@xopcai/xopc 0.0.199 → 0.0.201

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 (152) 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/{activity-store-DYVN1hRp.js → activity-store-DOhnAQOQ.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Bt70bZjv.js → agent-avatar-dicebear-D8Cw0Mve.js} +1 -1
  5. package/dist/gateway/static/root/assets/agents-ANavi648.js +68 -0
  6. package/dist/gateway/static/root/assets/{api-B8mzbAle.js → api-E9Bk-Idp.js} +1 -1
  7. package/dist/gateway/static/root/assets/{app-management-settings-panel-B4x7JfL8.js → app-management-settings-panel-BubrReXg.js} +1 -1
  8. package/dist/gateway/static/root/assets/{appearance-settings-Dwdagf-Q.js → appearance-settings-BY5Az2p4.js} +1 -1
  9. package/dist/gateway/static/root/assets/{apps-page-DkTiesxe.js → apps-page-CFh9MBxc.js} +1 -1
  10. package/dist/gateway/static/root/assets/{archive-plugin-Cv0VXKLm.js → archive-plugin-BY8843mB.js} +1 -1
  11. package/dist/gateway/static/root/assets/{attachment-load-CgidKrXn.js → attachment-load-DG45KScf.js} +1 -1
  12. package/dist/gateway/static/root/assets/automations-page-751CeNI3.js +6 -0
  13. package/dist/gateway/static/root/assets/{binary-plugins-DN3CQgIq.js → binary-plugins-DGIF2ZAv.js} +1 -1
  14. package/dist/gateway/static/root/assets/{block-editor-BwkSl1F_.js → block-editor-C1Qktr1g.js} +5 -5
  15. package/dist/gateway/static/root/assets/browser-settings-page-CGAWs-TT.js +8 -0
  16. package/dist/gateway/static/root/assets/{browser-workflow-inputs-_ndaecsf.js → browser-workflow-inputs-D_jnndyz.js} +1 -1
  17. package/dist/gateway/static/root/assets/{browser-workflows-page-C_I31wLm.js → browser-workflows-page-DyIRvPaq.js} +2 -2
  18. package/dist/gateway/static/root/assets/capabilities-settings-panel-CghUK68J.js +7 -0
  19. package/dist/gateway/static/root/assets/{capability-presets-api-Dy1jZJKs.js → capability-presets-api--tz0mGLY.js} +1 -1
  20. package/dist/gateway/static/root/assets/capability-presets-settings-panel-XsTfkvUn.js +3 -0
  21. package/dist/gateway/static/root/assets/{channel-recipient-api-D-9qiuio.js → channel-recipient-api-CkOKF9nc.js} +1 -1
  22. package/dist/gateway/static/root/assets/{channels-settings-DV5BhAeu.js → channels-settings-DkoAZZMe.js} +1 -1
  23. package/dist/gateway/static/root/assets/channels-status-swr-DNDvMWpl.js +1 -0
  24. package/dist/gateway/static/root/assets/{connectors-api-5FEBYguL.js → connectors-api-FBOe9SWC.js} +1 -1
  25. package/dist/gateway/static/root/assets/connectors-page-e4vekkAu.js +2 -0
  26. package/dist/gateway/static/root/assets/{cron-expression-SEFx5rnr.js → cron-expression-Q4QaYjpI.js} +1 -1
  27. package/dist/gateway/static/root/assets/{date-picker-D4zCUQJL.js → date-picker-Dtn7e6TW.js} +1 -1
  28. package/dist/gateway/static/root/assets/{dependency-picker-DpQAxS2k.js → dependency-picker-Br6nPaM6.js} +1 -1
  29. package/dist/gateway/static/root/assets/{desktop-pet-B_5G3lQl.js → desktop-pet-DzTM6aH8.js} +1 -1
  30. package/dist/gateway/static/root/assets/{desktop-pet-settings-ClEyoUJe.js → desktop-pet-settings-FDmaty3P.js} +1 -1
  31. package/dist/gateway/static/root/assets/{directory-picker-path-field-AsFWmOjG.js → directory-picker-path-field-X2e8xn8j.js} +1 -1
  32. package/dist/gateway/static/root/assets/{extension-debug-page-C22Y2o5l.js → extension-debug-page-Dx4MBfga.js} +1 -1
  33. package/dist/gateway/static/root/assets/{extension-page-C61Ikawk.js → extension-page-Bf_FEDhM.js} +1 -1
  34. package/dist/gateway/static/root/assets/{extension-settings-page-WlWWcDFr.js → extension-settings-page-CrOgZxkf.js} +1 -1
  35. package/dist/gateway/static/root/assets/{gateway-config-api-ByIOMQdc.js → gateway-config-api-CZ4r-7qT.js} +1 -1
  36. package/dist/gateway/static/root/assets/{gateway-config-swr-jB0hAhWO.js → gateway-config-swr-Cv2ywpdb.js} +1 -1
  37. package/dist/gateway/static/root/assets/{gateway-settings-CzzS9A17.js → gateway-settings-DpWmVi0w.js} +1 -1
  38. package/dist/gateway/static/root/assets/{gateway-startup-retry-C-fRlHCL.js → gateway-startup-retry-undf-k5g.js} +1 -1
  39. package/dist/gateway/static/root/assets/heartbeat-settings-DSQZhSvT.js +1 -0
  40. package/dist/gateway/static/root/assets/home-page-L0uHiu0T.js +3 -0
  41. package/dist/gateway/static/root/assets/{index-CR233S0Q.css → index-Bp8I_eX4.css} +1 -1
  42. package/dist/gateway/static/root/assets/index-DRrjYYzZ.js +152 -0
  43. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BD_TFz0_.js → keyboard-shortcuts-settings-Bc3Quw42.js} +1 -1
  44. package/dist/gateway/static/root/assets/local-app-workbench-page-Copi3sdP.js +2 -0
  45. package/dist/gateway/static/root/assets/{local-apps-page-BwbUeLfm.js → local-apps-page-CP9X_vtz.js} +1 -1
  46. package/dist/gateway/static/root/assets/{locale-store-xULEcFVs.js → locale-store-CnamlR07.js} +1 -1
  47. package/dist/gateway/static/root/assets/logs-page-DMKq6e29.js +2 -0
  48. package/dist/gateway/static/root/assets/{management-settings-CW2VpqtT.js → management-settings-CJmcaVje.js} +1 -1
  49. package/dist/gateway/static/root/assets/{markdown-split-B1M9KO16.js → markdown-split-AcuFp0TH.js} +1 -1
  50. package/dist/gateway/static/root/assets/{media-plugins-B_QlNdqZ.js → media-plugins-BvFgsiJL.js} +1 -1
  51. package/dist/gateway/static/root/assets/messages-D7kOD_o_.js +3 -0
  52. package/dist/gateway/static/root/assets/{notes-page-BTbD4GmH.js → notes-page-IW7IQ9nJ.js} +1 -1
  53. package/dist/gateway/static/root/assets/notes-workbench-Zb8U0anO.js +4 -0
  54. package/dist/gateway/static/root/assets/{preview-open-alternatives-CeqtArlZ.js → preview-open-alternatives-C-b34dgQ.js} +1 -1
  55. package/dist/gateway/static/root/assets/{product-open-page-DnalBZZs.js → product-open-page-CWEzLykF.js} +1 -1
  56. package/dist/gateway/static/root/assets/project-detail-page-BuIbLnan.js +1 -0
  57. package/dist/gateway/static/root/assets/projects-page-BwUfRqNV.js +1 -0
  58. package/dist/gateway/static/root/assets/remote-access-hub-BTaXxcEi.js +1 -0
  59. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-cGkBEfg4.js → runtime-tools-settings-panel-DAohEZrX.js} +2 -2
  60. package/dist/gateway/static/root/assets/{schema-form-CmsrLlxu.js → schema-form-C_OBW8A5.js} +1 -1
  61. package/dist/gateway/static/root/assets/sessions-page-BnHoTCD3.js +1 -0
  62. package/dist/gateway/static/root/assets/settings-advanced-gate-BTB_fxjt.js +1 -0
  63. package/dist/gateway/static/root/assets/{settings-form-section-DUWCbaMJ.js → settings-form-section-C7w2WS-A.js} +1 -1
  64. package/dist/gateway/static/root/assets/{settings-loading-skeleton-Bvy5rdMY.js → settings-loading-skeleton-zwibve4m.js} +1 -1
  65. package/dist/gateway/static/root/assets/{settings-page-cZSAwsRR.js → settings-page-B9W03dSW.js} +1 -1
  66. package/dist/gateway/static/root/assets/setup-status-panel-C8Hec2Af.js +1 -0
  67. package/dist/gateway/static/root/assets/{share-preview-page-BzA2NCAH.js → share-preview-page-6e3ks2be.js} +1 -1
  68. package/dist/gateway/static/root/assets/shares-settings-Bwc5HfLI.js +1 -0
  69. package/dist/gateway/static/root/assets/skill-reload-api-D7kunhqy.js +1 -0
  70. package/dist/gateway/static/root/assets/{skills-page-Bvde7_i5.js → skills-page-WgkaNzpc.js} +1 -1
  71. package/dist/gateway/static/root/assets/{skills-page.utils-vXSqHR7g.js → skills-page.utils-D9QT5cxj.js} +1 -1
  72. package/dist/gateway/static/root/assets/{system-settings-panel-9cQGOGCK.js → system-settings-panel-c1HVtv1Y.js} +1 -1
  73. package/dist/gateway/static/root/assets/task-detail-page-CjP-6WVU.js +1 -0
  74. package/dist/gateway/static/root/assets/{theme-store-CHQRiuCF.js → theme-store-BDyUTObE.js} +1 -1
  75. package/dist/gateway/static/root/assets/{use-autosave-7XfKULPI.js → use-autosave-D6UkH_Ga.js} +1 -1
  76. package/dist/gateway/static/root/assets/{user-context-page-CZ9m9aC_.js → user-context-page-D8ZhPDNF.js} +1 -1
  77. package/dist/gateway/static/root/assets/{voice-api-key-field-DXr21v-3.js → voice-api-key-field-BOxkKbGh.js} +1 -1
  78. package/dist/gateway/static/root/assets/{work-discovery-overlay-CeG7g_DZ.js → work-discovery-overlay-Dd19yK9t.js} +1 -1
  79. package/dist/gateway/static/root/assets/work-discovery-page-DUkdJl1e.js +1 -0
  80. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DSQQZP9T.js → workflow-run-setup-panel-ZA3bP65I.js} +2 -2
  81. package/dist/gateway/static/root/assets/workflows-page-C2b5W5bw.js +5 -0
  82. package/dist/gateway/static/root/assets/{working-directory-picker-modal-D-IgcHPp.js → working-directory-picker-modal-BcyiDXU3.js} +1 -1
  83. package/dist/gateway/static/root/index.html +9 -9
  84. package/dist/package.js +1 -1
  85. package/dist/packages/gateway-contract/src/tasks.js +51 -9
  86. package/dist/src/agent/context/execution-scope.js +3 -1
  87. package/dist/src/agent/tasks/task-judge-service.d.ts +1 -1
  88. package/dist/src/agent/tasks/task-judge-service.js +3 -2
  89. package/dist/src/agent/tools/xopc-use-tool.js +13 -3
  90. package/dist/src/auth/oauth/types.d.ts +2 -0
  91. package/dist/src/auth/oauth/xopc-cloud.js +24 -2
  92. package/dist/src/automations/domain/validation.d.ts +0 -12
  93. package/dist/src/automations/draft/automation-draft-validator.d.ts +0 -3
  94. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  95. package/dist/src/gateway/hono/app.js +1 -1
  96. package/dist/src/gateway/hono/oauth-async.js +2 -0
  97. package/dist/src/gateway/hono/routes/agent-stream.js +2 -74
  98. package/dist/src/gateway/hono/routes/session-input-handler.d.ts +62 -0
  99. package/dist/src/gateway/hono/routes/session-input-handler.js +82 -0
  100. package/dist/src/gateway/hono/routes/tasks.js +161 -2
  101. package/dist/src/gateway/service/task-conversation-query-service.d.ts +58 -0
  102. package/dist/src/gateway/service/task-conversation-query-service.js +84 -0
  103. package/dist/src/gateway/service.d.ts +10 -0
  104. package/dist/src/gateway/service.js +75 -42
  105. package/dist/src/projects/project-agent.js +1 -1
  106. package/dist/src/storage/sqlite/migrations/120_task_conversation.sql +112 -0
  107. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  108. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  109. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  110. package/dist/src/storage/sqlite/schema.js +1 -1
  111. package/dist/src/tasks/execution-context.js +8 -4
  112. package/dist/src/tasks/index.d.ts +2 -0
  113. package/dist/src/tasks/index.js +3 -1
  114. package/dist/src/tasks/task-application-service.js +10 -17
  115. package/dist/src/tasks/task-context-assembler.js +9 -4
  116. package/dist/src/tasks/task-context-repository.d.ts +0 -6
  117. package/dist/src/tasks/task-context-repository.js +0 -4
  118. package/dist/src/tasks/task-conversation-repository.d.ts +71 -0
  119. package/dist/src/tasks/task-conversation-repository.js +194 -0
  120. package/dist/src/tasks/task-handoff-service.d.ts +31 -0
  121. package/dist/src/tasks/task-handoff-service.js +143 -0
  122. package/dist/src/tasks/task-read-model-projector.js +1 -5
  123. package/dist/src/tasks/task-repository.d.ts +0 -2
  124. package/dist/src/tasks/task-repository.js +2 -9
  125. package/dist/src/tasks/task-run-coordinator.js +3 -1
  126. package/dist/src/workflows/service/workflow-run-service.js +4 -2
  127. package/package.json +2 -2
  128. package/dist/gateway/static/root/assets/agents-D19uNmJf.js +0 -68
  129. package/dist/gateway/static/root/assets/automations-page-BR6qMOVr.js +0 -6
  130. package/dist/gateway/static/root/assets/browser-settings-page-CDFQWAxI.js +0 -8
  131. package/dist/gateway/static/root/assets/capabilities-settings-panel-D41mssOq.js +0 -7
  132. package/dist/gateway/static/root/assets/capability-presets-settings-panel-BXgCyuu2.js +0 -3
  133. package/dist/gateway/static/root/assets/channels-status-swr-B4Rbh3bM.js +0 -1
  134. package/dist/gateway/static/root/assets/connectors-page-C_qkEN0T.js +0 -2
  135. package/dist/gateway/static/root/assets/heartbeat-settings-B4A_CXUL.js +0 -1
  136. package/dist/gateway/static/root/assets/home-page-FVGYYPWo.js +0 -3
  137. package/dist/gateway/static/root/assets/index-CGbKTCST.js +0 -152
  138. package/dist/gateway/static/root/assets/local-app-workbench-page-BNpkigNb.js +0 -2
  139. package/dist/gateway/static/root/assets/logs-page-DXP9OQQt.js +0 -2
  140. package/dist/gateway/static/root/assets/messages-3qRsLZuX.js +0 -3
  141. package/dist/gateway/static/root/assets/notes-workbench-JRiq7QDW.js +0 -4
  142. package/dist/gateway/static/root/assets/project-detail-page-CjWA13aE.js +0 -1
  143. package/dist/gateway/static/root/assets/projects-page-jsCkScbG.js +0 -1
  144. package/dist/gateway/static/root/assets/remote-access-hub-CGPJTEkM.js +0 -1
  145. package/dist/gateway/static/root/assets/sessions-page-BBHzziMd.js +0 -1
  146. package/dist/gateway/static/root/assets/settings-advanced-gate-2cGg8-9h.js +0 -1
  147. package/dist/gateway/static/root/assets/setup-status-panel-Cf06b66-.js +0 -1
  148. package/dist/gateway/static/root/assets/shares-settings-xlNKydYY.js +0 -1
  149. package/dist/gateway/static/root/assets/skill-reload-api-C5Xu93c_.js +0 -1
  150. package/dist/gateway/static/root/assets/task-detail-page-Bkno4tTe.js +0 -1
  151. package/dist/gateway/static/root/assets/work-discovery-page-CQWZD03N.js +0 -1
  152. package/dist/gateway/static/root/assets/workflows-page-Cs-MXFJ1.js +0 -5
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./createLucideIcon-DPHK1VkS.js";import{t as i}from"./loader-circle-CifKLtgG.js";import{t as a}from"./cn-JdwAhgNB.js";import{t as o}from"./button-CSEbl4zT.js";import{s}from"./form-field-width-DJw_jULe.js";import{n as c}from"./interaction-BmQogeqz.js";import{r as l,s as u}from"./locale-store-xULEcFVs.js";import{a as d,i as f,o as p,r as m,s as h,t as g}from"./dist-BPoKqzeH.js";import{r as _}from"./settings-form-draft-Dy10ldo8.js";var v=r(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),y=r(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),b=e(t(),1),x=`xopc.recentWorkspaceDirs.v1`,S=10;function C(){try{let e=localStorage.getItem(x);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`&&e.trim().length>0):[]}catch{return[]}}function w(e){let t=e.trim();if(t)try{let e=[t,...C().filter(e=>e!==t)].slice(0,S);localStorage.setItem(x,JSON.stringify(e))}catch{}}function T(e){let t=e.trim().replace(/[/\\]+$/,``);if(!t)return e;let n=t.split(/[/\\]/);return n[n.length-1]||t}async function E(e){let t=typeof window<`u`?window.electronAPI?.file?.openDirectory:void 0;if(!t)return null;let n=e?.trim();return n?t({defaultPath:n}):t()}function D(e={}){let{initialPath:t,onPicked:n,trackRecent:r=!0}=e,[i,a]=(0,b.useState)(!1),[o,s]=(0,b.useState)(!1),c=typeof window<`u`&&!!window.electronAPI?.file?.openDirectory,l=(0,b.useCallback)(async e=>{let t=e.trim();t&&(r&&w(t),await n?.(t))},[n,r]);return{hasNativePicker:c,modalOpen:i,setModalOpen:a,pick:(0,b.useCallback)(()=>{if(c){(async()=>{s(!0);try{let e=await E(t);e&&await l(e)}finally{s(!1)}})();return}a(!0)},[l,c,t]),confirmPick:l,picking:o}}async function O(e){let t=new URLSearchParams;e!=null&&e!==``&&t.set(`path`,e);let n=t.toString();return(await u(l(`/api/host/fs/list${n?`?${n}`:``}`))).payload}async function k(){return(await u(l(`/api/host/fs/meta`))).payload}var A=n();function j(){return a(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 font-mono text-sm text-fg`,`placeholder:text-fg-subtle`,s,`dark:border-edge`)}function M(e){return/^[A-Za-z]:\\?$/.test(e.replace(/\\$/,`\\`))}function N(e){return!e||e.currentPath===``?!1:e.parentPath===null?e.currentPath===`/`?!1:!!M(e.currentPath):!0}var P={metaHostname:null,listState:null,listLoading:!1,listError:null,manualPath:``};function F({open:e,onOpenChange:t,initialAbsolutePath:n,onConfirm:r,wd:s}){let l=(0,b.useId)(),[u,x]=(0,b.useReducer)(_,P),{metaHostname:S,listState:C,listLoading:w,listError:T,manualPath:E}=u,D=(0,b.useCallback)(async e=>{x({type:`patch`,patch:{listLoading:!0,listError:null}});try{x({type:`patch`,patch:{listState:await O(e)}})}catch(e){x({type:`patch`,patch:{listError:e instanceof Error?e.message:String(e),listState:null}})}finally{x({type:`patch`,patch:{listLoading:!1}})}},[]);(0,b.useEffect)(()=>{if(!e)return;let t=!1;return(async()=>{try{let e=await k();t||x({type:`patch`,patch:{metaHostname:e.hostname}})}catch{t||x({type:`patch`,patch:{metaHostname:null}})}})(),()=>{t=!0}},[e]),(0,b.useEffect)(()=>{if(!e)return;let t=n?.trim()??``;x({type:`patch`,patch:{manualPath:t}});let r=!1;return(async()=>{x({type:`patch`,patch:{listLoading:!0,listError:null}});try{if(t)try{let e=await O(t);r||x({type:`patch`,patch:{listState:e}})}catch{let e=await O();r||x({type:`patch`,patch:{listState:e}})}else{let e=await O();r||x({type:`patch`,patch:{listState:e}})}}catch(e){let t=e instanceof Error?e.message:String(e);r||x({type:`patch`,patch:{listError:t,listState:null}})}finally{r||x({type:`patch`,patch:{listLoading:!1}})}})(),()=>{r=!0}},[e,n]);let F=e=>{e.isDirectory&&D(e.absolutePath)},I=()=>{if(!C)return;let{parentPath:e,currentPath:t}=C;if(e!==null){D(e);return}t===`/`||t===``||M(t)&&D(void 0)},L=C?.currentPath===``?s.pickerDrives:C?.currentPath??``,R=!!C&&C.currentPath!==``&&!w&&!T,z=async()=>{if(!(!C||C.currentPath===``))try{await r(C.currentPath),t(!1)}catch{}},B=async()=>{let e=E.trim();if(e)try{await r(e),t(!1)}catch{}},V=w&&C;return(0,A.jsx)(g,{open:e,onOpenChange:t,children:(0,A.jsxs)(p,{children:[(0,A.jsx)(d,{className:`fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,A.jsxs)(m,{className:a(`fixed left-1/2 top-1/2 z-[101] flex max-h-[min(90vh,32rem)] w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2 flex-col rounded-xl border border-edge bg-surface-panel p-4 shadow-popover`,`dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,A.jsx)(h,{className:`text-base font-semibold text-fg`,children:s.pathModalTitle}),(0,A.jsx)(f,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:s.pathModalDescription}),S?(0,A.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:s.pickerHostHint.replace(`{{hostname}}`,S)}):null,(0,A.jsxs)(`div`,{className:`mt-3 flex min-h-0 flex-1 flex-col gap-2`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,A.jsxs)(o,{type:`button`,variant:`secondary`,className:`shrink-0 gap-1 px-2 py-1.5 text-xs`,disabled:w||!N(C)||!!T,onClick:()=>I(),title:s.pickerUp,children:[(0,A.jsx)(v,{className:`size-4`,"aria-hidden":!0}),s.pickerUp]}),(0,A.jsx)(`div`,{className:`min-w-0 flex-1 truncate rounded-md border border-edge-subtle/80 bg-surface-hover/30 px-2 py-1.5 font-mono text-xs text-fg`,title:L,children:w&&!C?s.pickerLoading:L||`—`})]}),(0,A.jsxs)(`div`,{className:a(`relative min-h-[12rem] overflow-y-auto rounded-lg border border-edge-subtle/80 bg-surface-hover/20 p-1 dark:border-edge-subtle`,c.focusRingPanel),role:`listbox`,"aria-label":s.pathModalTitle,children:[V?(0,A.jsx)(`div`,{className:`absolute inset-0 z-[1] flex items-center justify-center rounded-lg bg-surface-panel/60`,"aria-hidden":!0,children:(0,A.jsx)(i,{className:`size-6 animate-spin text-fg-muted`})}):null,w&&!C?(0,A.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-12 text-sm text-fg-muted`,children:[(0,A.jsx)(i,{className:`size-4 animate-spin`,"aria-hidden":!0}),s.pickerLoading]}):null,T?(0,A.jsx)(`p`,{className:`px-2 py-8 text-center text-sm text-fg-muted`,children:s.pickerListError}):null,!w&&C&&!T&&C.entries.length===0?(0,A.jsx)(`p`,{className:`px-2 py-8 text-center text-sm text-fg-muted`,children:s.pickerEmptyFolder}):null,C?.entries.map(e=>(0,A.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":!1,disabled:!e.isDirectory,className:a(`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm`,e.isDirectory?`cursor-pointer text-fg hover:bg-surface-hover`:`cursor-default text-fg-muted opacity-60`),onClick:()=>F(e),children:[(0,A.jsx)(y,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,A.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name})]},e.absolutePath))]}),(0,A.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,A.jsx)(`label`,{htmlFor:l,className:`text-xs text-fg-muted`,children:s.pickerManualPath}),(0,A.jsx)(`input`,{id:l,type:`text`,value:E,onChange:e=>x({type:`patch`,patch:{manualPath:e.target.value}}),placeholder:s.pathInputPlaceholder,className:j(),autoComplete:`off`,spellCheck:!1,onKeyDown:e=>{e.key===`Enter`&&E.trim()&&(e.preventDefault(),B())}})]})]}),(0,A.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-end gap-2 border-t border-edge-subtle/60 pt-3`,children:[(0,A.jsx)(o,{type:`button`,variant:`ghost`,onClick:()=>t(!1),children:s.pathModalCancel}),(0,A.jsx)(o,{type:`button`,variant:`secondary`,disabled:!E.trim(),onClick:()=>void B(),children:s.pickerApplyManual}),(0,A.jsx)(o,{type:`button`,disabled:!R,onClick:()=>void z(),children:s.pickerUseThisFolder})]})]})]})})}export{v as a,y as i,D as n,T as r,F as t};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./createLucideIcon-DPHK1VkS.js";import{t as i}from"./loader-circle-CifKLtgG.js";import{t as a}from"./cn-JdwAhgNB.js";import{t as o}from"./button-CSEbl4zT.js";import{s}from"./form-field-width-DJw_jULe.js";import{n as c}from"./interaction-BmQogeqz.js";import{r as l,s as u}from"./locale-store-CnamlR07.js";import{a as d,i as f,o as p,r as m,s as h,t as g}from"./dist-BPoKqzeH.js";import{r as _}from"./settings-form-draft-Dy10ldo8.js";var v=r(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),y=r(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),b=e(t(),1),x=`xopc.recentWorkspaceDirs.v1`,S=10;function C(){try{let e=localStorage.getItem(x);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`&&e.trim().length>0):[]}catch{return[]}}function w(e){let t=e.trim();if(t)try{let e=[t,...C().filter(e=>e!==t)].slice(0,S);localStorage.setItem(x,JSON.stringify(e))}catch{}}function T(e){let t=e.trim().replace(/[/\\]+$/,``);if(!t)return e;let n=t.split(/[/\\]/);return n[n.length-1]||t}async function E(e){let t=typeof window<`u`?window.electronAPI?.file?.openDirectory:void 0;if(!t)return null;let n=e?.trim();return n?t({defaultPath:n}):t()}function D(e={}){let{initialPath:t,onPicked:n,trackRecent:r=!0}=e,[i,a]=(0,b.useState)(!1),[o,s]=(0,b.useState)(!1),c=typeof window<`u`&&!!window.electronAPI?.file?.openDirectory,l=(0,b.useCallback)(async e=>{let t=e.trim();t&&(r&&w(t),await n?.(t))},[n,r]);return{hasNativePicker:c,modalOpen:i,setModalOpen:a,pick:(0,b.useCallback)(()=>{if(c){(async()=>{s(!0);try{let e=await E(t);e&&await l(e)}finally{s(!1)}})();return}a(!0)},[l,c,t]),confirmPick:l,picking:o}}async function O(e){let t=new URLSearchParams;e!=null&&e!==``&&t.set(`path`,e);let n=t.toString();return(await u(l(`/api/host/fs/list${n?`?${n}`:``}`))).payload}async function k(){return(await u(l(`/api/host/fs/meta`))).payload}var A=n();function j(){return a(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 font-mono text-sm text-fg`,`placeholder:text-fg-subtle`,s,`dark:border-edge`)}function M(e){return/^[A-Za-z]:\\?$/.test(e.replace(/\\$/,`\\`))}function N(e){return!e||e.currentPath===``?!1:e.parentPath===null?e.currentPath===`/`?!1:!!M(e.currentPath):!0}var P={metaHostname:null,listState:null,listLoading:!1,listError:null,manualPath:``};function F({open:e,onOpenChange:t,initialAbsolutePath:n,onConfirm:r,wd:s}){let l=(0,b.useId)(),[u,x]=(0,b.useReducer)(_,P),{metaHostname:S,listState:C,listLoading:w,listError:T,manualPath:E}=u,D=(0,b.useCallback)(async e=>{x({type:`patch`,patch:{listLoading:!0,listError:null}});try{x({type:`patch`,patch:{listState:await O(e)}})}catch(e){x({type:`patch`,patch:{listError:e instanceof Error?e.message:String(e),listState:null}})}finally{x({type:`patch`,patch:{listLoading:!1}})}},[]);(0,b.useEffect)(()=>{if(!e)return;let t=!1;return(async()=>{try{let e=await k();t||x({type:`patch`,patch:{metaHostname:e.hostname}})}catch{t||x({type:`patch`,patch:{metaHostname:null}})}})(),()=>{t=!0}},[e]),(0,b.useEffect)(()=>{if(!e)return;let t=n?.trim()??``;x({type:`patch`,patch:{manualPath:t}});let r=!1;return(async()=>{x({type:`patch`,patch:{listLoading:!0,listError:null}});try{if(t)try{let e=await O(t);r||x({type:`patch`,patch:{listState:e}})}catch{let e=await O();r||x({type:`patch`,patch:{listState:e}})}else{let e=await O();r||x({type:`patch`,patch:{listState:e}})}}catch(e){let t=e instanceof Error?e.message:String(e);r||x({type:`patch`,patch:{listError:t,listState:null}})}finally{r||x({type:`patch`,patch:{listLoading:!1}})}})(),()=>{r=!0}},[e,n]);let F=e=>{e.isDirectory&&D(e.absolutePath)},I=()=>{if(!C)return;let{parentPath:e,currentPath:t}=C;if(e!==null){D(e);return}t===`/`||t===``||M(t)&&D(void 0)},L=C?.currentPath===``?s.pickerDrives:C?.currentPath??``,R=!!C&&C.currentPath!==``&&!w&&!T,z=async()=>{if(!(!C||C.currentPath===``))try{await r(C.currentPath),t(!1)}catch{}},B=async()=>{let e=E.trim();if(e)try{await r(e),t(!1)}catch{}},V=w&&C;return(0,A.jsx)(g,{open:e,onOpenChange:t,children:(0,A.jsxs)(p,{children:[(0,A.jsx)(d,{className:`fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,A.jsxs)(m,{className:a(`fixed left-1/2 top-1/2 z-[101] flex max-h-[min(90vh,32rem)] w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2 flex-col rounded-xl border border-edge bg-surface-panel p-4 shadow-popover`,`dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,A.jsx)(h,{className:`text-base font-semibold text-fg`,children:s.pathModalTitle}),(0,A.jsx)(f,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:s.pathModalDescription}),S?(0,A.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:s.pickerHostHint.replace(`{{hostname}}`,S)}):null,(0,A.jsxs)(`div`,{className:`mt-3 flex min-h-0 flex-1 flex-col gap-2`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,A.jsxs)(o,{type:`button`,variant:`secondary`,className:`shrink-0 gap-1 px-2 py-1.5 text-xs`,disabled:w||!N(C)||!!T,onClick:()=>I(),title:s.pickerUp,children:[(0,A.jsx)(v,{className:`size-4`,"aria-hidden":!0}),s.pickerUp]}),(0,A.jsx)(`div`,{className:`min-w-0 flex-1 truncate rounded-md border border-edge-subtle/80 bg-surface-hover/30 px-2 py-1.5 font-mono text-xs text-fg`,title:L,children:w&&!C?s.pickerLoading:L||`—`})]}),(0,A.jsxs)(`div`,{className:a(`relative min-h-[12rem] overflow-y-auto rounded-lg border border-edge-subtle/80 bg-surface-hover/20 p-1 dark:border-edge-subtle`,c.focusRingPanel),role:`listbox`,"aria-label":s.pathModalTitle,children:[V?(0,A.jsx)(`div`,{className:`absolute inset-0 z-[1] flex items-center justify-center rounded-lg bg-surface-panel/60`,"aria-hidden":!0,children:(0,A.jsx)(i,{className:`size-6 animate-spin text-fg-muted`})}):null,w&&!C?(0,A.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-12 text-sm text-fg-muted`,children:[(0,A.jsx)(i,{className:`size-4 animate-spin`,"aria-hidden":!0}),s.pickerLoading]}):null,T?(0,A.jsx)(`p`,{className:`px-2 py-8 text-center text-sm text-fg-muted`,children:s.pickerListError}):null,!w&&C&&!T&&C.entries.length===0?(0,A.jsx)(`p`,{className:`px-2 py-8 text-center text-sm text-fg-muted`,children:s.pickerEmptyFolder}):null,C?.entries.map(e=>(0,A.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":!1,disabled:!e.isDirectory,className:a(`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm`,e.isDirectory?`cursor-pointer text-fg hover:bg-surface-hover`:`cursor-default text-fg-muted opacity-60`),onClick:()=>F(e),children:[(0,A.jsx)(y,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,A.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name})]},e.absolutePath))]}),(0,A.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,A.jsx)(`label`,{htmlFor:l,className:`text-xs text-fg-muted`,children:s.pickerManualPath}),(0,A.jsx)(`input`,{id:l,type:`text`,value:E,onChange:e=>x({type:`patch`,patch:{manualPath:e.target.value}}),placeholder:s.pathInputPlaceholder,className:j(),autoComplete:`off`,spellCheck:!1,onKeyDown:e=>{e.key===`Enter`&&E.trim()&&(e.preventDefault(),B())}})]})]}),(0,A.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-end gap-2 border-t border-edge-subtle/60 pt-3`,children:[(0,A.jsx)(o,{type:`button`,variant:`ghost`,onClick:()=>t(!1),children:s.pathModalCancel}),(0,A.jsx)(o,{type:`button`,variant:`secondary`,disabled:!E.trim(),onClick:()=>void B(),children:s.pickerApplyManual}),(0,A.jsx)(o,{type:`button`,disabled:!R,onClick:()=>void z(),children:s.pickerUseThisFolder})]})]})]})})}export{v as a,y as i,D as n,T as r,F as t};
@@ -11,7 +11,7 @@
11
11
  <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png?v=20260713-1" />
12
12
  <link rel="manifest" href="/site.webmanifest?v=20260713-1" />
13
13
  <title>XOPC — Turn goals into loops. Keep what matters moving.</title>
14
- <script type="module" crossorigin src="/assets/index-CGbKTCST.js"></script>
14
+ <script type="module" crossorigin src="/assets/index-DRrjYYzZ.js"></script>
15
15
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-aKtaBQYM.js">
16
16
  <link rel="modulepreload" crossorigin href="/assets/preload-helper-zJ_50EbN.js">
17
17
  <link rel="modulepreload" crossorigin href="/assets/vendor-react-BOUWij0V.js">
@@ -25,14 +25,14 @@
25
25
  <link rel="modulepreload" crossorigin href="/assets/createLucideIcon-DPHK1VkS.js">
26
26
  <link rel="modulepreload" crossorigin href="/assets/check-DUBLcKHA.js">
27
27
  <link rel="modulepreload" crossorigin href="/assets/loader-circle-CifKLtgG.js">
28
- <link rel="modulepreload" crossorigin href="/assets/messages-3qRsLZuX.js">
29
- <link rel="modulepreload" crossorigin href="/assets/locale-store-xULEcFVs.js">
28
+ <link rel="modulepreload" crossorigin href="/assets/messages-D7kOD_o_.js">
29
+ <link rel="modulepreload" crossorigin href="/assets/locale-store-CnamlR07.js">
30
30
  <link rel="modulepreload" crossorigin href="/assets/cn-JdwAhgNB.js">
31
31
  <link rel="modulepreload" crossorigin href="/assets/button-CSEbl4zT.js">
32
32
  <link rel="modulepreload" crossorigin href="/assets/form-field-width-DJw_jULe.js">
33
33
  <link rel="modulepreload" crossorigin href="/assets/interaction-BmQogeqz.js">
34
34
  <link rel="modulepreload" crossorigin href="/assets/settings-form-draft-Dy10ldo8.js">
35
- <link rel="modulepreload" crossorigin href="/assets/working-directory-picker-modal-D-IgcHPp.js">
35
+ <link rel="modulepreload" crossorigin href="/assets/working-directory-picker-modal-BcyiDXU3.js">
36
36
  <link rel="modulepreload" crossorigin href="/assets/settings-shell-dialog-layer-BU3UuiJr.js">
37
37
  <link rel="modulepreload" crossorigin href="/assets/popover-select-BzdnTy3h.js">
38
38
  <link rel="modulepreload" crossorigin href="/assets/copy-Dv6d4Dvw.js">
@@ -43,12 +43,12 @@
43
43
  <link rel="modulepreload" crossorigin href="/assets/product-delivery-tRr-7IxY.js">
44
44
  <link rel="modulepreload" crossorigin href="/assets/tool-activity-R8V9l6nk.js">
45
45
  <link rel="modulepreload" crossorigin href="/assets/config-reload-event-Bjh2zoKp.js">
46
- <link rel="modulepreload" crossorigin href="/assets/gateway-config-swr-jB0hAhWO.js">
46
+ <link rel="modulepreload" crossorigin href="/assets/gateway-config-swr-Cv2ywpdb.js">
47
47
  <link rel="modulepreload" crossorigin href="/assets/copy-to-clipboard-HOJ79TWv.js">
48
- <link rel="modulepreload" crossorigin href="/assets/gateway-startup-retry-C-fRlHCL.js">
49
- <link rel="modulepreload" crossorigin href="/assets/activity-store-DYVN1hRp.js">
50
- <link rel="modulepreload" crossorigin href="/assets/theme-store-CHQRiuCF.js">
51
- <link rel="stylesheet" crossorigin href="/assets/index-CR233S0Q.css">
48
+ <link rel="modulepreload" crossorigin href="/assets/gateway-startup-retry-undf-k5g.js">
49
+ <link rel="modulepreload" crossorigin href="/assets/activity-store-DOhnAQOQ.js">
50
+ <link rel="modulepreload" crossorigin href="/assets/theme-store-BDyUTObE.js">
51
+ <link rel="stylesheet" crossorigin href="/assets/index-Bp8I_eX4.css">
52
52
  </head>
53
53
  <body>
54
54
  <div id="root"></div>
package/dist/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "0.0.199";
2
+ var version = "0.0.201";
3
3
  //#endregion
4
4
  export { version };
@@ -26,7 +26,8 @@ const TaskChangedFieldSchema = z.enum([
26
26
  "context",
27
27
  "runs",
28
28
  "receipts",
29
- "attention"
29
+ "attention",
30
+ "conversation"
30
31
  ]);
31
32
  z.object({
32
33
  taskId: z.string().min(1),
@@ -278,7 +279,7 @@ const TaskCreateRequestSchema = z.object({
278
279
  phase: z.enum(["backlog", "ready"]).default("backlog")
279
280
  }), z.object({
280
281
  mode: z.literal("start"),
281
- executor: TaskExecutorSelectionSchema,
282
+ executor: TaskExecutorSelectionSchema.optional(),
282
283
  scheduleAt: z.number().int().nonnegative().optional()
283
284
  })])
284
285
  }).strict();
@@ -291,8 +292,7 @@ const TaskPatchRequestSchema = z.object({
291
292
  parentTaskId: z.string().trim().min(1).nullable().optional(),
292
293
  priority: TaskPrioritySchema.optional(),
293
294
  dueAt: z.number().int().nonnegative().nullable().optional(),
294
- ownerId: z.string().trim().min(1).nullable().optional(),
295
- delegateAgentId: z.string().trim().min(1).nullable().optional()
295
+ ownerId: z.string().trim().min(1).nullable().optional()
296
296
  }).strict();
297
297
  const TaskWaitInputSchema = z.object({
298
298
  kind: z.enum([
@@ -347,10 +347,6 @@ const TaskCommandSchema = z.discriminatedUnion("type", [
347
347
  waitId: z.string(),
348
348
  resolution: z.unknown().optional()
349
349
  }),
350
- z.object({
351
- type: z.literal("delegate"),
352
- agentId: z.string().optional()
353
- }),
354
350
  z.object({
355
351
  type: z.literal("revise_contract"),
356
352
  contract: TaskContractInputSchema
@@ -383,6 +379,50 @@ z.object({
383
379
  operationalState: TaskOperationalStateSchema,
384
380
  run: TaskRunSchema.optional()
385
381
  });
382
+ const TaskConversationStateSchema = z.object({
383
+ taskId: z.string(),
384
+ activeSessionKey: z.string().optional(),
385
+ currentExecutorAgentId: z.string().optional(),
386
+ assignmentEpoch: z.number().int().nonnegative(),
387
+ status: z.enum(["idle", "active"]),
388
+ updatedAt: z.number().int().nonnegative()
389
+ });
390
+ const TaskSessionLinkSchema = z.object({
391
+ id: z.string(),
392
+ taskId: z.string(),
393
+ sessionKey: z.string(),
394
+ role: z.enum([
395
+ "primary",
396
+ "discussion",
397
+ "execution"
398
+ ]),
399
+ agentId: z.string().optional(),
400
+ runId: z.string().optional(),
401
+ assignmentEpoch: z.number().int().nonnegative(),
402
+ status: z.enum([
403
+ "active",
404
+ "completed",
405
+ "superseded",
406
+ "failed"
407
+ ]),
408
+ startedAt: z.number().int().nonnegative(),
409
+ endedAt: z.number().int().nonnegative().optional(),
410
+ createdAt: z.number().int().nonnegative()
411
+ });
412
+ const TaskHandoffRequestSchema = z.object({
413
+ toAgentId: z.string().trim().min(1),
414
+ expectedVersion: z.number().int().positive(),
415
+ idempotencyKey: z.string().trim().min(1).max(200)
416
+ }).strict();
417
+ z.object({
418
+ ok: z.literal(true),
419
+ task: TaskSchema,
420
+ conversation: TaskConversationStateSchema,
421
+ fromAgentId: z.string().optional(),
422
+ toAgentId: z.string(),
423
+ activeSessionKey: z.string(),
424
+ assignmentEpoch: z.number().int().positive()
425
+ });
386
426
  z.object({
387
427
  ok: z.literal(true),
388
428
  task: TaskSchema,
@@ -392,6 +432,8 @@ z.object({
392
432
  runs: z.array(TaskRunSchema),
393
433
  receipts: z.array(TaskRunReceiptSchema),
394
434
  context: z.array(TaskContextEdgeSchema),
435
+ conversation: TaskConversationStateSchema,
436
+ sessions: z.array(TaskSessionLinkSchema),
395
437
  authorityGrants: z.array(TaskAuthorityGrantSchema),
396
438
  dependencies: z.array(TaskDependencySummarySchema),
397
439
  dependents: z.array(TaskDependencySummarySchema),
@@ -402,4 +444,4 @@ z.object({
402
444
  items: z.array(TaskRunReceiptSchema)
403
445
  });
404
446
  //#endregion
405
- export { TaskBoardPositionRequestSchema, TaskCommandRequestSchema, TaskCommandSchema, TaskContextInputSchema, TaskCreateRequestSchema, TaskDependencyUpdateRequestSchema, TaskExecutorSelectionSchema, TaskPatchRequestSchema };
447
+ export { TaskBoardPositionRequestSchema, TaskCommandRequestSchema, TaskCommandSchema, TaskContextInputSchema, TaskCreateRequestSchema, TaskDependencyUpdateRequestSchema, TaskExecutorSelectionSchema, TaskHandoffRequestSchema, TaskPatchRequestSchema };
@@ -3,6 +3,7 @@ import { getSessionMetadata } from "../../storage/sqlite/session-repository.js";
3
3
  import "../../storage/sqlite/index.js";
4
4
  import { sanitizeForPromptLiteral } from "../prompt/sanitize-for-prompt.js";
5
5
  import { TaskRepository } from "../../tasks/task-repository.js";
6
+ import { TaskConversationRepository } from "../../tasks/task-conversation-repository.js";
6
7
  import { TaskReadModelProjector } from "../../tasks/task-read-model-projector.js";
7
8
  import { buildActiveProjectContextForPrompt } from "./project-context.js";
8
9
  //#region src/agent/context/execution-scope.ts
@@ -14,7 +15,8 @@ function bounded(value, max = MAX_OBJECTIVE_TEXT) {
14
15
  return text.length <= max ? text : `${text.slice(0, max - 1).trimEnd()}…`;
15
16
  }
16
17
  function taskObjective(sessionKey) {
17
- const task = new TaskRepository().getBySession(sessionKey);
18
+ const taskId = new TaskConversationRepository().resolveActiveExecutionSession(sessionKey)?.taskId;
19
+ const task = taskId ? new TaskRepository().get(taskId) : void 0;
18
20
  if (!task) return void 0;
19
21
  const contract = task.contract;
20
22
  return {
@@ -1,6 +1,6 @@
1
+ import type { TaskJudgment } from '@xopcai/gateway-contract';
1
2
  import { type Config } from '../../config/schema.js';
2
3
  import type { SessionStore } from '../../session/store.js';
3
- import type { TaskJudgment } from '@xopcai/gateway-contract';
4
4
  import type { ModelManager } from '../models/index.js';
5
5
  export interface TaskTurnCompletion {
6
6
  sessionKey: string;
@@ -4,6 +4,7 @@ import { getAgentDefaultModelRef, init_schema } from "../../config/schema.js";
4
4
  import { resolveEffectiveAgentProfileForSession } from "../../config/agent-profile.js";
5
5
  import { getApiKey, init_providers, resolveModel } from "../../providers/index.js";
6
6
  import { TaskRepository } from "../../tasks/task-repository.js";
7
+ import { TaskConversationRepository } from "../../tasks/task-conversation-repository.js";
7
8
  import { TaskRunRepository } from "../../tasks/task-run-repository.js";
8
9
  import { completeWithResolvedCredentials } from "../../providers/model-call.js";
9
10
  import { TaskApplicationService } from "../../tasks/task-application-service.js";
@@ -61,13 +62,13 @@ var TaskJudgeService = class {
61
62
  #tasks = new TaskRepository();
62
63
  #runs = new TaskRunRepository();
63
64
  #application = new TaskApplicationService();
65
+ #conversations = new TaskConversationRepository();
64
66
  constructor(options) {
65
67
  this.options = options;
66
68
  }
67
69
  async reviewTurn(payload) {
68
70
  if (payload.skipTaskReview || payload.aborted || payload.streamError) return;
69
- const metadata = await this.options.sessionStore.getMetadata(payload.sessionKey);
70
- const taskId = typeof metadata?.customData?.taskId === "string" ? metadata.customData.taskId.trim() : "";
71
+ const taskId = this.#conversations.resolveActiveExecutionSession(payload.sessionKey)?.taskId;
71
72
  if (!taskId) return;
72
73
  const task = this.#tasks.get(taskId);
73
74
  if (!task?.contract) return;
@@ -4,6 +4,7 @@ import { getSessionMetadata } from "../../storage/sqlite/session-repository.js";
4
4
  import "../../storage/sqlite/index.js";
5
5
  import { ObjectLinkService } from "../../activity/service.js";
6
6
  import "../../activity/index.js";
7
+ import { getDefaultAgentId, init_resolve_route } from "../../routing/resolve-route.js";
7
8
  import { TaskRepository } from "../../tasks/task-repository.js";
8
9
  import { TaskRunRepository } from "../../tasks/task-run-repository.js";
9
10
  import { TaskReadModelProjector } from "../../tasks/task-read-model-projector.js";
@@ -11,7 +12,7 @@ import { TaskCommandSchema, TaskContextInputSchema } from "../../../packages/gat
11
12
  import { appendProductDeliveryText } from "../../../packages/gateway-contract/src/product-delivery.js";
12
13
  import { CreateAutomationSchema, UpdateAutomationSchema } from "../../automations/domain/validation.js";
13
14
  import "../../automations/index.js";
14
- import { isValidProjectAgentId, normalizeProjectAgentId } from "../../projects/project-agent.js";
15
+ import { isValidProjectAgentId, normalizeProjectAgentId, resolveProjectAgentId } from "../../projects/project-agent.js";
15
16
  import "../../projects/index.js";
16
17
  import { TaskContextRepository } from "../../tasks/task-context-repository.js";
17
18
  import { enqueueTaskChangedEvent } from "../../tasks/task-change-events.js";
@@ -22,6 +23,7 @@ import "../../tasks/index.js";
22
23
  import { randomUUID } from "node:crypto";
23
24
  import { Type } from "@sinclair/typebox";
24
25
  //#region src/agent/tools/xopc-use-tool.ts
26
+ init_resolve_route();
25
27
  const XopcUseToolSchema = Type.Object({
26
28
  mode: Type.Union([
27
29
  Type.Literal("project"),
@@ -92,7 +94,6 @@ const TASK_COMMANDS = new Set([
92
94
  "reopen",
93
95
  "add_wait",
94
96
  "resolve_wait",
95
- "delegate",
96
97
  "revise_contract"
97
98
  ]);
98
99
  const TASK_CREATE_MODES = new Set(["capture", "start"]);
@@ -1191,13 +1192,22 @@ async function handleTask(command, args, deps, dryRun) {
1191
1192
  contract[field] = value;
1192
1193
  }
1193
1194
  const sessionKey = trimString(args.sessionKey) ?? deps.getCurrentSessionKey?.();
1194
- const agentId = trimString(args.agentId) ?? deps.getCurrentAgentId?.() ?? "main";
1195
+ const config = deps.getConfig?.();
1196
+ const projectService = deps.getProjectService?.();
1197
+ const explicitAgentId = trimString(args.agentId);
1198
+ const agentId = config && projectService ? resolveProjectAgentId({
1199
+ config,
1200
+ projects: projectService,
1201
+ explicitAgentId,
1202
+ projectId
1203
+ }) : explicitAgentId ?? (config ? getDefaultAgentId(config) : deps.getCurrentAgentId?.() ?? "main");
1195
1204
  const input = {
1196
1205
  idempotencyKey: trimString(args.idempotencyKey) ?? randomUUID(),
1197
1206
  title: trimString(args.title) ?? objective,
1198
1207
  priority: priority ?? "normal",
1199
1208
  ...dueAt === void 0 ? {} : { dueAt },
1200
1209
  ...projectId ? { projectId } : {},
1210
+ delegateAgentId: agentId,
1201
1211
  ...locale ? { locale } : {},
1202
1212
  contract: {
1203
1213
  ...contract,
@@ -41,6 +41,8 @@ export interface OAuthLoginCallbacks {
41
41
  onProgress?: (message: string) => void;
42
42
  onManualCodeInput?: () => Promise<string>;
43
43
  onSelect: (prompt: OAuthSelectPrompt) => Promise<string | undefined>;
44
+ /** Optional app deep link shown after a successful browser callback. */
45
+ returnToAppUrl?: string;
44
46
  signal?: AbortSignal;
45
47
  }
46
48
  export interface OAuthProviderInterface {
@@ -41,9 +41,10 @@ function escapeHtml(value) {
41
41
  "'": "&#39;"
42
42
  })[character] ?? character);
43
43
  }
44
- function callbackHtml(title, message, tone) {
44
+ function callbackHtml(title, message, tone, returnToAppUrl) {
45
45
  const safeTitle = escapeHtml(title);
46
46
  const safeMessage = escapeHtml(message);
47
+ const safeReturnToAppUrl = returnToAppUrl?.startsWith("xopc://") ? escapeHtml(returnToAppUrl) : void 0;
47
48
  return `<!doctype html>
48
49
  <html lang="en">
49
50
  <head>
@@ -134,6 +135,20 @@ function callbackHtml(title, message, tone) {
134
135
  line-height: 1.55;
135
136
  }
136
137
  .window-icon { flex: none; width: 18px; height: 18px; margin-top: 1px; color: var(--accent); fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
138
+ .return-button {
139
+ display: inline-flex;
140
+ align-items: center;
141
+ justify-content: center;
142
+ margin-top: 22px;
143
+ min-height: 42px;
144
+ border-radius: 12px;
145
+ padding: 0 16px;
146
+ background: var(--accent);
147
+ color: #fff;
148
+ font-size: 14px;
149
+ font-weight: 650;
150
+ text-decoration: none;
151
+ }
137
152
  @media (prefers-color-scheme: dark) {
138
153
  :root {
139
154
  --accent-soft: rgba(58, 107, 255, 0.16);
@@ -183,11 +198,18 @@ function callbackHtml(title, message, tone) {
183
198
  </div>
184
199
  <h1>${safeTitle}</h1>
185
200
  <p class="message">${safeMessage}</p>
201
+ ${safeReturnToAppUrl ? `<a id="return-to-xopc" class="return-button" href="${safeReturnToAppUrl}">Open XOPC</a>` : ""}
186
202
  <div class="next-step">
187
203
  <svg class="window-icon" viewBox="0 0 24 24" aria-hidden="true"><rect x="3" y="5" width="18" height="14" rx="2" /><path d="M3 9h18" /></svg>
188
204
  <span>You can safely close this window and return to XOPC.</span>
189
205
  </div>
190
206
  </main>
207
+ ${safeReturnToAppUrl ? `<script>
208
+ window.setTimeout(function () {
209
+ var link = document.getElementById('return-to-xopc');
210
+ if (link) window.location.href = link.href;
211
+ }, 350);
212
+ <\/script>` : ""}
191
213
  </body>
192
214
  </html>`;
193
215
  }
@@ -226,7 +248,7 @@ async function loginWithBrowser(callbacks) {
226
248
  return;
227
249
  }
228
250
  response.statusCode = 200;
229
- response.end(callbackHtml("Authorization complete", "XOPC received the authorization callback successfully.", "success"));
251
+ response.end(callbackHtml("Authorization complete", "XOPC received the authorization callback successfully.", "success", callbacks.returnToAppUrl));
230
252
  settle?.({ code });
231
253
  } catch {
232
254
  const error = /* @__PURE__ */ new Error("XOPC OAuth callback could not be processed");
@@ -133,9 +133,6 @@ export declare const AutomationActionSchema: z.ZodDiscriminatedUnion<[z.ZodObjec
133
133
  type: z.ZodLiteral<"resolve_wait">;
134
134
  waitId: z.ZodString;
135
135
  resolution: z.ZodOptional<z.ZodUnknown>;
136
- }, z.core.$strip>, z.ZodObject<{
137
- type: z.ZodLiteral<"delegate">;
138
- agentId: z.ZodOptional<z.ZodString>;
139
136
  }, z.core.$strip>, z.ZodObject<{
140
137
  type: z.ZodLiteral<"revise_contract">;
141
138
  contract: z.ZodObject<{
@@ -321,9 +318,6 @@ export declare const AutomationSchema: z.ZodObject<{
321
318
  type: z.ZodLiteral<"resolve_wait">;
322
319
  waitId: z.ZodString;
323
320
  resolution: z.ZodOptional<z.ZodUnknown>;
324
- }, z.core.$strip>, z.ZodObject<{
325
- type: z.ZodLiteral<"delegate">;
326
- agentId: z.ZodOptional<z.ZodString>;
327
321
  }, z.core.$strip>, z.ZodObject<{
328
322
  type: z.ZodLiteral<"revise_contract">;
329
323
  contract: z.ZodObject<{
@@ -484,9 +478,6 @@ export declare const CreateAutomationSchema: z.ZodObject<{
484
478
  type: z.ZodLiteral<"resolve_wait">;
485
479
  waitId: z.ZodString;
486
480
  resolution: z.ZodOptional<z.ZodUnknown>;
487
- }, z.core.$strip>, z.ZodObject<{
488
- type: z.ZodLiteral<"delegate">;
489
- agentId: z.ZodOptional<z.ZodString>;
490
481
  }, z.core.$strip>, z.ZodObject<{
491
482
  type: z.ZodLiteral<"revise_contract">;
492
483
  contract: z.ZodObject<{
@@ -674,9 +665,6 @@ export declare const UpdateAutomationSchema: z.ZodObject<{
674
665
  type: z.ZodLiteral<"resolve_wait">;
675
666
  waitId: z.ZodString;
676
667
  resolution: z.ZodOptional<z.ZodUnknown>;
677
- }, z.core.$strip>, z.ZodObject<{
678
- type: z.ZodLiteral<"delegate">;
679
- agentId: z.ZodOptional<z.ZodString>;
680
668
  }, z.core.$strip>, z.ZodObject<{
681
669
  type: z.ZodLiteral<"revise_contract">;
682
670
  contract: z.ZodObject<{
@@ -86,9 +86,6 @@ export declare function buildAutomationDraftResponse(draft: GeneratedAutomationD
86
86
  type: "resolve_wait";
87
87
  waitId: string;
88
88
  resolution?: unknown;
89
- } | {
90
- type: "delegate";
91
- agentId?: string;
92
89
  } | {
93
90
  type: "revise_contract";
94
91
  contract: {
@@ -52,7 +52,7 @@ async function checkDatabaseSchema(ctx) {
52
52
  id: "database-schema",
53
53
  label: "Database schema",
54
54
  status: "pass",
55
- message: `SQLite schema v${status.dbVersion} (current release v119).`,
55
+ message: `SQLite schema v${status.dbVersion} (current release v120).`,
56
56
  hints: []
57
57
  };
58
58
  }
@@ -175,7 +175,7 @@ function createHonoApp(config) {
175
175
  }));
176
176
  app.use("/api/*", async (c, next) => {
177
177
  const contentType = c.req.header("content-type");
178
- const maxSize = c.req.method === "POST" && c.req.path === "/api/tasks" || c.req.method === "POST" && /^\/api\/sessions\/[^/]+\/inputs$/.test(c.req.path) || c.req.method === "PATCH" && /^\/api\/sessions\/[^/]+\/inputs\/[^/]+$/.test(c.req.path) ? SESSION_INPUT_BODY_MAX : c.req.path === "/api/skills/upload" ? SKILL_UPLOAD_BODY_MAX : c.req.path === "/api/voice/transcribe" || c.req.path === "/api/voice/transcriptions" ? VOICE_TRANSCRIBE_BODY_MAX : isNoteMediaUploadRequest(c.req.path, c.req.method, contentType) ? NOTE_MEDIA_BODY_MAX : isProjectFileUploadRequest(c.req.path, c.req.method, contentType) ? NOTE_MEDIA_BODY_MAX : discussionUploadBodyMax(c.req.path, c.req.method, contentType) ?? DEFAULT_API_BODY_MAX;
178
+ const maxSize = c.req.method === "POST" && c.req.path === "/api/tasks" || c.req.method === "POST" && /^\/api\/sessions\/[^/]+\/inputs$/.test(c.req.path) || c.req.method === "POST" && /^\/api\/tasks\/[^/]+\/inputs$/.test(c.req.path) || c.req.method === "PATCH" && /^\/api\/sessions\/[^/]+\/inputs\/[^/]+$/.test(c.req.path) ? SESSION_INPUT_BODY_MAX : c.req.path === "/api/skills/upload" ? SKILL_UPLOAD_BODY_MAX : c.req.path === "/api/voice/transcribe" || c.req.path === "/api/voice/transcriptions" ? VOICE_TRANSCRIBE_BODY_MAX : isNoteMediaUploadRequest(c.req.path, c.req.method, contentType) ? NOTE_MEDIA_BODY_MAX : isProjectFileUploadRequest(c.req.path, c.req.method, contentType) ? NOTE_MEDIA_BODY_MAX : discussionUploadBodyMax(c.req.path, c.req.method, contentType) ?? DEFAULT_API_BODY_MAX;
179
179
  const maxSizeMb = Math.ceil(maxSize / (1024 * 1024));
180
180
  return bodyLimit({
181
181
  maxSize,
@@ -110,6 +110,7 @@ function createOAuthAsyncHandler(service) {
110
110
  const session = {
111
111
  id: sessionId,
112
112
  provider,
113
+ ...body.client === "desktop" && provider === "xopc-cloud" ? { returnToAppUrl: `xopc://cloud/model-connected?request_id=${encodeURIComponent(sessionId)}` } : {},
113
114
  preferredLoginMethod: preferredOAuthLoginMethod({
114
115
  provider,
115
116
  requestedMethod: body.loginMethod,
@@ -283,6 +284,7 @@ async function runOAuthFlow(session, oauthProvider, service) {
283
284
  }, "Selected OAuth auth method");
284
285
  return selectedOption.id;
285
286
  },
287
+ returnToAppUrl: session.returnToAppUrl,
286
288
  signal: abortController.signal
287
289
  };
288
290
  try {
@@ -1,5 +1,5 @@
1
- import { endpointTurnClaimSchema } from "../../../../packages/endpoint-tools-protocol/src/index.js";
2
1
  import { validateWebchatAttachments, validateWebchatContent } from "../../chat-limits.js";
2
+ import { submitSessionInput } from "./session-input-handler.js";
3
3
  //#region src/gateway/hono/routes/agent-stream.ts
4
4
  function registerAgentStreamRoutes(authenticated, deps) {
5
5
  const { service, chatRateLimitMiddleware } = deps;
@@ -34,79 +34,7 @@ function registerAgentStreamRoutes(authenticated, deps) {
34
34
  });
35
35
  });
36
36
  authenticated.post("/api/sessions/:sessionKey/inputs", chatRateLimitMiddleware, async (c) => {
37
- const sessionKey = (c.req.param("sessionKey") ?? "").trim();
38
- const body = await c.req.json().catch(() => null);
39
- if (!body || !sessionKey) return c.json({
40
- ok: false,
41
- error: {
42
- code: "BAD_REQUEST",
43
- message: "Invalid request"
44
- }
45
- }, 400);
46
- const attachments = Array.isArray(body.attachments) ? body.attachments : void 0;
47
- const content = typeof body.content === "string" ? body.content : "";
48
- const contentError = validateWebchatContent(content);
49
- if (contentError) return c.json({
50
- ok: false,
51
- error: {
52
- code: "BAD_REQUEST",
53
- message: contentError
54
- }
55
- }, 400);
56
- const attachmentError = validateWebchatAttachments(attachments);
57
- if (attachmentError) return c.json({
58
- ok: false,
59
- error: {
60
- code: "BAD_REQUEST",
61
- message: attachmentError
62
- }
63
- }, 400);
64
- const delivery = body.delivery === "next" || body.delivery === "steer" ? body.delivery : null;
65
- if (!delivery) return c.json({
66
- ok: false,
67
- error: {
68
- code: "BAD_REQUEST",
69
- message: "Missing delivery"
70
- }
71
- }, 400);
72
- const origin = endpointTurnClaimSchema.safeParse(body.origin);
73
- if (!origin.success) return c.json({
74
- ok: false,
75
- error: {
76
- code: "BAD_REQUEST",
77
- message: "Invalid endpoint origin"
78
- }
79
- }, 400);
80
- if (!service.endpointTools.registry.verifyTurnClaim(origin.data.endpointId, origin.data.token)) return c.json({
81
- ok: false,
82
- error: {
83
- code: "INVALID_ENDPOINT",
84
- message: "Endpoint connection is not active"
85
- }
86
- }, 401);
87
- const result = await service.submitSessionInput({
88
- sessionKey,
89
- clientMessageId: typeof body.clientMessageId === "string" ? body.clientMessageId : "",
90
- delivery,
91
- content,
92
- attachments,
93
- thinking: typeof body.thinking === "string" ? body.thinking : void 0,
94
- origin: {
95
- type: "endpoint",
96
- endpointId: origin.data.endpointId
97
- }
98
- });
99
- if (result.ok === false) return c.json({
100
- ok: false,
101
- error: {
102
- code: result.code,
103
- message: "Input was not accepted"
104
- }
105
- }, result.code === "QUEUE_FULL" ? 409 : 400);
106
- return c.json({
107
- ok: true,
108
- payload: result
109
- }, 202);
37
+ return submitSessionInput(c, deps, (c.req.param("sessionKey") ?? "").trim());
110
38
  });
111
39
  authenticated.patch("/api/sessions/:sessionKey/inputs/:inputId", chatRateLimitMiddleware, async (c) => {
112
40
  const sessionKey = (c.req.param("sessionKey") ?? "").trim();
@@ -0,0 +1,62 @@
1
+ import type { Context } from 'hono';
2
+ import type { AuthenticatedRouteDeps } from './deps.js';
3
+ export declare function submitSessionInput(c: Context, deps: AuthenticatedRouteDeps, sessionKey: string): Promise<(Response & import("hono").TypedResponse<{
4
+ ok: false;
5
+ error: {
6
+ code: string;
7
+ message: string;
8
+ };
9
+ }, 400, "json">) | (Response & import("hono").TypedResponse<{
10
+ ok: false;
11
+ error: {
12
+ code: string;
13
+ message: string;
14
+ };
15
+ }, 401, "json">) | (Response & import("hono").TypedResponse<{
16
+ ok: false;
17
+ error: {
18
+ code: "BAD_REQUEST" | "QUEUE_FULL";
19
+ message: string;
20
+ };
21
+ }, 400 | 409, "json">) | (Response & import("hono").TypedResponse<{
22
+ ok: true;
23
+ payload: {
24
+ sessionKey: string;
25
+ ok: true;
26
+ effectiveDelivery: import("../../../storage/sqlite/session-input-repository.js").SessionInputDelivery;
27
+ state: {
28
+ sessionKey: string;
29
+ revision: number;
30
+ activeRunId?: string;
31
+ activeInputId?: string;
32
+ inputs: {
33
+ id: string;
34
+ sessionKey: string;
35
+ clientMessageId: string;
36
+ requestedDelivery: import("../../../storage/sqlite/session-input-repository.js").SessionInputDelivery;
37
+ effectiveDelivery: import("../../../storage/sqlite/session-input-repository.js").SessionInputDelivery;
38
+ status: import("../../../storage/sqlite/session-input-repository.js").SessionInputStatus;
39
+ content: string;
40
+ attachments?: import("hono/dist/types/utils/types.js").JSONValue[];
41
+ thinking?: string;
42
+ origin: {
43
+ type: "endpoint";
44
+ endpointId: string;
45
+ } | {
46
+ type: "channel";
47
+ channel: string;
48
+ } | {
49
+ type: "system";
50
+ source: "cli" | "workflow" | "automation" | "heartbeat" | "internal";
51
+ };
52
+ position: number;
53
+ targetRunId?: string;
54
+ runId?: string;
55
+ version: number;
56
+ error?: string;
57
+ createdAtMs: number;
58
+ updatedAtMs: number;
59
+ }[];
60
+ };
61
+ };
62
+ }, 202, "json">)>;