@openscout/protocol 0.2.63 → 0.2.82

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 (216) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +103 -52
  3. package/dist/a2a.d.ts +224 -0
  4. package/dist/a2a.d.ts.map +1 -0
  5. package/dist/a2a.js +225 -0
  6. package/dist/activity.d.ts +70 -0
  7. package/dist/activity.d.ts.map +1 -0
  8. package/dist/activity.js +1 -0
  9. package/dist/actors.d.ts +7 -3
  10. package/dist/actors.d.ts.map +1 -0
  11. package/dist/actors.js +15 -1
  12. package/dist/agent-broker-feed.d.ts +84 -0
  13. package/dist/agent-broker-feed.d.ts.map +1 -0
  14. package/dist/agent-broker-feed.js +1 -0
  15. package/dist/agent-identity.d.ts +23 -0
  16. package/dist/agent-identity.d.ts.map +1 -0
  17. package/dist/agent-identity.js +122 -8
  18. package/dist/agent-runs.d.ts +191 -0
  19. package/dist/agent-runs.d.ts.map +1 -0
  20. package/dist/agent-runs.js +365 -0
  21. package/dist/assigned-roles.d.ts +205 -0
  22. package/dist/assigned-roles.d.ts.map +1 -0
  23. package/dist/assigned-roles.js +228 -0
  24. package/dist/broker-routes.d.ts +40 -0
  25. package/dist/broker-routes.d.ts.map +1 -0
  26. package/dist/broker-routes.js +56 -0
  27. package/dist/budget.d.ts +65 -0
  28. package/dist/budget.d.ts.map +1 -0
  29. package/dist/budget.js +19 -0
  30. package/dist/capability-matrix.d.ts +230 -0
  31. package/dist/capability-matrix.d.ts.map +1 -0
  32. package/dist/capability-matrix.js +304 -0
  33. package/dist/channel-identity.d.ts +40 -0
  34. package/dist/channel-identity.d.ts.map +1 -0
  35. package/dist/channel-identity.js +108 -0
  36. package/dist/collaboration.d.ts +45 -16
  37. package/dist/collaboration.d.ts.map +1 -0
  38. package/dist/collaboration.js +39 -23
  39. package/dist/common.d.ts +4 -3
  40. package/dist/common.d.ts.map +1 -0
  41. package/dist/conversations.d.ts +1 -0
  42. package/dist/conversations.d.ts.map +1 -0
  43. package/dist/cursor-transport.d.ts +22 -0
  44. package/dist/cursor-transport.d.ts.map +1 -0
  45. package/dist/cursor-transport.js +10 -0
  46. package/dist/debug-attach.d.ts +29 -0
  47. package/dist/debug-attach.d.ts.map +1 -0
  48. package/dist/debug-attach.js +6 -0
  49. package/dist/deliveries.d.ts +16 -2
  50. package/dist/deliveries.d.ts.map +1 -0
  51. package/dist/durable-actions.d.ts +94 -0
  52. package/dist/durable-actions.d.ts.map +1 -0
  53. package/dist/durable-actions.js +1 -0
  54. package/dist/events.d.ts +27 -1
  55. package/dist/events.d.ts.map +1 -0
  56. package/dist/events.js +14 -1
  57. package/dist/harness-feature-support.d.ts +76 -0
  58. package/dist/harness-feature-support.d.ts.map +1 -0
  59. package/dist/harness-feature-support.js +29 -0
  60. package/dist/host-integrations.d.ts +22 -0
  61. package/dist/host-integrations.d.ts.map +1 -0
  62. package/dist/host-integrations.js +64 -0
  63. package/dist/inbox.d.ts +50 -0
  64. package/dist/inbox.d.ts.map +1 -0
  65. package/dist/inbox.js +9 -0
  66. package/dist/index.d.ts +36 -2
  67. package/dist/index.d.ts.map +1 -0
  68. package/dist/index.js +35 -2
  69. package/dist/invocations.d.ts +121 -0
  70. package/dist/invocations.d.ts.map +1 -0
  71. package/dist/invocations.js +201 -1
  72. package/dist/mesh.d.ts +98 -0
  73. package/dist/mesh.d.ts.map +1 -0
  74. package/dist/mesh.js +18 -1
  75. package/dist/messages.d.ts +3 -0
  76. package/dist/messages.d.ts.map +1 -0
  77. package/dist/native-interactions.d.ts +30 -0
  78. package/dist/native-interactions.d.ts.map +1 -0
  79. package/dist/native-interactions.js +51 -0
  80. package/dist/observed-status.d.ts +33 -0
  81. package/dist/observed-status.d.ts.map +1 -0
  82. package/dist/observed-status.js +6 -0
  83. package/dist/orchestrator-prompt.d.ts +10 -0
  84. package/dist/orchestrator-prompt.d.ts.map +1 -0
  85. package/dist/orchestrator-prompt.js +36 -0
  86. package/dist/permission-policy.d.ts +5 -0
  87. package/dist/permission-policy.d.ts.map +1 -0
  88. package/dist/permission-policy.js +15 -0
  89. package/dist/provisional-agent-names.d.ts +30 -0
  90. package/dist/provisional-agent-names.d.ts.map +1 -0
  91. package/dist/provisional-agent-names.js +224 -0
  92. package/dist/read-receipts.d.ts +12 -0
  93. package/dist/read-receipts.d.ts.map +1 -0
  94. package/dist/read-receipts.js +1 -0
  95. package/dist/relay-agent-card.d.ts +10 -0
  96. package/dist/relay-agent-card.d.ts.map +1 -0
  97. package/dist/rendezvous.d.ts +97 -0
  98. package/dist/rendezvous.d.ts.map +1 -0
  99. package/dist/rendezvous.js +35 -0
  100. package/dist/reserved-vocabulary.d.ts +21 -0
  101. package/dist/reserved-vocabulary.d.ts.map +1 -0
  102. package/dist/reserved-vocabulary.js +101 -0
  103. package/dist/route-aliases.d.ts +112 -0
  104. package/dist/route-aliases.d.ts.map +1 -0
  105. package/dist/route-aliases.js +1 -0
  106. package/dist/runtime-catalog-contract.d.ts +39 -0
  107. package/dist/runtime-catalog-contract.d.ts.map +1 -0
  108. package/dist/runtime-catalog-contract.js +17 -0
  109. package/dist/runtime-catalog.d.ts +11 -0
  110. package/dist/runtime-catalog.d.ts.map +1 -0
  111. package/dist/runtime-catalog.generated.d.ts +230 -0
  112. package/dist/runtime-catalog.generated.d.ts.map +1 -0
  113. package/dist/runtime-catalog.generated.js +299 -0
  114. package/dist/runtime-catalog.js +192 -0
  115. package/dist/runtime-execution.d.ts +161 -0
  116. package/dist/runtime-execution.d.ts.map +1 -0
  117. package/dist/runtime-execution.js +327 -0
  118. package/dist/runtime-profiles.d.ts +12 -0
  119. package/dist/runtime-profiles.d.ts.map +1 -0
  120. package/dist/runtime-profiles.js +20 -0
  121. package/dist/scout-agent-card.d.ts +10 -0
  122. package/dist/scout-agent-card.d.ts.map +1 -0
  123. package/dist/scout-composer.d.ts +27 -0
  124. package/dist/scout-composer.d.ts.map +1 -0
  125. package/dist/scout-composer.js +192 -0
  126. package/dist/scout-delivery.d.ts +101 -4
  127. package/dist/scout-delivery.d.ts.map +1 -0
  128. package/dist/scout-dispatch.d.ts +44 -3
  129. package/dist/scout-dispatch.d.ts.map +1 -0
  130. package/dist/scout-reply-context.d.ts +14 -0
  131. package/dist/scout-reply-context.d.ts.map +1 -0
  132. package/dist/scout-reply-context.js +1 -0
  133. package/dist/session-display-state.d.ts +132 -0
  134. package/dist/session-display-state.d.ts.map +1 -0
  135. package/dist/session-display-state.js +94 -0
  136. package/dist/terminal-host-topology.d.ts +119 -0
  137. package/dist/terminal-host-topology.d.ts.map +1 -0
  138. package/dist/terminal-host-topology.js +21 -0
  139. package/dist/terminal-sessions.d.ts +142 -0
  140. package/dist/terminal-sessions.d.ts.map +1 -0
  141. package/dist/terminal-sessions.js +81 -0
  142. package/dist/terminal-surface-id.d.ts +73 -0
  143. package/dist/terminal-surface-id.d.ts.map +1 -0
  144. package/dist/terminal-surface-id.js +162 -0
  145. package/dist/terminal-workspaces.d.ts +199 -0
  146. package/dist/terminal-workspaces.d.ts.map +1 -0
  147. package/dist/terminal-workspaces.js +287 -0
  148. package/dist/thread-events.d.ts +1 -0
  149. package/dist/thread-events.d.ts.map +1 -0
  150. package/dist/time.d.ts +16 -0
  151. package/dist/time.d.ts.map +1 -0
  152. package/dist/time.js +33 -0
  153. package/dist/transports.d.ts +1 -0
  154. package/dist/transports.d.ts.map +1 -0
  155. package/package.json +37 -9
  156. package/src/a2a.ts +471 -0
  157. package/src/activity.ts +113 -0
  158. package/src/actors.ts +42 -8
  159. package/src/agent-broker-feed.ts +102 -0
  160. package/src/agent-identity.ts +143 -8
  161. package/src/agent-runs.ts +675 -0
  162. package/src/assigned-roles.ts +437 -0
  163. package/src/broker-routes.ts +62 -0
  164. package/src/budget.ts +88 -0
  165. package/src/capability-matrix.ts +648 -0
  166. package/src/channel-identity.ts +147 -0
  167. package/src/collaboration.ts +78 -48
  168. package/src/common.ts +24 -5
  169. package/src/cursor-transport.ts +34 -0
  170. package/src/debug-attach.ts +38 -0
  171. package/src/deliveries.ts +16 -1
  172. package/src/durable-actions.ts +125 -0
  173. package/src/events.ts +31 -0
  174. package/src/harness-feature-support.ts +116 -0
  175. package/src/host-integrations.ts +104 -0
  176. package/src/inbox.ts +68 -0
  177. package/src/index.ts +35 -2
  178. package/src/invocations.ts +353 -0
  179. package/src/mesh.ts +130 -0
  180. package/src/messages.ts +2 -0
  181. package/src/native-interactions.ts +100 -0
  182. package/src/observed-status.ts +90 -0
  183. package/src/orchestrator-prompt.ts +47 -0
  184. package/src/permission-policy.ts +21 -0
  185. package/src/provisional-agent-names.ts +272 -0
  186. package/src/read-receipts.ts +12 -0
  187. package/src/relay-agent-card.ts +73 -63
  188. package/src/rendezvous.ts +154 -0
  189. package/src/reserved-vocabulary.ts +135 -0
  190. package/src/route-aliases.ts +130 -0
  191. package/src/runtime-catalog-contract.ts +60 -0
  192. package/src/runtime-catalog.generated.ts +300 -0
  193. package/src/runtime-catalog.md +21 -0
  194. package/src/runtime-catalog.ts +193 -0
  195. package/src/runtime-catalog.v1.json +81 -0
  196. package/src/runtime-execution.ts +545 -0
  197. package/src/runtime-profiles.ts +37 -0
  198. package/src/scout-agent-card.ts +10 -0
  199. package/src/scout-composer.ts +249 -0
  200. package/src/scout-delivery.ts +117 -4
  201. package/src/scout-dispatch.ts +34 -2
  202. package/src/scout-reply-context.ts +15 -0
  203. package/src/session-display-state.ts +202 -0
  204. package/src/terminal-host-topology.ts +132 -0
  205. package/src/terminal-sessions.ts +187 -0
  206. package/src/terminal-surface-id.ts +189 -0
  207. package/src/terminal-workspaces.ts +455 -0
  208. package/src/time.ts +49 -0
  209. package/dist/agent-address.d.ts +0 -1
  210. package/dist/agent-address.js +0 -1
  211. package/dist/agent-selectors.d.ts +0 -1
  212. package/dist/agent-selectors.js +0 -1
  213. package/src/agent-address.ts +0 -1
  214. package/src/agent-identity.test.ts +0 -435
  215. package/src/agent-selectors.ts +0 -1
  216. package/src/scout-agent-card.test.ts +0 -54
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md CHANGED
@@ -4,16 +4,61 @@
4
4
 
