@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,249 @@
1
+ import { parseAgentIdentity } from "./agent-identity.js";
2
+ import { AGENT_HARNESSES, type AgentHarness } from "./actors.js";
3
+ import type { ScoutRouteTarget } from "./scout-dispatch.js";
4
+
5
+ export const SCOUT_COMPOSER_ROUTE_OPERATOR = ">>" as const;
6
+ export const SCOUT_TARGET_HANDLE_SHORTHAND = "⌖" as const;
7
+
8
+ export type ScoutComposerRouteDiagnosticCode =
9
+ | "missing_target"
10
+ | "invalid_target";
11
+
12
+ export interface ScoutComposerRouteDiagnostic {
13
+ code: ScoutComposerRouteDiagnosticCode;
14
+ message: string;
15
+ start: number;
16
+ end: number;
17
+ }
18
+
19
+ export interface ScoutComposerRoute {
20
+ operator: typeof SCOUT_COMPOSER_ROUTE_OPERATOR;
21
+ token: string;
22
+ target: ScoutRouteTarget;
23
+ operatorStart: number;
24
+ operatorEnd: number;
25
+ targetStart: number;
26
+ targetEnd: number;
27
+ }
28
+
29
+ export interface ScoutComposerRouteParseResult {
30
+ route: ScoutComposerRoute | null;
31
+ body: string;
32
+ diagnostics: ScoutComposerRouteDiagnostic[];
33
+ }
34
+
35
+ const WHITESPACE_PATTERN = /\s/;
36
+ const TRAILING_TARGET_PUNCTUATION_PATTERN = /[.,!?;)\]}]+$/;
37
+ const ROUTE_VALUE_PATTERN = /^\S+$/;
38
+ const AGENT_LABEL_START_PATTERN = /^[A-Za-z0-9]/;
39
+ const SESSION_ROUTE_HARNESSES = new Set<AgentHarness>(AGENT_HARNESSES);
40
+
41
+ function findRouteOperator(input: string): { start: number; end: number } | null {
42
+ let searchFrom = 0;
43
+
44
+ while (searchFrom < input.length) {
45
+ const index = input.indexOf(SCOUT_COMPOSER_ROUTE_OPERATOR, searchFrom);
46
+ if (index === -1) {
47
+ return null;
48
+ }
49
+
50
+ const previous = index > 0 ? input[index - 1] : "";
51
+ if (index === 0 || WHITESPACE_PATTERN.test(previous)) {
52
+ return {
53
+ start: index,
54
+ end: index + SCOUT_COMPOSER_ROUTE_OPERATOR.length,
55
+ };
56
+ }
57
+
58
+ searchFrom = index + SCOUT_COMPOSER_ROUTE_OPERATOR.length;
59
+ }
60
+
61
+ return null;
62
+ }
63
+
64
+ function routeBodyWithoutTarget(input: string, start: number, end: number): string {
65
+ return `${input.slice(0, start)} ${input.slice(end)}`.replace(/\s+/g, " ").trim();
66
+ }
67
+
68
+ function trimRouteTargetToken(value: string): string {
69
+ return value
70
+ .trim()
71
+ .replace(TRAILING_TARGET_PUNCTUATION_PATTERN, "");
72
+ }
73
+
74
+ function isRouteValue(value: string): boolean {
75
+ return value.length > 0 && ROUTE_VALUE_PATTERN.test(value);
76
+ }
77
+
78
+ function parseAgentLabelTarget(value: string): ScoutRouteTarget | null {
79
+ const label = value.replace(/^@+/, "");
80
+ if (!AGENT_LABEL_START_PATTERN.test(label)) {
81
+ return null;
82
+ }
83
+ if (!parseAgentIdentity(label)) {
84
+ return null;
85
+ }
86
+ return { kind: "agent_label", label, value };
87
+ }
88
+
89
+ function parseTargetHandleTarget(rawValue: string): ScoutRouteTarget | null {
90
+ const handle = rawValue.replace(/^[@⌖]+/, "");
91
+ if (!isRouteValue(handle)) {
92
+ return null;
93
+ }
94
+ return { kind: "target_handle", handle, value: `target:${handle}` };
95
+ }
96
+
97
+ function parseRouteAliasTarget(rawValue: string): ScoutRouteTarget | null {
98
+ const alias = rawValue.replace(/^@+/, "").trim().toLowerCase();
99
+ if (!isRouteValue(alias)) return null;
100
+ return { kind: "route_alias", alias, value: `alias:${alias}` };
101
+ }
102
+
103
+ function parseSessionRouteTarget(rawValue: string): ScoutRouteTarget | null {
104
+ const value = rawValue.replace(/^@+/, "");
105
+ if (!isRouteValue(value)) {
106
+ return null;
107
+ }
108
+
109
+ const harnessSeparator = value.indexOf(":");
110
+ if (harnessSeparator > 0) {
111
+ const maybeHarness = value.slice(0, harnessSeparator) as AgentHarness;
112
+ const sessionId = value.slice(harnessSeparator + 1);
113
+ if (SESSION_ROUTE_HARNESSES.has(maybeHarness) && isRouteValue(sessionId)) {
114
+ return {
115
+ kind: "session_id",
116
+ sessionId,
117
+ harness: maybeHarness,
118
+ value: `session:${maybeHarness}:${sessionId}`,
119
+ };
120
+ }
121
+ }
122
+
123
+ return { kind: "session_id", sessionId: value, value: `session:${value}` };
124
+ }
125
+
126
+ function parsePrefixedRouteTarget(prefix: string, rawValue: string): ScoutRouteTarget | null {
127
+ const value = rawValue.replace(/^@+/, "");
128
+ if (!isRouteValue(value)) {
129
+ return null;
130
+ }
131
+
132
+ if (prefix === "agent" || prefix === "a") {
133
+ return parseAgentLabelTarget(value);
134
+ }
135
+ if (prefix === "alias" || prefix === "route-alias" || prefix === "route_alias") {
136
+ return parseRouteAliasTarget(rawValue);
137
+ }
138
+ if (prefix === "target" || prefix === "target-handle" || prefix === "target_handle") {
139
+ return parseTargetHandleTarget(rawValue);
140
+ }
141
+ if (prefix === "ref" || prefix === "binding" || prefix === "binding-ref") {
142
+ return { kind: "binding_ref", ref: value, value: `ref:${value}` };
143
+ }
144
+ if (prefix === "project" || prefix === "project-path" || prefix === "project_path") {
145
+ return { kind: "project_path", projectPath: value, value: `project:${value}` };
146
+ }
147
+ if (prefix === "id" || prefix === "agent-id" || prefix === "agent_id") {
148
+ return { kind: "agent_id", agentId: value, value: `id:${value}` };
149
+ }
150
+ if (prefix === "session" || prefix === "session-id" || prefix === "session_id" || prefix === "sid" || prefix === "s") {
151
+ return parseSessionRouteTarget(rawValue);
152
+ }
153
+ if (prefix === "channel" || prefix === "chan" || prefix === "ch") {
154
+ return { kind: "channel", channel: value, value: `channel:${value}` };
155
+ }
156
+
157
+ return null;
158
+ }
159
+
160
+ export function parseScoutComposerRouteTarget(value: string): ScoutRouteTarget | null {
161
+ const token = trimRouteTargetToken(value);
162
+ if (!isRouteValue(token)) {
163
+ return null;
164
+ }
165
+
166
+ if (token === "broadcast") {
167
+ return { kind: "broadcast", value: token };
168
+ }
169
+
170
+ if (token.startsWith(SCOUT_TARGET_HANDLE_SHORTHAND)) {
171
+ return parseTargetHandleTarget(token);
172
+ }
173
+
174
+ const separatorIndex = token.indexOf(":");
175
+ if (separatorIndex > 0) {
176
+ const prefix = token.slice(0, separatorIndex).toLowerCase();
177
+ const rawValue = token.slice(separatorIndex + 1);
178
+ const prefixed = parsePrefixedRouteTarget(prefix, rawValue);
179
+ if (prefixed) {
180
+ return prefixed;
181
+ }
182
+ }
183
+
184
+ return parseAgentLabelTarget(token);
185
+ }
186
+
187
+ export function parseScoutComposerRoute(input: string): ScoutComposerRouteParseResult {
188
+ const operator = findRouteOperator(input);
189
+ if (!operator) {
190
+ return {
191
+ route: null,
192
+ body: input.trim(),
193
+ diagnostics: [],
194
+ };
195
+ }
196
+
197
+ let targetStart = operator.end;
198
+ while (targetStart < input.length && WHITESPACE_PATTERN.test(input[targetStart] ?? "")) {
199
+ targetStart += 1;
200
+ }
201
+
202
+ if (targetStart >= input.length) {
203
+ return {
204
+ route: null,
205
+ body: routeBodyWithoutTarget(input, operator.start, operator.end),
206
+ diagnostics: [{
207
+ code: "missing_target",
208
+ message: "route operator requires a target after >>",
209
+ start: operator.start,
210
+ end: operator.end,
211
+ }],
212
+ };
213
+ }
214
+
215
+ let targetEnd = targetStart;
216
+ while (targetEnd < input.length && !WHITESPACE_PATTERN.test(input[targetEnd] ?? "")) {
217
+ targetEnd += 1;
218
+ }
219
+
220
+ const rawToken = input.slice(targetStart, targetEnd);
221
+ const token = trimRouteTargetToken(rawToken);
222
+ const target = parseScoutComposerRouteTarget(token);
223
+ if (!target) {
224
+ return {
225
+ route: null,
226
+ body: routeBodyWithoutTarget(input, operator.start, targetEnd),
227
+ diagnostics: [{
228
+ code: "invalid_target",
229
+ message: `invalid route target: ${rawToken}`,
230
+ start: targetStart,
231
+ end: targetEnd,
232
+ }],
233
+ };
234
+ }
235
+
236
+ return {
237
+ route: {
238
+ operator: SCOUT_COMPOSER_ROUTE_OPERATOR,
239
+ token,
240
+ target,
241
+ operatorStart: operator.start,
242
+ operatorEnd: operator.end,
243
+ targetStart,
244
+ targetEnd,
245
+ },
246
+ body: routeBodyWithoutTarget(input, operator.start, targetEnd),
247
+ diagnostics: [],
248
+ };
249
+ }
@@ -1,23 +1,93 @@
1
1
  import type { ConversationDefinition } from "./conversations.js";
