@ashlr/hub 3.7.0 → 3.9.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 (155) hide show
  1. package/CHANGELOG.md +257 -0
  2. package/dist/build-identity.json +2 -2
  3. package/dist/cli/resource-profile.js +95 -21
  4. package/dist/cli/resource-profile.js.map +1 -1
  5. package/dist/core/policy/local-only.d.ts +142 -2
  6. package/dist/core/policy/local-only.js +204 -15
  7. package/dist/core/policy/local-only.js.map +1 -1
  8. package/dist/core/resources/native-profile.d.ts +56 -0
  9. package/dist/core/resources/native-profile.js +368 -6
  10. package/dist/core/resources/native-profile.js.map +1 -1
  11. package/dist/core/run/budget.d.ts +22 -8
  12. package/dist/core/run/budget.js +80 -12
  13. package/dist/core/run/budget.js.map +1 -1
  14. package/dist/core/run/model-catalog.js +8 -1
  15. package/dist/core/run/model-catalog.js.map +1 -1
  16. package/dist/core/run/sandboxed-engine.js +3 -3
  17. package/dist/core/run/sandboxed-engine.js.map +1 -1
  18. package/dist/core/universe/builtins/preparation/manifest.json +1 -1
  19. package/dist/core/universe/builtins/preparation/preparation-bridge.mjs +69 -10
  20. package/dist/core/universe/builtins/preparation/preparation-verification-fixtures.mjs +68 -9
  21. package/dist/core/verse/adapters/claude.d.ts +49 -2
  22. package/dist/core/verse/adapters/claude.js +317 -56
  23. package/dist/core/verse/adapters/claude.js.map +1 -1
  24. package/dist/core/verse/adapters/codex.d.ts +81 -5
  25. package/dist/core/verse/adapters/codex.js +409 -47
  26. package/dist/core/verse/adapters/codex.js.map +1 -1
  27. package/dist/core/verse/adapters/grok.d.ts +13 -1
  28. package/dist/core/verse/adapters/grok.js +28 -2
  29. package/dist/core/verse/adapters/grok.js.map +1 -1
  30. package/dist/core/verse/adapters/index.d.ts +32 -0
  31. package/dist/core/verse/adapters/index.js +2 -0
  32. package/dist/core/verse/adapters/index.js.map +1 -1
  33. package/dist/core/verse/codex-rollout.d.ts +284 -0
  34. package/dist/core/verse/codex-rollout.js +786 -0
  35. package/dist/core/verse/codex-rollout.js.map +1 -0
  36. package/dist/core/verse/context-fit.d.ts +63 -0
  37. package/dist/core/verse/context-fit.js +355 -0
  38. package/dist/core/verse/context-fit.js.map +1 -0
  39. package/dist/core/verse/context-math.d.ts +215 -0
  40. package/dist/core/verse/context-math.js +365 -0
  41. package/dist/core/verse/context-math.js.map +1 -0
  42. package/dist/core/verse/local-models.d.ts +137 -1
  43. package/dist/core/verse/local-models.js +209 -5
  44. package/dist/core/verse/local-models.js.map +1 -1
  45. package/dist/core/verse/model-windows.d.ts +217 -0
  46. package/dist/core/verse/model-windows.js +616 -0
  47. package/dist/core/verse/model-windows.js.map +1 -0
  48. package/dist/core/verse/preferences.d.ts +123 -0
  49. package/dist/core/verse/preferences.js +403 -0
  50. package/dist/core/verse/preferences.js.map +1 -0
  51. package/dist/core/verse/project-memory.d.ts +112 -0
  52. package/dist/core/verse/project-memory.js +295 -0
  53. package/dist/core/verse/project-memory.js.map +1 -0
  54. package/dist/core/verse/seats.d.ts +106 -4
  55. package/dist/core/verse/seats.js +291 -89
  56. package/dist/core/verse/seats.js.map +1 -1
  57. package/dist/core/verse/session-engine.d.ts +117 -2
  58. package/dist/core/verse/session-engine.js +763 -65
  59. package/dist/core/verse/session-engine.js.map +1 -1
  60. package/dist/core/verse/session-handoff.d.ts +94 -0
  61. package/dist/core/verse/session-handoff.js +551 -0
  62. package/dist/core/verse/session-handoff.js.map +1 -0
  63. package/dist/core/verse/session-search.d.ts +63 -0
  64. package/dist/core/verse/session-search.js +213 -0
  65. package/dist/core/verse/session-search.js.map +1 -0
  66. package/dist/core/verse/session-store.d.ts +16 -2
  67. package/dist/core/verse/session-store.js +80 -6
  68. package/dist/core/verse/session-store.js.map +1 -1
  69. package/dist/core/verse/types.d.ts +333 -1
  70. package/dist/core/verse/types.js +54 -2
  71. package/dist/core/verse/types.js.map +1 -1
  72. package/dist/core/verse/verse-api.d.ts +40 -5
  73. package/dist/core/verse/verse-api.js +724 -25
  74. package/dist/core/verse/verse-api.js.map +1 -1
  75. package/dist/core/web/api.d.ts +14 -4
  76. package/dist/core/web/api.js +26 -11
  77. package/dist/core/web/api.js.map +1 -1
  78. package/dist/core/web/public/next/assets/{App-vtaHB9mp.js → App-XURmiAAp.js} +5 -5
  79. package/dist/core/web/public/next/assets/{App-vtaHB9mp.js.map → App-XURmiAAp.js.map} +1 -1
  80. package/dist/core/web/public/next/assets/{ApprovalsSection-B-bFJ0I9.js → ApprovalsSection-BriUzoZc.js} +2 -2
  81. package/dist/core/web/public/next/assets/{ApprovalsSection-B-bFJ0I9.js.map → ApprovalsSection-BriUzoZc.js.map} +1 -1
  82. package/dist/core/web/public/next/assets/AutonomySection-C4GBsQVc.js +2 -0
  83. package/dist/core/web/public/next/assets/{AutonomySection-DoqmsCjw.js.map → AutonomySection-C4GBsQVc.js.map} +1 -1
  84. package/dist/core/web/public/next/assets/ChatSection-BpOBOUvg.css +1 -0
  85. package/dist/core/web/public/next/assets/ChatSection-hlgPBRco.js +84 -0
  86. package/dist/core/web/public/next/assets/ChatSection-hlgPBRco.js.map +1 -0
  87. package/dist/core/web/public/next/assets/ConfirmDialog-BdQYI-Ng.js +2 -0
  88. package/dist/core/web/public/next/assets/ConfirmDialog-BdQYI-Ng.js.map +1 -0
  89. package/dist/core/web/public/next/assets/{Dialog-CPM9JxBc.js → Dialog-BxdIfmFH.js} +2 -2
  90. package/dist/core/web/public/next/assets/{Dialog-CPM9JxBc.js.map → Dialog-BxdIfmFH.js.map} +1 -1
  91. package/dist/core/web/public/next/assets/{DiffViewer-B84qVef9.js → DiffViewer-DmeRWuc4.js} +2 -2
  92. package/dist/core/web/public/next/assets/{DiffViewer-B84qVef9.js.map → DiffViewer-DmeRWuc4.js.map} +1 -1
  93. package/dist/core/web/public/next/assets/{McpSection-CEUpV_5X.js → McpSection-q34T7Tho.js} +2 -2
  94. package/dist/core/web/public/next/assets/{McpSection-CEUpV_5X.js.map → McpSection-q34T7Tho.js.map} +1 -1
  95. package/dist/core/web/public/next/assets/{MutationTokenDialog-DA8t97XT.js → MutationTokenDialog-CFAkwOEt.js} +2 -2
  96. package/dist/core/web/public/next/assets/{MutationTokenDialog-DA8t97XT.js.map → MutationTokenDialog-CFAkwOEt.js.map} +1 -1
  97. package/dist/core/web/public/next/assets/{ResourcePoolConsoleApp-Bq7Vyud0.js → ResourcePoolConsoleApp-DHc8GFOY.js} +4 -4
  98. package/dist/core/web/public/next/assets/{ResourcePoolConsoleApp-Bq7Vyud0.js.map → ResourcePoolConsoleApp-DHc8GFOY.js.map} +1 -1
  99. package/dist/core/web/public/next/assets/{RouteErrorBoundary-Badio_uO.js → RouteErrorBoundary-ZL9F4qUn.js} +2 -2
  100. package/dist/core/web/public/next/assets/{RouteErrorBoundary-Badio_uO.js.map → RouteErrorBoundary-ZL9F4qUn.js.map} +1 -1
  101. package/dist/core/web/public/next/assets/{Meter-CLcr-4wS.css → Segmented-8cf0Fypn.css} +1 -1
  102. package/dist/core/web/public/next/assets/{Meter--h3MmZS-.js → Segmented-DbRjVye3.js} +2 -2
  103. package/dist/core/web/public/next/assets/Segmented-DbRjVye3.js.map +1 -0
  104. package/dist/core/web/public/next/assets/SettingsSection-nJGGGYqv.js +2 -0
  105. package/dist/core/web/public/next/assets/{SettingsSection-BwrpQlpP.js.map → SettingsSection-nJGGGYqv.js.map} +1 -1
  106. package/dist/core/web/public/next/assets/UniverseConsoleApp-6GJydgo4.js +2 -0
  107. package/dist/core/web/public/next/assets/{UniverseConsoleApp-_FSohAdN.js.map → UniverseConsoleApp-6GJydgo4.js.map} +1 -1
  108. package/dist/core/web/public/next/assets/{UniverseView-DqcXbed4.js → UniverseView-DLDtNYL8.js} +2 -2
  109. package/dist/core/web/public/next/assets/{UniverseView-DqcXbed4.js.map → UniverseView-DLDtNYL8.js.map} +1 -1
  110. package/dist/core/web/public/next/assets/UsageSection-Cf9d9iFH.js +2 -0
  111. package/dist/core/web/public/next/assets/UsageSection-Cf9d9iFH.js.map +1 -0
  112. package/dist/core/web/public/next/assets/VerseConsoleApp-DsdKQoTH.css +1 -0
  113. package/dist/core/web/public/next/assets/VerseConsoleApp-y0uOHixd.js +3 -0
  114. package/dist/core/web/public/next/assets/VerseConsoleApp-y0uOHixd.js.map +1 -0
  115. package/dist/core/web/public/next/assets/{charts-CTZJ-JrH.js → charts-CVooqJWN.js} +2 -2
  116. package/dist/core/web/public/next/assets/{charts-CTZJ-JrH.js.map → charts-CVooqJWN.js.map} +1 -1
  117. package/dist/core/web/public/next/assets/context-model-Bqv8DVuH.js +2 -0
  118. package/dist/core/web/public/next/assets/context-model-Bqv8DVuH.js.map +1 -0
  119. package/dist/core/web/public/next/assets/global-eaY9GyX3.js +2 -0
  120. package/dist/core/web/public/next/assets/global-eaY9GyX3.js.map +1 -0
  121. package/dist/core/web/public/next/assets/{icons-D9vlf85u.js → icons-vex8rclC.js} +2 -2
  122. package/dist/core/web/public/next/assets/{icons-D9vlf85u.js.map → icons-vex8rclC.js.map} +1 -1
  123. package/dist/core/web/public/next/assets/{index-CZamKRUg.js → index-D2Eik-zt.js} +3 -3
  124. package/dist/core/web/public/next/assets/{index-CZamKRUg.js.map → index-D2Eik-zt.js.map} +1 -1
  125. package/dist/core/web/public/next/assets/{queries-B8eBnFox.js → queries-bAYU0VNy.js} +2 -2
  126. package/dist/core/web/public/next/assets/{queries-B8eBnFox.js.map → queries-bAYU0VNy.js.map} +1 -1
  127. package/dist/core/web/public/next/assets/use-guarded-action-C7QrP7Yp.js +2 -0
  128. package/dist/core/web/public/next/assets/{use-guarded-action-bzrVVAYq.js.map → use-guarded-action-C7QrP7Yp.js.map} +1 -1
  129. package/dist/core/web/public/next/assets/verse-model-TfDk9cky.js +2 -0
  130. package/dist/core/web/public/next/assets/verse-model-TfDk9cky.js.map +1 -0
  131. package/dist/core/web/public/next/assets/{workspace-model-v0a1gl-C.js → workspace-model-CHol5RVp.js} +2 -2
  132. package/dist/core/web/public/next/assets/{workspace-model-v0a1gl-C.js.map → workspace-model-CHol5RVp.js.map} +1 -1
  133. package/dist/core/web/public/next/index.html +1 -1
  134. package/dist/release-dependency-inventory.json +1 -1
  135. package/docs/README.md +1 -0
  136. package/package.json +1 -1
  137. package/dist/core/web/public/next/assets/AutonomySection-DoqmsCjw.js +0 -2
  138. package/dist/core/web/public/next/assets/ChatSection-BfnLe5dT.css +0 -1
  139. package/dist/core/web/public/next/assets/ChatSection-vNPIJffd.js +0 -80
  140. package/dist/core/web/public/next/assets/ChatSection-vNPIJffd.js.map +0 -1
  141. package/dist/core/web/public/next/assets/ConfirmDialog-Dd2APQhB.js +0 -2
  142. package/dist/core/web/public/next/assets/ConfirmDialog-Dd2APQhB.js.map +0 -1
  143. package/dist/core/web/public/next/assets/Meter--h3MmZS-.js.map +0 -1
  144. package/dist/core/web/public/next/assets/SettingsSection-BwrpQlpP.js +0 -2
  145. package/dist/core/web/public/next/assets/UniverseConsoleApp-_FSohAdN.js +0 -2
  146. package/dist/core/web/public/next/assets/UsageSection-Bq6Daaby.js +0 -2
  147. package/dist/core/web/public/next/assets/UsageSection-Bq6Daaby.js.map +0 -1
  148. package/dist/core/web/public/next/assets/VerseConsoleApp-CMkCizvL.css +0 -1
  149. package/dist/core/web/public/next/assets/VerseConsoleApp-CsIQv9id.js +0 -3
  150. package/dist/core/web/public/next/assets/VerseConsoleApp-CsIQv9id.js.map +0 -1
  151. package/dist/core/web/public/next/assets/global-D6bTxIRn.js +0 -2
  152. package/dist/core/web/public/next/assets/global-D6bTxIRn.js.map +0 -1
  153. package/dist/core/web/public/next/assets/use-guarded-action-bzrVVAYq.js +0 -2
  154. package/dist/core/web/public/next/assets/verse-model-CvtK6vP6.js +0 -2
  155. package/dist/core/web/public/next/assets/verse-model-CvtK6vP6.js.map +0 -1
