zidane 1.1.5 → 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.
@@ -1,125 +0,0 @@
1
- // src/harnesses/basic.ts
2
- import { execSync } from "child_process";
3
- import { existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync } from "fs";
4
- import { dirname, resolve } from "path";
5
- var cwd = process.cwd();
6
- function safePath(p) {
7
- const resolved = resolve(cwd, p);
8
- if (!resolved.startsWith(cwd))
9
- throw new Error(`Path escapes working directory: ${p}`);
10
- return resolved;
11
- }
12
- var shell = {
13
- spec: {
14
- name: "shell",
15
- description: "Execute a shell command and return stdout+stderr. Runs in the project root.",
16
- input_schema: {
17
- type: "object",
18
- properties: {
19
- command: { type: "string", description: "The shell command to run" }
20
- },
21
- required: ["command"]
22
- }
23
- },
24
- async execute({ command }) {
25
- try {
26
- const out = execSync(command, {
27
- cwd,
28
- encoding: "utf-8",
29
- timeout: 3e4,
30
- maxBuffer: 1024 * 1024,
31
- stdio: ["pipe", "pipe", "pipe"]
32
- });
33
- return out || "(no output)";
34
- } catch (err) {
35
- const stderr = err.stderr?.toString() ?? "";
36
- const stdout = err.stdout?.toString() ?? "";
37
- return `Exit code ${err.status ?? 1}
38
- ${stdout}
39
- ${stderr}`.trim();
40
- }
41
- }
42
- };
43
- var readFile = {
44
- spec: {
45
- name: "read_file",
46
- description: "Read the contents of a file at the given path (relative to project root).",
47
- input_schema: {
48
- type: "object",
49
- properties: {
50
- path: { type: "string", description: "Relative file path" }
51
- },
52
- required: ["path"]
53
- }
54
- },
55
- async execute({ path }) {
56
- const target = safePath(path);
57
- if (!existsSync(target))
58
- return `File not found: ${path}`;
59
- return readFileSync(target, "utf-8");
60
- }
61
- };
62
- var writeFile = {
63
- spec: {
64
- name: "write_file",
65
- description: "Write content to a file. Creates parent directories if needed.",
66
- input_schema: {
67
- type: "object",
68
- properties: {
69
- path: { type: "string", description: "Relative file path" },
70
- content: { type: "string", description: "File content to write" }
71
- },
72
- required: ["path", "content"]
73
- }
74
- },
75
- async execute({ path, content }) {
76
- const target = safePath(path);
77
- mkdirSync(dirname(target), { recursive: true });
78
- writeFileSync(target, content);
79
- return `Wrote ${content.length} bytes to ${path}`;
80
- }
81
- };
82
- var listFiles = {
83
- spec: {
84
- name: "list_files",
85
- description: "List files and directories at the given path (relative to project root).",
86
- input_schema: {
87
- type: "object",
88
- properties: {
89
- path: { type: "string", description: 'Relative directory path (default: ".")' }
90
- },
91
- required: []
92
- }
93
- },
94
- async execute({ path }) {
95
- const target = safePath(path || ".");
96
- if (!existsSync(target))
97
- return `Directory not found: ${path}`;
98
- const entries = readdirSync(target);
99
- return entries.map((name) => {
100
- const full = resolve(target, name);
101
- const isDir = statSync(full).isDirectory();
102
- return `${isDir ? "\u{1F4C1}" : "\u{1F4C4}"} ${name}`;
103
- }).join("\n");
104
- }
105
- };
106
- var basic_default = defineHarness({
107
- name: "basic",
108
- system: "You are a helpful assistant with access to shell, file reading, file writing, and directory listing tools. Use them to accomplish tasks in the project directory.",
109
- tools: {
110
- shell,
111
- readFile,
112
- writeFile,
113
- listFiles
114
- }
115
- });
116
-
117
- // src/harnesses/index.ts
118
- function defineHarness(config) {
119
- return config;
120
- }
121
-
122
- export {
123
- basic_default,
124
- defineHarness
125
- };
@@ -1,101 +0,0 @@
1
- /**
2
- * Shared types for the agent system.
3
- */
4
- type ThinkingLevel = 'off' | 'minimal' | 'low' | 'medium' | 'high';
5
- type ToolExecutionMode = 'sequential' | 'parallel';
6
- interface ImageContent {
7
- type: 'image';
8
- source: {
9
- type: 'base64';
10
- media_type: string;
11
- data: string;
12
- };
13
- }
14
- type ContentBlock = {
15
- type: 'text';
16
- text: string;
17
- } | ImageContent;
18
- interface AgentRunOptions {
19
- model?: string;
20
- prompt: string;
21
- system?: string;
22
- thinking?: ThinkingLevel;
23
- images?: ImageContent[];
24
- }
25
- interface AgentStats {
26
- totalIn: number;
27
- totalOut: number;
28
- turns: number;
29
- elapsed: number;
30
- }
31
-
32
- declare function anthropic(): Provider;
33
-
34
- declare function cerebras(defaultModel?: string): Provider;
35
-
36
- declare function openrouter(defaultModel?: string): Provider;
37
-
38
- interface ToolSpec {
39
- name: string;
40
- description: string;
41
- input_schema: Record<string, unknown>;
42
- }
43
- interface ToolCall {
44
- id: string;
45
- name: string;
46
- input: Record<string, unknown>;
47
- }
48
- interface ToolResult {
49
- id: string;
50
- content: string;
51
- }
52
- interface Message {
53
- role: 'user' | 'assistant';
54
- content: unknown;
55
- }
56
- interface StreamCallbacks {
57
- onText: (delta: string) => void;
58
- }
59
- interface TurnResult {
60
- /** Full response to push into message history as assistant turn */
61
- assistantMessage: unknown;
62
- /** Text content blocks concatenated */
63
- text: string;
64
- /** Tool calls requested by the model */
65
- toolCalls: ToolCall[];
66
- /** Whether the model wants to stop */
67
- done: boolean;
68
- usage: {
69
- input: number;
70
- output: number;
71
- };
72
- }
73
- interface StreamOptions {
74
- model: string;
75
- system: string;
76
- tools: unknown[];
77
- messages: Message[];
78
- maxTokens: number;
79
- /** Thinking/reasoning level (optional, default: off) */
80
- thinking?: ThinkingLevel;
81
- /** Abort signal for cancellation */
82
- signal?: AbortSignal;
83
- }
84
- interface Provider {
85
- readonly name: string;
86
- readonly meta: {
87
- defaultModel: string;
88
- } & Record<string, unknown>;
89
- /** Format tool specs for this provider */
90
- formatTools: (tools: ToolSpec[]) => unknown[];
91
- /** Create a user message (text or with images) */
92
- userMessage: (content: string, images?: ImageContent[]) => Message;
93
- /** Create an assistant message (for priming) */
94
- assistantMessage: (content: string) => Message;
95
- /** Create a tool results message to send back */
96
- toolResultsMessage: (results: ToolResult[]) => Message;
97
- /** Stream a turn, calling onText for each text delta */
98
- stream: (options: StreamOptions, callbacks: StreamCallbacks) => Promise<TurnResult>;
99
- }
100
-
101
- export { type AgentStats as A, type ContentBlock as C, type ImageContent as I, type Message as M, type Provider as P, type StreamOptions as S, type ToolExecutionMode as T, type AgentRunOptions as a, type ThinkingLevel as b, type StreamCallbacks as c, type ToolCall as d, type ToolResult as e, type ToolSpec as f, type TurnResult as g, anthropic as h, cerebras as i, openrouter as o };