@zaip-ai/cli 4.9.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (180) hide show
  1. package/dist/services/adapter-hook-sources.d.ts +3 -0
  2. package/dist/services/adapter-hook-sources.d.ts.map +1 -1
  3. package/dist/services/adapter-hook-sources.js +3 -0
  4. package/dist/services/adapter-hook-sources.js.map +1 -1
  5. package/dist/services/adapters.d.ts +1 -1
  6. package/dist/services/adapters.d.ts.map +1 -1
  7. package/dist/services/adapters.js +5 -2
  8. package/dist/services/adapters.js.map +1 -1
  9. package/dist/services/adapters.test.js +1 -1
  10. package/dist/services/adapters.test.js.map +1 -1
  11. package/dist/services/codex-conversation-lifecycle-hook.d.ts.map +1 -1
  12. package/dist/services/codex-conversation-lifecycle-hook.js +16 -6
  13. package/dist/services/codex-conversation-lifecycle-hook.js.map +1 -1
  14. package/dist/services/codex-hook-activation.d.ts +1 -1
  15. package/dist/services/codex-hook-activation.d.ts.map +1 -1
  16. package/dist/services/codex-hook-activation.js +116 -10
  17. package/dist/services/codex-hook-activation.js.map +1 -1
  18. package/dist/services/codex-pre-tool-cli-capture-template.d.ts +2 -0
  19. package/dist/services/codex-pre-tool-cli-capture-template.d.ts.map +1 -0
  20. package/dist/services/codex-pre-tool-cli-capture-template.js +104 -0
  21. package/dist/services/codex-pre-tool-cli-capture-template.js.map +1 -0
  22. package/dist/services/codex-pre-tool-cloud-template.d.ts +2 -0
  23. package/dist/services/codex-pre-tool-cloud-template.d.ts.map +1 -0
  24. package/dist/services/codex-pre-tool-cloud-template.js +190 -0
  25. package/dist/services/codex-pre-tool-cloud-template.js.map +1 -0
  26. package/dist/services/codex-pre-tool-dependencies.test-support.d.ts +2 -0
  27. package/dist/services/codex-pre-tool-dependencies.test-support.d.ts.map +1 -0
  28. package/dist/services/codex-pre-tool-dependencies.test-support.js +9 -0
  29. package/dist/services/codex-pre-tool-dependencies.test-support.js.map +1 -0
  30. package/dist/services/codex-pre-tool-hook-fixture.test-support.d.ts +5 -0
  31. package/dist/services/codex-pre-tool-hook-fixture.test-support.d.ts.map +1 -0
  32. package/dist/services/codex-pre-tool-hook-fixture.test-support.js +19 -0
  33. package/dist/services/codex-pre-tool-hook-fixture.test-support.js.map +1 -0
  34. package/dist/services/codex-pre-tool-hook-template-bootstrap.test.d.ts +2 -0
  35. package/dist/services/codex-pre-tool-hook-template-bootstrap.test.d.ts.map +1 -0
  36. package/dist/services/codex-pre-tool-hook-template-bootstrap.test.js +107 -0
  37. package/dist/services/codex-pre-tool-hook-template-bootstrap.test.js.map +1 -0
  38. package/dist/services/codex-pre-tool-hook-template.d.ts.map +1 -1
  39. package/dist/services/codex-pre-tool-hook-template.js +96 -210
  40. package/dist/services/codex-pre-tool-hook-template.js.map +1 -1
  41. package/dist/services/codex-pre-tool-hook-template.test.js +32 -80
  42. package/dist/services/codex-pre-tool-hook-template.test.js.map +1 -1
  43. package/dist/services/codex-pre-tool-host-context-template.d.ts +2 -0
  44. package/dist/services/codex-pre-tool-host-context-template.d.ts.map +1 -0
  45. package/dist/services/codex-pre-tool-host-context-template.js +139 -0
  46. package/dist/services/codex-pre-tool-host-context-template.js.map +1 -0
  47. package/dist/services/codex-pre-tool-support-template.d.ts.map +1 -1
  48. package/dist/services/codex-pre-tool-support-template.js +61 -101
  49. package/dist/services/codex-pre-tool-support-template.js.map +1 -1
  50. package/dist/services/codex-subagent-hook-template.d.ts +1 -1
  51. package/dist/services/codex-subagent-hook-template.d.ts.map +1 -1
  52. package/dist/services/codex-subagent-hook-template.js +13 -2
  53. package/dist/services/codex-subagent-hook-template.js.map +1 -1
  54. package/dist/services/codex-validation-runtime-template.d.ts.map +1 -1
  55. package/dist/services/codex-validation-runtime-template.js +10 -4
  56. package/dist/services/codex-validation-runtime-template.js.map +1 -1
  57. package/dist/services/runtime-template-test-support.d.ts +1 -0
  58. package/dist/services/runtime-template-test-support.d.ts.map +1 -1
  59. package/dist/services/runtime-template-test-support.js +23 -2
  60. package/dist/services/runtime-template-test-support.js.map +1 -1
  61. package/dist/services/runtime-template.test.js +4 -23
  62. package/dist/services/runtime-template.test.js.map +1 -1
  63. package/package.json +1 -1
  64. package/templates/.agents/README-ENG.md +49 -7
  65. package/templates/.agents/README.md +37 -10
  66. package/templates/.agents/config/agents/discovery.json +1 -1
  67. package/templates/.agents/dashboard/.zaip-managed.json +121 -73
  68. package/templates/.agents/dashboard/apps/frontend/dist/assets/{CostCalculationGuidePage-BW7Vy1cp.js → CostCalculationGuidePage-w6pjt4OM.js} +1 -1
  69. package/templates/.agents/dashboard/apps/frontend/dist/assets/{DashboardHelpDialog-Cp_hEVd8.js → DashboardHelpDialog-DhlntQcR.js} +76 -11
  70. package/templates/.agents/dashboard/apps/frontend/dist/assets/{PricingSettingsDialog-Prcs-ydy.js → PricingSettingsDialog-BHoZT2an.js} +1 -1
  71. package/templates/.agents/dashboard/apps/frontend/dist/assets/{ProjectSettingsPage-Cu40wAFF.js → ProjectSettingsPage-IcncIZ9Y.js} +1 -1
  72. package/templates/.agents/dashboard/apps/frontend/dist/assets/{TraceabilityWorkspace-Bh3YBd3C.js → TraceabilityWorkspace-C6rORjpr.js} +1 -1
  73. package/templates/.agents/dashboard/apps/frontend/dist/assets/cost-monitor-uPnOBShc.js +68 -0
  74. package/templates/.agents/dashboard/apps/frontend/dist/assets/{dashboard-localization-CF7B1Hjn.js → dashboard-localization-DWXjEIgc.js} +49 -7
  75. package/templates/.agents/dashboard/apps/frontend/dist/assets/{icons-vendor-DOhy6D2-.js → icons-vendor-Hc9fp_gs.js} +1 -1
  76. package/templates/.agents/dashboard/apps/frontend/dist/assets/{index-qVSJnJ0_.js → index-BqeOEZW5.js} +2 -2
  77. package/templates/.agents/dashboard/apps/frontend/dist/assets/{react-vendor-CkPC-yMz.js → react-vendor-C9ta_O10.js} +1 -1
  78. package/templates/.agents/dashboard/apps/frontend/dist/assets/{traceability-BEdGoIDm.js → traceability-IcefoTOv.js} +1 -1
  79. package/templates/.agents/dashboard/apps/frontend/dist/index.html +5 -5
  80. package/templates/.agents/dashboard/apps/frontend/package.json +1 -1
  81. package/templates/.agents/dashboard/modules/cost-monitor/package.json +1 -1
  82. package/templates/.agents/dashboard/modules/cost-monitor/src/contracts.ts +10 -3
  83. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostFilters.run-page.test.ts +5 -1
  84. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostGroupsTable.period-values.test.tsx +2 -2
  85. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostTables-keeps-legacy-codex-identity-fields-blank.test.ts +5 -5
  86. package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostTables.test.ts +36 -43
  87. package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor-loaders.ts +1 -0
  88. package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-table-formatters.ts +6 -4
  89. package/templates/.agents/dashboard/modules/cost-monitor/src/server/aggregate.ts +2 -2
  90. package/templates/.agents/dashboard/modules/cost-monitor/src/server/build-cost-monitor-projection.ts +1 -1
  91. package/templates/.agents/dashboard/modules/cost-monitor/src/server/build-cost-summary-projection.ts +11 -25
  92. package/templates/.agents/dashboard/modules/cost-monitor/src/server/cost-summary-defaults.ts +26 -0
  93. package/templates/.agents/dashboard/modules/operations/package.json +1 -1
  94. package/templates/.agents/dashboard/modules/operations/src/contracts.ts +11 -16
  95. package/templates/.agents/dashboard/modules/operations/src/planning-contracts.ts +14 -0
  96. package/templates/.agents/dashboard/modules/operations/src/react/DecisionTable.tsx +65 -0
  97. package/templates/.agents/dashboard/modules/operations/src/react/EntityTables.tsx +5 -71
  98. package/templates/.agents/dashboard/modules/operations/src/react/OperationsPage.tsx +10 -36
  99. package/templates/.agents/dashboard/modules/operations/src/react/operations-overview-period-filter.test.ts +7 -2
  100. package/templates/.agents/dashboard/modules/operations/src/react/use-operations-filter-sync.ts +66 -0
  101. package/templates/.agents/dashboard/modules/traceability/package.json +1 -1
  102. package/templates/.agents/dashboard/packages/branding/package.json +1 -1
  103. package/templates/.agents/dashboard/packages/contracts/package.json +1 -1
  104. package/templates/.agents/dashboard/packages/data-export/package.json +1 -1
  105. package/templates/.agents/dashboard/packages/local-runtime/dist/server.cjs +193 -191
  106. package/templates/.agents/dashboard/packages/local-runtime/dist/sqlite-read-model.cjs +169 -169
  107. package/templates/.agents/dashboard/packages/local-runtime/package.json +1 -1
  108. package/templates/.agents/dashboard/packages/local-runtime/server.mjs +193 -191
  109. package/templates/.agents/dashboard/packages/local-runtime/src/active-capture-failure.test.ts +38 -0
  110. package/templates/.agents/dashboard/packages/local-runtime/src/active-capture-failure.ts +35 -0
  111. package/templates/.agents/dashboard/packages/local-runtime/src/active-codex-telemetry.test.ts +53 -2
  112. package/templates/.agents/dashboard/packages/local-runtime/src/active-codex-telemetry.ts +18 -1
  113. package/templates/.agents/dashboard/packages/local-runtime/src/manifest-runs.ts +8 -2
  114. package/templates/.agents/dashboard/packages/local-runtime/src/server-capture-projection-order.test.ts +118 -0
  115. package/templates/.agents/dashboard/packages/local-runtime/src/server-cost-run-search.test.ts +90 -0
  116. package/templates/.agents/dashboard/packages/local-runtime/src/server-cost-run-search.ts +86 -0
  117. package/templates/.agents/dashboard/packages/local-runtime/src/server-operations-routes.ts +8 -1
  118. package/templates/.agents/dashboard/packages/local-runtime/src/server-projection-loaders.ts +13 -0
  119. package/templates/.agents/dashboard/packages/local-runtime/src/server-projections.ts +30 -74
  120. package/templates/.agents/dashboard/packages/local-runtime/src/server-route-handlers.ts +42 -0
  121. package/templates/.agents/dashboard/packages/local-runtime/src/server-routes.test.ts +60 -0
  122. package/templates/.agents/dashboard/packages/local-runtime/src/server-run-projections.test.ts +12 -2
  123. package/templates/.agents/dashboard/packages/local-runtime/src/server-telemetry-command.test.ts +29 -4
  124. package/templates/.agents/dashboard/packages/local-runtime/src/server-telemetry-refresh.ts +7 -0
  125. package/templates/.agents/dashboard/packages/local-runtime/src/server.test.ts +51 -54
  126. package/templates/.agents/dashboard/packages/local-runtime/src/server.ts +28 -45
  127. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-cost-filter-matrix.test.ts +5 -0
  128. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-cost-invocation-page.test.ts +49 -0
  129. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-cost-invocation-page.ts +44 -1
  130. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-cached-cost-page.ts +11 -10
  131. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-summary.ts +1 -1
  132. package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-work-item-index.test.ts +18 -1
  133. package/templates/.agents/dashboard/packages/ui/package.json +1 -1
  134. package/templates/.agents/dashboard/tests/e2e/package.json +1 -1
  135. package/templates/.agents/design/.zaip-managed.json +3 -3
  136. package/templates/.agents/design/apps/catalog/package.json +1 -1
  137. package/templates/.agents/design/packages/local-runtime/package.json +1 -1
  138. package/templates/.agents/requirements/autonomous-assurance.md +11 -2
  139. package/templates/.agents/requirements/cloud-hostinger-autonomy.md +1 -1
  140. package/templates/.agents/requirements/comparative-audit.md +1 -1
  141. package/templates/.agents/requirements/context-engine.md +1 -1
  142. package/templates/.agents/requirements/cost-observability.md +1 -1
  143. package/templates/.agents/requirements/dashboard-launch.md +1 -1
  144. package/templates/.agents/requirements/data-export.md +1 -1
  145. package/templates/.agents/requirements/design-system.md +1 -1
  146. package/templates/.agents/requirements/execution-engine.md +1 -1
  147. package/templates/.agents/requirements/kanban-dashboard.md +1 -1
  148. package/templates/.agents/requirements/model-orchestration.md +1 -1
  149. package/templates/.agents/requirements/public-distribution.md +1 -1
  150. package/templates/.agents/requirements/software-architecture.md +1 -1
  151. package/templates/.agents/requirements/strategic-improvements.md +1 -1
  152. package/templates/.agents/requirements/work-lifecycle.md +2 -1
  153. package/templates/.agents/requirements/zaip-strategic-95.md +1 -1
  154. package/templates/.agents/rules/run-lifecycle-closure.md +2 -1
  155. package/templates/.agents/rules/workflow.md +1 -0
  156. package/templates/.agents/runtime/VERSION +1 -1
  157. package/templates/.agents/runtime/bin/zaip.mjs +1178 -764
  158. package/templates/.agents/runtime/checksums.sha256 +6 -6
  159. package/templates/.agents/runtime/manifest.json +1 -1
  160. package/templates/.agents/runtime/pnpm-lock.sha256 +1 -1
  161. package/templates/.agents/runtime/provenance.json +5 -5
  162. package/templates/.agents/runtime/sbom.cdx.json +59 -59
  163. package/templates/.agents/skills/zaip-skill-execution/SKILL.md +1 -1
  164. package/templates/.agents/skills/zaip-skill-execution/references/controlled-release-recovery.md +14 -0
  165. package/templates/.agents/skills/zaip-skill-execution/references/runtime-governance.md +1 -1
  166. package/templates/.agents/skills/zaip-skill-github-deploy/SKILL.md +5 -1
  167. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/deploy-contract.mjs +12 -0
  168. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/deploy-contract.test.mjs +25 -0
  169. package/templates/.agents/skills/zaip-skill-maintenance-enter/SKILL.md +23 -0
  170. package/templates/.agents/skills/zaip-skill-maintenance-enter/agents/openai.yaml +4 -0
  171. package/templates/.agents/skills/zaip-skill-maintenance-enter/scripts/maintenance.mjs +213 -0
  172. package/templates/.agents/skills/zaip-skill-maintenance-enter/scripts/maintenance.test.mjs +207 -0
  173. package/templates/.agents/skills/zaip-skill-maintenance-exit/SKILL.md +21 -0
  174. package/templates/.agents/skills/zaip-skill-maintenance-exit/agents/openai.yaml +4 -0
  175. package/templates/.agents/skills/zaip-skill-release-qualification/SKILL.md +2 -0
  176. package/templates/.agents/skills/zaip-skill-release-qualification/references/local-preparation.md +37 -8
  177. package/templates/.agents/zaip-aios/VERSION +1 -1
  178. package/templates/.agents/zaip-aios/guides/26-qualidade-e-release.md +38 -0
  179. package/templates/template-manifest.json +188 -116
  180. package/templates/.agents/dashboard/apps/frontend/dist/assets/cost-monitor-Co2Jiuzh.js +0 -68