@@ -10,9 +10,31 @@
10
10
  * its own process-group leader (`detached: true`) so cancellation signals the
11
11
  * whole group, escalating SIGINT → SIGKILL after a grace period, with a bounded
12
12
  * drain so a descendant holding our pipes cannot keep a turn "running" forever.
13
+ *
14
+ * CONTEXT (V3.9, docs/VERSE-CONTEXT.md). The engine is the one place a
15
+ * session's context budget is decided and kept current:
16
+ * - at creation, from the seat's model option and the session's mode
17
+ * (`budgetFor`), recorded on `usage` with where the window came from;
18
+ * - on every reading, a window the CLI reports at runtime WINS over the
19
+ * catalog (a 1M Claude model the CLI clamps to 200k is a 200k session),
20
+ * and the compaction point is recomputed for it (`reconcileAutoCompactAt`);
21
+ * - `context` / `compaction` events replace occupancy and count compactions;
22
+ * - adapters that can only see exact occupancy in the CLI's own files
23
+ * (codex rollouts) get bounded telemetry hooks: polled while the turn
24
+ * runs, and called once after the parser has flushed.
25
+ * None of this spends: it reads what the CLI already reported or wrote.
26
+ *
27
+ * LOCAL-ONLY. Because the spawn is raw rather than routed through
28
+ * `run/engines.spawnEngine`, this module is a SECOND subprocess funnel and none
29
+ * of the daemon's gates cover it. It therefore carries its own call to the one
30
+ * shared predicate (`policy/local-only.decidePermission`, reached through its
31
+ * published wrappers) at the top of `startTurn` — see `verseSeatPermitted`.
13
32
  */
