@codexhost/cli-darwin-x64 0.25.0 → 0.26.0-rc.1
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/README.md +1 -1
- package/app/codexhost-distribution.json +1 -1
- package/app/console-server.mjs +174 -18
- package/app/console-web.js +543 -230
- package/app/desktop-controller.mjs +154 -5
- package/app/host-runtime.mjs +1064 -645
- package/app/plugins/antigravity/plugin.mjs +202 -19
- package/app/plugins/claude-code/plugin.mjs +195 -10
- package/app/plugins/codebuddy/plugin.mjs +154 -5
- package/app/plugins/codex-usage/plugin.mjs +154 -5
- package/app/plugins/copilot/plugin.mjs +154 -5
- package/app/plugins/cursor-cli/plugin.mjs +154 -5
- package/app/plugins/deepseek-harness/plugin.mjs +182 -36
- package/app/plugins/devin/plugin.mjs +154 -5
- package/app/plugins/grok/plugin.mjs +154 -5
- package/app/plugins/hermes/plugin.mjs +198 -20
- package/app/plugins/kimi-code/plugin.mjs +154 -5
- package/app/plugins/kiro-cli/plugin.mjs +154 -5
- package/app/plugins/omp/plugin.mjs +154 -5
- package/app/plugins/opencode/plugin.mjs +155 -9
- package/app/plugins/pi/plugin.mjs +296 -33
- package/app/plugins/qoder/plugin.mjs +154 -5
- package/app/plugins/qoder-cn/plugin.mjs +154 -5
- package/app/plugins/qwen-code/plugin.mjs +154 -5
- package/app/plugins/workbuddy/plugin.mjs +154 -5
- package/app/plugins/zcode/plugin.mjs +154 -5
- package/app/renderer-extension.js +1132 -330
- package/app/web/assets/{index-DUOvhHbV.js → index-Bl_9AU27.js} +70 -70
- package/app/web/assets/{index-CTCFIQbU.css → index-arwoPpaG.css} +1 -1
- package/app/web/codexhost-settings.js +230 -140
- package/app/web/index.html +2 -2
- package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +8 -10
- package/app/web/plugins/deepseek-ai__dsh-client-ui-brand-official/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +13 -13
- package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +73 -73
- package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +75 -75
- package/app/web/plugins/deepseek-ai__dsh-client-ui-input-trigger/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-layout/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-theme/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +18 -18
- package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +11 -11
- package/app/web-modules/server.mjs +14416 -13144
- package/bin/codexhost +0 -0
- package/libexec/CodexHost.app/Contents/Info.plist +2 -2
- package/libexec/CodexHost.app/Contents/MacOS/CodexHost +0 -0
- package/libexec/codexhost-shim +0 -0
- package/libexec/codexhost-updater +0 -0
- package/package.json +1 -1
|
@@ -16204,7 +16204,10 @@ var clientWorkspaceSnapshotSchema = external_exports.object({
|
|
|
16204
16204
|
assignments: external_exports.record(external_exports.string(), external_exports.string()),
|
|
16205
16205
|
projectless: external_exports.array(external_exports.string()),
|
|
16206
16206
|
/** Canonical external pin membership; pins/list provides the native merged order. */
|
|
16207
|
-
pinned: external_exports.array(external_exports.string())
|
|
16207
|
+
pinned: external_exports.array(external_exports.string()),
|
|
16208
|
+
/** Projects Desktop placed in each custom section, keyed by the official section ID, in
|
|
16209
|
+
* Desktop's section order. Omitted when no section holds a project. */
|
|
16210
|
+
sectionProjects: external_exports.record(external_exports.string(), external_exports.array(external_exports.string())).optional()
|
|
16208
16211
|
});
|
|
16209
16212
|
var record2 = external_exports.record(external_exports.string(), external_exports.unknown());
|
|
16210
16213
|
var clientChannelCursorSchema = external_exports.object({
|
|
@@ -16397,7 +16400,16 @@ var clientChannelResponseSchema = external_exports.object({
|
|
|
16397
16400
|
var threadCatalogReadParamsSchema = external_exports.object({
|
|
16398
16401
|
includeArchived: external_exports.boolean().optional(),
|
|
16399
16402
|
/** Absent means first page; null means this branch is exhausted. Native cursors only. */
|
|
16400
|
-
officialCursor: external_exports.object({ live: external_exports.string().nullable(), archived: external_exports.string().nullable().optional() }).strict().optional()
|
|
16403
|
+
officialCursor: external_exports.object({ live: external_exports.string().nullable(), archived: external_exports.string().nullable().optional() }).strict().optional(),
|
|
16404
|
+
/**
|
|
16405
|
+
* Keep reading native pages until one holds a Thread in `cwd` but outside every
|
|
16406
|
+
* `excludeCwds` folder, the branch ends, or a page bound is reached. Every row read is
|
|
16407
|
+
* returned, so the native cursors stay contiguous.
|
|
16408
|
+
*/
|
|
16409
|
+
scope: external_exports.object({
|
|
16410
|
+
cwd: external_exports.string().min(1).max(4096),
|
|
16411
|
+
excludeCwds: external_exports.array(external_exports.string().min(1).max(4096)).max(1024)
|
|
16412
|
+
}).strict().optional()
|
|
16401
16413
|
}).strict();
|
|
16402
16414
|
var threadCatalogReadResultSchema = external_exports.object({
|
|
16403
16415
|
threads: external_exports.array(jsonObjectSchema),
|
|
@@ -16663,7 +16675,7 @@ var idleReleaseSettingsSchema = external_exports.strictObject({
|
|
|
16663
16675
|
timeoutMinutes: external_exports.number().int().min(IDLE_RELEASE_TIMEOUT_MINUTES_MIN).max(IDLE_RELEASE_TIMEOUT_MINUTES_MAX)
|
|
16664
16676
|
});
|
|
16665
16677
|
var DEFAULT_IDLE_RELEASE_SETTINGS = Object.freeze({
|
|
16666
|
-
enabled:
|
|
16678
|
+
enabled: true,
|
|
16667
16679
|
timeoutMinutes: 10
|
|
16668
16680
|
});
|
|
16669
16681
|
|
|
@@ -17427,7 +17439,12 @@ var nativeCheckpointRefSchema = nativeCheckpointRefV1Schema;
|
|
|
17427
17439
|
var UPDATE_ERROR_MAX_LENGTH = 500;
|
|
17428
17440
|
var UPDATE_SEMVER_PATTERN = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/u;
|
|
17429
17441
|
var updateSemanticVersionSchema = external_exports.string().regex(UPDATE_SEMVER_PATTERN);
|
|
17430
|
-
var updateInstallationSchema = external_exports.enum([
|
|
17442
|
+
var updateInstallationSchema = external_exports.enum([
|
|
17443
|
+
"npm",
|
|
17444
|
+
"windows-installer",
|
|
17445
|
+
"macos-dmg",
|
|
17446
|
+
"linux-archive"
|
|
17447
|
+
]);
|
|
17431
17448
|
var updatePhaseSchema = external_exports.enum([
|
|
17432
17449
|
"prepared",
|
|
17433
17450
|
"downloading",
|
|
@@ -17556,7 +17573,9 @@ var remoteSshSetupResultSchema = external_exports.object({ state: external_expor
|
|
|
17556
17573
|
var REMOTE_CONTROLLER_REQUEST_MAX_BYTES = 16 * 1024;
|
|
17557
17574
|
var REMOTE_IDENTITY_MAX_LENGTH = 1024;
|
|
17558
17575
|
var identity = external_exports.string().min(1).max(REMOTE_IDENTITY_MAX_LENGTH);
|
|
17559
|
-
var target = {
|
|
17576
|
+
var target = {
|
|
17577
|
+
hostId: identity.regex(/^(?:remote-(?:ssh(?:-|:)|control:)|remote-peer:[a-zA-Z0-9_-]{1,64}$)/u)
|
|
17578
|
+
};
|
|
17560
17579
|
var thread = { ...target, threadId: identity };
|
|
17561
17580
|
var text = external_exports.string().min(1).max(8e3);
|
|
17562
17581
|
var input = { text, requestId: identity };
|
|
@@ -17775,6 +17794,136 @@ var webUiExtensionInstallSchema = external_exports.object({
|
|
|
17775
17794
|
var webUiExtensionEnabledSchema = external_exports.object({ id: webUiExtensionIdSchema, enabled: external_exports.boolean() }).strict();
|
|
17776
17795
|
var webUiExtensionRemoveSchema = external_exports.object({ id: webUiExtensionIdSchema }).strict();
|
|
17777
17796
|
|
|
17797
|
+
// ../../shared-contracts/dist/remote-peers.js
|
|
17798
|
+
var REMOTE_PEER_ID_PATTERN = /^[a-zA-Z0-9_-]{1,64}$/u;
|
|
17799
|
+
var remotePeerIdSchema = external_exports.string().regex(REMOTE_PEER_ID_PATTERN);
|
|
17800
|
+
var remotePeerHostIdSchema = external_exports.string().regex(/^remote-peer:[a-zA-Z0-9_-]{1,64}$/u);
|
|
17801
|
+
var remotePeerTransportKindSchema = external_exports.enum(["relay", "tailscale", "lan", "custom"]);
|
|
17802
|
+
var remotePeerStateSchema = external_exports.enum([
|
|
17803
|
+
"connected",
|
|
17804
|
+
"connecting",
|
|
17805
|
+
"auth-error",
|
|
17806
|
+
"offline",
|
|
17807
|
+
"disabled"
|
|
17808
|
+
]);
|
|
17809
|
+
var remotePeerSummarySchema = external_exports.object({
|
|
17810
|
+
peerId: remotePeerIdSchema,
|
|
17811
|
+
hostId: remotePeerHostIdSchema,
|
|
17812
|
+
name: external_exports.string().min(1).max(120),
|
|
17813
|
+
origin: external_exports.string().min(1).max(2048),
|
|
17814
|
+
transportKind: remotePeerTransportKindSchema,
|
|
17815
|
+
encrypted: external_exports.boolean(),
|
|
17816
|
+
enabled: external_exports.boolean(),
|
|
17817
|
+
state: remotePeerStateSchema,
|
|
17818
|
+
latencyMs: external_exports.number().int().nonnegative().optional(),
|
|
17819
|
+
version: external_exports.string().max(128).optional(),
|
|
17820
|
+
platform: external_exports.string().max(64).optional(),
|
|
17821
|
+
hostname: external_exports.string().max(255).optional(),
|
|
17822
|
+
homeDir: external_exports.string().max(4096).optional(),
|
|
17823
|
+
lastError: external_exports.string().max(1e3).optional(),
|
|
17824
|
+
projectCount: external_exports.number().int().nonnegative(),
|
|
17825
|
+
createdAt: external_exports.string(),
|
|
17826
|
+
updatedAt: external_exports.string()
|
|
17827
|
+
});
|
|
17828
|
+
var remotePeerListResultSchema = external_exports.object({
|
|
17829
|
+
peers: external_exports.array(remotePeerSummarySchema)
|
|
17830
|
+
});
|
|
17831
|
+
var remotePeerAddParamsSchema = external_exports.object({
|
|
17832
|
+
connectionUrl: external_exports.string().min(1).max(4096).optional(),
|
|
17833
|
+
origin: external_exports.string().min(1).max(2048).optional(),
|
|
17834
|
+
token: external_exports.string().min(1).max(2048).optional(),
|
|
17835
|
+
name: external_exports.string().trim().min(1).max(120).optional()
|
|
17836
|
+
}).refine((input2) => Boolean(input2.connectionUrl) || Boolean(input2.origin) && Boolean(input2.token), "Provide either connectionUrl or both origin and token");
|
|
17837
|
+
var remotePeerUpdateParamsSchema = external_exports.object({
|
|
17838
|
+
peerId: remotePeerIdSchema,
|
|
17839
|
+
name: external_exports.string().trim().min(1).max(120).optional(),
|
|
17840
|
+
connectionUrl: external_exports.string().min(1).max(4096).optional(),
|
|
17841
|
+
origin: external_exports.string().min(1).max(2048).optional(),
|
|
17842
|
+
token: external_exports.string().min(1).max(2048).optional(),
|
|
17843
|
+
enabled: external_exports.boolean().optional()
|
|
17844
|
+
});
|
|
17845
|
+
var remotePeerIdParamsSchema = external_exports.object({
|
|
17846
|
+
peerId: remotePeerIdSchema
|
|
17847
|
+
});
|
|
17848
|
+
var remotePeerRemoveResultSchema = external_exports.object({
|
|
17849
|
+
removed: external_exports.boolean()
|
|
17850
|
+
});
|
|
17851
|
+
var remotePeerTestParamsSchema = external_exports.object({
|
|
17852
|
+
peerId: remotePeerIdSchema.optional(),
|
|
17853
|
+
connectionUrl: external_exports.string().min(1).max(4096).optional(),
|
|
17854
|
+
origin: external_exports.string().min(1).max(2048).optional(),
|
|
17855
|
+
token: external_exports.string().min(1).max(2048).optional()
|
|
17856
|
+
}).refine((input2) => Boolean(input2.peerId) || Boolean(input2.connectionUrl) || Boolean(input2.origin) && Boolean(input2.token), "Provide peerId, connectionUrl, or both origin and token");
|
|
17857
|
+
var remotePeerTestResultSchema = external_exports.object({
|
|
17858
|
+
ok: external_exports.boolean(),
|
|
17859
|
+
latencyMs: external_exports.number().int().nonnegative().optional(),
|
|
17860
|
+
origin: external_exports.string().max(2048).optional(),
|
|
17861
|
+
transportKind: remotePeerTransportKindSchema.optional(),
|
|
17862
|
+
encrypted: external_exports.boolean().optional(),
|
|
17863
|
+
version: external_exports.string().max(128).optional(),
|
|
17864
|
+
platform: external_exports.string().max(64).optional(),
|
|
17865
|
+
hostname: external_exports.string().max(255).optional(),
|
|
17866
|
+
homeDir: external_exports.string().max(4096).optional(),
|
|
17867
|
+
projectCount: external_exports.number().int().nonnegative().optional(),
|
|
17868
|
+
error: external_exports.string().max(1e3).optional()
|
|
17869
|
+
});
|
|
17870
|
+
var remotePeerManifestProjectSchema = external_exports.object({
|
|
17871
|
+
id: external_exports.string().min(1).max(1024),
|
|
17872
|
+
name: external_exports.string().min(1).max(512),
|
|
17873
|
+
path: external_exports.string().min(1).max(8192),
|
|
17874
|
+
threadIds: external_exports.array(external_exports.string().min(1).max(1024))
|
|
17875
|
+
});
|
|
17876
|
+
var remotePeerManifestSchema = external_exports.object({
|
|
17877
|
+
version: external_exports.string().max(128),
|
|
17878
|
+
platform: external_exports.string().max(64),
|
|
17879
|
+
hostname: external_exports.string().max(255),
|
|
17880
|
+
homeDir: external_exports.string().max(4096).optional(),
|
|
17881
|
+
epoch: external_exports.string().min(1).max(256),
|
|
17882
|
+
projects: external_exports.array(remotePeerManifestProjectSchema)
|
|
17883
|
+
});
|
|
17884
|
+
var remotePeerDirectoryEntrySchema = external_exports.object({
|
|
17885
|
+
name: external_exports.string().min(1).max(512),
|
|
17886
|
+
path: external_exports.string().min(1).max(8192),
|
|
17887
|
+
kind: external_exports.literal("directory")
|
|
17888
|
+
});
|
|
17889
|
+
var remotePeerListDirsParamsSchema = external_exports.object({
|
|
17890
|
+
peerId: remotePeerIdSchema,
|
|
17891
|
+
path: external_exports.string().min(1).max(8192).optional()
|
|
17892
|
+
});
|
|
17893
|
+
var remotePeerListDirsResultSchema = external_exports.object({
|
|
17894
|
+
path: external_exports.string().min(1).max(8192),
|
|
17895
|
+
parentPath: external_exports.string().min(1).max(8192).nullable(),
|
|
17896
|
+
homeDir: external_exports.string().min(1).max(8192).optional(),
|
|
17897
|
+
entries: external_exports.array(remotePeerDirectoryEntrySchema)
|
|
17898
|
+
});
|
|
17899
|
+
var remotePeerCreateDirParamsSchema = external_exports.object({
|
|
17900
|
+
peerId: remotePeerIdSchema,
|
|
17901
|
+
parentPath: external_exports.string().min(1).max(8192),
|
|
17902
|
+
name: external_exports.string().min(1).max(255).refine((value) => value.trim().length > 0, "Directory name cannot be blank")
|
|
17903
|
+
});
|
|
17904
|
+
var remotePeerCreateDirResultSchema = external_exports.object({
|
|
17905
|
+
path: external_exports.string().min(1).max(8192),
|
|
17906
|
+
name: external_exports.string().min(1).max(255)
|
|
17907
|
+
});
|
|
17908
|
+
var remotePeerCreateWorkspaceParamsSchema = external_exports.object({
|
|
17909
|
+
peerId: remotePeerIdSchema,
|
|
17910
|
+
path: external_exports.string().min(1).max(8192),
|
|
17911
|
+
title: external_exports.string().trim().min(1).max(255).optional()
|
|
17912
|
+
});
|
|
17913
|
+
var remotePeerRenameWorkspaceParamsSchema = external_exports.object({
|
|
17914
|
+
peerId: remotePeerIdSchema,
|
|
17915
|
+
workspaceId: external_exports.string().min(1).max(1024),
|
|
17916
|
+
title: external_exports.string().trim().min(1).max(255)
|
|
17917
|
+
});
|
|
17918
|
+
var remotePeerDeleteWorkspaceParamsSchema = external_exports.object({
|
|
17919
|
+
peerId: remotePeerIdSchema,
|
|
17920
|
+
workspaceId: external_exports.string().min(1).max(1024)
|
|
17921
|
+
});
|
|
17922
|
+
var remotePeerWorkspaceMutationResultSchema = external_exports.object({
|
|
17923
|
+
workspaceId: external_exports.string().min(1).max(1024).optional(),
|
|
17924
|
+
manifest: remotePeerManifestSchema
|
|
17925
|
+
});
|
|
17926
|
+
|
|
17778
17927
|
// ../../shared-contracts/dist/index.js
|
|
17779
17928
|
var workspaceContractVersionSchema = external_exports.literal(WORKSPACE_CONTRACT_VERSION);
|
|
17780
17929
|
|
|
@@ -22478,6 +22627,7 @@ var READ_ONLY_COMMANDS = /* @__PURE__ */ new Set([
|
|
|
22478
22627
|
"get_available_thinking_levels"
|
|
22479
22628
|
]);
|
|
22480
22629
|
var MAX_EXPIRED_IDS = 64;
|
|
22630
|
+
var CANCELLATION_RECOVERY_TIMEOUT_MS = 6e4;
|
|
22481
22631
|
function nativeMessageIdentity(active2) {
|
|
22482
22632
|
return active2.assistantNativeMessageIdentity ? { nativeMessageIdentity: active2.assistantNativeMessageIdentity } : {};
|
|
22483
22633
|
}
|
|
@@ -22723,11 +22873,12 @@ var PiRpcSession = class {
|
|
|
22723
22873
|
// Pieces of the unterminated frame; joined once at its newline so a large frame (a long
|
|
22724
22874
|
// Session's get_entries) costs linear rather than quadratic copying on the Host event loop.
|
|
22725
22875
|
#buffer = [];
|
|
22726
|
-
// Ids whose read-only command timed out
|
|
22876
|
+
// Ids whose read-only command timed out or whose Turn was abandoned.
|
|
22727
22877
|
#expired = /* @__PURE__ */ new Set();
|
|
22728
22878
|
#child = null;
|
|
22729
22879
|
#closed = false;
|
|
22730
22880
|
#closePromise = null;
|
|
22881
|
+
#cancellationRecovery = null;
|
|
22731
22882
|
#compactionActive = false;
|
|
22732
22883
|
#compactionTurn = null;
|
|
22733
22884
|
#failed = false;
|
|
@@ -22776,7 +22927,14 @@ var PiRpcSession = class {
|
|
|
22776
22927
|
return this.#stderrTail;
|
|
22777
22928
|
}
|
|
22778
22929
|
get isBusy() {
|
|
22779
|
-
return this.#activeTurn !== null || this.#manualCompaction !== null || this.#compactionActive || this.#deferredRunFrames.length > 0;
|
|
22930
|
+
return this.#activeTurn !== null || this.#cancellationRecovery !== null || this.#manualCompaction !== null || this.#compactionActive || this.#deferredRunFrames.length > 0 || this.#hasPendingCommand(["steer"]);
|
|
22931
|
+
}
|
|
22932
|
+
#hasPendingCommand(commands) {
|
|
22933
|
+
for (const pending of this.#pending.values()) {
|
|
22934
|
+
if (commands.includes(pending.command))
|
|
22935
|
+
return true;
|
|
22936
|
+
}
|
|
22937
|
+
return false;
|
|
22780
22938
|
}
|
|
22781
22939
|
setSubagentStatusHandler(handler) {
|
|
22782
22940
|
this.#subagents.setHandler(handler);
|
|
@@ -22923,7 +23081,7 @@ var PiRpcSession = class {
|
|
|
22923
23081
|
if (!this.#child || !this.#state || this.#closed || this.#failed) {
|
|
22924
23082
|
throw new Error("Pi RPC Session is unavailable");
|
|
22925
23083
|
}
|
|
22926
|
-
if (this.#activeTurn || this.#manualCompaction || this.#compactionActive) {
|
|
23084
|
+
if (this.#activeTurn || this.#cancellationRecovery || this.#manualCompaction || this.#compactionActive || this.#hasPendingCommand(["steer"])) {
|
|
22927
23085
|
throw new Error("Pi RPC Session already has an active operation");
|
|
22928
23086
|
}
|
|
22929
23087
|
const result = new Promise((resolve, reject) => {
|
|
@@ -23128,11 +23286,14 @@ var PiRpcSession = class {
|
|
|
23128
23286
|
abortPromise: null
|
|
23129
23287
|
};
|
|
23130
23288
|
});
|
|
23289
|
+
const active2 = this.#activeTurn;
|
|
23131
23290
|
try {
|
|
23132
23291
|
this.#drainProgress(onEvent);
|
|
23133
23292
|
await this.#send("prompt", { message: text5 });
|
|
23134
23293
|
} catch (error51) {
|
|
23135
|
-
this.#
|
|
23294
|
+
if (this.#activeTurn === active2) {
|
|
23295
|
+
this.#rejectActiveTurn(error51 instanceof Error ? error51 : new Error(message2(error51)));
|
|
23296
|
+
}
|
|
23136
23297
|
}
|
|
23137
23298
|
return settled;
|
|
23138
23299
|
}
|
|
@@ -23183,11 +23344,13 @@ var PiRpcSession = class {
|
|
|
23183
23344
|
active2.cancellation = "accepted";
|
|
23184
23345
|
this.#finishSettledTurn(active2);
|
|
23185
23346
|
}).catch((error51) => {
|
|
23186
|
-
if (this.#activeTurn !== active2)
|
|
23347
|
+
if (this.#activeTurn !== active2) {
|
|
23348
|
+
if (active2.cancellation === "abandoned")
|
|
23349
|
+
return;
|
|
23187
23350
|
throw error51;
|
|
23351
|
+
}
|
|
23188
23352
|
const fault = error51 instanceof PiRpcFaultError ? error51 : new PiRpcFaultError("protocolError", `Pi RPC Abort failed: ${message2(error51)}`);
|
|
23189
23353
|
this.#terminateFailedCancellation(active2, fault);
|
|
23190
|
-
throw fault;
|
|
23191
23354
|
});
|
|
23192
23355
|
active2.abortPromise = aborting;
|
|
23193
23356
|
return aborting;
|
|
@@ -23198,10 +23361,82 @@ var PiRpcSession = class {
|
|
|
23198
23361
|
if (active2.cancellationTimeout)
|
|
23199
23362
|
clearTimeout(active2.cancellationTimeout);
|
|
23200
23363
|
active2.cancellationTimeout = null;
|
|
23201
|
-
this.#
|
|
23202
|
-
|
|
23364
|
+
if (this.#hasPendingCommand(["prompt", "steer"])) {
|
|
23365
|
+
void this.#faultAfterProcessCleanup(fault, "Pi RPC unacknowledged input cleanup failed");
|
|
23366
|
+
return;
|
|
23367
|
+
}
|
|
23368
|
+
active2.cancellation = "abandoned";
|
|
23369
|
+
const recovery = {
|
|
23370
|
+
probe: null,
|
|
23371
|
+
nativeStartGeneration: 0,
|
|
23372
|
+
timer: setTimeout(() => {
|
|
23373
|
+
void this.#expireCancellationRecovery(recovery, fault);
|
|
23374
|
+
}, CANCELLATION_RECOVERY_TIMEOUT_MS).unref()
|
|
23375
|
+
};
|
|
23376
|
+
this.#cancellationRecovery = recovery;
|
|
23377
|
+
this.#activeTurn = null;
|
|
23378
|
+
this.#deferredRunFrames = [];
|
|
23379
|
+
this.#deferredRunBytes = 0;
|
|
23380
|
+
for (const waiter of this.#runWaiters)
|
|
23381
|
+
waiter.reject(fault);
|
|
23382
|
+
for (const [id2, pending] of this.#pending) {
|
|
23383
|
+
if (pending.command !== "abort" && pending.command !== "prompt" && pending.command !== "steer") {
|
|
23384
|
+
continue;
|
|
23385
|
+
}
|
|
23386
|
+
if (pending.timeout)
|
|
23387
|
+
clearTimeout(pending.timeout);
|
|
23388
|
+
this.#pending.delete(id2);
|
|
23389
|
+
this.#rememberExpiredCommand(id2);
|
|
23390
|
+
pending.reject(fault);
|
|
23391
|
+
}
|
|
23392
|
+
if (this.#compactionActive) {
|
|
23393
|
+
this.#compactionActive = false;
|
|
23394
|
+
this.#compactionTurn = null;
|
|
23395
|
+
active2.onEvent({ type: "compaction.completed", outcome: "cancelled" });
|
|
23396
|
+
}
|
|
23397
|
+
this.#closeInteractions(active2, "cancelled");
|
|
23398
|
+
if (active2.origin === "autonomous") {
|
|
23399
|
+
this.#emitAutonomousTurn(active2, {
|
|
23400
|
+
status: "cancelled",
|
|
23401
|
+
text: active2.text,
|
|
23402
|
+
reason: fault.message
|
|
23403
|
+
});
|
|
23404
|
+
} else {
|
|
23405
|
+
active2.resolve({ text: active2.text, cancelled: true });
|
|
23406
|
+
}
|
|
23407
|
+
void this.#probeCancellationRecovery(recovery);
|
|
23408
|
+
}
|
|
23409
|
+
#probeCancellationRecovery(recovery) {
|
|
23410
|
+
const generation = recovery.nativeStartGeneration;
|
|
23411
|
+
recovery.probe ??= this.#send("get_state", {}, void 0, this.#options.closeTimeoutMs).then((response) => {
|
|
23412
|
+
const state2 = sessionStateData(response);
|
|
23413
|
+
if (this.#cancellationRecovery === recovery && recovery.nativeStartGeneration === generation && state2.isStreaming === false && state2.isCompacting === false) {
|
|
23414
|
+
this.#clearCancellationRecovery();
|
|
23415
|
+
}
|
|
23416
|
+
}).catch(() => {
|
|
23417
|
+
}).finally(() => {
|
|
23418
|
+
recovery.probe = null;
|
|
23419
|
+
});
|
|
23420
|
+
return recovery.probe;
|
|
23421
|
+
}
|
|
23422
|
+
async #expireCancellationRecovery(recovery, cancellationFault) {
|
|
23423
|
+
await recovery.probe;
|
|
23424
|
+
if (this.#cancellationRecovery !== recovery)
|
|
23425
|
+
return;
|
|
23426
|
+
await this.#probeCancellationRecovery(recovery);
|
|
23427
|
+
if (this.#cancellationRecovery !== recovery)
|
|
23428
|
+
return;
|
|
23429
|
+
const fault = new PiRpcFaultError("protocolError", `Pi RPC Session did not return to confirmed idle after an unconfirmed cancellation: ${cancellationFault.message}`);
|
|
23430
|
+
await this.#faultAfterProcessCleanup(fault, "Pi RPC cancellation recovery cleanup failed");
|
|
23431
|
+
}
|
|
23432
|
+
#clearCancellationRecovery() {
|
|
23433
|
+
if (!this.#cancellationRecovery)
|
|
23434
|
+
return;
|
|
23435
|
+
clearTimeout(this.#cancellationRecovery.timer);
|
|
23436
|
+
this.#cancellationRecovery = null;
|
|
23203
23437
|
}
|
|
23204
23438
|
close() {
|
|
23439
|
+
this.#clearCancellationRecovery();
|
|
23205
23440
|
this.#pendingProgress = [];
|
|
23206
23441
|
this.#omittedProgress = 0;
|
|
23207
23442
|
this.#seenNoticeFrames.clear();
|
|
@@ -23271,6 +23506,25 @@ var PiRpcSession = class {
|
|
|
23271
23506
|
}
|
|
23272
23507
|
if (this.#subagents.handle(value))
|
|
23273
23508
|
return;
|
|
23509
|
+
const recovery = this.#cancellationRecovery;
|
|
23510
|
+
if (recovery) {
|
|
23511
|
+
if (this.#handleGotgenesWidget(value))
|
|
23512
|
+
return;
|
|
23513
|
+
if (this.#handleProgress(value))
|
|
23514
|
+
return;
|
|
23515
|
+
this.#observeUsage(value);
|
|
23516
|
+
if (value.type === "agent_start" || value.type === "compaction_start") {
|
|
23517
|
+
recovery.nativeStartGeneration += 1;
|
|
23518
|
+
}
|
|
23519
|
+
if (value.type === "agent_settled" || value.type === "compaction_end") {
|
|
23520
|
+
void Promise.resolve(recovery.probe).then(() => {
|
|
23521
|
+
if (this.#cancellationRecovery === recovery) {
|
|
23522
|
+
return this.#probeCancellationRecovery(recovery);
|
|
23523
|
+
}
|
|
23524
|
+
});
|
|
23525
|
+
}
|
|
23526
|
+
return;
|
|
23527
|
+
}
|
|
23274
23528
|
const settling = this.#activeTurn;
|
|
23275
23529
|
if (settling && settling.settlement !== "pending" && generation > settling.runGeneration) {
|
|
23276
23530
|
this.#deferredRunBytes += Buffer.byteLength(JSON.stringify(value));
|
|
@@ -23288,14 +23542,8 @@ var PiRpcSession = class {
|
|
|
23288
23542
|
this.#startAutonomousTurn(void 0, generation);
|
|
23289
23543
|
return;
|
|
23290
23544
|
}
|
|
23291
|
-
if (value
|
|
23292
|
-
const records = parseGotgenesWidget(value);
|
|
23293
|
-
if (records) {
|
|
23294
|
-
this.#gotgenesLatest = records;
|
|
23295
|
-
this.#gotgenesHandler?.(records, this.#activeTurn?.origin ?? "idle");
|
|
23296
|
-
}
|
|
23545
|
+
if (this.#handleGotgenesWidget(value))
|
|
23297
23546
|
return;
|
|
23298
|
-
}
|
|
23299
23547
|
if (this.#handleProgress(value))
|
|
23300
23548
|
return;
|
|
23301
23549
|
this.#observeUsage(value);
|
|
@@ -23455,6 +23703,17 @@ var PiRpcSession = class {
|
|
|
23455
23703
|
this.#drainProgress(active2.onEvent);
|
|
23456
23704
|
return active2;
|
|
23457
23705
|
}
|
|
23706
|
+
#handleGotgenesWidget(value) {
|
|
23707
|
+
if (value.type !== "extension_ui_request" || value.method !== "setWidget" || value.widgetKey !== GOTGENES_WIDGET) {
|
|
23708
|
+
return false;
|
|
23709
|
+
}
|
|
23710
|
+
const records = parseGotgenesWidget(value);
|
|
23711
|
+
if (records) {
|
|
23712
|
+
this.#gotgenesLatest = records;
|
|
23713
|
+
this.#gotgenesHandler?.(records, this.#activeTurn?.origin ?? "idle");
|
|
23714
|
+
}
|
|
23715
|
+
return true;
|
|
23716
|
+
}
|
|
23458
23717
|
#handleProgress(value) {
|
|
23459
23718
|
if ((value.type === "message_start" || value.type === "message_end") && isRecord9(value.message) && value.message.role === "custom") {
|
|
23460
23719
|
if (value.type !== "message_end" || !this.#state)
|
|
@@ -23928,7 +24187,7 @@ var PiRpcSession = class {
|
|
|
23928
24187
|
child.stdin.write(frame, (error51) => error51 ? reject(error51) : resolve());
|
|
23929
24188
|
});
|
|
23930
24189
|
}
|
|
23931
|
-
#send(type, payload, onResponse) {
|
|
24190
|
+
#send(type, payload, onResponse, timeoutMs = this.#options.commandTimeoutMs) {
|
|
23932
24191
|
const child = this.#child;
|
|
23933
24192
|
if (!child?.stdin.writable || this.#closed || this.#failed) {
|
|
23934
24193
|
return Promise.reject(new Error("Pi RPC stdin is unavailable"));
|
|
@@ -23945,7 +24204,7 @@ var PiRpcSession = class {
|
|
|
23945
24204
|
timeout: null
|
|
23946
24205
|
};
|
|
23947
24206
|
this.#pending.set(id2, pending);
|
|
23948
|
-
this.#armCommandTimeout(id2, pending);
|
|
24207
|
+
this.#armCommandTimeout(id2, pending, timeoutMs);
|
|
23949
24208
|
const frame = Buffer.from(`${JSON.stringify({ id: id2, type, ...payload })}
|
|
23950
24209
|
`, "utf8");
|
|
23951
24210
|
child.stdin.write(frame, (error51) => {
|
|
@@ -23958,7 +24217,7 @@ var PiRpcSession = class {
|
|
|
23958
24217
|
});
|
|
23959
24218
|
});
|
|
23960
24219
|
}
|
|
23961
|
-
#armCommandTimeout(id2, pending) {
|
|
24220
|
+
#armCommandTimeout(id2, pending, timeoutMs = this.#options.commandTimeoutMs) {
|
|
23962
24221
|
if (pending.timeout || this.#pending.get(id2) !== pending || (pending.command === "prompt" || pending.command === "compact") && this.#compactionActive) {
|
|
23963
24222
|
return;
|
|
23964
24223
|
}
|
|
@@ -23967,22 +24226,25 @@ var PiRpcSession = class {
|
|
|
23967
24226
|
return;
|
|
23968
24227
|
pending.timeout = null;
|
|
23969
24228
|
const error51 = new Error(`Pi RPC '${pending.command}' command timed out`);
|
|
23970
|
-
if (pending.command !== "prompt") {
|
|
24229
|
+
if (pending.command !== "prompt" && pending.command !== "steer") {
|
|
23971
24230
|
this.#pending.delete(id2);
|
|
23972
|
-
if (READ_ONLY_COMMANDS.has(pending.command)) {
|
|
23973
|
-
this.#
|
|
23974
|
-
if (this.#expired.size > MAX_EXPIRED_IDS) {
|
|
23975
|
-
this.#expired.delete(this.#expired.values().next().value);
|
|
23976
|
-
}
|
|
24231
|
+
if (READ_ONLY_COMMANDS.has(pending.command) || pending.command === "abort") {
|
|
24232
|
+
this.#rememberExpiredCommand(id2);
|
|
23977
24233
|
}
|
|
23978
24234
|
pending.reject(error51);
|
|
23979
24235
|
return;
|
|
23980
24236
|
}
|
|
23981
24237
|
const fault = new PiRpcFaultError("protocolError", error51.message);
|
|
23982
|
-
void this.#
|
|
23983
|
-
},
|
|
24238
|
+
void this.#faultAfterProcessCleanup(fault, pending.command === "steer" ? "Pi RPC timed-out Steer cleanup failed" : "Pi RPC timed-out Prompt cleanup failed");
|
|
24239
|
+
}, timeoutMs);
|
|
24240
|
+
}
|
|
24241
|
+
#rememberExpiredCommand(id2) {
|
|
24242
|
+
this.#expired.add(id2);
|
|
24243
|
+
if (this.#expired.size > MAX_EXPIRED_IDS) {
|
|
24244
|
+
this.#expired.delete(this.#expired.values().next().value);
|
|
24245
|
+
}
|
|
23984
24246
|
}
|
|
23985
|
-
async #
|
|
24247
|
+
async #faultAfterProcessCleanup(fault, context) {
|
|
23986
24248
|
if (this.#closed || this.#failed)
|
|
23987
24249
|
return;
|
|
23988
24250
|
this.#failed = true;
|
|
@@ -23996,7 +24258,7 @@ var PiRpcSession = class {
|
|
|
23996
24258
|
try {
|
|
23997
24259
|
await this.close();
|
|
23998
24260
|
} catch (error51) {
|
|
23999
|
-
finalFault = new PiRpcFaultError("processExited",
|
|
24261
|
+
finalFault = new PiRpcFaultError("processExited", `${context}: ${message2(error51)}`);
|
|
24000
24262
|
}
|
|
24001
24263
|
this.#rejectAll(finalFault);
|
|
24002
24264
|
this.#options.onFault?.(finalFault);
|
|
@@ -24051,6 +24313,7 @@ var PiRpcSession = class {
|
|
|
24051
24313
|
if (this.#closed || this.#failed)
|
|
24052
24314
|
return;
|
|
24053
24315
|
this.#failed = true;
|
|
24316
|
+
this.#clearCancellationRecovery();
|
|
24054
24317
|
this.#rejectAll(error51);
|
|
24055
24318
|
this.#options.onFault?.(error51);
|
|
24056
24319
|
}
|