@skrr-ai/cli 0.1.42 → 0.1.44

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 (120) hide show
  1. package/dist/base-command.d.ts +2 -0
  2. package/dist/base-command.js +1 -0
  3. package/dist/commands/balance/index.js +1 -1
  4. package/dist/commands/balance/overage.js +4 -3
  5. package/dist/commands/balance/plan.js +10 -6
  6. package/dist/commands/balance/show.d.ts +32 -0
  7. package/dist/commands/balance/show.js +74 -3
  8. package/dist/commands/balance/usage/events.js +3 -2
  9. package/dist/commands/balance/usage.js +2 -1
  10. package/dist/commands/browser/install.js +3 -2
  11. package/dist/commands/browser/uninstall.js +3 -2
  12. package/dist/commands/code/handover.d.ts +1 -0
  13. package/dist/commands/code/handover.js +4 -0
  14. package/dist/commands/code/install.js +3 -2
  15. package/dist/commands/code/jobs/run.d.ts +1 -0
  16. package/dist/commands/code/jobs/run.js +4 -0
  17. package/dist/commands/daemon/install.js +7 -0
  18. package/dist/commands/harnesses/install.d.ts +11 -0
  19. package/dist/commands/harnesses/install.js +33 -14
  20. package/dist/commands/harnesses/installers.d.ts +10 -0
  21. package/dist/commands/harnesses/installers.js +31 -0
  22. package/dist/commands/harnesses/leases/show.js +14 -0
  23. package/dist/commands/harnesses/list.js +3 -2
  24. package/dist/commands/instructions/install.d.ts +22 -0
  25. package/dist/commands/instructions/install.js +83 -7
  26. package/dist/commands/instructions/list.js +5 -0
  27. package/dist/commands/instructions/show.d.ts +6 -0
  28. package/dist/commands/instructions/show.js +34 -1
  29. package/dist/commands/instructions/status.js +17 -1
  30. package/dist/commands/payments/wallet.js +2 -2
  31. package/dist/commands/tasks/attachments/set-role.d.ts +24 -0
  32. package/dist/commands/tasks/attachments/set-role.js +60 -0
  33. package/dist/commands/tasks/attachments/upload.d.ts +1 -0
  34. package/dist/commands/tasks/attachments/upload.js +18 -52
  35. package/dist/commands/tasks/comments/add.d.ts +1 -0
  36. package/dist/commands/tasks/comments/add.js +67 -2
  37. package/dist/commands/tasks/complete.d.ts +1 -0
  38. package/dist/commands/tasks/complete.js +56 -1
  39. package/dist/commands/tasks/create.d.ts +6 -0
  40. package/dist/commands/tasks/create.js +26 -3
  41. package/dist/commands/tasks/labels/attach.js +4 -0
  42. package/dist/commands/tasks/list.d.ts +1 -0
  43. package/dist/commands/tasks/list.js +9 -0
  44. package/dist/commands/tasks/result/submit.d.ts +3 -0
  45. package/dist/commands/tasks/result/submit.js +76 -8
  46. package/dist/commands/tasks/show.d.ts +23 -0
  47. package/dist/commands/tasks/show.js +61 -1
  48. package/dist/commands/tasks/update.js +16 -2
  49. package/dist/commands/tasks/updates/add.d.ts +1 -0
  50. package/dist/commands/tasks/updates/add.js +63 -0
  51. package/dist/commands/views/create.js +12 -2
  52. package/dist/commands/views/list.js +3 -2
  53. package/dist/commands/views/show.js +2 -0
  54. package/dist/lib/agentic-stream.d.ts +10 -4
  55. package/dist/lib/agentic-stream.js +25 -11
  56. package/dist/lib/api-fetch.js +7 -2
  57. package/dist/lib/cli-installers.d.ts +23 -4
  58. package/dist/lib/cli-installers.js +56 -8
  59. package/dist/lib/daemon-setup.d.ts +18 -1
  60. package/dist/lib/daemon-setup.js +33 -1
  61. package/dist/lib/dedicated-machines.js +4 -2
  62. package/dist/lib/file-mime.js +1 -1
  63. package/dist/lib/first-party-harness-agent.d.ts +16 -1
  64. package/dist/lib/first-party-harness-agent.js +47 -17
  65. package/dist/lib/first-party-harness-doctor.js +49 -48
  66. package/dist/lib/first-party-harness-managed.d.ts +9 -4
  67. package/dist/lib/first-party-harness-managed.js +13 -10
  68. package/dist/lib/first-party-harness.d.ts +32 -21
  69. package/dist/lib/first-party-harness.js +49 -31
  70. package/dist/lib/harness-provider-input.d.ts +18 -12
  71. package/dist/lib/harness-provider-input.js +18 -12
  72. package/dist/lib/harness-tiers.d.ts +4 -3
  73. package/dist/lib/harness-tiers.js +4 -3
  74. package/dist/lib/harnesses.d.ts +6 -0
  75. package/dist/lib/html-text.js +25 -0
  76. package/dist/lib/instruction-input.d.ts +21 -0
  77. package/dist/lib/instruction-input.js +30 -0
  78. package/dist/lib/instruction-provenance.d.ts +54 -0
  79. package/dist/lib/instruction-provenance.js +84 -0
  80. package/dist/lib/session-task-endpoints.d.ts +1 -1
  81. package/dist/lib/session-task-endpoints.js +3 -0
  82. package/dist/lib/task-asset-upload.d.ts +84 -0
  83. package/dist/lib/task-asset-upload.js +374 -0
  84. package/dist/lib/task-closure.d.ts +15 -0
  85. package/dist/lib/task-closure.js +20 -0
  86. package/dist/lib/task-view-render.d.ts +14 -0
  87. package/dist/lib/task-view-render.js +55 -0
  88. package/dist/lib/tasks.d.ts +26 -0
  89. package/dist/lib/tasks.js +38 -1
  90. package/dist/lib/views/vocabulary.d.ts +1 -1
  91. package/dist/lib/views/vocabulary.js +3 -1
  92. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarness.d.ts +183 -58
  93. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarness.js +286 -100
  94. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarnessChannels.d.ts +21 -33
  95. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarnessChannels.js +24 -50
  96. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarnessHome.d.ts +19 -7
  97. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarnessHome.js +26 -10
  98. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/harnessTrust.d.ts +9 -5
  99. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/harnessTrust.js +9 -5
  100. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.d.ts +1 -1
  101. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.js +1 -13
  102. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/legacyStatePreflight.d.ts +21 -1
  103. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/legacyStatePreflight.js +75 -19
  104. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarness.d.ts +183 -58
  105. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarness.js +279 -99
  106. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarnessChannels.d.ts +21 -33
  107. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarnessChannels.js +24 -49
  108. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarnessHome.d.ts +19 -7
  109. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarnessHome.js +27 -11
  110. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/harnessTrust.d.ts +9 -5
  111. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/harnessTrust.js +9 -5
  112. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.d.ts +1 -1
  113. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.js +1 -4
  114. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/legacyStatePreflight.d.ts +21 -1
  115. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/legacyStatePreflight.js +74 -19
  116. package/dist/node_modules/@skrr-ai/auth-core/package.json +1 -1
  117. package/dist/node_modules/@skrr-ai/data-provider/index.js +4588 -4509
  118. package/dist/node_modules/@skrr-ai/data-provider/package.json +1 -1
  119. package/oclif.manifest.json +33980 -33832
  120. package/package.json +3 -3
