@spotpatch/runtime 1.15.2 → 1.15.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.
- package/dist/chunk-ELCIEQGT.js +183 -0
- package/dist/chunk-ELCIEQGT.js.map +1 -0
- package/dist/contextual-ask-panel.cjs +100 -92
- package/dist/contextual-ask-panel.cjs.map +1 -1
- package/dist/contextual-ask-panel.js +74 -235
- package/dist/contextual-ask-panel.js.map +1 -1
- package/dist/data-flow-panel.cjs +28 -28
- package/dist/data-flow-panel.cjs.map +1 -1
- package/dist/data-flow-panel.js +28 -28
- package/dist/data-flow-panel.js.map +1 -1
- package/dist/external-handoff-panel.cjs +300 -110
- package/dist/external-handoff-panel.cjs.map +1 -1
- package/dist/external-handoff-panel.js +132 -110
- package/dist/external-handoff-panel.js.map +1 -1
- package/dist/index.cjs +284 -284
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +284 -284
- package/dist/index.js.map +1 -1
- package/dist/motion.cjs +2 -2
- package/dist/motion.cjs.map +1 -1
- package/dist/motion.js +2 -2
- package/dist/motion.js.map +1 -1
- package/package.json +2 -2
|
@@ -2,6 +2,10 @@ import {
|
|
|
2
2
|
getExternalHandoffExtension,
|
|
3
3
|
registerExternalHandoffExtension
|
|
4
4
|
} from "./chunk-TEH2CCO3.js";
|
|
5
|
+
import {
|
|
6
|
+
SELECT_PICKER_STYLES,
|
|
7
|
+
createSelectPicker
|
|
8
|
+
} from "./chunk-ELCIEQGT.js";
|
|
5
9
|
import {
|
|
6
10
|
createButton,
|
|
7
11
|
createMarkedElement
|
|
@@ -13,6 +17,7 @@ import {
|
|
|
13
17
|
EXTERNAL_AGENT_CONTROL_LIMITS as EXTERNAL_AGENT_CONTROL_LIMITS2,
|
|
14
18
|
EXTERNAL_AGENT_MANAGED_PROFILE,
|
|
15
19
|
EXTERNAL_HANDOFF_BROKER_PROTOCOL_VERSION,
|
|
20
|
+
EXTERNAL_HANDOFF_FRAMEWORKS,
|
|
16
21
|
EXTERNAL_HANDOFF_LIMITS,
|
|
17
22
|
EXTERNAL_HANDOFF_SNAPSHOT_SCHEMA_VERSION,
|
|
18
23
|
SPOTPATCH_ENDPOINTS as SPOTPATCH_ENDPOINTS2,
|
|
@@ -494,6 +499,9 @@ function parseStatusResult(value) {
|
|
|
494
499
|
dispatch
|
|
495
500
|
});
|
|
496
501
|
}
|
|
502
|
+
function isExternalHandoffFramework(value) {
|
|
503
|
+
return EXTERNAL_HANDOFF_FRAMEWORKS.some((framework) => framework === value);
|
|
504
|
+
}
|
|
497
505
|
function parseSummary(value) {
|
|
498
506
|
if (!record(value)) throw new ExternalHandoffApiError();
|
|
499
507
|
const expectedKeys = [
|
|
@@ -509,7 +517,7 @@ function parseSummary(value) {
|
|
|
509
517
|
"targetCount",
|
|
510
518
|
...value.pickedUpAt === void 0 ? [] : ["pickedUpAt"]
|
|
511
519
|
];
|
|
512
|
-
if (!exactKeys(value, expectedKeys) || typeof value.sessionId !== "string" || !OPAQUE_ID_PATTERN.test(value.sessionId) || value.framework
|
|
520
|
+
if (!exactKeys(value, expectedKeys) || typeof value.sessionId !== "string" || !OPAQUE_ID_PATTERN.test(value.sessionId) || !isExternalHandoffFramework(value.framework) || !Number.isSafeInteger(value.revision) || value.revision <= 0 || typeof value.cursor !== "string" || !OPAQUE_ID_PATTERN.test(value.cursor) || !Number.isSafeInteger(value.targetCount) || value.targetCount <= 0 || !record(value.page) || !exactKeys(value.page, ["origin", "pathname"]) || typeof value.page.origin !== "string" || typeof value.page.pathname !== "string" || !validTimestamp(value.publishedAt) || !validTimestamp(value.expiresAt) || value.state !== "available" && value.state !== "expired" && value.state !== "superseded" || !Number.isSafeInteger(value.pickupCount) || value.pickupCount < 0 || value.pickupCount > EXTERNAL_HANDOFF_LIMITS.maximumConnectorReceipts || value.pickedUpAt !== void 0 && !validTimestamp(value.pickedUpAt)) {
|
|
513
521
|
throw new ExternalHandoffApiError();
|
|
514
522
|
}
|
|
515
523
|
return Object.freeze({
|
|
@@ -1015,19 +1023,19 @@ var MESSAGES = Object.freeze({
|
|
|
1015
1023
|
modelLoading: "Connect to load available models",
|
|
1016
1024
|
modelHint: "Applies only to this managed connection, not API Key settings. Apply changes before publishing; switching reconnects Codex.",
|
|
1017
1025
|
applyModel: "Apply model",
|
|
1018
|
-
codexManaged: "Codex
|
|
1026
|
+
codexManaged: "Codex · managed (experimental)",
|
|
1019
1027
|
connectManaged: "Connect Codex",
|
|
1020
1028
|
disconnectManaged: "Disconnect",
|
|
1021
1029
|
revokeManaged: "Revoke grant",
|
|
1022
1030
|
cancelManaged: "Cancel managed task",
|
|
1023
1031
|
resultTitle: "Managed result",
|
|
1024
|
-
controlConnection: (state, mode) => `Connection: ${state}
|
|
1025
|
-
controlAuth: (auth, grant) => `Auth: ${auth}
|
|
1032
|
+
controlConnection: (state, mode) => `Connection: ${state} · Mode: ${mode}`,
|
|
1033
|
+
controlAuth: (auth, grant) => `Auth: ${auth} · Grant: ${grant}`,
|
|
1026
1034
|
controlConsentRequired: (command) => `Initialize project access once: run \`${command}\` from this project, then connect again. No dev-terminal confirmation is required. The grant allows isolated snapshot writes and validated application; revoke it here at any time.`,
|
|
1027
1035
|
controlModel: (model) => `Model: ${model}`,
|
|
1028
1036
|
controlRevision: (task) => `Revision ${String(task.revision)}: ${task.deliveryStatus} / ${task.executionStatus} / ${task.managedPhase}`,
|
|
1029
1037
|
controlValidation: (outcome) => `Validation: ${outcome}`,
|
|
1030
|
-
controlFailure: (error, action) => `Error: ${error}
|
|
1038
|
+
controlFailure: (error, action) => `Error: ${error} · Next: ${action}`,
|
|
1031
1039
|
controlUnavailable: "Page connection management is unavailable; external handoffs still fall back honestly to the Agent inbox.",
|
|
1032
1040
|
controlErrorText: Object.freeze({
|
|
1033
1041
|
AGENT_BINARY_NOT_FOUND: "Codex is not installed or is not on PATH.",
|
|
@@ -1061,17 +1069,17 @@ var MESSAGES = Object.freeze({
|
|
|
1061
1069
|
retry: "Retry the managed connection.",
|
|
1062
1070
|
"inspect-cleanup-warning": "Inspect cleanup status before reconnecting."
|
|
1063
1071
|
}),
|
|
1064
|
-
resultHeader: (revision, outcome) => `Revision ${String(revision)}
|
|
1072
|
+
resultHeader: (revision, outcome) => `Revision ${String(revision)} · Validation ${outcome}`,
|
|
1065
1073
|
resultDisposition: (outcome) => outcome === "passed" ? "Applied to the project after validation passed." : `Candidate only; it was not applied because validation is ${outcome}.`,
|
|
1066
1074
|
resultTiming: (stage, durationMs) => `Timing ${stage}: ${String(durationMs)} ms`,
|
|
1067
1075
|
description: "Send through a ready active adapter, or publish to the project Agent inbox when no active adapter is connected.",
|
|
1068
1076
|
ready: "Local Broker ready. No Agent connection is assumed until a connector reads or waits.",
|
|
1069
1077
|
readyWaiting: (count) => `${String(count)} active connector wait request(s); publishing can wake them immediately.`,
|
|
1070
1078
|
activeReady: (agent) => `${agent} is connected and idle. The next send will dispatch immediately.`,
|
|
1071
|
-
publishing: "Authorizing current source and publishing the handoff
|
|
1079
|
+
publishing: "Authorizing current source and publishing the handoff…",
|
|
1072
1080
|
published: (revision, expiresAt) => `Revision ${String(revision)} is available until ${expiresAt}. It has not been claimed as edited.`,
|
|
1073
1081
|
queued: (agent, revision) => `Revision ${String(revision)} is reserved for ${agent}.`,
|
|
1074
|
-
dispatching: (agent, revision) => `Dispatching revision ${String(revision)} to ${agent}
|
|
1082
|
+
dispatching: (agent, revision) => `Dispatching revision ${String(revision)} to ${agent}…`,
|
|
1075
1083
|
dispatched: (agent, revision) => agent === "Claude Code" ? `Revision ${String(revision)} was written to the Claude Channel transport; there is no model ACK yet.` : `Codex App Server accepted revision ${String(revision)}; waiting for the matching turn to start.`,
|
|
1076
1084
|
working: (agent, revision) => `${agent} is working on revision ${String(revision)}.`,
|
|
1077
1085
|
completed: (agent, revision) => `${agent} ended revision ${String(revision)} normally. Review the diff and checks; this does not prove the requested change is correct.`,
|
|
@@ -1085,7 +1093,7 @@ var MESSAGES = Object.freeze({
|
|
|
1085
1093
|
inboxSend: "Publish to Agent inbox",
|
|
1086
1094
|
retry: "Retry same send",
|
|
1087
1095
|
refresh: "Refresh pickup status",
|
|
1088
|
-
resolveUnknown: "Workspace reviewed
|
|
1096
|
+
resolveUnknown: "Workspace reviewed — allow a new task",
|
|
1089
1097
|
settingsTitle: "Project connection setup",
|
|
1090
1098
|
settingsHelp: "Codex managed mode is owned by the current development server. The browser never receives vendor credentials or arbitrary command access. Generic and attached adapters remain honest Inbox fallbacks.",
|
|
1091
1099
|
disclosureTitle: "Confirm external Agent handoff",
|
|
@@ -1100,100 +1108,101 @@ var MESSAGES = Object.freeze({
|
|
|
1100
1108
|
error: (code) => code === "EXTERNAL_AGENT_BUSY" ? "The active Agent is still busy or blocked by an uncertain delivery." : code === "ACTIVE_DISPATCH_INVALID" ? "The active delivery state changed. Refresh before continuing." : code === "HANDOFF_SOURCE_STALE" ? "The selected source changed. Select the current component again." : code === "HANDOFF_RESPONSE_TOO_LARGE" ? "The handoff is too large. Reduce the selected context." : code === "EXTERNAL_HANDOFF_DISABLED" ? "External Agent handoff is disabled in trusted project configuration." : code === "EXTERNAL_HANDOFF_UNAVAILABLE" || code === "SESSION_CLOSED" ? "The local external Agent Broker is unavailable. Restart the development server." : "The external Agent handoff request failed without publishing a partial revision."
|
|
1101
1109
|
}),
|
|
1102
1110
|
"zh-CN": Object.freeze({
|
|
1103
|
-
title: "
|
|
1111
|
+
title: "外部 Agent 连接",
|
|
1104
1112
|
agentLabel: "Agent",
|
|
1105
|
-
modelLabel: "
|
|
1106
|
-
modelLoading: "
|
|
1107
|
-
modelHint: "
|
|
1108
|
-
applyModel: "
|
|
1109
|
-
codexManaged: "Codex
|
|
1110
|
-
connectManaged: "
|
|
1111
|
-
disconnectManaged: "
|
|
1112
|
-
revokeManaged: "
|
|
1113
|
-
cancelManaged: "
|
|
1114
|
-
resultTitle: "
|
|
1115
|
-
controlConnection: (state, mode) =>
|
|
1116
|
-
controlAuth: (auth, grant) =>
|
|
1117
|
-
controlConsentRequired: (command) =>
|
|
1118
|
-
controlModel: (model) =>
|
|
1119
|
-
controlRevision: (task) => `revision ${String(task.revision)}
|
|
1120
|
-
controlValidation: (outcome) =>
|
|
1121
|
-
controlFailure: (error, action) =>
|
|
1122
|
-
controlUnavailable: "
|
|
1113
|
+
modelLabel: "受管 Codex 模型",
|
|
1114
|
+
modelLoading: "连接后加载可用模型",
|
|
1115
|
+
modelHint: "仅作用于此受管连接,不修改 API Key 配置。更换后请先应用模型,再发布任务;应用时会重新连接 Codex。",
|
|
1116
|
+
applyModel: "应用模型",
|
|
1117
|
+
codexManaged: "Codex · 受管模式(实验性)",
|
|
1118
|
+
connectManaged: "连接 Codex",
|
|
1119
|
+
disconnectManaged: "断开连接",
|
|
1120
|
+
revokeManaged: "撤销授权",
|
|
1121
|
+
cancelManaged: "取消受管任务",
|
|
1122
|
+
resultTitle: "受管执行结果",
|
|
1123
|
+
controlConnection: (state, mode) => `连接:${state} · 模式:${mode}`,
|
|
1124
|
+
controlAuth: (auth, grant) => `认证:${auth} · 授权:${grant}`,
|
|
1125
|
+
controlConsentRequired: (command) => `请在当前项目执行一次初始化:\`${command}\`,然后重新连接,无需在开发终端输入 yes。授权允许隔离快照修改及校验后的应用,可随时在此撤销。`,
|
|
1126
|
+
controlModel: (model) => `模型:${model}`,
|
|
1127
|
+
controlRevision: (task) => `revision ${String(task.revision)}:${task.deliveryStatus} / ${task.executionStatus} / ${task.managedPhase}`,
|
|
1128
|
+
controlValidation: (outcome) => `验证:${outcome}`,
|
|
1129
|
+
controlFailure: (error, action) => `错误:${error} · 下一步:${action}`,
|
|
1130
|
+
controlUnavailable: "页面连接管理不可用;外部交接仍会按真实能力降级为 Agent 收件箱。",
|
|
1123
1131
|
controlErrorText: Object.freeze({
|
|
1124
|
-
AGENT_BINARY_NOT_FOUND: "
|
|
1125
|
-
AGENT_BINARY_UNTRUSTED: "
|
|
1126
|
-
AGENT_VERSION_UNSUPPORTED: "
|
|
1127
|
-
APP_SERVER_HANDSHAKE_FAILED: "Codex App Server
|
|
1128
|
-
AGENT_AUTH_REQUIRED: "Codex
|
|
1129
|
-
AGENT_MODEL_UNAVAILABLE: "Codex
|
|
1130
|
-
AGENT_PROTOCOL_INCOMPATIBLE: "Codex
|
|
1131
|
-
CODEX_CONFIG_ISOLATION_UNSUPPORTED: "
|
|
1132
|
-
MANAGED_GRANT_INVALID: "
|
|
1133
|
-
MANAGED_PLATFORM_UNSUPPORTED: "
|
|
1134
|
-
MANAGED_GIT_REQUIRED: "
|
|
1135
|
-
MANAGED_SNAPSHOT_FAILED: "
|
|
1136
|
-
MANAGED_SCOPE_VIOLATION: "
|
|
1137
|
-
MANAGED_CHANGE_LIMIT_EXCEEDED: "
|
|
1138
|
-
MANAGED_VALIDATION_FAILED: "
|
|
1139
|
-
MANAGED_WORKSPACE_CONFLICT: "
|
|
1140
|
-
MANAGED_APPLY_FAILED: "
|
|
1141
|
-
MANAGED_CLEANUP_INCOMPLETE: "
|
|
1132
|
+
AGENT_BINARY_NOT_FOUND: "未安装 Codex,或 Codex 不在 PATH 中。",
|
|
1133
|
+
AGENT_BINARY_UNTRUSTED: "解析到的 Codex 可执行文件不可信。",
|
|
1134
|
+
AGENT_VERSION_UNSUPPORTED: "已安装的 Codex 版本低于 SpotPatch 兼容基线。",
|
|
1135
|
+
APP_SERVER_HANDSHAKE_FAILED: "Codex App Server 未完成启动握手。",
|
|
1136
|
+
AGENT_AUTH_REQUIRED: "Codex 需要已登录的账户。",
|
|
1137
|
+
AGENT_MODEL_UNAVAILABLE: "Codex 配置的模型当前不可用。",
|
|
1138
|
+
AGENT_PROTOCOL_INCOMPATIBLE: "Codex 生成的 App Server Schema 不满足 SpotPatch 所需协议子集。",
|
|
1139
|
+
CODEX_CONFIG_ISOLATION_UNSUPPORTED: "当前 Codex 版本无法证明受管配置隔离。",
|
|
1140
|
+
MANAGED_GRANT_INVALID: "保存的项目授权未通过校验。",
|
|
1141
|
+
MANAGED_PLATFORM_UNSUPPORTED: "当前平台尚未证明可安全运行受管执行。",
|
|
1142
|
+
MANAGED_GIT_REQUIRED: "受管执行要求项目位于 Git 仓库中。",
|
|
1143
|
+
MANAGED_SNAPSHOT_FAILED: "无法创建独立工作区快照。",
|
|
1144
|
+
MANAGED_SCOPE_VIOLATION: "候选修改超出授权路径。",
|
|
1145
|
+
MANAGED_CHANGE_LIMIT_EXCEEDED: "候选修改超过安全上限。",
|
|
1146
|
+
MANAGED_VALIDATION_FAILED: "候选修改未通过审计或验证。",
|
|
1147
|
+
MANAGED_WORKSPACE_CONFLICT: "执行期间授权源码发生了变化。",
|
|
1148
|
+
MANAGED_APPLY_FAILED: "已审计修改无法安全写入。",
|
|
1149
|
+
MANAGED_CLEANUP_INCOMPLETE: "受管 thread 或工作区清理不完整。"
|
|
1142
1150
|
}),
|
|
1143
1151
|
controlActionText: Object.freeze({
|
|
1144
|
-
"install-agent": "
|
|
1145
|
-
"use-supported-version": "
|
|
1146
|
-
"sign-in": "
|
|
1147
|
-
"choose-available-model": "
|
|
1148
|
-
"use-inbox": "
|
|
1149
|
-
"confirm-managed-access": "
|
|
1150
|
-
"review-candidate-diff": "
|
|
1151
|
-
"review-workspace-conflict": "
|
|
1152
|
-
retry: "
|
|
1153
|
-
"inspect-cleanup-warning": "
|
|
1152
|
+
"install-agent": "安装 Codex 后重试。",
|
|
1153
|
+
"use-supported-version": "改用 Schema 兼容的 Codex 版本。",
|
|
1154
|
+
"sign-in": "登录 Codex 后重试。",
|
|
1155
|
+
"choose-available-model": "选择可用模型后重新连接 Codex。",
|
|
1156
|
+
"use-inbox": "继续使用 Agent 收件箱降级路径。",
|
|
1157
|
+
"confirm-managed-access": "撤销无效授权并重新确认。",
|
|
1158
|
+
"review-candidate-diff": "检查候选 diff 和验证输出。",
|
|
1159
|
+
"review-workspace-conflict": "检查工作区变化后再重试。",
|
|
1160
|
+
retry: "重试受管连接。",
|
|
1161
|
+
"inspect-cleanup-warning": "确认清理状态后再连接。"
|
|
1154
1162
|
}),
|
|
1155
|
-
resultHeader: (revision, outcome) => `revision ${String(revision)}
|
|
1156
|
-
resultDisposition: (outcome) => outcome === "passed" ? "
|
|
1157
|
-
resultTiming: (stage, durationMs) =>
|
|
1158
|
-
description: "
|
|
1159
|
-
ready: "
|
|
1160
|
-
readyWaiting: (count) =>
|
|
1161
|
-
activeReady: (agent) => `${agent}
|
|
1162
|
-
publishing: "
|
|
1163
|
-
published: (revision, expiresAt) =>
|
|
1164
|
-
queued: (agent, revision) =>
|
|
1165
|
-
dispatching: (agent, revision) =>
|
|
1166
|
-
dispatched: (agent, revision) => agent === "Claude Code" ? `revision ${String(revision)}
|
|
1167
|
-
working: (agent, revision) => `${agent}
|
|
1168
|
-
completed: (agent, revision) => `${agent}
|
|
1169
|
-
failed: (agent, revision) => `${agent}
|
|
1170
|
-
unknown: (agent, revision) => `revision ${String(revision)}
|
|
1171
|
-
unknownResolved: (agent, revision) => `${agent}
|
|
1172
|
-
pickedUp: (revision, count, time) =>
|
|
1173
|
-
expired: (revision) =>
|
|
1174
|
-
superseded: (revision) =>
|
|
1175
|
-
send: "
|
|
1176
|
-
inboxSend: "
|
|
1177
|
-
retry: "
|
|
1178
|
-
refresh: "
|
|
1179
|
-
resolveUnknown: "
|
|
1180
|
-
settingsTitle: "
|
|
1181
|
-
settingsHelp: "Codex
|
|
1182
|
-
disclosureTitle: "
|
|
1183
|
-
disclosureIntro: (targets, files) =>
|
|
1184
|
-
disclosureData: "
|
|
1185
|
-
disclosureInbox: "15
|
|
1186
|
-
disclosureProvider: "Agent
|
|
1187
|
-
disclosureNoGuarantee: "
|
|
1188
|
-
disclosureManagedGuarantee: "
|
|
1189
|
-
cancel: "
|
|
1190
|
-
confirm: "
|
|
1191
|
-
error: (code) => code === "EXTERNAL_AGENT_BUSY" ? "
|
|
1163
|
+
resultHeader: (revision, outcome) => `revision ${String(revision)} · 验证 ${outcome}`,
|
|
1164
|
+
resultDisposition: (outcome) => outcome === "passed" ? "验证通过,修改已写入项目。" : `这只是候选 diff;验证状态为 ${outcome},因此没有写入项目。`,
|
|
1165
|
+
resultTiming: (stage, durationMs) => `耗时 ${stage}: ${String(durationMs)} ms`,
|
|
1166
|
+
description: "有主动适配器就立即派发;未连接主动适配器时,诚实降级为项目 Agent 收件箱。",
|
|
1167
|
+
ready: "本地 Broker 已就绪。只有连接器读取或等待后,才能证明发生过连接。",
|
|
1168
|
+
readyWaiting: (count) => `当前有 ${String(count)} 个连接器等待请求,发布后可立即唤醒。`,
|
|
1169
|
+
activeReady: (agent) => `${agent} 已连接并处于空闲状态,下次发送会立即派发。`,
|
|
1170
|
+
publishing: "正在重新授权当前源码并发布交接……",
|
|
1171
|
+
published: (revision, expiresAt) => `交接 revision ${String(revision)} 可读取至 ${expiresAt};这不表示代码已被修改。`,
|
|
1172
|
+
queued: (agent, revision) => `交接 revision ${String(revision)} 已为 ${agent} 预留。`,
|
|
1173
|
+
dispatching: (agent, revision) => `正在把 revision ${String(revision)} 派发给 ${agent}……`,
|
|
1174
|
+
dispatched: (agent, revision) => agent === "Claude Code" ? `revision ${String(revision)} 已写入 Claude Channel transport;当前没有模型 ACK。` : `Codex App Server 已接受 revision ${String(revision)},正在等待匹配 turn 启动。`,
|
|
1175
|
+
working: (agent, revision) => `${agent} 正在处理 revision ${String(revision)}。`,
|
|
1176
|
+
completed: (agent, revision) => `${agent} 已正常结束 revision ${String(revision)}。请核对 diff 和检查结果;这不证明修改要求已经正确完成。`,
|
|
1177
|
+
failed: (agent, revision) => `${agent} 已将 revision ${String(revision)} 报告为失败,连接器已恢复空闲。`,
|
|
1178
|
+
unknown: (agent, revision) => `revision ${String(revision)} 向 ${agent} 的投递结果不确定。受管 writer 已停止,请先核对工作区再允许新任务。`,
|
|
1179
|
+
unknownResolved: (agent, revision) => `${agent} 的 revision ${String(revision)} 仍记为投递未知,但工作区核对已经确认;现在可以重新连接或发布新的收件箱任务。`,
|
|
1180
|
+
pickedUp: (revision, count, time) => `交接 revision ${String(revision)} 已被 ${String(count)} 个连接器实例取走${time === void 0 ? "。" : `,最近取件于 ${time}。`}这不能证明代码已经修改。`,
|
|
1181
|
+
expired: (revision) => `交接 revision ${String(revision)} 已过期,请核对当前选择后重新发布。`,
|
|
1182
|
+
superseded: (revision) => `交接 revision ${String(revision)} 已被更新版本取代。`,
|
|
1183
|
+
send: "发送给 Agent",
|
|
1184
|
+
inboxSend: "发布到 Agent 收件箱",
|
|
1185
|
+
retry: "重试同一次发送",
|
|
1186
|
+
refresh: "刷新取件状态",
|
|
1187
|
+
resolveUnknown: "已核对工作区,允许新任务",
|
|
1188
|
+
settingsTitle: "项目连接设置",
|
|
1189
|
+
settingsHelp: "Codex 受管模式由当前开发服务托管,浏览器不会获得厂商凭证或任意命令权限;通用与 attached adapter 仍按真实能力降级为收件箱。",
|
|
1190
|
+
disclosureTitle: "确认发布到外部 Agent",
|
|
1191
|
+
disclosureIntro: (targets, files) => `将发布 ${String(targets)} 个目标,涉及 ${String(files)} 个项目相对文件。`,
|
|
1192
|
+
disclosureData: "交接包含修改说明、组件与页面上下文、已清洗的 DOM/CSS,以及本地 Node 服务重新读取的有界源码。",
|
|
1193
|
+
disclosureInbox: "15 分钟有效期内,本项目中任何已配置的 SpotPatch Connector 都可能读取。",
|
|
1194
|
+
disclosureProvider: "Agent 宿主可能依据其产品数据策略,将内容发送给云端模型服务。",
|
|
1195
|
+
disclosureNoGuarantee: "外部修改不具备 SpotPatch 内建 Agent 的 worktree、Apply 或 Revert 保证。",
|
|
1196
|
+
disclosureManagedGuarantee: "受管 Codex 只写独立临时快照。SpotPatch 会审计 diff,且仅在所有可信 required checks 通过后才写入业务仓库。",
|
|
1197
|
+
cancel: "取消",
|
|
1198
|
+
confirm: "确认并发送",
|
|
1199
|
+
error: (code) => code === "EXTERNAL_AGENT_BUSY" ? "主动 Agent 仍在工作,或存在尚未核对的投递未知状态。" : code === "ACTIVE_DISPATCH_INVALID" ? "主动投递状态已经变化,请刷新后再继续。" : code === "HANDOFF_SOURCE_STALE" ? "选中源码已经变化,请重新选择当前组件。" : code === "HANDOFF_RESPONSE_TOO_LARGE" ? "交接内容超过上限,请减少所选上下文。" : code === "EXTERNAL_HANDOFF_DISABLED" ? "可信项目配置没有启用外部 Agent 交接。" : code === "EXTERNAL_HANDOFF_UNAVAILABLE" || code === "SESSION_CLOSED" ? "本地外部 Agent Broker 不可用,请重启开发服务。" : "外部 Agent 交接请求失败,未发布任何部分 revision。"
|
|
1192
1200
|
})
|
|
1193
1201
|
});
|
|
1194
1202
|
function createStyles(document) {
|
|
1195
1203
|
const styles = document.createElement("style");
|
|
1196
1204
|
styles.textContent = `
|
|
1205
|
+
${SELECT_PICKER_STYLES}
|
|
1197
1206
|
.spotpatch-external-handoff { margin-top: 12px; padding: 12px; border: 1px solid var(--spotpatch-border); border-radius: var(--spotpatch-radius-card); background: rgb(82 168 255 / 5%); }
|
|
1198
1207
|
.spotpatch-external-handoff[hidden] { display: none; }
|
|
1199
1208
|
.spotpatch-external-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
|
|
@@ -1203,8 +1212,10 @@ function createStyles(document) {
|
|
|
1203
1212
|
.spotpatch-external-status[data-state="error"] { border-color: var(--spotpatch-danger); color: #fecdd3; }
|
|
1204
1213
|
.spotpatch-external-status[data-state="picked-up"] { border-color: var(--spotpatch-success); color: #a7f3d0; }
|
|
1205
1214
|
.spotpatch-external-control { margin-top: 9px; padding: 9px; border: 1px solid var(--spotpatch-border); border-radius: 8px; background: rgb(3 7 18 / 28%); }
|
|
1206
|
-
.spotpatch-external-control
|
|
1207
|
-
.spotpatch-external-control
|
|
1215
|
+
.spotpatch-external-control-field { display: grid; gap: 5px; min-width: 0; }
|
|
1216
|
+
.spotpatch-external-control-field + .spotpatch-external-control-field { margin-top: 9px; }
|
|
1217
|
+
.spotpatch-external-control-field > label { color: var(--spotpatch-text-secondary); font-size: 10px; }
|
|
1218
|
+
.spotpatch-external-agent-value { box-sizing: border-box; display: flex; width: 100%; min-height: 38px; align-items: center; border: 1px solid var(--spotpatch-border); border-radius: 9px; padding: 0 11px; overflow: hidden; color: var(--spotpatch-text); background: rgb(255 255 255 / 3%); font: inherit; text-overflow: ellipsis; white-space: nowrap; }
|
|
1208
1219
|
.spotpatch-external-control-status { margin: 7px 0 0; color: #cbd5e1; font-size: 10.5px; line-height: 1.5; white-space: pre-wrap; }
|
|
1209
1220
|
.spotpatch-external-control-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
|
|
1210
1221
|
.spotpatch-external-control-actions button { padding: 5px 8px; border: 1px solid var(--spotpatch-border); border-radius: 6px; background: var(--spotpatch-bg-active); color: var(--spotpatch-text); font: inherit; font-size: 10px; cursor: pointer; }
|
|
@@ -1359,18 +1370,24 @@ function createExternalHandoffPanel(document, framework, locale, sessionId, subs
|
|
|
1359
1370
|
status.setAttribute("aria-live", "polite");
|
|
1360
1371
|
const controlRoot = createMarkedElement(document, "div");
|
|
1361
1372
|
controlRoot.className = "spotpatch-external-control";
|
|
1373
|
+
const agentField = createMarkedElement(document, "div");
|
|
1374
|
+
agentField.className = "spotpatch-external-control-field";
|
|
1362
1375
|
const agentLabel = createMarkedElement(document, "label");
|
|
1363
1376
|
const agentLabelText = createMarkedElement(document, "span");
|
|
1364
|
-
const
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1377
|
+
const agentValue = createMarkedElement(document, "div");
|
|
1378
|
+
agentValue.className = "spotpatch-external-agent-value";
|
|
1379
|
+
agentLabel.append(agentLabelText);
|
|
1380
|
+
agentField.append(agentLabel, agentValue);
|
|
1381
|
+
const modelField = createMarkedElement(document, "div");
|
|
1382
|
+
modelField.className = "spotpatch-external-control-field";
|
|
1369
1383
|
const modelLabel = createMarkedElement(document, "label");
|
|
1370
1384
|
const modelLabelText = createMarkedElement(document, "span");
|
|
1371
|
-
const
|
|
1385
|
+
const modelPicker = createSelectPicker(document, options.onViewChange);
|
|
1386
|
+
const modelSelect = modelPicker.select;
|
|
1387
|
+
modelLabel.htmlFor = modelPicker.trigger.id;
|
|
1372
1388
|
const modelHint = createMarkedElement(document, "p");
|
|
1373
|
-
modelLabel.append(modelLabelText
|
|
1389
|
+
modelLabel.append(modelLabelText);
|
|
1390
|
+
modelField.append(modelLabel, modelPicker.root);
|
|
1374
1391
|
const controlStatus = createMarkedElement(document, "p");
|
|
1375
1392
|
controlStatus.className = "spotpatch-external-control-status";
|
|
1376
1393
|
controlStatus.setAttribute("role", "status");
|
|
@@ -1394,8 +1411,8 @@ function createExternalHandoffPanel(document, framework, locale, sessionId, subs
|
|
|
1394
1411
|
const managedResultDiff = createMarkedElement(document, "pre");
|
|
1395
1412
|
managedResult.append(managedResultTitle, managedResultSummary, managedResultDiff);
|
|
1396
1413
|
controlRoot.append(
|
|
1397
|
-
|
|
1398
|
-
|
|
1414
|
+
agentField,
|
|
1415
|
+
modelField,
|
|
1399
1416
|
modelHint,
|
|
1400
1417
|
controlStatus,
|
|
1401
1418
|
controlActions,
|
|
@@ -1458,10 +1475,11 @@ function createExternalHandoffPanel(document, framework, locale, sessionId, subs
|
|
|
1458
1475
|
}
|
|
1459
1476
|
};
|
|
1460
1477
|
const modelPending = () => control?.mode === "managed" && modelSelect.value !== "" && modelSelect.value !== control.requestedModel;
|
|
1478
|
+
const modelChangeBlocksSend = () => activeAdapter?.canDispatch === true && modelPending();
|
|
1461
1479
|
const controlPending = () => controlOperationBusy || control?.connectionState === "diagnosing" || control?.connectionState === "connecting" || control?.connectionState === "disconnecting";
|
|
1462
1480
|
const refreshActions = () => {
|
|
1463
1481
|
sendButton.textContent = retryable ? messages.retry : activeAdapter?.canDispatch === true ? messages.send : messages.inboxSend;
|
|
1464
|
-
sendButton.disabled = !visible || !brokerReady || !contextReady || operationBusy ||
|
|
1482
|
+
sendButton.disabled = !visible || !brokerReady || !contextReady || operationBusy || modelChangeBlocksSend() || !retryable && dispatchBlocksSend;
|
|
1465
1483
|
sendButton.setAttribute("aria-busy", String(operationBusy));
|
|
1466
1484
|
refreshButton.disabled = !visible || operationBusy;
|
|
1467
1485
|
resolveButton.hidden = !unknownDelivery;
|
|
@@ -1469,8 +1487,8 @@ function createExternalHandoffPanel(document, framework, locale, sessionId, subs
|
|
|
1469
1487
|
};
|
|
1470
1488
|
const refreshControlActions = () => {
|
|
1471
1489
|
connectButton.textContent = modelPending() ? messages.applyModel : messages.connectManaged;
|
|
1472
|
-
modelSelect.disabled = true;
|
|
1473
1490
|
if (control === void 0) {
|
|
1491
|
+
modelPicker.setDisabled(true);
|
|
1474
1492
|
connectButton.disabled = true;
|
|
1475
1493
|
disconnectButton.disabled = true;
|
|
1476
1494
|
revokeButton.disabled = true;
|
|
@@ -1479,7 +1497,9 @@ function createExternalHandoffPanel(document, framework, locale, sessionId, subs
|
|
|
1479
1497
|
}
|
|
1480
1498
|
const state = control.connectionState;
|
|
1481
1499
|
const operationPending = controlPending();
|
|
1482
|
-
|
|
1500
|
+
modelPicker.setDisabled(
|
|
1501
|
+
controlOperationBusy || state === "busy" || !control.models?.length
|
|
1502
|
+
);
|
|
1483
1503
|
connectButton.disabled = operationPending || state === "ready" && !modelPending() || state === "busy";
|
|
1484
1504
|
disconnectButton.disabled = operationPending || state === "disconnected";
|
|
1485
1505
|
revokeButton.disabled = operationPending || control.grantState !== "valid";
|
|
@@ -1536,7 +1556,7 @@ function createExternalHandoffPanel(document, framework, locale, sessionId, subs
|
|
|
1536
1556
|
if (modelSelect.options.length === 1 && modelSelect.options[0]?.value === "") {
|
|
1537
1557
|
modelSelect.options[0].textContent = messages.modelLoading;
|
|
1538
1558
|
}
|
|
1539
|
-
|
|
1559
|
+
agentValue.textContent = messages.codexManaged;
|
|
1540
1560
|
connectButton.textContent = messages.connectManaged;
|
|
1541
1561
|
disconnectButton.textContent = messages.disconnectManaged;
|
|
1542
1562
|
revokeButton.textContent = messages.revokeManaged;
|
|
@@ -1584,12 +1604,13 @@ function createExternalHandoffPanel(document, framework, locale, sessionId, subs
|
|
|
1584
1604
|
})
|
|
1585
1605
|
);
|
|
1586
1606
|
modelSelect.value = models.includes(previous) ? previous : control?.requestedModel ?? models[0] ?? "";
|
|
1607
|
+
modelPicker.rebuild();
|
|
1587
1608
|
};
|
|
1588
1609
|
renderModels();
|
|
1589
1610
|
const unsubscribeLocale = options.subscribeLocale(applyMessages);
|
|
1590
1611
|
applyMessages();
|
|
1591
1612
|
status.textContent = messages.ready;
|
|
1592
|
-
controlStatus.textContent = options.locale() === "zh-CN" ? "
|
|
1613
|
+
controlStatus.textContent = options.locale() === "zh-CN" ? "正在读取本地连接状态……" : "Reading local connection status…";
|
|
1593
1614
|
refreshActions();
|
|
1594
1615
|
refreshControlActions();
|
|
1595
1616
|
const summaryMessage = (summary) => summary.state === "expired" ? messages.expired(summary.revision) : summary.state === "superseded" ? messages.superseded(summary.revision) : summary.pickupCount > 0 ? messages.pickedUp(
|
|
@@ -1639,7 +1660,7 @@ function createExternalHandoffPanel(document, framework, locale, sessionId, subs
|
|
|
1639
1660
|
annotation.targets.length,
|
|
1640
1661
|
paths.length
|
|
1641
1662
|
);
|
|
1642
|
-
disclosureFiles.textContent = paths.length === 0 ? "
|
|
1663
|
+
disclosureFiles.textContent = paths.length === 0 ? "—" : paths.join("\n");
|
|
1643
1664
|
disclosure.hidden = false;
|
|
1644
1665
|
const rootNode = root.getRootNode();
|
|
1645
1666
|
const activeElement = "activeElement" in rootNode ? rootNode.activeElement : document.activeElement;
|
|
@@ -1749,6 +1770,7 @@ function createExternalHandoffPanel(document, framework, locale, sessionId, subs
|
|
|
1749
1770
|
settings.removeEventListener("toggle", options.onViewChange);
|
|
1750
1771
|
managedResult.removeEventListener("toggle", options.onViewChange);
|
|
1751
1772
|
modelSelect.removeEventListener("change", handleModelChange);
|
|
1773
|
+
modelPicker.dispose();
|
|
1752
1774
|
unsubscribeLocale();
|
|
1753
1775
|
}
|
|
1754
1776
|
});
|