@bastani/atomic 0.9.26-alpha.2 → 0.9.26-alpha.4

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 (115) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/builtin/intercom/CHANGELOG.md +6 -0
  3. package/dist/builtin/intercom/broker/broker.ts +9 -1
  4. package/dist/builtin/intercom/broker/spawn.ts +2 -0
  5. package/dist/builtin/intercom/index.bundle.mjs +12 -2
  6. package/dist/builtin/intercom/package.json +1 -1
  7. package/dist/builtin/intercom/types.ts +13 -0
  8. package/dist/builtin/mcp/native-client-licenses/NOTICE +2 -0
  9. package/dist/builtin/mcp/package.json +1 -1
  10. package/dist/builtin/subagents/package.json +1 -1
  11. package/dist/builtin/web-access/package.json +1 -1
  12. package/dist/builtin/workflows/CHANGELOG.md +6 -0
  13. package/dist/builtin/workflows/builtin/{chunk-kfsnh3w7.js → chunk-73p2cm5s.js} +4 -2
  14. package/dist/builtin/workflows/builtin/{chunk-rqmasd3d.js → chunk-n95myjcg.js} +1 -1
  15. package/dist/builtin/workflows/builtin/{chunk-wz783pvd.js → chunk-ycvg8y8k.js} +1 -1
  16. package/dist/builtin/workflows/builtin/goal.js +2 -2
  17. package/dist/builtin/workflows/builtin/index.js +3 -3
  18. package/dist/builtin/workflows/builtin/ralph.js +2 -2
  19. package/dist/builtin/workflows/package.json +1 -1
  20. package/dist/builtin/workflows/src/extension/index.bundle.mjs +336 -241
  21. package/dist/builtin/workflows/src/index.js +25 -15
  22. package/dist/cli/args.d.ts.map +1 -1
  23. package/dist/cli/args.js +4 -1
  24. package/dist/cli/args.js.map +1 -1
  25. package/dist/core/extensions/context-types.d.ts +5 -2
  26. package/dist/core/extensions/context-types.d.ts.map +1 -1
  27. package/dist/core/extensions/context-types.js.map +1 -1
  28. package/dist/core/keybindings.d.ts +5 -0
  29. package/dist/core/keybindings.d.ts.map +1 -1
  30. package/dist/core/keybindings.js +1 -0
  31. package/dist/core/keybindings.js.map +1 -1
  32. package/dist/extensions/mcp/cli.d.ts.map +1 -1
  33. package/dist/extensions/mcp/cli.js +4 -1
  34. package/dist/extensions/mcp/cli.js.map +1 -1
  35. package/dist/extensions/mcp/client/oauth/callback.d.ts +4 -2
  36. package/dist/extensions/mcp/client/oauth/callback.d.ts.map +1 -1
  37. package/dist/extensions/mcp/client/oauth/callback.js +12 -7
  38. package/dist/extensions/mcp/client/oauth/callback.js.map +1 -1
  39. package/dist/extensions/mcp/client/oauth/flow.d.ts +7 -1
  40. package/dist/extensions/mcp/client/oauth/flow.d.ts.map +1 -1
  41. package/dist/extensions/mcp/client/oauth/flow.js +20 -21
  42. package/dist/extensions/mcp/client/oauth/flow.js.map +1 -1
  43. package/dist/extensions/mcp/client/oauth/index.d.ts +1 -1
  44. package/dist/extensions/mcp/client/oauth/index.d.ts.map +1 -1
  45. package/dist/extensions/mcp/client/oauth/index.js.map +1 -1
  46. package/dist/extensions/mcp/client/oauth/provider.d.ts +5 -2
  47. package/dist/extensions/mcp/client/oauth/provider.d.ts.map +1 -1
  48. package/dist/extensions/mcp/client/oauth/provider.js +2 -0
  49. package/dist/extensions/mcp/client/oauth/provider.js.map +1 -1
  50. package/dist/extensions/mcp/config.d.ts +16 -4
  51. package/dist/extensions/mcp/config.d.ts.map +1 -1
  52. package/dist/extensions/mcp/config.js +50 -11
  53. package/dist/extensions/mcp/config.js.map +1 -1
  54. package/dist/extensions/mcp/index.d.ts +4 -1
  55. package/dist/extensions/mcp/index.d.ts.map +1 -1
  56. package/dist/extensions/mcp/index.js +80 -46
  57. package/dist/extensions/mcp/index.js.map +1 -1
  58. package/dist/extensions/mcp/oauth.d.ts.map +1 -1
  59. package/dist/extensions/mcp/oauth.js +9 -5
  60. package/dist/extensions/mcp/oauth.js.map +1 -1
  61. package/dist/extensions/mcp/ui.d.ts.map +1 -1
  62. package/dist/extensions/mcp/ui.js +8 -4
  63. package/dist/extensions/mcp/ui.js.map +1 -1
  64. package/dist/index.d.ts +1 -1
  65. package/dist/index.js.map +1 -1
  66. package/dist/modes/interactive/chat-input-actions.js.map +1 -1
  67. package/dist/modes/interactive/components/auth-url.d.ts +10 -0
  68. package/dist/modes/interactive/components/auth-url.d.ts.map +1 -0
  69. package/dist/modes/interactive/components/auth-url.js +37 -0
  70. package/dist/modes/interactive/components/auth-url.js.map +1 -0
  71. package/dist/modes/interactive/components/index.d.ts +0 -1
  72. package/dist/modes/interactive/components/index.d.ts.map +1 -1
  73. package/dist/modes/interactive/components/index.js +0 -1
  74. package/dist/modes/interactive/components/index.js.map +1 -1
  75. package/dist/modes/interactive/components/login-dialog.d.ts +1 -0
  76. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  77. package/dist/modes/interactive/components/login-dialog.js +10 -5
  78. package/dist/modes/interactive/components/login-dialog.js.map +1 -1
  79. package/dist/modes/interactive/interactive-auth-login.js +0 -1
  80. package/dist/modes/interactive/interactive-auth-login.js.map +1 -1
  81. package/dist/modes/interactive/interactive-hotkeys-debug.js +1 -11
  82. package/dist/modes/interactive/interactive-hotkeys-debug.js.map +1 -1
  83. package/dist/modes/interactive/interactive-mode-base.js.map +1 -1
  84. package/dist/modes/interactive/interactive-mode-deps.d.ts +1 -2
  85. package/dist/modes/interactive/interactive-mode-deps.d.ts.map +1 -1
  86. package/dist/modes/interactive/interactive-mode-deps.js +0 -1
  87. package/dist/modes/interactive/interactive-mode-deps.js.map +1 -1
  88. package/dist/modes/interactive/interactive-mode-surface.d.ts +0 -5
  89. package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -1
  90. package/dist/modes/interactive/interactive-mode-surface.js.map +1 -1
  91. package/dist/modes/interactive/interactive-model-routing.js +0 -2
  92. package/dist/modes/interactive/interactive-model-routing.js.map +1 -1
  93. package/dist/modes/interactive/interactive-tui.js.map +1 -1
  94. package/dist/modes/interactive-engine/engine-custom-ui.d.ts.map +1 -1
  95. package/dist/modes/interactive-engine/engine-custom-ui.js +38 -2
  96. package/dist/modes/interactive-engine/engine-custom-ui.js.map +1 -1
  97. package/dist/modes/interactive-engine/protocol.d.ts +10 -0
  98. package/dist/modes/interactive-engine/protocol.d.ts.map +1 -1
  99. package/dist/modes/interactive-engine/protocol.js +10 -0
  100. package/dist/modes/interactive-engine/protocol.js.map +1 -1
  101. package/dist/modes/interactive-engine/remote-component.d.ts +2 -1
  102. package/dist/modes/interactive-engine/remote-component.d.ts.map +1 -1
  103. package/dist/modes/interactive-engine/remote-component.js +23 -1
  104. package/dist/modes/interactive-engine/remote-component.js.map +1 -1
  105. package/docs/intercom/reference.md +13 -1
  106. package/docs/keybindings.md +3 -0
  107. package/docs/mcp-servers.md +13 -1
  108. package/docs/providers.md +2 -0
  109. package/docs/workflows/operations.md +2 -0
  110. package/npm-shrinkwrap.json +55 -33
  111. package/package.json +5 -4
  112. package/dist/modes/interactive/components/daxnuts.d.ts +0 -23
  113. package/dist/modes/interactive/components/daxnuts.d.ts.map +0 -1
  114. package/dist/modes/interactive/components/daxnuts.js +0 -140
  115. package/dist/modes/interactive/components/daxnuts.js.map +0 -1