5
5
  This package is intentionally not named `relay`. Relay is now a surface and compatibility layer. The control protocol is the canonical model underneath it.
6
6
 
7
- For the definitive Scout glossary, see [docs/glossary.md](../../docs/glossary.md). For Scout's current A2A posture and vocabulary mapping, see [docs/a2a-alignment.md](../../docs/a2a-alignment.md).
7
+ For the definitive Scout vocabulary and A2A posture, see [docs/concepts.md](../../docs/concepts.md).
8
8
 
9
9
  Scout is aware of adjacent standards such as A2A, but this package is not trying to become an A2A clone. The goal is clean correspondence without giving up Scout-specific mechanics such as broker-owned routing, `invocation` plus `flight`, or the `question` / `work_item` collaboration model.
10
10
 
11
- ## What Makes This A Good Local Communication Protocol
11
+ ## Quickstart
12
+
13
+ `@openscout/protocol` is pure, dependency-free TypeScript: typed records, discriminated-union control events, and hand-written validators for the OpenScout control plane. Use it at the boundary where user intent becomes broker-owned state.
14
+
15
+ ```ts
16
+ import {
17
+ parseScoutComposerRoute,
18
+ validateCollaborationRecord,
19
+ type CollaborationUpsertCommand,
20
+ type QuestionRecord,
21
+ } from "@openscout/protocol";
22
+
23
+ const parsed = parseScoutComposerRoute(">> hudson Can you review the parser?");
24
+ if (!parsed.route) {
25
+ const reason = parsed.diagnostics[0]?.message ?? "missing Scout route";
26
+ throw new Error(reason);
27
+ }
28
+
29
+ const now = Date.now();
30
+ const question: QuestionRecord = {
31
+ id: crypto.randomUUID(),
32
+ kind: "question",
33
+ state: "open",
34
+ acceptanceState: "none",
35
+ title: parsed.body,
36
+ createdById: "person:arach",
37
+ ownerId: parsed.route.target.value,
38
+ nextMoveOwnerId: parsed.route.target.value,
39
+ createdAt: now,
40
+ updatedAt: now,
41
+ metadata: {
42
+ route: parsed.route.target,
43
+ source: "composer",
44
+ },
45
+ };
46
+
47
+ const problems = validateCollaborationRecord(question);
48
+ if (problems.length > 0) throw new Error(problems.join("; "));
49
+
50
+ const command: CollaborationUpsertCommand = {
51
+ kind: "collaboration.upsert",
52
+ record: question,
53
+ };
54
+ ```
55
+
56
+ ## Protocol Properties
12
57
 
