@arcforge/kernel 2.0.108 → 2.0.110

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcforge/kernel",
3
- "version": "2.0.108",
3
+ "version": "2.0.110",
4
4
  "description": "The Axon kernel — ring 0. Owns resources and execution, enforces policy, and is the only constructor of the unprivileged capsule.",
5
5
  "type": "module",
6
6
  "private": false,
@@ -15,13 +15,13 @@
15
15
  "deploy": "echo \"This package is published ONLY by apps/tui/scripts/release.ts, which pins workspace:* deps to concrete versions first. Publishing it directly ships an unresolvable dependency.\" && exit 1"
16
16
  },
17
17
  "dependencies": {
18
- "@arcforge/cognet": "2.0.108",
19
- "@arcforge/engines": "2.0.108",
20
- "@arcforge/err": "2.0.108",
21
- "@arcforge/session": "2.0.108",
22
- "@arcforge/types": "2.0.108",
23
- "@arclabs/cloud": "2.0.108",
24
- "@axon/capsule": "2.0.108"
18
+ "@arcforge/cognet": "2.0.110",
19
+ "@arcforge/engines": "2.0.110",
20
+ "@arcforge/err": "2.0.110",
21
+ "@arcforge/session": "2.0.110",
22
+ "@arcforge/types": "2.0.110",
23
+ "@arclabs/cloud": "2.0.110",
24
+ "@axon/capsule": "2.0.110"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@types/bun": "latest",
package/src/kernel.ts CHANGED
@@ -283,6 +283,19 @@ export async function Kernel(opts: KernelOpts) {
283
283
  scheduler.attach(cognet)
284
284
 
285
285
  return {
286
+ /**
287
+ * Whether a cognet is loaded and able to wake.
288
+ *
289
+ * False after a failed load or a reload whose new brain did not
290
+ * compile: the process is alive and serving HTTP, but there is
291
+ * nothing to think with. An agent in that state must not report
292
+ * itself healthy — it looks fine from outside while silently
293
+ * answering nothing.
294
+ */
295
+ get ready() {
296
+ return scheduler.loaded
297
+ },
298
+
286
299
  /** Invoke on a stimulus arrival — invocation-mode cognets only; throws for continuous-mode. */
287
300
  stream(input: KernelInput = {}) {
288
301
  return scheduler.stream(input)
@@ -365,6 +378,10 @@ export async function Kernel(opts: KernelOpts) {
365
378
  // rethrown after the box is definitely gone.
366
379
  const unloadStarted = Date.now()
367
380
  await session.commit("cognet:unload:start", { name: cognet.name })
381
+ // Before the unload, not after: whether it succeeds or throws, a
382
+ // brain being torn down can no longer wake, and readiness must
383
+ // stop claiming otherwise the moment that becomes true.
384
+ scheduler.detach()
368
385
  let failure: ReturnType<typeof err> | null = null
369
386
  try {
370
387
  await cognet.unload()
@@ -121,6 +121,19 @@ export function Scheduler(opts: SchedulerOpts) {
121
121
  cognet = next
122
122
  },
123
123
 
124
+ /**
125
+ * Forget the cognet — the counterpart to attach(), run when the brain
126
+ * is unloaded.
127
+ *
128
+ * `attach` had no opposite, so `loaded` stayed true after a shutdown
129
+ * or a failed reload: the scheduler still held a reference to a brain
130
+ * that could no longer wake, and readiness reported healthy for an
131
+ * agent with nothing to think with.
132
+ */
133
+ detach() {
134
+ cognet = null
135
+ },
136
+
124
137
  /**
125
138
  * Advance a continuous cognet by one wake. The clock belongs to the
126
139
  * body (a plugin driving `axon.tick()`), never to this scheduler —