@spotpatch/runtime 1.12.0 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -999,6 +999,15 @@ var UI_Z_INDEX = Object.freeze({
999
999
  highlight: 2147483646,
1000
1000
  controls: 2147483647
1001
1001
  });
1002
+ var FLOATING_SURFACE_LAYOUT = Object.freeze({
1003
+ compactInset: 8,
1004
+ compactViewportWidth: 520,
1005
+ desktopInset: 24,
1006
+ dragActivationDistance: 6,
1007
+ edgeSnapDistance: 20,
1008
+ workbenchMaxHeight: 620,
1009
+ workbenchMaxWidth: 460
1010
+ });
1002
1011
 
1003
1012
  // src/ui/dom.ts
1004
1013
  function createMarkedElement(document, tagName) {
@@ -1027,6 +1036,7 @@ var MESSAGES = Object.freeze({
1027
1036
  resultTitle: "Managed result",
1028
1037
  controlConnection: (state, mode) => `Connection: ${state} \xB7 Mode: ${mode}`,
1029
1038
  controlAuth: (auth, grant) => `Auth: ${auth} \xB7 Grant: ${grant}`,
1039
+ controlConsentRequired: 'Grant required: type "yes" in the terminal that started `pnpm dev`. If no prompt is visible, restart `pnpm dev` in an interactive terminal and connect again.',
1030
1040
  controlModel: (model) => `Model: ${model}`,
1031
1041
  controlRevision: (task) => `Revision ${String(task.revision)}: ${task.deliveryStatus} / ${task.executionStatus} / ${task.managedPhase}`,
1032
1042
  controlValidation: (outcome) => `Validation: ${outcome}`,
@@ -1035,11 +1045,11 @@ var MESSAGES = Object.freeze({
1035
1045
  controlErrorText: Object.freeze({
1036
1046
  AGENT_BINARY_NOT_FOUND: "Codex is not installed or is not on PATH.",
1037
1047
  AGENT_BINARY_UNTRUSTED: "The resolved Codex executable is not trusted.",
1038
- AGENT_VERSION_UNSUPPORTED: "The installed Codex version is unsupported.",
1048
+ AGENT_VERSION_UNSUPPORTED: "The installed Codex version is below SpotPatch's compatibility baseline.",
1039
1049
  APP_SERVER_HANDSHAKE_FAILED: "Codex App Server did not complete startup.",
1040
1050
  AGENT_AUTH_REQUIRED: "Codex requires an authenticated account.",
1041
1051
  AGENT_MODEL_UNAVAILABLE: "The configured Codex model is unavailable.",
1042
- AGENT_PROTOCOL_INCOMPATIBLE: "The Codex App Server protocol is incompatible.",
1052
+ AGENT_PROTOCOL_INCOMPATIBLE: "The generated Codex App Server schema is incompatible with SpotPatch's required protocol subset.",
1043
1053
  CODEX_CONFIG_ISOLATION_UNSUPPORTED: "This Codex version cannot prove managed configuration isolation.",
1044
1054
  MANAGED_GRANT_INVALID: "The saved project grant failed validation.",
1045
1055
  MANAGED_PLATFORM_UNSUPPORTED: "Managed execution is not proven safe on this platform.",
@@ -1047,14 +1057,14 @@ var MESSAGES = Object.freeze({
1047
1057
  MANAGED_SNAPSHOT_FAILED: "The independent workspace snapshot could not be created.",
1048
1058
  MANAGED_SCOPE_VIOLATION: "The candidate change exceeded its authorized paths.",
1049
1059
  MANAGED_CHANGE_LIMIT_EXCEEDED: "The candidate change exceeded safety limits.",
1050
- MANAGED_VALIDATION_FAILED: "A required check failed or changed the candidate diff.",
1060
+ MANAGED_VALIDATION_FAILED: "The candidate change did not pass audit or validation.",
1051
1061
  MANAGED_WORKSPACE_CONFLICT: "An authorized source file changed during execution.",
1052
1062
  MANAGED_APPLY_FAILED: "The audited change could not be applied safely.",
1053
1063
  MANAGED_CLEANUP_INCOMPLETE: "Managed thread or workspace cleanup is incomplete."
1054
1064
  }),
1055
1065
  controlActionText: Object.freeze({
1056
1066
  "install-agent": "Install Codex and retry.",
1057
- "use-supported-version": "Use a supported Codex version.",
1067
+ "use-supported-version": "Use a schema-compatible Codex version.",
1058
1068
  "sign-in": "Sign in with Codex, then retry.",
1059
1069
  "choose-available-model": "Choose an available model in Codex configuration.",
1060
1070
  "use-inbox": "Continue with the Agent inbox fallback.",
@@ -1113,6 +1123,7 @@ var MESSAGES = Object.freeze({
1113
1123
  resultTitle: "\u53D7\u7BA1\u6267\u884C\u7ED3\u679C",
1114
1124
  controlConnection: (state, mode) => `\u8FDE\u63A5\uFF1A${state} \xB7 \u6A21\u5F0F\uFF1A${mode}`,
1115
1125
  controlAuth: (auth, grant) => `\u8BA4\u8BC1\uFF1A${auth} \xB7 \u6388\u6743\uFF1A${grant}`,
1126
+ controlConsentRequired: "\u9700\u8981\u9879\u76EE\u6388\u6743\uFF1A\u8BF7\u5728\u542F\u52A8 `pnpm dev` \u7684\u7EC8\u7AEF\u8F93\u5165\u201Cyes\u201D\u3002\u82E5\u7EC8\u7AEF\u6CA1\u6709\u51FA\u73B0\u786E\u8BA4\u63D0\u793A\uFF0C\u8BF7\u5728\u53EF\u4EA4\u4E92\u7EC8\u7AEF\u91CD\u65B0\u542F\u52A8 `pnpm dev` \u540E\u518D\u8FDE\u63A5\u3002",
1116
1127
  controlModel: (model) => `\u6A21\u578B\uFF1A${model}`,
1117
1128
  controlRevision: (task) => `revision ${String(task.revision)}\uFF1A${task.deliveryStatus} / ${task.executionStatus} / ${task.managedPhase}`,
1118
1129
  controlValidation: (outcome) => `\u9A8C\u8BC1\uFF1A${outcome}`,
@@ -1121,11 +1132,11 @@ var MESSAGES = Object.freeze({
1121
1132
  controlErrorText: Object.freeze({
1122
1133
  AGENT_BINARY_NOT_FOUND: "\u672A\u5B89\u88C5 Codex\uFF0C\u6216 Codex \u4E0D\u5728 PATH \u4E2D\u3002",
1123
1134
  AGENT_BINARY_UNTRUSTED: "\u89E3\u6790\u5230\u7684 Codex \u53EF\u6267\u884C\u6587\u4EF6\u4E0D\u53EF\u4FE1\u3002",
1124
- AGENT_VERSION_UNSUPPORTED: "\u5DF2\u5B89\u88C5\u7684 Codex \u7248\u672C\u4E0D\u53D7\u652F\u6301\u3002",
1135
+ AGENT_VERSION_UNSUPPORTED: "\u5DF2\u5B89\u88C5\u7684 Codex \u7248\u672C\u4F4E\u4E8E SpotPatch \u517C\u5BB9\u57FA\u7EBF\u3002",
1125
1136
  APP_SERVER_HANDSHAKE_FAILED: "Codex App Server \u672A\u5B8C\u6210\u542F\u52A8\u63E1\u624B\u3002",
1126
1137
  AGENT_AUTH_REQUIRED: "Codex \u9700\u8981\u5DF2\u767B\u5F55\u7684\u8D26\u6237\u3002",
1127
1138
  AGENT_MODEL_UNAVAILABLE: "Codex \u914D\u7F6E\u7684\u6A21\u578B\u5F53\u524D\u4E0D\u53EF\u7528\u3002",
1128
- AGENT_PROTOCOL_INCOMPATIBLE: "Codex App Server \u534F\u8BAE\u4E0D\u517C\u5BB9\u3002",
1139
+ AGENT_PROTOCOL_INCOMPATIBLE: "Codex \u751F\u6210\u7684 App Server Schema \u4E0D\u6EE1\u8DB3 SpotPatch \u6240\u9700\u534F\u8BAE\u5B50\u96C6\u3002",
1129
1140
  CODEX_CONFIG_ISOLATION_UNSUPPORTED: "\u5F53\u524D Codex \u7248\u672C\u65E0\u6CD5\u8BC1\u660E\u53D7\u7BA1\u914D\u7F6E\u9694\u79BB\u3002",
1130
1141
  MANAGED_GRANT_INVALID: "\u4FDD\u5B58\u7684\u9879\u76EE\u6388\u6743\u672A\u901A\u8FC7\u6821\u9A8C\u3002",
1131
1142
  MANAGED_PLATFORM_UNSUPPORTED: "\u5F53\u524D\u5E73\u53F0\u5C1A\u672A\u8BC1\u660E\u53EF\u5B89\u5168\u8FD0\u884C\u53D7\u7BA1\u6267\u884C\u3002",
@@ -1133,14 +1144,14 @@ var MESSAGES = Object.freeze({
1133
1144
  MANAGED_SNAPSHOT_FAILED: "\u65E0\u6CD5\u521B\u5EFA\u72EC\u7ACB\u5DE5\u4F5C\u533A\u5FEB\u7167\u3002",
1134
1145
  MANAGED_SCOPE_VIOLATION: "\u5019\u9009\u4FEE\u6539\u8D85\u51FA\u6388\u6743\u8DEF\u5F84\u3002",
1135
1146
  MANAGED_CHANGE_LIMIT_EXCEEDED: "\u5019\u9009\u4FEE\u6539\u8D85\u8FC7\u5B89\u5168\u4E0A\u9650\u3002",
1136
- MANAGED_VALIDATION_FAILED: "required check \u5931\u8D25\u6216\u6539\u53D8\u4E86\u5019\u9009 diff\u3002",
1147
+ MANAGED_VALIDATION_FAILED: "\u5019\u9009\u4FEE\u6539\u672A\u901A\u8FC7\u5BA1\u8BA1\u6216\u9A8C\u8BC1\u3002",
1137
1148
  MANAGED_WORKSPACE_CONFLICT: "\u6267\u884C\u671F\u95F4\u6388\u6743\u6E90\u7801\u53D1\u751F\u4E86\u53D8\u5316\u3002",
1138
1149
  MANAGED_APPLY_FAILED: "\u5DF2\u5BA1\u8BA1\u4FEE\u6539\u65E0\u6CD5\u5B89\u5168\u5199\u5165\u3002",
1139
1150
  MANAGED_CLEANUP_INCOMPLETE: "\u53D7\u7BA1 thread \u6216\u5DE5\u4F5C\u533A\u6E05\u7406\u4E0D\u5B8C\u6574\u3002"
1140
1151
  }),
1141
1152
  controlActionText: Object.freeze({
1142
1153
  "install-agent": "\u5B89\u88C5 Codex \u540E\u91CD\u8BD5\u3002",
1143
- "use-supported-version": "\u6539\u7528\u53D7\u652F\u6301\u7684 Codex \u7248\u672C\u3002",
1154
+ "use-supported-version": "\u6539\u7528 Schema \u517C\u5BB9\u7684 Codex \u7248\u672C\u3002",
1144
1155
  "sign-in": "\u767B\u5F55 Codex \u540E\u91CD\u8BD5\u3002",
1145
1156
  "choose-available-model": "\u5728 Codex \u914D\u7F6E\u4E2D\u9009\u62E9\u53EF\u7528\u6A21\u578B\u3002",
1146
1157
  "use-inbox": "\u7EE7\u7EED\u4F7F\u7528 Agent \u6536\u4EF6\u7BB1\u964D\u7EA7\u8DEF\u5F84\u3002",
@@ -1277,6 +1288,7 @@ function controlStatusText(value, messages) {
1277
1288
  const parts = [
1278
1289
  messages.controlConnection(value.connectionState, value.mode),
1279
1290
  messages.controlAuth(value.authReadiness, value.grantState),
1291
+ ...value.connectionState === "awaiting-consent" && value.grantState === "missing" ? [messages.controlConsentRequired] : [],
1280
1292
  ...model === void 0 ? [] : [messages.controlModel(model)],
1281
1293
  ...task === void 0 ? [] : [
1282
1294
  messages.controlRevision(task),
@@ -1309,11 +1321,13 @@ function managedResultText(result, messages) {
1309
1321
  ...timings
1310
1322
  ].join("\n");
1311
1323
  }
1312
- function createExternalHandoffPanel(document, framework, locale, sessionId, subscribeLocale, onViewChange) {
1324
+ function createExternalHandoffPanel(document, framework, locale, sessionId, subscribeLocale, onViewChange, onDispatchChange, onControlChange) {
1313
1325
  const options = {
1314
1326
  document,
1315
1327
  framework,
1316
1328
  locale,
1329
+ ...onDispatchChange === void 0 ? {} : { onDispatchChange },
1330
+ ...onControlChange === void 0 ? {} : { onControlChange },
1317
1331
  onViewChange,
1318
1332
  sessionId,
1319
1333
  subscribeLocale
@@ -1338,6 +1352,7 @@ function createExternalHandoffPanel(document, framework, locale, sessionId, subs
1338
1352
  root.hidden = true;
1339
1353
  const heading = createMarkedElement(document, "div");
1340
1354
  heading.className = "spotpatch-external-heading";
1355
+ heading.setAttribute("data-spotpatch-agent-identity", "");
1341
1356
  const title = createMarkedElement(document, "strong");
1342
1357
  const refreshButton = createButton(document, "", "spotpatch-external-refresh");
1343
1358
  heading.append(title, refreshButton);
@@ -1566,6 +1581,7 @@ function createExternalHandoffPanel(document, framework, locale, sessionId, subs
1566
1581
  status.textContent = summaryMessage(result.handoff);
1567
1582
  }
1568
1583
  refreshActions();
1584
+ options.onDispatchChange?.(result.dispatch);
1569
1585
  options.onViewChange();
1570
1586
  };
1571
1587
  return Object.freeze({
@@ -1607,6 +1623,7 @@ function createExternalHandoffPanel(document, framework, locale, sessionId, subs
1607
1623
  status.dataset.state = capability.brokerReady ? "ready" : "error";
1608
1624
  status.textContent = capability.brokerReady ? capability.activeAdapter?.canDispatch === true ? messages.activeReady(agentName(capability.activeAdapter.kind)) : capability.dispatch !== null && capability.activeAdapter !== null ? dispatchMessage(messages, capability.dispatch) : capability.activeWaitCount > 0 ? messages.readyWaiting(capability.activeWaitCount) : messages.ready : messages.error("EXTERNAL_HANDOFF_UNAVAILABLE");
1609
1625
  refreshActions();
1626
+ options.onDispatchChange?.(capability.dispatch);
1610
1627
  options.onViewChange();
1611
1628
  },
1612
1629
  renderPublishing() {
@@ -1635,6 +1652,7 @@ function createExternalHandoffPanel(document, framework, locale, sessionId, subs
1635
1652
  controlStatus.dataset.state = value.connectionState;
1636
1653
  disclosureNoGuarantee.textContent = value.mode === "managed" ? messages.disclosureManagedGuarantee : messages.disclosureNoGuarantee;
1637
1654
  refreshControlActions();
1655
+ options.onControlChange?.(value);
1638
1656
  options.onViewChange();
1639
1657
  },
1640
1658
  renderControlUnavailable() {
@@ -1643,6 +1661,7 @@ function createExternalHandoffPanel(document, framework, locale, sessionId, subs
1643
1661
  controlStatus.textContent = messages.controlUnavailable;
1644
1662
  disclosureNoGuarantee.textContent = messages.disclosureNoGuarantee;
1645
1663
  refreshControlActions();
1664
+ options.onControlChange?.(void 0);
1646
1665
  options.onViewChange();
1647
1666
  },
1648
1667
  renderManagedResult(result) {
@@ -1660,6 +1679,7 @@ function createExternalHandoffPanel(document, framework, locale, sessionId, subs
1660
1679
  status.dataset.state = "error";
1661
1680
  status.textContent = canRetry ? `${messages.error(code)} ${messages.retry}.` : messages.error(code);
1662
1681
  refreshActions();
1682
+ options.onDispatchChange?.(null);
1663
1683
  options.onViewChange();
1664
1684
  },
1665
1685
  setBusy(nextBusy) {