2
2
  import type { MetadataMap, ScoutId } from "./common.js";
3
+ import type {
4
+ CollaborationAcceptanceState,
5
+ CollaborationPriority,
6
+ WorkItemRecord,
7
+ } from "./collaboration.js";
3
8
  import type { FlightRecord, InvocationExecutionPreference } from "./invocations.js";
4
- import type { MessageRecord } from "./messages.js";
9
+ import type { MessageAttachment, MessageRecord } from "./messages.js";
5
10
  import type {
6
11
  ScoutCallerContext,
7
12
  ScoutDispatchRecord,
8
13
  ScoutRoutePolicy,
9
14
  ScoutRouteTarget,
10
15
  } from "./scout-dispatch.js";
16
+ import type { RouteAliasResolutionProof } from "./route-aliases.js";
17
+ import type {
18
+ ScoutExecutionResolution,
19
+ ScoutRuntimeResolutionSource,
20
+ } from "./runtime-execution.js";
11
21
 
12
22
  export type ScoutDeliverIntent = "tell" | "consult";
13
23
 
24
+ export type ScoutOperatorSignalKind = "notify" | "consult" | "need";
25
+
26
+ /**
27
+ * An agent-authored signal for its human operator.
28
+ *
29
+ * The three kinds are separated by what the agent does next, which is the only
30
+ * distinction the operator actually acts on:
31
+ *
32
+ * notify — FYI. The agent keeps going and expects nothing back.
33
+ * consult — input would help, and the agent has already decided what it will
34
+ * do without it (`defaultAction`). Silence is a valid answer.
35
+ * need — the agent cannot proceed. Silence is NOT an answer, so this is
36
+ * the only kind that is blocking, and the only one that raises the
37
+ * operator's needs-you surface.
38
+ *
39
+ * `notify` and `consult` stay conversational side effects: they never create a
40
+ * flight and never imply the agent is waiting. `need` is the exception on
41
+ * purpose — it is the agent declaring that the next move is yours.
42
+ *
43
+ * This is the declared counterpart to harness-level attention inference. An
44
+ * inferred stall says "something looks stuck"; a `need` says "here is exactly
45
+ * what I want from you", authored by the agent, and cannot be created without
46
+ * a question (enforced at the CLI boundary, not filtered downstream).
47
+ */
48
+ export type ScoutOperatorSignal =
49
+ | {
50
+ kind: "notify";
51
+ blocking: false;
52
+ replyExpectation: "none";
53
+ }
54
+ | {
55
+ kind: "consult";
56
+ blocking: false;
57
+ replyExpectation: "optional";
58
+ defaultAction: string;
59
+ }
60
+ | {
61
+ kind: "need";
62
+ blocking: true;
63
+ replyExpectation: "required";
64
+ /** What the agent is asking for. Never empty — that is the whole point. */
65
+ question: string;
66
+ /** Optional discrete choices, when the answer is a selection. */
67
+ options?: string[];
68
+ /** Why the agent cannot continue without it. */
69
+ blockedReason?: string;
70
+ };
71
+
14
72
  export type ScoutDeliverRouteKind = "dm" | "channel" | "broadcast";
