@germanescobar/anita 0.3.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 +353 -0
- package/dist/agent/agents.d.ts +16 -0
- package/dist/agent/agents.js +115 -0
- package/dist/agent/context-budget.d.ts +7 -0
- package/dist/agent/context-budget.js +17 -0
- package/dist/agent/context-builder.d.ts +34 -0
- package/dist/agent/context-builder.js +175 -0
- package/dist/agent/executor.d.ts +13 -0
- package/dist/agent/executor.js +65 -0
- package/dist/agent/loop.d.ts +54 -0
- package/dist/agent/loop.js +548 -0
- package/dist/agent/policies.d.ts +25 -0
- package/dist/agent/policies.js +177 -0
- package/dist/agent/session.d.ts +12 -0
- package/dist/agent/session.js +42 -0
- package/dist/attachments.d.ts +3 -0
- package/dist/attachments.js +73 -0
- package/dist/cli/index.d.ts +5 -0
- package/dist/cli/index.js +327 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -0
- package/dist/models/anthropic.d.ts +15 -0
- package/dist/models/anthropic.js +195 -0
- package/dist/models/openai-responses.d.ts +62 -0
- package/dist/models/openai-responses.js +377 -0
- package/dist/models/openai.d.ts +32 -0
- package/dist/models/openai.js +330 -0
- package/dist/models/provider.d.ts +33 -0
- package/dist/models/provider.js +1 -0
- package/dist/models/resolve.d.ts +48 -0
- package/dist/models/resolve.js +211 -0
- package/dist/security/sensitive-content.d.ts +6 -0
- package/dist/security/sensitive-content.js +59 -0
- package/dist/skills/skills.d.ts +62 -0
- package/dist/skills/skills.js +371 -0
- package/dist/storage/event-store.d.ts +7 -0
- package/dist/storage/event-store.js +36 -0
- package/dist/storage/session-store.d.ts +11 -0
- package/dist/storage/session-store.js +64 -0
- package/dist/tools/delete-file.d.ts +2 -0
- package/dist/tools/delete-file.js +25 -0
- package/dist/tools/edit-file.d.ts +2 -0
- package/dist/tools/edit-file.js +50 -0
- package/dist/tools/read-file.d.ts +2 -0
- package/dist/tools/read-file.js +122 -0
- package/dist/tools/registry.d.ts +9 -0
- package/dist/tools/registry.js +122 -0
- package/dist/tools/run-command.d.ts +2 -0
- package/dist/tools/run-command.js +103 -0
- package/dist/tools/write-file.d.ts +2 -0
- package/dist/tools/write-file.js +29 -0
- package/dist/types/agent.d.ts +44 -0
- package/dist/types/agent.js +1 -0
- package/dist/types/conversation.d.ts +43 -0
- package/dist/types/conversation.js +201 -0
- package/dist/types/events.d.ts +8 -0
- package/dist/types/events.js +1 -0
- package/dist/types/messages.d.ts +39 -0
- package/dist/types/messages.js +1 -0
- package/dist/types/output.d.ts +19 -0
- package/dist/types/output.js +1 -0
- package/dist/types/stream.d.ts +55 -0
- package/dist/types/stream.js +1 -0
- package/dist/types/tools.d.ts +28 -0
- package/dist/types/tools.js +1 -0
- package/package.json +45 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type EventType = "session_start" | "user_message" | "assistant_reasoning" | "assistant_response" | "conversation_compaction" | "tool_call" | "tool_result" | "policy_decision" | "error" | "run_cancelled" | "session_end" | "session_archived" | "skills_loaded";
|
|
2
|
+
export interface AgentEvent {
|
|
3
|
+
id: string;
|
|
4
|
+
sessionId: string;
|
|
5
|
+
timestamp: string;
|
|
6
|
+
type: EventType;
|
|
7
|
+
data: Record<string, unknown>;
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ToolResultMetadata } from "./tools.js";
|
|
2
|
+
export type MessageRole = "user" | "assistant";
|
|
3
|
+
export type AttachmentSource = {
|
|
4
|
+
type: "url";
|
|
5
|
+
url: string;
|
|
6
|
+
} | {
|
|
7
|
+
type: "data";
|
|
8
|
+
mediaType: string;
|
|
9
|
+
data: string;
|
|
10
|
+
};
|
|
11
|
+
export type AttachmentContentBlock = {
|
|
12
|
+
type: "image";
|
|
13
|
+
name?: string;
|
|
14
|
+
source: AttachmentSource;
|
|
15
|
+
} | {
|
|
16
|
+
type: "file";
|
|
17
|
+
name: string;
|
|
18
|
+
mediaType: string;
|
|
19
|
+
source: AttachmentSource;
|
|
20
|
+
};
|
|
21
|
+
export type ContentBlock = {
|
|
22
|
+
type: "text";
|
|
23
|
+
text: string;
|
|
24
|
+
} | AttachmentContentBlock | {
|
|
25
|
+
type: "tool_use";
|
|
26
|
+
id: string;
|
|
27
|
+
name: string;
|
|
28
|
+
input: Record<string, unknown>;
|
|
29
|
+
} | {
|
|
30
|
+
type: "tool_result";
|
|
31
|
+
toolUseId: string;
|
|
32
|
+
content: string;
|
|
33
|
+
isError?: boolean;
|
|
34
|
+
metadata?: Record<string, ToolResultMetadata>;
|
|
35
|
+
};
|
|
36
|
+
export interface Message {
|
|
37
|
+
role: MessageRole;
|
|
38
|
+
content: string | ContentBlock[];
|
|
39
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type OutputMode = "default" | "human" | "json";
|
|
2
|
+
export interface ToolCallResult {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
input: Record<string, unknown>;
|
|
6
|
+
content: string;
|
|
7
|
+
isError: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface AgentRunResult {
|
|
10
|
+
schemaVersion: "ada.v1";
|
|
11
|
+
sessionId: string;
|
|
12
|
+
model: string;
|
|
13
|
+
workingDirectory: string;
|
|
14
|
+
status: "completed" | "max_iterations";
|
|
15
|
+
stopReason: string;
|
|
16
|
+
finalText: string;
|
|
17
|
+
textBlocks: string[];
|
|
18
|
+
toolCalls: ToolCallResult[];
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { StopReason } from "./agent.js";
|
|
2
|
+
import type { ToolResultMetadata } from "./tools.js";
|
|
3
|
+
export type StreamEvent = {
|
|
4
|
+
type: "run.started";
|
|
5
|
+
sessionId: string;
|
|
6
|
+
model: string;
|
|
7
|
+
workingDirectory: string;
|
|
8
|
+
timestamp: string;
|
|
9
|
+
} | {
|
|
10
|
+
type: "assistant.reasoning";
|
|
11
|
+
text: string;
|
|
12
|
+
} | {
|
|
13
|
+
type: "assistant.reasoning.delta";
|
|
14
|
+
text: string;
|
|
15
|
+
} | {
|
|
16
|
+
type: "assistant.text";
|
|
17
|
+
text: string;
|
|
18
|
+
} | {
|
|
19
|
+
type: "assistant.text.delta";
|
|
20
|
+
text: string;
|
|
21
|
+
} | {
|
|
22
|
+
type: "tool.call.delta";
|
|
23
|
+
index: number;
|
|
24
|
+
id?: string;
|
|
25
|
+
name?: string;
|
|
26
|
+
inputDelta?: string;
|
|
27
|
+
} | {
|
|
28
|
+
type: "tool.call";
|
|
29
|
+
id: string;
|
|
30
|
+
name: string;
|
|
31
|
+
input: Record<string, unknown>;
|
|
32
|
+
} | {
|
|
33
|
+
type: "tool.result";
|
|
34
|
+
id: string;
|
|
35
|
+
name: string;
|
|
36
|
+
content: string;
|
|
37
|
+
isError: boolean;
|
|
38
|
+
metadata?: Record<string, ToolResultMetadata>;
|
|
39
|
+
} | {
|
|
40
|
+
type: "run.completed";
|
|
41
|
+
sessionId: string;
|
|
42
|
+
status: "completed" | "max_iterations";
|
|
43
|
+
stopReason: StopReason;
|
|
44
|
+
timestamp: string;
|
|
45
|
+
} | {
|
|
46
|
+
type: "run.failed";
|
|
47
|
+
sessionId: string;
|
|
48
|
+
error: string;
|
|
49
|
+
timestamp: string;
|
|
50
|
+
} | {
|
|
51
|
+
type: "run.cancelled";
|
|
52
|
+
sessionId: string;
|
|
53
|
+
reason: string;
|
|
54
|
+
timestamp: string;
|
|
55
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface ToolSchema {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
parameters: Record<string, unknown>;
|
|
5
|
+
}
|
|
6
|
+
export interface ToolExecuteOptions {
|
|
7
|
+
/** Aborted when the surrounding agent run is cancelled. */
|
|
8
|
+
signal?: AbortSignal;
|
|
9
|
+
}
|
|
10
|
+
export interface ToolDefinition {
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
inputSchema: Record<string, unknown>;
|
|
14
|
+
execute: (input: Record<string, unknown>, options?: ToolExecuteOptions) => Promise<ToolResult>;
|
|
15
|
+
}
|
|
16
|
+
export type ToolResultMetadata = string | number | boolean | null | ToolResultMetadata[] | {
|
|
17
|
+
[key: string]: ToolResultMetadata;
|
|
18
|
+
};
|
|
19
|
+
export interface ToolResult {
|
|
20
|
+
content: string;
|
|
21
|
+
isError?: boolean;
|
|
22
|
+
metadata?: Record<string, ToolResultMetadata>;
|
|
23
|
+
}
|
|
24
|
+
export interface ToolCall {
|
|
25
|
+
id: string;
|
|
26
|
+
name: string;
|
|
27
|
+
input: Record<string, unknown>;
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@germanescobar/anita",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "An intelligent AI-powered coding agent that helps you write, edit, and run code with conversational access to AI models and your file system.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist",
|
|
8
|
+
"README.md"
|
|
9
|
+
],
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/germanescobar/anita.git"
|
|
13
|
+
},
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/germanescobar/anita/issues"
|
|
16
|
+
},
|
|
17
|
+
"homepage": "https://github.com/germanescobar/anita#readme",
|
|
18
|
+
"bin": {
|
|
19
|
+
"anita": "dist/index.js"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"dev": "tsx src/index.ts",
|
|
23
|
+
"build": "tsc",
|
|
24
|
+
"test": "node --test --import tsx \"tests/**/*.test.ts\"",
|
|
25
|
+
"start": "node dist/index.js",
|
|
26
|
+
"eval": "tsx evals/run.ts",
|
|
27
|
+
"prepublishOnly": "npm run build"
|
|
28
|
+
},
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"access": "public"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@anthropic-ai/sdk": "^0.39.0",
|
|
34
|
+
"openai": "^4.77.0",
|
|
35
|
+
"commander": "^13.1.0",
|
|
36
|
+
"chalk": "^5.4.1",
|
|
37
|
+
"uuid": "^11.1.0"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"typescript": "^5.7.0",
|
|
41
|
+
"@types/node": "^22.10.0",
|
|
42
|
+
"@types/uuid": "^10.0.0",
|
|
43
|
+
"tsx": "^4.19.0"
|
|
44
|
+
}
|
|
45
|
+
}
|