macro-agent 0.0.14 → 0.0.15

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.
Files changed (134) hide show
  1. package/.claude/settings.local.json +59 -0
  2. package/dist/agent/agent-manager.d.ts.map +1 -1
  3. package/dist/agent/agent-manager.js +10 -4
  4. package/dist/agent/agent-manager.js.map +1 -1
  5. package/dist/cli/acp.d.ts +6 -0
  6. package/dist/cli/acp.d.ts.map +1 -1
  7. package/dist/cli/acp.js +16 -2
  8. package/dist/cli/acp.js.map +1 -1
  9. package/dist/map/utils/address-translation.d.ts +99 -0
  10. package/dist/map/utils/address-translation.d.ts.map +1 -0
  11. package/dist/map/utils/address-translation.js +285 -0
  12. package/dist/map/utils/address-translation.js.map +1 -0
  13. package/dist/map/utils/index.d.ts +7 -0
  14. package/dist/map/utils/index.d.ts.map +1 -0
  15. package/dist/map/utils/index.js +7 -0
  16. package/dist/map/utils/index.js.map +1 -0
  17. package/dist/store/event-store.js +9 -2
  18. package/dist/store/event-store.js.map +1 -1
  19. package/dist/store/types/agents.d.ts +2 -0
  20. package/dist/store/types/agents.d.ts.map +1 -1
  21. package/package.json +4 -4
  22. package/references/acp-factory-ref/CHANGELOG.md +33 -0
  23. package/references/acp-factory-ref/LICENSE +21 -0
  24. package/references/acp-factory-ref/README.md +341 -0
  25. package/references/acp-factory-ref/package-lock.json +3102 -0
  26. package/references/acp-factory-ref/package.json +96 -0
  27. package/references/acp-factory-ref/python/CHANGELOG.md +33 -0
  28. package/references/acp-factory-ref/python/LICENSE +21 -0
  29. package/references/acp-factory-ref/python/Makefile +57 -0
  30. package/references/acp-factory-ref/python/README.md +253 -0
  31. package/references/acp-factory-ref/python/pyproject.toml +73 -0
  32. package/references/acp-factory-ref/python/tests/__init__.py +0 -0
  33. package/references/acp-factory-ref/python/tests/e2e/__init__.py +1 -0
  34. package/references/acp-factory-ref/python/tests/e2e/test_codex_e2e.py +349 -0
  35. package/references/acp-factory-ref/python/tests/e2e/test_gemini_e2e.py +165 -0
  36. package/references/acp-factory-ref/python/tests/e2e/test_opencode_e2e.py +296 -0
  37. package/references/acp-factory-ref/python/tests/test_client_handler.py +543 -0
  38. package/references/acp-factory-ref/python/tests/test_pushable.py +199 -0
  39. package/references/claude-code-acp/.github/workflows/ci.yml +45 -0
  40. package/references/claude-code-acp/.github/workflows/publish.yml +34 -0
  41. package/references/claude-code-acp/.prettierrc.json +4 -0
  42. package/references/claude-code-acp/CHANGELOG.md +249 -0
  43. package/references/claude-code-acp/LICENSE +222 -0
  44. package/references/claude-code-acp/README.md +53 -0
  45. package/references/claude-code-acp/docs/RELEASES.md +24 -0
  46. package/references/claude-code-acp/eslint.config.js +48 -0
  47. package/references/claude-code-acp/package-lock.json +4570 -0
  48. package/references/claude-code-acp/package.json +88 -0
  49. package/references/claude-code-acp/scripts/release.sh +119 -0
  50. package/references/claude-code-acp/src/acp-agent.ts +2079 -0
  51. package/references/claude-code-acp/src/index.ts +26 -0
  52. package/references/claude-code-acp/src/lib.ts +38 -0
  53. package/references/claude-code-acp/src/mcp-server.ts +911 -0
  54. package/references/claude-code-acp/src/settings.ts +522 -0
  55. package/references/claude-code-acp/src/tests/.claude/commands/quick-math.md +5 -0
  56. package/references/claude-code-acp/src/tests/.claude/commands/say-hello.md +6 -0
  57. package/references/claude-code-acp/src/tests/acp-agent-fork.test.ts +479 -0
  58. package/references/claude-code-acp/src/tests/acp-agent.test.ts +1502 -0
  59. package/references/claude-code-acp/src/tests/extract-lines.test.ts +103 -0
  60. package/references/claude-code-acp/src/tests/fork-session.test.ts +335 -0
  61. package/references/claude-code-acp/src/tests/replace-and-calculate-location.test.ts +334 -0
  62. package/references/claude-code-acp/src/tests/settings.test.ts +617 -0
  63. package/references/claude-code-acp/src/tests/skills-options.test.ts +187 -0
  64. package/references/claude-code-acp/src/tests/tools.test.ts +318 -0
  65. package/references/claude-code-acp/src/tests/typescript-declarations.test.ts +558 -0
  66. package/references/claude-code-acp/src/tools.ts +819 -0
  67. package/references/claude-code-acp/src/utils.ts +171 -0
  68. package/references/claude-code-acp/tsconfig.json +18 -0
  69. package/references/claude-code-acp/vitest.config.ts +19 -0
  70. package/references/multi-agent-protocol/.sudocode/issues.jsonl +111 -0
  71. package/references/multi-agent-protocol/.sudocode/specs.jsonl +13 -0
  72. package/references/multi-agent-protocol/LICENSE +21 -0
  73. package/references/multi-agent-protocol/README.md +113 -0
  74. package/references/multi-agent-protocol/docs/00-design-specification.md +496 -0
  75. package/references/multi-agent-protocol/docs/01-open-questions.md +1050 -0
  76. package/references/multi-agent-protocol/docs/02-wire-protocol.md +296 -0
  77. package/references/multi-agent-protocol/docs/03-streaming-semantics.md +252 -0
  78. package/references/multi-agent-protocol/docs/04-error-handling.md +231 -0
  79. package/references/multi-agent-protocol/docs/05-connection-model.md +244 -0
  80. package/references/multi-agent-protocol/docs/06-visibility-permissions.md +243 -0
  81. package/references/multi-agent-protocol/docs/07-federation.md +259 -0
  82. package/references/multi-agent-protocol/docs/08-macro-agent-migration.md +253 -0
  83. package/references/multi-agent-protocol/docs/09-authentication.md +680 -0
  84. package/references/multi-agent-protocol/docs/10-mail-protocol.md +553 -0
  85. package/references/multi-agent-protocol/docs/agent-iam-integration.md +877 -0
  86. package/references/multi-agent-protocol/docs/agentic-mesh-integration-draft.md +459 -0
  87. package/references/multi-agent-protocol/docs/git-transport-draft.md +251 -0
  88. package/references/multi-agent-protocol/docs-site/Gemfile +22 -0
  89. package/references/multi-agent-protocol/docs-site/README.md +82 -0
  90. package/references/multi-agent-protocol/docs-site/_config.yml +91 -0
  91. package/references/multi-agent-protocol/docs-site/_includes/head_custom.html +20 -0
  92. package/references/multi-agent-protocol/docs-site/_sass/color_schemes/map.scss +42 -0
  93. package/references/multi-agent-protocol/docs-site/_sass/custom/custom.scss +34 -0
  94. package/references/multi-agent-protocol/docs-site/examples/full-integration.md +510 -0
  95. package/references/multi-agent-protocol/docs-site/examples/index.md +138 -0
  96. package/references/multi-agent-protocol/docs-site/examples/simple-chat.md +282 -0
  97. package/references/multi-agent-protocol/docs-site/examples/task-queue.md +399 -0
  98. package/references/multi-agent-protocol/docs-site/getting-started/index.md +98 -0
  99. package/references/multi-agent-protocol/docs-site/getting-started/installation.md +219 -0
  100. package/references/multi-agent-protocol/docs-site/getting-started/overview.md +172 -0
  101. package/references/multi-agent-protocol/docs-site/getting-started/quickstart.md +237 -0
  102. package/references/multi-agent-protocol/docs-site/index.md +136 -0
  103. package/references/multi-agent-protocol/docs-site/protocol/authentication.md +391 -0
  104. package/references/multi-agent-protocol/docs-site/protocol/connection-model.md +376 -0
  105. package/references/multi-agent-protocol/docs-site/protocol/design.md +284 -0
  106. package/references/multi-agent-protocol/docs-site/protocol/error-handling.md +312 -0
  107. package/references/multi-agent-protocol/docs-site/protocol/federation.md +449 -0
  108. package/references/multi-agent-protocol/docs-site/protocol/index.md +129 -0
  109. package/references/multi-agent-protocol/docs-site/protocol/permissions.md +398 -0
  110. package/references/multi-agent-protocol/docs-site/protocol/streaming.md +353 -0
  111. package/references/multi-agent-protocol/docs-site/protocol/wire-protocol.md +369 -0
  112. package/references/multi-agent-protocol/docs-site/sdk/api/agent.md +357 -0
  113. package/references/multi-agent-protocol/docs-site/sdk/api/client.md +380 -0
  114. package/references/multi-agent-protocol/docs-site/sdk/api/index.md +62 -0
  115. package/references/multi-agent-protocol/docs-site/sdk/api/server.md +453 -0
  116. package/references/multi-agent-protocol/docs-site/sdk/api/types.md +468 -0
  117. package/references/multi-agent-protocol/docs-site/sdk/guides/agent.md +375 -0
  118. package/references/multi-agent-protocol/docs-site/sdk/guides/authentication.md +405 -0
  119. package/references/multi-agent-protocol/docs-site/sdk/guides/client.md +352 -0
  120. package/references/multi-agent-protocol/docs-site/sdk/guides/index.md +89 -0
  121. package/references/multi-agent-protocol/docs-site/sdk/guides/server.md +360 -0
  122. package/references/multi-agent-protocol/docs-site/sdk/guides/testing.md +446 -0
  123. package/references/multi-agent-protocol/docs-site/sdk/guides/transports.md +363 -0
  124. package/references/multi-agent-protocol/docs-site/sdk/index.md +206 -0
  125. package/references/multi-agent-protocol/package-lock.json +3886 -0
  126. package/references/multi-agent-protocol/package.json +56 -0
  127. package/references/multi-agent-protocol/schema/meta.json +467 -0
  128. package/references/multi-agent-protocol/schema/schema.json +2558 -0
  129. package/src/agent/__tests__/agent-manager.test.ts +67 -1
  130. package/src/agent/agent-manager.ts +10 -4
  131. package/src/cli/__tests__/stable-instance-id.test.ts +57 -0
  132. package/src/cli/acp.ts +17 -2
  133. package/src/store/event-store.ts +10 -3
  134. 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
+ });