vibe64 0.1.47 → 0.1.49
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/bin/run.js +1734 -1687
- package/bin/server.js +75 -75
- package/bin/upgrade-state.js +4539 -4471
- package/dist/assets/GithubBrowserTabs-BwpiRS2u.js +1 -0
- package/dist/assets/{LocalDatabaseServer-6VzPWZxG.js → LocalDatabaseServer-u_Ky7bNS.js} +1 -1
- package/dist/assets/{Vibe64AuthSettingsButton-TLwqAxDo.js → Vibe64AuthSettingsButton-BCwswT1G.js} +1 -1
- package/dist/assets/{Vibe64DashboardShell-B4dQ-oHD.js → Vibe64DashboardShell-CWlgrR2B.js} +1 -1
- package/dist/assets/{Vibe64DatabaseWorkspace-Bh5WIPOj.js → Vibe64DatabaseWorkspace-Dhs8_H0P.js} +1 -1
- package/dist/assets/Vibe64OutputControls-Dn548CZa.js +8 -0
- package/dist/assets/{Vibe64RepositoryWorkspace-idDg94lc.js → Vibe64RepositoryWorkspace-C-8S4JUF.js} +1 -1
- package/dist/assets/{Vibe64SessionFiles-Z9zxosyl.js → Vibe64SessionFiles-Cx6J7DDN.js} +2 -3
- package/dist/assets/{Vibe64UiStoryboardView-CrCDWMdR.js → Vibe64UiStoryboardView-DHyhJiWS.js} +1 -1
- package/dist/assets/{Vibe64UnavailableSessions-TqsxvGSf.js → Vibe64UnavailableSessions-Da4RxIhA.js} +1 -1
- package/dist/assets/{_sessionId_-7F1VGOou.js → _sessionId_-DCpgDPSI.js} +1 -1
- package/dist/assets/_slug_-BbEWp01a.js +25 -0
- package/dist/assets/{_slug_-B16mTWjj.css → _slug_-DerKOisL.css} +1 -1
- package/dist/assets/{access-Cx9RH95J.js → access-D4di2sCr.js} +1 -1
- package/dist/assets/{app-DPx4KKOa.js → app-Adr9Iz8p.js} +1 -1
- package/dist/assets/asyncModuleRecovery-DJsn5NrL.js +1 -0
- package/dist/assets/{changes-DYsuQLFW.js → changes-3Dd1O8Lu.js} +1 -1
- package/dist/assets/client-BAXHGUOC.js +1 -0
- package/dist/assets/{client-BYsDPxR3.js → client-CCZIu6yc.js} +1 -1
- package/dist/assets/{conversation-3ln-WnbL.css → conversation-CSDHdGDb.css} +1 -1
- package/dist/assets/conversation-DG9lp25w.js +8 -0
- package/dist/assets/conversation-ErAO1CmH.js +13 -0
- package/dist/assets/{dashboard-CWswAbYP.js → dashboard-0tCzDYCX.js} +1 -1
- package/dist/assets/english-definitions-DeiQ-jTT.js +1 -0
- package/dist/assets/env-DsyQ2MFX.js +1 -0
- package/dist/assets/{health-C0f6s-G1.js → health-DyTXU-nb.js} +1 -1
- package/dist/assets/{history-BQjETNB9.js → history-BXGAdPMI.js} +1 -1
- package/dist/assets/{incoming-COpY201m.js → incoming-yajkdGBY.js} +1 -1
- package/dist/assets/{index-MWACm8Pp.css → index-B-dukXUB.css} +1 -1
- package/dist/assets/index-CGz4Yow6.js +136 -0
- package/dist/assets/{integrations-BBkvNRHu.js → integrations-BMrXET36.js} +10 -2
- package/dist/assets/issues-kc1XBZCK.js +1 -0
- package/dist/assets/{learning-B8_wHoe1.js → learning-CIE5ghYv.js} +1 -1
- package/dist/assets/linkPath-Ch9eft18.js +1 -0
- package/dist/assets/{placement-DXvgK433.js → placement-BNmlke_j.js} +1 -1
- package/dist/assets/placement-DYM3JJ-F.js +1 -0
- package/dist/assets/publish-DTh6amqi.js +3 -0
- package/dist/assets/pull-requests-CbfGSSIh.js +1 -0
- package/dist/assets/{repository-BNPt7UWc.js → repository-BstMh-bG.js} +1 -1
- package/dist/assets/settings-Bf8C6dls.js +1 -0
- package/dist/assets/{studioGateApi-BVdclhPL.js → studioGateApi-mkX1eOTX.js} +1 -1
- package/dist/assets/{studioUrls-CGKCbM_d.js → studioUrls-B0-GdWh8.js} +1 -1
- package/dist/assets/useArchivedVibe64Sessions-DIOpfUxD.js +1 -0
- package/dist/assets/useCommand-CVuya6vG.js +1 -0
- package/dist/assets/useEndpointResource-7-YDfAxX.js +1 -0
- package/dist/assets/usePaths-Y6UuQxmI.js +1 -0
- package/dist/assets/{useUiFeedback-B51xtCAK.js → useUiFeedback-Bd3rao6E.js} +1 -1
- package/dist/assets/useVibe64ConversationLog-ChJOU2SD.js +1 -0
- package/dist/assets/{useVibe64DatabaseTools-BE_yXZFn.js → useVibe64DatabaseTools-DKV-TeNJ.js} +1 -1
- package/dist/assets/{useVibe64ProjectScope-D7b8n1gx.js → useVibe64ProjectScope-DXjsKKhl.js} +1 -1
- package/dist/assets/useVibe64SessionData-BkIHUrP5.js +1 -0
- package/dist/assets/useVibe64SessionSelection-N8wX5oqo.js +1 -0
- package/dist/assets/{useVibe64SystemGraph-CDDcsye4.js → useVibe64SystemGraph-Db_eD-X8.js} +1 -1
- package/dist/assets/{useVibe64Terminal-Zr3Mig2L.js → useVibe64Terminal-B9EWJ9Ba.js} +2 -2
- package/dist/assets/vibe64ProjectScope.local-l5_-E6pq.js +1 -0
- package/dist/assets/vibe64RepositoryRealtime-CHT4-6VN.js +1 -0
- package/dist/assets/vibe64SessionFocus-CS6Ex53G.js +1 -0
- package/dist/assets/vibe64SessionFocus-CSm4YJQD.css +1 -0
- package/dist/assets/vibe64SessionRequestConfig-xIx-5jxQ.js +1 -0
- package/dist/index.html +26 -22
- package/docs/colleague-usage/ai-accounts.md +6 -2
- package/docs/colleague-usage/ai-balance-and-allowance.md +15 -2
- package/docs/colleague-usage/coding-agent-failures.md +2 -1
- package/docs/colleague-usage/coding-agent-goals.md +8 -3
- package/docs/colleague-usage/coding-agents.md +16 -0
- package/docs/colleague-usage/github-work.md +14 -0
- package/docs/colleague-usage/preview-browser-checks.md +5 -3
- package/docs/colleague-usage/project-setup.md +6 -3
- package/docs/colleague-usage/running-vibe64-on-your-computer.md +3 -1
- package/docs/colleague-usage/sessions.md +35 -7
- package/docs/colleague-usage/starter-apps.md +3 -0
- package/docs/colleague-usage/temporary-chat-context.md +2 -1
- package/docs/colleague-usage/temporary-chats.md +17 -5
- package/node_modules/@jskit-ai/assistant-core/CHANGELOG.md +539 -0
- package/node_modules/@jskit-ai/assistant-core/locales/en.json +383 -0
- package/node_modules/@jskit-ai/assistant-core/package.json +3 -2
- package/node_modules/@jskit-ai/assistant-runtime/CHANGELOG.md +138 -0
- package/node_modules/@jskit-ai/assistant-runtime/README.md +2 -1
- package/node_modules/@jskit-ai/assistant-runtime/locales/en.json +137 -0
- package/node_modules/@jskit-ai/assistant-runtime/package.json +3 -2
- package/node_modules/@jskit-ai/assistant-runtime/src/server/repositories/assistantConfigRepository.js +223 -203
- package/node_modules/@jskit-ai/assistant-runtime/src/server/repositories/conversationsRepository.js +286 -266
- package/node_modules/@jskit-ai/assistant-runtime/src/server/repositories/messagesRepository.js +270 -250
- package/node_modules/@jskit-ai/assistant-voice/locales/en.json +182 -0
- package/node_modules/@jskit-ai/assistant-voice/package.json +3 -2
- package/node_modules/@jskit-ai/connector-google-calendar/CHANGELOG.md +83 -0
- package/node_modules/@jskit-ai/connector-google-calendar/locales/en.json +91 -0
- package/node_modules/@jskit-ai/connector-google-calendar/package.json +4 -3
- package/node_modules/@jskit-ai/connectors-catalog/CHANGELOG.md +1722 -0
- package/node_modules/@jskit-ai/connectors-catalog/README.md +11 -0
- package/node_modules/@jskit-ai/connectors-catalog/locales/en.json +3139 -0
- package/node_modules/@jskit-ai/connectors-catalog/package.json +5 -4
- package/node_modules/@jskit-ai/connectors-core/CHANGELOG.md +183 -0
- package/node_modules/@jskit-ai/connectors-core/locales/en.json +92 -0
- package/node_modules/@jskit-ai/connectors-core/package.json +3 -2
- package/node_modules/@jskit-ai/http-runtime/CHANGELOG.md +31 -0
- package/node_modules/@jskit-ai/http-runtime/locales/en.json +14 -0
- package/node_modules/@jskit-ai/http-runtime/package.json +3 -2
- package/node_modules/@jskit-ai/kernel/CHANGELOG.md +182 -0
- package/node_modules/@jskit-ai/kernel/locales/en.json +94 -0
- package/node_modules/@jskit-ai/kernel/package.json +6 -2
- package/node_modules/@jskit-ai/payments-core/CHANGELOG.md +128 -0
- package/node_modules/@jskit-ai/payments-core/locales/en.json +77 -0
- package/node_modules/@jskit-ai/payments-core/package.json +3 -2
- package/node_modules/@jskit-ai/realtime/CHANGELOG.md +20 -0
- package/node_modules/@jskit-ai/realtime/locales/en.json +14 -0
- package/node_modules/@jskit-ai/realtime/package.json +3 -2
- package/node_modules/@jskit-ai/resource-core/package.json +1 -1
- package/node_modules/@jskit-ai/resource-crud-core/package.json +1 -1
- package/node_modules/@jskit-ai/uploads-runtime/CHANGELOG.md +35 -0
- package/node_modules/@jskit-ai/uploads-runtime/locales/en.json +15 -0
- package/node_modules/@jskit-ai/uploads-runtime/package.json +3 -2
- package/node_modules/@local/vibe64-execution/src/host/execHelper.js +49 -48
- package/node_modules/@local/vibe64-execution/src/server/gitTurnCheckpointCommand.js +1327 -0
- package/node_modules/@local/vibe64-genesis/bin/vibe64-genesis-host-context +430 -390
- package/node_modules/@local/vibe64-genesis/src/server/index.js +45 -45
- package/node_modules/@local/vibe64-genesis/src/server/promptContext.js +119 -119
- package/node_modules/@local/vibe64-runtime/src/server/codexAppServerProcess.js +57 -57
- package/node_modules/@local/vibe64-sessions/package.json +2 -1
- package/node_modules/@local/vibe64-terminals/src/server/opencodeSessionEnvironmentPlugin.js +195 -175
- package/node_modules/@local/vibe64-terminals/src/server/sessionWorkOperationCommand.js +1385 -1362
- package/package.json +15 -15
- package/server.bundle.mjs +44206 -42825
- package/dist/assets/GithubBrowserTabs-D-Z3TlA8.js +0 -1
- package/dist/assets/Vibe64OutputControls-DtybwgL3.js +0 -8
- package/dist/assets/_slug_-Bq84T_Iv.js +0 -24
- package/dist/assets/conversation-Bn7wpATa.js +0 -2
- package/dist/assets/conversation-CNcCrV-R.js +0 -16
- package/dist/assets/definitions-CEbi4qae.js +0 -1
- package/dist/assets/env-X7EOFLtl.js +0 -1
- package/dist/assets/index-CBo1BEk6.js +0 -138
- package/dist/assets/issues-BiSiUd5o.js +0 -1
- package/dist/assets/placement-B5T1LR7m.js +0 -1
- package/dist/assets/publish-CeLZE2AG.js +0 -3
- package/dist/assets/pull-requests-pTdQOT7i.js +0 -1
- package/dist/assets/settings-lecRzZ-r.js +0 -1
- package/dist/assets/useArchivedVibe64Sessions-DHYRnyJD.js +0 -1
- package/dist/assets/useCommand-Epd2yHhQ.js +0 -1
- package/dist/assets/useEndpointResource-DBRQISI_.js +0 -1
- package/dist/assets/usePaths-DdAnjVDj.js +0 -1
- package/dist/assets/useVibe64ConversationLog-DboM3tYN.js +0 -1
- package/dist/assets/useVibe64SessionData-CreWtQAO.js +0 -1
- package/dist/assets/useVibe64SessionSelection-CDaX4uwY.js +0 -1
- package/dist/assets/vibe64ProjectScope.local-BxTBYuRg.js +0 -1
- package/dist/assets/vibe64RepositoryRealtime-C-J0I5jY.js +0 -1
- package/dist/assets/vibe64SessionFocus-DSW5Irm6.css +0 -1
- package/dist/assets/vibe64SessionFocus-DzqbVq60.js +0 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { createRequire as __vibe64CreateRequire } from 'node:module';const require=__vibe64CreateRequire(import.meta.url);
|
|
3
3
|
import{spawn as Ye,spawnSync as I}from"node:child_process";import{chmodSync as Je,chownSync as xe,closeSync as Ze,existsSync as T,
|
|
4
4
|
lstatSync as fe,mkdirSync as _e,openSync as Qe,readFileSync as h,readSync as et,realpathSync as te,renameSync as Ne,rmSync as Te,
|
|
5
|
-
unlinkSync as
|
|
5
|
+
unlinkSync as L,writeFileSync as oe}from"node:fs";import u from"node:path";import{createConnection as tt}from"node:net";
|
|
6
6
|
import w from"node:process";var Ie=1024*1024,rt=64*1024,nt=10,ot=15e3,it="vibe64.exec-helper.payload",st=1,at=new Set(["\
|
|
7
7
|
account-auth-terminal","account-status","codex-app-server","create-system-user","deployment-service","enable-system-user",
|
|
8
8
|
"github-api-command","github-toolchain","github-workflow-command","health-status","managed-execution","managed-service",
|
|
@@ -23,7 +23,7 @@ ft=new Set(["assistant","browser","control","job","preview","service","terminal"
|
|
|
23
23
|
F=64*1024*1024,$e=1024*1024*1024*1024,yt=256*1024*1024,we=1024*1024*1024*1024,de=8,pe=8192,gt=15e3;import.meta.main&&ht().
|
|
24
24
|
catch(e=>{w.stderr.write(`${String(e?.message||e)}
|
|
25
25
|
`),w.exit(2)});async function ht(){if(w.argv[2]==="run-managed"){await bt(w.argv[3]||"");return}if(w.argv[2]!=="execute")
|
|
26
|
-
throw new Error("Usage: vibe64-exec-helper execute [payload-json-file]");let e=Jt(w.argv[3]||"");
|
|
26
|
+
throw new Error("Usage: vibe64-exec-helper execute [payload-json-file]");let e=Jt(w.argv[3]||"");Gt(e);let t=String(e.operation||
|
|
27
27
|
"").trim();if(!at.has(t))throw new Error("Vibe64 exec helper rejected an unknown operation.");if(t==="deployment-service"){
|
|
28
28
|
Ht(e);return}if(t==="managed-service"){Kt(e);return}if(t==="managed-execution"){St(e,w.argv[3]||"");return}let r=N(e.username);
|
|
29
29
|
if(t==="create-system-user"||t==="enable-system-user"){Wt(t,e,r);return}Se(r);let n=String(e.command||"").trim();if(!je.
|
|
@@ -35,7 +35,7 @@ error)throw p.error;w.exit(typeof p.status=="number"?p.status:1)}function Et(e,t
|
|
|
35
35
|
e.username,"--","/usr/bin/env","--",`PATH=${n.env.PATH}`,t,...r],{...n,env:{...n.env,PATH:ie}})}function St(e={},t=""){let r=q();
|
|
36
36
|
vt(t,r),ae(j);let n=String(e.action||"").trim();if(n.startsWith("workflow-")){let O=Ot(e,r);w.stdout.write(`${JSON.stringify(
|
|
37
37
|
O)}
|
|
38
|
-
`),O.ok!==!0&&(w.exitCode=1);return}let o=W(e.executionId),i=De(o,r);if(n==="inspect"){Pt(i,o,r);return}if(n==="stop"){
|
|
38
|
+
`),O.ok!==!0&&(w.exitCode=1);return}let o=W(e.executionId),i=De(o,r);if(n==="inspect"){Pt(i,o,r);return}if(n==="stop"){Lt(
|
|
39
39
|
i,o,r);return}if(n!=="start")throw new Error("Vibe64 exec helper rejected an unknown managed execution action.");let s=It(
|
|
40
40
|
e.mode),a=Tt(e.kind),c=String(e.lifecycle||"").trim();if(c!==(s==="capture"?"finite":s==="pty"?"interactive":"service"))
|
|
41
41
|
throw new Error("Vibe64 exec helper rejected a managed execution lifecycle mismatch.");let p=Re(e.controllerLeaseName,c),
|
|
@@ -61,25 +61,25 @@ ype=exec",`--slice=${k}`,`--property=Description=Vibe64 ${a} execution`,`--prope
|
|
|
61
61
|
p=${j}`,"--property=SupplementaryGroups=nix-users","--property=UMask=0007",`--property=WorkingDirectory=${f}`,...y?[`--p\
|
|
62
62
|
roperty=EnvironmentFile=${y}`]:[],"--property=KillMode=control-group","--property=ExitType=cgroup","--property=OOMPolicy\
|
|
63
63
|
=stop","--property=MemoryAccounting=yes","--property=IOAccounting=yes","--property=TasksAccounting=yes",`--property=Memo\
|
|
64
|
-
ryMax=${D}`,`--property=TasksMax=${V}`,"--property=TimeoutStopSec=10s",...s==="capture"?["--
|
|
65
|
-
|
|
66
|
-
0)&&Te(J,{force:!0,recursive:!0}),
|
|
67
|
-
let r=String(e||"").trim();if(!r)return;let n=u.resolve(r),o=u.join(Y(t.username),"
|
|
68
|
-
length!==1)throw new Error("Vibe64 exec helper rejected an unsafe managed execution
|
|
69
|
-
let t=u.resolve(String(e||"")),r=h(t,"utf8");
|
|
70
|
-
n?.schemaVersion!==1)throw new Error("Vibe64 managed execution runner
|
|
71
|
-
"").trim();if(!o||/[\r\n]/u.test(o))throw new Error("Vibe64 managed
|
|
72
|
-
n.controllerLeaseName,n.controllerLeaseName?"service":""),s=i?await xt(
|
|
73
|
-
l=!0,a&&c===null&&(c=Me(a))};s?.once("close",p);let m=new Date().toISOString();
|
|
74
|
-
String):[],{cwd:String(n.cwd||"/"),detached:!!s,env:n.releaseEnvironment===!0?
|
|
75
|
-
home:n.env.HOME},n.env.USER):n.env&&typeof n.env=="object"&&!Array.isArray(n.
|
|
76
|
-
|
|
77
|
-
l&&(c=Me(a));let d=await new Promise((g,x)=>{let M="";a.once("exit",()=>{M=new Date().
|
|
78
|
-
a.once("close",(y,D)=>g({signal:D,status:y,exitObservedAt:M}))}),f=typeof d.status=="
|
|
79
|
-
{...Dt(),executionId:W(n.executionId),startedAt:m,exitObservedAt:d.exitObservedAt,execMainCode:d.
|
|
80
|
-
execMainStatus:d.signal||String(f),result:d.signal?"signal":f===0?"success":"exit-code",signal:String(
|
|
81
|
-
exitCode=f}finally{c!==null&&clearTimeout(c),s?.off("close",p),s?.destroy()}}function Re(e="",t=""){let r=String(
|
|
82
|
-
if(t!=="service"){if(r)throw new Error("Vibe64 exec helper rejected a controller lease on a finite execution.");return""}
|
|
64
|
+
ryMax=${D}`,`--property=TasksMax=${V}`,"--property=TimeoutStopSec=10s",...s==="capture"?["--property=LogLevelMax=notice",
|
|
65
|
+
"--wait","--pipe"]:[],...s==="pty"?["--wait","--pty"]:[],Xe,"run-managed",Z],G=I("systemd-run",qe,{stdio:"inherit"});if((s!==
|
|
66
|
+
"detached"||G.error||G.status!==0)&&Te(J,{force:!0,recursive:!0}),G.error)throw G.error;w.exit(typeof G.status=="number"?
|
|
67
|
+
G.status:1)}function vt(e="",t={}){let r=String(e||"").trim();if(!r)return;let n=u.resolve(r),o=u.join(Y(t.username),"ma\
|
|
68
|
+
naged-execution-payloads");if(C(o,n).length!==1)throw new Error("Vibe64 exec helper rejected an unsafe managed execution\
|
|
69
|
+
payload path.");L(n)}async function bt(e=""){let t=u.resolve(String(e||"")),r=h(t,"utf8");L(t);let n=JSON.parse(r);if(n?.
|
|
70
|
+
schema!=="vibe64.managed-execution.command"||n?.schemaVersion!==1)throw new Error("Vibe64 managed execution runner rejec\
|
|
71
|
+
ted an invalid payload.");let o=String(n.command||"").trim();if(!o||/[\r\n]/u.test(o))throw new Error("Vibe64 managed ex\
|
|
72
|
+
ecution runner rejected an invalid command.");let i=Re(n.controllerLeaseName,n.controllerLeaseName?"service":""),s=i?await xt(
|
|
73
|
+
i):null;w.umask(7);let a=null,c=null,l=!1,p=()=>{l=!0,a&&c===null&&(c=Me(a))};s?.once("close",p);let m=new Date().toISOString();
|
|
74
|
+
try{a=Ye(o,Array.isArray(n.args)?n.args.map(String):[],{cwd:String(n.cwd||"/"),detached:!!s,env:n.releaseEnvironment===!0?
|
|
75
|
+
be({...w.env,...n.env},{username:n.env.USER,home:n.env.HOME},n.env.USER):n.env&&typeof n.env=="object"&&!Array.isArray(n.
|
|
76
|
+
env)?n.env:{},stdio:n.inputPresent===!0?["pipe","inherit","inherit"]:"inherit"}),n.inputPresent===!0&&a.stdin.end(Buffer.
|
|
77
|
+
from(String(n.inputBase64||""),"base64")),l&&(c=Me(a));let d=await new Promise((g,x)=>{let M="";a.once("exit",()=>{M=new Date().
|
|
78
|
+
toISOString()}),a.once("error",x),a.once("close",(y,D)=>g({signal:D,status:y,exitObservedAt:M}))}),f=typeof d.status=="n\
|
|
79
|
+
umber"?d.status:1;Ct(u.dirname(t),{...Dt(),executionId:W(n.executionId),startedAt:m,exitObservedAt:d.exitObservedAt,execMainCode:d.
|
|
80
|
+
signal?"killed":"exited",execMainStatus:d.signal||String(f),result:d.signal?"signal":f===0?"success":"exit-code",signal:String(
|
|
81
|
+
d.signal||"")}),w.exitCode=f}finally{c!==null&&clearTimeout(c),s?.off("close",p),s?.destroy()}}function Re(e="",t=""){let r=String(
|
|
82
|
+
e||"");if(t!=="service"){if(r)throw new Error("Vibe64 exec helper rejected a controller lease on a finite execution.");return""}
|
|
83
83
|
if(!/^\0vibe64-resource-controller-[a-z][a-z0-9-]{0,62}$/u.test(r))throw new Error("Vibe64 exec helper rejected an inval\
|
|
84
84
|
id managed service controller lease.");return r}function xt(e=""){return new Promise((t,r)=>{let n=tt({path:e}),o=setTimeout(
|
|
85
85
|
()=>{n.destroy(),r(new Error("Vibe64 managed service could not attach to its controller lease."))},3e3);o.unref?.(),n.once(
|
|
@@ -88,21 +88,22 @@ clearTimeout(o),n.destroy(),r(new Error(`Vibe64 managed service controller lease
|
|
|
88
88
|
ke(e,"SIGTERM");let t=setTimeout(()=>ke(e,"SIGKILL"),5e3);return t.unref?.(),t}function ke(e=null,t="SIGTERM"){let r=Number(
|
|
89
89
|
e?.pid);if(!(!Number.isSafeInteger(r)||r<=1))try{w.kill(-r,t)}catch(n){if(n?.code==="ESRCH")return;try{e.kill(t)}catch(o){
|
|
90
90
|
o?.code!=="ESRCH"&&w.stderr.write(`Vibe64 managed service process tree could not be stopped.
|
|
91
|
-
`)}}}function Mt(e={},{memoryMaxBytes:t=0,tasksMax:r=0}={}){let n=he(e);
|
|
92
|
-
|
|
93
|
-
function Ce(e={},t={}){let r=W(e.id);for(let a of[e.projectKey,e.sessionKey])
|
|
94
|
-
a))throw new Error("Vibe64 exec helper rejected an invalid workflow
|
|
95
|
-
re))throw new Error("Managed workflow accounting requires a
|
|
96
|
-
test(o))throw new Error("Invalid managed
|
|
97
|
-
s=`${i.slice(0,-6)}-s${e.sessionKey}.slice`;return{
|
|
98
|
-
sessionUnit:s,unitName:`${s.slice(0,-6)}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
if(t.code==="ENOENT")return null;throw t}}
|
|
102
|
-
try{_e(i,{mode:448})}catch(a){if(a.code!==
|
|
103
|
-
0||(s.mode&63)!==0)throw new Error("Unsafe
|
|
104
|
-
try{try{oe(o,`${JSON.stringify({...t,schema:"
|
|
105
|
-
|
|
91
|
+
`)}}}function Mt(e={},{memoryMaxBytes:t=0,tasksMax:r=0}={}){let n=he(e);A("systemctl",["is-active","--quiet",n]).status!==
|
|
92
|
+
0&&S("systemctl",["start",n]),S("systemctl",["set-property","--runtime",n,`MemoryMax=${t}`,`TasksMax=${r}`,"MemoryAccoun\
|
|
93
|
+
ting=yes","IOAccounting=yes","TasksAccounting=yes"])}function Ce(e={},t={}){let r=W(e.id);for(let a of[e.projectKey,e.sessionKey])
|
|
94
|
+
if(typeof a!="string"||!/^[a-f0-9]{64}$/u.test(a))throw new Error("Vibe64 exec helper rejected an invalid workflow accou\
|
|
95
|
+
nting identity.");let n=N(t.username);if(!n.startsWith(re))throw new Error("Managed workflow accounting requires a works\
|
|
96
|
+
pace daemon owner.");let o=$(n);if(!/^[a-z](?:[a-z0-9-]{0,61}[a-z0-9])?$/u.test(o))throw new Error("Invalid managed work\
|
|
97
|
+
flow workspace identity.");let i=`vibe64-${o}-work-p${e.projectKey}.slice`,s=`${i.slice(0,-6)}-s${e.sessionKey}.slice`;return{
|
|
98
|
+
id:r,workspace:o,projectKey:e.projectKey,sessionKey:e.sessionKey,projectUnit:i,sessionUnit:s,unitName:`${s.slice(0,-6)}-\
|
|
99
|
+
w${r.replaceAll("-","")}.slice`}}function ye(e){return u.join("/run/vibe64-workflows",e.workspace,`${e.id}.json`)}function kt(e){
|
|
100
|
+
try{let t=JSON.parse(h(ye(e),"utf8"));if(t.schema!=="vibe64.managed-workflow.result.v1"||t.unitName!==e.unitName||t.id!==
|
|
101
|
+
e.id)throw new Error("Invalid managed workflow result identity.");return t}catch(t){if(t.code==="ENOENT")return null;throw t}}
|
|
102
|
+
function At(e,t){let r=ye(e);for(let i of["/run/vibe64-workflows",u.dirname(r)]){try{_e(i,{mode:448})}catch(a){if(a.code!==
|
|
103
|
+
"EEXIST")throw a}let s=fe(i);if(!s.isDirectory()||s.isSymbolicLink()||s.uid!==0||(s.mode&63)!==0)throw new Error("Unsafe\
|
|
104
|
+
managed workflow result directory.")}let n=`${r}.tmp-${w.pid}`,o=Qe(n,"wx",384);try{try{oe(o,`${JSON.stringify({...t,schema:"\
|
|
105
|
+
vibe64.managed-workflow.result.v1"})}
|
|
106
|
+
`)}finally{Ze(o)}Ne(n,r)}catch(i){try{L(n)}catch(s){if(s.code!=="ENOENT")throw new AggregateError([i,s],"Workflow receip\
|
|
106
107
|
t write and cleanup failed.")}throw i}}function P(e){let t=A("systemctl",["show",e.unitName,"--no-pager","--property=Loa\
|
|
107
108
|
dState,ActiveState,ControlGroup,MemoryMax,TasksMax"]),r=Object.fromEntries(String(t.stdout||"").trim().split(`
|
|
108
109
|
`).map(s=>{let a=s.indexOf("=");return[s.slice(0,a),s.slice(a+1)]})),n=String(r.ControlGroup||"");if(n&&(u.posix.basename(
|
|
@@ -122,7 +123,7 @@ exec(s)?.[1]),oomCount:n.oom??null,oomKillCount:n.oom_kill??null,limitHitCount:n
|
|
|
122
123
|
t("pids.current")),peakScope:"workflow-lifetime"}}function Ot(e,t){let r=Ce(e.workflow,t),n=String(e.action||"");if(n===
|
|
123
124
|
"workflow-inspect")return{ok:!0,...P(r)};if(n==="workflow-grow"||n==="workflow-limits")return _t(e,r,t);if(n==="workflow\
|
|
124
125
|
-forget"){let o=P(r);if(o.scopeEmpty!==!0||o.activeState!=="inactive")throw new Error("Only a completed workflow receipt\
|
|
125
|
-
can be acknowledged.");try{
|
|
126
|
+
can be acknowledged.");try{L(ye(r))}catch(i){if(i.code!=="ENOENT")throw i}return{ok:!0,id:r.id}}if(n==="workflow-create"){
|
|
126
127
|
let o=U(e.memoryMaxBytes,F,we,"workflow memory limit"),i=U(e.tasksMax,de,pe,"workflow task limit"),s=E(S("systemctl",["s\
|
|
127
128
|
how",he(t),"--property=MemoryMax","--value"]));if(s===null||o>s)throw new Error("Vibe64 exec helper rejected a workflow \
|
|
128
129
|
above its proven work-slice memory limit.");let a=P(r);if(a.finishedAt)throw new Error("A completed workflow identity ca\
|
|
@@ -245,13 +246,13 @@ _NONE"&&g)V="host";else if(d==="CONSTRAINT_MEMCG"&&f&&(x===f||x.startsWith(`${f}
|
|
|
245
246
|
.slice`?"workspace":v==="vibe64.slice"?"platform":/-work-p[a-f0-9]{64}-s[a-f0-9]{64}-w[a-f0-9]{32}\.slice$/u.test(v)?"wo\
|
|
246
247
|
rkflow":/-work-p[a-f0-9]{64}-s[a-f0-9]{64}\.slice$/u.test(v)?"session":/-work-p[a-f0-9]{64}\.slice$/u.test(v)?"project":
|
|
247
248
|
"ancestor"}else return null;let H=f||"";if(a&&a.cgroup!==H)return null;(!a||l>Date.parse(a.recordedAt))&&(a={source:"ker\
|
|
248
|
-
nel-journal",scope:V,cgroup:H,recordedAt:new Date(l).toISOString()})}return a}function
|
|
249
|
+
nel-journal",scope:V,cgroup:H,recordedAt:new Date(l).toISOString()})}return a}function Lt(e="",t="",r={}){let n=K(e,t,r);
|
|
249
250
|
n.scopeEmpty||A("systemctl",["stop",e]);let o=Date.now()+gt,i=K(e,t,r),s=new Int32Array(new SharedArrayBuffer(4));for(;!i.
|
|
250
251
|
scopeEmpty&&Date.now()<o;)Atomics.wait(s,0,0,25),i=K(e,t,r);i.scopeEmpty||(A("systemctl",["kill","--kill-who=all","--sig\
|
|
251
252
|
nal=SIGKILL",e]),A("systemctl",["stop",e]),i=K(e,t,r)),i.scopeEmpty&&(Te(Ee(r,t),{force:!0,recursive:!0}),A("systemctl",
|
|
252
253
|
["reset-failed",e])),w.stdout.write(`${JSON.stringify({executionId:t,ok:i.scopeEmpty,scopeEmpty:i.scopeEmpty,stopped:n.scopeEmpty===
|
|
253
254
|
!1,...i})}
|
|
254
|
-
`),i.scopeEmpty||w.exit(1)}function
|
|
255
|
+
`),i.scopeEmpty||w.exit(1)}function Gt(e={}){if(e?.schema!==it||e?.schemaVersion!==st)throw new Error("Vibe64 exec helpe\
|
|
255
256
|
r rejected a non-normalized execution payload.")}function Wt(e="",t={},r=""){Se(r),q(),ae(j),e==="create-system-user"?tr(
|
|
256
257
|
r,String(t.password||"")):X(r),rr(r,j)}function Ht(e={}){let t=q();ae(j);let r=String(e.action||"").trim(),n=ce(e.unitName);
|
|
257
258
|
if(r==="inspect"){zt(n);return}if(r==="remove"){Yt(n);return}if(r!=="install-start")throw new Error("Vibe64 exec helper \
|
|
@@ -265,7 +266,7 @@ ager","--output=cat","--lines=80"]),n=String(r.stdout||r.stderr||"").trim();w.st
|
|
|
265
266
|
`)+`
|
|
266
267
|
`)}function Kt(e={}){let t=q();ae(j);let r=String(e.action||"").trim(),n=ve(e.unitName,t);if(r!=="install-start")throw new Error(
|
|
267
268
|
"Vibe64 exec helper rejected an unknown managed service action.");let o=Oe(e.workingDirectory,t,"workingDirectory"),i=Oe(
|
|
268
|
-
e.startScript,t,"startScript"),s=
|
|
269
|
+
e.startScript,t,"startScript"),s=Ge(e.processModel),a=s==="forking"?Le(e.pidFile,t):"",c=ir(n,t),l=ar({owner:t,pidFile:a,
|
|
269
270
|
processModel:s,startScript:i,unitName:n,workingDirectory:o});Ft({owner:t,pidFile:a,unitName:n}),Pe({activation:"start",unit:l,
|
|
270
271
|
unitName:n,unitPath:c})}function Ft({owner:e={},pidFile:t="",unitName:r=""}={}){if(!t||!T(t))return;let n=String(h(t,"ut\
|
|
271
272
|
f8")||"").trim();if(!/^[1-9][0-9]*$/u.test(n))throw new Error("Vibe64 managed service PID file is invalid.");let o=Number(
|
|
@@ -274,16 +275,16 @@ let i=Xt(o);if(i===null){Q(t,n);return}if(i!==e.uid)throw new Error("Vibe64 mana
|
|
|
274
275
|
er.");if(qt(o,r))return;try{w.kill(o,"SIGTERM")}catch(c){if(c?.code==="ESRCH"){Q(t,n);return}throw c}let s=Date.now()+3e4,
|
|
275
276
|
a=new Int32Array(new SharedArrayBuffer(4));for(;me(o)&&Date.now()<s;)Atomics.wait(a,0,0,100);if(me(o))throw new Error("V\
|
|
276
277
|
ibe64 managed service process did not stop cleanly during ownership transfer.");Q(t,n)}function Q(e="",t=""){T(e)&&String(
|
|
277
|
-
h(e,"utf8")||"").trim()===t&&
|
|
278
|
+
h(e,"utf8")||"").trim()===t&&L(e)}function me(e=0){try{return w.kill(e,0),!0}catch(t){if(t?.code==="ESRCH")return!1;throw t}}
|
|
278
279
|
function Xt(e=0){let t="";try{t=h(`/proc/${e}/status`,"utf8")}catch(o){if(o?.code==="ENOENT")return null;throw o}let r=String(
|
|
279
280
|
t||"").match(/^Uid:\s+([0-9]+)/mu),n=Number(r?.[1]);if(!Number.isSafeInteger(n))throw new Error("Vibe64 managed service \
|
|
280
281
|
process UID is unavailable.");return n}function qt(e=0,t=""){let r=`/${t}`,n="";try{n=h(`/proc/${e}/cgroup`,"utf8")}catch(o){
|
|
281
282
|
if(o?.code==="ENOENT")return!1;throw o}return String(n||"").split(`
|
|
282
283
|
`).some(o=>o.trim().endsWith(r))}function Pe({activation:e="start",unit:t="",unitName:r="",unitPath:n=""}={}){if(e!=="st\
|
|
283
284
|
art"&&e!=="restart")throw new Error("Vibe64 exec helper rejected an unsupported systemd activation.");let o=`${n}.tmp-${w.
|
|
284
|
-
pid}`;oe(o,t,{mode:420});try{S("mv",[o,n])}catch(i){try{
|
|
285
|
+
pid}`;oe(o,t,{mode:420});try{S("mv",[o,n])}catch(i){try{L(o)}catch{}throw i}S("systemctl",["daemon-reload"]),S("systemct\
|
|
285
286
|
l",["enable",r]),A("systemctl",["reset-failed",r]);try{S("systemctl",[e,r])}catch(i){throw A("systemctl",["stop",r]),i}}
|
|
286
|
-
function Yt(e=""){ce(e),A("systemctl",["stop",e]),A("systemctl",["disable",e]),A("systemctl",["reset-failed",e]);try{
|
|
287
|
+
function Yt(e=""){ce(e),A("systemctl",["stop",e]),A("systemctl",["disable",e]),A("systemctl",["reset-failed",e]);try{L(We(
|
|
287
288
|
e))}catch(t){if(t?.code!=="ENOENT")throw t}S("systemctl",["daemon-reload"])}function Jt(e=""){let t=e?h(u.resolve(e),"ut\
|
|
288
289
|
f8"):Zt();if(Buffer.byteLength(t,"utf8")>Ie)throw new Error("Vibe64 exec helper payload is too large.");let r=JSON.parse(
|
|
289
290
|
t);if(!r||typeof r!="object"||Array.isArray(r))throw new Error("Vibe64 exec helper payload must be a JSON object.");return r}
|
|
@@ -310,9 +311,9 @@ hpasswd",{encoding:"utf8",input:`${e}:${t}
|
|
|
310
311
|
S("usermod",["-a","-G",t,e])}function S(e="",t=[]){let r=I(e,t,{encoding:"utf8"});if(r.status!==0)throw new Error(String(
|
|
311
312
|
r.stderr||r.stdout||`${e} failed.`).trim());return String(r.stdout||"").trim()}function A(e="",t=[]){return I(e,t,{encoding:"\
|
|
312
313
|
utf8"})}function ee(e="",t={},r="path"){let n=nr(e,t);if(!T(n))throw new Error(`Vibe64 deployment service ${r} does not \
|
|
313
|
-
exist.`);return n}function Oe(e="",t={},r="path"){let n=
|
|
314
|
+
exist.`);return n}function Oe(e="",t={},r="path"){let n=Le(e,t);if(!T(n))throw new Error(`Vibe64 managed service ${r} do\
|
|
314
315
|
es not exist.`);return n}function Ve(e={}){let t=N(e.username),r=$(t);if(!r)throw new Error("Vibe64 exec helper could no\
|
|
315
|
-
t resolve the managed service workspace.");return u.join("/var/lib/vibe64",r,"services")}function
|
|
316
|
+
t resolve the managed service workspace.");return u.join("/var/lib/vibe64",r,"services")}function Le(e="",t={}){let r=String(
|
|
316
317
|
e||"").trim();if(!r)throw new Error("Vibe64 exec helper rejected an empty managed service path.");let n=b(r,{allowMissingLeaf:!0});
|
|
317
318
|
if(C(b(Ve(t)),n).length>0)return n;throw new Error("Vibe64 exec helper rejected a managed service path outside the works\
|
|
318
319
|
pace service root.")}function nr(e="",t={}){let r=String(e||"").trim();if(!r)throw new Error("Vibe64 exec helper rejecte\
|
|
@@ -327,7 +328,7 @@ release-")||!t.endsWith(".service")||!/^[A-Za-z0-9_.@:-]+$/u.test(t)||t.includes
|
|
|
327
328
|
"Vibe64 exec helper rejected an unsafe deployment service unit name.");return t}function ve(e="",t={}){let r=String(e||"").
|
|
328
329
|
trim(),n=u.basename(u.dirname(Ve(t)));if(!r.startsWith(`vibe64-managed-${n}-`)||!r.endsWith(".service")||!/^[A-Za-z0-9_.@:-]+$/u.
|
|
329
330
|
test(r)||r.includes("/")||r.includes(".."))throw new Error("Vibe64 exec helper rejected an unsafe managed service unit n\
|
|
330
|
-
ame.");return r}function
|
|
331
|
+
ame.");return r}function Ge(e=""){let t=String(e||"").trim();if(t!=="forking"&&t!=="simple")throw new Error("Vibe64 exec\
|
|
331
332
|
helper rejected an unsupported managed service process model.");return t}function We(e=""){return u.join("/etc/systemd/\
|
|
332
333
|
system",ce(e))}function ir(e="",t={}){return u.join("/etc/systemd/system",ve(e,t))}function He(e={}){return[`User=${_(e.
|
|
333
334
|
username)}`,`Group=${j}`,"SupplementaryGroups=nix-users","UMask=0007"]}function ze(e={}){return[`Slice=vibe64-${$(N(e.username))}\
|
|
@@ -339,7 +340,7 @@ let s=Array.isArray(r)?r:[];return["[Unit]",`Description=Vibe64 release service
|
|
|
339
340
|
`Environment=PATH=${_(ie)}`,`Environment=TMPDIR=${_(Y(t.username))}`,`ExecStart=${_(n)}`,"Restart=always","RestartSec=3",
|
|
340
341
|
"KillSignal=SIGTERM","TimeoutStopSec=30","","[Install]","WantedBy=multi-user.target",""].join(`
|
|
341
342
|
`)}function ar({owner:e={},pidFile:t="",processModel:r="simple",startScript:n="",unitName:o="",workingDirectory:i=""}={}){
|
|
342
|
-
let s=
|
|
343
|
+
let s=Ge(r);return["[Unit]",`Description=Vibe64 managed service ${o}`,"After=network-online.target","Wants=network-onlin\
|
|
343
344
|
e.target","","[Service]",`Type=${s}`,...He(e),...ze(e),`WorkingDirectory=${_(i)}`,`Environment=PATH=${_(ie)}`,`Environme\
|
|
344
345
|
nt=TMPDIR=${_(Y(e.username))}`,`ExecStart=${_(n)}`,...s==="forking"?[`PIDFile=${_(t)}`]:[],"Restart=on-failure","Restart\
|
|
345
346
|
Sec=3","TimeoutStartSec=90","TimeoutStopSec=30","","[Install]","WantedBy=multi-user.target",""].join(`
|