zidane 1.0.2 → 1.2.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/README.md +723 -0
- package/dist/agent-DvZm8U14.d.ts +313 -0
- package/dist/chunk-26LIQARN.js +109 -0
- package/dist/chunk-27EP7HB3.js +1005 -0
- package/dist/chunk-34KXKPNN.js +45 -0
- package/dist/chunk-LMSOIIAT.js +274 -0
- package/dist/chunk-LS57GDAV.js +365 -0
- package/dist/chunk-PNKVD2UK.js +26 -0
- package/dist/harnesses.d.ts +7 -0
- package/dist/harnesses.js +13 -0
- package/dist/index.d.ts +56 -0
- package/dist/index.js +57 -0
- package/dist/mcp.d.ts +7 -0
- package/dist/mcp.js +11 -0
- package/dist/providers.d.ts +65 -0
- package/dist/providers.js +257 -0
- package/dist/session.d.ts +167 -0
- package/dist/session.js +27 -0
- package/dist/spawn-pP2grsVp.d.ts +63 -0
- package/dist/tools.d.ts +28 -0
- package/dist/tools.js +20 -0
- package/dist/types-4CFQ-6Qu.d.ts +94 -0
- package/package.json +69 -6
- package/index.js +0 -1
- package/zidane.jpeg +0 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { f as HarnessConfig, g as ToolDef } from './agent-DvZm8U14.js';
|
|
2
|
+
import { a as AgentStats } from './types-4CFQ-6Qu.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Spawn tool — create sub-agents from a parent agent.
|
|
6
|
+
*
|
|
7
|
+
* A static tool that reads provider and harness from ToolContext.
|
|
8
|
+
* Just add it to any harness's tools — no factory needed.
|
|
9
|
+
*
|
|
10
|
+
* Usage:
|
|
11
|
+
* import { spawn } from 'zidane'
|
|
12
|
+
*
|
|
13
|
+
* const harness = defineHarness({
|
|
14
|
+
* name: 'orchestrator',
|
|
15
|
+
* tools: { ...basicTools, spawn },
|
|
16
|
+
* })
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
interface ChildAgent {
|
|
20
|
+
id: string;
|
|
21
|
+
task: string;
|
|
22
|
+
startedAt: number;
|
|
23
|
+
}
|
|
24
|
+
interface SpawnToolState {
|
|
25
|
+
/** Currently running children */
|
|
26
|
+
readonly children: ReadonlyMap<string, ChildAgent>;
|
|
27
|
+
/** Aggregated stats from all completed children (returns a copy) */
|
|
28
|
+
readonly totalChildStats: Readonly<AgentStats>;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Static spawn tool — add directly to any harness.
|
|
32
|
+
*
|
|
33
|
+
* Reads provider and harness from ToolContext at execution time.
|
|
34
|
+
* Children get the same harness as the parent (including spawn),
|
|
35
|
+
* so sub-agents can spawn their own children.
|
|
36
|
+
*/
|
|
37
|
+
declare const spawn: ToolDef & SpawnToolState;
|
|
38
|
+
interface SpawnToolOptions {
|
|
39
|
+
/** Maximum concurrent sub-agents (default: 3) */
|
|
40
|
+
maxConcurrent?: number;
|
|
41
|
+
/** Model override for child agents */
|
|
42
|
+
model?: string;
|
|
43
|
+
/** System prompt for child agents */
|
|
44
|
+
system?: string;
|
|
45
|
+
/** Thinking level for child agents */
|
|
46
|
+
thinking?: 'off' | 'minimal' | 'low' | 'medium' | 'high';
|
|
47
|
+
/** Override harness for children (defaults to parent's harness from ToolContext) */
|
|
48
|
+
harness?: HarnessConfig;
|
|
49
|
+
/** Called when a child agent starts */
|
|
50
|
+
onSpawn?: (child: ChildAgent) => void;
|
|
51
|
+
/** Called when a child agent completes */
|
|
52
|
+
onComplete?: (child: ChildAgent, stats: AgentStats) => void;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Create a configured spawn tool with custom options.
|
|
56
|
+
*
|
|
57
|
+
* For most cases, use the static `spawn` export directly.
|
|
58
|
+
* Use this factory when you need custom concurrency limits,
|
|
59
|
+
* model overrides, or lifecycle callbacks.
|
|
60
|
+
*/
|
|
61
|
+
declare function createSpawnTool(options?: SpawnToolOptions): ToolDef & SpawnToolState;
|
|
62
|
+
|
|
63
|
+
export { type ChildAgent as C, type SpawnToolOptions as S, type SpawnToolState as a, createSpawnTool as c, spawn as s };
|
package/dist/tools.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { g as ToolDef } from './agent-DvZm8U14.js';
|
|
2
|
+
export { C as ChildAgent, S as SpawnToolOptions, a as SpawnToolState, c as createSpawnTool, s as spawn } from './spawn-pP2grsVp.js';
|
|
3
|
+
import 'hookable';
|
|
4
|
+
import '@anthropic-ai/sdk';
|
|
5
|
+
import './types-4CFQ-6Qu.js';
|
|
6
|
+
import '@modelcontextprotocol/sdk/client/index.js';
|
|
7
|
+
import './providers.js';
|
|
8
|
+
import './session.js';
|
|
9
|
+
|
|
10
|
+
declare const listFiles: ToolDef;
|
|
11
|
+
|
|
12
|
+
declare const readFile: ToolDef;
|
|
13
|
+
|
|
14
|
+
declare const shell: ToolDef;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Simple tool argument validation against JSON Schema-style input_schema.
|
|
18
|
+
* Checks required fields are present; type coercion is left to the tools themselves.
|
|
19
|
+
*/
|
|
20
|
+
interface ValidationResult {
|
|
21
|
+
valid: boolean;
|
|
22
|
+
error?: string;
|
|
23
|
+
}
|
|
24
|
+
declare function validateToolArgs(input: Record<string, unknown>, schema: Record<string, unknown>): ValidationResult;
|
|
25
|
+
|
|
26
|
+
declare const writeFile: ToolDef;
|
|
27
|
+
|
|
28
|
+
export { type ValidationResult, listFiles, readFile, shell, validateToolArgs, writeFile };
|
package/dist/tools.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createSpawnTool,
|
|
3
|
+
listFiles,
|
|
4
|
+
readFile,
|
|
5
|
+
shell,
|
|
6
|
+
spawn,
|
|
7
|
+
validateToolArgs,
|
|
8
|
+
writeFile
|
|
9
|
+
} from "./chunk-27EP7HB3.js";
|
|
10
|
+
import "./chunk-26LIQARN.js";
|
|
11
|
+
import "./chunk-PNKVD2UK.js";
|
|
12
|
+
export {
|
|
13
|
+
createSpawnTool,
|
|
14
|
+
listFiles,
|
|
15
|
+
readFile,
|
|
16
|
+
shell,
|
|
17
|
+
spawn,
|
|
18
|
+
validateToolArgs,
|
|
19
|
+
writeFile
|
|
20
|
+
};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types for the agent system.
|
|
3
|
+
*/
|
|
4
|
+
type ThinkingLevel = 'off' | 'minimal' | 'low' | 'medium' | 'high';
|
|
5
|
+
interface McpServerConfig {
|
|
6
|
+
/** Display name (used for tool namespacing) */
|
|
7
|
+
name: string;
|
|
8
|
+
/** Transport type */
|
|
9
|
+
transport: 'stdio' | 'sse' | 'streamable-http';
|
|
10
|
+
/** For stdio: command to run */
|
|
11
|
+
command?: string;
|
|
12
|
+
/** For stdio: command arguments */
|
|
13
|
+
args?: string[];
|
|
14
|
+
/** For stdio: environment variables */
|
|
15
|
+
env?: Record<string, string>;
|
|
16
|
+
/** For sse/streamable-http: server URL */
|
|
17
|
+
url?: string;
|
|
18
|
+
/** Optional headers for HTTP transports */
|
|
19
|
+
headers?: Record<string, string>;
|
|
20
|
+
}
|
|
21
|
+
type ToolExecutionMode = 'sequential' | 'parallel';
|
|
22
|
+
interface ImageContent {
|
|
23
|
+
type: 'image';
|
|
24
|
+
source: {
|
|
25
|
+
type: 'base64';
|
|
26
|
+
media_type: string;
|
|
27
|
+
data: string;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
type SessionContentBlock = {
|
|
31
|
+
type: 'text';
|
|
32
|
+
text: string;
|
|
33
|
+
} | {
|
|
34
|
+
type: 'image';
|
|
35
|
+
mediaType: string;
|
|
36
|
+
data: string;
|
|
37
|
+
} | {
|
|
38
|
+
type: 'tool_call';
|
|
39
|
+
id: string;
|
|
40
|
+
name: string;
|
|
41
|
+
input: Record<string, unknown>;
|
|
42
|
+
} | {
|
|
43
|
+
type: 'tool_result';
|
|
44
|
+
callId: string;
|
|
45
|
+
output: string;
|
|
46
|
+
isError?: boolean;
|
|
47
|
+
} | {
|
|
48
|
+
type: 'thinking';
|
|
49
|
+
text: string;
|
|
50
|
+
};
|
|
51
|
+
interface SessionMessage {
|
|
52
|
+
role: 'user' | 'assistant';
|
|
53
|
+
content: SessionContentBlock[];
|
|
54
|
+
}
|
|
55
|
+
interface AgentRunOptions {
|
|
56
|
+
model?: string;
|
|
57
|
+
prompt: string;
|
|
58
|
+
system?: string;
|
|
59
|
+
thinking?: ThinkingLevel;
|
|
60
|
+
images?: ImageContent[];
|
|
61
|
+
/** Abort signal — when triggered, the agent stops after the current turn */
|
|
62
|
+
signal?: AbortSignal;
|
|
63
|
+
}
|
|
64
|
+
interface TurnUsage {
|
|
65
|
+
input: number;
|
|
66
|
+
output: number;
|
|
67
|
+
/** Tokens written to cache (Anthropic) */
|
|
68
|
+
cacheCreation?: number;
|
|
69
|
+
/** Tokens read from cache (Anthropic) */
|
|
70
|
+
cacheRead?: number;
|
|
71
|
+
/** Thinking/reasoning tokens used */
|
|
72
|
+
thinking?: number;
|
|
73
|
+
/** Cost in USD as reported by the provider (OpenRouter) */
|
|
74
|
+
cost?: number;
|
|
75
|
+
}
|
|
76
|
+
interface AgentStats {
|
|
77
|
+
totalIn: number;
|
|
78
|
+
totalOut: number;
|
|
79
|
+
turns: number;
|
|
80
|
+
elapsed: number;
|
|
81
|
+
/** Per-turn usage breakdown */
|
|
82
|
+
turnUsage?: TurnUsage[];
|
|
83
|
+
/** Total cost in USD (sum of per-turn costs reported by provider) */
|
|
84
|
+
cost?: number;
|
|
85
|
+
/** Stats from child agents spawned during this run */
|
|
86
|
+
children?: ChildRunStats[];
|
|
87
|
+
}
|
|
88
|
+
interface ChildRunStats {
|
|
89
|
+
id: string;
|
|
90
|
+
task: string;
|
|
91
|
+
stats: AgentStats;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export type { AgentRunOptions as A, ChildRunStats as C, ImageContent as I, McpServerConfig as M, SessionContentBlock as S, ThinkingLevel as T, AgentStats as a, SessionMessage as b, ToolExecutionMode as c, TurnUsage as d };
|
package/package.json
CHANGED
|
@@ -1,11 +1,74 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zidane",
|
|
3
|
-
"version": "1.0
|
|
4
|
-
"description": "
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"description": "an agent that goes straight to the goal",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"private": false,
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/Tahul/zidane"
|
|
8
10
|
},
|
|
9
11
|
"author": "Yaël GUILLOUX <yael.guilloux@gmail.com>",
|
|
10
|
-
"license": "
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/Tahul/zidane/issues"
|
|
15
|
+
},
|
|
16
|
+
"homepage": "https://github.com/Tahul/zidane",
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"import": "./dist/index.js",
|
|
20
|
+
"types": "./dist/index.d.ts"
|
|
21
|
+
},
|
|
22
|
+
"./providers": {
|
|
23
|
+
"import": "./dist/providers.js",
|
|
24
|
+
"types": "./dist/providers.d.ts"
|
|
25
|
+
},
|
|
26
|
+
"./tools": {
|
|
27
|
+
"import": "./dist/tools.js",
|
|
28
|
+
"types": "./dist/tools.d.ts"
|
|
29
|
+
},
|
|
30
|
+
"./harnesses": {
|
|
31
|
+
"import": "./dist/harnesses.js",
|
|
32
|
+
"types": "./dist/harnesses.d.ts"
|
|
33
|
+
},
|
|
34
|
+
"./mcp": {
|
|
35
|
+
"import": "./dist/mcp.js",
|
|
36
|
+
"types": "./dist/mcp.d.ts"
|
|
37
|
+
},
|
|
38
|
+
"./session": {
|
|
39
|
+
"import": "./dist/session.js",
|
|
40
|
+
"types": "./dist/session.d.ts"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"main": "./dist/index.js",
|
|
44
|
+
"types": "./dist/index.d.ts",
|
|
45
|
+
"files": [
|
|
46
|
+
"dist"
|
|
47
|
+
],
|
|
48
|
+
"scripts": {
|
|
49
|
+
"auth": "bun run src/auth.ts",
|
|
50
|
+
"start": "bun run src/start.ts",
|
|
51
|
+
"build": "tsup",
|
|
52
|
+
"lint": "eslint .",
|
|
53
|
+
"lint:fix": "eslint . --fix",
|
|
54
|
+
"test": "bun test",
|
|
55
|
+
"release": "bumpp"
|
|
56
|
+
},
|
|
57
|
+
"dependencies": {
|
|
58
|
+
"@anthropic-ai/sdk": "^0.80.0",
|
|
59
|
+
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
60
|
+
"@yaelg/pi-ai": "^0.58.4",
|
|
61
|
+
"chalk": "^5.6.2",
|
|
62
|
+
"hookable": "^6.1.0",
|
|
63
|
+
"md4x": "^0.0.25"
|
|
64
|
+
},
|
|
65
|
+
"devDependencies": {
|
|
66
|
+
"@antfu/eslint-config": "^7.7.3",
|
|
67
|
+
"@types/bun": "^1.3.11",
|
|
68
|
+
"@types/dockerode": "^4.0.1",
|
|
69
|
+
"bumpp": "^11.0.1",
|
|
70
|
+
"eslint": "^10.0.3",
|
|
71
|
+
"jiti": "^2.6.1",
|
|
72
|
+
"tsup": "^8.5.1"
|
|
73
|
+
}
|
|
11
74
|
}
|
package/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default () => console.log('1998')
|
package/zidane.jpeg
DELETED
|
Binary file
|