@@ -24,25 +24,40 @@
24
24
  * phase, once every peer accepts the new one;
25
25
  * 4. regenerate `first-party-harness.json`
26
26
  * (`node --import tsx scripts/emit-first-party-harness-json.mjs`);
27
- * 5. ship the data migration, which is generic over `aliases`.
27
+ * 5. ship the data migration, which is generic over `aliases` and
28
+ * `formerSpellings`;
29
+ * 6. at that rename's contract, move the spelling from `aliases` to the front
30
+ * of `formerSpellings`.
28
31
  *
29
32
  * No identifier, file, env var name or workflow input moves.
30
33
  *
31
- * ── Three spellings, kept apart on purpose ────────────────────────────────
34
+ * ── Four fields, kept apart on purpose ────────────────────────────────────
32
35
  *
33
- * `provider` CANONICAL. What the platform stores, returns and renders.
34
- * `aliases` ACCEPTED on every ingress until contract, and normalised to
35
- * canonical at the edge. Nothing new is ever written with one.
36
- * `wireProvider` What the server and a daemon say to EACH OTHER — the
37
- * capability a daemon advertises, `daemon:<p>:request|response`,
38
- * the `provider` of a session RPC. It moves after the flip and
39
- * BEFORE contract, because a daemon on a user's machine may be
40
- * any version and the server cannot tell which one sent a
41
- * request: only a released daemon that already advertises the
42
- * canonical capability lets the old one age out of the fleet.
36
+ * `provider` CANONICAL. What the platform stores, returns and renders.
37
+ * `aliases` ACCEPTED on every ingress during a rename's window, and
38
+ * normalised to canonical at the edge. Nothing new is ever
39
+ * written with one. Empty between renames.
40
+ * `formerSpellings` RETIRED. Accepted on NO ingress: no HTTP body, enum, Mongo
41
+ * filter, capability, wire event, CLI flag or trust table
42
+ * admits one. Recognised only where an ARTIFACT that predates
43
+ * the rename is read — a binary already installed, a checkout
44
+ * directory already on disk, a release already published
45
+ * under its prefix, a row or config key already written.
46
+ * Those exist whatever the platform accepts, and dropping a
47
+ * spelling from this list does not make them go away. Read it
48
+ * through `firstPartyHarnessArtifactSpellings`, never as an
49
+ * ingress check.
50
+ * `wireProvider` What the server and a daemon say to EACH OTHER — the
51
+ * capability a daemon advertises,
52
+ * `daemon:<p>:request|response`, the `provider` of a session
53
+ * RPC. It moves after the flip and BEFORE contract, because a
54
+ * daemon on a user's machine may be any version and the
55
+ * server cannot tell which one sent a request: only a
56
+ * released daemon that already advertises the canonical
57
+ * capability lets the old one age out of the fleet.
43
58
  *
44
- * The old code treated those three as one string, which is why no single
45
- * change could rename it safely. See
59
+ * The old code treated these as one string, which is why no single change could
60
+ * rename it safely. See
46
61
  * `docs/architecture/skrr-code-identifier-rename-2026-09-13.md`.
47
62
  *
48
63
  * ── Constraints on this file ──────────────────────────────────────────────
@@ -56,38 +71,43 @@
56
71
  const SLUG = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
