clanka 0.0.1
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 -0
- package/dist/Agent.d.ts +119 -0
- package/dist/Agent.d.ts.map +1 -0
- package/dist/Agent.js +240 -0
- package/dist/Agent.js.map +1 -0
- package/dist/AgentTools.d.ts +246 -0
- package/dist/AgentTools.d.ts.map +1 -0
- package/dist/AgentTools.js +374 -0
- package/dist/AgentTools.js.map +1 -0
- package/dist/AgentTools.test.d.ts +2 -0
- package/dist/AgentTools.test.d.ts.map +1 -0
- package/dist/AgentTools.test.js +147 -0
- package/dist/AgentTools.test.js.map +1 -0
- package/dist/ApplyPatch.d.ts +27 -0
- package/dist/ApplyPatch.d.ts.map +1 -0
- package/dist/ApplyPatch.js +343 -0
- package/dist/ApplyPatch.js.map +1 -0
- package/dist/ApplyPatch.test.d.ts +2 -0
- package/dist/ApplyPatch.test.d.ts.map +1 -0
- package/dist/ApplyPatch.test.js +99 -0
- package/dist/ApplyPatch.test.js.map +1 -0
- package/dist/Codex.d.ts +11 -0
- package/dist/Codex.d.ts.map +1 -0
- package/dist/Codex.js +14 -0
- package/dist/Codex.js.map +1 -0
- package/dist/CodexAuth.d.ts +68 -0
- package/dist/CodexAuth.d.ts.map +1 -0
- package/dist/CodexAuth.js +270 -0
- package/dist/CodexAuth.js.map +1 -0
- package/dist/CodexAuth.test.d.ts +2 -0
- package/dist/CodexAuth.test.d.ts.map +1 -0
- package/dist/CodexAuth.test.js +425 -0
- package/dist/CodexAuth.test.js.map +1 -0
- package/dist/Executor.d.ts +20 -0
- package/dist/Executor.d.ts.map +1 -0
- package/dist/Executor.js +76 -0
- package/dist/Executor.js.map +1 -0
- package/dist/OutputFormatter.d.ts +11 -0
- package/dist/OutputFormatter.d.ts.map +1 -0
- package/dist/OutputFormatter.js +5 -0
- package/dist/OutputFormatter.js.map +1 -0
- package/dist/ToolkitRenderer.d.ts +17 -0
- package/dist/ToolkitRenderer.d.ts.map +1 -0
- package/dist/ToolkitRenderer.js +25 -0
- package/dist/ToolkitRenderer.js.map +1 -0
- package/dist/TypeBuilder.d.ts +11 -0
- package/dist/TypeBuilder.d.ts.map +1 -0
- package/dist/TypeBuilder.js +383 -0
- package/dist/TypeBuilder.js.map +1 -0
- package/dist/TypeBuilder.test.d.ts +2 -0
- package/dist/TypeBuilder.test.d.ts.map +1 -0
- package/dist/TypeBuilder.test.js +243 -0
- package/dist/TypeBuilder.test.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/package.json +72 -0
- package/src/Agent.ts +398 -0
- package/src/AgentTools.test.ts +215 -0
- package/src/AgentTools.ts +507 -0
- package/src/ApplyPatch.test.ts +154 -0
- package/src/ApplyPatch.ts +473 -0
- package/src/Codex.ts +14 -0
- package/src/CodexAuth.test.ts +729 -0
- package/src/CodexAuth.ts +571 -0
- package/src/Executor.ts +129 -0
- package/src/OutputFormatter.ts +17 -0
- package/src/ToolkitRenderer.ts +39 -0
- package/src/TypeBuilder.test.ts +508 -0
- package/src/TypeBuilder.ts +670 -0
- package/src/index.ts +29 -0
package/README.md
ADDED
package/dist/Agent.d.ts
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @since 1.0.0
|
|
3
|
+
*/
|
|
4
|
+
import { Effect, FileSystem, Layer, Path, Schema, Scope, Stream } from "effect";
|
|
5
|
+
import { LanguageModel, Prompt, Tool, Toolkit } from "effect/unstable/ai";
|
|
6
|
+
import { AgentTools } from "./AgentTools.ts";
|
|
7
|
+
import { Executor } from "./Executor.ts";
|
|
8
|
+
import { ToolkitRenderer } from "./ToolkitRenderer.ts";
|
|
9
|
+
import { ProviderName } from "effect/unstable/ai/Model";
|
|
10
|
+
import type { ChildProcessSpawner } from "effect/unstable/process";
|
|
11
|
+
/**
|
|
12
|
+
* @since 1.0.0
|
|
13
|
+
* @category Models
|
|
14
|
+
*/
|
|
15
|
+
export interface Agent {
|
|
16
|
+
readonly output: Stream.Stream<Output, AgentFinished>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A layer that provides most of the common services needed to run an agent.
|
|
20
|
+
*
|
|
21
|
+
* @since 1.0.0
|
|
22
|
+
* @category Services
|
|
23
|
+
*/
|
|
24
|
+
export declare const layerServices: Layer.Layer<Tool.HandlersFor<typeof AgentTools.tools> | Executor | ToolkitRenderer, never, FileSystem.FileSystem | Path.Path | ChildProcessSpawner.ChildProcessSpawner>;
|
|
25
|
+
/**
|
|
26
|
+
* Start an agent in the given directory with the given prompt and tools.
|
|
27
|
+
*
|
|
28
|
+
* @since 1.0.0
|
|
29
|
+
* @category Constructors
|
|
30
|
+
*/
|
|
31
|
+
export declare const make: <Tools extends Record<string, Tool.Any> = {}>(options: {
|
|
32
|
+
/** The working directory to run the agent in */
|
|
33
|
+
readonly directory: string;
|
|
34
|
+
/** The prompt to use for the agent */
|
|
35
|
+
readonly prompt: Prompt.RawInput;
|
|
36
|
+
/** Additional system instructions to provide to the agent */
|
|
37
|
+
readonly system?: string | undefined;
|
|
38
|
+
/** Additional tools to provide to the agent */
|
|
39
|
+
readonly tools?: Toolkit.Toolkit<Tools> | undefined;
|
|
40
|
+
}) => Effect.Effect<Agent, never, Scope.Scope | FileSystem.FileSystem | Path.Path | Executor | LanguageModel.LanguageModel | ProviderName | ToolkitRenderer | Tool.HandlersFor<Tools> | Tool.HandlersFor<typeof AgentTools.tools> | Tool.HandlerServices<Tools[keyof Tools]>>;
|
|
41
|
+
declare const ReasoningStart_base: Schema.ExtendableClass<ReasoningStart, Schema.TaggedStruct<"ReasoningStart", {}>, {}>;
|
|
42
|
+
/**
|
|
43
|
+
* @since 1.0.0
|
|
44
|
+
* @category Output
|
|
45
|
+
*/
|
|
46
|
+
export declare class ReasoningStart extends ReasoningStart_base {
|
|
47
|
+
}
|
|
48
|
+
declare const ReasoningDelta_base: Schema.ExtendableClass<ReasoningDelta, Schema.TaggedStruct<"ReasoningDelta", {
|
|
49
|
+
readonly delta: Schema.String;
|
|
50
|
+
}>, {}>;
|
|
51
|
+
/**
|
|
52
|
+
* @since 1.0.0
|
|
53
|
+
* @category Output
|
|
54
|
+
*/
|
|
55
|
+
export declare class ReasoningDelta extends ReasoningDelta_base {
|
|
56
|
+
}
|
|
57
|
+
declare const ReasoningEnd_base: Schema.ExtendableClass<ReasoningEnd, Schema.TaggedStruct<"ReasoningEnd", {}>, {}>;
|
|
58
|
+
/**
|
|
59
|
+
* @since 1.0.0
|
|
60
|
+
* @category Output
|
|
61
|
+
*/
|
|
62
|
+
export declare class ReasoningEnd extends ReasoningEnd_base {
|
|
63
|
+
}
|
|
64
|
+
declare const ScriptStart_base: Schema.ExtendableClass<ScriptStart, Schema.TaggedStruct<"ScriptStart", {
|
|
65
|
+
readonly script: Schema.String;
|
|
66
|
+
}>, {}>;
|
|
67
|
+
/**
|
|
68
|
+
* @since 1.0.0
|
|
69
|
+
* @category Output
|
|
70
|
+
*/
|
|
71
|
+
export declare class ScriptStart extends ScriptStart_base {
|
|
72
|
+
}
|
|
73
|
+
declare const ScriptEnd_base: Schema.ExtendableClass<ScriptEnd, Schema.TaggedStruct<"ScriptEnd", {
|
|
74
|
+
readonly output: Schema.String;
|
|
75
|
+
}>, {}>;
|
|
76
|
+
/**
|
|
77
|
+
* @since 1.0.0
|
|
78
|
+
* @category Output
|
|
79
|
+
*/
|
|
80
|
+
export declare class ScriptEnd extends ScriptEnd_base {
|
|
81
|
+
}
|
|
82
|
+
declare const AgentFinished_base: Schema.ErrorClass<AgentFinished, Schema.TaggedStruct<"AgentFinished", {
|
|
83
|
+
readonly summary: Schema.String;
|
|
84
|
+
}>, import("effect/Cause").YieldableError>;
|
|
85
|
+
/**
|
|
86
|
+
* @since 1.0.0
|
|
87
|
+
* @category Output
|
|
88
|
+
*/
|
|
89
|
+
export declare class AgentFinished extends AgentFinished_base {
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* @since 1.0.0
|
|
93
|
+
* @category Output
|
|
94
|
+
*/
|
|
95
|
+
export declare const OutputPart: Schema.Union<readonly [typeof ReasoningStart, typeof ReasoningDelta, typeof ReasoningEnd, typeof ScriptStart, typeof ScriptEnd]>;
|
|
96
|
+
/**
|
|
97
|
+
* @since 1.0.0
|
|
98
|
+
* @category Output
|
|
99
|
+
*/
|
|
100
|
+
export type OutputPart = typeof OutputPart.Type;
|
|
101
|
+
declare const SubagentPart_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
102
|
+
readonly _tag: "SubagentPart";
|
|
103
|
+
} & Readonly<A>;
|
|
104
|
+
/**
|
|
105
|
+
* @since 1.0.0
|
|
106
|
+
* @category Output
|
|
107
|
+
*/
|
|
108
|
+
export declare class SubagentPart extends SubagentPart_base<{
|
|
109
|
+
id: number;
|
|
110
|
+
output: Stream.Stream<Output, AgentFinished>;
|
|
111
|
+
}> {
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* @since 1.0.0
|
|
115
|
+
* @category Output
|
|
116
|
+
*/
|
|
117
|
+
export type Output = OutputPart | SubagentPart;
|
|
118
|
+
export {};
|
|
119
|
+
//# sourceMappingURL=Agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Agent.d.ts","sourceRoot":"","sources":["../src/Agent.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAIL,MAAM,EACN,UAAU,EAEV,KAAK,EAEL,IAAI,EAGJ,MAAM,EACN,KAAK,EAEL,MAAM,EACP,MAAM,QAAQ,CAAA;AACf,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AACzE,OAAO,EAEL,UAAU,EAIX,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,QA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C,KAAK,CAAC,GACvB,IAAI,CAAC,WAAW,CAAC,OAAO,UAAU,CAAC,KAAK,CAAC,GACzC,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAuKnC,CAAA;;AA0DT;;;GAGG;AACH,qBAAa,cAAe,SAAQ,mBAGnC;CAAG;;;;AAEJ;;;GAGG;AACH,qBAAa,cAAe,SAAQ,mBAKnC;CAAG;;AAEJ;;;GAGG;AACH,qBAAa,YAAa,SAAQ,iBAGjC;CAAG;;;;AAEJ;;;GAGG;AACH,qBAAa,WAAY,SAAQ,gBAKhC;CAAG;;;;AAEJ;;;GAGG;AACH,qBAAa,SAAU,SAAQ,cAE7B;CAAG;;;;AAEL;;;GAGG;AACH,qBAAa,aAAc,SAAQ,kBAKlC;CAAG;AAEJ;;;GAGG;AACH,eAAO,MAAM,UAAU,kIAMrB,CAAA;AAEF;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC,IAAI,CAAA;;;;AAE/C;;;GAGG;AACH,qBAAa,YAAa,SAAQ,kBAAiC;IACjE,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;CAC7C,CAAC;CAAG;AAEL;;;GAGG;AACH,MAAM,MAAM,MAAM,GAAG,UAAU,GAAG,YAAY,CAAA"}
|
package/dist/Agent.js
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @since 1.0.0
|
|
3
|
+
*/
|
|
4
|
+
import { Array, Data, Deferred, Effect, FileSystem, identity, Layer, Option, Path, pipe, Queue, Schema, Scope, ServiceMap, Stream, } from "effect";
|
|
5
|
+
import { LanguageModel, Prompt, Tool, Toolkit } from "effect/unstable/ai";
|
|
6
|
+
import { AgentToolHandlers, AgentTools, CurrentDirectory, SubagentContext, TaskCompleteDeferred, } from "./AgentTools.js";
|
|
7
|
+
import { Executor } from "./Executor.js";
|
|
8
|
+
import { ToolkitRenderer } from "./ToolkitRenderer.js";
|
|
9
|
+
import { ProviderName } from "effect/unstable/ai/Model";
|
|
10
|
+
import { OpenAiLanguageModel } from "@effect/ai-openai";
|
|
11
|
+
import {} from "effect/unstable/ai/Response";
|
|
12
|
+
/**
|
|
13
|
+
* A layer that provides most of the common services needed to run an agent.
|
|
14
|
+
*
|
|
15
|
+
* @since 1.0.0
|
|
16
|
+
* @category Services
|
|
17
|
+
*/
|
|
18
|
+
export const layerServices = Layer.mergeAll(AgentToolHandlers, Executor.layer, ToolkitRenderer.layer);
|
|
19
|
+
/**
|
|
20
|
+
* Start an agent in the given directory with the given prompt and tools.
|
|
21
|
+
*
|
|
22
|
+
* @since 1.0.0
|
|
23
|
+
* @category Constructors
|
|
24
|
+
*/
|
|
25
|
+
export const make = Effect.fnUntraced(function* (options) {
|
|
26
|
+
const ai = yield* LanguageModel.LanguageModel;
|
|
27
|
+
const provider = yield* ProviderName;
|
|
28
|
+
const fs = yield* FileSystem.FileSystem;
|
|
29
|
+
const pathService = yield* Path.Path;
|
|
30
|
+
const executor = yield* Executor;
|
|
31
|
+
const allTools = Toolkit.merge(AgentTools, options.tools ?? Toolkit.empty);
|
|
32
|
+
const tools = yield* allTools;
|
|
33
|
+
const services = yield* Effect.services();
|
|
34
|
+
let system = yield* generateSystem(allTools);
|
|
35
|
+
if (options.system) {
|
|
36
|
+
system += `\n${options.system}`;
|
|
37
|
+
}
|
|
38
|
+
const withSystemPrompt = OpenAiLanguageModel.withConfigOverride({
|
|
39
|
+
instructions: system,
|
|
40
|
+
});
|
|
41
|
+
const agentsMd = yield* pipe(fs.readFileString(pathService.resolve(options.directory, "AGENTS.md")), Effect.option);
|
|
42
|
+
let subagentId = 0;
|
|
43
|
+
const spawn = Effect.fnUntraced(function* (prompt) {
|
|
44
|
+
const deferred = yield* Deferred.make();
|
|
45
|
+
const output = yield* Queue.make();
|
|
46
|
+
const taskServices = SubagentContext.serviceMap({
|
|
47
|
+
spawn: ({ prompt }) => {
|
|
48
|
+
let id = ++subagentId;
|
|
49
|
+
return spawn(Prompt.make(prompt)).pipe(Stream.broadcast({
|
|
50
|
+
capacity: "unbounded",
|
|
51
|
+
}), Effect.flatMap((stream) => {
|
|
52
|
+
Queue.offerUnsafe(output, new SubagentPart({ id, output: stream }));
|
|
53
|
+
return Stream.runDrain(stream);
|
|
54
|
+
}), Effect.scoped, Effect.as(""), Effect.catch((e) => Effect.succeed(e.summary)));
|
|
55
|
+
},
|
|
56
|
+
}).pipe(ServiceMap.add(CurrentDirectory, options.directory), ServiceMap.add(TaskCompleteDeferred, deferred));
|
|
57
|
+
prompt = Prompt.concat(prompt, agentsMd.pipe(Option.map((md) => Prompt.make(`Here is a copy of ./AGENTS.md. ALWAYS follow these instructions when completing the above task:
|
|
58
|
+
|
|
59
|
+
${md}`)), Option.getOrElse(() => Prompt.empty)));
|
|
60
|
+
if (provider !== "openai") {
|
|
61
|
+
prompt = Prompt.setSystem(prompt, system);
|
|
62
|
+
}
|
|
63
|
+
let currentScript = "";
|
|
64
|
+
yield* Effect.gen(function* () {
|
|
65
|
+
while (true) {
|
|
66
|
+
if (currentScript.length > 0) {
|
|
67
|
+
Queue.offerUnsafe(output, new ScriptStart({ script: currentScript }));
|
|
68
|
+
const result = yield* pipe(executor.execute({
|
|
69
|
+
tools,
|
|
70
|
+
script: currentScript,
|
|
71
|
+
}), Stream.mkString);
|
|
72
|
+
Queue.offerUnsafe(output, new ScriptEnd({ output: result }));
|
|
73
|
+
prompt = Prompt.concat(prompt, `Javascript output:\n\n${result}`);
|
|
74
|
+
currentScript = "";
|
|
75
|
+
}
|
|
76
|
+
if (Deferred.isDoneUnsafe(deferred)) {
|
|
77
|
+
yield* Queue.fail(output, new AgentFinished({ summary: yield* Deferred.await(deferred) }));
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
let response = Array.empty();
|
|
81
|
+
yield* pipe(ai.streamText({ prompt }), Stream.takeUntil((part) => part.type === "text-end"), Stream.runForEachArray((parts) => {
|
|
82
|
+
response.push(...parts);
|
|
83
|
+
for (const part of parts) {
|
|
84
|
+
switch (part.type) {
|
|
85
|
+
case "text-start":
|
|
86
|
+
currentScript = "";
|
|
87
|
+
break;
|
|
88
|
+
case "text-delta":
|
|
89
|
+
currentScript += part.delta;
|
|
90
|
+
break;
|
|
91
|
+
case "reasoning-start":
|
|
92
|
+
break;
|
|
93
|
+
case "reasoning-delta":
|
|
94
|
+
// process.stdout.write(part.delta)
|
|
95
|
+
break;
|
|
96
|
+
case "reasoning-end":
|
|
97
|
+
// console.log("\n")
|
|
98
|
+
break;
|
|
99
|
+
case "finish":
|
|
100
|
+
// console.log("Tokens used:", part.usage, "\n")
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return Effect.void;
|
|
105
|
+
}), Effect.retry({
|
|
106
|
+
while: (err) => {
|
|
107
|
+
response = [];
|
|
108
|
+
return err.isRetryable;
|
|
109
|
+
},
|
|
110
|
+
}), provider === "openai" ? withSystemPrompt : identity);
|
|
111
|
+
prompt = Prompt.concat(prompt, Prompt.fromResponseParts(response));
|
|
112
|
+
currentScript = currentScript.trim();
|
|
113
|
+
}
|
|
114
|
+
}).pipe(Effect.provideServices(taskServices), Effect.provideServices(services), Effect.forkScoped);
|
|
115
|
+
return Stream.fromQueue(output);
|
|
116
|
+
}, Stream.unwrap);
|
|
117
|
+
const output = yield* spawn(Prompt.make(options.prompt)).pipe(Stream.broadcast({
|
|
118
|
+
capacity: "unbounded",
|
|
119
|
+
}));
|
|
120
|
+
return identity({
|
|
121
|
+
output,
|
|
122
|
+
});
|
|
123
|
+
// oxlint-disable-next-line typescript/no-explicit-any
|
|
124
|
+
});
|
|
125
|
+
// oxlint-disable-next-line typescript/no-explicit-any
|
|
126
|
+
const generateSystem = Effect.fn(function* (tools) {
|
|
127
|
+
const renderer = yield* ToolkitRenderer;
|
|
128
|
+
return `# Who you are
|
|
129
|
+
|
|
130
|
+
You are a professional software engineer. You are precise, thoughtful and concise. You make changes with care and always do the due diligence to ensure the best possible outcome. You make no mistakes.
|
|
131
|
+
|
|
132
|
+
# Completing the task
|
|
133
|
+
|
|
134
|
+
To complete the task respond with javascript code that will be executed for you.
|
|
135
|
+
|
|
136
|
+
- Do not add any markdown formatting, just code.
|
|
137
|
+
- Use \`console.log\` to print any output you need.
|
|
138
|
+
- Top level await is supported.
|
|
139
|
+
- **Prefer using the functions provided** over the bash tool
|
|
140
|
+
|
|
141
|
+
You have the following functions available to you:
|
|
142
|
+
|
|
143
|
+
\`\`\`ts
|
|
144
|
+
${renderer.render(tools)}
|
|
145
|
+
|
|
146
|
+
declare const fetch: typeof globalThis.fetch
|
|
147
|
+
\`\`\`
|
|
148
|
+
|
|
149
|
+
Here is how you would read a file:
|
|
150
|
+
|
|
151
|
+
\`\`\`
|
|
152
|
+
const content = await readFile({
|
|
153
|
+
path: "package.json",
|
|
154
|
+
startLine: 1,
|
|
155
|
+
endLine: 10,
|
|
156
|
+
})
|
|
157
|
+
console.log(JSON.parse(content))
|
|
158
|
+
\`\`\`
|
|
159
|
+
|
|
160
|
+
And the output would look like this:
|
|
161
|
+
|
|
162
|
+
\`\`\`
|
|
163
|
+
Javascript output:
|
|
164
|
+
|
|
165
|
+
[22:44:53.054] INFO (#47): Calling "readFile" { path: 'package.json' }
|
|
166
|
+
{
|
|
167
|
+
"name": "my-project",
|
|
168
|
+
"version": "1.0.0"
|
|
169
|
+
}
|
|
170
|
+
\`\`\`
|
|
171
|
+
|
|
172
|
+
# Guidelines
|
|
173
|
+
|
|
174
|
+
- Use the current state of the codebase to inform your decisions. Don't look at git history unless explicity asked to.
|
|
175
|
+
- Only add comments when necessary.
|
|
176
|
+
- Repect the users AGENTS.md file and ALWAYS follow the instructions in it.
|
|
177
|
+
`;
|
|
178
|
+
});
|
|
179
|
+
/**
|
|
180
|
+
* @since 1.0.0
|
|
181
|
+
* @category Output
|
|
182
|
+
*/
|
|
183
|
+
export class ReasoningStart extends Schema.TaggedClass()("ReasoningStart", {}) {
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* @since 1.0.0
|
|
187
|
+
* @category Output
|
|
188
|
+
*/
|
|
189
|
+
export class ReasoningDelta extends Schema.TaggedClass()("ReasoningDelta", {
|
|
190
|
+
delta: Schema.String,
|
|
191
|
+
}) {
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* @since 1.0.0
|
|
195
|
+
* @category Output
|
|
196
|
+
*/
|
|
197
|
+
export class ReasoningEnd extends Schema.TaggedClass()("ReasoningEnd", {}) {
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* @since 1.0.0
|
|
201
|
+
* @category Output
|
|
202
|
+
*/
|
|
203
|
+
export class ScriptStart extends Schema.TaggedClass()("ScriptStart", {
|
|
204
|
+
script: Schema.String,
|
|
205
|
+
}) {
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* @since 1.0.0
|
|
209
|
+
* @category Output
|
|
210
|
+
*/
|
|
211
|
+
export class ScriptEnd extends Schema.TaggedClass()("ScriptEnd", {
|
|
212
|
+
output: Schema.String,
|
|
213
|
+
}) {
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* @since 1.0.0
|
|
217
|
+
* @category Output
|
|
218
|
+
*/
|
|
219
|
+
export class AgentFinished extends Schema.TaggedErrorClass()("AgentFinished", {
|
|
220
|
+
summary: Schema.String,
|
|
221
|
+
}) {
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* @since 1.0.0
|
|
225
|
+
* @category Output
|
|
226
|
+
*/
|
|
227
|
+
export const OutputPart = Schema.Union([
|
|
228
|
+
ReasoningStart,
|
|
229
|
+
ReasoningDelta,
|
|
230
|
+
ReasoningEnd,
|
|
231
|
+
ScriptStart,
|
|
232
|
+
ScriptEnd,
|
|
233
|
+
]);
|
|
234
|
+
/**
|
|
235
|
+
* @since 1.0.0
|
|
236
|
+
* @category Output
|
|
237
|
+
*/
|
|
238
|
+
export class SubagentPart extends Data.TaggedError("SubagentPart") {
|
|
239
|
+
}
|
|
240
|
+
//# sourceMappingURL=Agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Agent.js","sourceRoot":"","sources":["../src/Agent.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EACL,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,UAAU,EACV,QAAQ,EACR,KAAK,EACL,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,MAAM,EACN,KAAK,EACL,UAAU,EACV,MAAM,GACP,MAAM,QAAQ,CAAA;AACf,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AACzE,OAAO,EACL,iBAAiB,EACjB,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,oBAAoB,GACrB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,EAAmB,MAAM,6BAA6B,CAAA;AAW7D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAItB,KAAK,CAAC,QAAQ,CAAC,iBAAiB,EAAE,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC,KAAK,CAAC,CAAA;AAE5E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,IAAI,GAsBb,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,OAShC;IACC,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,aAAa,CAAC,aAAa,CAAA;IAC7C,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,YAAY,CAAA;IACpC,MAAM,EAAE,GAA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OAAO,aAAc,SAAQ,MAAM,CAAC,gBAAgB,EAAiB,CACzE,eAAe,EACf;IACE,OAAO,EAAE,MAAM,CAAC,MAAM;CACvB,CACF;CAAG;AAEJ;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC;IACrC,cAAc;IACd,cAAc;IACd,YAAY;IACZ,WAAW;IACX,SAAS;CACV,CAAC,CAAA;AAQF;;;GAGG;AACH,MAAM,OAAO,YAAa,SAAQ,IAAI,CAAC,WAAW,CAAC,cAAc,CAG/D;CAAG"}
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @since 1.0.0
|
|
3
|
+
*/
|
|
4
|
+
import { Deferred, Effect, FileSystem, Path, Schema, ServiceMap } from "effect";
|
|
5
|
+
import { Tool, Toolkit } from "effect/unstable/ai";
|
|
6
|
+
import { ChildProcessSpawner } from "effect/unstable/process";
|
|
7
|
+
declare const CurrentDirectory_base: ServiceMap.ServiceClass<CurrentDirectory, "clanka/AgentTools/CurrentDirectory", string>;
|
|
8
|
+
/**
|
|
9
|
+
* @since 1.0.0
|
|
10
|
+
* @category Context
|
|
11
|
+
*/
|
|
12
|
+
export declare class CurrentDirectory extends CurrentDirectory_base {
|
|
13
|
+
}
|
|
14
|
+
declare const TaskCompleteDeferred_base: ServiceMap.ServiceClass<TaskCompleteDeferred, "clanka/AgentTools/TaskCompleteDeferred", Deferred.Deferred<string, never>>;
|
|
15
|
+
/**
|
|
16
|
+
* @since 1.0.0
|
|
17
|
+
* @category Context
|
|
18
|
+
*/
|
|
19
|
+
export declare class TaskCompleteDeferred extends TaskCompleteDeferred_base {
|
|
20
|
+
}
|
|
21
|
+
declare const SubagentContext_base: ServiceMap.ServiceClass<SubagentContext, "clanka/AgentTools/SubagentContext", {
|
|
22
|
+
spawn(options: {
|
|
23
|
+
readonly prompt: string;
|
|
24
|
+
}): Effect.Effect<string>;
|
|
25
|
+
}>;
|
|
26
|
+
/**
|
|
27
|
+
* @since 1.0.0
|
|
28
|
+
* @category Context
|
|
29
|
+
*/
|
|
30
|
+
export declare class SubagentContext extends SubagentContext_base {
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* @since 1.0.0
|
|
34
|
+
* @category Context
|
|
35
|
+
*/
|
|
36
|
+
export declare const makeContextNoop: (cwd?: string) => ServiceMap.ServiceMap<CurrentDirectory | TaskCompleteDeferred | SubagentContext>;
|
|
37
|
+
/**
|
|
38
|
+
* @since 1.0.0
|
|
39
|
+
* @category Toolkit
|
|
40
|
+
*/
|
|
41
|
+
export declare const AgentTools: Toolkit.Toolkit<{
|
|
42
|
+
readonly readFile: Tool.Tool<"readFile", {
|
|
43
|
+
readonly parameters: Schema.Struct<{
|
|
44
|
+
readonly path: Schema.String;
|
|
45
|
+
readonly startLine: Schema.optional<Schema.Number>;
|
|
46
|
+
readonly endLine: Schema.optional<Schema.Number>;
|
|
47
|
+
}>;
|
|
48
|
+
readonly success: Schema.NullOr<Schema.String>;
|
|
49
|
+
readonly failure: Schema.Never;
|
|
50
|
+
readonly failureMode: "error";
|
|
51
|
+
}, CurrentDirectory>;
|
|
52
|
+
readonly createFile: Tool.Tool<"createFile", {
|
|
53
|
+
readonly parameters: Schema.Struct<{
|
|
54
|
+
readonly path: Schema.String;
|
|
55
|
+
readonly content: Schema.String;
|
|
56
|
+
}>;
|
|
57
|
+
readonly success: Schema.Void;
|
|
58
|
+
readonly failure: Schema.Never;
|
|
59
|
+
readonly failureMode: "error";
|
|
60
|
+
}, CurrentDirectory>;
|
|
61
|
+
readonly applyPatch: Tool.Tool<"applyPatch", {
|
|
62
|
+
readonly parameters: Schema.String;
|
|
63
|
+
readonly success: Schema.String;
|
|
64
|
+
readonly failure: Schema.Never;
|
|
65
|
+
readonly failureMode: "error";
|
|
66
|
+
}, CurrentDirectory>;
|
|
67
|
+
readonly removeFile: Tool.Tool<"removeFile", {
|
|
68
|
+
readonly parameters: Schema.String;
|
|
69
|
+
readonly success: Schema.Void;
|
|
70
|
+
readonly failure: Schema.Never;
|
|
71
|
+
readonly failureMode: "error";
|
|
72
|
+
}, CurrentDirectory>;
|
|
73
|
+
readonly renameFile: Tool.Tool<"renameFile", {
|
|
74
|
+
readonly parameters: Schema.Struct<{
|
|
75
|
+
readonly from: Schema.String;
|
|
76
|
+
readonly to: Schema.String;
|
|
77
|
+
}>;
|
|
78
|
+
readonly success: Schema.Void;
|
|
79
|
+
readonly failure: Schema.Never;
|
|
80
|
+
readonly failureMode: "error";
|
|
81
|
+
}, CurrentDirectory>;
|
|
82
|
+
readonly mkdir: Tool.Tool<"mkdir", {
|
|
83
|
+
readonly parameters: Schema.String;
|
|
84
|
+
readonly success: Schema.Void;
|
|
85
|
+
readonly failure: Schema.Never;
|
|
86
|
+
readonly failureMode: "error";
|
|
87
|
+
}, CurrentDirectory>;
|
|
88
|
+
readonly ls: Tool.Tool<"ls", {
|
|
89
|
+
readonly parameters: Schema.String;
|
|
90
|
+
readonly success: Schema.$Array<Schema.String>;
|
|
91
|
+
readonly failure: Schema.Never;
|
|
92
|
+
readonly failureMode: "error";
|
|
93
|
+
}, CurrentDirectory>;
|
|
94
|
+
readonly rg: Tool.Tool<"rg", {
|
|
95
|
+
readonly parameters: Schema.Struct<{
|
|
96
|
+
readonly pattern: Schema.String;
|
|
97
|
+
readonly glob: Schema.optional<Schema.String>;
|
|
98
|
+
readonly maxLines: Schema.optional<Schema.Finite>;
|
|
99
|
+
}>;
|
|
100
|
+
readonly success: Schema.String;
|
|
101
|
+
readonly failure: Schema.Never;
|
|
102
|
+
readonly failureMode: "error";
|
|
103
|
+
}, CurrentDirectory>;
|
|
104
|
+
readonly glob: Tool.Tool<"glob", {
|
|
105
|
+
readonly parameters: Schema.String;
|
|
106
|
+
readonly success: Schema.$Array<Schema.String>;
|
|
107
|
+
readonly failure: Schema.Never;
|
|
108
|
+
readonly failureMode: "error";
|
|
109
|
+
}, CurrentDirectory>;
|
|
110
|
+
readonly bash: Tool.Tool<"bash", {
|
|
111
|
+
readonly parameters: Schema.String;
|
|
112
|
+
readonly success: Schema.String;
|
|
113
|
+
readonly failure: Schema.Never;
|
|
114
|
+
readonly failureMode: "error";
|
|
115
|
+
}, CurrentDirectory>;
|
|
116
|
+
readonly gh: Tool.Tool<"gh", {
|
|
117
|
+
readonly parameters: Schema.$Array<Schema.String>;
|
|
118
|
+
readonly success: Schema.String;
|
|
119
|
+
readonly failure: Schema.Never;
|
|
120
|
+
readonly failureMode: "error";
|
|
121
|
+
}, CurrentDirectory>;
|
|
122
|
+
readonly subagent: Tool.Tool<"subagent", {
|
|
123
|
+
readonly parameters: Schema.String;
|
|
124
|
+
readonly success: Schema.String;
|
|
125
|
+
readonly failure: Schema.Never;
|
|
126
|
+
readonly failureMode: "error";
|
|
127
|
+
}, SubagentContext>;
|
|
128
|
+
readonly sleep: Tool.Tool<"sleep", {
|
|
129
|
+
readonly parameters: Schema.Finite;
|
|
130
|
+
readonly success: Schema.Void;
|
|
131
|
+
readonly failure: Schema.Never;
|
|
132
|
+
readonly failureMode: "error";
|
|
133
|
+
}, never>;
|
|
134
|
+
readonly taskComplete: Tool.Tool<"taskComplete", {
|
|
135
|
+
readonly parameters: Schema.String;
|
|
136
|
+
readonly success: Schema.Void;
|
|
137
|
+
readonly failure: Schema.Never;
|
|
138
|
+
readonly failureMode: "error";
|
|
139
|
+
}, TaskCompleteDeferred>;
|
|
140
|
+
}>;
|
|
141
|
+
/**
|
|
142
|
+
* @since 1.0.0
|
|
143
|
+
* @category Toolkit
|
|
144
|
+
*/
|
|
145
|
+
export declare const AgentToolHandlers: import("effect/Layer").Layer<Tool.HandlersFor<{
|
|
146
|
+
readonly readFile: Tool.Tool<"readFile", {
|
|
147
|
+
readonly parameters: Schema.Struct<{
|
|
148
|
+
readonly path: Schema.String;
|
|
149
|
+
readonly startLine: Schema.optional<Schema.Number>;
|
|
150
|
+
readonly endLine: Schema.optional<Schema.Number>;
|
|
151
|
+
}>;
|
|
152
|
+
readonly success: Schema.NullOr<Schema.String>;
|
|
153
|
+
readonly failure: Schema.Never;
|
|
154
|
+
readonly failureMode: "error";
|
|
155
|
+
}, CurrentDirectory>;
|
|
156
|
+
readonly createFile: Tool.Tool<"createFile", {
|
|
157
|
+
readonly parameters: Schema.Struct<{
|
|
158
|
+
readonly path: Schema.String;
|
|
159
|
+
readonly content: Schema.String;
|
|
160
|
+
}>;
|
|
161
|
+
readonly success: Schema.Void;
|
|
162
|
+
readonly failure: Schema.Never;
|
|
163
|
+
readonly failureMode: "error";
|
|
164
|
+
}, CurrentDirectory>;
|
|
165
|
+
readonly applyPatch: Tool.Tool<"applyPatch", {
|
|
166
|
+
readonly parameters: Schema.String;
|
|
167
|
+
readonly success: Schema.String;
|
|
168
|
+
readonly failure: Schema.Never;
|
|
169
|
+
readonly failureMode: "error";
|
|
170
|
+
}, CurrentDirectory>;
|
|
171
|
+
readonly removeFile: Tool.Tool<"removeFile", {
|
|
172
|
+
readonly parameters: Schema.String;
|
|
173
|
+
readonly success: Schema.Void;
|
|
174
|
+
readonly failure: Schema.Never;
|
|
175
|
+
readonly failureMode: "error";
|
|
176
|
+
}, CurrentDirectory>;
|
|
177
|
+
readonly renameFile: Tool.Tool<"renameFile", {
|
|
178
|
+
readonly parameters: Schema.Struct<{
|
|
179
|
+
readonly from: Schema.String;
|
|
180
|
+
readonly to: Schema.String;
|
|
181
|
+
}>;
|
|
182
|
+
readonly success: Schema.Void;
|
|
183
|
+
readonly failure: Schema.Never;
|
|
184
|
+
readonly failureMode: "error";
|
|
185
|
+
}, CurrentDirectory>;
|
|
186
|
+
readonly mkdir: Tool.Tool<"mkdir", {
|
|
187
|
+
readonly parameters: Schema.String;
|
|
188
|
+
readonly success: Schema.Void;
|
|
189
|
+
readonly failure: Schema.Never;
|
|
190
|
+
readonly failureMode: "error";
|
|
191
|
+
}, CurrentDirectory>;
|
|
192
|
+
readonly ls: Tool.Tool<"ls", {
|
|
193
|
+
readonly parameters: Schema.String;
|
|
194
|
+
readonly success: Schema.$Array<Schema.String>;
|
|
195
|
+
readonly failure: Schema.Never;
|
|
196
|
+
readonly failureMode: "error";
|
|
197
|
+
}, CurrentDirectory>;
|
|
198
|
+
readonly rg: Tool.Tool<"rg", {
|
|
199
|
+
readonly parameters: Schema.Struct<{
|
|
200
|
+
readonly pattern: Schema.String;
|
|
201
|
+
readonly glob: Schema.optional<Schema.String>;
|
|
202
|
+
readonly maxLines: Schema.optional<Schema.Finite>;
|
|
203
|
+
}>;
|
|
204
|
+
readonly success: Schema.String;
|
|
205
|
+
readonly failure: Schema.Never;
|
|
206
|
+
readonly failureMode: "error";
|
|
207
|
+
}, CurrentDirectory>;
|
|
208
|
+
readonly glob: Tool.Tool<"glob", {
|
|
209
|
+
readonly parameters: Schema.String;
|
|
210
|
+
readonly success: Schema.$Array<Schema.String>;
|
|
211
|
+
readonly failure: Schema.Never;
|
|
212
|
+
readonly failureMode: "error";
|
|
213
|
+
}, CurrentDirectory>;
|
|
214
|
+
readonly bash: Tool.Tool<"bash", {
|
|
215
|
+
readonly parameters: Schema.String;
|
|
216
|
+
readonly success: Schema.String;
|
|
217
|
+
readonly failure: Schema.Never;
|
|
218
|
+
readonly failureMode: "error";
|
|
219
|
+
}, CurrentDirectory>;
|
|
220
|
+
readonly gh: Tool.Tool<"gh", {
|
|
221
|
+
readonly parameters: Schema.$Array<Schema.String>;
|
|
222
|
+
readonly success: Schema.String;
|
|
223
|
+
readonly failure: Schema.Never;
|
|
224
|
+
readonly failureMode: "error";
|
|
225
|
+
}, CurrentDirectory>;
|
|
226
|
+
readonly subagent: Tool.Tool<"subagent", {
|
|
227
|
+
readonly parameters: Schema.String;
|
|
228
|
+
readonly success: Schema.String;
|
|
229
|
+
readonly failure: Schema.Never;
|
|
230
|
+
readonly failureMode: "error";
|
|
231
|
+
}, SubagentContext>;
|
|
232
|
+
readonly sleep: Tool.Tool<"sleep", {
|
|
233
|
+
readonly parameters: Schema.Finite;
|
|
234
|
+
readonly success: Schema.Void;
|
|
235
|
+
readonly failure: Schema.Never;
|
|
236
|
+
readonly failureMode: "error";
|
|
237
|
+
}, never>;
|
|
238
|
+
readonly taskComplete: Tool.Tool<"taskComplete", {
|
|
239
|
+
readonly parameters: Schema.String;
|
|
240
|
+
readonly success: Schema.Void;
|
|
241
|
+
readonly failure: Schema.Never;
|
|
242
|
+
readonly failureMode: "error";
|
|
243
|
+
}, TaskCompleteDeferred>;
|
|
244
|
+
}>, never, FileSystem.FileSystem | Path.Path | ChildProcessSpawner.ChildProcessSpawner>;
|
|
245
|
+
export {};
|
|
246
|
+
//# sourceMappingURL=AgentTools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentTools.d.ts","sourceRoot":"","sources":["../src/AgentTools.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAGL,QAAQ,EACR,MAAM,EACN,UAAU,EACV,IAAI,EAEJ,MAAM,EACN,UAAU,EAEX,MAAM,QAAQ,CAAA;AACf,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAgB,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;;AAK3E;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,qBAGG;CAAG;;AAE5C;;;GAGG;AACH,qBAAa,oBAAqB,SAAQ,yBAGG;CAAG;;mBAS7B;QAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;;AAPtE;;;GAGG;AACH,qBAAa,eAAgB,SAAQ,oBAKG;CAAG;AAE3C;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,MAAM,MAAM,qFAMzC,CAAA;AAEH;;;GAGG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0HtB,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uFAoT7B,CAAA"}
|