@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
@@ -0,0 +1,365 @@
1
+ import { normalizeScoutPermissionProfile, } from "./permission-policy.js";
2
+ export const AGENT_RUN_STATES = [
3
+ "queued",
4
+ "waking",
5
+ "running",
6
+ "waiting",
7
+ "review",
8
+ "completed",
9
+ "failed",
10
+ "cancelled",
11
+ "unknown",
12
+ ];
13
+ export const AGENT_RUN_SOURCES = [
14
+ "ask",
15
+ "message",
16
+ "schedule",
17
+ "recipe",
18
+ "external_issue",
19
+ "manual",
20
+ "eval",
21
+ "unknown",
22
+ ];
23
+ export const AGENT_RUN_REVIEW_STATES = [
24
+ "none",
25
+ "needed",
26
+ "blocked",
27
+ "approved",
28
+ "rejected",
29
+ ];
30
+ export function deriveProjectedAgentRunId(input) {
31
+ const flightId = trimString(input.flightId);
32
+ if (flightId) {
33
+ return `run:flight:${flightId}`;
34
+ }
35
+ return `run:invocation:${input.invocationId}`;
36
+ }
37
+ export function projectAgentRunFromInvocationFlight(input) {
38
+ const { invocation, flight } = input;
39
+ const agentRevisionSnapshot = input.agentRevisionSnapshot
40
+ ?? metadataObject(invocation.metadata, "agentRevisionSnapshot");
41
+ const reviewTaskIds = uniqueIds(input.reviewTaskIds ?? metadataIdList(invocation.metadata, "reviewTaskIds"));
42
+ const artifactIds = uniqueIds(input.artifactIds ?? metadataIdList(invocation.metadata, "artifactIds"));
43
+ const traceSessionIds = uniqueIds(input.traceSessionIds ?? metadataIdList(invocation.metadata, "traceSessionIds"));
44
+ const reviewState = inferReviewState({
45
+ explicitReviewState: input.reviewState,
46
+ invocationMetadata: invocation.metadata,
47
+ flightMetadata: flight?.metadata,
48
+ reviewTaskIds,
49
+ });
50
+ const state = projectAgentRunState(flight?.state, reviewState);
51
+ const output = projectOutput(flight);
52
+ const metadata = projectMetadata({
53
+ invocationMetadata: invocation.metadata,
54
+ flightMetadata: flight?.metadata,
55
+ agentRevisionSnapshot,
56
+ });
57
+ const permissionProfile = inferPermissionProfile(invocation, agentRevisionSnapshot);
58
+ const harness = invocation.execution?.harness ?? agentRevisionSnapshot?.runtime?.harness;
59
+ const model = stringMetadata(invocation.metadata, "model")
60
+ ?? stringMetadata(flight?.metadata, "model")
61
+ ?? agentRevisionSnapshot?.runtime?.model;
62
+ const workId = inferWorkId(invocation);
63
+ const collaborationRecordId = inferCollaborationRecordId(invocation);
64
+ const run = {
65
+ id: deriveProjectedAgentRunId({
66
+ invocationId: invocation.id,
67
+ flightId: flight?.id,
68
+ }),
69
+ source: input.source ?? inferAgentRunSource(invocation),
70
+ requesterId: invocation.requesterId,
71
+ agentId: invocation.targetAgentId,
72
+ state,
73
+ input: projectInput(invocation),
74
+ createdAt: invocation.createdAt,
75
+ updatedAt: projectUpdatedAt(invocation, flight, input.now),
76
+ };
77
+ addOptional(run, "agentRevisionId", agentRevisionSnapshot?.id ?? stringMetadata(invocation.metadata, "agentRevisionId"));
78
+ addOptional(run, "agentRevisionSnapshot", agentRevisionSnapshot);
79
+ addOptional(run, "aliasId", stringMetadata(invocation.metadata, "aliasId"));
80
+ addOptional(run, "workId", workId);
81
+ addOptional(run, "collaborationRecordId", collaborationRecordId);
82
+ addOptional(run, "conversationId", invocation.conversationId);
83
+ addOptional(run, "messageId", invocation.messageId);
84
+ addOptional(run, "invocationId", invocation.id);
85
+ addOptional(run, "flightIds", flight ? [flight.id] : undefined);
86
+ addOptional(run, "parentRunId", stringMetadata(invocation.metadata, "parentRunId"));
87
+ addOptional(run, "rootRunId", stringMetadata(invocation.metadata, "rootRunId"));
88
+ addOptional(run, "recipeId", stringMetadata(invocation.metadata, "recipeId"));
89
+ addOptional(run, "attempt", numberMetadata(invocation.metadata, "attempt"));
90
+ addOptional(run, "idempotencyKey", stringMetadata(invocation.metadata, "idempotencyKey"));
91
+ addOptional(run, "reviewState", reviewState);
92
+ addOptional(run, "terminalReason", terminalReason(flight, state));
93
+ addOptional(run, "output", output);
94
+ addOptional(run, "artifactIds", artifactIds.length > 0 ? artifactIds : undefined);
95
+ addOptional(run, "reviewTaskIds", reviewTaskIds.length > 0 ? reviewTaskIds : undefined);
96
+ addOptional(run, "traceSessionIds", traceSessionIds.length > 0 ? traceSessionIds : undefined);
97
+ addOptional(run, "startedAt", flight?.startedAt);
98
+ addOptional(run, "completedAt", flight?.completedAt);
99
+ addOptional(run, "harness", harness);
100
+ addOptional(run, "model", model);
101
+ addOptional(run, "permissionProfile", permissionProfile);
102
+ addOptional(run, "metrics", inferMetrics(invocation.metadata, flight?.metadata));
103
+ addOptional(run, "metadata", metadata);
104
+ return run;
105
+ }
106
+ /**
107
+ * Project an AgentRun from the merged invocation record (Phase 3's single source
108
+ * of truth), where execution status lives on the invocation itself.
109
+ *
110
+ * Until the storage merge (PR B+) lands, this re-derives the flight view from the
111
+ * invocation's status subset and delegates to
112
+ * {@link projectAgentRunFromInvocationFlight}, so the two projectors stay
113
+ * behavior-identical and the stable `run:flight:<flightId>` id is preserved. A
114
+ * record with no durable flightId projects as an invocation-only run, exactly as
115
+ * the flight-based projector does when no flight is present.
116
+ */
117
+ export function projectAgentRunFromInvocation(input) {
118
+ const { invocation } = input;
119
+ const flight = invocation.flightId
120
+ ? {
121
+ id: invocation.flightId,
122
+ invocationId: invocation.id,
123
+ requesterId: invocation.requesterId,
124
+ targetAgentId: invocation.targetAgentId,
125
+ state: invocation.state ?? "queued",
126
+ summary: invocation.summary,
127
+ output: invocation.output,
128
+ error: invocation.error,
129
+ startedAt: invocation.startedAt,
130
+ completedAt: invocation.completedAt,
131
+ labels: invocation.labels,
132
+ metadata: invocation.metadata,
133
+ }
134
+ : undefined;
135
+ return projectAgentRunFromInvocationFlight({
136
+ invocation,
137
+ flight,
138
+ now: input.now,
139
+ source: input.source,
140
+ reviewState: input.reviewState,
141
+ agentRevisionSnapshot: input.agentRevisionSnapshot,
142
+ reviewTaskIds: input.reviewTaskIds,
143
+ artifactIds: input.artifactIds,
144
+ traceSessionIds: input.traceSessionIds,
145
+ });
146
+ }
147
+ export function projectAgentRunState(flightState, reviewState) {
148
+ if (flightState === "failed") {
149
+ return "failed";
150
+ }
151
+ if (flightState === "cancelled") {
152
+ return "cancelled";
153
+ }
154
+ if (flightState === "completed" && isBlockingReviewState(reviewState)) {
155
+ return "review";
156
+ }
157
+ if (isAgentRunState(flightState)) {
158
+ return flightState;
159
+ }
160
+ return "unknown";
161
+ }
162
+ function projectInput(invocation) {
163
+ const projected = {
164
+ action: invocation.action,
165
+ task: invocation.task,
166
+ targetAgentId: invocation.targetAgentId,
167
+ requesterNodeId: invocation.requesterNodeId,
168
+ ensureAwake: invocation.ensureAwake,
169
+ stream: invocation.stream,
170
+ };
171
+ addOptional(projected, "targetNodeId", invocation.targetNodeId);
172
+ addOptional(projected, "timeoutMs", invocation.timeoutMs);
173
+ addOptional(projected, "context", invocation.context);
174
+ addOptional(projected, "execution", invocation.execution);
175
+ addOptional(projected, "metadata", invocation.metadata);
176
+ return projected;
177
+ }
178
+ function projectOutput(flight) {
179
+ if (!flight) {
180
+ return undefined;
181
+ }
182
+ const output = {};
183
+ addOptional(output, "summary", flight.summary);
184
+ addOptional(output, "text", flight.output);
185
+ addOptional(output, "error", flight.error);
186
+ addOptional(output, "metadata", flight.metadata);
187
+ return Object.keys(output).length > 0 ? output : undefined;
188
+ }
189
+ function projectMetadata(input) {
190
+ const metadata = {};
191
+ const rawSource = stringMetadata(input.invocationMetadata, "source");
192
+ addOptional(metadata, "rawSource", rawSource);
193
+ addOptional(metadata, "invocationMetadata", input.invocationMetadata);
194
+ addOptional(metadata, "flightMetadata", input.flightMetadata);
195
+ addOptional(metadata, "agentRevisionSnapshot", input.agentRevisionSnapshot);
196
+ return Object.keys(metadata).length > 0 ? metadata : undefined;
197
+ }
198
+ function projectUpdatedAt(invocation, flight, now) {
199
+ if (flight?.completedAt !== undefined) {
200
+ return flight.completedAt;
201
+ }
202
+ if (now !== undefined) {
203
+ return now;
204
+ }
205
+ if (flight?.startedAt !== undefined) {
206
+ return flight.startedAt;
207
+ }
208
+ return invocation.createdAt;
209
+ }
210
+ function inferAgentRunSource(invocation) {
211
+ const explicit = stringMetadata(invocation.metadata, "agentRunSource")
212
+ ?? stringMetadata(invocation.metadata, "runSource");
213
+ if (isAgentRunSource(explicit)) {
214
+ return explicit;
215
+ }
216
+ const rawSource = stringMetadata(invocation.metadata, "source");
217
+ if (isAgentRunSource(rawSource)) {
218
+ return rawSource;
219
+ }
220
+ switch (rawSource) {
221
+ case "collaboration-record":
222
+ return "ask";
223
+ case "broker-deliver":
224
+ return "message";
225
+ case "scout-app":
226
+ return invocation.messageId ? "message" : "manual";
227
+ case "scout-cli":
228
+ return invocation.messageId ? "message" : "ask";
229
+ default:
230
+ break;
231
+ }
232
+ if (invocation.collaborationRecordId
233
+ || metadataObject(invocation.context, "collaboration")
234
+ || stringMetadata(invocation.context, "collaborationRecordId")) {
235
+ return "ask";
236
+ }
237
+ if (invocation.messageId || invocation.conversationId) {
238
+ return "message";
239
+ }
240
+ if (invocation.action === "wake") {
241
+ return "manual";
242
+ }
243
+ return "ask";
244
+ }
245
+ function inferReviewState(input) {
246
+ if (input.explicitReviewState) {
247
+ return input.explicitReviewState;
248
+ }
249
+ const metadataReviewState = stringMetadata(input.flightMetadata, "reviewState")
250
+ ?? stringMetadata(input.invocationMetadata, "reviewState");
251
+ if (isAgentRunReviewState(metadataReviewState)) {
252
+ return metadataReviewState;
253
+ }
254
+ if (input.reviewTaskIds.length > 0
255
+ || booleanMetadata(input.flightMetadata, "reviewNeeded")
256
+ || booleanMetadata(input.flightMetadata, "needsReview")
257
+ || booleanMetadata(input.flightMetadata, "requiresReview")
258
+ || booleanMetadata(input.invocationMetadata, "reviewNeeded")
259
+ || booleanMetadata(input.invocationMetadata, "needsReview")
260
+ || booleanMetadata(input.invocationMetadata, "requiresReview")) {
261
+ return "needed";
262
+ }
263
+ return undefined;
264
+ }
265
+ function inferPermissionProfile(invocation, agentRevisionSnapshot) {
266
+ return invocation.execution?.permissionProfile
267
+ ?? normalizeScoutPermissionProfile(stringMetadata(invocation.metadata, "permissionProfile"))
268
+ ?? normalizeScoutPermissionProfile(agentRevisionSnapshot?.permissions?.permissionProfile);
269
+ }
270
+ function inferMetrics(invocationMetadata, flightMetadata) {
271
+ const metrics = metadataObject(flightMetadata, "metrics")
272
+ ?? metadataObject(invocationMetadata, "metrics");
273
+ if (!metrics) {
274
+ return undefined;
275
+ }
276
+ const projected = {};
277
+ addOptional(projected, "inputTokens", numberMetadata(metrics, "inputTokens"));
278
+ addOptional(projected, "outputTokens", numberMetadata(metrics, "outputTokens"));
279
+ addOptional(projected, "totalTokens", numberMetadata(metrics, "totalTokens"));
280
+ addOptional(projected, "estimatedUsd", numberMetadata(metrics, "estimatedUsd"));
281
+ addOptional(projected, "wallClockMs", numberMetadata(metrics, "wallClockMs"));
282
+ addOptional(projected, "toolCallCount", numberMetadata(metrics, "toolCallCount"));
283
+ addOptional(projected, "retryCount", numberMetadata(metrics, "retryCount"));
284
+ return Object.keys(projected).length > 0 ? projected : undefined;
285
+ }
286
+ function inferWorkId(invocation) {
287
+ return stringMetadata(invocation.metadata, "workId")
288
+ ?? stringMetadata(invocation.context, "workId")
289
+ ?? inferCollaborationWorkId(invocation);
290
+ }
291
+ function inferCollaborationRecordId(invocation) {
292
+ return invocation.collaborationRecordId
293
+ ?? stringMetadata(invocation.metadata, "collaborationRecordId")
294
+ ?? stringMetadata(invocation.context, "collaborationRecordId")
295
+ ?? stringMetadata(metadataObject(invocation.context, "collaboration"), "recordId");
296
+ }
297
+ function inferCollaborationWorkId(invocation) {
298
+ const collaboration = metadataObject(invocation.context, "collaboration");
299
+ const collaborationKind = stringMetadata(invocation.metadata, "collaborationRecordKind")
300
+ ?? stringMetadata(invocation.context, "collaborationRecordKind")
301
+ ?? stringMetadata(collaboration, "kind")
302
+ ?? stringMetadata(collaboration, "recordKind");
303
+ if (collaborationKind !== "work_item") {
304
+ return undefined;
305
+ }
306
+ return invocation.collaborationRecordId
307
+ ?? stringMetadata(invocation.metadata, "collaborationRecordId")
308
+ ?? stringMetadata(invocation.context, "collaborationRecordId")
309
+ ?? stringMetadata(collaboration, "recordId");
310
+ }
311
+ function terminalReason(flight, state) {
312
+ if (!flight || (state !== "failed" && state !== "cancelled")) {
313
+ return undefined;
314
+ }
315
+ return trimString(flight.error) ?? trimString(flight.summary);
316
+ }
317
+ function isBlockingReviewState(state) {
318
+ return state === "needed" || state === "blocked";
319
+ }
320
+ function isAgentRunState(value) {
321
+ return typeof value === "string" && AGENT_RUN_STATES.includes(value);
322
+ }
323
+ function isAgentRunSource(value) {
324
+ return typeof value === "string" && AGENT_RUN_SOURCES.includes(value);
325
+ }
326
+ function isAgentRunReviewState(value) {
327
+ return typeof value === "string" && AGENT_RUN_REVIEW_STATES.includes(value);
328
+ }
329
+ function metadataObject(metadata, key) {
330
+ const value = metadata?.[key];
331
+ return value && typeof value === "object" && !Array.isArray(value) ? value : undefined;
332
+ }
333
+ function stringMetadata(metadata, key) {
334
+ const value = metadata?.[key];
335
+ return trimString(typeof value === "string" ? value : undefined);
336
+ }
337
+ function numberMetadata(metadata, key) {
338
+ const value = metadata?.[key];
339
+ return typeof value === "number" && Number.isFinite(value) ? value : undefined;
340
+ }
341
+ function booleanMetadata(metadata, key) {
342
+ return metadata?.[key] === true;
343
+ }
344
+ function metadataIdList(metadata, key) {
345
+ const value = metadata?.[key];
346
+ if (Array.isArray(value)) {
347
+ return value
348
+ .map((item) => trimString(typeof item === "string" ? item : undefined))
349
+ .filter((item) => Boolean(item));
350
+ }
351
+ const single = trimString(typeof value === "string" ? value : undefined);
352
+ return single ? [single] : [];
353
+ }
354
+ function uniqueIds(ids) {
355
+ return [...new Set(ids.map((id) => id.trim()).filter(Boolean))];
356
+ }
357
+ function trimString(value) {
358
+ const trimmed = value?.trim();
359
+ return trimmed ? trimmed : undefined;
360
+ }
361
+ function addOptional(target, key, value) {
362
+ if (value !== undefined) {
363
+ target[key] = value;
364
+ }
365
+ }
@@ -0,0 +1,205 @@
1
+ /**
2
+ * Assigned roles: small explicit duties with hooks and allowed actions.
3
+ *
4
+ * Not agentClass, harness, or identity. No assignment → no hooks → no mission log.
5
+ * First role: orchestrator (mission spine + cheap mission log).
6
+ *
7
+ * See docs/proposals/assigned-roles-and-mission-log.md
8
+ */
9
+ import type { MetadataMap, ScoutId } from "./common.js";
10
+ export declare const SCOUT_ROLE_HOOK_IDS: readonly ["mission.started", "turn.ended", "delegation.created", "child.updated", "waiting.entered", "mission.heartbeat", "mission.finished"];
11
+ export type ScoutRoleHookId = (typeof SCOUT_ROLE_HOOK_IDS)[number];
12
+ /**
13
+ * Scout-side lifecycle moments (broker fires these; role definitions bind actions).
14
+ * Distinct from optional soft "hooks" the agent may also honor.
15
+ */
16
+ export declare const SCOUT_ROLE_LIFECYCLE_EVENT_IDS: readonly ["ask.completed", "ask.failed", "work.completed"];
17
+ export type ScoutRoleLifecycleEventId = (typeof SCOUT_ROLE_LIFECYCLE_EVENT_IDS)[number];
18
+ /** Who must hold the role for a lifecycle binding to run. */
19
+ export type ScoutRoleLifecycleWhen = "target" | "requester" | "either";
20
+ export declare const SCOUT_MISSION_LOG_APPEND: "mission_log.append";
21
+ export declare const SCOUT_WORK_CHILD_LINK: "work.child_link";
22
+ export declare const SCOUT_WORK_SET_NEXT_MOVE: "work.set_next_move";
23
+ export declare const SCOUT_ROLE_ACTION_IDS: readonly ["mission_log.append", "work.child_link", "work.set_next_move"];
24
+ /** Closed set for catalog authoring; open only at untrusted boundaries if needed. */
25
+ export type ScoutRoleActionId = (typeof SCOUT_ROLE_ACTION_IDS)[number];
26
+ /**
27
+ * Role-owned function at a lifecycle moment.
28
+ * Example: orchestrator → on ask.completed → mission_log.append (post_ask_summary).
29
+ */
30
+ export interface ScoutRoleLifecycleBinding {
31
+ on: ScoutRoleLifecycleEventId;
32
+ action: ScoutRoleActionId;
33
+ when: ScoutRoleLifecycleWhen;
34
+ /**
35
+ * Stable function id for logs/telemetry (role-defined name of the behavior).
36
+ * e.g. post_ask_summary, post_work_summary
37
+ */
38
+ functionId: string;
39
+ }
40
+ export declare const SCOUT_ORCHESTRATOR_ROLE_ID: "orchestrator";
41
+ /** Built-in role ids. Future roles append here and stay closed in the catalog. */
42
+ export type ScoutBuiltinRoleId = typeof SCOUT_ORCHESTRATOR_ROLE_ID;
43
+ /** Role id on definitions/assignments; catalog rows use built-ins. */
44
+ export type ScoutRoleId = ScoutBuiltinRoleId | (string & {});
45
+ export interface ScoutRoleDefinition {
46
+ id: ScoutRoleId;
47
+ label: string;
48
+ summary: string;
49
+ hooks: readonly ScoutRoleHookId[];
50
+ actions: readonly ScoutRoleActionId[];
51
+ /**
52
+ * Scout-enforced lifecycle functions for this role.
53
+ * Fired by the broker at ask/work boundaries — not agent-loaded hooks.
54
+ */
55
+ lifecycle?: readonly ScoutRoleLifecycleBinding[];
56
+ }
57
+ /** Orchestrator lifecycle: auto post-ask / post-work summary into mission log. */
58
+ export declare const SCOUT_ORCHESTRATOR_LIFECYCLE: readonly ScoutRoleLifecycleBinding[];
59
+ export declare const SCOUT_ORCHESTRATOR_ROLE: ScoutRoleDefinition;
60
+ /** Built-in catalog. Future roles (qa, sre, reviewer) append here. */
61
+ export declare const SCOUT_ROLE_CATALOG: readonly ScoutRoleDefinition[];
62
+ /**
63
+ * Mission scope uses a work-item id in v0 (campaign root).
64
+ * Agent scope is a standing duty on that agent.
65
+ * Project scope is reserved for Slice 1+ (requires projectRoot in context).
66
+ */
67
+ export type ScoutRoleAssignmentScope = {
68
+ kind: "mission";
69
+ missionId: ScoutId;
70
+ } | {
71
+ kind: "agent";
72
+ } | {
73
+ kind: "project";
74
+ projectRoot: string;
75
+ };
76
+ export interface ScoutRoleAssignment {
77
+ id: ScoutId;
78
+ roleId: ScoutRoleId;
79
+ agentId: ScoutId;
80
+ scope: ScoutRoleAssignmentScope;
81
+ assignedById: ScoutId;
82
+ assignedAt: number;
83
+ active: boolean;
84
+ revokedAt?: number;
85
+ revokedById?: ScoutId;
86
+ metadata?: MetadataMap;
87
+ }
88
+ /** Context used to decide whether an assignment applies. */
89
+ export interface ScoutRoleScopeContext {
90
+ missionId?: ScoutId;
91
+ projectRoot?: string;
92
+ }
93
+ export declare const SCOUT_MISSION_LOG_KINDS: readonly ["heartbeat", "progress", "delegation", "waiting", "decision", "risk", "integration", "done", "failed"];
94
+ export type ScoutMissionLogKind = (typeof SCOUT_MISSION_LOG_KINDS)[number];
95
+ /** Soft limits for writers, tool schemas, and prompts — single source of truth. */
96
+ export declare const SCOUT_MISSION_LOG_LIMITS: {
97
+ readonly intentMaxWords: 16;
98
+ /** Short current-action line (field name: `status`, not `now`). */
99
+ readonly statusMaxWords: 24;
100
+ readonly noteMaxChars: 240;
101
+ };
102
+ export interface ScoutMissionLogBlocker {
103
+ label: string;
104
+ ownerId?: ScoutId;
105
+ metadata?: MetadataMap;
106
+ }
107
+ export interface ScoutMissionLogRefs {
108
+ messageId?: ScoutId;
109
+ flightId?: ScoutId;
110
+ workId?: ScoutId;
111
+ sessionId?: ScoutId;
112
+ invocationId?: ScoutId;
113
+ }
114
+ /**
115
+ * Cheap structured entry written by an assigned orchestrator (or other role
116
+ * that lists mission_log.append). Prefer short intent/status; optional note max
117
+ * one sentence when truly useful.
118
+ *
119
+ * v0 persistence may map only a subset into work.progress + collaboration_events
120
+ * (lossy). Full fidelity wants an append-only log store in Slice 2+.
121
+ */
122
+ export interface ScoutMissionLogEntry {
123
+ id: ScoutId;
124
+ /** Work-item id of the campaign root (v0). */
125
+ missionId: ScoutId;
126
+ /** Child work / flight node when the entry is about a branch. */
127
+ nodeId?: ScoutId;
128
+ at: number;
129
+ /** Per-mission monotonic order; avoids same-ms collisions in UI. */
130
+ seq?: number;
131
+ actorId: ScoutId;
132
+ kind: ScoutMissionLogKind;
133
+ /** Stable goal for this node (keep short). */
134
+ intent: string;
135
+ /** Current action / state (keep short). Not a timestamp. */
136
+ status: string;
137
+ checkpoint?: string;
138
+ blockers?: ScoutMissionLogBlocker[];
139
+ refs?: ScoutMissionLogRefs;
140
+ note?: string;
141
+ metadata?: MetadataMap;
142
+ }
143
+ export interface ScoutMissionLogAppendInput {
144
+ missionId: ScoutId;
145
+ nodeId?: ScoutId;
146
+ actorId: ScoutId;
147
+ kind: ScoutMissionLogKind;
148
+ intent: string;
149
+ status: string;
150
+ checkpoint?: string;
151
+ blockers?: ScoutMissionLogBlocker[];
152
+ refs?: ScoutMissionLogRefs;
153
+ note?: string;
154
+ metadata?: MetadataMap;
155
+ /** Caller-supplied id; store may assign if omitted. */
156
+ id?: ScoutId;
157
+ at?: number;
158
+ seq?: number;
159
+ }
160
+ export declare function scoutRoleDefinition(roleId: string, catalog?: readonly ScoutRoleDefinition[]): ScoutRoleDefinition | undefined;
161
+ export declare function isScoutRoleHookId(value: string): value is ScoutRoleHookId;
162
+ export declare function isScoutMissionLogKind(value: string): value is ScoutMissionLogKind;
163
+ export declare function assignmentAppliesTo(assignment: ScoutRoleAssignment, ctx: ScoutRoleScopeContext): boolean;
164
+ export declare function activeScoutRoleAssignments(assignments: readonly ScoutRoleAssignment[]): ScoutRoleAssignment[];
165
+ export declare function scoutRoleAssignmentsForAgent(assignments: readonly ScoutRoleAssignment[], agentId: string, opts?: {
166
+ activeOnly?: boolean;
167
+ }): ScoutRoleAssignment[];
168
+ export declare function scoutRoleAssignmentsForMission(assignments: readonly ScoutRoleAssignment[], missionId: string, opts?: {
169
+ activeOnly?: boolean;
170
+ roleId?: string;
171
+ /** Include standing agent-scope assignments (default true for "who covers this mission"). */
172
+ includeStanding?: boolean;
173
+ }): ScoutRoleAssignment[];
174
+ /** Distinct agent ids holding an active role for a mission (incl. standing if enabled). */
175
+ export declare function activeRoleHoldersForMission(assignments: readonly ScoutRoleAssignment[], missionId: string, roleId: string, opts?: {
176
+ includeStanding?: boolean;
177
+ }): ScoutId[];
178
+ /**
179
+ * True when this agent may write the mission log for a mission under the
180
+ * anti-spam rules: active assignment whose definition includes mission_log.append
181
+ * and whose scope applies to the mission (or standing agent-scope).
182
+ */
183
+ export declare function agentMayWriteMissionLog(opts: {
184
+ agentId: string;
185
+ missionId: string;
186
+ assignments: readonly ScoutRoleAssignment[];
187
+ catalog?: readonly ScoutRoleDefinition[];
188
+ projectRoot?: string;
189
+ }): boolean;
190
+ export declare function roleDefinitionAllowsHook(definition: ScoutRoleDefinition, hookId: ScoutRoleHookId): boolean;
191
+ export declare function assignmentsMatchingHook(opts: {
192
+ hookId: ScoutRoleHookId;
193
+ assignments: readonly ScoutRoleAssignment[];
194
+ context?: ScoutRoleScopeContext;
195
+ catalog?: readonly ScoutRoleDefinition[];
196
+ }): ScoutRoleAssignment[];
197
+ export type MissionLogEntryValidation = {
198
+ ok: true;
199
+ } | {
200
+ ok: false;
201
+ errors: string[];
202
+ };
203
+ /** Soft structural validation for writers and tests (untrusted tool args). */
204
+ export declare function validateMissionLogEntryFields(input: Pick<ScoutMissionLogAppendInput, "intent" | "status" | "note" | "kind">): MissionLogEntryValidation;
205
+ //# sourceMappingURL=assigned-roles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assigned-roles.d.ts","sourceRoot":"","sources":["../src/assigned-roles.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAIxD,eAAO,MAAM,mBAAmB,+IAQtB,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEnE;;;GAGG;AACH,eAAO,MAAM,8BAA8B,4DAIjC,CAAC;AAEX,MAAM,MAAM,yBAAyB,GAAG,CAAC,OAAO,8BAA8B,CAAC,CAAC,MAAM,CAAC,CAAC;AAExF,6DAA6D;AAC7D,MAAM,MAAM,sBAAsB,GAAG,QAAQ,GAAG,WAAW,GAAG,QAAQ,CAAC;AAIvE,eAAO,MAAM,wBAAwB,EAAG,oBAA6B,CAAC;AACtE,eAAO,MAAM,qBAAqB,EAAG,iBAA0B,CAAC;AAChE,eAAO,MAAM,wBAAwB,EAAG,oBAA6B,CAAC;AAEtE,eAAO,MAAM,qBAAqB,0E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