@eddyskywalker/dsh-chatgpt-subscription 0.46.1 → 0.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/README.md +22 -1
  3. package/lib/client.js +2639 -571
  4. package/lib/client.js.map +1 -1
  5. package/lib/index.js +15598 -5902
  6. package/lib/plan-mode-pipeline.js +419 -0
  7. package/lib/plan-mode.js +783 -0
  8. package/lib/tool-result-pruner.js +400 -0
  9. package/lib/types/client/hub/brand-icons.d.ts +1 -1
  10. package/lib/types/client/hub/brand-icons.d.ts.map +1 -1
  11. package/lib/types/client/hub/brand-svg.d.ts +4 -0
  12. package/lib/types/client/hub/brand-svg.d.ts.map +1 -1
  13. package/lib/types/client/hub/providers.d.ts.map +1 -1
  14. package/lib/types/client/index.d.ts +2 -0
  15. package/lib/types/client/index.d.ts.map +1 -1
  16. package/lib/types/client/locales-ru/index.d.ts.map +1 -1
  17. package/lib/types/client/locales-ru/progress-updates.d.ts.map +1 -1
  18. package/lib/types/client/locales-ru/workbuddy.d.ts +10 -0
  19. package/lib/types/client/locales-ru/workbuddy.d.ts.map +1 -0
  20. package/lib/types/client/progress-updates/locales.d.ts +23 -5
  21. package/lib/types/client/progress-updates/locales.d.ts.map +1 -1
  22. package/lib/types/client/progress-updates/settings-binding.d.ts +13 -1
  23. package/lib/types/client/progress-updates/settings-binding.d.ts.map +1 -1
  24. package/lib/types/client/progress-updates/settings-section.d.ts +1 -1
  25. package/lib/types/client/progress-updates/settings-section.d.ts.map +1 -1
  26. package/lib/types/client/workbuddy/WorkBuddyComposerQuota.d.ts +34 -0
  27. package/lib/types/client/workbuddy/WorkBuddyComposerQuota.d.ts.map +1 -0
  28. package/lib/types/client/workbuddy/WorkBuddySection.d.ts +91 -0
  29. package/lib/types/client/workbuddy/WorkBuddySection.d.ts.map +1 -0
  30. package/lib/types/client/workbuddy/locales.d.ts +768 -0
  31. package/lib/types/client/workbuddy/locales.d.ts.map +1 -0
  32. package/lib/types/client/workbuddy/styles.d.ts +21 -0
  33. package/lib/types/client/workbuddy/styles.d.ts.map +1 -0
  34. package/lib/types/client/workbuddy/useWorkBuddySection.d.ts +149 -0
  35. package/lib/types/client/workbuddy/useWorkBuddySection.d.ts.map +1 -0
  36. package/lib/types/compat.d.ts +1 -1
  37. package/lib/types/entry-plan-mode-pipeline.d.ts +206 -0
  38. package/lib/types/entry-plan-mode-pipeline.d.ts.map +1 -0
  39. package/lib/types/entry-plan-mode.d.ts +353 -0
  40. package/lib/types/entry-plan-mode.d.ts.map +1 -0
  41. package/lib/types/entry-tool-result-pruner.d.ts +255 -0
  42. package/lib/types/entry-tool-result-pruner.d.ts.map +1 -0
  43. package/lib/types/host/agent-preset.d.ts.map +1 -1
  44. package/lib/types/host/cache-warmup/contracts.d.ts +5 -1
  45. package/lib/types/host/cache-warmup/contracts.d.ts.map +1 -1
  46. package/lib/types/host/cache-warmup/install.d.ts.map +1 -1
  47. package/lib/types/host/cache-warmup/projection.d.ts.map +1 -1
  48. package/lib/types/host/cache-warmup/retrieval-intent.d.ts +18 -0
  49. package/lib/types/host/cache-warmup/retrieval-intent.d.ts.map +1 -0
  50. package/lib/types/host/cache-warmup/settings.d.ts +9 -2
  51. package/lib/types/host/cache-warmup/settings.d.ts.map +1 -1
  52. package/lib/types/host/common/capabilities.d.ts.map +1 -1
  53. package/lib/types/host/common/model-request-control.d.ts +1 -1
  54. package/lib/types/host/common/model-request-control.d.ts.map +1 -1
  55. package/lib/types/host/common/request-diagnostics.d.ts +1 -1
  56. package/lib/types/host/common/request-diagnostics.d.ts.map +1 -1
  57. package/lib/types/host/compaction-policy-guard.d.ts +58 -0
  58. package/lib/types/host/compaction-policy-guard.d.ts.map +1 -0
  59. package/lib/types/host/compaction-prompt.d.ts +129 -0
  60. package/lib/types/host/compaction-prompt.d.ts.map +1 -0
  61. package/lib/types/host/plan-mode-cache-guard.d.ts +16 -0
  62. package/lib/types/host/plan-mode-cache-guard.d.ts.map +1 -0
  63. package/lib/types/host/preset-sync.d.ts.map +1 -1
  64. package/lib/types/host/ptc-sdk-cache-guard.d.ts +80 -0
  65. package/lib/types/host/ptc-sdk-cache-guard.d.ts.map +1 -0
  66. package/lib/types/host/tool-result-pruner-guard.d.ts +34 -0
  67. package/lib/types/host/tool-result-pruner-guard.d.ts.map +1 -0
  68. package/lib/types/host/workbuddy/account-pool.d.ts +389 -0
  69. package/lib/types/host/workbuddy/account-pool.d.ts.map +1 -0
  70. package/lib/types/host/workbuddy/adapter.d.ts +249 -0
  71. package/lib/types/host/workbuddy/adapter.d.ts.map +1 -0
  72. package/lib/types/host/workbuddy/atrest.d.ts +98 -0
  73. package/lib/types/host/workbuddy/atrest.d.ts.map +1 -0
  74. package/lib/types/host/workbuddy/checkin.d.ts +150 -0
  75. package/lib/types/host/workbuddy/checkin.d.ts.map +1 -0
  76. package/lib/types/host/workbuddy/client.d.ts +214 -0
  77. package/lib/types/host/workbuddy/client.d.ts.map +1 -0
  78. package/lib/types/host/workbuddy/dsml.d.ts +55 -0
  79. package/lib/types/host/workbuddy/dsml.d.ts.map +1 -0
  80. package/lib/types/host/workbuddy/guardrails.d.ts +111 -0
  81. package/lib/types/host/workbuddy/guardrails.d.ts.map +1 -0
  82. package/lib/types/host/workbuddy/identity.d.ts +71 -0
  83. package/lib/types/host/workbuddy/identity.d.ts.map +1 -0
  84. package/lib/types/host/workbuddy/mapper.d.ts +238 -0
  85. package/lib/types/host/workbuddy/mapper.d.ts.map +1 -0
  86. package/lib/types/host/workbuddy/model-catalog.d.ts +217 -0
  87. package/lib/types/host/workbuddy/model-catalog.d.ts.map +1 -0
  88. package/lib/types/host/workbuddy/oauth.d.ts +47 -0
  89. package/lib/types/host/workbuddy/oauth.d.ts.map +1 -0
  90. package/lib/types/host/workbuddy/outbound-identity.d.ts +139 -0
  91. package/lib/types/host/workbuddy/outbound-identity.d.ts.map +1 -0
  92. package/lib/types/host/workbuddy/routes.d.ts +56 -0
  93. package/lib/types/host/workbuddy/routes.d.ts.map +1 -0
  94. package/lib/types/host/workbuddy/token-store.d.ts +370 -0
  95. package/lib/types/host/workbuddy/token-store.d.ts.map +1 -0
  96. package/lib/types/host/workbuddy/types.d.ts +179 -0
  97. package/lib/types/host/workbuddy/types.d.ts.map +1 -0
  98. package/lib/types/index.d.ts +35 -0
  99. package/lib/types/index.d.ts.map +1 -1
  100. package/lib/types/shared/workbuddy-contracts.d.ts +531 -0
  101. package/lib/types/shared/workbuddy-contracts.d.ts.map +1 -0
  102. package/package.json +14 -2
  103. package/presets/dispatch/README.md +57 -3
  104. package/presets/dispatch/agent.cordis.yml +63 -3