13
58
  The target is a protocol that is:
14
59
 
15
60
  - explicit: conversation, work, delivery, and external bindings are separate records
16
- - durable: the broker is the only writer and local state is stored canonically
61
+ - durable: clients and adapters submit commands to the broker instead of writing coordination records directly
17
62
  - addressable: actors, conversations, messages, invocations, flights, and deliveries all have stable IDs
18
63
  - replayable: read models can be rebuilt from durable records and events
19
64
  - observable: status, ownership, outputs, and failures are inspectable
@@ -38,35 +83,37 @@ The protocol keeps a small set of nouns and gives each one a single job:
38
83
 
39
84
  For discovery, Scout also uses a `ScoutAgentCard`: a local discovery and routing card that overlaps intentionally with A2A-style discovery fields such as provider, skills, supported interfaces, and security hints without claiming to be the A2A wire-level `AgentCard`.
40
85
 
41
- ## Emerging Collaboration Model
86
+ ## Collaboration Model
42
87
 
43
- The protocol package now also exports a collaboration vocabulary for the next layer above
44
- messages and invocations. This is the first thin slice toward explicit human-agent and
45
- agent-agent workflow tracking. It is intentionally small.
88
+ Use collaboration records when an ask or task needs durable ownership, state, or
89
+ handoff. Keep ordinary discussion in `message` records. Use `invocation` and
90
+ `flight` for execution requests and their runtime lifecycle. Use collaboration
91
+ records for questions and work items that need to be tracked across surfaces.
46
92
 