15
73
 
74
+ export type ScoutProjectAgentPersistence = "one_time" | "sticky";
75
+
76
+ export interface ScoutProjectAgentSpec {
77
+ persistence?: ScoutProjectAgentPersistence;
78
+ /** Human-addressable handle, without requiring the caller to include "@". */
79
+ handle?: string;
80
+ }
81
+
16
82
  export type ScoutDeliveryRemediationKind =
17
83
  | "choose_target"
18
84
  | "register_target"
19
85
  | "wake_target"
20
- | "retry_later";
86
+ | "retry_later"
87
+ | "use_current_registration"
88
+ | "session_reference_not_attachable"
89
+ /** @deprecated use use_current_registration or session_reference_not_attachable */
90
+ | "stale_reference";
21
91
 
22
92
  export type ScoutDeliverRejectReason =
23
93
  | "unknown_target"
@@ -31,20 +101,37 @@ export interface ScoutDeliverRequest {
31
101
  requesterId?: ScoutId;
32
102
  requesterNodeId?: ScoutId;
33
103
  body: string;
104
+ attachments?: MessageAttachment[];
34
105
  intent: ScoutDeliverIntent;
35
106
  target?: ScoutRouteTarget;
36
107
  targetLabel?: string;
37
108
  targetAgentId?: ScoutId;
109
+ targetSessionId?: ScoutId;
38
110
  routePolicy?: ScoutRoutePolicy;
39
111
  channel?: string;
40
112
  replyToMessageId?: ScoutId;
113
+ replyToSessionId?: ScoutId;
41
114
  speechText?: string;
42
115
  ensureAwake?: boolean;
43
116
  execution?: InvocationExecutionPreference;
117
+ executionSource?: Partial<Record<"harness" | "model" | "reasoningEffort", ScoutRuntimeResolutionSource>>;
118
+ projectAgent?: ScoutProjectAgentSpec;
119
+ labels?: string[];
44
120
  createdAt?: number;
45
121
  collaborationRecordId?: ScoutId;
122
+ workItem?: {
123
+ id?: ScoutId;
124
+ title: string;
125
+ summary?: string;
126
+ priority?: CollaborationPriority;
127
+ labels?: string[];
128
+ parentId?: ScoutId;
129
+ acceptanceState?: CollaborationAcceptanceState;
130
+ metadata?: MetadataMap;
131
+ };
46
132
  messageMetadata?: MetadataMap;
47
133
  invocationMetadata?: MetadataMap;
134
+ operatorSignal?: ScoutOperatorSignal;
48
135
  }
