@zenera/neo 1.1.0
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/LICENSE +21 -0
- package/README.md +178 -0
- package/dist/agent.d.ts +66 -0
- package/dist/agent.js +97 -0
- package/dist/architecture.d.ts +74 -0
- package/dist/architecture.js +105 -0
- package/dist/embedding.d.ts +60 -0
- package/dist/embedding.js +21 -0
- package/dist/embeddings/gemini.d.ts +24 -0
- package/dist/embeddings/gemini.js +71 -0
- package/dist/embeddings/index.d.ts +4 -0
- package/dist/embeddings/index.js +4 -0
- package/dist/embeddings/openai.d.ts +18 -0
- package/dist/embeddings/openai.js +27 -0
- package/dist/embeddings/openrouter.d.ts +21 -0
- package/dist/embeddings/openrouter.js +54 -0
- package/dist/events.d.ts +144 -0
- package/dist/events.js +110 -0
- package/dist/ids.d.ts +14 -0
- package/dist/ids.js +33 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +25 -0
- package/dist/inspect/client.d.ts +2 -0
- package/dist/inspect/client.js +1326 -0
- package/dist/inspect/css.d.ts +2 -0
- package/dist/inspect/css.js +164 -0
- package/dist/inspect/index.d.ts +9 -0
- package/dist/inspect/index.js +12 -0
- package/dist/inspect/page.d.ts +3 -0
- package/dist/inspect/page.js +93 -0
- package/dist/inspect/report.d.ts +54 -0
- package/dist/inspect/report.js +62 -0
- package/dist/kernel.d.ts +178 -0
- package/dist/kernel.js +929 -0
- package/dist/memory-stores/factory.d.ts +15 -0
- package/dist/memory-stores/factory.js +29 -0
- package/dist/memory-stores/file.d.ts +37 -0
- package/dist/memory-stores/file.js +174 -0
- package/dist/memory-stores/in-memory.d.ts +17 -0
- package/dist/memory-stores/in-memory.js +80 -0
- package/dist/memory-stores/index.d.ts +4 -0
- package/dist/memory-stores/index.js +5 -0
- package/dist/memory.d.ts +115 -0
- package/dist/memory.js +213 -0
- package/dist/model.d.ts +25 -0
- package/dist/model.js +2 -0
- package/dist/models/anthropic.d.ts +36 -0
- package/dist/models/anthropic.js +293 -0
- package/dist/models/factory.d.ts +202 -0
- package/dist/models/factory.js +533 -0
- package/dist/models/gemini.d.ts +45 -0
- package/dist/models/gemini.js +368 -0
- package/dist/models/index.d.ts +7 -0
- package/dist/models/index.js +7 -0
- package/dist/models/openai-chat.d.ts +19 -0
- package/dist/models/openai-chat.js +203 -0
- package/dist/models/openai-responses.d.ts +31 -0
- package/dist/models/openai-responses.js +258 -0
- package/dist/models/openrouter.d.ts +44 -0
- package/dist/models/openrouter.js +230 -0
- package/dist/payload-stores/factory.d.ts +15 -0
- package/dist/payload-stores/factory.js +30 -0
- package/dist/payload-stores/file.d.ts +29 -0
- package/dist/payload-stores/file.js +112 -0
- package/dist/payload-stores/in-memory.d.ts +17 -0
- package/dist/payload-stores/in-memory.js +40 -0
- package/dist/payload-stores/index.d.ts +4 -0
- package/dist/payload-stores/index.js +5 -0
- package/dist/payload.d.ts +89 -0
- package/dist/payload.js +181 -0
- package/dist/project/config.d.ts +302 -0
- package/dist/project/config.js +290 -0
- package/dist/project/index.d.ts +4 -0
- package/dist/project/index.js +4 -0
- package/dist/project/load.d.ts +142 -0
- package/dist/project/load.js +430 -0
- package/dist/project/refs.d.ts +23 -0
- package/dist/project/refs.js +70 -0
- package/dist/prompt.d.ts +66 -0
- package/dist/prompt.js +62 -0
- package/dist/runner.d.ts +103 -0
- package/dist/runner.js +537 -0
- package/dist/services.d.ts +23 -0
- package/dist/services.js +44 -0
- package/dist/skill-providers/factory.d.ts +16 -0
- package/dist/skill-providers/factory.js +26 -0
- package/dist/skill-providers/file.d.ts +44 -0
- package/dist/skill-providers/file.js +209 -0
- package/dist/skill-providers/index.d.ts +4 -0
- package/dist/skill-providers/index.js +5 -0
- package/dist/skill-providers/static.d.ts +13 -0
- package/dist/skill-providers/static.js +47 -0
- package/dist/skills.d.ts +102 -0
- package/dist/skills.js +232 -0
- package/dist/state.d.ts +86 -0
- package/dist/state.js +49 -0
- package/dist/tools/exa.d.ts +23 -0
- package/dist/tools/exa.js +389 -0
- package/dist/tools/index.d.ts +4 -0
- package/dist/tools/index.js +6 -0
- package/dist/tools/sandbox.d.ts +172 -0
- package/dist/tools/sandbox.js +602 -0
- package/dist/tools/workspace.d.ts +53 -0
- package/dist/tools/workspace.js +1034 -0
- package/dist/trajectory.d.ts +213 -0
- package/dist/trajectory.js +232 -0
- package/dist/types.d.ts +195 -0
- package/dist/types.js +134 -0
- package/package.json +98 -0
package/dist/types.js
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
const MEDIA_KEYS = ['image', 'audio', 'video', 'file'];
|
|
2
|
+
export function text(value) {
|
|
3
|
+
return { type: 'text', text: value };
|
|
4
|
+
}
|
|
5
|
+
export function media(kind, url, mimeType) {
|
|
6
|
+
return { type: kind, url, mimeType };
|
|
7
|
+
}
|
|
8
|
+
/** Normalizes any accepted input shape into a flat `ContentPart[]`. */
|
|
9
|
+
export function toContent(input) {
|
|
10
|
+
if (typeof input === 'string') {
|
|
11
|
+
return [text(input)];
|
|
12
|
+
}
|
|
13
|
+
return input.map((part) => {
|
|
14
|
+
if (typeof part === 'string') {
|
|
15
|
+
return text(part);
|
|
16
|
+
}
|
|
17
|
+
// `'type' in part` is a TS narrowing guard: it splits the union into the
|
|
18
|
+
// canonical `ContentPart` branch and the `{ image: url }` shorthands.
|
|
19
|
+
if ('type' in part) {
|
|
20
|
+
return part;
|
|
21
|
+
}
|
|
22
|
+
// Shorthand: exactly one of image/audio/video/file carries the url.
|
|
23
|
+
for (const kind of MEDIA_KEYS) {
|
|
24
|
+
const url = part[kind];
|
|
25
|
+
if (typeof url === 'string') {
|
|
26
|
+
return media(kind, url, part.mimeType);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
throw new TypeError(`unsupported input part: ${JSON.stringify(part)}`);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
export function contentToText(content) {
|
|
33
|
+
return content.map((p) => (p.type === 'text' ? p.text : `[${p.type}: ${p.url}]`)).join('\n');
|
|
34
|
+
}
|
|
35
|
+
export function zeroUsage() {
|
|
36
|
+
return { inputTokens: 0, cachedInputTokens: 0, outputTokens: 0, reasoningTokens: 0 };
|
|
37
|
+
}
|
|
38
|
+
export function addUsage(a, b) {
|
|
39
|
+
return {
|
|
40
|
+
inputTokens: a.inputTokens + b.inputTokens,
|
|
41
|
+
cachedInputTokens: a.cachedInputTokens + b.cachedInputTokens,
|
|
42
|
+
outputTokens: a.outputTokens + b.outputTokens,
|
|
43
|
+
reasoningTokens: a.reasoningTokens + b.reasoningTokens,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
const TOOL_RETURN = Symbol('agent.toolReturn');
|
|
47
|
+
export function withEffects(output, ...effects) {
|
|
48
|
+
return { [TOOL_RETURN]: true, output, effects };
|
|
49
|
+
}
|
|
50
|
+
export function isToolReturn(v) {
|
|
51
|
+
return v !== null && typeof v === 'object' && TOOL_RETURN in v;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Identity helper. Its only job is inference: written inline, `execute`'s
|
|
55
|
+
* `args` would be `unknown`; going through `tool<{city: string}>()` types it.
|
|
56
|
+
*/
|
|
57
|
+
export function tool(def) {
|
|
58
|
+
return def;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Resolves selectors against the tools a host provided, in the order written
|
|
62
|
+
* and without duplicates. A selector is a tool name, `<group>:*` for every tool
|
|
63
|
+
* in a group, or `*` for everything; any of them prefixed with `-` removes
|
|
64
|
+
* what it matches from the selection so far.
|
|
65
|
+
*/
|
|
66
|
+
export function selectTools(available, selectors, opts) {
|
|
67
|
+
const chosen = new Map();
|
|
68
|
+
for (const raw of selectors) {
|
|
69
|
+
const drop = raw.startsWith('-');
|
|
70
|
+
const selector = (drop ? raw.slice(1) : raw).trim();
|
|
71
|
+
if (!selector) {
|
|
72
|
+
throw new Error(`${opts.where}: empty tool selector`);
|
|
73
|
+
}
|
|
74
|
+
for (const t of matchTools(available, selector, opts)) {
|
|
75
|
+
if (drop) {
|
|
76
|
+
chosen.delete(t.name);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
chosen.set(t.name, t);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return [...chosen.values()];
|
|
84
|
+
}
|
|
85
|
+
function matchTools(available, selector, opts) {
|
|
86
|
+
if (selector === '*') {
|
|
87
|
+
return available;
|
|
88
|
+
}
|
|
89
|
+
if (selector.endsWith(':*')) {
|
|
90
|
+
const group = selector.slice(0, -2);
|
|
91
|
+
const hits = available.filter((t) => t.group === group);
|
|
92
|
+
if (hits.length === 0) {
|
|
93
|
+
const groups = [...new Set(available.map((t) => t.group).filter(Boolean))];
|
|
94
|
+
throw new Error(`${opts.where}: no tools in group "${group}" ` +
|
|
95
|
+
`(known groups: ${groups.join(', ') || 'none'})`);
|
|
96
|
+
}
|
|
97
|
+
return hits;
|
|
98
|
+
}
|
|
99
|
+
const exact = available.find((t) => t.name === selector);
|
|
100
|
+
if (exact) {
|
|
101
|
+
return [exact];
|
|
102
|
+
}
|
|
103
|
+
const known = available.map((t) => t.name).join(', ') || 'none';
|
|
104
|
+
throw new Error(`${opts.where}: unknown tool "${selector}" ` +
|
|
105
|
+
(opts.hint ? `(${opts.hint}; known: ${known})` : `(known: ${known})`));
|
|
106
|
+
}
|
|
107
|
+
// Built-in tool names. Hand-offs, memory, skills and forks are all ordinary
|
|
108
|
+
// tools, so the model drives everything with one mechanism; the kernel
|
|
109
|
+
// recognises them by these names alone.
|
|
110
|
+
export const HANDOFF_PREFIX = 'transfer_to_';
|
|
111
|
+
export const FORK_TOOL = 'fork';
|
|
112
|
+
export const FINAL_OUTPUT_TOOL = 'final_output';
|
|
113
|
+
export const MEMORY_SEARCH_TOOL = 'memory_search';
|
|
114
|
+
export const MEMORY_WRITE_TOOL = 'memory_write';
|
|
115
|
+
export const MEMORY_UPDATE_TOOL = 'memory_update';
|
|
116
|
+
export const MEMORY_DELETE_TOOL = 'memory_delete';
|
|
117
|
+
export const SKILL_SEARCH_TOOL = 'skill_search';
|
|
118
|
+
export const SKILL_LOAD_TOOL = 'skill_load';
|
|
119
|
+
export function parseArgs(raw) {
|
|
120
|
+
try {
|
|
121
|
+
const v = JSON.parse(raw || '{}');
|
|
122
|
+
return v !== null && typeof v === 'object' ? v : {};
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
return {};
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
export function asString(v) {
|
|
129
|
+
return typeof v === 'string' ? v : undefined;
|
|
130
|
+
}
|
|
131
|
+
export function stringify(v) {
|
|
132
|
+
return typeof v === 'string' ? v : JSON.stringify(v ?? null);
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=types.js.map
|
package/package.json
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@zenera/neo",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "A multi-agent runtime for Node.js: agents, models, tools, skills, memory and an append-only trajectory.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"agents",
|
|
7
|
+
"ai-agents",
|
|
8
|
+
"multi-agent",
|
|
9
|
+
"llm",
|
|
10
|
+
"agent-runtime",
|
|
11
|
+
"tool-calling",
|
|
12
|
+
"openai",
|
|
13
|
+
"anthropic",
|
|
14
|
+
"gemini",
|
|
15
|
+
"typescript"
|
|
16
|
+
],
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"publishConfig": {
|
|
19
|
+
"access": "public"
|
|
20
|
+
},
|
|
21
|
+
"author": "Andrey Ryabov",
|
|
22
|
+
"homepage": "https://github.com/andreyryabov/ZeneraNeo#readme",
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/andreyryabov/ZeneraNeo.git",
|
|
26
|
+
"directory": "packages/neo"
|
|
27
|
+
},
|
|
28
|
+
"bugs": "https://github.com/andreyryabov/ZeneraNeo/issues",
|
|
29
|
+
"type": "module",
|
|
30
|
+
"main": "./dist/index.js",
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"exports": {
|
|
33
|
+
".": {
|
|
34
|
+
"types": "./dist/index.d.ts",
|
|
35
|
+
"default": "./dist/index.js"
|
|
36
|
+
},
|
|
37
|
+
"./payload-stores": {
|
|
38
|
+
"types": "./dist/payload-stores/index.d.ts",
|
|
39
|
+
"default": "./dist/payload-stores/index.js"
|
|
40
|
+
},
|
|
41
|
+
"./memory-stores": {
|
|
42
|
+
"types": "./dist/memory-stores/index.d.ts",
|
|
43
|
+
"default": "./dist/memory-stores/index.js"
|
|
44
|
+
},
|
|
45
|
+
"./skill-providers": {
|
|
46
|
+
"types": "./dist/skill-providers/index.d.ts",
|
|
47
|
+
"default": "./dist/skill-providers/index.js"
|
|
48
|
+
},
|
|
49
|
+
"./project": {
|
|
50
|
+
"types": "./dist/project/index.d.ts",
|
|
51
|
+
"default": "./dist/project/index.js"
|
|
52
|
+
},
|
|
53
|
+
"./package.json": "./package.json"
|
|
54
|
+
},
|
|
55
|
+
"sideEffects": false,
|
|
56
|
+
"files": [
|
|
57
|
+
"dist",
|
|
58
|
+
"!dist/**/*.map"
|
|
59
|
+
],
|
|
60
|
+
"engines": {
|
|
61
|
+
"node": ">=24"
|
|
62
|
+
},
|
|
63
|
+
"scripts": {
|
|
64
|
+
"build": "tsc -b",
|
|
65
|
+
"clean": "tsc -b --clean && rm -rf dist",
|
|
66
|
+
"prepack": "tsc -b"
|
|
67
|
+
},
|
|
68
|
+
"dependencies": {
|
|
69
|
+
"yaml": "^2.9.0",
|
|
70
|
+
"zod": "^4.4.3"
|
|
71
|
+
},
|
|
72
|
+
"peerDependencies": {
|
|
73
|
+
"@anthropic-ai/sdk": "^0.120.0",
|
|
74
|
+
"@google/genai": "^2.18.0",
|
|
75
|
+
"@openrouter/sdk": "^1.2.80",
|
|
76
|
+
"openai": "^6.0.0"
|
|
77
|
+
},
|
|
78
|
+
"peerDependenciesMeta": {
|
|
79
|
+
"@anthropic-ai/sdk": {
|
|
80
|
+
"optional": true
|
|
81
|
+
},
|
|
82
|
+
"@google/genai": {
|
|
83
|
+
"optional": true
|
|
84
|
+
},
|
|
85
|
+
"@openrouter/sdk": {
|
|
86
|
+
"optional": true
|
|
87
|
+
},
|
|
88
|
+
"openai": {
|
|
89
|
+
"optional": true
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"devDependencies": {
|
|
93
|
+
"@anthropic-ai/sdk": "^0.120.0",
|
|
94
|
+
"@google/genai": "^2.18.0",
|
|
95
|
+
"@openrouter/sdk": "^1.2.80",
|
|
96
|
+
"openai": "^6.0.0"
|
|
97
|
+
}
|
|
98
|
+
}
|