@piagent/platform 1.48.5 → 1.49.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/docs/command-reference-vietnamese.md +2 -2
- package/docs/distribution-standard.md +6 -6
- package/docs/harness-conformance.md +3 -3
- package/docs/operator-manual-vietnamese.md +7 -7
- package/docs/publishing-for-teams.md +2 -0
- package/docs/release-install-policy.md +2 -2
- package/docs/team-onboarding.md +2 -2
- package/docs-site/architecture.html +1 -1
- package/docs-site/assets/search-en.json +1 -1
- package/docs-site/assets/search-vi.json +1 -1
- package/docs-site/benchmark.html +1 -1
- package/docs-site/commands.html +1 -1
- package/docs-site/context-engine.html +1 -1
- package/docs-site/ecosystem.html +1 -1
- package/docs-site/en/architecture.html +1 -1
- package/docs-site/en/benchmark.html +1 -1
- package/docs-site/en/commands.html +1 -1
- package/docs-site/en/context-engine.html +1 -1
- package/docs-site/en/ecosystem.html +1 -1
- package/docs-site/en/index.html +15 -15
- package/docs-site/en/mcp-approval.html +1 -1
- package/docs-site/en/mcp-auth.html +1 -1
- package/docs-site/en/mcp-servers.html +1 -1
- package/docs-site/en/mcp.html +1 -1
- package/docs-site/en/permissions.html +1 -1
- package/docs-site/en/profiles.html +1 -1
- package/docs-site/en/quickstart.html +1 -1
- package/docs-site/en/runtime.html +1 -1
- package/docs-site/en/scope.html +1 -1
- package/docs-site/en/security.html +1 -1
- package/docs-site/en/team.html +1 -1
- package/docs-site/en/update.html +3 -3
- package/docs-site/en/whats-new.html +55 -30
- package/docs-site/en/windows.html +1 -1
- package/docs-site/en/workflows.html +1 -1
- package/docs-site/index.html +15 -15
- package/docs-site/mcp-approval.html +1 -1
- package/docs-site/mcp-auth.html +1 -1
- package/docs-site/mcp-servers.html +1 -1
- package/docs-site/mcp.html +1 -1
- package/docs-site/permissions.html +1 -1
- package/docs-site/profiles.html +1 -1
- package/docs-site/quickstart.html +1 -1
- package/docs-site/releases.json +77 -0
- package/docs-site/runtime.html +1 -1
- package/docs-site/scope.html +1 -1
- package/docs-site/security.html +1 -1
- package/docs-site/team.html +1 -1
- package/docs-site/update.html +3 -3
- package/docs-site/whats-new.html +55 -30
- package/docs-site/windows.html +1 -1
- package/docs-site/workflows.html +1 -1
- package/evals/private-holdout-v1/public-exposure.v2.json +2 -2
- package/package.json +1 -1
- package/packages/piagent-core/managed/check-questions.mjs +133 -0
- package/packages/piagent-core/managed/command-tools.mjs +2 -0
- package/packages/piagent-core/managed/fast-mode.mjs +19 -16
- package/packages/piagent-core/managed/helper-run.mjs +20 -3
- package/packages/piagent-core/managed/repository-checks.mjs +80 -0
- package/packages/piagent-core/managed/request-stream.mjs +2 -2
- package/packages/piagent-core/managed/session.mjs +2 -2
- package/packages/piagent-core/managed/workflow.mjs +41 -88
- package/packages/piagent-core/package.json +1 -1
- package/packages/piagent-webui/dist/client/assets/ActivityPanel-CmjxPmNT.js +1 -0
- package/packages/piagent-webui/dist/client/assets/{App-DqN7B1JR.js → App-JrRb7jgn.js} +1 -1
- package/packages/piagent-webui/dist/client/assets/GatewayApp-BmkqeXih.js +63 -0
- package/packages/piagent-webui/dist/client/assets/{InspectionApp-BKQiA0Ce.js → InspectionApp-9jBsgkVJ.js} +1 -1
- package/packages/piagent-webui/dist/client/assets/{SessionAgentWorkspace-ZAdRbxVA.js → SessionAgentWorkspace-RQ0N65d9.js} +1 -1
- package/packages/piagent-webui/dist/client/assets/{SessionInspectorDrawer-B2e4-1FG.js → SessionInspectorDrawer-BWyEN4bf.js} +2 -2
- package/packages/piagent-webui/dist/client/assets/{SettingsNavigation-C3MC0X4P.js → SettingsNavigation-Wx-q5QQk.js} +1 -1
- package/packages/piagent-webui/dist/client/assets/{SettingsPage-D4os5vHj.js → SettingsPage-xAt6kSyZ.js} +1 -1
- package/packages/piagent-webui/dist/client/assets/{TerminalPanel-CVYUiDkn.js → TerminalPanel-DzHdSjpN.js} +1 -1
- package/packages/piagent-webui/dist/client/assets/{WorkspaceCodeEditor-E0Zopcke.js → WorkspaceCodeEditor-CEuPTTBd.js} +1 -1
- package/packages/piagent-webui/dist/client/assets/{WorkspaceExplorer-DldLoJyf.js → WorkspaceExplorer-B_NwYf4S.js} +3 -3
- package/packages/piagent-webui/dist/client/assets/{index-CjM70M7D.css → index-De7bIeMc.css} +1 -1
- package/packages/piagent-webui/dist/client/assets/{index-DcrpSyBK.js → index-fUpioGMZ.js} +2 -2
- package/packages/piagent-webui/dist/client/index.html +2 -2
- package/packages/piagent-webui/gateway/gateway-session-stream.ts +28 -0
- package/packages/piagent-webui/gateway/managed-projection.ts +8 -1
- package/packages/piagent-webui/gateway/session-catalog.ts +2 -2
- package/packages/piagent-webui/server/tool-call-summary.ts +13 -0
- package/packages/piagent-webui/server/transcript-projection.ts +13 -5
- package/packages/piagent-webui/shared/process-copy.ts +3 -2
- package/schemas/piagent-webui/gateway-protocol-v1.schema.json +2 -0
- package/schemas/piagent-webui/session-catalog-v1.schema.json +1 -1
- package/schemas/piagent-webui/transcript-v1.schema.json +18 -1
- package/scripts/company-terminal.mjs +2 -2
- package/scripts/runtime-advisory-exceptions.json +8 -0
- package/packages/piagent-webui/dist/client/assets/ActivityPanel-Bv-jc1s3.js +0 -1
- package/packages/piagent-webui/dist/client/assets/GatewayApp-B3--WjSd.js +0 -63
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/InspectionApp-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/InspectionApp-9jBsgkVJ.js","assets/rolldown-runtime-hePW80VL.js","assets/vendor-DNZbaWhT.js","assets/bootstrap-CedkNtRG.js","assets/api-BQS4Dtrr.js","assets/latest-request-DXcYQW86.js","assets/App-JrRb7jgn.js","assets/ui-preferences-OfS30-ZV.js","assets/ActivityPanel-CmjxPmNT.js","assets/view-model-CWNiS4JN.js","assets/workspace-navigation-DW8zhH6U.js","assets/AttachmentImage-eZKqLYZ2.js","assets/transcript-view-model-acWtHGyE.js","assets/LineReview-CB3mQe7m.js","assets/GatewayApp-BmkqeXih.js","assets/SettingsNavigation-Wx-q5QQk.js","assets/composer-drafts-BtMaVw8W.js","assets/terminal-transport-Dk5pYNX5.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{r as e,t}from"./rolldown-runtime-hePW80VL.js";import{An as n,Cn as r,Dn as i,Fn as a,Gt as o,In as s,Ln as c,On as l,Pn as u,Rn as d,Sn as f,Ut as p,Wt as m,bn as h,gn as g,jn as _,kn as v,ln as y,mn as b,pn as x,un as S,vn as ee,yn as te}from"./vendor-DNZbaWhT.js";import{a as ne,n as re,o as ie,s as ae,t as oe}from"./ui-preferences-OfS30-ZV.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var se=t((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,S||(S=!0,ae());else{var t=n(l);t!==null&&ce(x,t.startTime-e)}}}var S=!1,ee=-1,te=5,ne=-1;function re(){return g?!0:!(e.unstable_now()-ne<te)}function ie(){if(g=!1,S){var t=e.unstable_now();ne=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(ee),ee=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&re());){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&&ce(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}}}finally{i?ae():S=!1}}}var ae;if(typeof y==`function`)ae=function(){y(ie)};else if(typeof MessageChannel<`u`){var oe=new MessageChannel,se=oe.port2;oe.port1.onmessage=ie,ae=function(){se.postMessage(null)}}else ae=function(){_(ie,0)};function ce(t,n){ee=_(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`):te=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(ee),ee=-1):h=!0,ce(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,ae()))),r},e.unstable_shouldYield=re,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),ce=t(((e,t)=>{t.exports=se()})),le=t((e=>{var t=ce(),n=d(),r=c();function i(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 a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(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 s(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 l(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 u(e){if(o(e)!==e)throw Error(i(188))}function f(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return u(a),e;if(s===r)return u(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,l=a.child;l;){if(l===n){c=!0,n=a,r=s;break}if(l===r){c=!0,r=a,n=s;break}l=l.sibling}if(!c){for(l=s.child;l;){if(l===n){c=!0,n=s,r=a;break}if(l===r){c=!0,r=s,n=a;break}l=l.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function p(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=p(e),t!==null)return t;e=e.sibling}return null}var m=Object.assign,h=Symbol.for(`react.element`),g=Symbol.for(`react.transitional.element`),_=Symbol.for(`react.portal`),v=Symbol.for(`react.fragment`),y=Symbol.for(`react.strict_mode`),b=Symbol.for(`react.profiler`),x=Symbol.for(`react.consumer`),S=Symbol.for(`react.context`),ee=Symbol.for(`react.forward_ref`),te=Symbol.for(`react.suspense`),ne=Symbol.for(`react.suspense_list`),re=Symbol.for(`react.memo`),ie=Symbol.for(`react.lazy`),ae=Symbol.for(`react.activity`),oe=Symbol.for(`react.memo_cache_sentinel`),se=Symbol.iterator;function le(e){return typeof e!=`object`||!e?null:(e=se&&e[se]||e[`@@iterator`],typeof e==`function`?e:null)}var ue=Symbol.for(`react.client.reference`);function C(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ue?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case v:return`Fragment`;case b:return`Profiler`;case y:return`StrictMode`;case te:return`Suspense`;case ne:return`SuspenseList`;case ae:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case _:return`Portal`;case S:return e.displayName||`Context`;case x:return(e._context.displayName||`Context`)+`.Consumer`;case ee:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case re:return t=e.displayName||null,t===null?C(e.type)||`Memo`:t;case ie:t=e._payload,e=e._init;try{return C(e(t))}catch{}}return null}var de=Array.isArray,w=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,T=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,E={pending:!1,data:null,method:null,action:null},fe=[],pe=-1;function me(e){return{current:e}}function D(e){0>pe||(e.current=fe[pe],fe[pe]=null,pe--)}function O(e,t){pe++,fe[pe]=e.current,e.current=t}var he=me(null),ge=me(null),_e=me(null),ve=me(null);function ye(e,t){switch(O(_e,t),O(ge,e),O(he,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}}D(he),O(he,e)}function be(){D(he),D(ge),D(_e)}function xe(e){e.memoizedState!==null&&O(ve,e);var t=he.current,n=Hd(t,e.type);t!==n&&(O(ge,e),O(he,n))}function Se(e){ge.current===e&&(D(he),D(ge)),ve.current===e&&(D(ve),Qf._currentValue=E)}var Ce,we;function Te(e){if(Ce===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Ce=t&&t[1]||``,we=-1<e.stack.indexOf(`
|
|
3
3
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
4
|
`+Ce+e+we}var Ee=!1;function De(e,t){if(!e||Ee)return``;Ee=!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(`
|
|
@@ -34,4 +34,4 @@ try {
|
|
|
34
34
|
if (colorScheme) {
|
|
35
35
|
${l}
|
|
36
36
|
}
|
|
37
|
-
} catch(e){}})();`}},`mui-color-scheme-init`)}function be(){}var xe=({key:e,storageWindow:t})=>(!t&&typeof window<`u`&&(t=window),{get(n){if(typeof window>`u`)return;if(!t)return n;let r;try{r=t.localStorage.getItem(e)}catch{}return r||n},set:n=>{if(t)try{t.localStorage.setItem(e,n)}catch{}},subscribe:n=>{if(!t)return be;let r=t=>{let r=t.newValue;t.key===e&&n(r)};return t.addEventListener(`storage`,r),()=>{t.removeEventListener(`storage`,r)}}});function Se(){}function Ce(e){if(typeof window<`u`&&typeof window.matchMedia==`function`&&e===`system`)return window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}function we(e,t){if(e.mode===`light`||e.mode===`system`&&e.systemMode===`light`)return t(`light`);if(e.mode===`dark`||e.mode===`system`&&e.systemMode===`dark`)return t(`dark`)}function Te(e){return we(e,t=>{if(t===`light`)return e.lightColorScheme;if(t===`dark`)return e.darkColorScheme})}function Ee(e){let{defaultMode:t=`light`,defaultLightColorScheme:n,defaultDarkColorScheme:r,supportedColorSchemes:i=[],modeStorageKey:a=ge,colorSchemeStorageKey:o=_e,storageWindow:s=typeof window>`u`?void 0:window,storageManager:c=xe,noSsr:l=!1}=e,u=i.join(`,`),d=i.length>1,f=C.useMemo(()=>c?.({key:a,storageWindow:s}),[c,a,s]),p=C.useMemo(()=>c?.({key:`${o}-light`,storageWindow:s}),[c,o,s]),m=C.useMemo(()=>c?.({key:`${o}-dark`,storageWindow:s}),[c,o,s]),[h,g]=C.useState(()=>{let e=f?.get(t)||t,i=p?.get(n)||n,a=m?.get(r)||r;return{mode:e,systemMode:Ce(e),lightColorScheme:i,darkColorScheme:a}}),[_,v]=C.useState(l||!d);C.useEffect(()=>{v(!0)},[]);let y=Te(h),b=C.useCallback(e=>{g(n=>{if(e===n.mode)return n;let r=e??t;return f?.set(r),{...n,mode:r,systemMode:Ce(r)}})},[f,t]),x=C.useCallback(e=>{e?typeof e==`string`?e&&!u.includes(e)?console.error(`\`${e}\` does not exist in \`theme.colorSchemes\`.`):g(t=>{let n={...t};return we(t,t=>{t===`light`&&(p?.set(e),n.lightColorScheme=e),t===`dark`&&(m?.set(e),n.darkColorScheme=e)}),n}):g(t=>{let i={...t},a=e.light===null?n:e.light,o=e.dark===null?r:e.dark;return a&&(u.includes(a)?(i.lightColorScheme=a,p?.set(a)):console.error(`\`${a}\` does not exist in \`theme.colorSchemes\`.`)),o&&(u.includes(o)?(i.darkColorScheme=o,m?.set(o)):console.error(`\`${o}\` does not exist in \`theme.colorSchemes\`.`)),i}):g(e=>(p?.set(n),m?.set(r),{...e,lightColorScheme:n,darkColorScheme:r}))},[u,p,m,n,r]),S=C.useCallback(e=>{h.mode===`system`&&g(t=>{let n=e?.matches?`dark`:`light`;return t.systemMode===n?t:{...t,systemMode:n}})},[h.mode]),ee=C.useRef(S);return ee.current=S,C.useEffect(()=>{if(typeof window.matchMedia!=`function`||!d)return;let e=(...e)=>ee.current(...e),t=window.matchMedia(`(prefers-color-scheme: dark)`);return t.addListener(e),e(t),()=>{t.removeListener(e)}},[d]),C.useEffect(()=>{if(d){let e=f?.subscribe(e=>{(!e||[`light`,`dark`,`system`].includes(e))&&b(e||t)})||Se,n=p?.subscribe(e=>{(!e||u.match(e))&&x({light:e})})||Se,r=m?.subscribe(e=>{(!e||u.match(e))&&x({dark:e})})||Se;return()=>{e(),n(),r()}}},[x,b,u,t,s,d,f,p,m]),{...h,mode:_?h.mode:void 0,systemMode:_?h.systemMode:void 0,colorScheme:_?y:void 0,setMode:b,setColorScheme:x}}var De=`*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}`;function Oe(e){let{themeId:t,theme:n={},modeStorageKey:i=ge,colorSchemeStorageKey:a=_e,disableTransitionOnChange:o=!1,defaultColorScheme:s,resolveTheme:c}=e,l={allColorSchemes:[],colorScheme:void 0,darkColorScheme:void 0,lightColorScheme:void 0,mode:void 0,setColorScheme:()=>{},setMode:()=>{},systemMode:void 0},u=C.createContext(void 0),d=()=>C.useContext(u)||l,f={},p={};function m(e){let{children:l,theme:d,modeStorageKey:m=i,colorSchemeStorageKey:h=a,disableTransitionOnChange:g=o,storageManager:_,storageWindow:y=typeof window>`u`?void 0:window,documentNode:b=typeof document>`u`?void 0:document,colorSchemeNode:x=typeof document>`u`?void 0:document.documentElement,disableNestedContext:S=!1,disableStyleSheetGeneration:ee=!1,defaultMode:te=`system`,forceThemeRerender:ne=!1,noSsr:re}=e,ie=C.useRef(!1),ae=w(),oe=C.useContext(u),se=!!oe&&!S,ce=C.useMemo(()=>d||(typeof n==`function`?n():n),[d]),le=ce[t],ue=le||ce,{colorSchemes:de=f,components:T=p,cssVarPrefix:fe}=ue,pe=Object.keys(de).filter(e=>!!de[e]).join(`,`),me=C.useMemo(()=>pe.split(`,`),[pe]),D=typeof s==`string`?s:s.light,O=typeof s==`string`?s:s.dark,{mode:ge,setMode:_e,systemMode:ve,lightColorScheme:ye,darkColorScheme:be,colorScheme:xe,setColorScheme:Se}=Ee({supportedColorSchemes:me,defaultLightColorScheme:D,defaultDarkColorScheme:O,modeStorageKey:m,colorSchemeStorageKey:h,defaultMode:de[D]&&de[O]?te:de[ue.defaultColorScheme]?.palette?.mode||ue.palette?.mode,storageManager:_,storageWindow:y,noSsr:re}),Ce=ge,we=xe;se&&(Ce=oe.mode,we=oe.colorScheme);let Te=we||ue.defaultColorScheme;ue.vars&&!ne&&(Te=ue.defaultColorScheme);let Oe=C.useMemo(()=>{let e=ue.generateThemeVars?.()||ue.vars,t={...ue,components:T,colorSchemes:de,cssVarPrefix:fe,vars:e};if(typeof t.generateSpacing==`function`&&(t.spacing=t.generateSpacing()),Te){let e=de[Te];e&&typeof e==`object`&&Object.keys(e).forEach(n=>{e[n]&&typeof e[n]==`object`?t[n]={...t[n],...e[n]}:t[n]=e[n]})}return c?c(t):t},[ue,Te,T,de,fe]),ke=ue.colorSchemeSelector;r(()=>{if(we&&x&&ke&&ke!==`media`){let e=ke,t=ke;if(e===`class`&&(t=`.%s`),e===`data`&&(t=`[data-%s]`),e?.startsWith(`data-`)&&!e.includes(`%s`)&&(t=`[${e}="%s"]`),t.startsWith(`.`))x.classList.remove(...me.map(e=>t.substring(1).replace(`%s`,e))),x.classList.add(t.substring(1).replace(`%s`,we));else{let e=t.replace(`%s`,we).match(/\[([^\]]+)\]/);if(e){let[t,n]=e[1].split(`=`);n||me.forEach(e=>{x.removeAttribute(t.replace(we,e))}),x.setAttribute(t,n?n.replace(/"|'/g,``):``)}else x.setAttribute(t,we)}}},[we,ke,x,me]),C.useEffect(()=>{let e;if(g&&ie.current&&b){let t=b.createElement(`style`);t.appendChild(b.createTextNode(De)),b.head.appendChild(t),window.getComputedStyle(b.body),e=setTimeout(()=>{b.head.removeChild(t)},1)}return()=>{clearTimeout(e)}},[we,g,b]),C.useEffect(()=>(ie.current=!0,()=>{ie.current=!1}),[]);let Ae=C.useMemo(()=>({allColorSchemes:me,colorScheme:we,darkColorScheme:be,lightColorScheme:ye,mode:Ce,setColorScheme:Se,setMode:_e,systemMode:ve}),[me,we,be,ye,Ce,Se,_e,ve,Oe.colorSchemeSelector]),je=!0;(ee||ue.cssVariables===!1||se&&ae?.cssVarPrefix===fe)&&(je=!1);let Me=(0,E.jsxs)(C.Fragment,{children:[(0,E.jsx)(he,{themeId:le?t:void 0,theme:Oe,children:l}),je&&(0,E.jsx)(v,{styles:Oe.generateStyleSheets?.()||[]})]});return se?Me:(0,E.jsx)(u.Provider,{value:Ae,children:Me})}let h=typeof s==`string`?s:s.light,g=typeof s==`string`?s:s.dark;return{CssVarsProvider:m,useColorScheme:d,getInitColorSchemeScript:e=>ye({colorSchemeStorageKey:a,defaultLightColorScheme:h,defaultDarkColorScheme:g,modeStorageKey:i,...e})}}var ke=typeof S({})==`function`,Ae=(e,t)=>({WebkitFontSmoothing:`antialiased`,MozOsxFontSmoothing:`grayscale`,boxSizing:`border-box`,WebkitTextSizeAdjust:`100%`,...t&&!e.vars&&{colorScheme:e.palette.mode}}),je=e=>({color:(e.vars||e).palette.text.primary,...e.typography.body1,backgroundColor:(e.vars||e).palette.background.default,"@media print":{backgroundColor:(e.vars||e).palette.common.white}}),Me=(e,t=!1)=>{let n={};t&&e.colorSchemes&&typeof e.getColorSchemeSelector==`function`&&Object.entries(e.colorSchemes).forEach(([t,r])=>{let i=e.getColorSchemeSelector(t);i.startsWith(`@`)?n[i]={":root":{colorScheme:r.palette?.mode}}:n[i.replace(/\s*&/,``)]={colorScheme:r.palette?.mode}});let r={html:Ae(e,t),"*, *::before, *::after":{boxSizing:`inherit`},"strong, b":{fontWeight:e.typography.fontWeightBold},body:{margin:0,...je(e),"&::backdrop":{backgroundColor:(e.vars||e).palette.background.default}},...n},i=e.components?.MuiCssBaseline?.styleOverrides;return i&&(r=[r,i]),r},Ne=`mui-ecs`,Pe=e=>{let t=Me(e,!1),n=Array.isArray(t)?t[0]:t;return!e.vars&&n&&(n.html[`:root:has(${Ne})`]={colorScheme:e.palette.mode}),e.colorSchemes&&Object.entries(e.colorSchemes).forEach(([t,r])=>{let i=e.getColorSchemeSelector(t);i.startsWith(`@`)?n[i]={[`:root:not(:has(.${Ne}))`]:{colorScheme:r.palette?.mode}}:n[i.replace(/\s*&/,``)]={[`&:not(:has(.${Ne}))`]:{colorScheme:r.palette?.mode}}}),t},Fe=S(ke?({theme:e,enableColorScheme:t})=>Me(e,t):({theme:e})=>Pe(e));function Ie(e){let{children:t,enableColorScheme:n=!1}=y({props:e,name:`MuiCssBaseline`});return(0,E.jsxs)(C.Fragment,{children:[ke&&(0,E.jsx)(Fe,{enableColorScheme:n}),!ke&&!n&&(0,E.jsx)(`span`,{className:Ne,style:{display:`none`}}),t]})}function Le({theme:e,...t}){let n=`$$material`in e?e[x]:void 0;return(0,E.jsx)(he,{...t,themeId:n?x:void 0,theme:n||e})}var Re={attribute:`data-mui-color-scheme`,colorSchemeStorageKey:`mui-color-scheme`,defaultLightColorScheme:`light`,defaultDarkColorScheme:`dark`,modeStorageKey:`mui-mode`},{CssVarsProvider:ze,useColorScheme:Be,getInitColorSchemeScript:Ve}=Oe({themeId:x,theme:()=>b({cssVariables:!0}),colorSchemeStorageKey:Re.colorSchemeStorageKey,modeStorageKey:Re.modeStorageKey,defaultColorScheme:{light:Re.defaultLightColorScheme,dark:Re.defaultDarkColorScheme},resolveTheme:e=>{let t={...e,typography:g(e.palette,e.typography)};return t.unstable_sx=function(e){return _({sx:e,theme:this})},t}}),He=ze;function Ue({theme:e,...t}){let n=C.useMemo(()=>{if(typeof e==`function`)return e;let t=`$$material`in e?e[x]:e;return`colorSchemes`in t?null:`vars`in t?e:{...e,vars:null}},[e]);return n?(0,E.jsx)(Le,{theme:n,...t}):(0,E.jsx)(He,{theme:e,...t})}var We=ue(),Ge=class extends C.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}render(){let{locale:e,children:t}=this.props;return this.state.failed?(0,E.jsxs)(m,{sx:{p:3},children:[(0,E.jsx)(o,{severity:`error`,children:re(e,`Không tải được giao diện. Vui lòng tải lại để thử lại.`,`Could not load this view. Reload to try again.`)}),(0,E.jsx)(p,{onClick:()=>window.location.reload(),children:re(e,`Tải lại trang`,`Reload page`)})]}):(0,E.jsx)(C.Suspense,{fallback:(0,E.jsx)(m,{role:`status`,sx:{p:3},children:re(e,`Đang tải giao diện…`,`Loading view…`)}),children:t})}};function Ke(e){let t=e.mode===`dark`,n=e.mode,{primary:r,secondary:i,background:a,paper:o,text:s,muted:c,divider:l}=e,u=t?`0 16px 48px -12px ${f(`#000`,.7)}, 0 0 0 1px ${f(s,.06)}`:`0 16px 40px -16px ${f(`#1a1a2e`,.25)}, 0 0 0 1px ${f(s,.06)}`,d=`0 0 0 3px ${f(r,t?.28:.22)}`;return b({cssVariables:{cssVarPrefix:`piagent`},palette:{mode:n,primary:{main:r,contrastText:e.onPrimary},secondary:{main:i},success:{main:i},warning:{main:e.warning},error:{main:e.error},background:{default:a,paper:o},text:{primary:s,secondary:c,disabled:c},divider:l,action:{hover:f(s,.05),selected:f(s,.08),focus:f(r,.14)}},shape:{borderRadius:6},transitions:{duration:{shortest:120,shorter:160,short:180,standard:200,complex:260,enteringScreen:200,leavingScreen:160}},typography:{fontFamily:`system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif`,fontSize:14,fontWeightRegular:400,fontWeightMedium:500,fontWeightBold:600,h1:{fontSize:`1.6rem`,fontWeight:650,letterSpacing:`-0.03em`,lineHeight:1.2},h2:{fontSize:`1.15rem`,fontWeight:600,letterSpacing:`-0.02em`},h3:{fontSize:`0.95rem`,fontWeight:600},body2:{fontSize:`0.8125rem`},button:{fontSize:`0.8125rem`,fontWeight:550,textTransform:`none`,letterSpacing:0},caption:{fontSize:`0.72rem`,letterSpacing:0},overline:{fontSize:`0.68rem`,fontWeight:600,letterSpacing:`0.08em`}},components:{MuiCssBaseline:{styleOverrides:{html:{backgroundColor:a,WebkitFontSmoothing:`antialiased`},body:{minWidth:320,minHeight:`100vh`,backgroundColor:a},"::selection":{backgroundColor:f(r,.28)},"*":{scrollbarWidth:`thin`,scrollbarColor:`${f(s,.18)} transparent`}}},MuiPaper:{defaultProps:{elevation:0},styleOverrides:{root:{backgroundImage:`none`}}},MuiButtonBase:{defaultProps:{disableRipple:!0}},MuiButton:{defaultProps:{disableElevation:!0},styleOverrides:{root:{minHeight:32,borderRadius:8,paddingInline:12,transition:`background-color .16s, border-color .16s, box-shadow .16s, color .16s`,"&.Mui-focusVisible":{boxShadow:d}},sizeSmall:{minHeight:28,paddingInline:10,fontSize:`0.78rem`},outlined:{borderColor:f(s,.14),"&:hover":{borderColor:f(s,.28),backgroundColor:f(s,.04)}},contained:{"&.MuiButton-colorPrimary:hover":{backgroundColor:f(r,.88),boxShadow:`0 0 0 3px ${f(r,.18)}`}},text:{"&:hover":{backgroundColor:f(s,.06)}}}},MuiIconButton:{styleOverrides:{root:{borderRadius:8,color:c,transition:`background-color .16s, color .16s`,"&:hover":{color:s,backgroundColor:f(s,.07)},"&.Mui-focusVisible":{boxShadow:d}},sizeSmall:{padding:5}}},MuiChip:{styleOverrides:{root:{height:24,borderRadius:999,fontWeight:500,fontSize:`0.75rem`},outlined:{borderColor:f(s,.14)},label:{paddingInline:9}}},MuiListItemButton:{styleOverrides:{root:{minHeight:36,margin:`1px 8px`,borderRadius:8,color:c,transition:`background-color .12s, color .12s`,"&:hover":{backgroundColor:f(s,.05),color:s},"&.Mui-selected":{color:s,backgroundColor:f(s,t?.08:.07)},"&.Mui-selected:hover":{backgroundColor:f(s,t?.11:.09)},"&.Mui-focusVisible":{boxShadow:d}}}},MuiTabs:{styleOverrides:{root:{minHeight:40},indicator:{height:2,borderRadius:2}}},MuiTab:{styleOverrides:{root:{minHeight:40,paddingInline:14,textTransform:`none`,fontWeight:550,fontSize:`0.8125rem`,color:c,"&.Mui-selected":{color:s}}}},MuiOutlinedInput:{styleOverrides:{root:{borderRadius:8,backgroundColor:f(s,t?.03:.02),transition:`box-shadow .16s`,"& .MuiOutlinedInput-notchedOutline":{borderColor:f(s,.12)},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:f(s,.24)},"&.Mui-focused":{boxShadow:d},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:r,borderWidth:1}}}},MuiTooltip:{defaultProps:{arrow:!1,enterDelay:350},styleOverrides:{tooltip:{fontSize:`0.75rem`,fontWeight:500,padding:`5px 9px`,borderRadius:6,color:t?s:`#fafafa`,backgroundColor:t?f(o,.98):`#1f1f24`,boxShadow:u}}},MuiMenu:{styleOverrides:{paper:{borderRadius:10,boxShadow:u,backgroundImage:`none`,marginTop:4},list:{padding:4}}},MuiPopover:{styleOverrides:{paper:{borderRadius:10,boxShadow:u}}},MuiMenuItem:{styleOverrides:{root:{minHeight:32,borderRadius:6,fontSize:`0.8125rem`,"&:hover":{backgroundColor:f(s,.06)},"&.Mui-selected":{backgroundColor:f(r,.12)}}}},MuiDialog:{styleOverrides:{paper:{borderRadius:14,boxShadow:u,backgroundImage:`none`}}},MuiBackdrop:{styleOverrides:{root:{backgroundColor:f(`#000`,t?.6:.32),backdropFilter:`blur(2px)`}}},MuiDrawer:{styleOverrides:{paper:{backgroundImage:`none`,backgroundColor:o}}},MuiAlert:{styleOverrides:{root:{borderRadius:10,border:`1px solid ${f(s,.1)}`,fontSize:`0.8125rem`,alignItems:`center`}}},MuiDivider:{styleOverrides:{root:{borderColor:l}}},MuiLinearProgress:{styleOverrides:{root:{borderRadius:999,height:4},bar:{borderRadius:999}}}}})}function qe(e){for(let t of e??[]){let e=String(t).toLowerCase().split(`-`)[0];if(e===`vi`)return`vi`;if(e)return`en`}return`en`}var Je=`modulepreload`,Ye=function(e){return`/`+e},Xe={},Ze=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=Ye(t,n),t=s(t),t in Xe)return;Xe[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:Je,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Qe=document.getElementById(`root`);if(!Qe)throw Error(`Piagent WebUI root is missing`);var $e=document.querySelector(`meta[name="csp-nonce"]`)?.content,et=s({key:`piagent-mui`,nonce:$e&&!$e.startsWith(`__PIAGENT_`)?$e:void 0,prepend:!0}),tt=(0,C.lazy)(()=>Ze(()=>import(`./InspectionApp-BKQiA0Ce.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]))),nt=(0,C.lazy)(()=>Ze(()=>import(`./GatewayApp-B3--WjSd.js`),__vite__mapDeps([14,1,2,7,3,4,9,15,10,11,12,16,5,17])));function rt(e,t,n){try{let r=window.localStorage.getItem(e);return r&&t.includes(r)?r:n}catch{return n}}function it(){let[e,t]=(0,C.useState)(()=>rt(`piagent-webui-locale`,[`vi`,`en`],qe(window.navigator?.languages??[window.navigator?.language??``]))),[n,r]=(0,C.useState)(()=>rt(`piagent-webui-theme`,ie.map(e=>e.id),``)||ne[rt(`piagent-webui-color-mode`,[`light`,`dark`],window.matchMedia?.(`(prefers-color-scheme: light)`).matches?`light`:`dark`)]),i=ae(n)??ae(ne.dark),a=i.mode,o=(0,C.useCallback)(e=>r(t=>ae(t)?.mode===e?t:ne[e]),[]),s=(0,C.useMemo)(()=>Ke(i),[i]);(0,C.useEffect)(()=>{document.documentElement.lang=e,document.documentElement.dataset.piagentColorMode=a,document.documentElement.dataset.piagentTheme=i.id;try{window.localStorage.setItem(`piagent-webui-locale`,e),window.localStorage.setItem(`piagent-webui-color-mode`,a),window.localStorage.setItem(`piagent-webui-theme`,i.id)}catch{}},[a,e,i]);let c=(0,C.useMemo)(()=>({locale:e,colorMode:a,themeId:i.id,setLocale:t,setColorMode:o,setThemeId:r}),[a,e,i,o]),l=document.querySelector(`meta[name="piagent-webui-mode"]`)?.content;return(0,E.jsx)(oe,{value:c,children:(0,E.jsxs)(Ue,{theme:s,children:[(0,E.jsx)(Ie,{}),(0,E.jsx)(Ge,{locale:e,children:l===`gateway`?(0,E.jsx)(nt,{}):(0,E.jsx)(tt,{})})]})})}(0,We.createRoot)(Qe).render((0,E.jsx)(C.StrictMode,{children:(0,E.jsx)(u,{value:et,children:(0,E.jsx)(it,{})})}));export{Ge as n,Ze as t};
|
|
37
|
+
} catch(e){}})();`}},`mui-color-scheme-init`)}function be(){}var xe=({key:e,storageWindow:t})=>(!t&&typeof window<`u`&&(t=window),{get(n){if(typeof window>`u`)return;if(!t)return n;let r;try{r=t.localStorage.getItem(e)}catch{}return r||n},set:n=>{if(t)try{t.localStorage.setItem(e,n)}catch{}},subscribe:n=>{if(!t)return be;let r=t=>{let r=t.newValue;t.key===e&&n(r)};return t.addEventListener(`storage`,r),()=>{t.removeEventListener(`storage`,r)}}});function Se(){}function Ce(e){if(typeof window<`u`&&typeof window.matchMedia==`function`&&e===`system`)return window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}function we(e,t){if(e.mode===`light`||e.mode===`system`&&e.systemMode===`light`)return t(`light`);if(e.mode===`dark`||e.mode===`system`&&e.systemMode===`dark`)return t(`dark`)}function Te(e){return we(e,t=>{if(t===`light`)return e.lightColorScheme;if(t===`dark`)return e.darkColorScheme})}function Ee(e){let{defaultMode:t=`light`,defaultLightColorScheme:n,defaultDarkColorScheme:r,supportedColorSchemes:i=[],modeStorageKey:a=ge,colorSchemeStorageKey:o=_e,storageWindow:s=typeof window>`u`?void 0:window,storageManager:c=xe,noSsr:l=!1}=e,u=i.join(`,`),d=i.length>1,f=C.useMemo(()=>c?.({key:a,storageWindow:s}),[c,a,s]),p=C.useMemo(()=>c?.({key:`${o}-light`,storageWindow:s}),[c,o,s]),m=C.useMemo(()=>c?.({key:`${o}-dark`,storageWindow:s}),[c,o,s]),[h,g]=C.useState(()=>{let e=f?.get(t)||t,i=p?.get(n)||n,a=m?.get(r)||r;return{mode:e,systemMode:Ce(e),lightColorScheme:i,darkColorScheme:a}}),[_,v]=C.useState(l||!d);C.useEffect(()=>{v(!0)},[]);let y=Te(h),b=C.useCallback(e=>{g(n=>{if(e===n.mode)return n;let r=e??t;return f?.set(r),{...n,mode:r,systemMode:Ce(r)}})},[f,t]),x=C.useCallback(e=>{e?typeof e==`string`?e&&!u.includes(e)?console.error(`\`${e}\` does not exist in \`theme.colorSchemes\`.`):g(t=>{let n={...t};return we(t,t=>{t===`light`&&(p?.set(e),n.lightColorScheme=e),t===`dark`&&(m?.set(e),n.darkColorScheme=e)}),n}):g(t=>{let i={...t},a=e.light===null?n:e.light,o=e.dark===null?r:e.dark;return a&&(u.includes(a)?(i.lightColorScheme=a,p?.set(a)):console.error(`\`${a}\` does not exist in \`theme.colorSchemes\`.`)),o&&(u.includes(o)?(i.darkColorScheme=o,m?.set(o)):console.error(`\`${o}\` does not exist in \`theme.colorSchemes\`.`)),i}):g(e=>(p?.set(n),m?.set(r),{...e,lightColorScheme:n,darkColorScheme:r}))},[u,p,m,n,r]),S=C.useCallback(e=>{h.mode===`system`&&g(t=>{let n=e?.matches?`dark`:`light`;return t.systemMode===n?t:{...t,systemMode:n}})},[h.mode]),ee=C.useRef(S);return ee.current=S,C.useEffect(()=>{if(typeof window.matchMedia!=`function`||!d)return;let e=(...e)=>ee.current(...e),t=window.matchMedia(`(prefers-color-scheme: dark)`);return t.addListener(e),e(t),()=>{t.removeListener(e)}},[d]),C.useEffect(()=>{if(d){let e=f?.subscribe(e=>{(!e||[`light`,`dark`,`system`].includes(e))&&b(e||t)})||Se,n=p?.subscribe(e=>{(!e||u.match(e))&&x({light:e})})||Se,r=m?.subscribe(e=>{(!e||u.match(e))&&x({dark:e})})||Se;return()=>{e(),n(),r()}}},[x,b,u,t,s,d,f,p,m]),{...h,mode:_?h.mode:void 0,systemMode:_?h.systemMode:void 0,colorScheme:_?y:void 0,setMode:b,setColorScheme:x}}var De=`*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}`;function Oe(e){let{themeId:t,theme:n={},modeStorageKey:i=ge,colorSchemeStorageKey:a=_e,disableTransitionOnChange:o=!1,defaultColorScheme:s,resolveTheme:c}=e,l={allColorSchemes:[],colorScheme:void 0,darkColorScheme:void 0,lightColorScheme:void 0,mode:void 0,setColorScheme:()=>{},setMode:()=>{},systemMode:void 0},u=C.createContext(void 0),d=()=>C.useContext(u)||l,f={},p={};function m(e){let{children:l,theme:d,modeStorageKey:m=i,colorSchemeStorageKey:h=a,disableTransitionOnChange:g=o,storageManager:_,storageWindow:y=typeof window>`u`?void 0:window,documentNode:b=typeof document>`u`?void 0:document,colorSchemeNode:x=typeof document>`u`?void 0:document.documentElement,disableNestedContext:S=!1,disableStyleSheetGeneration:ee=!1,defaultMode:te=`system`,forceThemeRerender:ne=!1,noSsr:re}=e,ie=C.useRef(!1),ae=w(),oe=C.useContext(u),se=!!oe&&!S,ce=C.useMemo(()=>d||(typeof n==`function`?n():n),[d]),le=ce[t],ue=le||ce,{colorSchemes:de=f,components:T=p,cssVarPrefix:fe}=ue,pe=Object.keys(de).filter(e=>!!de[e]).join(`,`),me=C.useMemo(()=>pe.split(`,`),[pe]),D=typeof s==`string`?s:s.light,O=typeof s==`string`?s:s.dark,{mode:ge,setMode:_e,systemMode:ve,lightColorScheme:ye,darkColorScheme:be,colorScheme:xe,setColorScheme:Se}=Ee({supportedColorSchemes:me,defaultLightColorScheme:D,defaultDarkColorScheme:O,modeStorageKey:m,colorSchemeStorageKey:h,defaultMode:de[D]&&de[O]?te:de[ue.defaultColorScheme]?.palette?.mode||ue.palette?.mode,storageManager:_,storageWindow:y,noSsr:re}),Ce=ge,we=xe;se&&(Ce=oe.mode,we=oe.colorScheme);let Te=we||ue.defaultColorScheme;ue.vars&&!ne&&(Te=ue.defaultColorScheme);let Oe=C.useMemo(()=>{let e=ue.generateThemeVars?.()||ue.vars,t={...ue,components:T,colorSchemes:de,cssVarPrefix:fe,vars:e};if(typeof t.generateSpacing==`function`&&(t.spacing=t.generateSpacing()),Te){let e=de[Te];e&&typeof e==`object`&&Object.keys(e).forEach(n=>{e[n]&&typeof e[n]==`object`?t[n]={...t[n],...e[n]}:t[n]=e[n]})}return c?c(t):t},[ue,Te,T,de,fe]),ke=ue.colorSchemeSelector;r(()=>{if(we&&x&&ke&&ke!==`media`){let e=ke,t=ke;if(e===`class`&&(t=`.%s`),e===`data`&&(t=`[data-%s]`),e?.startsWith(`data-`)&&!e.includes(`%s`)&&(t=`[${e}="%s"]`),t.startsWith(`.`))x.classList.remove(...me.map(e=>t.substring(1).replace(`%s`,e))),x.classList.add(t.substring(1).replace(`%s`,we));else{let e=t.replace(`%s`,we).match(/\[([^\]]+)\]/);if(e){let[t,n]=e[1].split(`=`);n||me.forEach(e=>{x.removeAttribute(t.replace(we,e))}),x.setAttribute(t,n?n.replace(/"|'/g,``):``)}else x.setAttribute(t,we)}}},[we,ke,x,me]),C.useEffect(()=>{let e;if(g&&ie.current&&b){let t=b.createElement(`style`);t.appendChild(b.createTextNode(De)),b.head.appendChild(t),window.getComputedStyle(b.body),e=setTimeout(()=>{b.head.removeChild(t)},1)}return()=>{clearTimeout(e)}},[we,g,b]),C.useEffect(()=>(ie.current=!0,()=>{ie.current=!1}),[]);let Ae=C.useMemo(()=>({allColorSchemes:me,colorScheme:we,darkColorScheme:be,lightColorScheme:ye,mode:Ce,setColorScheme:Se,setMode:_e,systemMode:ve}),[me,we,be,ye,Ce,Se,_e,ve,Oe.colorSchemeSelector]),je=!0;(ee||ue.cssVariables===!1||se&&ae?.cssVarPrefix===fe)&&(je=!1);let Me=(0,E.jsxs)(C.Fragment,{children:[(0,E.jsx)(he,{themeId:le?t:void 0,theme:Oe,children:l}),je&&(0,E.jsx)(v,{styles:Oe.generateStyleSheets?.()||[]})]});return se?Me:(0,E.jsx)(u.Provider,{value:Ae,children:Me})}let h=typeof s==`string`?s:s.light,g=typeof s==`string`?s:s.dark;return{CssVarsProvider:m,useColorScheme:d,getInitColorSchemeScript:e=>ye({colorSchemeStorageKey:a,defaultLightColorScheme:h,defaultDarkColorScheme:g,modeStorageKey:i,...e})}}var ke=typeof S({})==`function`,Ae=(e,t)=>({WebkitFontSmoothing:`antialiased`,MozOsxFontSmoothing:`grayscale`,boxSizing:`border-box`,WebkitTextSizeAdjust:`100%`,...t&&!e.vars&&{colorScheme:e.palette.mode}}),je=e=>({color:(e.vars||e).palette.text.primary,...e.typography.body1,backgroundColor:(e.vars||e).palette.background.default,"@media print":{backgroundColor:(e.vars||e).palette.common.white}}),Me=(e,t=!1)=>{let n={};t&&e.colorSchemes&&typeof e.getColorSchemeSelector==`function`&&Object.entries(e.colorSchemes).forEach(([t,r])=>{let i=e.getColorSchemeSelector(t);i.startsWith(`@`)?n[i]={":root":{colorScheme:r.palette?.mode}}:n[i.replace(/\s*&/,``)]={colorScheme:r.palette?.mode}});let r={html:Ae(e,t),"*, *::before, *::after":{boxSizing:`inherit`},"strong, b":{fontWeight:e.typography.fontWeightBold},body:{margin:0,...je(e),"&::backdrop":{backgroundColor:(e.vars||e).palette.background.default}},...n},i=e.components?.MuiCssBaseline?.styleOverrides;return i&&(r=[r,i]),r},Ne=`mui-ecs`,Pe=e=>{let t=Me(e,!1),n=Array.isArray(t)?t[0]:t;return!e.vars&&n&&(n.html[`:root:has(${Ne})`]={colorScheme:e.palette.mode}),e.colorSchemes&&Object.entries(e.colorSchemes).forEach(([t,r])=>{let i=e.getColorSchemeSelector(t);i.startsWith(`@`)?n[i]={[`:root:not(:has(.${Ne}))`]:{colorScheme:r.palette?.mode}}:n[i.replace(/\s*&/,``)]={[`&:not(:has(.${Ne}))`]:{colorScheme:r.palette?.mode}}}),t},Fe=S(ke?({theme:e,enableColorScheme:t})=>Me(e,t):({theme:e})=>Pe(e));function Ie(e){let{children:t,enableColorScheme:n=!1}=y({props:e,name:`MuiCssBaseline`});return(0,E.jsxs)(C.Fragment,{children:[ke&&(0,E.jsx)(Fe,{enableColorScheme:n}),!ke&&!n&&(0,E.jsx)(`span`,{className:Ne,style:{display:`none`}}),t]})}function Le({theme:e,...t}){let n=`$$material`in e?e[x]:void 0;return(0,E.jsx)(he,{...t,themeId:n?x:void 0,theme:n||e})}var Re={attribute:`data-mui-color-scheme`,colorSchemeStorageKey:`mui-color-scheme`,defaultLightColorScheme:`light`,defaultDarkColorScheme:`dark`,modeStorageKey:`mui-mode`},{CssVarsProvider:ze,useColorScheme:Be,getInitColorSchemeScript:Ve}=Oe({themeId:x,theme:()=>b({cssVariables:!0}),colorSchemeStorageKey:Re.colorSchemeStorageKey,modeStorageKey:Re.modeStorageKey,defaultColorScheme:{light:Re.defaultLightColorScheme,dark:Re.defaultDarkColorScheme},resolveTheme:e=>{let t={...e,typography:g(e.palette,e.typography)};return t.unstable_sx=function(e){return _({sx:e,theme:this})},t}}),He=ze;function Ue({theme:e,...t}){let n=C.useMemo(()=>{if(typeof e==`function`)return e;let t=`$$material`in e?e[x]:e;return`colorSchemes`in t?null:`vars`in t?e:{...e,vars:null}},[e]);return n?(0,E.jsx)(Le,{theme:n,...t}):(0,E.jsx)(He,{theme:e,...t})}var We=ue(),Ge=class extends C.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}render(){let{locale:e,children:t}=this.props;return this.state.failed?(0,E.jsxs)(m,{sx:{p:3},children:[(0,E.jsx)(o,{severity:`error`,children:re(e,`Không tải được giao diện. Vui lòng tải lại để thử lại.`,`Could not load this view. Reload to try again.`)}),(0,E.jsx)(p,{onClick:()=>window.location.reload(),children:re(e,`Tải lại trang`,`Reload page`)})]}):(0,E.jsx)(C.Suspense,{fallback:(0,E.jsx)(m,{role:`status`,sx:{p:3},children:re(e,`Đang tải giao diện…`,`Loading view…`)}),children:t})}};function Ke(e){let t=e.mode===`dark`,n=e.mode,{primary:r,secondary:i,background:a,paper:o,text:s,muted:c,divider:l}=e,u=t?`0 16px 48px -12px ${f(`#000`,.7)}, 0 0 0 1px ${f(s,.06)}`:`0 16px 40px -16px ${f(`#1a1a2e`,.25)}, 0 0 0 1px ${f(s,.06)}`,d=`0 0 0 3px ${f(r,t?.28:.22)}`;return b({cssVariables:{cssVarPrefix:`piagent`},palette:{mode:n,primary:{main:r,contrastText:e.onPrimary},secondary:{main:i},success:{main:i},warning:{main:e.warning},error:{main:e.error},background:{default:a,paper:o},text:{primary:s,secondary:c,disabled:c},divider:l,action:{hover:f(s,.05),selected:f(s,.08),focus:f(r,.14)}},shape:{borderRadius:6},transitions:{duration:{shortest:120,shorter:160,short:180,standard:200,complex:260,enteringScreen:200,leavingScreen:160}},typography:{fontFamily:`system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif`,fontSize:14,fontWeightRegular:400,fontWeightMedium:500,fontWeightBold:600,h1:{fontSize:`1.6rem`,fontWeight:650,letterSpacing:`-0.03em`,lineHeight:1.2},h2:{fontSize:`1.15rem`,fontWeight:600,letterSpacing:`-0.02em`},h3:{fontSize:`0.95rem`,fontWeight:600},body2:{fontSize:`0.8125rem`},button:{fontSize:`0.8125rem`,fontWeight:550,textTransform:`none`,letterSpacing:0},caption:{fontSize:`0.72rem`,letterSpacing:0},overline:{fontSize:`0.68rem`,fontWeight:600,letterSpacing:`0.08em`}},components:{MuiCssBaseline:{styleOverrides:{html:{backgroundColor:a,WebkitFontSmoothing:`antialiased`},body:{minWidth:320,minHeight:`100vh`,backgroundColor:a},"::selection":{backgroundColor:f(r,.28)},"*":{scrollbarWidth:`thin`,scrollbarColor:`${f(s,.18)} transparent`}}},MuiPaper:{defaultProps:{elevation:0},styleOverrides:{root:{backgroundImage:`none`}}},MuiButtonBase:{defaultProps:{disableRipple:!0}},MuiButton:{defaultProps:{disableElevation:!0},styleOverrides:{root:{minHeight:32,borderRadius:8,paddingInline:12,transition:`background-color .16s, border-color .16s, box-shadow .16s, color .16s`,"&.Mui-focusVisible":{boxShadow:d}},sizeSmall:{minHeight:28,paddingInline:10,fontSize:`0.78rem`},outlined:{borderColor:f(s,.14),"&:hover":{borderColor:f(s,.28),backgroundColor:f(s,.04)}},contained:{"&.MuiButton-colorPrimary:hover":{backgroundColor:f(r,.88),boxShadow:`0 0 0 3px ${f(r,.18)}`}},text:{"&:hover":{backgroundColor:f(s,.06)}}}},MuiIconButton:{styleOverrides:{root:{borderRadius:8,color:c,transition:`background-color .16s, color .16s`,"&:hover":{color:s,backgroundColor:f(s,.07)},"&.Mui-focusVisible":{boxShadow:d}},sizeSmall:{padding:5}}},MuiChip:{styleOverrides:{root:{height:24,borderRadius:999,fontWeight:500,fontSize:`0.75rem`},outlined:{borderColor:f(s,.14)},label:{paddingInline:9}}},MuiListItemButton:{styleOverrides:{root:{minHeight:36,margin:`1px 8px`,borderRadius:8,color:c,transition:`background-color .12s, color .12s`,"&:hover":{backgroundColor:f(s,.05),color:s},"&.Mui-selected":{color:s,backgroundColor:f(s,t?.08:.07)},"&.Mui-selected:hover":{backgroundColor:f(s,t?.11:.09)},"&.Mui-focusVisible":{boxShadow:d}}}},MuiTabs:{styleOverrides:{root:{minHeight:40},indicator:{height:2,borderRadius:2}}},MuiTab:{styleOverrides:{root:{minHeight:40,paddingInline:14,textTransform:`none`,fontWeight:550,fontSize:`0.8125rem`,color:c,"&.Mui-selected":{color:s}}}},MuiOutlinedInput:{styleOverrides:{root:{borderRadius:8,backgroundColor:f(s,t?.03:.02),transition:`box-shadow .16s`,"& .MuiOutlinedInput-notchedOutline":{borderColor:f(s,.12)},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:f(s,.24)},"&.Mui-focused":{boxShadow:d},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:r,borderWidth:1}}}},MuiTooltip:{defaultProps:{arrow:!1,enterDelay:350},styleOverrides:{tooltip:{fontSize:`0.75rem`,fontWeight:500,padding:`5px 9px`,borderRadius:6,color:t?s:`#fafafa`,backgroundColor:t?f(o,.98):`#1f1f24`,boxShadow:u}}},MuiMenu:{styleOverrides:{paper:{borderRadius:10,boxShadow:u,backgroundImage:`none`,marginTop:4},list:{padding:4}}},MuiPopover:{styleOverrides:{paper:{borderRadius:10,boxShadow:u}}},MuiMenuItem:{styleOverrides:{root:{minHeight:32,borderRadius:6,fontSize:`0.8125rem`,"&:hover":{backgroundColor:f(s,.06)},"&.Mui-selected":{backgroundColor:f(r,.12)}}}},MuiDialog:{styleOverrides:{paper:{borderRadius:14,boxShadow:u,backgroundImage:`none`}}},MuiBackdrop:{styleOverrides:{root:{backgroundColor:f(`#000`,t?.6:.32),backdropFilter:`blur(2px)`}}},MuiDrawer:{styleOverrides:{paper:{backgroundImage:`none`,backgroundColor:o}}},MuiAlert:{styleOverrides:{root:{borderRadius:10,border:`1px solid ${f(s,.1)}`,fontSize:`0.8125rem`,alignItems:`center`}}},MuiDivider:{styleOverrides:{root:{borderColor:l}}},MuiLinearProgress:{styleOverrides:{root:{borderRadius:999,height:4},bar:{borderRadius:999}}}}})}function qe(e){for(let t of e??[]){let e=String(t).toLowerCase().split(`-`)[0];if(e===`vi`)return`vi`;if(e)return`en`}return`en`}var Je=`modulepreload`,Ye=function(e){return`/`+e},Xe={},Ze=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=Ye(t,n),t=s(t),t in Xe)return;Xe[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:Je,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Qe=document.getElementById(`root`);if(!Qe)throw Error(`Piagent WebUI root is missing`);var $e=document.querySelector(`meta[name="csp-nonce"]`)?.content,et=s({key:`piagent-mui`,nonce:$e&&!$e.startsWith(`__PIAGENT_`)?$e:void 0,prepend:!0}),tt=(0,C.lazy)(()=>Ze(()=>import(`./InspectionApp-9jBsgkVJ.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]))),nt=(0,C.lazy)(()=>Ze(()=>import(`./GatewayApp-BmkqeXih.js`),__vite__mapDeps([14,1,2,7,3,4,9,15,10,11,12,16,5,17])));function rt(e,t,n){try{let r=window.localStorage.getItem(e);return r&&t.includes(r)?r:n}catch{return n}}function it(){let[e,t]=(0,C.useState)(()=>rt(`piagent-webui-locale`,[`vi`,`en`],qe(window.navigator?.languages??[window.navigator?.language??``]))),[n,r]=(0,C.useState)(()=>rt(`piagent-webui-theme`,ie.map(e=>e.id),``)||ne[rt(`piagent-webui-color-mode`,[`light`,`dark`],window.matchMedia?.(`(prefers-color-scheme: light)`).matches?`light`:`dark`)]),i=ae(n)??ae(ne.dark),a=i.mode,o=(0,C.useCallback)(e=>r(t=>ae(t)?.mode===e?t:ne[e]),[]),s=(0,C.useMemo)(()=>Ke(i),[i]);(0,C.useEffect)(()=>{document.documentElement.lang=e,document.documentElement.dataset.piagentColorMode=a,document.documentElement.dataset.piagentTheme=i.id;try{window.localStorage.setItem(`piagent-webui-locale`,e),window.localStorage.setItem(`piagent-webui-color-mode`,a),window.localStorage.setItem(`piagent-webui-theme`,i.id)}catch{}},[a,e,i]);let c=(0,C.useMemo)(()=>({locale:e,colorMode:a,themeId:i.id,setLocale:t,setColorMode:o,setThemeId:r}),[a,e,i,o]),l=document.querySelector(`meta[name="piagent-webui-mode"]`)?.content;return(0,E.jsx)(oe,{value:c,children:(0,E.jsxs)(Ue,{theme:s,children:[(0,E.jsx)(Ie,{}),(0,E.jsx)(Ge,{locale:e,children:l===`gateway`?(0,E.jsx)(nt,{}):(0,E.jsx)(tt,{})})]})})}(0,We.createRoot)(Qe).render((0,E.jsx)(C.StrictMode,{children:(0,E.jsx)(u,{value:et,children:(0,E.jsx)(it,{})})}));export{Ge as n,Ze as t};
|
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
<meta name="csp-nonce" content="__PIAGENT_CSP_NONCE__" />
|
|
8
8
|
<meta name="piagent-webui-mode" content="__PIAGENT_WEBUI_MODE__" />
|
|
9
9
|
<title>Piagent WebUI</title>
|
|
10
|
-
<script type="module" crossorigin src="/assets/index-
|
|
10
|
+
<script type="module" crossorigin src="/assets/index-fUpioGMZ.js"></script>
|
|
11
11
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
|
|
12
12
|
<link rel="modulepreload" crossorigin href="/assets/vendor-DNZbaWhT.js">
|
|
13
13
|
<link rel="modulepreload" crossorigin href="/assets/ui-preferences-OfS30-ZV.js">
|
|
14
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
14
|
+
<link rel="stylesheet" crossorigin href="/assets/index-De7bIeMc.css">
|
|
15
15
|
</head>
|
|
16
16
|
<body>
|
|
17
17
|
<div id="root"></div>
|
|
@@ -2,6 +2,7 @@ import { randomBytes } from "node:crypto";
|
|
|
2
2
|
|
|
3
3
|
import { redactSensitiveText } from "../../piagent-core/security/sensitive-data.js";
|
|
4
4
|
import { hasVisibleText } from "../shared/text-visibility.ts";
|
|
5
|
+
import { summarizeToolCall } from "../server/tool-call-summary.ts";
|
|
5
6
|
import type { TerminalDeliveryReceipt } from "../server/terminal-delivery-receipt.ts";
|
|
6
7
|
import { effectiveStopReason } from "../server/message-stop-reason.ts";
|
|
7
8
|
import { GatewayEventStore, type GatewayTaskStatus } from "./gateway-events.ts";
|
|
@@ -106,6 +107,7 @@ export function safeToolFileLabel(toolName: unknown, args: unknown): string | nu
|
|
|
106
107
|
}
|
|
107
108
|
return null;
|
|
108
109
|
}
|
|
110
|
+
const HELPER_KEY = /^[a-z][a-z0-9_#-]{0,31}$/;
|
|
109
111
|
function ref(prefix: string): string { return `${prefix}_${randomBytes(18).toString("base64url")}`; }
|
|
110
112
|
function messageText(message: any): string {
|
|
111
113
|
if (typeof message?.content === "string") return message.content;
|
|
@@ -165,6 +167,7 @@ export class GatewaySessionStream {
|
|
|
165
167
|
#settleListeners: Array<() => void> = [];
|
|
166
168
|
readonly #toolRefs = new Map<string, string>();
|
|
167
169
|
readonly #toolLabels = new Map<string, string>();
|
|
170
|
+
readonly #helperSteps = new Map<string, { step: string; toolCallRef: string; payload: Record<string, unknown> }>();
|
|
168
171
|
readonly #toolFileLabels = new Map<string, string | null>();
|
|
169
172
|
readonly #lifecycle: SessionOperationLifecycle;
|
|
170
173
|
readonly #commitTerminalDeliveryReceipt: ((message: unknown) => TerminalDeliveryReceipt | undefined) | undefined;
|
|
@@ -220,6 +223,7 @@ export class GatewaySessionStream {
|
|
|
220
223
|
// A company subagent started or ended while the main agent was quiet: its
|
|
221
224
|
// count in the catalog row ("Subagent 1/2") changed, and no agent event says so.
|
|
222
225
|
if (event?.type === "managed_helpers") this.#events.publish("catalog.changed", { reasonCode: "managed-helpers-changed" });
|
|
226
|
+
if (event?.type === "managed_helper_state" && Array.isArray(event.helpers)) this.#helperState(event.helpers);
|
|
223
227
|
const wasStarted = this.#lifecycle.started, wasSettled = this.#lifecycle.hostSettled;
|
|
224
228
|
// Summarising the older part of a long conversation can take a minute,
|
|
225
229
|
// right before the model is asked or after it answered: shown as a step
|
|
@@ -310,7 +314,31 @@ export class GatewaySessionStream {
|
|
|
310
314
|
toolCallRef, toolLabel: "capacity-wait", fileLabel: null, isError: failed, reasonCode: failed ? "capacity-wait-expired" : null });
|
|
311
315
|
}
|
|
312
316
|
|
|
317
|
+
// What a company subagent calls: one Activity row per step, named after the
|
|
318
|
+
// subagent. A helper reports only its starts, so the next step ends the last.
|
|
319
|
+
// A helper ending after the turn settled must not reopen it in the browser.
|
|
320
|
+
#helperState(helpers: any[]): void {
|
|
321
|
+
if (this.#lifecycle.hostSettled) return;
|
|
322
|
+
const current = new Map(helpers.filter((helper) => typeof helper?.key === "string" && HELPER_KEY.test(helper.key)).map((helper) => [helper.key as string, helper]));
|
|
323
|
+
for (const [key, shown] of this.#helperSteps) {
|
|
324
|
+
if (current.get(key)?.step === shown.step) continue;
|
|
325
|
+
this.#events.publish("tool.completed", { ...shown.payload, isError: false, reasonCode: null });
|
|
326
|
+
this.#helperSteps.delete(key);
|
|
327
|
+
}
|
|
328
|
+
for (const [key, helper] of current) {
|
|
329
|
+
if (this.#helperSteps.has(key) || typeof helper.tool !== "string") continue;
|
|
330
|
+
const { summary } = summarizeToolCall(helper.tool, helper.args ?? {});
|
|
331
|
+
const detail = redactSensitiveText(String(summary.target ?? summary.detail ?? "")).text.replace(/[\u0000-\u001F\u007F]+/g, " ").trim().slice(0, 400);
|
|
332
|
+
const toolCallRef = ref("tool"), payload = { sessionRef: this.sessionRef, operationRef: this.operationRef, ...this.#correlation(), toolCallRef,
|
|
333
|
+
toolLabel: safeTool(helper.tool), fileLabel: null, agent: key, ...(detail ? { detail } : {}) };
|
|
334
|
+
this.#helperSteps.set(key, { step: helper.step, toolCallRef, payload });
|
|
335
|
+
this.#events.publish("tool.started", { ...payload, isError: null, reasonCode: null });
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
|
|
313
339
|
#settleActiveTools(reasonCode: string): void {
|
|
340
|
+
for (const shown of this.#helperSteps.values()) this.#events.publish("tool.completed", { ...shown.payload, isError: false, reasonCode: null });
|
|
341
|
+
this.#helperSteps.clear();
|
|
314
342
|
for (const [toolCallId, toolCallRef] of this.#toolRefs) {
|
|
315
343
|
this.#events.publish("tool.completed", { sessionRef: this.sessionRef, operationRef: this.operationRef, ...this.#correlation(), toolCallRef,
|
|
316
344
|
toolLabel: this.#toolLabels.get(toolCallId) ?? "tool", fileLabel: this.#toolFileLabels.get(toolCallId) ?? null,
|
|
@@ -30,6 +30,13 @@ export function managedProjection(context: any, entries: any[]) {
|
|
|
30
30
|
// Helpers the Harness enables (up to four); a conversation recorded before
|
|
31
31
|
// that was known says two.
|
|
32
32
|
const maximum = Number.isInteger(counter?.maximum) && counter.maximum >= 0 && counter.maximum <= 4 ? counter.maximum : 2;
|
|
33
|
+
const active = Number.isInteger(counter?.active) && counter.active >= 0 && counter.active <= maximum ? counter.active : 0;
|
|
34
|
+
// Which helpers run and since when, so a long quiet step (the end-of-turn
|
|
35
|
+
// review) is named instead of looking like a stuck turn.
|
|
36
|
+
const isCounter = (e: any) => e.type === 'custom' && e.customType === 'agent-watch-helpers';
|
|
37
|
+
const idleAt = lastIndex(e => isCounter(e) && !e.data?.active);
|
|
38
|
+
const since = active > 0 ? entries.slice(idleAt + 1).find(isCounter)?.timestamp : null;
|
|
39
|
+
const roles = active > 0 && Array.isArray(counter?.roles) ? counter.roles.filter((role: any) => typeof role === 'string' && /^[a-z][a-z0-9_-]{0,31}$/.test(role)).slice(0, 4) : [];
|
|
33
40
|
// The member's access choice; Bypass only while the Harness allows it, else
|
|
34
41
|
// it applies as Full access (permission.mjs).
|
|
35
42
|
const chosen = last('agent-watch-permission')?.mode, bypassAllowed = last('agent-watch-bypass')?.allowed === true;
|
|
@@ -42,7 +49,7 @@ export function managedProjection(context: any, entries: any[]) {
|
|
|
42
49
|
const projectWarnings = Array.isArray(project?.warnings) ? project.warnings.filter((w: any) => kinds.includes(w?.kind) && typeof w.repo === 'string' && w.repo.trim())
|
|
43
50
|
.slice(0, 6).map((w: any) => ({ repo: w.repo.trim().slice(0, 200), kind: w.kind, ...(typeof w.name === 'string' && w.name.trim() ? { name: w.name.trim().slice(0, 80) } : {}) })) : [];
|
|
44
51
|
const projectWarning = projectWarnings.length ? { warnings: projectWarnings, ...(typeof project.team === 'string' && project.team.trim() ? { team: project.team.trim().slice(0, 80) } : {}) } : null;
|
|
45
|
-
return {modelLabel:'agent-watch-auto', managedPermission: permission, ...(bypassAllowed ? {managedBypass: true as const} : {}), ...(fast?.allowed === true ? {managedFast: fast.enabled === true ? 'on' as const : 'off' as const} : {}), managedHelpers:{active:
|
|
52
|
+
return {modelLabel:'agent-watch-auto', managedPermission: permission, ...(bypassAllowed ? {managedBypass: true as const} : {}), ...(fast?.allowed === true ? {managedFast: fast.enabled === true ? 'on' as const : 'off' as const} : {}), managedHelpers:{active, maximum, ...(roles.length ? {roles} : {}), ...(typeof since === 'string' ? {since} : {})},
|
|
46
53
|
...(Array.isArray(capabilities)?{managedThinkingLevels:levels.filter(level=>capabilities.includes(level))}:{}),
|
|
47
54
|
...(steps ? {managedPlan:{steps}} : {}), ...(process ? {managedProcess:process} : {}), ...(turnEnd ? {managedTurnEnd:turnEnd} : {}), ...(review ? {managedReview:review} : {}), ...(projectWarning ? {managedProjectWarning:projectWarning} : {})};
|
|
48
55
|
}
|
|
@@ -131,8 +131,8 @@ function row(key: Buffer, info: PiSessionInfo, metadata: SessionMetadata | undef
|
|
|
131
131
|
needsAttention: metadata?.archived ? false : ownership?.needsAttention ?? false,
|
|
132
132
|
...(gitBranch ? { gitBranch } : {}),
|
|
133
133
|
...(gitRepositories.length ? { gitRepositories } : {}),
|
|
134
|
-
...(sessionOptions?.managedHelpers ? {managedHelpers:
|
|
135
|
-
active: ownership?.liveState === 'idle' ? 0 :
|
|
134
|
+
...(sessionOptions?.managedHelpers ? {managedHelpers:ownership?.liveState === 'running' || ownership?.liveState === 'waiting-approval' ? sessionOptions.managedHelpers
|
|
135
|
+
: {active: ownership?.liveState === 'idle' ? 0 : null, maximum: sessionOptions.managedHelpers.maximum}} : {}),
|
|
136
136
|
...(sessionOptions?.managedThinkingLevels ? {managedThinkingLevels:sessionOptions.managedThinkingLevels} : {}),
|
|
137
137
|
...(sessionOptions?.managedPermission ? {managedPermission:sessionOptions.managedPermission} : {}),
|
|
138
138
|
...(sessionOptions?.managedFast ? {managedFast:sessionOptions.managedFast} : {}),
|
|
@@ -185,3 +185,16 @@ export function modelLabel(message: any): string | null {
|
|
|
185
185
|
const model = typeof message?.model === "string" ? message.model.replace(/[^A-Za-z0-9._:@/-]/g, "").slice(0, 120) : "";
|
|
186
186
|
return model || null;
|
|
187
187
|
}
|
|
188
|
+
|
|
189
|
+
// What a company subagent called ("agent-watch-helper-steps"), for Activity.
|
|
190
|
+
export type HelperRun = { agent: string; startedAt: string; endedAt: string; total: number; steps: Array<{ toolName: string; target: string | null; at: string }> };
|
|
191
|
+
export function helperRun(data: any): HelperRun | null {
|
|
192
|
+
const iso = (value: unknown) => typeof value === "string" && Number.isFinite(Date.parse(value));
|
|
193
|
+
if (typeof data?.agent !== "string" || !/^[a-z][a-z0-9_#-]{0,31}$/.test(data.agent) || !iso(data.startedAt) || !iso(data.endedAt) || !Array.isArray(data.steps)) return null;
|
|
194
|
+
const steps = data.steps.filter((step: any) => typeof step?.tool === "string" && iso(step.at)).slice(-200).map((step: any) => {
|
|
195
|
+
const { summary } = summarizeToolCall(step.tool, step.args ?? {});
|
|
196
|
+
const target = String(redactSensitiveText(String(summary.target ?? summary.detail ?? "")).text ?? "").replace(/[\u0000-\u001F\u007F]+/g, " ").trim().slice(0, 400);
|
|
197
|
+
return { toolName: String(step.tool).replace(/[^\w.:-]+/g, "_").slice(0, 160), target: target || null, at: step.at };
|
|
198
|
+
});
|
|
199
|
+
return { agent: data.agent, startedAt: data.startedAt, endedAt: data.endedAt, total: Number.isInteger(data.total) && data.total >= 0 ? Math.min(data.total, 1_000_000) : steps.length, steps };
|
|
200
|
+
}
|
|
@@ -12,7 +12,7 @@ import { WEBUI_MESSAGE_CORRELATION_ENTRY_TYPE, webUiMessageCorrelationEntry,
|
|
|
12
12
|
import { terminalDeliveryPairs, type TerminalDeliveryPair, type TerminalDeliveryReceipt } from "./terminal-delivery-receipt.ts";
|
|
13
13
|
import { parseFailure } from "../../piagent-core/runtime/managed-failure.mjs";
|
|
14
14
|
import { DOCUMENT_MIMES } from "../../piagent-core/runtime/input/attachment-types.ts";
|
|
15
|
-
import { modelLabel, summarizeToolCall, toolResultPreview, turnUsage, type ToolChange, type ToolResult, type ToolSummary,
|
|
15
|
+
import { helperRun, type HelperRun, modelLabel, summarizeToolCall, toolResultPreview, turnUsage, type ToolChange, type ToolResult, type ToolSummary,
|
|
16
16
|
type TurnUsage } from "./tool-call-summary.ts";
|
|
17
17
|
|
|
18
18
|
const MAX_ENTRIES = 50_000;
|
|
@@ -35,11 +35,11 @@ type TranscriptItem = { messageRef: string; parentMessageRef: string | null; rol
|
|
|
35
35
|
agentOperationId: string | null; messageRequestId?: string; turnIndex: number | null; content: TranscriptContent;
|
|
36
36
|
attachments?: TranscriptAttachment[];
|
|
37
37
|
toolCalls: Array<{ toolCallRef: string; toolName: string; state: "requested" | "completed" | "failed" | "unknown";
|
|
38
|
-
summary?: ToolSummary; change?: ToolChange; result?: ToolResult }>; usage?: TurnUsage; model?: string; process?: HarnessProcess; turnEnd?: TurnEnd };
|
|
38
|
+
summary?: ToolSummary; change?: ToolChange; result?: ToolResult }>; usage?: TurnUsage; model?: string; process?: HarnessProcess; helperRun?: HelperRun; turnEnd?: TurnEnd };
|
|
39
39
|
type HarnessFinding = { severity: "blocking" | "major" | "minor"; file: string; line: number | null; issue: string };
|
|
40
40
|
type HarnessIssue = { kind: "wrong_premise" | "conflicts_with_request" | "ambiguous" | "out_of_scope"; detail: string };
|
|
41
|
-
type HarnessProcess = { phase: "plan" | "verify" | "review" | "final" | "objection" | "answer" | "claims" | "rejudge" | "dispute" | "continue" | "undo"; outcome?: string; loop?: number; maxLoops?: number;
|
|
42
|
-
verified?: boolean; reviewed?: boolean; blockingOpen?: number; planOpen?: number; planDone?: number; planSteps?: number; round?: number; maxRounds?: number; idle?: number; planSkipped?: true; verifyPolicy?: string; reviewPolicy?: string; reviewUnavailable?: string;
|
|
41
|
+
type HarnessProcess = { phase: "plan" | "verify" | "review" | "reviewing" | "final" | "objection" | "answer" | "claims" | "rejudge" | "dispute" | "continue" | "undo"; outcome?: string; loop?: number; maxLoops?: number;
|
|
42
|
+
verified?: boolean; reviewed?: boolean; blockingOpen?: number; planOpen?: number; planDone?: number; planSteps?: number; round?: number; maxRounds?: number; idle?: number; planSkipped?: true; partOnly?: true; verifyPolicy?: string; reviewPolicy?: string; reviewUnavailable?: string;
|
|
43
43
|
findings?: HarnessFinding[]; role?: "scout" | "research" | "verify" | "review"; by?: "main" | "harness"; disputes?: number; unchanged?: true; issues?: HarnessIssue[]; claims?: { claim: string }[];
|
|
44
44
|
undo?: { result: "done" | "refused" | "busy" | "none" | "failed"; restored: number; removed: number; files: string[]; more?: boolean } };
|
|
45
45
|
export type TranscriptDocument = { schemaVersion: 1; version: "piagent-webui-transcript-v1"; generatedAt: string; identity: TranscriptIdentity;
|
|
@@ -216,7 +216,7 @@ const PROCESS_OUTCOMES = ["no_change", "interrupted", "disputed", "blocking_open
|
|
|
216
216
|
// A helper's objection to its brief, a failed claim, a disagreement handed to the member.
|
|
217
217
|
// "continue": the harness sent the agent back to a checklist with open steps.
|
|
218
218
|
// "undo": the member's /undo put the last turn's files back (checkpoints.mjs).
|
|
219
|
-
const PROCESS_PHASES = ["plan", "verify", "review", "final", "objection", "answer", "claims", "rejudge", "dispute", "continue", "undo"];
|
|
219
|
+
const PROCESS_PHASES = ["plan", "verify", "review", "reviewing", "final", "objection", "answer", "claims", "rejudge", "dispute", "continue", "undo"];
|
|
220
220
|
const ISSUE_KINDS = ["wrong_premise", "conflicts_with_request", "ambiguous", "out_of_scope"], HELPER_ROLES = ["scout", "research", "verify", "review"];
|
|
221
221
|
const POLICY_MODES = ["off", "suggest", "require"];
|
|
222
222
|
function harnessProcess(details: any): HarnessProcess | null {
|
|
@@ -237,6 +237,7 @@ function harnessProcess(details: any): HarnessProcess | null {
|
|
|
237
237
|
if (upTo(details.maxRounds, 1, 30)) out.maxRounds = details.maxRounds;
|
|
238
238
|
if (upTo(details.idle, 1, 2)) out.idle = details.idle;
|
|
239
239
|
if (details.planSkipped === true) out.planSkipped = true;
|
|
240
|
+
if (details.partOnly === true) out.partOnly = true;
|
|
240
241
|
if (POLICY_MODES.includes(details.policy?.verify)) out.verifyPolicy = details.policy.verify;
|
|
241
242
|
if (POLICY_MODES.includes(details.policy?.review)) out.reviewPolicy = details.policy.review;
|
|
242
243
|
if (["too_large", "not_git", "limit", "failed"].includes(details.reviewUnavailable)) out.reviewUnavailable = details.reviewUnavailable;
|
|
@@ -323,6 +324,13 @@ function correlatedTranscriptItems(entries: unknown[], identity: TranscriptIdent
|
|
|
323
324
|
cursor: opaque("transcript", [identity.sessionRef, entry.id]) });
|
|
324
325
|
continue;
|
|
325
326
|
}
|
|
327
|
+
if (entry?.type === "custom" && ["agent-watch-helper-steps", "agent-watch-review-start"].includes(entry.customType)) {
|
|
328
|
+
const run = entry.customType === "agent-watch-helper-steps" ? helperRun(entry.data) : null;
|
|
329
|
+
const projected = (run || entry.customType === "agent-watch-review-start") && item({ ...entry, type: "message", message: { role: "custom", content: "" } }, identity, true);
|
|
330
|
+
if (projected) values.push({ entry, item: { ...projected, ...(run ? { helperRun: run } : { process: { phase: "reviewing" as const } }), ...(turn ? { agentOperationId: turn.operationRef, messageRequestId: turn.messageRequestId } : {}) },
|
|
331
|
+
cursor: opaque("transcript", [identity.sessionRef, entry.id]) });
|
|
332
|
+
continue;
|
|
333
|
+
}
|
|
326
334
|
if (entry?.type === "custom_message" && entry.customType === "agent-watch-process") {
|
|
327
335
|
const process = harnessProcess(entry.details);
|
|
328
336
|
const projected = process && item({ ...entry, type: "message", message: { role: "custom", content: entry.content } }, identity, true);
|
|
@@ -4,7 +4,7 @@ import { failureRoleText, type CopyLocale, type FailureRole } from "./company-co
|
|
|
4
4
|
|
|
5
5
|
export type ProcessCopyInput = {
|
|
6
6
|
phase?: string; outcome?: string; loop?: number; maxLoops?: number; verified?: boolean; reviewed?: boolean; blockingOpen?: number;
|
|
7
|
-
planOpen?: number; planDone?: number; planSteps?: number; round?: number; maxRounds?: number; idle?: number; planSkipped?: boolean; verifyPolicy?: string; reviewPolicy?: string; reviewUnavailable?: string; role?: FailureRole;
|
|
7
|
+
planOpen?: number; planDone?: number; planSteps?: number; round?: number; maxRounds?: number; idle?: number; planSkipped?: boolean; partOnly?: boolean; verifyPolicy?: string; reviewPolicy?: string; reviewUnavailable?: string; role?: FailureRole;
|
|
8
8
|
disputes?: number; unchanged?: boolean;
|
|
9
9
|
findings?: Array<{ severity: string; file?: string; line?: number | null; issue: string }>;
|
|
10
10
|
claims?: Array<{ claim: string }>; issues?: Array<{ kind: string; detail: string }>;
|
|
@@ -26,7 +26,8 @@ export function outcomeText(process: ProcessCopyInput, locale: CopyLocale): stri
|
|
|
26
26
|
if (process.outcome === "disputed") parts.push((process.disputes ?? 1) > 1 ? pick(locale, `${process.disputes} conflict giữa main agent và subagent, bạn quyết định`, `${process.disputes} disagreements between the main agent and a subagent; your call`)
|
|
27
27
|
: pick(locale, "Main agent và subagent conflict, bạn quyết định", "The main agent and a subagent disagree; your call"));
|
|
28
28
|
if (process.unchanged) return parts.join(" · ") || pick(locale, "Không đổi code", "No code changed");
|
|
29
|
-
if (process.verified) parts.push(pick(locale, "
|
|
29
|
+
if (process.verified) parts.push(process.partOnly ? pick(locale, "Chỉ một phần test pass trên code cuối", "Only part of the test suite passed on the final code")
|
|
30
|
+
: pick(locale, "Check đã pass trên code cuối", "A check passed on the final code"));
|
|
30
31
|
else if (process.verifyPolicy !== "off") parts.push(pick(locale, "Chưa có check pass trên code cuối", "No check passed on the final code"));
|
|
31
32
|
if (process.reviewed) parts.push(process.blockingOpen ? pick(locale, `Còn ${process.blockingOpen} lỗi blocking chưa fix`, `${process.blockingOpen} blocking issue(s) still open`)
|
|
32
33
|
: pick(locale, "Review không có lỗi blocking", "Review found no blocking issue"));
|
|
@@ -609,6 +609,8 @@
|
|
|
609
609
|
"maxLength": 160,
|
|
610
610
|
"pattern": "^[^/\\\\\\u0000-\\u001F\\u007F]+$"
|
|
611
611
|
},
|
|
612
|
+
"agent": { "type": "string", "maxLength": 32, "pattern": "^[a-z][a-z0-9_#-]{0,31}$" },
|
|
613
|
+
"detail": { "type": "string", "minLength": 1, "maxLength": 400, "pattern": "^[^\\u0000-\\u001F\\u007F]+$" },
|
|
612
614
|
"isError": { "type": ["boolean", "null"] },
|
|
613
615
|
"reasonCode": { "$ref": "common-v1.schema.json#/$defs/nullableReasonCode" }
|
|
614
616
|
}
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"unread": { "type": "boolean" },
|
|
92
92
|
"composerAvailable": { "type": "boolean" },
|
|
93
93
|
"needsAttention": { "type": "boolean" },
|
|
94
|
-
"managedHelpers": { "type": "object", "additionalProperties": false, "required": ["active", "maximum"], "properties": {"active": {"type": ["integer", "null"], "minimum": 0, "maximum": 4}, "maximum": {"type": "integer", "minimum": 0, "maximum": 4}} },
|
|
94
|
+
"managedHelpers": { "type": "object", "additionalProperties": false, "required": ["active", "maximum"], "properties": {"active": {"type": ["integer", "null"], "minimum": 0, "maximum": 4}, "maximum": {"type": "integer", "minimum": 0, "maximum": 4}, "roles": {"type": "array", "maxItems": 4, "items": {"type": "string", "maxLength": 32, "pattern": "^[a-z][a-z0-9_-]{0,31}$"}}, "since": {"type": "string", "maxLength": 40, "format": "date-time"}} },
|
|
95
95
|
"managedThinkingLevels": {"type": "array", "uniqueItems": true, "maxItems": 7, "items": {"enum": ["off","minimal","low","medium","high","xhigh","max"]}}, "managedPermission": {"enum": ["workspace-write","trusted-full-access","bypass"]}, "managedBypass": {"const": true}, "managedProjectWarning": {"type": "object", "additionalProperties": false, "required": ["warnings"], "properties": {"team": {"type": "string", "minLength": 1, "maxLength": 80}, "warnings": {"type": "array", "minItems": 1, "maxItems": 6, "items": {"type": "object", "additionalProperties": false, "required": ["repo", "kind"], "properties": {"repo": {"type": "string", "minLength": 1, "maxLength": 200}, "name": {"type": "string", "minLength": 1, "maxLength": 80}, "kind": {"enum": ["other_team", "unlisted", "unregistered", "no_repository"]}}}}}}, "managedFast": {"enum": ["off","on"]},
|
|
96
96
|
"managedPlan": { "type": "object", "additionalProperties": false, "required": ["steps"], "properties": {
|
|
97
97
|
"steps": { "type": "array", "minItems": 1, "maxItems": 30, "items": { "type": "object", "additionalProperties": false, "required": ["step", "status"], "properties": {
|
|
@@ -152,12 +152,27 @@
|
|
|
152
152
|
}
|
|
153
153
|
]
|
|
154
154
|
},
|
|
155
|
+
"helperRun": {
|
|
156
|
+
"type": "object",
|
|
157
|
+
"additionalProperties": false,
|
|
158
|
+
"required": ["agent", "startedAt", "endedAt", "total", "steps"],
|
|
159
|
+
"properties": {
|
|
160
|
+
"agent": { "type": "string", "maxLength": 32, "pattern": "^[a-z][a-z0-9_#-]{0,31}$" },
|
|
161
|
+
"startedAt": { "type": "string", "maxLength": 40, "format": "date-time" },
|
|
162
|
+
"endedAt": { "type": "string", "maxLength": 40, "format": "date-time" },
|
|
163
|
+
"total": { "type": "integer", "minimum": 0, "maximum": 1000000 },
|
|
164
|
+
"steps": { "type": "array", "maxItems": 200, "items": { "type": "object", "additionalProperties": false, "required": ["toolName", "target", "at"], "properties": {
|
|
165
|
+
"toolName": { "type": "string", "minLength": 1, "maxLength": 160 },
|
|
166
|
+
"target": { "type": ["string", "null"], "maxLength": 400 },
|
|
167
|
+
"at": { "type": "string", "maxLength": 40, "format": "date-time" } } } }
|
|
168
|
+
}
|
|
169
|
+
},
|
|
155
170
|
"harnessProcess": {
|
|
156
171
|
"type": "object",
|
|
157
172
|
"additionalProperties": false,
|
|
158
173
|
"required": ["phase"],
|
|
159
174
|
"properties": {
|
|
160
|
-
"phase": { "enum": ["plan", "verify", "review", "final", "objection", "answer", "claims", "rejudge", "dispute", "continue", "undo"] },
|
|
175
|
+
"phase": { "enum": ["plan", "verify", "review", "reviewing", "final", "objection", "answer", "claims", "rejudge", "dispute", "continue", "undo"] },
|
|
161
176
|
"undo": {
|
|
162
177
|
"type": "object",
|
|
163
178
|
"additionalProperties": false,
|
|
@@ -210,6 +225,7 @@
|
|
|
210
225
|
"maxRounds": { "type": "integer", "minimum": 1, "maximum": 30 },
|
|
211
226
|
"idle": { "type": "integer", "minimum": 1, "maximum": 2 },
|
|
212
227
|
"planSkipped": { "const": true },
|
|
228
|
+
"partOnly": { "const": true },
|
|
213
229
|
"verifyPolicy": { "enum": ["off", "suggest", "require"] },
|
|
214
230
|
"reviewPolicy": { "enum": ["off", "suggest", "require"] },
|
|
215
231
|
"reviewUnavailable": { "enum": ["too_large", "not_git", "limit", "failed"] },
|
|
@@ -347,6 +363,7 @@
|
|
|
347
363
|
"model": { "type": "string", "minLength": 1, "maxLength": 120, "pattern": "^[A-Za-z0-9._:@/-]{1,120}$" },
|
|
348
364
|
"failure": { "$ref": "#/$defs/companyFailure" },
|
|
349
365
|
"process": { "$ref": "#/$defs/harnessProcess" },
|
|
366
|
+
"helperRun": { "$ref": "#/$defs/helperRun" },
|
|
350
367
|
"turnEnd": { "$ref": "#/$defs/turnEnd" },
|
|
351
368
|
"toolCalls": {
|
|
352
369
|
"type": "array",
|
|
@@ -376,8 +376,8 @@ export function companyTerminalExtension({ managed, packageRoot, sdkRoot, bindin
|
|
|
376
376
|
showFast(ctx);
|
|
377
377
|
ctx.ui.notify(session.managedFastState() === 'on'
|
|
378
378
|
? session.managedFastServed?.() === false
|
|
379
|
-
? 'Fast đang bật
|
|
380
|
-
: 'Fast đang bật: main agent
|
|
379
|
+
? 'Fast đang bật: model của main agent không hỗ trợ Fast nên main agent chạy tốc độ thường; subagent trên model GPT (Codex) vẫn chạy Fast, token của các lượt đó tính vào quota gấp 2,5 lần.'
|
|
380
|
+
: 'Fast đang bật: main agent và subagent chạy nhanh hơn trên model GPT, model khác giữ tốc độ thường; token chạy Fast tính vào quota gấp 2,5 lần.'
|
|
381
381
|
: 'Fast đang tắt: các lượt chạy tốc độ thường.', 'info');
|
|
382
382
|
} });
|
|
383
383
|
|
|
@@ -64,6 +64,14 @@
|
|
|
64
64
|
"decided": "2026-10-28",
|
|
65
65
|
"until": "2026-11-07",
|
|
66
66
|
"reason": "Denial of service from an unhandled exception in the decompress interceptor; no data exposure. Pinned by the Pi host as above; fixed in undici 8.12.2."
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"id": "GHSA-g3hv-75wg-m249",
|
|
70
|
+
"package": "minimatch",
|
|
71
|
+
"node": "node_modules/minimatch",
|
|
72
|
+
"decided": "2026-10-31",
|
|
73
|
+
"until": "2026-11-07",
|
|
74
|
+
"reason": "Denial of service through globparts amplification; no data exposure. minimatch 10.2.6 is an exact dependency of Pi 1.3.0 and 1.4.0; fixed in minimatch 11.0.1, a major version the Pi host does not take yet."
|
|
67
75
|
}
|
|
68
76
|
]
|
|
69
77
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{An as n,Rn as r}from"./vendor-DNZbaWhT.js";import{i,n as a}from"./ui-preferences-OfS30-ZV.js";import{B as o,x as s}from"./api-BQS4Dtrr.js";import{c}from"./view-model-CWNiS4JN.js";var l=t(r(),1);function u(e,t=`vi`){let n=e.state===`running`?`running`:e.state===`failed`?`failed`:`passed`,r=n===`running`?t===`vi`?`đang chạy`:`running`:n===`failed`?t===`vi`?`thất bại`:`failed`:t===`vi`?`hoàn tất`:`completed`,i=e.startedAt??e.finishedAt??``;return{activityRef:`live.${e.toolCallRef}`,kind:[`bash`,`shell`,`exec`].includes(e.toolLabel)?`command`:`tool`,state:n,label:`${e.toolLabel} ${r}`,preview:t===`vi`?`Cập nhật trực tiếp từ Gateway`:`Live update from the Gateway`,toolCallId:e.toolCallRef,toolName:e.toolLabel,commandDigest:null,logRef:null,exitCode:null,exitCodeExact:!1,startedAt:i,finishedAt:n===`running`?null:e.finishedAt??i}}function d(e,t=`vi`){let n=e.state===`failed`?t===`vi`?`Lượt chạy gặp lỗi`:`Operation failed`:e.state===`blocked`?t===`vi`?`Lượt chạy bị chặn`:`Operation blocked`:e.state===`aborted`?t===`vi`?`Lượt chạy đã dừng`:`Operation stopped`:t===`vi`?`Chưa xác định kết quả lượt chạy`:`Operation outcome unknown`;return{activityRef:e.activityRef,kind:`system`,state:e.state,label:n,preview:e.reasonCode,toolCallId:null,toolName:null,commandDigest:null,logRef:null,exitCode:null,exitCodeExact:!1,startedAt:e.settledAt,finishedAt:e.settledAt}}function f(e,t,n,r=`vi`,i){let a=[...e,...t],o=new Set(a.map(e=>e.activityRef)),s=n.filter(e=>!o.has(e.activityRef)).map(e=>d(e,r));if(i===void 0)return{rows:[...e,...s,...t],terminalCount:s.length,runningCount:e.length};let c=i.filter(e=>e.state===`running`).map(e=>u(e,r));return{rows:[...c,...s,...t],terminalCount:s.length,runningCount:c.length}}function p(e,t=`vi`){return e.state===`passed`&&/ recovered$/i.test(e.label)?t===`vi`?`Đã khôi phục`:`Recovered`:e.state===`passed`&&/ warning$/i.test(e.label)?t===`vi`?`Đã xử lý cảnh báo`:`Handled warning`:e.state===`passed`&&e.exitCodeExact?`Pass · exit ${e.exitCode??0}`:e.state===`failed`&&e.exitCodeExact?`Fail · exit ${e.exitCode??`?`}`:e.state===`blocked`?`Blocked`:e.state===`aborted`?t===`vi`?`Đã dừng`:`Stopped`:e.state===`unknown`?t===`vi`?`Chưa xác định`:`Unknown`:e.state===`failed`?t===`vi`?`Thất bại`:`Failed`:e.state===`running`?t===`vi`?`Đang chạy`:`Running`:e.state.replaceAll(`-`,` `)}function m(e,t=`vi`){let n=Date.parse(e.startedAt),r=e.finishedAt?Date.parse(e.finishedAt):Date.now();if(!Number.isFinite(n)||!Number.isFinite(r)||r<n)return t===`vi`?`Thời gian chưa xác định`:`Unknown duration`;let i=Math.round((r-n)/1e3);return i<60?`${i}s`:`${Math.floor(i/60)}m ${i%60}s`}var h=e({ActivityPanel:()=>v}),g=n();function _({activity:e,preview:t,onPreview:n,locale:r}){return(0,g.jsxs)(`article`,{className:`activity-row`,children:[(0,g.jsx)(`span`,{className:`activity-state tone-${c(e.state)}`,"aria-label":e.state}),(0,g.jsxs)(`div`,{className:`activity-copy`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`strong`,{children:e.label}),(0,g.jsx)(`span`,{children:e.kind})]}),(0,g.jsx)(`p`,{children:e.preview||a(r,`Không có mô tả ngắn`,`No short description`)}),t&&(0,g.jsxs)(`div`,{className:`log-preview ${t.state===`error`?`error-state`:``}`,children:[t.state===`loading`?a(r,`Đang tải log ngắn…`,`Loading log preview…`):t.state===`error`?a(r,`Log preview không còn sẵn sàng.`,`Log preview is no longer available.`):t.value?.preview??`${a(r,`Không có nội dung log`,`No log content`)} · ${t.value?.reasonCode??`unavailable`}`,t.value?.truncated&&(0,g.jsx)(`small`,{children:a(r,`Preview đã được rút gọn`,`Preview truncated`)})]})]}),(0,g.jsxs)(`div`,{className:`activity-result`,children:[(0,g.jsx)(`strong`,{children:p(e,r)}),(0,g.jsx)(`span`,{children:m(e,r)}),e.logRef&&n&&(0,g.jsx)(`button`,{type:`button`,onClick:n,"aria-expanded":!!t,children:t?a(r,`Ẩn log`,`Hide log`):a(r,`Xem log`,`View log`)})]})]})}function v({snapshot:e,sessionRef:t,terminalActivities:n=[],liveActivities:r}){let{locale:c}=i(),[u,d]=(0,l.useState)({}),p=e?.activity.running??[],m=e?.activity.recent??[],{rows:h,terminalCount:v,runningCount:y}=f(p,m,n,c,r),b=e=>{if(u[e.activityRef]){d(t=>({...t,[e.activityRef]:void 0}));return}d(t=>({...t,[e.activityRef]:{state:`loading`}})),(t?o(t,e.activityRef):s(e.activityRef)).then(t=>d(n=>({...n,[e.activityRef]:{state:`ready`,value:t}}))).catch(()=>d(t=>({...t,[e.activityRef]:{state:`error`}})))};return(0,g.jsxs)(`section`,{className:`activity-panel surface`,"aria-labelledby":`activity-title`,children:[(0,g.jsxs)(`header`,{className:`panel-heading`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`section-kicker`,children:`Activity`}),(0,g.jsx)(`h2`,{id:`activity-title`,children:a(c,`Tool, command và kết quả lượt chạy`,`Tools, commands, and operation outcomes`)})]}),(0,g.jsxs)(`div`,{children:[(0,g.jsxs)(`span`,{className:`running-count`,children:[y,` `,a(c,`đang chạy`,`running`)]}),(0,g.jsxs)(`span`,{children:[m.length+v,` `,a(c,`gần đây`,`recent`)]})]})]}),(0,g.jsxs)(`div`,{className:`activity-list`,children:[h.map(e=>(0,g.jsx)(_,{activity:e,preview:u[e.activityRef],onPreview:e.logRef?()=>b(e):void 0,locale:c},e.activityRef)),h.length===0&&(0,g.jsx)(`div`,{className:`activity-empty`,children:a(c,`Chưa có tool, command hoặc kết quả lượt chạy nào trong timeline hiện tại.`,`No tools, commands, or operation outcomes in the current timeline.`)})]}),e?.activity.page.truncated&&(0,g.jsx)(`footer`,{className:`panel-footnote`,children:a(c,`Timeline đã được rút gọn theo giới hạn local.`,`The timeline was truncated to local limits.`)})]})}export{h as n,v as t};
|