dsh-github-copilot 0.4.0-alpha.32 → 0.4.0-alpha.34
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/AGENTS.md +3 -3
- package/CHANGELOG.md +14 -0
- package/README.md +13 -11
- package/README.zh.md +13 -11
- package/deployment-baseline.json +8 -2
- package/docs/copilot-usage.md +8 -0
- package/docs/dual-model.md +29 -74
- package/docs/official-first-016-alpha2.md +7 -1
- package/lib/client.js +37 -719
- package/lib/client.js.map +1 -1
- package/lib/index.js +28 -160
- package/lib/types/client.d.ts +0 -1
- package/lib/types/dual-model-host.d.ts +1 -2
- package/package.json +1 -1
- package/lib/types/current-workspace.d.ts +0 -10
- package/lib/types/dual-model-card.d.ts +0 -53
- package/lib/types/dual-model-ui.d.ts +0 -5
package/lib/client.js
CHANGED
|
@@ -5113,7 +5113,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5113
5113
|
return required(ZodNonOptional, this, args[0]);
|
|
5114
5114
|
}
|
|
5115
5115
|
});
|
|
5116
|
-
function object
|
|
5116
|
+
function object(shape, params) {
|
|
5117
5117
|
const def = {
|
|
5118
5118
|
type: "object",
|
|
5119
5119
|
shape: shape ?? {},
|
|
@@ -5380,36 +5380,36 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5380
5380
|
//#region lib/types/dual-model-remote.js
|
|
5381
5381
|
const id = string().min(1).max(512);
|
|
5382
5382
|
const revision = number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
|
|
5383
|
-
const DualModelConfigSchema = object
|
|
5383
|
+
const DualModelConfigSchema = object({
|
|
5384
5384
|
enabled: boolean(),
|
|
5385
5385
|
plannerModel: string().max(512),
|
|
5386
5386
|
executorModel: string().max(512)
|
|
5387
5387
|
}).strict();
|
|
5388
|
-
const DualModelViewSchema = object
|
|
5388
|
+
const DualModelViewSchema = object({
|
|
5389
5389
|
supported: boolean(),
|
|
5390
5390
|
diagnostic: string().min(1).max(128).optional(),
|
|
5391
5391
|
writable: boolean(),
|
|
5392
5392
|
revision: revision.nullable(),
|
|
5393
5393
|
configuration: DualModelConfigSchema,
|
|
5394
|
-
models: array(object
|
|
5394
|
+
models: array(object({
|
|
5395
5395
|
id,
|
|
5396
5396
|
name: string().min(1).max(1024)
|
|
5397
5397
|
}).strict()).max(512),
|
|
5398
|
-
workspaces: array(object
|
|
5398
|
+
workspaces: array(object({
|
|
5399
5399
|
id,
|
|
5400
5400
|
name: string().min(1).max(1024)
|
|
5401
5401
|
}).strict()).max(1024)
|
|
5402
5402
|
}).strict();
|
|
5403
|
-
const DualModelSaveSchema = object
|
|
5403
|
+
const DualModelSaveSchema = object({
|
|
5404
5404
|
configuration: DualModelConfigSchema,
|
|
5405
5405
|
expectedRevision: revision
|
|
5406
5406
|
}).strict();
|
|
5407
|
-
const DualModelCreateSchema = object
|
|
5407
|
+
const DualModelCreateSchema = object({
|
|
5408
5408
|
requestId: string().uuid(),
|
|
5409
5409
|
workspaceId: id,
|
|
5410
5410
|
expectedRevision: revision
|
|
5411
5411
|
}).strict();
|
|
5412
|
-
const DualModelCreateResultSchema = object
|
|
5412
|
+
const DualModelCreateResultSchema = object({ sessionId: id }).strict();
|
|
5413
5413
|
const contribution$3 = {
|
|
5414
5414
|
package: "dsh-github-copilot",
|
|
5415
5415
|
descriptors: [
|
|
@@ -5454,9 +5454,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5454
5454
|
};
|
|
5455
5455
|
//#endregion
|
|
5456
5456
|
//#region lib/types/search-routing-remote.js
|
|
5457
|
-
const SearchProviderCatalogSchema = object
|
|
5457
|
+
const SearchProviderCatalogSchema = object({
|
|
5458
5458
|
supported: boolean(),
|
|
5459
|
-
providers: array(object
|
|
5459
|
+
providers: array(object({ id: string().min(1).max(512) }).strict()).max(512)
|
|
5460
5460
|
}).strict();
|
|
5461
5461
|
const contribution$2 = {
|
|
5462
5462
|
package: "dsh-github-copilot",
|
|
@@ -5499,7 +5499,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5499
5499
|
//#region lib/types/copilot-usage-remote.js
|
|
5500
5500
|
const amount$1 = number().finite().nonnegative().max(COPILOT_USAGE_MAX_AMOUNT);
|
|
5501
5501
|
const timestamp = number().int().nonnegative().max(COPILOT_USAGE_MAX_TIMESTAMP);
|
|
5502
|
-
const CopilotUsageViewSchema = object
|
|
5502
|
+
const CopilotUsageViewSchema = object({
|
|
5503
5503
|
state: _enum([
|
|
5504
5504
|
"ready",
|
|
5505
5505
|
"stale",
|
|
@@ -5568,7 +5568,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5568
5568
|
*/
|
|
5569
5569
|
const direct = { kind: "direct" };
|
|
5570
5570
|
const GITHUB_COPILOT_AUTHORIZATION_VIEW_TYPE_SYMBOL = "dsh-github-copilot#GitHubCopilotAuthorizationView";
|
|
5571
|
-
const GitHubCopilotAuthorizationViewSchema = object
|
|
5571
|
+
const GitHubCopilotAuthorizationViewSchema = object({
|
|
5572
5572
|
phase: _enum([
|
|
5573
5573
|
"signed-out",
|
|
5574
5574
|
"authorizing",
|
|
@@ -5578,12 +5578,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5578
5578
|
configured: boolean(),
|
|
5579
5579
|
writable: boolean(),
|
|
5580
5580
|
inFlight: boolean(),
|
|
5581
|
-
notices: array(object
|
|
5581
|
+
notices: array(object({
|
|
5582
5582
|
message: string(),
|
|
5583
5583
|
url: string().optional(),
|
|
5584
5584
|
code: string().optional()
|
|
5585
5585
|
}).strict()),
|
|
5586
|
-
catalog: object
|
|
5586
|
+
catalog: object({
|
|
5587
5587
|
state: _enum([
|
|
5588
5588
|
"current",
|
|
5589
5589
|
"partially-outdated",
|
|
@@ -5595,7 +5595,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5595
5595
|
temporarilyUnavailableModelIds: array(string()).optional(),
|
|
5596
5596
|
previewModelIds: array(string()).optional()
|
|
5597
5597
|
}).strict().optional(),
|
|
5598
|
-
accountModels: object
|
|
5598
|
+
accountModels: object({
|
|
5599
5599
|
state: _enum([
|
|
5600
5600
|
"idle",
|
|
5601
5601
|
"loading",
|
|
@@ -5606,23 +5606,23 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5606
5606
|
"unconfigured",
|
|
5607
5607
|
"unavailable"
|
|
5608
5608
|
]),
|
|
5609
|
-
models: array(object
|
|
5609
|
+
models: array(object({
|
|
5610
5610
|
id: string(),
|
|
5611
5611
|
name: string(),
|
|
5612
5612
|
api: string()
|
|
5613
5613
|
}).strict()).max(512),
|
|
5614
|
-
rejected: array(object
|
|
5614
|
+
rejected: array(object({
|
|
5615
5615
|
id: string().optional(),
|
|
5616
5616
|
code: string()
|
|
5617
5617
|
}).strict()).max(1024),
|
|
5618
|
-
warnings: array(object
|
|
5618
|
+
warnings: array(object({
|
|
5619
5619
|
id: string(),
|
|
5620
5620
|
code: string()
|
|
5621
5621
|
}).strict()).max(1024).optional(),
|
|
5622
5622
|
discoveredAt: number().int().nonnegative().optional(),
|
|
5623
5623
|
error: string().optional()
|
|
5624
5624
|
}).strict().optional(),
|
|
5625
|
-
route: object
|
|
5625
|
+
route: object({
|
|
5626
5626
|
state: _enum([
|
|
5627
5627
|
"ready",
|
|
5628
5628
|
"needs-repair",
|
|
@@ -5640,34 +5640,34 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5640
5640
|
}).strict();
|
|
5641
5641
|
const result = strictRemoteCodec(GITHUB_COPILOT_AUTHORIZATION_VIEW_TYPE_SYMBOL, GitHubCopilotAuthorizationViewSchema);
|
|
5642
5642
|
const GITHUB_COPILOT_MIGRATION_STATUS_TYPE_SYMBOL = "dsh-github-copilot#GitHubCopilotMigrationStatus";
|
|
5643
|
-
const selectionSchema = object
|
|
5643
|
+
const selectionSchema = object({
|
|
5644
5644
|
provider: string().min(1).max(512),
|
|
5645
5645
|
model: string().min(1).max(512),
|
|
5646
5646
|
reasoningEffort: string().min(1).max(512).optional()
|
|
5647
5647
|
}).strict();
|
|
5648
5648
|
/** Independent Ops result: strict at every object level; no account or private Session data. */
|
|
5649
|
-
const GitHubCopilotMigrationStatusSchema = object
|
|
5650
|
-
plugin: object
|
|
5649
|
+
const GitHubCopilotMigrationStatusSchema = object({
|
|
5650
|
+
plugin: object({
|
|
5651
5651
|
name: literal("dsh-github-copilot"),
|
|
5652
5652
|
version: string().min(1).max(512)
|
|
5653
5653
|
}).strict(),
|
|
5654
5654
|
protocolVersion: literal(1),
|
|
5655
5655
|
historyScope: literal("live-agents-only"),
|
|
5656
5656
|
observedAt: number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
|
|
5657
|
-
capabilities: object
|
|
5657
|
+
capabilities: object({
|
|
5658
5658
|
agentsList: boolean(),
|
|
5659
5659
|
sessionProjections: boolean(),
|
|
5660
5660
|
settingsCas: boolean(),
|
|
5661
5661
|
providerRegistry: boolean(),
|
|
5662
5662
|
defaultSelection: boolean()
|
|
5663
5663
|
}).strict(),
|
|
5664
|
-
complete: object
|
|
5664
|
+
complete: object({
|
|
5665
5665
|
sessions: boolean(),
|
|
5666
5666
|
defaultSelection: boolean(),
|
|
5667
5667
|
routes: boolean()
|
|
5668
5668
|
}).strict(),
|
|
5669
5669
|
defaultSelection: selectionSchema.nullable(),
|
|
5670
|
-
sessions: array(object
|
|
5670
|
+
sessions: array(object({
|
|
5671
5671
|
id: string().min(1).max(512),
|
|
5672
5672
|
status: _enum(["idle", "running"]),
|
|
5673
5673
|
effectiveSelection: selectionSchema.nullable(),
|
|
@@ -5679,7 +5679,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5679
5679
|
]),
|
|
5680
5680
|
activeRequestSelection: selectionSchema.nullable()
|
|
5681
5681
|
}).strict()).max(1024),
|
|
5682
|
-
routes: object
|
|
5682
|
+
routes: object({
|
|
5683
5683
|
nativeConfigured: boolean().nullable(),
|
|
5684
5684
|
nativeRegistered: boolean().nullable(),
|
|
5685
5685
|
managedRegistered: boolean().nullable()
|
|
@@ -6018,7 +6018,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6018
6018
|
const WEB_SEARCH_ROUTING_SETTINGS_NAMESPACE = "github-copilot-search-routing";
|
|
6019
6019
|
const GITHUB_COPILOT_SEARCH_PROVIDER = "github-copilot-hosted";
|
|
6020
6020
|
const DEEPSEEK_SEARCH_PROVIDER = "deepseek-official";
|
|
6021
|
-
const cardStyle
|
|
6021
|
+
const cardStyle = {
|
|
6022
6022
|
display: "grid",
|
|
6023
6023
|
gap: "14px",
|
|
6024
6024
|
padding: "18px",
|
|
@@ -6028,12 +6028,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6028
6028
|
borderRadius: "14px",
|
|
6029
6029
|
background: "color-mix(in srgb, currentColor 4%, transparent)"
|
|
6030
6030
|
};
|
|
6031
|
-
const fieldStyle
|
|
6031
|
+
const fieldStyle = {
|
|
6032
6032
|
display: "grid",
|
|
6033
6033
|
gap: "6px",
|
|
6034
6034
|
minWidth: 0
|
|
6035
6035
|
};
|
|
6036
|
-
const buttonStyle
|
|
6036
|
+
const buttonStyle = {
|
|
6037
6037
|
justifySelf: "start",
|
|
6038
6038
|
padding: "9px 16px",
|
|
6039
6039
|
borderRadius: "999px",
|
|
@@ -6264,7 +6264,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6264
6264
|
style: nativeOptionStyle(true)
|
|
6265
6265
|
}, `${id || "(empty)"} — unavailable`);
|
|
6266
6266
|
return (0, react.createElement)("section", {
|
|
6267
|
-
style: cardStyle
|
|
6267
|
+
style: cardStyle,
|
|
6268
6268
|
"data-dsh-web-search-routing": true,
|
|
6269
6269
|
"aria-busy": loading || saving !== void 0
|
|
6270
6270
|
}, (0, react.createElement)("div", null, (0, react.createElement)("h3", { style: {
|
|
@@ -6275,7 +6275,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6275
6275
|
opacity: .8,
|
|
6276
6276
|
fontSize: "13px",
|
|
6277
6277
|
lineHeight: 1.5
|
|
6278
|
-
} }, "Choose who runs web searches. This does not change your Chat model.")), (0, react.createElement)("label", { style: fieldStyle
|
|
6278
|
+
} }, "Choose who runs web searches. This does not change your Chat model.")), (0, react.createElement)("label", { style: fieldStyle }, (0, react.createElement)("span", { style: {
|
|
6279
6279
|
fontSize: "13px",
|
|
6280
6280
|
fontWeight: 600
|
|
6281
6281
|
} }, "Search provider"), (0, react.createElement)("select", {
|
|
@@ -6297,7 +6297,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6297
6297
|
}, "Auto — follow Chat"), draft.primary === "none" ? (0, react.createElement)("option", {
|
|
6298
6298
|
value: "none",
|
|
6299
6299
|
style: nativeOptionStyle()
|
|
6300
|
-
}, "Disabled — saved configuration") : null, ...providerOptions(), unavailableOption(draft.primary, primaryKnown)), (0, react.createElement)("span", { style: hintStyle }, "Auto follows the Chat provider when it supports search. A selected provider stays fixed when you switch Chat models.")), (0, react.createElement)("label", { style: fieldStyle
|
|
6300
|
+
}, "Disabled — saved configuration") : null, ...providerOptions(), unavailableOption(draft.primary, primaryKnown)), (0, react.createElement)("span", { style: hintStyle }, "Auto follows the Chat provider when it supports search. A selected provider stays fixed when you switch Chat models.")), (0, react.createElement)("label", { style: fieldStyle }, (0, react.createElement)("span", { style: {
|
|
6301
6301
|
fontSize: "13px",
|
|
6302
6302
|
fontWeight: 600
|
|
6303
6303
|
} }, "Fallback provider"), (0, react.createElement)("select", {
|
|
@@ -6326,11 +6326,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6326
6326
|
cursor: "pointer",
|
|
6327
6327
|
fontSize: "13px"
|
|
6328
6328
|
} }, "Existing Copilot model override"), (0, react.createElement)("div", { style: {
|
|
6329
|
-
...fieldStyle
|
|
6329
|
+
...fieldStyle,
|
|
6330
6330
|
marginTop: "8px"
|
|
6331
6331
|
} }, (0, react.createElement)("p", { style: hintStyle }, "Your saved override ", (0, react.createElement)("code", null, override.model), " is preserved. Saving providers does not change it."), (0, react.createElement)("button", {
|
|
6332
6332
|
type: "button",
|
|
6333
|
-
style: buttonStyle
|
|
6333
|
+
style: buttonStyle,
|
|
6334
6334
|
disabled: disabled || override.revision === void 0,
|
|
6335
6335
|
"data-dsh-copilot-search-reset": true,
|
|
6336
6336
|
onClick: () => {
|
|
@@ -6343,7 +6343,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6343
6343
|
flexWrap: "wrap"
|
|
6344
6344
|
} }, (0, react.createElement)("button", {
|
|
6345
6345
|
type: "button",
|
|
6346
|
-
style: buttonStyle
|
|
6346
|
+
style: buttonStyle,
|
|
6347
6347
|
disabled: disabled || missingProvider,
|
|
6348
6348
|
"data-dsh-web-search-save": true,
|
|
6349
6349
|
onClick: () => {
|
|
@@ -6351,7 +6351,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6351
6351
|
}
|
|
6352
6352
|
}, loading ? "Loading…" : saving === "routing" ? "Saving…" : "Save search routing"), (0, react.createElement)("button", {
|
|
6353
6353
|
type: "button",
|
|
6354
|
-
style: buttonStyle
|
|
6354
|
+
style: buttonStyle,
|
|
6355
6355
|
disabled: loading || saving !== void 0,
|
|
6356
6356
|
title: "Reload saved values and discard unsaved edits",
|
|
6357
6357
|
"data-dsh-web-search-reload": true,
|
|
@@ -6369,500 +6369,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6369
6369
|
}, message));
|
|
6370
6370
|
}
|
|
6371
6371
|
//#endregion
|
|
6372
|
-
//#region lib/types/dual-model-card.js
|
|
6373
|
-
const creations = /* @__PURE__ */ new WeakMap();
|
|
6374
|
-
const off = {
|
|
6375
|
-
enabled: false,
|
|
6376
|
-
plannerModel: "",
|
|
6377
|
-
executorModel: ""
|
|
6378
|
-
};
|
|
6379
|
-
const copy$1 = {
|
|
6380
|
-
en: {
|
|
6381
|
-
title: "Model roles",
|
|
6382
|
-
description: "The planning model plans and reviews acceptance. The execution model changes code and runs tests.",
|
|
6383
|
-
scope: "These role settings are profile-global, not workspace-specific. They apply only when you explicitly create a dedicated dual-model session. Ordinary and existing sessions, history, and the global default stay unchanged. Models are never substituted automatically.",
|
|
6384
|
-
enabled: "Enable dual-model sessions",
|
|
6385
|
-
planner: "Planning model",
|
|
6386
|
-
executor: "Execution model",
|
|
6387
|
-
acceptance: "Acceptance always uses the planning model.",
|
|
6388
|
-
selectModel: "Select an available model",
|
|
6389
|
-
unavailable: "unavailable",
|
|
6390
|
-
modelsMissing: "Choose two available account models to save an enabled configuration. An unavailable saved model is kept, not replaced.",
|
|
6391
|
-
newSession: "New dedicated session",
|
|
6392
|
-
sessionScope: "Create a new session in the current workspace using the saved role settings.",
|
|
6393
|
-
workspace: "New session destination",
|
|
6394
|
-
originalWorkspace: "Original destination (retained for this request)",
|
|
6395
|
-
noWorkspace: "No current workspace. Open a workspace to create a session; you can still save role settings.",
|
|
6396
|
-
currentWorkspaceUnavailable: "The current workspace is unavailable. Open an accessible workspace and reload settings before creating a session.",
|
|
6397
|
-
save: "Save configuration",
|
|
6398
|
-
saving: "Saving…",
|
|
6399
|
-
create: "Create session with this configuration",
|
|
6400
|
-
creating: "Creating session…",
|
|
6401
|
-
retryCreate: "Retry the same creation request",
|
|
6402
|
-
openCreated: "Open created session",
|
|
6403
|
-
reload: "Reload settings",
|
|
6404
|
-
reloadTitle: "Reload saved values and discard unsaved edits",
|
|
6405
|
-
loading: "Loading model roles…",
|
|
6406
|
-
dirty: "Save your changes before creating a session.",
|
|
6407
|
-
disabled: "Dual-model sessions are off. You can save this configuration, but cannot create a dual-model session.",
|
|
6408
|
-
readonly: "These settings are read-only. Ask the deployment owner to enable writes, then reload settings.",
|
|
6409
|
-
unsupported: "Dual-model sessions are unavailable in this deployment. Check plugin support, then reload settings.",
|
|
6410
|
-
revision: "A settings revision is unavailable. Reload settings before saving or creating a session.",
|
|
6411
|
-
conflict: "These settings changed elsewhere. Reload settings to review the saved configuration before trying again.",
|
|
6412
|
-
modelUnavailable: "A selected model is unavailable. Reload settings and choose available account models. No model was substituted.",
|
|
6413
|
-
workspaceUnavailable: "The creation workspace is unavailable. Open an accessible workspace and reload settings before creating a new session.",
|
|
6414
|
-
loadError: "Could not load model roles. Reload settings to retry.",
|
|
6415
|
-
saveError: "The save was not confirmed. Reload settings to check the saved configuration before trying again.",
|
|
6416
|
-
uncertain: "Session creation is not confirmed. Retry the same request to recover its result without creating a duplicate. Workspace and configuration are held until confirmation.",
|
|
6417
|
-
pending: "A previous creation request needs confirmation. Retry the same request; it is not replayed automatically.",
|
|
6418
|
-
saved: "Saved. This configuration applies only to new dual-model sessions.",
|
|
6419
|
-
created: "Session created.",
|
|
6420
|
-
openError: "Session created, but navigation failed. Open the created session from the session list.",
|
|
6421
|
-
requestUnavailable: "Secure request IDs are unavailable in this browser. Use a secure browser context before creating a session."
|
|
6422
|
-
},
|
|
6423
|
-
zh: {
|
|
6424
|
-
title: "模型分工",
|
|
6425
|
-
description: "主模型负责规划与验收;执行模型负责修改代码和运行测试。",
|
|
6426
|
-
scope: "模型分工设置适用于整个配置档案,不按工作区保存;仅在显式新建专用双模型会话时生效。普通会话、已有会话、历史记录和全局默认模型保持不变。不会自动替换模型。",
|
|
6427
|
-
enabled: "启用双模型会话",
|
|
6428
|
-
planner: "主模型(规划)",
|
|
6429
|
-
executor: "执行模型",
|
|
6430
|
-
acceptance: "验收固定跟随主模型。",
|
|
6431
|
-
selectModel: "选择可用模型",
|
|
6432
|
-
unavailable: "不可用",
|
|
6433
|
-
modelsMissing: "启用时须选择两个当前账号可用的模型才能保存。已保存但不可用的模型会保留,不会自动替换。",
|
|
6434
|
-
newSession: "新建专用会话",
|
|
6435
|
-
sessionScope: "使用已保存的模型分工设置,在当前工作区新建会话。",
|
|
6436
|
-
workspace: "新会话目标工作区",
|
|
6437
|
-
originalWorkspace: "原目标工作区(为此请求保留)",
|
|
6438
|
-
noWorkspace: "当前没有工作区。请打开工作区后新建会话;仍可保存模型分工设置。",
|
|
6439
|
-
currentWorkspaceUnavailable: "当前工作区不可用。请打开可访问的工作区并重新加载设置后,再新建会话。",
|
|
6440
|
-
save: "保存配置",
|
|
6441
|
-
saving: "正在保存…",
|
|
6442
|
-
create: "用此配置新建会话",
|
|
6443
|
-
creating: "正在创建会话…",
|
|
6444
|
-
retryCreate: "重试同一创建请求",
|
|
6445
|
-
openCreated: "打开已创建的会话",
|
|
6446
|
-
reload: "重新加载设置",
|
|
6447
|
-
reloadTitle: "重新读取已保存的配置,并放弃未保存的修改",
|
|
6448
|
-
loading: "正在加载模型分工…",
|
|
6449
|
-
dirty: "请先保存修改,再新建会话。",
|
|
6450
|
-
disabled: "双模型会话已关闭。可以保存配置,但不能新建双模型会话。",
|
|
6451
|
-
readonly: "当前设置为只读。请联系部署管理员启用写入后,重新加载设置。",
|
|
6452
|
-
unsupported: "当前部署不支持双模型会话。请检查插件支持情况后,重新加载设置。",
|
|
6453
|
-
revision: "无法获取设置版本。请重新加载设置后,再保存或新建会话。",
|
|
6454
|
-
conflict: "设置已在其他位置修改。请重新加载,检查已保存的配置后再重试。",
|
|
6455
|
-
modelUnavailable: "所选模型当前不可用。请重新加载设置并选择可用模型。未自动替换任何模型。",
|
|
6456
|
-
workspaceUnavailable: "创建会话的目标工作区不可用。请打开可访问的工作区并重新加载设置后,再新建会话。",
|
|
6457
|
-
loadError: "无法加载模型分工。请重新加载设置以重试。",
|
|
6458
|
-
saveError: "尚未确认保存结果。请重新加载并检查已保存的配置后再重试。",
|
|
6459
|
-
uncertain: "尚未确认会话创建结果。请重试同一请求以获取结果,避免重复创建。确认前将保持原工作区和配置不变。",
|
|
6460
|
-
pending: "上次创建请求的结果尚待确认。请重试同一请求;不会自动重新提交。",
|
|
6461
|
-
saved: "已保存。配置仅用于新建的双模型会话。",
|
|
6462
|
-
created: "会话已创建。",
|
|
6463
|
-
openError: "会话已创建,但无法自动打开。请从会话列表打开。",
|
|
6464
|
-
requestUnavailable: "当前浏览器无法生成安全的请求标识。请使用安全浏览器环境后再创建会话。"
|
|
6465
|
-
}
|
|
6466
|
-
};
|
|
6467
|
-
const diagnosticMessages = {
|
|
6468
|
-
DUAL_MODEL_UNSUPPORTED: "unsupported",
|
|
6469
|
-
DUAL_MODEL_READ_ONLY: "readonly",
|
|
6470
|
-
DUAL_MODEL_REVISION_CONFLICT: "conflict",
|
|
6471
|
-
DUAL_MODEL_MODEL_UNAVAILABLE: "modelUnavailable",
|
|
6472
|
-
DUAL_MODEL_WORKSPACE_UNAVAILABLE: "workspaceUnavailable",
|
|
6473
|
-
DUAL_MODEL_DISABLED: "disabled"
|
|
6474
|
-
};
|
|
6475
|
-
function diagnostic(value) {
|
|
6476
|
-
let code = value;
|
|
6477
|
-
if (typeof value === "object" && value !== null) {
|
|
6478
|
-
const details = "details" in value ? value.details : void 0;
|
|
6479
|
-
code = typeof details === "object" && details !== null && "reason" in details ? details.reason : "code" in value ? value.code : void 0;
|
|
6480
|
-
}
|
|
6481
|
-
return typeof code === "string" && Object.hasOwn(diagnosticMessages, code) ? diagnosticMessages[code] : void 0;
|
|
6482
|
-
}
|
|
6483
|
-
/** A reason alone says nothing about an earlier attempt with the same UUID. */
|
|
6484
|
-
function notCreatedDiagnostic(value) {
|
|
6485
|
-
if (typeof value !== "object" || value === null || !("details" in value)) return void 0;
|
|
6486
|
-
const details = value.details;
|
|
6487
|
-
if (typeof details !== "object" || details === null || !("creation" in details) || details.creation !== "not-created" || !("reason" in details) || typeof details.reason !== "string") return void 0;
|
|
6488
|
-
return diagnostic(details.reason);
|
|
6489
|
-
}
|
|
6490
|
-
function validRevision(value) {
|
|
6491
|
-
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
6492
|
-
}
|
|
6493
|
-
function validView(value) {
|
|
6494
|
-
const namedItems = (items) => Array.isArray(items) && items.every((item) => item && typeof item.id === "string" && item.id.length > 0 && typeof item.name === "string") && new Set(items.map((item) => item.id)).size === items.length;
|
|
6495
|
-
return !!value && typeof value.supported === "boolean" && typeof value.writable === "boolean" && (value.revision === null || validRevision(value.revision)) && !!value.configuration && typeof value.configuration.enabled === "boolean" && typeof value.configuration.plannerModel === "string" && typeof value.configuration.executorModel === "string" && namedItems(value.models) && namedItems(value.workspaces);
|
|
6496
|
-
}
|
|
6497
|
-
function sameConfig(a, b) {
|
|
6498
|
-
return a.enabled === b.enabled && a.plannerModel === b.plannerModel && a.executorModel === b.executorModel;
|
|
6499
|
-
}
|
|
6500
|
-
const cardStyle = {
|
|
6501
|
-
display: "grid",
|
|
6502
|
-
gap: "14px",
|
|
6503
|
-
padding: "18px",
|
|
6504
|
-
marginTop: "16px",
|
|
6505
|
-
minWidth: 0,
|
|
6506
|
-
border: "1px solid color-mix(in srgb, currentColor 20%, transparent)",
|
|
6507
|
-
borderRadius: "14px",
|
|
6508
|
-
background: "color-mix(in srgb, currentColor 4%, transparent)",
|
|
6509
|
-
overflowWrap: "anywhere"
|
|
6510
|
-
};
|
|
6511
|
-
const fieldStyle = {
|
|
6512
|
-
display: "grid",
|
|
6513
|
-
gap: "6px",
|
|
6514
|
-
minWidth: 0
|
|
6515
|
-
};
|
|
6516
|
-
const textStyle = {
|
|
6517
|
-
margin: 0,
|
|
6518
|
-
fontSize: "13px",
|
|
6519
|
-
lineHeight: 1.5
|
|
6520
|
-
};
|
|
6521
|
-
const labelStyle = {
|
|
6522
|
-
fontSize: "13px",
|
|
6523
|
-
fontWeight: 600
|
|
6524
|
-
};
|
|
6525
|
-
const buttonStyle = {
|
|
6526
|
-
padding: "9px 16px",
|
|
6527
|
-
maxWidth: "100%",
|
|
6528
|
-
borderRadius: "999px",
|
|
6529
|
-
cursor: "pointer",
|
|
6530
|
-
whiteSpace: "normal",
|
|
6531
|
-
overflowWrap: "anywhere",
|
|
6532
|
-
font: "inherit",
|
|
6533
|
-
color: "inherit",
|
|
6534
|
-
border: "1px solid color-mix(in srgb, currentColor 30%, transparent)",
|
|
6535
|
-
background: "color-mix(in srgb, currentColor 10%, transparent)"
|
|
6536
|
-
};
|
|
6537
|
-
const styleForButton = (disabled) => ({
|
|
6538
|
-
...buttonStyle,
|
|
6539
|
-
opacity: disabled ? .55 : 1,
|
|
6540
|
-
cursor: disabled ? "not-allowed" : "pointer"
|
|
6541
|
-
});
|
|
6542
|
-
/** Additive Models settings card. All mutations belong to the injected scoped Remote. */
|
|
6543
|
-
function DualModelCard(props) {
|
|
6544
|
-
const t = props.locale?.toLowerCase().startsWith("zh") ? copy$1.zh : copy$1.en;
|
|
6545
|
-
const id = (0, react.useId)();
|
|
6546
|
-
const [view, setView] = (0, react.useState)();
|
|
6547
|
-
const [draft, setDraft] = (0, react.useState)(off);
|
|
6548
|
-
const [phase, setPhase] = (0, react.useState)("loading");
|
|
6549
|
-
const [message, setMessage] = (0, react.useState)();
|
|
6550
|
-
const [needsReload, setNeedsReload] = (0, react.useState)(false);
|
|
6551
|
-
const [pending, setPending] = (0, react.useState)();
|
|
6552
|
-
const lifecycle = (0, react.useRef)({
|
|
6553
|
-
active: false,
|
|
6554
|
-
generation: 0,
|
|
6555
|
-
busy: false
|
|
6556
|
-
});
|
|
6557
|
-
const load = (0, react.useCallback)(async () => {
|
|
6558
|
-
const owner = lifecycle.current;
|
|
6559
|
-
if (!owner.active || owner.busy) return;
|
|
6560
|
-
const generation = ++owner.generation;
|
|
6561
|
-
const current = () => owner.active && owner.generation === generation;
|
|
6562
|
-
owner.busy = true;
|
|
6563
|
-
setPhase("loading");
|
|
6564
|
-
setMessage(void 0);
|
|
6565
|
-
setNeedsReload(true);
|
|
6566
|
-
const creation = creations.get(props.remote);
|
|
6567
|
-
setPending(creation);
|
|
6568
|
-
try {
|
|
6569
|
-
const result = await props.remote.view();
|
|
6570
|
-
if (!current()) return;
|
|
6571
|
-
if (!result.ok || !validView(result.value)) {
|
|
6572
|
-
setView(void 0);
|
|
6573
|
-
setMessage(!result.ok ? diagnostic(result.error) ?? "loadError" : "loadError");
|
|
6574
|
-
return;
|
|
6575
|
-
}
|
|
6576
|
-
setView(result.value);
|
|
6577
|
-
setDraft({ ...result.value.configuration });
|
|
6578
|
-
setNeedsReload(false);
|
|
6579
|
-
if (creation) setMessage(creation.sessionId ? "created" : "pending");
|
|
6580
|
-
} catch {
|
|
6581
|
-
if (current()) {
|
|
6582
|
-
setView(void 0);
|
|
6583
|
-
setMessage("loadError");
|
|
6584
|
-
}
|
|
6585
|
-
} finally {
|
|
6586
|
-
if (current()) {
|
|
6587
|
-
owner.busy = false;
|
|
6588
|
-
setPhase("idle");
|
|
6589
|
-
}
|
|
6590
|
-
}
|
|
6591
|
-
}, [props.remote]);
|
|
6592
|
-
(0, react.useEffect)(() => {
|
|
6593
|
-
const owner = lifecycle.current;
|
|
6594
|
-
owner.active = true;
|
|
6595
|
-
setView(void 0);
|
|
6596
|
-
setDraft(off);
|
|
6597
|
-
load();
|
|
6598
|
-
return () => {
|
|
6599
|
-
owner.active = false;
|
|
6600
|
-
owner.generation++;
|
|
6601
|
-
owner.busy = false;
|
|
6602
|
-
};
|
|
6603
|
-
}, [load]);
|
|
6604
|
-
const busy = phase !== "idle";
|
|
6605
|
-
const dirty = !!view && !sameConfig(draft, view.configuration);
|
|
6606
|
-
const models = view?.models ?? [];
|
|
6607
|
-
const validModels = models.some((model) => model.id === draft.plannerModel) && models.some((model) => model.id === draft.executorModel);
|
|
6608
|
-
const disabled = busy || !!pending || needsReload || !view?.supported || !view.writable || !validRevision(view.revision);
|
|
6609
|
-
const saveDisabled = disabled || draft.enabled && !validModels;
|
|
6610
|
-
const workspaceId = pending?.input.workspaceId ?? props.currentWorkspaceId;
|
|
6611
|
-
const destination = view?.workspaces.find((item) => item.id === workspaceId);
|
|
6612
|
-
const createDisabled = pending ? busy : disabled || dirty || !draft.enabled || !validModels || !destination;
|
|
6613
|
-
const save = async () => {
|
|
6614
|
-
const owner = lifecycle.current;
|
|
6615
|
-
if (!owner.active || owner.busy || saveDisabled || !view || !validRevision(view.revision)) return;
|
|
6616
|
-
owner.busy = true;
|
|
6617
|
-
const generation = owner.generation;
|
|
6618
|
-
const current = () => owner.active && owner.generation === generation;
|
|
6619
|
-
setPhase("saving");
|
|
6620
|
-
setMessage(void 0);
|
|
6621
|
-
try {
|
|
6622
|
-
const result = await props.remote.save({
|
|
6623
|
-
configuration: { ...draft },
|
|
6624
|
-
expectedRevision: view.revision
|
|
6625
|
-
});
|
|
6626
|
-
if (!current()) return;
|
|
6627
|
-
if (!result.ok || !validView(result.value)) {
|
|
6628
|
-
setNeedsReload(true);
|
|
6629
|
-
setMessage(!result.ok ? diagnostic(result.error) ?? "saveError" : "saveError");
|
|
6630
|
-
return;
|
|
6631
|
-
}
|
|
6632
|
-
setView(result.value);
|
|
6633
|
-
setDraft({ ...result.value.configuration });
|
|
6634
|
-
setMessage("saved");
|
|
6635
|
-
} catch {
|
|
6636
|
-
if (current()) {
|
|
6637
|
-
setNeedsReload(true);
|
|
6638
|
-
setMessage("saveError");
|
|
6639
|
-
}
|
|
6640
|
-
} finally {
|
|
6641
|
-
if (current()) {
|
|
6642
|
-
owner.busy = false;
|
|
6643
|
-
setPhase("idle");
|
|
6644
|
-
}
|
|
6645
|
-
}
|
|
6646
|
-
};
|
|
6647
|
-
const create = async () => {
|
|
6648
|
-
const owner = lifecycle.current;
|
|
6649
|
-
if (!owner.active || owner.busy || createDisabled) return;
|
|
6650
|
-
let creation = creations.get(props.remote);
|
|
6651
|
-
if (!creation) {
|
|
6652
|
-
if (!view || !validRevision(view.revision) || !props.currentWorkspaceId || !view.workspaces.some((item) => item.id === props.currentWorkspaceId)) return;
|
|
6653
|
-
try {
|
|
6654
|
-
creation = { input: {
|
|
6655
|
-
requestId: globalThis.crypto.randomUUID(),
|
|
6656
|
-
workspaceId: props.currentWorkspaceId,
|
|
6657
|
-
expectedRevision: view.revision
|
|
6658
|
-
} };
|
|
6659
|
-
} catch {
|
|
6660
|
-
setMessage("requestUnavailable");
|
|
6661
|
-
return;
|
|
6662
|
-
}
|
|
6663
|
-
creations.set(props.remote, creation);
|
|
6664
|
-
}
|
|
6665
|
-
const request = creation;
|
|
6666
|
-
const generation = owner.generation;
|
|
6667
|
-
const current = () => owner.active && owner.generation === generation;
|
|
6668
|
-
owner.busy = true;
|
|
6669
|
-
setPending(request);
|
|
6670
|
-
setPhase("creating");
|
|
6671
|
-
setMessage(void 0);
|
|
6672
|
-
if (!request.sessionId && !request.flight) request.flight = Promise.resolve().then(() => props.remote.create({ ...request.input })).catch(() => ({
|
|
6673
|
-
ok: false,
|
|
6674
|
-
error: void 0
|
|
6675
|
-
})).then((result) => {
|
|
6676
|
-
request.flight = void 0;
|
|
6677
|
-
if (result?.ok === true && typeof result.value?.sessionId === "string" && result.value.sessionId.length > 0) {
|
|
6678
|
-
request.sessionId = result.value.sessionId;
|
|
6679
|
-
return {
|
|
6680
|
-
ok: true,
|
|
6681
|
-
value: { sessionId: request.sessionId }
|
|
6682
|
-
};
|
|
6683
|
-
}
|
|
6684
|
-
return {
|
|
6685
|
-
ok: false,
|
|
6686
|
-
error: result?.ok === false ? result.error : void 0
|
|
6687
|
-
};
|
|
6688
|
-
});
|
|
6689
|
-
const result = request.sessionId ? {
|
|
6690
|
-
ok: true,
|
|
6691
|
-
value: { sessionId: request.sessionId }
|
|
6692
|
-
} : await request.flight;
|
|
6693
|
-
if (!current()) return;
|
|
6694
|
-
owner.busy = false;
|
|
6695
|
-
setPhase("idle");
|
|
6696
|
-
if (result.ok && typeof result.value?.sessionId === "string" && result.value.sessionId.length > 0) {
|
|
6697
|
-
creations.delete(props.remote);
|
|
6698
|
-
setPending(void 0);
|
|
6699
|
-
setMessage("created");
|
|
6700
|
-
try {
|
|
6701
|
-
props.onOpenSession?.(result.value.sessionId);
|
|
6702
|
-
} catch {
|
|
6703
|
-
setMessage("openError");
|
|
6704
|
-
}
|
|
6705
|
-
} else {
|
|
6706
|
-
const notCreated = !result.ok ? notCreatedDiagnostic(result.error) : void 0;
|
|
6707
|
-
if (notCreated) {
|
|
6708
|
-
creations.delete(props.remote);
|
|
6709
|
-
setPending(void 0);
|
|
6710
|
-
setNeedsReload(true);
|
|
6711
|
-
setMessage(notCreated);
|
|
6712
|
-
} else setMessage("uncertain");
|
|
6713
|
-
}
|
|
6714
|
-
};
|
|
6715
|
-
const field = (role, label, value) => {
|
|
6716
|
-
const missing = value !== "" && !models.some((model) => model.id === value);
|
|
6717
|
-
return (0, react.createElement)("div", { style: fieldStyle }, (0, react.createElement)("label", {
|
|
6718
|
-
htmlFor: `${id}-${role}`,
|
|
6719
|
-
style: labelStyle
|
|
6720
|
-
}, label), (0, react.createElement)("select", {
|
|
6721
|
-
id: `${id}-${role}`,
|
|
6722
|
-
style: nativeSelectStyle(disabled),
|
|
6723
|
-
value,
|
|
6724
|
-
disabled,
|
|
6725
|
-
[`data-dsh-dual-model-${role}`]: true,
|
|
6726
|
-
"aria-invalid": draft.enabled && !models.some((model) => model.id === value) ? true : void 0,
|
|
6727
|
-
"aria-describedby": `${id}-model-help`,
|
|
6728
|
-
onChange: (event) => {
|
|
6729
|
-
const value = event.currentTarget.value;
|
|
6730
|
-
if (disabled || !models.some((model) => model.id === value)) return;
|
|
6731
|
-
setMessage(void 0);
|
|
6732
|
-
setDraft((current) => ({
|
|
6733
|
-
...current,
|
|
6734
|
-
[role === "planner" ? "plannerModel" : "executorModel"]: value
|
|
6735
|
-
}));
|
|
6736
|
-
}
|
|
6737
|
-
}, (0, react.createElement)("option", {
|
|
6738
|
-
value: "",
|
|
6739
|
-
disabled: true,
|
|
6740
|
-
style: nativeOptionStyle(true)
|
|
6741
|
-
}, t.selectModel), missing ? (0, react.createElement)("option", {
|
|
6742
|
-
value,
|
|
6743
|
-
disabled: true,
|
|
6744
|
-
style: nativeOptionStyle(true)
|
|
6745
|
-
}, `${value} (${t.unavailable})`) : null, ...models.map((model) => (0, react.createElement)("option", {
|
|
6746
|
-
key: model.id,
|
|
6747
|
-
value: model.id,
|
|
6748
|
-
style: nativeOptionStyle()
|
|
6749
|
-
}, model.name || model.id))));
|
|
6750
|
-
};
|
|
6751
|
-
const viewNotice = !view ? void 0 : !view.supported ? diagnostic(view.diagnostic) ?? "unsupported" : !view.writable ? "readonly" : !validRevision(view.revision) ? "revision" : void 0;
|
|
6752
|
-
const status = phase === "loading" ? t.loading : message ? t[message] : "";
|
|
6753
|
-
const workspaceLabel = destination?.name || (pending ? pending.input.workspaceId : destination ? t.workspace : workspaceId ? t.currentWorkspaceUnavailable : t.noWorkspace);
|
|
6754
|
-
return (0, react.createElement)("section", {
|
|
6755
|
-
style: cardStyle,
|
|
6756
|
-
"data-dsh-dual-model-card": true,
|
|
6757
|
-
"aria-labelledby": `${id}-title`,
|
|
6758
|
-
"aria-busy": busy
|
|
6759
|
-
}, (0, react.createElement)("div", null, (0, react.createElement)("h3", {
|
|
6760
|
-
id: `${id}-title`,
|
|
6761
|
-
style: {
|
|
6762
|
-
margin: 0,
|
|
6763
|
-
fontSize: "16px"
|
|
6764
|
-
}
|
|
6765
|
-
}, t.title), (0, react.createElement)("p", { style: {
|
|
6766
|
-
...textStyle,
|
|
6767
|
-
marginTop: "5px"
|
|
6768
|
-
} }, t.description), (0, react.createElement)("p", { style: {
|
|
6769
|
-
...textStyle,
|
|
6770
|
-
marginTop: "6px"
|
|
6771
|
-
} }, t.scope)), (0, react.createElement)("div", { style: {
|
|
6772
|
-
display: "flex",
|
|
6773
|
-
alignItems: "center",
|
|
6774
|
-
gap: "9px"
|
|
6775
|
-
} }, (0, react.createElement)("input", {
|
|
6776
|
-
type: "checkbox",
|
|
6777
|
-
id: `${id}-enabled`,
|
|
6778
|
-
checked: draft.enabled,
|
|
6779
|
-
disabled,
|
|
6780
|
-
style: {
|
|
6781
|
-
margin: 0,
|
|
6782
|
-
flexShrink: 0
|
|
6783
|
-
},
|
|
6784
|
-
"data-dsh-dual-model-enabled": true,
|
|
6785
|
-
onChange: (event) => {
|
|
6786
|
-
const enabled = event.currentTarget.checked;
|
|
6787
|
-
if (disabled) return;
|
|
6788
|
-
setMessage(void 0);
|
|
6789
|
-
setDraft((current) => ({
|
|
6790
|
-
...current,
|
|
6791
|
-
enabled
|
|
6792
|
-
}));
|
|
6793
|
-
}
|
|
6794
|
-
}), (0, react.createElement)("label", {
|
|
6795
|
-
htmlFor: `${id}-enabled`,
|
|
6796
|
-
style: labelStyle
|
|
6797
|
-
}, t.enabled)), field("planner", t.planner, draft.plannerModel), field("executor", t.executor, draft.executorModel), (0, react.createElement)("p", {
|
|
6798
|
-
id: `${id}-model-help`,
|
|
6799
|
-
style: textStyle
|
|
6800
|
-
}, t.acceptance, view && draft.enabled && !validModels ? ` ${t.modelsMissing}` : ""), viewNotice ? (0, react.createElement)("p", { style: textStyle }, t[viewNotice]) : null, (0, react.createElement)("div", { style: {
|
|
6801
|
-
display: "flex",
|
|
6802
|
-
gap: "12px",
|
|
6803
|
-
flexWrap: "wrap",
|
|
6804
|
-
alignItems: "center",
|
|
6805
|
-
minWidth: 0
|
|
6806
|
-
} }, (0, react.createElement)("button", {
|
|
6807
|
-
type: "button",
|
|
6808
|
-
style: styleForButton(saveDisabled),
|
|
6809
|
-
disabled: saveDisabled,
|
|
6810
|
-
"data-dsh-dual-model-save": true,
|
|
6811
|
-
onClick: () => {
|
|
6812
|
-
save();
|
|
6813
|
-
}
|
|
6814
|
-
}, phase === "saving" ? t.saving : t.save), (0, react.createElement)("button", {
|
|
6815
|
-
type: "button",
|
|
6816
|
-
style: styleForButton(busy || !!pending),
|
|
6817
|
-
disabled: busy || !!pending,
|
|
6818
|
-
title: t.reloadTitle,
|
|
6819
|
-
"data-dsh-dual-model-reload": true,
|
|
6820
|
-
onClick: () => {
|
|
6821
|
-
if (!creations.has(props.remote)) load();
|
|
6822
|
-
}
|
|
6823
|
-
}, t.reload)), (0, react.createElement)("div", {
|
|
6824
|
-
role: "group",
|
|
6825
|
-
"aria-labelledby": `${id}-new-session`,
|
|
6826
|
-
style: {
|
|
6827
|
-
...fieldStyle,
|
|
6828
|
-
gap: "8px",
|
|
6829
|
-
borderTop: "1px solid color-mix(in srgb, currentColor 20%, transparent)",
|
|
6830
|
-
paddingTop: "14px"
|
|
6831
|
-
}
|
|
6832
|
-
}, (0, react.createElement)("h4", {
|
|
6833
|
-
id: `${id}-new-session`,
|
|
6834
|
-
style: {
|
|
6835
|
-
...labelStyle,
|
|
6836
|
-
margin: 0
|
|
6837
|
-
}
|
|
6838
|
-
}, t.newSession), !pending ? (0, react.createElement)("p", { style: textStyle }, t.sessionScope) : null, (0, react.createElement)("div", { style: fieldStyle }, (0, react.createElement)("span", {
|
|
6839
|
-
id: `${id}-workspace-label`,
|
|
6840
|
-
style: labelStyle
|
|
6841
|
-
}, pending ? t.originalWorkspace : t.workspace), (0, react.createElement)("p", {
|
|
6842
|
-
id: `${id}-workspace`,
|
|
6843
|
-
style: textStyle,
|
|
6844
|
-
"aria-labelledby": `${id}-workspace-label`,
|
|
6845
|
-
"data-dsh-dual-model-workspace": true,
|
|
6846
|
-
"data-workspace-id": workspaceId
|
|
6847
|
-
}, workspaceLabel)), !pending && view && !viewNotice ? (0, react.createElement)("p", { style: textStyle }, dirty ? t.dirty : !draft.enabled ? t.disabled : "") : null, (0, react.createElement)("button", {
|
|
6848
|
-
type: "button",
|
|
6849
|
-
style: {
|
|
6850
|
-
...styleForButton(createDisabled),
|
|
6851
|
-
justifySelf: "start"
|
|
6852
|
-
},
|
|
6853
|
-
disabled: createDisabled,
|
|
6854
|
-
"data-dsh-dual-model-create": true,
|
|
6855
|
-
onClick: () => {
|
|
6856
|
-
create();
|
|
6857
|
-
}
|
|
6858
|
-
}, phase === "creating" ? t.creating : pending?.sessionId ? t.openCreated : pending ? t.retryCreate : t.create)), (0, react.createElement)("div", {
|
|
6859
|
-
role: "status",
|
|
6860
|
-
"aria-live": "polite",
|
|
6861
|
-
"aria-atomic": true,
|
|
6862
|
-
style: textStyle
|
|
6863
|
-
}, status));
|
|
6864
|
-
}
|
|
6865
|
-
//#endregion
|
|
6866
6372
|
//#region lib/types/external-link.js
|
|
6867
6373
|
/** Use Desktop's public v1 navigation handoff instead of WebView popup creation. */
|
|
6868
6374
|
function externalLinkTarget() {
|
|
@@ -7263,190 +6769,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
7263
6769
|
} }, "https://github.com/settings/copilot"))) : null);
|
|
7264
6770
|
}
|
|
7265
6771
|
//#endregion
|
|
7266
|
-
//#region lib/types/current-workspace.js
|
|
7267
|
-
const object = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7268
|
-
function listOf(value) {
|
|
7269
|
-
if (!object(value) || !object(value.list)) return void 0;
|
|
7270
|
-
const list = value.list;
|
|
7271
|
-
return typeof list.getSnapshot === "function" && typeof list.subscribe === "function" ? list : void 0;
|
|
7272
|
-
}
|
|
7273
|
-
function selectedSession(selection) {
|
|
7274
|
-
if (!object(selection) || selection.phase !== "ready") return void 0;
|
|
7275
|
-
if (Object.hasOwn(selection, "current")) return typeof selection.current === "string" && selection.current ? selection.current : void 0;
|
|
7276
|
-
if (!object(selection.byId)) return void 0;
|
|
7277
|
-
let selected;
|
|
7278
|
-
for (const row of Object.values(selection.byId)) {
|
|
7279
|
-
if (!object(row) || !object(row.retainedBy)) continue;
|
|
7280
|
-
const count = row.retainedBy.mainView;
|
|
7281
|
-
if (count === void 0 || count === 0) continue;
|
|
7282
|
-
if (typeof count !== "number" || !Number.isSafeInteger(count) || count < 0 || typeof row.id !== "string" || !row.id || selected !== void 0) return void 0;
|
|
7283
|
-
selected = row.id;
|
|
7284
|
-
}
|
|
7285
|
-
return selected;
|
|
7286
|
-
}
|
|
7287
|
-
function selectedWorkspace(sessions, workspaces) {
|
|
7288
|
-
try {
|
|
7289
|
-
const sessionId = selectedSession(sessions.getSnapshot()), registry = workspaces.getSnapshot();
|
|
7290
|
-
if (sessionId === void 0 || !object(registry) || registry.phase !== "ready" || registry.state === "error" || !Array.isArray(registry.items)) return void 0;
|
|
7291
|
-
let match;
|
|
7292
|
-
for (const item of registry.items) {
|
|
7293
|
-
if (!object(item) || typeof item.workspaceId !== "string" || !item.workspaceId || !Array.isArray(item.sessionIds)) return void 0;
|
|
7294
|
-
if (!item.sessionIds.includes(sessionId)) continue;
|
|
7295
|
-
if (match !== void 0) return void 0;
|
|
7296
|
-
match = item.workspaceId;
|
|
7297
|
-
}
|
|
7298
|
-
return match;
|
|
7299
|
-
} catch {
|
|
7300
|
-
return;
|
|
7301
|
-
}
|
|
7302
|
-
}
|
|
7303
|
-
/** Observe only current membership. Do not call navigation/create or use a recent-workspace fallback. */
|
|
7304
|
-
function createCurrentWorkspaceSource(ctx) {
|
|
7305
|
-
const listeners = /* @__PURE__ */ new Set();
|
|
7306
|
-
let active = true;
|
|
7307
|
-
let current;
|
|
7308
|
-
const notify = () => {
|
|
7309
|
-
if (active) for (const listener of listeners) listener();
|
|
7310
|
-
};
|
|
7311
|
-
const injection = ctx.inject(["sessions", "workspaces"], (scope) => {
|
|
7312
|
-
if (!active) return;
|
|
7313
|
-
const sessions = listOf(scope.get("sessions")), workspaces = listOf(scope.get("workspaces"));
|
|
7314
|
-
if (!sessions || !workspaces) return;
|
|
7315
|
-
const binding = {
|
|
7316
|
-
sessions,
|
|
7317
|
-
workspaces
|
|
7318
|
-
};
|
|
7319
|
-
let stopSessions, stopWorkspaces;
|
|
7320
|
-
try {
|
|
7321
|
-
stopSessions = sessions.subscribe(notify);
|
|
7322
|
-
stopWorkspaces = workspaces.subscribe(notify);
|
|
7323
|
-
} catch {
|
|
7324
|
-
stopSessions?.();
|
|
7325
|
-
stopWorkspaces?.();
|
|
7326
|
-
return;
|
|
7327
|
-
}
|
|
7328
|
-
current = binding;
|
|
7329
|
-
scope.effect(() => () => {
|
|
7330
|
-
stopSessions?.();
|
|
7331
|
-
stopWorkspaces?.();
|
|
7332
|
-
if (current === binding) {
|
|
7333
|
-
current = void 0;
|
|
7334
|
-
notify();
|
|
7335
|
-
}
|
|
7336
|
-
});
|
|
7337
|
-
notify();
|
|
7338
|
-
});
|
|
7339
|
-
return {
|
|
7340
|
-
getSnapshot: () => active && current ? selectedWorkspace(current.sessions, current.workspaces) : void 0,
|
|
7341
|
-
subscribe(listener) {
|
|
7342
|
-
if (!active) return () => {};
|
|
7343
|
-
listeners.add(listener);
|
|
7344
|
-
return () => {
|
|
7345
|
-
listeners.delete(listener);
|
|
7346
|
-
};
|
|
7347
|
-
},
|
|
7348
|
-
dispose() {
|
|
7349
|
-
if (!active) return;
|
|
7350
|
-
active = false;
|
|
7351
|
-
current = void 0;
|
|
7352
|
-
listeners.clear();
|
|
7353
|
-
injection.dispose();
|
|
7354
|
-
}
|
|
7355
|
-
};
|
|
7356
|
-
}
|
|
7357
|
-
//#endregion
|
|
7358
|
-
//#region lib/types/dual-model-ui.js
|
|
7359
|
-
const emptySubscribe$1 = () => () => {};
|
|
7360
|
-
function DualModelSurface({ ctx, remote, workspaceSource, close }) {
|
|
7361
|
-
const locale = ctx.get("locale");
|
|
7362
|
-
const navigation = ctx.get("uiWorkspace");
|
|
7363
|
-
const language = (0, react.useSyncExternalStore)(locale === void 0 ? emptySubscribe$1 : (listener) => locale.subscribe(listener), () => locale?.getLocale().active ?? "en", () => "en");
|
|
7364
|
-
const currentWorkspaceId = (0, react.useSyncExternalStore)(workspaceSource.subscribe, workspaceSource.getSnapshot, () => void 0);
|
|
7365
|
-
return (0, react.createElement)(DualModelCard, {
|
|
7366
|
-
remote,
|
|
7367
|
-
locale: language,
|
|
7368
|
-
currentWorkspaceId,
|
|
7369
|
-
onOpenSession: navigation === void 0 ? void 0 : (id) => {
|
|
7370
|
-
navigation.openSession(id);
|
|
7371
|
-
close?.();
|
|
7372
|
-
}
|
|
7373
|
-
});
|
|
7374
|
-
}
|
|
7375
|
-
/** A single visible seat under Models, with a section fallback on older Clients. */
|
|
7376
|
-
function registerDualModelUi(ctx) {
|
|
7377
|
-
const remote = ctx.remote.githubCopilotDualModel;
|
|
7378
|
-
if (remote === void 0) return () => {};
|
|
7379
|
-
const workspaceSource = createCurrentWorkspaceSource(ctx);
|
|
7380
|
-
let active = true, footerActive = false, sectionActive = false;
|
|
7381
|
-
let fallback;
|
|
7382
|
-
const syncFallback = () => {
|
|
7383
|
-
if (active && sectionActive && !footerActive) fallback ??= ctx.slots.register({
|
|
7384
|
-
name: "settings.section",
|
|
7385
|
-
id: "github-copilot-dual-model",
|
|
7386
|
-
order: 13,
|
|
7387
|
-
label: "Copilot · Model roles"
|
|
7388
|
-
}, (props) => (0, react.createElement)(DualModelSurface, {
|
|
7389
|
-
ctx,
|
|
7390
|
-
remote,
|
|
7391
|
-
workspaceSource,
|
|
7392
|
-
close: props.close
|
|
7393
|
-
}));
|
|
7394
|
-
else {
|
|
7395
|
-
fallback?.();
|
|
7396
|
-
fallback = void 0;
|
|
7397
|
-
}
|
|
7398
|
-
};
|
|
7399
|
-
let footer = () => {};
|
|
7400
|
-
try {
|
|
7401
|
-
footer = ctx.slots.inject("settings.models.footer", () => {
|
|
7402
|
-
try {
|
|
7403
|
-
const spec = ctx.slots.spec?.("settings.models.footer");
|
|
7404
|
-
if (spec?.kind !== "list" || spec.scope !== "root") return () => {};
|
|
7405
|
-
const dispose = ctx.slots.register({
|
|
7406
|
-
name: "settings.models.footer",
|
|
7407
|
-
id: "github-copilot-dual-model",
|
|
7408
|
-
order: 15
|
|
7409
|
-
}, () => (0, react.createElement)(DualModelSurface, {
|
|
7410
|
-
ctx,
|
|
7411
|
-
remote,
|
|
7412
|
-
workspaceSource
|
|
7413
|
-
}));
|
|
7414
|
-
footerActive = true;
|
|
7415
|
-
syncFallback();
|
|
7416
|
-
let removed = false;
|
|
7417
|
-
return () => {
|
|
7418
|
-
if (removed) return;
|
|
7419
|
-
removed = true;
|
|
7420
|
-
dispose();
|
|
7421
|
-
footerActive = false;
|
|
7422
|
-
syncFallback();
|
|
7423
|
-
};
|
|
7424
|
-
} catch {
|
|
7425
|
-
ctx.logger.warn("[github-copilot] DUAL_MODEL_FOOTER_UNAVAILABLE");
|
|
7426
|
-
return () => {};
|
|
7427
|
-
}
|
|
7428
|
-
});
|
|
7429
|
-
} catch {
|
|
7430
|
-
ctx.logger.warn("[github-copilot] DUAL_MODEL_FOOTER_UNAVAILABLE");
|
|
7431
|
-
}
|
|
7432
|
-
const section = ctx.slots.inject("settings.section", () => {
|
|
7433
|
-
sectionActive = true;
|
|
7434
|
-
syncFallback();
|
|
7435
|
-
return () => {
|
|
7436
|
-
sectionActive = false;
|
|
7437
|
-
syncFallback();
|
|
7438
|
-
};
|
|
7439
|
-
});
|
|
7440
|
-
return () => {
|
|
7441
|
-
active = false;
|
|
7442
|
-
workspaceSource.dispose();
|
|
7443
|
-
footer();
|
|
7444
|
-
section();
|
|
7445
|
-
fallback?.();
|
|
7446
|
-
fallback = void 0;
|
|
7447
|
-
};
|
|
7448
|
-
}
|
|
7449
|
-
//#endregion
|
|
7450
6772
|
//#region lib/types/copilot-usage-ui.js
|
|
7451
6773
|
const slot = "conversation.composer.dock";
|
|
7452
6774
|
const noop = () => {};
|
|
@@ -7481,11 +6803,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
7481
6803
|
return next.provider === "github-copilot" || next.provider === "github-copilot-preview" ? next : void 0;
|
|
7482
6804
|
}
|
|
7483
6805
|
function Surface({ runtime, remote, locale, diagnostic }) {
|
|
7484
|
-
const
|
|
6806
|
+
const valid = runtime.useSession((session) => record(session) && session.sessionId === runtime.sessionId && session.removed === false && session.openState === "open");
|
|
7485
6807
|
const projection = runtime.useProjection("modelSelection");
|
|
7486
6808
|
const language = (0, react.useSyncExternalStore)(locale === void 0 ? emptySubscribe : (listener) => locale.subscribe(listener), () => locale?.getLocale().active ?? "en", () => "en");
|
|
7487
6809
|
const current = effectiveCopilot(projection);
|
|
7488
|
-
const valid = record(session) && session.sessionId === runtime.sessionId && session.removed === false && session.openState === "open";
|
|
7489
6810
|
(0, react.useEffect)(() => {
|
|
7490
6811
|
if (projection === void 0) diagnostic("COPILOT_USAGE_MODEL_PROJECTION_UNAVAILABLE");
|
|
7491
6812
|
}, [projection, diagnostic]);
|
|
@@ -8584,7 +7905,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
8584
7905
|
"remote.githubCopilotSearchRouting",
|
|
8585
7906
|
"slots"
|
|
8586
7907
|
], registerSearchUi);
|
|
8587
|
-
const dualModelUi = ctx.inject(["remote.githubCopilotDualModel", "slots"], registerDualModelUi);
|
|
8588
7908
|
const usageUi = ctx.inject(["remote.githubCopilotUsage", "slots"], registerCopilotUsageUi);
|
|
8589
7909
|
const presentation = ctx.inject(["uiConversation", "slots"], (scope) => installReasoningPresentation({
|
|
8590
7910
|
slots: scope.slots,
|
|
@@ -8594,7 +7914,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
8594
7914
|
return async () => {
|
|
8595
7915
|
await usageUi.dispose();
|
|
8596
7916
|
await presentation.dispose();
|
|
8597
|
-
await dualModelUi.dispose();
|
|
8598
7917
|
await searchUi.dispose();
|
|
8599
7918
|
await ui.dispose();
|
|
8600
7919
|
await disposeRemote();
|
|
@@ -8602,7 +7921,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
8602
7921
|
}
|
|
8603
7922
|
//#endregion
|
|
8604
7923
|
exports.CopilotUsageCard = CopilotUsageCard;
|
|
8605
|
-
exports.DualModelCard = DualModelCard;
|
|
8606
7924
|
exports.GitHubCopilotAccountModelsPanel = GitHubCopilotAccountModelsPanel;
|
|
8607
7925
|
exports.GitHubCopilotAccountModelsSummary = GitHubCopilotAccountModelsSummary;
|
|
8608
7926
|
exports.GitHubCopilotAccountModelsUpdatedAt = GitHubCopilotAccountModelsUpdatedAt;
|