dsh-github-copilot 0.4.0-alpha.25 → 0.4.0-alpha.27
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/CHANGELOG.md +74 -61
- package/README.md +10 -8
- package/README.zh.md +10 -8
- package/deployment-baseline.json +1 -1
- package/docs/dual-model.md +17 -6
- package/lib/client.js +247 -104
- package/lib/client.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/types/current-workspace.d.ts +10 -0
- package/lib/types/dual-model-card.d.ts +2 -0
- package/lib/types/native-select-style.d.ts +4 -0
- package/package.json +1 -1
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(shape, params) {
|
|
5116
|
+
function object$1(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$1({
|
|
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$1({
|
|
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$1({
|
|
5395
5395
|
id,
|
|
5396
5396
|
name: string().min(1).max(1024)
|
|
5397
5397
|
}).strict()).max(512),
|
|
5398
|
-
workspaces: array(object({
|
|
5398
|
+
workspaces: array(object$1({
|
|
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$1({
|
|
5404
5404
|
configuration: DualModelConfigSchema,
|
|
5405
5405
|
expectedRevision: revision
|
|
5406
5406
|
}).strict();
|
|
5407
|
-
const DualModelCreateSchema = object({
|
|
5407
|
+
const DualModelCreateSchema = object$1({
|
|
5408
5408
|
requestId: string().uuid(),
|
|
5409
5409
|
workspaceId: id,
|
|
5410
5410
|
expectedRevision: revision
|
|
5411
5411
|
}).strict();
|
|
5412
|
-
const DualModelCreateResultSchema = object({ sessionId: id }).strict();
|
|
5412
|
+
const DualModelCreateResultSchema = object$1({ sessionId: id }).strict();
|
|
5413
5413
|
const contribution$2 = {
|
|
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$1({
|
|
5458
5458
|
supported: boolean(),
|
|
5459
|
-
providers: array(object({ id: string().min(1).max(512) }).strict()).max(512)
|
|
5459
|
+
providers: array(object$1({ id: string().min(1).max(512) }).strict()).max(512)
|
|
5460
5460
|
}).strict();
|
|
5461
5461
|
const contribution$1 = {
|
|
5462
5462
|
package: "dsh-github-copilot",
|
|
@@ -5477,7 +5477,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5477
5477
|
*/
|
|
5478
5478
|
const direct = { kind: "direct" };
|
|
5479
5479
|
const GITHUB_COPILOT_AUTHORIZATION_VIEW_TYPE_SYMBOL = "dsh-github-copilot#GitHubCopilotAuthorizationView";
|
|
5480
|
-
const GitHubCopilotAuthorizationViewSchema = object({
|
|
5480
|
+
const GitHubCopilotAuthorizationViewSchema = object$1({
|
|
5481
5481
|
phase: _enum([
|
|
5482
5482
|
"signed-out",
|
|
5483
5483
|
"authorizing",
|
|
@@ -5487,12 +5487,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5487
5487
|
configured: boolean(),
|
|
5488
5488
|
writable: boolean(),
|
|
5489
5489
|
inFlight: boolean(),
|
|
5490
|
-
notices: array(object({
|
|
5490
|
+
notices: array(object$1({
|
|
5491
5491
|
message: string(),
|
|
5492
5492
|
url: string().optional(),
|
|
5493
5493
|
code: string().optional()
|
|
5494
5494
|
}).strict()),
|
|
5495
|
-
catalog: object({
|
|
5495
|
+
catalog: object$1({
|
|
5496
5496
|
state: _enum([
|
|
5497
5497
|
"current",
|
|
5498
5498
|
"partially-outdated",
|
|
@@ -5504,7 +5504,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5504
5504
|
temporarilyUnavailableModelIds: array(string()).optional(),
|
|
5505
5505
|
previewModelIds: array(string()).optional()
|
|
5506
5506
|
}).strict().optional(),
|
|
5507
|
-
accountModels: object({
|
|
5507
|
+
accountModels: object$1({
|
|
5508
5508
|
state: _enum([
|
|
5509
5509
|
"idle",
|
|
5510
5510
|
"loading",
|
|
@@ -5515,23 +5515,23 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5515
5515
|
"unconfigured",
|
|
5516
5516
|
"unavailable"
|
|
5517
5517
|
]),
|
|
5518
|
-
models: array(object({
|
|
5518
|
+
models: array(object$1({
|
|
5519
5519
|
id: string(),
|
|
5520
5520
|
name: string(),
|
|
5521
5521
|
api: string()
|
|
5522
5522
|
}).strict()).max(512),
|
|
5523
|
-
rejected: array(object({
|
|
5523
|
+
rejected: array(object$1({
|
|
5524
5524
|
id: string().optional(),
|
|
5525
5525
|
code: string()
|
|
5526
5526
|
}).strict()).max(1024),
|
|
5527
|
-
warnings: array(object({
|
|
5527
|
+
warnings: array(object$1({
|
|
5528
5528
|
id: string(),
|
|
5529
5529
|
code: string()
|
|
5530
5530
|
}).strict()).max(1024).optional(),
|
|
5531
5531
|
discoveredAt: number().int().nonnegative().optional(),
|
|
5532
5532
|
error: string().optional()
|
|
5533
5533
|
}).strict().optional(),
|
|
5534
|
-
route: object({
|
|
5534
|
+
route: object$1({
|
|
5535
5535
|
state: _enum([
|
|
5536
5536
|
"ready",
|
|
5537
5537
|
"needs-repair",
|
|
@@ -5549,34 +5549,34 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5549
5549
|
}).strict();
|
|
5550
5550
|
const result = strictRemoteCodec(GITHUB_COPILOT_AUTHORIZATION_VIEW_TYPE_SYMBOL, GitHubCopilotAuthorizationViewSchema);
|
|
5551
5551
|
const GITHUB_COPILOT_MIGRATION_STATUS_TYPE_SYMBOL = "dsh-github-copilot#GitHubCopilotMigrationStatus";
|
|
5552
|
-
const selectionSchema = object({
|
|
5552
|
+
const selectionSchema = object$1({
|
|
5553
5553
|
provider: string().min(1).max(512),
|
|
5554
5554
|
model: string().min(1).max(512),
|
|
5555
5555
|
reasoningEffort: string().min(1).max(512).optional()
|
|
5556
5556
|
}).strict();
|
|
5557
5557
|
/** Independent Ops result: strict at every object level; no account or private Session data. */
|
|
5558
|
-
const GitHubCopilotMigrationStatusSchema = object({
|
|
5559
|
-
plugin: object({
|
|
5558
|
+
const GitHubCopilotMigrationStatusSchema = object$1({
|
|
5559
|
+
plugin: object$1({
|
|
5560
5560
|
name: literal("dsh-github-copilot"),
|
|
5561
5561
|
version: string().min(1).max(512)
|
|
5562
5562
|
}).strict(),
|
|
5563
5563
|
protocolVersion: literal(1),
|
|
5564
5564
|
historyScope: literal("live-agents-only"),
|
|
5565
5565
|
observedAt: number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
|
|
5566
|
-
capabilities: object({
|
|
5566
|
+
capabilities: object$1({
|
|
5567
5567
|
agentsList: boolean(),
|
|
5568
5568
|
sessionProjections: boolean(),
|
|
5569
5569
|
settingsCas: boolean(),
|
|
5570
5570
|
providerRegistry: boolean(),
|
|
5571
5571
|
defaultSelection: boolean()
|
|
5572
5572
|
}).strict(),
|
|
5573
|
-
complete: object({
|
|
5573
|
+
complete: object$1({
|
|
5574
5574
|
sessions: boolean(),
|
|
5575
5575
|
defaultSelection: boolean(),
|
|
5576
5576
|
routes: boolean()
|
|
5577
5577
|
}).strict(),
|
|
5578
5578
|
defaultSelection: selectionSchema.nullable(),
|
|
5579
|
-
sessions: array(object({
|
|
5579
|
+
sessions: array(object$1({
|
|
5580
5580
|
id: string().min(1).max(512),
|
|
5581
5581
|
status: _enum(["idle", "running"]),
|
|
5582
5582
|
effectiveSelection: selectionSchema.nullable(),
|
|
@@ -5588,7 +5588,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5588
5588
|
]),
|
|
5589
5589
|
activeRequestSelection: selectionSchema.nullable()
|
|
5590
5590
|
}).strict()).max(1024),
|
|
5591
|
-
routes: object({
|
|
5591
|
+
routes: object$1({
|
|
5592
5592
|
nativeConfigured: boolean().nullable(),
|
|
5593
5593
|
nativeRegistered: boolean().nullable(),
|
|
5594
5594
|
managedRegistered: boolean().nullable()
|
|
@@ -5894,6 +5894,36 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5894
5894
|
};
|
|
5895
5895
|
}
|
|
5896
5896
|
//#endregion
|
|
5897
|
+
//#region lib/types/native-select-style.js
|
|
5898
|
+
const optionStyle = {
|
|
5899
|
+
backgroundColor: "var(--dsw-alias-bg-layer-1, Canvas)",
|
|
5900
|
+
color: "var(--dsw-alias-label-primary, CanvasText)"
|
|
5901
|
+
};
|
|
5902
|
+
const disabledOptionStyle = {
|
|
5903
|
+
...optionStyle,
|
|
5904
|
+
color: "var(--dsw-alias-label-secondary, GrayText)"
|
|
5905
|
+
};
|
|
5906
|
+
const selectStyle = {
|
|
5907
|
+
...optionStyle,
|
|
5908
|
+
width: "100%",
|
|
5909
|
+
minWidth: 0,
|
|
5910
|
+
boxSizing: "border-box",
|
|
5911
|
+
padding: "9px 11px",
|
|
5912
|
+
borderRadius: "9px",
|
|
5913
|
+
border: "1px solid var(--dsw-alias-border-l2, ButtonBorder)",
|
|
5914
|
+
font: "inherit"
|
|
5915
|
+
};
|
|
5916
|
+
const disabledSelectStyle = {
|
|
5917
|
+
...selectStyle,
|
|
5918
|
+
color: "var(--dsw-alias-label-secondary, GrayText)"
|
|
5919
|
+
};
|
|
5920
|
+
function nativeSelectStyle(disabled = false) {
|
|
5921
|
+
return disabled ? disabledSelectStyle : selectStyle;
|
|
5922
|
+
}
|
|
5923
|
+
function nativeOptionStyle(disabled = false) {
|
|
5924
|
+
return disabled ? disabledOptionStyle : optionStyle;
|
|
5925
|
+
}
|
|
5926
|
+
//#endregion
|
|
5897
5927
|
//#region lib/types/web-search-routing-card.js
|
|
5898
5928
|
const GITHUB_COPILOT_SETTINGS_NAMESPACE = "github-copilot";
|
|
5899
5929
|
const WEB_SEARCH_ROUTING_SETTINGS_NAMESPACE = "github-copilot-search-routing";
|
|
@@ -5915,7 +5945,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5915
5945
|
gap: "6px",
|
|
5916
5946
|
minWidth: 0
|
|
5917
5947
|
};
|
|
5918
|
-
const controlStyle
|
|
5948
|
+
const controlStyle = {
|
|
5919
5949
|
width: "100%",
|
|
5920
5950
|
minWidth: 0,
|
|
5921
5951
|
boxSizing: "border-box",
|
|
@@ -6149,11 +6179,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6149
6179
|
]);
|
|
6150
6180
|
const providerOptions = () => providers.map((id) => (0, react.createElement)("option", {
|
|
6151
6181
|
key: id,
|
|
6152
|
-
value: id
|
|
6182
|
+
value: id,
|
|
6183
|
+
style: nativeOptionStyle()
|
|
6153
6184
|
}, id));
|
|
6154
6185
|
const unavailableOption = (id, known) => known ? null : (0, react.createElement)("option", {
|
|
6155
6186
|
value: id,
|
|
6156
|
-
disabled: true
|
|
6187
|
+
disabled: true,
|
|
6188
|
+
style: nativeOptionStyle(true)
|
|
6157
6189
|
}, `${id || "(empty)"} — unavailable`);
|
|
6158
6190
|
return (0, react.createElement)("section", {
|
|
6159
6191
|
style: cardStyle$1,
|
|
@@ -6170,7 +6202,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6170
6202
|
fontSize: "13px",
|
|
6171
6203
|
fontWeight: 600
|
|
6172
6204
|
} }, "Search provider"), (0, react.createElement)("select", {
|
|
6173
|
-
style:
|
|
6205
|
+
style: nativeSelectStyle(disabled),
|
|
6174
6206
|
disabled,
|
|
6175
6207
|
value: draft.primary,
|
|
6176
6208
|
"data-dsh-web-search-mode": true,
|
|
@@ -6181,11 +6213,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6181
6213
|
primary
|
|
6182
6214
|
}));
|
|
6183
6215
|
}
|
|
6184
|
-
}, (0, react.createElement)("option", {
|
|
6216
|
+
}, (0, react.createElement)("option", {
|
|
6217
|
+
value: "auto",
|
|
6218
|
+
style: nativeOptionStyle()
|
|
6219
|
+
}, "Auto — follow Chat"), draft.primary === "none" ? (0, react.createElement)("option", {
|
|
6220
|
+
value: "none",
|
|
6221
|
+
style: nativeOptionStyle()
|
|
6222
|
+
}, "Disabled — saved configuration") : null, ...providerOptions(), unavailableOption(draft.primary, primaryKnown))), (0, react.createElement)("label", { style: fieldStyle$1 }, (0, react.createElement)("span", { style: {
|
|
6185
6223
|
fontSize: "13px",
|
|
6186
6224
|
fontWeight: 600
|
|
6187
6225
|
} }, "Default search provider"), (0, react.createElement)("select", {
|
|
6188
|
-
style:
|
|
6226
|
+
style: nativeSelectStyle(disabled),
|
|
6189
6227
|
disabled,
|
|
6190
6228
|
value: draft.provider,
|
|
6191
6229
|
"data-dsh-web-search-provider": true,
|
|
@@ -6196,7 +6234,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6196
6234
|
provider
|
|
6197
6235
|
}));
|
|
6198
6236
|
}
|
|
6199
|
-
}, (0, react.createElement)("option", {
|
|
6237
|
+
}, (0, react.createElement)("option", {
|
|
6238
|
+
value: NO_DEFAULT_SEARCH_PROVIDER,
|
|
6239
|
+
style: nativeOptionStyle()
|
|
6240
|
+
}, "None — no fallback"), ...providerOptions(), unavailableOption(draft.provider, fallbackKnown)), (0, react.createElement)("span", { style: hintStyle }, "Final fallback only: used when Auto has no matching provider or the primary search fails. The same provider is never retried as its own fallback.")), catalogReady && providers.length === 0 ? (0, react.createElement)("p", {
|
|
6200
6241
|
role: "status",
|
|
6201
6242
|
style: hintStyle
|
|
6202
6243
|
}, "No search providers are registered. Enable a search provider, then reload settings.") : null, catalogReady && missingProvider ? (0, react.createElement)("p", {
|
|
@@ -6206,7 +6247,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6206
6247
|
fontSize: "13px",
|
|
6207
6248
|
fontWeight: 600
|
|
6208
6249
|
} }, "Copilot search model"), (0, react.createElement)("input", {
|
|
6209
|
-
style: controlStyle
|
|
6250
|
+
style: controlStyle,
|
|
6210
6251
|
list: "dsh-copilot-search-models",
|
|
6211
6252
|
disabled: disabled || missingCopilot,
|
|
6212
6253
|
value: draft.model,
|
|
@@ -6264,7 +6305,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6264
6305
|
en: {
|
|
6265
6306
|
title: "Model roles",
|
|
6266
6307
|
description: "The planning model plans and reviews acceptance. The execution model changes code and runs tests.",
|
|
6267
|
-
scope: "
|
|
6308
|
+
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.",
|
|
6268
6309
|
enabled: "Enable dual-model sessions",
|
|
6269
6310
|
planner: "Planning model",
|
|
6270
6311
|
executor: "Execution model",
|
|
@@ -6272,9 +6313,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6272
6313
|
selectModel: "Select an available model",
|
|
6273
6314
|
unavailable: "unavailable",
|
|
6274
6315
|
modelsMissing: "Choose two available account models to save an enabled configuration. An unavailable saved model is kept, not replaced.",
|
|
6275
|
-
|
|
6276
|
-
|
|
6277
|
-
|
|
6316
|
+
newSession: "New dedicated session",
|
|
6317
|
+
sessionScope: "Create a new session in the current workspace using the saved role settings.",
|
|
6318
|
+
workspace: "New session destination",
|
|
6319
|
+
originalWorkspace: "Original destination (retained for this request)",
|
|
6320
|
+
noWorkspace: "No current workspace. Open a workspace to create a session; you can still save role settings.",
|
|
6321
|
+
currentWorkspaceUnavailable: "The current workspace is unavailable. Open an accessible workspace and reload settings before creating a session.",
|
|
6278
6322
|
save: "Save configuration",
|
|
6279
6323
|
saving: "Saving…",
|
|
6280
6324
|
create: "Create session with this configuration",
|
|
@@ -6291,7 +6335,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6291
6335
|
revision: "A settings revision is unavailable. Reload settings before saving or creating a session.",
|
|
6292
6336
|
conflict: "These settings changed elsewhere. Reload settings to review the saved configuration before trying again.",
|
|
6293
6337
|
modelUnavailable: "A selected model is unavailable. Reload settings and choose available account models. No model was substituted.",
|
|
6294
|
-
workspaceUnavailable: "The
|
|
6338
|
+
workspaceUnavailable: "The creation workspace is unavailable. Open an accessible workspace and reload settings before creating a new session.",
|
|
6295
6339
|
loadError: "Could not load model roles. Reload settings to retry.",
|
|
6296
6340
|
saveError: "The save was not confirmed. Reload settings to check the saved configuration before trying again.",
|
|
6297
6341
|
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.",
|
|
@@ -6304,7 +6348,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6304
6348
|
zh: {
|
|
6305
6349
|
title: "模型分工",
|
|
6306
6350
|
description: "主模型负责规划与验收;执行模型负责修改代码和运行测试。",
|
|
6307
|
-
scope: "
|
|
6351
|
+
scope: "模型分工设置适用于整个配置档案,不按工作区保存;仅在显式新建专用双模型会话时生效。普通会话、已有会话、历史记录和全局默认模型保持不变。不会自动替换模型。",
|
|
6308
6352
|
enabled: "启用双模型会话",
|
|
6309
6353
|
planner: "主模型(规划)",
|
|
6310
6354
|
executor: "执行模型",
|
|
@@ -6312,9 +6356,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6312
6356
|
selectModel: "选择可用模型",
|
|
6313
6357
|
unavailable: "不可用",
|
|
6314
6358
|
modelsMissing: "启用时须选择两个当前账号可用的模型才能保存。已保存但不可用的模型会保留,不会自动替换。",
|
|
6315
|
-
|
|
6316
|
-
|
|
6317
|
-
|
|
6359
|
+
newSession: "新建专用会话",
|
|
6360
|
+
sessionScope: "使用已保存的模型分工设置,在当前工作区新建会话。",
|
|
6361
|
+
workspace: "新会话目标工作区",
|
|
6362
|
+
originalWorkspace: "原目标工作区(为此请求保留)",
|
|
6363
|
+
noWorkspace: "当前没有工作区。请打开工作区后新建会话;仍可保存模型分工设置。",
|
|
6364
|
+
currentWorkspaceUnavailable: "当前工作区不可用。请打开可访问的工作区并重新加载设置后,再新建会话。",
|
|
6318
6365
|
save: "保存配置",
|
|
6319
6366
|
saving: "正在保存…",
|
|
6320
6367
|
create: "用此配置新建会话",
|
|
@@ -6331,7 +6378,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6331
6378
|
revision: "无法获取设置版本。请重新加载设置后,再保存或新建会话。",
|
|
6332
6379
|
conflict: "设置已在其他位置修改。请重新加载,检查已保存的配置后再重试。",
|
|
6333
6380
|
modelUnavailable: "所选模型当前不可用。请重新加载设置并选择可用模型。未自动替换任何模型。",
|
|
6334
|
-
workspaceUnavailable: "
|
|
6381
|
+
workspaceUnavailable: "创建会话的目标工作区不可用。请打开可访问的工作区并重新加载设置后,再新建会话。",
|
|
6335
6382
|
loadError: "无法加载模型分工。请重新加载设置以重试。",
|
|
6336
6383
|
saveError: "尚未确认保存结果。请重新加载并检查已保存的配置后再重试。",
|
|
6337
6384
|
uncertain: "尚未确认会话创建结果。请重试同一请求以获取结果,避免重复创建。确认前将保持原工作区和配置不变。",
|
|
@@ -6400,17 +6447,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6400
6447
|
fontSize: "13px",
|
|
6401
6448
|
fontWeight: 600
|
|
6402
6449
|
};
|
|
6403
|
-
const controlStyle = {
|
|
6404
|
-
width: "100%",
|
|
6405
|
-
minWidth: 0,
|
|
6406
|
-
boxSizing: "border-box",
|
|
6407
|
-
padding: "9px 11px",
|
|
6408
|
-
borderRadius: "9px",
|
|
6409
|
-
color: "inherit",
|
|
6410
|
-
border: "1px solid color-mix(in srgb, currentColor 24%, transparent)",
|
|
6411
|
-
background: "color-mix(in srgb, currentColor 3%, transparent)",
|
|
6412
|
-
font: "inherit"
|
|
6413
|
-
};
|
|
6414
6450
|
const buttonStyle = {
|
|
6415
6451
|
padding: "9px 16px",
|
|
6416
6452
|
maxWidth: "100%",
|
|
@@ -6434,7 +6470,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6434
6470
|
const id = (0, react.useId)();
|
|
6435
6471
|
const [view, setView] = (0, react.useState)();
|
|
6436
6472
|
const [draft, setDraft] = (0, react.useState)(off);
|
|
6437
|
-
const [workspace, setWorkspace] = (0, react.useState)("");
|
|
6438
6473
|
const [phase, setPhase] = (0, react.useState)("loading");
|
|
6439
6474
|
const [message, setMessage] = (0, react.useState)();
|
|
6440
6475
|
const [needsReload, setNeedsReload] = (0, react.useState)(false);
|
|
@@ -6455,7 +6490,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6455
6490
|
setNeedsReload(true);
|
|
6456
6491
|
const creation = creations.get(props.remote);
|
|
6457
6492
|
setPending(creation);
|
|
6458
|
-
if (creation) setWorkspace(creation.input.workspaceId);
|
|
6459
6493
|
try {
|
|
6460
6494
|
const result = await props.remote.view();
|
|
6461
6495
|
if (!current()) return;
|
|
@@ -6485,7 +6519,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6485
6519
|
owner.active = true;
|
|
6486
6520
|
setView(void 0);
|
|
6487
6521
|
setDraft(off);
|
|
6488
|
-
setWorkspace("");
|
|
6489
6522
|
load();
|
|
6490
6523
|
return () => {
|
|
6491
6524
|
owner.active = false;
|
|
@@ -6499,7 +6532,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6499
6532
|
const validModels = models.some((model) => model.id === draft.plannerModel) && models.some((model) => model.id === draft.executorModel);
|
|
6500
6533
|
const disabled = busy || !!pending || needsReload || !view?.supported || !view.writable || !validRevision(view.revision);
|
|
6501
6534
|
const saveDisabled = disabled || draft.enabled && !validModels;
|
|
6502
|
-
const
|
|
6535
|
+
const workspaceId = pending?.input.workspaceId ?? props.currentWorkspaceId;
|
|
6536
|
+
const destination = view?.workspaces.find((item) => item.id === workspaceId);
|
|
6537
|
+
const createDisabled = pending ? busy : disabled || dirty || !draft.enabled || !validModels || !destination;
|
|
6503
6538
|
const save = async () => {
|
|
6504
6539
|
const owner = lifecycle.current;
|
|
6505
6540
|
if (!owner.active || owner.busy || saveDisabled || !view || !validRevision(view.revision)) return;
|
|
@@ -6539,11 +6574,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6539
6574
|
if (!owner.active || owner.busy || createDisabled) return;
|
|
6540
6575
|
let creation = creations.get(props.remote);
|
|
6541
6576
|
if (!creation) {
|
|
6542
|
-
if (!view || !validRevision(view.revision)) return;
|
|
6577
|
+
if (!view || !validRevision(view.revision) || !props.currentWorkspaceId || !view.workspaces.some((item) => item.id === props.currentWorkspaceId)) return;
|
|
6543
6578
|
try {
|
|
6544
6579
|
creation = { input: {
|
|
6545
6580
|
requestId: globalThis.crypto.randomUUID(),
|
|
6546
|
-
workspaceId:
|
|
6581
|
+
workspaceId: props.currentWorkspaceId,
|
|
6547
6582
|
expectedRevision: view.revision
|
|
6548
6583
|
} };
|
|
6549
6584
|
} catch {
|
|
@@ -6609,7 +6644,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6609
6644
|
style: labelStyle
|
|
6610
6645
|
}, label), (0, react.createElement)("select", {
|
|
6611
6646
|
id: `${id}-${role}`,
|
|
6612
|
-
style:
|
|
6647
|
+
style: nativeSelectStyle(disabled),
|
|
6613
6648
|
value,
|
|
6614
6649
|
disabled,
|
|
6615
6650
|
[`data-dsh-dual-model-${role}`]: true,
|
|
@@ -6626,18 +6661,21 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6626
6661
|
}
|
|
6627
6662
|
}, (0, react.createElement)("option", {
|
|
6628
6663
|
value: "",
|
|
6629
|
-
disabled: true
|
|
6664
|
+
disabled: true,
|
|
6665
|
+
style: nativeOptionStyle(true)
|
|
6630
6666
|
}, t.selectModel), missing ? (0, react.createElement)("option", {
|
|
6631
6667
|
value,
|
|
6632
|
-
disabled: true
|
|
6668
|
+
disabled: true,
|
|
6669
|
+
style: nativeOptionStyle(true)
|
|
6633
6670
|
}, `${value} (${t.unavailable})`) : null, ...models.map((model) => (0, react.createElement)("option", {
|
|
6634
6671
|
key: model.id,
|
|
6635
|
-
value: model.id
|
|
6672
|
+
value: model.id,
|
|
6673
|
+
style: nativeOptionStyle()
|
|
6636
6674
|
}, model.name || model.id))));
|
|
6637
6675
|
};
|
|
6638
6676
|
const viewNotice = !view ? void 0 : !view.supported ? diagnostic(view.diagnostic) ?? "unsupported" : !view.writable ? "readonly" : !validRevision(view.revision) ? "revision" : void 0;
|
|
6639
6677
|
const status = phase === "loading" ? t.loading : message ? t[message] : "";
|
|
6640
|
-
const
|
|
6678
|
+
const workspaceLabel = destination?.name || (pending ? pending.input.workspaceId : destination ? t.workspace : workspaceId ? t.currentWorkspaceUnavailable : t.noWorkspace);
|
|
6641
6679
|
return (0, react.createElement)("section", {
|
|
6642
6680
|
style: cardStyle,
|
|
6643
6681
|
"data-dsh-dual-model-card": true,
|
|
@@ -6684,29 +6722,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6684
6722
|
}, t.enabled)), field("planner", t.planner, draft.plannerModel), field("executor", t.executor, draft.executorModel), (0, react.createElement)("p", {
|
|
6685
6723
|
id: `${id}-model-help`,
|
|
6686
6724
|
style: textStyle
|
|
6687
|
-
}, t.acceptance, view && draft.enabled && !validModels ? ` ${t.modelsMissing}` : ""), (0, react.createElement)("
|
|
6688
|
-
htmlFor: `${id}-workspace`,
|
|
6689
|
-
style: labelStyle
|
|
6690
|
-
}, t.workspace), (0, react.createElement)("select", {
|
|
6691
|
-
id: `${id}-workspace`,
|
|
6692
|
-
style: controlStyle,
|
|
6693
|
-
disabled,
|
|
6694
|
-
value: shownWorkspace,
|
|
6695
|
-
"data-dsh-dual-model-workspace": true,
|
|
6696
|
-
onChange: (event) => {
|
|
6697
|
-
const value = event.currentTarget.value;
|
|
6698
|
-
if (!disabled && view?.workspaces.some((item) => item.id === value)) setWorkspace(value);
|
|
6699
|
-
}
|
|
6700
|
-
}, (0, react.createElement)("option", {
|
|
6701
|
-
value: "",
|
|
6702
|
-
disabled: true
|
|
6703
|
-
}, t.selectWorkspace), shownWorkspace && !view?.workspaces.some((item) => item.id === shownWorkspace) ? (0, react.createElement)("option", {
|
|
6704
|
-
value: shownWorkspace,
|
|
6705
|
-
disabled: true
|
|
6706
|
-
}, `${shownWorkspace} (${t.unavailable})`) : null, ...(view?.workspaces ?? []).map((item) => (0, react.createElement)("option", {
|
|
6707
|
-
key: item.id,
|
|
6708
|
-
value: item.id
|
|
6709
|
-
}, item.name || item.id))), view && view.workspaces.length === 0 ? (0, react.createElement)("p", { style: textStyle }, t.noWorkspaces) : null), viewNotice ? (0, react.createElement)("p", { style: textStyle }, t[viewNotice]) : null, !pending && view && !viewNotice ? (0, react.createElement)("p", { style: textStyle }, dirty ? t.dirty : !draft.enabled ? t.disabled : "") : null, (0, react.createElement)("div", { style: {
|
|
6725
|
+
}, t.acceptance, view && draft.enabled && !validModels ? ` ${t.modelsMissing}` : ""), viewNotice ? (0, react.createElement)("p", { style: textStyle }, t[viewNotice]) : null, (0, react.createElement)("div", { style: {
|
|
6710
6726
|
display: "flex",
|
|
6711
6727
|
gap: "12px",
|
|
6712
6728
|
flexWrap: "wrap",
|
|
@@ -6722,7 +6738,43 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6722
6738
|
}
|
|
6723
6739
|
}, phase === "saving" ? t.saving : t.save), (0, react.createElement)("button", {
|
|
6724
6740
|
type: "button",
|
|
6725
|
-
style: styleForButton(
|
|
6741
|
+
style: styleForButton(busy || !!pending),
|
|
6742
|
+
disabled: busy || !!pending,
|
|
6743
|
+
title: t.reloadTitle,
|
|
6744
|
+
"data-dsh-dual-model-reload": true,
|
|
6745
|
+
onClick: () => {
|
|
6746
|
+
if (!creations.has(props.remote)) load();
|
|
6747
|
+
}
|
|
6748
|
+
}, t.reload)), (0, react.createElement)("div", {
|
|
6749
|
+
role: "group",
|
|
6750
|
+
"aria-labelledby": `${id}-new-session`,
|
|
6751
|
+
style: {
|
|
6752
|
+
...fieldStyle,
|
|
6753
|
+
gap: "8px",
|
|
6754
|
+
borderTop: "1px solid color-mix(in srgb, currentColor 20%, transparent)",
|
|
6755
|
+
paddingTop: "14px"
|
|
6756
|
+
}
|
|
6757
|
+
}, (0, react.createElement)("h4", {
|
|
6758
|
+
id: `${id}-new-session`,
|
|
6759
|
+
style: {
|
|
6760
|
+
...labelStyle,
|
|
6761
|
+
margin: 0
|
|
6762
|
+
}
|
|
6763
|
+
}, t.newSession), !pending ? (0, react.createElement)("p", { style: textStyle }, t.sessionScope) : null, (0, react.createElement)("div", { style: fieldStyle }, (0, react.createElement)("span", {
|
|
6764
|
+
id: `${id}-workspace-label`,
|
|
6765
|
+
style: labelStyle
|
|
6766
|
+
}, pending ? t.originalWorkspace : t.workspace), (0, react.createElement)("p", {
|
|
6767
|
+
id: `${id}-workspace`,
|
|
6768
|
+
style: textStyle,
|
|
6769
|
+
"aria-labelledby": `${id}-workspace-label`,
|
|
6770
|
+
"data-dsh-dual-model-workspace": true,
|
|
6771
|
+
"data-workspace-id": workspaceId
|
|
6772
|
+
}, workspaceLabel)), !pending && view && !viewNotice ? (0, react.createElement)("p", { style: textStyle }, dirty ? t.dirty : !draft.enabled ? t.disabled : "") : null, (0, react.createElement)("button", {
|
|
6773
|
+
type: "button",
|
|
6774
|
+
style: {
|
|
6775
|
+
...styleForButton(createDisabled),
|
|
6776
|
+
justifySelf: "start"
|
|
6777
|
+
},
|
|
6726
6778
|
disabled: createDisabled,
|
|
6727
6779
|
"data-dsh-dual-model-create": true,
|
|
6728
6780
|
onClick: () => {
|
|
@@ -6733,30 +6785,112 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6733
6785
|
"aria-live": "polite",
|
|
6734
6786
|
"aria-atomic": true,
|
|
6735
6787
|
style: textStyle
|
|
6736
|
-
}, status)
|
|
6737
|
-
|
|
6738
|
-
|
|
6739
|
-
|
|
6740
|
-
|
|
6788
|
+
}, status));
|
|
6789
|
+
}
|
|
6790
|
+
//#endregion
|
|
6791
|
+
//#region lib/types/current-workspace.js
|
|
6792
|
+
const object = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6793
|
+
function listOf(value) {
|
|
6794
|
+
if (!object(value) || !object(value.list)) return void 0;
|
|
6795
|
+
const list = value.list;
|
|
6796
|
+
return typeof list.getSnapshot === "function" && typeof list.subscribe === "function" ? list : void 0;
|
|
6797
|
+
}
|
|
6798
|
+
function selectedSession(selection) {
|
|
6799
|
+
if (!object(selection) || selection.phase !== "ready") return void 0;
|
|
6800
|
+
if (Object.hasOwn(selection, "current")) return typeof selection.current === "string" && selection.current ? selection.current : void 0;
|
|
6801
|
+
if (!object(selection.byId)) return void 0;
|
|
6802
|
+
let selected;
|
|
6803
|
+
for (const row of Object.values(selection.byId)) {
|
|
6804
|
+
if (!object(row) || !object(row.retainedBy)) continue;
|
|
6805
|
+
const count = row.retainedBy.mainView;
|
|
6806
|
+
if (count === void 0 || count === 0) continue;
|
|
6807
|
+
if (typeof count !== "number" || !Number.isSafeInteger(count) || count < 0 || typeof row.id !== "string" || !row.id || selected !== void 0) return void 0;
|
|
6808
|
+
selected = row.id;
|
|
6809
|
+
}
|
|
6810
|
+
return selected;
|
|
6811
|
+
}
|
|
6812
|
+
function selectedWorkspace(sessions, workspaces) {
|
|
6813
|
+
try {
|
|
6814
|
+
const sessionId = selectedSession(sessions.getSnapshot()), registry = workspaces.getSnapshot();
|
|
6815
|
+
if (sessionId === void 0 || !object(registry) || registry.phase !== "ready" || registry.state === "error" || !Array.isArray(registry.items)) return void 0;
|
|
6816
|
+
let match;
|
|
6817
|
+
for (const item of registry.items) {
|
|
6818
|
+
if (!object(item) || typeof item.workspaceId !== "string" || !item.workspaceId || !Array.isArray(item.sessionIds)) return void 0;
|
|
6819
|
+
if (!item.sessionIds.includes(sessionId)) continue;
|
|
6820
|
+
if (match !== void 0) return void 0;
|
|
6821
|
+
match = item.workspaceId;
|
|
6822
|
+
}
|
|
6823
|
+
return match;
|
|
6824
|
+
} catch {
|
|
6825
|
+
return;
|
|
6826
|
+
}
|
|
6827
|
+
}
|
|
6828
|
+
/** Observe only current membership. Do not call navigation/create or use a recent-workspace fallback. */
|
|
6829
|
+
function createCurrentWorkspaceSource(ctx) {
|
|
6830
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
6831
|
+
let active = true;
|
|
6832
|
+
let current;
|
|
6833
|
+
const notify = () => {
|
|
6834
|
+
if (active) for (const listener of listeners) listener();
|
|
6835
|
+
};
|
|
6836
|
+
const injection = ctx.inject(["sessions", "workspaces"], (scope) => {
|
|
6837
|
+
if (!active) return;
|
|
6838
|
+
const sessions = listOf(scope.get("sessions")), workspaces = listOf(scope.get("workspaces"));
|
|
6839
|
+
if (!sessions || !workspaces) return;
|
|
6840
|
+
const binding = {
|
|
6841
|
+
sessions,
|
|
6842
|
+
workspaces
|
|
6843
|
+
};
|
|
6844
|
+
let stopSessions, stopWorkspaces;
|
|
6845
|
+
try {
|
|
6846
|
+
stopSessions = sessions.subscribe(notify);
|
|
6847
|
+
stopWorkspaces = workspaces.subscribe(notify);
|
|
6848
|
+
} catch {
|
|
6849
|
+
stopSessions?.();
|
|
6850
|
+
stopWorkspaces?.();
|
|
6851
|
+
return;
|
|
6852
|
+
}
|
|
6853
|
+
current = binding;
|
|
6854
|
+
scope.effect(() => () => {
|
|
6855
|
+
stopSessions?.();
|
|
6856
|
+
stopWorkspaces?.();
|
|
6857
|
+
if (current === binding) {
|
|
6858
|
+
current = void 0;
|
|
6859
|
+
notify();
|
|
6860
|
+
}
|
|
6861
|
+
});
|
|
6862
|
+
notify();
|
|
6863
|
+
});
|
|
6864
|
+
return {
|
|
6865
|
+
getSnapshot: () => active && current ? selectedWorkspace(current.sessions, current.workspaces) : void 0,
|
|
6866
|
+
subscribe(listener) {
|
|
6867
|
+
if (!active) return () => {};
|
|
6868
|
+
listeners.add(listener);
|
|
6869
|
+
return () => {
|
|
6870
|
+
listeners.delete(listener);
|
|
6871
|
+
};
|
|
6741
6872
|
},
|
|
6742
|
-
|
|
6743
|
-
|
|
6744
|
-
|
|
6745
|
-
|
|
6746
|
-
|
|
6873
|
+
dispose() {
|
|
6874
|
+
if (!active) return;
|
|
6875
|
+
active = false;
|
|
6876
|
+
current = void 0;
|
|
6877
|
+
listeners.clear();
|
|
6878
|
+
injection.dispose();
|
|
6747
6879
|
}
|
|
6748
|
-
}
|
|
6880
|
+
};
|
|
6749
6881
|
}
|
|
6750
6882
|
//#endregion
|
|
6751
6883
|
//#region lib/types/dual-model-ui.js
|
|
6752
6884
|
const emptySubscribe = () => () => {};
|
|
6753
|
-
function DualModelSurface({ ctx, close }) {
|
|
6885
|
+
function DualModelSurface({ ctx, remote, workspaceSource, close }) {
|
|
6754
6886
|
const locale = ctx.get("locale");
|
|
6755
6887
|
const navigation = ctx.get("uiWorkspace");
|
|
6756
6888
|
const language = (0, react.useSyncExternalStore)(locale === void 0 ? emptySubscribe : (listener) => locale.subscribe(listener), () => locale?.getLocale().active ?? "en", () => "en");
|
|
6889
|
+
const currentWorkspaceId = (0, react.useSyncExternalStore)(workspaceSource.subscribe, workspaceSource.getSnapshot, () => void 0);
|
|
6757
6890
|
return (0, react.createElement)(DualModelCard, {
|
|
6758
|
-
remote
|
|
6891
|
+
remote,
|
|
6759
6892
|
locale: language,
|
|
6893
|
+
currentWorkspaceId,
|
|
6760
6894
|
onOpenSession: navigation === void 0 ? void 0 : (id) => {
|
|
6761
6895
|
navigation.openSession(id);
|
|
6762
6896
|
close?.();
|
|
@@ -6765,7 +6899,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6765
6899
|
}
|
|
6766
6900
|
/** A single visible seat under Models, with a section fallback on older Clients. */
|
|
6767
6901
|
function registerDualModelUi(ctx) {
|
|
6768
|
-
|
|
6902
|
+
const remote = ctx.remote.githubCopilotDualModel;
|
|
6903
|
+
if (remote === void 0) return () => {};
|
|
6904
|
+
const workspaceSource = createCurrentWorkspaceSource(ctx);
|
|
6769
6905
|
let active = true, footerActive = false, sectionActive = false;
|
|
6770
6906
|
let fallback;
|
|
6771
6907
|
const syncFallback = () => {
|
|
@@ -6776,6 +6912,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6776
6912
|
label: "Copilot · Model roles"
|
|
6777
6913
|
}, (props) => (0, react.createElement)(DualModelSurface, {
|
|
6778
6914
|
ctx,
|
|
6915
|
+
remote,
|
|
6916
|
+
workspaceSource,
|
|
6779
6917
|
close: props.close
|
|
6780
6918
|
}));
|
|
6781
6919
|
else {
|
|
@@ -6793,7 +6931,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6793
6931
|
name: "settings.models.footer",
|
|
6794
6932
|
id: "github-copilot-dual-model",
|
|
6795
6933
|
order: 15
|
|
6796
|
-
}, () => (0, react.createElement)(DualModelSurface, {
|
|
6934
|
+
}, () => (0, react.createElement)(DualModelSurface, {
|
|
6935
|
+
ctx,
|
|
6936
|
+
remote,
|
|
6937
|
+
workspaceSource
|
|
6938
|
+
}));
|
|
6797
6939
|
footerActive = true;
|
|
6798
6940
|
syncFallback();
|
|
6799
6941
|
let removed = false;
|
|
@@ -6822,6 +6964,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6822
6964
|
});
|
|
6823
6965
|
return () => {
|
|
6824
6966
|
active = false;
|
|
6967
|
+
workspaceSource.dispose();
|
|
6825
6968
|
footer();
|
|
6826
6969
|
section();
|
|
6827
6970
|
fallback?.();
|