@skrr-ai/cli 0.1.8 → 0.1.9

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 (169) hide show
  1. package/dist/base-command.d.ts +27 -0
  2. package/dist/base-command.js +83 -11
  3. package/dist/commands/agent/message/send.js +1 -1
  4. package/dist/commands/agents/chat.d.ts +1 -1
  5. package/dist/commands/agents/chat.js +1 -1
  6. package/dist/commands/browser/install.d.ts +1 -1
  7. package/dist/commands/browser/install.js +10 -2
  8. package/dist/commands/browser/mcp-config.js +3 -1
  9. package/dist/commands/browser/skill/show.js +1 -1
  10. package/dist/commands/browser/status.js +4 -1
  11. package/dist/commands/browser/uninstall.d.ts +1 -1
  12. package/dist/commands/browser/uninstall.js +10 -2
  13. package/dist/commands/browser.d.ts +1 -1
  14. package/dist/commands/browser.js +3 -3
  15. package/dist/commands/code/index.js +6 -3
  16. package/dist/commands/code/install.d.ts +61 -0
  17. package/dist/commands/code/install.js +247 -0
  18. package/dist/commands/code/oversky-agent.d.ts +2 -1
  19. package/dist/commands/code/oversky-agent.js +12 -8
  20. package/dist/commands/commands.js +1 -1
  21. package/dist/commands/context.js +1 -1
  22. package/dist/commands/create-token.js +1 -1
  23. package/dist/commands/daemon/byok.d.ts +1 -0
  24. package/dist/commands/daemon/byok.js +14 -1
  25. package/dist/commands/daemon/index.js +18 -7
  26. package/dist/commands/daemon/install.d.ts +1 -0
  27. package/dist/commands/daemon/install.js +22 -3
  28. package/dist/commands/daemon/logs.d.ts +1 -0
  29. package/dist/commands/daemon/logs.js +4 -0
  30. package/dist/commands/daemon/start.d.ts +1 -0
  31. package/dist/commands/daemon/start.js +15 -2
  32. package/dist/commands/daemon/status.d.ts +1 -0
  33. package/dist/commands/daemon/status.js +14 -1
  34. package/dist/commands/daemon/stop.d.ts +1 -0
  35. package/dist/commands/daemon/stop.js +14 -1
  36. package/dist/commands/daemon/uninstall.d.ts +1 -0
  37. package/dist/commands/daemon/uninstall.js +15 -2
  38. package/dist/commands/daemon/usage.d.ts +1 -0
  39. package/dist/commands/daemon/usage.js +5 -1
  40. package/dist/commands/doctor.js +2 -2
  41. package/dist/commands/github/allow-tools.d.ts +1 -0
  42. package/dist/commands/github/app/install.d.ts +1 -0
  43. package/dist/commands/github/app/status.d.ts +1 -0
  44. package/dist/commands/github/connect.d.ts +1 -0
  45. package/dist/commands/github/connections.d.ts +1 -0
  46. package/dist/commands/github/disconnect.d.ts +1 -0
  47. package/dist/commands/github/finalize.d.ts +1 -0
  48. package/dist/commands/github/reconnect.d.ts +1 -0
  49. package/dist/commands/github/run.d.ts +1 -0
  50. package/dist/commands/github/tools.d.ts +1 -0
  51. package/dist/commands/goals/create.js +2 -2
  52. package/dist/commands/goals/show.js +5 -0
  53. package/dist/commands/harnesses/list.js +14 -3
  54. package/dist/commands/harnesses/show.js +14 -0
  55. package/dist/commands/instructions/activate.js +1 -1
  56. package/dist/commands/instructions/archive-version.js +1 -1
  57. package/dist/commands/instructions/delete.js +1 -1
  58. package/dist/commands/instructions/diff.js +1 -1
  59. package/dist/commands/instructions/install.js +7 -1
  60. package/dist/commands/instructions/restore.js +1 -1
  61. package/dist/commands/instructions/show.js +17 -1
  62. package/dist/commands/instructions/update.js +1 -1
  63. package/dist/commands/integrations/connections/connect.d.ts +1 -0
  64. package/dist/commands/integrations/connections/disconnect.d.ts +1 -0
  65. package/dist/commands/integrations/connections/finalize.d.ts +1 -0
  66. package/dist/commands/integrations/connections/list.d.ts +1 -0
  67. package/dist/commands/integrations/connections/reconnect.d.ts +1 -0
  68. package/dist/commands/integrations/execute.d.ts +1 -0
  69. package/dist/commands/integrations/search.d.ts +1 -0
  70. package/dist/commands/integrations/toolkits.d.ts +1 -0
  71. package/dist/commands/integrations/tools/allow.d.ts +1 -0
  72. package/dist/commands/integrations/tools/list.d.ts +1 -0
  73. package/dist/commands/list-daemons.d.ts +2 -7
  74. package/dist/commands/list-daemons.js +13 -13
  75. package/dist/commands/login.js +73 -31
  76. package/dist/commands/logout.js +52 -1
  77. package/dist/commands/machines/hosted/start.js +1 -1
  78. package/dist/commands/pair.js +2 -2
  79. package/dist/commands/projects/create.js +6 -1
  80. package/dist/commands/projects/tasks.js +6 -1
  81. package/dist/commands/revoke-daemon.js +6 -2
  82. package/dist/commands/set-capabilities.js +6 -2
  83. package/dist/commands/skills/install.js +1 -1
  84. package/dist/commands/skills/library.js +2 -2
  85. package/dist/commands/spaces/create.js +6 -2
  86. package/dist/commands/tasks/complete.d.ts +1 -1
  87. package/dist/commands/tasks/complete.js +21 -8
  88. package/dist/commands/tasks/create.js +4 -1
  89. package/dist/commands/tasks/current.js +1 -1
  90. package/dist/commands/tasks/delete.d.ts +1 -0
  91. package/dist/commands/tasks/delete.js +9 -0
  92. package/dist/commands/tasks/export.js +5 -1
  93. package/dist/commands/tasks/follow-up.js +2 -1
  94. package/dist/commands/tasks/list.js +5 -1
  95. package/dist/commands/tasks/pr.js +1 -1
  96. package/dist/commands/tasks/show.js +10 -1
  97. package/dist/commands/tasks/triage.js +2 -1
  98. package/dist/commands/tasks/update.js +4 -1
  99. package/dist/commands/tasks/upsert.js +4 -1
  100. package/dist/commands/usage.js +1 -1
  101. package/dist/lib/agentic-stream.js +21 -1
  102. package/dist/lib/api-fetch.d.ts +1 -1
  103. package/dist/lib/api-fetch.js +1 -1
  104. package/dist/lib/auth-core-init.js +23 -3
  105. package/dist/lib/auth-storage.d.ts +0 -12
  106. package/dist/lib/auth-storage.js +37 -2
  107. package/dist/lib/config.d.ts +3 -3
  108. package/dist/lib/config.js +327 -26
  109. package/dist/lib/created-line.d.ts +22 -0
  110. package/dist/lib/created-line.js +25 -0
  111. package/dist/lib/daemon-binding.d.ts +29 -0
  112. package/dist/lib/daemon-binding.js +63 -0
  113. package/dist/lib/daemon-ref.d.ts +31 -0
  114. package/dist/lib/daemon-ref.js +47 -0
  115. package/dist/lib/daemonBroker.js +1 -1
  116. package/dist/lib/delegated-cli.js +3 -3
  117. package/dist/lib/exec-oversky.d.ts +18 -1
  118. package/dist/lib/exec-oversky.js +21 -4
  119. package/dist/lib/html-text.d.ts +15 -0
  120. package/dist/lib/html-text.js +40 -0
  121. package/dist/lib/keychain.d.ts +43 -0
  122. package/dist/lib/keychain.js +145 -4
  123. package/dist/lib/login.js +3 -3
  124. package/dist/lib/node-adapter.js +1 -1
  125. package/dist/lib/oauthLogin.js +17 -6
  126. package/dist/lib/sky-code-agent.d.ts +1 -1
  127. package/dist/lib/sky-code-agent.js +8 -8
  128. package/dist/lib/sky-code-broker.js +18 -2
  129. package/dist/lib/sky-code-doctor.js +120 -4
  130. package/dist/lib/sky-code-managed.d.ts +12 -0
  131. package/dist/lib/sky-code-managed.js +21 -7
  132. package/dist/lib/sky-code.d.ts +16 -1
  133. package/dist/lib/sky-code.js +102 -4
  134. package/dist/lib/task-execution.js +4 -11
  135. package/dist/lib/tasks.d.ts +1 -0
  136. package/dist/lib/tasks.js +9 -6
  137. package/dist/lib/update-check.js +1 -1
  138. package/dist/lib/usage-discovery.js +1 -1
  139. package/dist/lib/web-url.js +12 -1
  140. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/credentialResolver.d.ts +1 -1
  141. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/credentialResolver.js +2 -2
  142. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.d.ts +1 -0
  143. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.js +13 -1
  144. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/kek/linux.js +16 -3
  145. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/legacyStatePreflight.d.ts +0 -9
  146. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/legacyStatePreflight.js +18 -1
  147. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/loginLocalhost.js +3 -3
  148. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/messages.js +3 -3
  149. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/runtime.d.ts +7 -3
  150. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/skyCodeChannels.d.ts +96 -0
  151. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/skyCodeChannels.js +115 -0
  152. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/credentialResolver.d.ts +1 -1
  153. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/credentialResolver.js +2 -2
  154. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.d.ts +1 -0
  155. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.js +1 -0
  156. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/kek/linux.js +16 -3
  157. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/legacyStatePreflight.d.ts +0 -9
  158. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/legacyStatePreflight.js +18 -1
  159. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/loginLocalhost.js +3 -3
  160. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/messages.js +3 -3
  161. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/runtime.d.ts +7 -3
  162. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/skyCodeChannels.d.ts +96 -0
  163. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/skyCodeChannels.js +107 -0
  164. package/dist/node_modules/@skrr-ai/auth-core/package.json +1 -1
  165. package/dist/node_modules/@skrr-ai/data-provider/index.js +4206 -4191
  166. package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/managed-inference-broker.js +2 -2
  167. package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/managed-inference-broker.js +2 -2
  168. package/oclif.manifest.json +9924 -3352
  169. package/package.json +22 -19