14
33
  import { spawn as nodeSpawn } from 'node:child_process';
15
- import { type VerseCreateSessionRequest, type VerseEvent, type VerseSeat, type VerseSession } from './types.js';
34
+ import { type LocalOnlyVerdict } from '../policy/local-only.js';
35
+ import type { AshlrConfig } from '../types.js';
36
+ import { type VerseAdapter } from './adapters/index.js';
37
+ import { type VerseContextMode, type VerseCreateSessionRequest, type VerseEngine, type VerseEvent, type VerseModelOption, type VerseSeat, type VerseSession } from './types.js';
16
38
  export type VerseErrorCode = 'VERSE_SESSION_NOT_FOUND' | 'VERSE_SESSION_BUSY' | 'VERSE_INVALID' | 'VERSE_TOO_LARGE';
17
39
  export declare class VerseError extends Error {
18
40
  readonly code: VerseErrorCode;
@@ -38,16 +60,72 @@ export interface VerseSeatLaunch {
38
60
  * means "the Ollama lane", which is what those sessions were created on.
39
61
  */
40
62
  anthropicBaseUrl?: string;
63
+ /**
64
+ * V3.9 ADDITIVE. Shared project memory offered to this session, SNAPSHOTTED
65
+ * at creation: `dir` is the private memory directory, `block` the exact text
66
+ * appended to the CLI's system prompt on EVERY turn. Pinned rather than
67
+ * re-rendered per turn so the prompt prefix stays byte-identical and the
68
+ * provider's prompt cache survives; agents read the live file from `dir`.
69
+ * Absent = memory off for this session (and on every older record).
70
+ */
71
+ memory?: {
72
+ dir: string;
73
+ block: string;
74
+ writable: boolean;
75
+ };
76
+ }
77
+ /** V3.9 — creation-time extras the API resolves (preferences, provenance); never read off a request body. */
78
+ export interface VerseCreateOptions {
79
+ memory?: {
80
+ dir: string;
81
+ block: string;
82
+ writable: boolean;
83
+ } | null;
84
+ handoffFrom?: {
85
+ sessionId: string;
86
+ title: string;
87
+ } | null;
41
88
  }
42
89
  export interface VerseEngineHandle {
43
90
  listSessions(): VerseSession[];
44
91
  getSession(id: string): VerseSession | null;
45
92
  getEvents(id: string, fromSeq?: number): VerseEvent[];
46
- createSession(req: VerseCreateSessionRequest, launch: VerseSeatLaunch): VerseSession;
93
+ /**
94
+ * `opts` carries what the API resolved server-side (memory snapshot, handoff
95
+ * provenance). Omitted by every pre-3.9 caller, whose records then carry no
96
+ * memory or handoff keys at all.
97
+ */
98
+ createSession(req: VerseCreateSessionRequest, launch: VerseSeatLaunch, opts?: VerseCreateOptions): VerseSession;
47
99
  sendTurn(id: string, text: string): {
48
100
  turnId: string;
49
101
  session: VerseSession;
50
102
  };
103
+ /**
104
+ * V3.9. Switch the session's context budget. Takes effect from the NEXT turn
105
+ * (it only changes CLI flags, never prompt content, so the cache survives).
106
+ * Refused while a turn runs — that turn was launched with the old flags and
107
+ * its readings must be measured against them — and for a mode the model has
108
+ * no budget for.
109
+ */
110
+ setContextMode(id: string, mode: VerseContextMode): VerseSession;
111
+ /**
112
+ * V3.9. Re-read a LOCAL session's window from the seat's LIVE option (the
113
+ * API calls this before each turn with the option discovery resolves now).
114
+ *
115
+ * Local windows are the runtime's allocation — the dispatch lane, the pinned
116
+ * `num_ctx`, what `/api/ps` has resident — and change after a chat is
117
+ * created; a pre-3.9 record may even hold a window the old discovery got
118
+ * wrong (262,144 stored for a `-ctx64k` tag that serves 65,536). The CLI is
119
+ * told `usage.contextWindow` (`CLAUDE_CODE_MAX_CONTEXT_TOKENS`) and the meter
120
+ * draws the same field, so correcting it HERE, before the launch, keeps what
121
+ * the CLI compacts against and what the operator sees one number.
122
+ *
123
+ * Writes (and emits one `context` event) only when window, compaction point
124
+ * or source actually changed. A no-op for any other engine, and for an
125
+ * option with no window. Refused while a turn runs (its CLI was launched
126
+ * with the old window) and for an option naming a different model.
127
+ */
128
+ refreshLocalWindow(id: string, option: VerseModelOption): VerseSession;
51
129
  cancelTurn(id: string): boolean;
52
130
  deleteSession(id: string): void;
53
131
  renameSession(id: string, title: string): VerseSession;
@@ -65,6 +143,43 @@ export interface VerseEngineOptions {
65
143
  turnTimeoutMs?: number;
66
144
  /** SIGINT → SIGKILL escalation delay. Default 10s. */
67
145
  killGraceMs?: number;
146
+ /**
147
+ * Read the operator config that the local-only gate consults.
148
+ *
149
+ * Called ONCE PER TURN rather than once at construction, deliberately: the
150
+ * cockpit's Local-only switch writes `~/.ashlr/config.json` while this engine
151
+ * is already live, and a mode read at startup would leave the switch looking
152
+ * like it did nothing until a restart. `undefined` means "no config in hand",
153
+ * which the policy answers from env + its process latch — i.e. toward refusal.
154
+ *
155
+ * Default: `loadConfigReadOnly()`, which never creates, seeds or writes the
156
+ * file. The config is the user's; this module only ever reads it.
157
+ */
158
+ loadConfig?: () => AshlrConfig | undefined;
159
+ /** Adapter resolver. Default: `adapters/index.adapterFor`. A test seam, like `spawn`. */
160
+ adapterFor?: (engine: VerseEngine) => VerseAdapter;
161
+ /** Telemetry poll interval for adapters with `pollTelemetry`. Default VERSE_TELEMETRY_POLL_MS. */
162
+ telemetryPollMs?: number;
68
163
  }
164
+ /**
165
+ * Is this SEAT permitted to run a turn right now?
166
+ *
167
+ * NOT a second policy predicate — that is the point. Both branches delegate to
168
+ * `decidePermission()` through its published wrappers, so "local" means here
169
+ * exactly what it means at the daemon's chokepoints. This function contributes
170
+ * only the mapping from a Verse seat to a subject the predicate understands:
171
+ *
172
+ * claude / codex / grok — a Verse engine id IS the registry engine id, so
173
+ * `enginePermitted` classifies it directly (cli-agent → cloud for claude and
174
+ * codex, api-model at api.x.ai → cloud for grok).
175
+ *
176
+ * local — a local seat is discovered from a serving runtime and has no
177
+ * registry engine to name, so the ENDPOINT it dispatches to is the truth
178
+ * and `endpointPermitted` classifies that. A loopback runtime (the default,
179
+ * and every local seat today) is permitted exactly as before. One repointed
180
+ * at a remote inference host is refused, because that one would spend — the
181
+ * same rule the raw-transport sites apply to `cfg.foundry.ollamaBaseUrl`.
182
+ */
183
+ export declare function verseSeatPermitted(engine: VerseEngine, launch: VerseSeatLaunch, cfg: AshlrConfig | undefined): LocalOnlyVerdict;
69
184
  export declare function buildTurnEnv(extra: Record<string, string>, base?: NodeJS.ProcessEnv): Record<string, string>;
70
185
  export declare function createVerseEngine(opts?: VerseEngineOptions): VerseEngineHandle;