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.
Files changed (154) hide show
  1. package/.claude/settings.local.json +59 -0
  2. package/dist/acp/index.d.ts +1 -1
  3. package/dist/acp/index.d.ts.map +1 -1
  4. package/dist/acp/index.js.map +1 -1
  5. package/dist/acp/macro-agent.d.ts +21 -0
  6. package/dist/acp/macro-agent.d.ts.map +1 -1
  7. package/dist/acp/macro-agent.js +182 -0
  8. package/dist/acp/macro-agent.js.map +1 -1
  9. package/dist/acp/types.d.ts +31 -2
  10. package/dist/acp/types.d.ts.map +1 -1
  11. package/dist/acp/types.js.map +1 -1
  12. package/dist/agent/agent-manager.d.ts.map +1 -1
  13. package/dist/agent/agent-manager.js +10 -4
  14. package/dist/agent/agent-manager.js.map +1 -1
  15. package/dist/cli/acp.d.ts +6 -0
  16. package/dist/cli/acp.d.ts.map +1 -1
  17. package/dist/cli/acp.js +16 -2
  18. package/dist/cli/acp.js.map +1 -1
  19. package/dist/map/adapter/acp-over-map.d.ts +5 -0
  20. package/dist/map/adapter/acp-over-map.d.ts.map +1 -1
  21. package/dist/map/adapter/acp-over-map.js +47 -4
  22. package/dist/map/adapter/acp-over-map.js.map +1 -1
  23. package/dist/map/utils/address-translation.d.ts +99 -0
  24. package/dist/map/utils/address-translation.d.ts.map +1 -0
  25. package/dist/map/utils/address-translation.js +285 -0
  26. package/dist/map/utils/address-translation.js.map +1 -0
  27. package/dist/map/utils/index.d.ts +7 -0
  28. package/dist/map/utils/index.d.ts.map +1 -0
  29. package/dist/map/utils/index.js +7 -0
  30. package/dist/map/utils/index.js.map +1 -0
  31. package/dist/store/event-store.js +9 -2
  32. package/dist/store/event-store.js.map +1 -1
  33. package/dist/store/types/agents.d.ts +2 -0
  34. package/dist/store/types/agents.d.ts.map +1 -1
  35. package/package.json +4 -4
  36. package/references/acp-factory-ref/CHANGELOG.md +33 -0
  37. package/references/acp-factory-ref/LICENSE +21 -0
  38. package/references/acp-factory-ref/README.md +341 -0
  39. package/references/acp-factory-ref/package-lock.json +3102 -0
  40. package/references/acp-factory-ref/package.json +96 -0
  41. package/references/acp-factory-ref/python/CHANGELOG.md +33 -0
  42. package/references/acp-factory-ref/python/LICENSE +21 -0
  43. package/references/acp-factory-ref/python/Makefile +57 -0
  44. package/references/acp-factory-ref/python/README.md +253 -0
  45. package/references/acp-factory-ref/python/pyproject.toml +73 -0
  46. package/references/acp-factory-ref/python/tests/__init__.py +0 -0
  47. package/references/acp-factory-ref/python/tests/e2e/__init__.py +1 -0
  48. package/references/acp-factory-ref/python/tests/e2e/test_codex_e2e.py +349 -0
  49. package/references/acp-factory-ref/python/tests/e2e/test_gemini_e2e.py +165 -0
  50. package/references/acp-factory-ref/python/tests/e2e/test_opencode_e2e.py +296 -0
  51. package/references/acp-factory-ref/python/tests/test_client_handler.py +543 -0
  52. package/references/acp-factory-ref/python/tests/test_pushable.py +199 -0
  53. package/references/claude-code-acp/.github/workflows/ci.yml +45 -0
  54. package/references/claude-code-acp/.github/workflows/publish.yml +34 -0
  55. package/references/claude-code-acp/.prettierrc.json +4 -0
  56. package/references/claude-code-acp/CHANGELOG.md +249 -0
  57. package/references/claude-code-acp/LICENSE +222 -0
  58. package/references/claude-code-acp/README.md +53 -0
  59. package/references/claude-code-acp/docs/RELEASES.md +24 -0
  60. package/references/claude-code-acp/eslint.config.js +48 -0
  61. package/references/claude-code-acp/package-lock.json +4570 -0
  62. package/references/claude-code-acp/package.json +88 -0
  63. package/references/claude-code-acp/scripts/release.sh +119 -0
  64. package/references/claude-code-acp/src/acp-agent.ts +2079 -0
  65. package/references/claude-code-acp/src/index.ts +26 -0
  66. package/references/claude-code-acp/src/lib.ts +38 -0
  67. package/references/claude-code-acp/src/mcp-server.ts +911 -0
  68. package/references/claude-code-acp/src/settings.ts +522 -0
  69. package/references/claude-code-acp/src/tests/.claude/commands/quick-math.md +5 -0
  70. package/references/claude-code-acp/src/tests/.claude/commands/say-hello.md +6 -0
  71. package/references/claude-code-acp/src/tests/acp-agent-fork.test.ts +479 -0
  72. package/references/claude-code-acp/src/tests/acp-agent.test.ts +1502 -0
  73. package/references/claude-code-acp/src/tests/extract-lines.test.ts +103 -0
  74. package/references/claude-code-acp/src/tests/fork-session.test.ts +335 -0
  75. package/references/claude-code-acp/src/tests/replace-and-calculate-location.test.ts +334 -0
  76. package/references/claude-code-acp/src/tests/settings.test.ts +617 -0
  77. package/references/claude-code-acp/src/tests/skills-options.test.ts +187 -0
  78. package/references/claude-code-acp/src/tests/tools.test.ts +318 -0
  79. package/references/claude-code-acp/src/tests/typescript-declarations.test.ts +558 -0
  80. package/references/claude-code-acp/src/tools.ts +819 -0
  81. package/references/claude-code-acp/src/utils.ts +171 -0
  82. package/references/claude-code-acp/tsconfig.json +18 -0
  83. package/references/claude-code-acp/vitest.config.ts +19 -0
  84. package/references/multi-agent-protocol/.sudocode/issues.jsonl +111 -0
  85. package/references/multi-agent-protocol/.sudocode/specs.jsonl +13 -0
  86. package/references/multi-agent-protocol/LICENSE +21 -0
  87. package/references/multi-agent-protocol/README.md +113 -0
  88. package/references/multi-agent-protocol/docs/00-design-specification.md +496 -0
  89. package/references/multi-agent-protocol/docs/01-open-questions.md +1050 -0
  90. package/references/multi-agent-protocol/docs/02-wire-protocol.md +296 -0
  91. package/references/multi-agent-protocol/docs/03-streaming-semantics.md +252 -0
  92. package/references/multi-agent-protocol/docs/04-error-handling.md +231 -0
  93. package/references/multi-agent-protocol/docs/05-connection-model.md +244 -0
  94. package/references/multi-agent-protocol/docs/06-visibility-permissions.md +243 -0
  95. package/references/multi-agent-protocol/docs/07-federation.md +259 -0
  96. package/references/multi-agent-protocol/docs/08-macro-agent-migration.md +253 -0
  97. package/references/multi-agent-protocol/docs/09-authentication.md +680 -0
  98. package/references/multi-agent-protocol/docs/10-mail-protocol.md +553 -0
  99. package/references/multi-agent-protocol/docs/agent-iam-integration.md +877 -0
  100. package/references/multi-agent-protocol/docs/agentic-mesh-integration-draft.md +459 -0
  101. package/references/multi-agent-protocol/docs/git-transport-draft.md +251 -0
  102. package/references/multi-agent-protocol/docs-site/Gemfile +22 -0
  103. package/references/multi-agent-protocol/docs-site/README.md +82 -0
  104. package/references/multi-agent-protocol/docs-site/_config.yml +91 -0
  105. package/references/multi-agent-protocol/docs-site/_includes/head_custom.html +20 -0
  106. package/references/multi-agent-protocol/docs-site/_sass/color_schemes/map.scss +42 -0
  107. package/references/multi-agent-protocol/docs-site/_sass/custom/custom.scss +34 -0
  108. package/references/multi-agent-protocol/docs-site/examples/full-integration.md +510 -0
  109. package/references/multi-agent-protocol/docs-site/examples/index.md +138 -0
  110. package/references/multi-agent-protocol/docs-site/examples/simple-chat.md +282 -0
  111. package/references/multi-agent-protocol/docs-site/examples/task-queue.md +399 -0
  112. package/references/multi-agent-protocol/docs-site/getting-started/index.md +98 -0
  113. package/references/multi-agent-protocol/docs-site/getting-started/installation.md +219 -0
  114. package/references/multi-agent-protocol/docs-site/getting-started/overview.md +172 -0
  115. package/references/multi-agent-protocol/docs-site/getting-started/quickstart.md +237 -0
  116. package/references/multi-agent-protocol/docs-site/index.md +136 -0
  117. package/references/multi-agent-protocol/docs-site/protocol/authentication.md +391 -0
  118. package/references/multi-agent-protocol/docs-site/protocol/connection-model.md +376 -0
  119. package/references/multi-agent-protocol/docs-site/protocol/design.md +284 -0
  120. package/references/multi-agent-protocol/docs-site/protocol/error-handling.md +312 -0
  121. package/references/multi-agent-protocol/docs-site/protocol/federation.md +449 -0
  122. package/references/multi-agent-protocol/docs-site/protocol/index.md +129 -0
  123. package/references/multi-agent-protocol/docs-site/protocol/permissions.md +398 -0
  124. package/references/multi-agent-protocol/docs-site/protocol/streaming.md +353 -0
  125. package/references/multi-agent-protocol/docs-site/protocol/wire-protocol.md +369 -0
  126. package/references/multi-agent-protocol/docs-site/sdk/api/agent.md +357 -0
  127. package/references/multi-agent-protocol/docs-site/sdk/api/client.md +380 -0
  128. package/references/multi-agent-protocol/docs-site/sdk/api/index.md +62 -0
  129. package/references/multi-agent-protocol/docs-site/sdk/api/server.md +453 -0
  130. package/references/multi-agent-protocol/docs-site/sdk/api/types.md +468 -0
  131. package/references/multi-agent-protocol/docs-site/sdk/guides/agent.md +375 -0
  132. package/references/multi-agent-protocol/docs-site/sdk/guides/authentication.md +405 -0
  133. package/references/multi-agent-protocol/docs-site/sdk/guides/client.md +352 -0
  134. package/references/multi-agent-protocol/docs-site/sdk/guides/index.md +89 -0
  135. package/references/multi-agent-protocol/docs-site/sdk/guides/server.md +360 -0
  136. package/references/multi-agent-protocol/docs-site/sdk/guides/testing.md +446 -0
  137. package/references/multi-agent-protocol/docs-site/sdk/guides/transports.md +363 -0
  138. package/references/multi-agent-protocol/docs-site/sdk/index.md +206 -0
  139. package/references/multi-agent-protocol/package-lock.json +3886 -0
  140. package/references/multi-agent-protocol/package.json +56 -0
  141. package/references/multi-agent-protocol/schema/meta.json +467 -0
  142. package/references/multi-agent-protocol/schema/schema.json +2558 -0
  143. package/src/acp/__tests__/history.test.ts +526 -0
  144. package/src/acp/__tests__/integration.test.ts +2 -1
  145. package/src/acp/index.ts +4 -0
  146. package/src/acp/macro-agent.ts +329 -85
  147. package/src/acp/types.ts +39 -2
  148. package/src/agent/__tests__/agent-manager.test.ts +67 -1
  149. package/src/agent/agent-manager.ts +10 -4
  150. package/src/cli/__tests__/stable-instance-id.test.ts +57 -0
  151. package/src/cli/acp.ts +17 -2
  152. package/src/map/adapter/acp-over-map.ts +57 -2
  153. package/src/store/event-store.ts +10 -3
  154. package/src/store/types/agents.ts +2 -0
