@codexhost/cli-win32-arm64 0.26.1 → 0.28.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 +1010 -592
- package/app/console-web.js +1861 -1498
- package/app/desktop-controller.mjs +488 -245
- package/app/host-runtime.mjs +9177 -4006
- package/app/plugins/antigravity/plugin.mjs +9055 -548
- package/app/plugins/claude-code/plugin.mjs +1117 -423
- package/app/plugins/codebuddy/plugin.mjs +599 -261
- package/app/plugins/codex-usage/plugin.mjs +1808 -1357
- package/app/plugins/copilot/plugin.mjs +491 -235
- package/app/plugins/cursor-cli/plugin.mjs +487 -232
- package/app/plugins/deepseek-harness/plugin.mjs +493 -235
- package/app/plugins/devin/plugin.mjs +467 -232
- package/app/plugins/grok/plugin.mjs +547 -253
- package/app/plugins/hermes/plugin.mjs +468 -232
- package/app/plugins/kimi-code/plugin.mjs +762 -439
- package/app/plugins/kiro-cli/plugin.mjs +466 -232
- package/app/plugins/omp/plugin.mjs +1705 -1356
- package/app/plugins/opencode/manifest.json +1 -1
- package/app/plugins/opencode/plugin.mjs +544 -250
- package/app/plugins/pi/plugin.mjs +761 -364
- package/app/plugins/qoder/plugin.mjs +540 -246
- package/app/plugins/qoder-cn/plugin.mjs +540 -246
- package/app/plugins/qwen-code/plugin.mjs +466 -232
- package/app/plugins/workbuddy/plugin.mjs +594 -273
- package/app/plugins/zcode/plugin.mjs +468 -232
- package/app/renderer-extension.js +2653 -657
- package/app/web/assets/index-DBPgg32z.css +1 -0
- package/app/web/assets/index-DWxiVzuS.js +204 -0
- package/app/web/codexhost-settings.js +101 -66
- package/app/web/index.html +2 -2
- package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +65 -65
- package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +69 -69
- 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 +73 -73
- package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +19 -19
- package/app/web/plugins/deepseek-ai__dsh-client-ui-input-trigger/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-layout/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-model-selection/client.js +5 -5
- 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-documentpreview/client.pdf.js +2 -2
- 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 +5065 -1964
- 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(),
|
|
@@ -20357,11 +20389,21 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
20357
20389
|
ids.add(option.id);
|
|
20358
20390
|
}
|
|
20359
20391
|
});
|
|
20392
|
+
var harnessThinkingOptionsScopeSchema = external_exports.enum(["catalog", "activeModel"]);
|
|
20360
20393
|
var harnessModelCatalogSchema = external_exports.object({
|
|
20361
20394
|
models: external_exports.array(harnessModelSchema),
|
|
20362
20395
|
defaultModel: harnessModelRefSchema.optional(),
|
|
20363
20396
|
thinkingOptions: harnessThinkingOptionsSchema,
|
|
20364
|
-
defaultThinkingOptionId: harnessThinkingOptionIdSchema.optional()
|
|
20397
|
+
defaultThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
20398
|
+
/**
|
|
20399
|
+
* Scope of per-Model `supportedThinkingOptionIds` in this catalog.
|
|
20400
|
+
* Omitted or `"catalog"` means each Model's `supportedThinkingOptionIds`
|
|
20401
|
+
* reflects its own options (omitted or `[]` means none).
|
|
20402
|
+
* `"activeModel"` means only the active Model's Thinking options were
|
|
20403
|
+
* observed; other Models omit `supportedThinkingOptionIds` and must be
|
|
20404
|
+
* validated by the Adapter after selecting the Model.
|
|
20405
|
+
*/
|
|
20406
|
+
thinkingOptionsScope: harnessThinkingOptionsScopeSchema.optional()
|
|
20365
20407
|
}).strict().superRefine((catalog, context2) => {
|
|
20366
20408
|
const refs = [];
|
|
20367
20409
|
const thinkingIds = new Set(catalog.thinkingOptions.map(({ id: id2 }) => id2));
|
|
@@ -20498,7 +20540,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
20498
20540
|
]);
|
|
20499
20541
|
var harnessInspectParamsSchema = external_exports.object({
|
|
20500
20542
|
harnessId: harnessIdSchema,
|
|
20501
|
-
cwd:
|
|
20543
|
+
cwd: nonBlankTextSchema3.max(16384).optional(),
|
|
20502
20544
|
refresh: external_exports.boolean().optional(),
|
|
20503
20545
|
/** `availability` asks only whether the Harness can run; see `InspectHarnessInput.purpose`. */
|
|
20504
20546
|
purpose: external_exports.literal("availability").optional(),
|
|
@@ -20528,12 +20570,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
20528
20570
|
effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
20529
20571
|
effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
|
|
20530
20572
|
history: harnessHistoryCapabilitiesSchema.optional(),
|
|
20531
|
-
supportsThreadReferences: external_exports.literal(true).optional()
|
|
20573
|
+
supportsThreadReferences: external_exports.literal(true).optional(),
|
|
20574
|
+
handoff: threadHandoffMetadataSchema.optional()
|
|
20532
20575
|
}).strict();
|
|
20533
20576
|
var externalThreadInspectionSchema = external_exports.object({
|
|
20534
20577
|
owner: external_exports.literal("external"),
|
|
20535
|
-
harnessId:
|
|
20536
|
-
transportModelId:
|
|
20578
|
+
harnessId: nonBlankTextSchema3.max(256),
|
|
20579
|
+
transportModelId: nonBlankTextSchema3.max(HARNESS_TRANSPORT_MODEL_ID_MAX_LENGTH),
|
|
20537
20580
|
effectiveModel: harnessModelRefSchema.optional(),
|
|
20538
20581
|
resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
|
|
20539
20582
|
effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
@@ -20543,6 +20586,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
20543
20586
|
catalog: harnessModelCatalogSchema.optional(),
|
|
20544
20587
|
history: harnessHistoryCapabilitiesSchema,
|
|
20545
20588
|
usage: threadUsageSnapshotSchema.optional(),
|
|
20589
|
+
handoff: threadHandoffMetadataSchema.optional(),
|
|
20546
20590
|
locked: external_exports.literal(true)
|
|
20547
20591
|
}).strict();
|
|
20548
20592
|
var threadInspectionSchema = external_exports.discriminatedUnion("owner", [
|
|
@@ -21257,6 +21301,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
21257
21301
|
"codexhost/harness/preferences/get",
|
|
21258
21302
|
"codexhost/harness/preferences/patch",
|
|
21259
21303
|
"thread/list",
|
|
21304
|
+
"thread/metadata/update",
|
|
21260
21305
|
"codexhost/thread/catalog/read",
|
|
21261
21306
|
"thread/read",
|
|
21262
21307
|
"thread/resume",
|
|
@@ -21281,6 +21326,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
21281
21326
|
"thread/queue/start",
|
|
21282
21327
|
"codexhost/thread/queue/send-now",
|
|
21283
21328
|
"codexhost/workspace/read",
|
|
21329
|
+
"project/create",
|
|
21330
|
+
"project/update",
|
|
21331
|
+
"project/delete",
|
|
21332
|
+
"project/move",
|
|
21284
21333
|
"codexhost/thread/tree/read",
|
|
21285
21334
|
"codexhost/thread/pins/list",
|
|
21286
21335
|
"codexhost/thread/sections/list",
|
|
@@ -21298,6 +21347,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
21298
21347
|
"codexhost/harness/commands/inspect",
|
|
21299
21348
|
"codexhost/thread/command/execute",
|
|
21300
21349
|
"codexhost/thread/fork",
|
|
21350
|
+
THREAD_HANDOFF_METHOD,
|
|
21301
21351
|
"codexhost/harness/session-import/sources",
|
|
21302
21352
|
"codexhost/harness/session-import/list",
|
|
21303
21353
|
"codexhost/harness/session-import/import",
|
|
@@ -21348,7 +21398,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
21348
21398
|
prompt: external_exports.string().max(16384).optional()
|
|
21349
21399
|
}).strict();
|
|
21350
21400
|
var clientWorkspaceSnapshotSchema = external_exports.object({
|
|
21351
|
-
projects: external_exports.array(external_exports.object({
|
|
21401
|
+
projects: external_exports.array(external_exports.object({
|
|
21402
|
+
id: external_exports.string(),
|
|
21403
|
+
name: external_exports.string(),
|
|
21404
|
+
rootPaths: external_exports.array(external_exports.string()),
|
|
21405
|
+
createdAt: external_exports.number().int().optional()
|
|
21406
|
+
})),
|
|
21407
|
+
nativeProjects: external_exports.literal(true).optional(),
|
|
21352
21408
|
assignments: external_exports.record(external_exports.string(), external_exports.string()),
|
|
21353
21409
|
projectless: external_exports.array(external_exports.string()),
|
|
21354
21410
|
/** Canonical external pin membership; pins/list provides the native merged order. */
|
|
@@ -21363,6 +21419,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
21363
21419
|
sequence: external_exports.number().int().nonnegative()
|
|
21364
21420
|
});
|
|
21365
21421
|
var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
|
|
21422
|
+
external_exports.object({ type: external_exports.literal("projects-changed"), cursor: clientChannelCursorSchema }),
|
|
21366
21423
|
external_exports.object({
|
|
21367
21424
|
type: external_exports.literal("skills-changed"),
|
|
21368
21425
|
cursor: clientChannelCursorSchema,
|
|
@@ -21526,7 +21583,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
21526
21583
|
items: external_exports.array(clientQueuedSubmissionSchema),
|
|
21527
21584
|
pausedReason: external_exports.enum(["interrupted", "outcome-unknown", "failed"]).nullable()
|
|
21528
21585
|
}).optional(),
|
|
21529
|
-
interactions: external_exports.array(clientInteractionSchema)
|
|
21586
|
+
interactions: external_exports.array(clientInteractionSchema),
|
|
21587
|
+
handoff: threadHandoffMetadataSchema.optional()
|
|
21530
21588
|
});
|
|
21531
21589
|
var clientChannelDescriptorSchema = external_exports.object({
|
|
21532
21590
|
version: external_exports.literal(CLIENT_CHANNEL_VERSION),
|
|
@@ -21535,7 +21593,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
21535
21593
|
port: external_exports.number().int().min(1).max(65535),
|
|
21536
21594
|
token: external_exports.string().regex(/^[0-9a-f]{64}$/u),
|
|
21537
21595
|
startedAt: external_exports.number(),
|
|
21538
|
-
epoch: external_exports.string().uuid()
|
|
21596
|
+
epoch: external_exports.string().uuid(),
|
|
21597
|
+
capabilities: external_exports.object({
|
|
21598
|
+
peerDelegation: external_exports.literal(1).optional()
|
|
21599
|
+
}).optional()
|
|
21539
21600
|
});
|
|
21540
21601
|
var clientChannelResponseSchema = external_exports.object({
|
|
21541
21602
|
epoch: external_exports.string().uuid(),
|
|
@@ -21554,10 +21615,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
21554
21615
|
* `excludeCwds` folder, the branch ends, or a page bound is reached. Every row read is
|
|
21555
21616
|
* returned, so the native cursors stay contiguous.
|
|
21556
21617
|
*/
|
|
21557
|
-
scope: external_exports.
|
|
21558
|
-
|
|
21559
|
-
|
|
21560
|
-
|
|
21618
|
+
scope: external_exports.union([
|
|
21619
|
+
external_exports.object({
|
|
21620
|
+
cwd: external_exports.string().min(1).max(4096),
|
|
21621
|
+
excludeCwds: external_exports.array(external_exports.string().min(1).max(4096)).max(1024)
|
|
21622
|
+
}).strict(),
|
|
21623
|
+
external_exports.object({
|
|
21624
|
+
projectId: external_exports.string().min(1).max(1024),
|
|
21625
|
+
legacyThreadIds: external_exports.array(external_exports.string().min(1).max(1024)).max(1024),
|
|
21626
|
+
/** Roots whose Threads without a project ID belong to this project, as on Desktop. */
|
|
21627
|
+
rootPaths: external_exports.array(external_exports.string().min(1).max(4096)).max(1024).optional()
|
|
21628
|
+
}).strict()
|
|
21629
|
+
]).optional()
|
|
21561
21630
|
}).strict();
|
|
21562
21631
|
var threadCatalogReadResultSchema = external_exports.object({
|
|
21563
21632
|
threads: external_exports.array(jsonObjectSchema),
|
|
@@ -21793,6 +21862,361 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
21793
21862
|
to: external_exports.number().int().min(1).max(Number.MAX_SAFE_INTEGER).optional()
|
|
21794
21863
|
});
|
|
21795
21864
|
|
|
21865
|
+
// ../shared-contracts/dist/remote-peers.js
|
|
21866
|
+
var REMOTE_PEER_ID_PATTERN = /^[a-zA-Z0-9_-]{1,64}$/u;
|
|
21867
|
+
var remotePeerIdSchema = external_exports.string().regex(REMOTE_PEER_ID_PATTERN);
|
|
21868
|
+
var remotePeerNodeIdSchema = external_exports.string().regex(REMOTE_PEER_ID_PATTERN);
|
|
21869
|
+
var remotePeerHostIdSchema = external_exports.string().regex(/^remote-peer:[a-zA-Z0-9_-]{1,64}$/u);
|
|
21870
|
+
var remotePeerTransportKindSchema = external_exports.enum(["relay", "tailscale", "lan", "custom"]);
|
|
21871
|
+
var REMOTE_PEER_COLORS = [
|
|
21872
|
+
"blue",
|
|
21873
|
+
"purple",
|
|
21874
|
+
"cyan",
|
|
21875
|
+
"green",
|
|
21876
|
+
"amber",
|
|
21877
|
+
"rose",
|
|
21878
|
+
"slate"
|
|
21879
|
+
];
|
|
21880
|
+
var remotePeerColorSchema = external_exports.enum(REMOTE_PEER_COLORS);
|
|
21881
|
+
var REMOTE_PEER_COLOR_SET = new Set(REMOTE_PEER_COLORS);
|
|
21882
|
+
var remotePeerStateSchema = external_exports.enum([
|
|
21883
|
+
"connected",
|
|
21884
|
+
"connecting",
|
|
21885
|
+
"auth-error",
|
|
21886
|
+
"offline",
|
|
21887
|
+
"disabled"
|
|
21888
|
+
]);
|
|
21889
|
+
var remotePeerSummarySchema = external_exports.object({
|
|
21890
|
+
peerId: remotePeerIdSchema,
|
|
21891
|
+
hostId: remotePeerHostIdSchema,
|
|
21892
|
+
nodeId: remotePeerNodeIdSchema.optional(),
|
|
21893
|
+
name: external_exports.string().min(1).max(120),
|
|
21894
|
+
color: remotePeerColorSchema.optional(),
|
|
21895
|
+
origin: external_exports.string().min(1).max(2048),
|
|
21896
|
+
transportKind: remotePeerTransportKindSchema,
|
|
21897
|
+
encrypted: external_exports.boolean(),
|
|
21898
|
+
enabled: external_exports.boolean(),
|
|
21899
|
+
state: remotePeerStateSchema,
|
|
21900
|
+
supportsPeerPairing: external_exports.boolean().optional(),
|
|
21901
|
+
/** Omitted when either side's node mapping is unknown. */
|
|
21902
|
+
pairedBack: external_exports.boolean().optional(),
|
|
21903
|
+
/** Other configured remote peerIds on this Hub present in this peer's `manifest.peerNodes`. */
|
|
21904
|
+
linkedPeerIds: external_exports.array(remotePeerIdSchema).max(128).optional(),
|
|
21905
|
+
latencyMs: external_exports.number().int().nonnegative().optional(),
|
|
21906
|
+
version: external_exports.string().max(128).optional(),
|
|
21907
|
+
platform: external_exports.string().max(64).optional(),
|
|
21908
|
+
hostname: external_exports.string().max(255).optional(),
|
|
21909
|
+
homeDir: external_exports.string().max(4096).optional(),
|
|
21910
|
+
lastError: external_exports.string().max(1e3).optional(),
|
|
21911
|
+
projectCount: external_exports.number().int().nonnegative(),
|
|
21912
|
+
createdAt: external_exports.string(),
|
|
21913
|
+
updatedAt: external_exports.string()
|
|
21914
|
+
});
|
|
21915
|
+
var remotePeerListResultSchema = external_exports.object({
|
|
21916
|
+
peers: external_exports.array(remotePeerSummarySchema)
|
|
21917
|
+
});
|
|
21918
|
+
var remotePeerAddParamsSchema = external_exports.object({
|
|
21919
|
+
connectionUrl: external_exports.string().min(1).max(4096).optional(),
|
|
21920
|
+
origin: external_exports.string().min(1).max(2048).optional(),
|
|
21921
|
+
token: external_exports.string().min(1).max(2048).optional(),
|
|
21922
|
+
name: external_exports.string().trim().min(1).max(120).optional(),
|
|
21923
|
+
color: remotePeerColorSchema.optional(),
|
|
21924
|
+
pairBack: external_exports.boolean().optional(),
|
|
21925
|
+
meshPeerIds: external_exports.array(remotePeerIdSchema).max(64).optional(),
|
|
21926
|
+
selfOrigin: external_exports.string().min(1).max(2048).optional()
|
|
21927
|
+
}).refine((input3) => Boolean(input3.connectionUrl) || Boolean(input3.origin) && Boolean(input3.token), "Provide either connectionUrl or both origin and token");
|
|
21928
|
+
var remotePeerIntroduceParamsSchema = external_exports.strictObject({
|
|
21929
|
+
origin: external_exports.string().min(1).max(2048),
|
|
21930
|
+
token: external_exports.string().min(1).max(2048),
|
|
21931
|
+
name: external_exports.string().trim().min(1).max(120).optional(),
|
|
21932
|
+
color: remotePeerColorSchema.optional(),
|
|
21933
|
+
expectedNodeId: remotePeerNodeIdSchema.optional()
|
|
21934
|
+
});
|
|
21935
|
+
var remotePeerIntroduceResultSchema = external_exports.object({
|
|
21936
|
+
status: external_exports.enum(["added", "updated", "existing"]),
|
|
21937
|
+
peerId: remotePeerIdSchema,
|
|
21938
|
+
hostId: remotePeerHostIdSchema,
|
|
21939
|
+
nodeId: remotePeerNodeIdSchema.optional()
|
|
21940
|
+
});
|
|
21941
|
+
var remotePeerPairingStatusSchema = external_exports.enum([
|
|
21942
|
+
"added",
|
|
21943
|
+
"updated",
|
|
21944
|
+
"existing",
|
|
21945
|
+
"failed",
|
|
21946
|
+
"skipped"
|
|
21947
|
+
]);
|
|
21948
|
+
var remotePeerPairingStepSchema = external_exports.object({
|
|
21949
|
+
targetPeerId: remotePeerIdSchema,
|
|
21950
|
+
targetName: external_exports.string().min(1).max(120),
|
|
21951
|
+
introducedHost: external_exports.union([external_exports.literal("local"), remotePeerIdSchema]),
|
|
21952
|
+
introducedName: external_exports.string().min(1).max(120),
|
|
21953
|
+
status: remotePeerPairingStatusSchema,
|
|
21954
|
+
error: external_exports.string().max(1e3).optional()
|
|
21955
|
+
});
|
|
21956
|
+
var remotePeerPairingReportSchema = external_exports.object({
|
|
21957
|
+
results: external_exports.array(remotePeerPairingStepSchema)
|
|
21958
|
+
});
|
|
21959
|
+
var remotePeerSyncMeshParamsSchema = external_exports.object({
|
|
21960
|
+
peerIds: external_exports.array(remotePeerIdSchema).max(64).optional(),
|
|
21961
|
+
includeSelf: external_exports.boolean().optional(),
|
|
21962
|
+
includeMesh: external_exports.boolean().optional(),
|
|
21963
|
+
selfOrigin: external_exports.string().min(1).max(2048).optional()
|
|
21964
|
+
});
|
|
21965
|
+
var remotePeerUpdateParamsSchema = external_exports.object({
|
|
21966
|
+
peerId: remotePeerIdSchema,
|
|
21967
|
+
name: external_exports.string().trim().min(1).max(120).optional(),
|
|
21968
|
+
color: remotePeerColorSchema.nullable().optional(),
|
|
21969
|
+
connectionUrl: external_exports.string().min(1).max(4096).optional(),
|
|
21970
|
+
origin: external_exports.string().min(1).max(2048).optional(),
|
|
21971
|
+
token: external_exports.string().min(1).max(2048).optional(),
|
|
21972
|
+
enabled: external_exports.boolean().optional()
|
|
21973
|
+
});
|
|
21974
|
+
var remotePeerIdParamsSchema = external_exports.object({
|
|
21975
|
+
peerId: remotePeerIdSchema
|
|
21976
|
+
});
|
|
21977
|
+
var remotePeerRemoveResultSchema = external_exports.object({
|
|
21978
|
+
removed: external_exports.boolean()
|
|
21979
|
+
});
|
|
21980
|
+
var remotePeerTestParamsSchema = external_exports.object({
|
|
21981
|
+
peerId: remotePeerIdSchema.optional(),
|
|
21982
|
+
connectionUrl: external_exports.string().min(1).max(4096).optional(),
|
|
21983
|
+
origin: external_exports.string().min(1).max(2048).optional(),
|
|
21984
|
+
token: external_exports.string().min(1).max(2048).optional()
|
|
21985
|
+
}).refine((input3) => Boolean(input3.peerId) || Boolean(input3.connectionUrl) || Boolean(input3.origin) && Boolean(input3.token), "Provide peerId, connectionUrl, or both origin and token");
|
|
21986
|
+
var remotePeerTestProjectSchema = external_exports.object({
|
|
21987
|
+
id: external_exports.string().min(1).max(1024),
|
|
21988
|
+
name: external_exports.string().min(1).max(512),
|
|
21989
|
+
path: external_exports.string().min(1).max(8192)
|
|
21990
|
+
});
|
|
21991
|
+
var remotePeerTestResultSchema = external_exports.object({
|
|
21992
|
+
ok: external_exports.boolean(),
|
|
21993
|
+
nodeId: remotePeerNodeIdSchema.optional(),
|
|
21994
|
+
supportsPeerPairing: external_exports.boolean().optional(),
|
|
21995
|
+
pairedBack: external_exports.boolean().optional(),
|
|
21996
|
+
latencyMs: external_exports.number().int().nonnegative().optional(),
|
|
21997
|
+
origin: external_exports.string().max(2048).optional(),
|
|
21998
|
+
transportKind: remotePeerTransportKindSchema.optional(),
|
|
21999
|
+
encrypted: external_exports.boolean().optional(),
|
|
22000
|
+
version: external_exports.string().max(128).optional(),
|
|
22001
|
+
platform: external_exports.string().max(64).optional(),
|
|
22002
|
+
hostname: external_exports.string().max(255).optional(),
|
|
22003
|
+
homeDir: external_exports.string().max(4096).optional(),
|
|
22004
|
+
projectCount: external_exports.number().int().nonnegative().optional(),
|
|
22005
|
+
projects: external_exports.array(remotePeerTestProjectSchema).optional(),
|
|
22006
|
+
error: external_exports.string().max(1e3).optional()
|
|
22007
|
+
});
|
|
22008
|
+
var remotePeerManifestProjectSchema = external_exports.object({
|
|
22009
|
+
id: external_exports.string().min(1).max(1024),
|
|
22010
|
+
name: external_exports.string().min(1).max(512),
|
|
22011
|
+
path: external_exports.string().min(1).max(8192),
|
|
22012
|
+
threadIds: external_exports.array(external_exports.string().min(1).max(1024))
|
|
22013
|
+
});
|
|
22014
|
+
var remotePeerCapabilitiesSchema = external_exports.object({
|
|
22015
|
+
/** /api/peer/v1/uploads, /api/peer/v1/prompt, and /api/peer/v1/file are all available. */
|
|
22016
|
+
attachments: external_exports.literal(1).optional(),
|
|
22017
|
+
/** /api/peer/v1/workspace-files/rpc and /api/peer/v1/workspace-files/download are available. */
|
|
22018
|
+
workspaceFiles: external_exports.literal(1).optional(),
|
|
22019
|
+
/** Peer supports officeToPdf/render over /api/peer/v1/workspace-files/rpc. */
|
|
22020
|
+
officePreview: external_exports.literal(1).optional(),
|
|
22021
|
+
/** /api/peer/v1/delegation is available for fixed-whitelist cross-host delegation. */
|
|
22022
|
+
delegation: external_exports.literal(1).optional(),
|
|
22023
|
+
/** POST /api/peer/v1/peers is available. */
|
|
22024
|
+
peerPairing: external_exports.literal(1).optional()
|
|
22025
|
+
});
|
|
22026
|
+
var remotePeerManifestSchema = external_exports.object({
|
|
22027
|
+
version: external_exports.string().max(128),
|
|
22028
|
+
platform: external_exports.string().max(64),
|
|
22029
|
+
hostname: external_exports.string().max(255),
|
|
22030
|
+
homeDir: external_exports.string().max(4096).optional(),
|
|
22031
|
+
epoch: external_exports.string().min(1).max(256),
|
|
22032
|
+
nodeId: remotePeerNodeIdSchema.optional(),
|
|
22033
|
+
peerNodes: external_exports.record(remotePeerHostIdSchema, remotePeerNodeIdSchema).refine((v) => Object.keys(v).length <= 128).optional(),
|
|
22034
|
+
projects: external_exports.array(remotePeerManifestProjectSchema),
|
|
22035
|
+
capabilities: remotePeerCapabilitiesSchema.optional()
|
|
22036
|
+
});
|
|
22037
|
+
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;
|
|
22038
|
+
var remotePeerPromptParamsSchema = external_exports.strictObject({
|
|
22039
|
+
threadId: external_exports.string().min(1).max(1024),
|
|
22040
|
+
scope: external_exports.string().regex(REMOTE_PEER_UPLOAD_SCOPE_PATTERN).optional(),
|
|
22041
|
+
requestId: external_exports.string().min(1).max(256).optional(),
|
|
22042
|
+
mode: external_exports.enum(["queue", "steer"]).optional(),
|
|
22043
|
+
expectedTurnId: external_exports.string().min(1).max(1024).nullable().optional(),
|
|
22044
|
+
content: external_exports.array(external_exports.discriminatedUnion("type", [
|
|
22045
|
+
external_exports.strictObject({ type: external_exports.literal("text"), text: external_exports.string() }),
|
|
22046
|
+
external_exports.strictObject({ type: external_exports.literal("file"), receiptId: external_exports.string().min(1).max(128) })
|
|
22047
|
+
])).min(1).max(64)
|
|
22048
|
+
});
|
|
22049
|
+
var remotePeerErrorEnvelopeSchema = external_exports.object({
|
|
22050
|
+
ok: external_exports.literal(false),
|
|
22051
|
+
error: external_exports.object({
|
|
22052
|
+
code: external_exports.string(),
|
|
22053
|
+
message: external_exports.string(),
|
|
22054
|
+
details: external_exports.record(external_exports.string(), external_exports.unknown()).optional()
|
|
22055
|
+
})
|
|
22056
|
+
});
|
|
22057
|
+
var remotePeerUploadResultSchema = external_exports.union([
|
|
22058
|
+
external_exports.object({
|
|
22059
|
+
ok: external_exports.literal(true),
|
|
22060
|
+
value: external_exports.object({
|
|
22061
|
+
receiptId: external_exports.string().min(1),
|
|
22062
|
+
file: external_exports.object({
|
|
22063
|
+
attachmentId: external_exports.string(),
|
|
22064
|
+
name: external_exports.string(),
|
|
22065
|
+
bytes: external_exports.number().int().nonnegative()
|
|
22066
|
+
})
|
|
22067
|
+
})
|
|
22068
|
+
}),
|
|
22069
|
+
remotePeerErrorEnvelopeSchema
|
|
22070
|
+
]);
|
|
22071
|
+
var remotePeerPromptResultSchema = external_exports.union([
|
|
22072
|
+
external_exports.object({
|
|
22073
|
+
ok: external_exports.literal(true),
|
|
22074
|
+
value: external_exports.object({ accepted: external_exports.literal(true) })
|
|
22075
|
+
}),
|
|
22076
|
+
remotePeerErrorEnvelopeSchema
|
|
22077
|
+
]);
|
|
22078
|
+
var remotePeerDirectoryEntrySchema = external_exports.object({
|
|
22079
|
+
name: external_exports.string().min(1).max(512),
|
|
22080
|
+
path: external_exports.string().min(1).max(8192),
|
|
22081
|
+
kind: external_exports.literal("directory")
|
|
22082
|
+
});
|
|
22083
|
+
var remotePeerListDirsParamsSchema = external_exports.object({
|
|
22084
|
+
peerId: remotePeerIdSchema,
|
|
22085
|
+
path: external_exports.string().min(1).max(8192).optional()
|
|
22086
|
+
});
|
|
22087
|
+
var remotePeerListDirsResultSchema = external_exports.object({
|
|
22088
|
+
path: external_exports.string().min(1).max(8192),
|
|
22089
|
+
parentPath: external_exports.string().min(1).max(8192).nullable(),
|
|
22090
|
+
homeDir: external_exports.string().min(1).max(8192).optional(),
|
|
22091
|
+
entries: external_exports.array(remotePeerDirectoryEntrySchema)
|
|
22092
|
+
});
|
|
22093
|
+
var remotePeerCreateDirParamsSchema = external_exports.object({
|
|
22094
|
+
peerId: remotePeerIdSchema,
|
|
22095
|
+
parentPath: external_exports.string().min(1).max(8192),
|
|
22096
|
+
name: external_exports.string().min(1).max(255).refine((value) => value.trim().length > 0, "Directory name cannot be blank")
|
|
22097
|
+
});
|
|
22098
|
+
var remotePeerCreateDirResultSchema = external_exports.object({
|
|
22099
|
+
path: external_exports.string().min(1).max(8192),
|
|
22100
|
+
name: external_exports.string().min(1).max(255)
|
|
22101
|
+
});
|
|
22102
|
+
var remotePeerCreateWorkspaceParamsSchema = external_exports.object({
|
|
22103
|
+
peerId: remotePeerIdSchema,
|
|
22104
|
+
path: external_exports.string().min(1).max(8192),
|
|
22105
|
+
title: external_exports.string().trim().min(1).max(255).optional()
|
|
22106
|
+
});
|
|
22107
|
+
var remotePeerRenameWorkspaceParamsSchema = external_exports.object({
|
|
22108
|
+
peerId: remotePeerIdSchema,
|
|
22109
|
+
workspaceId: external_exports.string().min(1).max(1024),
|
|
22110
|
+
title: external_exports.string().trim().min(1).max(255)
|
|
22111
|
+
});
|
|
22112
|
+
var remotePeerDeleteWorkspaceParamsSchema = external_exports.object({
|
|
22113
|
+
peerId: remotePeerIdSchema,
|
|
22114
|
+
workspaceId: external_exports.string().min(1).max(1024)
|
|
22115
|
+
});
|
|
22116
|
+
var remotePeerWorkspaceMutationResultSchema = external_exports.object({
|
|
22117
|
+
workspaceId: external_exports.string().min(1).max(1024).optional(),
|
|
22118
|
+
manifest: remotePeerManifestSchema
|
|
22119
|
+
});
|
|
22120
|
+
var delegationRemoteHostsParamsSchema = external_exports.object({
|
|
22121
|
+
sessionHostId: external_exports.string().min(1).max(128).optional()
|
|
22122
|
+
});
|
|
22123
|
+
var delegationRemoteHostOptionSchema = external_exports.object({
|
|
22124
|
+
hostId: external_exports.union([external_exports.literal("local"), remotePeerHostIdSchema]),
|
|
22125
|
+
name: external_exports.string().min(1).max(120),
|
|
22126
|
+
isLocal: external_exports.boolean().optional(),
|
|
22127
|
+
color: remotePeerColorSchema.optional(),
|
|
22128
|
+
hostname: external_exports.string().max(255).optional()
|
|
22129
|
+
});
|
|
22130
|
+
var delegationRemoteHostsResultSchema = external_exports.object({
|
|
22131
|
+
hosts: external_exports.array(delegationRemoteHostOptionSchema)
|
|
22132
|
+
});
|
|
22133
|
+
var delegationHostHarnessesParamsSchema = external_exports.object({
|
|
22134
|
+
hostId: external_exports.union([external_exports.literal("local"), remotePeerHostIdSchema])
|
|
22135
|
+
});
|
|
22136
|
+
var delegationHostHarnessOptionSchema = external_exports.object({
|
|
22137
|
+
id: external_exports.string().regex(/^[a-z0-9][a-z0-9-]*$/u),
|
|
22138
|
+
name: external_exports.string().min(1).max(120)
|
|
22139
|
+
});
|
|
22140
|
+
var delegationHostHarnessesResultSchema = external_exports.object({
|
|
22141
|
+
harnesses: external_exports.array(delegationHostHarnessOptionSchema)
|
|
22142
|
+
});
|
|
22143
|
+
|
|
22144
|
+
// ../shared-contracts/dist/peer-delegation.js
|
|
22145
|
+
var PEER_DELEGATION_BRIDGE_VERSION = 1;
|
|
22146
|
+
var PEER_DELEGATION_OPERATIONS = [
|
|
22147
|
+
"listHarnesses",
|
|
22148
|
+
"inspect",
|
|
22149
|
+
"start",
|
|
22150
|
+
"send",
|
|
22151
|
+
"cancel",
|
|
22152
|
+
"read",
|
|
22153
|
+
"answer",
|
|
22154
|
+
"list"
|
|
22155
|
+
];
|
|
22156
|
+
var peerDelegationOperationSchema = external_exports.enum(PEER_DELEGATION_OPERATIONS);
|
|
22157
|
+
var peerDelegationRequestSchema = external_exports.strictObject({
|
|
22158
|
+
operation: peerDelegationOperationSchema,
|
|
22159
|
+
hopCount: external_exports.number().int().min(0).max(16),
|
|
22160
|
+
/** Opaque A-side peer pairing identifier used by B to scope implicit deduplication per Peer. */
|
|
22161
|
+
sourceId: remotePeerIdSchema.optional(),
|
|
22162
|
+
input: jsonObjectSchema
|
|
22163
|
+
});
|
|
22164
|
+
var peerDelegationErrorSchema = external_exports.strictObject({
|
|
22165
|
+
code: external_exports.string().min(1).max(128),
|
|
22166
|
+
message: external_exports.string().max(4096),
|
|
22167
|
+
details: jsonObjectSchema.optional()
|
|
22168
|
+
});
|
|
22169
|
+
var peerDelegationResponseSchema = external_exports.union([
|
|
22170
|
+
external_exports.strictObject({
|
|
22171
|
+
ok: external_exports.literal(true),
|
|
22172
|
+
value: jsonValueSchema
|
|
22173
|
+
}),
|
|
22174
|
+
external_exports.strictObject({
|
|
22175
|
+
ok: external_exports.literal(false),
|
|
22176
|
+
error: peerDelegationErrorSchema
|
|
22177
|
+
})
|
|
22178
|
+
]);
|
|
22179
|
+
var peerDelegationHostProjectSchema = external_exports.strictObject({
|
|
22180
|
+
id: external_exports.string().min(1).max(1024),
|
|
22181
|
+
name: external_exports.string().min(1).max(512),
|
|
22182
|
+
path: external_exports.string().min(1).max(8192)
|
|
22183
|
+
});
|
|
22184
|
+
var peerDelegationHostSummarySchema = external_exports.strictObject({
|
|
22185
|
+
hostId: remotePeerHostIdSchema,
|
|
22186
|
+
nodeId: remotePeerNodeIdSchema.optional(),
|
|
22187
|
+
displayName: external_exports.string().min(1).max(120),
|
|
22188
|
+
online: external_exports.boolean(),
|
|
22189
|
+
state: remotePeerStateSchema,
|
|
22190
|
+
delegation: external_exports.boolean(),
|
|
22191
|
+
projects: external_exports.array(peerDelegationHostProjectSchema),
|
|
22192
|
+
platform: external_exports.string().max(64).optional(),
|
|
22193
|
+
hostname: external_exports.string().max(255).optional(),
|
|
22194
|
+
homeDir: external_exports.string().max(4096).optional()
|
|
22195
|
+
});
|
|
22196
|
+
var peerDelegationHostsResultSchema = external_exports.strictObject({
|
|
22197
|
+
hosts: external_exports.array(peerDelegationHostSummarySchema)
|
|
22198
|
+
});
|
|
22199
|
+
var peerDelegationBridgeDescriptorSchema = external_exports.strictObject({
|
|
22200
|
+
version: external_exports.literal(PEER_DELEGATION_BRIDGE_VERSION),
|
|
22201
|
+
instanceId: external_exports.string().min(1).max(128),
|
|
22202
|
+
pid: external_exports.number().int().positive(),
|
|
22203
|
+
endpoint: external_exports.string().min(1).max(256),
|
|
22204
|
+
token: external_exports.string().regex(/^[0-9a-f]{64}$/u),
|
|
22205
|
+
startedAt: external_exports.number().int().nonnegative()
|
|
22206
|
+
});
|
|
22207
|
+
var peerDelegationBridgeRequestSchema = external_exports.union([
|
|
22208
|
+
external_exports.strictObject({
|
|
22209
|
+
operation: external_exports.literal("hosts")
|
|
22210
|
+
}),
|
|
22211
|
+
external_exports.strictObject({
|
|
22212
|
+
operation: peerDelegationOperationSchema,
|
|
22213
|
+
hostId: remotePeerHostIdSchema,
|
|
22214
|
+
hopCount: external_exports.number().int().min(0).max(16),
|
|
22215
|
+
timeoutMs: external_exports.number().int().min(1).max(12e4).optional(),
|
|
22216
|
+
input: jsonObjectSchema
|
|
22217
|
+
})
|
|
22218
|
+
]);
|
|
22219
|
+
|
|
21796
22220
|
// ../shared-contracts/dist/credential-imports.js
|
|
21797
22221
|
var credentialSourceSchema = external_exports.object({
|
|
21798
22222
|
id: external_exports.string().min(1).max(256),
|
|
@@ -22589,7 +23013,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
22589
23013
|
|
|
22590
23014
|
// ../shared-contracts/dist/codex-accounts.js
|
|
22591
23015
|
var accountIdSchema = external_exports.string().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u);
|
|
22592
|
-
var
|
|
23016
|
+
var nonBlankTextSchema4 = external_exports.string().trim().min(1);
|
|
22593
23017
|
var codexAccountPlanTypeSchema = external_exports.enum([
|
|
22594
23018
|
"free",
|
|
22595
23019
|
"go",
|
|
@@ -22611,7 +23035,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
22611
23035
|
]);
|
|
22612
23036
|
var codexAccountSchema = external_exports.object({
|
|
22613
23037
|
accountId: accountIdSchema,
|
|
22614
|
-
label:
|
|
23038
|
+
label: nonBlankTextSchema4.max(256),
|
|
22615
23039
|
email: external_exports.string().email().max(320).optional(),
|
|
22616
23040
|
planType: codexAccountPlanTypeSchema.optional()
|
|
22617
23041
|
}).strict();
|
|
@@ -22621,7 +23045,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
22621
23045
|
currentAccountId: accountIdSchema.nullable(),
|
|
22622
23046
|
phase: codexAccountPhaseSchema,
|
|
22623
23047
|
revision: external_exports.number().int().nonnegative(),
|
|
22624
|
-
instanceId:
|
|
23048
|
+
instanceId: nonBlankTextSchema4.max(1024).optional(),
|
|
22625
23049
|
accounts: external_exports.array(codexAccountSchema).max(1)
|
|
22626
23050
|
}).strict();
|
|
22627
23051
|
var codexAccountChangedSchema = codexAccountListResultSchema;
|
|
@@ -22644,13 +23068,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
22644
23068
|
var HARNESS_SESSION_IMPORT_LIST_MAX_LENGTH = 1e3;
|
|
22645
23069
|
var HARNESS_SESSION_IMPORT_DEFAULT_PAGE_SIZE = 20;
|
|
22646
23070
|
var HARNESS_SESSION_IMPORT_UPDATED_AT_MAX = 864e13;
|
|
22647
|
-
var
|
|
22648
|
-
var harnessSessionImportIdSchema =
|
|
23071
|
+
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");
|
|
23072
|
+
var harnessSessionImportIdSchema = nonBlankTextSchema5.max(HARNESS_SESSION_IMPORT_ID_MAX_LENGTH);
|
|
22649
23073
|
var harnessSessionImportCandidateSchema = external_exports.object({
|
|
22650
23074
|
nativeSessionId: harnessSessionImportIdSchema,
|
|
22651
|
-
title:
|
|
23075
|
+
title: nonBlankTextSchema5.max(HARNESS_SESSION_IMPORT_TITLE_MAX_LENGTH).nullable(),
|
|
22652
23076
|
updatedAt: external_exports.number().int().nonnegative().max(HARNESS_SESSION_IMPORT_UPDATED_AT_MAX),
|
|
22653
|
-
cwd:
|
|
23077
|
+
cwd: nonBlankTextSchema5.max(HARNESS_SESSION_IMPORT_CWD_MAX_LENGTH),
|
|
22654
23078
|
// Native file discovery cannot reliably observe another process's activity.
|
|
22655
23079
|
running: external_exports.boolean().nullable()
|
|
22656
23080
|
}).strict();
|
|
@@ -22658,7 +23082,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
22658
23082
|
var harnessSessionImportSourcesResultSchema = external_exports.object({
|
|
22659
23083
|
harnesses: external_exports.array(external_exports.object({
|
|
22660
23084
|
harnessId: harnessPluginIdSchema,
|
|
22661
|
-
name:
|
|
23085
|
+
name: nonBlankTextSchema5.max(128)
|
|
22662
23086
|
}).strict()).max(128)
|
|
22663
23087
|
}).strict();
|
|
22664
23088
|
var harnessSessionListParamsSchema = external_exports.object({
|
|
@@ -22676,13 +23100,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
22676
23100
|
nativeSessionId: harnessSessionImportIdSchema
|
|
22677
23101
|
}).strict();
|
|
22678
23102
|
var harnessSessionImportResultSchema = external_exports.object({
|
|
22679
|
-
threadId:
|
|
23103
|
+
threadId: nonBlankTextSchema5.max(1024).pipe(hostThreadIdSchema)
|
|
22680
23104
|
}).strict();
|
|
22681
23105
|
|
|
22682
23106
|
// ../shared-contracts/dist/deepseek-modern-sessions.js
|
|
22683
23107
|
var DEEPSEEK_MODERN_SESSION_LIST_MAX_LENGTH = HARNESS_SESSION_IMPORT_LIST_MAX_LENGTH;
|
|
22684
23108
|
var DEEPSEEK_MODERN_HOST_THREAD_ID_MAX_LENGTH = 1024;
|
|
22685
|
-
var
|
|
23109
|
+
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
23110
|
var deepSeekModernSessionIdSchema = harnessSessionImportIdSchema;
|
|
22687
23111
|
var deepSeekModernSessionCandidateSchema = harnessSessionImportCandidateSchema;
|
|
22688
23112
|
var deepSeekModernSessionListParamsSchema = external_exports.object({}).strict();
|
|
@@ -22693,7 +23117,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
22693
23117
|
nativeSessionId: deepSeekModernSessionIdSchema
|
|
22694
23118
|
}).strict();
|
|
22695
23119
|
var deepSeekModernSessionImportResultSchema = external_exports.object({
|
|
22696
|
-
threadId:
|
|
23120
|
+
threadId: nonBlankTextSchema6.max(DEEPSEEK_MODERN_HOST_THREAD_ID_MAX_LENGTH).pipe(hostThreadIdSchema)
|
|
22697
23121
|
}).strict();
|
|
22698
23122
|
|
|
22699
23123
|
// ../shared-contracts/dist/external-thread-fork.js
|
|
@@ -22728,9 +23152,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
22728
23152
|
/** Partial discovery failures; valid commands remain available. */
|
|
22729
23153
|
warnings: external_exports.array(external_exports.string().min(1)).optional(),
|
|
22730
23154
|
/**
|
|
22731
|
-
* `live` when
|
|
22732
|
-
* workspace (
|
|
22733
|
-
*
|
|
23155
|
+
* `live` when a native Session has reported its live catalog for the
|
|
23156
|
+
* workspace (even when filtering leaves only built-ins); `static` for
|
|
23157
|
+
* Adapter built-ins only before live commands arrive. Adapters may set
|
|
23158
|
+
* `live` once their Session's live catalog has loaded.
|
|
22734
23159
|
*/
|
|
22735
23160
|
source: external_exports.enum(["live", "static"]).optional()
|
|
22736
23161
|
}).strict().superRefine((catalog, context2) => {
|
|
@@ -22857,6 +23282,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
22857
23282
|
"succeeded",
|
|
22858
23283
|
"failed"
|
|
22859
23284
|
]);
|
|
23285
|
+
var npmDownloadProgressSchema = external_exports.strictObject({
|
|
23286
|
+
completed: external_exports.number().int().nonnegative(),
|
|
23287
|
+
total: external_exports.number().int().positive()
|
|
23288
|
+
}).refine((progress) => progress.completed <= progress.total, {
|
|
23289
|
+
path: ["completed"],
|
|
23290
|
+
message: "completed must not exceed total"
|
|
23291
|
+
});
|
|
22860
23292
|
var updateStatusSchema = external_exports.strictObject({
|
|
22861
23293
|
version: updateSemanticVersionSchema,
|
|
22862
23294
|
installation: updateInstallationSchema,
|
|
@@ -22864,6 +23296,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
22864
23296
|
updatedAt: external_exports.number().int().nonnegative(),
|
|
22865
23297
|
downloadedBytes: external_exports.number().int().nonnegative().optional(),
|
|
22866
23298
|
totalBytes: external_exports.number().int().positive().optional(),
|
|
23299
|
+
npmDownload: npmDownloadProgressSchema.optional(),
|
|
22867
23300
|
error: external_exports.string().min(1).max(UPDATE_ERROR_MAX_LENGTH).nullable(),
|
|
22868
23301
|
serviceStopOutput: external_exports.string().optional()
|
|
22869
23302
|
}).superRefine((status, context2) => {
|
|
@@ -22931,19 +23364,37 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
22931
23364
|
|
|
22932
23365
|
// ../shared-contracts/dist/delegation-mention.js
|
|
22933
23366
|
var DELEGATION_MENTION_PATH_PREFIX = "subagent://codexhost.";
|
|
23367
|
+
var REMOTE_DELEGATION_MENTION_PATH_PREFIX = "subagent://codexhost-remote/";
|
|
22934
23368
|
var HARNESS_ID_PATTERN = /^[a-z0-9][a-z0-9-]*$/u;
|
|
23369
|
+
var DELEGATION_HOST_ID_PATTERN = /^(?:local|remote-peer:[a-zA-Z0-9_-]{1,64})$/u;
|
|
22935
23370
|
function delegationMentionPath(harnessId) {
|
|
22936
23371
|
if (!HARNESS_ID_PATTERN.test(harnessId)) {
|
|
22937
23372
|
throw new Error(`Invalid delegation mention Harness id: ${harnessId}`);
|
|
22938
23373
|
}
|
|
22939
23374
|
return `${DELEGATION_MENTION_PATH_PREFIX}${harnessId}`;
|
|
22940
23375
|
}
|
|
23376
|
+
function remoteDelegationMentionPath(hostId2, harnessId) {
|
|
23377
|
+
if (!DELEGATION_HOST_ID_PATTERN.test(hostId2)) {
|
|
23378
|
+
throw new Error(`Invalid delegation mention Host id: ${hostId2}`);
|
|
23379
|
+
}
|
|
23380
|
+
if (harnessId !== void 0 && !HARNESS_ID_PATTERN.test(harnessId)) {
|
|
23381
|
+
throw new Error(`Invalid delegation mention Harness id: ${harnessId}`);
|
|
23382
|
+
}
|
|
23383
|
+
const encodedHost = encodeURIComponent(hostId2);
|
|
23384
|
+
return harnessId === void 0 ? `${REMOTE_DELEGATION_MENTION_PATH_PREFIX}${encodedHost}` : `${REMOTE_DELEGATION_MENTION_PATH_PREFIX}${encodedHost}/${harnessId}`;
|
|
23385
|
+
}
|
|
22941
23386
|
function sanitizeLabel(label) {
|
|
22942
23387
|
const cleaned = label.replace(/[[\]()\n\r]+/gu, " ").replace(/\s+/gu, " ").trim();
|
|
22943
23388
|
return cleaned.length > 0 ? cleaned : "agent";
|
|
22944
23389
|
}
|
|
22945
23390
|
function formatDelegationMentionLink(mention) {
|
|
22946
|
-
|
|
23391
|
+
const path = mention.hostId !== void 0 ? remoteDelegationMentionPath(mention.hostId, mention.harnessId) : (() => {
|
|
23392
|
+
if (mention.harnessId === void 0) {
|
|
23393
|
+
throw new Error("Delegation mention requires harnessId or hostId");
|
|
23394
|
+
}
|
|
23395
|
+
return delegationMentionPath(mention.harnessId);
|
|
23396
|
+
})();
|
|
23397
|
+
return `[@${sanitizeLabel(mention.label)}](${path})`;
|
|
22947
23398
|
}
|
|
22948
23399
|
var HARNESS_COMMAND_MENTION_PATH_PREFIX = "subagent://codexhost-command.";
|
|
22949
23400
|
function harnessCommandMentionPath(invocation) {
|
|
@@ -23124,7 +23575,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
23124
23575
|
kind: external_exports.literal("start"),
|
|
23125
23576
|
itemId: identity,
|
|
23126
23577
|
onlyIfHead: external_exports.literal(true).optional()
|
|
23127
|
-
})
|
|
23578
|
+
}),
|
|
23579
|
+
external_exports.strictObject({ kind: external_exports.literal("sendNow"), itemId: identity })
|
|
23128
23580
|
])
|
|
23129
23581
|
}),
|
|
23130
23582
|
external_exports.strictObject({ kind: external_exports.literal("interrupt"), ...thread, epoch: identity, turnId: identity }),
|
|
@@ -23239,206 +23691,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
23239
23691
|
var webUiExtensionEnabledSchema = external_exports.object({ id: webUiExtensionIdSchema, enabled: external_exports.boolean() }).strict();
|
|
23240
23692
|
var webUiExtensionRemoveSchema = external_exports.object({ id: webUiExtensionIdSchema }).strict();
|
|
23241
23693
|
|
|
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
23694
|
// ../shared-contracts/dist/index.js
|
|
23443
23695
|
var workspaceContractVersionSchema = external_exports.literal(WORKSPACE_CONTRACT_VERSION);
|
|
23444
23696
|
|
|
@@ -25353,7 +25605,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
25353
25605
|
|
|
25354
25606
|
// src/renderer-composer-kind.ts
|
|
25355
25607
|
function orbitComposerKind(composer) {
|
|
25356
|
-
let element = composer.querySelector('[contenteditable="true"], textarea, [role="textbox"]') ?? composer;
|
|
25608
|
+
let element = (typeof composer.querySelector === "function" ? composer.querySelector('[contenteditable="true"], textarea, [role="textbox"]') : null) ?? composer;
|
|
25357
25609
|
for (let depth = 0; element && depth < 12; depth += 1) {
|
|
25358
25610
|
const key2 = Object.getOwnPropertyNames(element).find(
|
|
25359
25611
|
(name) => name.startsWith("__reactFiber$")
|
|
@@ -25585,6 +25837,756 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
25585
25837
|
return fallback;
|
|
25586
25838
|
}
|
|
25587
25839
|
|
|
25840
|
+
// src/renderer-harness-localization.ts
|
|
25841
|
+
var ENGLISH_HARNESS_MESSAGES = Object.freeze({
|
|
25842
|
+
commands: "Commands",
|
|
25843
|
+
harnessCommands: "Harness commands",
|
|
25844
|
+
commandsUnavailable: "No Harness commands available yet",
|
|
25845
|
+
commandRequiresConversation: "Start a conversation before running this command",
|
|
25846
|
+
commandMenuHint: "Type # for commands, skills and agents",
|
|
25847
|
+
textArgument: "Text",
|
|
25848
|
+
permissionMode: "Permission mode",
|
|
25849
|
+
permissions: "Permissions",
|
|
25850
|
+
loadingPermissions: "Loading permissions...",
|
|
25851
|
+
selecting: "Selecting...",
|
|
25852
|
+
permissionsUnavailable: "Permissions unavailable",
|
|
25853
|
+
permissionModeFixedAtCreate: "This Permission Mode is fixed when the Session is created. Start a new Thread to change it.",
|
|
25854
|
+
codexUsageGateUnavailable: "Could not separate this Harness from the Codex usage limit in this Desktop version. Codex usage limits still apply to sending.",
|
|
25855
|
+
modelMenuTitle: "Model",
|
|
25856
|
+
refreshModels: "Refresh models",
|
|
25857
|
+
modelSelectionRejected: "Couldn't switch Model",
|
|
25858
|
+
thinkingSelectionRejected: "Couldn't switch Thinking option",
|
|
25859
|
+
handoffAction: "Handoff context",
|
|
25860
|
+
handoffTitle: "Context handoff",
|
|
25861
|
+
handoffTargetHarnessLabel: "Target Harness",
|
|
25862
|
+
handoffTargetModelLabel: "Model (optional)",
|
|
25863
|
+
handoffDefaultModelOption: "Default model",
|
|
25864
|
+
handoffTargetThinkingLabel: "Thinking (optional)",
|
|
25865
|
+
handoffDefaultThinkingOption: "Default thinking",
|
|
25866
|
+
handoffLoadingModels: "Loading models\u2026",
|
|
25867
|
+
handoffConfirm: "Handoff",
|
|
25868
|
+
handoffSubmitting: "Handing off\u2026",
|
|
25869
|
+
handoffCancel: "Cancel",
|
|
25870
|
+
handoffOpenSourceThread: "Open source thread",
|
|
25871
|
+
handoffPreviewLabel: "Context preview",
|
|
25872
|
+
handoffFailed: "Context handoff failed"
|
|
25873
|
+
});
|
|
25874
|
+
var CHINESE_HARNESS_MESSAGES = Object.freeze({
|
|
25875
|
+
commands: "\u547D\u4EE4",
|
|
25876
|
+
harnessCommands: "Harness \u547D\u4EE4",
|
|
25877
|
+
commandsUnavailable: "\u6682\u65E0\u53EF\u7528\u7684 Harness \u547D\u4EE4",
|
|
25878
|
+
commandRequiresConversation: "\u8BF7\u5148\u5F00\u59CB\u5BF9\u8BDD\uFF0C\u518D\u6267\u884C\u6B64\u547D\u4EE4",
|
|
25879
|
+
commandMenuHint: "\u8F93\u5165 # \u6253\u5F00\u547D\u4EE4\u3001\u6280\u80FD\u548C Agent",
|
|
25880
|
+
textArgument: "\u6587\u672C",
|
|
25881
|
+
permissionMode: "\u6743\u9650\u6A21\u5F0F",
|
|
25882
|
+
permissions: "\u6743\u9650",
|
|
25883
|
+
loadingPermissions: "\u6B63\u5728\u52A0\u8F7D\u6743\u9650...",
|
|
25884
|
+
selecting: "\u6B63\u5728\u9009\u62E9...",
|
|
25885
|
+
permissionsUnavailable: "\u6743\u9650\u4E0D\u53EF\u7528",
|
|
25886
|
+
permissionModeFixedAtCreate: "\u6B64\u6743\u9650\u6A21\u5F0F\u5728\u4F1A\u8BDD\u521B\u5EFA\u65F6\u786E\u5B9A\uFF0C\u5982\u9700\u66F4\u6539\u8BF7\u65B0\u5EFA\u4F1A\u8BDD",
|
|
25887
|
+
codexUsageGateUnavailable: "\u5F53\u524D Desktop \u7248\u672C\u65E0\u6CD5\u5C06\u6B64 Harness \u4E0E Codex \u989D\u5EA6\u9650\u5236\u5206\u79BB\uFF0C\u53D1\u9001\u4ECD\u53D7 Codex \u989D\u5EA6\u9650\u5236",
|
|
25888
|
+
modelMenuTitle: "\u6A21\u578B",
|
|
25889
|
+
refreshModels: "\u5237\u65B0\u6A21\u578B\u5217\u8868",
|
|
25890
|
+
modelSelectionRejected: "\u65E0\u6CD5\u5207\u6362\u6A21\u578B",
|
|
25891
|
+
thinkingSelectionRejected: "\u65E0\u6CD5\u5207\u6362\u601D\u8003\u9009\u9879",
|
|
25892
|
+
handoffAction: "\u4E0A\u4E0B\u6587\u4EA4\u63A5",
|
|
25893
|
+
handoffTitle: "\u4E0A\u4E0B\u6587\u4EA4\u63A5",
|
|
25894
|
+
handoffTargetHarnessLabel: "\u76EE\u6807 Harness",
|
|
25895
|
+
handoffTargetModelLabel: "\u6A21\u578B\uFF08\u53EF\u9009\uFF09",
|
|
25896
|
+
handoffDefaultModelOption: "\u9ED8\u8BA4\u6A21\u578B",
|
|
25897
|
+
handoffTargetThinkingLabel: "\u601D\u8003\u6863\u4F4D\uFF08\u53EF\u9009\uFF09",
|
|
25898
|
+
handoffDefaultThinkingOption: "\u9ED8\u8BA4\u601D\u8003\u6863\u4F4D",
|
|
25899
|
+
handoffLoadingModels: "\u6B63\u5728\u52A0\u8F7D\u6A21\u578B\u2026",
|
|
25900
|
+
handoffConfirm: "\u786E\u8BA4\u4EA4\u63A5",
|
|
25901
|
+
handoffSubmitting: "\u6B63\u5728\u4EA4\u63A5\u2026",
|
|
25902
|
+
handoffCancel: "\u53D6\u6D88",
|
|
25903
|
+
handoffOpenSourceThread: "\u8DF3\u56DE\u6E90\u4F1A\u8BDD",
|
|
25904
|
+
handoffPreviewLabel: "\u4EA4\u63A5\u4E0A\u4E0B\u6587\u9884\u89C8",
|
|
25905
|
+
handoffFailed: "\u4E0A\u4E0B\u6587\u4EA4\u63A5\u5931\u8D25"
|
|
25906
|
+
});
|
|
25907
|
+
function rendererHarnessMessages(locale) {
|
|
25908
|
+
return locale === "zh-CN" ? CHINESE_HARNESS_MESSAGES : ENGLISH_HARNESS_MESSAGES;
|
|
25909
|
+
}
|
|
25910
|
+
function rendererHarnessCommandPresentation(command, locale) {
|
|
25911
|
+
const presentation = localizeHarnessPresentation(command, locale);
|
|
25912
|
+
return { ...presentation, description: presentation.description ?? presentation.label };
|
|
25913
|
+
}
|
|
25914
|
+
function rendererPermissionModePresentation(mode, locale) {
|
|
25915
|
+
return localizeHarnessPresentation(mode, locale);
|
|
25916
|
+
}
|
|
25917
|
+
function rendererLiveCommandsPendingNotice(locale, harnessLabel) {
|
|
25918
|
+
const harness2 = harnessLabel.replace(/\s*[((][^))]*[))]\s*$/u, "").trim() || harnessLabel;
|
|
25919
|
+
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`;
|
|
25920
|
+
}
|
|
25921
|
+
function formatRendererHandoffTurnsSummary(locale, input3) {
|
|
25922
|
+
if (locale === "zh-CN") {
|
|
25923
|
+
if (input3.omittedTurns > 0) {
|
|
25924
|
+
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`;
|
|
25925
|
+
}
|
|
25926
|
+
if (input3.boundaryTurnNumber < input3.totalTurns) {
|
|
25927
|
+
return `\u5DF2\u643A\u5E26\u524D ${input3.boundaryTurnNumber} / ${input3.totalTurns} \u8F6E\u4E0A\u4E0B\u6587`;
|
|
25928
|
+
}
|
|
25929
|
+
return `\u5DF2\u643A\u5E26\u5168\u90E8 ${input3.totalTurns} \u8F6E\u4E0A\u4E0B\u6587`;
|
|
25930
|
+
}
|
|
25931
|
+
if (input3.omittedTurns > 0) {
|
|
25932
|
+
return `Carried ${input3.includedCount} of ${input3.totalTurns} turns (${input3.omittedTurns} omitted, up to turn ${input3.boundaryTurnNumber})`;
|
|
25933
|
+
}
|
|
25934
|
+
if (input3.boundaryTurnNumber < input3.totalTurns) {
|
|
25935
|
+
return `Carried first ${input3.boundaryTurnNumber} of ${input3.totalTurns} turns`;
|
|
25936
|
+
}
|
|
25937
|
+
return `Carried all ${input3.totalTurns} turns`;
|
|
25938
|
+
}
|
|
25939
|
+
|
|
25940
|
+
// src/renderer-handoff-view.ts
|
|
25941
|
+
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
25942
|
+
var STYLE_ATTRIBUTE = "data-codexhost-handoff-style";
|
|
25943
|
+
var HANDOFF_POPOVER_WIDTH = 316;
|
|
25944
|
+
var HANDOFF_CONTROL_ATTRIBUTE = "data-codexhost-handoff-control";
|
|
25945
|
+
var HANDOFF_DIVIDER_ATTRIBUTE = "data-codexhost-handoff-divider";
|
|
25946
|
+
var HANDOFF_POPOVER_ATTRIBUTE = "data-codexhost-handoff-popover";
|
|
25947
|
+
function createSwapIcon(ownerDocument, size = 14) {
|
|
25948
|
+
const svg2 = ownerDocument.createElementNS(SVG_NS, "svg");
|
|
25949
|
+
svg2.setAttribute("viewBox", "0 0 16 16");
|
|
25950
|
+
svg2.setAttribute("width", String(size));
|
|
25951
|
+
svg2.setAttribute("height", String(size));
|
|
25952
|
+
svg2.setAttribute("fill", "none");
|
|
25953
|
+
svg2.setAttribute("stroke", "currentColor");
|
|
25954
|
+
svg2.setAttribute("stroke-width", "1.45");
|
|
25955
|
+
svg2.setAttribute("stroke-linecap", "round");
|
|
25956
|
+
svg2.setAttribute("stroke-linejoin", "round");
|
|
25957
|
+
svg2.setAttribute("aria-hidden", "true");
|
|
25958
|
+
svg2.style.flex = "none";
|
|
25959
|
+
for (const d of [
|
|
25960
|
+
"M2.75 5.25H13.25",
|
|
25961
|
+
"M10.75 2.75L13.25 5.25L10.75 7.75",
|
|
25962
|
+
"M13.25 10.75H2.75",
|
|
25963
|
+
"M5.25 8.25L2.75 10.75L5.25 13.25"
|
|
25964
|
+
]) {
|
|
25965
|
+
const path = ownerDocument.createElementNS(SVG_NS, "path");
|
|
25966
|
+
path.setAttribute("d", d);
|
|
25967
|
+
svg2.append(path);
|
|
25968
|
+
}
|
|
25969
|
+
return svg2;
|
|
25970
|
+
}
|
|
25971
|
+
function createChevronIcon(ownerDocument) {
|
|
25972
|
+
const svg2 = ownerDocument.createElementNS(SVG_NS, "svg");
|
|
25973
|
+
svg2.setAttribute("viewBox", "0 0 16 16");
|
|
25974
|
+
svg2.setAttribute("width", "12");
|
|
25975
|
+
svg2.setAttribute("height", "12");
|
|
25976
|
+
svg2.setAttribute("fill", "none");
|
|
25977
|
+
svg2.setAttribute("stroke", "currentColor");
|
|
25978
|
+
svg2.setAttribute("stroke-width", "1.6");
|
|
25979
|
+
svg2.setAttribute("stroke-linecap", "round");
|
|
25980
|
+
svg2.setAttribute("stroke-linejoin", "round");
|
|
25981
|
+
svg2.setAttribute("aria-hidden", "true");
|
|
25982
|
+
svg2.classList.add("codexhost-handoff-divider-chevron");
|
|
25983
|
+
const path = ownerDocument.createElementNS(SVG_NS, "path");
|
|
25984
|
+
path.setAttribute("d", "M4.5 6.25L8 9.75L11.5 6.25");
|
|
25985
|
+
svg2.append(path);
|
|
25986
|
+
return svg2;
|
|
25987
|
+
}
|
|
25988
|
+
function createCheckIcon(ownerDocument) {
|
|
25989
|
+
const svg2 = ownerDocument.createElementNS(SVG_NS, "svg");
|
|
25990
|
+
svg2.setAttribute("viewBox", "0 0 16 16");
|
|
25991
|
+
svg2.setAttribute("width", "14");
|
|
25992
|
+
svg2.setAttribute("height", "14");
|
|
25993
|
+
svg2.setAttribute("fill", "none");
|
|
25994
|
+
svg2.setAttribute("stroke", "currentColor");
|
|
25995
|
+
svg2.setAttribute("stroke-width", "1.8");
|
|
25996
|
+
svg2.setAttribute("stroke-linecap", "round");
|
|
25997
|
+
svg2.setAttribute("stroke-linejoin", "round");
|
|
25998
|
+
svg2.setAttribute("aria-hidden", "true");
|
|
25999
|
+
svg2.style.flex = "none";
|
|
26000
|
+
const path = ownerDocument.createElementNS(SVG_NS, "path");
|
|
26001
|
+
path.setAttribute("d", "M3.5 8.5L6.5 11.5L12.5 4.75");
|
|
26002
|
+
svg2.append(path);
|
|
26003
|
+
return svg2;
|
|
26004
|
+
}
|
|
26005
|
+
function formatEndpointLabel(harnessId, harnessLabel, model2, plugin) {
|
|
26006
|
+
const base = harnessLabel?.trim() || rendererAgentLabel(harnessId, plugin);
|
|
26007
|
+
const trimmedModel = model2?.trim();
|
|
26008
|
+
if (!trimmedModel) return base;
|
|
26009
|
+
if (base.toLowerCase().includes(trimmedModel.toLowerCase())) return base;
|
|
26010
|
+
return `${base} (${trimmedModel})`;
|
|
26011
|
+
}
|
|
26012
|
+
function ensureRendererHandoffStyle(ownerDocument) {
|
|
26013
|
+
if (ownerDocument.querySelector(`style[${STYLE_ATTRIBUTE}]`)) return;
|
|
26014
|
+
const style2 = ownerDocument.createElement("style");
|
|
26015
|
+
style2.setAttribute(STYLE_ATTRIBUTE, "true");
|
|
26016
|
+
style2.textContent = `
|
|
26017
|
+
[${HANDOFF_CONTROL_ATTRIBUTE}] {
|
|
26018
|
+
display: inline-flex;
|
|
26019
|
+
align-items: center;
|
|
26020
|
+
align-self: center;
|
|
26021
|
+
flex: 0 0 auto;
|
|
26022
|
+
margin-inline-end: 2px;
|
|
26023
|
+
color: inherit;
|
|
26024
|
+
}
|
|
26025
|
+
[${HANDOFF_DIVIDER_ATTRIBUTE}] {
|
|
26026
|
+
display: block;
|
|
26027
|
+
width: 100%;
|
|
26028
|
+
max-width: 780px;
|
|
26029
|
+
margin: 14px auto 16px;
|
|
26030
|
+
padding: 0 12px;
|
|
26031
|
+
box-sizing: border-box;
|
|
26032
|
+
color-scheme: inherit;
|
|
26033
|
+
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
26034
|
+
}
|
|
26035
|
+
.codexhost-handoff-divider-row {
|
|
26036
|
+
display: flex;
|
|
26037
|
+
align-items: center;
|
|
26038
|
+
gap: 12px;
|
|
26039
|
+
width: 100%;
|
|
26040
|
+
}
|
|
26041
|
+
.codexhost-handoff-divider-line {
|
|
26042
|
+
flex: 1 1 auto;
|
|
26043
|
+
min-width: 24px;
|
|
26044
|
+
height: 1px;
|
|
26045
|
+
background: light-dark(rgba(15, 23, 42, 0.1), rgba(255, 255, 255, 0.11));
|
|
26046
|
+
}
|
|
26047
|
+
.codexhost-handoff-divider-button {
|
|
26048
|
+
display: inline-flex;
|
|
26049
|
+
align-items: center;
|
|
26050
|
+
gap: 6px;
|
|
26051
|
+
max-width: min(100%, 640px);
|
|
26052
|
+
min-width: 0;
|
|
26053
|
+
padding: 4px 10px;
|
|
26054
|
+
border: 0;
|
|
26055
|
+
border-radius: 999px;
|
|
26056
|
+
background: transparent;
|
|
26057
|
+
color: light-dark(#6b7280, #9ca3af);
|
|
26058
|
+
font: 400 12.5px/1.35 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
26059
|
+
cursor: pointer;
|
|
26060
|
+
transition: background-color 120ms ease;
|
|
26061
|
+
}
|
|
26062
|
+
.codexhost-handoff-divider-button:hover,
|
|
26063
|
+
.codexhost-handoff-divider-button[aria-expanded="true"] {
|
|
26064
|
+
background: light-dark(rgba(15, 23, 42, 0.045), rgba(255, 255, 255, 0.07));
|
|
26065
|
+
}
|
|
26066
|
+
.codexhost-handoff-divider-button:focus-visible {
|
|
26067
|
+
outline: 2px solid light-dark(#3b82f6, #60a5fa);
|
|
26068
|
+
outline-offset: 2px;
|
|
26069
|
+
}
|
|
26070
|
+
.codexhost-handoff-divider-title {
|
|
26071
|
+
color: light-dark(#6b7280, #9ca3af);
|
|
26072
|
+
white-space: nowrap;
|
|
26073
|
+
flex: 0 0 auto;
|
|
26074
|
+
}
|
|
26075
|
+
.codexhost-handoff-endpoint {
|
|
26076
|
+
display: inline-flex;
|
|
26077
|
+
align-items: center;
|
|
26078
|
+
gap: 5px;
|
|
26079
|
+
min-width: 0;
|
|
26080
|
+
font-weight: 500;
|
|
26081
|
+
}
|
|
26082
|
+
.codexhost-handoff-endpoint--source {
|
|
26083
|
+
color: light-dark(#18181b, #ececec);
|
|
26084
|
+
}
|
|
26085
|
+
.codexhost-handoff-endpoint--target {
|
|
26086
|
+
color: light-dark(#4f79a8, #7cb3f0);
|
|
26087
|
+
}
|
|
26088
|
+
.codexhost-handoff-endpoint-text {
|
|
26089
|
+
overflow: hidden;
|
|
26090
|
+
text-overflow: ellipsis;
|
|
26091
|
+
white-space: nowrap;
|
|
26092
|
+
}
|
|
26093
|
+
.codexhost-handoff-divider-arrow {
|
|
26094
|
+
color: light-dark(#9ca3af, #6b7280);
|
|
26095
|
+
font-size: 12px;
|
|
26096
|
+
flex: 0 0 auto;
|
|
26097
|
+
}
|
|
26098
|
+
.codexhost-handoff-divider-chevron {
|
|
26099
|
+
opacity: 0.55;
|
|
26100
|
+
flex: 0 0 auto;
|
|
26101
|
+
transition: transform 140ms ease;
|
|
26102
|
+
}
|
|
26103
|
+
.codexhost-handoff-divider-button[aria-expanded="true"] .codexhost-handoff-divider-chevron {
|
|
26104
|
+
transform: rotate(180deg);
|
|
26105
|
+
}
|
|
26106
|
+
.codexhost-handoff-detail {
|
|
26107
|
+
margin: 8px auto 0;
|
|
26108
|
+
max-width: 680px;
|
|
26109
|
+
padding: 12px 14px;
|
|
26110
|
+
border-radius: 12px;
|
|
26111
|
+
border: 1px solid light-dark(rgba(15, 23, 42, 0.09), rgba(255, 255, 255, 0.1));
|
|
26112
|
+
background: light-dark(#f8f9fa, #1d1e22);
|
|
26113
|
+
color: light-dark(#18181b, #ececec);
|
|
26114
|
+
box-shadow: light-dark(0 4px 16px rgba(15, 23, 42, 0.05), 0 6px 20px rgba(0, 0, 0, 0.3));
|
|
26115
|
+
box-sizing: border-box;
|
|
26116
|
+
}
|
|
26117
|
+
.codexhost-handoff-detail[hidden] {
|
|
26118
|
+
display: none;
|
|
26119
|
+
}
|
|
26120
|
+
.codexhost-handoff-detail-header {
|
|
26121
|
+
display: flex;
|
|
26122
|
+
align-items: center;
|
|
26123
|
+
justify-content: space-between;
|
|
26124
|
+
gap: 10px;
|
|
26125
|
+
flex-wrap: wrap;
|
|
26126
|
+
}
|
|
26127
|
+
.codexhost-handoff-turns-summary {
|
|
26128
|
+
font-size: 12px;
|
|
26129
|
+
line-height: 1.45;
|
|
26130
|
+
color: light-dark(#52525b, #a1a1aa);
|
|
26131
|
+
}
|
|
26132
|
+
.codexhost-handoff-source-btn {
|
|
26133
|
+
display: inline-flex;
|
|
26134
|
+
align-items: center;
|
|
26135
|
+
gap: 4px;
|
|
26136
|
+
padding: 4px 10px;
|
|
26137
|
+
border-radius: 999px;
|
|
26138
|
+
border: 1px solid light-dark(rgba(15, 23, 42, 0.12), rgba(255, 255, 255, 0.14));
|
|
26139
|
+
background: light-dark(#ffffff, #27272a);
|
|
26140
|
+
color: light-dark(#18181b, #ececec);
|
|
26141
|
+
font: 500 12px/1.3 inherit;
|
|
26142
|
+
cursor: pointer;
|
|
26143
|
+
}
|
|
26144
|
+
.codexhost-handoff-source-btn:hover {
|
|
26145
|
+
background: light-dark(#f1f5f9, #323236);
|
|
26146
|
+
}
|
|
26147
|
+
.codexhost-handoff-preview-label {
|
|
26148
|
+
margin: 10px 0 6px;
|
|
26149
|
+
font-size: 11px;
|
|
26150
|
+
font-weight: 500;
|
|
26151
|
+
color: light-dark(#71717a, #9ca3af);
|
|
26152
|
+
}
|
|
26153
|
+
.codexhost-handoff-preview {
|
|
26154
|
+
margin: 0;
|
|
26155
|
+
padding: 10px 12px;
|
|
26156
|
+
max-height: 220px;
|
|
26157
|
+
overflow: auto;
|
|
26158
|
+
border-radius: 8px;
|
|
26159
|
+
border: 1px solid light-dark(rgba(15, 23, 42, 0.07), rgba(255, 255, 255, 0.08));
|
|
26160
|
+
background: light-dark(#ffffff, #141518);
|
|
26161
|
+
color: light-dark(#27272a, #d4d4d8);
|
|
26162
|
+
font: 400 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
26163
|
+
white-space: pre-wrap;
|
|
26164
|
+
word-break: break-word;
|
|
26165
|
+
}
|
|
26166
|
+
[${HANDOFF_POPOVER_ATTRIBUTE}] {
|
|
26167
|
+
position: fixed;
|
|
26168
|
+
z-index: 2147483647;
|
|
26169
|
+
width: ${HANDOFF_POPOVER_WIDTH}px;
|
|
26170
|
+
max-width: calc(100vw - 16px);
|
|
26171
|
+
padding: 12px;
|
|
26172
|
+
border-radius: 14px;
|
|
26173
|
+
border: 1px solid light-dark(rgba(15, 23, 42, 0.12), rgba(255, 255, 255, 0.12));
|
|
26174
|
+
background: light-dark(#ffffff, #1e1f23);
|
|
26175
|
+
color: light-dark(#18181b, #ececec);
|
|
26176
|
+
box-shadow: light-dark(0 12px 32px rgba(15, 23, 42, 0.14), 0 14px 36px rgba(0, 0, 0, 0.52));
|
|
26177
|
+
color-scheme: inherit;
|
|
26178
|
+
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
26179
|
+
box-sizing: border-box;
|
|
26180
|
+
}
|
|
26181
|
+
.codexhost-handoff-popover-header {
|
|
26182
|
+
display: flex;
|
|
26183
|
+
align-items: center;
|
|
26184
|
+
justify-content: space-between;
|
|
26185
|
+
gap: 8px;
|
|
26186
|
+
margin-bottom: 10px;
|
|
26187
|
+
}
|
|
26188
|
+
.codexhost-handoff-popover-title {
|
|
26189
|
+
display: inline-flex;
|
|
26190
|
+
align-items: center;
|
|
26191
|
+
gap: 6px;
|
|
26192
|
+
font-size: 13px;
|
|
26193
|
+
font-weight: 600;
|
|
26194
|
+
color: light-dark(#18181b, #f4f4f5);
|
|
26195
|
+
}
|
|
26196
|
+
.codexhost-handoff-popover-close {
|
|
26197
|
+
display: inline-flex;
|
|
26198
|
+
align-items: center;
|
|
26199
|
+
justify-content: center;
|
|
26200
|
+
width: 24px;
|
|
26201
|
+
height: 24px;
|
|
26202
|
+
padding: 0;
|
|
26203
|
+
border: 0;
|
|
26204
|
+
border-radius: 6px;
|
|
26205
|
+
background: transparent;
|
|
26206
|
+
color: light-dark(#71717a, #a1a1aa);
|
|
26207
|
+
font-size: 16px;
|
|
26208
|
+
line-height: 1;
|
|
26209
|
+
cursor: pointer;
|
|
26210
|
+
}
|
|
26211
|
+
.codexhost-handoff-popover-close:hover {
|
|
26212
|
+
background: light-dark(rgba(15, 23, 42, 0.06), rgba(255, 255, 255, 0.08));
|
|
26213
|
+
}
|
|
26214
|
+
.codexhost-handoff-field-label {
|
|
26215
|
+
display: block;
|
|
26216
|
+
margin: 8px 0 5px;
|
|
26217
|
+
font-size: 11.5px;
|
|
26218
|
+
font-weight: 500;
|
|
26219
|
+
color: light-dark(#52525b, #a1a1aa);
|
|
26220
|
+
}
|
|
26221
|
+
.codexhost-handoff-harness-list {
|
|
26222
|
+
display: flex;
|
|
26223
|
+
flex-direction: column;
|
|
26224
|
+
gap: 4px;
|
|
26225
|
+
max-height: 176px;
|
|
26226
|
+
overflow-y: auto;
|
|
26227
|
+
}
|
|
26228
|
+
.codexhost-handoff-harness-option {
|
|
26229
|
+
display: flex;
|
|
26230
|
+
align-items: center;
|
|
26231
|
+
gap: 8px;
|
|
26232
|
+
width: 100%;
|
|
26233
|
+
padding: 7px 9px;
|
|
26234
|
+
border-radius: 9px;
|
|
26235
|
+
border: 1px solid transparent;
|
|
26236
|
+
background: transparent;
|
|
26237
|
+
color: light-dark(#18181b, #ececec);
|
|
26238
|
+
font: 500 13px/1.25 inherit;
|
|
26239
|
+
text-align: left;
|
|
26240
|
+
cursor: pointer;
|
|
26241
|
+
box-sizing: border-box;
|
|
26242
|
+
}
|
|
26243
|
+
.codexhost-handoff-harness-option:hover:not(:disabled) {
|
|
26244
|
+
background: light-dark(rgba(15, 23, 42, 0.045), rgba(255, 255, 255, 0.06));
|
|
26245
|
+
}
|
|
26246
|
+
.codexhost-handoff-harness-option[aria-checked="true"] {
|
|
26247
|
+
background: light-dark(rgba(79, 121, 168, 0.1), rgba(124, 179, 240, 0.15));
|
|
26248
|
+
border-color: light-dark(rgba(79, 121, 168, 0.34), rgba(124, 179, 240, 0.34));
|
|
26249
|
+
}
|
|
26250
|
+
.codexhost-handoff-harness-option:disabled {
|
|
26251
|
+
opacity: 0.55;
|
|
26252
|
+
cursor: not-allowed;
|
|
26253
|
+
}
|
|
26254
|
+
.codexhost-handoff-harness-name {
|
|
26255
|
+
flex: 1 1 auto;
|
|
26256
|
+
min-width: 0;
|
|
26257
|
+
overflow: hidden;
|
|
26258
|
+
text-overflow: ellipsis;
|
|
26259
|
+
white-space: nowrap;
|
|
26260
|
+
}
|
|
26261
|
+
.codexhost-handoff-harness-check {
|
|
26262
|
+
color: light-dark(#4f79a8, #7cb3f0);
|
|
26263
|
+
display: inline-flex;
|
|
26264
|
+
align-items: center;
|
|
26265
|
+
flex: 0 0 auto;
|
|
26266
|
+
}
|
|
26267
|
+
.codexhost-handoff-select {
|
|
26268
|
+
width: 100%;
|
|
26269
|
+
height: 32px;
|
|
26270
|
+
padding: 0 8px;
|
|
26271
|
+
border-radius: 8px;
|
|
26272
|
+
border: 1px solid light-dark(rgba(15, 23, 42, 0.14), rgba(255, 255, 255, 0.14));
|
|
26273
|
+
background: light-dark(#f8f9fa, #141518);
|
|
26274
|
+
color: light-dark(#18181b, #ececec);
|
|
26275
|
+
font: 400 12.5px/1.2 inherit;
|
|
26276
|
+
box-sizing: border-box;
|
|
26277
|
+
}
|
|
26278
|
+
.codexhost-handoff-select:disabled {
|
|
26279
|
+
opacity: 0.6;
|
|
26280
|
+
}
|
|
26281
|
+
.codexhost-handoff-error {
|
|
26282
|
+
margin-top: 8px;
|
|
26283
|
+
padding: 6px 9px;
|
|
26284
|
+
border-radius: 8px;
|
|
26285
|
+
background: light-dark(rgba(180, 35, 24, 0.08), rgba(248, 113, 113, 0.13));
|
|
26286
|
+
color: light-dark(#b42318, #fca5a5);
|
|
26287
|
+
font-size: 12px;
|
|
26288
|
+
line-height: 1.4;
|
|
26289
|
+
word-break: break-word;
|
|
26290
|
+
}
|
|
26291
|
+
.codexhost-handoff-popover-actions {
|
|
26292
|
+
display: flex;
|
|
26293
|
+
align-items: center;
|
|
26294
|
+
justify-content: flex-end;
|
|
26295
|
+
gap: 8px;
|
|
26296
|
+
margin-top: 12px;
|
|
26297
|
+
}
|
|
26298
|
+
.codexhost-handoff-btn {
|
|
26299
|
+
display: inline-flex;
|
|
26300
|
+
align-items: center;
|
|
26301
|
+
justify-content: center;
|
|
26302
|
+
min-height: 30px;
|
|
26303
|
+
padding: 0 12px;
|
|
26304
|
+
border-radius: 999px;
|
|
26305
|
+
border: 1px solid light-dark(rgba(15, 23, 42, 0.12), rgba(255, 255, 255, 0.14));
|
|
26306
|
+
background: transparent;
|
|
26307
|
+
color: light-dark(#18181b, #ececec);
|
|
26308
|
+
font: 500 12.5px/1 inherit;
|
|
26309
|
+
cursor: pointer;
|
|
26310
|
+
}
|
|
26311
|
+
.codexhost-handoff-btn:hover:not(:disabled) {
|
|
26312
|
+
background: light-dark(rgba(15, 23, 42, 0.05), rgba(255, 255, 255, 0.08));
|
|
26313
|
+
}
|
|
26314
|
+
.codexhost-handoff-btn--primary {
|
|
26315
|
+
border-color: transparent;
|
|
26316
|
+
background: light-dark(#18181b, #ececec);
|
|
26317
|
+
color: light-dark(#ffffff, #18181b);
|
|
26318
|
+
}
|
|
26319
|
+
.codexhost-handoff-btn--primary:hover:not(:disabled) {
|
|
26320
|
+
opacity: 0.9;
|
|
26321
|
+
background: light-dark(#18181b, #ececec);
|
|
26322
|
+
}
|
|
26323
|
+
.codexhost-handoff-btn:disabled {
|
|
26324
|
+
opacity: 0.55;
|
|
26325
|
+
cursor: not-allowed;
|
|
26326
|
+
}
|
|
26327
|
+
`;
|
|
26328
|
+
(ownerDocument.head ?? ownerDocument.documentElement).append(style2);
|
|
26329
|
+
}
|
|
26330
|
+
function createHandoffDividerElement(options) {
|
|
26331
|
+
const { ownerDocument, handoff: handoff2, plugins = [], locale, onOpenSourceThread } = options;
|
|
26332
|
+
ensureRendererHandoffStyle(ownerDocument);
|
|
26333
|
+
const messages = rendererHarnessMessages(locale);
|
|
26334
|
+
const pluginById = new Map(plugins.map((plugin) => [plugin.id, plugin]));
|
|
26335
|
+
const sourcePlugin = pluginById.get(handoff2.sourceHarnessId);
|
|
26336
|
+
const targetPlugin = pluginById.get(handoff2.targetHarnessId);
|
|
26337
|
+
const root = ownerDocument.createElement("section");
|
|
26338
|
+
root.setAttribute(HANDOFF_DIVIDER_ATTRIBUTE, handoff2.sourceThreadId);
|
|
26339
|
+
root.setAttribute("aria-label", messages.handoffTitle);
|
|
26340
|
+
const row = ownerDocument.createElement("div");
|
|
26341
|
+
row.className = "codexhost-handoff-divider-row";
|
|
26342
|
+
const leftLine = ownerDocument.createElement("span");
|
|
26343
|
+
leftLine.className = "codexhost-handoff-divider-line";
|
|
26344
|
+
leftLine.setAttribute("aria-hidden", "true");
|
|
26345
|
+
const button2 = ownerDocument.createElement("button");
|
|
26346
|
+
button2.type = "button";
|
|
26347
|
+
button2.className = "codexhost-handoff-divider-button";
|
|
26348
|
+
button2.setAttribute("data-codexhost-handoff-divider-toggle", "true");
|
|
26349
|
+
button2.setAttribute("aria-expanded", String(Boolean(options.initiallyExpanded)));
|
|
26350
|
+
const title = ownerDocument.createElement("span");
|
|
26351
|
+
title.className = "codexhost-handoff-divider-title";
|
|
26352
|
+
title.textContent = messages.handoffTitle;
|
|
26353
|
+
const source = ownerDocument.createElement("span");
|
|
26354
|
+
source.className = "codexhost-handoff-endpoint codexhost-handoff-endpoint--source";
|
|
26355
|
+
const sourceText = ownerDocument.createElement("span");
|
|
26356
|
+
sourceText.className = "codexhost-handoff-endpoint-text";
|
|
26357
|
+
sourceText.textContent = formatEndpointLabel(
|
|
26358
|
+
handoff2.sourceHarnessId,
|
|
26359
|
+
handoff2.sourceHarnessLabel,
|
|
26360
|
+
handoff2.sourceModel,
|
|
26361
|
+
sourcePlugin
|
|
26362
|
+
);
|
|
26363
|
+
source.append(
|
|
26364
|
+
createRendererAgentIcon(handoff2.sourceHarnessId, 15, ownerDocument, sourcePlugin),
|
|
26365
|
+
sourceText
|
|
26366
|
+
);
|
|
26367
|
+
const arrow = ownerDocument.createElement("span");
|
|
26368
|
+
arrow.className = "codexhost-handoff-divider-arrow";
|
|
26369
|
+
arrow.setAttribute("aria-hidden", "true");
|
|
26370
|
+
arrow.textContent = "\u2192";
|
|
26371
|
+
const target2 = ownerDocument.createElement("span");
|
|
26372
|
+
target2.className = "codexhost-handoff-endpoint codexhost-handoff-endpoint--target";
|
|
26373
|
+
const targetText = ownerDocument.createElement("span");
|
|
26374
|
+
targetText.className = "codexhost-handoff-endpoint-text";
|
|
26375
|
+
targetText.textContent = formatEndpointLabel(
|
|
26376
|
+
handoff2.targetHarnessId,
|
|
26377
|
+
handoff2.targetHarnessLabel,
|
|
26378
|
+
handoff2.targetModel,
|
|
26379
|
+
targetPlugin
|
|
26380
|
+
);
|
|
26381
|
+
target2.append(
|
|
26382
|
+
createRendererAgentIcon(handoff2.targetHarnessId, 15, ownerDocument, targetPlugin),
|
|
26383
|
+
targetText
|
|
26384
|
+
);
|
|
26385
|
+
button2.append(
|
|
26386
|
+
createSwapIcon(ownerDocument, 14),
|
|
26387
|
+
title,
|
|
26388
|
+
source,
|
|
26389
|
+
arrow,
|
|
26390
|
+
target2,
|
|
26391
|
+
createChevronIcon(ownerDocument)
|
|
26392
|
+
);
|
|
26393
|
+
const rightLine = ownerDocument.createElement("span");
|
|
26394
|
+
rightLine.className = "codexhost-handoff-divider-line";
|
|
26395
|
+
rightLine.setAttribute("aria-hidden", "true");
|
|
26396
|
+
row.append(leftLine, button2, rightLine);
|
|
26397
|
+
const detail = ownerDocument.createElement("div");
|
|
26398
|
+
detail.className = "codexhost-handoff-detail";
|
|
26399
|
+
detail.setAttribute("data-codexhost-handoff-detail", "true");
|
|
26400
|
+
detail.hidden = !options.initiallyExpanded;
|
|
26401
|
+
const detailHeader = ownerDocument.createElement("div");
|
|
26402
|
+
detailHeader.className = "codexhost-handoff-detail-header";
|
|
26403
|
+
const turnsSummary = ownerDocument.createElement("span");
|
|
26404
|
+
turnsSummary.className = "codexhost-handoff-turns-summary";
|
|
26405
|
+
turnsSummary.textContent = formatRendererHandoffTurnsSummary(locale, {
|
|
26406
|
+
includedCount: handoff2.includedTurnNumbers.length,
|
|
26407
|
+
totalTurns: handoff2.totalTurns,
|
|
26408
|
+
omittedTurns: handoff2.omittedTurns,
|
|
26409
|
+
boundaryTurnNumber: handoff2.boundaryTurnNumber
|
|
26410
|
+
});
|
|
26411
|
+
const sourceBtn = ownerDocument.createElement("button");
|
|
26412
|
+
sourceBtn.type = "button";
|
|
26413
|
+
sourceBtn.className = "codexhost-handoff-source-btn";
|
|
26414
|
+
sourceBtn.setAttribute("data-codexhost-handoff-open-source", "true");
|
|
26415
|
+
sourceBtn.textContent = `${messages.handoffOpenSourceThread} \u2197`;
|
|
26416
|
+
sourceBtn.addEventListener("click", () => {
|
|
26417
|
+
onOpenSourceThread(handoff2.sourceThreadId);
|
|
26418
|
+
});
|
|
26419
|
+
detailHeader.append(turnsSummary, sourceBtn);
|
|
26420
|
+
const previewLabel = ownerDocument.createElement("div");
|
|
26421
|
+
previewLabel.className = "codexhost-handoff-preview-label";
|
|
26422
|
+
previewLabel.textContent = messages.handoffPreviewLabel;
|
|
26423
|
+
const preview = ownerDocument.createElement("pre");
|
|
26424
|
+
preview.className = "codexhost-handoff-preview";
|
|
26425
|
+
preview.textContent = handoff2.preview;
|
|
26426
|
+
detail.append(detailHeader, previewLabel, preview);
|
|
26427
|
+
button2.addEventListener("click", () => {
|
|
26428
|
+
const nextExpanded = detail.hidden;
|
|
26429
|
+
detail.hidden = !nextExpanded;
|
|
26430
|
+
button2.setAttribute("aria-expanded", String(nextExpanded));
|
|
26431
|
+
});
|
|
26432
|
+
root.append(row, detail);
|
|
26433
|
+
return root;
|
|
26434
|
+
}
|
|
26435
|
+
function renderHandoffPopoverContent(popover, options) {
|
|
26436
|
+
const {
|
|
26437
|
+
ownerDocument,
|
|
26438
|
+
locale,
|
|
26439
|
+
harnesses,
|
|
26440
|
+
selectedHarnessId,
|
|
26441
|
+
catalog,
|
|
26442
|
+
loadingModels,
|
|
26443
|
+
selectedModelId,
|
|
26444
|
+
selectedThinkingOptionId,
|
|
26445
|
+
submitting,
|
|
26446
|
+
errorMessage: errorMessage4,
|
|
26447
|
+
onSelectHarness,
|
|
26448
|
+
onSelectModel,
|
|
26449
|
+
onSelectThinking,
|
|
26450
|
+
onConfirm,
|
|
26451
|
+
onCancel
|
|
26452
|
+
} = options;
|
|
26453
|
+
ensureRendererHandoffStyle(ownerDocument);
|
|
26454
|
+
const messages = rendererHarnessMessages(locale);
|
|
26455
|
+
popover.replaceChildren();
|
|
26456
|
+
popover.setAttribute("role", "dialog");
|
|
26457
|
+
popover.setAttribute("aria-label", messages.handoffTitle);
|
|
26458
|
+
const header = ownerDocument.createElement("div");
|
|
26459
|
+
header.className = "codexhost-handoff-popover-header";
|
|
26460
|
+
const title = ownerDocument.createElement("div");
|
|
26461
|
+
title.className = "codexhost-handoff-popover-title";
|
|
26462
|
+
const titleText = ownerDocument.createElement("span");
|
|
26463
|
+
titleText.textContent = messages.handoffTitle;
|
|
26464
|
+
title.append(createSwapIcon(ownerDocument, 14), titleText);
|
|
26465
|
+
const closeButton = ownerDocument.createElement("button");
|
|
26466
|
+
closeButton.type = "button";
|
|
26467
|
+
closeButton.className = "codexhost-handoff-popover-close";
|
|
26468
|
+
closeButton.setAttribute("aria-label", messages.handoffCancel);
|
|
26469
|
+
closeButton.textContent = "\xD7";
|
|
26470
|
+
closeButton.disabled = Boolean(submitting);
|
|
26471
|
+
closeButton.addEventListener("click", onCancel);
|
|
26472
|
+
header.append(title, closeButton);
|
|
26473
|
+
popover.append(header);
|
|
26474
|
+
const harnessLabel = ownerDocument.createElement("div");
|
|
26475
|
+
harnessLabel.className = "codexhost-handoff-field-label";
|
|
26476
|
+
harnessLabel.textContent = messages.handoffTargetHarnessLabel;
|
|
26477
|
+
popover.append(harnessLabel);
|
|
26478
|
+
const list = ownerDocument.createElement("div");
|
|
26479
|
+
list.className = "codexhost-handoff-harness-list";
|
|
26480
|
+
list.setAttribute("role", "radiogroup");
|
|
26481
|
+
list.setAttribute("aria-label", messages.handoffTargetHarnessLabel);
|
|
26482
|
+
for (const item of harnesses) {
|
|
26483
|
+
const selected = item.id === selectedHarnessId;
|
|
26484
|
+
const option = ownerDocument.createElement("button");
|
|
26485
|
+
option.type = "button";
|
|
26486
|
+
option.className = "codexhost-handoff-harness-option";
|
|
26487
|
+
option.setAttribute("role", "radio");
|
|
26488
|
+
option.setAttribute("aria-checked", String(selected));
|
|
26489
|
+
option.dataset.harnessId = item.id;
|
|
26490
|
+
option.disabled = Boolean(submitting);
|
|
26491
|
+
const name = ownerDocument.createElement("span");
|
|
26492
|
+
name.className = "codexhost-handoff-harness-name";
|
|
26493
|
+
name.textContent = item.label;
|
|
26494
|
+
option.append(createRendererAgentIcon(item.id, 18, ownerDocument, item.plugin), name);
|
|
26495
|
+
if (selected) {
|
|
26496
|
+
const check2 = ownerDocument.createElement("span");
|
|
26497
|
+
check2.className = "codexhost-handoff-harness-check";
|
|
26498
|
+
check2.append(createCheckIcon(ownerDocument));
|
|
26499
|
+
option.append(check2);
|
|
26500
|
+
}
|
|
26501
|
+
option.addEventListener("click", () => onSelectHarness(item.id));
|
|
26502
|
+
list.append(option);
|
|
26503
|
+
}
|
|
26504
|
+
popover.append(list);
|
|
26505
|
+
const models = catalog?.models ?? [];
|
|
26506
|
+
if (loadingModels || models.length > 0) {
|
|
26507
|
+
const modelLabel = ownerDocument.createElement("label");
|
|
26508
|
+
modelLabel.className = "codexhost-handoff-field-label";
|
|
26509
|
+
modelLabel.textContent = messages.handoffTargetModelLabel;
|
|
26510
|
+
const modelSelect = ownerDocument.createElement("select");
|
|
26511
|
+
modelSelect.className = "codexhost-handoff-select";
|
|
26512
|
+
modelSelect.setAttribute("data-codexhost-handoff-model-select", "true");
|
|
26513
|
+
modelSelect.disabled = Boolean(submitting || loadingModels);
|
|
26514
|
+
const defaultOpt = ownerDocument.createElement("option");
|
|
26515
|
+
defaultOpt.value = "";
|
|
26516
|
+
defaultOpt.textContent = loadingModels ? messages.handoffLoadingModels : messages.handoffDefaultModelOption;
|
|
26517
|
+
modelSelect.append(defaultOpt);
|
|
26518
|
+
for (const model2 of models) {
|
|
26519
|
+
const key2 = harnessModelRefKey(model2.ref);
|
|
26520
|
+
const opt = ownerDocument.createElement("option");
|
|
26521
|
+
opt.value = key2;
|
|
26522
|
+
opt.textContent = model2.label;
|
|
26523
|
+
if (key2 === selectedModelId) opt.selected = true;
|
|
26524
|
+
modelSelect.append(opt);
|
|
26525
|
+
}
|
|
26526
|
+
modelSelect.value = selectedModelId;
|
|
26527
|
+
modelSelect.addEventListener("change", () => onSelectModel(modelSelect.value));
|
|
26528
|
+
popover.append(modelLabel, modelSelect);
|
|
26529
|
+
}
|
|
26530
|
+
let selectedModel;
|
|
26531
|
+
if (selectedModelId) {
|
|
26532
|
+
try {
|
|
26533
|
+
selectedModel = catalogModelForRef(catalog, harnessModelRefFromKey(selectedModelId));
|
|
26534
|
+
} catch {
|
|
26535
|
+
selectedModel = void 0;
|
|
26536
|
+
}
|
|
26537
|
+
}
|
|
26538
|
+
const availableThinking = catalog && catalog.thinkingOptions.length > 0 ? selectedModel?.supportedThinkingOptionIds ? catalog.thinkingOptions.filter(
|
|
26539
|
+
({ id: id2 }) => selectedModel.supportedThinkingOptionIds?.includes(id2)
|
|
26540
|
+
) : catalog.thinkingOptions : [];
|
|
26541
|
+
if (!loadingModels && availableThinking.length > 0) {
|
|
26542
|
+
const thinkingLabel = ownerDocument.createElement("label");
|
|
26543
|
+
thinkingLabel.className = "codexhost-handoff-field-label";
|
|
26544
|
+
thinkingLabel.textContent = messages.handoffTargetThinkingLabel;
|
|
26545
|
+
const thinkingSelect = ownerDocument.createElement("select");
|
|
26546
|
+
thinkingSelect.className = "codexhost-handoff-select";
|
|
26547
|
+
thinkingSelect.setAttribute("data-codexhost-handoff-thinking-select", "true");
|
|
26548
|
+
thinkingSelect.disabled = Boolean(submitting);
|
|
26549
|
+
const defaultOpt = ownerDocument.createElement("option");
|
|
26550
|
+
defaultOpt.value = "";
|
|
26551
|
+
defaultOpt.textContent = messages.handoffDefaultThinkingOption;
|
|
26552
|
+
thinkingSelect.append(defaultOpt);
|
|
26553
|
+
for (const option of availableThinking) {
|
|
26554
|
+
const opt = ownerDocument.createElement("option");
|
|
26555
|
+
opt.value = option.id;
|
|
26556
|
+
opt.textContent = option.label;
|
|
26557
|
+
if (option.id === selectedThinkingOptionId) opt.selected = true;
|
|
26558
|
+
thinkingSelect.append(opt);
|
|
26559
|
+
}
|
|
26560
|
+
thinkingSelect.value = selectedThinkingOptionId;
|
|
26561
|
+
thinkingSelect.addEventListener("change", () => onSelectThinking(thinkingSelect.value));
|
|
26562
|
+
popover.append(thinkingLabel, thinkingSelect);
|
|
26563
|
+
}
|
|
26564
|
+
if (errorMessage4) {
|
|
26565
|
+
const error62 = ownerDocument.createElement("div");
|
|
26566
|
+
error62.className = "codexhost-handoff-error";
|
|
26567
|
+
error62.setAttribute("role", "alert");
|
|
26568
|
+
error62.textContent = errorMessage4;
|
|
26569
|
+
popover.append(error62);
|
|
26570
|
+
}
|
|
26571
|
+
const actions = ownerDocument.createElement("div");
|
|
26572
|
+
actions.className = "codexhost-handoff-popover-actions";
|
|
26573
|
+
const cancelBtn = ownerDocument.createElement("button");
|
|
26574
|
+
cancelBtn.type = "button";
|
|
26575
|
+
cancelBtn.className = "codexhost-handoff-btn";
|
|
26576
|
+
cancelBtn.textContent = messages.handoffCancel;
|
|
26577
|
+
cancelBtn.disabled = Boolean(submitting);
|
|
26578
|
+
cancelBtn.addEventListener("click", onCancel);
|
|
26579
|
+
const confirmBtn = ownerDocument.createElement("button");
|
|
26580
|
+
confirmBtn.type = "button";
|
|
26581
|
+
confirmBtn.className = "codexhost-handoff-btn codexhost-handoff-btn--primary";
|
|
26582
|
+
confirmBtn.setAttribute("data-codexhost-handoff-confirm", "true");
|
|
26583
|
+
confirmBtn.textContent = submitting ? messages.handoffSubmitting : messages.handoffConfirm;
|
|
26584
|
+
confirmBtn.disabled = Boolean(submitting || !selectedHarnessId);
|
|
26585
|
+
confirmBtn.addEventListener("click", onConfirm);
|
|
26586
|
+
actions.append(cancelBtn, confirmBtn);
|
|
26587
|
+
popover.append(actions);
|
|
26588
|
+
}
|
|
26589
|
+
|
|
25588
26590
|
// ../../node_modules/lucide/dist/esm/icons/circle-alert.mjs
|
|
25589
26591
|
var CircleAlert = [
|
|
25590
26592
|
["circle", { cx: "12", cy: "12", r: "10" }],
|
|
@@ -25696,7 +26698,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
25696
26698
|
];
|
|
25697
26699
|
|
|
25698
26700
|
// src/renderer-trigger-chip-style.ts
|
|
25699
|
-
var
|
|
26701
|
+
var STYLE_ATTRIBUTE2 = "data-codexhost-trigger-chip-style";
|
|
25700
26702
|
var TRIGGER_CHIP_CLASS = "codexhost-trigger-chip";
|
|
25701
26703
|
var TRIGGER_CHIP_ROOT_CLASS = "codexhost-trigger-chip-root";
|
|
25702
26704
|
var COMPACT_COMPOSER_ATTRIBUTE = "data-codexhost-compact-composer";
|
|
@@ -25757,9 +26759,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
25757
26759
|
};
|
|
25758
26760
|
}
|
|
25759
26761
|
function ensureRendererTriggerChipStyle(ownerDocument) {
|
|
25760
|
-
if (ownerDocument.querySelector(`style[${
|
|
26762
|
+
if (ownerDocument.querySelector(`style[${STYLE_ATTRIBUTE2}]`)) return;
|
|
25761
26763
|
const style2 = ownerDocument.createElement("style");
|
|
25762
|
-
style2.setAttribute(
|
|
26764
|
+
style2.setAttribute(STYLE_ATTRIBUTE2, "true");
|
|
25763
26765
|
style2.textContent = `
|
|
25764
26766
|
.${TRIGGER_CHIP_ROOT_CLASS} {
|
|
25765
26767
|
min-width: 0;
|
|
@@ -25933,7 +26935,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
25933
26935
|
function formatRendererCreditsPercent(value) {
|
|
25934
26936
|
return `${decimal(value, 1)}%`;
|
|
25935
26937
|
}
|
|
25936
|
-
var
|
|
26938
|
+
var SVG_NS2 = "http://www.w3.org/2000/svg";
|
|
25937
26939
|
function createRendererUsageRing(percent2, options) {
|
|
25938
26940
|
const { size, strokeWidth, color } = options;
|
|
25939
26941
|
const trackColor = options.trackColor ?? "color-mix(in srgb, currentColor 18%, transparent)";
|
|
@@ -25942,7 +26944,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
25942
26944
|
const clamped = Math.min(100, Math.max(0, percent2));
|
|
25943
26945
|
const offset = circumference * (1 - clamped / 100);
|
|
25944
26946
|
const center = size / 2;
|
|
25945
|
-
const svg2 = document.createElementNS(
|
|
26947
|
+
const svg2 = document.createElementNS(SVG_NS2, "svg");
|
|
25946
26948
|
svg2.setAttribute("width", String(size));
|
|
25947
26949
|
svg2.setAttribute("height", String(size));
|
|
25948
26950
|
svg2.setAttribute("viewBox", `0 0 ${size} ${size}`);
|
|
@@ -25950,14 +26952,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
25950
26952
|
svg2.style.display = "block";
|
|
25951
26953
|
svg2.style.flex = "0 0 auto";
|
|
25952
26954
|
svg2.style.transform = "rotate(-90deg)";
|
|
25953
|
-
const track = document.createElementNS(
|
|
26955
|
+
const track = document.createElementNS(SVG_NS2, "circle");
|
|
25954
26956
|
track.setAttribute("cx", String(center));
|
|
25955
26957
|
track.setAttribute("cy", String(center));
|
|
25956
26958
|
track.setAttribute("r", String(radius));
|
|
25957
26959
|
track.setAttribute("fill", "none");
|
|
25958
26960
|
track.setAttribute("stroke", trackColor);
|
|
25959
26961
|
track.setAttribute("stroke-width", String(strokeWidth));
|
|
25960
|
-
const fill3 = document.createElementNS(
|
|
26962
|
+
const fill3 = document.createElementNS(SVG_NS2, "circle");
|
|
25961
26963
|
fill3.setAttribute("cx", String(center));
|
|
25962
26964
|
fill3.setAttribute("cy", String(center));
|
|
25963
26965
|
fill3.setAttribute("r", String(radius));
|
|
@@ -30335,9 +31337,14 @@ ${error62.stderrTail}`] : []
|
|
|
30335
31337
|
function pickerGroupMessages() {
|
|
30336
31338
|
const languages = typeof navigator !== "undefined" ? navigator.languages : [];
|
|
30337
31339
|
const messages = rendererSettingsMessages(resolveRendererSettingsLocale(languages));
|
|
31340
|
+
const isZh = messages.locale === "zh-CN";
|
|
30338
31341
|
return {
|
|
30339
31342
|
...messages,
|
|
30340
|
-
ownershipErrorLabel:
|
|
31343
|
+
ownershipErrorLabel: isZh ? "\u65E0\u6CD5\u786E\u8BA4\u4F1A\u8BDD\u7684 Agent\uFF1B\u91CD\u65B0\u805A\u7126\u7A97\u53E3\u4EE5\u91CD\u8BD5" : "Unable to determine the Thread Agent; refocus the window to retry",
|
|
31344
|
+
handoffSectionLabel: isZh ? "\u4EA4\u63A5\u4E0A\u4E0B\u6587\u5230\u65B0\u4F1A\u8BDD" : "Hand off to new conversation",
|
|
31345
|
+
handoffHintLabel: isZh ? "\u539F\u4F1A\u8BDD\u4FDD\u7559\u53EA\u8BFB\uFF0C\u4EA4\u63A5\u540E\u5728\u65B0\u4F1A\u8BDD\u7EE7\u7EED\u3002" : "Original stays read-only; continues in a new conversation.",
|
|
31346
|
+
handoffSameLabel: (name) => isZh ? `\u7528 ${name} \u65B0\u5F00\u4EA4\u63A5\u4F1A\u8BDD` : `New ${name} handoff`,
|
|
31347
|
+
handoffTooltipSuffix: isZh ? " \xB7 \u4E0A\u4E0B\u6587\u4EA4\u63A5" : " \xB7 Context handoff"
|
|
30341
31348
|
};
|
|
30342
31349
|
}
|
|
30343
31350
|
function openSettingsPage(pageId, opener) {
|
|
@@ -30363,15 +31370,17 @@ ${error62.stderrTail}`] : []
|
|
|
30363
31370
|
bottom: Math.max(8, viewportHeight - triggerRect.top / zoom + 6)
|
|
30364
31371
|
};
|
|
30365
31372
|
}
|
|
30366
|
-
function rendererAgentPickerTooltip(state, activeAccount, plugin) {
|
|
31373
|
+
function rendererAgentPickerTooltip(state, activeAccount, plugin, handoffAvailable = false) {
|
|
30367
31374
|
const account = state.agent === "codex" && activeAccount ? ` \xB7 ${activeAccount.email ?? activeAccount.label}` : "";
|
|
30368
|
-
|
|
31375
|
+
const suffix = state.phase === "locked" ? handoffAvailable ? pickerGroupMessages().handoffTooltipSuffix : " (locked)" : "";
|
|
31376
|
+
return `Agent: ${rendererAgentLabel(state.agent, plugin)}${account}${suffix}`;
|
|
30369
31377
|
}
|
|
30370
|
-
function rendererAgentPickerView(state, adapterState, switching, agents, availability = {}, plugin) {
|
|
31378
|
+
function rendererAgentPickerView(state, adapterState, switching, agents, availability = {}, plugin, handoffAvailable = false) {
|
|
31379
|
+
const boundHandoff = state.phase === "locked" && handoffAvailable;
|
|
30371
31380
|
const optionDisabled = Object.fromEntries(
|
|
30372
31381
|
agents.map((agent) => [
|
|
30373
31382
|
agent,
|
|
30374
|
-
switching || state.phase === "locked" || agent !== "codex" && (adapterState !== "ready" || !isPickerAgentSelectable(availability[agent]))
|
|
31383
|
+
boundHandoff ? switching || agent !== state.agent && agent !== "codex" && (adapterState !== "ready" || !isPickerAgentSelectable(availability[agent])) : switching || state.phase === "locked" || agent !== "codex" && (adapterState !== "ready" || !isPickerAgentSelectable(availability[agent]))
|
|
30375
31384
|
])
|
|
30376
31385
|
);
|
|
30377
31386
|
const downloadVisible = Object.fromEntries(
|
|
@@ -30382,7 +31391,7 @@ ${error62.stderrTail}`] : []
|
|
|
30382
31391
|
);
|
|
30383
31392
|
return {
|
|
30384
31393
|
label: rendererAgentLabel(state.agent, plugin),
|
|
30385
|
-
triggerDisabled: switching || state.phase === "locked" || agents.length < 2 && state.agent === "codex",
|
|
31394
|
+
triggerDisabled: switching || state.phase === "locked" && !handoffAvailable || state.phase === "draft" && agents.length < 2 && state.agent === "codex",
|
|
30386
31395
|
nativeModelHidden: switching || state.agent !== "codex",
|
|
30387
31396
|
optionDisabled,
|
|
30388
31397
|
downloadVisible,
|
|
@@ -30407,7 +31416,7 @@ ${error62.stderrTail}`] : []
|
|
|
30407
31416
|
return !menu.hidden;
|
|
30408
31417
|
}
|
|
30409
31418
|
}
|
|
30410
|
-
function mountRendererAgentPicker(composerId, enabledAgents, onSelect, onDownload, onOpen, groupPreference = getSharedAgentGroupPreferenceStore(), plugins = []) {
|
|
31419
|
+
function mountRendererAgentPicker(composerId, enabledAgents, onSelect, onDownload, onOpen, groupPreference = getSharedAgentGroupPreferenceStore(), plugins = [], onHandoff) {
|
|
30411
31420
|
const root = document.createElement("div");
|
|
30412
31421
|
root.setAttribute(CONTROL_ATTRIBUTE, composerId);
|
|
30413
31422
|
root.style.display = "inline-flex";
|
|
@@ -30489,11 +31498,19 @@ ${error62.stderrTail}`] : []
|
|
|
30489
31498
|
const rowsByAgent = /* @__PURE__ */ new Map();
|
|
30490
31499
|
const groupMessages = pickerGroupMessages();
|
|
30491
31500
|
let switchFailureNotice;
|
|
31501
|
+
let boundHandoffAgent = null;
|
|
31502
|
+
let showSameHandoff = false;
|
|
31503
|
+
let moreOpen = false;
|
|
31504
|
+
let regroupMenu = null;
|
|
30492
31505
|
const close = () => {
|
|
30493
31506
|
if (!popoverOpen(menu)) return;
|
|
30494
31507
|
if (typeof menu.hidePopover === "function") menu.hidePopover();
|
|
30495
31508
|
else menu.hidden = true;
|
|
30496
31509
|
trigger.setAttribute("aria-expanded", "false");
|
|
31510
|
+
if (moreOpen) {
|
|
31511
|
+
moreOpen = false;
|
|
31512
|
+
regroupMenu?.();
|
|
31513
|
+
}
|
|
30497
31514
|
};
|
|
30498
31515
|
const focusOption = (position) => {
|
|
30499
31516
|
const available = [
|
|
@@ -30545,10 +31562,22 @@ ${error62.stderrTail}`] : []
|
|
|
30545
31562
|
const check2 = document.createElement("span");
|
|
30546
31563
|
check2.textContent = "\u2713";
|
|
30547
31564
|
check2.setAttribute("aria-hidden", "true");
|
|
30548
|
-
check2.style.
|
|
30549
|
-
check2.style.
|
|
30550
|
-
check2.style.
|
|
31565
|
+
check2.style.position = "absolute";
|
|
31566
|
+
check2.style.inset = "0";
|
|
31567
|
+
check2.style.display = "inline-flex";
|
|
31568
|
+
check2.style.alignItems = "center";
|
|
31569
|
+
check2.style.justifyContent = "center";
|
|
30551
31570
|
check2.style.visibility = "hidden";
|
|
31571
|
+
const swap = document.createElement("span");
|
|
31572
|
+
swap.setAttribute("aria-hidden", "true");
|
|
31573
|
+
swap.style.position = "absolute";
|
|
31574
|
+
swap.style.inset = "0";
|
|
31575
|
+
swap.style.display = "inline-flex";
|
|
31576
|
+
swap.style.alignItems = "center";
|
|
31577
|
+
swap.style.justifyContent = "center";
|
|
31578
|
+
swap.style.opacity = "0.55";
|
|
31579
|
+
swap.style.visibility = "hidden";
|
|
31580
|
+
swap.append(createSwapIcon(document, 14));
|
|
30552
31581
|
const label = document.createElement("span");
|
|
30553
31582
|
const plugin = plugins.find(({ id: id2 }) => id2 === agent);
|
|
30554
31583
|
label.textContent = rendererAgentLabel(agent, plugin);
|
|
@@ -30559,6 +31588,15 @@ ${error62.stderrTail}`] : []
|
|
|
30559
31588
|
label.style.whiteSpace = "nowrap";
|
|
30560
31589
|
button2.append(createRendererAgentIcon(agent, 20, document, plugin), label);
|
|
30561
31590
|
button2.addEventListener("click", () => {
|
|
31591
|
+
if (boundHandoffAgent !== null) {
|
|
31592
|
+
close();
|
|
31593
|
+
if (agent === boundHandoffAgent) {
|
|
31594
|
+
trigger.focus();
|
|
31595
|
+
} else {
|
|
31596
|
+
onHandoff?.(agent, trigger);
|
|
31597
|
+
}
|
|
31598
|
+
return;
|
|
31599
|
+
}
|
|
30562
31600
|
const selected = button2.getAttribute("aria-pressed") === "true";
|
|
30563
31601
|
close();
|
|
30564
31602
|
trigger.focus();
|
|
@@ -30610,17 +31648,109 @@ ${error62.stderrTail}`] : []
|
|
|
30610
31648
|
actionSlot.style.width = "24px";
|
|
30611
31649
|
actionSlot.style.height = "24px";
|
|
30612
31650
|
actionSlot.style.pointerEvents = "none";
|
|
30613
|
-
actionSlot.append(check2);
|
|
31651
|
+
actionSlot.append(check2, swap);
|
|
30614
31652
|
if (action) actionSlot.append(action);
|
|
30615
31653
|
row.append(button2, actionSlot);
|
|
30616
|
-
options[agent] = { row, button: button2, check: check2, action };
|
|
31654
|
+
options[agent] = { row, button: button2, check: check2, swap, action };
|
|
30617
31655
|
rowsByAgent.set(agent, row);
|
|
30618
31656
|
}
|
|
31657
|
+
const boundCurrentGroup = document.createElement("div");
|
|
31658
|
+
boundCurrentGroup.style.display = "none";
|
|
31659
|
+
boundCurrentGroup.style.flexDirection = "column";
|
|
31660
|
+
boundCurrentGroup.style.gap = "2px";
|
|
31661
|
+
const handoffSeparator = document.createElement("div");
|
|
31662
|
+
handoffSeparator.setAttribute("role", "separator");
|
|
31663
|
+
handoffSeparator.style.display = "none";
|
|
31664
|
+
handoffSeparator.style.height = "1px";
|
|
31665
|
+
handoffSeparator.style.margin = "4px 2px";
|
|
31666
|
+
handoffSeparator.style.background = "rgba(127, 127, 127, 0.16)";
|
|
31667
|
+
const handoffHeading = document.createElement("div");
|
|
31668
|
+
handoffHeading.setAttribute("role", "presentation");
|
|
31669
|
+
handoffHeading.textContent = groupMessages.handoffSectionLabel;
|
|
31670
|
+
handoffHeading.style.display = "none";
|
|
31671
|
+
handoffHeading.style.padding = "4px 8px";
|
|
31672
|
+
handoffHeading.style.font = "400 11px/15px system-ui, sans-serif";
|
|
31673
|
+
handoffHeading.style.opacity = "0.62";
|
|
31674
|
+
const sameHandoffRow = document.createElement("div");
|
|
31675
|
+
sameHandoffRow.style.position = "relative";
|
|
31676
|
+
sameHandoffRow.style.display = "none";
|
|
31677
|
+
sameHandoffRow.style.alignItems = "center";
|
|
31678
|
+
const sameHandoffButton = document.createElement("button");
|
|
31679
|
+
sameHandoffButton.type = "button";
|
|
31680
|
+
sameHandoffButton.setAttribute("role", "menuitem");
|
|
31681
|
+
sameHandoffButton.style.display = "flex";
|
|
31682
|
+
sameHandoffButton.style.alignItems = "center";
|
|
31683
|
+
sameHandoffButton.style.gap = "8px";
|
|
31684
|
+
sameHandoffButton.style.minWidth = "0";
|
|
31685
|
+
sameHandoffButton.style.width = "100%";
|
|
31686
|
+
sameHandoffButton.style.height = "36px";
|
|
31687
|
+
sameHandoffButton.style.padding = "0 34px 0 8px";
|
|
31688
|
+
sameHandoffButton.style.border = "0";
|
|
31689
|
+
sameHandoffButton.style.borderRadius = "4px";
|
|
31690
|
+
sameHandoffButton.style.background = "transparent";
|
|
31691
|
+
sameHandoffButton.style.color = "inherit";
|
|
31692
|
+
sameHandoffButton.style.font = "500 13px/1 system-ui, sans-serif";
|
|
31693
|
+
sameHandoffButton.style.textAlign = "left";
|
|
31694
|
+
sameHandoffButton.style.cursor = "pointer";
|
|
31695
|
+
sameHandoffButton.addEventListener("pointerenter", () => {
|
|
31696
|
+
sameHandoffButton.style.background = "rgba(127, 127, 127, 0.1)";
|
|
31697
|
+
});
|
|
31698
|
+
sameHandoffButton.addEventListener("pointerleave", () => {
|
|
31699
|
+
sameHandoffButton.style.background = "transparent";
|
|
31700
|
+
});
|
|
31701
|
+
sameHandoffButton.addEventListener("focus", () => {
|
|
31702
|
+
sameHandoffButton.style.background = "rgba(127, 127, 127, 0.1)";
|
|
31703
|
+
});
|
|
31704
|
+
sameHandoffButton.addEventListener("blur", () => {
|
|
31705
|
+
sameHandoffButton.style.background = "transparent";
|
|
31706
|
+
});
|
|
31707
|
+
const sameHandoffIconSlot = document.createElement("span");
|
|
31708
|
+
sameHandoffIconSlot.style.display = "inline-flex";
|
|
31709
|
+
sameHandoffIconSlot.style.alignItems = "center";
|
|
31710
|
+
sameHandoffIconSlot.style.justifyContent = "center";
|
|
31711
|
+
sameHandoffIconSlot.style.width = "20px";
|
|
31712
|
+
sameHandoffIconSlot.style.height = "20px";
|
|
31713
|
+
sameHandoffIconSlot.style.flex = "none";
|
|
31714
|
+
const sameHandoffLabel = document.createElement("span");
|
|
31715
|
+
sameHandoffLabel.style.minWidth = "0";
|
|
31716
|
+
sameHandoffLabel.style.flex = "1 1 auto";
|
|
31717
|
+
sameHandoffLabel.style.overflow = "hidden";
|
|
31718
|
+
sameHandoffLabel.style.textOverflow = "ellipsis";
|
|
31719
|
+
sameHandoffLabel.style.whiteSpace = "nowrap";
|
|
31720
|
+
sameHandoffButton.append(sameHandoffIconSlot, sameHandoffLabel);
|
|
31721
|
+
sameHandoffButton.addEventListener("click", () => {
|
|
31722
|
+
const current = boundHandoffAgent;
|
|
31723
|
+
close();
|
|
31724
|
+
if (current) onHandoff?.(current, trigger);
|
|
31725
|
+
});
|
|
31726
|
+
const sameHandoffSwapSlot = document.createElement("span");
|
|
31727
|
+
sameHandoffSwapSlot.setAttribute("aria-hidden", "true");
|
|
31728
|
+
sameHandoffSwapSlot.style.position = "absolute";
|
|
31729
|
+
sameHandoffSwapSlot.style.top = "6px";
|
|
31730
|
+
sameHandoffSwapSlot.style.right = "4px";
|
|
31731
|
+
sameHandoffSwapSlot.style.display = "inline-flex";
|
|
31732
|
+
sameHandoffSwapSlot.style.alignItems = "center";
|
|
31733
|
+
sameHandoffSwapSlot.style.justifyContent = "center";
|
|
31734
|
+
sameHandoffSwapSlot.style.width = "24px";
|
|
31735
|
+
sameHandoffSwapSlot.style.height = "24px";
|
|
31736
|
+
sameHandoffSwapSlot.style.opacity = "0.55";
|
|
31737
|
+
sameHandoffSwapSlot.style.pointerEvents = "none";
|
|
31738
|
+
sameHandoffSwapSlot.append(createSwapIcon(document, 14));
|
|
31739
|
+
sameHandoffRow.append(sameHandoffButton, sameHandoffSwapSlot);
|
|
31740
|
+
const handoffFooter = document.createElement("div");
|
|
31741
|
+
handoffFooter.setAttribute("role", "presentation");
|
|
31742
|
+
handoffFooter.textContent = groupMessages.handoffHintLabel;
|
|
31743
|
+
handoffFooter.style.display = "none";
|
|
31744
|
+
handoffFooter.style.marginTop = "4px";
|
|
31745
|
+
handoffFooter.style.padding = "6px 8px 4px";
|
|
31746
|
+
handoffFooter.style.borderTop = "1px solid rgba(127, 127, 127, 0.16)";
|
|
31747
|
+
handoffFooter.style.font = "400 11px/15px system-ui, sans-serif";
|
|
31748
|
+
handoffFooter.style.opacity = "0.62";
|
|
31749
|
+
handoffFooter.style.whiteSpace = "normal";
|
|
30619
31750
|
const mainGroup = document.createElement("div");
|
|
30620
31751
|
mainGroup.style.display = "flex";
|
|
30621
31752
|
mainGroup.style.flexDirection = "column";
|
|
30622
31753
|
mainGroup.style.gap = "2px";
|
|
30623
|
-
let moreOpen = false;
|
|
30624
31754
|
const moreToggle = document.createElement("button");
|
|
30625
31755
|
moreToggle.type = "button";
|
|
30626
31756
|
moreToggle.style.display = "none";
|
|
@@ -30708,7 +31838,10 @@ ${error62.stderrTail}`] : []
|
|
|
30708
31838
|
const seen = /* @__PURE__ */ new Set();
|
|
30709
31839
|
const nextMain = [];
|
|
30710
31840
|
const nextMore = [];
|
|
30711
|
-
if (
|
|
31841
|
+
if (boundHandoffAgent !== null) {
|
|
31842
|
+
seen.add(boundHandoffAgent);
|
|
31843
|
+
}
|
|
31844
|
+
if (enabledSet.has("codex") && !seen.has("codex")) {
|
|
30712
31845
|
nextMain.push("codex");
|
|
30713
31846
|
seen.add("codex");
|
|
30714
31847
|
}
|
|
@@ -30731,6 +31864,9 @@ ${error62.stderrTail}`] : []
|
|
|
30731
31864
|
const installationOrder = (a, b) => Number(notInstalled.has(a)) - Number(notInstalled.has(b));
|
|
30732
31865
|
mainAgents = nextMain.sort(installationOrder);
|
|
30733
31866
|
moreAgents = nextMore.sort(installationOrder);
|
|
31867
|
+
const boundRow = boundHandoffAgent ? rowsByAgent.get(boundHandoffAgent) : void 0;
|
|
31868
|
+
boundCurrentGroup.replaceChildren(...boundRow ? [boundRow] : []);
|
|
31869
|
+
boundCurrentGroup.style.display = boundRow ? "flex" : "none";
|
|
30734
31870
|
const mainChildren = [];
|
|
30735
31871
|
for (const agent of mainAgents) {
|
|
30736
31872
|
const row = rowsByAgent.get(agent);
|
|
@@ -30740,6 +31876,22 @@ ${error62.stderrTail}`] : []
|
|
|
30740
31876
|
moreRows.replaceChildren(
|
|
30741
31877
|
...moreAgents.map((agent) => rowsByAgent.get(agent)).filter((el) => !!el)
|
|
30742
31878
|
);
|
|
31879
|
+
const hasSecondaryRows = mainAgents.length > 0 || moreAgents.length > 0 || showSameHandoff;
|
|
31880
|
+
handoffSeparator.style.display = boundRow && hasSecondaryRows ? "block" : "none";
|
|
31881
|
+
handoffHeading.style.display = boundHandoffAgent && hasSecondaryRows ? "block" : "none";
|
|
31882
|
+
if (boundHandoffAgent && showSameHandoff) {
|
|
31883
|
+
const plugin = plugins.find(({ id: id2 }) => id2 === boundHandoffAgent);
|
|
31884
|
+
sameHandoffIconSlot.replaceChildren(
|
|
31885
|
+
createRendererAgentIcon(boundHandoffAgent, 20, document, plugin)
|
|
31886
|
+
);
|
|
31887
|
+
sameHandoffLabel.textContent = groupMessages.handoffSameLabel(
|
|
31888
|
+
rendererAgentLabel(boundHandoffAgent, plugin)
|
|
31889
|
+
);
|
|
31890
|
+
sameHandoffRow.style.display = "flex";
|
|
31891
|
+
} else {
|
|
31892
|
+
sameHandoffRow.style.display = "none";
|
|
31893
|
+
}
|
|
31894
|
+
handoffFooter.style.display = boundHandoffAgent ? "block" : "none";
|
|
30743
31895
|
const showMoreGroup = moreAgents.length > 0;
|
|
30744
31896
|
const showCta = !showMoreGroup && enabledAgents.length > AGENT_GROUP_CTA_THRESHOLD;
|
|
30745
31897
|
moreToggle.style.display = showMoreGroup ? "flex" : "none";
|
|
@@ -30748,13 +31900,24 @@ ${error62.stderrTail}`] : []
|
|
|
30748
31900
|
moreLabel.textContent = `${groupMessages.pickerMoreAgentsLabel} (${moreAgents.length})`;
|
|
30749
31901
|
moreArrow.textContent = moreOpen ? "\u25BE" : "\u25B8";
|
|
30750
31902
|
};
|
|
31903
|
+
regroupMenu = regroup;
|
|
30751
31904
|
moreToggle.addEventListener("click", () => {
|
|
30752
31905
|
moreOpen = !moreOpen;
|
|
30753
31906
|
regroup();
|
|
30754
31907
|
});
|
|
30755
31908
|
regroup();
|
|
30756
31909
|
const unsubscribeGroup = groupPreference.subscribe(regroup);
|
|
30757
|
-
menu.append(
|
|
31910
|
+
menu.append(
|
|
31911
|
+
boundCurrentGroup,
|
|
31912
|
+
handoffSeparator,
|
|
31913
|
+
handoffHeading,
|
|
31914
|
+
sameHandoffRow,
|
|
31915
|
+
mainGroup,
|
|
31916
|
+
moreToggle,
|
|
31917
|
+
morePanel,
|
|
31918
|
+
cta,
|
|
31919
|
+
handoffFooter
|
|
31920
|
+
);
|
|
30758
31921
|
root.append(trigger, menu);
|
|
30759
31922
|
const onTriggerClick = () => {
|
|
30760
31923
|
if (popoverOpen(menu)) close();
|
|
@@ -30819,6 +31982,12 @@ ${error62.stderrTail}`] : []
|
|
|
30819
31982
|
notInstalled = next;
|
|
30820
31983
|
regroup();
|
|
30821
31984
|
},
|
|
31985
|
+
setBoundHandoff(agent, sameHandoff) {
|
|
31986
|
+
if (boundHandoffAgent === agent && showSameHandoff === sameHandoff) return;
|
|
31987
|
+
boundHandoffAgent = agent;
|
|
31988
|
+
showSameHandoff = sameHandoff;
|
|
31989
|
+
regroup();
|
|
31990
|
+
},
|
|
30822
31991
|
showSwitchFailure() {
|
|
30823
31992
|
switchFailureNotice ??= mountRendererModelSelectionNotice(trigger);
|
|
30824
31993
|
if (groupMessages.locale === "zh-CN") {
|
|
@@ -30846,16 +32015,21 @@ ${error62.stderrTail}`] : []
|
|
|
30846
32015
|
};
|
|
30847
32016
|
return control;
|
|
30848
32017
|
}
|
|
30849
|
-
function renderRendererAgentPicker(control, state, adapterState, switching, availability = {}, currentCodexAccount = null, ownershipError = false) {
|
|
32018
|
+
function renderRendererAgentPicker(control, state, adapterState, switching, availability = {}, currentCodexAccount = null, ownershipError = false, handoffAvailable = false) {
|
|
32019
|
+
const effectiveHandoff = handoffAvailable && !ownershipError;
|
|
30850
32020
|
const view = rendererAgentPickerView(
|
|
30851
32021
|
state,
|
|
30852
32022
|
adapterState,
|
|
30853
32023
|
switching,
|
|
30854
32024
|
control.agents,
|
|
30855
32025
|
availability,
|
|
30856
|
-
control.plugins.find(({ id: id2 }) => id2 === state.agent)
|
|
32026
|
+
control.plugins.find(({ id: id2 }) => id2 === state.agent),
|
|
32027
|
+
effectiveHandoff
|
|
30857
32028
|
);
|
|
32029
|
+
const boundHandoff = state.phase === "locked" && effectiveHandoff;
|
|
32030
|
+
const hasOtherReady = boundHandoff && control.agents.some((agent) => agent !== state.agent && !(view.optionDisabled[agent] ?? true));
|
|
30858
32031
|
control.updateAvailability(availability);
|
|
32032
|
+
control.setBoundHandoff(boundHandoff ? state.agent : null, boundHandoff && !hasOtherReady);
|
|
30859
32033
|
if (control.iconSlot.dataset.agent !== state.agent) {
|
|
30860
32034
|
control.iconSlot.replaceChildren(
|
|
30861
32035
|
createRendererAgentIcon(
|
|
@@ -30871,12 +32045,13 @@ ${error62.stderrTail}`] : []
|
|
|
30871
32045
|
control.trigger.setAttribute("aria-busy", String(switching));
|
|
30872
32046
|
control.trigger.setAttribute(
|
|
30873
32047
|
"aria-label",
|
|
30874
|
-
ownershipError ? pickerGroupMessages().ownershipErrorLabel : state.phase === "locked" ? `Agent: ${view.label}` : `Select Agent, current ${view.label}`
|
|
32048
|
+
ownershipError ? pickerGroupMessages().ownershipErrorLabel : state.phase === "locked" && !effectiveHandoff ? `Agent: ${view.label}` : `Select Agent, current ${view.label}`
|
|
30875
32049
|
);
|
|
30876
32050
|
control.trigger.title = ownershipError ? pickerGroupMessages().ownershipErrorLabel : rendererAgentPickerTooltip(
|
|
30877
32051
|
state,
|
|
30878
32052
|
currentCodexAccount ?? void 0,
|
|
30879
|
-
control.plugins.find(({ id: id2 }) => id2 === state.agent)
|
|
32053
|
+
control.plugins.find(({ id: id2 }) => id2 === state.agent),
|
|
32054
|
+
effectiveHandoff
|
|
30880
32055
|
);
|
|
30881
32056
|
control.trigger.style.cursor = control.trigger.disabled ? "not-allowed" : "pointer";
|
|
30882
32057
|
control.trigger.style.opacity = control.trigger.disabled && !switching ? "0.72" : "1";
|
|
@@ -30888,6 +32063,10 @@ ${error62.stderrTail}`] : []
|
|
|
30888
32063
|
const option = control.options[agent];
|
|
30889
32064
|
if (!option) continue;
|
|
30890
32065
|
const selected = agent === state.agent;
|
|
32066
|
+
const externalAgent = agent !== "codex" ? agent : null;
|
|
32067
|
+
const showInstall = externalAgent !== null && view.downloadVisible[externalAgent] === true;
|
|
32068
|
+
const showError = externalAgent !== null && view.errorVisible[externalAgent] === true;
|
|
32069
|
+
const actionVisible = showInstall || showError;
|
|
30891
32070
|
option.button.disabled = view.optionDisabled[agent] ?? true;
|
|
30892
32071
|
option.button.setAttribute("aria-checked", String(selected));
|
|
30893
32072
|
option.button.setAttribute("aria-pressed", String(selected));
|
|
@@ -30895,11 +32074,9 @@ ${error62.stderrTail}`] : []
|
|
|
30895
32074
|
option.button.style.cursor = option.button.disabled ? "not-allowed" : "pointer";
|
|
30896
32075
|
option.button.style.opacity = option.button.disabled && !selected ? "0.5" : "1";
|
|
30897
32076
|
option.check.style.visibility = selected ? "visible" : "hidden";
|
|
32077
|
+
option.swap.style.visibility = boundHandoff && !selected && !option.button.disabled && !actionVisible ? "visible" : "hidden";
|
|
30898
32078
|
if (option.action) {
|
|
30899
|
-
const
|
|
30900
|
-
const showInstall = view.downloadVisible[externalAgent] === true;
|
|
30901
|
-
const showError = view.errorVisible[externalAgent] === true;
|
|
30902
|
-
const visible = showInstall || showError;
|
|
32079
|
+
const visible = actionVisible;
|
|
30903
32080
|
option.action.hidden = false;
|
|
30904
32081
|
option.action.disabled = !visible;
|
|
30905
32082
|
option.action.style.display = "inline-flex";
|
|
@@ -31095,60 +32272,6 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
31095
32272
|
};
|
|
31096
32273
|
}
|
|
31097
32274
|
|
|
31098
|
-
// src/renderer-harness-localization.ts
|
|
31099
|
-
var ENGLISH_HARNESS_MESSAGES = Object.freeze({
|
|
31100
|
-
commands: "Commands",
|
|
31101
|
-
harnessCommands: "Harness commands",
|
|
31102
|
-
commandsUnavailable: "No Harness commands available yet",
|
|
31103
|
-
commandRequiresConversation: "Start a conversation before running this command",
|
|
31104
|
-
commandMenuHint: "Type # for commands, skills and agents",
|
|
31105
|
-
textArgument: "Text",
|
|
31106
|
-
permissionMode: "Permission mode",
|
|
31107
|
-
permissions: "Permissions",
|
|
31108
|
-
loadingPermissions: "Loading permissions...",
|
|
31109
|
-
selecting: "Selecting...",
|
|
31110
|
-
permissionsUnavailable: "Permissions unavailable",
|
|
31111
|
-
permissionModeFixedAtCreate: "This Permission Mode is fixed when the Session is created. Start a new Thread to change it.",
|
|
31112
|
-
codexUsageGateUnavailable: "Could not separate this Harness from the Codex usage limit in this Desktop version. Codex usage limits still apply to sending.",
|
|
31113
|
-
modelMenuTitle: "Model",
|
|
31114
|
-
refreshModels: "Refresh models",
|
|
31115
|
-
modelSelectionRejected: "Couldn't switch Model",
|
|
31116
|
-
thinkingSelectionRejected: "Couldn't switch Thinking option"
|
|
31117
|
-
});
|
|
31118
|
-
var CHINESE_HARNESS_MESSAGES = Object.freeze({
|
|
31119
|
-
commands: "\u547D\u4EE4",
|
|
31120
|
-
harnessCommands: "Harness \u547D\u4EE4",
|
|
31121
|
-
commandsUnavailable: "\u6682\u65E0\u53EF\u7528\u7684 Harness \u547D\u4EE4",
|
|
31122
|
-
commandRequiresConversation: "\u8BF7\u5148\u5F00\u59CB\u5BF9\u8BDD\uFF0C\u518D\u6267\u884C\u6B64\u547D\u4EE4",
|
|
31123
|
-
commandMenuHint: "\u8F93\u5165 # \u6253\u5F00\u547D\u4EE4\u3001\u6280\u80FD\u548C Agent",
|
|
31124
|
-
textArgument: "\u6587\u672C",
|
|
31125
|
-
permissionMode: "\u6743\u9650\u6A21\u5F0F",
|
|
31126
|
-
permissions: "\u6743\u9650",
|
|
31127
|
-
loadingPermissions: "\u6B63\u5728\u52A0\u8F7D\u6743\u9650...",
|
|
31128
|
-
selecting: "\u6B63\u5728\u9009\u62E9...",
|
|
31129
|
-
permissionsUnavailable: "\u6743\u9650\u4E0D\u53EF\u7528",
|
|
31130
|
-
permissionModeFixedAtCreate: "\u6B64\u6743\u9650\u6A21\u5F0F\u5728\u4F1A\u8BDD\u521B\u5EFA\u65F6\u786E\u5B9A\uFF0C\u5982\u9700\u66F4\u6539\u8BF7\u65B0\u5EFA\u4F1A\u8BDD",
|
|
31131
|
-
codexUsageGateUnavailable: "\u5F53\u524D Desktop \u7248\u672C\u65E0\u6CD5\u5C06\u6B64 Harness \u4E0E Codex \u989D\u5EA6\u9650\u5236\u5206\u79BB\uFF0C\u53D1\u9001\u4ECD\u53D7 Codex \u989D\u5EA6\u9650\u5236",
|
|
31132
|
-
modelMenuTitle: "\u6A21\u578B",
|
|
31133
|
-
refreshModels: "\u5237\u65B0\u6A21\u578B\u5217\u8868",
|
|
31134
|
-
modelSelectionRejected: "\u65E0\u6CD5\u5207\u6362\u6A21\u578B",
|
|
31135
|
-
thinkingSelectionRejected: "\u65E0\u6CD5\u5207\u6362\u601D\u8003\u9009\u9879"
|
|
31136
|
-
});
|
|
31137
|
-
function rendererHarnessMessages(locale) {
|
|
31138
|
-
return locale === "zh-CN" ? CHINESE_HARNESS_MESSAGES : ENGLISH_HARNESS_MESSAGES;
|
|
31139
|
-
}
|
|
31140
|
-
function rendererHarnessCommandPresentation(command, locale) {
|
|
31141
|
-
const presentation = localizeHarnessPresentation(command, locale);
|
|
31142
|
-
return { ...presentation, description: presentation.description ?? presentation.label };
|
|
31143
|
-
}
|
|
31144
|
-
function rendererPermissionModePresentation(mode, locale) {
|
|
31145
|
-
return localizeHarnessPresentation(mode, locale);
|
|
31146
|
-
}
|
|
31147
|
-
function rendererLiveCommandsPendingNotice(locale, harnessLabel) {
|
|
31148
|
-
const harness2 = harnessLabel.replace(/\s*[((][^))]*[))]\s*$/u, "").trim() || harnessLabel;
|
|
31149
|
-
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
|
-
}
|
|
31151
|
-
|
|
31152
32275
|
// src/renderer-model-favorites.ts
|
|
31153
32276
|
var STORAGE_KEY = "codexhost.model-favorites.v1";
|
|
31154
32277
|
var pending = /* @__PURE__ */ new Map();
|
|
@@ -31196,11 +32319,11 @@ Codex Fast mode prioritizes requests and may increase usage.`
|
|
|
31196
32319
|
}
|
|
31197
32320
|
|
|
31198
32321
|
// src/renderer-model-option-style.ts
|
|
31199
|
-
var
|
|
32322
|
+
var STYLE_ATTRIBUTE3 = "data-codexhost-model-option-style";
|
|
31200
32323
|
function ensureModelOptionStyle(ownerDocument) {
|
|
31201
|
-
if (ownerDocument.querySelector(`style[${
|
|
32324
|
+
if (ownerDocument.querySelector(`style[${STYLE_ATTRIBUTE3}]`)) return;
|
|
31202
32325
|
const style2 = ownerDocument.createElement("style");
|
|
31203
|
-
style2.setAttribute(
|
|
32326
|
+
style2.setAttribute(STYLE_ATTRIBUTE3, "true");
|
|
31204
32327
|
style2.textContent = `
|
|
31205
32328
|
[data-codexhost-model-row] {
|
|
31206
32329
|
display: flex;
|
|
@@ -33081,29 +34204,29 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
|
|
|
33081
34204
|
(attribute) => `[${attribute}]`
|
|
33082
34205
|
).join(", ");
|
|
33083
34206
|
function isNativeComposerRequest(element) {
|
|
33084
|
-
return element.closest(NATIVE_REQUEST_SELECTOR) !== null;
|
|
34207
|
+
return typeof element.closest === "function" && element.closest(NATIVE_REQUEST_SELECTOR) !== null;
|
|
33085
34208
|
}
|
|
33086
34209
|
function hasNativeComposerRequest(composer) {
|
|
33087
|
-
return isNativeComposerRequest(composer) || composer.querySelector(NATIVE_REQUEST_SELECTOR) !== null;
|
|
34210
|
+
return isNativeComposerRequest(composer) || typeof composer.querySelector === "function" && composer.querySelector(NATIVE_REQUEST_SELECTOR) !== null;
|
|
33088
34211
|
}
|
|
33089
34212
|
|
|
33090
34213
|
// src/renderer-harness-command-control.ts
|
|
33091
34214
|
var CONTROL_ATTRIBUTE2 = "data-codexhost-harness-command-control";
|
|
33092
|
-
var
|
|
34215
|
+
var SVG_NS3 = "http://www.w3.org/2000/svg";
|
|
33093
34216
|
var COMMAND_ICON_PATHS = [
|
|
33094
34217
|
"M409.6 377.6h204.8a32 32 0 0 1 32 32v204.8a32 32 0 0 1-32 32H409.6a32 32 0 0 1-32-32V409.6a32 32 0 0 1 32-32z m172.8 64h-140.8v140.8h140.8z",
|
|
33095
34218
|
"M332.8 800a108.8 108.8 0 0 1 0-217.6h76.8a32 32 0 0 1 32 32v76.8a108.928 108.928 0 0 1-108.8 108.8z m0-153.6a44.8 44.8 0 1 0 44.8 44.8v-44.8zM409.6 441.6H332.8a108.8 108.8 0 1 1 108.8-108.8v76.8a32 32 0 0 1-32 32z m-76.8-153.6a44.8 44.8 0 0 0 0 89.6h44.8V332.8A44.842667 44.842667 0 0 0 332.8 288zM691.2 441.6h-76.8a32 32 0 0 1-32-32V332.8a108.8 108.8 0 1 1 108.8 108.8z m-44.8-64h44.8a44.8 44.8 0 1 0-44.8-44.8zM691.2 800a108.928 108.928 0 0 1-108.8-108.8v-76.8a32 32 0 0 1 32-32h76.8a108.8 108.8 0 0 1 0 217.6z m-44.8-153.6v44.8a44.8 44.8 0 1 0 44.8-44.8z",
|
|
33096
34219
|
"M640 970.666667H384c-118.186667 0-198.272-25.002667-251.946667-78.72S53.333333 758.186667 53.333333 640V384c0-118.186667 25.002667-198.272 78.72-251.946667S265.813333 53.333333 384 53.333333h256c118.186667 0 198.272 25.002667 251.946667 78.72S970.666667 265.813333 970.666667 384v256c0 118.186667-25.002667 198.272-78.72 251.946667S758.186667 970.666667 640 970.666667z m-256-853.333334c-100.096 0-165.802667 19.2-206.72 59.946667S117.333333 283.904 117.333333 384v256c0 100.096 19.072 165.802667 59.946667 206.72S283.904 906.666667 384 906.666667h256c100.096 0 165.802667-19.072 206.72-59.946667S906.666667 740.096 906.666667 640V384c0-100.096-19.072-165.802667-59.946667-206.72S740.096 117.333333 640 117.333333z"
|
|
33097
34220
|
];
|
|
33098
34221
|
function createHarnessCommandIcon(ownerDocument) {
|
|
33099
|
-
const svg2 = ownerDocument.createElementNS(
|
|
34222
|
+
const svg2 = ownerDocument.createElementNS(SVG_NS3, "svg");
|
|
33100
34223
|
svg2.setAttribute("viewBox", "0 0 1024 1024");
|
|
33101
34224
|
svg2.setAttribute("width", "15");
|
|
33102
34225
|
svg2.setAttribute("height", "15");
|
|
33103
34226
|
svg2.setAttribute("fill", "currentColor");
|
|
33104
34227
|
svg2.setAttribute("aria-hidden", "true");
|
|
33105
34228
|
for (const path of COMMAND_ICON_PATHS) {
|
|
33106
|
-
const element = ownerDocument.createElementNS(
|
|
34229
|
+
const element = ownerDocument.createElementNS(SVG_NS3, "path");
|
|
33107
34230
|
element.setAttribute("d", path);
|
|
33108
34231
|
svg2.append(element);
|
|
33109
34232
|
}
|
|
@@ -33276,7 +34399,7 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
|
|
|
33276
34399
|
return controlDescription(button2);
|
|
33277
34400
|
}
|
|
33278
34401
|
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");
|
|
34402
|
+
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
34403
|
}
|
|
33281
34404
|
function isComposerSubmitButton(button2) {
|
|
33282
34405
|
if (button2.type === "submit") return true;
|
|
@@ -33588,7 +34711,7 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
|
|
|
33588
34711
|
setNativeControlHidden(control.nativeContextUsageControl, false);
|
|
33589
34712
|
setNativeControlHidden(control.nativePermissionModeControl, hidePermissionMode);
|
|
33590
34713
|
}
|
|
33591
|
-
function mountComposerAgentControl(composer, composerId, sendButton, enabledAgents, onSelect, onDownload, onOpenProviderPicker, onSelectModel, onSelectThinking, onSelectPermissionMode, onOpenCommandMenu, onRefreshModels) {
|
|
34714
|
+
function mountComposerAgentControl(composer, composerId, sendButton, enabledAgents, onSelect, onDownload, onOpenProviderPicker, onSelectModel, onSelectThinking, onSelectPermissionMode, onOpenCommandMenu, onRefreshModels, onHandoff) {
|
|
33592
34715
|
if (composer instanceof HTMLElement) composer.style.minWidth = "0";
|
|
33593
34716
|
const nativeModelControl = captureNativeControl(nativeModelControlForComposer(composer));
|
|
33594
34717
|
const nativeContextUsageControl = captureNativeControl(
|
|
@@ -33602,7 +34725,10 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
|
|
|
33602
34725
|
enabledAgents,
|
|
33603
34726
|
onSelect,
|
|
33604
34727
|
onDownload,
|
|
33605
|
-
onOpenProviderPicker
|
|
34728
|
+
onOpenProviderPicker,
|
|
34729
|
+
void 0,
|
|
34730
|
+
void 0,
|
|
34731
|
+
onHandoff
|
|
33606
34732
|
);
|
|
33607
34733
|
const modelPicker = mountRendererModelPicker(
|
|
33608
34734
|
composerId,
|
|
@@ -33648,7 +34774,8 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
|
|
|
33648
34774
|
onDownload,
|
|
33649
34775
|
onOpenProviderPicker,
|
|
33650
34776
|
void 0,
|
|
33651
|
-
plugins
|
|
34777
|
+
plugins,
|
|
34778
|
+
onHandoff
|
|
33652
34779
|
);
|
|
33653
34780
|
control.picker.root.replaceWith(next.root);
|
|
33654
34781
|
control.picker.dispose();
|
|
@@ -33679,7 +34806,7 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
|
|
|
33679
34806
|
const props = key2 ? Object.getOwnPropertyDescriptor(button2, key2)?.value : void 0;
|
|
33680
34807
|
return typeof props === "object" && props !== null && "disabled" in props && typeof props.disabled === "boolean" ? props.disabled : fallback;
|
|
33681
34808
|
}
|
|
33682
|
-
function renderComposerAgentControl(control, state, adapterState, switching, availability = {}, modelView = { status: "idle" }, permissionModeView = { status: "idle" }, usage = null, accountCredits = null, locale = "en", currentCodexAccount = null, ownershipError = false, accountBalance = null) {
|
|
34809
|
+
function renderComposerAgentControl(control, state, adapterState, switching, availability = {}, modelView = { status: "idle" }, permissionModeView = { status: "idle" }, usage = null, accountCredits = null, locale = "en", currentCodexAccount = null, ownershipError = false, accountBalance = null, handoffAvailable = false) {
|
|
33683
34810
|
if (control.usage === null) {
|
|
33684
34811
|
control.usage = mountRendererUsageControl(control.composerId, locale);
|
|
33685
34812
|
}
|
|
@@ -33708,7 +34835,8 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
|
|
|
33708
34835
|
switching,
|
|
33709
34836
|
availability,
|
|
33710
34837
|
currentCodexAccount,
|
|
33711
|
-
ownershipError
|
|
34838
|
+
ownershipError,
|
|
34839
|
+
handoffAvailable
|
|
33712
34840
|
);
|
|
33713
34841
|
reconcileComposerNativeControls(
|
|
33714
34842
|
control,
|
|
@@ -35124,6 +36252,11 @@ ${messages.refreshModels}` : view.error ?? accessibleLabel;
|
|
|
35124
36252
|
const result = await manager.sendRequest(THREAD_FORK_METHOD, params);
|
|
35125
36253
|
return externalThreadForkResultSchema.parse(result);
|
|
35126
36254
|
},
|
|
36255
|
+
async handoffThread(input3) {
|
|
36256
|
+
const params = threadHandoffParamsSchema.parse(input3);
|
|
36257
|
+
const result = await manager.sendRequest(THREAD_HANDOFF_METHOD, params);
|
|
36258
|
+
return threadHandoffResultSchema.parse(result);
|
|
36259
|
+
},
|
|
35127
36260
|
inspectHarness,
|
|
35128
36261
|
async listSkills(params) {
|
|
35129
36262
|
return skillsListResultSchema.parse(
|
|
@@ -36871,6 +38004,846 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
36871
38004
|
};
|
|
36872
38005
|
}
|
|
36873
38006
|
|
|
38007
|
+
// src/codex-locale-adapter.ts
|
|
38008
|
+
var DEFAULT_LOCALE_REQUEST_TIMEOUT_MS = 750;
|
|
38009
|
+
function isNativeLocaleServices(value) {
|
|
38010
|
+
if (!isRecord13(value) || !Object.hasOwn(value, "appInfo")) return false;
|
|
38011
|
+
const appInfo = value.appInfo;
|
|
38012
|
+
return appInfo != null && typeof appInfo.getLocaleInfo === "function";
|
|
38013
|
+
}
|
|
38014
|
+
function isNativeSettingsServices(value) {
|
|
38015
|
+
if (!isRecord13(value) || !Object.hasOwn(value, "settings")) return false;
|
|
38016
|
+
const settings = value.settings;
|
|
38017
|
+
return typeof settings?.read === "function" && typeof settings?.write === "function";
|
|
38018
|
+
}
|
|
38019
|
+
function isRecord13(value) {
|
|
38020
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
38021
|
+
}
|
|
38022
|
+
function canonicalLocale(value) {
|
|
38023
|
+
if (typeof value !== "string" || value.trim().length === 0) return void 0;
|
|
38024
|
+
try {
|
|
38025
|
+
return Intl.getCanonicalLocales(value.trim())[0];
|
|
38026
|
+
} catch {
|
|
38027
|
+
return void 0;
|
|
38028
|
+
}
|
|
38029
|
+
}
|
|
38030
|
+
function firstNavigatorLocale(ownerWindow) {
|
|
38031
|
+
for (const candidate of ownerWindow.navigator.languages) {
|
|
38032
|
+
const locale = canonicalLocale(candidate);
|
|
38033
|
+
if (locale) return locale;
|
|
38034
|
+
}
|
|
38035
|
+
return canonicalLocale(ownerWindow.navigator.language);
|
|
38036
|
+
}
|
|
38037
|
+
function abortError2() {
|
|
38038
|
+
return new DOMException("The operation was aborted", "AbortError");
|
|
38039
|
+
}
|
|
38040
|
+
function parseLocaleOverride(response) {
|
|
38041
|
+
if (!isRecord13(response) || !Object.hasOwn(response, "effective")) {
|
|
38042
|
+
throw new Error("Codex native locale override response is malformed");
|
|
38043
|
+
}
|
|
38044
|
+
if (response.effective === null) return null;
|
|
38045
|
+
const locale = canonicalLocale(response.effective);
|
|
38046
|
+
if (!locale) throw new Error("Codex locale override is invalid");
|
|
38047
|
+
return locale;
|
|
38048
|
+
}
|
|
38049
|
+
function optionalLocale(value, field2) {
|
|
38050
|
+
if (value === void 0 || value === null) return void 0;
|
|
38051
|
+
const locale = canonicalLocale(value);
|
|
38052
|
+
if (!locale) throw new Error(`Codex ${field2} is invalid`);
|
|
38053
|
+
return locale;
|
|
38054
|
+
}
|
|
38055
|
+
function parseLocaleInfo(value) {
|
|
38056
|
+
if (!isRecord13(value)) throw new Error("Codex locale info response is malformed");
|
|
38057
|
+
return {
|
|
38058
|
+
ideLocale: optionalLocale(value.ideLocale, "IDE locale"),
|
|
38059
|
+
systemLocale: optionalLocale(value.systemLocale, "system locale")
|
|
38060
|
+
};
|
|
38061
|
+
}
|
|
38062
|
+
function requestNativeLocale(ownerWindow, signal, timeoutMs, matchesServices, invoke2) {
|
|
38063
|
+
if (signal?.aborted) return Promise.reject(abortError2());
|
|
38064
|
+
return new Promise((resolve, reject) => {
|
|
38065
|
+
let settled = false;
|
|
38066
|
+
let nativeRequest;
|
|
38067
|
+
const settle2 = (operation) => {
|
|
38068
|
+
if (settled) return;
|
|
38069
|
+
settled = true;
|
|
38070
|
+
ownerWindow.clearTimeout(timer);
|
|
38071
|
+
signal?.removeEventListener("abort", onAbort);
|
|
38072
|
+
try {
|
|
38073
|
+
nativeRequest?.[Symbol.dispose]?.();
|
|
38074
|
+
operation();
|
|
38075
|
+
} catch (error62) {
|
|
38076
|
+
reject(error62);
|
|
38077
|
+
}
|
|
38078
|
+
};
|
|
38079
|
+
const onAbort = () => settle2(() => reject(abortError2()));
|
|
38080
|
+
const timer = ownerWindow.setTimeout(
|
|
38081
|
+
() => settle2(() => reject(new Error("Codex locale request timed out"))),
|
|
38082
|
+
timeoutMs
|
|
38083
|
+
);
|
|
38084
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
38085
|
+
void (async () => {
|
|
38086
|
+
const native = await loadCodexNativeServices(ownerWindow, matchesServices);
|
|
38087
|
+
if (settled) return;
|
|
38088
|
+
if (!native) throw new Error("Codex native locale services are unavailable");
|
|
38089
|
+
nativeRequest = invoke2(native);
|
|
38090
|
+
const response = await nativeRequest;
|
|
38091
|
+
settle2(() => resolve(response));
|
|
38092
|
+
})().catch((error62) => settle2(() => reject(error62)));
|
|
38093
|
+
});
|
|
38094
|
+
}
|
|
38095
|
+
async function readCodexLocaleSettings(options = {}) {
|
|
38096
|
+
const ownerWindow = options.ownerWindow ?? window;
|
|
38097
|
+
const timeoutMs = options.timeoutMs ?? DEFAULT_LOCALE_REQUEST_TIMEOUT_MS;
|
|
38098
|
+
if (!Number.isFinite(timeoutMs) || timeoutMs <= 0) {
|
|
38099
|
+
throw new Error("Codex locale request timeout must be positive");
|
|
38100
|
+
}
|
|
38101
|
+
if (options.signal?.aborted) throw abortError2();
|
|
38102
|
+
const [overrideResult, localeInfoResult] = await Promise.allSettled([
|
|
38103
|
+
requestNativeLocale(
|
|
38104
|
+
ownerWindow,
|
|
38105
|
+
options.signal,
|
|
38106
|
+
timeoutMs,
|
|
38107
|
+
isNativeSettingsServices,
|
|
38108
|
+
(native) => native.settings.read("localeOverride")
|
|
38109
|
+
).then(parseLocaleOverride),
|
|
38110
|
+
requestNativeLocale(
|
|
38111
|
+
ownerWindow,
|
|
38112
|
+
options.signal,
|
|
38113
|
+
timeoutMs,
|
|
38114
|
+
isNativeLocaleServices,
|
|
38115
|
+
(native) => native.appInfo.getLocaleInfo()
|
|
38116
|
+
).then(parseLocaleInfo)
|
|
38117
|
+
]);
|
|
38118
|
+
if (options.signal?.aborted) throw abortError2();
|
|
38119
|
+
const navigatorLocale = firstNavigatorLocale(ownerWindow);
|
|
38120
|
+
const overrideKnown = overrideResult.status === "fulfilled";
|
|
38121
|
+
const localeOverride = overrideKnown ? overrideResult.value : void 0;
|
|
38122
|
+
const localeInfo = localeInfoResult.status === "fulfilled" ? localeInfoResult.value : { ideLocale: void 0, systemLocale: void 0 };
|
|
38123
|
+
if (typeof localeOverride === "string") {
|
|
38124
|
+
return Object.freeze({
|
|
38125
|
+
status: "ready",
|
|
38126
|
+
mode: "explicit",
|
|
38127
|
+
localeOverride,
|
|
38128
|
+
ideLocale: localeInfo.ideLocale,
|
|
38129
|
+
systemLocale: localeInfo.systemLocale,
|
|
38130
|
+
preferredLocale: localeOverride,
|
|
38131
|
+
source: "override"
|
|
38132
|
+
});
|
|
38133
|
+
}
|
|
38134
|
+
if (overrideKnown) {
|
|
38135
|
+
const preferredLocale = localeInfo.ideLocale ?? localeInfo.systemLocale ?? navigatorLocale ?? "en-US";
|
|
38136
|
+
const source = localeInfo.ideLocale ? "ide" : localeInfo.systemLocale ? "system" : navigatorLocale ? "navigator" : "default";
|
|
38137
|
+
return Object.freeze({
|
|
38138
|
+
status: "ready",
|
|
38139
|
+
mode: "automatic",
|
|
38140
|
+
localeOverride: null,
|
|
38141
|
+
ideLocale: localeInfo.ideLocale,
|
|
38142
|
+
systemLocale: localeInfo.systemLocale,
|
|
38143
|
+
preferredLocale,
|
|
38144
|
+
source
|
|
38145
|
+
});
|
|
38146
|
+
}
|
|
38147
|
+
return Object.freeze({
|
|
38148
|
+
status: "fallback",
|
|
38149
|
+
mode: "unavailable",
|
|
38150
|
+
localeOverride: void 0,
|
|
38151
|
+
ideLocale: localeInfo.ideLocale,
|
|
38152
|
+
systemLocale: localeInfo.systemLocale,
|
|
38153
|
+
preferredLocale: navigatorLocale ?? "en-US",
|
|
38154
|
+
source: navigatorLocale ? "navigator" : "default"
|
|
38155
|
+
});
|
|
38156
|
+
}
|
|
38157
|
+
|
|
38158
|
+
// src/renderer-handoff-control.ts
|
|
38159
|
+
var COMPOSER_TURN_SELECTORS = [
|
|
38160
|
+
"[data-turn-key]",
|
|
38161
|
+
"[data-content-search-turn-key]",
|
|
38162
|
+
"[data-local-conversation-item-target-ids]"
|
|
38163
|
+
];
|
|
38164
|
+
var CONVERSATION_ANCESTOR_MAX_DEPTH = 8;
|
|
38165
|
+
var POPOVER_PADDING = 8;
|
|
38166
|
+
var POPOVER_OFFSET = 8;
|
|
38167
|
+
var OWNED_TRAILING_SELECTORS = [
|
|
38168
|
+
"[data-codexhost-harness-command-control]",
|
|
38169
|
+
"[data-codexhost-usage-control]",
|
|
38170
|
+
"[data-codexhost-model-control]",
|
|
38171
|
+
"[data-codexhost-agent-control]"
|
|
38172
|
+
];
|
|
38173
|
+
function defaultResolveComposerThreadId(composer) {
|
|
38174
|
+
const portals = Array.from(composer.children ?? []).filter(
|
|
38175
|
+
(child) => child.hasAttribute("data-above-composer-portal")
|
|
38176
|
+
);
|
|
38177
|
+
if (portals.length !== 1) return null;
|
|
38178
|
+
const raw = portals[0]?.getAttribute("data-above-composer-conversation-id");
|
|
38179
|
+
if (!raw) return null;
|
|
38180
|
+
const parsed = hostThreadIdSchema.safeParse(raw);
|
|
38181
|
+
return parsed.success ? parsed.data : null;
|
|
38182
|
+
}
|
|
38183
|
+
function isComposerVisible(composer, ownerWindow) {
|
|
38184
|
+
if (!composer.isConnected) return false;
|
|
38185
|
+
if (typeof composer.closest === "function" && composer.closest('[hidden], [inert], [aria-hidden="true"]'))
|
|
38186
|
+
return false;
|
|
38187
|
+
if (typeof ownerWindow.getComputedStyle === "function") {
|
|
38188
|
+
const style2 = ownerWindow.getComputedStyle(composer);
|
|
38189
|
+
if (style2.display === "none" || style2.visibility === "hidden") return false;
|
|
38190
|
+
}
|
|
38191
|
+
return true;
|
|
38192
|
+
}
|
|
38193
|
+
function findActiveConversationComposer(ownerDocument, ownerWindow, resolveThreadId) {
|
|
38194
|
+
const composers = [...ownerDocument.querySelectorAll(CODEX_COMPOSER_SELECTOR)];
|
|
38195
|
+
for (const composer of composers) {
|
|
38196
|
+
if (orbitComposerKind(composer) !== "codex" || hasNativeComposerRequest(composer)) continue;
|
|
38197
|
+
if (!isComposerVisible(composer, ownerWindow)) continue;
|
|
38198
|
+
const threadId = resolveThreadId(composer);
|
|
38199
|
+
if (threadId) return { composer, threadId };
|
|
38200
|
+
}
|
|
38201
|
+
return null;
|
|
38202
|
+
}
|
|
38203
|
+
function findTriggerAnchor(composer) {
|
|
38204
|
+
const sendButton = sendButtonWithin(composer);
|
|
38205
|
+
if (!sendButton) return null;
|
|
38206
|
+
const trailing = trailingActionAnchor(sendButton);
|
|
38207
|
+
const parent = trailing.parentElement;
|
|
38208
|
+
if (!parent || !parent.isConnected || !composer.contains(parent)) return null;
|
|
38209
|
+
for (const selector of OWNED_TRAILING_SELECTORS) {
|
|
38210
|
+
const existing = parent.querySelector(selector);
|
|
38211
|
+
if (existing && existing.parentElement === parent) {
|
|
38212
|
+
return { parent, before: existing };
|
|
38213
|
+
}
|
|
38214
|
+
}
|
|
38215
|
+
return { parent, before: trailing };
|
|
38216
|
+
}
|
|
38217
|
+
function findConversationDividerAnchor(composer) {
|
|
38218
|
+
let ancestor = composer.parentElement;
|
|
38219
|
+
for (let depth = 0; ancestor && depth < CONVERSATION_ANCESTOR_MAX_DEPTH && ancestor !== composer.ownerDocument.body; depth += 1) {
|
|
38220
|
+
for (const selector of COMPOSER_TURN_SELECTORS) {
|
|
38221
|
+
const firstTurn = ancestor.querySelector(selector);
|
|
38222
|
+
if (firstTurn && firstTurn.parentElement && !composer.contains(firstTurn)) {
|
|
38223
|
+
return { parent: firstTurn.parentElement, before: firstTurn };
|
|
38224
|
+
}
|
|
38225
|
+
}
|
|
38226
|
+
ancestor = ancestor.parentElement;
|
|
38227
|
+
}
|
|
38228
|
+
if (composer.parentElement) {
|
|
38229
|
+
return { parent: composer.parentElement, before: composer };
|
|
38230
|
+
}
|
|
38231
|
+
return null;
|
|
38232
|
+
}
|
|
38233
|
+
function positionPopover3(popover, trigger, ownerWindow, ownerDocument) {
|
|
38234
|
+
const rect = trigger.getBoundingClientRect();
|
|
38235
|
+
const rawZoom = typeof ownerWindow.getComputedStyle === "function" ? ownerWindow.getComputedStyle(ownerDocument.documentElement).getPropertyValue("--codex-window-zoom") : "";
|
|
38236
|
+
const parsedZoom = Number.parseFloat(rawZoom.trim());
|
|
38237
|
+
const zoom = Number.isFinite(parsedZoom) && parsedZoom > 0 ? parsedZoom : 1;
|
|
38238
|
+
const viewportWidth = (ownerWindow.innerWidth || 1024) / zoom;
|
|
38239
|
+
const viewportHeight = (ownerWindow.innerHeight || 768) / zoom;
|
|
38240
|
+
const width = Math.min(HANDOFF_POPOVER_WIDTH, Math.max(220, viewportWidth - POPOVER_PADDING * 2));
|
|
38241
|
+
const left = Math.max(
|
|
38242
|
+
POPOVER_PADDING,
|
|
38243
|
+
Math.min(rect.right / zoom - width, viewportWidth - width - POPOVER_PADDING)
|
|
38244
|
+
);
|
|
38245
|
+
const bottom = Math.max(POPOVER_PADDING, viewportHeight - rect.top / zoom + POPOVER_OFFSET);
|
|
38246
|
+
popover.style.width = `${width}px`;
|
|
38247
|
+
popover.style.left = `${left}px`;
|
|
38248
|
+
popover.style.bottom = `${bottom}px`;
|
|
38249
|
+
}
|
|
38250
|
+
function errorDetail(error62, fallback) {
|
|
38251
|
+
if (error62 instanceof Error && error62.message.trim().length > 0) {
|
|
38252
|
+
return `${fallback}: ${error62.message.trim()}`;
|
|
38253
|
+
}
|
|
38254
|
+
return fallback;
|
|
38255
|
+
}
|
|
38256
|
+
function installRendererHandoffControl(options) {
|
|
38257
|
+
const ownerDocument = options.document ?? (typeof document !== "undefined" ? document : void 0);
|
|
38258
|
+
const ownerWindow = options.window ?? (typeof window !== "undefined" ? window : void 0);
|
|
38259
|
+
if (!ownerDocument || !ownerWindow || typeof ownerDocument.querySelectorAll !== "function" || !ownerDocument.documentElement) {
|
|
38260
|
+
return {
|
|
38261
|
+
refresh() {
|
|
38262
|
+
},
|
|
38263
|
+
canOpenForComposer() {
|
|
38264
|
+
return false;
|
|
38265
|
+
},
|
|
38266
|
+
openForComposer() {
|
|
38267
|
+
return false;
|
|
38268
|
+
},
|
|
38269
|
+
dispose() {
|
|
38270
|
+
}
|
|
38271
|
+
};
|
|
38272
|
+
}
|
|
38273
|
+
const mountTrigger = options.mountTrigger !== false;
|
|
38274
|
+
const resolveThreadId = options.resolveComposerThreadId ?? defaultResolveComposerThreadId;
|
|
38275
|
+
const openThread = options.openThread ?? ((threadId, openOptions) => openRendererThread(threadId, openOptions));
|
|
38276
|
+
let disposed = false;
|
|
38277
|
+
let locale = options.getLocale?.() ?? resolveRendererSettingsLocale(
|
|
38278
|
+
ownerWindow.navigator?.languages ?? [ownerWindow.navigator?.language ?? "en"]
|
|
38279
|
+
);
|
|
38280
|
+
const currentLocale = () => options.getLocale?.() ?? locale;
|
|
38281
|
+
let activeComposer = null;
|
|
38282
|
+
let activeThreadId = null;
|
|
38283
|
+
let activeHostId = null;
|
|
38284
|
+
let triggerRoot = null;
|
|
38285
|
+
let triggerButton = null;
|
|
38286
|
+
let dividerElement = null;
|
|
38287
|
+
let dividerKey = null;
|
|
38288
|
+
const handoffCache = /* @__PURE__ */ new Map();
|
|
38289
|
+
const threadOwnerHarness = /* @__PURE__ */ new Map();
|
|
38290
|
+
const inFlightInspects = /* @__PURE__ */ new Map();
|
|
38291
|
+
const pluginsByHost = /* @__PURE__ */ new Map();
|
|
38292
|
+
const pluginsLoadingByHost = /* @__PURE__ */ new Map();
|
|
38293
|
+
const harnessCatalogCache = /* @__PURE__ */ new Map();
|
|
38294
|
+
const harnessInspectInFlight = /* @__PURE__ */ new Set();
|
|
38295
|
+
let popoverState = null;
|
|
38296
|
+
const hostScopeKey = (hostId2) => hostId2 ?? "default";
|
|
38297
|
+
const cacheKeyFor = (hostId2, threadId) => `${hostScopeKey(hostId2)}\0${threadId}`;
|
|
38298
|
+
const catalogCacheKey = (hostId2, harnessId) => `${hostScopeKey(hostId2)}\0${harnessId}`;
|
|
38299
|
+
const clientForHost = (hostId2) => {
|
|
38300
|
+
const base = options.getClient();
|
|
38301
|
+
if (!base) return null;
|
|
38302
|
+
if (hostId2 === null) return options.getHostId && base.clientForHost ? null : base;
|
|
38303
|
+
if (base.clientForHost) return base.clientForHost(hostId2);
|
|
38304
|
+
if (!base.currentHostId) return hostId2 === "local" ? base : null;
|
|
38305
|
+
return base.currentHostId() === hostId2 ? base : null;
|
|
38306
|
+
};
|
|
38307
|
+
const pluginsForHost = (hostId2) => pluginsByHost.get(hostScopeKey(hostId2)) ?? [];
|
|
38308
|
+
const unmountDivider = () => {
|
|
38309
|
+
dividerElement?.remove();
|
|
38310
|
+
dividerElement = null;
|
|
38311
|
+
dividerKey = null;
|
|
38312
|
+
};
|
|
38313
|
+
const unmountTrigger = () => {
|
|
38314
|
+
triggerRoot?.remove();
|
|
38315
|
+
triggerRoot = null;
|
|
38316
|
+
triggerButton = null;
|
|
38317
|
+
};
|
|
38318
|
+
const closePopover3 = () => {
|
|
38319
|
+
if (!popoverState) return;
|
|
38320
|
+
popoverState.element.remove();
|
|
38321
|
+
popoverState = null;
|
|
38322
|
+
triggerButton?.setAttribute("aria-expanded", "false");
|
|
38323
|
+
triggerButton?.removeAttribute("data-state");
|
|
38324
|
+
};
|
|
38325
|
+
const availableHarnesses = (hostId2) => [
|
|
38326
|
+
{ id: "codex", label: "Codex" },
|
|
38327
|
+
...pluginsForHost(hostId2).map((plugin) => ({
|
|
38328
|
+
id: plugin.id,
|
|
38329
|
+
label: rendererAgentLabel(plugin.id, plugin),
|
|
38330
|
+
plugin
|
|
38331
|
+
}))
|
|
38332
|
+
];
|
|
38333
|
+
const loadPlugins = async (client, hostId2) => {
|
|
38334
|
+
const scope = hostScopeKey(hostId2);
|
|
38335
|
+
if (pluginsByHost.has(scope) || !client.listHarnessPlugins) return;
|
|
38336
|
+
const existing = pluginsLoadingByHost.get(scope);
|
|
38337
|
+
if (existing) return existing;
|
|
38338
|
+
const request = (async () => {
|
|
38339
|
+
try {
|
|
38340
|
+
const result = await client.listHarnessPlugins?.();
|
|
38341
|
+
if (disposed || !result) return;
|
|
38342
|
+
pluginsByHost.set(
|
|
38343
|
+
scope,
|
|
38344
|
+
result.plugins.filter(({ kind }) => kind !== "usage")
|
|
38345
|
+
);
|
|
38346
|
+
if (popoverState && hostScopeKey(popoverState.hostId) === scope) renderPopover();
|
|
38347
|
+
if (activeThreadId && hostScopeKey(activeHostId) === scope) syncDivider();
|
|
38348
|
+
} catch {
|
|
38349
|
+
} finally {
|
|
38350
|
+
pluginsLoadingByHost.delete(scope);
|
|
38351
|
+
}
|
|
38352
|
+
})();
|
|
38353
|
+
pluginsLoadingByHost.set(scope, request);
|
|
38354
|
+
return request;
|
|
38355
|
+
};
|
|
38356
|
+
const loadHarnessCatalog = (hostId2, harnessId) => {
|
|
38357
|
+
const key2 = catalogCacheKey(hostId2, harnessId);
|
|
38358
|
+
if (harnessId === "codex" || harnessCatalogCache.has(key2)) return;
|
|
38359
|
+
if (harnessInspectInFlight.has(key2)) return;
|
|
38360
|
+
const client = clientForHost(hostId2);
|
|
38361
|
+
if (!client) return;
|
|
38362
|
+
const parsedId = harnessIdSchema.safeParse(harnessId);
|
|
38363
|
+
if (!parsedId.success) return;
|
|
38364
|
+
harnessInspectInFlight.add(key2);
|
|
38365
|
+
if (popoverState?.selectedHarnessId === harnessId && popoverState.hostId === hostId2) {
|
|
38366
|
+
renderPopover();
|
|
38367
|
+
}
|
|
38368
|
+
void client.inspectHarness({ harnessId: parsedId.data }).then((inspection) => {
|
|
38369
|
+
if (disposed) return;
|
|
38370
|
+
harnessCatalogCache.set(
|
|
38371
|
+
key2,
|
|
38372
|
+
inspection.status === "ready" ? inspection.catalog ?? null : null
|
|
38373
|
+
);
|
|
38374
|
+
}).catch(() => {
|
|
38375
|
+
if (!disposed) harnessCatalogCache.set(key2, null);
|
|
38376
|
+
}).finally(() => {
|
|
38377
|
+
harnessInspectInFlight.delete(key2);
|
|
38378
|
+
if (!disposed && popoverState?.selectedHarnessId === harnessId && popoverState.hostId === hostId2) {
|
|
38379
|
+
renderPopover();
|
|
38380
|
+
}
|
|
38381
|
+
});
|
|
38382
|
+
};
|
|
38383
|
+
const submitHandoff = () => {
|
|
38384
|
+
const state = popoverState;
|
|
38385
|
+
if (!state || state.submitting) return;
|
|
38386
|
+
const targetHostId = state.hostId;
|
|
38387
|
+
const openCreatedTarget = async (createdThreadId) => {
|
|
38388
|
+
await openThread(createdThreadId, targetHostId ? { hostId: targetHostId } : void 0);
|
|
38389
|
+
if (disposed) return;
|
|
38390
|
+
if (popoverState === state) closePopover3();
|
|
38391
|
+
};
|
|
38392
|
+
if (state.createdThreadId) {
|
|
38393
|
+
state.submitting = true;
|
|
38394
|
+
state.errorMessage = null;
|
|
38395
|
+
renderPopover();
|
|
38396
|
+
void openCreatedTarget(state.createdThreadId).catch((error62) => {
|
|
38397
|
+
if (disposed) return;
|
|
38398
|
+
options.reportError?.(error62);
|
|
38399
|
+
if (popoverState === state) {
|
|
38400
|
+
state.submitting = false;
|
|
38401
|
+
state.errorMessage = errorDetail(
|
|
38402
|
+
error62,
|
|
38403
|
+
rendererHarnessMessages(currentLocale()).handoffFailed
|
|
38404
|
+
);
|
|
38405
|
+
renderPopover();
|
|
38406
|
+
}
|
|
38407
|
+
});
|
|
38408
|
+
return;
|
|
38409
|
+
}
|
|
38410
|
+
const client = clientForHost(targetHostId);
|
|
38411
|
+
if (!client) {
|
|
38412
|
+
state.errorMessage = rendererHarnessMessages(currentLocale()).handoffFailed;
|
|
38413
|
+
renderPopover();
|
|
38414
|
+
return;
|
|
38415
|
+
}
|
|
38416
|
+
const parsedHarness = harnessIdSchema.safeParse(state.selectedHarnessId);
|
|
38417
|
+
if (!parsedHarness.success) {
|
|
38418
|
+
state.errorMessage = rendererHarnessMessages(currentLocale()).handoffFailed;
|
|
38419
|
+
renderPopover();
|
|
38420
|
+
return;
|
|
38421
|
+
}
|
|
38422
|
+
state.submitting = true;
|
|
38423
|
+
state.errorMessage = null;
|
|
38424
|
+
renderPopover();
|
|
38425
|
+
void client.handoffThread({
|
|
38426
|
+
sourceThreadId: state.threadId,
|
|
38427
|
+
targetHarnessId: parsedHarness.data,
|
|
38428
|
+
...state.selectedModelId ? { targetModel: state.selectedModelId } : {},
|
|
38429
|
+
...state.selectedThinkingOptionId ? { targetThinkingOptionId: state.selectedThinkingOptionId } : {}
|
|
38430
|
+
}).then(async (result) => {
|
|
38431
|
+
if (disposed) return;
|
|
38432
|
+
handoffCache.set(cacheKeyFor(targetHostId, result.threadId), result.handoff);
|
|
38433
|
+
threadOwnerHarness.set(
|
|
38434
|
+
cacheKeyFor(targetHostId, result.threadId),
|
|
38435
|
+
result.handoff.targetHarnessId
|
|
38436
|
+
);
|
|
38437
|
+
state.createdThreadId = result.threadId;
|
|
38438
|
+
await openCreatedTarget(result.threadId);
|
|
38439
|
+
}).catch((error62) => {
|
|
38440
|
+
if (disposed) return;
|
|
38441
|
+
options.reportError?.(error62);
|
|
38442
|
+
if (popoverState === state) {
|
|
38443
|
+
state.submitting = false;
|
|
38444
|
+
state.errorMessage = errorDetail(
|
|
38445
|
+
error62,
|
|
38446
|
+
rendererHarnessMessages(currentLocale()).handoffFailed
|
|
38447
|
+
);
|
|
38448
|
+
renderPopover();
|
|
38449
|
+
}
|
|
38450
|
+
});
|
|
38451
|
+
};
|
|
38452
|
+
const renderPopover = () => {
|
|
38453
|
+
const state = popoverState;
|
|
38454
|
+
if (!state) return;
|
|
38455
|
+
const harnesses = availableHarnesses(state.hostId);
|
|
38456
|
+
const pluginsLoaded = pluginsByHost.has(hostScopeKey(state.hostId));
|
|
38457
|
+
if ((!state.explicitTargetHarness || pluginsLoaded) && !harnesses.some(({ id: id2 }) => id2 === state.selectedHarnessId) && harnesses[0]) {
|
|
38458
|
+
state.selectedHarnessId = harnesses[0].id;
|
|
38459
|
+
}
|
|
38460
|
+
const key2 = catalogCacheKey(state.hostId, state.selectedHarnessId);
|
|
38461
|
+
const catalog = harnessCatalogCache.get(key2) ?? void 0;
|
|
38462
|
+
const loadingModels = harnessInspectInFlight.has(key2);
|
|
38463
|
+
renderHandoffPopoverContent(state.element, {
|
|
38464
|
+
ownerDocument,
|
|
38465
|
+
locale: currentLocale(),
|
|
38466
|
+
harnesses,
|
|
38467
|
+
selectedHarnessId: state.selectedHarnessId,
|
|
38468
|
+
catalog,
|
|
38469
|
+
loadingModels,
|
|
38470
|
+
selectedModelId: state.selectedModelId,
|
|
38471
|
+
selectedThinkingOptionId: state.selectedThinkingOptionId,
|
|
38472
|
+
submitting: state.submitting,
|
|
38473
|
+
errorMessage: state.errorMessage,
|
|
38474
|
+
onSelectHarness: (harnessId) => {
|
|
38475
|
+
if (state.selectedHarnessId === harnessId) return;
|
|
38476
|
+
state.selectedHarnessId = harnessId;
|
|
38477
|
+
state.selectedModelId = "";
|
|
38478
|
+
state.selectedThinkingOptionId = "";
|
|
38479
|
+
state.errorMessage = null;
|
|
38480
|
+
state.createdThreadId = null;
|
|
38481
|
+
loadHarnessCatalog(state.hostId, harnessId);
|
|
38482
|
+
renderPopover();
|
|
38483
|
+
},
|
|
38484
|
+
onSelectModel: (modelId2) => {
|
|
38485
|
+
state.selectedModelId = modelId2;
|
|
38486
|
+
state.selectedThinkingOptionId = "";
|
|
38487
|
+
state.createdThreadId = null;
|
|
38488
|
+
renderPopover();
|
|
38489
|
+
},
|
|
38490
|
+
onSelectThinking: (thinkingId) => {
|
|
38491
|
+
state.selectedThinkingOptionId = thinkingId;
|
|
38492
|
+
state.createdThreadId = null;
|
|
38493
|
+
renderPopover();
|
|
38494
|
+
},
|
|
38495
|
+
onConfirm: submitHandoff,
|
|
38496
|
+
onCancel: closePopover3
|
|
38497
|
+
});
|
|
38498
|
+
const anchor2 = state.anchor ?? triggerButton;
|
|
38499
|
+
if (anchor2) {
|
|
38500
|
+
positionPopover3(state.element, anchor2, ownerWindow, ownerDocument);
|
|
38501
|
+
}
|
|
38502
|
+
};
|
|
38503
|
+
const openPopoverFor = (params) => {
|
|
38504
|
+
if (disposed || !params.anchor) return false;
|
|
38505
|
+
if (popoverState) {
|
|
38506
|
+
const sameToggle = params.toggleIfSameAnchor === true && popoverState.threadId === params.threadId && popoverState.anchor === params.anchor;
|
|
38507
|
+
closePopover3();
|
|
38508
|
+
if (sameToggle) return true;
|
|
38509
|
+
}
|
|
38510
|
+
const targetHostId = params.hostId;
|
|
38511
|
+
const client = clientForHost(targetHostId);
|
|
38512
|
+
const currentKey = cacheKeyFor(targetHostId, params.threadId);
|
|
38513
|
+
const currentOwner = threadOwnerHarness.get(currentKey);
|
|
38514
|
+
const harnesses = availableHarnesses(targetHostId);
|
|
38515
|
+
const explicitTarget = typeof params.targetHarnessId === "string" && params.targetHarnessId.trim().length > 0 ? params.targetHarnessId.trim() : void 0;
|
|
38516
|
+
const defaultTarget = explicitTarget ?? harnesses.find(({ id: id2 }) => id2 !== currentOwner)?.id ?? harnesses[0]?.id ?? "codex";
|
|
38517
|
+
const element = ownerDocument.createElement("div");
|
|
38518
|
+
element.setAttribute(HANDOFF_POPOVER_ATTRIBUTE, "true");
|
|
38519
|
+
(ownerDocument.body ?? ownerDocument.documentElement).append(element);
|
|
38520
|
+
popoverState = {
|
|
38521
|
+
element,
|
|
38522
|
+
anchor: params.anchor,
|
|
38523
|
+
threadId: params.threadId,
|
|
38524
|
+
hostId: targetHostId,
|
|
38525
|
+
explicitTargetHarness: explicitTarget !== void 0,
|
|
38526
|
+
selectedHarnessId: defaultTarget,
|
|
38527
|
+
selectedModelId: "",
|
|
38528
|
+
selectedThinkingOptionId: "",
|
|
38529
|
+
submitting: false,
|
|
38530
|
+
errorMessage: null,
|
|
38531
|
+
createdThreadId: null
|
|
38532
|
+
};
|
|
38533
|
+
if (params.anchor === triggerButton && triggerButton) {
|
|
38534
|
+
triggerButton.setAttribute("aria-expanded", "true");
|
|
38535
|
+
triggerButton.setAttribute("data-state", "open");
|
|
38536
|
+
}
|
|
38537
|
+
renderPopover();
|
|
38538
|
+
if (client) {
|
|
38539
|
+
void loadPlugins(client, targetHostId).then(() => {
|
|
38540
|
+
if (!disposed && popoverState && popoverState.hostId === targetHostId) {
|
|
38541
|
+
const updatedHarnesses = availableHarnesses(targetHostId);
|
|
38542
|
+
if (!popoverState.explicitTargetHarness && popoverState.selectedHarnessId === currentOwner && updatedHarnesses.some(({ id: id2 }) => id2 !== currentOwner)) {
|
|
38543
|
+
popoverState.selectedHarnessId = updatedHarnesses.find(({ id: id2 }) => id2 !== currentOwner)?.id ?? popoverState.selectedHarnessId;
|
|
38544
|
+
}
|
|
38545
|
+
loadHarnessCatalog(targetHostId, popoverState.selectedHarnessId);
|
|
38546
|
+
renderPopover();
|
|
38547
|
+
}
|
|
38548
|
+
});
|
|
38549
|
+
}
|
|
38550
|
+
loadHarnessCatalog(targetHostId, defaultTarget);
|
|
38551
|
+
return true;
|
|
38552
|
+
};
|
|
38553
|
+
const openPopover3 = () => {
|
|
38554
|
+
if (!activeThreadId || !triggerButton) return;
|
|
38555
|
+
openPopoverFor({
|
|
38556
|
+
threadId: activeThreadId,
|
|
38557
|
+
hostId: activeHostId,
|
|
38558
|
+
anchor: triggerButton,
|
|
38559
|
+
toggleIfSameAnchor: true
|
|
38560
|
+
});
|
|
38561
|
+
};
|
|
38562
|
+
const canOpenForComposer = (composer) => {
|
|
38563
|
+
const sendButton = sendButtonWithin(composer);
|
|
38564
|
+
if (disposed || orbitComposerKind(composer) !== "codex" || hasNativeComposerRequest(composer) || !isComposerVisible(composer, ownerWindow) || !sendButton || !isComposerVisible(sendButton, ownerWindow) || !resolveThreadId(composer))
|
|
38565
|
+
return false;
|
|
38566
|
+
const hasStop = [...composer.querySelectorAll("button")].some(
|
|
38567
|
+
(button2) => isComposerVisible(button2, ownerWindow) && /^(stop|stop generating|stop streaming|停止|停止生成|停止响应)$/iu.test(
|
|
38568
|
+
button2.getAttribute("aria-label")?.trim() || button2.getAttribute("title")?.trim() || ""
|
|
38569
|
+
)
|
|
38570
|
+
);
|
|
38571
|
+
return !hasStop && clientForHost(options.getHostId?.(composer) ?? null) !== null;
|
|
38572
|
+
};
|
|
38573
|
+
const openForComposer = (composer, openOptions) => {
|
|
38574
|
+
if (!canOpenForComposer(composer)) return false;
|
|
38575
|
+
const threadId = resolveThreadId(composer);
|
|
38576
|
+
if (!threadId) return false;
|
|
38577
|
+
const hostId2 = options.getHostId?.(composer) ?? null;
|
|
38578
|
+
const anchor2 = openOptions?.anchor ?? triggerButton;
|
|
38579
|
+
if (!anchor2) return false;
|
|
38580
|
+
return openPopoverFor({
|
|
38581
|
+
threadId,
|
|
38582
|
+
hostId: hostId2,
|
|
38583
|
+
anchor: anchor2,
|
|
38584
|
+
...openOptions?.targetHarnessId === void 0 ? {} : { targetHarnessId: openOptions.targetHarnessId }
|
|
38585
|
+
});
|
|
38586
|
+
};
|
|
38587
|
+
const ensureTriggerMounted = (composer) => {
|
|
38588
|
+
if (!mountTrigger) {
|
|
38589
|
+
unmountTrigger();
|
|
38590
|
+
return;
|
|
38591
|
+
}
|
|
38592
|
+
const anchor2 = findTriggerAnchor(composer);
|
|
38593
|
+
if (!anchor2) {
|
|
38594
|
+
unmountTrigger();
|
|
38595
|
+
return;
|
|
38596
|
+
}
|
|
38597
|
+
ensureRendererTriggerChipStyle(ownerDocument);
|
|
38598
|
+
ensureRendererHandoffStyle(ownerDocument);
|
|
38599
|
+
const messages = rendererHarnessMessages(currentLocale());
|
|
38600
|
+
if (!triggerRoot || !triggerButton) {
|
|
38601
|
+
const root = ownerDocument.createElement("div");
|
|
38602
|
+
root.setAttribute(HANDOFF_CONTROL_ATTRIBUTE, "true");
|
|
38603
|
+
const button2 = ownerDocument.createElement("button");
|
|
38604
|
+
button2.type = "button";
|
|
38605
|
+
button2.className = TRIGGER_CHIP_CLASS;
|
|
38606
|
+
button2.setAttribute("aria-haspopup", "dialog");
|
|
38607
|
+
button2.setAttribute("aria-expanded", "false");
|
|
38608
|
+
button2.setAttribute("data-codexhost-handoff-trigger", "true");
|
|
38609
|
+
Object.assign(button2.style, {
|
|
38610
|
+
width: "28px",
|
|
38611
|
+
height: "28px",
|
|
38612
|
+
padding: "0"
|
|
38613
|
+
});
|
|
38614
|
+
button2.append(createSwapIcon(ownerDocument, 14));
|
|
38615
|
+
button2.addEventListener("click", (event) => {
|
|
38616
|
+
event.stopPropagation();
|
|
38617
|
+
openPopover3();
|
|
38618
|
+
});
|
|
38619
|
+
root.append(button2);
|
|
38620
|
+
triggerRoot = root;
|
|
38621
|
+
triggerButton = button2;
|
|
38622
|
+
}
|
|
38623
|
+
triggerButton.setAttribute("aria-label", messages.handoffAction);
|
|
38624
|
+
triggerButton.title = messages.handoffAction;
|
|
38625
|
+
if (triggerRoot.parentElement !== anchor2.parent || triggerRoot.nextElementSibling !== anchor2.before) {
|
|
38626
|
+
anchor2.parent.insertBefore(triggerRoot, anchor2.before);
|
|
38627
|
+
}
|
|
38628
|
+
};
|
|
38629
|
+
const syncDivider = () => {
|
|
38630
|
+
if (!activeComposer || !activeThreadId) {
|
|
38631
|
+
unmountDivider();
|
|
38632
|
+
return;
|
|
38633
|
+
}
|
|
38634
|
+
const key2 = cacheKeyFor(activeHostId, activeThreadId);
|
|
38635
|
+
const handoff2 = handoffCache.get(key2);
|
|
38636
|
+
if (!handoff2) {
|
|
38637
|
+
unmountDivider();
|
|
38638
|
+
return;
|
|
38639
|
+
}
|
|
38640
|
+
const anchor2 = findConversationDividerAnchor(activeComposer);
|
|
38641
|
+
if (!anchor2) {
|
|
38642
|
+
unmountDivider();
|
|
38643
|
+
return;
|
|
38644
|
+
}
|
|
38645
|
+
const plugins = pluginsForHost(activeHostId);
|
|
38646
|
+
const renderSignature = JSON.stringify([
|
|
38647
|
+
key2,
|
|
38648
|
+
currentLocale(),
|
|
38649
|
+
handoff2.createdAtMs,
|
|
38650
|
+
plugins.map(({ id: id2, name, icon: icon2 }) => [id2, name, icon2])
|
|
38651
|
+
]);
|
|
38652
|
+
if (!dividerElement || dividerKey !== renderSignature) {
|
|
38653
|
+
const wasExpanded = dividerElement?.querySelector("[data-codexhost-handoff-divider-toggle]")?.getAttribute("aria-expanded") === "true";
|
|
38654
|
+
dividerElement?.remove();
|
|
38655
|
+
const targetHostId = activeHostId;
|
|
38656
|
+
dividerElement = createHandoffDividerElement({
|
|
38657
|
+
ownerDocument,
|
|
38658
|
+
handoff: handoff2,
|
|
38659
|
+
plugins,
|
|
38660
|
+
locale: currentLocale(),
|
|
38661
|
+
initiallyExpanded: wasExpanded,
|
|
38662
|
+
onOpenSourceThread: (sourceThreadId) => {
|
|
38663
|
+
void openThread(
|
|
38664
|
+
sourceThreadId,
|
|
38665
|
+
targetHostId ? { hostId: targetHostId } : void 0
|
|
38666
|
+
).catch((error62) => options.reportError?.(error62));
|
|
38667
|
+
}
|
|
38668
|
+
});
|
|
38669
|
+
dividerKey = renderSignature;
|
|
38670
|
+
}
|
|
38671
|
+
if (dividerElement.parentElement !== anchor2.parent || dividerElement.nextElementSibling !== anchor2.before) {
|
|
38672
|
+
anchor2.parent.insertBefore(dividerElement, anchor2.before);
|
|
38673
|
+
}
|
|
38674
|
+
};
|
|
38675
|
+
const ensureThreadInspected = (threadId, hostId2) => {
|
|
38676
|
+
const key2 = cacheKeyFor(hostId2, threadId);
|
|
38677
|
+
if (handoffCache.has(key2) || inFlightInspects.has(key2)) return;
|
|
38678
|
+
const client = clientForHost(hostId2);
|
|
38679
|
+
if (!client) return;
|
|
38680
|
+
const request = (async () => {
|
|
38681
|
+
try {
|
|
38682
|
+
const inspection = await client.inspectThread({ threadId });
|
|
38683
|
+
if (disposed) return;
|
|
38684
|
+
threadOwnerHarness.set(
|
|
38685
|
+
key2,
|
|
38686
|
+
inspection.owner === "external" ? inspection.harnessId : "codex"
|
|
38687
|
+
);
|
|
38688
|
+
const handoff2 = inspection.handoff ?? null;
|
|
38689
|
+
handoffCache.set(key2, handoff2);
|
|
38690
|
+
if (handoff2) {
|
|
38691
|
+
void loadPlugins(client, hostId2);
|
|
38692
|
+
}
|
|
38693
|
+
if (activeThreadId === threadId && activeHostId === hostId2) {
|
|
38694
|
+
syncDivider();
|
|
38695
|
+
}
|
|
38696
|
+
} catch {
|
|
38697
|
+
} finally {
|
|
38698
|
+
inFlightInspects.delete(key2);
|
|
38699
|
+
}
|
|
38700
|
+
})();
|
|
38701
|
+
inFlightInspects.set(key2, request);
|
|
38702
|
+
};
|
|
38703
|
+
const refresh = () => {
|
|
38704
|
+
if (disposed) return;
|
|
38705
|
+
const active2 = findActiveConversationComposer(ownerDocument, ownerWindow, resolveThreadId);
|
|
38706
|
+
if (!active2) {
|
|
38707
|
+
activeComposer = null;
|
|
38708
|
+
activeThreadId = null;
|
|
38709
|
+
activeHostId = null;
|
|
38710
|
+
closePopover3();
|
|
38711
|
+
unmountTrigger();
|
|
38712
|
+
unmountDivider();
|
|
38713
|
+
return;
|
|
38714
|
+
}
|
|
38715
|
+
const hostId2 = options.getHostId?.(active2.composer) ?? null;
|
|
38716
|
+
const threadChanged = active2.threadId !== activeThreadId || hostId2 !== activeHostId;
|
|
38717
|
+
activeComposer = active2.composer;
|
|
38718
|
+
activeThreadId = active2.threadId;
|
|
38719
|
+
activeHostId = hostId2;
|
|
38720
|
+
if (threadChanged) {
|
|
38721
|
+
closePopover3();
|
|
38722
|
+
unmountDivider();
|
|
38723
|
+
}
|
|
38724
|
+
ensureTriggerMounted(active2.composer);
|
|
38725
|
+
ensureThreadInspected(active2.threadId, hostId2);
|
|
38726
|
+
syncDivider();
|
|
38727
|
+
};
|
|
38728
|
+
let frameId = null;
|
|
38729
|
+
let timerId = null;
|
|
38730
|
+
const scheduleRefresh = () => {
|
|
38731
|
+
if (disposed || frameId !== null || timerId !== null) return;
|
|
38732
|
+
if (typeof ownerWindow.requestAnimationFrame === "function") {
|
|
38733
|
+
frameId = ownerWindow.requestAnimationFrame(() => {
|
|
38734
|
+
frameId = null;
|
|
38735
|
+
refresh();
|
|
38736
|
+
});
|
|
38737
|
+
} else {
|
|
38738
|
+
timerId = setTimeout(() => {
|
|
38739
|
+
timerId = null;
|
|
38740
|
+
refresh();
|
|
38741
|
+
}, 0);
|
|
38742
|
+
}
|
|
38743
|
+
};
|
|
38744
|
+
const refreshLocale = () => {
|
|
38745
|
+
if (disposed || options.getLocale) return;
|
|
38746
|
+
void readCodexLocaleSettings({ ownerWindow }).then((settings) => {
|
|
38747
|
+
if (disposed) return;
|
|
38748
|
+
const next = resolveRendererSettingsLocale([settings.preferredLocale]);
|
|
38749
|
+
if (next === locale) return;
|
|
38750
|
+
locale = next;
|
|
38751
|
+
if (triggerButton) {
|
|
38752
|
+
const messages = rendererHarnessMessages(locale);
|
|
38753
|
+
triggerButton.setAttribute("aria-label", messages.handoffAction);
|
|
38754
|
+
triggerButton.title = messages.handoffAction;
|
|
38755
|
+
}
|
|
38756
|
+
if (popoverState) renderPopover();
|
|
38757
|
+
syncDivider();
|
|
38758
|
+
}).catch(() => void 0);
|
|
38759
|
+
};
|
|
38760
|
+
const onDocumentPointerDown = (event) => {
|
|
38761
|
+
if (!popoverState) return;
|
|
38762
|
+
const target2 = event.target instanceof Node ? event.target : null;
|
|
38763
|
+
if (!target2) return;
|
|
38764
|
+
if (popoverState.element.contains(target2) || triggerRoot?.contains(target2)) return;
|
|
38765
|
+
closePopover3();
|
|
38766
|
+
};
|
|
38767
|
+
const onDocumentKeyDown = (event) => {
|
|
38768
|
+
if (event.key === "Escape" && popoverState && !popoverState.submitting) {
|
|
38769
|
+
const returnFocus = popoverState.anchor ?? triggerButton;
|
|
38770
|
+
closePopover3();
|
|
38771
|
+
returnFocus?.focus();
|
|
38772
|
+
}
|
|
38773
|
+
};
|
|
38774
|
+
const onWindowResize = () => {
|
|
38775
|
+
const anchor2 = popoverState?.anchor ?? triggerButton;
|
|
38776
|
+
if (popoverState && anchor2) {
|
|
38777
|
+
positionPopover3(popoverState.element, anchor2, ownerWindow, ownerDocument);
|
|
38778
|
+
}
|
|
38779
|
+
};
|
|
38780
|
+
const onWindowFocus = () => {
|
|
38781
|
+
refreshLocale();
|
|
38782
|
+
scheduleRefresh();
|
|
38783
|
+
};
|
|
38784
|
+
const onRoutingChanged = () => {
|
|
38785
|
+
scheduleRefresh();
|
|
38786
|
+
};
|
|
38787
|
+
const observer = typeof MutationObserver === "function" ? new MutationObserver((mutations) => {
|
|
38788
|
+
if (disposed) return;
|
|
38789
|
+
for (const mutation of mutations) {
|
|
38790
|
+
const target2 = mutation.target;
|
|
38791
|
+
if (target2 instanceof Element && (target2.closest(`[${HANDOFF_DIVIDER_ATTRIBUTE}]`) || target2.closest(`[${HANDOFF_POPOVER_ATTRIBUTE}]`) || target2.closest(`[${HANDOFF_CONTROL_ATTRIBUTE}]`))) {
|
|
38792
|
+
continue;
|
|
38793
|
+
}
|
|
38794
|
+
scheduleRefresh();
|
|
38795
|
+
return;
|
|
38796
|
+
}
|
|
38797
|
+
}) : null;
|
|
38798
|
+
observer?.observe(ownerDocument.documentElement, {
|
|
38799
|
+
childList: true,
|
|
38800
|
+
subtree: true,
|
|
38801
|
+
attributes: true,
|
|
38802
|
+
attributeFilter: ["data-above-composer-conversation-id", "hidden", "aria-hidden"]
|
|
38803
|
+
});
|
|
38804
|
+
ownerDocument.addEventListener?.("pointerdown", onDocumentPointerDown, true);
|
|
38805
|
+
ownerDocument.addEventListener?.("keydown", onDocumentKeyDown, true);
|
|
38806
|
+
ownerWindow.addEventListener?.("resize", onWindowResize);
|
|
38807
|
+
ownerWindow.addEventListener?.("focus", onWindowFocus);
|
|
38808
|
+
ownerWindow.addEventListener?.("codexhost:draft-prewarm-policy-changed", onRoutingChanged);
|
|
38809
|
+
refreshLocale();
|
|
38810
|
+
refresh();
|
|
38811
|
+
return {
|
|
38812
|
+
refresh,
|
|
38813
|
+
openForComposer,
|
|
38814
|
+
canOpenForComposer,
|
|
38815
|
+
dispose() {
|
|
38816
|
+
if (disposed) return;
|
|
38817
|
+
disposed = true;
|
|
38818
|
+
observer?.disconnect();
|
|
38819
|
+
if (frameId !== null && typeof ownerWindow.cancelAnimationFrame === "function") {
|
|
38820
|
+
ownerWindow.cancelAnimationFrame(frameId);
|
|
38821
|
+
}
|
|
38822
|
+
if (timerId !== null) clearTimeout(timerId);
|
|
38823
|
+
frameId = null;
|
|
38824
|
+
timerId = null;
|
|
38825
|
+
ownerDocument.removeEventListener?.("pointerdown", onDocumentPointerDown, true);
|
|
38826
|
+
ownerDocument.removeEventListener?.("keydown", onDocumentKeyDown, true);
|
|
38827
|
+
ownerWindow.removeEventListener?.("resize", onWindowResize);
|
|
38828
|
+
ownerWindow.removeEventListener?.("focus", onWindowFocus);
|
|
38829
|
+
ownerWindow.removeEventListener?.("codexhost:draft-prewarm-policy-changed", onRoutingChanged);
|
|
38830
|
+
closePopover3();
|
|
38831
|
+
unmountTrigger();
|
|
38832
|
+
unmountDivider();
|
|
38833
|
+
handoffCache.clear();
|
|
38834
|
+
threadOwnerHarness.clear();
|
|
38835
|
+
inFlightInspects.clear();
|
|
38836
|
+
pluginsByHost.clear();
|
|
38837
|
+
pluginsLoadingByHost.clear();
|
|
38838
|
+
harnessCatalogCache.clear();
|
|
38839
|
+
harnessInspectInFlight.clear();
|
|
38840
|
+
activeComposer = null;
|
|
38841
|
+
activeThreadId = null;
|
|
38842
|
+
activeHostId = null;
|
|
38843
|
+
}
|
|
38844
|
+
};
|
|
38845
|
+
}
|
|
38846
|
+
|
|
36874
38847
|
// src/versioned-renderer-adapter.ts
|
|
36875
38848
|
var PI_TRANSPORT_MODEL_ID = "codexhost/pi-native";
|
|
36876
38849
|
var PI_TRANSPORT_MODEL_PREFIX = `${PI_TRANSPORT_MODEL_ID}@`;
|
|
@@ -36898,7 +38871,7 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
36898
38871
|
}
|
|
36899
38872
|
var DRAFT_PREWARM_POLICY_WAIT_TIMEOUT_MS = 1e4;
|
|
36900
38873
|
var DRAFT_PREWARM_POLICY_POLL_INTERVAL_MS = 25;
|
|
36901
|
-
function
|
|
38874
|
+
function isRecord14(value) {
|
|
36902
38875
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
36903
38876
|
}
|
|
36904
38877
|
function decodeOpenCodeTransportModelId(value) {
|
|
@@ -37063,7 +39036,7 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
37063
39036
|
let fiber = findComposerFiber(composer);
|
|
37064
39037
|
for (let depth = 0; fiber && depth < 120; depth += 1) {
|
|
37065
39038
|
const props = fiber.memoizedProps;
|
|
37066
|
-
if (
|
|
39039
|
+
if (isRecord14(props) && "conversationId" in props && props.conversationId != null) {
|
|
37067
39040
|
const candidate = hostThreadIdSchema.safeParse(props.conversationId);
|
|
37068
39041
|
if (!candidate.success || threadId !== void 0 && threadId !== candidate.data) {
|
|
37069
39042
|
return null;
|
|
@@ -37076,12 +39049,12 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
37076
39049
|
return threadId;
|
|
37077
39050
|
}
|
|
37078
39051
|
function isLegacySevenSlotDraftWrapper(value) {
|
|
37079
|
-
if (!Array.isArray(value) || value.length !== 7 || value[3] !== value[5] || value[3] !== value[6] || !
|
|
39052
|
+
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
39053
|
return false;
|
|
37081
39054
|
}
|
|
37082
39055
|
try {
|
|
37083
39056
|
const draft = value[3].get();
|
|
37084
|
-
return
|
|
39057
|
+
return isRecord14(draft) && "modelSettings" in draft && "isManuallyChanged" in draft;
|
|
37085
39058
|
} catch {
|
|
37086
39059
|
return false;
|
|
37087
39060
|
}
|
|
@@ -37115,8 +39088,8 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
37115
39088
|
let fiber = findComposerFiber(composer);
|
|
37116
39089
|
for (let depth = 0; fiber && depth < 120; depth += 1) {
|
|
37117
39090
|
const updateQueue = fiber.updateQueue;
|
|
37118
|
-
const memoCache =
|
|
37119
|
-
const data =
|
|
39091
|
+
const memoCache = isRecord14(updateQueue) ? updateQueue.memoCache : null;
|
|
39092
|
+
const data = isRecord14(memoCache) && Array.isArray(memoCache.data) ? memoCache.data : [];
|
|
37120
39093
|
for (const value of data) {
|
|
37121
39094
|
const draftId = draftIdFromMemoValue(value);
|
|
37122
39095
|
if (draftId) draftIds.add(draftId);
|
|
@@ -37144,7 +39117,7 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
37144
39117
|
return ["default", draftIds.values().next().value];
|
|
37145
39118
|
}
|
|
37146
39119
|
function isDraftPrewarmPolicyReady(value) {
|
|
37147
|
-
return
|
|
39120
|
+
return isRecord14(value) && value.state === "ready" && typeof value.hostId === "string" && value.hostId.length > 0 && typeof value.select === "function" && typeof value.clear === "function";
|
|
37148
39121
|
}
|
|
37149
39122
|
async function waitForRendererDraftPrewarmPolicy(target2, composer) {
|
|
37150
39123
|
const deadline = Date.now() + DRAFT_PREWARM_POLICY_WAIT_TIMEOUT_MS;
|
|
@@ -37248,6 +39221,7 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
37248
39221
|
return client.listHarnessPlugins();
|
|
37249
39222
|
},
|
|
37250
39223
|
forkThread: (input3) => currentModelClient().forkThread(input3),
|
|
39224
|
+
handoffThread: (input3) => currentModelClient().handoffThread(input3),
|
|
37251
39225
|
inspectHarness: (...args) => currentModelClient().inspectHarness(...args),
|
|
37252
39226
|
inspectThread: (input3) => currentModelClient().inspectThread(input3),
|
|
37253
39227
|
usesIndependentNativeInference: async (input3) => {
|
|
@@ -37326,10 +39300,23 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
37326
39300
|
);
|
|
37327
39301
|
}
|
|
37328
39302
|
});
|
|
39303
|
+
const handoffControl = installRendererHandoffControl({
|
|
39304
|
+
getClient: () => disposed ? null : modelControl,
|
|
39305
|
+
getHostId: (composer) => modelControl.currentHostId?.(composer) ?? null,
|
|
39306
|
+
resolveComposerThreadId: (composer) => threadIdFromComposerModelTarget(findComposerModelTarget(composer)),
|
|
39307
|
+
mountTrigger: false,
|
|
39308
|
+
reportError: (error62) => {
|
|
39309
|
+
console.error(
|
|
39310
|
+
"codexhost Thread Handoff failed",
|
|
39311
|
+
error62 instanceof Error ? error62.name : "UnknownError"
|
|
39312
|
+
);
|
|
39313
|
+
}
|
|
39314
|
+
});
|
|
37329
39315
|
const selectedPolicies = /* @__PURE__ */ new Map();
|
|
37330
39316
|
const draftModels = createScopedDraftModelWriter();
|
|
37331
39317
|
const handleRoutingPolicyChange = () => {
|
|
37332
39318
|
currentRequestRoute();
|
|
39319
|
+
handoffControl.refresh();
|
|
37333
39320
|
};
|
|
37334
39321
|
window.addEventListener("codexhost:draft-prewarm-policy-changed", handleRoutingPolicyChange);
|
|
37335
39322
|
currentRequestRoute();
|
|
@@ -37389,6 +39376,11 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
37389
39376
|
status: liveStatus,
|
|
37390
39377
|
modelControl,
|
|
37391
39378
|
applyAgent,
|
|
39379
|
+
canOpenHandoff: (composer) => handoffControl.canOpenForComposer(composer),
|
|
39380
|
+
openHandoff: (composer, targetHarnessId, anchor2) => handoffControl.openForComposer(composer, {
|
|
39381
|
+
...targetHarnessId === void 0 ? {} : { targetHarnessId },
|
|
39382
|
+
...anchor2 === void 0 ? {} : { anchor: anchor2 }
|
|
39383
|
+
}),
|
|
37392
39384
|
dispose() {
|
|
37393
39385
|
if (disposed) return;
|
|
37394
39386
|
disposed = true;
|
|
@@ -37401,6 +39393,7 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
37401
39393
|
const cleanups = [
|
|
37402
39394
|
...[...selectedPolicies.values()].map((policy) => () => policy.select(null)),
|
|
37403
39395
|
() => forkControl.dispose(),
|
|
39396
|
+
() => handoffControl.dispose(),
|
|
37404
39397
|
() => stopGroupSync(),
|
|
37405
39398
|
() => clients.dispose(),
|
|
37406
39399
|
() => usageSubscription.dispose(),
|
|
@@ -37442,11 +39435,11 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
37442
39435
|
return null;
|
|
37443
39436
|
}
|
|
37444
39437
|
}
|
|
37445
|
-
function
|
|
39438
|
+
function isRecord15(value) {
|
|
37446
39439
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
37447
39440
|
}
|
|
37448
39441
|
function parseExternalConfiguration(value) {
|
|
37449
|
-
if (!
|
|
39442
|
+
if (!isRecord15(value)) return void 0;
|
|
37450
39443
|
const model2 = harnessModelRefSchema.safeParse(value.model);
|
|
37451
39444
|
if (!model2.success) return void 0;
|
|
37452
39445
|
const thinkingOptionId = harnessThinkingOptionIdSchema.safeParse(value.thinkingOptionId);
|
|
@@ -37463,10 +39456,10 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
37463
39456
|
const raw = storage.getItem(RENDERER_NEW_THREAD_PREFERENCE_KEY);
|
|
37464
39457
|
if (!raw) return void 0;
|
|
37465
39458
|
const parsed = JSON.parse(raw);
|
|
37466
|
-
if (!
|
|
39459
|
+
if (!isRecord15(parsed) || parsed.version !== 1) return void 0;
|
|
37467
39460
|
if (parsed.lastAgent !== "codex" && !harnessPluginIdSchema.safeParse(parsed.lastAgent).success)
|
|
37468
39461
|
return void 0;
|
|
37469
|
-
const externalByAgent =
|
|
39462
|
+
const externalByAgent = isRecord15(parsed.externalByAgent) ? parsed.externalByAgent : {};
|
|
37470
39463
|
const parsedExternal = Object.fromEntries(
|
|
37471
39464
|
Object.keys(externalByAgent).filter((agent) => harnessPluginIdSchema.safeParse(agent).success).flatMap((agent) => {
|
|
37472
39465
|
const configuration = parseExternalConfiguration(externalByAgent[agent]);
|
|
@@ -37608,157 +39601,6 @@ ${text2.includes("## My request:") ? "" : "\n## My request:\n"}`,
|
|
|
37608
39601
|
return editor !== null && prependEditor(editor, `${command.invocation} `);
|
|
37609
39602
|
}
|
|
37610
39603
|
|
|
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
39604
|
// src/desktop-extension-api.ts
|
|
37763
39605
|
var markerOwners = /* @__PURE__ */ new WeakMap();
|
|
37764
39606
|
function cloneStorageValues(values) {
|
|
@@ -45950,18 +47792,20 @@ ${detail}` : ""}`
|
|
|
45950
47792
|
const renderActions = (extensionId, displayName, installed, catalogEntry, state) => {
|
|
45951
47793
|
if (!actionBar || !modalToggle) return;
|
|
45952
47794
|
const updateAvailable = hasCatalogUpdate(installed, catalogEntry);
|
|
45953
|
-
const
|
|
47795
|
+
const extAction = state.pendingMutations.get(extensionId) ?? null;
|
|
47796
|
+
const controlsDisabled = extAction !== null || state.globalBusy;
|
|
45954
47797
|
const nodes = [];
|
|
45955
47798
|
if (!installed && catalogEntry) {
|
|
45956
47799
|
const installButton = createEl(
|
|
45957
47800
|
document2,
|
|
45958
47801
|
"button",
|
|
45959
47802
|
"settings-command-button",
|
|
45960
|
-
|
|
47803
|
+
extAction === "install" ? copy.installing : copy.install
|
|
45961
47804
|
);
|
|
45962
47805
|
installButton.type = "button";
|
|
45963
47806
|
installButton.dataset.action = "install";
|
|
45964
|
-
installButton.
|
|
47807
|
+
installButton.setAttribute("aria-busy", String(extAction === "install"));
|
|
47808
|
+
installButton.disabled = controlsDisabled || !state.canInstall;
|
|
45965
47809
|
installButton.addEventListener("click", () => {
|
|
45966
47810
|
if (!installButton.disabled) onInstall?.(catalogEntry, false);
|
|
45967
47811
|
});
|
|
@@ -45981,11 +47825,12 @@ ${detail}` : ""}`
|
|
|
45981
47825
|
document2,
|
|
45982
47826
|
"button",
|
|
45983
47827
|
"settings-command-button",
|
|
45984
|
-
|
|
47828
|
+
extAction === "update" ? copy.updating : formatMessage(copy.updateToVersion, { version: catalogEntry.version })
|
|
45985
47829
|
);
|
|
45986
47830
|
updateButton.type = "button";
|
|
45987
47831
|
updateButton.dataset.action = "update";
|
|
45988
|
-
updateButton.
|
|
47832
|
+
updateButton.setAttribute("aria-busy", String(extAction === "update"));
|
|
47833
|
+
updateButton.disabled = controlsDisabled || !state.canInstall;
|
|
45989
47834
|
updateButton.addEventListener("click", () => {
|
|
45990
47835
|
if (!updateButton.disabled) onInstall?.(catalogEntry, true);
|
|
45991
47836
|
});
|
|
@@ -45993,7 +47838,7 @@ ${detail}` : ""}`
|
|
|
45993
47838
|
}
|
|
45994
47839
|
const blocked = isToggleBlocked(installed);
|
|
45995
47840
|
modalToggle.checked = installed.enabled;
|
|
45996
|
-
modalToggle.disabled =
|
|
47841
|
+
modalToggle.disabled = controlsDisabled || blocked;
|
|
45997
47842
|
modalToggle.setAttribute(
|
|
45998
47843
|
"aria-label",
|
|
45999
47844
|
formatMessage(copy.toggleLabel, { name: displayName })
|
|
@@ -46004,7 +47849,7 @@ ${detail}` : ""}`
|
|
|
46004
47849
|
const openPageButton = createEl(document2, "button", "settings-command-button");
|
|
46005
47850
|
openPageButton.type = "button";
|
|
46006
47851
|
openPageButton.dataset.action = "open-page";
|
|
46007
|
-
openPageButton.disabled =
|
|
47852
|
+
openPageButton.disabled = controlsDisabled;
|
|
46008
47853
|
openPageButton.append(
|
|
46009
47854
|
createRendererSettingsIcon("external-link", 13),
|
|
46010
47855
|
createEl(document2, "span", "", copy.openPage)
|
|
@@ -46024,7 +47869,7 @@ ${detail}` : ""}`
|
|
|
46024
47869
|
);
|
|
46025
47870
|
openSettingsButton.type = "button";
|
|
46026
47871
|
openSettingsButton.dataset.action = "open-settings";
|
|
46027
|
-
openSettingsButton.disabled =
|
|
47872
|
+
openSettingsButton.disabled = controlsDisabled;
|
|
46028
47873
|
openSettingsButton.append(
|
|
46029
47874
|
createRendererSettingsIcon("settings", 13),
|
|
46030
47875
|
createEl(document2, "span", "", copy.openExtensionSettings)
|
|
@@ -46053,11 +47898,12 @@ ${detail}` : ""}`
|
|
|
46053
47898
|
document2,
|
|
46054
47899
|
"button",
|
|
46055
47900
|
"settings-command-button settings-command-button--secondary settings-command-button--danger",
|
|
46056
|
-
|
|
47901
|
+
extAction === "uninstall" ? copy.uninstalling : copy.uninstallConfirm
|
|
46057
47902
|
);
|
|
46058
47903
|
confirmButton.type = "button";
|
|
46059
47904
|
confirmButton.dataset.action = "confirm-uninstall";
|
|
46060
|
-
confirmButton.
|
|
47905
|
+
confirmButton.setAttribute("aria-busy", String(extAction === "uninstall"));
|
|
47906
|
+
confirmButton.disabled = controlsDisabled;
|
|
46061
47907
|
confirmButton.addEventListener("click", () => {
|
|
46062
47908
|
if (!confirmButton.disabled) onUninstall?.(installed);
|
|
46063
47909
|
});
|
|
@@ -46069,9 +47915,9 @@ ${detail}` : ""}`
|
|
|
46069
47915
|
);
|
|
46070
47916
|
cancelButton.type = "button";
|
|
46071
47917
|
cancelButton.dataset.action = "cancel-uninstall";
|
|
46072
|
-
cancelButton.disabled =
|
|
47918
|
+
cancelButton.disabled = controlsDisabled;
|
|
46073
47919
|
cancelButton.addEventListener("click", () => {
|
|
46074
|
-
if (
|
|
47920
|
+
if (controlsDisabled) return;
|
|
46075
47921
|
confirmingUninstall = false;
|
|
46076
47922
|
if (currentState) {
|
|
46077
47923
|
renderContent(extensionId, currentItem, currentCatalogEntry, currentState);
|
|
@@ -46087,13 +47933,13 @@ ${detail}` : ""}`
|
|
|
46087
47933
|
);
|
|
46088
47934
|
uninstallButton.type = "button";
|
|
46089
47935
|
uninstallButton.dataset.action = "uninstall";
|
|
46090
|
-
uninstallButton.disabled =
|
|
47936
|
+
uninstallButton.disabled = controlsDisabled;
|
|
46091
47937
|
uninstallButton.append(
|
|
46092
47938
|
createRendererSettingsIcon("trash", 13),
|
|
46093
47939
|
createEl(document2, "span", "", copy.uninstall)
|
|
46094
47940
|
);
|
|
46095
47941
|
uninstallButton.addEventListener("click", () => {
|
|
46096
|
-
if (
|
|
47942
|
+
if (controlsDisabled) return;
|
|
46097
47943
|
confirmingUninstall = true;
|
|
46098
47944
|
if (currentState) {
|
|
46099
47945
|
renderContent(extensionId, currentItem, currentCatalogEntry, currentState);
|
|
@@ -46126,7 +47972,7 @@ ${detail}` : ""}`
|
|
|
46126
47972
|
} else {
|
|
46127
47973
|
delete dialog.dataset.extensionState;
|
|
46128
47974
|
}
|
|
46129
|
-
if (state.
|
|
47975
|
+
if (state.pendingMutations.has(extensionId)) dialog.dataset.busy = "true";
|
|
46130
47976
|
else delete dialog.dataset.busy;
|
|
46131
47977
|
const categories = (installed?.state === "valid" ? installed.manifest.categories : void 0) ?? catalogEntry?.categories;
|
|
46132
47978
|
const iconUrl2 = resolveInstalledExtensionIconUrl(installed, catalogEntry);
|
|
@@ -46411,7 +48257,8 @@ ${detail}` : ""}`
|
|
|
46411
48257
|
modalToggle.addEventListener("change", () => {
|
|
46412
48258
|
if (!currentItem || !modalToggle) return;
|
|
46413
48259
|
const desired = modalToggle.checked;
|
|
46414
|
-
|
|
48260
|
+
const isBusyThis = currentState?.globalBusy || Boolean(currentState?.pendingMutations.has(currentItem.id));
|
|
48261
|
+
if (isBusyThis || isToggleBlocked(currentItem)) {
|
|
46415
48262
|
modalToggle.checked = currentItem.enabled;
|
|
46416
48263
|
return;
|
|
46417
48264
|
}
|
|
@@ -47012,9 +48859,8 @@ ${detail}` : ""}`
|
|
|
47012
48859
|
visibleEntries,
|
|
47013
48860
|
installedById,
|
|
47014
48861
|
canInstall,
|
|
47015
|
-
|
|
47016
|
-
|
|
47017
|
-
activeMutationAction,
|
|
48862
|
+
pendingMutations,
|
|
48863
|
+
globalBusy,
|
|
47018
48864
|
onOpenDetails,
|
|
47019
48865
|
onInstall,
|
|
47020
48866
|
onViewInstalled
|
|
@@ -47027,22 +48873,26 @@ ${detail}` : ""}`
|
|
|
47027
48873
|
const installed = installedById.get(entry.id);
|
|
47028
48874
|
const updateAvailable = hasCatalogUpdate(installed, entry);
|
|
47029
48875
|
const installState = installed ? updateAvailable ? "update" : "installed" : "available";
|
|
47030
|
-
const
|
|
48876
|
+
const entryAction = pendingMutations.get(entry.id) ?? null;
|
|
48877
|
+
const isBusyCard = entryAction !== null;
|
|
48878
|
+
const controlsDisabled = isBusyCard || globalBusy;
|
|
47031
48879
|
const actionButton = createEl(document2, "button");
|
|
47032
48880
|
actionButton.type = "button";
|
|
47033
48881
|
actionButton.dataset.extensionId = entry.id;
|
|
47034
48882
|
if (installState === "available") {
|
|
47035
48883
|
actionButton.className = "settings-command-button settings-extensions-card__button";
|
|
47036
48884
|
actionButton.dataset.action = "install";
|
|
47037
|
-
const installingThis =
|
|
48885
|
+
const installingThis = entryAction === "install";
|
|
47038
48886
|
actionButton.textContent = installingThis ? copy.installing : copy.install;
|
|
47039
|
-
actionButton.
|
|
48887
|
+
actionButton.setAttribute("aria-busy", String(installingThis));
|
|
48888
|
+
actionButton.disabled = controlsDisabled || !canInstall;
|
|
47040
48889
|
} else if (installState === "update") {
|
|
47041
48890
|
actionButton.className = "settings-command-button settings-extensions-card__button settings-extensions-card__button--update";
|
|
47042
48891
|
actionButton.dataset.action = "update";
|
|
47043
|
-
const updatingThis =
|
|
48892
|
+
const updatingThis = entryAction === "update";
|
|
47044
48893
|
actionButton.textContent = updatingThis ? copy.updating : copy.update;
|
|
47045
|
-
actionButton.
|
|
48894
|
+
actionButton.setAttribute("aria-busy", String(updatingThis));
|
|
48895
|
+
actionButton.disabled = controlsDisabled || !canInstall;
|
|
47046
48896
|
} else {
|
|
47047
48897
|
actionButton.className = "settings-command-button settings-command-button--secondary settings-extensions-card__button settings-extensions-card__button--installed";
|
|
47048
48898
|
actionButton.dataset.action = "installed";
|
|
@@ -47050,7 +48900,7 @@ ${detail}` : ""}`
|
|
|
47050
48900
|
createRendererSettingsIcon("check", 12),
|
|
47051
48901
|
createEl(document2, "span", "", copy.installedBadge)
|
|
47052
48902
|
);
|
|
47053
|
-
actionButton.disabled =
|
|
48903
|
+
actionButton.disabled = controlsDisabled;
|
|
47054
48904
|
}
|
|
47055
48905
|
actionButton.addEventListener("click", (event) => {
|
|
47056
48906
|
event.stopPropagation?.();
|
|
@@ -47363,16 +49213,18 @@ ${detail}` : ""}`
|
|
|
47363
49213
|
let loading = false;
|
|
47364
49214
|
let catalogLoading = false;
|
|
47365
49215
|
let catalogRequestToken = 0;
|
|
47366
|
-
let
|
|
47367
|
-
|
|
47368
|
-
let
|
|
49216
|
+
let listApplyToken = 0;
|
|
49217
|
+
const pendingMutations = /* @__PURE__ */ new Map();
|
|
49218
|
+
let importing = false;
|
|
49219
|
+
let recovering = false;
|
|
49220
|
+
let toggleQueue = Promise.resolve();
|
|
47369
49221
|
let pollTimer;
|
|
47370
49222
|
let activeRecoveryDialog = null;
|
|
47371
49223
|
let selectedCapability = "all";
|
|
47372
49224
|
let selectedCategory = null;
|
|
47373
49225
|
let searchQuery = "";
|
|
47374
|
-
let
|
|
47375
|
-
|
|
49226
|
+
let modalFeedback = null;
|
|
49227
|
+
const hasPendingMutations = () => pendingMutations.size > 0 || importing || recovering;
|
|
47376
49228
|
const clientCapabilities = () => {
|
|
47377
49229
|
const client = resolveAvailableClient(getClient);
|
|
47378
49230
|
return {
|
|
@@ -47431,10 +49283,9 @@ ${detail}` : ""}`
|
|
|
47431
49283
|
unavailable,
|
|
47432
49284
|
canInstall,
|
|
47433
49285
|
canUninstall,
|
|
47434
|
-
|
|
47435
|
-
|
|
47436
|
-
|
|
47437
|
-
feedback: modalFeedbackExtensionId !== null && modalFeedbackExtensionId === detailModal.extensionId ? currentFeedback : null
|
|
49286
|
+
pendingMutations: new Map(pendingMutations),
|
|
49287
|
+
globalBusy: recovering,
|
|
49288
|
+
feedback: modalFeedback !== null && modalFeedback.extensionId === detailModal.extensionId ? modalFeedback.feedback : null
|
|
47438
49289
|
};
|
|
47439
49290
|
};
|
|
47440
49291
|
const detailModal = createDesktopExtensionDetailModal({
|
|
@@ -47475,7 +49326,7 @@ ${detail}` : ""}`
|
|
|
47475
49326
|
if (pageId) context2.navigateToPage?.(pageId);
|
|
47476
49327
|
} : void 0,
|
|
47477
49328
|
onClose: () => {
|
|
47478
|
-
|
|
49329
|
+
modalFeedback = null;
|
|
47479
49330
|
}
|
|
47480
49331
|
});
|
|
47481
49332
|
const createModal = createDesktopExtensionCreateModal({
|
|
@@ -47495,8 +49346,10 @@ ${detail}` : ""}`
|
|
|
47495
49346
|
}
|
|
47496
49347
|
});
|
|
47497
49348
|
const setFeedback = (next, modalExtensionId = null) => {
|
|
47498
|
-
|
|
47499
|
-
|
|
49349
|
+
if (modalExtensionId !== null) {
|
|
49350
|
+
modalFeedback = next ? { extensionId: modalExtensionId, feedback: next } : null;
|
|
49351
|
+
return;
|
|
49352
|
+
}
|
|
47500
49353
|
if (!next) {
|
|
47501
49354
|
banner.hidden = true;
|
|
47502
49355
|
bannerText.textContent = "";
|
|
@@ -47515,14 +49368,13 @@ ${detail}` : ""}`
|
|
|
47515
49368
|
};
|
|
47516
49369
|
const syncToolbarState = () => {
|
|
47517
49370
|
const activeLoading = activeTab === "installed" ? loading : catalogLoading;
|
|
47518
|
-
|
|
47519
|
-
refreshButton.disabled = busy;
|
|
49371
|
+
refreshButton.disabled = activeLoading || recovering;
|
|
47520
49372
|
refreshButton.setAttribute("aria-busy", String(activeLoading));
|
|
47521
49373
|
refreshButton.title = activeLoading ? copy.refreshing : copy.refresh;
|
|
47522
49374
|
refreshButton.setAttribute("aria-label", activeLoading ? copy.refreshing : copy.refresh);
|
|
47523
49375
|
const { canInstall, canRecover } = clientCapabilities();
|
|
47524
|
-
importButton.disabled =
|
|
47525
|
-
recoveryMenuItem.disabled =
|
|
49376
|
+
importButton.disabled = importing || recovering || !canInstall;
|
|
49377
|
+
recoveryMenuItem.disabled = hasPendingMutations() || !canRecover;
|
|
47526
49378
|
installedTabLabel.textContent = formatMessage(copy.tabInstalled, {
|
|
47527
49379
|
count: String(listing?.extensions.length ?? 0)
|
|
47528
49380
|
});
|
|
@@ -47701,7 +49553,7 @@ ${detail}` : ""}`
|
|
|
47701
49553
|
}
|
|
47702
49554
|
closeHeaderMenus();
|
|
47703
49555
|
if (detailModal.extensionId !== extensionId) {
|
|
47704
|
-
|
|
49556
|
+
modalFeedback = null;
|
|
47705
49557
|
}
|
|
47706
49558
|
detailModal.open(extensionId, buildDetailModalState());
|
|
47707
49559
|
};
|
|
@@ -47712,10 +49564,13 @@ ${detail}` : ""}`
|
|
|
47712
49564
|
const errorId = preferenceId(`host-ext-error-${item.id}`);
|
|
47713
49565
|
const blocked = isToggleBlocked(item);
|
|
47714
49566
|
const statusState = itemStatusState(item);
|
|
49567
|
+
const extAction = pendingMutations.get(item.id) ?? null;
|
|
49568
|
+
const isExtBusy = extAction !== null;
|
|
49569
|
+
const controlsDisabled = isExtBusy || recovering;
|
|
47715
49570
|
const toggle = createPreferenceSwitch(document2, switchId, errorId);
|
|
47716
49571
|
toggle.checked = item.enabled;
|
|
47717
49572
|
toggle.setAttribute("aria-label", formatMessage(copy.toggleLabel, { name: displayName }));
|
|
47718
|
-
toggle.disabled =
|
|
49573
|
+
toggle.disabled = controlsDisabled || blocked;
|
|
47719
49574
|
if (blocked) {
|
|
47720
49575
|
toggle.title = blockedToggleReason(item, copy);
|
|
47721
49576
|
}
|
|
@@ -47726,7 +49581,7 @@ ${detail}` : ""}`
|
|
|
47726
49581
|
toggle.addEventListener("keydown", stopTrigger);
|
|
47727
49582
|
toggle.addEventListener("change", () => {
|
|
47728
49583
|
const desired = toggle.checked;
|
|
47729
|
-
if (
|
|
49584
|
+
if (recovering || pendingMutations.has(item.id) || blocked) {
|
|
47730
49585
|
toggle.checked = item.enabled;
|
|
47731
49586
|
return;
|
|
47732
49587
|
}
|
|
@@ -47743,7 +49598,7 @@ ${detail}` : ""}`
|
|
|
47743
49598
|
btn.type = "button";
|
|
47744
49599
|
btn.dataset.action = "open-page";
|
|
47745
49600
|
btn.dataset.extensionId = item.id;
|
|
47746
|
-
btn.disabled =
|
|
49601
|
+
btn.disabled = controlsDisabled;
|
|
47747
49602
|
btn.addEventListener("click", (event) => {
|
|
47748
49603
|
event.stopPropagation?.();
|
|
47749
49604
|
if (!btn.disabled) openExtensionPage(item);
|
|
@@ -47753,7 +49608,7 @@ ${detail}` : ""}`
|
|
|
47753
49608
|
}
|
|
47754
49609
|
let update;
|
|
47755
49610
|
if (catalogEntry && hasCatalogUpdate(item, catalogEntry)) {
|
|
47756
|
-
const updating =
|
|
49611
|
+
const updating = extAction === "update";
|
|
47757
49612
|
const button2 = createEl(
|
|
47758
49613
|
document2,
|
|
47759
49614
|
"button",
|
|
@@ -47763,7 +49618,7 @@ ${detail}` : ""}`
|
|
|
47763
49618
|
button2.type = "button";
|
|
47764
49619
|
button2.dataset.action = "update";
|
|
47765
49620
|
button2.setAttribute("aria-busy", String(updating));
|
|
47766
|
-
button2.disabled =
|
|
49621
|
+
button2.disabled = controlsDisabled || !canUpdate;
|
|
47767
49622
|
button2.addEventListener("click", () => {
|
|
47768
49623
|
if (!button2.disabled) void installFromCatalog(catalogEntry, true);
|
|
47769
49624
|
});
|
|
@@ -47797,7 +49652,7 @@ ${detail}` : ""}`
|
|
|
47797
49652
|
capabilityBadges: deriveCapabilityBadges(itemCapabilities(item), copy),
|
|
47798
49653
|
secondaryAction: openPageButton,
|
|
47799
49654
|
actionControl: toggle,
|
|
47800
|
-
busy:
|
|
49655
|
+
busy: isExtBusy,
|
|
47801
49656
|
dataset: {
|
|
47802
49657
|
extensionState: statusState,
|
|
47803
49658
|
trustTier: catalogEntry?.trustTier
|
|
@@ -47934,7 +49789,7 @@ ${detail}` : ""}`
|
|
|
47934
49789
|
{
|
|
47935
49790
|
label: copy.retry,
|
|
47936
49791
|
onClick: () => {
|
|
47937
|
-
if (!catalogLoading && !
|
|
49792
|
+
if (!catalogLoading && !recovering) {
|
|
47938
49793
|
void loadCatalog({ forceRefresh: true, silent: false });
|
|
47939
49794
|
}
|
|
47940
49795
|
}
|
|
@@ -47949,9 +49804,9 @@ ${detail}` : ""}`
|
|
|
47949
49804
|
document2,
|
|
47950
49805
|
messages,
|
|
47951
49806
|
catalog,
|
|
47952
|
-
catalogLoading ||
|
|
49807
|
+
catalogLoading || recovering,
|
|
47953
49808
|
() => {
|
|
47954
|
-
if (!catalogLoading && !
|
|
49809
|
+
if (!catalogLoading && !recovering) {
|
|
47955
49810
|
void loadCatalog({ forceRefresh: true, silent: false });
|
|
47956
49811
|
}
|
|
47957
49812
|
},
|
|
@@ -48013,9 +49868,8 @@ ${detail}` : ""}`
|
|
|
48013
49868
|
visibleEntries,
|
|
48014
49869
|
installedById,
|
|
48015
49870
|
canInstall,
|
|
48016
|
-
|
|
48017
|
-
|
|
48018
|
-
activeMutationAction,
|
|
49871
|
+
pendingMutations,
|
|
49872
|
+
globalBusy: recovering,
|
|
48019
49873
|
onOpenDetails: openDetailModal,
|
|
48020
49874
|
onInstall: (entry, isUpdate) => {
|
|
48021
49875
|
void installFromCatalog(entry, isUpdate);
|
|
@@ -48031,7 +49885,7 @@ ${detail}` : ""}`
|
|
|
48031
49885
|
render();
|
|
48032
49886
|
},
|
|
48033
49887
|
onRetryCatalog: () => {
|
|
48034
|
-
if (!catalogLoading && !
|
|
49888
|
+
if (!catalogLoading && !recovering) {
|
|
48035
49889
|
void loadCatalog({ forceRefresh: true, silent: false });
|
|
48036
49890
|
}
|
|
48037
49891
|
}
|
|
@@ -48067,14 +49921,16 @@ ${detail}` : ""}`
|
|
|
48067
49921
|
clearPollTimer();
|
|
48068
49922
|
if (disposed || context2.signal.aborted || document2.visibilityState === "hidden") return;
|
|
48069
49923
|
pollTimer = setTimeout(() => {
|
|
48070
|
-
if (disposed || context2.signal.aborted ||
|
|
49924
|
+
if (disposed || context2.signal.aborted || hasPendingMutations() || loading || activeRecoveryDialog || importModal.isOpen) {
|
|
48071
49925
|
schedulePoll();
|
|
48072
49926
|
return;
|
|
48073
49927
|
}
|
|
48074
49928
|
void loadInstalled({ silent: true });
|
|
48075
49929
|
}, POLL_INTERVAL_MS2);
|
|
48076
49930
|
};
|
|
48077
|
-
const applyLoadedList = (result) => {
|
|
49931
|
+
const applyLoadedList = (result, token) => {
|
|
49932
|
+
if (token !== void 0 && token !== listApplyToken) return false;
|
|
49933
|
+
if (token === void 0) listApplyToken += 1;
|
|
48078
49934
|
const hadOpenPageId = pageHost.extensionId;
|
|
48079
49935
|
listing = result;
|
|
48080
49936
|
pluginPages?.syncInstalledExtensions?.(result.extensions, result.configuration.revision);
|
|
@@ -48082,6 +49938,18 @@ ${detail}` : ""}`
|
|
|
48082
49938
|
if (hadOpenPageId && !pageHost.isOpen) {
|
|
48083
49939
|
setFeedback({ tone: "info", text: copy.pageClosedDisabled });
|
|
48084
49940
|
}
|
|
49941
|
+
return true;
|
|
49942
|
+
};
|
|
49943
|
+
const refreshInstalledAfterMutation = async () => {
|
|
49944
|
+
const client = resolveAvailableClient(getClient);
|
|
49945
|
+
if (!client?.listHostExtensions) return;
|
|
49946
|
+
const token = ++listApplyToken;
|
|
49947
|
+
try {
|
|
49948
|
+
const refreshed = await client.listHostExtensions();
|
|
49949
|
+
if (disposed || context2.signal.aborted) return;
|
|
49950
|
+
applyLoadedList(refreshed, token);
|
|
49951
|
+
} catch {
|
|
49952
|
+
}
|
|
48085
49953
|
};
|
|
48086
49954
|
const loadInstalled = async (options = {}) => {
|
|
48087
49955
|
const silent = options.silent ?? false;
|
|
@@ -48102,17 +49970,23 @@ ${detail}` : ""}`
|
|
|
48102
49970
|
render();
|
|
48103
49971
|
}
|
|
48104
49972
|
const listHostExtensions = client.listHostExtensions.bind(client);
|
|
49973
|
+
const token = ++listApplyToken;
|
|
48105
49974
|
await context2.runLatest(async () => listHostExtensions(), {
|
|
48106
49975
|
success(result) {
|
|
48107
49976
|
loading = false;
|
|
48108
49977
|
unavailable = false;
|
|
48109
|
-
applyLoadedList(result);
|
|
48110
|
-
if (!keepFeedback) setFeedback(null);
|
|
49978
|
+
const applied = applyLoadedList(result, token);
|
|
49979
|
+
if (applied && !keepFeedback) setFeedback(null);
|
|
48111
49980
|
render();
|
|
48112
49981
|
schedulePoll();
|
|
48113
49982
|
},
|
|
48114
49983
|
failure(error62) {
|
|
48115
49984
|
loading = false;
|
|
49985
|
+
if (token !== listApplyToken) {
|
|
49986
|
+
render();
|
|
49987
|
+
schedulePoll();
|
|
49988
|
+
return;
|
|
49989
|
+
}
|
|
48116
49990
|
if (error62 instanceof RendererMethodUnavailableError) {
|
|
48117
49991
|
unavailable = true;
|
|
48118
49992
|
listing = null;
|
|
@@ -48183,7 +50057,8 @@ ${detail}` : ""}`
|
|
|
48183
50057
|
}
|
|
48184
50058
|
};
|
|
48185
50059
|
const installFromCatalog = async (entry, isUpdate) => {
|
|
48186
|
-
if (
|
|
50060
|
+
if (recovering || pendingMutations.has(entry.id) || disposed || context2.signal.aborted)
|
|
50061
|
+
return;
|
|
48187
50062
|
const client = resolveAvailableClient(getClient);
|
|
48188
50063
|
const installedItem = listing?.extensions.find((item) => item.id === entry.id);
|
|
48189
50064
|
const canUpdate = isUpdate && installedItem?.state === "valid" && Boolean(client?.updateHostExtension);
|
|
@@ -48191,10 +50066,7 @@ ${detail}` : ""}`
|
|
|
48191
50066
|
const update = client?.updateHostExtension?.bind(client);
|
|
48192
50067
|
if (!canUpdate && !install2) return;
|
|
48193
50068
|
const fallbackName = catalogDisplayName(entry, messages.locale);
|
|
48194
|
-
|
|
48195
|
-
mutating = true;
|
|
48196
|
-
activeMutationId = entry.id;
|
|
48197
|
-
activeMutationAction = isUpdate ? "update" : "install";
|
|
50069
|
+
pendingMutations.set(entry.id, isUpdate ? "update" : "install");
|
|
48198
50070
|
clearPollTimer();
|
|
48199
50071
|
render();
|
|
48200
50072
|
try {
|
|
@@ -48215,6 +50087,7 @@ ${detail}` : ""}`
|
|
|
48215
50087
|
}
|
|
48216
50088
|
if (disposed || context2.signal.aborted) return;
|
|
48217
50089
|
const displayName = result.manifest.name[messages.locale] || result.manifest.name.en || fallbackName;
|
|
50090
|
+
const modalTargetId = detailModal.extensionId === entry.id ? entry.id : null;
|
|
48218
50091
|
setFeedback(
|
|
48219
50092
|
{
|
|
48220
50093
|
tone: "success",
|
|
@@ -48225,14 +50098,10 @@ ${detail}` : ""}`
|
|
|
48225
50098
|
},
|
|
48226
50099
|
modalTargetId
|
|
48227
50100
|
);
|
|
48228
|
-
|
|
48229
|
-
const refreshed = await client.listHostExtensions();
|
|
48230
|
-
if (!disposed && !context2.signal.aborted) {
|
|
48231
|
-
applyLoadedList(refreshed);
|
|
48232
|
-
}
|
|
48233
|
-
}
|
|
50101
|
+
await refreshInstalledAfterMutation();
|
|
48234
50102
|
} catch (error62) {
|
|
48235
50103
|
if (disposed || context2.signal.aborted) return;
|
|
50104
|
+
const modalTargetId = detailModal.extensionId === entry.id ? entry.id : null;
|
|
48236
50105
|
setFeedback(
|
|
48237
50106
|
{
|
|
48238
50107
|
tone: "danger",
|
|
@@ -48241,24 +50110,21 @@ ${detail}` : ""}`
|
|
|
48241
50110
|
modalTargetId
|
|
48242
50111
|
);
|
|
48243
50112
|
} finally {
|
|
50113
|
+
pendingMutations.delete(entry.id);
|
|
48244
50114
|
if (!disposed && !context2.signal.aborted) {
|
|
48245
|
-
mutating = false;
|
|
48246
|
-
activeMutationId = null;
|
|
48247
|
-
activeMutationAction = null;
|
|
48248
50115
|
render();
|
|
48249
|
-
schedulePoll();
|
|
50116
|
+
if (!hasPendingMutations()) schedulePoll();
|
|
48250
50117
|
}
|
|
48251
50118
|
}
|
|
48252
50119
|
};
|
|
48253
50120
|
const importExtension = async (source) => {
|
|
50121
|
+
if (importing || recovering) return;
|
|
48254
50122
|
const client = resolveAvailableClient(getClient);
|
|
48255
50123
|
const install2 = client?.installHostExtension?.bind(client);
|
|
48256
50124
|
if (!install2) {
|
|
48257
50125
|
throw new Error(copy.importUnavailable);
|
|
48258
50126
|
}
|
|
48259
|
-
|
|
48260
|
-
activeMutationId = null;
|
|
48261
|
-
activeMutationAction = "install";
|
|
50127
|
+
importing = true;
|
|
48262
50128
|
clearPollTimer();
|
|
48263
50129
|
syncToolbarState();
|
|
48264
50130
|
try {
|
|
@@ -48278,32 +50144,23 @@ ${detail}` : ""}`
|
|
|
48278
50144
|
version: result.manifest.version
|
|
48279
50145
|
})
|
|
48280
50146
|
});
|
|
48281
|
-
|
|
48282
|
-
const refreshed = await client.listHostExtensions();
|
|
48283
|
-
if (!disposed && !context2.signal.aborted) {
|
|
48284
|
-
applyLoadedList(refreshed);
|
|
48285
|
-
}
|
|
48286
|
-
}
|
|
50147
|
+
await refreshInstalledAfterMutation();
|
|
48287
50148
|
} finally {
|
|
50149
|
+
importing = false;
|
|
48288
50150
|
if (!disposed && !context2.signal.aborted) {
|
|
48289
|
-
mutating = false;
|
|
48290
|
-
activeMutationId = null;
|
|
48291
|
-
activeMutationAction = null;
|
|
48292
50151
|
render();
|
|
48293
|
-
schedulePoll();
|
|
50152
|
+
if (!hasPendingMutations()) schedulePoll();
|
|
48294
50153
|
}
|
|
48295
50154
|
}
|
|
48296
50155
|
};
|
|
48297
50156
|
const uninstallExtension = async (item) => {
|
|
48298
|
-
if (
|
|
50157
|
+
if (recovering || pendingMutations.has(item.id) || disposed || context2.signal.aborted)
|
|
50158
|
+
return;
|
|
48299
50159
|
const client = resolveAvailableClient(getClient);
|
|
48300
50160
|
const uninstall = client?.uninstallHostExtension?.bind(client);
|
|
48301
50161
|
if (!uninstall) return;
|
|
48302
50162
|
const displayName = extensionDisplayName(item, messages.locale);
|
|
48303
|
-
|
|
48304
|
-
mutating = true;
|
|
48305
|
-
activeMutationId = item.id;
|
|
48306
|
-
activeMutationAction = "uninstall";
|
|
50163
|
+
pendingMutations.set(item.id, "uninstall");
|
|
48307
50164
|
clearPollTimer();
|
|
48308
50165
|
render();
|
|
48309
50166
|
try {
|
|
@@ -48315,19 +50172,17 @@ ${detail}` : ""}`
|
|
|
48315
50172
|
if (pageHost.extensionId === item.id) {
|
|
48316
50173
|
pageHost.close();
|
|
48317
50174
|
}
|
|
48318
|
-
detailModal.
|
|
50175
|
+
if (detailModal.extensionId === item.id) {
|
|
50176
|
+
detailModal.close();
|
|
50177
|
+
}
|
|
48319
50178
|
setFeedback({
|
|
48320
50179
|
tone: "success",
|
|
48321
50180
|
text: formatMessage(copy.uninstalledSuccess, { name: displayName })
|
|
48322
50181
|
});
|
|
48323
|
-
|
|
48324
|
-
const refreshed = await client.listHostExtensions();
|
|
48325
|
-
if (!disposed && !context2.signal.aborted) {
|
|
48326
|
-
applyLoadedList(refreshed);
|
|
48327
|
-
}
|
|
48328
|
-
}
|
|
50182
|
+
await refreshInstalledAfterMutation();
|
|
48329
50183
|
} catch (error62) {
|
|
48330
50184
|
if (disposed || context2.signal.aborted) return;
|
|
50185
|
+
const modalTargetId = detailModal.extensionId === item.id ? item.id : null;
|
|
48331
50186
|
setFeedback(
|
|
48332
50187
|
{
|
|
48333
50188
|
tone: "danger",
|
|
@@ -48336,17 +50191,16 @@ ${detail}` : ""}`
|
|
|
48336
50191
|
modalTargetId
|
|
48337
50192
|
);
|
|
48338
50193
|
} finally {
|
|
50194
|
+
pendingMutations.delete(item.id);
|
|
48339
50195
|
if (!disposed && !context2.signal.aborted) {
|
|
48340
|
-
mutating = false;
|
|
48341
|
-
activeMutationId = null;
|
|
48342
|
-
activeMutationAction = null;
|
|
48343
50196
|
render();
|
|
48344
|
-
schedulePoll();
|
|
50197
|
+
if (!hasPendingMutations()) schedulePoll();
|
|
48345
50198
|
}
|
|
48346
50199
|
}
|
|
48347
50200
|
};
|
|
48348
50201
|
const toggleExtension = async (item, enable) => {
|
|
48349
|
-
if (
|
|
50202
|
+
if (recovering || pendingMutations.has(item.id) || disposed || context2.signal.aborted)
|
|
50203
|
+
return;
|
|
48350
50204
|
const client = resolveAvailableClient(getClient);
|
|
48351
50205
|
const mutate = enable ? client?.enableHostExtension?.bind(client) : client?.disableHostExtension?.bind(client);
|
|
48352
50206
|
if (!mutate) {
|
|
@@ -48354,17 +50208,17 @@ ${detail}` : ""}`
|
|
|
48354
50208
|
render();
|
|
48355
50209
|
return;
|
|
48356
50210
|
}
|
|
48357
|
-
const expectedRevision2 = listing?.configuration.revision ?? 0;
|
|
48358
50211
|
const displayName = extensionDisplayName(item, messages.locale);
|
|
48359
|
-
|
|
48360
|
-
mutating = true;
|
|
48361
|
-
activeMutationId = item.id;
|
|
48362
|
-
activeMutationAction = "toggle";
|
|
50212
|
+
pendingMutations.set(item.id, "toggle");
|
|
48363
50213
|
clearPollTimer();
|
|
48364
50214
|
render();
|
|
48365
|
-
|
|
50215
|
+
let shouldReload = false;
|
|
50216
|
+
const runQueued = toggleQueue.then(async () => {
|
|
50217
|
+
if (disposed || context2.signal.aborted) return;
|
|
50218
|
+
const expectedRevision2 = listing?.configuration.revision ?? 0;
|
|
48366
50219
|
const result = await mutate({ id: item.id, expectedRevision: expectedRevision2 });
|
|
48367
50220
|
if (disposed || context2.signal.aborted) return;
|
|
50221
|
+
const modalTargetId = detailModal.extensionId === item.id ? item.id : null;
|
|
48368
50222
|
if (result.state === "saved") {
|
|
48369
50223
|
if (!enable && pageHost.extensionId === item.id) {
|
|
48370
50224
|
pageHost.close();
|
|
@@ -48387,14 +50241,17 @@ ${detail}` : ""}`
|
|
|
48387
50241
|
},
|
|
48388
50242
|
modalTargetId
|
|
48389
50243
|
);
|
|
48390
|
-
|
|
48391
|
-
activeMutationId = null;
|
|
48392
|
-
activeMutationAction = null;
|
|
48393
|
-
render();
|
|
48394
|
-
await loadInstalled({ silent: true, keepFeedback: true });
|
|
50244
|
+
shouldReload = true;
|
|
48395
50245
|
return;
|
|
48396
50246
|
}
|
|
48397
50247
|
if (result.state === "revision-conflict") {
|
|
50248
|
+
listApplyToken += 1;
|
|
50249
|
+
if (listing) {
|
|
50250
|
+
listing = {
|
|
50251
|
+
...listing,
|
|
50252
|
+
configuration: { ...listing.configuration, revision: result.revision }
|
|
50253
|
+
};
|
|
50254
|
+
}
|
|
48398
50255
|
setFeedback(
|
|
48399
50256
|
{
|
|
48400
50257
|
tone: "warning",
|
|
@@ -48402,13 +50259,15 @@ ${detail}` : ""}`
|
|
|
48402
50259
|
},
|
|
48403
50260
|
modalTargetId
|
|
48404
50261
|
);
|
|
48405
|
-
|
|
48406
|
-
activeMutationId = null;
|
|
48407
|
-
activeMutationAction = null;
|
|
48408
|
-
render();
|
|
48409
|
-
await loadInstalled({ silent: true, keepFeedback: true });
|
|
48410
|
-
return;
|
|
50262
|
+
shouldReload = true;
|
|
48411
50263
|
}
|
|
50264
|
+
});
|
|
50265
|
+
toggleQueue = runQueued.then(
|
|
50266
|
+
() => void 0,
|
|
50267
|
+
() => void 0
|
|
50268
|
+
);
|
|
50269
|
+
try {
|
|
50270
|
+
await runQueued;
|
|
48412
50271
|
} catch (error62) {
|
|
48413
50272
|
if (disposed || context2.signal.aborted) return;
|
|
48414
50273
|
if (error62 instanceof RendererMethodUnavailableError) {
|
|
@@ -48417,6 +50276,7 @@ ${detail}` : ""}`
|
|
|
48417
50276
|
setFeedback(null);
|
|
48418
50277
|
return;
|
|
48419
50278
|
}
|
|
50279
|
+
const modalTargetId = detailModal.extensionId === item.id ? item.id : null;
|
|
48420
50280
|
setFeedback(
|
|
48421
50281
|
{
|
|
48422
50282
|
tone: "danger",
|
|
@@ -48425,17 +50285,20 @@ ${detail}` : ""}`
|
|
|
48425
50285
|
modalTargetId
|
|
48426
50286
|
);
|
|
48427
50287
|
} finally {
|
|
50288
|
+
pendingMutations.delete(item.id);
|
|
48428
50289
|
if (!disposed && !context2.signal.aborted) {
|
|
48429
|
-
mutating = false;
|
|
48430
|
-
activeMutationId = null;
|
|
48431
|
-
activeMutationAction = null;
|
|
48432
50290
|
render();
|
|
48433
|
-
|
|
50291
|
+
if (shouldReload) {
|
|
50292
|
+
await loadInstalled({ silent: true, keepFeedback: true });
|
|
50293
|
+
} else if (!hasPendingMutations()) {
|
|
50294
|
+
schedulePoll();
|
|
50295
|
+
}
|
|
48434
50296
|
}
|
|
48435
50297
|
}
|
|
48436
50298
|
};
|
|
48437
50299
|
const openRecoveryDialog = () => {
|
|
48438
|
-
if (disposed || context2.signal.aborted ||
|
|
50300
|
+
if (disposed || context2.signal.aborted || hasPendingMutations() || activeRecoveryDialog)
|
|
50301
|
+
return;
|
|
48439
50302
|
const client = resolveAvailableClient(getClient);
|
|
48440
50303
|
if (!client?.recoverHostExtensions) return;
|
|
48441
50304
|
detailModal.close();
|
|
@@ -48494,7 +50357,7 @@ ${detail}` : ""}`
|
|
|
48494
50357
|
context2.signal.addEventListener("abort", cleanupDialog, { once: true });
|
|
48495
50358
|
form.addEventListener("submit", (event) => {
|
|
48496
50359
|
event.preventDefault();
|
|
48497
|
-
if (dialogBusy ||
|
|
50360
|
+
if (dialogBusy || hasPendingMutations()) return;
|
|
48498
50361
|
const recover = resolveAvailableClient(getClient)?.recoverHostExtensions;
|
|
48499
50362
|
if (!recover) {
|
|
48500
50363
|
modal.close();
|
|
@@ -48504,9 +50367,9 @@ ${detail}` : ""}`
|
|
|
48504
50367
|
}
|
|
48505
50368
|
dialogError.textContent = "";
|
|
48506
50369
|
setDialogBusy(true);
|
|
48507
|
-
|
|
50370
|
+
recovering = true;
|
|
48508
50371
|
clearPollTimer();
|
|
48509
|
-
|
|
50372
|
+
render();
|
|
48510
50373
|
const params = listing !== null ? { expectedRevision: listing.configuration.revision } : {};
|
|
48511
50374
|
void recover(params).then(async (result) => {
|
|
48512
50375
|
if (disposed || context2.signal.aborted) return;
|
|
@@ -48526,31 +50389,40 @@ ${detail}` : ""}`
|
|
|
48526
50389
|
tone: "info",
|
|
48527
50390
|
text: copy.recoverySaved
|
|
48528
50391
|
});
|
|
48529
|
-
|
|
50392
|
+
recovering = false;
|
|
48530
50393
|
modal.close();
|
|
48531
50394
|
render();
|
|
48532
50395
|
await loadInstalled({ silent: true, keepFeedback: true });
|
|
48533
50396
|
return;
|
|
48534
50397
|
}
|
|
48535
50398
|
if (result.state === "revision-conflict") {
|
|
50399
|
+
listApplyToken += 1;
|
|
50400
|
+
if (listing) {
|
|
50401
|
+
listing = {
|
|
50402
|
+
...listing,
|
|
50403
|
+
configuration: { ...listing.configuration, revision: result.revision }
|
|
50404
|
+
};
|
|
50405
|
+
}
|
|
48536
50406
|
setFeedback({
|
|
48537
50407
|
tone: "warning",
|
|
48538
50408
|
text: copy.revisionConflictBanner
|
|
48539
50409
|
});
|
|
48540
|
-
|
|
50410
|
+
recovering = false;
|
|
48541
50411
|
modal.close();
|
|
48542
50412
|
render();
|
|
48543
50413
|
await loadInstalled({ silent: true, keepFeedback: true });
|
|
48544
50414
|
return;
|
|
48545
50415
|
}
|
|
48546
|
-
|
|
50416
|
+
recovering = false;
|
|
48547
50417
|
setDialogBusy(false);
|
|
48548
|
-
|
|
50418
|
+
render();
|
|
50419
|
+
schedulePoll();
|
|
48549
50420
|
}).catch((error62) => {
|
|
48550
50421
|
if (disposed || context2.signal.aborted) return;
|
|
48551
|
-
|
|
50422
|
+
recovering = false;
|
|
48552
50423
|
setDialogBusy(false);
|
|
48553
|
-
|
|
50424
|
+
render();
|
|
50425
|
+
schedulePoll();
|
|
48554
50426
|
if (error62 instanceof RendererMethodUnavailableError) {
|
|
48555
50427
|
modal.close();
|
|
48556
50428
|
unavailable = true;
|
|
@@ -48581,7 +50453,7 @@ ${detail}` : ""}`
|
|
|
48581
50453
|
};
|
|
48582
50454
|
const onVisibilityChange = () => {
|
|
48583
50455
|
if (document2.visibilityState === "hidden") clearPollTimer();
|
|
48584
|
-
else if (!disposed && !context2.signal.aborted && !
|
|
50456
|
+
else if (!disposed && !context2.signal.aborted && !hasPendingMutations() && !loading && !activeRecoveryDialog && !importModal.isOpen) {
|
|
48585
50457
|
void loadInstalled({ silent: true });
|
|
48586
50458
|
}
|
|
48587
50459
|
};
|
|
@@ -48670,14 +50542,14 @@ ${detail}` : ""}`
|
|
|
48670
50542
|
createModal.open();
|
|
48671
50543
|
});
|
|
48672
50544
|
importButton.addEventListener("click", () => {
|
|
48673
|
-
if (
|
|
50545
|
+
if (importing || recovering || !clientCapabilities().canInstall) return;
|
|
48674
50546
|
closeHeaderMenus();
|
|
48675
50547
|
detailModal.close();
|
|
48676
50548
|
createModal.close();
|
|
48677
50549
|
importModal.open();
|
|
48678
50550
|
});
|
|
48679
50551
|
refreshButton.addEventListener("click", () => {
|
|
48680
|
-
if (
|
|
50552
|
+
if (recovering) return;
|
|
48681
50553
|
closeHeaderMenus();
|
|
48682
50554
|
if (activeTab === "marketplace") {
|
|
48683
50555
|
if (!catalogLoading) void loadCatalog({ forceRefresh: true, silent: false });
|
|
@@ -48687,7 +50559,7 @@ ${detail}` : ""}`
|
|
|
48687
50559
|
}
|
|
48688
50560
|
});
|
|
48689
50561
|
bannerRetry.addEventListener("click", () => {
|
|
48690
|
-
if (
|
|
50562
|
+
if (recovering) return;
|
|
48691
50563
|
if (activeTab === "marketplace") {
|
|
48692
50564
|
if (!catalogLoading) void loadCatalog({ forceRefresh: true, silent: false });
|
|
48693
50565
|
} else if (!loading) {
|
|
@@ -48731,6 +50603,9 @@ ${detail}` : ""}`
|
|
|
48731
50603
|
var CONTINUATION_PATTERN = /^[ \t]+(.+?)\s*$/u;
|
|
48732
50604
|
var ORDERED_ITEM_PATTERN = /^\d+[.)][ \t]+(.+?)\s*$/u;
|
|
48733
50605
|
var FENCE_PATTERN2 = /^```([\w+-]*)\s*$/u;
|
|
50606
|
+
var DETAILS_OPEN_PATTERN = /^<details(\s+open)?\s*>$/iu;
|
|
50607
|
+
var DETAILS_CLOSE_PATTERN = /^<\/details>\s*$/iu;
|
|
50608
|
+
var SUMMARY_LINE_PATTERN = /^<summary>(.*?)<\/summary>\s*$/iu;
|
|
48734
50609
|
var THEMATIC_BREAK_PATTERN = /^(?:---|___|\*\*\*)[ \t]*$/u;
|
|
48735
50610
|
var CJK_PATTERN = /[\u3040-\u30ff\u3400-\u9fff\uac00-\ud7af]/u;
|
|
48736
50611
|
var INLINE_PATTERN = /(`+)((?:(?!\1).)+)\1|\*\*(.+?)\*\*|\[([^\]]+)\]\(([^)\s]+)\)/gu;
|
|
@@ -48754,6 +50629,11 @@ ${detail}` : ""}`
|
|
|
48754
50629
|
index = appendFencedCode(document2, root, lines, index, fence[1] ?? "");
|
|
48755
50630
|
continue;
|
|
48756
50631
|
}
|
|
50632
|
+
const detailsOpen = DETAILS_OPEN_PATTERN.exec(line.trim());
|
|
50633
|
+
if (detailsOpen) {
|
|
50634
|
+
index = appendDetails(document2, root, lines, index, Boolean(detailsOpen[1]));
|
|
50635
|
+
continue;
|
|
50636
|
+
}
|
|
48757
50637
|
const heading = HEADING_PATTERN2.exec(line);
|
|
48758
50638
|
if (heading?.[1] && heading[2]) {
|
|
48759
50639
|
const tag = `h${heading[1].length}`;
|
|
@@ -48783,6 +50663,52 @@ ${detail}` : ""}`
|
|
|
48783
50663
|
index = appendParagraph(document2, root, lines, index);
|
|
48784
50664
|
}
|
|
48785
50665
|
}
|
|
50666
|
+
function appendDetails(document2, root, lines, start, open2) {
|
|
50667
|
+
let depth = 1;
|
|
50668
|
+
let index = start + 1;
|
|
50669
|
+
const innerLines = [];
|
|
50670
|
+
while (index < lines.length && depth > 0) {
|
|
50671
|
+
const current = lines[index] ?? "";
|
|
50672
|
+
const trimmed = current.trim();
|
|
50673
|
+
if (DETAILS_OPEN_PATTERN.test(trimmed)) {
|
|
50674
|
+
depth += 1;
|
|
50675
|
+
innerLines.push(current);
|
|
50676
|
+
} else if (DETAILS_CLOSE_PATTERN.test(trimmed)) {
|
|
50677
|
+
depth -= 1;
|
|
50678
|
+
if (depth > 0) innerLines.push(current);
|
|
50679
|
+
} else {
|
|
50680
|
+
innerLines.push(current);
|
|
50681
|
+
}
|
|
50682
|
+
index += 1;
|
|
50683
|
+
}
|
|
50684
|
+
let summaryText = "Details";
|
|
50685
|
+
const bodyLines = [];
|
|
50686
|
+
let foundSummary = false;
|
|
50687
|
+
for (const innerLine of innerLines) {
|
|
50688
|
+
if (!foundSummary && innerLine.trim().length === 0) continue;
|
|
50689
|
+
if (!foundSummary) {
|
|
50690
|
+
const summaryMatch = SUMMARY_LINE_PATTERN.exec(innerLine.trim());
|
|
50691
|
+
if (summaryMatch) {
|
|
50692
|
+
summaryText = summaryMatch[1]?.trim() || "Details";
|
|
50693
|
+
foundSummary = true;
|
|
50694
|
+
continue;
|
|
50695
|
+
}
|
|
50696
|
+
foundSummary = true;
|
|
50697
|
+
}
|
|
50698
|
+
bodyLines.push(innerLine);
|
|
50699
|
+
}
|
|
50700
|
+
const details = document2.createElement("details");
|
|
50701
|
+
if (open2) details.setAttribute("open", "");
|
|
50702
|
+
const summary = document2.createElement("summary");
|
|
50703
|
+
appendInline(document2, summary, summaryText);
|
|
50704
|
+
details.append(summary);
|
|
50705
|
+
const body = document2.createElement("div");
|
|
50706
|
+
body.className = "settings-update-notes-details-body";
|
|
50707
|
+
appendReleaseNotesBlocks(document2, body, bodyLines.join("\n"));
|
|
50708
|
+
details.append(body);
|
|
50709
|
+
root.append(details);
|
|
50710
|
+
return index;
|
|
50711
|
+
}
|
|
48786
50712
|
function appendFencedCode(document2, root, lines, start, language) {
|
|
48787
50713
|
const body = [];
|
|
48788
50714
|
let index = start + 1;
|
|
@@ -48847,7 +50773,7 @@ ${detail}` : ""}`
|
|
|
48847
50773
|
let index = start;
|
|
48848
50774
|
while (index < lines.length) {
|
|
48849
50775
|
const current = lines[index] ?? "";
|
|
48850
|
-
if (current.trim().length === 0 || FENCE_PATTERN2.test(current) || HEADING_PATTERN2.test(current) || BLOCKQUOTE_PATTERN2.test(current) || THEMATIC_BREAK_PATTERN.test(current) || UNORDERED_ITEM_PATTERN.test(current) || ORDERED_ITEM_PATTERN.test(current)) {
|
|
50776
|
+
if (current.trim().length === 0 || FENCE_PATTERN2.test(current) || DETAILS_OPEN_PATTERN.test(current.trim()) || DETAILS_CLOSE_PATTERN.test(current.trim()) || HEADING_PATTERN2.test(current) || BLOCKQUOTE_PATTERN2.test(current) || THEMATIC_BREAK_PATTERN.test(current) || UNORDERED_ITEM_PATTERN.test(current) || ORDERED_ITEM_PATTERN.test(current)) {
|
|
48851
50777
|
break;
|
|
48852
50778
|
}
|
|
48853
50779
|
paragraphLines.push(current.trim());
|
|
@@ -50707,7 +52633,7 @@ ${detail}` : ""}`
|
|
|
50707
52633
|
}
|
|
50708
52634
|
|
|
50709
52635
|
// src/settings/delegation-diagram.ts
|
|
50710
|
-
var
|
|
52636
|
+
var SVG_NS4 = "http://www.w3.org/2000/svg";
|
|
50711
52637
|
var RING_RADIUS = 16.5;
|
|
50712
52638
|
var RING_CIRCUMFERENCE = 2 * Math.PI * RING_RADIUS;
|
|
50713
52639
|
var COMET_TAIL_LENGTH = 72;
|
|
@@ -50759,7 +52685,7 @@ ${detail}` : ""}`
|
|
|
50759
52685
|
{ id: "grok", name: "Grok" }
|
|
50760
52686
|
];
|
|
50761
52687
|
function createSvgElement(doc, tag, attrs) {
|
|
50762
|
-
const el = doc.createElementNS(
|
|
52688
|
+
const el = doc.createElementNS(SVG_NS4, tag);
|
|
50763
52689
|
if (attrs) {
|
|
50764
52690
|
for (const [key2, value] of Object.entries(attrs)) {
|
|
50765
52691
|
el.setAttribute(key2, value);
|
|
@@ -52629,6 +54555,12 @@ ${detail}` : ""}`
|
|
|
52629
54555
|
panel.replaceChildren();
|
|
52630
54556
|
panel.append(createPanelHead(document2, viewPhase, message2));
|
|
52631
54557
|
appendServiceStopOutput(status);
|
|
54558
|
+
if (status?.phase === "failed" && status.error) {
|
|
54559
|
+
const error62 = document2.createElement("p");
|
|
54560
|
+
error62.className = "settings-update-error";
|
|
54561
|
+
error62.textContent = status.error;
|
|
54562
|
+
panel.append(error62);
|
|
54563
|
+
}
|
|
52632
54564
|
setManualFallback(viewPhase === "failed");
|
|
52633
54565
|
if (status?.phase === "downloading" && status.totalBytes !== void 0 && status.downloadedBytes !== void 0) {
|
|
52634
54566
|
const progress = document2.createElement("progress");
|
|
@@ -54783,6 +56715,40 @@ ${detail}` : ""}`
|
|
|
54783
56715
|
white-space: pre-wrap;
|
|
54784
56716
|
}
|
|
54785
56717
|
|
|
56718
|
+
.settings-update-notes details {
|
|
56719
|
+
min-width: 0;
|
|
56720
|
+
border: 1px solid var(--settings-border);
|
|
56721
|
+
border-radius: 8px;
|
|
56722
|
+
background: var(--settings-surface);
|
|
56723
|
+
}
|
|
56724
|
+
|
|
56725
|
+
.settings-update-notes summary {
|
|
56726
|
+
padding: 9px 12px;
|
|
56727
|
+
color: var(--settings-text);
|
|
56728
|
+
font-size: 13px;
|
|
56729
|
+
font-weight: 500;
|
|
56730
|
+
line-height: 20px;
|
|
56731
|
+
cursor: pointer;
|
|
56732
|
+
user-select: none;
|
|
56733
|
+
}
|
|
56734
|
+
|
|
56735
|
+
.settings-update-notes summary:hover {
|
|
56736
|
+
background: var(--settings-hover);
|
|
56737
|
+
border-radius: 7px;
|
|
56738
|
+
}
|
|
56739
|
+
|
|
56740
|
+
.settings-update-notes details[open] > summary {
|
|
56741
|
+
border-bottom: 1px solid var(--settings-divider);
|
|
56742
|
+
border-radius: 7px 7px 0 0;
|
|
56743
|
+
}
|
|
56744
|
+
|
|
56745
|
+
.settings-update-notes-details-body {
|
|
56746
|
+
display: grid;
|
|
56747
|
+
min-width: 0;
|
|
56748
|
+
gap: 10px;
|
|
56749
|
+
padding: 12px;
|
|
56750
|
+
}
|
|
56751
|
+
|
|
54786
56752
|
/* Manual update sits directly under the status panel, not behind a disclosure:
|
|
54787
56753
|
automatic updates can fail for machine-local reasons and this is the way out. */
|
|
54788
56754
|
.settings-update-controls {
|
|
@@ -61464,18 +63430,18 @@ ${renderer_brand_mark_default}`;
|
|
|
61464
63430
|
}
|
|
61465
63431
|
|
|
61466
63432
|
// src/renderer-skill-reference.ts
|
|
61467
|
-
var
|
|
61468
|
-
var
|
|
63433
|
+
var STYLE_ATTRIBUTE4 = "data-codexhost-skill-reference-style";
|
|
63434
|
+
var SVG_NS5 = "http://www.w3.org/2000/svg";
|
|
61469
63435
|
var CUBE = "M12 3 20 7.5v9L12 21l-8-4.5v-9ZM4 7.5 12 12l8-4.5M12 12v9";
|
|
61470
63436
|
function createSkillIcon(ownerDocument) {
|
|
61471
|
-
const svg2 = ownerDocument.createElementNS(
|
|
63437
|
+
const svg2 = ownerDocument.createElementNS(SVG_NS5, "svg");
|
|
61472
63438
|
svg2.setAttribute("viewBox", "0 0 24 24");
|
|
61473
63439
|
svg2.setAttribute("fill", "none");
|
|
61474
63440
|
svg2.setAttribute("stroke", "currentColor");
|
|
61475
63441
|
svg2.setAttribute("stroke-width", "1.7");
|
|
61476
63442
|
svg2.setAttribute("stroke-linejoin", "round");
|
|
61477
63443
|
svg2.setAttribute("aria-hidden", "true");
|
|
61478
|
-
const path = ownerDocument.createElementNS(
|
|
63444
|
+
const path = ownerDocument.createElementNS(SVG_NS5, "path");
|
|
61479
63445
|
path.setAttribute("d", CUBE);
|
|
61480
63446
|
svg2.append(path);
|
|
61481
63447
|
return svg2;
|
|
@@ -61485,10 +63451,10 @@ ${renderer_brand_mark_default}`;
|
|
|
61485
63451
|
}
|
|
61486
63452
|
function installRendererSkillReferences(ownerDocument, isExternalEditor) {
|
|
61487
63453
|
const style2 = ownerDocument.createElement("style");
|
|
61488
|
-
style2.setAttribute(
|
|
63454
|
+
style2.setAttribute(STYLE_ATTRIBUTE4, "true");
|
|
61489
63455
|
const selector = `[agent-mention-path^="${DESKTOP_SKILL_MENTION_PATH_PREFIX}"][agent-mention-display-name]`;
|
|
61490
63456
|
const icon2 = encodeURIComponent(
|
|
61491
|
-
`<svg xmlns="${
|
|
63457
|
+
`<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
63458
|
);
|
|
61493
63459
|
style2.textContent = `${selector}>span{display:none;}
|
|
61494
63460
|
${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 +63566,7 @@ ${selector}::after{content:attr(agent-mention-display-name);}`;
|
|
|
61600
63566
|
|
|
61601
63567
|
// src/renderer-delegation-mention.ts
|
|
61602
63568
|
var MENU_ATTRIBUTE = "data-codexhost-delegation-mention-menu";
|
|
61603
|
-
var
|
|
63569
|
+
var STYLE_ATTRIBUTE5 = "data-codexhost-delegation-mention-style";
|
|
61604
63570
|
var MENU_MAX_HEIGHT = 320;
|
|
61605
63571
|
var SOURCE_TAG = "codexhost";
|
|
61606
63572
|
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 +63644,10 @@ ${selector}::after{content:attr(agent-mention-display-name);}`;
|
|
|
61678
63644
|
return `"${value.replace(/["\\\n]/gu, (character) => `\\${character === "\n" ? "a " : character}`)}"`;
|
|
61679
63645
|
}
|
|
61680
63646
|
function syncChipStyle(ownerDocument, targets, cache) {
|
|
61681
|
-
let style2 = ownerDocument.querySelector(`style[${
|
|
63647
|
+
let style2 = ownerDocument.querySelector(`style[${STYLE_ATTRIBUTE5}]`);
|
|
61682
63648
|
if (!style2) {
|
|
61683
63649
|
style2 = ownerDocument.createElement("style");
|
|
61684
|
-
style2.setAttribute(
|
|
63650
|
+
style2.setAttribute(STYLE_ATTRIBUTE5, "true");
|
|
61685
63651
|
(ownerDocument.head ?? ownerDocument.documentElement).append(style2);
|
|
61686
63652
|
}
|
|
61687
63653
|
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 +64062,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
|
|
|
62096
64062
|
view.removeEventListener("scroll", onViewportChange, true);
|
|
62097
64063
|
options.onClose?.();
|
|
62098
64064
|
menu.remove();
|
|
62099
|
-
ownerDocument.querySelector(`style[${
|
|
64065
|
+
ownerDocument.querySelector(`style[${STYLE_ATTRIBUTE5}]`)?.remove();
|
|
62100
64066
|
};
|
|
62101
64067
|
const openFor = (editor) => {
|
|
62102
64068
|
editor.focus({ preventScroll: true });
|
|
@@ -63426,6 +65392,8 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
|
|
|
63426
65392
|
if (!target2) return true;
|
|
63427
65393
|
if (mutation.type === "attributes" && (mutation.attributeName === "data-codex-composer-root" || NATIVE_COMPOSER_REQUEST_ATTRIBUTES.some((attribute) => attribute === mutation.attributeName)))
|
|
63428
65394
|
return true;
|
|
65395
|
+
if (mutation.type === "attributes" && (mutation.attributeName === "aria-label" || mutation.attributeName === "type"))
|
|
65396
|
+
return target2.closest(CODEX_COMPOSER_SELECTOR) !== null;
|
|
63429
65397
|
if (mutation.type !== "attributes" && editorForElement(target2)) {
|
|
63430
65398
|
return mutation.type === "childList" && [...mutation.addedNodes, ...mutation.removedNodes].some(
|
|
63431
65399
|
(node2) => node2 instanceof Element && hasNativeComposerRequest(node2)
|
|
@@ -63496,6 +65464,8 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
|
|
|
63496
65464
|
let refreshTargetsOnNextScan = false;
|
|
63497
65465
|
let adapterDispose = null;
|
|
63498
65466
|
let applyAdapterAgent = null;
|
|
65467
|
+
let canOpenAdapterHandoff = null;
|
|
65468
|
+
let openAdapterHandoff = null;
|
|
63499
65469
|
let modelControl = null;
|
|
63500
65470
|
const activeModelHostId = (composer) => {
|
|
63501
65471
|
if (!modelControl) return null;
|
|
@@ -63750,6 +65720,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
|
|
|
63750
65720
|
}
|
|
63751
65721
|
}
|
|
63752
65722
|
}
|
|
65723
|
+
const composerHandoffAvailable = (composer) => Boolean(openAdapterHandoff && canOpenAdapterHandoff?.(composer));
|
|
63753
65724
|
const renderMounted = (mounted) => {
|
|
63754
65725
|
if (!isMountedComposer(mounted.composer)) return;
|
|
63755
65726
|
restorePendingDraftPreference(mounted);
|
|
@@ -63765,6 +65736,8 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
|
|
|
63765
65736
|
);
|
|
63766
65737
|
const catalogRequest = catalogRequests.get(mounted);
|
|
63767
65738
|
const refreshing = catalogRequest?.refreshing && controller.isCurrentModelRequest(mounted.composer, catalogRequest.generation);
|
|
65739
|
+
const handoffAvailable = composerHandoffAvailable(mounted.composer);
|
|
65740
|
+
mounted.handoffAvailable = handoffAvailable;
|
|
63768
65741
|
const externalSubmissionReady = renderComposerAgentControl(
|
|
63769
65742
|
mounted.control,
|
|
63770
65743
|
controller.get(mounted.composer),
|
|
@@ -63778,7 +65751,8 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
|
|
|
63778
65751
|
settingsLifecycle.locale,
|
|
63779
65752
|
currentCodexAccount ?? null,
|
|
63780
65753
|
mounted.ownershipStatus === "error",
|
|
63781
|
-
mounted.accountBalance
|
|
65754
|
+
mounted.accountBalance,
|
|
65755
|
+
handoffAvailable
|
|
63782
65756
|
);
|
|
63783
65757
|
const nativeTargetResolved = mounted.modelTarget?.[0] === "default" || mounted.modelTarget?.[0] === "conversation";
|
|
63784
65758
|
const nativeEligible = nativeTargetResolved && controller.get(mounted.composer).agent === "codex" && mounted.ownershipStatus !== "loading" && mounted.ownershipStatus !== "error" && !controller.isSwitching(mounted.composer);
|
|
@@ -63900,11 +65874,12 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
|
|
|
63900
65874
|
renderMounted(mounted);
|
|
63901
65875
|
}
|
|
63902
65876
|
};
|
|
65877
|
+
function isDraftUsageComposer(mounted) {
|
|
65878
|
+
return controller.get(mounted.composer).phase === "draft" && !controller.isSwitching(mounted.composer) && !controller.isSubmissionPending(mounted.composer) && !threadIdFromComposerModelTarget(mounted.modelTarget);
|
|
65879
|
+
}
|
|
63903
65880
|
const refreshDraftUsage = async (mounted) => {
|
|
63904
|
-
|
|
63905
|
-
|
|
63906
|
-
return;
|
|
63907
|
-
const agent = state.agent;
|
|
65881
|
+
if (!isDraftUsageComposer(mounted)) return;
|
|
65882
|
+
const agent = controller.get(mounted.composer).agent;
|
|
63908
65883
|
const accounts = agent === "codex" ? composerCodexAccounts(mounted.composer) : null;
|
|
63909
65884
|
const accountId = accounts?.readyAccountId;
|
|
63910
65885
|
const client = composerClient(mounted);
|
|
@@ -63921,7 +65896,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
|
|
|
63921
65896
|
mounted.accountBalance = null;
|
|
63922
65897
|
mounted.accountCreditsSupported = false;
|
|
63923
65898
|
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 &&
|
|
65899
|
+
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
65900
|
try {
|
|
63926
65901
|
if (!client) return;
|
|
63927
65902
|
if (agent === "codex") {
|
|
@@ -65326,7 +67301,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
|
|
|
65326
67301
|
const client = composerClient(mounted);
|
|
65327
67302
|
const request = draftUsageRequests.get(mounted);
|
|
65328
67303
|
const state = controller.get(mounted.composer);
|
|
65329
|
-
if (
|
|
67304
|
+
if (isDraftUsageComposer(mounted) && mounted.draftUsageClient !== client && (!request || request.client !== client || request.generation !== mounted.usageRequestGeneration || retryDraftUsage && !request.pending)) {
|
|
65330
67305
|
if (state.agent === "codex") void loadCodexAccountsForHost(mounted.hostId);
|
|
65331
67306
|
else void refreshDraftUsage(mounted);
|
|
65332
67307
|
}
|
|
@@ -65537,6 +67512,10 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
|
|
|
65537
67512
|
() => {
|
|
65538
67513
|
const mounted2 = mountedByComposer.get(composer);
|
|
65539
67514
|
if (mounted2) void refreshExternalModels(mounted2);
|
|
67515
|
+
},
|
|
67516
|
+
(agent, anchor2) => {
|
|
67517
|
+
if (!composer.isConnected) return;
|
|
67518
|
+
openAdapterHandoff?.(composer, agent, anchor2);
|
|
65540
67519
|
}
|
|
65541
67520
|
);
|
|
65542
67521
|
if (!pendingDefaultPreferences.has(state.composerId)) {
|
|
@@ -65569,7 +67548,8 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
|
|
|
65569
67548
|
hostId: inherited?.hostId ?? hostId2,
|
|
65570
67549
|
usageRequestGeneration: 0,
|
|
65571
67550
|
draftUsageClient: null,
|
|
65572
|
-
commandRequestGeneration: 0
|
|
67551
|
+
commandRequestGeneration: 0,
|
|
67552
|
+
handoffAvailable: false
|
|
65573
67553
|
};
|
|
65574
67554
|
mountedByComposer.set(composer, mounted);
|
|
65575
67555
|
if (isComposerModelWriteAllowed(modelTarget)) {
|
|
@@ -65659,6 +67639,9 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
|
|
|
65659
67639
|
const hideCodexControls = controller.isSwitching(composer) || state.agent !== "codex";
|
|
65660
67640
|
reconcileComposerNativeControls(mounted.control, hideCodexControls, hideCodexControls);
|
|
65661
67641
|
showCodexUsageGateStatus(mounted, mounted.codexUsageGate.refresh());
|
|
67642
|
+
if (composerHandoffAvailable(composer) !== mounted.handoffAvailable) {
|
|
67643
|
+
renderMounted(mounted);
|
|
67644
|
+
}
|
|
65662
67645
|
}
|
|
65663
67646
|
for (const editor of document.querySelectorAll(EDITOR_SELECTOR)) {
|
|
65664
67647
|
const composer = composerForEditor(editor);
|
|
@@ -65846,7 +67829,7 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
|
|
|
65846
67829
|
const state = controller.get(mounted.composer);
|
|
65847
67830
|
if (state.agent !== "codex" && !threadIdFromComposerModelTarget(mounted.modelTarget) && !isExternalConfigurationStable(mounted.modelView, mounted.permissionModeView)) {
|
|
65848
67831
|
void loadExternalCatalog(mounted);
|
|
65849
|
-
} else if (state.agent === "codex" && !threadIdFromComposerModelTarget(mounted.modelTarget)) {
|
|
67832
|
+
} else if (state.agent === "codex" && !threadIdFromComposerModelTarget(mounted.modelTarget) || composerHandoffAvailable(mounted.composer) !== mounted.handoffAvailable) {
|
|
65850
67833
|
renderMounted(mounted);
|
|
65851
67834
|
}
|
|
65852
67835
|
}
|
|
@@ -65873,6 +67856,8 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
|
|
|
65873
67856
|
attributeFilter: [
|
|
65874
67857
|
"hidden",
|
|
65875
67858
|
"aria-hidden",
|
|
67859
|
+
"aria-label",
|
|
67860
|
+
"type",
|
|
65876
67861
|
"data-codex-composer-root",
|
|
65877
67862
|
...NATIVE_COMPOSER_REQUEST_ATTRIBUTES
|
|
65878
67863
|
],
|
|
@@ -66098,11 +68083,13 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
|
|
|
66098
68083
|
...permissionModeId ? { permissionModeId } : {}
|
|
66099
68084
|
};
|
|
66100
68085
|
},
|
|
66101
|
-
setAdapter(status, dispose, applyAgent, nextModelControl) {
|
|
68086
|
+
setAdapter(status, dispose, applyAgent, nextModelControl, nextOpenHandoff, nextCanOpenHandoff) {
|
|
66102
68087
|
usageNotificationDispose();
|
|
66103
68088
|
adapterDispose?.();
|
|
66104
68089
|
adapterDispose = dispose ?? null;
|
|
66105
68090
|
applyAdapterAgent = applyAgent ?? null;
|
|
68091
|
+
openAdapterHandoff = nextOpenHandoff ?? null;
|
|
68092
|
+
canOpenAdapterHandoff = nextCanOpenHandoff ?? null;
|
|
66106
68093
|
modelControl = nextModelControl ?? null;
|
|
66107
68094
|
adapterStatus = status;
|
|
66108
68095
|
widgets.refresh();
|
|
@@ -66165,6 +68152,8 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
|
|
|
66165
68152
|
adapterDispose?.();
|
|
66166
68153
|
adapterDispose = null;
|
|
66167
68154
|
applyAdapterAgent = null;
|
|
68155
|
+
openAdapterHandoff = null;
|
|
68156
|
+
canOpenAdapterHandoff = null;
|
|
66168
68157
|
modelControl = null;
|
|
66169
68158
|
mutationObserver.disconnect();
|
|
66170
68159
|
disposeReasoningSoftWrap();
|
|
@@ -66219,7 +68208,14 @@ ${skill.description ?? ""}`.toLowerCase().includes(needle)
|
|
|
66219
68208
|
const binding = installRendererBindingProbe({ ...enabledAgents ? { enabledAgents } : {} });
|
|
66220
68209
|
try {
|
|
66221
68210
|
const adapter = installCurrentRendererAdapter();
|
|
66222
|
-
binding.setAdapter(
|
|
68211
|
+
binding.setAdapter(
|
|
68212
|
+
adapter.status,
|
|
68213
|
+
adapter.dispose,
|
|
68214
|
+
adapter.applyAgent,
|
|
68215
|
+
adapter.modelControl,
|
|
68216
|
+
adapter.openHandoff,
|
|
68217
|
+
adapter.canOpenHandoff
|
|
68218
|
+
);
|
|
66223
68219
|
} catch (error62) {
|
|
66224
68220
|
console.error(
|
|
66225
68221
|
"codexhost Renderer Adapter installation failed",
|