@arcforge/types 2.0.159 → 2.0.161

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/types",
3
- "version": "2.0.159",
3
+ "version": "2.0.161",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "main": "./src/index.ts",
@@ -41,16 +41,36 @@ export type CognetSchedule =
41
41
  | { kind: "continuous" }
42
42
 
43
43
  /**
44
- * Cognet identity — what cognet.config.ts declares via defineCognet().
45
- * The compiled artifact composes this with the loop the entry script
46
- * registers; identity and behavior never live in the same file.
44
+ * What cognet.config.ts declares via defineCognet() — the cognet's own
45
+ * DECLARED shape, and nothing that is already a fact elsewhere.
46
+ *
47
+ * Deliberately not identity: `name` and `version` used to live here and were
48
+ * a second copy of what the cognet's package.json already said. Two writable
49
+ * sources for one fact drift, and they did — @axon/zero shipped as 1.0.44
50
+ * while telling the kernel it was 0.1.2, because publish read the package and
51
+ * the runtime read the config. Identity now has exactly one home; this file
52
+ * declares only what the author actually decides.
53
+ *
54
+ * The compiled artifact composes this with resolved identity and the loop the
55
+ * entry script registers — see CognetDefinition. Identity, declaration and
56
+ * behavior never live in the same file.
47
57
  */
48
58
  export type CognetConfig = {
49
- name: string
50
- version: string
51
-
52
- /** The kernel ABI version this cognet was built against — checked at load, mismatch refuses loudly. */
53
- abi: string
59
+ /**
60
+ * The kernel ABI version this cognet targets — checked at load, mismatch
61
+ * refuses loudly.
62
+ *
63
+ * OPTIONAL, and omitting it is the right default. A cognet is published as
64
+ * SOURCE and compiled by the consumer against the kernel it will actually
65
+ * run on, so "the ABI I was built against" is a fact the compile step
66
+ * knows and the author does not. Absent, the compile stamps in the ABI it
67
+ * compiled against — truthful by construction.
68
+ *
69
+ * Pin it only to make a cognet REFUSE a kernel it has not been validated
70
+ * against. That is a deliberate assertion, and deliberate assertions go in
71
+ * the file.
72
+ */
73
+ abi?: string
54
74
 
55
75
  /** How the scheduler invokes this cognet. */
56
76
  mode: CognetSchedule
@@ -129,7 +149,32 @@ export type ModelRef =
129
149
  sha256?: string
130
150
  }
131
151
 
132
- export type CognetDefinition = CognetConfig & {
152
+ /**
153
+ * What the author declared, plus the identity the compile step resolved.
154
+ *
155
+ * `name`/`version`/`abi` are REQUIRED here and absent from CognetConfig: the
156
+ * author writes none of them. Name and version come from the cognet's
157
+ * package.json (the one identity the registry, the installer and the manifest
158
+ * already agree on), and the ABI from the kernel the compile ran against
159
+ * unless the config pinned one. The compile step is where the three become
160
+ * facts; before it they are questions the author cannot answer.
161
+ *
162
+ * This is what the generated entry hands CognetHost — never the author's
163
+ * cognet.config.ts on its own.
164
+ */
165
+ export type CognetIdentity = Omit<CognetConfig, "abi"> & {
166
+ /** Package name — from the cognet's package.json, never authored. */
167
+ name: string
168
+
169
+ /** Package version — from the cognet's package.json, never authored. */
170
+ version: string
171
+
172
+ /** The kernel ABI this artifact was compiled against, or the pinned one. */
173
+ abi: string
174
+ }
175
+
176
+ /** A compiled cognet — identity resolved, ABI stamped, behavior attached. */
177
+ export type CognetDefinition = CognetIdentity & {
133
178
 
134
179
  /** exec(): receives the syscall table. Runs once, before any wake. */
135
180
  load(kernel: KernelAbi): Promise<void> | void
@@ -1,3 +1,3 @@
1
- export type { CognetConfig, CognetDefinition, CognetSchedule, ModelRef } from "./cognet"
1
+ export type { CognetConfig, CognetIdentity, CognetDefinition, CognetSchedule, ModelRef } from "./cognet"
2
2
  export type { CognetBlueprint } from "./blueprint"
3
3
  export type { CognetHooks, CognetHookName, CognetPlugin, CognetPluginContext } from "./hooks"