vibe64 0.1.42 → 0.1.44
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 +133 -133
- package/bin/upgrade-state.js +287 -286
- package/dist/assets/{GithubBrowserTabs-YvIe2BdE.js → GithubBrowserTabs-CxeMBH6W.js} +1 -1
- package/dist/assets/{Vibe64AuthSettingsButton-DLdfT68V.js → Vibe64AuthSettingsButton-BuAidNAq.js} +1 -1
- package/dist/assets/{Vibe64DashboardShell-DMPz6fIx.js → Vibe64DashboardShell-uWi4NB4y.js} +1 -1
- package/dist/assets/{Vibe64DatabaseWorkspace-BCEIOlSg.js → Vibe64DatabaseWorkspace-CCpDbiGK.js} +1 -1
- package/dist/assets/{Vibe64OutputControls-DMoqL0VD.js → Vibe64OutputControls-ttqEP46v.js} +1 -1
- package/dist/assets/{Vibe64RepositoryWorkspace-BdwRwbxp.js → Vibe64RepositoryWorkspace-Bq37tlM9.js} +1 -1
- package/dist/assets/{Vibe64SessionFiles-ChJWUOqm.js → Vibe64SessionFiles-BhNCbnUP.js} +1 -1
- package/dist/assets/{_sessionId_-Bw0KfJeR.js → _sessionId_-wrEZX5JX.js} +1 -1
- package/dist/assets/{_slug_-q9prK_gX.js → _slug_-pVQuRCsN.js} +4 -4
- package/dist/assets/{access-C05Nkq6r.js → access-CwTmMeFU.js} +1 -1
- package/dist/assets/{app-D1CGY9Xm.js → app-BSNXOpH-.js} +1 -1
- package/dist/assets/{changes-D17XpgGz.js → changes-BHk1r-xi.js} +1 -1
- package/dist/assets/{dashboard-BXXgeQ0Q.js → dashboard-CtPZicHO.js} +1 -1
- package/dist/assets/{definitions-SNvFDEFS.js → definitions-Cfy1CWRi.js} +1 -1
- package/dist/assets/{env-sXAQqKWk.js → env-vkfe7Ud2.js} +1 -1
- package/dist/assets/{history-N1iRZaab.js → history-lzQXJSu7.js} +1 -1
- package/dist/assets/{index-Mxalhei8.js → index-BnZ5igE0.js} +5 -5
- package/dist/assets/{integrations-BmwFvHgZ.js → integrations-CefYdMOC.js} +1 -1
- package/dist/assets/{issues-BbiG7dCV.js → issues-CiGWy5Cv.js} +1 -1
- package/dist/assets/{learning-CUCuuoHM.js → learning-BfyUAtaJ.js} +1 -1
- package/dist/assets/{placement-CQy46H3H.js → placement-BxRjNrZ1.js} +1 -1
- package/dist/assets/{publish-4r_4K5IY.js → publish-W5aA6JkR.js} +1 -1
- package/dist/assets/{pull-requests-DY9jg3cE.js → pull-requests-BrtOgprU.js} +1 -1
- package/dist/assets/{repository-DhXdoMP6.js → repository-BsSO4tkZ.js} +1 -1
- package/dist/assets/{settings-Cj4u-76p.js → settings-Ck7lEre8.js} +1 -1
- package/dist/assets/{useArchivedVibe64Sessions-BXNg8oES.js → useArchivedVibe64Sessions-DBSnMGIY.js} +1 -1
- package/dist/assets/{useVibe64ConversationLog-C1xjhFtS.js → useVibe64ConversationLog-DQUm75XZ.js} +1 -1
- package/dist/assets/{useVibe64SessionData-CnDOFFHb.js → useVibe64SessionData-t_rs_q6g.js} +1 -1
- package/dist/assets/{useVibe64SessionSelection-J87nJ9p5.js → useVibe64SessionSelection-gAUaIEs7.js} +1 -1
- package/dist/assets/{vibe64SessionFocus-DlN8NwcE.js → vibe64SessionFocus-BZFoISVS.js} +1 -1
- package/dist/index.html +1 -1
- package/docs/colleague-usage/ai-model-setups.md +2 -1
- package/docs/colleague-usage/coding-agent-goal-pause.md +1 -1
- package/docs/colleague-usage/colleague.md +2 -2
- package/docs/colleague-usage/dashboard-navigation.md +4 -3
- package/docs/colleague-usage/publishing.md +2 -1
- package/node_modules/@local/vibe64-genesis/src/server/index.js +122 -125
- package/node_modules/@local/vibe64-genesis/src/server/promptContext.js +10 -13
- package/package.json +1 -1
- package/server.bundle.mjs +19535 -19510
package/bin/upgrade-state.js
CHANGED
|
@@ -58,7 +58,7 @@ kf.exports.mask=function(t,r,n,o,i){i<48?OP(t,r,n,o,i):e.mask(t,r,n,o,i)},kf.exp
|
|
|
58
58
|
t,r):e.unmask(t,r)}}catch{}});var jP=lt((cEe,NP)=>{"use strict";var kP=Symbol("kDone"),Jv=Symbol("kRun"),Xv=class{constructor(t){this[kP]=()=>{this.pending--,
|
|
59
59
|
this[Jv]()},this.concurrency=t||1/0,this.jobs=[],this.pending=0}add(t){this.jobs.push(t),this[Jv]()}[Jv](){if(this.pending!==
|
|
60
60
|
this.concurrency&&this.jobs.length){let t=this.jobs.shift();this.pending++,t(this[kP])}}};NP.exports=Xv});var Ta=lt((uEe,DP)=>{"use strict";var fd=ot("zlib"),MP=pd(),_W=jP(),{kStatusCode:$P}=ro(),bW=Buffer[Symbol.species],IW=Buffer.
|
|
61
|
-
from([0,0,255,255]),jf=Symbol("permessage-deflate"),no=Symbol("total-length"),Ea=Symbol("callback"),
|
|
61
|
+
from([0,0,255,255]),jf=Symbol("permessage-deflate"),no=Symbol("total-length"),Ea=Symbol("callback"),Uo=Symbol("buffers"),
|
|
62
62
|
xa=Symbol("error"),Nf,Yv=class{constructor(t){if(this._options=t||{},this._threshold=this._options.threshold!==void 0?this.
|
|
63
63
|
_options.threshold:1024,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=
|
|
64
64
|
null,this._inflate=null,this.params=null,!Nf){let r=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:
|
|
@@ -89,18 +89,18 @@ if(o!==!0)throw new TypeError(`Invalid value for parameter "${n}": ${o}`)}else t
|
|
|
89
89
|
r[n]=o})}),t}decompress(t,r,n){Nf.add(o=>{this._decompress(t,r,(i,s)=>{o(),n(i,s)})})}compress(t,r,n){Nf.add(o=>{this._compress(
|
|
90
90
|
t,r,(i,s)=>{o(),n(i,s)})})}_decompress(t,r,n){let o=this._isServer?"client":"server";if(!this._inflate){let i=`${o}_max_\
|
|
91
91
|
window_bits`,s=typeof this.params[i]!="number"?fd.Z_DEFAULT_WINDOWBITS:this.params[i];this._inflate=fd.createInflateRaw(
|
|
92
|
-
{...this._options.zlibInflateOptions,windowBits:s}),this._inflate[jf]=this,this._inflate[no]=0,this._inflate[
|
|
92
|
+
{...this._options.zlibInflateOptions,windowBits:s}),this._inflate[jf]=this,this._inflate[no]=0,this._inflate[Uo]=[],this.
|
|
93
93
|
_inflate.on("error",AW),this._inflate.on("data",LP)}this._inflate[Ea]=n,this._inflate.write(t),r&&this._inflate.write(IW),
|
|
94
94
|
this._inflate.flush(()=>{let i=this._inflate[xa];if(i){this._inflate.close(),this._inflate=null,n(i);return}let s=MP.concat(
|
|
95
|
-
this._inflate[
|
|
96
|
-
(this._inflate[no]=0,this._inflate[
|
|
95
|
+
this._inflate[Uo],this._inflate[no]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):
|
|
96
|
+
(this._inflate[no]=0,this._inflate[Uo]=[],r&&this.params[`${o}_no_context_takeover`]&&this._inflate.reset()),n(null,s)})}_compress(t,r,n){
|
|
97
97
|
let o=this._isServer?"server":"client";if(!this._deflate){let i=`${o}_max_window_bits`,s=typeof this.params[i]!="number"?
|
|
98
98
|
fd.Z_DEFAULT_WINDOWBITS:this.params[i];this._deflate=fd.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:s}),
|
|
99
|
-
this._deflate[no]=0,this._deflate[
|
|
100
|
-
flush(fd.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let i=MP.concat(this._deflate[
|
|
101
|
-
buffer,i.byteOffset,i.length-4)),this._deflate[Ea]=null,this._deflate[no]=0,this._deflate[
|
|
102
|
-
_context_takeover`]&&this._deflate.reset(),n(null,i)})}};DP.exports=Yv;function SW(e){this[
|
|
103
|
-
function LP(e){if(this[no]+=e.length,this[jf]._maxPayload<1||this[no]<=this[jf]._maxPayload){this[
|
|
99
|
+
this._deflate[no]=0,this._deflate[Uo]=[],this._deflate.on("data",SW)}this._deflate[Ea]=n,this._deflate.write(t),this._deflate.
|
|
100
|
+
flush(fd.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let i=MP.concat(this._deflate[Uo],this._deflate[no]);r&&(i=new bW(i.
|
|
101
|
+
buffer,i.byteOffset,i.length-4)),this._deflate[Ea]=null,this._deflate[no]=0,this._deflate[Uo]=[],r&&this.params[`${o}_no\
|
|
102
|
+
_context_takeover`]&&this._deflate.reset(),n(null,i)})}};DP.exports=Yv;function SW(e){this[Uo].push(e),this[no]+=e.length}
|
|
103
|
+
function LP(e){if(this[no]+=e.length,this[jf]._maxPayload<1||this[no]<=this[jf]._maxPayload){this[Uo].push(e);return}this[xa]=
|
|
104
104
|
new RangeError("Max payload size exceeded"),this[xa].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[xa][$P]=1009,this.removeListener(
|
|
105
105
|
"data",LP),this.reset()}function AW(e){if(this[jf]._inflate=null,this[xa]){this[Ea](this[xa]);return}e[$P]=1007,this[Ea](
|
|
106
106
|
e)}});var Ca=lt((dEe,Mf)=>{"use strict";var{isUtf8:zP}=ot("buffer"),{hasBlob:EW}=ro(),xW=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
@@ -255,7 +255,7 @@ void 0,c=d=-1}else throw new SyntaxError(`Unexpected character at index ${l}`);i
|
|
|
255
255
|
p.replace(/\\/g,"")):Pn(r,a,p),Pn(t,s,r)),t}function KW(e){return Object.keys(e).map(t=>{let r=e[t];return Array.isArray(
|
|
256
256
|
r)||(r=[r]),r.map(n=>[t].concat(Object.keys(n).map(o=>{let i=n[o];return Array.isArray(i)||(i=[i]),i.map(s=>s===!0?o:`${o}\
|
|
257
257
|
=${s}`).join("; ")})).join("; ")).join(", ")}).join(", ")}ik.exports={format:KW,parse:WW}});var Vf=lt((vEe,wk)=>{"use strict";var JW=ot("events"),XW=ot("https"),YW=ot("http"),ck=ot("net"),ZW=ot("tls"),{randomBytes:QW,
|
|
258
|
-
createHash:eK}=ot("crypto"),{Duplex:gEe,Readable:wEe}=ot("stream"),{URL:cy}=ot("url"),
|
|
258
|
+
createHash:eK}=ot("crypto"),{Duplex:gEe,Readable:wEe}=ot("stream"),{URL:cy}=ot("url"),Fo=Ta(),tK=ny(),rK=sy(),{isBlob:nK}=Ca(),
|
|
259
259
|
{BINARY_TYPES:sk,CLOSE_TIMEOUT:oK,EMPTY_BUFFER:Ff,GUID:iK,kForOnEventAttribute:uy,kListener:sK,kStatusCode:aK,kWebSocket:zt,
|
|
260
260
|
NOOP:uk}=ro(),{EventTarget:{addEventListener:cK,removeEventListener:uK}}=ok(),{format:dK,parse:lK}=Uf(),{toBuffer:pK}=pd(),
|
|
261
261
|
dk=Symbol("kAborted"),dy=[8,13],io=["CONNECTING","OPEN","CLOSING","CLOSED"],fK=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,ht=class e extends JW{constructor(t,r,n){
|
|
@@ -274,8 +274,8 @@ maxPayload,skipUTF8Validation:n.skipUTF8Validation}),i=new rK(t,this._extensions
|
|
|
274
274
|
i,this._socket=t,o[zt]=this,i[zt]=this,t[zt]=this,o.on("conclude",gK),o.on("drain",wK),o.on("error",vK),o.on("message",yK),
|
|
275
275
|
o.on("ping",_K),o.on("pong",bK),i.onerror=IK,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),r.length>0&&t.unshift(
|
|
276
276
|
r),t.on("close",mk),t.on("data",qf),t.on("end",hk),t.on("error",gk),this._readyState=e.OPEN,this.emit("open")}emitClose(){
|
|
277
|
-
if(!this._socket){this._readyState=e.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[
|
|
278
|
-
extensionName]&&this._extensions[
|
|
277
|
+
if(!this._socket){this._readyState=e.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[Fo.
|
|
278
|
+
extensionName]&&this._extensions[Fo.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=e.CLOSED,
|
|
279
279
|
this.emit("close",this._closeCode,this._closeMessage)}close(t,r){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){
|
|
280
280
|
Ir(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===e.CLOSING){this.
|
|
281
281
|
_closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this.
|
|
@@ -290,7 +290,7 @@ State 0 (CONNECTING)");if(typeof t=="function"?(n=t,t=r=void 0):typeof r=="funct
|
|
|
290
290
|
n)}resume(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||
|
|
291
291
|
this._socket.resume())}send(t,r,n){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState \
|
|
292
292
|
0 (CONNECTING)");if(typeof r=="function"&&(n=r,r={}),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){ly(this,
|
|
293
|
-
t,n);return}let o={binary:typeof t!="string",mask:!this._isServer,compress:!0,fin:!0,...r};this._extensions[
|
|
293
|
+
t,n);return}let o={binary:typeof t!="string",mask:!this._isServer,compress:!0,fin:!0,...r};this._extensions[Fo.extensionName]||
|
|
294
294
|
(o.compress=!1),this._sender.send(t||Ff,o,n)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){
|
|
295
295
|
Ir(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=e.
|
|
296
296
|
CLOSING,this._socket.destroy())}}};Object.defineProperty(ht,"CONNECTING",{enumerable:!0,value:io.indexOf("CONNECTING")});
|
|
@@ -315,8 +315,8 @@ t;else try{i=new cy(t)}catch{throw new SyntaxError(`Invalid URL: ${t}`)}i.protoc
|
|
|
315
315
|
throw g;Bf(e,g);return}let u=s?443:80,d=QW(16).toString("base64"),l=s?XW.request:YW.request,p=new Set,f;if(o.createConnection=
|
|
316
316
|
o.createConnection||(s?hK:mK),o.defaultPort=o.defaultPort||u,o.port=i.port||u,o.host=i.hostname.startsWith("[")?i.hostname.
|
|
317
317
|
slice(1,-1):i.hostname,o.headers={...o.headers,"Sec-WebSocket-Version":o.protocolVersion,"Sec-WebSocket-Key":d,Connection:"\
|
|
318
|
-
Upgrade",Upgrade:"websocket"},o.path=i.pathname+i.search,o.timeout=o.handshakeTimeout,o.perMessageDeflate&&(f=new
|
|
319
|
-
perMessageDeflate,isServer:!1,maxPayload:o.maxPayload}),o.headers["Sec-WebSocket-Extensions"]=dK({[
|
|
318
|
+
Upgrade",Upgrade:"websocket"},o.path=i.pathname+i.search,o.timeout=o.handshakeTimeout,o.perMessageDeflate&&(f=new Fo({...o.
|
|
319
|
+
perMessageDeflate,isServer:!1,maxPayload:o.maxPayload}),o.headers["Sec-WebSocket-Extensions"]=dK({[Fo.extensionName]:f.offer()})),
|
|
320
320
|
r.length){for(let g of r){if(typeof g!="string"||!fK.test(g)||p.has(g))throw new SyntaxError("An invalid or duplicated s\
|
|
321
321
|
ubprotocol was specified");p.add(g)}o.headers["Sec-WebSocket-Protocol"]=r.join(",")}if(o.origin&&(o.protocolVersion<13?o.
|
|
322
322
|
headers["Sec-WebSocket-Origin"]=o.origin:o.headers.Origin=o.origin),(i.username||i.password)&&(o.auth=`${i.username}:${i.
|
|
@@ -337,9 +337,9 @@ t"]!==_){Ir(e,y,"Invalid Sec-WebSocket-Accept header");return}let I=g.headers["s
|
|
|
337
337
|
p.size?p.has(I)||(E="Server sent an invalid subprotocol"):E="Server sent a subprotocol but none was requested":p.size&&(E=
|
|
338
338
|
"Server sent no subprotocol"),E){Ir(e,y,E);return}I&&(e._protocol=I);let C=g.headers["sec-websocket-extensions"];if(C!==
|
|
339
339
|
void 0){if(!f){Ir(e,y,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let T;try{T=
|
|
340
|
-
lK(C)}catch{Ir(e,y,"Invalid Sec-WebSocket-Extensions header");return}let M=Object.keys(T);if(M.length!==1||M[0]!==
|
|
341
|
-
Ir(e,y,"Server indicated an extension that was not requested");return}try{f.accept(T[
|
|
342
|
-
valid Sec-WebSocket-Extensions header");return}e._extensions[
|
|
340
|
+
lK(C)}catch{Ir(e,y,"Invalid Sec-WebSocket-Extensions header");return}let M=Object.keys(T);if(M.length!==1||M[0]!==Fo.extensionName){
|
|
341
|
+
Ir(e,y,"Server indicated an extension that was not requested");return}try{f.accept(T[Fo.extensionName])}catch{Ir(e,y,"In\
|
|
342
|
+
valid Sec-WebSocket-Extensions header");return}e._extensions[Fo.extensionName]=f}e.setSocket(y,m,{allowSynchronousEvents:o.
|
|
343
343
|
allowSynchronousEvents,generateMask:o.generateMask,maxBufferedChunks:o.maxBufferedChunks,maxFragments:o.maxFragments,maxPayload:o.
|
|
344
344
|
maxPayload,skipUTF8Validation:o.skipUTF8Validation})}),o.finishRequest?o.finishRequest(v,e):v.end()}function Bf(e,t){e._readyState=
|
|
345
345
|
ht.CLOSING,e._errorEmitted=!0,e.emit("error",t),e.emitClose()}function mK(e){return e.path=e.socketPath,ck.connect(e)}function hK(e){
|
|
@@ -1171,24 +1171,24 @@ he \`cancelSignal\` option must be an AbortSignal: ${String(e)}`)},Px=({subproce
|
|
|
1171
1171
|
controller:o})=>t===void 0||r?[]:[B4(e,t,n,o)],B4=async(e,t,r,{signal:n})=>{throw await hp(t,n),r.terminationReason??="c\
|
|
1172
1172
|
ancel",e.kill(),t.reason};import{scheduler as uB}from"node:timers/promises";import{promisify as sB}from"node:util";var ta=({methodName:e,isSubprocess:t,ipc:r,isConnected:n})=>{q4(e,t,r),Yg(e,t,n)},q4=(e,t,r)=>{if(!r)throw new Error(`${an(
|
|
1173
1173
|
e,t)} can only be used if the \`ipc\` option is \`true\`.`)},Yg=(e,t,r)=>{if(!r)throw new Error(`${an(e,t)} cannot be us\
|
|
1174
|
-
ed: the ${
|
|
1175
|
-
ete: the ${
|
|
1174
|
+
ed: the ${Co(t)} has already exited or disconnected.`)},kx=e=>{throw new Error(`${an("getOneMessage",e)} could not compl\
|
|
1175
|
+
ete: the ${Co(e)} exited or disconnected.`)},Nx=e=>{throw new Error(`${an("sendMessage",e)} failed: the ${Co(e)} is send\
|
|
1176
1176
|
ing a message too, instead of listening to incoming messages.
|
|
1177
1177
|
This can be fixed by both sending a message and listening to incoming messages at the same time:
|
|
1178
1178
|
|
|
1179
1179
|
const [receivedMessage] = await Promise.all([
|
|
1180
1180
|
${an("getOneMessage",e)},
|
|
1181
1181
|
${an("sendMessage",e,"message, {strict: true}")},
|
|
1182
|
-
]);`)},gp=(e,t)=>new Error(`${an("sendMessage",t)} failed when sending an acknowledgment response to the ${
|
|
1183
|
-
jx=e=>{throw new Error(`${an("sendMessage",e)} failed: the ${
|
|
1184
|
-
`${an("sendMessage",e)} failed: the ${
|
|
1185
|
-
Signal\` aborted: the ${
|
|
1182
|
+
]);`)},gp=(e,t)=>new Error(`${an("sendMessage",t)} failed when sending an acknowledgment response to the ${Co(t)}.`,{cause:e}),
|
|
1183
|
+
jx=e=>{throw new Error(`${an("sendMessage",e)} failed: the ${Co(e)} is not listening to incoming messages.`)},Mx=e=>{throw new Error(
|
|
1184
|
+
`${an("sendMessage",e)} failed: the ${Co(e)} exited without listening to incoming messages.`)},$x=()=>new Error(`\`cancel\
|
|
1185
|
+
Signal\` aborted: the ${Co(!0)} disconnected.`),Lx=()=>{throw new Error("`getCancelSignal()` cannot be used without sett\
|
|
1186
1186
|
ing the `cancelSignal` subprocess option.")},Dx=({error:e,methodName:t,isSubprocess:r})=>{if(e.code==="EPIPE")throw new Error(
|
|
1187
|
-
`${an(t,r)} cannot be used: the ${
|
|
1187
|
+
`${an(t,r)} cannot be used: the ${Co(r)} is disconnecting.`,{cause:e})},zx=({error:e,methodName:t,isSubprocess:r,message:n})=>{
|
|
1188
1188
|
if(V4(e))throw new Error(`${an(t,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:e})},
|
|
1189
1189
|
V4=({code:e,message:t})=>H4.has(e)||G4.some(r=>t.includes(r)),H4=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),G4=[
|
|
1190
1190
|
"could not be cloned","circular structure","call stack size exceeded"],an=(e,t,r="")=>e==="cancelSignal"?"`cancelSignal`\
|
|
1191
|
-
's `controller.abort()`":`${W4(t)}${e}(${r})`,W4=e=>e?"":"subprocess.",
|
|
1191
|
+
's `controller.abort()`":`${W4(t)}${e}(${r})`,W4=e=>e?"":"subprocess.",Co=e=>e?"parent process":"subprocess",ra=e=>{e.connected&&
|
|
1192
1192
|
e.disconnect()};var Tn=()=>{let e={},t=new Promise((r,n)=>{Object.assign(e,{resolve:r,reject:n})});return Object.assign(t,e)};var vp=(e,t="stdin")=>{let{options:n,fileDescriptors:o}=Cn.get(e),i=Ux(o,t,!0),s=e.stdio[i];if(s===null)throw new TypeError(
|
|
1193
1193
|
Fx(i,t,n,!0));return s},na=(e,t="stdout")=>{let{options:n,fileDescriptors:o}=Cn.get(e),i=Ux(o,t,!1),s=i==="all"?e.all:e.
|
|
1194
1194
|
stdio[i];if(s==null)throw new TypeError(Fx(i,t,n,!1));return s},Cn=new WeakMap,Ux=(e,t,r)=>{let n=K4(t,r);return J4(n,t,
|
|
@@ -1212,11 +1212,11 @@ Vx=(e,t)=>{t&&(Zg(e),Zg(e))};var Hx=async({anyProcess:e,channel:t,isSubprocess:r
|
|
|
1212
1212
|
get(e);if(i.push(o),!(i.length>1))for(;i.length>0;){await Jx(e,n,o),await Q4.yield();let s=await Wx({wrappedMessage:i[0],
|
|
1213
1213
|
anyProcess:e,channel:t,isSubprocess:r,ipcEmitter:n});i.shift(),n.emit("message",s),n.emit("message:done")}},Gx=async({anyProcess:e,
|
|
1214
1214
|
channel:t,isSubprocess:r,ipcEmitter:n,boundOnMessage:o})=>{ew();let i=bp.get(e);for(;i?.length>0;)await Z4(n,"message:do\
|
|
1215
|
-
ne");e.removeListener("message",o),Vx(t,r),n.connected=!1,n.emit("disconnect")},bp=new WeakMap;var
|
|
1215
|
+
ne");e.removeListener("message",o),Vx(t,r),n.connected=!1,n.emit("disconnect")},bp=new WeakMap;var Ro=(e,t,r)=>{if(Ip.has(e))return Ip.get(e);let n=new eB;return n.connected=!0,Ip.set(e,n),tB({ipcEmitter:n,anyProcess:e,
|
|
1216
1216
|
channel:t,isSubprocess:r}),n},Ip=new WeakMap,tB=({ipcEmitter:e,anyProcess:t,channel:r,isSubprocess:n})=>{let o=Hx.bind(void 0,
|
|
1217
1217
|
{anyProcess:t,channel:r,isSubprocess:n,ipcEmitter:e});t.on("message",o),t.once("disconnect",Gx.bind(void 0,{anyProcess:t,
|
|
1218
1218
|
channel:r,isSubprocess:n,ipcEmitter:e,boundOnMessage:o})),qx(r,n)},Sp=e=>{let t=Ip.get(e);return t===void 0?e.channel!==
|
|
1219
|
-
null:t.connected};var Yx=({anyProcess:e,channel:t,isSubprocess:r,message:n,strict:o})=>{if(!o)return n;let i=
|
|
1219
|
+
null:t.connected};var Yx=({anyProcess:e,channel:t,isSubprocess:r,message:n,strict:o})=>{if(!o)return n;let i=Ro(e,t,r),s=xp(e,i);return{id:nB++,
|
|
1220
1220
|
type:Ep,message:n,hasListeners:s}},nB=0n,Zx=(e,t)=>{if(!(t?.type!==Ep||t.hasListeners))for(let{id:r}of e)r!==void 0&&Ap[r].
|
|
1221
1221
|
resolve({isDeadlock:!0,hasListeners:!1})},Wx=async({wrappedMessage:e,anyProcess:t,channel:r,isSubprocess:n,ipcEmitter:o})=>{
|
|
1222
1222
|
if(e?.type!==Ep||!t.connected)return e;let{id:i,message:s}=e,a={id:i,type:eT,message:xp(t,o)};try{await Tp({anyProcess:t,
|
|
@@ -1236,7 +1236,7 @@ e);try{await Promise.all([Qx(n,e,r),i(n)])}catch(s){throw Dx({error:s,methodName
|
|
|
1236
1236
|
isSubprocess:r,message:o}),s}},cB=e=>{if(tw.has(e))return tw.get(e);let t=sB(e.send.bind(e));return tw.set(e,t),t},tw=new WeakMap;var oT=(e,t)=>{let r="cancelSignal";return Yg(r,!1,e.connected),rw({anyProcess:e,methodName:r,isSubprocess:!1,wrappedMessage:{
|
|
1237
1237
|
type:sT,message:t},message:t})},iT=async({anyProcess:e,channel:t,isSubprocess:r,ipc:n})=>(await dB({anyProcess:e,channel:t,
|
|
1238
1238
|
isSubprocess:r,ipc:n}),nw.signal),dB=async({anyProcess:e,channel:t,isSubprocess:r,ipc:n})=>{if(!nT){if(nT=!0,!n){Lx();return}
|
|
1239
|
-
if(t===null){ew();return}
|
|
1239
|
+
if(t===null){ew();return}Ro(e,t,r),await uB.yield()}},nT=!1,Xx=e=>e?.type!==sT?!1:(nw.abort(e.message),!0),sT="execa:ipc\
|
|
1240
1240
|
:cancel",ew=()=>{nw.abort($x())},nw=new AbortController;var aT=({gracefulCancel:e,cancelSignal:t,ipc:r,serialization:n})=>{if(e){if(t===void 0)throw new Error("The `cancelSigna\
|
|
1241
1241
|
l` option must be defined when setting the `gracefulCancel` option.");if(!r)throw new Error("The `ipc` option cannot be \
|
|
1242
1242
|
false when setting the `gracefulCancel` option.");if(n==="json")throw new Error("The `serialization` option cannot be 'j\
|
|
@@ -1404,7 +1404,7 @@ prototype.toString.call(e)==="[object WritableStream]",O1=e=>tC(e)||Fp(e),mw=e=>
|
|
|
1404
1404
|
e)&&typeof e[Symbol.asyncIterator]=="function",k1=e=>rC(e)&&typeof e[Symbol.iterator]=="function",rC=e=>typeof e=="objec\
|
|
1405
1405
|
t"&&e!==null,zr=new Set(["generator","asyncGenerator","duplex","webTransform"]),Bp=new Set(["fileUrl","filePath","fileNu\
|
|
1406
1406
|
mber"]),hw=new Set(["fileUrl","filePath"]),nC=new Set([...hw,"webStream","nodeStream"]),oC=new Set(["webTransform","dupl\
|
|
1407
|
-
ex"]),
|
|
1407
|
+
ex"]),Oo={generator:"a generator",asyncGenerator:"an async generator",fileUrl:"a file URL",filePath:"a file path string",
|
|
1408
1408
|
fileNumber:"a file descriptor number",webStream:"a web stream",nodeStream:"a Node.js stream",webTransform:"a web Transfo\
|
|
1409
1409
|
rmStream",duplex:"a Duplex stream",native:"any value",iterable:"an iterable",asyncIterable:"an async iterable",string:"a\
|
|
1410
1410
|
string",uint8Array:"a Uint8Array"};var gw=(e,t,r,n)=>n==="output"?N1(e,t,r):j1(e,t,r),N1=(e,t,r)=>{let n=t!==0&&r[t-1].value.readableObjectMode;return{writableObjectMode:n,
|
|
@@ -1459,7 +1459,7 @@ type:t,value:r,optionName:n,direction:o})=>{let i=e.filter(a=>aq(a,r));if(i.leng
|
|
|
1459
1459
|
o);return vC(s,n,t),o==="output"?i[0].stream:void 0},aq=({type:e,value:t},r)=>e==="filePath"?t.file===r.file:e==="fileUr\
|
|
1460
1460
|
l"?t.href===r.href:t===r,cq=({otherStdioItems:e,type:t,value:r,optionName:n})=>{let o=e.find(({value:{transform:i}})=>i===
|
|
1461
1461
|
r.transform);vC(o,n,t)},vC=(e,t,r)=>{if(e!==void 0)throw new TypeError(`The \`${e.optionName}\` and \`${t}\` options must\
|
|
1462
|
-
not target ${
|
|
1462
|
+
not target ${Oo[r]} that is the same.`)};var qp=(e,t,r,n)=>{let i=dC(t,r,n).map((a,c)=>uq({stdioOption:a,fdNumber:c,options:t,isSync:n})),s=wq({initialFileDescriptors:i,
|
|
1463
1463
|
addProperties:e,options:t,isSync:n});return t.stdio=s.map(({stdioItems:a})=>_q(a)),s},uq=({stdioOption:e,fdNumber:t,options:r,
|
|
1464
1464
|
isSync:n})=>{let o=ep(t),{stdioItems:i,isStdioArray:s}=dq({stdioOption:e,fdNumber:t,options:r,optionName:o}),a=aC(i,t,o),
|
|
1465
1465
|
c=i.map(l=>fC({stdioItem:l,isStdioArray:s,fdNumber:t,direction:a,isSync:n})),u=sC(c,o,a,r),d=iC(u,a);return gq(u,d),{direction:a,
|
|
@@ -1479,7 +1479,7 @@ direction:e,options:i,fileDescriptors:n,isSync:s}));return{direction:e,objectMod
|
|
|
1479
1479
|
direction:r,options:n,fileDescriptors:o,isSync:i})=>{let s=gC({stdioItem:e,direction:r,fileDescriptors:o,isSync:i});return s!==
|
|
1480
1480
|
void 0?{...e,stream:s}:{...e,...t[r][e.type](e,n)}},yw=e=>{for(let{stdioItems:t}of e)for(let{stream:r}of t)r!==void 0&&!on(
|
|
1481
1481
|
r)&&r.destroy()},_q=e=>{if(e.length>1)return e.some(({value:n})=>n==="overlapped")?"overlapped":"pipe";let[{type:t,value:r}]=e;
|
|
1482
|
-
return t==="native"?r:"pipe"};var bC=(e,t)=>qp(Iq,e,t,!0),On=({type:e,optionName:t})=>{IC(t,
|
|
1482
|
+
return t==="native"?r:"pipe"};var bC=(e,t)=>qp(Iq,e,t,!0),On=({type:e,optionName:t})=>{IC(t,Oo[e])},bq=({optionName:e,value:t})=>((t==="ipc"||t==="ove\
|
|
1483
1483
|
rlapped")&&IC(e,`"${t}"`),{}),IC=(e,t)=>{throw new TypeError(`The \`${e}\` option cannot be ${t} with synchronous method\
|
|
1484
1484
|
s.`)},_C={generator(){},asyncGenerator:On,webStream:On,nodeStream:On,webTransform:On,duplex:On,asyncIterable:On,native:bq},
|
|
1485
1485
|
Iq={input:{..._C,fileUrl:({value:e})=>({contents:[Yn(yC(e))]}),filePath:({value:{file:e}})=>({contents:[Yn(yC(e))]}),fileNumber:On,
|
|
@@ -1520,7 +1520,7 @@ binary:r,writableObjectMode:n,readableObjectMode:o,preserveNewlines:i},s,a)=>{le
|
|
|
1520
1520
|
n),Vp(r,i,n,c),{transform:e,final:t},{transform:TC(o,a)},EC({binary:r,preserveNewlines:i,readableObjectMode:o,state:c})].
|
|
1521
1521
|
filter(Boolean)};var MC=(e,t)=>{for(let r of Vq(e))Hq(e,r,t)},Vq=e=>new Set(Object.entries(e).filter(([,{direction:t}])=>t==="input").map(
|
|
1522
1522
|
([t])=>Number(t))),Hq=(e,t,r)=>{let{stdioItems:n}=e[t],o=n.filter(({contents:a})=>a!==void 0);if(o.length===0)return;if(t!==
|
|
1523
|
-
0){let[{type:a,optionName:c}]=o;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${
|
|
1523
|
+
0){let[{type:a,optionName:c}]=o;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${Oo[a]} with synch\
|
|
1524
1524
|
ronous methods.`)}let s=o.map(({contents:a})=>a).map(a=>Gq(a,n));r.input=Mu(s)},Gq=(e,t)=>{let r=Wp(e,t,"utf8",!0);return Wq(
|
|
1525
1525
|
r),Mu(r)},Wq=e=>{let t=e.find(r=>typeof r!="string"&&!Ot(r));if(t!==void 0)throw new TypeError(`The \`stdin\` option is in\
|
|
1526
1526
|
valid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${t}.`)};import{writeFileSync as Yq,appendFileSync as Zq}from"node:fs";var Kp=({stdioItems:e,encoding:t,verboseInfo:r,fdNumber:n})=>n!=="all"&&Zs(r,n)&&!_r.has(t)&&Kq(n)&&(e.some(({type:o,value:i})=>o===
|
|
@@ -1561,13 +1561,13 @@ timedOut:n,isMaxBuffer:o,stdio:i,all:s,options:a,command:c,escapedCommand:u,star
|
|
|
1561
1561
|
stdio:i,all:s,ipcOutput:[],options:a,startTime:d}):Vu({error:e,command:c,escapedCommand:u,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,
|
|
1562
1562
|
isMaxBuffer:o,isForcefullyTerminated:!1,exitCode:t,signal:r,stdio:i,all:s,ipcOutput:[],options:a,startTime:d,isSync:!0});import{setMaxListeners as tH}from"node:events";import{spawn as rH}from"node:child_process";import XC from"node:process";import{once as Cw,on as h6}from"node:events";var GC=({anyProcess:e,channel:t,isSubprocess:r,ipc:n},{reference:o=!0,filter:i}={})=>(ta({methodName:"getOneMessage",isSubprocess:r,
|
|
1563
1563
|
ipc:n,isConnected:Sp(e)}),g6({anyProcess:e,channel:t,isSubprocess:r,filter:i,reference:o})),g6=async({anyProcess:e,channel:t,
|
|
1564
|
-
isSubprocess:r,filter:n,reference:o})=>{yp(t,o);let i=
|
|
1564
|
+
isSubprocess:r,filter:n,reference:o})=>{yp(t,o);let i=Ro(e,t,r),s=new AbortController;try{return await Promise.race([w6(
|
|
1565
1565
|
i,n,s),v6(i,r,s),y6(i,r,s)])}catch(a){throw ra(e),a}finally{s.abort(),_p(t,o)}},w6=async(e,t,{signal:r})=>{if(t===void 0){
|
|
1566
1566
|
let[n]=await Cw(e,"message",{signal:r});return n}for await(let[n]of h6(e,"message",{signal:r}))if(t(n))return n},v6=async(e,t,{
|
|
1567
1567
|
signal:r})=>{await Cw(e,"disconnect",{signal:r}),kx(t)},y6=async(e,t,{signal:r})=>{let[n]=await Cw(e,"strict:error",{signal:r});
|
|
1568
1568
|
throw gp(n,t)};import{once as KC,on as _6}from"node:events";var JC=({anyProcess:e,channel:t,isSubprocess:r,ipc:n},{reference:o=!0}={})=>Rw({anyProcess:e,channel:t,isSubprocess:r,ipc:n,
|
|
1569
1569
|
shouldAwait:!r,reference:o}),Rw=({anyProcess:e,channel:t,isSubprocess:r,ipc:n,shouldAwait:o,reference:i})=>{ta({methodName:"\
|
|
1570
|
-
getEachMessage",isSubprocess:r,ipc:n,isConnected:Sp(e)}),yp(t,i);let s=
|
|
1570
|
+
getEachMessage",isSubprocess:r,ipc:n,isConnected:Sp(e)}),yp(t,i);let s=Ro(e,t,r),a=new AbortController,c={};return b6(e,
|
|
1571
1571
|
s,a),I6({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),S6({anyProcess:e,channel:t,ipcEmitter:s,isSubprocess:r,shouldAwait:o,
|
|
1572
1572
|
controller:a,state:c,reference:i})},b6=async(e,t,r)=>{try{await KC(t,"disconnect",{signal:r.signal}),r.abort()}catch{}},
|
|
1573
1573
|
I6=async({ipcEmitter:e,isSubprocess:t,controller:r,state:n})=>{try{let[o]=await KC(e,"strict:error",{signal:r.signal});n.
|
|
@@ -1582,7 +1582,7 @@ options:o,startTime:i,isSync:!1}),u=N6(c,s,o);return{subprocess:a,promise:u}},R6
|
|
|
1582
1582
|
from({length:t.length-3},Gu),s=Gu(),a=[r,n,o,...i];Object.assign(e,{stdin:r,stdout:n,stderr:o,all:s,stdio:a})},Gu=()=>{let e=new E6;
|
|
1583
1583
|
return e.end(),e},O6=()=>new x6({read(){}}),P6=()=>new T6({write(){}}),k6=()=>new C6({read(){},write(){}}),N6=async(e,t,r)=>aa(
|
|
1584
1584
|
e,t,r);import{createReadStream as tR,createWriteStream as rR}from"node:fs";import{Buffer as j6}from"node:buffer";import{Readable as Wu,
|
|
1585
|
-
Writable as M6,Duplex as $6}from"node:stream";var oR=(e,t)=>qp(L6,e,t,!1),Ku=({type:e,optionName:t})=>{throw new TypeError(`The \`${t}\` option cannot be ${
|
|
1585
|
+
Writable as M6,Duplex as $6}from"node:stream";var oR=(e,t)=>qp(L6,e,t,!1),Ku=({type:e,optionName:t})=>{throw new TypeError(`The \`${t}\` option cannot be ${Oo[e]}.`)},
|
|
1586
1586
|
nR={fileNumber:Ku,generator:Ew,asyncGenerator:Ew,nodeStream:({value:e})=>({stream:e}),webTransform({value:{transform:e,writableObjectMode:t,
|
|
1587
1587
|
readableObjectMode:r}}){let n=t||r;return{stream:$6.fromWeb(e,{objectMode:n})}},duplex:({value:{transform:e}})=>({stream:e}),
|
|
1588
1588
|
native(){}},L6={input:{...nR,fileUrl:({value:e})=>({stream:tR(e)}),filePath:({value:{file:e}})=>({stream:tR(e)}),webStream:({
|
|
@@ -1774,7 +1774,7 @@ terminationReason==="timeout",isCanceled:s.terminationReason==="cancel"||s.termi
|
|
|
1774
1774
|
terminationReason==="gracefulCancel",isMaxBuffer:e.error instanceof Rn,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:t,
|
|
1775
1775
|
signal:r,stdio:n,all:o,ipcOutput:i,options:a,startTime:d,isSync:!1}):zp({command:c,escapedCommand:u,stdio:n,all:o,ipcOutput:i,
|
|
1776
1776
|
options:a,startTime:d});var sf=(e,t)=>{let r=Object.fromEntries(Object.entries(t).map(([n,o])=>[n,cH(n,e[n],o)]));return{...e,...r}},cH=(e,t,r)=>uH.
|
|
1777
|
-
has(e)&&bt(t)&&bt(r)?{...t,...r}:r,uH=new Set(["env",...Mg]);var
|
|
1777
|
+
has(e)&&bt(t)&&bt(r)?{...t,...r}:r,uH=new Set(["env",...Mg]);var Po=(e,t,r,n)=>{let o=(s,a,c)=>Po(s,a,r,c),i=(...s)=>dH({mapArguments:e,deepOptions:r,boundOptions:t,setBoundExeca:n,
|
|
1778
1778
|
createNested:o},...s);return n!==void 0&&n(i,o,t),i},dH=({mapArguments:e,deepOptions:t={},boundOptions:r={},setBoundExeca:n,
|
|
1779
1779
|
createNested:o},i,...s)=>{if(bt(i))return o(e,sf(r,i),n);let{file:a,commandArguments:c,options:u,isSync:d}=lH({mapArguments:e,
|
|
1780
1780
|
firstArgument:i,nextArguments:s,deepOptions:t,boundOptions:r});return d?HC(a,c,u):WR(a,c,u,o)},lH=({mapArguments:e,firstArgument:t,
|
|
@@ -1785,7 +1785,7 @@ length>0)throw new TypeError(`The command and its arguments must be passed as a
|
|
|
1785
1785
|
e);return{file:r,commandArguments:n}},pH=e=>{if(typeof e!="string")throw new TypeError(`The command must be a string: ${String(
|
|
1786
1786
|
e)}.`);let t=e.trim();if(t==="")return[];let r=[];for(let n of t.split(fH)){let o=r.at(-1);o&&o.endsWith("\\")?r[r.length-
|
|
1787
1787
|
1]=`${o.slice(0,-1)} ${n}`:r.push(n)}return r},fH=/ +/g;var YR=(e,t,r)=>{e.sync=t(mH,r),e.s=e.sync},ZR=({options:e})=>QR(e),mH=({options:e})=>({...QR(e),isSync:!0}),QR=e=>({options:{
|
|
1788
|
-
...hH(e),...e}}),hH=({input:e,inputFile:t,stdio:r})=>e===void 0&&t===void 0&&r===void 0?{stdin:"inherit"}:{},eO={preferLocal:!0};var tO=
|
|
1788
|
+
...hH(e),...e}}),hH=({input:e,inputFile:t,stdio:r})=>e===void 0&&t===void 0&&r===void 0?{stdin:"inherit"}:{},eO={preferLocal:!0};var tO=Po(()=>({})),Ohe=Po(()=>({isSync:!0})),Phe=Po(KR),khe=Po(JR),Nhe=Po(pT),jhe=Po(ZR,{},eO,YR),{sendMessage:Mhe,getOneMessage:$he,
|
|
1789
1789
|
getEachMessage:Lhe,getCancelSignal:Dhe}=ZC();function gH(e=0){let t=Number(e);return Number.isSafeInteger(t)?t:1}function Yu({code:e="",error:t="",exitCode:r=0,ok:n=null,
|
|
1790
1790
|
output:o="",outputEncoding:i="utf8",pid:s=null,signal:a="",stderr:c="",stdout:u="",timedOut:d=!1,execution:l=null,retryable:p=null}={}){
|
|
1791
1791
|
let f=gH(r),v=String(u||""),g=String(c||""),y=String(o||[v,g].filter(Boolean).join(`
|
|
@@ -1942,13 +1942,13 @@ ires a gitAuthToken.");throw t.code="vibe64_command_git_auth_token_required",t}r
|
|
|
1942
1942
|
[kO]:e.gitAuthToken})}function NO({request:e={}}={}){let t={GIT_TERMINAL_PROMPT:"0"},r=t;return e.gitTransport==="github\
|
|
1943
1943
|
-token"?r=nG(e):(e.gitTransport==="github-https"||e.purpose==="github")&&(r=Iv({...t,...gf()})),_v(r,e.gitSafeDirectories||
|
|
1944
1944
|
[])}import jO from"node:path";var Sv="NPM_CONFIG_PREFIX";function Av({env:e={}}={}){return Yt()?De(e?.[Sv])||(De(e?.HOME)?jO.join(De(e.HOME),".local"):
|
|
1945
|
-
""):""}function Ev(e={}){let t=Av(e);return t?{[Sv]:t}:{}}function xv(e={}){let t=Av(e);return t?[jO.join(t,"bin")]:[]}import{existsSync as oG,readdirSync as iG}from"node:fs";import sG from"node:os";import
|
|
1945
|
+
""):""}function Ev(e={}){let t=Av(e);return t?{[Sv]:t}:{}}function xv(e={}){let t=Av(e);return t?[jO.join(t,"bin")]:[]}import{existsSync as oG,readdirSync as iG}from"node:fs";import sG from"node:os";import ko from"node:path";import ya from"node:process";var $O="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin";function sd(e=""){return String(e||"").split(":").
|
|
1946
1946
|
map(Le).filter(Boolean)}function LO(e=[]){return e.filter(t=>{try{return oG(t)}catch{return!1}})}function MO(e="",t=/^$/u){
|
|
1947
1947
|
try{return iG(e).filter(r=>t.test(r)).sort((r,n)=>Number(/\d+/u.exec(n)?.[0]||0)-Number(/\d+/u.exec(r)?.[0]||0))}catch{return[]}}
|
|
1948
|
-
function aG(e=ya.env){if(Yt())return[];let t=String(e.HOME||sG.homedir()||"");if(!
|
|
1949
|
-
String(e.XDG_DATA_HOME||""))?e.XDG_DATA_HOME:
|
|
1950
|
-
|
|
1951
|
-
".bun/bin"].map(o=>
|
|
1948
|
+
function aG(e=ya.env){if(Yt())return[];let t=String(e.HOME||sG.homedir()||"");if(!ko.isAbsolute(t))return[];let r=ko.isAbsolute(
|
|
1949
|
+
String(e.XDG_DATA_HOME||""))?e.XDG_DATA_HOME:ko.join(t,".local/share"),n=ko.isAbsolute(String(e.MISE_DATA_DIR||""))?e.MISE_DATA_DIR:
|
|
1950
|
+
ko.join(r,"mise");return LO([ko.join(t,".local/bin"),ko.join(n,"shims"),...[".claude/local",".opencode/bin",".cargo/bin",
|
|
1951
|
+
".bun/bin"].map(o=>ko.join(t,o))])}function cG(){if(Yt())return[];let e=["/opt/homebrew","/usr/local"];return[...sd(ya.env.
|
|
1952
1952
|
PATH),...ya.platform==="darwin"?["/opt/homebrew/bin"]:[],...LO([...MO("/usr/lib/postgresql",/^\d+$/u).slice(0,1).map(t=>`\
|
|
1953
1953
|
/usr/lib/postgresql/${t}/bin`),...ya.platform==="darwin"?e.flatMap(t=>[...MO(`${t}/opt`,/^postgresql@\d+$/u).slice(0,1).
|
|
1954
1954
|
map(r=>`${t}/opt/${r}/bin`),`${t}/opt/mariadb/bin`]):[]])]}function DO({env:e=ya.env,existingPath:t="",inheritedPath:r="",
|
|
@@ -2077,7 +2077,7 @@ control","job","preview","service","terminal"]),iP=Object.freeze(["finite","inte
|
|
|
2077
2077
|
node26","git","gh","mysql","mariadb","postgresql","sqlite","ripgrep","bubblewrap","bun","php","composer","awsebcli","cpp",
|
|
2078
2078
|
"python","ruby","go","java","kotlin","csharp","rust","playwright","operator-clis"]),o2=1e3*1e3*100,i2=new Set(["assistan\
|
|
2079
2079
|
t","codex","deployment","output","preview","source","terminal"]);function Ur(e="",t="vibe64_command_request_invalid"){let r=new Error(
|
|
2080
|
-
e||"Invalid Vibe64 command request.");return r.code=t,r}function
|
|
2080
|
+
e||"Invalid Vibe64 command request.");return r.code=t,r}function No(e="",t=[],r="",n="value"){let o=Le(e)||r;if(!t.includes(
|
|
2081
2081
|
o))throw Ur(`Unsupported Vibe64 command ${n}: ${o||"(empty)"}.`,`vibe64_command_${n}_unsupported`);return o}function s2(e=[],{
|
|
2082
2082
|
mode:t="capture"}={}){if(typeof e=="function"){if(t!=="pty")throw Ur("Function-valued command args are only supported fo\
|
|
2083
2083
|
r PTY commands.","vibe64_command_args_function_requires_pty");return e}return(Array.isArray(e)?e:[e]).map(r=>String(r??""))}
|
|
@@ -2094,8 +2094,8 @@ t.username||t.ownerUserKey||t.userKey)}:{}}function d2(e="capture"){return e==="
|
|
|
2094
2094
|
ve":"finite"}function l2({mode:e="capture",purpose:t="terminal"}={}){return t==="preview"?"preview":e==="pty"?"terminal":
|
|
2095
2095
|
"job"}function Ia(e=""){let t=Le(e);if(!t)return"";if(!/^[A-Za-z0-9](?:[A-Za-z0-9._:-]{0,254}[A-Za-z0-9])?$/u.test(t))throw Ur(
|
|
2096
2096
|
`Invalid Vibe64 execution identifier: ${t}.`,"vibe64_execution_identifier_invalid");return t}function sP(e={},{mode:t="c\
|
|
2097
|
-
apture",project:r={},purpose:n="terminal",session:o={}}={}){let i=Rt(e),s=
|
|
2098
|
-
_kind"),a=
|
|
2097
|
+
apture",project:r={},purpose:n="terminal",session:o={}}={}){let i=Rt(e),s=No(i.kind,oP,l2({mode:t,purpose:n}),"execution\
|
|
2098
|
+
_kind"),a=No(i.lifecycle,iP,d2(t),"execution_lifecycle");if(t==="detached"&&a!=="service"||t==="pty"&&a!=="interactive"||
|
|
2099
2099
|
t==="capture"&&a!=="finite")throw Ur(`Execution lifecycle ${a} is incompatible with command mode ${t}.`,"vibe64_executio\
|
|
2100
2100
|
n_lifecycle_incompatible");let c=Ia(i.ownerId||o.sessionId||o.id);if(a==="service"&&!c)throw Ur("Service execution requi\
|
|
2101
2101
|
res a durable owner id.","vibe64_execution_owner_required");let u=i.resourceProfile;if(u!=null&&(!u||typeof u!="object"||
|
|
@@ -2110,20 +2110,20 @@ test(e))throw Ur("Execution requires a valid managed workflow id.","vibe64_workf
|
|
|
2110
2110
|
function f2(e=""){return i2.has(e)?nd:[]}function nP(e={},t=""){return Object.prototype.hasOwnProperty.call(e,t)}function m2(e={},t=""){
|
|
2111
2111
|
let r=nP(e,"runtimes"),n=nP(e,"runtime");if(!r&&!n)return Jn(f2(t));let o=r?e.runtimes:e.runtime;return Jn((Array.isArray(
|
|
2112
2112
|
o)?o:[o]).map(Le).filter(Boolean))}function aP(e={}){let t=Rt(e),r=Le(t.command);if(!r)throw Ur("A command is required.",
|
|
2113
|
-
"vibe64_command_required");let n=
|
|
2113
|
+
"vibe64_command_required");let n=No(t.mode,QG,"capture","mode");if(t.signal!=null&&(!(t.signal instanceof AbortSignal)||
|
|
2114
2114
|
n!=="capture"))throw Ur("Cancellation signals require a finite capture command.","vibe64_command_signal_invalid");let o=Kt(
|
|
2115
|
-
t.baseEnv),i=a2(t.env!==void 0?t.env:t.extraEnv,{mode:n}),s=
|
|
2115
|
+
t.baseEnv),i=a2(t.env!==void 0?t.env:t.extraEnv,{mode:n}),s=No(t.purpose,ZG,"terminal","purpose"),a=m2(t,s);for(let l of a)
|
|
2116
2116
|
if(!n2.includes(l))throw Ur(`Unsupported Vibe64 runtime: ${l}.`,"vibe64_command_runtime_unsupported");let c=Rt(t.project),
|
|
2117
2117
|
u=Rt(t.session),d=t.releaseEnvironmentFile??"";if(typeof d!="string"||d&&(!d.startsWith("/")||/[\r\n\0]/u.test(d)||n!=="\
|
|
2118
2118
|
capture"||t.actor!=="app"||t.envPolicy!=="deployment"||Object.keys(i.env).length||i.envFactory||Object.keys(o).length))throw Ur(
|
|
2119
2119
|
"Release environment files require a finite application deployment command without caller Env.","vibe64_command_release_\
|
|
2120
|
-
environment_invalid");return{actor:
|
|
2121
|
-
baseEnv:o,command:r,cwd:De(t.cwd||process.cwd()),env:i.env,envFactory:i.envFactory,envPolicy:
|
|
2120
|
+
environment_invalid");return{actor:No(t.actor,YG,"daemon","actor"),allowedRoots:jv(t.allowedRoots),args:s2(t.args,{mode:n}),
|
|
2121
|
+
baseEnv:o,command:r,cwd:De(t.cwd||process.cwd()),env:i.env,envFactory:i.envFactory,envPolicy:No(t.envPolicy,t2,"session",
|
|
2122
2122
|
"env_policy"),releaseEnvironmentFile:d,execution:sP(t.execution,{mode:n,project:c,purpose:s,session:u}),credentialHome:u2(
|
|
2123
2123
|
t.credentialHome),gitAuthToken:Le(t.gitAuthToken||t.gitCredentials?.token),gitSafeDirectories:jv(t.gitSafeDirectories||t.
|
|
2124
|
-
safeDirectories),gitTransport:
|
|
2124
|
+
safeDirectories),gitTransport:No(t.gitTransport,r2,t.githubTransport?"github-https":"none","git_transport"),inheritProcessEnv:!d&&
|
|
2125
2125
|
t.inheritProcessEnv!==!1,input:t.stdin??t.input,logPath:De(t.logPath),maxBuffer:Number.isSafeInteger(Number(t.maxBuffer))&&
|
|
2126
|
-
Number(t.maxBuffer)>0?Number(t.maxBuffer):o2,mode:n,onOutput:typeof t.onOutput=="function"?t.onOutput:null,outputEncoding:
|
|
2126
|
+
Number(t.maxBuffer)>0?Number(t.maxBuffer):o2,mode:n,onOutput:typeof t.onOutput=="function"?t.onOutput:null,outputEncoding:No(
|
|
2127
2127
|
t.outputEncoding,e2,"utf8","output_encoding"),project:c,purpose:s,runtimes:a,session:u,signal:t.signal??null,shimDirs:jv(
|
|
2128
2128
|
t.shimDirs),terminal:c2(t.terminal||t.pty),timeout:Number.isSafeInteger(Number(t.timeout))&&Number(t.timeout)>0?Number(t.
|
|
2129
2129
|
timeout):15e3,userKey:Le(t.userKey)}}var h2=null,cP="VIBE64_MANAGED_EXECUTION_REQUIRED";function Mv(){return h2}function If(e=process.env){return["1","true"].includes(String(e?.[cP]||"").trim().toLowerCase())}async function g2(e,{actor:t,baseEnv:r,localPath:n,cwd:o,env:i,requiresHelper:s}={}){return e.releaseEnvironmentFile?Jt(
|
|
@@ -2133,7 +2133,7 @@ e.mode==="pty"?ZO(e,{actor:t,baseEnv:r,localPath:n,cwd:o,env:i}):e.mode==="detac
|
|
|
2133
2133
|
supported",{execution:e.execution}):oO(e,{actor:t,cwd:o,env:i}):s?{...await av(Qu({actor:t,args:e.args,command:e.command,
|
|
2134
2134
|
cwd:o,env:i,input:e.input,operation:ed(e)}),{maxBuffer:e.maxBuffer,outputEncoding:e.outputEncoding,signal:e.signal,timeout:e.
|
|
2135
2135
|
timeout}),execution:e.execution}:Zu(e.command,e.args,{cwd:o,env:i,execution:e.execution,input:e.input,maxBuffer:e.maxBuffer,
|
|
2136
|
-
onOutput:e.onOutput,outputEncoding:e.outputEncoding,signal:e.signal,timeout:e.timeout})}async function
|
|
2136
|
+
onOutput:e.onOutput,outputEncoding:e.outputEncoding,signal:e.signal,timeout:e.timeout})}async function jo(e={}){let t=null;
|
|
2137
2137
|
try{if(t=aP(e),t.signal?.aborted)return Jt("Command cancelled.","vibe64_command_cancelled",{execution:t.execution});let r=await lO(
|
|
2138
2138
|
t),n=t.inheritProcessEnv?{...process.env,...t.baseEnv}:{...t.baseEnv},o=(v={})=>({...v,VIBE64_EXECUTION_ID:t.execution.id}),
|
|
2139
2139
|
i=Mv(),s=If(n)||If(process.env),a=pf(r),c=!i&&!s&&!a&&!lf(n)&&!lf(process.env)&&la(r)?[n.PATH,process.env.PATH].filter(Boolean).
|
|
@@ -2333,14 +2333,14 @@ test(o.topic.commit)||typeof o.topic.topicHash!="string"||!/^[a-f0-9]{64}$/u.tes
|
|
|
2333
2333
|
"string"||!s.test(o.lesson.code)||typeof o.lesson.hash!="string"||!/^[a-f0-9]{64}$/u.test(o.lesson.hash)||i.kind!=="bund\
|
|
2334
2334
|
led")throw Dv();let c=i.sourcePath;if(typeof c!="string"||!c||c.length>512||c.includes("\\")||c.includes("\0")||V2.posix.
|
|
2335
2335
|
isAbsolute(c)||/^[a-zA-Z][a-zA-Z0-9+.-]*:/u.test(c)||c!=="."&&c.split("/").some(u=>!u||u==="."||u===".."))throw Dv();return{
|
|
2336
|
-
schemaVersion:2,learnerKey:r,practiceId:n,pin:{course:{...o.course},topic:{...o.topic},lesson:{...o.lesson}},exercise:{...i}}}var nSe=Object.freeze({on:!1,currentAttemptId:"",lessonCode:"",practiceSlug:""});var bSe=new K2;import
|
|
2337
|
-
e?.mode||"").trim().toLowerCase();return e?.local===!0||t==="local"||t==="local-editor"}function Q2(e=ud.homedir(),t
|
|
2338
|
-
upport","Vibe64"));let n=String(
|
|
2339
|
-
64"))}function eW({home:e=ud.homedir()}={}){return
|
|
2340
|
-
return
|
|
2341
|
-
return String(i||"").trim()
|
|
2336
|
+
schemaVersion:2,learnerKey:r,practiceId:n,pin:{course:{...o.course},topic:{...o.topic},lesson:{...o.lesson}},exercise:{...i}}}var nSe=Object.freeze({on:!1,currentAttemptId:"",lessonCode:"",practiceSlug:""});var bSe=new K2;import Mo from"node:path";import $o from"node:process";import ud from"node:os";var J2="VIBE64_SERVICE_DATA_ROOT";var Uv="VIBE64_SYSTEM_ROOT",X2=".vibe64-demon";var Y2="Vibe64";function Lo(e,t){let r=String(e||"").trim();return Mo.resolve(r||t||$o.cwd())}function Z2(e={}){let t=String(
|
|
2337
|
+
e?.mode||"").trim().toLowerCase();return e?.local===!0||t==="local"||t==="local-editor"}function Q2(e=ud.homedir(),t=$o.platform){let r=e||$o.cwd();if(t==="darwin")return Lo(Mo.join(r,"Library","Application S\
|
|
2338
|
+
upport","Vibe64"));let n=String($o.env.XDG_STATE_HOME||"").trim();return Lo(Mo.join(n||Mo.join(r,".local","state"),"vibe\
|
|
2339
|
+
64"))}function eW({home:e=ud.homedir()}={}){return Lo(Mo.join(e||$o.cwd(),Y2))}function fP({explicitRoot:e="",home:t=ud.homedir()}={}){
|
|
2340
|
+
return Lo(e,eW({home:t}))}function tW({env:e=$o.env,explicitRoot:t="",home:r=ud.homedir(),projectsRoot:n="",runtimeProfile:o=null}={}){let i=t||e[Uv];
|
|
2341
|
+
return String(i||"").trim()?Lo(i):Z2(o)?Q2(r):Lo(Mo.join(n||Mo.join(r||$o.cwd(),"vibe64"),X2))}function mP({env:e=$o.env,
|
|
2342
2342
|
explicitRoot:t="",home:r=ud.homedir(),runtimeProfile:n=null,systemRoot:o=""}={}){let i=t||e[J2];if(String(i||"").trim())
|
|
2343
|
-
return
|
|
2343
|
+
return Lo(i);let s=String(o||"").trim()?Lo(o):tW({env:e,home:r,runtimeProfile:n});return Mo.join(s,"services")}import{lstat as rW,readdir as nW}from"node:fs/promises";import Li from"node:path";var Fv=48,oW=/^[a-z0-9][a-z0-9_-]*$/u;function xf(e=""){let t=String(e||"").trim();if(!oW.test(t)){let r=new Error("Proj\
|
|
2344
2344
|
ect slug must start with a lowercase letter or number and contain only lowercase letters, numbers, underscores, or dashe\
|
|
2345
2345
|
s.");throw r.code="vibe64_invalid_project_slug",r}if(t.length>Fv){let r=new Error(`Project slug must be ${Fv} characters\
|
|
2346
2346
|
or fewer.`);throw r.code="vibe64_invalid_project_slug",r}return t}var hP="projects";async function mt(e){if(!Li.isAbsolute(
|
|
@@ -2403,7 +2403,7 @@ includeData:t=!1}={}){return pW("sha256").update(JSON.stringify({role:e.role,tex
|
|
|
2403
2403
|
r.turnId,n),role:n.role==="system"&&r.metadata?.runtime?.origin==="application"?"application":n.role,messageId:n.messageId,
|
|
2404
2404
|
text:n.text,...n.data!==void 0?{data:n.data}:{},...n.attachments?.length?{attachments:n.attachments}:{},...t?{engineId:r.
|
|
2405
2405
|
metadata?.runtime?.engine,originalVersion:r.metadata?.nativeMessageVersions?.[zi(r.turnId,n)]}:{},version:Sa(n,{includeData:!0})})))}function Rf(e){return Object.fromEntries(fW(e).map(t=>[t.id,t.version]))}var mW=["assistant","commentary","system","thinking","user"];function dd(){let e=()=>null;return{idle:new Promise(r=>{e=
|
|
2406
|
-
r}),operations:0,resolveIdle:e}}function
|
|
2406
|
+
r}),operations:0,resolveIdle:e}}function Do(e){return e.operations+=1,{active:!0}}function zo(e,t){t.active=!1,e.operations-=
|
|
2407
2407
|
1,e.operations===0&&e.resolveIdle()}function SP({role:e,at:t,messageId:r}={}){let n=String(e||"").trim();if(!mW.includes(n))return null;let o=t instanceof Date?
|
|
2408
2408
|
t:new Date(t);if(Number.isNaN(o.getTime()))return null;let i=o.toISOString().replace(/[-:]/gu,"").replace(".",""),s=String(
|
|
2409
2409
|
r||"").trim(),a=s?`.${s}`:"";return`${n}.${i}${a}.md`}function AP(e){if(!e.index){e.index=new Map;for(let[t,r]of e.turns)
|
|
@@ -2552,9 +2552,9 @@ has(e))throw new Error(`${t}() received unsafe path segment "${e}".`)}function q
|
|
|
2552
2552
|
/\[(.+?)\]/g,".$1").replace(/^\.+/,"").replace(/\.+/g,".").replace(/\.$/,"")}function My(e,t,{normalize:r=!1,allowEmpty:n=!1}={}){
|
|
2553
2553
|
let o=r?qJ(e):e;if(typeof o!="string"||o.trim()===""){if(n&&o==="")return[];throw new Error(`${t}() expects a non-empty \
|
|
2554
2554
|
dotted path string.`)}let i=o.split(".");if(i.some(s=>s===""))throw new Error(`${t}() received an invalid path "${o}".`);
|
|
2555
|
-
for(let s of i)BJ(s,t);return i}var VJ="http://json-schema.org/draft-07/schema#",
|
|
2555
|
+
for(let s of i)BJ(s,t);return i}var VJ="http://json-schema.org/draft-07/schema#",Bo="x-json-rest-schema",$y=["object","array","string","number","boolean"],
|
|
2556
2556
|
Ly=Symbol("json-rest-schema.exportContext"),HJ=["true","1","yes","y","on"],GJ=["false","0","no","n","off"];function _0(e){
|
|
2557
|
-
return{anyOf:[{type:"integer",minimum:-e,maximum:e},{type:"string",pattern:Ny}]}}function Ji(e,t){return{[
|
|
2557
|
+
return{anyOf:[{type:"integer",minimum:-e,maximum:e},{type:"string",pattern:Ny}]}}function Ji(e,t){return{[Bo]:{[e]:t}}}var WJ={
|
|
2558
2558
|
none:()=>({type:$y}),blob:()=>({type:$y}),serialize:()=>({type:$y}),object:()=>({type:"object"}),array:()=>({type:"array"}),
|
|
2559
2559
|
file:()=>({type:"string"}),string:()=>({type:"string"}),number:()=>({type:["number","string"]}),integer:()=>({type:["int\
|
|
2560
2560
|
eger","string"]}),epochMilliseconds:()=>_0(864e13),epochSeconds:()=>_0(864e10),dateTime:({definition:e,fieldName:t})=>({
|
|
@@ -2573,7 +2573,7 @@ Ji("transforms",{uppercase:!0}):null,lowercase:({parameterValue:e})=>e?Ji("trans
|
|
|
2573
2573
|
"metadata",{temporalPrecision:e}),strictBoolean:()=>null,required:()=>null,nullable:()=>null,nullOnEmpty:()=>null,defaultTo:()=>null};
|
|
2574
2574
|
function Fy(e,t){for(let r of Object.keys(t)){let n=t[r],o=e[r];if(n&&o&&typeof n=="object"&&typeof o=="object"&&!Array.
|
|
2575
2575
|
isArray(n)&&!Array.isArray(o)){Fy(o,n);continue}e[r]=n}}function JJ(e,t){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(
|
|
2576
|
-
"JSON Schema export hooks must return an object or null.");for(let r of Object.keys(t)){if(r===
|
|
2576
|
+
"JSON Schema export hooks must return an object or null.");for(let r of Object.keys(t)){if(r===Bo&&e[r]&&typeof e[r]=="o\
|
|
2577
2577
|
bject"&&typeof t[r]=="object"&&!Array.isArray(e[r])&&!Array.isArray(t[r])){Fy(e[r],t[r]);continue}e[r]=t[r]}}function XJ(e,t){
|
|
2578
2578
|
let n=[...Array.isArray(e.anyOf)&&Object.keys(e).length===1?e.anyOf:[e],...t];return n.length===1?e:{anyOf:n}}function YJ(e,t){
|
|
2579
2579
|
if(!Object.hasOwn(e.types,t.type))throw new Error(`No casting function for type: ${t.type}`);let r=e.types[t.type];if(typeof r.
|
|
@@ -2603,9 +2603,9 @@ s?{$ref:"#"}:S0(s,t)}function xd(e,{referenceBacked:t=!1}={}){return{schema:e,re
|
|
|
2603
2603
|
let i={},s=[];for(let[c,u]of Object.entries(e.structure))Ce(i,c,qy(e,c,u,t,r,n)),n.enforceRequired&&u.required===!0&&s.push(
|
|
2604
2604
|
c);let a={type:"object",properties:i,additionalProperties:o};return s.length>0&&(a.required=s),a}function s3(e,t,r,n,o,i){
|
|
2605
2605
|
let s=rm(t,r);if(!s)return null;if(s.kind==="schema")return{...im(By(s.schema,n,"replace",s.schema.operations.replace,!1)),
|
|
2606
|
-
[
|
|
2606
|
+
[Bo]:{castType:"object"}};let a=r.items.type==="object"&&Object.hasOwn(r.items,"schema")?"replace":o,c=a==="replace"?e.operations.
|
|
2607
2607
|
replace:i;return qy(e,`${t}[]`,r.items,n,a,c)}function a3(e,t,r,n,o,i){let s=Ad(t,r);if(!s)return null;if(s.kind==="sche\
|
|
2608
|
-
ma")return{...im(By(s.schema,n,"replace",s.schema.operations.replace,!1)),[
|
|
2608
|
+
ma")return{...im(By(s.schema,n,"replace",s.schema.operations.replace,!1)),[Bo]:{castType:"object"}};let a=s.definition.type===
|
|
2609
2609
|
"object"&&Object.hasOwn(s.definition,"schema")?"replace":o,c=a==="replace"?e.operations.replace:i;return qy(e,`${t}.*`,s.
|
|
2610
2610
|
definition,n,a,c)}function c3(e,t,r,n,o,i){if(r.type==="object"){let a=nm(t,r);if(a.kind==="nested")return xd(By(a.schema,
|
|
2611
2611
|
n,o,i,a.allowAdditionalProperties===!0),{referenceBacked:!0});if(a.kind==="opaque")return xd({type:"object",additionalProperties:!0});
|
|
@@ -2615,12 +2615,12 @@ operation:o,mode:o,options:n});if(!s||typeof s!="object"||Array.isArray(s))throw
|
|
|
2615
2615
|
referenceBacked:Dy(s)})}return xd(s,{referenceBacked:Dy(s)})}function qy(e,t,r,n,o,i){let s={schema:e,fieldName:t,definition:r,
|
|
2616
2616
|
operation:o,mode:o,options:n},a=c3(e,t,r,n,o,i),c=a.referenceBacked?im(a.schema):{...a.schema},u={castType:r.type};for(let p of Object.
|
|
2617
2617
|
keys(r)){if(p==="type"||!Object.hasOwn(e.validators,p))continue;let f=ZJ(e,p,t);if(!f)continue;let v=f({...s,parameterName:p,
|
|
2618
|
-
parameterValue:r[p],fieldSchema:{...c}});v&&JJ(c,v)}c[
|
|
2618
|
+
parameterValue:r[p],fieldSchema:{...c}});v&&JJ(c,v)}c[Bo]&&(Fy(u,c[Bo]),delete c[Bo]);let d=[];r.nullable===!0&&d.push({
|
|
2619
2619
|
type:"null"}),r.nullOnEmpty===!0&&d.push({const:""});let l=im(XJ(c,d));if(r.defaultTo!==void 0&&i.applyDefaults)if(typeof r.
|
|
2620
2620
|
defaultTo!="function"){let p=e._normalizeDefault(r,r.defaultTo,{fieldPath:t,currentObject:{},containerKey:t,objectBeforeCast:{},
|
|
2621
2621
|
options:{},settings:e._buildOperationSettings(o,i,{})});if(Object.keys(p.errors).length>0){let f=Object.values(p.errors)[0];
|
|
2622
2622
|
throw new Error(`defaultTo for "${t}" is invalid (${f.code}).`)}l.default=p.value}else u.defaults={providedByFunction:!0};
|
|
2623
|
-
return l[
|
|
2623
|
+
return l[Bo]=u,l}function A0(e,t={}){let r=t3(t),{operationName:n,operation:o}=e3(e,r),i=r.additionalProperties===void 0?
|
|
2624
2624
|
!1:r.additionalProperties,s=sm(r),a=I0(e,r,n,o,i,{root:!0}),c={$schema:VJ,...S0(a,r)};return Object.keys(s.definitions).
|
|
2625
2625
|
length>0&&(c.definitions=s.definitions),c}function E0(e){return e!==null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"}function Ky(e){return e instanceof
|
|
2626
2626
|
Da}function u3(){return{self:!1,children:{}}}function x0(e){return Object.keys(e.children).length>0}function Xi(e,t){return`${e}\
|
|
@@ -2908,7 +2908,7 @@ e.size;if(n){let p=Buffer.alloc(t.check.length);await r.read(p,0,p.length,t.offs
|
|
|
2908
2908
|
t.offset:0,i=Buffer.alloc(e.size-o);i.length&&await r.read(i,0,i.length,o);let s=i.lastIndexOf(10)+1,a=[];if(s)for await(let p of fg(
|
|
2909
2909
|
[i.subarray(0,s)]))p.isSidechain||a.push(o8(p));let c=o+s,u=Buffer.alloc(Math.min(n8,c));await r.read(u,0,u.length,c-u.length);
|
|
2910
2910
|
let d={dev:e.dev,ino:e.ino,offset:c,check:u,frames:n?t.frames.concat(a):a},l=co.get(e.path);return l&&(l.value=d),d.frames}catch(n){
|
|
2911
|
-
let o=co.get(e.path);throw o&&delete o.value,n}finally{await r.close()}}async function
|
|
2911
|
+
let o=co.get(e.path);throw o&&delete o.value,n}finally{await r.close()}}async function qo(e){let t=await hm(e),r={...e.includeUserMessages?
|
|
2912
2912
|
{userMessages:[]}:{},...e.includeCommandMessages?{commandMessages:[]}:{},...e.includeFinalCarriers?{completedResults:[],
|
|
2913
2913
|
failedResults:[],structuredOutputs:[]}:{}};if(!t||t.size===0)return{exists:!1,messages:[],userIds:[],text:"",...r};if(t.
|
|
2914
2914
|
size>256*1024*1024)throw new Error("Claude history exceeds the supported read limit.");let n=new Map,o=[],i="",s=null,a="",
|
|
@@ -3189,7 +3189,7 @@ covery_session_name","source_recovery_source_path","source_recovery_untracked_ar
|
|
|
3189
3189
|
"source_remote_url","source_removed"]),S9=6e4,A9=50*1024*1024,E9=200,x9=/^[A-Za-z0-9][A-Za-z0-9_.-]{0,191}$/u,T9=/^[A-Za-z0-9][A-Za-z0-9_.-]{0,127}$/u,
|
|
3190
3190
|
C9=/^[A-Za-z0-9][A-Za-z0-9_.-]{0,191}$/u,rj=/^[A-Za-z0-9][A-Za-z0-9_.:-]{0,127}$/u,zN=/^([A-Za-z0-9][A-Za-z0-9_-]{0,127})\.json$/u,
|
|
3191
3191
|
R9=Pd(["assistant","commentary","system","thinking","user"]),S_=/^(user|assistant|commentary|system|thinking)\.(\d{8}T\d{9}Z)(?:\.([A-Za-z0-9][A-Za-z0-9_-]{0,127}))?\.md$/u,
|
|
3192
|
-
|
|
3192
|
+
Ho=/^\d{6}$/u,UN="attachments.json",A_="metadata.json",O9=Object.freeze(["base_commit","canonical_commit","repository_mo\
|
|
3193
3193
|
de","source","source_kind","source_path","source_path_authority","source_removed"]),nj=/^[A-Za-z0-9][A-Za-z0-9_.-]{0,127}$/u,
|
|
3194
3194
|
P9=/^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/u,Qi=Object.freeze({FAILED:"failed",READY:"ready",RUNNING:"running"}),k9=new Set(Object.
|
|
3195
3195
|
values(Qi)),Nn=Object.freeze({ACTIVE:"active",CANCELLED:"cancelled",COMPLETED:"completed",FAILED:"failed",FINALIZING:"fi\
|
|
@@ -3208,13 +3208,13 @@ RENEWAL_PENDING].includes(e.status)?lo(t.renewed_from):e.status===de.RENEWAL_QUI
|
|
|
3208
3208
|
de.ARCHIVED?lo(t.renewed_to):e.status===de.ACTIVE&&lo(t.renewed_from)&&!N(t.renewed_to)}function Nm(e){let t=N(e)||Nn.STARTING;
|
|
3209
3209
|
if(!N9.has(t))throw U(`Invalid vibe64 agent run state: ${t}`,"vibe64_invalid_agent_run_state");return t}function U9(e){return M9.
|
|
3210
3210
|
has(Nm(e))}function F9(e){return j9.has(Nm(e))}function BN(e){let t=N(e)||Qi.RUNNING;if(!k9.has(t))throw U(`Invalid vibe\
|
|
3211
|
-
64 background task status: ${t}`,"vibe64_invalid_background_task_status");return t}function
|
|
3212
|
-
if(!b9.has(t))throw U(`Invalid vibe64 session status: ${t}`,"vibe64_invalid_session_status");return t}function Pm(e={}){let t=
|
|
3211
|
+
64 background task status: ${t}`,"vibe64_invalid_background_task_status");return t}function Wo(e){let t=N(e)||de.ACTIVE;
|
|
3212
|
+
if(!b9.has(t))throw U(`Invalid vibe64 session status: ${t}`,"vibe64_invalid_session_status");return t}function Pm(e={}){let t=Wo(e.status);if(Dd.has(t))throw U(`Vibe64 session is reserved for an in-progress renewal: ${N(e.
|
|
3213
3213
|
sessionId)||"(unknown)"}`,"vibe64_session_renewal_private");return e}function Cm(e={}){let t=Pm(e);if(t.status===de.RENEWAL_QUIESCED)
|
|
3214
3214
|
throw U(`Vibe64 session is read-only while its renewal is in progress: ${N(e.sessionId)||"(unknown)"}`,"vibe64_session_r\
|
|
3215
3215
|
enewal_quiesced");return t}function B9(e=""){let t=N(e);if(!t)return"";if(["all","archived","open"].includes(t))return t;
|
|
3216
3216
|
throw U(`Invalid vibe64 session list status group: ${t}`,"vibe64_invalid_session_list_status_group")}function q9(e=[]){return new Set(
|
|
3217
|
-
(Array.isArray(e)?e:[]).map(t=>N(t)).filter(Boolean).map(
|
|
3217
|
+
(Array.isArray(e)?e:[]).map(t=>N(t)).filter(Boolean).map(Wo))}function V9(e={}){return{statusGroup:B9(e.statusGroup),statuses:q9(
|
|
3218
3218
|
e.statuses)}}function qN(e,{statusGroup:t="",statuses:r=new Set}={}){let n=N(e)||de.ACTIVE;return Dd.has(n)||r.size>0&&!r.
|
|
3219
3219
|
has(n)?!1:t==="open"?Ld.has(n):t==="archived"?n===de.ARCHIVED:Ld.has(n)||n===de.ARCHIVED}function VN({statusGroup:e="",statuses:t=new Set}={}){
|
|
3220
3220
|
return e!=="open"&&(t.size<1||t.has(de.ARCHIVED))}async function Nt(e){try{return await $d(e,"utf8")}catch(t){if(Pt(t))return"";
|
|
@@ -3226,11 +3226,11 @@ delete(n),t.set(n,{identity:o,value:i}),t.size>e&&t.delete(t.keys().next().value
|
|
|
3226
3226
|
let i=await jd(n,"r");try{let s=cj(await i.stat({bigint:!0})),a=t.get(n);return a?.identity===s?r(n,s,a.value):r(n,s,o(await i.
|
|
3227
3227
|
readFile("utf8")))}finally{await i.close()}}})}var HN=uj(8),H9=uj(256),GN=new WeakMap;function G9(e,t){let r=GN.get(e);if(!r){
|
|
3228
3228
|
r=new Set;for(let n of e.turns.values())for(let o of n.messages)o.messageId&&r.add(o.messageId);GN.set(e,r)}return!!t&&r.
|
|
3229
|
-
has(t)}async function Ga(e,t=[],{allowedRoots:r=[],cwd:n="",maxBuffer:o=A9,timeout:i=S9}={}){let s=n||fr.cwd(),a=await
|
|
3229
|
+
has(t)}async function Ga(e,t=[],{allowedRoots:r=[],cwd:n="",maxBuffer:o=A9,timeout:i=S9}={}){let s=n||fr.cwd(),a=await jo(
|
|
3230
3230
|
{actor:"daemon",allowedRoots:[s,...r].filter(Boolean),args:t,command:e,cwd:s,envPolicy:"session",maxBuffer:o,mode:"captu\
|
|
3231
3231
|
re",purpose:"source",timeout:i});return{ok:a.ok===!0,output:N(`${a.stdout||""}
|
|
3232
|
-
${a.stderr||""}`)||N(a.output||a.error),stdout:String(a.stdout||""),stderr:String(a.stderr||"")}}function
|
|
3233
|
-
e);return Number.isSafeInteger(t)&&t>=0?t:0}function dj(e={}){return{...e,revision:
|
|
3232
|
+
${a.stderr||""}`)||N(a.output||a.error),stdout:String(a.stdout||""),stderr:String(a.stderr||"")}}function Go(e){let t=Number(
|
|
3233
|
+
e);return Number.isSafeInteger(t)&&t>=0?t:0}function dj(e={}){return{...e,revision:Go(e.revision)}}function W9(e,t={},r=""){
|
|
3234
3234
|
if(!$e(e)||N(e.sessionId)!==r)return e;let n=dj(t);return{...e,manifest:$e(e.manifest)?{...e.manifest,revision:n.revision,
|
|
3235
3235
|
updatedAt:N(n.updatedAt)}:e.manifest,revision:n.revision,updatedAt:N(n.updatedAt)}}function Ft(e,t){let n=(xm.get(e)||Promise.
|
|
3236
3236
|
resolve()).catch(()=>null).then(t),o=n.catch(()=>null).finally(()=>{xm.get(e)===o&&xm.delete(e)});return xm.set(e,o),n}function K9(e=0){
|
|
@@ -3297,7 +3297,7 @@ e),r=t.split("/");if(!t||t.includes("\\")||r.some(n=>!T9.test(n)))throw U(`Inval
|
|
|
3297
3297
|
"vibe64_invalid_artifact_path");return r.join("/")}function Ka(e,t){let r=$_(t),n=q.resolve(e.artifactsRoot),o=q.resolve(
|
|
3298
3298
|
n,...r.split("/")),i=q.relative(n,o);if(i.startsWith("..")||q.isAbsolute(i))throw U(`Invalid vibe64 artifact path: ${r}`,
|
|
3299
3299
|
"vibe64_invalid_artifact_path");return o}function JN(e,t){return q.join(e.agentRunsRoot,`${O_(t)}.json`)}function XN(e,t){
|
|
3300
|
-
return q.join(e.backgroundTasksRoot,`${P_(t)}.json`)}function
|
|
3300
|
+
return q.join(e.backgroundTasksRoot,`${P_(t)}.json`)}function Vo(e,t){let r=N(t);if(!Ho.test(r))throw U(`Invalid vibe64 \
|
|
3301
3301
|
conversation turn id: ${r||"(empty)"}`,"vibe64_invalid_conversation_turn_id");return q.join(e.conversationLogRoot,r)}function L_(e){
|
|
3302
3302
|
if(e==null)return null;let t=()=>U("Learning sessions require an authorized learner, exact attempt/pin and exercise scop\
|
|
3303
3303
|
e.","vibe64_learning_scope_invalid");if(!$e(e)||Object.keys(e).some(o=>!["learnerId","attemptId","pin","noExercise"].includes(
|
|
@@ -3331,10 +3331,10 @@ return Wa(await Er(h()),w=>zN.test(w)).map(w=>w.match(zN)?.[1]||"").filter(Boole
|
|
|
3331
3331
|
A,async()=>{let O=await y(x,"renewal-state",{waitMs:kn});if(!O)throw U(`Timed out waiting to update Vibe64 session renew\
|
|
3332
3332
|
al: ${S}`,"vibe64_session_renewal_state_lock_timeout");try{return await b()}finally{await O()}})}async function j(w="",b,{
|
|
3333
3333
|
waitMs:S=0}={}){if(typeof b!="function")throw new TypeError("Session renewal workflow requires an operation.");let A=me(
|
|
3334
|
-
w),x=V(A,""),O=Md(x,"renewal-workflow"),P=Ha.getStore(),k=P?.get(O);if(k?.participant?.active===!0){let re=
|
|
3335
|
-
P);oe.set(O,{lease:k.lease,participant:re});try{return{acquired:!0,value:await Ha.run(oe,b)}}finally{
|
|
3336
|
-
x,"renewal-workflow",{waitMs:S});if(!L)return{acquired:!1,value:null};let z=dd(),F=
|
|
3337
|
-
participant:F});try{return await Ha.run(te,async()=>({acquired:!0,value:await b()}))}finally{
|
|
3334
|
+
w),x=V(A,""),O=Md(x,"renewal-workflow"),P=Ha.getStore(),k=P?.get(O);if(k?.participant?.active===!0){let re=Do(k.lease),oe=new Map(
|
|
3335
|
+
P);oe.set(O,{lease:k.lease,participant:re});try{return{acquired:!0,value:await Ha.run(oe,b)}}finally{zo(k.lease,re)}}let L=await y(
|
|
3336
|
+
x,"renewal-workflow",{waitMs:S});if(!L)return{acquired:!1,value:null};let z=dd(),F=Do(z),te=new Map(P||[]);te.set(O,{lease:z,
|
|
3337
|
+
participant:F});try{return await Ha.run(te,async()=>({acquired:!0,value:await b()}))}finally{zo(z,F),await z.idle,await L()}}
|
|
3338
3338
|
function V(w="",b=""){let S=m();return mj({activeSessionsRoot:S.activeSessionsRoot,closingSessionsRoot:S.closingSessionsRoot,
|
|
3339
3339
|
archivedSessionsRoot:S.archivedSessionsRoot,currentSessionAliasPath:S.currentSessionAliasPath,projectContextRoot:S.projectContextRoot,
|
|
3340
3340
|
sessionId:me(w),sessionRoot:b,sessionsRoot:S.sessionsRoot,stateRoot:S.stateRoot})}async function Y(w){let b=m(w);if(!await Qe(
|
|
@@ -3342,7 +3342,7 @@ b.manifestPath)){let S=ue(b.sessionId);throw await Qe(S.manifestPath)||await ae(
|
|
|
3342
3342
|
y archived: ${b.sessionId}`,"vibe64_session_archived"):U(`Unknown vibe64 session: ${b.sessionId}`,"vibe64_session_not_fo\
|
|
3343
3343
|
und")}return b}function ue(w=""){let b=m(),S=me(w);return V(S,N_(b,S))}function Z(w={},{archivePath:b="",metadataPath:S=""}={}){
|
|
3344
3344
|
if(!$e(w)||w.kind!==DN||w.schemaVersion!==$N||!lo(w.sessionId)||!$e(w.index)||N(w.index.sessionId)!==N(w.sessionId))throw U(
|
|
3345
|
-
`Invalid Vibe64 session archive metadata: ${S}`,"vibe64_invalid_session_archive_metadata");let A=
|
|
3345
|
+
`Invalid Vibe64 session archive metadata: ${S}`,"vibe64_invalid_session_archive_metadata");let A=Wo(w.status);if(A!==de.
|
|
3346
3346
|
ARCHIVED||N(w.index.status)!==de.ARCHIVED)throw U(`Invalid Vibe64 session archive status: ${A}`,"vibe64_invalid_session_\
|
|
3347
3347
|
archive_status");return{...w,archivePath:b,index:w.index,metadataPath:S,status:A}}async function _e(w,b){let S=me(b),A=Xa(
|
|
3348
3348
|
w,S);if(!await Qe(A))return null;try{return Z(JSON.parse(await $d(A,"utf8")),{archivePath:Ja(w,S),metadataPath:A})}catch(x){
|
|
@@ -3355,10 +3355,10 @@ return Z(k,{archivePath:A,metadataPath:x})}async function ut(){let w=m(),b=await
|
|
|
3355
3355
|
endsWith(".json")&&lo(A.slice(0,-5)));return(await Promise.all(S.map(A=>_e(w,A.slice(0,-5))))).filter(Boolean)}function K(w={}){
|
|
3356
3356
|
if(!$e(w))return{};let b=I9.map(S=>[S,N(w[S])]).filter(([,S])=>S);return Object.fromEntries(b)}function ie(w={},{sessionId:b=""}={}){
|
|
3357
3357
|
let S=$e(w.manifest)?w.manifest:{},A=N(w.createdAt||S.createdAt),x=N(w.updatedAt||S.updatedAt||A);return{createdAt:A,manifest:{
|
|
3358
|
-
createdAt:A,revision:
|
|
3358
|
+
createdAt:A,revision:Go(w.revision??S.revision),runtimeKind:N(S.runtimeKind),updatedAt:x},metadata:K(w.metadata),revision:Go(
|
|
3359
3359
|
w.revision??S.revision),sessionId:me(b||w.sessionId),sessionName:N(w.sessionName),sessionRoot:"",status:de.ARCHIVED,updatedAt:x}}
|
|
3360
3360
|
function fe(w={}){let b=$e(w.index)?w.index:{};return{createdAt:N(b.createdAt),manifest:$e(b.manifest)?b.manifest:{},metadata:$e(
|
|
3361
|
-
b.metadata)?b.metadata:{},revision:
|
|
3361
|
+
b.metadata)?b.metadata:{},revision:Go(b.revision),sessionName:N(b.sessionName),updatedAt:N(b.updatedAt),archiveMetadataPath:w.
|
|
3362
3362
|
metadataPath,archivePath:w.archivePath,archiveStatus:w.status,archived:!0,archivedAt:N(w.archivedAt),sessionId:N(b.sessionId)||
|
|
3363
3363
|
N(w.sessionId),sessionRoot:"",status:N(b.status)||N(w.status)}}function B({archivePath:w="",archivedAt:b="",metadataPath:S="",
|
|
3364
3364
|
sessionId:A="",summary:x={}}={}){let O=me(A),P=q.basename(w),k=q.basename(S);return{archive:{fileName:P,relativePath:`ar\
|
|
@@ -3423,23 +3423,23 @@ async function Qt(w,b){if(typeof b!="function")throw new TypeError("Prepared ren
|
|
|
3423
3423
|
let S=me(w),A=await Ne(S);if(!A)throw U(`Renewal predecessor has no prepared archive: ${S}`,"vibe64_session_renewal_arch\
|
|
3424
3424
|
ive_required");return await lr(A.archivePath),H(A,async(x,O)=>{let P=await sr(x,O);return b({...P,artifactsRoot:x.artifactsRoot,
|
|
3425
3425
|
sessionRoot:x.sessionRoot})})}async function he(w,b){return ve(w,async(S,A)=>(Pm({sessionId:S.sessionId,status:await Me(
|
|
3426
|
-
S)}),b(S,A)))}async function We(w){let b=await
|
|
3426
|
+
S)}),b(S,A)))}async function We(w){let b=await xo(w),S={...b,revision:Go(b.revision)+1,updatedAt:f().toISOString()};return await Ar(
|
|
3427
3427
|
w.manifestPath,S),S}async function Gt(w,b,{renewal:S=!1}={}){let A=m(w),x=A.sessionRoot,O=Va.getStore();if(O?.key===x&&O.
|
|
3428
|
-
participant?.active===!0){let P=
|
|
3429
|
-
!0,sessionPaths:O.sessionPaths},()=>b(O.sessionPaths))}finally{
|
|
3428
|
+
participant?.active===!0){let P=Do(O.lease);try{return await Va.run({key:x,lease:O.lease,participant:P,renewal:S||O.renewal===
|
|
3429
|
+
!0,sessionPaths:O.sessionPaths},()=>b(O.sessionPaths))}finally{zo(O.lease,P)}}return Ft(x,async()=>{let P=await y(A,"mut\
|
|
3430
3430
|
ation",{waitMs:kn});if(!P)throw U(`Timed out waiting to update Vibe64 session: ${A.sessionId}`,"vibe64_session_mutation_\
|
|
3431
|
-
lock_timeout");try{let k=await Y(A.sessionId);await le(k);let L=dd(),z=
|
|
3432
|
-
renewal:S,sessionPaths:k},()=>b(k))}finally{
|
|
3431
|
+
lock_timeout");try{let k=await Y(A.sessionId);await le(k);let L=dd(),z=Do(L),F;try{F=await Va.run({key:x,lease:L,participant:z,
|
|
3432
|
+
renewal:S,sessionPaths:k},()=>b(k))}finally{zo(L,z),await L.idle}let te=await We(k);return W9(F,te,k.sessionId)}finally{
|
|
3433
3433
|
await P()}})}async function Ze(w,b){let S=m(w),A=Va.getStore();return A?.key===S.sessionRoot&&A.participant?.active===!0&&
|
|
3434
3434
|
A.renewal===!0?Gt(w,b,{renewal:!0}):Gt(w,async x=>(Cm({sessionId:x.sessionId,status:await Me(x)}),b(x)))}async function Mt(w,b){
|
|
3435
3435
|
return Gt(w,b,{renewal:!0})}async function bi(w,b,S,{operation:A="",renewal:x=!1,waitMs:O=0}={}){if(typeof S!="function")
|
|
3436
3436
|
throw new TypeError("Exclusive Vibe64 session work requires an operation.");let P=await Y(w),k=Md(P,b),L=Ha.getStore(),z=L?.
|
|
3437
|
-
get(k);if(z?.participant?.active===!0){let pe=
|
|
3438
|
-
acquired:!0,value:await Ha.run(G,S)}}finally{
|
|
3439
|
-
waitMs:O});if(!te)return{acquired:!1,blockingOperation:F,value:null};let re=dd(),oe=
|
|
3437
|
+
get(k);if(z?.participant?.active===!0){let pe=Do(z.lease),G=new Map(L);G.set(k,{lease:z.lease,participant:pe});try{return{
|
|
3438
|
+
acquired:!0,value:await Ha.run(G,S)}}finally{zo(z.lease,pe)}}let F="",te=await y(P,b,{onRejected:pe=>{F=pe},operation:A,
|
|
3439
|
+
waitMs:O});if(!te)return{acquired:!1,blockingOperation:F,value:null};let re=dd(),oe=Do(re),Q=new Map(L||[]);Q.set(k,{lease:re,
|
|
3440
3440
|
participant:oe});try{return x||Cm({sessionId:P.sessionId,status:await Me(P)}),await Ha.run(Q,async()=>({acquired:!0,value:await S()}))}finally{
|
|
3441
|
-
|
|
3442
|
-
w,b,S,{...A,renewal:!0})}async function
|
|
3441
|
+
zo(re,oe),await re.idle,await te()}}async function yn(w,b,S,A={}){return bi(w,b,S,A)}async function ir(w,b,S,A={}){return bi(
|
|
3442
|
+
w,b,S,{...A,renewal:!0})}async function Eo(w,b){Ld.has(b)||await kl(w);let S=Wo(b);if(Em.has(S))throw U(`Renewal session\
|
|
3443
3443
|
status requires a renewal transition: ${S}`,"vibe64_session_renewal_transition_required");return Ze(w,async A=>{let x=await Me(
|
|
3444
3444
|
A);if(Em.has(x))throw U(`Renewal session status requires a renewal transition: ${x}`,"vibe64_session_renewal_transition_\
|
|
3445
3445
|
required");await dt(A.statusPath,`${S}
|
|
@@ -3484,17 +3484,17 @@ A.finishedAt||L.finishedAt)||z,id:k,kind:Object.hasOwn(A,"kind")?N(A.kind):N(re.
|
|
|
3484
3484
|
essage")?N(A.message):Object.hasOwn(S,"message")?N(S.message):N(L.message),startedAt:F===Qi.RUNNING&&te!==Qi.RUNNING?z:N(
|
|
3485
3485
|
A.startedAt||L.startedAt)||z,status:F,updatedAt:z};return F!==Qi.RUNNING&&!Object.hasOwn(A,"stage")&&delete oe.stage,F!==
|
|
3486
3486
|
Qi.FAILED&&!Object.hasOwn(A,"error")&&(oe.error=""),await Ar(XN(P,k),oe),oe})}async function oD(w,b,S){let A=N(S).match(
|
|
3487
|
-
S_);if(!A)return null;let x=N(A[3]);return{at:tX(A[2]),role:A[1],text:N(await Nt(q.join(
|
|
3488
|
-
{}}}async function iD(w,b){let S=Wa(await Er(
|
|
3487
|
+
S_);if(!A)return null;let x=N(A[3]);return{at:tX(A[2]),role:A[1],text:N(await Nt(q.join(Vo(w,b),S))),...x?{messageId:x}:
|
|
3488
|
+
{}}}async function iD(w,b){let S=Wa(await Er(Vo(w,b)),P=>S_.test(P)),A=(await Promise.all(S.map(P=>oD(w,b,P)))).filter(Boolean),
|
|
3489
3489
|
[x,O]=await Promise.all([pD(w,b),fD(w,b)]);return{messages:A.map(P=>P.role==="user"&&x.length?{...P,attachments:x}:P),...O?
|
|
3490
3490
|
{metadata:O}:{}}}async function sD(w,b,S){let A=IN(S);if(!A)return null;let x=v9("sha256").update(S.text).digest("hex"),
|
|
3491
|
-
O=await Nt(q.join(
|
|
3491
|
+
O=await Nt(q.join(Vo(w,b),"integration-setup.json")),P={outcome:"pending"};if(O){let k;try{k=JSON.parse(O)}catch{throw U(
|
|
3492
3492
|
"Invalid integration setup decision.","vibe64_invalid_integration_setup_decision")}let L=k?.outcome==="completed";if(!$e(
|
|
3493
3493
|
k)||Object.keys(k).length!==(L?6:2)||typeof k.requestId!="string"||!/^[a-f0-9]{64}$/u.test(k.requestId)||(L?!WI(k)||!KI(
|
|
3494
3494
|
k.continuation)||typeof k.continuationMessageId!="string"||!/^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/u.
|
|
3495
3495
|
test(k.continuationMessageId):k.outcome!=="skipped"))throw U("Invalid integration setup decision.","vibe64_invalid_integ\
|
|
3496
3496
|
ration_setup_decision");k.requestId===x&&(P=k)}return{integrationId:A.integrationId,requestId:x,...P}}async function aD(w,b){
|
|
3497
|
-
if(typeof b!="string"||!
|
|
3497
|
+
if(typeof b!="string"||!Ho.test(b))throw U("Invalid integration setup request.","vibe64_invalid_integration_setup_reques\
|
|
3498
3498
|
t");return he(w,async S=>(await Hh(S,b)).integrationSetup||null)}function WI(w){return typeof w.configurationHash=="stri\
|
|
3499
3499
|
ng"&&/^[a-f0-9]{64}$/u.test(w.configurationHash)&&typeof w.verifiedAt=="string"&&Number.isFinite(Date.parse(w.verifiedAt))}
|
|
3500
3500
|
function KI(w){return $e(w)?w.status==="pending"?Object.keys(w).length===1:Object.keys(w).length===3&&["sending","accept\
|
|
@@ -3504,7 +3504,7 @@ vibe64_invalid_integration_setup_completion");return XI(w,b,{configurationHash:b
|
|
|
3504
3504
|
continuationMessageId:ln(),continuation:{status:"pending"},outcome:"completed"})}async function uD(w,b={}){return XI(w,b,
|
|
3505
3505
|
{outcome:"skipped"})}async function dD(w,b={}){return JI(w,b,"sending")}async function lD(w,b={}){return JI(w,b,"accepte\
|
|
3506
3506
|
d")}async function JI(w,b,S){let{turnId:A,requestId:x,continuationMessageId:O,engineId:P,threadId:k}=b,L={status:S,engineId:P,
|
|
3507
|
-
threadId:k};if(typeof A!="string"||!
|
|
3507
|
+
threadId:k};if(typeof A!="string"||!Ho.test(A)||!KI(L))throw U("Invalid integration continuation.","vibe64_invalid_integ\
|
|
3508
3508
|
ration_continuation");return Ze(w,async z=>{let F=(await Hh(z,A)).integrationSetup;if(!F||F.outcome!=="completed"||F.requestId!==
|
|
3509
3509
|
x||F.continuationMessageId!==O)throw U("This integration completion has changed or no longer exists.","vibe64_integratio\
|
|
3510
3510
|
n_setup_request_changed");if(F.continuation.status!=="pending"&&(F.continuation.engineId!==P||F.continuation.threadId!==
|
|
@@ -3512,18 +3512,18 @@ k))throw U("This continuation belongs to a different assistant thread.","vibe64_
|
|
|
3512
3512
|
if(S==="accepted"&&F.continuation.status==="pending")throw U("This integration continuation has not been claimed.","vibe\
|
|
3513
3513
|
64_integration_continuation_not_claimed");if(F.continuation.status==="accepted"||S==="sending"&&F.continuation.status===
|
|
3514
3514
|
"sending")return{changed:!1,integrationSetup:F};let te={...F,continuation:L},{integrationId:re,...oe}=te;return await Ar(
|
|
3515
|
-
q.join(
|
|
3516
|
-
turnId:b,requestId:S},A){if(typeof b!="string"||!
|
|
3515
|
+
q.join(Vo(z,A),"integration-setup.json"),oe),{changed:!0,integrationSetup:{...oe,integrationId:re}}})}async function XI(w,{
|
|
3516
|
+
turnId:b,requestId:S},A){if(typeof b!="string"||!Ho.test(b)||typeof S!="string"||!/^[a-f0-9]{64}$/u.test(S))throw U("Inv\
|
|
3517
3517
|
alid integration setup request.","vibe64_invalid_integration_setup_request");return Ze(w,async x=>{let O=await Hh(x,b);if(!O.
|
|
3518
3518
|
integrationSetup||O.integrationSetup.requestId!==S)throw U("This integration setup request has changed or no longer exis\
|
|
3519
3519
|
ts.","vibe64_integration_setup_request_changed");if(O.integrationSetup.outcome==="completed"&&A.outcome==="completed"&&O.
|
|
3520
3520
|
integrationSetup.configurationHash!==A.configurationHash)throw U("This request was completed against a different integra\
|
|
3521
3521
|
tion configuration.","vibe64_integration_setup_configuration_changed");return O.integrationSetup.outcome!=="pending"?O.integrationSetup:
|
|
3522
|
-
(await Ar(q.join(
|
|
3523
|
-
let S=await Nt(q.join(
|
|
3522
|
+
(await Ar(q.join(Vo(x,b),"integration-setup.json"),{requestId:S,...A}),{...O.integrationSetup,...A})})}async function pD(w,b){
|
|
3523
|
+
let S=await Nt(q.join(Vo(w,b),UN));if(!S)return[];try{let A=JSON.parse(S),x=h_(A);if(!Array.isArray(A)||x.length!==A.length)
|
|
3524
3524
|
throw new TypeError("Conversation attachments must be a valid attachment list.");return x}catch(A){throw U(`Conversation\
|
|
3525
3525
|
turn ${b} attachments are invalid: ${N(A?.message)||"unknown error"}`,"vibe64_invalid_conversation_turn_attachments")}}
|
|
3526
|
-
async function fD(w,b){let S=await Nt(q.join(
|
|
3526
|
+
async function fD(w,b){let S=await Nt(q.join(Vo(w,b),A_));if(!S)return null;try{return Rl(JSON.parse(S))}catch(A){throw A instanceof
|
|
3527
3527
|
SyntaxError?U(`Conversation turn ${b} metadata is not valid JSON.`,"vibe64_invalid_conversation_turn_metadata"):A}}function Rl(w=null){
|
|
3528
3528
|
if(!$e(w))throw U("Conversation turn metadata must be an object.","vibe64_invalid_conversation_turn_metadata");let b={...w};
|
|
3529
3529
|
for(let S of["actorDisplayName","actorId","engineId","assistantSelection","assistantRouting","nativeMessageVersions"])delete b[S];
|
|
@@ -3537,13 +3537,13 @@ return{version:1,metadata:w.metadata,rewound:w.rewound,turns:[...w.turns]}}funct
|
|
|
3537
3537
|
throw U("Conversation storage is not valid JSON. Restore it before continuing.","vibe64_invalid_conversation_storage")}return ZI(
|
|
3538
3538
|
b)}function ZI(w){let b=Array.isArray(w?.turns)?new Set(w.turns.map(S=>S?.[0])):new Set;if(w?.version!==1||!$e(w.metadata)||
|
|
3539
3539
|
!Array.isArray(w.rewound)||!Array.isArray(w.turns)||w.turns.some(S=>!Array.isArray(S)||S.length!==2||typeof S[0]!="strin\
|
|
3540
|
-
g"||!
|
|
3540
|
+
g"||!Ho.test(S[0])||!$e(S[1])||!Array.isArray(S[1].messages)||S[1].metadata!==void 0&&!$e(S[1].metadata)||S[1].messages.
|
|
3541
3541
|
some(A=>!$e(A)||!R9.includes(A.role)||typeof A.text!="string"||typeof A.at!="string"||!Number.isFinite(Date.parse(A.at))||
|
|
3542
3542
|
A.messageId!==void 0&&typeof A.messageId!="string"))||b.size!==w.turns.length||w.rewound.some(S=>!b.has(S)))throw U("Con\
|
|
3543
3543
|
versation storage has an unsupported or damaged format. Restore it before continuing.","vibe64_invalid_conversation_stor\
|
|
3544
3544
|
age");return{metadata:w.metadata,rewound:w.rewound,turns:new Map(w.turns)}}async function QI(w){try{return await HN.read(
|
|
3545
3545
|
q.join(w.conversationLogRoot,"transcript.json"),Ou)}catch(S){if(!Pt(S))throw S}if((await Er(w.conversationLogRoot)).some(
|
|
3546
|
-
S=>
|
|
3546
|
+
S=>Ho.test(S.name)||["rewound.json","message-ids.json"].includes(S.name)))throw U("This conversation needs the offline s\
|
|
3547
3547
|
tate upgrade. Stop services and run the candidate upgrade-state command before opening it.","vibe64_conversation_upgrade\
|
|
3548
3548
|
_required");return{turns:new Map,metadata:{},rewound:[]}}function eS(w,b,S=!1,A=null){let x;return Aa({async readRecord(){
|
|
3549
3549
|
return x=await QI(w),x},async writeRecord(P,k){k={metadata:k.metadata,turns:k.turns,rewound:k.rewound??x.rewound};let L=YI(
|
|
@@ -3580,19 +3580,19 @@ upsertConversationAssistantMessage:ED,writeConversationCommentaryMessage:xD,writ
|
|
|
3580
3580
|
readTurn(b);return A?.messages?.length?A:null},!1)}function OD(w,b){return SD(w,{...b,attachments:h_(b?.attachments)})}function Pl(w){
|
|
3581
3581
|
return typeof w=="string"?m(w).sessionRoot:_n(m(w.sessionId),w.conversationId).conversationRoot}function PD(w){return Tm.
|
|
3582
3582
|
read(Pl(w))}function kD(w,b){return Tm.update(Pl(w),b)}function ND(w,b){return Tm.complete(Pl(w),b)}function jD(w){return Tm.
|
|
3583
|
-
clear(Pl(w))}async function MD(w){return he(w,
|
|
3583
|
+
clear(Pl(w))}async function MD(w){return he(w,xo)}async function xo(w){let b=await Nt(w.manifestPath);try{return dj(JSON.
|
|
3584
3584
|
parse(b))}catch{throw U(`Invalid vibe64 session manifest: ${w.sessionId}`,"vibe64_invalid_manifest")}}async function Gh(w){
|
|
3585
3585
|
return Pm(await bn(w))}async function bn(w){return ve(w,sr)}async function sr(w,b=null){let[S,A,x,O,P]=await Promise.all(
|
|
3586
|
-
[
|
|
3586
|
+
[xo(w),Me(w),at(w),HI(w),GI(w)]),k=!!b,L=await _t(w,x);return{agentRuns:O,agentRunsRoot:k?"":w.agentRunsRoot,artifactsRoot:k?
|
|
3587
3587
|
"":w.artifactsRoot,backgroundTasks:P,backgroundTasksRoot:k?"":w.backgroundTasksRoot,conversationLogRoot:k?"":w.conversationLogRoot,
|
|
3588
|
-
manifest:S,metadata:x,metadataRoot:k?"":w.metadataRoot,projectContextRoot:w.projectContextRoot,revision:
|
|
3588
|
+
manifest:S,metadata:x,metadataRoot:k?"":w.metadataRoot,projectContextRoot:w.projectContextRoot,revision:Go(S.revision),sessionId:w.
|
|
3589
3589
|
sessionId,sessionName:L,pinnedSessionId:await xi(),sessionRoot:k?"":w.sessionRoot,stateRoot:w.stateRoot,status:A,updatedAt:N(
|
|
3590
3590
|
S.updatedAt||S.createdAt),...k?{archivePath:b.archivePath,archiveStatus:b.status,archived:!0,archivedAt:N(b.archivedAt),
|
|
3591
3591
|
archiveMetadataPath:b.metadataPath}:{}}}async function nS(w){return Pm(await $D(w))}async function $D(w){let b=m(w),S=await X(
|
|
3592
3592
|
w,Wh);if(S.found)return S.value;let A=await ae(w);if(A){let x=fe(A);return uo(x.metadata,u,x.sessionId),x}throw U(`Unkno\
|
|
3593
|
-
wn vibe64 session: ${b.sessionId}`,"vibe64_session_not_found")}async function Wh(w){let[b,S,A]=await Promise.all([
|
|
3594
|
-
Me(w),at(w)]),x=await _t(w,A);return{createdAt:N(b.createdAt),manifest:{createdAt:N(b.createdAt),revision:
|
|
3595
|
-
runtimeKind:N(b.runtimeKind),updatedAt:N(b.updatedAt||b.createdAt)},metadata:A,projectContextRoot:w.projectContextRoot,revision:
|
|
3593
|
+
wn vibe64 session: ${b.sessionId}`,"vibe64_session_not_found")}async function Wh(w){let[b,S,A]=await Promise.all([xo(w),
|
|
3594
|
+
Me(w),at(w)]),x=await _t(w,A);return{createdAt:N(b.createdAt),manifest:{createdAt:N(b.createdAt),revision:Go(b.revision),
|
|
3595
|
+
runtimeKind:N(b.runtimeKind),updatedAt:N(b.updatedAt||b.createdAt)},metadata:A,projectContextRoot:w.projectContextRoot,revision:Go(
|
|
3596
3596
|
b.revision),sessionId:w.sessionId,sessionName:x,pinnedSessionId:await xi(),sessionRoot:w.sessionRoot,stateRoot:w.stateRoot,
|
|
3597
3597
|
status:S,updatedAt:N(b.updatedAt||b.createdAt)}}async function lr(w){let b=await Ga("tar",["-tzf",w],{allowedRoots:[q.dirname(
|
|
3598
3598
|
w)],cwd:d});if(!b.ok)throw U(`Invalid Vibe64 session archive ${w}: ${b.output}`,"vibe64_session_archive_invalid")}async function Kh(w,b){
|
|
@@ -3739,7 +3739,7 @@ return YN(b,w)}async function JD(){let w=m();if(!w.currentSessionAliasPath)retur
|
|
|
3739
3739
|
if(!b||!u&&await cS(me(b)))return null;let S=await bn(me(b));return Ld.has(S.status)?S:null}async function uS({metadata:w={},
|
|
3740
3740
|
runtimeKind:b="",sessionId:S="",status:A=de.ACTIVE}={},x=null){if(Object.hasOwn(w,er))throw U("Learning purpose is suppl\
|
|
3741
3741
|
ied only by the authorized runtime constructor, not creation metadata.","vibe64_learning_scope_invalid");let O=Object.fromEntries(
|
|
3742
|
-
Object.entries(w).map(([re,oe])=>[aj(re),N(oe)])),P=
|
|
3742
|
+
Object.entries(w).map(([re,oe])=>[aj(re),N(oe)])),P=Wo(A),k=m();await Et(k.activeSessionsRoot,{recursive:!0});let L=f().
|
|
3743
3743
|
toISOString(),z=S?me(S):await oX(k,L),F=m(z);u&&(O[er]=JSON.stringify({schemaVersion:1,...u,conversationId:z}));let te=await y(
|
|
3744
3744
|
F,"create",{waitMs:kn});if(!te)throw U(`Vibe64 session creation is already in progress: ${z}`,"vibe64_session_busy");try{
|
|
3745
3745
|
let re=await Ft(F.sessionRoot,async()=>{let oe=j_(k),Q=q.join(oe,`${z}.${fr.pid}.${ln()}`),pe=V(z,Q),G=!1;try{if(await M_(
|
|
@@ -3753,9 +3753,9 @@ revision:1,schemaVersion:_9,sessionId:z,updatedAt:L};if(await Promise.all([Ar(pe
|
|
|
3753
3753
|
G=!0,await aX(k,z).catch(()=>null),bn(z)}catch(W){throw["EEXIST","ENOTEMPTY"].includes(W?.code)?U(`Vibe64 session alread\
|
|
3754
3754
|
y exists: ${z}`,"vibe64_session_exists"):W}finally{G||await ze(Q,{force:!0,recursive:!0})}});return x?await x(re):re}finally{
|
|
3755
3755
|
await te()}}async function XD(w={},b=null){if(b!==null&&typeof b!="function")throw new TypeError("Session initialization\
|
|
3756
|
-
must be a function.");let S=
|
|
3756
|
+
must be a function.");let S=Wo(w.status);if(Em.has(S))throw U(`Renewal session status requires createRenewalPendingSess\
|
|
3757
3757
|
ion: ${S}`,"vibe64_session_renewal_transition_required");return uS({...w,status:S},b)}async function YD({quiescedAt:w="",
|
|
3758
|
-
renewalId:b="",sourceSessionId:S=""}={}){let A=Ut(b),x=me(S),O=w?dn(w).toISOString():f().toISOString();return
|
|
3758
|
+
renewalId:b="",sourceSessionId:S=""}={}){let A=Ut(b),x=me(S),O=w?dn(w).toISOString():f().toISOString();return To(async()=>Mt(
|
|
3759
3759
|
x,async P=>{let[k,L]=await Promise.all([Me(P),at(P)]),z=N(L.renewal_quiesced_id);if(k===de.RENEWAL_QUIESCED){if(z&&z!==A)
|
|
3760
3760
|
throw U(`Session is quiesced for another renewal: ${x}`,"vibe64_session_renewal_conflict");let te=N(L.renewal_quiesced_at)||
|
|
3761
3761
|
O;return await Promise.all([dt(tt(P,"renewal_quiesced_at"),`${te}
|
|
@@ -3766,7 +3766,7 @@ ive: ${x}`,"vibe64_session_renewal_source_not_active");return await dt(P.statusP
|
|
|
3766
3766
|
ze(tt(P,"renewal_restored_id"),{force:!0}),dt(tt(P,"renewal_quiesced_at"),`${O}
|
|
3767
3767
|
`),dt(tt(P,"renewal_quiesced_id"),`${A}
|
|
3768
3768
|
`)]),sr(P)}))}async function ZD({renewalId:w="",restoredAt:b="",sourceSessionId:S=""}={}){let A=Ut(w),x=me(S),O=b?dn(b).
|
|
3769
|
-
toISOString():f().toISOString();return
|
|
3769
|
+
toISOString():f().toISOString();return To(async()=>Mt(x,async P=>{let[k,L]=await Promise.all([Me(P),at(P)]),z=N(L.renewal_quiesced_id),
|
|
3770
3770
|
F=N(L.renewal_restored_id);if(k===de.ACTIVE&&F===A)return await Promise.all([ze(tt(P,"renewal_quiesced_at"),{force:!0}),
|
|
3771
3771
|
ze(tt(P,"renewal_quiesced_id"),{force:!0})]),sr(P);if(k!==de.RENEWAL_QUIESCED||z!==A||N(L.renewed_to))throw U(`Session c\
|
|
3772
3772
|
annot be restored from renewal ${A}: ${x}`,"vibe64_session_renewal_transition_invalid");let te=N(L.renewal_restored_at)||
|
|
@@ -3779,7 +3779,7 @@ startedAt:L=""}={}){let z=Ut(x),F=me(O),te=k?me(k):"";if(te&&te===F)throw U("A r
|
|
|
3779
3779
|
sion id from its predecessor.","vibe64_session_renewal_same_session");let re=N(b);if(!re)throw U("A renewed session requ\
|
|
3780
3780
|
ires actor attribution.","vibe64_session_renewal_actor_required");if(!N(S))throw U("A renewed session requires the confi\
|
|
3781
3781
|
rmation timestamp.","vibe64_session_renewal_confirmation_required");let oe=dn(S).toISOString(),Q=L?dn(L).toISOString():"";
|
|
3782
|
-
return
|
|
3782
|
+
return To(async()=>{let pe=await bn(F);if(pe.status!==de.RENEWAL_QUIESCED||N(pe.metadata.renewal_quiesced_id)!==z)throw U(
|
|
3783
3783
|
`A renewed session can only be prepared from its quiesced predecessor: ${F}`,pe.status===de.RENEWAL_QUIESCED?"vibe64_ses\
|
|
3784
3784
|
sion_renewal_conflict":"vibe64_session_renewal_source_not_quiesced");let G=await pS();if(G.find(Ee=>Ee.sessionId!==F&&N(
|
|
3785
3785
|
Ee.metadata.renewal_quiesced_id)===z))throw U(`Renewal ${z} belongs to another predecessor.`,"vibe64_session_renewal_con\
|
|
@@ -3789,7 +3789,7 @@ re&&N(ne.metadata.renewal_actor_display_name)===N(w)&&N(ne.metadata.renewal_conf
|
|
|
3789
3789
|
Q)&&(!te||ne.sessionId===te))return ne;throw U(`Another renewal is already prepared for session ${F}.`,"vibe64_session_r\
|
|
3790
3790
|
enewal_conflict")}let se=f().toISOString();return uS({metadata:{...$e(A)?A:{},renewal_actor_display_name:N(w),renewal_actor_id:re,
|
|
3791
3791
|
renewal_confirmed_at:oe,renewal_id:z,renewal_started_at:Q||se,renewal_successor_created_at:se,renewed_from:F},runtimeKind:P,
|
|
3792
|
-
sessionId:te,status:de.RENEWAL_PENDING})})}async function
|
|
3792
|
+
sessionId:te,status:de.RENEWAL_PENDING})})}async function To(w){let b=m(),S=V("renewal-transitions",""),A=q.join(b.sessionsRoot,
|
|
3793
3793
|
".renewal-transition");return Ft(A,async()=>{let x=await y(S,"transition",{waitMs:kn});if(!x)throw U("Timed out waiting \
|
|
3794
3794
|
to transition renewed Vibe64 sessions.","vibe64_session_renewal_transition_lock_timeout");try{return await w()}finally{await x()}})}
|
|
3795
3795
|
async function ez({acknowledgedAt:w="",actorDisplayName:b="",actorId:S="",handoverDeliveredAt:A="",renewedAt:x="",renewalId:O="",
|
|
@@ -3797,7 +3797,7 @@ sourceSessionId:P="",successorSessionId:k=""}={}){let L=Ut(O),z=me(P),F=me(k);if
|
|
|
3797
3797
|
ave a different session id from its predecessor.","vibe64_session_renewal_same_session");let te=N(w),re=N(A);if(!te&&!re)
|
|
3798
3798
|
throw U("A renewed session cannot become active before its handover reaches the fresh agent thread.","vibe64_session_ren\
|
|
3799
3799
|
ewal_handover_required");let oe=te?dn(te).toISOString():"",Q=dn(re||oe).toISOString(),pe=x?dn(x).toISOString():f().toISOString();
|
|
3800
|
-
return
|
|
3800
|
+
return To(async()=>await Mt(z,async W=>Mt(F,async ne=>{let[se,Ee,Pe,Ke]=await Promise.all([Me(W),at(W),Me(ne),at(ne)]),wt=N(
|
|
3801
3801
|
Ke.renewal_id),Ct=N(Ke.renewed_from),Wt=N(Ee.renewal_quiesced_id);if(wt!==L||Ct!==z||Wt!==L)throw U(`Renewal successor d\
|
|
3802
3802
|
oes not match renewal ${L}: ${F}`,"vibe64_session_renewal_link_mismatch");if(!N(Ke.renewal_actor_id))throw U("A renewed \
|
|
3803
3803
|
session requires actor attribution.","vibe64_session_renewal_actor_required");let In=N(S)||N(Ke.renewal_actor_id),ar=N(b)||
|
|
@@ -3810,7 +3810,7 @@ Ke.renewal_successor_created_at),renewed_at:N(Ke.renewed_at)||pe};return await P
|
|
|
3810
3810
|
map(([lz,pz])=>dt(tt(ne,lz),`${pz}
|
|
3811
3811
|
`))]),{renewalId:L,sourceSessionId:z,successorSessionId:F}})))}async function tz({preparedAt:w="",renewalId:b="",sourceSessionId:S="",
|
|
3812
3812
|
successorSessionId:A=""}={}){let x=Ut(b),O=me(S),P=me(A),k=w?dn(w).toISOString():f().toISOString();return await Qt(O,L=>Ei(
|
|
3813
|
-
{metadata:L.metadata,renewalId:x,sessionId:O,successorSessionId:P})),
|
|
3813
|
+
{metadata:L.metadata,renewalId:x,sessionId:O,successorSessionId:P})),To(()=>Mt(P,async L=>{let[z,F]=await Promise.all([Me(
|
|
3814
3814
|
L),at(L)]);if(N(F.renewal_id)!==x||N(F.renewed_from)!==O)throw U(`Renewal successor does not match renewal ${x}: ${P}`,"\
|
|
3815
3815
|
vibe64_session_renewal_link_mismatch");if(z===de.RENEWAL_ACTIVATING){if(!N(F.renewal_activation_prepared_at))throw U(`Pr\
|
|
3816
3816
|
epared renewal successor has no activation proof: ${P}`,"vibe64_session_renewal_transition_invalid");return sr(L)}if(z!==
|
|
@@ -3819,21 +3819,21 @@ tion_invalid");let te=N(F.renewal_activation_prepared_at)||k;return await dt(tt(
|
|
|
3819
3819
|
|
|
3820
3820
|
`),await dt(L.statusPath,`${de.RENEWAL_ACTIVATING}
|
|
3821
3821
|
`),sr(L)}))}async function rz({renewalId:w="",sourceSessionId:b="",successorSessionId:S=""}={}){let A=Ut(w),x=me(b),O=me(
|
|
3822
|
-
S);return
|
|
3822
|
+
S);return To(()=>Mt(O,async P=>{let[k,L]=await Promise.all([Me(P),at(P)]);if(N(L.renewal_id)!==A||N(L.renewed_from)!==x)
|
|
3823
3823
|
throw U(`Renewal successor does not match renewal ${A}: ${O}`,"vibe64_session_renewal_link_mismatch");if(k===de.RENEWAL_PENDING)
|
|
3824
3824
|
return await ze(tt(P,"renewal_activation_prepared_at"),{force:!0}),sr(P);if(k!==de.RENEWAL_ACTIVATING)throw U(`Renewal s\
|
|
3825
3825
|
uccessor activation cannot be rolled back from status ${k}: ${O}`,"vibe64_session_renewal_transition_invalid");return await dt(
|
|
3826
3826
|
P.statusPath,`${de.RENEWAL_PENDING}
|
|
3827
3827
|
`),await ze(tt(P,"renewal_activation_prepared_at"),{force:!0}),sr(P)}))}async function nz({committedAt:w="",renewalId:b="",
|
|
3828
3828
|
sourceSessionId:S="",successorSessionId:A=""}={}){let x=Ut(b),O=me(S),P=me(A),k=dn(w).toISOString();return await Ie(O,L=>Ei(
|
|
3829
|
-
{metadata:L.metadata,renewalId:x,sessionId:O,successorSessionId:P})),
|
|
3829
|
+
{metadata:L.metadata,renewalId:x,sessionId:O,successorSessionId:P})),To(()=>Mt(P,async L=>{let[z,F]=await Promise.all([Me(
|
|
3830
3830
|
L),at(L)]);if(N(F.renewal_id)!==x||N(F.renewed_from)!==O)throw U(`Renewal successor does not match renewal ${x}: ${P}`,"\
|
|
3831
3831
|
vibe64_session_renewal_link_mismatch");if(z===de.ACTIVE){if(N(F.renewal_activated_at)!==k)throw U(`Active renewal succes\
|
|
3832
3832
|
sor has a different commit marker: ${P}`,"vibe64_session_renewal_transition_invalid");return sr(L)}if(z!==de.RENEWAL_ACTIVATING||
|
|
3833
3833
|
!N(F.renewal_activation_prepared_at))throw U(`Renewal successor is not prepared for commit: ${P}`,"vibe64_session_renewa\
|
|
3834
3834
|
l_transition_invalid");return await dt(tt(L,"renewal_activated_at"),`${k}
|
|
3835
3835
|
`),await dt(L.statusPath,`${de.ACTIVE}
|
|
3836
|
-
`),sr(L)}))}async function oz({renewalId:w="",sessionId:b=""}={}){let S=Ut(w),A=me(b);return
|
|
3836
|
+
`),sr(L)}))}async function oz({renewalId:w="",sessionId:b=""}={}){let S=Ut(w),A=me(b);return To(async()=>{let x=m(A),O=x.
|
|
3837
3837
|
sessionRoot;return Ft(O,async()=>{let P=await y(x,"mutation",{waitMs:kn});if(!P)throw U(`Timed out waiting to remove ren\
|
|
3838
3838
|
ewal successor: ${A}`,"vibe64_session_mutation_lock_timeout");try{if(!await Qe(x.manifestPath)){if(await ae(A))throw U(`\
|
|
3839
3839
|
An archived session cannot be removed as a pending renewal successor: ${A}`,"vibe64_session_renewal_transition_invalid");
|
|
@@ -3857,7 +3857,7 @@ de.ACTIVE,de.BLOCKED,de.RENEWAL_ACTIVATING,de.RENEWAL_PENDING,de.RENEWAL_QUIESCE
|
|
|
3857
3857
|
b)))).filter(b=>[de.ACTIVE,de.BLOCKED,de.RENEWAL_QUIESCED].includes(b.status)||FN(b))}async function az({temporaryRoot:w,
|
|
3858
3858
|
transform:b,transformTurnMetadata:S,transformHelperRecord:A,includePlans:x=!1,transformPlanProgress:O}){if(typeof b!="fu\
|
|
3859
3859
|
nction")throw new Error("Routing upgrade requires a transform.");return Nl({temporaryRoot:w,inspectSession:async(k,{checkedPath:L,
|
|
3860
|
-
inventory:z,readRegularText:F})=>{await L(k.sessionRoot,!0),await L(k.manifestPath),await
|
|
3860
|
+
inventory:z,readRegularText:F})=>{await L(k.sessionRoot,!0),await L(k.manifestPath),await xo(k),await z(k.metadataRoot);
|
|
3861
3861
|
let te=await at(k),re=[];for(let G of await z(k.conversationsRoot)){if(!G.isDirectory())continue;let W=q.join(_n(k,G.name).
|
|
3862
3862
|
conversationRoot,"conversation.json"),ne=await F(W);if(ne){let se;try{se=JSON.parse(ne)}catch{throw new Error(`Invalid t\
|
|
3863
3863
|
emporary conversation record: ${W}. Inspect it before upgrading routing.`)}if(!$e(se))throw new Error(`Invalid temporary\
|
|
@@ -3890,7 +3890,7 @@ on metadata.");if(W===te[G])continue;let ne=tt(k,G);pe.push({filePath:ne,origina
|
|
|
3890
3890
|
"Routing upgrade cannot create or replace an unknown temporary conversation.");JSON.stringify(W.record)!==JSON.stringify(
|
|
3891
3891
|
G)&&pe.push({filePath:W.filePath,original:W.original,contents:`${JSON.stringify(G)}
|
|
3892
3892
|
`})}if(S){let G=[k,...re.map(({record:W})=>_n(k,W.conversationId))];for(let W of G)for(let ne of await z(W.conversationLogRoot)){
|
|
3893
|
-
if(!ne.isDirectory()||!
|
|
3893
|
+
if(!ne.isDirectory()||!Ho.test(ne.name))continue;let se=q.join(W.conversationLogRoot,ne.name,A_),Ee=await F(se);if(!Ee)continue;
|
|
3894
3894
|
let Pe;try{Pe=JSON.parse(Ee)}catch{throw new Error(`Invalid conversation metadata: ${se}. Inspect it before upgrading ro\
|
|
3895
3895
|
uting.`)}if(!$e(Pe))throw new Error(`Invalid conversation metadata: ${se}.`);let Ke=S(Pe);JSON.stringify(Ke)!==JSON.stringify(
|
|
3896
3896
|
Pe)&&pe.push({filePath:se,original:Ee,contents:`${JSON.stringify(Ke)}
|
|
@@ -3936,7 +3936,7 @@ ation. Finish its original owner transaction before upgrading.`)},te=_(O),re;try
|
|
|
3936
3936
|
if(re)throw new Error(`Practice session ${O} retains renewal state. Finish or inspect its original transaction before up\
|
|
3937
3937
|
grading.`);let oe=await Nl({temporaryRoot:w,async inspectSession(G,{checkedPath:W,inventory:ne,archiveRecord:se}){if(G.sessionId!==
|
|
3938
3938
|
O)return[];if(L)throw new Error(`Practice session ${O} has multiple state incarnations. Finish archive recovery before u\
|
|
3939
|
-
pgrading.`);L=!0,await W(G.sessionRoot,!0),await W(G.manifestPath),await
|
|
3939
|
+
pgrading.`);L=!0,await W(G.sessionRoot,!0),await W(G.manifestPath),await xo(G);let Ee=Wo(await Me(G));if(Em.has(Ee))throw new Error(
|
|
3940
3940
|
`Practice session ${O} is in a renewal transition.`);for(let wt of await ne(G.metadataRoot)){let Ct=await ur(q.join(G.metadataRoot,
|
|
3941
3941
|
wt.name));if(!Ct.isFile()||Ct.nlink!==1)throw new Error(`Practice session ${O} requires regular non-aliased metadata.`)}
|
|
3942
3942
|
let Pe=await Ii(G);if(se&&Ee!==de.ARCHIVED)throw new Error(`Practice archive ${O} has non-archived contents.`);F(Pe,{archived:!!se});
|
|
@@ -3961,11 +3961,11 @@ index.metadata?.[er]},x,O);let Ee=await ur(G);if(!Ee.isFile()||Ee.nlink!==1)thro
|
|
|
3961
3961
|
is not a regular file.`);await lr(G),await H(se,async Pe=>{if(!(await ur(Pe.metadataRoot)).isDirectory())throw new Error(
|
|
3962
3962
|
`Frozen practice archive ${O} has an unsafe metadata root.`);let wt=await R_(Pe.metadataRoot,{withFileTypes:!0});for(let Wt of wt){
|
|
3963
3963
|
let In=await ur(q.join(Pe.metadataRoot,Wt.name));if(!In.isFile()||In.nlink!==1)throw new Error(`Frozen practice archive ${O}\
|
|
3964
|
-
has unsafe metadata paths.`)}let Ct=await Ii(Pe);if(uo(Ct,x,O),
|
|
3964
|
+
has unsafe metadata paths.`)}let Ct=await Ii(Pe);if(uo(Ct,x,O),Wo(await Me(Pe))!==de.ARCHIVED)throw new Error(`Frozen p\
|
|
3965
3965
|
ractice archive ${O} has non-archived contents.`);F(Ct,{archived:!0})},{temporaryRoot:w})}}return{found:L,files:k,updates:oe}}
|
|
3966
3966
|
async function uz({temporaryRoot:w,transform:b}){if(typeof b!="function")throw new Error("Conversation data upgrade requ\
|
|
3967
3967
|
ires a transform.");return Nl({temporaryRoot:w,async inspectSession(S,{checkedPath:A,inventory:x,readRegularText:O}){await A(
|
|
3968
|
-
S.sessionRoot,!0),await A(S.manifestPath),await
|
|
3968
|
+
S.sessionRoot,!0),await A(S.manifestPath),await xo(S),await x(S.metadataRoot);let P=await at(S),k=[{paths:S,conversation:null}];
|
|
3969
3969
|
for(let z of await x(S.conversationsRoot)){if(!z.isDirectory())continue;let F=_n(S,z.name),te=await O(q.join(F.conversationRoot,
|
|
3970
3970
|
"conversation.json")),re=te?JSON.parse(te):null;if(!$e(re)||re.conversationId!==z.name)throw new Error(`Invalid temporar\
|
|
3971
3971
|
y conversation ${z.name}. Inspect it before upgrading message data.`);k.push({paths:F,conversation:re})}let L=[];for(let z of k){
|
|
@@ -3979,9 +3979,9 @@ data))throw new Error("Conversation message has invalid data. Inspect it before
|
|
|
3979
3979
|
D_(se.data,Ee)||(se.data=Ee,pe=!0)}if(pe){let W=`${JSON.stringify(re,null,2)}
|
|
3980
3980
|
`;Ou(W),L.push({filePath:F,original:te,contents:W})}}return L}})}async function dz({temporaryRoot:w}){return Nl({temporaryRoot:w,
|
|
3981
3981
|
async inspectSession(b,{checkedPath:S,inventory:A,readRegularText:x}){await S(b.sessionRoot,!0),await S(b.manifestPath),
|
|
3982
|
-
await
|
|
3982
|
+
await xo(b);let O=[],P=[b];for(let k of await A(b.conversationsRoot))k.isDirectory()&&P.push(_n(b,k.name));for(let k of P){
|
|
3983
3983
|
let L=await A(k.conversationLogRoot),z=q.join(k.conversationLogRoot,"transcript.json"),F=await S(z)?await x(z):null,te=[],
|
|
3984
|
-
re=new Map;for(let Q of L){if(!Q.isDirectory()||!
|
|
3984
|
+
re=new Map;for(let Q of L){if(!Q.isDirectory()||!Ho.test(Q.name))continue;let pe=Vo(k,Q.name);for(let G of await A(pe)){
|
|
3985
3985
|
if(!S_.test(G.name)&&![UN,A_].includes(G.name))continue;let W=q.join(pe,G.name),ne=await x(W);te.push({filePath:W,original:ne,
|
|
3986
3986
|
contents:null})}re.set(Q.name,await iD(k,Q.name))}let oe=[];for(let Q of["rewound.json","message-ids.json"]){let pe=q.join(
|
|
3987
3987
|
k.conversationLogRoot,Q);if(!await S(pe))continue;let G=await x(pe);Q==="rewound.json"&&(oe=JSON.parse(G)),te.push({filePath:pe,
|
|
@@ -4009,7 +4009,7 @@ finalizeRenewalCurrentSession:WD,writeArtifact:Be,writeJsonArtifact:Si,writeAgen
|
|
|
4009
4009
|
upsertConversationAssistantMessage:ED,writeConversationAssistantMessage:AD,writeConversationCommentaryMessage:xD,writeConversationSystemMessage:CD,
|
|
4010
4010
|
writeConversationThinkingMessage:TD,writeConversationUserMessage:OD,writeMetadataValue:Ls,writeMetadataValueForRenewal:Cl,
|
|
4011
4011
|
writeJsonArtifactForRenewal:YL,writeSessionRenewalStateRecord:C,withPublishedRenewalSession:Ie,withArchivedSession:Ae,pruneArchivedSessionAttachments:jr,
|
|
4012
|
-
pruneArchivedSessionArtifacts:je,writeSessionLabel:Lr,writeStatus:
|
|
4012
|
+
pruneArchivedSessionArtifacts:je,writeSessionLabel:Lr,writeStatus:Eo}}var wj=new Set(Object.values(Im)),$m=new Set(["plan","code","economy","auto"]),vj=new Set(["routing","sending","uncertai\
|
|
4013
4013
|
n","sent","failed","cancelled","done","review_pending","review_sending","review_uncertain","reviewing"]),uX=new Set([...vj,
|
|
4014
4014
|
"planning","planning_pending","planning_sending","planning_uncertain","implementation_pending","implementation_sending",
|
|
4015
4015
|
"implementation_uncertain"]),jn=e=>e&&typeof e=="object"&&!Array.isArray(e),dX=["custom","senior","junior","helper","rev\
|
|
@@ -4216,14 +4216,14 @@ e:[]).map(qe).filter(t=>t&&t.length<=256&&!Y_(t)))]}function Bd(e=0){let t=Numbe
|
|
|
4216
4216
|
0?t:0}function Z_(e=null){if(!e||typeof e!="object"||Array.isArray(e))return null;let t=qe(e.status);return UX.has(t)?{checked:Bd(
|
|
4217
4217
|
e.checked),currentModelId:qe(e.currentModelId).slice(0,256),enabled:Bd(e.enabled),finishedAt:qe(e.finishedAt),id:qe(e.id),
|
|
4218
4218
|
message:qe(e.message).slice(0,320),rejected:Bd(e.rejected),retryable:Bd(e.retryable),startedAt:qe(e.startedAt),status:t,
|
|
4219
|
-
total:Bd(e.total),updatedAt:qe(e.updatedAt)}:null}function
|
|
4219
|
+
total:Bd(e.total),updatedAt:qe(e.updatedAt)}:null}function Jo(e={},t=""){try{let r=W_({defaultModelId:e.defaultModelId,id:t,
|
|
4220
4220
|
label:e.productLabel||e.label}),n=typeof e.ownerOnly=="boolean"?e.ownerOnly:r.ownerOnly;return{...r,accessLabel:n?"Perso\
|
|
4221
4221
|
nal use":"Workspace use",billingLabel:qe(e.billingLabel)||r.billingLabel,defaultModelId:qe(e.defaultModelId)||r.defaultModelId,
|
|
4222
4222
|
managementUrl:qe(e.managementUrl)||r.managementUrl,modelAccess:r.modelAccess?{...r.modelAccess,mode:e.modelAccessUnlocked===
|
|
4223
4223
|
!0?"all":"recommended"}:null,ownerOnly:n,productLabel:r.productLabel}}catch{return null}}function K_(e=null){let t=e&&typeof e==
|
|
4224
4224
|
"object"&&!Array.isArray(e)?e:{},r=t.connections&&typeof t.connections=="object"&&!Array.isArray(t.connections)?t.connections:
|
|
4225
4225
|
{},n={};for(let[s,a]of Object.entries(r)){if(!X_.test(s)||!a||typeof a!="object")continue;let c=String(a.apiKey||"");if(!c)
|
|
4226
|
-
continue;let u=
|
|
4226
|
+
continue;let u=Jo(a,s);n[s]={apiKey:c,billingLabel:qe(a.billingLabel)||u?.billingLabel||"",createdAt:qe(a.createdAt),...Object.
|
|
4227
4227
|
hasOwn(a,"helperModelId")?{helperModelId:a.helperModelId}:{},defaultModelId:qe(a.defaultModelId)||u?.defaultModelId||"",
|
|
4228
4228
|
endpointCode:G_,fingerprint:kj(s,c),label:qe(a.label)||s,managementUrl:qe(a.managementUrl)||u?.managementUrl||"",modelAccessUnlocked:a.
|
|
4229
4229
|
modelAccessUnlocked===!0,ownerOnly:a.ownerOnly===!1?!1:u?.ownerOnly!==!1,productLabel:qe(a.productLabel)||u?.productLabel||
|
|
@@ -4233,10 +4233,10 @@ zenModelAccessMode:Pj.has(qe(a.zenModelAccessMode))?qe(a.zenModelAccessMode):"re
|
|
|
4233
4233
|
updatedAt:qe(t.updatedAt),version:LX}}function Nj(e={},t="",{activeZenCheck:r=!1}={}){if(t===Mn){let n=Pj.has(qe(e.zenModelAccessMode))?
|
|
4234
4234
|
qe(e.zenModelAccessMode):"recommended",o=Z_(e.zenModelCheck);return{check:o&&["starting","running","cancelling"].includes(
|
|
4235
4235
|
o.status)&&!r?{...o,currentModelId:"",message:"The previous model check stopped when Vibe64 restarted.",status:"interrup\
|
|
4236
|
-
ted"}:o,configurable:!0,enabledModelIds:ts([
|
|
4237
|
-
en model access",managementOnly:!0,mode:n,recommendedModelId:
|
|
4238
|
-
one tiny request to each current Zen model and may use API credit."}}return
|
|
4239
|
-
let n=String(e.apiKey||""),o=
|
|
4236
|
+
ted"}:o,configurable:!0,enabledModelIds:ts([Jo(e,t)?.defaultModelId,...n==="verified"?e.zenEnabledModelIds:[]]),label:"Z\
|
|
4237
|
+
en model access",managementOnly:!0,mode:n,recommendedModelId:Jo(e,t)?.defaultModelId||"",warning:"Checking models sends \
|
|
4238
|
+
one tiny request to each current Zen model and may use API credit."}}return Jo(e,t)?.modelAccess||null}function Ko(e={},t="",r={}){
|
|
4239
|
+
let n=String(e.apiKey||""),o=Jo(e,t),i=Nj(e,t,r);return{accessLabel:o?.accessLabel||"Personal use",billingLabel:o?.billingLabel||
|
|
4240
4240
|
"Billing endpoint not selected",canonicalUrl:"",connected:!!o,defaultModelId:o?.defaultModelId||"",endpointCode:qe(e.endpointCode),
|
|
4241
4241
|
fingerprint:qe(e.fingerprint),id:t,keyHint:n.length>4?`\u2022\u2022\u2022\u2022${n.slice(-4)}`:"\u2022\u2022\u2022\u2022",
|
|
4242
4242
|
label:qe(e.label)||t,managementUrl:o?.managementUrl||"",modelProviderId:t,modelAccess:i||null,ownerOnly:o?.ownerOnly!==!1,
|
|
@@ -4268,7 +4268,7 @@ new Promise(m=>{setTimeout(m,y).unref?.()}):Promise.resolve()}async function f(y
|
|
|
4268
4268
|
connections[Mn];if(!_||_.fingerprint!==y.fingerprint||_.zenModelCheck?.id!==y.id||m(_,h)===!1)return null;let E=new Date().
|
|
4269
4269
|
toISOString();return _.zenModelCheck.updatedAt=E,h.updatedAt=E,await d(h),_})}async function v(y,m,h=""){await f(y,_=>{_.
|
|
4270
4270
|
zenModelCheck.currentModelId="",_.zenModelCheck.finishedAt=new Date().toISOString(),_.zenModelCheck.message=qe(h).slice(
|
|
4271
|
-
0,320),_.zenModelCheck.status=m}),a.get(Mn)===y&&a.delete(Mn)}async function g(y){try{let m=ts(await n()),h=
|
|
4271
|
+
0,320),_.zenModelCheck.status=m}),a.get(Mn)===y&&a.delete(Mn)}async function g(y){try{let m=ts(await n()),h=Jo({},Mn)?.defaultModelId,
|
|
4272
4272
|
_=m.filter(E=>E!==DX&&E!==h).sort((E,C)=>E.localeCompare(C));if(!await f(y,E=>{E.zenModelCheck.currentModelId=_[0]||"",E.
|
|
4273
4273
|
zenModelCheck.status="running",E.zenModelCheck.total=_.length}))return;for(let[E,C]of _.entries()){if(y.cancelled){await v(
|
|
4274
4274
|
y,"cancelled","Model checking was cancelled.");return}let T=!1,M=!1;try{T=(await o({apiKey:y.apiKey,engineId:"opencode",
|
|
@@ -4278,15 +4278,15 @@ currentModelId=j,T?(Y.zenEnabledModelIds=ts([...Y.zenEnabledModelIds,C]),Y.zenMo
|
|
|
4278
4278
|
1:Y.zenModelCheck.rejected+=1})){await v(y,"cancelled","Model checking was cancelled.");return}j&&await p()}await v(y,"c\
|
|
4279
4279
|
omplete")}catch{await v(y,y.cancelled?"cancelled":"failed",y.cancelled?"Model checking was cancelled.":"Vibe64 could not\
|
|
4280
4280
|
complete the Zen model check. Try again.")}}return Object.freeze({filePath:s,async listConnections(){let y=await u();return Object.
|
|
4281
|
-
keys(y.connections).map(m=>
|
|
4282
|
-
h.id))},async assistantAccess(y="",{modelId:m=""}={}){let h=Fd(y),_=await u(),I=J_(_,h),E=I?
|
|
4281
|
+
keys(y.connections).map(m=>Ko(J_(y,m),m,{activeZenCheck:a.has(m)})).sort((m,h)=>m.label.localeCompare(h.label)||m.id.localeCompare(
|
|
4282
|
+
h.id))},async assistantAccess(y="",{modelId:m=""}={}){let h=Fd(y),_=await u(),I=J_(_,h),E=I?Jo(I,h):null,C=I?Nj(I,h,{activeZenCheck:a.
|
|
4283
4283
|
has(h)}):null,T=qe(m),M=new Set(ts([C?.recommendedModelId,...ts(C?.enabledModelIds)])),j=!T||!C||C.mode==="all"||M.has(T);
|
|
4284
4284
|
return E?{accessLabel:E.accessLabel,available:j,connectionIdentity:`opencode:${h}:${I.fingerprint}`,endpointCode:E.endpointCode,
|
|
4285
4285
|
ownerOnly:E.ownerOnly}:{available:!1,ownerOnly:!0}},async removeConnection(y=""){let m=Fd(y);return l(async()=>{let h=await u();
|
|
4286
4286
|
if(!(h.connections[m]||null))return{id:m,ok:!0,removed:!1};let I=a.get(m);I&&(I.cancelled=!0,a.delete(m)),delete h.connections[m],
|
|
4287
4287
|
h.preferredProviderId===m&&(h.preferredProviderId=""),h.updatedAt=new Date().toISOString();let E={modelProviderId:m,reason:"\
|
|
4288
4288
|
removed"};return await r(E,()=>d(h)),await t(E),{id:m,ok:!0,removed:!0}})},async resolveConnection(y=""){let m=Fd(y),h=await u(),
|
|
4289
|
-
_=J_(h,m);if(!_)return null;let I=
|
|
4289
|
+
_=J_(h,m);if(!_)return null;let I=Jo(_,m);if(!I){let E=new Error("The owner must choose this provider's billing endpoint\
|
|
4290
4290
|
before it can be used.");throw E.code="vibe64_ai_endpoint_selection_required",E.statusCode=409,E}return{apiKey:_.apiKey,
|
|
4291
4291
|
canonicalUrl:"",defaultModelId:I.defaultModelId,endpointCode:I.endpointCode,fingerprint:_.fingerprint,modelProviderId:m,
|
|
4292
4292
|
providerRevision:_.providerRevision}},async upsertConnection(y={},{provider:m=null}={}){let h=Fd(y.modelProviderId||y.providerId||
|
|
@@ -4300,31 +4300,31 @@ createdAt)||M,defaultModelId:E.defaultModelId,endpointCode:E.endpointCode,finger
|
|
|
4300
4300
|
productLabel||h),managementUrl:E.managementUrl,modelAccessUnlocked:T?.modelAccessUnlocked===!0,ownerOnly:E.ownerOnly,productLabel:E.
|
|
4301
4301
|
productLabel,providerRevision:I,updatedAt:M,...h===Mn?{zenEnabledModelIds:V?ts(T.zenEnabledModelIds):[],zenModelAccessMode:V?
|
|
4302
4302
|
T.zenModelAccessMode:"recommended",zenModelCheck:V?Z_(T.zenModelCheck):null}:{}};C.connections[h]=ue,h===Za&&(C.preferredProviderId=
|
|
4303
|
-
Za),C.updatedAt=M;let Z={modelProviderId:h,reason:T?"replaced":"created"};return await r(Z,()=>d(C)),await t(Z),
|
|
4303
|
+
Za),C.updatedAt=M;let Z={modelProviderId:h,reason:T?"replaced":"created"};return await r(Z,()=>d(C)),await t(Z),Ko({...ue,
|
|
4304
4304
|
preferred:C.preferredProviderId===h},h)})},async updateModelAccess(y="",m={}){let h=Fd(y),_=qe(m.operation)||(typeof m.unlocked==
|
|
4305
4305
|
"boolean"?m.unlocked?"enable-all":"disable-additional":"");if(![Za,Mn].includes(h)){let E=new Error("This provider does \
|
|
4306
4306
|
not have configurable model access.");throw E.code="vibe64_ai_model_access_not_configurable",E.statusCode=400,E}if(h===Za){
|
|
4307
4307
|
if(!["disable-additional","enable-all"].includes(_)){let E=new Error("Choose whether all Z.AI models should be unlocked.");
|
|
4308
4308
|
throw E.code="vibe64_ai_model_access_invalid",E.statusCode=400,E}return l(async()=>{let E=await u(),C=E.connections[h];if(!C){
|
|
4309
4309
|
let j=new Error("Connect a Z.AI API key before changing model access.");throw j.code="vibe64_ai_connection_required",j.statusCode=
|
|
4310
|
-
409,j}let T=_==="enable-all";if(C.modelAccessUnlocked===T)return
|
|
4310
|
+
409,j}let T=_==="enable-all";if(C.modelAccessUnlocked===T)return Ko({...C,preferred:E.preferredProviderId===h},h);let M=new Date().
|
|
4311
4311
|
toISOString();return C.modelAccessUnlocked=T,C.updatedAt=M,E.updatedAt=M,await d(E),await t({modelProviderId:h,reason:"m\
|
|
4312
|
-
odel-access-updated"}),
|
|
4312
|
+
odel-access-updated"}),Ko({...C,preferred:E.preferredProviderId===h},h)})}if(!["cancel-check","check-available","disable\
|
|
4313
4313
|
-additional","enable-all"].includes(_)){let E=new Error("Choose how OpenCode Zen models should be enabled.");throw E.code=
|
|
4314
4314
|
"vibe64_ai_model_access_invalid",E.statusCode=400,E}if(_==="check-available"){if(typeof n!="function"){let T=new Error("\
|
|
4315
4315
|
This Vibe64 host cannot read the current Zen model list.");throw T.code="vibe64_ai_model_check_unavailable",T.statusCode=
|
|
4316
4316
|
503,T}let E=null,C=await l(async()=>{let T=await u(),M=T.connections[h];if(!M){let V=new Error("Add a Zen API key before\
|
|
4317
|
-
checking model access.");throw V.code="vibe64_ai_connection_required",V.statusCode=409,V}if(a.has(h))return
|
|
4317
|
+
checking model access.");throw V.code="vibe64_ai_connection_required",V.statusCode=409,V}if(a.has(h))return Ko({...M,preferred:T.
|
|
4318
4318
|
preferredProviderId===h},h,{activeZenCheck:!0});let j=new Date().toISOString();return E={apiKey:M.apiKey,cancelled:!1,fingerprint:M.
|
|
4319
4319
|
fingerprint,id:Cj()},a.set(h,E),M.zenEnabledModelIds=[],M.zenModelAccessMode="verified",M.zenModelCheck={checked:0,currentModelId:"",
|
|
4320
4320
|
enabled:0,finishedAt:"",id:E.id,message:"",rejected:0,retryable:0,startedAt:j,status:"starting",total:0,updatedAt:j},M.updatedAt=
|
|
4321
|
-
j,T.updatedAt=j,await d(T),
|
|
4321
|
+
j,T.updatedAt=j,await d(T),Ko({...M,preferred:T.preferredProviderId===h},h,{activeZenCheck:!0})});if(E){try{await t({modelProviderId:h,
|
|
4322
4322
|
reason:"model-access-updated"})}catch(T){throw E.cancelled=!0,await v(E,"failed","Vibe64 could not prepare the Zen model\
|
|
4323
4323
|
check. Try again."),T}g(E).catch(()=>null)}return C}if(_==="cancel-check"){let E=a.get(h);return E&&(E.cancelled=!0),l(
|
|
4324
4324
|
async()=>{let C=await u(),T=C.connections[h];if(!T){let j=new Error("Add a Zen API key before changing model access.");throw j.
|
|
4325
4325
|
code="vibe64_ai_connection_required",j.statusCode=409,j}let M=new Date().toISOString();return T.zenModelCheck&&(T.zenModelCheck.
|
|
4326
4326
|
status=E?"cancelling":"cancelled",T.zenModelCheck.updatedAt=M,E||(T.zenModelCheck.currentModelId="",T.zenModelCheck.finishedAt=
|
|
4327
|
-
M,T.zenModelCheck.message="Model checking was cancelled."),C.updatedAt=M,await d(C)),
|
|
4327
|
+
M,T.zenModelCheck.message="Model checking was cancelled."),C.updatedAt=M,await d(C)),Ko({...T,preferred:C.preferredProviderId===
|
|
4328
4328
|
h},h,{activeZenCheck:!!E})})}let I=a.get(h);return I&&(I.cancelled=!0,a.delete(h)),l(async()=>{let E=await u(),C=E.connections[h];
|
|
4329
4329
|
if(!C){let j=new Error("Add a Zen API key before changing model access.");throw j.code="vibe64_ai_connection_required",j.
|
|
4330
4330
|
statusCode=409,j}let T=_==="enable-all"?"all":"recommended",M=new Date().toISOString();return C.zenEnabledModelIds=[],C.
|
|
@@ -4332,7 +4332,7 @@ zenModelAccessMode=T,C.zenModelCheck&&["starting","running","cancelling"].includ
|
|
|
4332
4332
|
currentModelId="",C.zenModelCheck.finishedAt=M,C.zenModelCheck.message=_==="enable-all"?"The check stopped because all c\
|
|
4333
4333
|
urrent Zen models were enabled.":"The check stopped because additional Zen models were disabled.",C.zenModelCheck.status=
|
|
4334
4334
|
"cancelled",C.zenModelCheck.updatedAt=M),C.updatedAt=M,E.updatedAt=M,await d(E),await t({modelProviderId:h,reason:"model\
|
|
4335
|
-
-access-updated"}),
|
|
4335
|
+
-access-updated"}),Ko({...C,preferred:E.preferredProviderId===h},h,{activeZenCheck:!1})})}})}var JX="gpt-5.6-luna",XX="haiku",Q_=["plan","code","economy","router","sharedBackup"],eb=e=>e&&typeof e=="object"&&!Array.
|
|
4336
4336
|
isArray(e),Kr=e=>JSON.stringify([e.engineId,e.modelProviderId,e.modelId]),YX=e=>KX("sha256").update(e).digest("hex"),jj=e=>`${JSON.
|
|
4337
4337
|
stringify(e,null,2)}
|
|
4338
4338
|
`;function Bm(e,t){return(z_.models.find(n=>["engineId","modelProviderId","modelId"].every(o=>n[o]===e[o]))?.scores||z_.
|
|
@@ -4539,7 +4539,7 @@ r(),s.add(c.freshOperation.operationId);let u=new Set;for(let d of c.unconfirmed
|
|
|
4539
4539
|
g"||!d.messageId||d.messageId.length>128||typeof d.clientId!="string"||!d.clientId||d.clientId.length>128||typeof d.text!=
|
|
4540
4540
|
"string"||!d.text.trim()||d.text.length>24e3||d.source!=="client-reported"||d.status!=="unconfirmed"||u.has(d.messageId))&&
|
|
4541
4541
|
r(),u.add(d.messageId)}}import{randomUUID as oI}from"node:crypto";import{glob as GZ,lstat as bu,open as WZ,readdir as iI,realpath as rI}from"node:fs/promises";
|
|
4542
|
-
import{homedir as Sh}from"node:os";import Ge from"node:path";import{isDeepStrictEqual as
|
|
4542
|
+
import{homedir as Sh}from"node:os";import Ge from"node:path";import{isDeepStrictEqual as hi}from"node:util";import m5 from"node:os";import Xj from"node:path";import Wm from"node:process";function h5(e=""){let t=Le(e);return t&&Xj.isAbsolute(t)?Xj.resolve(t):""}function Yj(e=""){return typeof Wm[e]=="functi\
|
|
4543
4543
|
on"?Wm[e]():null}function g5(e={}){return{actor:"app",credentialScope:e.scope||"app",requiresRealUser:!1,user:{gid:e.gid,
|
|
4544
4544
|
home:e.toolHomeSource,uid:e.uid,username:e.username}}}function w5(e=[]){let t=Array.isArray(e)?e:[];return Jn([...nd,...t])}
|
|
4545
4545
|
function sb({env:e=Wm.env,gid:t=Yj("getgid"),home:r=m5.homedir(),providerOptions:n={},requireSystemRoot:o=!1,shimDirs:i=[],
|
|
@@ -4561,36 +4561,36 @@ n=>(+n^r()&15>>+n/4).toString(16))};function Kd(e){return typeof e=="object"&&e!
|
|
|
4561
4561
|
includes("FetchRequestCanceledException"))}var Jd=e=>{if(e instanceof Error)return e;if(typeof e=="object"&&e!==null){try{
|
|
4562
4562
|
if(Object.prototype.toString.call(e)==="[object Error]"){let t=new Error(e.message,e.cause?{cause:e.cause}:{});return e.
|
|
4563
4563
|
stack&&(t.stack=e.stack),e.cause&&!t.cause&&(t.cause=e.cause),e.name&&(t.name=e.name),t}}catch{}try{return new Error(JSON.
|
|
4564
|
-
stringify(e))}catch{}}return new Error(e)};var ee=class extends Error{},
|
|
4564
|
+
stringify(e))}catch{}}return new Error(e)};var ee=class extends Error{},yt=class e extends ee{constructor(t,r,n,o){super(`${e.makeMessage(t,r,n)}`),this.status=t,this.
|
|
4565
4565
|
headers=o,this.requestID=o?.get("x-request-id"),this.error=r;let i=r;this.code=i?.code,this.param=i?.param,this.type=i?.
|
|
4566
4566
|
type}static makeMessage(t,r,n){let o=r?.message?typeof r.message=="string"?r.message:JSON.stringify(r.message):r?JSON.stringify(
|
|
4567
4567
|
r):n;return t&&o?`${t} ${o}`:t?`${t} status code (no body)`:o||"(no status code or body)"}static generate(t,r,n,o){if(!t||
|
|
4568
|
-
!o)return new
|
|
4568
|
+
!o)return new Xo({message:n,cause:Jd(r)});let i=r?.error;return t===400?new tc(t,i,n,o):t===401?new rc(t,i,n,o):t===403?
|
|
4569
4569
|
new nc(t,i,n,o):t===404?new oc(t,i,n,o):t===409?new ic(t,i,n,o):t===422?new sc(t,i,n,o):t===429?new ac(t,i,n,o):t>=500?new cc(
|
|
4570
|
-
t,i,n,o):new e(t,i,n,o)}},It=class extends
|
|
4571
|
-
void 0)}},
|
|
4572
|
-
cause=r)}},
|
|
4573
|
-
rc=class extends
|
|
4574
|
-
cc=class extends
|
|
4570
|
+
t,i,n,o):new e(t,i,n,o)}},It=class extends yt{constructor({message:t}={}){super(void 0,void 0,t||"Request was aborted.",
|
|
4571
|
+
void 0)}},Xo=class extends yt{constructor({message:t,cause:r}){super(void 0,void 0,t||"Connection error.",void 0),r&&(this.
|
|
4572
|
+
cause=r)}},Yo=class extends Xo{constructor({message:t}={}){super({message:t??"Request timed out."})}},tc=class extends yt{},
|
|
4573
|
+
rc=class extends yt{},nc=class extends yt{},oc=class extends yt{},ic=class extends yt{},sc=class extends yt{},ac=class extends yt{},
|
|
4574
|
+
cc=class extends yt{},uc=class extends ee{constructor(){super("Could not parse response content as the length limit was \
|
|
4575
4575
|
reached")}},dc=class extends ee{constructor(){super("Could not parse response content as the request was rejected by the\
|
|
4576
|
-
content filter")}},Ln=class extends Error{constructor(t){super(t)}},os=class extends
|
|
4576
|
+
content filter")}},Ln=class extends Error{constructor(t){super(t)}},os=class extends yt{constructor(t,r,n){let o="OAuth\
|
|
4577
4577
|
2 authentication error",i;if(r&&typeof r=="object"){let s=r;i=s.error;let a=s.error_description;a&&typeof a=="string"?o=
|
|
4578
4578
|
a:i&&(o=i)}super(t,r,o,n),this.error_code=i}},Xd=class extends ee{constructor(t,r,n){super(t),this.provider=r,this.cause=
|
|
4579
4579
|
n}};var y5=/^[a-z][a-z0-9+.-]*:/i,Zj=e=>y5.test(e),tr=e=>(tr=Array.isArray,tr(e)),ab=tr;function Km(e){return typeof e!="obj\
|
|
4580
4580
|
ect"?{}:e??{}}function cb(e){if(!e)return!0;for(let t in e)return!1;return!0}function Qj(e,t){return Object.prototype.hasOwnProperty.
|
|
4581
4581
|
call(e,t)}function Yd(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)}var eM=(e,t)=>{if(typeof t!="number"||!Number.isInteger(t))throw new ee(`${e} must be an integer`);if(t<0)throw new ee(`${e}\
|
|
4582
|
-
must be a positive integer`);return t};var tM=e=>{try{return JSON.parse(e)}catch{return}};var Dn=e=>new Promise(t=>setTimeout(t,e));var
|
|
4582
|
+
must be a positive integer`);return t};var tM=e=>{try{return JSON.parse(e)}catch{return}};var Dn=e=>new Promise(t=>setTimeout(t,e));var Zo="6.49.0";var iM=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";function _5(){return typeof Deno<"u"&&Deno.
|
|
4583
4583
|
build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.
|
|
4584
4584
|
process:0)==="[object process]"?"node":"unknown"}var b5=()=>{let e=_5();if(e==="deno")return{"X-Stainless-Lang":"js","X-\
|
|
4585
|
-
Stainless-Package-Version":
|
|
4585
|
+
Stainless-Package-Version":Zo,"X-Stainless-OS":nM(Deno.build.os),"X-Stainless-Arch":rM(Deno.build.arch),"X-Stainless-Run\
|
|
4586
4586
|
time":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<
|
|
4587
|
-
"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":
|
|
4587
|
+
"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Zo,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other\
|
|
4588
4588
|
:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(e==="node")return{
|
|
4589
|
-
"X-Stainless-Lang":"js","X-Stainless-Package-Version":
|
|
4589
|
+
"X-Stainless-Lang":"js","X-Stainless-Package-Version":Zo,"X-Stainless-OS":nM(globalThis.process.platform??"unknown"),"X-\
|
|
4590
4590
|
Stainless-Arch":rM(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.
|
|
4591
|
-
process.version??"unknown"};let t=I5();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":
|
|
4591
|
+
process.version??"unknown"};let t=I5();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Zo,"X-Stainless-O\
|
|
4592
4592
|
S":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${t.browser}`,"X-Stainless-Runtime-Version":t.version}:
|
|
4593
|
-
{"X-Stainless-Lang":"js","X-Stainless-Package-Version":
|
|
4593
|
+
{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Zo,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Sta\
|
|
4594
4594
|
inless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function I5(){if(typeof navigator>"u"||!navigator)return null;
|
|
4595
4595
|
let e=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},
|
|
4596
4596
|
{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},
|
|
@@ -4680,9 +4680,9 @@ fRequestLogID"in e&&(e.retryOfRequestLogID&&(e.retryOf=e.retryOfRequestLogID),de
|
|
|
4680
4680
|
let i=!1,s=n?St(n):console;async function*a(){if(i)throw new ee("Cannot iterate over a consumed stream, use `.tee()` to \
|
|
4681
4681
|
split the stream.");i=!0;let c=!1;try{for await(let u of R5(t,r))if(!c){if(u.data.startsWith("[DONE]")){c=!0;continue}if(u.
|
|
4682
4682
|
event===null||!u.event.startsWith("thread.")){let d;try{d=JSON.parse(u.data)}catch(l){throw s.error("Could not parse mes\
|
|
4683
|
-
sage into JSON:",u.data),s.error("From chunk:",u.raw),l}if(d&&d.error)throw new
|
|
4683
|
+
sage into JSON:",u.data),s.error("From chunk:",u.raw),l}if(d&&d.error)throw new yt(void 0,d.error,void 0,t.headers);yield o?
|
|
4684
4684
|
{event:u.event,data:d}:d}else{let d;try{d=JSON.parse(u.data)}catch(l){throw console.error("Could not parse message into \
|
|
4685
|
-
JSON:",u.data),console.error("From chunk:",u.raw),l}if(u.event=="error")throw new
|
|
4685
|
+
JSON:",u.data),console.error("From chunk:",u.raw),l}if(u.event=="error")throw new yt(void 0,d.error,d.message,void 0);yield{
|
|
4686
4686
|
event:u.event,data:d}}}c=!0}catch(u){if(Kd(u))return;throw u}finally{c||r.abort()}}return new e(a,r,n)}static fromReadableStream(t,r,n){
|
|
4687
4687
|
let o=!1;async function*i(){let a=new is,c=t.getReader(),u=!1,d,l=()=>{d??(d=c.cancel()),d.catch(()=>{})};r.signal.addEventListener(
|
|
4688
4688
|
"abort",l,{once:!0});try{if(r.signal.aborted){l();return}for(;;){let{value:p,done:f}=await c.read();if(f){u=!0;break}if(r.
|
|
@@ -4746,7 +4746,7 @@ let t=await this.config.provider.getToken(),r={grant_type:j5,subject_token:t,sub
|
|
|
4746
4746
|
tokenType],identity_provider_id:this.config.identityProviderId,service_account_id:this.config.serviceAccountId};this.config.
|
|
4747
4747
|
clientId&&(r.client_id=this.config.clientId);let n=await this.fetch(this.tokenExchangeUrl,{method:"POST",headers:{"Conte\
|
|
4748
4748
|
nt-Type":"application/json"},body:JSON.stringify(r)});if(!n.ok){let c=await n.text(),u;try{u=JSON.parse(c)}catch{}throw n.
|
|
4749
|
-
status===400||n.status===401||n.status===403?new os(n.status,u,n.headers):
|
|
4749
|
+
status===400||n.status===401||n.status===403?new os(n.status,u,n.headers):yt.generate(n.status,u,`Token exchange failed \
|
|
4750
4750
|
with status ${n.status}`,n.headers)}let o=await n.json();if(typeof o!="object"||o===null||!("access_token"in o)||typeof o.
|
|
4751
4751
|
access_token!="string"||o.access_token.trim().length===0)throw new ee("Token exchange response missing 'access_token' fi\
|
|
4752
4752
|
eld");let i=o.access_token,s=o.expires_in??3600,a=Date.now()+s*1e3;return this.cachedToken={token:i,expiresAt:a},i}isTokenExpired(t){
|
|
@@ -4764,7 +4764,7 @@ a global, which is required for file uploads."+(t?" Update to Node 20 LTS or new
|
|
|
4764
4764
|
'node:buffer').File`.":""))}};function mc(e,t,r){return Eb(),new File(e,t??"unknown_file",r)}function fc(e){return(typeof e==
|
|
4765
4765
|
"object"&&e!==null&&("name"in e&&e.name&&String(e.name)||"url"in e&&e.url&&String(e.url)||"filename"in e&&e.filename&&String(
|
|
4766
4766
|
e.filename)||"path"in e&&e.path&&String(e.path))||"").split(/[\\/]/).pop()||void 0}var hc=e=>e!=null&&typeof e=="object"&&
|
|
4767
|
-
typeof e[Symbol.asyncIterator]=="function",
|
|
4767
|
+
typeof e[Symbol.asyncIterator]=="function",Qo=async(e,t)=>Ib(e.body)?nh(e.body)?TM(e):{...e,body:await xM(e.body,t)}:e,nr=async(e,t)=>nh(
|
|
4768
4768
|
e.body)?TM(e):{...e,body:await xM(e.body,t)},AM=new WeakMap;function L5(e){let t=typeof e=="function"?e:e.fetch,r=AM.get(
|
|
4769
4769
|
t);if(r)return r;let n=(async()=>{try{let o="Response"in t?t.Response:(await t("data:,")).constructor,i=new FormData;return i.
|
|
4770
4770
|
toString()!==await new o(i).text()}catch{return!0}})();return AM.set(t,n),n}var xM=async(e,t)=>{if(!await L5(t))throw new TypeError(
|
|
@@ -4838,7 +4838,7 @@ r?.function.strict||!1)}function Rb(e){return il(e.response_format)?!0:e.tools?.
|
|
|
4838
4838
|
strict===!0)??!1}function jM(e){for(let t of e||[])if(t.type!=="function")throw new ee(`Currently only \`function\` tool c\
|
|
4839
4839
|
alls are supported; Received \`${t.type}\``)}function MM(e){for(let t of e??[]){if(t.type!=="function")throw new ee(`Cur\
|
|
4840
4840
|
rently only \`function\` tool types support auto-parsing; Received \`${t.type}\``);if(t.function.strict!==!0)throw new ee(
|
|
4841
|
-
`The \`${t.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`)}}var fo=e=>e?.role==="assistant",al=e=>e?.role==="tool";var cl,ah,ch,ul,dl,uh,ll,mo,dh,pl,lh,ph,gc,$M,Ob,
|
|
4841
|
+
`The \`${t.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`)}}var fo=e=>e?.role==="assistant",al=e=>e?.role==="tool";var cl,ah,ch,ul,dl,uh,ll,mo,dh,pl,lh,ph,gc,$M,Ob,ei=class{constructor(){cl.add(this),this.controller=new AbortController,
|
|
4842
4842
|
ah.set(this,void 0),ch.set(this,()=>{}),ul.set(this,()=>{}),dl.set(this,void 0),uh.set(this,()=>{}),ll.set(this,()=>{}),
|
|
4843
4843
|
mo.set(this,{}),dh.set(this,[]),pl.set(this,!1),lh.set(this,!1),ph.set(this,!1),gc.set(this,!1),be(this,ah,new Promise((t,r)=>{
|
|
4844
4844
|
be(this,ch,t,"f"),be(this,ul,r,"f")}),"f"),be(this,dl,new Promise((t,r)=>{be(this,uh,t,"f"),be(this,ll,r,"f")}),"f"),D(this,
|
|
@@ -4872,7 +4872,7 @@ _emit("error",t);if(t instanceof Error){let r=new ee(t.message);return r.cause=t
|
|
|
4872
4872
|
e.content!==void 0&&(t.content=e.content),e.function_call!=null&&(t.function_call=e.function_call),e.name!==void 0&&(t.name=
|
|
4873
4873
|
e.name),e.refusal!=null&&(t.refusal=e.refusal),e.tool_calls!==void 0&&(t.tool_calls=e.tool_calls.map(r=>r.type==="custom"?
|
|
4874
4874
|
{id:r.id,type:r.type,custom:{input:r.custom.input,name:r.custom.name}}:{id:r.id,type:r.type,function:{arguments:r.function.
|
|
4875
|
-
arguments,name:r.function.name}})),t}var wc=class extends
|
|
4875
|
+
arguments,name:r.function.name}})),t}var wc=class extends ei{constructor(){super(...arguments),dr.add(this),this._chatCompletions=
|
|
4876
4876
|
[],this.messages=[]}_addChatCompletion(t){Z5(t),this._chatCompletions.push(t),this._emit("chatCompletion",t);let r=t.choices[0]?.
|
|
4877
4877
|
message;return r&&this._addMessage(r),t}_addMessage(t,r=!0){if("content"in t||(t.content=null),this.messages.push(t),r){
|
|
4878
4878
|
if(this._emit("message",t),al(t)&&t.content)this._emit("functionToolCallResult",t.content);else if(fo(t)&&t.tool_calls)for(let n of t.
|
|
@@ -4941,12 +4941,12 @@ if(Bt.NUM&t)try{return e[e.length-1]==="."?JSON.parse(e.substring(0,e.lastIndexO
|
|
|
4941
4941
|
"e")))}catch{}i(String(f))}}let p=n;for(e[n]==="-"&&n++;e[n]&&!",]}".includes(e[n]);)n++;n==r&&!(Bt.NUM&t)&&o("Untermina\
|
|
4942
4942
|
ted number literal");try{return JSON.parse(e.substring(p,n))}catch{e.substring(p,n)==="-"&&Bt.NUM&t&&o("Not sure what '-\
|
|
4943
4943
|
' is");try{return JSON.parse(e.substring(p,e.lastIndexOf("e")))}catch(v){i(String(v))}}},l=()=>{for(;n<r&&`
|
|
4944
|
-
\r `.includes(e[n]);)n++};return s()},Lb=e=>eY(e,Bt.ALL^Bt.NUM);var Tt,ho,
|
|
4944
|
+
\r `.includes(e[n]);)n++};return s()},Lb=e=>eY(e,Bt.ALL^Bt.NUM);var Tt,ho,ti,vc,fn,Db,mh,zb,Ub,Fb,ml,Bb,UM,Vb="chat.completion.chunk.message:";function FM(e,t,r){let n={type:"message",
|
|
4945
4945
|
message:t,...r?{tool_call_ids:r}:{}};return{id:e.id,choices:[],created:e.created,model:e.model,object:`${Vb}${JSON.stringify(
|
|
4946
4946
|
n)}`}}function rY(e){return"type"in e&&e.type==="message"&&"message"in e||"object"in e&&typeof e.object=="string"&&e.object.
|
|
4947
4947
|
startsWith(Vb)}function nY(e){return"type"in e?e:JSON.parse(e.object.slice(Vb.length))}var us=class e extends wc{constructor(t){
|
|
4948
|
-
super(),Tt.add(this),ho.set(this,void 0),
|
|
4949
|
-
this,
|
|
4948
|
+
super(),Tt.add(this),ho.set(this,void 0),ti.set(this,void 0),vc.set(this,void 0),fn.set(this,void 0),be(this,ho,t,"f"),be(
|
|
4949
|
+
this,ti,new Set,"f"),be(this,vc,[],"f")}get currentChatCompletionSnapshot(){return D(this,fn,"f")}static fromReadableStream(t){
|
|
4950
4950
|
let r=new e(null);return r._run(()=>r._fromReadableStream(t)),r}static createChatCompletion(t,r,n){let o=new e(r);return o.
|
|
4951
4951
|
_run(()=>o._runChatCompletion(t,{...r,stream:!0},{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}async _createChatCompletion(t,r,n){
|
|
4952
4952
|
super._createChatCompletion,this._listenForAbort(n?.signal),D(this,Tt,"m",Db).call(this);let o=await t.chat.completions.
|
|
@@ -4958,8 +4958,8 @@ d,l]of c.tool_call_ids?.entries()??[]){let p=u?.[d];p&&l&&(p.id=l)}this._addChat
|
|
|
4958
4958
|
o=void 0}this._addMessage(c.message);continue}let a=s;o&&a.id&&o!==a.id&&this._addChatCompletion(D(this,Tt,"m",ml).call(
|
|
4959
4959
|
this)),D(this,Tt,"m",zb).call(this,a),a.id&&(o=a.id)}if(n.controller.signal?.aborted)throw new It;if(D(this,fn,"f"))return this.
|
|
4960
4960
|
_addChatCompletion(D(this,Tt,"m",ml).call(this));let i=this._chatCompletions[this._chatCompletions.length-1];if(i)return i;
|
|
4961
|
-
throw new ee("request ended without sending any chunks")}[(ho=new WeakMap,
|
|
4962
|
-
new WeakSet,Db=function(){this.ended||(be(this,
|
|
4961
|
+
throw new ee("request ended without sending any chunks")}[(ho=new WeakMap,ti=new WeakMap,vc=new WeakMap,fn=new WeakMap,Tt=
|
|
4962
|
+
new WeakSet,Db=function(){this.ended||(be(this,ti,new Set,"f"),be(this,fn,void 0,"f"))},mh=function(r){let n=D(this,vc,"\
|
|
4963
4963
|
f")[r.index];return n||(n={content_done:!1,refusal_done:!1,logprobs_content_done:!1,logprobs_refusal_done:!1,done_tool_calls:new Set,
|
|
4964
4964
|
current_tool_call_index:null},D(this,vc,"f")[r.index]=n,n)},zb=function(r){if(this.ended)return;let n=D(this,Tt,"m",UM).
|
|
4965
4965
|
call(this,r);this._emit("chunk",r,n);for(let o of r.choices){let i=n.choices[o.index],{delta:s}=o;s?.content!=null&&i.message?.
|
|
@@ -4985,16 +4985,16 @@ this);this._emit("content.done",{content:r.message.content,parsed:o?o.$parseRaw(
|
|
|
4985
4985
|
(n.logprobs_content_done=!0,this._emit("logprobs.content.done",{content:r.logprobs.content})),r.logprobs?.refusal&&!n.logprobs_refusal_done&&
|
|
4986
4986
|
(n.logprobs_refusal_done=!0,this._emit("logprobs.refusal.done",{refusal:r.logprobs.refusal}))},ml=function(){if(this.ended)
|
|
4987
4987
|
throw new ee("stream has ended, this shouldn't happen");let r=D(this,fn,"f");if(!r)throw new ee("request ended without s\
|
|
4988
|
-
ending any chunks");let n=D(this,
|
|
4988
|
+
ending any chunks");let n=D(this,ti,"f");return be(this,ti,new Set,"f"),be(this,fn,void 0,"f"),be(this,vc,[],"f"),oY(r,D(
|
|
4989
4989
|
this,ho,"f"),n)},Bb=function(){let r=D(this,ho,"f")?.response_format;return il(r)?r:null},UM=function(r){var n,o,i,s,a;let c=D(
|
|
4990
4990
|
this,fn,"f"),{choices:u,...d}=r;c?r.id&&Object.assign(c,d):c=be(this,fn,{...d,choices:[]},"f");for(let{delta:l,finish_reason:p,
|
|
4991
4991
|
index:f,logprobs:v=null,...g}of r.choices){let y=c.choices[f];if(y||(y=c.choices[f]={finish_reason:p,index:f,message:{},
|
|
4992
4992
|
logprobs:v,...g}),v)if(!y.logprobs)y.logprobs=Object.assign({},v);else{let{content:M,refusal:j,...V}=v;Object.assign(y.logprobs,
|
|
4993
4993
|
V),M&&((n=y.logprobs).content??(n.content=[]),y.logprobs.content.push(...M)),j&&((o=y.logprobs).refusal??(o.refusal=[]),
|
|
4994
4994
|
y.logprobs.refusal.push(...j))}if(p&&(y.finish_reason=p,D(this,ho,"f")&&Rb(D(this,ho,"f")))){if(p==="length")throw new uc;
|
|
4995
|
-
if(p==="content_filter")throw new dc}if(Object.assign(y,g),!l)continue;D(this,
|
|
4995
|
+
if(p==="content_filter")throw new dc}if(Object.assign(y,g),!l)continue;D(this,ti,"f").delete(f);let{audio:m,content:h,refusal:_,
|
|
4996
4996
|
function_call:I,role:E,tool_calls:C,...T}=l;if(Object.assign(y.message,T),m?.expires_at!=null&&m.id==null&&m.data==null&&
|
|
4997
|
-
m.transcript==null&&h==null&&_==null&&I==null&&E==null&&C==null&&Object.keys(T).length===0&&D(this,
|
|
4997
|
+
m.transcript==null&&h==null&&_==null&&I==null&&E==null&&C==null&&Object.keys(T).length===0&&D(this,ti,"f").add(f),_&&(y.
|
|
4998
4998
|
message.refusal=(y.message.refusal||"")+_),E&&(y.message.role=E),m){let M=(i=y.message).audio??(i.audio={});m.id!=null&&
|
|
4999
4999
|
(M.id=m.id),m.data!=null&&(M.data=(M.data??"")+m.data),m.transcript!=null&&(M.transcript=(M.transcript??"")+m.transcript),
|
|
5000
5000
|
m.expires_at!=null&&(M.expires_at=m.expires_at)}if(I&&(y.message.function_call?(I.name&&(y.message.function_call.name=I.
|
|
@@ -5038,7 +5038,7 @@ get(R`/chat/completions/${t}`,{...r,__security:{bearerAuth:!0}})}update(t,r,n){r
|
|
|
5038
5038
|
__security:{bearerAuth:!0}})}delete(t,r){return this._client.delete(R`/chat/completions/${t}`,{...r,__security:{bearerAuth:!0}})}parse(t,r){
|
|
5039
5039
|
return MM(t.tools),this._client.chat.completions.create(t,{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"chat\
|
|
5040
5040
|
.completions.parse"}})._thenUnwrap(n=>sl(n,t))}runTools(t,r){return t.stream?hl.runTools(this._client,t,r):fl.runTools(this.
|
|
5041
|
-
_client,t,r)}stream(t,r){return us.createChatCompletion(this._client,t,r)}};go.Messages=as;var
|
|
5041
|
+
_client,t,r)}stream(t,r){return us.createChatCompletion(this._client,t,r)}};go.Messages=as;var ri=class extends ${constructor(){super(...arguments),this.completions=new go(this._client)}};ri.Completions=go;var yc=class extends ${create(t,r){return this._client.post("/organization/admin_api_keys",{body:t,...r,__security:{adminAPIKeyAuth:!0}})}retrieve(t,r){
|
|
5042
5042
|
return this._client.get(R`/organization/admin_api_keys/${t}`,{...r,__security:{adminAPIKeyAuth:!0}})}list(t={},r){return this.
|
|
5043
5043
|
_client.getAPIList("/organization/admin_api_keys",Re,{query:t,...r,__security:{adminAPIKeyAuth:!0}})}delete(t,r){return this.
|
|
5044
5044
|
_client.delete(R`/organization/admin_api_keys/${t}`,{...r,__security:{adminAPIKeyAuth:!0}})}};var _c=class extends ${list(t={},r){return this._client.getAPIList("/organization/audit_logs",Ye,{query:t,...r,__security:{
|
|
@@ -5081,12 +5081,12 @@ xt,{query:r,...n,__security:{adminAPIKeyAuth:!0}})}delete(t,r,n){let{group_id:o}
|
|
|
5081
5081
|
adminAPIKeyAuth:!0}})}retrieve(t,r,n){let{group_id:o}=r;return this._client.get(R`/organization/groups/${o}/users/${t}`,
|
|
5082
5082
|
{...n,__security:{adminAPIKeyAuth:!0}})}list(t,r={},n){return this._client.getAPIList(R`/organization/groups/${t}/users`,
|
|
5083
5083
|
xt,{query:r,...n,__security:{adminAPIKeyAuth:!0}})}delete(t,r,n){let{group_id:o}=r;return this._client.delete(R`/organization/groups/${o}/users/${t}`,
|
|
5084
|
-
{...n,__security:{adminAPIKeyAuth:!0}})}};var
|
|
5084
|
+
{...n,__security:{adminAPIKeyAuth:!0}})}};var ni=class extends ${constructor(){super(...arguments),this.users=new Rc(this._client),this.roles=new Cc(this._client)}create(t,r){
|
|
5085
5085
|
return this._client.post("/organization/groups",{body:t,...r,__security:{adminAPIKeyAuth:!0}})}retrieve(t,r){return this.
|
|
5086
5086
|
_client.get(R`/organization/groups/${t}`,{...r,__security:{adminAPIKeyAuth:!0}})}update(t,r,n){return this._client.post(
|
|
5087
5087
|
R`/organization/groups/${t}`,{body:r,...n,__security:{adminAPIKeyAuth:!0}})}list(t={},r){return this._client.getAPIList(
|
|
5088
5088
|
"/organization/groups",xt,{query:t,...r,__security:{adminAPIKeyAuth:!0}})}delete(t,r){return this._client.delete(R`/organization/groups/${t}`,
|
|
5089
|
-
{...r,__security:{adminAPIKeyAuth:!0}})}};
|
|
5089
|
+
{...r,__security:{adminAPIKeyAuth:!0}})}};ni.Users=Rc;ni.Roles=Cc;var Oc=class extends ${retrieve(t,r,n){let{project_id:o}=r;return this._client.get(R`/organization/projects/${o}/api_keys/${t}`,
|
|
5090
5090
|
{...n,__security:{adminAPIKeyAuth:!0}})}list(t,r={},n){return this._client.getAPIList(R`/organization/projects/${t}/api_keys`,
|
|
5091
5091
|
Ye,{query:r,...n,__security:{adminAPIKeyAuth:!0}})}delete(t,r,n){let{project_id:o}=r;return this._client.delete(R`/organization/projects/${o}/api_keys/${t}`,
|
|
5092
5092
|
{...n,__security:{adminAPIKeyAuth:!0}})}};var Pc=class extends ${list(t,r={},n){return this._client.getAPIList(R`/organization/projects/${t}/certificates`,Ye,{query:r,
|
|
@@ -5158,11 +5158,11 @@ get(R`/organization/users/${t}`,{...r,__security:{adminAPIKeyAuth:!0}})}update(t
|
|
|
5158
5158
|
{body:r,...n,__security:{adminAPIKeyAuth:!0}})}list(t={},r){return this._client.getAPIList("/organization/users",Ye,{query:t,
|
|
5159
5159
|
...r,__security:{adminAPIKeyAuth:!0}})}delete(t,r){return this._client.delete(R`/organization/users/${t}`,{...r,__security:{
|
|
5160
5160
|
adminAPIKeyAuth:!0}})}};fs.Roles=Bc;var Vt=class extends ${constructor(){super(...arguments),this.auditLogs=new _c(this._client),this.adminAPIKeys=new yc(this.
|
|
5161
|
-
_client),this.usage=new Tc(this._client),this.invites=new Sc(this._client),this.users=new fs(this._client),this.groups=new
|
|
5161
|
+
_client),this.usage=new Tc(this._client),this.invites=new Sc(this._client),this.users=new fs(this._client),this.groups=new ni(
|
|
5162
5162
|
this._client),this.roles=new Ac(this._client),this.dataRetention=new Ic(this._client),this.spendLimit=new xc(this._client),
|
|
5163
5163
|
this.spendAlerts=new Ec(this._client),this.certificates=new bc(this._client),this.projects=new qt(this._client)}};Vt.AuditLogs=
|
|
5164
|
-
_c;Vt.AdminAPIKeys=yc;Vt.Usage=Tc;Vt.Invites=Sc;Vt.Users=fs;Vt.Groups=
|
|
5165
|
-
Vt.SpendAlerts=Ec;Vt.Certificates=bc;Vt.Projects=qt;var
|
|
5164
|
+
_c;Vt.AdminAPIKeys=yc;Vt.Usage=Tc;Vt.Invites=Sc;Vt.Users=fs;Vt.Groups=ni;Vt.Roles=Ac;Vt.DataRetention=Ic;Vt.SpendLimit=xc;
|
|
5165
|
+
Vt.SpendAlerts=Ec;Vt.Certificates=bc;Vt.Projects=qt;var oi=class extends ${constructor(){super(...arguments),this.organization=new Vt(this._client)}};oi.Organization=Vt;var qc=class extends ${create(t,r){return this._client.post("/audio/speech",{body:t,...r,headers:J([{Accept:"application\
|
|
5166
5166
|
/octet-stream"},r?.headers]),__security:{bearerAuth:!0},__binaryResponse:!0})}};var Vc=class extends ${create(t,r){return this._client.post("/audio/transcriptions",nr({body:t,...r,stream:t.stream??!1,
|
|
5167
5167
|
__metadata:{model:t.model},__security:{bearerAuth:!0}},this._client))}};var Hc=class extends ${create(t,r){return this._client.post("/audio/translations",nr({body:t,...r,__metadata:{model:t.model},
|
|
5168
5168
|
__security:{bearerAuth:!0}},this._client))}};var Un=class extends ${constructor(){super(...arguments),this.transcriptions=new Vc(this._client),this.translations=new Hc(
|
|
@@ -5177,18 +5177,18 @@ _client.getAPIList("/assistants",Re,{query:t,...r,headers:J([{"OpenAI-Beta":"ass
|
|
|
5177
5177
|
return this._client.delete(R`/assistants/${t}`,{...r,headers:J([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{
|
|
5178
5178
|
bearerAuth:!0}})}};var Wc=class extends ${create(t,r){return this._client.post("/realtime/sessions",{body:t,...r,headers:J([{"OpenAI-Beta":"\
|
|
5179
5179
|
assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}};var Kc=class extends ${create(t,r){return this._client.post("/realtime/transcription_sessions",{body:t,...r,headers:J([{
|
|
5180
|
-
"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}};var
|
|
5181
|
-
this._client)}};
|
|
5180
|
+
"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}};var ii=class extends ${constructor(){super(...arguments),this.sessions=new Wc(this._client),this.transcriptionSessions=new Kc(
|
|
5181
|
+
this._client)}};ii.Sessions=Wc;ii.TranscriptionSessions=Kc;var Jc=class extends ${create(t,r){return this._client.post("/chatkit/sessions",{body:t,...r,headers:J([{"OpenAI-Beta":"\
|
|
5182
5182
|
chatkit_beta=v1"},r?.headers]),__security:{bearerAuth:!0}})}cancel(t,r){return this._client.post(R`/chatkit/sessions/${t}/cancel`,
|
|
5183
5183
|
{...r,headers:J([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers]),__security:{bearerAuth:!0}})}};var Xc=class extends ${retrieve(t,r){return this._client.get(R`/chatkit/threads/${t}`,{...r,headers:J([{"OpenAI-Beta":"c\
|
|
5184
5184
|
hatkit_beta=v1"},r?.headers]),__security:{bearerAuth:!0}})}list(t={},r){return this._client.getAPIList("/chatkit/threads",
|
|
5185
5185
|
Ye,{query:t,...r,headers:J([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers]),__security:{bearerAuth:!0}})}delete(t,r){return this.
|
|
5186
5186
|
_client.delete(R`/chatkit/threads/${t}`,{...r,headers:J([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers]),__security:{bearerAuth:!0}})}listItems(t,r={},n){
|
|
5187
5187
|
return this._client.getAPIList(R`/chatkit/threads/${t}/items`,Ye,{query:r,...n,headers:J([{"OpenAI-Beta":"chatkit_beta=v\
|
|
5188
|
-
1"},n?.headers]),__security:{bearerAuth:!0}})}};var
|
|
5189
|
-
|
|
5188
|
+
1"},n?.headers]),__security:{bearerAuth:!0}})}};var si=class extends ${constructor(){super(...arguments),this.sessions=new Jc(this._client),this.threads=new Xc(this._client)}};
|
|
5189
|
+
si.Sessions=Jc;si.Threads=Xc;var Yc=class extends ${list(t,r={},n){let{betas:o,...i}=r??{};return this._client.getAPIList(R`/responses/${t}/input_items?beta=true`,
|
|
5190
5190
|
Re,{query:i,...n,headers:J([{...o?.toString()!=null?{"openai-beta":o?.toString()}:void 0},n?.headers]),__security:{bearerAuth:!0}})}};var Zc=class extends ${count(t={},r){let{betas:n,...o}=t??{};return this._client.post("/responses/input_tokens?beta=true",
|
|
5191
|
-
{body:o,...r,headers:J([{...n?.toString()!=null?{"openai-beta":n?.toString()}:void 0},r?.headers]),__security:{bearerAuth:!0}})}};var
|
|
5191
|
+
{body:o,...r,headers:J([{...n?.toString()!=null?{"openai-beta":n?.toString()}:void 0},r?.headers]),__security:{bearerAuth:!0}})}};var ai=class extends ${constructor(){super(...arguments),this.inputItems=new Yc(this._client),this.inputTokens=new Zc(this.
|
|
5192
5192
|
_client)}create(t,r){let{betas:n,...o}=t;return this._client.post("/responses?beta=true",{body:o,...r,headers:J([{...n?.
|
|
5193
5193
|
toString()!=null?{"openai-beta":n?.toString()}:void 0},r?.headers]),stream:t.stream??!1,__security:{bearerAuth:!0}})}retrieve(t,r={},n){
|
|
5194
5194
|
let{betas:o,...i}=r??{};return this._client.get(R`/responses/${t}?beta=true`,{query:i,...n,headers:J([{...o?.toString()!=
|
|
@@ -5198,7 +5198,7 @@ null?{"openai-beta":o?.toString()}:void 0},n?.headers]),__security:{bearerAuth:!
|
|
|
5198
5198
|
return this._client.post(R`/responses/${t}/cancel?beta=true`,{...n,headers:J([{...o?.toString()!=null?{"openai-beta":o?.
|
|
5199
5199
|
toString()}:void 0},n?.headers]),__security:{bearerAuth:!0}})}compact(t,r){let{betas:n,...o}=t;return this._client.post(
|
|
5200
5200
|
"/responses/compact?beta=true",{body:o,...r,headers:J([{...n?.toString()!=null?{"openai-beta":n?.toString()}:void 0},r?.
|
|
5201
|
-
headers]),__security:{bearerAuth:!0}})}};
|
|
5201
|
+
headers]),__security:{bearerAuth:!0}})}};ai.InputItems=Yc;ai.InputTokens=Zc;var Qc=class extends ${create(t,r,n){return this._client.post(R`/threads/${t}/messages`,{body:r,...n,headers:J([{"OpenAI\
|
|
5202
5202
|
-Beta":"assistants=v2"},n?.headers]),__security:{bearerAuth:!0}})}retrieve(t,r,n){let{thread_id:o}=r;return this._client.
|
|
5203
5203
|
get(R`/threads/${o}/messages/${t}`,{...n,headers:J([{"OpenAI-Beta":"assistants=v2"},n?.headers]),__security:{bearerAuth:!0}})}update(t,r,n){
|
|
5204
5204
|
let{thread_id:o,...i}=r;return this._client.post(R`/threads/${o}/messages/${t}`,{body:i,...n,headers:J([{"OpenAI-Beta":"\
|
|
@@ -5211,7 +5211,7 @@ n?.headers]),__security:{bearerAuth:!0}})}};var eu=class extends ${retrieve(t,r,
|
|
|
5211
5211
|
stants=v2"},n?.headers]),__security:{bearerAuth:!0}})}};var BM=e=>{if(typeof Buffer<"u"){let t=Buffer.from(e,"base64");return Array.from(new Float32Array(t.buffer,t.byteOffset,
|
|
5212
5212
|
t.length/Float32Array.BYTES_PER_ELEMENT))}else{let t=atob(e),r=t.length,n=new Uint8Array(r);for(let o=0;o<r;o++)n[o]=t.charCodeAt(
|
|
5213
5213
|
o);return Array.from(new Float32Array(n.buffer))}};var mn=e=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[e]?.trim()||void 0;if(typeof globalThis.Deno<
|
|
5214
|
-
"u")return globalThis.Deno.env?.get?.(e)?.trim()||void 0};var Zt,gs,Hb,Fn,hh,hn,ws,tu,hs,vh,Pr,gh,wh,vl,gl,wl,qM,VM,HM,GM,WM,KM,JM,wo=class extends
|
|
5214
|
+
"u")return globalThis.Deno.env?.get?.(e)?.trim()||void 0};var Zt,gs,Hb,Fn,hh,hn,ws,tu,hs,vh,Pr,gh,wh,vl,gl,wl,qM,VM,HM,GM,WM,KM,JM,wo=class extends ei{constructor(){super(...arguments),
|
|
5215
5215
|
Zt.add(this),Hb.set(this,[]),Fn.set(this,{}),hh.set(this,{}),hn.set(this,void 0),ws.set(this,void 0),tu.set(this,void 0),
|
|
5216
5216
|
hs.set(this,void 0),vh.set(this,void 0),Pr.set(this,void 0),gh.set(this,void 0),wh.set(this,void 0),vl.set(this,void 0)}[(Hb=
|
|
5217
5217
|
new WeakMap,Fn=new WeakMap,hh=new WeakMap,hn=new WeakMap,ws=new WeakMap,tu=new WeakMap,hs=new WeakMap,vh=new WeakMap,Pr=
|
|
@@ -5312,7 +5312,7 @@ t,this._client.beta.threads.runs,r,n)}submitToolOutputs(t,r,n){let{thread_id:o,.
|
|
|
5312
5312
|
{body:i,...n,headers:J([{"OpenAI-Beta":"assistants=v2"},n?.headers]),stream:r.stream??!1,__synthesizeEventData:!0,__security:{
|
|
5313
5313
|
bearerAuth:!0}})}async submitToolOutputsAndPoll(t,r,n){let o=await this.submitToolOutputs(t,r,n);return await this.poll(
|
|
5314
5314
|
o.id,r,n)}submitToolOutputsStream(t,r,n){return wo.createToolAssistantStream(t,this._client.beta.threads.runs,r,n)}};vs.
|
|
5315
|
-
Steps=eu;var
|
|
5315
|
+
Steps=eu;var ci=class extends ${constructor(){super(...arguments),this.runs=new vs(this._client),this.messages=new Qc(this._client)}create(t={},r){
|
|
5316
5316
|
return this._client.post("/threads",{body:t,...r,headers:J([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}retrieve(t,r){
|
|
5317
5317
|
return this._client.get(R`/threads/${t}`,{...r,headers:J([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}update(t,r,n){
|
|
5318
5318
|
return this._client.post(R`/threads/${t}`,{body:r,...n,headers:J([{"OpenAI-Beta":"assistants=v2"},n?.headers]),__security:{
|
|
@@ -5320,27 +5320,27 @@ bearerAuth:!0}})}delete(t,r){return this._client.delete(R`/threads/${t}`,{...r,h
|
|
|
5320
5320
|
r?.headers]),__security:{bearerAuth:!0}})}createAndRun(t,r){return this._client.post("/threads/runs",{body:t,...r,headers:J(
|
|
5321
5321
|
[{"OpenAI-Beta":"assistants=v2"},r?.headers]),stream:t.stream??!1,__synthesizeEventData:!0,__security:{bearerAuth:!0}})}async createAndRunPoll(t,r){
|
|
5322
5322
|
let n=await this.createAndRun(t,r);return await this.runs.poll(n.id,{thread_id:n.thread_id},r)}createAndRunStream(t,r){return wo.
|
|
5323
|
-
createThreadAssistantStream(t,this._client.beta.threads,r)}};
|
|
5324
|
-
this.chatkit=new
|
|
5325
|
-
Jr.Responses=
|
|
5323
|
+
createThreadAssistantStream(t,this._client.beta.threads,r)}};ci.Runs=vs;ci.Messages=Qc;var Jr=class extends ${constructor(){super(...arguments),this.realtime=new ii(this._client),this.responses=new ai(this._client),
|
|
5324
|
+
this.chatkit=new si(this._client),this.assistants=new Gc(this._client),this.threads=new ci(this._client)}};Jr.Realtime=ii;
|
|
5325
|
+
Jr.Responses=ai;Jr.ChatKit=si;Jr.Assistants=Gc;Jr.Threads=ci;var ys=class extends ${create(t,r){return this._client.post("/completions",{body:t,...r,stream:t.stream??!1,__security:{
|
|
5326
5326
|
bearerAuth:!0}})}};var ru=class extends ${retrieve(t,r,n){let{container_id:o}=r;return this._client.get(R`/containers/${o}/files/${t}/content`,
|
|
5327
5327
|
{...n,headers:J([{Accept:"application/binary"},n?.headers]),__security:{bearerAuth:!0},__binaryResponse:!0})}};var _s=class extends ${constructor(){super(...arguments),this.content=new ru(this._client)}create(t,r,n){return this._client.
|
|
5328
|
-
post(R`/containers/${t}/files`,
|
|
5328
|
+
post(R`/containers/${t}/files`,Qo({body:r,...n,__security:{bearerAuth:!0}},this._client))}retrieve(t,r,n){let{container_id:o}=r;
|
|
5329
5329
|
return this._client.get(R`/containers/${o}/files/${t}`,{...n,__security:{bearerAuth:!0}})}list(t,r={},n){return this._client.
|
|
5330
5330
|
getAPIList(R`/containers/${t}/files`,Re,{query:r,...n,__security:{bearerAuth:!0}})}delete(t,r,n){let{container_id:o}=r;return this.
|
|
5331
5331
|
_client.delete(R`/containers/${o}/files/${t}`,{...n,headers:J([{Accept:"*/*"},n?.headers]),__security:{bearerAuth:!0}})}};
|
|
5332
|
-
_s.Content=ru;var
|
|
5332
|
+
_s.Content=ru;var ui=class extends ${constructor(){super(...arguments),this.files=new _s(this._client)}create(t,r){return this._client.
|
|
5333
5333
|
post("/containers",{body:t,...r,__security:{bearerAuth:!0}})}retrieve(t,r){return this._client.get(R`/containers/${t}`,{
|
|
5334
5334
|
...r,__security:{bearerAuth:!0}})}list(t={},r){return this._client.getAPIList("/containers",Re,{query:t,...r,__security:{
|
|
5335
5335
|
bearerAuth:!0}})}delete(t,r){return this._client.delete(R`/containers/${t}`,{...r,headers:J([{Accept:"*/*"},r?.headers]),
|
|
5336
|
-
__security:{bearerAuth:!0}})}};
|
|
5336
|
+
__security:{bearerAuth:!0}})}};ui.Files=_s;var nu=class extends ${create(t,r,n){let{include:o,...i}=r;return this._client.post(R`/conversations/${t}/items`,{query:{
|
|
5337
5337
|
include:o},body:i,...n,__security:{bearerAuth:!0}})}retrieve(t,r,n){let{conversation_id:o,...i}=r;return this._client.get(
|
|
5338
5338
|
R`/conversations/${o}/items/${t}`,{query:i,...n,__security:{bearerAuth:!0}})}list(t,r={},n){return this._client.getAPIList(
|
|
5339
5339
|
R`/conversations/${t}/items`,Ye,{query:r,...n,__security:{bearerAuth:!0}})}delete(t,r,n){let{conversation_id:o}=r;return this.
|
|
5340
|
-
_client.delete(R`/conversations/${o}/items/${t}`,{...n,__security:{bearerAuth:!0}})}};var
|
|
5340
|
+
_client.delete(R`/conversations/${o}/items/${t}`,{...n,__security:{bearerAuth:!0}})}};var di=class extends ${constructor(){super(...arguments),this.items=new nu(this._client)}create(t={},r){return this._client.
|
|
5341
5341
|
post("/conversations",{body:t,...r,__security:{bearerAuth:!0}})}retrieve(t,r){return this._client.get(R`/conversations/${t}`,
|
|
5342
5342
|
{...r,__security:{bearerAuth:!0}})}update(t,r,n){return this._client.post(R`/conversations/${t}`,{body:r,...n,__security:{
|
|
5343
|
-
bearerAuth:!0}})}delete(t,r){return this._client.delete(R`/conversations/${t}`,{...r,__security:{bearerAuth:!0}})}};
|
|
5343
|
+
bearerAuth:!0}})}delete(t,r){return this._client.delete(R`/conversations/${t}`,{...r,__security:{bearerAuth:!0}})}};di.Items=
|
|
5344
5344
|
nu;var bs=class extends ${create(t,r){let n=!!t.encoding_format,o=n?t.encoding_format:"base64";n&&St(this._client).debug("e\
|
|
5345
5345
|
mbeddings/user defined encoding_format:",t.encoding_format);let i=this._client.post("/embeddings",{body:{...t,encoding_format:o},
|
|
5346
5346
|
...r,__security:{bearerAuth:!0}});return n?i:(St(this._client).debug("embeddings/decoding base64 embeddings from base64"),
|
|
@@ -5351,17 +5351,17 @@ _client.post(R`/evals/${t}/runs`,{body:r,...n,__security:{bearerAuth:!0}})}retri
|
|
|
5351
5351
|
_client.get(R`/evals/${o}/runs/${t}`,{...n,__security:{bearerAuth:!0}})}list(t,r={},n){return this._client.getAPIList(R`/evals/${t}/runs`,
|
|
5352
5352
|
Re,{query:r,...n,__security:{bearerAuth:!0}})}delete(t,r,n){let{eval_id:o}=r;return this._client.delete(R`/evals/${o}/runs/${t}`,
|
|
5353
5353
|
{...n,__security:{bearerAuth:!0}})}cancel(t,r,n){let{eval_id:o}=r;return this._client.post(R`/evals/${o}/runs/${t}`,{...n,
|
|
5354
|
-
__security:{bearerAuth:!0}})}};Is.OutputItems=ou;var
|
|
5354
|
+
__security:{bearerAuth:!0}})}};Is.OutputItems=ou;var li=class extends ${constructor(){super(...arguments),this.runs=new Is(this._client)}create(t,r){return this._client.
|
|
5355
5355
|
post("/evals",{body:t,...r,__security:{bearerAuth:!0}})}retrieve(t,r){return this._client.get(R`/evals/${t}`,{...r,__security:{
|
|
5356
5356
|
bearerAuth:!0}})}update(t,r,n){return this._client.post(R`/evals/${t}`,{body:r,...n,__security:{bearerAuth:!0}})}list(t={},r){
|
|
5357
5357
|
return this._client.getAPIList("/evals",Re,{query:t,...r,__security:{bearerAuth:!0}})}delete(t,r){return this._client.delete(
|
|
5358
|
-
R`/evals/${t}`,{...r,__security:{bearerAuth:!0}})}};
|
|
5358
|
+
R`/evals/${t}`,{...r,__security:{bearerAuth:!0}})}};li.Runs=Is;var Ss=class extends ${create(t,r){return this._client.post("/files",nr({body:t,...r,__security:{bearerAuth:!0}},this._client))}retrieve(t,r){
|
|
5359
5359
|
return this._client.get(R`/files/${t}`,{...r,__security:{bearerAuth:!0}})}list(t={},r){return this._client.getAPIList("/\
|
|
5360
5360
|
files",Re,{query:t,...r,__security:{bearerAuth:!0}})}delete(t,r){return this._client.delete(R`/files/${t}`,{...r,__security:{
|
|
5361
5361
|
bearerAuth:!0}})}content(t,r){return this._client.get(R`/files/${t}/content`,{...r,headers:J([{Accept:"application/binar\
|
|
5362
5362
|
y"},r?.headers]),__security:{bearerAuth:!0},__binaryResponse:!0})}async waitForProcessing(t,{pollInterval:r=5e3,maxWait:n=1800*
|
|
5363
5363
|
1e3}={}){let o=new Set(["processed","error","deleted"]),i=Date.now(),s=await this.retrieve(t);for(;!s.status||!o.has(s.status);)
|
|
5364
|
-
if(await Dn(r),s=await this.retrieve(t),Date.now()-i>n)throw new
|
|
5364
|
+
if(await Dn(r),s=await this.retrieve(t),Date.now()-i>n)throw new Yo({message:`Giving up on waiting for file ${t} to fini\
|
|
5365
5365
|
sh processing after ${n} milliseconds.`});return s}};var iu=class extends ${};var su=class extends ${run(t,r){return this._client.post("/fine_tuning/alpha/graders/run",{body:t,...r,__security:{bearerAuth:!0}})}validate(t,r){
|
|
5366
5366
|
return this._client.post("/fine_tuning/alpha/graders/validate",{body:t,...r,__security:{bearerAuth:!0}})}};var As=class extends ${constructor(){super(...arguments),this.graders=new su(this._client)}};As.Graders=su;var au=class extends ${create(t,r,n){return this._client.getAPIList(R`/fine_tuning/checkpoints/${t}/permissions`,rr,{body:r,
|
|
5367
5367
|
method:"post",...n,__security:{adminAPIKeyAuth:!0}})}retrieve(t,r={},n){return this._client.get(R`/fine_tuning/checkpoints/${t}/permissions`,
|
|
@@ -5376,7 +5376,7 @@ return this._client.getAPIList(R`/fine_tuning/jobs/${t}/events`,Re,{query:r,...n
|
|
|
5376
5376
|
return this._client.post(R`/fine_tuning/jobs/${t}/pause`,{...r,__security:{bearerAuth:!0}})}resume(t,r){return this._client.
|
|
5377
5377
|
post(R`/fine_tuning/jobs/${t}/resume`,{...r,__security:{bearerAuth:!0}})}};xs.Checkpoints=cu;var gn=class extends ${constructor(){super(...arguments),this.methods=new iu(this._client),this.jobs=new xs(this._client),
|
|
5378
5378
|
this.checkpoints=new Es(this._client),this.alpha=new As(this._client)}};gn.Methods=iu;gn.Jobs=xs;gn.Checkpoints=Es;gn.Alpha=
|
|
5379
|
-
As;var uu=class extends ${};var
|
|
5379
|
+
As;var uu=class extends ${};var pi=class extends ${constructor(){super(...arguments),this.graderModels=new uu(this._client)}};pi.GraderModels=uu;var Ts=class extends ${createVariation(t,r){return this._client.post("/images/variations",nr({body:t,...r,__security:{bearerAuth:!0}},
|
|
5380
5380
|
this._client))}edit(t,r){return this._client.post("/images/edits",nr({body:t,...r,stream:t.stream??!1,__security:{bearerAuth:!0}},
|
|
5381
5381
|
this._client))}generate(t,r){return this._client.post("/images/generations",{body:t,...r,stream:t.stream??!1,__security:{
|
|
5382
5382
|
bearerAuth:!0}})}};var Cs=class extends ${retrieve(t,r){return this._client.get(R`/models/${t}`,{...r,__security:{bearerAuth:!0}})}list(t){
|
|
@@ -5458,17 +5458,17 @@ artial_image":case"response.mcp_list_tools.in_progress":case"response.mcp_list_t
|
|
|
5458
5458
|
ools.failed":case"keepalive":case"error":break;default:_Z(e)}return t}function QM(e){let t=structuredClone(e);return(!Object.
|
|
5459
5459
|
getOwnPropertyDescriptor(t,"output_text")||t.output_text==null)&&kr(t),t}function Je(e,t){let r=e.output[t];if(!r)throw new ee(
|
|
5460
5460
|
`missing output at index ${t}`);return r}function Xr(e,t){let r=e[t];if(!r)throw new ee(`missing content at index ${t}`);
|
|
5461
|
-
return r}function _Z(e){throw new ee(`Unhandled response stream event: ${JSON.stringify(e)}`)}var
|
|
5461
|
+
return r}function _Z(e){throw new ee(`Unhandled response stream event: ${JSON.stringify(e)}`)}var fi,yh,Os,_h,Wb,Kb,Jb,bh=class e extends ei{constructor(t){super(),fi.add(this),yh.set(this,void 0),Os.set(this,void 0),
|
|
5462
5462
|
_h.set(this,void 0),be(this,yh,t,"f")}static createResponse(t,r,n){let o=new e(r);return o._run(()=>o._createOrRetrieveResponse(
|
|
5463
5463
|
t,r,{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}static fromReadableStream(t){let r=new e(null);
|
|
5464
5464
|
return r._run(()=>r._fromReadableStream(t)),r}async _createOrRetrieveResponse(t,r,n){this._listenForAbort(n?.signal),D(this,
|
|
5465
|
-
|
|
5465
|
+
fi,"m",Wb).call(this);let o,i=null;"response_id"in r?(o=await t.responses.retrieve(r.response_id,{stream:!0},{...n,signal:this.
|
|
5466
5466
|
controller.signal,stream:!0}),i=r.starting_after??null):o=await t.responses.create({...r,stream:!0},{...n,signal:this.controller.
|
|
5467
|
-
signal}),this._connected();for await(let s of o)D(this,
|
|
5468
|
-
return D(this,
|
|
5469
|
-
this),this._connected();let n=gr.fromReadableStream(t,this.controller);for await(let o of n)D(this,
|
|
5470
|
-
o,null);if(n.controller.signal?.aborted)throw new It;return D(this,
|
|
5471
|
-
_h=new WeakMap,
|
|
5467
|
+
signal}),this._connected();for await(let s of o)D(this,fi,"m",Kb).call(this,s,i);if(o.controller.signal?.aborted)throw new It;
|
|
5468
|
+
return D(this,fi,"m",Jb).call(this)}async _fromReadableStream(t,r){this._listenForAbort(r?.signal),D(this,fi,"m",Wb).call(
|
|
5469
|
+
this),this._connected();let n=gr.fromReadableStream(t,this.controller);for await(let o of n)D(this,fi,"m",Kb).call(this,
|
|
5470
|
+
o,null);if(n.controller.signal?.aborted)throw new It;return D(this,fi,"m",Jb).call(this)}[(yh=new WeakMap,Os=new WeakMap,
|
|
5471
|
+
_h=new WeakMap,fi=new WeakSet,Wb=function(){this.ended||be(this,Os,void 0,"f")},Kb=function(r,n){if(this.ended)return;let o=(s,a)=>{
|
|
5472
5472
|
(n==null||a.sequence_number>n)&&this._emit(s,a)},i=e$(r,D(this,Os,"f"));switch(be(this,Os,i,"f"),o("event",r),r.type){case"\
|
|
5473
5473
|
response.output_text.delta":{let s=i.output[r.output_index];if(!s)throw new ee(`missing output at index ${r.output_index}`);
|
|
5474
5474
|
if(s.type==="message"){let a=s.content[r.content_index];if(!a)throw new ee(`missing content at index ${r.content_index}`);
|
|
@@ -5495,18 +5495,18 @@ return this._client.post("/responses/compact",{body:t,...r,__security:{bearerAut
|
|
|
5495
5495
|
fu;var mu=class extends ${retrieve(t,r){return this._client.get(R`/skills/${t}/content`,{...r,headers:J([{Accept:"applicati\
|
|
5496
5496
|
on/binary"},r?.headers]),__security:{bearerAuth:!0},__binaryResponse:!0})}};var hu=class extends ${retrieve(t,r,n){let{skill_id:o}=r;return this._client.get(R`/skills/${o}/versions/${t}/content`,{
|
|
5497
5497
|
...n,headers:J([{Accept:"application/binary"},n?.headers]),__security:{bearerAuth:!0},__binaryResponse:!0})}};var Ps=class extends ${constructor(){super(...arguments),this.content=new hu(this._client)}create(t,r={},n){return this.
|
|
5498
|
-
_client.post(R`/skills/${t}/versions`,
|
|
5498
|
+
_client.post(R`/skills/${t}/versions`,Qo({body:r,...n,__security:{bearerAuth:!0}},this._client))}retrieve(t,r,n){let{skill_id:o}=r;
|
|
5499
5499
|
return this._client.get(R`/skills/${o}/versions/${t}`,{...n,__security:{bearerAuth:!0}})}list(t,r={},n){return this._client.
|
|
5500
5500
|
getAPIList(R`/skills/${t}/versions`,Re,{query:r,...n,__security:{bearerAuth:!0}})}delete(t,r,n){let{skill_id:o}=r;return this.
|
|
5501
5501
|
_client.delete(R`/skills/${o}/versions/${t}`,{...n,__security:{bearerAuth:!0}})}};Ps.Content=hu;var yo=class extends ${constructor(){super(...arguments),this.content=new mu(this._client),this.versions=new Ps(this._client)}create(t={},r){
|
|
5502
|
-
return this._client.post("/skills",
|
|
5502
|
+
return this._client.post("/skills",Qo({body:t,...r,__security:{bearerAuth:!0}},this._client))}retrieve(t,r){return this.
|
|
5503
5503
|
_client.get(R`/skills/${t}`,{...r,__security:{bearerAuth:!0}})}update(t,r,n){return this._client.post(R`/skills/${t}`,{body:r,
|
|
5504
5504
|
...n,__security:{bearerAuth:!0}})}list(t={},r){return this._client.getAPIList("/skills",Re,{query:t,...r,__security:{bearerAuth:!0}})}delete(t,r){
|
|
5505
5505
|
return this._client.delete(R`/skills/${t}`,{...r,__security:{bearerAuth:!0}})}};yo.Content=mu;yo.Versions=Ps;var gu=class extends ${create(t,r,n){return this._client.post(R`/uploads/${t}/parts`,nr({body:r,...n,__security:{bearerAuth:!0}},
|
|
5506
|
-
this._client))}};var
|
|
5506
|
+
this._client))}};var mi=class extends ${constructor(){super(...arguments),this.parts=new gu(this._client)}create(t,r){return this._client.
|
|
5507
5507
|
post("/uploads",{body:t,...r,__security:{bearerAuth:!0}})}cancel(t,r){return this._client.post(R`/uploads/${t}/cancel`,{
|
|
5508
5508
|
...r,__security:{bearerAuth:!0}})}complete(t,r,n){return this._client.post(R`/uploads/${t}/complete`,{body:r,...n,__security:{
|
|
5509
|
-
bearerAuth:!0}})}};
|
|
5509
|
+
bearerAuth:!0}})}};mi.Parts=gu;var t$=async e=>{let t=await Promise.allSettled(e),r=t.filter(o=>o.status==="rejected");if(r.length){for(let o of r)console.
|
|
5510
5510
|
error(o.reason);throw new Error(`${r.length} promise(s) failed - see the above errors`)}let n=[];for(let o of t)o.status===
|
|
5511
5511
|
"fulfilled"&&n.push(o.value);return n};var wu=class extends ${create(t,r,n){return this._client.post(R`/vector_stores/${t}/file_batches`,{body:r,...n,headers:J(
|
|
5512
5512
|
[{"OpenAI-Beta":"assistants=v2"},n?.headers]),__security:{bearerAuth:!0}})}retrieve(t,r,n){let{vector_store_id:o}=r;return this.
|
|
@@ -5554,7 +5554,7 @@ this._client))}downloadContent(t,r={},n){return this._client.get(R`/videos/${t}/
|
|
|
5554
5554
|
application/binary"},n?.headers]),__security:{bearerAuth:!0},__binaryResponse:!0})}edit(t,r){return this._client.post("/\
|
|
5555
5555
|
videos/edits",nr({body:t,...r,__security:{bearerAuth:!0}},this._client))}extend(t,r){return this._client.post("/videos/e\
|
|
5556
5556
|
xtensions",nr({body:t,...r,__security:{bearerAuth:!0}},this._client))}getCharacter(t,r){return this._client.get(R`/videos/characters/${t}`,
|
|
5557
|
-
{...r,__security:{bearerAuth:!0}})}remix(t,r,n){return this._client.post(R`/videos/${t}/remix`,
|
|
5557
|
+
{...r,__security:{bearerAuth:!0}})}remix(t,r,n){return this._client.post(R`/videos/${t}/remix`,Qo({body:r,...n,__security:{
|
|
5558
5558
|
bearerAuth:!0}},this._client))}};var yu,r$,Ih,Ns=class extends ${constructor(){super(...arguments),yu.add(this)}async unwrap(t,r,n=this._client.webhookSecret,o=300){
|
|
5559
5559
|
return await this.verifySignature(t,r,n,o),JSON.parse(t)}async verifySignature(t,r,n=this._client.webhookSecret,o=300){if(typeof crypto>
|
|
5560
5560
|
"u"||typeof crypto.subtle.importKey!="function"||typeof crypto.subtle.verify!="function")throw new Error("Webhook signat\
|
|
@@ -5572,11 +5572,11 @@ or passed to this function")},Ih=function(t,r){if(!t)throw new Error("Headers ar
|
|
|
5572
5572
|
`Missing required header: ${r}`);return n};var o$=Symbol.for("openai.node.providerDefinitions.v1"),i$=globalThis,s$=i$[o$],a$=s$??new WeakMap;s$||Object.defineProperty(
|
|
5573
5573
|
i$,o$,{value:a$});function c$(e){let t=a$.get(e);if(!t)throw new Error("Invalid provider. Providers must be created with createProvider().");
|
|
5574
5574
|
return t.configure()}var Xb,Yb,yl,u$,OZ="workload-identity-auth",Oe=class{constructor(t={}){Xb.add(this),yl.set(this,void 0),this.completions=
|
|
5575
|
-
new ys(this),this.chat=new
|
|
5576
|
-
new Un(this),this.moderations=new Rs(this),this.models=new Cs(this),this.fineTuning=new gn(this),this.graders=new
|
|
5575
|
+
new ys(this),this.chat=new ri(this),this.embeddings=new bs(this),this.files=new Ss(this),this.images=new Ts(this),this.audio=
|
|
5576
|
+
new Un(this),this.moderations=new Rs(this),this.models=new Cs(this),this.fineTuning=new gn(this),this.graders=new pi(this),
|
|
5577
5577
|
this.vectorStores=new _o(this),this.webhooks=new Ns(this),this.beta=new Jr(this),this.batches=new ms(this),this.uploads=
|
|
5578
|
-
new
|
|
5579
|
-
this.evals=new
|
|
5578
|
+
new mi(this),this.admin=new oi(this),this.responses=new Bn(this),this.realtime=new vo(this),this.conversations=new di(this),
|
|
5579
|
+
this.evals=new li(this),this.containers=new ui(this),this.skills=new yo(this),this.videos=new ks(this);let r=t.provider;
|
|
5580
5580
|
if(r){let g=["apiKey","adminAPIKey","workloadIdentity","baseURL"].filter(y=>t[y]!=null);if(g.length)throw new ee(`The \`p\
|
|
5581
5581
|
rovider\` option cannot be used with ${g.map(y=>`\`${y}\``).join(", ")}. Configure authentication and the base URL throu\
|
|
5582
5582
|
gh the provider instead.`)}let{baseURL:n=r?null:mn("OPENAI_BASE_URL"),apiKey:o=r?null:mn("OPENAI_API_KEY")??null,adminAPIKey:i=r?
|
|
@@ -5614,8 +5614,8 @@ n" or "api-key" headers to be explicitly omitted')}async authHeaders(t,r={bearer
|
|
|
5614
5614
|
bearerAuth?await this.bearerAuth(t):null,r.adminAPIKeyAuth?await this.adminAPIKeyAuth(t):null])}async bearerAuth(t){if(this.
|
|
5615
5615
|
_workloadIdentityAuth)return J([{Authorization:`Bearer ${await this._workloadIdentityAuth.getToken()}`}]);if(this.apiKey!=
|
|
5616
5616
|
null)return J([{Authorization:`Bearer ${this.apiKey}`}])}async adminAPIKeyAuth(t){if(this.adminAPIKey!=null)return J([{Authorization:`\
|
|
5617
|
-
Bearer ${this.adminAPIKey}`}])}stringifyQuery(t){return wM(t)}getUserAgent(){return`${this.constructor.name}/JS ${
|
|
5618
|
-
return`stainless-node-retry-${ns()}`}makeStatusError(t,r,n,o){return
|
|
5617
|
+
Bearer ${this.adminAPIKey}`}])}stringifyQuery(t){return wM(t)}getUserAgent(){return`${this.constructor.name}/JS ${Zo}`}defaultIdempotencyKey(){
|
|
5618
|
+
return`stainless-node-retry-${ns()}`}makeStatusError(t,r,n,o){return yt.generate(t,r,n,o)}async _callApiKey(){if(this._provider)
|
|
5619
5619
|
return!1;let t=this._options.apiKey;if(typeof t!="function")return!1;let r;try{r=await t()}catch(n){throw n instanceof ee?
|
|
5620
5620
|
n:new ee(`Failed to get token from 'apiKey' function: ${n.message}`,{cause:n})}if(typeof r!="string"||!r)throw new ee(`E\
|
|
5621
5621
|
xpected 'apiKey' function argument to return a string but it returned ${r}`);return this.apiKey=r,!0}buildURL(t,r,n){let o=!D(
|
|
@@ -5638,7 +5638,7 @@ d"} - ${_}`),St(this).debug(`[${d}] connection ${I?"timed out":"failed"} (${_})`
|
|
|
5638
5638
|
p,message:g.message})),this.retryRequest(o,r,n??d);let E=u?"error; streaming body cannot be retried":"error; no more ret\
|
|
5639
5639
|
ries left";throw St(this).info(`[${d}] connection ${I?"timed out":"failed"} - ${E}`),St(this).debug(`[${d}] connection ${I?
|
|
5640
5640
|
"timed out":"failed"} (${E})`,po({retryOfRequestLogID:n,url:a,durationMs:y-p,message:g.message})),g instanceof os||g instanceof
|
|
5641
|
-
Xd?g:I?new
|
|
5641
|
+
Xd?g:I?new Yo:new Xo({message:PZ(g),cause:g})}let m=[...g.headers.entries()].filter(([_])=>_==="x-request-id").map(([_,I])=>"\
|
|
5642
5642
|
, "+_+": "+JSON.stringify(I)).join(""),h=`[${d}${l}${m}] ${s.method} ${a} ${g.ok?"succeeded":"failed"} with status ${g.status}\
|
|
5643
5643
|
in ${y-p}ms`;if(!g.ok){if(g.status===401&&this._workloadIdentityAuth&&f.bearerAuth&&!o.__metadata?.hasStreamingBody&&!o.
|
|
5644
5644
|
__metadata?.workloadIdentityTokenRefreshed)return await db(g.body),this._workloadIdentityAuth.invalidateToken(),this.makeRequest(
|
|
@@ -5685,12 +5685,12 @@ t"in r&&typeof r.next=="function")?{bodyHeaders:void 0,body:Zd(r),isStreamingBod
|
|
|
5685
5685
|
content-type")==="application/x-www-form-urlencoded"?{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.
|
|
5686
5686
|
stringifyQuery(r),isStreamingBody:!1}:{...D(this,yl,"f").call(this,{body:r,headers:o}),isStreamingBody:!1}}};Yb=Oe,yl=new WeakMap,
|
|
5687
5687
|
Xb=new WeakSet,u$=function(){return this._provider!==void 0||this.baseURL!=="https://api.openai.com/v1"};Oe.OpenAI=Yb;Oe.
|
|
5688
|
-
DEFAULT_TIMEOUT=6e5;Oe.OpenAIError=ee;Oe.APIError=
|
|
5688
|
+
DEFAULT_TIMEOUT=6e5;Oe.OpenAIError=ee;Oe.APIError=yt;Oe.APIConnectionError=Xo;Oe.APIConnectionTimeoutError=Yo;Oe.APIUserAbortError=
|
|
5689
5689
|
It;Oe.NotFoundError=oc;Oe.ConflictError=ic;Oe.RateLimitError=ac;Oe.BadRequestError=tc;Oe.AuthenticationError=rc;Oe.InternalServerError=
|
|
5690
5690
|
cc;Oe.PermissionDeniedError=nc;Oe.UnprocessableEntityError=sc;Oe.InvalidWebhookSignatureError=Ln;Oe.toFile=sh;Oe.toStreamingFile=
|
|
5691
|
-
oh;Oe.Completions=ys;Oe.Chat=
|
|
5692
|
-
FineTuning=gn;Oe.Graders=
|
|
5693
|
-
Bn;Oe.Realtime=vo;Oe.Conversations=
|
|
5691
|
+
oh;Oe.Completions=ys;Oe.Chat=ri;Oe.Embeddings=bs;Oe.Files=Ss;Oe.Images=Ts;Oe.Audio=Un;Oe.Moderations=Rs;Oe.Models=Cs;Oe.
|
|
5692
|
+
FineTuning=gn;Oe.Graders=pi;Oe.VectorStores=_o;Oe.Webhooks=Ns;Oe.Beta=Jr;Oe.Batches=ms;Oe.Uploads=mi;Oe.Admin=oi;Oe.Responses=
|
|
5693
|
+
Bn;Oe.Realtime=vo;Oe.Conversations=di;Oe.Evals=li;Oe.Containers=ui;Oe.Skills=yo;Oe.Videos=ks;function PZ(e){if(kZ(e))return"\
|
|
5694
5694
|
Connection error. This may be caused by passing an undici dispatcher, such as ProxyAgent, that is incompatible with the \
|
|
5695
5695
|
fetch implementation. If you are using undici's ProxyAgent, pass the fetch implementation from the same undici package: \
|
|
5696
5696
|
import { fetch, ProxyAgent } from 'undici'; new OpenAI({ fetch, fetchOptions: { dispatcher: new ProxyAgent(...) } });"}function kZ(e){
|
|
@@ -5876,7 +5876,7 @@ systemPrompt:_=_u})=>{let I=m.schemaVersion===1?m:m.retiredConversation;if(!I||!
|
|
|
5876
5876
|
assistantSelection.engineId;if(i&&(E!=="codex"||m.schemaVersion!==3))return null;let C=E==="claude"?"Claude":E==="codex"?
|
|
5877
5877
|
"Codex":"OpenCode";if(m.conversationMetadata?.runtime||m.previousConversations?.length||m.freshOperation)return null;let T=he=>{
|
|
5878
5878
|
throw new Error(`${v}: ${he} No native work or history was changed.`)};(!(E!=="opencode"?Ah:/^ses_[a-zA-Z0-9_]{1,256}$/u).
|
|
5879
|
-
test(I.conversationId||"")||!I.runId||!
|
|
5879
|
+
test(I.conversationId||"")||!I.runId||!hi(m.assistantSelection,I.assistantSelection)||m.status==="working"||m.operation||
|
|
5880
5880
|
I.operation||["request","replacement","rewind","continuity"].some(he=>Object.hasOwn(m.conversationMetadata||{},he)))&&T(
|
|
5881
5881
|
`The retired ${C} binding has changed selection or unfinished/unsupported state. Inspect its original receipts before re\
|
|
5882
5882
|
trying.`),u.get(nI(E,I.conversationId))?.size!==1&&T(`The native ${C} identity is claimed by another Colleague scope. Re\
|
|
@@ -5893,8 +5893,8 @@ nal Codex request.");let We=I.assistantSelection.modelProviderId,Gt=sb({env:o,ho
|
|
|
5893
5893
|
openai"?{}:await wg({systemRoot:e}).runtimeOptions(We),Mt=We==="openai"?Gt:sb({env:o,home:o.HOME||Sh(),systemRoot:e,providerOptions:Ze});
|
|
5894
5894
|
(Gt.ok!==!0||Mt.ok!==!0)&&T("The original Codex credential home could not be resolved. Restore the original daemon confi\
|
|
5895
5895
|
guration.");let bi=Ge.join(Gt.toolHomeSource,".codex"),yn=Ge.join(Mt.toolHomeSource,".codex"),ir=Mt.env.CODEX_SQLITE_HOME||
|
|
5896
|
-
yn;Ge.isAbsolute(ir)||T("The original native SQLite home is not an absolute trusted path.");let
|
|
5897
|
-
qlite");await we(ir,
|
|
5896
|
+
yn;Ge.isAbsolute(ir)||T("The original native SQLite home is not an absolute trusted path.");let Eo=Ge.join(ir,"goals_1.s\
|
|
5897
|
+
qlite");await we(ir,Eo);let Mr=await Kf(Eo,{threadId:I.conversationId});Mr!==null&&!["paused","complete"].includes(Mr.status)&&
|
|
5898
5898
|
T("The original native Codex goal is not paused or complete. Resolve it through its original owner before retrying.");let $r=[];
|
|
5899
5899
|
for await(let _t of GZ([`sessions/*/*/*/rollout-*-${I.conversationId}.jsonl*`,`archived_sessions/rollout-*-${I.conversationId}\
|
|
5900
5900
|
.jsonl*`],{cwd:yn}))$r.push(Ge.join(yn,_t));($r.length!==1||!$r[0].endsWith(".jsonl"))&&T("The original native Codex rol\
|
|
@@ -5934,7 +5934,7 @@ at(-1)?.text!==he.text))&&T("The original Codex history does not prove the exact
|
|
|
5934
5934
|
newer native work.");let Fs;try{Fs=za(zs)}catch{T("The original native Codex final answer is not a complete Colleague re\
|
|
5935
5935
|
sponse.")}return(Fs.kind!=="reply"||Fs.text!==V)&&T("The original native Codex answer differs from its written product r\
|
|
5936
5936
|
eply."),ue({threadId:I.conversationId,workdir:M,configRoot:bi,executionId:"",processInstanceId:"",toolSchemaIdentity:y$},
|
|
5937
|
-
async()=>{let _t=await bu(Me);(["dev","ino","size","mtimeMs","ctimeMs"].some(Be=>$t[Be]!==_t[Be])||!
|
|
5937
|
+
async()=>{let _t=await bu(Me);(["dev","ino","size","mtimeMs","ctimeMs"].some(Be=>$t[Be]!==_t[Be])||!hi(await Kf(Eo,{threadId:I.
|
|
5938
5938
|
conversationId}),Mr))&&T("The original Codex history or goal changed during inspection. Keep its writers stopped before \
|
|
5939
5939
|
retrying.")})}if(E==="opencode"){/^msg_[a-zA-Z0-9_]{1,256}$/u.test(I.runId)||T("The last written product turn does not i\
|
|
5940
5940
|
dentify a completed original OpenCode request.");let he=mP({systemRoot:e,env:o}),We=Ge.join(he,"opencode","opencode.db");
|
|
@@ -5946,8 +5946,8 @@ let Me=j.messages.find(Ls=>Ls.role==="user"),$t=bi?.userMessages?.at(-1);(ir?.au
|
|
|
5946
5946
|
ean"||!Array.isArray(ir.userMessages)||!Me||$t?.messageId!==Me.messageId||$t?.text!==Me.text)&&T("The original OpenCode \
|
|
5947
5947
|
input does not match the last authored product request.")}Y&&(ir?.autonomous!==!0||typeof ir.readOnly!="boolean"||!Array.
|
|
5948
5948
|
isArray(ir.userMessages)||ir.userMessages.length||!Array.isArray(ir.observations)||!ir.observations.length)&&T("The orig\
|
|
5949
|
-
inal OpenCode update does not match its watched-conversation input.");let
|
|
5950
|
-
"assistant"||
|
|
5949
|
+
inal OpenCode update does not match its watched-conversation input.");let Eo=Rd(Ze,I.runId),Mr=bm(Eo);(Ze.at(-1)?.type!==
|
|
5950
|
+
"assistant"||Eo.at(-1)!==Ze.at(-1)||Mr.error||Mr.message?.summary||!(Mr.message?.time?.completed||Mr.message?.finish)||Mr.
|
|
5951
5951
|
message?.finish==="tool-calls")&&T("Native OpenCode history has newer or unconfirmed work, or no final answer for the or\
|
|
5952
5952
|
iginal request.");let $r;try{$r=za(Cd(Mr.text))}catch{T("The original native OpenCode answer is not a complete Colleague\
|
|
5953
5953
|
response.")}return($r.kind!=="reply"||$r.text!==V)&&T("The original native OpenCode answer differs from its written pro\
|
|
@@ -5972,7 +5972,7 @@ Vl(ut,We,Ze.baseUrl,Ze.apiKey)}return he},B=await fe();B.anthropic&&(K.accountId
|
|
|
5972
5972
|
Object.entries(B).filter(([he])=>he!=="anthropic"));Object.keys(H).length&&(K.connectionIdentities=H),(await mm({configRoot:ut,
|
|
5973
5973
|
binding:K})).some(he=>he.conversationId===K.conversationId)||T("The original native history is missing or not a regular \
|
|
5974
5974
|
file.");let le=await hm(K);le||T("The original active native transcript is missing."),await we(ut,le.path);let ve=await bu(
|
|
5975
|
-
le.path);ve.isFile()||T("The original active native transcript must be a regular file.");let Ie=await
|
|
5975
|
+
le.path);ve.isFile()||T("The original active native transcript must be a regular file.");let Ie=await qo({...K,allowIncompleteTail:!1,
|
|
5976
5976
|
includeUserMessages:!0,includeFinalCarriers:!0});(!Ie.exists||Ie.userIds.at(-1)!==ae.lastMessageId||Ie.goal?.status==="a\
|
|
5977
5977
|
ctive"||Ie.failedResults.some(he=>he.userId===ae.lastMessageId))&&T("Native history has a newer/unconfirmed request, act\
|
|
5978
5978
|
ive goal or no final answer for the exact stopped turn. Inspect it before retrying.");let Ae=null,He=null;for(let he of Ie.
|
|
@@ -5987,7 +5987,7 @@ filter(he=>he.role==="assistant"&&he.userId===ae.lastMessageId&&he.text.trim()),
|
|
|
5987
5987
|
slice(-1);Qt.length||T("The original native Claude history has no final carrier for its stopped completed receipt.");for(let he of Qt){
|
|
5988
5988
|
let We;try{We=za(he.text)}catch{T("The original native Claude answer is not a complete Colleague response.")}(We.kind!==
|
|
5989
5989
|
"reply"||We.text!==V)&&T("The original native Claude answer differs from its written product reply.")}return ue(K,async()=>{
|
|
5990
|
-
|
|
5990
|
+
hi(await fe(),B)||T("A retained Claude provider key changed during inspection. Stop its writers before retrying.");let he=await bu(
|
|
5991
5991
|
le.path);(!he.isFile()||["dev","ino","size","mtimeMs","ctimeMs"].some(We=>ve[We]!==he[We])||await Te(Z)!==_e)&&T("Native\
|
|
5992
5992
|
history or its receipt changed during inspection. Stop all writers before retrying.")})};await we(e,Ge.join(r,"manifest\
|
|
5993
5993
|
.json"));let p=await Te(Ge.join(r,"manifest.json")),f=null;if(p!==null){await ke({systemRoot:e,backupRoot:r,apply:!1,report:n,
|
|
@@ -5998,7 +5998,7 @@ let I=or(await Te(Ge.join(r,"after",g.path)),"Prepared Colleague history");pt(I,
|
|
|
5998
5998
|
conversationLog:I.conversationLog});let E=I.conversationMetadata.runtime.configuration.systemPrompt;if(E!==""&&E!==_u)throw new Error(
|
|
5999
5999
|
"The prepared Colleague instructions are unsupported. Inspect the verified backup before retrying.");let C=await l({...m,
|
|
6000
6000
|
saved:_,original:h,segmentId:I.conversationMetadata.runtime.segmentId,systemPrompt:E});if(!C)throw new Error("The native\
|
|
6001
|
-
-continuity backup is not an eligible original conversation. Inspect it before retrying.");if(!
|
|
6001
|
+
-continuity backup is not an eligible original conversation. Inspect it before retrying.");if(!hi(or(C.contents,"Reinspe\
|
|
6002
6002
|
cted Colleague history"),I))throw new Error("The prepared native binding differs from its current original evidence. Res\
|
|
6003
6003
|
tore the original daemon configuration and receipts before retrying.");f.push(C)}}if(p!==null)for(let v of f)await v.verify();
|
|
6004
6004
|
await ke({systemRoot:e,apply:t,backupRoot:r,report:n,prepareUpdates:async()=>{f=[];for(let v of c){let g=await l(v);if(g){
|
|
@@ -6037,7 +6037,7 @@ t the original backup before retrying.");for(let l of d.files){let p=s.find(_=>G
|
|
|
6037
6037
|
throw new Error("A backed-up Colleague owner is missing. Restore its original state before retrying.");let f=await Te(Ge.
|
|
6038
6038
|
join(r,"before",l.path)),v=or(f,"Backed-up Colleague history"),g=or(await Te(Ge.join(r,"after",l.path)),"Prepared Collea\
|
|
6039
6039
|
gue history");pt(v,p.ownerKey),pt(g,p.ownerKey);let y=g.conversationMetadata?.runtime,m=y?.predecessors?.at(-1),h=a({...p,
|
|
6040
|
-
saved:v,original:f,operationId:m?.replacement?.operationId,successorSegmentId:y?.segmentId});if(!h||!
|
|
6040
|
+
saved:v,original:f,operationId:m?.replacement?.operationId,successorSegmentId:y?.segmentId});if(!h||!hi(or(h.contents,"R\
|
|
6041
6041
|
einspected Colleague history"),g))throw new Error("The prepared Codex transition differs from its original binding or hi\
|
|
6042
6042
|
story. Inspect the verified backup before retrying.")}}await ke({systemRoot:e,apply:t,backupRoot:r,report:n,prepareUpdates:async()=>{
|
|
6043
6043
|
let d=[];for(let l of s){let p=a(l);p&&(n("warning",`${l.ownerKey}: retire only the known old Codex tool binding and ret\
|
|
@@ -6051,9 +6051,9 @@ d);if(l===null)continue;let p=or(l,"Colleague history");pt(p,u.name),s.push({own
|
|
|
6051
6051
|
let a=({ownerKey:u,filePath:d,original:l,saved:p})=>{let f=p.conversationMetadata?.runtime;if(f?.configuration?.systemPrompt!==
|
|
6052
6052
|
"")return null;let v=I=>{throw new Error(`${u}: ${I} No request, binding or history was changed.`)},g=p.retiredConversation,
|
|
6053
6053
|
y=f.binding,m=f.engine==="codex"?y?.threadId:f.engine==="claude"?y?.conversationId:y?.sessionId;(p.schemaVersion!==3||!Eh(
|
|
6054
|
-
g?.assistantSelection)||!g.runId||!
|
|
6054
|
+
g?.assistantSelection)||!g.runId||!hi(p.assistantSelection,g.assistantSelection)||f.version!==3||f.engine!==p.assistantSelection.
|
|
6055
6055
|
engineId||f.lastEngine!==f.engine||m!==g.conversationId||!m||f.predecessors?.length!==0||p.previousConversations?.length||
|
|
6056
|
-
p.freshOperation||y.executionId!==""||!
|
|
6056
|
+
p.freshOperation||y.executionId!==""||!hi(f.configuration,tI(p.assistantSelection,"").configuration))&&v("The empty conf\
|
|
6057
6057
|
iguration is not the known unchanged imported native binding. Inspect its original conversion before retrying."),(p.status===
|
|
6058
6058
|
"working"||p.operation&&!["completed","complete","failed","cancelled","not-executed"].includes(p.operation.status)||g.operation||
|
|
6059
6059
|
["request","replacement","rewind","continuity"].some(I=>Object.hasOwn(f,I))||f.nativeTurn?.active===!0||y.observationLoss&&
|
|
@@ -6071,19 +6071,19 @@ ible Colleague owner appeared after preparation. Keep writers stopped and inspec
|
|
|
6071
6071
|
for(let d of u.files){let l=s.find(y=>Ge.relative(e,y.filePath)===d.path);if(!l)throw new Error("A backed-up Colleague o\
|
|
6072
6072
|
wner is missing. Restore its original state before retrying.");let p=await Te(Ge.join(r,"before",d.path)),f=or(p,"Backed\
|
|
6073
6073
|
-up Colleague history"),v=or(await Te(Ge.join(r,"after",d.path)),"Prepared Colleague history");pt(f,l.ownerKey),pt(v,l.ownerKey);
|
|
6074
|
-
let g=a({...l,original:p,saved:f});if(!g||!
|
|
6074
|
+
let g=a({...l,original:p,saved:f});if(!g||!hi(or(g.contents,"Reinspected Colleague history"),v))throw new Error("The pre\
|
|
6075
6075
|
pared Colleague instructions differ from the original binding or history. Inspect the verified backup before retrying.")}}
|
|
6076
6076
|
await ke({systemRoot:e,apply:t,backupRoot:r,report:n,prepareUpdates:async()=>{let u=[];for(let d of s){let l=a(d);l&&(n(
|
|
6077
6077
|
"warning",`${d.ownerKey}: restore only the missing Colleague instructions with all product writers stopped. The failed r\
|
|
6078
|
-
equest, native binding, account and full history remain unchanged; no request is sent or retried.`),u.push(l))}return u}})}import{readdir as XZ}from"node:fs/promises";import
|
|
6078
|
+
equest, native binding, account and full history remain unchanged; no request is sent or retried.`),u.push(l))}return u}})}import{readdir as XZ}from"node:fs/promises";import gi from"node:path";import{isDeepStrictEqual as _$}from"node:util";var Iu=e=>e&&typeof e=="object"&&!Array.isArray(e),YZ=/^[a-f0-9]{8}(?:-[a-f0-9]{4}){3}-[a-f0-9]{12}$/iu;function _l(e){try{
|
|
6079
6079
|
let t=JSON.parse(e);if(Iu(t))return t}catch{}throw new Error("Colleague operation-receipt state is invalid. Inspect it b\
|
|
6080
6080
|
efore repairing.")}function ZZ(e){if(typeof e.arguments!="string")return!1;let t;try{t=JSON.parse(e.arguments)}catch{return!1}
|
|
6081
6081
|
let r=e.result;return Iu(t)&&typeof t.actionId=="string"&&/^vibe64\.[\w.-]{1,128}$/u.test(t.actionId)&&t.version===1&&Iu(
|
|
6082
6082
|
t.input)&&Iu(r)&&r.ok===!0&&Iu(r.result)&&r.result.actionId===t.actionId&&r.result.version===t.version&&Iu(r.result.result)&&
|
|
6083
|
-
r.result.result.ok===!0}async function dI({systemRoot:e,apply:t,backupRoot:r,report:n}){let o=
|
|
6084
|
-
e,
|
|
6083
|
+
r.result.result.ok===!0}async function dI({systemRoot:e,apply:t,backupRoot:r,report:n}){let o=gi.join(e,"colleague");await we(
|
|
6084
|
+
e,gi.join(o,"placeholder"));let i=await XZ(o,{withFileTypes:!0}).catch(d=>{if(d.code==="ENOENT")return[];throw d}),s=[];
|
|
6085
6085
|
for(let d of i){if(!d.isDirectory()||!/^[\w-]+$/u.test(d.name))throw new Error("Unexpected Colleague state entry. Inspec\
|
|
6086
|
-
t it before repairing.");let l=
|
|
6086
|
+
t it before repairing.");let l=gi.join(o,d.name,"conversation.json");await we(e,l);let p=await Te(l);if(p===null)continue;
|
|
6087
6087
|
let f=_l(p);pt(f,d.name),s.push({ownerKey:d.name,filePath:l,original:p,saved:f})}let a=({ownerKey:d,filePath:l,original:p,
|
|
6088
6088
|
saved:f})=>{let v=f.retiredConversation;if(!v?.operation||v.assistantSelection?.engineId!=="codex"||f.conversationMetadata?.
|
|
6089
6089
|
runtime||f.previousConversations?.length||f.freshOperation)return null;let g=()=>{throw new Error(`${d}: the retired ope\
|
|
@@ -6094,12 +6094,12 @@ _execute"||!ZZ(y)||["request","replacement","rewind","continuity"].some(I=>Objec
|
|
|
6094
6094
|
f.conversationLog.some(I=>["running","working","inProgress"].includes(I.metadata?.runtime?.status)||I.metadata?.applicationTools?.
|
|
6095
6095
|
some(E=>E.status!=="complete"||!E.result))||(f.assignments||[]).some(I=>I.turns?.some(E=>["reserved","unknown"].includes(
|
|
6096
6096
|
E.status))))&&g();let{operation:m,...h}=v,_={...f,retiredConversation:{...h,completedOperationReceipt:m}};return pt(_,d),
|
|
6097
|
-
{filePath:l,original:p,contents:JSON.stringify(_)}},c=
|
|
6097
|
+
{filePath:l,original:p,contents:JSON.stringify(_)}},c=gi.join(r,"manifest.json");await we(e,c);let u=await Te(c);if(u!==
|
|
6098
6098
|
null){await ke({systemRoot:e,apply:!1,backupRoot:r,report:n,prepareUpdates:async()=>[]});let d=_l(u);for(let l of s)if(!d.
|
|
6099
|
-
files.some(p=>p.path===
|
|
6100
|
-
reparation. Keep writers stopped and inspect the original backup.");for(let l of d.files){let p=s.find(m=>
|
|
6099
|
+
files.some(p=>p.path===gi.relative(e,l.filePath))&&a(l))throw new Error("A new eligible Colleague owner appeared after p\
|
|
6100
|
+
reparation. Keep writers stopped and inspect the original backup.");for(let l of d.files){let p=s.find(m=>gi.relative(e,
|
|
6101
6101
|
m.filePath)===l.path);if(!p)throw new Error("A backed-up Colleague owner is missing. Restore its original state before r\
|
|
6102
|
-
etrying.");let f=await Te(
|
|
6102
|
+
etrying.");let f=await Te(gi.join(r,"before",l.path)),v=_l(f);pt(v,p.ownerKey);let g=_l(await Te(gi.join(r,"after",l.path))),
|
|
6103
6103
|
y=a({...p,original:f,saved:v});if(!y||!_$(_l(y.contents),g))throw new Error("The prepared Colleague receipt differs from\
|
|
6104
6104
|
its original marker. Inspect the verified backup before retrying.")}}await ke({systemRoot:e,apply:t,backupRoot:r,report:n,
|
|
6105
6105
|
prepareUpdates:async()=>{let d=[];for(let l of s){let p=a(l);p&&(n("warning",`${l.ownerKey}: retain the completed operat\
|
|
@@ -6240,54 +6240,55 @@ required:!1}}),P$=ce({schemaVersion:xh,id:nt,title:Ue,svg:Ue,controller:Ue,asset
|
|
|
6240
6240
|
states:Ve(nt,32),description:{...Ue,maxLength:2e3},commands:Ve(ce({name:nt,parameters:Ve(ce({name:nt,required:{type:"boo\
|
|
6241
6241
|
lean",required:!0},maxLength:{type:"integer",required:!0,min:1,max:256}}),8),completionState:nt,description:{...Ue,maxLength:2e3}}),
|
|
6242
6242
|
32)});function Qr(e,t,r){let n=fm({schema:e,mode:"create"},t,{context:r});if(!u7(t,n))throw new Error(`${r}: unknown fie\
|
|
6243
|
-
lds or noncanonical values.`);return n}var
|
|
6244
|
-
{id:e,label:t}),k$=
|
|
6243
|
+
lds or noncanonical values.`);return n}var So=/^[a-z][a-z0-9-]{0,63}$/u,g7=new Set(["studio","project"]),w7=new Set(["everyone","owner"]),vt=(e,t)=>Object.freeze(
|
|
6244
|
+
{id:e,label:t}),k$=vt("preview","Preview"),Io=vt("dashboard","Dashboard"),N$=vt("database","Database"),bI=vt("account-me\
|
|
6245
6245
|
nu","Account menu"),v7=[{id:"preview",label:"Preview",scope:"project",open:{pane:"preview"},steps:[k$]},{id:"dashboard",
|
|
6246
|
-
label:"Dashboard",scope:"project",open:null,steps:[
|
|
6247
|
-
ase",databaseView:"erd"},steps:[
|
|
6248
|
-
pane:"database",databaseView:"data"},steps:[
|
|
6249
|
-
open:{pane:"files"},steps:[
|
|
6250
|
-
anges"},steps:[
|
|
6251
|
-
steps:[
|
|
6252
|
-
|
|
6253
|
-
|
|
6254
|
-
|
|
6255
|
-
{id:"
|
|
6256
|
-
|
|
6257
|
-
|
|
6258
|
-
"
|
|
6259
|
-
|
|
6260
|
-
{id:"
|
|
6246
|
+
label:"Dashboard",scope:"project",open:null,steps:[Io]},{id:"database-erd",label:"ERD",scope:"project",open:{pane:"datab\
|
|
6247
|
+
ase",databaseView:"erd"},steps:[Io,N$,vt("database-erd","ERD")]},{id:"database-data",label:"Data",scope:"project",open:{
|
|
6248
|
+
pane:"database",databaseView:"data"},steps:[Io,N$,vt("database-data","Data")]},{id:"files",label:"Files",scope:"project",
|
|
6249
|
+
open:{pane:"files"},steps:[Io,vt("files","Files")]},{id:"changes",label:"Current changes",scope:"project",open:{pane:"ch\
|
|
6250
|
+
anges"},steps:[Io,vt("changes","Current changes")]},{id:"git-log",label:"Git log",scope:"project",open:{pane:"repository"},
|
|
6251
|
+
steps:[Io,vt("git-log","Git log")]},{id:"session-info",label:"Session info",scope:"project",open:{pane:"session"},steps:[
|
|
6252
|
+
Io,vt("session-info","Session info")]},{id:"architecture",label:"Architecture",scope:"project",open:{pane:"system"},steps:[
|
|
6253
|
+
Io,vt("architecture","Architecture")]},{id:"publish",label:"Publish",scope:"project",open:{pane:"publish"},steps:[Io,vt(
|
|
6254
|
+
"publish","Publish")]},{id:"chat",label:"Coding chat",scope:"project",open:null,shown:[{pane:"chat"},{chatVisible:!0}],steps:[
|
|
6255
|
+
vt("chat","Coding chat")]},{id:"save",label:"Save",scope:"project",open:null,event:"saved",steps:[vt("save","Save")]},{id:"\
|
|
6256
|
+
reload-preview",label:"Reload preview",scope:"project",open:null,event:"preview-reloaded",steps:[k$,vt("reload-preview",
|
|
6257
|
+
"Reload preview")]},{id:"learning",label:"Learning",scope:"studio",open:{learning:!0},shown:[],event:"learn-toggled",steps:[
|
|
6258
|
+
vt("learning","Learning")]},{id:"lesson",label:"Lesson",scope:"studio",open:null,shown:[{pane:"lesson"}],steps:[vt("less\
|
|
6259
|
+
on","Lesson")]},{id:"lesson-bar",label:"Lesson step bar",scope:"studio",open:null,steps:[vt("lesson-bar","Lesson step ba\
|
|
6260
|
+
r")]},{id:"courses",label:"Courses",scope:"studio",open:null,shown:[{learningOpen:!0}],steps:[vt("courses","Courses")]},
|
|
6261
|
+
{id:"colleague",label:"Colleague",scope:"studio",open:null,event:"colleague-opened",steps:[vt("colleague","Colleague")]},
|
|
6261
6262
|
{id:"account-menu",label:"Account menu",scope:"studio",open:null,steps:[bI]},{id:"account-settings",label:"Account setti\
|
|
6262
|
-
ngs",scope:"studio",open:null,steps:[bI,
|
|
6263
|
-
studio",open:null,steps:[bI,
|
|
6263
|
+
ngs",scope:"studio",open:null,steps:[bI,vt("account-settings","Account settings")]},{id:"ai-setup",label:"AI setup",scope:"\
|
|
6264
|
+
studio",open:null,steps:[bI,vt("ai-setup","AI setup")]}],y7=[{id:"send-message",event:"message-sent",place:"chat"},{id:"\
|
|
6264
6265
|
agent-finished",event:"agent-finished"},{id:"file-opened",event:"file-opened",place:"files"},{id:"app-pressed",event:"ap\
|
|
6265
6266
|
p-pressed",place:"preview"},{id:"colleague-minimised",event:"colleague-minimised",place:"colleague"}],_7=["ai-ready"];function wr(e){
|
|
6266
6267
|
return Object.assign(new Error(e),{code:"VIBE64_TRAINING_VOCABULARY_INVALID"})}var II=e=>!!e&&typeof e=="object"&&!Array.
|
|
6267
|
-
isArray(e),j$=e=>typeof e=="string"&&e.trim().length>0&&e.length<=64;function b7(e){if(!II(e)||!
|
|
6268
|
+
isArray(e),j$=e=>typeof e=="string"&&e.trim().length>0&&e.length<=64;function b7(e){if(!II(e)||!So.test(e.id||""))throw wr(
|
|
6268
6269
|
"A place needs a lowercase id.");let t=`Place ${e.id}`;if(!j$(e.label))throw wr(`${t} needs a label.`);if(!g7.has(e.scope))
|
|
6269
6270
|
throw wr(`${t} scope is studio or project.`);let r=e.who??"everyone";if(!w7.has(r))throw wr(`${t} who is everyone or own\
|
|
6270
6271
|
er.`);let n=e.open??null;if(n!==null){let i=Object.keys(n||{}).sort().join(",");if(!(i==="pane"||i==="databaseView,pane"?
|
|
6271
|
-
e.scope==="project"&&
|
|
6272
|
+
e.scope==="project"&&So.test(n.pane):i==="route"?e.scope==="studio"&&typeof n.route=="string"&&/^\/app(?:\/[a-z0-9-]+)*$/u.
|
|
6272
6273
|
test(n.route):i==="learning"&&n.learning===!0))throw wr(`${t} opens a project pane, a studio /app route, Courses, or not\
|
|
6273
|
-
hing.`)}if(!Array.isArray(e.steps)||!e.steps.length||e.steps.length>6||e.steps.some(i=>!
|
|
6274
|
+
hing.`)}if(!Array.isArray(e.steps)||!e.steps.length||e.steps.length>6||e.steps.some(i=>!So.test(i?.id||"")||!j$(i.label))||
|
|
6274
6275
|
e.steps.at(-1).id!==e.id)throw wr(`${t} needs 1 to 6 labelled steps ending with itself.`);let o=e.shown??(n?.pane?[{pane:n.
|
|
6275
6276
|
pane,...n.databaseView?{databaseView:n.databaseView}:{}}]:n?.route?[{route:n.route}]:[]);if(!Array.isArray(o)||o.some(i=>!II(
|
|
6276
|
-
i)||!Object.keys(i).length))throw wr(`${t} shown is a list of page focus matchers.`);if(e.event!==void 0&&!
|
|
6277
|
+
i)||!Object.keys(i).length))throw wr(`${t} shown is a list of page focus matchers.`);if(e.event!==void 0&&!So.test(e.event))
|
|
6277
6278
|
throw wr(`${t} event is a lowercase activity name.`);return Object.freeze({id:e.id,label:e.label,scope:e.scope,who:r,open:n&&
|
|
6278
|
-
Object.freeze({...n}),steps:Object.freeze(e.steps.map(i=>
|
|
6279
|
-
...i}))),...e.event?{event:e.event}:{}})}function I7(e){if(!II(e)||!
|
|
6280
|
-
rcase id.");if(!
|
|
6279
|
+
Object.freeze({...n}),steps:Object.freeze(e.steps.map(i=>vt(i.id,i.label))),shown:Object.freeze(o.map(i=>Object.freeze({
|
|
6280
|
+
...i}))),...e.event?{event:e.event}:{}})}function I7(e){if(!II(e)||!So.test(e.id||""))throw wr("An activity needs a lowe\
|
|
6281
|
+
rcase id.");if(!So.test(e.event||""))throw wr(`Activity ${e.id} needs its page activity event.`);if(e.place!==void 0&&!So.
|
|
6281
6282
|
test(e.place))throw wr(`Activity ${e.id} place is a place id.`);return Object.freeze({id:e.id,event:e.event,...e.place?{
|
|
6282
6283
|
place:e.place}:{}})}function $$({places:e=v7,activities:t=y7,facts:r=_7}={}){let n=new Map,o=new Map,i=new Set,s=(c,u)=>JSON.
|
|
6283
6284
|
stringify(c)===JSON.stringify(u);function a({places:c=[],activities:u=[],facts:d=[]}={}){let l=c.map(b7),p=u.map(I7);for(let f of[
|
|
6284
6285
|
...l,...p])if(n.has(f.id)&&!s(n.get(f.id),f)||o.has(f.id)&&!s(o.get(f.id),f)||l.includes(f)&&o.has(f.id)||p.includes(f)&&
|
|
6285
|
-
n.has(f.id))throw wr(`${f.id} is already registered with another meaning.`);for(let f of d)if(!
|
|
6286
|
+
n.has(f.id))throw wr(`${f.id} is already registered with another meaning.`);for(let f of d)if(!So.test(f||""))throw wr("\
|
|
6286
6287
|
A fact needs a lowercase id.");for(let f of l)n.set(f.id,f);for(let f of p)o.set(f.id,f);for(let f of d)i.add(f)}return a(
|
|
6287
6288
|
{places:e,activities:t,facts:r}),Object.freeze({register:a,place:c=>n.get(c)||null,activity:c=>o.get(c)||null,hasFact:c=>i.
|
|
6288
6289
|
has(c),places:()=>[...n.values()],events:()=>new Set([...[...o.values()].map(c=>c.event),...[...n.values()].filter(c=>c.
|
|
6289
6290
|
event).map(c=>c.event)])})}var Au=$$({facts:[]});function Ch({places:e=[],activities:t=[],facts:r=[]}={}){let n=$$(),o=new Set(n.places().map(a=>a.id));for(let a of[...e,
|
|
6290
|
-
...t,...r])if(!
|
|
6291
|
+
...t,...r])if(!So.test(a||""))throw wr(`Declared name ${a} is not a lowercase id.`);let i=new Set(e.filter(a=>!o.has(a))),
|
|
6291
6292
|
s=new Set(t.filter(a=>!n.activity(a)));return Object.freeze({...n,declared:a=>i.has(a)||s.has(a),declaredPlace:a=>i.has(
|
|
6292
6293
|
a),declaredActivity:a=>s.has(a),hasFact:a=>n.hasFact(a)||r.includes(a)})}var SI=/^(?!\/)(?!.*(?:^|\/)\.\.(?:\/|$))[^\u0000-\u001f\\]{1,512}$/u,
|
|
6293
6294
|
M$=256;function wi(e){return Object.assign(new Error(e),{code:"VIBE64_TRAINING_GUIDE_INVALID",statusCode:422})}var S7=e=>!!e?.
|
|
@@ -6571,7 +6572,7 @@ lesson.steps:null}var vQ=e=>e.check?.kind==="none"?"read":e.check?.kind;function
|
|
|
6571
6572
|
n.kind||n.kind==="auto"&&n.evidence.checkId!==o.check.check||n.kind==="fact"&&n.evidence.fact!==o.check.fact)throw new Error(
|
|
6572
6573
|
"Saved step results must match the exact pinned lesson step and its declared check.")}for(let n of e.receipts||[]){let o=r.
|
|
6573
6574
|
find(i=>i.id===n.stepId);if(o?.check?.kind!=="auto"||o.check.check!==n.checkId)throw new Error("Saved step receipts must\
|
|
6574
|
-
match the exact pinned lesson step's automatic check.")}}function
|
|
6575
|
+
match the exact pinned lesson step's automatic check.")}}function Ao(e,t,r,n={}){return Object.assign(new Error(t),{code:e,
|
|
6575
6576
|
...r?{statusCode:r}:{},...n})}function Q$(e){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Learning state\
|
|
6576
6577
|
requires an actor supplied by the admitted authenticated caller.");let t=e?.uid??e?.username;if(typeof t!="string"&&typeof t!=
|
|
6577
6578
|
"number"||typeof t=="number"&&(!Number.isSafeInteger(t)||t<0))throw new Error("Learning state requires a valid identity \
|
|
@@ -6697,7 +6698,7 @@ length<=Ne.submissions.length&&ae.submissions.every((ie,fe)=>Fe(ie)===Fe(Ne.subm
|
|
|
6697
6698
|
(ae.resume.revision<Ne.resume.revision||Fe(ae.resume)===Fe(Ne.resume));ut&&K&&(_e={..._e,learning:Ne})}if(!ue||T.progressRevision>
|
|
6698
6699
|
Y||Fe(_e)!==Fe(ue))throw new Error("Active summary conflicts with durable progress; inspect a consistent backup before r\
|
|
6699
6700
|
ecovery.")}}let E=eL(_);return{revision:_.revision,progress:_,active:E,activeSummaryCurrent:Fe(I)===Fe(E||(_.revision?{schemaVersion:1,
|
|
6700
|
-
learnerId:_.learnerId,progressRevision:_.revision,attemptId:null}:null))}}catch(_){throw
|
|
6701
|
+
learnerId:_.learnerId,progressRevision:_.revision,attemptId:null}:null))}}catch(_){throw Ao("VIBE64_TRAINING_STATE_INVAL\
|
|
6701
6702
|
ID",`Learning state is invalid: ${_.message} Keep the files and ask the owner to inspect them; no automatic conversion w\
|
|
6702
6703
|
as performed.`,null,{cause:_})}}async function s(h,{admissionOnly:_=!1}={}){let E=await(_&&typeof r.readAdmissionIdentity==
|
|
6703
6704
|
"function"?r.readAdmissionIdentity:r.readLesson).call(r,{...h.topic,lessonCode:h.lesson.code,lessonHash:h.lesson.hash});
|
|
@@ -6710,12 +6711,12 @@ progress.attempts){let ue=Fe(Y.pin.lesson),Z=M.get(ue)||{...p(Y,C.get(Y.attemptI
|
|
|
6710
6711
|
attempts.find(Y=>Y.attemptId===E.progress.activeAttemptId);return{...E,completion:p(V,C.get(V.attemptId),E.progress.attempts,
|
|
6711
6712
|
T),lessonCompletions:j}}async function u(h,_,I){let E=h.progress.activeAttemptId===_.attemptId&&!_.ended,C=(I==="write"||
|
|
6712
6713
|
I==="create")&&(!E||!h.activeSummaryCurrent);if(C||typeof r.readExercise!="function")throw(await s(_.pin)).lesson.exercise?
|
|
6713
|
-
C?
|
|
6714
|
-
|
|
6715
|
-
se.",409):
|
|
6714
|
+
C?Ao("VIBE64_TRAINING_ATTEMPT_INACTIVE","Resume this exact confirmed active lesson before admitting practice work.",409):
|
|
6715
|
+
Ao("VIBE64_TRAINING_EXERCISE_UNAVAILABLE","This installed content reader cannot supply the lesson's exact bundled exerci\
|
|
6716
|
+
se.",409):Ao("VIBE64_TRAINING_EXERCISE_MISSING","This saved lesson has no practice project. Use its source-less learning\
|
|
6716
6717
|
conversation.",409);let T;try{T=await r.readExercise({..._.pin.topic,lessonCode:_.pin.lesson.code,lessonHash:_.pin.lesson.
|
|
6717
6718
|
hash,metadataOnly:!0,admissionOnly:I==="observe"||I==="control"})}catch(M){throw M?.code==="VIBE64_TRAINING_EXERCISE_MIS\
|
|
6718
|
-
SING"?(await s(_.pin),
|
|
6719
|
+
SING"?(await s(_.pin),Ao("VIBE64_TRAINING_EXERCISE_MISSING","This saved lesson has no practice project. Use its source-l\
|
|
6719
6720
|
ess learning conversation.",409)):M}if(Fe(T.pin)!==Fe(_.pin.topic)||T.lessonCode!==_.pin.lesson.code||T.lessonHash!==_.pin.
|
|
6720
6721
|
lesson.hash)throw new Error("The installed topic differs from the admitted reservation pin.");return{active:E,sourcePath:T.
|
|
6721
6722
|
sourcePath}}function d(h,_,I,{active:E,training:C}){return{scope:{learnerId:h.learner.id,attemptId:I.attemptId,pin:structuredClone(
|
|
@@ -6723,8 +6724,8 @@ I.pin),noExercise:!1},systemRoot:e,training:C,projectSlug:I.projectSlug,...I.pre
|
|
|
6723
6724
|
preparation.initialSessionId}:{},active:E,activeSummaryCurrent:_.activeSummaryCurrent}}async function l({actor:h,attemptId:_,
|
|
6724
6725
|
access:I="observe"}={}){if(!["observe","control","write","create"].includes(I))throw new TypeError("Use an explicit prac\
|
|
6725
6726
|
tice operation scope.");let E=n(h);if(typeof _!="string"||!$I.test(_))throw new Error("Use the exact saved exercise atte\
|
|
6726
|
-
mpt ID.");let C=await i(E),T=C.progress.attempts.find(V=>V.attemptId===_);if(!T)throw
|
|
6727
|
-
G","This learner has no matching saved attempt.",404);if(T.practiceId)throw
|
|
6727
|
+
mpt ID.");let C=await i(E),T=C.progress.attempts.find(V=>V.attemptId===_);if(!T)throw Ao("VIBE64_TRAINING_ATTEMPT_MISSIN\
|
|
6728
|
+
G","This learner has no matching saved attempt.",404);if(T.practiceId)throw Ao("VIBE64_TRAINING_ATTEMPT_CONFLICT","This \
|
|
6728
6729
|
attempt continues a learning-space practice project; read it by its practice project.",409);let{active:M,sourcePath:j}=await u(
|
|
6729
6730
|
C,T,I);return d(E,C,T,{active:M,training:{schemaVersion:1,learnerKey:E.learner.key,attemptId:_,pin:structuredClone(T.pin),
|
|
6730
6731
|
exercise:{kind:"bundled",sourcePath:j}}})}function p(h,_,I=[h],E=[]){let C=kI(_),T,M;if(C){let{results:j}=$Q(E,h.pin.lesson);
|
|
@@ -6744,7 +6745,7 @@ find(T=>T.id===I.assessmentId),C=I.evidence;if(!E||I.kind!==E.kind||I.rubric!==E
|
|
|
6744
6745
|
"Saved assessment receipts must match the exact pinned assessment, rubric and evidence contract.")}}}async function y(h){
|
|
6745
6746
|
let _=await Lh(h.stepProgress,tL);return _?MQ(_,h.learner.id):null}async function m(h,_,I){try{let E=await y(h);for(let C of E?.
|
|
6746
6747
|
lessons||[]){let T=_.attempts.find(M=>Fe(M.pin.lesson)===Fe(C.lesson));T&&Z$(C,I.get(T.attemptId))}return{revision:E?.revision||
|
|
6747
|
-
0,lessons:E?.lessons||[]}}catch(E){throw
|
|
6748
|
+
0,lessons:E?.lessons||[]}}catch(E){throw Ao("VIBE64_TRAINING_STATE_INVALID",`Learning step progress is invalid: ${E.message}\
|
|
6748
6749
|
Keep the files and ask the owner to inspect them; no automatic conversion was performed.`,null,{cause:E})}}return{readState:c,
|
|
6749
6750
|
readExerciseProjectScope:l}}async function lL({systemRoot:e,backupRoot:t,apply:r,report:n}){if(!At.isAbsolute(e||"")||At.resolve(e)!==e||e===At.parse(
|
|
6750
6751
|
e).root||t!==At.join(e,"upgrades","backups","20261008-learning-practice-history"))throw new Error("Practice history upgr\
|
|
@@ -6928,7 +6929,7 @@ filter(g=>g.assistantSelection?.engineId==="claude").map(g=>({conversationId:g.c
|
|
|
6928
6929
|
{metadata:a}).filter(g=>g.engineId==="claude"),p=`${BI.basename(o)}/${s}/${c?.conversationId||"main"}`,f=new Map,v=new Set;
|
|
6929
6930
|
for(let g of l){let y=JSON.stringify([g.workdir,g.conversationId]);if(v.has(y))continue;if(v.add(y),!BI.isAbsolute(g.workdir||
|
|
6930
6931
|
""))throw new Error(`${p}: Claude history has no absolute workdir. Inspect its saved binding before upgrading.`);let m;try{
|
|
6931
|
-
m=await
|
|
6932
|
+
m=await qo({configRoot:t,workdir:g.workdir,conversationId:g.conversationId,allowIncompleteTail:!1,includeCommandMessages:!0})}catch(h){
|
|
6932
6933
|
if(h.code!=="ENOENT")throw h}if(!m?.exists){e.report("warning",`${p}: native Claude history is unavailable; unproven com\
|
|
6933
6934
|
mand messages remain unchanged.`);continue}for(let h of m.commandMessages){let _=d.filter(T=>T.messageId===h.id);if(!_.length)
|
|
6934
6935
|
continue;let I=_[0].data?.native,E=I?.engineId==="claude"&&I.type==="system"&&I.subtype==="local_command_output"&&I.command===
|
|
@@ -6945,7 +6946,7 @@ ct its original request and native receipt before retrying.")};(o.schemaVersion!
|
|
|
6945
6946
|
messageId!==o.messageId||i.id!=="claude_stream_json"||i.active!==!1||i.state!=="interrupted"||i.threadId!==o.threadId||t.
|
|
6946
6947
|
some(l=>l.active))&&s();let a=JSON.parse(e[`claude_conversation_${o.threadId}`]||"null"),c=gm(o.messageId);(!qI(a)||a.executionId!==
|
|
6947
6948
|
""||a.state!=="interrupted"||a.main!==!0||a.lastMessageId!==c||a.turnId!==c||i.turnId!==c||typeof a.nativeWorkdir!="stri\
|
|
6948
|
-
ng"||!Hn.isAbsolute(a.nativeWorkdir))&&s();let u=await
|
|
6949
|
+
ng"||!Hn.isAbsolute(a.nativeWorkdir))&&s();let u=await qo({configRoot:r,workdir:a.nativeWorkdir,conversationId:o.threadId,
|
|
6949
6950
|
allowIncompleteTail:!1});(!u.exists||u.userIds.includes(c))&&s();let d={...o,status:"waiting",delivery:"failed",error:PL};
|
|
6950
6951
|
return delete d.attemptedMessageId,{assistant_routing_request:JSON.stringify(d)}}async function kL(e){let t=process.env.
|
|
6951
6952
|
CLAUDE_CONFIG_DIR||Hn.join(Js().home,".claude"),r=Hn.join(e.backupRoot,"manifest.json");await we(e.systemRoot,r);let n=await Te(
|