@@ -0,0 +1,139 @@
1
+ /**
2
+ * Outbound client identities this route can present.
3
+ *
4
+ * The subscription gateway gates on client identity, and it gates DIFFERENTLY
5
+ * per surface: measured on this route, `CodeBuddyIDE` is rejected by
6
+ * `/v3/config` with 400 `code 12403` ("check ua") and 401'd outright by the
7
+ * international chat endpoint, which is why the CLI identity is what the line
8
+ * ships and has always used.
9
+ *
10
+ * Two more identities exist on the same backend. Both were captured by sibling
11
+ * gateways that reverse-engineered the real clients' requests; this file's
12
+ * version block below names the exact source of every string it sends.
13
+ *
14
+ * desktop `WorkBuddy/<app> <appName>/<app> CLI/<cli>`, where `<app>` is
15
+ * the desktop build, `<appName>` is `WorkBuddy` (domestic) or
16
+ * `workbuddy-ai` (international) and `<cli>` is the CLI bundled
17
+ * inside that build
18
+ * + `X-IDE-Type/Name: WorkBuddy`, `X-IDE-Version`, `X-Agent-Intent: craft`
19
+ * + `X-Agent-Purpose: conversation`, `X-Agent-Type: main`,
20
+ * + `X-Agent-Runtime: local-agent` (the 5.9 client names where the
21
+ * agent runs; the header is absent in 5.8), trace headers
22
+ * vscode `VSCode/<ide> WorkBuddy/<product>`
23
+ * + `X-IDE-Type/Name: VSCode`, `X-IDE-Version`, `X-Product-Version`, `X-Env-ID`
24
+ * cli `CLI/2.63.2 CodeBuddy/2.63.2` + no overrides
25
+ *
26
+ * The `cli` literal is kept byte-identical to what this line has always sent,
27
+ * but it is NO LONGER the default: upstream now refuses any agent that is not a
28
+ * `WorkBuddy/<version>` one with error 10085, which is exactly what a bare
29
+ * `CLI/...` agent is. `DEFAULT_OUTBOUND_SETTING` therefore names `workbuddy`,
30
+ * and {@link migrateOutboundSettingDocument} moves a stored pre-marker document
31
+ * across without overriding a choice the user has since made.
32
+ *
33
+ * Quota is NOT per identity: the subscription meters an account × model over a
34
+ * 24h window (429 `code 6004`), so switching identity cannot create allowance.
35
+ * What it can do is give each account a stable, plausible client — the same
36
+ * reason the gateway projects one device per account.
37
+ */
38
+ import type { WorkBuddyOutboundProduct, WorkBuddyOutboundSetting } from '../../shared/workbuddy-contracts.ts';
39
+ export type { WorkBuddyOutboundProduct, WorkBuddyOutboundSetting };
40
+ /** Everything the settings card may offer, in display order. */
41
+ export declare const OUTBOUND_PRODUCTS: readonly WorkBuddyOutboundProduct[];
42
+ /**
43
+ * Shipped default: the desktop identity.
44
+ *
45
+ * It used to be `cli`, because that literal is what this line measured working
46
+ * first. That is no longer true — upstream refuses any agent that is not a
47
+ * `WorkBuddy/<version>` one with error 10085, and a bare `CLI/...` agent is
48
+ * exactly such a request (see the version block below, which cites the source
49
+ * of both facts). The desktop identity is the shipped one because it is the
50
+ * identity that presents a `WorkBuddy/<version>` agent.
51
+ *
52
+ * A document written while `cli` was the default is moved across ONCE by
53
+ * {@link migrateOutboundSettingDocument}; a choice made after that is never
54
+ * revisited.
55
+ */
56
+ export declare const DEFAULT_OUTBOUND_SETTING: WorkBuddyOutboundProduct;
57
+ /** Narrow a stored or patched value into a supported preference. */
58
+ export declare function normalizeOutboundSetting(value: unknown): WorkBuddyOutboundSetting;
59
+ /**
60
+ * Which identity one account uses.
61
+ *
62
+ * `auto` assigns by hashing the account key, so an account keeps the same
63
+ * client for its whole life — the one property that matters for a device
64
+ * fingerprint — while a pool as a whole spreads over the available clients.
65
+ */
66
+ export declare function resolveOutboundProduct(setting: WorkBuddyOutboundSetting, accountKey: string): WorkBuddyOutboundProduct;
67
+ /**
68
+ * A stable pseudo-device id for one account.
69
+ *
70
+ * Same derivation as the measured clients (`derive_id`: md5 of `salt:uid`
71
+ * reshaped into a UUID), so the value is a well-formed v4-shaped machine id
72
+ * that never changes for an account and never collides between accounts. A
73
+ * per-PROCESS id would be worse than none here: it would present every account
74
+ * in the pool as the same machine.
75
+ */
76
+ export declare function deriveMachineId(uid: string): string;
77
+ /** Identity-specific headers and user agent for one request. */
78
+ export interface OutboundIdentity {
79
+ product: WorkBuddyOutboundProduct;
80
+ userAgent: string;
81
+ /** Extra or overriding headers; `conversation` supplies the ids already minted. */
82
+ headers(conversation: Readonly<Record<string, string>>): Record<string, string>;
83
+ }
84
+ /** Resolve the identity block for one product on one region. */
85
+ export declare function outboundIdentity(product: WorkBuddyOutboundProduct, region: 'cn' | 'intl', uid: string): OutboundIdentity;
86
+ /**
87
+ * Version of the outbound-identity semantics one settings document carries.
88
+ *
89
+ * 1 (never written as a number) = the era whose shipped default was `cli`. That
90
+ * era wrote `cli` into a document as soon as it normalised an unset
91
+ * preference, so a stored `cli` from it cannot be told apart from "untouched".
92
+ * 2 = the desktop default.
93
+ *
94
+ * A document with no marker is version 1 — that direction is load-bearing. A
95
+ * register-backed scope whose schema defaulted the marker to the CURRENT version
96
+ * would declare every stale document already migrated, which is the same
97
+ * upgrade-breaks-everyone bug reached through the other storage path.
98
+ */
99
+ export declare const OUTBOUND_IDENTITY_VERSION = 2;
100
+ /** What an absent marker means. Deliberately not the current version. */
101
+ export declare const LEGACY_OUTBOUND_IDENTITY_VERSION = 1;
102
+ /** One stored preference, as {@link migrateOutboundSettingDocument} reads it. */
103
+ export interface OutboundSettingDocument {
104
+ /** The stored preference, in whatever shape the document holds it. */
105
+ outboundIdentity?: unknown;
106
+ /** The marker; absent on a pre-marker document. */
107
+ outboundIdentityVersion?: unknown;
108
+ }
109
+ /** What a caller must use, and whether it must write the document back. */
110
+ export interface MigratedOutboundSetting {
111
+ /** The identity this host is to present. */
112
+ outboundIdentity: WorkBuddyOutboundSetting;
113
+ /** Marker the document carries after this read. */
114
+ outboundIdentityVersion: number;
115
+ /** Whether the caller must persist the document (marker and/or new value). */
116
+ migrated: boolean;
117
+ }
118
+ /**
119
+ * Read one stored outbound preference, migrating the pre-marker default once.
120
+ *
121
+ * The rule, and the reason for each half:
122
+ *
123
+ * - `marker >= 2`: this document has been through the migration. Whatever it
124
+ * holds is a choice now — `cli` included, which a deployment may pin on
125
+ * purpose — so the value is returned untouched and nothing is written.
126
+ * - no marker and a stored `cli`: the era's default, indistinguishable from a
127
+ * deliberate one, and a value upstream now refuses (10085). It becomes
128
+ * {@link DEFAULT_OUTBOUND_SETTING} and the marker is stamped. The stamp is
129
+ * what makes this idempotent AND what stops a genuine `cli` pinned AFTER the
130
+ * migration from being flipped on the next read.
131
+ * - no marker and any other value (`auto`/`workbuddy`/`vscode`): a real user
132
+ * setting, kept as-is; only the marker is stamped, so a later upgrade never
133
+ * re-decides it.
134
+ *
135
+ * An unparseable stored value normalises to the shipped default, exactly as an
136
+ * absent one does, and is stamped: garbage is not a preference.
137
+ */
138
+ export declare function migrateOutboundSettingDocument(document: OutboundSettingDocument): MigratedOutboundSetting;
139
+ //# sourceMappingURL=outbound-identity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outbound-identity.d.ts","sourceRoot":"","sources":["../../../../src/host/workbuddy/outbound-identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAGH,OAAO,KAAK,EACV,wBAAwB,EACxB,wBAAwB,EACzB,MAAM,qCAAqC,CAAA;AAE5C,YAAY,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,CAAA;AAElE,gEAAgE;AAChE,eAAO,MAAM,iBAAiB,EAAE,SAAS,wBAAwB,EAAmC,CAAA;AAEpG;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,wBAAwB,EAAE,w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AAE,uBAAuB,GAChC,uBAAuB,CAqBzB"}
@@ -0,0 +1,56 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ import { DEFAULT_CONTEXT_WINDOW, PROVIDER_ID, PROVIDER_NAME } from './types.ts';
3
+ import { FileCredentialStore, FileModelSettingsStore, type WorkBuddyAtRestKeyStore, type WorkBuddyPreferenceStore } from './token-store.ts';
4
+ import { getCachedQuota } from './client.ts';
5
+ import { type WorkBuddyModelEntry } from './model-catalog.ts';
6
+ import type { WorkBuddyModelOption, WorkBuddyWebStatus } from '../../shared/workbuddy-contracts.ts';
7
+ import type { WorkBuddyCheckinService } from './checkin.ts';
8
+ import type { WorkBuddyAccountPool } from './account-pool.ts';
9
+ /**
10
+ * The selection the card should show.
11
+ *
12
+ * A stored list that still equals the shipped default has never been edited, so
13
+ * it cannot know about models the catalog has since added; treating it as
14
+ * "everything this account can call" keeps a first run from hiding models
15
+ * behind an unedited default. Any explicit edit is honoured exactly.
16
+ */
17
+ export declare function resolveEnabledModelIds(stored: readonly string[], available: readonly string[], enabled?: boolean): string[];
18
+ /**
19
+ * Build the model options the settings card renders.
20
+ *
21
+ * Order comes from the caller, which passes a vendor-grouped list so a family
22
+ * is not interleaved with the next one; this preserves whatever order it is
23
+ * given rather than imposing a second one.
24
+ *
25
+ * `credits` is passed through whole, every region the entry carries. Trimming
26
+ * it to one account's region is tempting and wrong: this DTO is also read with
27
+ * no account in hand (the harness resolves a model list before a credential is
28
+ * chosen), and such a caller would be told nothing rather than everything. The
29
+ * region key the reader actually has is already on each entry as `regions`, so
30
+ * picking a value is the renderer's job, not this one's.
31
+ */
32
+ export declare function buildModelOptions(catalog: readonly WorkBuddyModelEntry[], available: readonly string[], enabledModelIds: readonly string[], overrides: Record<string, number>): WorkBuddyModelOption[];
33
+ export interface WorkBuddyStatusOptions {
34
+ fetchFn?: typeof fetch;
35
+ /** Whether this plugin currently owns the provider route; re-read on every status. */
36
+ serving?: boolean | (() => boolean);
37
+ /** Diagnostic when another plugin owns the provider route; re-read on every status. */
38
+ conflict?: string | null | (() => string | null);
39
+ /** Multi-account pool this line schedules through; absent keeps the single-account card. */
40
+ accountPool?: WorkBuddyAccountPool;
41
+ /** Daily check-in scheduler; absent leaves the card's check-in row empty. */
42
+ checkin?: Pick<WorkBuddyCheckinService, 'tick' | 'summary'>;
43
+ /**
44
+ * Storage for the `$wbEncrypted` at-rest key.
45
+ *
46
+ * Absent hides the whole control: without it a pasted key could not be
47
+ * remembered, and offering the field anyway would lose it on restart.
48
+ */
49
+ atRestKey?: Pick<WorkBuddyAtRestKeyStore, 'adopt' | 'clear' | 'load' | 'path'>;
50
+ }
51
+ /** Everything the settings card renders: account, quota, and the model catalog. */
52
+ export declare function getWorkBuddyWebStatus(store: FileCredentialStore, modelSettings: FileModelSettingsStore, preferences?: WorkBuddyPreferenceStore, options?: WorkBuddyStatusOptions): Promise<WorkBuddyWebStatus>;
53
+ /** Register the WorkBuddy settings routes under `/workbuddy/api`. */
54
+ export declare function registerWorkBuddyRoutes(ctx: Context, store: FileCredentialStore, modelSettings: FileModelSettingsStore, preferences?: WorkBuddyPreferenceStore, options?: WorkBuddyStatusOptions): () => void;
55
+ export { PROVIDER_ID, PROVIDER_NAME, DEFAULT_CONTEXT_WINDOW, getCachedQuota, type WorkBuddyModelOption, type WorkBuddyWebStatus, };
56
+ //# sourceMappingURL=routes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../../../src/host/workbuddy/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAIlD,OAAO,EAGL,sBAAsB,EACtB,WAAW,EACX,aAAa,EAEd,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EAGtB,KAAK,uBAAuB,EAE5B,KAAK,wBAAwB,EAC9B,MAAM,kBAAkB,CAAA;AAIzB,OAAO,EAKL,cAAc,EAKf,MAAM,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,CACzC,KAAK,EAAE,mBAAmB,EAC1B,aAAa,EAAE,sBAAsB,EACrC,WAAW,CAAC,EAAE,wBAAwB,EACtC,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,kBAAkB,CAAC,CAuF7B;AAED,qEAAqE;AACrE,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,mBAAmB,EAC1B,aAAa,EAAE,sBAAsB,EACrC,WAAW,CAAC,EAAE,wBAAwB,EACtC,OAAO,GAAE,sBAA2B,GACnC,MAAM,IAAI,CAkbZ;AAED,OAAO,EACL,WAAW,EACX,aAAa,EACb,sBAAsB,EACtB,cAAc,EACd,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,GACxB,CAAA"}
@@ -0,0 +1,370 @@
1
+ import type { WorkBuddyCheckinSettings, WorkBuddyReasoningEffort, WorkBuddyRegion } from '../../shared/workbuddy-contracts.ts';
2
+ import { type ContextWindowOverridePatch } from '../common/context-window-overrides.ts';
3
+ import { type WorkBuddyGuardrails } from './guardrails.ts';
4
+ import { type WorkBuddyOutboundSetting } from './outbound-identity.ts';
5
+ import type { CredentialStore } from '../token-store.ts';
6
+ import { isIntlDomain } from './types.ts';
7
+ export declare const WORKBUDDY_PREFERENCES_NAMESPACE = "dsh-workbuddy";
8
+ export type { WorkBuddyReasoningEffort };
9
+ /**
10
+ * One WorkBuddy credential, parsed from a CodeBuddy desktop `*.info` file.
11
+ *
12
+ * These files are the IDE's own credential store, not this plugin's: the plugin
13
+ * reads them so a user who is already signed in to the IDE needs no second
14
+ * login. A refreshed token is written back so both clients stay valid instead of
15
+ * racing each other with a rotating refresh token.
16
+ */
17
+ export interface WorkBuddyCredentials {
18
+ /** Bearer token for the chat and billing APIs. Host-only. */
19
+ accessToken: string;
20
+ /** Rotating refresh token. Host-only. */
21
+ refreshToken: string;
22
+ /** Unix milliseconds the access token stops being valid. */
23
+ expiresAt: number;
24
+ /** Region the account belongs to; decides which backend serves it. */
25
+ region: WorkBuddyRegion;
26
+ /** Auth domain recorded in the file, e.g. `copilot.tencent.com`. */
27
+ domain: string;
28
+ /** Backend base URL derived from {@link domain}. */
29
+ backend: string;
30
+ uid?: string;
31
+ nickname?: string;
32
+ uin?: string;
33
+ accountType?: string;
34
+ enterpriseId?: string;
35
+ /** Absolute path of the `*.info` file this credential came from. */
36
+ sourceFile: string;
37
+ /** File modification time when it was read, so a stale cache is detectable. */
38
+ sourceMtimeMs: number;
39
+ /** Which store owns the secret; only managed credentials may be deleted. */
40
+ source: 'desktop' | 'managed';
41
+ /**
42
+ * Sealed token material, when the file holds `$wbEncrypted` envelopes.
43
+ *
44
+ * The desktop client stopped writing plaintext tokens on 2026-09-24, so a
45
+ * credential read from such a file has no usable `accessToken` until the
46
+ * at-rest key opens these. They are kept verbatim here — never logged, never
47
+ * sent anywhere — and resolved by {@link unsealCredentials}.
48
+ */
49
+ sealed?: {
50
+ accessToken?: unknown;
51
+ refreshToken?: unknown;
52
+ };
53
+ }
54
+ export interface WorkBuddyModelSettings {
55
+ enabled?: boolean;
56
+ enabledModelIds: string[];
57
+ contextWindowOverrides: Record<string, number>;
58
+ defaultReasoningEffort: WorkBuddyReasoningEffort | null;
59
+ /** Stable account key selected by the user; null keeps automatic selection. */
60
+ selectedAccountId: string | null;
61
+ /** Desktop accounts hidden from this plugin without deleting CodeBuddy files. */
62
+ hiddenAccountIds: string[];
63
+ /** Daily check-in scheduler preferences. */
64
+ checkin: WorkBuddyCheckinSettings;
65
+ /**
66
+ * Which outbound client identity requests present.
67
+ *
68
+ * `auto` assigns one product per account (stable for the account's life);
69
+ * anything else pins it line-wide.
70
+ */
71
+ outboundIdentity: WorkBuddyOutboundSetting;
72
+ /**
73
+ * Which `outboundIdentity` semantics this document was written under.
74
+ *
75
+ * Read, never guessed: a document without it predates the desktop default and
76
+ * is migrated once by {@link migrateOutboundSettingDocument}. Writing the
77
+ * marker is what makes that migration idempotent and what stops a later
78
+ * explicit `cli` from being moved again.
79
+ */
80
+ outboundIdentityVersion: number;
81
+ /** Local quota guardrails; all-off by default. */
82
+ guardrails: WorkBuddyGuardrails;
83
+ }
84
+ export interface WorkBuddyPreferenceStore {
85
+ /**
86
+ * Resolve once the store has read whatever it was going to read.
87
+ *
88
+ * The file-backed store warms up asynchronously, so `status()` answers from
89
+ * shipped defaults until that read settles. A caller that acts on a
90
+ * preference at startup — the check-in scheduler signing in on boot — must
91
+ * await this first, or it acts on the default instead of the user's choice.
92
+ * A register-backed store reads synchronously and resolves immediately.
93
+ */
94
+ ready(): Promise<void>;
95
+ status(): WorkBuddyModelSettings;
96
+ update(patch: {
97
+ enabled?: boolean;
98
+ enabledModelIds?: string[];
99
+ /** `null` deletes one override and falls back to the catalog default. */
100
+ contextWindowOverrides?: ContextWindowOverridePatch;
101
+ defaultReasoningEffort?: WorkBuddyReasoningEffort | null;
102
+ selectedAccountId?: string | null;
103
+ hiddenAccountIds?: string[];
104
+ checkin?: Partial<WorkBuddyCheckinSettings>;
105
+ outboundIdentity?: WorkBuddyOutboundSetting;
106
+ guardrails?: Partial<WorkBuddyGuardrails>;
107
+ }): Promise<WorkBuddyModelSettings>;
108
+ }
109
+ /** Shipped check-in default: on. */
110
+ export declare const DEFAULT_CHECKIN_SETTINGS: WorkBuddyCheckinSettings;
111
+ /**
112
+ * Narrow an unknown stored/patched value into valid check-in settings.
113
+ *
114
+ * Documents written while the window was still configurable may carry
115
+ * startHour/endHour; those keys are inert now and dropped on the next write.
116
+ */
117
+ export declare function normalizeCheckinSettings(value: unknown): WorkBuddyCheckinSettings;
118
+ /**
119
+ * Bind the model selection to the DSH settings document when the harness still
120
+ * offers one, and to the JSON file beside it otherwise: a harness without the
121
+ * register seam (0.1.7, and a headless test) reads that file back on boot.
122
+ */
123
+ export declare function registerWorkBuddyPreferenceStore(settings?: unknown, fallbackStore?: FileModelSettingsStore): WorkBuddyPreferenceStore;
124
+ /**
125
+ * Credential directory the CodeBuddy desktop client writes to.
126
+ *
127
+ * `CODEBUDDY_AUTH_DIR` overrides it, matching the environment variable the
128
+ * official tooling honours, which is also what makes the scan testable without
129
+ * touching a real profile.
130
+ */
131
+ export declare function codeBuddyAuthDir(): string;
132
+ /** Plugin settings file, used when no settings service is present. */
133
+ export declare function modelSettingsPath(): string;
134
+ /** Encrypted account pool for credentials added through this plugin. */
135
+ export declare function managedCredentialsPath(): string;
136
+ /** Platform-encrypted storage for the pasted at-rest key (never plaintext on disk). */
137
+ export declare function atRestKeyPath(): string;
138
+ /**
139
+ * Storage for the `$wbEncrypted` protector key.
140
+ *
141
+ * The key is the one secret that unlocks the desktop client's tokens, so it goes
142
+ * through the same platform store the managed pool uses (DPAPI / Keychain /
143
+ * Secret Service) and is installed into the process only after the client's own
144
+ * keyblob accepts it. A pasted value that fails that check never displaces a
145
+ * working key.
146
+ */
147
+ export declare class WorkBuddyAtRestKeyStore {
148
+ private readonly filePath;
149
+ private readonly backend;
150
+ private cached;
151
+ constructor(filePath?: string, backend?: CredentialStore<{
152
+ version: 1;
153
+ keyHex: string;
154
+ }>);
155
+ /** Human-readable storage description, mirroring the managed pool's. */
156
+ path(): string;
157
+ /**
158
+ * Load the stored key into the process.
159
+ *
160
+ * Called once at startup: the credential readers consult the module-level
161
+ * slot, so a key that is only on disk would otherwise leave every sealed
162
+ * account unreadable until something else triggered a load.
163
+ */
164
+ load(): Promise<Buffer | null>;
165
+ /** Validate and persist a pasted secret; returns the key id for display. */
166
+ adopt(text: string): Promise<string>;
167
+ /** Forget the key, both on disk and in this process. */
168
+ clear(): Promise<void>;
169
+ }
170
+ /**
171
+ * Parse one CodeBuddy `*.info` payload.
172
+ *
173
+ * Only the fields this plugin needs are read; the file also carries the IDE's
174
+ * own account bookkeeping, which is deliberately left untouched. A file without
175
+ * a usable access token is rejected rather than half-accepted, so the scanner
176
+ * can move on to the next candidate.
177
+ */
178
+ export declare function parseCredentialFile(value: unknown, sourceFile: string, sourceMtimeMs?: number): WorkBuddyCredentials;
179
+ /** Whether a credential is at or near expiry; refreshed a minute early. */
180
+ export declare function isExpired(credentials: WorkBuddyCredentials, now?: number): boolean;
181
+ /**
182
+ * Stable public key for selecting an account without exposing a token or tying
183
+ * the preference to a timestamped snapshot filename.
184
+ *
185
+ * The chain is uid → uin → nickname → domain, and the reason it is safe is
186
+ * **ordering**: {@link withResolvedIdentity} settles a credential's uid from
187
+ * its own token before any id is derived, so a real sign-in and the IDE's file
188
+ * for the same account both reach the uid branch and agree. The nickname rung
189
+ * is only reached by a token whose claims cannot be read at all, and keeping it
190
+ * there is what stops two such accounts in one region from collapsing onto the
191
+ * shared deployment key below it.
192
+ *
193
+ * A nickname must therefore never be the *first* rung: that is what split one
194
+ * account into two pool rows, because the browser-login response states the
195
+ * display name while the IDE's file states the uid. Likewise the uid must be
196
+ * settled *before* the id is minted, which is why the heal runs inside the
197
+ * credential parsers and the pool's own account creation.
198
+ */
199
+ export declare function workBuddyAccountId(credentials: Pick<WorkBuddyCredentials, 'region' | 'uid' | 'uin' | 'nickname' | 'domain'>): string;
200
+ /**
201
+ * Every key one credential may have been addressable under.
202
+ *
203
+ * A settings document written before the identity fix pinned and hid accounts
204
+ * by the old chain (`uid → uin → nickname → domain`), so an account that only
205
+ * had a nickname stored was addressed as `region:<nickname>`. The heal moves
206
+ * that account to its uid, and without this alias the stored pointer would
207
+ * silently stop matching — a pinned account would fall back to automatic
208
+ * routing and a hidden one would reappear. Callers therefore accept either
209
+ * spelling; only the current one is ever written.
210
+ */
211
+ export declare function workBuddyAccountIdAliases(credentials: Pick<WorkBuddyCredentials, 'region' | 'uid' | 'uin' | 'nickname' | 'domain'>): string[];
212
+ /** Strict parser for credentials owned by the plugin's encrypted pool. */
213
+ export declare function parseManagedCredentials(value: unknown): WorkBuddyCredentials[];
214
+ /**
215
+ * Candidate ordering for the scanned credential files.
216
+ *
217
+ * A user's auth directory accumulates timestamped snapshots beside the live
218
+ * file, and the live one is not always the newest. Preference order is: the
219
+ * plain `workbuddy-desktop.info` / `codebuddy-desktop.info` files first, then
220
+ * the newest `expiresAt` among the timestamped snapshots. Picking purely by
221
+ * mtime selected a stale snapshot during development, so the token's own
222
+ * expiry is what decides.
223
+ */
224
+ /** What the last credential scan observed about sealed (`$wbEncrypted`) files. */
225
+ export interface SealedCredentialDiagnostics {
226
+ /** Sealed credential files the scan met. */
227
+ sealedFiles: number;
228
+ /** Of those, how many the held key opened. */
229
+ opened: number;
230
+ /** True when at least one sealed file was skipped because no key is held. */
231
+ missingKey: boolean;
232
+ /** Why the last sealed file refused to open, when it did. */
233
+ lastError: string | null;
234
+ }
235
+ /** Snapshot of the last scan's sealed-credential observations. */
236
+ export declare function sealedCredentialDiagnostics(): SealedCredentialDiagnostics;
237
+ /**
238
+ * Resolve a credential's sealed tokens into usable plaintext.
239
+ *
240
+ * Returns `null` when the credential is sealed and this process holds no key
241
+ * that opens it: such a file is not an error the caller can act on per-file, it
242
+ * is a missing key the settings card reports once.
243
+ */
244
+ export declare function unsealCredentials<T extends WorkBuddyCredentials>(credentials: T): T | null;
245
+ /**
246
+ * Scan the CodeBuddy auth directory for usable credentials.
247
+ *
248
+ * Every `*.info` file is considered; unreadable or malformed ones are skipped
249
+ * rather than failing the whole scan, because the directory routinely holds
250
+ * expired snapshots next to the live credential.
251
+ */
252
+ export declare function scanCredentials(dir?: string): Promise<WorkBuddyCredentials[]>;
253
+ /** Encrypted credentials added through the WorkBuddy settings page. */
254
+ export declare class ManagedCredentialStore {
255
+ private readonly filePath;
256
+ private readonly backend;
257
+ constructor(filePath?: string, backend?: CredentialStore<{
258
+ version: 1;
259
+ accounts: WorkBuddyCredentials[];
260
+ }>);
261
+ path(): string;
262
+ private serialize;
263
+ list(): Promise<WorkBuddyCredentials[]>;
264
+ add(credentials: WorkBuddyCredentials): Promise<void>;
265
+ update(credentials: WorkBuddyCredentials): Promise<void>;
266
+ delete(accountId: string): Promise<boolean>;
267
+ }
268
+ /**
269
+ * Credential store backed by the CodeBuddy desktop client's own auth files.
270
+ *
271
+ * The plugin does not own these files, so there is nothing to encrypt here: the
272
+ * secret is the IDE's, already on disk, and the only write this store performs
273
+ * is an atomic write-back of a refreshed token so the IDE does not lose its
274
+ * session. Tokens are never sent to a browser.
275
+ */
276
+ export declare class FileCredentialStore {
277
+ private readonly dir;
278
+ /** How long a scan result is reused before the directory is re-read. */
279
+ private readonly cacheTtlMs;
280
+ private readonly managed;
281
+ private cached;
282
+ private scannedAt;
283
+ /** Serializes refresh/write-back per account; different accounts never share a token. */
284
+ private readonly refreshInFlight;
285
+ constructor(dir?: string,
286
+ /** How long a scan result is reused before the directory is re-read. */
287
+ cacheTtlMs?: number, managed?: ManagedCredentialStore);
288
+ /** Directory this store scans. */
289
+ directory(): string;
290
+ /** Human-readable storage description for the settings card. */
291
+ path(): string;
292
+ managedPath(): string;
293
+ /** Read the selected credential, or the best visible candidate in automatic mode. */
294
+ read(options?: {
295
+ force?: boolean;
296
+ accountId?: string | null;
297
+ hiddenAccountIds?: readonly string[];
298
+ }): Promise<WorkBuddyCredentials | null>;
299
+ /** Whether a cached credential's source file is unchanged on disk. */
300
+ private isStillCurrent;
301
+ /**
302
+ * All distinct usable accounts, best credential first.
303
+ *
304
+ * The desktop directory keeps historical snapshots. They are credentials for
305
+ * the same account, not additional account choices, so only the first (best)
306
+ * candidate for each stable account id is exposed.
307
+ */
308
+ list(): Promise<WorkBuddyCredentials[]>;
309
+ /**
310
+ * Desktop credentials only, best first.
311
+ *
312
+ * The account pool adopts these so the IDE's own sign-ins take part in
313
+ * scheduling. Unlike {@link list} this never mixes in managed accounts:
314
+ * only the desktop set is re-adopted when the IDE changes its directory.
315
+ */
316
+ discoverDesktopCredentials(): Promise<WorkBuddyCredentials[]>;
317
+ /**
318
+ * Re-read one desktop credential file.
319
+ *
320
+ * A pooled desktop account must serve the IDE's current token rather than
321
+ * the copy taken when it was adopted, because the IDE rotates that token on
322
+ * its own schedule. Returns null when the file is gone or unreadable.
323
+ */
324
+ readDesktopFile(filePath: string): Promise<WorkBuddyCredentials | null>;
325
+ addManaged(credentials: WorkBuddyCredentials): Promise<void>;
326
+ deleteManaged(accountId: string): Promise<boolean>;
327
+ /** Forget the cached scan; the next read re-reads the directory. */
328
+ invalidate(): void;
329
+ /**
330
+ * Return a credential whose access token is valid, refreshing it first when
331
+ * it is at or near expiry.
332
+ *
333
+ * Concurrent callers share one refresh: the refresh token rotates, so two
334
+ * simultaneous refreshes would invalidate each other.
335
+ */
336
+ ensureFresh(credentials: WorkBuddyCredentials, refresh: (current: WorkBuddyCredentials) => Promise<WorkBuddyCredentials>): Promise<WorkBuddyCredentials>;
337
+ /** Renew after an upstream 401, even when the local expiry still looks valid. */
338
+ renew(credentials: WorkBuddyCredentials, refresh: (current: WorkBuddyCredentials) => Promise<WorkBuddyCredentials>): Promise<WorkBuddyCredentials>;
339
+ /**
340
+ * Persist a refreshed token back into the IDE's own credential file.
341
+ *
342
+ * Only the `auth` block is rewritten, and the write is atomic so a crash
343
+ * cannot leave the IDE with a half-written file. A failure here is not fatal
344
+ * to the in-flight request: the refreshed token still works for this process,
345
+ * and the next scan simply finds the older token on disk.
346
+ */
347
+ writeBack(credentials: WorkBuddyCredentials): Promise<void>;
348
+ }
349
+ /** Plain-JSON model settings used when the settings service is unavailable. */
350
+ export declare class FileModelSettingsStore {
351
+ private readonly filePath;
352
+ constructor(filePath?: string);
353
+ path(): string;
354
+ read(): Promise<WorkBuddyModelSettings>;
355
+ write(settings: WorkBuddyModelSettings): Promise<void>;
356
+ updateSettings(patch: {
357
+ enabled?: boolean;
358
+ enabledModelIds?: string[];
359
+ /** `null` deletes one override and falls back to the catalog default. */
360
+ contextWindowOverrides?: ContextWindowOverridePatch;
361
+ defaultReasoningEffort?: WorkBuddyReasoningEffort | null;
362
+ selectedAccountId?: string | null;
363
+ hiddenAccountIds?: string[];
364
+ checkin?: Partial<WorkBuddyCheckinSettings>;
365
+ outboundIdentity?: WorkBuddyOutboundSetting;
366
+ guardrails?: Partial<WorkBuddyGuardrails>;
367
+ }): Promise<WorkBuddyModelSettings>;
368
+ }
369
+ export { isIntlDomain };
370
+ //# sourceMappingURL=token-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token-store.d.ts","sourceRoot":"","sources":["../../../../src/host/workbuddy/token-store.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAA;AAI9H,OAAO,EAA+B,KAAK,0BAA0B,EAAE,MAAM,uCAAuC,CAAA;AAGpH,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAML,KAAK,wBAAwB,EAC9B,MAAM,wBAAwB,CAAA;AAW/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAIxD,OAAO,EAGL,YAAY,EAEb,MAAM,YAAY,CAAA;AAEnB,eAAO,MAAM,+BAA+B,kBAAkB,CAAA;AAE9D,YAAY,EAAE,wBAAwB,EAAE,CAAA;AAOxC;;;;;;;GAOG;AACH,MAAM,WAAW,oBAAoB;IACnC,6DAA6D;IAC7D,WAAW,EAAE,MAAM,CAAA;IACnB,yCAAyC;IACzC,YAAY,EAAE,MAAM,CAAA;IACpB,4DAA4D;IAC5D,SAAS,EAAE,MAAM,CAAA;IACjB,sEAAsE;IACtE,MAAM,EAAE,eAAe,CAAA;IACvB,oEAAoE;IACpE,MAAM,EAAE,MAAM,CAAA;IACd,oDAAoD;IACpD,OAAO,EAAE,MAAM,CAAA;IACf,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,oEAAoE;IACpE,UAAU,EAAE,MAAM,CAAA;IAClB,+EAA+E;IAC/E,aAAa,EAAE,MAAM,CAAA;IACrB,4EAA4E;IAC5E,MAAM,EAAE,SAAS,GAAG,SAAS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