47
- The current canonical collaboration kinds are:
93
+ The canonical collaboration kinds are:
48
94
 
49
- - `question`: a lightweight information-seeking interaction with states such as `open`,
50
- `answered`, `closed`, and `declined`
51
- - `work_item`: a durable execution object with states such as `open`, `working`,
52
- `waiting`, `review`, `done`, and `cancelled`
95
+ - `question`: a specific ask that can be `open`, `answered`, `closed`, or
96
+ `declined`
97
+ - `work_item`: durable execution with an owner, next move, progress, and states
98
+ such as `open`, `working`, `waiting`, `review`, `done`, and `cancelled`
53
99
 
54
100
  These are peers, not points on one severity ladder:
55
101
 
56
102
  - a question can resolve directly
57
103
  - a question can attach to a work item
58
104
  - a question can spawn a work item
59
- - a work item can accumulate progress, waiting conditions, and review state without
60
- pretending it started as a question
105
+ - a work item can accumulate progress, waiting conditions, and review state
61
106
 
62
107
  Acceptance is modeled separately from workflow state so that a reply and satisfaction do
63
108
  not collapse into one transition. A work item can be done without peer acceptance, and a
64
109
  question can be answered without being closed yet.
65
110
 
66
- The exported collaboration shapes are a protocol vocabulary for upcoming runtime and UI
67
- work. They do not yet imply that the broker persists the full collaboration layer today.
68
- See [docs/collaboration-workflows-v1.md](../../docs/collaboration-workflows-v1.md) for the
69
- v1 model.
111
+ These collaboration shapes are backed by the runtime. The broker persists collaboration
112
+ records and events to its local store (`collaboration.upsert` and
113
+ `collaboration.event.append` commands, `collaboration_records` and `collaboration_events`
114
+ tables) and emits `collaboration.upserted` / `collaboration.event.appended` control events.
115
+ See [docs/agents-and-collaboration.md](../../docs/agents-and-collaboration.md) for the
116
+ full collaboration model.
70
117
 
