dsh-github-copilot 0.4.0-alpha.33 → 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/lib/index.js CHANGED
@@ -17,7 +17,7 @@ import { Config as Config$1, PiAiAdapter } from "@deepseek-ai/dsh-llm-pi-ai";
17
17
  import { estimateContextTokens, estimateMessageTokens } from "@earendil-works/pi-ai/utils/estimate";
18
18
  import { buildCopilotDynamicHeaders, hasCopilotVisionInput } from "@earendil-works/pi-ai/api/github-copilot-headers";
19
19
  //#region lib/types/dual-model-host.js
20
- /** Optional plugin-owned planner/executor sessions; no Core/default-model mutation. */
20
+ /** Retired planner/executor entry points; retained policies stay enforceable without migration. */
21
21
  var __runInitializers$3 = function(thisArg, initializers, value) {
22
22
  var useValue = arguments.length > 2;
23
23
  for (var i = 0; i < initializers.length; i++) value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
@@ -59,7 +59,6 @@ var __esDecorate$3 = function(ctor, descriptorIn, decorators, contextIn, initial
59
59
  done = true;
60
60
  };
61
61
  const DUAL_MODEL_NAMESPACE = "github-copilot-dual-model";
62
- const DUAL_MODEL_POLICY_EVENT = "github-copilot/dual-model-policy";
63
62
  const DUAL_MODEL_PROJECTION = "githubCopilotDualModelPolicy";
64
63
  const DUAL_MODEL_EXECUTE_TOOL = "copilot_execute";
65
64
  const DEFAULT_CONFIG = Object.freeze({
@@ -87,10 +86,6 @@ const SaveJson = z$1.object({
87
86
  configuration: ConfigJson,
88
87
  expectedRevision: RevisionJson
89
88
  }).strict();
90
- const CatalogEntryJson = z$1.object({
91
- id: z$1.string().min(1).max(512),
92
- name: z$1.string().min(1).max(1024)
93
- }).strict();
94
89
  const ExecuteJson = z$1.object({
95
90
  description: z$1.string().min(1).max(160),
96
91
  prompt: z$1.string().min(1).max(1e5)
@@ -182,38 +177,6 @@ const dualModelProjection = {
182
177
  return state;
183
178
  }
184
179
  };
185
- const ROOT_TOOLS = [
186
- DUAL_MODEL_EXECUTE_TOOL,
187
- "read",
188
- "read_image",
189
- "glob",
190
- "grep",
191
- "skill",
192
- "ask_user_question",
193
- "todo_write",
194
- "send_message",
195
- "list_agents",
196
- "interrupt_agent"
197
- ];
198
- const EXECUTOR_TOOLS = [
199
- "read",
200
- "read_image",
201
- "glob",
202
- "grep",
203
- "skill",
204
- "write",
205
- "edit",
206
- "pwsh",
207
- "bash",
208
- "present",
209
- "todo_write",
210
- "send_message",
211
- "list_agents",
212
- "interrupt_agent",
213
- "job_list",
214
- "job_output",
215
- "job_kill"
216
- ];
217
180
  const EXECUTOR_PERSONA = "You are the execution agent for a dedicated Copilot planner/executor session. Implement only the delegated task. Your provider and model are fixed by the session policy. Do not create other agents, workflows, dynamic plugins, or alternate model calls. Report the changed files, verification, limitations, and actual results to your direct parent with send_message. Do not claim tests or work you did not perform.";
218
181
  function roleText(policy, role) {
219
182
  return role === "planner" ? `You are the planning and acceptance agent. Read the current code and evidence, plan, clarify, delegate implementation through ${DUAL_MODEL_EXECUTE_TOOL}, and independently review results. Do not implement changes or run commands directly. Your planning model is ${policy.plannerModel}; execution is fixed to ${policy.executorModel}. Use the original send_message/list_agents/interrupt_agent controls to continue and inspect your execution children. Provider: ${GITHUB_COPILOT_PREVIEW_PROVIDER_ID}.` : EXECUTOR_PERSONA;
@@ -238,6 +201,7 @@ function revision(value) {
238
201
  return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
239
202
  }
240
203
  const ERROR_REASONS = /* @__PURE__ */ new Set([
204
+ "DUAL_MODEL_RETIRED",
241
205
  "DUAL_MODEL_UNSUPPORTED",
242
206
  "DUAL_MODEL_READ_ONLY",
243
207
  "DUAL_MODEL_REVISION_CONFLICT",
@@ -349,7 +313,6 @@ let GitHubCopilotDualModel = (() => {
349
313
  lifetime = new AbortController();
350
314
  creates = /* @__PURE__ */ new Map();
351
315
  overlays = /* @__PURE__ */ new Map();
352
- handles = /* @__PURE__ */ new Map();
353
316
  settingsReady = false;
354
317
  projectionReady = false;
355
318
  registrationFailed = false;
@@ -429,7 +392,6 @@ let GitHubCopilotDualModel = (() => {
429
392
  const subject = agent;
430
393
  const overlay = this.overlays.get(subject);
431
394
  this.overlays.delete(subject);
432
- if (this.handles.get(agent.id)?.agent === subject) this.handles.delete(agent.id);
433
395
  if (overlay) overlay.dispose().catch(() => {});
434
396
  });
435
397
  ctx.effect(() => async () => {
@@ -439,9 +401,7 @@ let GitHubCopilotDualModel = (() => {
439
401
  await api$1(ctx, "subagents", ["drainContinuableDescendants"])?.drainContinuableDescendants(roots).catch(() => {});
440
402
  for (const [agent] of this.overlays) agent.cancel({ kind: "disposed" });
441
403
  await Promise.allSettled([...this.overlays.keys()].map((agent) => agent.whenIdle()));
442
- await Promise.allSettled([...this.handles.values()].map((handle) => handle.dispose()));
443
404
  await Promise.allSettled([...this.overlays.values()].map((overlay) => overlay.dispose()));
444
- this.handles.clear();
445
405
  this.overlays.clear();
446
406
  });
447
407
  for (const agent of api$1(ctx, "agents", ["list"])?.list() ?? []) try {
@@ -525,7 +485,7 @@ let GitHubCopilotDualModel = (() => {
525
485
  async view() {
526
486
  const empty = {
527
487
  supported: false,
528
- diagnostic: "DUAL_MODEL_UNSUPPORTED",
488
+ diagnostic: "DUAL_MODEL_RETIRED",
529
489
  writable: false,
530
490
  revision: null,
531
491
  configuration: DEFAULT_CONFIG,
@@ -533,35 +493,9 @@ let GitHubCopilotDualModel = (() => {
533
493
  workspaces: []
534
494
  };
535
495
  try {
536
- const configuration = this.configuration(), cap = this.capabilities();
537
- if (!cap) return {
538
- ...empty,
539
- ...configuration
540
- };
541
- let models = [], diagnostic;
542
- try {
543
- const preview = await cap.preview.discover({
544
- force: false,
545
- signal: this.lifetime.signal
546
- });
547
- if (preview.available && preview.state === "ready") models = z$1.array(CatalogEntryJson).max(512).parse(preview.models.map(({ id, name }) => ({
548
- id,
549
- name
550
- })));
551
- else diagnostic = "DUAL_MODEL_MODEL_UNAVAILABLE";
552
- } catch {
553
- diagnostic = "DUAL_MODEL_MODEL_UNAVAILABLE";
554
- }
555
496
  return {
556
- supported: true,
557
- ...diagnostic === void 0 ? {} : { diagnostic },
558
- writable: cap.settings.writable === true,
559
- ...configuration,
560
- models,
561
- workspaces: z$1.array(CatalogEntryJson).max(1024).parse(cap.workspaces.list().map((workspace) => ({
562
- id: workspace.id,
563
- name: workspace.title
564
- })))
497
+ ...empty,
498
+ ...this.configuration()
565
499
  };
566
500
  } catch {
567
501
  return empty;
@@ -575,18 +509,8 @@ let GitHubCopilotDualModel = (() => {
575
509
  }
576
510
  }
577
511
  async saveOnce(input) {
578
- const parsed = SaveJson.safeParse(input);
579
- if (!parsed.success) fail$1("DUAL_MODEL_INVALID_REQUEST");
580
- const cap = this.requireCapabilities(), { configuration, expectedRevision } = parsed.data;
581
- if (cap.settings.writable !== true) fail$1("DUAL_MODEL_READ_ONLY");
582
- if (this.configuration().revision !== expectedRevision) fail$1("DUAL_MODEL_REVISION_CONFLICT");
583
- if (configuration.enabled) await this.assertModels(cap, [configuration.plannerModel, configuration.executorModel]);
584
- try {
585
- await cap.settings.replace(DUAL_MODEL_NAMESPACE, configuration, expectedRevision);
586
- } catch (error) {
587
- fail$1(reasonOf(error, "DUAL_MODEL_SAVE_FAILED"));
588
- }
589
- return this.view();
512
+ if (!SaveJson.safeParse(input).success) fail$1("DUAL_MODEL_INVALID_REQUEST");
513
+ fail$1("DUAL_MODEL_RETIRED");
590
514
  }
591
515
  create(input) {
592
516
  const parsed = CreateJson.safeParse(input);
@@ -605,89 +529,33 @@ let GitHubCopilotDualModel = (() => {
605
529
  async createOnce(request, id) {
606
530
  let creation = "uncertain";
607
531
  try {
608
- const cap = this.requireCapabilities();
609
- if (await cap.persistence.stat(id) !== void 0 || cap.agents.get(id)) {
610
- const inspection = await cap.inspector.inspect(id);
611
- let state = dualModelProjection.init(inspection.meta, inspection.inheritedEventCount);
612
- for (const event of inspection.events) state = dualModelProjection.apply(state, event);
613
- if (state.invalid || !state.policy || !policyMatches(state.policy, request)) fail$1("DUAL_MODEL_REQUEST_CONFLICT");
614
- const workspace = this.workspace(cap, request.workspaceId);
615
- if (workspace.path !== state.policy.cwd) fail$1("DUAL_MODEL_REQUEST_CONFLICT");
616
- await workspace.attachSession(id);
617
- return { sessionId: id };
532
+ if (this.lifetime.signal.aborted) fail$1("DUAL_MODEL_UNSUPPORTED");
533
+ const ctx = this.owner.ctx;
534
+ const persistence = api$1(ctx, "sessionPersistence", ["stat"]);
535
+ const agents = api$1(ctx, "agents", ["get"]);
536
+ if (!persistence || !agents) fail$1("DUAL_MODEL_UNSUPPORTED");
537
+ if (await persistence.stat(id) === void 0 && !agents.get(id)) {
538
+ creation = "not-created";
539
+ fail$1("DUAL_MODEL_RETIRED");
618
540
  }
619
- creation = "not-created";
620
- const current = this.configuration();
621
- if (current.revision !== request.expectedRevision) fail$1("DUAL_MODEL_REVISION_CONFLICT");
622
- if (!current.configuration.enabled) fail$1("DUAL_MODEL_DISABLED");
623
- const workspace = this.workspace(cap, request.workspaceId);
624
- const captured = { ...current.configuration };
625
- await this.assertModels(cap, [captured.plannerModel, captured.executorModel]);
626
- const preset = await cap.presets.resolve();
627
- const standingKey = await cap.presets.standingKeyFor(preset.id);
628
- const inheritedNames = new Set(cap.tools.schemas(standingKey).map((tool) => tool.name));
629
- const executorTools = EXECUTOR_TOOLS.filter((name) => inheritedNames.has(name));
630
- if (!executorTools.includes("send_message")) fail$1("DUAL_MODEL_UNSUPPORTED");
631
- if (this.configuration().revision !== request.expectedRevision) fail$1("DUAL_MODEL_REVISION_CONFLICT");
632
- if (cap.workspaces.get(workspace.id) !== workspace) fail$1("DUAL_MODEL_WORKSPACE_UNAVAILABLE");
633
- const policy = {
634
- version: 1,
635
- rootSessionId: id,
636
- requestId: request.requestId,
637
- workspaceId: workspace.id,
638
- settingsRevision: request.expectedRevision,
639
- cwd: workspace.path,
640
- agentPreset: preset.id,
641
- provider: GITHUB_COPILOT_PREVIEW_PROVIDER_ID,
642
- plannerModel: captured.plannerModel,
643
- executorModel: captured.executorModel,
644
- plannerTools: [...ROOT_TOOLS],
645
- executorTools: [...executorTools]
646
- };
647
- creation = "uncertain";
648
- const handle = await cap.agents.create({
649
- sessionId: id,
650
- agentOptions: {
651
- provider: GITHUB_COPILOT_PREVIEW_PROVIDER_ID,
652
- model: policy.plannerModel
653
- },
654
- meta: {
655
- cwd: policy.cwd,
656
- agentPreset: preset.id,
657
- isSeeded: false
658
- },
659
- inheritedEventCount: 0,
660
- seed: [{
661
- type: DUAL_MODEL_POLICY_EVENT,
662
- seq: 0,
663
- time: Date.now(),
664
- ignorable: true,
665
- data: policy
666
- }, {
667
- type: "model/selection",
668
- seq: 1,
669
- time: Date.now(),
670
- data: {
671
- provider: GITHUB_COPILOT_PREVIEW_PROVIDER_ID,
672
- model: policy.plannerModel
673
- }
674
- }],
675
- signal: this.lifetime.signal,
676
- setup: async (agentCtx, agent) => {
677
- await cap.presets.mount(agentCtx, preset.id);
678
- this.install(agent, policy, "planner");
679
- }
680
- });
681
- this.handles.set(id, handle);
682
- if (!await cap.sessions.flush(handle.agent.session)) fail$1("DUAL_MODEL_CREATE_UNCERTAIN");
541
+ const inspector = api$1(ctx, "sessionController", ["inspect"]);
542
+ const workspaces = api$1(ctx, "workspaceRegistry", ["get"]);
543
+ if (!inspector || !workspaces) fail$1("DUAL_MODEL_UNSUPPORTED");
544
+ const inspection = await inspector.inspect(id);
545
+ let state = dualModelProjection.init(inspection.meta, inspection.inheritedEventCount);
546
+ for (const event of inspection.events) state = dualModelProjection.apply(state, event);
547
+ if (state.id !== id || state.invalid || !state.policy || !policyMatches(state.policy, request)) fail$1("DUAL_MODEL_REQUEST_CONFLICT");
548
+ const workspace = this.workspace(workspaces, request.workspaceId);
549
+ if (workspace.path !== state.policy.cwd) fail$1("DUAL_MODEL_REQUEST_CONFLICT");
550
+ if (this.lifetime.signal.aborted) fail$1("DUAL_MODEL_UNSUPPORTED");
683
551
  await workspace.attachSession(id);
684
552
  return { sessionId: id };
685
553
  } catch (error) {
686
554
  fail$1(reasonOf(error, "DUAL_MODEL_CREATE_UNCERTAIN"), creation);
687
555
  }
688
556
  }
689
- workspace(cap, id) {
690
- const workspace = cap.workspaces.get(id);
557
+ workspace(workspaces, id) {
558
+ const workspace = workspaces.get(id);
691
559
  if (!workspace || typeof workspace.path !== "string" || typeof workspace.attachSession !== "function") fail$1("DUAL_MODEL_WORKSPACE_UNAVAILABLE");
692
560
  return workspace;
693
561
  }
@@ -1732,7 +1600,7 @@ let GitHubCopilotUsageController = (() => {
1732
1600
  //#endregion
1733
1601
  //#region package.json
1734
1602
  var name$1 = "dsh-github-copilot";
1735
- var version = "0.4.0-alpha.33";
1603
+ var version = "0.4.0-alpha.34";
1736
1604
  //#endregion
1737
1605
  //#region lib/types/probe.js
1738
1606
  /**
@@ -8,7 +8,6 @@ import type { CSSProperties, ReactElement } from 'react';
8
8
  import type { GitHubCopilotAuthorizationView } from './authorization-controller.ts';
9
9
  import type { ProviderCardExtrasOwnerProps, SettingsSectionOwnerProps } from './dsh-supported-types.ts';
10
10
  export { WebSearchRoutingCard } from './web-search-routing-card.ts';
11
- export { DualModelCard } from './dual-model-card.ts';
12
11
  export { CopilotUsageCard } from './copilot-usage-card.ts';
13
12
  export declare const inject: string[];
14
13
  interface GitHubCopilotProviderCardProps extends ProviderCardExtrasOwnerProps {
@@ -91,13 +91,12 @@ declare module '@deepseek-ai/cordis' {
91
91
  githubCopilotDualModel: GitHubCopilotDualModel;
92
92
  }
93
93
  }
94
- /** Always mountable; missing optional APIs produce a safe unsupported view. */
94
+ /** Always mountable; retired entry points coexist with retained policy enforcement. */
95
95
  export default class GitHubCopilotDualModel extends TypertRemoteService {
96
96
  private readonly owner;
97
97
  private readonly lifetime;
98
98
  private readonly creates;
99
99
  private readonly overlays;
100
- private readonly handles;
101
100
  private settingsReady;
102
101
  private projectionReady;
103
102
  private registrationFailed;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-github-copilot",
3
3
  "description": "DSH companion for GitHub Copilot sign-in, account-aware model profiles, tool compatibility, and provider-hosted search.",
4
- "version": "0.4.0-alpha.33",
4
+ "version": "0.4.0-alpha.34",
5
5
  "publishConfig": {
6
6
  "access": "public",
7
7
  "registry": "https://registry.npmjs.org/",
@@ -1,10 +0,0 @@
1
- /** Optional read-only projection of the public Client Session/Workspace lists. */
2
- import type { Context } from '@deepseek-ai/cordis';
3
- export interface CurrentWorkspaceSource {
4
- getSnapshot(): string | undefined;
5
- subscribe(listener: () => void): () => void;
6
- dispose(): void;
7
- }
8
- /** Observe only current membership. Do not call navigation/create or use a recent-workspace fallback. */
9
- export declare function createCurrentWorkspaceSource(ctx: Context): CurrentWorkspaceSource;
10
- //# sourceMappingURL=current-workspace.d.ts.map
@@ -1,53 +0,0 @@
1
- import type { ReactElement } from 'react';
2
- /** Client-owned contracts: no Host implementation or credential imports. */
3
- export interface DualModelConfig {
4
- enabled: boolean;
5
- plannerModel: string;
6
- executorModel: string;
7
- }
8
- export interface DualModelView {
9
- supported: boolean;
10
- diagnostic?: string;
11
- writable: boolean;
12
- revision: number | null;
13
- configuration: DualModelConfig;
14
- models: readonly {
15
- id: string;
16
- name: string;
17
- }[];
18
- workspaces: readonly {
19
- id: string;
20
- name: string;
21
- }[];
22
- }
23
- export type Result<T> = {
24
- ok: true;
25
- value: T;
26
- } | {
27
- ok: false;
28
- error: unknown;
29
- };
30
- export interface DualModelRemote {
31
- view(): Promise<Result<DualModelView>>;
32
- save(input: {
33
- configuration: DualModelConfig;
34
- expectedRevision: number;
35
- }): Promise<Result<DualModelView>>;
36
- create(input: {
37
- requestId: string;
38
- workspaceId: string;
39
- expectedRevision: number;
40
- }): Promise<Result<{
41
- sessionId: string;
42
- }>>;
43
- }
44
- export interface DualModelCardProps {
45
- remote: DualModelRemote;
46
- locale?: string;
47
- /** Current Client workspace; never a saved role setting or an implicit fallback. */
48
- currentWorkspaceId?: string;
49
- onOpenSession?: (id: string) => void;
50
- }
51
- /** Additive Models settings card. All mutations belong to the injected scoped Remote. */
52
- export declare function DualModelCard(props: DualModelCardProps): ReactElement;
53
- //# sourceMappingURL=dual-model-card.d.ts.map
@@ -1,5 +0,0 @@
1
- /** Optional Models-page entry; feature absence never blocks account sign-in. */
2
- import type { Context } from '@deepseek-ai/cordis';
3
- /** A single visible seat under Models, with a section fallback on older Clients. */
4
- export declare function registerDualModelUi(ctx: Context): () => void;
5
- //# sourceMappingURL=dual-model-ui.d.ts.map