@codexhost/cli-darwin-x64 0.21.0 → 0.22.0
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 +1 -0
- package/app/console-web.js +1 -0
- package/app/desktop-controller.mjs +4 -1
- package/app/host-runtime.mjs +86 -21
- package/app/plugins/antigravity/plugin.mjs +1144 -1254
- package/app/plugins/claude-code/plugin.mjs +389 -84
- package/app/plugins/codebuddy/plugin.mjs +1 -0
- package/app/plugins/codex-usage/plugin.mjs +1 -0
- package/app/plugins/copilot/plugin.mjs +1 -0
- package/app/plugins/cursor-cli/plugin.mjs +1 -0
- package/app/plugins/deepseek-harness/plugin.mjs +1 -0
- package/app/plugins/devin/plugin.mjs +1 -0
- package/app/plugins/grok/plugin.mjs +192 -177
- package/app/plugins/hermes/plugin.mjs +1 -0
- package/app/plugins/kimi-code/plugin.mjs +1 -0
- package/app/plugins/kiro-cli/plugin.mjs +1 -0
- package/app/plugins/omp/plugin.mjs +108 -22
- package/app/plugins/opencode/plugin.mjs +1 -0
- package/app/plugins/pi/plugin.mjs +119 -23
- package/app/plugins/qoder/plugin.mjs +1 -0
- package/app/plugins/qoder-cn/plugin.mjs +1 -0
- package/app/plugins/qwen-code/plugin.mjs +1 -0
- package/app/plugins/workbuddy/plugin.mjs +1 -0
- package/app/plugins/zcode/plugin.mjs +1 -0
- package/app/renderer-extension.js +1 -0
- package/app/web/assets/index-CN4a4sj0.js +201 -0
- package/app/web/codexhost-settings.js +1 -0
- package/app/web/index.html +1 -1
- 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 +6 -6
- package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +69 -69
- package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +1 -1
- package/app/web-modules/server.mjs +130 -74
- package/bin/codexhost +0 -0
- package/libexec/codexhost-shim +0 -0
- package/libexec/codexhost-updater +0 -0
- package/package.json +1 -1
- package/app/web/assets/index-BdmZfTRW.js +0 -201
|
@@ -16867,6 +16867,7 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
|
16867
16867
|
message: "A history continuation requires its connection epoch"
|
|
16868
16868
|
}).optional()
|
|
16869
16869
|
}),
|
|
16870
|
+
external_exports.strictObject({ kind: external_exports.literal("usage"), ...thread, epoch: identity }),
|
|
16870
16871
|
external_exports.strictObject({
|
|
16871
16872
|
kind: external_exports.literal("configure"),
|
|
16872
16873
|
...thread,
|
|
@@ -16987,6 +16987,7 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
|
16987
16987
|
message: "A history continuation requires its connection epoch"
|
|
16988
16988
|
}).optional()
|
|
16989
16989
|
}),
|
|
16990
|
+
external_exports.strictObject({ kind: external_exports.literal("usage"), ...thread, epoch: identity }),
|
|
16990
16991
|
external_exports.strictObject({
|
|
16991
16992
|
kind: external_exports.literal("configure"),
|
|
16992
16993
|
...thread,
|
|
@@ -16842,6 +16842,7 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
|
16842
16842
|
message: "A history continuation requires its connection epoch"
|
|
16843
16843
|
}).optional()
|
|
16844
16844
|
}),
|
|
16845
|
+
external_exports.strictObject({ kind: external_exports.literal("usage"), ...thread, epoch: identity }),
|
|
16845
16846
|
external_exports.strictObject({
|
|
16846
16847
|
kind: external_exports.literal("configure"),
|
|
16847
16848
|
...thread,
|
|
@@ -16903,6 +16903,7 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
|
16903
16903
|
message: "A history continuation requires its connection epoch"
|
|
16904
16904
|
}).optional()
|
|
16905
16905
|
}),
|
|
16906
|
+
external_exports.strictObject({ kind: external_exports.literal("usage"), ...thread, epoch: identity }),
|
|
16906
16907
|
external_exports.strictObject({
|
|
16907
16908
|
kind: external_exports.literal("configure"),
|
|
16908
16909
|
...thread,
|
|
@@ -17135,18 +17136,6 @@ function sanitizeDiagnosticTail(value) {
|
|
|
17135
17136
|
return redacted.length <= DIAGNOSTIC_TAIL_MAX_LENGTH ? redacted : redacted.slice(-DIAGNOSTIC_TAIL_MAX_LENGTH);
|
|
17136
17137
|
}
|
|
17137
17138
|
|
|
17138
|
-
// ../../harness-adapter/dist/steer.js
|
|
17139
|
-
function unsupportedSteer(harnessLabel) {
|
|
17140
|
-
return {
|
|
17141
|
-
ok: false,
|
|
17142
|
-
error: {
|
|
17143
|
-
code: "unsupported",
|
|
17144
|
-
message: `${harnessLabel} cannot steer an active Turn natively`,
|
|
17145
|
-
retryable: false
|
|
17146
|
-
}
|
|
17147
|
-
};
|
|
17148
|
-
}
|
|
17149
|
-
|
|
17150
17139
|
// ../../harness-adapter/dist/usage.js
|
|
17151
17140
|
var tokenFields = [
|
|
17152
17141
|
"inputTokens",
|
|
@@ -18783,6 +18772,15 @@ var OmpRpcFaultError = class extends Error {
|
|
|
18783
18772
|
this.name = "OmpRpcFaultError";
|
|
18784
18773
|
}
|
|
18785
18774
|
};
|
|
18775
|
+
var OmpRpcSteerRejectedError = class extends Error {
|
|
18776
|
+
};
|
|
18777
|
+
var OmpRpcSteerTargetEndedError = class extends OmpRpcFaultError {
|
|
18778
|
+
history;
|
|
18779
|
+
constructor(history) {
|
|
18780
|
+
super("protocolError", "Omp Turn ended before steer admission could be confirmed. Delivery is unknown; do not automatically resend the input");
|
|
18781
|
+
this.history = history;
|
|
18782
|
+
}
|
|
18783
|
+
};
|
|
18786
18784
|
var OmpRpcUnsupportedCommandError = class extends Error {
|
|
18787
18785
|
command;
|
|
18788
18786
|
constructor(command) {
|
|
@@ -19306,6 +19304,30 @@ var OmpRpcSession = class {
|
|
|
19306
19304
|
throw fault;
|
|
19307
19305
|
}
|
|
19308
19306
|
}
|
|
19307
|
+
async steer(message3) {
|
|
19308
|
+
if (!this.#child || !this.#state || this.#closed || this.#failed) {
|
|
19309
|
+
throw new Error("Omp RPC Session is unavailable");
|
|
19310
|
+
}
|
|
19311
|
+
if (message3.length === 0)
|
|
19312
|
+
throw new Error("Omp steer text must not be empty");
|
|
19313
|
+
const target2 = this.#activeTurn;
|
|
19314
|
+
let targetEnded = false;
|
|
19315
|
+
const response = await this.#send("steer", { message: message3 }, void 0, () => {
|
|
19316
|
+
targetEnded = target2 !== null && this.#activeTurn !== target2;
|
|
19317
|
+
});
|
|
19318
|
+
if (isRecord8(response.data) && response.data.disposition !== void 0 && response.data.disposition !== "queued") {
|
|
19319
|
+
throw new Error("Omp steer was handled without confirming same-Turn queue admission");
|
|
19320
|
+
}
|
|
19321
|
+
if (targetEnded) {
|
|
19322
|
+
let history;
|
|
19323
|
+
try {
|
|
19324
|
+
history = await this.getEntries();
|
|
19325
|
+
} finally {
|
|
19326
|
+
await this.close().catch(() => void 0);
|
|
19327
|
+
}
|
|
19328
|
+
throw new OmpRpcSteerTargetEndedError(history);
|
|
19329
|
+
}
|
|
19330
|
+
}
|
|
19309
19331
|
async runTurn(text, onEvent) {
|
|
19310
19332
|
if (!this.#child || !this.#state || this.#closed || this.#failed) {
|
|
19311
19333
|
throw new Error("Omp RPC Session is unavailable");
|
|
@@ -19873,7 +19895,9 @@ var OmpRpcSession = class {
|
|
|
19873
19895
|
pending.resolve(value);
|
|
19874
19896
|
} else {
|
|
19875
19897
|
const error51 = typeof value.error === "string" ? value.error : "Omp RPC command failed";
|
|
19876
|
-
if (
|
|
19898
|
+
if (pending.command === "steer" && value.command === "steer" && value.success === false) {
|
|
19899
|
+
pending.reject(new OmpRpcSteerRejectedError(error51));
|
|
19900
|
+
} else if (value.command === pending.command && error51 === `Unknown command: ${pending.command}`) {
|
|
19877
19901
|
pending.reject(new OmpRpcUnsupportedCommandError(pending.command));
|
|
19878
19902
|
} else {
|
|
19879
19903
|
pending.reject(new Error(error51));
|
|
@@ -20153,7 +20177,7 @@ var OmpRpcSession = class {
|
|
|
20153
20177
|
child.stdin.write(frame, (error51) => error51 ? reject(error51) : resolve());
|
|
20154
20178
|
});
|
|
20155
20179
|
}
|
|
20156
|
-
#send(type, payload, id = `codexhost-${randomUUID()}
|
|
20180
|
+
#send(type, payload, id = `codexhost-${randomUUID()}`, onResponse) {
|
|
20157
20181
|
const child = this.#child;
|
|
20158
20182
|
if (!child?.stdin.writable || this.#closed || this.#failed) {
|
|
20159
20183
|
return Promise.reject(new Error("Omp RPC stdin is unavailable"));
|
|
@@ -20161,7 +20185,10 @@ var OmpRpcSession = class {
|
|
|
20161
20185
|
return new Promise((resolve, reject) => {
|
|
20162
20186
|
const pending = {
|
|
20163
20187
|
command: type,
|
|
20164
|
-
resolve
|
|
20188
|
+
resolve: (response) => {
|
|
20189
|
+
onResponse?.();
|
|
20190
|
+
resolve(response);
|
|
20191
|
+
},
|
|
20165
20192
|
reject,
|
|
20166
20193
|
timeout: null
|
|
20167
20194
|
};
|
|
@@ -21496,7 +21523,7 @@ var OmpHarnessSession = class {
|
|
|
21496
21523
|
this.#toolOutputLimit = options.toolOutputLimit;
|
|
21497
21524
|
this.#permissionMode = options.permissionMode;
|
|
21498
21525
|
this.#permissionModeId = options.permissionModeId;
|
|
21499
|
-
this.capabilities = {
|
|
21526
|
+
this.capabilities = ((session) => ({
|
|
21500
21527
|
configuration: {
|
|
21501
21528
|
selectModel: true,
|
|
21502
21529
|
selectThinkingOption: options.supportsThinkingSelection,
|
|
@@ -21504,8 +21531,11 @@ var OmpHarnessSession = class {
|
|
|
21504
21531
|
permissionModeScope: "live"
|
|
21505
21532
|
},
|
|
21506
21533
|
history: { fork: true, forkAcrossCwd: true, rollbackLastTurn: true },
|
|
21507
|
-
subagents: { observe: true, readTranscript: true }
|
|
21508
|
-
|
|
21534
|
+
subagents: { observe: true, readTranscript: true },
|
|
21535
|
+
get steer() {
|
|
21536
|
+
return session.#canSteerActiveTurn();
|
|
21537
|
+
}
|
|
21538
|
+
}))(this);
|
|
21509
21539
|
this.commands = {
|
|
21510
21540
|
list: async () => ({ ok: true, value: this.#liveCommandCatalog() }),
|
|
21511
21541
|
execute: (command) => this.#executeHarnessCommand(command)
|
|
@@ -21646,7 +21676,7 @@ var OmpHarnessSession = class {
|
|
|
21646
21676
|
if (command.type === "turn.cancel")
|
|
21647
21677
|
return this.#cancel(command);
|
|
21648
21678
|
if (command.type === "turn.steer")
|
|
21649
|
-
return
|
|
21679
|
+
return this.#steer(command);
|
|
21650
21680
|
if (command.type === "interaction.respond")
|
|
21651
21681
|
return this.#respond(command);
|
|
21652
21682
|
if (command.type === "model.select")
|
|
@@ -21716,6 +21746,9 @@ var OmpHarnessSession = class {
|
|
|
21716
21746
|
agentMessageId: null,
|
|
21717
21747
|
compactionItem: null,
|
|
21718
21748
|
sawAssistantMessage: false,
|
|
21749
|
+
acceptedSteerCount: 0,
|
|
21750
|
+
acceptingSteers: true,
|
|
21751
|
+
pendingSteers: /* @__PURE__ */ new Set(),
|
|
21719
21752
|
reasoningItem: null,
|
|
21720
21753
|
tools: /* @__PURE__ */ new Map(),
|
|
21721
21754
|
interactions: /* @__PURE__ */ new Map(),
|
|
@@ -22073,6 +22106,47 @@ var OmpHarnessSession = class {
|
|
|
22073
22106
|
return { ok: false, error: normalizedError(error51, "nativeFailure") };
|
|
22074
22107
|
}
|
|
22075
22108
|
}
|
|
22109
|
+
#canSteerActiveTurn() {
|
|
22110
|
+
const active = this.#active;
|
|
22111
|
+
return Boolean(this.#phase === "open" && active && !active.cancellationRequested && active.acceptingSteers && active.tools.size > 0 && this.#transport);
|
|
22112
|
+
}
|
|
22113
|
+
async #steer(command) {
|
|
22114
|
+
const text = command.input.map((input) => input.text).join("\n");
|
|
22115
|
+
if (text.length === 0) {
|
|
22116
|
+
return {
|
|
22117
|
+
ok: false,
|
|
22118
|
+
error: {
|
|
22119
|
+
code: "invalidRequest",
|
|
22120
|
+
message: "Omp steer text must not be empty",
|
|
22121
|
+
retryable: false
|
|
22122
|
+
}
|
|
22123
|
+
};
|
|
22124
|
+
}
|
|
22125
|
+
const active = this.#active;
|
|
22126
|
+
const transport = this.#transport;
|
|
22127
|
+
if (!active || !transport || active.command.turnId !== command.turnId || !this.#canSteerActiveTurn()) {
|
|
22128
|
+
return { ok: false, error: invalidState("Omp Turn is not accepting native input") };
|
|
22129
|
+
}
|
|
22130
|
+
let accepted;
|
|
22131
|
+
try {
|
|
22132
|
+
accepted = transport.steer(text).then(() => {
|
|
22133
|
+
active.acceptedSteerCount += 1;
|
|
22134
|
+
});
|
|
22135
|
+
active.pendingSteers.add(accepted);
|
|
22136
|
+
await accepted;
|
|
22137
|
+
return { ok: true, value: { accepted: true } };
|
|
22138
|
+
} catch (error51) {
|
|
22139
|
+
if (error51 instanceof OmpRpcSteerRejectedError) {
|
|
22140
|
+
return { ok: false, error: invalidState(error51.message) };
|
|
22141
|
+
}
|
|
22142
|
+
if (error51 instanceof OmpRpcSteerTargetEndedError)
|
|
22143
|
+
active.steerFailure = error51;
|
|
22144
|
+
throw error51;
|
|
22145
|
+
} finally {
|
|
22146
|
+
if (accepted)
|
|
22147
|
+
active.pendingSteers.delete(accepted);
|
|
22148
|
+
}
|
|
22149
|
+
}
|
|
22076
22150
|
async #cancel(command) {
|
|
22077
22151
|
const active = this.#active;
|
|
22078
22152
|
if (!active || active.command.turnId !== command.turnId) {
|
|
@@ -22183,6 +22257,9 @@ var OmpHarnessSession = class {
|
|
|
22183
22257
|
agentMessageId: null,
|
|
22184
22258
|
compactionItem: null,
|
|
22185
22259
|
sawAssistantMessage: false,
|
|
22260
|
+
acceptedSteerCount: 0,
|
|
22261
|
+
acceptingSteers: false,
|
|
22262
|
+
pendingSteers: /* @__PURE__ */ new Set(),
|
|
22186
22263
|
reasoningItem: null,
|
|
22187
22264
|
tools: /* @__PURE__ */ new Map(),
|
|
22188
22265
|
interactions: /* @__PURE__ */ new Map(),
|
|
@@ -22684,13 +22761,18 @@ var OmpHarnessSession = class {
|
|
|
22684
22761
|
});
|
|
22685
22762
|
}
|
|
22686
22763
|
async #completedTurnIdentity(active, transport) {
|
|
22687
|
-
|
|
22764
|
+
active.acceptingSteers = false;
|
|
22765
|
+
await Promise.allSettled([...active.pendingSteers]);
|
|
22766
|
+
const history = active.steerFailure?.history ?? await transport.getEntries();
|
|
22767
|
+
const snapshot = mapOmpSnapshot(history, {
|
|
22688
22768
|
sessionId: transport.state.sessionId,
|
|
22689
22769
|
model: nativeModelForHistory(transport.state)
|
|
22690
22770
|
});
|
|
22691
22771
|
const created = snapshot.turns.filter((turn2) => !active.beforeNativeTurnKeys.has(turn2.nativeTurnRef.nativeTurnKey));
|
|
22692
|
-
|
|
22693
|
-
|
|
22772
|
+
const expected = 1 + active.acceptedSteerCount;
|
|
22773
|
+
if (created.length !== expected) {
|
|
22774
|
+
const countText = expected === 1 ? "one" : `${expected}`;
|
|
22775
|
+
throw new Error(`Omp Turn persisted ${created.length} new User Entries; exactly ${countText} is required`);
|
|
22694
22776
|
}
|
|
22695
22777
|
const turn = created[0];
|
|
22696
22778
|
if (!turn?.checkpoint)
|
|
@@ -22733,6 +22815,10 @@ var OmpHarnessSession = class {
|
|
|
22733
22815
|
...ephemeral ? { ephemeral } : {}
|
|
22734
22816
|
});
|
|
22735
22817
|
active.resolveCompletion();
|
|
22818
|
+
if (active.steerFailure) {
|
|
22819
|
+
this.#fault(active.steerFailure);
|
|
22820
|
+
return;
|
|
22821
|
+
}
|
|
22736
22822
|
queueMicrotask(() => {
|
|
22737
22823
|
if (this.#phase === "open")
|
|
22738
22824
|
void this.#refreshUsage(active.command.turnId);
|
|
@@ -17046,6 +17046,7 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
|
17046
17046
|
message: "A history continuation requires its connection epoch"
|
|
17047
17047
|
}).optional()
|
|
17048
17048
|
}),
|
|
17049
|
+
external_exports.strictObject({ kind: external_exports.literal("usage"), ...thread, epoch: identity }),
|
|
17049
17050
|
external_exports.strictObject({
|
|
17050
17051
|
kind: external_exports.literal("configure"),
|
|
17051
17052
|
...thread,
|
|
@@ -16903,6 +16903,7 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
|
16903
16903
|
message: "A history continuation requires its connection epoch"
|
|
16904
16904
|
}).optional()
|
|
16905
16905
|
}),
|
|
16906
|
+
external_exports.strictObject({ kind: external_exports.literal("usage"), ...thread, epoch: identity }),
|
|
16906
16907
|
external_exports.strictObject({
|
|
16907
16908
|
kind: external_exports.literal("configure"),
|
|
16908
16909
|
...thread,
|
|
@@ -17127,18 +17128,6 @@ function sanitizeDiagnosticTail(value) {
|
|
|
17127
17128
|
return redacted.length <= DIAGNOSTIC_TAIL_MAX_LENGTH ? redacted : redacted.slice(-DIAGNOSTIC_TAIL_MAX_LENGTH);
|
|
17128
17129
|
}
|
|
17129
17130
|
|
|
17130
|
-
// ../../harness-adapter/dist/steer.js
|
|
17131
|
-
function unsupportedSteer(harnessLabel) {
|
|
17132
|
-
return {
|
|
17133
|
-
ok: false,
|
|
17134
|
-
error: {
|
|
17135
|
-
code: "unsupported",
|
|
17136
|
-
message: `${harnessLabel} cannot steer an active Turn natively`,
|
|
17137
|
-
retryable: false
|
|
17138
|
-
}
|
|
17139
|
-
};
|
|
17140
|
-
}
|
|
17141
|
-
|
|
17142
17131
|
// ../../harness-adapter/dist/usage.js
|
|
17143
17132
|
var tokenFields = [
|
|
17144
17133
|
"inputTokens",
|
|
@@ -21673,6 +21662,15 @@ var PiRpcFaultError = class extends Error {
|
|
|
21673
21662
|
this.name = "PiRpcFaultError";
|
|
21674
21663
|
}
|
|
21675
21664
|
};
|
|
21665
|
+
var PiRpcSteerRejectedError = class extends Error {
|
|
21666
|
+
};
|
|
21667
|
+
var PiRpcSteerTargetEndedError = class extends PiRpcFaultError {
|
|
21668
|
+
history;
|
|
21669
|
+
constructor(history) {
|
|
21670
|
+
super("protocolError", "Pi Turn ended before steer admission could be confirmed; the isolated runtime was closed. Input hook effects are unknown, so do not automatically resend the input");
|
|
21671
|
+
this.history = history;
|
|
21672
|
+
}
|
|
21673
|
+
};
|
|
21676
21674
|
var PiRpcUnsupportedCommandError = class extends Error {
|
|
21677
21675
|
command;
|
|
21678
21676
|
constructor(command) {
|
|
@@ -22269,6 +22267,38 @@ var PiRpcSession = class {
|
|
|
22269
22267
|
throw fault;
|
|
22270
22268
|
}
|
|
22271
22269
|
}
|
|
22270
|
+
async steer(message3) {
|
|
22271
|
+
if (!this.#child || !this.#state || this.#closed || this.#failed) {
|
|
22272
|
+
throw new Error("Pi RPC Session is unavailable");
|
|
22273
|
+
}
|
|
22274
|
+
if (message3.length === 0)
|
|
22275
|
+
throw new Error("Pi steer text must not be empty");
|
|
22276
|
+
const target2 = this.#activeTurn;
|
|
22277
|
+
if (!target2 || target2.origin !== "requested" || target2.settlement !== "pending") {
|
|
22278
|
+
throw new PiRpcSteerRejectedError("Pi Turn is not accepting native input");
|
|
22279
|
+
}
|
|
22280
|
+
let admitted = false;
|
|
22281
|
+
const response = await this.#send("steer", { message: message3 }, () => {
|
|
22282
|
+
admitted = this.#activeTurn === target2 && target2.settlement === "pending";
|
|
22283
|
+
});
|
|
22284
|
+
if (isRecord9(response.data) && response.data.disposition !== void 0 && response.data.disposition !== "queued") {
|
|
22285
|
+
throw new Error("Pi steer was handled without confirming same-Turn queue admission");
|
|
22286
|
+
}
|
|
22287
|
+
if (!admitted) {
|
|
22288
|
+
let history;
|
|
22289
|
+
try {
|
|
22290
|
+
history = await this.getEntries();
|
|
22291
|
+
} finally {
|
|
22292
|
+
try {
|
|
22293
|
+
await this.close();
|
|
22294
|
+
} catch (error51) {
|
|
22295
|
+
if (history !== void 0)
|
|
22296
|
+
throw error51;
|
|
22297
|
+
}
|
|
22298
|
+
}
|
|
22299
|
+
throw new PiRpcSteerTargetEndedError(history);
|
|
22300
|
+
}
|
|
22301
|
+
}
|
|
22272
22302
|
async runTurn(text4, onEvent) {
|
|
22273
22303
|
if (!this.#child || !this.#state || this.#closed || this.#failed) {
|
|
22274
22304
|
throw new Error("Pi RPC Session is unavailable");
|
|
@@ -22832,7 +22862,9 @@ var PiRpcSession = class {
|
|
|
22832
22862
|
pending.resolve(value);
|
|
22833
22863
|
else {
|
|
22834
22864
|
const error51 = typeof value.error === "string" ? value.error : "Pi RPC command failed";
|
|
22835
|
-
if (
|
|
22865
|
+
if (pending.command === "steer" && value.command === "steer" && value.success === false) {
|
|
22866
|
+
pending.reject(new PiRpcSteerRejectedError(error51));
|
|
22867
|
+
} else if (value.command === pending.command && error51 === `Unknown command: ${pending.command}`) {
|
|
22836
22868
|
pending.reject(new PiRpcUnsupportedCommandError(pending.command));
|
|
22837
22869
|
} else {
|
|
22838
22870
|
pending.reject(new Error(error51));
|
|
@@ -23106,7 +23138,7 @@ var PiRpcSession = class {
|
|
|
23106
23138
|
child.stdin.write(frame, (error51) => error51 ? reject(error51) : resolve());
|
|
23107
23139
|
});
|
|
23108
23140
|
}
|
|
23109
|
-
#send(type, payload) {
|
|
23141
|
+
#send(type, payload, onResponse) {
|
|
23110
23142
|
const child = this.#child;
|
|
23111
23143
|
if (!child?.stdin.writable || this.#closed || this.#failed) {
|
|
23112
23144
|
return Promise.reject(new Error("Pi RPC stdin is unavailable"));
|
|
@@ -23115,7 +23147,10 @@ var PiRpcSession = class {
|
|
|
23115
23147
|
return new Promise((resolve, reject) => {
|
|
23116
23148
|
const pending = {
|
|
23117
23149
|
command: type,
|
|
23118
|
-
resolve
|
|
23150
|
+
resolve: (response) => {
|
|
23151
|
+
onResponse?.();
|
|
23152
|
+
resolve(response);
|
|
23153
|
+
},
|
|
23119
23154
|
reject,
|
|
23120
23155
|
timeout: null
|
|
23121
23156
|
};
|
|
@@ -23409,7 +23444,7 @@ var PiHarnessSession = class {
|
|
|
23409
23444
|
this.#requestedThinkingOptionId = options.thinkingOptionId;
|
|
23410
23445
|
this.#toolOutputLimit = options.toolOutputLimit;
|
|
23411
23446
|
this.#isFastSupported = options.isFastSupported;
|
|
23412
|
-
this.capabilities = {
|
|
23447
|
+
this.capabilities = ((session) => ({
|
|
23413
23448
|
configuration: {
|
|
23414
23449
|
selectModel: true,
|
|
23415
23450
|
selectThinkingOption: options.supportsThinkingSelection,
|
|
@@ -23418,8 +23453,12 @@ var PiHarnessSession = class {
|
|
|
23418
23453
|
},
|
|
23419
23454
|
history: { fork: true, forkAcrossCwd: true, rollbackLastTurn: true },
|
|
23420
23455
|
autonomousTurns: { observe: true },
|
|
23421
|
-
subagents: { observe: true, readTranscript: true }
|
|
23422
|
-
|
|
23456
|
+
subagents: { observe: true, readTranscript: true },
|
|
23457
|
+
// Root Tools provide an admission window; the transport also checks native receipt order.
|
|
23458
|
+
get steer() {
|
|
23459
|
+
return session.#canSteerActiveTurn();
|
|
23460
|
+
}
|
|
23461
|
+
}))(this);
|
|
23423
23462
|
this.commands = {
|
|
23424
23463
|
list: async () => ({ ok: true, value: await this.#refreshLiveCommands() }),
|
|
23425
23464
|
execute: (command) => this.#executeHarnessCommand(command)
|
|
@@ -23514,8 +23553,6 @@ var PiHarnessSession = class {
|
|
|
23514
23553
|
if (this.#phase !== "open") {
|
|
23515
23554
|
return { ok: false, error: invalidState("Pi Session is not open") };
|
|
23516
23555
|
}
|
|
23517
|
-
if (command.type === "turn.steer")
|
|
23518
|
-
return unsupportedSteer("Pi");
|
|
23519
23556
|
if (command.type === "turn.cancel")
|
|
23520
23557
|
return this.#cancel(command);
|
|
23521
23558
|
if (command.type === "interaction.respond")
|
|
@@ -23534,6 +23571,8 @@ var PiHarnessSession = class {
|
|
|
23534
23571
|
}
|
|
23535
23572
|
};
|
|
23536
23573
|
}
|
|
23574
|
+
if (command.type === "turn.steer")
|
|
23575
|
+
return this.#steer(command);
|
|
23537
23576
|
if (this.#acceptingTurn || this.#active || this.#configuring || this.#transport?.isBusy) {
|
|
23538
23577
|
return {
|
|
23539
23578
|
ok: false,
|
|
@@ -23593,6 +23632,9 @@ var PiHarnessSession = class {
|
|
|
23593
23632
|
agentMessageId: null,
|
|
23594
23633
|
compactionItem: null,
|
|
23595
23634
|
sawAssistantMessage: false,
|
|
23635
|
+
acceptedSteerCount: 0,
|
|
23636
|
+
acceptingSteers: true,
|
|
23637
|
+
pendingSteers: /* @__PURE__ */ new Set(),
|
|
23596
23638
|
reasoningItem: null,
|
|
23597
23639
|
tools: /* @__PURE__ */ new Map(),
|
|
23598
23640
|
interactions: /* @__PURE__ */ new Map(),
|
|
@@ -23854,6 +23896,47 @@ var PiHarnessSession = class {
|
|
|
23854
23896
|
this.#drainPendingAutonomousTurns(this.#transport);
|
|
23855
23897
|
}
|
|
23856
23898
|
}
|
|
23899
|
+
#canSteerActiveTurn() {
|
|
23900
|
+
const active = this.#active;
|
|
23901
|
+
return Boolean(this.#phase === "open" && active && !active.cancellationRequested && active.acceptingSteers && active.tools.size > 0 && this.#transport);
|
|
23902
|
+
}
|
|
23903
|
+
async #steer(command) {
|
|
23904
|
+
const text4 = command.input.map((input) => input.text).join("\n");
|
|
23905
|
+
if (text4.length === 0) {
|
|
23906
|
+
return {
|
|
23907
|
+
ok: false,
|
|
23908
|
+
error: {
|
|
23909
|
+
code: "invalidRequest",
|
|
23910
|
+
message: "Pi steer text must not be empty",
|
|
23911
|
+
retryable: false
|
|
23912
|
+
}
|
|
23913
|
+
};
|
|
23914
|
+
}
|
|
23915
|
+
const active = this.#active;
|
|
23916
|
+
const transport = this.#transport;
|
|
23917
|
+
if (!active || !transport || active.command.turnId !== command.turnId || !this.#canSteerActiveTurn()) {
|
|
23918
|
+
return { ok: false, error: invalidState("Pi Turn is not accepting native input") };
|
|
23919
|
+
}
|
|
23920
|
+
let accepted;
|
|
23921
|
+
try {
|
|
23922
|
+
accepted = transport.steer(text4).then(() => {
|
|
23923
|
+
active.acceptedSteerCount += 1;
|
|
23924
|
+
});
|
|
23925
|
+
active.pendingSteers.add(accepted);
|
|
23926
|
+
await accepted;
|
|
23927
|
+
return { ok: true, value: { accepted: true } };
|
|
23928
|
+
} catch (error51) {
|
|
23929
|
+
if (error51 instanceof PiRpcSteerRejectedError) {
|
|
23930
|
+
return { ok: false, error: invalidState(error51.message) };
|
|
23931
|
+
}
|
|
23932
|
+
if (error51 instanceof PiRpcSteerTargetEndedError)
|
|
23933
|
+
active.steerFailure = error51;
|
|
23934
|
+
throw error51;
|
|
23935
|
+
} finally {
|
|
23936
|
+
if (accepted)
|
|
23937
|
+
active.pendingSteers.delete(accepted);
|
|
23938
|
+
}
|
|
23939
|
+
}
|
|
23857
23940
|
async #cancel(command) {
|
|
23858
23941
|
const active = this.#active;
|
|
23859
23942
|
if (!active || active.command.turnId !== command.turnId) {
|
|
@@ -23977,6 +24060,9 @@ var PiHarnessSession = class {
|
|
|
23977
24060
|
agentMessageId: null,
|
|
23978
24061
|
compactionItem: null,
|
|
23979
24062
|
sawAssistantMessage: false,
|
|
24063
|
+
acceptedSteerCount: 0,
|
|
24064
|
+
acceptingSteers: false,
|
|
24065
|
+
pendingSteers: /* @__PURE__ */ new Set(),
|
|
23980
24066
|
reasoningItem: null,
|
|
23981
24067
|
tools: /* @__PURE__ */ new Map(),
|
|
23982
24068
|
interactions: /* @__PURE__ */ new Map(),
|
|
@@ -24243,6 +24329,9 @@ var PiHarnessSession = class {
|
|
|
24243
24329
|
agentMessageId: null,
|
|
24244
24330
|
compactionItem: null,
|
|
24245
24331
|
sawAssistantMessage: false,
|
|
24332
|
+
acceptedSteerCount: 0,
|
|
24333
|
+
acceptingSteers: false,
|
|
24334
|
+
pendingSteers: /* @__PURE__ */ new Set(),
|
|
24246
24335
|
reasoningItem: null,
|
|
24247
24336
|
tools: /* @__PURE__ */ new Map(),
|
|
24248
24337
|
interactions: /* @__PURE__ */ new Map(),
|
|
@@ -24685,13 +24774,16 @@ var PiHarnessSession = class {
|
|
|
24685
24774
|
}
|
|
24686
24775
|
}
|
|
24687
24776
|
async #completedTurnIdentity(active, transport) {
|
|
24688
|
-
|
|
24777
|
+
active.acceptingSteers = false;
|
|
24778
|
+
await Promise.allSettled([...active.pendingSteers]);
|
|
24779
|
+
const snapshot = mapPiSnapshot(active.steerFailure?.history ?? await transport.getEntries(), {
|
|
24689
24780
|
sessionId: transport.state.sessionId,
|
|
24690
24781
|
model: nativeModelForHistory(transport.state)
|
|
24691
24782
|
});
|
|
24692
24783
|
const created = snapshot.turns.filter((turn2) => turn2.input.length > 0 && !active.beforeNativeTurnKeys.has(turn2.nativeTurnRef.nativeTurnKey));
|
|
24693
|
-
|
|
24694
|
-
|
|
24784
|
+
const expected = 1 + active.acceptedSteerCount;
|
|
24785
|
+
if (created.length !== expected) {
|
|
24786
|
+
throw new Error(`Pi Turn persisted ${created.length} new User Entries; exactly ${expected} is required`);
|
|
24695
24787
|
}
|
|
24696
24788
|
const turn = created[0];
|
|
24697
24789
|
if (!turn)
|
|
@@ -24727,6 +24819,10 @@ var PiHarnessSession = class {
|
|
|
24727
24819
|
...nativeTurnRef ? { nativeTurnRef } : {}
|
|
24728
24820
|
});
|
|
24729
24821
|
active.resolveCompletion();
|
|
24822
|
+
if (active.steerFailure) {
|
|
24823
|
+
this.#fault(active.steerFailure);
|
|
24824
|
+
return;
|
|
24825
|
+
}
|
|
24730
24826
|
queueMicrotask(() => {
|
|
24731
24827
|
if (this.#phase !== "open")
|
|
24732
24828
|
return;
|
|
@@ -29492,6 +29492,7 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
|
29492
29492
|
message: "A history continuation requires its connection epoch"
|
|
29493
29493
|
}).optional()
|
|
29494
29494
|
}),
|
|
29495
|
+
external_exports.strictObject({ kind: external_exports.literal("usage"), ...thread, epoch: identity }),
|
|
29495
29496
|
external_exports.strictObject({
|
|
29496
29497
|
kind: external_exports.literal("configure"),
|
|
29497
29498
|
...thread,
|
|
@@ -29089,6 +29089,7 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
|
29089
29089
|
message: "A history continuation requires its connection epoch"
|
|
29090
29090
|
}).optional()
|
|
29091
29091
|
}),
|
|
29092
|
+
external_exports.strictObject({ kind: external_exports.literal("usage"), ...thread, epoch: identity }),
|
|
29092
29093
|
external_exports.strictObject({
|
|
29093
29094
|
kind: external_exports.literal("configure"),
|
|
29094
29095
|
...thread,
|
|
@@ -23392,6 +23392,7 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
|
23392
23392
|
message: "A history continuation requires its connection epoch"
|
|
23393
23393
|
}).optional()
|
|
23394
23394
|
}),
|
|
23395
|
+
external_exports.strictObject({ kind: external_exports.literal("usage"), ...thread, epoch: identity }),
|
|
23395
23396
|
external_exports.strictObject({
|
|
23396
23397
|
kind: external_exports.literal("configure"),
|
|
23397
23398
|
...thread,
|
|
@@ -16506,6 +16506,7 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
|
16506
16506
|
message: "A history continuation requires its connection epoch"
|
|
16507
16507
|
}).optional()
|
|
16508
16508
|
}),
|
|
16509
|
+
external_exports.strictObject({ kind: external_exports.literal("usage"), ...thread, epoch: identity }),
|
|
16509
16510
|
external_exports.strictObject({
|
|
16510
16511
|
kind: external_exports.literal("configure"),
|
|
16511
16512
|
...thread,
|
|
@@ -16692,6 +16692,7 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
|
16692
16692
|
message: "A history continuation requires its connection epoch"
|
|
16693
16693
|
}).optional()
|
|
16694
16694
|
}),
|
|
16695
|
+
external_exports.strictObject({ kind: external_exports.literal("usage"), ...thread, epoch: identity }),
|
|
16695
16696
|
external_exports.strictObject({
|
|
16696
16697
|
kind: external_exports.literal("configure"),
|
|
16697
16698
|
...thread,
|
|
@@ -17059,6 +17059,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17059
17059
|
message: "A history continuation requires its connection epoch"
|
|
17060
17060
|
}).optional()
|
|
17061
17061
|
}),
|
|
17062
|
+
external_exports.strictObject({ kind: external_exports.literal("usage"), ...thread, epoch: identity }),
|
|
17062
17063
|
external_exports.strictObject({
|
|
17063
17064
|
kind: external_exports.literal("configure"),
|
|
17064
17065
|
...thread,
|