@karlorz/codexhost-cli-win32-x64 0.18.0-0 → 0.19.0-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 +317 -59
- package/app/console-web.js +1889 -141
- package/app/cpa-live-voice-hook.js +1938 -428
- package/app/desktop-controller.mjs +2081 -212
- package/app/host-runtime.mjs +14818 -3381
- package/app/overlay-voice-bootstrap.js +1616 -0
- package/app/plugins/antigravity/plugin.mjs +963 -324
- package/app/plugins/claude-code/plugin.mjs +395 -67
- package/app/plugins/codebuddy/plugin.mjs +409 -76
- package/app/plugins/codex-usage/plugin.mjs +316 -58
- package/app/plugins/copilot/plugin.mjs +316 -58
- package/app/plugins/cursor-cli/plugin.mjs +391 -68
- package/app/plugins/deepseek-harness/manifest.json +2 -2
- package/app/plugins/deepseek-harness/plugin.mjs +343 -63
- package/app/plugins/devin/plugin.mjs +316 -58
- package/app/plugins/grok/plugin.mjs +1350 -1026
- package/app/plugins/hermes/plugin.mjs +395 -70
- package/app/plugins/kimi-code/plugin.mjs +316 -58
- package/app/plugins/kiro-cli/plugin.mjs +544 -74
- package/app/plugins/omp/plugin.mjs +1264 -902
- package/app/plugins/opencode/plugin.mjs +316 -58
- package/app/plugins/pi/plugin.mjs +1189 -862
- package/app/plugins/qoder/plugin.mjs +318 -62
- package/app/plugins/qoder-cn/plugin.mjs +318 -62
- package/app/plugins/qwen-code/plugin.mjs +425 -150
- package/app/plugins/workbuddy/plugin.mjs +409 -76
- package/app/plugins/zcode/plugin.mjs +389 -61
- package/app/renderer-extension.js +11830 -8531
- package/app/voice-profile-pins.json +25 -0
- package/app/voice-qualification.json +4 -0
- package/app/web/assets/index-BCyiiDDL.js +199 -0
- package/app/web/assets/index-BNQIOOHE.css +1 -0
- package/app/web/codexhost-settings.js +1895 -190
- 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 +69 -69
- package/app/web/plugins/deepseek-ai__dsh-client-file-upload/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 +129 -8
- package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +65 -63
- package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +95 -93
- 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-settings-general/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-documentpreview/client.excel.js +1 -1
- 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 +79 -79
- package/app/web/plugins/deepseek-ai__dsh-client-ui-user-questions/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +11 -11
- package/app/web-modules/server.mjs +3279 -1676
- package/bin/codexhost.exe +0 -0
- package/libexec/codexhost-node-repl.exe +0 -0
- package/libexec/codexhost-shim.exe +0 -0
- package/libexec/codexhost-updater.exe +0 -0
- package/package.json +1 -1
- package/app/web/assets/index-Bs17Kuah.js +0 -199
- package/app/web/assets/index-C3lniEH1.css +0 -1
|
@@ -408,15 +408,6 @@ function createHarnessInstaller(environment, source) {
|
|
|
408
408
|
};
|
|
409
409
|
}
|
|
410
410
|
|
|
411
|
-
// dist/antigravity-adapter.js
|
|
412
|
-
import { spawn } from "node:child_process";
|
|
413
|
-
import { randomUUID as randomUUID6 } from "node:crypto";
|
|
414
|
-
import { access as access2, readFile as readFile2, unlink } from "node:fs/promises";
|
|
415
|
-
import https3 from "node:https";
|
|
416
|
-
import os6 from "node:os";
|
|
417
|
-
import path11 from "node:path";
|
|
418
|
-
import readline from "node:readline";
|
|
419
|
-
|
|
420
411
|
// ../../../node_modules/zod/v4/classic/external.js
|
|
421
412
|
var external_exports = {};
|
|
422
413
|
__export(external_exports, {
|
|
@@ -14958,7 +14949,7 @@ var harnessGoalSetSchema = external_exports.object({
|
|
|
14958
14949
|
origin: goalOriginSchema
|
|
14959
14950
|
});
|
|
14960
14951
|
|
|
14961
|
-
// ../../shared-contracts/dist/realtime-call.js
|
|
14952
|
+
// ../../shared-contracts/dist/realtime-call-core.js
|
|
14962
14953
|
var REALTIME_CALL_FORWARDED_HEADERS = [
|
|
14963
14954
|
"openai-alpha",
|
|
14964
14955
|
"thread-id",
|
|
@@ -14967,7 +14958,9 @@ var REALTIME_CALL_FORWARDED_HEADERS = [
|
|
|
14967
14958
|
"x-codex-turn-metadata"
|
|
14968
14959
|
];
|
|
14969
14960
|
var FORWARDED_HEADERS = new Set(REALTIME_CALL_FORWARDED_HEADERS);
|
|
14970
|
-
var REALTIME_CALL_ID_PATTERN = /^
|
|
14961
|
+
var REALTIME_CALL_ID_PATTERN = /^[A-Za-z0-9_-]{1,128}$/u;
|
|
14962
|
+
|
|
14963
|
+
// ../../shared-contracts/dist/realtime-call.js
|
|
14971
14964
|
var requestId = external_exports.string().min(1).max(128);
|
|
14972
14965
|
var realtimeCallParamsSchema = external_exports.discriminatedUnion("operation", [
|
|
14973
14966
|
external_exports.object({
|
|
@@ -15022,12 +15015,6 @@ var RELAY_PUBLIC_ORIGIN = "https://codexhost.karldigi.dev";
|
|
|
15022
15015
|
var RELAY_PUBLIC_RESOURCE = `${RELAY_PUBLIC_ORIGIN}/mcp`;
|
|
15023
15016
|
var RELAY_WAIT_TIMEOUT_MAX_MS = 25e3;
|
|
15024
15017
|
var RELAY_MAX_BODY_BYTES = 2 * 1024 * 1024;
|
|
15025
|
-
var RELAY_ALLOWED_ROUTES = [
|
|
15026
|
-
"/v1/enroll/status",
|
|
15027
|
-
"/v1/thread/read",
|
|
15028
|
-
"/v1/thread/wait",
|
|
15029
|
-
"/v1/thread/send"
|
|
15030
|
-
];
|
|
15031
15018
|
var relayLinkHelloSchema = external_exports.strictObject({
|
|
15032
15019
|
v: external_exports.literal(RELAY_LINK_PROTOCOL_VERSION),
|
|
15033
15020
|
secret: external_exports.string().min(1).max(4096)
|
|
@@ -15039,8 +15026,11 @@ var relayLinkHelloAckSchema = external_exports.strictObject({
|
|
|
15039
15026
|
var relayLinkRequestSchema = external_exports.strictObject({
|
|
15040
15027
|
requestId: external_exports.string().min(1).max(128),
|
|
15041
15028
|
deadlineMs: external_exports.number().int().positive(),
|
|
15042
|
-
route: external_exports.
|
|
15043
|
-
body: external_exports.record(external_exports.string(), external_exports.unknown())
|
|
15029
|
+
route: external_exports.string().min(1).max(128),
|
|
15030
|
+
body: external_exports.record(external_exports.string(), external_exports.unknown()),
|
|
15031
|
+
operationalClient: external_exports.string().min(1).max(64).optional(),
|
|
15032
|
+
oauthClientId: external_exports.string().min(1).max(128).optional(),
|
|
15033
|
+
dispatchGrant: external_exports.enum(["legacy-four", "full-dispatch"]).optional()
|
|
15044
15034
|
});
|
|
15045
15035
|
var relayLinkErrorSchema = external_exports.strictObject({
|
|
15046
15036
|
code: external_exports.string().min(1).max(64),
|
|
@@ -15084,6 +15074,204 @@ var relayEnrollStatusResultSchema = external_exports.strictObject({
|
|
|
15084
15074
|
runtime: external_exports.enum(["reachable", "unreachable"])
|
|
15085
15075
|
});
|
|
15086
15076
|
|
|
15077
|
+
// ../../shared-contracts/dist/external-clients.js
|
|
15078
|
+
var EXTERNAL_CLIENT_NAME_PATTERN = /^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$/u;
|
|
15079
|
+
var externalClientNameSchema = external_exports.string().trim().min(1).max(64).regex(EXTERNAL_CLIENT_NAME_PATTERN);
|
|
15080
|
+
var externalClientAccessSchema = external_exports.enum(["all-threads", "selected-workspaces"]);
|
|
15081
|
+
var externalClientConnectionModeSchema = external_exports.enum(["public-relay", "local", "direct"]);
|
|
15082
|
+
var externalClientDispatchGrantSchema = external_exports.enum(["legacy-four", "full-dispatch"]);
|
|
15083
|
+
var workspacePathSchema = external_exports.string().trim().min(1).max(4096);
|
|
15084
|
+
var directUrlSchema = external_exports.string().trim().max(2048);
|
|
15085
|
+
var externalClientPublicViewSchema = external_exports.strictObject({
|
|
15086
|
+
name: externalClientNameSchema,
|
|
15087
|
+
createdAt: external_exports.string().min(1).max(64),
|
|
15088
|
+
access: externalClientAccessSchema,
|
|
15089
|
+
workspaces: external_exports.array(workspacePathSchema).max(64),
|
|
15090
|
+
connectionMode: externalClientConnectionModeSchema,
|
|
15091
|
+
dispatchGrant: externalClientDispatchGrantSchema,
|
|
15092
|
+
oauthClientId: external_exports.string().trim().min(1).max(128).optional(),
|
|
15093
|
+
directUrl: directUrlSchema.optional(),
|
|
15094
|
+
mcpUrl: external_exports.string().min(1).max(2048).optional(),
|
|
15095
|
+
mcpUrlNote: external_exports.string().min(1).max(512).optional()
|
|
15096
|
+
});
|
|
15097
|
+
var externalClientListParamsSchema = external_exports.strictObject({});
|
|
15098
|
+
var externalClientListResultSchema = external_exports.strictObject({
|
|
15099
|
+
clients: external_exports.array(externalClientPublicViewSchema).max(256)
|
|
15100
|
+
});
|
|
15101
|
+
var externalClientWriteFieldsSchema = external_exports.strictObject({
|
|
15102
|
+
access: externalClientAccessSchema.optional(),
|
|
15103
|
+
workspaces: external_exports.array(workspacePathSchema).max(64).optional(),
|
|
15104
|
+
connectionMode: externalClientConnectionModeSchema.optional(),
|
|
15105
|
+
dispatchGrant: externalClientDispatchGrantSchema.optional(),
|
|
15106
|
+
oauthClientId: external_exports.string().trim().min(1).max(128).optional(),
|
|
15107
|
+
directUrl: directUrlSchema.optional()
|
|
15108
|
+
});
|
|
15109
|
+
var externalClientCreateParamsSchema = externalClientWriteFieldsSchema.extend({
|
|
15110
|
+
name: externalClientNameSchema
|
|
15111
|
+
});
|
|
15112
|
+
var externalClientCreateResultSchema = externalClientPublicViewSchema.extend({
|
|
15113
|
+
token: external_exports.string().min(1).max(256).optional()
|
|
15114
|
+
});
|
|
15115
|
+
var externalClientUpdateParamsSchema = externalClientWriteFieldsSchema.extend({
|
|
15116
|
+
name: externalClientNameSchema,
|
|
15117
|
+
clearOauthClientId: external_exports.literal(true).optional()
|
|
15118
|
+
});
|
|
15119
|
+
var externalClientRevokeParamsSchema = external_exports.strictObject({
|
|
15120
|
+
name: externalClientNameSchema
|
|
15121
|
+
});
|
|
15122
|
+
var externalClientRevokeResultSchema = external_exports.strictObject({
|
|
15123
|
+
name: externalClientNameSchema,
|
|
15124
|
+
revoked: external_exports.literal(true)
|
|
15125
|
+
});
|
|
15126
|
+
var stringProp = (description) => ({ type: "string", description });
|
|
15127
|
+
var integerProp = (description) => ({
|
|
15128
|
+
type: "integer",
|
|
15129
|
+
minimum: 0,
|
|
15130
|
+
description
|
|
15131
|
+
});
|
|
15132
|
+
var threadProp = stringProp("Thread id or codex://threads/<id> link");
|
|
15133
|
+
var EXTERNAL_MCP_TOOL_DESCRIPTORS = [
|
|
15134
|
+
{
|
|
15135
|
+
name: "harness_list",
|
|
15136
|
+
description: "List the Harnesses this codexhost can delegate to.",
|
|
15137
|
+
inputSchema: { type: "object", properties: {} }
|
|
15138
|
+
},
|
|
15139
|
+
{
|
|
15140
|
+
name: "harness_inspect",
|
|
15141
|
+
description: "Read a Harness's Models, Thinking options and defaults; use the returned ids when delegating.",
|
|
15142
|
+
inputSchema: {
|
|
15143
|
+
type: "object",
|
|
15144
|
+
properties: {
|
|
15145
|
+
harnessId: stringProp("Harness id from harness_list"),
|
|
15146
|
+
cwd: stringProp("Absolute workspace path"),
|
|
15147
|
+
refresh: { type: "boolean" }
|
|
15148
|
+
},
|
|
15149
|
+
required: ["harnessId"]
|
|
15150
|
+
}
|
|
15151
|
+
},
|
|
15152
|
+
{
|
|
15153
|
+
name: "delegate_start",
|
|
15154
|
+
description: "Start a task in a new Thread and return at once. Without parentThread the work belongs to this client and cwd is required. watch=true records an event for this client when the Thread stops (read it with events_poll or the SSE stream).",
|
|
15155
|
+
inputSchema: {
|
|
15156
|
+
type: "object",
|
|
15157
|
+
properties: {
|
|
15158
|
+
harnessId: stringProp("Harness id from harness_list"),
|
|
15159
|
+
task: stringProp("The full task text"),
|
|
15160
|
+
taskName: stringProp("Short display name"),
|
|
15161
|
+
cwd: stringProp("Absolute workspace path"),
|
|
15162
|
+
model: stringProp("Model id from harness_inspect"),
|
|
15163
|
+
thinking: stringProp("Thinking option id from harness_inspect"),
|
|
15164
|
+
parentThread: stringProp("Optional parent Thread"),
|
|
15165
|
+
requestId: stringProp("Reuse to retry idempotently"),
|
|
15166
|
+
refs: {
|
|
15167
|
+
type: "array",
|
|
15168
|
+
items: { type: "string" },
|
|
15169
|
+
description: "Absolute URIs of where the work came from"
|
|
15170
|
+
},
|
|
15171
|
+
watch: { type: "boolean", description: "Record an event when the Thread stops" },
|
|
15172
|
+
watchTimeoutMs: integerProp("How long to watch; default 29 minutes")
|
|
15173
|
+
},
|
|
15174
|
+
required: ["harnessId", "task"]
|
|
15175
|
+
}
|
|
15176
|
+
},
|
|
15177
|
+
{
|
|
15178
|
+
name: "thread_read",
|
|
15179
|
+
description: "Read a Thread's status and latest result, or page its visible messages (view=messages). Never changes the Thread.",
|
|
15180
|
+
inputSchema: {
|
|
15181
|
+
type: "object",
|
|
15182
|
+
properties: {
|
|
15183
|
+
thread: threadProp,
|
|
15184
|
+
view: { type: "string", enum: ["result", "messages"] },
|
|
15185
|
+
cursor: stringProp("Message cursor"),
|
|
15186
|
+
limit: integerProp("Messages per page, at most 100")
|
|
15187
|
+
},
|
|
15188
|
+
required: ["thread"]
|
|
15189
|
+
}
|
|
15190
|
+
},
|
|
15191
|
+
{
|
|
15192
|
+
name: "thread_wait",
|
|
15193
|
+
description: "Wait up to timeoutMs (at most 60000) for a Thread to stop, then return the same snapshot as thread_read plus timedOut.",
|
|
15194
|
+
inputSchema: {
|
|
15195
|
+
type: "object",
|
|
15196
|
+
properties: {
|
|
15197
|
+
thread: threadProp,
|
|
15198
|
+
timeoutMs: integerProp("At most 60000; default 30000"),
|
|
15199
|
+
view: { type: "string", enum: ["result", "messages"] }
|
|
15200
|
+
},
|
|
15201
|
+
required: ["thread"]
|
|
15202
|
+
}
|
|
15203
|
+
},
|
|
15204
|
+
{
|
|
15205
|
+
name: "thread_list",
|
|
15206
|
+
description: "List Threads: by workspace (cwd), by parent Thread, by the client that started them, or by reference.",
|
|
15207
|
+
inputSchema: {
|
|
15208
|
+
type: "object",
|
|
15209
|
+
properties: {
|
|
15210
|
+
cwd: stringProp("Absolute workspace path"),
|
|
15211
|
+
parent: stringProp("Parent Thread"),
|
|
15212
|
+
client: stringProp("Client name"),
|
|
15213
|
+
ref: stringProp("Reference URI"),
|
|
15214
|
+
limit: integerProp("At most 100; default 25"),
|
|
15215
|
+
cursor: stringProp("Cursor from a previous page"),
|
|
15216
|
+
sort: {
|
|
15217
|
+
type: "string",
|
|
15218
|
+
enum: [
|
|
15219
|
+
"created-asc",
|
|
15220
|
+
"created-desc",
|
|
15221
|
+
"updated-asc",
|
|
15222
|
+
"updated-desc",
|
|
15223
|
+
"recency-asc",
|
|
15224
|
+
"recency-desc"
|
|
15225
|
+
]
|
|
15226
|
+
}
|
|
15227
|
+
}
|
|
15228
|
+
}
|
|
15229
|
+
},
|
|
15230
|
+
{
|
|
15231
|
+
name: "thread_send",
|
|
15232
|
+
description: "Start a new Turn in an idle Thread. THREAD_BUSY means its current Turn is still running; messages are not queued.",
|
|
15233
|
+
inputSchema: {
|
|
15234
|
+
type: "object",
|
|
15235
|
+
properties: { thread: threadProp, message: stringProp("Message text") },
|
|
15236
|
+
required: ["thread", "message"]
|
|
15237
|
+
}
|
|
15238
|
+
},
|
|
15239
|
+
{
|
|
15240
|
+
name: "thread_cancel",
|
|
15241
|
+
description: "Cancel a Thread's active Turn, keeping the Thread and its history.",
|
|
15242
|
+
inputSchema: { type: "object", properties: { thread: threadProp }, required: ["thread"] }
|
|
15243
|
+
},
|
|
15244
|
+
{
|
|
15245
|
+
name: "thread_watch",
|
|
15246
|
+
description: "Record one event for this client when the Thread stops or the watch expires.",
|
|
15247
|
+
inputSchema: {
|
|
15248
|
+
type: "object",
|
|
15249
|
+
properties: { thread: threadProp, timeoutMs: integerProp("Default 29 minutes") },
|
|
15250
|
+
required: ["thread"]
|
|
15251
|
+
}
|
|
15252
|
+
},
|
|
15253
|
+
{
|
|
15254
|
+
name: "thread_watches",
|
|
15255
|
+
description: "List watches that have not been delivered yet.",
|
|
15256
|
+
inputSchema: { type: "object", properties: {} }
|
|
15257
|
+
},
|
|
15258
|
+
{
|
|
15259
|
+
name: "events_poll",
|
|
15260
|
+
description: "Read this client's events after a cursor (0 for all retained). Waits up to timeoutMs (at most 60000) for the first one. Pass the returned cursor back next time. CURSOR_EXPIRED: reconcile with thread_list client=<this client>.",
|
|
15261
|
+
inputSchema: {
|
|
15262
|
+
type: "object",
|
|
15263
|
+
properties: {
|
|
15264
|
+
after: integerProp("Cursor; 0 for all retained"),
|
|
15265
|
+
timeoutMs: integerProp("At most 60000; default 0"),
|
|
15266
|
+
limit: integerProp("At most 100")
|
|
15267
|
+
}
|
|
15268
|
+
}
|
|
15269
|
+
}
|
|
15270
|
+
];
|
|
15271
|
+
|
|
15272
|
+
// ../../shared-contracts/dist/external-mcp-map.js
|
|
15273
|
+
var DEFAULT_WATCH_MS = 29 * 6e4;
|
|
15274
|
+
|
|
15087
15275
|
// ../../shared-contracts/dist/grok-computer-use.js
|
|
15088
15276
|
var grokComputerUseGetSchema = external_exports.object({}).strict();
|
|
15089
15277
|
var grokComputerUseSetSchema = external_exports.object({
|
|
@@ -15680,11 +15868,61 @@ var threadSteeringInspectResultSchema = external_exports.object({
|
|
|
15680
15868
|
delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
|
|
15681
15869
|
}).strict();
|
|
15682
15870
|
|
|
15871
|
+
// ../../shared-contracts/dist/voice-settings.js
|
|
15872
|
+
var voiceRoutesSchema = external_exports.strictObject({
|
|
15873
|
+
chatExperience: external_exports.enum(["chatgpt", "codex"]),
|
|
15874
|
+
chatConnection: external_exports.enum(["desktop", "gateway"]),
|
|
15875
|
+
workConnection: external_exports.enum(["desktop", "gateway"])
|
|
15876
|
+
});
|
|
15877
|
+
var DEFAULT_VOICE_ROUTES = Object.freeze({
|
|
15878
|
+
chatExperience: "chatgpt",
|
|
15879
|
+
chatConnection: "desktop",
|
|
15880
|
+
workConnection: "gateway"
|
|
15881
|
+
});
|
|
15882
|
+
var voiceSettingsSchema = voiceRoutesSchema.extend({ inject: external_exports.boolean() });
|
|
15883
|
+
var voiceSettingsRequestSchema = external_exports.discriminatedUnion("operation", [
|
|
15884
|
+
external_exports.strictObject({
|
|
15885
|
+
operation: external_exports.literal("get"),
|
|
15886
|
+
runtime: external_exports.strictObject({
|
|
15887
|
+
id: external_exports.string().uuid(),
|
|
15888
|
+
revision: external_exports.string().max(64),
|
|
15889
|
+
activeCall: external_exports.boolean()
|
|
15890
|
+
}).optional()
|
|
15891
|
+
}),
|
|
15892
|
+
external_exports.strictObject({ operation: external_exports.literal("migrate"), routes: voiceRoutesSchema }),
|
|
15893
|
+
external_exports.strictObject({
|
|
15894
|
+
operation: external_exports.literal("set"),
|
|
15895
|
+
settings: voiceSettingsSchema,
|
|
15896
|
+
revision: external_exports.string().max(64)
|
|
15897
|
+
}),
|
|
15898
|
+
external_exports.strictObject({ operation: external_exports.literal("restart"), confirm: external_exports.literal(true) })
|
|
15899
|
+
]);
|
|
15900
|
+
var voiceSettingsStateSchema = external_exports.strictObject({
|
|
15901
|
+
settings: voiceSettingsSchema,
|
|
15902
|
+
initialized: external_exports.boolean(),
|
|
15903
|
+
revision: external_exports.string(),
|
|
15904
|
+
activeInject: external_exports.boolean().nullable(),
|
|
15905
|
+
envOverride: external_exports.enum(["0", "1"]).nullable(),
|
|
15906
|
+
activeEnvOverride: external_exports.enum(["0", "1"]).nullable(),
|
|
15907
|
+
routesActive: external_exports.boolean().nullable(),
|
|
15908
|
+
activeCall: external_exports.boolean().nullable(),
|
|
15909
|
+
gatewayReady: external_exports.boolean().nullable(),
|
|
15910
|
+
restartAvailable: external_exports.boolean(),
|
|
15911
|
+
restart: external_exports.strictObject({
|
|
15912
|
+
phase: external_exports.enum(["idle", "restarting", "succeeded", "failed"]),
|
|
15913
|
+
error: external_exports.string().nullable()
|
|
15914
|
+
})
|
|
15915
|
+
});
|
|
15916
|
+
|
|
15683
15917
|
// ../../shared-contracts/dist/client-channel.js
|
|
15684
15918
|
var CLIENT_CHANNEL_VERSION = 1;
|
|
15685
15919
|
var CLIENT_REQUEST_LIMIT_BYTES = 128 * 1024 * 1024;
|
|
15686
15920
|
var clientThreadPinsSchema = external_exports.object({ threadIds: external_exports.array(external_exports.string().min(1)) }).strict();
|
|
15687
15921
|
var clientThreadPinParamsSchema = external_exports.object({ threadId: external_exports.string().min(1).max(1024), pinned: external_exports.boolean() }).strict();
|
|
15922
|
+
var clientThreadTreeReadParamsSchema = external_exports.object({}).strict();
|
|
15923
|
+
var clientThreadTreeSchema = external_exports.object({
|
|
15924
|
+
parents: external_exports.record(external_exports.string().min(1), external_exports.string().min(1))
|
|
15925
|
+
}).strict();
|
|
15688
15926
|
var clientProjectlessWorkspaceSchema = external_exports.object({
|
|
15689
15927
|
prompt: external_exports.string().max(16384).optional()
|
|
15690
15928
|
}).strict();
|
|
@@ -15701,6 +15939,11 @@ var clientChannelCursorSchema = external_exports.object({
|
|
|
15701
15939
|
sequence: external_exports.number().int().nonnegative()
|
|
15702
15940
|
});
|
|
15703
15941
|
var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
|
|
15942
|
+
external_exports.object({
|
|
15943
|
+
type: external_exports.literal("skills-changed"),
|
|
15944
|
+
cursor: clientChannelCursorSchema,
|
|
15945
|
+
cwd: external_exports.string().optional()
|
|
15946
|
+
}),
|
|
15704
15947
|
external_exports.object({ type: external_exports.literal("display-settings-changed"), cursor: clientChannelCursorSchema }),
|
|
15705
15948
|
external_exports.object({
|
|
15706
15949
|
type: external_exports.literal("preferences-changed"),
|
|
@@ -15898,6 +16141,28 @@ var voiceTranscribeResultSchema = external_exports.discriminatedUnion("ok", [
|
|
|
15898
16141
|
external_exports.object({ ok: external_exports.literal(false), error: external_exports.object({ code: voiceErrorCodeSchema }).strict() }).strict()
|
|
15899
16142
|
]);
|
|
15900
16143
|
|
|
16144
|
+
// ../../shared-contracts/dist/skills.js
|
|
16145
|
+
var skillsListParamsSchema = external_exports.object({
|
|
16146
|
+
threadId: hostThreadIdSchema.optional(),
|
|
16147
|
+
cwd: external_exports.string().min(1).optional()
|
|
16148
|
+
}).strict().refine((params) => !(params.threadId && params.cwd), {
|
|
16149
|
+
message: "Specify threadId or cwd, not both"
|
|
16150
|
+
});
|
|
16151
|
+
var librarySkillSchema = external_exports.object({
|
|
16152
|
+
name: external_exports.string().min(1).regex(/^[^\s[\]]+$/u),
|
|
16153
|
+
description: external_exports.string().optional(),
|
|
16154
|
+
path: external_exports.string().min(1),
|
|
16155
|
+
scope: external_exports.enum(["project", "global"]),
|
|
16156
|
+
source: external_exports.string().min(1)
|
|
16157
|
+
}).strict();
|
|
16158
|
+
var skillsListResultSchema = external_exports.object({
|
|
16159
|
+
revision: external_exports.number().int().nonnegative(),
|
|
16160
|
+
complete: external_exports.boolean(),
|
|
16161
|
+
skills: external_exports.array(librarySkillSchema),
|
|
16162
|
+
warnings: external_exports.array(external_exports.string()).optional()
|
|
16163
|
+
}).strict();
|
|
16164
|
+
var skillsChangedParamsSchema = external_exports.object({ cwd: external_exports.string().min(1).optional() }).strict();
|
|
16165
|
+
|
|
15901
16166
|
// ../../shared-contracts/dist/web-access-tokens.js
|
|
15902
16167
|
var webNetworkAccessUrlSchema = external_exports.object({
|
|
15903
16168
|
/**
|
|
@@ -16003,8 +16268,8 @@ var REMOTE_THREAD_REPLY_MAX_BYTES = 16 * 1024 * 1024;
|
|
|
16003
16268
|
var delegationReadParamsSchema = external_exports.strictObject({
|
|
16004
16269
|
threadId: external_exports.string().min(1).max(1024),
|
|
16005
16270
|
view: external_exports.enum(["result", "messages"]),
|
|
16006
|
-
|
|
16007
|
-
|
|
16271
|
+
from: external_exports.number().int().min(1).max(Number.MAX_SAFE_INTEGER).optional(),
|
|
16272
|
+
to: external_exports.number().int().min(1).max(Number.MAX_SAFE_INTEGER).optional()
|
|
16008
16273
|
});
|
|
16009
16274
|
|
|
16010
16275
|
// ../../shared-contracts/dist/credential-imports.js
|
|
@@ -16456,6 +16721,10 @@ var CONSOLE_HOST_METHODS = Object.freeze([
|
|
|
16456
16721
|
"codexhost/voice/gateway-status",
|
|
16457
16722
|
"codexhost/enrollment/list",
|
|
16458
16723
|
"codexhost/enrollment/revoke",
|
|
16724
|
+
"codexhost/external-clients/list",
|
|
16725
|
+
"codexhost/external-clients/create",
|
|
16726
|
+
"codexhost/external-clients/update",
|
|
16727
|
+
"codexhost/external-clients/revoke",
|
|
16459
16728
|
"codexhost/console/remote-connections",
|
|
16460
16729
|
"codexhost/runtime/status",
|
|
16461
16730
|
"codexhost/remote/ssh-setup",
|
|
@@ -17002,6 +17271,17 @@ var updateStatusResultSchema = external_exports.strictObject({
|
|
|
17002
17271
|
status: updateStatusSchema.nullable()
|
|
17003
17272
|
});
|
|
17004
17273
|
|
|
17274
|
+
// ../../shared-contracts/dist/thread-watch-notice.js
|
|
17275
|
+
var THREAD_WATCH_NOTICE_OUTCOMES = [
|
|
17276
|
+
"completed",
|
|
17277
|
+
"failed",
|
|
17278
|
+
"interrupted",
|
|
17279
|
+
"timedOut",
|
|
17280
|
+
"unreadable",
|
|
17281
|
+
"notFound"
|
|
17282
|
+
];
|
|
17283
|
+
var ENTRY_PATTERN = new RegExp(String.raw`^- \[([^\]\n]+)\]\(thread://([^\s()<>"?#/]+)\): ` + `(${THREAD_WATCH_NOTICE_OUTCOMES.join("|")})(?:. (.+))?$`, "u");
|
|
17284
|
+
|
|
17005
17285
|
// ../../shared-contracts/dist/remote-runtime.js
|
|
17006
17286
|
var remoteUpdatePhaseSchema = external_exports.enum([
|
|
17007
17287
|
"idle",
|
|
@@ -17049,6 +17329,14 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
|
17049
17329
|
archived: external_exports.boolean()
|
|
17050
17330
|
}),
|
|
17051
17331
|
external_exports.strictObject({ kind: external_exports.literal("read"), ...thread }),
|
|
17332
|
+
external_exports.strictObject({
|
|
17333
|
+
kind: external_exports.literal("configure"),
|
|
17334
|
+
...thread,
|
|
17335
|
+
epoch: identity,
|
|
17336
|
+
modelId: identity.optional(),
|
|
17337
|
+
thinkingOptionId: identity.optional(),
|
|
17338
|
+
permissionModeId: identity.optional()
|
|
17339
|
+
}).refine((value) => [value.modelId, value.thinkingOptionId, value.permissionModeId].filter((v) => v !== void 0).length === 1, "Select exactly one remote setting"),
|
|
17052
17340
|
external_exports.strictObject({
|
|
17053
17341
|
kind: external_exports.literal("prompt"),
|
|
17054
17342
|
...thread,
|
|
@@ -17121,6 +17409,13 @@ var remoteConnectionsReplySchema = external_exports.union([
|
|
|
17121
17409
|
external_exports.strictObject({ error: external_exports.strictObject({ code: external_exports.number().int(), message: external_exports.string() }) })
|
|
17122
17410
|
]);
|
|
17123
17411
|
|
|
17412
|
+
// ../../shared-contracts/dist/thread-title.js
|
|
17413
|
+
var threadTitleInputSchema = external_exports.strictObject({
|
|
17414
|
+
prompt: external_exports.string().trim().min(1).max(2e3),
|
|
17415
|
+
cwd: external_exports.string().max(4096).nullable()
|
|
17416
|
+
});
|
|
17417
|
+
var threadTitleResultSchema = external_exports.string().trim().min(1).max(60).nullable();
|
|
17418
|
+
|
|
17124
17419
|
// ../../shared-contracts/dist/web-ui-extensions.js
|
|
17125
17420
|
var webUiExtensionIdSchema = external_exports.string().max(214).regex(/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/u);
|
|
17126
17421
|
var localizedTextSchema2 = external_exports.union([
|
|
@@ -17161,52 +17456,6 @@ var webUiExtensionInstallSchema = external_exports.object({
|
|
|
17161
17456
|
var webUiExtensionEnabledSchema = external_exports.object({ id: webUiExtensionIdSchema, enabled: external_exports.boolean() }).strict();
|
|
17162
17457
|
var webUiExtensionRemoveSchema = external_exports.object({ id: webUiExtensionIdSchema }).strict();
|
|
17163
17458
|
|
|
17164
|
-
// ../../shared-contracts/dist/voice-settings.js
|
|
17165
|
-
var voiceRoutesSchema = external_exports.strictObject({
|
|
17166
|
-
chatExperience: external_exports.enum(["chatgpt", "codex"]),
|
|
17167
|
-
chatConnection: external_exports.enum(["desktop", "gateway"]),
|
|
17168
|
-
workConnection: external_exports.enum(["desktop", "gateway"])
|
|
17169
|
-
});
|
|
17170
|
-
var DEFAULT_VOICE_ROUTES = Object.freeze({
|
|
17171
|
-
chatExperience: "chatgpt",
|
|
17172
|
-
chatConnection: "desktop",
|
|
17173
|
-
workConnection: "gateway"
|
|
17174
|
-
});
|
|
17175
|
-
var voiceSettingsSchema = voiceRoutesSchema.extend({ inject: external_exports.boolean() });
|
|
17176
|
-
var voiceSettingsRequestSchema = external_exports.discriminatedUnion("operation", [
|
|
17177
|
-
external_exports.strictObject({
|
|
17178
|
-
operation: external_exports.literal("get"),
|
|
17179
|
-
runtime: external_exports.strictObject({
|
|
17180
|
-
id: external_exports.string().uuid(),
|
|
17181
|
-
revision: external_exports.string().max(64),
|
|
17182
|
-
activeCall: external_exports.boolean()
|
|
17183
|
-
}).optional()
|
|
17184
|
-
}),
|
|
17185
|
-
external_exports.strictObject({ operation: external_exports.literal("migrate"), routes: voiceRoutesSchema }),
|
|
17186
|
-
external_exports.strictObject({
|
|
17187
|
-
operation: external_exports.literal("set"),
|
|
17188
|
-
settings: voiceSettingsSchema,
|
|
17189
|
-
revision: external_exports.string().max(64)
|
|
17190
|
-
}),
|
|
17191
|
-
external_exports.strictObject({ operation: external_exports.literal("restart"), confirm: external_exports.literal(true) })
|
|
17192
|
-
]);
|
|
17193
|
-
var voiceSettingsStateSchema = external_exports.strictObject({
|
|
17194
|
-
settings: voiceSettingsSchema,
|
|
17195
|
-
initialized: external_exports.boolean(),
|
|
17196
|
-
revision: external_exports.string(),
|
|
17197
|
-
activeInject: external_exports.boolean().nullable(),
|
|
17198
|
-
envOverride: external_exports.enum(["0", "1"]).nullable(),
|
|
17199
|
-
activeEnvOverride: external_exports.enum(["0", "1"]).nullable(),
|
|
17200
|
-
routesActive: external_exports.boolean().nullable(),
|
|
17201
|
-
activeCall: external_exports.boolean().nullable(),
|
|
17202
|
-
gatewayReady: external_exports.boolean().nullable(),
|
|
17203
|
-
restartAvailable: external_exports.boolean(),
|
|
17204
|
-
restart: external_exports.strictObject({
|
|
17205
|
-
phase: external_exports.enum(["idle", "restarting", "succeeded", "failed"]),
|
|
17206
|
-
error: external_exports.string().nullable()
|
|
17207
|
-
})
|
|
17208
|
-
});
|
|
17209
|
-
|
|
17210
17459
|
// ../../shared-contracts/dist/background-activity.js
|
|
17211
17460
|
var backgroundActivitySchema = external_exports.strictObject({
|
|
17212
17461
|
id: external_exports.string().min(1),
|
|
@@ -17404,6 +17653,69 @@ var requestFields = /* @__PURE__ */ new Set([
|
|
|
17404
17653
|
"provider"
|
|
17405
17654
|
]);
|
|
17406
17655
|
|
|
17656
|
+
// ../../harness-adapter/dist/subagent-configuration.js
|
|
17657
|
+
function subagentConfiguration(value) {
|
|
17658
|
+
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
17659
|
+
return {};
|
|
17660
|
+
const row = value;
|
|
17661
|
+
const text = (value2) => typeof value2 === "string" && value2.trim() ? value2 : void 0;
|
|
17662
|
+
const model2 = row.model === "inherit" ? void 0 : text(row.model);
|
|
17663
|
+
const reasoningEffort = text(row.reasoningEffort) ?? text(row.reasoning_effort) ?? text(row.thinking);
|
|
17664
|
+
return { ...model2 ? { model: model2 } : {}, ...reasoningEffort ? { reasoningEffort } : {} };
|
|
17665
|
+
}
|
|
17666
|
+
function inheritSubagentConfiguration(child, parent) {
|
|
17667
|
+
const native = subagentConfiguration(child);
|
|
17668
|
+
const model2 = native.model ?? parent.model;
|
|
17669
|
+
const reasoningEffort = native.reasoningEffort ?? parent.reasoningEffort;
|
|
17670
|
+
const next = { ...child };
|
|
17671
|
+
delete next.model;
|
|
17672
|
+
delete next.reasoningEffort;
|
|
17673
|
+
return { ...next, ...model2 ? { model: model2 } : {}, ...reasoningEffort ? { reasoningEffort } : {} };
|
|
17674
|
+
}
|
|
17675
|
+
function configureSubagentEvent(event, parent) {
|
|
17676
|
+
const children = (states) => states.map((child) => inheritSubagentConfiguration(child, parent));
|
|
17677
|
+
if (event.type === "item.started" && event.item.type === "subagentDelegation")
|
|
17678
|
+
return { ...event, item: { ...event.item, subagents: children(event.item.subagents) } };
|
|
17679
|
+
if (event.type === "item.updated" && event.update.type === "subagents.replace")
|
|
17680
|
+
return { ...event, update: { ...event.update, subagents: children(event.update.subagents) } };
|
|
17681
|
+
if (event.type === "item.completed" && event.snapshot.item.type === "subagentDelegation")
|
|
17682
|
+
return {
|
|
17683
|
+
...event,
|
|
17684
|
+
snapshot: {
|
|
17685
|
+
...event.snapshot,
|
|
17686
|
+
item: {
|
|
17687
|
+
...event.snapshot.item,
|
|
17688
|
+
subagents: children(event.snapshot.item.subagents)
|
|
17689
|
+
}
|
|
17690
|
+
}
|
|
17691
|
+
};
|
|
17692
|
+
return event;
|
|
17693
|
+
}
|
|
17694
|
+
function configureSubagentSnapshot(snapshot, parent) {
|
|
17695
|
+
return {
|
|
17696
|
+
...snapshot,
|
|
17697
|
+
turns: snapshot.turns.map((turn) => ({
|
|
17698
|
+
...turn,
|
|
17699
|
+
items: turn.items.map((entry) => entry.item.type === "subagentDelegation" ? {
|
|
17700
|
+
...entry,
|
|
17701
|
+
item: {
|
|
17702
|
+
...entry.item,
|
|
17703
|
+
subagents: entry.item.subagents.map((child) => inheritSubagentConfiguration(child, parent))
|
|
17704
|
+
}
|
|
17705
|
+
} : entry)
|
|
17706
|
+
}))
|
|
17707
|
+
};
|
|
17708
|
+
}
|
|
17709
|
+
|
|
17710
|
+
// dist/antigravity-adapter.js
|
|
17711
|
+
import { spawn } from "node:child_process";
|
|
17712
|
+
import { randomUUID as randomUUID6 } from "node:crypto";
|
|
17713
|
+
import { access as access2, readFile as readFile2, unlink } from "node:fs/promises";
|
|
17714
|
+
import https3 from "node:https";
|
|
17715
|
+
import os6 from "node:os";
|
|
17716
|
+
import path11 from "node:path";
|
|
17717
|
+
import readline from "node:readline";
|
|
17718
|
+
|
|
17407
17719
|
// dist/command.js
|
|
17408
17720
|
import path4 from "node:path";
|
|
17409
17721
|
var antigravityDiscoverySpec = {
|
|
@@ -17430,7 +17742,8 @@ function resolveAntigravityExecutable(input = {}) {
|
|
|
17430
17742
|
|
|
17431
17743
|
// dist/fork.js
|
|
17432
17744
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
17433
|
-
import {
|
|
17745
|
+
import { constants } from "node:fs";
|
|
17746
|
+
import { access, copyFile, cp, mkdir as mkdir2, rm as rm3 } from "node:fs/promises";
|
|
17434
17747
|
import os4 from "node:os";
|
|
17435
17748
|
import path7 from "node:path";
|
|
17436
17749
|
|
|
@@ -17506,6 +17819,8 @@ var hostItemSchema = external_exports.discriminatedUnion("type", [
|
|
|
17506
17819
|
nativeSubagentId: external_exports.string().optional(),
|
|
17507
17820
|
description: external_exports.string(),
|
|
17508
17821
|
role: external_exports.string().optional(),
|
|
17822
|
+
model: external_exports.string().optional(),
|
|
17823
|
+
reasoningEffort: external_exports.string().optional(),
|
|
17509
17824
|
background: external_exports.boolean(),
|
|
17510
17825
|
status: external_exports.enum(["pending", "running", "completed", "failed", "interrupted"]),
|
|
17511
17826
|
resultSummary: external_exports.string().optional()
|
|
@@ -17757,63 +18072,170 @@ async function nativeTurnBoundaryError(dbPath, sidecarTurnCount) {
|
|
|
17757
18072
|
return null;
|
|
17758
18073
|
}
|
|
17759
18074
|
|
|
17760
|
-
// dist/
|
|
17761
|
-
|
|
17762
|
-
|
|
17763
|
-
|
|
17764
|
-
|
|
17765
|
-
|
|
17766
|
-
|
|
17767
|
-
|
|
17768
|
-
var HarnessUsageSourceChangedError = class extends Error {
|
|
17769
|
-
code = "HARNESS_USAGE_SOURCE_CHANGED";
|
|
17770
|
-
/** Plugins may bundle their own copy of this contract, so instanceof is insufficient. */
|
|
17771
|
-
static is(error51) {
|
|
17772
|
-
return typeof error51 === "object" && error51 !== null && "code" in error51 && error51.code === "HARNESS_USAGE_SOURCE_CHANGED";
|
|
17773
|
-
}
|
|
17774
|
-
};
|
|
17775
|
-
var MAX_SESSION_ID_LENGTH = 512;
|
|
17776
|
-
var MAX_CWD_LENGTH = 4096;
|
|
17777
|
-
var MAX_SESSION_TITLE_LENGTH = 200;
|
|
17778
|
-
function usageSessionTitle(value) {
|
|
17779
|
-
if (typeof value !== "string")
|
|
17780
|
-
return void 0;
|
|
17781
|
-
const normalized = value.replaceAll("\0", "").replaceAll(/\s+/gu, " ").trim();
|
|
17782
|
-
if (!normalized)
|
|
17783
|
-
return void 0;
|
|
17784
|
-
if (normalized.length <= MAX_SESSION_TITLE_LENGTH)
|
|
17785
|
-
return normalized;
|
|
17786
|
-
let title = "";
|
|
17787
|
-
for (const character of normalized) {
|
|
17788
|
-
if (title.length + character.length >= MAX_SESSION_TITLE_LENGTH)
|
|
17789
|
-
break;
|
|
17790
|
-
title += character;
|
|
18075
|
+
// dist/native-trajectory-metadata.js
|
|
18076
|
+
var DEFAULT_CLI_PROJECT_ID = "default-cli-project";
|
|
18077
|
+
function encodeVarint(value) {
|
|
18078
|
+
const bytes = [];
|
|
18079
|
+
let remaining = value >>> 0;
|
|
18080
|
+
while (remaining >= 128) {
|
|
18081
|
+
bytes.push(remaining & 127 | 128);
|
|
18082
|
+
remaining >>>= 7;
|
|
17791
18083
|
}
|
|
17792
|
-
|
|
18084
|
+
bytes.push(remaining);
|
|
18085
|
+
return Buffer.from(bytes);
|
|
17793
18086
|
}
|
|
17794
|
-
function
|
|
17795
|
-
|
|
18087
|
+
function decodeVarint(buffer, start) {
|
|
18088
|
+
let value = 0n;
|
|
18089
|
+
for (let index = 0; index < 10; index++) {
|
|
18090
|
+
const byte = buffer[start + index];
|
|
18091
|
+
if (byte === void 0 || index === 9 && byte > 1)
|
|
18092
|
+
return null;
|
|
18093
|
+
value |= BigInt(byte & 127) << BigInt(index * 7);
|
|
18094
|
+
if ((byte & 128) === 0)
|
|
18095
|
+
return [value, start + index + 1];
|
|
18096
|
+
}
|
|
18097
|
+
return null;
|
|
17796
18098
|
}
|
|
17797
|
-
function
|
|
17798
|
-
return
|
|
18099
|
+
function encodeLengthDelimited(fieldNumber, payload) {
|
|
18100
|
+
return Buffer.concat([
|
|
18101
|
+
encodeVarint(fieldNumber << 3 | 2),
|
|
18102
|
+
encodeVarint(payload.length),
|
|
18103
|
+
Buffer.from(payload)
|
|
18104
|
+
]);
|
|
17799
18105
|
}
|
|
17800
|
-
function
|
|
17801
|
-
|
|
17802
|
-
|
|
17803
|
-
|
|
17804
|
-
|
|
17805
|
-
return entry;
|
|
17806
|
-
return {
|
|
17807
|
-
...entry,
|
|
17808
|
-
...sessionId !== void 0 ? { sessionId } : {},
|
|
17809
|
-
...cwd !== void 0 ? { cwd } : {},
|
|
17810
|
-
...sessionTitle !== void 0 ? { sessionTitle } : {}
|
|
17811
|
-
};
|
|
18106
|
+
function minimalTrajectoryMetadataBlob(cascadeId, projectId = DEFAULT_CLI_PROJECT_ID) {
|
|
18107
|
+
return Buffer.concat([
|
|
18108
|
+
encodeLengthDelimited(6, Buffer.from(cascadeId, "utf8")),
|
|
18109
|
+
encodeLengthDelimited(18, Buffer.from(projectId, "utf8"))
|
|
18110
|
+
]);
|
|
17812
18111
|
}
|
|
17813
|
-
|
|
17814
|
-
|
|
17815
|
-
|
|
17816
|
-
|
|
18112
|
+
function minimalRawSummaryBlob(trajectoryId, metadataBlob) {
|
|
18113
|
+
return Buffer.concat([
|
|
18114
|
+
encodeLengthDelimited(4, Buffer.from(trajectoryId, "utf8")),
|
|
18115
|
+
Buffer.from([40, 1]),
|
|
18116
|
+
encodeLengthDelimited(17, metadataBlob),
|
|
18117
|
+
Buffer.from([176, 1, 4])
|
|
18118
|
+
]);
|
|
18119
|
+
}
|
|
18120
|
+
function rewriteTrajectoryMetadataCascadeId(blob, cascadeId) {
|
|
18121
|
+
const chunks = [];
|
|
18122
|
+
let offset = 0;
|
|
18123
|
+
let wroteCascadeId = false;
|
|
18124
|
+
let hasProjectId = false;
|
|
18125
|
+
while (offset < blob.length) {
|
|
18126
|
+
const fieldStart = offset;
|
|
18127
|
+
const tagParsed = decodeVarint(blob, offset);
|
|
18128
|
+
if (!tagParsed)
|
|
18129
|
+
return null;
|
|
18130
|
+
const [tag, afterTag] = tagParsed;
|
|
18131
|
+
if (tag < 8n || tag > 0xffffffffn)
|
|
18132
|
+
return null;
|
|
18133
|
+
const fieldNumber = Number(tag >> 3n);
|
|
18134
|
+
const wireType = Number(tag & 7n);
|
|
18135
|
+
if (fieldNumber === 6 && wireType !== 2)
|
|
18136
|
+
return null;
|
|
18137
|
+
offset = afterTag;
|
|
18138
|
+
if (wireType === 0) {
|
|
18139
|
+
const valParsed = decodeVarint(blob, offset);
|
|
18140
|
+
if (!valParsed)
|
|
18141
|
+
return null;
|
|
18142
|
+
offset = valParsed[1];
|
|
18143
|
+
} else if (wireType === 1) {
|
|
18144
|
+
if (offset + 8 > blob.length)
|
|
18145
|
+
return null;
|
|
18146
|
+
offset += 8;
|
|
18147
|
+
} else if (wireType === 2) {
|
|
18148
|
+
const lenParsed = decodeVarint(blob, offset);
|
|
18149
|
+
if (!lenParsed)
|
|
18150
|
+
return null;
|
|
18151
|
+
const [length, afterLen] = lenParsed;
|
|
18152
|
+
if (length > BigInt(blob.length - afterLen))
|
|
18153
|
+
return null;
|
|
18154
|
+
offset = afterLen + Number(length);
|
|
18155
|
+
if (fieldNumber === 6) {
|
|
18156
|
+
if (!wroteCascadeId) {
|
|
18157
|
+
chunks.push(encodeLengthDelimited(6, Buffer.from(cascadeId, "utf8")));
|
|
18158
|
+
wroteCascadeId = true;
|
|
18159
|
+
}
|
|
18160
|
+
continue;
|
|
18161
|
+
}
|
|
18162
|
+
if (fieldNumber === 18)
|
|
18163
|
+
hasProjectId = true;
|
|
18164
|
+
} else if (wireType === 5) {
|
|
18165
|
+
if (offset + 4 > blob.length)
|
|
18166
|
+
return null;
|
|
18167
|
+
offset += 4;
|
|
18168
|
+
} else {
|
|
18169
|
+
return null;
|
|
18170
|
+
}
|
|
18171
|
+
chunks.push(Buffer.from(blob.subarray(fieldStart, offset)));
|
|
18172
|
+
}
|
|
18173
|
+
if (!wroteCascadeId) {
|
|
18174
|
+
chunks.push(encodeLengthDelimited(6, Buffer.from(cascadeId, "utf8")));
|
|
18175
|
+
}
|
|
18176
|
+
if (!hasProjectId) {
|
|
18177
|
+
chunks.push(encodeLengthDelimited(18, Buffer.from(DEFAULT_CLI_PROJECT_ID, "utf8")));
|
|
18178
|
+
}
|
|
18179
|
+
return Buffer.concat(chunks);
|
|
18180
|
+
}
|
|
18181
|
+
|
|
18182
|
+
// dist/usage-statistics.js
|
|
18183
|
+
import { lstat, opendir } from "node:fs/promises";
|
|
18184
|
+
import os3 from "node:os";
|
|
18185
|
+
import path6 from "node:path";
|
|
18186
|
+
|
|
18187
|
+
// ../../harness-adapter/dist/usage-statistics.js
|
|
18188
|
+
import { createReadStream } from "node:fs";
|
|
18189
|
+
import { createInterface } from "node:readline";
|
|
18190
|
+
var HarnessUsageSourceChangedError = class extends Error {
|
|
18191
|
+
code = "HARNESS_USAGE_SOURCE_CHANGED";
|
|
18192
|
+
/** Plugins may bundle their own copy of this contract, so instanceof is insufficient. */
|
|
18193
|
+
static is(error51) {
|
|
18194
|
+
return typeof error51 === "object" && error51 !== null && "code" in error51 && error51.code === "HARNESS_USAGE_SOURCE_CHANGED";
|
|
18195
|
+
}
|
|
18196
|
+
};
|
|
18197
|
+
var MAX_SESSION_ID_LENGTH = 512;
|
|
18198
|
+
var MAX_CWD_LENGTH = 4096;
|
|
18199
|
+
var MAX_SESSION_TITLE_LENGTH = 200;
|
|
18200
|
+
function usageSessionTitle(value) {
|
|
18201
|
+
if (typeof value !== "string")
|
|
18202
|
+
return void 0;
|
|
18203
|
+
const normalized = value.replaceAll("\0", "").replaceAll(/\s+/gu, " ").trim();
|
|
18204
|
+
if (!normalized)
|
|
18205
|
+
return void 0;
|
|
18206
|
+
if (normalized.length <= MAX_SESSION_TITLE_LENGTH)
|
|
18207
|
+
return normalized;
|
|
18208
|
+
let title = "";
|
|
18209
|
+
for (const character of normalized) {
|
|
18210
|
+
if (title.length + character.length >= MAX_SESSION_TITLE_LENGTH)
|
|
18211
|
+
break;
|
|
18212
|
+
title += character;
|
|
18213
|
+
}
|
|
18214
|
+
return `${title.trimEnd()}…`;
|
|
18215
|
+
}
|
|
18216
|
+
function sessionIdOk(value) {
|
|
18217
|
+
return typeof value === "string" && value.length > 0 && value.length <= MAX_SESSION_ID_LENGTH;
|
|
18218
|
+
}
|
|
18219
|
+
function cwdOk(value) {
|
|
18220
|
+
return typeof value === "string" && value.length > 0 && value.length <= MAX_CWD_LENGTH && !value.includes("\0") && (value.startsWith("/") || /^[A-Za-z]:[\\/]/u.test(value) || value.startsWith("\\\\"));
|
|
18221
|
+
}
|
|
18222
|
+
function withUsageSession(entry, session) {
|
|
18223
|
+
const sessionId = sessionIdOk(session.sessionId) ? session.sessionId : void 0;
|
|
18224
|
+
const cwd = cwdOk(session.cwd) ? session.cwd : void 0;
|
|
18225
|
+
const sessionTitle = sessionId !== void 0 ? usageSessionTitle(session.title) : void 0;
|
|
18226
|
+
if (sessionId === void 0 && cwd === void 0)
|
|
18227
|
+
return entry;
|
|
18228
|
+
return {
|
|
18229
|
+
...entry,
|
|
18230
|
+
...sessionId !== void 0 ? { sessionId } : {},
|
|
18231
|
+
...cwd !== void 0 ? { cwd } : {},
|
|
18232
|
+
...sessionTitle !== void 0 ? { sessionTitle } : {}
|
|
18233
|
+
};
|
|
18234
|
+
}
|
|
18235
|
+
async function* jsonlRecords(file2, marker, signal) {
|
|
18236
|
+
const lines = createInterface({
|
|
18237
|
+
input: createReadStream(file2, { encoding: "utf8", signal }),
|
|
18238
|
+
crlfDelay: Infinity
|
|
17817
18239
|
});
|
|
17818
18240
|
for await (const line of lines) {
|
|
17819
18241
|
if (!line.includes(marker))
|
|
@@ -17939,7 +18361,7 @@ function createAntigravityUsageStatistics(environment) {
|
|
|
17939
18361
|
}
|
|
17940
18362
|
|
|
17941
18363
|
// dist/fork.js
|
|
17942
|
-
var
|
|
18364
|
+
var DEFAULT_CLI_PROJECT_ID2 = "default-cli-project";
|
|
17943
18365
|
var UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/iu;
|
|
17944
18366
|
function nativeConversationDbPath(nativeSessionId, homedir2 = os4.homedir()) {
|
|
17945
18367
|
return path7.join(homedir2, ".gemini", "antigravity-cli", "conversations", `${nativeSessionId}.db`);
|
|
@@ -17953,120 +18375,6 @@ function nativeBrainRoot(homedir2 = os4.homedir()) {
|
|
|
17953
18375
|
function nativeBrainDirPath(nativeSessionId, homedir2 = os4.homedir()) {
|
|
17954
18376
|
return path7.join(nativeBrainRoot(homedir2), nativeSessionId);
|
|
17955
18377
|
}
|
|
17956
|
-
function encodeVarint(value) {
|
|
17957
|
-
const bytes = [];
|
|
17958
|
-
let remaining = value >>> 0;
|
|
17959
|
-
while (remaining >= 128) {
|
|
17960
|
-
bytes.push(remaining & 127 | 128);
|
|
17961
|
-
remaining >>>= 7;
|
|
17962
|
-
}
|
|
17963
|
-
bytes.push(remaining);
|
|
17964
|
-
return Buffer.from(bytes);
|
|
17965
|
-
}
|
|
17966
|
-
function decodeVarint(buffer, startOffset) {
|
|
17967
|
-
let value = 0;
|
|
17968
|
-
let shift = 0;
|
|
17969
|
-
let offset = startOffset;
|
|
17970
|
-
while (offset < buffer.length) {
|
|
17971
|
-
const byte = buffer[offset];
|
|
17972
|
-
if (byte === void 0)
|
|
17973
|
-
return null;
|
|
17974
|
-
offset += 1;
|
|
17975
|
-
value += (byte & 127) * 2 ** shift;
|
|
17976
|
-
if ((byte & 128) === 0)
|
|
17977
|
-
return [value, offset];
|
|
17978
|
-
shift += 7;
|
|
17979
|
-
if (shift > 53)
|
|
17980
|
-
return null;
|
|
17981
|
-
}
|
|
17982
|
-
return null;
|
|
17983
|
-
}
|
|
17984
|
-
function encodeLengthDelimited(fieldNumber, payload) {
|
|
17985
|
-
return Buffer.concat([
|
|
17986
|
-
encodeVarint(fieldNumber << 3 | 2),
|
|
17987
|
-
encodeVarint(payload.length),
|
|
17988
|
-
Buffer.from(payload)
|
|
17989
|
-
]);
|
|
17990
|
-
}
|
|
17991
|
-
function minimalTrajectoryMetadataBlob(cascadeId, projectId = DEFAULT_CLI_PROJECT_ID) {
|
|
17992
|
-
return Buffer.concat([
|
|
17993
|
-
encodeLengthDelimited(6, Buffer.from(cascadeId, "utf8")),
|
|
17994
|
-
encodeLengthDelimited(18, Buffer.from(projectId, "utf8"))
|
|
17995
|
-
]);
|
|
17996
|
-
}
|
|
17997
|
-
function minimalRawSummaryBlob(trajectoryId, metadataBlob) {
|
|
17998
|
-
return Buffer.concat([
|
|
17999
|
-
encodeLengthDelimited(4, Buffer.from(trajectoryId, "utf8")),
|
|
18000
|
-
Buffer.from([40, 1]),
|
|
18001
|
-
encodeLengthDelimited(17, metadataBlob),
|
|
18002
|
-
Buffer.from([176, 1, 4])
|
|
18003
|
-
]);
|
|
18004
|
-
}
|
|
18005
|
-
function updateTrajectoryMetadataCascadeId(blob, cascadeId) {
|
|
18006
|
-
if (!blob || blob.length === 0)
|
|
18007
|
-
return minimalTrajectoryMetadataBlob(cascadeId);
|
|
18008
|
-
return rewriteTrajectoryMetadataCascadeId(blob, cascadeId) ?? minimalTrajectoryMetadataBlob(cascadeId);
|
|
18009
|
-
}
|
|
18010
|
-
function rewriteTrajectoryMetadataCascadeId(blob, cascadeId) {
|
|
18011
|
-
const chunks = [];
|
|
18012
|
-
let offset = 0;
|
|
18013
|
-
let wroteCascadeId = false;
|
|
18014
|
-
let hasProjectId = false;
|
|
18015
|
-
while (offset < blob.length) {
|
|
18016
|
-
const fieldStart = offset;
|
|
18017
|
-
const tagParsed = decodeVarint(blob, offset);
|
|
18018
|
-
if (!tagParsed)
|
|
18019
|
-
return null;
|
|
18020
|
-
const [tag, afterTag] = tagParsed;
|
|
18021
|
-
const fieldNumber = tag >>> 3;
|
|
18022
|
-
const wireType = tag & 7;
|
|
18023
|
-
offset = afterTag;
|
|
18024
|
-
if (wireType === 0) {
|
|
18025
|
-
const valParsed = decodeVarint(blob, offset);
|
|
18026
|
-
if (!valParsed)
|
|
18027
|
-
return null;
|
|
18028
|
-
offset = valParsed[1];
|
|
18029
|
-
chunks.push(Buffer.from(blob.subarray(fieldStart, offset)));
|
|
18030
|
-
} else if (wireType === 1) {
|
|
18031
|
-
if (offset + 8 > blob.length)
|
|
18032
|
-
return null;
|
|
18033
|
-
offset += 8;
|
|
18034
|
-
chunks.push(Buffer.from(blob.subarray(fieldStart, offset)));
|
|
18035
|
-
} else if (wireType === 2) {
|
|
18036
|
-
const lenParsed = decodeVarint(blob, offset);
|
|
18037
|
-
if (!lenParsed)
|
|
18038
|
-
return null;
|
|
18039
|
-
const [length, afterLen] = lenParsed;
|
|
18040
|
-
if (afterLen + length > blob.length)
|
|
18041
|
-
return null;
|
|
18042
|
-
offset = afterLen + length;
|
|
18043
|
-
if (fieldNumber === 6) {
|
|
18044
|
-
if (!wroteCascadeId) {
|
|
18045
|
-
chunks.push(encodeLengthDelimited(6, Buffer.from(cascadeId, "utf8")));
|
|
18046
|
-
wroteCascadeId = true;
|
|
18047
|
-
}
|
|
18048
|
-
} else {
|
|
18049
|
-
if (fieldNumber === 18)
|
|
18050
|
-
hasProjectId = true;
|
|
18051
|
-
chunks.push(Buffer.from(blob.subarray(fieldStart, offset)));
|
|
18052
|
-
}
|
|
18053
|
-
} else if (wireType === 5) {
|
|
18054
|
-
if (offset + 4 > blob.length)
|
|
18055
|
-
return null;
|
|
18056
|
-
offset += 4;
|
|
18057
|
-
chunks.push(Buffer.from(blob.subarray(fieldStart, offset)));
|
|
18058
|
-
} else {
|
|
18059
|
-
return null;
|
|
18060
|
-
}
|
|
18061
|
-
}
|
|
18062
|
-
if (!wroteCascadeId) {
|
|
18063
|
-
chunks.push(encodeLengthDelimited(6, Buffer.from(cascadeId, "utf8")));
|
|
18064
|
-
}
|
|
18065
|
-
if (!hasProjectId) {
|
|
18066
|
-
chunks.push(encodeLengthDelimited(18, Buffer.from(DEFAULT_CLI_PROJECT_ID, "utf8")));
|
|
18067
|
-
}
|
|
18068
|
-
return Buffer.concat(chunks);
|
|
18069
|
-
}
|
|
18070
18378
|
async function pathExists(targetPath2) {
|
|
18071
18379
|
return access(targetPath2).then(() => true, (error51) => {
|
|
18072
18380
|
if (error51?.code === "ENOENT")
|
|
@@ -18139,7 +18447,7 @@ function upsertConversationSummaryRow(DatabaseSync, summariesDbPath, conversatio
|
|
|
18139
18447
|
\`parent_conversation_id\`, \`nesting_depth\`, \`battle_id\`, \`winning_conversation_id\`,
|
|
18140
18448
|
\`not_fully_idle\`, \`killed\`, \`last_user_input_time\`, \`last_user_input_step_index\`,
|
|
18141
18449
|
\`app_data_dir\`, \`raw_summary\`, \`group_id\`
|
|
18142
|
-
) VALUES (?, '', '', ?, ?, '[]', 'CASCADE_RUN_STATUS_IDLE', '', ?, '', '', 0, '', '', 0, 0, ?, -1, '', ?, '')`).run(conversationId, stepCount, now,
|
|
18450
|
+
) VALUES (?, '', '', ?, ?, '[]', 'CASCADE_RUN_STATUS_IDLE', '', ?, '', '', 0, '', '', 0, 0, ?, -1, '', ?, '')`).run(conversationId, stepCount, now, DEFAULT_CLI_PROJECT_ID2, now, rawSummary);
|
|
18143
18451
|
}
|
|
18144
18452
|
} finally {
|
|
18145
18453
|
sumDb.close();
|
|
@@ -18320,28 +18628,24 @@ async function cloneNativeConversationDb(sourceSessionId, derivedSessionId, reta
|
|
|
18320
18628
|
const sourceDb = nativeConversationDbPath(sourceSessionId, homedir2);
|
|
18321
18629
|
const targetDb = nativeConversationDbPath(derivedSessionId, homedir2);
|
|
18322
18630
|
const summariesDbPath = nativeConversationSummariesDbPath(homedir2);
|
|
18323
|
-
|
|
18324
|
-
|
|
18325
|
-
await mkdir2(path7.dirname(targetDb), { recursive: true });
|
|
18326
|
-
await copyFile(sourceDb, targetDb);
|
|
18327
|
-
copiedFromDisk = true;
|
|
18328
|
-
} catch {
|
|
18329
|
-
copiedFromDisk = false;
|
|
18330
|
-
}
|
|
18331
|
-
let DatabaseSync;
|
|
18332
|
-
try {
|
|
18333
|
-
({ DatabaseSync } = await import("node:sqlite"));
|
|
18334
|
-
} catch {
|
|
18335
|
-
return copiedFromDisk;
|
|
18336
|
-
}
|
|
18337
|
-
if (!copiedFromDisk) {
|
|
18631
|
+
const { DatabaseSync } = await import("node:sqlite");
|
|
18632
|
+
if (!await pathExists(sourceDb)) {
|
|
18338
18633
|
const sourceSummary = await pathExists(summariesDbPath) ? readConversationSummaryRow(DatabaseSync, summariesDbPath, sourceSessionId) : void 0;
|
|
18339
18634
|
const sourceBrainExists = await pathExists(nativeBrainDirPath(sourceSessionId, homedir2));
|
|
18340
18635
|
if (!UUID_PATTERN.test(sourceSessionId) && !sourceSummary && !sourceBrainExists) {
|
|
18341
18636
|
return false;
|
|
18342
18637
|
}
|
|
18343
|
-
|
|
18638
|
+
if (await pathExists(targetDb)) {
|
|
18639
|
+
throw new Error("Antigravity derived native conversation database already exists");
|
|
18640
|
+
}
|
|
18641
|
+
if (!await seedNativeConversationDb(derivedSessionId, homedir2, sourceSummary)) {
|
|
18642
|
+
await rm3(targetDb, { force: true });
|
|
18643
|
+
throw new Error("Antigravity could not seed the derived native conversation database");
|
|
18644
|
+
}
|
|
18645
|
+
return true;
|
|
18344
18646
|
}
|
|
18647
|
+
await mkdir2(path7.dirname(targetDb), { recursive: true });
|
|
18648
|
+
await copyFile(sourceDb, targetDb, constants.COPYFILE_EXCL);
|
|
18345
18649
|
let trajectoryId = randomUUID2();
|
|
18346
18650
|
let metadataBlob = minimalTrajectoryMetadataBlob(derivedSessionId);
|
|
18347
18651
|
let remainingStepCount = 0;
|
|
@@ -18349,64 +18653,49 @@ async function cloneNativeConversationDb(sourceSessionId, derivedSessionId, reta
|
|
|
18349
18653
|
const db = new DatabaseSync(targetDb);
|
|
18350
18654
|
try {
|
|
18351
18655
|
db.prepare("UPDATE trajectory_meta SET cascade_id = ?").run(derivedSessionId);
|
|
18352
|
-
|
|
18353
|
-
|
|
18354
|
-
|
|
18355
|
-
|
|
18356
|
-
|
|
18357
|
-
|
|
18358
|
-
|
|
18359
|
-
|
|
18360
|
-
|
|
18361
|
-
db.prepare("INSERT OR REPLACE INTO trajectory_metadata_blob (id, data) VALUES ('main', ?)").run(metadataBlob);
|
|
18362
|
-
} catch {
|
|
18363
|
-
}
|
|
18656
|
+
const metaRow = db.prepare("SELECT trajectory_id FROM trajectory_meta LIMIT 1").get();
|
|
18657
|
+
if (metaRow?.trajectory_id)
|
|
18658
|
+
trajectoryId = metaRow.trajectory_id;
|
|
18659
|
+
const blobRow = db.prepare("SELECT data FROM trajectory_metadata_blob WHERE id = 'main'").get();
|
|
18660
|
+
const rewritten = blobRow?.data?.length ? rewriteTrajectoryMetadataCascadeId(blobRow.data, derivedSessionId) : minimalTrajectoryMetadataBlob(derivedSessionId);
|
|
18661
|
+
if (!rewritten)
|
|
18662
|
+
throw new Error("Antigravity could not parse source trajectory metadata");
|
|
18663
|
+
metadataBlob = rewritten;
|
|
18664
|
+
db.prepare("INSERT OR REPLACE INTO trajectory_metadata_blob (id, data) VALUES ('main', ?)").run(metadataBlob);
|
|
18364
18665
|
if (retainedTurnsCount !== void 0) {
|
|
18365
|
-
|
|
18366
|
-
|
|
18367
|
-
|
|
18368
|
-
|
|
18369
|
-
|
|
18370
|
-
|
|
18371
|
-
|
|
18372
|
-
db.prepare("DELETE FROM steps WHERE idx >= ?").run(cutoff.idx);
|
|
18373
|
-
}
|
|
18374
|
-
}
|
|
18375
|
-
} catch {
|
|
18376
|
-
}
|
|
18377
|
-
try {
|
|
18378
|
-
db.prepare("DELETE FROM gen_metadata WHERE idx >= ?").run(retainedTurnsCount);
|
|
18379
|
-
} catch {
|
|
18380
|
-
}
|
|
18381
|
-
try {
|
|
18382
|
-
db.prepare("DELETE FROM executor_metadata WHERE idx >= ?").run(retainedTurnsCount);
|
|
18383
|
-
} catch {
|
|
18384
|
-
}
|
|
18385
|
-
try {
|
|
18386
|
-
db.prepare("DELETE FROM parent_references WHERE idx >= ?").run(retainedTurnsCount);
|
|
18387
|
-
} catch {
|
|
18666
|
+
if (retainedTurnsCount === 0) {
|
|
18667
|
+
db.prepare("DELETE FROM steps").run();
|
|
18668
|
+
} else {
|
|
18669
|
+
const rows = db.prepare("SELECT idx FROM steps WHERE step_type = 14 ORDER BY idx ASC").all();
|
|
18670
|
+
const cutoff = rows[retainedTurnsCount];
|
|
18671
|
+
if (cutoff)
|
|
18672
|
+
db.prepare("DELETE FROM steps WHERE idx >= ?").run(cutoff.idx);
|
|
18388
18673
|
}
|
|
18389
|
-
|
|
18390
|
-
|
|
18391
|
-
|
|
18674
|
+
for (const table of [
|
|
18675
|
+
"gen_metadata",
|
|
18676
|
+
"executor_metadata",
|
|
18677
|
+
"parent_references",
|
|
18678
|
+
"battle_mode_infos"
|
|
18679
|
+
]) {
|
|
18680
|
+
if (db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = ?").get(table)) {
|
|
18681
|
+
db.prepare(`DELETE FROM ${table} WHERE idx >= ?`).run(retainedTurnsCount);
|
|
18682
|
+
}
|
|
18392
18683
|
}
|
|
18393
18684
|
}
|
|
18394
|
-
|
|
18395
|
-
|
|
18396
|
-
|
|
18397
|
-
remainingStepCount = countRow.c;
|
|
18398
|
-
} catch {
|
|
18399
|
-
}
|
|
18685
|
+
const countRow = db.prepare("SELECT count(*) as c FROM steps").get();
|
|
18686
|
+
if (countRow)
|
|
18687
|
+
remainingStepCount = countRow.c;
|
|
18400
18688
|
} finally {
|
|
18401
18689
|
db.close();
|
|
18402
18690
|
}
|
|
18403
|
-
|
|
18404
|
-
|
|
18405
|
-
|
|
18406
|
-
|
|
18407
|
-
|
|
18408
|
-
|
|
18409
|
-
|
|
18691
|
+
if (await pathExists(summariesDbPath)) {
|
|
18692
|
+
const sourceRow = readConversationSummaryRow(DatabaseSync, summariesDbPath, sourceSessionId);
|
|
18693
|
+
const effectiveStepCount = retainedTurnsCount !== void 0 ? remainingStepCount : typeof sourceRow?.step_count === "number" ? sourceRow.step_count : remainingStepCount;
|
|
18694
|
+
upsertConversationSummaryRow(DatabaseSync, summariesDbPath, derivedSessionId, trajectoryId, metadataBlob, effectiveStepCount, sourceRow);
|
|
18695
|
+
}
|
|
18696
|
+
} catch (error51) {
|
|
18697
|
+
await rm3(targetDb, { force: true });
|
|
18698
|
+
throw error51;
|
|
18410
18699
|
}
|
|
18411
18700
|
return true;
|
|
18412
18701
|
}
|
|
@@ -18509,6 +18798,19 @@ async function forkAntigravitySession(options) {
|
|
|
18509
18798
|
const model2 = sourceSession?.model ?? sourceHistory.model;
|
|
18510
18799
|
const thinkingOptionId = sourceSession?.thinkingOptionId ?? sourceHistory.thinkingOptionId;
|
|
18511
18800
|
const permissionMode = sourceSession?.permissionMode ?? "dangerously-skip-permissions";
|
|
18801
|
+
try {
|
|
18802
|
+
await copyNativeConversationDbIfExists(sourceRef.nativeSessionId, derivedNativeSessionId, retainedTurns.length, homedir2);
|
|
18803
|
+
} catch (error51) {
|
|
18804
|
+
return {
|
|
18805
|
+
ok: false,
|
|
18806
|
+
error: {
|
|
18807
|
+
code: "nativeFailure",
|
|
18808
|
+
message: error51 instanceof Error ? error51.message : String(error51),
|
|
18809
|
+
retryable: false
|
|
18810
|
+
}
|
|
18811
|
+
};
|
|
18812
|
+
}
|
|
18813
|
+
await copyNativeBrainDirIfExists(sourceRef.nativeSessionId, derivedNativeSessionId, homedir2);
|
|
18512
18814
|
const forkedHistory = await AntigravityHistory.createDerived({
|
|
18513
18815
|
environment: sessionEnvironment,
|
|
18514
18816
|
nativeSessionId: derivedNativeSessionId,
|
|
@@ -18516,10 +18818,6 @@ async function forkAntigravitySession(options) {
|
|
|
18516
18818
|
...model2 ? { model: model2 } : {},
|
|
18517
18819
|
...thinkingOptionId ? { thinkingOptionId } : {}
|
|
18518
18820
|
});
|
|
18519
|
-
await Promise.all([
|
|
18520
|
-
copyNativeConversationDbIfExists(sourceRef.nativeSessionId, derivedNativeSessionId, retainedTurns.length, homedir2),
|
|
18521
|
-
copyNativeBrainDirIfExists(sourceRef.nativeSessionId, derivedNativeSessionId, homedir2)
|
|
18522
|
-
]);
|
|
18523
18821
|
const derivedNativeRef = {
|
|
18524
18822
|
harnessId,
|
|
18525
18823
|
nativeSessionId: derivedNativeSessionId,
|
|
@@ -18659,6 +18957,109 @@ function decodeAntigravityPermissionModeId(value) {
|
|
|
18659
18957
|
return "dangerously-skip-permissions";
|
|
18660
18958
|
}
|
|
18661
18959
|
|
|
18960
|
+
// dist/recovered-native-error.js
|
|
18961
|
+
var USER_INPUT_STEP = 14;
|
|
18962
|
+
var PLANNER_RESPONSE_STEP = 15;
|
|
18963
|
+
var ERROR_MESSAGE_STEP = 17;
|
|
18964
|
+
var DONE_STATUS = 3;
|
|
18965
|
+
var UNSETTLED_STATUSES = /* @__PURE__ */ new Set([0, 1, 2, 8, 9, 11]);
|
|
18966
|
+
var RETRIED_REQUEST_ERROR = /^API error \(attempt \d+\):/;
|
|
18967
|
+
var SETTLE_ATTEMPTS = 3;
|
|
18968
|
+
var SETTLE_DELAY_MS = 150;
|
|
18969
|
+
async function nativeTurnRecoveredFromError(query) {
|
|
18970
|
+
const error51 = query.error.trim();
|
|
18971
|
+
if (!query.conversationId || !error51)
|
|
18972
|
+
return false;
|
|
18973
|
+
let DatabaseSync;
|
|
18974
|
+
try {
|
|
18975
|
+
({ DatabaseSync } = await import("node:sqlite"));
|
|
18976
|
+
} catch {
|
|
18977
|
+
return false;
|
|
18978
|
+
}
|
|
18979
|
+
const dbPath = nativeConversationDbPath(query.conversationId, query.homedir);
|
|
18980
|
+
const errorBytes = Buffer.from(error51, "utf8");
|
|
18981
|
+
for (let attempt = 1; ; attempt += 1) {
|
|
18982
|
+
let verdict;
|
|
18983
|
+
try {
|
|
18984
|
+
verdict = readVerdict(DatabaseSync, dbPath, errorBytes);
|
|
18985
|
+
} catch {
|
|
18986
|
+
return false;
|
|
18987
|
+
}
|
|
18988
|
+
if (verdict !== "unsettled")
|
|
18989
|
+
return verdict === "recovered";
|
|
18990
|
+
if (attempt >= SETTLE_ATTEMPTS)
|
|
18991
|
+
return false;
|
|
18992
|
+
await new Promise((resolve) => setTimeout(resolve, SETTLE_DELAY_MS));
|
|
18993
|
+
}
|
|
18994
|
+
}
|
|
18995
|
+
function readVerdict(DatabaseSync, dbPath, errorBytes) {
|
|
18996
|
+
const db = new DatabaseSync(dbPath, { readOnly: true });
|
|
18997
|
+
try {
|
|
18998
|
+
const turnStart = db.prepare("SELECT MAX(idx) AS idx FROM steps WHERE step_type = ?").get(USER_INPUT_STEP);
|
|
18999
|
+
if (turnStart?.idx === null || turnStart?.idx === void 0)
|
|
19000
|
+
return "notRecovered";
|
|
19001
|
+
const steps = db.prepare(`SELECT idx, step_type, status,
|
|
19002
|
+
(instr(COALESCE(step_payload, X''), ?) > 0
|
|
19003
|
+
OR instr(COALESCE(error_details, X''), ?) > 0) AS has_error
|
|
19004
|
+
FROM steps WHERE idx > ? ORDER BY idx ASC`).all(errorBytes, errorBytes, turnStart.idx);
|
|
19005
|
+
if (steps.some((step) => step.has_error)) {
|
|
19006
|
+
return verdictForTurn(steps, RETRIED_REQUEST_ERROR.test(new TextDecoder().decode(errorBytes)));
|
|
19007
|
+
}
|
|
19008
|
+
const earlier = db.prepare(`SELECT 1 AS found FROM steps
|
|
19009
|
+
WHERE idx < ?
|
|
19010
|
+
AND (instr(COALESCE(step_payload, X''), ?) > 0
|
|
19011
|
+
OR instr(COALESCE(error_details, X''), ?) > 0)
|
|
19012
|
+
LIMIT 1`).get(turnStart.idx, errorBytes, errorBytes);
|
|
19013
|
+
if (!earlier)
|
|
19014
|
+
return "notRecovered";
|
|
19015
|
+
return verdictForFinishedTurn(steps);
|
|
19016
|
+
} finally {
|
|
19017
|
+
db.close();
|
|
19018
|
+
}
|
|
19019
|
+
}
|
|
19020
|
+
function verdictForTurn(steps, retriedRequest) {
|
|
19021
|
+
let errorAt = -1;
|
|
19022
|
+
for (let index = steps.length - 1; index >= 0; index -= 1) {
|
|
19023
|
+
if (steps[index]?.has_error) {
|
|
19024
|
+
errorAt = index;
|
|
19025
|
+
break;
|
|
19026
|
+
}
|
|
19027
|
+
}
|
|
19028
|
+
if (errorAt < 0)
|
|
19029
|
+
return "notRecovered";
|
|
19030
|
+
const after = steps.slice(errorAt + 1);
|
|
19031
|
+
const verdict = verdictForFinishedTurn(after);
|
|
19032
|
+
if (verdict !== "notRecovered" || !retriedRequest)
|
|
19033
|
+
return verdict;
|
|
19034
|
+
return retriedRequestRecovered(after) ? "recovered" : "notRecovered";
|
|
19035
|
+
}
|
|
19036
|
+
function settled(step) {
|
|
19037
|
+
return !UNSETTLED_STATUSES.has(step.status);
|
|
19038
|
+
}
|
|
19039
|
+
function completedPlannerResponse(step) {
|
|
19040
|
+
return step.step_type === PLANNER_RESPONSE_STEP && step.status === DONE_STATUS;
|
|
19041
|
+
}
|
|
19042
|
+
function verdictForFinishedTurn(steps) {
|
|
19043
|
+
const last = steps.at(-1);
|
|
19044
|
+
if (!last)
|
|
19045
|
+
return "notRecovered";
|
|
19046
|
+
if (!steps.every(settled))
|
|
19047
|
+
return "unsettled";
|
|
19048
|
+
return completedPlannerResponse(last) ? "recovered" : "notRecovered";
|
|
19049
|
+
}
|
|
19050
|
+
function retriedRequestRecovered(steps) {
|
|
19051
|
+
if (!steps.every(settled))
|
|
19052
|
+
return false;
|
|
19053
|
+
let lastReply = -1;
|
|
19054
|
+
steps.forEach((step, index) => {
|
|
19055
|
+
if (completedPlannerResponse(step))
|
|
19056
|
+
lastReply = index;
|
|
19057
|
+
});
|
|
19058
|
+
if (lastReply < 0)
|
|
19059
|
+
return false;
|
|
19060
|
+
return !steps.slice(lastReply + 1).some((step) => step.step_type === ERROR_MESSAGE_STEP || step.step_type === PLANNER_RESPONSE_STEP && step.status !== DONE_STATUS);
|
|
19061
|
+
}
|
|
19062
|
+
|
|
18662
19063
|
// dist/rollback.js
|
|
18663
19064
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
18664
19065
|
async function rollbackAntigravityLastTurn(options) {
|
|
@@ -18733,6 +19134,19 @@ async function rollbackAntigravityLastTurn(options) {
|
|
|
18733
19134
|
const model2 = sourceSession?.model ?? sourceHistory.model;
|
|
18734
19135
|
const thinkingOptionId = sourceSession?.thinkingOptionId ?? sourceHistory.thinkingOptionId;
|
|
18735
19136
|
const permissionMode = sourceSession?.permissionMode ?? "dangerously-skip-permissions";
|
|
19137
|
+
try {
|
|
19138
|
+
await copyNativeConversationDbIfExists(sourceRef.nativeSessionId, derivedNativeSessionId, mappedTurns.length, homedir2);
|
|
19139
|
+
} catch (error51) {
|
|
19140
|
+
return {
|
|
19141
|
+
ok: false,
|
|
19142
|
+
error: {
|
|
19143
|
+
code: "nativeFailure",
|
|
19144
|
+
message: error51 instanceof Error ? error51.message : String(error51),
|
|
19145
|
+
retryable: false
|
|
19146
|
+
}
|
|
19147
|
+
};
|
|
19148
|
+
}
|
|
19149
|
+
await copyNativeBrainDirIfExists(sourceRef.nativeSessionId, derivedNativeSessionId, homedir2);
|
|
18736
19150
|
const rolledBackHistory = await AntigravityHistory.createDerived({
|
|
18737
19151
|
environment: sessionEnvironment,
|
|
18738
19152
|
nativeSessionId: derivedNativeSessionId,
|
|
@@ -18740,10 +19154,6 @@ async function rollbackAntigravityLastTurn(options) {
|
|
|
18740
19154
|
...model2 ? { model: model2 } : {},
|
|
18741
19155
|
...thinkingOptionId ? { thinkingOptionId } : {}
|
|
18742
19156
|
});
|
|
18743
|
-
await Promise.all([
|
|
18744
|
-
copyNativeConversationDbIfExists(sourceRef.nativeSessionId, derivedNativeSessionId, mappedTurns.length, homedir2),
|
|
18745
|
-
copyNativeBrainDirIfExists(sourceRef.nativeSessionId, derivedNativeSessionId, homedir2)
|
|
18746
|
-
]);
|
|
18747
19157
|
const derivedNativeRef = {
|
|
18748
19158
|
harnessId,
|
|
18749
19159
|
nativeSessionId: derivedNativeSessionId,
|
|
@@ -19111,6 +19521,7 @@ function completeAntigravityToolItem(item, step, toolOutputLimit, cwd) {
|
|
|
19111
19521
|
|
|
19112
19522
|
// dist/code-action-diff.js
|
|
19113
19523
|
var DIFF_CONTEXT_LINES = 3;
|
|
19524
|
+
var TRAJECTORY_PAGE_SIZE = 256;
|
|
19114
19525
|
function isRecord2(value) {
|
|
19115
19526
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
19116
19527
|
}
|
|
@@ -19290,6 +19701,75 @@ function requestAntigravityTrajectorySteps(port, conversationId, timeoutMs) {
|
|
|
19290
19701
|
request.end(JSON.stringify({ cascadeId: conversationId }));
|
|
19291
19702
|
});
|
|
19292
19703
|
}
|
|
19704
|
+
function plannerStepThinking(step) {
|
|
19705
|
+
if (!isRecord2(step) || step.type !== "CORTEX_STEP_TYPE_PLANNER_RESPONSE")
|
|
19706
|
+
return null;
|
|
19707
|
+
const plannerResponse = isRecord2(step.plannerResponse) ? step.plannerResponse : null;
|
|
19708
|
+
if (!plannerResponse)
|
|
19709
|
+
return null;
|
|
19710
|
+
for (const candidate of [
|
|
19711
|
+
plannerResponse.thinking,
|
|
19712
|
+
plannerResponse.rawThinking,
|
|
19713
|
+
plannerResponse.raw_thinking
|
|
19714
|
+
]) {
|
|
19715
|
+
if (typeof candidate === "string" && candidate.trim().length > 0)
|
|
19716
|
+
return candidate;
|
|
19717
|
+
}
|
|
19718
|
+
return null;
|
|
19719
|
+
}
|
|
19720
|
+
function parseAntigravityStepThinking(value, stepIndex, stepOffset = 0) {
|
|
19721
|
+
if (!isRecord2(value) || !Array.isArray(value.steps))
|
|
19722
|
+
return null;
|
|
19723
|
+
const relativeIndex = stepIndex - stepOffset;
|
|
19724
|
+
if (relativeIndex >= 0 && relativeIndex < value.steps.length) {
|
|
19725
|
+
const direct = plannerStepThinking(value.steps[relativeIndex]);
|
|
19726
|
+
if (direct !== null)
|
|
19727
|
+
return direct;
|
|
19728
|
+
}
|
|
19729
|
+
for (const step of value.steps) {
|
|
19730
|
+
if (isRecord2(step) && step.stepIndex === stepIndex) {
|
|
19731
|
+
const matched = plannerStepThinking(step);
|
|
19732
|
+
if (matched !== null)
|
|
19733
|
+
return matched;
|
|
19734
|
+
}
|
|
19735
|
+
}
|
|
19736
|
+
return null;
|
|
19737
|
+
}
|
|
19738
|
+
function requestAntigravityStepThinking(port, conversationId, stepIndex, timeoutMs) {
|
|
19739
|
+
const stepOffset = stepIndex >= TRAJECTORY_PAGE_SIZE ? stepIndex : 0;
|
|
19740
|
+
return new Promise((resolve) => {
|
|
19741
|
+
const request = https.request({
|
|
19742
|
+
hostname: "127.0.0.1",
|
|
19743
|
+
port,
|
|
19744
|
+
path: "/exa.language_server_pb.LanguageServerService/GetCascadeTrajectorySteps",
|
|
19745
|
+
method: "POST",
|
|
19746
|
+
rejectUnauthorized: false,
|
|
19747
|
+
timeout: timeoutMs,
|
|
19748
|
+
headers: { "content-type": "application/json" }
|
|
19749
|
+
}, (response) => {
|
|
19750
|
+
let body = "";
|
|
19751
|
+
response.setEncoding("utf8");
|
|
19752
|
+
response.on("data", (chunk) => {
|
|
19753
|
+
body += chunk;
|
|
19754
|
+
});
|
|
19755
|
+
response.on("end", () => {
|
|
19756
|
+
if (response.statusCode !== 200)
|
|
19757
|
+
return resolve(null);
|
|
19758
|
+
try {
|
|
19759
|
+
resolve(parseAntigravityStepThinking(JSON.parse(body), stepIndex, stepOffset));
|
|
19760
|
+
} catch {
|
|
19761
|
+
resolve(null);
|
|
19762
|
+
}
|
|
19763
|
+
});
|
|
19764
|
+
});
|
|
19765
|
+
request.on("timeout", () => request.destroy());
|
|
19766
|
+
request.on("error", () => resolve(null));
|
|
19767
|
+
request.end(JSON.stringify({
|
|
19768
|
+
cascadeId: conversationId,
|
|
19769
|
+
...stepOffset > 0 ? { stepOffset } : {}
|
|
19770
|
+
}));
|
|
19771
|
+
});
|
|
19772
|
+
}
|
|
19293
19773
|
|
|
19294
19774
|
// dist/stream-events.js
|
|
19295
19775
|
function isRecord3(value) {
|
|
@@ -19450,7 +19930,7 @@ async function fetchAntigravityQuota(run, now = /* @__PURE__ */ new Date()) {
|
|
|
19450
19930
|
|
|
19451
19931
|
// dist/question-bridge.js
|
|
19452
19932
|
import { randomBytes, randomUUID as randomUUID4, timingSafeEqual } from "node:crypto";
|
|
19453
|
-
import { mkdir as mkdir3, mkdtemp as mkdtemp2, rm as
|
|
19933
|
+
import { mkdir as mkdir3, mkdtemp as mkdtemp2, rm as rm4, writeFile as writeFile3 } from "node:fs/promises";
|
|
19454
19934
|
import { createServer } from "node:http";
|
|
19455
19935
|
import os5 from "node:os";
|
|
19456
19936
|
import path9 from "node:path";
|
|
@@ -19824,7 +20304,7 @@ var AntigravityQuestionBridge = class _AntigravityQuestionBridge {
|
|
|
19824
20304
|
this.#server.closeAllConnections();
|
|
19825
20305
|
});
|
|
19826
20306
|
if (this.#options.directory === void 0) {
|
|
19827
|
-
await
|
|
20307
|
+
await rm4(this.directory, { recursive: true, force: true, maxRetries: 5, retryDelay: 50 });
|
|
19828
20308
|
}
|
|
19829
20309
|
})();
|
|
19830
20310
|
return this.#disposal;
|
|
@@ -19846,6 +20326,7 @@ var transcriptStepSchema = external_exports.object({
|
|
|
19846
20326
|
type: external_exports.string(),
|
|
19847
20327
|
status: external_exports.string(),
|
|
19848
20328
|
content: external_exports.string().optional(),
|
|
20329
|
+
thinking: external_exports.string().optional(),
|
|
19849
20330
|
tool_calls: external_exports.array(external_exports.object({ name: external_exports.string(), args: external_exports.unknown().optional() })).optional()
|
|
19850
20331
|
});
|
|
19851
20332
|
async function subagentRpc(port, conversationId, method) {
|
|
@@ -19965,6 +20446,16 @@ function parseSubagentTranscript(text, parentId, childId, status, cwd, outputLim
|
|
|
19965
20446
|
}
|
|
19966
20447
|
} : { status: "succeeded" };
|
|
19967
20448
|
if (step.type === "PLANNER_RESPONSE") {
|
|
20449
|
+
if (step.thinking?.trim()) {
|
|
20450
|
+
current.items.push({
|
|
20451
|
+
item: {
|
|
20452
|
+
type: "reasoning",
|
|
20453
|
+
itemId: hostItemIdSchema.parse(`${itemId}-thinking`),
|
|
20454
|
+
text: step.thinking.slice(0, outputLimit)
|
|
20455
|
+
},
|
|
20456
|
+
outcome
|
|
20457
|
+
});
|
|
20458
|
+
}
|
|
19968
20459
|
if (step.content) {
|
|
19969
20460
|
current.items.push({
|
|
19970
20461
|
item: { type: "agentMessage", itemId, text: step.content.slice(0, outputLimit) },
|
|
@@ -20039,6 +20530,40 @@ async function readSubagentTranscript(input) {
|
|
|
20039
20530
|
};
|
|
20040
20531
|
}
|
|
20041
20532
|
}
|
|
20533
|
+
async function readTranscriptStepThinking(conversationId, stepIndex, outputLimit, home) {
|
|
20534
|
+
if (!conversationId || /[/\\]|^\.\.?$/u.test(conversationId))
|
|
20535
|
+
return null;
|
|
20536
|
+
const logsDir = path10.join(nativeBrainDirPath(conversationId, home), ".system_generated", "logs");
|
|
20537
|
+
for (const filename of ["transcript_full.jsonl", "transcript.jsonl"]) {
|
|
20538
|
+
try {
|
|
20539
|
+
const handle = await open(path10.join(logsDir, filename), "r");
|
|
20540
|
+
let text;
|
|
20541
|
+
try {
|
|
20542
|
+
const size = (await handle.stat()).size;
|
|
20543
|
+
if (size === 0 || size > MAX_TRANSCRIPT_BYTES)
|
|
20544
|
+
continue;
|
|
20545
|
+
const buffer = Buffer.alloc(size);
|
|
20546
|
+
const { bytesRead } = await handle.read(buffer, 0, size, 0);
|
|
20547
|
+
text = buffer.subarray(0, bytesRead).toString("utf8");
|
|
20548
|
+
} finally {
|
|
20549
|
+
await handle.close();
|
|
20550
|
+
}
|
|
20551
|
+
for (const line of text.split("\n")) {
|
|
20552
|
+
if (!line.trim())
|
|
20553
|
+
continue;
|
|
20554
|
+
try {
|
|
20555
|
+
const parsed = JSON.parse(line);
|
|
20556
|
+
if (isRecord3(parsed) && parsed.step_index === stepIndex && parsed.type === "PLANNER_RESPONSE" && typeof parsed.thinking === "string" && parsed.thinking.trim().length > 0) {
|
|
20557
|
+
return parsed.thinking.slice(0, outputLimit);
|
|
20558
|
+
}
|
|
20559
|
+
} catch {
|
|
20560
|
+
}
|
|
20561
|
+
}
|
|
20562
|
+
} catch {
|
|
20563
|
+
}
|
|
20564
|
+
}
|
|
20565
|
+
return null;
|
|
20566
|
+
}
|
|
20042
20567
|
|
|
20043
20568
|
// dist/subagents.js
|
|
20044
20569
|
var infoSchema = external_exports.object({
|
|
@@ -20046,6 +20571,10 @@ var infoSchema = external_exports.object({
|
|
|
20046
20571
|
conversation_id: nativeSubagentIdSchema,
|
|
20047
20572
|
type_name: external_exports.string().max(256).optional(),
|
|
20048
20573
|
role: external_exports.string().max(2048).optional(),
|
|
20574
|
+
model: external_exports.string().max(512).optional().catch(void 0),
|
|
20575
|
+
reasoningEffort: external_exports.string().max(128).optional().catch(void 0),
|
|
20576
|
+
reasoning_effort: external_exports.string().max(128).optional().catch(void 0),
|
|
20577
|
+
thinking: external_exports.string().max(128).optional().catch(void 0),
|
|
20049
20578
|
initial_prompt: external_exports.string().max(128e3).optional()
|
|
20050
20579
|
})).max(32)
|
|
20051
20580
|
});
|
|
@@ -20101,14 +20630,15 @@ var AntigravitySubagents = class {
|
|
|
20101
20630
|
return true;
|
|
20102
20631
|
}
|
|
20103
20632
|
const subagents = parsed.data.subagents.map((child) => {
|
|
20104
|
-
const state = {
|
|
20633
|
+
const state = inheritSubagentConfiguration({
|
|
20105
20634
|
subagentId: child.conversation_id,
|
|
20106
20635
|
nativeSubagentId: child.conversation_id,
|
|
20107
20636
|
description: child.role || child.type_name || "Antigravity Subagent",
|
|
20108
20637
|
...child.type_name ? { role: child.type_name } : {},
|
|
20638
|
+
...subagentConfiguration(child),
|
|
20109
20639
|
background: true,
|
|
20110
20640
|
status: "running"
|
|
20111
|
-
};
|
|
20641
|
+
}, this.#options.parentConfiguration ?? {});
|
|
20112
20642
|
this.#states.set(child.conversation_id, state);
|
|
20113
20643
|
return state;
|
|
20114
20644
|
});
|
|
@@ -20732,7 +21262,19 @@ var AntigravitySession = class {
|
|
|
20732
21262
|
return historySubagentState(this.#history, id);
|
|
20733
21263
|
}
|
|
20734
21264
|
initialState;
|
|
21265
|
+
#subagentConfiguration() {
|
|
21266
|
+
const state = this.#state();
|
|
21267
|
+
const model2 = state.effectiveModel ? state.effectiveModel.id : void 0;
|
|
21268
|
+
return {
|
|
21269
|
+
...model2 ? { model: model2 } : {},
|
|
21270
|
+
...state.effectiveThinkingOptionId ? { reasoningEffort: state.effectiveThinkingOptionId } : {}
|
|
21271
|
+
};
|
|
21272
|
+
}
|
|
20735
21273
|
async readSnapshot() {
|
|
21274
|
+
const result = await this.#readSnapshot();
|
|
21275
|
+
return result.ok ? { ok: true, value: configureSubagentSnapshot(result.value, this.#subagentConfiguration()) } : result;
|
|
21276
|
+
}
|
|
21277
|
+
async #readSnapshot() {
|
|
20736
21278
|
if (this.#closed)
|
|
20737
21279
|
return { ok: false, error: invalidState("Antigravity Session is closed") };
|
|
20738
21280
|
return { ok: true, value: { turns: this.#history.snapshot(), state: this.#state() } };
|
|
@@ -20869,6 +21411,10 @@ var AntigravitySession = class {
|
|
|
20869
21411
|
questions,
|
|
20870
21412
|
subagents: new AntigravitySubagents({
|
|
20871
21413
|
turnId: command.turnId,
|
|
21414
|
+
parentConfiguration: {
|
|
21415
|
+
...this.#model ? { model: this.#model.id } : {},
|
|
21416
|
+
...this.#thinkingOptionId ? { reasoningEffort: this.#thinkingOptionId } : {}
|
|
21417
|
+
},
|
|
20872
21418
|
parentId: () => this.#nativeRef?.nativeSessionId,
|
|
20873
21419
|
port: () => this.#languageServerPort(active),
|
|
20874
21420
|
cwd: this.#cwd,
|
|
@@ -20904,6 +21450,9 @@ var AntigravitySession = class {
|
|
|
20904
21450
|
codeActionCursor: 0,
|
|
20905
21451
|
fileChanges: /* @__PURE__ */ new Map(),
|
|
20906
21452
|
pendingSteps: /* @__PURE__ */ new Map(),
|
|
21453
|
+
thinkingSteps: /* @__PURE__ */ new Set(),
|
|
21454
|
+
checkedActiveThinkingSteps: /* @__PURE__ */ new Set(),
|
|
21455
|
+
pendingAgentText: /* @__PURE__ */ new Map(),
|
|
20907
21456
|
httpsPort: null
|
|
20908
21457
|
};
|
|
20909
21458
|
this.#active = active;
|
|
@@ -21126,7 +21675,14 @@ ${line}`).slice(-8e3);
|
|
|
21126
21675
|
if (!timedOut && finishedReason !== "interrupted" && repliedThisTurn && event.result.error?.trim() && this.#reportedEarlier(error51)) {
|
|
21127
21676
|
this.#completeTurn(active, { status: "succeeded", checkpoint }, nativeTurnRef);
|
|
21128
21677
|
} else {
|
|
21129
|
-
|
|
21678
|
+
const recovered = !timedOut && finishedReason !== "interrupted" && repliedThisTurn && event.result.error?.trim() && await nativeTurnRecoveredFromError({
|
|
21679
|
+
conversationId: convId,
|
|
21680
|
+
error: event.result.error,
|
|
21681
|
+
homedir: antigravityHome(this.#environment)
|
|
21682
|
+
});
|
|
21683
|
+
if (this.#active !== active)
|
|
21684
|
+
return;
|
|
21685
|
+
this.#completeTurn(active, active.cancellationRequested ? { status: "cancelled", reason: "Cancelled by user", checkpoint } : recovered ? { status: "succeeded", checkpoint } : { status: "failed", error: error51, checkpoint }, nativeTurnRef);
|
|
21130
21686
|
}
|
|
21131
21687
|
}
|
|
21132
21688
|
}
|
|
@@ -21194,14 +21750,13 @@ ${line}`).slice(-8e3);
|
|
|
21194
21750
|
step = { ...step, step_type: "tool" };
|
|
21195
21751
|
}
|
|
21196
21752
|
if (step.step_type === "agent_response") {
|
|
21197
|
-
|
|
21198
|
-
|
|
21199
|
-
|
|
21200
|
-
|
|
21201
|
-
|
|
21202
|
-
if (
|
|
21203
|
-
this.#
|
|
21204
|
-
return;
|
|
21753
|
+
await this.#maybeProjectStepThinking(active, step);
|
|
21754
|
+
const isDelta = typeof step.text_delta === "string" && step.text_delta.length > 0;
|
|
21755
|
+
const text = isDelta ? step.text_delta : step.text ?? (typeof step.content === "string" ? step.content : void 0) ?? (typeof step.message === "string" ? step.message : void 0);
|
|
21756
|
+
if (typeof text === "string" && text.length > 0) {
|
|
21757
|
+
this.#emitOrBufferAgentResponseText(active, step.step_index, text, isDelta);
|
|
21758
|
+
} else if (active.thinkingSteps.has(step.step_index)) {
|
|
21759
|
+
this.#flushPendingAgentText(active, step.step_index);
|
|
21205
21760
|
}
|
|
21206
21761
|
return;
|
|
21207
21762
|
}
|
|
@@ -21211,6 +21766,7 @@ ${line}`).slice(-8e3);
|
|
|
21211
21766
|
}
|
|
21212
21767
|
if (step.step_type !== "tool")
|
|
21213
21768
|
return;
|
|
21769
|
+
this.#flushAllPendingAgentText(active);
|
|
21214
21770
|
if (active.agentItem) {
|
|
21215
21771
|
this.#completeItem(active, active.agentItem, { status: "succeeded" });
|
|
21216
21772
|
active.agentItem = null;
|
|
@@ -21330,6 +21886,87 @@ ${line}`).slice(-8e3);
|
|
|
21330
21886
|
active.httpsPort = port;
|
|
21331
21887
|
return port;
|
|
21332
21888
|
}
|
|
21889
|
+
/**
|
|
21890
|
+
* `agy --output-format stream-json` strips `<thought>` blocks from step text
|
|
21891
|
+
* and omits `thinking` from `step_update`, reporting only `usage.thinking_tokens`
|
|
21892
|
+
* when a planner step finishes. Resolve the step's thinking from inline fields,
|
|
21893
|
+
* the Language Server trajectory, or the native brain transcript before
|
|
21894
|
+
* projecting the step's visible response or subsequent tool calls. Reply text
|
|
21895
|
+
* for the same step is buffered until this returns with the step recorded in
|
|
21896
|
+
* `thinkingSteps`, so a late-fetched reasoning Item is not outranked by the
|
|
21897
|
+
* streamed answer.
|
|
21898
|
+
*/
|
|
21899
|
+
async #maybeProjectStepThinking(active, step) {
|
|
21900
|
+
if (active.thinkingSteps.has(step.step_index))
|
|
21901
|
+
return;
|
|
21902
|
+
const isTerminal = step.state === "DONE" || step.state === "ERROR";
|
|
21903
|
+
if (!isTerminal && active.checkedActiveThinkingSteps.has(step.step_index))
|
|
21904
|
+
return;
|
|
21905
|
+
if (!isTerminal)
|
|
21906
|
+
active.checkedActiveThinkingSteps.add(step.step_index);
|
|
21907
|
+
const inlineThinking = typeof step.thinking_delta === "string" && step.thinking_delta.trim().length > 0 ? step.thinking_delta : typeof step.thinking === "string" && step.thinking.trim().length > 0 ? step.thinking : null;
|
|
21908
|
+
let thinking = inlineThinking;
|
|
21909
|
+
if (thinking === null) {
|
|
21910
|
+
const thinkingTokens = safeToken(step.usage?.thinking_tokens);
|
|
21911
|
+
if (!isTerminal || thinkingTokens === void 0 || thinkingTokens > 0) {
|
|
21912
|
+
const port = await this.#languageServerPort(active);
|
|
21913
|
+
if (port !== null) {
|
|
21914
|
+
thinking = await requestAntigravityStepThinking(port, step.conversation_id, step.step_index, TRAJECTORY_TIMEOUT_MS);
|
|
21915
|
+
}
|
|
21916
|
+
if (thinking === null) {
|
|
21917
|
+
const home = (process.platform === "win32" ? this.#environment.USERPROFILE : this.#environment.HOME) || void 0;
|
|
21918
|
+
thinking = await readTranscriptStepThinking(step.conversation_id, step.step_index, this.#toolOutputLimit, home);
|
|
21919
|
+
}
|
|
21920
|
+
}
|
|
21921
|
+
}
|
|
21922
|
+
if (isTerminal)
|
|
21923
|
+
active.thinkingSteps.add(step.step_index);
|
|
21924
|
+
if (thinking === null || thinking.trim().length === 0) {
|
|
21925
|
+
if (!isTerminal && !this.#thinkingOptionId)
|
|
21926
|
+
active.thinkingSteps.add(step.step_index);
|
|
21927
|
+
return;
|
|
21928
|
+
}
|
|
21929
|
+
active.thinkingSteps.add(step.step_index);
|
|
21930
|
+
if (active.agentItem) {
|
|
21931
|
+
this.#completeItem(active, active.agentItem, { status: "succeeded" });
|
|
21932
|
+
active.agentItem = null;
|
|
21933
|
+
active.agentText = "";
|
|
21934
|
+
}
|
|
21935
|
+
const item = {
|
|
21936
|
+
type: "reasoning",
|
|
21937
|
+
itemId: this.#newItemId(),
|
|
21938
|
+
text: thinking.slice(0, this.#toolOutputLimit)
|
|
21939
|
+
};
|
|
21940
|
+
this.#event({ type: "item.started", turnId: active.command.turnId, item });
|
|
21941
|
+
this.#completeItem(active, item, { status: "succeeded" });
|
|
21942
|
+
}
|
|
21943
|
+
/**
|
|
21944
|
+
* Emit agent_response text only after that step's thinking is resolved when
|
|
21945
|
+
* a late reasoning Item is still possible. Otherwise buffer so the streamed
|
|
21946
|
+
* answer cannot outrank thinking that only becomes available at DONE.
|
|
21947
|
+
*/
|
|
21948
|
+
#emitOrBufferAgentResponseText(active, stepIndex, text, isDelta) {
|
|
21949
|
+
if (active.thinkingSteps.has(stepIndex) || !this.#thinkingOptionId) {
|
|
21950
|
+
this.#flushPendingAgentText(active, stepIndex);
|
|
21951
|
+
this.#appendOrSyncAgentText(active, text, isDelta);
|
|
21952
|
+
return;
|
|
21953
|
+
}
|
|
21954
|
+
const previous = active.pendingAgentText.get(stepIndex) ?? "";
|
|
21955
|
+
active.pendingAgentText.set(stepIndex, isDelta ? previous + text : text);
|
|
21956
|
+
}
|
|
21957
|
+
#flushPendingAgentText(active, stepIndex) {
|
|
21958
|
+
const pending = active.pendingAgentText.get(stepIndex);
|
|
21959
|
+
if (pending === void 0)
|
|
21960
|
+
return;
|
|
21961
|
+
active.pendingAgentText.delete(stepIndex);
|
|
21962
|
+
if (pending.length > 0)
|
|
21963
|
+
this.#appendOrSyncAgentText(active, pending, true);
|
|
21964
|
+
}
|
|
21965
|
+
#flushAllPendingAgentText(active) {
|
|
21966
|
+
for (const stepIndex of [...active.pendingAgentText.keys()].sort((a, b) => a - b)) {
|
|
21967
|
+
this.#flushPendingAgentText(active, stepIndex);
|
|
21968
|
+
}
|
|
21969
|
+
}
|
|
21333
21970
|
#appendOrSyncAgentText(active, text, isExplicitDelta) {
|
|
21334
21971
|
if (!text)
|
|
21335
21972
|
return;
|
|
@@ -21384,6 +22021,7 @@ ${line}`).slice(-8e3);
|
|
|
21384
22021
|
this.#active = null;
|
|
21385
22022
|
const itemOutcome = outcome.status === "failed" ? { status: "failed", error: outcome.error } : outcome.status === "cancelled" ? { status: "cancelled", ...outcome.reason ? { reason: outcome.reason } : {} } : { status: "succeeded" };
|
|
21386
22023
|
active.subagents.finish(itemOutcome);
|
|
22024
|
+
this.#flushAllPendingAgentText(active);
|
|
21387
22025
|
if (active.compactionItem)
|
|
21388
22026
|
this.#completeItem(active, active.compactionItem, itemOutcome);
|
|
21389
22027
|
active.compactionItem = null;
|
|
@@ -21536,6 +22174,7 @@ ${line}`).slice(-8e3);
|
|
|
21536
22174
|
};
|
|
21537
22175
|
}
|
|
21538
22176
|
#event(event) {
|
|
22177
|
+
event = configureSubagentEvent(event, this.#subagentConfiguration());
|
|
21539
22178
|
this.#channel.emit({ kind: "event", event });
|
|
21540
22179
|
}
|
|
21541
22180
|
#newItemId() {
|