@openscout/protocol 0.2.109 → 0.3.0

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 (101) hide show
  1. package/dist/actors.d.ts +1 -1
  2. package/dist/actors.d.ts.map +1 -1
  3. package/dist/agent-notifications.d.ts +137 -0
  4. package/dist/agent-notifications.d.ts.map +1 -0
  5. package/dist/agent-notifications.js +148 -0
  6. package/dist/channel-invites.d.ts +3 -1
  7. package/dist/channel-invites.d.ts.map +1 -1
  8. package/dist/channel-membership.d.ts +10 -0
  9. package/dist/channel-membership.d.ts.map +1 -0
  10. package/dist/channel-membership.js +16 -0
  11. package/dist/chat-mentions.d.ts +4 -0
  12. package/dist/chat-mentions.d.ts.map +1 -0
  13. package/dist/chat-mentions.js +11 -0
  14. package/dist/chat-message-corrections.d.ts +28 -0
  15. package/dist/chat-message-corrections.d.ts.map +1 -0
  16. package/dist/chat-message-corrections.js +46 -0
  17. package/dist/chat-pins.d.ts +14 -0
  18. package/dist/chat-pins.d.ts.map +1 -0
  19. package/dist/chat-pins.js +37 -0
  20. package/dist/common.d.ts +1 -1
  21. package/dist/common.d.ts.map +1 -1
  22. package/dist/events.d.ts +4 -1
  23. package/dist/events.d.ts.map +1 -1
  24. package/dist/herdr-workspace-digest.d.ts +8 -4
  25. package/dist/herdr-workspace-digest.d.ts.map +1 -1
  26. package/dist/herdr-workspace-digest.js +18 -3
  27. package/dist/host-integrations.js +6 -6
  28. package/dist/index.d.ts +6 -0
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +6 -0
  31. package/dist/invocations.d.ts +17 -2
  32. package/dist/invocations.d.ts.map +1 -1
  33. package/dist/invocations.js +1 -1
  34. package/dist/mcp-core-tools.d.ts +137 -0
  35. package/dist/mcp-core-tools.d.ts.map +1 -0
  36. package/dist/mcp-core-tools.js +27 -0
  37. package/dist/message-reactions.d.ts +5 -0
  38. package/dist/message-reactions.d.ts.map +1 -1
  39. package/dist/message-reactions.js +10 -1
  40. package/dist/orchestration-provider-map.d.ts.map +1 -1
  41. package/dist/orchestration-provider-map.js +9 -1
  42. package/dist/read-receipts.d.ts +38 -0
  43. package/dist/read-receipts.d.ts.map +1 -1
  44. package/dist/read-receipts.js +43 -1
  45. package/dist/runtime-catalog-contract.d.ts +14 -0
  46. package/dist/runtime-catalog-contract.d.ts.map +1 -1
  47. package/dist/runtime-catalog.d.ts.map +1 -1
  48. package/dist/runtime-catalog.generated.d.ts +88 -2
  49. package/dist/runtime-catalog.generated.d.ts.map +1 -1
  50. package/dist/runtime-catalog.generated.js +114 -12
  51. package/dist/runtime-catalog.js +28 -0
  52. package/dist/runtime-execution.d.ts +33 -2
  53. package/dist/runtime-execution.d.ts.map +1 -1
  54. package/dist/runtime-execution.js +34 -17
  55. package/dist/scout-agent-card.d.ts +2 -0
  56. package/dist/scout-agent-card.d.ts.map +1 -1
  57. package/dist/scout-agent-card.js +3 -0
  58. package/dist/scout-composer.d.ts.map +1 -1
  59. package/dist/scout-composer.js +23 -0
  60. package/dist/scout-delivery.d.ts +3 -1
  61. package/dist/scout-delivery.d.ts.map +1 -1
  62. package/dist/scout-dispatch.d.ts +13 -0
  63. package/dist/scout-dispatch.d.ts.map +1 -1
  64. package/dist/session-handle.d.ts +37 -0
  65. package/dist/session-handle.d.ts.map +1 -1
  66. package/dist/session-handle.js +58 -0
  67. package/dist/terminal-host-topology.d.ts +5 -2
  68. package/dist/terminal-host-topology.d.ts.map +1 -1
  69. package/dist/terminal-host-topology.js +2 -1
  70. package/dist/transports.d.ts +8 -1
  71. package/dist/transports.d.ts.map +1 -1
  72. package/package.json +4 -4
  73. package/src/actors.ts +2 -0
  74. package/src/agent-notifications.ts +241 -0
  75. package/src/channel-invites.ts +4 -1
  76. package/src/channel-membership.ts +22 -0
  77. package/src/chat-mentions.ts +11 -0
  78. package/src/chat-message-corrections.ts +40 -0
  79. package/src/chat-pins.ts +40 -0
  80. package/src/common.ts +2 -0
  81. package/src/events.ts +3 -0
  82. package/src/herdr-workspace-digest.ts +23 -6
  83. package/src/host-integrations.ts +6 -6
  84. package/src/index.ts +10 -0
  85. package/src/invocations.ts +18 -3
  86. package/src/mcp-core-tools.ts +46 -0
  87. package/src/message-reactions.ts +16 -2
  88. package/src/orchestration-provider-map.ts +12 -1
  89. package/src/read-receipts.ts +71 -0
  90. package/src/runtime-catalog-contract.ts +16 -0
  91. package/src/runtime-catalog.generated.ts +114 -12
  92. package/src/runtime-catalog.ts +32 -0
  93. package/src/runtime-catalog.v1.json +20 -13
  94. package/src/runtime-execution.ts +70 -16
  95. package/src/scout-agent-card.ts +5 -0
  96. package/src/scout-composer.ts +26 -0
  97. package/src/scout-delivery.ts +3 -1
  98. package/src/scout-dispatch.ts +13 -0
  99. package/src/session-handle.ts +88 -0
  100. package/src/terminal-host-topology.ts +5 -2
  101. package/src/transports.ts +9 -0
