@chatcode/chatcode-cli 3.0.6-rc.2 → 3.0.6-rc.4
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 +15 -15
- package/runtime/manifest.json +2 -2
- package/runtime/node_modules/@chatcode/runtime-client/README.md +13 -10
- package/runtime/node_modules/@chatcode/runtime-client/desktop-history.mjs +49 -48
- package/runtime/node_modules/@chatcode/runtime-client/index.d.ts +9 -15
- package/runtime/node_modules/@chatcode/runtime-client/local-platform.mjs +81 -0
- package/runtime/node_modules/@chatcode/runtime-client/model-preferences.mjs +7 -12
- package/runtime/node_modules/@chatcode/runtime-client/package.json +4 -3
- package/runtime/node_modules/@chatcode/runtime-client/runtime-connector.mjs +27 -26
- 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.4",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -98,44 +98,44 @@
|
|
|
98
98
|
"@deepseek-ai/dsh-acp": "0.1.7-rc.2",
|
|
99
99
|
"@deepseek-ai/dsh-agent": "0.1.7-rc.2",
|
|
100
100
|
"@deepseek-ai/dsh-agent-loop-testkit": "0.1.7-rc.2",
|
|
101
|
-
"@deepseek-ai/dsh-credentials-local": "0.1.7-rc.2",
|
|
102
101
|
"@deepseek-ai/dsh-agent-loop": "0.1.7-rc.2",
|
|
103
102
|
"@deepseek-ai/dsh-attachment-local": "0.1.7-rc.2",
|
|
104
103
|
"@deepseek-ai/dsh-bash-local": "0.1.7-rc.2",
|
|
104
|
+
"@deepseek-ai/dsh-experimental-agent-team": "0.1.7-rc.2",
|
|
105
105
|
"@deepseek-ai/dsh-deepseek-llm-api-extensions": "0.1.7-rc.2",
|
|
106
106
|
"@deepseek-ai/dsh-experimental-ptc-runtime-python": "0.1.7-rc.2",
|
|
107
|
+
"@deepseek-ai/dsh-experimental-tool-agent-team": "0.1.7-rc.2",
|
|
107
108
|
"@deepseek-ai/dsh-fs-sandbox": "0.1.7-rc.2",
|
|
108
109
|
"@deepseek-ai/dsh-fs-observation-policy": "0.1.7-rc.2",
|
|
109
110
|
"@deepseek-ai/dsh-host-frontend-static": "0.1.7-rc.2",
|
|
110
|
-
"@deepseek-ai/dsh-experimental-tool-agent-team": "0.1.7-rc.2",
|
|
111
111
|
"@deepseek-ai/dsh-host-webserver": "0.1.7-rc.2",
|
|
112
|
+
"@deepseek-ai/dsh-llm-deepseek-api-key": "0.1.7-rc.2",
|
|
112
113
|
"@deepseek-ai/dsh-llm": "0.1.7-rc.2",
|
|
113
|
-
"@deepseek-ai/dsh-llm-deepseek
|
|
114
|
+
"@deepseek-ai/dsh-llm-deepseek": "0.1.7-rc.2",
|
|
114
115
|
"@deepseek-ai/dsh-llm-mock-server": "0.1.7-rc.2",
|
|
115
|
-
"@deepseek-ai/dsh-llm-deepseek-
|
|
116
|
+
"@deepseek-ai/dsh-llm-deepseek-account": "0.1.7-rc.2",
|
|
116
117
|
"@deepseek-ai/dsh-llm-pi-ai": "0.1.7-rc.2",
|
|
117
|
-
"@deepseek-ai/dsh-llm-deepseek": "0.1.7-rc.2",
|
|
118
|
-
"@deepseek-ai/dsh-experimental-agent-team": "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
120
|
"@deepseek-ai/dsh-loader-smoke": "0.1.7-rc.2",
|
|
121
|
+
"@deepseek-ai/dsh-sandbox-policy": "0.1.7-rc.2",
|
|
122
|
+
"@deepseek-ai/dsh-sandbox-local": "0.1.7-rc.2",
|
|
123
|
+
"@deepseek-ai/dsh-credentials-local": "0.1.7-rc.2",
|
|
121
124
|
"@deepseek-ai/dsh-plugin-package-inventory-deepseek": "0.1.7-rc.2",
|
|
122
125
|
"@deepseek-ai/dsh-session": "0.1.7-rc.2",
|
|
123
|
-
"@deepseek-ai/dsh-sandbox-policy": "0.1.7-rc.2",
|
|
124
126
|
"@deepseek-ai/dsh-session-checkpoint-policy": "0.1.7-rc.2",
|
|
125
|
-
"@deepseek-ai/dsh-sandbox-local": "0.1.7-rc.2",
|
|
126
|
-
"@deepseek-ai/dsh-session-persistence-jsonl": "0.1.7-rc.2",
|
|
127
|
-
"@deepseek-ai/dsh-session-query": "0.1.7-rc.2",
|
|
128
127
|
"@deepseek-ai/dsh-session-log-deepseek": "0.1.7-rc.2",
|
|
128
|
+
"@deepseek-ai/dsh-session-persistence-jsonl": "0.1.7-rc.2",
|
|
129
129
|
"@deepseek-ai/dsh-shell-env": "0.1.7-rc.2",
|
|
130
|
-
"@deepseek-ai/dsh-
|
|
131
|
-
"@deepseek-ai/dsh-subagent": "0.1.7-rc.2",
|
|
130
|
+
"@deepseek-ai/dsh-session-query": "0.1.7-rc.2",
|
|
132
131
|
"@deepseek-ai/dsh-settings": "0.1.7-rc.2",
|
|
132
|
+
"@deepseek-ai/dsh-subagent": "0.1.7-rc.2",
|
|
133
133
|
"@deepseek-ai/dsh-subagent-fork-in-process": "0.1.7-rc.2",
|
|
134
|
-
"@deepseek-ai/dsh-system-prompt": "0.1.7-rc.2",
|
|
135
134
|
"@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-system-prompt": "0.1.7-rc.2"
|
|
139
139
|
},
|
|
140
140
|
"exports": {
|
|
141
141
|
"./headless-compat": {
|
package/runtime/manifest.json
CHANGED
|
@@ -33,7 +33,7 @@ The application writes createIntegrationPatch(mode) to a file and passes its abs
|
|
|
33
33
|
|
|
34
34
|
```js
|
|
35
35
|
const { RuntimeConnector } = await import('@chatcode/runtime-client')
|
|
36
|
-
const runtime = new RuntimeConnector({ nodePath, launcherPath, home, patches: [patchPath] })
|
|
36
|
+
const runtime = new RuntimeConnector({ nodePath, launcherPath, home, patches: [patchPath], appCredentials: { appId, secret } })
|
|
37
37
|
await runtime.start()
|
|
38
38
|
const { sessionId } = await runtime.createSession({ cwd })
|
|
39
39
|
const off = await runtime.follow(sessionId, onFrame, onFailure)
|
|
@@ -44,15 +44,13 @@ The example’s paths, callbacks, stable requestId, and text come from the host.
|
|
|
44
44
|
|
|
45
45
|
Desktop execution views use `readAssistantContent` for separate body/reasoning, `readAssistantToolCalls` for partial arguments, and `readSessionActivity` for task-list replacements and parent-owned child catalogs. Follow verified children with `followAddress`; `toolCatalog(sessionId)` reads the actual scoped tools. Follow events retain native calls, results and nested PTC dispatches. Current tool results identify their call through `message.source.callId`; hosts preserve that identity and the original arguments when building cards. These projections add no model messages or authentication APIs.
|
|
46
46
|
|
|
47
|
-
Session callbacks receive snapshots, durable events, and assistant-stream frames. Convert these into the host’s message UI; readAssistantText only reconstructs body blocks. accepted means admission, and assistant-stream/end closes one model attempt rather than a whole turn. On transport loss, invalidate pending approvals and call reconnect() to obtain new baselines without resending prompts. off() detaches one conversation; cancel(sessionId) stops its active turn; await close() on application exit.
|
|
47
|
+
Unexpected Runtime exit notifies every active Session, Workspace, and interaction subscription with `runtime/exited`. Session callbacks receive snapshots, durable events, and assistant-stream frames. Convert these into the host’s message UI; readAssistantText only reconstructs body blocks. accepted means admission, and assistant-stream/end closes one model attempt rather than a whole turn. On transport loss, invalidate pending approvals and call reconnect() to obtain new baselines without resending prompts. off() detaches one conversation; cancel(sessionId) stops its active turn; await close() on application exit.
|
|
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
|
-
|
|
51
|
+
Every `new RuntimeConnector(options)` requires `appCredentials: { appId, secret }` from the desktop backend. Omitting the option or either field, or supplying an empty value, throws `runtime/app-credentials` before starting a subprocess. 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. The Connector keeps both values in private memory; callers supply them once per Connector, not on each message. Subsequent HTTP requests and WebSocket subscriptions use the issued Cookie. The Runtime receives the secret only in the launch request and does not retain it in an application credential registry; it cannot retrieve the secret later from Session metadata. A new Connector requires both values again. 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
|
|
|
@@ -104,15 +102,15 @@ Human questions are independent of tool approval mode. Both integration modes ca
|
|
|
104
102
|
|
|
105
103
|
### Desktop history handoff
|
|
106
104
|
|
|
107
|
-
The source package exposes `DesktopHistoryHost`, `createDesktopHistoryClient`, and `releaseSession`; published integration.1 lacks these additions. The host supplies verified account/configuration checks, discovery metadata, snapshot previews, exact native launch context, tool policy, and return synchronization. The CLI client discovers only running hosts through private Unix sockets and defers spawning until the current UI exits. The terminal uses a temporary configuration home with the original authoritative Session root; it retains the host-approved model routes, preset, directory, and account, disables both legacy and current automatic history import plus user asset discovery, and never copies credentials or replays the transcript. Keep the host running: account or host loss stops execution.
|
|
105
|
+
The source package exposes `DesktopHistoryHost`, `createDesktopHistoryClient`, and `releaseSession`; published integration.1 lacks these additions. The host supplies verified account/configuration checks, discovery metadata, snapshot previews, exact native launch context, tool policy, and return synchronization. The CLI client discovers only running hosts through local Windows named pipes or private Unix sockets on macOS/Linux, and defers spawning until the current UI exits. Windows uses Windows PowerShell to establish and verify current-user ownership and private Windows ACLs on discovery files, temporary homes, and shared model preferences; the filesystem must support Windows ACLs. Existing discovery directories must already be private. Unix keeps owner-only permission checks. The terminal uses a temporary configuration home with the original authoritative Session root; it retains the host-approved model routes, preset, directory, and account, disables both legacy and current automatic history import plus user asset discovery, and never copies credentials or replays the transcript. Keep the host running: account or host loss stops execution. Offline continuation is unsupported. The host must reject unsupported input, tools, policy modes, and changed tool arguments.
|
|
108
106
|
|
|
109
107
|
Call `releaseSession(sessionId)` only after completing or cancelling pending work. It drains a controller-owned idle Session and releases its native writer without stopping other Sessions; active work, foreign lifecycle ownership, or another process's writer rejects. Released identities reject implicit prompt admission until explicit `createSession({ cwd, sessionId })` resumes them. On return, probe release before activation, import events idempotently through the public snapshot/page APIs, and reject a nonempty native inbox instead of automatically replaying pending work.
|
|
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
|
|
|
@@ -126,7 +124,7 @@ Desktop AI workbenches that manage their own API keys and model catalog use the
|
|
|
126
124
|
|
|
127
125
|
**Typical desktop flow:**
|
|
128
126
|
```js
|
|
129
|
-
const runtime = new RuntimeConnector({ nodePath, launcherPath, home, patches: [patchPath] })
|
|
127
|
+
const runtime = new RuntimeConnector({ nodePath, launcherPath, home, patches: [patchPath], appCredentials: { appId, secret } })
|
|
130
128
|
await runtime.start()
|
|
131
129
|
|
|
132
130
|
// Optionally inject an OAuth login token
|
|
@@ -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>
|
|
@@ -1,24 +1,18 @@
|
|
|
1
1
|
/** Local, single-writer handoff between a desktop host and the official terminal. */
|
|
2
2
|
import { spawn } from 'node:child_process'
|
|
3
3
|
import { createHash, randomUUID } from 'node:crypto'
|
|
4
|
-
import { chmod,
|
|
4
|
+
import { chmod, mkdir, mkdtemp, readFile, readdir, rename, rm, writeFile } from 'node:fs/promises'
|
|
5
5
|
import { createServer, request } from 'node:http'
|
|
6
6
|
import { homedir, tmpdir } from 'node:os'
|
|
7
7
|
import { join } from 'node:path'
|
|
8
8
|
|
|
9
|
+
import { assertPrivateLocalEntry, ensurePrivateLocalDirectory, historySocketPath, sealPrivateLocalEntry } from './local-platform.mjs'
|
|
10
|
+
|
|
9
11
|
const MAX_BODY = 2 * 1024 * 1024
|
|
10
12
|
const errorMessage = error => error instanceof Error ? error.message : 'Desktop history unavailable'
|
|
11
13
|
const directoryOf = directory => directory ?? join(homedir(), '.chatcode-cli', 'desktop-history', 'v1')
|
|
12
14
|
const keyOf = (hostId, sessionId) => `desktop-history:${hostId}:${encodeURIComponent(sessionId)}`
|
|
13
15
|
|
|
14
|
-
async function privateEntry(path, directory = false) {
|
|
15
|
-
const stat = await lstat(path)
|
|
16
|
-
if (stat.isSymbolicLink() || (directory ? !stat.isDirectory() : !stat.isFile())
|
|
17
|
-
|| (process.getuid && stat.uid !== process.getuid()) || (stat.mode & 0o077) !== 0) {
|
|
18
|
-
throw new Error('Desktop history discovery requires private, user-owned files')
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
16
|
/** Request the local host over its private socket; credentials never enter discovery records. */
|
|
23
17
|
export function desktopHistoryRequest(socketPath, body, timeoutMs = 10000) {
|
|
24
18
|
return new Promise((resolve, reject) => {
|
|
@@ -45,6 +39,7 @@ export function desktopHistoryRequest(socketPath, body, timeoutMs = 10000) {
|
|
|
45
39
|
export class DesktopHistoryHost {
|
|
46
40
|
#server
|
|
47
41
|
#temporary
|
|
42
|
+
#socketPath
|
|
48
43
|
#record
|
|
49
44
|
#reservations = new Map()
|
|
50
45
|
#closing = false
|
|
@@ -54,43 +49,49 @@ export class DesktopHistoryHost {
|
|
|
54
49
|
|
|
55
50
|
async start() {
|
|
56
51
|
if (this.#server) return
|
|
57
|
-
if (
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
52
|
+
if (this.#closing) throw new Error('Desktop history host is closed; create a new host')
|
|
53
|
+
try {
|
|
54
|
+
const directory = directoryOf(this.options.directory)
|
|
55
|
+
await ensurePrivateLocalDirectory(directory)
|
|
56
|
+
this.#temporary = await mkdtemp(join(tmpdir(), 'chatcode-history-'))
|
|
57
|
+
await sealPrivateLocalEntry(this.#temporary, true)
|
|
58
|
+
const socketPath = historySocketPath(this.#temporary)
|
|
59
|
+
this.#socketPath = socketPath
|
|
60
|
+
this.#server = createServer(async (req, res) => {
|
|
61
|
+
try {
|
|
62
|
+
if (req.method !== 'POST' || req.url !== '/') throw new Error('Unsupported desktop history request')
|
|
63
|
+
let text = ''
|
|
64
|
+
for await (const chunk of req) {
|
|
65
|
+
text += chunk
|
|
66
|
+
if (text.length > MAX_BODY) throw new Error('Desktop history request too large')
|
|
67
|
+
}
|
|
68
|
+
const result = await this.#dispatch(JSON.parse(text))
|
|
69
|
+
res.writeHead(200, { 'content-type': 'application/json' }).end(JSON.stringify(result))
|
|
70
|
+
} catch (error) {
|
|
71
|
+
res.writeHead(409, { 'content-type': 'application/json' }).end(JSON.stringify({ error: errorMessage(error) }))
|
|
71
72
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
this.#
|
|
80
|
-
this.#
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
73
|
+
})
|
|
74
|
+
await new Promise((resolve, reject) => {
|
|
75
|
+
this.#server.once('error', reject)
|
|
76
|
+
this.#server.listen(socketPath, resolve)
|
|
77
|
+
})
|
|
78
|
+
if (process.platform !== 'win32') await chmod(socketPath, 0o600)
|
|
79
|
+
const hostId = createHash('sha256').update(this.options.hostId).digest('hex')
|
|
80
|
+
this.#record = join(directory, `${hostId}.json`)
|
|
81
|
+
const temporary = `${this.#record}.${randomUUID()}.tmp`
|
|
82
|
+
await writeFile(temporary, JSON.stringify({ v: 1, hostId, socketPath, pid: process.pid }), { mode: 0o600 })
|
|
83
|
+
await sealPrivateLocalEntry(temporary)
|
|
84
|
+
await rename(temporary, this.#record)
|
|
85
|
+
this.#timer = setInterval(() => {
|
|
86
|
+
for (const [sessionId, lease] of this.#reservations) {
|
|
87
|
+
if (lease.phase !== 'preparing' && lease.expiresAt <= Date.now()) void this.#finish(sessionId, lease).catch(() => {})
|
|
88
|
+
}
|
|
89
|
+
}, 1000)
|
|
90
|
+
this.#timer.unref()
|
|
91
|
+
} catch (error) {
|
|
92
|
+
await this.close()
|
|
93
|
+
throw error
|
|
94
|
+
}
|
|
94
95
|
}
|
|
95
96
|
|
|
96
97
|
/** Reports a reservation, including revoked ownership awaiting return synchronization. */
|
|
@@ -129,7 +130,7 @@ export class DesktopHistoryHost {
|
|
|
129
130
|
config: { sessionId: body.sessionId, provider: launch.provider, model: launch.model, tools: launch.tools, allowedModels: launch.allowedModels } }] }]), { mode: 0o600 })
|
|
130
131
|
return { ...launch, home: terminalHome, patches: [...launch.patches, patchPath], env: { ...launch.env,
|
|
131
132
|
CHATCODE_CLI_TUI_SESSION_ROOT: join(launch.home, 'sessions'),
|
|
132
|
-
CHATCODE_DESKTOP_HISTORY_SOCKET:
|
|
133
|
+
CHATCODE_DESKTOP_HISTORY_SOCKET: this.#socketPath,
|
|
133
134
|
CHATCODE_DESKTOP_HISTORY_LEASE: lease.id }, leaseId: lease.id }
|
|
134
135
|
} catch (error) {
|
|
135
136
|
this.#reservations.delete(body.sessionId)
|
|
@@ -201,13 +202,13 @@ export function createDesktopHistoryClient(options = {}) {
|
|
|
201
202
|
async list() {
|
|
202
203
|
const directory = directoryOf(options.directory)
|
|
203
204
|
let files
|
|
204
|
-
try { await
|
|
205
|
+
try { await assertPrivateLocalEntry(directory, true); files = await readdir(directory) }
|
|
205
206
|
catch (error) { if (error.code === 'ENOENT') return []; throw error }
|
|
206
207
|
const rows = []
|
|
207
208
|
for (const file of files.filter(file => /^[a-f0-9]{64}\.json$/u.test(file))) {
|
|
208
209
|
try {
|
|
209
210
|
const path = join(directory, file)
|
|
210
|
-
await
|
|
211
|
+
await assertPrivateLocalEntry(path)
|
|
211
212
|
const record = JSON.parse(await readFile(path, 'utf8'))
|
|
212
213
|
if (record.v !== 1 || `${record.hostId}.json` !== file || typeof record.socketPath !== 'string') continue
|
|
213
214
|
const result = await desktopHistoryRequest(record.socketPath, { op: 'list' }, 3000)
|
|
@@ -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,8 +39,8 @@ export interface RuntimeOptions {
|
|
|
37
39
|
home: string
|
|
38
40
|
patches?: string[]
|
|
39
41
|
env?: Record<string, string | undefined>
|
|
40
|
-
/**
|
|
41
|
-
appCredentials
|
|
42
|
+
/** Required application metadata, supplied once per Connector; Runtime verification is deferred. */
|
|
43
|
+
appCredentials: RuntimeAppCredentials
|
|
42
44
|
processCwd?: string
|
|
43
45
|
startupTimeoutMs?: number
|
|
44
46
|
requestTimeoutMs?: number
|
|
@@ -77,7 +79,7 @@ export interface DesktopHistoryEntry {
|
|
|
77
79
|
provider: string
|
|
78
80
|
model: string
|
|
79
81
|
}
|
|
80
|
-
/** Desktop-owned launch context, transferred only over a private local
|
|
82
|
+
/** Desktop-owned launch context, transferred only over a private local IPC endpoint. */
|
|
81
83
|
export interface DesktopHistoryLaunch {
|
|
82
84
|
nodePath: string
|
|
83
85
|
launcherPath: string
|
|
@@ -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 })
|
|
@@ -140,7 +136,7 @@ export class AccountModelPreferences {
|
|
|
140
136
|
export class RuntimeConnector {
|
|
141
137
|
/** @param options - Explicit child-process paths, overlays, application credentials, and operation settings. */
|
|
142
138
|
constructor(options: RuntimeOptions)
|
|
143
|
-
/** Start once and authenticate. @returns Ready after cookie
|
|
139
|
+
/** Start once and authenticate. @returns Ready after the cookie exchange carrying application metadata; verification is deferred. */
|
|
144
140
|
start(): Promise<void>
|
|
145
141
|
/**
|
|
146
142
|
* Create or restore an owned Session.
|
|
@@ -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. */
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/** Local IPC names and private discovery files for Unix and Windows hosts. */
|
|
2
|
+
import { execFile } from 'node:child_process'
|
|
3
|
+
import { randomUUID } from 'node:crypto'
|
|
4
|
+
import { chmod, lstat, mkdir } from 'node:fs/promises'
|
|
5
|
+
import { join } from 'node:path'
|
|
6
|
+
import { promisify } from 'node:util'
|
|
7
|
+
|
|
8
|
+
const execute = promisify(execFile)
|
|
9
|
+
const privateError = () => new Error('Local state requires private, user-owned files')
|
|
10
|
+
|
|
11
|
+
/** Choose a local named pipe on Windows or a filesystem socket on Unix. */
|
|
12
|
+
export function historySocketPath(directory, platform = process.platform) {
|
|
13
|
+
return platform === 'win32' ? `\\\\.\\pipe\\chatcode-history-${process.pid}-${randomUUID()}` : join(directory, 'host.sock')
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Paths travel through the child environment, never PowerShell source interpolation.
|
|
17
|
+
const aclScript = `
|
|
18
|
+
$ErrorActionPreference = 'Stop'
|
|
19
|
+
$path = $env:CHATCODE_HISTORY_ACL_PATH
|
|
20
|
+
$seal = $env:CHATCODE_HISTORY_ACL_SEAL -eq '1'
|
|
21
|
+
$item = Get-Item -LiteralPath $path -Force
|
|
22
|
+
if (($item.Attributes -band [IO.FileAttributes]::ReparsePoint) -ne 0) { throw 'Links are not allowed' }
|
|
23
|
+
$user = [Security.Principal.WindowsIdentity]::GetCurrent().User
|
|
24
|
+
$trusted = @($user.Value, 'S-1-5-18', 'S-1-5-32-544')
|
|
25
|
+
if ($seal) {
|
|
26
|
+
if ($item.PSIsContainer) {
|
|
27
|
+
$acl = [System.Security.AccessControl.DirectorySecurity]::new()
|
|
28
|
+
$inherit = [Security.AccessControl.InheritanceFlags]'ContainerInherit, ObjectInherit'
|
|
29
|
+
} else {
|
|
30
|
+
$acl = [System.Security.AccessControl.FileSecurity]::new()
|
|
31
|
+
$inherit = [Security.AccessControl.InheritanceFlags]::None
|
|
32
|
+
}
|
|
33
|
+
$acl.SetOwner($user)
|
|
34
|
+
$acl.SetAccessRuleProtection($true, $false)
|
|
35
|
+
foreach ($sid in $trusted) {
|
|
36
|
+
$identity = [System.Security.Principal.SecurityIdentifier]::new($sid)
|
|
37
|
+
$rule = [System.Security.AccessControl.FileSystemAccessRule]::new($identity, 'FullControl', $inherit, 'None', 'Allow')
|
|
38
|
+
$acl.AddAccessRule($rule)
|
|
39
|
+
}
|
|
40
|
+
Set-Acl -LiteralPath $path -AclObject $acl
|
|
41
|
+
}
|
|
42
|
+
$acl = Get-Acl -LiteralPath $path
|
|
43
|
+
if ($acl.GetOwner([Security.Principal.SecurityIdentifier]).Value -ne $user.Value) { throw 'Unexpected owner' }
|
|
44
|
+
foreach ($rule in $acl.GetAccessRules($true, $true, [Security.Principal.SecurityIdentifier])) {
|
|
45
|
+
if ($rule.AccessControlType -eq 'Allow' -and $trusted -notcontains $rule.IdentityReference.Value) { throw 'Shared access is not allowed' }
|
|
46
|
+
}
|
|
47
|
+
`
|
|
48
|
+
|
|
49
|
+
async function windowsPrivacy(path, seal) {
|
|
50
|
+
try {
|
|
51
|
+
await execute('powershell.exe', ['-NoLogo', '-NoProfile', '-NonInteractive', '-EncodedCommand', Buffer.from(aclScript, 'utf16le').toString('base64')], {
|
|
52
|
+
windowsHide: true, timeout: 10000, maxBuffer: 16384,
|
|
53
|
+
env: { ...process.env, CHATCODE_HISTORY_ACL_PATH: path, CHATCODE_HISTORY_ACL_SEAL: seal ? '1' : '0' },
|
|
54
|
+
})
|
|
55
|
+
} catch (error) {
|
|
56
|
+
throw new Error('Local state requires Windows PowerShell and private, user-owned Windows ACL-protected files', { cause: error })
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** Refuse links and shared discovery entries using native ownership and access rules. */
|
|
61
|
+
export async function assertPrivateLocalEntry(path, directory = false) {
|
|
62
|
+
const stat = await lstat(path)
|
|
63
|
+
if (stat.isSymbolicLink() || (directory ? !stat.isDirectory() : !stat.isFile())) throw privateError()
|
|
64
|
+
if (process.platform === 'win32') return windowsPrivacy(path, false)
|
|
65
|
+
if ((process.getuid && stat.uid !== process.getuid()) || (stat.mode & 0o077) !== 0) throw privateError()
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** Secure a newly created host directory or discovery record before publishing it. */
|
|
69
|
+
export async function sealPrivateLocalEntry(path, directory = false) {
|
|
70
|
+
const stat = await lstat(path)
|
|
71
|
+
if (stat.isSymbolicLink() || (directory ? !stat.isDirectory() : !stat.isFile())) throw privateError()
|
|
72
|
+
if (process.platform === 'win32') return windowsPrivacy(path, true)
|
|
73
|
+
await chmod(path, directory ? 0o700 : 0o600)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** Create the discovery directory privately; existing directories must already be private. */
|
|
77
|
+
export async function ensurePrivateLocalDirectory(directory) {
|
|
78
|
+
const created = await mkdir(directory, { recursive: true, mode: 0o700 })
|
|
79
|
+
if (created !== undefined) await sealPrivateLocalEntry(directory, true)
|
|
80
|
+
await assertPrivateLocalEntry(directory, true)
|
|
81
|
+
}
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
/** Account-scoped model preferences shared by local desktop and terminal entry points. */
|
|
2
2
|
import { randomUUID } from 'node:crypto'
|
|
3
|
-
import {
|
|
3
|
+
import { readFile, rename, rm, writeFile } from 'node:fs/promises'
|
|
4
4
|
import { homedir } from 'node:os'
|
|
5
5
|
import { join } from 'node:path'
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
if (stat.isSymbolicLink() || (directory ? !stat.isDirectory() : !stat.isFile())
|
|
10
|
-
|| (process.getuid && stat.uid !== process.getuid()) || (stat.mode & 0o077)) {
|
|
11
|
-
throw new Error('Model preferences require private user-owned files')
|
|
12
|
-
}
|
|
13
|
-
}
|
|
7
|
+
import { assertPrivateLocalEntry, ensurePrivateLocalDirectory, sealPrivateLocalEntry } from './local-platform.mjs'
|
|
8
|
+
|
|
14
9
|
function route(value) {
|
|
15
10
|
if (!value || typeof value.provider !== 'string' || !value.provider.trim()
|
|
16
11
|
|| typeof value.model !== 'string' || !value.model.trim()) throw new Error('A complete model route is required')
|
|
@@ -30,8 +25,8 @@ export class AccountModelPreferences {
|
|
|
30
25
|
async read(owner) {
|
|
31
26
|
const path = this.#path(owner)
|
|
32
27
|
try {
|
|
33
|
-
await
|
|
34
|
-
await
|
|
28
|
+
await assertPrivateLocalEntry(this.directory, true)
|
|
29
|
+
await assertPrivateLocalEntry(path)
|
|
35
30
|
const value = JSON.parse(await readFile(path, 'utf8'))
|
|
36
31
|
if (value.v !== 1 || value.owner !== owner || typeof value.revision !== 'string') throw new Error('Invalid account model preference')
|
|
37
32
|
return { ...route(value), revision: value.revision }
|
|
@@ -45,11 +40,11 @@ export class AccountModelPreferences {
|
|
|
45
40
|
async write(owner, selection) {
|
|
46
41
|
const path = this.#path(owner)
|
|
47
42
|
const value = { v: 1, owner, ...route(selection), revision: randomUUID() }
|
|
48
|
-
await
|
|
49
|
-
await owned(this.directory, true)
|
|
43
|
+
await ensurePrivateLocalDirectory(this.directory)
|
|
50
44
|
const temporary = `${path}.${randomUUID()}.tmp`
|
|
51
45
|
try {
|
|
52
46
|
await writeFile(temporary, JSON.stringify(value), { flag: 'wx', mode: 0o600 })
|
|
47
|
+
await sealPrivateLocalEntry(temporary)
|
|
53
48
|
await rename(temporary, path)
|
|
54
49
|
} finally { await rm(temporary, { force: true }) }
|
|
55
50
|
return { ...route(value), revision: value.revision }
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chatcode/runtime-client",
|
|
3
|
-
"version": "0.1.0-integration.
|
|
3
|
+
"version": "0.1.0-integration.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Node.js client for persistent chatcode-cli Runtime sessions and desktop approvals",
|
|
6
6
|
"exports": {
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"stdio-bridge.mjs",
|
|
20
20
|
"desktop-permission-gate.mjs",
|
|
21
21
|
"desktop-history.mjs",
|
|
22
|
+
"local-platform.mjs",
|
|
22
23
|
"model-preferences.mjs",
|
|
23
24
|
"desktop-history-guard.mjs",
|
|
24
25
|
"index.d.ts",
|
|
@@ -34,8 +35,8 @@
|
|
|
34
35
|
"ws": "8.21.0"
|
|
35
36
|
},
|
|
36
37
|
"scripts": {
|
|
37
|
-
"test": "node --test tests/lifecycle.test.mjs tests/interactions.test.mjs tests/history.test.mjs tests/models.test.mjs tests/activity.test.mjs tests/execution.test.mjs tests/user-questions.test.mjs tests/session-browser.test.mjs",
|
|
38
|
-
"build": "node --check session-browser.mjs && node --check user-questions.mjs && node --check execution.mjs && node --check runtime-connector.mjs && node --check session-activity.mjs && node --check model-preferences.mjs && node --check desktop-permission-gate.mjs && node --check desktop-history.mjs && node --check desktop-history-guard.mjs && node --check stdio-bridge.mjs && tsc -p tsconfig.json",
|
|
38
|
+
"test": "node --test tests/lifecycle.test.mjs tests/interactions.test.mjs tests/history.test.mjs tests/history-platform.test.mjs tests/models.test.mjs tests/activity.test.mjs tests/execution.test.mjs tests/user-questions.test.mjs tests/session-browser.test.mjs",
|
|
39
|
+
"build": "node --check session-browser.mjs && node --check user-questions.mjs && node --check execution.mjs && node --check runtime-connector.mjs && node --check session-activity.mjs && node --check model-preferences.mjs && node --check desktop-permission-gate.mjs && node --check desktop-history.mjs && node --check local-platform.mjs && node --check desktop-history-guard.mjs && node --check stdio-bridge.mjs && tsc -p tsconfig.json",
|
|
39
40
|
"prepublishOnly": "npm run build && npm test"
|
|
40
41
|
},
|
|
41
42
|
"license": "MIT",
|