49
136
 
50
137
  export interface ScoutDeliveryReceipt {
@@ -53,11 +140,18 @@ export interface ScoutDeliveryReceipt {
53
140
  requesterId: ScoutId;
54
141
  requesterNodeId: ScoutId;
55
142
  targetAgentId?: ScoutId;
143
+ targetSessionId?: ScoutId;
56
144
  targetLabel?: string;
145
+ /** Provisional routable pointer (e.g. project-chopin) when target is cardless. */
146
+ sessionAlias?: string;
147
+ bindingRef?: string;
57
148
  conversationId: ScoutId;
58
149
  messageId: ScoutId;
59
150
  flightId?: ScoutId;
151
+ /** Per-dimension requested/resolved launch truth available at acceptance. */
152
+ executionResolution?: ScoutExecutionResolution;
60
153
  acceptedAt: number;
154
+ aliasResolution?: RouteAliasResolutionProof;
61
155
  }
62
156
 
63
157
  export interface ScoutDeliveryRemediationAction {
@@ -76,16 +170,35 @@ export interface ScoutDeliverAcceptedResponse {
76
170
  conversation: ConversationDefinition;
77
171
  message: MessageRecord;
78
172
  targetAgentId?: ScoutId;
173
+ targetSessionId?: ScoutId;
174
+ sessionAlias?: string;
175
+ bindingRef?: string;
176
+ aliasResolution?: RouteAliasResolutionProof;
79
177
  flight?: FlightRecord;
178
+ workItem?: WorkItemRecord;
80
179
  }
81
180
 
82
- export interface ScoutDeliverQuestionResponse {
181
+ /**
182
+ * A routing clarification: delivery was not accepted and the caller is asked to
183
+ * clarify or re-route the carried {@link ScoutDispatchRecord}. This is unrelated to
184
+ * the collaboration `question` kind ({@link QuestionRecord}) — the `question` field
185
+ * here carries the dispatch, and the wire `kind` discriminant stays `"question"` for
186
+ * backward compatibility.
187
+ */
188
+ export interface ScoutDeliverClarificationResponse {
83
189
  kind: "question";
84
190
  accepted: false;
85
191
  question: ScoutDispatchRecord;
86
192
  remediation?: ScoutDeliveryRemediationAction;
87
193
  }
88
194
 
195
+ /**
196
+ * @deprecated Renamed to {@link ScoutDeliverClarificationResponse}. This routing
197
+ * clarification is distinct from the collaboration `question` kind. Retained as an
198
+ * alias for backward compatibility.
199
+ */
200
+ export type ScoutDeliverQuestionResponse = ScoutDeliverClarificationResponse;
201
+
89
202
  export interface ScoutDeliverRejectedResponse {
90
203
  kind: "rejected";
91
204
  accepted: false;
@@ -96,5 +209,5 @@ export interface ScoutDeliverRejectedResponse {
96
209
 
97
210
  export type ScoutDeliverResponse =
98
211
  | ScoutDeliverAcceptedResponse
99
- | ScoutDeliverQuestionResponse
212
+ | ScoutDeliverClarificationResponse
100
213
  | ScoutDeliverRejectedResponse;
@@ -1,11 +1,23 @@
1
- import type { WakePolicy } from "./actors.js";
1
+ import type { AgentHarness, WakePolicy } from "./actors.js";
2
2
  import type { AdvertiseScope, DeliveryTransport, MetadataMap, ScoutId } from "./common.js";
3
+ import type { RouteAliasDiagnosticCode, RouteAliasResolutionProof, RouteAliasScope } from "./route-aliases.js";
3
4
 
4
5
  export type ScoutDispatchKind = "ambiguous" | "unknown" | "unparseable" | "unavailable";
5
6
 
6
7
  export type ScoutCandidateEndpointState = "online" | "offline" | "unknown";
7
8
 
8
- export type ScoutRouteTargetKind = "agent_id" | "agent_label" | "channel" | "broadcast";
9
+ export type ScoutRouteTargetKind =
10
+ | "agent_id"
11
+ | "agent_label"
12
+ | "existing_handle"
13
+ | "runtime_profile"
14
+ | "route_alias"
15
+ | "target_handle"
16
+ | "session_id"
17
+ | "binding_ref"
18
+ | "project_path"
19
+ | "channel"
20
+ | "broadcast";
9
21
 
10
22
  export type ScoutRouteAmbiguousPolicy = "reject" | "ask";
11
23
 
@@ -21,18 +33,36 @@ export interface ScoutCallerContext {
21
33
  export type ScoutRouteTarget =
22
34
  | { kind: "agent_id"; agentId: ScoutId; value?: string }
23
35
  | { kind: "agent_label"; label: string; value?: string }
36
+ | { kind: "existing_handle"; handle: string; value?: string }
37
+ | {
38
+ kind: "runtime_profile";
39
+ profile: string;
40
+ projectPath: string;
41
+ reasoningEffort?: string;
42
+ value?: string;
43
+ }
44
+ | { kind: "route_alias"; alias: string; scope?: RouteAliasScope; bindingId?: ScoutId; value?: string }
45
+ | { kind: "target_handle"; handle: string; value?: string }
46
+ | { kind: "session_id"; sessionId: ScoutId; harness?: AgentHarness; value?: string }
47
+ | { kind: "binding_ref"; ref: string; value?: string }
48
+ | { kind: "project_path"; projectPath: string; value?: string }
24
49
  | { kind: "channel"; channel: string; value?: string }
25
50
  | { kind: "broadcast"; value?: string };
26
51
 
27
52
  export interface ScoutRoutePolicy {
28
53
  preferLocalNodeId?: ScoutId;
29
54
  ambiguous?: ScoutRouteAmbiguousPolicy;
55
+ allowHistoricalDirectId?: boolean;
56
+ /** @deprecated use allowHistoricalDirectId */
30
57
  allowStaleDirectId?: boolean;
31
58
  }
32
59
 
33
60
  export type ScoutDispatchUnavailableReason =
34
61
  | "manual_wake_required"
35
62
  | "retired"
63
+ | "superseded_registration"
64
+ | "session_reference_not_attachable"
65
+ /** @deprecated use superseded_registration or session_reference_not_attachable */
36
66
  | "stale_registration"
37
67
  | "unknown";
38
68
 
@@ -71,6 +101,8 @@ export interface ScoutDispatchEnvelope {
71
101
  target?: ScoutDispatchUnavailableTarget;
72
102
  dispatchedAt: number;
73
103
  dispatcherNodeId: ScoutId;
104
+ diagnosticCode?: RouteAliasDiagnosticCode;
105
+ aliasResolution?: RouteAliasResolutionProof;
74
106
  }
75
107
 
76
108
  export interface ScoutDispatchRecord extends ScoutDispatchEnvelope {
@@ -0,0 +1,15 @@
1
+ import type { ScoutId } from "./common.js";
2
+ import type { InvocationAction } from "./invocations.js";
3
+
4
+ export type ScoutReplyPath = "final_response" | "mcp_reply";
5
+
6
+ export interface ScoutReplyContext {
7
+ mode: "broker_reply";
8
+ fromAgentId: ScoutId;
9
+ toAgentId: ScoutId;
10
+ conversationId: ScoutId;
11
+ messageId: ScoutId;
12
+ replyToMessageId: ScoutId;
13
+ replyPath: ScoutReplyPath;
14
+ action?: InvocationAction;
15
+ }