package/dist/actors.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { ActorKind, AdvertiseScope, AgentState, DeliveryTransport, MetadataMap, ScoutId } from "./common.js";
2
2
  export type AgentClass = "general" | "builder" | "reviewer" | "researcher" | "operator" | "bridge" | "system";
3
3
  export type AgentCapability = "chat" | "invoke" | "deliver" | "speak" | "listen" | "bridge" | "summarize" | "review" | "execute";
4
- export type AgentEndpointTransport = Extract<DeliveryTransport, "local_socket" | "http" | "websocket" | "pairing_bridge" | "claude_channel" | "claude_stream_json" | "codex_app_server" | "codex_exec" | "claude_resume" | "pi_rpc" | "grok_acp" | "kimi_acp" | "cursor_acp" | "opencode_acp" | "devin_acp" | "tmux" | "cursor_exec" | "cursor_cli_text" | "cursor_cli_stream_json" | "cursor_sdk_local">;
4
+ export type AgentEndpointTransport = Extract<DeliveryTransport, "local_socket" | "http" | "mcp_poll" | "devin_cloud_cli" | "websocket" | "pairing_bridge" | "claude_channel" | "claude_stream_json" | "codex_app_server" | "codex_exec" | "claude_resume" | "pi_rpc" | "grok_acp" | "kimi_acp" | "cursor_acp" | "opencode_acp" | "devin_acp" | "tmux" | "cursor_exec" | "cursor_cli_text" | "cursor_cli_stream_json" | "cursor_sdk_local">;
5
5
  export declare const AGENT_HARNESSES: readonly ["codex", "claude", "grok", "grok-acp", "kimi", "flue", "cursor", "opencode", "devin", "native", "worker", "bridge", "http", "pi"];
6
6
  export type AgentHarness = typeof AGENT_HARNESSES[number];
7
7
  export type WakePolicy = "manual" | "on_demand" | "keep_warm";