@@ -1,4 +1,4 @@
1
- import{t as e}from"./rolldown-runtime-Bh1tDfsg.js";import{E as t,T as n}from"./cost-monitor-Co2Jiuzh.js";var r=e((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,ee||(ee=!0,oe());else{var t=n(l);t!==null&&le(x,t.startTime-e)}}var ee=!1,te=-1,ne=5,re=-1;function ie(){return g?!0:!(e.unstable_now()-re<ne)}function ae(){if(g=!1,ee){var t=e.unstable_now();re=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(te),te=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&ie());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&le(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?oe():ee=!1}}}var oe;if(typeof y==`function`)oe=function(){y(ae)};else if(typeof MessageChannel<`u`){var se=new MessageChannel,ce=se.port2;se.port1.onmessage=ae,oe=function(){ce.postMessage(null)}}else oe=function(){_(ae,0)};function le(t,n){te=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):ne=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(te),te=-1):h=!0,le(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,ee||(ee=!0,oe()))),r},e.unstable_shouldYield=ie,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),i=e(((e,t)=>{t.exports=r()})),a=e((e=>{var r=i(),a=t(),o=n();function s(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function l(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function u(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function d(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function f(e){if(l(e)!==e)throw Error(s(188))}function p(e){var t=e.alternate;if(!t){if(t=l(e),t===null)throw Error(s(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var a=i.alternate;if(a===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===a.child){for(a=i.child;a;){if(a===n)return f(i),e;if(a===r)return f(i),t;a=a.sibling}throw Error(s(188))}if(n.return!==r.return)n=i,r=a;else{for(var o=!1,c=i.child;c;){if(c===n){o=!0,n=i,r=a;break}if(c===r){o=!0,r=i,n=a;break}c=c.sibling}if(!o){for(c=a.child;c;){if(c===n){o=!0,n=a,r=i;break}if(c===r){o=!0,r=a,n=i;break}c=c.sibling}if(!o)throw Error(s(189))}}if(n.alternate!==r)throw Error(s(190))}if(n.tag!==3)throw Error(s(188));return n.stateNode.current===n?e:t}function m(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=m(e),t!==null)return t;e=e.sibling}return null}var h=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),ee=Symbol.for(`react.consumer`),te=Symbol.for(`react.context`),ne=Symbol.for(`react.forward_ref`),re=Symbol.for(`react.suspense`),ie=Symbol.for(`react.suspense_list`),ae=Symbol.for(`react.memo`),oe=Symbol.for(`react.lazy`),se=Symbol.for(`react.activity`),ce=Symbol.for(`react.memo_cache_sentinel`),le=Symbol.iterator;function ue(e){return typeof e!=`object`||!e?null:(e=le&&e[le]||e[`@@iterator`],typeof e==`function`?e:null)}var de=Symbol.for(`react.client.reference`);function fe(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===de?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case re:return`Suspense`;case ie:return`SuspenseList`;case se:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case te:return e.displayName||`Context`;case ee:return(e._context.displayName||`Context`)+`.Consumer`;case ne:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case ae:return t=e.displayName||null,t===null?fe(e.type)||`Memo`:t;case oe:t=e._payload,e=e._init;try{return fe(e(t))}catch{}}return null}var pe=Array.isArray,S=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,C=o.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,me={pending:!1,data:null,method:null,action:null},he=[],ge=-1;function _e(e){return{current:e}}function w(e){0>ge||(e.current=he[ge],he[ge]=null,ge--)}function T(e,t){ge++,he[ge]=e.current,e.current=t}var ve=_e(null),ye=_e(null),be=_e(null),xe=_e(null);function Se(e,t){switch(T(be,t),T(ye,e),T(ve,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}w(ve),T(ve,e)}function Ce(){w(ve),w(ye),w(be)}function we(e){e.memoizedState!==null&&T(xe,e);var t=ve.current,n=Hd(t,e.type);t!==n&&(T(ye,e),T(ve,n))}function Te(e){ye.current===e&&(w(ve),w(ye)),xe.current===e&&(w(xe),Qf._currentValue=me)}var Ee,De;function Oe(e){if(Ee===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Ee=t&&t[1]||``,De=-1<e.stack.indexOf(`
1
+ import{t as e}from"./rolldown-runtime-Bh1tDfsg.js";import{E as t,T as n}from"./cost-monitor-uPnOBShc.js";var r=e((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,ee||(ee=!0,oe());else{var t=n(l);t!==null&&le(x,t.startTime-e)}}var ee=!1,te=-1,ne=5,re=-1;function ie(){return g?!0:!(e.unstable_now()-re<ne)}function ae(){if(g=!1,ee){var t=e.unstable_now();re=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(te),te=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&ie());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&le(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?oe():ee=!1}}}var oe;if(typeof y==`function`)oe=function(){y(ae)};else if(typeof MessageChannel<`u`){var se=new MessageChannel,ce=se.port2;se.port1.onmessage=ae,oe=function(){ce.postMessage(null)}}else oe=function(){_(ae,0)};function le(t,n){te=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):ne=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(te),te=-1):h=!0,le(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,ee||(ee=!0,oe()))),r},e.unstable_shouldYield=ie,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),i=e(((e,t)=>{t.exports=r()})),a=e((e=>{var r=i(),a=t(),o=n();function s(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function l(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function u(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function d(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function f(e){if(l(e)!==e)throw Error(s(188))}function p(e){var t=e.alternate;if(!t){if(t=l(e),t===null)throw Error(s(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var a=i.alternate;if(a===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===a.child){for(a=i.child;a;){if(a===n)return f(i),e;if(a===r)return f(i),t;a=a.sibling}throw Error(s(188))}if(n.return!==r.return)n=i,r=a;else{for(var o=!1,c=i.child;c;){if(c===n){o=!0,n=i,r=a;break}if(c===r){o=!0,r=i,n=a;break}c=c.sibling}if(!o){for(c=a.child;c;){if(c===n){o=!0,n=a,r=i;break}if(c===r){o=!0,r=a,n=i;break}c=c.sibling}if(!o)throw Error(s(189))}}if(n.alternate!==r)throw Error(s(190))}if(n.tag!==3)throw Error(s(188));return n.stateNode.current===n?e:t}function m(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=m(e),t!==null)return t;e=e.sibling}return null}var h=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),ee=Symbol.for(`react.consumer`),te=Symbol.for(`react.context`),ne=Symbol.for(`react.forward_ref`),re=Symbol.for(`react.suspense`),ie=Symbol.for(`react.suspense_list`),ae=Symbol.for(`react.memo`),oe=Symbol.for(`react.lazy`),se=Symbol.for(`react.activity`),ce=Symbol.for(`react.memo_cache_sentinel`),le=Symbol.iterator;function ue(e){return typeof e!=`object`||!e?null:(e=le&&e[le]||e[`@@iterator`],typeof e==`function`?e:null)}var de=Symbol.for(`react.client.reference`);function fe(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===de?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case re:return`Suspense`;case ie:return`SuspenseList`;case se:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case te:return e.displayName||`Context`;case ee:return(e._context.displayName||`Context`)+`.Consumer`;case ne:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case ae:return t=e.displayName||null,t===null?fe(e.type)||`Memo`:t;case oe:t=e._payload,e=e._init;try{return fe(e(t))}catch{}}return null}var pe=Array.isArray,S=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,C=o.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,me={pending:!1,data:null,method:null,action:null},he=[],ge=-1;function _e(e){return{current:e}}function w(e){0>ge||(e.current=he[ge],he[ge]=null,ge--)}function T(e,t){ge++,he[ge]=e.current,e.current=t}var ve=_e(null),ye=_e(null),be=_e(null),xe=_e(null);function Se(e,t){switch(T(be,t),T(ye,e),T(ve,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}w(ve),T(ve,e)}function Ce(){w(ve),w(ye),w(be)}function we(e){e.memoizedState!==null&&T(xe,e);var t=ve.current,n=Hd(t,e.type);t!==n&&(T(ye,e),T(ve,n))}function Te(e){ye.current===e&&(w(ve),w(ye)),xe.current===e&&(w(xe),Qf._currentValue=me)}var Ee,De;function Oe(e){if(Ee===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Ee=t&&t[1]||``,De=-1<e.stack.indexOf(`
2
2
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
3
3
  `+Ee+e+De}var ke=!1;function Ae(e,t){if(!e||ke)return``;ke=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
4
4
  `),l=s.split(`
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-Bh1tDfsg.js";import{C as t,E as n,S as r,c as i,d as a,f as o,l as s,m as c,p as l,s as u,u as d,w as f,x as p}from"./cost-monitor-Co2Jiuzh.js";import{a as m,c as h,d as g,f as _,i as v,l as y,m as b,n as x,o as S,p as C,r as w,s as T,t as E,u as D}from"./icons-vendor-DOhy6D2-.js";var O=e(n(),1),k=f();function A({ariaLabel:e,closeLabel:t,document:n,onClose:r}){return(0,k.jsxs)(`section`,{"aria-label":e,"aria-modal":`true`,className:`trace-document`,role:`dialog`,children:[(0,k.jsxs)(`header`,{children:[(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`small`,{children:n.path}),(0,k.jsx)(`h2`,{children:n.title})]}),(0,k.jsx)(`button`,{"aria-label":t,className:`trace-close-button`,onClick:r,type:`button`,children:(0,k.jsx)(u,{"aria-hidden":`true`,size:20,strokeWidth:2})})]}),(0,k.jsx)(`pre`,{children:n.content})]})}function j({stage:e,stageRecord:t,documents:n,stageCopy:r,stageArtifacts:i,copy:a,onBack:o,onOpenDocument:s,onStageChange:u}){let d=[`definition`,`planning`,`execution`,`decisions`,`verification`,`evidence`],f=d.indexOf(e),p=d[f-1],h=d[f+1],g=n.filter(e=>e.kind===`evidence`).length,_=new Set(n.map(e=>e.kind)).size,v=new Map;for(let e of n)v.set(e.kind,[...v.get(e.kind)??[],e]);let y=t?.last_recorded_at??a.pending;return(0,k.jsxs)(`section`,{className:`trace-stage-detail`,children:[(0,k.jsx)(`header`,{children:(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`p`,{children:r[e].label}),(0,k.jsx)(`h3`,{children:i[e]}),(0,k.jsx)(`small`,{children:y})]})}),(0,k.jsxs)(`div`,{className:`trace-stage-metrics`,children:[(0,k.jsxs)(`article`,{children:[(0,k.jsx)(`span`,{children:a.documents}),(0,k.jsx)(`strong`,{children:n.length})]}),(0,k.jsxs)(`article`,{children:[(0,k.jsx)(`span`,{children:a.types}),(0,k.jsx)(`strong`,{children:_})]}),(0,k.jsxs)(`article`,{children:[(0,k.jsx)(`span`,{children:a.evidenceMetric}),(0,k.jsx)(`strong`,{children:g})]})]}),(0,k.jsx)(`div`,{className:`trace-stage-documents`,children:n.length===0?(0,k.jsx)(`p`,{className:`trace-stage-empty`,children:a.empty}):[...v].map(([e,t])=>(0,k.jsxs)(`section`,{className:`trace-document-group`,children:[(0,k.jsxs)(`h4`,{children:[e,` `,(0,k.jsx)(`small`,{children:t.length})]}),t.map(e=>(0,k.jsxs)(`button`,{onClick:()=>s(e),type:`button`,children:[(0,k.jsx)(`strong`,{children:e.title}),(0,k.jsx)(`small`,{children:e.path})]},e.id))]},e))}),(0,k.jsxs)(`nav`,{"aria-label":a.navigation,className:`trace-stage-navigation`,children:[(0,k.jsxs)(`button`,{className:`trace-navigation-action trace-navigation-previous`,disabled:f===0,onClick:()=>u(d[f-1]),type:`button`,children:[(0,k.jsx)(c,{"aria-hidden":`true`,size:18,strokeWidth:1.9}),(0,k.jsxs)(`span`,{children:[(0,k.jsx)(`small`,{children:a.previous}),(0,k.jsx)(`strong`,{children:p?r[p].label.split(` (`)[0]:`—`})]})]}),(0,k.jsxs)(`div`,{className:`trace-navigation-center`,children:[(0,k.jsx)(`div`,{"aria-hidden":`true`,className:`trace-navigation-progress`,children:d.map((t,n)=>(0,k.jsx)(`span`,{"data-active":t===e,"data-passed":n<f},t))}),(0,k.jsxs)(`small`,{children:[f+1,` `,a.of,` `,d.length]}),(0,k.jsxs)(`button`,{className:`trace-all-stages-button`,onClick:o,type:`button`,children:[(0,k.jsx)(m,{"aria-hidden":`true`,size:15,strokeWidth:1.9}),a.back]})]}),(0,k.jsxs)(`button`,{className:`trace-navigation-action trace-navigation-next`,disabled:f===d.length-1,onClick:()=>u(d[f+1]),type:`button`,children:[(0,k.jsxs)(`span`,{children:[(0,k.jsx)(`small`,{children:a.next}),(0,k.jsx)(`strong`,{children:h?r[h].label.split(` (`)[0]:`—`})]}),(0,k.jsx)(l,{"aria-hidden":`true`,size:18,strokeWidth:1.9})]})]})]})}function M({ariaLabel:e,children:t,closeLabel:n,onClose:r}){return(0,O.useEffect)(()=>{let e=e=>{e.key===`Escape`&&r()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r]),(0,k.jsxs)(`div`,{className:`trace-stage-dialog-backdrop`,role:`presentation`,children:[(0,k.jsx)(`button`,{"aria-label":n,className:`trace-stage-dialog-backdrop-dismiss`,onClick:r,type:`button`}),(0,k.jsxs)(`section`,{"aria-label":e,"aria-modal":`true`,className:`trace-stage-dialog`,role:`dialog`,children:[(0,k.jsx)(`button`,{"aria-label":n,className:`trace-stage-dialog-close`,onClick:r,type:`button`,children:(0,k.jsx)(u,{"aria-hidden":`true`,size:22})}),t]})]})}var N=[`definition`,`planning`,`execution`,`decisions`,`verification`,`evidence`],P=[`task`,`change`,`spec`,`prd`],F=[`coverage`,`documents`,`evidence`,`links`],I={"pt-BR":{lite:`Leve`,standard:`Padrão`,critical:`Crítico`},"en-US":{lite:`Lite`,standard:`Standard`,critical:`Critical`}},L={definition:D,planning:d,execution:w,decisions:S,verification:x,evidence:h},R={definition:`PRD · Requisitos`,planning:`SPEC · Change`,execution:`Tarefas · DAG · Runs · arquivos`,decisions:`Decisões do planejamento e da execução`,verification:`Testes · revisões · evals · checks`,evidence:`Evidências · resultados · rastreabilidade`},z={definition:`PRD · Requirements`,planning:`SPEC · Change`,execution:`Tasks · DAG · Runs · files`,decisions:`Planning and execution decisions`,verification:`Tests · reviews · evals · checks`,evidence:`Evidence · results · traceability`};function B(e,t){return[{label:`Task`,value:e.task_id,onOpen:void 0},{label:`Change`,value:e.change_id,onOpen:t.onOpenChange},{label:`SPEC`,value:e.spec_id,onOpen:t.onOpenSpec},{label:`PRD`,value:e.prd_id,onOpen:t.onOpenPrd}]}var V={definition:{label:`Definição (PRD + Requisitos)`,description:`Objetivo, contexto e critérios que definem o trabalho.`},planning:{label:`Planejamento (SPEC + Change)`,description:`Escopo, solução e mudanças previstas antes da execução.`},execution:{label:`Execução (Tarefas ou DAG)`,description:`Tarefas, dependências da DAG, Runs e arquivos produzidos.`},decisions:{label:`Decisões (Plano e Execução)`,description:`Decisões humanas e da IA tomadas no planejamento e na execução.`},verification:{label:`Verificação (Testes + Revisões)`,description:`Testes, revisões, evals e checks comparam o resultado aos Critérios de Aceite.`},evidence:{label:`Evidências (Resultados + Rastreabilidade)`,description:`Provas reproduzíveis vinculadas às Tasks, Changes, Runs e Critérios de Aceite.`}},H={definition:{label:`Definition (PRD + Requirements)`,description:`Objective, context, and criteria that define the work.`},planning:{label:`Planning (SPEC + Change)`,description:`Scope, solution, and changes planned before execution.`},execution:{label:`Execution (Tasks or DAG)`,description:`Tasks, DAG dependencies, Runs, and produced files.`},decisions:{label:`Decisions (Plan and Execution)`,description:`Human and AI decisions made during planning and execution.`},verification:{label:`Verification (Tests + Reviews)`,description:`Tests, reviews, evals, and checks compare results with acceptance criteria.`},evidence:{label:`Evidence (Results + Traceability)`,description:`Reproducible proof linked to Tasks, Changes, Runs, and acceptance criteria.`}},U={"pt-BR":{aria:`Rastreabilidade da task`,coverage:`etapas rastreadas`,evidence:`evidências`,close:`Fechar`,empty:`Nenhum documento relacionado.`,closeDocument:`Fechar documento`,back:`Voltar às etapas`,previous:`Anterior`,next:`Próxima`,documents:`Documentos`,types:`Tipos`,evidenceMetric:`Evidências`,taskFirst:`Task-first`,specDriven:`Spec-driven`,copyId:`Copiar ID`,copied:`ID copiado`,unlinked:`Não vinculado`,recorded:`Registrada em`,pending:`Pendente`,missingTimestamp:`Sem data/hora`,tests:`testes registrados`,time:`Tempo`,tokens:`Tokens`,cost:`Custo`,measuredRuns:`Runs medidas`,items:`itens`,navigation:`Navegação entre etapas`,of:`de`,stageDetails:`Detalhes da etapa`,document:`Documento`},"en-US":{aria:`Task traceability`,coverage:`tracked stages`,evidence:`evidence items`,close:`Close`,empty:`No related document.`,closeDocument:`Close document`,back:`Back to stages`,previous:`Previous`,next:`Next`,documents:`Documents`,types:`Types`,evidenceMetric:`Evidence`,taskFirst:`Task-first`,specDriven:`Spec-driven`,copyId:`Copy ID`,copied:`ID copied`,unlinked:`Not linked`,recorded:`Recorded at`,pending:`Pending`,missingTimestamp:`Missing date/time`,tests:`recorded tests`,time:`Time`,tokens:`Tokens`,cost:`Cost`,measuredRuns:`measured Runs`,items:`items`,navigation:`Stage navigation`,of:`of`,stageDetails:`Stage details`,document:`Document`}};function W({taskId:e,locale:t=`pt-BR`}){let n=t===`pt-BR`;return(0,k.jsx)(`div`,{className:`trace-backdrop`,children:(0,k.jsxs)(`section`,{"aria-busy":`true`,"aria-label":n?`Carregando rastreabilidade`:`Loading traceability`,"aria-live":`polite`,className:`trace-panel trace-loading-panel`,role:`dialog`,children:[(0,k.jsxs)(`header`,{className:`trace-panel-header`,children:[(0,k.jsxs)(`div`,{className:`trace-heading`,children:[(0,k.jsx)(`span`,{className:`trace-heading-icon trace-loading-icon`,"aria-hidden":`true`,children:(0,k.jsx)(s,{size:22,strokeWidth:1.8})}),(0,k.jsxs)(`div`,{className:`trace-task-summary-content`,children:[(0,k.jsx)(`h2`,{children:n?`Carregando rastreabilidade`:`Loading traceability`}),(0,k.jsx)(`p`,{children:e})]})]}),(0,k.jsxs)(`span`,{className:`trace-loading-status`,children:[(0,k.jsx)(s,{"aria-hidden":`true`,size:15,strokeWidth:2}),n?`Preparando trace`:`Preparing trace`]})]}),(0,k.jsx)(`div`,{className:`trace-loading-identifiers`,"aria-hidden":`true`,children:P.map(e=>(0,k.jsx)(`span`,{},e))}),(0,k.jsx)(`div`,{className:`trace-loading-metrics`,"aria-hidden":`true`,children:F.map(e=>(0,k.jsx)(`span`,{},e))}),(0,k.jsx)(`div`,{className:`trace-loading-stages`,"aria-hidden":`true`,children:N.map(e=>(0,k.jsx)(`span`,{},e))})]})})}function G({trace:e,locale:t=`pt-BR`,onClose:n,onOpenChange:r,onOpenPrd:s,onOpenSpec:c,embedded:d=!1}){let[f,p]=(0,O.useState)(null),[m,h]=(0,O.useState)(null),[S,w]=(0,O.useState)(!1),D=U[t],P=t===`en-US`?H:V,F=t===`en-US`?z:R,W=(0,O.useMemo)(()=>new Map(N.map(t=>[t,e.documents.filter(e=>e.stage===t)])),[e.documents]),G=(0,O.useMemo)(()=>new Map(e.stages.map(e=>[e.stage,e])),[e.stages]),q=Math.round(e.coverage.stages_with_timestamps/e.coverage.total_stages*100),X=[e.task_id,e.change_id,e.spec_id,e.prd_id].filter(Boolean).length,Z=B(e,{onOpenChange:r,onOpenPrd:s,onOpenSpec:c}),Q=J(e.task_created_at,t),$=Y(e.task_created_at,t),ee=async()=>{try{await navigator.clipboard.writeText(e.task_id),w(!0),window.setTimeout(()=>w(!1),2e3)}catch{w(!1)}};return(0,k.jsxs)(`div`,{className:d?`trace-embedded`:`trace-backdrop`,children:[(0,k.jsxs)(`section`,{"aria-label":D.aria,"aria-modal":d?void 0:`true`,className:`trace-panel`,role:`dialog`,children:[(0,k.jsxs)(`header`,{className:`trace-panel-header`,children:[(0,k.jsxs)(`div`,{className:`trace-heading`,children:[(0,k.jsx)(`span`,{className:`trace-heading-icon`,"aria-hidden":`true`,children:(0,k.jsx)(i,{size:22,strokeWidth:1.8})}),(0,k.jsxs)(`div`,{className:`trace-task-summary-content`,children:[(0,k.jsx)(`div`,{className:`trace-heading-title`,children:(0,k.jsxs)(`h2`,{children:[(0,k.jsx)(`span`,{className:`trace-title-prefix`,children:`Trace:`}),` `,e.task_title||e.task_id]})}),(0,k.jsx)(`p`,{children:t===`pt-BR`?`Visão completa do ciclo de desenvolvimento`:`Complete development lifecycle view`})]})]}),(0,k.jsxs)(`div`,{className:`trace-header-actions`,children:[(0,k.jsx)(K,{copy:D,locale:t,usage:e.usage}),d?null:(0,k.jsx)(`button`,{className:`trace-close-button`,"aria-label":D.close,onClick:n,type:`button`,children:(0,k.jsx)(u,{"aria-hidden":`true`,size:20,strokeWidth:2})})]})]}),(0,k.jsxs)(`section`,{className:`trace-task-summary`,"aria-label":t===`pt-BR`?`Resumo da tarefa`:`Task summary`,children:[(0,k.jsxs)(`article`,{children:[(0,k.jsx)(C,{"aria-hidden":`true`,size:17,strokeWidth:1.8}),(0,k.jsxs)(`div`,{className:`trace-task-summary-content`,children:[(0,k.jsx)(`span`,{children:t===`pt-BR`?`Criada em`:`Created at`}),(0,k.jsx)(`strong`,{children:Q})]})]}),(0,k.jsxs)(`article`,{children:[(0,k.jsx)(a,{"aria-hidden":`true`,size:17,strokeWidth:1.8}),(0,k.jsxs)(`div`,{className:`trace-task-summary-content`,children:[(0,k.jsx)(`span`,{children:t===`pt-BR`?`Desde a criação`:`Since creation`}),(0,k.jsx)(`strong`,{children:$})]})]}),(0,k.jsxs)(`article`,{className:`trace-task-progress`,children:[(0,k.jsx)(g,{"aria-hidden":`true`,size:17,strokeWidth:1.8}),(0,k.jsxs)(`div`,{className:`trace-task-summary-content trace-task-progress-content`,children:[(0,k.jsx)(`span`,{children:t===`pt-BR`?`Progresso`:`Progress`}),(0,k.jsxs)(`strong`,{children:[e.task_progress,`%`]}),(0,k.jsx)(`progress`,{max:100,value:e.task_progress})]})]}),(0,k.jsxs)(`article`,{className:`trace-task-classification`,children:[(0,k.jsx)(b,{"aria-hidden":`true`,size:17,strokeWidth:1.8}),(0,k.jsxs)(`div`,{className:`trace-task-summary-content`,children:[(0,k.jsx)(`span`,{children:t===`pt-BR`?`Classificação`:`Classification`}),(0,k.jsxs)(`div`,{className:`trace-task-badges`,children:[(0,k.jsxs)(`span`,{className:`trace-mode-badge`,children:[(0,k.jsx)(E,{"aria-hidden":`true`,size:12,strokeWidth:2}),e.spec_id===null?D.taskFirst:D.specDriven]}),e.task_risk?(0,k.jsxs)(`span`,{className:`trace-risk-badge`,"data-risk":e.task_risk,children:[(0,k.jsx)(x,{"aria-hidden":`true`,size:12,strokeWidth:2}),I[t][e.task_risk]]}):null]})]})]})]}),(0,k.jsx)(`section`,{className:`trace-overview trace-lineage`,"aria-label":t===`pt-BR`?`Identificadores vinculados`:`Linked identifiers`,children:Z.map(({label:e,value:n,onOpen:r})=>{let i=n!==null&&r!==void 0,a=e===`Task`&&n!==null,o=(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(`div`,{className:`trace-identifier-content`,children:[(0,k.jsxs)(`span`,{children:[(0,k.jsx)(v,{"aria-hidden":`true`,size:11,strokeWidth:2}),e]}),(0,k.jsx)(`strong`,{title:n??D.unlinked,children:n??D.unlinked})]}),a?(0,k.jsx)(`button`,{"aria-label":S?t===`pt-BR`?`ID da tarefa copiado`:`Task ID copied`:t===`pt-BR`?`Copiar ID da tarefa`:`Copy task ID`,className:`trace-identifier-copy`,onClick:()=>void ee(),title:S?t===`pt-BR`?`Copiado`:`Copied`:void 0,type:`button`,children:S?(0,k.jsx)(_,{"aria-hidden":`true`,size:15}):(0,k.jsx)(y,{"aria-hidden":`true`,size:15})}):null,i?(0,k.jsx)(l,{"aria-hidden":`true`,size:15,strokeWidth:1.9}):null]});return(0,k.jsx)(`article`,{"data-empty":n===null,"data-linked":n!==null,"data-navigable":i,children:i?(0,k.jsx)(`button`,{"aria-label":`${t===`pt-BR`?`Abrir`:`Open`} ${e}: ${n}`,className:`trace-identifier-navigation`,onClick:()=>r(n),type:`button`,children:o}):(0,k.jsx)(`div`,{className:`trace-identifier-static`,children:o})},e)})}),(0,k.jsxs)(`section`,{className:`trace-metrics`,"aria-label":t===`pt-BR`?`Resumo da rastreabilidade`:`Traceability summary`,children:[(0,k.jsxs)(`article`,{children:[(0,k.jsx)(`span`,{className:`trace-metric-icon`,children:(0,k.jsx)(i,{"aria-hidden":`true`,size:18})}),(0,k.jsxs)(`div`,{children:[(0,k.jsxs)(`strong`,{children:[q,`%`]}),(0,k.jsx)(`span`,{children:D.coverage})]}),(0,k.jsxs)(`small`,{children:[e.coverage.stages_with_timestamps,` `,D.of,` `,e.coverage.total_stages]})]}),(0,k.jsxs)(`article`,{children:[(0,k.jsx)(`span`,{className:`trace-metric-icon`,children:(0,k.jsx)(T,{"aria-hidden":`true`,size:18})}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`strong`,{children:e.documents.length}),(0,k.jsx)(`span`,{children:D.documents})]}),(0,k.jsx)(`small`,{children:t===`pt-BR`?`no ciclo completo`:`in the full lifecycle`})]}),(0,k.jsxs)(`article`,{children:[(0,k.jsx)(`span`,{className:`trace-metric-icon`,children:(0,k.jsx)(b,{"aria-hidden":`true`,size:18})}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`strong`,{children:e.coverage.evidence_count}),(0,k.jsx)(`span`,{children:D.evidenceMetric})]}),(0,k.jsxs)(`small`,{children:[e.coverage.test_count,` `,D.tests]})]}),(0,k.jsxs)(`article`,{children:[(0,k.jsx)(`span`,{className:`trace-metric-icon`,children:(0,k.jsx)(v,{"aria-hidden":`true`,size:18})}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`strong`,{children:X}),(0,k.jsx)(`span`,{children:t===`pt-BR`?`Vínculos`:`Links`})]}),(0,k.jsx)(`small`,{children:`Task · Change · SPEC · PRD`})]})]}),(0,k.jsx)(`div`,{className:`trace-stage-menu`,children:N.map((e,n)=>{let r=L[e],i=(W.get(e)??[]).length;return(0,k.jsxs)(`button`,{className:`trace-stage-menu-button`,"data-stage":e,onClick:()=>h(e),type:`button`,children:[(0,k.jsx)(`span`,{className:`trace-stage-number`,children:String(n+1).padStart(2,`0`)}),(0,k.jsx)(r,{className:`trace-stage-icon`,"aria-hidden":`true`,size:22,strokeWidth:1.8}),(0,k.jsx)(`strong`,{children:P[e].label}),(0,k.jsx)(`em`,{children:P[e].description}),(0,k.jsxs)(`span`,{className:`trace-stage-action`,children:[(0,k.jsxs)(`small`,{children:[(0,k.jsx)(o,{"aria-hidden":`true`,size:13}),` `,i,` `,D.items]}),(0,k.jsxs)(`span`,{children:[t===`pt-BR`?`Ver etapa`:`View stage`,(0,k.jsx)(l,{"aria-hidden":`true`,size:13,strokeWidth:2})]})]})]},e)})})]}),m?(0,k.jsx)(M,{ariaLabel:D.stageDetails,closeLabel:t===`pt-BR`?`Fechar detalhes da etapa`:`Close stage details`,onClose:()=>h(null),children:(0,k.jsx)(j,{copy:D,documents:W.get(m)??[],locale:t,onBack:()=>h(null),onOpenDocument:p,onStageChange:h,stage:m,stageArtifacts:F,stageRecord:G.get(m),stageCopy:P})}):null,f?(0,k.jsx)(A,{ariaLabel:`${D.document} ${f.title}`,closeLabel:D.closeDocument,document:f,onClose:()=>p(null)}):null]})}function K({usage:e,locale:t,copy:n}){let i=[{label:n.time,metric:e.duration_ms,value:q(e.duration_ms.value,t)},{label:n.tokens,metric:e.total_tokens,value:e.total_tokens.value===null?`—`:p(e.total_tokens.value,t)},{label:n.cost,metric:e.cost,value:e.cost.value===null||e.cost.currency===null?`—`:r(e.cost.value,e.cost.currency,t)}];return(0,k.jsx)(`section`,{"aria-label":t===`pt-BR`?`Uso agregado da Task`:`Aggregated Task usage`,children:(0,k.jsx)(`dl`,{className:`trace-usage-strip`,children:i.map(({label:t,metric:r,value:i})=>{let a=Math.round(r.coverage_ratio*100),o=`${r.known_runs}/${e.run_count} ${n.measuredRuns} · ${a}%`;return(0,k.jsxs)(`div`,{title:o,children:[(0,k.jsxs)(`dt`,{children:[t,(0,k.jsx)(`span`,{"aria-hidden":`true`,className:`trace-usage-coverage`,"data-complete":r.unknown_runs===0}),(0,k.jsx)(`span`,{className:`trace-usage-sr-only`,children:o})]}),(0,k.jsx)(`dd`,{children:i})]},t)})})})}function q(e,n){return e===null?`—`:t(e,n)}function J(e,t){if(e===null)return`—`;let n=new Date(e);return Number.isNaN(n.getTime())?`—`:new Intl.DateTimeFormat(t,{dateStyle:`short`,timeStyle:`short`}).format(n)}function Y(e,t){if(e===null)return`—`;let n=Date.parse(e);if(!Number.isFinite(n))return`—`;let r=Math.max(0,Date.now()-n),i=Math.max(1,Math.round(r/6e4)),a;if(i<60)a=`${i}m`;else{let e=Math.round(i/60);if(e<24)a=`${e}h`;else{let n=Math.round(e/24);if(n<7)a=`${n}d`;else{let e=Math.round(n/7);a=t===`pt-BR`?`${e}sem`:`${e}w`}}}return t===`pt-BR`?`Há ${a}`:`${a} ago`}export{G as n,W as t};
1
+ import{n as e}from"./rolldown-runtime-Bh1tDfsg.js";import{C as t,E as n,S as r,c as i,d as a,f as o,l as s,m as c,p as l,s as u,u as d,w as f,x as p}from"./cost-monitor-uPnOBShc.js";import{a as m,c as h,d as g,f as _,i as v,l as y,m as b,n as x,o as S,p as C,r as w,s as T,t as E,u as D}from"./icons-vendor-Hc9fp_gs.js";var O=e(n(),1),k=f();function A({ariaLabel:e,closeLabel:t,document:n,onClose:r}){return(0,k.jsxs)(`section`,{"aria-label":e,"aria-modal":`true`,className:`trace-document`,role:`dialog`,children:[(0,k.jsxs)(`header`,{children:[(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`small`,{children:n.path}),(0,k.jsx)(`h2`,{children:n.title})]}),(0,k.jsx)(`button`,{"aria-label":t,className:`trace-close-button`,onClick:r,type:`button`,children:(0,k.jsx)(u,{"aria-hidden":`true`,size:20,strokeWidth:2})})]}),(0,k.jsx)(`pre`,{children:n.content})]})}function j({stage:e,stageRecord:t,documents:n,stageCopy:r,stageArtifacts:i,copy:a,onBack:o,onOpenDocument:s,onStageChange:u}){let d=[`definition`,`planning`,`execution`,`decisions`,`verification`,`evidence`],f=d.indexOf(e),p=d[f-1],h=d[f+1],g=n.filter(e=>e.kind===`evidence`).length,_=new Set(n.map(e=>e.kind)).size,v=new Map;for(let e of n)v.set(e.kind,[...v.get(e.kind)??[],e]);let y=t?.last_recorded_at??a.pending;return(0,k.jsxs)(`section`,{className:`trace-stage-detail`,children:[(0,k.jsx)(`header`,{children:(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`p`,{children:r[e].label}),(0,k.jsx)(`h3`,{children:i[e]}),(0,k.jsx)(`small`,{children:y})]})}),(0,k.jsxs)(`div`,{className:`trace-stage-metrics`,children:[(0,k.jsxs)(`article`,{children:[(0,k.jsx)(`span`,{children:a.documents}),(0,k.jsx)(`strong`,{children:n.length})]}),(0,k.jsxs)(`article`,{children:[(0,k.jsx)(`span`,{children:a.types}),(0,k.jsx)(`strong`,{children:_})]}),(0,k.jsxs)(`article`,{children:[(0,k.jsx)(`span`,{children:a.evidenceMetric}),(0,k.jsx)(`strong`,{children:g})]})]}),(0,k.jsx)(`div`,{className:`trace-stage-documents`,children:n.length===0?(0,k.jsx)(`p`,{className:`trace-stage-empty`,children:a.empty}):[...v].map(([e,t])=>(0,k.jsxs)(`section`,{className:`trace-document-group`,children:[(0,k.jsxs)(`h4`,{children:[e,` `,(0,k.jsx)(`small`,{children:t.length})]}),t.map(e=>(0,k.jsxs)(`button`,{onClick:()=>s(e),type:`button`,children:[(0,k.jsx)(`strong`,{children:e.title}),(0,k.jsx)(`small`,{children:e.path})]},e.id))]},e))}),(0,k.jsxs)(`nav`,{"aria-label":a.navigation,className:`trace-stage-navigation`,children:[(0,k.jsxs)(`button`,{className:`trace-navigation-action trace-navigation-previous`,disabled:f===0,onClick:()=>u(d[f-1]),type:`button`,children:[(0,k.jsx)(c,{"aria-hidden":`true`,size:18,strokeWidth:1.9}),(0,k.jsxs)(`span`,{children:[(0,k.jsx)(`small`,{children:a.previous}),(0,k.jsx)(`strong`,{children:p?r[p].label.split(` (`)[0]:`—`})]})]}),(0,k.jsxs)(`div`,{className:`trace-navigation-center`,children:[(0,k.jsx)(`div`,{"aria-hidden":`true`,className:`trace-navigation-progress`,children:d.map((t,n)=>(0,k.jsx)(`span`,{"data-active":t===e,"data-passed":n<f},t))}),(0,k.jsxs)(`small`,{children:[f+1,` `,a.of,` `,d.length]}),(0,k.jsxs)(`button`,{className:`trace-all-stages-button`,onClick:o,type:`button`,children:[(0,k.jsx)(m,{"aria-hidden":`true`,size:15,strokeWidth:1.9}),a.back]})]}),(0,k.jsxs)(`button`,{className:`trace-navigation-action trace-navigation-next`,disabled:f===d.length-1,onClick:()=>u(d[f+1]),type:`button`,children:[(0,k.jsxs)(`span`,{children:[(0,k.jsx)(`small`,{children:a.next}),(0,k.jsx)(`strong`,{children:h?r[h].label.split(` (`)[0]:`—`})]}),(0,k.jsx)(l,{"aria-hidden":`true`,size:18,strokeWidth:1.9})]})]})]})}function M({ariaLabel:e,children:t,closeLabel:n,onClose:r}){return(0,O.useEffect)(()=>{let e=e=>{e.key===`Escape`&&r()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r]),(0,k.jsxs)(`div`,{className:`trace-stage-dialog-backdrop`,role:`presentation`,children:[(0,k.jsx)(`button`,{"aria-label":n,className:`trace-stage-dialog-backdrop-dismiss`,onClick:r,type:`button`}),(0,k.jsxs)(`section`,{"aria-label":e,"aria-modal":`true`,className:`trace-stage-dialog`,role:`dialog`,children:[(0,k.jsx)(`button`,{"aria-label":n,className:`trace-stage-dialog-close`,onClick:r,type:`button`,children:(0,k.jsx)(u,{"aria-hidden":`true`,size:22})}),t]})]})}var N=[`definition`,`planning`,`execution`,`decisions`,`verification`,`evidence`],P=[`task`,`change`,`spec`,`prd`],F=[`coverage`,`documents`,`evidence`,`links`],I={"pt-BR":{lite:`Leve`,standard:`Padrão`,critical:`Crítico`},"en-US":{lite:`Lite`,standard:`Standard`,critical:`Critical`}},L={definition:D,planning:d,execution:w,decisions:S,verification:x,evidence:h},R={definition:`PRD · Requisitos`,planning:`SPEC · Change`,execution:`Tarefas · DAG · Runs · arquivos`,decisions:`Decisões do planejamento e da execução`,verification:`Testes · revisões · evals · checks`,evidence:`Evidências · resultados · rastreabilidade`},z={definition:`PRD · Requirements`,planning:`SPEC · Change`,execution:`Tasks · DAG · Runs · files`,decisions:`Planning and execution decisions`,verification:`Tests · reviews · evals · checks`,evidence:`Evidence · results · traceability`};function B(e,t){return[{label:`Task`,value:e.task_id,onOpen:void 0},{label:`Change`,value:e.change_id,onOpen:t.onOpenChange},{label:`SPEC`,value:e.spec_id,onOpen:t.onOpenSpec},{label:`PRD`,value:e.prd_id,onOpen:t.onOpenPrd}]}var V={definition:{label:`Definição (PRD + Requisitos)`,description:`Objetivo, contexto e critérios que definem o trabalho.`},planning:{label:`Planejamento (SPEC + Change)`,description:`Escopo, solução e mudanças previstas antes da execução.`},execution:{label:`Execução (Tarefas ou DAG)`,description:`Tarefas, dependências da DAG, Runs e arquivos produzidos.`},decisions:{label:`Decisões (Plano e Execução)`,description:`Decisões humanas e da IA tomadas no planejamento e na execução.`},verification:{label:`Verificação (Testes + Revisões)`,description:`Testes, revisões, evals e checks comparam o resultado aos Critérios de Aceite.`},evidence:{label:`Evidências (Resultados + Rastreabilidade)`,description:`Provas reproduzíveis vinculadas às Tasks, Changes, Runs e Critérios de Aceite.`}},H={definition:{label:`Definition (PRD + Requirements)`,description:`Objective, context, and criteria that define the work.`},planning:{label:`Planning (SPEC + Change)`,description:`Scope, solution, and changes planned before execution.`},execution:{label:`Execution (Tasks or DAG)`,description:`Tasks, DAG dependencies, Runs, and produced files.`},decisions:{label:`Decisions (Plan and Execution)`,description:`Human and AI decisions made during planning and execution.`},verification:{label:`Verification (Tests + Reviews)`,description:`Tests, reviews, evals, and checks compare results with acceptance criteria.`},evidence:{label:`Evidence (Results + Traceability)`,description:`Reproducible proof linked to Tasks, Changes, Runs, and acceptance criteria.`}},U={"pt-BR":{aria:`Rastreabilidade da task`,coverage:`etapas rastreadas`,evidence:`evidências`,close:`Fechar`,empty:`Nenhum documento relacionado.`,closeDocument:`Fechar documento`,back:`Voltar às etapas`,previous:`Anterior`,next:`Próxima`,documents:`Documentos`,types:`Tipos`,evidenceMetric:`Evidências`,taskFirst:`Task-first`,specDriven:`Spec-driven`,copyId:`Copiar ID`,copied:`ID copiado`,unlinked:`Não vinculado`,recorded:`Registrada em`,pending:`Pendente`,missingTimestamp:`Sem data/hora`,tests:`testes registrados`,time:`Tempo`,tokens:`Tokens`,cost:`Custo`,measuredRuns:`Runs medidas`,items:`itens`,navigation:`Navegação entre etapas`,of:`de`,stageDetails:`Detalhes da etapa`,document:`Documento`},"en-US":{aria:`Task traceability`,coverage:`tracked stages`,evidence:`evidence items`,close:`Close`,empty:`No related document.`,closeDocument:`Close document`,back:`Back to stages`,previous:`Previous`,next:`Next`,documents:`Documents`,types:`Types`,evidenceMetric:`Evidence`,taskFirst:`Task-first`,specDriven:`Spec-driven`,copyId:`Copy ID`,copied:`ID copied`,unlinked:`Not linked`,recorded:`Recorded at`,pending:`Pending`,missingTimestamp:`Missing date/time`,tests:`recorded tests`,time:`Time`,tokens:`Tokens`,cost:`Cost`,measuredRuns:`measured Runs`,items:`items`,navigation:`Stage navigation`,of:`of`,stageDetails:`Stage details`,document:`Document`}};function W({taskId:e,locale:t=`pt-BR`}){let n=t===`pt-BR`;return(0,k.jsx)(`div`,{className:`trace-backdrop`,children:(0,k.jsxs)(`section`,{"aria-busy":`true`,"aria-label":n?`Carregando rastreabilidade`:`Loading traceability`,"aria-live":`polite`,className:`trace-panel trace-loading-panel`,role:`dialog`,children:[(0,k.jsxs)(`header`,{className:`trace-panel-header`,children:[(0,k.jsxs)(`div`,{className:`trace-heading`,children:[(0,k.jsx)(`span`,{className:`trace-heading-icon trace-loading-icon`,"aria-hidden":`true`,children:(0,k.jsx)(s,{size:22,strokeWidth:1.8})}),(0,k.jsxs)(`div`,{className:`trace-task-summary-content`,children:[(0,k.jsx)(`h2`,{children:n?`Carregando rastreabilidade`:`Loading traceability`}),(0,k.jsx)(`p`,{children:e})]})]}),(0,k.jsxs)(`span`,{className:`trace-loading-status`,children:[(0,k.jsx)(s,{"aria-hidden":`true`,size:15,strokeWidth:2}),n?`Preparando trace`:`Preparing trace`]})]}),(0,k.jsx)(`div`,{className:`trace-loading-identifiers`,"aria-hidden":`true`,children:P.map(e=>(0,k.jsx)(`span`,{},e))}),(0,k.jsx)(`div`,{className:`trace-loading-metrics`,"aria-hidden":`true`,children:F.map(e=>(0,k.jsx)(`span`,{},e))}),(0,k.jsx)(`div`,{className:`trace-loading-stages`,"aria-hidden":`true`,children:N.map(e=>(0,k.jsx)(`span`,{},e))})]})})}function G({trace:e,locale:t=`pt-BR`,onClose:n,onOpenChange:r,onOpenPrd:s,onOpenSpec:c,embedded:d=!1}){let[f,p]=(0,O.useState)(null),[m,h]=(0,O.useState)(null),[S,w]=(0,O.useState)(!1),D=U[t],P=t===`en-US`?H:V,F=t===`en-US`?z:R,W=(0,O.useMemo)(()=>new Map(N.map(t=>[t,e.documents.filter(e=>e.stage===t)])),[e.documents]),G=(0,O.useMemo)(()=>new Map(e.stages.map(e=>[e.stage,e])),[e.stages]),q=Math.round(e.coverage.stages_with_timestamps/e.coverage.total_stages*100),X=[e.task_id,e.change_id,e.spec_id,e.prd_id].filter(Boolean).length,Z=B(e,{onOpenChange:r,onOpenPrd:s,onOpenSpec:c}),Q=J(e.task_created_at,t),$=Y(e.task_created_at,t),ee=async()=>{try{await navigator.clipboard.writeText(e.task_id),w(!0),window.setTimeout(()=>w(!1),2e3)}catch{w(!1)}};return(0,k.jsxs)(`div`,{className:d?`trace-embedded`:`trace-backdrop`,children:[(0,k.jsxs)(`section`,{"aria-label":D.aria,"aria-modal":d?void 0:`true`,className:`trace-panel`,role:`dialog`,children:[(0,k.jsxs)(`header`,{className:`trace-panel-header`,children:[(0,k.jsxs)(`div`,{className:`trace-heading`,children:[(0,k.jsx)(`span`,{className:`trace-heading-icon`,"aria-hidden":`true`,children:(0,k.jsx)(i,{size:22,strokeWidth:1.8})}),(0,k.jsxs)(`div`,{className:`trace-task-summary-content`,children:[(0,k.jsx)(`div`,{className:`trace-heading-title`,children:(0,k.jsxs)(`h2`,{children:[(0,k.jsx)(`span`,{className:`trace-title-prefix`,children:`Trace:`}),` `,e.task_title||e.task_id]})}),(0,k.jsx)(`p`,{children:t===`pt-BR`?`Visão completa do ciclo de desenvolvimento`:`Complete development lifecycle view`})]})]}),(0,k.jsxs)(`div`,{className:`trace-header-actions`,children:[(0,k.jsx)(K,{copy:D,locale:t,usage:e.usage}),d?null:(0,k.jsx)(`button`,{className:`trace-close-button`,"aria-label":D.close,onClick:n,type:`button`,children:(0,k.jsx)(u,{"aria-hidden":`true`,size:20,strokeWidth:2})})]})]}),(0,k.jsxs)(`section`,{className:`trace-task-summary`,"aria-label":t===`pt-BR`?`Resumo da tarefa`:`Task summary`,children:[(0,k.jsxs)(`article`,{children:[(0,k.jsx)(C,{"aria-hidden":`true`,size:17,strokeWidth:1.8}),(0,k.jsxs)(`div`,{className:`trace-task-summary-content`,children:[(0,k.jsx)(`span`,{children:t===`pt-BR`?`Criada em`:`Created at`}),(0,k.jsx)(`strong`,{children:Q})]})]}),(0,k.jsxs)(`article`,{children:[(0,k.jsx)(a,{"aria-hidden":`true`,size:17,strokeWidth:1.8}),(0,k.jsxs)(`div`,{className:`trace-task-summary-content`,children:[(0,k.jsx)(`span`,{children:t===`pt-BR`?`Desde a criação`:`Since creation`}),(0,k.jsx)(`strong`,{children:$})]})]}),(0,k.jsxs)(`article`,{className:`trace-task-progress`,children:[(0,k.jsx)(g,{"aria-hidden":`true`,size:17,strokeWidth:1.8}),(0,k.jsxs)(`div`,{className:`trace-task-summary-content trace-task-progress-content`,children:[(0,k.jsx)(`span`,{children:t===`pt-BR`?`Progresso`:`Progress`}),(0,k.jsxs)(`strong`,{children:[e.task_progress,`%`]}),(0,k.jsx)(`progress`,{max:100,value:e.task_progress})]})]}),(0,k.jsxs)(`article`,{className:`trace-task-classification`,children:[(0,k.jsx)(b,{"aria-hidden":`true`,size:17,strokeWidth:1.8}),(0,k.jsxs)(`div`,{className:`trace-task-summary-content`,children:[(0,k.jsx)(`span`,{children:t===`pt-BR`?`Classificação`:`Classification`}),(0,k.jsxs)(`div`,{className:`trace-task-badges`,children:[(0,k.jsxs)(`span`,{className:`trace-mode-badge`,children:[(0,k.jsx)(E,{"aria-hidden":`true`,size:12,strokeWidth:2}),e.spec_id===null?D.taskFirst:D.specDriven]}),e.task_risk?(0,k.jsxs)(`span`,{className:`trace-risk-badge`,"data-risk":e.task_risk,children:[(0,k.jsx)(x,{"aria-hidden":`true`,size:12,strokeWidth:2}),I[t][e.task_risk]]}):null]})]})]})]}),(0,k.jsx)(`section`,{className:`trace-overview trace-lineage`,"aria-label":t===`pt-BR`?`Identificadores vinculados`:`Linked identifiers`,children:Z.map(({label:e,value:n,onOpen:r})=>{let i=n!==null&&r!==void 0,a=e===`Task`&&n!==null,o=(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(`div`,{className:`trace-identifier-content`,children:[(0,k.jsxs)(`span`,{children:[(0,k.jsx)(v,{"aria-hidden":`true`,size:11,strokeWidth:2}),e]}),(0,k.jsx)(`strong`,{title:n??D.unlinked,children:n??D.unlinked})]}),a?(0,k.jsx)(`button`,{"aria-label":S?t===`pt-BR`?`ID da tarefa copiado`:`Task ID copied`:t===`pt-BR`?`Copiar ID da tarefa`:`Copy task ID`,className:`trace-identifier-copy`,onClick:()=>void ee(),title:S?t===`pt-BR`?`Copiado`:`Copied`:void 0,type:`button`,children:S?(0,k.jsx)(_,{"aria-hidden":`true`,size:15}):(0,k.jsx)(y,{"aria-hidden":`true`,size:15})}):null,i?(0,k.jsx)(l,{"aria-hidden":`true`,size:15,strokeWidth:1.9}):null]});return(0,k.jsx)(`article`,{"data-empty":n===null,"data-linked":n!==null,"data-navigable":i,children:i?(0,k.jsx)(`button`,{"aria-label":`${t===`pt-BR`?`Abrir`:`Open`} ${e}: ${n}`,className:`trace-identifier-navigation`,onClick:()=>r(n),type:`button`,children:o}):(0,k.jsx)(`div`,{className:`trace-identifier-static`,children:o})},e)})}),(0,k.jsxs)(`section`,{className:`trace-metrics`,"aria-label":t===`pt-BR`?`Resumo da rastreabilidade`:`Traceability summary`,children:[(0,k.jsxs)(`article`,{children:[(0,k.jsx)(`span`,{className:`trace-metric-icon`,children:(0,k.jsx)(i,{"aria-hidden":`true`,size:18})}),(0,k.jsxs)(`div`,{children:[(0,k.jsxs)(`strong`,{children:[q,`%`]}),(0,k.jsx)(`span`,{children:D.coverage})]}),(0,k.jsxs)(`small`,{children:[e.coverage.stages_with_timestamps,` `,D.of,` `,e.coverage.total_stages]})]}),(0,k.jsxs)(`article`,{children:[(0,k.jsx)(`span`,{className:`trace-metric-icon`,children:(0,k.jsx)(T,{"aria-hidden":`true`,size:18})}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`strong`,{children:e.documents.length}),(0,k.jsx)(`span`,{children:D.documents})]}),(0,k.jsx)(`small`,{children:t===`pt-BR`?`no ciclo completo`:`in the full lifecycle`})]}),(0,k.jsxs)(`article`,{children:[(0,k.jsx)(`span`,{className:`trace-metric-icon`,children:(0,k.jsx)(b,{"aria-hidden":`true`,size:18})}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`strong`,{children:e.coverage.evidence_count}),(0,k.jsx)(`span`,{children:D.evidenceMetric})]}),(0,k.jsxs)(`small`,{children:[e.coverage.test_count,` `,D.tests]})]}),(0,k.jsxs)(`article`,{children:[(0,k.jsx)(`span`,{className:`trace-metric-icon`,children:(0,k.jsx)(v,{"aria-hidden":`true`,size:18})}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`strong`,{children:X}),(0,k.jsx)(`span`,{children:t===`pt-BR`?`Vínculos`:`Links`})]}),(0,k.jsx)(`small`,{children:`Task · Change · SPEC · PRD`})]})]}),(0,k.jsx)(`div`,{className:`trace-stage-menu`,children:N.map((e,n)=>{let r=L[e],i=(W.get(e)??[]).length;return(0,k.jsxs)(`button`,{className:`trace-stage-menu-button`,"data-stage":e,onClick:()=>h(e),type:`button`,children:[(0,k.jsx)(`span`,{className:`trace-stage-number`,children:String(n+1).padStart(2,`0`)}),(0,k.jsx)(r,{className:`trace-stage-icon`,"aria-hidden":`true`,size:22,strokeWidth:1.8}),(0,k.jsx)(`strong`,{children:P[e].label}),(0,k.jsx)(`em`,{children:P[e].description}),(0,k.jsxs)(`span`,{className:`trace-stage-action`,children:[(0,k.jsxs)(`small`,{children:[(0,k.jsx)(o,{"aria-hidden":`true`,size:13}),` `,i,` `,D.items]}),(0,k.jsxs)(`span`,{children:[t===`pt-BR`?`Ver etapa`:`View stage`,(0,k.jsx)(l,{"aria-hidden":`true`,size:13,strokeWidth:2})]})]})]},e)})})]}),m?(0,k.jsx)(M,{ariaLabel:D.stageDetails,closeLabel:t===`pt-BR`?`Fechar detalhes da etapa`:`Close stage details`,onClose:()=>h(null),children:(0,k.jsx)(j,{copy:D,documents:W.get(m)??[],locale:t,onBack:()=>h(null),onOpenDocument:p,onStageChange:h,stage:m,stageArtifacts:F,stageRecord:G.get(m),stageCopy:P})}):null,f?(0,k.jsx)(A,{ariaLabel:`${D.document} ${f.title}`,closeLabel:D.closeDocument,document:f,onClose:()=>p(null)}):null]})}function K({usage:e,locale:t,copy:n}){let i=[{label:n.time,metric:e.duration_ms,value:q(e.duration_ms.value,t)},{label:n.tokens,metric:e.total_tokens,value:e.total_tokens.value===null?`—`:p(e.total_tokens.value,t)},{label:n.cost,metric:e.cost,value:e.cost.value===null||e.cost.currency===null?`—`:r(e.cost.value,e.cost.currency,t)}];return(0,k.jsx)(`section`,{"aria-label":t===`pt-BR`?`Uso agregado da Task`:`Aggregated Task usage`,children:(0,k.jsx)(`dl`,{className:`trace-usage-strip`,children:i.map(({label:t,metric:r,value:i})=>{let a=Math.round(r.coverage_ratio*100),o=`${r.known_runs}/${e.run_count} ${n.measuredRuns} · ${a}%`;return(0,k.jsxs)(`div`,{title:o,children:[(0,k.jsxs)(`dt`,{children:[t,(0,k.jsx)(`span`,{"aria-hidden":`true`,className:`trace-usage-coverage`,"data-complete":r.unknown_runs===0}),(0,k.jsx)(`span`,{className:`trace-usage-sr-only`,children:o})]}),(0,k.jsx)(`dd`,{children:i})]},t)})})})}function q(e,n){return e===null?`—`:t(e,n)}function J(e,t){if(e===null)return`—`;let n=new Date(e);return Number.isNaN(n.getTime())?`—`:new Intl.DateTimeFormat(t,{dateStyle:`short`,timeStyle:`short`}).format(n)}function Y(e,t){if(e===null)return`—`;let n=Date.parse(e);if(!Number.isFinite(n))return`—`;let r=Math.max(0,Date.now()-n),i=Math.max(1,Math.round(r/6e4)),a;if(i<60)a=`${i}m`;else{let e=Math.round(i/60);if(e<24)a=`${e}h`;else{let n=Math.round(e/24);if(n<7)a=`${n}d`;else{let e=Math.round(n/7);a=t===`pt-BR`?`${e}sem`:`${e}w`}}}return t===`pt-BR`?`Há ${a}`:`${a} ago`}export{G as n,W as t};
@@ -6,12 +6,12 @@
6
6
  <meta name="color-scheme" content="dark light" />
7
7
  <link rel="icon" type="image/png" href="/icon_zaip.png" />
8
8
  <title>Dashboard Zaip AIOS</title>
9
- <script type="module" crossorigin src="/assets/index-qVSJnJ0_.js"></script>
9
+ <script type="module" crossorigin src="/assets/index-BqeOEZW5.js"></script>
10
10
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-Bh1tDfsg.js">
11
- <link rel="modulepreload" crossorigin href="/assets/cost-monitor-Co2Jiuzh.js">
12
- <link rel="modulepreload" crossorigin href="/assets/react-vendor-CkPC-yMz.js">
13
- <link rel="modulepreload" crossorigin href="/assets/icons-vendor-DOhy6D2-.js">
14
- <link rel="modulepreload" crossorigin href="/assets/traceability-BEdGoIDm.js">
11
+ <link rel="modulepreload" crossorigin href="/assets/cost-monitor-uPnOBShc.js">
12
+ <link rel="modulepreload" crossorigin href="/assets/react-vendor-C9ta_O10.js">
13
+ <link rel="modulepreload" crossorigin href="/assets/icons-vendor-Hc9fp_gs.js">
14
+ <link rel="modulepreload" crossorigin href="/assets/traceability-IcefoTOv.js">
15
15
  <link rel="stylesheet" crossorigin href="/assets/cost-monitor-C2AFYBu_.css">
16
16
  <link rel="stylesheet" crossorigin href="/assets/traceability-DFY7ZDlu.css">
17
17
  <link rel="stylesheet" crossorigin href="/assets/index-DZhppOIk.css">
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zaip-ai/dashboard-frontend",
3
- "version": "4.9.0",
3
+ "version": "5.0.0",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "scripts": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zaip-ai/dashboard-cost-monitor",
3
- "version": "4.9.0",
3
+ "version": "5.0.0",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": {
@@ -69,7 +69,7 @@ export interface CostRunRow {
69
69
  run_id: string;
70
70
  /** Lifecycle Execution that owns this Run, retained for the Executions tab period filter. */
71
71
  execution_id: string | null;
72
- conversation_id: string;
72
+ conversation_id: string | null;
73
73
  task_id: string | null;
74
74
  task_title: string;
75
75
  task_status: string;
@@ -81,7 +81,14 @@ export interface CostRunRow {
81
81
  parent_run_id: string | null;
82
82
  run_role: "intake" | "orchestrator" | "subagent";
83
83
  run_kind: "run" | "subrun";
84
- run_purpose: "intake" | "orchestration" | "execution" | "review" | "audit" | "finalization";
84
+ run_purpose:
85
+ | "observation"
86
+ | "intake"
87
+ | "orchestration"
88
+ | "execution"
89
+ | "review"
90
+ | "audit"
91
+ | "finalization";
85
92
  requires_finalizer: boolean;
86
93
  client: string;
87
94
  agent: string;
@@ -95,7 +102,7 @@ export interface CostRunRow {
95
102
  call_count: number | null;
96
103
  status: string;
97
104
  phase: string;
98
- origin: "conversation" | "task" | "spec" | "prd";
105
+ origin: "observation" | "conversation" | "task" | "spec" | "prd";
99
106
  work_type: "new" | "rework";
100
107
  started_at: string;
101
108
  finished_at: string | null;
@@ -1,5 +1,5 @@
1
1
  import { describe, expect, it } from "vitest";
2
- import { loadCostMonitorRunPage } from "./CostFilters.js";
2
+ import { emptyCostFilters, loadCostMonitorRunPage } from "./CostFilters.js";
3
3
 
4
4
  describe("Cost Monitor invocation page loading", () => {
5
5
  it("uses a ten-row default for the remote invocation page", async () => {
@@ -7,6 +7,7 @@ describe("Cost Monitor invocation page loading", () => {
7
7
  await loadCostMonitorRunPage({
8
8
  currency: "BRL",
9
9
  offset: 0,
10
+ filters: { ...emptyCostFilters, query: "target title" },
10
11
  fetcher: async (url) => {
11
12
  calls.push(String(url));
12
13
  return new Response(JSON.stringify({ runs: [] }), { status: 200 });
@@ -14,5 +15,8 @@ describe("Cost Monitor invocation page loading", () => {
14
15
  });
15
16
 
16
17
  expect(new URL(calls[0]!, "http://dashboard.local").searchParams.get("limit")).toBe("10");
18
+ expect(new URL(calls[0]!, "http://dashboard.local").searchParams.get("query")).toBe(
19
+ "target title",
20
+ );
17
21
  });
18
22
  });
@@ -22,7 +22,7 @@ const unavailableGroup = {
22
22
  } as const;
23
23
 
24
24
  describe("period group values", () => {
25
- it("discloses presentation zero without changing null sorting", () => {
25
+ it("preserves unavailable tokens alongside disclosed presentation zeros and null sorting", () => {
26
26
  const table = CostGroupsTable({
27
27
  rows: [unavailableGroup],
28
28
  currency: "BRL",
@@ -53,7 +53,7 @@ describe("period group values", () => {
53
53
  );
54
54
  expect([duration.props.children, tokens.props.children, cost.props.children]).toEqual([
55
55
  "0",
56
- "0",
56
+ "—",
57
57
  formatAuditableCurrency(0, "BRL", "pt-BR"),
58
58
  ]);
59
59
  expect(
@@ -179,7 +179,7 @@ describe("grouped cost availability", () => {
179
179
  ).toBe("0");
180
180
  expect(
181
181
  columns.find((column) => column.key === "cost")?.render?.({ ...model, estimated_brl: null }),
182
- ).toBe("0");
182
+ ).toBe("—");
183
183
  expect(
184
184
  columns
185
185
  .find((column) => column.key === "tokens")
@@ -324,14 +324,14 @@ describe("grouped cost availability", () => {
324
324
  expect(column(key)?.description).toContain("projeção SQLite/API");
325
325
  expect(column(key)?.hidden).not.toBe(true);
326
326
  }
327
- expect(column("duration")?.render?.(unavailableRun)).toBe("0");
328
- expect(column("inputTokens")?.render?.(unavailableRun)).toBe("0");
327
+ expect(column("duration")?.render?.(unavailableRun)).toBe("—");
328
+ expect(column("inputTokens")?.render?.(unavailableRun)).toBe("—");
329
329
  expect(column("inputRate")?.render?.(unavailableRun)).toBe("0,00");
330
330
  expect(column("contextMultiplier")?.render?.(unavailableRun)).toBe("0");
331
331
  expect(column("inputCost")?.render?.(unavailableRun)).toContain("0,00");
332
332
  expect(column("fxRate")?.render?.(unavailableRun)).toBe("R$ 0,00");
333
- expect(column("recordedBrl")?.render?.(unavailableRun)).toBe("0");
334
- expect(column("cost")?.render?.(unavailableRun)).toBe("0");
333
+ expect(column("recordedBrl")?.render?.(unavailableRun)).toBe("—");
334
+ expect(column("cost")?.render?.(unavailableRun)).toBe("—");
335
335
  });
336
336
  it("provides a clear scroll label for the detailed Runs table", () => {
337
337
  expect(costRunsScrollLabel("pt-BR")).toBe(
@@ -76,10 +76,13 @@ describe("date time formatting", () => {
76
76
  });
77
77
  });
78
78
  describe("formatAuditableNumber", () => {
79
- it("renders unavailable numeric metrics as presentation zero", () => {
80
- expect(formatAuditableNumber(null, "pt-BR")).toBe("0");
81
- expect(formatAuditableNumber(null, "en-US")).toBe("0");
79
+ it("distinguishes unavailable numeric metrics from an observed zero", () => {
80
+ expect(formatAuditableNumber(null, "pt-BR")).toBe("—");
81
+ expect(formatAuditableNumber(null, "en-US")).toBe("—");
82
82
  expect(formatAuditableNumber(0, "pt-BR")).toBe("0");
83
+ expect(formatAuditableCompactNumber(null, "pt-BR")).toBe("—");
84
+ expect(formatAuditableCurrency(null, "BRL", "pt-BR")).toBe("—");
85
+ expect(formatAuditableDuration(null, "pt-BR")).toBe("—");
83
86
  });
84
87
  it("keeps observed positive values", () => {
85
88
  expect(formatAuditableNumber(1234, "pt-BR")).toBe("1.234");
@@ -107,12 +110,12 @@ describe("monetary formatting", () => {
107
110
  expect(ratio(106.73, 19.583444)).toBeCloseTo(5.45, 2);
108
111
  expect(ratio(100, 0)).toBeNull();
109
112
  });
110
- it("shows zero for unmeasured metrics without changing their source values", () => {
113
+ it("preserves unavailable values separately from observed zero", () => {
111
114
  expect(formatRate(null, "pt-BR")).toBe("0,00");
112
115
  expect(formatUsd(null, "en-US")).toContain("0.00");
113
- expect(formatAuditableCurrency(null, "BRL", "pt-BR")).toBe("0");
114
- expect(formatAuditableDuration(null, "pt-BR")).toBe("0");
115
- expect(formatAuditableCompactNumber(null, "pt-BR")).toBe("0");
116
+ expect(formatAuditableCurrency(null, "BRL", "pt-BR")).toBe("—");
117
+ expect(formatAuditableDuration(null, "pt-BR")).toBe("—");
118
+ expect(formatAuditableCompactNumber(null, "pt-BR")).toBe("—");
116
119
  });
117
120
  });
118
121
  describe("duration coverage", () => {
@@ -143,14 +146,14 @@ describe("duration coverage", () => {
143
146
  1_100,
144
147
  "pt-BR",
145
148
  ),
146
- ).toBe(formatAuditableDuration(null, "pt-BR"));
149
+ ).toBe("0");
147
150
  expect(
148
151
  formatTokenBackedDuration(
149
152
  { known_sum: 0, unknown: 2, complete: false, coverage_ratio: 0 },
150
153
  null,
151
154
  "pt-BR",
152
155
  ),
153
- ).toBe(formatAuditableDuration(null, "pt-BR"));
156
+ ).toBe("0");
154
157
  });
155
158
  });
156
159
  describe("runtime availability", () => {
@@ -185,27 +188,26 @@ describe("grouped cost availability", () => {
185
188
  duration: { known_sum: 0, unknown: 2, complete: false, coverage_ratio: 0 },
186
189
  coverage: { events: 2, tokens: 0, usd: 0, brl: 0 },
187
190
  } as const;
191
+ const completeDeveloperRow = {
192
+ account_id: "42",
193
+ login_snapshot: "dev-42",
194
+ prd_count: 1,
195
+ spec_count: 2,
196
+ task_count: 3,
197
+ run_count: 4,
198
+ test_count: null,
199
+ evidence_count: null,
200
+ total_duration_ms: 60_000,
201
+ total_tokens: 50,
202
+ total_cost_brl: 1.5,
203
+ duration_covered_runs: 4,
204
+ token_covered_runs: 4,
205
+ brl_covered_runs: 4,
206
+ } satisfies CostDeveloperAttributionRow;
188
207
  it("uses the requested Cost Monitor developer metric columns without Operations source or coverage", () => {
189
208
  const table = CostDeveloperAttributionTable({
190
209
  locale: "pt-BR",
191
- rows: [
192
- {
193
- account_id: "42",
194
- login_snapshot: "dev-42",
195
- prd_count: 1,
196
- spec_count: 2,
197
- task_count: 3,
198
- run_count: 4,
199
- test_count: null,
200
- evidence_count: null,
201
- total_duration_ms: 60_000,
202
- total_tokens: 50,
203
- total_cost_brl: 1.5,
204
- duration_covered_runs: 4,
205
- token_covered_runs: 4,
206
- brl_covered_runs: 4,
207
- },
208
- ],
210
+ rows: [completeDeveloperRow],
209
211
  });
210
212
  const columns = table.props.columns as Array<{
211
213
  key: string;
@@ -246,17 +248,7 @@ describe("grouped cost availability", () => {
246
248
  });
247
249
  it("marks incomplete aggregates in place without adding source or coverage columns", () => {
248
250
  const partial = {
249
- account_id: "42",
250
- login_snapshot: "dev-42",
251
- prd_count: 1,
252
- spec_count: 2,
253
- task_count: 3,
254
- run_count: 4,
255
- test_count: null,
256
- evidence_count: null,
257
- total_duration_ms: 60_000,
258
- total_tokens: 50,
259
- total_cost_brl: 1.5,
251
+ ...completeDeveloperRow,
260
252
  duration_covered_runs: 3,
261
253
  token_covered_runs: 2,
262
254
  brl_covered_runs: 2,
@@ -348,12 +340,12 @@ describe("grouped cost availability", () => {
348
340
  const column = (key: string) => columns.find((candidate) => candidate.key === key);
349
341
  expect(table.props.scrollLabel).toBe(costGroupsScrollLabel("pt-BR"));
350
342
  expect(column("duration")?.render(unavailableGroup)).toBe("0");
351
- expect(column("tokens")?.render(unavailableGroup)).toBe("0");
352
- expect(column("cost")?.render(unavailableGroup)).toBe("0");
343
+ expect(column("tokens")?.render(unavailableGroup)).toBe("—");
344
+ expect(column("cost")?.render(unavailableGroup)).toBe("—");
353
345
  expect(column("duration")?.sortValue?.(unavailableGroup)).toBeNull();
354
346
  expect(column("tokens")?.sortValue?.(unavailableGroup)).toBeNull();
355
347
  expect(column("cost")?.sortValue?.(unavailableGroup)).toBeNull();
356
- const totalSummary = "Total geral — Tempo: 0; Tokens: 0; BRL: 0";
348
+ const totalSummary = "Total geral — Tempo: 0; Tokens: —; BRL: —";
357
349
  const footerLabel = (key: string) => {
358
350
  const footer = column(key)?.footer as { props?: { "aria-label"?: string } } | undefined;
359
351
  return footer?.props?.["aria-label"];
@@ -450,10 +442,11 @@ describe("grouped cost availability", () => {
450
442
  render?: (row: CostGroupRow) => unknown;
451
443
  footer?: unknown;
452
444
  }>;
453
- for (const key of ["tasks", "prds", "specs", "tests", "evidences", "tokens"]) {
445
+ for (const key of ["tasks", "prds", "specs", "tests", "evidences"]) {
454
446
  expect(columns.find((c) => c.key === key)?.render?.(missing)).toBe("0");
455
447
  }
448
+ expect(columns.find((c) => c.key === "tokens")?.render?.(missing)).toBe("—");
456
449
  expect(columns.find((c) => c.key === "duration")?.render?.(missing)).toBe("0");
457
- expect(columns.find((c) => c.key === "cost")?.render?.(missing)).toBe("0");
450
+ expect(columns.find((c) => c.key === "cost")?.render?.(missing)).toBe("—");
458
451
  });
459
452
  });
@@ -167,6 +167,7 @@ function costMonitorQuery({
167
167
  ["status", filters.status],
168
168
  ] as const;
169
169
  for (const [key, value] of manifestFilters) if (value) query.set(key, value);
170
+ if (filters.query) query.set("query", filters.query);
170
171
  }
171
172
  if (refresh) query.set("refresh", refresh);
172
173
  return query;
@@ -18,7 +18,9 @@ export function displayCostGroupLabel(label: string, locale: CostLocale): string
18
18
  }
19
19
 
20
20
  export function formatAuditableNumber(value: number | null, locale: CostLocale): string {
21
- return new Intl.NumberFormat(locale, { maximumFractionDigits: 0 }).format(value ?? 0);
21
+ return value === null
22
+ ? "—"
23
+ : new Intl.NumberFormat(locale, { maximumFractionDigits: 0 }).format(value);
22
24
  }
23
25
 
24
26
  export function formatFactualCount(value: number | null, locale: CostLocale): string {
@@ -26,7 +28,7 @@ export function formatFactualCount(value: number | null, locale: CostLocale): st
26
28
  }
27
29
 
28
30
  export function formatAuditableCompactNumber(value: number | null, locale: CostLocale): string {
29
- return formatCompactNumber(value ?? 0, locale);
31
+ return value === null ? "—" : formatCompactNumber(value, locale);
30
32
  }
31
33
 
32
34
  export function formatAuditableCurrency(
@@ -34,12 +36,12 @@ export function formatAuditableCurrency(
34
36
  currency: CostCurrency,
35
37
  locale: CostLocale,
36
38
  ): string {
37
- if (value === null) return "0";
39
+ if (value === null) return "—";
38
40
  return formatCurrency(value, currency, locale);
39
41
  }
40
42
 
41
43
  export function formatAuditableDuration(value: number | null, locale: CostLocale): string {
42
- if (value === null) return "0";
44
+ if (value === null) return "—";
43
45
  return value === 0 ? "0" : formatDurationMs(value, locale);
44
46
  }
45
47
 
@@ -10,11 +10,11 @@ import {
10
10
 
11
11
  export function aggregateRows(
12
12
  rows: readonly CostRunRow[],
13
- select: (row: CostRunRow) => string,
13
+ select: (row: CostRunRow) => string | null,
14
14
  label: (key: string) => string = (key) => key,
15
15
  durationScope: DurationAggregationScope = "all_invocations",
16
16
  ): CostGroupRow[] {
17
- const keys = [...new Set(rows.map(select))];
17
+ const keys = [...new Set(rows.map(select).filter((key): key is string => key !== null))];
18
18
  const durationContributorIds = new Set(
19
19
  durationAggregationRows(rows, durationScope).map((row) => row.run_id),
20
20
  );
@@ -81,7 +81,7 @@ export function buildCostMonitorProjection(
81
81
  execution_id: run.execution_id,
82
82
  conversation_id: run.conversation_id,
83
83
  task_id: run.task_id,
84
- task_title: task?.title ?? run.task_id ?? run.conversation_id,
84
+ task_title: task?.title ?? run.task_id ?? run.conversation_id ?? run.id,
85
85
  task_status: task?.status ?? run.status,
86
86
  priority: task?.priority ?? "none",
87
87
  risk: task?.risk ?? "none",
@@ -1,7 +1,6 @@
1
1
  import type {
2
2
  OperationsProjection,
3
3
  RunProjection,
4
- UsageMetricProjection,
5
4
  UsageProjection,
6
5
  } from "@zaip-ai/dashboard-operations/contracts";
7
6
  import {
@@ -16,6 +15,7 @@ import {
16
15
  } from "@zaip-ai/dashboard-operations/server";
17
16
  import type { CostGroupRow, CostMonitorProjection } from "../contracts.js";
18
17
  import { buildCostMonitorProjection, usageForRuns } from "./build-cost-monitor-projection.js";
18
+ import { emptyOrigins } from "./cost-summary-defaults.js";
19
19
 
20
20
  /** Fast Cost Monitor first fold backed only by the durable lifecycle summary. */
21
21
  export function buildCostSummaryProjection(
@@ -288,6 +288,8 @@ export interface CostSummarySource {
288
288
  >;
289
289
  run_metrics?: Array<{
290
290
  id: string;
291
+ entrypoint?: string | null;
292
+ run_purpose?: string | null;
291
293
  started_at: string;
292
294
  finished_at: string | null;
293
295
  task_id: string | null;
@@ -366,11 +368,16 @@ function summaryRunProjection(
366
368
  ? run.status
367
369
  : "completed",
368
370
  phase,
369
- entrypoint: run.task_id === null ? "conversation" : "task",
371
+ entrypoint:
372
+ run.entrypoint === "observation"
373
+ ? "observation"
374
+ : run.task_id === null
375
+ ? "conversation"
376
+ : "task",
370
377
  work_type: "new",
371
378
  run_role: run.run_kind === "subrun" ? "subagent" : "orchestrator",
372
379
  run_kind: run.run_kind ?? "run",
373
- run_purpose: "execution",
380
+ run_purpose: run.run_purpose === "observation" ? "observation" : "execution",
374
381
  requires_finalizer: false,
375
382
  parent_run_id: run.parent_run_id,
376
383
  client: "unknown",
@@ -386,7 +393,7 @@ function summaryRunProjection(
386
393
  terminal_call_count: null,
387
394
  failed_call_count: 0,
388
395
  cancelled_call_count: 0,
389
- conversation_id: run.conversation_id ?? run.id,
396
+ conversation_id: run.entrypoint === "observation" ? null : (run.conversation_id ?? run.id),
390
397
  execution_id: run.execution_id ?? null,
391
398
  task_id: run.task_id,
392
399
  spec_id: run.spec_id ?? null,
@@ -739,24 +746,3 @@ function knownRuns(eligibleRuns: number, unknownRuns: number): number {
739
746
  function runPopulation(eligible_runs: number, known_runs: number) {
740
747
  return { eligible_runs, known_runs, unknown_runs: eligible_runs - known_runs };
741
748
  }
742
-
743
- function emptyMetric(): UsageMetricProjection {
744
- return {
745
- events: 0,
746
- tokens: { input: null, cached_input: null, output: null, reasoning: null, total: null },
747
- cost: { usd: null, brl: null },
748
- coverage: { events: 0, tokens: 0, usd: 0, brl: 0 },
749
- };
750
- }
751
-
752
- function emptyOrigins(): CostMonitorProjection["origins"] {
753
- const usage = (): UsageProjection => ({
754
- conversation: emptyMetric(),
755
- planning: emptyMetric(),
756
- execution: emptyMetric(),
757
- total: emptyMetric(),
758
- new_work: emptyMetric(),
759
- rework: emptyMetric(),
760
- });
761
- return { conversation: usage(), task: usage(), spec: usage(), prd: usage() };
762
- }
@@ -0,0 +1,26 @@
1
+ import type {
2
+ UsageMetricProjection,
3
+ UsageProjection,
4
+ } from "@zaip-ai/dashboard-operations/contracts";
5
+ import type { CostMonitorProjection } from "../contracts.js";
6
+
7
+ function emptyMetric(): UsageMetricProjection {
8
+ return {
9
+ events: 0,
10
+ tokens: { input: null, cached_input: null, output: null, reasoning: null, total: null },
11
+ cost: { usd: null, brl: null },
12
+ coverage: { events: 0, tokens: 0, usd: 0, brl: 0 },
13
+ };
14
+ }
15
+
16
+ export function emptyOrigins(): CostMonitorProjection["origins"] {
17
+ const usage = (): UsageProjection => ({
18
+ conversation: emptyMetric(),
19
+ planning: emptyMetric(),
20
+ execution: emptyMetric(),
21
+ total: emptyMetric(),
22
+ new_work: emptyMetric(),
23
+ rework: emptyMetric(),
24
+ });
25
+ return { conversation: usage(), task: usage(), spec: usage(), prd: usage() };
26
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zaip-ai/dashboard-operations",
3
- "version": "4.9.0",
3
+ "version": "5.0.0",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": {