@zenera/neo 1.1.54 → 1.1.56

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/dist/types.d.ts CHANGED
@@ -144,6 +144,47 @@ export interface ToolReturn {
144
144
  }
145
145
  export declare function withEffects(output: unknown, ...effects: ToolEffect[]): ToolReturn;
146
146
  export declare function isToolReturn(v: unknown): v is ToolReturn;
147
+ declare const TOOL_SUSPEND: unique symbol;
148
+ export interface SuspendSpec {
149
+ /** what the run waits for, in the host's own words (e.g. "mcp_auth", "input") */
150
+ reason: string;
151
+ /** a human-readable prompt for whoever answers */
152
+ message?: string;
153
+ /** anything the host needs to resolve it; must be JSON */
154
+ data?: unknown;
155
+ /** the shape of the answer expected, when the answer becomes the result */
156
+ responseSchema?: Record<string, unknown>;
157
+ }
158
+ export interface ToolSuspend {
159
+ [TOOL_SUSPEND]: true;
160
+ spec: SuspendSpec;
161
+ }
162
+ export declare function suspend(spec: SuspendSpec): ToolSuspend;
163
+ export declare function isToolSuspend(v: unknown): v is ToolSuspend;
164
+ /** A pending tool call a run is suspended on. Lives in `AgentState.suspended`. */
165
+ export interface Suspension extends SuspendSpec {
166
+ callId: string;
167
+ /** the tool that suspended */
168
+ name: string;
169
+ /** when it suspended, as the run's clock writes times */
170
+ at: string;
171
+ }
172
+ /**
173
+ * The answer to one suspension, given to `runner.resume`.
174
+ * resolved + rerun - what was needed is done; run the call again
175
+ * resolved + payload - the payload is the call's result
176
+ * cancelled - nobody will answer; the call gets `message` as an error
177
+ */
178
+ export type ResumeAnswer = {
179
+ status: 'resolved';
180
+ rerun: true;
181
+ } | {
182
+ status: 'resolved';
183
+ payload: unknown;
184
+ } | {
185
+ status: 'cancelled';
186
+ message?: string;
187
+ };
147
188
  export interface Tool<TArgs = unknown, TCtx = unknown> extends ToolSchema {
148
189
  /**
149
190
  * The family this tool belongs to, so config can name the whole set at
@@ -188,6 +229,7 @@ export declare const MEMORY_GREP_TOOL = "memory_grep";
188
229
  export declare const MEMORY_LOAD_TOOL = "memory_load";
189
230
  export declare const MEMORY_COMMIT_TOOL = "memory_commit";
190
231
  export declare const MEMORY_FORGET_TOOL = "memory_forget";
232
+ export declare const MEMORY_COPY_FILE_TOOL = "memory_copy_file";
191
233
  export declare const SKILL_SEARCH_TOOL = "skill_search";
192
234
  export declare const SKILL_LOAD_TOOL = "skill_load";
193
235
  export declare function parseArgs(raw: string): Record<string, unknown>;
package/dist/types.js CHANGED
@@ -50,6 +50,27 @@ export function withEffects(output, ...effects) {
50
50
  export function isToolReturn(v) {
51
51
  return v !== null && typeof v === 'object' && TOOL_RETURN in v;
52
52
  }
53
+ // ---------------------------------------------------------------------------
54
+ // Suspending a run
55
+ //
56
+ // Some tools cannot finish without a person: an account to connect, a value
57
+ // only someone knows, an approval. Such a tool returns `suspend(...)` instead
58
+ // of a result. The run then stops with the call still pending - nothing is
59
+ // held while it waits - and a later `runner.resume(state, { answers })` either
60
+ // runs the call again (the person did what was needed) or hands the call an
61
+ // answer as its result. What the pause is about is the host's business: the
62
+ // runner only carries `reason`, `message` and `data` through to whoever shows
63
+ // it, and `responseSchema` to whoever collects the answer.
64
+ // ---------------------------------------------------------------------------
65
+ // Registered (`Symbol.for`) so a plugin with no dependencies can suspend too:
66
+ // `{ [Symbol.for('zenera.neo.toolSuspend')]: true, spec }` is what `suspend` makes.
67
+ const TOOL_SUSPEND = Symbol.for('zenera.neo.toolSuspend');
68
+ export function suspend(spec) {
69
+ return { [TOOL_SUSPEND]: true, spec };
70
+ }
71
+ export function isToolSuspend(v) {
72
+ return v !== null && typeof v === 'object' && TOOL_SUSPEND in v;
73
+ }
53
74
  /**
54
75
  * Identity helper. Its only job is inference: written inline, `execute`'s
55
76
  * `args` would be `unknown`; going through `tool<{city: string}>()` types it.
@@ -148,6 +169,7 @@ export const MEMORY_GREP_TOOL = 'memory_grep';
148
169
  export const MEMORY_LOAD_TOOL = 'memory_load';
149
170
  export const MEMORY_COMMIT_TOOL = 'memory_commit';
150
171
  export const MEMORY_FORGET_TOOL = 'memory_forget';
172
+ export const MEMORY_COPY_FILE_TOOL = 'memory_copy_file';
151
173
  export const SKILL_SEARCH_TOOL = 'skill_search';
152
174
  export const SKILL_LOAD_TOOL = 'skill_load';
153
175
  export function parseArgs(raw) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zenera/neo",
3
- "version": "1.1.54",
3
+ "version": "1.1.56",
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,6 +62,7 @@
62
62
  "prepack": "tsc -b"
63
63
  },
64
64
  "dependencies": {
65
+ "@zenera/sandbox": "^1.1.56",
65
66
  "graphology": "^0.26.0",
66
67
  "yaml": "^2.9.1",
67
68
  "zod": "^4.6.7"
@@ -1,79 +0,0 @@
1
- import { type AnyTool } from '../types.ts';
2
- /** Where a project's `assets/` directory appears in the agent's namespace. */
3
- export declare const ASSETS_MOUNT = "/assets";
4
- /** ...and where its skill catalog does, so a skill's scripts can be run. */
5
- export declare const SKILLS_MOUNT = "/skills";
6
- /**
7
- * A second tree the agent can reach, under a name of its own. Structurally the
8
- * same as a `SandboxMount` on purpose: one directory is one mount, and the host
9
- * hands the identical array to the file tools and to the container so that both
10
- * call it by the same name.
11
- */
12
- export interface WorkspaceMount {
13
- /** absolute host path; must already exist */
14
- host: string;
15
- /** absolute path the agent names it by, e.g. `/assets` */
16
- at: string;
17
- /** defaults to true — an extra tree is reference material unless said otherwise */
18
- readOnly?: boolean;
19
- }
20
- export interface WorkspaceOptions {
21
- root: string;
22
- /** refuse every mutating tool; `zen run --read-only` */
23
- readOnly?: boolean;
24
- /**
25
- * An absolute path the root is *also* known by, because something else has
26
- * mounted it there — the sandbox bind-mounts the workspace at `/workspace`,
27
- * so `run_command` returns compiler errors, stack traces and `pwd` output
28
- * naming files under a prefix the file tools would otherwise refuse. Set
29
- * it and both spellings reach the same file.
30
- */
31
- mount?: string;
32
- /** further trees, each under its own name; read-only unless one says otherwise */
33
- mounts?: readonly WorkspaceMount[];
34
- }
35
- export declare class Workspace {
36
- #private;
37
- readonly root: string;
38
- readonly readOnly: boolean;
39
- readonly mount: string | undefined;
40
- /** the extra trees, resolved — the primary root is not among them */
41
- readonly mounts: readonly Required<WorkspaceMount>[];
42
- constructor(opts: WorkspaceOptions);
43
- /**
44
- * The one gate. Returns an absolute path inside one of the roots, or throws.
45
- *
46
- * A path that does not exist yet cannot be realpath'd, so the nearest
47
- * existing ancestor is resolved instead and the remainder appended — which
48
- * is exactly what a create needs and closes the same hole a create opens.
49
- */
50
- within(input: string, opts?: {
51
- write?: boolean;
52
- }): string;
53
- /** Where a path sits under its own root, in posix form. `.` is that root. */
54
- rel(path: string): string;
55
- /**
56
- * How a path is written back to the model, and the reason `mount` is not
57
- * only about what comes in. A shell in the sandbox prints the mounted name
58
- * — `find` returns /workspace/src/a.ts — so if the file tools answered with
59
- * `src/a.ts` the model would be holding two vocabularies for one tree and
60
- * would have to translate between them to feed one tool's output to the
61
- * other. With a mount configured every path in and every path out is the
62
- * mounted one, and copying a path from a command's output into read_file
63
- * is exact. Without one, everything stays relative as before.
64
- */
65
- show(path: string): string;
66
- /** Whether a resolved path *is* one of the roots. Nothing may move or delete one. */
67
- isRoot(path: string): boolean;
68
- mutable(): void;
69
- }
70
- export type FileFormat = 'text' | 'binary' | 'image' | 'audio' | 'video' | 'pdf' | 'archive';
71
- export interface FileInfo {
72
- name: string;
73
- kind: 'file' | 'dir' | 'link' | 'other';
74
- format?: FileFormat;
75
- bytes?: number;
76
- lines?: number;
77
- }
78
- export declare function workspaceTools<TCtx = unknown>(opts: WorkspaceOptions): AnyTool<TCtx>[];
79
- //# sourceMappingURL=workspace.d.ts.map