71
118
  ## Identity Model
72
119
 
@@ -81,6 +128,22 @@ The important distinction is between a helper and an agent:
81
128
 
82
129
  This lets a person work with a helper in Codex or Claude while still invoking real agents as first-class targets.
83
130
 
131
+ ## Composer Route Operator
132
+
133
+ Scout-aware text inputs can use `>>` to route without relying on `@` mentions
134
+ owned by the host UI:
135
+
136
+ ```text
137
+ /scout:ask >> hudson Review the parser.
138
+ ```
139
+
140
+ The route operator is composer syntax, not message payload. The protocol package
141
+ exports `parseScoutComposerRoute`, `SCOUT_COMPOSER_ROUTE_OPERATOR`, and
142
+ `SCOUT_TARGET_HANDLE_SHORTHAND` so clients can translate `>> hudson`,
143
+ `>> target:mw-talkie`, `>> ⌖mw-talkie`, `>> ref:8kj4pd`, `>> channel:ops`,
144
+ or `>> broadcast` into structured `ScoutRouteTarget` metadata before
145
+ submitting to the broker.
146
+
84
147
  ## Core Design Rules
85
148
 
86
149
  1. A message is conversation.
@@ -88,19 +151,8 @@ This lets a person work with a helper in Codex or Claude while still invoking re
88
151
  3. A flight is the tracked lifecycle of that work.
89
152
  4. Delivery is planned explicitly per target and transport.
90
153
  5. Bindings map external channels into the same internal model.
91
- 6. Voice is metadata and transport, not the canonical message body.
92
- 7. The broker is the only canonical writer.
93
-
94
- ## Bootstrap And Startup
95
-
96
- The intended machine lifecycle is:
97
-
98
- 1. `scout setup` creates machine-local settings, a relay agent registry, and repo-local `.openscout/project.json` when needed.
99
- 2. The runtime installs a launch agent under `~/Library/LaunchAgents/` for the broker.
100
- 3. `launchd` keeps the broker process alive and restarts it if it exits.
101
- 4. Workspace discovery scans configured roots and repo-local manifests to map projects to agent identities.
102
- 5. Agents register endpoints that describe their harness, transport, session, cwd, and project root.
103
- 6. Surfaces such as the desktop shell, CLI, and relay compatibility layer talk to the broker instead of writing shared files directly.
154
+ 6. Clients and adapters submit commands to the broker instead of writing Scout-owned coordination records directly.
155
+ 7. Harnesses own their primary transcripts and logs; Scout links to and observes them without importing them as canonical messages.
104
156
 
105
157
  ## Conversation, Work, And Delivery
106
158
 
@@ -177,7 +229,7 @@ The important part is the separation:
177
229
 
178
230
  ## Storage Model
179
231
 
180
- The runtime package owns the SQLite schema. The durable model is:
232
+ The runtime package owns the local storage and projection schema for Scout-owned control-plane records. The durable model is:
181
233
 
182
234
  - `nodes`
183
235
  - `actors`
@@ -195,9 +247,11 @@ The runtime package owns the SQLite schema. The durable model is:
195
247
  - `delivery_attempts`
196
248
  - `events`
197
249
 
198
- SQLite is the canonical store because it stays local and inspectable while handling append races, indexing, leases, retries, and subscriptions better than raw JSONL.
250
+ These are first-party Scout facts: records created by Scout surfaces, agent tools, the broker, or mesh forwarding. Local projections such as SQLite make those facts cheap to inspect, query, and render across surfaces.
199
251
 
