@zenera/neo 1.3.3 → 1.3.5
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/README.md +3 -3
- package/dist/kernel.d.ts +2 -0
- package/dist/kernel.js +1 -0
- package/dist/model.d.ts +6 -0
- package/dist/models/factory.d.ts +38 -10
- package/dist/models/factory.js +83 -15
- package/dist/models/index.d.ts +1 -0
- package/dist/models/index.js +1 -0
- package/dist/models/ref.d.ts +25 -0
- package/dist/models/ref.js +60 -0
- package/dist/project/load.js +59 -3
- package/dist/runner.js +1 -0
- package/dist/trajectory.d.ts +5 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -93,7 +93,7 @@ const getWeather = tool<{ city: string }>({
|
|
|
93
93
|
execute: ({ city }) => ({ city, tempC: 21, sky: 'clear' }),
|
|
94
94
|
});
|
|
95
95
|
|
|
96
|
-
const runner = new AgentRunner({ model: createModel('openai
|
|
96
|
+
const runner = new AgentRunner({ model: createModel('openai/gpt-5.4-mini') });
|
|
97
97
|
|
|
98
98
|
const planner = runner.agent({
|
|
99
99
|
name: 'planner',
|
|
@@ -141,7 +141,7 @@ The whole system is an `agents.yaml`:
|
|
|
141
141
|
|
|
142
142
|
```yaml
|
|
143
143
|
default: intake
|
|
144
|
-
model: anthropic
|
|
144
|
+
model: anthropic/claude-sonnet-4-5
|
|
145
145
|
skills: agents/skills
|
|
146
146
|
|
|
147
147
|
agents:
|
|
@@ -154,7 +154,7 @@ agents:
|
|
|
154
154
|
- name: adjuster
|
|
155
155
|
description: Weighs the written policy against the case and explains the outcome.
|
|
156
156
|
system: agents/prompts/adjuster.md
|
|
157
|
-
model: openai
|
|
157
|
+
model: openai/gpt-5.4
|
|
158
158
|
tools: [files:*, sandbox:*]
|
|
159
159
|
skills:
|
|
160
160
|
discovery: index # the model loads what the case needs
|
package/dist/kernel.d.ts
CHANGED
|
@@ -117,6 +117,8 @@ export interface LlmCallOptions<TCtx = unknown> {
|
|
|
117
117
|
request?: ModelRequest;
|
|
118
118
|
/** needed to validate a `fork` call against the agent's declaration */
|
|
119
119
|
registry?: AgentRegistry<TCtx>;
|
|
120
|
+
/** the model's `ref`, recorded beside its wire id */
|
|
121
|
+
ref?: string;
|
|
120
122
|
}
|
|
121
123
|
/**
|
|
122
124
|
* Appends the `llm_call` node (plus the nodes its tool calls imply) and moves
|
package/dist/kernel.js
CHANGED
|
@@ -446,6 +446,7 @@ export async function applyLlmResponse(state, res, model, env, opts = {}) {
|
|
|
446
446
|
b.add({
|
|
447
447
|
type: 'llm_call',
|
|
448
448
|
model,
|
|
449
|
+
...(opts.ref ? { ref: opts.ref } : {}),
|
|
449
450
|
requestDigest: opts.digest ?? (opts.request ? requestDigest(opts.request) : ''),
|
|
450
451
|
request: opts.request ? await put(env, serializeRequest(opts.request)) : undefined,
|
|
451
452
|
text: await put(env, res.text),
|
package/dist/model.d.ts
CHANGED
|
@@ -18,6 +18,12 @@ export interface ModelResponse {
|
|
|
18
18
|
}
|
|
19
19
|
export interface Model {
|
|
20
20
|
readonly id: string;
|
|
21
|
+
/**
|
|
22
|
+
* The ref that names this model again — `openai/gpt-5-mini` — when it was
|
|
23
|
+
* built from one. `id` is only what goes on the wire, and has lost which
|
|
24
|
+
* provider that was.
|
|
25
|
+
*/
|
|
26
|
+
readonly ref?: string;
|
|
21
27
|
generate(req: ModelRequest): Promise<ModelResponse>;
|
|
22
28
|
/** optional: non-streaming models simply never produce deltas */
|
|
23
29
|
stream?(req: ModelRequest, onDelta: (d: StreamDelta) => void): Promise<ModelResponse>;
|
package/dist/models/factory.d.ts
CHANGED
|
@@ -104,15 +104,31 @@ export interface ModelSpec extends Credentials, OpenAIResponsesModelOptions, Ant
|
|
|
104
104
|
client?: ProviderClient;
|
|
105
105
|
}
|
|
106
106
|
/**
|
|
107
|
-
* Shorthand: `
|
|
108
|
-
* `
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
* form.
|
|
107
|
+
* Shorthand: `provider/id`, e.g. `openai/gpt-5-mini`,
|
|
108
|
+
* `vertex/anthropic/claude-opus-5`, `openrouter/anthropic/claude-sonnet-5` —
|
|
109
|
+
* see `ref.ts`. The older `[provider[/api]:]id` (`openai:gpt-4o`,
|
|
110
|
+
* `openai/responses:o3`, `openai:ft:gpt-4o:acme::a1b2`) and a bare id on the
|
|
111
|
+
* default provider are still read. Anything the shorthand cannot express
|
|
112
|
+
* (keys, base urls, reasoning knobs) needs the object form.
|
|
114
113
|
*/
|
|
115
114
|
export type ModelRef = ModelSpec | string;
|
|
115
|
+
/**
|
|
116
|
+
* How a ref is written, against how it would be written today.
|
|
117
|
+
*
|
|
118
|
+
* - `bare` — no provider: it goes to the default one
|
|
119
|
+
* - `colon` — the older `provider:id`
|
|
120
|
+
* - `ambiguous` — `anthropic/claude-…` on an OpenRouter-style default, which
|
|
121
|
+
* still means the default provider's id, as it always has; written out, it
|
|
122
|
+
* says so
|
|
123
|
+
* - `publisher` — Claude on Vertex without its `anthropic/`
|
|
124
|
+
*
|
|
125
|
+
* `canonical` keeps the meaning. A colon ref naming an api is already as
|
|
126
|
+
* written as it gets: no other shorthand carries one.
|
|
127
|
+
*/
|
|
128
|
+
export interface ModelRefStyle {
|
|
129
|
+
issue: 'bare' | 'colon' | 'ambiguous' | 'publisher';
|
|
130
|
+
canonical: string;
|
|
131
|
+
}
|
|
116
132
|
/**
|
|
117
133
|
* The same idea one layer down: which vectoriser, and of whom.
|
|
118
134
|
*
|
|
@@ -128,7 +144,7 @@ export interface EmbeddingSpec extends Credentials, OpenAIEmbedderOptions, Gemin
|
|
|
128
144
|
/** pre-built client — bypasses provider resolution entirely */
|
|
129
145
|
client?: ProviderClient;
|
|
130
146
|
}
|
|
131
|
-
/** Shorthand: `
|
|
147
|
+
/** Shorthand: `provider/model`, e.g. `google/gemini-embedding-001` — read as `ModelRef` is, minus an api. */
|
|
132
148
|
export type EmbeddingRef = EmbeddingSpec | string;
|
|
133
149
|
/**
|
|
134
150
|
* What a ref *would* connect with. `model()` answers the same question by
|
|
@@ -241,10 +257,22 @@ export declare class ModelRegistry {
|
|
|
241
257
|
* credential, and the two want different words.
|
|
242
258
|
*/
|
|
243
259
|
requirement(ref: ModelRef | EmbeddingRef): ModelRequirement;
|
|
244
|
-
/**
|
|
260
|
+
/** A shorthand → spec; see `ModelRef`. Exposed so a caller can validate a ref. */
|
|
245
261
|
parse(ref: string): ModelSpec;
|
|
246
262
|
/**
|
|
247
|
-
*
|
|
263
|
+
* The ref a spec is written as: `provider/id`, with Claude on Vertex under
|
|
264
|
+
* its publisher. The colon form when that is the only one that reads back
|
|
265
|
+
* the same — an api to carry, or an id the slash would split differently.
|
|
266
|
+
*/
|
|
267
|
+
refOf(spec: {
|
|
268
|
+
provider?: string;
|
|
269
|
+
api?: string;
|
|
270
|
+
model: string;
|
|
271
|
+
}): string;
|
|
272
|
+
/** How `ref` is written, when that is not the way it would be written today. */
|
|
273
|
+
refStyle(ref: string): ModelRefStyle | undefined;
|
|
274
|
+
/**
|
|
275
|
+
* Splits a shorthand into the spec it stands for, so a caller holding
|
|
248
276
|
* a shorthand can still set the knobs a shorthand has no room for.
|
|
249
277
|
*/
|
|
250
278
|
parseEmbedding(ref: string): EmbeddingSpec;
|
package/dist/models/factory.js
CHANGED
|
@@ -11,6 +11,7 @@ import { GeminiModel } from "./gemini.js";
|
|
|
11
11
|
import { OpenAIModel } from "./openai-chat.js";
|
|
12
12
|
import { OpenAIResponsesModel } from "./openai-responses.js";
|
|
13
13
|
import { OpenRouterModel } from "./openrouter.js";
|
|
14
|
+
import { MODEL_APIS, splitModelRef } from "./ref.js";
|
|
14
15
|
// ---------------------------------------------------------------------------
|
|
15
16
|
// The vendor SDKs
|
|
16
17
|
//
|
|
@@ -348,6 +349,13 @@ export class ModelRegistry {
|
|
|
348
349
|
/** Turns a shorthand or a spec into a `Model`. */
|
|
349
350
|
model(ref) {
|
|
350
351
|
const spec = typeof ref === 'string' ? this.parse(ref) : ref;
|
|
352
|
+
const built = this.#build(spec);
|
|
353
|
+
// What the trace records beside the wire id: the id alone has lost
|
|
354
|
+
// which provider it went to.
|
|
355
|
+
Object.defineProperty(built, 'ref', { value: this.refOf(spec), enumerable: false });
|
|
356
|
+
return built;
|
|
357
|
+
}
|
|
358
|
+
#build(spec) {
|
|
351
359
|
const name = spec.provider ?? this.#default;
|
|
352
360
|
const provider = this.#spec(name);
|
|
353
361
|
const kind = this.kindOf(name);
|
|
@@ -481,30 +489,90 @@ export class ModelRegistry {
|
|
|
481
489
|
keyOptional: Boolean(defaults.keyOptional),
|
|
482
490
|
};
|
|
483
491
|
}
|
|
484
|
-
/**
|
|
492
|
+
/** A shorthand → spec; see `ModelRef`. Exposed so a caller can validate a ref. */
|
|
485
493
|
parse(ref) {
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
494
|
+
return this.#read(ref).spec;
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* The ref a spec is written as: `provider/id`, with Claude on Vertex under
|
|
498
|
+
* its publisher. The colon form when that is the only one that reads back
|
|
499
|
+
* the same — an api to carry, or an id the slash would split differently.
|
|
500
|
+
*/
|
|
501
|
+
refOf(spec) {
|
|
502
|
+
const name = spec.provider ?? this.#default;
|
|
503
|
+
if (spec.api) {
|
|
504
|
+
return `${name}/${spec.api}:${spec.model}`;
|
|
505
|
+
}
|
|
506
|
+
const model = this.kindOf(name) === 'vertex' && /^claude-/.test(spec.model)
|
|
507
|
+
? `anthropic/${spec.model}`
|
|
508
|
+
: spec.model;
|
|
509
|
+
const slash = `${name}/${model}`;
|
|
510
|
+
try {
|
|
511
|
+
const back = this.parse(slash);
|
|
512
|
+
if ((back.provider ?? this.#default) === name && back.model === model && !back.api) {
|
|
513
|
+
return slash;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
catch {
|
|
517
|
+
// falls through to the form that always reads back
|
|
490
518
|
}
|
|
491
|
-
|
|
492
|
-
|
|
519
|
+
return `${name}:${model}`;
|
|
520
|
+
}
|
|
521
|
+
/** How `ref` is written, when that is not the way it would be written today. */
|
|
522
|
+
refStyle(ref) {
|
|
523
|
+
const { spec, form } = this.#read(ref);
|
|
524
|
+
const canonical = this.refOf(spec);
|
|
525
|
+
if (canonical === ref) {
|
|
526
|
+
return undefined;
|
|
527
|
+
}
|
|
528
|
+
return { issue: form === 'slash' ? 'publisher' : form, canonical };
|
|
529
|
+
}
|
|
530
|
+
#read(ref) {
|
|
531
|
+
const parts = splitModelRef(ref, (name) => this.has(name));
|
|
532
|
+
if (parts.form === 'bare') {
|
|
533
|
+
return { spec: { model: ref }, form: 'bare' };
|
|
534
|
+
}
|
|
535
|
+
const { provider, api, model } = parts;
|
|
493
536
|
if (!model) {
|
|
494
537
|
throw new TypeError(`missing model id in "${ref}"`);
|
|
495
538
|
}
|
|
496
|
-
if (
|
|
497
|
-
|
|
498
|
-
`
|
|
499
|
-
|
|
539
|
+
if (parts.form === 'colon') {
|
|
540
|
+
if (!provider || !this.has(provider)) {
|
|
541
|
+
throw new TypeError(`unknown provider "${provider}" in "${ref}" ` +
|
|
542
|
+
`(known: ${this.names().join(', ')}; a model id that itself contains a ` +
|
|
543
|
+
`colon must name its provider, e.g. "openai:${ref}")`);
|
|
544
|
+
}
|
|
545
|
+
if (api !== undefined && !MODEL_APIS.includes(api)) {
|
|
546
|
+
throw new TypeError(`unknown api "${api}" in "${ref}" (expected chat or responses; an id ` +
|
|
547
|
+
'with a colon in it goes in the object form)');
|
|
548
|
+
}
|
|
549
|
+
return { spec: { provider, api: api, model }, form: 'colon' };
|
|
500
550
|
}
|
|
501
|
-
|
|
502
|
-
|
|
551
|
+
// Before a slash named a provider, it was part of an id on the default
|
|
552
|
+
// one — and on a default whose own ids have slashes (OpenRouter's
|
|
553
|
+
// `anthropic/claude-…`, an endpoint of somebody's) that reading may be
|
|
554
|
+
// the one that was meant. It is kept; `refStyle` asks for it written out.
|
|
555
|
+
const fallback = this.#default;
|
|
556
|
+
if (this.#slashIds(fallback) && (provider !== fallback || this.#repointed(fallback))) {
|
|
557
|
+
return { spec: { model: ref }, form: 'ambiguous' };
|
|
503
558
|
}
|
|
504
|
-
return { provider,
|
|
559
|
+
return { spec: { provider, model }, form: 'slash' };
|
|
560
|
+
}
|
|
561
|
+
/** A provider whose own model ids may contain a slash. */
|
|
562
|
+
#slashIds(name) {
|
|
563
|
+
const kind = this.kindOf(name);
|
|
564
|
+
return (kind === 'openrouter' ||
|
|
565
|
+
kind === 'vertex' ||
|
|
566
|
+
kind === 'openai-compatible' ||
|
|
567
|
+
this.#repointed(name));
|
|
568
|
+
}
|
|
569
|
+
/** Declared at a base url of its own: a proxy may name its models any way it likes. */
|
|
570
|
+
#repointed(name) {
|
|
571
|
+
const spec = this.#providers.get(name);
|
|
572
|
+
return Boolean(spec?.baseURL || spec?.baseURLEnv);
|
|
505
573
|
}
|
|
506
574
|
/**
|
|
507
|
-
* Splits
|
|
575
|
+
* Splits a shorthand into the spec it stands for, so a caller holding
|
|
508
576
|
* a shorthand can still set the knobs a shorthand has no room for.
|
|
509
577
|
*/
|
|
510
578
|
parseEmbedding(ref) {
|
package/dist/models/index.d.ts
CHANGED
package/dist/models/index.js
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare const MODEL_APIS: readonly ["chat", "responses"];
|
|
2
|
+
export type ModelRefForm = 'slash' | 'colon' | 'bare';
|
|
3
|
+
export interface ModelRefParts {
|
|
4
|
+
provider?: string;
|
|
5
|
+
/** colon form only: `openai/responses:o3` */
|
|
6
|
+
api?: string;
|
|
7
|
+
model: string;
|
|
8
|
+
form: ModelRefForm;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The syntax of a ref, without deciding whether its provider exists.
|
|
12
|
+
*
|
|
13
|
+
* `isProvider` decides whether a leading `name/` is a provider or the start of
|
|
14
|
+
* an id: `openai/gpt-5-mini` splits, `meta-llama/Llama-3-8B` does not. The colon
|
|
15
|
+
* form is recognised by its shape alone, so a typo in it still reaches the
|
|
16
|
+
* caller as an unknown provider rather than as a strange model id.
|
|
17
|
+
*/
|
|
18
|
+
export declare function splitModelRef(ref: string, isProvider: (name: string) => boolean): ModelRefParts;
|
|
19
|
+
/**
|
|
20
|
+
* `provider/id`, unless that would read back as something else — a fine-tuned
|
|
21
|
+
* `ft:gpt-4o:acme::a1b2` would, its `ft:` looking like an api — in which case
|
|
22
|
+
* the colon form, which carries any id.
|
|
23
|
+
*/
|
|
24
|
+
export declare function formatModelRef(provider: string, model: string, isProvider: (name: string) => boolean): string;
|
|
25
|
+
//# sourceMappingURL=ref.d.ts.map
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// ---------------------------------------------------------------------------
|
|
2
|
+
// Model references
|
|
3
|
+
//
|
|
4
|
+
// One grammar, read the same way by the library, the CLI and the meta agent:
|
|
5
|
+
//
|
|
6
|
+
// provider/id openai/gpt-5-mini
|
|
7
|
+
// vertex/anthropic/claude-opus-5
|
|
8
|
+
// openrouter/anthropic/claude-sonnet-5
|
|
9
|
+
//
|
|
10
|
+
// The first segment is always a provider name and everything after the first
|
|
11
|
+
// slash is the id as that provider spells it — slashes and colons included. It
|
|
12
|
+
// is also how Bifrost names a model, so the string in `agents.yaml`, the trace
|
|
13
|
+
// and the gateway's logs is the same one.
|
|
14
|
+
//
|
|
15
|
+
// Two older spellings are still read:
|
|
16
|
+
//
|
|
17
|
+
// provider[/api]:id openai:gpt-4o, openai/responses:o3
|
|
18
|
+
// id gpt-4o — the registry's default provider
|
|
19
|
+
//
|
|
20
|
+
// The colon form stays the way to write an id the slash form cannot carry back
|
|
21
|
+
// (`openai:ft:gpt-4o:acme::a1b2`), and the only shorthand that names an api.
|
|
22
|
+
// ---------------------------------------------------------------------------
|
|
23
|
+
export const MODEL_APIS = ['chat', 'responses'];
|
|
24
|
+
/** What an api selector looks like, as opposed to a model name: `responses`, not `llama3`. */
|
|
25
|
+
const API_LIKE = /^[a-z]+$/;
|
|
26
|
+
/**
|
|
27
|
+
* The syntax of a ref, without deciding whether its provider exists.
|
|
28
|
+
*
|
|
29
|
+
* `isProvider` decides whether a leading `name/` is a provider or the start of
|
|
30
|
+
* an id: `openai/gpt-5-mini` splits, `meta-llama/Llama-3-8B` does not. The colon
|
|
31
|
+
* form is recognised by its shape alone, so a typo in it still reaches the
|
|
32
|
+
* caller as an unknown provider rather than as a strange model id.
|
|
33
|
+
*/
|
|
34
|
+
export function splitModelRef(ref, isProvider) {
|
|
35
|
+
const colon = ref.indexOf(':');
|
|
36
|
+
if (colon > 0) {
|
|
37
|
+
const head = ref.slice(0, colon).split('/');
|
|
38
|
+
if (head.length === 1 || (head.length === 2 && API_LIKE.test(head[1]))) {
|
|
39
|
+
return { provider: head[0], api: head[1], model: ref.slice(colon + 1), form: 'colon' };
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const slash = ref.indexOf('/');
|
|
43
|
+
if (slash > 0 && isProvider(ref.slice(0, slash))) {
|
|
44
|
+
return { provider: ref.slice(0, slash), model: ref.slice(slash + 1), form: 'slash' };
|
|
45
|
+
}
|
|
46
|
+
return { model: ref, form: 'bare' };
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* `provider/id`, unless that would read back as something else — a fine-tuned
|
|
50
|
+
* `ft:gpt-4o:acme::a1b2` would, its `ft:` looking like an api — in which case
|
|
51
|
+
* the colon form, which carries any id.
|
|
52
|
+
*/
|
|
53
|
+
export function formatModelRef(provider, model, isProvider) {
|
|
54
|
+
const slash = `${provider}/${model}`;
|
|
55
|
+
const back = splitModelRef(slash, isProvider);
|
|
56
|
+
return back.form === 'slash' && back.provider === provider && back.model === model
|
|
57
|
+
? slash
|
|
58
|
+
: `${provider}:${model}`;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=ref.js.map
|
package/dist/project/load.js
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
// packages/neo/src/project/load.ts
|
|
2
|
+
//
|
|
3
|
+
// Turning a project folder (`agents.yaml`, `agents/*instructions.md`, `agents/prompts/`, skills,
|
|
4
|
+
// assets, memory) into an `AgentRegistry` and a runner. Also where house rules are discovered and
|
|
5
|
+
// gated by their `requires:` frontmatter (`CAPABILITIES`, `tools:<group>`).
|
|
6
|
+
// Main: `loadProject(dir, opts)` -> `AgentProject`; also `readProjectConfig`, `projectRegistry`,
|
|
7
|
+
// `memoryDir`, `skillDirs`, `skillMounts`, `assetsDir`.
|
|
8
|
+
// Used by (through `project/index.ts` and `@zenera/neo`): the engine (`engine.ts` loads every run,
|
|
9
|
+
// `projects.ts`, `audit.ts`); the CLI (`validate.ts`, `batch.ts`, `release.ts`, `container.ts`,
|
|
10
|
+
// `ask.ts`, `seed.ts`, commands); the server (`store.ts`, `status.ts`, `memory.ts`);
|
|
11
|
+
// `@zenera/meta` (`prepare.ts`); and SDK users directly.
|
|
12
|
+
// `packages/cli/src/validate.ts` mirrors its constants and capabilities on purpose: keep the two in
|
|
13
|
+
// step. Tests: test/project.test.ts.
|
|
1
14
|
import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';
|
|
2
15
|
import { basename, join, relative, resolve, sep } from 'node:path';
|
|
3
16
|
import { Agent, AgentRegistry } from "../agent.js";
|
|
@@ -223,9 +236,9 @@ function readHouseRules(root) {
|
|
|
223
236
|
const { data, body } = frontmatter(readFileSync(path, 'utf8'));
|
|
224
237
|
const requires = toList(data.requires);
|
|
225
238
|
for (const cap of requires) {
|
|
226
|
-
if (!(cap
|
|
239
|
+
if (!capability(cap)) {
|
|
227
240
|
throw new Error(`${rel}: unknown capability "${cap}" in requires: ` +
|
|
228
|
-
`(known: ${Object.keys(CAPABILITIES).join(', ')})`);
|
|
241
|
+
`(known: ${[...Object.keys(CAPABILITIES), `${TOOLS_CAPABILITY}<group>`].join(', ')})`);
|
|
229
242
|
}
|
|
230
243
|
}
|
|
231
244
|
// One object per document, shared by every agent it reaches, so the
|
|
@@ -327,6 +340,49 @@ const CAPABILITIES = {
|
|
|
327
340
|
workspace: (spec) => hasFileTools(spec),
|
|
328
341
|
'workspace-write': (spec) => hasFileWriteTools(spec),
|
|
329
342
|
};
|
|
343
|
+
/**
|
|
344
|
+
* `tools:<group>`: the agent's `tools:` grants at least one tool of that group.
|
|
345
|
+
* The one open-ended entry, because groups come from plugins this package
|
|
346
|
+
* cannot list. It is still decided from `agents.yaml` alone, so a bare name
|
|
347
|
+
* counts as the group's when it carries the group's prefix (`mcp_call` for
|
|
348
|
+
* `mcp`) - the convention plugin tools are named by.
|
|
349
|
+
*/
|
|
350
|
+
const TOOLS_CAPABILITY = 'tools:';
|
|
351
|
+
function grantsGroup(selectors, group) {
|
|
352
|
+
let whole = false;
|
|
353
|
+
const named = new Set();
|
|
354
|
+
for (const raw of selectors ?? []) {
|
|
355
|
+
const drop = raw.startsWith('-');
|
|
356
|
+
const selector = (drop ? raw.slice(1) : raw).trim();
|
|
357
|
+
if (selector === '*' || selector === `${group}:*`) {
|
|
358
|
+
whole = !drop;
|
|
359
|
+
named.clear();
|
|
360
|
+
continue;
|
|
361
|
+
}
|
|
362
|
+
const colon = selector.lastIndexOf(':');
|
|
363
|
+
const name = colon >= 0 ? selector.slice(colon + 1) : selector;
|
|
364
|
+
const inGroup = colon >= 0 ? selector.slice(0, colon) === group : name.startsWith(`${group}_`);
|
|
365
|
+
if (!inGroup) {
|
|
366
|
+
continue;
|
|
367
|
+
}
|
|
368
|
+
if (drop) {
|
|
369
|
+
named.delete(name);
|
|
370
|
+
}
|
|
371
|
+
else {
|
|
372
|
+
named.add(name);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
// A whole group less some names still grants the rest: no selector can
|
|
376
|
+
// withdraw every tool of a group without knowing what the group holds.
|
|
377
|
+
return whole || named.size > 0;
|
|
378
|
+
}
|
|
379
|
+
function capability(cap) {
|
|
380
|
+
if (cap.startsWith(TOOLS_CAPABILITY)) {
|
|
381
|
+
const group = cap.slice(TOOLS_CAPABILITY.length);
|
|
382
|
+
return group ? (spec) => grantsGroup(spec.tools, group) : undefined;
|
|
383
|
+
}
|
|
384
|
+
return Object.hasOwn(CAPABILITIES, cap) ? CAPABILITIES[cap] : undefined;
|
|
385
|
+
}
|
|
330
386
|
/**
|
|
331
387
|
* The document as this agent gets it, or `undefined` when its conditions rule
|
|
332
388
|
* the agent out. Several run-time conditions are met by meeting all of them.
|
|
@@ -334,7 +390,7 @@ const CAPABILITIES = {
|
|
|
334
390
|
function ruleFor(rule, spec) {
|
|
335
391
|
const gates = [];
|
|
336
392
|
for (const cap of rule.requires) {
|
|
337
|
-
const resolved =
|
|
393
|
+
const resolved = capability(cap)(spec);
|
|
338
394
|
if (!resolved) {
|
|
339
395
|
return undefined;
|
|
340
396
|
}
|
package/dist/runner.js
CHANGED
package/dist/trajectory.d.ts
CHANGED
|
@@ -82,6 +82,11 @@ export interface LlmCallNode extends NodeBase {
|
|
|
82
82
|
type: 'llm_call';
|
|
83
83
|
/** exact model id used */
|
|
84
84
|
model: string;
|
|
85
|
+
/**
|
|
86
|
+
* The ref that names the model again, `provider/id` — absent from runs
|
|
87
|
+
* recorded before it was, and for models not built by a registry.
|
|
88
|
+
*/
|
|
89
|
+
ref?: string;
|
|
85
90
|
/** sha256 of the projected request, for replay checks */
|
|
86
91
|
requestDigest: string;
|
|
87
92
|
request?: Payload;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zenera/neo",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.5",
|
|
4
4
|
"description": "A multi-agent runtime for Node.js: agents, models, tools, skills, memory and an append-only trajectory.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agents",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"prepack": "tsc -b"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@zenera/sandbox": "^1.3.
|
|
65
|
+
"@zenera/sandbox": "^1.3.5",
|
|
66
66
|
"graphology": "^0.26.0",
|
|
67
67
|
"yaml": "^2.9.1",
|
|
68
68
|
"zod": "^4.6.7"
|