mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-29 11:42:17 +00:00
Co-authored-by: Alireza Haghdoost <haghdoost@uber.com> Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
31 lines
739 B
TypeScript
31 lines
739 B
TypeScript
import { mergeProps } from "solid-js"
|
|
import { createSimpleContext } from "./helper"
|
|
|
|
export interface Args {
|
|
model?: string
|
|
agent?: string
|
|
prompt?: string
|
|
continue?: boolean
|
|
sessionID?: string
|
|
newSessionID?: string
|
|
fork?: boolean
|
|
auto?: boolean
|
|
}
|
|
|
|
export const { use: useArgs, provider: ArgsProvider } = createSimpleContext({
|
|
name: "Args",
|
|
init: (props: Args) => {
|
|
// The first new session created from home takes this ID; later ones mint their own.
|
|
let pending = props.newSessionID
|
|
return mergeProps(props, {
|
|
takeNewSessionID() {
|
|
const id = pending
|
|
pending = undefined
|
|
return id
|
|
},
|
|
restoreNewSessionID(id: string) {
|
|
pending ??= id
|
|
},
|
|
})
|
|
},
|
|
})
|