@codexhost/cli-win32-x64 0.30.0 → 0.31.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 +54 -5
- package/app/console-web.js +74 -7
- package/app/desktop-controller.mjs +60 -9
- package/app/host-runtime.mjs +1367 -322
- package/app/plugins/antigravity/plugin.mjs +54 -5
- package/app/plugins/claude-code/plugin.mjs +65 -13
- package/app/plugins/codebuddy/plugin.mjs +253 -93
- package/app/plugins/codex-usage/plugin.mjs +54 -5
- package/app/plugins/copilot/plugin.mjs +54 -5
- package/app/plugins/cursor-cli/plugin.mjs +54 -5
- package/app/plugins/deepseek-harness/plugin.mjs +54 -5
- package/app/plugins/devin/plugin.mjs +54 -5
- package/app/plugins/grok/plugin.mjs +54 -5
- package/app/plugins/hermes/plugin.mjs +54 -5
- package/app/plugins/kimi-code/plugin.mjs +54 -5
- package/app/plugins/kiro-cli/plugin.mjs +54 -5
- package/app/plugins/omp/plugin.mjs +54 -5
- package/app/plugins/opencode/plugin.mjs +54 -5
- package/app/plugins/pi/plugin.mjs +54 -5
- package/app/plugins/qoder/plugin.mjs +54 -5
- package/app/plugins/qoder-cn/plugin.mjs +54 -5
- package/app/plugins/qwen-code/plugin.mjs +54 -5
- package/app/plugins/workbuddy/plugin.mjs +253 -93
- package/app/plugins/zcode/plugin.mjs +54 -5
- package/app/renderer-extension.js +650 -413
- package/app/web/assets/{abnfDiagram-XWFEHMT6-BdinLox4.js → abnfDiagram-XWFEHMT6-Bqy7uOSy.js} +1 -1
- package/app/web/assets/{architectureDiagram-CSQXQB3N-DgPBbtvP.js → architectureDiagram-CSQXQB3N-6aaP1YoM.js} +1 -1
- package/app/web/assets/{blockDiagram-BEDRHYPZ-B4ENdwtZ.js → blockDiagram-BEDRHYPZ-B4QSFXe0.js} +1 -1
- package/app/web/assets/{c4Diagram-M2UUVUY5-DA6Owfyu.js → c4Diagram-M2UUVUY5-BYE-C8Gq.js} +1 -1
- package/app/web/assets/{chunk-2Q5K7J3B-Dvh3qOmo.js → chunk-2Q5K7J3B-CiEM-GTd.js} +1 -1
- package/app/web/assets/{chunk-3GCGMST5-VIkqueym.js → chunk-3GCGMST5-hzY9BiB1.js} +1 -1
- package/app/web/assets/{chunk-5VM5RSS4-DTYof_OI.js → chunk-5VM5RSS4-DYXznY0H.js} +1 -1
- package/app/web/assets/{chunk-7U7NFRK5-Dp7s2dg0.js → chunk-7U7NFRK5-Bzw5MDPr.js} +1 -1
- package/app/web/assets/{chunk-CNRTWJTD-TKBKxZLU.js → chunk-CNRTWJTD-DMbxMfi3.js} +1 -1
- package/app/web/assets/{chunk-D5HYT7QG-BRZDovSS.js → chunk-D5HYT7QG-By0ZVBtD.js} +1 -1
- package/app/web/assets/{chunk-EBZ3SEQC-C9USZ3tT.js → chunk-EBZ3SEQC-Yyu_sMV7.js} +2 -2
- package/app/web/assets/{chunk-JWPE2WC7-BrdvVNVo.js → chunk-JWPE2WC7-DDzqxIPT.js} +1 -1
- package/app/web/assets/{chunk-KTR4FSNJ-C7qwjGba.js → chunk-KTR4FSNJ-GlKqhtpl.js} +1 -1
- package/app/web/assets/{chunk-XXDRQBXY-DlSrRuwN.js → chunk-XXDRQBXY-DNc-CvYu.js} +1 -1
- package/app/web/assets/{classDiagram-v2-KXABOMEV-BFvB4kwX.js → classDiagram-v2-KXABOMEV-4_PFS2N_.js} +1 -1
- package/app/web/assets/{cose-bilkent-JH36ORCC-UyCAqNvj.js → cose-bilkent-JH36ORCC-BE3foHUY.js} +1 -1
- package/app/web/assets/{cynefin-EF2NZ3EQ-CwawUbjJ.js → cynefin-EF2NZ3EQ-D2PqrYZ3.js} +1 -1
- package/app/web/assets/{cynefinDiagram-NJNITYFG-BaWEIQJ0.js → cynefinDiagram-NJNITYFG-DOObpTbq.js} +1 -1
- package/app/web/assets/{dagre-KIHZ2IZ3-B7ENIjLG.js → dagre-KIHZ2IZ3-Znm2jin9.js} +1 -1
- package/app/web/assets/{diagram-7YQZDPLS-CxRMU8xq.js → diagram-7YQZDPLS-ByZMD-uA.js} +1 -1
- package/app/web/assets/{diagram-QBROCOUO-qo7sxm4K.js → diagram-QBROCOUO-BiRShpnN.js} +1 -1
- package/app/web/assets/{diagram-RJJCUUZO-CQiGMCMe.js → diagram-RJJCUUZO-D9wLVoK2.js} +1 -1
- package/app/web/assets/{diagram-WERXNKYE-D0Jps1As.js → diagram-WERXNKYE-BSbIh-yC.js} +1 -1
- package/app/web/assets/{diagram-YHHI257C-p4AB8cqK.js → diagram-YHHI257C-DMWrHMc8.js} +1 -1
- package/app/web/assets/{diagram-YR4HJLHV-Bh6JKT04.js → diagram-YR4HJLHV-C4sBAFb1.js} +1 -1
- package/app/web/assets/{ebnfDiagram-N527522P-DRac0k4W.js → ebnfDiagram-N527522P-BZLloaoQ.js} +1 -1
- package/app/web/assets/{elk-O5DQBFGD-CWTz5SZP.js → elk-O5DQBFGD-Da3e5tn5.js} +1 -1
- package/app/web/assets/{erDiagram-K3K3BIDK-DE3w4BEY.js → erDiagram-K3K3BIDK-B2lKAIZF.js} +1 -1
- package/app/web/assets/{flowDiagram-Z6JWZHQI-NYs8bi5t.js → flowDiagram-Z6JWZHQI-q2EY_kmB.js} +1 -1
- package/app/web/assets/{ganttDiagram-3PRQTZWP-Bspp9btW.js → ganttDiagram-3PRQTZWP-BGrNZ20b.js} +1 -1
- package/app/web/assets/{gitGraphDiagram-VXDFKS5L-ByGW1uvv.js → gitGraphDiagram-VXDFKS5L-DIZNXREy.js} +1 -1
- package/app/web/assets/{grid-E2QIVN74-CegebiIw.js → grid-E2QIVN74-0cUkPG69.js} +1 -1
- package/app/web/assets/{index-DFPOGLS4.js → index-PN7K-15_.js} +76 -76
- package/app/web/assets/{infoDiagram-EZ3ZOAHP-CexmsdZx.js → infoDiagram-EZ3ZOAHP-BHhUTQCn.js} +1 -1
- package/app/web/assets/{ishikawaDiagram-S3EKX5GW-BbWqKhg6.js → ishikawaDiagram-S3EKX5GW-DPOxtl4c.js} +1 -1
- package/app/web/assets/{journeyDiagram-POQNLL5X-27YlCe-1.js → journeyDiagram-POQNLL5X-D8RyXckG.js} +1 -1
- package/app/web/assets/{kanban-definition-BH5XI6FM-BAhOdeck.js → kanban-definition-BH5XI6FM-COJv3Hyh.js} +1 -1
- package/app/web/assets/{mermaid.core-sGgCbv5y.js → mermaid.core-DYdcDKIt.js} +4 -4
- package/app/web/assets/{mindmap-definition-WVAN44T4-CsMIX0Lj.js → mindmap-definition-WVAN44T4-DnYIM4ja.js} +1 -1
- package/app/web/assets/{pegDiagram-D4NLKWP3-Cs3LXqn_.js → pegDiagram-D4NLKWP3-Ds3GAEJ6.js} +1 -1
- package/app/web/assets/{pieDiagram-36ENHN4W-DdQsQX9I.js → pieDiagram-36ENHN4W-BhLUJGEB.js} +1 -1
- package/app/web/assets/{quadrantDiagram-ZQUDMS73-D1jOKqx_.js → quadrantDiagram-ZQUDMS73-DwtX-IxK.js} +1 -1
- package/app/web/assets/{railroadDiagram-JIZHGYPL-XulrgX5n.js → railroadDiagram-JIZHGYPL-D2vmTTnJ.js} +1 -1
- package/app/web/assets/{render-VIF2ZAQL-CSsGw-0I.js → render-VIF2ZAQL-DGU1ql-Z.js} +2 -2
- package/app/web/assets/{requirementDiagram-AXW2TVFA-CT66GXLN.js → requirementDiagram-AXW2TVFA-u3j1sKkI.js} +1 -1
- package/app/web/assets/{sankeyDiagram-FBCJTAIF-CNRKebNY.js → sankeyDiagram-FBCJTAIF-k-An9VHW.js} +1 -1
- package/app/web/assets/{sequenceDiagram-3LA2ROMG-DVl5y64e.js → sequenceDiagram-3LA2ROMG-DUjbYb4R.js} +1 -1
- package/app/web/assets/{sizeCapture-2Q2CQKSF-Kg0XxSga.js → sizeCapture-2Q2CQKSF-DATTL7FZ.js} +1 -1
- package/app/web/assets/{stateDiagram-v2-ATKHQDJO-DYQnfMsS.js → stateDiagram-v2-ATKHQDJO-cCJX5M2u.js} +1 -1
- package/app/web/assets/{swimlanes-YQL5WMAO-Chqt7pxD.js → swimlanes-YQL5WMAO-B7grWEWt.js} +1 -1
- package/app/web/assets/swimlanesDiagram-UCCPES4V-B8Jem9gq.js +8 -0
- package/app/web/assets/{timeline-definition-7Z437IG3-aHFxjIT6.js → timeline-definition-7Z437IG3-BhsLa6l1.js} +1 -1
- package/app/web/assets/{usecaseDiagram-RDK6N6HP-DsC5tFe4.js → usecaseDiagram-RDK6N6HP-CkPQYmQw.js} +1 -1
- package/app/web/assets/{vennDiagram-SHRQU5PJ-C65oZxFn.js → vennDiagram-SHRQU5PJ-CufZSwvw.js} +1 -1
- package/app/web/assets/{wardleyDiagram-F3OXNVQS-HTkq7DT0.js → wardleyDiagram-F3OXNVQS-CSkfpFOA.js} +1 -1
- package/app/web/assets/{xychartDiagram-GDYJKCDI-p1LpQ9MH.js → xychartDiagram-GDYJKCDI-BhZf9scK.js} +1 -1
- package/app/web/codexhost-settings.js +56 -56
- package/app/web/index.html +1 -1
- package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +8 -8
- package/app/web/plugins/deepseek-ai__dsh-api-workspace-controller/client.js +3 -3
- package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +75 -75
- package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +16 -16
- package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +16 -16
- 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 +70 -72
- package/app/web-modules/server.mjs +383 -148
- package/bin/codexhost.exe +0 -0
- package/libexec/codexhost-node-repl.exe +0 -0
- package/libexec/codexhost-screenshot.exe +0 -0
- package/libexec/codexhost-shell.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/swimlanesDiagram-UCCPES4V-BfREktNP.js +0 -8
|
@@ -73161,7 +73161,39 @@ var NATIVE_CODEX_GOAL_METHOD = "codexhost/thread/goal", nativeCodexGoalInvocatio
|
|
|
73161
73161
|
|
|
73162
73162
|
// packages/shared-contracts/dist/client-channel.js
|
|
73163
73163
|
var CLIENT_CHANNEL_VERSION = 1, CLIENT_REQUEST_LIMIT_BYTES = 128 * 1024 * 1024;
|
|
73164
|
-
var
|
|
73164
|
+
var THREAD_SECTION_CAPABILITY = "threadSectionsV1", threadSectionName = external_exports.string().trim().min(1), threadSectionId = external_exports.string().min(1), threadSectionAppearance = external_exports.object({
|
|
73165
|
+
icon: external_exports.string().nullable(),
|
|
73166
|
+
color: external_exports.string().nullable()
|
|
73167
|
+
}), clientThreadSectionAppearanceSchema = threadSectionAppearance.nullable(), CLIENT_THREAD_SECTION_MUTATIONS = {
|
|
73168
|
+
create: {
|
|
73169
|
+
method: "codexhost/thread/sections/create",
|
|
73170
|
+
params: external_exports.object({ name: threadSectionName }).strict()
|
|
73171
|
+
},
|
|
73172
|
+
update: {
|
|
73173
|
+
method: "codexhost/thread/sections/update",
|
|
73174
|
+
params: external_exports.object({
|
|
73175
|
+
sectionId: threadSectionId,
|
|
73176
|
+
name: threadSectionName,
|
|
73177
|
+
appearance: threadSectionAppearance.strict().nullable().optional()
|
|
73178
|
+
}).strict()
|
|
73179
|
+
},
|
|
73180
|
+
delete: {
|
|
73181
|
+
method: "codexhost/thread/sections/delete",
|
|
73182
|
+
params: external_exports.object({ sectionId: threadSectionId }).strict()
|
|
73183
|
+
}
|
|
73184
|
+
}, clientThreadSectionMutationResultSchema = external_exports.discriminatedUnion("status", [
|
|
73185
|
+
external_exports.object({ status: external_exports.literal("unknown") }),
|
|
73186
|
+
external_exports.object({
|
|
73187
|
+
status: external_exports.literal("confirmed"),
|
|
73188
|
+
sectionId: threadSectionId,
|
|
73189
|
+
section: external_exports.object({
|
|
73190
|
+
id: threadSectionId,
|
|
73191
|
+
name: external_exports.string().min(1),
|
|
73192
|
+
appearance: clientThreadSectionAppearanceSchema
|
|
73193
|
+
}).nullable(),
|
|
73194
|
+
syncPending: external_exports.boolean()
|
|
73195
|
+
})
|
|
73196
|
+
]), CLIENT_CHANNEL_METHODS = [
|
|
73165
73197
|
"codexhost/skills/list",
|
|
73166
73198
|
"codexhost/voice/status",
|
|
73167
73199
|
"codexhost/voice/transcribe",
|
|
@@ -73207,6 +73239,9 @@ var CLIENT_CHANNEL_METHODS = [
|
|
|
73207
73239
|
"codexhost/thread/pins/list",
|
|
73208
73240
|
"codexhost/thread/sections/list",
|
|
73209
73241
|
"codexhost/thread/sections/move",
|
|
73242
|
+
CLIENT_THREAD_SECTION_MUTATIONS.create.method,
|
|
73243
|
+
CLIENT_THREAD_SECTION_MUTATIONS.update.method,
|
|
73244
|
+
CLIENT_THREAD_SECTION_MUTATIONS.delete.method,
|
|
73210
73245
|
"codexhost/thread/pins/set",
|
|
73211
73246
|
"codexhost/harness/plugins/list",
|
|
73212
73247
|
"codexhost/harness/inspect",
|
|
@@ -73256,15 +73291,20 @@ var CLIENT_CHANNEL_METHODS = [
|
|
|
73256
73291
|
PRODUCT_TELEMETRY_SIGNAL_METHOD,
|
|
73257
73292
|
"codexhost/sessions/loaded/list"
|
|
73258
73293
|
], clientThreadSectionsSchema = external_exports.object({
|
|
73294
|
+
[THREAD_SECTION_CAPABILITY]: external_exports.literal(!0).optional(),
|
|
73295
|
+
complete: external_exports.literal(!1).optional(),
|
|
73259
73296
|
sections: external_exports.array(external_exports.object({
|
|
73260
73297
|
id: external_exports.string().min(1),
|
|
73261
73298
|
name: external_exports.string().min(1),
|
|
73299
|
+
appearance: clientThreadSectionAppearanceSchema.optional(),
|
|
73262
73300
|
threads: external_exports.array(jsonObjectSchema)
|
|
73263
|
-
})
|
|
73264
|
-
})
|
|
73301
|
+
}))
|
|
73302
|
+
}), clientThreadSectionMoveSchema = external_exports.object({
|
|
73265
73303
|
threadId: external_exports.string().min(1).max(1024),
|
|
73266
|
-
sectionId: external_exports.string().min(1).max(1024).nullable()
|
|
73267
|
-
|
|
73304
|
+
sectionId: external_exports.string().min(1).max(1024).nullable(),
|
|
73305
|
+
beforeThreadId: external_exports.string().min(1).max(1024).nullable().optional(),
|
|
73306
|
+
expectedSourceSectionId: external_exports.string().min(1).max(1024).optional()
|
|
73307
|
+
}).refine((move) => move.expectedSourceSectionId === void 0 || move.sectionId === null), clientThreadPinsSchema = external_exports.object({ threadIds: external_exports.array(external_exports.string().min(1)) }).strict(), clientThreadPinParamsSchema = external_exports.object({ threadId: external_exports.string().min(1).max(1024), pinned: external_exports.boolean() }).strict(), clientThreadTreeReadParamsSchema = external_exports.object({}).strict(), clientThreadTreeSchema = external_exports.object({
|
|
73268
73308
|
parents: external_exports.record(external_exports.string().min(1), external_exports.string().min(1))
|
|
73269
73309
|
}).strict(), clientProjectlessWorkspaceSchema = external_exports.object({
|
|
73270
73310
|
prompt: external_exports.string().max(16384).optional()
|
|
@@ -73302,6 +73342,7 @@ var CLIENT_CHANNEL_METHODS = [
|
|
|
73302
73342
|
harnessId: external_exports.string().min(1)
|
|
73303
73343
|
}),
|
|
73304
73344
|
external_exports.object({ type: external_exports.literal("display-settings-changed"), cursor: clientChannelCursorSchema }),
|
|
73345
|
+
external_exports.object({ type: external_exports.literal("sections-changed"), cursor: clientChannelCursorSchema }),
|
|
73305
73346
|
external_exports.object({
|
|
73306
73347
|
type: external_exports.literal("preferences-changed"),
|
|
73307
73348
|
cursor: clientChannelCursorSchema,
|
|
@@ -73456,7 +73497,8 @@ var CLIENT_CHANNEL_METHODS = [
|
|
|
73456
73497
|
startedAt: external_exports.number(),
|
|
73457
73498
|
epoch: external_exports.string().uuid(),
|
|
73458
73499
|
capabilities: external_exports.object({
|
|
73459
|
-
peerDelegation: external_exports.literal(1).optional()
|
|
73500
|
+
peerDelegation: external_exports.literal(1).optional(),
|
|
73501
|
+
threadReferenceContext: external_exports.literal(1).optional()
|
|
73460
73502
|
}).optional()
|
|
73461
73503
|
}), clientChannelResponseSchema = external_exports.object({
|
|
73462
73504
|
epoch: external_exports.string().uuid(),
|
|
@@ -75287,7 +75329,7 @@ var HostClientChannel = class {
|
|
|
75287
75329
|
throw new Error("Host unavailable");
|
|
75288
75330
|
this.descriptor = descriptor;
|
|
75289
75331
|
let url2 = new URL(`http://127.0.0.1:${descriptor.port}/v1/events`);
|
|
75290
|
-
this.cursor && (url2.searchParams.set("epoch", this.cursor.epoch), url2.searchParams.set("after", String(this.cursor.sequence)));
|
|
75332
|
+
url2.searchParams.set(THREAD_SECTION_CAPABILITY, "1"), this.cursor && (url2.searchParams.set("epoch", this.cursor.epoch), url2.searchParams.set("after", String(this.cursor.sequence)));
|
|
75291
75333
|
let response = await fetch(url2, {
|
|
75292
75334
|
redirect: "error",
|
|
75293
75335
|
headers: { authorization: `Bearer ${descriptor.token}` },
|
|
@@ -75354,12 +75396,15 @@ var HostClientChannel = class {
|
|
|
75354
75396
|
throw Object.assign(new Error("Obsolete Host reply; resynchronize after reconnecting"), {
|
|
75355
75397
|
code: -32094
|
|
75356
75398
|
});
|
|
75357
|
-
if (value
|
|
75358
|
-
|
|
75359
|
-
|
|
75399
|
+
if (Object.hasOwn(value, "error") && !Object.hasOwn(value, "result")) {
|
|
75400
|
+
let error62 = jsonRpcErrorSchema.safeParse(value.error);
|
|
75401
|
+
if (error62.success)
|
|
75402
|
+
throw Object.assign(new Error(error62.data.message), { code: error62.data.code });
|
|
75403
|
+
}
|
|
75404
|
+
if (!response.ok || Object.hasOwn(value, "error") || !Object.hasOwn(value, "result"))
|
|
75405
|
+
throw Object.assign(new Error("Invalid Host reply; operation outcome may be unknown"), {
|
|
75406
|
+
code: -32093
|
|
75360
75407
|
});
|
|
75361
|
-
if (!Object.hasOwn(value, "result"))
|
|
75362
|
-
throw new Error("Invalid Host reply; operation outcome may be unknown");
|
|
75363
75408
|
return value.result;
|
|
75364
75409
|
}
|
|
75365
75410
|
request(method2, params, timeoutMs) {
|
|
@@ -77651,8 +77696,10 @@ var INITIAL_CONNECTION_WAIT_MS = 2e3, MAX_TRACKED_SNAPSHOT_THREADS = 64, MAX_TRA
|
|
|
77651
77696
|
this.changed(this.hostId);
|
|
77652
77697
|
}
|
|
77653
77698
|
if (this.life.signal.aborted) return;
|
|
77654
|
-
let query =
|
|
77655
|
-
|
|
77699
|
+
let query = new URLSearchParams({ [THREAD_SECTION_CAPABILITY]: "1" });
|
|
77700
|
+
this.cursor && (query.set("epoch", this.cursor.epoch), query.set("after", String(this.cursor.sequence)));
|
|
77701
|
+
let response = await this.fetch(
|
|
77702
|
+
`/api/ch/v1/events?${query}`,
|
|
77656
77703
|
"GET",
|
|
77657
77704
|
void 0,
|
|
77658
77705
|
streamAbort.signal
|
|
@@ -78666,9 +78713,10 @@ var ChRealtime = class {
|
|
|
78666
78713
|
urgent = /* @__PURE__ */ new Set();
|
|
78667
78714
|
running = /* @__PURE__ */ new Set();
|
|
78668
78715
|
timers = /* @__PURE__ */ new Map();
|
|
78669
|
-
catalogReason
|
|
78716
|
+
catalogReason;
|
|
78670
78717
|
threadDebounceMs;
|
|
78671
78718
|
closed = !1;
|
|
78719
|
+
sectionsDirty = !1;
|
|
78672
78720
|
online = !1;
|
|
78673
78721
|
unsubscribe;
|
|
78674
78722
|
invalidate(id2) {
|
|
@@ -78692,9 +78740,11 @@ var ChRealtime = class {
|
|
|
78692
78740
|
if (event.type === "hello") {
|
|
78693
78741
|
this.callbacks.reset(event.cursor.epoch, event.reset);
|
|
78694
78742
|
for (let id2 of this.watched.keys()) this.schedule(id2, 100);
|
|
78695
|
-
this.
|
|
78743
|
+
this.catalogReason ??= "hello", this.schedule("", 100);
|
|
78696
78744
|
} else if (event.type === "projects-changed")
|
|
78697
|
-
this.schedule("", 100);
|
|
78745
|
+
this.catalogReason = "changed", this.schedule("", 100);
|
|
78746
|
+
else if (event.type === "sections-changed" && this.callbacks.sections)
|
|
78747
|
+
this.sectionsDirty = !0, this.schedule("", 100);
|
|
78698
78748
|
else if (event.type === "changed") {
|
|
78699
78749
|
if (event.method === "codexhost/thread/usage/updated" || event.method === "thread/tokenUsage/updated") {
|
|
78700
78750
|
this.online && this.watched.has(event.threadId) && this.callbacks.usage(event.threadId);
|
|
@@ -78733,12 +78783,14 @@ var ChRealtime = class {
|
|
|
78733
78783
|
if (this.dirty.delete(id2), this.urgent.delete(id2), this.closed || !this.online || id2 && !this.watched.has(id2)) return;
|
|
78734
78784
|
this.running.add(id2);
|
|
78735
78785
|
let catalogReason = id2 ? void 0 : this.catalogReason;
|
|
78736
|
-
id2 || (this.catalogReason =
|
|
78786
|
+
id2 || (this.catalogReason = void 0);
|
|
78787
|
+
let sections = !id2 && this.sectionsDirty ? this.callbacks.sections : void 0;
|
|
78788
|
+
sections && (this.sectionsDirty = !1);
|
|
78737
78789
|
let retryDelay2;
|
|
78738
78790
|
try {
|
|
78739
|
-
id2 ? await this.callbacks.thread(id2) : await this.callbacks.catalog(catalogReason);
|
|
78791
|
+
id2 ? await this.callbacks.thread(id2) : catalogReason ? await this.callbacks.catalog(catalogReason, !!sections) : sections && await sections();
|
|
78740
78792
|
} catch (error62) {
|
|
78741
|
-
this.callbacks.error(id2, error62), this.dirty.add(id2),
|
|
78793
|
+
sections && (this.sectionsDirty = !0), this.callbacks.error(id2, error62), this.dirty.add(id2), catalogReason && (this.catalogReason ??= catalogReason), retryDelay2 = 1e3;
|
|
78742
78794
|
} finally {
|
|
78743
78795
|
if (this.running.delete(id2), this.dirty.has(id2)) {
|
|
78744
78796
|
let nextDelay = retryDelay2 ?? (id2 ? this.urgent.has(id2) ? 100 : this.threadDebounceMs : 100);
|
|
@@ -139633,7 +139685,7 @@ var Workspaces = class {
|
|
|
139633
139685
|
nativeRoots = /* @__PURE__ */ new Map();
|
|
139634
139686
|
nativeRootOwners = /* @__PURE__ */ new Map();
|
|
139635
139687
|
legacyAssignments = {};
|
|
139636
|
-
followers = /* @__PURE__ */ new
|
|
139688
|
+
followers = /* @__PURE__ */ new Map();
|
|
139637
139689
|
referenceGroups;
|
|
139638
139690
|
referenceProjectless = /* @__PURE__ */ new Set();
|
|
139639
139691
|
referencePins;
|
|
@@ -139684,8 +139736,9 @@ var Workspaces = class {
|
|
|
139684
139736
|
remoteProjectId(sessionId) {
|
|
139685
139737
|
return this.state.remoteProjectIds?.[sessionId];
|
|
139686
139738
|
}
|
|
139687
|
-
broadcast(frame) {
|
|
139688
|
-
for (let sink of this.followers)
|
|
139739
|
+
broadcast(frame, sectionCapability) {
|
|
139740
|
+
for (let [sink, capable] of this.followers)
|
|
139741
|
+
(sectionCapability === void 0 || capable === sectionCapability) && sink.push(frame);
|
|
139689
139742
|
}
|
|
139690
139743
|
touch(workspace) {
|
|
139691
139744
|
workspace.updatedAt = (/* @__PURE__ */ new Date()).toISOString(), this.save();
|
|
@@ -139873,44 +139926,44 @@ var Workspaces = class {
|
|
|
139873
139926
|
}
|
|
139874
139927
|
/** Unmodified official snapshot and the projection delivered to Web clients. */
|
|
139875
139928
|
officialThreadSections;
|
|
139876
|
-
|
|
139877
|
-
projectSectionCoverage = /* @__PURE__ */ new Map();
|
|
139929
|
+
officialThreadSectionsV1;
|
|
139878
139930
|
referenceThreadSections = [];
|
|
139931
|
+
legacyThreadSections = [];
|
|
139932
|
+
referenceThreadSectionsV1;
|
|
139933
|
+
referenceSectionWorkspaceIdsDirty = !1;
|
|
139879
139934
|
hasThreadSection(id2) {
|
|
139880
139935
|
return this.referenceThreadSections.some((section) => section.id === id2);
|
|
139881
139936
|
}
|
|
139937
|
+
sectionMemberIds() {
|
|
139938
|
+
return new Set(this.referenceThreadSections.flatMap(({ threadIds }) => threadIds));
|
|
139939
|
+
}
|
|
139882
139940
|
/**
|
|
139883
139941
|
* Publish native sections. Desktop's project members become the Workspaces of their root
|
|
139884
139942
|
* folders, so call this after the project roots are synced into Workspaces.
|
|
139885
139943
|
*/
|
|
139886
|
-
setReferenceThreadSections(sections, projects = [], sectionProjects = {}) {
|
|
139887
|
-
|
|
139944
|
+
setReferenceThreadSections(sections, projects = [], sectionProjects = {}, threadSectionsV1) {
|
|
139945
|
+
if (!sections) {
|
|
139946
|
+
this.officialThreadSectionsV1 = void 0, this.publishProjectSections();
|
|
139947
|
+
return;
|
|
139948
|
+
}
|
|
139949
|
+
let paths2 = this.nativeWorkspaces ? void 0 : sectionRootPaths(
|
|
139888
139950
|
projects,
|
|
139889
139951
|
sectionProjects,
|
|
139890
139952
|
sections.map((section) => section.id)
|
|
139891
139953
|
), next = sections.map((section) => {
|
|
139892
|
-
|
|
139893
|
-
let
|
|
139894
|
-
|
|
139895
|
-
|
|
139896
|
-
});
|
|
139897
|
-
return workspaceIds2.length > 0 ? { ...section, workspaceIds: workspaceIds2 } : { ...section };
|
|
139898
|
-
}
|
|
139899
|
-
let workspaceIds = (paths2.get(section.id) ?? []).flatMap((path7) => {
|
|
139954
|
+
let workspaceIds = this.nativeWorkspaces ? (sectionProjects[section.id] ?? []).flatMap((id2) => {
|
|
139955
|
+
let workspace = this.nativeWorkspaces?.find((item) => item.projectId === id2);
|
|
139956
|
+
return workspace ? [workspace.workspaceId] : [];
|
|
139957
|
+
}) : (paths2?.get(section.id) ?? []).flatMap((path7) => {
|
|
139900
139958
|
let workspace = this.byPath(path7);
|
|
139901
139959
|
return workspace ? [workspace.workspaceId] : [];
|
|
139902
139960
|
});
|
|
139903
139961
|
return workspaceIds.length > 0 ? { ...section, workspaceIds } : { ...section };
|
|
139904
|
-
}), saved = this.state.projectSectionOverrides, registered = this.nativeWorkspaces && new Set(this.nativeWorkspaces.map((item) => item.workspaceId))
|
|
139962
|
+
}), saved = this.state.projectSectionOverrides, registered = this.nativeWorkspaces && new Set(this.nativeWorkspaces.map((item) => item.workspaceId));
|
|
139905
139963
|
if (registered) {
|
|
139906
139964
|
let located = new Set(next.flatMap((section) => section.workspaceIds ?? []));
|
|
139907
139965
|
for (let section of next) {
|
|
139908
|
-
if (Object.hasOwn(sectionProjects, section.id))
|
|
139909
|
-
coverage.set(section.id, registered);
|
|
139910
|
-
continue;
|
|
139911
|
-
}
|
|
139912
|
-
let lastRead = this.projectSectionCoverage.get(section.id);
|
|
139913
|
-
lastRead && coverage.set(section.id, lastRead);
|
|
139966
|
+
if (Object.hasOwn(sectionProjects, section.id)) continue;
|
|
139914
139967
|
let previous = this.officialThreadSections?.find((item) => item.id === section.id)?.workspaceIds ?? [], anchors = Object.entries(saved ?? {}).flatMap(
|
|
139915
139968
|
([id2, placement]) => placement.official === section.id ? [id2] : []
|
|
139916
139969
|
), retained = [.../* @__PURE__ */ new Set([...previous, ...anchors])].filter(
|
|
@@ -139930,7 +139983,7 @@ var Workspaces = class {
|
|
|
139930
139983
|
);
|
|
139931
139984
|
Object.keys(valid2).length !== Object.keys(saved).length && this.saveProjectSections(valid2);
|
|
139932
139985
|
}
|
|
139933
|
-
this.officialThreadSections = next, this.
|
|
139986
|
+
this.officialThreadSections = next, this.referenceSectionWorkspaceIdsDirty = !1, this.officialThreadSectionsV1 = threadSectionsV1, this.publishProjectSections();
|
|
139934
139987
|
}
|
|
139935
139988
|
projectSection(sections, workspaceId) {
|
|
139936
139989
|
return sections.find((section) => section.workspaceIds?.includes(workspaceId))?.id ?? null;
|
|
@@ -139939,26 +139992,56 @@ var Workspaces = class {
|
|
|
139939
139992
|
let state2 = { ...this.state };
|
|
139940
139993
|
Object.keys(overrides).length ? state2.projectSectionOverrides = overrides : delete state2.projectSectionOverrides, this.data.writeJson(FILE2, state2), this.state = state2;
|
|
139941
139994
|
}
|
|
139995
|
+
/** A move cannot change definitions or project membership. */
|
|
139996
|
+
applyThreadSectionMove(sections, threadSectionsV1, movedId) {
|
|
139997
|
+
let current = this.officialThreadSections ?? [];
|
|
139998
|
+
if (this.referenceSectionWorkspaceIdsDirty || threadSectionsV1 !== this.officialThreadSectionsV1 || sections.length !== current.length || !sections.every((section, i) => {
|
|
139999
|
+
let previous = current[i];
|
|
140000
|
+
return previous?.id === section.id && previous.name === section.name && JSON.stringify(previous.appearance) === JSON.stringify(section.appearance);
|
|
140001
|
+
}))
|
|
140002
|
+
return !1;
|
|
140003
|
+
let remaining = /* @__PURE__ */ new Set();
|
|
140004
|
+
if (movedId !== void 0)
|
|
140005
|
+
for (let { threadIds } of current)
|
|
140006
|
+
for (let id2 of threadIds) id2 !== movedId && remaining.add(id2);
|
|
140007
|
+
let seen = /* @__PURE__ */ new Set();
|
|
140008
|
+
for (let { threadIds } of sections)
|
|
140009
|
+
for (let id2 of threadIds) {
|
|
140010
|
+
if (seen.has(id2) || movedId !== void 0 && id2 !== movedId && !remaining.delete(id2))
|
|
140011
|
+
return !1;
|
|
140012
|
+
seen.add(id2);
|
|
140013
|
+
}
|
|
140014
|
+
return remaining.size !== 0 ? !1 : (this.officialThreadSections = sections.map((section, i) => {
|
|
140015
|
+
let workspaceIds = current[i]?.workspaceIds;
|
|
140016
|
+
return workspaceIds === void 0 ? section : { ...section, workspaceIds };
|
|
140017
|
+
}), this.publishProjectSections(), !0);
|
|
140018
|
+
}
|
|
139942
140019
|
publishProjectSections() {
|
|
139943
140020
|
let official = this.officialThreadSections ?? [], overrides = this.nativeWorkspaces ? this.state.projectSectionOverrides : void 0, next = overrides ? official.map(({ workspaceIds, ...section }) => {
|
|
139944
140021
|
let ids = (workspaceIds ?? []).filter((id2) => !Object.hasOwn(overrides, id2));
|
|
139945
140022
|
for (let [id2, placement] of Object.entries(overrides))
|
|
139946
140023
|
placement.target === section.id && ids.push(id2);
|
|
139947
140024
|
return ids.length ? { ...section, workspaceIds: ids } : section;
|
|
139948
|
-
}) : official
|
|
139949
|
-
|
|
140025
|
+
}) : official, threadSectionsV1 = this.officialThreadSectionsV1, legacy2 = next.some((section) => section.appearance !== void 0) ? next.map((section) => {
|
|
140026
|
+
let legacySection = { ...section };
|
|
140027
|
+
return delete legacySection.appearance, legacySection;
|
|
140028
|
+
}) : next, projected = threadSectionsV1 ? next : legacy2;
|
|
140029
|
+
if (threadSectionsV1 === this.referenceThreadSectionsV1 && JSON.stringify(projected) === JSON.stringify(this.referenceThreadSections))
|
|
140030
|
+
return;
|
|
140031
|
+
let legacyChanged = JSON.stringify(legacy2) !== JSON.stringify(this.legacyThreadSections);
|
|
140032
|
+
this.referenceThreadSections = projected, this.referenceThreadSectionsV1 = threadSectionsV1, this.legacyThreadSections = legacy2, this.broadcast(
|
|
140033
|
+
{
|
|
140034
|
+
type: "threadSections",
|
|
140035
|
+
threadSections: projected,
|
|
140036
|
+
...threadSectionsV1 ? { [THREAD_SECTION_CAPABILITY]: !0 } : {}
|
|
140037
|
+
},
|
|
140038
|
+
!0
|
|
140039
|
+
), legacyChanged && this.broadcast({ type: "threadSections", threadSections: legacy2 }, !1);
|
|
139950
140040
|
}
|
|
139951
140041
|
moveWorkspaceToSection(workspaceId, sectionId) {
|
|
139952
140042
|
if (typeof workspaceId != "string" || !this.officialThreadSections || !this.nativeWorkspaces?.some((workspace) => workspace.workspaceId === workspaceId) || !(sectionId === null || typeof sectionId == "string" && this.hasThreadSection(sectionId)))
|
|
139953
140043
|
throw new SessionRuntimeError("workspace/section-invalid", "Unknown local project or sidebar section.");
|
|
139954
140044
|
let official = this.projectSection(this.officialThreadSections, workspaceId);
|
|
139955
|
-
if (official === null && !this.state.projectSectionOverrides?.[workspaceId] && this.officialThreadSections.some(
|
|
139956
|
-
(section) => !this.projectSectionCoverage.get(section.id)?.has(workspaceId)
|
|
139957
|
-
))
|
|
139958
|
-
throw new SessionRuntimeError(
|
|
139959
|
-
"workspace/section-invalid",
|
|
139960
|
-
"The project's current sidebar section is unknown. Refresh the sidebar and try again."
|
|
139961
|
-
);
|
|
139962
140045
|
if (this.projectSection(this.referenceThreadSections, workspaceId) !== sectionId) {
|
|
139963
140046
|
let overrides = Object.fromEntries(
|
|
139964
140047
|
Object.entries(this.state.projectSectionOverrides ?? {}).filter(
|
|
@@ -140156,7 +140239,7 @@ var Workspaces = class {
|
|
|
140156
140239
|
),
|
|
140157
140240
|
...displayOrder !== void 0 ? { displayOrder } : {}
|
|
140158
140241
|
};
|
|
140159
|
-
return this.data.writeJson(FILE2, state2), this.state = state2, this.broadcast({ type: "upsert", workspace }), this.broadcast({
|
|
140242
|
+
return this.data.writeJson(FILE2, state2), this.state = state2, this.referenceProjectRoots.has(absolute2) && (this.referenceSectionWorkspaceIdsDirty = !0), this.broadcast({ type: "upsert", workspace }), this.broadcast({
|
|
140160
140243
|
type: "order",
|
|
140161
140244
|
workspaceIds: this.list().map((item) => item.workspaceId)
|
|
140162
140245
|
}), { workspace, created: !0 };
|
|
@@ -140311,7 +140394,13 @@ var Workspaces = class {
|
|
|
140311
140394
|
...nextDisplayOrder && nextDisplayOrder.length > 0 ? { displayOrder: nextDisplayOrder } : {},
|
|
140312
140395
|
...Object.keys(nextPinnedOverrides).length > 0 ? { pinnedWorkspaceOverrides: nextPinnedOverrides } : {}
|
|
140313
140396
|
};
|
|
140314
|
-
return this.data.writeJson(FILE2, state2), this.state = state2, this.broadcast({ type: "remove", workspaceId: request3.workspaceId }), this.publishPinnedWorkspaces(),
|
|
140397
|
+
return this.data.writeJson(FILE2, state2), this.state = state2, this.broadcast({ type: "remove", workspaceId: request3.workspaceId }), this.publishPinnedWorkspaces(), this.officialThreadSections?.some(
|
|
140398
|
+
({ workspaceIds }) => workspaceIds?.includes(workspace.workspaceId)
|
|
140399
|
+
) && (this.officialThreadSections = this.officialThreadSections.map((section) => {
|
|
140400
|
+
if (!section.workspaceIds?.includes(workspace.workspaceId)) return section;
|
|
140401
|
+
let { workspaceIds, ...rest } = section, remaining = workspaceIds.filter((id2) => id2 !== workspace.workspaceId);
|
|
140402
|
+
return remaining.length ? { ...rest, workspaceIds: remaining } : rest;
|
|
140403
|
+
}), this.publishProjectSections()), { deleted: !0 };
|
|
140315
140404
|
}), rpc2.register("workspace/moveWorkspaceToSection", async (args) => {
|
|
140316
140405
|
let request3 = requestOf(args);
|
|
140317
140406
|
return this.moveWorkspaceToSection(request3?.workspaceId, request3?.sectionId);
|
|
@@ -140349,14 +140438,16 @@ var Workspaces = class {
|
|
|
140349
140438
|
), rpc2.register("workspace/deleteSession", (args) => {
|
|
140350
140439
|
let sessionId = String(requestOf(args).sessionId ?? "");
|
|
140351
140440
|
return sessionId && this.forgetSession(sessionId), {};
|
|
140352
|
-
}), rpc2.register("workspace/pinSession", setMembership("pinnedSessionIds", "pinned", !0)), rpc2.register("workspace/unpinSession", setMembership("pinnedSessionIds", "pinned", !1)), streams2.register("workspace/follow", (
|
|
140353
|
-
|
|
140441
|
+
}), rpc2.register("workspace/pinSession", setMembership("pinnedSessionIds", "pinned", !0)), rpc2.register("workspace/unpinSession", setMembership("pinnedSessionIds", "pinned", !1)), streams2.register("workspace/follow", (args, sink) => {
|
|
140442
|
+
let capable = Object.hasOwn(args, THREAD_SECTION_CAPABILITY) && args[THREAD_SECTION_CAPABILITY] === !0;
|
|
140443
|
+
this.followers.set(sink, capable), sink.onClose(() => this.followers.delete(sink)), sink.push({
|
|
140354
140444
|
type: "baseline",
|
|
140355
140445
|
value: {
|
|
140356
140446
|
items: this.list(),
|
|
140357
140447
|
pinnedSessionIds: this.pinnedSessionIds(),
|
|
140358
140448
|
pinnedWorkspaceIds: this.pinnedWorkspaceIds(),
|
|
140359
|
-
threadSections: this.referenceThreadSections,
|
|
140449
|
+
threadSections: capable ? this.referenceThreadSections : this.legacyThreadSections,
|
|
140450
|
+
...capable && this.referenceThreadSectionsV1 ? { [THREAD_SECTION_CAPABILITY]: !0 } : {},
|
|
140360
140451
|
archivedSessionIds: this.archivedSessionIds(),
|
|
140361
140452
|
...this.referenceOnlyDefault ? { canStartProjectless: !0 } : {}
|
|
140362
140453
|
}
|
|
@@ -141305,9 +141396,11 @@ var ChSessions = class {
|
|
|
141305
141396
|
let view = this.threads.view(id2);
|
|
141306
141397
|
view && this.loadUsage(view, !0);
|
|
141307
141398
|
},
|
|
141308
|
-
catalog: async () => {
|
|
141309
|
-
await this.
|
|
141399
|
+
catalog: async (_reason, requireSections) => {
|
|
141400
|
+
await this.refreshing?.catch(() => {
|
|
141401
|
+
}), await this.refresh(void 0, !1, void 0, void 0, requireSections);
|
|
141310
141402
|
},
|
|
141403
|
+
sections: () => this.refreshSectionMove(),
|
|
141311
141404
|
archived: (id2, archived) => {
|
|
141312
141405
|
this.archiveOperations.delete(id2), this.updateArchive(id2, archived);
|
|
141313
141406
|
},
|
|
@@ -141351,7 +141444,6 @@ var ChSessions = class {
|
|
|
141351
141444
|
attachments;
|
|
141352
141445
|
fileInputs;
|
|
141353
141446
|
rows = /* @__PURE__ */ new Map();
|
|
141354
|
-
workspacePageRows = /* @__PURE__ */ new Set();
|
|
141355
141447
|
publishedCatalog;
|
|
141356
141448
|
handoffs = /* @__PURE__ */ new Map();
|
|
141357
141449
|
/** Loaded rows accumulate across partial official pages; drafts are not Host Threads. */
|
|
@@ -141364,6 +141456,7 @@ var ChSessions = class {
|
|
|
141364
141456
|
refreshingArchives = !1;
|
|
141365
141457
|
refreshingArchiveChanges;
|
|
141366
141458
|
refreshingDeletedIds;
|
|
141459
|
+
archiveRevision = 0;
|
|
141367
141460
|
refreshingProjectAssignments;
|
|
141368
141461
|
archiveOperations = /* @__PURE__ */ new Map();
|
|
141369
141462
|
queueOperations = /* @__PURE__ */ new Map();
|
|
@@ -141430,12 +141523,12 @@ var ChSessions = class {
|
|
|
141430
141523
|
row && (row.projectId = projectId);
|
|
141431
141524
|
}
|
|
141432
141525
|
/** A `scope` reads an explicit page on until it reaches a Thread of that folder. */
|
|
141433
|
-
async refresh(timing, includeArchived = !1, cursor, workspace) {
|
|
141526
|
+
async refresh(timing, includeArchived = !1, cursor, workspace, requireSections = !1, sectionSnapshot) {
|
|
141434
141527
|
if (this.closed) return;
|
|
141435
141528
|
if (this.refreshing && (cursor !== void 0 || !this.refreshingCatalog || includeArchived !== this.refreshingArchives)) {
|
|
141436
141529
|
let stage = this.refreshingCatalog ? "catalog_wait" : "workspace_wait", pending2 = this.refreshing.catch(() => {
|
|
141437
141530
|
});
|
|
141438
|
-
return await (timing ? timing.measure(stage, () => pending2) : pending2), this.refresh(timing, includeArchived, cursor, workspace);
|
|
141531
|
+
return await (timing ? timing.measure(stage, () => pending2) : pending2), this.refresh(timing, includeArchived, cursor, workspace, requireSections);
|
|
141439
141532
|
}
|
|
141440
141533
|
let mode = this.refreshing ? "joined" : "started";
|
|
141441
141534
|
if (!this.refreshing) {
|
|
@@ -141451,18 +141544,83 @@ var ChSessions = class {
|
|
|
141451
141544
|
deletedIds,
|
|
141452
141545
|
cursor,
|
|
141453
141546
|
workspace
|
|
141454
|
-
) : this.listAll(
|
|
141547
|
+
) : this.listAll(
|
|
141548
|
+
this.refreshingTiming,
|
|
141549
|
+
includeArchived,
|
|
141550
|
+
archiveChanges,
|
|
141551
|
+
deletedIds,
|
|
141552
|
+
cursor,
|
|
141553
|
+
sectionSnapshot
|
|
141554
|
+
);
|
|
141455
141555
|
this.refreshing = load2.finally(() => {
|
|
141456
141556
|
this.refreshing = void 0, this.refreshingCatalog = !1, this.refreshingArchives = !1, this.refreshingArchiveChanges = void 0, this.refreshingDeletedIds = void 0, this.refreshingProjectAssignments = void 0, this.refreshingTiming = void 0;
|
|
141457
141557
|
});
|
|
141458
141558
|
}
|
|
141459
141559
|
let pending = this.refreshing, catalogTiming = this.refreshingTiming;
|
|
141460
141560
|
try {
|
|
141461
|
-
|
|
141561
|
+
let result = await (timing ? timing.measure("catalog_wait", () => pending) : pending);
|
|
141562
|
+
if (requireSections && result?.sectionFailure) throw result.sectionFailure.error;
|
|
141563
|
+
return result;
|
|
141462
141564
|
} finally {
|
|
141463
141565
|
timing && catalogTiming && (timing.catalog = { mode, ...catalogTiming.snapshot() });
|
|
141464
141566
|
}
|
|
141465
141567
|
}
|
|
141568
|
+
/** An invalidation cannot join a catalog read that began before it. */
|
|
141569
|
+
async refreshAfterCurrent() {
|
|
141570
|
+
await this.refreshing?.catch(() => {
|
|
141571
|
+
}), await this.refresh();
|
|
141572
|
+
}
|
|
141573
|
+
async readThreadSections() {
|
|
141574
|
+
let snapshot = clientThreadSectionsSchema.parse(
|
|
141575
|
+
await this.host.request("codexhost/thread/sections/list", {
|
|
141576
|
+
[THREAD_SECTION_CAPABILITY]: !0,
|
|
141577
|
+
requireComplete: !0
|
|
141578
|
+
})
|
|
141579
|
+
);
|
|
141580
|
+
if (snapshot.complete === !1)
|
|
141581
|
+
throw new SessionRuntimeError("host/sections-incomplete", "Complete Thread sections are unavailable.");
|
|
141582
|
+
return snapshot;
|
|
141583
|
+
}
|
|
141584
|
+
async refreshSectionMove(move) {
|
|
141585
|
+
for (; this.refreshing; ) await this.refreshing.catch(() => {
|
|
141586
|
+
});
|
|
141587
|
+
if (this.closed) return;
|
|
141588
|
+
let archiveRevision = this.archiveRevision, read2 = this.readThreadSections();
|
|
141589
|
+
this.refreshing = read2.then(
|
|
141590
|
+
() => {
|
|
141591
|
+
},
|
|
141592
|
+
() => {
|
|
141593
|
+
}
|
|
141594
|
+
);
|
|
141595
|
+
let snapshot;
|
|
141596
|
+
try {
|
|
141597
|
+
if (snapshot = await read2, this.closed) return;
|
|
141598
|
+
if (this.archiveRevision !== archiveRevision) snapshot = void 0;
|
|
141599
|
+
else if (this.applySectionMove(snapshot, move)) return;
|
|
141600
|
+
} catch (error62) {
|
|
141601
|
+
if (error62 instanceof SessionRuntimeError && (error62.code === "host/method-unavailable" || "hostCode" in error62.details && error62.details.hostCode === -32601)) snapshot = null;
|
|
141602
|
+
else if (!move) throw error62;
|
|
141603
|
+
} finally {
|
|
141604
|
+
this.refreshing = void 0;
|
|
141605
|
+
}
|
|
141606
|
+
await this.refresh(void 0, !1, void 0, void 0, !move, snapshot);
|
|
141607
|
+
}
|
|
141608
|
+
applySectionMove(snapshot, move) {
|
|
141609
|
+
let archived = new Set(this.workspaces.localArchivedSessionIds()), sections = [], capability = snapshot[THREAD_SECTION_CAPABILITY], referenced = this.workspaces.sectionMemberIds(), destination = null;
|
|
141610
|
+
for (let { id: id2, name: name2, appearance, threads } of snapshot.sections) {
|
|
141611
|
+
let threadIds = [];
|
|
141612
|
+
for (let thread3 of threads)
|
|
141613
|
+
if (thread3.archived !== !0) {
|
|
141614
|
+
if (typeof thread3.id != "string" || archived.has(thread3.id) || !referenced.has(thread3.id) || !this.publishedCatalog?.has(thread3.id) || !this.threads.hasHarness(thread3.id))
|
|
141615
|
+
return !1;
|
|
141616
|
+
threadIds.push(thread3.id), thread3.id === move?.threadId && (destination = id2);
|
|
141617
|
+
}
|
|
141618
|
+
sections.push(
|
|
141619
|
+
capability && appearance !== void 0 ? { id: id2, name: name2, appearance, threadIds } : { id: id2, name: name2, threadIds }
|
|
141620
|
+
);
|
|
141621
|
+
}
|
|
141622
|
+
return (!move || destination === move.sectionId) && this.workspaces.applyThreadSectionMove(sections, capability, move?.threadId);
|
|
141623
|
+
}
|
|
141466
141624
|
refreshPins() {
|
|
141467
141625
|
return this.pins.refresh().catch((error62) => (console.error("[session/list] native pins unavailable", error62), this.workspaces.localPinnedSessionIds()));
|
|
141468
141626
|
}
|
|
@@ -141509,7 +141667,7 @@ var ChSessions = class {
|
|
|
141509
141667
|
continue;
|
|
141510
141668
|
}
|
|
141511
141669
|
let harnessId = ownership.get(id2);
|
|
141512
|
-
harnessId && (this.rows.
|
|
141670
|
+
harnessId && (this.rows.set(id2, row), this.threads.setHarness(id2, harnessId));
|
|
141513
141671
|
}
|
|
141514
141672
|
this.workspaces.addCatalogMembers(workspaceId, [...members2.keys()]);
|
|
141515
141673
|
let localArchives = new Set(this.workspaces.localArchivedSessionIds()), included = this.tree.withAncestors(members2.keys());
|
|
@@ -141530,36 +141688,46 @@ var ChSessions = class {
|
|
|
141530
141688
|
);
|
|
141531
141689
|
return { ...page, workspaceItems };
|
|
141532
141690
|
}
|
|
141533
|
-
async listAll(timing, includeArchived, archiveChanges, deletedIds, cursor) {
|
|
141534
|
-
let known = new Set(this.rows.keys()), [{ page: snapshot }, definitions, , sections] = await Promise.all([
|
|
141691
|
+
async listAll(timing, includeArchived, archiveChanges, deletedIds, cursor, sectionSnapshot) {
|
|
141692
|
+
let known = new Set(this.rows.keys()), sectionFailure, sectionsUnsupported = !1, [{ page: snapshot }, definitions, , sections] = await Promise.all([
|
|
141535
141693
|
readSessionPage(this.host, timing, includeArchived, cursor, () => this.refreshPins()),
|
|
141536
141694
|
timing.measure("project_definitions", () => this.host.projects([])),
|
|
141537
141695
|
timing.measure("thread_tree", () => this.tree.refresh()),
|
|
141538
141696
|
timing.measure("thread_sections", async () => {
|
|
141697
|
+
if (sectionSnapshot === null) {
|
|
141698
|
+
sectionsUnsupported = !0;
|
|
141699
|
+
return;
|
|
141700
|
+
}
|
|
141539
141701
|
try {
|
|
141540
|
-
return
|
|
141541
|
-
|
|
141542
|
-
)
|
|
141543
|
-
} catch {
|
|
141702
|
+
return sectionSnapshot ?? await this.readThreadSections();
|
|
141703
|
+
} catch (error62) {
|
|
141704
|
+
sectionsUnsupported = error62 instanceof SessionRuntimeError && (error62.code === "host/method-unavailable" || "hostCode" in error62.details && error62.details.hostCode === -32601), sectionsUnsupported || (sectionFailure = { error: error62 });
|
|
141544
141705
|
return;
|
|
141545
141706
|
}
|
|
141546
141707
|
})
|
|
141547
141708
|
]);
|
|
141548
141709
|
if (this.closed) return;
|
|
141549
|
-
let found = new Map(snapshot.threads.map((row) => [row.id, row])), snapshotArchives = new Set(snapshot.archivedThreadIds), archivedIds = new Set(this.workspaces.localArchivedSessionIds());
|
|
141710
|
+
let found = new Map(snapshot.threads.map((row) => [row.id, row])), headIds = cursor === void 0 && !includeArchived ? this.tree.withAncestors(found.keys()) : null, snapshotArchives = new Set(snapshot.archivedThreadIds), archivedIds = new Set(this.workspaces.localArchivedSessionIds());
|
|
141550
141711
|
for (let id2 of snapshotArchives) archivedIds.add(id2);
|
|
141551
141712
|
for (let id2 of found.keys()) snapshotArchives.has(id2) || archivedIds.delete(id2);
|
|
141552
|
-
let ownership = catalogOwnership(snapshot, found),
|
|
141713
|
+
let ownership = catalogOwnership(snapshot, found), threadSectionsV1 = sections?.[THREAD_SECTION_CAPABILITY], threadSections = sections?.sections.map(({ id: id2, name: name2, appearance, threads }) => {
|
|
141553
141714
|
let threadIds = [];
|
|
141554
|
-
for (let thread3 of threads)
|
|
141555
|
-
|
|
141556
|
-
|
|
141715
|
+
for (let thread3 of threads) {
|
|
141716
|
+
let threadId = thread3.id;
|
|
141717
|
+
if (!(typeof threadId != "string" || thread3.archived === !0)) {
|
|
141718
|
+
if (found.has(threadId)) {
|
|
141719
|
+
if (!ownership.has(threadId)) continue;
|
|
141720
|
+
} else if (thread3.modelProvider === "codexhost") {
|
|
141721
|
+
let harnessId = cursor === void 0 ? void 0 : this.threads.harnessId(threadId);
|
|
141722
|
+
if (!harnessId || harnessId === "codex") continue;
|
|
141723
|
+
} else {
|
|
141557
141724
|
let row = thread3;
|
|
141558
|
-
found.set(
|
|
141725
|
+
found.set(threadId, row), ownership.set(threadId, "codex");
|
|
141559
141726
|
}
|
|
141560
|
-
|
|
141727
|
+
thread3.archived === !1 && !snapshotArchives.has(threadId) && archivedIds.delete(threadId), threadIds.push(threadId);
|
|
141561
141728
|
}
|
|
141562
|
-
|
|
141729
|
+
}
|
|
141730
|
+
return threadSectionsV1 && appearance !== void 0 ? { id: id2, name: name2, threadIds, appearance } : { id: id2, name: name2, threadIds };
|
|
141563
141731
|
});
|
|
141564
141732
|
timing.count("ownershipIds", ownership.size), timing.count(
|
|
141565
141733
|
"archivedRows",
|
|
@@ -141577,8 +141745,6 @@ var ChSessions = class {
|
|
|
141577
141745
|
let { thread: thread3, harnessId } = await this.readThread(id2);
|
|
141578
141746
|
return ownership.set(id2, harnessId), thread3.archived === !0 && archivedIds.add(id2), thread3;
|
|
141579
141747
|
});
|
|
141580
|
-
for (let id2 of deletedIds)
|
|
141581
|
-
rows.delete(id2), ownership.delete(id2), archivedIds.delete(id2);
|
|
141582
141748
|
let assignments = await timing.measure(
|
|
141583
141749
|
"projects",
|
|
141584
141750
|
() => this.host.projects([...rows.keys()])
|
|
@@ -141587,28 +141753,48 @@ var ChSessions = class {
|
|
|
141587
141753
|
projects: definitions.projects,
|
|
141588
141754
|
...pinnedProjects !== void 0 ? { pinnedProjects } : {}
|
|
141589
141755
|
};
|
|
141590
|
-
if (
|
|
141591
|
-
|
|
141592
|
-
|
|
141593
|
-
|
|
141594
|
-
|
|
141595
|
-
|
|
141596
|
-
|
|
141597
|
-
|
|
141598
|
-
|
|
141599
|
-
|
|
141600
|
-
|
|
141601
|
-
|
|
141602
|
-
|
|
141603
|
-
|
|
141604
|
-
timing
|
|
141605
|
-
|
|
141606
|
-
|
|
141607
|
-
|
|
141608
|
-
|
|
141609
|
-
|
|
141610
|
-
|
|
141756
|
+
if (this.closed) return;
|
|
141757
|
+
for (let id2 of deletedIds)
|
|
141758
|
+
rows.delete(id2), ownership.delete(id2), archivedIds.delete(id2);
|
|
141759
|
+
for (let [id2, projectId] of this.refreshingProjectAssignments ?? []) {
|
|
141760
|
+
let row = rows.get(id2);
|
|
141761
|
+
row && (row.projectId = projectId);
|
|
141762
|
+
}
|
|
141763
|
+
if (this.threads.replaceHarnesses(ownership), this.rows = rows, this.host.realtime && this.hostOnline && !this.closed && this.syncBackgroundRunningInteractions(), timing.count("visibleRows", rows.size), await this.syncWorkspace(timing, projects), this.closed) return;
|
|
141764
|
+
let projectedSections = threadSections && (!this.workspaces.usesNativeProjects || projects.nativeProjects) ? threadSections : void 0, before = this.publishedCatalog, sectionIds = projectedSections ? new Set(projectedSections.flatMap(({ threadIds }) => threadIds)) : this.workspaces.sectionMemberIds();
|
|
141765
|
+
if (!projectedSections)
|
|
141766
|
+
for (let id2 of sectionIds) before?.has(id2) || sectionIds.delete(id2);
|
|
141767
|
+
if (await timing.measure(
|
|
141768
|
+
"catalog_publish",
|
|
141769
|
+
() => this.publishCatalogChanges(
|
|
141770
|
+
timing,
|
|
141771
|
+
headIds,
|
|
141772
|
+
sectionIds,
|
|
141773
|
+
archivedIds,
|
|
141774
|
+
archiveChanges,
|
|
141775
|
+
deletedIds
|
|
141776
|
+
)
|
|
141777
|
+
), this.closed) return;
|
|
141778
|
+
if (projectedSections) {
|
|
141779
|
+
let archived = new Set(this.workspaces.localArchivedSessionIds());
|
|
141780
|
+
this.workspaces.setReferenceThreadSections(
|
|
141781
|
+
projectedSections.map((section) => ({
|
|
141782
|
+
...section,
|
|
141783
|
+
threadIds: section.threadIds.filter(
|
|
141784
|
+
(id2) => !archived.has(id2) && !deletedIds.has(id2) && this.publishedCatalog?.has(id2)
|
|
141785
|
+
)
|
|
141786
|
+
})),
|
|
141787
|
+
definitions.projects,
|
|
141788
|
+
definitions.sectionProjects,
|
|
141789
|
+
threadSectionsV1
|
|
141790
|
+
);
|
|
141791
|
+
} else (sectionsUnsupported || threadSections && !threadSectionsV1) && this.workspaces.setReferenceThreadSections(void 0);
|
|
141792
|
+
let pageIds = new Set(snapshot.threads.map(({ id: id2 }) => id2));
|
|
141793
|
+
for (let id2 of sectionIds) {
|
|
141794
|
+
let row = rows.get(id2);
|
|
141795
|
+
row && this.publishedCatalog?.has(id2) && (cursor === void 0 || !before?.has(id2)) && !pageIds.has(id2) && snapshot.threads.push(row);
|
|
141611
141796
|
}
|
|
141797
|
+
return this.catalogReadAt = Date.now(), { ...snapshot, sectionFailure };
|
|
141612
141798
|
}
|
|
141613
141799
|
async syncWorkspace(timing = new SessionListTiming(), snapshot) {
|
|
141614
141800
|
let projects = snapshot ?? await timing.measure("projects", () => this.host.projects([...this.rows.keys()]));
|
|
@@ -141679,33 +141865,51 @@ var ChSessions = class {
|
|
|
141679
141865
|
codexhostImportSource: row.codexhostImportSource ?? null
|
|
141680
141866
|
};
|
|
141681
141867
|
}
|
|
141682
|
-
async publishCatalogChanges(
|
|
141683
|
-
let before = this.publishedCatalog, next = new Map(
|
|
141684
|
-
|
|
141685
|
-
|
|
141686
|
-
|
|
141687
|
-
|
|
141688
|
-
|
|
141689
|
-
|
|
141690
|
-
|
|
141691
|
-
|
|
141692
|
-
let
|
|
141693
|
-
|
|
141694
|
-
|
|
141695
|
-
|
|
141696
|
-
|
|
141697
|
-
|
|
141698
|
-
|
|
141699
|
-
|
|
141700
|
-
|
|
141868
|
+
async publishCatalogChanges(timing, headIds, sectionIds, archivedIds, archiveChanges, deletedIds) {
|
|
141869
|
+
let before = this.publishedCatalog, next = /* @__PURE__ */ new Map(), changed = [];
|
|
141870
|
+
for (let row of this.rows.values()) {
|
|
141871
|
+
let priorKey = before?.get(row.id), sectionMember = sectionIds.has(row.id);
|
|
141872
|
+
if (!sectionMember) {
|
|
141873
|
+
if (headIds === null) {
|
|
141874
|
+
if (priorKey === void 0) continue;
|
|
141875
|
+
} else if (!headIds.has(row.id))
|
|
141876
|
+
continue;
|
|
141877
|
+
}
|
|
141878
|
+
let key = this.catalogKey(row);
|
|
141879
|
+
next.set(row.id, key), priorKey !== key && (before || sectionMember) && changed.push(row);
|
|
141880
|
+
}
|
|
141881
|
+
let summaries = await Promise.all(changed.map((row) => this.summary(row)));
|
|
141882
|
+
if (!this.closed) {
|
|
141883
|
+
for (let [id2, archived] of archiveChanges)
|
|
141884
|
+
archived ? archivedIds.add(id2) : archivedIds.delete(id2);
|
|
141885
|
+
for (let id2 of deletedIds)
|
|
141886
|
+
archivedIds.delete(id2), next.delete(id2);
|
|
141887
|
+
for (let id2 of archivedIds) next.delete(id2);
|
|
141888
|
+
timing.measureSync(
|
|
141889
|
+
"archive_sync",
|
|
141890
|
+
() => this.workspaces.setReferenceArchives([...archivedIds].sort())
|
|
141891
|
+
), this.publishedCatalog = next;
|
|
141892
|
+
for (let [id2, row] of this.rows) {
|
|
141893
|
+
let log46 = this.threads.view(id2)?.log;
|
|
141894
|
+
if (log46)
|
|
141701
141895
|
for (let [key, value] of Object.entries(this.catalogProjections(row)))
|
|
141702
|
-
|
|
141703
|
-
sink.push({ type: "projection", sessionId, key, value, seq: seq2 });
|
|
141896
|
+
log46.setProjection(key, value);
|
|
141704
141897
|
}
|
|
141705
|
-
|
|
141706
|
-
|
|
141707
|
-
|
|
141708
|
-
|
|
141898
|
+
if (this.controls.size > 0)
|
|
141899
|
+
for (let { sessionId } of summaries) {
|
|
141900
|
+
if (!next.has(sessionId)) continue;
|
|
141901
|
+
let row = this.rows.get(sessionId), seq2 = row ? this.threads.reserveDroppedProjectionSeq(sessionId) : void 0;
|
|
141902
|
+
if (!(!row || seq2 === void 0))
|
|
141903
|
+
for (let [key, value] of Object.entries(this.catalogProjections(row)))
|
|
141904
|
+
for (let sink of this.controls)
|
|
141905
|
+
sink.push({ type: "projection", sessionId, key, value, seq: seq2 });
|
|
141906
|
+
}
|
|
141907
|
+
for (let row of summaries)
|
|
141908
|
+
next.has(row.sessionId) && this.events.emit("api-session/added", row);
|
|
141909
|
+
if (before)
|
|
141910
|
+
for (let id2 of before.keys())
|
|
141911
|
+
this.rows.has(id2) || (this.handoffs.delete(id2), this.events.emit("api-session/removed", id2));
|
|
141912
|
+
}
|
|
141709
141913
|
}
|
|
141710
141914
|
async owner(id2) {
|
|
141711
141915
|
let resolved = this.id(id2);
|
|
@@ -142038,7 +142242,7 @@ var ChSessions = class {
|
|
|
142038
142242
|
);
|
|
142039
142243
|
thread3.projectId = updated.thread.projectId, this.refreshingProjectAssignments?.set(thread3.id, draft.projectId);
|
|
142040
142244
|
}
|
|
142041
|
-
return draft.canonicalId = thread3.id, this.files?.bind(draft.id, thread3.id), this.rows.set(thread3.id, thread3), this.threads.setHarness(thread3.id, harnessId), this.workspaces.detachSession(draft.id), this.workspaces.usesNativeProjects ? this.workspaces.updateNativeProjectMember(thread3.id, draft.projectId) : draft.cwd ? (this.workspaces.selectReferenceWorkspace(draft.cwd), this.workspaces.attachReferencedSession(thread3.id, thread3.cwd), this.workspaces.addDraftReference(thread3.id, draft.cwd)) : this.workspaces.addDraftReference(thread3.id, void 0), this.events.emit("api-session/added", await this.summary(thread3)), this.publishedCatalog?.set(thread3.id, this.catalogKey(thread3)), this.events.emit("codexhost/session-bound", draft.id, thread3.id), this.events.emit("api-session/removed", draft.id), thread3.id;
|
|
142245
|
+
return draft.canonicalId = thread3.id, this.files?.bind(draft.id, thread3.id), this.rows.set(thread3.id, thread3), this.threads.setHarness(thread3.id, harnessId), this.workspaces.detachSession(draft.id), this.workspaces.usesNativeProjects ? this.workspaces.updateNativeProjectMember(thread3.id, draft.projectId) : draft.cwd ? (this.workspaces.selectReferenceWorkspace(draft.cwd), this.workspaces.attachReferencedSession(thread3.id, thread3.cwd), this.workspaces.addDraftReference(thread3.id, draft.cwd)) : this.workspaces.addDraftReference(thread3.id, void 0), this.events.emit("api-session/added", await this.summary(thread3)), this.workspaces.isArchived(thread3.id) || this.publishedCatalog?.set(thread3.id, this.catalogKey(thread3)), this.events.emit("codexhost/session-bound", draft.id, thread3.id), this.events.emit("api-session/removed", draft.id), thread3.id;
|
|
142042
142246
|
}
|
|
142043
142247
|
/**
|
|
142044
142248
|
* Working directory of one Host-confirmed local Thread.
|
|
@@ -142147,7 +142351,7 @@ var ChSessions = class {
|
|
|
142147
142351
|
forgetDeleted(id2) {
|
|
142148
142352
|
this.refreshingDeletedIds?.add(id2), this.archiveOperations.delete(id2), this.queueOperations.delete(id2), this.titleRequests.delete(id2), this.syncedRunningInteractions.delete(id2);
|
|
142149
142353
|
let activeRead = this.interactionReads.get(id2);
|
|
142150
|
-
activeRead && (activeRead.cancelled = !0, activeRead.dirty = !1, this.interactionReads.delete(id2)), this.interactions?.clearSession(id2), this.
|
|
142354
|
+
activeRead && (activeRead.cancelled = !0, activeRead.dirty = !1, this.interactionReads.delete(id2)), this.interactions?.clearSession(id2), this.rows.delete(id2), this.handoffs.delete(id2), this.threads.delete(id2), this.tree.forget(id2);
|
|
142151
142355
|
let archived = this.workspaces.localArchivedSessionIds();
|
|
142152
142356
|
archived.includes(id2) && this.workspaces.setReferenceArchives(archived.filter((item) => item !== id2));
|
|
142153
142357
|
let pinned = this.workspaces.localPinnedSessionIds();
|
|
@@ -142164,9 +142368,9 @@ var ChSessions = class {
|
|
|
142164
142368
|
});
|
|
142165
142369
|
}
|
|
142166
142370
|
updateArchive(id2, archived) {
|
|
142167
|
-
this.refreshingArchiveChanges?.set(id2, archived);
|
|
142371
|
+
this.archiveRevision++, this.refreshingArchiveChanges?.set(id2, archived);
|
|
142168
142372
|
let ids = new Set(this.workspaces.localArchivedSessionIds());
|
|
142169
|
-
archived ? ids.add(id2) : ids.delete(id2), this.workspaces.setReferenceArchives([...ids].sort());
|
|
142373
|
+
archived ? (ids.add(id2), this.publishedCatalog?.delete(id2)) : ids.delete(id2), this.workspaces.setReferenceArchives([...ids].sort());
|
|
142170
142374
|
}
|
|
142171
142375
|
async setArchived(sessionId, archived) {
|
|
142172
142376
|
let id2 = this.id(sessionId), operation = /* @__PURE__ */ Symbol();
|
|
@@ -142255,21 +142459,49 @@ var ChSessions = class {
|
|
|
142255
142459
|
return await this.pins.sync({ threadId: id2, pinned }), await this.refresh().catch(() => {
|
|
142256
142460
|
}), { pinnedSessionIds: this.workspaces.pinnedSessionIds() };
|
|
142257
142461
|
});
|
|
142462
|
+
for (let [method2, mutation] of [
|
|
142463
|
+
["workspace/createThreadSection", CLIENT_THREAD_SECTION_MUTATIONS.create],
|
|
142464
|
+
["workspace/updateThreadSection", CLIENT_THREAD_SECTION_MUTATIONS.update],
|
|
142465
|
+
["workspace/deleteThreadSection", CLIENT_THREAD_SECTION_MUTATIONS.delete]
|
|
142466
|
+
])
|
|
142467
|
+
rpc2.register(method2, async (args) => {
|
|
142468
|
+
let params = mutation.params.safeParse(requestOf(args));
|
|
142469
|
+
if (!params.success)
|
|
142470
|
+
throw new SessionRuntimeError("workspace/section-invalid", "Invalid Thread section request.");
|
|
142471
|
+
let value = await this.host.request(mutation.method, params.data).catch((error62) => {
|
|
142472
|
+
if (error62 instanceof SessionRuntimeError) {
|
|
142473
|
+
let { code, details } = error62, hostCode = "hostCode" in details ? details.hostCode : void 0;
|
|
142474
|
+
if (code === "host/disconnected" || code === "host/resync" || code === "remote/offline" || code === "host/rejected" && (hostCode === -32093 || hostCode === -32094))
|
|
142475
|
+
return { status: "unknown" };
|
|
142476
|
+
}
|
|
142477
|
+
throw error62;
|
|
142478
|
+
}), result = clientThreadSectionMutationResultSchema.safeParse(value);
|
|
142479
|
+
return await this.refreshAfterCurrent().catch(() => {
|
|
142480
|
+
}), result.success ? result.data : { status: "unknown" };
|
|
142481
|
+
});
|
|
142258
142482
|
rpc2.register("workspace/moveSessionToSection", async (args) => {
|
|
142259
142483
|
let input3 = requestOf(args), move = clientThreadSectionMoveSchema.safeParse({
|
|
142260
142484
|
threadId: input3.sessionId,
|
|
142261
|
-
sectionId: input3.sectionId
|
|
142485
|
+
sectionId: input3.sectionId,
|
|
142486
|
+
beforeThreadId: input3.beforeSessionId,
|
|
142487
|
+
expectedSourceSectionId: input3.expectedSourceSectionId
|
|
142262
142488
|
});
|
|
142263
142489
|
if (!move.success)
|
|
142264
142490
|
throw new SessionRuntimeError("workspace/section-invalid", "Invalid Thread section move.");
|
|
142265
|
-
let {
|
|
142266
|
-
if (
|
|
142491
|
+
let { sectionId, beforeThreadId, expectedSourceSectionId } = move.data, id2 = this.id(move.data.threadId), before = typeof beforeThreadId == "string" ? this.id(beforeThreadId) : beforeThreadId;
|
|
142492
|
+
if (typeof before == "string" && (sectionId === null || before === id2))
|
|
142493
|
+
throw new SessionRuntimeError("workspace/section-invalid", "Invalid Thread section anchor.");
|
|
142494
|
+
if (this.drafts.has(id2) || !this.threads.hasHarness(id2) || this.rows.get(id2)?.parentThreadId || this.workspaces.isArchived(id2) || this.workspaces.pinnedSessionIds().includes(id2) || sectionId !== null && !this.workspaces.hasThreadSection(sectionId))
|
|
142267
142495
|
throw new SessionRuntimeError(
|
|
142268
142496
|
"workspace/section-unavailable",
|
|
142269
142497
|
"This Thread or section is unavailable for a move."
|
|
142270
142498
|
);
|
|
142271
|
-
return await this.host.request("codexhost/thread/sections/move",
|
|
142272
|
-
|
|
142499
|
+
return await this.host.request("codexhost/thread/sections/move", {
|
|
142500
|
+
threadId: id2,
|
|
142501
|
+
sectionId,
|
|
142502
|
+
...before === void 0 ? {} : { beforeThreadId: before },
|
|
142503
|
+
...expectedSourceSectionId === void 0 ? {} : { expectedSourceSectionId }
|
|
142504
|
+
}), await this.refreshSectionMove({ threadId: id2, sectionId }).catch(() => {
|
|
142273
142505
|
}), { sectionId };
|
|
142274
142506
|
}), rpc2.register("session/list", async (args, context) => {
|
|
142275
142507
|
let {
|
|
@@ -143250,6 +143482,9 @@ var exec3 = promisify7(execFile6), METHODS = /* @__PURE__ */ new Set([
|
|
|
143250
143482
|
"codexhost/thread/pins/list",
|
|
143251
143483
|
"codexhost/thread/sections/list",
|
|
143252
143484
|
"codexhost/thread/sections/move",
|
|
143485
|
+
CLIENT_THREAD_SECTION_MUTATIONS.create.method,
|
|
143486
|
+
CLIENT_THREAD_SECTION_MUTATIONS.update.method,
|
|
143487
|
+
CLIENT_THREAD_SECTION_MUTATIONS.delete.method,
|
|
143253
143488
|
"codexhost/thread/pins/set",
|
|
143254
143489
|
"codexhost/harness/display-settings/get",
|
|
143255
143490
|
"codexhost/harness/display-settings/set",
|
|
@@ -143502,7 +143737,7 @@ async function serveChClientGateway(host, request3, response, { authenticated =
|
|
|
143502
143737
|
let after = url2.searchParams.has("epoch") ? clientChannelCursorSchema.parse({
|
|
143503
143738
|
epoch: url2.searchParams.get("epoch"),
|
|
143504
143739
|
sequence: Number(url2.searchParams.get("after"))
|
|
143505
|
-
}) : void 0, stop = channel.subscribe((event) => {
|
|
143740
|
+
}) : void 0, supportsSections = url2.searchParams.get(THREAD_SECTION_CAPABILITY) === "1", stop = channel.subscribe((event) => {
|
|
143506
143741
|
if (event.type === "connection") {
|
|
143507
143742
|
!event.online && !response.writableEnded && !response.destroyed && (response.headersSent ? response.end() : response.writeHead(503, {
|
|
143508
143743
|
"content-type": "application/json; charset=utf-8",
|
|
@@ -143510,17 +143745,17 @@ async function serveChClientGateway(host, request3, response, { authenticated =
|
|
|
143510
143745
|
}).end(JSON.stringify({ error: { code: -32090, message: "CH is reconnecting" } })));
|
|
143511
143746
|
return;
|
|
143512
143747
|
}
|
|
143513
|
-
if (
|
|
143514
|
-
|
|
143515
|
-
|
|
143516
|
-
|
|
143517
|
-
|
|
143518
|
-
|
|
143519
|
-
|
|
143520
|
-
}
|
|
143521
|
-
response.write(JSON.stringify(event) + `
|
|
143522
|
-
`);
|
|
143748
|
+
if (response.destroyed || response.writableEnded) return;
|
|
143749
|
+
if (response.headersSent || response.writeHead(200, {
|
|
143750
|
+
"content-type": "application/x-ndjson",
|
|
143751
|
+
"cache-control": "no-store"
|
|
143752
|
+
}), response.writableLength > 256 * 1024) {
|
|
143753
|
+
response.destroy();
|
|
143754
|
+
return;
|
|
143523
143755
|
}
|
|
143756
|
+
let frame = event.type === "sections-changed" && !supportsSections ? { type: "hello", version: 1, cursor: event.cursor, reset: !0 } : event;
|
|
143757
|
+
response.write(JSON.stringify(frame) + `
|
|
143758
|
+
`);
|
|
143524
143759
|
}, after), heartbeat = setInterval(() => {
|
|
143525
143760
|
response.headersSent && !response.writableEnded && response.write(`
|
|
143526
143761
|
`);
|
|
@@ -144939,7 +145174,7 @@ async function snapshotPackagedHost(distribution, data2) {
|
|
|
144939
145174
|
|
|
144940
145175
|
// packages/web-server/src/main.ts
|
|
144941
145176
|
var RELEASE_WEB = !0, DISTRIBUTION_ROOT = resolve25(import.meta.dirname, ".."), PACKED_WEB = join36(DISTRIBUTION_ROOT, "web"), PACKED = existsSync16(join36(PACKED_WEB, "plugins.json")), REPO_ROOT = resolve25(import.meta.dirname, "../../.."), SERVER_VERSION = resolveServerVersion(
|
|
144942
|
-
"0.
|
|
145177
|
+
"0.31.0",
|
|
144943
145178
|
[join36(DISTRIBUTION_ROOT, "package.json"), join36(REPO_ROOT, "package.json")]
|
|
144944
145179
|
);
|
|
144945
145180
|
if (PACKED) {
|