@spunto/build 0.35.0 → 0.36.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spunto/build",
3
- "version": "0.35.0",
3
+ "version": "0.36.0",
4
4
  "description": "Spunto's shared Build engine — the devcontainer image protocol and VS Code extension registry clients, with no database, no HTTP framework and no UI.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -978,6 +978,81 @@
978
978
  ],
979
979
  "additionalProperties": false
980
980
  },
981
+ {
982
+ "type": "object",
983
+ "properties": {
984
+ "type": {
985
+ "const": "mcp.reloaded"
986
+ },
987
+ "source": {
988
+ "description": "The harness's own message this event was read from, verbatim — kept so the projection can be replayed."
989
+ },
990
+ "id": {
991
+ "anyOf": [
992
+ {
993
+ "type": "string"
994
+ },
995
+ {
996
+ "type": "null"
997
+ }
998
+ ]
999
+ },
1000
+ "servers": {
1001
+ "type": "array",
1002
+ "items": {
1003
+ "type": "object",
1004
+ "properties": {
1005
+ "name": {
1006
+ "type": "string"
1007
+ },
1008
+ "status": {
1009
+ "type": "string"
1010
+ },
1011
+ "tools": {
1012
+ "anyOf": [
1013
+ {
1014
+ "type": "number"
1015
+ },
1016
+ {
1017
+ "type": "null"
1018
+ }
1019
+ ]
1020
+ },
1021
+ "error": {
1022
+ "anyOf": [
1023
+ {
1024
+ "type": "string"
1025
+ },
1026
+ {
1027
+ "type": "null"
1028
+ }
1029
+ ]
1030
+ }
1031
+ },
1032
+ "required": [
1033
+ "name",
1034
+ "status"
1035
+ ],
1036
+ "additionalProperties": false
1037
+ }
1038
+ },
1039
+ "error": {
1040
+ "anyOf": [
1041
+ {
1042
+ "type": "string"
1043
+ },
1044
+ {
1045
+ "type": "null"
1046
+ }
1047
+ ]
1048
+ }
1049
+ },
1050
+ "required": [
1051
+ "type",
1052
+ "servers"
1053
+ ],
1054
+ "additionalProperties": false
1055
+ },
981
1056
  {
982
1057
  "type": "object",
983
1058
  "properties": {
@@ -1135,6 +1210,44 @@
1135
1210
  "answers"
1136
1211
  ],
1137
1212
  "additionalProperties": false
1213
+ },
1214
+ {
1215
+ "type": "object",
1216
+ "properties": {
1217
+ "type": {
1218
+ "type": "string",
1219
+ "enum": [
1220
+ "mcp.reload"
1221
+ ]
1222
+ },
1223
+ "id": {
1224
+ "type": "string"
1225
+ },
1226
+ "servers": {
1227
+ "type": "array",
1228
+ "items": {
1229
+ "type": "object",
1230
+ "properties": {
1231
+ "name": {
1232
+ "type": "string"
1233
+ },
1234
+ "path": {
1235
+ "type": "string"
1236
+ }
1237
+ },
1238
+ "required": [
1239
+ "name",
1240
+ "path"
1241
+ ],
1242
+ "additionalProperties": false
1243
+ }
1244
+ }
1245
+ },
1246
+ "required": [
1247
+ "type",
1248
+ "id"
1249
+ ],
1250
+ "additionalProperties": false
1138
1251
  }
1139
1252
  ]
1140
1253
  }
@@ -23,6 +23,8 @@
23
23
  * Pure: no I/O, no clock.
24
24
  */
25
25
 
26
+ import type { AgentMcpServer } from "./runner"
27
+
26
28
 
27
29
  /** One line, no runs of whitespace, bounded — a title goes in a list row and in a page header. */
