@xopcai/xopc 0.0.442 → 0.0.444

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 (156) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-Chneosh4.js → agent-defaults-settings-panel-rH1QpgiR.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agents-DKfOY5z9.js → agents-lvQfOQPN.js} +1 -1
  5. package/dist/gateway/static/root/assets/{api-ClZ7BrD4.js → api-snfMD8_Y.js} +1 -1
  6. package/dist/gateway/static/root/assets/{apps-page-CBLj-m2k.js → apps-page-C3iDd3ZQ.js} +1 -1
  7. package/dist/gateway/static/root/assets/automation-task-card-CKbHMLSy.js +3 -0
  8. package/dist/gateway/static/root/assets/{automations-page-CYngiwxI.js → automations-page-K3trjTZl.js} +1 -1
  9. package/dist/gateway/static/root/assets/{automations-workspace-zyhyqSdH.js → automations-workspace-D7m3w_9B.js} +2 -2
  10. package/dist/gateway/static/root/assets/{capabilities-oWWLfwf3.js → capabilities-DDJJhQ40.js} +1 -1
  11. package/dist/gateway/static/root/assets/{capabilities-BpYi2fQO.js → capabilities-DJYgOjeq.js} +1 -1
  12. package/dist/gateway/static/root/assets/{capabilities-page-Dlgwv1dI.js → capabilities-page-CBqvHAyp.js} +2 -2
  13. package/dist/gateway/static/root/assets/{capabilities-settings-panel-CslXPIs8.js → capabilities-settings-panel-wjezs0OE.js} +1 -1
  14. package/dist/gateway/static/root/assets/{channels-P-xOLYBz.js → channels-D4q8hiD0.js} +1 -1
  15. package/dist/gateway/static/root/assets/{chat-page-Cen4dGHa.js → chat-page-CeHOmJqM.js} +6 -6
  16. package/dist/gateway/static/root/assets/{chat-terminal-dock-DTQL2DBu.js → chat-terminal-dock-D9o0nUEV.js} +1 -1
  17. package/dist/gateway/static/root/assets/{composer-payload-handoff-B1GFVFK_.js → composer-payload-handoff-CoDWKzBm.js} +1 -1
  18. package/dist/gateway/static/root/assets/{connected-providers-grid-sULM6YyQ.js → connected-providers-grid-C5-3MDIj.js} +1 -1
  19. package/dist/gateway/static/root/assets/{connectors-page-DN9BOiFk.js → connectors-page-QVWuoxuK.js} +1 -1
  20. package/dist/gateway/static/root/assets/constants-CsVXarqA.js +1 -0
  21. package/dist/gateway/static/root/assets/{extension-debug-page-D2Dhtu6H.js → extension-debug-page-CDZfdMAR.js} +1 -1
  22. package/dist/gateway/static/root/assets/{extension-iframe-host-Dra7k_6o.js → extension-iframe-host-CG70QWPS.js} +1 -1
  23. package/dist/gateway/static/root/assets/{extension-page-Dd16lQg-.js → extension-page-DpJTL6-v.js} +1 -1
  24. package/dist/gateway/static/root/assets/{extension-provider-C4WwnCxf.js → extension-provider-BZTbdvCF.js} +1 -1
  25. package/dist/gateway/static/root/assets/{extension-settings-page-BHwQ2ipj.js → extension-settings-page-CC4rmiFC.js} +1 -1
  26. package/dist/gateway/static/root/assets/{home-page-D-gy9LlQ.js → home-page-Df3X6-Ko.js} +2 -2
  27. package/dist/gateway/static/root/assets/{index-CqQZfWRQ.js → index-Cg0AgHw1.js} +5 -5
  28. package/dist/gateway/static/root/assets/{index-D7Noveui.css → index-DE2bG5EI.css} +1 -1
  29. package/dist/gateway/static/root/assets/{local-app-workbench-page-Drbzz4Lm.js → local-app-workbench-page-CE46mHc0.js} +1 -1
  30. package/dist/gateway/static/root/assets/{note-detail-panel-BQdgpm0s.js → note-detail-panel-DWIWloib.js} +1 -1
  31. package/dist/gateway/static/root/assets/{notes-page-IefutMyg.js → notes-page-DIugUbkV.js} +1 -1
  32. package/dist/gateway/static/root/assets/{page-context-capture-button-DDmLslYG.js → page-context-capture-button-B9L7V_n2.js} +1 -1
  33. package/dist/gateway/static/root/assets/{personal-page-DkrDSJqk.js → personal-page-BZWJKyZ8.js} +1 -1
  34. package/dist/gateway/static/root/assets/{product-preview-content-COU6H_jO.js → product-preview-content-CGbqoID0.js} +1 -1
  35. package/dist/gateway/static/root/assets/{product-preview-modal-Ct5q4tv6.js → product-preview-modal-0wvIDcVr.js} +2 -2
  36. package/dist/gateway/static/root/assets/{project-detail-page-CQj7nm6I.js → project-detail-page-Bkxs8knZ.js} +2 -2
  37. package/dist/gateway/static/root/assets/{projects-page-sWxQJrFS.js → projects-page-BsgZb6n9.js} +1 -1
  38. package/dist/gateway/static/root/assets/{route-preload-CDQtPdgq.js → route-preload-BVo8JPwW.js} +2 -2
  39. package/dist/gateway/static/root/assets/{session-manager-Czu9GpZX.js → session-manager-ChHnJOWW.js} +1 -1
  40. package/dist/gateway/static/root/assets/{sessions-page-CGkbbrz-.js → sessions-page-BM-oqd22.js} +1 -1
  41. package/dist/gateway/static/root/assets/{settings-page-zGjDXdHY.js → settings-page-irv-JoTz.js} +1 -1
  42. package/dist/gateway/static/root/assets/{share-preview-page-Bs3VjTGj.js → share-preview-page-CFebGqyB.js} +1 -1
  43. package/dist/gateway/static/root/assets/{shares-settings-BseSozxm.js → shares-settings-B-7la3QN.js} +1 -1
  44. package/dist/gateway/static/root/assets/sliding-tab-list-CmcrqRzN.js +1 -0
  45. package/dist/gateway/static/root/assets/task-detail-page-6awKGnOr.js +3 -0
  46. package/dist/gateway/static/root/assets/{task-result-evidence-BNhYqUAa.js → task-result-evidence-Cy9txdqV.js} +1 -1
  47. package/dist/gateway/static/root/assets/{tasks-DRmd6sWt.js → tasks-D_xuHn6V.js} +1 -1
  48. package/dist/gateway/static/root/assets/{tracing-settings-page-CMtFem_g.js → tracing-settings-page-B_Xdc2VF.js} +1 -1
  49. package/dist/gateway/static/root/assets/{usage-page-BO2OFCoA.js → usage-page-DqzosTxy.js} +1 -1
  50. package/dist/gateway/static/root/assets/use-composer-attachments-ClakaDU1.js +2 -0
  51. package/dist/gateway/static/root/assets/{use-file-preview-expanded-g4SwMHbx.js → use-file-preview-expanded-9DED7ohY.js} +1 -1
  52. package/dist/gateway/static/root/assets/{use-workspace-tree-DG5ZMfaY.js → use-workspace-tree-Dq0qgK3N.js} +1 -1
  53. package/dist/gateway/static/root/assets/{user-model-page-B5_01fi_.js → user-model-page-Ziz55hVM.js} +1 -1
  54. package/dist/gateway/static/root/assets/{voice-transcribe-api-Cc92OabY.js → voice-transcribe-api-Bf9FaI-p.js} +1 -1
  55. package/dist/gateway/static/root/assets/{workspace-api-fKmmIslV.js → workspace-api-DrVss2Fd.js} +2 -2
  56. package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-C_0lUEsm.js → workspace-file-preview-dialog-C2egBzza.js} +1 -1
  57. package/dist/gateway/static/root/assets/{workspace-open-location-menu-BznuSmFZ.js → workspace-open-location-menu-XFUtwfLY.js} +1 -1
  58. package/dist/gateway/static/root/index.html +24 -24
  59. package/dist/package.js +1 -1
  60. package/dist/packages/gateway-contract/src/task-research-result.js +1 -0
  61. package/dist/packages/gateway-contract/src/tasks.js +1 -1
  62. package/dist/src/agent/embedded/codemode-extension.js +10 -1
  63. package/dist/src/agent/embedded/execution-tool-policy.d.ts +1 -1
  64. package/dist/src/agent/embedded/execution-tool-policy.js +2 -1
  65. package/dist/src/agent/embedded/run-turn.js +2 -1
  66. package/dist/src/agent/embedded/session-runner.js +1 -0
  67. package/dist/src/agent/orchestration/llm-turn-retry.d.ts +4 -0
  68. package/dist/src/agent/orchestration/llm-turn-retry.js +14 -1
  69. package/dist/src/agent/tool-manuals/xopc-use.d.ts +1 -1
  70. package/dist/src/agent/tool-manuals/xopc-use.js +3 -0
  71. package/dist/src/agent/tools/factory.js +1 -0
  72. package/dist/src/agent/tools/personal-request-result-tool.js +2 -2
  73. package/dist/src/agent/tools/personal-request-tool.js +4 -1
  74. package/dist/src/agent/tools/personal-task-tool.d.ts +1 -0
  75. package/dist/src/agent/tools/personal-task-tool.js +4 -0
  76. package/dist/src/agent/tools/task-collaboration-tool.js +10 -1
  77. package/dist/src/agent/tools/task-evidence.js +1 -0
  78. package/dist/src/agent/tools/xopc-use-tool.js +10 -1
  79. package/dist/src/automations/capabilities/write.d.ts +6 -6
  80. package/dist/src/automations/domain/validation.d.ts +12 -12
  81. package/dist/src/automations/draft/automation-draft-validator.d.ts +1 -1
  82. package/dist/src/cli/commands/extension-dev.js +1 -1
  83. package/dist/src/cli/commands/extension-marketplace.js +1 -1
  84. package/dist/src/cli/commands/extension.js +1 -1
  85. package/dist/src/cli/commands/models.js +1 -1
  86. package/dist/src/cli/commands/onboard/model.js +3 -3
  87. package/dist/src/cli/commands/tunnel.js +1 -1
  88. package/dist/src/gateway/hono/app.js +1 -1
  89. package/dist/src/gateway/hono/middleware/auth.js +1 -1
  90. package/dist/src/gateway/hono/routes/config-patch/misc.js +2 -2
  91. package/dist/src/gateway/hono/routes/desktop-host.js +1 -1
  92. package/dist/src/gateway/hono/routes/exposure.js +1 -1
  93. package/dist/src/gateway/hono/routes/files.js +2 -2
  94. package/dist/src/gateway/hono/routes/logs.js +1 -1
  95. package/dist/src/gateway/hono/routes/models.js +5 -5
  96. package/dist/src/gateway/hono/routes/notes.js +1 -1
  97. package/dist/src/gateway/hono/routes/phone-setup.js +1 -1
  98. package/dist/src/gateway/hono/routes/projects.js +1 -1
  99. package/dist/src/gateway/hono/routes/runtime-tools.js +1 -1
  100. package/dist/src/gateway/hono/routes/sessions.js +1 -1
  101. package/dist/src/gateway/hono/routes/shares.js +5 -5
  102. package/dist/src/gateway/hono/routes/status.js +1 -1
  103. package/dist/src/gateway/hono/routes/tasks.js +1 -1
  104. package/dist/src/gateway/hono/routes/tunnel.js +2 -2
  105. package/dist/src/gateway/hono/routes/voice.js +1 -1
  106. package/dist/src/gateway/index.js +1 -1
  107. package/dist/src/gateway/next-turn-suggestions/snapshot.js +11 -3
  108. package/dist/src/gateway/provider-model-setup.js +1 -1
  109. package/dist/src/gateway/security/audit.js +1 -1
  110. package/dist/src/gateway/security/index.js +2 -2
  111. package/dist/src/gateway/server.js +1 -1
  112. package/dist/src/gateway/service/agent-runner.js +1 -1
  113. package/dist/src/gateway/service/run-gateway-agent.js +1 -1
  114. package/dist/src/gateway/service/sessions-api.js +1 -1
  115. package/dist/src/gateway/service.js +21 -21
  116. package/dist/src/gateway/side-chat/run-service.js +1 -1
  117. package/dist/src/home-intelligence/application-service.js +1 -1
  118. package/dist/src/personal-agent/communication.d.ts +1 -1
  119. package/dist/src/personal-agent/communication.js +2 -2
  120. package/dist/src/personal-agent/reply-style.d.ts +1 -1
  121. package/dist/src/personal-agent/reply-style.js +3 -1
  122. package/dist/src/personal-agent/request-delivery.js +1 -5
  123. package/dist/src/personal-agent/request-repository.d.ts +1 -0
  124. package/dist/src/personal-agent/request-service.d.ts +1 -0
  125. package/dist/src/personal-agent/request-service.js +12 -3
  126. package/dist/src/personal-agent/request-verification.d.ts +6 -0
  127. package/dist/src/personal-agent/request-verification.js +22 -0
  128. package/dist/src/phone/stream-gateway.js +1 -1
  129. package/dist/src/providers/setup/voice.js +1 -1
  130. package/dist/src/realtime/runtime.js +1 -1
  131. package/dist/src/remote-access/exposure-manager.js +1 -1
  132. package/dist/src/share/site-share-router.js +2 -2
  133. package/dist/src/tasks/task-allocation-service.js +4 -2
  134. package/dist/src/tasks/task-application-service.js +4 -1
  135. package/dist/src/tasks/task-context-assembler.js +3 -1
  136. package/dist/src/tasks/task-contract-definition.d.ts +1 -0
  137. package/dist/src/tasks/task-contract-planner.js +3 -0
  138. package/dist/src/tasks/task-main-update-decision-service.js +7 -7
  139. package/dist/src/tasks/task-main-update-delivery.js +15 -2
  140. package/dist/src/tasks/task-repository.js +1 -1
  141. package/dist/src/tasks/task-research-repair.d.ts +1 -0
  142. package/dist/src/tasks/task-research-repair.js +3 -1
  143. package/dist/src/tasks/task-research-result.js +24 -3
  144. package/dist/src/tasks/task-run-coordinator.js +12 -9
  145. package/dist/src/tui/backends/embedded-backend.js +3 -3
  146. package/dist/src/tunnel/gateway-lifecycle.js +1 -1
  147. package/dist/src/voice/realtime/runtime.js +1 -1
  148. package/dist/src/work-discovery/index.js +2 -2
  149. package/dist/src/work-discovery/investigator.js +1 -1
  150. package/dist/src/work-discovery/service.js +3 -3
  151. package/package.json +2 -2
  152. package/dist/gateway/static/root/assets/automation-task-card-DLg-LYCm.js +0 -3
  153. package/dist/gateway/static/root/assets/constants-DBtMsXdW.js +0 -1
  154. package/dist/gateway/static/root/assets/sliding-tab-list-DuQyViqe.js +0 -1
  155. package/dist/gateway/static/root/assets/task-detail-page-CwMpmFVS.js +0 -3
  156. package/dist/gateway/static/root/assets/use-composer-attachments-DA6SxZPQ.js +0 -2
