@chatcode/chatcode-cli 3.0.6-rc.2 → 3.0.6-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +24 -24
- package/runtime/manifest.json +1 -1
- package/runtime/node_modules/@chatcode/runtime-client/README.md +9 -6
- package/runtime/node_modules/@chatcode/runtime-client/index.d.ts +6 -12
- package/runtime/node_modules/@chatcode/runtime-client/package.json +1 -1
- package/runtime/node_modules/@chatcode/runtime-client/runtime-connector.mjs +16 -16
- package/runtime/node_modules/@chatcode/runtime-client/session-browser.mjs +1 -0
- package/runtime/node_modules/@deepseek-ai/dsh-agent-loop/lib/index.js +1 -1
- package/runtime/node_modules/@deepseek-ai/dsh-agent-preset-registry/lib/typert.host.js +3 -3
- package/runtime/node_modules/@deepseek-ai/dsh-api-remotes/lib/client.js +14 -4
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/client.js +1 -0
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/index.js +23 -10
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/typert.host.js +23 -13
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/typert.remote-client.d.ts +2 -2
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/typert.remote-client.js +10 -0
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/agent.d.ts +2 -1
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/agent.js +5 -3
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/commands.js +8 -3
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/index.d.ts +1 -0
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/index.js +1 -1
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/list.js +7 -3
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/types.d.ts +9 -0
- package/runtime/node_modules/@deepseek-ai/dsh-api-terminal-controller/lib/typert.host.js +3 -3
- package/runtime/node_modules/@deepseek-ai/dsh-client-file-upload/lib/typert.host.js +3 -3
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-account/lib/client.js +2 -2
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-account/lib/types/index.d.ts +2 -2
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-general/lib/client.js +1 -1
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-sidebar/lib/client.js +1 -1
- package/runtime/node_modules/@deepseek-ai/dsh-commands/lib/typert.host.js +3 -3
- package/runtime/node_modules/@deepseek-ai/dsh-cordis-host-runner/lib/typert.host.js +6 -6
- package/runtime/node_modules/@deepseek-ai/dsh-goal/lib/typert.host.js +3 -3
- package/runtime/node_modules/@deepseek-ai/dsh-llm/lib/index.js +17 -1
- package/runtime/node_modules/@deepseek-ai/dsh-llm/lib/typert.host.js +6 -6
- package/runtime/node_modules/@deepseek-ai/dsh-llm/lib/typert.remote-client.js +3 -3
- package/runtime/node_modules/@deepseek-ai/dsh-llm/lib/types/call-config.d.ts +4 -0
- package/runtime/node_modules/@deepseek-ai/dsh-llm/lib/types/call-config.js +1 -0
- package/runtime/node_modules/@deepseek-ai/dsh-llm/lib/types/index.js +24 -0
- package/runtime/node_modules/@deepseek-ai/dsh-llm/lib/types/types.d.ts +2 -0
- package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/index.js +7 -0
- package/runtime/node_modules/@deepseek-ai/dsh-llm-pi-ai/lib/index.js +15 -4
- package/runtime/node_modules/@deepseek-ai/dsh-permission-presets/lib/typert.host.js +3 -3
- package/runtime/node_modules/@deepseek-ai/dsh-repeat-tool-reminder/lib/index.js +16 -1
- package/runtime/node_modules/@deepseek-ai/dsh-session/lib/index.js +12 -1
- package/runtime/node_modules/@deepseek-ai/dsh-session/lib/types/index.d.ts +2 -0
- package/runtime/node_modules/@deepseek-ai/dsh-session/lib/types/index.js +13 -1
- package/runtime/node_modules/@deepseek-ai/dsh-session/lib/types/known-event-types.js +1 -0
- package/runtime/node_modules/@deepseek-ai/dsh-session/lib/types/types.d.ts +5 -0
- package/runtime/node_modules/@deepseek-ai/dsh-session-persistence-jsonl/lib/worker.cjs +22 -1
- package/runtime/node_modules/@deepseek-ai/dsh-session-reference/lib/typert.host.js +3 -3
- package/runtime/node_modules/@deepseek-ai/dsh-subagent/lib/index.js +1 -0
- package/runtime/node_modules/@deepseek-ai/dsh-subagent/lib/typert.host.js +3 -3
- package/runtime/node_modules/@deepseek-ai/dsh-subagent/lib/types/child-agent.js +1 -0
- package/runtime/node_modules/@deepseek-ai/dsh-subagent/lib/types/control.d.ts +1 -1
- package/runtime/node_modules/@deepseek-ai/dsh-tmux-context/lib/index.js +16 -1
- package/runtime/node_modules/@deepseek-ai/dsh-tool-cordis/lib/types/api-catalog.js +83 -20
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chatcode/chatcode-cli",
|
|
3
3
|
"description": "ChatCode CLI: TUI-first coding agent, Web launcher, profiles, and legacy DSH-compatible plugins",
|
|
4
|
-
"version": "3.0.6-rc.
|
|
4
|
+
"version": "3.0.6-rc.3",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -95,47 +95,47 @@
|
|
|
95
95
|
"ajv": "^8.20.0",
|
|
96
96
|
"execa": "^10.0.0",
|
|
97
97
|
"ws": "8.21.0",
|
|
98
|
-
"@deepseek-ai/dsh-
|
|
98
|
+
"@deepseek-ai/dsh-attachment-local": "0.1.7-rc.2",
|
|
99
99
|
"@deepseek-ai/dsh-agent": "0.1.7-rc.2",
|
|
100
|
-
"@deepseek-ai/dsh-
|
|
100
|
+
"@deepseek-ai/dsh-acp": "0.1.7-rc.2",
|
|
101
101
|
"@deepseek-ai/dsh-credentials-local": "0.1.7-rc.2",
|
|
102
|
-
"@deepseek-ai/dsh-agent-loop": "0.1.7-rc.2",
|
|
103
|
-
"@deepseek-ai/dsh-
|
|
104
|
-
"@deepseek-ai/dsh-bash-local": "0.1.7-rc.2",
|
|
102
|
+
"@deepseek-ai/dsh-agent-loop-testkit": "0.1.7-rc.2",
|
|
103
|
+
"@deepseek-ai/dsh-experimental-agent-team": "0.1.7-rc.2",
|
|
105
104
|
"@deepseek-ai/dsh-deepseek-llm-api-extensions": "0.1.7-rc.2",
|
|
105
|
+
"@deepseek-ai/dsh-agent-loop": "0.1.7-rc.2",
|
|
106
|
+
"@deepseek-ai/dsh-experimental-tool-agent-team": "0.1.7-rc.2",
|
|
107
|
+
"@deepseek-ai/dsh-fs-observation-policy": "0.1.7-rc.2",
|
|
106
108
|
"@deepseek-ai/dsh-experimental-ptc-runtime-python": "0.1.7-rc.2",
|
|
109
|
+
"@deepseek-ai/dsh-host-webserver": "0.1.7-rc.2",
|
|
107
110
|
"@deepseek-ai/dsh-fs-sandbox": "0.1.7-rc.2",
|
|
108
|
-
"@deepseek-ai/dsh-fs-observation-policy": "0.1.7-rc.2",
|
|
109
111
|
"@deepseek-ai/dsh-host-frontend-static": "0.1.7-rc.2",
|
|
110
|
-
"@deepseek-ai/dsh-
|
|
111
|
-
"@deepseek-ai/dsh-host-webserver": "0.1.7-rc.2",
|
|
112
|
-
"@deepseek-ai/dsh-llm": "0.1.7-rc.2",
|
|
113
|
-
"@deepseek-ai/dsh-llm-deepseek-account": "0.1.7-rc.2",
|
|
114
|
-
"@deepseek-ai/dsh-llm-mock-server": "0.1.7-rc.2",
|
|
112
|
+
"@deepseek-ai/dsh-bash-local": "0.1.7-rc.2",
|
|
115
113
|
"@deepseek-ai/dsh-llm-deepseek-api-key": "0.1.7-rc.2",
|
|
116
|
-
"@deepseek-ai/dsh-llm-pi-ai": "0.1.7-rc.2",
|
|
117
114
|
"@deepseek-ai/dsh-llm-deepseek": "0.1.7-rc.2",
|
|
118
|
-
"@deepseek-ai/dsh-
|
|
115
|
+
"@deepseek-ai/dsh-llm": "0.1.7-rc.2",
|
|
116
|
+
"@deepseek-ai/dsh-llm-pi-ai": "0.1.7-rc.2",
|
|
117
|
+
"@deepseek-ai/dsh-plugin-package-inventory-deepseek": "0.1.7-rc.2",
|
|
119
118
|
"@deepseek-ai/dsh-llm-replay": "0.1.7-rc.2",
|
|
119
|
+
"@deepseek-ai/dsh-sdk-client": "0.1.7-rc.2",
|
|
120
|
+
"@deepseek-ai/dsh-sandbox-local": "0.1.7-rc.2",
|
|
120
121
|
"@deepseek-ai/dsh-loader-smoke": "0.1.7-rc.2",
|
|
121
|
-
"@deepseek-ai/dsh-plugin-package-inventory-deepseek": "0.1.7-rc.2",
|
|
122
|
-
"@deepseek-ai/dsh-session": "0.1.7-rc.2",
|
|
123
122
|
"@deepseek-ai/dsh-sandbox-policy": "0.1.7-rc.2",
|
|
124
|
-
"@deepseek-ai/dsh-session
|
|
125
|
-
"@deepseek-ai/dsh-sandbox-local": "0.1.7-rc.2",
|
|
126
|
-
"@deepseek-ai/dsh-session-persistence-jsonl": "0.1.7-rc.2",
|
|
123
|
+
"@deepseek-ai/dsh-session": "0.1.7-rc.2",
|
|
127
124
|
"@deepseek-ai/dsh-session-query": "0.1.7-rc.2",
|
|
128
125
|
"@deepseek-ai/dsh-session-log-deepseek": "0.1.7-rc.2",
|
|
129
|
-
"@deepseek-ai/dsh-
|
|
130
|
-
"@deepseek-ai/dsh-sdk-client": "0.1.7-rc.2",
|
|
131
|
-
"@deepseek-ai/dsh-subagent": "0.1.7-rc.2",
|
|
126
|
+
"@deepseek-ai/dsh-llm-deepseek-account": "0.1.7-rc.2",
|
|
132
127
|
"@deepseek-ai/dsh-settings": "0.1.7-rc.2",
|
|
128
|
+
"@deepseek-ai/dsh-shell-env": "0.1.7-rc.2",
|
|
133
129
|
"@deepseek-ai/dsh-subagent-fork-in-process": "0.1.7-rc.2",
|
|
130
|
+
"@deepseek-ai/dsh-subagent": "0.1.7-rc.2",
|
|
131
|
+
"@deepseek-ai/dsh-session-persistence-jsonl": "0.1.7-rc.2",
|
|
132
|
+
"@deepseek-ai/dsh-session-checkpoint-policy": "0.1.7-rc.2",
|
|
133
|
+
"@deepseek-ai/dsh-llm-mock-server": "0.1.7-rc.2",
|
|
134
134
|
"@deepseek-ai/dsh-system-prompt": "0.1.7-rc.2",
|
|
135
|
-
"@deepseek-ai/dsh-subprocess-local": "0.1.7-rc.2",
|
|
136
135
|
"@deepseek-ai/dsh-subagent-spawn-in-process": "0.1.7-rc.2",
|
|
136
|
+
"@deepseek-ai/dsh-tools": "0.1.7-rc.2",
|
|
137
137
|
"@deepseek-ai/dsh-user-approval": "0.1.7-rc.2",
|
|
138
|
-
"@deepseek-ai/dsh-
|
|
138
|
+
"@deepseek-ai/dsh-subprocess-local": "0.1.7-rc.2"
|
|
139
139
|
},
|
|
140
140
|
"exports": {
|
|
141
141
|
"./headless-compat": {
|
package/runtime/manifest.json
CHANGED
|
@@ -48,11 +48,9 @@ Session callbacks receive snapshots, durable events, and assistant-stream frames
|
|
|
48
48
|
|
|
49
49
|
ChatCode account authentication is separate from tool approvals and local HTTP cookie authentication. When the host already owns a validated ChatCode account, pass its token only in the subprocess env field as CHATCODE_CLI_OAUTH_TOKEN. The host owns token validation, renewal, logout, and account isolation; restart the Connector after changing the token. This SDK version does not expose account login, status, or logout APIs. Neither createIntegrationPatch mode disables account authentication.
|
|
50
50
|
|
|
51
|
-
For application
|
|
51
|
+
For application identification, pass `appCredentials: { appId, secret }` to `new RuntimeConnector(options)` in the desktop backend. Both fields are required when the option is set. Use 1 to 128 printable ASCII characters for the ID and 1 to 1024 for the secret, without spaces. If the backend reads the secret from an environment variable, omit that variable from the subprocess `env` option. A distributed SDK or installer cannot protect a shared long-lived secret. An installation can use a credential provisioned separately by the operator or by an authorization service.
|
|
52
52
|
|
|
53
|
-
The SDK sends `X-ChatCode-App-Id` and `X-ChatCode-App-Secret`
|
|
54
|
-
|
|
55
|
-
Invalid configuration throws `runtime/app-credentials` during construction. HTTP 401 or 403 during the exchange rejects startup with `runtime/app-auth`. A cookie without the application authentication acknowledgment rejects startup with `runtime/app-auth-unsupported`. Omitting the option uses the regular local-cookie exchange. With application credentials configured, the SDK requires a Runtime version that implements the application exchange.
|
|
53
|
+
The SDK sends `X-ChatCode-App-Id` and `X-ChatCode-App-Secret` in the local launch token exchange and copies `appCredentials.appId` into each new Session. The Session log, creation result, Session list and unified conversation report carry optional `appId`; resuming preserves the recorded value, including its absence on legacy Sessions. Malformed local credentials throw `runtime/app-credentials`. Application credential verification is deferred. The launch exchange accepts the normal local cookie without an application acknowledgment, while HTTP 401/403 still reject startup. Secrets are excluded from Session metadata.
|
|
56
54
|
|
|
57
55
|
The current Web profile also checks ChatCode/CVP launch admission before binding HTTP. Both integration modes preserve this check. Prepare the Runtime’s required service access and credentials, then verify that its launcher starts; report admission failures as Runtime startup errors rather than tool approval requests.
|
|
58
56
|
|
|
@@ -110,9 +108,9 @@ Call `releaseSession(sessionId)` only after completing or cancelling pending wor
|
|
|
110
108
|
|
|
111
109
|
Beginning a return revokes terminal checks, heartbeats, and model-preference reads. Asynchronous callbacks revalidate the same active, unexpired lease before returning a decision. A failed return retains the reservation and remains revoked; the original lease may retry return even after expiry. `owns()` reports this reservation, not execution permission. These checks do not retract decisions already delivered or roll back tools already executing.
|
|
112
110
|
|
|
113
|
-
###
|
|
111
|
+
### Model ownership
|
|
114
112
|
|
|
115
|
-
The
|
|
113
|
+
The host supplies the model catalog. The SDK exposes no `modelCatalog`, `selectModel`, or `RuntimeModelCatalog` API. Ordinary CLI and Web launches keep their model selectors.
|
|
116
114
|
|
|
117
115
|
### Desktop integration model
|
|
118
116
|
|
|
@@ -143,6 +141,7 @@ await runtime.prompt({
|
|
|
143
141
|
sessionId, requestId, mode: 'queue', content: [{ type: 'text', text: 'Hello' }],
|
|
144
142
|
modelConfig: {
|
|
145
143
|
provider: 'openai', model: 'gpt-4o', protocol: 'openai-completions',
|
|
144
|
+
baseUrl: 'https://api.example.com/v1',
|
|
146
145
|
apiKey,
|
|
147
146
|
options: { temperature: 0, contextWindow: 128_000, maxTokens: 4096, top_p: 0.9 },
|
|
148
147
|
},
|
|
@@ -151,6 +150,8 @@ await runtime.prompt({
|
|
|
151
150
|
|
|
152
151
|
The Runtime applies `contextWindow` to context budgeting, `maxTokens` and `temperature` to generation, and `reasoningEffort` to a reasoning level advertised by the route. Runtime passes the remaining keys in `options` to the registered protocol adapter. The pi-ai Chat Completions, Responses, Messages, and Google GenerateContent paths and the native DeepSeek adapter forward extra JSON generation fields. For example, use `reasoning_effort` for Chat Completions, `reasoning.effort` for Responses, or `output_config.effort` for Messages. Google puts these fields in `generationConfig` and maps `thinking_level` to `thinkingConfig.thinkingLevel`. Runtime owns routing, input, tools, streaming, transport, and authentication. The upstream model decides which extra fields it accepts. Configuration errors carry `session/invalid-model-config` and a field path. Reuse the same `requestId` and payload when retrying admission. Use `assertPromptModelConfig({ unifiedOptions: true })` before sending unified options to check Runtime support. Older clients may still send separate `protocolOptions` or use the top-level `provider` and `model` fields. When using separate objects, each key must occur in only one. Supply `modelConfig.apiKey` with each prompt that uses a desktop API key. The SDK checks Runtime support before sending. Runtime uses the key in memory for the submitted model and records only a credential-required marker. After restarting, retry a queued prompt with the same ID, content, configuration and key before resuming work. Supply ChatCode OAuth grants through `setLoginToken`.
|
|
153
152
|
|
|
153
|
+
`modelConfig.baseUrl` is an optional service URL beside `apiKey`, not a generation option. It accepts HTTP(S) without embedded credentials, query, or fragment and requires a caller-supplied `apiKey`; configured credentials and profile headers are not sent to the supplied destination. The URL follows the queued message, its retries, and request headers without changing global provider configuration. The registered provider/model still selects the protocol adapter. Omit it to use the original provider endpoint. `assertPromptModelConfig({ baseUrl: true })` checks `requestBaseUrl` support; the SDK checks automatically before sending a configured URL.
|
|
154
|
+
|
|
154
155
|
`AccountModelPreferences` stores only provider, model and revision under a private per-user account directory. The caller derives its owner fingerprint from the server-validated account API origin and normalized email. It never accepts an environment token as identity proof. Cherry publishes its accepted choice; the official CLI adopts it while idle and checks before new input. A busy CLI finishes its current task first. Unavailable routes retain the current model and show a warning. Logout and different accounts do not share choices. Desktop handoff reads the preference through its original host lease and retains that host's allowed model routes. This feature does not share credentials, Session homes or permissions, and does not change other Cherry Agents' stored models.
|
|
155
156
|
|
|
156
157
|
<a id="build-and-publish"></a>
|
|
@@ -175,6 +176,8 @@ node tests/permission-smoke.mjs ../../..
|
|
|
175
176
|
node tests/history-smoke.mjs ../../..
|
|
176
177
|
```
|
|
177
178
|
|
|
179
|
+
From the repository root, `node packages/sdk/runtime-client/tests/model-endpoint-smoke.mjs` checks two prompt-local endpoints, their API keys, original application identity after restart, and the removed SDK catalog methods using the installed configuration plugin.
|
|
180
|
+
|
|
178
181
|
The history fixture boots the real launcher against loopback model and CVP protocol fixtures, preserves launch checks, and checks native writer ownership and real file effects in both tool modes. It does not validate production accounts or platform admission. Add `--terminal` to exercise the actual interactive TUI in a private fixture. Add `--picker` to start an ordinary CLI and select the isolated desktop Session through `/resume`; `--inline` selects an inline parent terminal.
|
|
179
182
|
|
|
180
183
|
<a id="understand-the-implementation"></a>
|
|
@@ -12,6 +12,8 @@ type SessionExecutionPrompt = {
|
|
|
12
12
|
|
|
13
13
|
/** Model route and JSON options applied to one queued user prompt. */
|
|
14
14
|
export interface PromptModelConfig {
|
|
15
|
+
/** HTTP(S) service URL supplied for this prompt; requires a prompt API key. */
|
|
16
|
+
baseUrl?: string
|
|
15
17
|
provider: string
|
|
16
18
|
model: string
|
|
17
19
|
protocol?: string
|
|
@@ -37,7 +39,7 @@ export interface RuntimeOptions {
|
|
|
37
39
|
home: string
|
|
38
40
|
patches?: string[]
|
|
39
41
|
env?: Record<string, string | undefined>
|
|
40
|
-
/**
|
|
42
|
+
/** Application metadata forwarded to the Runtime; application credential verification is deferred. */
|
|
41
43
|
appCredentials?: RuntimeAppCredentials
|
|
42
44
|
processCwd?: string
|
|
43
45
|
startupTimeoutMs?: number
|
|
@@ -122,14 +124,8 @@ export function createDesktopHistoryClient(options?: { directory?: string }): {
|
|
|
122
124
|
has(id: string): boolean
|
|
123
125
|
prepare(id: string): Promise<() => Promise<number>>
|
|
124
126
|
}
|
|
125
|
-
/** Safe Runtime model metadata; credentials remain in Runtime plugins. */
|
|
126
127
|
export type WorkspaceAccess = 'read-only' | 'workspace-write' | 'danger-full-access'
|
|
127
128
|
export type SessionAddress = { kind: 'session'; sessionId: string } | { kind: 'subagent'; parentSessionId: string; childSessionId: string; mode: 'one-shot' | 'continuable' | 'unknown' }
|
|
128
|
-
export interface RuntimeModelCatalog {
|
|
129
|
-
default: { provider: string; model: string }
|
|
130
|
-
groups: Array<{ id: string; name: string; models: Array<{ id: string; name: string; inputModalities?: Array<'text' | 'image'> }> }>
|
|
131
|
-
failures: Array<{ id: string; name: string; message: string }>
|
|
132
|
-
}
|
|
133
129
|
/** Local preferences require a SHA-256 owner fingerprint from a validated account. */
|
|
134
130
|
export class AccountModelPreferences {
|
|
135
131
|
constructor(options?: { directory?: string })
|
|
@@ -158,9 +154,6 @@ export class RuntimeConnector {
|
|
|
158
154
|
onFailure?: (error: Error) => void,
|
|
159
155
|
signal?: AbortSignal,
|
|
160
156
|
): Promise<() => void>
|
|
161
|
-
modelCatalog(options?: { refresh?: boolean }): Promise<RuntimeModelCatalog>
|
|
162
|
-
/** Select an available route for the next request on the same Session. */
|
|
163
|
-
selectModel(request: { sessionId: string; provider: string; model: string }): Promise<{ selected: { provider: string; model: string } }>
|
|
164
157
|
/**
|
|
165
158
|
* Create a new Session, optionally with provider/model.
|
|
166
159
|
* @param request - Workspace, optional Session identity, and optional provider/model.
|
|
@@ -197,7 +190,7 @@ export class RuntimeConnector {
|
|
|
197
190
|
signal?: AbortSignal,
|
|
198
191
|
): Promise<() => void>
|
|
199
192
|
/** Reject unless the Runtime supports request-local prompt model configuration. */
|
|
200
|
-
assertPromptModelConfig(options?: { apiKey?: boolean; unifiedOptions?: boolean }): Promise<void>
|
|
193
|
+
assertPromptModelConfig(options?: { apiKey?: boolean; unifiedOptions?: boolean; baseUrl?: boolean }): Promise<void>
|
|
201
194
|
/**
|
|
202
195
|
* Admit new user content without waiting for the turn.
|
|
203
196
|
* @param request - Session, stable request identity, and content.
|
|
@@ -407,6 +400,7 @@ export interface RuntimeWorkspace {
|
|
|
407
400
|
}
|
|
408
401
|
/** Cold-safe summary; the host need not load transcript bodies or activate Sessions. */
|
|
409
402
|
export interface RuntimeSessionSummary {
|
|
403
|
+
appId?: string
|
|
410
404
|
sessionId: string
|
|
411
405
|
title: string | null
|
|
412
406
|
updatedAt: number
|
|
@@ -432,7 +426,7 @@ export type SessionCreateOptions = ({ workspaceId: string; cwd?: never } | { cwd
|
|
|
432
426
|
sessionId?: string
|
|
433
427
|
agentPreset?: string
|
|
434
428
|
}
|
|
435
|
-
export interface SessionIdentity { sessionId: string; agentPreset?: string }
|
|
429
|
+
export interface SessionIdentity { sessionId: string; agentPreset?: string; appId?: string }
|
|
436
430
|
/** Omit location to resolve the saved cwd through the cold-safe Session list. */
|
|
437
431
|
export interface SessionResumeOptions { sessionId: string; workspaceId?: string; cwd?: string; agentPreset?: string }
|
|
438
432
|
/** Raw Web Workspace frames retain ISO timestamps; list APIs normalize them to epoch milliseconds. */
|
|
@@ -26,7 +26,6 @@ function redact(text) { return text.replace(/([?&]token=)[^\s&]+/gu, '$1[redacte
|
|
|
26
26
|
|
|
27
27
|
const APP_ID_HEADER = 'x-chatcode-app-id'
|
|
28
28
|
const APP_SECRET_HEADER = 'x-chatcode-app-secret'
|
|
29
|
-
const APP_AUTHENTICATED_HEADER = 'x-chatcode-app-authenticated'
|
|
30
29
|
|
|
31
30
|
/** Owns one public-profile Runtime and one multiplexed WebSocket. */
|
|
32
31
|
export class RuntimeConnector {
|
|
@@ -154,9 +153,6 @@ export class RuntimeConnector {
|
|
|
154
153
|
throw failure('Runtime rejected application authentication', 'runtime/app-auth')
|
|
155
154
|
}
|
|
156
155
|
if (auth.status !== 303 || !auth.headers['set-cookie']?.length) throw failure('Host authentication failed', 'runtime/auth')
|
|
157
|
-
if (credentials && auth.headers[APP_AUTHENTICATED_HEADER] !== '1') {
|
|
158
|
-
throw failure('Runtime did not confirm application authentication', 'runtime/app-auth-unsupported')
|
|
159
|
-
}
|
|
160
156
|
this.#cookie = auth.headers['set-cookie'].map(value => value.split(';')[0]).join('; ')
|
|
161
157
|
this.#origin = launchURL.origin
|
|
162
158
|
if (this.#closed || child.exitCode !== null || child.signalCode !== null) throw new Error('Runtime stopped during startup')
|
|
@@ -221,15 +217,6 @@ export class RuntimeConnector {
|
|
|
221
217
|
return message.result.value
|
|
222
218
|
}
|
|
223
219
|
|
|
224
|
-
/**
|
|
225
|
-
* With sessionId, restore that Session instead of minting a new one.
|
|
226
|
-
* @param request - Absolute workspace and optional persisted Session identity.
|
|
227
|
-
* @returns The Runtime-owned Session identity.
|
|
228
|
-
*/
|
|
229
|
-
/** Read safe model names and routes from the live Runtime registry. */
|
|
230
|
-
modelCatalog(options = {}) { return this.#rpcArgs(options.refresh ? 'session/refreshModelCatalog' : 'session/modelCatalog', {}) }
|
|
231
|
-
/** Select an available route for the next request on the same Session. */
|
|
232
|
-
selectModel(request) { return this.#rpc('session/selectModel', request) }
|
|
233
220
|
permissionCatalog() { return this.#rpcArgs('permissionPresets/catalog', {}) }
|
|
234
221
|
getWorkspaceAccess(sessionId) { return this.#rpc('session/workspaceAccess', { sessionId }) }
|
|
235
222
|
setWorkspaceAccess(request) { return this.#rpc('session/setWorkspaceAccess', request) }
|
|
@@ -292,10 +279,20 @@ export class RuntimeConnector {
|
|
|
292
279
|
}
|
|
293
280
|
return this.#rpc('session/create', { ...location, resumeOnly: true })
|
|
294
281
|
}
|
|
295
|
-
|
|
282
|
+
/**
|
|
283
|
+
* Create a Session with the Connector's application identity or adopt an existing identity.
|
|
284
|
+
* @param request - Workspace and optional persisted Session identity.
|
|
285
|
+
* @returns The Runtime-owned Session identity and its original application ID.
|
|
286
|
+
*/
|
|
287
|
+
createSession(request) {
|
|
288
|
+
return this.#rpc('session/create', {
|
|
289
|
+
...request,
|
|
290
|
+
...(this.#appCredentials === undefined ? {} : { appId: this.#appCredentials.appId }),
|
|
291
|
+
})
|
|
292
|
+
}
|
|
296
293
|
/**
|
|
297
294
|
* Confirm this Runtime supports request-local prompt model configuration.
|
|
298
|
-
* @param options - require support for prompt API keys or unified model options.
|
|
295
|
+
* @param options - require support for prompt API keys, service URLs, or unified model options.
|
|
299
296
|
* @returns A promise that rejects when the requested capability is unavailable.
|
|
300
297
|
*/
|
|
301
298
|
async assertPromptModelConfig(options = {}) {
|
|
@@ -312,6 +309,9 @@ export class RuntimeConnector {
|
|
|
312
309
|
if (options.apiKey && capability.requestApiKey !== true) {
|
|
313
310
|
throw failure('Runtime does not support API keys supplied with prompts', 'runtime/model-config-unsupported')
|
|
314
311
|
}
|
|
312
|
+
if (options.baseUrl && capability.requestBaseUrl !== true) {
|
|
313
|
+
throw failure('Runtime does not support service URLs supplied with prompts', 'runtime/model-config-unsupported')
|
|
314
|
+
}
|
|
315
315
|
if (options.unifiedOptions && capability.unifiedOptions !== true) {
|
|
316
316
|
throw failure('Runtime does not support unified prompt model options', 'runtime/model-config-unsupported')
|
|
317
317
|
}
|
|
@@ -348,7 +348,7 @@ export class RuntimeConnector {
|
|
|
348
348
|
return existing.promise
|
|
349
349
|
}
|
|
350
350
|
const submit = () => this.#rpc('session/prompt', wire)
|
|
351
|
-
const promise = (configured ? this.assertPromptModelConfig({ apiKey: wire.modelConfig.apiKey !== undefined }).then(submit) : submit()).finally(() => this.#prompts.delete(key))
|
|
351
|
+
const promise = (configured ? this.assertPromptModelConfig({ apiKey: wire.modelConfig.apiKey !== undefined, baseUrl: wire.modelConfig.baseUrl !== undefined }).then(submit) : submit()).finally(() => this.#prompts.delete(key))
|
|
352
352
|
this.#prompts.set(key, { payload, wire, promise })
|
|
353
353
|
return promise
|
|
354
354
|
}
|
|
@@ -58,6 +58,7 @@ export function readSessionSummaries(value) {
|
|
|
58
58
|
running: row.running,
|
|
59
59
|
blank: row.blank,
|
|
60
60
|
...(row.cwd === undefined ? {} : { cwd: string(row.cwd) }),
|
|
61
|
+
...(row.appId === undefined ? {} : { appId: string(row.appId) }),
|
|
61
62
|
...(row.origin === undefined ? {} : { origin: row.origin }),
|
|
62
63
|
...(row.parentSessionId === undefined ? {} : { parentSessionId: string(row.parentSessionId) })
|
|
63
64
|
}
|
|
@@ -1222,7 +1222,7 @@ var ReactLoopAgent = class {
|
|
|
1222
1222
|
}, () => Promise.resolve(seedConfig));
|
|
1223
1223
|
signal.throwIfAborted();
|
|
1224
1224
|
if (!proposedConfig.provider || !proposedConfig.model) throw new Error(`agent "${this.id}" has no provider/model: set AgentOptions.provider and AgentOptions.model or supply both via the agent/request waterfall`);
|
|
1225
|
-
if (promptApiKey !== void 0 && (proposedConfig.provider !== promptConfig?.provider || proposedConfig.model !== promptConfig.model)) throw new LlmError("A prompt API key can only be used with its submitted model route", "INVALID_REQUEST");
|
|
1225
|
+
if (promptApiKey !== void 0 && (proposedConfig.provider !== promptConfig?.provider || proposedConfig.model !== promptConfig.model || proposedConfig.baseUrl !== promptConfig.baseUrl)) throw new LlmError("A prompt API key can only be used with its submitted model route", "INVALID_REQUEST");
|
|
1226
1226
|
let config;
|
|
1227
1227
|
let preparedCall;
|
|
1228
1228
|
try {
|
|
@@ -496,7 +496,7 @@ export const TYPERT = {
|
|
|
496
496
|
},
|
|
497
497
|
{
|
|
498
498
|
"name": "LlmCallConfig",
|
|
499
|
-
"declaration": "export interface LlmCallConfig {\n provider: string;\n model: string;\n reasoningEffort?: ReasoningEffortId;\n temperature?: number;\n maxTokens?: number;\n stop?: string[];\n contextWindow?: number;\n protocol?: string;\n protocolOptions?: Readonly<Record<string, JsonValue>>;\n}"
|
|
499
|
+
"declaration": "export interface LlmCallConfig {\n baseUrl?: string;\n provider: string;\n model: string;\n reasoningEffort?: ReasoningEffortId;\n temperature?: number;\n maxTokens?: number;\n stop?: string[];\n contextWindow?: number;\n protocol?: string;\n protocolOptions?: Readonly<Record<string, JsonValue>>;\n}"
|
|
500
500
|
},
|
|
501
501
|
{
|
|
502
502
|
"name": "LlmCallConfigAdapterDefaults",
|
|
@@ -636,7 +636,7 @@ export const TYPERT = {
|
|
|
636
636
|
},
|
|
637
637
|
{
|
|
638
638
|
"name": "Session",
|
|
639
|
-
"declaration": "export class Session {\n get surface(): SessionSurface;\n readonly header: SessionHeader;\n readonly inheritedEventCount: SessionLogOffset;\n get id(): SessionId;\n readonly firstLiveSeq: SessionLogOffset;\n readonly firstLifecycleSeq: SessionLogOffset;\n eventAt(seq: SessionSeq): SessionEvent | undefined;\n snapshotEvents(fromSeq: SessionLogOffset = SessionLogOffset(0), toSeqExclusive: SessionLogOffset = this.seq): readonly SessionEvent[];\n ownEvents(): readonly SessionEvent[];\n isOwnSeq(seq: SessionSeq): boolean;\n get seq(): SessionLogOffset;\n append<T extends SessionEventType>(type: T, data: SessionEventMap[T], ...opts: T extends SurfaceEventType ? [opts: SurfaceIntent<T>] : []): SessionEvent<T>;\n requestHeader(): EpochHeader | undefined;\n requestContext(): RequestContext | undefined;\n toolHistory(): ToolHistory;\n deriveMessages(): Message[];\n deriveEventMessage(event: SessionEvent): Message | null;\n}"
|
|
639
|
+
"declaration": "export class Session {\n get surface(): SessionSurface;\n readonly header: SessionHeader;\n readonly inheritedEventCount: SessionLogOffset;\n get id(): SessionId;\n readonly firstLiveSeq: SessionLogOffset;\n readonly firstLifecycleSeq: SessionLogOffset;\n get appId(): string | undefined;\n eventAt(seq: SessionSeq): SessionEvent | undefined;\n snapshotEvents(fromSeq: SessionLogOffset = SessionLogOffset(0), toSeqExclusive: SessionLogOffset = this.seq): readonly SessionEvent[];\n ownEvents(): readonly SessionEvent[];\n isOwnSeq(seq: SessionSeq): boolean;\n get seq(): SessionLogOffset;\n append<T extends SessionEventType>(type: T, data: SessionEventMap[T], ...opts: T extends SurfaceEventType ? [opts: SurfaceIntent<T>] : []): SessionEvent<T>;\n requestHeader(): EpochHeader | undefined;\n requestContext(): RequestContext | undefined;\n toolHistory(): ToolHistory;\n deriveMessages(): Message[];\n deriveEventMessage(event: SessionEvent): Message | null;\n}"
|
|
640
640
|
},
|
|
641
641
|
{
|
|
642
642
|
"name": "SessionEvent",
|
|
@@ -644,7 +644,7 @@ export const TYPERT = {
|
|
|
644
644
|
},
|
|
645
645
|
{
|
|
646
646
|
"name": "SessionEventMap",
|
|
647
|
-
"declaration": "export interface SessionEventMap {\n 'turn/start': { turn: number; };\n 'turn/end': { turn: number; reason: TurnEndReason; };\n 'step/start': { turn: number; step: number; };\n 'step/end': { turn: number; step: number; };\n 'user/message': UserMessage;\n 'developer/message': { turn: number; step: number; message: DeveloperMessage; headerSeq?: SessionSeq; };\n 'system/message': { turn: number; step: number; message: SystemMessage; };\n 'assistant/message': { turn: number; step: number; message: AssistantMessage; stream: AssistantStreamRecord[]; usage?: TokenUsage; interrupted?: true; };\n 'assistant/attempt': { turn: number; step: number; stream: AssistantStreamRecord[]; };\n 'tool/call': { turn: number; step: number; callId: ToolCallId; name: string; arguments: string; };\n 'tool/result': { turn: number; step: number; message: ToolResultMessage; error?: { name: string; code: string; reason?: string; }; meta?: JsonValue; };\n 'request/header': { header: EpochHeader; reason: RequestHeaderReason; startsSeries?: true; };\n 'request/context': RequestContext;\n 'session/end-seed': { inherited?: true; };\n 'agent/inbox/spliced': { target: InboxTarget; start: number; removedCount?: number; inserted: UserMessage[]; outcome?: 'canceled'; };\n 'sandbox/mode': { mode: SandboxMode; source?: 'delegation'; };\n 'approval/asked': { id: ApprovalRequestId; toolName: string; callId?: ToolCallId; reason?: string; };\n 'approval/decided': { id: ApprovalRequestId; outcome: ApprovalOutcome; };\n 'approval/policy': { policy: ApprovalPolicy; source?: 'delegation'; };\n 'tool/ptc-dispatch-start': PtcDispatchStartEventData;\n 'tool/ptc-dispatch': PtcDispatchEventData;\n 'agent-preset/selected': { agentPreset: string; };\n 'command/run': { commandId: CommandId; name: string; args?: string; source: CommandSource; };\n 'command/done': { commandId: CommandId; kind: 'success' | 'error'; text?: string; sourceEventSeq?: import('@deepseek-ai/dsh-session/types').SessionSeq; };\n 'image/offload': { targets: ImageOffloadTarget[]; };\n 'session/title': SessionTitleEventData;\n 'todo/write': { todos: TodoItem[]; };\n 'model/selection': ModelSelection;\n 'subagent/descriptor': SubagentDescriptorData;\n 'permission/preset': { preset: string; };\n 'subagent/catalog': SubagentCatalogEvent;\n 'feedback/record': FeedbackRecord;\n 'goal/change': GoalChangeMeta;\n 'feedback/message-put': MessageFeedbackPut;\n 'feedback/message-delete': MessageFeedbackDelete;\n 'schedule/change': ScheduleChange;\n 'compaction/start': { compactionId: CompactionId; sourceCommandId?: CommandId; turn: number | null; };\n 'compaction/summary': { compactionId: CompactionId; sourceCommandId?: CommandId; summary: ContentBlock[]; shadowedRange: { start: SessionSeq; end: SessionSeq; }; shadowedSeqs: SessionSeq[]; shadowedTokenCount: number; provider: string; model: string; maxTokens?: number; usage?: TokenUsage; } & ({ rawOutput: ContentBlock[]; llmStreamCall: true; } | { rawOutput?: ContentBlock[]; llmStreamCall?: never; });\n 'compaction/end': { compactionId: CompactionId; sourceCommandId?: CommandId; turn: number | null; error?: string; };\n 'compaction/prune': { shadowedRange: { start: SessionSeq; end: SessionSeq; }; shadowedSeqs: SessionSeq[]; shadowedTokenCount: number; };\n}"
|
|
647
|
+
"declaration": "export interface SessionEventMap {\n 'session/application': { appId: string; };\n 'turn/start': { turn: number; };\n 'turn/end': { turn: number; reason: TurnEndReason; };\n 'step/start': { turn: number; step: number; };\n 'step/end': { turn: number; step: number; };\n 'user/message': UserMessage;\n 'developer/message': { turn: number; step: number; message: DeveloperMessage; headerSeq?: SessionSeq; };\n 'system/message': { turn: number; step: number; message: SystemMessage; };\n 'assistant/message': { turn: number; step: number; message: AssistantMessage; stream: AssistantStreamRecord[]; usage?: TokenUsage; interrupted?: true; };\n 'assistant/attempt': { turn: number; step: number; stream: AssistantStreamRecord[]; };\n 'tool/call': { turn: number; step: number; callId: ToolCallId; name: string; arguments: string; };\n 'tool/result': { turn: number; step: number; message: ToolResultMessage; error?: { name: string; code: string; reason?: string; }; meta?: JsonValue; };\n 'request/header': { header: EpochHeader; reason: RequestHeaderReason; startsSeries?: true; };\n 'request/context': RequestContext;\n 'session/end-seed': { inherited?: true; };\n 'agent/inbox/spliced': { target: InboxTarget; start: number; removedCount?: number; inserted: UserMessage[]; outcome?: 'canceled'; };\n 'sandbox/mode': { mode: SandboxMode; source?: 'delegation'; };\n 'approval/asked': { id: ApprovalRequestId; toolName: string; callId?: ToolCallId; reason?: string; };\n 'approval/decided': { id: ApprovalRequestId; outcome: ApprovalOutcome; };\n 'approval/policy': { policy: ApprovalPolicy; source?: 'delegation'; };\n 'tool/ptc-dispatch-start': PtcDispatchStartEventData;\n 'tool/ptc-dispatch': PtcDispatchEventData;\n 'agent-preset/selected': { agentPreset: string; };\n 'command/run': { commandId: CommandId; name: string; args?: string; source: CommandSource; };\n 'command/done': { commandId: CommandId; kind: 'success' | 'error'; text?: string; sourceEventSeq?: import('@deepseek-ai/dsh-session/types').SessionSeq; };\n 'image/offload': { targets: ImageOffloadTarget[]; };\n 'session/title': SessionTitleEventData;\n 'todo/write': { todos: TodoItem[]; };\n 'model/selection': ModelSelection;\n 'subagent/descriptor': SubagentDescriptorData;\n 'permission/preset': { preset: string; };\n 'subagent/catalog': SubagentCatalogEvent;\n 'feedback/record': FeedbackRecord;\n 'goal/change': GoalChangeMeta;\n 'feedback/message-put': MessageFeedbackPut;\n 'feedback/message-delete': MessageFeedbackDelete;\n 'schedule/change': ScheduleChange;\n 'compaction/start': { compactionId: CompactionId; sourceCommandId?: CommandId; turn: number | null; };\n 'compaction/summary': { compactionId: CompactionId; sourceCommandId?: CommandId; summary: ContentBlock[]; shadowedRange: { start: SessionSeq; end: SessionSeq; }; shadowedSeqs: SessionSeq[]; shadowedTokenCount: number; provider: string; model: string; maxTokens?: number; usage?: TokenUsage; } & ({ rawOutput: ContentBlock[]; llmStreamCall: true; } | { rawOutput?: ContentBlock[]; llmStreamCall?: never; });\n 'compaction/end': { compactionId: CompactionId; sourceCommandId?: CommandId; turn: number | null; error?: string; };\n 'compaction/prune': { shadowedRange: { start: SessionSeq; end: SessionSeq; }; shadowedSeqs: SessionSeq[]; shadowedTokenCount: number; };\n}"
|
|
648
648
|
},
|
|
649
649
|
{
|
|
650
650
|
"name": "SessionEventType",
|
|
@@ -6986,7 +6986,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6986
6986
|
},
|
|
6987
6987
|
sourceLocation: {
|
|
6988
6988
|
"file": "packages/llm/llm/src/index.ts",
|
|
6989
|
-
"line":
|
|
6989
|
+
"line": 713,
|
|
6990
6990
|
"column": 9
|
|
6991
6991
|
}
|
|
6992
6992
|
},
|
|
@@ -7004,7 +7004,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
7004
7004
|
},
|
|
7005
7005
|
sourceLocation: {
|
|
7006
7006
|
"file": "packages/llm/llm/src/index.ts",
|
|
7007
|
-
"line":
|
|
7007
|
+
"line": 625,
|
|
7008
7008
|
"column": 3
|
|
7009
7009
|
}
|
|
7010
7010
|
},
|
|
@@ -7022,7 +7022,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
7022
7022
|
},
|
|
7023
7023
|
sourceLocation: {
|
|
7024
7024
|
"file": "packages/llm/llm/src/index.ts",
|
|
7025
|
-
"line":
|
|
7025
|
+
"line": 553,
|
|
7026
7026
|
"column": 3
|
|
7027
7027
|
}
|
|
7028
7028
|
}
|
|
@@ -9799,6 +9799,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
9799
9799
|
])
|
|
9800
9800
|
}))]).optional(),
|
|
9801
9801
|
"sessionListMetadata": object({
|
|
9802
|
+
"appId": union([_undefined(), string()]).readonly().optional(),
|
|
9802
9803
|
"hasUserPrompt": boolean().readonly().optional(),
|
|
9803
9804
|
"blank": boolean().readonly(),
|
|
9804
9805
|
"lastPromptAt": union([literal(null), number()]).readonly()
|
|
@@ -9920,6 +9921,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
9920
9921
|
}))]);
|
|
9921
9922
|
let _deepseek_ai_dsh_api_session_controller_session_create_parameter_0$schema$value;
|
|
9922
9923
|
const _deepseek_ai_dsh_api_session_controller_session_create_parameter_0$schema = () => _deepseek_ai_dsh_api_session_controller_session_create_parameter_0$schema$value ??= object({
|
|
9924
|
+
"appId": string().readonly().optional(),
|
|
9923
9925
|
"resumeOnly": boolean().readonly().optional(),
|
|
9924
9926
|
"workspaceId": intersection(string(), unknown()).readonly().optional(),
|
|
9925
9927
|
"cwd": string().readonly().optional(),
|
|
@@ -9930,6 +9932,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
9930
9932
|
});
|
|
9931
9933
|
let _deepseek_ai_dsh_api_session_controller_session_create_result$schema$value;
|
|
9932
9934
|
const _deepseek_ai_dsh_api_session_controller_session_create_result$schema = () => _deepseek_ai_dsh_api_session_controller_session_create_result$schema$value ??= object({
|
|
9935
|
+
"appId": string().readonly().optional(),
|
|
9933
9936
|
"sessionId": intersection(string(), unknown()).readonly(),
|
|
9934
9937
|
"agentPreset": string().readonly().optional()
|
|
9935
9938
|
});
|
|
@@ -10078,6 +10081,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
10078
10081
|
])
|
|
10079
10082
|
}))]).optional(),
|
|
10080
10083
|
"sessionListMetadata": object({
|
|
10084
|
+
"appId": union([_undefined(), string()]).readonly().optional(),
|
|
10081
10085
|
"hasUserPrompt": boolean().readonly().optional(),
|
|
10082
10086
|
"blank": boolean().readonly(),
|
|
10083
10087
|
"lastPromptAt": union([literal(null), number()]).readonly()
|
|
@@ -10257,6 +10261,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
10257
10261
|
const _deepseek_ai_dsh_api_session_controller_session_list_parameter_0$schema = () => _deepseek_ai_dsh_api_session_controller_session_list_parameter_0$schema$value ??= object({ "cursor": string().readonly().optional() });
|
|
10258
10262
|
let _deepseek_ai_dsh_api_session_controller_session_list_result$schema$value;
|
|
10259
10263
|
const _deepseek_ai_dsh_api_session_controller_session_list_result$schema = () => _deepseek_ai_dsh_api_session_controller_session_list_result$schema$value ??= object({ "items": array(object({
|
|
10264
|
+
"appId": string().readonly().optional(),
|
|
10260
10265
|
"agentAvailable": boolean().readonly(),
|
|
10261
10266
|
"sessionId": intersection(string(), unknown()).readonly(),
|
|
10262
10267
|
"updatedAt": number().readonly(),
|
|
@@ -10300,6 +10305,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
10300
10305
|
])
|
|
10301
10306
|
}))]).optional(),
|
|
10302
10307
|
"sessionListMetadata": object({
|
|
10308
|
+
"appId": union([_undefined(), string()]).readonly().optional(),
|
|
10303
10309
|
"hasUserPrompt": boolean().readonly().optional(),
|
|
10304
10310
|
"blank": boolean().readonly(),
|
|
10305
10311
|
"lastPromptAt": union([literal(null), number()]).readonly()
|
|
@@ -10553,6 +10559,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
10553
10559
|
])
|
|
10554
10560
|
}))]).optional(),
|
|
10555
10561
|
"sessionListMetadata": object({
|
|
10562
|
+
"appId": union([_undefined(), string()]).readonly().optional(),
|
|
10556
10563
|
"hasUserPrompt": boolean().readonly().optional(),
|
|
10557
10564
|
"blank": boolean().readonly(),
|
|
10558
10565
|
"lastPromptAt": union([literal(null), number()]).readonly()
|
|
@@ -10691,6 +10698,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
10691
10698
|
"provider": string().readonly(),
|
|
10692
10699
|
"model": string().readonly(),
|
|
10693
10700
|
"protocol": string().readonly().optional(),
|
|
10701
|
+
"baseUrl": string().readonly().optional(),
|
|
10694
10702
|
"apiKey": string().readonly().optional(),
|
|
10695
10703
|
"options": record(string(), union([
|
|
10696
10704
|
literal(null),
|
|
@@ -10718,7 +10726,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
10718
10726
|
const _deepseek_ai_dsh_api_session_controller_session_promptModelConfig_result$schema = () => _deepseek_ai_dsh_api_session_controller_session_promptModelConfig_result$schema$value ??= object({
|
|
10719
10727
|
"version": literal(1),
|
|
10720
10728
|
"requestApiKey": literal(true),
|
|
10721
|
-
"unifiedOptions": literal(true)
|
|
10729
|
+
"unifiedOptions": literal(true),
|
|
10730
|
+
"requestBaseUrl": literal(true)
|
|
10722
10731
|
});
|
|
10723
10732
|
let _deepseek_ai_dsh_api_session_controller_session_refreshModelCatalog_result$schema$value;
|
|
10724
10733
|
const _deepseek_ai_dsh_api_session_controller_session_refreshModelCatalog_result$schema = () => _deepseek_ai_dsh_api_session_controller_session_refreshModelCatalog_result$schema$value ??= object({
|
|
@@ -10781,6 +10790,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
10781
10790
|
});
|
|
10782
10791
|
let _deepseek_ai_dsh_api_session_controller_session_resume_result$schema$value;
|
|
10783
10792
|
const _deepseek_ai_dsh_api_session_controller_session_resume_result$schema = () => _deepseek_ai_dsh_api_session_controller_session_resume_result$schema$value ??= object({
|
|
10793
|
+
"appId": string().readonly().optional(),
|
|
10784
10794
|
"sessionId": intersection(string(), unknown()).readonly(),
|
|
10785
10795
|
"selected": object({
|
|
10786
10796
|
"provider": string().readonly(),
|
|
@@ -388,14 +388,15 @@ var ApiSessionAgentController = class {
|
|
|
388
388
|
* @param existingOnly - refuse a cold identity that does not exist instead of creating it.
|
|
389
389
|
* @param provider - optional provider override for the model selection.
|
|
390
390
|
* @param model - optional model override for the model selection.
|
|
391
|
+
* @param appId - application identity for new Sessions.
|
|
391
392
|
* @returns the matching live ordinary Agent.
|
|
392
393
|
*/
|
|
393
|
-
async ensureSession(sessionId, cwd, checkPersistedIdentity, presetId, existingOnly = false, provider, model) {
|
|
394
|
+
async ensureSession(sessionId, cwd, checkPersistedIdentity, presetId, existingOnly = false, provider, model, appId) {
|
|
394
395
|
const releasing = this.releases.get(sessionId);
|
|
395
396
|
if (releasing !== void 0) await releasing;
|
|
396
397
|
let creation = this.creations.get(sessionId);
|
|
397
398
|
if (creation === void 0) {
|
|
398
|
-
creation = this.createOrAdopt(sessionId, cwd, checkPersistedIdentity, presetId, existingOnly, provider, model).catch((error) => {
|
|
399
|
+
creation = this.createOrAdopt(sessionId, cwd, checkPersistedIdentity, presetId, existingOnly, provider, model, appId).catch((error) => {
|
|
399
400
|
const live = this.ctx.agents.get(sessionId);
|
|
400
401
|
if (live !== void 0) {
|
|
401
402
|
if (hasApiSessionSubagentOwner(this.ctx, live.session, live)) throw new ApiSessionSubagentOwnership(sessionId);
|
|
@@ -556,7 +557,7 @@ var ApiSessionAgentController = class {
|
|
|
556
557
|
setup: composition.setup
|
|
557
558
|
}))).agent;
|
|
558
559
|
}
|
|
559
|
-
async createOrAdopt(sessionId, cwd, checkPersistedIdentity, presetId, existingOnly, provider, model) {
|
|
560
|
+
async createOrAdopt(sessionId, cwd, checkPersistedIdentity, presetId, existingOnly, provider, model, appId) {
|
|
560
561
|
const attached = this.ctx.sessions.get(sessionId);
|
|
561
562
|
const live = this.ctx.agents.get(sessionId);
|
|
562
563
|
if (attached !== void 0 && hasApiSessionSubagentOwner(this.ctx, attached, live)) throw new ApiSessionSubagentOwnership(sessionId);
|
|
@@ -601,6 +602,7 @@ var ApiSessionAgentController = class {
|
|
|
601
602
|
agentOptions: this.agentOptions(provider, model),
|
|
602
603
|
meta: {
|
|
603
604
|
cwd,
|
|
605
|
+
...appId === void 0 ? {} : { appId },
|
|
604
606
|
...composition.agentPreset === void 0 ? {} : { agentPreset: composition.agentPreset }
|
|
605
607
|
},
|
|
606
608
|
setup: composition.setup
|
|
@@ -857,6 +859,7 @@ var SessionCommandController = class {
|
|
|
857
859
|
* @returns the Session identity and resolved preset when configured.
|
|
858
860
|
*/
|
|
859
861
|
async create(request) {
|
|
862
|
+
if (request.appId !== void 0 && (typeof request.appId !== "string" || !/^[\x21-\x7e]{1,128}$/u.test(request.appId))) throw new RemoteError("gateway/bad-request", "appId must contain 1 to 128 visible ASCII characters", {});
|
|
860
863
|
if (request.resumeOnly === true && !request.sessionId) throw new RemoteError("gateway/bad-request", "resumeOnly requires a sessionId", {});
|
|
861
864
|
if (request.workspaceId !== void 0 && request.cwd !== void 0) throw new RemoteError("gateway/bad-request", "session.create accepts workspaceId or cwd, not both", {});
|
|
862
865
|
this.ctx.logger.info("session-controller.commands: create", {
|
|
@@ -873,7 +876,7 @@ var SessionCommandController = class {
|
|
|
873
876
|
const cwd = workspace?.path ?? request.cwd ?? this.defaultCwd;
|
|
874
877
|
let adopted;
|
|
875
878
|
try {
|
|
876
|
-
adopted = await this.agents.ensureSession(sessionId, cwd, request.sessionId !== void 0, request.agentPreset, request.resumeOnly === true, request.provider, request.model);
|
|
879
|
+
adopted = await this.agents.ensureSession(sessionId, cwd, request.sessionId !== void 0, request.agentPreset, request.resumeOnly === true, request.provider, request.model, request.appId);
|
|
877
880
|
} catch (error) {
|
|
878
881
|
this.rejectCreation(sessionId, error);
|
|
879
882
|
}
|
|
@@ -886,9 +889,11 @@ var SessionCommandController = class {
|
|
|
886
889
|
});
|
|
887
890
|
}
|
|
888
891
|
const agentPreset = this.agents.presetForSession(adopted.session);
|
|
892
|
+
const appId = adopted.session.appId;
|
|
889
893
|
return {
|
|
890
894
|
sessionId,
|
|
891
|
-
...agentPreset === void 0 ? {} : { agentPreset }
|
|
895
|
+
...agentPreset === void 0 ? {} : { agentPreset },
|
|
896
|
+
...appId === void 0 ? {} : { appId }
|
|
892
897
|
};
|
|
893
898
|
}
|
|
894
899
|
/**
|
|
@@ -1259,6 +1264,7 @@ var SessionCommandController = class {
|
|
|
1259
1264
|
const current = selection.current;
|
|
1260
1265
|
return {
|
|
1261
1266
|
sessionId,
|
|
1267
|
+
...agent.session.appId === void 0 ? {} : { appId: agent.session.appId },
|
|
1262
1268
|
selected: {
|
|
1263
1269
|
provider: current.provider,
|
|
1264
1270
|
model: current.model,
|
|
@@ -1348,7 +1354,8 @@ function validatePromptModelConfig(request) {
|
|
|
1348
1354
|
"protocol",
|
|
1349
1355
|
"options",
|
|
1350
1356
|
"protocolOptions",
|
|
1351
|
-
"apiKey"
|
|
1357
|
+
"apiKey",
|
|
1358
|
+
"baseUrl"
|
|
1352
1359
|
].includes(key)) || Buffer.byteLength(JSON.stringify(config)) > 16384) throw invalidModelConfig("modelConfig");
|
|
1353
1360
|
for (const key of [
|
|
1354
1361
|
"provider",
|
|
@@ -2197,6 +2204,7 @@ const SEARCH_PROVIDER_CALL_LIMIT = 100;
|
|
|
2197
2204
|
const SESSION_SEARCH_QUERY_MAX_CHARS = 500;
|
|
2198
2205
|
const MESSAGE_TYPES = new Set(["user/message", "assistant/message"]);
|
|
2199
2206
|
const sessionListMetadataSchema = z$1.object({
|
|
2207
|
+
appId: z$1.string().optional(),
|
|
2200
2208
|
hasUserPrompt: z$1.boolean().default(false),
|
|
2201
2209
|
blank: z$1.boolean(),
|
|
2202
2210
|
lastPromptAt: z$1.number().nullable()
|
|
@@ -2219,10 +2227,12 @@ function applySessionListMetadata(state, event) {
|
|
|
2219
2227
|
const blank = state.blank && event.type !== "turn/start";
|
|
2220
2228
|
const hasUserPrompt = state.hasUserPrompt === true || hasHumanInput(event);
|
|
2221
2229
|
const lastPromptAt = event.type === "user/message" && event.data.source.kind === "user" ? event.time : state.lastPromptAt;
|
|
2222
|
-
|
|
2230
|
+
const appId = state.appId ?? (event.type === "session/application" ? event.data.appId : void 0);
|
|
2231
|
+
return appId === state.appId && blank === state.blank && lastPromptAt === state.lastPromptAt && hasUserPrompt === state.hasUserPrompt ? state : {
|
|
2223
2232
|
blank,
|
|
2224
2233
|
lastPromptAt,
|
|
2225
|
-
hasUserPrompt
|
|
2234
|
+
hasUserPrompt,
|
|
2235
|
+
...appId === void 0 ? {} : { appId }
|
|
2226
2236
|
};
|
|
2227
2237
|
}
|
|
2228
2238
|
/** User-origin text or media is conversation input; injected context is not. */
|
|
@@ -2271,7 +2281,7 @@ var ApiSessionList = class {
|
|
|
2271
2281
|
viewSchema: sessionListMetadataSchema,
|
|
2272
2282
|
view: (state) => state
|
|
2273
2283
|
},
|
|
2274
|
-
stateVersion:
|
|
2284
|
+
stateVersion: 3
|
|
2275
2285
|
});
|
|
2276
2286
|
ctx.effect(() => async () => {
|
|
2277
2287
|
this.backfillAbort.abort();
|
|
@@ -2309,6 +2319,7 @@ var ApiSessionList = class {
|
|
|
2309
2319
|
running: this.ctx.agents.get(session.id)?.status === "running",
|
|
2310
2320
|
blank: metadata?.blank ?? session.seq === 0,
|
|
2311
2321
|
...listFields(session.header),
|
|
2322
|
+
...session.appId === void 0 ? {} : { appId: session.appId },
|
|
2312
2323
|
...projections === void 0 ? {} : { projections }
|
|
2313
2324
|
};
|
|
2314
2325
|
}
|
|
@@ -2353,6 +2364,7 @@ var ApiSessionList = class {
|
|
|
2353
2364
|
running: false,
|
|
2354
2365
|
blank: metadata?.blank ?? false,
|
|
2355
2366
|
...listFields(header),
|
|
2367
|
+
...metadata?.appId === void 0 ? {} : { appId: metadata.appId },
|
|
2356
2368
|
...projections === void 0 ? {} : { projections }
|
|
2357
2369
|
};
|
|
2358
2370
|
}
|
|
@@ -3894,7 +3906,8 @@ let SessionController = (() => {
|
|
|
3894
3906
|
return {
|
|
3895
3907
|
version: 1,
|
|
3896
3908
|
requestApiKey: true,
|
|
3897
|
-
unifiedOptions: true
|
|
3909
|
+
unifiedOptions: true,
|
|
3910
|
+
requestBaseUrl: true
|
|
3898
3911
|
};
|
|
3899
3912
|
}
|
|
3900
3913
|
/**
|