@spotpatch/runtime 1.2.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -227,7 +227,7 @@ function isAgentEventBase(value) {
227
227
  "timestamp",
228
228
  "type",
229
229
  "data"
230
- ]) && value.schemaVersion === 1 && isPositiveInteger(value.sequence) && isJobId(value.jobId) && typeof value.status === "string" && JOB_STATUS_VALUES.has(value.status) && isIsoTimestamp(value.timestamp) && typeof value.type === "string" && isRecord(value.data);
230
+ ]) && value.schemaVersion === 2 && isPositiveInteger(value.sequence) && isJobId(value.jobId) && typeof value.status === "string" && JOB_STATUS_VALUES.has(value.status) && isIsoTimestamp(value.timestamp) && typeof value.type === "string" && isRecord(value.data);
231
231
  }
232
232
  function isAgentJobEvent(value) {
233
233
  if (!isAgentEventBase(value)) {
@@ -241,12 +241,13 @@ function isAgentJobEvent(value) {
241
241
  return hasOnlyKeys(data, ["message"]) && isBoundedString(data.message, 1024);
242
242
  case "tool":
243
243
  return hasOnlyKeys(data, [
244
+ "turn",
244
245
  "toolCallId",
245
246
  "toolName",
246
247
  "state",
247
248
  "relativePath",
248
249
  "checkLabel"
249
- ]) && isBoundedString(data.toolCallId, 256) && isBoundedString(data.toolName, 100) && (data.state === "started" || data.state === "succeeded" || data.state === "failed") && isOptionalBoundedString(data.relativePath, 1024) && isOptionalBoundedString(data.checkLabel, 100);
250
+ ]) && isPositiveInteger(data.turn) && isBoundedString(data.toolCallId, 256) && isBoundedString(data.toolName, 100) && (data.state === "started" || data.state === "succeeded" || data.state === "failed") && isOptionalBoundedString(data.relativePath, 1024) && isOptionalBoundedString(data.checkLabel, 100);
250
251
  case "check":
251
252
  return hasOnlyKeys(data, ["result"]) && isAgentCheckResult(data.result);
252
253
  case "result-ready":
@@ -2347,13 +2348,15 @@ var ERROR_MESSAGES_EN = Object.freeze({
2347
2348
  [import_shared6.ERROR_CODES.WORKTREE_LOCAL_CHANGES_TOO_LARGE]: "Reduce untracked files below the safe count and size limits.",
2348
2349
  [import_shared6.ERROR_CODES.WORKTREE_UNTRACKED_UNSUPPORTED]: "An untracked path is missing, linked, or not a regular file.",
2349
2350
  [import_shared6.ERROR_CODES.WORKTREE_LOCAL_CHANGES_UNSUPPORTED]: "Local changes cannot be isolated safely.",
2350
- [import_shared6.ERROR_CODES.TOOL_DENIED]: "A model tool request violated the local safety policy.",
2351
- [import_shared6.ERROR_CODES.TOOL_INPUT_INVALID]: "The model sent invalid tool arguments or reused a tool ID.",
2352
- [import_shared6.ERROR_CODES.TOOL_PATH_DENIED]: "The model requested a protected, linked, non-text, or external path.",
2353
- [import_shared6.ERROR_CODES.PATCH_REJECTED]: "The proposed patch did not pass local policy.",
2354
- [import_shared6.ERROR_CODES.VALIDATION_FAILED]: "Required project checks failed. The change cannot be applied.",
2355
- [import_shared6.ERROR_CODES.APPLY_CONFLICT]: "Project files changed after the Agent baseline; no overwrite was performed.",
2356
- [import_shared6.ERROR_CODES.INTERNAL_ERROR]: "The Agent job failed without exposing private details."
2351
+ [import_shared6.ERROR_CODES.TOOL_DENIED]: "A tool request violated local safety policy.",
2352
+ [import_shared6.ERROR_CODES.TOOL_INPUT_INVALID]: "Invalid tool request.",
2353
+ [import_shared6.ERROR_CODES.TOOL_ARGUMENTS_INVALID]: "Tool arguments are invalid.",
2354
+ [import_shared6.ERROR_CODES.TOOL_CALL_ID_CONFLICT]: "Tool ID conflicts in this turn.",
2355
+ [import_shared6.ERROR_CODES.TOOL_PATH_DENIED]: "The model requested a protected or external path.",
2356
+ [import_shared6.ERROR_CODES.PATCH_REJECTED]: "The patch violated local policy.",
2357
+ [import_shared6.ERROR_CODES.VALIDATION_FAILED]: "Required checks failed; changes cannot be applied.",
2358
+ [import_shared6.ERROR_CODES.APPLY_CONFLICT]: "Agent-touched files changed; nothing was overwritten.",
2359
+ [import_shared6.ERROR_CODES.INTERNAL_ERROR]: "The Agent failed without exposing private details."
2357
2360
  });
2358
2361
  var ERROR_MESSAGES_ZH = Object.freeze({
2359
2362
  [import_shared6.ERROR_CODES.INVALID_REQUEST]: "Agent \u8BF7\u6C42\u65E0\u6548\uFF0C\u5DF2\u88AB\u62D2\u7EDD\u3002",
@@ -2380,13 +2383,15 @@ var ERROR_MESSAGES_ZH = Object.freeze({
2380
2383
  [import_shared6.ERROR_CODES.WORKTREE_LOCAL_CHANGES_TOO_LARGE]: "\u672A\u8DDF\u8E2A\u6587\u4EF6\u8D85\u8FC7\u5B89\u5168\u6570\u91CF\u6216\u4F53\u79EF\u4E0A\u9650\uFF0C\u8BF7\u5148\u7CBE\u7B80\u3002",
2381
2384
  [import_shared6.ERROR_CODES.WORKTREE_UNTRACKED_UNSUPPORTED]: "\u672A\u8DDF\u8E2A\u9879\u5DF2\u4E22\u5931\u3001\u662F\u7B26\u53F7\u94FE\u63A5\u6216\u4E0D\u662F\u666E\u901A\u6587\u4EF6\u3002",
2382
2385
  [import_shared6.ERROR_CODES.WORKTREE_LOCAL_CHANGES_UNSUPPORTED]: "\u5F53\u524D\u672C\u5730\u4FEE\u6539\u65E0\u6CD5\u5B89\u5168\u9694\u79BB\u3002",
2383
- [import_shared6.ERROR_CODES.TOOL_DENIED]: "\u6A21\u578B\u5DE5\u5177\u8BF7\u6C42\u8FDD\u53CD\u672C\u5730\u5B89\u5168\u7B56\u7565\u3002",
2384
- [import_shared6.ERROR_CODES.TOOL_INPUT_INVALID]: "\u6A21\u578B\u53D1\u9001\u4E86\u65E0\u6548\u5DE5\u5177\u53C2\u6570\uFF0C\u6216\u590D\u7528\u4E86\u5DE5\u5177\u8C03\u7528 ID\u3002",
2385
- [import_shared6.ERROR_CODES.TOOL_PATH_DENIED]: "\u6A21\u578B\u8BF7\u6C42\u4E86\u53D7\u4FDD\u62A4\u3001\u975E\u6587\u672C\u3001\u7B26\u53F7\u94FE\u63A5\u6216\u9879\u76EE\u5916\u8DEF\u5F84\u3002",
2386
- [import_shared6.ERROR_CODES.PATCH_REJECTED]: "\u5EFA\u8BAE\u8865\u4E01\u672A\u901A\u8FC7\u672C\u5730\u7B56\u7565\u68C0\u67E5\u3002",
2387
- [import_shared6.ERROR_CODES.VALIDATION_FAILED]: "\u9879\u76EE\u5FC5\u9700\u68C0\u67E5\u5931\u8D25\uFF0C\u4E0D\u80FD\u5E94\u7528\u672C\u6B21\u53D8\u66F4\u3002",
2388
- [import_shared6.ERROR_CODES.APPLY_CONFLICT]: "Agent \u5EFA\u7ACB\u57FA\u7EBF\u540E\u9879\u76EE\u6587\u4EF6\u5DF2\u53D8\u5316\uFF0C\u672A\u6267\u884C\u8986\u76D6\u3002",
2389
- [import_shared6.ERROR_CODES.INTERNAL_ERROR]: "Agent \u4EFB\u52A1\u5931\u8D25\uFF0C\u79C1\u6709\u7EC6\u8282\u672A\u66B4\u9732\u5230\u6D4F\u89C8\u5668\u3002"
2386
+ [import_shared6.ERROR_CODES.TOOL_DENIED]: "\u5DE5\u5177\u8BF7\u6C42\u8FDD\u53CD\u672C\u5730\u5B89\u5168\u7B56\u7565\u3002",
2387
+ [import_shared6.ERROR_CODES.TOOL_INPUT_INVALID]: "\u5DE5\u5177\u8BF7\u6C42\u65E0\u6548\u3002",
2388
+ [import_shared6.ERROR_CODES.TOOL_ARGUMENTS_INVALID]: "\u5DE5\u5177\u53C2\u6570\u65E0\u6548\u3002",
2389
+ [import_shared6.ERROR_CODES.TOOL_CALL_ID_CONFLICT]: "\u672C\u8F6E\u5DE5\u5177 ID \u51B2\u7A81\u3002",
2390
+ [import_shared6.ERROR_CODES.TOOL_PATH_DENIED]: "\u6A21\u578B\u8BF7\u6C42\u4E86\u53D7\u4FDD\u62A4\u6216\u9879\u76EE\u5916\u8DEF\u5F84\u3002",
2391
+ [import_shared6.ERROR_CODES.PATCH_REJECTED]: "\u8865\u4E01\u8FDD\u53CD\u672C\u5730\u7B56\u7565\u3002",
2392
+ [import_shared6.ERROR_CODES.VALIDATION_FAILED]: "\u5FC5\u9700\u68C0\u67E5\u5931\u8D25\uFF0C\u65E0\u6CD5\u5E94\u7528\u53D8\u66F4\u3002",
2393
+ [import_shared6.ERROR_CODES.APPLY_CONFLICT]: "Agent \u89E6\u53CA\u6587\u4EF6\u5DF2\u53D8\u5316\uFF0C\u672A\u8986\u76D6\u3002",
2394
+ [import_shared6.ERROR_CODES.INTERNAL_ERROR]: "Agent \u5931\u8D25\uFF0C\u672A\u66B4\u9732\u79C1\u6709\u7EC6\u8282\u3002"
2390
2395
  });
2391
2396
  var SUMMARY_MESSAGES_EN = Object.freeze({
2392
2397
  adapter: "React adapter",
@@ -4160,7 +4165,7 @@ function capabilityKey(providerProfileId, modelProfileId) {
4160
4165
  function activityFromEvent(event) {
4161
4166
  if (event.type === "tool") {
4162
4167
  return Object.freeze({
4163
- key: `tool:${event.data.toolCallId}`,
4168
+ key: `tool:${String(event.data.turn)}:${event.data.toolCallId}`,
4164
4169
  label: `${event.data.toolName} \xB7 ${event.data.state}`,
4165
4170
  state: event.data.state === "started" ? "active" : event.data.state === "succeeded" ? "success" : "failure"
4166
4171
  });