@north-light/crouter 0.3.351 → 0.3.352
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/dist/clients/attach/viewer.js +924 -908
- package/dist/core/canvas/migrations.js +42 -26
- package/dist/core/canvas/recovery.js +1 -1
- package/dist/core/grants/remove.js +1 -1
- package/dist/core/grants/sync.d.ts +21 -0
- package/dist/core/grants/sync.js +1 -1
- package/dist/core/human/page-schema.d.ts +1 -1
- package/dist/core/human/requests.d.ts +3 -0
- package/dist/core/human/requests.js +15 -14
- package/dist/core/human/scan.js +1 -1
- package/dist/core/runs/operations.d.ts +24 -3
- package/dist/core/runs/operations.js +5 -5
- package/dist/core/runs/questions.d.ts +54 -0
- package/dist/core/runs/questions.js +4 -0
- package/dist/core/storage/attachments.d.ts +33 -0
- package/dist/core/storage/attachments.js +1 -0
- package/dist/core/storage/client.d.ts +67 -0
- package/dist/core/storage/client.js +3 -0
- package/dist/core/storage/download.d.ts +23 -0
- package/dist/core/storage/download.js +1 -0
- package/dist/core/storage/shares.d.ts +32 -0
- package/dist/core/storage/shares.js +1 -0
- package/dist/core/storage/tables.d.ts +59 -0
- package/dist/core/storage/tables.js +3 -0
- package/dist/daemon/api/app-listener.js +12 -12
- package/dist/daemon/api/handlers/app-profiles.d.ts +17 -0
- package/dist/daemon/api/handlers/app-profiles.js +1 -0
- package/dist/daemon/api/handlers/questions.d.ts +7 -0
- package/dist/daemon/api/handlers/questions.js +1 -0
- package/dist/daemon/api/handlers/runs.js +1 -1
- package/dist/daemon/api/handlers/transfer.d.ts +15 -0
- package/dist/daemon/api/handlers/transfer.js +1 -0
- package/dist/daemon/api/operations.d.ts +2 -1
- package/dist/daemon/api/operations.js +1 -1
- package/dist/daemon/cron-run.js +1 -1
- package/dist/daemon/crtrd.js +7 -7
- package/dist/daemon/human/finish.d.ts +5 -0
- package/dist/daemon/human/finish.js +3 -3
- package/dist/daemon/human/settle.js +1 -1
- package/dist/daemon/reconcilers/storage-due-work.d.ts +32 -0
- package/dist/daemon/reconcilers/storage-due-work.js +1 -0
- package/dist/daemon/runs/append-section.js +2 -2
- package/dist/daemon/runs/observer.js +2 -2
- package/dist/types.d.ts +6 -0
- package/package.json +2 -2
- package/packages/crouter-identity/package.json +1 -1
- package/runtime.lock.json +11 -11
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var v=Object.defineProperty;var c=(i,t)=>v(i,"name",{value:t,configurable:!0});import{closeSync as f,constants as h,createReadStream as b,fstatSync as C,realpathSync as g}from"node:fs";import{extname as N,isAbsolute as R,join as w,relative as l,resolve as S,sep as d}from"node:path";import{pipeline as E}from"node:stream/promises";import{appsRoot as x,runtimeRoot as $,userRoot as O}from"../layout.js";import{RunError as m}from"../runs/operations.js";import{isBeneathRefusal as _,openBeneath as I}from"../spaces/open-beneath.js";import{fileRoot as T}from"../spaces/permissions.js";const j={".txt":"text/plain; charset=utf-8",".log":"text/plain; charset=utf-8",".md":"text/markdown; charset=utf-8",".csv":"text/csv; charset=utf-8",".tsv":"text/tab-separated-values; charset=utf-8",".json":"application/json",".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".heic":"image/heic",".heif":"image/heif",".avif":"image/avif",".bmp":"image/bmp",".tif":"image/tiff",".tiff":"image/tiff",".mp3":"audio/mpeg",".m4a":"audio/mp4",".wav":"audio/wav",".ogg":"audio/ogg",".mp4":"video/mp4",".mov":"video/quicktime",".webm":"video/webm",".zip":"application/zip",".gz":"application/gzip",".tar":"application/x-tar",".doc":"application/msword",".docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document",".xls":"application/vnd.ms-excel",".xlsx":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",".ppt":"application/vnd.ms-powerpoint",".pptx":"application/vnd.openxmlformats-officedocument.presentationml.presentation"},A=new Set(["text/html","image/svg+xml","application/xhtml+xml"]);function D(i){const t=j[N(i).toLowerCase()]??"application/octet-stream";return A.has(t.split(";")[0].trim().toLowerCase())?"application/octet-stream":t}c(D,"contentTypeFor");function u(i,t){const n=l(i,t);return n===""||n!==".."&&!n.startsWith(`..${d}`)&&!n.startsWith(d)}c(u,"contains");function L(i){if(u($(),i)||u(w(O(),"memory"),i))return!0;if(!u(x(),i))return!1;const t=l(x(),i).split(d)[1];return t==="memory"||t==="conversations"}c(L,"withheld");function q(i,t){if(typeof t!="string"||!t)throw new m(400,"invalid_request","path is required","path");if(!R(t)||t.includes("\0"))throw new m(400,"invalid_request","path must be absolute","path");const n=S(t),p=c(()=>new m(404,"not_found",`no such file: ${n}`),"notFound");if(L(n))throw p();const e=T(i,n,"read");if(!("root"in e))throw new m(403,"scope_missing",e.missing?`missing scope ${e.missing}`:`no permission names ${n}`,void 0,void 0,e.missing??void 0);const o=c(()=>new m(400,"invalid_request",`${n} meets a symlink, leaves its permitted root, or is not a regular file`,"path"),"symlink");let s;try{s=I(e.root,n,h.O_RDONLY|h.O_NONBLOCK)}catch(r){if(_(r))throw o();const a=r.code;throw a==="ENOENT"||a==="ENOTDIR"||a==="EISDIR"||a==="ENXIO"||a==="EACCES"||a==="EPERM"?p():r}try{if(process.platform!=="linux"){let a;try{a=g(n)}catch{throw p()}if(a!==w(g(e.root),l(e.root,n)))throw o()}const r=C(s);if(!r.isFile())throw p();return{fd:s,path:n,size:r.size}}catch(r){throw f(s),r}}c(q,"openCallerFile");function z(i,t){if(i===void 0)return null;const n=c(()=>new m(416,"invalid_request","range not satisfiable","range",{size:t}),"refuse"),p=/^bytes=(.+)$/i.exec(i.trim());if(!p)throw n();if(p[1].includes(","))return null;const e=/^\s*(\d*)\s*-\s*(\d*)\s*$/.exec(p[1]);if(!e||e[1]===""&&e[2]==="")throw n();let o,s;if(e[1]===""){const r=Number(e[2]);if(!Number.isSafeInteger(r)||r===0||t===0)throw n();o=Math.max(0,t-r),s=t-1}else if(o=Number(e[1]),s=e[2]===""?t-1:Math.min(Number(e[2]),t-1),!Number.isSafeInteger(o)||!Number.isSafeInteger(s)||o>=t||e[2]!==""&&Number(e[2])<o)throw n();return{start:o,end:s}}c(z,"parseRange");async function X(i,t,n,p){const e=q(n,p);let o;try{const a=i.headers.range;try{o=z(Array.isArray(a)?a[0]:a,e.size)}catch(y){throw t.setHeader("Content-Range",`bytes */${e.size}`),y}}catch(a){throw f(e.fd),a}const s={"Content-Type":D(e.path),"X-Content-Type-Options":"nosniff","Content-Security-Policy":"sandbox; default-src 'none'","Accept-Ranges":"bytes","Cache-Control":"no-store"};if(i.destroyed||t.destroyed){f(e.fd);return}if(o?t.writeHead(206,{...s,"Content-Length":String(o.end-o.start+1),"Content-Range":`bytes ${o.start}-${o.end}/${e.size}`}):t.writeHead(200,{...s,"Content-Length":String(e.size)}),e.size===0||o&&o.end<o.start){f(e.fd),t.end();return}const r=b("",{fd:e.fd,autoClose:!0,...o?{start:o.start,end:o.end}:{start:0}});try{await E(r,t)}catch{r.destroy(),t.destroy()}}c(X,"serveDownload");export{D as contentTypeFor,q as openCallerFile,z as parseRange,X as serveDownload};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { FileCaller } from '../spaces/permissions.js';
|
|
2
|
+
export declare const SHARE_SCOPE = "crtr:files:share";
|
|
3
|
+
export interface ShareView {
|
|
4
|
+
share_id: string;
|
|
5
|
+
url: string;
|
|
6
|
+
source_path: string;
|
|
7
|
+
created_by: string;
|
|
8
|
+
created_at: string;
|
|
9
|
+
expires_at: string | null;
|
|
10
|
+
status: 'on' | 'off';
|
|
11
|
+
}
|
|
12
|
+
/** `share.create`: freeze a copy of a file the caller may read at a public URL.
|
|
13
|
+
* Without `crtr:files:share` only the caller's own app space may be shared. The
|
|
14
|
+
* row is inserted only once storage holds the bytes. */
|
|
15
|
+
export declare function createShare(caller: FileCaller, input: {
|
|
16
|
+
path: unknown;
|
|
17
|
+
expires_at?: unknown;
|
|
18
|
+
}): Promise<{
|
|
19
|
+
share_id: string;
|
|
20
|
+
url: string;
|
|
21
|
+
expires_at: string | null;
|
|
22
|
+
}>;
|
|
23
|
+
/** `share.list`: the shares `createdBy` created. */
|
|
24
|
+
export declare function listOwnShares(createdBy: string): {
|
|
25
|
+
shares: ShareView[];
|
|
26
|
+
};
|
|
27
|
+
/** `share.delete`: turn the share off, then delete its stored copy. A storage
|
|
28
|
+
* failure leaves `object_deleted_at` unset for the due-work tick to retry. */
|
|
29
|
+
export declare function deleteOwnShare(createdBy: string, shareId: string): Promise<{
|
|
30
|
+
share_id: string;
|
|
31
|
+
status: 'off';
|
|
32
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var g=Object.defineProperty;var n=(e,t)=>g(e,"name",{value:t,configurable:!0});import{closeSync as x,read as v}from"node:fs";import{promisify as O}from"node:util";import{basename as $,relative as u,sep as d}from"node:path";import{Readable as _}from"node:stream";import{appsRoot as m,appSpace as A}from"../layout.js";import{RunError as s}from"../runs/operations.js";import{scopeAllowed as k}from"../scopes.js";import{invalidStorageName as q,storageClient as w,UPLOAD_MAX_BYTES as D}from"./client.js";import{contentTypeFor as E,openCallerFile as C}from"./download.js";import{getShare as R,insertShare as T,listShares as B,markShareObjectDeleted as N,turnShareOff as F}from"./tables.js";const f="crtr:files:share";function y(e,t){const r=u(e,t);return r===""||r!==".."&&!r.startsWith(`..${d}`)&&!r.startsWith(d)}n(y,"contains");function M(e){if(y(m(),e)){const t=u(m(),e).split(d)[0];if(t)return`app:${t}`}return"user"}n(M,"spaceOf");const b=n(e=>new s(503,"storage_unavailable",e,void 0,void 0,void 0,!0),"unavailable"),P=O(v);async function*U(e,t){let r=0;for(;r<t;){const a=Buffer.allocUnsafe(Math.min(1048576,t-r)),{bytesRead:i}=await P(e,a,0,a.length,r);if(i===0)throw new Error("shared file shrank while it was being copied");r+=i,yield a.subarray(0,i)}}n(U,"chunks");async function W(e,t,r,a){const i=_.from(U(t,r));let c;try{c=await fetch(e,{method:"PUT",signal:AbortSignal.timeout(11e4),headers:{"Content-Type":a,"Content-Length":String(r)},body:_.toWeb(i),duplex:"half"})}catch(p){throw b(`storage could not be reached: ${p instanceof Error?p.message:String(p)}`)}finally{i.destroy()}if(await c.body?.cancel().catch(()=>{}),!c.ok)throw b(`storage answered ${c.status} to the share upload`)}n(W,"putBytes");async function Z(e,t){if(typeof t.path!="string"||!t.path)throw new s(400,"invalid_request","path is required","path");let r;if(t.expires_at!==void 0&&t.expires_at!==null){const i=typeof t.expires_at=="string"?Date.parse(t.expires_at):NaN;if(!Number.isFinite(i))throw new s(400,"invalid_request","expires_at must be an ISO 8601 time","expires_at");if(i<=Date.now())throw new s(400,"invalid_request","expires_at must be in the future","expires_at");r=new Date(i).toISOString()}const a=C(e,t.path);try{if(!k(e.resolved,f)&&!y(A(e.app).root,a.path))throw new s(403,"scope_missing",`missing scope ${f}: without it only files in the app's own space can be shared`,void 0,void 0,f);if(a.size>D)throw new s(400,"invalid_request","file exceeds 100 MiB","path");const i=$(a.path),c=q(i);if(c)throw new s(400,"invalid_request",`file name cannot be shared: ${c}`,"path");const p=E(a.path),h=w(),o=await h.createShare({name:i,media_type:p,size:a.size,...r?{expires_at:r}:{}});try{await W(o.upload_link,a.fd,a.size,p)}catch(S){throw await h.deleteShare(o.share_id).catch(()=>{}),S}const l=o.expires_at??r??null;return T({share_id:o.share_id,source_space:M(a.path),source_path:a.path,storage_key:`${h.runtimeId}/shares/${o.share_id}/${i}`,url:o.url,created_by:e.app,created_at:new Date().toISOString(),expires_at:l}),{share_id:o.share_id,url:o.url,expires_at:l}}finally{x(a.fd)}}n(Z,"createShare");function j(e){return{share_id:e.share_id,url:e.url,source_path:e.source_path,created_by:e.created_by,created_at:e.created_at,expires_at:e.expires_at,status:e.status}}n(j,"view");function ee(e){return{shares:B(e).map(j)}}n(ee,"listOwnShares");async function te(e,t){const r=R(t);if(!r||r.created_by!==e)throw new s(404,"not_found","share not found");if(F(t),!r.object_deleted_at)try{await w().deleteShare(t),N(t)}catch(a){if(!(a instanceof s&&a.code==="storage_unavailable"))throw a}return{share_id:t,status:"off"}}n(te,"deleteOwnShare");export{f as SHARE_SCOPE,Z as createShare,te as deleteOwnShare,ee as listOwnShares};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { DatabaseSync } from 'node:sqlite';
|
|
2
|
+
/** Row helpers for the v57 file-transfer tables. Each takes an optional handle
|
|
3
|
+
* so a caller inside `withCanvasWrite` passes its transaction. */
|
|
4
|
+
export interface UploadRow {
|
|
5
|
+
upload_id: string;
|
|
6
|
+
grantee: string;
|
|
7
|
+
name: string;
|
|
8
|
+
media_type: string;
|
|
9
|
+
size: number;
|
|
10
|
+
created_at: string;
|
|
11
|
+
delete_pending_since: string | null;
|
|
12
|
+
}
|
|
13
|
+
export interface UploadUseRow {
|
|
14
|
+
upload_id: string;
|
|
15
|
+
run_id: string;
|
|
16
|
+
path: string;
|
|
17
|
+
}
|
|
18
|
+
export interface ShareRow {
|
|
19
|
+
share_id: string;
|
|
20
|
+
source_space: string;
|
|
21
|
+
source_path: string;
|
|
22
|
+
storage_key: string;
|
|
23
|
+
url: string;
|
|
24
|
+
created_by: string;
|
|
25
|
+
created_at: string;
|
|
26
|
+
expires_at: string | null;
|
|
27
|
+
status: 'on' | 'off';
|
|
28
|
+
object_deleted_at: string | null;
|
|
29
|
+
}
|
|
30
|
+
export declare function insertUpload(row: Omit<UploadRow, 'delete_pending_since'>, db?: DatabaseSync): void;
|
|
31
|
+
export declare function getUpload(uploadId: string, db?: DatabaseSync): UploadRow | null;
|
|
32
|
+
export declare function deleteUploadRow(uploadId: string, db?: DatabaseSync): void;
|
|
33
|
+
/** Uploads the runtime owes storage a delete for, oldest first. */
|
|
34
|
+
export declare function pendingUploadDeletes(db?: DatabaseSync): UploadRow[];
|
|
35
|
+
/** Mark uploads for deletion (idempotent: keeps the first mark). */
|
|
36
|
+
export declare function markUploadsDeletePending(uploadIds: readonly string[], db?: DatabaseSync, at?: string): void;
|
|
37
|
+
export declare function insertUploadUses(uses: readonly UploadUseRow[], db?: DatabaseSync): void;
|
|
38
|
+
/** The use recorded at `path`, if any. */
|
|
39
|
+
export declare function uploadUseAt(path: string, db?: DatabaseSync): UploadUseRow | null;
|
|
40
|
+
/** Delete a run's uses and mark each of its uploads that no other run uses for
|
|
41
|
+
* deletion. Returns the upload ids newly owed a storage delete. */
|
|
42
|
+
export declare function releaseRunUploads(runIds: readonly string[], db?: DatabaseSync): string[];
|
|
43
|
+
/** Uploads never used 24 h after creation (the tick marks them for deletion). */
|
|
44
|
+
export declare function staleUnusedUploads(before: string, db?: DatabaseSync): string[];
|
|
45
|
+
export declare function insertShare(row: Omit<ShareRow, 'status' | 'object_deleted_at'>, db?: DatabaseSync): void;
|
|
46
|
+
export declare function getShare(shareId: string, db?: DatabaseSync): ShareRow | null;
|
|
47
|
+
/** Shares `created_by` owns; `null` (the person) lists every share. */
|
|
48
|
+
export declare function listShares(createdBy: string | null, db?: DatabaseSync): ShareRow[];
|
|
49
|
+
export declare function turnShareOff(shareId: string, db?: DatabaseSync): void;
|
|
50
|
+
/** Turn every share `created_by` owns off; returns their ids. */
|
|
51
|
+
export declare function turnSharesOffFor(createdBy: string, db?: DatabaseSync): string[];
|
|
52
|
+
/** Shares `on` whose `expires_at` has passed turn `off`; returns their ids. */
|
|
53
|
+
export declare function expireShares(at?: string, db?: DatabaseSync): string[];
|
|
54
|
+
/** Shares `off` whose stored object storage has not confirmed deleted. */
|
|
55
|
+
export declare function sharesOwingObjectDelete(db?: DatabaseSync): ShareRow[];
|
|
56
|
+
export declare function markShareObjectDeleted(shareId: string, db?: DatabaseSync, at?: string): void;
|
|
57
|
+
/** Mark every upload `grantee` created for deletion (app removal); returns the
|
|
58
|
+
* ids newly marked. */
|
|
59
|
+
export declare function markGranteeUploadsDeletePending(grantee: string, db?: DatabaseSync, at?: string): string[];
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var i=Object.defineProperty;var a=(e,t)=>i(e,"name",{value:t,configurable:!0});import{openDb as l}from"../canvas/db.js";const p=a(e=>e??l(),"handle"),o=a(()=>new Date().toISOString(),"now");function S(e,t){p(t).prepare("INSERT INTO uploads (upload_id, grantee, name, media_type, size, created_at, delete_pending_since) VALUES (?, ?, ?, ?, ?, ?, NULL)").run(e.upload_id,e.grantee,e.name,e.media_type,e.size,e.created_at)}a(S,"insertUpload");function h(e,t){return p(t).prepare("SELECT * FROM uploads WHERE upload_id = ?").get(e)??null}a(h,"getUpload");function T(e,t){p(t).prepare("DELETE FROM uploads WHERE upload_id = ?").run(e)}a(T,"deleteUploadRow");function f(e){return p(e).prepare("SELECT * FROM uploads WHERE delete_pending_since IS NOT NULL ORDER BY delete_pending_since, upload_id").all()}a(f,"pendingUploadDeletes");function E(e,t,r=o()){const n=p(t).prepare("UPDATE uploads SET delete_pending_since = COALESCE(delete_pending_since, ?) WHERE upload_id = ?");for(const s of e)n.run(r,s)}a(E,"markUploadsDeletePending");function L(e,t){const r=p(t).prepare("INSERT INTO upload_uses (upload_id, run_id, path) VALUES (?, ?, ?)");for(const n of e)r.run(n.upload_id,n.run_id,n.path)}a(L,"insertUploadUses");function O(e,t){return p(t).prepare("SELECT upload_id, run_id, path FROM upload_uses WHERE path = ? ORDER BY run_id LIMIT 1").get(e)??null}a(O,"uploadUseAt");function x(e,t){const r=p(t);if(!e.length)return[];const n=e.map(()=>"?").join(","),s=r.prepare(`SELECT DISTINCT upload_id FROM upload_uses WHERE run_id IN (${n})`).all(...e).map(u=>u.upload_id);r.prepare(`DELETE FROM upload_uses WHERE run_id IN (${n})`).run(...e);const d=s.filter(u=>!r.prepare("SELECT 1 FROM upload_uses WHERE upload_id = ? LIMIT 1").get(u));return E(d,r),d}a(x,"releaseRunUploads");function D(e,t){return p(t).prepare(`SELECT upload_id FROM uploads u WHERE delete_pending_since IS NULL AND created_at <= ?
|
|
2
|
+
AND NOT EXISTS (SELECT 1 FROM upload_uses x WHERE x.upload_id = u.upload_id)`).all(e).map(r=>r.upload_id)}a(D,"staleUnusedUploads");function N(e,t){p(t).prepare(`INSERT INTO shares (share_id, source_space, source_path, storage_key, url, created_by, created_at, expires_at, status, object_deleted_at)
|
|
3
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, 'on', NULL)`).run(e.share_id,e.source_space,e.source_path,e.storage_key,e.url,e.created_by,e.created_at,e.expires_at)}a(N,"insertShare");function U(e,t){return p(t).prepare("SELECT * FROM shares WHERE share_id = ?").get(e)??null}a(U,"getShare");function g(e,t){return e===null?p(t).prepare("SELECT * FROM shares ORDER BY created_at DESC, share_id").all():p(t).prepare("SELECT * FROM shares WHERE created_by = ? ORDER BY created_at DESC, share_id").all(e)}a(g,"listShares");function _(e,t){p(t).prepare("UPDATE shares SET status = 'off' WHERE share_id = ?").run(e)}a(_,"turnShareOff");function C(e,t){const r=p(t),n=r.prepare("SELECT share_id FROM shares WHERE created_by = ? AND status = 'on'").all(e).map(s=>s.share_id);return r.prepare("UPDATE shares SET status = 'off' WHERE created_by = ? AND status = 'on'").run(e),n}a(C,"turnSharesOffFor");function H(e=o(),t){const r=p(t),n=r.prepare("SELECT share_id FROM shares WHERE status = 'on' AND expires_at IS NOT NULL AND expires_at <= ?").all(e).map(s=>s.share_id);for(const s of n)_(s,r);return n}a(H,"expireShares");function W(e){return p(e).prepare("SELECT * FROM shares WHERE status = 'off' AND object_deleted_at IS NULL ORDER BY created_at, share_id").all()}a(W,"sharesOwingObjectDelete");function A(e,t,r=o()){p(t).prepare("UPDATE shares SET object_deleted_at = COALESCE(object_deleted_at, ?) WHERE share_id = ?").run(r,e)}a(A,"markShareObjectDeleted");function I(e,t,r=o()){const n=p(t),s=n.prepare("SELECT upload_id FROM uploads WHERE grantee = ? AND delete_pending_since IS NULL").all(e).map(d=>d.upload_id);return E(s,n,r),s}a(I,"markGranteeUploadsDeletePending");export{T as deleteUploadRow,H as expireShares,U as getShare,h as getUpload,N as insertShare,S as insertUpload,L as insertUploadUses,g as listShares,I as markGranteeUploadsDeletePending,A as markShareObjectDeleted,E as markUploadsDeletePending,f as pendingUploadDeletes,x as releaseRunUploads,W as sharesOwingObjectDelete,D as staleUnusedUploads,_ as turnShareOff,C as turnSharesOffFor,O as uploadUseAt};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
var
|
|
2
|
-
data: ${JSON.stringify(
|
|
1
|
+
var k=Object.defineProperty;var i=(e,r)=>k(e,"name",{value:r,configurable:!0});import{randomUUID as C}from"node:crypto";import{createServer as x}from"node:http";import{Router as H}from"./router.js";import{OPERATIONS as I}from"./operations.js";import{AppPrincipalResolver as J}from"./principal.js";import{handleRunOperation as $,integer as U}from"./handlers/runs.js";import{parseLlmRequest as X,runLlm as j}from"../../core/llm/run.js";import{RunError as u}from"../../core/runs/operations.js";import{requireRun as T}from"./router.js";import{readRunEvents as A,registerGrantStream as z,subscribeRunEvents as B}from"../../core/runs/events.js";import{activeGrant as D}from"../../core/grants/mirror.js";import{emitEvent as G}from"../../core/events/emit.js";import{handleVendorSignIn as L,isVendorSignInPath as F}from"./vendor-signin.js";import{listAppProfiles as M}from"./handlers/app-profiles.js";import{handleTransferDownload as Q,handleTransferOperation as V,TRANSFER_OPERATIONS as W}from"./handlers/transfer.js";import{handleQuestionOperation as Y,QUESTION_OPERATIONS as K}from"./handlers/questions.js";const Z={other_app_run:"permission_error",unauthorized:"authentication_error",grant_revoked:"authentication_error",scope_missing:"permission_error",owner_only:"permission_error",invalid_request:"invalid_request_error",not_found:"invalid_request_error",model_unavailable:"invalid_request_error",substitution_refused:"invalid_request_error",payer_not_app:"invalid_request_error",all_routes_exhausted:"rate_limit_error",idempotency_conflict:"invalid_request_error",run_settled:"invalid_request_error",stream_gap:"invalid_request_error",stream_dropped:"server_error",runtime_starting:"server_error",storage_unavailable:"server_error",server_error:"server_error"};function R(e,r,n){return{error:{code:e.code,message:e.message,...e.details===void 0?{}:{details:e.details},type:Z[e.code]??"api_error",...e.param?{param:e.param}:{},origin:"runtime",retryable:e.retryable||e.code==="stream_dropped",request_id:r,...n?{run_id:n}:{},...e.scope?{scope:e.scope}:{},...e.code==="unauthorized"?{user_action:"reconnect"}:{},...e.code==="all_routes_exhausted"?{retry_after_s:e.details.retry_after_s}:{}}}}i(R,"envelope");function ee(e,r,n,s){const l=r instanceof u?r:new u(500,"server_error","runtime request failed");if(r instanceof u||console.error("[app-listener]",r),e.headersSent&&!String(e.getHeader("Content-Type")??"").startsWith("text/event-stream")){e.destroy();return}if(e.headersSent){e.end(`event: error
|
|
2
|
+
data: ${JSON.stringify(R(l,n,s))}
|
|
3
3
|
|
|
4
|
-
`);return}e.writeHead(
|
|
4
|
+
`);return}e.writeHead(l.status,{"Content-Type":"application/json; charset=utf-8","Request-Id":n,"X-Content-Type-Options":"nosniff",...l.code==="all_routes_exhausted"?{"Retry-After":String(l.details.retry_after_s)}:{}}),e.end(JSON.stringify(R(l,n,s)))}i(ee,"fail");function g(e,r,n){e.writeHead(r,{"Content-Type":"application/json; charset=utf-8"}),e.end(JSON.stringify(n))}i(g,"json");async function q(e){const r=[];let n=0;for await(const s of e){if(n+=s.length,n>4*1024*1024)throw new u(400,"invalid_request","request body too large");r.push(s)}if(n)try{return JSON.parse(Buffer.concat(r).toString("utf8"))}catch{throw new u(400,"invalid_request","invalid JSON body")}}i(q,"bodyOf");function te(e,r){const n=e.headers["last-event-id"]??r.get("after");if(Array.isArray(n))throw new u(400,"invalid_request","invalid cursor","after");return U(n??null,"after",0,Number.MAX_SAFE_INTEGER,0)}i(te,"cursor");function re(e){return`id: ${e.sequence_number}
|
|
5
5
|
event: ${e.type}
|
|
6
6
|
data: ${JSON.stringify(e)}
|
|
7
7
|
|
|
8
|
-
`}
|
|
8
|
+
`}i(re,"frame");function ne(e,r,n,s,l,b,m){T(s,n);let p=A(n,l);if(l>p.latest_sequence)throw new u(400,"invalid_request","cursor is beyond the run","after");if(l<p.latest_sequence&&(p.earliest_sequence===null||l<p.earliest_sequence-1))throw new u(409,"stream_gap","events have expired",void 0,{earliest_sequence:p.earliest_sequence,latest_sequence:p.latest_sequence});if(r.destroyed||e.destroyed)return r.destroy(),Promise.resolve();r.writeHead(200,{"Content-Type":m==="sse"?"text/event-stream":"application/x-ndjson","Cache-Control":"no-cache","X-Accel-Buffering":"no"}),m==="sse"?r.write(`: connected
|
|
9
9
|
|
|
10
|
-
`):r.flushHeaders();let
|
|
11
|
-
data: ${JSON.stringify(
|
|
10
|
+
`):r.flushHeaders();let a=l,t=!1,f=!1,_=!1,d;const v=new Promise(h=>{d=h}),o=i(()=>{t||(t=!0,clearInterval(P),N(),E(),r.off("close",o),r.off("drain",w),r.end(),d())},"end"),w=i(()=>{_=!1,c()},"onDrain"),y=i(h=>{t||r.write(m==="sse"?`event: error
|
|
11
|
+
data: ${JSON.stringify(R(h,b,n))}
|
|
12
12
|
|
|
13
|
-
`:`${JSON.stringify({type:"error",...
|
|
14
|
-
`),
|
|
15
|
-
`),
|
|
13
|
+
`:`${JSON.stringify({type:"error",...R(h,b,n)})}
|
|
14
|
+
`),o()},"error"),c=i(()=>{if(!(t||f)){f=!0;try{if(!O()){S();return}if(T(s,n),p=A(n,a),p.backlog_count>1e3||p.backlog_bytes>32*1024*1024){y(new u(503,"stream_dropped","stream reader fell behind",void 0,{last_sequence:a}));return}for(const h of p.events){if(_)break;_=!r.write(m==="sse"?re(h):`${JSON.stringify(h)}
|
|
15
|
+
`),a=h.sequence_number}}catch(h){y(h instanceof u?h:new u(500,"server_error","stream failed"))}finally{f=!1}}},"flush"),S=i(()=>y(new u(401,"grant_revoked","grant is not active")),"revoked"),O=i(()=>"class"in s||D(s.grant)!==null,"grantActive"),N=B(n,c),E="class"in s?()=>{}:z(s.grant,S),P=setInterval(()=>{!t&&!_&&m==="sse"&&r.write(`: keepalive
|
|
16
16
|
|
|
17
|
-
`)},15e3);return r.on("drain",w),r.on("close",
|
|
17
|
+
`)},15e3);return r.on("drain",w),r.on("close",o),c(),v}i(ne,"streamRunEvents");function be(e,r,n){if(!e.issuer||!e.audience||!e.listener?.address||!Number.isInteger(e.listener.port)||e.listener.port<1||e.listener.port>65535)throw new Error("runtime issuer, audience and listener address/port are required");if(["0.0.0.0","::","[::]"].includes(e.listener.address))throw new Error("runtime listener must bind a specific address");const s=new J(e.issuer,e.audience,n,e.jwksUrl),l=new H,b=new Map;for(const a of I.filter(t=>t.stage!==void 0)){const t=i(()=>({status:500}),"handler");l.register({method:a.method,pattern:a.path,handler:t}),b.set(t,a)}const m=x((a,t)=>{(async()=>{const f=C();t.setHeader("Request-Id",f);let _;try{const d=new URL(a.url??"/","http://runtime.local");if(F(d.pathname)){await L(a,t,d,s);return}if((a.method!=="GET"||d.pathname!=="/v1/health")&&(!s.isReady()||!r()))throw new u(503,"runtime_starting","runtime_starting");const v=l.match(a.method??"GET",d.pathname);if(!v)throw new u(404,"not_found","unknown operation");const o=b.get(v.handler);if(!o)throw new u(404,"not_found","unknown operation");if(_=v.params.run_id,o.name==="health"){g(t,200,{status:"ok",api_version:"2026-09-23"});return}if(o.name==="runtime.sync-notice"){if(!await s.verifySyncNotice(a.headers.authorization)){t.writeHead(204),t.end();return}G({level:"info",event:"daemon.grants.sync_notice",fields:{request_id:f}});try{await n({fresh:!0})}catch{throw new u(503,"server_error","grant sync failed")}t.writeHead(204),t.end();return}const w=await s.resolve(a.headers.authorization,o.scope);if(t.setHeader("Request-Id",f),_&&T(w,_,["run.message","run.interrupt","run.cancel","run.rename","run.delete"].includes(o.name),o.name==="run.delete"),o.stream==="bytes"){await Q(a,t,w,d.searchParams);return}if(o.stream){ne(a,t,_,w,te(a,d.searchParams),f,"sse");return}if(o.name==="llm"){const c=X(await q(a)),S=new AbortController,O=i(()=>S.abort(),"abort");t.on("close",O);try{const N=await j(c,S.signal,c.stream?E=>{t.headersSent||t.writeHead(200,{"Content-Type":"text/event-stream","Cache-Control":"no-cache","X-Accel-Buffering":"no"}),t.write(`data: ${JSON.stringify(E)}
|
|
18
18
|
|
|
19
|
-
`)}:void 0);
|
|
19
|
+
`)}:void 0);c.stream?(t.headersSent||t.writeHead(200,{"Content-Type":"text/event-stream","Cache-Control":"no-cache","X-Accel-Buffering":"no"}),t.end(`data: [DONE]
|
|
20
20
|
|
|
21
|
-
`)):
|
|
21
|
+
`)):g(t,200,N.completion)}finally{t.off("close",O)}return}if(o.name==="profile.list"){g(t,200,M(w));return}if(K.has(o.name)){const c=await Y(o.name,w,v.params.question_id,o.method==="POST"?await q(a):void 0);g(t,c.status,c.body);return}if(W.has(o.name)){const c=await V(o,w,v.params,d.searchParams,await q(a));g(t,c.status,c.body);return}const y=await $(o,w,_,d.searchParams,await q(a),a.headers["idempotency-key"]);g(t,y.status,y.body)}catch(d){ee(t,d,f,_)}})()});return{ready:new Promise((a,t)=>{m.once("error",t),m.listen(e.listener.port,e.listener.address,()=>{m.off("error",t),a()})}),close:i(async()=>{s.close(),m.closeAllConnections(),await new Promise((a,t)=>m.close(f=>f?t(f):a()))},"close")}}i(be,"createAppListener");export{be as createAppListener,te as cursor,ne as streamRunEvents};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AppPrincipal } from '../principal.js';
|
|
2
|
+
/** `profile.list` for an app caller (daemon-operations §profile.list): the
|
|
3
|
+
* caller's app's profiles, and each profile of another app B that its resolved
|
|
4
|
+
* scope set covers with `crtr:memory:rw:app:<B>:profile:<id>` (which
|
|
5
|
+
* `crtr:memory:rw:app:<B>` covers) — the visibility of the owner socket's
|
|
6
|
+
* `GET /v1/profiles` for an app. `default` marks the caller's own default
|
|
7
|
+
* profile. Creates, changes, and selects nothing beyond that default profile,
|
|
8
|
+
* which `run.start` without `profile` would create the same way. */
|
|
9
|
+
export declare function listAppProfiles(caller: AppPrincipal): {
|
|
10
|
+
profiles: Array<{
|
|
11
|
+
profile_id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
grantee: string;
|
|
14
|
+
default_kind: string;
|
|
15
|
+
default: boolean;
|
|
16
|
+
}>;
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var a=Object.defineProperty;var i=(e,o)=>a(e,"name",{value:o,configurable:!0});import{covers as f}from"@north-light/crouter-identity";import{ensureAppProfile as l,listProfiles as m}from"../../../core/profiles/manifest.js";function P(e){const o=l(e.grantee).profileId;return{profiles:m().filter(({profileId:t,manifest:r})=>{const n=r.grantee??"app:terminal";if(n===e.grantee)return!0;const p=`crtr:memory:rw:${n}:profile:${t}`;return e.resolved.some(s=>f(s,p))}).map(({profileId:t,manifest:r})=>({profile_id:t,name:r.name,grantee:r.grantee??"app:terminal",default_kind:r.default_kind??"general",default:t===o}))}}i(P,"listAppProfiles");export{P as listAppProfiles};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AppPrincipal } from '../principal.js';
|
|
2
|
+
export declare const QUESTION_OPERATIONS: Set<string>;
|
|
3
|
+
/** `question.get` / `question.answer` (daemon-operations §question.*) for an app caller. */
|
|
4
|
+
export declare function handleQuestionOperation(name: string, caller: AppPrincipal, questionId: string, body: unknown): Promise<{
|
|
5
|
+
status: number;
|
|
6
|
+
body: unknown;
|
|
7
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var q=Object.defineProperty;var o=(t,e)=>q(t,"name",{value:e,configurable:!0});import{validatePageTicketResponses as y}from"../../../core/human/tickets.js";import{getRequest as _}from"../../../core/human/requests.js";import{RunError as a}from"../../../core/runs/operations.js";import{getQuestion as g,questionObject as h,questionResult as b,questionStatus as d}from"../../../core/runs/questions.js";import{answerPageTicket as R}from"../../human/finish.js";import{requireRun as A}from"../router.js";const x=new Set(["question.get","question.answer"]),m=o(()=>new a(404,"not_found","question not found"),"missing");function p(t,e,n){const r=g(e);if(r===null)throw m();try{A(t,r.run.run_id,n)}catch(s){throw s instanceof a&&s.code==="not_found"?m():s}return r}o(p,"reachable");function w(t){const e=_(t);return new a(409,"run_settled",`question ${t} is already ${d(e)}`,void 0,{state:d(e),result:b(e)})}o(w,"settled");function O(t){return/slot(?: id)? "([^"]+)"/.exec(t)?.[1]??"responses"}o(O,"slotParam");async function Q(t,e,n,r){if(t==="question.get"){const{request:u,run:c}=p(e,n,!1);return{status:200,body:h(u,c)}}const{request:s}=p(e,n,!0);if(s.state==="settled")throw w(n);const i=r&&typeof r=="object"&&!Array.isArray(r)?r.responses:void 0;if(!i||typeof i!="object"||Array.isArray(i))throw new a(400,"invalid_request","responses must be an object keyed by slot id","responses");try{y(s.request_dir,i)}catch(u){const c=u instanceof Error?u.message:String(u);throw new a(400,"invalid_request",c,O(c))}const f=await R(s.request_id,i,{actor:e.grantee});if(f.outcome==="already_settled")throw w(n);const l=f.result;return{status:200,body:{question_id:s.request_id,status:"answered",answer:l.responses}}}o(Q,"handleQuestionOperation");export{x as QUESTION_OPERATIONS,Q as handleQuestionOperation};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var h=Object.defineProperty;var
|
|
1
|
+
var h=Object.defineProperty;var c=(s,t)=>h(s,"name",{value:t,configurable:!0});import{RunError as n,cancelRun as g,deleteRun as b,interruptRun as v,listRuns as k,messageRun as y,renameRun as q,requestedScopes as R,startRun as $,traceRun as N,waitRun as j}from"../../../core/runs/operations.js";import{canReadRun as x,requireRun as d,runCallerApp as O}from"../router.js";function l(s){if(!s||typeof s!="object"||Array.isArray(s))throw new n(400,"invalid_request","a JSON object is required");return s}c(l,"object");function w(s,t,o,u,i){if(s===null)return i;if(!/^(0|[1-9]\d*)$/.test(s)||!Number.isSafeInteger(Number(s))||Number(s)<o||Number(s)>u)throw new n(400,"invalid_request",`invalid ${t}`,t);return Number(s)}c(w,"integer");async function B(s,t,o,u,i,p){switch(s.name){case"grant.get":{if("class"in t)throw new n(403,"permission_error","an app token is required");return{status:200,body:{sub:t.sub,grantee:t.grantee,client_id:t.client_id,grant:t.grant,rev:t.rev,resolved_scopes:t.resolved_scopes,spend_cap:t.spend_cap,exp:t.exp,payer:"user"}}}case"run.start":{if("class"in t)throw new n(403,"permission_error","an app token is required");const e=l(i),r=["mode","parent","fork_from","node_id","env","tools","system_prompt"];for(const a of r)if(e[a]!==void 0)throw new n(403,"owner_only",`${a} is owner-only`,a);const f=["payer","model","model_policy","output_schema","deadline","cwd","worktree","kind"];for(const a of f)if(e[a]!==void 0)throw new n(400,"invalid_request",`${a} is not available`,a);for(const a of Object.keys(e))if(!["prompt","scopes","metadata","profile"].includes(a))throw new n(400,"invalid_request",`unknown field ${a}`,a);if(e.profile!==void 0&&(typeof e.profile!="string"||!e.profile))throw new n(400,"invalid_request","profile must be a profile id","profile");if(typeof e.prompt!="string"||!e.prompt.trim())throw new n(400,"invalid_request","prompt is required","prompt");const m=e.metadata===void 0?{}:l(e.metadata);if(Buffer.byteLength(JSON.stringify(m))>4096)throw new n(400,"invalid_request","metadata exceeds 4 KB","metadata");const _=R(t.resolved,e.scopes,t.grantee);return{status:201,body:await $(t,{prompt:e.prompt,scopes:_,metadata:m,profile:e.profile},p)}}case"run.list":{const e=u.get("status")??void 0;if(e&&!["running","waiting_on_user","idle","settled"].includes(e))throw new n(400,"invalid_request","invalid status","status");const r=u.get("app");if(r!==null&&!/^(?:app:)?[a-z0-9][a-z0-9-]*$/.test(r))throw new n(400,"invalid_request","invalid app","app");const f=r===null?O(t):r.startsWith("app:")?r:`app:${r}`;if(f!==null&&!x(t,f))throw new n(404,"not_found","run not found");return{status:200,body:k(f,{status:e,after:u.get("after")??void 0,limit:w(u.get("limit"),"limit",1,100,50)})}}case"run.get":{const e=u.has("wait")?w(u.get("wait"),"wait",1,25,0):0,r=d(t,o),f=await j(o,r.grantee,e);return d(t,o),{status:200,body:f}}case"run.message":{const e=l(i);if(typeof e.message!="string"||!e.message.trim())throw new n(400,"invalid_request","message is required","message");return{status:202,body:await y(d(t,o,!0),e.message)}}case"run.interrupt":{const e=l(i===void 0?{}:i);if(e.children!==void 0&&e.children!=="stop"&&e.children!=="continue")throw new n(400,"invalid_request","invalid children","children");return{status:200,body:await v(d(t,o,!0),e.children)}}case"run.cancel":{const e=l(i===void 0?{}:i);if(e.keep_schedules!==void 0&&typeof e.keep_schedules!="boolean")throw new n(400,"invalid_request","invalid keep_schedules","keep_schedules");return{status:200,body:await g(d(t,o,!0),{keepSchedules:e.keep_schedules})}}case"run.rename":{const e=l(i);for(const r of Object.keys(e))if(r!=="name")throw new n(400,"invalid_request",`unknown field ${r}`,r);return{status:200,body:q(d(t,o,!0),e.name)}}case"run.delete":{const{uploads_pending:e}=await b(d(t,o,!0,!0));return{status:200,body:{run_id:o,uploads_pending:e}}}case"trace.get":{const e=u.get("format")??void 0;if(e&&e!=="entries")throw new n(400,"invalid_request","unknown trace format","format");const r=d(t,o);return{status:200,body:N(o,r.grantee,e)}}default:throw new n(404,"not_found","unknown operation")}}c(B,"handleRunOperation");export{B as handleRunOperation,w as integer};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
2
|
+
import type { FileCaller } from '../../../core/spaces/permissions.js';
|
|
3
|
+
import type { AppOperation } from '../operations.js';
|
|
4
|
+
import type { AppPrincipal } from '../principal.js';
|
|
5
|
+
/** The app-listener rows of file transfer (daemon-operations §File transfer). */
|
|
6
|
+
export declare const TRANSFER_OPERATIONS: Set<string>;
|
|
7
|
+
/** An app caller's file permission: its grant, with no narrower launched list. */
|
|
8
|
+
export declare function fileCaller(caller: AppPrincipal): FileCaller;
|
|
9
|
+
/** JSON rows. `file.download` streams and goes through `handleTransferDownload`. */
|
|
10
|
+
export declare function handleTransferOperation(operation: AppOperation, caller: AppPrincipal, params: Record<string, string>, query: URLSearchParams, body: unknown): Promise<{
|
|
11
|
+
status: number;
|
|
12
|
+
body: unknown;
|
|
13
|
+
}>;
|
|
14
|
+
/** `file.download` (`stream: 'bytes'`): raw bytes with `Range` support. */
|
|
15
|
+
export declare function handleTransferDownload(req: IncomingMessage, res: ServerResponse, caller: AppPrincipal, query: URLSearchParams): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var h=Object.defineProperty;var s=(e,a)=>h(e,"name",{value:a,configurable:!0});import{isAbsolute as w,resolve as _}from"node:path";import{RunError as n}from"../../../core/runs/operations.js";import{invalidStorageName as m,storageClient as l,StorageRefused as y,UPLOAD_MAX_BYTES as g}from"../../../core/storage/client.js";import{serveDownload as b}from"../../../core/storage/download.js";import{createShare as q,deleteOwnShare as v,listOwnShares as A}from"../../../core/storage/shares.js";import{getUpload as S,insertUpload as k,uploadUseAt as x}from"../../../core/storage/tables.js";import{requireRun as z}from"../router.js";const C=new Set(["upload.create","attachment.link","file.download","share.create","share.list","share.delete"]);function c(e){if(!e||typeof e!="object"||Array.isArray(e))throw new n(400,"invalid_request","a JSON object is required");return e}s(c,"object");function f(e){return{app:e.grantee,resolved:e.resolved,launched:null}}s(f,"fileCaller");const O=/^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}\/[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}(?:\s*;.{0,200})?$/;async function T(e,a){const i=c(a);for(const p of Object.keys(i))if(!["name","media_type","size"].includes(p))throw new n(400,"invalid_request",`unknown field ${p}`,p);const{name:r,media_type:o,size:t}=i;if(typeof t!="number"||!Number.isSafeInteger(t)||t<0)throw new n(400,"invalid_request","size must be a non-negative integer","size");if(t>g)throw new n(400,"invalid_request","size exceeds 100 MiB","size");if(typeof r!="string")throw new n(400,"invalid_request","name is required","name");const d=m(r);if(d)throw new n(400,"invalid_request",d,"name");if(typeof o!="string"||!O.test(o))throw new n(400,"invalid_request","media_type must be a media type","media_type");const u=await l().createUpload({name:r,media_type:o,size:t});return k({upload_id:u.upload_id,grantee:e.grantee,name:r,media_type:o,size:t,created_at:new Date().toISOString()}),{upload_id:u.upload_id,url:u.url,upload_link:u.upload_link,expires_at:u.expires_at}}s(T,"uploadCreate");async function D(e,a){if(!a)throw new n(400,"invalid_request","path is required","path");if(!w(a))throw new n(400,"invalid_request","path must be absolute","path");const i=x(_(a)),r=s(()=>new n(404,"not_found","no upload is recorded at that path"),"missing");if(!i)throw r();try{z(e,i.run_id)}catch(t){throw t instanceof n&&t.code==="not_found"?r():t}const o=S(i.upload_id);if(!o||o.delete_pending_since)throw r();try{return await l().signDownload(i.upload_id)}catch(t){throw t instanceof y?r():t}}s(D,"attachmentLink");async function M(e,a,i,r,o){switch(e.name){case"upload.create":return{status:201,body:await T(a,o)};case"attachment.link":return{status:200,body:await D(a,r.get("path"))};case"share.create":{const t=c(o);for(const d of Object.keys(t))if(!["path","expires_at"].includes(d))throw new n(400,"invalid_request",`unknown field ${d}`,d);return{status:201,body:await q(f(a),{path:t.path,expires_at:t.expires_at})}}case"share.list":return{status:200,body:A(a.grantee)};case"share.delete":return{status:200,body:await v(a.grantee,i.share_id)};default:throw new n(404,"not_found","unknown operation")}}s(M,"handleTransferOperation");function P(e,a,i,r){return b(e,a,f(i),r.get("path"))}s(P,"handleTransferDownload");export{C as TRANSFER_OPERATIONS,f as fileCaller,P as handleTransferDownload,M as handleTransferOperation};
|
|
@@ -10,7 +10,8 @@ export interface Operation {
|
|
|
10
10
|
resource: ResourceRule;
|
|
11
11
|
stage?: string;
|
|
12
12
|
idempotency?: string;
|
|
13
|
-
|
|
13
|
+
/** How the response is sent: `true` server-sent run events; `'bytes'` a file's raw bytes (`Range` → 206). */
|
|
14
|
+
stream?: true | 'bytes';
|
|
14
15
|
wait?: boolean;
|
|
15
16
|
}
|
|
16
17
|
export type AppOperation = Operation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var n=Object.defineProperty;var r=(e,s)=>n(e,"name",{value:s,configurable:!0});const a=[{name:"health",method:"GET",path:"/v1/health",classes:["anonymous"],resource:"none",stage:"v0.5"},{name:"chat-inventory.get.1",method:"GET",path:"/v1/nodes/:id/chat-inventory",classes:["person","broker"],resource:"node-read"},{name:"model-config.put.2",method:"PUT",path:"/v1/model-config",classes:["person"],resource:"none"},{name:"files.get.3",method:"GET",path:"/v1/files/peek",classes:["person","broker"],resource:"none"},{name:"files.post.4",method:"POST",path:"/v1/files/write",classes:["person","broker"],resource:"none"},{name:"files.get.5",method:"GET",path:"/v1/files/list",classes:["person","broker"],resource:"none"},{name:"reviews.post.6",method:"POST",path:"/v1/human/reviews",classes:["person","broker"],resource:"human",scope:"crtr:act"},{name:"reviews.get.7",method:"GET",path:"/v1/human/reviews",classes:["person","broker"],resource:"human"},{name:"reviews.get.8",method:"GET",path:"/v1/human/reviews/:review_id",classes:["person","broker"],resource:"human"},{name:"reviews.post.9",method:"POST",path:"/v1/human/reviews/:review_id/submit",classes:["person","broker"],resource:"human"},{name:"reviews.post.10",method:"POST",path:"/v1/human/reviews/:review_id/cancel",classes:["person","broker"],resource:"human"},{name:"reviews.get.11",method:"GET",path:"/v1/human/reviews/:review_id/document",classes:["person","broker"],resource:"human"},{name:"feedback-comments.post.12",method:"POST",path:"/v1/human/inbox/:ticket_id/feedback-comments",classes:["person","broker"],resource:"human"},{name:"feedback-comments.post.13",method:"POST",path:"/v1/human/inbox/:ticket_id/feedback-comments/:comment_id/resolve",classes:["person","broker"],resource:"human"},{name:"node.log.append",method:"POST",path:"/v1/nodes/:id/records/log",classes:["person","broker"],resource:"node-own"},{name:"node.telemetry.put",method:"PUT",path:"/v1/nodes/:id/records/telemetry",classes:["person","broker"],resource:"node-own"},{name:"node.recap.put",method:"PUT",path:"/v1/nodes/:id/records/recap",classes:["person","broker"],resource:"node-own"},{name:"node.inbox.read",method:"GET",path:"/v1/nodes/:id/records/inbox",classes:["person","broker"],resource:"node-own"},{name:"node.passive.read",method:"GET",path:"/v1/nodes/:id/records/passive",classes:["person","broker"],resource:"node-own"},{name:"node.pushed-final",method:"POST",path:"/v1/nodes/:id/records/pushed-final",classes:["person","broker"],resource:"node-own"},{name:"broker-ops.post.14",method:"POST",path:"/v1/nodes/:id/broker/session-bound",classes:["person","broker"],resource:"node-own"},{name:"broker-ops.post.15",method:"POST",path:"/v1/nodes/:id/broker/settle",classes:["person","broker"],resource:"node-own"},{name:"broker-ops.post.16",method:"POST",path:"/v1/nodes/:id/broker/park-complete",classes:["person","broker"],resource:"node-own"},{name:"broker-ops.post.17",method:"POST",path:"/v1/nodes/:id/broker/park-activity",classes:["person","broker"],resource:"node-own"},{name:"broker-ops.post.18",method:"POST",path:"/v1/nodes/:id/broker/telemetry",classes:["person","broker"],resource:"node-own"},{name:"broker-ops.post.19",method:"POST",path:"/v1/nodes/:id/broker/model",classes:["person","broker"],resource:"node-own"},{name:"broker-ops.get.20",method:"GET",path:"/v1/nodes/:id/broker/extension-state",classes:["person","broker"],resource:"node-own"},{name:"broker-ops.context",method:"POST",path:"/v1/nodes/:id/broker/context",classes:["person","broker"],resource:"node-own"},{name:"broker-ops.memory-refs",method:"POST",path:"/v1/nodes/:id/broker/memory-refs",classes:["person","broker"],resource:"node-own"},{name:"broker-ops.context-commit",method:"POST",path:"/v1/nodes/:id/broker/context/commit",classes:["person","broker"],resource:"node-own"},{name:"broker-ops.context-event",method:"POST",path:"/v1/nodes/:id/broker/context/event",classes:["person","broker"],resource:"node-own"},{name:"broker-ops.post.21",method:"POST",path:"/v1/nodes/:id/broker/generated-name",classes:["person","broker"],resource:"node-own"},{name:"broker-ops.post.22",method:"POST",path:"/v1/nodes/:id/broker/persona-ack",classes:["person","broker"],resource:"node-own"},{name:"memory.get.23",method:"GET",path:"/v1/memory/docs",classes:["person","app","broker"],resource:"memory"},{name:"memory.get.24",method:"GET",path:"/v1/memory/docs/:name",classes:["person","app","broker"],resource:"memory"},{name:"memory.post.25",method:"POST",path:"/v1/memory/docs",classes:["person","app","broker"],resource:"memory"},{name:"memory.patch.26",method:"PATCH",path:"/v1/memory/docs/:name",classes:["person","app","broker"],resource:"memory"},{name:"memory.delete.27",method:"DELETE",path:"/v1/memory/docs/:name",classes:["person","app","broker"],resource:"memory"},{name:"memory.post.28",method:"POST",path:"/v1/memory/docs/:name/move",classes:["person","app","broker"],resource:"memory"},{name:"memory.post.29",method:"POST",path:"/v1/memory/search",classes:["person","app","broker"],resource:"memory"},{name:"memory.get.30",method:"GET",path:"/v1/memory/docs/:name/history",classes:["person","app","broker"],resource:"memory"},{name:"memory.get.31",method:"GET",path:"/v1/memory/resolve",classes:["person","app","broker"],resource:"memory"},{name:"memory.get.32",method:"GET",path:"/v1/memory/origin",classes:["person","app","broker"],resource:"memory"},{name:"memory.lint",method:"POST",path:"/v1/memory/lint",classes:["person","app","broker"],resource:"memory"},{name:"memory.extensions",method:"GET",path:"/v1/memory/extensions",classes:["person","broker"],resource:"memory"},{name:"memory.slash.list",method:"GET",path:"/v1/memory/slash",classes:["person","broker"],resource:"memory"},{name:"memory.slash.attachments",method:"POST",path:"/v1/memory/slash/attachments",classes:["person","broker"],resource:"memory"},{name:"health.get.33",method:"GET",path:"/healthz",classes:["anonymous"],resource:"none"},{name:"health.get.34",method:"GET",path:"/v1/status",classes:["person"],resource:"none"},{name:"bash-jobs.start",method:"POST",path:"/v1/nodes/:id/jobs/start",classes:["broker"],resource:"node-own",scope:"crtr:act"},{name:"hooks.plan",method:"GET",path:"/v1/nodes/:id/hooks/plan",classes:["broker"],resource:"node-own"},{name:"hooks.exec",method:"POST",path:"/v1/nodes/:id/hooks/exec",classes:["broker"],resource:"node-own"},{name:"hooks.exec.person",method:"POST",path:"/v1/hooks/exec",classes:["person"],resource:"none"},{name:"bash-jobs.get.35",method:"GET",path:"/v1/nodes/:id/jobs",classes:["person","broker"],resource:"node-read"},{name:"bash-jobs.delete.36",method:"DELETE",path:"/v1/nodes/:id/jobs/:jobId",classes:["person","broker"],resource:"node-write"},{name:"prospective-chat-inventory.get.37",method:"GET",path:"/v1/prospective-chat-inventory",classes:["person"],resource:"none"},{name:"node-events.get.38",method:"GET",path:"/v1/nodes/:id/events",classes:["person","broker"],resource:"node-read"},{name:"bash.post.39",method:"POST",path:"/v1/bash",classes:["person","broker"],resource:"daemon-bash",scope:"crtr:act"},{name:"subscriptions.post.40",method:"POST",path:"/v1/nodes/:id/subscriptions",classes:["person","broker"],resource:"node-write"},{name:"subscriptions.delete.41",method:"DELETE",path:"/v1/nodes/:id/subscriptions/:target",classes:["person","broker"],resource:"node-write"},{name:"attach.post.42",method:"POST",path:"/v1/nodes/:id/attach",classes:["person"],resource:"none"},{name:"review-comments.post.44",method:"POST",path:"/v1/human/reviews/self/comments",classes:["person","broker"],resource:"human"},{name:"review-comments.get.45",method:"GET",path:"/v1/human/reviews/self/comments",classes:["person","broker"],resource:"human"},{name:"review-comments.post.46",method:"POST",path:"/v1/human/reviews/:review_id/comments",classes:["person","broker"],resource:"human"},{name:"review-comments.get.47",method:"GET",path:"/v1/human/reviews/:review_id/comments",classes:["person","broker"],resource:"human"},{name:"review-comments.get.48",method:"GET",path:"/v1/human/reviews/:review_id/comment-events",classes:["person","broker"],resource:"human"},{name:"review-comments.post.49",method:"POST",path:"/v1/human/reviews/:review_id/comment-ranges",classes:["person","broker"],resource:"human"},{name:"review-comments.get.50",method:"GET",path:"/v1/human/comments/:comment_id",classes:["person","broker"],resource:"human"},{name:"review-comments.post.51",method:"POST",path:"/v1/human/comments/:comment_id/edit",classes:["person","broker"],resource:"human"},{name:"review-comments.post.52",method:"POST",path:"/v1/human/comments/:comment_id/resolve",classes:["person","broker"],resource:"human"},{name:"review-comments.post.53",method:"POST",path:"/v1/human/comments/:comment_id/reopen",classes:["person","broker"],resource:"human"},{name:"review-comments.post.54",method:"POST",path:"/v1/human/comments/:comment_id/delete",classes:["person","broker"],resource:"human"},{name:"review-comments.post.55",method:"POST",path:"/v1/human/comments/:comment_id/fork",classes:["person","broker"],resource:"human"},{name:"messages.post.56",method:"POST",path:"/v1/nodes/:id/mail/claim",classes:["person","broker"],resource:"node-own"},{name:"messages.post.57",method:"POST",path:"/v1/nodes/:id/mail/acknowledge",classes:["person","broker"],resource:"node-own"},{name:"messages.post.58",method:"POST",path:"/v1/nodes/:id/messages",classes:["person","broker"],resource:"node-write"},{name:"messages.post.59",method:"POST",path:"/v1/nodes/:id/interrupt",classes:["person","broker"],resource:"node-write"},{name:"reports.post.60",method:"POST",path:"/v1/nodes/:id/reports",classes:["person","broker"],resource:"node-own"},{name:"reports.get.61",method:"GET",path:"/v1/nodes/:id/reports",classes:["person","broker"],resource:"node-read"},{name:"reports.post.62",method:"POST",path:"/v1/nodes/:id/result",classes:["person","broker"],resource:"node-own"},{name:"inbox.get.63",method:"GET",path:"/v1/human/inbox",classes:["person","broker"],resource:"human"},{name:"inbox.get.64",method:"GET",path:"/v1/human/inbox/history",classes:["person","broker"],resource:"human"},{name:"inbox.get.65",method:"GET",path:"/v1/human/inbox/:ticket_id",classes:["person","broker"],resource:"human"},{name:"inbox.get.66",method:"GET",path:"/v1/human/inbox/:ticket_id/response",classes:["person","broker"],resource:"human"},{name:"inbox.post.67",method:"POST",path:"/v1/human/inbox/:ticket_id/respond",classes:["person","broker"],resource:"human"},{name:"inbox.post.68",method:"POST",path:"/v1/human/inbox/:ticket_id/progress",classes:["person","broker"],resource:"human"},{name:"inbox.post.69",method:"POST",path:"/v1/human/inbox/:ticket_id/cancel",classes:["person","broker"],resource:"human"},{name:"worktree.post.70",method:"POST",path:"/v1/nodes/:id/worktree/close",classes:["person","broker"],resource:"node-write"},{name:"worktree.post.71",method:"POST",path:"/v1/nodes/:id/worktree/abandon",classes:["person","broker"],resource:"node-write"},{name:"worktree.get.72",method:"GET",path:"/v1/worktrees/quarantined",classes:["person"],resource:"none"},{name:"crons.post.73",method:"POST",path:"/v1/crons",classes:["person","app","broker"],resource:"cron",scope:"crtr:schedule"},{name:"crons.get.74",method:"GET",path:"/v1/crons",classes:["person","app","broker"],resource:"cron"},{name:"crons.get.75",method:"GET",path:"/v1/crons/:cronId",classes:["person","app","broker"],resource:"cron"},{name:"crons.post.76",method:"POST",path:"/v1/crons/:cronId/pause",classes:["person","app","broker"],resource:"cron",scope:"crtr:schedule"},{name:"crons.post.77",method:"POST",path:"/v1/crons/:cronId/resume",classes:["person","app","broker"],resource:"cron",scope:"crtr:schedule"},{name:"crons.post.78",method:"POST",path:"/v1/crons/poke",classes:["person","app","broker"],resource:"cron",scope:"crtr:schedule"},{name:"crons.post.79",method:"POST",path:"/v1/crons/:cronId/run",classes:["person","app","broker"],resource:"cron",scope:"crtr:schedule"},{name:"crons.delete.80",method:"DELETE",path:"/v1/crons/:cronId",classes:["person","app","broker"],resource:"cron",scope:"crtr:schedule"},{name:"modelauth.get.81",method:"GET",path:"/v1/model-auth",classes:["person"],resource:"none"},{name:"modelauth.get.82",method:"GET",path:"/v1/model-auth/readiness",classes:["person"],resource:"none"},{name:"modelauth.put.83",method:"PUT",path:"/v1/model-auth/:provider",classes:["person"],resource:"none"},{name:"modelauth.delete.84",method:"DELETE",path:"/v1/model-auth/:provider",classes:["person"],resource:"none"},{name:"model_auth.start",method:"POST",path:"/v1/model-auth/flows",classes:["person"],resource:"none"},{name:"model_auth.complete",method:"POST",path:"/v1/model-auth/flows/:flow_id/complete",classes:["person"],resource:"none"},{name:"model_auth.cancel",method:"POST",path:"/v1/model-auth/flows/:flow_id/cancel",classes:["person"],resource:"none"},{name:"model_auth.get",method:"GET",path:"/v1/model-auth/flows/:flow_id",classes:["person"],resource:"none",wait:!0},{name:"nodes.post.85",method:"POST",path:"/v1/nodes",classes:["person","broker"],resource:"node-own",scope:"crtr:act"},{name:"nodes.get.86",method:"GET",path:"/v1/nodes",classes:["person","broker"],resource:"nodes-list"},{name:"nodes.post.87",method:"POST",path:"/v1/nodes/revive-all",classes:["person"],resource:"none"},{name:"nodes.get.88",method:"GET",path:"/v1/nodes/:id",classes:["person","broker"],resource:"node-read"},{name:"nodes.get.89",method:"GET",path:"/v1/nodes/:id/snapshot",classes:["person","broker"],resource:"node-read"},{name:"nodes.get.90",method:"GET",path:"/v1/nodes/:id/subject",classes:["person","broker"],resource:"node-read"},{name:"nodes.get.91",method:"GET",path:"/v1/nodes/:id/messages",classes:["person","broker"],resource:"node-read"},{name:"nodes.get.92",method:"GET",path:"/v1/nodes/:id/session",classes:["person","broker"],resource:"node-read"},{name:"nodes.get.93",method:"GET",path:"/v1/nodes/:id/transcript",classes:["person","broker"],resource:"node-read"},{name:"nodes.get.94",method:"GET",path:"/v1/nodes/:id/context",classes:["person","broker"],resource:"node-read"},{name:"nodes.get.95",method:"GET",path:"/v1/nodes/:id/artifacts",classes:["person","broker"],resource:"node-read"},{name:"nodes.post.96",method:"POST",path:"/v1/nodes/:id/fork",classes:["person","broker"],resource:"node-write",scope:"crtr:act"},{name:"nodes.post.97",method:"POST",path:"/v1/nodes/:id/revive",classes:["person","broker"],resource:"node-write",scope:"crtr:act"},{name:"nodes.post.98",method:"POST",path:"/v1/nodes/:id/relaunch-root",classes:["person","broker"],resource:"node-write",scope:"crtr:act"},{name:"nodes.post.99",method:"POST",path:"/v1/nodes/:id/close",classes:["person","broker"],resource:"node-write",scope:"crtr:act"},{name:"nodes.post.100",method:"POST",path:"/v1/nodes/:id/recycle",classes:["person","broker"],resource:"node-write",scope:"crtr:act"},{name:"nodes.post.101",method:"POST",path:"/v1/nodes/:id/demote",classes:["person","broker"],resource:"node-write",scope:"crtr:act"},{name:"nodes.post.102",method:"POST",path:"/v1/nodes/:id/promote",classes:["person","broker"],resource:"node-write",scope:"crtr:act"},{name:"nodes.post.103",method:"POST",path:"/v1/nodes/:id/yield",classes:["person","broker"],resource:"node-write",scope:"crtr:act"},{name:"nodes.post.104",method:"POST",path:"/v1/nodes/:id/wait",classes:["person","broker"],resource:"node-write",scope:"crtr:act"},{name:"nodes.patch.105",method:"PATCH",path:"/v1/nodes/:id/config",classes:["person","broker"],resource:"node-write",scope:"crtr:act"},{name:"broker-recovery.post.106",method:"POST",path:"/v1/broker/:id/turn",classes:["person","broker"],resource:"node-own"},{name:"broker-recovery.post.107",method:"POST",path:"/v1/broker/:id/provider-retry",classes:["person","broker"],resource:"node-own"},{name:"broker-recovery.post.108",method:"POST",path:"/v1/broker/:id/fault",classes:["person","broker"],resource:"node-own"},{name:"broker-recovery.get.109",method:"GET",path:"/v1/broker/:id/recovery",classes:["person","broker"],resource:"node-own"},{name:"broker-recovery.post.110",method:"POST",path:"/v1/nodes/:id/fault",classes:["person","broker"],resource:"node-write"},{name:"broker-recovery.delete.111",method:"DELETE",path:"/v1/nodes/:id/fault",classes:["person","broker"],resource:"node-write"},{name:"profiles.put.112",method:"PUT",path:"/v1/profiles/:name",classes:["person","app","broker"],resource:"profile"},{name:"profiles.post.113",method:"POST",path:"/v1/profiles/:name/pause",classes:["person"],resource:"profile"},{name:"profiles.post.114",method:"POST",path:"/v1/profiles/:name/resume",classes:["person"],resource:"profile"},{name:"profiles.patch.115",method:"PATCH",path:"/v1/profiles/:name/metadata",classes:["person","app","broker"],resource:"profile"},{name:"profile.create",method:"POST",path:"/v1/profiles",classes:["person","app","broker"],resource:"profile"},{name:"profile.update",method:"PATCH",path:"/v1/profiles/:name",classes:["person","app","broker"],resource:"profile"},{name:"profile.env.list",method:"GET",path:"/v1/profiles/:name/env",classes:["person","app","broker"],resource:"profile"},{name:"profile.env.set",method:"PUT",path:"/v1/profiles/:name/env/:var",classes:["person","app","broker"],resource:"profile"},{name:"profile.env.remove",method:"DELETE",path:"/v1/profiles/:name/env/:var",classes:["person","app","broker"],resource:"profile"},{name:"profiles.delete.116",method:"DELETE",path:"/v1/profiles/:name",classes:["person","app","broker"],resource:"profile"},{name:"profiles.get.117",method:"GET",path:"/v1/profiles",classes:["person","app","broker"],resource:"profile"},{name:"profiles.get.118",method:"GET",path:"/v1/profiles/:name",classes:["person","app","broker"],resource:"profile"},{name:"node-outcomes.get.119",method:"GET",path:"/v1/nodes/:id/outcome",classes:["person","broker"],resource:"node-read"},{name:"node-outcomes.put.120",method:"PUT",path:"/v1/nodes/:id/outcome-delivery",classes:["person","broker"],resource:"node-write"},{name:"node-outcomes.get.121",method:"GET",path:"/v1/nodes/:id/outcome-delivery",classes:["person","broker"],resource:"node-read"},{name:"node-outcomes.delete.122",method:"DELETE",path:"/v1/nodes/:id/outcome-delivery",classes:["person","broker"],resource:"node-write"},{name:"canvas.get.123",method:"GET",path:"/v1/canvas/attention",classes:["person","broker"],resource:"canvas-read"},{name:"canvas.post.124",method:"POST",path:"/v1/canvas/attention/counts",classes:["person","broker"],resource:"canvas-read"},{name:"canvas.post.125",method:"POST",path:"/v1/canvas/history/search",classes:["person","broker"],resource:"canvas-read"},{name:"canvas.post.126",method:"POST",path:"/v1/canvas/history/grep",classes:["person","broker"],resource:"canvas-read"},{name:"canvas.get.127",method:"GET",path:"/v1/canvas/history/read",classes:["person","broker"],resource:"canvas-read"},{name:"canvas.post.128",method:"POST",path:"/v1/canvas/history/stats",classes:["person","broker"],resource:"canvas-read"},{name:"canvas.get.129",method:"GET",path:"/v1/canvas/snapshot",classes:["person","broker"],resource:"canvas-read"},{name:"canvas.get.130",method:"GET",path:"/v1/canvas/roster",classes:["person","broker"],resource:"canvas-read"},{name:"canvas.get.analytics",method:"GET",path:"/v1/canvas/analytics",classes:["person"],resource:"canvas-read"},{name:"memory-reads.post",method:"POST",path:"/v1/nodes/:id/memory-reads",classes:["person","broker"],resource:"node-own"},{name:"canvas.get.131",method:"GET",path:"/v1/canvas/graph",classes:["person","broker"],resource:"canvas-read"},{name:"canvas.post.132",method:"POST",path:"/v1/canvas/prune",classes:["person"],resource:"none"},{name:"daemon.post.133",method:"POST",path:"/v1/daemon/restart",classes:["person"],resource:"none"},{name:"daemon.post.134",method:"POST",path:"/v1/daemon/migrate",classes:["person"],resource:"none"},{name:"daemon.post.135",method:"POST",path:"/v1/daemon/admit",classes:["person"],resource:"none"},{name:"human.components.list",method:"GET",path:"/v1/human/components",classes:["person","broker"],resource:"none"},{name:"human-requests.post.136",method:"POST",path:"/v1/human/requests",classes:["person","broker"],resource:"human",scope:"crtr:act"},{name:"human-requests.get.137",method:"GET",path:"/v1/human/requests/:request_id",classes:["person","broker"],resource:"human"},{name:"human-requests.post.138",method:"POST",path:"/v1/human/requests/:request_id/replace",classes:["person","broker"],resource:"human"},{name:"human-requests.post.139",method:"POST",path:"/v1/human/requests/:request_id/respond",classes:["person","broker"],resource:"human"},{name:"human-requests.post.140",method:"POST",path:"/v1/human/requests/:request_id/dismiss",classes:["person","broker"],resource:"human"},{name:"human-requests.post.141",method:"POST",path:"/v1/human/requests/:request_id/cancel",classes:["person","broker"],resource:"human"},{name:"focus.get.142",method:"GET",path:"/v1/focuses",classes:["person"],resource:"none"},{name:"focus.post.143",method:"POST",path:"/v1/focuses",classes:["person"],resource:"none"},{name:"focus.get.144",method:"GET",path:"/v1/focuses/by-node",classes:["person"],resource:"none"},{name:"focus.get.145",method:"GET",path:"/v1/focuses/by-pane",classes:["person"],resource:"none"},{name:"focus.patch.146",method:"PATCH",path:"/v1/focuses/:focus_id",classes:["person"],resource:"none"},{name:"focus.delete.147",method:"DELETE",path:"/v1/focuses/:focus_id",classes:["person"],resource:"none"},{name:"space.list",method:"GET",path:"/v1/spaces",classes:["person"],resource:"none"},{name:"kinds.list",method:"GET",path:"/v1/kinds",classes:["person","app","broker"],resource:"none"},{name:"grant.get",method:"GET",path:"/v1/grant",classes:["app"],resource:"none",stage:"v0.5"},{name:"llm",method:"POST",path:"/v1/llm",classes:["app","person","broker"],scope:"crtr:llm",resource:"none",stage:"v1"},{name:"run.start",method:"POST",path:"/v1/runs",classes:["app"],scope:"crtr:act",resource:"none",stage:"v0.5",idempotency:"24h"},{name:"run.list",method:"GET",path:"/v1/runs",classes:["app","person","broker"],resource:"run",stage:"v0.5"},{name:"run.get",method:"GET",path:"/v1/runs/:run_id",classes:["app","person","broker"],resource:"run",stage:"v0.5",wait:!0},{name:"run.message",method:"POST",path:"/v1/runs/:run_id/messages",classes:["app","person","broker"],scope:"crtr:act",resource:"run",stage:"v0.5"},{name:"run.events",method:"GET",path:"/v1/runs/:run_id/events",classes:["app","person","broker"],resource:"run",stage:"v0.5",stream:!0},{name:"run.interrupt",method:"POST",path:"/v1/runs/:run_id/interrupt",classes:["app","person","broker"],resource:"run",stage:"v0.5"},{name:"run.cancel",method:"POST",path:"/v1/runs/:run_id/cancel",classes:["app","person","broker"],resource:"run",stage:"v0.5"},{name:"run.delete",method:"DELETE",path:"/v1/runs/:run_id",classes:["app","person","broker"],resource:"run",stage:"v0.5"},{name:"trace.get",method:"GET",path:"/v1/runs/:run_id/trace",classes:["app","person","broker"],resource:"run",stage:"v0.5"},{name:"runtime.sync-notice",method:"POST",path:"/v1/runtime/sync-notice",classes:["directory"],resource:"none",stage:"v1"}];function m(e,s){return a.find(o=>o.method===e.toUpperCase()&&o.path===s)}r(m,"operationFor");export{a as OPERATIONS,m as operationFor};
|
|
1
|
+
var a=Object.defineProperty;var r=(e,s)=>a(e,"name",{value:s,configurable:!0});const n=[{name:"health",method:"GET",path:"/v1/health",classes:["anonymous"],resource:"none",stage:"v0.5"},{name:"chat-inventory.get.1",method:"GET",path:"/v1/nodes/:id/chat-inventory",classes:["person","broker"],resource:"node-read"},{name:"model-config.put.2",method:"PUT",path:"/v1/model-config",classes:["person"],resource:"none"},{name:"files.get.3",method:"GET",path:"/v1/files/peek",classes:["person","broker"],resource:"none"},{name:"files.post.4",method:"POST",path:"/v1/files/write",classes:["person","broker"],resource:"none"},{name:"files.get.5",method:"GET",path:"/v1/files/list",classes:["person","broker"],resource:"none"},{name:"reviews.post.6",method:"POST",path:"/v1/human/reviews",classes:["person","broker"],resource:"human",scope:"crtr:act"},{name:"reviews.get.7",method:"GET",path:"/v1/human/reviews",classes:["person","broker"],resource:"human"},{name:"reviews.get.8",method:"GET",path:"/v1/human/reviews/:review_id",classes:["person","broker"],resource:"human"},{name:"reviews.post.9",method:"POST",path:"/v1/human/reviews/:review_id/submit",classes:["person","broker"],resource:"human"},{name:"reviews.post.10",method:"POST",path:"/v1/human/reviews/:review_id/cancel",classes:["person","broker"],resource:"human"},{name:"reviews.get.11",method:"GET",path:"/v1/human/reviews/:review_id/document",classes:["person","broker"],resource:"human"},{name:"feedback-comments.post.12",method:"POST",path:"/v1/human/inbox/:ticket_id/feedback-comments",classes:["person","broker"],resource:"human"},{name:"feedback-comments.post.13",method:"POST",path:"/v1/human/inbox/:ticket_id/feedback-comments/:comment_id/resolve",classes:["person","broker"],resource:"human"},{name:"node.log.append",method:"POST",path:"/v1/nodes/:id/records/log",classes:["person","broker"],resource:"node-own"},{name:"node.telemetry.put",method:"PUT",path:"/v1/nodes/:id/records/telemetry",classes:["person","broker"],resource:"node-own"},{name:"node.recap.put",method:"PUT",path:"/v1/nodes/:id/records/recap",classes:["person","broker"],resource:"node-own"},{name:"node.inbox.read",method:"GET",path:"/v1/nodes/:id/records/inbox",classes:["person","broker"],resource:"node-own"},{name:"node.passive.read",method:"GET",path:"/v1/nodes/:id/records/passive",classes:["person","broker"],resource:"node-own"},{name:"node.pushed-final",method:"POST",path:"/v1/nodes/:id/records/pushed-final",classes:["person","broker"],resource:"node-own"},{name:"broker-ops.post.14",method:"POST",path:"/v1/nodes/:id/broker/session-bound",classes:["person","broker"],resource:"node-own"},{name:"broker-ops.post.15",method:"POST",path:"/v1/nodes/:id/broker/settle",classes:["person","broker"],resource:"node-own"},{name:"broker-ops.post.16",method:"POST",path:"/v1/nodes/:id/broker/park-complete",classes:["person","broker"],resource:"node-own"},{name:"broker-ops.post.17",method:"POST",path:"/v1/nodes/:id/broker/park-activity",classes:["person","broker"],resource:"node-own"},{name:"broker-ops.post.18",method:"POST",path:"/v1/nodes/:id/broker/telemetry",classes:["person","broker"],resource:"node-own"},{name:"broker-ops.post.19",method:"POST",path:"/v1/nodes/:id/broker/model",classes:["person","broker"],resource:"node-own"},{name:"broker-ops.get.20",method:"GET",path:"/v1/nodes/:id/broker/extension-state",classes:["person","broker"],resource:"node-own"},{name:"broker-ops.context",method:"POST",path:"/v1/nodes/:id/broker/context",classes:["person","broker"],resource:"node-own"},{name:"broker-ops.memory-refs",method:"POST",path:"/v1/nodes/:id/broker/memory-refs",classes:["person","broker"],resource:"node-own"},{name:"broker-ops.context-commit",method:"POST",path:"/v1/nodes/:id/broker/context/commit",classes:["person","broker"],resource:"node-own"},{name:"broker-ops.context-event",method:"POST",path:"/v1/nodes/:id/broker/context/event",classes:["person","broker"],resource:"node-own"},{name:"broker-ops.post.21",method:"POST",path:"/v1/nodes/:id/broker/generated-name",classes:["person","broker"],resource:"node-own"},{name:"broker-ops.post.22",method:"POST",path:"/v1/nodes/:id/broker/persona-ack",classes:["person","broker"],resource:"node-own"},{name:"memory.get.23",method:"GET",path:"/v1/memory/docs",classes:["person","app","broker"],resource:"memory"},{name:"memory.get.24",method:"GET",path:"/v1/memory/docs/:name",classes:["person","app","broker"],resource:"memory"},{name:"memory.post.25",method:"POST",path:"/v1/memory/docs",classes:["person","app","broker"],resource:"memory"},{name:"memory.patch.26",method:"PATCH",path:"/v1/memory/docs/:name",classes:["person","app","broker"],resource:"memory"},{name:"memory.delete.27",method:"DELETE",path:"/v1/memory/docs/:name",classes:["person","app","broker"],resource:"memory"},{name:"memory.post.28",method:"POST",path:"/v1/memory/docs/:name/move",classes:["person","app","broker"],resource:"memory"},{name:"memory.post.29",method:"POST",path:"/v1/memory/search",classes:["person","app","broker"],resource:"memory"},{name:"memory.get.30",method:"GET",path:"/v1/memory/docs/:name/history",classes:["person","app","broker"],resource:"memory"},{name:"memory.get.31",method:"GET",path:"/v1/memory/resolve",classes:["person","app","broker"],resource:"memory"},{name:"memory.get.32",method:"GET",path:"/v1/memory/origin",classes:["person","app","broker"],resource:"memory"},{name:"memory.lint",method:"POST",path:"/v1/memory/lint",classes:["person","app","broker"],resource:"memory"},{name:"memory.extensions",method:"GET",path:"/v1/memory/extensions",classes:["person","broker"],resource:"memory"},{name:"memory.slash.list",method:"GET",path:"/v1/memory/slash",classes:["person","broker"],resource:"memory"},{name:"memory.slash.attachments",method:"POST",path:"/v1/memory/slash/attachments",classes:["person","broker"],resource:"memory"},{name:"health.get.33",method:"GET",path:"/healthz",classes:["anonymous"],resource:"none"},{name:"health.get.34",method:"GET",path:"/v1/status",classes:["person"],resource:"none"},{name:"bash-jobs.start",method:"POST",path:"/v1/nodes/:id/jobs/start",classes:["broker"],resource:"node-own",scope:"crtr:act"},{name:"hooks.plan",method:"GET",path:"/v1/nodes/:id/hooks/plan",classes:["broker"],resource:"node-own"},{name:"hooks.exec",method:"POST",path:"/v1/nodes/:id/hooks/exec",classes:["broker"],resource:"node-own"},{name:"hooks.exec.person",method:"POST",path:"/v1/hooks/exec",classes:["person"],resource:"none"},{name:"bash-jobs.get.35",method:"GET",path:"/v1/nodes/:id/jobs",classes:["person","broker"],resource:"node-read"},{name:"bash-jobs.delete.36",method:"DELETE",path:"/v1/nodes/:id/jobs/:jobId",classes:["person","broker"],resource:"node-write"},{name:"prospective-chat-inventory.get.37",method:"GET",path:"/v1/prospective-chat-inventory",classes:["person"],resource:"none"},{name:"node-events.get.38",method:"GET",path:"/v1/nodes/:id/events",classes:["person","broker"],resource:"node-read"},{name:"bash.post.39",method:"POST",path:"/v1/bash",classes:["person","broker"],resource:"daemon-bash",scope:"crtr:act"},{name:"subscriptions.post.40",method:"POST",path:"/v1/nodes/:id/subscriptions",classes:["person","broker"],resource:"node-write"},{name:"subscriptions.delete.41",method:"DELETE",path:"/v1/nodes/:id/subscriptions/:target",classes:["person","broker"],resource:"node-write"},{name:"attach.post.42",method:"POST",path:"/v1/nodes/:id/attach",classes:["person"],resource:"none"},{name:"review-comments.post.44",method:"POST",path:"/v1/human/reviews/self/comments",classes:["person","broker"],resource:"human"},{name:"review-comments.get.45",method:"GET",path:"/v1/human/reviews/self/comments",classes:["person","broker"],resource:"human"},{name:"review-comments.post.46",method:"POST",path:"/v1/human/reviews/:review_id/comments",classes:["person","broker"],resource:"human"},{name:"review-comments.get.47",method:"GET",path:"/v1/human/reviews/:review_id/comments",classes:["person","broker"],resource:"human"},{name:"review-comments.get.48",method:"GET",path:"/v1/human/reviews/:review_id/comment-events",classes:["person","broker"],resource:"human"},{name:"review-comments.post.49",method:"POST",path:"/v1/human/reviews/:review_id/comment-ranges",classes:["person","broker"],resource:"human"},{name:"review-comments.get.50",method:"GET",path:"/v1/human/comments/:comment_id",classes:["person","broker"],resource:"human"},{name:"review-comments.post.51",method:"POST",path:"/v1/human/comments/:comment_id/edit",classes:["person","broker"],resource:"human"},{name:"review-comments.post.52",method:"POST",path:"/v1/human/comments/:comment_id/resolve",classes:["person","broker"],resource:"human"},{name:"review-comments.post.53",method:"POST",path:"/v1/human/comments/:comment_id/reopen",classes:["person","broker"],resource:"human"},{name:"review-comments.post.54",method:"POST",path:"/v1/human/comments/:comment_id/delete",classes:["person","broker"],resource:"human"},{name:"review-comments.post.55",method:"POST",path:"/v1/human/comments/:comment_id/fork",classes:["person","broker"],resource:"human"},{name:"messages.post.56",method:"POST",path:"/v1/nodes/:id/mail/claim",classes:["person","broker"],resource:"node-own"},{name:"messages.post.57",method:"POST",path:"/v1/nodes/:id/mail/acknowledge",classes:["person","broker"],resource:"node-own"},{name:"messages.post.58",method:"POST",path:"/v1/nodes/:id/messages",classes:["person","broker"],resource:"node-write"},{name:"messages.post.59",method:"POST",path:"/v1/nodes/:id/interrupt",classes:["person","broker"],resource:"node-write"},{name:"reports.post.60",method:"POST",path:"/v1/nodes/:id/reports",classes:["person","broker"],resource:"node-own"},{name:"reports.get.61",method:"GET",path:"/v1/nodes/:id/reports",classes:["person","broker"],resource:"node-read"},{name:"reports.post.62",method:"POST",path:"/v1/nodes/:id/result",classes:["person","broker"],resource:"node-own"},{name:"inbox.get.63",method:"GET",path:"/v1/human/inbox",classes:["person","broker"],resource:"human"},{name:"inbox.get.64",method:"GET",path:"/v1/human/inbox/history",classes:["person","broker"],resource:"human"},{name:"inbox.get.65",method:"GET",path:"/v1/human/inbox/:ticket_id",classes:["person","broker"],resource:"human"},{name:"inbox.get.66",method:"GET",path:"/v1/human/inbox/:ticket_id/response",classes:["person","broker"],resource:"human"},{name:"inbox.post.67",method:"POST",path:"/v1/human/inbox/:ticket_id/respond",classes:["person","broker"],resource:"human"},{name:"inbox.post.68",method:"POST",path:"/v1/human/inbox/:ticket_id/progress",classes:["person","broker"],resource:"human"},{name:"inbox.post.69",method:"POST",path:"/v1/human/inbox/:ticket_id/cancel",classes:["person","broker"],resource:"human"},{name:"worktree.post.70",method:"POST",path:"/v1/nodes/:id/worktree/close",classes:["person","broker"],resource:"node-write"},{name:"worktree.post.71",method:"POST",path:"/v1/nodes/:id/worktree/abandon",classes:["person","broker"],resource:"node-write"},{name:"worktree.get.72",method:"GET",path:"/v1/worktrees/quarantined",classes:["person"],resource:"none"},{name:"crons.post.73",method:"POST",path:"/v1/crons",classes:["person","app","broker"],resource:"cron",scope:"crtr:schedule"},{name:"crons.get.74",method:"GET",path:"/v1/crons",classes:["person","app","broker"],resource:"cron"},{name:"crons.get.75",method:"GET",path:"/v1/crons/:cronId",classes:["person","app","broker"],resource:"cron"},{name:"crons.post.76",method:"POST",path:"/v1/crons/:cronId/pause",classes:["person","app","broker"],resource:"cron",scope:"crtr:schedule"},{name:"crons.post.77",method:"POST",path:"/v1/crons/:cronId/resume",classes:["person","app","broker"],resource:"cron",scope:"crtr:schedule"},{name:"crons.post.78",method:"POST",path:"/v1/crons/poke",classes:["person","app","broker"],resource:"cron",scope:"crtr:schedule"},{name:"crons.post.79",method:"POST",path:"/v1/crons/:cronId/run",classes:["person","app","broker"],resource:"cron",scope:"crtr:schedule"},{name:"crons.delete.80",method:"DELETE",path:"/v1/crons/:cronId",classes:["person","app","broker"],resource:"cron",scope:"crtr:schedule"},{name:"modelauth.get.81",method:"GET",path:"/v1/model-auth",classes:["person"],resource:"none"},{name:"modelauth.get.82",method:"GET",path:"/v1/model-auth/readiness",classes:["person"],resource:"none"},{name:"modelauth.put.83",method:"PUT",path:"/v1/model-auth/:provider",classes:["person"],resource:"none"},{name:"modelauth.delete.84",method:"DELETE",path:"/v1/model-auth/:provider",classes:["person"],resource:"none"},{name:"model_auth.start",method:"POST",path:"/v1/model-auth/flows",classes:["person"],resource:"none"},{name:"model_auth.complete",method:"POST",path:"/v1/model-auth/flows/:flow_id/complete",classes:["person"],resource:"none"},{name:"model_auth.cancel",method:"POST",path:"/v1/model-auth/flows/:flow_id/cancel",classes:["person"],resource:"none"},{name:"model_auth.get",method:"GET",path:"/v1/model-auth/flows/:flow_id",classes:["person"],resource:"none",wait:!0},{name:"nodes.post.85",method:"POST",path:"/v1/nodes",classes:["person","broker"],resource:"node-own",scope:"crtr:act"},{name:"nodes.get.86",method:"GET",path:"/v1/nodes",classes:["person","broker"],resource:"nodes-list"},{name:"nodes.post.87",method:"POST",path:"/v1/nodes/revive-all",classes:["person"],resource:"none"},{name:"nodes.get.88",method:"GET",path:"/v1/nodes/:id",classes:["person","broker"],resource:"node-read"},{name:"nodes.get.89",method:"GET",path:"/v1/nodes/:id/snapshot",classes:["person","broker"],resource:"node-read"},{name:"nodes.get.90",method:"GET",path:"/v1/nodes/:id/subject",classes:["person","broker"],resource:"node-read"},{name:"nodes.get.91",method:"GET",path:"/v1/nodes/:id/messages",classes:["person","broker"],resource:"node-read"},{name:"nodes.get.92",method:"GET",path:"/v1/nodes/:id/session",classes:["person","broker"],resource:"node-read"},{name:"nodes.get.93",method:"GET",path:"/v1/nodes/:id/transcript",classes:["person","broker"],resource:"node-read"},{name:"nodes.get.94",method:"GET",path:"/v1/nodes/:id/context",classes:["person","broker"],resource:"node-read"},{name:"nodes.get.95",method:"GET",path:"/v1/nodes/:id/artifacts",classes:["person","broker"],resource:"node-read"},{name:"nodes.post.96",method:"POST",path:"/v1/nodes/:id/fork",classes:["person","broker"],resource:"node-write",scope:"crtr:act"},{name:"nodes.post.97",method:"POST",path:"/v1/nodes/:id/revive",classes:["person","broker"],resource:"node-write",scope:"crtr:act"},{name:"nodes.post.98",method:"POST",path:"/v1/nodes/:id/relaunch-root",classes:["person","broker"],resource:"node-write",scope:"crtr:act"},{name:"nodes.post.99",method:"POST",path:"/v1/nodes/:id/close",classes:["person","broker"],resource:"node-write",scope:"crtr:act"},{name:"nodes.post.100",method:"POST",path:"/v1/nodes/:id/recycle",classes:["person","broker"],resource:"node-write",scope:"crtr:act"},{name:"nodes.post.101",method:"POST",path:"/v1/nodes/:id/demote",classes:["person","broker"],resource:"node-write",scope:"crtr:act"},{name:"nodes.post.102",method:"POST",path:"/v1/nodes/:id/promote",classes:["person","broker"],resource:"node-write",scope:"crtr:act"},{name:"nodes.post.103",method:"POST",path:"/v1/nodes/:id/yield",classes:["person","broker"],resource:"node-write",scope:"crtr:act"},{name:"nodes.post.104",method:"POST",path:"/v1/nodes/:id/wait",classes:["person","broker"],resource:"node-write",scope:"crtr:act"},{name:"nodes.patch.105",method:"PATCH",path:"/v1/nodes/:id/config",classes:["person","broker"],resource:"node-write",scope:"crtr:act"},{name:"broker-recovery.post.106",method:"POST",path:"/v1/broker/:id/turn",classes:["person","broker"],resource:"node-own"},{name:"broker-recovery.post.107",method:"POST",path:"/v1/broker/:id/provider-retry",classes:["person","broker"],resource:"node-own"},{name:"broker-recovery.post.108",method:"POST",path:"/v1/broker/:id/fault",classes:["person","broker"],resource:"node-own"},{name:"broker-recovery.get.109",method:"GET",path:"/v1/broker/:id/recovery",classes:["person","broker"],resource:"node-own"},{name:"broker-recovery.post.110",method:"POST",path:"/v1/nodes/:id/fault",classes:["person","broker"],resource:"node-write"},{name:"broker-recovery.delete.111",method:"DELETE",path:"/v1/nodes/:id/fault",classes:["person","broker"],resource:"node-write"},{name:"profiles.put.112",method:"PUT",path:"/v1/profiles/:name",classes:["person","app","broker"],resource:"profile"},{name:"profiles.post.113",method:"POST",path:"/v1/profiles/:name/pause",classes:["person"],resource:"profile"},{name:"profiles.post.114",method:"POST",path:"/v1/profiles/:name/resume",classes:["person"],resource:"profile"},{name:"profiles.patch.115",method:"PATCH",path:"/v1/profiles/:name/metadata",classes:["person","app","broker"],resource:"profile"},{name:"profile.create",method:"POST",path:"/v1/profiles",classes:["person","app","broker"],resource:"profile"},{name:"profile.update",method:"PATCH",path:"/v1/profiles/:name",classes:["person","app","broker"],resource:"profile"},{name:"profile.env.list",method:"GET",path:"/v1/profiles/:name/env",classes:["person","app","broker"],resource:"profile"},{name:"profile.env.set",method:"PUT",path:"/v1/profiles/:name/env/:var",classes:["person","app","broker"],resource:"profile"},{name:"profile.env.remove",method:"DELETE",path:"/v1/profiles/:name/env/:var",classes:["person","app","broker"],resource:"profile"},{name:"profiles.delete.116",method:"DELETE",path:"/v1/profiles/:name",classes:["person","app","broker"],resource:"profile"},{name:"profile.list",method:"GET",path:"/v1/profiles",classes:["person","app","broker"],resource:"profile",stage:"chat"},{name:"profiles.get.118",method:"GET",path:"/v1/profiles/:name",classes:["person","app","broker"],resource:"profile"},{name:"node-outcomes.get.119",method:"GET",path:"/v1/nodes/:id/outcome",classes:["person","broker"],resource:"node-read"},{name:"node-outcomes.put.120",method:"PUT",path:"/v1/nodes/:id/outcome-delivery",classes:["person","broker"],resource:"node-write"},{name:"node-outcomes.get.121",method:"GET",path:"/v1/nodes/:id/outcome-delivery",classes:["person","broker"],resource:"node-read"},{name:"node-outcomes.delete.122",method:"DELETE",path:"/v1/nodes/:id/outcome-delivery",classes:["person","broker"],resource:"node-write"},{name:"canvas.get.123",method:"GET",path:"/v1/canvas/attention",classes:["person","broker"],resource:"canvas-read"},{name:"canvas.post.124",method:"POST",path:"/v1/canvas/attention/counts",classes:["person","broker"],resource:"canvas-read"},{name:"canvas.post.125",method:"POST",path:"/v1/canvas/history/search",classes:["person","broker"],resource:"canvas-read"},{name:"canvas.post.126",method:"POST",path:"/v1/canvas/history/grep",classes:["person","broker"],resource:"canvas-read"},{name:"canvas.get.127",method:"GET",path:"/v1/canvas/history/read",classes:["person","broker"],resource:"canvas-read"},{name:"canvas.post.128",method:"POST",path:"/v1/canvas/history/stats",classes:["person","broker"],resource:"canvas-read"},{name:"canvas.get.129",method:"GET",path:"/v1/canvas/snapshot",classes:["person","broker"],resource:"canvas-read"},{name:"canvas.get.130",method:"GET",path:"/v1/canvas/roster",classes:["person","broker"],resource:"canvas-read"},{name:"canvas.get.analytics",method:"GET",path:"/v1/canvas/analytics",classes:["person"],resource:"canvas-read"},{name:"memory-reads.post",method:"POST",path:"/v1/nodes/:id/memory-reads",classes:["person","broker"],resource:"node-own"},{name:"canvas.get.131",method:"GET",path:"/v1/canvas/graph",classes:["person","broker"],resource:"canvas-read"},{name:"canvas.post.132",method:"POST",path:"/v1/canvas/prune",classes:["person"],resource:"none"},{name:"daemon.post.133",method:"POST",path:"/v1/daemon/restart",classes:["person"],resource:"none"},{name:"daemon.post.134",method:"POST",path:"/v1/daemon/migrate",classes:["person"],resource:"none"},{name:"daemon.post.135",method:"POST",path:"/v1/daemon/admit",classes:["person"],resource:"none"},{name:"human.components.list",method:"GET",path:"/v1/human/components",classes:["person","broker"],resource:"none"},{name:"human-requests.post.136",method:"POST",path:"/v1/human/requests",classes:["person","broker"],resource:"human",scope:"crtr:act"},{name:"human-requests.get.137",method:"GET",path:"/v1/human/requests/:request_id",classes:["person","broker"],resource:"human"},{name:"human-requests.post.138",method:"POST",path:"/v1/human/requests/:request_id/replace",classes:["person","broker"],resource:"human"},{name:"human-requests.post.139",method:"POST",path:"/v1/human/requests/:request_id/respond",classes:["person","broker"],resource:"human"},{name:"human-requests.post.140",method:"POST",path:"/v1/human/requests/:request_id/dismiss",classes:["person","broker"],resource:"human"},{name:"human-requests.post.141",method:"POST",path:"/v1/human/requests/:request_id/cancel",classes:["person","broker"],resource:"human"},{name:"focus.get.142",method:"GET",path:"/v1/focuses",classes:["person"],resource:"none"},{name:"focus.post.143",method:"POST",path:"/v1/focuses",classes:["person"],resource:"none"},{name:"focus.get.144",method:"GET",path:"/v1/focuses/by-node",classes:["person"],resource:"none"},{name:"focus.get.145",method:"GET",path:"/v1/focuses/by-pane",classes:["person"],resource:"none"},{name:"focus.patch.146",method:"PATCH",path:"/v1/focuses/:focus_id",classes:["person"],resource:"none"},{name:"focus.delete.147",method:"DELETE",path:"/v1/focuses/:focus_id",classes:["person"],resource:"none"},{name:"space.list",method:"GET",path:"/v1/spaces",classes:["person"],resource:"none"},{name:"kinds.list",method:"GET",path:"/v1/kinds",classes:["person","app","broker"],resource:"none"},{name:"grant.get",method:"GET",path:"/v1/grant",classes:["app"],resource:"none",stage:"v0.5"},{name:"llm",method:"POST",path:"/v1/llm",classes:["app","person","broker"],scope:"crtr:llm",resource:"none",stage:"v1"},{name:"run.start",method:"POST",path:"/v1/runs",classes:["app"],scope:"crtr:act",resource:"none",stage:"v0.5",idempotency:"24h"},{name:"run.list",method:"GET",path:"/v1/runs",classes:["app","person","broker"],resource:"run",stage:"v0.5"},{name:"run.get",method:"GET",path:"/v1/runs/:run_id",classes:["app","person","broker"],resource:"run",stage:"v0.5",wait:!0},{name:"run.message",method:"POST",path:"/v1/runs/:run_id/messages",classes:["app","person","broker"],scope:"crtr:act",resource:"run",stage:"v0.5"},{name:"run.events",method:"GET",path:"/v1/runs/:run_id/events",classes:["app","person","broker"],resource:"run",stage:"v0.5",stream:!0},{name:"run.interrupt",method:"POST",path:"/v1/runs/:run_id/interrupt",classes:["app","person","broker"],resource:"run",stage:"v0.5"},{name:"run.cancel",method:"POST",path:"/v1/runs/:run_id/cancel",classes:["app","person","broker"],resource:"run",stage:"v0.5"},{name:"run.delete",method:"DELETE",path:"/v1/runs/:run_id",classes:["app","person","broker"],resource:"run",stage:"v0.5"},{name:"run.rename",method:"POST",path:"/v1/runs/:run_id/rename",classes:["app"],resource:"run",stage:"chat"},{name:"question.get",method:"GET",path:"/v1/questions/:question_id",classes:["app"],resource:"none",stage:"chat"},{name:"question.answer",method:"POST",path:"/v1/questions/:question_id/answer",classes:["app"],resource:"none",stage:"chat"},{name:"trace.get",method:"GET",path:"/v1/runs/:run_id/trace",classes:["app","person","broker"],resource:"run",stage:"v0.5"},{name:"upload.create",method:"POST",path:"/v1/uploads",classes:["app"],scope:"crtr:act",resource:"none",stage:"file-transfer"},{name:"attachment.link",method:"GET",path:"/v1/attachments/link",classes:["app"],resource:"none",stage:"file-transfer"},{name:"file.download",method:"GET",path:"/v1/files/download",classes:["app"],resource:"none",stage:"file-transfer",stream:"bytes"},{name:"share.create",method:"POST",path:"/v1/shares",classes:["app"],resource:"none",stage:"file-transfer"},{name:"share.list",method:"GET",path:"/v1/shares",classes:["app"],resource:"none",stage:"file-transfer"},{name:"share.delete",method:"DELETE",path:"/v1/shares/:share_id",classes:["app"],resource:"none",stage:"file-transfer"},{name:"runtime.sync-notice",method:"POST",path:"/v1/runtime/sync-notice",classes:["directory"],resource:"none",stage:"v1"}];function m(e,s){return n.find(o=>o.method===e.toUpperCase()&&o.path===s)}r(m,"operationFor");export{n as OPERATIONS,m as operationFor};
|
package/dist/daemon/cron-run.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var A=Object.defineProperty;var f=(e,t)=>A(e,"name",{value:t,configurable:!0});import{randomUUID as R}from"node:crypto";import{CRON_OUTPUT_HEAD_BYTES as h,EMPTY_STDOUT_SHA256 as T,formatCronOutputHead as H}from"./cron/capture.js";import{clearLiveRun as _,cronDaemonInstanceId as E,registerLiveRun as g}from"./cron/live-runs.js";import{buildArmedRunContext as v}from"./cron/armed-context.js";import{decideHeldSettle as M,EXIT_HELD as k,HELD_DELIVERED as B}from"./cron/held.js";import{settleRun as D}from"./cron/settle.js";import{applyOverlapPolicies as L,expireDueCrons as U}from"./cron/passes.js";import{dueClockCrons as b,acquireCronRunLease as y,attachCronRunPid as P,advanceCron as $,setCronState as N}from"../core/canvas/crons.js";import{emitEvent as Y}from"../core/events/emit.js";import{runAppCommand as q}from"../core/runtime/run-command.js";import{nextSlotAfter as F}from"../core/wake.js";import{CRON_OUTPUT_HEAD_BYTES as ie}from"./cron/capture.js";import{cronDaemonInstanceId as ue,markSelfCanceledCronRun as ce}from"./cron/live-runs.js";import{recoverStaleCronLeases as me}from"./cron/lease-recovery.js";async function J(e,t){const{runId:s,outOfBand:r,startedAtIso:n,finishedAtMs:o,code:u,timedOut:i,processError:l}=t,p=!r&&!i&&l==null&&u===k&&!t.wasReplaced&&!t.wasSelfCanceled;let c,m;return t.wasReplaced?(c={kind:"stated",delivered:"replaced (overlap=replace)"},m="release"):p?(c={kind:"stated",delivered:B},m=M(e,n,o)??"release"):(c={kind:"disposed",ctx:{runId:s,startedAtIso:n,exitCode:i?-1:u,timedOut:i,runTimeoutS:e.run_timeout_s,processErrorMessage:l!=null?l.message:null,stdoutHead:t.stdoutHead,stdoutSha256:t.stdoutSha256,stderrHead:t.stderrHead},selfCanceled:t.wasSelfCanceled},m=r?"release":{kind:"clear"}),D(e,{outOfBand:r,outcome:c,record:{runId:s,startedAtIso:n,finishedAtMs:o,durationMs:o-t.startedAtMs,exitCode:i?-1:u,stdoutHead:t.stdoutHead===""?null:t.stdoutHead,stderrHead:l!=null?`run process error: ${l.message}`.slice(0,h):t.stderrHead===""?null:t.stderrHead},lease:m})}f(J,"settleClosedRun");function S(e,t,s,r){const n=Date.now(),o=`${s}: ${r.message}`.slice(0,h);return D(e,{outOfBand:t.outOfBand,outcome:{kind:"disposed",ctx:{runId:t.runId,startedAtIso:t.startedAtIso,exitCode:null,timedOut:!1,runTimeoutS:e.run_timeout_s,processErrorMessage:r.message,stdoutHead:"",stdoutSha256:T,stderrHead:o}},record:{runId:t.runId,startedAtIso:t.startedAtIso,finishedAtMs:n,durationMs:n-t.startedAtMs,exitCode:null,stdoutHead:null,stderrHead:o},lease:"release"})}f(S,"settleUnspawnedRun");function V(e,t){let s;try{s=F(e.recur,new Date(t))}catch(r){return Y({level:"error",event:"cron.recur.unparseable",error:r,fields:{cron_id:e.cron_id,name:e.name,recur:e.recur}}),N(e.cron_id,"paused"),new Error(`unparseable recurrence ${JSON.stringify(e.recur)}: ${r.message} \u2014 this cron cannot be rescheduled until its recurrence is fixed (\`crtr cron cancel\` and re-arm it), so it has been paused.`)}return $(e.cron_id,s),null}f(V,"advanceRecurrence");function X(e,t){const{outOfBand:s}=t;return new Promise((r,n)=>{const o=R(),u=Date.now(),i=new Date(u).toISOString(),l={runId:o,outOfBand:s,startedAtIso:i,startedAtMs:u};if(!y(e.cron_id,E,i,s)){r(null);return}let p;try{if({env:p}=v(e,o),!s&&e.recur!=null){const d=V(e,u);if(d!==null)throw d}}catch(d){S(e,l,"run could not be armed",d).then(r,n);return}let c=null,m=!1;const C={runId:o,replaced:!1,selfCanceled:!1,kill:f(()=>{c!==null?c():m=!0},"kill")};g(e.cron_id,C),q({command:e.command,cwd:e.cwd,env:p,app:e.grantee,...e.anchor_node===null?{}:{nodeId:e.anchor_node},timeoutMs:e.run_timeout_s*1e3,headBytes:h}).then(d=>{if(d.pid===null){_(e.cron_id,o),d.completion.then(a=>{S(e,l,"run failed to spawn",a.processError??new Error("bash did not provide a process id")).then(r,n)},n);return}let I=!1;const w=f(()=>{d.completion.then(a=>{const O=C.replaced,x=C.selfCanceled;if(_(e.cron_id,o),I){r(null);return}J(e,{runId:o,outOfBand:s,startedAtIso:i,startedAtMs:u,finishedAtMs:Date.now(),code:a.exitCode,timedOut:a.timedOut,processError:a.processError,stdoutHead:H(a.stdout,a.stdoutTruncated),stderrHead:H(a.stderr,a.stderrTruncated),stdoutSha256:a.stdoutSha256,wasReplaced:O,wasSelfCanceled:x}).then(r,n)},n)},"settleCommand");if(!P(e.cron_id,E,i,d.pid)&&!C.selfCanceled){I=!0,d.terminate(),w();return}c=d.terminate,m&&d.terminate(),w()},d=>{_(e.cron_id,o),S(e,l,"run failed to spawn",d).then(r,n)})})}f(X,"executeCron");function se(e,t={}){const s=new Date(e).toISOString();U(s),L(e,s);const r=[];for(const n of b(s)){const o=X(n,{outOfBand:!1}).then(()=>{});r.push(o),t.register?.(o)}for(const n of r)n.catch(()=>{});return r}f(se,"runDueCrons");export{ie as CRON_OUTPUT_HEAD_BYTES,ue as cronDaemonInstanceId,X as executeCron,ce as markSelfCanceledCronRun,me as recoverStaleCronLeases,se as runDueCrons};
|