@@ -57,6 +57,7 @@ function buildResearchRepair(input) {
57
57
  instructionSequence: input.instructionSequence,
58
58
  criteria: input.criteria,
59
59
  stale: input.stale,
60
+ resultFingerprint: input.resultFingerprint,
60
61
  publications,
61
62
  sources: research?.sources.map((source) => source.snapshotHash).sort(),
62
63
  claims: research?.claims.map((claim) => [claim.statement, claim.support]),
@@ -69,7 +70,8 @@ function buildResearchRepair(input) {
69
70
  JSON.stringify(gaps).slice(0, 16e3),
70
71
  "Resolve contradictions by checking original sources and dates, or accurately document conflicting evidence and limits. Never invent a consensus. Follow the latest user direction.",
71
72
  "Only perform in-scope source reads, workspace corrections and required artifact publication. Do not replay external writes, messages, purchases or account actions. Ask if new authorization or missing user input is required.",
72
- "Publish corrected final files, then call publish_task_result with fresh evidence and read every returned check. If no research result was previously submitted, submit one when applicable. Preserve honest unverified status for impossible checks.",
73
+ "For a connected-app request, first save the corrected summary, items and complete coverage with personal_request_result, then submit source-linked claims with publish_task_result. Do not create files or use unavailable artifact tools for connected requests.",
74
+ "Publish required corrected final files, then call publish_task_result with fresh evidence and read every returned check. If no research result was previously submitted, submit one when applicable. Preserve honest unverified status for impossible checks.",
73
75
  "Use mode amend for targeted repair: keep original source/claim IDs and unchanged calculation/input evidence. Update changed claims by ID; retire obsolete or incorrect claims with retireClaimIds. A file repair must not discard valid price or script evidence. Never cite an earlier review as a source proving its own success.",
74
76
  "Do not repeatedly resubmit unchanged evidence. Keep the final user reply concise: result, material limitation and file entry points."
75
77
  ].join("\n")
@@ -17,6 +17,7 @@ import { taskInstructionSequence } from "./task-instruction-sequence.js";
17
17
  import { TaskResultDeliveryRepository } from "./task-result-delivery-repository.js";
18
18
  import { defineTaskContract } from "./task-contract-definition.js";
19
19
  import { completeTaskModelCall } from "./task-model-call.js";
20
+ import { personalRequestReviewSnapshot } from "../personal-agent/request-verification.js";
20
21
  import { observedEvidenceExcerpt, suggestedEvidenceRanges } from "./task-evidence-ranges.js";
21
22
  import { createHash } from "node:crypto";
22
23
  import { z } from "zod";
@@ -324,11 +325,14 @@ function taskResearchEvidence(conversationId) {
324
325
  if (!link || !run || run.conversationId !== conversationId || !["running", "verifying"].includes(run.status)) throw new Error("No active Task execution");
325
326
  const transcriptId = readCurrentTranscriptId(getSqliteDatabase(), conversationId);
326
327
  const rows = getSqliteDatabase().prepare(`SELECT payload_json, created_at FROM transcript_entries
327
- WHERE transcript_id = ? AND role = 'toolResult' AND created_at >= ? ORDER BY seq`).all(transcriptId, run.startedAt ?? 0);
328
+ WHERE transcript_id = ? AND (role = 'toolResult' OR
329
+ (role IS NULL AND json_extract(payload_json, '$.customType') = 'codemode-tool-result'))
330
+ AND created_at >= ? ORDER BY seq`).all(transcriptId, run.startedAt ?? 0);
328
331
  return {
329
332
  rows,
330
333
  tools: rows.flatMap((row) => {
331
- const value = JSON.parse(row.payload_json);
334
+ const stored = JSON.parse(row.payload_json);
335
+ const value = stored.customType === "codemode-tool-result" ? stored.data : stored;
332
336
  if (!RESEARCH_READ_TOOLS.has(value.toolName) || value.toolName === "managed_job" && (value.details?.status !== "success" || value.details?.exitCode !== 0) || value.toolName === "task_collaboration" && value.details?.taskSourceRead?.taskId !== link.taskId || value.isError || value.details?.error || [
333
337
  "failed",
334
338
  "blocked",
@@ -362,10 +366,13 @@ async function submitTaskResearchResult(conversationId, toolCallId, raw, signal,
362
366
  const task = new TaskRepository().require(link.taskId);
363
367
  const criteria = task.contract?.acceptanceCriteria ?? [];
364
368
  if (criteria.length > 40) throw new Error("Research acceptance exceeds 40 criteria");
369
+ const personalSnapshot = personalRequestReviewSnapshot(task.id, run.id);
370
+ if (personalSnapshot && !personalSnapshot.content) throw new Error("Save the connected-app result with personal_request_result before submitting acceptance evidence.");
365
371
  const { rows, tools } = taskResearchEvidence(conversationId);
366
372
  let result = TaskResearchResultSchema.parse({
367
373
  version: 1,
368
374
  contractVersion: task.latestContractVersion,
375
+ ...personalSnapshot?.hash ? { personalResultHash: personalSnapshot.hash } : {},
369
376
  instructionSequence: taskInstructionSequence(task.id),
370
377
  sources: bindResearchSources(input, tools),
371
378
  claims: input.claims.map((claim) => ({
@@ -389,7 +396,7 @@ async function submitTaskResearchResult(conversationId, toolCallId, raw, signal,
389
396
  review: "unavailable"
390
397
  });
391
398
  if ((result.instructionChecks?.length ?? 0) > 40) throw new Error("Instruction review exceeds 40 applicable directions; explicitly supersede obsolete directions before continuing");
392
- if (JSON.stringify(result).length + (task.body?.length ?? 0) > 48e3) throw new Error("Research review exceeds context budget; shorten excerpts without dropping required findings");
399
+ if (JSON.stringify(result).length + (task.body?.length ?? 0) + (personalSnapshot?.content?.length ?? 0) > 48e3) throw new Error("Research review exceeds context budget; shorten excerpts without dropping required findings");
393
400
  const published = /* @__PURE__ */ new Map();
394
401
  for (const row of rows) for (const rawArtifact of JSON.parse(row.payload_json).details?.artifacts ?? []) {
395
402
  const artifact = TurnOutcomeDeliverableSchema.safeParse(rawArtifact);
@@ -416,6 +423,11 @@ async function submitTaskResearchResult(conversationId, toolCallId, raw, signal,
416
423
  result.finalArtifactIds = submitted.finalArtifactIds;
417
424
  }
418
425
  const artifacts = [];
426
+ if (personalSnapshot?.content) artifacts.push({
427
+ title: "Saved connected-app result (summary, items and coverage)",
428
+ content: personalSnapshot.content,
429
+ contentReviewed: true
430
+ });
419
431
  result.inspectedArtifactIds = [...published.values()].map((artifact) => artifact.artifactId);
420
432
  let contentBudget = 24e3;
421
433
  for (const artifact of published.values()) {
@@ -473,7 +485,16 @@ async function submitTaskResearchResult(conversationId, toolCallId, raw, signal,
473
485
  note: "Default criteria were not expanded into concrete acceptance items; broad completion cannot certify item coverage."
474
486
  }))
475
487
  };
488
+ if (personalSnapshot && !personalSnapshot.complete) result = {
489
+ ...result,
490
+ checks: result.checks.map((check) => ({
491
+ ...check,
492
+ status: "unverified",
493
+ note: "Connected-app query coverage is incomplete; finish the requested range before automatic acceptance."
494
+ }))
495
+ };
476
496
  signal?.throwIfAborted();
497
+ if (personalSnapshot && personalRequestReviewSnapshot(task.id, run.id)?.hash !== personalSnapshot.hash) throw new Error("Connected-app result changed during review; resubmit evidence for the current saved result.");
477
498
  const current = new TaskRepository().require(task.id);
478
499
  if (current.latestContractVersion !== result.contractVersion || taskInstructionSequence(task.id) !== result.instructionSequence || new TaskRunRepository().getActiveRoot(task.id)?.id !== run.id || current.phase === "closed") throw new Error("Task requirements changed during review; resubmit the current result");
479
500
  new TaskResultDeliveryRepository().capture(run.id, {
@@ -1,7 +1,6 @@
1
1
  import { init_transaction, runSqliteWriteTransaction } from "../storage/sqlite/transaction.js";
2
2
  import { TaskRepository, init_task_repository } from "./task-repository.js";
3
3
  import { TaskRunRepository, init_task_run_repository } from "./task-run-repository.js";
4
- import { init_request_repository, personalRequestForTask } from "../personal-agent/request-repository.js";
5
4
  import { loadTranscriptRowsForSession } from "../storage/sqlite/transcript-repository.js";
6
5
  import "../storage/sqlite/index.js";
7
6
  import { AgentCatalogRepository, init_repository } from "../agent-catalog/repository.js";
@@ -14,11 +13,11 @@ import { TaskCollaborationRepository } from "./task-collaboration-repository.js"
14
13
  import { taskInstructionSequence } from "./task-instruction-sequence.js";
15
14
  import { TaskResultDeliveryRepository } from "./task-result-delivery-repository.js";
16
15
  import { TaskApplicationService } from "./task-application-service.js";
16
+ import { personalRequestReviewSnapshot } from "../personal-agent/request-verification.js";
17
17
  import { currentTaskResearchResult } from "./task-research-result.js";
18
18
  import { buildResearchRepair, inspectTaskPublications } from "./task-research-repair.js";
19
19
  //#region src/tasks/task-run-coordinator.ts
20
20
  init_repository();
21
- init_request_repository();
22
21
  init_transaction();
23
22
  init_task_repository();
24
23
  init_task_run_repository();
@@ -172,7 +171,8 @@ var TaskRunCoordinator = class TaskRunCoordinator {
172
171
  const resultSummary = status === "succeeded" && hasAssistantResult && /^Message processed(?: successfully)?$/.test(input.summary) ? input.assistantText.trim() : input.summary;
173
172
  const summary = emptySuccess ? zh ? "助手执行未返回结果或证据" : "Agent run returned no result or evidence" : zh ? systemSummaries[resultSummary] ?? resultSummary : resultSummary;
174
173
  const research = currentTaskResearchResult(run.id);
175
- const currentResearch = research && research.contractVersion === task.latestContractVersion && research.instructionSequence === taskInstructionSequence(task.id) ? research : void 0;
174
+ const personalSnapshot = personalRequestReviewSnapshot(task.id, run.id);
175
+ const currentResearch = research && (!personalSnapshot || personalSnapshot.hash && personalSnapshot.hash === research.personalResultHash) && research.contractVersion === task.latestContractVersion && research.instructionSequence === taskInstructionSequence(task.id) ? research : void 0;
176
176
  const publications = inspectTaskPublications(run.id, currentResearch);
177
177
  const repair = buildResearchRepair({
178
178
  research: currentResearch,
@@ -180,7 +180,8 @@ var TaskRunCoordinator = class TaskRunCoordinator {
180
180
  instructionSequence: taskInstructionSequence(task.id),
181
181
  publications,
182
182
  criteria: task.contract?.acceptanceCriteria ?? [],
183
- requiresReview: !personalRequestForTask(task.id) && Boolean(task.body?.includes("publish_task_result"))
183
+ resultFingerprint: personalSnapshot?.hash,
184
+ requiresReview: task.contract?.acceptancePolicy === "verified_auto" || !personalSnapshot && Boolean(task.body?.includes("publish_task_result"))
184
185
  });
185
186
  const repairBlocked = Boolean(repair && run.conversationId && !canResumeAfterModelFailure(loadTranscriptRowsForSession(run.conversationId), { allowFailedReadTools: ACCEPTANCE_REPAIR_READ_TOOLS }));
186
187
  if (status === "failed" && isTransientProviderErrorMessage(input.summary) && !unconfirmedEffects && this.#runs.scheduleContinuation({
@@ -226,13 +227,15 @@ var TaskRunCoordinator = class TaskRunCoordinator {
226
227
  note: check.note,
227
228
  method: "model_reviewed"
228
229
  }));
229
- const achieved = status === "succeeded" && checks.length > 0 && checks.length === task.contract?.acceptanceCriteria.length && checks.every((check) => check.status === "passed") && !repair && currentResearch.claims.every((claim) => claim.support === "supported");
230
+ const achieved = status === "succeeded" && checks.length > 0 && checks.length === task.contract?.acceptanceCriteria.length && (!personalSnapshot || personalSnapshot.complete) && [...checks, ...instructionChecks].every((check) => check.status === "passed") && !repair && currentResearch.claims.every((claim) => claim.support === "supported");
231
+ const acceptanceFailed = status === "succeeded" && Boolean(repair) && task.contract?.acceptancePolicy === "verified_auto" && !repairBlocked && !unconfirmedEffects;
232
+ const finalStatus = acceptanceFailed ? "failed" : status;
230
233
  this.#application.completeRun({
231
234
  runId: run.id,
232
235
  expectedRunVersion: run.version,
233
236
  resultText: input.assistantText,
234
237
  receipt: {
235
- status,
238
+ status: finalStatus,
236
239
  summary,
237
240
  changes: this.#evidence.filter((item) => item.kind === "state"),
238
241
  evidence: [...this.#evidence, ...researchEvidence],
@@ -244,10 +247,10 @@ var TaskRunCoordinator = class TaskRunCoordinator {
244
247
  needsUser: unconfirmedEffects || repairBlocked,
245
248
  ...repairBlocked ? { nextAction: zh ? "先确认上次未确认操作的实际影响,再继续补查。" : "Confirm the effects of the unconfirmed operation before repair." } : {},
246
249
  completionVerdict: achieved ? "achieved" : status === "succeeded" ? "partial" : "not_achieved",
247
- ...status === "failed" ? { failure: {
248
- code: unconfirmedEffects ? "tool_outcome_unconfirmed" : emptySuccess ? "empty_agent_run" : "agent_run_failed",
250
+ ...finalStatus === "failed" ? { failure: {
251
+ code: acceptanceFailed ? "acceptance_incomplete" : unconfirmedEffects ? "tool_outcome_unconfirmed" : emptySuccess ? "empty_agent_run" : "agent_run_failed",
249
252
  phase: "execution",
250
- recoveryAction: unconfirmedEffects ? zh ? "检查上次操作的实际影响后再恢复任务" : "Confirm the previous operation effects before resuming" : zh ? "使用其他可用助手或模型重试任务" : "Retry the task run with another available Agent or model"
253
+ recoveryAction: acceptanceFailed ? zh ? "自动补做后仍有未核验项;检查已记录的缺口后重试任务" : "Automatic repair left unverified requirements; inspect the recorded gaps and retry" : unconfirmedEffects ? zh ? "检查上次操作的实际影响后再恢复任务" : "Confirm the previous operation effects before resuming" : zh ? "使用其他可用助手或模型重试任务" : "Retry the task run with another available Agent or model"
251
254
  } } : {}
252
255
  }
253
256
  });
@@ -32,16 +32,16 @@ import { MessageBus, MessageBusShutdownError } from "../../infra/bus/queue.js";
32
32
  import "../../infra/bus/index.js";
33
33
  import { prependEnvelopeTimestamp } from "../../channels/envelope-timestamp.js";
34
34
  import "../../config/index.js";
35
+ import { ChatStreamMapper } from "../../gateway/chat-stream/mapper.js";
35
36
  import { getXopcCloudCatalogCoordinator } from "../../providers/xopc-cloud-catalog-coordinator.js";
37
+ import { acceptSessionCommand } from "../../storage/sqlite/session-creation-repository.js";
38
+ import { fuzzySearchWorkspaceFiles } from "../../gateway/workspace-file-search.js";
36
39
  import { commitDeliveredChatInput } from "../tui-chat-input-state.js";
37
40
  import { sessionMetadataToTuiItem } from "../tui-session-format.js";
38
41
  import { buildTuiTranscriptTree, transcriptTreeEntryIdToRowNumber } from "../tui-transcript-tree.js";
39
42
  import { computeTuiSessionStats } from "../tui-session-stats.js";
40
43
  import { collectTuiStartupResources } from "../tui-startup-resources.js";
41
44
  import { EmbeddedDraftStore } from "./embedded-drafts.js";
42
- import { acceptSessionCommand } from "../../storage/sqlite/session-creation-repository.js";
43
- import { ChatStreamMapper } from "../../gateway/chat-stream/mapper.js";
44
- import { fuzzySearchWorkspaceFiles } from "../../gateway/workspace-file-search.js";
45
45
  import { isAbsolute, join, relative, resolve } from "node:path";
46
46
  //#region src/tui/backends/embedded-backend.ts
47
47
  init_src();
@@ -3,9 +3,9 @@ import { init_logger } from "../utils/logger.js";
3
3
  import { resolveGatewayEffectiveHost } from "../config/gateway-bind.js";
4
4
  import { resolveOptionalTunnelRegistrationSecret, resolveTunnelBrokerUrl } from "./env.js";
5
5
  import { getTunnelService } from "./tunnel-service.js";
6
- import { hasValidTunnelConsent } from "./consent.js";
7
6
  import { resolveGatewayAuth } from "../gateway/auth.js";
8
7
  import { requireTunnelGatewayToken } from "./auth-policy.js";
8
+ import { hasValidTunnelConsent } from "./consent.js";
9
9
  import { resolveFrpSubdomainHost } from "./frp-subdomain-host.js";
10
10
  import { fetchTunnelWellKnown } from "./well-known.js";
11
11
  //#region src/tunnel/gateway-lifecycle.ts
@@ -13,10 +13,10 @@ import { ALIBABA_REALTIME_TTS_MODEL } from "../tts/providers/alibaba-speech.js";
13
13
  import { resolveSpeechProviderChain } from "../tts/factory.js";
14
14
  import { mergeTtsConfigFromAppConfig } from "../tts/merge-config.js";
15
15
  import { verifyDeviceConnectionProof } from "../../gateway/security/device-request-proof.js";
16
+ import { voiceConversationInstructions } from "./conversation-context.js";
16
17
  import { createPreauthConnectionBudget } from "../../gateway/security/preauth-connection-budget.js";
17
18
  import { claimOpeningGreeting, finishOpeningGreeting, openingGreetingText } from "./opening-greeting.js";
18
19
  import { createAgentVoiceEngine } from "./agentEngine.js";
19
- import { voiceConversationInstructions } from "./conversation-context.js";
20
20
  import { resolveOmniRoute } from "./omniRoute.js";
21
21
  import { createOmniVoiceEngine } from "./omniEngine.js";
22
22
  import { applyVoiceOutputGain } from "./pcm-output-gain.js";
@@ -1,13 +1,13 @@
1
1
  import { createWorkDiscoveryRun, getProjectUnderstandingRun, getWorkDiscoveryOnboardingState, getWorkDiscoveryRun, getWorkDiscoveryRunByIdempotencyKey, listPendingProjectUnderstandingRuns, setWorkDiscoveryFeedback, setWorkDiscoveryOnboardingState, updateWorkDiscoveryRun } from "./repository.js";
2
2
  import { analyzeUnderstandingSources, analyzeWorkContext, workDiscoveryResultMarkdown } from "./analyzer.js";
3
3
  import { discoverWorkCandidates, resolvePersonalWorkRoots } from "./candidate-discovery.js";
4
- import { evaluateQuickUnderstandingCase, evaluateWorkUnderstandingCase, meetsQuickUnderstandingGate } from "./evaluation.js";
5
4
  import { workDiscoveryFingerprintsEqual } from "./incremental.js";
6
5
  import { findActiveWorkDiscoverySourceRefresh, listWorkDiscoverySourceRefreshes, recordWorkDiscoverySourceRefresh, updateWorkDiscoverySourceRefreshForRun } from "./incremental-repository.js";
7
- import { WORK_DISCOVERY_SCAN_POLICY_VERSION, canonicalWorkDiscoveryRoot, previewWorkDiscoveryRoot, probeWorkDiscoveryRoot, readWorkDiscoveryTextExcerpt, searchWorkDiscoveryText, summarizeWorkContextSnapshot } from "./probe.js";
8
6
  import { appendWorkUnderstandingEvidence, createWorkUnderstandingInvestigation, getWorkUnderstandingInvestigation, getWorkUnderstandingInvestigationForRun, listWorkUnderstandingEvidence, resetWorkUnderstandingInvestigation, updateWorkUnderstandingEvidenceObservation, updateWorkUnderstandingInvestigation } from "./investigation-repository.js";
7
+ import { WORK_DISCOVERY_SCAN_POLICY_VERSION, canonicalWorkDiscoveryRoot, previewWorkDiscoveryRoot, probeWorkDiscoveryRoot, readWorkDiscoveryTextExcerpt, searchWorkDiscoveryText, summarizeWorkContextSnapshot } from "./probe.js";
9
8
  import { DEFAULT_WORK_INVESTIGATION_BUDGET, investigateWorkContext } from "./investigator.js";
10
9
  import { persistWorkThreadsFromDiscovery } from "./thread-service.js";
11
10
  import { getWorkDiscoveryDirectorySource, listWorkDiscoveryDirectorySources, revokeWorkDiscoveryDirectorySource, upsertWorkDiscoveryDirectorySource } from "./source-repository.js";
12
11
  import { WorkDiscoveryService, normalizeUnderstandingSourceItems } from "./service.js";
12
+ import { evaluateQuickUnderstandingCase, evaluateWorkUnderstandingCase, meetsQuickUnderstandingGate } from "./evaluation.js";
13
13
  export { DEFAULT_WORK_INVESTIGATION_BUDGET, WORK_DISCOVERY_SCAN_POLICY_VERSION, WorkDiscoveryService, analyzeUnderstandingSources, analyzeWorkContext, appendWorkUnderstandingEvidence, canonicalWorkDiscoveryRoot, createWorkDiscoveryRun, createWorkUnderstandingInvestigation, discoverWorkCandidates, evaluateQuickUnderstandingCase, evaluateWorkUnderstandingCase, findActiveWorkDiscoverySourceRefresh, getProjectUnderstandingRun, getWorkDiscoveryDirectorySource, getWorkDiscoveryOnboardingState, getWorkDiscoveryRun, getWorkDiscoveryRunByIdempotencyKey, getWorkUnderstandingInvestigation, getWorkUnderstandingInvestigationForRun, investigateWorkContext, listPendingProjectUnderstandingRuns, listWorkDiscoveryDirectorySources, listWorkDiscoverySourceRefreshes, listWorkUnderstandingEvidence, meetsQuickUnderstandingGate, normalizeUnderstandingSourceItems, persistWorkThreadsFromDiscovery, previewWorkDiscoveryRoot, probeWorkDiscoveryRoot, readWorkDiscoveryTextExcerpt, recordWorkDiscoverySourceRefresh, resetWorkUnderstandingInvestigation, resolvePersonalWorkRoots, revokeWorkDiscoveryDirectorySource, searchWorkDiscoveryText, setWorkDiscoveryFeedback, setWorkDiscoveryOnboardingState, summarizeWorkContextSnapshot, updateWorkDiscoveryRun, updateWorkDiscoverySourceRefreshForRun, updateWorkUnderstandingEvidenceObservation, updateWorkUnderstandingInvestigation, upsertWorkDiscoveryDirectorySource, workDiscoveryFingerprintsEqual, workDiscoveryResultMarkdown };
@@ -3,8 +3,8 @@ import { init_logger } from "../utils/logger.js";
3
3
  import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
4
4
  import { init_providers, resolveModel } from "../providers/index.js";
5
5
  import { completeWithResolvedCredentials } from "../providers/model-call.js";
6
- import { readWorkDiscoveryTextExcerpt, searchWorkDiscoveryText } from "./probe.js";
7
6
  import { appendWorkUnderstandingEvidence, createWorkUnderstandingInvestigation, getWorkUnderstandingInvestigationForRun, resetWorkUnderstandingInvestigation, updateWorkUnderstandingEvidenceObservation, updateWorkUnderstandingInvestigation } from "./investigation-repository.js";
7
+ import { readWorkDiscoveryTextExcerpt, searchWorkDiscoveryText } from "./probe.js";
8
8
  import { createHash } from "node:crypto";
9
9
  //#region src/work-discovery/investigator.ts
10
10
  init_schema();
@@ -20,13 +20,13 @@ import { createWorkDiscoveryRun, getProjectUnderstandingRun, getWorkDiscoveryOnb
20
20
  import { createUnderstandingSourceRun, getUnderstandingSourceGrant, getUnderstandingSourceRun, updateUnderstandingSourceGrantCheckpoint, updateUnderstandingSourceGrantPolicies, updateUnderstandingSourceRun, upsertUnderstandingSourceGrant } from "../user-context/sources/repository.js";
21
21
  import { allowsRemoteSourceProcessing } from "../user-context/sources/processing-policy.js";
22
22
  import { analyzeUnderstandingSources, analyzeWorkContext, workDiscoveryResultMarkdown } from "./analyzer.js";
23
+ import { clusterActivityTopics } from "../user-context/sources/activity-clustering.js";
24
+ import { isLocalUnderstandingSourceId } from "../user-context/sources/local-source-contract.js";
23
25
  import { discoverWorkCandidates } from "./candidate-discovery.js";
24
26
  import { workDiscoveryFingerprintsEqual } from "./incremental.js";
25
27
  import { findActiveWorkDiscoverySourceRefresh, recordWorkDiscoverySourceRefresh, updateWorkDiscoverySourceRefreshForRun } from "./incremental-repository.js";
26
- import { previewWorkDiscoveryRoot, probeWorkDiscoveryRoot, summarizeWorkContextSnapshot } from "./probe.js";
27
- import { clusterActivityTopics } from "../user-context/sources/activity-clustering.js";
28
- import { isLocalUnderstandingSourceId } from "../user-context/sources/local-source-contract.js";
29
28
  import { appendWorkUnderstandingEvidence, getWorkUnderstandingInvestigationForRun, listWorkUnderstandingEvidence } from "./investigation-repository.js";
29
+ import { previewWorkDiscoveryRoot, probeWorkDiscoveryRoot, summarizeWorkContextSnapshot } from "./probe.js";
30
30
  import { investigateWorkContext } from "./investigator.js";
31
31
  import { persistWorkThreadsFromDiscovery } from "./thread-service.js";
32
32
  import { saveProjectUnderstandingOverview } from "./project-understanding.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xopcai/xopc",
3
- "version": "0.0.442",
3
+ "version": "0.0.444",
4
4
  "description": "An open-source AI assistant for work and everyday life. Remembers context and helps you get things done. Local-first, on a computer you choose.",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",
@@ -171,8 +171,8 @@
171
171
  "vue": "^3.5.44",
172
172
  "xlsx": "file:web/vendor/xlsx-0.20.3.tgz",
173
173
  "@xopcai/browser-control-contract": "0.1.0",
174
- "@xopcai/endpoint-tools-client": "0.0.0",
175
174
  "@xopcai/computer-control-contract": "0.1.0",
175
+ "@xopcai/endpoint-tools-client": "0.0.0",
176
176
  "@xopcai/endpoint-tools-protocol": "0.0.0",
177
177
  "@xopcai/gateway-contract": "0.0.0",
178
178
  "@xopcai/image-providers": "0.1.0",