@@ -0,0 +1,99 @@
1
+ /**
2
+ * Address Translation Utilities
3
+ *
4
+ * Provides bidirectional translation between MAP addresses and
5
+ * legacy MessageRouter channel format. Used during migration to
6
+ * support both addressing schemes.
7
+ *
8
+ * @see specs/s-5qir_map_integration_for_macro_agent.md
9
+ */
10
+ import type { Address } from "../types.js";
11
+ import type { ChannelType } from "../../router/types.js";
12
+ import type { AgentId } from "../../store/types/index.js";
13
+ /**
14
+ * Legacy channel format from MessageRouter.
15
+ * Used for translation during migration.
16
+ */
17
+ export interface LegacyChannel {
18
+ type: ChannelType;
19
+ /** Target ID (agent_id, task_id, or topic name) */
20
+ target: string;
21
+ /** Role name for role channels */
22
+ role?: string;
23
+ /** Coordinator ID for scoped role channels */
24
+ coordinatorId?: AgentId;
25
+ /** Broadcast scope */
26
+ scope?: string;
27
+ }
28
+ /**
29
+ * Translate a MAP Address to legacy MessageRouter channel format.
30
+ *
31
+ * Used during migration to route messages through the existing
32
+ * MessageRouter while accepting MAP-style addresses.
33
+ *
34
+ * @param address - MAP address to translate
35
+ * @returns Legacy channel format
36
+ * @throws Error if address type is not supported in legacy format
37
+ */
38
+ export declare function addressToChannel(address: Address): LegacyChannel;
39
+ /**
40
+ * Translate a legacy MessageRouter channel to MAP address format.
41
+ *
42
+ * Used to migrate existing code to the new addressing scheme.
43
+ *
44
+ * @param channel - Legacy channel to translate
45
+ * @returns MAP address
46
+ * @throws Error if channel type is unknown
47
+ */
48
+ export declare function channelToAddress(channel: LegacyChannel): Address;
49
+ /**
50
+ * Check if a MAP address can be translated to legacy channel format.
51
+ *
52
+ * Returns false for address types that were added in MAP and have
53
+ * no equivalent in the legacy MessageRouter.
54
+ *
55
+ * @param address - Address to check
56
+ * @returns true if address can be translated to legacy format
57
+ */
58
+ export declare function isLegacyCompatible(address: Address): boolean;
59
+ /**
60
+ * Get a list of address features that are not legacy compatible.
61
+ *
62
+ * @param address - Address to check
63
+ * @returns Array of incompatible feature names, empty if fully compatible
64
+ */
65
+ export declare function getLegacyIncompatibilities(address: Address): string[];
66
+ /**
67
+ * Error thrown when a MAP address cannot be translated to legacy format.
68
+ */
69
+ export declare class AddressTranslationError extends Error {
70
+ readonly address: Address;
71
+ constructor(message: string, address: Address);
72
+ }
73
+ /**
74
+ * Error thrown when a legacy channel cannot be translated to MAP format.
75
+ */
76
+ export declare class ChannelTranslationError extends Error {
77
+ readonly channel: LegacyChannel;
78
+ constructor(message: string, channel: LegacyChannel);
79
+ }
80
+ /**
81
+ * Attempt to translate an address, returning undefined if not compatible.
82
+ *
83
+ * @param address - Address to translate
84
+ * @returns Legacy channel or undefined if not compatible
85
+ */
86
+ export declare function tryAddressToChannel(address: Address): LegacyChannel | undefined;
87
+ /**
88
+ * Create a mapping table entry for documentation/debugging.
89
+ */
90
+ export interface AddressMapping {
91
+ mapAddress: string;
92
+ legacyChannel: string;
93
+ notes?: string;
94
+ }
95
+ /**
96
+ * Get the address mapping table for documentation.
97
+ */
98
+ export declare function getAddressMappingTable(): AddressMapping[];
99
+ //# sourceMappingURL=address-translation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"address-translation.d.ts","sourceRoot":"","sources":["../../../src/map/utils/address-translation.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,OAAO,EASR,MAAM,aAAa,CAAC;AAcrB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,OAAO,EAAU,MAAM,4BAA4B,CAAC;AAMlE;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,WAAW,CAAC;IAClB,mDAAmD;IACnD,MAAM,EAAE,MAAM,CAAC;IACf,kCAAkC;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8CAA8C;IAC9C,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,sBAAsB;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAMD;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,aAAa,CA0FhE;AAMD;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAsChE;AAMD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAW5D;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,EAAE,CAiBrE;AAMD;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,KAAK;IAChD,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;gBAEd,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO;CAK9C;AAED;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,KAAK;IAChD,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;gBAEpB,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa;CAKpD;AAMD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,OAAO,GACf,aAAa,GAAG,SAAS,CAU3B;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,cAAc,EAAE,CAuDzD"}
@@ -0,0 +1,285 @@
1
+ /**
2
+ * Address Translation Utilities
3
+ *
4
+ * Provides bidirectional translation between MAP addresses and
5
+ * legacy MessageRouter channel format. Used during migration to
6
+ * support both addressing schemes.
7
+ *
8
+ * @see specs/s-5qir_map_integration_for_macro_agent.md
9
+ */
10
+ import { isAgentAddress, isAgentsAddress, isScopeAddress, isRoleAddress, isBroadcastAddress, isTaskAddress, isAncestorsAddress, isDescendantsAddress, isParentAddress, isChildrenAddress, isSiblingsAddress, } from "../types.js";
11
+ // =============================================================================
12
+ // Address to Channel Translation
13
+ // =============================================================================
14
+ /**
15
+ * Translate a MAP Address to legacy MessageRouter channel format.
16
+ *
17
+ * Used during migration to route messages through the existing
18
+ * MessageRouter while accepting MAP-style addresses.
19
+ *
20
+ * @param address - MAP address to translate
21
+ * @returns Legacy channel format
22
+ * @throws Error if address type is not supported in legacy format
23
+ */
24
+ export function addressToChannel(address) {
25
+ // Direct agent addressing
26
+ if (isAgentAddress(address)) {
27
+ return {
28
+ type: "agent",
29
+ target: address.agent,
30
+ };
31
+ }
32
+ // Multi-agent addressing (not supported in legacy)
33
+ if (isAgentsAddress(address)) {
34
+ throw new AddressTranslationError("Multi-agent addressing not supported in legacy format", address);
35
+ }
36
+ // Scope addressing → topic channel
37
+ if (isScopeAddress(address)) {
38
+ return {
39
+ type: "topic",
40
+ target: address.scope,
41
+ };
42
+ }
43
+ // Role addressing
44
+ if (isRoleAddress(address)) {
45
+ return {
46
+ type: "role",
47
+ target: address.role,
48
+ role: address.role,
49
+ coordinatorId: address.within,
50
+ };
51
+ }
52
+ // Broadcast addressing
53
+ if (isBroadcastAddress(address)) {
54
+ return {
55
+ type: "broadcast",
56
+ target: "all",
57
+ };
58
+ }
59
+ // Task addressing (macro-agent extension)
60
+ if (isTaskAddress(address)) {
61
+ return {
62
+ type: "task",
63
+ target: address.task,
64
+ };
65
+ }
66
+ // Ancestors → lineage channel
67
+ if (isAncestorsAddress(address)) {
68
+ return {
69
+ type: "lineage",
70
+ target: "ancestors",
71
+ };
72
+ }
73
+ // Descendants → subtree channel
74
+ if (isDescendantsAddress(address)) {
75
+ return {
76
+ type: "subtree",
77
+ target: "descendants",
78
+ };
79
+ }
80
+ // New hierarchical types not supported in legacy
81
+ if (isParentAddress(address)) {
82
+ throw new AddressTranslationError("Parent addressing not supported in legacy format", address);
83
+ }
84
+ if (isChildrenAddress(address)) {
85
+ throw new AddressTranslationError("Children addressing not supported in legacy format", address);
86
+ }
87
+ if (isSiblingsAddress(address)) {
88
+ throw new AddressTranslationError("Siblings addressing not supported in legacy format", address);
89
+ }
90
+ throw new AddressTranslationError("Unknown address type", address);
91
+ }
92
+ // =============================================================================
93
+ // Channel to Address Translation
94
+ // =============================================================================
95
+ /**
96
+ * Translate a legacy MessageRouter channel to MAP address format.
97
+ *
98
+ * Used to migrate existing code to the new addressing scheme.
99
+ *
100
+ * @param channel - Legacy channel to translate
101
+ * @returns MAP address
102
+ * @throws Error if channel type is unknown
103
+ */
104
+ export function channelToAddress(channel) {
105
+ switch (channel.type) {
106
+ case "agent":
107
+ return { agent: channel.target };
108
+ case "task":
109
+ return { task: channel.target };
110
+ case "topic":
111
+ return { scope: channel.target };
112
+ case "role":
113
+ if (channel.coordinatorId) {
114
+ return { role: channel.role ?? channel.target, within: channel.coordinatorId };
115
+ }
116
+ return { role: channel.role ?? channel.target };
117
+ case "broadcast":
118
+ // Check for scoped broadcast (e.g., "workers" → role: "worker")
119
+ if (channel.scope && channel.scope !== "all") {
120
+ // Convert plural scope to singular role: "workers" → "worker"
121
+ const role = channel.scope.replace(/s$/, "");
122
+ return { role };
123
+ }
124
+ return { broadcast: true };
125
+ case "lineage":
126
+ return { ancestors: true };
127
+ case "subtree":
128
+ return { descendants: true };
129
+ default:
130
+ throw new ChannelTranslationError(`Unknown channel type: ${channel.type}`, channel);
131
+ }
132
+ }
133
+ // =============================================================================
134
+ // Legacy Compatibility Check
135
+ // =============================================================================
136
+ /**
137
+ * Check if a MAP address can be translated to legacy channel format.
138
+ *
139
+ * Returns false for address types that were added in MAP and have
140
+ * no equivalent in the legacy MessageRouter.
141
+ *
142
+ * @param address - Address to check
143
+ * @returns true if address can be translated to legacy format
144
+ */
145
+ export function isLegacyCompatible(address) {
146
+ // Multi-agent addressing is new
147
+ if (isAgentsAddress(address))
148
+ return false;
149
+ // These hierarchical types are new
150
+ if (isParentAddress(address))
151
+ return false;
152
+ if (isChildrenAddress(address))
153
+ return false;
154
+ if (isSiblingsAddress(address))
155
+ return false;
156
+ // All other types have legacy equivalents
157
+ return true;
158
+ }
159
+ /**
160
+ * Get a list of address features that are not legacy compatible.
161
+ *
162
+ * @param address - Address to check
163
+ * @returns Array of incompatible feature names, empty if fully compatible
164
+ */
165
+ export function getLegacyIncompatibilities(address) {
166
+ const incompatibilities = [];
167
+ if (isAgentsAddress(address)) {
168
+ incompatibilities.push("multi-agent addressing");
169
+ }
170
+ if (isParentAddress(address)) {
171
+ incompatibilities.push("parent addressing");
172
+ }
173
+ if (isChildrenAddress(address)) {
174
+ incompatibilities.push("children addressing");
175
+ }
176
+ if (isSiblingsAddress(address)) {
177
+ incompatibilities.push("siblings addressing");
178
+ }
179
+ return incompatibilities;
180
+ }
181
+ // =============================================================================
182
+ // Error Classes
183
+ // =============================================================================
184
+ /**
185
+ * Error thrown when a MAP address cannot be translated to legacy format.
186
+ */
187
+ export class AddressTranslationError extends Error {
188
+ address;
189
+ constructor(message, address) {
190
+ super(`${message}: ${JSON.stringify(address)}`);
191
+ this.name = "AddressTranslationError";
192
+ this.address = address;
193
+ }
194
+ }
195
+ /**
196
+ * Error thrown when a legacy channel cannot be translated to MAP format.
197
+ */
198
+ export class ChannelTranslationError extends Error {
199
+ channel;
200
+ constructor(message, channel) {
201
+ super(`${message}: ${JSON.stringify(channel)}`);
202
+ this.name = "ChannelTranslationError";
203
+ this.channel = channel;
204
+ }
205
+ }
206
+ // =============================================================================
207
+ // Utility Functions
208
+ // =============================================================================
209
+ /**
210
+ * Attempt to translate an address, returning undefined if not compatible.
211
+ *
212
+ * @param address - Address to translate
213
+ * @returns Legacy channel or undefined if not compatible
214
+ */
215
+ export function tryAddressToChannel(address) {
216
+ if (!isLegacyCompatible(address)) {
217
+ return undefined;
218
+ }
219
+ try {
220
+ return addressToChannel(address);
221
+ }
222
+ catch {
223
+ return undefined;
224
+ }
225
+ }
226
+ /**
227
+ * Get the address mapping table for documentation.
228
+ */
229
+ export function getAddressMappingTable() {
230
+ return [
231
+ {
232
+ mapAddress: '{ agent: "id" }',
233
+ legacyChannel: '{ type: "agent", target: "id" }',
234
+ },
235
+ {
236
+ mapAddress: '{ task: "id" }',
237
+ legacyChannel: '{ type: "task", target: "id" }',
238
+ },
239
+ {
240
+ mapAddress: '{ scope: "id" }',
241
+ legacyChannel: '{ type: "topic", target: "id" }',
242
+ },
243
+ {
244
+ mapAddress: '{ role: "worker" }',
245
+ legacyChannel: '{ type: "role", role: "worker" }',
246
+ },
247
+ {
248
+ mapAddress: '{ role: "worker", within: "scope" }',
249
+ legacyChannel: '{ type: "role", role: "worker", coordinatorId: "scope" }',
250
+ },
251
+ {
252
+ mapAddress: "{ broadcast: true }",
253
+ legacyChannel: '{ type: "broadcast" }',
254
+ },
255
+ {
256
+ mapAddress: "{ ancestors: true }",
257
+ legacyChannel: '{ type: "lineage" }',
258
+ },
259
+ {
260
+ mapAddress: "{ descendants: true }",
261
+ legacyChannel: '{ type: "subtree" }',
262
+ },
263
+ {
264
+ mapAddress: "{ parent: true }",
265
+ legacyChannel: "N/A",
266
+ notes: "Not supported in legacy format",
267
+ },
268
+ {
269
+ mapAddress: "{ children: true }",
270
+ legacyChannel: "N/A",
271
+ notes: "Not supported in legacy format",
272
+ },
273
+ {
274
+ mapAddress: "{ siblings: true }",
275
+ legacyChannel: "N/A",
276
+ notes: "Not supported in legacy format",
277
+ },
278
+ {
279
+ mapAddress: '{ agents: ["a", "b"] }',
280
+ legacyChannel: "N/A",
281
+ notes: "Not supported in legacy format",
282
+ },
283
+ ];
284
+ }
285
+ //# sourceMappingURL=address-translation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"address-translation.js","sourceRoot":"","sources":["../../../src/map/utils/address-translation.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAaH,OAAO,EACL,cAAc,EACd,eAAe,EACf,cAAc,EACd,aAAa,EACb,kBAAkB,EAClB,aAAa,EACb,kBAAkB,EAClB,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,aAAa,CAAC;AAwBrB,gFAAgF;AAChF,iCAAiC;AACjC,gFAAgF;AAEhF;;;;;;;;;GASG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAgB;IAC/C,0BAA0B;IAC1B,IAAI,cAAc,CAAC,OAAO,CAAC,EAAE,CAAC;QAC5B,OAAO;YACL,IAAI,EAAE,OAAO;YACb,MAAM,EAAE,OAAO,CAAC,KAAK;SACtB,CAAC;IACJ,CAA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QACD;YACE,UAAU,EAAE,gBAAgB;YAC5B,aAAa,EAAE,gCAAgC;SAChD;QACD;YACE,UAAU,EAAE,iBAAiB;YAC7B,aAAa,EAAE,iCAAiC;SACjD;QACD;YACE,UAAU,EAAE,oBAAoB;YAChC,aAAa,EAAE,kCAAkC;SAClD;QACD;YACE,UAAU,EAAE,qCAAqC;YACjD,aAAa,EAAE,0DAA0D;SAC1E;QACD;YACE,UAAU,EAAE,qBAAqB;YACjC,aAAa,EAAE,uBAAuB;SACvC;QACD;YACE,UAAU,EAAE,qBAAqB;YACjC,aAAa,EAAE,qBAAqB;SACrC;QACD;YACE,UAAU,EAAE,uBAAuB;YACnC,aAAa,EAAE,qBAAqB;SACrC;QACD;YACE,UAAU,EAAE,kBAAkB;YAC9B,aAAa,EAAE,KAAK;YACpB,KAAK,EAAE,gCAAgC;SACxC;QACD;YACE,UAAU,EAAE,oBAAoB;YAChC,aAAa,EAAE,KAAK;YACpB,KAAK,EAAE,gCAAgC;SACxC;QACD;YACE,UAAU,EAAE,oBAAoB;YAChC,aAAa,EAAE,KAAK;YACpB,KAAK,EAAE,gCAAgC;SACxC;QACD;YACE,UAAU,EAAE,wBAAwB;YACpC,aAAa,EAAE,KAAK;YACpB,KAAK,EAAE,gCAAgC;SACxC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ export {};
2
+ /**
3
+ * MAP Utilities Module
4
+ *
5
+ * Provides utility functions for MAP integration.
6
+ */
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/map/utils/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG"}
@@ -0,0 +1,7 @@
1
+ export {};
2
+ /**
3
+ * MAP Utilities Module
4
+ *
5
+ * Provides utility functions for MAP integration.
6
+ */
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/map/utils/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG"}
@@ -1025,6 +1025,7 @@ function applySpawnEvent(store, event, notify) {
1025
1025
  store.setRow('agents', agentId, {
1026
1026
  id: agentId,
1027
1027
  session_id: payload.session_id,
1028
+ provider_session_id: '',
1028
1029
  parent: parent ?? '',
1029
1030
  lineage: JSON.stringify(lineage),
1030
1031
  state: 'spawning',
@@ -1069,11 +1070,16 @@ function applyStatusEvent(store, event, notify) {
1069
1070
  const payload = event.payload;
1070
1071
  // Handle specific status types
1071
1072
  if (payload.status_type === 'started') {
1072
- store.setPartialRow('agents', agentId, {
1073
+ const updates = {
1073
1074
  state: 'running',
1074
1075
  started_at: event.timestamp,
1075
1076
  last_activity_at: event.timestamp,
1076
- });
1077
+ };
1078
+ // Store the provider's session ID (e.g., Claude Code UUID for --resume)
1079
+ if (payload.provider_session_id) {
1080
+ updates.provider_session_id = payload.provider_session_id;
1081
+ }
1082
+ store.setPartialRow('agents', agentId, updates);
1077
1083
  }
1078
1084
  else {
1079
1085
  // Always update last_activity_at on any status event
@@ -1311,6 +1317,7 @@ function rowToAgent(row) {
1311
1317
  return {
1312
1318
  id: row.id,
1313
1319
  session_id: row.session_id,
1320
+ provider_session_id: row.provider_session_id || undefined,
1314
1321
  parent: row.parent || null,
1315
1322
  lineage: row.lineage ? JSON.parse(row.lineage) : [],
1316
1323
  state: row.state,