57
72
  function defineIdentity(identity) {
58
73
  const spellings = [identity.provider, ...identity.aliases];
59
- for (const spelling of spellings) {
74
+ const every = [...spellings, ...identity.formerSpellings];
75
+ for (const spelling of every) {
60
76
  if (!SLUG.test(spelling)) {
61
77
  throw new Error(`first-party harness spelling ${JSON.stringify(spelling)} is not a slug; it becomes a ` +
62
78
  `directory name, a capability prefix and a wire event segment`);
63
79
  }
64
80
  }
65
- if (new Set(spellings).size !== spellings.length) {
66
- throw new Error('first-party harness provider and aliases must be distinct');
81
+ if (new Set(every).size !== every.length) {
82
+ throw new Error('first-party harness provider, aliases and formerSpellings must be distinct — a spelling ' +
83
+ 'is accepted or retired, never both');
67
84
  }
68
85
  if (!spellings.includes(identity.wireProvider)) {
69
86
  throw new Error(`first-party harness wireProvider ${JSON.stringify(identity.wireProvider)} must be the ` +
70
87
  'provider or one of its aliases — a peer can only accept a spelling it knows');
71
88
  }
72
- return Object.freeze({ ...identity, aliases: Object.freeze([...identity.aliases]) });
89
+ return Object.freeze({
90
+ ...identity,
91
+ aliases: Object.freeze([...identity.aliases]),
92
+ formerSpellings: Object.freeze([...identity.formerSpellings]),
93
+ });
73
94
  }
74
95
  /** The canonical slug. Written once, and read by every field that names the current spelling. */
75
96
  const PROVIDER = 'skrr-code';
76
97
  /**
77
98
  * THE identity — the only literal product name in the codebase.
78
99
  *
79
- * Phase: WIRE MOVED. `skrr-code` is canonical — stored, returned, rendered — and
80
- * it is now also what the server and a daemon say to each other. `sky-code` is
81
- * still accepted on every ingress, so a daemon released before this change
82
- * (which advertises and answers on `sky-code`) keeps working against a server
83
- * that speaks `skrr-code`, and the reverse. Contract (OSK-8663) empties
84
- * `aliases` once no connected daemon still advertises the old capability.
100
+ * Phase: CONTRACTED (OSK-8663). `skrr-code` is the only spelling any ingress
101
+ * accepts and the only one on the wire. `sky-code` is retired: nothing admits
102
+ * it, and it is still recognised where a binary, a checkout, a published
103
+ * release or a stored value written before the rename is looked for.
85
104
  */
86
105
  const IDENTITY = {
87
106
  displayName: 'skrr Code',
88
107
  command: 'skrr code',
89
108
  provider: PROVIDER,
90
- aliases: ['sky-code'],
109
+ aliases: [],
110
+ formerSpellings: ['sky-code'],
91
111
  wireProvider: PROVIDER,
92
112
  };
93
113
  export const FIRST_PARTY_HARNESS = defineIdentity(IDENTITY);
@@ -98,6 +118,11 @@ const SPELLINGS = Object.freeze([
98
118
  ...FIRST_PARTY_HARNESS.aliases,
99
119
  ]);
100
120
  const SPELLING_SET = new Set(SPELLINGS);
121
+ const ARTIFACT_SPELLINGS = Object.freeze([
122
+ ...SPELLINGS,
123
+ ...FIRST_PARTY_HARNESS.formerSpellings,
124
+ ]);
125
+ const ARTIFACT_SPELLING_SET = new Set(ARTIFACT_SPELLINGS);
101
126
  const SESSION_SUFFIX = '_session';
102
127
  const ENVIRONMENT_PREFIX = 'local-';
103
128
  function asSlug(value) {
@@ -106,10 +131,30 @@ function asSlug(value) {
106
131
  const slug = value.trim().toLowerCase();
107
132
  return slug ? slug : null;
108
133
  }
109
- /** Every spelling, canonical first. The order is the resolution order. */
134
+ /**
135
+ * Every ACCEPTED spelling, canonical first — what an ingress admits. The order
136
+ * is the resolution order.
137
+ */
110
138
  export function firstPartyHarnessSpellings() {
111
139
  return SPELLINGS;
112
140
  }
141
+ /**
142
+ * Every spelling an ARTIFACT that already exists may carry, canonical first:
143
+ * the accepted spellings, then every former one.
144
+ *
145
+ * For code that LOOKS FOR what an earlier release left behind — an installed
146
+ * binary, a checkout directory, an immutable published release, a stored value
147
+ * or config key — and for the tooling that must keep recognising those
148
+ * (ignore lists, the identity ratchet). A machine that never ran a post-rename
149
+ * client still has its engine under the old name, and it must still be found.
150
+ *
151
+ * Never an ingress check: a former spelling is not accepted anywhere, and a
152
+ * reader that admitted one here would silently reopen what contract closed. Use
153
+ * `firstPartyHarnessSpellings` / `isFirstPartyHarnessProvider` for that.
154
+ */
155
+ export function firstPartyHarnessArtifactSpellings() {
156
+ return ARTIFACT_SPELLINGS;
157
+ }
113
158
  /** True for the canonical provider or any alias (case- and whitespace-insensitive). */
114
159
  export function isFirstPartyHarnessProvider(value) {
115
160
  const slug = asSlug(value);
@@ -123,6 +168,27 @@ export function isFirstPartyHarnessProvider(value) {
123
168
  export function canonicalHarnessProvider(value) {
124
169
  return isFirstPartyHarnessProvider(value) ? FIRST_PARTY_HARNESS.provider : value;
125
170
  }
171
+ /**
172
+ * The canonical provider for a value read back from an ARTIFACT that may predate
173
+ * a rename — any artifact spelling (canonical, alias or FORMER) becomes the
174
+ * provider; every other value is returned unchanged.
175
+ *
176
+ * For values nobody migrates and nobody can refuse: a harness row's stored
177
+ * display NAME (the operator migration rewrites `provider`, never `name`), a
178
+ * daemon's config file, a harness session binding on a user's machine. Read raw
179
+ * after contract, each would name an unknown provider — a label that renders the
180
+ * retired name again, a local session silently running another backend, a live
181
+ * resume context reset as new — with no error anywhere.
182
+ *
183
+ * NEVER for anything a peer, a client or an operator SENDS, and never for a
184
+ * trust, dispatch or admission decision: a former spelling is accepted on no
185
+ * ingress, and canonicalising one here would reopen what contract closed. Use
186
+ * `canonicalHarnessProvider` for those.
187
+ */
188
+ export function canonicalArtifactHarnessProvider(value) {
189
+ const slug = asSlug(value);
190
+ return slug !== null && ARTIFACT_SPELLING_SET.has(slug) ? FIRST_PARTY_HARNESS.provider : value;
191
+ }
126
192
  /**
127
193
  * Every spelling a stored row for this provider may carry, canonical first —
128
194
  * for a Mongo `$in` filter while rows written before a flip still exist. Any
@@ -202,9 +268,18 @@ export function canonicalExecutionEnvironment(value) {
202
268
  export function firstPartyHarnessBinaryName(provider = FIRST_PARTY_HARNESS.provider, platform) {
203
269
  return platform === 'win32' ? `${provider}.exe` : provider;
204
270
  }
205
- /** Every binary file name, canonical first — the lookup order. */
271
+ /**
272
+ * Every binary file name an install may carry, canonical first — the lookup
273
+ * order, and the names an install links to the canonical binary.
274
+ *
275
+ * Built from the ARTIFACT spellings, former ones included: binaries are
276
+ * artifacts. An engine installed before a rename is still on disk under its old
277
+ * name, and a platform CLI or daemon built before it still looks for that name,
278
+ * so resolvers try it and installers leave a link at it. Neither makes the
279
+ * spelling acceptable on any ingress.
280
+ */
206
281
  export function firstPartyHarnessBinaryNames(platform) {
207
- return SPELLINGS.map((spelling) => firstPartyHarnessBinaryName(spelling, platform));
282
+ return ARTIFACT_SPELLINGS.map((spelling) => firstPartyHarnessBinaryName(spelling, platform));
208
283
  }
209
284
  /**
210
285
  * The engine home directory name under the skrr config root.
@@ -215,7 +290,8 @@ export function firstPartyHarnessBinaryNames(platform) {
215
290
  * the managed `AGENTS.md` from `<home>`. Deriving it from the provider would, on
216
291
  * a fresh install after a provider rename, create a second directory the engine
217
292
  * never reads — managed instructions would stop applying with no error. It moves
218
- * when the engine's namespace moves, and not before.
293
+ * when the engine's namespace moves, and not before; it did in OSK-8674, and
294
+ * `migrateFirstPartyHarnessHome` moves a home under a legacy name onto it.
219
295
  */
220
296
  export function firstPartyHarnessHomeDirname() {
221
297
  return FIRST_PARTY_HARNESS_ENGINE.appName;
@@ -233,7 +309,13 @@ export const FIRST_PARTY_HARNESS_FEED_ORIGIN = 'https://updates.oversky.ai';
233
309
  export function firstPartyHarnessFeedPrefix(provider = FIRST_PARTY_HARNESS.provider) {
234
310
  return `${provider}/`;
235
311
  }
236
- /** Every feed prefix, canonical first. Publishing writes all of them. */
312
+ /**
313
+ * Every feed prefix a publish WRITES, canonical first: the accepted spellings.
314
+ *
315
+ * A former spelling's prefix still holds every release published under it, and
316
+ * those stay served — their artifact URLs are inside signed manifests — but
317
+ * nothing new is written there, so its channel pointers stop moving at contract.
318
+ */
237
319
  export function firstPartyHarnessFeedPrefixes() {
238
320
  return SPELLINGS.map((spelling) => firstPartyHarnessFeedPrefix(spelling));
239
321
  }
@@ -245,97 +327,195 @@ export function firstPartyHarnessStagingPrefix(provider = FIRST_PARTY_HARNESS.pr
245
327
  export function firstPartyHarnessDefaultFeedBase(provider = FIRST_PARTY_HARNESS.provider) {
246
328
  return `${FIRST_PARTY_HARNESS_FEED_ORIGIN}/${provider}`;
247
329
  }
248
- function envName(name, legacy) {
249
- return Object.freeze({ name, legacy: Object.freeze([...legacy]) });
330
+ function envName(name) {
331
+ return Object.freeze({ name });
250
332
  }
251
333
  /**
252
- * Every environment variable the platform reads for the first-party harness,
253
- * by purpose. The neutral name wins; a legacy name is read only when the neutral
254
- * one is unset or blank, because a variable set in an ECS task definition, a
255
- * user's shell or a LaunchAgent does not change when the code does.
334
+ * Every environment variable the PLATFORM reads for the first-party harness, by
335
+ * purpose, under one brand-neutral name each — so a product rename never renames
336
+ * one.
337
+ *
338
+ * The product-named variables these replaced were read second until contract
339
+ * (OSK-8663) and are not read at all now. The ENGINE's own variables are a
340
+ * different namespace (`FIRST_PARTY_HARNESS_ENGINE.env`): the fork reads them,
341
+ * so a platform reader that must agree with the engine consults the engine's
342
+ * names explicitly (`readFirstPartyHarnessEngineEnv`) — the engine home is the
343
+ * one case (`home` below).
256
344
  */
257
345
  export const FIRST_PARTY_HARNESS_ENV = Object.freeze({
258
346
  /** Absolute path to an engine binary, overriding resolution. */
259
- path: envName('SKRR_FIRST_PARTY_HARNESS_PATH', ['OVERSKY_SKY_CODE_PATH']),
347
+ path: envName('SKRR_FIRST_PARTY_HARNESS_PATH'),
260
348
  /** Forces the CLI's managed-inference mode. */
261
- managed: envName('SKRR_FIRST_PARTY_HARNESS_MANAGED', ['OVERSKY_SKY_CODE_MANAGED']),
349
+ managed: envName('SKRR_FIRST_PARTY_HARNESS_MANAGED'),
262
350
  /** Update channel. */
263
- channel: envName('SKRR_FIRST_PARTY_HARNESS_CHANNEL', ['OVERSKY_SKY_CODE_CHANNEL']),
351
+ channel: envName('SKRR_FIRST_PARTY_HARNESS_CHANNEL'),
264
352
  /** Update-feed base URL override. */
265
- updateFeedBase: envName('SKRR_FIRST_PARTY_HARNESS_UPDATE_FEED_BASE', [
266
- 'OVERSKY_SKY_CODE_UPDATE_FEED_BASE',
267
- ]),
353
+ updateFeedBase: envName('SKRR_FIRST_PARTY_HARNESS_UPDATE_FEED_BASE'),
268
354
  /** Path to a file of development release keys. */
269
- devKeys: envName('SKRR_FIRST_PARTY_HARNESS_DEV_KEYS', ['OVERSKY_SKY_CODE_DEV_KEYS']),
355
+ devKeys: envName('SKRR_FIRST_PARTY_HARNESS_DEV_KEYS'),
270
356
  /** Engine version the desktop build bundles. */
271
- bundleVersion: envName('SKRR_FIRST_PARTY_HARNESS_BUNDLE_VERSION', ['OVERSKY_BUNDLE_SKY_CODE']),
272
- /** Engine home override (the engine reads its own name too — see ENGINE env below). */
273
- home: envName('SKRR_FIRST_PARTY_HARNESS_HOME', ['SKY_CODE_HOME']),
357
+ bundleVersion: envName('SKRR_FIRST_PARTY_HARNESS_BUNDLE_VERSION'),
358
+ /**
359
+ * Engine home override. The engine reads only its own variable, under every
360
+ * name it has had (`readFirstPartyHarnessEngineEnv(env, 'home')`), so a reader
361
+ * that resolves the home the engine will use reads those second, and a
362
+ * launcher hands the engine the resolved path under every one of them
363
+ * (`firstPartyHarnessEngineEnvEntries`).
364
+ */
365
+ home: envName('SKRR_FIRST_PARTY_HARNESS_HOME'),
274
366
  /** Engine version baked into the cloud-coding image. */
275
- cloudCodingVersion: envName('CLOUD_CODING_FIRST_PARTY_HARNESS_VERSION', [
276
- 'CLOUD_CODING_SKY_CODE_VERSION',
277
- ]),
367
+ cloudCodingVersion: envName('CLOUD_CODING_FIRST_PARTY_HARNESS_VERSION'),
278
368
  /** Engine version baked into the Dedicated Runtime AMI. */
279
- dedicatedRuntimeVersion: envName('SKRR_DEDICATED_RUNTIME_FIRST_PARTY_HARNESS_VERSION', [
280
- 'SKRR_DEDICATED_RUNTIME_SKY_CODE_VERSION',
281
- ]),
369
+ dedicatedRuntimeVersion: envName('SKRR_DEDICATED_RUNTIME_FIRST_PARTY_HARNESS_VERSION'),
282
370
  /** Engine version the desktop release workflow bundles. */
283
- desktopBundledVersion: envName('DESKTOP_BUNDLED_FIRST_PARTY_HARNESS_VERSION', [
284
- 'DESKTOP_BUNDLED_SKY_CODE_VERSION',
285
- ]),
371
+ desktopBundledVersion: envName('DESKTOP_BUNDLED_FIRST_PARTY_HARNESS_VERSION'),
286
372
  /** Update-feed bucket used by publish and promote. */
287
- updatesBucket: envName('FIRST_PARTY_HARNESS_UPDATES_BUCKET', ['SKY_CODE_UPDATES_BUCKET']),
373
+ updatesBucket: envName('FIRST_PARTY_HARNESS_UPDATES_BUCKET'),
288
374
  /** Release signing key (CI secret). */
289
- signingKey: envName('FIRST_PARTY_HARNESS_SIGNING_KEY', ['SKY_CODE_SIGNING_KEY']),
375
+ signingKey: envName('FIRST_PARTY_HARNESS_SIGNING_KEY'),
290
376
  /** Release signing key id (CI secret). */
291
- signingKeyId: envName('FIRST_PARTY_HARNESS_SIGNING_KEY_ID', ['SKY_CODE_SIGNING_KEY_ID']),
377
+ signingKeyId: envName('FIRST_PARTY_HARNESS_SIGNING_KEY_ID'),
292
378
  });
293
- /** Every name for one purpose, neutral first — for spawn-env forwarding and sanitisers. */
294
- export function firstPartyHarnessEnvNames(key) {
295
- const entry = FIRST_PARTY_HARNESS_ENV[key];
296
- return [entry.name, ...entry.legacy];
297
- }
298
- /** Read one purpose's variable: neutral name first, legacy names after. */
379
+ /** Read one purpose's variable. A blank value counts as unset. */
299
380
  export function readFirstPartyHarnessEnv(env, key) {
300
- const entry = FIRST_PARTY_HARNESS_ENV[key];
301
- for (const name of [entry.name, ...entry.legacy]) {
302
- const raw = env[name];
303
- if (typeof raw === 'string' && raw.trim() !== '') {
304
- return { value: raw.trim(), name, legacy: name !== entry.name };
305
- }
381
+ const { name } = FIRST_PARTY_HARNESS_ENV[key];
382
+ const raw = env[name];
383
+ if (typeof raw === 'string' && raw.trim() !== '') {
384
+ return { value: raw.trim(), name };
306
385
  }
307
- return { value: undefined, name: undefined, legacy: false };
386
+ return { value: undefined, name: undefined };
308
387
  }
309
388
  /* ── The ENGINE's own namespace (defined inside the fork) ───────────────── */
389
+ /**
390
+ * The engine's state namespace today. Moved from `sky-code` by OSK-8674: XDG
391
+ * dirs, project directory, config basename, the engine home under the skrr
392
+ * root, and every variable the engine reads all derive from it.
393
+ */
394
+ const ENGINE_APP_NAME = 'skrr-code';
395
+ /**
396
+ * Earlier engine namespaces, newest first. Still READ on both sides of the
397
+ * daemon↔engine boundary: an engine binary, a daemon, a CLI and a desktop app
398
+ * each ship on their own schedule, and a machine holds state written under
399
+ * every name it has run.
400
+ */
401
+ const ENGINE_LEGACY_APP_NAMES = ['sky-code'];
402
+ /**
403
+ * Every variable the engine reads, by purpose, as the suffix after the app
404
+ * name's prefix (`skrr-code` → `SKRR_CODE_<suffix>`). The fork names all of its
405
+ * own variables this way, so the names follow the namespace rather than being
406
+ * written out once per spelling.
407
+ */
408
+ const ENGINE_ENV_SUFFIXES = Object.freeze({
409
+ serverPassword: 'SERVER_PASSWORD',
410
+ serverUsername: 'SERVER_USERNAME',
411
+ home: 'HOME',
412
+ config: 'CONFIG',
413
+ appName: 'APP_NAME',
414
+ scriptName: 'SCRIPT_NAME',
415
+ allowUpstreamEgress: 'ALLOW_UPSTREAM_EGRESS',
416
+ compatOpencode: 'COMPAT_OPENCODE',
417
+ noCompatPrompts: 'NO_COMPAT_PROMPTS',
418
+ });
419
+ function engineEnvName(appName, key) {
420
+ return `${appName.toUpperCase().replace(/-/g, '_')}_${ENGINE_ENV_SUFFIXES[key]}`;
421
+ }
422
+ function engineEnvTable(appName) {
423
+ return Object.freeze(Object.fromEntries(Object.keys(ENGINE_ENV_SUFFIXES).map((key) => [
424
+ key,
425
+ engineEnvName(appName, key),
426
+ ])));
427
+ }
428
+ function defineEngineNamespace(appName, legacyAppNames) {
429
+ const every = [appName, ...legacyAppNames];
430
+ for (const name of every) {
431
+ if (!SLUG.test(name)) {
432
+ throw new Error(`first-party harness engine app name ${JSON.stringify(name)} is not a slug; it becomes a ` +
433
+ 'directory name and a variable prefix');
434
+ }
435
+ }
436
+ if (new Set(every).size !== every.length) {
437
+ throw new Error('first-party harness engine appName and legacyAppNames must be distinct');
438
+ }
439
+ return Object.freeze({
440
+ /**
441
+ * The engine's state namespace: XDG dirs, project marker, config basename, and
442
+ * the engine home under the skrr root (`firstPartyHarnessHomeDirname`).
443
+ */
444
+ appName,
445
+ /**
446
+ * Earlier `appName`s, newest first. `migrateFirstPartyHarnessHome` moves a home
447
+ * under one of them onto the current name and leaves a symlink; readers of
448
+ * engine state look under them after the current name.
449
+ */
450
+ legacyAppNames: Object.freeze([...legacyAppNames]),
451
+ /** Project-local configuration directory inside a user's repository. */
452
+ projectDirectory: `.${appName}`,
453
+ /**
454
+ * Earlier project directories, newest first. The engine still reads them and
455
+ * the platform never rewrites a user's repository to move one, so a reader
456
+ * looks here after `projectDirectory`, and a writer adopts an existing file
457
+ * here rather than creating a second one beside it.
458
+ */
459
+ legacyProjectDirectories: Object.freeze(legacyAppNames.map((name) => `.${name}`)),
460
+ /**
461
+ * Environment variables the engine reads, under the CURRENT namespace. The
462
+ * engine also reads each one under every legacy namespace, second — use
463
+ * `readFirstPartyHarnessEngineEnv` to read one the way the engine does and
464
+ * `firstPartyHarnessEngineEnvEntries` to set one every engine build honours.
465
+ */
466
+ env: engineEnvTable(appName),
467
+ });
468
+ }
310
469
  /**
311
470
  * Names the ENGINE itself defines and reads. The platform sets or reads them
312
471
  * across the daemon↔engine boundary, so they are recorded here as values rather
313
- * than scattered as literals — but they are the fork's to change, and moving
314
- * one is a two-sided change (contract §6). Not part of this identity's rename.
472
+ * than scattered as literals. They are the fork's names, and moving one is a
473
+ * two-sided change: the engine reads the new name first and every legacy name
474
+ * second, and while engine and platform releases can arrive in either order the
475
+ * platform SETS every name and READS new-then-legacy (contract §6, OSK-8674).
315
476
  */
316
- export const FIRST_PARTY_HARNESS_ENGINE = Object.freeze({
317
- /**
318
- * The engine's state namespace: XDG dirs, project marker, config basename, and
319
- * the engine home under the skrr root (`firstPartyHarnessHomeDirname`).
320
- */
321
- appName: 'sky-code',
322
- /**
323
- * Earlier `appName`s whose home directory `migrateFirstPartyHarnessHome` moves
324
- * onto the current one. Empty until the engine's namespace is renamed.
325
- */
326
- legacyAppNames: Object.freeze([]),
327
- /** Project-local configuration directory inside a user's repository. */
328
- projectDirectory: '.sky-code',
329
- /** Environment variables the engine reads. */
330
- env: Object.freeze({
331
- serverPassword: 'SKY_CODE_SERVER_PASSWORD',
332
- serverUsername: 'SKY_CODE_SERVER_USERNAME',
333
- home: 'SKY_CODE_HOME',
334
- config: 'SKY_CODE_CONFIG',
335
- appName: 'SKY_CODE_APP_NAME',
336
- scriptName: 'SKY_CODE_SCRIPT_NAME',
337
- allowUpstreamEgress: 'SKY_CODE_ALLOW_UPSTREAM_EGRESS',
338
- compatOpencode: 'SKY_CODE_COMPAT_OPENCODE',
339
- noCompatPrompts: 'SKY_CODE_NO_COMPAT_PROMPTS',
340
- }),
341
- });
477
+ export const FIRST_PARTY_HARNESS_ENGINE = defineEngineNamespace(ENGINE_APP_NAME, ENGINE_LEGACY_APP_NAMES);
478
+ /**
479
+ * Every name the engine reads for one purpose, current namespace first — the
480
+ * engine's own lookup order.
481
+ */
482
+ export function firstPartyHarnessEngineEnvNames(key) {
483
+ return [FIRST_PARTY_HARNESS_ENGINE.appName, ...FIRST_PARTY_HARNESS_ENGINE.legacyAppNames].map((appName) => engineEnvName(appName, key));
484
+ }
485
+ /**
486
+ * Read one engine variable the way the engine reads it: the current name, then
487
+ * every legacy name. A blank value counts as unset.
488
+ */
489
+ export function readFirstPartyHarnessEngineEnv(env, key) {
490
+ for (const name of firstPartyHarnessEngineEnvNames(key)) {
491
+ const raw = env[name];
492
+ if (typeof raw === 'string' && raw.trim() !== '') {
493
+ return { value: raw.trim(), name };
494
+ }
495
+ }
496
+ return { value: undefined, name: undefined };
497
+ }
498
+ /**
499
+ * One engine variable set under EVERY name the engine has read, for a process
500
+ * that spawns the engine. An engine binary is installed on its own schedule, so
501
+ * a launcher cannot know whether the one it starts reads the current name or a
502
+ * legacy one; setting both means either build receives the value.
503
+ */
504
+ export function firstPartyHarnessEngineEnvEntries(key, value) {
505
+ return Object.fromEntries(firstPartyHarnessEngineEnvNames(key).map((name) => [name, value]));
506
+ }
507
+ /** Every engine project directory, current first — the engine's read order. */
508
+ export function firstPartyHarnessEngineProjectDirectories() {
509
+ return [
510
+ FIRST_PARTY_HARNESS_ENGINE.projectDirectory,
511
+ ...FIRST_PARTY_HARNESS_ENGINE.legacyProjectDirectories,
512
+ ];
513
+ }
514
+ /**
515
+ * Every engine home directory name under a config root, current first: where an
516
+ * engine home may exist on disk. `firstPartyHarnessHomeDirname` is the one the
517
+ * platform writes.
518
+ */
519
+ export function firstPartyHarnessEngineHomeDirnames() {
520
+ return [FIRST_PARTY_HARNESS_ENGINE.appName, ...FIRST_PARTY_HARNESS_ENGINE.legacyAppNames];
521
+ }
@@ -108,40 +108,28 @@ export interface FirstPartyHarnessFeedCandidate {
108
108
  * Every place a manifest may be published, in the order an installer should
109
109
  * try them: the canonical spelling first, then each alias.
110
110
  *
111
- * Why a list: publishing writes every spelling, but an installer can ship before
112
- * the first release that does, and a machine can point at a feed published by
113
- * an older pipeline. An installer that asked only for the canonical path would
114
- * then find NOTHING and report "no release" on a feed that has one. Trying the
115
- * aliases on not-found closes that window in both directions without anyone
116
- * having to deploy in a particular order.
111
+ * Why a list: publishing writes every accepted spelling, but an installer can
112
+ * ship before the first release that does, and a machine can point at a feed
113
+ * published by an older pipeline. An installer that asked only for the canonical
114
+ * path would then find NOTHING and report "no release" on a feed that has one.
115
+ * Trying the aliases on not-found closes that window in both directions without
116
+ * anyone having to deploy in a particular order.
117
+ *
118
+ * WHICH spellings depends on what is being read, and the difference is the
119
+ * point:
120
+ *
121
+ * - a CHANNEL pointer (`pinnedRelease` false) is current state. Only the
122
+ * accepted spellings are tried: a former spelling's pointer stopped moving
123
+ * when publishing stopped writing it, so falling back to one would install
124
+ * whatever that channel named on the day of contract — a silent downgrade.
125
+ * - a PINNED release (`pinnedRelease` true) is an immutable artifact. Former
126
+ * spellings are tried too: a release published before the canonical prefix
127
+ * existed lives only under the old one, and its signed bytes — artifact URLs
128
+ * included — are the same wherever they are found.
117
129
  *
118
130
  * An operator override keeps its base and still tries each manifest filename,
119
131
  * since a dev feed staged by an older script names the file the old way.
120
132
  */
121
- export declare function firstPartyHarnessFeedCandidates(env?: NodeJS.ProcessEnv): readonly FirstPartyHarnessFeedCandidate[];
122
- /** @deprecated Use `FIRST_PARTY_HARNESS_CHANNELS`. */
123
- export declare const SKY_CODE_CHANNELS: readonly ["internal", "canary", "beta", "stable"];
124
- /** @deprecated Use `FirstPartyHarnessChannel`. */
125
- export type SkyCodeChannel = FirstPartyHarnessChannel;
126
- /** @deprecated Use `DEFAULT_FIRST_PARTY_HARNESS_CHANNEL`. */
127
- export declare const DEFAULT_SKY_CODE_CHANNEL: "stable";
128
- /** @deprecated Read the channel with `resolveFirstPartyHarnessChannel`; the variable has a neutral name now. */
129
- export declare const SKY_CODE_CHANNEL_ENV: string;
130
- /** @deprecated Use `firstPartyHarnessManifestFile()`. Names the legacy file. */
131
- export declare const SKY_CODE_MANIFEST_FILE: string;
132
- /** @deprecated Use `isFirstPartyHarnessChannel`. */
133
- export declare const isSkyCodeChannel: typeof isFirstPartyHarnessChannel;
134
- /** @deprecated Use `resolveFirstPartyHarnessChannel`. */
135
- export declare const resolveSkyCodeChannel: typeof resolveFirstPartyHarnessChannel;
136
- /** @deprecated Use `firstPartyHarnessChannelPrefix`. */
137
- export declare const skyCodeChannelPrefix: typeof firstPartyHarnessChannelPrefix;
138
- /** @deprecated Use `firstPartyHarnessDefaultFeedBase()`. Names the legacy feed. */
139
- export declare const DEFAULT_SKY_CODE_FEED_BASE: string;
140
- /** @deprecated Read the feed with `firstPartyHarnessFeedBase`; the variable has a neutral name now. */
141
- export declare const SKY_CODE_FEED_BASE_ENV: string;
142
- /**
143
- * @deprecated Use `firstPartyHarnessFeedCandidates`. Keeps the LEGACY feed as its
144
- * default, because that is the only feed a caller compiled against this name knows
145
- * how to read.
146
- */
147
- export declare function skyCodeFeedBase(env?: NodeJS.ProcessEnv): string;
133
+ export declare function firstPartyHarnessFeedCandidates(env?: NodeJS.ProcessEnv, options?: {
134
+ pinnedRelease?: boolean;
135
+ }): readonly FirstPartyHarnessFeedCandidate[];
@@ -26,7 +26,7 @@
26
26
  * Every product-named value comes from `firstPartyHarness.ts`; nothing in this
27
27
  * file spells the product.
28
28
  */
29
- import { FIRST_PARTY_HARNESS, FIRST_PARTY_HARNESS_ENV, firstPartyHarnessDefaultFeedBase, firstPartyHarnessManifestFile, firstPartyHarnessSpellings, readFirstPartyHarnessEnv, } from './firstPartyHarness.js';
29
+ import { firstPartyHarnessArtifactSpellings, firstPartyHarnessDefaultFeedBase, firstPartyHarnessManifestFile, firstPartyHarnessSpellings, readFirstPartyHarnessEnv, } from './firstPartyHarness.js';
30
30
  /** Channels in promotion order. Index order IS the promotion order. */
31
31
  export const FIRST_PARTY_HARNESS_CHANNELS = ['internal', 'canary', 'beta', 'stable'];
32
32
  /**
@@ -116,61 +116,36 @@ export function firstPartyHarnessFeedBase(env = process.env) {
116
116
  * Every place a manifest may be published, in the order an installer should
117
117
  * try them: the canonical spelling first, then each alias.
118
118
  *
119
- * Why a list: publishing writes every spelling, but an installer can ship before
120
- * the first release that does, and a machine can point at a feed published by
121
- * an older pipeline. An installer that asked only for the canonical path would
122
- * then find NOTHING and report "no release" on a feed that has one. Trying the
123
- * aliases on not-found closes that window in both directions without anyone
124
- * having to deploy in a particular order.
119
+ * Why a list: publishing writes every accepted spelling, but an installer can
120
+ * ship before the first release that does, and a machine can point at a feed
121
+ * published by an older pipeline. An installer that asked only for the canonical
122
+ * path would then find NOTHING and report "no release" on a feed that has one.
123
+ * Trying the aliases on not-found closes that window in both directions without
124
+ * anyone having to deploy in a particular order.
125
+ *
126
+ * WHICH spellings depends on what is being read, and the difference is the
127
+ * point:
128
+ *
129
+ * - a CHANNEL pointer (`pinnedRelease` false) is current state. Only the
130
+ * accepted spellings are tried: a former spelling's pointer stopped moving
131
+ * when publishing stopped writing it, so falling back to one would install
132
+ * whatever that channel named on the day of contract — a silent downgrade.
133
+ * - a PINNED release (`pinnedRelease` true) is an immutable artifact. Former
134
+ * spellings are tried too: a release published before the canonical prefix
135
+ * existed lives only under the old one, and its signed bytes — artifact URLs
136
+ * included — are the same wherever they are found.
125
137
  *
126
138
  * An operator override keeps its base and still tries each manifest filename,
127
139
  * since a dev feed staged by an older script names the file the old way.
128
140
  */
129
- export function firstPartyHarnessFeedCandidates(env = process.env) {
141
+ export function firstPartyHarnessFeedCandidates(env = process.env, options = {}) {
130
142
  const override = readFirstPartyHarnessEnv(env, 'updateFeedBase').value?.replace(/\/+$/, '');
131
- return firstPartyHarnessSpellings().map((provider) => ({
143
+ const spellings = options.pinnedRelease
144
+ ? firstPartyHarnessArtifactSpellings()
145
+ : firstPartyHarnessSpellings();
146
+ return spellings.map((provider) => ({
132
147
  base: override || firstPartyHarnessDefaultFeedBase(provider),
133
148
  manifestFilename: firstPartyHarnessManifestFile(provider),
134
149
  provider,
135
150
  }));
136
151
  }
137
- /* ── Deprecated names ───────────────────────────────────────────────────────
138
- *
139
- * `@skrr-ai/auth-core` is PUBLISHED, and the released CLI resolves it with a
140
- * caret range. An installed CLI that picks up this version must still find the
141
- * names it was compiled against, or it crashes at import. These aliases leave in
142
- * the contract phase (OSK-8663), with a minor-version bump — never a patch.
143
- *
144
- * The ones that name a feed name the LEGACY one, the spelling a caller compiled
145
- * against them was built for — the retired alias, not `wireProvider`, which has
146
- * moved to canonical.
147
- */
148
- /** The spelling the deprecated names were written for. */
149
- const LEGACY_SPELLING = FIRST_PARTY_HARNESS.aliases[0] ?? FIRST_PARTY_HARNESS.provider;
150
- /** @deprecated Use `FIRST_PARTY_HARNESS_CHANNELS`. */
151
- export const SKY_CODE_CHANNELS = FIRST_PARTY_HARNESS_CHANNELS;
152
- /** @deprecated Use `DEFAULT_FIRST_PARTY_HARNESS_CHANNEL`. */
153
- export const DEFAULT_SKY_CODE_CHANNEL = DEFAULT_FIRST_PARTY_HARNESS_CHANNEL;
154
- /** @deprecated Read the channel with `resolveFirstPartyHarnessChannel`; the variable has a neutral name now. */
155
- export const SKY_CODE_CHANNEL_ENV = FIRST_PARTY_HARNESS_ENV.channel.legacy[0];
156
- /** @deprecated Use `firstPartyHarnessManifestFile()`. Names the legacy file. */
157
- export const SKY_CODE_MANIFEST_FILE = firstPartyHarnessManifestFile(LEGACY_SPELLING);
158
- /** @deprecated Use `isFirstPartyHarnessChannel`. */
159
- export const isSkyCodeChannel = isFirstPartyHarnessChannel;
160
- /** @deprecated Use `resolveFirstPartyHarnessChannel`. */
161
- export const resolveSkyCodeChannel = resolveFirstPartyHarnessChannel;
162
- /** @deprecated Use `firstPartyHarnessChannelPrefix`. */
163
- export const skyCodeChannelPrefix = firstPartyHarnessChannelPrefix;
164
- /** @deprecated Use `firstPartyHarnessDefaultFeedBase()`. Names the legacy feed. */
165
- export const DEFAULT_SKY_CODE_FEED_BASE = firstPartyHarnessDefaultFeedBase(LEGACY_SPELLING);
166
- /** @deprecated Read the feed with `firstPartyHarnessFeedBase`; the variable has a neutral name now. */
167
- export const SKY_CODE_FEED_BASE_ENV = FIRST_PARTY_HARNESS_ENV.updateFeedBase.legacy[0];
168
- /**
169
- * @deprecated Use `firstPartyHarnessFeedCandidates`. Keeps the LEGACY feed as its
170
- * default, because that is the only feed a caller compiled against this name knows
171
- * how to read.
172
- */
173
- export function skyCodeFeedBase(env = process.env) {
174
- const override = readFirstPartyHarnessEnv(env, 'updateFeedBase').value;
175
- return (override || firstPartyHarnessDefaultFeedBase(LEGACY_SPELLING)).replace(/\/+$/, '');
176
- }