@@ -51,6 +51,13 @@ export function findLegacyLocalState(home = os.homedir()) {
51
51
  * `--force`: the operator's next step is the backup the runbook specifies, and
52
52
  * a flag that skips a safety check is the flag everyone learns to paste.
53
53
  */
54
+ /**
55
+ * The pre-rename runtime binary. Named in the refusal above because deregistering
56
+ * the OLD service is the one step the NEW binary cannot do: `uninstall` resolves
57
+ * the current profile's label (`ai.skrr.daemon.*`), and the legacy sweep is wired
58
+ * only into the install path.
59
+ */
60
+ const LEGACY_BINARY_NAME = 'oversky';
54
61
  export function describeLegacyState(report, binaryName) {
55
62
  const lines = [];
56
63
  lines.push('Found state from the previous product identity on this machine:');
@@ -65,7 +72,17 @@ export function describeLegacyState(report, binaryName) {
65
72
  lines.push('Nothing above has been read, copied or removed. Follow the team cutover');
66
73
  lines.push('runbook — it takes a backup first — and then run this again:');
67
74
  lines.push('');
68
- lines.push(` ${binaryName} uninstall # stop and deregister the old service`);
75
+ // The OLD binary, deliberately: it is the one that knows the old service
76
+ // label. `<current> uninstall` resolves the CURRENT profile's label and would
77
+ // report success while leaving the pre-rename service registered. Guarded by
78
+ // "only if" rather than omitted, because this module inspects directories and
79
+ // has no way to know whether that binary is still on PATH.
80
+ lines.push(` ${LEGACY_BINARY_NAME} uninstall # only if the old runtime is still installed —`);
81
+ lines.push(` # it is the one that knows the old service label`);
69
82
  lines.push(' # then remove the directories listed above, per the runbook');
83
+ lines.push('');
84
+ lines.push(`Any pre-rename service still registered is swept by \`${binaryName} install\``);
85
+ lines.push('once those directories are gone, so re-running the install completes the');
86
+ lines.push('cutover either way.');
70
87
  return lines.join('\n');
71
88
  }
@@ -341,15 +341,15 @@ function htmlShell(title, accent, headline, body) {
341
341
  function successHtml() {
342
342
  const headline = `<div class="badge"><svg viewBox="0 0 24 24"><path d="M5 13l4 4L19 7"/></svg></div>
343
343
  <h1>Authorized</h1>`;
344
- return htmlShell('OverSky — Authorized', '#10b981', headline, 'You can close this tab and return to your terminal.');
344
+ return htmlShell('skrr — Authorized', '#10b981', headline, 'You can close this tab and return to your terminal.');
345
345
  }
346
346
  function declinedHtml() {
347
347
  const headline = `<div class="badge" style="background:#64748b"><svg viewBox="0 0 24 24"><path d="M6 6l12 12M18 6L6 18"/></svg></div>
348
348
  <h1>Authorization declined</h1>`;
349
- return htmlShell('OverSky — Authorization declined', '#64748b', headline, 'You can close this tab. Run the CLI command again to retry.');
349
+ return htmlShell('skrr — Authorization declined', '#64748b', headline, 'You can close this tab. Run the CLI command again to retry.');
350
350
  }
351
351
  function genericFailureHtml() {
352
352
  const headline = `<div class="badge" style="background:#ef4444"><svg viewBox="0 0 24 24"><path d="M12 8v4M12 16h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/></svg></div>
353
353
  <h1>Authorization error</h1>`;
354
- return htmlShell('OverSky — Authorization error', '#ef4444', headline, 'Something went wrong. You can close this tab and retry from the terminal.');
354
+ return htmlShell('skrr — Authorization error', '#ef4444', headline, 'Something went wrong. You can close this tab and retry from the terminal.');
355
355
  }
@@ -14,8 +14,8 @@ const REASON_HUMAN = {
14
14
  SESSION_REVOKED: 'Your session was ended (you signed out elsewhere or your password changed).',
15
15
  TOKEN_EXPIRED: 'Your access token has expired.',
16
16
  TOKEN_INVALID: 'Your saved credentials are no longer valid.',
17
- UNKNOWN_401: 'OverSky needs you to sign in again.',
18
- UNKNOWN: 'OverSky needs you to sign in again.',
17
+ UNKNOWN_401: 'skrr needs you to sign in again.',
18
+ UNKNOWN: 'skrr needs you to sign in again.',
19
19
  };
20
20
  export function formatReauthMessage(reason) {
21
21
  const norm = REASON_HUMAN[reason] || REASON_HUMAN.UNKNOWN;
@@ -24,7 +24,7 @@ export function formatReauthMessage(reason) {
24
24
  const cmd = isHeadless ? `${bin} login --device` : `${bin} login`;
25
25
  return [
26
26
  '',
27
- 'OverSky cannot connect — re-authentication required.',
27
+ 'skrr cannot connect — re-authentication required.',
28
28
  ` Reason: ${norm}`,
29
29
  '',
30
30
  ` To continue, run: ${cmd}`,
@@ -49,9 +49,13 @@ export interface AuthCoreConfig {
49
49
  * per-profile and silently killed the `legacyDaemonUuids()` fold safety net
50
50
  * (it scanned `<profileDir>/profiles/*`, which never exists). See OSK-1478.
51
51
  *
52
- * Default: falls back to `configDir()` when unset. The CLI's `configDir` is
53
- * already the machine root (`~/.skrr`), so it needs no wiring; the daemon
54
- * wires this explicitly to its root `CONFIG_DIR` in `auth/configure.ts`.
52
+ * Default: falls back to `configDir()` when unset. BOTH callers now wire it
53
+ * explicitly the daemon to its root `CONFIG_DIR` in `auth/configure.ts`,
54
+ * and the CLI in `auth-core-init.ts`. The CLI's used to need no wiring
55
+ * because its `configDir` was unconditionally the machine root; that stopped
56
+ * being true when `configDir` became profile-aware, and an unwired default
57
+ * would have drifted `cliId` per profile — which the server rejects, because
58
+ * it binds that value into the JWT `did` claim.
55
59
  */
56
60
  machineConfigDir?: () => string;
57
61
  /** Logger used by all stateful helpers. */
@@ -0,0 +1,96 @@
1
+ /**
2
+ * skrr Code update channels — the vocabulary, in the ONE place both readers resolve.
3
+ *
4
+ * It lived in `daemon/src/sky-code/channels.ts`, whose only importer was the
5
+ * daemon's own installer. That was fine while the daemon was the only thing that
6
+ * needed it, and it stopped being fine the moment a user could be told to go
7
+ * looking: `skrr code`'s not-installed message promised that `skrr code doctor`
8
+ * would name "which channel this machine follows and whether that channel has a
9
+ * published release", and the CLI had no access to any of it — so the sentence
10
+ * described a diagnosis nobody had written (dogfood OSK-274).
11
+ *
12
+ * A MIRROR in the CLI was the obvious alternative and is the wrong answer here,
13
+ * with precedent: OSK-3894 shipped exactly that for the harness trust tiers and
14
+ * OSK-3897 removed it, because a mirror proves two copies agree rather than
15
+ * proving there is one copy. `harnessTrust.ts` moved into this package for that
16
+ * reason, the daemon re-exports it, and a static check keeps the daemon from
17
+ * quietly redeclaring. This follows that road rather than reopening the one it
18
+ * replaced.
19
+ *
20
+ * Only the VOCABULARY moves — channel names, the env var, the default, and the
21
+ * URL shape. The installer, the signature verification and the promotion
22
+ * machinery stay in the daemon, which is the only process that performs them.
23
+ */
24
+ /** Channels in promotion order. Index order IS the promotion order. */
25
+ export declare const SKY_CODE_CHANNELS: readonly ["internal", "canary", "beta", "stable"];
26
+ export type SkyCodeChannel = (typeof SKY_CODE_CHANNELS)[number];
27
+ /**
28
+ * The channel a build without an explicit setting follows.
29
+ *
30
+ * `stable`, and never inferred from anything else. A default that drifted with
31
+ * the build (say, dev builds silently on `canary`) would mean a user's update
32
+ * path depended on how their binary happened to be produced.
33
+ */
34
+ export declare const DEFAULT_SKY_CODE_CHANNEL: SkyCodeChannel;
35
+ /** Env var selecting the channel. Explicit opt-in; never set implicitly. */
36
+ export declare const SKY_CODE_CHANNEL_ENV = "OVERSKY_SKY_CODE_CHANNEL";
37
+ /** Manifest filename, under a channel prefix or an immutable release prefix. */
38
+ export declare const SKY_CODE_MANIFEST_FILE = "sky-code-version.json";
39
+ export declare function isSkyCodeChannel(value: unknown): value is SkyCodeChannel;
40
+ /**
41
+ * The channel this process should follow.
42
+ *
43
+ * An unrecognised value falls back to the default rather than throwing. A
44
+ * typo'd channel must not brick updates altogether — that turns a harmless
45
+ * mistake into an un-updatable machine, which is the failure the updater exists
46
+ * to prevent. The caller is handed `invalid` so it can say so out loud.
47
+ */
48
+ export declare function resolveSkyCodeChannel(env?: NodeJS.ProcessEnv): {
49
+ channel: SkyCodeChannel;
50
+ invalid?: string;
51
+ };
52
+ /**
53
+ * Where a channel's signed manifest lives.
54
+ *
55
+ * `stable` is NOT special-cased to `latest/`. Two paths that must always agree
56
+ * is a pair that eventually will not, and the one that disagrees silently is
57
+ * the one serving production. `latest/` remains for the daemon feed and for
58
+ * anything already pointing at it; skrr Code channel clients read
59
+ * `channels/<name>/` uniformly.
60
+ */
61
+ export declare function skyCodeChannelPrefix(channel: SkyCodeChannel): string;
62
+ /**
63
+ * Manifest URL for a channel, or for a pinned version.
64
+ *
65
+ * A pinned version wins over the channel and reads its immutable per-release
66
+ * copy: pinning means "this exact build", and a channel pointer that moved
67
+ * underneath would make the pin a suggestion.
68
+ *
69
+ * Builds only MANIFEST urls, never artifact ones. `buildManifestMessage` signs
70
+ * version, minimum, forceUpdate and the per-platform sha256s; `buildArtifactMessage`
71
+ * signs the artifact URL. Neither signs a channel — so artifact URLs stay
72
+ * channel-independent and promotion is a COPY OF AN ALREADY-SIGNED OBJECT that
73
+ * never needs the release key. Put the channel in the artifact URL instead and
74
+ * every promotion becomes a re-signing ceremony, which decides whether the
75
+ * ed25519 key has to be reachable from routine automation. A helper here that
76
+ * adjusted artifact urls would silently reintroduce exactly that coupling.
77
+ */
78
+ export declare function resolveChannelManifestUrl(input: {
79
+ base: string;
80
+ manifestFilename: string;
81
+ channel: SkyCodeChannel;
82
+ pinnedVersion?: string | null;
83
+ }): string;
84
+ /** Default public feed. Mirrors the daemon's `updates.oversky.ai/daemon` prefix. */
85
+ export declare const DEFAULT_SKY_CODE_FEED_BASE = "https://updates.oversky.ai/sky-code";
86
+ /**
87
+ * Feed override, read at call time rather than module load so a test or an
88
+ * operator can repoint it without re-importing.
89
+ *
90
+ * Explicit-only: a production user must never be silently enrolled onto a
91
+ * different feed. Selecting a feed changes WHICH signed manifest is read, never
92
+ * WHETHER the signature is checked — every artifact is verified against the
93
+ * pinned keys regardless of where it came from.
94
+ */
95
+ export declare const SKY_CODE_FEED_BASE_ENV = "OVERSKY_SKY_CODE_UPDATE_FEED_BASE";
96
+ export declare function skyCodeFeedBase(env?: NodeJS.ProcessEnv): string;
@@ -0,0 +1,107 @@
1
+ /**
2
+ * skrr Code update channels — the vocabulary, in the ONE place both readers resolve.
3
+ *
4
+ * It lived in `daemon/src/sky-code/channels.ts`, whose only importer was the
5
+ * daemon's own installer. That was fine while the daemon was the only thing that
6
+ * needed it, and it stopped being fine the moment a user could be told to go
7
+ * looking: `skrr code`'s not-installed message promised that `skrr code doctor`
8
+ * would name "which channel this machine follows and whether that channel has a
9
+ * published release", and the CLI had no access to any of it — so the sentence
10
+ * described a diagnosis nobody had written (dogfood OSK-274).
11
+ *
12
+ * A MIRROR in the CLI was the obvious alternative and is the wrong answer here,
13
+ * with precedent: OSK-3894 shipped exactly that for the harness trust tiers and
14
+ * OSK-3897 removed it, because a mirror proves two copies agree rather than
15
+ * proving there is one copy. `harnessTrust.ts` moved into this package for that
16
+ * reason, the daemon re-exports it, and a static check keeps the daemon from
17
+ * quietly redeclaring. This follows that road rather than reopening the one it
18
+ * replaced.
19
+ *
20
+ * Only the VOCABULARY moves — channel names, the env var, the default, and the
21
+ * URL shape. The installer, the signature verification and the promotion
22
+ * machinery stay in the daemon, which is the only process that performs them.
23
+ */
24
+ /** Channels in promotion order. Index order IS the promotion order. */
25
+ export const SKY_CODE_CHANNELS = ['internal', 'canary', 'beta', 'stable'];
26
+ /**
27
+ * The channel a build without an explicit setting follows.
28
+ *
29
+ * `stable`, and never inferred from anything else. A default that drifted with
30
+ * the build (say, dev builds silently on `canary`) would mean a user's update
31
+ * path depended on how their binary happened to be produced.
32
+ */
33
+ export const DEFAULT_SKY_CODE_CHANNEL = 'stable';
34
+ /** Env var selecting the channel. Explicit opt-in; never set implicitly. */
35
+ export const SKY_CODE_CHANNEL_ENV = 'OVERSKY_SKY_CODE_CHANNEL';
36
+ /** Manifest filename, under a channel prefix or an immutable release prefix. */
37
+ export const SKY_CODE_MANIFEST_FILE = 'sky-code-version.json';
38
+ export function isSkyCodeChannel(value) {
39
+ return typeof value === 'string' && SKY_CODE_CHANNELS.includes(value);
40
+ }
41
+ /**
42
+ * The channel this process should follow.
43
+ *
44
+ * An unrecognised value falls back to the default rather than throwing. A
45
+ * typo'd channel must not brick updates altogether — that turns a harmless
46
+ * mistake into an un-updatable machine, which is the failure the updater exists
47
+ * to prevent. The caller is handed `invalid` so it can say so out loud.
48
+ */
49
+ export function resolveSkyCodeChannel(env = process.env) {
50
+ const raw = env[SKY_CODE_CHANNEL_ENV]?.trim();
51
+ if (!raw)
52
+ return { channel: DEFAULT_SKY_CODE_CHANNEL };
53
+ if (isSkyCodeChannel(raw))
54
+ return { channel: raw };
55
+ return { channel: DEFAULT_SKY_CODE_CHANNEL, invalid: raw };
56
+ }
57
+ /**
58
+ * Where a channel's signed manifest lives.
59
+ *
60
+ * `stable` is NOT special-cased to `latest/`. Two paths that must always agree
61
+ * is a pair that eventually will not, and the one that disagrees silently is
62
+ * the one serving production. `latest/` remains for the daemon feed and for
63
+ * anything already pointing at it; skrr Code channel clients read
64
+ * `channels/<name>/` uniformly.
65
+ */
66
+ export function skyCodeChannelPrefix(channel) {
67
+ return `channels/${channel}/`;
68
+ }
69
+ /**
70
+ * Manifest URL for a channel, or for a pinned version.
71
+ *
72
+ * A pinned version wins over the channel and reads its immutable per-release
73
+ * copy: pinning means "this exact build", and a channel pointer that moved
74
+ * underneath would make the pin a suggestion.
75
+ *
76
+ * Builds only MANIFEST urls, never artifact ones. `buildManifestMessage` signs
77
+ * version, minimum, forceUpdate and the per-platform sha256s; `buildArtifactMessage`
78
+ * signs the artifact URL. Neither signs a channel — so artifact URLs stay
79
+ * channel-independent and promotion is a COPY OF AN ALREADY-SIGNED OBJECT that
80
+ * never needs the release key. Put the channel in the artifact URL instead and
81
+ * every promotion becomes a re-signing ceremony, which decides whether the
82
+ * ed25519 key has to be reachable from routine automation. A helper here that
83
+ * adjusted artifact urls would silently reintroduce exactly that coupling.
84
+ */
85
+ export function resolveChannelManifestUrl(input) {
86
+ const base = input.base.replace(/\/+$/, '');
87
+ if (input.pinnedVersion) {
88
+ return `${base}/releases/${input.pinnedVersion}/${input.manifestFilename}`;
89
+ }
90
+ return `${base}/${skyCodeChannelPrefix(input.channel)}${input.manifestFilename}`;
91
+ }
92
+ /** Default public feed. Mirrors the daemon's `updates.oversky.ai/daemon` prefix. */
93
+ export const DEFAULT_SKY_CODE_FEED_BASE = 'https://updates.oversky.ai/sky-code';
94
+ /**
95
+ * Feed override, read at call time rather than module load so a test or an
96
+ * operator can repoint it without re-importing.
97
+ *
98
+ * Explicit-only: a production user must never be silently enrolled onto a
99
+ * different feed. Selecting a feed changes WHICH signed manifest is read, never
100
+ * WHETHER the signature is checked — every artifact is verified against the
101
+ * pinned keys regardless of where it came from.
102
+ */
103
+ export const SKY_CODE_FEED_BASE_ENV = 'OVERSKY_SKY_CODE_UPDATE_FEED_BASE';
104
+ export function skyCodeFeedBase(env = process.env) {
105
+ const override = (env[SKY_CODE_FEED_BASE_ENV] || '').trim();
106
+ return (override || DEFAULT_SKY_CODE_FEED_BASE).replace(/\/+$/, '');
107
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skrr-ai/auth-core",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "main": "dist/cjs/index.js",
5
5
  "types": "dist/esm/index.d.ts",
6
6
  "exports": {