@@ -1 +1 @@
1
- {"version":3,"file":"actors.d.ts","sourceRoot":"","sources":["../src/actors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,cAAc,EACd,UAAU,EACV,iBAAiB,EACjB,WAAW,EACX,OAAO,EACR,MAAM,aAAa,CAAC;AAErB,MAAM,MAAM,UAAU,GAClB,SAAS,GACT,SAAS,GACT,UAAU,GACV,YAAY,GACZ,UAAU,GACV,QAAQ,GACR,QAAQ,CAAC;AAEb,MAAM,MAAM,eAAe,GACvB,MAAM,GACN,QAAQ,GACR,SAAS,GACT,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,WAAW,GACX,QAAQ,GACR,SAAS,CAAC;AAEd,MAAM,MAAM,sBAAsB,GAAG,OAAO,CAC1C,iBAAiB,EACf,cAAc,GACd,MAAM,GACN,WAAW,GACX,gBAAgB,GAChB,gBAAgB,GAChB,oBAAoB,GACpB,kBAAkB,GAClB,YAAY,GACZ,eAAe,GACf,QAAQ,GACR,UAAU,GACV,UAAU,GACV,YAAY,GACZ,cAAc,GACd,WAAW,GACX,MAAM,GACN,aAAa,GACb,iBAAiB,GACjB,wBAAwB,GACxB,kBAAkB,CACrB,CAAC;AAEF,eAAO,MAAM,eAAe,6IAelB,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;AAE1D,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,WAAW,GAAG,WAAW,CAAC;AAE9D,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,OAAO,CAAC;IACZ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
+ * the view that fits it.
4
+ *
5
+ * Every notification declares a `view` and the typed fields that view needs.
6
+ * The same record renders in three places: the lock screen (text only, via
7
+ * {@link collapseAgentNotification}), the long-press view, and the app's
8
+ * Notifications row. A client that doesn't know a `view` renders `text`.
9
+ *
10
+ * Everything that wants the operator is a question of some kind; the prefix
11
+ * says WHEN it was asked:
12
+ * - `turn.*` is mid-turn: the turn is paused until the operator answers.
13
+ * - `ask` is outside a turn: the agent finished and reached out on its own.
14
+ * Only declared things become notifications. Inferred attention never does.
15
+ *
16
+ * The record travels sealed (see the runtime's mobile-push sealing): the relay
17
+ * that delivers the push never reads any of it.
18
+ */
19
+ export declare const AGENT_NOTIFICATION_VERSION: 1;
20
+ export type AgentNotificationRisk = "low" | "medium" | "high";
21
+ export type AgentNotificationFileChange = {
22
+ path: string;
23
+ added: number;
24
+ removed: number;
25
+ };
26
+ export type AgentNotificationArtifact = {
27
+ kind: "pr" | "build" | "file" | "link";
28
+ label: string;
29
+ meta?: string;
30
+ url?: string;
31
+ };
32
+ export type AgentNotificationView = {
33
+ view: "turn.approve.command";
34
+ command: string;
35
+ cwd?: string;
36
+ risk: AgentNotificationRisk;
37
+ why?: string;
38
+ } | {
39
+ view: "turn.approve.edit";
40
+ summary?: string;
41
+ files: AgentNotificationFileChange[];
42
+ risk: AgentNotificationRisk;
43
+ } | {
44
+ view: "turn.approve.tool";
45
+ tool: string;
46
+ summary?: string;
47
+ risk: AgentNotificationRisk;
48
+ } | {
49
+ view: "turn.question.choice";
50
+ question: string;
51
+ context?: string;
52
+ options: string[];
53
+ multiSelect?: boolean;
54
+ } | {
55
+ view: "turn.question.open";
56
+ question: string;
57
+ context?: string;
58
+ } | {
59
+ view: "turn.failed";
60
+ error: string;
61
+ excerpt?: string[];
62
+ elapsed?: string;
63
+ } | {
64
+ view: "work.done";
65
+ summary: string;
66
+ artifacts?: AgentNotificationArtifact[];
67
+ } | {
68
+ view: "ask";
69
+ note: string;
70
+ options?: string[];
71
+ } | {
72
+ view: "text";
73
+ title: string;
74
+ body?: string;
75
+ };
76
+ export type AgentNotificationViewName = AgentNotificationView["view"];
77
+ export type AgentNotificationAction = "approve" | "deny" | "reply" | "open_chat" | "open_link";
78
+ export type AgentNotification = AgentNotificationView & {
79
+ v: typeof AGENT_NOTIFICATION_VERSION;
80
+ /** Stable id of the thing that wants attention (inbox item, message). */
81
+ itemId: string;
82
+ /** The agent, as the operator knows it. */
83
+ sender: {
84
+ name: string;
85
+ agentId?: string;
86
+ };
87
+ project?: string;
88
+ /** The Mac it happened on. */
89
+ host?: string;
90
+ /** Declared and still open: Time Sensitive on the lock screen, Priority in the app. */
91
+ urgent: boolean;
92
+ createdAt: number;
93
+ /** Routing back into the app. */
94
+ route?: {
95
+ sessionId?: string;
96
+ turnId?: string;
97
+ blockId?: string;
98
+ conversationId?: string;
99
+ messageId?: string;
100
+ };
101
+ };
102
+ export type AgentNotificationCollapse = {
103
+ /** Lock-screen title: the agent. */
104
+ title: string;
105
+ /** Lock-screen subtitle: project · host. */
106
+ subtitle: string;
107
+ /** Lock-screen body: headline, then the most useful line that fits as text. */
108
+ body: string;
109
+ /** Row headline in the app. Same words as line 1 of the body. */
110
+ headline: string;
111
+ /** iOS notification category, which carries the actions. */
112
+ category: string;
113
+ /** One thread per agent, so stacks group by who sent them. */
114
+ threadId: string;
115
+ };
116
+ /**
117
+ * What travels sealed in a push: the record plus its lock-screen text,
118
+ * computed once here so the phone's extension applies it verbatim and no
119
+ * client re-derives the words.
120
+ */
121
+ export type SealedAgentNotification = AgentNotification & {
122
+ lockScreen: Pick<AgentNotificationCollapse, "title" | "subtitle" | "body" | "category" | "threadId">;
123
+ };
124
+ export declare function sealedAgentNotification(n: AgentNotification): SealedAgentNotification;
125
+ export declare function agentNotificationHeadline(n: AgentNotification): string;
126
+ /** The actions a view offers, in order. The first is the primary one. */
127
+ export declare function agentNotificationActions(n: AgentNotification): AgentNotificationAction[];
128
+ /** iOS category ids. Registered by the app with their actions. */
129
+ export declare function agentNotificationCategory(n: AgentNotification): string;
130
+ export declare function collapseAgentNotification(n: AgentNotification): AgentNotificationCollapse;
131
+ /**
132
+ * Bound every free-text field so a sealed record fits inside one APNs push
133
+ * (4 KB, shared with the alert text). Lists are capped too; the app loads the
134
+ * full item when it opens.
135
+ */
136
+ export declare function clampAgentNotification(n: AgentNotification): AgentNotification;
137
+ //# sourceMappingURL=agent-notifications.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-notifications.d.ts","sourceRoot":"","sources":["../src/agent-notifications.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,eAAO,MAAM,0BAA0B,EAAG,CAAU,CAAC;AAErD,MAAM,MAAM,qBAAqB,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE9D,MAAM,MAAM,2BAA2B,GAAG;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,IAAI,EAAE,IAAI,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAC7B;IAAE,IAAI,EAAE,sBAAsB,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,qBAAqB,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAC1G;IAAE,IAAI,EAAE,mBAAmB,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,2BAA2B,EAAE,CAAC;IAAC,IAAI,EAAE,qBAAqB,CAAA;CAAE,GAClH;IAAE,IAAI,EAAE,mBAAmB,CAAC;I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,yBAAyB,CAAC,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAgBtE;AAED,wBAAgB,yBAAyB,CAAC,CAAC,EAAE,iBAAiB,GAAG,yBAAyB,CAYzF;AASD;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,iBAAiB,GAAG,iBAAiB,CA2B9E"}
@@ -0,0 +1,148 @@
1
+ /**
2
+ * Agent notifications: what an agent's notification IS, so the phone can pick
3
+ * the view that fits it.
4
+ *
5
+ * Every notification declares a `view` and the typed fields that view needs.
6
+ * The same record renders in three places: the lock screen (text only, via
7
+ * {@link collapseAgentNotification}), the long-press view, and the app's
8
+ * Notifications row. A client that doesn't know a `view` renders `text`.
9
+ *
10
+ * Everything that wants the operator is a question of some kind; the prefix
11
+ * says WHEN it was asked:
12
+ * - `turn.*` is mid-turn: the turn is paused until the operator answers.
13
+ * - `ask` is outside a turn: the agent finished and reached out on its own.
14
+ * Only declared things become notifications. Inferred attention never does.
15
+ *
16
+ * The record travels sealed (see the runtime's mobile-push sealing): the relay
17
+ * that delivers the push never reads any of it.
18
+ */
19
+ export const AGENT_NOTIFICATION_VERSION = 1;
20
+ export function sealedAgentNotification(n) {
21
+ const { title, subtitle, body, category, threadId } = collapseAgentNotification(n);
22
+ return { ...n, lockScreen: { title, subtitle, body, category, threadId } };
23
+ }
24
+ function riskLabel(risk) {
25
+ return risk === "high" ? "High risk" : risk === "medium" ? "Medium risk" : "Low risk";
26
+ }
27
+ function plural(count, one, many) {
28
+ return `${count} ${count === 1 ? one : many}`;
29
+ }
30
+ export function agentNotificationHeadline(n) {
31
+ switch (n.view) {
32
+ case "turn.approve.command": return "Wants to run a command";
33
+ case "turn.approve.edit": return `Wants to edit ${plural(n.files.length, "file", "files")}`;
34
+ case "turn.approve.tool": return `Wants to use ${n.tool}`;
35
+ case "turn.question.choice": return n.question;
36
+ case "turn.question.open": return n.question;
37
+ case "turn.failed": return `Turn failed: ${n.error}`;
38
+ case "work.done": return `Done: ${n.summary}`;
39
+ case "ask": return "Asked for you";
40
+ case "text": return n.title;
41
+ }
42
+ }
43
+ function detailLine(n) {
44
+ switch (n.view) {
45
+ case "turn.approve.command": return `${n.command} · ${riskLabel(n.risk)}`;
46
+ case "turn.approve.edit": {
47
+ const added = n.files.reduce((sum, f) => sum + f.added, 0);
48
+ const removed = n.files.reduce((sum, f) => sum + f.removed, 0);
49
+ const counts = `+${added} −${removed}`;
50
+ return n.summary ? `${counts} · ${n.summary}` : `${counts} · ${n.files.map((f) => f.path).join(", ")}`;
51
+ }
52
+ case "turn.approve.tool": return n.summary ? `${n.summary} · ${riskLabel(n.risk)}` : riskLabel(n.risk);
53
+ case "turn.question.choice": return n.options.join(" · ");
54
+ case "turn.question.open": return n.context ?? "";
55
+ case "turn.failed": return n.elapsed ? `After ${n.elapsed}. The session is still open.` : "The session is still open.";
56
+ case "work.done": return (n.artifacts ?? []).map((a) => a.meta ? `${a.label} ${a.meta}` : a.label).join(" · ");
57
+ case "ask": return n.note;
58
+ case "text": return n.body ?? "";
59
+ }
60
+ }
61
+ /** The actions a view offers, in order. The first is the primary one. */
62
+ export function agentNotificationActions(n) {
63
+ switch (n.view) {
64
+ case "turn.approve.command":
65
+ case "turn.approve.edit":
66
+ case "turn.approve.tool":
67
+ return ["approve", "deny"];
68
+ case "turn.question.choice":
69
+ case "turn.question.open":
70
+ case "ask":
71
+ return ["reply"];
72
+ case "turn.failed":
73
+ return ["open_chat"];
74
+ case "work.done":
75
+ return (n.artifacts ?? []).some((a) => a.url) ? ["open_link", "open_chat"] : ["open_chat"];
76
+ case "text":
77
+ return [];
78
+ }
79
+ }
80
+ /** iOS category ids. Registered by the app with their actions. */
81
+ export function agentNotificationCategory(n) {
82
+ switch (n.view) {
83
+ case "turn.approve.command":
84
+ case "turn.approve.edit":
85
+ case "turn.approve.tool":
86
+ return "scout.approval";
87
+ case "turn.question.choice":
88
+ case "turn.question.open":
89
+ case "ask":
90
+ return "scout.question";
91
+ case "turn.failed":
92
+ case "work.done":
93
+ return "scout.open";
94
+ case "text":
95
+ return "scout.text";
96
+ }
97
+ }
98
+ export function collapseAgentNotification(n) {
99
+ const headline = agentNotificationHeadline(n);
100
+ const line2 = detailLine(n).trim();
101
+ const where = [n.project, n.host].filter((part) => Boolean(part && part.trim())).join(" · ");
102
+ return {
103
+ title: n.sender.name,
104
+ subtitle: where,
105
+ body: line2 && line2 !== headline ? `${headline}\n${line2}` : headline,
106
+ headline,
107
+ category: agentNotificationCategory(n),
108
+ threadId: `scout.agent.${n.sender.agentId ?? n.sender.name}`,
109
+ };
110
+ }
111
+ const MAX_TEXT = 600;
112
+ function clip(value, max = MAX_TEXT) {
113
+ const trimmed = value.trim();
114
+ return trimmed.length <= max ? trimmed : `${trimmed.slice(0, max - 1)}…`;
115
+ }
116
+ /**
117
+ * Bound every free-text field so a sealed record fits inside one APNs push
118
+ * (4 KB, shared with the alert text). Lists are capped too; the app loads the
119
+ * full item when it opens.
120
+ */
121
+ export function clampAgentNotification(n) {
122
+ const base = {
123
+ ...n,
124
+ sender: { ...n.sender, name: clip(n.sender.name, 80) },
125
+ ...(n.project ? { project: clip(n.project, 80) } : {}),
126
+ ...(n.host ? { host: clip(n.host, 80) } : {}),
127
+ };
128
+ switch (base.view) {
129
+ case "turn.approve.command":
130
+ return { ...base, command: clip(base.command, 400), ...(base.why ? { why: clip(base.why, 300) } : {}) };
131
+ case "turn.approve.edit":
132
+ return { ...base, files: base.files.slice(0, 8).map((f) => ({ ...f, path: clip(f.path, 160) })), ...(base.summary ? { summary: clip(base.summary, 300) } : {}) };
133
+ case "turn.approve.tool":
134
+ return { ...base, tool: clip(base.tool, 80), ...(base.summary ? { summary: clip(base.summary, 300) } : {}) };
135
+ case "turn.question.choice":
136
+ return { ...base, question: clip(base.question, 400), options: base.options.slice(0, 6).map((o) => clip(o, 60)), ...(base.context ? { context: clip(base.context, 300) } : {}) };
137
+ case "turn.question.open":
138
+ return { ...base, question: clip(base.question, 400), ...(base.context ? { context: clip(base.context, 300) } : {}) };
139
+ case "turn.failed":
140
+ return { ...base, error: clip(base.error, 200), ...(base.excerpt ? { excerpt: base.excerpt.slice(-4).map((l) => clip(l, 120)) } : {}) };
141
+ case "work.done":
142
+ return { ...base, summary: clip(base.summary, 300), ...(base.artifacts ? { artifacts: base.artifacts.slice(0, 4) } : {}) };
143
+ case "ask":
144
+ return { ...base, note: clip(base.note, 500), ...(base.options ? { options: base.options.slice(0, 6).map((o) => clip(o, 60)) } : {}) };
145
+ case "text":
146
+ return { ...base, title: clip(base.title, 120), ...(base.body ? { body: clip(base.body, 400) } : {}) };
147
+ }
148
+ }
@@ -94,7 +94,7 @@ export interface ChannelInviteRecord {
94
94
  }
95
95
  export type ChannelInviteState = "active" | "expired" | "revoked" | "exhausted";
96
96
  export declare function channelInviteState(invite: ChannelInviteRecord, nowMs: number): ChannelInviteState;
97
- export type ChannelInviteRejectionReason = "unknown_token" | "expired" | "revoked" | "exhausted" | "scope_mismatch" | "channel_mismatch" | "missing_identity";
97
+ export type ChannelInviteRejectionReason = "unknown_token" | "expired" | "revoked" | "exhausted" | "scope_mismatch" | "channel_mismatch" | "missing_identity" | "membership_removed";
98
98
  export interface ChannelInviteRejection {
99
99
  reason: ChannelInviteRejectionReason;
100
100
  message: string;
@@ -160,6 +160,8 @@ export declare function findChannelInviteByTokenHash(invites: ChannelInviteRecor
160
160
  * understand the offer, and nothing that could be replayed into membership.
161
161
  */
162
162
  export interface ChannelInvitePublicView {
163
+ /** Explicit where the issuer supports single-use human invitations. */
164
+ kind?: "teammate" | "agent" | "api";
163
165
  id: ScoutId;
164
166
  channelId: ScoutId;
165
167
  /** Public authorship, used to show who may revoke this invitation. */
@@ -1 +1 @@
1
- {"version":3,"file":"channel-invites.d.ts","sourceRoot":"","sources":["../src/channel-invites.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,eAAO,M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AmB,EAAE,EAC9B,SAAS,EAAE,MAAM,GAChB,mBAAmB,GAAG,IAAI,CAI5B;AAED;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,uEAAuE;IACvE,IAAI,CAAC,EAAE,UAAU,GAAG,OAAO,GAAG,KAAK,CAAC;IACpC,EAAE,EAAE,OAAO,CAAC;IACZ,SAAS,EAAE,OAAO,CAAC;IACnB,sEAAsE;IACtE,gBAAgB,EAAE,OAAO,CAAC;IAC1B,KAAK,EAAE,kBAAkB,CAAC;IAC1B,KAAK,EAAE,kBAAkB,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B,KAAK,EAAE,kBAAkB,CAAC;IAC1B,WAAW,EAAE,uBAAuB,EAAE,CAAC;CACxC;AAED,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,mBAAmB,EAC3B,KAAK,EAAE,MAAM,GACZ,uBAAuB,CAgBzB"}
@@ -0,0 +1,10 @@
1
+ import type { MetadataMap } from "./common.js";
2
+ /** Broker-written removals preserve history while invalidating older join links. */
3
+ export declare const CHANNEL_MEMBER_REMOVALS_KEY = "channelMemberRemovals";
4
+ export interface ChannelMemberRemoval {
5
+ removedAt: number;
6
+ removedByActorId: string;
7
+ blockedInviteIds: string[];
8
+ }
9
+ export declare function readChannelMemberRemoval(metadata: MetadataMap | undefined, actorId: string): ChannelMemberRemoval | null;
10
+ //# sourceMappingURL=channel-membership.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"channel-membership.d.ts","sourceRoot":"","sources":["../src/channel-membership.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,oFAAoF;AACpF,eAAO,MAAM,2BAA2B,0BAA0B,CAAC;AAEnE,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,WAAW,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,oBAAoB,GAAG,IAAI,CAUxH"}
@@ -0,0 +1,16 @@
1
+ /** Broker-written removals preserve history while invalidating older join links. */
2
+ export const CHANNEL_MEMBER_REMOVALS_KEY = "channelMemberRemovals";
3
+ export function readChannelMemberRemoval(metadata, actorId) {
4
+ const records = metadata?.[CHANNEL_MEMBER_REMOVALS_KEY];
5
+ if (!records || typeof records !== "object" || Array.isArray(records) || !Object.hasOwn(records, actorId))
6
+ return null;
7
+ const value = records[actorId];
8
+ if (!value || typeof value !== "object" || Array.isArray(value))
9
+ return null;
10
+ const entry = value;
11
+ if (typeof entry.removedAt !== "number" || !Number.isFinite(entry.removedAt)
12
+ || typeof entry.removedByActorId !== "string" || !Array.isArray(entry.blockedInviteIds)
13
+ || !entry.blockedInviteIds.every(id => typeof id === "string"))
14
+ return null;
15
+ return { removedAt: entry.removedAt, removedByActorId: entry.removedByActorId, blockedInviteIds: entry.blockedInviteIds };
16
+ }
@@ -0,0 +1,4 @@
1
+ /** Explicit attention recipients. Text is payload and is never parsed as routing. */
2
+ export declare const MAX_CHAT_MENTIONS = 20;
3
+ export declare function parseChatMentionActorIds(value: unknown): string[];
4
+ //# sourceMappingURL=chat-mentions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-mentions.d.ts","sourceRoot":"","sources":["../src/chat-mentions.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAEpC,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAOjE"}
@@ -0,0 +1,11 @@
1
+ /** Explicit attention recipients. Text is payload and is never parsed as routing. */
2
+ export const MAX_CHAT_MENTIONS = 20;
3
+ export function parseChatMentionActorIds(value) {
4
+ if (value === undefined)
5
+ return [];
6
+ if (!Array.isArray(value) || value.length > MAX_CHAT_MENTIONS
7
+ || value.some(id => typeof id !== "string" || !id.trim() || id.length > 256)) {
8
+ throw new Error("Choose at most 20 valid mention recipients.");
9
+ }
10
+ return [...new Set(value.map(id => id.trim()))].sort();
11
+ }
@@ -0,0 +1,28 @@
1
+ import type { MessageRecord } from "./messages.js";
2
+ export interface ChatMessageCorrection {
3
+ revision: number;
4
+ editedAt?: number;
5
+ deletedAt?: number;
6
+ changedBy: string;
7
+ }
8
+ export type ChatMessageChange = {
9
+ expectedRevision: number;
10
+ body: string;
11
+ } | {
12
+ expectedRevision: number;
13
+ deleted: true;
14
+ };
15
+ export declare class ChatMessageCorrectionError extends Error {
16
+ readonly status: 400 | 403 | 404 | 409;
17
+ constructor(status: 400 | 403 | 404 | 409, message: string);
18
+ }
19
+ export declare function readChatMessageCorrection(metadata: unknown): ChatMessageCorrection | undefined;
20
+ export declare function parseChatMessageChange(value: unknown): ChatMessageChange;
21
+ /** A correction affects the shared record, never a new delivery or invocation. */
22
+ export declare function correctChatMessage<T extends Pick<MessageRecord, "actorId" | "body"> & {
23
+ metadata?: MessageRecord["metadata"] | null;
24
+ attachments?: unknown[];
25
+ mentions?: unknown[];
26
+ speech?: unknown;
27
+ }>(message: T, input: unknown, actorId: string, canModerate: boolean, now: number): T;
28
+ //# sourceMappingURL=chat-message-corrections.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-message-corrections.d.ts","sourceRoot":"","sources":["../src/chat-message-corrections.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,MAAM,WAAW,qBAAqB;IAAG,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE;AACrH,MAAM,MAAM,iBAAiB,GAAG;IAAE,gBAAgB,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,gBAAgB,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,IAAI,CAAA;CAAE,CAAC;AACzH,qBAAa,0BAA2B,SAAQ,KAAK;aACvB,MAAM,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG;gBAA7B,MAAM,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,EAAE,OAAO,EAAE,MAAM;CAC3E;AACD,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,OAAO,GAAG,qBAAqB,GAAG,SAAS,CAQ9F;AACD,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,iBAAiB,CAOxE;AAED,kFAAkF;AAClF,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,IAAI,CAAC,aAAa,EAAE,SAAS,GAAG,MAAM,CAAC,GAAG;IACrF,QAAQ,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,EAAE,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAC;CAC9G,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,CAWpF"}
@@ -0,0 +1,46 @@
1
+ export class ChatMessageCorrectionError extends Error {
2
+ status;
3
+ constructor(status, message) {
4
+ super(message);
5
+ this.status = status;
6
+ }
7
+ }
8
+ export function readChatMessageCorrection(metadata) {
9
+ const value = metadata?.chatCorrection;
10
+ if (!value || typeof value !== "object")
11
+ return;
12
+ const item = value;
13
+ if (!Number.isSafeInteger(item.revision) || item.revision < 1 || typeof item.changedBy !== "string")
14
+ return;
15
+ return { revision: item.revision, changedBy: item.changedBy,
16
+ ...(typeof item.editedAt === "number" && Number.isFinite(item.editedAt) ? { editedAt: item.editedAt } : {}),
17
+ ...(typeof item.deletedAt === "number" && Number.isFinite(item.deletedAt) ? { deletedAt: item.deletedAt } : {}) };
18
+ }
19
+ export function parseChatMessageChange(value) {
20
+ if (!value || typeof value !== "object" || Array.isArray(value))
21
+ throw new ChatMessageCorrectionError(400, "Invalid message change.");
22
+ const input = value;
23
+ if (Object.keys(input).length !== 2 || !Number.isSafeInteger(input.expectedRevision) || input.expectedRevision < 0)
24
+ throw new ChatMessageCorrectionError(400, "Invalid message revision.");
25
+ if (input.deleted === true)
26
+ return { expectedRevision: input.expectedRevision, deleted: true };
27
+ if (typeof input.body !== "string" || !input.body.trim() || input.body.length > 32_000)
28
+ throw new ChatMessageCorrectionError(400, "Message must contain between 1 and 32000 characters.");
29
+ return { expectedRevision: input.expectedRevision, body: input.body };
30
+ }
31
+ /** A correction affects the shared record, never a new delivery or invocation. */
32
+ export function correctChatMessage(message, input, actorId, canModerate, now) {
33
+ const change = parseChatMessageChange(input);
34
+ const prior = readChatMessageCorrection(message.metadata);
35
+ const deleting = "deleted" in change;
36
+ if (message.actorId !== actorId && !(deleting && canModerate))
37
+ throw new ChatMessageCorrectionError(403, "Only the author can edit this message. Hosts can also delete messages.");
38
+ if ((prior?.revision ?? 0) !== change.expectedRevision)
39
+ throw new ChatMessageCorrectionError(409, "This message changed since you opened it. Review the latest version before trying again.");
40
+ if (prior?.deletedAt != null)
41
+ throw new ChatMessageCorrectionError(409, "This message has already been deleted.");
42
+ const correction = { ...prior, revision: (prior?.revision ?? 0) + 1, changedBy: actorId, ...(deleting ? { deletedAt: now } : { editedAt: now }) };
43
+ return { ...message, body: deleting ? "" : change.body,
44
+ ...(deleting ? { attachments: [], mentions: [], speech: undefined } : {}),
45
+ metadata: { ...message.metadata, chatCorrection: correction } };
46
+ }
@@ -0,0 +1,14 @@
1
+ /** Channel-visible references, distinct from a person's private saved messages. */
2
+ export interface ChatPin {
3
+ messageId: string;
4
+ pinnedBy: string;
5
+ pinnedAt: number;
6
+ }
7
+ export interface ChatPinChange {
8
+ messageId: string;
9
+ pinned: boolean;
10
+ }
11
+ export declare function readChatPins(value: unknown): ChatPin[];
12
+ export declare function parseChatPinChange(value: unknown): ChatPinChange;
13
+ export declare function applyChatPinChange(current: unknown, change: unknown, actorId: string, now: number): ChatPin[];
14
+ //# sourceMappingURL=chat-pins.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-pins.d.ts","sourceRoot":"","sources":["../src/chat-pins.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,MAAM,WAAW,OAAO;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AACD,MAAM,WAAW,aAAa;IAAG,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE;AAErE,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,EAAE,CAUtD;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,aAAa,CAQhE;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,EAAE,CAS7G"}
@@ -0,0 +1,37 @@
1
+ export function readChatPins(value) {
2
+ if (!Array.isArray(value))
3
+ return [];
4
+ const seen = new Set();
5
+ return value.filter((item) => {
6
+ if (!item || typeof item !== "object" || typeof item.messageId !== "string" || !item.messageId
7
+ || typeof item.pinnedBy !== "string" || !item.pinnedBy || typeof item.pinnedAt !== "number"
8
+ || !Number.isFinite(item.pinnedAt) || seen.has(item.messageId))
9
+ return false;
10
+ seen.add(item.messageId);
11
+ return true;
12
+ }).map(({ messageId, pinnedBy, pinnedAt }) => ({ messageId, pinnedBy, pinnedAt }));
13
+ }
14
+ export function parseChatPinChange(value) {
15
+ if (!value || typeof value !== "object" || Array.isArray(value))
16
+ throw new Error("Invalid channel pin change.");
17
+ const input = value;
18
+ if (Object.keys(input).length !== 2 || typeof input.messageId !== "string" || !input.messageId
19
+ || input.messageId.trim() !== input.messageId || input.messageId.length > 256 || typeof input.pinned !== "boolean") {
20
+ throw new Error("Invalid channel pin change.");
21
+ }
22
+ return { messageId: input.messageId, pinned: input.pinned };
23
+ }
24
+ export function applyChatPinChange(current, change, actorId, now) {
25
+ const input = parseChatPinChange(change);
26
+ const pins = readChatPins(current);
27
+ if (!input.pinned)
28
+ return pins.filter(pin => pin.messageId !== input.messageId);
29
+ // An idempotent repeat must not rewrite who originally pinned the message.
30
+ if (pins.some(pin => pin.messageId === input.messageId))
31
+ return pins;
32
+ if (pins.length >= 50)
33
+ throw new Error("Channel pin limit reached. Unpin a message before adding another.");
34
+ if (!actorId || !Number.isFinite(now))
35
+ throw new Error("Invalid pin attribution.");
36
+ return [...pins, { messageId: input.messageId, pinnedBy: actorId, pinnedAt: now }];
37
+ }
package/dist/common.d.ts CHANGED
@@ -6,7 +6,7 @@ export type DeliveryStatus = "accepted" | "peer_acked" | "running" | "completed"
6
6
  export type DeliveryFailureReason = "peer_unreachable" | "peer_rejected" | "agent_offline" | "timeout" | "harness_error" | "dispatch" | "cancelled";
7
7
  export type DeliveryPolicy = "best_effort" | "must_ack" | "durable" | "ephemeral";
8
8
  export type DeliveryTargetKind = "participant" | "agent" | "bridge" | "device" | "voice_session" | "webhook";
9
- export type DeliveryTransport = "local_socket" | "websocket" | "pairing_bridge" | "peer_broker" | "http" | "webhook" | "telegram" | "discord" | "sms" | "email" | "tts" | "native_voice" | "claude_channel" | "claude_stream_json" | "codex_app_server" | "codex_exec" | "claude_resume" | "pi_rpc" | "grok_acp" | "kimi_acp" | "cursor_acp" | "opencode_acp" | "devin_acp" | "tmux" | "cursor_exec" | "cursor_cli_text" | "cursor_cli_stream_json" | "cursor_sdk_local";
9
+ export type DeliveryTransport = "local_socket" | "websocket" | "pairing_bridge" | "peer_broker" | "http" | "mcp_poll" | "devin_cloud_cli" | "webhook" | "telegram" | "discord" | "sms" | "email" | "tts" | "native_voice" | "claude_channel" | "claude_stream_json" | "codex_app_server" | "codex_exec" | "claude_resume" | "pi_rpc" | "grok_acp" | "kimi_acp" | "cursor_acp" | "opencode_acp" | "devin_acp" | "tmux" | "cursor_exec" | "cursor_cli_text" | "cursor_cli_stream_json" | "cursor_sdk_local";
10
10
  export type DeliveryReason = "conversation_visibility" | "direct_message" | "mention" | "thread_reply" | "invocation" | "bridge_outbound" | "speech";
11
11
  export type AdvertiseScope = "local" | "mesh";
12
12
  export type ShareMode = "local" | "summary" | "shared";
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC;AAE7B,MAAM,MAAM,SAAS,GACjB,QAAQ,GACR,QAAQ,GACR,OAAO,GACP,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,QAAQ,CAAC;AAEb,MAAM,MAAM,UAAU,GAClB,YAAY,GACZ,WAAW,GACX,QAAQ,GACR,SAAS,GACT,MAAM,GACN,QAAQ,GACR,SAAS,GACT,SAAS,GACT,aAAa,GACb,QAAQ,GACR,YAAY,GACZ,SAAS,CAAC;AAEd,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE5E,MAAM,MAAM,cAAc,GAEtB,UAAU,GACV,YAAY,GACZ,SAAS,GACT,WAAW,GACX,UAAU,GACV,QAAQ,GACR,WAAW,GAEX,SAAS,GACT,QAAQ,GACR,MAAM,GACN,cAAc,CAAC;AAEnB,MAAM,MAAM,qBAAqB,GAC7B,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AAS,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEvD,MAAM,WAAW,WAAW;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB"}
package/dist/events.d.ts CHANGED
@@ -50,6 +50,9 @@ export type BindingUpsertedEvent = ControlEventBase<"binding.upserted", {
50
50
  export type MessagePostedEvent = ControlEventBase<"message.posted", {
51
51
  message: MessageRecord;
52
52
  }>;
53
+ export type MessageCorrectedEvent = ControlEventBase<"message.corrected", {
54
+ message: MessageRecord;
55
+ }>;
53
56
  export type ConversationReadCursorUpdatedEvent = ControlEventBase<"conversation.read_cursor.updated", {
54
57
  cursor: ConversationReadCursor;
55
58
  }>;
@@ -92,7 +95,7 @@ export type PresenceUpdatedEvent = ControlEventBase<"presence.updated", {
92
95
  /** Absent when the agent had no prior presence entry. */
93
96
  previousActivity?: ObservedActivity;
94
97
  }>;
95
- export type ControlEvent = NodeUpsertedEvent | ActorRegisteredEvent | AgentRegisteredEvent | AgentEndpointUpsertedEvent | AgentEndpointDeletedEvent | ConversationUpsertedEvent | BindingUpsertedEvent | MessagePostedEvent | ConversationReadCursorUpdatedEvent | InvocationRequestedEvent | FlightUpdatedEvent | DeliveryPlannedEvent | DeliveryAttemptedEvent | DeliveryStateChangedEvent | CollaborationUpsertedEvent | CollaborationEventAppendedEvent | ScoutDispatchedEvent | PresenceUpdatedEvent;
98
+ export type ControlEvent = NodeUpsertedEvent | ActorRegisteredEvent | AgentRegisteredEvent | AgentEndpointUpsertedEvent | AgentEndpointDeletedEvent | ConversationUpsertedEvent | BindingUpsertedEvent | MessagePostedEvent | MessageCorrectedEvent | ConversationReadCursorUpdatedEvent | InvocationRequestedEvent | FlightUpdatedEvent | DeliveryPlannedEvent | DeliveryAttemptedEvent | DeliveryStateChangedEvent | CollaborationUpsertedEvent | CollaborationEventAppendedEvent | ScoutDispatchedEvent | PresenceUpdatedEvent;
96
99
  /**
97
100
  * Control-event kinds that are ephemeral by construction.
98
101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