@codexhost/cli-win32-arm64 0.26.1 → 0.27.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 +561 -322
- package/app/console-web.js +543 -369
- package/app/desktop-controller.mjs +385 -243
- package/app/host-runtime.mjs +7774 -3488
- package/app/plugins/antigravity/plugin.mjs +8669 -417
- package/app/plugins/claude-code/plugin.mjs +736 -393
- package/app/plugins/codebuddy/plugin.mjs +388 -233
- package/app/plugins/codex-usage/plugin.mjs +363 -230
- package/app/plugins/copilot/plugin.mjs +388 -233
- package/app/plugins/cursor-cli/plugin.mjs +363 -230
- package/app/plugins/deepseek-harness/plugin.mjs +388 -233
- package/app/plugins/devin/plugin.mjs +363 -230
- package/app/plugins/grok/plugin.mjs +363 -230
- package/app/plugins/hermes/plugin.mjs +363 -230
- package/app/plugins/kimi-code/plugin.mjs +492 -270
- package/app/plugins/kiro-cli/plugin.mjs +363 -230
- package/app/plugins/omp/plugin.mjs +363 -230
- package/app/plugins/opencode/manifest.json +1 -1
- package/app/plugins/opencode/plugin.mjs +439 -248
- package/app/plugins/pi/plugin.mjs +363 -230
- package/app/plugins/qoder/plugin.mjs +363 -230
- package/app/plugins/qoder-cn/plugin.mjs +363 -230
- package/app/plugins/qwen-code/plugin.mjs +363 -230
- package/app/plugins/workbuddy/plugin.mjs +383 -245
- package/app/plugins/zcode/plugin.mjs +363 -230
- package/app/renderer-extension.js +2071 -555
- package/app/web/assets/index-D9l7_ThH.js +199 -0
- package/app/web/assets/index-nw2RXcDu.css +1 -0
- package/app/web/codexhost-settings.js +67 -67
- package/app/web/index.html +2 -2
- package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +8 -8
- package/app/web/plugins/deepseek-ai__dsh-client-shortcuts/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-approval/client.js +4 -1
- 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 +19 -19
- package/app/web/plugins/deepseek-ai__dsh-client-ui-layout/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-model-selection/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-settings-general/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-shortcuts/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-right/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +18 -18
- package/app/web/plugins/deepseek-ai__dsh-client-ui-user-questions/client.js +4 -4
- package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +71 -71
- package/app/web/plugins.json +2 -1
- package/app/web-modules/server.mjs +2884 -1128
- package/bin/codexhost.exe +0 -0
- package/libexec/codexhost-node-repl.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/index-CR4Y8Ndj.css +0 -1
- package/app/web/assets/index-Dw-yHAxN.js +0 -196
|
@@ -20120,6 +20120,38 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
20120
20120
|
// ../shared-contracts/dist/harness-route-limit.js
|
|
20121
20121
|
var HARNESS_TRANSPORT_MODEL_ID_MAX_LENGTH = 8192;
|
|
20122
20122
|
|
|
20123
|
+
// ../shared-contracts/dist/thread-handoff.js
|
|
20124
|
+
var nonBlankTextSchema2 = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
20125
|
+
message: "Value must not be empty or whitespace"
|
|
20126
|
+
});
|
|
20127
|
+
var THREAD_HANDOFF_METHOD = "codexhost/thread/handoff";
|
|
20128
|
+
var threadHandoffParamsSchema = external_exports.object({
|
|
20129
|
+
sourceThreadId: hostThreadIdSchema,
|
|
20130
|
+
lastTurnId: hostTurnIdSchema.optional(),
|
|
20131
|
+
targetHarnessId: harnessIdSchema,
|
|
20132
|
+
targetModel: nonBlankTextSchema2.max(1024).optional(),
|
|
20133
|
+
targetThinkingOptionId: nonBlankTextSchema2.max(128).regex(/^[A-Za-z0-9._~-]+$/u, "Thinking option ID must use transport-safe characters").optional()
|
|
20134
|
+
}).strict();
|
|
20135
|
+
var threadHandoffMetadataSchema = external_exports.object({
|
|
20136
|
+
sourceThreadId: hostThreadIdSchema,
|
|
20137
|
+
sourceHarnessId: harnessIdSchema,
|
|
20138
|
+
sourceHarnessLabel: nonBlankTextSchema2.max(256).optional(),
|
|
20139
|
+
sourceModel: nonBlankTextSchema2.max(1024).optional(),
|
|
20140
|
+
targetHarnessId: harnessIdSchema,
|
|
20141
|
+
targetHarnessLabel: nonBlankTextSchema2.max(256).optional(),
|
|
20142
|
+
targetModel: nonBlankTextSchema2.max(1024).optional(),
|
|
20143
|
+
totalTurns: external_exports.number().int().min(1),
|
|
20144
|
+
boundaryTurnNumber: external_exports.number().int().min(1),
|
|
20145
|
+
includedTurnNumbers: external_exports.array(external_exports.number().int().min(1)),
|
|
20146
|
+
omittedTurns: external_exports.number().int().min(0),
|
|
20147
|
+
preview: external_exports.string().max(32e3),
|
|
20148
|
+
createdAtMs: external_exports.number().int().nonnegative()
|
|
20149
|
+
}).strict();
|
|
20150
|
+
var threadHandoffResultSchema = external_exports.object({
|
|
20151
|
+
threadId: hostThreadIdSchema,
|
|
20152
|
+
handoff: threadHandoffMetadataSchema
|
|
20153
|
+
}).strict();
|
|
20154
|
+
|
|
20123
20155
|
// ../shared-contracts/dist/thread-usage.js
|
|
20124
20156
|
var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
|
|
20125
20157
|
var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
|
|
@@ -20303,7 +20335,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
20303
20335
|
var HARNESS_MODEL_LABEL_MAX_LENGTH = 256;
|
|
20304
20336
|
var HARNESS_THINKING_OPTION_ID_MAX_LENGTH = 128;
|
|
20305
20337
|
var THREAD_OWNERSHIP_LIST_MAX_LENGTH = 100;
|
|
20306
|
-
var
|
|
20338
|
+
var nonBlankTextSchema3 = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
20307
20339
|
message: "Value must not be empty or whitespace"
|
|
20308
20340
|
});
|
|
20309
20341
|
var harnessModelRefIdSchema = external_exports.string().min(1).max(HARNESS_MODEL_REF_MAX_LENGTH).refine((id2) => !/\p{Cc}/u.test(id2), "Model Ref must not contain control characters").brand();
|
|
@@ -20322,15 +20354,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
20322
20354
|
const separator = key2.indexOf("");
|
|
20323
20355
|
return harnessModelRefSchema.parse(separator === -1 ? { id: key2 } : { id: key2.slice(0, separator), serviceTier: key2.slice(separator + 1) });
|
|
20324
20356
|
}
|
|
20325
|
-
var harnessThinkingOptionIdSchema =
|
|
20326
|
-
var harnessResolvedModelLabelSchema =
|
|
20357
|
+
var harnessThinkingOptionIdSchema = nonBlankTextSchema3.max(HARNESS_THINKING_OPTION_ID_MAX_LENGTH).regex(/^[A-Za-z0-9._~-]+$/u, "Thinking option ID must use transport-safe characters").brand();
|
|
20358
|
+
var harnessResolvedModelLabelSchema = nonBlankTextSchema3.max(HARNESS_MODEL_LABEL_MAX_LENGTH);
|
|
20327
20359
|
var harnessThinkingOptionSchema = external_exports.object({
|
|
20328
20360
|
id: harnessThinkingOptionIdSchema,
|
|
20329
|
-
label:
|
|
20361
|
+
label: nonBlankTextSchema3.max(HARNESS_MODEL_LABEL_MAX_LENGTH)
|
|
20330
20362
|
}).strict();
|
|
20331
20363
|
var harnessModelSchema = external_exports.object({
|
|
20332
20364
|
ref: harnessModelRefSchema,
|
|
20333
|
-
label:
|
|
20365
|
+
label: nonBlankTextSchema3.max(HARNESS_MODEL_LABEL_MAX_LENGTH),
|
|
20334
20366
|
resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
|
|
20335
20367
|
/** Optional opaque selection for this same Model with priority processing enabled. */
|
|
20336
20368
|
fastModel: harnessModelRefSchema.optional(),
|
|
@@ -20498,7 +20530,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
20498
20530
|
]);
|
|
20499
20531
|
var harnessInspectParamsSchema = external_exports.object({
|
|
20500
20532
|
harnessId: harnessIdSchema,
|
|
20501
|
-
cwd:
|
|
20533
|
+
cwd: nonBlankTextSchema3.max(16384).optional(),
|
|
20502
20534
|
refresh: external_exports.boolean().optional(),
|
|
20503
20535
|
/** `availability` asks only whether the Harness can run; see `InspectHarnessInput.purpose`. */
|
|
20504
20536
|
purpose: external_exports.literal("availability").optional(),
|
|
@@ -20528,12 +20560,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
20528
20560
|
effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
20529
20561
|
effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
|
|
20530
20562
|
history: harnessHistoryCapabilitiesSchema.optional(),
|
|
20531
|
-
supportsThreadReferences: external_exports.literal(true).optional()
|
|
20563
|
+
supportsThreadReferences: external_exports.literal(true).optional(),
|
|
20564
|
+
handoff: threadHandoffMetadataSchema.optional()
|
|
20532
20565
|
}).strict();
|
|
20533
20566
|
var externalThreadInspectionSchema = external_exports.object({
|
|
20534
20567
|
owner: external_exports.literal("external"),
|
|
20535
|
-
harnessId:
|
|
20536
|
-
transportModelId:
|
|
20568
|
+
harnessId: nonBlankTextSchema3.max(256),
|
|
20569
|
+
transportModelId: nonBlankTextSchema3.max(HARNESS_TRANSPORT_MODEL_ID_MAX_LENGTH),
|
|
20537
20570
|
effectiveModel: harnessModelRefSchema.optional(),
|
|
20538
20571
|
resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
|
|
20539
20572
|
effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
@@ -20543,6 +20576,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
20543
20576
|
catalog: harnessModelCatalogSchema.optional(),
|
|
20544
20577
|
history: harnessHistoryCapabilitiesSchema,
|
|
20545
20578
|
usage: threadUsageSnapshotSchema.optional(),
|
|
20579
|
+
handoff: threadHandoffMetadataSchema.optional(),
|
|
20546
20580
|
locked: external_exports.literal(true)
|
|
20547
20581
|
}).strict();
|
|
20548
20582
|
var threadInspectionSchema = external_exports.discriminatedUnion("owner", [
|
|
@@ -21257,6 +21291,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
21257
21291
|
"codexhost/harness/preferences/get",
|
|
21258
21292
|
"codexhost/harness/preferences/patch",
|
|
21259
21293
|
"thread/list",
|
|
21294
|
+
"thread/metadata/update",
|
|
21260
21295
|
"codexhost/thread/catalog/read",
|
|
21261
21296
|
"thread/read",
|
|
21262
21297
|
"thread/resume",
|
|
@@ -21281,6 +21316,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
21281
21316
|
"thread/queue/start",
|
|
21282
21317
|
"codexhost/thread/queue/send-now",
|
|
21283
21318
|
"codexhost/workspace/read",
|
|
21319
|
+
"project/create",
|
|
21320
|
+
"project/update",
|
|
21321
|
+
"project/delete",
|
|
21322
|
+
"project/move",
|
|
21284
21323
|
"codexhost/thread/tree/read",
|
|
21285
21324
|
"codexhost/thread/pins/list",
|
|
21286
21325
|
"codexhost/thread/sections/list",
|
|
@@ -21298,6 +21337,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
21298
21337
|
"codexhost/harness/commands/inspect",
|
|
21299
21338
|
"codexhost/thread/command/execute",
|
|
21300
21339
|
"codexhost/thread/fork",
|
|
21340
|
+
THREAD_HANDOFF_METHOD,
|
|
21301
21341
|
"codexhost/harness/session-import/sources",
|
|
21302
21342
|
"codexhost/harness/session-import/list",
|
|
21303
21343
|
"codexhost/harness/session-import/import",
|
|
@@ -21349,6 +21389,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
21349
21389
|
}).strict();
|
|
21350
21390
|
var clientWorkspaceSnapshotSchema = external_exports.object({
|
|
21351
21391
|
projects: external_exports.array(external_exports.object({ id: external_exports.string(), name: external_exports.string(), rootPaths: external_exports.array(external_exports.string()) })),
|
|
21392
|
+
nativeProjects: external_exports.literal(true).optional(),
|
|
21352
21393
|
assignments: external_exports.record(external_exports.string(), external_exports.string()),
|
|
21353
21394
|
projectless: external_exports.array(external_exports.string()),
|
|
21354
21395
|
/** Canonical external pin membership; pins/list provides the native merged order. */
|
|
@@ -21363,6 +21404,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
21363
21404
|
sequence: external_exports.number().int().nonnegative()
|
|
21364
21405
|
});
|
|
21365
21406
|
var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
|
|
21407
|
+
external_exports.object({ type: external_exports.literal("projects-changed"), cursor: clientChannelCursorSchema }),
|
|
21366
21408
|
external_exports.object({
|
|
21367
21409
|
type: external_exports.literal("skills-changed"),
|
|
21368
21410
|
cursor: clientChannelCursorSchema,
|
|
@@ -21526,7 +21568,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
21526
21568
|
items: external_exports.array(clientQueuedSubmissionSchema),
|
|
21527
21569
|
pausedReason: external_exports.enum(["interrupted", "outcome-unknown", "failed"]).nullable()
|
|
21528
21570
|
}).optional(),
|
|
21529
|
-
interactions: external_exports.array(clientInteractionSchema)
|
|
21571
|
+
interactions: external_exports.array(clientInteractionSchema),
|
|
21572
|
+
handoff: threadHandoffMetadataSchema.optional()
|
|
21530
21573
|
});
|
|
21531
21574
|
var clientChannelDescriptorSchema = external_exports.object({
|
|
21532
21575
|
version: external_exports.literal(CLIENT_CHANNEL_VERSION),
|
|
@@ -21535,7 +21578,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
21535
21578
|
port: external_exports.number().int().min(1).max(65535),
|
|
21536
21579
|
token: external_exports.string().regex(/^[0-9a-f]{64}$/u),
|
|
21537
21580
|
startedAt: external_exports.number(),
|
|
21538
|
-
epoch: external_exports.string().uuid()
|
|
21581
|
+
epoch: external_exports.string().uuid(),
|
|
21582
|
+
capabilities: external_exports.object({
|
|
21583
|
+
peerDelegation: external_exports.literal(1).optional()
|
|
21584
|
+
}).optional()
|
|
21539
21585
|
});
|
|
21540
21586
|
var clientChannelResponseSchema = external_exports.object({
|
|
21541
21587
|
epoch: external_exports.string().uuid(),
|
|
@@ -21554,10 +21600,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
21554
21600
|
* `excludeCwds` folder, the branch ends, or a page bound is reached. Every row read is
|
|
21555
21601
|
* returned, so the native cursors stay contiguous.
|
|
21556
21602
|
*/
|
|
21557
|
-
scope: external_exports.
|
|
21558
|
-
|
|
21559
|
-
|
|
21560
|
-
|
|
21603
|
+
scope: external_exports.union([
|
|
21604
|
+
external_exports.object({
|
|
21605
|
+
cwd: external_exports.string().min(1).max(4096),
|
|
21606
|
+
excludeCwds: external_exports.array(external_exports.string().min(1).max(4096)).max(1024)
|
|
21607
|
+
}).strict(),
|
|
21608
|
+
external_exports.object({
|
|
21609
|
+
projectId: external_exports.string().min(1).max(1024),
|
|
21610
|
+
legacyThreadIds: external_exports.array(external_exports.string().min(1).max(1024)).max(1024),
|
|
21611
|
+
/** Roots whose Threads without a project ID belong to this project, as on Desktop. */
|
|
21612
|
+
rootPaths: external_exports.array(external_exports.string().min(1).max(4096)).max(1024).optional()
|
|
21613
|
+
}).strict()
|
|
21614
|
+
]).optional()
|
|
21561
21615
|
}).strict();
|
|
21562
21616
|
var threadCatalogReadResultSchema = external_exports.object({
|
|
21563
21617
|
threads: external_exports.array(jsonObjectSchema),
|
|
@@ -21793,6 +21847,283 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
21793
21847
|
to: external_exports.number().int().min(1).max(Number.MAX_SAFE_INTEGER).optional()
|
|
21794
21848
|
});
|
|
21795
21849
|
|
|
21850
|
+
// ../shared-contracts/dist/remote-peers.js
|
|
21851
|
+
var REMOTE_PEER_ID_PATTERN = /^[a-zA-Z0-9_-]{1,64}$/u;
|
|
21852
|
+
var remotePeerIdSchema = external_exports.string().regex(REMOTE_PEER_ID_PATTERN);
|
|
21853
|
+
var remotePeerHostIdSchema = external_exports.string().regex(/^remote-peer:[a-zA-Z0-9_-]{1,64}$/u);
|
|
21854
|
+
var remotePeerTransportKindSchema = external_exports.enum(["relay", "tailscale", "lan", "custom"]);
|
|
21855
|
+
var REMOTE_PEER_COLORS = [
|
|
21856
|
+
"blue",
|
|
21857
|
+
"purple",
|
|
21858
|
+
"cyan",
|
|
21859
|
+
"green",
|
|
21860
|
+
"amber",
|
|
21861
|
+
"rose",
|
|
21862
|
+
"slate"
|
|
21863
|
+
];
|
|
21864
|
+
var remotePeerColorSchema = external_exports.enum(REMOTE_PEER_COLORS);
|
|
21865
|
+
var REMOTE_PEER_COLOR_SET = new Set(REMOTE_PEER_COLORS);
|
|
21866
|
+
var remotePeerStateSchema = external_exports.enum([
|
|
21867
|
+
"connected",
|
|
21868
|
+
"connecting",
|
|
21869
|
+
"auth-error",
|
|
21870
|
+
"offline",
|
|
21871
|
+
"disabled"
|
|
21872
|
+
]);
|
|
21873
|
+
var remotePeerSummarySchema = external_exports.object({
|
|
21874
|
+
peerId: remotePeerIdSchema,
|
|
21875
|
+
hostId: remotePeerHostIdSchema,
|
|
21876
|
+
name: external_exports.string().min(1).max(120),
|
|
21877
|
+
color: remotePeerColorSchema.optional(),
|
|
21878
|
+
origin: external_exports.string().min(1).max(2048),
|
|
21879
|
+
transportKind: remotePeerTransportKindSchema,
|
|
21880
|
+
encrypted: external_exports.boolean(),
|
|
21881
|
+
enabled: external_exports.boolean(),
|
|
21882
|
+
state: remotePeerStateSchema,
|
|
21883
|
+
latencyMs: external_exports.number().int().nonnegative().optional(),
|
|
21884
|
+
version: external_exports.string().max(128).optional(),
|
|
21885
|
+
platform: external_exports.string().max(64).optional(),
|
|
21886
|
+
hostname: external_exports.string().max(255).optional(),
|
|
21887
|
+
homeDir: external_exports.string().max(4096).optional(),
|
|
21888
|
+
lastError: external_exports.string().max(1e3).optional(),
|
|
21889
|
+
projectCount: external_exports.number().int().nonnegative(),
|
|
21890
|
+
createdAt: external_exports.string(),
|
|
21891
|
+
updatedAt: external_exports.string()
|
|
21892
|
+
});
|
|
21893
|
+
var remotePeerListResultSchema = external_exports.object({
|
|
21894
|
+
peers: external_exports.array(remotePeerSummarySchema)
|
|
21895
|
+
});
|
|
21896
|
+
var remotePeerAddParamsSchema = external_exports.object({
|
|
21897
|
+
connectionUrl: external_exports.string().min(1).max(4096).optional(),
|
|
21898
|
+
origin: external_exports.string().min(1).max(2048).optional(),
|
|
21899
|
+
token: external_exports.string().min(1).max(2048).optional(),
|
|
21900
|
+
name: external_exports.string().trim().min(1).max(120).optional(),
|
|
21901
|
+
color: remotePeerColorSchema.optional()
|
|
21902
|
+
}).refine((input3) => Boolean(input3.connectionUrl) || Boolean(input3.origin) && Boolean(input3.token), "Provide either connectionUrl or both origin and token");
|
|
21903
|
+
var remotePeerUpdateParamsSchema = external_exports.object({
|
|
21904
|
+
peerId: remotePeerIdSchema,
|
|
21905
|
+
name: external_exports.string().trim().min(1).max(120).optional(),
|
|
21906
|
+
color: remotePeerColorSchema.nullable().optional(),
|
|
21907
|
+
connectionUrl: external_exports.string().min(1).max(4096).optional(),
|
|
21908
|
+
origin: external_exports.string().min(1).max(2048).optional(),
|
|
21909
|
+
token: external_exports.string().min(1).max(2048).optional(),
|
|
21910
|
+
enabled: external_exports.boolean().optional()
|
|
21911
|
+
});
|
|
21912
|
+
var remotePeerIdParamsSchema = external_exports.object({
|
|
21913
|
+
peerId: remotePeerIdSchema
|
|
21914
|
+
});
|
|
21915
|
+
var remotePeerRemoveResultSchema = external_exports.object({
|
|
21916
|
+
removed: external_exports.boolean()
|
|
21917
|
+
});
|
|
21918
|
+
var remotePeerTestParamsSchema = external_exports.object({
|
|
21919
|
+
peerId: remotePeerIdSchema.optional(),
|
|
21920
|
+
connectionUrl: external_exports.string().min(1).max(4096).optional(),
|
|
21921
|
+
origin: external_exports.string().min(1).max(2048).optional(),
|
|
21922
|
+
token: external_exports.string().min(1).max(2048).optional()
|
|
21923
|
+
}).refine((input3) => Boolean(input3.peerId) || Boolean(input3.connectionUrl) || Boolean(input3.origin) && Boolean(input3.token), "Provide peerId, connectionUrl, or both origin and token");
|
|
21924
|
+
var remotePeerTestProjectSchema = external_exports.object({
|
|
21925
|
+
id: external_exports.string().min(1).max(1024),
|
|
21926
|
+
name: external_exports.string().min(1).max(512),
|
|
21927
|
+
path: external_exports.string().min(1).max(8192)
|
|
21928
|
+
});
|
|
21929
|
+
var remotePeerTestResultSchema = external_exports.object({
|
|
21930
|
+
ok: external_exports.boolean(),
|
|
21931
|
+
latencyMs: external_exports.number().int().nonnegative().optional(),
|
|
21932
|
+
origin: external_exports.string().max(2048).optional(),
|
|
21933
|
+
transportKind: remotePeerTransportKindSchema.optional(),
|
|
21934
|
+
encrypted: external_exports.boolean().optional(),
|
|
21935
|
+
version: external_exports.string().max(128).optional(),
|
|
21936
|
+
platform: external_exports.string().max(64).optional(),
|
|
21937
|
+
hostname: external_exports.string().max(255).optional(),
|
|
21938
|
+
homeDir: external_exports.string().max(4096).optional(),
|
|
21939
|
+
projectCount: external_exports.number().int().nonnegative().optional(),
|
|
21940
|
+
projects: external_exports.array(remotePeerTestProjectSchema).optional(),
|
|
21941
|
+
error: external_exports.string().max(1e3).optional()
|
|
21942
|
+
});
|
|
21943
|
+
var remotePeerManifestProjectSchema = external_exports.object({
|
|
21944
|
+
id: external_exports.string().min(1).max(1024),
|
|
21945
|
+
name: external_exports.string().min(1).max(512),
|
|
21946
|
+
path: external_exports.string().min(1).max(8192),
|
|
21947
|
+
threadIds: external_exports.array(external_exports.string().min(1).max(1024))
|
|
21948
|
+
});
|
|
21949
|
+
var remotePeerCapabilitiesSchema = external_exports.object({
|
|
21950
|
+
/** /api/peer/v1/uploads, /api/peer/v1/prompt, and /api/peer/v1/file are all available. */
|
|
21951
|
+
attachments: external_exports.literal(1).optional(),
|
|
21952
|
+
/** /api/peer/v1/workspace-files/rpc and /api/peer/v1/workspace-files/download are available. */
|
|
21953
|
+
workspaceFiles: external_exports.literal(1).optional(),
|
|
21954
|
+
/** Peer supports officeToPdf/render over /api/peer/v1/workspace-files/rpc. */
|
|
21955
|
+
officePreview: external_exports.literal(1).optional(),
|
|
21956
|
+
/** /api/peer/v1/delegation is available for fixed-whitelist cross-host delegation. */
|
|
21957
|
+
delegation: external_exports.literal(1).optional()
|
|
21958
|
+
});
|
|
21959
|
+
var remotePeerManifestSchema = external_exports.object({
|
|
21960
|
+
version: external_exports.string().max(128),
|
|
21961
|
+
platform: external_exports.string().max(64),
|
|
21962
|
+
hostname: external_exports.string().max(255),
|
|
21963
|
+
homeDir: external_exports.string().max(4096).optional(),
|
|
21964
|
+
epoch: external_exports.string().min(1).max(256),
|
|
21965
|
+
projects: external_exports.array(remotePeerManifestProjectSchema),
|
|
21966
|
+
capabilities: remotePeerCapabilitiesSchema.optional()
|
|
21967
|
+
});
|
|
21968
|
+
var REMOTE_PEER_UPLOAD_SCOPE_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u;
|
|
21969
|
+
var remotePeerPromptParamsSchema = external_exports.strictObject({
|
|
21970
|
+
threadId: external_exports.string().min(1).max(1024),
|
|
21971
|
+
scope: external_exports.string().regex(REMOTE_PEER_UPLOAD_SCOPE_PATTERN).optional(),
|
|
21972
|
+
requestId: external_exports.string().min(1).max(256).optional(),
|
|
21973
|
+
mode: external_exports.enum(["queue", "steer"]).optional(),
|
|
21974
|
+
expectedTurnId: external_exports.string().min(1).max(1024).nullable().optional(),
|
|
21975
|
+
content: external_exports.array(external_exports.discriminatedUnion("type", [
|
|
21976
|
+
external_exports.strictObject({ type: external_exports.literal("text"), text: external_exports.string() }),
|
|
21977
|
+
external_exports.strictObject({ type: external_exports.literal("file"), receiptId: external_exports.string().min(1).max(128) })
|
|
21978
|
+
])).min(1).max(64)
|
|
21979
|
+
});
|
|
21980
|
+
var remotePeerErrorEnvelopeSchema = external_exports.object({
|
|
21981
|
+
ok: external_exports.literal(false),
|
|
21982
|
+
error: external_exports.object({
|
|
21983
|
+
code: external_exports.string(),
|
|
21984
|
+
message: external_exports.string(),
|
|
21985
|
+
details: external_exports.record(external_exports.string(), external_exports.unknown()).optional()
|
|
21986
|
+
})
|
|
21987
|
+
});
|
|
21988
|
+
var remotePeerUploadResultSchema = external_exports.union([
|
|
21989
|
+
external_exports.object({
|
|
21990
|
+
ok: external_exports.literal(true),
|
|
21991
|
+
value: external_exports.object({
|
|
21992
|
+
receiptId: external_exports.string().min(1),
|
|
21993
|
+
file: external_exports.object({
|
|
21994
|
+
attachmentId: external_exports.string(),
|
|
21995
|
+
name: external_exports.string(),
|
|
21996
|
+
bytes: external_exports.number().int().nonnegative()
|
|
21997
|
+
})
|
|
21998
|
+
})
|
|
21999
|
+
}),
|
|
22000
|
+
remotePeerErrorEnvelopeSchema
|
|
22001
|
+
]);
|
|
22002
|
+
var remotePeerPromptResultSchema = external_exports.union([
|
|
22003
|
+
external_exports.object({
|
|
22004
|
+
ok: external_exports.literal(true),
|
|
22005
|
+
value: external_exports.object({ accepted: external_exports.literal(true) })
|
|
22006
|
+
}),
|
|
22007
|
+
remotePeerErrorEnvelopeSchema
|
|
22008
|
+
]);
|
|
22009
|
+
var remotePeerDirectoryEntrySchema = external_exports.object({
|
|
22010
|
+
name: external_exports.string().min(1).max(512),
|
|
22011
|
+
path: external_exports.string().min(1).max(8192),
|
|
22012
|
+
kind: external_exports.literal("directory")
|
|
22013
|
+
});
|
|
22014
|
+
var remotePeerListDirsParamsSchema = external_exports.object({
|
|
22015
|
+
peerId: remotePeerIdSchema,
|
|
22016
|
+
path: external_exports.string().min(1).max(8192).optional()
|
|
22017
|
+
});
|
|
22018
|
+
var remotePeerListDirsResultSchema = external_exports.object({
|
|
22019
|
+
path: external_exports.string().min(1).max(8192),
|
|
22020
|
+
parentPath: external_exports.string().min(1).max(8192).nullable(),
|
|
22021
|
+
homeDir: external_exports.string().min(1).max(8192).optional(),
|
|
22022
|
+
entries: external_exports.array(remotePeerDirectoryEntrySchema)
|
|
22023
|
+
});
|
|
22024
|
+
var remotePeerCreateDirParamsSchema = external_exports.object({
|
|
22025
|
+
peerId: remotePeerIdSchema,
|
|
22026
|
+
parentPath: external_exports.string().min(1).max(8192),
|
|
22027
|
+
name: external_exports.string().min(1).max(255).refine((value) => value.trim().length > 0, "Directory name cannot be blank")
|
|
22028
|
+
});
|
|
22029
|
+
var remotePeerCreateDirResultSchema = external_exports.object({
|
|
22030
|
+
path: external_exports.string().min(1).max(8192),
|
|
22031
|
+
name: external_exports.string().min(1).max(255)
|
|
22032
|
+
});
|
|
22033
|
+
var remotePeerCreateWorkspaceParamsSchema = external_exports.object({
|
|
22034
|
+
peerId: remotePeerIdSchema,
|
|
22035
|
+
path: external_exports.string().min(1).max(8192),
|
|
22036
|
+
title: external_exports.string().trim().min(1).max(255).optional()
|
|
22037
|
+
});
|
|
22038
|
+
var remotePeerRenameWorkspaceParamsSchema = external_exports.object({
|
|
22039
|
+
peerId: remotePeerIdSchema,
|
|
22040
|
+
workspaceId: external_exports.string().min(1).max(1024),
|
|
22041
|
+
title: external_exports.string().trim().min(1).max(255)
|
|
22042
|
+
});
|
|
22043
|
+
var remotePeerDeleteWorkspaceParamsSchema = external_exports.object({
|
|
22044
|
+
peerId: remotePeerIdSchema,
|
|
22045
|
+
workspaceId: external_exports.string().min(1).max(1024)
|
|
22046
|
+
});
|
|
22047
|
+
var remotePeerWorkspaceMutationResultSchema = external_exports.object({
|
|
22048
|
+
workspaceId: external_exports.string().min(1).max(1024).optional(),
|
|
22049
|
+
manifest: remotePeerManifestSchema
|
|
22050
|
+
});
|
|
22051
|
+
|
|
22052
|
+
// ../shared-contracts/dist/peer-delegation.js
|
|
22053
|
+
var PEER_DELEGATION_BRIDGE_VERSION = 1;
|
|
22054
|
+
var PEER_DELEGATION_OPERATIONS = [
|
|
22055
|
+
"listHarnesses",
|
|
22056
|
+
"inspect",
|
|
22057
|
+
"start",
|
|
22058
|
+
"send",
|
|
22059
|
+
"cancel",
|
|
22060
|
+
"read",
|
|
22061
|
+
"answer",
|
|
22062
|
+
"list"
|
|
22063
|
+
];
|
|
22064
|
+
var peerDelegationOperationSchema = external_exports.enum(PEER_DELEGATION_OPERATIONS);
|
|
22065
|
+
var peerDelegationRequestSchema = external_exports.strictObject({
|
|
22066
|
+
operation: peerDelegationOperationSchema,
|
|
22067
|
+
hopCount: external_exports.number().int().min(0).max(16),
|
|
22068
|
+
/** Opaque A-side peer pairing identifier used by B to scope implicit deduplication per Peer. */
|
|
22069
|
+
sourceId: remotePeerIdSchema.optional(),
|
|
22070
|
+
input: jsonObjectSchema
|
|
22071
|
+
});
|
|
22072
|
+
var peerDelegationErrorSchema = external_exports.strictObject({
|
|
22073
|
+
code: external_exports.string().min(1).max(128),
|
|
22074
|
+
message: external_exports.string().max(4096),
|
|
22075
|
+
details: jsonObjectSchema.optional()
|
|
22076
|
+
});
|
|
22077
|
+
var peerDelegationResponseSchema = external_exports.union([
|
|
22078
|
+
external_exports.strictObject({
|
|
22079
|
+
ok: external_exports.literal(true),
|
|
22080
|
+
value: jsonValueSchema
|
|
22081
|
+
}),
|
|
22082
|
+
external_exports.strictObject({
|
|
22083
|
+
ok: external_exports.literal(false),
|
|
22084
|
+
error: peerDelegationErrorSchema
|
|
22085
|
+
})
|
|
22086
|
+
]);
|
|
22087
|
+
var peerDelegationHostProjectSchema = external_exports.strictObject({
|
|
22088
|
+
id: external_exports.string().min(1).max(1024),
|
|
22089
|
+
name: external_exports.string().min(1).max(512),
|
|
22090
|
+
path: external_exports.string().min(1).max(8192)
|
|
22091
|
+
});
|
|
22092
|
+
var peerDelegationHostSummarySchema = external_exports.strictObject({
|
|
22093
|
+
hostId: remotePeerHostIdSchema,
|
|
22094
|
+
displayName: external_exports.string().min(1).max(120),
|
|
22095
|
+
online: external_exports.boolean(),
|
|
22096
|
+
state: remotePeerStateSchema,
|
|
22097
|
+
delegation: external_exports.boolean(),
|
|
22098
|
+
projects: external_exports.array(peerDelegationHostProjectSchema),
|
|
22099
|
+
platform: external_exports.string().max(64).optional(),
|
|
22100
|
+
hostname: external_exports.string().max(255).optional(),
|
|
22101
|
+
homeDir: external_exports.string().max(4096).optional()
|
|
22102
|
+
});
|
|
22103
|
+
var peerDelegationHostsResultSchema = external_exports.strictObject({
|
|
22104
|
+
hosts: external_exports.array(peerDelegationHostSummarySchema)
|
|
22105
|
+
});
|
|
22106
|
+
var peerDelegationBridgeDescriptorSchema = external_exports.strictObject({
|
|
22107
|
+
version: external_exports.literal(PEER_DELEGATION_BRIDGE_VERSION),
|
|
22108
|
+
instanceId: external_exports.string().min(1).max(128),
|
|
22109
|
+
pid: external_exports.number().int().positive(),
|
|
22110
|
+
endpoint: external_exports.string().min(1).max(256),
|
|
22111
|
+
token: external_exports.string().regex(/^[0-9a-f]{64}$/u),
|
|
22112
|
+
startedAt: external_exports.number().int().nonnegative()
|
|
22113
|
+
});
|
|
22114
|
+
var peerDelegationBridgeRequestSchema = external_exports.union([
|
|
22115
|
+
external_exports.strictObject({
|
|
22116
|
+
operation: external_exports.literal("hosts")
|
|
22117
|
+
}),
|
|
22118
|
+
external_exports.strictObject({
|
|
22119
|
+
operation: peerDelegationOperationSchema,
|
|
22120
|
+
hostId: remotePeerHostIdSchema,
|
|
22121
|
+
hopCount: external_exports.number().int().min(0).max(16),
|
|
22122
|
+
timeoutMs: external_exports.number().int().min(1).max(12e4).optional(),
|
|
22123
|
+
input: jsonObjectSchema
|
|
22124
|
+
})
|
|
22125
|
+
]);
|
|
22126
|
+
|
|
21796
22127
|
// ../shared-contracts/dist/credential-imports.js
|
|
21797
22128
|
var credentialSourceSchema = external_exports.object({
|
|
21798
22129
|
id: external_exports.string().min(1).max(256),
|
|
@@ -22589,7 +22920,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
22589
22920
|
|
|
22590
22921
|
// ../shared-contracts/dist/codex-accounts.js
|
|
22591
22922
|
var accountIdSchema = external_exports.string().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u);
|
|
22592
|
-
var
|
|
22923
|
+
var nonBlankTextSchema4 = external_exports.string().trim().min(1);
|
|
22593
22924
|
var codexAccountPlanTypeSchema = external_exports.enum([
|
|
22594
22925
|
"free",
|
|
22595
22926
|
"go",
|
|
@@ -22611,7 +22942,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
22611
22942
|
]);
|
|
22612
22943
|
var codexAccountSchema = external_exports.object({
|
|
22613
22944
|
accountId: accountIdSchema,
|
|
22614
|
-
label:
|
|
22945
|
+
label: nonBlankTextSchema4.max(256),
|
|
22615
22946
|
email: external_exports.string().email().max(320).optional(),
|
|
22616
22947
|
planType: codexAccountPlanTypeSchema.optional()
|
|
22617
22948
|
}).strict();
|
|
@@ -22621,7 +22952,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
22621
22952
|
currentAccountId: accountIdSchema.nullable(),
|
|
22622
22953
|
phase: codexAccountPhaseSchema,
|
|
22623
22954
|
revision: external_exports.number().int().nonnegative(),
|
|
22624
|
-
instanceId:
|
|
22955
|
+
instanceId: nonBlankTextSchema4.max(1024).optional(),
|
|
22625
22956
|
accounts: external_exports.array(codexAccountSchema).max(1)
|
|
22626
22957
|
}).strict();
|
|
22627
22958
|
var codexAccountChangedSchema = codexAccountListResultSchema;
|
|
@@ -22644,13 +22975,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
22644
22975
|
var HARNESS_SESSION_IMPORT_LIST_MAX_LENGTH = 1e3;
|
|
22645
22976
|
var HARNESS_SESSION_IMPORT_DEFAULT_PAGE_SIZE = 20;
|
|
22646
22977
|
var HARNESS_SESSION_IMPORT_UPDATED_AT_MAX = 864e13;
|
|
22647
|
-
var
|
|
22648
|
-
var harnessSessionImportIdSchema =
|
|
22978
|
+
var nonBlankTextSchema5 = external_exports.string().refine((value) => value.trim().length > 0, "Value must not be empty or whitespace").refine((value) => !value.includes("\0"), "Value must not contain NUL");
|
|
22979
|
+
var harnessSessionImportIdSchema = nonBlankTextSchema5.max(HARNESS_SESSION_IMPORT_ID_MAX_LENGTH);
|
|
22649
22980
|
var harnessSessionImportCandidateSchema = external_exports.object({
|
|
22650
22981
|
nativeSessionId: harnessSessionImportIdSchema,
|
|
22651
|
-
title:
|
|
22982
|
+
title: nonBlankTextSchema5.max(HARNESS_SESSION_IMPORT_TITLE_MAX_LENGTH).nullable(),
|
|
22652
22983
|
updatedAt: external_exports.number().int().nonnegative().max(HARNESS_SESSION_IMPORT_UPDATED_AT_MAX),
|
|
22653
|
-
cwd:
|
|
22984
|
+
cwd: nonBlankTextSchema5.max(HARNESS_SESSION_IMPORT_CWD_MAX_LENGTH),
|
|
22654
22985
|
// Native file discovery cannot reliably observe another process's activity.
|
|
22655
22986
|
running: external_exports.boolean().nullable()
|
|
22656
22987
|
}).strict();
|
|
@@ -22658,7 +22989,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
22658
22989
|
var harnessSessionImportSourcesResultSchema = external_exports.object({
|
|
22659
22990
|
harnesses: external_exports.array(external_exports.object({
|
|
22660
22991
|
harnessId: harnessPluginIdSchema,
|
|
22661
|
-
name:
|
|
22992
|
+
name: nonBlankTextSchema5.max(128)
|
|
22662
22993
|
}).strict()).max(128)
|
|
22663
22994
|
}).strict();
|
|
22664
22995
|
var harnessSessionListParamsSchema = external_exports.object({
|
|
@@ -22676,13 +23007,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
22676
23007
|
nativeSessionId: harnessSessionImportIdSchema
|
|
22677
23008
|
}).strict();
|
|
22678
23009
|
var harnessSessionImportResultSchema = external_exports.object({
|
|
22679
|
-
threadId:
|
|
23010
|
+
threadId: nonBlankTextSchema5.max(1024).pipe(hostThreadIdSchema)
|
|
22680
23011
|
}).strict();
|
|
22681
23012
|
|
|
22682
23013
|
// ../shared-contracts/dist/deepseek-modern-sessions.js
|
|
22683
23014
|
var DEEPSEEK_MODERN_SESSION_LIST_MAX_LENGTH = HARNESS_SESSION_IMPORT_LIST_MAX_LENGTH;
|
|
22684
23015
|
var DEEPSEEK_MODERN_HOST_THREAD_ID_MAX_LENGTH = 1024;
|
|
22685
|
-
var
|
|
23016
|
+
var nonBlankTextSchema6 = external_exports.string().refine((value) => value.trim().length > 0, "Value must not be empty or whitespace").refine((value) => !value.includes("\0"), "Value must not contain NUL");
|
|
22686
23017
|
var deepSeekModernSessionIdSchema = harnessSessionImportIdSchema;
|
|
22687
23018
|
var deepSeekModernSessionCandidateSchema = harnessSessionImportCandidateSchema;
|
|
22688
23019
|
var deepSeekModernSessionListParamsSchema = external_exports.object({}).strict();
|
|
@@ -22693,7 +23024,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
22693
23024
|
nativeSessionId: deepSeekModernSessionIdSchema
|
|
22694
23025
|
}).strict();
|
|
22695
23026
|
var deepSeekModernSessionImportResultSchema = external_exports.object({
|
|
22696
|
-
threadId:
|
|
23027
|
+
threadId: nonBlankTextSchema6.max(DEEPSEEK_MODERN_HOST_THREAD_ID_MAX_LENGTH).pipe(hostThreadIdSchema)
|
|
22697
23028
|
}).strict();
|
|
22698
23029
|
|
|
22699
23030
|
// ../shared-contracts/dist/external-thread-fork.js
|
|
@@ -22728,9 +23059,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
22728
23059
|
/** Partial discovery failures; valid commands remain available. */
|
|
22729
23060
|
warnings: external_exports.array(external_exports.string().min(1)).optional(),
|
|
22730
23061
|
/**
|
|
22731
|
-
* `live` when
|
|
22732
|
-
* workspace (
|
|
22733
|
-
*
|
|
23062
|
+
* `live` when a native Session has reported its live catalog for the
|
|
23063
|
+
* workspace (even when filtering leaves only built-ins); `static` for
|
|
23064
|
+
* Adapter built-ins only before live commands arrive. Adapters may set
|
|
23065
|
+
* `live` once their Session's live catalog has loaded.
|
|
22734
23066
|
*/
|
|
22735
23067
|
source: external_exports.enum(["live", "static"]).optional()
|
|
22736
23068
|
}).strict().superRefine((catalog, context2) => {
|
|
@@ -23124,7 +23456,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
23124
23456
|
kind: external_exports.literal("start"),
|
|
23125
23457
|
itemId: identity,
|
|
23126
23458
|
onlyIfHead: external_exports.literal(true).optional()
|
|
23127
|
-
})
|
|
23459
|
+
}),
|
|
23460
|
+
external_exports.strictObject({ kind: external_exports.literal("sendNow"), itemId: identity })
|
|
23128
23461
|
])
|
|
23129
23462
|
}),
|
|
23130
23463
|
external_exports.strictObject({ kind: external_exports.literal("interrupt"), ...thread, epoch: identity, turnId: identity }),
|
|
@@ -23239,206 +23572,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
23239
23572
|
var webUiExtensionEnabledSchema = external_exports.object({ id: webUiExtensionIdSchema, enabled: external_exports.boolean() }).strict();
|
|
23240
23573
|
var webUiExtensionRemoveSchema = external_exports.object({ id: webUiExtensionIdSchema }).strict();
|
|
23241
23574
|
|
|
23242
|
-
// ../shared-contracts/dist/remote-peers.js
|
|
23243
|
-
var REMOTE_PEER_ID_PATTERN = /^[a-zA-Z0-9_-]{1,64}$/u;
|
|
23244
|
-
var remotePeerIdSchema = external_exports.string().regex(REMOTE_PEER_ID_PATTERN);
|
|
23245
|
-
var remotePeerHostIdSchema = external_exports.string().regex(/^remote-peer:[a-zA-Z0-9_-]{1,64}$/u);
|
|
23246
|
-
var remotePeerTransportKindSchema = external_exports.enum(["relay", "tailscale", "lan", "custom"]);
|
|
23247
|
-
var REMOTE_PEER_COLORS = [
|
|
23248
|
-
"blue",
|
|
23249
|
-
"purple",
|
|
23250
|
-
"cyan",
|
|
23251
|
-
"green",
|
|
23252
|
-
"amber",
|
|
23253
|
-
"rose",
|
|
23254
|
-
"slate"
|
|
23255
|
-
];
|
|
23256
|
-
var remotePeerColorSchema = external_exports.enum(REMOTE_PEER_COLORS);
|
|
23257
|
-
var REMOTE_PEER_COLOR_SET = new Set(REMOTE_PEER_COLORS);
|
|
23258
|
-
var remotePeerStateSchema = external_exports.enum([
|
|
23259
|
-
"connected",
|
|
23260
|
-
"connecting",
|
|
23261
|
-
"auth-error",
|
|
23262
|
-
"offline",
|
|
23263
|
-
"disabled"
|
|
23264
|
-
]);
|
|
23265
|
-
var remotePeerSummarySchema = external_exports.object({
|
|
23266
|
-
peerId: remotePeerIdSchema,
|
|
23267
|
-
hostId: remotePeerHostIdSchema,
|
|
23268
|
-
name: external_exports.string().min(1).max(120),
|
|
23269
|
-
color: remotePeerColorSchema.optional(),
|
|
23270
|
-
origin: external_exports.string().min(1).max(2048),
|
|
23271
|
-
transportKind: remotePeerTransportKindSchema,
|
|
23272
|
-
encrypted: external_exports.boolean(),
|
|
23273
|
-
enabled: external_exports.boolean(),
|
|
23274
|
-
state: remotePeerStateSchema,
|
|
23275
|
-
latencyMs: external_exports.number().int().nonnegative().optional(),
|
|
23276
|
-
version: external_exports.string().max(128).optional(),
|
|
23277
|
-
platform: external_exports.string().max(64).optional(),
|
|
23278
|
-
hostname: external_exports.string().max(255).optional(),
|
|
23279
|
-
homeDir: external_exports.string().max(4096).optional(),
|
|
23280
|
-
lastError: external_exports.string().max(1e3).optional(),
|
|
23281
|
-
projectCount: external_exports.number().int().nonnegative(),
|
|
23282
|
-
createdAt: external_exports.string(),
|
|
23283
|
-
updatedAt: external_exports.string()
|
|
23284
|
-
});
|
|
23285
|
-
var remotePeerListResultSchema = external_exports.object({
|
|
23286
|
-
peers: external_exports.array(remotePeerSummarySchema)
|
|
23287
|
-
});
|
|
23288
|
-
var remotePeerAddParamsSchema = external_exports.object({
|
|
23289
|
-
connectionUrl: external_exports.string().min(1).max(4096).optional(),
|
|
23290
|
-
origin: external_exports.string().min(1).max(2048).optional(),
|
|
23291
|
-
token: external_exports.string().min(1).max(2048).optional(),
|
|
23292
|
-
name: external_exports.string().trim().min(1).max(120).optional(),
|
|
23293
|
-
color: remotePeerColorSchema.optional()
|
|
23294
|
-
}).refine((input3) => Boolean(input3.connectionUrl) || Boolean(input3.origin) && Boolean(input3.token), "Provide either connectionUrl or both origin and token");
|
|
23295
|
-
var remotePeerUpdateParamsSchema = external_exports.object({
|
|
23296
|
-
peerId: remotePeerIdSchema,
|
|
23297
|
-
name: external_exports.string().trim().min(1).max(120).optional(),
|
|
23298
|
-
color: remotePeerColorSchema.nullable().optional(),
|
|
23299
|
-
connectionUrl: external_exports.string().min(1).max(4096).optional(),
|
|
23300
|
-
origin: external_exports.string().min(1).max(2048).optional(),
|
|
23301
|
-
token: external_exports.string().min(1).max(2048).optional(),
|
|
23302
|
-
enabled: external_exports.boolean().optional()
|
|
23303
|
-
});
|
|
23304
|
-
var remotePeerIdParamsSchema = external_exports.object({
|
|
23305
|
-
peerId: remotePeerIdSchema
|
|
23306
|
-
});
|
|
23307
|
-
var remotePeerRemoveResultSchema = external_exports.object({
|
|
23308
|
-
removed: external_exports.boolean()
|
|
23309
|
-
});
|
|
23310
|
-
var remotePeerTestParamsSchema = external_exports.object({
|
|
23311
|
-
peerId: remotePeerIdSchema.optional(),
|
|
23312
|
-
connectionUrl: external_exports.string().min(1).max(4096).optional(),
|
|
23313
|
-
origin: external_exports.string().min(1).max(2048).optional(),
|
|
23314
|
-
token: external_exports.string().min(1).max(2048).optional()
|
|
23315
|
-
}).refine((input3) => Boolean(input3.peerId) || Boolean(input3.connectionUrl) || Boolean(input3.origin) && Boolean(input3.token), "Provide peerId, connectionUrl, or both origin and token");
|
|
23316
|
-
var remotePeerTestProjectSchema = external_exports.object({
|
|
23317
|
-
id: external_exports.string().min(1).max(1024),
|
|
23318
|
-
name: external_exports.string().min(1).max(512),
|
|
23319
|
-
path: external_exports.string().min(1).max(8192)
|
|
23320
|
-
});
|
|
23321
|
-
var remotePeerTestResultSchema = external_exports.object({
|
|
23322
|
-
ok: external_exports.boolean(),
|
|
23323
|
-
latencyMs: external_exports.number().int().nonnegative().optional(),
|
|
23324
|
-
origin: external_exports.string().max(2048).optional(),
|
|
23325
|
-
transportKind: remotePeerTransportKindSchema.optional(),
|
|
23326
|
-
encrypted: external_exports.boolean().optional(),
|
|
23327
|
-
version: external_exports.string().max(128).optional(),
|
|
23328
|
-
platform: external_exports.string().max(64).optional(),
|
|
23329
|
-
hostname: external_exports.string().max(255).optional(),
|
|
23330
|
-
homeDir: external_exports.string().max(4096).optional(),
|
|
23331
|
-
projectCount: external_exports.number().int().nonnegative().optional(),
|
|
23332
|
-
projects: external_exports.array(remotePeerTestProjectSchema).optional(),
|
|
23333
|
-
error: external_exports.string().max(1e3).optional()
|
|
23334
|
-
});
|
|
23335
|
-
var remotePeerManifestProjectSchema = external_exports.object({
|
|
23336
|
-
id: external_exports.string().min(1).max(1024),
|
|
23337
|
-
name: external_exports.string().min(1).max(512),
|
|
23338
|
-
path: external_exports.string().min(1).max(8192),
|
|
23339
|
-
threadIds: external_exports.array(external_exports.string().min(1).max(1024))
|
|
23340
|
-
});
|
|
23341
|
-
var remotePeerCapabilitiesSchema = external_exports.object({
|
|
23342
|
-
/** /api/peer/v1/uploads, /api/peer/v1/prompt, and /api/peer/v1/file are all available. */
|
|
23343
|
-
attachments: external_exports.literal(1).optional(),
|
|
23344
|
-
/** /api/peer/v1/workspace-files/rpc and /api/peer/v1/workspace-files/download are available. */
|
|
23345
|
-
workspaceFiles: external_exports.literal(1).optional(),
|
|
23346
|
-
/** Peer supports officeToPdf/render over /api/peer/v1/workspace-files/rpc. */
|
|
23347
|
-
officePreview: external_exports.literal(1).optional()
|
|
23348
|
-
});
|
|
23349
|
-
var remotePeerManifestSchema = external_exports.object({
|
|
23350
|
-
version: external_exports.string().max(128),
|
|
23351
|
-
platform: external_exports.string().max(64),
|
|
23352
|
-
hostname: external_exports.string().max(255),
|
|
23353
|
-
homeDir: external_exports.string().max(4096).optional(),
|
|
23354
|
-
epoch: external_exports.string().min(1).max(256),
|
|
23355
|
-
projects: external_exports.array(remotePeerManifestProjectSchema),
|
|
23356
|
-
capabilities: remotePeerCapabilitiesSchema.optional()
|
|
23357
|
-
});
|
|
23358
|
-
var REMOTE_PEER_UPLOAD_SCOPE_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u;
|
|
23359
|
-
var remotePeerPromptParamsSchema = external_exports.strictObject({
|
|
23360
|
-
threadId: external_exports.string().min(1).max(1024),
|
|
23361
|
-
scope: external_exports.string().regex(REMOTE_PEER_UPLOAD_SCOPE_PATTERN).optional(),
|
|
23362
|
-
requestId: external_exports.string().min(1).max(256).optional(),
|
|
23363
|
-
mode: external_exports.enum(["queue", "steer"]).optional(),
|
|
23364
|
-
expectedTurnId: external_exports.string().min(1).max(1024).nullable().optional(),
|
|
23365
|
-
content: external_exports.array(external_exports.discriminatedUnion("type", [
|
|
23366
|
-
external_exports.strictObject({ type: external_exports.literal("text"), text: external_exports.string() }),
|
|
23367
|
-
external_exports.strictObject({ type: external_exports.literal("file"), receiptId: external_exports.string().min(1).max(128) })
|
|
23368
|
-
])).min(1).max(64)
|
|
23369
|
-
});
|
|
23370
|
-
var remotePeerErrorEnvelopeSchema = external_exports.object({
|
|
23371
|
-
ok: external_exports.literal(false),
|
|
23372
|
-
error: external_exports.object({
|
|
23373
|
-
code: external_exports.string(),
|
|
23374
|
-
message: external_exports.string(),
|
|
23375
|
-
details: external_exports.record(external_exports.string(), external_exports.unknown()).optional()
|
|
23376
|
-
})
|
|
23377
|
-
});
|
|
23378
|
-
var remotePeerUploadResultSchema = external_exports.union([
|
|
23379
|
-
external_exports.object({
|
|
23380
|
-
ok: external_exports.literal(true),
|
|
23381
|
-
value: external_exports.object({
|
|
23382
|
-
receiptId: external_exports.string().min(1),
|
|
23383
|
-
file: external_exports.object({
|
|
23384
|
-
attachmentId: external_exports.string(),
|
|
23385
|
-
name: external_exports.string(),
|
|
23386
|
-
bytes: external_exports.number().int().nonnegative()
|
|
23387
|
-
})
|
|
23388
|
-
})
|
|
23389
|
-
}),
|
|
23390
|
-
remotePeerErrorEnvelopeSchema
|
|
23391
|
-
]);
|
|
23392
|
-
var remotePeerPromptResultSchema = external_exports.union([
|
|
23393
|
-
external_exports.object({
|
|
23394
|
-
ok: external_exports.literal(true),
|
|
23395
|
-
value: external_exports.object({ accepted: external_exports.literal(true) })
|
|
23396
|
-
}),
|
|
23397
|
-
remotePeerErrorEnvelopeSchema
|
|
23398
|
-
]);
|
|
23399
|
-
var remotePeerDirectoryEntrySchema = external_exports.object({
|
|
23400
|
-
name: external_exports.string().min(1).max(512),
|
|
23401
|
-
path: external_exports.string().min(1).max(8192),
|
|
23402
|
-
kind: external_exports.literal("directory")
|
|
23403
|
-
});
|
|
23404
|
-
var remotePeerListDirsParamsSchema = external_exports.object({
|
|
23405
|
-
peerId: remotePeerIdSchema,
|
|
23406
|
-
path: external_exports.string().min(1).max(8192).optional()
|
|
23407
|
-
});
|
|
23408
|
-
var remotePeerListDirsResultSchema = external_exports.object({
|
|
23409
|
-
path: external_exports.string().min(1).max(8192),
|
|
23410
|
-
parentPath: external_exports.string().min(1).max(8192).nullable(),
|
|
23411
|
-
homeDir: external_exports.string().min(1).max(8192).optional(),
|
|
23412
|
-
entries: external_exports.array(remotePeerDirectoryEntrySchema)
|
|
23413
|
-
});
|
|
23414
|
-
var remotePeerCreateDirParamsSchema = external_exports.object({
|
|
23415
|
-
peerId: remotePeerIdSchema,
|
|
23416
|
-
parentPath: external_exports.string().min(1).max(8192),
|
|
23417
|
-
name: external_exports.string().min(1).max(255).refine((value) => value.trim().length > 0, "Directory name cannot be blank")
|
|
23418
|
-
});
|
|
23419
|
-
var remotePeerCreateDirResultSchema = external_exports.object({
|
|
23420
|
-
path: external_exports.string().min(1).max(8192),
|
|
23421
|
-
name: external_exports.string().min(1).max(255)
|
|
23422
|
-
});
|
|
23423
|
-
var remotePeerCreateWorkspaceParamsSchema = external_exports.object({
|
|
23424
|
-
peerId: remotePeerIdSchema,
|
|
23425
|
-
path: external_exports.string().min(1).max(8192),
|
|
23426
|
-
title: external_exports.string().trim().min(1).max(255).optional()
|
|
23427
|
-
});
|
|
23428
|
-
var remotePeerRenameWorkspaceParamsSchema = external_exports.object({
|
|
23429
|
-
peerId: remotePeerIdSchema,
|
|
23430
|
-
workspaceId: external_exports.string().min(1).max(1024),
|
|
23431
|
-
title: external_exports.string().trim().min(1).max(255)
|
|
23432
|
-
});
|
|
23433
|
-
var remotePeerDeleteWorkspaceParamsSchema = external_exports.object({
|
|
23434
|
-
peerId: remotePeerIdSchema,
|
|
23435
|
-
workspaceId: external_exports.string().min(1).max(1024)
|
|
23436
|
-
});
|
|
23437
|
-
var remotePeerWorkspaceMutationResultSchema = external_exports.object({
|
|
23438
|
-
workspaceId: external_exports.string().min(1).max(1024).optional(),
|
|
23439
|
-
manifest: remotePeerManifestSchema
|
|
23440
|
-
});
|
|
23441
|
-
|
|
23442
23575
|
// ../shared-contracts/dist/index.js
|
|
23443
23576
|
var workspaceContractVersionSchema = external_exports.literal(WORKSPACE_CONTRACT_VERSION);
|
|
23444
23577
|
|
|
@@ -25353,7 +25486,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
25353
25486
|
|
|
25354
25487
|
// src/renderer-composer-kind.ts
|
|
25355
25488
|
function orbitComposerKind(composer) {
|
|
25356
|
-
let element = composer.querySelector('[contenteditable="true"], textarea, [role="textbox"]') ?? composer;
|
|
25489
|
+
let element = (typeof composer.querySelector === "function" ? composer.querySelector('[contenteditable="true"], textarea, [role="textbox"]') : null) ?? composer;
|
|
25357
25490
|
for (let depth = 0; element && depth < 12; depth += 1) {
|
|
25358
25491
|
const key2 = Object.getOwnPropertyNames(element).find(
|
|
25359
25492
|
(name) => name.startsWith("__reactFiber$")
|
|
@@ -31113,7 +31246,21 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
31113
31246
|
modelMenuTitle: "Model",
|
|
31114
31247
|
refreshModels: "Refresh models",
|
|
31115
31248
|
modelSelectionRejected: "Couldn't switch Model",
|
|
31116
|
-
thinkingSelectionRejected: "Couldn't switch Thinking option"
|
|
31249
|
+
thinkingSelectionRejected: "Couldn't switch Thinking option",
|
|
31250
|
+
handoffAction: "Handoff context",
|
|
31251
|
+
handoffTitle: "Context handoff",
|
|
31252
|
+
handoffTargetHarnessLabel: "Target Harness",
|
|
31253
|
+
handoffTargetModelLabel: "Model (optional)",
|
|
31254
|
+
handoffDefaultModelOption: "Default model",
|
|
31255
|
+
handoffTargetThinkingLabel: "Thinking (optional)",
|
|
31256
|
+
handoffDefaultThinkingOption: "Default thinking",
|
|
31257
|
+
handoffLoadingModels: "Loading models\u2026",
|
|
31258
|
+
handoffConfirm: "Handoff",
|
|
31259
|
+
handoffSubmitting: "Handing off\u2026",
|
|
31260
|
+
handoffCancel: "Cancel",
|
|
31261
|
+
handoffOpenSourceThread: "Open source thread",
|
|
31262
|
+
handoffPreviewLabel: "Context preview",
|
|
31263
|
+
handoffFailed: "Context handoff failed"
|
|
31117
31264
|
});
|
|
31118
31265
|
var CHINESE_HARNESS_MESSAGES = Object.freeze({
|
|
31119
31266
|
commands: "\u547D\u4EE4",
|
|
@@ -31132,7 +31279,21 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
31132
31279
|
modelMenuTitle: "\u6A21\u578B",
|
|
31133
31280
|
refreshModels: "\u5237\u65B0\u6A21\u578B\u5217\u8868",
|
|
31134
31281
|
modelSelectionRejected: "\u65E0\u6CD5\u5207\u6362\u6A21\u578B",
|
|
31135
|
-
thinkingSelectionRejected: "\u65E0\u6CD5\u5207\u6362\u601D\u8003\u9009\u9879"
|
|
31282
|
+
thinkingSelectionRejected: "\u65E0\u6CD5\u5207\u6362\u601D\u8003\u9009\u9879",
|
|
31283
|
+
handoffAction: "\u4E0A\u4E0B\u6587\u4EA4\u63A5",
|
|
31284
|
+
handoffTitle: "\u4E0A\u4E0B\u6587\u4EA4\u63A5",
|
|
31285
|
+
handoffTargetHarnessLabel: "\u76EE\u6807 Harness",
|
|
31286
|
+
handoffTargetModelLabel: "\u6A21\u578B\uFF08\u53EF\u9009\uFF09",
|
|
31287
|
+
handoffDefaultModelOption: "\u9ED8\u8BA4\u6A21\u578B",
|
|
31288
|
+
handoffTargetThinkingLabel: "\u601D\u8003\u6863\u4F4D\uFF08\u53EF\u9009\uFF09",
|
|
31289
|
+
handoffDefaultThinkingOption: "\u9ED8\u8BA4\u601D\u8003\u6863\u4F4D",
|
|
31290
|
+
handoffLoadingModels: "\u6B63\u5728\u52A0\u8F7D\u6A21\u578B\u2026",
|
|
31291
|
+
handoffConfirm: "\u786E\u8BA4\u4EA4\u63A5",
|
|
31292
|
+
handoffSubmitting: "\u6B63\u5728\u4EA4\u63A5\u2026",
|
|
31293
|
+
handoffCancel: "\u53D6\u6D88",
|
|
31294
|
+
handoffOpenSourceThread: "\u8DF3\u56DE\u6E90\u4F1A\u8BDD",
|
|
31295
|
+
handoffPreviewLabel: "\u4EA4\u63A5\u4E0A\u4E0B\u6587\u9884\u89C8",
|
|
31296
|
+
handoffFailed: "\u4E0A\u4E0B\u6587\u4EA4\u63A5\u5931\u8D25"
|
|
31136
31297
|
});
|
|
31137
31298
|
function rendererHarnessMessages(locale) {
|
|
31138
31299
|
return locale === "zh-CN" ? CHINESE_HARNESS_MESSAGES : ENGLISH_HARNESS_MESSAGES;
|
|
@@ -31148,6 +31309,24 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
31148
31309
|
const harness2 = harnessLabel.replace(/\s*[((][^))]*[))]\s*$/u, "").trim() || harnessLabel;
|
|
31149
31310
|
return locale === "zh-CN" ? `\u53D1\u9001\u4E00\u6761\u6D88\u606F\u540E\uFF0C\u4F1A\u52A0\u8F7D ${harness2} \u5728\u5F53\u524D\u9879\u76EE\u7684\u5168\u90E8\u547D\u4EE4` : `Send a message to load all ${harness2} commands for this project`;
|
|
31150
31311
|
}
|
|
31312
|
+
function formatRendererHandoffTurnsSummary(locale, input3) {
|
|
31313
|
+
if (locale === "zh-CN") {
|
|
31314
|
+
if (input3.omittedTurns > 0) {
|
|
31315
|
+
return `\u5DF2\u643A\u5E26 ${input3.includedCount} / ${input3.totalTurns} \u8F6E\u4E0A\u4E0B\u6587\uFF08\u5DF2\u7701\u7565 ${input3.omittedTurns} \u8F6E\uFF0C\u622A\u81F3\u7B2C ${input3.boundaryTurnNumber} \u8F6E\uFF09`;
|
|
31316
|
+
}
|
|
31317
|
+
if (input3.boundaryTurnNumber < input3.totalTurns) {
|
|
31318
|
+
return `\u5DF2\u643A\u5E26\u524D ${input3.boundaryTurnNumber} / ${input3.totalTurns} \u8F6E\u4E0A\u4E0B\u6587`;
|
|
31319
|
+
}
|
|
31320
|
+
return `\u5DF2\u643A\u5E26\u5168\u90E8 ${input3.totalTurns} \u8F6E\u4E0A\u4E0B\u6587`;
|
|
31321
|
+
}
|
|
31322
|
+
if (input3.omittedTurns > 0) {
|
|
31323
|
+
return `Carried ${input3.includedCount} of ${input3.totalTurns} turns (${input3.omittedTurns} omitted, up to turn ${input3.boundaryTurnNumber})`;
|
|
31324
|
+
}
|
|
31325
|
+
if (input3.boundaryTurnNumber < input3.totalTurns) {
|
|
31326
|
+
return `Carried first ${input3.boundaryTurnNumber} of ${input3.totalTurns} turns`;
|
|
31327
|
+
}
|
|
31328
|
+
return `Carried all ${input3.totalTurns} turns`;
|
|
31329
|
+
}
|
|
31151
31330
|
|
|
31152
31331
|
// src/renderer-model-favorites.ts
|
|
31153
31332
|
var STORAGE_KEY = "codexhost.model-favorites.v1";
|
|
@@ -33081,10 +33260,10 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
|
|
|
33081
33260
|
(attribute) => `[${attribute}]`
|
|
33082
33261
|
).join(", ");
|
|
33083
33262
|
function isNativeComposerRequest(element) {
|
|
33084
|
-
return element.closest(NATIVE_REQUEST_SELECTOR) !== null;
|
|
33263
|
+
return typeof element.closest === "function" && element.closest(NATIVE_REQUEST_SELECTOR) !== null;
|
|
33085
33264
|
}
|
|
33086
33265
|
function hasNativeComposerRequest(composer) {
|
|
33087
|
-
return isNativeComposerRequest(composer) || composer.querySelector(NATIVE_REQUEST_SELECTOR) !== null;
|
|
33266
|
+
return isNativeComposerRequest(composer) || typeof composer.querySelector === "function" && composer.querySelector(NATIVE_REQUEST_SELECTOR) !== null;
|
|
33088
33267
|
}
|
|
33089
33268
|
|
|
33090
33269
|
// src/renderer-harness-command-control.ts
|
|
@@ -33276,7 +33455,7 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
|
|
|
33276
33455
|
return controlDescription(button2);
|
|
33277
33456
|
}
|
|
33278
33457
|
function isOwnedRendererControl(element) {
|
|
33279
|
-
return element.hasAttribute(CONTROL_ATTRIBUTE) || element.hasAttribute("data-codexhost-model-control") || element.hasAttribute("data-codexhost-permission-mode-control") || element.hasAttribute("data-codexhost-usage-control") || element.hasAttribute("data-codexhost-credits-control") || element.hasAttribute("data-codexhost-composer-indicators") || element.hasAttribute("data-codexhost-harness-command-control");
|
|
33458
|
+
return element.hasAttribute(CONTROL_ATTRIBUTE) || element.hasAttribute("data-codexhost-model-control") || element.hasAttribute("data-codexhost-permission-mode-control") || element.hasAttribute("data-codexhost-usage-control") || element.hasAttribute("data-codexhost-credits-control") || element.hasAttribute("data-codexhost-composer-indicators") || element.hasAttribute("data-codexhost-harness-command-control") || element.hasAttribute("data-codexhost-handoff-control");
|
|
33280
33459
|
}
|
|
33281
33460
|
function isComposerSubmitButton(button2) {
|
|
33282
33461
|
if (button2.type === "submit") return true;
|
|
@@ -35124,6 +35303,11 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
|
|
|
35124
35303
|
const result = await manager.sendRequest(THREAD_FORK_METHOD, params);
|
|
35125
35304
|
return externalThreadForkResultSchema.parse(result);
|
|
35126
35305
|
},
|
|
35306
|
+
async handoffThread(input3) {
|
|
35307
|
+
const params = threadHandoffParamsSchema.parse(input3);
|
|
35308
|
+
const result = await manager.sendRequest(THREAD_HANDOFF_METHOD, params);
|
|
35309
|
+
return threadHandoffResultSchema.parse(result);
|
|
35310
|
+
},
|
|
35127
35311
|
inspectHarness,
|
|
35128
35312
|
async listSkills(params) {
|
|
35129
35313
|
return skillsListResultSchema.parse(
|
|
@@ -36871,6 +37055,1438 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
36871
37055
|
};
|
|
36872
37056
|
}
|
|
36873
37057
|
|
|
37058
|
+
// src/codex-locale-adapter.ts
|
|
37059
|
+
var DEFAULT_LOCALE_REQUEST_TIMEOUT_MS = 750;
|
|
37060
|
+
function isNativeLocaleServices(value) {
|
|
37061
|
+
if (!isRecord13(value) || !Object.hasOwn(value, "appInfo")) return false;
|
|
37062
|
+
const appInfo = value.appInfo;
|
|
37063
|
+
return appInfo != null && typeof appInfo.getLocaleInfo === "function";
|
|
37064
|
+
}
|
|
37065
|
+
function isNativeSettingsServices(value) {
|
|
37066
|
+
if (!isRecord13(value) || !Object.hasOwn(value, "settings")) return false;
|
|
37067
|
+
const settings = value.settings;
|
|
37068
|
+
return typeof settings?.read === "function" && typeof settings?.write === "function";
|
|
37069
|
+
}
|
|
37070
|
+
function isRecord13(value) {
|
|
37071
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
37072
|
+
}
|
|
37073
|
+
function canonicalLocale(value) {
|
|
37074
|
+
if (typeof value !== "string" || value.trim().length === 0) return void 0;
|
|
37075
|
+
try {
|
|
37076
|
+
return Intl.getCanonicalLocales(value.trim())[0];
|
|
37077
|
+
} catch {
|
|
37078
|
+
return void 0;
|
|
37079
|
+
}
|
|
37080
|
+
}
|
|
37081
|
+
function firstNavigatorLocale(ownerWindow) {
|
|
37082
|
+
for (const candidate of ownerWindow.navigator.languages) {
|
|
37083
|
+
const locale = canonicalLocale(candidate);
|
|
37084
|
+
if (locale) return locale;
|
|
37085
|
+
}
|
|
37086
|
+
return canonicalLocale(ownerWindow.navigator.language);
|
|
37087
|
+
}
|
|
37088
|
+
function abortError2() {
|
|
37089
|
+
return new DOMException("The operation was aborted", "AbortError");
|
|
37090
|
+
}
|
|
37091
|
+
function parseLocaleOverride(response) {
|
|
37092
|
+
if (!isRecord13(response) || !Object.hasOwn(response, "effective")) {
|
|
37093
|
+
throw new Error("Codex native locale override response is malformed");
|
|
37094
|
+
}
|
|
37095
|
+
if (response.effective === null) return null;
|
|
37096
|
+
const locale = canonicalLocale(response.effective);
|
|
37097
|
+
if (!locale) throw new Error("Codex locale override is invalid");
|
|
37098
|
+
return locale;
|
|
37099
|
+
}
|
|
37100
|
+
function optionalLocale(value, field2) {
|
|
37101
|
+
if (value === void 0 || value === null) return void 0;
|
|
37102
|
+
const locale = canonicalLocale(value);
|
|
37103
|
+
if (!locale) throw new Error(`Codex ${field2} is invalid`);
|
|
37104
|
+
return locale;
|
|
37105
|
+
}
|
|
37106
|
+
function parseLocaleInfo(value) {
|
|
37107
|
+
if (!isRecord13(value)) throw new Error("Codex locale info response is malformed");
|
|
37108
|
+
return {
|
|
37109
|
+
ideLocale: optionalLocale(value.ideLocale, "IDE locale"),
|
|
37110
|
+
systemLocale: optionalLocale(value.systemLocale, "system locale")
|
|
37111
|
+
};
|
|
37112
|
+
}
|
|
37113
|
+
function requestNativeLocale(ownerWindow, signal, timeoutMs, matchesServices, invoke2) {
|
|
37114
|
+
if (signal?.aborted) return Promise.reject(abortError2());
|
|
37115
|
+
return new Promise((resolve, reject) => {
|
|
37116
|
+
let settled = false;
|
|
37117
|
+
let nativeRequest;
|
|
37118
|
+
const settle2 = (operation) => {
|
|
37119
|
+
if (settled) return;
|
|
37120
|
+
settled = true;
|
|
37121
|
+
ownerWindow.clearTimeout(timer);
|
|
37122
|
+
signal?.removeEventListener("abort", onAbort);
|
|
37123
|
+
try {
|
|
37124
|
+
nativeRequest?.[Symbol.dispose]?.();
|
|
37125
|
+
operation();
|
|
37126
|
+
} catch (error62) {
|
|
37127
|
+
reject(error62);
|
|
37128
|
+
}
|
|
37129
|
+
};
|
|
37130
|
+
const onAbort = () => settle2(() => reject(abortError2()));
|
|
37131
|
+
const timer = ownerWindow.setTimeout(
|
|
37132
|
+
() => settle2(() => reject(new Error("Codex locale request timed out"))),
|
|
37133
|
+
timeoutMs
|
|
37134
|
+
);
|
|
37135
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
37136
|
+
void (async () => {
|
|
37137
|
+
const native = await loadCodexNativeServices(ownerWindow, matchesServices);
|
|
37138
|
+
if (settled) return;
|
|
37139
|
+
if (!native) throw new Error("Codex native locale services are unavailable");
|
|
37140
|
+
nativeRequest = invoke2(native);
|
|
37141
|
+
const response = await nativeRequest;
|
|
37142
|
+
settle2(() => resolve(response));
|
|
37143
|
+
})().catch((error62) => settle2(() => reject(error62)));
|
|
37144
|
+
});
|
|
37145
|
+
}
|
|
37146
|
+
async function readCodexLocaleSettings(options = {}) {
|
|
37147
|
+
const ownerWindow = options.ownerWindow ?? window;
|
|
37148
|
+
const timeoutMs = options.timeoutMs ?? DEFAULT_LOCALE_REQUEST_TIMEOUT_MS;
|
|
37149
|
+
if (!Number.isFinite(timeoutMs) || timeoutMs <= 0) {
|
|
37150
|
+
throw new Error("Codex locale request timeout must be positive");
|
|
37151
|
+
}
|
|
37152
|
+
if (options.signal?.aborted) throw abortError2();
|
|
37153
|
+
const [overrideResult, localeInfoResult] = await Promise.allSettled([
|
|
37154
|
+
requestNativeLocale(
|
|
37155
|
+
ownerWindow,
|
|
37156
|
+
options.signal,
|
|
37157
|
+
timeoutMs,
|
|
37158
|
+
isNativeSettingsServices,
|
|
37159
|
+
(native) => native.settings.read("localeOverride")
|
|
37160
|
+
).then(parseLocaleOverride),
|
|
37161
|
+
requestNativeLocale(
|
|
37162
|
+
ownerWindow,
|
|
37163
|
+
options.signal,
|
|
37164
|
+
timeoutMs,
|
|
37165
|
+
isNativeLocaleServices,
|
|
37166
|
+
(native) => native.appInfo.getLocaleInfo()
|
|
37167
|
+
).then(parseLocaleInfo)
|
|
37168
|
+
]);
|
|
37169
|
+
if (options.signal?.aborted) throw abortError2();
|
|
37170
|
+
const navigatorLocale = firstNavigatorLocale(ownerWindow);
|
|
37171
|
+
const overrideKnown = overrideResult.status === "fulfilled";
|
|
37172
|
+
const localeOverride = overrideKnown ? overrideResult.value : void 0;
|
|
37173
|
+
const localeInfo = localeInfoResult.status === "fulfilled" ? localeInfoResult.value : { ideLocale: void 0, systemLocale: void 0 };
|
|
37174
|
+
if (typeof localeOverride === "string") {
|
|
37175
|
+
return Object.freeze({
|
|
37176
|
+
status: "ready",
|
|
37177
|
+
mode: "explicit",
|
|
37178
|
+
localeOverride,
|
|
37179
|
+
ideLocale: localeInfo.ideLocale,
|
|
37180
|
+
systemLocale: localeInfo.systemLocale,
|
|
37181
|
+
preferredLocale: localeOverride,
|
|
37182
|
+
source: "override"
|
|
37183
|
+
});
|
|
37184
|
+
}
|
|
37185
|
+
if (overrideKnown) {
|
|
37186
|
+
const preferredLocale = localeInfo.ideLocale ?? localeInfo.systemLocale ?? navigatorLocale ?? "en-US";
|
|
37187
|
+
const source = localeInfo.ideLocale ? "ide" : localeInfo.systemLocale ? "system" : navigatorLocale ? "navigator" : "default";
|
|
37188
|
+
return Object.freeze({
|
|
37189
|
+
status: "ready",
|
|
37190
|
+
mode: "automatic",
|
|
37191
|
+
localeOverride: null,
|
|
37192
|
+
ideLocale: localeInfo.ideLocale,
|
|
37193
|
+
systemLocale: localeInfo.systemLocale,
|
|
37194
|
+
preferredLocale,
|
|
37195
|
+
source
|
|
37196
|
+
});
|
|
37197
|
+
}
|
|
37198
|
+
return Object.freeze({
|
|
37199
|
+
status: "fallback",
|
|
37200
|
+
mode: "unavailable",
|
|
37201
|
+
localeOverride: void 0,
|
|
37202
|
+
ideLocale: localeInfo.ideLocale,
|
|
37203
|
+
systemLocale: localeInfo.systemLocale,
|
|
37204
|
+
preferredLocale: navigatorLocale ?? "en-US",
|
|
37205
|
+
source: navigatorLocale ? "navigator" : "default"
|
|
37206
|
+
});
|
|
37207
|
+
}
|
|
37208
|
+
|
|
37209
|
+
// src/renderer-handoff-view.ts
|
|
37210
|
+
var SVG_NS3 = "http://www.w3.org/2000/svg";
|
|
37211
|
+
var STYLE_ATTRIBUTE3 = "data-codexhost-handoff-style";
|
|
37212
|
+
var HANDOFF_POPOVER_WIDTH = 316;
|
|
37213
|
+
var HANDOFF_CONTROL_ATTRIBUTE = "data-codexhost-handoff-control";
|
|
37214
|
+
var HANDOFF_DIVIDER_ATTRIBUTE = "data-codexhost-handoff-divider";
|
|
37215
|
+
var HANDOFF_POPOVER_ATTRIBUTE = "data-codexhost-handoff-popover";
|
|
37216
|
+
function createSwapIcon(ownerDocument, size = 14) {
|
|
37217
|
+
const svg2 = ownerDocument.createElementNS(SVG_NS3, "svg");
|
|
37218
|
+
svg2.setAttribute("viewBox", "0 0 16 16");
|
|
37219
|
+
svg2.setAttribute("width", String(size));
|
|
37220
|
+
svg2.setAttribute("height", String(size));
|
|
37221
|
+
svg2.setAttribute("fill", "none");
|
|
37222
|
+
svg2.setAttribute("stroke", "currentColor");
|
|
37223
|
+
svg2.setAttribute("stroke-width", "1.45");
|
|
37224
|
+
svg2.setAttribute("stroke-linecap", "round");
|
|
37225
|
+
svg2.setAttribute("stroke-linejoin", "round");
|
|
37226
|
+
svg2.setAttribute("aria-hidden", "true");
|
|
37227
|
+
svg2.style.flex = "none";
|
|
37228
|
+
for (const d of [
|
|
37229
|
+
"M2.75 5.25H13.25",
|
|
37230
|
+
"M10.75 2.75L13.25 5.25L10.75 7.75",
|
|
37231
|
+
"M13.25 10.75H2.75",
|
|
37232
|
+
"M5.25 8.25L2.75 10.75L5.25 13.25"
|
|
37233
|
+
]) {
|
|
37234
|
+
const path = ownerDocument.createElementNS(SVG_NS3, "path");
|
|
37235
|
+
path.setAttribute("d", d);
|
|
37236
|
+
svg2.append(path);
|
|
37237
|
+
}
|
|
37238
|
+
return svg2;
|
|
37239
|
+
}
|
|
37240
|
+
function createChevronIcon(ownerDocument) {
|
|
37241
|
+
const svg2 = ownerDocument.createElementNS(SVG_NS3, "svg");
|
|
37242
|
+
svg2.setAttribute("viewBox", "0 0 16 16");
|
|
37243
|
+
svg2.setAttribute("width", "12");
|
|
37244
|
+
svg2.setAttribute("height", "12");
|
|
37245
|
+
svg2.setAttribute("fill", "none");
|
|
37246
|
+
svg2.setAttribute("stroke", "currentColor");
|
|
37247
|
+
svg2.setAttribute("stroke-width", "1.6");
|
|
37248
|
+
svg2.setAttribute("stroke-linecap", "round");
|
|
37249
|
+
svg2.setAttribute("stroke-linejoin", "round");
|
|
37250
|
+
svg2.setAttribute("aria-hidden", "true");
|
|
37251
|
+
svg2.classList.add("codexhost-handoff-divider-chevron");
|
|
37252
|
+
const path = ownerDocument.createElementNS(SVG_NS3, "path");
|
|
37253
|
+
path.setAttribute("d", "M4.5 6.25L8 9.75L11.5 6.25");
|
|
37254
|
+
svg2.append(path);
|
|
37255
|
+
return svg2;
|
|
37256
|
+
}
|
|
37257
|
+
function createCheckIcon(ownerDocument) {
|
|
37258
|
+
const svg2 = ownerDocument.createElementNS(SVG_NS3, "svg");
|
|
37259
|
+
svg2.setAttribute("viewBox", "0 0 16 16");
|
|
37260
|
+
svg2.setAttribute("width", "14");
|
|
37261
|
+
svg2.setAttribute("height", "14");
|
|
37262
|
+
svg2.setAttribute("fill", "none");
|
|
37263
|
+
svg2.setAttribute("stroke", "currentColor");
|
|
37264
|
+
svg2.setAttribute("stroke-width", "1.8");
|
|
37265
|
+
svg2.setAttribute("stroke-linecap", "round");
|
|
37266
|
+
svg2.setAttribute("stroke-linejoin", "round");
|
|
37267
|
+
svg2.setAttribute("aria-hidden", "true");
|
|
37268
|
+
svg2.style.flex = "none";
|
|
37269
|
+
const path = ownerDocument.createElementNS(SVG_NS3, "path");
|
|
37270
|
+
path.setAttribute("d", "M3.5 8.5L6.5 11.5L12.5 4.75");
|
|
37271
|
+
svg2.append(path);
|
|
37272
|
+
return svg2;
|
|
37273
|
+
}
|
|
37274
|
+
function formatEndpointLabel(harnessId, harnessLabel, model2, plugin) {
|
|
37275
|
+
const base = harnessLabel?.trim() || rendererAgentLabel(harnessId, plugin);
|
|
37276
|
+
const trimmedModel = model2?.trim();
|
|
37277
|
+
if (!trimmedModel) return base;
|
|
37278
|
+
if (base.toLowerCase().includes(trimmedModel.toLowerCase())) return base;
|
|
37279
|
+
return `${base} (${trimmedModel})`;
|
|
37280
|
+
}
|
|
37281
|
+
function ensureRendererHandoffStyle(ownerDocument) {
|
|
37282
|
+
if (ownerDocument.querySelector(`style[${STYLE_ATTRIBUTE3}]`)) return;
|
|
37283
|
+
const style2 = ownerDocument.createElement("style");
|
|
37284
|
+
style2.setAttribute(STYLE_ATTRIBUTE3, "true");
|
|
37285
|
+
style2.textContent = `
|
|
37286
|
+
[${HANDOFF_CONTROL_ATTRIBUTE}] {
|
|
37287
|
+
display: inline-flex;
|
|
37288
|
+
align-items: center;
|
|
37289
|
+
align-self: center;
|
|
37290
|
+
flex: 0 0 auto;
|
|
37291
|
+
margin-inline-end: 2px;
|
|
37292
|
+
color: inherit;
|
|
37293
|
+
}
|
|
37294
|
+
[${HANDOFF_DIVIDER_ATTRIBUTE}] {
|
|
37295
|
+
display: block;
|
|
37296
|
+
width: 100%;
|
|
37297
|
+
max-width: 780px;
|
|
37298
|
+
margin: 14px auto 16px;
|
|
37299
|
+
padding: 0 12px;
|
|
37300
|
+
box-sizing: border-box;
|
|
37301
|
+
color-scheme: inherit;
|
|
37302
|
+
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
37303
|
+
}
|
|
37304
|
+
.codexhost-handoff-divider-row {
|
|
37305
|
+
display: flex;
|
|
37306
|
+
align-items: center;
|
|
37307
|
+
gap: 12px;
|
|
37308
|
+
width: 100%;
|
|
37309
|
+
}
|
|
37310
|
+
.codexhost-handoff-divider-line {
|
|
37311
|
+
flex: 1 1 auto;
|
|
37312
|
+
min-width: 24px;
|
|
37313
|
+
height: 1px;
|
|
37314
|
+
background: light-dark(rgba(15, 23, 42, 0.1), rgba(255, 255, 255, 0.11));
|
|
37315
|
+
}
|
|
37316
|
+
.codexhost-handoff-divider-button {
|
|
37317
|
+
display: inline-flex;
|
|
37318
|
+
align-items: center;
|
|
37319
|
+
gap: 6px;
|
|
37320
|
+
max-width: min(100%, 640px);
|
|
37321
|
+
min-width: 0;
|
|
37322
|
+
padding: 4px 10px;
|
|
37323
|
+
border: 0;
|
|
37324
|
+
border-radius: 999px;
|
|
37325
|
+
background: transparent;
|
|
37326
|
+
color: light-dark(#6b7280, #9ca3af);
|
|
37327
|
+
font: 400 12.5px/1.35 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
37328
|
+
cursor: pointer;
|
|
37329
|
+
transition: background-color 120ms ease;
|
|
37330
|
+
}
|
|
37331
|
+
.codexhost-handoff-divider-button:hover,
|
|
37332
|
+
.codexhost-handoff-divider-button[aria-expanded="true"] {
|
|
37333
|
+
background: light-dark(rgba(15, 23, 42, 0.045), rgba(255, 255, 255, 0.07));
|
|
37334
|
+
}
|
|
37335
|
+
.codexhost-handoff-divider-button:focus-visible {
|
|
37336
|
+
outline: 2px solid light-dark(#3b82f6, #60a5fa);
|
|
37337
|
+
outline-offset: 2px;
|
|
37338
|
+
}
|
|
37339
|
+
.codexhost-handoff-divider-title {
|
|
37340
|
+
color: light-dark(#6b7280, #9ca3af);
|
|
37341
|
+
white-space: nowrap;
|
|
37342
|
+
flex: 0 0 auto;
|
|
37343
|
+
}
|
|
37344
|
+
.codexhost-handoff-endpoint {
|
|
37345
|
+
display: inline-flex;
|
|
37346
|
+
align-items: center;
|
|
37347
|
+
gap: 5px;
|
|
37348
|
+
min-width: 0;
|
|
37349
|
+
font-weight: 500;
|
|
37350
|
+
}
|
|
37351
|
+
.codexhost-handoff-endpoint--source {
|
|
37352
|
+
color: light-dark(#18181b, #ececec);
|
|
37353
|
+
}
|
|
37354
|
+
.codexhost-handoff-endpoint--target {
|
|
37355
|
+
color: light-dark(#4f79a8, #7cb3f0);
|
|
37356
|
+
}
|
|
37357
|
+
.codexhost-handoff-endpoint-text {
|
|
37358
|
+
overflow: hidden;
|
|
37359
|
+
text-overflow: ellipsis;
|
|
37360
|
+
white-space: nowrap;
|
|
37361
|
+
}
|
|
37362
|
+
.codexhost-handoff-divider-arrow {
|
|
37363
|
+
color: light-dark(#9ca3af, #6b7280);
|
|
37364
|
+
font-size: 12px;
|
|
37365
|
+
flex: 0 0 auto;
|
|
37366
|
+
}
|
|
37367
|
+
.codexhost-handoff-divider-chevron {
|
|
37368
|
+
opacity: 0.55;
|
|
37369
|
+
flex: 0 0 auto;
|
|
37370
|
+
transition: transform 140ms ease;
|
|
37371
|
+
}
|
|
37372
|
+
.codexhost-handoff-divider-button[aria-expanded="true"] .codexhost-handoff-divider-chevron {
|
|
37373
|
+
transform: rotate(180deg);
|
|
37374
|
+
}
|
|
37375
|
+
.codexhost-handoff-detail {
|
|
37376
|
+
margin: 8px auto 0;
|
|
37377
|
+
max-width: 680px;
|
|
37378
|
+
padding: 12px 14px;
|
|
37379
|
+
border-radius: 12px;
|
|
37380
|
+
border: 1px solid light-dark(rgba(15, 23, 42, 0.09), rgba(255, 255, 255, 0.1));
|
|
37381
|
+
background: light-dark(#f8f9fa, #1d1e22);
|
|
37382
|
+
color: light-dark(#18181b, #ececec);
|
|
37383
|
+
box-shadow: light-dark(0 4px 16px rgba(15, 23, 42, 0.05), 0 6px 20px rgba(0, 0, 0, 0.3));
|
|
37384
|
+
box-sizing: border-box;
|
|
37385
|
+
}
|
|
37386
|
+
.codexhost-handoff-detail[hidden] {
|
|
37387
|
+
display: none;
|
|
37388
|
+
}
|
|
37389
|
+
.codexhost-handoff-detail-header {
|
|
37390
|
+
display: flex;
|
|
37391
|
+
align-items: center;
|
|
37392
|
+
justify-content: space-between;
|
|
37393
|
+
gap: 10px;
|
|
37394
|
+
flex-wrap: wrap;
|
|
37395
|
+
}
|
|
37396
|
+
.codexhost-handoff-turns-summary {
|
|
37397
|
+
font-size: 12px;
|
|
37398
|
+
line-height: 1.45;
|
|
37399
|
+
color: light-dark(#52525b, #a1a1aa);
|
|
37400
|
+
}
|
|
37401
|
+
.codexhost-handoff-source-btn {
|
|
37402
|
+
display: inline-flex;
|
|
37403
|
+
align-items: center;
|
|
37404
|
+
gap: 4px;
|
|
37405
|
+
padding: 4px 10px;
|
|
37406
|
+
border-radius: 999px;
|
|
37407
|
+
border: 1px solid light-dark(rgba(15, 23, 42, 0.12), rgba(255, 255, 255, 0.14));
|
|
37408
|
+
background: light-dark(#ffffff, #27272a);
|
|
37409
|
+
color: light-dark(#18181b, #ececec);
|
|
37410
|
+
font: 500 12px/1.3 inherit;
|
|
37411
|
+
cursor: pointer;
|
|
37412
|
+
}
|
|
37413
|
+
.codexhost-handoff-source-btn:hover {
|
|
37414
|
+
background: light-dark(#f1f5f9, #323236);
|
|
37415
|
+
}
|
|
37416
|
+
.codexhost-handoff-preview-label {
|
|
37417
|
+
margin: 10px 0 6px;
|
|
37418
|
+
font-size: 11px;
|
|
37419
|
+
font-weight: 500;
|
|
37420
|
+
color: light-dark(#71717a, #9ca3af);
|
|
37421
|
+
}
|
|
37422
|
+
.codexhost-handoff-preview {
|
|
37423
|
+
margin: 0;
|
|
37424
|
+
padding: 10px 12px;
|
|
37425
|
+
max-height: 220px;
|
|
37426
|
+
overflow: auto;
|
|
37427
|
+
border-radius: 8px;
|
|
37428
|
+
border: 1px solid light-dark(rgba(15, 23, 42, 0.07), rgba(255, 255, 255, 0.08));
|
|
37429
|
+
background: light-dark(#ffffff, #141518);
|
|
37430
|
+
color: light-dark(#27272a, #d4d4d8);
|
|
37431
|
+
font: 400 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
37432
|
+
white-space: pre-wrap;
|
|
37433
|
+
word-break: break-word;
|
|
37434
|
+
}
|
|
37435
|
+
[${HANDOFF_POPOVER_ATTRIBUTE}] {
|
|
37436
|
+
position: fixed;
|
|
37437
|
+
z-index: 2147483647;
|
|
37438
|
+
width: ${HANDOFF_POPOVER_WIDTH}px;
|
|
37439
|
+
max-width: calc(100vw - 16px);
|
|
37440
|
+
padding: 12px;
|
|
37441
|
+
border-radius: 14px;
|
|
37442
|
+
border: 1px solid light-dark(rgba(15, 23, 42, 0.12), rgba(255, 255, 255, 0.12));
|
|
37443
|
+
background: light-dark(#ffffff, #1e1f23);
|
|
37444
|
+
color: light-dark(#18181b, #ececec);
|
|
37445
|
+
box-shadow: light-dark(0 12px 32px rgba(15, 23, 42, 0.14), 0 14px 36px rgba(0, 0, 0, 0.52));
|
|
37446
|
+
color-scheme: inherit;
|
|
37447
|
+
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
37448
|
+
box-sizing: border-box;
|
|
37449
|
+
}
|
|
37450
|
+
.codexhost-handoff-popover-header {
|
|
37451
|
+
display: flex;
|
|
37452
|
+
align-items: center;
|
|
37453
|
+
justify-content: space-between;
|
|
37454
|
+
gap: 8px;
|
|
37455
|
+
margin-bottom: 10px;
|
|
37456
|
+
}
|
|
37457
|
+
.codexhost-handoff-popover-title {
|
|
37458
|
+
display: inline-flex;
|
|
37459
|
+
align-items: center;
|
|
37460
|
+
gap: 6px;
|
|
37461
|
+
font-size: 13px;
|
|
37462
|
+
font-weight: 600;
|
|
37463
|
+
color: light-dark(#18181b, #f4f4f5);
|
|
37464
|
+
}
|
|
37465
|
+
.codexhost-handoff-popover-close {
|
|
37466
|
+
display: inline-flex;
|
|
37467
|
+
align-items: center;
|
|
37468
|
+
justify-content: center;
|
|
37469
|
+
width: 24px;
|
|
37470
|
+
height: 24px;
|
|
37471
|
+
padding: 0;
|
|
37472
|
+
border: 0;
|
|
37473
|
+
border-radius: 6px;
|
|
37474
|
+
background: transparent;
|
|
37475
|
+
color: light-dark(#71717a, #a1a1aa);
|
|
37476
|
+
font-size: 16px;
|
|
37477
|
+
line-height: 1;
|
|
37478
|
+
cursor: pointer;
|
|
37479
|
+
}
|
|
37480
|
+
.codexhost-handoff-popover-close:hover {
|
|
37481
|
+
background: light-dark(rgba(15, 23, 42, 0.06), rgba(255, 255, 255, 0.08));
|
|
37482
|
+
}
|
|
37483
|
+
.codexhost-handoff-field-label {
|
|
37484
|
+
display: block;
|
|
37485
|
+
margin: 8px 0 5px;
|
|
37486
|
+
font-size: 11.5px;
|
|
37487
|
+
font-weight: 500;
|
|
37488
|
+
color: light-dark(#52525b, #a1a1aa);
|
|
37489
|
+
}
|
|
37490
|
+
.codexhost-handoff-harness-list {
|
|
37491
|
+
display: flex;
|
|
37492
|
+
flex-direction: column;
|
|
37493
|
+
gap: 4px;
|
|
37494
|
+
max-height: 176px;
|
|
37495
|
+
overflow-y: auto;
|
|
37496
|
+
}
|
|
37497
|
+
.codexhost-handoff-harness-option {
|
|
37498
|
+
display: flex;
|
|
37499
|
+
align-items: center;
|
|
37500
|
+
gap: 8px;
|
|
37501
|
+
width: 100%;
|
|
37502
|
+
padding: 7px 9px;
|
|
37503
|
+
border-radius: 9px;
|
|
37504
|
+
border: 1px solid transparent;
|
|
37505
|
+
background: transparent;
|
|
37506
|
+
color: light-dark(#18181b, #ececec);
|
|
37507
|
+
font: 500 13px/1.25 inherit;
|
|
37508
|
+
text-align: left;
|
|
37509
|
+
cursor: pointer;
|
|
37510
|
+
box-sizing: border-box;
|
|
37511
|
+
}
|
|
37512
|
+
.codexhost-handoff-harness-option:hover:not(:disabled) {
|
|
37513
|
+
background: light-dark(rgba(15, 23, 42, 0.045), rgba(255, 255, 255, 0.06));
|
|
37514
|
+
}
|
|
37515
|
+
.codexhost-handoff-harness-option[aria-checked="true"] {
|
|
37516
|
+
background: light-dark(rgba(79, 121, 168, 0.1), rgba(124, 179, 240, 0.15));
|
|
37517
|
+
border-color: light-dark(rgba(79, 121, 168, 0.34), rgba(124, 179, 240, 0.34));
|
|
37518
|
+
}
|
|
37519
|
+
.codexhost-handoff-harness-option:disabled {
|
|
37520
|
+
opacity: 0.55;
|
|
37521
|
+
cursor: not-allowed;
|
|
37522
|
+
}
|
|
37523
|
+
.codexhost-handoff-harness-name {
|
|
37524
|
+
flex: 1 1 auto;
|
|
37525
|
+
min-width: 0;
|
|
37526
|
+
overflow: hidden;
|
|
37527
|
+
text-overflow: ellipsis;
|
|
37528
|
+
white-space: nowrap;
|
|
37529
|
+
}
|
|
37530
|
+
.codexhost-handoff-harness-check {
|
|
37531
|
+
color: light-dark(#4f79a8, #7cb3f0);
|
|
37532
|
+
display: inline-flex;
|
|
37533
|
+
align-items: center;
|
|
37534
|
+
flex: 0 0 auto;
|
|
37535
|
+
}
|
|
37536
|
+
.codexhost-handoff-select {
|
|
37537
|
+
width: 100%;
|
|
37538
|
+
height: 32px;
|
|
37539
|
+
padding: 0 8px;
|
|
37540
|
+
border-radius: 8px;
|
|
37541
|
+
border: 1px solid light-dark(rgba(15, 23, 42, 0.14), rgba(255, 255, 255, 0.14));
|
|
37542
|
+
background: light-dark(#f8f9fa, #141518);
|
|
37543
|
+
color: light-dark(#18181b, #ececec);
|
|
37544
|
+
font: 400 12.5px/1.2 inherit;
|
|
37545
|
+
box-sizing: border-box;
|
|
37546
|
+
}
|
|
37547
|
+
.codexhost-handoff-select:disabled {
|
|
37548
|
+
opacity: 0.6;
|
|
37549
|
+
}
|
|
37550
|
+
.codexhost-handoff-error {
|
|
37551
|
+
margin-top: 8px;
|
|
37552
|
+
padding: 6px 9px;
|
|
37553
|
+
border-radius: 8px;
|
|
37554
|
+
background: light-dark(rgba(180, 35, 24, 0.08), rgba(248, 113, 113, 0.13));
|
|
37555
|
+
color: light-dark(#b42318, #fca5a5);
|
|
37556
|
+
font-size: 12px;
|
|
37557
|
+
line-height: 1.4;
|
|
37558
|
+
word-break: break-word;
|
|
37559
|
+
}
|
|
37560
|
+
.codexhost-handoff-popover-actions {
|
|
37561
|
+
display: flex;
|
|
37562
|
+
align-items: center;
|
|
37563
|
+
justify-content: flex-end;
|
|
37564
|
+
gap: 8px;
|
|
37565
|
+
margin-top: 12px;
|
|
37566
|
+
}
|
|
37567
|
+
.codexhost-handoff-btn {
|
|
37568
|
+
display: inline-flex;
|
|
37569
|
+
align-items: center;
|
|
37570
|
+
justify-content: center;
|
|
37571
|
+
min-height: 30px;
|
|
37572
|
+
padding: 0 12px;
|
|
37573
|
+
border-radius: 999px;
|
|
37574
|
+
border: 1px solid light-dark(rgba(15, 23, 42, 0.12), rgba(255, 255, 255, 0.14));
|
|
37575
|
+
background: transparent;
|
|
37576
|
+
color: light-dark(#18181b, #ececec);
|
|
37577
|
+
font: 500 12.5px/1 inherit;
|
|
37578
|
+
cursor: pointer;
|
|
37579
|
+
}
|
|
37580
|
+
.codexhost-handoff-btn:hover:not(:disabled) {
|
|
37581
|
+
background: light-dark(rgba(15, 23, 42, 0.05), rgba(255, 255, 255, 0.08));
|
|
37582
|
+
}
|
|
37583
|
+
.codexhost-handoff-btn--primary {
|
|
37584
|
+
border-color: transparent;
|
|
37585
|
+
background: light-dark(#18181b, #ececec);
|
|
37586
|
+
color: light-dark(#ffffff, #18181b);
|
|
37587
|
+
}
|
|
37588
|
+
.codexhost-handoff-btn--primary:hover:not(:disabled) {
|
|
37589
|
+
opacity: 0.9;
|
|
37590
|
+
background: light-dark(#18181b, #ececec);
|
|
37591
|
+
}
|
|
37592
|
+
.codexhost-handoff-btn:disabled {
|
|
37593
|
+
opacity: 0.55;
|
|
37594
|
+
cursor: not-allowed;
|
|
37595
|
+
}
|
|
37596
|
+
`;
|
|
37597
|
+
(ownerDocument.head ?? ownerDocument.documentElement).append(style2);
|
|
37598
|
+
}
|
|
37599
|
+
function createHandoffDividerElement(options) {
|
|
37600
|
+
const { ownerDocument, handoff: handoff2, plugins = [], locale, onOpenSourceThread } = options;
|
|
37601
|
+
ensureRendererHandoffStyle(ownerDocument);
|
|
37602
|
+
const messages = rendererHarnessMessages(locale);
|
|
37603
|
+
const pluginById = new Map(plugins.map((plugin) => [plugin.id, plugin]));
|
|
37604
|
+
const sourcePlugin = pluginById.get(handoff2.sourceHarnessId);
|
|
37605
|
+
const targetPlugin = pluginById.get(handoff2.targetHarnessId);
|
|
37606
|
+
const root = ownerDocument.createElement("section");
|
|
37607
|
+
root.setAttribute(HANDOFF_DIVIDER_ATTRIBUTE, handoff2.sourceThreadId);
|
|
37608
|
+
root.setAttribute("aria-label", messages.handoffTitle);
|
|
37609
|
+
const row = ownerDocument.createElement("div");
|
|
37610
|
+
row.className = "codexhost-handoff-divider-row";
|
|
37611
|
+
const leftLine = ownerDocument.createElement("span");
|
|
37612
|
+
leftLine.className = "codexhost-handoff-divider-line";
|
|
37613
|
+
leftLine.setAttribute("aria-hidden", "true");
|
|
37614
|
+
const button2 = ownerDocument.createElement("button");
|
|
37615
|
+
button2.type = "button";
|
|
37616
|
+
button2.className = "codexhost-handoff-divider-button";
|
|
37617
|
+
button2.setAttribute("data-codexhost-handoff-divider-toggle", "true");
|
|
37618
|
+
button2.setAttribute("aria-expanded", String(Boolean(options.initiallyExpanded)));
|
|
37619
|
+
const title = ownerDocument.createElement("span");
|
|
37620
|
+
title.className = "codexhost-handoff-divider-title";
|
|
37621
|
+
title.textContent = messages.handoffTitle;
|
|
37622
|
+
const source = ownerDocument.createElement("span");
|
|
37623
|
+
source.className = "codexhost-handoff-endpoint codexhost-handoff-endpoint--source";
|
|
37624
|
+
const sourceText = ownerDocument.createElement("span");
|
|
37625
|
+
sourceText.className = "codexhost-handoff-endpoint-text";
|
|
37626
|
+
sourceText.textContent = formatEndpointLabel(
|
|
37627
|
+
handoff2.sourceHarnessId,
|
|
37628
|
+
handoff2.sourceHarnessLabel,
|
|
37629
|
+
handoff2.sourceModel,
|
|
37630
|
+
sourcePlugin
|
|
37631
|
+
);
|
|
37632
|
+
source.append(
|
|
37633
|
+
createRendererAgentIcon(handoff2.sourceHarnessId, 15, ownerDocument, sourcePlugin),
|
|
37634
|
+
sourceText
|
|
37635
|
+
);
|
|
37636
|
+
const arrow = ownerDocument.createElement("span");
|
|
37637
|
+
arrow.className = "codexhost-handoff-divider-arrow";
|
|
37638
|
+
arrow.setAttribute("aria-hidden", "true");
|
|
37639
|
+
arrow.textContent = "\u2192";
|
|
37640
|
+
const target2 = ownerDocument.createElement("span");
|
|
37641
|
+
target2.className = "codexhost-handoff-endpoint codexhost-handoff-endpoint--target";
|
|
37642
|
+
const targetText = ownerDocument.createElement("span");
|
|
37643
|
+
targetText.className = "codexhost-handoff-endpoint-text";
|
|
37644
|
+
targetText.textContent = formatEndpointLabel(
|
|
37645
|
+
handoff2.targetHarnessId,
|
|
37646
|
+
handoff2.targetHarnessLabel,
|
|
37647
|
+
handoff2.targetModel,
|
|
37648
|
+
targetPlugin
|
|
37649
|
+
);
|
|
37650
|
+
target2.append(
|
|
37651
|
+
createRendererAgentIcon(handoff2.targetHarnessId, 15, ownerDocument, targetPlugin),
|
|
37652
|
+
targetText
|
|
37653
|
+
);
|
|
37654
|
+
button2.append(
|
|
37655
|
+
createSwapIcon(ownerDocument, 14),
|
|
37656
|
+
title,
|
|
37657
|
+
source,
|
|
37658
|
+
arrow,
|
|
37659
|
+
target2,
|
|
37660
|
+
createChevronIcon(ownerDocument)
|
|
37661
|
+
);
|
|
37662
|
+
const rightLine = ownerDocument.createElement("span");
|
|
37663
|
+
rightLine.className = "codexhost-handoff-divider-line";
|
|
37664
|
+
rightLine.setAttribute("aria-hidden", "true");
|
|
37665
|
+
row.append(leftLine, button2, rightLine);
|
|
37666
|
+
const detail = ownerDocument.createElement("div");
|
|
37667
|
+
detail.className = "codexhost-handoff-detail";
|
|
37668
|
+
detail.setAttribute("data-codexhost-handoff-detail", "true");
|
|
37669
|
+
detail.hidden = !options.initiallyExpanded;
|
|
37670
|
+
const detailHeader = ownerDocument.createElement("div");
|
|
37671
|
+
detailHeader.className = "codexhost-handoff-detail-header";
|
|
37672
|
+
const turnsSummary = ownerDocument.createElement("span");
|
|
37673
|
+
turnsSummary.className = "codexhost-handoff-turns-summary";
|
|
37674
|
+
turnsSummary.textContent = formatRendererHandoffTurnsSummary(locale, {
|
|
37675
|
+
includedCount: handoff2.includedTurnNumbers.length,
|
|
37676
|
+
totalTurns: handoff2.totalTurns,
|
|
37677
|
+
omittedTurns: handoff2.omittedTurns,
|
|
37678
|
+
boundaryTurnNumber: handoff2.boundaryTurnNumber
|
|
37679
|
+
});
|
|
37680
|
+
const sourceBtn = ownerDocument.createElement("button");
|
|
37681
|
+
sourceBtn.type = "button";
|
|
37682
|
+
sourceBtn.className = "codexhost-handoff-source-btn";
|
|
37683
|
+
sourceBtn.setAttribute("data-codexhost-handoff-open-source", "true");
|
|
37684
|
+
sourceBtn.textContent = `${messages.handoffOpenSourceThread} \u2197`;
|
|
37685
|
+
sourceBtn.addEventListener("click", () => {
|
|
37686
|
+
onOpenSourceThread(handoff2.sourceThreadId);
|
|
37687
|
+
});
|
|
37688
|
+
detailHeader.append(turnsSummary, sourceBtn);
|
|
37689
|
+
const previewLabel = ownerDocument.createElement("div");
|
|
37690
|
+
previewLabel.className = "codexhost-handoff-preview-label";
|
|
37691
|
+
previewLabel.textContent = messages.handoffPreviewLabel;
|
|
37692
|
+
const preview = ownerDocument.createElement("pre");
|
|
37693
|
+
preview.className = "codexhost-handoff-preview";
|
|
37694
|
+
preview.textContent = handoff2.preview;
|
|
37695
|
+
detail.append(detailHeader, previewLabel, preview);
|
|
37696
|
+
button2.addEventListener("click", () => {
|
|
37697
|
+
const nextExpanded = detail.hidden;
|
|
37698
|
+
detail.hidden = !nextExpanded;
|
|
37699
|
+
button2.setAttribute("aria-expanded", String(nextExpanded));
|
|
37700
|
+
});
|
|
37701
|
+
root.append(row, detail);
|
|
37702
|
+
return root;
|
|
37703
|
+
}
|
|
37704
|
+
function renderHandoffPopoverContent(popover, options) {
|
|
37705
|
+
const {
|
|
37706
|
+
ownerDocument,
|
|
37707
|
+
locale,
|
|
37708
|
+
harnesses,
|
|
37709
|
+
selectedHarnessId,
|
|
37710
|
+
catalog,
|
|
37711
|
+
loadingModels,
|
|
37712
|
+
selectedModelId,
|
|
37713
|
+
selectedThinkingOptionId,
|
|
37714
|
+
submitting,
|
|
37715
|
+
errorMessage: errorMessage4,
|
|
37716
|
+
onSelectHarness,
|
|
37717
|
+
onSelectModel,
|
|
37718
|
+
onSelectThinking,
|
|
37719
|
+
onConfirm,
|
|
37720
|
+
onCancel
|
|
37721
|
+
} = options;
|
|
37722
|
+
ensureRendererHandoffStyle(ownerDocument);
|
|
37723
|
+
const messages = rendererHarnessMessages(locale);
|
|
37724
|
+
popover.replaceChildren();
|
|
37725
|
+
popover.setAttribute("role", "dialog");
|
|
37726
|
+
popover.setAttribute("aria-label", messages.handoffTitle);
|
|
37727
|
+
const header = ownerDocument.createElement("div");
|
|
37728
|
+
header.className = "codexhost-handoff-popover-header";
|
|
37729
|
+
const title = ownerDocument.createElement("div");
|
|
37730
|
+
title.className = "codexhost-handoff-popover-title";
|
|
37731
|
+
const titleText = ownerDocument.createElement("span");
|
|
37732
|
+
titleText.textContent = messages.handoffTitle;
|
|
37733
|
+
title.append(createSwapIcon(ownerDocument, 14), titleText);
|
|
37734
|
+
const closeButton = ownerDocument.createElement("button");
|
|
37735
|
+
closeButton.type = "button";
|
|
37736
|
+
closeButton.className = "codexhost-handoff-popover-close";
|
|
37737
|
+
closeButton.setAttribute("aria-label", messages.handoffCancel);
|
|
37738
|
+
closeButton.textContent = "\xD7";
|
|
37739
|
+
closeButton.disabled = Boolean(submitting);
|
|
37740
|
+
closeButton.addEventListener("click", onCancel);
|
|
37741
|
+
header.append(title, closeButton);
|
|
37742
|
+
popover.append(header);
|
|
37743
|
+
const harnessLabel = ownerDocument.createElement("div");
|
|
37744
|
+
harnessLabel.className = "codexhost-handoff-field-label";
|
|
37745
|
+
harnessLabel.textContent = messages.handoffTargetHarnessLabel;
|
|
37746
|
+
popover.append(harnessLabel);
|
|
37747
|
+
const list = ownerDocument.createElement("div");
|
|
37748
|
+
list.className = "codexhost-handoff-harness-list";
|
|
37749
|
+
list.setAttribute("role", "radiogroup");
|
|
37750
|
+
list.setAttribute("aria-label", messages.handoffTargetHarnessLabel);
|
|
37751
|
+
for (const item of harnesses) {
|
|
37752
|
+
const selected = item.id === selectedHarnessId;
|
|
37753
|
+
const option = ownerDocument.createElement("button");
|
|
37754
|
+
option.type = "button";
|
|
37755
|
+
option.className = "codexhost-handoff-harness-option";
|
|
37756
|
+
option.setAttribute("role", "radio");
|
|
37757
|
+
option.setAttribute("aria-checked", String(selected));
|
|
37758
|
+
option.dataset.harnessId = item.id;
|
|
37759
|
+
option.disabled = Boolean(submitting);
|
|
37760
|
+
const name = ownerDocument.createElement("span");
|
|
37761
|
+
name.className = "codexhost-handoff-harness-name";
|
|
37762
|
+
name.textContent = item.label;
|
|
37763
|
+
option.append(createRendererAgentIcon(item.id, 18, ownerDocument, item.plugin), name);
|
|
37764
|
+
if (selected) {
|
|
37765
|
+
const check2 = ownerDocument.createElement("span");
|
|
37766
|
+
check2.className = "codexhost-handoff-harness-check";
|
|
37767
|
+
check2.append(createCheckIcon(ownerDocument));
|
|
37768
|
+
option.append(check2);
|
|
37769
|
+
}
|
|
37770
|
+
option.addEventListener("click", () => onSelectHarness(item.id));
|
|
37771
|
+
list.append(option);
|
|
37772
|
+
}
|
|
37773
|
+
popover.append(list);
|
|
37774
|
+
const models = catalog?.models ?? [];
|
|
37775
|
+
if (loadingModels || models.length > 0) {
|
|
37776
|
+
const modelLabel = ownerDocument.createElement("label");
|
|
37777
|
+
modelLabel.className = "codexhost-handoff-field-label";
|
|
37778
|
+
modelLabel.textContent = messages.handoffTargetModelLabel;
|
|
37779
|
+
const modelSelect = ownerDocument.createElement("select");
|
|
37780
|
+
modelSelect.className = "codexhost-handoff-select";
|
|
37781
|
+
modelSelect.setAttribute("data-codexhost-handoff-model-select", "true");
|
|
37782
|
+
modelSelect.disabled = Boolean(submitting || loadingModels);
|
|
37783
|
+
const defaultOpt = ownerDocument.createElement("option");
|
|
37784
|
+
defaultOpt.value = "";
|
|
37785
|
+
defaultOpt.textContent = loadingModels ? messages.handoffLoadingModels : messages.handoffDefaultModelOption;
|
|
37786
|
+
modelSelect.append(defaultOpt);
|
|
37787
|
+
for (const model2 of models) {
|
|
37788
|
+
const key2 = harnessModelRefKey(model2.ref);
|
|
37789
|
+
const opt = ownerDocument.createElement("option");
|
|
37790
|
+
opt.value = key2;
|
|
37791
|
+
opt.textContent = model2.label;
|
|
37792
|
+
if (key2 === selectedModelId) opt.selected = true;
|
|
37793
|
+
modelSelect.append(opt);
|
|
37794
|
+
}
|
|
37795
|
+
modelSelect.value = selectedModelId;
|
|
37796
|
+
modelSelect.addEventListener("change", () => onSelectModel(modelSelect.value));
|
|
37797
|
+
popover.append(modelLabel, modelSelect);
|
|
37798
|
+
}
|
|
37799
|
+
let selectedModel;
|
|
37800
|
+
if (selectedModelId) {
|
|
37801
|
+
try {
|
|
37802
|
+
selectedModel = catalogModelForRef(catalog, harnessModelRefFromKey(selectedModelId));
|
|
37803
|
+
} catch {
|
|
37804
|
+
selectedModel = void 0;
|
|
37805
|
+
}
|
|
37806
|
+
}
|
|
37807
|
+
const availableThinking = catalog && catalog.thinkingOptions.length > 0 ? selectedModel?.supportedThinkingOptionIds ? catalog.thinkingOptions.filter(
|
|
37808
|
+
({ id: id2 }) => selectedModel.supportedThinkingOptionIds?.includes(id2)
|
|
37809
|
+
) : catalog.thinkingOptions : [];
|
|
37810
|
+
if (!loadingModels && availableThinking.length > 0) {
|
|
37811
|
+
const thinkingLabel = ownerDocument.createElement("label");
|
|
37812
|
+
thinkingLabel.className = "codexhost-handoff-field-label";
|
|
37813
|
+
thinkingLabel.textContent = messages.handoffTargetThinkingLabel;
|
|
37814
|
+
const thinkingSelect = ownerDocument.createElement("select");
|
|
37815
|
+
thinkingSelect.className = "codexhost-handoff-select";
|
|
37816
|
+
thinkingSelect.setAttribute("data-codexhost-handoff-thinking-select", "true");
|
|
37817
|
+
thinkingSelect.disabled = Boolean(submitting);
|
|
37818
|
+
const defaultOpt = ownerDocument.createElement("option");
|
|
37819
|
+
defaultOpt.value = "";
|
|
37820
|
+
defaultOpt.textContent = messages.handoffDefaultThinkingOption;
|
|
37821
|
+
thinkingSelect.append(defaultOpt);
|
|
37822
|
+
for (const option of availableThinking) {
|
|
37823
|
+
const opt = ownerDocument.createElement("option");
|
|
37824
|
+
opt.value = option.id;
|
|
37825
|
+
opt.textContent = option.label;
|
|
37826
|
+
if (option.id === selectedThinkingOptionId) opt.selected = true;
|
|
37827
|
+
thinkingSelect.append(opt);
|
|
37828
|
+
}
|
|
37829
|
+
thinkingSelect.value = selectedThinkingOptionId;
|
|
37830
|
+
thinkingSelect.addEventListener("change", () => onSelectThinking(thinkingSelect.value));
|
|
37831
|
+
popover.append(thinkingLabel, thinkingSelect);
|
|
37832
|
+
}
|
|
37833
|
+
if (errorMessage4) {
|
|
37834
|
+
const error62 = ownerDocument.createElement("div");
|
|
37835
|
+
error62.className = "codexhost-handoff-error";
|
|
37836
|
+
error62.setAttribute("role", "alert");
|
|
37837
|
+
error62.textContent = errorMessage4;
|
|
37838
|
+
popover.append(error62);
|
|
37839
|
+
}
|
|
37840
|
+
const actions = ownerDocument.createElement("div");
|
|
37841
|
+
actions.className = "codexhost-handoff-popover-actions";
|
|
37842
|
+
const cancelBtn = ownerDocument.createElement("button");
|
|
37843
|
+
cancelBtn.type = "button";
|
|
37844
|
+
cancelBtn.className = "codexhost-handoff-btn";
|
|
37845
|
+
cancelBtn.textContent = messages.handoffCancel;
|
|
37846
|
+
cancelBtn.disabled = Boolean(submitting);
|
|
37847
|
+
cancelBtn.addEventListener("click", onCancel);
|
|
37848
|
+
const confirmBtn = ownerDocument.createElement("button");
|
|
37849
|
+
confirmBtn.type = "button";
|
|
37850
|
+
confirmBtn.className = "codexhost-handoff-btn codexhost-handoff-btn--primary";
|
|
37851
|
+
confirmBtn.setAttribute("data-codexhost-handoff-confirm", "true");
|
|
37852
|
+
confirmBtn.textContent = submitting ? messages.handoffSubmitting : messages.handoffConfirm;
|
|
37853
|
+
confirmBtn.disabled = Boolean(submitting || !selectedHarnessId);
|
|
37854
|
+
confirmBtn.addEventListener("click", onConfirm);
|
|
37855
|
+
actions.append(cancelBtn, confirmBtn);
|
|
37856
|
+
popover.append(actions);
|
|
37857
|
+
}
|
|
37858
|
+
|
|
37859
|
+
// src/renderer-handoff-control.ts
|
|
37860
|
+
var COMPOSER_TURN_SELECTORS = [
|
|
37861
|
+
"[data-turn-key]",
|
|
37862
|
+
"[data-content-search-turn-key]",
|
|
37863
|
+
"[data-local-conversation-item-target-ids]"
|
|
37864
|
+
];
|
|
37865
|
+
var CONVERSATION_ANCESTOR_MAX_DEPTH = 8;
|
|
37866
|
+
var POPOVER_PADDING = 8;
|
|
37867
|
+
var POPOVER_OFFSET = 8;
|
|
37868
|
+
var OWNED_TRAILING_SELECTORS = [
|
|
37869
|
+
"[data-codexhost-harness-command-control]",
|
|
37870
|
+
"[data-codexhost-usage-control]",
|
|
37871
|
+
"[data-codexhost-model-control]",
|
|
37872
|
+
"[data-codexhost-agent-control]"
|
|
37873
|
+
];
|
|
37874
|
+
function defaultResolveComposerThreadId(composer) {
|
|
37875
|
+
const portals = Array.from(composer.children ?? []).filter(
|
|
37876
|
+
(child) => child.hasAttribute("data-above-composer-portal")
|
|
37877
|
+
);
|
|
37878
|
+
if (portals.length !== 1) return null;
|
|
37879
|
+
const raw = portals[0]?.getAttribute("data-above-composer-conversation-id");
|
|
37880
|
+
if (!raw) return null;
|
|
37881
|
+
const parsed = hostThreadIdSchema.safeParse(raw);
|
|
37882
|
+
return parsed.success ? parsed.data : null;
|
|
37883
|
+
}
|
|
37884
|
+
function isComposerVisible(composer, ownerWindow) {
|
|
37885
|
+
if (!composer.isConnected) return false;
|
|
37886
|
+
if (typeof composer.closest === "function" && composer.closest('[hidden], [inert], [aria-hidden="true"]'))
|
|
37887
|
+
return false;
|
|
37888
|
+
if (typeof ownerWindow.getComputedStyle === "function") {
|
|
37889
|
+
const style2 = ownerWindow.getComputedStyle(composer);
|
|
37890
|
+
if (style2.display === "none" || style2.visibility === "hidden") return false;
|
|
37891
|
+
}
|
|
37892
|
+
return true;
|
|
37893
|
+
}
|
|
37894
|
+
function findActiveConversationComposer(ownerDocument, ownerWindow, resolveThreadId) {
|
|
37895
|
+
const composers = [...ownerDocument.querySelectorAll(CODEX_COMPOSER_SELECTOR)];
|
|
37896
|
+
for (const composer of composers) {
|
|
37897
|
+
if (isOrbitComposer(composer) || hasNativeComposerRequest(composer)) continue;
|
|
37898
|
+
if (!isComposerVisible(composer, ownerWindow)) continue;
|
|
37899
|
+
const threadId = resolveThreadId(composer);
|
|
37900
|
+
if (threadId) return { composer, threadId };
|
|
37901
|
+
}
|
|
37902
|
+
return null;
|
|
37903
|
+
}
|
|
37904
|
+
function findTriggerAnchor(composer) {
|
|
37905
|
+
const sendButton = sendButtonWithin(composer);
|
|
37906
|
+
if (!sendButton) return null;
|
|
37907
|
+
const trailing = trailingActionAnchor(sendButton);
|
|
37908
|
+
const parent = trailing.parentElement;
|
|
37909
|
+
if (!parent || !parent.isConnected || !composer.contains(parent)) return null;
|
|
37910
|
+
for (const selector of OWNED_TRAILING_SELECTORS) {
|
|
37911
|
+
const existing = parent.querySelector(selector);
|
|
37912
|
+
if (existing && existing.parentElement === parent) {
|
|
37913
|
+
return { parent, before: existing };
|
|
37914
|
+
}
|
|
37915
|
+
}
|
|
37916
|
+
return { parent, before: trailing };
|
|
37917
|
+
}
|
|
37918
|
+
function findConversationDividerAnchor(composer) {
|
|
37919
|
+
let ancestor = composer.parentElement;
|
|
37920
|
+
for (let depth = 0; ancestor && depth < CONVERSATION_ANCESTOR_MAX_DEPTH && ancestor !== composer.ownerDocument.body; depth += 1) {
|
|
37921
|
+
for (const selector of COMPOSER_TURN_SELECTORS) {
|
|
37922
|
+
const firstTurn = ancestor.querySelector(selector);
|
|
37923
|
+
if (firstTurn && firstTurn.parentElement && !composer.contains(firstTurn)) {
|
|
37924
|
+
return { parent: firstTurn.parentElement, before: firstTurn };
|
|
37925
|
+
}
|
|
37926
|
+
}
|
|
37927
|
+
ancestor = ancestor.parentElement;
|
|
37928
|
+
}
|
|
37929
|
+
if (composer.parentElement) {
|
|
37930
|
+
return { parent: composer.parentElement, before: composer };
|
|
37931
|
+
}
|
|
37932
|
+
return null;
|
|
37933
|
+
}
|
|
37934
|
+
function positionPopover3(popover, trigger, ownerWindow, ownerDocument) {
|
|
37935
|
+
const rect = trigger.getBoundingClientRect();
|
|
37936
|
+
const rawZoom = typeof ownerWindow.getComputedStyle === "function" ? ownerWindow.getComputedStyle(ownerDocument.documentElement).getPropertyValue("--codex-window-zoom") : "";
|
|
37937
|
+
const parsedZoom = Number.parseFloat(rawZoom.trim());
|
|
37938
|
+
const zoom = Number.isFinite(parsedZoom) && parsedZoom > 0 ? parsedZoom : 1;
|
|
37939
|
+
const viewportWidth = (ownerWindow.innerWidth || 1024) / zoom;
|
|
37940
|
+
const viewportHeight = (ownerWindow.innerHeight || 768) / zoom;
|
|
37941
|
+
const width = Math.min(HANDOFF_POPOVER_WIDTH, Math.max(220, viewportWidth - POPOVER_PADDING * 2));
|
|
37942
|
+
const left = Math.max(
|
|
37943
|
+
POPOVER_PADDING,
|
|
37944
|
+
Math.min(rect.right / zoom - width, viewportWidth - width - POPOVER_PADDING)
|
|
37945
|
+
);
|
|
37946
|
+
const bottom = Math.max(POPOVER_PADDING, viewportHeight - rect.top / zoom + POPOVER_OFFSET);
|
|
37947
|
+
popover.style.width = `${width}px`;
|
|
37948
|
+
popover.style.left = `${left}px`;
|
|
37949
|
+
popover.style.bottom = `${bottom}px`;
|
|
37950
|
+
}
|
|
37951
|
+
function errorDetail(error62, fallback) {
|
|
37952
|
+
if (error62 instanceof Error && error62.message.trim().length > 0) {
|
|
37953
|
+
return `${fallback}: ${error62.message.trim()}`;
|
|
37954
|
+
}
|
|
37955
|
+
return fallback;
|
|
37956
|
+
}
|
|
37957
|
+
function installRendererHandoffControl(options) {
|
|
37958
|
+
const ownerDocument = options.document ?? (typeof document !== "undefined" ? document : void 0);
|
|
37959
|
+
const ownerWindow = options.window ?? (typeof window !== "undefined" ? window : void 0);
|
|
37960
|
+
if (!ownerDocument || !ownerWindow || typeof ownerDocument.querySelectorAll !== "function" || !ownerDocument.documentElement) {
|
|
37961
|
+
return {
|
|
37962
|
+
refresh() {
|
|
37963
|
+
},
|
|
37964
|
+
dispose() {
|
|
37965
|
+
}
|
|
37966
|
+
};
|
|
37967
|
+
}
|
|
37968
|
+
const resolveThreadId = options.resolveComposerThreadId ?? defaultResolveComposerThreadId;
|
|
37969
|
+
const openThread = options.openThread ?? ((threadId, openOptions) => openRendererThread(threadId, openOptions));
|
|
37970
|
+
let disposed = false;
|
|
37971
|
+
let locale = options.getLocale?.() ?? resolveRendererSettingsLocale(
|
|
37972
|
+
ownerWindow.navigator?.languages ?? [ownerWindow.navigator?.language ?? "en"]
|
|
37973
|
+
);
|
|
37974
|
+
const currentLocale = () => options.getLocale?.() ?? locale;
|
|
37975
|
+
let activeComposer = null;
|
|
37976
|
+
let activeThreadId = null;
|
|
37977
|
+
let activeHostId = null;
|
|
37978
|
+
let triggerRoot = null;
|
|
37979
|
+
let triggerButton = null;
|
|
37980
|
+
let dividerElement = null;
|
|
37981
|
+
let dividerKey = null;
|
|
37982
|
+
const handoffCache = /* @__PURE__ */ new Map();
|
|
37983
|
+
const threadOwnerHarness = /* @__PURE__ */ new Map();
|
|
37984
|
+
const inFlightInspects = /* @__PURE__ */ new Map();
|
|
37985
|
+
const pluginsByHost = /* @__PURE__ */ new Map();
|
|
37986
|
+
const pluginsLoadingByHost = /* @__PURE__ */ new Map();
|
|
37987
|
+
const harnessCatalogCache = /* @__PURE__ */ new Map();
|
|
37988
|
+
const harnessInspectInFlight = /* @__PURE__ */ new Set();
|
|
37989
|
+
let popoverState = null;
|
|
37990
|
+
const hostScopeKey = (hostId2) => hostId2 ?? "default";
|
|
37991
|
+
const cacheKeyFor = (hostId2, threadId) => `${hostScopeKey(hostId2)}\0${threadId}`;
|
|
37992
|
+
const catalogCacheKey = (hostId2, harnessId) => `${hostScopeKey(hostId2)}\0${harnessId}`;
|
|
37993
|
+
const clientForHost = (hostId2) => {
|
|
37994
|
+
const base = options.getClient();
|
|
37995
|
+
if (!base) return null;
|
|
37996
|
+
if (hostId2 === null) return base;
|
|
37997
|
+
if (base.clientForHost) return base.clientForHost(hostId2);
|
|
37998
|
+
if (!base.currentHostId) return hostId2 === "local" ? base : null;
|
|
37999
|
+
return base.currentHostId() === hostId2 ? base : null;
|
|
38000
|
+
};
|
|
38001
|
+
const pluginsForHost = (hostId2) => pluginsByHost.get(hostScopeKey(hostId2)) ?? [];
|
|
38002
|
+
const unmountDivider = () => {
|
|
38003
|
+
dividerElement?.remove();
|
|
38004
|
+
dividerElement = null;
|
|
38005
|
+
dividerKey = null;
|
|
38006
|
+
};
|
|
38007
|
+
const unmountTrigger = () => {
|
|
38008
|
+
triggerRoot?.remove();
|
|
38009
|
+
triggerRoot = null;
|
|
38010
|
+
triggerButton = null;
|
|
38011
|
+
};
|
|
38012
|
+
const closePopover3 = () => {
|
|
38013
|
+
if (!popoverState) return;
|
|
38014
|
+
popoverState.element.remove();
|
|
38015
|
+
popoverState = null;
|
|
38016
|
+
triggerButton?.setAttribute("aria-expanded", "false");
|
|
38017
|
+
triggerButton?.removeAttribute("data-state");
|
|
38018
|
+
};
|
|
38019
|
+
const availableHarnesses = (hostId2) => [
|
|
38020
|
+
{ id: "codex", label: "Codex" },
|
|
38021
|
+
...pluginsForHost(hostId2).map((plugin) => ({
|
|
38022
|
+
id: plugin.id,
|
|
38023
|
+
label: rendererAgentLabel(plugin.id, plugin),
|
|
38024
|
+
plugin
|
|
38025
|
+
}))
|
|
38026
|
+
];
|
|
38027
|
+
const loadPlugins = async (client, hostId2) => {
|
|
38028
|
+
const scope = hostScopeKey(hostId2);
|
|
38029
|
+
if (pluginsByHost.has(scope) || !client.listHarnessPlugins) return;
|
|
38030
|
+
const existing = pluginsLoadingByHost.get(scope);
|
|
38031
|
+
if (existing) return existing;
|
|
38032
|
+
const request = (async () => {
|
|
38033
|
+
try {
|
|
38034
|
+
const result = await client.listHarnessPlugins?.();
|
|
38035
|
+
if (disposed || !result) return;
|
|
38036
|
+
pluginsByHost.set(
|
|
38037
|
+
scope,
|
|
38038
|
+
result.plugins.filter(({ kind }) => kind !== "usage")
|
|
38039
|
+
);
|
|
38040
|
+
if (popoverState && hostScopeKey(popoverState.hostId) === scope) renderPopover();
|
|
38041
|
+
if (activeThreadId && hostScopeKey(activeHostId) === scope) syncDivider();
|
|
38042
|
+
} catch {
|
|
38043
|
+
} finally {
|
|
38044
|
+
pluginsLoadingByHost.delete(scope);
|
|
38045
|
+
}
|
|
38046
|
+
})();
|
|
38047
|
+
pluginsLoadingByHost.set(scope, request);
|
|
38048
|
+
return request;
|
|
38049
|
+
};
|
|
38050
|
+
const loadHarnessCatalog = (hostId2, harnessId) => {
|
|
38051
|
+
const key2 = catalogCacheKey(hostId2, harnessId);
|
|
38052
|
+
if (harnessId === "codex" || harnessCatalogCache.has(key2)) return;
|
|
38053
|
+
if (harnessInspectInFlight.has(key2)) return;
|
|
38054
|
+
const client = clientForHost(hostId2);
|
|
38055
|
+
if (!client) return;
|
|
38056
|
+
const parsedId = harnessIdSchema.safeParse(harnessId);
|
|
38057
|
+
if (!parsedId.success) return;
|
|
38058
|
+
harnessInspectInFlight.add(key2);
|
|
38059
|
+
if (popoverState?.selectedHarnessId === harnessId && popoverState.hostId === hostId2) {
|
|
38060
|
+
renderPopover();
|
|
38061
|
+
}
|
|
38062
|
+
void client.inspectHarness({ harnessId: parsedId.data }).then((inspection) => {
|
|
38063
|
+
if (disposed) return;
|
|
38064
|
+
harnessCatalogCache.set(
|
|
38065
|
+
key2,
|
|
38066
|
+
inspection.status === "ready" ? inspection.catalog ?? null : null
|
|
38067
|
+
);
|
|
38068
|
+
}).catch(() => {
|
|
38069
|
+
if (!disposed) harnessCatalogCache.set(key2, null);
|
|
38070
|
+
}).finally(() => {
|
|
38071
|
+
harnessInspectInFlight.delete(key2);
|
|
38072
|
+
if (!disposed && popoverState?.selectedHarnessId === harnessId && popoverState.hostId === hostId2) {
|
|
38073
|
+
renderPopover();
|
|
38074
|
+
}
|
|
38075
|
+
});
|
|
38076
|
+
};
|
|
38077
|
+
const submitHandoff = () => {
|
|
38078
|
+
const state = popoverState;
|
|
38079
|
+
if (!state || state.submitting) return;
|
|
38080
|
+
const targetHostId = state.hostId;
|
|
38081
|
+
const openCreatedTarget = async (createdThreadId) => {
|
|
38082
|
+
await openThread(createdThreadId, targetHostId ? { hostId: targetHostId } : void 0);
|
|
38083
|
+
if (disposed) return;
|
|
38084
|
+
if (popoverState === state) closePopover3();
|
|
38085
|
+
};
|
|
38086
|
+
if (state.createdThreadId) {
|
|
38087
|
+
state.submitting = true;
|
|
38088
|
+
state.errorMessage = null;
|
|
38089
|
+
renderPopover();
|
|
38090
|
+
void openCreatedTarget(state.createdThreadId).catch((error62) => {
|
|
38091
|
+
if (disposed) return;
|
|
38092
|
+
options.reportError?.(error62);
|
|
38093
|
+
if (popoverState === state) {
|
|
38094
|
+
state.submitting = false;
|
|
38095
|
+
state.errorMessage = errorDetail(
|
|
38096
|
+
error62,
|
|
38097
|
+
rendererHarnessMessages(currentLocale()).handoffFailed
|
|
38098
|
+
);
|
|
38099
|
+
renderPopover();
|
|
38100
|
+
}
|
|
38101
|
+
});
|
|
38102
|
+
return;
|
|
38103
|
+
}
|
|
38104
|
+
const client = clientForHost(targetHostId);
|
|
38105
|
+
if (!client) {
|
|
38106
|
+
state.errorMessage = rendererHarnessMessages(currentLocale()).handoffFailed;
|
|
38107
|
+
renderPopover();
|
|
38108
|
+
return;
|
|
38109
|
+
}
|
|
38110
|
+
const parsedHarness = harnessIdSchema.safeParse(state.selectedHarnessId);
|
|
38111
|
+
if (!parsedHarness.success) {
|
|
38112
|
+
state.errorMessage = rendererHarnessMessages(currentLocale()).handoffFailed;
|
|
38113
|
+
renderPopover();
|
|
38114
|
+
return;
|
|
38115
|
+
}
|
|
38116
|
+
state.submitting = true;
|
|
38117
|
+
state.errorMessage = null;
|
|
38118
|
+
renderPopover();
|
|
38119
|
+
void client.handoffThread({
|
|
38120
|
+
sourceThreadId: state.threadId,
|
|
38121
|
+
targetHarnessId: parsedHarness.data,
|
|
38122
|
+
...state.selectedModelId ? { targetModel: state.selectedModelId } : {},
|
|
38123
|
+
...state.selectedThinkingOptionId ? { targetThinkingOptionId: state.selectedThinkingOptionId } : {}
|
|
38124
|
+
}).then(async (result) => {
|
|
38125
|
+
if (disposed) return;
|
|
38126
|
+
handoffCache.set(cacheKeyFor(targetHostId, result.threadId), result.handoff);
|
|
38127
|
+
threadOwnerHarness.set(
|
|
38128
|
+
cacheKeyFor(targetHostId, result.threadId),
|
|
38129
|
+
result.handoff.targetHarnessId
|
|
38130
|
+
);
|
|
38131
|
+
state.createdThreadId = result.threadId;
|
|
38132
|
+
await openCreatedTarget(result.threadId);
|
|
38133
|
+
}).catch((error62) => {
|
|
38134
|
+
if (disposed) return;
|
|
38135
|
+
options.reportError?.(error62);
|
|
38136
|
+
if (popoverState === state) {
|
|
38137
|
+
state.submitting = false;
|
|
38138
|
+
state.errorMessage = errorDetail(
|
|
38139
|
+
error62,
|
|
38140
|
+
rendererHarnessMessages(currentLocale()).handoffFailed
|
|
38141
|
+
);
|
|
38142
|
+
renderPopover();
|
|
38143
|
+
}
|
|
38144
|
+
});
|
|
38145
|
+
};
|
|
38146
|
+
const renderPopover = () => {
|
|
38147
|
+
const state = popoverState;
|
|
38148
|
+
if (!state) return;
|
|
38149
|
+
const harnesses = availableHarnesses(state.hostId);
|
|
38150
|
+
if (!harnesses.some(({ id: id2 }) => id2 === state.selectedHarnessId) && harnesses[0]) {
|
|
38151
|
+
state.selectedHarnessId = harnesses[0].id;
|
|
38152
|
+
}
|
|
38153
|
+
const key2 = catalogCacheKey(state.hostId, state.selectedHarnessId);
|
|
38154
|
+
const catalog = harnessCatalogCache.get(key2) ?? void 0;
|
|
38155
|
+
const loadingModels = harnessInspectInFlight.has(key2);
|
|
38156
|
+
renderHandoffPopoverContent(state.element, {
|
|
38157
|
+
ownerDocument,
|
|
38158
|
+
locale: currentLocale(),
|
|
38159
|
+
harnesses,
|
|
38160
|
+
selectedHarnessId: state.selectedHarnessId,
|
|
38161
|
+
catalog,
|
|
38162
|
+
loadingModels,
|
|
38163
|
+
selectedModelId: state.selectedModelId,
|
|
38164
|
+
selectedThinkingOptionId: state.selectedThinkingOptionId,
|
|
38165
|
+
submitting: state.submitting,
|
|
38166
|
+
errorMessage: state.errorMessage,
|
|
38167
|
+
onSelectHarness: (harnessId) => {
|
|
38168
|
+
if (state.selectedHarnessId === harnessId) return;
|
|
38169
|
+
state.selectedHarnessId = harnessId;
|
|
38170
|
+
state.selectedModelId = "";
|
|
38171
|
+
state.selectedThinkingOptionId = "";
|
|
38172
|
+
state.errorMessage = null;
|
|
38173
|
+
state.createdThreadId = null;
|
|
38174
|
+
loadHarnessCatalog(state.hostId, harnessId);
|
|
38175
|
+
renderPopover();
|
|
38176
|
+
},
|
|
38177
|
+
onSelectModel: (modelId2) => {
|
|
38178
|
+
state.selectedModelId = modelId2;
|
|
38179
|
+
state.selectedThinkingOptionId = "";
|
|
38180
|
+
state.createdThreadId = null;
|
|
38181
|
+
renderPopover();
|
|
38182
|
+
},
|
|
38183
|
+
onSelectThinking: (thinkingId) => {
|
|
38184
|
+
state.selectedThinkingOptionId = thinkingId;
|
|
38185
|
+
state.createdThreadId = null;
|
|
38186
|
+
renderPopover();
|
|
38187
|
+
},
|
|
38188
|
+
onConfirm: submitHandoff,
|
|
38189
|
+
onCancel: closePopover3
|
|
38190
|
+
});
|
|
38191
|
+
if (triggerButton) {
|
|
38192
|
+
positionPopover3(state.element, triggerButton, ownerWindow, ownerDocument);
|
|
38193
|
+
}
|
|
38194
|
+
};
|
|
38195
|
+
const openPopover3 = () => {
|
|
38196
|
+
if (disposed || !activeThreadId || !triggerButton) return;
|
|
38197
|
+
if (popoverState) {
|
|
38198
|
+
closePopover3();
|
|
38199
|
+
return;
|
|
38200
|
+
}
|
|
38201
|
+
const targetHostId = activeHostId;
|
|
38202
|
+
const client = clientForHost(targetHostId);
|
|
38203
|
+
const currentKey = cacheKeyFor(targetHostId, activeThreadId);
|
|
38204
|
+
const currentOwner = threadOwnerHarness.get(currentKey);
|
|
38205
|
+
const harnesses = availableHarnesses(targetHostId);
|
|
38206
|
+
const defaultTarget = harnesses.find(({ id: id2 }) => id2 !== currentOwner)?.id ?? harnesses[0]?.id ?? "codex";
|
|
38207
|
+
const element = ownerDocument.createElement("div");
|
|
38208
|
+
element.setAttribute(HANDOFF_POPOVER_ATTRIBUTE, "true");
|
|
38209
|
+
(ownerDocument.body ?? ownerDocument.documentElement).append(element);
|
|
38210
|
+
popoverState = {
|
|
38211
|
+
element,
|
|
38212
|
+
threadId: activeThreadId,
|
|
38213
|
+
hostId: targetHostId,
|
|
38214
|
+
selectedHarnessId: defaultTarget,
|
|
38215
|
+
selectedModelId: "",
|
|
38216
|
+
selectedThinkingOptionId: "",
|
|
38217
|
+
submitting: false,
|
|
38218
|
+
errorMessage: null,
|
|
38219
|
+
createdThreadId: null
|
|
38220
|
+
};
|
|
38221
|
+
triggerButton.setAttribute("aria-expanded", "true");
|
|
38222
|
+
triggerButton.setAttribute("data-state", "open");
|
|
38223
|
+
renderPopover();
|
|
38224
|
+
if (client) {
|
|
38225
|
+
void loadPlugins(client, targetHostId).then(() => {
|
|
38226
|
+
if (!disposed && popoverState && popoverState.hostId === targetHostId) {
|
|
38227
|
+
const updatedHarnesses = availableHarnesses(targetHostId);
|
|
38228
|
+
if (popoverState.selectedHarnessId === currentOwner && updatedHarnesses.some(({ id: id2 }) => id2 !== currentOwner)) {
|
|
38229
|
+
popoverState.selectedHarnessId = updatedHarnesses.find(({ id: id2 }) => id2 !== currentOwner)?.id ?? popoverState.selectedHarnessId;
|
|
38230
|
+
}
|
|
38231
|
+
loadHarnessCatalog(targetHostId, popoverState.selectedHarnessId);
|
|
38232
|
+
renderPopover();
|
|
38233
|
+
}
|
|
38234
|
+
});
|
|
38235
|
+
}
|
|
38236
|
+
loadHarnessCatalog(targetHostId, defaultTarget);
|
|
38237
|
+
};
|
|
38238
|
+
const ensureTriggerMounted = (composer) => {
|
|
38239
|
+
const anchor2 = findTriggerAnchor(composer);
|
|
38240
|
+
if (!anchor2) {
|
|
38241
|
+
unmountTrigger();
|
|
38242
|
+
return;
|
|
38243
|
+
}
|
|
38244
|
+
ensureRendererTriggerChipStyle(ownerDocument);
|
|
38245
|
+
ensureRendererHandoffStyle(ownerDocument);
|
|
38246
|
+
const messages = rendererHarnessMessages(currentLocale());
|
|
38247
|
+
if (!triggerRoot || !triggerButton) {
|
|
38248
|
+
const root = ownerDocument.createElement("div");
|
|
38249
|
+
root.setAttribute(HANDOFF_CONTROL_ATTRIBUTE, "true");
|
|
38250
|
+
const button2 = ownerDocument.createElement("button");
|
|
38251
|
+
button2.type = "button";
|
|
38252
|
+
button2.className = TRIGGER_CHIP_CLASS;
|
|
38253
|
+
button2.setAttribute("aria-haspopup", "dialog");
|
|
38254
|
+
button2.setAttribute("aria-expanded", "false");
|
|
38255
|
+
button2.setAttribute("data-codexhost-handoff-trigger", "true");
|
|
38256
|
+
Object.assign(button2.style, {
|
|
38257
|
+
width: "28px",
|
|
38258
|
+
height: "28px",
|
|
38259
|
+
padding: "0"
|
|
38260
|
+
});
|
|
38261
|
+
button2.append(createSwapIcon(ownerDocument, 14));
|
|
38262
|
+
button2.addEventListener("click", (event) => {
|
|
38263
|
+
event.stopPropagation();
|
|
38264
|
+
openPopover3();
|
|
38265
|
+
});
|
|
38266
|
+
root.append(button2);
|
|
38267
|
+
triggerRoot = root;
|
|
38268
|
+
triggerButton = button2;
|
|
38269
|
+
}
|
|
38270
|
+
triggerButton.setAttribute("aria-label", messages.handoffAction);
|
|
38271
|
+
triggerButton.title = messages.handoffAction;
|
|
38272
|
+
if (triggerRoot.parentElement !== anchor2.parent || triggerRoot.nextElementSibling !== anchor2.before) {
|
|
38273
|
+
anchor2.parent.insertBefore(triggerRoot, anchor2.before);
|
|
38274
|
+
}
|
|
38275
|
+
};
|
|
38276
|
+
const syncDivider = () => {
|
|
38277
|
+
if (!activeComposer || !activeThreadId) {
|
|
38278
|
+
unmountDivider();
|
|
38279
|
+
return;
|
|
38280
|
+
}
|
|
38281
|
+
const key2 = cacheKeyFor(activeHostId, activeThreadId);
|
|
38282
|
+
const handoff2 = handoffCache.get(key2);
|
|
38283
|
+
if (!handoff2) {
|
|
38284
|
+
unmountDivider();
|
|
38285
|
+
return;
|
|
38286
|
+
}
|
|
38287
|
+
const anchor2 = findConversationDividerAnchor(activeComposer);
|
|
38288
|
+
if (!anchor2) {
|
|
38289
|
+
unmountDivider();
|
|
38290
|
+
return;
|
|
38291
|
+
}
|
|
38292
|
+
const plugins = pluginsForHost(activeHostId);
|
|
38293
|
+
const renderSignature = JSON.stringify([
|
|
38294
|
+
key2,
|
|
38295
|
+
currentLocale(),
|
|
38296
|
+
handoff2.createdAtMs,
|
|
38297
|
+
plugins.map(({ id: id2, name, icon: icon2 }) => [id2, name, icon2])
|
|
38298
|
+
]);
|
|
38299
|
+
if (!dividerElement || dividerKey !== renderSignature) {
|
|
38300
|
+
const wasExpanded = dividerElement?.querySelector("[data-codexhost-handoff-divider-toggle]")?.getAttribute("aria-expanded") === "true";
|
|
38301
|
+
dividerElement?.remove();
|
|
38302
|
+
const targetHostId = activeHostId;
|
|
38303
|
+
dividerElement = createHandoffDividerElement({
|
|
38304
|
+
ownerDocument,
|
|
38305
|
+
handoff: handoff2,
|
|
38306
|
+
plugins,
|
|
38307
|
+
locale: currentLocale(),
|
|
38308
|
+
initiallyExpanded: wasExpanded,
|
|
38309
|
+
onOpenSourceThread: (sourceThreadId) => {
|
|
38310
|
+
void openThread(
|
|
38311
|
+
sourceThreadId,
|
|
38312
|
+
targetHostId ? { hostId: targetHostId } : void 0
|
|
38313
|
+
).catch((error62) => options.reportError?.(error62));
|
|
38314
|
+
}
|
|
38315
|
+
});
|
|
38316
|
+
dividerKey = renderSignature;
|
|
38317
|
+
}
|
|
38318
|
+
if (dividerElement.parentElement !== anchor2.parent || dividerElement.nextElementSibling !== anchor2.before) {
|
|
38319
|
+
anchor2.parent.insertBefore(dividerElement, anchor2.before);
|
|
38320
|
+
}
|
|
38321
|
+
};
|
|
38322
|
+
const ensureThreadInspected = (threadId, hostId2) => {
|
|
38323
|
+
const key2 = cacheKeyFor(hostId2, threadId);
|
|
38324
|
+
if (handoffCache.has(key2) || inFlightInspects.has(key2)) return;
|
|
38325
|
+
const client = clientForHost(hostId2);
|
|
38326
|
+
if (!client) return;
|
|
38327
|
+
const request = (async () => {
|
|
38328
|
+
try {
|
|
38329
|
+
const inspection = await client.inspectThread({ threadId });
|
|
38330
|
+
if (disposed) return;
|
|
38331
|
+
threadOwnerHarness.set(
|
|
38332
|
+
key2,
|
|
38333
|
+
inspection.owner === "external" ? inspection.harnessId : "codex"
|
|
38334
|
+
);
|
|
38335
|
+
const handoff2 = inspection.handoff ?? null;
|
|
38336
|
+
handoffCache.set(key2, handoff2);
|
|
38337
|
+
if (handoff2) {
|
|
38338
|
+
void loadPlugins(client, hostId2);
|
|
38339
|
+
}
|
|
38340
|
+
if (activeThreadId === threadId && activeHostId === hostId2) {
|
|
38341
|
+
syncDivider();
|
|
38342
|
+
}
|
|
38343
|
+
} catch {
|
|
38344
|
+
} finally {
|
|
38345
|
+
inFlightInspects.delete(key2);
|
|
38346
|
+
}
|
|
38347
|
+
})();
|
|
38348
|
+
inFlightInspects.set(key2, request);
|
|
38349
|
+
};
|
|
38350
|
+
const refresh = () => {
|
|
38351
|
+
if (disposed) return;
|
|
38352
|
+
const active2 = findActiveConversationComposer(ownerDocument, ownerWindow, resolveThreadId);
|
|
38353
|
+
if (!active2) {
|
|
38354
|
+
activeComposer = null;
|
|
38355
|
+
activeThreadId = null;
|
|
38356
|
+
activeHostId = null;
|
|
38357
|
+
closePopover3();
|
|
38358
|
+
unmountTrigger();
|
|
38359
|
+
unmountDivider();
|
|
38360
|
+
return;
|
|
38361
|
+
}
|
|
38362
|
+
const hostId2 = options.getHostId?.(active2.composer) ?? null;
|
|
38363
|
+
const threadChanged = active2.threadId !== activeThreadId || hostId2 !== activeHostId;
|
|
38364
|
+
activeComposer = active2.composer;
|
|
38365
|
+
activeThreadId = active2.threadId;
|
|
38366
|
+
activeHostId = hostId2;
|
|
38367
|
+
if (threadChanged) {
|
|
38368
|
+
closePopover3();
|
|
38369
|
+
unmountDivider();
|
|
38370
|
+
}
|
|
38371
|
+
ensureTriggerMounted(active2.composer);
|
|
38372
|
+
ensureThreadInspected(active2.threadId, hostId2);
|
|
38373
|
+
syncDivider();
|
|
38374
|
+
};
|
|
38375
|
+
let frameId = null;
|
|
38376
|
+
let timerId = null;
|
|
38377
|
+
const scheduleRefresh = () => {
|
|
38378
|
+
if (disposed || frameId !== null || timerId !== null) return;
|
|
38379
|
+
if (typeof ownerWindow.requestAnimationFrame === "function") {
|
|
38380
|
+
frameId = ownerWindow.requestAnimationFrame(() => {
|
|
38381
|
+
frameId = null;
|
|
38382
|
+
refresh();
|
|
38383
|
+
});
|
|
38384
|
+
} else {
|
|
38385
|
+
timerId = setTimeout(() => {
|
|
38386
|
+
timerId = null;
|
|
38387
|
+
refresh();
|
|
38388
|
+
}, 0);
|
|
38389
|
+
}
|
|
38390
|
+
};
|
|
38391
|
+
const refreshLocale = () => {
|
|
38392
|
+
if (disposed || options.getLocale) return;
|
|
38393
|
+
void readCodexLocaleSettings({ ownerWindow }).then((settings) => {
|
|
38394
|
+
if (disposed) return;
|
|
38395
|
+
const next = resolveRendererSettingsLocale([settings.preferredLocale]);
|
|
38396
|
+
if (next === locale) return;
|
|
38397
|
+
locale = next;
|
|
38398
|
+
if (triggerButton) {
|
|
38399
|
+
const messages = rendererHarnessMessages(locale);
|
|
38400
|
+
triggerButton.setAttribute("aria-label", messages.handoffAction);
|
|
38401
|
+
triggerButton.title = messages.handoffAction;
|
|
38402
|
+
}
|
|
38403
|
+
if (popoverState) renderPopover();
|
|
38404
|
+
syncDivider();
|
|
38405
|
+
}).catch(() => void 0);
|
|
38406
|
+
};
|
|
38407
|
+
const onDocumentPointerDown = (event) => {
|
|
38408
|
+
if (!popoverState) return;
|
|
38409
|
+
const target2 = event.target instanceof Node ? event.target : null;
|
|
38410
|
+
if (!target2) return;
|
|
38411
|
+
if (popoverState.element.contains(target2) || triggerRoot?.contains(target2)) return;
|
|
38412
|
+
closePopover3();
|
|
38413
|
+
};
|
|
38414
|
+
const onDocumentKeyDown = (event) => {
|
|
38415
|
+
if (event.key === "Escape" && popoverState && !popoverState.submitting) {
|
|
38416
|
+
closePopover3();
|
|
38417
|
+
triggerButton?.focus();
|
|
38418
|
+
}
|
|
38419
|
+
};
|
|
38420
|
+
const onWindowResize = () => {
|
|
38421
|
+
if (popoverState && triggerButton) {
|
|
38422
|
+
positionPopover3(popoverState.element, triggerButton, ownerWindow, ownerDocument);
|
|
38423
|
+
}
|
|
38424
|
+
};
|
|
38425
|
+
const onWindowFocus = () => {
|
|
38426
|
+
refreshLocale();
|
|
38427
|
+
scheduleRefresh();
|
|
38428
|
+
};
|
|
38429
|
+
const onRoutingChanged = () => {
|
|
38430
|
+
scheduleRefresh();
|
|
38431
|
+
};
|
|
38432
|
+
const observer = typeof MutationObserver === "function" ? new MutationObserver((mutations) => {
|
|
38433
|
+
if (disposed) return;
|
|
38434
|
+
for (const mutation of mutations) {
|
|
38435
|
+
const target2 = mutation.target;
|
|
38436
|
+
if (target2 instanceof Element && (target2.closest(`[${HANDOFF_DIVIDER_ATTRIBUTE}]`) || target2.closest(`[${HANDOFF_POPOVER_ATTRIBUTE}]`) || target2.closest(`[${HANDOFF_CONTROL_ATTRIBUTE}]`))) {
|
|
38437
|
+
continue;
|
|
38438
|
+
}
|
|
38439
|
+
scheduleRefresh();
|
|
38440
|
+
return;
|
|
38441
|
+
}
|
|
38442
|
+
}) : null;
|
|
38443
|
+
observer?.observe(ownerDocument.documentElement, {
|
|
38444
|
+
childList: true,
|
|
38445
|
+
subtree: true,
|
|
38446
|
+
attributes: true,
|
|
38447
|
+
attributeFilter: ["data-above-composer-conversation-id", "hidden", "aria-hidden"]
|
|
38448
|
+
});
|
|
38449
|
+
ownerDocument.addEventListener?.("pointerdown", onDocumentPointerDown, true);
|
|
38450
|
+
ownerDocument.addEventListener?.("keydown", onDocumentKeyDown, true);
|
|
38451
|
+
ownerWindow.addEventListener?.("resize", onWindowResize);
|
|
38452
|
+
ownerWindow.addEventListener?.("focus", onWindowFocus);
|
|
38453
|
+
ownerWindow.addEventListener?.("codexhost:draft-prewarm-policy-changed", onRoutingChanged);
|
|
38454
|
+
refreshLocale();
|
|
38455
|
+
refresh();
|
|
38456
|
+
return {
|
|
38457
|
+
refresh,
|
|
38458
|
+
dispose() {
|
|
38459
|
+
if (disposed) return;
|
|
38460
|
+
disposed = true;
|
|
38461
|
+
observer?.disconnect();
|
|
38462
|
+
if (frameId !== null && typeof ownerWindow.cancelAnimationFrame === "function") {
|
|
38463
|
+
ownerWindow.cancelAnimationFrame(frameId);
|
|
38464
|
+
}
|
|
38465
|
+
if (timerId !== null) clearTimeout(timerId);
|
|
38466
|
+
frameId = null;
|
|
38467
|
+
timerId = null;
|
|
38468
|
+
ownerDocument.removeEventListener?.("pointerdown", onDocumentPointerDown, true);
|
|
38469
|
+
ownerDocument.removeEventListener?.("keydown", onDocumentKeyDown, true);
|
|
38470
|
+
ownerWindow.removeEventListener?.("resize", onWindowResize);
|
|
38471
|
+
ownerWindow.removeEventListener?.("focus", onWindowFocus);
|
|
38472
|
+
ownerWindow.removeEventListener?.("codexhost:draft-prewarm-policy-changed", onRoutingChanged);
|
|
38473
|
+
closePopover3();
|
|
38474
|
+
unmountTrigger();
|
|
38475
|
+
unmountDivider();
|
|
38476
|
+
handoffCache.clear();
|
|
38477
|
+
threadOwnerHarness.clear();
|
|
38478
|
+
inFlightInspects.clear();
|
|
38479
|
+
pluginsByHost.clear();
|
|
38480
|
+
pluginsLoadingByHost.clear();
|
|
38481
|
+
harnessCatalogCache.clear();
|
|
38482
|
+
harnessInspectInFlight.clear();
|
|
38483
|
+
activeComposer = null;
|
|
38484
|
+
activeThreadId = null;
|
|
38485
|
+
activeHostId = null;
|
|
38486
|
+
}
|
|
38487
|
+
};
|
|
38488
|
+
}
|
|
38489
|
+
|
|
36874
38490
|
// src/versioned-renderer-adapter.ts
|
|
36875
38491
|
var PI_TRANSPORT_MODEL_ID = "codexhost/pi-native";
|
|
36876
38492
|
var PI_TRANSPORT_MODEL_PREFIX = `${PI_TRANSPORT_MODEL_ID}@`;
|
|
@@ -36898,7 +38514,7 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
36898
38514
|
}
|
|
36899
38515
|
var DRAFT_PREWARM_POLICY_WAIT_TIMEOUT_MS = 1e4;
|
|
36900
38516
|
var DRAFT_PREWARM_POLICY_POLL_INTERVAL_MS = 25;
|
|
36901
|
-
function
|
|
38517
|
+
function isRecord14(value) {
|
|
36902
38518
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
36903
38519
|
}
|
|
36904
38520
|
function decodeOpenCodeTransportModelId(value) {
|
|
@@ -37063,7 +38679,7 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
37063
38679
|
let fiber = findComposerFiber(composer);
|
|
37064
38680
|
for (let depth = 0; fiber && depth < 120; depth += 1) {
|
|
37065
38681
|
const props = fiber.memoizedProps;
|
|
37066
|
-
if (
|
|
38682
|
+
if (isRecord14(props) && "conversationId" in props && props.conversationId != null) {
|
|
37067
38683
|
const candidate = hostThreadIdSchema.safeParse(props.conversationId);
|
|
37068
38684
|
if (!candidate.success || threadId !== void 0 && threadId !== candidate.data) {
|
|
37069
38685
|
return null;
|
|
@@ -37076,12 +38692,12 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
37076
38692
|
return threadId;
|
|
37077
38693
|
}
|
|
37078
38694
|
function isLegacySevenSlotDraftWrapper(value) {
|
|
37079
|
-
if (!Array.isArray(value) || value.length !== 7 || value[3] !== value[5] || value[3] !== value[6] || !
|
|
38695
|
+
if (!Array.isArray(value) || value.length !== 7 || value[3] !== value[5] || value[3] !== value[6] || !isRecord14(value[3]) || typeof value[3].get !== "function" || typeof value[2] !== "string" && value[2] !== null) {
|
|
37080
38696
|
return false;
|
|
37081
38697
|
}
|
|
37082
38698
|
try {
|
|
37083
38699
|
const draft = value[3].get();
|
|
37084
|
-
return
|
|
38700
|
+
return isRecord14(draft) && "modelSettings" in draft && "isManuallyChanged" in draft;
|
|
37085
38701
|
} catch {
|
|
37086
38702
|
return false;
|
|
37087
38703
|
}
|
|
@@ -37115,8 +38731,8 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
37115
38731
|
let fiber = findComposerFiber(composer);
|
|
37116
38732
|
for (let depth = 0; fiber && depth < 120; depth += 1) {
|
|
37117
38733
|
const updateQueue = fiber.updateQueue;
|
|
37118
|
-
const memoCache =
|
|
37119
|
-
const data =
|
|
38734
|
+
const memoCache = isRecord14(updateQueue) ? updateQueue.memoCache : null;
|
|
38735
|
+
const data = isRecord14(memoCache) && Array.isArray(memoCache.data) ? memoCache.data : [];
|
|
37120
38736
|
for (const value of data) {
|
|
37121
38737
|
const draftId = draftIdFromMemoValue(value);
|
|
37122
38738
|
if (draftId) draftIds.add(draftId);
|
|
@@ -37144,7 +38760,7 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
37144
38760
|
return ["default", draftIds.values().next().value];
|
|
37145
38761
|
}
|
|
37146
38762
|
function isDraftPrewarmPolicyReady(value) {
|
|
37147
|
-
return
|
|
38763
|
+
return isRecord14(value) && value.state === "ready" && typeof value.hostId === "string" && value.hostId.length > 0 && typeof value.select === "function" && typeof value.clear === "function";
|
|
37148
38764
|
}
|
|
37149
38765
|
async function waitForRendererDraftPrewarmPolicy(target2, composer) {
|
|
37150
38766
|
const deadline = Date.now() + DRAFT_PREWARM_POLICY_WAIT_TIMEOUT_MS;
|
|
@@ -37248,6 +38864,7 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
37248
38864
|
return client.listHarnessPlugins();
|
|
37249
38865
|
},
|
|
37250
38866
|
forkThread: (input3) => currentModelClient().forkThread(input3),
|
|
38867
|
+
handoffThread: (input3) => currentModelClient().handoffThread(input3),
|
|
37251
38868
|
inspectHarness: (...args) => currentModelClient().inspectHarness(...args),
|
|
37252
38869
|
inspectThread: (input3) => currentModelClient().inspectThread(input3),
|
|
37253
38870
|
usesIndependentNativeInference: async (input3) => {
|
|
@@ -37326,10 +38943,22 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
37326
38943
|
);
|
|
37327
38944
|
}
|
|
37328
38945
|
});
|
|
38946
|
+
const handoffControl = installRendererHandoffControl({
|
|
38947
|
+
getClient: () => disposed ? null : modelControl,
|
|
38948
|
+
getHostId: (composer) => modelControl.currentHostId?.(composer) ?? null,
|
|
38949
|
+
resolveComposerThreadId: (composer) => threadIdFromComposerModelTarget(findComposerModelTarget(composer)),
|
|
38950
|
+
reportError: (error62) => {
|
|
38951
|
+
console.error(
|
|
38952
|
+
"codexhost Thread Handoff failed",
|
|
38953
|
+
error62 instanceof Error ? error62.name : "UnknownError"
|
|
38954
|
+
);
|
|
38955
|
+
}
|
|
38956
|
+
});
|
|
37329
38957
|
const selectedPolicies = /* @__PURE__ */ new Map();
|
|
37330
38958
|
const draftModels = createScopedDraftModelWriter();
|
|
37331
38959
|
const handleRoutingPolicyChange = () => {
|
|
37332
38960
|
currentRequestRoute();
|
|
38961
|
+
handoffControl.refresh();
|
|
37333
38962
|
};
|
|
37334
38963
|
window.addEventListener("codexhost:draft-prewarm-policy-changed", handleRoutingPolicyChange);
|
|
37335
38964
|
currentRequestRoute();
|
|
@@ -37401,6 +39030,7 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
37401
39030
|
const cleanups = [
|
|
37402
39031
|
...[...selectedPolicies.values()].map((policy) => () => policy.select(null)),
|
|
37403
39032
|
() => forkControl.dispose(),
|
|
39033
|
+
() => handoffControl.dispose(),
|
|
37404
39034
|
() => stopGroupSync(),
|
|
37405
39035
|
() => clients.dispose(),
|
|
37406
39036
|
() => usageSubscription.dispose(),
|
|
@@ -37442,11 +39072,11 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
37442
39072
|
return null;
|
|
37443
39073
|
}
|
|
37444
39074
|
}
|
|
37445
|
-
function
|
|
39075
|
+
function isRecord15(value) {
|
|
37446
39076
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
37447
39077
|
}
|
|
37448
39078
|
function parseExternalConfiguration(value) {
|
|
37449
|
-
if (!
|
|
39079
|
+
if (!isRecord15(value)) return void 0;
|
|
37450
39080
|
const model2 = harnessModelRefSchema.safeParse(value.model);
|
|
37451
39081
|
if (!model2.success) return void 0;
|
|
37452
39082
|
const thinkingOptionId = harnessThinkingOptionIdSchema.safeParse(value.thinkingOptionId);
|
|
@@ -37463,10 +39093,10 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
37463
39093
|
const raw = storage.getItem(RENDERER_NEW_THREAD_PREFERENCE_KEY);
|
|
37464
39094
|
if (!raw) return void 0;
|
|
37465
39095
|
const parsed = JSON.parse(raw);
|
|
37466
|
-
if (!
|
|
39096
|
+
if (!isRecord15(parsed) || parsed.version !== 1) return void 0;
|
|
37467
39097
|
if (parsed.lastAgent !== "codex" && !harnessPluginIdSchema.safeParse(parsed.lastAgent).success)
|
|
37468
39098
|
return void 0;
|
|
37469
|
-
const externalByAgent =
|
|
39099
|
+
const externalByAgent = isRecord15(parsed.externalByAgent) ? parsed.externalByAgent : {};
|
|
37470
39100
|
const parsedExternal = Object.fromEntries(
|
|
37471
39101
|
Object.keys(externalByAgent).filter((agent) => harnessPluginIdSchema.safeParse(agent).success).flatMap((agent) => {
|
|
37472
39102
|
const configuration = parseExternalConfiguration(externalByAgent[agent]);
|
|
@@ -37608,157 +39238,6 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
37608
39238
|
return editor !== null && prependEditor(editor, `${command.invocation} `);
|
|
37609
39239
|
}
|
|
37610
39240
|
|
|
37611
|
-
// src/codex-locale-adapter.ts
|
|
37612
|
-
var DEFAULT_LOCALE_REQUEST_TIMEOUT_MS = 750;
|
|
37613
|
-
function isNativeLocaleServices(value) {
|
|
37614
|
-
if (!isRecord15(value) || !Object.hasOwn(value, "appInfo")) return false;
|
|
37615
|
-
const appInfo = value.appInfo;
|
|
37616
|
-
return appInfo != null && typeof appInfo.getLocaleInfo === "function";
|
|
37617
|
-
}
|
|
37618
|
-
function isNativeSettingsServices(value) {
|
|
37619
|
-
if (!isRecord15(value) || !Object.hasOwn(value, "settings")) return false;
|
|
37620
|
-
const settings = value.settings;
|
|
37621
|
-
return typeof settings?.read === "function" && typeof settings?.write === "function";
|
|
37622
|
-
}
|
|
37623
|
-
function isRecord15(value) {
|
|
37624
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
37625
|
-
}
|
|
37626
|
-
function canonicalLocale(value) {
|
|
37627
|
-
if (typeof value !== "string" || value.trim().length === 0) return void 0;
|
|
37628
|
-
try {
|
|
37629
|
-
return Intl.getCanonicalLocales(value.trim())[0];
|
|
37630
|
-
} catch {
|
|
37631
|
-
return void 0;
|
|
37632
|
-
}
|
|
37633
|
-
}
|
|
37634
|
-
function firstNavigatorLocale(ownerWindow) {
|
|
37635
|
-
for (const candidate of ownerWindow.navigator.languages) {
|
|
37636
|
-
const locale = canonicalLocale(candidate);
|
|
37637
|
-
if (locale) return locale;
|
|
37638
|
-
}
|
|
37639
|
-
return canonicalLocale(ownerWindow.navigator.language);
|
|
37640
|
-
}
|
|
37641
|
-
function abortError2() {
|
|
37642
|
-
return new DOMException("The operation was aborted", "AbortError");
|
|
37643
|
-
}
|
|
37644
|
-
function parseLocaleOverride(response) {
|
|
37645
|
-
if (!isRecord15(response) || !Object.hasOwn(response, "effective")) {
|
|
37646
|
-
throw new Error("Codex native locale override response is malformed");
|
|
37647
|
-
}
|
|
37648
|
-
if (response.effective === null) return null;
|
|
37649
|
-
const locale = canonicalLocale(response.effective);
|
|
37650
|
-
if (!locale) throw new Error("Codex locale override is invalid");
|
|
37651
|
-
return locale;
|
|
37652
|
-
}
|
|
37653
|
-
function optionalLocale(value, field2) {
|
|
37654
|
-
if (value === void 0 || value === null) return void 0;
|
|
37655
|
-
const locale = canonicalLocale(value);
|
|
37656
|
-
if (!locale) throw new Error(`Codex ${field2} is invalid`);
|
|
37657
|
-
return locale;
|
|
37658
|
-
}
|
|
37659
|
-
function parseLocaleInfo(value) {
|
|
37660
|
-
if (!isRecord15(value)) throw new Error("Codex locale info response is malformed");
|
|
37661
|
-
return {
|
|
37662
|
-
ideLocale: optionalLocale(value.ideLocale, "IDE locale"),
|
|
37663
|
-
systemLocale: optionalLocale(value.systemLocale, "system locale")
|
|
37664
|
-
};
|
|
37665
|
-
}
|
|
37666
|
-
function requestNativeLocale(ownerWindow, signal, timeoutMs, matchesServices, invoke2) {
|
|
37667
|
-
if (signal?.aborted) return Promise.reject(abortError2());
|
|
37668
|
-
return new Promise((resolve, reject) => {
|
|
37669
|
-
let settled = false;
|
|
37670
|
-
let nativeRequest;
|
|
37671
|
-
const settle2 = (operation) => {
|
|
37672
|
-
if (settled) return;
|
|
37673
|
-
settled = true;
|
|
37674
|
-
ownerWindow.clearTimeout(timer);
|
|
37675
|
-
signal?.removeEventListener("abort", onAbort);
|
|
37676
|
-
try {
|
|
37677
|
-
nativeRequest?.[Symbol.dispose]?.();
|
|
37678
|
-
operation();
|
|
37679
|
-
} catch (error62) {
|
|
37680
|
-
reject(error62);
|
|
37681
|
-
}
|
|
37682
|
-
};
|
|
37683
|
-
const onAbort = () => settle2(() => reject(abortError2()));
|
|
37684
|
-
const timer = ownerWindow.setTimeout(
|
|
37685
|
-
() => settle2(() => reject(new Error("Codex locale request timed out"))),
|
|
37686
|
-
timeoutMs
|
|
37687
|
-
);
|
|
37688
|
-
signal?.addEventListener("abort", onAbort, { once: true });
|
|
37689
|
-
void (async () => {
|
|
37690
|
-
const native = await loadCodexNativeServices(ownerWindow, matchesServices);
|
|
37691
|
-
if (settled) return;
|
|
37692
|
-
if (!native) throw new Error("Codex native locale services are unavailable");
|
|
37693
|
-
nativeRequest = invoke2(native);
|
|
37694
|
-
const response = await nativeRequest;
|
|
37695
|
-
settle2(() => resolve(response));
|
|
37696
|
-
})().catch((error62) => settle2(() => reject(error62)));
|
|
37697
|
-
});
|
|
37698
|
-
}
|
|
37699
|
-
async function readCodexLocaleSettings(options = {}) {
|
|
37700
|
-
const ownerWindow = options.ownerWindow ?? window;
|
|
37701
|
-
const timeoutMs = options.timeoutMs ?? DEFAULT_LOCALE_REQUEST_TIMEOUT_MS;
|
|
37702
|
-
if (!Number.isFinite(timeoutMs) || timeoutMs <= 0) {
|
|
37703
|
-
throw new Error("Codex locale request timeout must be positive");
|
|
37704
|
-
}
|
|
37705
|
-
if (options.signal?.aborted) throw abortError2();
|
|
37706
|
-
const [overrideResult, localeInfoResult] = await Promise.allSettled([
|
|
37707
|
-
requestNativeLocale(
|
|
37708
|
-
ownerWindow,
|
|
37709
|
-
options.signal,
|
|
37710
|
-
timeoutMs,
|
|
37711
|
-
isNativeSettingsServices,
|
|
37712
|
-
(native) => native.settings.read("localeOverride")
|
|
37713
|
-
).then(parseLocaleOverride),
|
|
37714
|
-
requestNativeLocale(
|
|
37715
|
-
ownerWindow,
|
|
37716
|
-
options.signal,
|
|
37717
|
-
timeoutMs,
|
|
37718
|
-
isNativeLocaleServices,
|
|
37719
|
-
(native) => native.appInfo.getLocaleInfo()
|
|
37720
|
-
).then(parseLocaleInfo)
|
|
37721
|
-
]);
|
|
37722
|
-
if (options.signal?.aborted) throw abortError2();
|
|
37723
|
-
const navigatorLocale = firstNavigatorLocale(ownerWindow);
|
|
37724
|
-
const overrideKnown = overrideResult.status === "fulfilled";
|
|
37725
|
-
const localeOverride = overrideKnown ? overrideResult.value : void 0;
|
|
37726
|
-
const localeInfo = localeInfoResult.status === "fulfilled" ? localeInfoResult.value : { ideLocale: void 0, systemLocale: void 0 };
|
|
37727
|
-
if (typeof localeOverride === "string") {
|
|
37728
|
-
return Object.freeze({
|
|
37729
|
-
status: "ready",
|
|
37730
|
-
mode: "explicit",
|
|
37731
|
-
localeOverride,
|
|
37732
|
-
ideLocale: localeInfo.ideLocale,
|
|
37733
|
-
systemLocale: localeInfo.systemLocale,
|
|
37734
|
-
preferredLocale: localeOverride,
|
|
37735
|
-
source: "override"
|
|
37736
|
-
});
|
|
37737
|
-
}
|
|
37738
|
-
if (overrideKnown) {
|
|
37739
|
-
const preferredLocale = localeInfo.ideLocale ?? localeInfo.systemLocale ?? navigatorLocale ?? "en-US";
|
|
37740
|
-
const source = localeInfo.ideLocale ? "ide" : localeInfo.systemLocale ? "system" : navigatorLocale ? "navigator" : "default";
|
|
37741
|
-
return Object.freeze({
|
|
37742
|
-
status: "ready",
|
|
37743
|
-
mode: "automatic",
|
|
37744
|
-
localeOverride: null,
|
|
37745
|
-
ideLocale: localeInfo.ideLocale,
|
|
37746
|
-
systemLocale: localeInfo.systemLocale,
|
|
37747
|
-
preferredLocale,
|
|
37748
|
-
source
|
|
37749
|
-
});
|
|
37750
|
-
}
|
|
37751
|
-
return Object.freeze({
|
|
37752
|
-
status: "fallback",
|
|
37753
|
-
mode: "unavailable",
|
|
37754
|
-
localeOverride: void 0,
|
|
37755
|
-
ideLocale: localeInfo.ideLocale,
|
|
37756
|
-
systemLocale: localeInfo.systemLocale,
|
|
37757
|
-
preferredLocale: navigatorLocale ?? "en-US",
|
|
37758
|
-
source: navigatorLocale ? "navigator" : "default"
|
|
37759
|
-
});
|
|
37760
|
-
}
|
|
37761
|
-
|
|
37762
39241
|
// src/desktop-extension-api.ts
|
|
37763
39242
|
var markerOwners = /* @__PURE__ */ new WeakMap();
|
|
37764
39243
|
function cloneStorageValues(values) {
|
|
@@ -45950,18 +47429,20 @@ ${detail}` : ""}`
|
|
|
45950
47429
|
const renderActions = (extensionId, displayName, installed, catalogEntry, state) => {
|
|
45951
47430
|
if (!actionBar || !modalToggle) return;
|
|
45952
47431
|
const updateAvailable = hasCatalogUpdate(installed, catalogEntry);
|
|
45953
|
-
const
|
|
47432
|
+
const extAction = state.pendingMutations.get(extensionId) ?? null;
|
|
47433
|
+
const controlsDisabled = extAction !== null || state.globalBusy;
|
|
45954
47434
|
const nodes = [];
|
|
45955
47435
|
if (!installed && catalogEntry) {
|
|
45956
47436
|
const installButton = createEl(
|
|
45957
47437
|
document2,
|
|
45958
47438
|
"button",
|
|
45959
47439
|
"settings-command-button",
|
|
45960
|
-
|
|
47440
|
+
extAction === "install" ? copy.installing : copy.install
|
|
45961
47441
|
);
|
|
45962
47442
|
installButton.type = "button";
|
|
45963
47443
|
installButton.dataset.action = "install";
|
|
45964
|
-
installButton.
|
|
47444
|
+
installButton.setAttribute("aria-busy", String(extAction === "install"));
|
|
47445
|
+
installButton.disabled = controlsDisabled || !state.canInstall;
|
|
45965
47446
|
installButton.addEventListener("click", () => {
|
|
45966
47447
|
if (!installButton.disabled) onInstall?.(catalogEntry, false);
|
|
45967
47448
|
});
|
|
@@ -45981,11 +47462,12 @@ ${detail}` : ""}`
|
|
|
45981
47462
|
document2,
|
|
45982
47463
|
"button",
|
|
45983
47464
|
"settings-command-button",
|
|
45984
|
-
|
|
47465
|
+
extAction === "update" ? copy.updating : formatMessage(copy.updateToVersion, { version: catalogEntry.version })
|
|
45985
47466
|
);
|
|
45986
47467
|
updateButton.type = "button";
|
|
45987
47468
|
updateButton.dataset.action = "update";
|
|
45988
|
-
updateButton.
|
|
47469
|
+
updateButton.setAttribute("aria-busy", String(extAction === "update"));
|
|
47470
|
+
updateButton.disabled = controlsDisabled || !state.canInstall;
|
|
45989
47471
|
updateButton.addEventListener("click", () => {
|
|
45990
47472
|
if (!updateButton.disabled) onInstall?.(catalogEntry, true);
|
|
45991
47473
|
});
|
|
@@ -45993,7 +47475,7 @@ ${detail}` : ""}`
|
|
|
45993
47475
|
}
|
|
45994
47476
|
const blocked = isToggleBlocked(installed);
|
|
45995
47477
|
modalToggle.checked = installed.enabled;
|
|
45996
|
-
modalToggle.disabled =
|
|
47478
|
+
modalToggle.disabled = controlsDisabled || blocked;
|
|
45997
47479
|
modalToggle.setAttribute(
|
|
45998
47480
|
"aria-label",
|
|
45999
47481
|
formatMessage(copy.toggleLabel, { name: displayName })
|
|
@@ -46004,7 +47486,7 @@ ${detail}` : ""}`
|
|
|
46004
47486
|
const openPageButton = createEl(document2, "button", "settings-command-button");
|
|
46005
47487
|
openPageButton.type = "button";
|
|
46006
47488
|
openPageButton.dataset.action = "open-page";
|
|
46007
|
-
openPageButton.disabled =
|
|
47489
|
+
openPageButton.disabled = controlsDisabled;
|
|
46008
47490
|
openPageButton.append(
|
|
46009
47491
|
createRendererSettingsIcon("external-link", 13),
|
|
46010
47492
|
createEl(document2, "span", "", copy.openPage)
|
|
@@ -46024,7 +47506,7 @@ ${detail}` : ""}`
|
|
|
46024
47506
|
);
|
|
46025
47507
|
openSettingsButton.type = "button";
|
|
46026
47508
|
openSettingsButton.dataset.action = "open-settings";
|
|
46027
|
-
openSettingsButton.disabled =
|
|
47509
|
+
openSettingsButton.disabled = controlsDisabled;
|
|
46028
47510
|
openSettingsButton.append(
|
|
46029
47511
|
createRendererSettingsIcon("settings", 13),
|
|
46030
47512
|
createEl(document2, "span", "", copy.openExtensionSettings)
|
|
@@ -46053,11 +47535,12 @@ ${detail}` : ""}`
|
|
|
46053
47535
|
document2,
|
|
46054
47536
|
"button",
|
|
46055
47537
|
"settings-command-button settings-command-button--secondary settings-command-button--danger",
|
|
46056
|
-
|
|
47538
|
+
extAction === "uninstall" ? copy.uninstalling : copy.uninstallConfirm
|
|
46057
47539
|
);
|
|
46058
47540
|
confirmButton.type = "button";
|
|
46059
47541
|
confirmButton.dataset.action = "confirm-uninstall";
|
|
46060
|
-
confirmButton.
|
|
47542
|
+
confirmButton.setAttribute("aria-busy", String(extAction === "uninstall"));
|
|
47543
|
+
confirmButton.disabled = controlsDisabled;
|
|
46061
47544
|
confirmButton.addEventListener("click", () => {
|
|
46062
47545
|
if (!confirmButton.disabled) onUninstall?.(installed);
|
|
46063
47546
|
});
|
|
@@ -46069,9 +47552,9 @@ ${detail}` : ""}`
|
|
|
46069
47552
|
);
|
|
46070
47553
|
cancelButton.type = "button";
|
|
46071
47554
|
cancelButton.dataset.action = "cancel-uninstall";
|
|
46072
|
-
cancelButton.disabled =
|
|
47555
|
+
cancelButton.disabled = controlsDisabled;
|
|
46073
47556
|
cancelButton.addEventListener("click", () => {
|
|
46074
|
-
if (
|
|
47557
|
+
if (controlsDisabled) return;
|
|
46075
47558
|
confirmingUninstall = false;
|
|
46076
47559
|
if (currentState) {
|
|
46077
47560
|
renderContent(extensionId, currentItem, currentCatalogEntry, currentState);
|
|
@@ -46087,13 +47570,13 @@ ${detail}` : ""}`
|
|
|
46087
47570
|
);
|
|
46088
47571
|
uninstallButton.type = "button";
|
|
46089
47572
|
uninstallButton.dataset.action = "uninstall";
|
|
46090
|
-
uninstallButton.disabled =
|
|
47573
|
+
uninstallButton.disabled = controlsDisabled;
|
|
46091
47574
|
uninstallButton.append(
|
|
46092
47575
|
createRendererSettingsIcon("trash", 13),
|
|
46093
47576
|
createEl(document2, "span", "", copy.uninstall)
|
|
46094
47577
|
);
|
|
46095
47578
|
uninstallButton.addEventListener("click", () => {
|
|
46096
|
-
if (
|
|
47579
|
+
if (controlsDisabled) return;
|
|
46097
47580
|
confirmingUninstall = true;
|
|
46098
47581
|
if (currentState) {
|
|
46099
47582
|
renderContent(extensionId, currentItem, currentCatalogEntry, currentState);
|
|
@@ -46126,7 +47609,7 @@ ${detail}` : ""}`
|
|
|
46126
47609
|
} else {
|
|
46127
47610
|
delete dialog.dataset.extensionState;
|
|
46128
47611
|
}
|
|
46129
|
-
if (state.
|
|
47612
|
+
if (state.pendingMutations.has(extensionId)) dialog.dataset.busy = "true";
|
|
46130
47613
|
else delete dialog.dataset.busy;
|
|
46131
47614
|
const categories = (installed?.state === "valid" ? installed.manifest.categories : void 0) ?? catalogEntry?.categories;
|
|
46132
47615
|
const iconUrl2 = resolveInstalledExtensionIconUrl(installed, catalogEntry);
|
|
@@ -46411,7 +47894,8 @@ ${detail}` : ""}`
|
|
|
46411
47894
|
modalToggle.addEventListener("change", () => {
|
|
46412
47895
|
if (!currentItem || !modalToggle) return;
|
|
46413
47896
|
const desired = modalToggle.checked;
|
|
46414
|
-
|
|
47897
|
+
const isBusyThis = currentState?.globalBusy || Boolean(currentState?.pendingMutations.has(currentItem.id));
|
|
47898
|
+
if (isBusyThis || isToggleBlocked(currentItem)) {
|
|
46415
47899
|
modalToggle.checked = currentItem.enabled;
|
|
46416
47900
|
return;
|
|
46417
47901
|
}
|
|
@@ -47012,9 +48496,8 @@ ${detail}` : ""}`
|
|
|
47012
48496
|
visibleEntries,
|
|
47013
48497
|
installedById,
|
|
47014
48498
|
canInstall,
|
|
47015
|
-
|
|
47016
|
-
|
|
47017
|
-
activeMutationAction,
|
|
48499
|
+
pendingMutations,
|
|
48500
|
+
globalBusy,
|
|
47018
48501
|
onOpenDetails,
|
|
47019
48502
|
onInstall,
|
|
47020
48503
|
onViewInstalled
|
|
@@ -47027,22 +48510,26 @@ ${detail}` : ""}`
|
|
|
47027
48510
|
const installed = installedById.get(entry.id);
|
|
47028
48511
|
const updateAvailable = hasCatalogUpdate(installed, entry);
|
|
47029
48512
|
const installState = installed ? updateAvailable ? "update" : "installed" : "available";
|
|
47030
|
-
const
|
|
48513
|
+
const entryAction = pendingMutations.get(entry.id) ?? null;
|
|
48514
|
+
const isBusyCard = entryAction !== null;
|
|
48515
|
+
const controlsDisabled = isBusyCard || globalBusy;
|
|
47031
48516
|
const actionButton = createEl(document2, "button");
|
|
47032
48517
|
actionButton.type = "button";
|
|
47033
48518
|
actionButton.dataset.extensionId = entry.id;
|
|
47034
48519
|
if (installState === "available") {
|
|
47035
48520
|
actionButton.className = "settings-command-button settings-extensions-card__button";
|
|
47036
48521
|
actionButton.dataset.action = "install";
|
|
47037
|
-
const installingThis =
|
|
48522
|
+
const installingThis = entryAction === "install";
|
|
47038
48523
|
actionButton.textContent = installingThis ? copy.installing : copy.install;
|
|
47039
|
-
actionButton.
|
|
48524
|
+
actionButton.setAttribute("aria-busy", String(installingThis));
|
|
48525
|
+
actionButton.disabled = controlsDisabled || !canInstall;
|
|
47040
48526
|
} else if (installState === "update") {
|
|
47041
48527
|
actionButton.className = "settings-command-button settings-extensions-card__button settings-extensions-card__button--update";
|
|
47042
48528
|
actionButton.dataset.action = "update";
|
|
47043
|
-
const updatingThis =
|
|
48529
|
+
const updatingThis = entryAction === "update";
|
|
47044
48530
|
actionButton.textContent = updatingThis ? copy.updating : copy.update;
|
|
47045
|
-
actionButton.
|
|
48531
|
+
actionButton.setAttribute("aria-busy", String(updatingThis));
|
|
48532
|
+
actionButton.disabled = controlsDisabled || !canInstall;
|
|
47046
48533
|
} else {
|
|
47047
48534
|
actionButton.className = "settings-command-button settings-command-button--secondary settings-extensions-card__button settings-extensions-card__button--installed";
|
|
47048
48535
|
actionButton.dataset.action = "installed";
|
|
@@ -47050,7 +48537,7 @@ ${detail}` : ""}`
|
|
|
47050
48537
|
createRendererSettingsIcon("check", 12),
|
|
47051
48538
|
createEl(document2, "span", "", copy.installedBadge)
|
|
47052
48539
|
);
|
|
47053
|
-
actionButton.disabled =
|
|
48540
|
+
actionButton.disabled = controlsDisabled;
|
|
47054
48541
|
}
|
|
47055
48542
|
actionButton.addEventListener("click", (event) => {
|
|
47056
48543
|
event.stopPropagation?.();
|
|
@@ -47363,16 +48850,18 @@ ${detail}` : ""}`
|
|
|
47363
48850
|
let loading = false;
|
|
47364
48851
|
let catalogLoading = false;
|
|
47365
48852
|
let catalogRequestToken = 0;
|
|
47366
|
-
let
|
|
47367
|
-
|
|
47368
|
-
let
|
|
48853
|
+
let listApplyToken = 0;
|
|
48854
|
+
const pendingMutations = /* @__PURE__ */ new Map();
|
|
48855
|
+
let importing = false;
|
|
48856
|
+
let recovering = false;
|
|
48857
|
+
let toggleQueue = Promise.resolve();
|
|
47369
48858
|
let pollTimer;
|
|
47370
48859
|
let activeRecoveryDialog = null;
|
|
47371
48860
|
let selectedCapability = "all";
|
|
47372
48861
|
let selectedCategory = null;
|
|
47373
48862
|
let searchQuery = "";
|
|
47374
|
-
let
|
|
47375
|
-
|
|
48863
|
+
let modalFeedback = null;
|
|
48864
|
+
const hasPendingMutations = () => pendingMutations.size > 0 || importing || recovering;
|
|
47376
48865
|
const clientCapabilities = () => {
|
|
47377
48866
|
const client = resolveAvailableClient(getClient);
|
|
47378
48867
|
return {
|
|
@@ -47431,10 +48920,9 @@ ${detail}` : ""}`
|
|
|
47431
48920
|
unavailable,
|
|
47432
48921
|
canInstall,
|
|
47433
48922
|
canUninstall,
|
|
47434
|
-
|
|
47435
|
-
|
|
47436
|
-
|
|
47437
|
-
feedback: modalFeedbackExtensionId !== null && modalFeedbackExtensionId === detailModal.extensionId ? currentFeedback : null
|
|
48923
|
+
pendingMutations: new Map(pendingMutations),
|
|
48924
|
+
globalBusy: recovering,
|
|
48925
|
+
feedback: modalFeedback !== null && modalFeedback.extensionId === detailModal.extensionId ? modalFeedback.feedback : null
|
|
47438
48926
|
};
|
|
47439
48927
|
};
|
|
47440
48928
|
const detailModal = createDesktopExtensionDetailModal({
|
|
@@ -47475,7 +48963,7 @@ ${detail}` : ""}`
|
|
|
47475
48963
|
if (pageId) context2.navigateToPage?.(pageId);
|
|
47476
48964
|
} : void 0,
|
|
47477
48965
|
onClose: () => {
|
|
47478
|
-
|
|
48966
|
+
modalFeedback = null;
|
|
47479
48967
|
}
|
|
47480
48968
|
});
|
|
47481
48969
|
const createModal = createDesktopExtensionCreateModal({
|
|
@@ -47495,8 +48983,10 @@ ${detail}` : ""}`
|
|
|
47495
48983
|
}
|
|
47496
48984
|
});
|
|
47497
48985
|
const setFeedback = (next, modalExtensionId = null) => {
|
|
47498
|
-
|
|
47499
|
-
|
|
48986
|
+
if (modalExtensionId !== null) {
|
|
48987
|
+
modalFeedback = next ? { extensionId: modalExtensionId, feedback: next } : null;
|
|
48988
|
+
return;
|
|
48989
|
+
}
|
|
47500
48990
|
if (!next) {
|
|
47501
48991
|
banner.hidden = true;
|
|
47502
48992
|
bannerText.textContent = "";
|
|
@@ -47515,14 +49005,13 @@ ${detail}` : ""}`
|
|
|
47515
49005
|
};
|
|
47516
49006
|
const syncToolbarState = () => {
|
|
47517
49007
|
const activeLoading = activeTab === "installed" ? loading : catalogLoading;
|
|
47518
|
-
|
|
47519
|
-
refreshButton.disabled = busy;
|
|
49008
|
+
refreshButton.disabled = activeLoading || recovering;
|
|
47520
49009
|
refreshButton.setAttribute("aria-busy", String(activeLoading));
|
|
47521
49010
|
refreshButton.title = activeLoading ? copy.refreshing : copy.refresh;
|
|
47522
49011
|
refreshButton.setAttribute("aria-label", activeLoading ? copy.refreshing : copy.refresh);
|
|
47523
49012
|
const { canInstall, canRecover } = clientCapabilities();
|
|
47524
|
-
importButton.disabled =
|
|
47525
|
-
recoveryMenuItem.disabled =
|
|
49013
|
+
importButton.disabled = importing || recovering || !canInstall;
|
|
49014
|
+
recoveryMenuItem.disabled = hasPendingMutations() || !canRecover;
|
|
47526
49015
|
installedTabLabel.textContent = formatMessage(copy.tabInstalled, {
|
|
47527
49016
|
count: String(listing?.extensions.length ?? 0)
|
|
47528
49017
|
});
|
|
@@ -47701,7 +49190,7 @@ ${detail}` : ""}`
|
|
|
47701
49190
|
}
|
|
47702
49191
|
closeHeaderMenus();
|
|
47703
49192
|
if (detailModal.extensionId !== extensionId) {
|
|
47704
|
-
|
|
49193
|
+
modalFeedback = null;
|
|
47705
49194
|
}
|
|
47706
49195
|
detailModal.open(extensionId, buildDetailModalState());
|
|
47707
49196
|
};
|
|
@@ -47712,10 +49201,13 @@ ${detail}` : ""}`
|
|
|
47712
49201
|
const errorId = preferenceId(`host-ext-error-${item.id}`);
|
|
47713
49202
|
const blocked = isToggleBlocked(item);
|
|
47714
49203
|
const statusState = itemStatusState(item);
|
|
49204
|
+
const extAction = pendingMutations.get(item.id) ?? null;
|
|
49205
|
+
const isExtBusy = extAction !== null;
|
|
49206
|
+
const controlsDisabled = isExtBusy || recovering;
|
|
47715
49207
|
const toggle = createPreferenceSwitch(document2, switchId, errorId);
|
|
47716
49208
|
toggle.checked = item.enabled;
|
|
47717
49209
|
toggle.setAttribute("aria-label", formatMessage(copy.toggleLabel, { name: displayName }));
|
|
47718
|
-
toggle.disabled =
|
|
49210
|
+
toggle.disabled = controlsDisabled || blocked;
|
|
47719
49211
|
if (blocked) {
|
|
47720
49212
|
toggle.title = blockedToggleReason(item, copy);
|
|
47721
49213
|
}
|
|
@@ -47726,7 +49218,7 @@ ${detail}` : ""}`
|
|
|
47726
49218
|
toggle.addEventListener("keydown", stopTrigger);
|
|
47727
49219
|
toggle.addEventListener("change", () => {
|
|
47728
49220
|
const desired = toggle.checked;
|
|
47729
|
-
if (
|
|
49221
|
+
if (recovering || pendingMutations.has(item.id) || blocked) {
|
|
47730
49222
|
toggle.checked = item.enabled;
|
|
47731
49223
|
return;
|
|
47732
49224
|
}
|
|
@@ -47743,7 +49235,7 @@ ${detail}` : ""}`
|
|
|
47743
49235
|
btn.type = "button";
|
|
47744
49236
|
btn.dataset.action = "open-page";
|
|
47745
49237
|
btn.dataset.extensionId = item.id;
|
|
47746
|
-
btn.disabled =
|
|
49238
|
+
btn.disabled = controlsDisabled;
|
|
47747
49239
|
btn.addEventListener("click", (event) => {
|
|
47748
49240
|
event.stopPropagation?.();
|
|
47749
49241
|
if (!btn.disabled) openExtensionPage(item);
|
|
@@ -47753,7 +49245,7 @@ ${detail}` : ""}`
|
|
|
47753
49245
|
}
|
|
47754
49246
|
let update;
|
|
47755
49247
|
if (catalogEntry && hasCatalogUpdate(item, catalogEntry)) {
|
|
47756
|
-
const updating =
|
|
49248
|
+
const updating = extAction === "update";
|
|
47757
49249
|
const button2 = createEl(
|
|
47758
49250
|
document2,
|
|
47759
49251
|
"button",
|
|
@@ -47763,7 +49255,7 @@ ${detail}` : ""}`
|
|
|
47763
49255
|
button2.type = "button";
|
|
47764
49256
|
button2.dataset.action = "update";
|
|
47765
49257
|
button2.setAttribute("aria-busy", String(updating));
|
|
47766
|
-
button2.disabled =
|
|
49258
|
+
button2.disabled = controlsDisabled || !canUpdate;
|
|
47767
49259
|
button2.addEventListener("click", () => {
|
|
47768
49260
|
if (!button2.disabled) void installFromCatalog(catalogEntry, true);
|
|
47769
49261
|
});
|
|
@@ -47797,7 +49289,7 @@ ${detail}` : ""}`
|
|
|
47797
49289
|
capabilityBadges: deriveCapabilityBadges(itemCapabilities(item), copy),
|
|
47798
49290
|
secondaryAction: openPageButton,
|
|
47799
49291
|
actionControl: toggle,
|
|
47800
|
-
busy:
|
|
49292
|
+
busy: isExtBusy,
|
|
47801
49293
|
dataset: {
|
|
47802
49294
|
extensionState: statusState,
|
|
47803
49295
|
trustTier: catalogEntry?.trustTier
|
|
@@ -47934,7 +49426,7 @@ ${detail}` : ""}`
|
|
|
47934
49426
|
{
|
|
47935
49427
|
label: copy.retry,
|
|
47936
49428
|
onClick: () => {
|
|
47937
|
-
if (!catalogLoading && !
|
|
49429
|
+
if (!catalogLoading && !recovering) {
|
|
47938
49430
|
void loadCatalog({ forceRefresh: true, silent: false });
|
|
47939
49431
|
}
|
|
47940
49432
|
}
|
|
@@ -47949,9 +49441,9 @@ ${detail}` : ""}`
|
|
|
47949
49441
|
document2,
|
|
47950
49442
|
messages,
|
|
47951
49443
|
catalog,
|
|
47952
|
-
catalogLoading ||
|
|
49444
|
+
catalogLoading || recovering,
|
|
47953
49445
|
() => {
|
|
47954
|
-
if (!catalogLoading && !
|
|
49446
|
+
if (!catalogLoading && !recovering) {
|
|
47955
49447
|
void loadCatalog({ forceRefresh: true, silent: false });
|
|
47956
49448
|
}
|
|
47957
49449
|
},
|
|
@@ -48013,9 +49505,8 @@ ${detail}` : ""}`
|
|
|
48013
49505
|
visibleEntries,
|
|
48014
49506
|
installedById,
|
|
48015
49507
|
canInstall,
|
|
48016
|
-
|
|
48017
|
-
|
|
48018
|
-
activeMutationAction,
|
|
49508
|
+
pendingMutations,
|
|
49509
|
+
globalBusy: recovering,
|
|
48019
49510
|
onOpenDetails: openDetailModal,
|
|
48020
49511
|
onInstall: (entry, isUpdate) => {
|
|
48021
49512
|
void installFromCatalog(entry, isUpdate);
|
|
@@ -48031,7 +49522,7 @@ ${detail}` : ""}`
|
|
|
48031
49522
|
render();
|
|
48032
49523
|
},
|
|
48033
49524
|
onRetryCatalog: () => {
|
|
48034
|
-
if (!catalogLoading && !
|
|
49525
|
+
if (!catalogLoading && !recovering) {
|
|
48035
49526
|
void loadCatalog({ forceRefresh: true, silent: false });
|
|
48036
49527
|
}
|
|
48037
49528
|
}
|
|
@@ -48067,14 +49558,16 @@ ${detail}` : ""}`
|
|
|
48067
49558
|
clearPollTimer();
|
|
48068
49559
|
if (disposed || context2.signal.aborted || document2.visibilityState === "hidden") return;
|
|
48069
49560
|
pollTimer = setTimeout(() => {
|
|
48070
|
-
if (disposed || context2.signal.aborted ||
|
|
49561
|
+
if (disposed || context2.signal.aborted || hasPendingMutations() || loading || activeRecoveryDialog || importModal.isOpen) {
|
|
48071
49562
|
schedulePoll();
|
|
48072
49563
|
return;
|
|
48073
49564
|
}
|
|
48074
49565
|
void loadInstalled({ silent: true });
|
|
48075
49566
|
}, POLL_INTERVAL_MS2);
|
|
48076
49567
|
};
|
|
48077
|
-
const applyLoadedList = (result) => {
|
|
49568
|
+
const applyLoadedList = (result, token) => {
|
|
49569
|
+
if (token !== void 0 && token !== listApplyToken) return false;
|
|
49570
|
+
if (token === void 0) listApplyToken += 1;
|
|
48078
49571
|
const hadOpenPageId = pageHost.extensionId;
|
|
48079
49572
|
listing = result;
|
|
48080
49573
|
pluginPages?.syncInstalledExtensions?.(result.extensions, result.configuration.revision);
|
|
@@ -48082,6 +49575,18 @@ ${detail}` : ""}`
|
|
|
48082
49575
|
if (hadOpenPageId && !pageHost.isOpen) {
|
|
48083
49576
|
setFeedback({ tone: "info", text: copy.pageClosedDisabled });
|
|
48084
49577
|
}
|
|
49578
|
+
return true;
|
|
49579
|
+
};
|
|
49580
|
+
const refreshInstalledAfterMutation = async () => {
|
|
49581
|
+
const client = resolveAvailableClient(getClient);
|
|
49582
|
+
if (!client?.listHostExtensions) return;
|
|
49583
|
+
const token = ++listApplyToken;
|
|
49584
|
+
try {
|
|
49585
|
+
const refreshed = await client.listHostExtensions();
|
|
49586
|
+
if (disposed || context2.signal.aborted) return;
|
|
49587
|
+
applyLoadedList(refreshed, token);
|
|
49588
|
+
} catch {
|
|
49589
|
+
}
|
|
48085
49590
|
};
|
|
48086
49591
|
const loadInstalled = async (options = {}) => {
|
|
48087
49592
|
const silent = options.silent ?? false;
|
|
@@ -48102,17 +49607,23 @@ ${detail}` : ""}`
|
|
|
48102
49607
|
render();
|
|
48103
49608
|
}
|
|
48104
49609
|
const listHostExtensions = client.listHostExtensions.bind(client);
|
|
49610
|
+
const token = ++listApplyToken;
|
|
48105
49611
|
await context2.runLatest(async () => listHostExtensions(), {
|
|
48106
49612
|
success(result) {
|
|
48107
49613
|
loading = false;
|
|
48108
49614
|
unavailable = false;
|
|
48109
|
-
applyLoadedList(result);
|
|
48110
|
-
if (!keepFeedback) setFeedback(null);
|
|
49615
|
+
const applied = applyLoadedList(result, token);
|
|
49616
|
+
if (applied && !keepFeedback) setFeedback(null);
|
|
48111
49617
|
render();
|
|
48112
49618
|
schedulePoll();
|
|
48113
49619
|
},
|
|
48114
49620
|
failure(error62) {
|
|
48115
49621
|
loading = false;
|
|
49622
|
+
if (token !== listApplyToken) {
|
|
49623
|
+
render();
|
|
49624
|
+
schedulePoll();
|
|
49625
|
+
return;
|
|
49626
|
+
}
|
|
48116
49627
|
if (error62 instanceof RendererMethodUnavailableError) {
|
|
48117
49628
|
unavailable = true;
|
|
48118
49629
|
listing = null;
|
|
@@ -48183,7 +49694,8 @@ ${detail}` : ""}`
|
|
|
48183
49694
|
}
|
|
48184
49695
|
};
|
|
48185
49696
|
const installFromCatalog = async (entry, isUpdate) => {
|
|
48186
|
-
if (
|
|
49697
|
+
if (recovering || pendingMutations.has(entry.id) || disposed || context2.signal.aborted)
|
|
49698
|
+
return;
|
|
48187
49699
|
const client = resolveAvailableClient(getClient);
|
|
48188
49700
|
const installedItem = listing?.extensions.find((item) => item.id === entry.id);
|
|
48189
49701
|
const canUpdate = isUpdate && installedItem?.state === "valid" && Boolean(client?.updateHostExtension);
|
|
@@ -48191,10 +49703,7 @@ ${detail}` : ""}`
|
|
|
48191
49703
|
const update = client?.updateHostExtension?.bind(client);
|
|
48192
49704
|
if (!canUpdate && !install2) return;
|
|
48193
49705
|
const fallbackName = catalogDisplayName(entry, messages.locale);
|
|
48194
|
-
|
|
48195
|
-
mutating = true;
|
|
48196
|
-
activeMutationId = entry.id;
|
|
48197
|
-
activeMutationAction = isUpdate ? "update" : "install";
|
|
49706
|
+
pendingMutations.set(entry.id, isUpdate ? "update" : "install");
|
|
48198
49707
|
clearPollTimer();
|
|
48199
49708
|
render();
|
|
48200
49709
|
try {
|
|
@@ -48215,6 +49724,7 @@ ${detail}` : ""}`
|
|
|
48215
49724
|
}
|
|
48216
49725
|
if (disposed || context2.signal.aborted) return;
|
|
48217
49726
|
const displayName = result.manifest.name[messages.locale] || result.manifest.name.en || fallbackName;
|
|
49727
|
+
const modalTargetId = detailModal.extensionId === entry.id ? entry.id : null;
|
|
48218
49728
|
setFeedback(
|
|
48219
49729
|
{
|
|
48220
49730
|
tone: "success",
|
|
@@ -48225,14 +49735,10 @@ ${detail}` : ""}`
|
|
|
48225
49735
|
},
|
|
48226
49736
|
modalTargetId
|
|
48227
49737
|
);
|
|
48228
|
-
|
|
48229
|
-
const refreshed = await client.listHostExtensions();
|
|
48230
|
-
if (!disposed && !context2.signal.aborted) {
|
|
48231
|
-
applyLoadedList(refreshed);
|
|
48232
|
-
}
|
|
48233
|
-
}
|
|
49738
|
+
await refreshInstalledAfterMutation();
|
|
48234
49739
|
} catch (error62) {
|
|
48235
49740
|
if (disposed || context2.signal.aborted) return;
|
|
49741
|
+
const modalTargetId = detailModal.extensionId === entry.id ? entry.id : null;
|
|
48236
49742
|
setFeedback(
|
|
48237
49743
|
{
|
|
48238
49744
|
tone: "danger",
|
|
@@ -48241,24 +49747,21 @@ ${detail}` : ""}`
|
|
|
48241
49747
|
modalTargetId
|
|
48242
49748
|
);
|
|
48243
49749
|
} finally {
|
|
49750
|
+
pendingMutations.delete(entry.id);
|
|
48244
49751
|
if (!disposed && !context2.signal.aborted) {
|
|
48245
|
-
mutating = false;
|
|
48246
|
-
activeMutationId = null;
|
|
48247
|
-
activeMutationAction = null;
|
|
48248
49752
|
render();
|
|
48249
|
-
schedulePoll();
|
|
49753
|
+
if (!hasPendingMutations()) schedulePoll();
|
|
48250
49754
|
}
|
|
48251
49755
|
}
|
|
48252
49756
|
};
|
|
48253
49757
|
const importExtension = async (source) => {
|
|
49758
|
+
if (importing || recovering) return;
|
|
48254
49759
|
const client = resolveAvailableClient(getClient);
|
|
48255
49760
|
const install2 = client?.installHostExtension?.bind(client);
|
|
48256
49761
|
if (!install2) {
|
|
48257
49762
|
throw new Error(copy.importUnavailable);
|
|
48258
49763
|
}
|
|
48259
|
-
|
|
48260
|
-
activeMutationId = null;
|
|
48261
|
-
activeMutationAction = "install";
|
|
49764
|
+
importing = true;
|
|
48262
49765
|
clearPollTimer();
|
|
48263
49766
|
syncToolbarState();
|
|
48264
49767
|
try {
|
|
@@ -48278,32 +49781,23 @@ ${detail}` : ""}`
|
|
|
48278
49781
|
version: result.manifest.version
|
|
48279
49782
|
})
|
|
48280
49783
|
});
|
|
48281
|
-
|
|
48282
|
-
const refreshed = await client.listHostExtensions();
|
|
48283
|
-
if (!disposed && !context2.signal.aborted) {
|
|
48284
|
-
applyLoadedList(refreshed);
|
|
48285
|
-
}
|
|
48286
|
-
}
|
|
49784
|
+
await refreshInstalledAfterMutation();
|
|
48287
49785
|
} finally {
|
|
49786
|
+
importing = false;
|
|
48288
49787
|
if (!disposed && !context2.signal.aborted) {
|
|
48289
|
-
mutating = false;
|
|
48290
|
-
activeMutationId = null;
|
|
48291
|
-
activeMutationAction = null;
|
|
48292
49788
|
render();
|
|
48293
|
-
schedulePoll();
|
|
49789
|
+
if (!hasPendingMutations()) schedulePoll();
|
|
48294
49790
|
}
|
|
48295
49791
|
}
|
|
48296
49792
|
};
|
|
48297
49793
|
const uninstallExtension = async (item) => {
|
|
48298
|
-
if (
|
|
49794
|
+
if (recovering || pendingMutations.has(item.id) || disposed || context2.signal.aborted)
|
|
49795
|
+
return;
|
|
48299
49796
|
const client = resolveAvailableClient(getClient);
|
|
48300
49797
|
const uninstall = client?.uninstallHostExtension?.bind(client);
|
|
48301
49798
|
if (!uninstall) return;
|
|
48302
49799
|
const displayName = extensionDisplayName(item, messages.locale);
|
|
48303
|
-
|
|
48304
|
-
mutating = true;
|
|
48305
|
-
activeMutationId = item.id;
|
|
48306
|
-
activeMutationAction = "uninstall";
|
|
49800
|
+
pendingMutations.set(item.id, "uninstall");
|
|
48307
49801
|
clearPollTimer();
|
|
48308
49802
|
render();
|
|
48309
49803
|
try {
|
|
@@ -48315,19 +49809,17 @@ ${detail}` : ""}`
|
|
|
48315
49809
|
if (pageHost.extensionId === item.id) {
|
|
48316
49810
|
pageHost.close();
|
|
48317
49811
|
}
|
|
48318
|
-
detailModal.
|
|
49812
|
+
if (detailModal.extensionId === item.id) {
|
|
49813
|
+
detailModal.close();
|
|
49814
|
+
}
|
|
48319
49815
|
setFeedback({
|
|
48320
49816
|
tone: "success",
|
|
48321
49817
|
text: formatMessage(copy.uninstalledSuccess, { name: displayName })
|
|
48322
49818
|
});
|
|
48323
|
-
|
|
48324
|
-
const refreshed = await client.listHostExtensions();
|
|
48325
|
-
if (!disposed && !context2.signal.aborted) {
|
|
48326
|
-
applyLoadedList(refreshed);
|
|
48327
|
-
}
|
|
48328
|
-
}
|
|
49819
|
+
await refreshInstalledAfterMutation();
|
|
48329
49820
|
} catch (error62) {
|
|
48330
49821
|
if (disposed || context2.signal.aborted) return;
|
|
49822
|
+
const modalTargetId = detailModal.extensionId === item.id ? item.id : null;
|
|
48331
49823
|
setFeedback(
|
|
48332
49824
|
{
|
|
48333
49825
|
tone: "danger",
|
|
@@ -48336,17 +49828,16 @@ ${detail}` : ""}`
|
|
|
48336
49828
|
modalTargetId
|
|
48337
49829
|
);
|
|
48338
49830
|
} finally {
|
|
49831
|
+
pendingMutations.delete(item.id);
|
|
48339
49832
|
if (!disposed && !context2.signal.aborted) {
|
|
48340
|
-
mutating = false;
|
|
48341
|
-
activeMutationId = null;
|
|
48342
|
-
activeMutationAction = null;
|
|
48343
49833
|
render();
|
|
48344
|
-
schedulePoll();
|
|
49834
|
+
if (!hasPendingMutations()) schedulePoll();
|
|
48345
49835
|
}
|
|
48346
49836
|
}
|
|
48347
49837
|
};
|
|
48348
49838
|
const toggleExtension = async (item, enable) => {
|
|
48349
|
-
if (
|
|
49839
|
+
if (recovering || pendingMutations.has(item.id) || disposed || context2.signal.aborted)
|
|
49840
|
+
return;
|
|
48350
49841
|
const client = resolveAvailableClient(getClient);
|
|
48351
49842
|
const mutate = enable ? client?.enableHostExtension?.bind(client) : client?.disableHostExtension?.bind(client);
|
|
48352
49843
|
if (!mutate) {
|
|
@@ -48354,17 +49845,17 @@ ${detail}` : ""}`
|
|
|
48354
49845
|
render();
|
|
48355
49846
|
return;
|
|
48356
49847
|
}
|
|
48357
|
-
const expectedRevision2 = listing?.configuration.revision ?? 0;
|
|
48358
49848
|
const displayName = extensionDisplayName(item, messages.locale);
|
|
48359
|
-
|
|
48360
|
-
mutating = true;
|
|
48361
|
-
activeMutationId = item.id;
|
|
48362
|
-
activeMutationAction = "toggle";
|
|
49849
|
+
pendingMutations.set(item.id, "toggle");
|
|
48363
49850
|
clearPollTimer();
|
|
48364
49851
|
render();
|
|
48365
|
-
|
|
49852
|
+
let shouldReload = false;
|
|
49853
|
+
const runQueued = toggleQueue.then(async () => {
|
|
49854
|
+
if (disposed || context2.signal.aborted) return;
|
|
49855
|
+
const expectedRevision2 = listing?.configuration.revision ?? 0;
|
|
48366
49856
|
const result = await mutate({ id: item.id, expectedRevision: expectedRevision2 });
|
|
48367
49857
|
if (disposed || context2.signal.aborted) return;
|
|
49858
|
+
const modalTargetId = detailModal.extensionId === item.id ? item.id : null;
|
|
48368
49859
|
if (result.state === "saved") {
|
|
48369
49860
|
if (!enable && pageHost.extensionId === item.id) {
|
|
48370
49861
|
pageHost.close();
|
|
@@ -48387,14 +49878,17 @@ ${detail}` : ""}`
|
|
|
48387
49878
|
},
|
|
48388
49879
|
modalTargetId
|
|
48389
49880
|
);
|
|
48390
|
-
|
|
48391
|
-
activeMutationId = null;
|
|
48392
|
-
activeMutationAction = null;
|
|
48393
|
-
render();
|
|
48394
|
-
await loadInstalled({ silent: true, keepFeedback: true });
|
|
49881
|
+
shouldReload = true;
|
|
48395
49882
|
return;
|
|
48396
49883
|
}
|
|
48397
49884
|
if (result.state === "revision-conflict") {
|
|
49885
|
+
listApplyToken += 1;
|
|
49886
|
+
if (listing) {
|
|
49887
|
+
listing = {
|
|
49888
|
+
...listing,
|
|
49889
|
+
configuration: { ...listing.configuration, revision: result.revision }
|
|
49890
|
+
};
|
|
49891
|
+
}
|
|
48398
49892
|
setFeedback(
|
|
48399
49893
|
{
|
|
48400
49894
|
tone: "warning",
|
|
@@ -48402,13 +49896,15 @@ ${detail}` : ""}`
|
|
|
48402
49896
|
},
|
|
48403
49897
|
modalTargetId
|
|
48404
49898
|
);
|
|
48405
|
-
|
|
48406
|
-
activeMutationId = null;
|
|
48407
|
-
activeMutationAction = null;
|
|
48408
|
-
render();
|
|
48409
|
-
await loadInstalled({ silent: true, keepFeedback: true });
|
|
48410
|
-
return;
|
|
49899
|
+
shouldReload = true;
|
|
48411
49900
|
}
|
|
49901
|
+
});
|
|
49902
|
+
toggleQueue = runQueued.then(
|
|
49903
|
+
() => void 0,
|
|
49904
|
+
() => void 0
|
|
49905
|
+
);
|
|
49906
|
+
try {
|
|
49907
|
+
await runQueued;
|
|
48412
49908
|
} catch (error62) {
|
|
48413
49909
|
if (disposed || context2.signal.aborted) return;
|
|
48414
49910
|
if (error62 instanceof RendererMethodUnavailableError) {
|
|
@@ -48417,6 +49913,7 @@ ${detail}` : ""}`
|
|
|
48417
49913
|
setFeedback(null);
|
|
48418
49914
|
return;
|
|
48419
49915
|
}
|
|
49916
|
+
const modalTargetId = detailModal.extensionId === item.id ? item.id : null;
|
|
48420
49917
|
setFeedback(
|
|
48421
49918
|
{
|
|
48422
49919
|
tone: "danger",
|
|
@@ -48425,17 +49922,20 @@ ${detail}` : ""}`
|
|
|
48425
49922
|
modalTargetId
|
|
48426
49923
|
);
|
|
48427
49924
|
} finally {
|
|
49925
|
+
pendingMutations.delete(item.id);
|
|
48428
49926
|
if (!disposed && !context2.signal.aborted) {
|
|
48429
|
-
mutating = false;
|
|
48430
|
-
activeMutationId = null;
|
|
48431
|
-
activeMutationAction = null;
|
|
48432
49927
|
render();
|
|
48433
|
-
|
|
49928
|
+
if (shouldReload) {
|
|
49929
|
+
await loadInstalled({ silent: true, keepFeedback: true });
|
|
49930
|
+
} else if (!hasPendingMutations()) {
|
|
49931
|
+
schedulePoll();
|
|
49932
|
+
}
|
|
48434
49933
|
}
|
|
48435
49934
|
}
|
|
48436
49935
|
};
|
|
48437
49936
|
const openRecoveryDialog = () => {
|
|
48438
|
-
if (disposed || context2.signal.aborted ||
|
|
49937
|
+
if (disposed || context2.signal.aborted || hasPendingMutations() || activeRecoveryDialog)
|
|
49938
|
+
return;
|
|
48439
49939
|
const client = resolveAvailableClient(getClient);
|
|
48440
49940
|
if (!client?.recoverHostExtensions) return;
|
|
48441
49941
|
detailModal.close();
|
|
@@ -48494,7 +49994,7 @@ ${detail}` : ""}`
|
|
|
48494
49994
|
context2.signal.addEventListener("abort", cleanupDialog, { once: true });
|
|
48495
49995
|
form.addEventListener("submit", (event) => {
|
|
48496
49996
|
event.preventDefault();
|
|
48497
|
-
if (dialogBusy ||
|
|
49997
|
+
if (dialogBusy || hasPendingMutations()) return;
|
|
48498
49998
|
const recover = resolveAvailableClient(getClient)?.recoverHostExtensions;
|
|
48499
49999
|
if (!recover) {
|
|
48500
50000
|
modal.close();
|
|
@@ -48504,9 +50004,9 @@ ${detail}` : ""}`
|
|
|
48504
50004
|
}
|
|
48505
50005
|
dialogError.textContent = "";
|
|
48506
50006
|
setDialogBusy(true);
|
|
48507
|
-
|
|
50007
|
+
recovering = true;
|
|
48508
50008
|
clearPollTimer();
|
|
48509
|
-
|
|
50009
|
+
render();
|
|
48510
50010
|
const params = listing !== null ? { expectedRevision: listing.configuration.revision } : {};
|
|
48511
50011
|
void recover(params).then(async (result) => {
|
|
48512
50012
|
if (disposed || context2.signal.aborted) return;
|
|
@@ -48526,31 +50026,40 @@ ${detail}` : ""}`
|
|
|
48526
50026
|
tone: "info",
|
|
48527
50027
|
text: copy.recoverySaved
|
|
48528
50028
|
});
|
|
48529
|
-
|
|
50029
|
+
recovering = false;
|
|
48530
50030
|
modal.close();
|
|
48531
50031
|
render();
|
|
48532
50032
|
await loadInstalled({ silent: true, keepFeedback: true });
|
|
48533
50033
|
return;
|
|
48534
50034
|
}
|
|
48535
50035
|
if (result.state === "revision-conflict") {
|
|
50036
|
+
listApplyToken += 1;
|
|
50037
|
+
if (listing) {
|
|
50038
|
+
listing = {
|
|
50039
|
+
...listing,
|
|
50040
|
+
configuration: { ...listing.configuration, revision: result.revision }
|
|
50041
|
+
};
|
|
50042
|
+
}
|
|
48536
50043
|
setFeedback({
|
|
48537
50044
|
tone: "warning",
|
|
48538
50045
|
text: copy.revisionConflictBanner
|
|
48539
50046
|
});
|
|
48540
|
-
|
|
50047
|
+
recovering = false;
|
|
48541
50048
|
modal.close();
|
|
48542
50049
|
render();
|
|
48543
50050
|
await loadInstalled({ silent: true, keepFeedback: true });
|
|
48544
50051
|
return;
|
|
48545
50052
|
}
|
|
48546
|
-
|
|
50053
|
+
recovering = false;
|
|
48547
50054
|
setDialogBusy(false);
|
|
48548
|
-
|
|
50055
|
+
render();
|
|
50056
|
+
schedulePoll();
|
|
48549
50057
|
}).catch((error62) => {
|
|
48550
50058
|
if (disposed || context2.signal.aborted) return;
|
|
48551
|
-
|
|
50059
|
+
recovering = false;
|
|
48552
50060
|
setDialogBusy(false);
|
|
48553
|
-
|
|
50061
|
+
render();
|
|
50062
|
+
schedulePoll();
|
|
48554
50063
|
if (error62 instanceof RendererMethodUnavailableError) {
|
|
48555
50064
|
modal.close();
|
|
48556
50065
|
unavailable = true;
|
|
@@ -48581,7 +50090,7 @@ ${detail}` : ""}`
|
|
|
48581
50090
|
};
|
|
48582
50091
|
const onVisibilityChange = () => {
|
|
48583
50092
|
if (document2.visibilityState === "hidden") clearPollTimer();
|
|
48584
|
-
else if (!disposed && !context2.signal.aborted && !
|
|
50093
|
+
else if (!disposed && !context2.signal.aborted && !hasPendingMutations() && !loading && !activeRecoveryDialog && !importModal.isOpen) {
|
|
48585
50094
|
void loadInstalled({ silent: true });
|
|
48586
50095
|
}
|
|
48587
50096
|
};
|
|
@@ -48670,14 +50179,14 @@ ${detail}` : ""}`
|
|
|
48670
50179
|
createModal.open();
|
|
48671
50180
|
});
|
|
48672
50181
|
importButton.addEventListener("click", () => {
|
|
48673
|
-
if (
|
|
50182
|
+
if (importing || recovering || !clientCapabilities().canInstall) return;
|
|
48674
50183
|
closeHeaderMenus();
|
|
48675
50184
|
detailModal.close();
|
|
48676
50185
|
createModal.close();
|
|
48677
50186
|
importModal.open();
|
|
48678
50187
|
});
|
|
48679
50188
|
refreshButton.addEventListener("click", () => {
|
|
48680
|
-
if (
|
|
50189
|
+
if (recovering) return;
|
|
48681
50190
|
closeHeaderMenus();
|
|
48682
50191
|
if (activeTab === "marketplace") {
|
|
48683
50192
|
if (!catalogLoading) void loadCatalog({ forceRefresh: true, silent: false });
|
|
@@ -48687,7 +50196,7 @@ ${detail}` : ""}`
|
|
|
48687
50196
|
}
|
|
48688
50197
|
});
|
|
48689
50198
|
bannerRetry.addEventListener("click", () => {
|
|
48690
|
-
if (
|
|
50199
|
+
if (recovering) return;
|
|
48691
50200
|
if (activeTab === "marketplace") {
|
|
48692
50201
|
if (!catalogLoading) void loadCatalog({ forceRefresh: true, silent: false });
|
|
48693
50202
|
} else if (!loading) {
|
|
@@ -50707,7 +52216,7 @@ ${detail}` : ""}`
|
|
|
50707
52216
|
}
|
|
50708
52217
|
|
|
50709
52218
|
// src/settings/delegation-diagram.ts
|
|
50710
|
-
var
|
|
52219
|
+
var SVG_NS4 = "http://www.w3.org/2000/svg";
|
|
50711
52220
|
var RING_RADIUS = 16.5;
|
|
50712
52221
|
var RING_CIRCUMFERENCE = 2 * Math.PI * RING_RADIUS;
|
|
50713
52222
|
var COMET_TAIL_LENGTH = 72;
|
|
@@ -50759,7 +52268,7 @@ ${detail}` : ""}`
|
|
|
50759
52268
|
{ id: "grok", name: "Grok" }
|
|
50760
52269
|
];
|
|
50761
52270
|
function createSvgElement(doc, tag, attrs) {
|
|
50762
|
-
const el = doc.createElementNS(
|
|
52271
|
+
const el = doc.createElementNS(SVG_NS4, tag);
|
|
50763
52272
|
if (attrs) {
|
|
50764
52273
|
for (const [key2, value] of Object.entries(attrs)) {
|
|
50765
52274
|
el.setAttribute(key2, value);
|
|
@@ -52629,6 +54138,12 @@ ${detail}` : ""}`
|
|
|
52629
54138
|
panel.replaceChildren();
|
|
52630
54139
|
panel.append(createPanelHead(document2, viewPhase, message2));
|
|
52631
54140
|
appendServiceStopOutput(status);
|
|
54141
|
+
if (status?.phase === "failed" && status.error) {
|
|
54142
|
+
const error62 = document2.createElement("p");
|
|
54143
|
+
error62.className = "settings-update-error";
|
|
54144
|
+
error62.textContent = status.error;
|
|
54145
|
+
panel.append(error62);
|
|
54146
|
+
}
|
|
52632
54147
|
setManualFallback(viewPhase === "failed");
|
|
52633
54148
|
if (status?.phase === "downloading" && status.totalBytes !== void 0 && status.downloadedBytes !== void 0) {
|
|
52634
54149
|
const progress = document2.createElement("progress");
|
|
@@ -61464,18 +62979,18 @@ ${renderer_brand_mark_default}`;
|
|
|
61464
62979
|
}
|
|
61465
62980
|
|
|
61466
62981
|
// src/renderer-skill-reference.ts
|
|
61467
|
-
var
|
|
61468
|
-
var
|
|
62982
|
+
var STYLE_ATTRIBUTE4 = "data-codexhost-skill-reference-style";
|
|
62983
|
+
var SVG_NS5 = "http://www.w3.org/2000/svg";
|
|
61469
62984
|
var CUBE = "M12 3 20 7.5v9L12 21l-8-4.5v-9ZM4 7.5 12 12l8-4.5M12 12v9";
|
|
61470
62985
|
function createSkillIcon(ownerDocument) {
|
|
61471
|
-
const svg2 = ownerDocument.createElementNS(
|
|
62986
|
+
const svg2 = ownerDocument.createElementNS(SVG_NS5, "svg");
|
|
61472
62987
|
svg2.setAttribute("viewBox", "0 0 24 24");
|
|
61473
62988
|
svg2.setAttribute("fill", "none");
|
|
61474
62989
|
svg2.setAttribute("stroke", "currentColor");
|
|
61475
62990
|
svg2.setAttribute("stroke-width", "1.7");
|
|
61476
62991
|
svg2.setAttribute("stroke-linejoin", "round");
|
|
61477
62992
|
svg2.setAttribute("aria-hidden", "true");
|
|
61478
|
-
const path = ownerDocument.createElementNS(
|
|
62993
|
+
const path = ownerDocument.createElementNS(SVG_NS5, "path");
|
|
61479
62994
|
path.setAttribute("d", CUBE);
|
|
61480
62995
|
svg2.append(path);
|
|
61481
62996
|
return svg2;
|
|
@@ -61485,10 +63000,10 @@ ${renderer_brand_mark_default}`;
|
|
|
61485
63000
|
}
|
|
61486
63001
|
function installRendererSkillReferences(ownerDocument, isExternalEditor) {
|
|
61487
63002
|
const style2 = ownerDocument.createElement("style");
|
|
61488
|
-
style2.setAttribute(
|
|
63003
|
+
style2.setAttribute(STYLE_ATTRIBUTE4, "true");
|
|
61489
63004
|
const selector = `[agent-mention-path^="${DESKTOP_SKILL_MENTION_PATH_PREFIX}"][agent-mention-display-name]`;
|
|
61490
63005
|
const icon2 = encodeURIComponent(
|
|
61491
|
-
`<svg xmlns="${
|
|
63006
|
+
`<svg xmlns="${SVG_NS5}" viewBox="0 0 24 24" fill="none" stroke="#808080" stroke-width="1.7" stroke-linejoin="round"><path d="${CUBE}"/></svg>`
|
|
61492
63007
|
);
|
|
61493
63008
|
style2.textContent = `${selector}>span{display:none;}
|
|
61494
63009
|
${selector}::before{content:"";display:inline-block;width:16px;height:16px;margin-inline-end:3px;vertical-align:-3px;background:url("data:image/svg+xml,${icon2}") center/contain no-repeat;}
|
|
@@ -61600,7 +63115,7 @@ ${selector}::after{content:attr(agent-mention-display-name);}`;
|
|
|
61600
63115
|
|
|
61601
63116
|
// src/renderer-delegation-mention.ts
|
|
61602
63117
|
var MENU_ATTRIBUTE = "data-codexhost-delegation-mention-menu";
|
|
61603
|
-
var
|
|
63118
|
+
var STYLE_ATTRIBUTE5 = "data-codexhost-delegation-mention-style";
|
|
61604
63119
|
var MENU_MAX_HEIGHT = 320;
|
|
61605
63120
|
var SOURCE_TAG = "codexhost";
|
|
61606
63121
|
var MENU_CLASS = "border-default bg-surface-elevated-secondary flex flex-col overflow-hidden rounded-[var(--radius-suggestion-menu,var(--radius-2xl))] border text-sm backdrop-blur-sm";
|
|
@@ -61678,10 +63193,10 @@ ${selector}::after{content:attr(agent-mention-display-name);}`;
|
|
|
61678
63193
|
return `"${value.replace(/["\\\n]/gu, (character) => `\\${character === "\n" ? "a " : character}`)}"`;
|
|
61679
63194
|
}
|
|
61680
63195
|
function syncChipStyle(ownerDocument, targets, cache) {
|
|
61681
|
-
let style2 = ownerDocument.querySelector(`style[${
|
|
63196
|
+
let style2 = ownerDocument.querySelector(`style[${STYLE_ATTRIBUTE5}]`);
|
|
61682
63197
|
if (!style2) {
|
|
61683
63198
|
style2 = ownerDocument.createElement("style");
|
|
61684
|
-
style2.setAttribute(
|
|
63199
|
+
style2.setAttribute(STYLE_ATTRIBUTE5, "true");
|
|
61685
63200
|
(ownerDocument.head ?? ownerDocument.documentElement).append(style2);
|
|
61686
63201
|
}
|
|
61687
63202
|
const chip = [DELEGATION_MENTION_PATH_PREFIX, HARNESS_COMMAND_MENTION_PATH_PREFIX].map((prefix) => `[agent-mention-path^=${cssString(prefix)}][agent-mention-display-name]`).join(",");
|
|
@@ -62096,7 +63611,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
|
|
|
62096
63611
|
view.removeEventListener("scroll", onViewportChange, true);
|
|
62097
63612
|
options.onClose?.();
|
|
62098
63613
|
menu.remove();
|
|
62099
|
-
ownerDocument.querySelector(`style[${
|
|
63614
|
+
ownerDocument.querySelector(`style[${STYLE_ATTRIBUTE5}]`)?.remove();
|
|
62100
63615
|
};
|
|
62101
63616
|
const openFor = (editor) => {
|
|
62102
63617
|
editor.focus({ preventScroll: true });
|
|
@@ -63900,11 +65415,12 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
|
|
|
63900
65415
|
renderMounted(mounted);
|
|
63901
65416
|
}
|
|
63902
65417
|
};
|
|
65418
|
+
function isDraftUsageComposer(mounted) {
|
|
65419
|
+
return controller.get(mounted.composer).phase === "draft" && !controller.isSwitching(mounted.composer) && !controller.isSubmissionPending(mounted.composer) && !threadIdFromComposerModelTarget(mounted.modelTarget);
|
|
65420
|
+
}
|
|
63903
65421
|
const refreshDraftUsage = async (mounted) => {
|
|
63904
|
-
|
|
63905
|
-
|
|
63906
|
-
return;
|
|
63907
|
-
const agent = state.agent;
|
|
65422
|
+
if (!isDraftUsageComposer(mounted)) return;
|
|
65423
|
+
const agent = controller.get(mounted.composer).agent;
|
|
63908
65424
|
const accounts = agent === "codex" ? composerCodexAccounts(mounted.composer) : null;
|
|
63909
65425
|
const accountId = accounts?.readyAccountId;
|
|
63910
65426
|
const client = composerClient(mounted);
|
|
@@ -63921,7 +65437,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
|
|
|
63921
65437
|
mounted.accountBalance = null;
|
|
63922
65438
|
mounted.accountCreditsSupported = false;
|
|
63923
65439
|
renderMounted(mounted);
|
|
63924
|
-
const isCurrent = () => !disposed && mounted.hostId === hostId2 && composerClient(mounted) === client && mounted.composer.isConnected && mountedByComposer.get(mounted.composer) === mounted && mounted.usageRequestGeneration === generation && controller.get(mounted.composer).agent === agent &&
|
|
65440
|
+
const isCurrent = () => !disposed && mounted.hostId === hostId2 && composerClient(mounted) === client && mounted.composer.isConnected && mountedByComposer.get(mounted.composer) === mounted && mounted.usageRequestGeneration === generation && controller.get(mounted.composer).agent === agent && isDraftUsageComposer(mounted);
|
|
63925
65441
|
try {
|
|
63926
65442
|
if (!client) return;
|
|
63927
65443
|
if (agent === "codex") {
|
|
@@ -65326,7 +66842,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
|
|
|
65326
66842
|
const client = composerClient(mounted);
|
|
65327
66843
|
const request = draftUsageRequests.get(mounted);
|
|
65328
66844
|
const state = controller.get(mounted.composer);
|
|
65329
|
-
if (
|
|
66845
|
+
if (isDraftUsageComposer(mounted) && mounted.draftUsageClient !== client && (!request || request.client !== client || request.generation !== mounted.usageRequestGeneration || retryDraftUsage && !request.pending)) {
|
|
65330
66846
|
if (state.agent === "codex") void loadCodexAccountsForHost(mounted.hostId);
|
|
65331
66847
|
else void refreshDraftUsage(mounted);
|
|
65332
66848
|
}
|