dsh-github-copilot 0.4.0-alpha.18
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 +233 -0
- package/CONTRIBUTING.md +46 -0
- package/LICENSE +21 -0
- package/README.md +365 -0
- package/README.zh.md +376 -0
- package/SECURITY.md +29 -0
- package/cordis.patch.yml +16 -0
- package/deployment-baseline.json +752 -0
- package/docs/agent-readiness.md +95 -0
- package/docs/images/copilot-auth-card-signed-in.png +0 -0
- package/docs/images/copilot-device-code-copy.png +0 -0
- package/docs/images/copilot-model-freshness.png +0 -0
- package/docs/images/copilot-model-refreshing.png +0 -0
- package/docs/images/copilot-provider-authorization.png +0 -0
- package/docs/images/copilot-provider-entry.png +0 -0
- package/docs/images/github-copilot-auth-flow.gif +0 -0
- package/docs/model-compatibility-acceptance.md +46 -0
- package/docs/npm-distribution.md +134 -0
- package/docs/session-search-routing.md +53 -0
- package/docs/single-route-migration.md +115 -0
- package/lib/client.js +7153 -0
- package/lib/client.js.map +1 -0
- package/lib/index.js +5384 -0
- package/lib/remote.js +162 -0
- package/lib/routed-web.js +80 -0
- package/lib/search-routing-pFLux0W7.js +763 -0
- package/lib/types/account-model-auth.d.ts +15 -0
- package/lib/types/account-model-catalog.d.ts +67 -0
- package/lib/types/account-model-source.d.ts +85 -0
- package/lib/types/authorization-controller.d.ts +100 -0
- package/lib/types/client.d.ts +106 -0
- package/lib/types/compact-account.d.ts +42 -0
- package/lib/types/compatibility.d.ts +17 -0
- package/lib/types/config.d.ts +42 -0
- package/lib/types/content-file.d.ts +10 -0
- package/lib/types/copilot-auth.d.ts +23 -0
- package/lib/types/copilot-grant.d.ts +11 -0
- package/lib/types/copilot-identity.d.ts +6 -0
- package/lib/types/copilot-request.d.ts +11 -0
- package/lib/types/current-provider.d.ts +59 -0
- package/lib/types/deepseek-search-fallback.d.ts +11 -0
- package/lib/types/failure.d.ts +38 -0
- package/lib/types/http.d.ts +48 -0
- package/lib/types/index.d.ts +39 -0
- package/lib/types/migration-status.d.ts +50 -0
- package/lib/types/model-protocol.d.ts +31 -0
- package/lib/types/pi-provider-bridge.d.ts +22 -0
- package/lib/types/plan.d.ts +148 -0
- package/lib/types/preview-provider.d.ts +35 -0
- package/lib/types/preview-route.d.ts +63 -0
- package/lib/types/probe.d.ts +39 -0
- package/lib/types/reasoning-presentation.d.ts +55 -0
- package/lib/types/remote.d.ts +151 -0
- package/lib/types/responses-reasoning-text.d.ts +24 -0
- package/lib/types/responses-reasoning.d.ts +7 -0
- package/lib/types/route-ownership.d.ts +70 -0
- package/lib/types/routed-web.d.ts +38 -0
- package/lib/types/search-backend.d.ts +16 -0
- package/lib/types/search-routing.d.ts +43 -0
- package/lib/types/serialize.d.ts +109 -0
- package/lib/types/sse.d.ts +28 -0
- package/lib/types/temporary-models.d.ts +25 -0
- package/lib/types/tool-schema-compat.d.ts +17 -0
- package/lib/types/traditional-search.d.ts +17 -0
- package/lib/types/types.d.ts +69 -0
- package/lib/types/usage.d.ts +26 -0
- package/lib/types/watchdog.d.ts +22 -0
- package/lib/types/web-delegate.d.ts +12 -0
- package/lib/types/web-search-routing-card.d.ts +10 -0
- package/lib/types/web-search-routing-config.d.ts +16 -0
- package/lib/types/wire-anthropic.d.ts +37 -0
- package/lib/types/wire.d.ts +56 -0
- package/lib/web-delegate.js +9 -0
- package/package.json +200 -0
- package/scripts/check-search-composition.mjs +191 -0
package/AGENTS.md
ADDED
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
# Agent guide
|
|
2
|
+
|
|
3
|
+
This file is the authoritative entry point for humans and coding agents. Read it before changing code.
|
|
4
|
+
|
|
5
|
+
## Plugin-only implementation boundary
|
|
6
|
+
|
|
7
|
+
This repository follows a **plugin-only** policy: implement fixes in `dsh-github-copilot` through existing published public Core/pi-ai APIs. This rule applies to agents, subagents, scripts, installers and release plans, not just the final diff.
|
|
8
|
+
|
|
9
|
+
- Do not edit DSH Core source, create Core implementation worktrees, prepare Core commits/PRs/releases, or rebuild/install a modified Core to complete this project's work.
|
|
10
|
+
- Do not patch deployed Core or dependency artifacts in `node_modules`, ship hidden Core patches, replace Core prototypes/private registries, or mutate shared upstream model catalogs. Create only plugin-owned objects and reversible registrations through public APIs.
|
|
11
|
+
- Do not make a Core patch, a new Core export, or an upstream Core PR being merged/released a prerequisite for delivering a plugin fix.
|
|
12
|
+
- Read-only Core/API inspection and isolated compatibility tests against unchanged pinned artifacts are allowed. Test-only fixtures must not alter tracked Core implementation or a live deployment and must clean up only their own temporary files. Historical controlled baselines are regression evidence, not permission for new Core changes.
|
|
13
|
+
- If the existing API cannot support the desired behavior, report the limit and choose a tested plugin-local alternative or defer that capability. Do not expand into Core work to preserve an earlier design claim. Reusing a published adapter class for an account-scoped, metadata-driven Copilot route is allowed; a second wire implementation, independently maintained static model catalog, copied credentials, or a fabricated single-route claim is not.
|
|
14
|
+
- General model compatibility must be data-driven: new account models with supported endpoint/capability metadata must work without adding model IDs or name-prefix branches to code. Unknown or incomplete metadata must produce a diagnostic rather than guessed capabilities. Follow [the current acceptance checklist](./docs/model-compatibility-acceptance.md), including Thinking, pi version compatibility, PR/merge/release and the requested local upgrade.
|
|
15
|
+
- Any future Core work requires a separate, explicit human request and separate task scope. Generic requests to fix compatibility, add models, optimize, or continue a goal do not grant that permission. Preserve abandoned Core work without resuming, publishing or deleting it automatically.
|
|
16
|
+
|
|
17
|
+
`agent-contract.json` records this boundary; `pnpm verify:agent` and tooling regressions reject missing or weakened policy. These checks detect repository policy drift, not filesystem access outside the repository; they do not replace agent compliance or sandbox enforcement.
|
|
18
|
+
|
|
19
|
+
## Agent quick start
|
|
20
|
+
|
|
21
|
+
1. Run `pwd`, `git status --short --branch`, and `git remote -v` in the bound checkout. Preserve user changes and existing worktrees; do not infer the project from the DSH installation path.
|
|
22
|
+
2. Read this file, then `node scripts/agent.mjs describe --json`. `agent-contract.json` maps each task to its owning files, focused tests, risks and approval boundaries; package scripts and release URLs are derived from current metadata.
|
|
23
|
+
3. Run `node scripts/agent.mjs doctor --json` before install. It is a dependency-free, read-only repository preflight: exit 0 means preflight passed, 1 means prerequisites missing, 2 means invalid arguments/metadata. Build presence is not build freshness, and no live DSH or credential readiness is claimed.
|
|
24
|
+
4. Choose a task with `node scripts/agent.mjs plan models --json` (or authorization/search/client/compatibility/tooling/release). Output is an unexecuted argv plan, never implicit permission to run destructive operations.
|
|
25
|
+
5. Use Node 24 LTS for development and the exact pnpm version in `package.json`; the runtime dependency floor is Node 22.19.0. Run frozen install in this checkout. Dependencies/build output are not carried into worktrees.
|
|
26
|
+
6. Create/reuse a tracking issue and feature branch, implement a regression first, run the full gate, inspect the diff, and open a PR. After an authorized merge of an important update, continue through the release-delivery rule below without another release prompt. Merge, live-profile install and worktree checkout still require explicit user approval.
|
|
27
|
+
|
|
28
|
+
Use native DSH tools for goals, background jobs and scoped subagents. Use local Git and the GitHub REST API for delivery; no external orchestration daemon, roster or `vcs_*` tool is required. Do not assume a model provider's identity is the assisting agent.
|
|
29
|
+
|
|
30
|
+
## Product and architecture
|
|
31
|
+
|
|
32
|
+
`dsh-github-copilot` is a companion to official DSH `0.1.5-rc.2`, DSH `0.1.5-rc.1`, DSH `0.1.5-alpha.2`, DSH `0.1.5-alpha.1`, DSH `0.1.3-alpha.1`, DSH `0.1.2-rc.1`, and the controlled DSH Desktop `0.1.1-rc.2` Core baseline. It does not own a general Copilot chat adapter. DSH's built-in `llm-pi-ai` mount owns the GitHub Copilot provider, catalog, OAuth method and grant format, token exchange, refresh, and normal model transport.
|
|
33
|
+
|
|
34
|
+
This repository owns eight narrow surfaces:
|
|
35
|
+
|
|
36
|
+
1. A conditional authorization-service bootstrap plus Host controller that joins DSH authorization, credentials, and settings.
|
|
37
|
+
2. A Client Models provider-card contribution with one shared account-state owner and Client-safe Remote descriptors; embed in an existing configured canonical row, suppress its separate footer controller, and retain footer/old-Core section fallback when no such row is mounted.
|
|
38
|
+
3. Strict JSON normalization of pi-ai's provider-owned Copilot OAuth grant.
|
|
39
|
+
4. Preserve intentional absence of `llm-pi-ai.providers.github-copilot`; reconcile only existing legacy profiles and verified ownership journals. Fresh installations use the single account-discovered route; existing profiles require explicit migration, never silent removal.
|
|
40
|
+
5. Direct provider-hosted search using the same Host-side credential lifecycle.
|
|
41
|
+
6. Provider-scoped tool-schema compatibility for Copilot payload behaviors; Core remains the tool and execution owner.
|
|
42
|
+
7. A bounded account-discovery route that supplies validated endpoint/capability metadata to the published native adapter, without maintaining model-ID routing rules or changing Core's catalog.
|
|
43
|
+
8. Optional, provider-scoped Chat presentation for completed empty reasoning disclosures; durable content and encrypted replay metadata remain Core-owned.
|
|
44
|
+
|
|
45
|
+
## File map
|
|
46
|
+
|
|
47
|
+
- `src/index.ts`: authorization bootstrap, dependency-gated Host entry, settings registration, listener, and `ctx.web` provider composition.
|
|
48
|
+
- `src/authorization-controller.ts`: sign-in/status/sign-out and route mutation.
|
|
49
|
+
- `src/copilot-grant.ts`, `src/copilot-auth.ts`: strict grant normalization and narrow pi-ai `CredentialStore` adapter over `llm-pi-ai/github-copilot`.
|
|
50
|
+
- `src/client.ts`: `settings.models.provider-card` account UI, a separate `settings.models.footer` search-routing card, and independently managed optional Chat integration.
|
|
51
|
+
- `src/web-search-routing-config.ts`, `src/web-search-routing-card.ts`: plugin-owned cross-provider live routing settings and the Models-page control surface.
|
|
52
|
+
- `src/reasoning-presentation.ts`: guarded native Chat delegation and historical Copilot provenance; filters temporary view props only, never messages, signatures, replay indexes or usage.
|
|
53
|
+
- `src/remote.ts`: Typert Remote contribution. Never add credential payloads here.
|
|
54
|
+
- `src/current-provider.ts`: selected DSH route plus installed pi-ai catalog facts.
|
|
55
|
+
- `src/temporary-models.ts`: exact, account-gated corrections with semantic protocol/capability retirement.
|
|
56
|
+
- `src/model-protocol.ts`: explicit Core capability detection and conservative legacy fallback.
|
|
57
|
+
- `src/responses-reasoning.ts`, `src/responses-reasoning-text.ts`: selected-model effort mapping and public summary assembly.
|
|
58
|
+
- `src/tool-schema-compat.ts`: Copilot-only prompt-assembly filter for unusable escalation arguments and action-specific Goal update schemas.
|
|
59
|
+
- `src/plan.ts`: Copilot-only, fail-closed hosted-search candidate lifecycle.
|
|
60
|
+
- `src/probe.ts`: bounded native-search capability proof.
|
|
61
|
+
- `src/wire.ts`, `src/wire-anthropic.ts`: inline hosted-search streaming.
|
|
62
|
+
- `src/traditional-search.ts`: `github-copilot-hosted` `ctx.web` provider.
|
|
63
|
+
- `src/serialize.ts`, `src/sse.ts`, `src/failure.ts`: protocol conversion and bounded error handling.
|
|
64
|
+
- `tests/`: unit and integration evidence; mirror the source area being changed.
|
|
65
|
+
- `deployment-baseline.json`: declared machine-readable compatibility and capability evidence inventory.
|
|
66
|
+
- `scripts/verify-deployment-baseline.mjs`: invariant drift gate.
|
|
67
|
+
- `lib/`: generated release output; never edit it.
|
|
68
|
+
|
|
69
|
+
## Non-negotiable invariants
|
|
70
|
+
|
|
71
|
+
- Do not implement a second general wire adapter or independently maintained static Copilot model catalog. The account-scoped route composes the published adapter and SDK with validated supplier metadata.
|
|
72
|
+
- Protocol and capability corrections must follow authenticated, current account metadata; new model IDs must not need new implementation tables. Native pi metadata may be reused only where it agrees with advertised endpoints and capabilities. Matching IDs alone do not prove correctness or authorize migration back into another Core catalog. Preserve old bounded ownership journals solely for verified restoration of legacy writes, never for new global protocol overrides.
|
|
73
|
+
- Solve protocol gaps inside the plugin using existing published extension points. Do not require a new Core capability/service or patch Core to keep a single route. The managed account-model route reuses the published adapter with one shared OAuth grant; label multiple routes honestly. Keep canonical Core models/configuration under their existing owner instead of rewriting them from the companion's pi catalog.
|
|
74
|
+
- Preserve public Responses summaries and the effective selected-model reasoning effort. Never synthesize raw reasoning replay from summaries or read/decrypt opaque replay data; assistant reasoning/replay histories delegate to Core before probing.
|
|
75
|
+
- Do not require or silently support `copilot2api`, an external gateway, a pasted GitHub token, a placeholder key, or `dsh-web-search-provider`.
|
|
76
|
+
- The credential record key is `llm-pi-ai/github-copilot`.
|
|
77
|
+
- OAuth credential payloads stay Host-only. Client Remote methods may expose status, notices, and errors only.
|
|
78
|
+
- Refresh must run through pi-ai `Models.getAuth()` and DSH `credentials.modifyRecord()`.
|
|
79
|
+
- Copilot OAuth grant writes must rebuild only pi-ai's documented provider fields as a fresh plain JSON object; unrelated extension values never reach DSH credential storage.
|
|
80
|
+
- Settings changes are path-level. Never replace the whole `llm-pi-ai` section or unrelated provider profiles.
|
|
81
|
+
- Sign-out deletes only the Copilot credential record and keeps route settings.
|
|
82
|
+
- Hosted search serves either an eligible initiating `github-copilot` / managed `github-copilot-preview` route, or an explicitly configured provider-owned `searchModel` selected by the user-facing web-search router. Both paths require an account-available model and supported search protocol; custom inline transport remains legacy-canonical only. Never substitute the global chat default or another Session's identity. The default `probe: true` path requires successful capability proof; `probe: false` is an explicit trust override, not an implicit fallback. Any request containing a file block, including one nested in tool-result content, must bypass the custom wire through `next()` so Core retains file projection ownership.
|
|
83
|
+
- Misconfiguration and API drift fail loudly with a named missing seam. Do not fall back to process-local secrets or implicit machine state.
|
|
84
|
+
- Host, Client, and Remote package entries must stay independently buildable and exported.
|
|
85
|
+
- The package must self-provide authorization when Core omits it, reuse an existing service without duplicate registration, and never activate the integration body before authorization is available.
|
|
86
|
+
|
|
87
|
+
## Session and migration ownership (V3, alpha.8, #99)
|
|
88
|
+
|
|
89
|
+
- One global Host account supplies many models; selected/history-backed Sessions retain independent model context. Auto-mode native search derives from the captured initiating Session's effective request-header/config or explicit `GenerateOptions`, never another Session or future global default C. Fixed/default Copilot search uses only the explicit provider-owned `searchModel`, never the global chat default. `Agent.options` is the activation seed, not selected Session-model evidence; `installModelSelection` overrides request/assembly; Core records the effective `Session.requestHeader().config` before tools. Without proven request context, traditional search is unavailable. A newly selected pending model must not reuse the old request header as current prompt guidance. Per-owner plan caches prevent different-model A/B reuse/cancellation; metadata remains shared.
|
|
90
|
+
- Cold Chat picker and `/model` `listModels()` ensure the shared managed source without Settings first. Actual cold managed search non-forcing ensures metadata before deriving facts; existing 24h maximum TTL, cooldown, credential, allowlist and capability/probe gates remain.
|
|
91
|
+
- Without `agents.currentInitiator`, traditional hosted search is unavailable with a named diagnostic; explicit marked `GenerateOptions` can still bind guarded inline requests, uncached if necessary. Credential notification during initial lazy discovery cannot distinguish own rotation from external account change via public status: fail closed with `WEB_PROVIDER_UNAVAILABLE` before probe/wire; a later user/driver request may retry, never automatically.
|
|
92
|
+
- The new native Copilot draft warning says Save adds another real group, not a second account. Public additive APIs cannot veto Add or disable Save; this is warning-only, not enforced single-route registration. Core Edit/Delete remain. Alpha.7 screenshots illustrate timestamps, not alpha.8 migration/search proof.
|
|
93
|
+
- Public `session.selectModel` also saves the future global default. Choose only approved Sessions/default; preserve other selected/history-backed Sessions, but do not promise unselected empty Sessions cannot inherit that default.
|
|
94
|
+
- Code does not auto-migrate settings, credentials or history. After plugin release, approved Ops migration may compare-and-swap only the reviewed user-native `llm-pi-ai.providers.github-copilot` path after ruling out base/journal conflicts, then read back settings and registry. No hidden groups, bulk rewrites or credential copying. Search allowlist updates to the managed ID require a separate reviewed Ops edit; never silently broaden old lists.
|
|
95
|
+
|
|
96
|
+
## Live migration readiness (alpha.9, #101)
|
|
97
|
+
|
|
98
|
+
- Use no-argument `githubCopilot.migrationStatus()` for fresh live-Agent evidence; generic `session/list` may be stale and plugin inventory alone has no loaded-version evidence. `src/migration-status.ts` reads public leaves synchronously and reports loaded build `plugin.name/version`, `protocolVersion: 1`, `observedAt`, capability flags and completeness flags. Missing/unknown/incomplete is not safe absence.
|
|
99
|
+
- Capabilities are `agentsList`, `sessionProjections`, `settingsCas`, `providerRegistry`, `defaultSelection`; `complete.sessions/defaultSelection/routes` describes evidence completeness, not migration approval. Effective selection uses pending projection, request-header config, then default only for genuinely empty Sessions with known projection state. Running `activeRequestSelection` is the latest recorded header, not proven in-flight LLM work. Native effective configuration and native/managed registration are separate flags.
|
|
100
|
+
- This read invokes no auth status/model discovery, credentials or network and mutates no settings/Sessions. No normal UI/global current-model/search card is added. Seven ordinary authorization Remotes retain their codec; the eighth migration Remote uses a separate strict `GitHubCopilotMigrationStatus` codec.
|
|
101
|
+
- `historyScope: live-agents-only` excludes cold stored histories. Require operator acknowledgement that older conversations may need a new explicit selection later. Loaded version/structural capability self-reports are not full Desktop/Core byte attestation or an atomic cross-namespace guarantee; recheck immediately before CAS.
|
|
102
|
+
- The planned `cloga/dsh-windows-ops` command `tools/migrate-copilot-managed-route.ps1` is separate config-only maintenance after release. V1 performs no automated Session/default writes, cold-history scan, plugin install, restart or full Desktop-baseline acceptance. Resolve selection blockers separately with explicit approval; never report this planned command or live migration as published/installed/completed without evidence.
|
|
103
|
+
|
|
104
|
+
## Supported DSH seams
|
|
105
|
+
|
|
106
|
+
The supported upstream baselines are:
|
|
107
|
+
|
|
108
|
+
- Desktop `0.1.1-rc.2` with controlled Core commit `a772dbbde82780bff2b9394427e9f0a24cafa1d5`
|
|
109
|
+
on `cloga-pi-ai-model-api`, based on tag commit `b150a551b8d465e31e418e1b2eaf5e79bbb7d28e`.
|
|
110
|
+
- Tag `dsh-v0.1.2-rc.1`, commit `a66e4702047846cdaa10c66c9d3df3951f5ea70d`.
|
|
111
|
+
- Tag `dsh-v0.1.3-alpha.1`, commit `d347e703908d0406b7a7ef80e3a0e594d86b2215`.
|
|
112
|
+
- Official tag `dsh-v0.1.5-alpha.1`, commit `5dda764ed3aa172535a7967b06ff95d9cbfe536a`.
|
|
113
|
+
- Official tag `dsh-v0.1.5-alpha.2`, commit `b2e3b2a0125854567a4a5fcba75782e42fe84901`.
|
|
114
|
+
- Official tag `dsh-v0.1.5-rc.1`, commit `183f08e9c6dde7e36cd2318eaee70b0da08fb35e`.
|
|
115
|
+
- Official tag `dsh-v0.1.5-rc.2`, commit `fb2c4b9e698e30edb738bca4cf0618587db7d203`.
|
|
116
|
+
|
|
117
|
+
The current target is official `0.1.5-alpha.2`; retain all six earlier pins and exact `0.1.2-rc.1` development dependencies. All five tagged-source targets use unchanged tagged-source runtime fixtures, not standalone npm-artifact certification. Compatibility metadata and synthetic tests do not prove live endpoints, installed Desktop bytes, release publication or loaded runtime state. Public Host, Client and Remote seams remain available; this baseline update does not authorize implementation rewrites.
|
|
118
|
+
|
|
119
|
+
These pins document compatibility evidence. They do not authorize creating another controlled Core patch or making one a prerequisite for new plugin fixes.
|
|
120
|
+
|
|
121
|
+
- Models UI: `0.1.2-rc.1`, `0.1.3-alpha.1`, `0.1.5-alpha.1`, `0.1.5-alpha.2`, `0.1.5-rc.1` and `0.1.5-rc.2` use `settings.models.provider-card`, keyed by settings namespace `llm-pi-ai`, to embed login/status/Refresh/Manage in a mounted configured canonical `github-copilot` row and suppress the separate footer controller. With no such row mounted, retain footer fallback; rc.2 uses a dedicated `settings.section`. Preserve the shared account-state owner across transfer only while another eligible surface remains mounted. Unmounting the last surface or replacing declarations without overlapping mounts stops polling; a later controller reads status and separately non-forcing ensures missing/idle/stale/error/loading signed-in metadata, without replaying the old forced-login action. Manual Refresh models lives inside Manage; errors expose Retry. Opening Models is no longer guaranteed network-free, but status/details themselves remain pure. This additive slot cannot replace Core Edit/Delete: retain the native editor, while normal plugin discovery needs no manual model definitions. UI integration must not merge/remove actual canonical and `github-copilot-preview` routes or rewrite credentials, configuration, history or selection.
|
|
122
|
+
- Authorization flow key: `llm-pi-ai/github-copilot`.
|
|
123
|
+
- Authorization service: rc.1 Core provides it; the rc.2 web/headless profiles rely on this package's runtime dependency and conditional bootstrap.
|
|
124
|
+
- Credentials: use record description/read/modify/delete APIs on the Host. Never read records in the browser.
|
|
125
|
+
- Copilot grant schema: `type: oauth`, non-empty `refresh`/`access`, finite `expires`, optional non-empty `enterpriseUrl`, and optional deduplicated non-empty-string `availableModelIds`.
|
|
126
|
+
- Settings: never recreate a missing `providers.github-copilot` profile. Existing native profiles remain user/Core-owned and require explicit migration before only the account-discovered route is listed.
|
|
127
|
+
- Per-model API: do not assume stock Core honors a configured model.api. Verify the existing published behavior; where it cannot serve a model, use a plugin-local, exact-model alternative or report the limitation rather than patching Core.
|
|
128
|
+
- Route activation: the dormant `llm-pi-ai` mount observes the profile and registers the route.
|
|
129
|
+
- Client activation: package metadata injects DSH remotes and Models UI; `./client` mounts `./remote`.
|
|
130
|
+
- Provider headers: rc.1 validates configured headers through Fetch and reuses Host-owned headers during model discovery.
|
|
131
|
+
- Remote results: the seven ordinary authorization methods retain the Zod v4 `GitHubCopilotAuthorizationView` strict codec required by rc.2 and accepted by rc.1. The eighth no-argument `migrationStatus()` method has a separate strict `GitHubCopilotMigrationStatus` codec; it does not change the ordinary auth contract.
|
|
132
|
+
|
|
133
|
+
When upgrading DSH or pi-ai, inspect the exact tagged public exports and update the baseline, compatibility guard, tests, and docs together.
|
|
134
|
+
|
|
135
|
+
## Code and documentation conventions
|
|
136
|
+
|
|
137
|
+
- TypeScript is strict, ESM, and English-only for code, comments, test names, and `README.md`.
|
|
138
|
+
- `README.zh.md` is the Chinese user guide and should match the English product contract.
|
|
139
|
+
- Prefer existing helpers and narrow interfaces over casts or broad catches.
|
|
140
|
+
- Provider/network errors must not leak credentials or raw sensitive response bodies.
|
|
141
|
+
- Do not commit generated archives, temporary files, `.env` files, tokens, or local credentials.
|
|
142
|
+
- Keep design rationale in code/docs that enforce it; do not add empty templates or duplicate policy documents.
|
|
143
|
+
|
|
144
|
+
## Distribution and release invariants
|
|
145
|
+
|
|
146
|
+
- GitHub Releases and npm are the default distribution channels for every new version. This supersedes the Release-only decision in #43 at the user's request. Publish the same verified original tarball to both; never repack an existing release or silently skip npm. First package bootstrap and OIDC setup require an authorized maintainer; see [npm distribution](./docs/npm-distribution.md). Never bypass organizational registry restrictions.
|
|
147
|
+
- User-facing install commands must include the required DSH `--profile` option and derive the versioned Release URL from `package.json`.
|
|
148
|
+
- Package version, deployment-baseline version, README URLs, and the annotated `v<version>` tag must agree.
|
|
149
|
+
- New versions use standard SemVer prerelease identifiers (`alpha`, `beta`, `rc`); do not add owner/user names to new version strings.
|
|
150
|
+
- The Release workflow must run the complete gate, pack the versioned tarball, publish `SHA256SUMS`, and create the Release only after every preceding step succeeds.
|
|
151
|
+
- Release tags must never move or be reused. Repository tag rules and immutable-release settings enforce this for new releases.
|
|
152
|
+
|
|
153
|
+
## Important-update release delivery
|
|
154
|
+
|
|
155
|
+
- User-requested important updates include user-visible features, behavior fixes, compatibility fixes, and security or stability fixes. Their default delivery includes publication after an authorized merge and green required CI; do not stop at a merged PR or ask a second time whether to release.
|
|
156
|
+
- Explicit user restrictions such as code-only, review-only or do-not-release take precedence. Pure documentation and internal-only changes are not automatically release-bearing; they need an explicit release request if publication is desired. A task plan is not permission for an unrelated release.
|
|
157
|
+
- Plan version alignment with the implementation PR whenever possible. If the prepared version/tag is unused and aligned, release it; otherwise prepare the next appropriate SemVer version through the normal PR path. Preserve the prerelease channel unless promotion is explicitly requested. Any additional version PR still needs merge approval, not a repeated release-scope question.
|
|
158
|
+
- Check all required CI, tag rules and package/archive checks. Create a fresh annotated tag only on the verified merged revision, let the protected Release workflow publish, and verify the non-draft Release, intended prerelease flag, tag/commit, assets and SHA-256. Never bypass failing CI, move a tag or substitute an unverified local archive.
|
|
159
|
+
- A release-bearing update is not fully delivered until the published Release URL, verified version/commit/assets/checksum and npm version/SRI are reported. If CI, permissions or network prevents either channel, report partial delivery and the exact pending step; never describe merged-only or GitHub-only work as fully delivered.
|
|
160
|
+
- This standing release authorization does not authorize profile installation, sign-out, worktree checkout or interruption of running Sessions. Keep published, installed-on-disk and loaded-runtime status separate; a session-interrupting restart still requires explicit acknowledgement.
|
|
161
|
+
|
|
162
|
+
## Installation-agent PowerShell practice
|
|
163
|
+
|
|
164
|
+
Installation agents using the DSH `pwsh` tool must follow these rules:
|
|
165
|
+
|
|
166
|
+
- Initial `pwsh` calls omit `sandbox_permissions` and `justification` entirely.
|
|
167
|
+
- When approval prompts are disabled, never include either field.
|
|
168
|
+
- When the current sandbox mode is `danger-full-access`, never request escalation.
|
|
169
|
+
- Use both fields only once, when retrying the exact same command after a real sandbox denial, approval is available, and the target mode is strictly wider than the current mode.
|
|
170
|
+
- Omit the keys rather than sending `null`, empty strings, or the current sandbox mode.
|
|
171
|
+
|
|
172
|
+
The plugin keeps its managed Copilot route on ordinary JSON-schema tool calling and removes `sandbox_permissions` plus `justification` only from tool schemas assembled for the `github-copilot` provider. Optional schema semantics alone do not stop these models from emitting invalid escalation requests. Other providers retain the native one-shot escalation surface; Copilot sessions must choose sufficient standing permissions before a call that needs wider access. The rules above remain agent-side practice, and the plugin does not rewrite user-global agent instructions.
|
|
173
|
+
|
|
174
|
+
## Mechanical verification
|
|
175
|
+
|
|
176
|
+
Run from the repository root:
|
|
177
|
+
|
|
178
|
+
```sh
|
|
179
|
+
pnpm install --frozen-lockfile
|
|
180
|
+
pnpm verify
|
|
181
|
+
pnpm pack --pack-destination artifacts
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Then run `pnpm verify:tarball -- artifacts/dsh-github-copilot-<package-version>.tgz` on that exact archive. `node scripts/agent.mjs plan release --json` supplies the versioned argument without shell interpolation or platform assumptions.
|
|
185
|
+
|
|
186
|
+
`pnpm verify` checks the Agent contract, source and local test types, baseline markers, a clean build, Vitest tests, Node tooling tests, and real built Host import/Client-loader/Remote smoke. `tests/fixtures` are intentionally excluded from local test typecheck because they import source from a separate pinned Core checkout. The checked-in code must pass; never suppress compiler errors or weaken a test to get a green report.
|
|
187
|
+
|
|
188
|
+
CI runs on Windows/Linux against all seven exact Core baselines, with unchanged tagged-source runtime checks for `0.1.3-alpha.1`, `0.1.5-alpha.1`, `0.1.5-alpha.2`, `0.1.5-rc.1` and `0.1.5-rc.2`. Optional native Chat fixtures also cover all five tagged-source targets and `0.1.2-rc.1`. `verify:upstream` is static seam-marker evidence. `verify:controlled-core` exclusively installs a temporary config fixture, refuses an existing target, and removes only its own file; it is not full plugin activation. The published rc.2 adapter test covers model materialization, not live provider transport. The release job must wait for the complete reusable CI matrix on the tagged revision, then verify its own packed bytes before publishing.
|
|
189
|
+
|
|
190
|
+
### Evidence and side effects
|
|
191
|
+
|
|
192
|
+
| Operation | What it proves / changes |
|
|
193
|
+
|---|---|
|
|
194
|
+
| `agent.mjs describe/doctor/plan` | Read-only checkout metadata/preflight; never runtime health or credentials |
|
|
195
|
+
| `pnpm verify:baseline` | Required source/test markers exist; not semantic or live proof |
|
|
196
|
+
| `pnpm verify` | Local compiler, tests, clean build and import checks; no real OAuth/API requests |
|
|
197
|
+
| `pnpm verify:tarball` | Archive structure/export/media and equality to local build; no extraction/execution |
|
|
198
|
+
| Authorization `status()` / `describeGitHubCopilotProviderProfile()` | Read-only grant snapshot and route planning; no settings mutation, OAuth refresh or network proof |
|
|
199
|
+
| Authorization `reconcile()` / `inspectGitHubCopilotProviderProfile()` | Explicit stored-snapshot repair; revision-checked settings writes; NOT token/model discovery refresh |
|
|
200
|
+
| Explicit UI Start sign-in / account switch | Successful immediate or polled completion forces one bounded discovery; shared owner survives only overlapping eligible mounts; no model switch or message replay |
|
|
201
|
+
| Models opening / `ensureModels()` | Separately ensures missing/idle/stale/error/loading signed-in metadata once without force; error re-entry may retry after shared cooldown with no same-mount loop; loading joins the Host flight without extra network; fresh ready makes no request and true unavailable/empty models do not auto-retry; status/details remain network-free |
|
|
202
|
+
| Manage → Refresh models / visible Retry | Explicit bounded discovery and native OAuth refresh when needed; not a prerequisite for normal opening/use |
|
|
203
|
+
| Metadata freshness | `github-copilot.accountModelTtlMs` defaults to 86400000 (24h maximum reuse); `accountModelFailureCooldownMs` defaults to 300000 (5min non-forcing failure cooldown); shared Host single flight, no periodic metadata polling; a separate mounted 60s timer updates timestamp text only |
|
|
204
|
+
| Last metadata display | Same-account data may display during TTL refresh/loading/error but never authorize requests; credential/account/permission invalidation or proof expiry immediately revokes evidence; TTL does not extend tokens |
|
|
205
|
+
| Last-success timestamp (alpha.7, #97) | Show `snapshot.discoveredAt` once beside count outside Manage: English relative text, full LOCAL date/time/zone tooltip and accessible semantic `time`; missing/invalid/no account hides it, future uses absolute text. Pending/error retains last success, successful refresh replaces it and sign-out clears it. One mounted 60s display-only timer makes no RPC/status/discovery calls and is disposed with timestamp/unmount; cache/discovery lifecycle unchanged |
|
|
206
|
+
| Definitive `UNKNOWN_MODEL` | One bounded metadata refresh, never message replay or automatic model switching; generic HTTP/network errors are not guessed to be unknown models |
|
|
207
|
+
| README GIF/PNG illustrations | Primary alpha.7 model-freshness/model-refreshing PNGs show the built Client in isolated Edge with synthetic Remote/provider shell. Fake-clock checks advance the label from 8 to 10 minutes without additional RPC, retain timestamp during pending/error, replace it on refresh success, clear it and remove the timer on sign-out, and keep the 375px layout safe. Host TTL/cooldown timing needs unit tests, not screenshots; no live Core/production authorization. Provider-entry/authorization PNGs remain historical alpha.5; older compact GIF/PNGs alpha.3 |
|
|
208
|
+
| Host attach/restart | Reconciles the stored profile; search proofs stay lazy and do not start at attach |
|
|
209
|
+
| Background credential/reset notifications | Invalidate evidence and clear Client state with read-only status; no forced discovery on every token event; next Models open/use ensures metadata |
|
|
210
|
+
| Eligible model/search request | May resolve/refresh credentials and run bounded capability proof; changes during proof must fail closed rather than reuse another account's proof |
|
|
211
|
+
| Release install | Writes a named user profile; installed on disk is not loaded in the running Host |
|
|
212
|
+
|
|
213
|
+
Never say GPT-6/search works merely because settings, typecheck or a package import passes. Report the layers separately. Keep synthetic credentials in fixtures; no real sign-in, logout or API call just to produce test evidence. Do not recommend disabling capability proof as a routine repair. Preserve logs locally and report only redacted facts; route security-sensitive findings through SECURITY.md.
|
|
214
|
+
|
|
215
|
+
## Changing capabilities
|
|
216
|
+
|
|
217
|
+
1. Identify the owning seam using `agent-contract.json`; do not duplicate an upstream owner.
|
|
218
|
+
2. Add or update focused tests before changing deployment claims.
|
|
219
|
+
3. Update both READMEs when user behavior, setup, migration, or boundaries change.
|
|
220
|
+
4. Update `deployment-baseline.json`, `agent-contract.json` and their verifiers when the corresponding contract changes.
|
|
221
|
+
5. Build before package smoke; never hand-edit `lib/`.
|
|
222
|
+
|
|
223
|
+
## Issue, branch, and PR workflow
|
|
224
|
+
|
|
225
|
+
- Every change starts from a tracking issue. Resolve the actual default branch through Git remote metadata.
|
|
226
|
+
- Work on a feature branch; never commit directly to `main`.
|
|
227
|
+
- Reference the issue in the commit and use truthful tool attribution: `Assisted-by: DeepSeek Harness (DSH)` for this DSH session. For a different tool, name the tool actually used. `node scripts/agent.mjs attribution "DeepSeek Harness (DSH)"` formats the trailer without inventing an identity.
|
|
228
|
+
- `Co-authored-by` is reserved for actual collaborators with verified identities. Do not copy the Copilot App trailer from history or invent a bot email. The model provider is not the authoring tool. Keep the user's Git author unchanged and do not rewrite published history.
|
|
229
|
+
- State expected results and scope before the complete gate; compare actual outcomes before pushing. All current CI checks must be green before any authorized merge.
|
|
230
|
+
- Push only the feature branch and open a PR targeting the resolved default branch with `Fixes #<issue>`. Include risks, tests, evidence limits, and rollback.
|
|
231
|
+
- Merge, installing into a user profile, sign-out and worktree checkout require explicit user approval. Important-update publication follows the standing release-delivery rule above, not a second release prompt; other releases need an explicit request. Never bypass branch/tag protection.
|
|
232
|
+
|
|
233
|
+
GitHub operations must use the repository owner's intended authenticated identity. Inject credentials only into the current Git/API process; never print or persist them or add machine-specific credential paths here. Network failure is not an authentication failure: follow user-authorized network recovery, bound retries, preserve local work and report pending remote delivery honestly.
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
## Scope first
|
|
4
|
+
|
|
5
|
+
Read [AGENTS.md](./AGENTS.md) before changing code. This repository is a narrow companion to DSH's built-in `@deepseek-ai/dsh-llm-pi-ai`; do not add a second general Copilot adapter, catalog, credential store, external gateway, or sandbox owner. Exact temporary model compatibility remains constrained by the documented account/ownership gates.
|
|
6
|
+
|
|
7
|
+
Use a tracking issue to describe the problem and owning seam. Security-sensitive reports belong in [private vulnerability reporting](./SECURITY.md), not a public issue. Use native DSH tools, local Git and the GitHub REST API; no external orchestrator or special VCS tool is required.
|
|
8
|
+
|
|
9
|
+
## Plugin-only delivery
|
|
10
|
+
|
|
11
|
+
Follow the **plugin-only** boundary in [AGENTS.md](./AGENTS.md#plugin-only-implementation-boundary). Fixes must live in this plugin and use existing published public APIs. Do not modify Core source, patch installed Core or `node_modules`, monkey-patch Core internals/shared catalogs, or prepare Core PRs/releases as part of this work. A new Core export or patch being merged is not an acceptable plugin delivery prerequisite.
|
|
12
|
+
|
|
13
|
+
Core inspection is read-only. Isolated tests may use unchanged pinned Core artifacts and owned temporary fixtures, never edits to tracked Core implementation or a live deployment. If an API is insufficient, document the limitation and a plugin-local alternative; do not silently move the task into Core. A separate, explicit human Core task is required for any future Core work—generic compatibility or optimization requests do not authorize it.
|
|
14
|
+
|
|
15
|
+
## Change workflow
|
|
16
|
+
|
|
17
|
+
1. Determine `pwd`, Git status, remote and actual default branch. Preserve other people's changes. Start a feature branch such as `feature/issue-73-agent-readiness`; branch names need not contain an owner name.
|
|
18
|
+
2. Read `node scripts/agent.mjs describe --json` and run `node scripts/agent.mjs doctor --json`. These are read-only repository diagnostics, not live health checks. Plans from `node scripts/agent.mjs plan <task> --json` contain unexecuted argv lists.
|
|
19
|
+
3. Use Node 24 LTS for development (runtime floor: 22.19.0), the pinned pnpm version, and frozen install inside the checkout/worktree.
|
|
20
|
+
4. Add focused regression tests before changing capability claims. Keep READMEs, deployment evidence and the Agent task map aligned.
|
|
21
|
+
5. State expected outcomes and scope; run:
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
pnpm install --frozen-lockfile
|
|
25
|
+
pnpm verify
|
|
26
|
+
pnpm pack --pack-destination artifacts
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Validate the resulting exact path with `pnpm verify:tarball -- artifacts/dsh-github-copilot-<package-version>.tgz`. The release task plan supplies that path automatically. Never run broad cleanup on an existing artifacts directory just to package again.
|
|
30
|
+
6. Inspect the complete diff, compare expected versus actual results, and report what was NOT checked. Source markers, stubbed unit tests, built module imports, upstream config fixtures, authenticated API calls, installation, and loaded UI are different evidence layers.
|
|
31
|
+
7. Commit with the issue reference and accurate attribution. For work assisted by DSH use `Assisted-by: DeepSeek Harness (DSH)`. Other agents must name the actual tool; do not infer authorship from the model vendor or copy a bot identity. Add `Co-authored-by` only for real verified collaborators. No fabricated email, author replacement or published-history rewrite.
|
|
32
|
+
8. Push the feature branch and open a PR containing `Fixes #<issue>`, verification, risks and rollback. Merge only with explicit approval and after all Windows/Linux x controlled-rc.2/rc.1/0.1.3-alpha.1/0.1.5-alpha.1/0.1.5-alpha.2/0.1.5-rc.1/0.1.5-rc.2 CI jobs pass.
|
|
33
|
+
|
|
34
|
+
Generated `lib/` output, archives, `.env`, tokens, local credentials, machine state and production screenshots with real authorization codes must not be committed. Use synthetic fixtures for screenshots and report staged UI honestly.
|
|
35
|
+
|
|
36
|
+
## Release changes
|
|
37
|
+
|
|
38
|
+
GitHub Releases and npm are the default distribution channels for every new version, superseding the Release-only decision in #43 at the user's request. The public package uses the exact same verified tarball in both channels. No automatic npm opt-out is allowed. See [npm distribution](./docs/npm-distribution.md) for initial maintainer bootstrap, OIDC, retry recovery and organizational access requirements.
|
|
39
|
+
|
|
40
|
+
Important user-requested features, behavior fixes, compatibility fixes, and security or stability fixes include release follow-through by default after authorized merge and green required CI. Do not stop at the merged PR or ask for a second release confirmation. User instructions limiting delivery to code/review or forbidding publication take precedence; documentation-only, internal-only and unrelated releases are not implicitly authorized. Follow the [important-update delivery rule](./AGENTS.md#important-update-release-delivery).
|
|
41
|
+
|
|
42
|
+
Prepare version alignment in the implementation PR. Important runtime or delivery changes fail the `release-ready` PR check unless `package.json` is strictly newer than the base and `deployment-baseline.json` plus both README install URLs agree. Retain the current prerelease channel unless promotion is requested. Docs/tests-only changes may keep the current version. Never move or reuse a tag. Local installation, sign-out and worktree checkout still need explicit approval; restarting active Sessions requires acknowledgement of the interruption.
|
|
43
|
+
|
|
44
|
+
After the release-ready PR merges, the successful main CI run calls the reusable Release workflow on that exact SHA. It creates or reconciles the annotated version tag and a draft-first Release, rebuilds and verifies the package, writes and verifies `SHA256SUMS`, checks remote asset digests, and only then publishes an immutable Release. Identical reruns reconcile safely; conflicting tags, releases or bytes fail closed. A tag created by `GITHUB_TOKEN` does not trigger a second workflow, so publication occurs in the gated main workflow rather than depending on recursive tag events. Do not hand-upload a replacement or bypass failed CI.
|
|
45
|
+
|
|
46
|
+
Release-bearing work is complete only after reporting the published Release URL and verified version/commit/assets/checksum, or clearly identifying a concrete publication blocker and pending step. A merged PR or a local tarball alone is not release delivery. After publication, independently verify the Release is not a draft, its prerelease flag, exact tag/commit, asset names and downloaded SHA-256. An install command must include the target `--profile`; never overwrite a shipped preset. Compare the installed package to the downloaded asset, then separately validate activation after restart. HTTP 200 alone does not prove the new plugin loaded.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 yms
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|