@liberseek/boft-cli-linux-x64 0.8.7 → 0.8.9
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 +59 -6
- package/app/console-web.js +1376 -1053
- package/app/desktop-controller.mjs +239 -57
- package/app/host-runtime.mjs +32921 -24901
- package/app/plugins/antigravity/assets/icon.svg +1 -1
- package/app/plugins/antigravity/plugin.mjs +9491 -4266
- package/app/plugins/claude-code/plugin.mjs +580 -116
- package/app/plugins/codebuddy/plugin.mjs +85 -8
- package/app/plugins/codex-usage/plugin.mjs +70 -6
- package/app/plugins/copilot/plugin.mjs +62 -6
- package/app/plugins/cursor-cli/plugin.mjs +62 -6
- package/app/plugins/deepseek-harness/plugin.mjs +87 -11
- package/app/plugins/devin/plugin.mjs +61 -6
- package/app/plugins/grok/plugin.mjs +320 -223
- package/app/plugins/hermes/plugin.mjs +61 -6
- package/app/plugins/kimi-code/plugin.mjs +87 -16
- package/app/plugins/kiro-cli/plugin.mjs +62 -6
- package/app/plugins/muse/plugin.mjs +61 -6
- package/app/plugins/omp/plugin.mjs +195 -31
- package/app/plugins/opencode/plugin.mjs +88 -15
- package/app/plugins/pi/plugin.mjs +207 -32
- package/app/plugins/qoder/plugin.mjs +99 -7
- package/app/plugins/qoder-cn/plugin.mjs +99 -7
- package/app/plugins/qwen-code/plugin.mjs +62 -6
- package/app/plugins/workbuddy/plugin.mjs +89 -11
- package/app/plugins/zcode/plugin.mjs +70 -6
- package/app/renderer-extension.js +1767 -1187
- package/app/web/assets/index-C2OA-eHT.js +201 -0
- package/app/web/assets/index-DJW4bmyx.css +1 -0
- package/app/web/assets/langs/{graphql-B8vkg11W.js → graphql-ChAeyPkT.js} +1 -1
- package/app/web/assets/langs/{http-DmoDEjMt.js → http-BvreBIbD.js} +1 -1
- package/app/web/assets/langs/{php-DJ5ovfAM.js → php-D8omCIuJ.js} +1 -1
- package/app/web/assets/langs/{rst-U5-R5x3p.js → rst-Do7RLLCS.js} +1 -1
- package/app/web/assets/langs/{ruby-VKVsnS0H.js → ruby-rH_O_vse.js} +1 -1
- package/app/web/assets/langs/{svelte-C20lOv9V.js → svelte-xZy73wAj.js} +1 -1
- package/app/web/assets/langs/{vue-z6Y-lzP-.js → vue-C4DW8agZ.js} +1 -1
- package/app/web/assets/{vendor-dSL872WO.js → vendor-C9g2bw8s.js} +3 -3
- package/app/web/codexhost-settings.js +1383 -1056
- package/app/web/index.html +4 -3
- package/app/web/plugins/deepseek-ai__dsh-api-gateway/client.js +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 +11 -11
- package/app/web/plugins/deepseek-ai__dsh-client-connection/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-locale/client.js +3 -3
- package/app/web/plugins/deepseek-ai__dsh-client-ui-attachment/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +74 -69
- package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +3 -3
- package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +28 -28
- 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 +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-model-selection/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-session/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-settings-general/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-sidebar-documentpreview/client.js +9 -9
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-files/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 +2458 -1615
- package/bin/boft +0 -0
- package/libexec/boft-shim +0 -0
- package/libexec/boft-updater +0 -0
- package/package.json +1 -1
- package/app/web/assets/index-CP6wY-1D.css +0 -1
- package/app/web/assets/index-Da35Phrd.js +0 -199
|
@@ -15059,13 +15059,25 @@ var threadPermissionModeSelectParamsSchema = external_exports.object({
|
|
|
15059
15059
|
var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
|
|
15060
15060
|
var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
|
|
15061
15061
|
var cacheHitRatePercentSchema = external_exports.number().finite().min(0).max(100);
|
|
15062
|
+
var usageOutputTimingSchema = external_exports.object({
|
|
15063
|
+
version: external_exports.union([external_exports.literal(3), external_exports.literal(4)]).optional(),
|
|
15064
|
+
requestId: external_exports.string().min(1),
|
|
15065
|
+
turnId: external_exports.string().min(1).max(1024),
|
|
15066
|
+
outputTokens: nonNegativeSafeIntegerSchema,
|
|
15067
|
+
startedAtMs: nonNegativeSafeIntegerSchema,
|
|
15068
|
+
completedAtMs: nonNegativeSafeIntegerSchema
|
|
15069
|
+
}).strict().refine((value) => value.completedAtMs > value.startedAtMs);
|
|
15062
15070
|
var usageMeasurementSchema = external_exports.object({
|
|
15071
|
+
version: external_exports.union([external_exports.literal(2), external_exports.literal(3), external_exports.literal(4)]).optional(),
|
|
15063
15072
|
value: finiteNonNegativeNumberSchema,
|
|
15064
15073
|
turnId: external_exports.string().min(1).max(1024),
|
|
15065
15074
|
at: nonNegativeSafeIntegerSchema
|
|
15066
15075
|
}).strict();
|
|
15067
15076
|
var usageMeasurementsSchema = external_exports.object({
|
|
15068
|
-
|
|
15077
|
+
// Older intervals can omit hidden thinking time; do not restore them into averages.
|
|
15078
|
+
outputTimings: external_exports.array(usageOutputTimingSchema).transform((values) => values.filter((value) => value.version === 4)).optional(),
|
|
15079
|
+
// Retain independent TTFT facts when dropping incompatible speed measurements.
|
|
15080
|
+
outputTokensPerSecond: usageMeasurementSchema.refine((value) => value.version === 4).optional().catch(void 0),
|
|
15069
15081
|
timeToFirstOutputMs: usageMeasurementSchema.extend({ value: nonNegativeSafeIntegerSchema }).optional()
|
|
15070
15082
|
}).strict();
|
|
15071
15083
|
var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text4) => text4.length <= maximum));
|
|
@@ -15085,6 +15097,7 @@ var threadUsageSnapshotSchema = external_exports.object({
|
|
|
15085
15097
|
cacheWriteInputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
15086
15098
|
outputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
15087
15099
|
outputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
|
|
15100
|
+
sessionOutputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
|
|
15088
15101
|
apiOutputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
|
|
15089
15102
|
reasoningOutputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
15090
15103
|
totalTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
@@ -15516,11 +15529,19 @@ var threadSteeringInspectResultSchema = external_exports.object({
|
|
|
15516
15529
|
delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
|
|
15517
15530
|
}).strict();
|
|
15518
15531
|
|
|
15532
|
+
// ../../shared-contracts/dist/thread-archive-confirm.js
|
|
15533
|
+
var threadArchiveConfirmParamsSchema = external_exports.object({ threadId: hostThreadIdSchema }).strict();
|
|
15534
|
+
var threadArchiveConfirmResultSchema = external_exports.object({ confirmed: external_exports.boolean() }).strict();
|
|
15535
|
+
|
|
15519
15536
|
// ../../shared-contracts/dist/client-channel.js
|
|
15520
15537
|
var CLIENT_CHANNEL_VERSION = 1;
|
|
15521
15538
|
var CLIENT_REQUEST_LIMIT_BYTES = 128 * 1024 * 1024;
|
|
15522
15539
|
var clientThreadPinsSchema = external_exports.object({ threadIds: external_exports.array(external_exports.string().min(1)) }).strict();
|
|
15523
15540
|
var clientThreadPinParamsSchema = external_exports.object({ threadId: external_exports.string().min(1).max(1024), pinned: external_exports.boolean() }).strict();
|
|
15541
|
+
var clientThreadTreeReadParamsSchema = external_exports.object({}).strict();
|
|
15542
|
+
var clientThreadTreeSchema = external_exports.object({
|
|
15543
|
+
parents: external_exports.record(external_exports.string().min(1), external_exports.string().min(1))
|
|
15544
|
+
}).strict();
|
|
15524
15545
|
var clientProjectlessWorkspaceSchema = external_exports.object({
|
|
15525
15546
|
prompt: external_exports.string().max(16384).optional()
|
|
15526
15547
|
}).strict();
|
|
@@ -15542,6 +15563,11 @@ var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
|
|
|
15542
15563
|
cursor: clientChannelCursorSchema,
|
|
15543
15564
|
cwd: external_exports.string().optional()
|
|
15544
15565
|
}),
|
|
15566
|
+
external_exports.object({
|
|
15567
|
+
type: external_exports.literal("harness-inspection-changed"),
|
|
15568
|
+
cursor: clientChannelCursorSchema,
|
|
15569
|
+
harnessId: external_exports.string().min(1)
|
|
15570
|
+
}),
|
|
15545
15571
|
external_exports.object({ type: external_exports.literal("display-settings-changed"), cursor: clientChannelCursorSchema }),
|
|
15546
15572
|
external_exports.object({
|
|
15547
15573
|
type: external_exports.literal("preferences-changed"),
|
|
@@ -15613,6 +15639,8 @@ var clientItemTruncationSchema = external_exports.object({
|
|
|
15613
15639
|
var clientTurnSchema = external_exports.object({
|
|
15614
15640
|
id: external_exports.string().min(1),
|
|
15615
15641
|
status: external_exports.string().min(1),
|
|
15642
|
+
/** Native history has no terminal evidence; Desktop's status vocabulary cannot express this. */
|
|
15643
|
+
codexhostTurnOutcome: external_exports.object({ status: external_exports.literal("unknown"), reason: external_exports.string() }).optional(),
|
|
15616
15644
|
items: external_exports.array(external_exports.object({ id: external_exports.string().min(1), type: external_exports.string().min(1) }).passthrough()),
|
|
15617
15645
|
/** Original file operations, independent of the cumulative Desktop fileChange card.
|
|
15618
15646
|
* Insert before the named non-file Item; null appends at the end of the Turn.
|
|
@@ -15651,7 +15679,12 @@ var clientThreadSnapshotSchema = external_exports.object({
|
|
|
15651
15679
|
/** Current interruptible Host Turn, including command Turns omitted from client history. */
|
|
15652
15680
|
activeTurnId: external_exports.string().min(1).nullable().optional(),
|
|
15653
15681
|
/** Most recent explicit command in this Host process; not native conversation history. */
|
|
15654
|
-
command: external_exports.object({
|
|
15682
|
+
command: external_exports.object({
|
|
15683
|
+
name: external_exports.string().min(1),
|
|
15684
|
+
turn: clientTurnSchema,
|
|
15685
|
+
/** First ordinary Turn started after this command; its retained result is not a new event. */
|
|
15686
|
+
subsequentTurnId: external_exports.string().min(1).optional()
|
|
15687
|
+
}).optional(),
|
|
15655
15688
|
thread: external_exports.object({
|
|
15656
15689
|
id: external_exports.string().min(1),
|
|
15657
15690
|
cwd: external_exports.string(),
|
|
@@ -15859,15 +15892,14 @@ var webAccessStateSchema = external_exports.object({
|
|
|
15859
15892
|
quotaUntil: external_exports.string().optional()
|
|
15860
15893
|
}).strict().optional()
|
|
15861
15894
|
}).strict();
|
|
15862
|
-
var webLocalAccessRequiredDetailsSchema = external_exports.object({ url: external_exports.string() }).strict();
|
|
15863
15895
|
|
|
15864
15896
|
// ../../shared-contracts/dist/delegation-read.js
|
|
15865
15897
|
var REMOTE_THREAD_REPLY_MAX_BYTES = 16 * 1024 * 1024;
|
|
15866
15898
|
var delegationReadParamsSchema = external_exports.strictObject({
|
|
15867
15899
|
threadId: external_exports.string().min(1).max(1024),
|
|
15868
15900
|
view: external_exports.enum(["result", "messages"]),
|
|
15869
|
-
|
|
15870
|
-
|
|
15901
|
+
from: external_exports.number().int().min(1).max(Number.MAX_SAFE_INTEGER).optional(),
|
|
15902
|
+
to: external_exports.number().int().min(1).max(Number.MAX_SAFE_INTEGER).optional()
|
|
15871
15903
|
});
|
|
15872
15904
|
|
|
15873
15905
|
// ../../shared-contracts/dist/credential-imports.js
|
|
@@ -16852,6 +16884,7 @@ var THREAD_WATCH_NOTICE_OUTCOMES = [
|
|
|
16852
16884
|
"completed",
|
|
16853
16885
|
"failed",
|
|
16854
16886
|
"interrupted",
|
|
16887
|
+
"needsInput",
|
|
16855
16888
|
"timedOut",
|
|
16856
16889
|
"unreadable",
|
|
16857
16890
|
"notFound"
|
|
@@ -16898,13 +16931,26 @@ var target = { hostId: identity.regex(/^remote-(?:ssh(?:-|:)|control:)/u) };
|
|
|
16898
16931
|
var thread = { ...target, threadId: identity };
|
|
16899
16932
|
var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
16900
16933
|
external_exports.strictObject({ kind: external_exports.literal("hosts") }),
|
|
16934
|
+
external_exports.strictObject({ kind: external_exports.literal("status"), ...thread }),
|
|
16901
16935
|
external_exports.strictObject({
|
|
16902
16936
|
kind: external_exports.literal("list"),
|
|
16903
16937
|
...target,
|
|
16904
16938
|
cursor: external_exports.string().nullable(),
|
|
16905
16939
|
archived: external_exports.boolean()
|
|
16906
16940
|
}),
|
|
16907
|
-
external_exports.strictObject({
|
|
16941
|
+
external_exports.strictObject({
|
|
16942
|
+
kind: external_exports.literal("read"),
|
|
16943
|
+
...thread,
|
|
16944
|
+
page: external_exports.strictObject({
|
|
16945
|
+
cursor: external_exports.string().min(1).max(8192).nullable(),
|
|
16946
|
+
epoch: identity.optional(),
|
|
16947
|
+
sortDirection: external_exports.enum(["asc", "desc"]).optional(),
|
|
16948
|
+
limit: external_exports.number().int().min(1).max(20).optional()
|
|
16949
|
+
}).refine((page) => page.cursor === null || page.epoch !== void 0, {
|
|
16950
|
+
message: "A history continuation requires its connection epoch"
|
|
16951
|
+
}).optional()
|
|
16952
|
+
}),
|
|
16953
|
+
external_exports.strictObject({ kind: external_exports.literal("usage"), ...thread, epoch: identity }),
|
|
16908
16954
|
external_exports.strictObject({
|
|
16909
16955
|
kind: external_exports.literal("configure"),
|
|
16910
16956
|
...thread,
|
|
@@ -16985,6 +17031,13 @@ var remoteConnectionsReplySchema = external_exports.union([
|
|
|
16985
17031
|
external_exports.strictObject({ error: external_exports.strictObject({ code: external_exports.number().int(), message: external_exports.string() }) })
|
|
16986
17032
|
]);
|
|
16987
17033
|
|
|
17034
|
+
// ../../shared-contracts/dist/thread-title.js
|
|
17035
|
+
var threadTitleInputSchema = external_exports.strictObject({
|
|
17036
|
+
prompt: external_exports.string().trim().min(1).max(2e3),
|
|
17037
|
+
cwd: external_exports.string().max(4096).nullable()
|
|
17038
|
+
});
|
|
17039
|
+
var threadTitleResultSchema = external_exports.string().trim().min(1).max(60).nullable();
|
|
17040
|
+
|
|
16988
17041
|
// ../../shared-contracts/dist/web-ui-extensions.js
|
|
16989
17042
|
var webUiExtensionIdSchema = external_exports.string().max(214).regex(/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/u);
|
|
16990
17043
|
var localizedTextSchema2 = external_exports.union([
|
|
@@ -17122,18 +17175,6 @@ function sanitizeDiagnosticTail(value) {
|
|
|
17122
17175
|
return redacted.length <= DIAGNOSTIC_TAIL_MAX_LENGTH ? redacted : redacted.slice(-DIAGNOSTIC_TAIL_MAX_LENGTH);
|
|
17123
17176
|
}
|
|
17124
17177
|
|
|
17125
|
-
// ../../harness-adapter/dist/steer.js
|
|
17126
|
-
function unsupportedSteer(harnessLabel) {
|
|
17127
|
-
return {
|
|
17128
|
-
ok: false,
|
|
17129
|
-
error: {
|
|
17130
|
-
code: "unsupported",
|
|
17131
|
-
message: `${harnessLabel} cannot steer an active Turn natively`,
|
|
17132
|
-
retryable: false
|
|
17133
|
-
}
|
|
17134
|
-
};
|
|
17135
|
-
}
|
|
17136
|
-
|
|
17137
17178
|
// ../../harness-adapter/dist/usage.js
|
|
17138
17179
|
var tokenFields = [
|
|
17139
17180
|
"inputTokens",
|
|
@@ -17166,6 +17207,7 @@ var usageFields = /* @__PURE__ */ new Set([
|
|
|
17166
17207
|
"totalCredits",
|
|
17167
17208
|
"contextUsagePercent",
|
|
17168
17209
|
"outputTokensPerSecond",
|
|
17210
|
+
"sessionOutputTokensPerSecond",
|
|
17169
17211
|
"apiOutputTokensPerSecond",
|
|
17170
17212
|
"costSource",
|
|
17171
17213
|
"unpricedModels"
|
|
@@ -17188,6 +17230,7 @@ function parseHostUsage(value) {
|
|
|
17188
17230
|
for (const field2 of [
|
|
17189
17231
|
"totalCredits",
|
|
17190
17232
|
"contextUsagePercent",
|
|
17233
|
+
"sessionOutputTokensPerSecond",
|
|
17191
17234
|
"apiOutputTokensPerSecond"
|
|
17192
17235
|
]) {
|
|
17193
17236
|
const candidate = value[field2];
|
|
@@ -17272,6 +17315,7 @@ var requestTokenFields = [
|
|
|
17272
17315
|
"cacheWrite1hInputTokens",
|
|
17273
17316
|
"outputTokens",
|
|
17274
17317
|
"reasoningOutputTokens",
|
|
17318
|
+
"timedOutputTokens",
|
|
17275
17319
|
"startedAtMs",
|
|
17276
17320
|
"completedAtMs"
|
|
17277
17321
|
];
|
|
@@ -17324,6 +17368,14 @@ function parseHostUsageRequest(value) {
|
|
|
17324
17368
|
if (request.startedAtMs === void 0 !== (request.completedAtMs === void 0)) {
|
|
17325
17369
|
throw new Error("Harness Usage request timing fields must be provided together");
|
|
17326
17370
|
}
|
|
17371
|
+
if (request.timedOutputTokens !== void 0) {
|
|
17372
|
+
if (request.startedAtMs === void 0) {
|
|
17373
|
+
throw new Error("Harness Usage request 'timedOutputTokens' requires timing fields");
|
|
17374
|
+
}
|
|
17375
|
+
if (request.timedOutputTokens > request.outputTokens) {
|
|
17376
|
+
throw new Error("Harness Usage request 'timedOutputTokens' must not exceed 'outputTokens'");
|
|
17377
|
+
}
|
|
17378
|
+
}
|
|
17327
17379
|
if (request.startedAtMs !== void 0 && request.completedAtMs !== void 0 && request.completedAtMs < request.startedAtMs) {
|
|
17328
17380
|
throw new Error("Harness Usage request 'completedAtMs' must not precede 'startedAtMs'");
|
|
17329
17381
|
}
|
|
@@ -21663,6 +21715,15 @@ var PiRpcFaultError = class extends Error {
|
|
|
21663
21715
|
this.name = "PiRpcFaultError";
|
|
21664
21716
|
}
|
|
21665
21717
|
};
|
|
21718
|
+
var PiRpcSteerRejectedError = class extends Error {
|
|
21719
|
+
};
|
|
21720
|
+
var PiRpcSteerTargetEndedError = class extends PiRpcFaultError {
|
|
21721
|
+
history;
|
|
21722
|
+
constructor(history) {
|
|
21723
|
+
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");
|
|
21724
|
+
this.history = history;
|
|
21725
|
+
}
|
|
21726
|
+
};
|
|
21666
21727
|
var PiRpcUnsupportedCommandError = class extends Error {
|
|
21667
21728
|
command;
|
|
21668
21729
|
constructor(command) {
|
|
@@ -21921,6 +21982,7 @@ var PiRpcSession = class {
|
|
|
21921
21982
|
#autonomousLifecycleHandler = null;
|
|
21922
21983
|
#usageHandler = null;
|
|
21923
21984
|
#usageRequestStartedAtMs = null;
|
|
21985
|
+
#usageRequestTimingUnavailable = false;
|
|
21924
21986
|
// Pieces of the unterminated frame; joined once at its newline so a large frame (a long
|
|
21925
21987
|
// Session's get_entries) costs linear rather than quadratic copying on the Host event loop.
|
|
21926
21988
|
#buffer = [];
|
|
@@ -21996,14 +22058,29 @@ var PiRpcSession = class {
|
|
|
21996
22058
|
/** Every finished assistant message is one model request, with or without an active Turn. */
|
|
21997
22059
|
#observeUsage(value) {
|
|
21998
22060
|
if (value.type === "message_start") {
|
|
21999
|
-
if (isRecord9(value.message) && value.message.role === "assistant")
|
|
22061
|
+
if (isRecord9(value.message) && value.message.role === "assistant") {
|
|
22000
22062
|
this.#usageRequestStartedAtMs = null;
|
|
22063
|
+
this.#usageRequestTimingUnavailable = false;
|
|
22064
|
+
}
|
|
22001
22065
|
return;
|
|
22002
22066
|
}
|
|
22003
22067
|
if (value.type === "message_update") {
|
|
22004
22068
|
const event = value.assistantMessageEvent;
|
|
22005
|
-
if (this.#usageRequestStartedAtMs === null && isRecord9(event) && typeof event.type === "string"
|
|
22006
|
-
|
|
22069
|
+
if (this.#usageRequestStartedAtMs === null && !this.#usageRequestTimingUnavailable && isRecord9(event) && typeof event.type === "string") {
|
|
22070
|
+
if (
|
|
22071
|
+
// Native thinking starts can precede visible text by seconds; output usage includes it.
|
|
22072
|
+
/^(thinking|reasoning|thought)_start$/u.test(event.type) || /^(text|thinking|reasoning|thought)_delta$/u.test(event.type) && typeof event.delta === "string" && event.delta.length > 0
|
|
22073
|
+
)
|
|
22074
|
+
this.#usageRequestStartedAtMs = Date.now();
|
|
22075
|
+
else if (event.type === "toolcall_delta" && typeof event.delta === "string" && event.delta.length > 0) {
|
|
22076
|
+
try {
|
|
22077
|
+
JSON.parse(event.delta);
|
|
22078
|
+
this.#usageRequestTimingUnavailable = true;
|
|
22079
|
+
} catch {
|
|
22080
|
+
this.#usageRequestStartedAtMs = Date.now();
|
|
22081
|
+
}
|
|
22082
|
+
} else if (event.type === "toolcall_end")
|
|
22083
|
+
this.#usageRequestTimingUnavailable = true;
|
|
22007
22084
|
}
|
|
22008
22085
|
return;
|
|
22009
22086
|
}
|
|
@@ -22243,6 +22320,38 @@ var PiRpcSession = class {
|
|
|
22243
22320
|
throw fault;
|
|
22244
22321
|
}
|
|
22245
22322
|
}
|
|
22323
|
+
async steer(message3) {
|
|
22324
|
+
if (!this.#child || !this.#state || this.#closed || this.#failed) {
|
|
22325
|
+
throw new Error("Pi RPC Session is unavailable");
|
|
22326
|
+
}
|
|
22327
|
+
if (message3.length === 0)
|
|
22328
|
+
throw new Error("Pi steer text must not be empty");
|
|
22329
|
+
const target2 = this.#activeTurn;
|
|
22330
|
+
if (!target2 || target2.origin !== "requested" || target2.settlement !== "pending") {
|
|
22331
|
+
throw new PiRpcSteerRejectedError("Pi Turn is not accepting native input");
|
|
22332
|
+
}
|
|
22333
|
+
let admitted = false;
|
|
22334
|
+
const response = await this.#send("steer", { message: message3 }, () => {
|
|
22335
|
+
admitted = this.#activeTurn === target2 && target2.settlement === "pending";
|
|
22336
|
+
});
|
|
22337
|
+
if (isRecord9(response.data) && response.data.disposition !== void 0 && response.data.disposition !== "queued") {
|
|
22338
|
+
throw new Error("Pi steer was handled without confirming same-Turn queue admission");
|
|
22339
|
+
}
|
|
22340
|
+
if (!admitted) {
|
|
22341
|
+
let history;
|
|
22342
|
+
try {
|
|
22343
|
+
history = await this.getEntries();
|
|
22344
|
+
} finally {
|
|
22345
|
+
try {
|
|
22346
|
+
await this.close();
|
|
22347
|
+
} catch (error51) {
|
|
22348
|
+
if (history !== void 0)
|
|
22349
|
+
throw error51;
|
|
22350
|
+
}
|
|
22351
|
+
}
|
|
22352
|
+
throw new PiRpcSteerTargetEndedError(history);
|
|
22353
|
+
}
|
|
22354
|
+
}
|
|
22246
22355
|
async runTurn(text4, onEvent) {
|
|
22247
22356
|
if (!this.#child || !this.#state || this.#closed || this.#failed) {
|
|
22248
22357
|
throw new Error("Pi RPC Session is unavailable");
|
|
@@ -22816,7 +22925,9 @@ var PiRpcSession = class {
|
|
|
22816
22925
|
pending.resolve(value);
|
|
22817
22926
|
else {
|
|
22818
22927
|
const error51 = typeof value.error === "string" ? value.error : "Pi RPC command failed";
|
|
22819
|
-
if (
|
|
22928
|
+
if (pending.command === "steer" && value.command === "steer" && value.success === false) {
|
|
22929
|
+
pending.reject(new PiRpcSteerRejectedError(error51));
|
|
22930
|
+
} else if (value.command === pending.command && error51 === `Unknown command: ${pending.command}`) {
|
|
22820
22931
|
pending.reject(new PiRpcUnsupportedCommandError(pending.command));
|
|
22821
22932
|
} else {
|
|
22822
22933
|
pending.reject(new Error(error51));
|
|
@@ -23100,7 +23211,7 @@ var PiRpcSession = class {
|
|
|
23100
23211
|
child.stdin.write(frame, (error51) => error51 ? reject(error51) : resolve());
|
|
23101
23212
|
});
|
|
23102
23213
|
}
|
|
23103
|
-
#send(type, payload) {
|
|
23214
|
+
#send(type, payload, onResponse) {
|
|
23104
23215
|
const child = this.#child;
|
|
23105
23216
|
if (!child?.stdin.writable || this.#closed || this.#failed) {
|
|
23106
23217
|
return Promise.reject(new Error("Pi RPC stdin is unavailable"));
|
|
@@ -23109,7 +23220,10 @@ var PiRpcSession = class {
|
|
|
23109
23220
|
return new Promise((resolve, reject) => {
|
|
23110
23221
|
const pending = {
|
|
23111
23222
|
command: type,
|
|
23112
|
-
resolve
|
|
23223
|
+
resolve: (response) => {
|
|
23224
|
+
onResponse?.();
|
|
23225
|
+
resolve(response);
|
|
23226
|
+
},
|
|
23113
23227
|
reject,
|
|
23114
23228
|
timeout: null
|
|
23115
23229
|
};
|
|
@@ -23403,7 +23517,7 @@ var PiHarnessSession = class {
|
|
|
23403
23517
|
this.#requestedThinkingOptionId = options.thinkingOptionId;
|
|
23404
23518
|
this.#toolOutputLimit = options.toolOutputLimit;
|
|
23405
23519
|
this.#isFastSupported = options.isFastSupported;
|
|
23406
|
-
this.capabilities = {
|
|
23520
|
+
this.capabilities = ((session) => ({
|
|
23407
23521
|
configuration: {
|
|
23408
23522
|
selectModel: true,
|
|
23409
23523
|
selectThinkingOption: options.supportsThinkingSelection,
|
|
@@ -23412,8 +23526,12 @@ var PiHarnessSession = class {
|
|
|
23412
23526
|
},
|
|
23413
23527
|
history: { fork: true, forkAcrossCwd: true, rollbackLastTurn: true },
|
|
23414
23528
|
autonomousTurns: { observe: true },
|
|
23415
|
-
subagents: { observe: true, readTranscript: true }
|
|
23416
|
-
|
|
23529
|
+
subagents: { observe: true, readTranscript: true },
|
|
23530
|
+
// Root Tools provide an admission window; the transport also checks native receipt order.
|
|
23531
|
+
get steer() {
|
|
23532
|
+
return session.#canSteerActiveTurn();
|
|
23533
|
+
}
|
|
23534
|
+
}))(this);
|
|
23417
23535
|
this.commands = {
|
|
23418
23536
|
list: async () => ({ ok: true, value: await this.#refreshLiveCommands() }),
|
|
23419
23537
|
execute: (command) => this.#executeHarnessCommand(command)
|
|
@@ -23511,8 +23629,6 @@ var PiHarnessSession = class {
|
|
|
23511
23629
|
if (this.#phase !== "open") {
|
|
23512
23630
|
return { ok: false, error: invalidState("Pi Session is not open") };
|
|
23513
23631
|
}
|
|
23514
|
-
if (command.type === "turn.steer")
|
|
23515
|
-
return unsupportedSteer("Pi");
|
|
23516
23632
|
if (command.type === "turn.cancel")
|
|
23517
23633
|
return this.#cancel(command);
|
|
23518
23634
|
if (command.type === "interaction.respond")
|
|
@@ -23531,6 +23647,8 @@ var PiHarnessSession = class {
|
|
|
23531
23647
|
}
|
|
23532
23648
|
};
|
|
23533
23649
|
}
|
|
23650
|
+
if (command.type === "turn.steer")
|
|
23651
|
+
return this.#steer(command);
|
|
23534
23652
|
if (this.#acceptingTurn || this.#active || this.#configuring || this.#transport?.isBusy) {
|
|
23535
23653
|
return {
|
|
23536
23654
|
ok: false,
|
|
@@ -23590,6 +23708,9 @@ var PiHarnessSession = class {
|
|
|
23590
23708
|
agentMessageId: null,
|
|
23591
23709
|
compactionItem: null,
|
|
23592
23710
|
sawAssistantMessage: false,
|
|
23711
|
+
acceptedSteerCount: 0,
|
|
23712
|
+
acceptingSteers: true,
|
|
23713
|
+
pendingSteers: /* @__PURE__ */ new Set(),
|
|
23593
23714
|
reasoningItem: null,
|
|
23594
23715
|
tools: /* @__PURE__ */ new Map(),
|
|
23595
23716
|
interactions: /* @__PURE__ */ new Map(),
|
|
@@ -23851,6 +23972,47 @@ var PiHarnessSession = class {
|
|
|
23851
23972
|
this.#drainPendingAutonomousTurns(this.#transport);
|
|
23852
23973
|
}
|
|
23853
23974
|
}
|
|
23975
|
+
#canSteerActiveTurn() {
|
|
23976
|
+
const active = this.#active;
|
|
23977
|
+
return Boolean(this.#phase === "open" && active && !active.cancellationRequested && active.acceptingSteers && active.tools.size > 0 && this.#transport);
|
|
23978
|
+
}
|
|
23979
|
+
async #steer(command) {
|
|
23980
|
+
const text4 = command.input.map((input) => input.text).join("\n");
|
|
23981
|
+
if (text4.length === 0) {
|
|
23982
|
+
return {
|
|
23983
|
+
ok: false,
|
|
23984
|
+
error: {
|
|
23985
|
+
code: "invalidRequest",
|
|
23986
|
+
message: "Pi steer text must not be empty",
|
|
23987
|
+
retryable: false
|
|
23988
|
+
}
|
|
23989
|
+
};
|
|
23990
|
+
}
|
|
23991
|
+
const active = this.#active;
|
|
23992
|
+
const transport = this.#transport;
|
|
23993
|
+
if (!active || !transport || active.command.turnId !== command.turnId || !this.#canSteerActiveTurn()) {
|
|
23994
|
+
return { ok: false, error: invalidState("Pi Turn is not accepting native input") };
|
|
23995
|
+
}
|
|
23996
|
+
let accepted;
|
|
23997
|
+
try {
|
|
23998
|
+
accepted = transport.steer(text4).then(() => {
|
|
23999
|
+
active.acceptedSteerCount += 1;
|
|
24000
|
+
});
|
|
24001
|
+
active.pendingSteers.add(accepted);
|
|
24002
|
+
await accepted;
|
|
24003
|
+
return { ok: true, value: { accepted: true } };
|
|
24004
|
+
} catch (error51) {
|
|
24005
|
+
if (error51 instanceof PiRpcSteerRejectedError) {
|
|
24006
|
+
return { ok: false, error: invalidState(error51.message) };
|
|
24007
|
+
}
|
|
24008
|
+
if (error51 instanceof PiRpcSteerTargetEndedError)
|
|
24009
|
+
active.steerFailure = error51;
|
|
24010
|
+
throw error51;
|
|
24011
|
+
} finally {
|
|
24012
|
+
if (accepted)
|
|
24013
|
+
active.pendingSteers.delete(accepted);
|
|
24014
|
+
}
|
|
24015
|
+
}
|
|
23854
24016
|
async #cancel(command) {
|
|
23855
24017
|
const active = this.#active;
|
|
23856
24018
|
if (!active || active.command.turnId !== command.turnId) {
|
|
@@ -23974,6 +24136,9 @@ var PiHarnessSession = class {
|
|
|
23974
24136
|
agentMessageId: null,
|
|
23975
24137
|
compactionItem: null,
|
|
23976
24138
|
sawAssistantMessage: false,
|
|
24139
|
+
acceptedSteerCount: 0,
|
|
24140
|
+
acceptingSteers: false,
|
|
24141
|
+
pendingSteers: /* @__PURE__ */ new Set(),
|
|
23977
24142
|
reasoningItem: null,
|
|
23978
24143
|
tools: /* @__PURE__ */ new Map(),
|
|
23979
24144
|
interactions: /* @__PURE__ */ new Map(),
|
|
@@ -24240,6 +24405,9 @@ var PiHarnessSession = class {
|
|
|
24240
24405
|
agentMessageId: null,
|
|
24241
24406
|
compactionItem: null,
|
|
24242
24407
|
sawAssistantMessage: false,
|
|
24408
|
+
acceptedSteerCount: 0,
|
|
24409
|
+
acceptingSteers: false,
|
|
24410
|
+
pendingSteers: /* @__PURE__ */ new Set(),
|
|
24243
24411
|
reasoningItem: null,
|
|
24244
24412
|
tools: /* @__PURE__ */ new Map(),
|
|
24245
24413
|
interactions: /* @__PURE__ */ new Map(),
|
|
@@ -24682,13 +24850,16 @@ var PiHarnessSession = class {
|
|
|
24682
24850
|
}
|
|
24683
24851
|
}
|
|
24684
24852
|
async #completedTurnIdentity(active, transport) {
|
|
24685
|
-
|
|
24853
|
+
active.acceptingSteers = false;
|
|
24854
|
+
await Promise.allSettled([...active.pendingSteers]);
|
|
24855
|
+
const snapshot = mapPiSnapshot(active.steerFailure?.history ?? await transport.getEntries(), {
|
|
24686
24856
|
sessionId: transport.state.sessionId,
|
|
24687
24857
|
model: nativeModelForHistory(transport.state)
|
|
24688
24858
|
});
|
|
24689
24859
|
const created = snapshot.turns.filter((turn2) => turn2.input.length > 0 && !active.beforeNativeTurnKeys.has(turn2.nativeTurnRef.nativeTurnKey));
|
|
24690
|
-
|
|
24691
|
-
|
|
24860
|
+
const expected = 1 + active.acceptedSteerCount;
|
|
24861
|
+
if (created.length !== expected) {
|
|
24862
|
+
throw new Error(`Pi Turn persisted ${created.length} new User Entries; exactly ${expected} is required`);
|
|
24692
24863
|
}
|
|
24693
24864
|
const turn = created[0];
|
|
24694
24865
|
if (!turn)
|
|
@@ -24724,6 +24895,10 @@ var PiHarnessSession = class {
|
|
|
24724
24895
|
...nativeTurnRef ? { nativeTurnRef } : {}
|
|
24725
24896
|
});
|
|
24726
24897
|
active.resolveCompletion();
|
|
24898
|
+
if (active.steerFailure) {
|
|
24899
|
+
this.#fault(active.steerFailure);
|
|
24900
|
+
return;
|
|
24901
|
+
}
|
|
24727
24902
|
queueMicrotask(() => {
|
|
24728
24903
|
if (this.#phase !== "open")
|
|
24729
24904
|
return;
|