@arcforge/types 2.0.199 → 2.0.201
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 +1 -1
- package/src/cognet/blueprint.ts +11 -2
- package/src/cognet/cognet.ts +38 -2
- package/src/cognet/index.ts +1 -1
- package/src/config.ts +5 -3
- package/src/engine.ts +7 -4
- package/src/handle.ts +5 -3
- package/src/inference.ts +25 -0
- package/src/kernel/abi.ts +31 -13
- package/src/prompts.ts +2 -0
- package/src/session/events/stdio/stimuli.ts +5 -0
- package/src/session/index.ts +1 -1
- package/src/supervisor.ts +2 -2
package/package.json
CHANGED
package/src/cognet/blueprint.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AxonEntryEvent } from "../session/events/entries"
|
|
2
|
-
import type { CognetDefinition } from "./cognet"
|
|
3
|
-
import type { EngineRequirements } from "../inference"
|
|
2
|
+
import type { CognetDefinition, CognetStimulusSupport } from "./cognet"
|
|
3
|
+
import type { EngineRequirements, ResolvedEngineFacts } from "../inference"
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* The cognet slot in the agent blueprint — how a brain reaches the runtime.
|
|
@@ -26,6 +26,15 @@ export type CognetBlueprint = {
|
|
|
26
26
|
/** Declarative wake mask — overrides the definition's own default. */
|
|
27
27
|
wakeOn?: Array<keyof AxonEntryEvent>
|
|
28
28
|
|
|
29
|
+
/** Input modalities the brain declares it knows how to consume. */
|
|
30
|
+
stimuli?: CognetStimulusSupport
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Actual role facts resolved by a supervisor before confinement.
|
|
34
|
+
* Contains no provider/model identity or credentials.
|
|
35
|
+
*/
|
|
36
|
+
resolvedEngines?: Readonly<Record<string, ResolvedEngineFacts>>
|
|
37
|
+
|
|
29
38
|
/**
|
|
30
39
|
* Resolved model weights — the cognet's local name → an absolute path on
|
|
31
40
|
* THIS machine, already fetched and verified.
|
package/src/cognet/cognet.ts
CHANGED
|
@@ -40,6 +40,24 @@ export type CognetSchedule =
|
|
|
40
40
|
| { kind: "invocation" }
|
|
41
41
|
| { kind: "continuous" }
|
|
42
42
|
|
|
43
|
+
/**
|
|
44
|
+
* When this brain can consume one input modality.
|
|
45
|
+
*
|
|
46
|
+
* `true` means cognition itself owns a path regardless of inference bindings.
|
|
47
|
+
* An engine condition means the path is available only when that resolved role
|
|
48
|
+
* actually accepts the same modality. `any` supports multi-model fallbacks
|
|
49
|
+
* without exposing provider or model identity.
|
|
50
|
+
*/
|
|
51
|
+
export type CognetStimulusCondition =
|
|
52
|
+
| true
|
|
53
|
+
| { engine: string }
|
|
54
|
+
| { any: string[] }
|
|
55
|
+
|
|
56
|
+
export type CognetStimulusSupport = Partial<Record<
|
|
57
|
+
"text" | "image" | "audio" | "video" | "vector",
|
|
58
|
+
CognetStimulusCondition
|
|
59
|
+
>>
|
|
60
|
+
|
|
43
61
|
/**
|
|
44
62
|
* What cognet.config.ts declares via defineCognet() — the cognet's own
|
|
45
63
|
* DECLARED shape, and nothing that is already a fact elsewhere.
|
|
@@ -78,6 +96,14 @@ export type CognetConfig = {
|
|
|
78
96
|
/** Default wake mask — overridable by the blueprint's wakeOn. Absent = wake on everything. */
|
|
79
97
|
wakeOn?: Array<keyof AxonEntryEvent>
|
|
80
98
|
|
|
99
|
+
/**
|
|
100
|
+
* Input modalities this brain has an explicit cognitive path for.
|
|
101
|
+
*
|
|
102
|
+
* This is distinct from engine capability: a multimodel brain may accept
|
|
103
|
+
* images through a fallback even when its cortex is text-only.
|
|
104
|
+
*/
|
|
105
|
+
stimuli?: CognetStimulusSupport
|
|
106
|
+
|
|
81
107
|
/**
|
|
82
108
|
* Hard safety bound for one wake. Omitted means UNBOUNDED, which is the
|
|
83
109
|
* default and the right one for most cognets.
|
|
@@ -141,12 +167,22 @@ export type ModelRef =
|
|
|
141
167
|
| {
|
|
142
168
|
/** `owner/repo` on Hugging Face. */
|
|
143
169
|
hf: string
|
|
144
|
-
/**
|
|
145
|
-
|
|
170
|
+
/** Set this when Axon must materialize the complete repository directory. */
|
|
171
|
+
set?: boolean
|
|
172
|
+
/** Path within the repo. Required unless `set: true` requests the complete repository. */
|
|
173
|
+
file?: string
|
|
146
174
|
/** Git revision. Defaults to `main`. */
|
|
147
175
|
rev?: string
|
|
148
176
|
/** Expected content hash. Pin it and a changed upstream is an error, not a surprise. */
|
|
149
177
|
sha256?: string
|
|
178
|
+
/** Optional capability metadata for Axond's local provider catalogue. */
|
|
179
|
+
capability?: string
|
|
180
|
+
/** Engine handle shape: generate, transform, or stream. */
|
|
181
|
+
type?: "generate" | "transform" | "stream"
|
|
182
|
+
/** Accepted input modalities. */
|
|
183
|
+
in?: string[]
|
|
184
|
+
/** Produced output modalities. */
|
|
185
|
+
out?: string[]
|
|
150
186
|
}
|
|
151
187
|
|
|
152
188
|
/**
|
package/src/cognet/index.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export type { CognetConfig, CognetIdentity, CognetDefinition, CognetSchedule, ModelRef } from "./cognet"
|
|
1
|
+
export type { CognetConfig, CognetIdentity, CognetDefinition, CognetSchedule, CognetStimulusCondition, CognetStimulusSupport, ModelRef } from "./cognet"
|
|
2
2
|
export type { CognetBlueprint } from "./blueprint"
|
|
3
3
|
export type { CognetHooks, CognetHookName, CognetPlugin, CognetPluginContext } from "./hooks"
|
package/src/config.ts
CHANGED
|
@@ -181,9 +181,11 @@ export type AxonConfig<EventMap extends Record<string, unknown> = Record<string,
|
|
|
181
181
|
modules?: ModuleEntry[]
|
|
182
182
|
|
|
183
183
|
/**
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
*
|
|
184
|
+
* Control repository workspace integration.
|
|
185
|
+
*
|
|
186
|
+
* Workspace prompts are loaded by default from the nearest `.agents/prompts`
|
|
187
|
+
* directory found from the invocation cwd, under the `workspace:` namespace.
|
|
188
|
+
* Set false to opt out. Other workspace surfaces are not loaded yet.
|
|
187
189
|
*/
|
|
188
190
|
workspace?: boolean
|
|
189
191
|
}
|
package/src/engine.ts
CHANGED
|
@@ -371,10 +371,13 @@ export type AxonEngineCall = AxonEngineRequest & {
|
|
|
371
371
|
*/
|
|
372
372
|
export type AirProtocolName = "classic" | "raw"
|
|
373
373
|
|
|
374
|
-
export type
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
374
|
+
export type AxonEngineContent =
|
|
375
|
+
| { type: "text"; text: string }
|
|
376
|
+
| { type: "image"; ref: import("./session").StimulusRef }
|
|
377
|
+
|
|
378
|
+
export type AxonEngineMessage =
|
|
379
|
+
| { role: "system"; content: string }
|
|
380
|
+
| { role: "user" | "assistant"; content: string | AxonEngineContent[] }
|
|
378
381
|
|
|
379
382
|
/** Request payload passed to an engine. */
|
|
380
383
|
export type AxonEngineRequest = {
|
package/src/handle.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { EscalationCall } from "./policy"
|
|
2
|
-
import type { AxonEntry, AxonKernelEvent, AxonSessionEvent, AxonStimulusEvent, AxonStimulusType } from "./session"
|
|
2
|
+
import type { AxonEntry, AxonKernelEvent, AxonSessionEvent, AxonStimulusEvent, AxonStimulusInput, AxonStimulusType } from "./session"
|
|
3
3
|
import type { AxonOutputEvent } from "./session/events/stdio/output"
|
|
4
4
|
import type { AxonScript } from "./scripts"
|
|
5
5
|
import type { AxonPrompt, AxonPromptName, AxonPromptProps } from "./prompts"
|
|
@@ -23,8 +23,10 @@ import type { AxonAmbient } from "./session/events/activity"
|
|
|
23
23
|
|
|
24
24
|
/** Input to a single agent invocation. */
|
|
25
25
|
export type AxonRequestInput = {
|
|
26
|
-
/**
|
|
27
|
-
prompt
|
|
26
|
+
/** Text shorthand retained for every existing caller. */
|
|
27
|
+
prompt?: string | string[]
|
|
28
|
+
/** Ordered heterogeneous stimuli, all committed before one wake starts. */
|
|
29
|
+
stimuli?: AxonStimulusInput[]
|
|
28
30
|
/**
|
|
29
31
|
* The surface this message arrived on — and the address a reply goes back
|
|
30
32
|
* to. `terminal`, `axon-cli`, `telegram:8199237521`.
|
package/src/inference.ts
CHANGED
|
@@ -79,6 +79,18 @@ export type EngineRequirement = {
|
|
|
79
79
|
/** Produced output modalities. A single value is shorthand for one. */
|
|
80
80
|
out: Modality | Modality[]
|
|
81
81
|
|
|
82
|
+
/**
|
|
83
|
+
* Modalities that improve this role but are not required for it to run.
|
|
84
|
+
*
|
|
85
|
+
* Resolution prefers candidates covering these after honoring an explicit
|
|
86
|
+
* user model choice, then falls back to any candidate satisfying `in`.
|
|
87
|
+
* The bound handle reports what it actually got.
|
|
88
|
+
*/
|
|
89
|
+
prefer?: {
|
|
90
|
+
in?: Modality | Modality[]
|
|
91
|
+
out?: Modality | Modality[]
|
|
92
|
+
}
|
|
93
|
+
|
|
82
94
|
/**
|
|
83
95
|
* Minimum usable context window, in tokens. Only meaningful for
|
|
84
96
|
* "generate" — a VAD has no context and declaring one is a category
|
|
@@ -194,6 +206,19 @@ export type EngineCapability = {
|
|
|
194
206
|
* site can never block on it and can never fail differently on the second
|
|
195
207
|
* tick than the first.
|
|
196
208
|
*/
|
|
209
|
+
/**
|
|
210
|
+
* Sanitized facts about one resolved role.
|
|
211
|
+
*
|
|
212
|
+
* Safe to cross confinement: these describe what the handle can do, never
|
|
213
|
+
* which provider/model supplies it or which credential reaches it.
|
|
214
|
+
*/
|
|
215
|
+
export type ResolvedEngineFacts = {
|
|
216
|
+
type: EngineType
|
|
217
|
+
context?: number
|
|
218
|
+
modalities: { in: Modality[]; out: Modality[] }
|
|
219
|
+
slots: number
|
|
220
|
+
}
|
|
221
|
+
|
|
197
222
|
export type EngineBinding = {
|
|
198
223
|
role: string
|
|
199
224
|
requirement: EngineRequirement
|
package/src/kernel/abi.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { AxonOutputEvent } from "../session/events/stdio/output"
|
|
|
5
5
|
import type { AxonStimulusEntry } from "../session/events/stdio/stimuli"
|
|
6
6
|
import type { CognetEventMap } from "../session/events/cognet"
|
|
7
7
|
import type { AxonScope } from "../scope"
|
|
8
|
-
import type { Modality } from "../inference"
|
|
8
|
+
import type { EngineRequirements, EngineType, Modality } from "../inference"
|
|
9
9
|
import type { CapsuleScope } from "../capsule-scope"
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -285,7 +285,7 @@ export type AxonRunResult = {
|
|
|
285
285
|
* structured-output contract, attached from the invocation; a cognet has no
|
|
286
286
|
* business knowing a shape was demanded.
|
|
287
287
|
*/
|
|
288
|
-
export type CognetEngineCall = Omit<AxonEngineCall, "
|
|
288
|
+
export type CognetEngineCall = Omit<AxonEngineCall, "output" | "retries">
|
|
289
289
|
|
|
290
290
|
/**
|
|
291
291
|
* One bound role, as the cognet holds it.
|
|
@@ -302,6 +302,23 @@ export type CognetEngineCall = Omit<AxonEngineCall, "signal" | "output" | "retri
|
|
|
302
302
|
*/
|
|
303
303
|
export type KernelEngine = GenerateEngine | TransformEngine | StreamEngine
|
|
304
304
|
|
|
305
|
+
/** The engine handle implied by one declared requirement. */
|
|
306
|
+
type EnginePayload<M> =
|
|
307
|
+
M extends "text" ? string
|
|
308
|
+
: M extends "audio" ? Int16Array
|
|
309
|
+
: M extends "score" ? number
|
|
310
|
+
: unknown
|
|
311
|
+
|
|
312
|
+
export type EngineForRequirement<R> =
|
|
313
|
+
R extends { type: "generate"; out: infer M } ? GenerateEngine<EnginePayload<M>>
|
|
314
|
+
: R extends { type: "generate" } ? GenerateEngine
|
|
315
|
+
: R extends { type: "transform"; out: infer M } ? TransformEngine<EnginePayload<M>>
|
|
316
|
+
: R extends { type: "transform" } ? TransformEngine
|
|
317
|
+
: R extends { type: "stream"; out: infer M } ? StreamEngine<EnginePayload<M>>
|
|
318
|
+
: R extends { type: "stream" } ? StreamEngine
|
|
319
|
+
: R extends { type: EngineType } ? KernelEngine
|
|
320
|
+
: never
|
|
321
|
+
|
|
305
322
|
/** What every engine handle reports about what it actually got. */
|
|
306
323
|
type EngineFacts = {
|
|
307
324
|
/** Usable context window of the bound model. Undefined when the source does not report one. */
|
|
@@ -321,12 +338,12 @@ type EngineFacts = {
|
|
|
321
338
|
* model behind it generates token by token — it takes a string, not a
|
|
322
339
|
* timeline, and nothing about the grammar applies.
|
|
323
340
|
*/
|
|
324
|
-
export type GenerateEngine = EngineFacts & {
|
|
341
|
+
export type GenerateEngine<Response = AxonEngineResponse> = EngineFacts & {
|
|
325
342
|
readonly type: "generate"
|
|
326
343
|
/** Stream block events in real time, terminated by a single engine:done. */
|
|
327
344
|
stream(req: CognetEngineCall): AsyncGenerator<AxonEngineEvent>
|
|
328
345
|
/** Single-shot completion. Same response shape as the stream's done event. */
|
|
329
|
-
request(req: CognetEngineCall): Promise<
|
|
346
|
+
request(req: CognetEngineCall): Promise<Response>
|
|
330
347
|
}
|
|
331
348
|
|
|
332
349
|
/**
|
|
@@ -343,9 +360,9 @@ export type GenerateEngine = EngineFacts & {
|
|
|
343
360
|
* makes that indistinguishable from a hang. Absent for the many transforms
|
|
344
361
|
* that finish in milliseconds and report nothing.
|
|
345
362
|
*/
|
|
346
|
-
export type TransformEngine = EngineFacts & {
|
|
363
|
+
export type TransformEngine<Output = unknown> = EngineFacts & {
|
|
347
364
|
readonly type: "transform"
|
|
348
|
-
transform(input: unknown, opts?: TransformOptions): Promise<
|
|
365
|
+
transform(input: unknown, opts?: TransformOptions): Promise<Output>
|
|
349
366
|
}
|
|
350
367
|
|
|
351
368
|
export type TransformOptions = {
|
|
@@ -371,15 +388,15 @@ export type TransformOptions = {
|
|
|
371
388
|
* The session is the cognet's to hold — it is resident memory of precisely
|
|
372
389
|
* the kind a brain keeps.
|
|
373
390
|
*/
|
|
374
|
-
export type StreamEngine = EngineFacts & {
|
|
391
|
+
export type StreamEngine<Output = unknown> = EngineFacts & {
|
|
375
392
|
readonly type: "stream"
|
|
376
393
|
/** Begin one sequence. Every push into it shares the model's hidden state. */
|
|
377
|
-
open(): EngineSession
|
|
394
|
+
open(): EngineSession<Output>
|
|
378
395
|
}
|
|
379
396
|
|
|
380
|
-
export type EngineSession = {
|
|
397
|
+
export type EngineSession<Output = unknown> = {
|
|
381
398
|
/** Feed one item. Order is significant — that is what makes this not a transform. */
|
|
382
|
-
push(input: unknown): Promise<
|
|
399
|
+
push(input: unknown): Promise<Output>
|
|
383
400
|
/**
|
|
384
401
|
* Forget the sequence so far, keeping the session.
|
|
385
402
|
*
|
|
@@ -399,7 +416,7 @@ export type EngineSession = {
|
|
|
399
416
|
* (`kernel.engine("main")`) and the degradation check reads as a question
|
|
400
417
|
* (`kernel.engine.has("percept")`).
|
|
401
418
|
*/
|
|
402
|
-
export type KernelEngines = {
|
|
419
|
+
export type KernelEngines<Requirements extends EngineRequirements = EngineRequirements> = {
|
|
403
420
|
/**
|
|
404
421
|
* The handle for a declared role.
|
|
405
422
|
*
|
|
@@ -409,6 +426,7 @@ export type KernelEngines = {
|
|
|
409
426
|
* cognet bug, and a null handle would only move the crash one frame
|
|
410
427
|
* later with less to say about it.
|
|
411
428
|
*/
|
|
429
|
+
<Name extends keyof Requirements & string>(role: Name): EngineForRequirement<Requirements[Name]>
|
|
412
430
|
(role: string): KernelEngine
|
|
413
431
|
|
|
414
432
|
/**
|
|
@@ -422,7 +440,7 @@ export type KernelEngines = {
|
|
|
422
440
|
has(role: string): boolean
|
|
423
441
|
}
|
|
424
442
|
|
|
425
|
-
export type KernelAbi = {
|
|
443
|
+
export type KernelAbi<Requirements extends EngineRequirements = EngineRequirements> = {
|
|
426
444
|
/**
|
|
427
445
|
* Emit a fact to the world — text, audio, visual, or a declared field
|
|
428
446
|
* reading. Unmediated: the kernel commits it durably to the session's
|
|
@@ -452,7 +470,7 @@ export type KernelAbi = {
|
|
|
452
470
|
* reply is parsed with); what it no longer decides is WHICH model, and
|
|
453
471
|
* the cognet still never learns.
|
|
454
472
|
*/
|
|
455
|
-
engine: KernelEngines
|
|
473
|
+
engine: KernelEngines<Requirements>
|
|
456
474
|
|
|
457
475
|
/**
|
|
458
476
|
* Execute code in the capsule — ring 3, policy-mediated. The only
|
package/src/prompts.ts
CHANGED
|
@@ -45,6 +45,8 @@ export type AxonPrompt = {
|
|
|
45
45
|
* Present for agent-owned and module prompts; absent for inline prompts.
|
|
46
46
|
*/
|
|
47
47
|
filePath?: string
|
|
48
|
+
/** Inline source for prompts discovered outside the agent root. */
|
|
49
|
+
source?: string
|
|
48
50
|
/**
|
|
49
51
|
* Components this prompt may compose, as PascalCase name → absolute path.
|
|
50
52
|
*
|
|
@@ -195,4 +195,9 @@ export const STIMULUS_TRANSIENT_EVENTS = new Set<AxonStimulusType>(
|
|
|
195
195
|
* it never has to switch over every entry family that exists, only
|
|
196
196
|
* the ones it can actually receive.
|
|
197
197
|
*/
|
|
198
|
+
/** One unenveloped stimulus supplied by a caller before the session stamps it. */
|
|
199
|
+
export type AxonStimulusInput = {
|
|
200
|
+
[K in AxonStimulusType]: { type: K; data: AxonStimulusEvent[K] }
|
|
201
|
+
}[AxonStimulusType]
|
|
202
|
+
|
|
198
203
|
export type AxonStimulusEntry = AxonEventUnion<AxonStimulusEvent>
|
package/src/session/index.ts
CHANGED
|
@@ -17,7 +17,7 @@ export type { AxonEngineEvent } from "./events/engine"
|
|
|
17
17
|
export type { AxonEntryEvent } from "./events/entries"
|
|
18
18
|
export { ENTRY_EVENT_PREFIXES } from "./events/entries"
|
|
19
19
|
export { isKernelEvent, isEntryEvent, classifyEvent, type AxonEventView } from "./classify"
|
|
20
|
-
export type { AxonStimulusEntry, AxonStimulusEvent, AxonStimulusType } from "./events/stdio/stimuli"
|
|
20
|
+
export type { AxonStimulusEntry, AxonStimulusInput, AxonStimulusEvent, AxonStimulusType } from "./events/stdio/stimuli"
|
|
21
21
|
export { STIMULUS_TRANSIENT_EVENTS } from "./events/stdio/stimuli"
|
|
22
22
|
export type { AxonOutputEvent, AxonOutputType } from "./events/stdio/output"
|
|
23
23
|
export type { AxonChannel, AxonChunk, AxonTextFormat, StimulusRef } from "./events/stdio/shared"
|
package/src/supervisor.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { AxonRunResult } from "./kernel/abi"
|
|
|
3
3
|
import type { AxonBlueprint } from "./blueprint"
|
|
4
4
|
import type { AxonEventMap } from "./session/session"
|
|
5
5
|
import type { AxonCommitContext } from "./session/envelope"
|
|
6
|
-
import type { AxonStimulusEntry } from "./session/events/stdio/stimuli"
|
|
6
|
+
import type { AxonStimulusEntry, AxonStimulusInput } from "./session/events/stdio/stimuli"
|
|
7
7
|
import type { EscalationCall } from "./policy"
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -129,7 +129,7 @@ export type SupervisorToAgent = {
|
|
|
129
129
|
* "the wake this stimulus caused" names nothing. Such a caller wants
|
|
130
130
|
* `stimulus` and the commit stream.
|
|
131
131
|
*/
|
|
132
|
-
request(
|
|
132
|
+
request(input: AxonStimulusEntry | { content?: string | string[]; stimuli?: AxonStimulusInput[]; channel?: string }): Promise<{ ok: boolean; interrupted?: boolean }>
|
|
133
133
|
|
|
134
134
|
/**
|
|
135
135
|
* Bind the agent's HTTP surface, inside the box, and report the port.
|