@code-yeongyu/senpi 2026.8.27 → 2026.8.28-2
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/CHANGELOG.md +83 -0
- package/dist/cli/args.d.ts +2 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +4 -0
- package/dist/cli/args.js.map +1 -1
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +2 -0
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +5 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +1 -0
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts +1 -0
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +3 -0
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/credential-accounts.d.ts +31 -0
- package/dist/core/credential-accounts.d.ts.map +1 -0
- package/dist/core/credential-accounts.js +135 -0
- package/dist/core/credential-accounts.js.map +1 -0
- package/dist/core/credential-pool/classify.d.ts +6 -1
- package/dist/core/credential-pool/classify.d.ts.map +1 -1
- package/dist/core/credential-pool/classify.js +22 -5
- package/dist/core/credential-pool/classify.js.map +1 -1
- package/dist/core/credential-pool/failover.d.ts +8 -0
- package/dist/core/credential-pool/failover.d.ts.map +1 -1
- package/dist/core/credential-pool/failover.js +24 -6
- package/dist/core/credential-pool/failover.js.map +1 -1
- package/dist/core/credential-pool/rotation-stream.d.ts +13 -2
- package/dist/core/credential-pool/rotation-stream.d.ts.map +1 -1
- package/dist/core/credential-pool/rotation-stream.js +97 -10
- package/dist/core/credential-pool/rotation-stream.js.map +1 -1
- package/dist/core/extensions/builtin/account/index.d.ts +9 -0
- package/dist/core/extensions/builtin/account/index.d.ts.map +1 -0
- package/dist/core/extensions/builtin/account/index.js +69 -0
- package/dist/core/extensions/builtin/account/index.js.map +1 -0
- package/dist/core/extensions/builtin/goal/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/goal/index.js +7 -0
- package/dist/core/extensions/builtin/goal/index.js.map +1 -1
- package/dist/core/extensions/builtin/imagegen/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/imagegen/index.js +10 -3
- package/dist/core/extensions/builtin/imagegen/index.js.map +1 -1
- package/dist/core/extensions/builtin/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/index.js +4 -0
- package/dist/core/extensions/builtin/index.js.map +1 -1
- package/dist/core/extensions/builtin/service-tier.d.ts.map +1 -1
- package/dist/core/extensions/builtin/service-tier.js +13 -0
- package/dist/core/extensions/builtin/service-tier.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/extension.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/extension.js +4 -2
- package/dist/core/extensions/builtin/terminal/extension.js.map +1 -1
- package/dist/core/model-config-schema.d.ts +4 -4
- package/dist/core/model-runtime.d.ts +2 -0
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +74 -37
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/retry-fallback/chains.d.ts +23 -1
- package/dist/core/retry-fallback/chains.d.ts.map +1 -1
- package/dist/core/retry-fallback/chains.js +59 -3
- package/dist/core/retry-fallback/chains.js.map +1 -1
- package/dist/core/retry-fallback/controller.d.ts.map +1 -1
- package/dist/core/retry-fallback/controller.js +9 -2
- package/dist/core/retry-fallback/controller.js.map +1 -1
- package/dist/core/retry-fallback/settings.d.ts.map +1 -1
- package/dist/core/retry-fallback/settings.js +9 -0
- package/dist/core/retry-fallback/settings.js.map +1 -1
- package/dist/core/retry-fallback/validate.js +1 -1
- package/dist/core/retry-fallback/validate.js.map +1 -1
- package/dist/core/sdk.js +1 -1
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager.d.ts +9 -0
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +31 -0
- package/dist/core/session-manager.js.map +1 -1
- package/dist/main.d.ts +7 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +22 -2
- package/dist/main.js.map +1 -1
- package/dist/modes/app-server/server/account.d.ts.map +1 -1
- package/dist/modes/app-server/server/account.js +5 -5
- package/dist/modes/app-server/server/account.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +11 -3
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +31 -1
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/grok/chrome.d.ts +4 -4
- package/dist/modes/interactive/grok/chrome.d.ts.map +1 -1
- package/dist/modes/interactive/grok/chrome.js.map +1 -1
- package/dist/modes/interactive/grok/footer.d.ts +3 -3
- package/dist/modes/interactive/grok/footer.d.ts.map +1 -1
- package/dist/modes/interactive/grok/footer.js.map +1 -1
- package/dist/modes/interactive/interactive-host-runtime.d.ts +16 -1
- package/dist/modes/interactive/interactive-host-runtime.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-host-runtime.js +321 -36
- package/dist/modes/interactive/interactive-host-runtime.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +295 -250
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/rpc/connection-handler.d.ts.map +1 -1
- package/dist/modes/rpc/connection-handler.js +144 -29
- package/dist/modes/rpc/connection-handler.js.map +1 -1
- package/dist/modes/rpc/multi-session-host.js +14 -4
- package/dist/modes/rpc/multi-session-host.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +90 -8
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +118 -23
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts +3 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +3 -1
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +164 -2
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/modes/rpc/session-command-router.d.ts +22 -0
- package/dist/modes/rpc/session-command-router.d.ts.map +1 -1
- package/dist/modes/rpc/session-command-router.js +153 -14
- package/dist/modes/rpc/session-command-router.js.map +1 -1
- package/dist/modes/rpc/session-event-writer.d.ts +2 -0
- package/dist/modes/rpc/session-event-writer.d.ts.map +1 -1
- package/dist/modes/rpc/session-event-writer.js +4 -0
- package/dist/modes/rpc/session-event-writer.js.map +1 -1
- package/dist/modes/rpc/session-registry.d.ts +16 -0
- package/dist/modes/rpc/session-registry.d.ts.map +1 -1
- package/dist/modes/rpc/session-registry.js +40 -3
- package/dist/modes/rpc/session-registry.js.map +1 -1
- package/docs/providers.md +48 -0
- package/docs/rpc.md +43 -4
- package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +26 -0
- package/node_modules/@code-yeongyu/senpi-codemode/package.json +4 -4
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/context-manager.ts +13 -1
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/inline-worker.ts +15 -1
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/py/transport.ts +14 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/edit.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/edit.js +20 -4
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/edit.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/index.d.ts +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/post-mutate.d.ts +21 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/post-mutate.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/post-mutate.js +27 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/post-mutate.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/tool-context.d.ts +24 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/tool-context.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/tool-context.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/write.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/write.js +7 -2
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/write.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
- package/node_modules/@earendil-works/pi-ai/dist/auth/credential-store.d.ts +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/credential-store.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/credential-store.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/credential-store.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/types.d.ts +3 -2
- package/node_modules/@earendil-works/pi-ai/dist/auth/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/alibaba-token-plan.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/amazon-bedrock.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/baseten.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-ai-gateway.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-workers-ai.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/fireworks.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/github-copilot.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/huggingface.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/nvidia.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openai-codex.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openai.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode-go.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan-cn.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/together.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
- package/node_modules/@earendil-works/pi-ai/package.json +2 -2
- package/node_modules/@earendil-works/pi-pty/package.json +1 -1
- package/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
- package/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection-handler.d.ts","sourceRoot":"","sources":["../../../src/modes/rpc/connection-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;
|
|
1
|
+
{"version":3,"file":"connection-handler.d.ts","sourceRoot":"","sources":["../../../src/modes/rpc/connection-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAOH,OAAO,KAAK,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC;AACnF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAwC/E,OAAO,KAAK,EAWX,eAAe,EAEf,MAAM,gBAAgB,CAAC;AAGxB,kFAAkF;AAClF,MAAM,WAAW,oBAAoB;IACpC,mFAAmF;IACnF,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,iFAAiF;IACjF,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,0DAA0D;IAC1D,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,kFAAkF;IAClF,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IACjC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACrC;AAED,MAAM,WAAW,oBAAoB;IACpC;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,sEAAsE;IACtE,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7C;;;OAGG;IACH,mBAAmB,IAAI,OAAO,CAAC;IAC/B,iFAAiF;IACjF,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACzB;AA4BD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,YAAY,GAAG,eAAe,CAqC3E;AA4BD;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CACzC,WAAW,EAAE,mBAAmB,EAChC,IAAI,EAAE,iBAAiB,EACvB,OAAO,GAAE,oBAAyB,GAChC,oBAAoB,CA4pCtB"}
|
|
@@ -15,11 +15,13 @@
|
|
|
15
15
|
* (and whether) to end the process.
|
|
16
16
|
*/
|
|
17
17
|
import * as crypto from "node:crypto";
|
|
18
|
+
import { existsSync } from "node:fs";
|
|
18
19
|
import { basename, dirname, extname } from "node:path";
|
|
19
20
|
import { VERSION } from "../../config.js";
|
|
20
21
|
import { buildLoginProviderInfos } from "../../core/auth-providers.js";
|
|
22
|
+
import { getCredentialAccounts, pinCredentialAccount, removeCredentialAccount, } from "../../core/credential-accounts.js";
|
|
21
23
|
import { emitProviderAccountsChanged, subscribeProviderAccountEvents, } from "../../core/extensions/builtin/claude-sdk-oauth/account-events.js";
|
|
22
|
-
import { CLAUDE_SDK_OAUTH_PROVIDER_ID
|
|
24
|
+
import { CLAUDE_SDK_OAUTH_PROVIDER_ID } from "../../core/extensions/builtin/claude-sdk-oauth/account-management.js";
|
|
23
25
|
import { isMcpControlInventoryChanged, MCP_CONTROL_INVENTORY_CHANGED_EVENT, MCP_CONTROL_INVENTORY_REQUEST_EVENT, } from "../../core/extensions/builtin/mcp/control-inventory.js";
|
|
24
26
|
import { applyFastMode, resolveServiceTierMemoryModel, } from "../../core/extensions/builtin/service-tier.js";
|
|
25
27
|
import { getSupportedThinkingLevels } from "../../core/thinking-levels.js";
|
|
@@ -72,11 +74,27 @@ export function buildRpcSessionState(session) {
|
|
|
72
74
|
fastMode: session.isFastModeActive(),
|
|
73
75
|
isStreaming: session.isStreaming,
|
|
74
76
|
isCompacting: session.isCompacting,
|
|
77
|
+
retryAttempt: session.retryAttempt,
|
|
78
|
+
isBashRunning: session.isBashRunning,
|
|
75
79
|
steeringMode: session.steeringMode,
|
|
76
80
|
followUpMode: session.followUpMode,
|
|
77
81
|
sessionFile: session.sessionFile,
|
|
78
82
|
sessionId: session.sessionId,
|
|
79
83
|
sessionName: session.sessionName,
|
|
84
|
+
cwd: session.sessionManager.getCwd(),
|
|
85
|
+
projectTrusted: session.settingsManager?.isProjectTrusted?.() ?? true,
|
|
86
|
+
...(session.sessionFile &&
|
|
87
|
+
!existsSync(session.sessionFile) &&
|
|
88
|
+
session.sessionManager
|
|
89
|
+
.getEntries()
|
|
90
|
+
.some((entry) => entry.type !== "model_change" && entry.type !== "thinking_level_change")
|
|
91
|
+
? { entries: session.sessionManager.getEntries() }
|
|
92
|
+
: {}),
|
|
93
|
+
steering: typeof session.getSteeringMessages === "function" ? [...session.getSteeringMessages()] : [],
|
|
94
|
+
followUp: typeof session.getFollowUpMessages === "function" ? [...session.getFollowUpMessages()] : [],
|
|
95
|
+
ordered: [
|
|
96
|
+
...(session._queuedInputOrder ?? []),
|
|
97
|
+
].sort((a, b) => a.enqueueOrder - b.enqueueOrder),
|
|
80
98
|
autoCompactionEnabled: session.autoCompactionEnabled,
|
|
81
99
|
messageCount: session.messages.length,
|
|
82
100
|
pendingMessageCount: session.pendingMessageCount,
|
|
@@ -190,8 +208,16 @@ export function createRpcConnectionHandler(runtimeHost, sink, options = {}) {
|
|
|
190
208
|
}
|
|
191
209
|
return { id, type: "response", command, success: true, data };
|
|
192
210
|
};
|
|
193
|
-
const error = (id, command, message) => {
|
|
194
|
-
return {
|
|
211
|
+
const error = (id, command, message, errorCode, errorData) => {
|
|
212
|
+
return {
|
|
213
|
+
id,
|
|
214
|
+
type: "response",
|
|
215
|
+
command,
|
|
216
|
+
success: false,
|
|
217
|
+
error: message,
|
|
218
|
+
...(errorCode ? { errorCode } : {}),
|
|
219
|
+
...(errorData === undefined ? {} : { errorData }),
|
|
220
|
+
};
|
|
195
221
|
};
|
|
196
222
|
// Pending extension UI requests waiting for response
|
|
197
223
|
const pendingExtensionRequests = new SessionExtensionUiRequests();
|
|
@@ -587,17 +613,24 @@ export function createRpcConnectionHandler(runtimeHost, sink, options = {}) {
|
|
|
587
613
|
}
|
|
588
614
|
// Start prompt handling immediately, but emit the authoritative response only after
|
|
589
615
|
// prompt preflight succeeds. Queued and immediately handled prompts also count as success.
|
|
616
|
+
// The disposition is captured for the wire: AgentSession always fires promptDisposition
|
|
617
|
+
// strictly before preflightResult(true), so the success frame carries the final value.
|
|
590
618
|
let preflightSucceeded = false;
|
|
619
|
+
let disposition;
|
|
591
620
|
void session
|
|
592
621
|
.prompt(command.message, {
|
|
593
622
|
images: command.images,
|
|
594
623
|
streamingBehavior: command.streamingBehavior,
|
|
595
624
|
thinkingLevel: command.thinkingLevel,
|
|
625
|
+
expandPromptTemplates: command.expandPromptTemplates,
|
|
596
626
|
source: "rpc",
|
|
627
|
+
promptDisposition: (nextDisposition) => {
|
|
628
|
+
disposition = nextDisposition;
|
|
629
|
+
},
|
|
597
630
|
preflightResult: (didSucceed) => {
|
|
598
631
|
if (didSucceed && !preflightSucceeded) {
|
|
599
632
|
preflightSucceeded = true;
|
|
600
|
-
output(success(id, "prompt"));
|
|
633
|
+
output(success(id, "prompt", { ...(disposition !== undefined ? { disposition } : {}) }));
|
|
601
634
|
}
|
|
602
635
|
},
|
|
603
636
|
})
|
|
@@ -608,21 +641,68 @@ export function createRpcConnectionHandler(runtimeHost, sink, options = {}) {
|
|
|
608
641
|
});
|
|
609
642
|
return undefined;
|
|
610
643
|
}
|
|
644
|
+
case "append_user_message": {
|
|
645
|
+
const content = command.content;
|
|
646
|
+
const message = typeof content === "string"
|
|
647
|
+
? { role: "user", content, timestamp: Date.now() }
|
|
648
|
+
: { role: "user", content, timestamp: Date.now() };
|
|
649
|
+
session.sessionManager.appendMessage(message);
|
|
650
|
+
session.messages.push(message);
|
|
651
|
+
return success(id, "append_user_message");
|
|
652
|
+
}
|
|
653
|
+
case "append_session_entry": {
|
|
654
|
+
session.sessionManager.appendEntry(command.entry);
|
|
655
|
+
if (command.entry.type === "message")
|
|
656
|
+
session.messages.push(command.entry.message);
|
|
657
|
+
return success(id, "append_session_entry");
|
|
658
|
+
}
|
|
659
|
+
case "send_custom_message": {
|
|
660
|
+
await session.sendCustomMessage({
|
|
661
|
+
customType: command.customType,
|
|
662
|
+
content: command.content,
|
|
663
|
+
display: command.display,
|
|
664
|
+
details: command.details,
|
|
665
|
+
}, { triggerTurn: command.triggerTurn, deliverAs: command.deliverAs });
|
|
666
|
+
return success(id, "send_custom_message");
|
|
667
|
+
}
|
|
611
668
|
case "steer": {
|
|
612
|
-
await session.steer(command.message, command.images);
|
|
669
|
+
await session.steer(command.message, command.images, { enqueueOrder: command.enqueueOrder });
|
|
613
670
|
return success(id, "steer");
|
|
614
671
|
}
|
|
615
672
|
case "follow_up": {
|
|
616
|
-
await session.followUp(command.message, command.images);
|
|
673
|
+
await session.followUp(command.message, command.images, { enqueueOrder: command.enqueueOrder });
|
|
617
674
|
return success(id, "follow_up");
|
|
618
675
|
}
|
|
619
676
|
case "abort": {
|
|
620
677
|
await session.abort();
|
|
621
678
|
return success(id, "abort");
|
|
622
679
|
}
|
|
680
|
+
case "abort_compaction": {
|
|
681
|
+
session.abortCompaction();
|
|
682
|
+
return success(id, "abort_compaction");
|
|
683
|
+
}
|
|
684
|
+
case "reload": {
|
|
685
|
+
const result = await session.reload();
|
|
686
|
+
return success(id, "reload", result);
|
|
687
|
+
}
|
|
688
|
+
case "check_reload_veto": {
|
|
689
|
+
return success(id, "check_reload_veto", await session.checkReloadVeto());
|
|
690
|
+
}
|
|
623
691
|
case "clear_queue": {
|
|
624
|
-
|
|
692
|
+
const cleared = session.clearQueue({ abortWillFollow: command.abortWillFollow ?? false });
|
|
693
|
+
return success(id, "clear_queue", {
|
|
694
|
+
steering: cleared.steering,
|
|
695
|
+
followUp: cleared.followUp,
|
|
696
|
+
ordered: [...cleared.ordered],
|
|
697
|
+
});
|
|
625
698
|
}
|
|
699
|
+
case "get_steering_messages":
|
|
700
|
+
return success(id, "get_steering_messages", { messages: [...session.getSteeringMessages()] });
|
|
701
|
+
case "get_follow_up_messages":
|
|
702
|
+
return success(id, "get_follow_up_messages", { messages: [...session.getFollowUpMessages()] });
|
|
703
|
+
case "abort_branch_summary":
|
|
704
|
+
session.abortBranchSummary();
|
|
705
|
+
return success(id, "abort_branch_summary");
|
|
626
706
|
case "new_session": {
|
|
627
707
|
const options = command.parentSession ? { parentSession: command.parentSession } : undefined;
|
|
628
708
|
const result = await runtimeHost.newSession(options);
|
|
@@ -645,8 +725,8 @@ export function createRpcConnectionHandler(runtimeHost, sink, options = {}) {
|
|
|
645
725
|
if (!model) {
|
|
646
726
|
return error(id, "set_model", `Model not found: ${command.provider}/${command.modelId}`);
|
|
647
727
|
}
|
|
648
|
-
await session.setModel(model);
|
|
649
|
-
return success(id, "set_model", model);
|
|
728
|
+
const systemPromptChange = await session.setModel(model);
|
|
729
|
+
return success(id, "set_model", { ...model, systemPromptName: systemPromptChange?.systemPromptName });
|
|
650
730
|
}
|
|
651
731
|
case "cycle_model": {
|
|
652
732
|
const result = await session.cycleModel();
|
|
@@ -762,24 +842,49 @@ export function createRpcConnectionHandler(runtimeHost, sink, options = {}) {
|
|
|
762
842
|
// =================================================================
|
|
763
843
|
// Bash
|
|
764
844
|
// =================================================================
|
|
765
|
-
case "
|
|
766
|
-
const
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
845
|
+
case "navigate_tree": {
|
|
846
|
+
const result = await session.navigateTree(command.targetId, {
|
|
847
|
+
summarize: command.summarize,
|
|
848
|
+
customInstructions: command.customInstructions,
|
|
849
|
+
replaceInstructions: command.replaceInstructions,
|
|
850
|
+
label: command.label,
|
|
771
851
|
});
|
|
772
|
-
|
|
773
|
-
|
|
852
|
+
return success(id, "navigate_tree", result);
|
|
853
|
+
}
|
|
854
|
+
case "record_bash_result":
|
|
855
|
+
session.recordBashResult(command.command, command.result, {
|
|
856
|
+
excludeFromContext: command.excludeFromContext,
|
|
857
|
+
});
|
|
858
|
+
return success(id, "record_bash_result");
|
|
859
|
+
case "set_label":
|
|
860
|
+
session.sessionManager.appendLabelChange(command.entryId, command.label);
|
|
861
|
+
return success(id, "set_label");
|
|
862
|
+
case "bash": {
|
|
863
|
+
outputEvent({ type: "bash_start" });
|
|
864
|
+
try {
|
|
865
|
+
const eventResult = await session.extensionRunner.emitUserBash({
|
|
866
|
+
type: "user_bash",
|
|
867
|
+
command: command.command,
|
|
868
|
+
excludeFromContext: command.excludeFromContext ?? false,
|
|
869
|
+
cwd: session.sessionManager.getCwd(),
|
|
870
|
+
});
|
|
871
|
+
if (eventResult?.result) {
|
|
872
|
+
session.recordBashResult(command.command, eventResult.result, {
|
|
873
|
+
excludeFromContext: command.excludeFromContext,
|
|
874
|
+
});
|
|
875
|
+
return success(id, "bash", eventResult.result);
|
|
876
|
+
}
|
|
877
|
+
const result = await session.executeBash(command.command, undefined, {
|
|
774
878
|
excludeFromContext: command.excludeFromContext,
|
|
879
|
+
// Functions cannot cross JSONL. Host extensions may still provide the
|
|
880
|
+
// executable operations object; client-supplied data is only a wire-safe hint.
|
|
881
|
+
operations: eventResult?.operations,
|
|
775
882
|
});
|
|
776
|
-
return success(id, "bash",
|
|
883
|
+
return success(id, "bash", result);
|
|
884
|
+
}
|
|
885
|
+
finally {
|
|
886
|
+
outputEvent({ type: "bash_end" });
|
|
777
887
|
}
|
|
778
|
-
const result = await session.executeBash(command.command, undefined, {
|
|
779
|
-
excludeFromContext: command.excludeFromContext,
|
|
780
|
-
operations: eventResult?.operations,
|
|
781
|
-
});
|
|
782
|
-
return success(id, "bash", result);
|
|
783
888
|
}
|
|
784
889
|
case "abort_bash": {
|
|
785
890
|
session.abortBash();
|
|
@@ -796,15 +901,18 @@ export function createRpcConnectionHandler(runtimeHost, sink, options = {}) {
|
|
|
796
901
|
const path = await session.exportToHtml(command.outputPath);
|
|
797
902
|
return success(id, "export_html", { path });
|
|
798
903
|
}
|
|
904
|
+
case "export_jsonl": {
|
|
905
|
+
return success(id, "export_jsonl", { path: session.exportToJsonl(command.outputPath) });
|
|
906
|
+
}
|
|
799
907
|
case "switch_session": {
|
|
800
|
-
const result = await runtimeHost.switchSession(command.sessionPath);
|
|
908
|
+
const result = await runtimeHost.switchSession(command.sessionPath, { cwdOverride: command.cwdOverride });
|
|
801
909
|
if (!result.cancelled) {
|
|
802
910
|
await rebindSession();
|
|
803
911
|
}
|
|
804
912
|
return success(id, "switch_session", result);
|
|
805
913
|
}
|
|
806
914
|
case "fork": {
|
|
807
|
-
const result = await runtimeHost.fork(command.entryId);
|
|
915
|
+
const result = await runtimeHost.fork(command.entryId, { position: command.position });
|
|
808
916
|
if (!result.cancelled) {
|
|
809
917
|
await rebindSession();
|
|
810
918
|
}
|
|
@@ -845,6 +953,12 @@ export function createRpcConnectionHandler(runtimeHost, sink, options = {}) {
|
|
|
845
953
|
const text = session.getLastAssistantText();
|
|
846
954
|
return success(id, "get_last_assistant_text", { text });
|
|
847
955
|
}
|
|
956
|
+
case "import_jsonl": {
|
|
957
|
+
const result = await runtimeHost.importFromJsonl(command.inputPath, command.cwdOverride);
|
|
958
|
+
if (!result.cancelled)
|
|
959
|
+
await rebindSession();
|
|
960
|
+
return success(id, "import_jsonl", result);
|
|
961
|
+
}
|
|
848
962
|
case "set_session_name": {
|
|
849
963
|
const name = command.name.trim();
|
|
850
964
|
if (!name) {
|
|
@@ -917,15 +1031,15 @@ export function createRpcConnectionHandler(runtimeHost, sink, options = {}) {
|
|
|
917
1031
|
return success(id, "logout");
|
|
918
1032
|
}
|
|
919
1033
|
case "get_provider_accounts": {
|
|
920
|
-
const accounts =
|
|
1034
|
+
const accounts = await getCredentialAccounts(session.modelRegistry.authStorage, command.provider);
|
|
921
1035
|
return success(id, "get_provider_accounts", { accounts });
|
|
922
1036
|
}
|
|
923
1037
|
case "account_pin": {
|
|
924
|
-
await
|
|
1038
|
+
await pinCredentialAccount(session.modelRegistry.authStorage, command.provider, command.name);
|
|
925
1039
|
return success(id, "account_pin");
|
|
926
1040
|
}
|
|
927
1041
|
case "account_remove": {
|
|
928
|
-
await
|
|
1042
|
+
await removeCredentialAccount(session.modelRegistry.authStorage, command.provider, command.name);
|
|
929
1043
|
return success(id, "account_remove");
|
|
930
1044
|
}
|
|
931
1045
|
default: {
|
|
@@ -978,7 +1092,8 @@ export function createRpcConnectionHandler(runtimeHost, sink, options = {}) {
|
|
|
978
1092
|
}
|
|
979
1093
|
}
|
|
980
1094
|
catch (commandError) {
|
|
981
|
-
|
|
1095
|
+
const missingCwd = commandError instanceof Error && commandError.name === "MissingSessionCwdError" && "issue" in commandError;
|
|
1096
|
+
output(error(command.id, command.type, commandError instanceof Error ? commandError.message : String(commandError), missingCwd ? "missing_session_cwd" : undefined, missingCwd ? commandError.issue : undefined));
|
|
982
1097
|
await waitForRpcBackpressure();
|
|
983
1098
|
}
|
|
984
1099
|
};
|