@@ -127,6 +127,11 @@ export type InteractiveEngineMessage = {
127
127
  type: "engine_custom_terminal";
128
128
  componentId: string;
129
129
  control: EngineTerminalControl;
130
+ } | {
131
+ type: "engine_custom_copy";
132
+ componentId: string;
133
+ requestId: number;
134
+ text: string;
130
135
  } | {
131
136
  type: "engine_custom_control";
132
137
  componentId: string;
@@ -177,6 +182,11 @@ export type InteractiveEngineCommand = {
177
182
  componentId: string;
178
183
  requestId: number;
179
184
  data: string;
185
+ } | {
186
+ type: "engine_custom_copy_result";
187
+ componentId: string;
188
+ requestId: number;
189
+ error?: string;
180
190
  } | {
181
191
  type: "engine_custom_scroll";
182
192
  componentId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive-engine/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAwB,MAAM,iCAAiC,CAAC;AA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AAM,CAAA;CAAE,CAAC;AAY7D,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,IAAI,SAAS,CAIhG;AA+KD,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,MAAM,GAAG,wBAAwB,GAAG,SAAS,CAsKhG;AAED,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,MAAM,GAAG,wBAAwB,GAAG,SAAS,CAiHhG;AAED,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,wBAAwB,GAAG,wBAAwB,GAAG,MAAM,CAEpH;AAED,eAAO,MAAM,iCAAiC,wCAAkC,CAAC"}
@@ -279,6 +279,12 @@ export function parseInteractiveEngineMessage(line) {
279
279
  return typeof value.componentId === "string"
280
280
  ? { type: value.type, componentId: value.componentId, result: value.result }
281
281
  : undefined;
282
+ case "engine_custom_copy":
283
+ return typeof value.componentId === "string" &&
284
+ typeof value.requestId === "number" &&
285
+ typeof value.text === "string"
286
+ ? { type: value.type, componentId: value.componentId, requestId: value.requestId, text: value.text }
287
+ : undefined;
282
288
  case "engine_custom_terminal": {
283
289
  const control = parseEngineTerminalControl(value.control);
284
290
  return typeof value.componentId === "string" && control
@@ -379,6 +385,10 @@ export function parseInteractiveEngineCommand(line) {
379
385
  }
380
386
  if (value.type === "engine_custom_input" && typeof value.requestId === "number" && typeof value.data === "string")
381
387
  return { type: value.type, componentId: value.componentId, requestId: value.requestId, data: value.data };
388
+ if (value.type === "engine_custom_copy_result" &&
389
+ typeof value.requestId === "number" &&
390
+ (value.error === undefined || typeof value.error === "string"))
391
+ return { type: value.type, componentId: value.componentId, requestId: value.requestId, error: value.error };
382
392
  if (value.type === "engine_custom_dispose" || value.type === "engine_render_dispose")
383
393
  return { type: value.type, componentId: value.componentId };
384
394
  if ((value.type === "engine_session_picker_select" || value.type === "engine_session_picker_delete") &&
@@ -1 +1 @@
1
- {"version":3,"file":"protocol.js","sourceRoot":"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AM,iCAAiC,GAAG,+BAA+B,CAAC","sourcesContent":["import type { CallbackActivity, CallbackActivityKind } from \"../../core/callback-activity.ts\";\nimport type {\n\tHostInputFormField,\n\tHostSessionPickerRow,\n\tWidgetScrollRequest,\n\tWidgetScrollState,\n} from \"../../core/extensions/ui-types.js\";\nimport type { KeyId } from \"../../core/keybindings.ts\";\n\n/**\n * Version 4 separates minimal session binding from optional resource readiness.\n * A host must not submit a prompt until the matching engine generation reports\n * `engine_resources_ready`.\n */\nexport const INTERACTIVE_ENGINE_PROTOCOL_VERSION = 4;\n\nexport interface JsonObject {\n\t[key: string]: JsonValue;\n}\n\nexport type JsonValue = boolean | JsonObject | JsonValue[] | null | number | string;\n\nexport interface SerializableOverlayOptions {\n\tanchor?: string;\n\tcol?: number | string;\n\tmargin?: number | { top?: number; right?: number; bottom?: number; left?: number };\n\tmaxHeight?: number | string;\n\tmaxWidth?: number | string;\n\tminHeight?: number;\n\tminWidth?: number;\n\toffsetX?: number;\n\toffsetY?: number;\n\trow?: number | string;\n\twidth?: number | string;\n}\n\n/**\n * Allowlisted terminal-mode control a remote custom component may ask the host\n * to apply to the real host TTY. Deliberately NOT a raw byte channel: the child\n * names an intent and the host owns the concrete escape sequence, so a buggy or\n * compromised child can only toggle this documented mode.\n */\nexport type EngineTerminalControl = { kind: \"autowrap\"; enabled: boolean };\n\nexport interface EngineExtensionShortcut {\n\tkey: string;\n\tdescription?: string;\n\t/** Editor-owned input exclusions resolved in the engine and matched by the host. */\n\teditorKeys?: KeyId[];\n}\n\nexport type SerializableKeybindingsConfig = Record<string, KeyId | KeyId[]>;\n\nexport interface EngineKeybindingState {\n\tuserBindings: SerializableKeybindingsConfig;\n\teffectiveBindings: SerializableKeybindingsConfig;\n\tshortcuts: EngineExtensionShortcut[];\n}\n\nexport type InteractiveEngineMessage =\n\t| { type: \"engine_ready\"; protocolVersion: typeof INTERACTIVE_ENGINE_PROTOCOL_VERSION; pid: number }\n\t| { type: \"engine_bound\" }\n\t| { type: \"engine_resources_ready\" }\n\t| { type: \"engine_resources_failed\"; message: string }\n\t| { type: \"engine_keybindings_reloaded\"; state: EngineKeybindingState }\n\t| { type: \"engine_heartbeat\"; at: number }\n\t| { type: \"engine_activity_started\"; activity: CallbackActivity }\n\t| { type: \"engine_activity_finished\"; activityId: string }\n\t/**\n\t * The child took ownership of a correlated RPC request: it has parsed the\n\t * command and is about to run it. Emitted and flushed BEFORE any handler\n\t * work, so a later transport failure can be told apart from a send that\n\t * never landed. Output is not a substitute: a command can run to completion\n\t * with side effects and produce nothing.\n\t */\n\t| { type: \"engine_request_accepted\"; requestId: string; command: string }\n\t| {\n\t\t\ttype: \"engine_custom_open\";\n\t\t\tcomponentId: string;\n\t\t\toverlay: boolean;\n\t\t\tpurpose?: \"prompt\" | \"navigation\";\n\t\t\tdeferInlineCustomUiFocus?: boolean;\n\t\t\thandlesCtrlC?: boolean;\n\t\t\thandlesInternalUiAction?: boolean;\n\t\t\treserveTranscriptRows?: boolean;\n\t\t\toverlayOptions?: SerializableOverlayOptions;\n\t\t\twidgetKey?: string;\n\t\t\twidgetPlacement?: \"aboveEditor\" | \"belowEditor\";\n\t\t\twidgetScroll?: { maxHeight: number; maxHeightFraction?: number };\n\t }\n\t| { type: \"engine_custom_close\"; componentId: string }\n\t| {\n\t\t\ttype: \"engine_custom_frame\";\n\t\t\tcomponentId: string;\n\t\t\trequestId: number;\n\t\t\tlines: string[];\n\t\t\tscrollRequest?: WidgetScrollRequest;\n\t }\n\t| { type: \"engine_custom_input_result\"; componentId: string; requestId: number; handled: boolean }\n\t| { type: \"engine_custom_invalidate\"; componentId: string }\n\t| { type: \"engine_custom_done\"; componentId: string; result?: JsonValue }\n\t| { type: \"engine_custom_terminal\"; componentId: string; control: EngineTerminalControl }\n\t| { type: \"engine_custom_control\"; componentId: string; action: \"focus\" | \"hide\" | \"show\" | \"unfocus\" }\n\t| {\n\t\t\ttype: \"engine_session_picker_open\";\n\t\t\tcomponentId: string;\n\t\t\tsessions: HostSessionPickerRow[];\n\t\t\tshowRenameHint?: boolean;\n\t }\n\t| { type: \"engine_session_picker_update\"; componentId: string; sessions: HostSessionPickerRow[] }\n\t| { type: \"engine_session_picker_error\"; componentId: string; message: string }\n\t| { type: \"engine_session_picker_close\"; componentId: string }\n\t| {\n\t\t\ttype: \"engine_input_form_open\";\n\t\t\tcomponentId: string;\n\t\t\ttitle: string;\n\t\t\tfields: HostInputFormField[];\n\t\t\theading?: string;\n\t\t\tsubmitLabel?: string;\n\t }\n\t| { type: \"engine_input_form_close\"; componentId: string };\nexport type InteractiveEngineCommand =\n\t| { type: \"engine_project_trust_start\"; componentId: string; kind: \"select\" | \"confirm\" | \"input\"; title: string }\n\t| { type: \"engine_project_trust_end\"; componentId: string }\n\t| { type: \"engine_custom_render\"; componentId: string; requestId: number; width: number; rows: number }\n\t| { type: \"engine_custom_input\"; componentId: string; requestId: number; data: string }\n\t| { type: \"engine_custom_scroll\"; componentId: string; state: WidgetScrollState }\n\t| { type: \"engine_custom_dispose\"; componentId: string }\n\t| {\n\t\t\ttype: \"engine_tool_render\";\n\t\t\tcomponentId: string;\n\t\t\trequestId: number;\n\t\t\twidth: number;\n\t\t\ttoolName: string;\n\t\t\ttoolCallId: string;\n\t\t\targs: JsonValue;\n\t\t\tresult?: JsonObject;\n\t\t\texecutionStarted: boolean;\n\t\t\targsComplete: boolean;\n\t\t\tisPartial: boolean;\n\t\t\texpanded: boolean;\n\t\t\tshowImages: boolean;\n\t\t\timageWidthCells: number;\n\t }\n\t| {\n\t\t\ttype: \"engine_message_render\";\n\t\t\tcomponentId: string;\n\t\t\trequestId: number;\n\t\t\twidth: number;\n\t\t\tmessage: JsonObject;\n\t\t\texpanded: boolean;\n\t\t\toutputPad: number;\n\t }\n\t| { type: \"engine_render_dispose\"; componentId: string }\n\t| { type: \"engine_session_picker_select\"; componentId: string; path: string }\n\t| { type: \"engine_session_picker_cancel\"; componentId: string }\n\t| { type: \"engine_session_picker_delete\"; componentId: string; path: string }\n\t| { type: \"engine_input_form_submit\"; componentId: string; values: Record<string, string> }\n\t| { type: \"engine_input_form_cancel\"; componentId: string };\n\nconst ACTIVITY_KINDS: readonly CallbackActivityKind[] = [\n\t\"extension.hook\",\n\t\"renderer\",\n\t\"tool.execute\",\n\t\"tool.prepare\",\n\t\"workflow.ctx_tool\",\n\t\"workflow.run\",\n\t\"workflow.stage_adapter\",\n];\n\nexport function isJsonValue(value: object | boolean | null | number | string): value is JsonValue {\n\tif (value === null || typeof value !== \"object\") return true;\n\tif (Array.isArray(value)) return value.every((item) => isJsonValue(item));\n\treturn Object.values(value).every((item) => item !== undefined && isJsonValue(item));\n}\n\nfunction isJsonObject(value: JsonValue): value is JsonObject {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction isActivityKind(value: JsonValue): value is CallbackActivityKind {\n\treturn typeof value === \"string\" && ACTIVITY_KINDS.includes(value as CallbackActivityKind);\n}\n\nfunction isCallbackActivity(value: JsonValue): value is JsonObject & CallbackActivity {\n\treturn (\n\t\tisJsonObject(value) &&\n\t\ttypeof value.id === \"string\" &&\n\t\tisActivityKind(value.kind) &&\n\t\ttypeof value.name === \"string\" &&\n\t\ttypeof value.startedAt === \"number\"\n\t);\n}\n\nfunction parseEngineTerminalControl(value: JsonValue | undefined): EngineTerminalControl | undefined {\n\tif (value === undefined || !isJsonObject(value) || value.kind !== \"autowrap\" || typeof value.enabled !== \"boolean\") {\n\t\treturn undefined;\n\t}\n\treturn { kind: \"autowrap\", enabled: value.enabled };\n}\n\nconst SESSION_PICKER_MESSAGE_COLORS = [\"success\", \"warning\", \"accent\", \"error\"] as const;\n\nfunction parseSessionPickerRow(value: JsonValue): HostSessionPickerRow | undefined {\n\tif (!isJsonObject(value)) return undefined;\n\tconst {\n\t\tpath,\n\t\tid,\n\t\tcwd,\n\t\tcreatedAt,\n\t\tmodifiedAt,\n\t\tmessageCount,\n\t\tfirstMessage,\n\t\tsummary,\n\t\tallMessagesText,\n\t\tname,\n\t\tmessageColor,\n\t} = value;\n\tif (\n\t\ttypeof path !== \"string\" ||\n\t\ttypeof id !== \"string\" ||\n\t\ttypeof cwd !== \"string\" ||\n\t\ttypeof createdAt !== \"number\" ||\n\t\ttypeof modifiedAt !== \"number\" ||\n\t\ttypeof messageCount !== \"number\" ||\n\t\ttypeof firstMessage !== \"string\"\n\t)\n\t\treturn undefined;\n\tif (summary !== undefined && typeof summary !== \"string\") return undefined;\n\tif (allMessagesText !== undefined && typeof allMessagesText !== \"string\") return undefined;\n\tif (name !== undefined && typeof name !== \"string\") return undefined;\n\tif (\n\t\tmessageColor !== undefined &&\n\t\t!SESSION_PICKER_MESSAGE_COLORS.includes(messageColor as (typeof SESSION_PICKER_MESSAGE_COLORS)[number])\n\t)\n\t\treturn undefined;\n\treturn {\n\t\tpath,\n\t\tid,\n\t\tcwd,\n\t\tcreatedAt,\n\t\tmodifiedAt,\n\t\tmessageCount,\n\t\tfirstMessage,\n\t\t...(summary !== undefined ? { summary } : {}),\n\t\t...(allMessagesText !== undefined ? { allMessagesText } : {}),\n\t\t...(name !== undefined ? { name } : {}),\n\t\t...(messageColor !== undefined\n\t\t\t? { messageColor: messageColor as (typeof SESSION_PICKER_MESSAGE_COLORS)[number] }\n\t\t\t: {}),\n\t};\n}\n\nfunction parseSessionPickerRows(value: JsonValue | undefined): HostSessionPickerRow[] | undefined {\n\tif (!Array.isArray(value)) return undefined;\n\tconst rows: HostSessionPickerRow[] = [];\n\tfor (const entry of value) {\n\t\tconst row = parseSessionPickerRow(entry);\n\t\tif (!row) return undefined;\n\t\trows.push(row);\n\t}\n\treturn rows;\n}\n\nconst INPUT_FORM_FIELD_TYPES = [\"string\", \"text\", \"number\", \"integer\", \"boolean\", \"select\"] as const;\n\nfunction parseInputFormFields(value: JsonValue | undefined): HostInputFormField[] | undefined {\n\tif (!Array.isArray(value)) return undefined;\n\tconst fields: HostInputFormField[] = [];\n\tfor (const entry of value) {\n\t\tif (!isJsonObject(entry)) return undefined;\n\t\tconst { name, type, description, required, choices, placeholder, initialValue } = entry;\n\t\tif (\n\t\t\ttypeof name !== \"string\" ||\n\t\t\t!INPUT_FORM_FIELD_TYPES.includes(type as HostInputFormField[\"type\"]) ||\n\t\t\ttypeof initialValue !== \"string\"\n\t\t)\n\t\t\treturn undefined;\n\t\tif (description !== undefined && typeof description !== \"string\") return undefined;\n\t\tif (required !== undefined && typeof required !== \"boolean\") return undefined;\n\t\tif (choices !== undefined && (!Array.isArray(choices) || !choices.every((choice) => typeof choice === \"string\")))\n\t\t\treturn undefined;\n\t\tif (placeholder !== undefined && typeof placeholder !== \"string\") return undefined;\n\t\tfields.push({\n\t\t\tname,\n\t\t\ttype: type as HostInputFormField[\"type\"],\n\t\t\tinitialValue,\n\t\t\t...(typeof description === \"string\" ? { description } : {}),\n\t\t\t...(typeof required === \"boolean\" ? { required } : {}),\n\t\t\t...(Array.isArray(choices) ? { choices: choices as string[] } : {}),\n\t\t\t...(typeof placeholder === \"string\" ? { placeholder } : {}),\n\t\t});\n\t}\n\treturn fields;\n}\n\nfunction parseStringRecord(value: JsonValue | undefined): Record<string, string> | undefined {\n\tif (value === undefined || !isJsonObject(value)) return undefined;\n\tconst entries = Object.entries(value);\n\tif (entries.some(([, entry]) => typeof entry !== \"string\")) return undefined;\n\treturn Object.fromEntries(entries) as Record<string, string>;\n}\n\nfunction parseKeybindingsConfig(value: JsonValue | undefined): SerializableKeybindingsConfig | undefined {\n\tif (value === undefined || !isJsonObject(value)) return undefined;\n\tconst config: SerializableKeybindingsConfig = {};\n\tfor (const [key, binding] of Object.entries(value)) {\n\t\tif (typeof binding === \"string\") config[key] = binding as SerializableKeybindingsConfig[string];\n\t\telse if (Array.isArray(binding) && binding.every((entry) => typeof entry === \"string\")) {\n\t\t\tconfig[key] = binding as SerializableKeybindingsConfig[string];\n\t\t} else return undefined;\n\t}\n\treturn config;\n}\n\nfunction parseKeybindingState(value: JsonValue | undefined): EngineKeybindingState | undefined {\n\tif (value === undefined || !isJsonObject(value) || !Array.isArray(value.shortcuts)) return undefined;\n\tconst userBindings = parseKeybindingsConfig(value.userBindings);\n\tconst effectiveBindings = parseKeybindingsConfig(value.effectiveBindings);\n\tif (!userBindings || !effectiveBindings) return undefined;\n\tconst shortcuts: EngineExtensionShortcut[] = [];\n\tfor (const shortcut of value.shortcuts) {\n\t\tif (\n\t\t\t!isJsonObject(shortcut) ||\n\t\t\ttypeof shortcut.key !== \"string\" ||\n\t\t\t(shortcut.description !== undefined && typeof shortcut.description !== \"string\") ||\n\t\t\t(shortcut.editorKeys !== undefined &&\n\t\t\t\t(!Array.isArray(shortcut.editorKeys) || shortcut.editorKeys.some((key) => typeof key !== \"string\")))\n\t\t)\n\t\t\treturn undefined;\n\t\tshortcuts.push({\n\t\t\tkey: shortcut.key,\n\t\t\t...(typeof shortcut.description === \"string\" ? { description: shortcut.description } : {}),\n\t\t\t...(Array.isArray(shortcut.editorKeys) ? { editorKeys: shortcut.editorKeys as KeyId[] } : {}),\n\t\t});\n\t}\n\treturn { userBindings, effectiveBindings, shortcuts };\n}\n\nfunction parseJsonObject(line: string): JsonObject | undefined {\n\tlet value: JsonValue;\n\ttry {\n\t\tvalue = JSON.parse(line) as JsonValue;\n\t} catch {\n\t\treturn undefined;\n\t}\n\treturn isJsonObject(value) ? value : undefined;\n}\n\nexport function parseInteractiveEngineMessage(line: string): InteractiveEngineMessage | undefined {\n\tconst value = parseJsonObject(line);\n\tif (!value || typeof value.type !== \"string\") return undefined;\n\tswitch (value.type) {\n\t\tcase \"engine_ready\":\n\t\t\treturn value.protocolVersion === INTERACTIVE_ENGINE_PROTOCOL_VERSION && typeof value.pid === \"number\"\n\t\t\t\t? { type: value.type, protocolVersion: INTERACTIVE_ENGINE_PROTOCOL_VERSION, pid: value.pid }\n\t\t\t\t: undefined;\n\t\tcase \"engine_bound\":\n\t\t\treturn { type: value.type };\n\t\tcase \"engine_resources_ready\":\n\t\t\treturn { type: value.type };\n\t\tcase \"engine_resources_failed\":\n\t\t\treturn typeof value.message === \"string\" ? { type: value.type, message: value.message } : undefined;\n\t\tcase \"engine_keybindings_reloaded\": {\n\t\t\tconst state = parseKeybindingState(value.state);\n\t\t\treturn state ? { type: value.type, state } : undefined;\n\t\t}\n\t\tcase \"engine_heartbeat\":\n\t\t\treturn typeof value.at === \"number\" ? { type: value.type, at: value.at } : undefined;\n\t\tcase \"engine_activity_started\":\n\t\t\treturn isCallbackActivity(value.activity) ? { type: value.type, activity: value.activity } : undefined;\n\t\tcase \"engine_activity_finished\":\n\t\t\treturn typeof value.activityId === \"string\" ? { type: value.type, activityId: value.activityId } : undefined;\n\t\tcase \"engine_request_accepted\":\n\t\t\treturn typeof value.requestId === \"string\" && typeof value.command === \"string\"\n\t\t\t\t? { type: value.type, requestId: value.requestId, command: value.command }\n\t\t\t\t: undefined;\n\t\tcase \"engine_custom_open\":\n\t\t\treturn typeof value.componentId === \"string\" && typeof value.overlay === \"boolean\"\n\t\t\t\t? {\n\t\t\t\t\t\ttype: value.type,\n\t\t\t\t\t\tcomponentId: value.componentId,\n\t\t\t\t\t\toverlay: value.overlay,\n\t\t\t\t\t\t...(value.purpose === \"navigation\" || value.purpose === \"prompt\" ? { purpose: value.purpose } : {}),\n\t\t\t\t\t\tdeferInlineCustomUiFocus: value.deferInlineCustomUiFocus === true,\n\t\t\t\t\t\thandlesCtrlC: value.handlesCtrlC === true,\n\t\t\t\t\t\thandlesInternalUiAction: value.handlesInternalUiAction === true,\n\t\t\t\t\t\treserveTranscriptRows: value.reserveTranscriptRows === true,\n\t\t\t\t\t\toverlayOptions: isJsonObject(value.overlayOptions)\n\t\t\t\t\t\t\t? (value.overlayOptions as SerializableOverlayOptions)\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\twidgetKey: typeof value.widgetKey === \"string\" ? value.widgetKey : undefined,\n\t\t\t\t\t\t...(isJsonObject(value.widgetScroll) && typeof value.widgetScroll.maxHeight === \"number\"\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\twidgetScroll: {\n\t\t\t\t\t\t\t\t\t\tmaxHeight: value.widgetScroll.maxHeight,\n\t\t\t\t\t\t\t\t\t\t...(typeof value.widgetScroll.maxHeightFraction === \"number\"\n\t\t\t\t\t\t\t\t\t\t\t? { maxHeightFraction: value.widgetScroll.maxHeightFraction }\n\t\t\t\t\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\twidgetPlacement:\n\t\t\t\t\t\t\tvalue.widgetPlacement === \"belowEditor\"\n\t\t\t\t\t\t\t\t? \"belowEditor\"\n\t\t\t\t\t\t\t\t: value.widgetPlacement === \"aboveEditor\"\n\t\t\t\t\t\t\t\t\t? \"aboveEditor\"\n\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t}\n\t\t\t\t: undefined;\n\t\tcase \"engine_custom_close\":\n\t\t\treturn typeof value.componentId === \"string\"\n\t\t\t\t? { type: value.type, componentId: value.componentId }\n\t\t\t\t: undefined;\n\t\tcase \"engine_custom_frame\":\n\t\t\treturn typeof value.componentId === \"string\" &&\n\t\t\t\ttypeof value.requestId === \"number\" &&\n\t\t\t\tArray.isArray(value.lines) &&\n\t\t\t\tvalue.lines.every((entry) => typeof entry === \"string\")\n\t\t\t\t? {\n\t\t\t\t\t\ttype: value.type,\n\t\t\t\t\t\tcomponentId: value.componentId,\n\t\t\t\t\t\trequestId: value.requestId,\n\t\t\t\t\t\tlines: value.lines,\n\t\t\t\t\t\t...(isJsonObject(value.scrollRequest) &&\n\t\t\t\t\t\ttypeof value.scrollRequest.version === \"number\" &&\n\t\t\t\t\t\ttypeof value.scrollRequest.scrollTop === \"number\"\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\tscrollRequest: {\n\t\t\t\t\t\t\t\t\t\tversion: value.scrollRequest.version,\n\t\t\t\t\t\t\t\t\t\tscrollTop: value.scrollRequest.scrollTop,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t}\n\t\t\t\t: undefined;\n\t\tcase \"engine_custom_input_result\":\n\t\t\treturn typeof value.componentId === \"string\" &&\n\t\t\t\ttypeof value.requestId === \"number\" &&\n\t\t\t\ttypeof value.handled === \"boolean\"\n\t\t\t\t? { type: value.type, componentId: value.componentId, requestId: value.requestId, handled: value.handled }\n\t\t\t\t: undefined;\n\t\tcase \"engine_custom_invalidate\":\n\t\t\treturn typeof value.componentId === \"string\"\n\t\t\t\t? { type: value.type, componentId: value.componentId }\n\t\t\t\t: undefined;\n\t\tcase \"engine_custom_done\":\n\t\t\treturn typeof value.componentId === \"string\"\n\t\t\t\t? { type: value.type, componentId: value.componentId, result: value.result }\n\t\t\t\t: undefined;\n\t\tcase \"engine_custom_terminal\": {\n\t\t\tconst control = parseEngineTerminalControl(value.control);\n\t\t\treturn typeof value.componentId === \"string\" && control\n\t\t\t\t? { type: value.type, componentId: value.componentId, control }\n\t\t\t\t: undefined;\n\t\t}\n\t\tcase \"engine_custom_control\":\n\t\t\treturn typeof value.componentId === \"string\" &&\n\t\t\t\t[\"focus\", \"hide\", \"show\", \"unfocus\"].includes(String(value.action))\n\t\t\t\t? {\n\t\t\t\t\t\ttype: value.type,\n\t\t\t\t\t\tcomponentId: value.componentId,\n\t\t\t\t\t\taction: value.action as \"focus\" | \"hide\" | \"show\" | \"unfocus\",\n\t\t\t\t\t}\n\t\t\t\t: undefined;\n\t\tcase \"engine_session_picker_open\": {\n\t\t\tconst sessions = parseSessionPickerRows(value.sessions);\n\t\t\treturn typeof value.componentId === \"string\" &&\n\t\t\t\tsessions &&\n\t\t\t\t(value.showRenameHint === undefined || typeof value.showRenameHint === \"boolean\")\n\t\t\t\t? {\n\t\t\t\t\t\ttype: value.type,\n\t\t\t\t\t\tcomponentId: value.componentId,\n\t\t\t\t\t\tsessions,\n\t\t\t\t\t\t...(typeof value.showRenameHint === \"boolean\" ? { showRenameHint: value.showRenameHint } : {}),\n\t\t\t\t\t}\n\t\t\t\t: undefined;\n\t\t}\n\t\tcase \"engine_session_picker_update\": {\n\t\t\tconst sessions = parseSessionPickerRows(value.sessions);\n\t\t\treturn typeof value.componentId === \"string\" && sessions\n\t\t\t\t? { type: value.type, componentId: value.componentId, sessions }\n\t\t\t\t: undefined;\n\t\t}\n\t\tcase \"engine_session_picker_error\":\n\t\t\treturn typeof value.componentId === \"string\" && typeof value.message === \"string\"\n\t\t\t\t? { type: value.type, componentId: value.componentId, message: value.message }\n\t\t\t\t: undefined;\n\t\tcase \"engine_session_picker_close\":\n\t\tcase \"engine_input_form_close\":\n\t\t\treturn typeof value.componentId === \"string\"\n\t\t\t\t? { type: value.type, componentId: value.componentId }\n\t\t\t\t: undefined;\n\t\tcase \"engine_input_form_open\": {\n\t\t\tconst fields = parseInputFormFields(value.fields);\n\t\t\treturn typeof value.componentId === \"string\" && typeof value.title === \"string\" && fields\n\t\t\t\t? {\n\t\t\t\t\t\ttype: value.type,\n\t\t\t\t\t\tcomponentId: value.componentId,\n\t\t\t\t\t\ttitle: value.title,\n\t\t\t\t\t\tfields,\n\t\t\t\t\t\t...(typeof value.heading === \"string\" ? { heading: value.heading } : {}),\n\t\t\t\t\t\t...(typeof value.submitLabel === \"string\" ? { submitLabel: value.submitLabel } : {}),\n\t\t\t\t\t}\n\t\t\t\t: undefined;\n\t\t}\n\t\tdefault:\n\t\t\treturn undefined;\n\t}\n}\n\nexport function parseInteractiveEngineCommand(line: string): InteractiveEngineCommand | undefined {\n\tconst value = parseJsonObject(line);\n\tif (!value || typeof value.type !== \"string\" || typeof value.componentId !== \"string\") return undefined;\n\tif (value.type === \"engine_project_trust_end\") return { type: value.type, componentId: value.componentId };\n\tif (\n\t\tvalue.type === \"engine_project_trust_start\" &&\n\t\t(value.kind === \"select\" || value.kind === \"confirm\" || value.kind === \"input\") &&\n\t\ttypeof value.title === \"string\"\n\t) {\n\t\treturn { type: value.type, componentId: value.componentId, kind: value.kind, title: value.title };\n\t}\n\tif (\n\t\tvalue.type === \"engine_custom_scroll\" &&\n\t\tisJsonObject(value.state) &&\n\t\ttypeof value.state.scrollTop === \"number\" &&\n\t\ttypeof value.state.viewportHeight === \"number\" &&\n\t\ttypeof value.state.contentHeight === \"number\"\n\t) {\n\t\treturn {\n\t\t\ttype: value.type,\n\t\t\tcomponentId: value.componentId,\n\t\t\tstate: {\n\t\t\t\tscrollTop: value.state.scrollTop,\n\t\t\t\tviewportHeight: value.state.viewportHeight,\n\t\t\t\tcontentHeight: value.state.contentHeight,\n\t\t\t},\n\t\t};\n\t}\n\tif (\n\t\tvalue.type === \"engine_custom_render\" &&\n\t\ttypeof value.requestId === \"number\" &&\n\t\ttypeof value.width === \"number\" &&\n\t\ttypeof value.rows === \"number\"\n\t) {\n\t\treturn {\n\t\t\ttype: value.type,\n\t\t\tcomponentId: value.componentId,\n\t\t\trequestId: value.requestId,\n\t\t\twidth: value.width,\n\t\t\trows: value.rows,\n\t\t};\n\t}\n\tif (value.type === \"engine_custom_input\" && typeof value.requestId === \"number\" && typeof value.data === \"string\")\n\t\treturn { type: value.type, componentId: value.componentId, requestId: value.requestId, data: value.data };\n\tif (value.type === \"engine_custom_dispose\" || value.type === \"engine_render_dispose\")\n\t\treturn { type: value.type, componentId: value.componentId };\n\tif (\n\t\t(value.type === \"engine_session_picker_select\" || value.type === \"engine_session_picker_delete\") &&\n\t\ttypeof value.path === \"string\"\n\t) {\n\t\treturn { type: value.type, componentId: value.componentId, path: value.path };\n\t}\n\tif (value.type === \"engine_session_picker_cancel\") return { type: value.type, componentId: value.componentId };\n\tif (value.type === \"engine_input_form_cancel\") return { type: value.type, componentId: value.componentId };\n\tif (value.type === \"engine_input_form_submit\") {\n\t\tconst values = parseStringRecord(value.values);\n\t\treturn values ? { type: value.type, componentId: value.componentId, values } : undefined;\n\t}\n\tif (\n\t\tvalue.type === \"engine_tool_render\" &&\n\t\ttypeof value.requestId === \"number\" &&\n\t\ttypeof value.width === \"number\" &&\n\t\ttypeof value.toolName === \"string\" &&\n\t\ttypeof value.toolCallId === \"string\" &&\n\t\ttypeof value.executionStarted === \"boolean\" &&\n\t\ttypeof value.argsComplete === \"boolean\" &&\n\t\ttypeof value.isPartial === \"boolean\" &&\n\t\ttypeof value.expanded === \"boolean\" &&\n\t\ttypeof value.showImages === \"boolean\" &&\n\t\ttypeof value.imageWidthCells === \"number\"\n\t) {\n\t\treturn {\n\t\t\ttype: value.type,\n\t\t\tcomponentId: value.componentId,\n\t\t\trequestId: value.requestId,\n\t\t\twidth: value.width,\n\t\t\ttoolName: value.toolName,\n\t\t\ttoolCallId: value.toolCallId,\n\t\t\targs: value.args,\n\t\t\tresult: isJsonObject(value.result) ? value.result : undefined,\n\t\t\texecutionStarted: value.executionStarted,\n\t\t\targsComplete: value.argsComplete,\n\t\t\tisPartial: value.isPartial,\n\t\t\texpanded: value.expanded,\n\t\t\tshowImages: value.showImages,\n\t\t\timageWidthCells: value.imageWidthCells,\n\t\t};\n\t}\n\tif (\n\t\tvalue.type === \"engine_message_render\" &&\n\t\ttypeof value.requestId === \"number\" &&\n\t\ttypeof value.width === \"number\" &&\n\t\tisJsonObject(value.message) &&\n\t\ttypeof value.expanded === \"boolean\" &&\n\t\ttypeof value.outputPad === \"number\"\n\t) {\n\t\treturn {\n\t\t\ttype: value.type,\n\t\t\tcomponentId: value.componentId,\n\t\t\trequestId: value.requestId,\n\t\t\twidth: value.width,\n\t\t\tmessage: value.message,\n\t\t\texpanded: value.expanded,\n\t\t\toutputPad: value.outputPad,\n\t\t};\n\t}\n\treturn undefined;\n}\n\nexport function serializeInteractiveEngineFrame(message: InteractiveEngineMessage | InteractiveEngineCommand): string {\n\treturn `${JSON.stringify(message)}\\n`;\n}\n\nexport const serializeInteractiveEngineMessage = serializeInteractiveEngineFrame;\n"]}
1
+ {"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../../src/modes/interactive-engine/protocol.ts"],"names":[],"mappings":"AASA;;;;GAIG;AACH,MAAM,CAAC,M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CAAC,KAAK,KAAK,QAAQ;QAC/B,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC;QAC3B,OAAO,KAAK,CAAC,QAAQ,KAAK,SAAS;QACnC,OAAO,KAAK,CAAC,SAAS,KAAK,QAAQ,EAClC,CAAC;QACF,OAAO;YACN,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,SAAS,EAAE,KAAK,CAAC,SAAS;YAC1B,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,SAAS,EAAE,KAAK,CAAC,SAAS;SAC1B,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,+BAA+B,CAAC,OAA4D;IAC3G,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC;AACvC,CAAC;AAED,MAAM,CAAC,MAAM,iCAAiC,GAAG,+BAA+B,CAAC","sourcesContent":["import type { CallbackActivity, CallbackActivityKind } from \"../../core/callback-activity.ts\";\nimport type {\n\tHostInputFormField,\n\tHostSessionPickerRow,\n\tWidgetScrollRequest,\n\tWidgetScrollState,\n} from \"../../core/extensions/ui-types.js\";\nimport type { KeyId } from \"../../core/keybindings.ts\";\n\n/**\n * Version 4 separates minimal session binding from optional resource readiness.\n * A host must not submit a prompt until the matching engine generation reports\n * `engine_resources_ready`.\n */\nexport const INTERACTIVE_ENGINE_PROTOCOL_VERSION = 4;\n\nexport interface JsonObject {\n\t[key: string]: JsonValue;\n}\n\nexport type JsonValue = boolean | JsonObject | JsonValue[] | null | number | string;\n\nexport interface SerializableOverlayOptions {\n\tanchor?: string;\n\tcol?: number | string;\n\tmargin?: number | { top?: number; right?: number; bottom?: number; left?: number };\n\tmaxHeight?: number | string;\n\tmaxWidth?: number | string;\n\tminHeight?: number;\n\tminWidth?: number;\n\toffsetX?: number;\n\toffsetY?: number;\n\trow?: number | string;\n\twidth?: number | string;\n}\n\n/**\n * Allowlisted terminal-mode control a remote custom component may ask the host\n * to apply to the real host TTY. Deliberately NOT a raw byte channel: the child\n * names an intent and the host owns the concrete escape sequence, so a buggy or\n * compromised child can only toggle this documented mode.\n */\nexport type EngineTerminalControl = { kind: \"autowrap\"; enabled: boolean };\n\nexport interface EngineExtensionShortcut {\n\tkey: string;\n\tdescription?: string;\n\t/** Editor-owned input exclusions resolved in the engine and matched by the host. */\n\teditorKeys?: KeyId[];\n}\n\nexport type SerializableKeybindingsConfig = Record<string, KeyId | KeyId[]>;\n\nexport interface EngineKeybindingState {\n\tuserBindings: SerializableKeybindingsConfig;\n\teffectiveBindings: SerializableKeybindingsConfig;\n\tshortcuts: EngineExtensionShortcut[];\n}\n\nexport type InteractiveEngineMessage =\n\t| { type: \"engine_ready\"; protocolVersion: typeof INTERACTIVE_ENGINE_PROTOCOL_VERSION; pid: number }\n\t| { type: \"engine_bound\" }\n\t| { type: \"engine_resources_ready\" }\n\t| { type: \"engine_resources_failed\"; message: string }\n\t| { type: \"engine_keybindings_reloaded\"; state: EngineKeybindingState }\n\t| { type: \"engine_heartbeat\"; at: number }\n\t| { type: \"engine_activity_started\"; activity: CallbackActivity }\n\t| { type: \"engine_activity_finished\"; activityId: string }\n\t/**\n\t * The child took ownership of a correlated RPC request: it has parsed the\n\t * command and is about to run it. Emitted and flushed BEFORE any handler\n\t * work, so a later transport failure can be told apart from a send that\n\t * never landed. Output is not a substitute: a command can run to completion\n\t * with side effects and produce nothing.\n\t */\n\t| { type: \"engine_request_accepted\"; requestId: string; command: string }\n\t| {\n\t\t\ttype: \"engine_custom_open\";\n\t\t\tcomponentId: string;\n\t\t\toverlay: boolean;\n\t\t\tpurpose?: \"prompt\" | \"navigation\";\n\t\t\tdeferInlineCustomUiFocus?: boolean;\n\t\t\thandlesCtrlC?: boolean;\n\t\t\thandlesInternalUiAction?: boolean;\n\t\t\treserveTranscriptRows?: boolean;\n\t\t\toverlayOptions?: SerializableOverlayOptions;\n\t\t\twidgetKey?: string;\n\t\t\twidgetPlacement?: \"aboveEditor\" | \"belowEditor\";\n\t\t\twidgetScroll?: { maxHeight: number; maxHeightFraction?: number };\n\t }\n\t| { type: \"engine_custom_close\"; componentId: string }\n\t| {\n\t\t\ttype: \"engine_custom_frame\";\n\t\t\tcomponentId: string;\n\t\t\trequestId: number;\n\t\t\tlines: string[];\n\t\t\tscrollRequest?: WidgetScrollRequest;\n\t }\n\t| { type: \"engine_custom_input_result\"; componentId: string; requestId: number; handled: boolean }\n\t| { type: \"engine_custom_invalidate\"; componentId: string }\n\t| { type: \"engine_custom_done\"; componentId: string; result?: JsonValue }\n\t| { type: \"engine_custom_terminal\"; componentId: string; control: EngineTerminalControl }\n\t| { type: \"engine_custom_copy\"; componentId: string; requestId: number; text: string }\n\t| { type: \"engine_custom_control\"; componentId: string; action: \"focus\" | \"hide\" | \"show\" | \"unfocus\" }\n\t| {\n\t\t\ttype: \"engine_session_picker_open\";\n\t\t\tcomponentId: string;\n\t\t\tsessions: HostSessionPickerRow[];\n\t\t\tshowRenameHint?: boolean;\n\t }\n\t| { type: \"engine_session_picker_update\"; componentId: string; sessions: HostSessionPickerRow[] }\n\t| { type: \"engine_session_picker_error\"; componentId: string; message: string }\n\t| { type: \"engine_session_picker_close\"; componentId: string }\n\t| {\n\t\t\ttype: \"engine_input_form_open\";\n\t\t\tcomponentId: string;\n\t\t\ttitle: string;\n\t\t\tfields: HostInputFormField[];\n\t\t\theading?: string;\n\t\t\tsubmitLabel?: string;\n\t }\n\t| { type: \"engine_input_form_close\"; componentId: string };\nexport type InteractiveEngineCommand =\n\t| { type: \"engine_project_trust_start\"; componentId: string; kind: \"select\" | \"confirm\" | \"input\"; title: string }\n\t| { type: \"engine_project_trust_end\"; componentId: string }\n\t| { type: \"engine_custom_render\"; componentId: string; requestId: number; width: number; rows: number }\n\t| { type: \"engine_custom_input\"; componentId: string; requestId: number; data: string }\n\t| { type: \"engine_custom_copy_result\"; componentId: string; requestId: number; error?: string }\n\t| { type: \"engine_custom_scroll\"; componentId: string; state: WidgetScrollState }\n\t| { type: \"engine_custom_dispose\"; componentId: string }\n\t| {\n\t\t\ttype: \"engine_tool_render\";\n\t\t\tcomponentId: string;\n\t\t\trequestId: number;\n\t\t\twidth: number;\n\t\t\ttoolName: string;\n\t\t\ttoolCallId: string;\n\t\t\targs: JsonValue;\n\t\t\tresult?: JsonObject;\n\t\t\texecutionStarted: boolean;\n\t\t\targsComplete: boolean;\n\t\t\tisPartial: boolean;\n\t\t\texpanded: boolean;\n\t\t\tshowImages: boolean;\n\t\t\timageWidthCells: number;\n\t }\n\t| {\n\t\t\ttype: \"engine_message_render\";\n\t\t\tcomponentId: string;\n\t\t\trequestId: number;\n\t\t\twidth: number;\n\t\t\tmessage: JsonObject;\n\t\t\texpanded: boolean;\n\t\t\toutputPad: number;\n\t }\n\t| { type: \"engine_render_dispose\"; componentId: string }\n\t| { type: \"engine_session_picker_select\"; componentId: string; path: string }\n\t| { type: \"engine_session_picker_cancel\"; componentId: string }\n\t| { type: \"engine_session_picker_delete\"; componentId: string; path: string }\n\t| { type: \"engine_input_form_submit\"; componentId: string; values: Record<string, string> }\n\t| { type: \"engine_input_form_cancel\"; componentId: string };\n\nconst ACTIVITY_KINDS: readonly CallbackActivityKind[] = [\n\t\"extension.hook\",\n\t\"renderer\",\n\t\"tool.execute\",\n\t\"tool.prepare\",\n\t\"workflow.ctx_tool\",\n\t\"workflow.run\",\n\t\"workflow.stage_adapter\",\n];\n\nexport function isJsonValue(value: object | boolean | null | number | string): value is JsonValue {\n\tif (value === null || typeof value !== \"object\") return true;\n\tif (Array.isArray(value)) return value.every((item) => isJsonValue(item));\n\treturn Object.values(value).every((item) => item !== undefined && isJsonValue(item));\n}\n\nfunction isJsonObject(value: JsonValue): value is JsonObject {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction isActivityKind(value: JsonValue): value is CallbackActivityKind {\n\treturn typeof value === \"string\" && ACTIVITY_KINDS.includes(value as CallbackActivityKind);\n}\n\nfunction isCallbackActivity(value: JsonValue): value is JsonObject & CallbackActivity {\n\treturn (\n\t\tisJsonObject(value) &&\n\t\ttypeof value.id === \"string\" &&\n\t\tisActivityKind(value.kind) &&\n\t\ttypeof value.name === \"string\" &&\n\t\ttypeof value.startedAt === \"number\"\n\t);\n}\n\nfunction parseEngineTerminalControl(value: JsonValue | undefined): EngineTerminalControl | undefined {\n\tif (value === undefined || !isJsonObject(value) || value.kind !== \"autowrap\" || typeof value.enabled !== \"boolean\") {\n\t\treturn undefined;\n\t}\n\treturn { kind: \"autowrap\", enabled: value.enabled };\n}\n\nconst SESSION_PICKER_MESSAGE_COLORS = [\"success\", \"warning\", \"accent\", \"error\"] as const;\n\nfunction parseSessionPickerRow(value: JsonValue): HostSessionPickerRow | undefined {\n\tif (!isJsonObject(value)) return undefined;\n\tconst {\n\t\tpath,\n\t\tid,\n\t\tcwd,\n\t\tcreatedAt,\n\t\tmodifiedAt,\n\t\tmessageCount,\n\t\tfirstMessage,\n\t\tsummary,\n\t\tallMessagesText,\n\t\tname,\n\t\tmessageColor,\n\t} = value;\n\tif (\n\t\ttypeof path !== \"string\" ||\n\t\ttypeof id !== \"string\" ||\n\t\ttypeof cwd !== \"string\" ||\n\t\ttypeof createdAt !== \"number\" ||\n\t\ttypeof modifiedAt !== \"number\" ||\n\t\ttypeof messageCount !== \"number\" ||\n\t\ttypeof firstMessage !== \"string\"\n\t)\n\t\treturn undefined;\n\tif (summary !== undefined && typeof summary !== \"string\") return undefined;\n\tif (allMessagesText !== undefined && typeof allMessagesText !== \"string\") return undefined;\n\tif (name !== undefined && typeof name !== \"string\") return undefined;\n\tif (\n\t\tmessageColor !== undefined &&\n\t\t!SESSION_PICKER_MESSAGE_COLORS.includes(messageColor as (typeof SESSION_PICKER_MESSAGE_COLORS)[number])\n\t)\n\t\treturn undefined;\n\treturn {\n\t\tpath,\n\t\tid,\n\t\tcwd,\n\t\tcreatedAt,\n\t\tmodifiedAt,\n\t\tmessageCount,\n\t\tfirstMessage,\n\t\t...(summary !== undefined ? { summary } : {}),\n\t\t...(allMessagesText !== undefined ? { allMessagesText } : {}),\n\t\t...(name !== undefined ? { name } : {}),\n\t\t...(messageColor !== undefined\n\t\t\t? { messageColor: messageColor as (typeof SESSION_PICKER_MESSAGE_COLORS)[number] }\n\t\t\t: {}),\n\t};\n}\n\nfunction parseSessionPickerRows(value: JsonValue | undefined): HostSessionPickerRow[] | undefined {\n\tif (!Array.isArray(value)) return undefined;\n\tconst rows: HostSessionPickerRow[] = [];\n\tfor (const entry of value) {\n\t\tconst row = parseSessionPickerRow(entry);\n\t\tif (!row) return undefined;\n\t\trows.push(row);\n\t}\n\treturn rows;\n}\n\nconst INPUT_FORM_FIELD_TYPES = [\"string\", \"text\", \"number\", \"integer\", \"boolean\", \"select\"] as const;\n\nfunction parseInputFormFields(value: JsonValue | undefined): HostInputFormField[] | undefined {\n\tif (!Array.isArray(value)) return undefined;\n\tconst fields: HostInputFormField[] = [];\n\tfor (const entry of value) {\n\t\tif (!isJsonObject(entry)) return undefined;\n\t\tconst { name, type, description, required, choices, placeholder, initialValue } = entry;\n\t\tif (\n\t\t\ttypeof name !== \"string\" ||\n\t\t\t!INPUT_FORM_FIELD_TYPES.includes(type as HostInputFormField[\"type\"]) ||\n\t\t\ttypeof initialValue !== \"string\"\n\t\t)\n\t\t\treturn undefined;\n\t\tif (description !== undefined && typeof description !== \"string\") return undefined;\n\t\tif (required !== undefined && typeof required !== \"boolean\") return undefined;\n\t\tif (choices !== undefined && (!Array.isArray(choices) || !choices.every((choice) => typeof choice === \"string\")))\n\t\t\treturn undefined;\n\t\tif (placeholder !== undefined && typeof placeholder !== \"string\") return undefined;\n\t\tfields.push({\n\t\t\tname,\n\t\t\ttype: type as HostInputFormField[\"type\"],\n\t\t\tinitialValue,\n\t\t\t...(typeof description === \"string\" ? { description } : {}),\n\t\t\t...(typeof required === \"boolean\" ? { required } : {}),\n\t\t\t...(Array.isArray(choices) ? { choices: choices as string[] } : {}),\n\t\t\t...(typeof placeholder === \"string\" ? { placeholder } : {}),\n\t\t});\n\t}\n\treturn fields;\n}\n\nfunction parseStringRecord(value: JsonValue | undefined): Record<string, string> | undefined {\n\tif (value === undefined || !isJsonObject(value)) return undefined;\n\tconst entries = Object.entries(value);\n\tif (entries.some(([, entry]) => typeof entry !== \"string\")) return undefined;\n\treturn Object.fromEntries(entries) as Record<string, string>;\n}\n\nfunction parseKeybindingsConfig(value: JsonValue | undefined): SerializableKeybindingsConfig | undefined {\n\tif (value === undefined || !isJsonObject(value)) return undefined;\n\tconst config: SerializableKeybindingsConfig = {};\n\tfor (const [key, binding] of Object.entries(value)) {\n\t\tif (typeof binding === \"string\") config[key] = binding as SerializableKeybindingsConfig[string];\n\t\telse if (Array.isArray(binding) && binding.every((entry) => typeof entry === \"string\")) {\n\t\t\tconfig[key] = binding as SerializableKeybindingsConfig[string];\n\t\t} else return undefined;\n\t}\n\treturn config;\n}\n\nfunction parseKeybindingState(value: JsonValue | undefined): EngineKeybindingState | undefined {\n\tif (value === undefined || !isJsonObject(value) || !Array.isArray(value.shortcuts)) return undefined;\n\tconst userBindings = parseKeybindingsConfig(value.userBindings);\n\tconst effectiveBindings = parseKeybindingsConfig(value.effectiveBindings);\n\tif (!userBindings || !effectiveBindings) return undefined;\n\tconst shortcuts: EngineExtensionShortcut[] = [];\n\tfor (const shortcut of value.shortcuts) {\n\t\tif (\n\t\t\t!isJsonObject(shortcut) ||\n\t\t\ttypeof shortcut.key !== \"string\" ||\n\t\t\t(shortcut.description !== undefined && typeof shortcut.description !== \"string\") ||\n\t\t\t(shortcut.editorKeys !== undefined &&\n\t\t\t\t(!Array.isArray(shortcut.editorKeys) || shortcut.editorKeys.some((key) => typeof key !== \"string\")))\n\t\t)\n\t\t\treturn undefined;\n\t\tshortcuts.push({\n\t\t\tkey: shortcut.key,\n\t\t\t...(typeof shortcut.description === \"string\" ? { description: shortcut.description } : {}),\n\t\t\t...(Array.isArray(shortcut.editorKeys) ? { editorKeys: shortcut.editorKeys as KeyId[] } : {}),\n\t\t});\n\t}\n\treturn { userBindings, effectiveBindings, shortcuts };\n}\n\nfunction parseJsonObject(line: string): JsonObject | undefined {\n\tlet value: JsonValue;\n\ttry {\n\t\tvalue = JSON.parse(line) as JsonValue;\n\t} catch {\n\t\treturn undefined;\n\t}\n\treturn isJsonObject(value) ? value : undefined;\n}\n\nexport function parseInteractiveEngineMessage(line: string): InteractiveEngineMessage | undefined {\n\tconst value = parseJsonObject(line);\n\tif (!value || typeof value.type !== \"string\") return undefined;\n\tswitch (value.type) {\n\t\tcase \"engine_ready\":\n\t\t\treturn value.protocolVersion === INTERACTIVE_ENGINE_PROTOCOL_VERSION && typeof value.pid === \"number\"\n\t\t\t\t? { type: value.type, protocolVersion: INTERACTIVE_ENGINE_PROTOCOL_VERSION, pid: value.pid }\n\t\t\t\t: undefined;\n\t\tcase \"engine_bound\":\n\t\t\treturn { type: value.type };\n\t\tcase \"engine_resources_ready\":\n\t\t\treturn { type: value.type };\n\t\tcase \"engine_resources_failed\":\n\t\t\treturn typeof value.message === \"string\" ? { type: value.type, message: value.message } : undefined;\n\t\tcase \"engine_keybindings_reloaded\": {\n\t\t\tconst state = parseKeybindingState(value.state);\n\t\t\treturn state ? { type: value.type, state } : undefined;\n\t\t}\n\t\tcase \"engine_heartbeat\":\n\t\t\treturn typeof value.at === \"number\" ? { type: value.type, at: value.at } : undefined;\n\t\tcase \"engine_activity_started\":\n\t\t\treturn isCallbackActivity(value.activity) ? { type: value.type, activity: value.activity } : undefined;\n\t\tcase \"engine_activity_finished\":\n\t\t\treturn typeof value.activityId === \"string\" ? { type: value.type, activityId: value.activityId } : undefined;\n\t\tcase \"engine_request_accepted\":\n\t\t\treturn typeof value.requestId === \"string\" && typeof value.command === \"string\"\n\t\t\t\t? { type: value.type, requestId: value.requestId, command: value.command }\n\t\t\t\t: undefined;\n\t\tcase \"engine_custom_open\":\n\t\t\treturn typeof value.componentId === \"string\" && typeof value.overlay === \"boolean\"\n\t\t\t\t? {\n\t\t\t\t\t\ttype: value.type,\n\t\t\t\t\t\tcomponentId: value.componentId,\n\t\t\t\t\t\toverlay: value.overlay,\n\t\t\t\t\t\t...(value.purpose === \"navigation\" || value.purpose === \"prompt\" ? { purpose: value.purpose } : {}),\n\t\t\t\t\t\tdeferInlineCustomUiFocus: value.deferInlineCustomUiFocus === true,\n\t\t\t\t\t\thandlesCtrlC: value.handlesCtrlC === true,\n\t\t\t\t\t\thandlesInternalUiAction: value.handlesInternalUiAction === true,\n\t\t\t\t\t\treserveTranscriptRows: value.reserveTranscriptRows === true,\n\t\t\t\t\t\toverlayOptions: isJsonObject(value.overlayOptions)\n\t\t\t\t\t\t\t? (value.overlayOptions as SerializableOverlayOptions)\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\twidgetKey: typeof value.widgetKey === \"string\" ? value.widgetKey : undefined,\n\t\t\t\t\t\t...(isJsonObject(value.widgetScroll) && typeof value.widgetScroll.maxHeight === \"number\"\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\twidgetScroll: {\n\t\t\t\t\t\t\t\t\t\tmaxHeight: value.widgetScroll.maxHeight,\n\t\t\t\t\t\t\t\t\t\t...(typeof value.widgetScroll.maxHeightFraction === \"number\"\n\t\t\t\t\t\t\t\t\t\t\t? { maxHeightFraction: value.widgetScroll.maxHeightFraction }\n\t\t\t\t\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\twidgetPlacement:\n\t\t\t\t\t\t\tvalue.widgetPlacement === \"belowEditor\"\n\t\t\t\t\t\t\t\t? \"belowEditor\"\n\t\t\t\t\t\t\t\t: value.widgetPlacement === \"aboveEditor\"\n\t\t\t\t\t\t\t\t\t? \"aboveEditor\"\n\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t}\n\t\t\t\t: undefined;\n\t\tcase \"engine_custom_close\":\n\t\t\treturn typeof value.componentId === \"string\"\n\t\t\t\t? { type: value.type, componentId: value.componentId }\n\t\t\t\t: undefined;\n\t\tcase \"engine_custom_frame\":\n\t\t\treturn typeof value.componentId === \"string\" &&\n\t\t\t\ttypeof value.requestId === \"number\" &&\n\t\t\t\tArray.isArray(value.lines) &&\n\t\t\t\tvalue.lines.every((entry) => typeof entry === \"string\")\n\t\t\t\t? {\n\t\t\t\t\t\ttype: value.type,\n\t\t\t\t\t\tcomponentId: value.componentId,\n\t\t\t\t\t\trequestId: value.requestId,\n\t\t\t\t\t\tlines: value.lines,\n\t\t\t\t\t\t...(isJsonObject(value.scrollRequest) &&\n\t\t\t\t\t\ttypeof value.scrollRequest.version === \"number\" &&\n\t\t\t\t\t\ttypeof value.scrollRequest.scrollTop === \"number\"\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\tscrollRequest: {\n\t\t\t\t\t\t\t\t\t\tversion: value.scrollRequest.version,\n\t\t\t\t\t\t\t\t\t\tscrollTop: value.scrollRequest.scrollTop,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t}\n\t\t\t\t: undefined;\n\t\tcase \"engine_custom_input_result\":\n\t\t\treturn typeof value.componentId === \"string\" &&\n\t\t\t\ttypeof value.requestId === \"number\" &&\n\t\t\t\ttypeof value.handled === \"boolean\"\n\t\t\t\t? { type: value.type, componentId: value.componentId, requestId: value.requestId, handled: value.handled }\n\t\t\t\t: undefined;\n\t\tcase \"engine_custom_invalidate\":\n\t\t\treturn typeof value.componentId === \"string\"\n\t\t\t\t? { type: value.type, componentId: value.componentId }\n\t\t\t\t: undefined;\n\t\tcase \"engine_custom_done\":\n\t\t\treturn typeof value.componentId === \"string\"\n\t\t\t\t? { type: value.type, componentId: value.componentId, result: value.result }\n\t\t\t\t: undefined;\n\t\tcase \"engine_custom_copy\":\n\t\t\treturn typeof value.componentId === \"string\" &&\n\t\t\t\ttypeof value.requestId === \"number\" &&\n\t\t\t\ttypeof value.text === \"string\"\n\t\t\t\t? { type: value.type, componentId: value.componentId, requestId: value.requestId, text: value.text }\n\t\t\t\t: undefined;\n\t\tcase \"engine_custom_terminal\": {\n\t\t\tconst control = parseEngineTerminalControl(value.control);\n\t\t\treturn typeof value.componentId === \"string\" && control\n\t\t\t\t? { type: value.type, componentId: value.componentId, control }\n\t\t\t\t: undefined;\n\t\t}\n\t\tcase \"engine_custom_control\":\n\t\t\treturn typeof value.componentId === \"string\" &&\n\t\t\t\t[\"focus\", \"hide\", \"show\", \"unfocus\"].includes(String(value.action))\n\t\t\t\t? {\n\t\t\t\t\t\ttype: value.type,\n\t\t\t\t\t\tcomponentId: value.componentId,\n\t\t\t\t\t\taction: value.action as \"focus\" | \"hide\" | \"show\" | \"unfocus\",\n\t\t\t\t\t}\n\t\t\t\t: undefined;\n\t\tcase \"engine_session_picker_open\": {\n\t\t\tconst sessions = parseSessionPickerRows(value.sessions);\n\t\t\treturn typeof value.componentId === \"string\" &&\n\t\t\t\tsessions &&\n\t\t\t\t(value.showRenameHint === undefined || typeof value.showRenameHint === \"boolean\")\n\t\t\t\t? {\n\t\t\t\t\t\ttype: value.type,\n\t\t\t\t\t\tcomponentId: value.componentId,\n\t\t\t\t\t\tsessions,\n\t\t\t\t\t\t...(typeof value.showRenameHint === \"boolean\" ? { showRenameHint: value.showRenameHint } : {}),\n\t\t\t\t\t}\n\t\t\t\t: undefined;\n\t\t}\n\t\tcase \"engine_session_picker_update\": {\n\t\t\tconst sessions = parseSessionPickerRows(value.sessions);\n\t\t\treturn typeof value.componentId === \"string\" && sessions\n\t\t\t\t? { type: value.type, componentId: value.componentId, sessions }\n\t\t\t\t: undefined;\n\t\t}\n\t\tcase \"engine_session_picker_error\":\n\t\t\treturn typeof value.componentId === \"string\" && typeof value.message === \"string\"\n\t\t\t\t? { type: value.type, componentId: value.componentId, message: value.message }\n\t\t\t\t: undefined;\n\t\tcase \"engine_session_picker_close\":\n\t\tcase \"engine_input_form_close\":\n\t\t\treturn typeof value.componentId === \"string\"\n\t\t\t\t? { type: value.type, componentId: value.componentId }\n\t\t\t\t: undefined;\n\t\tcase \"engine_input_form_open\": {\n\t\t\tconst fields = parseInputFormFields(value.fields);\n\t\t\treturn typeof value.componentId === \"string\" && typeof value.title === \"string\" && fields\n\t\t\t\t? {\n\t\t\t\t\t\ttype: value.type,\n\t\t\t\t\t\tcomponentId: value.componentId,\n\t\t\t\t\t\ttitle: value.title,\n\t\t\t\t\t\tfields,\n\t\t\t\t\t\t...(typeof value.heading === \"string\" ? { heading: value.heading } : {}),\n\t\t\t\t\t\t...(typeof value.submitLabel === \"string\" ? { submitLabel: value.submitLabel } : {}),\n\t\t\t\t\t}\n\t\t\t\t: undefined;\n\t\t}\n\t\tdefault:\n\t\t\treturn undefined;\n\t}\n}\n\nexport function parseInteractiveEngineCommand(line: string): InteractiveEngineCommand | undefined {\n\tconst value = parseJsonObject(line);\n\tif (!value || typeof value.type !== \"string\" || typeof value.componentId !== \"string\") return undefined;\n\tif (value.type === \"engine_project_trust_end\") return { type: value.type, componentId: value.componentId };\n\tif (\n\t\tvalue.type === \"engine_project_trust_start\" &&\n\t\t(value.kind === \"select\" || value.kind === \"confirm\" || value.kind === \"input\") &&\n\t\ttypeof value.title === \"string\"\n\t) {\n\t\treturn { type: value.type, componentId: value.componentId, kind: value.kind, title: value.title };\n\t}\n\tif (\n\t\tvalue.type === \"engine_custom_scroll\" &&\n\t\tisJsonObject(value.state) &&\n\t\ttypeof value.state.scrollTop === \"number\" &&\n\t\ttypeof value.state.viewportHeight === \"number\" &&\n\t\ttypeof value.state.contentHeight === \"number\"\n\t) {\n\t\treturn {\n\t\t\ttype: value.type,\n\t\t\tcomponentId: value.componentId,\n\t\t\tstate: {\n\t\t\t\tscrollTop: value.state.scrollTop,\n\t\t\t\tviewportHeight: value.state.viewportHeight,\n\t\t\t\tcontentHeight: value.state.contentHeight,\n\t\t\t},\n\t\t};\n\t}\n\tif (\n\t\tvalue.type === \"engine_custom_render\" &&\n\t\ttypeof value.requestId === \"number\" &&\n\t\ttypeof value.width === \"number\" &&\n\t\ttypeof value.rows === \"number\"\n\t) {\n\t\treturn {\n\t\t\ttype: value.type,\n\t\t\tcomponentId: value.componentId,\n\t\t\trequestId: value.requestId,\n\t\t\twidth: value.width,\n\t\t\trows: value.rows,\n\t\t};\n\t}\n\tif (value.type === \"engine_custom_input\" && typeof value.requestId === \"number\" && typeof value.data === \"string\")\n\t\treturn { type: value.type, componentId: value.componentId, requestId: value.requestId, data: value.data };\n\tif (\n\t\tvalue.type === \"engine_custom_copy_result\" &&\n\t\ttypeof value.requestId === \"number\" &&\n\t\t(value.error === undefined || typeof value.error === \"string\")\n\t)\n\t\treturn { type: value.type, componentId: value.componentId, requestId: value.requestId, error: value.error };\n\tif (value.type === \"engine_custom_dispose\" || value.type === \"engine_render_dispose\")\n\t\treturn { type: value.type, componentId: value.componentId };\n\tif (\n\t\t(value.type === \"engine_session_picker_select\" || value.type === \"engine_session_picker_delete\") &&\n\t\ttypeof value.path === \"string\"\n\t) {\n\t\treturn { type: value.type, componentId: value.componentId, path: value.path };\n\t}\n\tif (value.type === \"engine_session_picker_cancel\") return { type: value.type, componentId: value.componentId };\n\tif (value.type === \"engine_input_form_cancel\") return { type: value.type, componentId: value.componentId };\n\tif (value.type === \"engine_input_form_submit\") {\n\t\tconst values = parseStringRecord(value.values);\n\t\treturn values ? { type: value.type, componentId: value.componentId, values } : undefined;\n\t}\n\tif (\n\t\tvalue.type === \"engine_tool_render\" &&\n\t\ttypeof value.requestId === \"number\" &&\n\t\ttypeof value.width === \"number\" &&\n\t\ttypeof value.toolName === \"string\" &&\n\t\ttypeof value.toolCallId === \"string\" &&\n\t\ttypeof value.executionStarted === \"boolean\" &&\n\t\ttypeof value.argsComplete === \"boolean\" &&\n\t\ttypeof value.isPartial === \"boolean\" &&\n\t\ttypeof value.expanded === \"boolean\" &&\n\t\ttypeof value.showImages === \"boolean\" &&\n\t\ttypeof value.imageWidthCells === \"number\"\n\t) {\n\t\treturn {\n\t\t\ttype: value.type,\n\t\t\tcomponentId: value.componentId,\n\t\t\trequestId: value.requestId,\n\t\t\twidth: value.width,\n\t\t\ttoolName: value.toolName,\n\t\t\ttoolCallId: value.toolCallId,\n\t\t\targs: value.args,\n\t\t\tresult: isJsonObject(value.result) ? value.result : undefined,\n\t\t\texecutionStarted: value.executionStarted,\n\t\t\targsComplete: value.argsComplete,\n\t\t\tisPartial: value.isPartial,\n\t\t\texpanded: value.expanded,\n\t\t\tshowImages: value.showImages,\n\t\t\timageWidthCells: value.imageWidthCells,\n\t\t};\n\t}\n\tif (\n\t\tvalue.type === \"engine_message_render\" &&\n\t\ttypeof value.requestId === \"number\" &&\n\t\ttypeof value.width === \"number\" &&\n\t\tisJsonObject(value.message) &&\n\t\ttypeof value.expanded === \"boolean\" &&\n\t\ttypeof value.outputPad === \"number\"\n\t) {\n\t\treturn {\n\t\t\ttype: value.type,\n\t\t\tcomponentId: value.componentId,\n\t\t\trequestId: value.requestId,\n\t\t\twidth: value.width,\n\t\t\tmessage: value.message,\n\t\t\texpanded: value.expanded,\n\t\t\toutputPad: value.outputPad,\n\t\t};\n\t}\n\treturn undefined;\n}\n\nexport function serializeInteractiveEngineFrame(message: InteractiveEngineMessage | InteractiveEngineCommand): string {\n\treturn `${JSON.stringify(message)}\\n`;\n}\n\nexport const serializeInteractiveEngineMessage = serializeInteractiveEngineFrame;\n"]}
@@ -19,7 +19,8 @@ export declare class RemoteComponentController {
19
19
  private readonly unsubscribeTuiRendererReplaced;
20
20
  private readonly runtime;
21
21
  private readonly ui;
22
- constructor(runtime: RemoteComponentRuntime, ui: RemoteComponentUI, tuiRendererLifecycle: TuiRendererLifecycle);
22
+ private readonly copyText;
23
+ constructor(runtime: RemoteComponentRuntime, ui: RemoteComponentUI, tuiRendererLifecycle: TuiRendererLifecycle, copyText?: (text: string) => Promise<void>);
23
24
  dispose(): void;
24
25
  /** The remote overlay proxy that currently holds focus (see remote-input-ownership.ts). */
25
26
  focusedRemoteOverlay(): unknown;
@@ -1 +1 @@
1
- {"version":3,"file":"remote-component.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive-engine/remote-component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEzE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAKxE,MAAM,MAAM,sBAAsB,GAAG,IAAI,CACxC,0BAA0B,EAC1B,iBAAiB,GAAG,mBAAmB,GAAG,mBAAmB,CAC7D,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,kBAAkB,EAAE,QAAQ,GAAG,eAAe,GAAG,WAAW,GAAG,iBAAiB,CAAC,CAAC;AAevH;;;GAGG;AACH,eAAO,MAAM,6BAA6B,MAAM,CAAC;AAwJjD,MAAM,WAAW,oBAAoB;IACpC,YAAY,IAAI,OAAO,CAAC;IACxB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC;CACrD;AAED,qBAAa,yBAAyB;IACrC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA6C;IACrE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAa;IACzC,OAAO,CAAC,QAAQ,CAAC,0BAA0B,CAAa;IACxD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAyB;IACvD,OAAO,CAAC,QAAQ,CAAC,8BAA8B,CAAa;IAE5D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAyB;IACjD,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAoB;IAEvC,YAAY,OAAO,EAAE,sBAAsB,EAAE,EAAE,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,oBAAoB,EAY7G;IAED,OAAO,IAAI,IAAI,CAKd;IAED,2FAA2F;IAC3F,oBAAoB,IAAI,OAAO,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yB;IACvD,OAAO,CAAC,QAAQ,CAAC,8BAA8B,CAAa;IAE5D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAyB;IACjD,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAoB;IACvC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAkC;IAE3D,YACC,OAAO,EAAE,sBAAsB,EAC/B,EAAE,EAAE,iBAAiB,EACrB,oBAAoB,EAAE,oBAAoB,EAC1C,QAAQ,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAmB,EAc3D;IAED,OAAO,IAAI,IAAI,CAKd;IAED,2FAA2F;IAC3F,oBAAoB,IAAI,OAAO,CAK9B;IAED,sFAAsF;IACtF,gBAAgB,CAAC,SAAS,EAAE,OAAO,GAAG,OAAO,CAM5C;IAED,iFAAiF;IACjF,uBAAuB,CAAC,SAAS,EAAE,OAAO,GAAG,OAAO,CAKnD;IAED;;;;;;;;;;OAUG;IACH,kBAAkB,CAAC,SAAS,EAAE,OAAO,GAAG,OAAO,CAQ9C;IAED,OAAO,CAAC,aAAa;IASrB;;;;;;;;;;;;;;;;;OAiBG;IACH,OAAO,CAAC,UAAU;IAclB,OAAO,CAAC,aAAa;IAwErB,OAAO,CAAC,IAAI;IAoFZ,OAAO,CAAC,KAAK;IAUb,OAAO,CAAC,OAAO;CAkBf"}
@@ -1,3 +1,4 @@
1
+ import { copyToClipboard } from "../../utils/clipboard.js";
1
2
  import { RemoteFrameWidthClamp } from "./remote-frame-clamp.js";
2
3
  import { TerminalModeController } from "./terminal-mode-controller.js";
3
4
  /**
@@ -147,9 +148,11 @@ export class RemoteComponentController {
147
148
  unsubscribeTuiRendererReplaced;
148
149
  runtime;
149
150
  ui;
150
- constructor(runtime, ui, tuiRendererLifecycle) {
151
+ copyText;
152
+ constructor(runtime, ui, tuiRendererLifecycle, copyText = copyToClipboard) {
151
153
  this.runtime = runtime;
152
154
  this.ui = ui;
155
+ this.copyText = copyText;
153
156
  this.terminalModes = new TerminalModeController(() => tuiRendererLifecycle.isFullscreen());
154
157
  this.unsubscribeTuiRendererReplaced = tuiRendererLifecycle.onRendererReplaced(() => this.terminalModes.rebindTui());
155
158
  this.unsubscribe = runtime.onEngineMessage((message) => this.handleMessage(message));
@@ -281,6 +284,25 @@ export class RemoteComponentController {
281
284
  case "engine_custom_invalidate":
282
285
  this.mounted.get(message.componentId)?.component.requestRemoteRender();
283
286
  break;
287
+ case "engine_custom_copy":
288
+ void (async () => {
289
+ let error;
290
+ try {
291
+ if (!this.mounted.has(message.componentId))
292
+ throw new Error("Sign-in screen is no longer open");
293
+ await this.copyText(message.text);
294
+ }
295
+ catch (cause) {
296
+ error = cause instanceof Error ? cause.message : String(cause);
297
+ }
298
+ this.runtime.sendEngineCommand({
299
+ type: "engine_custom_copy_result",
300
+ componentId: message.componentId,
301
+ requestId: message.requestId,
302
+ error,
303
+ });
304
+ })();
305
+ break;
284
306
  case "engine_custom_terminal":
285
307
  this.terminalModes.applyControl(message.componentId, message.control);
286
308
  break;
@@ -1 +1 @@
1
- {"version":3,"file":"remote-component.js","sourceRoot":"","sources":["../../../src/modes/interactive-engine/remote-component.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAsBvE;;;GAGG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,GAAG,CAAC;AAOjD,MAAM,eAAe;IACZ,aAAa,CAAkC;IACvD,gBAAgB;QACf,OAAO,IAAI,CAAC,aAAa,CAAC;IAC3B,CAAC;IACD,QAAQ,CAAC,KAAwB;QAChC,IAAI,CAAC,IAAI,CAAC,QAAQ;YACjB,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,EAAE,IAAI,EAAE,sBAAsB,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC;IACzG,CAAC;IACD,eAAe,G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,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;QAC1C,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QACjC,MAAM,CAAC,wBAAwB,EAAE,EAAE,CAAC;QACpC,IAAI,MAAM,CAAC,SAAS;YAAE,IAAI,CAAC,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QACrE,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;IAC5B,CAAC;IAEO,OAAO,CAAC,WAAmB,EAAE,MAA6C;QACjF,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QACrD,IAAI,CAAC,MAAM;YAAE,OAAO;QACpB,QAAQ,MAAM,EAAE,CAAC;YAChB,KAAK,OAAO;gBACX,MAAM,CAAC,KAAK,EAAE,CAAC;gBACf,MAAM;YACP,KAAK,MAAM;gBACV,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;gBACvB,MAAM;YACP,KAAK,MAAM;gBACV,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;gBACxB,MAAM;YACP,KAAK,SAAS;gBACb,MAAM,CAAC,OAAO,EAAE,CAAC;gBACjB,MAAM;QACR,CAAC;IACF,CAAC;CACD","sourcesContent":["import type { Component, OverlayHandle, OverlayOptions, TUI } from \"@earendil-works/pi-tui\";\nimport type { ExtensionUIContext } from \"../../core/extensions/index.js\";\nimport type { WidgetScrollRequest, WidgetScrollState } from \"../../core/extensions/ui-types.js\";\nimport type { IsolatedInteractiveRuntime } from \"./isolated-runtime.js\";\nimport type { InteractiveEngineMessage, JsonValue, SerializableOverlayOptions } from \"./protocol.ts\";\nimport { RemoteFrameWidthClamp } from \"./remote-frame-clamp.ts\";\nimport { TerminalModeController } from \"./terminal-mode-controller.ts\";\n\nexport type RemoteComponentRuntime = Pick<\n\tIsolatedInteractiveRuntime,\n\t\"onEngineMessage\" | \"onGenerationEnded\" | \"sendEngineCommand\"\n>;\n\nexport type RemoteComponentUI = Pick<ExtensionUIContext, \"custom\" | \"requestRender\" | \"setWidget\" | \"onWidgetRelease\">;\n\ninterface MountedRemoteComponent {\n\tcomponent: RemoteComponent;\n\tdone: (result: JsonValue | undefined) => void;\n\tengineDone: boolean;\n\t/** The extension declared that this component binds Ctrl+C itself. */\n\thandlesCtrlC: boolean;\n\t/** The extension declared that this component claims internal UI actions. */\n\thandlesInternalUiAction: boolean;\n\thandle?: OverlayHandle;\n\twidgetKey?: string;\n\tunsubscribeWidgetRelease?: () => void;\n}\n\n/**\n * A stalled engine must not make fullscreen input wait forever. A timed-out\n * reply is treated as unhandled and lets the viewport process the key.\n */\nexport const REMOTE_INPUT_REPLY_TIMEOUT_MS = 250;\n\ninterface PendingInput {\n\tresolve: (handled: boolean | undefined) => void;\n\ttimer: ReturnType<typeof setTimeout>;\n}\n\nclass RemoteComponent implements Component {\n\tprivate scrollRequest: WidgetScrollRequest | undefined;\n\tgetScrollRequest(): WidgetScrollRequest | undefined {\n\t\treturn this.scrollRequest;\n\t}\n\tonScroll(state: WidgetScrollState): void {\n\t\tif (!this.disposed)\n\t\t\tthis.runtime.sendEngineCommand({ type: \"engine_custom_scroll\", componentId: this.componentId, state });\n\t}\n\twantsKeyRelease = true;\n\treadonly handlesInternalUiAction: boolean;\n\tprivate lines = [\"Loading remote component…\"];\n\tprivate width = 0;\n\tprivate rows = 0;\n\tprivate requestId = 0;\n\tprivate inputRequestId = 0;\n\tprivate appliedRequestId = 0;\n\tprivate dirty = true;\n\tprivate disposed = false;\n\tprivate readonly pendingInputs = new Map<number, PendingInput>();\n\tprivate readonly frameClamp = new RemoteFrameWidthClamp();\n\n\tprivate readonly componentId: string;\n\tprivate readonly runtime: RemoteComponentRuntime;\n\tprivate readonly requestRender: () => void;\n\tprivate readonly getRows: () => number;\n\n\tconstructor(\n\t\tcomponentId: string,\n\t\truntime: RemoteComponentRuntime,\n\t\trequestRender: () => void,\n\t\tgetRows: () => number,\n\t\thandlesInternalUiAction = false,\n\t) {\n\t\tthis.componentId = componentId;\n\t\tthis.runtime = runtime;\n\t\tthis.requestRender = requestRender;\n\t\tthis.getRows = getRows;\n\t\tthis.handlesInternalUiAction = handlesInternalUiAction;\n\t}\n\n\trender(width: number): string[] {\n\t\tconst rows = this.getRows();\n\t\tif (!this.disposed && (this.dirty || width !== this.width || rows !== this.rows)) {\n\t\t\tthis.width = width;\n\t\t\tthis.rows = rows;\n\t\t\tthis.dirty = false;\n\t\t\tthis.runtime.sendEngineCommand({\n\t\t\t\ttype: \"engine_custom_render\",\n\t\t\t\tcomponentId: this.componentId,\n\t\t\t\trequestId: ++this.requestId,\n\t\t\t\twidth,\n\t\t\t\trows,\n\t\t\t});\n\t\t}\n\t\t// The engine child re-renders asynchronously; until the fresh frame\n\t\t// arrives, the previous frame may be wrapped for an older terminal\n\t\t// width. Clamp so a resize never replays overflowing lines (pi-tui\n\t\t// crashes on any rendered line wider than the terminal).\n\t\treturn this.frameClamp.clamp(this.lines, width);\n\t}\n\n\thandleInput(data: string): Promise<boolean | undefined> {\n\t\tif (this.disposed) return Promise.resolve(undefined);\n\t\tconst requestId = ++this.inputRequestId;\n\t\tconst result = new Promise<boolean | undefined>((resolve) => {\n\t\t\tconst timer = setTimeout(() => this.resolveInput(requestId, false), REMOTE_INPUT_REPLY_TIMEOUT_MS);\n\t\t\ttimer.unref?.();\n\t\t\tthis.pendingInputs.set(requestId, { resolve, timer });\n\t\t});\n\t\ttry {\n\t\t\tthis.runtime.sendEngineCommand({\n\t\t\t\ttype: \"engine_custom_input\",\n\t\t\t\tcomponentId: this.componentId,\n\t\t\t\trequestId,\n\t\t\t\tdata,\n\t\t\t});\n\t\t} catch {\n\t\t\tthis.resolveInput(requestId, false);\n\t\t}\n\t\t// Engine commands are delivered in order, so a frame requested now is\n\t\t// rendered by the child only AFTER it has applied this input. Pipelining\n\t\t// the request keeps keypress latency at a single round trip and repaints\n\t\t// components that never self-invalidate, instead of waiting for a\n\t\t// child-side invalidate (or an unrelated refresh) to trigger a frame.\n\t\tthis.dirty = true;\n\t\tthis.requestRender();\n\t\treturn result;\n\t}\n\n\tresolveInput(requestId: number, handled: boolean | undefined): void {\n\t\tconst pending = this.pendingInputs.get(requestId);\n\t\tif (!pending) return;\n\t\tthis.pendingInputs.delete(requestId);\n\t\tclearTimeout(pending.timer);\n\t\tpending.resolve(handled);\n\t}\n\n\tinvalidate(): void {\n\t\tthis.dirty = true;\n\t}\n\n\tapplyFrame(requestId: number, lines: string[], scrollRequest?: WidgetScrollRequest): void {\n\t\tif (this.disposed || requestId < this.appliedRequestId) return;\n\t\tthis.appliedRequestId = requestId;\n\t\tthis.lines = lines;\n\t\tthis.scrollRequest = scrollRequest;\n\t\tthis.requestRender();\n\t}\n\n\trequestRemoteRender(): void {\n\t\tif (this.disposed) return;\n\t\tthis.dirty = true;\n\t\tthis.requestRender();\n\t}\n\n\t/**\n\t * Tear the proxy down. `notifyEngine` must be false once the writer no longer\n\t * points at the generation that owns this component: component IDs restart at\n\t * `remote_component_1` for every child, so a late dispose would address an\n\t * unrelated component in the replacement engine.\n\t */\n\tdispose(notifyEngine = true): void {\n\t\tif (this.disposed) return;\n\t\tthis.disposed = true;\n\t\tfor (const requestId of [...this.pendingInputs.keys()]) this.resolveInput(requestId, undefined);\n\t\tif (notifyEngine)\n\t\t\tthis.runtime.sendEngineCommand({ type: \"engine_custom_dispose\", componentId: this.componentId });\n\t}\n}\n\nfunction overlayOptions(options: SerializableOverlayOptions | undefined): OverlayOptions | undefined {\n\treturn options as OverlayOptions | undefined;\n}\n\n/**\n * Resolve the real host terminal from the pi-tui TUI handed to the overlay\n * factory. Optional: some hosts / test seams do not surface `tui.terminal`, in\n * which case terminal-mode controls harmlessly no-op.\n */\nfunction hostTerminal(tui: TUI): { write(data: string): void } {\n\tconst terminal = (tui as { terminal?: { write?(data: string): void } }).terminal;\n\treturn typeof terminal?.write === \"function\" ? (terminal as { write(data: string): void }) : { write: () => {} };\n}\n\nexport interface TuiRendererLifecycle {\n\tisFullscreen(): boolean;\n\tonRendererReplaced(listener: () => void): () => void;\n}\n\nexport class RemoteComponentController {\n\tprivate readonly mounted = new Map<string, MountedRemoteComponent>();\n\tprivate readonly unsubscribe: () => void;\n\tprivate readonly unsubscribeGenerationEnded: () => void;\n\tprivate readonly terminalModes: TerminalModeController;\n\tprivate readonly unsubscribeTuiRendererReplaced: () => void;\n\n\tprivate readonly runtime: RemoteComponentRuntime;\n\tprivate readonly ui: RemoteComponentUI;\n\n\tconstructor(runtime: RemoteComponentRuntime, ui: RemoteComponentUI, tuiRendererLifecycle: TuiRendererLifecycle) {\n\t\tthis.runtime = runtime;\n\t\tthis.ui = ui;\n\t\tthis.terminalModes = new TerminalModeController(() => tuiRendererLifecycle.isFullscreen());\n\t\tthis.unsubscribeTuiRendererReplaced = tuiRendererLifecycle.onRendererReplaced(() =>\n\t\t\tthis.terminalModes.rebindTui(),\n\t\t);\n\t\tthis.unsubscribe = runtime.onEngineMessage((message) => this.handleMessage(message));\n\t\t// Teardown is driven by engine death rather than the NEXT generation's\n\t\t// `engine_ready`, so a crash with no restart, or a hung/failed restart,\n\t\t// still releases the host editor, focus, and inline-custom-UI depth.\n\t\tthis.unsubscribeGenerationEnded = runtime.onGenerationEnded(() => this.disposeAll(\"generation-lost\"));\n\t}\n\n\tdispose(): void {\n\t\tthis.unsubscribeTuiRendererReplaced();\n\t\tthis.unsubscribe();\n\t\tthis.unsubscribeGenerationEnded();\n\t\tthis.disposeAll(\"host-shutdown\");\n\t}\n\n\t/** The remote overlay proxy that currently holds focus (see remote-input-ownership.ts). */\n\tfocusedRemoteOverlay(): unknown {\n\t\tfor (const record of this.mounted.values()) {\n\t\t\tif (record.handle?.isFocused() === true) return record.component;\n\t\t}\n\t\treturn undefined;\n\t}\n\n\t/** `component` itself when it is one of this generation's live non-widget proxies. */\n\tremoteProxyOwner(component: unknown): unknown {\n\t\tif (!(component instanceof RemoteComponent)) return undefined;\n\t\tfor (const record of this.mounted.values()) {\n\t\t\tif (record.component === component) return record.widgetKey === undefined ? component : undefined;\n\t\t}\n\t\treturn undefined;\n\t}\n\n\t/** True when the extension that mounted `component` declared it binds Ctrl+C. */\n\tremoteProxyHandlesCtrlC(component: unknown): boolean {\n\t\tfor (const record of this.mounted.values()) {\n\t\t\tif (record.component === component) return record.handlesCtrlC;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * Close exactly one live proxy through the ordinary host close path.\n\t *\n\t * The host escape from a component that traps Ctrl+C, and deliberately not\n\t * `disposeAll()`: that is generation-death teardown, which would also close\n\t * unrelated nested components and suppress the child notification. Here the\n\t * record stays registered while `done` runs, so `showExtensionCustom()`\n\t * hides this overlay (or remounts the editor) and its finalizer disposes the\n\t * proxy normally — which tells the healthy child to resolve its own\n\t * `ui.custom()` promise with `undefined`, exactly like a user cancel.\n\t */\n\tdismissRemoteProxy(component: unknown): boolean {\n\t\tfor (const record of this.mounted.values()) {\n\t\t\tif (record.component !== component || record.widgetKey !== undefined) continue;\n\t\t\trecord.done(undefined);\n\t\t\tthis.ui.requestRender();\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tprivate releaseWidget(widgetKey: string): void {\n\t\tfor (const [componentId, record] of this.mounted) {\n\t\t\tif (record.widgetKey !== widgetKey) continue;\n\t\t\tthis.mounted.delete(componentId);\n\t\t\trecord.unsubscribeWidgetRelease?.();\n\t\t\trecord.unsubscribeWidgetRelease = undefined;\n\t\t\tthis.terminalModes.onUnmount(componentId);\n\t\t}\n\t}\n\t/**\n\t * Close every mounted component.\n\t *\n\t * `\"generation-lost\"` closes through the real host close path: it hides the\n\t * overlay or remounts the editor into `editorContainer`, restores the saved\n\t * draft and focus, releases `blockingInlineCustomUiDepth`, and resolves the\n\t * extension's `ui.custom()` promise. Records are removed BEFORE each `done`\n\t * runs so the settlement path cannot re-enter the controller, and proxy\n\t * disposal is local-only because the writer already points at a replacement\n\t * child whose component IDs restart at `remote_component_1`.\n\t *\n\t * Order is newest-first, matching the TUI's overlay stack. Closing oldest\n\t * first would let an overlay mounted above an inline proxy restore focus to\n\t * that inline proxy after it had already been disposed.\n\t *\n\t * `\"host-shutdown\"` notifies the still-live engine child instead and leaves\n\t * host mounts alone: the TUI is already stopping and must not repaint.\n\t */\n\tprivate disposeAll(reason: \"generation-lost\" | \"host-shutdown\"): void {\n\t\tconst records = [...this.mounted.entries()].reverse();\n\t\tthis.mounted.clear();\n\t\tfor (const [componentId, record] of records) {\n\t\t\tthis.terminalModes.onUnmount(componentId);\n\t\t\trecord.unsubscribeWidgetRelease?.();\n\t\t\trecord.component.dispose(reason === \"host-shutdown\" && !record.engineDone);\n\t\t\tif (record.widgetKey) this.ui.setWidget(record.widgetKey, undefined);\n\t\t\telse if (reason === \"generation-lost\") record.done(undefined);\n\t\t}\n\t\tthis.terminalModes.resetAll();\n\t\tif (reason === \"generation-lost\" && records.length > 0) this.ui.requestRender();\n\t}\n\n\tprivate handleMessage(message: InteractiveEngineMessage): void {\n\t\tswitch (message.type) {\n\t\t\tcase \"engine_ready\":\n\t\t\t\t// Idempotent fallback for a generation replacement whose death event\n\t\t\t\t// was already handled: stale records must be gone before the new child\n\t\t\t\t// can reuse `remote_component_1`, and any terminal modes the dead\n\t\t\t\t// generation left on are reset here too.\n\t\t\t\tthis.disposeAll(\"generation-lost\");\n\t\t\t\tbreak;\n\t\t\tcase \"engine_custom_open\":\n\t\t\t\tthis.open(\n\t\t\t\t\tmessage.componentId,\n\t\t\t\t\tmessage.overlay,\n\t\t\t\t\tmessage.deferInlineCustomUiFocus,\n\t\t\t\t\tmessage.overlayOptions,\n\t\t\t\t\tmessage.widgetKey,\n\t\t\t\t\tmessage.widgetPlacement,\n\t\t\t\t\tmessage.handlesCtrlC === true,\n\t\t\t\t\tmessage.handlesInternalUiAction === true,\n\t\t\t\t\tmessage.reserveTranscriptRows === true,\n\t\t\t\t\tmessage.purpose,\n\t\t\t\t\tmessage.widgetScroll,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\tcase \"engine_custom_close\":\n\t\t\t\tthis.close(message.componentId);\n\t\t\t\tbreak;\n\t\t\tcase \"engine_custom_frame\":\n\t\t\t\tthis.mounted\n\t\t\t\t\t.get(message.componentId)\n\t\t\t\t\t?.component.applyFrame(message.requestId, message.lines, message.scrollRequest);\n\t\t\t\tbreak;\n\t\t\tcase \"engine_custom_input_result\":\n\t\t\t\tthis.mounted.get(message.componentId)?.component.resolveInput(message.requestId, message.handled);\n\t\t\t\tbreak;\n\t\t\tcase \"engine_custom_invalidate\":\n\t\t\t\tthis.mounted.get(message.componentId)?.component.requestRemoteRender();\n\t\t\t\tbreak;\n\t\t\tcase \"engine_custom_terminal\":\n\t\t\t\tthis.terminalModes.applyControl(message.componentId, message.control);\n\t\t\t\tbreak;\n\t\t\tcase \"engine_custom_done\": {\n\t\t\t\tconst record = this.mounted.get(message.componentId);\n\t\t\t\tif (record) {\n\t\t\t\t\trecord.engineDone = true;\n\t\t\t\t\trecord.done(message.result);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"engine_custom_control\":\n\t\t\t\tthis.control(message.componentId, message.action);\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tprivate open(\n\t\tcomponentId: string,\n\t\toverlay: boolean,\n\t\tdeferInlineCustomUiFocus: boolean | undefined,\n\t\toptions: SerializableOverlayOptions | undefined,\n\t\twidgetKey?: string,\n\t\twidgetPlacement?: \"aboveEditor\" | \"belowEditor\",\n\t\thandlesCtrlC = false,\n\t\thandlesInternalUiAction = false,\n\t\treserveTranscriptRows = false,\n\t\tpurpose?: \"prompt\" | \"navigation\",\n\t\twidgetScroll?: { maxHeight: number; maxHeightFraction?: number },\n\t): void {\n\t\tif (this.mounted.has(componentId)) return;\n\t\tif (widgetKey) {\n\t\t\tlet getRows = () => 24;\n\t\t\tconst component = new RemoteComponent(\n\t\t\t\tcomponentId,\n\t\t\t\tthis.runtime,\n\t\t\t\t() => this.ui.requestRender(),\n\t\t\t\t() => getRows(),\n\t\t\t\thandlesInternalUiAction,\n\t\t\t);\n\t\t\tconst unsubscribeWidgetRelease = this.ui.onWidgetRelease?.(widgetKey, () => this.releaseWidget(widgetKey));\n\t\t\tthis.mounted.set(componentId, {\n\t\t\t\tcomponent,\n\t\t\t\tdone: () => {},\n\t\t\t\tengineDone: false,\n\t\t\t\thandlesCtrlC,\n\t\t\t\thandlesInternalUiAction,\n\t\t\t\twidgetKey,\n\t\t\t\tunsubscribeWidgetRelease,\n\t\t\t});\n\t\t\tthis.ui.setWidget(\n\t\t\t\twidgetKey,\n\t\t\t\t(tui) => {\n\t\t\t\t\tgetRows = () => tui.terminal.rows;\n\t\t\t\t\treturn component;\n\t\t\t\t},\n\t\t\t\t{ placement: widgetPlacement, ...(widgetScroll ? { scroll: widgetScroll } : {}) },\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\t\tlet mounted: MountedRemoteComponent | undefined;\n\t\tvoid this.ui\n\t\t\t.custom<JsonValue | undefined>(\n\t\t\t\t(tui, _theme, _keybindings, done) => {\n\t\t\t\t\tconst component = new RemoteComponent(\n\t\t\t\t\t\tcomponentId,\n\t\t\t\t\t\tthis.runtime,\n\t\t\t\t\t\t() => this.ui.requestRender(),\n\t\t\t\t\t\t() => tui.terminal.rows,\n\t\t\t\t\t\thandlesInternalUiAction,\n\t\t\t\t\t);\n\t\t\t\t\tmounted = { component, done, engineDone: false, handlesCtrlC, handlesInternalUiAction };\n\t\t\t\t\tthis.mounted.set(componentId, mounted);\n\t\t\t\t\t// Bind this component to the real host terminal so a buffered\n\t\t\t\t\t// autowrap control emitted before the mount frame applies to the host TTY.\n\t\t\t\t\tthis.terminalModes.onMount(componentId, hostTerminal(tui));\n\t\t\t\t\treturn component;\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\toverlay,\n\t\t\t\t\tpurpose,\n\t\t\t\t\tdeferInlineCustomUiFocus,\n\t\t\t\t\thandlesInternalUiAction,\n\t\t\t\t\treserveTranscriptRows,\n\t\t\t\t\toverlayOptions: overlayOptions(options),\n\t\t\t\t\tonHandle: (handle) => {\n\t\t\t\t\t\tif (mounted) mounted.handle = handle;\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t)\n\t\t\t.catch(() => undefined)\n\t\t\t.finally(() => {\n\t\t\t\tthis.terminalModes.onUnmount(componentId);\n\t\t\t\tconst record = this.mounted.get(componentId);\n\t\t\t\tif (!record) return;\n\t\t\t\tthis.mounted.delete(componentId);\n\t\t\t\tif (record.engineDone) record.component.dispose(false);\n\t\t\t\telse record.component.dispose();\n\t\t\t});\n\t}\n\n\tprivate close(componentId: string): void {\n\t\tconst record = this.mounted.get(componentId);\n\t\tif (!record) return;\n\t\tthis.terminalModes.onUnmount(componentId);\n\t\tthis.mounted.delete(componentId);\n\t\trecord.unsubscribeWidgetRelease?.();\n\t\tif (record.widgetKey) this.ui.setWidget(record.widgetKey, undefined);\n\t\trecord.component.dispose();\n\t}\n\n\tprivate control(componentId: string, action: \"focus\" | \"hide\" | \"show\" | \"unfocus\"): void {\n\t\tconst handle = this.mounted.get(componentId)?.handle;\n\t\tif (!handle) return;\n\t\tswitch (action) {\n\t\t\tcase \"focus\":\n\t\t\t\thandle.focus();\n\t\t\t\tbreak;\n\t\t\tcase \"hide\":\n\t\t\t\thandle.setHidden(true);\n\t\t\t\tbreak;\n\t\t\tcase \"show\":\n\t\t\t\thandle.setHidden(false);\n\t\t\t\tbreak;\n\t\t\tcase \"unfocus\":\n\t\t\t\thandle.unfocus();\n\t\t\t\tbreak;\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"remote-component.js","sourceRoot":"","sources":["../../../src/modes/interactive-engine/remote-component.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAG3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CA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AC1C,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QACjC,MAAM,CAAC,wBAAwB,EAAE,EAAE,CAAC;QACpC,IAAI,MAAM,CAAC,SAAS;YAAE,IAAI,CAAC,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QACrE,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;IAC5B,CAAC;IAEO,OAAO,CAAC,WAAmB,EAAE,MAA6C;QACjF,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QACrD,IAAI,CAAC,MAAM;YAAE,OAAO;QACpB,QAAQ,MAAM,EAAE,CAAC;YAChB,KAAK,OAAO;gBACX,MAAM,CAAC,KAAK,EAAE,CAAC;gBACf,MAAM;YACP,KAAK,MAAM;gBACV,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;gBACvB,MAAM;YACP,KAAK,MAAM;gBACV,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;gBACxB,MAAM;YACP,KAAK,SAAS;gBACb,MAAM,CAAC,OAAO,EAAE,CAAC;gBACjB,MAAM;QACR,CAAC;IACF,CAAC;CACD","sourcesContent":["import type { Component, OverlayHandle, OverlayOptions, TUI } from \"@earendil-works/pi-tui\";\nimport type { ExtensionUIContext } from \"../../core/extensions/index.js\";\nimport type { WidgetScrollRequest, WidgetScrollState } from \"../../core/extensions/ui-types.js\";\nimport { copyToClipboard } from \"../../utils/clipboard.js\";\nimport type { IsolatedInteractiveRuntime } from \"./isolated-runtime.js\";\nimport type { InteractiveEngineMessage, JsonValue, SerializableOverlayOptions } from \"./protocol.ts\";\nimport { RemoteFrameWidthClamp } from \"./remote-frame-clamp.ts\";\nimport { TerminalModeController } from \"./terminal-mode-controller.ts\";\n\nexport type RemoteComponentRuntime = Pick<\n\tIsolatedInteractiveRuntime,\n\t\"onEngineMessage\" | \"onGenerationEnded\" | \"sendEngineCommand\"\n>;\n\nexport type RemoteComponentUI = Pick<ExtensionUIContext, \"custom\" | \"requestRender\" | \"setWidget\" | \"onWidgetRelease\">;\n\ninterface MountedRemoteComponent {\n\tcomponent: RemoteComponent;\n\tdone: (result: JsonValue | undefined) => void;\n\tengineDone: boolean;\n\t/** The extension declared that this component binds Ctrl+C itself. */\n\thandlesCtrlC: boolean;\n\t/** The extension declared that this component claims internal UI actions. */\n\thandlesInternalUiAction: boolean;\n\thandle?: OverlayHandle;\n\twidgetKey?: string;\n\tunsubscribeWidgetRelease?: () => void;\n}\n\n/**\n * A stalled engine must not make fullscreen input wait forever. A timed-out\n * reply is treated as unhandled and lets the viewport process the key.\n */\nexport const REMOTE_INPUT_REPLY_TIMEOUT_MS = 250;\n\ninterface PendingInput {\n\tresolve: (handled: boolean | undefined) => void;\n\ttimer: ReturnType<typeof setTimeout>;\n}\n\nclass RemoteComponent implements Component {\n\tprivate scrollRequest: WidgetScrollRequest | undefined;\n\tgetScrollRequest(): WidgetScrollRequest | undefined {\n\t\treturn this.scrollRequest;\n\t}\n\tonScroll(state: WidgetScrollState): void {\n\t\tif (!this.disposed)\n\t\t\tthis.runtime.sendEngineCommand({ type: \"engine_custom_scroll\", componentId: this.componentId, state });\n\t}\n\twantsKeyRelease = true;\n\treadonly handlesInternalUiAction: boolean;\n\tprivate lines = [\"Loading remote component…\"];\n\tprivate width = 0;\n\tprivate rows = 0;\n\tprivate requestId = 0;\n\tprivate inputRequestId = 0;\n\tprivate appliedRequestId = 0;\n\tprivate dirty = true;\n\tprivate disposed = false;\n\tprivate readonly pendingInputs = new Map<number, PendingInput>();\n\tprivate readonly frameClamp = new RemoteFrameWidthClamp();\n\n\tprivate readonly componentId: string;\n\tprivate readonly runtime: RemoteComponentRuntime;\n\tprivate readonly requestRender: () => void;\n\tprivate readonly getRows: () => number;\n\n\tconstructor(\n\t\tcomponentId: string,\n\t\truntime: RemoteComponentRuntime,\n\t\trequestRender: () => void,\n\t\tgetRows: () => number,\n\t\thandlesInternalUiAction = false,\n\t) {\n\t\tthis.componentId = componentId;\n\t\tthis.runtime = runtime;\n\t\tthis.requestRender = requestRender;\n\t\tthis.getRows = getRows;\n\t\tthis.handlesInternalUiAction = handlesInternalUiAction;\n\t}\n\n\trender(width: number): string[] {\n\t\tconst rows = this.getRows();\n\t\tif (!this.disposed && (this.dirty || width !== this.width || rows !== this.rows)) {\n\t\t\tthis.width = width;\n\t\t\tthis.rows = rows;\n\t\t\tthis.dirty = false;\n\t\t\tthis.runtime.sendEngineCommand({\n\t\t\t\ttype: \"engine_custom_render\",\n\t\t\t\tcomponentId: this.componentId,\n\t\t\t\trequestId: ++this.requestId,\n\t\t\t\twidth,\n\t\t\t\trows,\n\t\t\t});\n\t\t}\n\t\t// The engine child re-renders asynchronously; until the fresh frame\n\t\t// arrives, the previous frame may be wrapped for an older terminal\n\t\t// width. Clamp so a resize never replays overflowing lines (pi-tui\n\t\t// crashes on any rendered line wider than the terminal).\n\t\treturn this.frameClamp.clamp(this.lines, width);\n\t}\n\n\thandleInput(data: string): Promise<boolean | undefined> {\n\t\tif (this.disposed) return Promise.resolve(undefined);\n\t\tconst requestId = ++this.inputRequestId;\n\t\tconst result = new Promise<boolean | undefined>((resolve) => {\n\t\t\tconst timer = setTimeout(() => this.resolveInput(requestId, false), REMOTE_INPUT_REPLY_TIMEOUT_MS);\n\t\t\ttimer.unref?.();\n\t\t\tthis.pendingInputs.set(requestId, { resolve, timer });\n\t\t});\n\t\ttry {\n\t\t\tthis.runtime.sendEngineCommand({\n\t\t\t\ttype: \"engine_custom_input\",\n\t\t\t\tcomponentId: this.componentId,\n\t\t\t\trequestId,\n\t\t\t\tdata,\n\t\t\t});\n\t\t} catch {\n\t\t\tthis.resolveInput(requestId, false);\n\t\t}\n\t\t// Engine commands are delivered in order, so a frame requested now is\n\t\t// rendered by the child only AFTER it has applied this input. Pipelining\n\t\t// the request keeps keypress latency at a single round trip and repaints\n\t\t// components that never self-invalidate, instead of waiting for a\n\t\t// child-side invalidate (or an unrelated refresh) to trigger a frame.\n\t\tthis.dirty = true;\n\t\tthis.requestRender();\n\t\treturn result;\n\t}\n\n\tresolveInput(requestId: number, handled: boolean | undefined): void {\n\t\tconst pending = this.pendingInputs.get(requestId);\n\t\tif (!pending) return;\n\t\tthis.pendingInputs.delete(requestId);\n\t\tclearTimeout(pending.timer);\n\t\tpending.resolve(handled);\n\t}\n\n\tinvalidate(): void {\n\t\tthis.dirty = true;\n\t}\n\n\tapplyFrame(requestId: number, lines: string[], scrollRequest?: WidgetScrollRequest): void {\n\t\tif (this.disposed || requestId < this.appliedRequestId) return;\n\t\tthis.appliedRequestId = requestId;\n\t\tthis.lines = lines;\n\t\tthis.scrollRequest = scrollRequest;\n\t\tthis.requestRender();\n\t}\n\n\trequestRemoteRender(): void {\n\t\tif (this.disposed) return;\n\t\tthis.dirty = true;\n\t\tthis.requestRender();\n\t}\n\n\t/**\n\t * Tear the proxy down. `notifyEngine` must be false once the writer no longer\n\t * points at the generation that owns this component: component IDs restart at\n\t * `remote_component_1` for every child, so a late dispose would address an\n\t * unrelated component in the replacement engine.\n\t */\n\tdispose(notifyEngine = true): void {\n\t\tif (this.disposed) return;\n\t\tthis.disposed = true;\n\t\tfor (const requestId of [...this.pendingInputs.keys()]) this.resolveInput(requestId, undefined);\n\t\tif (notifyEngine)\n\t\t\tthis.runtime.sendEngineCommand({ type: \"engine_custom_dispose\", componentId: this.componentId });\n\t}\n}\n\nfunction overlayOptions(options: SerializableOverlayOptions | undefined): OverlayOptions | undefined {\n\treturn options as OverlayOptions | undefined;\n}\n\n/**\n * Resolve the real host terminal from the pi-tui TUI handed to the overlay\n * factory. Optional: some hosts / test seams do not surface `tui.terminal`, in\n * which case terminal-mode controls harmlessly no-op.\n */\nfunction hostTerminal(tui: TUI): { write(data: string): void } {\n\tconst terminal = (tui as { terminal?: { write?(data: string): void } }).terminal;\n\treturn typeof terminal?.write === \"function\" ? (terminal as { write(data: string): void }) : { write: () => {} };\n}\n\nexport interface TuiRendererLifecycle {\n\tisFullscreen(): boolean;\n\tonRendererReplaced(listener: () => void): () => void;\n}\n\nexport class RemoteComponentController {\n\tprivate readonly mounted = new Map<string, MountedRemoteComponent>();\n\tprivate readonly unsubscribe: () => void;\n\tprivate readonly unsubscribeGenerationEnded: () => void;\n\tprivate readonly terminalModes: TerminalModeController;\n\tprivate readonly unsubscribeTuiRendererReplaced: () => void;\n\n\tprivate readonly runtime: RemoteComponentRuntime;\n\tprivate readonly ui: RemoteComponentUI;\n\tprivate readonly copyText: (text: string) => Promise<void>;\n\n\tconstructor(\n\t\truntime: RemoteComponentRuntime,\n\t\tui: RemoteComponentUI,\n\t\ttuiRendererLifecycle: TuiRendererLifecycle,\n\t\tcopyText: (text: string) => Promise<void> = copyToClipboard,\n\t) {\n\t\tthis.runtime = runtime;\n\t\tthis.ui = ui;\n\t\tthis.copyText = copyText;\n\t\tthis.terminalModes = new TerminalModeController(() => tuiRendererLifecycle.isFullscreen());\n\t\tthis.unsubscribeTuiRendererReplaced = tuiRendererLifecycle.onRendererReplaced(() =>\n\t\t\tthis.terminalModes.rebindTui(),\n\t\t);\n\t\tthis.unsubscribe = runtime.onEngineMessage((message) => this.handleMessage(message));\n\t\t// Teardown is driven by engine death rather than the NEXT generation's\n\t\t// `engine_ready`, so a crash with no restart, or a hung/failed restart,\n\t\t// still releases the host editor, focus, and inline-custom-UI depth.\n\t\tthis.unsubscribeGenerationEnded = runtime.onGenerationEnded(() => this.disposeAll(\"generation-lost\"));\n\t}\n\n\tdispose(): void {\n\t\tthis.unsubscribeTuiRendererReplaced();\n\t\tthis.unsubscribe();\n\t\tthis.unsubscribeGenerationEnded();\n\t\tthis.disposeAll(\"host-shutdown\");\n\t}\n\n\t/** The remote overlay proxy that currently holds focus (see remote-input-ownership.ts). */\n\tfocusedRemoteOverlay(): unknown {\n\t\tfor (const record of this.mounted.values()) {\n\t\t\tif (record.handle?.isFocused() === true) return record.component;\n\t\t}\n\t\treturn undefined;\n\t}\n\n\t/** `component` itself when it is one of this generation's live non-widget proxies. */\n\tremoteProxyOwner(component: unknown): unknown {\n\t\tif (!(component instanceof RemoteComponent)) return undefined;\n\t\tfor (const record of this.mounted.values()) {\n\t\t\tif (record.component === component) return record.widgetKey === undefined ? component : undefined;\n\t\t}\n\t\treturn undefined;\n\t}\n\n\t/** True when the extension that mounted `component` declared it binds Ctrl+C. */\n\tremoteProxyHandlesCtrlC(component: unknown): boolean {\n\t\tfor (const record of this.mounted.values()) {\n\t\t\tif (record.component === component) return record.handlesCtrlC;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * Close exactly one live proxy through the ordinary host close path.\n\t *\n\t * The host escape from a component that traps Ctrl+C, and deliberately not\n\t * `disposeAll()`: that is generation-death teardown, which would also close\n\t * unrelated nested components and suppress the child notification. Here the\n\t * record stays registered while `done` runs, so `showExtensionCustom()`\n\t * hides this overlay (or remounts the editor) and its finalizer disposes the\n\t * proxy normally — which tells the healthy child to resolve its own\n\t * `ui.custom()` promise with `undefined`, exactly like a user cancel.\n\t */\n\tdismissRemoteProxy(component: unknown): boolean {\n\t\tfor (const record of this.mounted.values()) {\n\t\t\tif (record.component !== component || record.widgetKey !== undefined) continue;\n\t\t\trecord.done(undefined);\n\t\t\tthis.ui.requestRender();\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tprivate releaseWidget(widgetKey: string): void {\n\t\tfor (const [componentId, record] of this.mounted) {\n\t\t\tif (record.widgetKey !== widgetKey) continue;\n\t\t\tthis.mounted.delete(componentId);\n\t\t\trecord.unsubscribeWidgetRelease?.();\n\t\t\trecord.unsubscribeWidgetRelease = undefined;\n\t\t\tthis.terminalModes.onUnmount(componentId);\n\t\t}\n\t}\n\t/**\n\t * Close every mounted component.\n\t *\n\t * `\"generation-lost\"` closes through the real host close path: it hides the\n\t * overlay or remounts the editor into `editorContainer`, restores the saved\n\t * draft and focus, releases `blockingInlineCustomUiDepth`, and resolves the\n\t * extension's `ui.custom()` promise. Records are removed BEFORE each `done`\n\t * runs so the settlement path cannot re-enter the controller, and proxy\n\t * disposal is local-only because the writer already points at a replacement\n\t * child whose component IDs restart at `remote_component_1`.\n\t *\n\t * Order is newest-first, matching the TUI's overlay stack. Closing oldest\n\t * first would let an overlay mounted above an inline proxy restore focus to\n\t * that inline proxy after it had already been disposed.\n\t *\n\t * `\"host-shutdown\"` notifies the still-live engine child instead and leaves\n\t * host mounts alone: the TUI is already stopping and must not repaint.\n\t */\n\tprivate disposeAll(reason: \"generation-lost\" | \"host-shutdown\"): void {\n\t\tconst records = [...this.mounted.entries()].reverse();\n\t\tthis.mounted.clear();\n\t\tfor (const [componentId, record] of records) {\n\t\t\tthis.terminalModes.onUnmount(componentId);\n\t\t\trecord.unsubscribeWidgetRelease?.();\n\t\t\trecord.component.dispose(reason === \"host-shutdown\" && !record.engineDone);\n\t\t\tif (record.widgetKey) this.ui.setWidget(record.widgetKey, undefined);\n\t\t\telse if (reason === \"generation-lost\") record.done(undefined);\n\t\t}\n\t\tthis.terminalModes.resetAll();\n\t\tif (reason === \"generation-lost\" && records.length > 0) this.ui.requestRender();\n\t}\n\n\tprivate handleMessage(message: InteractiveEngineMessage): void {\n\t\tswitch (message.type) {\n\t\t\tcase \"engine_ready\":\n\t\t\t\t// Idempotent fallback for a generation replacement whose death event\n\t\t\t\t// was already handled: stale records must be gone before the new child\n\t\t\t\t// can reuse `remote_component_1`, and any terminal modes the dead\n\t\t\t\t// generation left on are reset here too.\n\t\t\t\tthis.disposeAll(\"generation-lost\");\n\t\t\t\tbreak;\n\t\t\tcase \"engine_custom_open\":\n\t\t\t\tthis.open(\n\t\t\t\t\tmessage.componentId,\n\t\t\t\t\tmessage.overlay,\n\t\t\t\t\tmessage.deferInlineCustomUiFocus,\n\t\t\t\t\tmessage.overlayOptions,\n\t\t\t\t\tmessage.widgetKey,\n\t\t\t\t\tmessage.widgetPlacement,\n\t\t\t\t\tmessage.handlesCtrlC === true,\n\t\t\t\t\tmessage.handlesInternalUiAction === true,\n\t\t\t\t\tmessage.reserveTranscriptRows === true,\n\t\t\t\t\tmessage.purpose,\n\t\t\t\t\tmessage.widgetScroll,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\tcase \"engine_custom_close\":\n\t\t\t\tthis.close(message.componentId);\n\t\t\t\tbreak;\n\t\t\tcase \"engine_custom_frame\":\n\t\t\t\tthis.mounted\n\t\t\t\t\t.get(message.componentId)\n\t\t\t\t\t?.component.applyFrame(message.requestId, message.lines, message.scrollRequest);\n\t\t\t\tbreak;\n\t\t\tcase \"engine_custom_input_result\":\n\t\t\t\tthis.mounted.get(message.componentId)?.component.resolveInput(message.requestId, message.handled);\n\t\t\t\tbreak;\n\t\t\tcase \"engine_custom_invalidate\":\n\t\t\t\tthis.mounted.get(message.componentId)?.component.requestRemoteRender();\n\t\t\t\tbreak;\n\t\t\tcase \"engine_custom_copy\":\n\t\t\t\tvoid (async () => {\n\t\t\t\t\tlet error: string | undefined;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (!this.mounted.has(message.componentId)) throw new Error(\"Sign-in screen is no longer open\");\n\t\t\t\t\t\tawait this.copyText(message.text);\n\t\t\t\t\t} catch (cause) {\n\t\t\t\t\t\terror = cause instanceof Error ? cause.message : String(cause);\n\t\t\t\t\t}\n\t\t\t\t\tthis.runtime.sendEngineCommand({\n\t\t\t\t\t\ttype: \"engine_custom_copy_result\",\n\t\t\t\t\t\tcomponentId: message.componentId,\n\t\t\t\t\t\trequestId: message.requestId,\n\t\t\t\t\t\terror,\n\t\t\t\t\t});\n\t\t\t\t})();\n\t\t\t\tbreak;\n\t\t\tcase \"engine_custom_terminal\":\n\t\t\t\tthis.terminalModes.applyControl(message.componentId, message.control);\n\t\t\t\tbreak;\n\t\t\tcase \"engine_custom_done\": {\n\t\t\t\tconst record = this.mounted.get(message.componentId);\n\t\t\t\tif (record) {\n\t\t\t\t\trecord.engineDone = true;\n\t\t\t\t\trecord.done(message.result);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"engine_custom_control\":\n\t\t\t\tthis.control(message.componentId, message.action);\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tprivate open(\n\t\tcomponentId: string,\n\t\toverlay: boolean,\n\t\tdeferInlineCustomUiFocus: boolean | undefined,\n\t\toptions: SerializableOverlayOptions | undefined,\n\t\twidgetKey?: string,\n\t\twidgetPlacement?: \"aboveEditor\" | \"belowEditor\",\n\t\thandlesCtrlC = false,\n\t\thandlesInternalUiAction = false,\n\t\treserveTranscriptRows = false,\n\t\tpurpose?: \"prompt\" | \"navigation\",\n\t\twidgetScroll?: { maxHeight: number; maxHeightFraction?: number },\n\t): void {\n\t\tif (this.mounted.has(componentId)) return;\n\t\tif (widgetKey) {\n\t\t\tlet getRows = () => 24;\n\t\t\tconst component = new RemoteComponent(\n\t\t\t\tcomponentId,\n\t\t\t\tthis.runtime,\n\t\t\t\t() => this.ui.requestRender(),\n\t\t\t\t() => getRows(),\n\t\t\t\thandlesInternalUiAction,\n\t\t\t);\n\t\t\tconst unsubscribeWidgetRelease = this.ui.onWidgetRelease?.(widgetKey, () => this.releaseWidget(widgetKey));\n\t\t\tthis.mounted.set(componentId, {\n\t\t\t\tcomponent,\n\t\t\t\tdone: () => {},\n\t\t\t\tengineDone: false,\n\t\t\t\thandlesCtrlC,\n\t\t\t\thandlesInternalUiAction,\n\t\t\t\twidgetKey,\n\t\t\t\tunsubscribeWidgetRelease,\n\t\t\t});\n\t\t\tthis.ui.setWidget(\n\t\t\t\twidgetKey,\n\t\t\t\t(tui) => {\n\t\t\t\t\tgetRows = () => tui.terminal.rows;\n\t\t\t\t\treturn component;\n\t\t\t\t},\n\t\t\t\t{ placement: widgetPlacement, ...(widgetScroll ? { scroll: widgetScroll } : {}) },\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\t\tlet mounted: MountedRemoteComponent | undefined;\n\t\tvoid this.ui\n\t\t\t.custom<JsonValue | undefined>(\n\t\t\t\t(tui, _theme, _keybindings, done) => {\n\t\t\t\t\tconst component = new RemoteComponent(\n\t\t\t\t\t\tcomponentId,\n\t\t\t\t\t\tthis.runtime,\n\t\t\t\t\t\t() => this.ui.requestRender(),\n\t\t\t\t\t\t() => tui.terminal.rows,\n\t\t\t\t\t\thandlesInternalUiAction,\n\t\t\t\t\t);\n\t\t\t\t\tmounted = { component, done, engineDone: false, handlesCtrlC, handlesInternalUiAction };\n\t\t\t\t\tthis.mounted.set(componentId, mounted);\n\t\t\t\t\t// Bind this component to the real host terminal so a buffered\n\t\t\t\t\t// autowrap control emitted before the mount frame applies to the host TTY.\n\t\t\t\t\tthis.terminalModes.onMount(componentId, hostTerminal(tui));\n\t\t\t\t\treturn component;\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\toverlay,\n\t\t\t\t\tpurpose,\n\t\t\t\t\tdeferInlineCustomUiFocus,\n\t\t\t\t\thandlesInternalUiAction,\n\t\t\t\t\treserveTranscriptRows,\n\t\t\t\t\toverlayOptions: overlayOptions(options),\n\t\t\t\t\tonHandle: (handle) => {\n\t\t\t\t\t\tif (mounted) mounted.handle = handle;\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t)\n\t\t\t.catch(() => undefined)\n\t\t\t.finally(() => {\n\t\t\t\tthis.terminalModes.onUnmount(componentId);\n\t\t\t\tconst record = this.mounted.get(componentId);\n\t\t\t\tif (!record) return;\n\t\t\t\tthis.mounted.delete(componentId);\n\t\t\t\tif (record.engineDone) record.component.dispose(false);\n\t\t\t\telse record.component.dispose();\n\t\t\t});\n\t}\n\n\tprivate close(componentId: string): void {\n\t\tconst record = this.mounted.get(componentId);\n\t\tif (!record) return;\n\t\tthis.terminalModes.onUnmount(componentId);\n\t\tthis.mounted.delete(componentId);\n\t\trecord.unsubscribeWidgetRelease?.();\n\t\tif (record.widgetKey) this.ui.setWidget(record.widgetKey, undefined);\n\t\trecord.component.dispose();\n\t}\n\n\tprivate control(componentId: string, action: \"focus\" | \"hide\" | \"show\" | \"unfocus\"): void {\n\t\tconst handle = this.mounted.get(componentId)?.handle;\n\t\tif (!handle) return;\n\t\tswitch (action) {\n\t\t\tcase \"focus\":\n\t\t\t\thandle.focus();\n\t\t\t\tbreak;\n\t\t\tcase \"hide\":\n\t\t\t\thandle.setHidden(true);\n\t\t\t\tbreak;\n\t\t\tcase \"show\":\n\t\t\t\thandle.setHidden(false);\n\t\t\t\tbreak;\n\t\t\tcase \"unfocus\":\n\t\t\t\thandle.unfocus();\n\t\t\t\tbreak;\n\t\t}\n\t}\n}\n"]}
@@ -81,7 +81,19 @@ Send material updates through Intercom to every affected workflow stage, includi
81
81
 
82
82
  Name and pattern paths remain sticky for every future matching stage until the root terminates. When shared scope or acceptance criteria change, broadcast one authoritative update to `workflow:<rootRunId>/**` (or a narrower path pattern) rather than enumerating stages: `**` reaches every live stage now and every future descendant. A syntactically valid path outside the persisted known set still queues and returns `notInKnownSet`; if it never delivers, root-terminal settlement sends the correlated undeliverable notification. A sticky entry delivered at least once is not reported undeliverable.
83
83
 
84
- The workflows extension persists up to **50 queued messages per target** with workflow state. Messages survive resume/replay and broker restart, and logical message IDs prevent redelivery to the same materialized stage across stage-attempt restarts. When a matching stage session initializes, it receives the FIFO entries through the ordinary Intercom inbound path before its first model turn, under the heading **Messages received before you started**, with sender identity and `Sent:` timestamps visible separately from the task prompt.
84
+ The `[future]` queued count is the number of retained sticky messages, not the number unread by a particular stage. A message remains queued for later matches after earlier stages receive it. Inspect the per-stage `deliveryStates` in `intercom list` and `workflow({ action: "status", runId: "<rootRunId>" })` to check receipt or why delivery was skipped. `delivered` confirms admission to stage context, not that the model followed the instruction. `receipt-unverified` means only transport delivery or an older receipt is known; inspect the stage transcript before resending.
85
+
86
+ `[delivery]` rows retain per-stage evidence for sticky targets missing from the future-target list, including exact targets after materialization. They do not indicate that a stage is still in the future or currently live. Use the per-stage state to decide what to do; an ended stage without confirmed context admission shows `stage-terminal`, even when transport delivery was acknowledged.
87
+
88
+ | State | What to do |
89
+ | --- | --- |
90
+ | `queued` | Wait for the matching stage to finish startup. |
91
+ | `session-replaced` | Check startup status. The new session must receive retained context before its first turn. |
92
+ | `delivery-unavailable` | Enable Intercom for that stage and keep it in the workflow invocation group. |
93
+ | `stage-terminal` | Steer a live stage or start separately authorized work; the ended stage cannot consume the update. |
94
+ | `root-unresolved` | Check the reported ownership problem before retrying. Preserve the run ID and diagnostic when reporting it. |
95
+
96
+ The workflows extension persists up to **50 queued messages per target** with workflow state. Messages survive resume/replay and broker restart. Reusing a stage's existing session transcript does not duplicate acknowledged messages; a replacement session with a new transcript receives the retained sticky context again. When a matching stage session initializes, it receives the FIFO entries through the ordinary Intercom inbound path before its first model turn, under the heading **Messages received before you started**, with sender identity and `Sent:` timestamps visible separately from the task prompt.
85
97
 
86
98
  Only a workflow invocation member with eligible invocation-control authority can queue to its invocation-owned stages; this includes a main-chat session that explicitly joined `workflow:<rootRunId>`. Subgroup peers and another root run remain refused even if they add that membership. An explicit stage `group: "default"` is a shared-group escape, is not workflow-owned, and does not receive pending invocation delivery. An ineligible attempt is refused with `Target workflow run is in a different intercom group`. The 51st queued message is refused with `Pending stage message queue is full (limit 50)` rather than evicting an earlier entry.
87
99
 
@@ -167,6 +167,8 @@ When the clipboard has both text and an image, behavior depends on the terminal:
167
167
 
168
168
  Ctrl+X does not copy messages or selections. A workflow tool-detail view closes to its graph; the scoped-model selector clears its local selection; an attached workflow stage chat returns to its graph; and a workflow graph returns to main chat. Workflow surfaces recognize the physical Ctrl+X chord directly, including CSI variants. `/copy` always copies the last assistant message.
169
169
 
170
+ On OAuth sign-in screens, Ctrl+X copies the sign-in URL, including long URLs that wrap across lines. This also works in `/mcp login`. Customize this shortcut with `app.auth.copyUrl`; it does not change Ctrl+X behavior outside sign-in screens. Remote sessions use OSC 52 clipboard forwarding as described above.
171
+
170
172
  A held paused queue by itself is idle for Ctrl+C handling. After an interruption settles, the next Ctrl+C clears the editor without releasing or dequeuing the hold, and a second quick idle press exits normally.
171
173
 
172
174
  In interactive sessions the agent runs in a supervised engine child (see [Extensions](/extensions#interactive-callback-isolation)). Escape there requests the engine's cooperative cancellation and waits for it with no deadline; it never terminates or replaces the engine.
@@ -213,6 +215,7 @@ Interactive model and thinking choices automatically become startup defaults. Th
213
215
  | Keybinding id | Default | Description |
214
216
  |--------|---------|-------------|
215
217
  | `app.tools.expand` | `ctrl+o` | Collapse or expand tool and workflow-node detail in main chat or an attached workflow stage chat |
218
+ | `app.auth.copyUrl` | `ctrl+x` | Copy the URL on an OAuth sign-in screen |
216
219
  | `app.message.followUp` | `alt+enter` | Queue follow-up message |
217
220
  | `app.message.dequeue` | `alt+up` | Restore queued messages to editor |
218
221