@zonease/aiworker-cli 0.15.0 → 0.15.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/aiworker-bun.js
CHANGED
|
@@ -1715,7 +1715,7 @@ ${A}`)}formatType(D,u,r){let A=HQ[D.type]||nQ[D.level]||"gray";if(u)return YQ(A)
|
|
|
1715
1715
|
`)});if(f)w=f(w)||w;console.log(w.map(($)=>{return $.title?`${$.title}:
|
|
1716
1716
|
${$.body}`:$.body}).join(`
|
|
1717
1717
|
|
|
1718
|
-
`))}outputVersion(){let{name:D}=this.cli,{versionNumber:u}=this.cli.globalCommand;if(u)console.log(`${D}/${u} ${hh}`)}checkRequiredArgs(){let D=this.args.filter((u)=>u.required).length;if(this.cli.args.length<D)throw new df(`missing required args for command \`${this.rawName}\``)}checkUnknownOptions(){let{options:D,globalCommand:u}=this.cli;if(!this.config.allowUnknownOptions){for(let r of Object.keys(D))if(r!=="--"&&!this.hasOption(r)&&!u.hasOption(r))throw new df(`Unknown option \`${r.length>1?`--${r}`:`-${r}`}\``)}}checkOptionValue(){let{options:D,globalCommand:u}=this.cli,r=[...u.options,...this.options];for(let A of r){let f=D[A.name.split(".")[0]];if(A.required){let w=r.some((F)=>F.negated&&F.names.includes(A.name));if(f===!0||f===!1&&!w)throw new df(`option \`${A.rawName}\` value is missing`)}}}}class C$ extends G${constructor(D){super("@@global@@","",{},D)}}var of=Object.assign;class aB extends Xh{constructor(D=""){super();this.name=D,this.commands=[],this.rawArgs=[],this.args=[],this.options={},this.globalCommand=new C$(this),this.globalCommand.usage("<command> [options]")}usage(D){return this.globalCommand.usage(D),this}command(D,u,r){let A=new G$(D,u||"",r,this);return A.globalCommand=this.globalCommand,this.commands.push(A),A}option(D,u,r){return this.globalCommand.option(D,u,r),this}help(D){return this.globalCommand.option("-h, --help","Display this message"),this.globalCommand.helpCallback=D,this.showHelpOnExit=!0,this}version(D,u="-v, --version"){return this.globalCommand.version(D,u),this.showVersionOnExit=!0,this}example(D){return this.globalCommand.example(D),this}outputHelp(){if(this.matchedCommand)this.matchedCommand.outputHelp();else this.globalCommand.outputHelp()}outputVersion(){this.globalCommand.outputVersion()}setParsedInfo({args:D,options:u},r,A){if(this.args=D,this.options=u,r)this.matchedCommand=r;if(A)this.matchedCommandName=A;return this}unsetMatchedCommand(){this.matchedCommand=void 0,this.matchedCommandName=void 0}parse(D=Kh,{run:u=!0}={}){if(this.rawArgs=D,!this.name)this.name=D[1]?Vh(D[1]):"cli";let r=!0;for(let f of this.commands){let w=this.mri(D.slice(2),f),F=w.args[0];if(f.isMatched(F)){r=!1;let E=of(of({},w),{args:w.args.slice(1)});this.setParsedInfo(E,f,F),this.emit(`command:${F}`,f)}}if(r){for(let f of this.commands)if(f.name===""){r=!1;let w=this.mri(D.slice(2),f);this.setParsedInfo(w,f),this.emit("command:!",f)}}if(r){let f=this.mri(D.slice(2));this.setParsedInfo(f)}if(this.options.help&&this.showHelpOnExit)this.outputHelp(),u=!1,this.unsetMatchedCommand();if(this.options.version&&this.showVersionOnExit&&this.matchedCommandName==null)this.outputVersion(),u=!1,this.unsetMatchedCommand();let A={args:this.args,options:this.options};if(u)this.runMatchedCommand();if(!this.matchedCommand&&this.args[0])this.emit("command:*");return A}mri(D,u){let r=[...this.globalCommand.options,...u?u.options:[]],A=Ph(r),f=[],w=D.indexOf("--");if(w>-1)f=D.slice(w+1),D=D.slice(0,w);let F=Mh(D,A);F=Object.keys(F).reduce((S,B)=>{return of(of({},S),{[mB(B)]:F[B]})},{_:[]});let E=F._,$={"--":f},g=u&&u.config.ignoreOptionDefaultValue?u.config.ignoreOptionDefaultValue:this.globalCommand.config.ignoreOptionDefaultValue,R=Object.create(null);for(let S of r){if(!g&&S.config.default!==void 0)for(let B of S.names)$[B]=S.config.default;if(Array.isArray(S.config.type)){if(R[S.name]===void 0)R[S.name]=Object.create(null),R[S.name].shouldTransform=!0,R[S.name].transformFunction=S.config.type[0]}}for(let S of Object.keys(F))if(S!=="_"){let B=S.split(".");kh($,B,F[S]),Ih($,R)}return{args:E,options:$}}runMatchedCommand(){let{args:D,options:u,matchedCommand:r}=this;if(!r||!r.commandAction)return;r.checkUnknownOptions(),r.checkOptionValue(),r.checkRequiredArgs();let A=[];return r.args.forEach((f,w)=>{if(f.variadic)A.push(D.slice(w));else A.push(D[w])}),A.push(u),r.commandAction.apply(this,A)}}var Nh=(D="")=>new aB(D),eB=Nh;D3();var Pu={name:"@zonease/aiworker-cli",type:"module",version:"0.15.
|
|
1718
|
+
`))}outputVersion(){let{name:D}=this.cli,{versionNumber:u}=this.cli.globalCommand;if(u)console.log(`${D}/${u} ${hh}`)}checkRequiredArgs(){let D=this.args.filter((u)=>u.required).length;if(this.cli.args.length<D)throw new df(`missing required args for command \`${this.rawName}\``)}checkUnknownOptions(){let{options:D,globalCommand:u}=this.cli;if(!this.config.allowUnknownOptions){for(let r of Object.keys(D))if(r!=="--"&&!this.hasOption(r)&&!u.hasOption(r))throw new df(`Unknown option \`${r.length>1?`--${r}`:`-${r}`}\``)}}checkOptionValue(){let{options:D,globalCommand:u}=this.cli,r=[...u.options,...this.options];for(let A of r){let f=D[A.name.split(".")[0]];if(A.required){let w=r.some((F)=>F.negated&&F.names.includes(A.name));if(f===!0||f===!1&&!w)throw new df(`option \`${A.rawName}\` value is missing`)}}}}class C$ extends G${constructor(D){super("@@global@@","",{},D)}}var of=Object.assign;class aB extends Xh{constructor(D=""){super();this.name=D,this.commands=[],this.rawArgs=[],this.args=[],this.options={},this.globalCommand=new C$(this),this.globalCommand.usage("<command> [options]")}usage(D){return this.globalCommand.usage(D),this}command(D,u,r){let A=new G$(D,u||"",r,this);return A.globalCommand=this.globalCommand,this.commands.push(A),A}option(D,u,r){return this.globalCommand.option(D,u,r),this}help(D){return this.globalCommand.option("-h, --help","Display this message"),this.globalCommand.helpCallback=D,this.showHelpOnExit=!0,this}version(D,u="-v, --version"){return this.globalCommand.version(D,u),this.showVersionOnExit=!0,this}example(D){return this.globalCommand.example(D),this}outputHelp(){if(this.matchedCommand)this.matchedCommand.outputHelp();else this.globalCommand.outputHelp()}outputVersion(){this.globalCommand.outputVersion()}setParsedInfo({args:D,options:u},r,A){if(this.args=D,this.options=u,r)this.matchedCommand=r;if(A)this.matchedCommandName=A;return this}unsetMatchedCommand(){this.matchedCommand=void 0,this.matchedCommandName=void 0}parse(D=Kh,{run:u=!0}={}){if(this.rawArgs=D,!this.name)this.name=D[1]?Vh(D[1]):"cli";let r=!0;for(let f of this.commands){let w=this.mri(D.slice(2),f),F=w.args[0];if(f.isMatched(F)){r=!1;let E=of(of({},w),{args:w.args.slice(1)});this.setParsedInfo(E,f,F),this.emit(`command:${F}`,f)}}if(r){for(let f of this.commands)if(f.name===""){r=!1;let w=this.mri(D.slice(2),f);this.setParsedInfo(w,f),this.emit("command:!",f)}}if(r){let f=this.mri(D.slice(2));this.setParsedInfo(f)}if(this.options.help&&this.showHelpOnExit)this.outputHelp(),u=!1,this.unsetMatchedCommand();if(this.options.version&&this.showVersionOnExit&&this.matchedCommandName==null)this.outputVersion(),u=!1,this.unsetMatchedCommand();let A={args:this.args,options:this.options};if(u)this.runMatchedCommand();if(!this.matchedCommand&&this.args[0])this.emit("command:*");return A}mri(D,u){let r=[...this.globalCommand.options,...u?u.options:[]],A=Ph(r),f=[],w=D.indexOf("--");if(w>-1)f=D.slice(w+1),D=D.slice(0,w);let F=Mh(D,A);F=Object.keys(F).reduce((S,B)=>{return of(of({},S),{[mB(B)]:F[B]})},{_:[]});let E=F._,$={"--":f},g=u&&u.config.ignoreOptionDefaultValue?u.config.ignoreOptionDefaultValue:this.globalCommand.config.ignoreOptionDefaultValue,R=Object.create(null);for(let S of r){if(!g&&S.config.default!==void 0)for(let B of S.names)$[B]=S.config.default;if(Array.isArray(S.config.type)){if(R[S.name]===void 0)R[S.name]=Object.create(null),R[S.name].shouldTransform=!0,R[S.name].transformFunction=S.config.type[0]}}for(let S of Object.keys(F))if(S!=="_"){let B=S.split(".");kh($,B,F[S]),Ih($,R)}return{args:E,options:$}}runMatchedCommand(){let{args:D,options:u,matchedCommand:r}=this;if(!r||!r.commandAction)return;r.checkUnknownOptions(),r.checkOptionValue(),r.checkRequiredArgs();let A=[];return r.args.forEach((f,w)=>{if(f.variadic)A.push(D.slice(w));else A.push(D[w])}),A.push(u),r.commandAction.apply(this,A)}}var Nh=(D="")=>new aB(D),eB=Nh;D3();var Pu={name:"@zonease/aiworker-cli",type:"module",version:"0.15.1",description:"AIWorker CLI \u2014 local Host and vertical Soul workspace runtime",license:"MIT",homepage:"https://github.com/ZonEaseTech/aiworker#readme",repository:{type:"git",url:"git+https://github.com/ZonEaseTech/aiworker.git"},publishConfig:{access:"public"},bin:{aiworker:"./dist/aiworker.js"},files:["README.md","dist/"],engines:{bun:">=1.1"},scripts:{typecheck:"tsc --noEmit",test:"bun test --timeout=15000","test:stress":"bun test --timeout=15000 --rerun-each=3 src/commands/worker/init.integration.test.ts src/commands/worker/sessions.test.ts",build:"bun run --filter '@zonease/aiworker-web' build && bun run build:bundle","build:bundle":"bun run --filter '@zonease/aiworker-hr' build && bun run --filter '@zonease/aiworker-qa' build && bun build --target=bun --minify --outfile=dist/aiworker-bun.js src/aiworker.ts && bun scripts/build-publish-manifest.ts",prepublishOnly:"bun run build","smoke:dist-release":"bun scripts/smoke-dist-release.ts"},devDependencies:{"@types/bun":"^1.2.13","@zonease/aiworker-api":"workspace:*","@zonease/aiworker-core":"workspace:*","@zonease/aiworker-fs-layout":"workspace:*","@zonease/aiworker-shared":"workspace:*","@zonease/aiworker-storage-sqlite":"workspace:*",cac:"^6.7.14",consola:"^3.4.2",typescript:"^5.8.3",yaml:"^2.7.1"}};import PA from"process";var dJ="@zonease/aiworker-cli",iQ="https://registry.npmjs.org/@zonease%2Faiworker-cli",kQ="https://api.github.com/repos/ZonEaseTech/aiworker/releases/latest";function b$(D,u){if(u.channel!==void 0&&u.channel!=="stable"&&u.channel!=="preview")throw Error(`unsupported update channel: ${u.channel}`);let r=u.pre===!0||u.channel==="preview",A=u.check===!0?"check":u.dryRun===!0?"dry-run":"apply";return{channel:r?"preview":"stable",command:D,mode:A,prerelease:r,target:u.target,yes:u.yes===!0}}function z$(D){let u=A3(D.argv1),r=A3(D.realArgv1),A=A3(D.moduleDir),f=[u,r,A].filter(Boolean).join(`
|
|
1719
1719
|
`);if(A.includes("/apps/cli/src")||r.endsWith("/apps/cli/src/aiworker.ts"))return{canAutoUpgrade:!1,kind:"source-checkout",reason:"source checkout cannot self-modify"};if(f.includes("/.npm/_npx/")||f.includes("/.bun/install/cache/"))return{canAutoUpgrade:!1,kind:"ephemeral",reason:"ephemeral runner cache cannot be upgraded in place"};if(r3(u,D.npmGlobalBinDirs)||r3(r,D.npmGlobalBinDirs))return{canAutoUpgrade:!0,kind:"npm-global",packageManager:"npm"};if(r3(u,D.bunGlobalBinDirs)||r3(r,D.bunGlobalBinDirs))return{canAutoUpgrade:!0,kind:"bun-global",packageManager:"bun"};if(A.includes("/aiworker-darwin-")||A.includes("/aiworker-linux-"))return{canAutoUpgrade:!0,kind:"github-tarball"};return{canAutoUpgrade:!1,kind:"unknown",reason:"installation source could not be proven"}}function j$(D){let u=[],r;if(QQ(D.currentVersion,D.target.version)>=0)r="already_current";else if(D.source.kind==="unknown")r="source_unknown";else if(!D.source.canAutoUpgrade&&D.options.mode!=="check")r="source_not_supported";else if(D.source.kind==="github-tarball"&&D.options.mode!=="check"&&(!D.target.downloadUrl||!D.target.checksumUrl))r="source_not_supported";else r="update_available";if(r==="update_available"&&D.options.mode!=="check"){if(D.source.packageManager)u.push(VQ(D.source.packageManager,D.target.version));else if(D.source.kind==="github-tarball"&&D.target.downloadUrl&&D.target.checksumUrl)u.push({checksumUrl:D.target.checksumUrl,downloadUrl:D.target.downloadUrl,kind:"github-tarball"});if(D.options.mode==="apply"&&u.length>0)u.push({kind:"host-convergence"},{kind:"daemon-restart"})}return{actions:u,currentVersion:D.currentVersion,mode:D.options.mode,requiresConfirmation:D.options.mode==="apply"&&u.length>0&&!D.options.yes,source:D.source,status:r,target:D.target,targetVersion:D.target.version}}async function T$(D){if(D.options.target)return{checksumUrl:null,downloadUrl:null,isPrerelease:D.options.prerelease,source:D.source.kind==="github-tarball"?"github":"npm",version:D.options.target};if(D.source.kind==="github-tarball"){let f=hQ(await yJ(D.fetch,kQ)),w=(D.platformAssetName??IQ)(),F=f.assets.find(($)=>$.name===w),E=f.assets.find(($)=>$.name===`${w}.sha256`);return{checksumUrl:lJ(E,`${w}.sha256`),downloadUrl:lJ(F,w),isPrerelease:D.options.prerelease,source:"github",version:f.tag_name.replace(/^v/,"")}}let u=KQ(await yJ(D.fetch,iQ)),r=D.options.prerelease?"preview":"latest",A=u["dist-tags"]?.[r];if(typeof A!=="string"||A.length===0)throw Error(`npm dist-tag not found: ${r}`);return{checksumUrl:null,downloadUrl:null,isPrerelease:D.options.prerelease,source:"npm",version:A}}async function xJ(D){if(D.plan.mode==="dry-run")return{completedActions:[],status:"dry_run"};if(D.plan.status!=="update_available"||D.plan.actions.length===0)return{completedActions:[],status:"skipped"};let u=[];for(let r of D.plan.actions){if(r.kind==="package-manager"){if(!r.command||!r.args)throw Error("package-manager upgrade action is missing command or args");await u3(D.runCommand,"runCommand")(r.command,r.args)}else if(r.kind==="github-tarball"){if(!r.downloadUrl||!r.checksumUrl)throw Error("github tarball upgrade action requires downloadUrl and checksumUrl");await u3(D.downloadAndReplace,"downloadAndReplace")({checksumUrl:r.checksumUrl,downloadUrl:r.downloadUrl})}else if(r.kind==="host-convergence")await u3(D.convergeHost,"convergeHost")();else await u3(D.restartDaemon,"restartDaemon")();u.push(r.kind)}return{completedActions:u,status:"completed"}}function mJ(D,u){if(!D?.checkedAt)return{canCheck:!0,latestSeenVersion:D?.latestSeenVersion??null};let r=new Date(D.checkedAt),A=u.getTime()-r.getTime();return{canCheck:!Number.isFinite(r.getTime())||A<0||A>=86400000,latestSeenVersion:D.latestSeenVersion??null}}function IQ(){let D=PA.platform==="win32"?"windows":PA.platform,u=PA.arch==="x64"?"x64":PA.arch==="arm64"?"arm64":PA.arch;return`aiworker-${D}-${u}.tar.gz`}function VQ(D,u){if(D==="bun")return{args:["install","-g",`${dJ}@${u}`],command:"bun",kind:"package-manager",packageManager:D};return{args:["install","-g",`${dJ}@${u}`],command:"npm",kind:"package-manager",packageManager:D}}async function yJ(D,u){let r=await(D??globalThis.fetch)(u);if(!r.ok)throw Error(`failed to resolve release target from ${u}: HTTP ${r.status}`);return await r.json()}function KQ(D){if(!f3(D))return{};let u=D["dist-tags"];if(!f3(u))return{};return{"dist-tags":Object.fromEntries(Object.entries(u).filter((r)=>typeof r[1]==="string"))}}function hQ(D){if(!f3(D)||typeof D.tag_name!=="string"||D.tag_name.length===0)throw Error("github release tag not found");if(!Array.isArray(D.assets))throw Error("github release assets invalid");return{assets:D.assets.filter(NQ),tag_name:D.tag_name}}function NQ(D){return f3(D)&&(D.name===void 0||typeof D.name==="string")}function lJ(D,u){if(D===void 0)return null;if(typeof D.browser_download_url!=="string"||D.browser_download_url.trim().length===0)throw Error(`github release asset url invalid: ${u}`);return D.browser_download_url}function u3(D,u){if(D===void 0)throw Error(`upgrade executor hook missing: ${u}`);return D}function f3(D){return typeof D==="object"&&D!==null&&!Array.isArray(D)}function QQ(D,u){let r=tJ(D),A=tJ(u);for(let f=0;f<3;f+=1){let w=r.core[f]??0,F=A.core[f]??0;if(w>F)return 1;if(w<F)return-1}return LQ(r.prerelease,A.prerelease)}function r3(D,u){if(!D)return!1;return(u??[]).map(A3).some((r)=>{if(!r)return!1;return D===r||D.startsWith(`${r}/`)})}function A3(D){if(!D)return"";return D.replaceAll("\\","/").replace(/\/+/g,"/").replace(/\/$/,"")}function LQ(D,u){if(D.length===0&&u.length===0)return 0;if(D.length===0)return 1;if(u.length===0)return-1;let r=Math.max(D.length,u.length);for(let A=0;A<r;A+=1){let f=D[A],w=u[A];if(f===void 0)return-1;if(w===void 0)return 1;let F=cJ(f),E=cJ(w);if(F!==void 0&&E!==void 0){if(F>E)return 1;if(F<E)return-1;continue}if(F!==void 0)return-1;if(E!==void 0)return 1;if(f>w)return 1;if(f<w)return-1}return 0}function cJ(D){if(!/^\d+$/.test(D))return;return Number.parseInt(D,10)}function tJ(D){let u=D.replace(/^v/,"").split("+",1)[0]??"",r=u.indexOf("-"),A=r===-1?u:u.slice(0,r),f=r===-1?void 0:u.slice(r+1);return{core:(A??"").split(".").slice(0,3).map((w)=>Number.parseInt(w,10)).map((w)=>Number.isFinite(w)?w:0),prerelease:f?f.split("."):[]}}var v=eB("aiworker"),x2=L.dirname(Sq(import.meta.url)),rC="soul-app.manifest.json";function RC(D=x2){let u=L.resolve(D,"official-apps");if(ZD(L.join(u,"aiworker-hr",rC)))return u;let r=L.resolve(D,"../../apps");if(ZD(L.join(r,"aiworker-hr",rC)))return r;return}function Bq(D=x2){let u=L.resolve(D,"web","worker");if(ZD(L.join(u,"index.html")))return u;let r=L.resolve(D,"../../web/dist/worker");if(ZD(L.join(r,"index.html")))return r;return}var Jq=".aiworker-dev",Wq=".aiworker";function Gq(D=x2){let u=ZD(L.join(D,"official-apps")),r=ZD(L.join(D,"web","worker"));return u||r?Wq:Jq}function Cq(D=x2){let u=P3({defaultHomeDir:Gq(D)}).home;return{home:u,dbPath:a.env.WORKER_DB_PATH??L.join(u,"aiworker.db"),workersRoot:L.join(u,"workers"),pidFile:L.join(u,"aiworker-daemon.pid"),logFile:L.join(u,"aiworker-daemon.log")}}function Hq(D){a.env.AIWORKER_HOME??=D.home,a.env.WORKER_DB_PATH??=D.dbPath}function m2(){let D=Cq();return Hq(D),D}async function gD(){let D=m2();return await uC(D.home,{recursive:!0}),await uC(L.dirname(D.dbPath),{recursive:!0}),W1(D.dbPath),G1(Zu().WORKER_MIGRATIONS_FOLDER),D}function nq(){let u=pr().find((r)=>r.key==="selected-worker")?.valueJson;return u&&typeof u.workerId==="string"?u.workerId:null}function U7(){return{hostVersion:Pu.version}}function lD(D,u={}){return XA({executor:u.executor,officialAppsRoot:u.officialAppsRoot??RC(),registryContext:u.registryContext??U7,workersRoot:D.workersRoot})}async function p2(D={}){let u=await gD(),r=D.worker??nq();if(!r)throw Error("worker is required; pass --worker or run `aiworker worker select <id>`");let A=PD(r);if(!A)throw Error(`worker not found: ${r}`);let f=lD(u).createRuntimeForWorker(A);return await f.init(),f}async function Iu(){return await gD(),Er()}function Z(D){a.stdout.write(`${JSON.stringify(D,null,2)}
|
|
1720
1720
|
`)}function Vu(D,u){if(typeof D!=="string"||D.trim().length===0)throw Error(`${u} is required`);return D.trim()}function c2(D){let u=D?.[0];return typeof u==="number"&&Number.isFinite(u)?u:void 0}function Uq(D){try{return a.kill(D,0),!0}catch{return!1}}async function Xq(){let D=await gD();Z({home:D.home,dbPath:D.dbPath,workersRoot:D.workersRoot,workers:Er()})}async function Yq(){let D=await gD(),u=await SC();Z({ok:!0,home:D.home,dbPath:D.dbPath,apps:lD(D).listApps(),workers:Er(),workspaces:nu(),daemon:M3(),settings:pr(),updateNotice:u})}async function AC(D,u){let r=b$(D,u),A=X7(a.argv[1]),f=z$({argv1:A,bunGlobalBinDirs:JC(),moduleDir:x2,npmGlobalBinDirs:BC(),realArgv1:Y7(A)}),w=await T$({fetch:($)=>fetch($),options:r,source:f}),F=j$({currentVersion:Pu.version,options:r,source:f,target:w});if(r.mode!=="apply"){Z({update:F});return}if(F.status==="source_not_supported"||F.status==="source_unknown")throw Z({update:F}),Error(`update_not_supported: ${F.source.detail??F.source.reason??F.source.kind}`);if(F.status==="update_available"&&F.actions.length===0)throw Z({update:F}),Error("update_not_actionable");if(F.status!=="update_available"){Z({update:F});return}if(F.requiresConfirmation)throw Z({update:F}),Error("update requires --yes to apply changes");let E=await xJ({convergeHost:async()=>{await Db()},downloadAndReplace:async($)=>{await Mq($)},plan:F,restartDaemon:async()=>{vr.info("AIWorker daemon requires manual restart after CLI upgrade")},runCommand:async($,g)=>{if(await Bun.spawn([$,...g],{stderr:"inherit",stdin:"inherit",stdout:"inherit"}).exited!==0)throw Error(`package manager upgrade failed: ${$} ${g.join(" ")}`)}});Z({update:F,result:E})}async function Mq(D,u={}){let r=Y7(X7(u.currentPath??a.argv[1]));if(!r)throw Error("current binary path is required");let A=u.renameSync??gq,f=u.spawnSync??((J)=>Bun.spawnSync(J)),w=u.fetch??fetch,F=L.dirname(r),E=L.dirname(F),$=_C(L.join(E,".aiworker-update-")),g=L.join($,"aiworker.tar.gz"),R=L.join(E,`.aiworker-next-${a.pid}-${H7()}`),S=L.join(E,`.aiworker-backup-${a.pid}-${H7()}`),B=!1;try{let[J,H]=await Promise.all([Pq(D.checksumUrl,w),Oq(D.downloadUrl,w)]),G=J.trim().split(/\s+/)[0],U=EC("sha256").update(H).digest("hex");if(!G||U!==G)throw Error("checksum_mismatch");Y3(g,H);let O=f(["tar","-xzf",g,"-C",$]);if(O.exitCode!==0){let M=fC(O.stderr);throw Error(`staging_failed: ${M||`tar exited ${O.exitCode}`}`)}let i=n7($).map((M)=>L.join($,M)).filter((M)=>oA(M).isDirectory()),k=i.find((M)=>ZD(L.join(M,"aiworker")));if(!k)throw Error(i.length>0?"staging_failed: aiworker binary not found":"staging_failed: extracted directory not found");let z=L.join(k,"aiworker");if(!ZD(z)||!oA(z).isFile())throw Error("staging_failed: aiworker binary not found");if(!ZD(L.join(k,"web"))||!oA(L.join(k,"web")).isDirectory())throw Error("staging_failed: web assets not found");if(!ZD(L.join(k,"drizzle"))||!oA(L.join(k,"drizzle")).isDirectory())throw Error("staging_failed: drizzle migrations not found");c0(R,{force:!0,recursive:!0}),c0(S,{force:!0,recursive:!0}),A(k,R),Fq(L.join(R,"aiworker"),493);let q=f([L.join(R,"aiworker"),"--version"]);if(q.exitCode!==0){let M=fC(q.stderr);throw Error(`staging_failed: version probe failed${M?`: ${M}`:""}`)}A(F,S);try{A(R,F)}catch(M){throw A(S,F),M}return B=!0,{backupPath:S,installedPath:r}}finally{if(c0($,{recursive:!0,force:!0}),!B)c0(R,{recursive:!0,force:!0})}}function fC(D){if(!D)return"";if(typeof D==="string")return D.trim();return wC.from(D.buffer,D.byteOffset,D.byteLength).toString("utf8").trim()}async function Oq(D,u=fetch){let r=await u(D);if(!r.ok)throw Error(`update asset fetch failed: HTTP ${r.status}`);return wC.from(await r.arrayBuffer())}async function Pq(D,u=fetch){let r=await u(D);if(!r.ok)throw Error(`update checksum fetch failed: HTTP ${r.status}`);return await r.text()}async function SC(){let D=new Date;try{await gD();let r=pr().find((g)=>g.key==="update.notice")?.valueJson??null,A=mJ(r,D);if(!A.canCheck)return A.latestSeenVersion&&kq(A.latestSeenVersion,Pu.version)>0?{channel:"stable",command:"aiworker update",currentVersion:Pu.version,targetVersion:A.latestSeenVersion}:null;let f=b$("update",{check:!0,channel:"stable"}),w=X7(a.argv[1]),F=z$({argv1:w,bunGlobalBinDirs:JC(),moduleDir:x2,npmGlobalBinDirs:BC(),realArgv1:Y7(w)}),E=await T$({fetch:(g)=>iq(g),options:f,source:F}),$=j$({currentVersion:Pu.version,options:f,source:F,target:E});return k0("update.notice",{checkedAt:D.toISOString(),latestSeenVersion:E.version}),$.status==="update_available"?{channel:"stable",command:"aiworker update",currentVersion:Pu.version,targetVersion:E.version}:null}catch(u){let r=u instanceof Error?u.message:String(u);try{let A=pr().find((f)=>f.key==="update.notice")?.valueJson.latestSeenVersion;k0("update.notice",{checkedAt:D.toISOString(),errorMessage:r,latestSeenVersion:typeof A==="string"?A:Pu.version})}catch{}return null}}function BC(){return WC([a.env.npm_config_prefix?L.join(a.env.npm_config_prefix,"bin"):void 0,a.env.PREFIX?L.join(a.env.PREFIX,"bin"):void 0,"/usr/local/bin","/opt/homebrew/bin"])}function JC(){return WC([a.env.BUN_INSTALL?L.join(a.env.BUN_INSTALL,"bin"):void 0,a.env.HOME?L.join(a.env.HOME,".bun","bin"):void 0])}function WC(D){return[...new Set(D.filter((u)=>typeof u==="string"&&u.length>0).map((u)=>L.resolve(u)))]}function X7(D){return D?L.resolve(D):void 0}function Y7(D){if(!D)return;try{return Eq(D)}catch{return D}}async function iq(D){let u=new AbortController,r=setTimeout(()=>u.abort(),750);try{return await fetch(D,{signal:u.signal})}finally{clearTimeout(r)}}function kq(D,u){let r=D.split(/[.-]/).map((w)=>Number.parseInt(w,10)||0),A=u.split(/[.-]/).map((w)=>Number.parseInt(w,10)||0),f=Math.max(r.length,A.length);for(let w=0;w<f;w++){let F=(r[w]??0)-(A[w]??0);if(F!==0)return F}return 0}function M3(){let D=m2();if(!ZD(D.pidFile))return{pid:null,running:!1,logFile:D.logFile};let u=Number.parseInt(t2(D.pidFile,"utf8"),10);return{pid:Number.isFinite(u)?u:null,running:Number.isFinite(u)&&Uq(u),logFile:D.logFile}}async function Iq(D={}){let u=m2();gC(u.home,{recursive:!0});let r=M3();if(r.running)throw Error(`daemon already running: pid=${r.pid}`);Y3(u.logFile,"");let A=$q(u.logFile,"a"),f=$C(a.execPath,[L.resolve(a.argv[1]??"aiworker"),"daemon","foreground",...D.host?["--host",D.host]:[],...D.port?["--port",String(D.port)]:[]],{cwd:a.cwd(),detached:!0,env:{...a.env,AIWORKER_HOME:u.home,WORKER_DB_PATH:u.dbPath},stdio:["ignore",A,A]});if(f.unref(),wq(A),!f.pid)throw Error("daemon did not return a pid");Y3(u.pidFile,String(f.pid)),Z({started:!0,pid:f.pid,logFile:u.logFile,url:`http://127.0.0.1:${D.port??Zu().PORT}`})}async function Vq(){let D=m2(),u=M3();if(!u.pid||!u.running){c0(D.pidFile,{force:!0}),Z({stopped:!1,running:!1});return}a.kill(u.pid,"SIGTERM"),c0(D.pidFile,{force:!0}),Z({stopped:!0,pid:u.pid})}async function FC(D={}){m2();let u=await SC();if(u)vr.info(`[aiworker-daemon] update available: ${u.currentVersion} -> ${u.targetVersion}; run ${u.command}`);let{bootstrapWorkerApp:r}=await Promise.resolve().then(() => (DC(),eG)),{app:A,port:f}=await r({officialAppsRoot:RC(),runtimeVersion:Pu.version,webStaticDir:Bq()}),w=Zu(),F=Bun.serve({fetch:A.fetch,hostname:D.host??w.AIWORKER_WORKER_HOST,idleTimeout:255,port:D.port??f});vr.success(`[aiworker-daemon] listening on http://${F.hostname}:${F.port}`),await new Promise((E)=>{let $=setInterval(()=>{return},60000),g=()=>{clearInterval($),F.stop(),E()};a.once("SIGINT",g),a.once("SIGTERM",g)})}async function Kq(D={}){let u=Zu(),r=`http://${D.host??u.AIWORKER_WORKER_HOST}:${D.port??u.PORT}/health`,A=await fetch(r);Z({ok:A.ok,status:A.status,body:await A.json().catch(()=>null)})}async function hq(D={}){let u=m2().logFile;if(!ZD(u))return;let A=(await _q(u,"utf8")).split(/\r?\n/);a.stdout.write(`${A.slice(-(D.tail??80)).join(`
|
|
1721
1721
|
`)}
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/people-workbench-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/people-workbench-CuoxRrll.js","assets/markdown-preview-DFe-rfff.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{a as e,i as t,n,r}from"./markdown-preview-DFe-rfff.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),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var i=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,C());else{var t=n(l);t!==null&&se(x,t.startTime-e)}}var ee=!1,S=-1,te=5,ne=-1;function re(){return g?!0:!(e.unstable_now()-ne<te)}function ie(){if(g=!1,ee){var t=e.unstable_now();ne=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(S),S=-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&&se(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?C():ee=!1}}}var C;if(typeof y==`function`)C=function(){y(ie)};else if(typeof MessageChannel<`u`){var ae=new MessageChannel,oe=ae.port2;ae.port1.onmessage=ie,C=function(){oe.postMessage(null)}}else C=function(){_(ie,0)};function se(t,n){S=_(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(S),S=-1):h=!0,se(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,ee||(ee=!0,C()))),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}}}})),a=e(((e,t)=>{t.exports=i()})),o=e((e=>{var n=t();function r(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 i(){}var a={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for(`react.portal`);function s(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var c=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(r(299));return s(e,t,null,n)},e.flushSync=function(e){var t=c.T,n=a.p;try{if(c.T=null,a.p=2,e)return e()}finally{c.T=t,a.p=n,a.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,a.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&a.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin),i=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?a.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:o}):n===`script`&&a.d.X(e,{crossOrigin:r,integrity:i,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=l(t.as,t.crossOrigin);a.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??a.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin);a.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=l(t.as,t.crossOrigin);a.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else a.d.m(e)},e.requestFormReset=function(e){a.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return c.H.useFormState(e,t,n)},e.useFormStatus=function(){return c.H.useHostTransitionStatus()},e.version=`19.2.5`})),s=e(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=o()})),c=e((e=>{var n=a(),r=t(),i=s();function o(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(o(188))}function p(e){var t=e.alternate;if(!t){if(t=l(e),t===null)throw Error(o(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(o(188))}if(n.return!==r.return)n=i,r=a;else{for(var s=!1,c=i.child;c;){if(c===n){s=!0,n=i,r=a;break}if(c===r){s=!0,r=i,n=a;break}c=c.sibling}if(!s){for(c=a.child;c;){if(c===n){s=!0,n=a,r=i;break}if(c===r){s=!0,r=a,n=i;break}c=c.sibling}if(!s)throw Error(o(189))}}if(n.alternate!==r)throw Error(o(190))}if(n.tag!==3)throw Error(o(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`),S=Symbol.for(`react.context`),te=Symbol.for(`react.forward_ref`),ne=Symbol.for(`react.suspense`),re=Symbol.for(`react.suspense_list`),ie=Symbol.for(`react.memo`),C=Symbol.for(`react.lazy`),ae=Symbol.for(`react.activity`),oe=Symbol.for(`react.memo_cache_sentinel`),se=Symbol.iterator;function ce(e){return typeof e!=`object`||!e?null:(e=se&&e[se]||e[`@@iterator`],typeof e==`function`?e:null)}var le=Symbol.for(`react.client.reference`);function ue(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===le?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 ne:return`Suspense`;case re:return`SuspenseList`;case ae:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case S:return e.displayName||`Context`;case ee:return(e._context.displayName||`Context`)+`.Consumer`;case te:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case ie:return t=e.displayName||null,t===null?ue(e.type)||`Memo`:t;case C:t=e._payload,e=e._init;try{return ue(e(t))}catch{}}return null}var de=Array.isArray,w=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,T=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,fe={pending:!1,data:null,method:null,action:null},pe=[],me=-1;function he(e){return{current:e}}function ge(e){0>me||(e.current=pe[me],pe[me]=null,me--)}function E(e,t){me++,pe[me]=e.current,e.current=t}var _e=he(null),ve=he(null),ye=he(null),be=he(null);function xe(e,t){switch(E(ye,t),E(ve,e),E(_e,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}}ge(_e),E(_e,e)}function Se(){ge(_e),ge(ve),ge(ye)}function Ce(e){e.memoizedState!==null&&E(be,e);var t=_e.current,n=Hd(t,e.type);t!==n&&(E(ve,e),E(_e,n))}function we(e){ve.current===e&&(ge(_e),ge(ve)),be.current===e&&(ge(be),Qf._currentValue=fe)}var Te,Ee;function De(e){if(Te===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Te=t&&t[1]||``,Ee=-1<e.stack.indexOf(`
|
|
3
3
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
4
|
`+Te+e+Ee}var Oe=!1;function ke(e,t){if(!e||Oe)return``;Oe=!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(`
|
|
@@ -14,5 +14,5 @@ Error generating stack: `+e.message+`
|
|
|
14
14
|
`);for(;s!==-1;){let e=i.slice(0,s);i=i.slice(s+2);let n=pt(e);if(n?.event===`turn`)t.onTurn?.(n.data);else if(n?.event===`session`)t.onSession?.(n.data);else if(n?.event===`session_event`)t.onEvent?.(n.data);else if(n?.event===`result`)a=n.data;else if(n?.event===`error`){let e=n.data;throw Error(e.message??`Session stream failed.`)}s=i.indexOf(`
|
|
15
15
|
|
|
16
16
|
`)}}if(!a)throw Error(`Session stream completed without a result.`);return a}function F(e){return P(`/api/local/settings`,{method:`PATCH`,body:JSON.stringify(e)})}function Ct(){return P(`/api/local/settings/engines/rescan`,{method:`POST`,body:JSON.stringify({})})}function wt(e){return P(`/api/local/settings/engines/test`,{method:`POST`,body:JSON.stringify({engineId:e})})}function Tt(e){return P(`/api/local/workers`,{method:`POST`,body:JSON.stringify(e)})}async function Et(){let[e,t,n,r,i,a,o,s,c,l,u,d,f,p]=await Promise.all([P(`/api/local/info`),P(`/api/local/apps`),P(`/api/local/workers`),P(`/api/local/souls`),P(`/api/local/templates`),P(`/api/local/workspaces`),P(`/api/local/sessions`),P(`/api/local/turns`),P(`/api/local/files`),P(`/api/local/artifacts`),P(`/api/local/reviews`),P(`/api/local/lessons`),P(`/api/local/events`),P(`/api/local/settings`)]);return{info:e,apps:t.apps,workers:n.workers,souls:r.souls,templates:i.templates,workspaces:a.workspaces,sessions:o.sessions,turns:s.turns,files:c.files,artifacts:l.artifacts,reviews:u.reviews,lessons:d.lessons,events:f.events,settings:p.settings}}async function Dt(e,t,n,r){return P(`/api/local/apps/${e}/actions/${t}`,{body:JSON.stringify({input:n,scope:r}),method:`POST`})}async function Ot(e){return P(`/api/local/apps/${e}/enable`,{method:`POST`})}async function kt(e){return P(`/api/local/apps/${e}/security-review`)}async function At(e){return P(`/api/local/apps/${e}/disable`,{method:`POST`})}async function jt(e,t,n,r){let i=new URLSearchParams({providerId:t,query:n});return r!==void 0&&i.set(`limit`,String(r)),P(`/api/local/apps/${e}/search?${i.toString()}`)}function Mt(e,t){return P(`/api/local/workers/${e}/workspaces`,{method:`POST`,body:JSON.stringify(t)})}function Nt(e,t){return ft(`/api/local/workspaces/${e}/files/raw/${t}`)}function Pt({availableSouls:e,copy:t,locale:n,onClose:r,onNameChange:i,onSoulChange:a,onSubmit:o,open:s,selectedSoulId:c,workerName:l}){return(0,f.jsx)(Le,{description:t.workspace.createWorkerHint,open:s,title:t.workspace.createWorker,titleId:`create-worker-dialog-title`,closeLabel:t.accessibility.closeDialog,onClose:r,children:(0,f.jsxs)(`form`,{className:`dialog-form`,onSubmit:o,children:[(0,f.jsx)(Ke,{label:t.create.soul,children:(0,f.jsx)(D,{ariaLabel:t.create.soul,label:t.create.soul,options:e.map(e=>{let t=ct(e,n);return{description:t.domain,label:t.name,value:e.id}}),value:c,onChange:a})}),(0,f.jsx)(Ge,{label:t.workspace.workerName,children:(0,f.jsx)(`input`,{className:`newproj-name`,"aria-label":t.workspace.workerName,placeholder:t.workspace.workerName,value:l,onChange:e=>i(e.target.value)})}),(0,f.jsxs)(`div`,{className:`dialog-actions`,children:[(0,f.jsx)(Pe,{variant:`ghost`,onClick:r,children:t.accessibility.closeDialog}),(0,f.jsxs)(Pe,{variant:`primary`,type:`submit`,disabled:!l.trim()||e.length===0,children:[(0,f.jsx)(xe,{"aria-hidden":`true`,size:13}),(0,f.jsx)(`span`,{children:t.workspace.createWorker})]})]})]})})}function Ft({copy:e,onClose:t,onSubmit:n,onTitleChange:r,open:i,placeholder:a,workerLabel:o,submitting:s,workspaceTitle:c}){return(0,f.jsx)(Le,{description:e.workspace.createWorkspaceHint,open:i,title:e.workspace.createWorkspace,titleId:`create-workspace-dialog-title`,closeLabel:e.accessibility.closeDialog,onClose:t,children:(0,f.jsxs)(`form`,{className:`dialog-form`,onSubmit:n,children:[(0,f.jsx)(Ge,{label:e.workspace.currentWorker,children:(0,f.jsx)(`input`,{readOnly:!0,value:o})}),(0,f.jsx)(Ge,{label:e.create.projectName,children:(0,f.jsx)(`input`,{className:`newproj-name`,"aria-label":e.create.projectName,"data-testid":`new-project-name`,placeholder:a,value:c,onChange:e=>r(e.target.value)})}),(0,f.jsxs)(`div`,{className:`dialog-actions`,children:[(0,f.jsx)(Pe,{variant:`ghost`,onClick:t,children:e.accessibility.closeDialog}),(0,f.jsxs)(Pe,{variant:`primary`,"data-testid":`create-project`,type:`submit`,disabled:!c.trim()||s,children:[(0,f.jsx)(xe,{"aria-hidden":`true`,size:13}),(0,f.jsx)(`span`,{children:e.workspace.createWorkspace})]})]})]})})}function It({copy:e,engineLabel:t,engineReadiness:n,locale:r,onContextChange:i,onOpenSettings:a,onSubmit:o,onTemplateChange:s,selectedTemplate:c,submitting:l,templates:u,value:d,workspace:p}){let m=lt(c,r);return(0,f.jsxs)(`section`,{className:`workspace-session-composer`,"data-testid":`new-session-panel`,children:[(0,f.jsx)(`h2`,{className:`workspace-composer-title`,children:e.workspace.createSessionPrompt(p.name)}),(0,f.jsxs)(`form`,{className:`workspace-composer-box`,onSubmit:o,children:[(0,f.jsx)(`textarea`,{id:`project-context`,className:`workspace-composer-input`,"aria-label":e.create.businessContext,placeholder:e.workspace.createSessionPlaceholder,value:d,onChange:e=>i(e.target.value)}),n.ready?null:(0,f.jsxs)(`div`,{className:`inline-warning workspace-composer-warning`,role:`status`,children:[(0,f.jsx)(Ee,{"aria-hidden":`true`,size:14}),(0,f.jsx)(`span`,{children:n.detail})]}),(0,f.jsxs)(`div`,{className:`workspace-composer-toolbar`,children:[(0,f.jsxs)(`div`,{className:`workspace-composer-tools`,children:[(0,f.jsx)(`span`,{className:`workspace-composer-tool-static`,"aria-hidden":`true`,children:(0,f.jsx)(xe,{size:18})}),(0,f.jsx)(D,{ariaLabel:e.create.capabilityTemplate,className:`workspace-composer-select`,label:e.create.capabilityTemplate,options:u.map(e=>{let t=lt(e,r);return{description:e.outputKind,label:t.name,value:e.id}}),value:c.id,onChange:s}),(0,f.jsxs)(`button`,{type:`button`,className:`workspace-composer-engine`,"aria-label":e.accessibility.openSettings,onClick:a,children:[(0,f.jsx)(Te,{"aria-hidden":`true`,size:14}),(0,f.jsx)(`span`,{children:t})]})]}),(0,f.jsx)(`button`,{className:`primary workspace-composer-submit`,"data-testid":`create-session`,type:`submit`,"aria-label":e.workspace.createSession,disabled:!d.trim()||l||!n.ready,children:(0,f.jsx)(se,{"aria-hidden":`true`,size:18})})]})]}),(0,f.jsx)(`p`,{className:`workspace-composer-hint`,children:e.workspace.createSessionHint(m.name)})]})}function Lt({compact:e=!1,copy:t,locale:n,soul:r,soulCopy:i,worker:a}){return(0,f.jsxs)(Ue,{className:`worker-identity ${e?`compact`:``}`,children:[(0,f.jsxs)(`div`,{className:`worker-identity-head`,children:[(0,f.jsx)(`span`,{className:`kicker`,children:t.workspace.currentWorker}),(0,f.jsx)(`strong`,{children:a?.name??t.workspace.noWorker})]}),(0,f.jsxs)(`div`,{className:`worker-identity-grid`,children:[(0,f.jsx)(`span`,{children:t.workspace.workerId}),(0,f.jsx)(`strong`,{children:a?.id??`-`}),(0,f.jsx)(`span`,{children:t.workspace.workerStatus}),(0,f.jsx)(`strong`,{children:a?ut(a.status,n):t.workspace.noWorker}),(0,f.jsx)(`span`,{children:t.workspace.workerEngine}),(0,f.jsx)(`strong`,{children:a?.defaultEngineId??`-`}),(0,f.jsx)(`span`,{children:t.workspace.workerSoul}),(0,f.jsx)(`strong`,{children:`${i.name} / ${r.id}`})]})]})}function Rt({active:e,artifact:t,item:n,locale:r,onSelect:i,session:a,template:o,turn:s}){let c=ot(r),l=o?lt(o,r):null,u=t?l?.outputKind??t.kind:c.artifact.pending;return(0,f.jsxs)(We,{active:e,className:`design-card`,onClick:i,children:[(0,f.jsx)(`div`,{className:`design-card-thumb`,"aria-hidden":`true`,children:(0,f.jsx)(me,{size:22})}),(0,f.jsxs)(`div`,{className:`design-card-meta-block`,children:[(0,f.jsx)(`div`,{className:`design-card-name`,title:n.name,children:n.name}),(0,f.jsxs)(`div`,{className:`design-card-meta`,children:[(0,f.jsx)(`span`,{className:`ds`,children:l?.name??a?.capabilityTemplateId??c.common.workspace}),` · ${u} · `,(0,f.jsx)(`span`,{className:`design-card-status design-card-status-succeeded`,children:ut(s?.status??a?.status??n.status,r)}),` · ${N(n.updatedAt,r)}`]})]})]})}function zt(e,t){return t.filter(t=>t.sessionId===e.id).sort((e,t)=>e.seq-t.seq)}function Bt(e,t){let n=new Map(e.map(e=>[e.id,e]));return n.set(t.id,t),[...n.values()].sort((e,t)=>e.seq-t.seq)}function Vt(e,t){let n=new Map(e.map(e=>[e.id,e]));return n.set(t.id,t),[...n.values()].sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt))}function Ht(e,t){return t.filter(t=>t.sessionId===e.id).sort((e,t)=>e.seq-t.seq)}function Ut(e,t){return t.filter(t=>t.workspaceId===e.id).sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt))}function Wt(e,t){return t.filter(t=>t.workspaceId===e.id).sort((e,t)=>t.createdAt.localeCompare(e.createdAt))}function Gt(e,t){return t.filter(t=>t.workspaceId===e.id).sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt))}function Kt(e,t,n){return[`Soul: ${e.name}`,`Domain system: ${e.domain}`,`Capability template: ${t.name}`,`Output kind: ${t.outputKind}`,``,`Business context:`,n.trim(),``,`Input hints:`,...t.inputHints.map(e=>`- ${e}`),``,`Review rubric:`,...t.reviewRubric.map(e=>`- ${e}`)].join(`
|
|
17
|
-
`)}function qt(e,t,n){let r=Xt(e,n);return r?Jt(r,t):null}function Jt(e,t){return t.find(t=>t.sessionId===e.id)??null}function Yt(e,t){return t.find(t=>t.sessionId===e.id)??null}function Xt(e,t){return e?t.filter(t=>t.workspaceId===e.id).sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt))[0]??null:null}function Zt(e,t){return e?t.filter(t=>t.sessionId===e.id).sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt))[0]??null:null}function Qt(e){return e.slice().sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt))[0]??null}function $t(e,t){return e===`aiworker-hr`||e===`hr`?t.create.projectPlaceholders.hr:e===`pm`?t.create.projectPlaceholders.pm:e===`aiworker-qa`||e===`qa`?t.create.projectPlaceholders.qa:e===`devops`?t.create.projectPlaceholders.devops:t.create.projectPlaceholders.default}function en(e,t){if(!e)return{detail:t.workspace.engineLoading,label:t.workspace.engineLoading,ready:!1};if(e.executionMode===`byok`){let n=e.byok.provider.trim().length>0&&e.byok.model.trim().length>0&&e.byok.apiKeyRef.trim().length>0;return{detail:n?t.workspace.byokReady(e.byok.provider,e.byok.model):t.workspace.byokNeedsKey,label:`${e.byok.provider} · ${e.byok.model}`,ready:n}}let n=e.engines.find(t=>t.id===e.engineId);return n?{detail:n.installed?t.workspace.engineReadyDetail(n.name):t.workspace.engineNotInstalled(n.name),label:`${n.name}${n.installed?``:` · ${t.common.notInstalled}`}`,ready:n.installed}:{detail:t.workspace.engineMissing(e.engineId),label:e.engineId,ready:!1}}var I={"claude-code":`/engine-icons/claude.svg`,codex:`/engine-icons/openai.svg`,cursor:`/engine-icons/cursor.svg`,gemini:`/engine-icons/gemini.svg`,hermes:`/engine-icons/hermesagent.svg`,"hermes-agent":`/engine-icons/hermesagent.svg`,opencode:`/engine-icons/opencode.svg`,qwen:`/engine-icons/qwen.svg`};function tn(e){return I[e]??null}function nn(e,t){if(e.executionMode===`byok`)return`${e.byok.provider} · ${e.byok.model}`;let n=e.engines.find(t=>t.id===e.engineId);return n?`${n.name}${n.installed?``:` · ${t.common.notInstalled}`}`:e.engineId}var rn=[{id:`execution`,icon:De},{id:`soul-packs`,icon:Oe},{id:`connectors`,icon:E},{id:`mcp`,icon:Ee},{id:`external-mcp`,icon:Ae},{id:`language`,icon:ge},{id:`appearance`,icon:ke},{id:`about`,icon:Te}];function an({apps:e,initial:t,initialSection:n,onAppsChanged:r,onClose:i,onSaved:a,runtimeVersion:o,templates:s}){let[c,l]=(0,u.useState)(t),[d,p]=(0,u.useState)(n),[m,h]=(0,u.useState)(`idle`),[g,_]=(0,u.useState)(null),v=at(c.language),y=ot(v),b=y.settings;(0,u.useEffect)(()=>{if(m!==`saved`)return;let e=window.setTimeout(()=>{h(e=>e===`saved`?`idle`:e)},1600);return()=>window.clearTimeout(e)},[m]);async function x(e){l({...c,...e}),h(`saving`);try{let t=await F(e);l(t.settings),a(t.settings),h(`saved`)}catch{h(`failed`)}}async function ee(){h(`saving`);try{let e=await Ct();l(e.settings),a(e.settings),h(`saved`)}catch{h(`failed`)}}async function S(e){_(b.engine.testing);try{_((await wt(e)).result.message)}catch(e){_(e instanceof Error?e.message:String(e))}}return(0,f.jsx)(`div`,{className:`modal-backdrop`,onClick:i,children:(0,f.jsxs)(`div`,{className:`modal modal-settings`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`settings-dialog-title`,onClick:e=>e.stopPropagation(),children:[(0,f.jsxs)(`div`,{className:`settings-chrome`,"aria-hidden":!1,children:[m===`idle`?null:(0,f.jsxs)(`div`,{className:`settings-autosave ${Sn(m)}`,role:`status`,"aria-live":`polite`,children:[m===`saving`?(0,f.jsx)(Se,{size:12,className:`spin`}):(0,f.jsx)(ce,{size:12}),(0,f.jsx)(`span`,{children:xn(m,b)})]}),(0,f.jsx)(Pe,{variant:`close`,onClick:i,"aria-label":y.accessibility.closeSettings,title:y.accessibility.closeSettings,children:(0,f.jsx)(Me,{size:16,strokeWidth:2})})]}),(0,f.jsxs)(`header`,{className:`modal-head`,children:[(0,f.jsx)(`span`,{className:`kicker`,children:b.dialog.kicker}),(0,f.jsx)(`h2`,{id:`settings-dialog-title`,children:b.dialog.title}),(0,f.jsx)(`p`,{className:`subtitle`,children:b.dialog.subtitle})]}),(0,f.jsxs)(`div`,{className:`modal-body`,children:[(0,f.jsx)(`aside`,{className:`settings-sidebar`,"aria-label":b.dialog.title,children:rn.map(e=>{let t=e.icon,n=bn(b.nav,e.id);return(0,f.jsx)(qe,{active:d===e.id,className:`settings-nav-item`,description:n.detail,icon:(0,f.jsx)(t,{size:18}),label:n.title,onClick:()=>p(e.id)},e.id)})}),(0,f.jsxs)(`div`,{className:`settings-content`,children:[d===`execution`?(0,f.jsx)(L,{copy:y,engineTest:g,onRescan:()=>void ee(),onTest:e=>void S(e),settings:c,update:x}):null,d===`soul-packs`?(0,f.jsx)(sn,{apps:e,copy:y,locale:v,settings:c,templates:s,onAppsChanged:r}):null,d===`connectors`?(0,f.jsx)(mn,{copy:y,settings:c,update:x}):null,d===`mcp`?(0,f.jsx)(hn,{copy:y,settings:c,update:x}):null,d===`external-mcp`?(0,f.jsx)(gn,{copy:y,settings:c,update:x}):null,d===`language`?(0,f.jsx)(_n,{copy:y,locale:v,update:x}):null,d===`appearance`?(0,f.jsx)(vn,{copy:y,settings:c,update:x}):null,d===`about`?(0,f.jsxs)(`div`,{className:`settings-section`,children:[(0,f.jsx)(`div`,{className:`section-head`,children:(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h3`,{children:b.about.title}),(0,f.jsx)(`p`,{className:`hint`,children:b.about.hint})]})}),(0,f.jsxs)(`dl`,{className:`about-grid`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`dt`,{children:b.about.version}),(0,f.jsx)(`dd`,{children:o})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`dt`,{children:b.about.executionMode}),(0,f.jsx)(`dd`,{children:c.executionMode})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`dt`,{children:b.about.selectedEngine}),(0,f.jsx)(`dd`,{children:c.engineId})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`dt`,{children:b.about.updated}),(0,f.jsx)(`dd`,{children:N(c.updatedAt,v)})]})]})]}):null]})]})]})})}function L({copy:e,engineTest:t,onRescan:n,onTest:r,settings:i,update:a}){let o=i.engines.filter(e=>e.installed).length,s=e.settings;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`div`,{className:`seg-control`,role:`tablist`,"aria-label":s.nav.execution,style:{"--seg-cols":2},children:[(0,f.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":i.executionMode===`local-cli`,className:`seg-btn ${i.executionMode===`local-cli`?`active`:``}`,onClick:()=>void a({executionMode:`local-cli`}),children:[(0,f.jsx)(`span`,{className:`seg-title`,children:`Local CLI`}),(0,f.jsx)(`span`,{className:`seg-meta`,children:s.engine.availableCount(o)})]}),(0,f.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":i.executionMode===`byok`,className:`seg-btn ${i.executionMode===`byok`?`active`:``}`,onClick:()=>void a({executionMode:`byok`}),children:[(0,f.jsx)(`span`,{className:`seg-title`,children:`BYOK`}),(0,f.jsx)(`span`,{className:`seg-meta`,children:i.byok.provider})]})]}),i.executionMode===`local-cli`?(0,f.jsxs)(`section`,{className:`settings-section`,children:[(0,f.jsxs)(`div`,{className:`section-head`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h3`,{children:s.engine.title}),(0,f.jsx)(`p`,{className:`hint`,children:s.engine.hint})]}),(0,f.jsxs)(`div`,{className:`section-head-actions`,children:[(0,f.jsx)(Pe,{variant:`ghost`,icon:(0,f.jsx)(he,{size:13}),className:`settings-action-button settings-test-btn`,onClick:()=>r(i.engineId),children:(0,f.jsx)(`span`,{children:s.engine.test})}),(0,f.jsx)(Pe,{variant:`ghost`,icon:(0,f.jsx)(Se,{size:13}),className:`settings-action-button settings-rescan-btn`,onClick:n,children:(0,f.jsx)(`span`,{children:s.engine.rescan})})]})]}),(0,f.jsx)(`div`,{className:`agent-grid`,children:i.engines.map(t=>(0,f.jsx)(on,{active:i.engineId===t.id,copy:e,engine:t,onSelect:()=>void a({engineId:t.id})},t.id))}),t?(0,f.jsx)(`p`,{className:`settings-note`,role:`status`,children:t}):null]}):(0,f.jsxs)(`section`,{className:`settings-section`,children:[(0,f.jsx)(`div`,{className:`section-head`,children:(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h3`,{children:s.byok.title}),(0,f.jsx)(`p`,{className:`hint`,children:s.byok.hint})]})}),(0,f.jsxs)(`div`,{className:`settings-field-grid`,children:[(0,f.jsx)(Ge,{label:s.byok.provider,children:(0,f.jsx)(`input`,{value:i.byok.provider,onChange:e=>void a({byok:{...i.byok,provider:e.target.value}})})}),(0,f.jsx)(Ge,{label:s.byok.baseUrl,children:(0,f.jsx)(`input`,{value:i.byok.baseUrl,onChange:e=>void a({byok:{...i.byok,baseUrl:e.target.value}})})}),(0,f.jsx)(Ge,{label:s.byok.model,children:(0,f.jsx)(`input`,{value:i.byok.model,onChange:e=>void a({byok:{...i.byok,model:e.target.value}})})}),(0,f.jsx)(Ge,{label:s.byok.apiKeyRef,children:(0,f.jsx)(`input`,{value:i.byok.apiKeyRef,onChange:e=>void a({byok:{...i.byok,apiKeyRef:e.target.value}}),placeholder:`env:OPENAI_API_KEY`})})]})]})]})}function on({active:e,copy:t,engine:n,onSelect:r}){let i=tn(n.id);return(0,f.jsxs)(We,{active:e,className:`agent-card${n.installed?``:` disabled`}`,disabled:!n.installed,"aria-pressed":e,onClick:r,children:[(0,f.jsx)(`span`,{className:`agent-icon ${n.installed?`agent-icon-ready`:`agent-icon-muted`}`,"data-engine-icon":n.id,"aria-hidden":`true`,children:i?(0,f.jsx)(`span`,{className:`agent-icon-shape`,style:{"--engine-icon-url":`url(${i})`}}):(0,f.jsx)(Oe,{size:24})}),(0,f.jsxs)(`span`,{className:`agent-card-body`,children:[(0,f.jsx)(`span`,{className:`agent-card-name`,children:n.name}),(0,f.jsx)(`span`,{className:`agent-card-meta`,children:n.installed?(0,f.jsx)(`span`,{children:n.version??n.path??n.command}):(0,f.jsx)(`span`,{className:`muted`,children:t.common.notInstalled})})]}),n.installed?(0,f.jsx)(`span`,{className:`status-dot${e?` active`:``}`,"aria-hidden":`true`}):null]})}function sn({apps:e,copy:t,locale:n,onAppsChanged:r,settings:i,templates:a}){let o=t.settings.soulPacks,[s,c]=(0,u.useState)(null),[l,d]=(0,u.useState)(null);async function p(e){c(e.appId),d(null);try{if(e.status===`enabled`)await At(e.appId);else{let t=await kt(e.appId);if(!t.summary.canEnable)throw Error(cn(t.summary));await Ot(e.appId)}await r?.()}catch(e){d(e instanceof Error?e.message:String(e))}finally{c(null)}}return(0,f.jsxs)(`div`,{className:`settings-section`,children:[(0,f.jsx)(`div`,{className:`section-head`,children:(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h3`,{children:o.title}),(0,f.jsx)(`p`,{className:`hint`,children:o.hint})]})}),(0,f.jsx)(`div`,{className:`settings-card-list`,children:e.length>0?e.map(e=>{let t=e.manifest.permissions?.length??0,r=ln(e),c=a.filter(t=>t.soulId===e.appId||t.soulId===e.projectedSoul?.id).length,l=e.mountedContribution.apiRoutePrefix,u=e.projectedSoul?.domain??e.manifest.soul?.domain??e.appId,d=(e.manifest.permissions??[]).map(un).filter(dn),m=(e.manifest.connectors?.required??[]).map(e=>({id:e.id,label:o.connectorStatus(e.id,fn(e.id,i,o))})),h=pn(e),g=s===e.appId,_=e.status===`enabled`?o.disableApp(e.manifest.name):o.enableApp(e.manifest.name);return(0,f.jsxs)(`article`,{className:`settings-card-row ${e.status===`enabled`?``:`disabled`}`,children:[(0,f.jsxs)(`div`,{className:`settings-card-mainline`,children:[(0,f.jsxs)(`span`,{children:[(0,f.jsx)(`strong`,{children:e.manifest.name}),(0,f.jsx)(`span`,{children:`${ut(e.status,n)} · ${e.version}`})]}),(0,f.jsx)(Pe,{variant:`ghost`,className:`settings-action-button soul-app-lifecycle-button`,disabled:g,onClick:()=>void p(e),children:(0,f.jsx)(`span`,{children:g?o.updating:_})})]}),(0,f.jsx)(`small`,{children:u}),(0,f.jsxs)(`div`,{className:`settings-card-tags`,children:[(0,f.jsx)(`small`,{children:o.permissionCount(t)}),(0,f.jsx)(`small`,{children:o.templateCount(c)}),(0,f.jsx)(`small`,{children:o.mountedContributionCount(r)})]}),(0,f.jsxs)(`div`,{className:`settings-review-grid`,"aria-label":`${e.manifest.name} security review`,children:[d.length>0?(0,f.jsxs)(`div`,{className:`settings-review-group`,children:[(0,f.jsx)(`span`,{children:o.permissionsTitle}),(0,f.jsx)(`div`,{className:`settings-card-tags`,children:d.slice(0,4).map(e=>(0,f.jsx)(`small`,{children:e},e))})]}):null,m.length>0?(0,f.jsxs)(`div`,{className:`settings-review-group`,children:[(0,f.jsx)(`span`,{children:o.connectorsTitle}),(0,f.jsx)(`div`,{className:`settings-card-tags`,children:m.map(e=>(0,f.jsx)(`small`,{children:e.label},e.id))})]}):null,h.length>0?(0,f.jsxs)(`div`,{className:`settings-review-group`,children:[(0,f.jsx)(`span`,{children:o.descriptorPermissionsTitle}),(0,f.jsx)(`div`,{className:`settings-card-tags`,children:h.slice(0,4).map(e=>(0,f.jsx)(`small`,{children:e},e))})]}):null]}),l?(0,f.jsx)(`small`,{children:o.apiRoute(l)}):null]},e.appId)}):(0,f.jsx)(`div`,{className:`settings-note`,children:o.empty})}),l?(0,f.jsx)(`p`,{className:`settings-note`,role:`alert`,children:l}):null]})}function cn(e){return e.warnings.length>0?e.warnings.join(` `):e.missingRequiredConnectorIds.length>0?`Required connectors are not available: ${e.missingRequiredConnectorIds.join(`, `)}`:`Host security review does not allow enabling this Soul App.`}function ln(e){return e.mountedContribution.artifactPreviewIds.length+e.mountedContribution.panelIds.length+e.mountedContribution.reviewPanelIds.length+e.mountedContribution.workspaceWidgetIds.length}function un(e){return!e.kind||!e.action||!e.target?null:`${e.kind}:${e.action}:${e.target}`}function dn(e){return typeof e==`string`}function fn(e,t,n){let r=t.connectors.find(t=>t.id===e);return r?r.enabled?n.enabledConnector:n.disabledConnector:n.unavailableConnector}function pn(e){let t=new Set,n=e=>{for(let n of e??[])t.add(n)},r=e.manifest.ui?.shell;n(r?.primaryAction?.requiredPermissions);for(let e of r?.actions??[])n(e.requiredPermissions);n(r?.search?.requiredPermissions),n(r?.settings?.requiredPermissions);for(let t of e.manifest.ui?.routes??[])n(t.surface?.requiredPermissions);for(let t of e.manifest.ui?.panels??[])n(t.surface?.requiredPermissions);for(let t of e.manifest.ui?.artifactPreviews??[])n(t.surface?.requiredPermissions);for(let t of e.manifest.ui?.reviewPanels??[])n(t.surface?.requiredPermissions);for(let t of e.manifest.ui?.workspaceWidgets??[])n(t.surface?.requiredPermissions);return[...t]}function mn({copy:e,settings:t,update:n}){let r=e.settings;return(0,f.jsxs)(`div`,{className:`settings-section`,children:[(0,f.jsx)(`div`,{className:`section-head`,children:(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h3`,{children:r.connectors.title}),(0,f.jsx)(`p`,{className:`hint`,children:r.connectors.hint})]})}),(0,f.jsx)(`div`,{className:`connector-list`,children:t.connectors.map(e=>(0,f.jsxs)(`label`,{className:`switch-row`,children:[(0,f.jsxs)(`span`,{children:[(0,f.jsx)(`strong`,{children:e.name}),(0,f.jsx)(`small`,{children:e.status===`configured`?r.connectors.configured:r.connectors.notConfigured})]}),(0,f.jsx)(`input`,{checked:e.enabled,type:`checkbox`,onChange:r=>void n({connectors:t.connectors.map(t=>t.id===e.id?{...t,enabled:r.target.checked,status:r.target.checked?`configured`:`not_configured`}:t)})})]},e.id))})]})}function hn({copy:e,settings:t,update:n}){let r=e.settings;return(0,f.jsxs)(`div`,{className:`settings-section`,children:[(0,f.jsx)(`div`,{className:`section-head`,children:(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h3`,{children:r.localMcp.title}),(0,f.jsx)(`p`,{className:`hint`,children:r.localMcp.hint})]})}),(0,f.jsxs)(`label`,{className:`switch-row`,children:[(0,f.jsxs)(`span`,{children:[(0,f.jsx)(`strong`,{children:r.localMcp.toggle}),(0,f.jsx)(`small`,{children:t.localMcpServer.url})]}),(0,f.jsx)(`input`,{checked:t.localMcpServer.enabled,type:`checkbox`,onChange:e=>void n({localMcpServer:{...t.localMcpServer,enabled:e.target.checked}})})]})]})}function gn({copy:e,settings:t,update:n}){let r=e.settings;return(0,f.jsxs)(`div`,{className:`settings-section`,children:[(0,f.jsx)(`div`,{className:`section-head`,children:(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h3`,{children:r.externalMcp.title}),(0,f.jsx)(`p`,{className:`hint`,children:r.externalMcp.hint})]})}),(0,f.jsx)(`div`,{className:`connector-list`,children:t.externalMcpServers.map(e=>(0,f.jsx)(Ge,{label:e.name,children:(0,f.jsx)(`input`,{value:e.command,onChange:r=>void n({externalMcpServers:t.externalMcpServers.map(t=>t.id===e.id?{...t,command:r.target.value}:t)}),placeholder:r.externalMcp.placeholder})},e.id))})]})}function _n({copy:e,locale:t,update:n}){let r=e.settings;return(0,f.jsxs)(`div`,{className:`settings-section`,children:[(0,f.jsx)(`div`,{className:`section-head`,children:(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h3`,{children:r.language.title}),(0,f.jsx)(`p`,{className:`hint`,children:r.language.hint})]})}),(0,f.jsx)(`div`,{className:`seg-control`,role:`group`,"aria-label":r.language.title,style:{"--seg-cols":4},children:rt.map(r=>(0,f.jsxs)(`button`,{type:`button`,className:`seg-btn ${t===r?`active`:``}`,onClick:()=>void n({language:r}),children:[(0,f.jsx)(`span`,{className:`seg-title`,children:st(r,t)}),(0,f.jsx)(`span`,{className:`seg-meta`,children:e.common.interface})]},r))})]})}function vn({copy:e,settings:t,update:n}){let r=e.settings;return(0,f.jsxs)(`div`,{className:`settings-section`,children:[(0,f.jsx)(`div`,{className:`section-head`,children:(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h3`,{children:r.appearance.title}),(0,f.jsx)(`p`,{className:`hint`,children:r.appearance.hint})]})}),(0,f.jsxs)(`div`,{className:`seg-control`,role:`group`,"aria-label":r.appearance.title,style:{"--seg-cols":3},children:[(0,f.jsx)(yn,{active:t.appearance===`system`,icon:(0,f.jsx)(Te,{size:14}),label:r.appearance.system,meta:e.common.workspace,onClick:()=>void n({appearance:`system`})}),(0,f.jsx)(yn,{active:t.appearance===`light`,icon:(0,f.jsx)(ke,{size:14}),label:r.appearance.light,meta:e.common.workspace,onClick:()=>void n({appearance:`light`})}),(0,f.jsx)(yn,{active:t.appearance===`dark`,icon:(0,f.jsx)(ve,{size:14}),label:r.appearance.dark,meta:e.common.workspace,onClick:()=>void n({appearance:`dark`})})]})]})}function yn({active:e,icon:t,label:n,meta:r,onClick:i}){return(0,f.jsxs)(Pe,{className:`seg-btn ${e?`active`:``}`,onClick:i,children:[(0,f.jsxs)(`span`,{className:`seg-title seg-title-inline`,children:[t,n]}),(0,f.jsx)(`span`,{className:`seg-meta`,children:r})]})}function bn(e,t){return t===`execution`?{title:e.execution,detail:e.executionDetail}:t===`soul-packs`?{title:e.soulPacks,detail:e.soulPacksDetail}:t===`connectors`?{title:e.connectors,detail:e.connectorsDetail}:t===`mcp`?{title:e.localMcp,detail:e.localMcpDetail}:t===`external-mcp`?{title:e.externalMcp,detail:e.externalMcpDetail}:t===`language`?{title:e.language,detail:e.languageDetail}:t===`appearance`?{title:e.appearance,detail:e.appearanceDetail}:{title:e.about,detail:e.aboutDetail}}function xn(e,t){return e===`saving`?t.autosave.saving:e===`failed`?t.autosave.failed:t.autosave.saved}function Sn(e){return e===`saving`?`is-saving`:e===`failed`?`is-failed`:`is-saved`}var Cn=`(prefers-color-scheme: dark)`;function wn(){return(0,u.useSyncExternalStore)(Tn,En,()=>`light`)}function Tn(e){if(typeof window>`u`||typeof window.matchMedia!=`function`)return()=>{};let t=window.matchMedia(Cn);return typeof t.addEventListener==`function`?(t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)):(t.addListener(e),()=>t.removeListener(e))}function En(){return typeof window>`u`||typeof window.matchMedia!=`function`?`light`:window.matchMedia(Cn).matches?`dark`:`light`}function Dn(e,t){return e===`system`?t:e}function On({className:e=``,compact:t=!1,progress:n}){return(0,f.jsxs)(`section`,{"aria-live":n.live?`polite`:void 0,className:`session-progress-card ${t?`compact`:``} ${e}`.trim(),"data-stage":n.stage,"data-tone":n.tone,children:[(0,f.jsxs)(`div`,{className:`session-progress-head`,children:[(0,f.jsx)(`span`,{className:`session-progress-dot`,"aria-hidden":`true`}),(0,f.jsx)(`span`,{className:`session-progress-label`,children:n.label})]}),(0,f.jsx)(`strong`,{children:n.title}),(0,f.jsx)(`span`,{className:`session-progress-detail`,children:n.detail})]})}function kn({copy:e,engineReadiness:t,events:n,locale:r,detailDrawerOpen:i,onOpenSettings:a,onRefresh:o,onToggleDetailDrawer:s,onSubmitTurn:c,onTurnInputChange:l,progress:d,session:p,template:m,turnInput:h,turnSubmitting:g,turns:_,workspace:v}){let y=(0,u.useRef)(null),b=(0,u.useRef)(!1),x=(0,u.useRef)(!0),[ee,S]=(0,u.useState)(!1),te=m?lt(m,r):null,ne=(0,u.useMemo)(()=>[..._].sort((e,t)=>e.seq-t.seq),[_]),re=(0,u.useMemo)(()=>[...n].sort((e,t)=>e.seq-t.seq),[n]);(0,u.useEffect)(()=>{b.current=!1,x.current=!0},[p.id]),(0,u.useEffect)(()=>{let e=y.current;!e||b.current||ne.length===0&&re.length===0||(b.current=!0,requestAnimationFrame(()=>{e.scrollTop=e.scrollHeight,x.current=!0,S(!1)}))},[p.id,re.length,ne.length]),(0,u.useEffect)(()=>{let e=y.current;e&&x.current&&requestAnimationFrame(()=>{e.scrollTop=e.scrollHeight,S(!1)})},[re,ne,g]),(0,u.useEffect)(()=>{let e=y.current;if(!e)return;let t=()=>{let e=y.current;if(!e)return;let t=e.scrollHeight-e.scrollTop-e.clientHeight;x.current=t<80,S(t>140)};return e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)},[]);function ie(){let e=y.current;e&&(x.current=!0,e.scrollTo({behavior:`smooth`,top:e.scrollHeight}),S(!1))}return(0,f.jsxs)(`section`,{className:`worker-chat-pane`,"aria-label":e.workspace.sessionDetail,children:[(0,f.jsxs)(`header`,{className:`worker-chat-header`,children:[(0,f.jsxs)(`div`,{className:`worker-chat-title`,children:[(0,f.jsx)(`span`,{className:`kicker`,children:e.workspace.selectedWorkspace}),(0,f.jsx)(`h1`,{children:v.name}),(0,f.jsxs)(`div`,{className:`worker-chat-meta`,children:[(0,f.jsx)(`span`,{children:te?.name??p.capabilityTemplateId}),(0,f.jsx)(`span`,{children:ut(p.status,r)}),(0,f.jsx)(`span`,{children:e.workspace.updated(N(p.updatedAt,r))})]}),(0,f.jsx)(On,{compact:!0,className:`worker-chat-progress`,progress:d})]}),(0,f.jsxs)(`div`,{className:`worker-chat-actions`,children:[(0,f.jsx)(Fe,{"aria-label":e.accessibility.refreshWorkspace,onClick:o,children:(0,f.jsx)(Se,{"aria-hidden":`true`,size:16})}),(0,f.jsx)(Fe,{"aria-label":e.accessibility.openSettings,onClick:a,children:(0,f.jsx)(Te,{"aria-hidden":`true`,size:16})}),(0,f.jsx)(Fe,{"aria-label":i?e.accessibility.collapseSessionDetail:e.accessibility.expandSessionDetail,"aria-pressed":i,className:i?`session-detail-toggle active`:`session-detail-toggle`,title:i?e.accessibility.collapseSessionDetail:e.accessibility.expandSessionDetail,onClick:s,children:i?(0,f.jsx)(ye,{"aria-hidden":`true`,size:16}):(0,f.jsx)(be,{"aria-hidden":`true`,size:16})})]})]}),(0,f.jsxs)(`div`,{className:`worker-chat-log-wrap`,children:[(0,f.jsxs)(`div`,{ref:y,className:`worker-chat-log`,"data-testid":`worker-chat-log`,children:[ne.length>0?ne.map(t=>{let n=re.filter(e=>e.turnId===t.id);return(0,f.jsxs)(u.Fragment,{children:[(0,f.jsx)(An,{copy:e,turn:t,locale:r}),(0,f.jsx)(jn,{copy:e,events:n,locale:r,turn:t,turnSubmitting:g&&t.status===`running`})]},t.id)}):(0,f.jsxs)(`div`,{className:`worker-chat-empty`,children:[(0,f.jsx)(_e,{"aria-hidden":`true`,size:24}),(0,f.jsx)(`strong`,{children:e.workspace.noTurns}),(0,f.jsx)(`span`,{children:t.detail})]}),g&&ne.every(e=>e.status!==`running`)?(0,f.jsx)(Mn,{detail:t.detail,role:e.workspace.engineRole}):null]}),ee?(0,f.jsxs)(`button`,{type:`button`,className:`worker-chat-jump`,onClick:ie,children:[(0,f.jsx)(ae,{"aria-hidden":`true`,size:14}),(0,f.jsx)(`span`,{children:e.workspace.latest})]}):null]}),(0,f.jsxs)(`form`,{className:`worker-composer`,onSubmit:c,children:[(0,f.jsx)(`button`,{type:`button`,className:`worker-composer-tool`,"aria-label":e.accessibility.openSettings,onClick:a,children:(0,f.jsx)(Te,{"aria-hidden":`true`,size:15})}),(0,f.jsx)(`textarea`,{"aria-label":e.workspace.followUpInput,disabled:!t.ready||g,placeholder:e.workspace.followUpPlaceholder,rows:3,value:h,onChange:e=>l(e.target.value)}),(0,f.jsxs)(`button`,{className:`primary worker-composer-send`,type:`submit`,disabled:!h.trim()||g||!t.ready,children:[(0,f.jsx)(we,{"aria-hidden":`true`,size:14}),(0,f.jsx)(`span`,{children:g?e.workspace.sendingTurn:e.workspace.sendTurn})]})]})]})}function An({copy:e,locale:t,turn:n}){return(0,f.jsxs)(`article`,{className:`worker-message user`,children:[(0,f.jsxs)(`div`,{className:`worker-message-role`,children:[(0,f.jsx)(`span`,{children:e.workspace.operatorRole}),(0,f.jsx)(`time`,{children:N(n.createdAt,t)})]}),(0,f.jsx)(`div`,{className:`worker-user-bubble`,children:n.input})]})}function jn({copy:e,events:t,locale:n,turn:r,turnSubmitting:i}){let a=Ln(t.map(e=>({event:In(e),key:String(e.id)})));a.length===0&&r.response&&a.push({event:{kind:`text`,text:r.response},key:`response-${r.id}`});let o=new Map;for(let{event:e}of a)e.kind===`tool_result`&&o.set(e.id,e);return(0,f.jsxs)(`article`,{className:`worker-message assistant`,children:[(0,f.jsxs)(`div`,{className:`worker-message-role`,children:[(0,f.jsx)(`span`,{children:e.workspace.engineRole}),(0,f.jsx)(`time`,{children:ut(r.status,n)})]}),(0,f.jsxs)(`div`,{className:`worker-assistant-flow`,children:[a.length===0&&(r.status===`running`||i)?(0,f.jsx)(Nn,{detail:e.workspace.engineStarting}):null,a.map(({event:e,key:t})=>e.kind===`tool_result`?null:e.kind===`tool_use`?(0,f.jsx)(Fn,{result:o.get(e.id),tool:e},t):(0,f.jsx)(Pn,{event:e},t)),r.error?(0,f.jsx)(Pn,{event:{kind:`error`,message:r.error}}):null]})]})}function Mn({detail:e,role:t}){return(0,f.jsxs)(`article`,{className:`worker-message assistant`,children:[(0,f.jsx)(`div`,{className:`worker-message-role`,children:(0,f.jsx)(`span`,{children:t})}),(0,f.jsx)(`div`,{className:`worker-assistant-flow`,children:(0,f.jsx)(Nn,{detail:e})})]})}function Nn({detail:e}){return(0,f.jsx)(Ve,{active:!0,className:`worker-status-pill`,children:e})}function Pn({event:e}){return e.kind===`text`?(0,f.jsx)(`div`,{className:`worker-prose`,children:e.text}):e.kind===`thinking`?(0,f.jsx)(`pre`,{className:`worker-log thinking`,children:e.text}):e.kind===`log`?(0,f.jsxs)(`details`,{className:`worker-log-card`,children:[(0,f.jsxs)(`summary`,{children:[(0,f.jsx)(Ae,{"aria-hidden":`true`,size:14}),(0,f.jsx)(`span`,{children:e.stream})]}),(0,f.jsx)(`pre`,{children:e.chunk})]}):e.kind===`raw`?(0,f.jsxs)(`details`,{className:`worker-log-card`,children:[(0,f.jsxs)(`summary`,{children:[(0,f.jsx)(Ae,{"aria-hidden":`true`,size:14}),(0,f.jsx)(`span`,{children:`raw`})]}),(0,f.jsx)(`pre`,{children:e.line})]}):e.kind===`status`?(0,f.jsx)(Ve,{active:!0,className:`worker-status-pill`,detail:e.detail,children:e.label}):e.kind===`usage`?(0,f.jsxs)(Be,{className:`worker-status-pill`,icon:(0,f.jsx)(w,{size:14}),children:[(0,f.jsx)(`span`,{children:`Usage`}),(0,f.jsx)(`small`,{children:[e.inputTokens,e.outputTokens].filter(e=>e!=null).join(` / `)})]}):e.kind===`artifact`||e.kind===`review`||e.kind===`lesson`?(0,f.jsxs)(Be,{className:`worker-produced-chip`,icon:(0,f.jsx)(me,{size:14}),children:[(0,f.jsx)(`span`,{children:e.kind}),(0,f.jsx)(`small`,{children:e.detail})]}):e.kind===`error`?(0,f.jsxs)(`div`,{className:`worker-error-card`,role:`alert`,children:[(0,f.jsx)(de,{"aria-hidden":`true`,size:15}),(0,f.jsx)(`span`,{children:e.message})]}):null}function Fn({result:e,tool:t}){let n=Vn(t.input)?t.input:{},r=typeof n.command==`string`?n.command:``,i=typeof n.description==`string`?n.description:t.name;return(0,f.jsxs)(`details`,{className:`worker-tool-card`,open:!e?.content,children:[(0,f.jsxs)(`summary`,{children:[(0,f.jsx)(`span`,{className:`worker-tool-icon`,children:(0,f.jsx)(je,{"aria-hidden":`true`,size:14})}),(0,f.jsx)(`span`,{children:t.name}),(0,f.jsx)(`small`,{children:i}),e?(0,f.jsx)(`span`,{className:`worker-tool-result ${e.isError?`failed`:`ok`}`,children:e.isError?`failed`:`done`}):null]}),r?(0,f.jsx)(`pre`,{className:`worker-tool-command`,children:r}):null,e?.content?(0,f.jsx)(`pre`,{className:`worker-tool-output`,children:e.content}):null]})}function In(e){let t=e.payloadJson,n=Vn(t.agentEvent)?t.agentEvent:null;if(n&&typeof n.kind==`string`){let t=n.kind;if(t===`status`)return{detail:zn(n.detail),kind:t,label:zn(n.label,e.type)};if(t===`text`||t===`thinking`)return{kind:t,text:zn(n.text)};if(t===`log`)return{chunk:zn(n.chunk),kind:t,stream:n.stream===`stderr`?`stderr`:`stdout`};if(t===`tool_use`)return{id:zn(n.id,String(e.id)),input:n.input,kind:t,name:zn(n.name,`Tool`)};if(t===`tool_result`)return{content:zn(n.content),id:zn(n.id??n.toolUseId,String(e.id)),isError:n.isError===!0,kind:t,name:zn(n.name)};if(t===`usage`)return{costUsd:Bn(n.costUsd),inputTokens:Bn(n.inputTokens),kind:t,outputTokens:Bn(n.outputTokens)};if(t===`raw`)return{kind:t,line:zn(n.line)}}return e.type===`assistant_delta`?{kind:`text`,text:zn(t.text??t.delta)}:e.type===`artifact`?{detail:zn(t.path??t.artifactId,`artifact`),kind:`artifact`}:e.type===`review`?{detail:zn(t.verdict??t.reviewId,`review`),kind:`review`}:e.type===`lesson`?{detail:zn(t.lessonId,`memory candidate`),kind:`lesson`}:e.type===`error`?{kind:`error`,message:zn(t.message,`Session turn failed.`)}:e.type===`log`?{chunk:JSON.stringify(t,null,2),kind:`log`,stream:`stdout`}:{detail:zn(t.status,e.type),kind:`status`,label:e.type}}function Ln(e){let t=[];for(let n of e){let e=t.at(-1);if(n.event.kind===`text`&&e?.event.kind===`text`){e.event={...e.event,text:`${e.event.text}${n.event.text}`};continue}if(n.event.kind===`thinking`&&e?.event.kind===`thinking`){e.event={...e.event,text:Rn(`${e.event.text}${n.event.text}`)};continue}if(n.event.kind===`log`&&e?.event.kind===`log`&&e.event.stream===n.event.stream){e.event={...e.event,chunk:Rn(`${e.event.chunk}${n.event.chunk}`)};continue}t.push(n.event.kind===`log`?{event:{...n.event,chunk:Rn(n.event.chunk)},key:n.key}:n)}return t}function Rn(e){let t=12e3;return e.length<=t?e:`${e.slice(0,t)}\n...[truncated]`}function zn(e,t=``){return typeof e==`string`&&e.trim().length>0?e:t}function Bn(e){return typeof e==`number`&&Number.isFinite(e)?e:void 0}function Vn(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Hn({artifact:e,artifactCopy:t,artifactPreview:n,artifacts:r,collapsed:i=!1,copy:a,engineReadiness:o,events:s,lessonBusyId:c,lessons:l,locale:u,onLessonStatus:d,onReview:p,onSubmitTurn:m,onTurnInputChange:h,progress:g,review:_,reviewSubmitting:v,reviews:y,session:b,mode:x=`full`,template:ee,turnInput:S,turnSubmitting:te,turns:ne,workspace:re}){let ie=ee?lt(ee,u):null,C=s.slice(-6).reverse();return i?(0,f.jsx)(`aside`,{className:`artifact-rail session-panel collapsed`,"aria-hidden":`true`}):(0,f.jsxs)(`aside`,{className:`artifact-rail session-panel`,"aria-label":a.accessibility.businessArtifactPreview,children:[(0,f.jsx)(`header`,{className:`artifact-rail-head`,children:(0,f.jsxs)(`div`,{className:`artifact-rail-title`,children:[(0,f.jsx)(_e,{"aria-hidden":`true`,size:14}),(0,f.jsx)(`strong`,{children:a.workspace.sessionDetail})]})}),re&&b?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`section`,{className:`session-summary`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`span`,{className:`kicker`,children:a.workspace.selectedWorkspace}),(0,f.jsx)(`h2`,{children:re.name})]}),(0,f.jsx)(Ve,{active:!0,className:`artifact-rail-status-pill`,icon:(0,f.jsx)(T,{size:10}),children:ut(b.status,u)})]}),(0,f.jsxs)(`section`,{className:`rail-metadata`,children:[(0,f.jsx)(`strong`,{children:ie?.name??b.capabilityTemplateId}),(0,f.jsx)(`small`,{children:ie?.outputKind??b.capabilityTemplateId}),(0,f.jsx)(`small`,{children:a.workspace.updated(N(b.updatedAt,u))})]}),g?(0,f.jsx)(On,{compact:!0,className:`artifact-session-progress`,progress:g}):null,x===`full`?(0,f.jsxs)(`section`,{className:`turn-composer`,children:[(0,f.jsx)(Re,{className:`section-head compact`,title:a.workspace.continueSession,description:o.detail}),(0,f.jsxs)(`form`,{onSubmit:m,children:[(0,f.jsx)(`textarea`,{"aria-label":a.workspace.followUpInput,placeholder:a.workspace.followUpPlaceholder,value:S,onChange:e=>h(e.target.value)}),(0,f.jsxs)(`button`,{className:`primary`,type:`submit`,disabled:!S.trim()||te||!o.ready,children:[(0,f.jsx)(we,{"aria-hidden":`true`,size:13}),(0,f.jsx)(`span`,{children:te?a.workspace.sendingTurn:a.workspace.sendTurn})]})]})]}):null,(0,f.jsxs)(`section`,{className:`artifact-panel`,children:[(0,f.jsx)(Re,{className:`artifact-section-head`,icon:(0,f.jsx)(pe,{size:14}),title:a.artifact.label,description:a.workspace.artifactCount(r.length)}),e?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`div`,{className:`rail-metadata`,children:[(0,f.jsx)(`strong`,{children:t?.name??e.title}),(0,f.jsx)(`small`,{children:t?.outputKind??e.kind}),(0,f.jsx)(`small`,{children:e.path})]}),n.loading?(0,f.jsx)(`div`,{className:`artifact-preview-state`,children:a.artifact.loading}):null,n.error?(0,f.jsx)(`div`,{className:`artifact-preview-state`,role:`alert`,children:n.error}):null,!n.loading&&!n.error?(0,f.jsx)(`pre`,{className:`artifact-preview`,children:n.content}):null]}):(0,f.jsx)(`div`,{className:`artifact-preview-state`,children:g?.previewDetail??a.artifact.empty})]}),x===`full`?(0,f.jsxs)(`details`,{className:`session-subpanel compact-details`,children:[(0,f.jsxs)(`summary`,{className:`artifact-section-head`,children:[(0,f.jsx)(`span`,{className:`artifact-summary-icon`,"aria-hidden":`true`,children:(0,f.jsx)(_e,{size:14})}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`strong`,{children:a.workspace.turnHistory}),(0,f.jsx)(`small`,{children:a.workspace.turnCount(ne.length)})]})]}),ne.length>0?(0,f.jsx)(`div`,{className:`turn-list`,children:ne.map(e=>(0,f.jsx)(He,{className:`turn-row`,title:ut(e.status,u),detail:e.input,meta:e.seq,children:e.error?(0,f.jsx)(`small`,{className:`danger-text`,children:e.error}):null},e.id))}):(0,f.jsx)(`div`,{className:`artifact-preview-state`,children:a.workspace.noTurns})]}):null,(0,f.jsxs)(`section`,{className:`session-subpanel`,children:[(0,f.jsx)(Re,{className:`artifact-section-head`,icon:(0,f.jsx)(fe,{size:14}),title:a.artifact.review,description:_?dt(_.verdict,u):a.artifact.reviewCount(y.length)}),_?(0,f.jsx)(`div`,{className:`review-list`,children:Un(_).map(e=>(0,f.jsx)(`span`,{children:e},e))}):e?(0,f.jsxs)(`button`,{type:`button`,className:`ghost review-action`,disabled:v,onClick:p,children:[(0,f.jsx)(fe,{"aria-hidden":`true`,size:13}),(0,f.jsx)(`span`,{children:v?a.workspace.requestingReview:a.workspace.requestReview})]}):(0,f.jsx)(`div`,{className:`artifact-preview-state`,children:a.workspace.reviewWaiting})]}),(0,f.jsxs)(`section`,{className:`session-subpanel memory-subpanel`,children:[(0,f.jsx)(Re,{className:`artifact-section-head`,icon:(0,f.jsx)(Oe,{size:14}),title:a.workspace.memoryCandidates,description:a.artifact.memoryCandidates(l.length)}),l.length>0?(0,f.jsx)(`div`,{className:`memory-list`,children:l.map(e=>(0,f.jsxs)(`article`,{className:`memory-row`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`strong`,{children:Wn(e.status,a)}),(0,f.jsx)(`span`,{children:e.statement})]}),(0,f.jsxs)(`div`,{className:`memory-actions`,children:[(0,f.jsx)(`button`,{type:`button`,className:`ghost`,disabled:c===e.id||e.status===`accepted`,onClick:()=>d(e,`accepted`),children:a.workspace.accept}),(0,f.jsx)(`button`,{type:`button`,className:`ghost`,disabled:c===e.id||e.status===`rejected`,onClick:()=>d(e,`rejected`),children:a.workspace.reject})]})]},e.id))}):(0,f.jsx)(`div`,{className:`artifact-preview-state`,children:a.workspace.noMemoryCandidates})]}),(0,f.jsxs)(`details`,{className:`session-subpanel compact-details`,children:[(0,f.jsxs)(`summary`,{className:`artifact-section-head`,children:[(0,f.jsx)(`span`,{className:`artifact-summary-icon`,"aria-hidden":`true`,children:(0,f.jsx)(Ae,{size:14})}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`strong`,{children:a.workspace.eventStream}),(0,f.jsx)(`small`,{children:a.workspace.eventCount(s.length)})]})]}),C.length>0?(0,f.jsx)(`div`,{className:`event-list`,children:C.map(e=>(0,f.jsx)(He,{className:`event-row`,title:e.type,meta:N(e.createdAt,u)},e.id))}):(0,f.jsx)(`div`,{className:`artifact-preview-state`,children:a.workspace.noEvents})]})]}):(0,f.jsx)(ze,{className:`empty-session-state`,icon:(0,f.jsx)(me,{size:22}),title:a.workspace.noSelectionTitle,detail:a.workspace.noSelectionDetail})]})}function Un(e){let t=e.findingsJson.map(e=>String(e.message??e.summary??JSON.stringify(e))),n=e.risksJson.map(e=>String(e.message??e.summary??JSON.stringify(e)));return[...t,...n].filter(Boolean)}function Wn(e,t){return e===`accepted`?t.workspace.accepted:e===`rejected`?t.workspace.rejected:t.workspace.proposed}function Gn({artifact:e,events:t,locale:n,review:r,session:i,turns:a}){let o=qn(n),s=!!e,c=a.some(e=>e.status===`queued`||e.status===`running`),l=a.some(e=>e.status===`failed`),u=a.some(e=>e.status===`cancelled`);return i.status===`failed`||l||i.status===`cancelled`||u?o.failed:s?r?.verdict===`pass`||r?.verdict===`warn`?o.reviewed:r?.verdict===`fail`?o.review_failed:o.review_ready:Kn(t)?o.artifact_finalizing:c||i.status===`active`&&a.length===0?o.engine_running:o.empty}function Kn(e){return e.some(e=>{let t=e.payloadJson,n=Yn(t.agentEvent)?t.agentEvent:null,r=Jn(n?.label??t.label),i=Jn(n?.status??t.status),a=Jn(n?.detail??t.detail??t.path),o=Jn(t.path),s=e.type===`file_change`||r===`file_change`,c=/(?:^|\/)artifacts\//i.test(a)||/(?:^|\/)artifacts\//i.test(o),l=/\bcompleted\b/i.test(a)||i===`completed`||i===`succeeded`;return s&&c&&l})}function qn(e){return e===`zh-CN`?{artifact_finalizing:{detail:`Engine 已写入产物文件;AIWorker 正在结束 session,并把文件归集到产物预览。`,label:`产物文件`,live:!0,previewDetail:`产物文件已经写入,预览会在 session 完成归集后出现。`,stage:`artifact_finalizing`,title:`文件已写入,正在归集`,tone:`finalizing`},empty:{detail:`当前 session 还没有可 review 的产物。`,label:`产物`,live:!1,previewDetail:`暂无产物预览。`,stage:`empty`,title:`等待产物`,tone:`muted`},engine_running:{detail:`Agent 正在生成可 review 产物;事件流会继续更新。`,label:`引擎`,live:!0,previewDetail:`产物预览会在第一个 artifact 进入索引后解锁。`,stage:`engine_running`,title:`Agent 正在生成`,tone:`working`},failed:{detail:`Session 或 turn 已失败,需要查看事件流或重新发起。`,label:`异常`,live:!1,previewDetail:`当前 session 未生成可用产物。`,stage:`failed`,title:`需要处理`,tone:`risk`},review_failed:{detail:`人工 review 已发现风险;修订产物后再进入 lesson 或 memory。`,label:`Review`,live:!1,previewDetail:`产物已归集,但 review 未通过。`,stage:`review_failed`,title:`Review 未通过`,tone:`risk`},review_ready:{detail:`产物已进入索引;进入 lesson 或 memory 前必须由人类 review。`,label:`Review`,live:!1,previewDetail:`产物已可预览,请完成人工 review。`,stage:`review_ready`,title:`产物已就绪,等待人工 review`,tone:`ready`},reviewed:{detail:`已有人工 review 记录;lesson 或 memory 沉淀仍需要显式接受。`,label:`Review`,live:!1,previewDetail:`产物已 review,可继续处理 lesson 候选。`,stage:`reviewed`,title:`Review 已记录`,tone:`reviewed`}}:e===`ja`?{artifact_finalizing:{detail:`エンジンは成果物ファイルを書き込み済みです。AIWorker がセッションを完了し、プレビュー索引へ反映しています。`,label:`Artifact file`,live:!0,previewDetail:`成果物ファイルは書き込み済みで、索引完了後にここへ表示されます。`,stage:`artifact_finalizing`,title:`ファイル書き込み済み、索引中`,tone:`finalizing`},empty:{detail:`このセッションにはまだレビュー可能な成果物がありません。`,label:`Artifact`,live:!1,previewDetail:`成果物プレビューはまだありません。`,stage:`empty`,title:`成果物待ち`,tone:`muted`},engine_running:{detail:`Agent がレビュー可能な成果物を生成しています。イベントストリームは更新され続けます。`,label:`Engine`,live:!0,previewDetail:`最初の artifact が索引化されるとプレビューが表示されます。`,stage:`engine_running`,title:`Agent 生成中`,tone:`working`},failed:{detail:`セッションまたは turn が失敗しました。イベントストリームを確認して再実行してください。`,label:`Issue`,live:!1,previewDetail:`このセッションには利用可能な成果物がありません。`,stage:`failed`,title:`対応が必要`,tone:`risk`},review_failed:{detail:`人間の review がリスクを検出しました。lesson や memory の前に成果物を修正してください。`,label:`Review`,live:!1,previewDetail:`成果物は索引済みですが、review は未通過です。`,stage:`review_failed`,title:`Review failed`,tone:`risk`},review_ready:{detail:`成果物は索引済みです。lesson や memory へ進む前に人間の review が必要です。`,label:`Review`,live:!1,previewDetail:`成果物をプレビューできます。人間の review を完了してください。`,stage:`review_ready`,title:`Review 待ち成果物`,tone:`ready`},reviewed:{detail:`人間の review 記録があります。lesson や memory への反映は明示的な承認が必要です。`,label:`Review`,live:!1,previewDetail:`成果物は review 済みです。lesson 候補を処理できます。`,stage:`reviewed`,title:`Review recorded`,tone:`reviewed`}}:e===`de`?{artifact_finalizing:{detail:`Die Engine hat die Artefaktdatei geschrieben. AIWorker schliesst die Session ab und indexiert sie fuer die Vorschau.`,label:`Artifact file`,live:!0,previewDetail:`Die Artefaktdatei ist geschrieben und erscheint nach der Indexierung hier.`,stage:`artifact_finalizing`,title:`Datei geschrieben, Indexierung laeuft`,tone:`finalizing`},empty:{detail:`Diese Session hat noch kein review-faehiges Artefakt.`,label:`Artifact`,live:!1,previewDetail:`Noch keine Artefaktvorschau.`,stage:`empty`,title:`Wartet auf Artefakt`,tone:`muted`},engine_running:{detail:`Der Agent erzeugt ein review-faehiges Artefakt. Der Event-Stream wird weiter aktualisiert.`,label:`Engine`,live:!0,previewDetail:`Die Vorschau wird sichtbar, sobald das erste Artifact indexiert ist.`,stage:`engine_running`,title:`Agent generiert`,tone:`working`},failed:{detail:`Session oder Turn ist fehlgeschlagen. Pruefe den Event-Stream oder starte erneut.`,label:`Issue`,live:!1,previewDetail:`Diese Session hat kein nutzbares Artefakt erzeugt.`,stage:`failed`,title:`Handlung noetig`,tone:`risk`},review_failed:{detail:`Human Review hat Risiken gefunden. Ueberarbeite das Artefakt vor Lesson oder Memory.`,label:`Review`,live:!1,previewDetail:`Das Artefakt ist indexiert, aber Review ist fehlgeschlagen.`,stage:`review_failed`,title:`Review failed`,tone:`risk`},review_ready:{detail:`Das Artefakt ist indexiert. Vor Lesson oder Memory ist Human Review erforderlich.`,label:`Review`,live:!1,previewDetail:`Das Artefakt ist sichtbar. Bitte Human Review abschliessen.`,stage:`review_ready`,title:`Artefakt bereit fuer Review`,tone:`ready`},reviewed:{detail:`Human Review liegt vor. Lesson oder Memory brauchen weiterhin explizite Annahme.`,label:`Review`,live:!1,previewDetail:`Das Artefakt ist reviewed; Lesson-Kandidaten koennen bearbeitet werden.`,stage:`reviewed`,title:`Review recorded`,tone:`reviewed`}}:{artifact_finalizing:{detail:`The engine wrote an artifact file. AIWorker is finalizing the session before it appears in the artifact preview.`,label:`Artifact file`,live:!0,previewDetail:`The artifact file is written and will appear here after session finalization.`,stage:`artifact_finalizing`,title:`File written, indexing`,tone:`finalizing`},empty:{detail:`This session does not have a reviewable artifact yet.`,label:`Artifact`,live:!1,previewDetail:`No artifact preview yet.`,stage:`empty`,title:`Waiting for artifact`,tone:`muted`},engine_running:{detail:`The agent is generating a reviewable artifact. Streamed events will keep updating.`,label:`Engine`,live:!0,previewDetail:`The preview will unlock after the first artifact enters the index.`,stage:`engine_running`,title:`Agent is generating`,tone:`working`},failed:{detail:`The session or turn failed. Check the event stream or start a new turn.`,label:`Issue`,live:!1,previewDetail:`This session did not produce a usable artifact.`,stage:`failed`,title:`Needs attention`,tone:`risk`},review_failed:{detail:`Human review found risks. Revise the artifact before lesson or memory promotion.`,label:`Review`,live:!1,previewDetail:`The artifact is indexed, but review did not pass.`,stage:`review_failed`,title:`Review failed`,tone:`risk`},review_ready:{detail:`The artifact is indexed. Human review is required before lesson or memory promotion.`,label:`Review`,live:!1,previewDetail:`The artifact is visible. Complete human review before promoting it.`,stage:`review_ready`,title:`Artifact ready for review`,tone:`ready`},reviewed:{detail:`A human review exists. Lessons or memory still require explicit acceptance.`,label:`Review`,live:!1,previewDetail:`The artifact is reviewed and lesson candidates can be handled.`,stage:`reviewed`,title:`Review recorded`,tone:`reviewed`}}}function Jn(e){return typeof e==`string`?e:``}function Yn(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Xn=`modulepreload`,Zn=function(e){return`/`+e},Qn={},$n=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}))))}r=o(t.map(t=>{if(t=Zn(t,n),t in Qn)return;Qn[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:Xn,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.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)})},er={"hr-people-workbench":(0,u.lazy)(()=>$n(()=>import(`./people-workbench-DM7Dw1QO.js`).then(e=>({default:e.HrPeopleWorkbench})),__vite__mapDeps([0,1])))};function tr({context:e}){let t=er[e.workbench.id];return t?(0,f.jsx)(u.Suspense,{fallback:null,children:(0,f.jsx)(t,{context:e})}):null}var nr=new Set([`hr-people-workbench`]);function rr(e){return!!(e&&nr.has(e.id))}var ir=`aiworker-hr`,ar={artifactId:null,content:``,error:null,loading:!1},or={content:``,error:null,loading:!1,workspaceId:null};function sr(e,t){switch(t.type){case`idle`:return ar;case`loading`:return{artifactId:t.artifactId,content:``,error:null,loading:!0};case`loaded`:return{artifactId:t.artifactId,content:t.content,error:null,loading:!1};case`failed`:return{artifactId:t.artifactId,content:``,error:t.error,loading:!1}}}function cr(e,t){switch(t.type){case`idle`:return or;case`loading`:return{content:``,error:null,loading:!0,workspaceId:t.workspaceId};case`loaded`:return{content:t.content,error:null,loading:!1,workspaceId:t.workspaceId};case`failed`:return{content:``,error:t.error,loading:!1,workspaceId:t.workspaceId}}}function lr(e,t){switch(t.type){case`idle`:return{error:null,items:[],loading:!1,query:t.query};case`loading`:return{...e,error:null,loading:!0,query:t.query};case`loaded`:return{error:null,items:t.items,loading:!1,query:t.query};case`failed`:return{error:t.error,items:[],loading:!1,query:t.query}}}function ur(){let e=Ze(),[t,n]=(0,u.useState)({data:null,error:null,loading:!0}),[r,i]=(0,u.useState)(null),[a,o]=(0,u.useState)(``),[s,c]=(0,u.useState)(ir),[l,d]=(0,u.useState)(`person-profile`),[p,h]=(0,u.useState)(null),[g,_]=(0,u.useState)(``),[y,b]=(0,u.useState)(``),[x,ee]=(0,u.useState)(``),[S,te]=(0,u.useState)(!1),[ne,re]=(0,u.useState)(!1),[ie,C]=(0,u.useState)(()=>new Set),[ae,se]=(0,u.useState)(!1),[ce,de]=(0,u.useState)(!1),[w,T]=(0,u.useState)(`execution`),[fe,pe]=(0,u.useState)(!1),[he,E]=(0,u.useState)({sessionId:null,value:``}),[_e,ve]=(0,u.useState)(!1),[ye,be]=(0,u.useState)(!1),[we,Ee]=(0,u.useState)(!1),[De,Oe]=(0,u.useState)(null),[ke,Ae]=(0,u.useState)({busyActionId:null,error:null,message:null}),[je,Me]=(0,u.useReducer)(lr,{error:null,items:[],loading:!1,query:``}),[Ne,Pe]=(0,u.useState)([]),[Ie,Le]=(0,u.useState)([]),[Be,Ve]=(0,u.useState)([]),[He,Ue]=(0,u.useState)(null),[We,Ge]=(0,u.useReducer)(sr,ar),[Ke,qe]=(0,u.useReducer)(cr,or),D=(0,u.useCallback)(async()=>{n(e=>({...e,loading:!0,error:null}));try{n({data:await Et(),error:null,loading:!1})}catch(e){n({data:null,error:e instanceof Error?e.message:String(e),loading:!1})}},[]);(0,u.useEffect)(()=>{D()},[D]);let O=t.data,k=at(O?.settings.language),A=ot(k),j=(0,u.useMemo)(()=>{let e=new Map;for(let t of O?.sessions??[])e.set(t.id,t);for(let t of Ie)e.set(t.id,t);return[...e.values()]},[O?.sessions,Ie]),Qe=e.kind===`workspace`||e.kind===`session`?O?.workspaces.find(t=>t.id===e.workspaceId)??null:null,$e=e.kind===`worker`?O?.workers.find(t=>t.id===e.workerId)??null:Qe?O?.workers.find(e=>e.id===Qe.workerId)??null:null,et=(0,u.useMemo)(()=>{if(!O)return[];let e=new Set(O.souls.filter(e=>e.status===`available`).map(e=>e.id)),t=new Set(O.templates.map(e=>e.soulId));return O.workers.filter(n=>e.has(n.soulId)&&t.has(n.soulId))},[O]),M=($e&&et.some(e=>e.id===$e.id)?$e:null)??(r?et.find(e=>e.id===r)??null:null)??et[0]??null,tt=M?O?.souls.find(e=>e.id===M.soulId)??null:O?.souls.find(e=>e.id===s&&e.status===`available`)??O?.souls.find(e=>e.status===`available`)??null,nt=(0,u.useMemo)(()=>O?.apps.find(e=>e.appId===tt?.id||e.projectedSoul?.id===tt?.id)??null,[O?.apps,tt?.id]),rt=(0,u.useMemo)(()=>O?.templates.filter(e=>e.soulId===M?.soulId)??[],[O?.templates,M?.soulId]),it=rt.find(e=>e.id===l)??rt[0]??null,dt=tt?Je(tt.id):null,P=(0,u.useMemo)(()=>O?.workspaces.filter(e=>e.workerId===M?.id)??[],[O?.workspaces,M?.id]),ft=(0,u.useMemo)(()=>{let e=new Set(P.map(e=>e.id));return j.filter(t=>e.has(t.workspaceId))},[j,P]),pt=(0,u.useMemo)(()=>new Set(ft.map(e=>e.id)),[ft]),vt=(0,u.useMemo)(()=>O?.artifacts.filter(e=>e.sessionId!==null&&pt.has(e.sessionId))??[],[O?.artifacts,pt]),bt=(0,u.useMemo)(()=>{let e=x.trim().toLowerCase();return P.filter(t=>{let n=Xt(t,j),r=O?.templates.find(e=>e.id===n?.capabilityTemplateId),i=r?lt(r,k):null;return!e||t.name.toLowerCase().includes(e)||r?.name.toLowerCase().includes(e)||i?.name.toLowerCase().includes(e)})},[k,j,O?.templates,x,P]),St=nt?.mountedContribution.shell??nt?.manifest.ui?.shell??null,F=St?.primaryAction??null,Ct=St?.search??null,wt=(0,u.useMemo)(()=>{let e=[],t=new Set,n=n=>{!n||t.has(n.id)||(t.add(n.id),e.push(n))};n(St?.primaryAction);for(let e of St?.actions??[])n(e);return St?.settings&&n({...St.settings,slot:`settings`}),e},[St]),Ot=wt.filter(e=>e.id!==F?.id),kt=(0,u.useMemo)(()=>{if(!O)return[];let e=new Map;for(let t of O.souls){let n=ct(t,k);e.set(t.id,{domain:n.domain,id:t.id,name:n.name,workers:[]})}for(let t of et)e.has(t.soulId)||e.set(t.soulId,{domain:t.soulId,id:t.soulId,name:t.soulId,workers:[]}),e.get(t.soulId)?.workers.push(t);return[...e.values()].filter(e=>e.workers.length>0)},[k,O,et]),At=e.kind===`workspace`||e.kind===`session`?e.workspaceId:null,I=(At?P.find(e=>e.id===At)??null:null)??(p&&P.some(e=>e.id===p)?P.find(e=>e.id===p)??null:Qt(P)),tn=(0,u.useMemo)(()=>I?P.filter(e=>e.id!==I.id):P,[I,P]),rn=(0,u.useMemo)(()=>I?j.filter(e=>e.workspaceId===I.id).sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt)):[],[j,I]),L=(e.kind===`session`?j.find(t=>t.id===e.sessionId&&t.workspaceId===e.workspaceId)??null:null)??(e.kind===`workspace`?null:I?Xt(I,j):Qt(ft)),on=L?Zt(L,O?.turns??[]):null,sn=L?Jt(L,O?.artifacts??[]):I?qt(I,O?.artifacts??[],j):Qt(vt),cn=L?Yt(L,O?.reviews??[]):null,ln=(0,u.useMemo)(()=>L?zt(L,O?.turns??[]):[],[O?.turns,L]),un=(0,u.useMemo)(()=>{if(!L)return[];let e=new Map;for(let t of ln)e.set(t.id,t);for(let t of Be.filter(e=>e.sessionId===L.id))e.set(t.id,t);return He?.sessionId===L.id&&e.set(He.id,He),[...e.values()].sort((e,t)=>e.seq-t.seq)},[He,L,ln,Be]),dn=(0,u.useMemo)(()=>L?Ht(L,O?.events??[]):[],[O?.events,L]),fn=(0,u.useMemo)(()=>{if(!L)return[];let e=new Map;for(let t of dn)e.set(String(t.id),t);for(let t of Ne.filter(e=>e.sessionId===L.id))e.set(String(t.id),t);return[...e.values()].sort((e,t)=>e.seq-t.seq)},[L,dn,Ne]),pn=(0,u.useMemo)(()=>L?Gn({artifact:sn,events:fn,locale:k,review:cn,session:L,turns:un}):null,[k,fn,un,sn,cn,L]),mn=I?Ut(I,O?.artifacts??[]):[],hn=I?Gt(I,O?.lessons??[]):[],gn=I?Wt(I,O?.reviews??[]):[],_n=(0,u.useMemo)(()=>O?.apps.filter(e=>e.status===`enabled`)??[],[O?.apps]),vn=(0,u.useMemo)(()=>new Set(P.map(e=>e.id)),[P]),yn=(0,u.useMemo)(()=>O?.reviews.filter(e=>vn.has(e.workspaceId))??[],[O?.reviews,vn]),bn=(0,u.useMemo)(()=>O?.lessons.filter(e=>vn.has(e.workspaceId))??[],[O?.lessons,vn]),xn=tt?ct(tt,k):null,Sn=it?lt(it,k):null,Cn=L?O?.templates.find(e=>e.id===L.capabilityTemplateId)??null:null,Tn=Cn?lt(Cn,k):null,En=en(O?.settings??null,A),On=wn(),An=O?.settings.appearance??`system`,jn=Dn(An,On),Mn=L&&he.sessionId===L.id?he.value:``,Nn=(0,u.useCallback)(e=>{E({sessionId:L?.id??null,value:e})},[L?.id]);(0,u.useEffect)(()=>{document.documentElement.lang=k},[k]),(0,u.useEffect)(()=>{let e=x.trim();if(!nt||!Ct||!e){Me({query:e,type:`idle`});return}let t=!1;return Me({query:e,type:`loading`}),jt(nt.appId,Ct.protocolProvider,e,8).then(n=>{t||Me({items:n.items,query:e,type:`loaded`})}).catch(n=>{t||Me({error:n instanceof Error?n.message:String(n),query:e,type:`failed`})}),()=>{t=!0}},[x,nt,Ct]);function Pn(e=`execution`){T(e),de(!0)}async function Fn(e){if(!nt||ke.busyActionId)return null;Ae({busyActionId:e.id,error:null,message:null});try{let t=await Dt(nt.appId,e.id,{source:`worker-shell`},{sessionId:L?.id??void 0,workerId:M?.id??void 0,workspaceId:I?.id??void 0});return Ae({busyActionId:null,error:t.result.ok?null:t.result.message??`Soul App action failed.`,message:t.result.message??null}),t.result.refresh&&await D(),t.result}catch(e){return Ae({busyActionId:null,error:e instanceof Error?e.message:String(e),message:null}),null}}function In(e){C(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}function Ln(e){if(!O)return;let t=O.souls.some(t=>t.id===e.appId)?e.appId:e.projectedSoul?.id??e.appId,n=O.souls.find(e=>e.id===t),r=n?ct(n,k):null;c(t),o(r?.name??e.manifest.name),te(!0)}async function Rn(e){if(e.preventDefault(),!a.trim()||!s)return;let t=await Tt({name:a.trim(),soulId:s});i(t.worker.id),o(``),te(!1),await D(),Xe({kind:`worker`,workerId:t.worker.id})}(0,u.useEffect)(()=>{if(!sn){Ge({type:`idle`});return}let e=!1;return Ge({artifactId:sn.id,type:`loading`}),Nt(sn.workspaceId,sn.path).then(t=>{e||Ge({artifactId:sn.id,content:t,type:`loaded`})}).catch(t=>{e||Ge({artifactId:sn.id,error:t instanceof Error?t.message:String(t),type:`failed`})}),()=>{e=!0}},[sn]),(0,u.useEffect)(()=>{if(!I){qe({type:`idle`});return}let e=!1;return qe({type:`loading`,workspaceId:I.id}),ht(I.id).then(t=>{e||qe({content:t,type:`loaded`,workspaceId:I.id})}).catch(t=>{e||qe({error:t instanceof Error?t.message:String(t),type:`failed`,workspaceId:I.id})}),()=>{e=!0}},[I]);async function zn(e){if(e.preventDefault(),!(!O||!tt||!M||!g.trim())){pe(!0);try{let e=await Mt(M.id,{metadata:{soulId:tt.id},name:g.trim()});h(e.workspace.id),_(``),re(!1),await D(),Xe({kind:`workspace`,workerId:M.id,workspaceId:e.workspace.id})}finally{pe(!1)}}}async function Bn(e){if(e.preventDefault(),!(!tt||!M||!I||!it||!y.trim()||!En.ready)){pe(!0);try{let e=Kt(tt,it,y),t=!1,n=M.id,r=I.id,i=e=>{if(t)return;let i=Ye(window.location.pathname),a=i.kind===`worker`&&i.workerId===n,o=i.kind===`workspace`&&i.workerId===n&&i.workspaceId===r;!a&&!o||(t=!0,Xe({kind:`session`,sessionId:e,workerId:n,workspaceId:r}))},a=await yt(I.id,{capabilityTemplateId:it.id,context:y,input:e,metadata:{inputHints:it.inputHints,outputKind:it.outputKind,requestedFrom:`worker-web`,reviewRubric:it.reviewRubric},title:I.name},M.id,{onEvent:e=>Pe(t=>[...t,e]),onSession:e=>{Le(t=>Vt(t,e)),i(e.id)},onTurn:e=>Ve(t=>Bt(t,e))});Le(e=>Vt(e,a.session)),Ve(e=>Bt(e,a.turn)),b(``),await D(),i(a.session.id)}finally{pe(!1)}}}async function Vn(e){if(e.preventDefault(),!(!L||!Mn.trim()||!En.ready)){ve(!0);try{let e=Mn.trim(),t=new Date().toISOString();Ue({createdAt:t,error:null,id:`pending-${t}`,input:e,metadataJson:{optimistic:!0},response:null,seq:(ln.at(-1)?.seq??ln.length)+1,sessionId:L.id,status:`running`,updatedAt:t}),E({sessionId:L.id,value:``});let n=await xt(L.id,{input:e,metadata:{requestedFrom:`worker-web-follow-up`}},L.workerId,{onEvent:e=>Pe(t=>[...t,e]),onTurn:e=>{Ve(t=>Bt(t,e)),Ue(t=>t?.sessionId===e.sessionId?null:t)}});Ve(e=>Bt(e,n.turn)),await D()}catch{await D()}finally{Ue(null),ve(!1)}}}async function Un(){if(!(!I||!L||!sn)){be(!0);try{await _t({artifactId:sn.id,findingsJson:[{message:`Human review requested from Worker Web.`}],risksJson:[],sessionId:L.id,turnId:on?.id??null,verdict:`needs_review`,workspaceId:I.id}),await D()}finally{be(!1)}}}async function Wn(){if(!(!I||!sn||we)){Ee(!0);try{let e=We.artifactId===sn.id&&!We.loading&&!We.error?We.content.trim():``;await gt(I.id,{artifactId:sn.id,findingsJson:[{message:`Approved from HR workbench.`}],profileMarkdown:e||void 0,risksJson:[],verdict:`pass`});try{qe({content:await ht(I.id),type:`loaded`,workspaceId:I.id})}catch(e){qe({error:e instanceof Error?e.message:String(e),type:`failed`,workspaceId:I.id})}await D()}finally{Ee(!1)}}}async function Kn(e,t){Oe(e.id);try{await mt(e.id,t),await D()}finally{Oe(null)}}function qn(e){let t=rt.find(t=>t.id===e.templateId)??it;t&&d(t.id);let n=I?.name??M?.name??xn?.name??`this people profile`;b([`Workbench action: ${e.label}`,`Scope: ${e.scope}`,`Target: ${n}`,``,e.prompt,``,`Return this as a profile-bound artifact proposal with source-backed claims, missing evidence, risks, next-step notes, and human review notes.`].join(`
|
|
18
|
-
`))}function Jn(e,t=`plus`){let n=ke.busyActionId===e.id,r=t===`settings`?Te:xe;return(0,f.jsxs)(`button`,{"aria-busy":n,className:`shell-primary-action`,disabled:!!ke.busyActionId,title:`Provided by the Soul App protocol`,type:`button`,onClick:()=>void Fn(e),children:[(0,f.jsx)(r,{"aria-hidden":`true`,size:14}),(0,f.jsx)(`span`,{children:e.label})]},e.id)}function Yn(){return Ct?(0,f.jsxs)(`label`,{className:`toolbar-search`,children:[(0,f.jsx)(`span`,{className:`search-icon`,"aria-hidden":`true`,children:(0,f.jsx)(Ce,{size:13})}),(0,f.jsx)(`input`,{"aria-label":A.accessibility.searchProjects,placeholder:Ct.placeholder,value:x,onChange:e=>ee(e.target.value)})]}):null}let Xn=ke.message||ke.error?(0,f.jsx)(`p`,{className:ke.error?`shell-action-status error`:`shell-action-status`,role:ke.error?`alert`:`status`,children:ke.error??ke.message}):null,Zn=Ct&&je.query?(0,f.jsxs)(`div`,{className:`shell-search-results`,role:`status`,"aria-live":`polite`,children:[je.loading?(0,f.jsx)(`span`,{className:`shell-search-note`,children:`Searching`}):null,je.error?(0,f.jsx)(`span`,{className:`shell-search-note error`,children:je.error}):null,!je.loading&&!je.error?je.items.map(e=>(0,f.jsxs)(`button`,{type:`button`,className:`shell-search-result`,children:[(0,f.jsx)(`strong`,{children:e.title}),e.summary?(0,f.jsx)(`span`,{children:e.summary}):null]},e.id)):null]}):null,Qn=St?{actionDescriptors:wt,actionSlots:new Set(wt.map(e=>e.slot)),busyActionId:ke.busyActionId,onAction:Fn,results:Zn,search:Yn(),status:Xn}:null;if(t.loading&&!O)return(0,f.jsx)(`main`,{className:`od-loading-shell`,"data-appearance":An,"data-theme":jn,children:(0,f.jsx)(`span`,{children:A.app.loading})});if(t.error)return(0,f.jsx)(`main`,{className:`od-loading-shell`,"data-appearance":An,"data-theme":jn,children:(0,f.jsx)(`span`,{role:`alert`,children:t.error})});if(!O)return null;if(!M){let e=O.souls.filter(e=>e.status===`available`);return(0,f.jsx)(v,{appearance:An,mainLabel:A.accessibility.soulProjectsAndArtifacts,resolvedTheme:jn,sidebarLabel:A.workspace.currentWorker,variant:`home`,sidebar:(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(dr,{copy:A}),(0,f.jsx)(`section`,{className:`workspace-rail-card first-run-rail-card`,children:(0,f.jsx)(Re,{className:`rail-section-head`,title:A.workspace.firstRunRailTitle,description:A.workspace.firstRunRailHint})})]}),main:(0,f.jsx)(m,{kicker:A.app.workspacePill,title:A.workspace.firstRunTitle,children:(0,f.jsx)(fr,{apps:_n,copy:A,locale:k,souls:e,onCreateWorker:()=>te(!0),onStartApp:Ln})}),dialogs:(0,f.jsx)(Pt,{availableSouls:e,copy:A,locale:k,open:S,selectedSoulId:s,workerName:a,onClose:()=>te(!1),onNameChange:o,onSoulChange:c,onSubmit:Rn})})}if(!tt||!it||!xn||!Sn)return null;let $n=(e.kind===`workspace`||e.kind===`session`)&&!!I,er=$n&&!!I,nr=e.kind===`session`&&!!(I&&L),ur=rr(dt),pr=nr?`session`:er?`workspace`:`home`,hr=dt?{artifactPreview:We,artifacts:vt,copy:A,engineReadiness:En,lessons:bn,locale:k,reviews:yn,selectedArtifact:sn,selectedTemplate:it,selectedWorkspace:I,shellHeader:Qn,sessions:ft,soul:tt,soulCopy:xn,submitting:fe,templates:rt,value:y,workbench:dt,workerName:M.name,workspaces:P,onActionSelect:qn,onContextChange:b,onCreateWorkspace:()=>re(!0),onOpenConnectors:()=>Pn(`connectors`),onOpenSettings:()=>Pn(`execution`),onOpenSession:e=>Xe({kind:`session`,sessionId:e.id,workerId:e.workerId,workspaceId:e.workspaceId}),onOpenWorkspace:e=>Xe({kind:`workspace`,workerId:e.workerId,workspaceId:e.id}),onPromoteProfileRevision:Wn,onRefresh:()=>void D(),onSubmitSession:Bn,onTemplateChange:d,profilePreview:Ke,profileRevisionSubmitting:we}:null;return(0,f.jsx)(v,{appearance:An,detail:nr?(0,f.jsx)(Hn,{artifact:sn,artifactCopy:Tn,artifactPreview:We,artifacts:mn,copy:A,engineReadiness:En,events:fn,lessonBusyId:De,lessons:hn,locale:k,mode:`artifact`,collapsed:ae,review:cn,reviewSubmitting:ye,reviews:gn,session:L,template:Cn,turnInput:Mn,turnSubmitting:_e,turns:un,workspace:I,onLessonStatus:(e,t)=>void Kn(e,t),onReview:()=>void Un(),onSubmitTurn:Vn,onTurnInputChange:Nn,progress:pn}):null,detailCollapsed:ae,dialogs:(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(Pt,{availableSouls:O.souls.filter(e=>e.status===`available`),copy:A,locale:k,open:S,selectedSoulId:s,workerName:a,onClose:()=>te(!1),onNameChange:o,onSoulChange:c,onSubmit:Rn}),(0,f.jsx)(Ft,{copy:A,open:ne,placeholder:$t(tt.id,A),workerLabel:`${M.name} / ${xn.name}`,submitting:fe,workspaceTitle:g,onClose:()=>re(!1),onSubmit:zn,onTitleChange:_}),ce?(0,f.jsx)(an,{initial:O.settings,initialSection:w,apps:O.apps,runtimeVersion:O.info.runtimeVersion,templates:O.templates,onClose:()=>de(!1),onSaved:e=>{n(t=>t.data?{...t,data:{...t.data,settings:e},loading:!1}:t)},onAppsChanged:()=>D()}):null]}),mainLabel:A.accessibility.soulProjectsAndArtifacts,resolvedTheme:jn,sidebarLabel:$n?A.workspace.workspaceNavigation:A.accessibility.soulProjectCreator,variant:pr,sidebar:(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(dr,{copy:A}),$n&&I?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`section`,{className:`workspace-rail-card workspace-context-card`,children:[(0,f.jsxs)(`button`,{type:`button`,className:`rail-back-button`,onClick:()=>Xe({kind:`worker`,workerId:M.id}),children:[(0,f.jsx)(oe,{"aria-hidden":`true`,size:13}),(0,f.jsx)(`span`,{children:A.workspace.backToWorker})]}),(0,f.jsxs)(`div`,{className:`rail-context-main`,children:[(0,f.jsx)(`span`,{className:`kicker`,children:A.workspace.workspaceNavigation}),(0,f.jsx)(`h3`,{children:I.name}),(0,f.jsx)(`p`,{children:`${xn.name} / ${xn.domain}`})]}),(0,f.jsx)(Lt,{compact:!0,copy:A,locale:k,soul:tt,soulCopy:xn,worker:M}),(0,f.jsxs)(`div`,{className:`rail-meta-grid`,children:[(0,f.jsx)(`span`,{children:A.workspace.currentWorkspace}),(0,f.jsx)(`strong`,{children:I.name}),(0,f.jsx)(`span`,{children:A.workspace.selectedCapability}),(0,f.jsx)(`strong`,{children:Tn?.name??Sn.name}),(0,f.jsx)(`span`,{children:A.workspace.currentSession}),(0,f.jsx)(`strong`,{children:L?ut(L.status,k):A.artifact.noSession})]})]}),(0,f.jsxs)(`section`,{className:`workspace-rail-card`,children:[(0,f.jsx)(Re,{className:`rail-section-head`,title:A.workspace.workspaceSessions,action:(0,f.jsx)(Fe,{"aria-label":A.workspace.newSession,title:A.workspace.newSession,onClick:()=>Xe({kind:`workspace`,workerId:I.workerId,workspaceId:I.id}),children:(0,f.jsx)(xe,{"aria-hidden":`true`,size:16})})}),(0,f.jsx)(`div`,{className:`rail-session-list`,children:rn.length>0?rn.map(e=>(0,f.jsxs)(`button`,{type:`button`,className:`rail-session-item ${L?.id===e.id?`active`:``}`,onClick:()=>Xe({kind:`session`,sessionId:e.id,workerId:e.workerId,workspaceId:e.workspaceId}),children:[(0,f.jsx)(`strong`,{children:e.title}),(0,f.jsxs)(`span`,{children:[lt(O.templates.find(t=>t.id===e.capabilityTemplateId)??it,k).name,` · `,ut(e.status,k)]}),(0,f.jsx)(`small`,{children:A.workspace.updated(N(e.updatedAt,k))})]},e.id)):(0,f.jsx)(`div`,{className:`rail-empty`,children:A.workspace.noWorkspaceSessions})})]}),(0,f.jsxs)(`section`,{className:`workspace-rail-card`,children:[(0,f.jsx)(Re,{className:`rail-section-head`,title:A.workspace.otherWorkspaces,action:(0,f.jsx)(Fe,{"aria-label":A.workspace.createWorkspace,title:A.workspace.createWorkspace,onClick:()=>re(!0),children:(0,f.jsx)(xe,{"aria-hidden":`true`,size:16})})}),(0,f.jsx)(`div`,{className:`rail-workspace-list`,children:tn.length>0?tn.map(e=>(0,f.jsxs)(`button`,{type:`button`,className:`rail-workspace-item`,onClick:()=>Xe({kind:`workspace`,workerId:e.workerId,workspaceId:e.id}),children:[(0,f.jsx)(`strong`,{children:e.name}),(0,f.jsx)(`small`,{children:ut(e.status,k)})]},e.id)):(0,f.jsx)(`div`,{className:`rail-empty`,children:A.workspace.noOtherWorkspaces})})]})]}):(0,f.jsx)(f.Fragment,{children:(0,f.jsx)(`section`,{className:`newproj worker-list-panel soul-catalog-panel soul-rail-panel`,children:(0,f.jsxs)(`div`,{className:`newproj-body`,children:[(0,f.jsx)(Re,{className:`section-head compact with-action`,title:A.workspace.workerList,description:A.workspace.workerListHint,action:(0,f.jsx)(Fe,{"aria-label":A.workspace.createWorker,title:A.workspace.createWorker,onClick:()=>te(!0),children:(0,f.jsx)(xe,{"aria-hidden":`true`,size:16})})}),(0,f.jsx)(`div`,{className:`worker-list-rail soul-rail`,role:`listbox`,"aria-label":A.workspace.currentWorker,children:kt.map(e=>{let t=ie.has(e.id),n=`worker-soul-group-${e.id}`;return(0,f.jsxs)(`div`,{className:`worker-soul-group`,children:[(0,f.jsxs)(`button`,{type:`button`,className:`worker-soul-group-toggle`,"aria-label":`${e.name} (${e.workers.length}) ${e.domain}`,"aria-controls":n,"aria-expanded":!t,onClick:()=>In(e.id),children:[(0,f.jsxs)(`span`,{className:`worker-soul-group-title`,children:[(0,f.jsx)(`strong`,{children:`${e.name} (${e.workers.length})`}),(0,f.jsx)(`small`,{children:e.domain})]}),t?(0,f.jsx)(ue,{"aria-hidden":`true`,size:14}):(0,f.jsx)(le,{"aria-hidden":`true`,size:14})]}),t?null:(0,f.jsx)(`div`,{id:n,className:`worker-soul-group-items`,role:`group`,"aria-label":e.name,children:e.workers.map(e=>{let t=M.id===e.id;return(0,f.jsxs)(`button`,{type:`button`,className:`worker-list-item ${t?`active`:``}`,"aria-selected":t,role:`option`,onClick:()=>{i(e.id),h(null);let t=O.templates.find(t=>t.soulId===e.soulId);t&&d(t.id),Xe({kind:`worker`,workerId:e.id})},children:[(0,f.jsx)(`span`,{className:`worker-list-item-main`,children:(0,f.jsx)(`strong`,{children:e.name})}),(0,f.jsx)(`span`,{className:`status-dot ${e.status===`active`?`active`:``}`,"aria-hidden":`true`})]},e.id)})})]},e.id)})})]})})}),(0,f.jsxs)(`div`,{className:`entry-side-foot`,children:[(0,f.jsxs)(`button`,{type:`button`,className:`foot-pill`,onClick:()=>Pn(`execution`),children:[(0,f.jsx)(Te,{"aria-hidden":`true`,size:12}),(0,f.jsx)(`span`,{children:O.settings.executionMode===`local-cli`?`Local CLI`:`BYOK`}),(0,f.jsx)(`span`,{className:`foot-divider-dot`,children:`·`}),(0,f.jsx)(`span`,{children:nn(O.settings,A)})]}),(0,f.jsxs)(`button`,{type:`button`,className:`foot-pill`,"aria-label":A.accessibility.languageSwitcher,onClick:()=>Pn(`language`),children:[(0,f.jsx)(ge,{"aria-hidden":`true`,size:12}),(0,f.jsx)(`span`,{children:st(k,k)}),(0,f.jsx)(le,{"aria-hidden":`true`,size:12})]})]})]}),main:(0,f.jsxs)(f.Fragment,{children:[nr&&I&&L&&pn?(0,f.jsx)(kn,{copy:A,detailDrawerOpen:!ae,engineReadiness:En,events:fn,locale:k,session:L,template:Cn,turnInput:Mn,turnSubmitting:_e,turns:un,workspace:I,onOpenSettings:()=>Pn(`execution`),onRefresh:()=>void D(),onSubmitTurn:Vn,onToggleDetailDrawer:()=>se(e=>!e),onTurnInputChange:Nn,progress:pn},L.id):null,!nr&&ur&&hr?(0,f.jsx)(tr,{context:hr}):null,!nr&&!ur&&$n&&I?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`header`,{className:`entry-header workspace-header`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`span`,{className:`kicker`,children:A.workspace.currentWorkspace}),(0,f.jsx)(`h1`,{children:I.name})]}),(0,f.jsxs)(`div`,{className:`entry-header-right`,children:[(0,f.jsx)(Fe,{"aria-label":A.accessibility.refreshWorkspace,onClick:()=>void D(),children:(0,f.jsx)(Se,{"aria-hidden":`true`,size:16})}),(0,f.jsx)(Fe,{"aria-label":A.accessibility.openSettings,onClick:()=>Pn(),children:(0,f.jsx)(Te,{"aria-hidden":`true`,size:16})})]})]}),(0,f.jsx)(`div`,{className:`entry-tab-content workspace-content workspace-compose-content`,children:(0,f.jsx)(It,{copy:A,engineLabel:nn(O.settings,A),engineReadiness:En,locale:k,selectedTemplate:it,submitting:fe,templates:rt,value:y,workspace:I,onContextChange:b,onOpenSettings:()=>Pn(`execution`),onSubmit:Bn,onTemplateChange:d})})]}):null,!nr&&!ur&&!($n&&I)?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`header`,{className:`entry-header workspace-header`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`span`,{className:`kicker`,children:A.workspace.currentWorker}),(0,f.jsx)(`h1`,{children:A.workspace.workspaceTitle(M.name)})]}),(0,f.jsxs)(`div`,{className:`entry-header-right`,children:[(0,f.jsx)(Fe,{"aria-label":A.accessibility.refreshWorkspace,onClick:()=>void D(),children:(0,f.jsx)(Se,{"aria-hidden":`true`,size:16})}),(0,f.jsx)(Fe,{"aria-label":A.accessibility.openSettings,onClick:()=>Pn(),children:(0,f.jsx)(Te,{"aria-hidden":`true`,size:16})}),(0,f.jsx)(`button`,{className:`avatar-btn`,type:`button`,"aria-label":A.accessibility.workspace,children:(0,f.jsx)(`span`,{"aria-hidden":`true`,className:`avatar-btn-initials`,children:mr(M.name)})})]})]}),(0,f.jsxs)(`div`,{className:`entry-tab-content workspace-content`,children:[(0,f.jsxs)(`section`,{className:`worker-overview-panel`,children:[(0,f.jsx)(Lt,{compact:!0,copy:A,locale:k,soul:tt,soulCopy:xn,worker:M}),(0,f.jsxs)(`div`,{className:`worker-capability-summary`,children:[(0,f.jsx)(Re,{className:`rail-section-head`,title:`${A.create.capabilityTemplate} (${rt.length})`}),(0,f.jsx)(`div`,{className:`worker-capability-chips`,children:rt.map(e=>(0,f.jsx)(`span`,{children:lt(e,k).name},e.id))})]})]}),(0,f.jsxs)(`section`,{className:`workspace-list-section`,children:[(0,f.jsxs)(`div`,{className:`tab-panel-toolbar`,children:[(0,f.jsxs)(`div`,{className:`toolbar-left`,children:[(0,f.jsx)(`strong`,{children:`${A.workspace.workspaceList} (${bt.length})`}),(0,f.jsx)(Fe,{"aria-label":A.workspace.createWorkspace,title:A.workspace.createWorkspace,onClick:()=>re(!0),children:(0,f.jsx)(xe,{"aria-hidden":`true`,size:16})}),F?Jn(F):null,Ot.map(e=>Jn(e,e.slot===`settings`?`settings`:`plus`))]}),(0,f.jsx)(`div`,{className:`toolbar-right`,children:Ct?Yn():(0,f.jsxs)(`label`,{className:`toolbar-search`,children:[(0,f.jsx)(`span`,{className:`search-icon`,"aria-hidden":`true`,children:(0,f.jsx)(Ce,{size:13})}),(0,f.jsx)(`input`,{"aria-label":A.accessibility.searchProjects,placeholder:A.projects.searchPlaceholder,value:x,onChange:e=>ee(e.target.value)})]})})]}),Xn,Zn,(0,f.jsx)(`div`,{className:`design-grid workspace-grid workspace-list`,children:bt.length>0?bt.map(e=>(0,f.jsx)(Rt,{active:I?.id===e.id,artifact:qt(e,O.artifacts,j),item:e,locale:k,session:Xt(e,j),template:O.templates.find(t=>t.id===Xt(e,j)?.capabilityTemplateId),turn:Zt(Xt(e,j),O.turns),onSelect:()=>{h(e.id),Xe({kind:`workspace`,workerId:e.workerId,workspaceId:e.id})}},e.id)):(0,f.jsx)(ze,{className:`empty-design-state`,icon:(0,f.jsx)(me,{size:20}),title:A.projects.empty.title,detail:A.projects.empty.detail(xn.name),action:(0,f.jsxs)(`button`,{type:`button`,className:`ghost icon-btn`,onClick:()=>re(!0),children:[(0,f.jsx)(xe,{"aria-hidden":`true`,size:13}),(0,f.jsx)(`span`,{children:A.workspace.createWorkspace})]})})})]})]})]}):null]})})}function dr({copy:e}){return(0,f.jsxs)(`div`,{className:`entry-brand`,children:[(0,f.jsx)(`span`,{className:`entry-brand-mark`,"aria-hidden":`true`,children:`AI`}),(0,f.jsxs)(`div`,{className:`entry-brand-text`,children:[(0,f.jsxs)(`div`,{className:`entry-brand-title-row`,children:[(0,f.jsx)(`span`,{className:`entry-brand-title`,children:e.app.brand}),(0,f.jsx)(`span`,{className:`entry-brand-pill`,children:e.app.workspacePill})]}),(0,f.jsx)(`div`,{className:`entry-brand-subtitle`,children:e.app.subtitle})]})]})}function fr({apps:e,copy:t,locale:n,onCreateWorker:r,onStartApp:i,souls:a}){return e.length===0?(0,f.jsx)(ze,{className:`empty-design-state`,icon:(0,f.jsx)(me,{size:20}),title:t.workspace.noSoulApps,detail:t.workspace.noSoulAppsDetail,action:(0,f.jsxs)(`button`,{type:`button`,className:`ghost icon-btn`,onClick:r,children:[(0,f.jsx)(xe,{"aria-hidden":`true`,size:13}),(0,f.jsx)(`span`,{children:t.workspace.createWorker})]})}):(0,f.jsxs)(`section`,{className:`first-run-panel`,"aria-label":t.workspace.firstRunTitle,children:[(0,f.jsx)(`div`,{className:`first-run-intro`,children:(0,f.jsx)(`p`,{children:t.workspace.firstRunDetail})}),(0,f.jsx)(`div`,{className:`first-run-app-grid`,children:e.map(e=>{let r=pr(e,a),o=r?ct(r,n):null,s=o?.domain??e.projectedSoul?.domain??e.appId,c=o?.description??e.manifest.description;return(0,f.jsxs)(`button`,{type:`button`,className:`first-run-app-card`,"aria-label":t.workspace.startSoulApp(e.manifest.name),onClick:()=>i(e),children:[(0,f.jsxs)(`span`,{className:`first-run-app-card-main`,children:[(0,f.jsx)(`strong`,{children:e.manifest.name}),(0,f.jsx)(`span`,{children:s})]}),(0,f.jsx)(`span`,{className:`first-run-app-card-detail`,children:c}),(0,f.jsxs)(`span`,{className:`first-run-app-card-foot`,children:[(0,f.jsx)(`span`,{children:`${ut(e.status,n)} · ${e.version}`}),(0,f.jsxs)(`span`,{className:`first-run-app-action`,children:[(0,f.jsx)(`span`,{children:t.workspace.startSoulApp(e.manifest.name)}),(0,f.jsx)(ue,{"aria-hidden":`true`,size:14})]})]})]},e.appId)})})]})}function pr(e,t){return t.find(t=>t.id===e.appId)??t.find(t=>t.id===e.projectedSoul?.id)??null}function mr(e){let t=e.trim().split(/\s+/).filter(Boolean);return t.length>1?t.slice(0,2).map(e=>Array.from(e)[0]).join(``).toUpperCase():Array.from(t[0]??`AI`).slice(0,2).join(``).toUpperCase()}var hr=document.getElementById(`root`);if(!hr)throw Error(`Root element not found`);(0,d.createRoot)(hr).render((0,f.jsx)(u.StrictMode,{children:(0,f.jsx)(ur,{})}));export{Fe as a,Te as c,xe as d,be as f,C as g,le as h,ut as i,Ce as l,me as m,lt as n,Oe as o,ye as p,N as r,Ee as s,$n as t,Se as u};
|
|
17
|
+
`)}function qt(e,t,n){let r=Xt(e,n);return r?Jt(r,t):null}function Jt(e,t){return t.find(t=>t.sessionId===e.id)??null}function Yt(e,t){return t.find(t=>t.sessionId===e.id)??null}function Xt(e,t){return e?t.filter(t=>t.workspaceId===e.id).sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt))[0]??null:null}function Zt(e,t){return e?t.filter(t=>t.sessionId===e.id).sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt))[0]??null:null}function Qt(e){return e.slice().sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt))[0]??null}function $t(e,t){return e===`aiworker-hr`||e===`hr`?t.create.projectPlaceholders.hr:e===`pm`?t.create.projectPlaceholders.pm:e===`aiworker-qa`||e===`qa`?t.create.projectPlaceholders.qa:e===`devops`?t.create.projectPlaceholders.devops:t.create.projectPlaceholders.default}function en(e,t){if(!e)return{detail:t.workspace.engineLoading,label:t.workspace.engineLoading,ready:!1};if(e.executionMode===`byok`){let n=e.byok.provider.trim().length>0&&e.byok.model.trim().length>0&&e.byok.apiKeyRef.trim().length>0;return{detail:n?t.workspace.byokReady(e.byok.provider,e.byok.model):t.workspace.byokNeedsKey,label:`${e.byok.provider} · ${e.byok.model}`,ready:n}}let n=e.engines.find(t=>t.id===e.engineId);return n?{detail:n.installed?t.workspace.engineReadyDetail(n.name):t.workspace.engineNotInstalled(n.name),label:`${n.name}${n.installed?``:` · ${t.common.notInstalled}`}`,ready:n.installed}:{detail:t.workspace.engineMissing(e.engineId),label:e.engineId,ready:!1}}var I={"claude-code":`/engine-icons/claude.svg`,codex:`/engine-icons/openai.svg`,cursor:`/engine-icons/cursor.svg`,gemini:`/engine-icons/gemini.svg`,hermes:`/engine-icons/hermesagent.svg`,"hermes-agent":`/engine-icons/hermesagent.svg`,opencode:`/engine-icons/opencode.svg`,qwen:`/engine-icons/qwen.svg`};function tn(e){return I[e]??null}function nn(e,t){if(e.executionMode===`byok`)return`${e.byok.provider} · ${e.byok.model}`;let n=e.engines.find(t=>t.id===e.engineId);return n?`${n.name}${n.installed?``:` · ${t.common.notInstalled}`}`:e.engineId}var rn=[{id:`execution`,icon:De},{id:`soul-packs`,icon:Oe},{id:`connectors`,icon:E},{id:`mcp`,icon:Ee},{id:`external-mcp`,icon:Ae},{id:`language`,icon:ge},{id:`appearance`,icon:ke},{id:`about`,icon:Te}];function an({apps:e,initial:t,initialSection:n,onAppsChanged:r,onClose:i,onSaved:a,runtimeVersion:o,templates:s}){let[c,l]=(0,u.useState)(t),[d,p]=(0,u.useState)(n),[m,h]=(0,u.useState)(`idle`),[g,_]=(0,u.useState)(null),v=at(c.language),y=ot(v),b=y.settings;(0,u.useEffect)(()=>{if(m!==`saved`)return;let e=window.setTimeout(()=>{h(e=>e===`saved`?`idle`:e)},1600);return()=>window.clearTimeout(e)},[m]);async function x(e){l({...c,...e}),h(`saving`);try{let t=await F(e);l(t.settings),a(t.settings),h(`saved`)}catch{h(`failed`)}}async function ee(){h(`saving`);try{let e=await Ct();l(e.settings),a(e.settings),h(`saved`)}catch{h(`failed`)}}async function S(e){_(b.engine.testing);try{_((await wt(e)).result.message)}catch(e){_(e instanceof Error?e.message:String(e))}}return(0,f.jsx)(`div`,{className:`modal-backdrop`,onClick:i,children:(0,f.jsxs)(`div`,{className:`modal modal-settings`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`settings-dialog-title`,onClick:e=>e.stopPropagation(),children:[(0,f.jsxs)(`div`,{className:`settings-chrome`,"aria-hidden":!1,children:[m===`idle`?null:(0,f.jsxs)(`div`,{className:`settings-autosave ${Sn(m)}`,role:`status`,"aria-live":`polite`,children:[m===`saving`?(0,f.jsx)(Se,{size:12,className:`spin`}):(0,f.jsx)(ce,{size:12}),(0,f.jsx)(`span`,{children:xn(m,b)})]}),(0,f.jsx)(Pe,{variant:`close`,onClick:i,"aria-label":y.accessibility.closeSettings,title:y.accessibility.closeSettings,children:(0,f.jsx)(Me,{size:16,strokeWidth:2})})]}),(0,f.jsxs)(`header`,{className:`modal-head`,children:[(0,f.jsx)(`span`,{className:`kicker`,children:b.dialog.kicker}),(0,f.jsx)(`h2`,{id:`settings-dialog-title`,children:b.dialog.title}),(0,f.jsx)(`p`,{className:`subtitle`,children:b.dialog.subtitle})]}),(0,f.jsxs)(`div`,{className:`modal-body`,children:[(0,f.jsx)(`aside`,{className:`settings-sidebar`,"aria-label":b.dialog.title,children:rn.map(e=>{let t=e.icon,n=bn(b.nav,e.id);return(0,f.jsx)(qe,{active:d===e.id,className:`settings-nav-item`,description:n.detail,icon:(0,f.jsx)(t,{size:18}),label:n.title,onClick:()=>p(e.id)},e.id)})}),(0,f.jsxs)(`div`,{className:`settings-content`,children:[d===`execution`?(0,f.jsx)(L,{copy:y,engineTest:g,onRescan:()=>void ee(),onTest:e=>void S(e),settings:c,update:x}):null,d===`soul-packs`?(0,f.jsx)(sn,{apps:e,copy:y,locale:v,settings:c,templates:s,onAppsChanged:r}):null,d===`connectors`?(0,f.jsx)(mn,{copy:y,settings:c,update:x}):null,d===`mcp`?(0,f.jsx)(hn,{copy:y,settings:c,update:x}):null,d===`external-mcp`?(0,f.jsx)(gn,{copy:y,settings:c,update:x}):null,d===`language`?(0,f.jsx)(_n,{copy:y,locale:v,update:x}):null,d===`appearance`?(0,f.jsx)(vn,{copy:y,settings:c,update:x}):null,d===`about`?(0,f.jsxs)(`div`,{className:`settings-section`,children:[(0,f.jsx)(`div`,{className:`section-head`,children:(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h3`,{children:b.about.title}),(0,f.jsx)(`p`,{className:`hint`,children:b.about.hint})]})}),(0,f.jsxs)(`dl`,{className:`about-grid`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`dt`,{children:b.about.version}),(0,f.jsx)(`dd`,{children:o})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`dt`,{children:b.about.executionMode}),(0,f.jsx)(`dd`,{children:c.executionMode})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`dt`,{children:b.about.selectedEngine}),(0,f.jsx)(`dd`,{children:c.engineId})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`dt`,{children:b.about.updated}),(0,f.jsx)(`dd`,{children:N(c.updatedAt,v)})]})]})]}):null]})]})]})})}function L({copy:e,engineTest:t,onRescan:n,onTest:r,settings:i,update:a}){let o=i.engines.filter(e=>e.installed).length,s=e.settings;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`div`,{className:`seg-control`,role:`tablist`,"aria-label":s.nav.execution,style:{"--seg-cols":2},children:[(0,f.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":i.executionMode===`local-cli`,className:`seg-btn ${i.executionMode===`local-cli`?`active`:``}`,onClick:()=>void a({executionMode:`local-cli`}),children:[(0,f.jsx)(`span`,{className:`seg-title`,children:`Local CLI`}),(0,f.jsx)(`span`,{className:`seg-meta`,children:s.engine.availableCount(o)})]}),(0,f.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":i.executionMode===`byok`,className:`seg-btn ${i.executionMode===`byok`?`active`:``}`,onClick:()=>void a({executionMode:`byok`}),children:[(0,f.jsx)(`span`,{className:`seg-title`,children:`BYOK`}),(0,f.jsx)(`span`,{className:`seg-meta`,children:i.byok.provider})]})]}),i.executionMode===`local-cli`?(0,f.jsxs)(`section`,{className:`settings-section`,children:[(0,f.jsxs)(`div`,{className:`section-head`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h3`,{children:s.engine.title}),(0,f.jsx)(`p`,{className:`hint`,children:s.engine.hint})]}),(0,f.jsxs)(`div`,{className:`section-head-actions`,children:[(0,f.jsx)(Pe,{variant:`ghost`,icon:(0,f.jsx)(he,{size:13}),className:`settings-action-button settings-test-btn`,onClick:()=>r(i.engineId),children:(0,f.jsx)(`span`,{children:s.engine.test})}),(0,f.jsx)(Pe,{variant:`ghost`,icon:(0,f.jsx)(Se,{size:13}),className:`settings-action-button settings-rescan-btn`,onClick:n,children:(0,f.jsx)(`span`,{children:s.engine.rescan})})]})]}),(0,f.jsx)(`div`,{className:`agent-grid`,children:i.engines.map(t=>(0,f.jsx)(on,{active:i.engineId===t.id,copy:e,engine:t,onSelect:()=>void a({engineId:t.id})},t.id))}),t?(0,f.jsx)(`p`,{className:`settings-note`,role:`status`,children:t}):null]}):(0,f.jsxs)(`section`,{className:`settings-section`,children:[(0,f.jsx)(`div`,{className:`section-head`,children:(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h3`,{children:s.byok.title}),(0,f.jsx)(`p`,{className:`hint`,children:s.byok.hint})]})}),(0,f.jsxs)(`div`,{className:`settings-field-grid`,children:[(0,f.jsx)(Ge,{label:s.byok.provider,children:(0,f.jsx)(`input`,{value:i.byok.provider,onChange:e=>void a({byok:{...i.byok,provider:e.target.value}})})}),(0,f.jsx)(Ge,{label:s.byok.baseUrl,children:(0,f.jsx)(`input`,{value:i.byok.baseUrl,onChange:e=>void a({byok:{...i.byok,baseUrl:e.target.value}})})}),(0,f.jsx)(Ge,{label:s.byok.model,children:(0,f.jsx)(`input`,{value:i.byok.model,onChange:e=>void a({byok:{...i.byok,model:e.target.value}})})}),(0,f.jsx)(Ge,{label:s.byok.apiKeyRef,children:(0,f.jsx)(`input`,{value:i.byok.apiKeyRef,onChange:e=>void a({byok:{...i.byok,apiKeyRef:e.target.value}}),placeholder:`env:OPENAI_API_KEY`})})]})]})]})}function on({active:e,copy:t,engine:n,onSelect:r}){let i=tn(n.id);return(0,f.jsxs)(We,{active:e,className:`agent-card${n.installed?``:` disabled`}`,disabled:!n.installed,"aria-pressed":e,onClick:r,children:[(0,f.jsx)(`span`,{className:`agent-icon ${n.installed?`agent-icon-ready`:`agent-icon-muted`}`,"data-engine-icon":n.id,"aria-hidden":`true`,children:i?(0,f.jsx)(`span`,{className:`agent-icon-shape`,style:{"--engine-icon-url":`url(${i})`}}):(0,f.jsx)(Oe,{size:24})}),(0,f.jsxs)(`span`,{className:`agent-card-body`,children:[(0,f.jsx)(`span`,{className:`agent-card-name`,children:n.name}),(0,f.jsx)(`span`,{className:`agent-card-meta`,children:n.installed?(0,f.jsx)(`span`,{children:n.version??n.path??n.command}):(0,f.jsx)(`span`,{className:`muted`,children:t.common.notInstalled})})]}),n.installed?(0,f.jsx)(`span`,{className:`status-dot${e?` active`:``}`,"aria-hidden":`true`}):null]})}function sn({apps:e,copy:t,locale:n,onAppsChanged:r,settings:i,templates:a}){let o=t.settings.soulPacks,[s,c]=(0,u.useState)(null),[l,d]=(0,u.useState)(null);async function p(e){c(e.appId),d(null);try{if(e.status===`enabled`)await At(e.appId);else{let t=await kt(e.appId);if(!t.summary.canEnable)throw Error(cn(t.summary));await Ot(e.appId)}await r?.()}catch(e){d(e instanceof Error?e.message:String(e))}finally{c(null)}}return(0,f.jsxs)(`div`,{className:`settings-section`,children:[(0,f.jsx)(`div`,{className:`section-head`,children:(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h3`,{children:o.title}),(0,f.jsx)(`p`,{className:`hint`,children:o.hint})]})}),(0,f.jsx)(`div`,{className:`settings-card-list`,children:e.length>0?e.map(e=>{let t=e.manifest.permissions?.length??0,r=ln(e),c=a.filter(t=>t.soulId===e.appId||t.soulId===e.projectedSoul?.id).length,l=e.mountedContribution.apiRoutePrefix,u=e.projectedSoul?.domain??e.manifest.soul?.domain??e.appId,d=(e.manifest.permissions??[]).map(un).filter(dn),m=(e.manifest.connectors?.required??[]).map(e=>({id:e.id,label:o.connectorStatus(e.id,fn(e.id,i,o))})),h=pn(e),g=s===e.appId,_=e.status===`enabled`?o.disableApp(e.manifest.name):o.enableApp(e.manifest.name);return(0,f.jsxs)(`article`,{className:`settings-card-row ${e.status===`enabled`?``:`disabled`}`,children:[(0,f.jsxs)(`div`,{className:`settings-card-mainline`,children:[(0,f.jsxs)(`span`,{children:[(0,f.jsx)(`strong`,{children:e.manifest.name}),(0,f.jsx)(`span`,{children:`${ut(e.status,n)} · ${e.version}`})]}),(0,f.jsx)(Pe,{variant:`ghost`,className:`settings-action-button soul-app-lifecycle-button`,disabled:g,onClick:()=>void p(e),children:(0,f.jsx)(`span`,{children:g?o.updating:_})})]}),(0,f.jsx)(`small`,{children:u}),(0,f.jsxs)(`div`,{className:`settings-card-tags`,children:[(0,f.jsx)(`small`,{children:o.permissionCount(t)}),(0,f.jsx)(`small`,{children:o.templateCount(c)}),(0,f.jsx)(`small`,{children:o.mountedContributionCount(r)})]}),(0,f.jsxs)(`div`,{className:`settings-review-grid`,"aria-label":`${e.manifest.name} security review`,children:[d.length>0?(0,f.jsxs)(`div`,{className:`settings-review-group`,children:[(0,f.jsx)(`span`,{children:o.permissionsTitle}),(0,f.jsx)(`div`,{className:`settings-card-tags`,children:d.slice(0,4).map(e=>(0,f.jsx)(`small`,{children:e},e))})]}):null,m.length>0?(0,f.jsxs)(`div`,{className:`settings-review-group`,children:[(0,f.jsx)(`span`,{children:o.connectorsTitle}),(0,f.jsx)(`div`,{className:`settings-card-tags`,children:m.map(e=>(0,f.jsx)(`small`,{children:e.label},e.id))})]}):null,h.length>0?(0,f.jsxs)(`div`,{className:`settings-review-group`,children:[(0,f.jsx)(`span`,{children:o.descriptorPermissionsTitle}),(0,f.jsx)(`div`,{className:`settings-card-tags`,children:h.slice(0,4).map(e=>(0,f.jsx)(`small`,{children:e},e))})]}):null]}),l?(0,f.jsx)(`small`,{children:o.apiRoute(l)}):null]},e.appId)}):(0,f.jsx)(`div`,{className:`settings-note`,children:o.empty})}),l?(0,f.jsx)(`p`,{className:`settings-note`,role:`alert`,children:l}):null]})}function cn(e){return e.warnings.length>0?e.warnings.join(` `):e.missingRequiredConnectorIds.length>0?`Required connectors are not available: ${e.missingRequiredConnectorIds.join(`, `)}`:`Host security review does not allow enabling this Soul App.`}function ln(e){return e.mountedContribution.artifactPreviewIds.length+e.mountedContribution.panelIds.length+e.mountedContribution.reviewPanelIds.length+e.mountedContribution.workspaceWidgetIds.length}function un(e){return!e.kind||!e.action||!e.target?null:`${e.kind}:${e.action}:${e.target}`}function dn(e){return typeof e==`string`}function fn(e,t,n){let r=t.connectors.find(t=>t.id===e);return r?r.enabled?n.enabledConnector:n.disabledConnector:n.unavailableConnector}function pn(e){let t=new Set,n=e=>{for(let n of e??[])t.add(n)},r=e.manifest.ui?.shell;n(r?.primaryAction?.requiredPermissions);for(let e of r?.actions??[])n(e.requiredPermissions);n(r?.search?.requiredPermissions),n(r?.settings?.requiredPermissions);for(let t of e.manifest.ui?.routes??[])n(t.surface?.requiredPermissions);for(let t of e.manifest.ui?.panels??[])n(t.surface?.requiredPermissions);for(let t of e.manifest.ui?.artifactPreviews??[])n(t.surface?.requiredPermissions);for(let t of e.manifest.ui?.reviewPanels??[])n(t.surface?.requiredPermissions);for(let t of e.manifest.ui?.workspaceWidgets??[])n(t.surface?.requiredPermissions);return[...t]}function mn({copy:e,settings:t,update:n}){let r=e.settings;return(0,f.jsxs)(`div`,{className:`settings-section`,children:[(0,f.jsx)(`div`,{className:`section-head`,children:(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h3`,{children:r.connectors.title}),(0,f.jsx)(`p`,{className:`hint`,children:r.connectors.hint})]})}),(0,f.jsx)(`div`,{className:`connector-list`,children:t.connectors.map(e=>(0,f.jsxs)(`label`,{className:`switch-row`,children:[(0,f.jsxs)(`span`,{children:[(0,f.jsx)(`strong`,{children:e.name}),(0,f.jsx)(`small`,{children:e.status===`configured`?r.connectors.configured:r.connectors.notConfigured})]}),(0,f.jsx)(`input`,{checked:e.enabled,type:`checkbox`,onChange:r=>void n({connectors:t.connectors.map(t=>t.id===e.id?{...t,enabled:r.target.checked,status:r.target.checked?`configured`:`not_configured`}:t)})})]},e.id))})]})}function hn({copy:e,settings:t,update:n}){let r=e.settings;return(0,f.jsxs)(`div`,{className:`settings-section`,children:[(0,f.jsx)(`div`,{className:`section-head`,children:(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h3`,{children:r.localMcp.title}),(0,f.jsx)(`p`,{className:`hint`,children:r.localMcp.hint})]})}),(0,f.jsxs)(`label`,{className:`switch-row`,children:[(0,f.jsxs)(`span`,{children:[(0,f.jsx)(`strong`,{children:r.localMcp.toggle}),(0,f.jsx)(`small`,{children:t.localMcpServer.url})]}),(0,f.jsx)(`input`,{checked:t.localMcpServer.enabled,type:`checkbox`,onChange:e=>void n({localMcpServer:{...t.localMcpServer,enabled:e.target.checked}})})]})]})}function gn({copy:e,settings:t,update:n}){let r=e.settings;return(0,f.jsxs)(`div`,{className:`settings-section`,children:[(0,f.jsx)(`div`,{className:`section-head`,children:(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h3`,{children:r.externalMcp.title}),(0,f.jsx)(`p`,{className:`hint`,children:r.externalMcp.hint})]})}),(0,f.jsx)(`div`,{className:`connector-list`,children:t.externalMcpServers.map(e=>(0,f.jsx)(Ge,{label:e.name,children:(0,f.jsx)(`input`,{value:e.command,onChange:r=>void n({externalMcpServers:t.externalMcpServers.map(t=>t.id===e.id?{...t,command:r.target.value}:t)}),placeholder:r.externalMcp.placeholder})},e.id))})]})}function _n({copy:e,locale:t,update:n}){let r=e.settings;return(0,f.jsxs)(`div`,{className:`settings-section`,children:[(0,f.jsx)(`div`,{className:`section-head`,children:(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h3`,{children:r.language.title}),(0,f.jsx)(`p`,{className:`hint`,children:r.language.hint})]})}),(0,f.jsx)(`div`,{className:`seg-control`,role:`group`,"aria-label":r.language.title,style:{"--seg-cols":4},children:rt.map(r=>(0,f.jsxs)(`button`,{type:`button`,className:`seg-btn ${t===r?`active`:``}`,onClick:()=>void n({language:r}),children:[(0,f.jsx)(`span`,{className:`seg-title`,children:st(r,t)}),(0,f.jsx)(`span`,{className:`seg-meta`,children:e.common.interface})]},r))})]})}function vn({copy:e,settings:t,update:n}){let r=e.settings;return(0,f.jsxs)(`div`,{className:`settings-section`,children:[(0,f.jsx)(`div`,{className:`section-head`,children:(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h3`,{children:r.appearance.title}),(0,f.jsx)(`p`,{className:`hint`,children:r.appearance.hint})]})}),(0,f.jsxs)(`div`,{className:`seg-control`,role:`group`,"aria-label":r.appearance.title,style:{"--seg-cols":3},children:[(0,f.jsx)(yn,{active:t.appearance===`system`,icon:(0,f.jsx)(Te,{size:14}),label:r.appearance.system,meta:e.common.workspace,onClick:()=>void n({appearance:`system`})}),(0,f.jsx)(yn,{active:t.appearance===`light`,icon:(0,f.jsx)(ke,{size:14}),label:r.appearance.light,meta:e.common.workspace,onClick:()=>void n({appearance:`light`})}),(0,f.jsx)(yn,{active:t.appearance===`dark`,icon:(0,f.jsx)(ve,{size:14}),label:r.appearance.dark,meta:e.common.workspace,onClick:()=>void n({appearance:`dark`})})]})]})}function yn({active:e,icon:t,label:n,meta:r,onClick:i}){return(0,f.jsxs)(Pe,{className:`seg-btn ${e?`active`:``}`,onClick:i,children:[(0,f.jsxs)(`span`,{className:`seg-title seg-title-inline`,children:[t,n]}),(0,f.jsx)(`span`,{className:`seg-meta`,children:r})]})}function bn(e,t){return t===`execution`?{title:e.execution,detail:e.executionDetail}:t===`soul-packs`?{title:e.soulPacks,detail:e.soulPacksDetail}:t===`connectors`?{title:e.connectors,detail:e.connectorsDetail}:t===`mcp`?{title:e.localMcp,detail:e.localMcpDetail}:t===`external-mcp`?{title:e.externalMcp,detail:e.externalMcpDetail}:t===`language`?{title:e.language,detail:e.languageDetail}:t===`appearance`?{title:e.appearance,detail:e.appearanceDetail}:{title:e.about,detail:e.aboutDetail}}function xn(e,t){return e===`saving`?t.autosave.saving:e===`failed`?t.autosave.failed:t.autosave.saved}function Sn(e){return e===`saving`?`is-saving`:e===`failed`?`is-failed`:`is-saved`}var Cn=`(prefers-color-scheme: dark)`;function wn(){return(0,u.useSyncExternalStore)(Tn,En,()=>`light`)}function Tn(e){if(typeof window>`u`||typeof window.matchMedia!=`function`)return()=>{};let t=window.matchMedia(Cn);return typeof t.addEventListener==`function`?(t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)):(t.addListener(e),()=>t.removeListener(e))}function En(){return typeof window>`u`||typeof window.matchMedia!=`function`?`light`:window.matchMedia(Cn).matches?`dark`:`light`}function Dn(e,t){return e===`system`?t:e}function On({className:e=``,compact:t=!1,progress:n}){return(0,f.jsxs)(`section`,{"aria-live":n.live?`polite`:void 0,className:`session-progress-card ${t?`compact`:``} ${e}`.trim(),"data-stage":n.stage,"data-tone":n.tone,children:[(0,f.jsxs)(`div`,{className:`session-progress-head`,children:[(0,f.jsx)(`span`,{className:`session-progress-dot`,"aria-hidden":`true`}),(0,f.jsx)(`span`,{className:`session-progress-label`,children:n.label})]}),(0,f.jsx)(`strong`,{children:n.title}),(0,f.jsx)(`span`,{className:`session-progress-detail`,children:n.detail})]})}function kn({copy:e,engineReadiness:t,events:n,locale:r,detailDrawerOpen:i,onOpenSettings:a,onRefresh:o,onToggleDetailDrawer:s,onSubmitTurn:c,onTurnInputChange:l,progress:d,session:p,template:m,turnInput:h,turnSubmitting:g,turns:_,workspace:v}){let y=(0,u.useRef)(null),b=(0,u.useRef)(!1),x=(0,u.useRef)(!0),[ee,S]=(0,u.useState)(!1),te=m?lt(m,r):null,ne=(0,u.useMemo)(()=>[..._].sort((e,t)=>e.seq-t.seq),[_]),re=(0,u.useMemo)(()=>[...n].sort((e,t)=>e.seq-t.seq),[n]);(0,u.useEffect)(()=>{b.current=!1,x.current=!0},[p.id]),(0,u.useEffect)(()=>{let e=y.current;!e||b.current||ne.length===0&&re.length===0||(b.current=!0,requestAnimationFrame(()=>{e.scrollTop=e.scrollHeight,x.current=!0,S(!1)}))},[p.id,re.length,ne.length]),(0,u.useEffect)(()=>{let e=y.current;e&&x.current&&requestAnimationFrame(()=>{e.scrollTop=e.scrollHeight,S(!1)})},[re,ne,g]),(0,u.useEffect)(()=>{let e=y.current;if(!e)return;let t=()=>{let e=y.current;if(!e)return;let t=e.scrollHeight-e.scrollTop-e.clientHeight;x.current=t<80,S(t>140)};return e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)},[]);function ie(){let e=y.current;e&&(x.current=!0,e.scrollTo({behavior:`smooth`,top:e.scrollHeight}),S(!1))}return(0,f.jsxs)(`section`,{className:`worker-chat-pane`,"aria-label":e.workspace.sessionDetail,children:[(0,f.jsxs)(`header`,{className:`worker-chat-header`,children:[(0,f.jsxs)(`div`,{className:`worker-chat-title`,children:[(0,f.jsx)(`span`,{className:`kicker`,children:e.workspace.selectedWorkspace}),(0,f.jsx)(`h1`,{children:v.name}),(0,f.jsxs)(`div`,{className:`worker-chat-meta`,children:[(0,f.jsx)(`span`,{children:te?.name??p.capabilityTemplateId}),(0,f.jsx)(`span`,{children:ut(p.status,r)}),(0,f.jsx)(`span`,{children:e.workspace.updated(N(p.updatedAt,r))})]}),(0,f.jsx)(On,{compact:!0,className:`worker-chat-progress`,progress:d})]}),(0,f.jsxs)(`div`,{className:`worker-chat-actions`,children:[(0,f.jsx)(Fe,{"aria-label":e.accessibility.refreshWorkspace,onClick:o,children:(0,f.jsx)(Se,{"aria-hidden":`true`,size:16})}),(0,f.jsx)(Fe,{"aria-label":e.accessibility.openSettings,onClick:a,children:(0,f.jsx)(Te,{"aria-hidden":`true`,size:16})}),(0,f.jsx)(Fe,{"aria-label":i?e.accessibility.collapseSessionDetail:e.accessibility.expandSessionDetail,"aria-pressed":i,className:i?`session-detail-toggle active`:`session-detail-toggle`,title:i?e.accessibility.collapseSessionDetail:e.accessibility.expandSessionDetail,onClick:s,children:i?(0,f.jsx)(ye,{"aria-hidden":`true`,size:16}):(0,f.jsx)(be,{"aria-hidden":`true`,size:16})})]})]}),(0,f.jsxs)(`div`,{className:`worker-chat-log-wrap`,children:[(0,f.jsxs)(`div`,{ref:y,className:`worker-chat-log`,"data-testid":`worker-chat-log`,children:[ne.length>0?ne.map(t=>{let n=re.filter(e=>e.turnId===t.id);return(0,f.jsxs)(u.Fragment,{children:[(0,f.jsx)(An,{copy:e,turn:t,locale:r}),(0,f.jsx)(jn,{copy:e,events:n,locale:r,turn:t,turnSubmitting:g&&t.status===`running`})]},t.id)}):(0,f.jsxs)(`div`,{className:`worker-chat-empty`,children:[(0,f.jsx)(_e,{"aria-hidden":`true`,size:24}),(0,f.jsx)(`strong`,{children:e.workspace.noTurns}),(0,f.jsx)(`span`,{children:t.detail})]}),g&&ne.every(e=>e.status!==`running`)?(0,f.jsx)(Mn,{detail:t.detail,role:e.workspace.engineRole}):null]}),ee?(0,f.jsxs)(`button`,{type:`button`,className:`worker-chat-jump`,onClick:ie,children:[(0,f.jsx)(ae,{"aria-hidden":`true`,size:14}),(0,f.jsx)(`span`,{children:e.workspace.latest})]}):null]}),(0,f.jsxs)(`form`,{className:`worker-composer`,onSubmit:c,children:[(0,f.jsx)(`button`,{type:`button`,className:`worker-composer-tool`,"aria-label":e.accessibility.openSettings,onClick:a,children:(0,f.jsx)(Te,{"aria-hidden":`true`,size:15})}),(0,f.jsx)(`textarea`,{"aria-label":e.workspace.followUpInput,disabled:!t.ready||g,placeholder:e.workspace.followUpPlaceholder,rows:3,value:h,onChange:e=>l(e.target.value)}),(0,f.jsxs)(`button`,{className:`primary worker-composer-send`,type:`submit`,disabled:!h.trim()||g||!t.ready,children:[(0,f.jsx)(we,{"aria-hidden":`true`,size:14}),(0,f.jsx)(`span`,{children:g?e.workspace.sendingTurn:e.workspace.sendTurn})]})]})]})}function An({copy:e,locale:t,turn:n}){return(0,f.jsxs)(`article`,{className:`worker-message user`,children:[(0,f.jsxs)(`div`,{className:`worker-message-role`,children:[(0,f.jsx)(`span`,{children:e.workspace.operatorRole}),(0,f.jsx)(`time`,{children:N(n.createdAt,t)})]}),(0,f.jsx)(`div`,{className:`worker-user-bubble`,children:n.input})]})}function jn({copy:e,events:t,locale:n,turn:r,turnSubmitting:i}){let a=Ln(t.map(e=>({event:In(e),key:String(e.id)})));a.length===0&&r.response&&a.push({event:{kind:`text`,text:r.response},key:`response-${r.id}`});let o=new Map;for(let{event:e}of a)e.kind===`tool_result`&&o.set(e.id,e);return(0,f.jsxs)(`article`,{className:`worker-message assistant`,children:[(0,f.jsxs)(`div`,{className:`worker-message-role`,children:[(0,f.jsx)(`span`,{children:e.workspace.engineRole}),(0,f.jsx)(`time`,{children:ut(r.status,n)})]}),(0,f.jsxs)(`div`,{className:`worker-assistant-flow`,children:[a.length===0&&(r.status===`running`||i)?(0,f.jsx)(Nn,{detail:e.workspace.engineStarting}):null,a.map(({event:e,key:t})=>e.kind===`tool_result`?null:e.kind===`tool_use`?(0,f.jsx)(Fn,{result:o.get(e.id),tool:e},t):(0,f.jsx)(Pn,{event:e},t)),r.error?(0,f.jsx)(Pn,{event:{kind:`error`,message:r.error}}):null]})]})}function Mn({detail:e,role:t}){return(0,f.jsxs)(`article`,{className:`worker-message assistant`,children:[(0,f.jsx)(`div`,{className:`worker-message-role`,children:(0,f.jsx)(`span`,{children:t})}),(0,f.jsx)(`div`,{className:`worker-assistant-flow`,children:(0,f.jsx)(Nn,{detail:e})})]})}function Nn({detail:e}){return(0,f.jsx)(Ve,{active:!0,className:`worker-status-pill`,children:e})}function Pn({event:e}){return e.kind===`text`?(0,f.jsx)(`div`,{className:`worker-prose`,children:e.text}):e.kind===`thinking`?(0,f.jsx)(`pre`,{className:`worker-log thinking`,children:e.text}):e.kind===`log`?(0,f.jsxs)(`details`,{className:`worker-log-card`,children:[(0,f.jsxs)(`summary`,{children:[(0,f.jsx)(Ae,{"aria-hidden":`true`,size:14}),(0,f.jsx)(`span`,{children:e.stream})]}),(0,f.jsx)(`pre`,{children:e.chunk})]}):e.kind===`raw`?(0,f.jsxs)(`details`,{className:`worker-log-card`,children:[(0,f.jsxs)(`summary`,{children:[(0,f.jsx)(Ae,{"aria-hidden":`true`,size:14}),(0,f.jsx)(`span`,{children:`raw`})]}),(0,f.jsx)(`pre`,{children:e.line})]}):e.kind===`status`?(0,f.jsx)(Ve,{active:!0,className:`worker-status-pill`,detail:e.detail,children:e.label}):e.kind===`usage`?(0,f.jsxs)(Be,{className:`worker-status-pill`,icon:(0,f.jsx)(w,{size:14}),children:[(0,f.jsx)(`span`,{children:`Usage`}),(0,f.jsx)(`small`,{children:[e.inputTokens,e.outputTokens].filter(e=>e!=null).join(` / `)})]}):e.kind===`artifact`||e.kind===`review`||e.kind===`lesson`?(0,f.jsxs)(Be,{className:`worker-produced-chip`,icon:(0,f.jsx)(me,{size:14}),children:[(0,f.jsx)(`span`,{children:e.kind}),(0,f.jsx)(`small`,{children:e.detail})]}):e.kind===`error`?(0,f.jsxs)(`div`,{className:`worker-error-card`,role:`alert`,children:[(0,f.jsx)(de,{"aria-hidden":`true`,size:15}),(0,f.jsx)(`span`,{children:e.message})]}):null}function Fn({result:e,tool:t}){let n=Vn(t.input)?t.input:{},r=typeof n.command==`string`?n.command:``,i=typeof n.description==`string`?n.description:t.name;return(0,f.jsxs)(`details`,{className:`worker-tool-card`,open:!e?.content,children:[(0,f.jsxs)(`summary`,{children:[(0,f.jsx)(`span`,{className:`worker-tool-icon`,children:(0,f.jsx)(je,{"aria-hidden":`true`,size:14})}),(0,f.jsx)(`span`,{children:t.name}),(0,f.jsx)(`small`,{children:i}),e?(0,f.jsx)(`span`,{className:`worker-tool-result ${e.isError?`failed`:`ok`}`,children:e.isError?`failed`:`done`}):null]}),r?(0,f.jsx)(`pre`,{className:`worker-tool-command`,children:r}):null,e?.content?(0,f.jsx)(`pre`,{className:`worker-tool-output`,children:e.content}):null]})}function In(e){let t=e.payloadJson,n=Vn(t.agentEvent)?t.agentEvent:null;if(n&&typeof n.kind==`string`){let t=n.kind;if(t===`status`)return{detail:zn(n.detail),kind:t,label:zn(n.label,e.type)};if(t===`text`||t===`thinking`)return{kind:t,text:zn(n.text)};if(t===`log`)return{chunk:zn(n.chunk),kind:t,stream:n.stream===`stderr`?`stderr`:`stdout`};if(t===`tool_use`)return{id:zn(n.id,String(e.id)),input:n.input,kind:t,name:zn(n.name,`Tool`)};if(t===`tool_result`)return{content:zn(n.content),id:zn(n.id??n.toolUseId,String(e.id)),isError:n.isError===!0,kind:t,name:zn(n.name)};if(t===`usage`)return{costUsd:Bn(n.costUsd),inputTokens:Bn(n.inputTokens),kind:t,outputTokens:Bn(n.outputTokens)};if(t===`raw`)return{kind:t,line:zn(n.line)}}return e.type===`assistant_delta`?{kind:`text`,text:zn(t.text??t.delta)}:e.type===`artifact`?{detail:zn(t.path??t.artifactId,`artifact`),kind:`artifact`}:e.type===`review`?{detail:zn(t.verdict??t.reviewId,`review`),kind:`review`}:e.type===`lesson`?{detail:zn(t.lessonId,`memory candidate`),kind:`lesson`}:e.type===`error`?{kind:`error`,message:zn(t.message,`Session turn failed.`)}:e.type===`log`?{chunk:JSON.stringify(t,null,2),kind:`log`,stream:`stdout`}:{detail:zn(t.status,e.type),kind:`status`,label:e.type}}function Ln(e){let t=[];for(let n of e){let e=t.at(-1);if(n.event.kind===`text`&&e?.event.kind===`text`){e.event={...e.event,text:`${e.event.text}${n.event.text}`};continue}if(n.event.kind===`thinking`&&e?.event.kind===`thinking`){e.event={...e.event,text:Rn(`${e.event.text}${n.event.text}`)};continue}if(n.event.kind===`log`&&e?.event.kind===`log`&&e.event.stream===n.event.stream){e.event={...e.event,chunk:Rn(`${e.event.chunk}${n.event.chunk}`)};continue}t.push(n.event.kind===`log`?{event:{...n.event,chunk:Rn(n.event.chunk)},key:n.key}:n)}return t}function Rn(e){let t=12e3;return e.length<=t?e:`${e.slice(0,t)}\n...[truncated]`}function zn(e,t=``){return typeof e==`string`&&e.trim().length>0?e:t}function Bn(e){return typeof e==`number`&&Number.isFinite(e)?e:void 0}function Vn(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Hn({artifact:e,artifactCopy:t,artifactPreview:n,artifacts:r,collapsed:i=!1,copy:a,engineReadiness:o,events:s,lessonBusyId:c,lessons:l,locale:u,onLessonStatus:d,onReview:p,onSubmitTurn:m,onTurnInputChange:h,progress:g,review:_,reviewSubmitting:v,reviews:y,session:b,mode:x=`full`,template:ee,turnInput:S,turnSubmitting:te,turns:ne,workspace:re}){let ie=ee?lt(ee,u):null,C=s.slice(-6).reverse();return i?(0,f.jsx)(`aside`,{className:`artifact-rail session-panel collapsed`,"aria-hidden":`true`}):(0,f.jsxs)(`aside`,{className:`artifact-rail session-panel`,"aria-label":a.accessibility.businessArtifactPreview,children:[(0,f.jsx)(`header`,{className:`artifact-rail-head`,children:(0,f.jsxs)(`div`,{className:`artifact-rail-title`,children:[(0,f.jsx)(_e,{"aria-hidden":`true`,size:14}),(0,f.jsx)(`strong`,{children:a.workspace.sessionDetail})]})}),re&&b?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`section`,{className:`session-summary`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`span`,{className:`kicker`,children:a.workspace.selectedWorkspace}),(0,f.jsx)(`h2`,{children:re.name})]}),(0,f.jsx)(Ve,{active:!0,className:`artifact-rail-status-pill`,icon:(0,f.jsx)(T,{size:10}),children:ut(b.status,u)})]}),(0,f.jsxs)(`section`,{className:`rail-metadata`,children:[(0,f.jsx)(`strong`,{children:ie?.name??b.capabilityTemplateId}),(0,f.jsx)(`small`,{children:ie?.outputKind??b.capabilityTemplateId}),(0,f.jsx)(`small`,{children:a.workspace.updated(N(b.updatedAt,u))})]}),g?(0,f.jsx)(On,{compact:!0,className:`artifact-session-progress`,progress:g}):null,x===`full`?(0,f.jsxs)(`section`,{className:`turn-composer`,children:[(0,f.jsx)(Re,{className:`section-head compact`,title:a.workspace.continueSession,description:o.detail}),(0,f.jsxs)(`form`,{onSubmit:m,children:[(0,f.jsx)(`textarea`,{"aria-label":a.workspace.followUpInput,placeholder:a.workspace.followUpPlaceholder,value:S,onChange:e=>h(e.target.value)}),(0,f.jsxs)(`button`,{className:`primary`,type:`submit`,disabled:!S.trim()||te||!o.ready,children:[(0,f.jsx)(we,{"aria-hidden":`true`,size:13}),(0,f.jsx)(`span`,{children:te?a.workspace.sendingTurn:a.workspace.sendTurn})]})]})]}):null,(0,f.jsxs)(`section`,{className:`artifact-panel`,children:[(0,f.jsx)(Re,{className:`artifact-section-head`,icon:(0,f.jsx)(pe,{size:14}),title:a.artifact.label,description:a.workspace.artifactCount(r.length)}),e?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`div`,{className:`rail-metadata`,children:[(0,f.jsx)(`strong`,{children:t?.name??e.title}),(0,f.jsx)(`small`,{children:t?.outputKind??e.kind}),(0,f.jsx)(`small`,{children:e.path})]}),n.loading?(0,f.jsx)(`div`,{className:`artifact-preview-state`,children:a.artifact.loading}):null,n.error?(0,f.jsx)(`div`,{className:`artifact-preview-state`,role:`alert`,children:n.error}):null,!n.loading&&!n.error?(0,f.jsx)(`pre`,{className:`artifact-preview`,children:n.content}):null]}):(0,f.jsx)(`div`,{className:`artifact-preview-state`,children:g?.previewDetail??a.artifact.empty})]}),x===`full`?(0,f.jsxs)(`details`,{className:`session-subpanel compact-details`,children:[(0,f.jsxs)(`summary`,{className:`artifact-section-head`,children:[(0,f.jsx)(`span`,{className:`artifact-summary-icon`,"aria-hidden":`true`,children:(0,f.jsx)(_e,{size:14})}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`strong`,{children:a.workspace.turnHistory}),(0,f.jsx)(`small`,{children:a.workspace.turnCount(ne.length)})]})]}),ne.length>0?(0,f.jsx)(`div`,{className:`turn-list`,children:ne.map(e=>(0,f.jsx)(He,{className:`turn-row`,title:ut(e.status,u),detail:e.input,meta:e.seq,children:e.error?(0,f.jsx)(`small`,{className:`danger-text`,children:e.error}):null},e.id))}):(0,f.jsx)(`div`,{className:`artifact-preview-state`,children:a.workspace.noTurns})]}):null,(0,f.jsxs)(`section`,{className:`session-subpanel`,children:[(0,f.jsx)(Re,{className:`artifact-section-head`,icon:(0,f.jsx)(fe,{size:14}),title:a.artifact.review,description:_?dt(_.verdict,u):a.artifact.reviewCount(y.length)}),_?(0,f.jsx)(`div`,{className:`review-list`,children:Un(_).map(e=>(0,f.jsx)(`span`,{children:e},e))}):e?(0,f.jsxs)(`button`,{type:`button`,className:`ghost review-action`,disabled:v,onClick:p,children:[(0,f.jsx)(fe,{"aria-hidden":`true`,size:13}),(0,f.jsx)(`span`,{children:v?a.workspace.requestingReview:a.workspace.requestReview})]}):(0,f.jsx)(`div`,{className:`artifact-preview-state`,children:a.workspace.reviewWaiting})]}),(0,f.jsxs)(`section`,{className:`session-subpanel memory-subpanel`,children:[(0,f.jsx)(Re,{className:`artifact-section-head`,icon:(0,f.jsx)(Oe,{size:14}),title:a.workspace.memoryCandidates,description:a.artifact.memoryCandidates(l.length)}),l.length>0?(0,f.jsx)(`div`,{className:`memory-list`,children:l.map(e=>(0,f.jsxs)(`article`,{className:`memory-row`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`strong`,{children:Wn(e.status,a)}),(0,f.jsx)(`span`,{children:e.statement})]}),(0,f.jsxs)(`div`,{className:`memory-actions`,children:[(0,f.jsx)(`button`,{type:`button`,className:`ghost`,disabled:c===e.id||e.status===`accepted`,onClick:()=>d(e,`accepted`),children:a.workspace.accept}),(0,f.jsx)(`button`,{type:`button`,className:`ghost`,disabled:c===e.id||e.status===`rejected`,onClick:()=>d(e,`rejected`),children:a.workspace.reject})]})]},e.id))}):(0,f.jsx)(`div`,{className:`artifact-preview-state`,children:a.workspace.noMemoryCandidates})]}),(0,f.jsxs)(`details`,{className:`session-subpanel compact-details`,children:[(0,f.jsxs)(`summary`,{className:`artifact-section-head`,children:[(0,f.jsx)(`span`,{className:`artifact-summary-icon`,"aria-hidden":`true`,children:(0,f.jsx)(Ae,{size:14})}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`strong`,{children:a.workspace.eventStream}),(0,f.jsx)(`small`,{children:a.workspace.eventCount(s.length)})]})]}),C.length>0?(0,f.jsx)(`div`,{className:`event-list`,children:C.map(e=>(0,f.jsx)(He,{className:`event-row`,title:e.type,meta:N(e.createdAt,u)},e.id))}):(0,f.jsx)(`div`,{className:`artifact-preview-state`,children:a.workspace.noEvents})]})]}):(0,f.jsx)(ze,{className:`empty-session-state`,icon:(0,f.jsx)(me,{size:22}),title:a.workspace.noSelectionTitle,detail:a.workspace.noSelectionDetail})]})}function Un(e){let t=e.findingsJson.map(e=>String(e.message??e.summary??JSON.stringify(e))),n=e.risksJson.map(e=>String(e.message??e.summary??JSON.stringify(e)));return[...t,...n].filter(Boolean)}function Wn(e,t){return e===`accepted`?t.workspace.accepted:e===`rejected`?t.workspace.rejected:t.workspace.proposed}function Gn({artifact:e,events:t,locale:n,review:r,session:i,turns:a}){let o=qn(n),s=!!e,c=a.some(e=>e.status===`queued`||e.status===`running`),l=a.some(e=>e.status===`failed`),u=a.some(e=>e.status===`cancelled`);return i.status===`failed`||l||i.status===`cancelled`||u?o.failed:s?r?.verdict===`pass`||r?.verdict===`warn`?o.reviewed:r?.verdict===`fail`?o.review_failed:o.review_ready:Kn(t)?o.artifact_finalizing:c||i.status===`active`&&a.length===0?o.engine_running:o.empty}function Kn(e){return e.some(e=>{let t=e.payloadJson,n=Yn(t.agentEvent)?t.agentEvent:null,r=Jn(n?.label??t.label),i=Jn(n?.status??t.status),a=Jn(n?.detail??t.detail??t.path),o=Jn(t.path),s=e.type===`file_change`||r===`file_change`,c=/(?:^|\/)artifacts\//i.test(a)||/(?:^|\/)artifacts\//i.test(o),l=/\bcompleted\b/i.test(a)||i===`completed`||i===`succeeded`;return s&&c&&l})}function qn(e){return e===`zh-CN`?{artifact_finalizing:{detail:`Engine 已写入产物文件;AIWorker 正在结束 session,并把文件归集到产物预览。`,label:`产物文件`,live:!0,previewDetail:`产物文件已经写入,预览会在 session 完成归集后出现。`,stage:`artifact_finalizing`,title:`文件已写入,正在归集`,tone:`finalizing`},empty:{detail:`当前 session 还没有可 review 的产物。`,label:`产物`,live:!1,previewDetail:`暂无产物预览。`,stage:`empty`,title:`等待产物`,tone:`muted`},engine_running:{detail:`Agent 正在生成可 review 产物;事件流会继续更新。`,label:`引擎`,live:!0,previewDetail:`产物预览会在第一个 artifact 进入索引后解锁。`,stage:`engine_running`,title:`Agent 正在生成`,tone:`working`},failed:{detail:`Session 或 turn 已失败,需要查看事件流或重新发起。`,label:`异常`,live:!1,previewDetail:`当前 session 未生成可用产物。`,stage:`failed`,title:`需要处理`,tone:`risk`},review_failed:{detail:`人工 review 已发现风险;修订产物后再进入 lesson 或 memory。`,label:`Review`,live:!1,previewDetail:`产物已归集,但 review 未通过。`,stage:`review_failed`,title:`Review 未通过`,tone:`risk`},review_ready:{detail:`产物已进入索引;进入 lesson 或 memory 前必须由人类 review。`,label:`Review`,live:!1,previewDetail:`产物已可预览,请完成人工 review。`,stage:`review_ready`,title:`产物已就绪,等待人工 review`,tone:`ready`},reviewed:{detail:`已有人工 review 记录;lesson 或 memory 沉淀仍需要显式接受。`,label:`Review`,live:!1,previewDetail:`产物已 review,可继续处理 lesson 候选。`,stage:`reviewed`,title:`Review 已记录`,tone:`reviewed`}}:e===`ja`?{artifact_finalizing:{detail:`エンジンは成果物ファイルを書き込み済みです。AIWorker がセッションを完了し、プレビュー索引へ反映しています。`,label:`Artifact file`,live:!0,previewDetail:`成果物ファイルは書き込み済みで、索引完了後にここへ表示されます。`,stage:`artifact_finalizing`,title:`ファイル書き込み済み、索引中`,tone:`finalizing`},empty:{detail:`このセッションにはまだレビュー可能な成果物がありません。`,label:`Artifact`,live:!1,previewDetail:`成果物プレビューはまだありません。`,stage:`empty`,title:`成果物待ち`,tone:`muted`},engine_running:{detail:`Agent がレビュー可能な成果物を生成しています。イベントストリームは更新され続けます。`,label:`Engine`,live:!0,previewDetail:`最初の artifact が索引化されるとプレビューが表示されます。`,stage:`engine_running`,title:`Agent 生成中`,tone:`working`},failed:{detail:`セッションまたは turn が失敗しました。イベントストリームを確認して再実行してください。`,label:`Issue`,live:!1,previewDetail:`このセッションには利用可能な成果物がありません。`,stage:`failed`,title:`対応が必要`,tone:`risk`},review_failed:{detail:`人間の review がリスクを検出しました。lesson や memory の前に成果物を修正してください。`,label:`Review`,live:!1,previewDetail:`成果物は索引済みですが、review は未通過です。`,stage:`review_failed`,title:`Review failed`,tone:`risk`},review_ready:{detail:`成果物は索引済みです。lesson や memory へ進む前に人間の review が必要です。`,label:`Review`,live:!1,previewDetail:`成果物をプレビューできます。人間の review を完了してください。`,stage:`review_ready`,title:`Review 待ち成果物`,tone:`ready`},reviewed:{detail:`人間の review 記録があります。lesson や memory への反映は明示的な承認が必要です。`,label:`Review`,live:!1,previewDetail:`成果物は review 済みです。lesson 候補を処理できます。`,stage:`reviewed`,title:`Review recorded`,tone:`reviewed`}}:e===`de`?{artifact_finalizing:{detail:`Die Engine hat die Artefaktdatei geschrieben. AIWorker schliesst die Session ab und indexiert sie fuer die Vorschau.`,label:`Artifact file`,live:!0,previewDetail:`Die Artefaktdatei ist geschrieben und erscheint nach der Indexierung hier.`,stage:`artifact_finalizing`,title:`Datei geschrieben, Indexierung laeuft`,tone:`finalizing`},empty:{detail:`Diese Session hat noch kein review-faehiges Artefakt.`,label:`Artifact`,live:!1,previewDetail:`Noch keine Artefaktvorschau.`,stage:`empty`,title:`Wartet auf Artefakt`,tone:`muted`},engine_running:{detail:`Der Agent erzeugt ein review-faehiges Artefakt. Der Event-Stream wird weiter aktualisiert.`,label:`Engine`,live:!0,previewDetail:`Die Vorschau wird sichtbar, sobald das erste Artifact indexiert ist.`,stage:`engine_running`,title:`Agent generiert`,tone:`working`},failed:{detail:`Session oder Turn ist fehlgeschlagen. Pruefe den Event-Stream oder starte erneut.`,label:`Issue`,live:!1,previewDetail:`Diese Session hat kein nutzbares Artefakt erzeugt.`,stage:`failed`,title:`Handlung noetig`,tone:`risk`},review_failed:{detail:`Human Review hat Risiken gefunden. Ueberarbeite das Artefakt vor Lesson oder Memory.`,label:`Review`,live:!1,previewDetail:`Das Artefakt ist indexiert, aber Review ist fehlgeschlagen.`,stage:`review_failed`,title:`Review failed`,tone:`risk`},review_ready:{detail:`Das Artefakt ist indexiert. Vor Lesson oder Memory ist Human Review erforderlich.`,label:`Review`,live:!1,previewDetail:`Das Artefakt ist sichtbar. Bitte Human Review abschliessen.`,stage:`review_ready`,title:`Artefakt bereit fuer Review`,tone:`ready`},reviewed:{detail:`Human Review liegt vor. Lesson oder Memory brauchen weiterhin explizite Annahme.`,label:`Review`,live:!1,previewDetail:`Das Artefakt ist reviewed; Lesson-Kandidaten koennen bearbeitet werden.`,stage:`reviewed`,title:`Review recorded`,tone:`reviewed`}}:{artifact_finalizing:{detail:`The engine wrote an artifact file. AIWorker is finalizing the session before it appears in the artifact preview.`,label:`Artifact file`,live:!0,previewDetail:`The artifact file is written and will appear here after session finalization.`,stage:`artifact_finalizing`,title:`File written, indexing`,tone:`finalizing`},empty:{detail:`This session does not have a reviewable artifact yet.`,label:`Artifact`,live:!1,previewDetail:`No artifact preview yet.`,stage:`empty`,title:`Waiting for artifact`,tone:`muted`},engine_running:{detail:`The agent is generating a reviewable artifact. Streamed events will keep updating.`,label:`Engine`,live:!0,previewDetail:`The preview will unlock after the first artifact enters the index.`,stage:`engine_running`,title:`Agent is generating`,tone:`working`},failed:{detail:`The session or turn failed. Check the event stream or start a new turn.`,label:`Issue`,live:!1,previewDetail:`This session did not produce a usable artifact.`,stage:`failed`,title:`Needs attention`,tone:`risk`},review_failed:{detail:`Human review found risks. Revise the artifact before lesson or memory promotion.`,label:`Review`,live:!1,previewDetail:`The artifact is indexed, but review did not pass.`,stage:`review_failed`,title:`Review failed`,tone:`risk`},review_ready:{detail:`The artifact is indexed. Human review is required before lesson or memory promotion.`,label:`Review`,live:!1,previewDetail:`The artifact is visible. Complete human review before promoting it.`,stage:`review_ready`,title:`Artifact ready for review`,tone:`ready`},reviewed:{detail:`A human review exists. Lessons or memory still require explicit acceptance.`,label:`Review`,live:!1,previewDetail:`The artifact is reviewed and lesson candidates can be handled.`,stage:`reviewed`,title:`Review recorded`,tone:`reviewed`}}}function Jn(e){return typeof e==`string`?e:``}function Yn(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Xn=`modulepreload`,Zn=function(e){return`/`+e},Qn={},$n=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}))))}r=o(t.map(t=>{if(t=Zn(t,n),t in Qn)return;Qn[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:Xn,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.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)})},er={"hr-people-workbench":(0,u.lazy)(()=>$n(()=>import(`./people-workbench-CuoxRrll.js`).then(e=>({default:e.HrPeopleWorkbench})),__vite__mapDeps([0,1])))};function tr({context:e}){let t=er[e.workbench.id];return t?(0,f.jsx)(u.Suspense,{fallback:null,children:(0,f.jsx)(t,{context:e})}):null}var nr=new Set([`hr-people-workbench`]);function rr(e){return!!(e&&nr.has(e.id))}var ir=`aiworker-hr`,ar={artifactId:null,content:``,error:null,loading:!1},or={content:``,error:null,loading:!1,workspaceId:null};function sr(e,t){switch(t.type){case`idle`:return ar;case`loading`:return{artifactId:t.artifactId,content:``,error:null,loading:!0};case`loaded`:return{artifactId:t.artifactId,content:t.content,error:null,loading:!1};case`failed`:return{artifactId:t.artifactId,content:``,error:t.error,loading:!1}}}function cr(e,t){switch(t.type){case`idle`:return or;case`loading`:return{content:``,error:null,loading:!0,workspaceId:t.workspaceId};case`loaded`:return{content:t.content,error:null,loading:!1,workspaceId:t.workspaceId};case`failed`:return{content:``,error:t.error,loading:!1,workspaceId:t.workspaceId}}}function lr(e,t){switch(t.type){case`idle`:return{error:null,items:[],loading:!1,query:t.query};case`loading`:return{...e,error:null,loading:!0,query:t.query};case`loaded`:return{error:null,items:t.items,loading:!1,query:t.query};case`failed`:return{error:t.error,items:[],loading:!1,query:t.query}}}function ur(){let e=Ze(),[t,n]=(0,u.useState)({data:null,error:null,loading:!0}),[r,i]=(0,u.useState)(null),[a,o]=(0,u.useState)(``),[s,c]=(0,u.useState)(ir),[l,d]=(0,u.useState)(`person-profile`),[p,h]=(0,u.useState)(null),[g,_]=(0,u.useState)(``),[y,b]=(0,u.useState)(``),[x,ee]=(0,u.useState)(``),[S,te]=(0,u.useState)(!1),[ne,re]=(0,u.useState)(!1),[ie,C]=(0,u.useState)(()=>new Set),[ae,se]=(0,u.useState)(!1),[ce,de]=(0,u.useState)(!1),[w,T]=(0,u.useState)(`execution`),[fe,pe]=(0,u.useState)(!1),[he,E]=(0,u.useState)({sessionId:null,value:``}),[_e,ve]=(0,u.useState)(!1),[ye,be]=(0,u.useState)(!1),[we,Ee]=(0,u.useState)(!1),[De,Oe]=(0,u.useState)(null),[ke,Ae]=(0,u.useState)({busyActionId:null,error:null}),[je,Me]=(0,u.useReducer)(lr,{error:null,items:[],loading:!1,query:``}),[Ne,Pe]=(0,u.useState)([]),[Ie,Le]=(0,u.useState)([]),[Be,Ve]=(0,u.useState)([]),[He,Ue]=(0,u.useState)(null),[We,Ge]=(0,u.useReducer)(sr,ar),[Ke,qe]=(0,u.useReducer)(cr,or),D=(0,u.useCallback)(async()=>{n(e=>({...e,loading:!0,error:null}));try{n({data:await Et(),error:null,loading:!1})}catch(e){n({data:null,error:e instanceof Error?e.message:String(e),loading:!1})}},[]);(0,u.useEffect)(()=>{D()},[D]);let O=t.data,k=at(O?.settings.language),A=ot(k),j=(0,u.useMemo)(()=>{let e=new Map;for(let t of O?.sessions??[])e.set(t.id,t);for(let t of Ie)e.set(t.id,t);return[...e.values()]},[O?.sessions,Ie]),Qe=e.kind===`workspace`||e.kind===`session`?O?.workspaces.find(t=>t.id===e.workspaceId)??null:null,$e=e.kind===`worker`?O?.workers.find(t=>t.id===e.workerId)??null:Qe?O?.workers.find(e=>e.id===Qe.workerId)??null:null,et=(0,u.useMemo)(()=>{if(!O)return[];let e=new Set(O.souls.filter(e=>e.status===`available`).map(e=>e.id)),t=new Set(O.templates.map(e=>e.soulId));return O.workers.filter(n=>e.has(n.soulId)&&t.has(n.soulId))},[O]),M=($e&&et.some(e=>e.id===$e.id)?$e:null)??(r?et.find(e=>e.id===r)??null:null)??et[0]??null,tt=M?O?.souls.find(e=>e.id===M.soulId)??null:O?.souls.find(e=>e.id===s&&e.status===`available`)??O?.souls.find(e=>e.status===`available`)??null,nt=(0,u.useMemo)(()=>O?.apps.find(e=>e.appId===tt?.id||e.projectedSoul?.id===tt?.id)??null,[O?.apps,tt?.id]),rt=(0,u.useMemo)(()=>O?.templates.filter(e=>e.soulId===M?.soulId)??[],[O?.templates,M?.soulId]),it=rt.find(e=>e.id===l)??rt[0]??null,dt=tt?Je(tt.id):null,P=(0,u.useMemo)(()=>O?.workspaces.filter(e=>e.workerId===M?.id)??[],[O?.workspaces,M?.id]),ft=(0,u.useMemo)(()=>{let e=new Set(P.map(e=>e.id));return j.filter(t=>e.has(t.workspaceId))},[j,P]),pt=(0,u.useMemo)(()=>new Set(ft.map(e=>e.id)),[ft]),vt=(0,u.useMemo)(()=>O?.artifacts.filter(e=>e.sessionId!==null&&pt.has(e.sessionId))??[],[O?.artifacts,pt]),bt=(0,u.useMemo)(()=>{let e=x.trim().toLowerCase();return P.filter(t=>{let n=Xt(t,j),r=O?.templates.find(e=>e.id===n?.capabilityTemplateId),i=r?lt(r,k):null;return!e||t.name.toLowerCase().includes(e)||r?.name.toLowerCase().includes(e)||i?.name.toLowerCase().includes(e)})},[k,j,O?.templates,x,P]),St=nt?.mountedContribution.shell??nt?.manifest.ui?.shell??null,F=St?.primaryAction??null,Ct=St?.search??null,wt=(0,u.useMemo)(()=>{let e=[],t=new Set,n=n=>{!n||t.has(n.id)||(t.add(n.id),e.push(n))};n(St?.primaryAction);for(let e of St?.actions??[])n(e);return St?.settings&&n({...St.settings,slot:`settings`}),e},[St]),Ot=wt.filter(e=>e.id!==F?.id),kt=(0,u.useMemo)(()=>{if(!O)return[];let e=new Map;for(let t of O.souls){let n=ct(t,k);e.set(t.id,{domain:n.domain,id:t.id,name:n.name,workers:[]})}for(let t of et)e.has(t.soulId)||e.set(t.soulId,{domain:t.soulId,id:t.soulId,name:t.soulId,workers:[]}),e.get(t.soulId)?.workers.push(t);return[...e.values()].filter(e=>e.workers.length>0)},[k,O,et]),At=e.kind===`workspace`||e.kind===`session`?e.workspaceId:null,I=(At?P.find(e=>e.id===At)??null:null)??(p&&P.some(e=>e.id===p)?P.find(e=>e.id===p)??null:Qt(P)),tn=(0,u.useMemo)(()=>I?P.filter(e=>e.id!==I.id):P,[I,P]),rn=(0,u.useMemo)(()=>I?j.filter(e=>e.workspaceId===I.id).sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt)):[],[j,I]),L=(e.kind===`session`?j.find(t=>t.id===e.sessionId&&t.workspaceId===e.workspaceId)??null:null)??(e.kind===`workspace`?null:I?Xt(I,j):Qt(ft)),on=L?Zt(L,O?.turns??[]):null,sn=L?Jt(L,O?.artifacts??[]):I?qt(I,O?.artifacts??[],j):Qt(vt),cn=L?Yt(L,O?.reviews??[]):null,ln=(0,u.useMemo)(()=>L?zt(L,O?.turns??[]):[],[O?.turns,L]),un=(0,u.useMemo)(()=>{if(!L)return[];let e=new Map;for(let t of ln)e.set(t.id,t);for(let t of Be.filter(e=>e.sessionId===L.id))e.set(t.id,t);return He?.sessionId===L.id&&e.set(He.id,He),[...e.values()].sort((e,t)=>e.seq-t.seq)},[He,L,ln,Be]),dn=(0,u.useMemo)(()=>L?Ht(L,O?.events??[]):[],[O?.events,L]),fn=(0,u.useMemo)(()=>{if(!L)return[];let e=new Map;for(let t of dn)e.set(String(t.id),t);for(let t of Ne.filter(e=>e.sessionId===L.id))e.set(String(t.id),t);return[...e.values()].sort((e,t)=>e.seq-t.seq)},[L,dn,Ne]),pn=(0,u.useMemo)(()=>L?Gn({artifact:sn,events:fn,locale:k,review:cn,session:L,turns:un}):null,[k,fn,un,sn,cn,L]),mn=I?Ut(I,O?.artifacts??[]):[],hn=I?Gt(I,O?.lessons??[]):[],gn=I?Wt(I,O?.reviews??[]):[],_n=(0,u.useMemo)(()=>O?.apps.filter(e=>e.status===`enabled`)??[],[O?.apps]),vn=(0,u.useMemo)(()=>new Set(P.map(e=>e.id)),[P]),yn=(0,u.useMemo)(()=>O?.reviews.filter(e=>vn.has(e.workspaceId))??[],[O?.reviews,vn]),bn=(0,u.useMemo)(()=>O?.lessons.filter(e=>vn.has(e.workspaceId))??[],[O?.lessons,vn]),xn=tt?ct(tt,k):null,Sn=it?lt(it,k):null,Cn=L?O?.templates.find(e=>e.id===L.capabilityTemplateId)??null:null,Tn=Cn?lt(Cn,k):null,En=en(O?.settings??null,A),On=wn(),An=O?.settings.appearance??`system`,jn=Dn(An,On),Mn=L&&he.sessionId===L.id?he.value:``,Nn=(0,u.useCallback)(e=>{E({sessionId:L?.id??null,value:e})},[L?.id]);(0,u.useEffect)(()=>{document.documentElement.lang=k},[k]),(0,u.useEffect)(()=>{let e=x.trim();if(!nt||!Ct||!e){Me({query:e,type:`idle`});return}let t=!1;return Me({query:e,type:`loading`}),jt(nt.appId,Ct.protocolProvider,e,8).then(n=>{t||Me({items:n.items,query:e,type:`loaded`})}).catch(n=>{t||Me({error:n instanceof Error?n.message:String(n),query:e,type:`failed`})}),()=>{t=!0}},[x,nt,Ct]);function Pn(e=`execution`){T(e),de(!0)}async function Fn(e){if(!nt||ke.busyActionId)return null;Ae({busyActionId:e.id,error:null});try{let t=await Dt(nt.appId,e.id,{source:`worker-shell`},{sessionId:L?.id??void 0,workerId:M?.id??void 0,workspaceId:I?.id??void 0});return Ae({busyActionId:null,error:t.result.ok?null:t.result.message??`Soul App action failed.`}),t.result.refresh&&await D(),t.result}catch(e){return Ae({busyActionId:null,error:e instanceof Error?e.message:String(e)}),null}}function In(e){C(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}function Ln(e){if(!O)return;let t=O.souls.some(t=>t.id===e.appId)?e.appId:e.projectedSoul?.id??e.appId,n=O.souls.find(e=>e.id===t),r=n?ct(n,k):null;c(t),o(r?.name??e.manifest.name),te(!0)}async function Rn(e){if(e.preventDefault(),!a.trim()||!s)return;let t=await Tt({name:a.trim(),soulId:s});i(t.worker.id),o(``),te(!1),await D(),Xe({kind:`worker`,workerId:t.worker.id})}(0,u.useEffect)(()=>{if(!sn){Ge({type:`idle`});return}let e=!1;return Ge({artifactId:sn.id,type:`loading`}),Nt(sn.workspaceId,sn.path).then(t=>{e||Ge({artifactId:sn.id,content:t,type:`loaded`})}).catch(t=>{e||Ge({artifactId:sn.id,error:t instanceof Error?t.message:String(t),type:`failed`})}),()=>{e=!0}},[sn]),(0,u.useEffect)(()=>{if(!I){qe({type:`idle`});return}let e=!1;return qe({type:`loading`,workspaceId:I.id}),ht(I.id).then(t=>{e||qe({content:t,type:`loaded`,workspaceId:I.id})}).catch(t=>{e||qe({error:t instanceof Error?t.message:String(t),type:`failed`,workspaceId:I.id})}),()=>{e=!0}},[I]);async function zn(e){if(e.preventDefault(),!(!O||!tt||!M||!g.trim())){pe(!0);try{let e=await Mt(M.id,{metadata:{soulId:tt.id},name:g.trim()});h(e.workspace.id),_(``),re(!1),await D(),Xe({kind:`workspace`,workerId:M.id,workspaceId:e.workspace.id})}finally{pe(!1)}}}async function Bn(e){if(e.preventDefault(),!(!tt||!M||!I||!it||!y.trim()||!En.ready)){pe(!0);try{let e=Kt(tt,it,y),t=!1,n=M.id,r=I.id,i=e=>{if(t)return;let i=Ye(window.location.pathname),a=i.kind===`worker`&&i.workerId===n,o=i.kind===`workspace`&&i.workerId===n&&i.workspaceId===r;!a&&!o||(t=!0,Xe({kind:`session`,sessionId:e,workerId:n,workspaceId:r}))},a=await yt(I.id,{capabilityTemplateId:it.id,context:y,input:e,metadata:{inputHints:it.inputHints,outputKind:it.outputKind,requestedFrom:`worker-web`,reviewRubric:it.reviewRubric},title:I.name},M.id,{onEvent:e=>Pe(t=>[...t,e]),onSession:e=>{Le(t=>Vt(t,e)),i(e.id)},onTurn:e=>Ve(t=>Bt(t,e))});Le(e=>Vt(e,a.session)),Ve(e=>Bt(e,a.turn)),b(``),await D(),i(a.session.id)}finally{pe(!1)}}}async function Vn(e){if(e.preventDefault(),!(!L||!Mn.trim()||!En.ready)){ve(!0);try{let e=Mn.trim(),t=new Date().toISOString();Ue({createdAt:t,error:null,id:`pending-${t}`,input:e,metadataJson:{optimistic:!0},response:null,seq:(ln.at(-1)?.seq??ln.length)+1,sessionId:L.id,status:`running`,updatedAt:t}),E({sessionId:L.id,value:``});let n=await xt(L.id,{input:e,metadata:{requestedFrom:`worker-web-follow-up`}},L.workerId,{onEvent:e=>Pe(t=>[...t,e]),onTurn:e=>{Ve(t=>Bt(t,e)),Ue(t=>t?.sessionId===e.sessionId?null:t)}});Ve(e=>Bt(e,n.turn)),await D()}catch{await D()}finally{Ue(null),ve(!1)}}}async function Un(){if(!(!I||!L||!sn)){be(!0);try{await _t({artifactId:sn.id,findingsJson:[{message:`Human review requested from Worker Web.`}],risksJson:[],sessionId:L.id,turnId:on?.id??null,verdict:`needs_review`,workspaceId:I.id}),await D()}finally{be(!1)}}}async function Wn(){if(!(!I||!sn||we)){Ee(!0);try{let e=We.artifactId===sn.id&&!We.loading&&!We.error?We.content.trim():``;await gt(I.id,{artifactId:sn.id,findingsJson:[{message:`Approved from HR workbench.`}],profileMarkdown:e||void 0,risksJson:[],verdict:`pass`});try{qe({content:await ht(I.id),type:`loaded`,workspaceId:I.id})}catch(e){qe({error:e instanceof Error?e.message:String(e),type:`failed`,workspaceId:I.id})}await D()}finally{Ee(!1)}}}async function Kn(e,t){Oe(e.id);try{await mt(e.id,t),await D()}finally{Oe(null)}}function qn(e){let t=rt.find(t=>t.id===e.templateId)??it;t&&d(t.id);let n=I?.name??M?.name??xn?.name??`this people profile`;b([`Workbench action: ${e.label}`,`Scope: ${e.scope}`,`Target: ${n}`,``,e.prompt,``,`Return this as a profile-bound artifact proposal with source-backed claims, missing evidence, risks, next-step notes, and human review notes.`].join(`
|
|
18
|
+
`))}function Jn(e,t=`plus`){let n=ke.busyActionId===e.id,r=t===`settings`?Te:xe;return(0,f.jsxs)(`button`,{"aria-busy":n,className:`shell-primary-action`,disabled:!!ke.busyActionId,title:`Provided by the Soul App protocol`,type:`button`,onClick:()=>void Fn(e),children:[(0,f.jsx)(r,{"aria-hidden":`true`,size:14}),(0,f.jsx)(`span`,{children:e.label})]},e.id)}function Yn(){return Ct?(0,f.jsxs)(`label`,{className:`toolbar-search`,children:[(0,f.jsx)(`span`,{className:`search-icon`,"aria-hidden":`true`,children:(0,f.jsx)(Ce,{size:13})}),(0,f.jsx)(`input`,{"aria-label":A.accessibility.searchProjects,placeholder:Ct.placeholder,value:x,onChange:e=>ee(e.target.value)})]}):null}let Xn=ke.error?(0,f.jsx)(`p`,{className:`shell-action-status error`,role:`alert`,children:ke.error}):null,Zn=Ct&&je.query?(0,f.jsxs)(`div`,{className:`shell-search-results`,role:`status`,"aria-live":`polite`,children:[je.loading?(0,f.jsx)(`span`,{className:`shell-search-note`,children:`Searching`}):null,je.error?(0,f.jsx)(`span`,{className:`shell-search-note error`,children:je.error}):null,!je.loading&&!je.error?je.items.map(e=>(0,f.jsxs)(`button`,{type:`button`,className:`shell-search-result`,children:[(0,f.jsx)(`strong`,{children:e.title}),e.summary?(0,f.jsx)(`span`,{children:e.summary}):null]},e.id)):null]}):null,Qn=St?{actionDescriptors:wt,actionSlots:new Set(wt.map(e=>e.slot)),busyActionId:ke.busyActionId,onAction:Fn,results:Zn,search:Yn(),status:Xn}:null;if(t.loading&&!O)return(0,f.jsx)(`main`,{className:`od-loading-shell`,"data-appearance":An,"data-theme":jn,children:(0,f.jsx)(`span`,{children:A.app.loading})});if(t.error)return(0,f.jsx)(`main`,{className:`od-loading-shell`,"data-appearance":An,"data-theme":jn,children:(0,f.jsx)(`span`,{role:`alert`,children:t.error})});if(!O)return null;if(!M){let e=O.souls.filter(e=>e.status===`available`);return(0,f.jsx)(v,{appearance:An,mainLabel:A.accessibility.soulProjectsAndArtifacts,resolvedTheme:jn,sidebarLabel:A.workspace.currentWorker,variant:`home`,sidebar:(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(dr,{copy:A}),(0,f.jsx)(`section`,{className:`workspace-rail-card first-run-rail-card`,children:(0,f.jsx)(Re,{className:`rail-section-head`,title:A.workspace.firstRunRailTitle,description:A.workspace.firstRunRailHint})})]}),main:(0,f.jsx)(m,{kicker:A.app.workspacePill,title:A.workspace.firstRunTitle,children:(0,f.jsx)(fr,{apps:_n,copy:A,locale:k,souls:e,onCreateWorker:()=>te(!0),onStartApp:Ln})}),dialogs:(0,f.jsx)(Pt,{availableSouls:e,copy:A,locale:k,open:S,selectedSoulId:s,workerName:a,onClose:()=>te(!1),onNameChange:o,onSoulChange:c,onSubmit:Rn})})}if(!tt||!it||!xn||!Sn)return null;let $n=(e.kind===`workspace`||e.kind===`session`)&&!!I,er=$n&&!!I,nr=e.kind===`session`&&!!(I&&L),ur=rr(dt),pr=nr?`session`:er?`workspace`:`home`,hr=dt?{artifactPreview:We,artifacts:vt,copy:A,engineReadiness:En,lessons:bn,locale:k,reviews:yn,selectedArtifact:sn,selectedTemplate:it,selectedWorkspace:I,shellHeader:Qn,sessions:ft,soul:tt,soulCopy:xn,submitting:fe,templates:rt,value:y,workbench:dt,workerName:M.name,workspaces:P,onActionSelect:qn,onContextChange:b,onCreateWorkspace:()=>re(!0),onOpenConnectors:()=>Pn(`connectors`),onOpenSettings:()=>Pn(`execution`),onOpenSession:e=>Xe({kind:`session`,sessionId:e.id,workerId:e.workerId,workspaceId:e.workspaceId}),onOpenWorkspace:e=>Xe({kind:`workspace`,workerId:e.workerId,workspaceId:e.id}),onPromoteProfileRevision:Wn,onRefresh:()=>void D(),onSubmitSession:Bn,onTemplateChange:d,profilePreview:Ke,profileRevisionSubmitting:we}:null;return(0,f.jsx)(v,{appearance:An,detail:nr?(0,f.jsx)(Hn,{artifact:sn,artifactCopy:Tn,artifactPreview:We,artifacts:mn,copy:A,engineReadiness:En,events:fn,lessonBusyId:De,lessons:hn,locale:k,mode:`artifact`,collapsed:ae,review:cn,reviewSubmitting:ye,reviews:gn,session:L,template:Cn,turnInput:Mn,turnSubmitting:_e,turns:un,workspace:I,onLessonStatus:(e,t)=>void Kn(e,t),onReview:()=>void Un(),onSubmitTurn:Vn,onTurnInputChange:Nn,progress:pn}):null,detailCollapsed:ae,dialogs:(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(Pt,{availableSouls:O.souls.filter(e=>e.status===`available`),copy:A,locale:k,open:S,selectedSoulId:s,workerName:a,onClose:()=>te(!1),onNameChange:o,onSoulChange:c,onSubmit:Rn}),(0,f.jsx)(Ft,{copy:A,open:ne,placeholder:$t(tt.id,A),workerLabel:`${M.name} / ${xn.name}`,submitting:fe,workspaceTitle:g,onClose:()=>re(!1),onSubmit:zn,onTitleChange:_}),ce?(0,f.jsx)(an,{initial:O.settings,initialSection:w,apps:O.apps,runtimeVersion:O.info.runtimeVersion,templates:O.templates,onClose:()=>de(!1),onSaved:e=>{n(t=>t.data?{...t,data:{...t.data,settings:e},loading:!1}:t)},onAppsChanged:()=>D()}):null]}),mainLabel:A.accessibility.soulProjectsAndArtifacts,resolvedTheme:jn,sidebarLabel:$n?A.workspace.workspaceNavigation:A.accessibility.soulProjectCreator,variant:pr,sidebar:(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(dr,{copy:A}),$n&&I?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`section`,{className:`workspace-rail-card workspace-context-card`,children:[(0,f.jsxs)(`button`,{type:`button`,className:`rail-back-button`,onClick:()=>Xe({kind:`worker`,workerId:M.id}),children:[(0,f.jsx)(oe,{"aria-hidden":`true`,size:13}),(0,f.jsx)(`span`,{children:A.workspace.backToWorker})]}),(0,f.jsxs)(`div`,{className:`rail-context-main`,children:[(0,f.jsx)(`span`,{className:`kicker`,children:A.workspace.workspaceNavigation}),(0,f.jsx)(`h3`,{children:I.name}),(0,f.jsx)(`p`,{children:`${xn.name} / ${xn.domain}`})]}),(0,f.jsx)(Lt,{compact:!0,copy:A,locale:k,soul:tt,soulCopy:xn,worker:M}),(0,f.jsxs)(`div`,{className:`rail-meta-grid`,children:[(0,f.jsx)(`span`,{children:A.workspace.currentWorkspace}),(0,f.jsx)(`strong`,{children:I.name}),(0,f.jsx)(`span`,{children:A.workspace.selectedCapability}),(0,f.jsx)(`strong`,{children:Tn?.name??Sn.name}),(0,f.jsx)(`span`,{children:A.workspace.currentSession}),(0,f.jsx)(`strong`,{children:L?ut(L.status,k):A.artifact.noSession})]})]}),(0,f.jsxs)(`section`,{className:`workspace-rail-card`,children:[(0,f.jsx)(Re,{className:`rail-section-head`,title:A.workspace.workspaceSessions,action:(0,f.jsx)(Fe,{"aria-label":A.workspace.newSession,title:A.workspace.newSession,onClick:()=>Xe({kind:`workspace`,workerId:I.workerId,workspaceId:I.id}),children:(0,f.jsx)(xe,{"aria-hidden":`true`,size:16})})}),(0,f.jsx)(`div`,{className:`rail-session-list`,children:rn.length>0?rn.map(e=>(0,f.jsxs)(`button`,{type:`button`,className:`rail-session-item ${L?.id===e.id?`active`:``}`,onClick:()=>Xe({kind:`session`,sessionId:e.id,workerId:e.workerId,workspaceId:e.workspaceId}),children:[(0,f.jsx)(`strong`,{children:e.title}),(0,f.jsxs)(`span`,{children:[lt(O.templates.find(t=>t.id===e.capabilityTemplateId)??it,k).name,` · `,ut(e.status,k)]}),(0,f.jsx)(`small`,{children:A.workspace.updated(N(e.updatedAt,k))})]},e.id)):(0,f.jsx)(`div`,{className:`rail-empty`,children:A.workspace.noWorkspaceSessions})})]}),(0,f.jsxs)(`section`,{className:`workspace-rail-card`,children:[(0,f.jsx)(Re,{className:`rail-section-head`,title:A.workspace.otherWorkspaces,action:(0,f.jsx)(Fe,{"aria-label":A.workspace.createWorkspace,title:A.workspace.createWorkspace,onClick:()=>re(!0),children:(0,f.jsx)(xe,{"aria-hidden":`true`,size:16})})}),(0,f.jsx)(`div`,{className:`rail-workspace-list`,children:tn.length>0?tn.map(e=>(0,f.jsxs)(`button`,{type:`button`,className:`rail-workspace-item`,onClick:()=>Xe({kind:`workspace`,workerId:e.workerId,workspaceId:e.id}),children:[(0,f.jsx)(`strong`,{children:e.name}),(0,f.jsx)(`small`,{children:ut(e.status,k)})]},e.id)):(0,f.jsx)(`div`,{className:`rail-empty`,children:A.workspace.noOtherWorkspaces})})]})]}):(0,f.jsx)(f.Fragment,{children:(0,f.jsx)(`section`,{className:`newproj worker-list-panel soul-catalog-panel soul-rail-panel`,children:(0,f.jsxs)(`div`,{className:`newproj-body`,children:[(0,f.jsx)(Re,{className:`section-head compact with-action`,title:A.workspace.workerList,description:A.workspace.workerListHint,action:(0,f.jsx)(Fe,{"aria-label":A.workspace.createWorker,title:A.workspace.createWorker,onClick:()=>te(!0),children:(0,f.jsx)(xe,{"aria-hidden":`true`,size:16})})}),(0,f.jsx)(`div`,{className:`worker-list-rail soul-rail`,role:`listbox`,"aria-label":A.workspace.currentWorker,children:kt.map(e=>{let t=ie.has(e.id),n=`worker-soul-group-${e.id}`;return(0,f.jsxs)(`div`,{className:`worker-soul-group`,children:[(0,f.jsxs)(`button`,{type:`button`,className:`worker-soul-group-toggle`,"aria-label":`${e.name} (${e.workers.length}) ${e.domain}`,"aria-controls":n,"aria-expanded":!t,onClick:()=>In(e.id),children:[(0,f.jsxs)(`span`,{className:`worker-soul-group-title`,children:[(0,f.jsx)(`strong`,{children:`${e.name} (${e.workers.length})`}),(0,f.jsx)(`small`,{children:e.domain})]}),t?(0,f.jsx)(ue,{"aria-hidden":`true`,size:14}):(0,f.jsx)(le,{"aria-hidden":`true`,size:14})]}),t?null:(0,f.jsx)(`div`,{id:n,className:`worker-soul-group-items`,role:`group`,"aria-label":e.name,children:e.workers.map(e=>{let t=M.id===e.id;return(0,f.jsxs)(`button`,{type:`button`,className:`worker-list-item ${t?`active`:``}`,"aria-selected":t,role:`option`,onClick:()=>{i(e.id),h(null);let t=O.templates.find(t=>t.soulId===e.soulId);t&&d(t.id),Xe({kind:`worker`,workerId:e.id})},children:[(0,f.jsx)(`span`,{className:`worker-list-item-main`,children:(0,f.jsx)(`strong`,{children:e.name})}),(0,f.jsx)(`span`,{className:`status-dot ${e.status===`active`?`active`:``}`,"aria-hidden":`true`})]},e.id)})})]},e.id)})})]})})}),(0,f.jsxs)(`div`,{className:`entry-side-foot`,children:[(0,f.jsxs)(`button`,{type:`button`,className:`foot-pill`,onClick:()=>Pn(`execution`),children:[(0,f.jsx)(Te,{"aria-hidden":`true`,size:12}),(0,f.jsx)(`span`,{children:O.settings.executionMode===`local-cli`?`Local CLI`:`BYOK`}),(0,f.jsx)(`span`,{className:`foot-divider-dot`,children:`·`}),(0,f.jsx)(`span`,{children:nn(O.settings,A)})]}),(0,f.jsxs)(`button`,{type:`button`,className:`foot-pill`,"aria-label":A.accessibility.languageSwitcher,onClick:()=>Pn(`language`),children:[(0,f.jsx)(ge,{"aria-hidden":`true`,size:12}),(0,f.jsx)(`span`,{children:st(k,k)}),(0,f.jsx)(le,{"aria-hidden":`true`,size:12})]})]})]}),main:(0,f.jsxs)(f.Fragment,{children:[nr&&I&&L&&pn?(0,f.jsx)(kn,{copy:A,detailDrawerOpen:!ae,engineReadiness:En,events:fn,locale:k,session:L,template:Cn,turnInput:Mn,turnSubmitting:_e,turns:un,workspace:I,onOpenSettings:()=>Pn(`execution`),onRefresh:()=>void D(),onSubmitTurn:Vn,onToggleDetailDrawer:()=>se(e=>!e),onTurnInputChange:Nn,progress:pn},L.id):null,!nr&&ur&&hr?(0,f.jsx)(tr,{context:hr}):null,!nr&&!ur&&$n&&I?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`header`,{className:`entry-header workspace-header`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`span`,{className:`kicker`,children:A.workspace.currentWorkspace}),(0,f.jsx)(`h1`,{children:I.name})]}),(0,f.jsxs)(`div`,{className:`entry-header-right`,children:[(0,f.jsx)(Fe,{"aria-label":A.accessibility.refreshWorkspace,onClick:()=>void D(),children:(0,f.jsx)(Se,{"aria-hidden":`true`,size:16})}),(0,f.jsx)(Fe,{"aria-label":A.accessibility.openSettings,onClick:()=>Pn(),children:(0,f.jsx)(Te,{"aria-hidden":`true`,size:16})})]})]}),(0,f.jsx)(`div`,{className:`entry-tab-content workspace-content workspace-compose-content`,children:(0,f.jsx)(It,{copy:A,engineLabel:nn(O.settings,A),engineReadiness:En,locale:k,selectedTemplate:it,submitting:fe,templates:rt,value:y,workspace:I,onContextChange:b,onOpenSettings:()=>Pn(`execution`),onSubmit:Bn,onTemplateChange:d})})]}):null,!nr&&!ur&&!($n&&I)?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`header`,{className:`entry-header workspace-header`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`span`,{className:`kicker`,children:A.workspace.currentWorker}),(0,f.jsx)(`h1`,{children:A.workspace.workspaceTitle(M.name)})]}),(0,f.jsxs)(`div`,{className:`entry-header-right`,children:[(0,f.jsx)(Fe,{"aria-label":A.accessibility.refreshWorkspace,onClick:()=>void D(),children:(0,f.jsx)(Se,{"aria-hidden":`true`,size:16})}),(0,f.jsx)(Fe,{"aria-label":A.accessibility.openSettings,onClick:()=>Pn(),children:(0,f.jsx)(Te,{"aria-hidden":`true`,size:16})}),(0,f.jsx)(`button`,{className:`avatar-btn`,type:`button`,"aria-label":A.accessibility.workspace,children:(0,f.jsx)(`span`,{"aria-hidden":`true`,className:`avatar-btn-initials`,children:mr(M.name)})})]})]}),(0,f.jsxs)(`div`,{className:`entry-tab-content workspace-content`,children:[(0,f.jsxs)(`section`,{className:`worker-overview-panel`,children:[(0,f.jsx)(Lt,{compact:!0,copy:A,locale:k,soul:tt,soulCopy:xn,worker:M}),(0,f.jsxs)(`div`,{className:`worker-capability-summary`,children:[(0,f.jsx)(Re,{className:`rail-section-head`,title:`${A.create.capabilityTemplate} (${rt.length})`}),(0,f.jsx)(`div`,{className:`worker-capability-chips`,children:rt.map(e=>(0,f.jsx)(`span`,{children:lt(e,k).name},e.id))})]})]}),(0,f.jsxs)(`section`,{className:`workspace-list-section`,children:[(0,f.jsxs)(`div`,{className:`tab-panel-toolbar`,children:[(0,f.jsxs)(`div`,{className:`toolbar-left`,children:[(0,f.jsx)(`strong`,{children:`${A.workspace.workspaceList} (${bt.length})`}),(0,f.jsx)(Fe,{"aria-label":A.workspace.createWorkspace,title:A.workspace.createWorkspace,onClick:()=>re(!0),children:(0,f.jsx)(xe,{"aria-hidden":`true`,size:16})}),F?Jn(F):null,Ot.map(e=>Jn(e,e.slot===`settings`?`settings`:`plus`))]}),(0,f.jsx)(`div`,{className:`toolbar-right`,children:Ct?Yn():(0,f.jsxs)(`label`,{className:`toolbar-search`,children:[(0,f.jsx)(`span`,{className:`search-icon`,"aria-hidden":`true`,children:(0,f.jsx)(Ce,{size:13})}),(0,f.jsx)(`input`,{"aria-label":A.accessibility.searchProjects,placeholder:A.projects.searchPlaceholder,value:x,onChange:e=>ee(e.target.value)})]})})]}),Xn,Zn,(0,f.jsx)(`div`,{className:`design-grid workspace-grid workspace-list`,children:bt.length>0?bt.map(e=>(0,f.jsx)(Rt,{active:I?.id===e.id,artifact:qt(e,O.artifacts,j),item:e,locale:k,session:Xt(e,j),template:O.templates.find(t=>t.id===Xt(e,j)?.capabilityTemplateId),turn:Zt(Xt(e,j),O.turns),onSelect:()=>{h(e.id),Xe({kind:`workspace`,workerId:e.workerId,workspaceId:e.id})}},e.id)):(0,f.jsx)(ze,{className:`empty-design-state`,icon:(0,f.jsx)(me,{size:20}),title:A.projects.empty.title,detail:A.projects.empty.detail(xn.name),action:(0,f.jsxs)(`button`,{type:`button`,className:`ghost icon-btn`,onClick:()=>re(!0),children:[(0,f.jsx)(xe,{"aria-hidden":`true`,size:13}),(0,f.jsx)(`span`,{children:A.workspace.createWorkspace})]})})})]})]})]}):null]})})}function dr({copy:e}){return(0,f.jsxs)(`div`,{className:`entry-brand`,children:[(0,f.jsx)(`span`,{className:`entry-brand-mark`,"aria-hidden":`true`,children:`AI`}),(0,f.jsxs)(`div`,{className:`entry-brand-text`,children:[(0,f.jsxs)(`div`,{className:`entry-brand-title-row`,children:[(0,f.jsx)(`span`,{className:`entry-brand-title`,children:e.app.brand}),(0,f.jsx)(`span`,{className:`entry-brand-pill`,children:e.app.workspacePill})]}),(0,f.jsx)(`div`,{className:`entry-brand-subtitle`,children:e.app.subtitle})]})]})}function fr({apps:e,copy:t,locale:n,onCreateWorker:r,onStartApp:i,souls:a}){return e.length===0?(0,f.jsx)(ze,{className:`empty-design-state`,icon:(0,f.jsx)(me,{size:20}),title:t.workspace.noSoulApps,detail:t.workspace.noSoulAppsDetail,action:(0,f.jsxs)(`button`,{type:`button`,className:`ghost icon-btn`,onClick:r,children:[(0,f.jsx)(xe,{"aria-hidden":`true`,size:13}),(0,f.jsx)(`span`,{children:t.workspace.createWorker})]})}):(0,f.jsxs)(`section`,{className:`first-run-panel`,"aria-label":t.workspace.firstRunTitle,children:[(0,f.jsx)(`div`,{className:`first-run-intro`,children:(0,f.jsx)(`p`,{children:t.workspace.firstRunDetail})}),(0,f.jsx)(`div`,{className:`first-run-app-grid`,children:e.map(e=>{let r=pr(e,a),o=r?ct(r,n):null,s=o?.domain??e.projectedSoul?.domain??e.appId,c=o?.description??e.manifest.description;return(0,f.jsxs)(`button`,{type:`button`,className:`first-run-app-card`,"aria-label":t.workspace.startSoulApp(e.manifest.name),onClick:()=>i(e),children:[(0,f.jsxs)(`span`,{className:`first-run-app-card-main`,children:[(0,f.jsx)(`strong`,{children:e.manifest.name}),(0,f.jsx)(`span`,{children:s})]}),(0,f.jsx)(`span`,{className:`first-run-app-card-detail`,children:c}),(0,f.jsxs)(`span`,{className:`first-run-app-card-foot`,children:[(0,f.jsx)(`span`,{children:`${ut(e.status,n)} · ${e.version}`}),(0,f.jsxs)(`span`,{className:`first-run-app-action`,children:[(0,f.jsx)(`span`,{children:t.workspace.startSoulApp(e.manifest.name)}),(0,f.jsx)(ue,{"aria-hidden":`true`,size:14})]})]})]},e.appId)})})]})}function pr(e,t){return t.find(t=>t.id===e.appId)??t.find(t=>t.id===e.projectedSoul?.id)??null}function mr(e){let t=e.trim().split(/\s+/).filter(Boolean);return t.length>1?t.slice(0,2).map(e=>Array.from(e)[0]).join(``).toUpperCase():Array.from(t[0]??`AI`).slice(0,2).join(``).toUpperCase()}var hr=document.getElementById(`root`);if(!hr)throw Error(`Root element not found`);(0,d.createRoot)(hr).render((0,f.jsx)(u.StrictMode,{children:(0,f.jsx)(ur,{})}));export{Fe as a,Te as c,xe as d,be as f,C as g,le as h,ut as i,Ce as l,me as m,lt as n,Oe as o,ye as p,N as r,Ee as s,$n as t,Se as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,n as t}from"./markdown-preview-DFe-rfff.js";import{a as n,c as r,d as i,f as a,g as o,h as s,i as c,l,m as u,n as d,o as f,p,r as m,s as h,t as g,u as _}from"./index-CX4fPJXV.js";var v=o(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),y=o(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),b=o(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),x=o(`list-checks`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]),S=o(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),C=o(`notebook-text`,[[`path`,{d:`M2 6h4`,key:`aawbzj`}],[`path`,{d:`M2 10h4`,key:`l0bgd4`}],[`path`,{d:`M2 14h4`,key:`1gsvsf`}],[`path`,{d:`M2 18h4`,key:`1bu2t1`}],[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,key:`1nb95v`}],[`path`,{d:`M9.5 8h5`,key:`11mslq`}],[`path`,{d:`M9.5 12H16`,key:`ktog6x`}],[`path`,{d:`M9.5 16H14`,key:`p1seyn`}]]),w=o(`panel-left-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m16 15-3-3 3-3`,key:`14y99z`}]]),ee=o(`panel-left-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]]),T=o(`users-round`,[[`path`,{d:`M18 21a8 8 0 0 0-16 0`,key:`3ypg7q`}],[`circle`,{cx:`10`,cy:`8`,r:`5`,key:`o932ke`}],[`path`,{d:`M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3`,key:`10s06x`}]]),E=e(),D=t();function O({detail:e,icon:t,title:n}){return(0,D.jsxs)(`div`,{className:`workbench-section-title`,children:[(0,D.jsx)(`span`,{className:`workbench-section-icon`,"aria-hidden":`true`,children:t}),(0,D.jsxs)(`span`,{children:[(0,D.jsx)(`strong`,{children:n}),(0,D.jsx)(`small`,{children:e})]})]})}var k=(0,E.lazy)(()=>g(()=>import(`./markdown-preview-DFe-rfff.js`).then(e=>e.t).then(e=>({default:e.MarkdownPreview})),[]));function te({artifact:e,artifactPreview:t,focusedProfile:n,labels:r,locale:i,onPromoteProfileRevision:a,profilePreview:o,profileRevisionSubmitting:s,reviewGuardrails:c,timeline:l}){let d=!!(e&&t.artifactId===e.id),f=!!(n&&o.workspaceId===n.id);return(0,D.jsxs)(`section`,{className:`hr-profile-details`,"aria-label":r.profileDetailsTitle,children:[(0,D.jsx)(O,{icon:(0,D.jsx)(C,{size:15}),title:r.profileDetailsTitle,detail:n?r.profileDetailsDetail(n.name):r.profileDetailsEmpty}),(0,D.jsxs)(`div`,{className:`hr-profile-details-scroll`,children:[(0,D.jsxs)(`article`,{className:`hr-current-profile-card`,"data-testid":`hr-current-profile-summary`,children:[(0,D.jsxs)(`div`,{className:`hr-current-profile-head`,children:[n?(0,D.jsx)(`span`,{className:`hr-profile-avatar large`,"aria-hidden":`true`,children:n.initials}):null,(0,D.jsxs)(`span`,{children:[(0,D.jsx)(`strong`,{children:n?.name??r.profileDetailsTitle}),(0,D.jsx)(`small`,{children:`README.md`})]})]}),A({empty:r.currentProfileEmpty,error:r.currentProfileError,loading:r.currentProfileLoading,profilePreview:o,profilePreviewMatchesProfile:f})]}),(0,D.jsxs)(`div`,{className:`hr-details-grid`,children:[(0,D.jsxs)(`article`,{className:`hr-details-card`,children:[(0,D.jsx)(O,{icon:(0,D.jsx)(u,{size:15}),title:r.sourcesTitle,detail:r.sourcesDetail}),(0,D.jsx)(`div`,{className:`hr-source-grid`,children:r.sourceCards(n?.artifacts.length??0,n?.sessions.length??0,n?.reviews.length??0).map(e=>(0,D.jsxs)(`div`,{className:`hr-source-row`,children:[(0,D.jsx)(`span`,{children:e.label}),(0,D.jsx)(`strong`,{children:e.count}),(0,D.jsx)(`small`,{children:e.detail})]},e.label))}),(0,D.jsxs)(`div`,{className:`hr-profile-timeline`,"aria-label":r.timelineTitle,children:[(0,D.jsx)(`strong`,{children:r.timelineTitle}),l.length>0?l.map(e=>(0,D.jsxs)(`div`,{className:`hr-timeline-row`,children:[(0,D.jsx)(`span`,{className:`hr-timeline-dot ${e.tone}`,"aria-hidden":`true`}),(0,D.jsxs)(`span`,{children:[(0,D.jsx)(`strong`,{children:e.label}),(0,D.jsx)(`small`,{children:e.detail})]})]},`${e.label}-${e.detail}`)):(0,D.jsx)(`span`,{className:`hr-muted-note`,children:r.noTimeline})]})]}),(0,D.jsxs)(`article`,{className:`hr-details-card hr-artifact-preview-card`,"data-testid":`hr-proposed-change`,children:[(0,D.jsx)(O,{icon:(0,D.jsx)(u,{size:15}),title:r.artifactPreviewTitle,detail:e?m(e.updatedAt,i):r.artifactPreviewDetail}),e?(0,D.jsx)(`strong`,{className:`hr-artifact-preview-name`,children:e.title}):null,j({artifact:e,artifactPreview:t,empty:r.artifactPreviewEmpty,error:r.artifactPreviewError,loading:r.artifactPreviewLoading,previewMatchesArtifact:d}),(0,D.jsxs)(`div`,{className:`hr-proposed-change-actions`,children:[(0,D.jsx)(`span`,{className:`hr-muted-note`,children:r.promoteProfileRevisionHint}),(0,D.jsxs)(`button`,{type:`button`,className:`secondary hr-profile-promote-button`,disabled:!e||s,onClick:()=>void a(),children:[(0,D.jsx)(y,{"aria-hidden":`true`,size:14}),(0,D.jsx)(`span`,{children:s?r.approvingProfileRevision:r.approveProfileRevision})]})]})]})]}),(0,D.jsxs)(`div`,{className:`hr-guardrail-panel`,children:[(0,D.jsx)(O,{icon:(0,D.jsx)(x,{size:15}),title:r.guardrailsTitle,detail:r.guardrailsDetail}),(0,D.jsx)(`ul`,{className:`hr-guardrail-list`,children:c.map(e=>(0,D.jsx)(`li`,{children:e},e))})]})]})]})}function A({empty:e,error:t,loading:n,profilePreview:r,profilePreviewMatchesProfile:i}){return!i||r.loading?(0,D.jsx)(`div`,{className:`hr-artifact-preview-empty`,children:n}):r.error?(0,D.jsx)(`div`,{className:`hr-artifact-preview-empty`,role:`alert`,children:`${t} ${r.error}`}):(0,D.jsx)(E.Suspense,{fallback:(0,D.jsx)(`div`,{className:`hr-markdown-preview hr-current-profile-markdown`,"data-testid":`hr-current-profile-markdown-loading`}),children:(0,D.jsx)(k,{className:`hr-markdown-preview hr-current-profile-markdown`,content:r.content,"data-testid":`hr-current-profile-markdown`,empty:(0,D.jsx)(`span`,{children:e})})})}function j({artifact:e,artifactPreview:t,empty:n,error:r,loading:i,previewMatchesArtifact:a}){return e?!a||t.loading?(0,D.jsx)(`div`,{className:`hr-artifact-preview-empty`,children:i}):t.error?(0,D.jsx)(`div`,{className:`hr-artifact-preview-empty`,role:`alert`,children:`${r} ${t.error}`}):(0,D.jsx)(E.Suspense,{fallback:(0,D.jsx)(`div`,{className:`hr-markdown-preview`,"data-testid":`hr-artifact-markdown-preview-loading`}),children:(0,D.jsx)(k,{className:`hr-markdown-preview`,content:t.content,"data-testid":`hr-artifact-markdown-preview`,empty:(0,D.jsx)(`span`,{children:n})})}):(0,D.jsx)(`div`,{className:`hr-artifact-preview-empty`,children:n})}function ne({collapsedSectionIds:e,labels:t,onOpenWorkspace:n,onToggleSection:r,sections:i,selectedWorkspaceId:a,visibleCount:o}){return(0,D.jsxs)(`aside`,{className:`hr-profile-list-panel`,"aria-label":t.profileBoardLabel,children:[(0,D.jsx)(O,{icon:(0,D.jsx)(T,{size:15}),title:t.profileBoardTitle,detail:t.profileListDetail(o)}),(0,D.jsx)(`div`,{className:`hr-profile-list-scroll`,children:i.map(i=>{let o=e.has(i.id);return(0,D.jsxs)(`section`,{className:`hr-profile-list-section`,children:[(0,D.jsxs)(`button`,{type:`button`,className:`hr-profile-section-toggle`,"aria-expanded":!o,onClick:()=>r(i.id),children:[(0,D.jsx)(`span`,{children:(0,D.jsx)(`strong`,{children:i.label})}),(0,D.jsx)(`span`,{className:`hr-section-count`,children:i.profiles.length}),(0,D.jsx)(s,{"aria-hidden":`true`,size:14})]}),o?null:(0,D.jsx)(`div`,{className:`hr-profile-section-drawer`,children:i.profiles.length>0?i.profiles.map(e=>(0,D.jsx)(M,{labels:t,profile:e,selected:a===e.id,onOpenWorkspace:n},`${i.id}-${e.id}`)):(0,D.jsx)(`span`,{className:`hr-profile-section-empty`,children:t.noProfilesInSection})})]},i.id)})})]})}function M({labels:e,onOpenWorkspace:t,profile:n,selected:r}){return(0,D.jsxs)(`button`,{type:`button`,className:`hr-profile-list-card ${n.lifecycle} ${r?`active`:``}`,"aria-label":e.openProfile(n.name),onClick:()=>t(n.workspace),children:[(0,D.jsxs)(`span`,{className:`hr-profile-list-card-main`,children:[(0,D.jsxs)(`span`,{className:`hr-profile-list-card-copy`,children:[(0,D.jsx)(`strong`,{children:n.name}),(0,D.jsx)(`small`,{children:n.detail})]}),(0,D.jsx)(`span`,{className:`workbench-status-cell ${n.statusTone}`,children:e.lifecycleLabels[n.lifecycle]})]}),(0,D.jsxs)(`span`,{className:`hr-profile-list-card-status`,children:[(0,D.jsx)(`small`,{children:n.moment}),(0,D.jsx)(`strong`,{children:n.nextStep})]})]})}function re(e,t,n,r,i,a,o){return e.map(e=>{let o=t.filter(t=>t.workspaceId===e.id),s=n.filter(t=>t.workspaceId===e.id),c=r.filter(t=>t.workspaceId===e.id),l=i.filter(t=>t.workspaceId===e.id),u=N(e,o,s),d=o.slice().sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt))[0]??null,f=s.length>0,p=L(c),m=d?.status===`failed`?`risk`:f?`good`:`warn`,h=z(p);return{artifacts:s,detail:d?V(d):a.noSessionYet,evidenceTone:m,id:e.id,initials:B(e.name),latestSession:d,lessons:l,lifecycle:u,moment:P(u,o,s,p,a),name:e.name,nextStep:F(u,o,s,p,a),reviews:c,reviewState:p,reviewStatus:a.reviewStatus(p),reviewTone:h,sessions:o,status:f?a.status.evidenceReady:a.status.evidenceMissing,statusTone:m,workspace:{...e,updatedAt:e.updatedAt||new Date().toISOString()}}}).sort((e,t)=>{let n=+!!I(e),r=+!!I(t);return n===r?t.workspace.updatedAt.localeCompare(e.workspace.updatedAt):r-n}).map(e=>({...e,detail:`${e.detail} · ${m(e.workspace.updatedAt,o)}`}))}function N(e,t,n){let r=[e.name,e.type,...t.map(e=>`${e.title} ${e.capabilityTemplateId}`),...n.map(e=>`${e.kind} ${e.title}`)].join(` `).toLowerCase();return/alumni|offboard|depart|exit|handoff|离职|交接|校友/.test(r)?`alumni`:/employee|onboard|new hire|check.?in|growth|retention|员工|入职|在职|试用/.test(r)?`employee`:`candidate`}function P(e,t,n,r,i){if(t.some(e=>e.status===`failed`)||r===`fail`)return i.moments.riskReview;if(R(r))return i.moments.reviewed;if(n.length>0)return i.moments.artifactReady;if(t.length>0)return i.moments.inProgress;switch(e){case`alumni`:return i.moments.offboardingNeeded;case`employee`:return i.moments.checkinNeeded;case`candidate`:return i.moments.intakeNeeded}}function F(e,t,n,r,i){if(t.some(e=>e.status===`failed`)||r===`fail`)return i.nextSteps.resolveRisk;if(n.length>0&&!R(r))return i.nextSteps.requestReview;if(R(r))return i.nextSteps.captureMemory;if(t.length>0)return i.nextSteps.completeArtifact;switch(e){case`alumni`:return i.nextSteps.offboarding;case`employee`:return i.nextSteps.checkin;case`candidate`:return i.nextSteps.profileSnapshot}}function ie(e,t){return[{id:`candidate`,label:t.lifecycleFilters.candidate,profiles:e.filter(e=>e.lifecycle===`candidate`)},{id:`employee`,label:t.lifecycleFilters.employee,profiles:e.filter(e=>e.lifecycle===`employee`)},{id:`alumni`,label:t.lifecycleFilters.alumni,profiles:e.filter(e=>e.lifecycle===`alumni`)}]}function I(e){return e.sessions.length===0||e.artifacts.length===0||e.latestSession?.status===`failed`||e.reviewTone!==`good`}function L(e){return e.slice().sort((e,t)=>t.createdAt.localeCompare(e.createdAt))[0]?.verdict??`none`}function R(e){return e===`pass`||e===`warn`}function z(e){return e===`pass`?`good`:e===`fail`?`risk`:`warn`}function ae(e,t){let n=t?.lifecycle===`employee`?[`prepare-next-step`,`draft-onboarding-plan`,`summarize-profile`,`check-risky-wording`]:t?.lifecycle===`alumni`?[`prepare-offboarding-summary`,`summarize-profile`,`prepare-next-step`,`check-risky-wording`]:[`summarize-profile`,`extract-evidence`,`draft-interview-kit`,`build-evidence-matrix`],r=new Map(n.map((e,t)=>[e,t]));return e.slice().sort((e,t)=>(r.get(e.id)??99)-(r.get(t.id)??99)).slice(0,5)}function oe(e,t,n){let r=[{detail:t.timelineUpdated(m(e.workspace.updatedAt,n)),label:t.timelineLabels.profile,tone:`muted`}];e.latestSession&&r.push({detail:`${e.latestSession.title} · ${c(e.latestSession.status,n)}`,label:t.timelineLabels.session,tone:e.latestSession.status===`failed`?`risk`:`good`});let i=e.artifacts.slice().sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt))[0];return i&&r.push({detail:i.title,label:t.timelineLabels.artifact,tone:`good`}),e.reviews.length>0&&r.push({detail:t.timelineReviewCount(e.reviews.length),label:t.timelineLabels.review,tone:`good`}),e.lessons.length>0&&r.push({detail:t.timelineLessonCount(e.lessons.length),label:t.timelineLabels.memory,tone:`warn`}),r.slice(0,5)}function B(e){let t=e.trim().split(/\s+/).filter(Boolean);return t.length>=2?`${t[0]?.[0]??``}${t[1]?.[0]??``}`.toUpperCase():Array.from(e.trim()).slice(0,2).join(``).toUpperCase()||`HR`}function V(e){return e.capabilityTemplateId.replace(/-/g,` `)}function H(e,t){return t.actionLabels[e.id]??e.label}function se({activeActions:e,copy:t,engineReadiness:n,focusedProfile:r,labels:i,locale:a,onActionSelect:o,onContextChange:s,onOpenSession:l,onSubmitSession:u,onTemplateChange:p,selectedTemplate:h,selectedWorkspace:g,submitting:_,templates:y,value:x}){let C=d(h,a),w=r?.sessions.slice().sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt)).slice(0,3)??[];return(0,D.jsxs)(`aside`,{className:`hr-profile-tools-panel`,"aria-label":i.actionComposerTitle,children:[(0,D.jsx)(O,{icon:(0,D.jsx)(f,{size:15}),title:i.actionComposerTitle,detail:r?i.actionComposerDetail(r.name):i.actionComposerEmpty}),(0,D.jsxs)(`div`,{className:`hr-profile-tools-scroll`,children:[r?(0,D.jsxs)(`div`,{className:`hr-action-profile-card`,children:[(0,D.jsx)(`span`,{className:`hr-profile-avatar large`,"aria-hidden":`true`,children:r.initials}),(0,D.jsxs)(`span`,{children:[(0,D.jsx)(`strong`,{children:r.name}),(0,D.jsx)(`small`,{children:`${i.lifecycleLabels[r.lifecycle]} · ${r.moment}`})]})]}):null,(0,D.jsxs)(`section`,{className:`hr-tool-section`,"aria-label":i.recentSessionsTitle,children:[(0,D.jsx)(O,{icon:(0,D.jsx)(S,{size:15}),title:i.recentSessionsTitle,detail:i.recentSessionsDetail(w.length)}),(0,D.jsx)(`div`,{className:`hr-session-card-list`,children:w.length>0?w.map(e=>(0,D.jsxs)(`button`,{type:`button`,className:`hr-session-card`,"aria-label":i.openSession(e.title),onClick:()=>l(e),children:[(0,D.jsxs)(`span`,{children:[(0,D.jsx)(`strong`,{children:e.title}),(0,D.jsx)(`small`,{children:U(e,y,a)})]}),(0,D.jsxs)(`span`,{className:`hr-session-card-meta`,children:[(0,D.jsx)(`em`,{children:c(e.status,a)}),(0,D.jsxs)(`small`,{children:[(0,D.jsx)(b,{"aria-hidden":`true`,size:12}),m(e.updatedAt,a)]})]})]},e.id)):(0,D.jsx)(`span`,{className:`hr-profile-section-empty`,children:i.noRecentSessions})})]}),(0,D.jsxs)(`section`,{className:`hr-tool-section`,"aria-label":i.suggestedToolsTitle,children:[(0,D.jsx)(O,{icon:(0,D.jsx)(f,{size:15}),title:i.suggestedToolsTitle,detail:i.proposalOnly}),(0,D.jsx)(`div`,{className:`hr-action-list`,children:e.map((e,t)=>(0,D.jsxs)(`button`,{type:`button`,className:`hr-action-row ${t===0?`suggested`:``}`,disabled:!g,onClick:()=>o(e),children:[(0,D.jsxs)(`span`,{children:[(0,D.jsx)(`strong`,{children:H(e,i)}),(0,D.jsx)(`small`,{children:i.actionMeta(e.scope,e.outputKind)})]}),t===0?(0,D.jsx)(`em`,{children:i.recommended}):(0,D.jsx)(v,{"aria-hidden":`true`,size:14})]},e.id))})]})]}),(0,D.jsxs)(`form`,{className:`hr-task-composer`,onSubmit:u,children:[(0,D.jsxs)(`div`,{className:`hr-composer-heading`,children:[(0,D.jsx)(`strong`,{children:i.proposalComposerTitle}),(0,D.jsx)(`small`,{children:g?i.proposalComposerDetail:i.selectProfileFirst})]}),(0,D.jsx)(`label`,{htmlFor:`hr-task-template`,children:i.artifactTargetLabel}),(0,D.jsx)(`select`,{id:`hr-task-template`,value:h.id,onChange:e=>p(e.target.value),children:y.map(e=>(0,D.jsx)(`option`,{value:e.id,children:d(e,a).name},e.id))}),(0,D.jsx)(`label`,{htmlFor:`hr-task-context`,children:i.contextLabel}),(0,D.jsx)(`textarea`,{id:`hr-task-context`,value:x,placeholder:i.contextPlaceholder,onChange:e=>s(e.target.value)}),n.ready?null:(0,D.jsx)(`div`,{className:`inline-warning`,role:`status`,children:n.detail}),(0,D.jsx)(`button`,{type:`submit`,className:`primary`,disabled:!g||!x.trim()||_||!n.ready,children:(0,D.jsx)(`span`,{children:_?t.workspace.createSession:i.generate(C.outputKind)})})]})]})}function U(e,t,n){let r=t.find(t=>t.id===e.capabilityTemplateId);return r?d(r,n).name:e.capabilityTemplateId.replace(/-/g,` `)}var W={actionLabels:{},actionComposerEmpty:`Select a profile`,actionMeta:(e,t)=>`${e} / ${t}`,actionComposerDetail:e=>`Prepare the next reviewable profile action for ${e}.`,actionComposerTitle:`Profile Actions`,artifactPatches:`artifact proposals`,artifactPreviewDetail:`Latest reviewable change proposal rendered from the workspace file.`,artifactPreviewEmpty:`No proposed change yet.`,artifactPreviewError:`Proposed change preview is unavailable.`,artifactPreviewLoading:`Loading proposed change...`,artifactPreviewTitle:`Proposed Change`,artifactTargetLabel:`Artifact proposal target`,approveProfileRevision:`Approve Profile Revision`,approvingProfileRevision:`Approving Profile Revision`,commandDetail:(e,t)=>`${e}: ${t}. Keep evidence, next step, review, and memory status connected.`,contextLabel:`Context for the next profile proposal`,contextPlaceholder:`Describe this person, lifecycle moment, evidence, open questions, or the next HR artifact...`,currentProfileEmpty:`No accepted profile summary yet. Approve a proposed change to update README.md.`,currentProfileError:`Current profile summary is unavailable.`,currentProfileLoading:`Loading current profile summary...`,emptyProfileBody:`Create a profile workspace to start connecting evidence, next steps, review, and memory.`,emptyProfileTitle:`No people profiles yet`,evidenceConnectors:`Evidence connectors`,generate:e=>`Generate ${e}`,guardrailsDetail:`Review before memory`,guardrailsTitle:`Review guardrails`,headerFallback:`People Profiles`,hideProfileList:`Hide Profile List`,hideProfileTools:`Hide Profile Tools`,humanDecisionTag:`human decision`,latestSession:e=>`Latest session ${e}.`,lifecycleFilterLabel:`Lifecycle filters`,lifecycleFilters:{all:`All people`,alumni:`Alumni`,attention:`Needs attention`,candidate:`Candidates`,employee:`Employees`},lifecycleLabels:{alumni:`Alumni`,candidate:`Candidate`,employee:`Employee`},memoryCandidates:`memory candidates`,metrics:(e,t,n)=>[`${e} profiles`,`${t} artifacts`,`${n} lessons`],metricsLabel:`HR workbench metrics`,moments:{artifactReady:`Artifact ready for review`,checkinNeeded:`Check-in needed`,inProgress:`Session in progress`,intakeNeeded:`Profile intake needed`,offboardingNeeded:`Offboarding notes needed`,reviewed:`Reviewed`,riskReview:`Risk review needed`},newProfile:`New profile`,nextLabel:`Next`,nextSteps:{captureMemory:`Capture lesson candidate`,checkin:`Prepare check-in`,completeArtifact:`Complete proposal`,offboarding:`Prepare offboarding summary`,profileSnapshot:`Summarize profile`,requestReview:`Request review`,resolveRisk:`Resolve risk`},noSessionYet:`No session yet`,noTimeline:`Select or create a profile to build the timeline.`,noProfilesInSection:`No profiles in this section.`,noRecentSessions:`No agent sessions for this profile yet.`,openSession:e=>`Open ${e} session`,openLatestSession:`Open latest session`,openProfile:e=>`Open ${e} profile`,profileDetailsDetail:e=>`${e} accepted README profile, evidence, proposed changes, and review state.`,profileDetailsEmpty:`Select a people profile to inspect its accepted README profile and proposed changes.`,profileDetailsTitle:`Current Profile Summary`,profileBoardDetail:e=>`${e} visible profiles`,profileBoardLabel:`People Profiles`,profileBoardTitle:`People Profiles`,profileListDetail:e=>`${e} visible profiles`,profileListSearchLabel:`Search people profiles`,profileListSearchPlaceholder:`Search people...`,recentSessionsDetail:e=>`${e} profile sessions`,recentSessionsTitle:`Recent Sessions`,proposalComposerDetail:`Agent output remains a reviewable proposal tied to this profile.`,proposalComposerTitle:`Proposal Composer`,promoteProfileRevisionHint:`Review accepts this proposal into README.md and records a git revision.`,proposalOnly:`Agent output remains a proposal until review.`,recommended:`Recommended`,reviewGuardrails:[`Evidence is tied to role-related or lifecycle-relevant criteria and source references.`,`Missing, weak, and conflicting signals are visible.`,`Sensitive details are not promoted into durable memory without review.`,`Hiring and employment decisions remain explicitly human-owned.`],reviewStatus:e=>e===`pass`?`reviewed`:e===`warn`?`review warnings`:e===`fail`?`review failed`:`needs review`,selectProfileFirst:`Select a profile card before generating a proposal.`,sessionLoops:`session loops`,showProfileList:`Show Profile List`,showProfileTools:`Show Profile Tools`,sourceCards:(e,t,n)=>[{count:e,detail:`reviewable outputs`,label:`Artifact evidence`},{count:t,detail:`profile work loops`,label:`Session context`},{count:n,detail:`human checks`,label:`Review records`}],sourcesDetail:`Selected profile inventory`,sourcesTitle:`Profile sources`,suggestedToolsTitle:`Suggested Profile Actions`,status:{evidenceMissing:`needs evidence`,evidenceReady:`evidence ready`},timelineLabels:{artifact:`Artifact`,memory:`Memory`,profile:`Profile`,review:`Review`,session:`Session`},timelineLessonCount:e=>`${e} memory candidates`,timelineReviewCount:e=>`${e} review records`,timelineTitle:`Profile timeline`,timelineUpdated:e=>`Updated ${e}`,workbenchPanelControlsLabel:`Workbench panel controls`,workbenchTitle:`People Workbench`},G={actionLabels:{"build-evidence-matrix":`构建证据矩阵`,"check-risky-wording":`检查风险表述`,"draft-interview-kit":`生成面试提纲`,"draft-onboarding-plan":`生成入职计划`,"extract-evidence":`抽取人员证据`,"prepare-next-step":`准备下一步触点`,"prepare-offboarding-summary":`准备离职交接`,"summarize-profile":`生成人员档案`},actionComposerEmpty:`选择一个人员档案`,actionMeta:(e,t)=>`${K(e)} / ${t}`,actionComposerDetail:e=>`为 ${e} 准备下一步档案操作。`,actionComposerTitle:`档案操作`,artifactPatches:`产物提案`,artifactPreviewDetail:`从 workspace 文件渲染最近一份可 review 的档案变更提案。`,artifactPreviewEmpty:`还没有可预览的变更提案。`,artifactPreviewError:`变更提案预览暂不可用。`,artifactPreviewLoading:`正在加载变更提案...`,artifactPreviewTitle:`变更提案`,artifactTargetLabel:`产物提案目标`,approveProfileRevision:`批准档案修订`,approvingProfileRevision:`正在批准档案修订`,commandDetail:(e,t)=>`${e}:${t}。证据、下一步、review 和 memory 状态保持在同一个闭环里。`,contextLabel:`下一份人员提案上下文`,contextPlaceholder:`描述这个人、生命周期节点、证据、开放问题,或下一份 HR 产物目标...`,currentProfileEmpty:`还没有已接受的档案摘要。批准一份变更提案后会更新 README.md。`,currentProfileError:`当前档案摘要暂不可用。`,currentProfileLoading:`正在加载当前档案摘要...`,emptyProfileBody:`创建人员档案工作区后,再把证据、下一步、review 和 memory 串起来。`,emptyProfileTitle:`还没有人员档案`,evidenceConnectors:`证据连接器`,generate:e=>`生成 ${e}`,guardrailsDetail:`先复核,再沉淀组织记忆`,guardrailsTitle:`Review 护栏`,headerFallback:`人员档案`,hideProfileList:`隐藏 Profile List`,hideProfileTools:`隐藏 Profile Tools`,humanDecisionTag:`人类决策`,latestSession:e=>`最近 session ${e}。`,lifecycleFilterLabel:`生命周期筛选`,lifecycleFilters:{all:`全部人员`,alumni:`离职 / Alumni`,attention:`需要关注`,candidate:`候选人`,employee:`在职员工`},lifecycleLabels:{alumni:`离职`,candidate:`候选人`,employee:`在职`},memoryCandidates:`memory 候选`,metrics:(e,t,n)=>[`${e} 个人员档案`,`${t} 个产物`,`${n} 条 lesson`],metricsLabel:`HR 工作台指标`,moments:{artifactReady:`产物可 review`,checkinNeeded:`需要 check-in`,inProgress:`session 进行中`,intakeNeeded:`需要补齐档案`,offboardingNeeded:`需要离职交接记录`,reviewed:`已 review`,riskReview:`需要风险复核`},newProfile:`新建人员档案`,nextLabel:`下一步`,nextSteps:{captureMemory:`沉淀 lesson 候选`,checkin:`准备 check-in`,completeArtifact:`补齐产物提案`,offboarding:`准备离职交接`,profileSnapshot:`生成人员档案`,requestReview:`请求 review`,resolveRisk:`处理风险`},noSessionYet:`还没有 session`,noTimeline:`选择或创建人员档案后开始形成时间线。`,noProfilesInSection:`这个分组里还没有人员档案。`,noRecentSessions:`这个人员档案还没有 agent session。`,openSession:e=>`打开 ${e} session`,openLatestSession:`打开最近 session`,openProfile:e=>`打开 ${e} 档案`,profileDetailsDetail:e=>`${e} 的已接受 README 档案、证据、变更提案和 review 状态。`,profileDetailsEmpty:`选择一个人员档案后查看已接受 README 档案和变更提案。`,profileDetailsTitle:`当前档案摘要`,profileBoardDetail:e=>`${e} 个可见档案`,profileBoardLabel:`人员档案`,profileBoardTitle:`人员档案`,profileListDetail:e=>`${e} 个可见档案`,profileListSearchLabel:`搜索人员档案`,profileListSearchPlaceholder:`搜索人员...`,recentSessionsDetail:e=>`${e} 个 profile session`,recentSessionsTitle:`Recent Sessions`,proposalComposerDetail:`Agent 输出只作为绑定此档案的可 review 提案。`,proposalComposerTitle:`产物提案`,promoteProfileRevisionHint:`Review 通过后会把这份提案写入 README.md,并记录 git 修订。`,proposalOnly:`Agent 输出在 review 前都只是提案。`,recommended:`建议`,reviewGuardrails:[`证据必须绑定岗位相关或生命周期相关标准和来源引用。`,`缺失、薄弱和冲突信号必须保持可见。`,`敏感信息未经 review 不进入 durable memory。`,`招聘和雇佣决策必须明确由人类负责。`],reviewStatus:e=>e===`pass`?`已 review`:e===`warn`?`review 有警告`:e===`fail`?`review 未通过`:`待 review`,selectProfileFirst:`先选择一个人员档案卡片,再生成提案。`,sessionLoops:`session 循环`,showProfileList:`显示 Profile List`,showProfileTools:`显示 Profile Tools`,sourceCards:(e,t,n)=>[{count:e,detail:`可 review 的输出`,label:`产物证据`},{count:t,detail:`人员工作循环`,label:`Session 上下文`},{count:n,detail:`人工质量检查`,label:`Review 记录`}],sourcesDetail:`所选人员证据库存`,sourcesTitle:`档案来源`,suggestedToolsTitle:`建议档案操作`,status:{evidenceMissing:`需要证据`,evidenceReady:`证据就绪`},timelineLabels:{artifact:`产物`,memory:`Memory`,profile:`档案`,review:`Review`,session:`Session`},timelineLessonCount:e=>`${e} 条 memory 候选`,timelineReviewCount:e=>`${e} 条 review 记录`,timelineTitle:`档案时间线`,timelineUpdated:e=>`更新于 ${e}`,workbenchPanelControlsLabel:`工作台面板控制`,workbenchTitle:`People Workbench`};function ce(e){return e===`zh-CN`?G:W}function K(e){switch(e){case`alumni`:return`离职`;case`artifact`:return`产物`;case`candidate`:return`候选人`;case`employee`:return`员工`;case`interview`:return`面试`;case`lifecycle`:return`生命周期`;case`person`:return`人员`;case`pool`:return`候选池`;case`role`:return`岗位`}}function q({context:{artifactPreview:e,artifacts:t,copy:o,engineReadiness:s,lessons:c,locale:u,onActionSelect:d,onOpenConnectors:f,onContextChange:m,onCreateWorkspace:g,onOpenSession:v,onOpenSettings:y,onOpenWorkspace:b,onPromoteProfileRevision:x,onRefresh:S,onSubmitSession:C,onTemplateChange:T,profilePreview:O,profileRevisionSubmitting:k,reviews:A,selectedArtifact:j,selectedTemplate:M,selectedWorkspace:N,shellHeader:P,sessions:F,soulCopy:I,submitting:L,templates:R,value:z,workbench:B,workerName:V,workspaces:H}}){let U=ce(u),[W,G]=(0,E.useState)(``),[K,q]=(0,E.useState)(!0),[J,Y]=(0,E.useState)(!0),[ue,de]=(0,E.useState)(()=>new Set([`employee`,`alumni`])),X=(0,E.useMemo)(()=>re(H,F,t,A,c,U,u),[t,U,c,u,A,F,H]),Z=(0,E.useMemo)(()=>X.filter(e=>le(e,W)),[W,X]),fe=(0,E.useMemo)(()=>ie(Z,U),[U,Z]),Q=(N?X.find(e=>e.id===N.id)??null:null)??X[0]??null,pe=u===`zh-CN`?U.reviewGuardrails:B.reviewChecklist.slice(0,4),me=ae(B.actions,Q),he=Q?oe(Q,U,u):[],ge=e=>{de(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};async function $(e){if((await P?.onAction(e))?.ok){if(e.slot===`primary`){g();return}if(e.slot===`drawer-toggle`){Y(e=>!e);return}e.slot===`settings`&&y()}}function _e(e){let t=P?.busyActionId===e.id,n=e.slot===`settings`?r:e.slot===`refresh`?_:e.slot===`drawer-toggle`?h:i;return(0,D.jsxs)(`button`,{"aria-busy":t,className:`shell-primary-action`,disabled:!!P?.busyActionId,title:`Provided by the Soul App protocol`,type:`button`,onClick:()=>void $(e),children:[(0,D.jsx)(n,{"aria-hidden":`true`,size:14}),(0,D.jsx)(`span`,{children:e.label})]},e.id)}return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`header`,{className:`entry-header workspace-header hr-people-header`,children:[(0,D.jsxs)(`div`,{className:`hr-header-main`,children:[(0,D.jsx)(`span`,{className:`kicker`,children:`${I.name} / ${B.name}`}),(0,D.jsx)(`h1`,{children:U.workbenchTitle}),(0,D.jsx)(`p`,{children:Q?U.commandDetail(Q.name,Q.moment):`${V} ${U.headerFallback}`})]}),(0,D.jsxs)(`div`,{className:`entry-header-right hr-header-actions`,children:[P?.search??(0,D.jsxs)(`label`,{className:`hr-profile-search`,children:[(0,D.jsx)(l,{"aria-hidden":`true`,size:14}),(0,D.jsx)(`span`,{className:`sr-only`,children:U.profileListSearchLabel}),(0,D.jsx)(`input`,{value:W,placeholder:U.profileListSearchPlaceholder,onChange:e=>G(e.target.value)})]}),(0,D.jsx)(`div`,{className:`hr-header-metrics`,"aria-label":U.metricsLabel,children:U.metrics(X.length,t.length,c.length).map(e=>(0,D.jsx)(`span`,{children:e},e))}),P?P.actionDescriptors.map(_e):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`button`,{type:`button`,className:`primary hr-header-command`,onClick:g,children:[(0,D.jsx)(i,{"aria-hidden":`true`,size:14}),(0,D.jsx)(`span`,{children:U.newProfile})]}),(0,D.jsxs)(`button`,{type:`button`,className:`ghost hr-header-command`,onClick:f,children:[(0,D.jsx)(h,{"aria-hidden":`true`,size:14}),(0,D.jsx)(`span`,{children:U.evidenceConnectors})]})]}),(0,D.jsxs)(`div`,{className:`hr-header-icon-group`,"aria-label":U.workbenchPanelControlsLabel,children:[(0,D.jsx)(n,{"aria-label":K?U.hideProfileList:U.showProfileList,"aria-pressed":K,onClick:()=>q(e=>!e),children:K?(0,D.jsx)(w,{"aria-hidden":`true`,size:16}):(0,D.jsx)(ee,{"aria-hidden":`true`,size:16})}),(0,D.jsx)(n,{"aria-label":J?U.hideProfileTools:U.showProfileTools,"aria-pressed":J,onClick:()=>Y(e=>!e),children:J?(0,D.jsx)(p,{"aria-hidden":`true`,size:16}):(0,D.jsx)(a,{"aria-hidden":`true`,size:16})}),P?.actionSlots.has(`refresh`)?null:(0,D.jsx)(n,{"aria-label":o.accessibility.refreshWorkspace,onClick:S,children:(0,D.jsx)(_,{"aria-hidden":`true`,size:16})}),P?.actionSlots.has(`settings`)?null:(0,D.jsx)(n,{"aria-label":o.accessibility.openSettings,onClick:y,children:(0,D.jsx)(r,{"aria-hidden":`true`,size:16})})]})]})]}),P?.status,P?.results,(0,D.jsx)(`div`,{className:`entry-tab-content workspace-content hr-people-content`,"data-testid":`hr-people-workbench`,children:(0,D.jsxs)(`div`,{className:`hr-people-layout ${K?``:`without-profile-list`} ${J?``:`without-profile-tools`}`,children:[K?(0,D.jsx)(ne,{collapsedSectionIds:ue,labels:U,sections:fe,selectedWorkspaceId:N?.id??null,visibleCount:Z.length,onOpenWorkspace:b,onToggleSection:ge}):null,(0,D.jsx)(te,{artifact:j,artifactPreview:e,focusedProfile:Q,labels:U,locale:u,profilePreview:O,profileRevisionSubmitting:k,reviewGuardrails:pe,timeline:he,onPromoteProfileRevision:x}),J?(0,D.jsx)(se,{activeActions:me,copy:o,engineReadiness:s,focusedProfile:Q,labels:U,locale:u,selectedTemplate:M,selectedWorkspace:N,submitting:L,templates:R,value:z,onActionSelect:d,onContextChange:m,onOpenSession:v,onSubmitSession:C,onTemplateChange:T}):null]})})]})}function le(e,t){let n=t.trim().toLowerCase();return n?[e.name,e.detail,e.moment,e.nextStep,e.status,e.reviewStatus,e.lifecycle].some(e=>e.toLowerCase().includes(n)):!0}export{q as HrPeopleWorkbench};
|
|
1
|
+
import{i as e,n as t}from"./markdown-preview-DFe-rfff.js";import{a as n,c as r,d as i,f as a,g as o,h as s,i as c,l,m as u,n as d,o as f,p,r as m,s as h,t as g,u as _}from"./index-D-3jVGvl.js";var v=o(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),y=o(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),b=o(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),x=o(`list-checks`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]),S=o(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),C=o(`notebook-text`,[[`path`,{d:`M2 6h4`,key:`aawbzj`}],[`path`,{d:`M2 10h4`,key:`l0bgd4`}],[`path`,{d:`M2 14h4`,key:`1gsvsf`}],[`path`,{d:`M2 18h4`,key:`1bu2t1`}],[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,key:`1nb95v`}],[`path`,{d:`M9.5 8h5`,key:`11mslq`}],[`path`,{d:`M9.5 12H16`,key:`ktog6x`}],[`path`,{d:`M9.5 16H14`,key:`p1seyn`}]]),w=o(`panel-left-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m16 15-3-3 3-3`,key:`14y99z`}]]),ee=o(`panel-left-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]]),T=o(`users-round`,[[`path`,{d:`M18 21a8 8 0 0 0-16 0`,key:`3ypg7q`}],[`circle`,{cx:`10`,cy:`8`,r:`5`,key:`o932ke`}],[`path`,{d:`M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3`,key:`10s06x`}]]),E=e(),D=t();function O({detail:e,icon:t,title:n}){return(0,D.jsxs)(`div`,{className:`workbench-section-title`,children:[(0,D.jsx)(`span`,{className:`workbench-section-icon`,"aria-hidden":`true`,children:t}),(0,D.jsxs)(`span`,{children:[(0,D.jsx)(`strong`,{children:n}),(0,D.jsx)(`small`,{children:e})]})]})}var k=(0,E.lazy)(()=>g(()=>import(`./markdown-preview-DFe-rfff.js`).then(e=>e.t).then(e=>({default:e.MarkdownPreview})),[]));function te({artifact:e,artifactPreview:t,focusedProfile:n,labels:r,locale:i,onPromoteProfileRevision:a,profilePreview:o,profileRevisionSubmitting:s,reviewGuardrails:c,timeline:l}){let d=!!(e&&t.artifactId===e.id),f=!!(n&&o.workspaceId===n.id);return(0,D.jsxs)(`section`,{className:`hr-profile-details`,"aria-label":r.profileDetailsTitle,children:[(0,D.jsx)(O,{icon:(0,D.jsx)(C,{size:15}),title:r.profileDetailsTitle,detail:n?r.profileDetailsDetail(n.name):r.profileDetailsEmpty}),(0,D.jsxs)(`div`,{className:`hr-profile-details-scroll`,children:[(0,D.jsxs)(`article`,{className:`hr-current-profile-card`,"data-testid":`hr-current-profile-summary`,children:[(0,D.jsxs)(`div`,{className:`hr-current-profile-head`,children:[n?(0,D.jsx)(`span`,{className:`hr-profile-avatar large`,"aria-hidden":`true`,children:n.initials}):null,(0,D.jsxs)(`span`,{children:[(0,D.jsx)(`strong`,{children:n?.name??r.profileDetailsTitle}),(0,D.jsx)(`small`,{children:`README.md`})]})]}),A({empty:r.currentProfileEmpty,error:r.currentProfileError,loading:r.currentProfileLoading,profilePreview:o,profilePreviewMatchesProfile:f})]}),(0,D.jsxs)(`div`,{className:`hr-details-grid`,children:[(0,D.jsxs)(`article`,{className:`hr-details-card`,children:[(0,D.jsx)(O,{icon:(0,D.jsx)(u,{size:15}),title:r.sourcesTitle,detail:r.sourcesDetail}),(0,D.jsx)(`div`,{className:`hr-source-grid`,children:r.sourceCards(n?.artifacts.length??0,n?.sessions.length??0,n?.reviews.length??0).map(e=>(0,D.jsxs)(`div`,{className:`hr-source-row`,children:[(0,D.jsx)(`span`,{children:e.label}),(0,D.jsx)(`strong`,{children:e.count}),(0,D.jsx)(`small`,{children:e.detail})]},e.label))}),(0,D.jsxs)(`div`,{className:`hr-profile-timeline`,"aria-label":r.timelineTitle,children:[(0,D.jsx)(`strong`,{children:r.timelineTitle}),l.length>0?l.map(e=>(0,D.jsxs)(`div`,{className:`hr-timeline-row`,children:[(0,D.jsx)(`span`,{className:`hr-timeline-dot ${e.tone}`,"aria-hidden":`true`}),(0,D.jsxs)(`span`,{children:[(0,D.jsx)(`strong`,{children:e.label}),(0,D.jsx)(`small`,{children:e.detail})]})]},`${e.label}-${e.detail}`)):(0,D.jsx)(`span`,{className:`hr-muted-note`,children:r.noTimeline})]})]}),(0,D.jsxs)(`article`,{className:`hr-details-card hr-artifact-preview-card`,"data-testid":`hr-proposed-change`,children:[(0,D.jsx)(O,{icon:(0,D.jsx)(u,{size:15}),title:r.artifactPreviewTitle,detail:e?m(e.updatedAt,i):r.artifactPreviewDetail}),e?(0,D.jsx)(`strong`,{className:`hr-artifact-preview-name`,children:e.title}):null,j({artifact:e,artifactPreview:t,empty:r.artifactPreviewEmpty,error:r.artifactPreviewError,loading:r.artifactPreviewLoading,previewMatchesArtifact:d}),(0,D.jsxs)(`div`,{className:`hr-proposed-change-actions`,children:[(0,D.jsx)(`span`,{className:`hr-muted-note`,children:r.promoteProfileRevisionHint}),(0,D.jsxs)(`button`,{type:`button`,className:`secondary hr-profile-promote-button`,disabled:!e||s,onClick:()=>void a(),children:[(0,D.jsx)(y,{"aria-hidden":`true`,size:14}),(0,D.jsx)(`span`,{children:s?r.approvingProfileRevision:r.approveProfileRevision})]})]})]})]}),(0,D.jsxs)(`div`,{className:`hr-guardrail-panel`,children:[(0,D.jsx)(O,{icon:(0,D.jsx)(x,{size:15}),title:r.guardrailsTitle,detail:r.guardrailsDetail}),(0,D.jsx)(`ul`,{className:`hr-guardrail-list`,children:c.map(e=>(0,D.jsx)(`li`,{children:e},e))})]})]})]})}function A({empty:e,error:t,loading:n,profilePreview:r,profilePreviewMatchesProfile:i}){return!i||r.loading?(0,D.jsx)(`div`,{className:`hr-artifact-preview-empty`,children:n}):r.error?(0,D.jsx)(`div`,{className:`hr-artifact-preview-empty`,role:`alert`,children:`${t} ${r.error}`}):(0,D.jsx)(E.Suspense,{fallback:(0,D.jsx)(`div`,{className:`hr-markdown-preview hr-current-profile-markdown`,"data-testid":`hr-current-profile-markdown-loading`}),children:(0,D.jsx)(k,{className:`hr-markdown-preview hr-current-profile-markdown`,content:r.content,"data-testid":`hr-current-profile-markdown`,empty:(0,D.jsx)(`span`,{children:e})})})}function j({artifact:e,artifactPreview:t,empty:n,error:r,loading:i,previewMatchesArtifact:a}){return e?!a||t.loading?(0,D.jsx)(`div`,{className:`hr-artifact-preview-empty`,children:i}):t.error?(0,D.jsx)(`div`,{className:`hr-artifact-preview-empty`,role:`alert`,children:`${r} ${t.error}`}):(0,D.jsx)(E.Suspense,{fallback:(0,D.jsx)(`div`,{className:`hr-markdown-preview`,"data-testid":`hr-artifact-markdown-preview-loading`}),children:(0,D.jsx)(k,{className:`hr-markdown-preview`,content:t.content,"data-testid":`hr-artifact-markdown-preview`,empty:(0,D.jsx)(`span`,{children:n})})}):(0,D.jsx)(`div`,{className:`hr-artifact-preview-empty`,children:n})}function ne({collapsedSectionIds:e,labels:t,onOpenWorkspace:n,onToggleSection:r,sections:i,selectedWorkspaceId:a,visibleCount:o}){return(0,D.jsxs)(`aside`,{className:`hr-profile-list-panel`,"aria-label":t.profileBoardLabel,children:[(0,D.jsx)(O,{icon:(0,D.jsx)(T,{size:15}),title:t.profileBoardTitle,detail:t.profileListDetail(o)}),(0,D.jsx)(`div`,{className:`hr-profile-list-scroll`,children:i.map(i=>{let o=e.has(i.id);return(0,D.jsxs)(`section`,{className:`hr-profile-list-section`,children:[(0,D.jsxs)(`button`,{type:`button`,className:`hr-profile-section-toggle`,"aria-expanded":!o,onClick:()=>r(i.id),children:[(0,D.jsx)(`span`,{children:(0,D.jsx)(`strong`,{children:i.label})}),(0,D.jsx)(`span`,{className:`hr-section-count`,children:i.profiles.length}),(0,D.jsx)(s,{"aria-hidden":`true`,size:14})]}),o?null:(0,D.jsx)(`div`,{className:`hr-profile-section-drawer`,children:i.profiles.length>0?i.profiles.map(e=>(0,D.jsx)(M,{labels:t,profile:e,selected:a===e.id,onOpenWorkspace:n},`${i.id}-${e.id}`)):(0,D.jsx)(`span`,{className:`hr-profile-section-empty`,children:t.noProfilesInSection})})]},i.id)})})]})}function M({labels:e,onOpenWorkspace:t,profile:n,selected:r}){return(0,D.jsxs)(`button`,{type:`button`,className:`hr-profile-list-card ${n.lifecycle} ${r?`active`:``}`,"aria-label":e.openProfile(n.name),onClick:()=>t(n.workspace),children:[(0,D.jsxs)(`span`,{className:`hr-profile-list-card-main`,children:[(0,D.jsxs)(`span`,{className:`hr-profile-list-card-copy`,children:[(0,D.jsx)(`strong`,{children:n.name}),(0,D.jsx)(`small`,{children:n.detail})]}),(0,D.jsx)(`span`,{className:`workbench-status-cell ${n.statusTone}`,children:e.lifecycleLabels[n.lifecycle]})]}),(0,D.jsxs)(`span`,{className:`hr-profile-list-card-status`,children:[(0,D.jsx)(`small`,{children:n.moment}),(0,D.jsx)(`strong`,{children:n.nextStep})]})]})}function re(e,t,n,r,i,a,o){return e.map(e=>{let o=t.filter(t=>t.workspaceId===e.id),s=n.filter(t=>t.workspaceId===e.id),c=r.filter(t=>t.workspaceId===e.id),l=i.filter(t=>t.workspaceId===e.id),u=N(e,o,s),d=o.slice().sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt))[0]??null,f=s.length>0,p=L(c),m=d?.status===`failed`?`risk`:f?`good`:`warn`,h=z(p);return{artifacts:s,detail:d?V(d):a.noSessionYet,evidenceTone:m,id:e.id,initials:B(e.name),latestSession:d,lessons:l,lifecycle:u,moment:P(u,o,s,p,a),name:e.name,nextStep:F(u,o,s,p,a),reviews:c,reviewState:p,reviewStatus:a.reviewStatus(p),reviewTone:h,sessions:o,status:f?a.status.evidenceReady:a.status.evidenceMissing,statusTone:m,workspace:{...e,updatedAt:e.updatedAt||new Date().toISOString()}}}).sort((e,t)=>{let n=+!!I(e),r=+!!I(t);return n===r?t.workspace.updatedAt.localeCompare(e.workspace.updatedAt):r-n}).map(e=>({...e,detail:`${e.detail} · ${m(e.workspace.updatedAt,o)}`}))}function N(e,t,n){let r=[e.name,e.type,...t.map(e=>`${e.title} ${e.capabilityTemplateId}`),...n.map(e=>`${e.kind} ${e.title}`)].join(` `).toLowerCase();return/alumni|offboard|depart|exit|handoff|离职|交接|校友/.test(r)?`alumni`:/employee|onboard|new hire|check.?in|growth|retention|员工|入职|在职|试用/.test(r)?`employee`:`candidate`}function P(e,t,n,r,i){if(t.some(e=>e.status===`failed`)||r===`fail`)return i.moments.riskReview;if(R(r))return i.moments.reviewed;if(n.length>0)return i.moments.artifactReady;if(t.length>0)return i.moments.inProgress;switch(e){case`alumni`:return i.moments.offboardingNeeded;case`employee`:return i.moments.checkinNeeded;case`candidate`:return i.moments.intakeNeeded}}function F(e,t,n,r,i){if(t.some(e=>e.status===`failed`)||r===`fail`)return i.nextSteps.resolveRisk;if(n.length>0&&!R(r))return i.nextSteps.requestReview;if(R(r))return i.nextSteps.captureMemory;if(t.length>0)return i.nextSteps.completeArtifact;switch(e){case`alumni`:return i.nextSteps.offboarding;case`employee`:return i.nextSteps.checkin;case`candidate`:return i.nextSteps.profileSnapshot}}function ie(e,t){return[{id:`candidate`,label:t.lifecycleFilters.candidate,profiles:e.filter(e=>e.lifecycle===`candidate`)},{id:`employee`,label:t.lifecycleFilters.employee,profiles:e.filter(e=>e.lifecycle===`employee`)},{id:`alumni`,label:t.lifecycleFilters.alumni,profiles:e.filter(e=>e.lifecycle===`alumni`)}]}function I(e){return e.sessions.length===0||e.artifacts.length===0||e.latestSession?.status===`failed`||e.reviewTone!==`good`}function L(e){return e.slice().sort((e,t)=>t.createdAt.localeCompare(e.createdAt))[0]?.verdict??`none`}function R(e){return e===`pass`||e===`warn`}function z(e){return e===`pass`?`good`:e===`fail`?`risk`:`warn`}function ae(e,t){let n=t?.lifecycle===`employee`?[`prepare-next-step`,`draft-onboarding-plan`,`summarize-profile`,`check-risky-wording`]:t?.lifecycle===`alumni`?[`prepare-offboarding-summary`,`summarize-profile`,`prepare-next-step`,`check-risky-wording`]:[`summarize-profile`,`extract-evidence`,`draft-interview-kit`,`build-evidence-matrix`],r=new Map(n.map((e,t)=>[e,t]));return e.slice().sort((e,t)=>(r.get(e.id)??99)-(r.get(t.id)??99)).slice(0,5)}function oe(e,t,n){let r=[{detail:t.timelineUpdated(m(e.workspace.updatedAt,n)),label:t.timelineLabels.profile,tone:`muted`}];e.latestSession&&r.push({detail:`${e.latestSession.title} · ${c(e.latestSession.status,n)}`,label:t.timelineLabels.session,tone:e.latestSession.status===`failed`?`risk`:`good`});let i=e.artifacts.slice().sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt))[0];return i&&r.push({detail:i.title,label:t.timelineLabels.artifact,tone:`good`}),e.reviews.length>0&&r.push({detail:t.timelineReviewCount(e.reviews.length),label:t.timelineLabels.review,tone:`good`}),e.lessons.length>0&&r.push({detail:t.timelineLessonCount(e.lessons.length),label:t.timelineLabels.memory,tone:`warn`}),r.slice(0,5)}function B(e){let t=e.trim().split(/\s+/).filter(Boolean);return t.length>=2?`${t[0]?.[0]??``}${t[1]?.[0]??``}`.toUpperCase():Array.from(e.trim()).slice(0,2).join(``).toUpperCase()||`HR`}function V(e){return e.capabilityTemplateId.replace(/-/g,` `)}function H(e,t){return t.actionLabels[e.id]??e.label}function se({activeActions:e,copy:t,engineReadiness:n,focusedProfile:r,labels:i,locale:a,onActionSelect:o,onContextChange:s,onOpenSession:l,onSubmitSession:u,onTemplateChange:p,selectedTemplate:h,selectedWorkspace:g,submitting:_,templates:y,value:x}){let C=d(h,a),w=r?.sessions.slice().sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt)).slice(0,3)??[];return(0,D.jsxs)(`aside`,{className:`hr-profile-tools-panel`,"aria-label":i.actionComposerTitle,children:[(0,D.jsx)(O,{icon:(0,D.jsx)(f,{size:15}),title:i.actionComposerTitle,detail:r?i.actionComposerDetail(r.name):i.actionComposerEmpty}),(0,D.jsxs)(`div`,{className:`hr-profile-tools-scroll`,children:[r?(0,D.jsxs)(`div`,{className:`hr-action-profile-card`,children:[(0,D.jsx)(`span`,{className:`hr-profile-avatar large`,"aria-hidden":`true`,children:r.initials}),(0,D.jsxs)(`span`,{children:[(0,D.jsx)(`strong`,{children:r.name}),(0,D.jsx)(`small`,{children:`${i.lifecycleLabels[r.lifecycle]} · ${r.moment}`})]})]}):null,(0,D.jsxs)(`section`,{className:`hr-tool-section`,"aria-label":i.recentSessionsTitle,children:[(0,D.jsx)(O,{icon:(0,D.jsx)(S,{size:15}),title:i.recentSessionsTitle,detail:i.recentSessionsDetail(w.length)}),(0,D.jsx)(`div`,{className:`hr-session-card-list`,children:w.length>0?w.map(e=>(0,D.jsxs)(`button`,{type:`button`,className:`hr-session-card`,"aria-label":i.openSession(e.title),onClick:()=>l(e),children:[(0,D.jsxs)(`span`,{children:[(0,D.jsx)(`strong`,{children:e.title}),(0,D.jsx)(`small`,{children:U(e,y,a)})]}),(0,D.jsxs)(`span`,{className:`hr-session-card-meta`,children:[(0,D.jsx)(`em`,{children:c(e.status,a)}),(0,D.jsxs)(`small`,{children:[(0,D.jsx)(b,{"aria-hidden":`true`,size:12}),m(e.updatedAt,a)]})]})]},e.id)):(0,D.jsx)(`span`,{className:`hr-profile-section-empty`,children:i.noRecentSessions})})]}),(0,D.jsxs)(`section`,{className:`hr-tool-section`,"aria-label":i.suggestedToolsTitle,children:[(0,D.jsx)(O,{icon:(0,D.jsx)(f,{size:15}),title:i.suggestedToolsTitle,detail:i.proposalOnly}),(0,D.jsx)(`div`,{className:`hr-action-list`,children:e.map((e,t)=>(0,D.jsxs)(`button`,{type:`button`,className:`hr-action-row ${t===0?`suggested`:``}`,disabled:!g,onClick:()=>o(e),children:[(0,D.jsxs)(`span`,{children:[(0,D.jsx)(`strong`,{children:H(e,i)}),(0,D.jsx)(`small`,{children:i.actionMeta(e.scope,e.outputKind)})]}),t===0?(0,D.jsx)(`em`,{children:i.recommended}):(0,D.jsx)(v,{"aria-hidden":`true`,size:14})]},e.id))})]})]}),(0,D.jsxs)(`form`,{className:`hr-task-composer`,onSubmit:u,children:[(0,D.jsxs)(`div`,{className:`hr-composer-heading`,children:[(0,D.jsx)(`strong`,{children:i.proposalComposerTitle}),(0,D.jsx)(`small`,{children:g?i.proposalComposerDetail:i.selectProfileFirst})]}),(0,D.jsx)(`label`,{htmlFor:`hr-task-template`,children:i.artifactTargetLabel}),(0,D.jsx)(`select`,{id:`hr-task-template`,value:h.id,onChange:e=>p(e.target.value),children:y.map(e=>(0,D.jsx)(`option`,{value:e.id,children:d(e,a).name},e.id))}),(0,D.jsx)(`label`,{htmlFor:`hr-task-context`,children:i.contextLabel}),(0,D.jsx)(`textarea`,{id:`hr-task-context`,value:x,placeholder:i.contextPlaceholder,onChange:e=>s(e.target.value)}),n.ready?null:(0,D.jsx)(`div`,{className:`inline-warning`,role:`status`,children:n.detail}),(0,D.jsx)(`button`,{type:`submit`,className:`primary`,disabled:!g||!x.trim()||_||!n.ready,children:(0,D.jsx)(`span`,{children:_?t.workspace.createSession:i.generate(C.outputKind)})})]})]})}function U(e,t,n){let r=t.find(t=>t.id===e.capabilityTemplateId);return r?d(r,n).name:e.capabilityTemplateId.replace(/-/g,` `)}var W={actionLabels:{},actionComposerEmpty:`Select a profile`,actionMeta:(e,t)=>`${e} / ${t}`,actionComposerDetail:e=>`Prepare the next reviewable profile action for ${e}.`,actionComposerTitle:`Profile Actions`,artifactPatches:`artifact proposals`,artifactPreviewDetail:`Latest reviewable change proposal rendered from the workspace file.`,artifactPreviewEmpty:`No proposed change yet.`,artifactPreviewError:`Proposed change preview is unavailable.`,artifactPreviewLoading:`Loading proposed change...`,artifactPreviewTitle:`Proposed Change`,artifactTargetLabel:`Artifact proposal target`,approveProfileRevision:`Approve Profile Revision`,approvingProfileRevision:`Approving Profile Revision`,commandDetail:(e,t)=>`${e}: ${t}. Keep evidence, next step, review, and memory status connected.`,contextLabel:`Context for the next profile proposal`,contextPlaceholder:`Describe this person, lifecycle moment, evidence, open questions, or the next HR artifact...`,currentProfileEmpty:`No accepted profile summary yet. Approve a proposed change to update README.md.`,currentProfileError:`Current profile summary is unavailable.`,currentProfileLoading:`Loading current profile summary...`,emptyProfileBody:`Create a profile workspace to start connecting evidence, next steps, review, and memory.`,emptyProfileTitle:`No people profiles yet`,evidenceConnectors:`Evidence connectors`,generate:e=>`Generate ${e}`,guardrailsDetail:`Review before memory`,guardrailsTitle:`Review guardrails`,headerFallback:`People Profiles`,hideProfileList:`Hide Profile List`,hideProfileTools:`Hide Profile Tools`,humanDecisionTag:`human decision`,latestSession:e=>`Latest session ${e}.`,lifecycleFilterLabel:`Lifecycle filters`,lifecycleFilters:{all:`All people`,alumni:`Alumni`,attention:`Needs attention`,candidate:`Candidates`,employee:`Employees`},lifecycleLabels:{alumni:`Alumni`,candidate:`Candidate`,employee:`Employee`},memoryCandidates:`memory candidates`,metrics:(e,t,n)=>[`${e} profiles`,`${t} artifacts`,`${n} lessons`],metricsLabel:`HR workbench metrics`,moments:{artifactReady:`Artifact ready for review`,checkinNeeded:`Check-in needed`,inProgress:`Session in progress`,intakeNeeded:`Profile intake needed`,offboardingNeeded:`Offboarding notes needed`,reviewed:`Reviewed`,riskReview:`Risk review needed`},newProfile:`New profile`,nextLabel:`Next`,nextSteps:{captureMemory:`Capture lesson candidate`,checkin:`Prepare check-in`,completeArtifact:`Complete proposal`,offboarding:`Prepare offboarding summary`,profileSnapshot:`Summarize profile`,requestReview:`Request review`,resolveRisk:`Resolve risk`},noSessionYet:`No session yet`,noTimeline:`Select or create a profile to build the timeline.`,noProfilesInSection:`No profiles in this section.`,noRecentSessions:`No agent sessions for this profile yet.`,openSession:e=>`Open ${e} session`,openLatestSession:`Open latest session`,openProfile:e=>`Open ${e} profile`,profileDetailsDetail:e=>`${e} accepted README profile, evidence, proposed changes, and review state.`,profileDetailsEmpty:`Select a people profile to inspect its accepted README profile and proposed changes.`,profileDetailsTitle:`Current Profile Summary`,profileBoardDetail:e=>`${e} visible profiles`,profileBoardLabel:`People Profiles`,profileBoardTitle:`People Profiles`,profileListDetail:e=>`${e} visible profiles`,profileListSearchLabel:`Search people profiles`,profileListSearchPlaceholder:`Search people...`,recentSessionsDetail:e=>`${e} profile sessions`,recentSessionsTitle:`Recent Sessions`,proposalComposerDetail:`Agent output remains a reviewable proposal tied to this profile.`,proposalComposerTitle:`Proposal Composer`,promoteProfileRevisionHint:`Review accepts this proposal into README.md and records a git revision.`,proposalOnly:`Agent output remains a proposal until review.`,recommended:`Recommended`,reviewGuardrails:[`Evidence is tied to role-related or lifecycle-relevant criteria and source references.`,`Missing, weak, and conflicting signals are visible.`,`Sensitive details are not promoted into durable memory without review.`,`Hiring and employment decisions remain explicitly human-owned.`],reviewStatus:e=>e===`pass`?`reviewed`:e===`warn`?`review warnings`:e===`fail`?`review failed`:`needs review`,selectProfileFirst:`Select a profile card before generating a proposal.`,sessionLoops:`session loops`,showProfileList:`Show Profile List`,showProfileTools:`Show Profile Tools`,sourceCards:(e,t,n)=>[{count:e,detail:`reviewable outputs`,label:`Artifact evidence`},{count:t,detail:`profile work loops`,label:`Session context`},{count:n,detail:`human checks`,label:`Review records`}],sourcesDetail:`Selected profile inventory`,sourcesTitle:`Profile sources`,suggestedToolsTitle:`Suggested Profile Actions`,status:{evidenceMissing:`needs evidence`,evidenceReady:`evidence ready`},timelineLabels:{artifact:`Artifact`,memory:`Memory`,profile:`Profile`,review:`Review`,session:`Session`},timelineLessonCount:e=>`${e} memory candidates`,timelineReviewCount:e=>`${e} review records`,timelineTitle:`Profile timeline`,timelineUpdated:e=>`Updated ${e}`,workbenchPanelControlsLabel:`Workbench panel controls`,workbenchTitle:`People Workbench`},G={actionLabels:{"build-evidence-matrix":`构建证据矩阵`,"check-risky-wording":`检查风险表述`,"draft-interview-kit":`生成面试提纲`,"draft-onboarding-plan":`生成入职计划`,"extract-evidence":`抽取人员证据`,"prepare-next-step":`准备下一步触点`,"prepare-offboarding-summary":`准备离职交接`,"summarize-profile":`生成人员档案`},actionComposerEmpty:`选择一个人员档案`,actionMeta:(e,t)=>`${K(e)} / ${t}`,actionComposerDetail:e=>`为 ${e} 准备下一步档案操作。`,actionComposerTitle:`档案操作`,artifactPatches:`产物提案`,artifactPreviewDetail:`从 workspace 文件渲染最近一份可 review 的档案变更提案。`,artifactPreviewEmpty:`还没有可预览的变更提案。`,artifactPreviewError:`变更提案预览暂不可用。`,artifactPreviewLoading:`正在加载变更提案...`,artifactPreviewTitle:`变更提案`,artifactTargetLabel:`产物提案目标`,approveProfileRevision:`批准档案修订`,approvingProfileRevision:`正在批准档案修订`,commandDetail:(e,t)=>`${e}:${t}。证据、下一步、review 和 memory 状态保持在同一个闭环里。`,contextLabel:`下一份人员提案上下文`,contextPlaceholder:`描述这个人、生命周期节点、证据、开放问题,或下一份 HR 产物目标...`,currentProfileEmpty:`还没有已接受的档案摘要。批准一份变更提案后会更新 README.md。`,currentProfileError:`当前档案摘要暂不可用。`,currentProfileLoading:`正在加载当前档案摘要...`,emptyProfileBody:`创建人员档案工作区后,再把证据、下一步、review 和 memory 串起来。`,emptyProfileTitle:`还没有人员档案`,evidenceConnectors:`证据连接器`,generate:e=>`生成 ${e}`,guardrailsDetail:`先复核,再沉淀组织记忆`,guardrailsTitle:`Review 护栏`,headerFallback:`人员档案`,hideProfileList:`隐藏 Profile List`,hideProfileTools:`隐藏 Profile Tools`,humanDecisionTag:`人类决策`,latestSession:e=>`最近 session ${e}。`,lifecycleFilterLabel:`生命周期筛选`,lifecycleFilters:{all:`全部人员`,alumni:`离职 / Alumni`,attention:`需要关注`,candidate:`候选人`,employee:`在职员工`},lifecycleLabels:{alumni:`离职`,candidate:`候选人`,employee:`在职`},memoryCandidates:`memory 候选`,metrics:(e,t,n)=>[`${e} 个人员档案`,`${t} 个产物`,`${n} 条 lesson`],metricsLabel:`HR 工作台指标`,moments:{artifactReady:`产物可 review`,checkinNeeded:`需要 check-in`,inProgress:`session 进行中`,intakeNeeded:`需要补齐档案`,offboardingNeeded:`需要离职交接记录`,reviewed:`已 review`,riskReview:`需要风险复核`},newProfile:`新建人员档案`,nextLabel:`下一步`,nextSteps:{captureMemory:`沉淀 lesson 候选`,checkin:`准备 check-in`,completeArtifact:`补齐产物提案`,offboarding:`准备离职交接`,profileSnapshot:`生成人员档案`,requestReview:`请求 review`,resolveRisk:`处理风险`},noSessionYet:`还没有 session`,noTimeline:`选择或创建人员档案后开始形成时间线。`,noProfilesInSection:`这个分组里还没有人员档案。`,noRecentSessions:`这个人员档案还没有 agent session。`,openSession:e=>`打开 ${e} session`,openLatestSession:`打开最近 session`,openProfile:e=>`打开 ${e} 档案`,profileDetailsDetail:e=>`${e} 的已接受 README 档案、证据、变更提案和 review 状态。`,profileDetailsEmpty:`选择一个人员档案后查看已接受 README 档案和变更提案。`,profileDetailsTitle:`当前档案摘要`,profileBoardDetail:e=>`${e} 个可见档案`,profileBoardLabel:`人员档案`,profileBoardTitle:`人员档案`,profileListDetail:e=>`${e} 个可见档案`,profileListSearchLabel:`搜索人员档案`,profileListSearchPlaceholder:`搜索人员...`,recentSessionsDetail:e=>`${e} 个 profile session`,recentSessionsTitle:`Recent Sessions`,proposalComposerDetail:`Agent 输出只作为绑定此档案的可 review 提案。`,proposalComposerTitle:`产物提案`,promoteProfileRevisionHint:`Review 通过后会把这份提案写入 README.md,并记录 git 修订。`,proposalOnly:`Agent 输出在 review 前都只是提案。`,recommended:`建议`,reviewGuardrails:[`证据必须绑定岗位相关或生命周期相关标准和来源引用。`,`缺失、薄弱和冲突信号必须保持可见。`,`敏感信息未经 review 不进入 durable memory。`,`招聘和雇佣决策必须明确由人类负责。`],reviewStatus:e=>e===`pass`?`已 review`:e===`warn`?`review 有警告`:e===`fail`?`review 未通过`:`待 review`,selectProfileFirst:`先选择一个人员档案卡片,再生成提案。`,sessionLoops:`session 循环`,showProfileList:`显示 Profile List`,showProfileTools:`显示 Profile Tools`,sourceCards:(e,t,n)=>[{count:e,detail:`可 review 的输出`,label:`产物证据`},{count:t,detail:`人员工作循环`,label:`Session 上下文`},{count:n,detail:`人工质量检查`,label:`Review 记录`}],sourcesDetail:`所选人员证据库存`,sourcesTitle:`档案来源`,suggestedToolsTitle:`建议档案操作`,status:{evidenceMissing:`需要证据`,evidenceReady:`证据就绪`},timelineLabels:{artifact:`产物`,memory:`Memory`,profile:`档案`,review:`Review`,session:`Session`},timelineLessonCount:e=>`${e} 条 memory 候选`,timelineReviewCount:e=>`${e} 条 review 记录`,timelineTitle:`档案时间线`,timelineUpdated:e=>`更新于 ${e}`,workbenchPanelControlsLabel:`工作台面板控制`,workbenchTitle:`People Workbench`};function ce(e){return e===`zh-CN`?G:W}function K(e){switch(e){case`alumni`:return`离职`;case`artifact`:return`产物`;case`candidate`:return`候选人`;case`employee`:return`员工`;case`interview`:return`面试`;case`lifecycle`:return`生命周期`;case`person`:return`人员`;case`pool`:return`候选池`;case`role`:return`岗位`}}function q({context:{artifactPreview:e,artifacts:t,copy:o,engineReadiness:s,lessons:c,locale:u,onActionSelect:d,onOpenConnectors:f,onContextChange:m,onCreateWorkspace:g,onOpenSession:v,onOpenSettings:y,onOpenWorkspace:b,onPromoteProfileRevision:x,onRefresh:S,onSubmitSession:C,onTemplateChange:T,profilePreview:O,profileRevisionSubmitting:k,reviews:A,selectedArtifact:j,selectedTemplate:M,selectedWorkspace:N,shellHeader:P,sessions:F,soulCopy:I,submitting:L,templates:R,value:z,workbench:B,workerName:V,workspaces:H}}){let U=ce(u),[W,G]=(0,E.useState)(``),[K,q]=(0,E.useState)(!0),[J,Y]=(0,E.useState)(!0),[ue,de]=(0,E.useState)(()=>new Set([`employee`,`alumni`])),X=(0,E.useMemo)(()=>re(H,F,t,A,c,U,u),[t,U,c,u,A,F,H]),Z=(0,E.useMemo)(()=>X.filter(e=>le(e,W)),[W,X]),fe=(0,E.useMemo)(()=>ie(Z,U),[U,Z]),Q=(N?X.find(e=>e.id===N.id)??null:null)??X[0]??null,pe=u===`zh-CN`?U.reviewGuardrails:B.reviewChecklist.slice(0,4),me=ae(B.actions,Q),he=Q?oe(Q,U,u):[],ge=e=>{de(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};async function $(e){if((await P?.onAction(e))?.ok){if(e.slot===`primary`){g();return}if(e.slot===`drawer-toggle`){Y(e=>!e);return}e.slot===`settings`&&y()}}function _e(e){let t=P?.busyActionId===e.id,n=e.slot===`settings`?r:e.slot===`refresh`?_:e.slot===`drawer-toggle`?h:i;return(0,D.jsxs)(`button`,{"aria-busy":t,className:`shell-primary-action`,disabled:!!P?.busyActionId,title:`Provided by the Soul App protocol`,type:`button`,onClick:()=>void $(e),children:[(0,D.jsx)(n,{"aria-hidden":`true`,size:14}),(0,D.jsx)(`span`,{children:e.label})]},e.id)}return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`header`,{className:`entry-header workspace-header hr-people-header`,children:[(0,D.jsxs)(`div`,{className:`hr-header-main`,children:[(0,D.jsx)(`span`,{className:`kicker`,children:`${I.name} / ${B.name}`}),(0,D.jsx)(`h1`,{children:U.workbenchTitle}),(0,D.jsx)(`p`,{children:Q?U.commandDetail(Q.name,Q.moment):`${V} ${U.headerFallback}`})]}),(0,D.jsxs)(`div`,{className:`entry-header-right hr-header-actions`,children:[P?.search??(0,D.jsxs)(`label`,{className:`hr-profile-search`,children:[(0,D.jsx)(l,{"aria-hidden":`true`,size:14}),(0,D.jsx)(`span`,{className:`sr-only`,children:U.profileListSearchLabel}),(0,D.jsx)(`input`,{value:W,placeholder:U.profileListSearchPlaceholder,onChange:e=>G(e.target.value)})]}),(0,D.jsx)(`div`,{className:`hr-header-metrics`,"aria-label":U.metricsLabel,children:U.metrics(X.length,t.length,c.length).map(e=>(0,D.jsx)(`span`,{children:e},e))}),P?P.actionDescriptors.map(_e):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`button`,{type:`button`,className:`primary hr-header-command`,onClick:g,children:[(0,D.jsx)(i,{"aria-hidden":`true`,size:14}),(0,D.jsx)(`span`,{children:U.newProfile})]}),(0,D.jsxs)(`button`,{type:`button`,className:`ghost hr-header-command`,onClick:f,children:[(0,D.jsx)(h,{"aria-hidden":`true`,size:14}),(0,D.jsx)(`span`,{children:U.evidenceConnectors})]})]}),(0,D.jsxs)(`div`,{className:`hr-header-icon-group`,"aria-label":U.workbenchPanelControlsLabel,children:[(0,D.jsx)(n,{"aria-label":K?U.hideProfileList:U.showProfileList,"aria-pressed":K,onClick:()=>q(e=>!e),children:K?(0,D.jsx)(w,{"aria-hidden":`true`,size:16}):(0,D.jsx)(ee,{"aria-hidden":`true`,size:16})}),(0,D.jsx)(n,{"aria-label":J?U.hideProfileTools:U.showProfileTools,"aria-pressed":J,onClick:()=>Y(e=>!e),children:J?(0,D.jsx)(p,{"aria-hidden":`true`,size:16}):(0,D.jsx)(a,{"aria-hidden":`true`,size:16})}),P?.actionSlots.has(`refresh`)?null:(0,D.jsx)(n,{"aria-label":o.accessibility.refreshWorkspace,onClick:S,children:(0,D.jsx)(_,{"aria-hidden":`true`,size:16})}),P?.actionSlots.has(`settings`)?null:(0,D.jsx)(n,{"aria-label":o.accessibility.openSettings,onClick:y,children:(0,D.jsx)(r,{"aria-hidden":`true`,size:16})})]})]})]}),P?.status,P?.results,(0,D.jsx)(`div`,{className:`entry-tab-content workspace-content hr-people-content`,"data-testid":`hr-people-workbench`,children:(0,D.jsxs)(`div`,{className:`hr-people-layout ${K?``:`without-profile-list`} ${J?``:`without-profile-tools`}`,children:[K?(0,D.jsx)(ne,{collapsedSectionIds:ue,labels:U,sections:fe,selectedWorkspaceId:N?.id??null,visibleCount:Z.length,onOpenWorkspace:b,onToggleSection:ge}):null,(0,D.jsx)(te,{artifact:j,artifactPreview:e,focusedProfile:Q,labels:U,locale:u,profilePreview:O,profileRevisionSubmitting:k,reviewGuardrails:pe,timeline:he,onPromoteProfileRevision:x}),J?(0,D.jsx)(se,{activeActions:me,copy:o,engineReadiness:s,focusedProfile:Q,labels:U,locale:u,selectedTemplate:M,selectedWorkspace:N,submitting:L,templates:R,value:z,onActionSelect:d,onContextChange:m,onOpenSession:v,onSubmitSession:C,onTemplateChange:T}):null]})})]})}function le(e,t){let n=t.trim().toLowerCase();return n?[e.name,e.detail,e.moment,e.nextStep,e.status,e.reviewStatus,e.lifecycle].some(e=>e.toLowerCase().includes(n)):!0}export{q as HrPeopleWorkbench};
|
package/web/worker/index.html
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<link rel="preload" href="/fonts/jetbrains-mono-latin-wght-normal.woff2" as="font" type="font/woff2" crossorigin />
|
|
9
9
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
10
10
|
<title>AIWorker · Soul Workspace</title>
|
|
11
|
-
<script type="module" crossorigin src="/assets/index-
|
|
11
|
+
<script type="module" crossorigin src="/assets/index-D-3jVGvl.js"></script>
|
|
12
12
|
<link rel="modulepreload" crossorigin href="/assets/markdown-preview-DFe-rfff.js">
|
|
13
13
|
<link rel="stylesheet" crossorigin href="/assets/index-xCuCRnvM.css">
|
|
14
14
|
</head>
|