@spotpatch/runtime 1.15.1 → 1.15.3
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/{chunk-ASRUAKA5.js → chunk-TEH2CCO3.js} +1 -1
- package/dist/chunk-TEH2CCO3.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 +355 -106
- package/dist/external-handoff-panel.cjs.map +1 -1
- package/dist/external-handoff-panel.d.cts +1 -0
- package/dist/external-handoff-panel.d.ts +1 -0
- package/dist/external-handoff-panel.js +187 -107
- 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 +285 -285
- 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
- package/dist/chunk-ASRUAKA5.js.map +0 -1
|
@@ -4,6 +4,7 @@ import { SpotPatchRuntimeConfig } from '@spotpatch/shared';
|
|
|
4
4
|
interface ExternalHandoffPanel {
|
|
5
5
|
readonly cancelManagedButton: HTMLButtonElement;
|
|
6
6
|
readonly connectButton: HTMLButtonElement;
|
|
7
|
+
readonly readModel: () => string | undefined;
|
|
7
8
|
readonly disconnectButton: HTMLButtonElement;
|
|
8
9
|
readonly refreshButton: HTMLButtonElement;
|
|
9
10
|
readonly root: HTMLElement;
|
|
@@ -4,6 +4,7 @@ import { SpotPatchRuntimeConfig } from '@spotpatch/shared';
|
|
|
4
4
|
interface ExternalHandoffPanel {
|
|
5
5
|
readonly cancelManagedButton: HTMLButtonElement;
|
|
6
6
|
readonly connectButton: HTMLButtonElement;
|
|
7
|
+
readonly readModel: () => string | undefined;
|
|
7
8
|
readonly disconnectButton: HTMLButtonElement;
|
|
8
9
|
readonly refreshButton: HTMLButtonElement;
|
|
9
10
|
readonly root: HTMLElement;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getExternalHandoffExtension,
|
|
3
3
|
registerExternalHandoffExtension
|
|
4
|
-
} from "./chunk-
|
|
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
|
|
@@ -203,6 +207,9 @@ function parseTask(value) {
|
|
|
203
207
|
...value.resultExpiresAt === void 0 ? {} : { resultExpiresAt: value.resultExpiresAt }
|
|
204
208
|
});
|
|
205
209
|
}
|
|
210
|
+
function validModel(value) {
|
|
211
|
+
return typeof value === "string" && value.length > 0 && value.length <= EXTERNAL_AGENT_CONTROL_LIMITS.maximumModelCharacters && value.trim() === value;
|
|
212
|
+
}
|
|
206
213
|
function parseExternalAgentControlStatus(value) {
|
|
207
214
|
if (!record(value) || !optionalKeys(
|
|
208
215
|
value,
|
|
@@ -216,8 +223,8 @@ function parseExternalAgentControlStatus(value) {
|
|
|
216
223
|
"sequence",
|
|
217
224
|
"updatedAt"
|
|
218
225
|
],
|
|
219
|
-
["effectiveModel", "error", "requestedModel", "task"]
|
|
220
|
-
) || value.schemaVersion !== 1 || !integer(value.sequence) || !member(MODES, value.mode) || !member(CONNECTION_STATES, value.connectionState) || !member(AUTH_STATES, value.authReadiness) || !member(GRANT_STATES, value.grantState) || !validTimestamp(value.updatedAt) || value.requestedModel !== void 0 && (
|
|
226
|
+
["effectiveModel", "error", "requestedModel", "task", "models"]
|
|
227
|
+
) || value.schemaVersion !== 1 || !integer(value.sequence) || !member(MODES, value.mode) || !member(CONNECTION_STATES, value.connectionState) || !member(AUTH_STATES, value.authReadiness) || !member(GRANT_STATES, value.grantState) || !validTimestamp(value.updatedAt) || value.requestedModel !== void 0 && !validModel(value.requestedModel) || value.effectiveModel !== void 0 && !validModel(value.effectiveModel) || value.models !== void 0 && (!Array.isArray(value.models) || value.models.length === 0 || value.models.length > EXTERNAL_AGENT_CONTROL_LIMITS.maximumModels || !value.models.every(validModel) || new Set(value.models).size !== value.models.length) || !record(value.adapter) || !exactKeys(value.adapter, ["availability", "kind", "maturity"]) || value.adapter.kind !== "codex" || value.adapter.maturity !== "experimental" || value.adapter.availability !== "available" && value.adapter.availability !== "unavailable") {
|
|
221
228
|
throw new TypeError("Invalid external Agent control status.");
|
|
222
229
|
}
|
|
223
230
|
let error;
|
|
@@ -244,6 +251,7 @@ function parseExternalAgentControlStatus(value) {
|
|
|
244
251
|
connectionState: value.connectionState,
|
|
245
252
|
authReadiness: value.authReadiness,
|
|
246
253
|
grantState: value.grantState,
|
|
254
|
+
...value.models === void 0 ? {} : { models: Object.freeze([...value.models]) },
|
|
247
255
|
...value.requestedModel === void 0 ? {} : { requestedModel: value.requestedModel },
|
|
248
256
|
...value.effectiveModel === void 0 ? {} : { effectiveModel: value.effectiveModel },
|
|
249
257
|
...value.task === void 0 ? {} : { task: parseTask(value.task) },
|
|
@@ -742,11 +750,13 @@ function createExternalHandoffWorkflow(fetch, panel, selectedAnnotation, session
|
|
|
742
750
|
}
|
|
743
751
|
};
|
|
744
752
|
const handleConnectClick = () => {
|
|
753
|
+
const model = options.panel.readModel();
|
|
745
754
|
void performControlAction(
|
|
746
755
|
() => controlClient.connect({
|
|
747
756
|
requestId: createRequestId(options.window),
|
|
748
757
|
adapterKind: "codex",
|
|
749
|
-
profile: EXTERNAL_AGENT_MANAGED_PROFILE
|
|
758
|
+
profile: EXTERNAL_AGENT_MANAGED_PROFILE,
|
|
759
|
+
...model === void 0 ? {} : { model }
|
|
750
760
|
})
|
|
751
761
|
);
|
|
752
762
|
};
|
|
@@ -1005,19 +1015,23 @@ var MESSAGES = Object.freeze({
|
|
|
1005
1015
|
"en-US": Object.freeze({
|
|
1006
1016
|
title: "External Agent connection",
|
|
1007
1017
|
agentLabel: "Agent",
|
|
1008
|
-
|
|
1018
|
+
modelLabel: "Managed Codex model",
|
|
1019
|
+
modelLoading: "Connect to load available models",
|
|
1020
|
+
modelHint: "Applies only to this managed connection, not API Key settings. Apply changes before publishing; switching reconnects Codex.",
|
|
1021
|
+
applyModel: "Apply model",
|
|
1022
|
+
codexManaged: "Codex · managed (experimental)",
|
|
1009
1023
|
connectManaged: "Connect Codex",
|
|
1010
1024
|
disconnectManaged: "Disconnect",
|
|
1011
1025
|
revokeManaged: "Revoke grant",
|
|
1012
1026
|
cancelManaged: "Cancel managed task",
|
|
1013
1027
|
resultTitle: "Managed result",
|
|
1014
|
-
controlConnection: (state, mode) => `Connection: ${state}
|
|
1015
|
-
controlAuth: (auth, grant) => `Auth: ${auth}
|
|
1028
|
+
controlConnection: (state, mode) => `Connection: ${state} · Mode: ${mode}`,
|
|
1029
|
+
controlAuth: (auth, grant) => `Auth: ${auth} · Grant: ${grant}`,
|
|
1016
1030
|
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.`,
|
|
1017
1031
|
controlModel: (model) => `Model: ${model}`,
|
|
1018
1032
|
controlRevision: (task) => `Revision ${String(task.revision)}: ${task.deliveryStatus} / ${task.executionStatus} / ${task.managedPhase}`,
|
|
1019
1033
|
controlValidation: (outcome) => `Validation: ${outcome}`,
|
|
1020
|
-
controlFailure: (error, action) => `Error: ${error}
|
|
1034
|
+
controlFailure: (error, action) => `Error: ${error} · Next: ${action}`,
|
|
1021
1035
|
controlUnavailable: "Page connection management is unavailable; external handoffs still fall back honestly to the Agent inbox.",
|
|
1022
1036
|
controlErrorText: Object.freeze({
|
|
1023
1037
|
AGENT_BINARY_NOT_FOUND: "Codex is not installed or is not on PATH.",
|
|
@@ -1043,7 +1057,7 @@ var MESSAGES = Object.freeze({
|
|
|
1043
1057
|
"install-agent": "Install Codex and retry.",
|
|
1044
1058
|
"use-supported-version": "Use a schema-compatible Codex version.",
|
|
1045
1059
|
"sign-in": "Sign in with Codex, then retry.",
|
|
1046
|
-
"choose-available-model": "Choose an available model
|
|
1060
|
+
"choose-available-model": "Choose an available model and reconnect Codex.",
|
|
1047
1061
|
"use-inbox": "Continue with the Agent inbox fallback.",
|
|
1048
1062
|
"confirm-managed-access": "Revoke the invalid grant and confirm access again.",
|
|
1049
1063
|
"review-candidate-diff": "Review the candidate diff and validation output.",
|
|
@@ -1051,17 +1065,17 @@ var MESSAGES = Object.freeze({
|
|
|
1051
1065
|
retry: "Retry the managed connection.",
|
|
1052
1066
|
"inspect-cleanup-warning": "Inspect cleanup status before reconnecting."
|
|
1053
1067
|
}),
|
|
1054
|
-
resultHeader: (revision, outcome) => `Revision ${String(revision)}
|
|
1068
|
+
resultHeader: (revision, outcome) => `Revision ${String(revision)} · Validation ${outcome}`,
|
|
1055
1069
|
resultDisposition: (outcome) => outcome === "passed" ? "Applied to the project after validation passed." : `Candidate only; it was not applied because validation is ${outcome}.`,
|
|
1056
1070
|
resultTiming: (stage, durationMs) => `Timing ${stage}: ${String(durationMs)} ms`,
|
|
1057
1071
|
description: "Send through a ready active adapter, or publish to the project Agent inbox when no active adapter is connected.",
|
|
1058
1072
|
ready: "Local Broker ready. No Agent connection is assumed until a connector reads or waits.",
|
|
1059
1073
|
readyWaiting: (count) => `${String(count)} active connector wait request(s); publishing can wake them immediately.`,
|
|
1060
1074
|
activeReady: (agent) => `${agent} is connected and idle. The next send will dispatch immediately.`,
|
|
1061
|
-
publishing: "Authorizing current source and publishing the handoff
|
|
1075
|
+
publishing: "Authorizing current source and publishing the handoff…",
|
|
1062
1076
|
published: (revision, expiresAt) => `Revision ${String(revision)} is available until ${expiresAt}. It has not been claimed as edited.`,
|
|
1063
1077
|
queued: (agent, revision) => `Revision ${String(revision)} is reserved for ${agent}.`,
|
|
1064
|
-
dispatching: (agent, revision) => `Dispatching revision ${String(revision)} to ${agent}
|
|
1078
|
+
dispatching: (agent, revision) => `Dispatching revision ${String(revision)} to ${agent}…`,
|
|
1065
1079
|
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.`,
|
|
1066
1080
|
working: (agent, revision) => `${agent} is working on revision ${String(revision)}.`,
|
|
1067
1081
|
completed: (agent, revision) => `${agent} ended revision ${String(revision)} normally. Review the diff and checks; this does not prove the requested change is correct.`,
|
|
@@ -1075,7 +1089,7 @@ var MESSAGES = Object.freeze({
|
|
|
1075
1089
|
inboxSend: "Publish to Agent inbox",
|
|
1076
1090
|
retry: "Retry same send",
|
|
1077
1091
|
refresh: "Refresh pickup status",
|
|
1078
|
-
resolveUnknown: "Workspace reviewed
|
|
1092
|
+
resolveUnknown: "Workspace reviewed — allow a new task",
|
|
1079
1093
|
settingsTitle: "Project connection setup",
|
|
1080
1094
|
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.",
|
|
1081
1095
|
disclosureTitle: "Confirm external Agent handoff",
|
|
@@ -1090,96 +1104,101 @@ var MESSAGES = Object.freeze({
|
|
|
1090
1104
|
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."
|
|
1091
1105
|
}),
|
|
1092
1106
|
"zh-CN": Object.freeze({
|
|
1093
|
-
title: "
|
|
1107
|
+
title: "外部 Agent 连接",
|
|
1094
1108
|
agentLabel: "Agent",
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
+
modelLabel: "受管 Codex 模型",
|
|
1110
|
+
modelLoading: "连接后加载可用模型",
|
|
1111
|
+
modelHint: "仅作用于此受管连接,不修改 API Key 配置。更换后请先应用模型,再发布任务;应用时会重新连接 Codex。",
|
|
1112
|
+
applyModel: "应用模型",
|
|
1113
|
+
codexManaged: "Codex · 受管模式(实验性)",
|
|
1114
|
+
connectManaged: "连接 Codex",
|
|
1115
|
+
disconnectManaged: "断开连接",
|
|
1116
|
+
revokeManaged: "撤销授权",
|
|
1117
|
+
cancelManaged: "取消受管任务",
|
|
1118
|
+
resultTitle: "受管执行结果",
|
|
1119
|
+
controlConnection: (state, mode) => `连接:${state} · 模式:${mode}`,
|
|
1120
|
+
controlAuth: (auth, grant) => `认证:${auth} · 授权:${grant}`,
|
|
1121
|
+
controlConsentRequired: (command) => `请在当前项目执行一次初始化:\`${command}\`,然后重新连接,无需在开发终端输入 yes。授权允许隔离快照修改及校验后的应用,可随时在此撤销。`,
|
|
1122
|
+
controlModel: (model) => `模型:${model}`,
|
|
1123
|
+
controlRevision: (task) => `revision ${String(task.revision)}:${task.deliveryStatus} / ${task.executionStatus} / ${task.managedPhase}`,
|
|
1124
|
+
controlValidation: (outcome) => `验证:${outcome}`,
|
|
1125
|
+
controlFailure: (error, action) => `错误:${error} · 下一步:${action}`,
|
|
1126
|
+
controlUnavailable: "页面连接管理不可用;外部交接仍会按真实能力降级为 Agent 收件箱。",
|
|
1109
1127
|
controlErrorText: Object.freeze({
|
|
1110
|
-
AGENT_BINARY_NOT_FOUND: "
|
|
1111
|
-
AGENT_BINARY_UNTRUSTED: "
|
|
1112
|
-
AGENT_VERSION_UNSUPPORTED: "
|
|
1113
|
-
APP_SERVER_HANDSHAKE_FAILED: "Codex App Server
|
|
1114
|
-
AGENT_AUTH_REQUIRED: "Codex
|
|
1115
|
-
AGENT_MODEL_UNAVAILABLE: "Codex
|
|
1116
|
-
AGENT_PROTOCOL_INCOMPATIBLE: "Codex
|
|
1117
|
-
CODEX_CONFIG_ISOLATION_UNSUPPORTED: "
|
|
1118
|
-
MANAGED_GRANT_INVALID: "
|
|
1119
|
-
MANAGED_PLATFORM_UNSUPPORTED: "
|
|
1120
|
-
MANAGED_GIT_REQUIRED: "
|
|
1121
|
-
MANAGED_SNAPSHOT_FAILED: "
|
|
1122
|
-
MANAGED_SCOPE_VIOLATION: "
|
|
1123
|
-
MANAGED_CHANGE_LIMIT_EXCEEDED: "
|
|
1124
|
-
MANAGED_VALIDATION_FAILED: "
|
|
1125
|
-
MANAGED_WORKSPACE_CONFLICT: "
|
|
1126
|
-
MANAGED_APPLY_FAILED: "
|
|
1127
|
-
MANAGED_CLEANUP_INCOMPLETE: "
|
|
1128
|
+
AGENT_BINARY_NOT_FOUND: "未安装 Codex,或 Codex 不在 PATH 中。",
|
|
1129
|
+
AGENT_BINARY_UNTRUSTED: "解析到的 Codex 可执行文件不可信。",
|
|
1130
|
+
AGENT_VERSION_UNSUPPORTED: "已安装的 Codex 版本低于 SpotPatch 兼容基线。",
|
|
1131
|
+
APP_SERVER_HANDSHAKE_FAILED: "Codex App Server 未完成启动握手。",
|
|
1132
|
+
AGENT_AUTH_REQUIRED: "Codex 需要已登录的账户。",
|
|
1133
|
+
AGENT_MODEL_UNAVAILABLE: "Codex 配置的模型当前不可用。",
|
|
1134
|
+
AGENT_PROTOCOL_INCOMPATIBLE: "Codex 生成的 App Server Schema 不满足 SpotPatch 所需协议子集。",
|
|
1135
|
+
CODEX_CONFIG_ISOLATION_UNSUPPORTED: "当前 Codex 版本无法证明受管配置隔离。",
|
|
1136
|
+
MANAGED_GRANT_INVALID: "保存的项目授权未通过校验。",
|
|
1137
|
+
MANAGED_PLATFORM_UNSUPPORTED: "当前平台尚未证明可安全运行受管执行。",
|
|
1138
|
+
MANAGED_GIT_REQUIRED: "受管执行要求项目位于 Git 仓库中。",
|
|
1139
|
+
MANAGED_SNAPSHOT_FAILED: "无法创建独立工作区快照。",
|
|
1140
|
+
MANAGED_SCOPE_VIOLATION: "候选修改超出授权路径。",
|
|
1141
|
+
MANAGED_CHANGE_LIMIT_EXCEEDED: "候选修改超过安全上限。",
|
|
1142
|
+
MANAGED_VALIDATION_FAILED: "候选修改未通过审计或验证。",
|
|
1143
|
+
MANAGED_WORKSPACE_CONFLICT: "执行期间授权源码发生了变化。",
|
|
1144
|
+
MANAGED_APPLY_FAILED: "已审计修改无法安全写入。",
|
|
1145
|
+
MANAGED_CLEANUP_INCOMPLETE: "受管 thread 或工作区清理不完整。"
|
|
1128
1146
|
}),
|
|
1129
1147
|
controlActionText: Object.freeze({
|
|
1130
|
-
"install-agent": "
|
|
1131
|
-
"use-supported-version": "
|
|
1132
|
-
"sign-in": "
|
|
1133
|
-
"choose-available-model": "
|
|
1134
|
-
"use-inbox": "
|
|
1135
|
-
"confirm-managed-access": "
|
|
1136
|
-
"review-candidate-diff": "
|
|
1137
|
-
"review-workspace-conflict": "
|
|
1138
|
-
retry: "
|
|
1139
|
-
"inspect-cleanup-warning": "
|
|
1148
|
+
"install-agent": "安装 Codex 后重试。",
|
|
1149
|
+
"use-supported-version": "改用 Schema 兼容的 Codex 版本。",
|
|
1150
|
+
"sign-in": "登录 Codex 后重试。",
|
|
1151
|
+
"choose-available-model": "选择可用模型后重新连接 Codex。",
|
|
1152
|
+
"use-inbox": "继续使用 Agent 收件箱降级路径。",
|
|
1153
|
+
"confirm-managed-access": "撤销无效授权并重新确认。",
|
|
1154
|
+
"review-candidate-diff": "检查候选 diff 和验证输出。",
|
|
1155
|
+
"review-workspace-conflict": "检查工作区变化后再重试。",
|
|
1156
|
+
retry: "重试受管连接。",
|
|
1157
|
+
"inspect-cleanup-warning": "确认清理状态后再连接。"
|
|
1140
1158
|
}),
|
|
1141
|
-
resultHeader: (revision, outcome) => `revision ${String(revision)}
|
|
1142
|
-
resultDisposition: (outcome) => outcome === "passed" ? "
|
|
1143
|
-
resultTiming: (stage, durationMs) =>
|
|
1144
|
-
description: "
|
|
1145
|
-
ready: "
|
|
1146
|
-
readyWaiting: (count) =>
|
|
1147
|
-
activeReady: (agent) => `${agent}
|
|
1148
|
-
publishing: "
|
|
1149
|
-
published: (revision, expiresAt) =>
|
|
1150
|
-
queued: (agent, revision) =>
|
|
1151
|
-
dispatching: (agent, revision) =>
|
|
1152
|
-
dispatched: (agent, revision) => agent === "Claude Code" ? `revision ${String(revision)}
|
|
1153
|
-
working: (agent, revision) => `${agent}
|
|
1154
|
-
completed: (agent, revision) => `${agent}
|
|
1155
|
-
failed: (agent, revision) => `${agent}
|
|
1156
|
-
unknown: (agent, revision) => `revision ${String(revision)}
|
|
1157
|
-
unknownResolved: (agent, revision) => `${agent}
|
|
1158
|
-
pickedUp: (revision, count, time) =>
|
|
1159
|
-
expired: (revision) =>
|
|
1160
|
-
superseded: (revision) =>
|
|
1161
|
-
send: "
|
|
1162
|
-
inboxSend: "
|
|
1163
|
-
retry: "
|
|
1164
|
-
refresh: "
|
|
1165
|
-
resolveUnknown: "
|
|
1166
|
-
settingsTitle: "
|
|
1167
|
-
settingsHelp: "Codex
|
|
1168
|
-
disclosureTitle: "
|
|
1169
|
-
disclosureIntro: (targets, files) =>
|
|
1170
|
-
disclosureData: "
|
|
1171
|
-
disclosureInbox: "15
|
|
1172
|
-
disclosureProvider: "Agent
|
|
1173
|
-
disclosureNoGuarantee: "
|
|
1174
|
-
disclosureManagedGuarantee: "
|
|
1175
|
-
cancel: "
|
|
1176
|
-
confirm: "
|
|
1177
|
-
error: (code) => code === "EXTERNAL_AGENT_BUSY" ? "
|
|
1159
|
+
resultHeader: (revision, outcome) => `revision ${String(revision)} · 验证 ${outcome}`,
|
|
1160
|
+
resultDisposition: (outcome) => outcome === "passed" ? "验证通过,修改已写入项目。" : `这只是候选 diff;验证状态为 ${outcome},因此没有写入项目。`,
|
|
1161
|
+
resultTiming: (stage, durationMs) => `耗时 ${stage}: ${String(durationMs)} ms`,
|
|
1162
|
+
description: "有主动适配器就立即派发;未连接主动适配器时,诚实降级为项目 Agent 收件箱。",
|
|
1163
|
+
ready: "本地 Broker 已就绪。只有连接器读取或等待后,才能证明发生过连接。",
|
|
1164
|
+
readyWaiting: (count) => `当前有 ${String(count)} 个连接器等待请求,发布后可立即唤醒。`,
|
|
1165
|
+
activeReady: (agent) => `${agent} 已连接并处于空闲状态,下次发送会立即派发。`,
|
|
1166
|
+
publishing: "正在重新授权当前源码并发布交接……",
|
|
1167
|
+
published: (revision, expiresAt) => `交接 revision ${String(revision)} 可读取至 ${expiresAt};这不表示代码已被修改。`,
|
|
1168
|
+
queued: (agent, revision) => `交接 revision ${String(revision)} 已为 ${agent} 预留。`,
|
|
1169
|
+
dispatching: (agent, revision) => `正在把 revision ${String(revision)} 派发给 ${agent}……`,
|
|
1170
|
+
dispatched: (agent, revision) => agent === "Claude Code" ? `revision ${String(revision)} 已写入 Claude Channel transport;当前没有模型 ACK。` : `Codex App Server 已接受 revision ${String(revision)},正在等待匹配 turn 启动。`,
|
|
1171
|
+
working: (agent, revision) => `${agent} 正在处理 revision ${String(revision)}。`,
|
|
1172
|
+
completed: (agent, revision) => `${agent} 已正常结束 revision ${String(revision)}。请核对 diff 和检查结果;这不证明修改要求已经正确完成。`,
|
|
1173
|
+
failed: (agent, revision) => `${agent} 已将 revision ${String(revision)} 报告为失败,连接器已恢复空闲。`,
|
|
1174
|
+
unknown: (agent, revision) => `revision ${String(revision)} 向 ${agent} 的投递结果不确定。受管 writer 已停止,请先核对工作区再允许新任务。`,
|
|
1175
|
+
unknownResolved: (agent, revision) => `${agent} 的 revision ${String(revision)} 仍记为投递未知,但工作区核对已经确认;现在可以重新连接或发布新的收件箱任务。`,
|
|
1176
|
+
pickedUp: (revision, count, time) => `交接 revision ${String(revision)} 已被 ${String(count)} 个连接器实例取走${time === void 0 ? "。" : `,最近取件于 ${time}。`}这不能证明代码已经修改。`,
|
|
1177
|
+
expired: (revision) => `交接 revision ${String(revision)} 已过期,请核对当前选择后重新发布。`,
|
|
1178
|
+
superseded: (revision) => `交接 revision ${String(revision)} 已被更新版本取代。`,
|
|
1179
|
+
send: "发送给 Agent",
|
|
1180
|
+
inboxSend: "发布到 Agent 收件箱",
|
|
1181
|
+
retry: "重试同一次发送",
|
|
1182
|
+
refresh: "刷新取件状态",
|
|
1183
|
+
resolveUnknown: "已核对工作区,允许新任务",
|
|
1184
|
+
settingsTitle: "项目连接设置",
|
|
1185
|
+
settingsHelp: "Codex 受管模式由当前开发服务托管,浏览器不会获得厂商凭证或任意命令权限;通用与 attached adapter 仍按真实能力降级为收件箱。",
|
|
1186
|
+
disclosureTitle: "确认发布到外部 Agent",
|
|
1187
|
+
disclosureIntro: (targets, files) => `将发布 ${String(targets)} 个目标,涉及 ${String(files)} 个项目相对文件。`,
|
|
1188
|
+
disclosureData: "交接包含修改说明、组件与页面上下文、已清洗的 DOM/CSS,以及本地 Node 服务重新读取的有界源码。",
|
|
1189
|
+
disclosureInbox: "15 分钟有效期内,本项目中任何已配置的 SpotPatch Connector 都可能读取。",
|
|
1190
|
+
disclosureProvider: "Agent 宿主可能依据其产品数据策略,将内容发送给云端模型服务。",
|
|
1191
|
+
disclosureNoGuarantee: "外部修改不具备 SpotPatch 内建 Agent 的 worktree、Apply 或 Revert 保证。",
|
|
1192
|
+
disclosureManagedGuarantee: "受管 Codex 只写独立临时快照。SpotPatch 会审计 diff,且仅在所有可信 required checks 通过后才写入业务仓库。",
|
|
1193
|
+
cancel: "取消",
|
|
1194
|
+
confirm: "确认并发送",
|
|
1195
|
+
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。"
|
|
1178
1196
|
})
|
|
1179
1197
|
});
|
|
1180
1198
|
function createStyles(document) {
|
|
1181
1199
|
const styles = document.createElement("style");
|
|
1182
1200
|
styles.textContent = `
|
|
1201
|
+
${SELECT_PICKER_STYLES}
|
|
1183
1202
|
.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%); }
|
|
1184
1203
|
.spotpatch-external-handoff[hidden] { display: none; }
|
|
1185
1204
|
.spotpatch-external-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
|
|
@@ -1189,8 +1208,10 @@ function createStyles(document) {
|
|
|
1189
1208
|
.spotpatch-external-status[data-state="error"] { border-color: var(--spotpatch-danger); color: #fecdd3; }
|
|
1190
1209
|
.spotpatch-external-status[data-state="picked-up"] { border-color: var(--spotpatch-success); color: #a7f3d0; }
|
|
1191
1210
|
.spotpatch-external-control { margin-top: 9px; padding: 9px; border: 1px solid var(--spotpatch-border); border-radius: 8px; background: rgb(3 7 18 / 28%); }
|
|
1192
|
-
.spotpatch-external-control
|
|
1193
|
-
.spotpatch-external-control
|
|
1211
|
+
.spotpatch-external-control-field { display: grid; gap: 5px; min-width: 0; }
|
|
1212
|
+
.spotpatch-external-control-field + .spotpatch-external-control-field { margin-top: 9px; }
|
|
1213
|
+
.spotpatch-external-control-field > label { color: var(--spotpatch-text-secondary); font-size: 10px; }
|
|
1214
|
+
.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; }
|
|
1194
1215
|
.spotpatch-external-control-status { margin: 7px 0 0; color: #cbd5e1; font-size: 10.5px; line-height: 1.5; white-space: pre-wrap; }
|
|
1195
1216
|
.spotpatch-external-control-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
|
|
1196
1217
|
.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; }
|
|
@@ -1345,13 +1366,24 @@ function createExternalHandoffPanel(document, framework, locale, sessionId, subs
|
|
|
1345
1366
|
status.setAttribute("aria-live", "polite");
|
|
1346
1367
|
const controlRoot = createMarkedElement(document, "div");
|
|
1347
1368
|
controlRoot.className = "spotpatch-external-control";
|
|
1369
|
+
const agentField = createMarkedElement(document, "div");
|
|
1370
|
+
agentField.className = "spotpatch-external-control-field";
|
|
1348
1371
|
const agentLabel = createMarkedElement(document, "label");
|
|
1349
1372
|
const agentLabelText = createMarkedElement(document, "span");
|
|
1350
|
-
const
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1373
|
+
const agentValue = createMarkedElement(document, "div");
|
|
1374
|
+
agentValue.className = "spotpatch-external-agent-value";
|
|
1375
|
+
agentLabel.append(agentLabelText);
|
|
1376
|
+
agentField.append(agentLabel, agentValue);
|
|
1377
|
+
const modelField = createMarkedElement(document, "div");
|
|
1378
|
+
modelField.className = "spotpatch-external-control-field";
|
|
1379
|
+
const modelLabel = createMarkedElement(document, "label");
|
|
1380
|
+
const modelLabelText = createMarkedElement(document, "span");
|
|
1381
|
+
const modelPicker = createSelectPicker(document, options.onViewChange);
|
|
1382
|
+
const modelSelect = modelPicker.select;
|
|
1383
|
+
modelLabel.htmlFor = modelPicker.trigger.id;
|
|
1384
|
+
const modelHint = createMarkedElement(document, "p");
|
|
1385
|
+
modelLabel.append(modelLabelText);
|
|
1386
|
+
modelField.append(modelLabel, modelPicker.root);
|
|
1355
1387
|
const controlStatus = createMarkedElement(document, "p");
|
|
1356
1388
|
controlStatus.className = "spotpatch-external-control-status";
|
|
1357
1389
|
controlStatus.setAttribute("role", "status");
|
|
@@ -1374,7 +1406,14 @@ function createExternalHandoffPanel(document, framework, locale, sessionId, subs
|
|
|
1374
1406
|
const managedResultSummary = createMarkedElement(document, "p");
|
|
1375
1407
|
const managedResultDiff = createMarkedElement(document, "pre");
|
|
1376
1408
|
managedResult.append(managedResultTitle, managedResultSummary, managedResultDiff);
|
|
1377
|
-
controlRoot.append(
|
|
1409
|
+
controlRoot.append(
|
|
1410
|
+
agentField,
|
|
1411
|
+
modelField,
|
|
1412
|
+
modelHint,
|
|
1413
|
+
controlStatus,
|
|
1414
|
+
controlActions,
|
|
1415
|
+
managedResult
|
|
1416
|
+
);
|
|
1378
1417
|
const resolveButton = createButton(document, "", "spotpatch-external-resolve");
|
|
1379
1418
|
resolveButton.hidden = true;
|
|
1380
1419
|
const settings = createMarkedElement(document, "details");
|
|
@@ -1431,16 +1470,21 @@ function createExternalHandoffPanel(document, framework, locale, sessionId, subs
|
|
|
1431
1470
|
} catch {
|
|
1432
1471
|
}
|
|
1433
1472
|
};
|
|
1473
|
+
const modelPending = () => control?.mode === "managed" && modelSelect.value !== "" && modelSelect.value !== control.requestedModel;
|
|
1474
|
+
const modelChangeBlocksSend = () => activeAdapter?.canDispatch === true && modelPending();
|
|
1475
|
+
const controlPending = () => controlOperationBusy || control?.connectionState === "diagnosing" || control?.connectionState === "connecting" || control?.connectionState === "disconnecting";
|
|
1434
1476
|
const refreshActions = () => {
|
|
1435
1477
|
sendButton.textContent = retryable ? messages.retry : activeAdapter?.canDispatch === true ? messages.send : messages.inboxSend;
|
|
1436
|
-
sendButton.disabled = !visible || !brokerReady || !contextReady || operationBusy || !retryable && dispatchBlocksSend;
|
|
1478
|
+
sendButton.disabled = !visible || !brokerReady || !contextReady || operationBusy || modelChangeBlocksSend() || !retryable && dispatchBlocksSend;
|
|
1437
1479
|
sendButton.setAttribute("aria-busy", String(operationBusy));
|
|
1438
1480
|
refreshButton.disabled = !visible || operationBusy;
|
|
1439
1481
|
resolveButton.hidden = !unknownDelivery;
|
|
1440
1482
|
resolveButton.disabled = !visible || operationBusy || !unknownDelivery;
|
|
1441
1483
|
};
|
|
1442
1484
|
const refreshControlActions = () => {
|
|
1485
|
+
connectButton.textContent = modelPending() ? messages.applyModel : messages.connectManaged;
|
|
1443
1486
|
if (control === void 0) {
|
|
1487
|
+
modelPicker.setDisabled(true);
|
|
1444
1488
|
connectButton.disabled = true;
|
|
1445
1489
|
disconnectButton.disabled = true;
|
|
1446
1490
|
revokeButton.disabled = true;
|
|
@@ -1448,8 +1492,11 @@ function createExternalHandoffPanel(document, framework, locale, sessionId, subs
|
|
|
1448
1492
|
return;
|
|
1449
1493
|
}
|
|
1450
1494
|
const state = control.connectionState;
|
|
1451
|
-
const operationPending =
|
|
1452
|
-
|
|
1495
|
+
const operationPending = controlPending();
|
|
1496
|
+
modelPicker.setDisabled(
|
|
1497
|
+
controlOperationBusy || state === "busy" || !control.models?.length
|
|
1498
|
+
);
|
|
1499
|
+
connectButton.disabled = operationPending || state === "ready" && !modelPending() || state === "busy";
|
|
1453
1500
|
disconnectButton.disabled = operationPending || state === "disconnected";
|
|
1454
1501
|
revokeButton.disabled = operationPending || control.grantState !== "valid";
|
|
1455
1502
|
const phase = control.task?.managedPhase;
|
|
@@ -1500,7 +1547,12 @@ function createExternalHandoffPanel(document, framework, locale, sessionId, subs
|
|
|
1500
1547
|
disclosureProvider.textContent = messages.disclosureProvider;
|
|
1501
1548
|
disclosureNoGuarantee.textContent = messages.disclosureNoGuarantee;
|
|
1502
1549
|
agentLabelText.textContent = messages.agentLabel;
|
|
1503
|
-
|
|
1550
|
+
modelLabelText.textContent = messages.modelLabel;
|
|
1551
|
+
modelHint.textContent = messages.modelHint;
|
|
1552
|
+
if (modelSelect.options.length === 1 && modelSelect.options[0]?.value === "") {
|
|
1553
|
+
modelSelect.options[0].textContent = messages.modelLoading;
|
|
1554
|
+
}
|
|
1555
|
+
agentValue.textContent = messages.codexManaged;
|
|
1504
1556
|
connectButton.textContent = messages.connectManaged;
|
|
1505
1557
|
disconnectButton.textContent = messages.disconnectManaged;
|
|
1506
1558
|
revokeButton.textContent = messages.revokeManaged;
|
|
@@ -1531,10 +1583,30 @@ function createExternalHandoffPanel(document, framework, locale, sessionId, subs
|
|
|
1531
1583
|
disclosure.addEventListener("keydown", handleDisclosureKeydown);
|
|
1532
1584
|
settings.addEventListener("toggle", options.onViewChange);
|
|
1533
1585
|
managedResult.addEventListener("toggle", options.onViewChange);
|
|
1586
|
+
const handleModelChange = () => {
|
|
1587
|
+
refreshControlActions();
|
|
1588
|
+
refreshActions();
|
|
1589
|
+
};
|
|
1590
|
+
modelSelect.addEventListener("change", handleModelChange);
|
|
1591
|
+
const renderModels = () => {
|
|
1592
|
+
const previous = modelSelect.value;
|
|
1593
|
+
const models = control?.models ?? [];
|
|
1594
|
+
modelSelect.replaceChildren(
|
|
1595
|
+
...(models.length ? models : [""]).map((model) => {
|
|
1596
|
+
const option = createMarkedElement(document, "option");
|
|
1597
|
+
option.value = model;
|
|
1598
|
+
option.textContent = model || messages.modelLoading;
|
|
1599
|
+
return option;
|
|
1600
|
+
})
|
|
1601
|
+
);
|
|
1602
|
+
modelSelect.value = models.includes(previous) ? previous : control?.requestedModel ?? models[0] ?? "";
|
|
1603
|
+
modelPicker.rebuild();
|
|
1604
|
+
};
|
|
1605
|
+
renderModels();
|
|
1534
1606
|
const unsubscribeLocale = options.subscribeLocale(applyMessages);
|
|
1535
1607
|
applyMessages();
|
|
1536
1608
|
status.textContent = messages.ready;
|
|
1537
|
-
controlStatus.textContent = options.locale() === "zh-CN" ? "
|
|
1609
|
+
controlStatus.textContent = options.locale() === "zh-CN" ? "正在读取本地连接状态……" : "Reading local connection status…";
|
|
1538
1610
|
refreshActions();
|
|
1539
1611
|
refreshControlActions();
|
|
1540
1612
|
const summaryMessage = (summary) => summary.state === "expired" ? messages.expired(summary.revision) : summary.state === "superseded" ? messages.superseded(summary.revision) : summary.pickupCount > 0 ? messages.pickedUp(
|
|
@@ -1573,6 +1645,7 @@ function createExternalHandoffPanel(document, framework, locale, sessionId, subs
|
|
|
1573
1645
|
resolveButton,
|
|
1574
1646
|
cancelManagedButton,
|
|
1575
1647
|
connectButton,
|
|
1648
|
+
readModel: () => modelSelect.value || void 0,
|
|
1576
1649
|
disconnectButton,
|
|
1577
1650
|
revokeButton,
|
|
1578
1651
|
confirmDisclosure(annotation) {
|
|
@@ -1583,7 +1656,7 @@ function createExternalHandoffPanel(document, framework, locale, sessionId, subs
|
|
|
1583
1656
|
annotation.targets.length,
|
|
1584
1657
|
paths.length
|
|
1585
1658
|
);
|
|
1586
|
-
disclosureFiles.textContent = paths.length === 0 ? "
|
|
1659
|
+
disclosureFiles.textContent = paths.length === 0 ? "—" : paths.join("\n");
|
|
1587
1660
|
disclosure.hidden = false;
|
|
1588
1661
|
const rootNode = root.getRootNode();
|
|
1589
1662
|
const activeElement = "activeElement" in rootNode ? rootNode.activeElement : document.activeElement;
|
|
@@ -1629,20 +1702,24 @@ function createExternalHandoffPanel(document, framework, locale, sessionId, subs
|
|
|
1629
1702
|
},
|
|
1630
1703
|
renderControlStatus(value) {
|
|
1631
1704
|
control = value;
|
|
1705
|
+
renderModels();
|
|
1632
1706
|
controlStatus.textContent = controlStatusText(value, messages, framework);
|
|
1633
1707
|
controlStatus.dataset.state = value.connectionState;
|
|
1634
1708
|
disclosureNoGuarantee.textContent = value.mode === "managed" ? messages.disclosureManagedGuarantee : messages.disclosureNoGuarantee;
|
|
1635
1709
|
refreshControlActions();
|
|
1710
|
+
refreshActions();
|
|
1636
1711
|
options.onControlChange?.(value);
|
|
1637
1712
|
options.onViewChange();
|
|
1638
1713
|
},
|
|
1639
1714
|
renderControlUnavailable() {
|
|
1640
1715
|
control = void 0;
|
|
1716
|
+
renderModels();
|
|
1641
1717
|
controlStatus.dataset.state = "unavailable";
|
|
1642
1718
|
controlStatus.textContent = messages.controlUnavailable;
|
|
1643
1719
|
disclosureNoGuarantee.textContent = messages.disclosureNoGuarantee;
|
|
1644
1720
|
refreshControlActions();
|
|
1645
1721
|
options.onControlChange?.(void 0);
|
|
1722
|
+
refreshActions();
|
|
1646
1723
|
options.onViewChange();
|
|
1647
1724
|
},
|
|
1648
1725
|
renderManagedResult(result) {
|
|
@@ -1670,6 +1747,7 @@ function createExternalHandoffPanel(document, framework, locale, sessionId, subs
|
|
|
1670
1747
|
setControlBusy(nextBusy) {
|
|
1671
1748
|
controlOperationBusy = nextBusy;
|
|
1672
1749
|
refreshControlActions();
|
|
1750
|
+
refreshActions();
|
|
1673
1751
|
},
|
|
1674
1752
|
setContextReady(ready) {
|
|
1675
1753
|
contextReady = ready;
|
|
@@ -1687,6 +1765,8 @@ function createExternalHandoffPanel(document, framework, locale, sessionId, subs
|
|
|
1687
1765
|
disclosure.removeEventListener("keydown", handleDisclosureKeydown);
|
|
1688
1766
|
settings.removeEventListener("toggle", options.onViewChange);
|
|
1689
1767
|
managedResult.removeEventListener("toggle", options.onViewChange);
|
|
1768
|
+
modelSelect.removeEventListener("change", handleModelChange);
|
|
1769
|
+
modelPicker.dispose();
|
|
1690
1770
|
unsubscribeLocale();
|
|
1691
1771
|
}
|
|
1692
1772
|
});
|