@arcforge/types 2.0.214 → 2.0.216
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 +3 -2
- package/src/session/events/cognet.ts +92 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcforge/types",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.216",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -44,5 +44,6 @@
|
|
|
44
44
|
"ai-agent",
|
|
45
45
|
"agent-runtime",
|
|
46
46
|
"typescript"
|
|
47
|
-
]
|
|
47
|
+
],
|
|
48
|
+
"axonRevision": "1142da36e6cfed36fe03f3b5e91a04cc01929d6e"
|
|
48
49
|
}
|
|
@@ -82,11 +82,101 @@ export type CognetEventMap =
|
|
|
82
82
|
"cognet:knowledge:write": { name: string }
|
|
83
83
|
"cognet:knowledge:remove": { name: string }
|
|
84
84
|
|
|
85
|
+
// ── World schema ─────────────────────────────────────────────────────────
|
|
86
|
+
//
|
|
87
|
+
// A component type describes itself ONCE, when the world first sees it.
|
|
88
|
+
//
|
|
89
|
+
// The alternative — shape metadata on every write — repeats "Fear is a
|
|
90
|
+
// scalar in 0..1" twenty times a second in the highest-volume family in
|
|
91
|
+
// the system. Declaring once also means a reader can render a component
|
|
92
|
+
// before any value has arrived, so panes exist from world spawn rather
|
|
93
|
+
// than appearing on first write.
|
|
94
|
+
//
|
|
95
|
+
// `frame` is not decoration. A position or field is meaningless without
|
|
96
|
+
// knowing whether it is measured from the body, from a remembered anchor,
|
|
97
|
+
// or in world coordinates, and a reader that guesses draws a convincing
|
|
98
|
+
// lie. Components carrying no spatial claim declare "none".
|
|
99
|
+
"cognet:component:declare": {
|
|
100
|
+
component: string
|
|
101
|
+
/**
|
|
102
|
+
* What the value is INDEXED BY — the thing that decides how a reader
|
|
103
|
+
* lays it out. A mood and a depth map are both scalars; one is a
|
|
104
|
+
* scalar at a point and the other a scalar over an image, and only
|
|
105
|
+
* the domain distinguishes them.
|
|
106
|
+
*/
|
|
107
|
+
domain: "point" | "space" | "time" | "sequence" | "tree" | "set"
|
|
108
|
+
/** What sits at one index. */
|
|
109
|
+
shape: "scalar" | "vector" | "categorical" | "record"
|
|
110
|
+
/** Physical unit for scalar/vector readings — "hp", "px/tick", "bool". */
|
|
111
|
+
unit?: string
|
|
112
|
+
/** Expected bounds, so a reader can scale without waiting for outliers. */
|
|
113
|
+
range?: [number, number]
|
|
114
|
+
/** Component names, in value order. Vectors only. */
|
|
115
|
+
labels?: string[]
|
|
116
|
+
/** The permitted values. Categoricals only. */
|
|
117
|
+
options?: string[]
|
|
118
|
+
/**
|
|
119
|
+
* The declared frame this value is expressed in, by name.
|
|
120
|
+
*
|
|
121
|
+
* A NAME rather than an enum: an agent may hold eight cameras, a
|
|
122
|
+
* joint space, and a dependency graph, and a fixed list of spatial
|
|
123
|
+
* words cannot describe any of them. Absent means the belief makes no
|
|
124
|
+
* positional claim at all. See cognet:frame:declare.
|
|
125
|
+
*/
|
|
126
|
+
frame?: string
|
|
127
|
+
/**
|
|
128
|
+
* Whether this belief is in the WORKSPACE — the pool a mind's attention
|
|
129
|
+
* may draw from, as opposed to the machinery it runs on.
|
|
130
|
+
*
|
|
131
|
+
* A reader can therefore show what a mind could in principle attend to,
|
|
132
|
+
* separately from everything it merely stores.
|
|
133
|
+
*/
|
|
134
|
+
workspace?: boolean
|
|
135
|
+
}
|
|
136
|
+
|
|
85
137
|
// ── World writes ─────────────────────────────────────────────────────────
|
|
138
|
+
//
|
|
139
|
+
// `value` carries the data itself, which is what makes the world
|
|
140
|
+
// reconstructible from the log rather than merely auditable. Without it
|
|
141
|
+
// these events say a component changed but never to what, so no reader
|
|
142
|
+
// can render the mind's contents and no replay can rebuild them.
|
|
143
|
+
//
|
|
144
|
+
// The volume this implies is governed at the WRITE — Component() emits an
|
|
145
|
+
// update only when the value actually changed. That keeps the log a record
|
|
146
|
+
// of change rather than a stream of identical snapshots, and it is the
|
|
147
|
+
// reason this family can afford to carry data at all.
|
|
148
|
+
//
|
|
149
|
+
// OPTIONAL, deliberately. A cognet is a prebuilt bundle carrying its own
|
|
150
|
+
// inlined host, so bundles compiled before this field existed are still
|
|
151
|
+
// running and still emitting these events without it. Declaring it required
|
|
152
|
+
// would make the type a lie about the wire AND force an ABI bump, which
|
|
153
|
+
// refuses every already-published cognet for a field no reader needs in
|
|
154
|
+
// order to function. A reader that has no value renders nothing for that
|
|
155
|
+
// belief, which is the correct outcome.
|
|
156
|
+
// ── Frames ───────────────────────────────────────────────────────────────
|
|
157
|
+
//
|
|
158
|
+
// A frame is a space beliefs can be positioned in, and the reason two of
|
|
159
|
+
// them can be layered: depth over a camera image, danger over a world map,
|
|
160
|
+
// coverage over a call graph.
|
|
161
|
+
//
|
|
162
|
+
// Deliberately NOT restricted to metric space. A dependency graph, a file
|
|
163
|
+
// tree and a conversation are all spaces with positions and neighbours, so
|
|
164
|
+
// a mind with no physical body still composes its beliefs the same way —
|
|
165
|
+
// which is what keeps this contract honest for agents that never see
|
|
166
|
+
// anything.
|
|
167
|
+
"cognet:frame:declare": {
|
|
168
|
+
frame: string
|
|
169
|
+
kind: "metric2d" | "metric3d" | "graph" | "tree" | "sequence"
|
|
170
|
+
/** Physical unit of the axes, for metric frames. */
|
|
171
|
+
unit?: string
|
|
172
|
+
/** Size along each axis, so a reader can scale without waiting for outliers. */
|
|
173
|
+
extent?: number[]
|
|
174
|
+
}
|
|
175
|
+
|
|
86
176
|
"cognet:entity:add": { tick: number; phase: string | null; entity: string }
|
|
87
177
|
"cognet:entity:remove": { tick: number; phase: string | null; entity: string }
|
|
88
178
|
|
|
89
|
-
"cognet:component:add": { tick: number; phase: string | null; entity: string; component: string }
|
|
90
|
-
"cognet:component:update": { tick: number; phase: string | null; entity: string; component: string }
|
|
179
|
+
"cognet:component:add": { tick: number; phase: string | null; entity: string; component: string; value?: unknown }
|
|
180
|
+
"cognet:component:update": { tick: number; phase: string | null; entity: string; component: string; value?: unknown }
|
|
91
181
|
"cognet:component:remove": { tick: number; phase: string | null; entity: string; component: string }
|
|
92
182
|
}
|