200
- ## Why Work Does Not Get Lost
252
+ External harness transcripts are different. Claude Code JSONL, Codex session JSONL, and future harness logs are source material owned by their harnesses. Scout can observe them through adapters and tail views, but the protocol should not treat every external transcript turn as a Scout `message` or require bulk transcript replication into the control-plane database.
253
+
254
+ ## Durability
201
255
 
202
256
  The protocol is designed so that the system does not depend on terminal scrollback to remember what happened.
203
257
 
@@ -207,6 +261,7 @@ The protocol is designed so that the system does not depend on terminal scrollba
207
261
  - deliveries and delivery attempts make routing and failures inspectable
208
262
  - bindings make external channel mappings durable
209
263
  - append-only events let read models be rebuilt
264
+ - external harness transcript files remain linkable and observable without becoming Scout-owned conversation records
210
265
 
211
266
  That does not require every surface to be smart. The broker owns the hard part, and the surfaces can recover by reading the canonical store.
212
267
 
@@ -221,31 +276,27 @@ OpenScout should not fork its protocol per harness.
221
276
 
222
277
  This keeps the protocol stable even when the execution layer changes.
223
278
 
224
- ## Modalities
279
+ ## Transport And Media
225
280
 
226
- The protocol supports multiple modalities, but text remains canonical.
281
+ The protocol is text-first and transport-agnostic. Commands, subscriptions,
282
+ bridge delivery, and media references travel through transport records or
283
+ metadata; raw media does not belong in the canonical conversation log.
227
284
 
228
285
  - HTTP: commands, admin, webhook intake
229
286
  - WebSocket: subscriptions, streaming flight updates, typing/presence
230
287
  - local socket: trusted local clients such as the native app and CLI
231
288
  - bridges: Telegram, Discord, telecom adapters
232
- - voice: transcripts, playback directives, media references
233
-
234
- Raw media does not belong in the primary message log. The protocol stores transcript, speech, and attachment metadata while media transport stays on a dedicated transport.
289
+ - media attachments: transcripts, playback directives, and file references
235
290
 
236
- ## What The Protocol Is Not
291
+ Transport-specific behavior belongs at adapters and runtime surfaces. The
292
+ protocol keeps the durable record shape stable.
237
293
 
238
- OpenScout is intentionally not trying to be:
294
+ ## Package Commands
239
295
 
240
- - a hosted chat service
241
- - a workflow engine with mandatory plan bureaucracy
242
- - a harness-specific control plane
243
- - a replacement for Telegram, Discord, or tmux
296
+ From the repo root:
244
297
 
