@lucascouts/claude-agent-acp-plus 0.1.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/LICENSE +191 -0
- package/README.md +27 -0
- package/dist/acp-agent.d.ts +564 -0
- package/dist/acp-agent.d.ts.map +1 -0
- package/dist/acp-agent.js +4332 -0
- package/dist/agent-name.d.ts +3 -0
- package/dist/agent-name.d.ts.map +1 -0
- package/dist/agent-name.js +15 -0
- package/dist/ask-user-question-fallback.d.ts +78 -0
- package/dist/ask-user-question-fallback.d.ts.map +1 -0
- package/dist/ask-user-question-fallback.js +104 -0
- package/dist/elicitation.d.ts +129 -0
- package/dist/elicitation.d.ts.map +1 -0
- package/dist/elicitation.js +312 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +75 -0
- package/dist/lib.d.ts +6 -0
- package/dist/lib.d.ts.map +1 -0
- package/dist/lib.js +5 -0
- package/dist/settings.d.ts +68 -0
- package/dist/settings.d.ts.map +1 -0
- package/dist/settings.js +185 -0
- package/dist/tools.d.ts +103 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +757 -0
- package/dist/utils.d.ts +16 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +81 -0
- package/package.json +86 -0
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Readable, Writable } from "node:stream";
|
|
2
|
+
import { WritableStream, ReadableStream } from "node:stream/web";
|
|
3
|
+
import { Logger } from "./acp-agent.js";
|
|
4
|
+
export declare class Pushable<T> implements AsyncIterable<T> {
|
|
5
|
+
private queue;
|
|
6
|
+
private resolvers;
|
|
7
|
+
private done;
|
|
8
|
+
push(item: T): void;
|
|
9
|
+
end(): void;
|
|
10
|
+
[Symbol.asyncIterator](): AsyncIterator<T>;
|
|
11
|
+
}
|
|
12
|
+
export declare function nodeToWebWritable(nodeStream: Writable): WritableStream<Uint8Array>;
|
|
13
|
+
export declare function nodeToWebReadable(nodeStream: Readable): ReadableStream<Uint8Array>;
|
|
14
|
+
export declare function unreachable(value: never, logger?: Logger): void;
|
|
15
|
+
export declare function sleep(time: number): Promise<void>;
|
|
16
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAGxC,qBAAa,QAAQ,CAAC,CAAC,CAAE,YAAW,aAAa,CAAC,CAAC,CAAC;IAClD,OAAO,CAAC,KAAK,CAAW;IACxB,OAAO,CAAC,SAAS,CAA8C;IAC/D,OAAO,CAAC,IAAI,CAAS;IAErB,IAAI,CAAC,IAAI,EAAE,CAAC;IASZ,GAAG;IAQH,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC;CAgB3C;AAGD,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,QAAQ,GAAG,cAAc,CAAC,UAAU,CAAC,CAclF;AAED,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,QAAQ,GAAG,cAAc,CAAC,UAAU,CAAC,CAUlF;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,GAAE,MAAgB,QAQjE;AAED,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEjD"}
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// A pushable async iterable: allows you to push items and consume them with for-await.
|
|
2
|
+
import { WritableStream, ReadableStream } from "node:stream/web";
|
|
3
|
+
// Useful for bridging push-based and async-iterator-based code.
|
|
4
|
+
export class Pushable {
|
|
5
|
+
queue = [];
|
|
6
|
+
resolvers = [];
|
|
7
|
+
done = false;
|
|
8
|
+
push(item) {
|
|
9
|
+
if (this.resolvers.length > 0) {
|
|
10
|
+
const resolve = this.resolvers.shift();
|
|
11
|
+
resolve({ value: item, done: false });
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
this.queue.push(item);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
end() {
|
|
18
|
+
this.done = true;
|
|
19
|
+
while (this.resolvers.length > 0) {
|
|
20
|
+
const resolve = this.resolvers.shift();
|
|
21
|
+
resolve({ value: undefined, done: true });
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
[Symbol.asyncIterator]() {
|
|
25
|
+
return {
|
|
26
|
+
next: () => {
|
|
27
|
+
if (this.queue.length > 0) {
|
|
28
|
+
const value = this.queue.shift();
|
|
29
|
+
return Promise.resolve({ value, done: false });
|
|
30
|
+
}
|
|
31
|
+
if (this.done) {
|
|
32
|
+
return Promise.resolve({ value: undefined, done: true });
|
|
33
|
+
}
|
|
34
|
+
return new Promise((resolve) => {
|
|
35
|
+
this.resolvers.push(resolve);
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
// Helper to convert Node.js streams to Web Streams
|
|
42
|
+
export function nodeToWebWritable(nodeStream) {
|
|
43
|
+
return new WritableStream({
|
|
44
|
+
write(chunk) {
|
|
45
|
+
return new Promise((resolve, reject) => {
|
|
46
|
+
nodeStream.write(Buffer.from(chunk), (err) => {
|
|
47
|
+
if (err) {
|
|
48
|
+
reject(err);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
resolve();
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
export function nodeToWebReadable(nodeStream) {
|
|
59
|
+
return new ReadableStream({
|
|
60
|
+
start(controller) {
|
|
61
|
+
nodeStream.on("data", (chunk) => {
|
|
62
|
+
controller.enqueue(new Uint8Array(chunk));
|
|
63
|
+
});
|
|
64
|
+
nodeStream.on("end", () => controller.close());
|
|
65
|
+
nodeStream.on("error", (err) => controller.error(err));
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
export function unreachable(value, logger = console) {
|
|
70
|
+
let valueAsString;
|
|
71
|
+
try {
|
|
72
|
+
valueAsString = JSON.stringify(value);
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
valueAsString = value;
|
|
76
|
+
}
|
|
77
|
+
logger.error(`Unexpected case: ${valueAsString}`);
|
|
78
|
+
}
|
|
79
|
+
export function sleep(time) {
|
|
80
|
+
return new Promise((resolve) => setTimeout(resolve, time));
|
|
81
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lucascouts/claude-agent-acp-plus",
|
|
3
|
+
"publishConfig": {
|
|
4
|
+
"access": "public"
|
|
5
|
+
},
|
|
6
|
+
"version": "0.1.0",
|
|
7
|
+
"description": "An ACP-compatible coding agent powered by the Claude Agent SDK (TypeScript)",
|
|
8
|
+
"main": "dist/lib.js",
|
|
9
|
+
"types": "dist/lib.d.ts",
|
|
10
|
+
"bin": {
|
|
11
|
+
"claude-agent-acp-plus": "dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"type": "module",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/lib.d.ts",
|
|
17
|
+
"import": "./dist/lib.js"
|
|
18
|
+
},
|
|
19
|
+
"./*": "./*"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist/",
|
|
23
|
+
"!dist/tests/",
|
|
24
|
+
"README.md",
|
|
25
|
+
"LICENSE",
|
|
26
|
+
"package.json"
|
|
27
|
+
],
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "tsc",
|
|
30
|
+
"start": "node dist/index.js",
|
|
31
|
+
"dev": "npm run build && npm run start",
|
|
32
|
+
"lint": "eslint src --ext .ts",
|
|
33
|
+
"lint:fix": "eslint src --ext .ts --fix",
|
|
34
|
+
"format": "prettier --write .",
|
|
35
|
+
"format:check": "prettier --check .",
|
|
36
|
+
"check": "npm run lint && npm run format:check",
|
|
37
|
+
"ci:local": "npm run format:check && npm run lint && npm run build && npm run test:run",
|
|
38
|
+
"test": "vitest",
|
|
39
|
+
"test:integration": "RUN_INTEGRATION_TESTS=true vitest run",
|
|
40
|
+
"test:run": "vitest run",
|
|
41
|
+
"test:coverage": "vitest run --coverage",
|
|
42
|
+
"prepublishOnly": "npm run build"
|
|
43
|
+
},
|
|
44
|
+
"keywords": [
|
|
45
|
+
"claude",
|
|
46
|
+
"acp",
|
|
47
|
+
"agent",
|
|
48
|
+
"anthropic",
|
|
49
|
+
"typescript",
|
|
50
|
+
"sdk",
|
|
51
|
+
"code"
|
|
52
|
+
],
|
|
53
|
+
"homepage": "https://github.com/lucascouts/claude-agent-acp-plus#readme",
|
|
54
|
+
"bugs": {
|
|
55
|
+
"url": "https://github.com/lucascouts/claude-agent-acp-plus/issues"
|
|
56
|
+
},
|
|
57
|
+
"repository": {
|
|
58
|
+
"type": "git",
|
|
59
|
+
"url": "git+https://github.com/lucascouts/claude-agent-acp-plus.git"
|
|
60
|
+
},
|
|
61
|
+
"author": "Zed Industries",
|
|
62
|
+
"license": "Apache-2.0",
|
|
63
|
+
"engines": {
|
|
64
|
+
"node": ">=22"
|
|
65
|
+
},
|
|
66
|
+
"dependencies": {
|
|
67
|
+
"@agentclientprotocol/sdk": "1.2.1",
|
|
68
|
+
"@anthropic-ai/claude-agent-sdk": "0.3.204",
|
|
69
|
+
"zod": "^3.25.0 || ^4.0.0"
|
|
70
|
+
},
|
|
71
|
+
"devDependencies": {
|
|
72
|
+
"@anthropic-ai/sdk": "0.110.0",
|
|
73
|
+
"@eslint/js": "10.0.1",
|
|
74
|
+
"@tsconfig/node22": "22.0.5",
|
|
75
|
+
"@types/node": "26.1.1",
|
|
76
|
+
"@typescript-eslint/eslint-plugin": "8.63.0",
|
|
77
|
+
"@typescript-eslint/parser": "8.63.0",
|
|
78
|
+
"eslint": "10.6.0",
|
|
79
|
+
"eslint-config-prettier": "10.1.8",
|
|
80
|
+
"globals": "17.7.0",
|
|
81
|
+
"prettier": "3.9.4",
|
|
82
|
+
"ts-node": "10.9.2",
|
|
83
|
+
"typescript": "6.0.3",
|
|
84
|
+
"vitest": "4.1.10"
|
|
85
|
+
}
|
|
86
|
+
}
|