28
30
  export function cleanTitle(value: unknown): string | null {
@@ -75,6 +77,7 @@ export const TASK_EVENT_TYPES = [
75
77
  "context.compacted",
76
78
  "skill.loaded",
77
79
  "question",
80
+ "mcp.reloaded",
78
81
  "raw",
79
82
  ] as const
80
83
  export type TaskEventType = (typeof TASK_EVENT_TYPES)[number]
@@ -99,7 +102,7 @@ export type SourcedEvent = NormalizedEvent & { source: string }
99
102
  export type QuestionAnswer = { question: string; selected: string[]; text?: string | null }
100
103
 
101
104
  /**
102
- * One line of a runner's stdin. The whole input side of the contract — four verbs, the same for
105
+ * One line of a runner's stdin. The whole input side of the contract — five verbs, the same for
103
106
  * every harness, so the platform never writes a harness's own shape into a runner. Closing stdin
104
107
  * ends the session once its turn is over.
105
108
  */
@@ -108,6 +111,7 @@ export type RunnerInput =
108
111
  | { type: "interrupt"; id: string }
109
112
  | { type: "title"; id: string; description: string }
110
113
  | { type: "answer"; callId: string; answers: QuestionAnswer[] }
114
+ | { type: "mcp.reload"; id: string; servers?: AgentMcpServer[] }
111
115
 
112
116
  // ── The table ─────────────────────────────────────────────────────────────────
113
117
 
@@ -195,6 +199,13 @@ export const SUBAGENT_STATUSES = ["running", "completed", "failed", "stopped"] a
195
199
  */
196
200
  export const QUESTION_STATUSES = ["pending", "answered", "dismissed"] as const
197
201
 
202
+ /**
203
+ * How an MCP server of the session stands after a reload, in the harness's own word (Claude Code:
204
+ * `connected`, `failed`, `needs-auth`, `pending`, `disabled`) — plus `deferred`: a call to it was
205
+ * in flight, so it is reconnected once that call is over rather than cut. Shown, never decided on.
206
+ */
207
+ const MCP_SERVER = object({ name: req(str()), status: req(str()), tools: COUNT, error: nullable(str()) })
208
+
198
209
  const ANSWERS = array(object({ question: req(str()), selected: req(array(str())), text: nullable(str()) }))
199
210
 
200
211
  /**
@@ -327,6 +338,10 @@ const FIELDS: Record<TaskEventType | TransientType, Record<string, Field>> = {
327
338
  ),
328
339
  answers: ANSWERS,
329
340
  },
341
+ // The session's MCP servers were reloaded, in answer to the `mcp.reload` verb (`id`): each one
342
+ // and the tools it now lists. `error` when the harness could not reload at all (one that only
343
+ // connects its servers when the session starts) — the servers it has are then left alone.
344
+ "mcp.reloaded": { id: nullable(str()), servers: req(array(MCP_SERVER)), error: nullable(str()) },
330
345
  raw: { json: any(), text: str() },
331
346
  // Not stored. `start` opens a fresh draft (one draft is one text block), else `text` is appended.
332
347
  "message.delta": { text: req(str()), start: bool() },
@@ -344,6 +359,7 @@ export function agentContractSchema(): Record<string, unknown> {
344
359
  { type: req(oneOf(["interrupt"])), id: req(str()) },
345
360
  { type: req(oneOf(["title"])), id: req(str()), description: req(str()) },
346
361
  { type: req(oneOf(["answer"])), callId: req(str()), answers: req(ANSWERS) },
362
+ { type: req(oneOf(["mcp.reload"])), id: req(str()), servers: array(object({ name: req(str()), path: req(str()) })) },
347
363
  ]
348
364
  return {
349
365
  $schema: "https://json-schema.org/draft/2020-12/schema",
@@ -22,6 +22,7 @@
22
22
  */
23
23
 
24
24
  import { readContractLine, type NormalizedEvent, type QuestionAnswer, type RunnerInput, type SourcedEvent } from "../agent-contract/vocabulary"
25
+ import type { AgentMcpServer } from "../agent-contract/runner"
25
26
 
26
27
  export { TASK_EVENT_TYPES } from "../agent-contract/vocabulary"
27
28
  export type { NormalizedEvent, QuestionAnswer, RunnerInput, SourcedEvent, TaskEventType } from "../agent-contract/vocabulary"
@@ -69,6 +70,16 @@ export function answerLine(protocol: AgentProtocol, callId: string, answers: Que
69
70
  return runnerLine({ type: "answer", callId, answers })
70
71
  }
71
72
 
73
+ /**
74
+ * Ask the session to **reload its MCP servers** now, or null for a session that cannot be told.
75
+ * `servers`: the platform's servers as they stand today — one turned on since the session started
76
+ * is added, one turned off removed. The runner answers with an `mcp.reloaded` line under `requestId`.
77
+ */
78
+ export function mcpReloadLine(protocol: AgentProtocol, requestId: string, servers: AgentMcpServer[]): string | null {
79
+ if (protocol !== "agent-v1") return null
80
+ return runnerLine({ type: "mcp.reload", id: requestId, servers })
81
+ }
82
+
72
83
  /**
73
84
  * Ask the session to **name the conversation**, or null when it cannot be asked. The runner
74
85
  * answers — if its harness can name a conversation at all — with a `session.title` line; the
@@ -9,6 +9,7 @@ export {
9
9
  answerLine,
10
10
  interruptLine,
11
11
  isInteractive,
12
+ mcpReloadLine,
12
13
  parseLines,
13
14
  parseStreamLine,
14
15
  sessionTitleRequestLine,