245
- It is the durable local substrate that makes agent communication legible, inspectable, and recoverable.
246
-
247
- ## Migration Direction
248
-
249
- The control protocol replaces Relay as the core architecture.
250
-
251
- Any remaining Relay-specific tools should be treated as surfaces or compatibility utilities, not as canonical storage or runtime paths.
298
+ ```bash
299
+ npm --prefix packages/protocol run build
300
+ npm --prefix packages/protocol run check
301
+ npm --prefix packages/protocol run test
302
+ ```
package/dist/a2a.d.ts ADDED
@@ -0,0 +1,224 @@
1
+ import type { MetadataMap, ScoutId } from "./common.js";
2
+ import type { FlightRecord, InvocationRequest } from "./invocations.js";
3
+ import type { ScoutAgentCard } from "./scout-agent-card.js";
4
+ export declare const A2A_PROTOCOL_VERSION = "1.0";
5
+ export declare const A2A_JSON_RPC_CONTENT_TYPE = "application/json";
6
+ export declare const A2A_HTTP_JSON_CONTENT_TYPE = "application/a2a+json";
7
+ export declare const A2A_JSON_RPC_METHODS: {
8
+ readonly sendMessage: "SendMessage";
9
+ readonly sendStreamingMessage: "SendStreamingMessage";
10
+ readonly getTask: "GetTask";
11
+ readonly listTasks: "ListTasks";
12
+ readonly cancelTask: "CancelTask";
13
+ readonly subscribeToTask: "SubscribeToTask";
14
+ readonly createTaskPushNotificationConfig: "CreateTaskPushNotificationConfig";
15
+ readonly getTaskPushNotificationConfig: "GetTaskPushNotificationConfig";
16
+ readonly listTaskPushNotificationConfigs: "ListTaskPushNotificationConfigs";
17
+ readonly deleteTaskPushNotificationConfig: "DeleteTaskPushNotificationConfig";
18
+ readonly getExtendedAgentCard: "GetExtendedAgentCard";
19
+ };
20
+ export declare const A2A_LEGACY_JSON_RPC_METHODS: {
21
+ readonly sendMessage: "message/send";
22
+ readonly sendStreamingMessage: "message/stream";
23
+ readonly getTask: "tasks/get";
24
+ readonly listTasks: "tasks/list";
25
+ readonly cancelTask: "tasks/cancel";
26
+ readonly subscribeToTask: "tasks/subscribe";
27
+ readonly getExtendedAgentCard: "agent/getAuthenticatedExtendedCard";
28
+ };
29
+ export type A2AJsonRpcMethod = typeof A2A_JSON_RPC_METHODS[keyof typeof A2A_JSON_RPC_METHODS] | typeof A2A_LEGACY_JSON_RPC_METHODS[keyof typeof A2A_LEGACY_JSON_RPC_METHODS];
30
+ export type A2ARole = "ROLE_USER" | "ROLE_AGENT";
31
+ export type A2ATaskState = "TASK_STATE_SUBMITTED" | "TASK_STATE_WORKING" | "TASK_STATE_INPUT_REQUIRED" | "TASK_STATE_AUTH_REQUIRED" | "TASK_STATE_COMPLETED" | "TASK_STATE_FAILED" | "TASK_STATE_CANCELED" | "TASK_STATE_REJECTED" | "TASK_STATE_UNKNOWN";
32
+ export type A2APart = {
33
+ text: string;
34
+ metadata?: MetadataMap;
35
+ } | {
36
+ file: {
37
+ name?: string;
38
+ mimeType?: string;
39
+ bytes?: string;
40
+ uri?: string;
41
+ };
42
+ metadata?: MetadataMap;
43
+ } | {
44
+ data: unknown;
45
+ metadata?: MetadataMap;
46
+ };
47
+ export interface A2AMessage {
48
+ role: A2ARole;
49
+ parts: A2APart[];
50
+ messageId: ScoutId;
51
+ taskId?: ScoutId;
52
+ contextId?: ScoutId;
53
+ extensions?: string[];
54
+ metadata?: MetadataMap;
55
+ }
56
+ export interface A2AArtifact {
57
+ artifactId: ScoutId;
58
+ name?: string;
59
+ description?: string;
60
+ parts: A2APart[];
61
+ metadata?: MetadataMap;
62
+ }
63
+ export interface A2ATaskStatus {
64
+ state: A2ATaskState;
65
+ message?: A2AMessage;
66
+ timestamp?: string;
67
+ }
68
+ export interface A2ATask {
69
+ id: ScoutId;
70
+ contextId: ScoutId;
71
+ status: A2ATaskStatus;
72
+ artifacts?: A2AArtifact[];
73
+ history?: A2AMessage[];
74
+ metadata?: MetadataMap;
75
+ }
76
+ export interface A2ATaskStatusUpdateEvent {
77
+ taskId: ScoutId;
78
+ contextId: ScoutId;
79
+ status: A2ATaskStatus;
80
+ final?: boolean;
81
+ metadata?: MetadataMap;
82
+ }
83
+ export interface A2ATaskArtifactUpdateEvent {
84
+ taskId: ScoutId;
85
+ contextId: ScoutId;
86
+ artifact: A2AArtifact;
87
+ append?: boolean;
88
+ lastChunk?: boolean;
89
+ metadata?: MetadataMap;
90
+ }
91
+ export type A2AStreamResponse = {
92
+ task: A2ATask;
93
+ } | {
94
+ message: A2AMessage;
95
+ } | {
96
+ statusUpdate: A2ATaskStatusUpdateEvent;
97
+ } | {
98
+ artifactUpdate: A2ATaskArtifactUpdateEvent;
99
+ };
100
+ export interface A2AAgentProvider {
101
+ organization: string;
102
+ url?: string;
103
+ }
104
+ export interface A2AAgentCapabilities {
105
+ streaming?: boolean;
106
+ pushNotifications?: boolean;
107
+ stateTransitionHistory?: boolean;
108
+ extendedAgentCard?: boolean;
109
+ extensions?: Array<{
110
+ uri: string;
111
+ description?: string;
112
+ required?: boolean;
113
+ params?: MetadataMap;
114
+ }>;
115
+ }
116
+ export interface A2AAgentSkill {
117
+ id: string;
118
+ name: string;
119
+ description: string;
120
+ tags?: string[];
121
+ examples?: string[];
122
+ inputModes?: string[];
123
+ outputModes?: string[];
124
+ }
125
+ export interface A2AAgentInterface {
126
+ url: string;
127
+ transport?: string;
128
+ protocolBinding: string;
129
+ protocolVersion?: string;
130
+ tenant?: string;
131
+ }
132
+ export interface A2AAgentCard {
133
+ protocolVersion: string;
134
+ name: string;
135
+ description: string;
136
+ url: string;
137
+ preferredTransport?: string;
138
+ provider?: A2AAgentProvider;
139
+ version?: string;
140
+ documentationUrl?: string;
141
+ capabilities: A2AAgentCapabilities;
142
+ defaultInputModes: string[];
143
+ defaultOutputModes: string[];
144
+ skills: A2AAgentSkill[];
145
+ supportedInterfaces?: A2AAgentInterface[];
146
+ securitySchemes?: Record<string, unknown>;
147
+ security?: Array<Record<string, string[]>>;
148
+ iconUrl?: string;
149
+ signatures?: unknown[];
150
+ metadata?: MetadataMap;
151
+ }
152
+ export interface A2AJsonRpcRequest<TParams = unknown> {
153
+ jsonrpc: "2.0";
154
+ id: string | number | null;
155
+ method: A2AJsonRpcMethod | string;
156
+ params?: TParams;
157
+ }
158
+ export interface A2AJsonRpcResponse<TResult = unknown> {
159
+ jsonrpc: "2.0";
160
+ id: string | number | null;
161
+ result?: TResult;
162
+ error?: A2AJsonRpcError;
163
+ }
164
+ export interface A2AJsonRpcError {
165
+ code: number;
166
+ message: string;
167
+ data?: unknown;
168
+ }
169
+ export interface A2ASendMessageParams {
170
+ message: A2AMessage;
171
+ configuration?: {
172
+ acceptedOutputModes?: string[];
173
+ historyLength?: number;
174
+ blocking?: boolean;
175
+ pushNotificationConfig?: unknown;
176
+ };
177
+ metadata?: MetadataMap;
178
+ }
179
+ export interface A2ATaskIdParams {
180
+ id?: string;
181
+ taskId?: string;
182
+ metadata?: MetadataMap;
183
+ }
184
+ export interface A2AListTasksParams {
185
+ contextId?: string;
186
+ limit?: number;
187
+ pageSize?: number;
188
+ pageToken?: string;
189
+ state?: A2ATaskState | string;
190
+ metadata?: MetadataMap;
191
+ }
192
+ export interface A2AListTasksResult {
193
+ tasks: A2ATask[];
194
+ pageSize: number;
195
+ nextPageToken?: string;
196
+ totalSize?: number;
197
+ }
198
+ export declare function a2aTaskStateFromFlightState(state: FlightRecord["state"]): A2ATaskState;
199
+ export declare function isA2ATerminalTaskState(state: A2ATaskState): boolean;
200
+ export declare function a2aTextPart(text: string, metadata?: MetadataMap): A2APart;
201
+ export declare function a2aTextMessage(input: {
202
+ role: A2ARole;
203
+ text: string;
204
+ messageId: string;
205
+ contextId?: string;
206
+ taskId?: string;
207
+ metadata?: MetadataMap;
208
+ }): A2AMessage;
209
+ export declare function a2aTextFromParts(parts: unknown): string;
210
+ export declare function a2aTextFromMessage(message: unknown): string;
211
+ export declare function a2aContextIdForInvocation(invocation: InvocationRequest, fallback?: string): string;
212
+ export declare function a2aTaskFromFlight(flight: FlightRecord, invocation?: InvocationRequest, options?: {
213
+ contextId?: string;
214
+ includeHistory?: boolean;
215
+ timestamp?: string;
216
+ }): A2ATask;
217
+ export declare function a2aAgentCardFromScoutCard(card: ScoutAgentCard, options: {
218
+ url: string;
219
+ protocolVersion?: string;
220
+ protocolBinding?: string;
221
+ transport?: string;
222
+ capabilities?: Partial<A2AAgentCapabilities>;
223
+ }): A2AAgentCard;
224
+ //# sourceMappingURL=a2a.d.ts.map