macro-agent 0.0.14 → 0.0.16
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/.claude/settings.local.json +59 -0
- package/dist/acp/index.d.ts +1 -1
- package/dist/acp/index.d.ts.map +1 -1
- package/dist/acp/index.js.map +1 -1
- package/dist/acp/macro-agent.d.ts +21 -0
- package/dist/acp/macro-agent.d.ts.map +1 -1
- package/dist/acp/macro-agent.js +182 -0
- package/dist/acp/macro-agent.js.map +1 -1
- package/dist/acp/types.d.ts +31 -2
- package/dist/acp/types.d.ts.map +1 -1
- package/dist/acp/types.js.map +1 -1
- package/dist/agent/agent-manager.d.ts.map +1 -1
- package/dist/agent/agent-manager.js +10 -4
- package/dist/agent/agent-manager.js.map +1 -1
- package/dist/cli/acp.d.ts +6 -0
- package/dist/cli/acp.d.ts.map +1 -1
- package/dist/cli/acp.js +16 -2
- package/dist/cli/acp.js.map +1 -1
- package/dist/map/adapter/acp-over-map.d.ts +5 -0
- package/dist/map/adapter/acp-over-map.d.ts.map +1 -1
- package/dist/map/adapter/acp-over-map.js +47 -4
- package/dist/map/adapter/acp-over-map.js.map +1 -1
- package/dist/map/utils/address-translation.d.ts +99 -0
- package/dist/map/utils/address-translation.d.ts.map +1 -0
- package/dist/map/utils/address-translation.js +285 -0
- package/dist/map/utils/address-translation.js.map +1 -0
- package/dist/map/utils/index.d.ts +7 -0
- package/dist/map/utils/index.d.ts.map +1 -0
- package/dist/map/utils/index.js +7 -0
- package/dist/map/utils/index.js.map +1 -0
- package/dist/store/event-store.js +9 -2
- package/dist/store/event-store.js.map +1 -1
- package/dist/store/types/agents.d.ts +2 -0
- package/dist/store/types/agents.d.ts.map +1 -1
- package/package.json +4 -4
- package/references/acp-factory-ref/CHANGELOG.md +33 -0
- package/references/acp-factory-ref/LICENSE +21 -0
- package/references/acp-factory-ref/README.md +341 -0
- package/references/acp-factory-ref/package-lock.json +3102 -0
- package/references/acp-factory-ref/package.json +96 -0
- package/references/acp-factory-ref/python/CHANGELOG.md +33 -0
- package/references/acp-factory-ref/python/LICENSE +21 -0
- package/references/acp-factory-ref/python/Makefile +57 -0
- package/references/acp-factory-ref/python/README.md +253 -0
- package/references/acp-factory-ref/python/pyproject.toml +73 -0
- package/references/acp-factory-ref/python/tests/__init__.py +0 -0
- package/references/acp-factory-ref/python/tests/e2e/__init__.py +1 -0
- package/references/acp-factory-ref/python/tests/e2e/test_codex_e2e.py +349 -0
- package/references/acp-factory-ref/python/tests/e2e/test_gemini_e2e.py +165 -0
- package/references/acp-factory-ref/python/tests/e2e/test_opencode_e2e.py +296 -0
- package/references/acp-factory-ref/python/tests/test_client_handler.py +543 -0
- package/references/acp-factory-ref/python/tests/test_pushable.py +199 -0
- package/references/claude-code-acp/.github/workflows/ci.yml +45 -0
- package/references/claude-code-acp/.github/workflows/publish.yml +34 -0
- package/references/claude-code-acp/.prettierrc.json +4 -0
- package/references/claude-code-acp/CHANGELOG.md +249 -0
- package/references/claude-code-acp/LICENSE +222 -0
- package/references/claude-code-acp/README.md +53 -0
- package/references/claude-code-acp/docs/RELEASES.md +24 -0
- package/references/claude-code-acp/eslint.config.js +48 -0
- package/references/claude-code-acp/package-lock.json +4570 -0
- package/references/claude-code-acp/package.json +88 -0
- package/references/claude-code-acp/scripts/release.sh +119 -0
- package/references/claude-code-acp/src/acp-agent.ts +2079 -0
- package/references/claude-code-acp/src/index.ts +26 -0
- package/references/claude-code-acp/src/lib.ts +38 -0
- package/references/claude-code-acp/src/mcp-server.ts +911 -0
- package/references/claude-code-acp/src/settings.ts +522 -0
- package/references/claude-code-acp/src/tests/.claude/commands/quick-math.md +5 -0
- package/references/claude-code-acp/src/tests/.claude/commands/say-hello.md +6 -0
- package/references/claude-code-acp/src/tests/acp-agent-fork.test.ts +479 -0
- package/references/claude-code-acp/src/tests/acp-agent.test.ts +1502 -0
- package/references/claude-code-acp/src/tests/extract-lines.test.ts +103 -0
- package/references/claude-code-acp/src/tests/fork-session.test.ts +335 -0
- package/references/claude-code-acp/src/tests/replace-and-calculate-location.test.ts +334 -0
- package/references/claude-code-acp/src/tests/settings.test.ts +617 -0
- package/references/claude-code-acp/src/tests/skills-options.test.ts +187 -0
- package/references/claude-code-acp/src/tests/tools.test.ts +318 -0
- package/references/claude-code-acp/src/tests/typescript-declarations.test.ts +558 -0
- package/references/claude-code-acp/src/tools.ts +819 -0
- package/references/claude-code-acp/src/utils.ts +171 -0
- package/references/claude-code-acp/tsconfig.json +18 -0
- package/references/claude-code-acp/vitest.config.ts +19 -0
- package/references/multi-agent-protocol/.sudocode/issues.jsonl +111 -0
- package/references/multi-agent-protocol/.sudocode/specs.jsonl +13 -0
- package/references/multi-agent-protocol/LICENSE +21 -0
- package/references/multi-agent-protocol/README.md +113 -0
- package/references/multi-agent-protocol/docs/00-design-specification.md +496 -0
- package/references/multi-agent-protocol/docs/01-open-questions.md +1050 -0
- package/references/multi-agent-protocol/docs/02-wire-protocol.md +296 -0
- package/references/multi-agent-protocol/docs/03-streaming-semantics.md +252 -0
- package/references/multi-agent-protocol/docs/04-error-handling.md +231 -0
- package/references/multi-agent-protocol/docs/05-connection-model.md +244 -0
- package/references/multi-agent-protocol/docs/06-visibility-permissions.md +243 -0
- package/references/multi-agent-protocol/docs/07-federation.md +259 -0
- package/references/multi-agent-protocol/docs/08-macro-agent-migration.md +253 -0
- package/references/multi-agent-protocol/docs/09-authentication.md +680 -0
- package/references/multi-agent-protocol/docs/10-mail-protocol.md +553 -0
- package/references/multi-agent-protocol/docs/agent-iam-integration.md +877 -0
- package/references/multi-agent-protocol/docs/agentic-mesh-integration-draft.md +459 -0
- package/references/multi-agent-protocol/docs/git-transport-draft.md +251 -0
- package/references/multi-agent-protocol/docs-site/Gemfile +22 -0
- package/references/multi-agent-protocol/docs-site/README.md +82 -0
- package/references/multi-agent-protocol/docs-site/_config.yml +91 -0
- package/references/multi-agent-protocol/docs-site/_includes/head_custom.html +20 -0
- package/references/multi-agent-protocol/docs-site/_sass/color_schemes/map.scss +42 -0
- package/references/multi-agent-protocol/docs-site/_sass/custom/custom.scss +34 -0
- package/references/multi-agent-protocol/docs-site/examples/full-integration.md +510 -0
- package/references/multi-agent-protocol/docs-site/examples/index.md +138 -0
- package/references/multi-agent-protocol/docs-site/examples/simple-chat.md +282 -0
- package/references/multi-agent-protocol/docs-site/examples/task-queue.md +399 -0
- package/references/multi-agent-protocol/docs-site/getting-started/index.md +98 -0
- package/references/multi-agent-protocol/docs-site/getting-started/installation.md +219 -0
- package/references/multi-agent-protocol/docs-site/getting-started/overview.md +172 -0
- package/references/multi-agent-protocol/docs-site/getting-started/quickstart.md +237 -0
- package/references/multi-agent-protocol/docs-site/index.md +136 -0
- package/references/multi-agent-protocol/docs-site/protocol/authentication.md +391 -0
- package/references/multi-agent-protocol/docs-site/protocol/connection-model.md +376 -0
- package/references/multi-agent-protocol/docs-site/protocol/design.md +284 -0
- package/references/multi-agent-protocol/docs-site/protocol/error-handling.md +312 -0
- package/references/multi-agent-protocol/docs-site/protocol/federation.md +449 -0
- package/references/multi-agent-protocol/docs-site/protocol/index.md +129 -0
- package/references/multi-agent-protocol/docs-site/protocol/permissions.md +398 -0
- package/references/multi-agent-protocol/docs-site/protocol/streaming.md +353 -0
- package/references/multi-agent-protocol/docs-site/protocol/wire-protocol.md +369 -0
- package/references/multi-agent-protocol/docs-site/sdk/api/agent.md +357 -0
- package/references/multi-agent-protocol/docs-site/sdk/api/client.md +380 -0
- package/references/multi-agent-protocol/docs-site/sdk/api/index.md +62 -0
- package/references/multi-agent-protocol/docs-site/sdk/api/server.md +453 -0
- package/references/multi-agent-protocol/docs-site/sdk/api/types.md +468 -0
- package/references/multi-agent-protocol/docs-site/sdk/guides/agent.md +375 -0
- package/references/multi-agent-protocol/docs-site/sdk/guides/authentication.md +405 -0
- package/references/multi-agent-protocol/docs-site/sdk/guides/client.md +352 -0
- package/references/multi-agent-protocol/docs-site/sdk/guides/index.md +89 -0
- package/references/multi-agent-protocol/docs-site/sdk/guides/server.md +360 -0
- package/references/multi-agent-protocol/docs-site/sdk/guides/testing.md +446 -0
- package/references/multi-agent-protocol/docs-site/sdk/guides/transports.md +363 -0
- package/references/multi-agent-protocol/docs-site/sdk/index.md +206 -0
- package/references/multi-agent-protocol/package-lock.json +3886 -0
- package/references/multi-agent-protocol/package.json +56 -0
- package/references/multi-agent-protocol/schema/meta.json +467 -0
- package/references/multi-agent-protocol/schema/schema.json +2558 -0
- package/src/acp/__tests__/history.test.ts +526 -0
- package/src/acp/__tests__/integration.test.ts +2 -1
- package/src/acp/index.ts +4 -0
- package/src/acp/macro-agent.ts +329 -85
- package/src/acp/types.ts +39 -2
- package/src/agent/__tests__/agent-manager.test.ts +67 -1
- package/src/agent/agent-manager.ts +10 -4
- package/src/cli/__tests__/stable-instance-id.test.ts +57 -0
- package/src/cli/acp.ts +17 -2
- package/src/map/adapter/acp-over-map.ts +57 -2
- package/src/store/event-store.ts +10 -3
- package/src/store/types/agents.ts +2 -0
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
// A pushable async iterable: allows you to push items and consume them with for-await.
|
|
2
|
+
|
|
3
|
+
import { Readable, Writable } from "node:stream";
|
|
4
|
+
import { WritableStream, ReadableStream } from "node:stream/web";
|
|
5
|
+
import { readFileSync } from "node:fs";
|
|
6
|
+
import { Logger } from "./acp-agent.js";
|
|
7
|
+
import { ClaudeCodeSettings, getManagedSettingsPath } from "./settings.js";
|
|
8
|
+
|
|
9
|
+
// Useful for bridging push-based and async-iterator-based code.
|
|
10
|
+
export class Pushable<T> implements AsyncIterable<T> {
|
|
11
|
+
private queue: T[] = [];
|
|
12
|
+
private resolvers: ((value: IteratorResult<T>) => void)[] = [];
|
|
13
|
+
private done = false;
|
|
14
|
+
|
|
15
|
+
push(item: T) {
|
|
16
|
+
if (this.resolvers.length > 0) {
|
|
17
|
+
const resolve = this.resolvers.shift()!;
|
|
18
|
+
resolve({ value: item, done: false });
|
|
19
|
+
} else {
|
|
20
|
+
this.queue.push(item);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
end() {
|
|
25
|
+
this.done = true;
|
|
26
|
+
while (this.resolvers.length > 0) {
|
|
27
|
+
const resolve = this.resolvers.shift()!;
|
|
28
|
+
resolve({ value: undefined as any, done: true });
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
[Symbol.asyncIterator](): AsyncIterator<T> {
|
|
33
|
+
return {
|
|
34
|
+
next: (): Promise<IteratorResult<T>> => {
|
|
35
|
+
if (this.queue.length > 0) {
|
|
36
|
+
const value = this.queue.shift()!;
|
|
37
|
+
return Promise.resolve({ value, done: false });
|
|
38
|
+
}
|
|
39
|
+
if (this.done) {
|
|
40
|
+
return Promise.resolve({ value: undefined as any, done: true });
|
|
41
|
+
}
|
|
42
|
+
return new Promise<IteratorResult<T>>((resolve) => {
|
|
43
|
+
this.resolvers.push(resolve);
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Helper to convert Node.js streams to Web Streams
|
|
51
|
+
export function nodeToWebWritable(nodeStream: Writable): WritableStream<Uint8Array> {
|
|
52
|
+
return new WritableStream<Uint8Array>({
|
|
53
|
+
write(chunk) {
|
|
54
|
+
return new Promise<void>((resolve, reject) => {
|
|
55
|
+
nodeStream.write(Buffer.from(chunk), (err) => {
|
|
56
|
+
if (err) {
|
|
57
|
+
reject(err);
|
|
58
|
+
} else {
|
|
59
|
+
resolve();
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function nodeToWebReadable(nodeStream: Readable): ReadableStream<Uint8Array> {
|
|
68
|
+
return new ReadableStream<Uint8Array>({
|
|
69
|
+
start(controller) {
|
|
70
|
+
nodeStream.on("data", (chunk: Buffer) => {
|
|
71
|
+
controller.enqueue(new Uint8Array(chunk));
|
|
72
|
+
});
|
|
73
|
+
nodeStream.on("end", () => controller.close());
|
|
74
|
+
nodeStream.on("error", (err) => controller.error(err));
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function unreachable(value: never, logger: Logger = console) {
|
|
80
|
+
let valueAsString;
|
|
81
|
+
try {
|
|
82
|
+
valueAsString = JSON.stringify(value);
|
|
83
|
+
} catch {
|
|
84
|
+
valueAsString = value;
|
|
85
|
+
}
|
|
86
|
+
logger.error(`Unexpected case: ${valueAsString}`);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export function sleep(time: number): Promise<void> {
|
|
90
|
+
return new Promise((resolve) => setTimeout(resolve, time));
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export function loadManagedSettings(): ClaudeCodeSettings | null {
|
|
94
|
+
try {
|
|
95
|
+
return JSON.parse(readFileSync(getManagedSettingsPath(), "utf8")) as ClaudeCodeSettings;
|
|
96
|
+
} catch {
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export function applyEnvironmentSettings(settings: ClaudeCodeSettings): void {
|
|
102
|
+
if (settings.env) {
|
|
103
|
+
for (const [key, value] of Object.entries(settings.env)) {
|
|
104
|
+
process.env[key] = value;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export interface ExtractLinesResult {
|
|
110
|
+
content: string;
|
|
111
|
+
wasLimited: boolean;
|
|
112
|
+
linesRead: number;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Extracts lines from file content with byte limit enforcement.
|
|
117
|
+
*
|
|
118
|
+
* @param fullContent - The complete file content
|
|
119
|
+
* @param maxContentLength - Maximum number of UTF-16 Code Units to return
|
|
120
|
+
* @returns Object containing extracted content and metadata
|
|
121
|
+
*/
|
|
122
|
+
export function extractLinesWithByteLimit(
|
|
123
|
+
fullContent: string,
|
|
124
|
+
maxContentLength: number,
|
|
125
|
+
): ExtractLinesResult {
|
|
126
|
+
if (fullContent === "") {
|
|
127
|
+
return {
|
|
128
|
+
content: "",
|
|
129
|
+
wasLimited: false,
|
|
130
|
+
linesRead: 1,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
let linesSeen = 0;
|
|
135
|
+
let index = 0;
|
|
136
|
+
linesSeen = 0;
|
|
137
|
+
|
|
138
|
+
let contentLength = 0;
|
|
139
|
+
let wasLimited = false;
|
|
140
|
+
|
|
141
|
+
while (true) {
|
|
142
|
+
const nextIndex = fullContent.indexOf("\n", index);
|
|
143
|
+
|
|
144
|
+
if (nextIndex < 0) {
|
|
145
|
+
// Last line in file (no trailing newline)
|
|
146
|
+
if (linesSeen > 0 && fullContent.length > maxContentLength) {
|
|
147
|
+
wasLimited = true;
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
linesSeen += 1;
|
|
151
|
+
contentLength = fullContent.length;
|
|
152
|
+
break;
|
|
153
|
+
} else {
|
|
154
|
+
// Line with newline - include up to the newline
|
|
155
|
+
const newContentLength = nextIndex + 1;
|
|
156
|
+
if (linesSeen > 0 && newContentLength > maxContentLength) {
|
|
157
|
+
wasLimited = true;
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
linesSeen += 1;
|
|
161
|
+
contentLength = newContentLength;
|
|
162
|
+
index = newContentLength;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return {
|
|
167
|
+
content: fullContent.slice(0, contentLength),
|
|
168
|
+
wasLimited,
|
|
169
|
+
linesRead: linesSeen,
|
|
170
|
+
};
|
|
171
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"moduleResolution": "NodeNext",
|
|
6
|
+
"lib": ["ES2020"],
|
|
7
|
+
"strict": true,
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"forceConsistentCasingInFileNames": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"outDir": "dist",
|
|
12
|
+
"rootDir": "src",
|
|
13
|
+
"declaration": true,
|
|
14
|
+
"declarationMap": true
|
|
15
|
+
},
|
|
16
|
+
"include": ["src/**/*.ts"],
|
|
17
|
+
"exclude": ["node_modules", "dist"]
|
|
18
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { defineConfig } from "vitest/config";
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
test: {
|
|
5
|
+
watch: false,
|
|
6
|
+
globals: true,
|
|
7
|
+
environment: "node",
|
|
8
|
+
include: ["src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],
|
|
9
|
+
coverage: {
|
|
10
|
+
provider: "v8",
|
|
11
|
+
reporter: ["text", "json", "html"],
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
resolve: {
|
|
15
|
+
alias: {
|
|
16
|
+
"@": "/src",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
});
|