@north-light/crouter 0.3.319 → 0.3.321

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.
Files changed (63) hide show
  1. package/dist/api/client.d.ts +2 -1
  2. package/dist/api/client.js +1 -1
  3. package/dist/api/dto/broker-ops.d.ts +0 -1
  4. package/dist/api/dto/node-outcomes.d.ts +6 -0
  5. package/dist/api/dto/nodes.d.ts +4 -3
  6. package/dist/api/dto/review-comments.d.ts +8 -0
  7. package/dist/api/routes.d.ts +1 -0
  8. package/dist/api/routes.js +1 -1
  9. package/dist/clients/attach/viewer.js +582 -582
  10. package/dist/clients/inbox/review/comments-client.d.ts +8 -1
  11. package/dist/clients/inbox/review/comments-client.js +1 -1
  12. package/dist/clients/inbox/review/companion-pane.d.ts +17 -0
  13. package/dist/clients/inbox/review/companion-pane.js +1 -1
  14. package/dist/clients/inbox/review/document-surface.d.ts +10 -0
  15. package/dist/clients/inbox/review/document-surface.js +2 -2
  16. package/dist/clients/inbox/review/frame.js +1 -1
  17. package/dist/clients/inbox/review/keys.d.ts +2 -0
  18. package/dist/clients/inbox/review/keys.js +1 -1
  19. package/dist/commands/human/prompts.js +1 -1
  20. package/dist/core/canvas/browse/app.js +3 -3
  21. package/dist/core/canvas/canvas.d.ts +3 -3
  22. package/dist/core/canvas/canvas.js +17 -14
  23. package/dist/core/canvas/migrations.js +34 -27
  24. package/dist/core/canvas/node-sql-migration.d.ts +1 -0
  25. package/dist/core/canvas/node-sql-migration.js +28 -2
  26. package/dist/core/canvas/paths.d.ts +4 -0
  27. package/dist/core/canvas/paths.js +1 -1
  28. package/dist/core/canvas/recovery.d.ts +1 -0
  29. package/dist/core/canvas/recovery.js +1 -1
  30. package/dist/core/canvas/worktrees.d.ts +1 -0
  31. package/dist/core/canvas/worktrees.js +1 -1
  32. package/dist/core/human/requests.d.ts +1 -0
  33. package/dist/core/human/requests.js +17 -13
  34. package/dist/core/review/fork.d.ts +8 -0
  35. package/dist/core/review/fork.js +5 -0
  36. package/dist/core/runtime/broker/extension-abort.d.ts +3 -0
  37. package/dist/core/runtime/broker/extension-abort.js +1 -1
  38. package/dist/core/runtime/broker.js +1 -1
  39. package/dist/core/runtime/spawn.d.ts +5 -1
  40. package/dist/core/runtime/spawn.js +2 -2
  41. package/dist/core/runtime/stop-guard.d.ts +1 -3
  42. package/dist/core/runtime/stop-guard.js +2 -2
  43. package/dist/core/runtime/stop-signals.d.ts +0 -1
  44. package/dist/core/runtime/stop-signals.js +1 -1
  45. package/dist/daemon/api/handlers/broker-ops.js +1 -1
  46. package/dist/daemon/api/handlers/health.js +14 -1
  47. package/dist/daemon/api/handlers/inbox.js +1 -1
  48. package/dist/daemon/api/handlers/review-comments.js +1 -1
  49. package/dist/daemon/api/map.d.ts +4 -2
  50. package/dist/daemon/api/map.js +2 -2
  51. package/dist/daemon/companion-retire.d.ts +3 -1
  52. package/dist/daemon/companion-retire.js +1 -1
  53. package/dist/daemon/crtrd.js +7 -7
  54. package/dist/daemon/human/finish.d.ts +4 -1
  55. package/dist/daemon/human/finish.js +7 -7
  56. package/dist/daemon/human/settle.d.ts +8 -6
  57. package/dist/daemon/human/settle.js +1 -1
  58. package/dist/daemon/reconcilers/node-lifecycle/tick.js +1 -1
  59. package/dist/pi-extensions/canvas-inbox-watcher.js +1 -1
  60. package/dist/pi-extensions/canvas-stophook.js +1 -1
  61. package/package.json +2 -1
  62. package/runtime.lock.json +5 -5
  63. package/scripts/pack-minify.mjs +108 -0
@@ -16,7 +16,7 @@ import type { MemoryDocRefDTO } from './dto/memory.js';
16
16
  import type { ChatInventoryDTO, ProspectiveChatInventoryDTO, ProspectiveChatInventoryQuery } from './dto/chat-inventory.js';
17
17
  import type { CredentialRemovalResultDTO, CredentialResultDTO, InstallCredentialRequest, ModelAuthListDTO } from './dto/modelauth.js';
18
18
  import type { CancelReviewRequest, CreateReviewRequest, ListReviewsQuery, ReviewCancelResultDTO, ReviewDocumentBaseDTO, ReviewDTO, ReviewListDTO, ReviewSubmitResultDTO } from './dto/reviews.js';
19
- import type { CreateReviewCommentRequest, EditReviewCommentRequest, ListReviewCommentsQuery, ReadReviewCommentEventsQuery, ReviewCommentActionRequest, ReviewCommentDetailDTO, ReviewCommentEventsDTO, ReviewCommentListDTO, ReviewCommentMutationDTO, ReviewCommentRangeBatchRequest, ReviewCommentRangeBatchResultDTO } from './dto/review-comments.js';
19
+ import type { CreateReviewCommentRequest, EditReviewCommentRequest, ListReviewCommentsQuery, ReadReviewCommentEventsQuery, ReviewCommentActionRequest, ReviewCommentDetailDTO, ReviewCommentEventsDTO, ReviewCommentForkDTO, ReviewCommentListDTO, ReviewCommentMutationDTO, ReviewCommentRangeBatchRequest, ReviewCommentRangeBatchResultDTO } from './dto/review-comments.js';
20
20
  import type { CancelInboxTicketRequest, CanceledTicketResultDTO, InboxListDTO, InboxPageDTO, InboxPageHistoryDTO, InboxPageResponseDTO, InboxTicketIdDTO, PageFeedbackResolutionDTO, PageResponsesDTO, PageTicketResultDTO, RespondInboxPageRequest } from './dto/inbox.js';
21
21
  import type { CreateHumanRequestDTO, CreateHumanRequestRequest, HumanRequestDTO, HumanRequestIdDTO, ReplaceHumanRequestRequest, RespondHumanRequestRequest, SettleHumanRequestRequest } from './dto/human-requests.js';
22
22
  import type { AttentionCountsDTO, AttentionDTO, DashboardDTO, DashboardQuery, HistoryGrepQuery, HistoryGrepResultDTO, HistoryReadQuery, HistoryStatsQuery, HistoryStatsResultDTO, HistoryReadResultDTO, HistorySearchQuery, HistorySearchResultDTO, PruneRequest, PruneResultDTO, RosterDTO, SnapshotDTO } from './dto/canvas.js';
@@ -236,6 +236,7 @@ export declare class CrtrClient {
236
236
  resolveReviewComment(commentId: string, req?: ReviewCommentActionRequest): Promise<ReviewCommentMutationDTO>;
237
237
  reopenReviewComment(commentId: string, req?: ReviewCommentActionRequest): Promise<ReviewCommentMutationDTO>;
238
238
  deleteReviewComment(commentId: string, req?: ReviewCommentActionRequest): Promise<ReviewCommentMutationDTO>;
239
+ forkReviewComment(commentId: string): Promise<ReviewCommentForkDTO>;
239
240
  /** Pending page/review tickets across every available crouter-owned
240
241
  * humanloop root. */
241
242
  listHumanInbox(): Promise<InboxListDTO>;
@@ -1,2 +1,2 @@
1
- var b=Object.defineProperty;var d=(n,e)=>b(n,"name",{value:e,configurable:!0});import{envHomeOverride as C}from"../shared/env.js";import{request as G}from"node:http";import{request as N}from"node:https";import{homedir as _}from"node:os";import{join as k}from"node:path";import{ApiError as u,isErrorBody as A}from"./errors.js";import{routes as r}from"./routes.js";import{isSafeNodeId as p}from"./dto/common.js";import{isSafeBashJobId as D}from"./dto/bash-jobs.js";import{isSafeCronId as I}from"./dto/crons.js";const x=".crouter",M="crtrd.sock";function B(){const n=C(),e=n!==void 0&&n!==""?n:k(_(),x,"canvas");return k(e,M)}d(B,"defaultSocketPath");const H=3e4,$=1e4,U=200;async function L({windowMs:n,probe:e,initialError:t,pollIntervalMs:s=U,retry:o=d(()=>!0,"retry"),now:a=Date.now,sleep:h=F}){const P=a()+n;let c=t;for(;;){const m=P-a();if(m<=0)throw c??new Error("crtrd availability window expired without a probe failure");try{await e(m);return}catch(f){if(c=f,!o(f))throw f}const l=P-a();if(l<=0)throw c;await h(Math.min(s,l))}}d(L,"waitForDaemonAvailability");class R{static{d(this,"CrtrClient")}socketPath;baseUrl;headers;autostart;timeoutMs;onColdSocket;coldStartDiagnostic;coldStartPollWindowMs;coldStartAttempted=!1;constructor(e){const t=e.socketPath!==void 0&&e.socketPath!=="",s=e.baseUrl!==void 0&&e.baseUrl!=="";if(t===s)throw new TypeError("CrtrClient requires exactly one of socketPath | baseUrl");t&&(this.socketPath=e.socketPath),s&&(this.baseUrl=new URL(e.baseUrl)),this.headers={...e.headers},this.autostart=e.autostart??t,this.timeoutMs=e.timeoutMs??H,e.onColdSocket!==void 0&&(this.onColdSocket=e.onColdSocket),e.coldStartDiagnostic!==void 0&&(this.coldStartDiagnostic=e.coldStartDiagnostic),this.coldStartPollWindowMs=e.coldStartPollWindowMs??$}static forLocalSocket(e){return new R({socketPath:B(),autostart:!0,...e})}healthz(){return this.request("GET",r.healthz())}async probeHealthz(e){const t=await this.transport("GET",r.healthz(),void 0,void 0,e);if(t.status===503)try{const s=JSON.parse(t.text);if(typeof s.startup_blocked=="string")return s}catch{}return y(t)}status(){return this.request("GET",r.status())}restartDaemon(){return this.request("POST",r.daemonRestart())}admitDaemon(){return this.request("POST",r.daemonAdmit())}migrateState(e){return this.request("POST",r.daemonMigrate(),e)}createNode(e){return this.request("POST",r.nodes(),e)}listNodes(e){return this.request("GET",i(r.nodes(),e))}getNode(e){return this.request("GET",r.node(this.nodePath(e)))}getNodeOutcome(e,{waitSeconds:t}={}){if(t!==void 0&&(!Number.isInteger(t)||t<0||t>25))throw new RangeError("waitSeconds must be an integer between 0 and 25");return this.request("GET",i(r.nodeOutcome(this.nodePath(e)),{wait:t}),void 0,(t??0)*1e3+this.timeoutMs)}registerOutcomeDelivery(e,t){return this.request("PUT",r.nodeOutcomeDelivery(this.nodePath(e)),t)}getOutcomeDelivery(e){return this.request("GET",r.nodeOutcomeDelivery(this.nodePath(e)))}async disarmOutcomeDelivery(e){await this.request("DELETE",r.nodeOutcomeDelivery(this.nodePath(e)))}listBashJobs(e){return this.request("GET",r.nodeJobs(this.nodePath(e)))}stopBashJob(e,t){return this.request("DELETE",r.nodeJob(this.nodePath(e),this.jobPath(t)))}sendMessage(e,t){return this.request("POST",r.nodeMessages(this.nodePath(e)),t)}interruptNode(e){return this.request("POST",r.nodeInterrupt(this.nodePath(e)),{})}pushReport(e,t){return this.request("POST",r.nodeReports(this.nodePath(e)),t)}submitResult(e,t){return this.request("POST",r.nodeResult(this.nodePath(e)),t)}forkNode(e){return this.request("POST",r.nodeFork(this.nodePath(e)),{})}reviveNode(e,t){return this.request("POST",r.nodeRevive(this.nodePath(e)),t??{})}relaunchRoot(e){return this.request("POST",r.nodeRelaunchRoot(this.nodePath(e)),{})}bindBrokerSession(e,t){return this.request("POST",r.nodeBrokerSessionBound(this.nodePath(e)),t)}settleBroker(e,t){return this.request("POST",r.nodeBrokerSettle(this.nodePath(e)),t)}completeBrokerPark(e,t){return this.request("POST",r.nodeBrokerParkComplete(this.nodePath(e)),t)}recordBrokerParkActivity(e,t){return this.request("POST",r.nodeBrokerParkActivity(this.nodePath(e)),t)}claimNodeMail(e,t){return this.request("POST",r.nodeMailClaim(this.nodePath(e)),t)}acknowledgeNodeMail(e,t){return this.request("POST",r.nodeMailAcknowledge(this.nodePath(e)),t)}recordBrokerTurn(e,t){return this.request("POST",r.brokerTurn(this.nodePath(e)),t)}mutateBrokerProviderRetry(e,t){return this.request("POST",r.brokerProviderRetry(this.nodePath(e)),t)}mutateBrokerFault(e,t){return this.request("POST",r.brokerFault(this.nodePath(e)),t)}getBrokerRecovery(e,t){return this.request("GET",`${r.brokerRecovery(this.nodePath(e))}?expected_execution_id=${encodeURIComponent(t)}`)}recordNodeFault(e,t){return this.request("POST",r.nodeFault(this.nodePath(e)),t)}clearNodeFault(e,t={}){const s=new URLSearchParams;t.link!==void 0&&s.set("link",t.link),t.preserve_episode!==void 0&&s.set("preserve_episode",String(t.preserve_episode));const o=s.size===0?"":`?${s.toString()}`;return this.request("DELETE",`${r.nodeFault(this.nodePath(e))}${o}`)}commitBrokerModel(e,t){return this.request("POST",r.nodeBrokerModel(this.nodePath(e)),t)}brokerExtensionState(e){return this.request("GET",r.nodeBrokerExtensionState(this.nodePath(e)))}commitBrokerGeneratedName(e,t){return this.request("POST",r.nodeBrokerGeneratedName(this.nodePath(e)),t)}commitBrokerPersonaAck(e,t){return this.request("POST",r.nodeBrokerPersonaAck(this.nodePath(e)),t)}closeNode(e,t){return this.request("POST",r.nodeClose(this.nodePath(e)),t??{})}recycleNode(e){return this.request("POST",r.nodeRecycle(this.nodePath(e)),{})}demoteNode(e){return this.request("POST",r.nodeDemote(this.nodePath(e)),{})}promoteNode(e,t){return this.request("POST",r.nodePromote(this.nodePath(e)),t)}yieldNode(e,t){return this.request("POST",r.nodeYield(this.nodePath(e)),t)}waitNode(e,t){return this.request("POST",r.nodeWait(this.nodePath(e)),t)}patchConfig(e,t){return this.request("PATCH",r.nodeConfig(this.nodePath(e)),t)}closeWorktree(e){return this.request("POST",r.nodeWorktreeClose(this.nodePath(e)),{})}abandonWorktree(e,t){return this.request("POST",r.nodeWorktreeAbandon(this.nodePath(e)),t)}listQuarantinedWorktrees(){return this.request("GET",r.quarantinedWorktrees())}subscribe(e,t){return this.request("POST",r.nodeSubscriptions(this.nodePath(e)),t)}listFocuses(){return this.request("GET",r.focuses())}focusOf(e){return this.request("GET",i(r.focusByNode(),{node_id:e}))}focusByPane(e){return this.request("GET",i(r.focusByPane(),{pane:e}))}registerFocus(e){return this.request("POST",r.focuses(),e)}async setFocusPane(e,t){await this.request("PATCH",r.focus(e),t)}async closeFocus(e){await this.request("DELETE",r.focus(e))}async unsubscribe(e,t){await this.request("DELETE",r.nodeSubscription(this.nodePath(e),this.nodePath(t)))}armCron(e){return this.request("POST",r.crons(),e)}listCrons(e){return this.request("GET",i(r.crons(),e))}showCron(e,t){return this.request("GET",i(r.cron(this.cronPath(e)),t))}pauseCron(e,t){return this.request("POST",i(r.cronPause(this.cronPath(e)),t),{})}resumeCron(e,t){return this.request("POST",i(r.cronResume(this.cronPath(e)),t),{})}runCron(e,t){return this.request("POST",i(r.cronRun(this.cronPath(e)),t),{})}async cancelCron(e,t){await this.request("DELETE",i(r.cron(this.cronPath(e)),t))}pokeCrons(){return this.request("POST",r.cronsPoke(),{})}ensureAttach(e,t){return this.request("POST",r.nodeAttach(this.nodePath(e)),t??{})}getReports(e,t){return this.request("GET",i(r.nodeReports(this.nodePath(e)),t))}getTranscript(e,t){return this.request("GET",i(r.nodeTranscript(this.nodePath(e)),t))}getSnapshot(e){return this.request("GET",r.nodeSnapshot(this.nodePath(e)))}nodeSubject(e){return this.request("GET",r.nodeSubject(this.nodePath(e)))}getNodeMessages(e,t){return this.request("GET",i(r.nodeMessages(this.nodePath(e)),t))}getSession(e){return this.request("GET",r.nodeSession(this.nodePath(e)))}getChatInventory(e){return this.request("GET",r.nodeChatInventory(this.nodePath(e)))}getProspectiveChatInventory(e){return this.request("GET",i(r.prospectiveChatInventory(),e))}getArtifacts(e,t){return this.request("GET",i(r.nodeArtifacts(this.nodePath(e)),t))}getContext(e){return this.request("GET",r.nodeContext(this.nodePath(e)))}peekFile(e){return this.request("GET",i(r.filePeek(),{path:e}))}resolveMemoryDoc(e,t){return this.request("GET",i(r.memoryResolve(),{name:e,node:t}))}ensureProfile(e,t){return this.request("PUT",r.profile(e),t??{})}listProfiles(){return this.request("GET",r.profiles())}getProfile(e){return this.request("GET",r.profile(e))}pauseProfile(e){return this.request("POST",r.profilePause(e),{})}resumeProfile(e){return this.request("POST",r.profileResume(e),{})}updateProfileMetadata(e,t){return this.request("PATCH",r.profileMetadata(e),t)}deleteProfile(e,t){return this.request("DELETE",r.profile(e),t)}listModelAuth(){return this.request("GET",r.modelAuths())}installCredential(e,t){return this.request("PUT",r.modelAuth(e),t)}removeCredential(e){return this.request("DELETE",r.modelAuth(e))}createReview(e){return this.request("POST",r.humanReviews(),e)}listReviews(e){return this.request("GET",i(r.humanReviews(),e))}getReview(e){return this.request("GET",r.humanReview(this.reviewPath(e)))}submitReview(e){return this.request("POST",r.humanReviewSubmit(this.reviewPath(e)),{})}cancelReview(e,t={}){return this.request("POST",r.humanReviewCancel(this.reviewPath(e)),t)}getReviewDocumentBase(e){return this.request("GET",r.humanReviewDocument(this.reviewPath(e)))}createReviewComment(e,t){const s=e===void 0?"self":this.reviewPath(e);return this.request("POST",r.humanReviewComments(s),t)}listReviewComments(e,t){const s=e===void 0?"self":this.reviewPath(e);return this.request("GET",i(r.humanReviewComments(s),t))}readReviewCommentEvents(e,t){return this.request("GET",i(r.humanReviewCommentEvents(this.reviewPath(e)),t))}updateReviewCommentRanges(e,t){return this.request("POST",r.humanReviewCommentRanges(this.reviewPath(e)),t)}getReviewComment(e){return this.request("GET",r.humanComment(this.commentPath(e)))}editReviewComment(e,t){return this.request("POST",r.humanCommentEdit(this.commentPath(e)),t)}resolveReviewComment(e,t={}){return this.request("POST",r.humanCommentResolve(this.commentPath(e)),t)}reopenReviewComment(e,t={}){return this.request("POST",r.humanCommentReopen(this.commentPath(e)),t)}deleteReviewComment(e,t={}){return this.request("POST",r.humanCommentDelete(this.commentPath(e)),t)}listHumanInbox(){return this.request("GET",r.humanInbox())}getHumanInboxPage(e){return this.request("GET",r.humanInboxTicket(this.ticketId(e)))}getInboxHistory(e){if(e===void 0)return this.request("GET",r.humanInbox()+"/history");if(typeof e!="string"||e==="")throw new TypeError(`invalid node id: ${JSON.stringify(e)}`);return this.request("GET",i(r.humanInbox()+"/history",{node_id:e}))}respondHumanInboxPage(e,t){return this.request("POST",r.humanInboxRespond(this.ticketId(e)),t)}postInboxProgress(e,t){return this.request("POST",r.humanInboxProgress(this.ticketId(e)),{responses:t})}getInboxResponse(e){return this.request("GET",r.humanInboxResponse(this.ticketId(e)))}cancelHumanInboxTicket(e,t){return this.request("POST",r.humanInboxCancel(this.ticketId(e)),t??{})}createHumanRequest(e){return this.request("POST",r.humanRequests(),e)}getHumanRequest(e){return this.request("GET",r.humanRequest(this.requestPath(e)))}replaceHumanRequest(e,t){return this.request("POST",r.humanRequestReplace(this.requestPath(e)),t)}respondHumanRequest(e,t){return this.request("POST",r.humanRequestRespond(this.requestPath(e)),t)}dismissHumanRequest(e,t={}){return this.request("POST",r.humanRequestDismiss(this.requestPath(e)),t)}cancelHumanRequest(e,t={}){return this.request("POST",r.humanRequestCancel(this.requestPath(e)),t)}resolvePageFeedbackComment(e,t,s){if(!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(t))throw new TypeError(`invalid feedback comment id: ${JSON.stringify(t)}`);return this.request("POST",r.humanInboxFeedbackResolve(this.ticketId(e),t),{node_id:s})}async dashboard(e){const t=e?.under!==void 0?{under:e.under}:void 0,[s,o]=await Promise.all([this.listNodes(t),this.status()]);return{nodes:s,counts:o.node_counts,generated_at:new Date().toISOString()}}attention(){return this.request("GET",r.canvasAttention())}attentionCounts(e){const t={node_ids:e};return this.request("POST",r.canvasAttentionCounts(),t)}historySearch(e){return this.request("POST",r.canvasHistorySearch(),e)}historyGrep(e){return this.request("POST",r.canvasHistoryGrep(),e)}historyRead(e){return this.request("GET",i(r.canvasHistoryRead(),e))}historyStats(e){return this.request("POST",r.canvasHistoryStats(),e)}canvasSnapshot(){return this.request("GET",r.canvasSnapshot())}canvasRoster(){return this.request("GET",r.canvasRoster())}prune(e){return this.request("POST",r.canvasPrune(),e)}async request(e,t,s,o){return y(await this.send(e,t,s,void 0,o))}async send(e,t,s,o,a){try{return await this.transport(e,t,s,o,a)}catch(h){if(this.isColdSocketError(h))try{return await this.handleColdSocket(h),await this.transport(e,t,s,o,a)}catch(P){throw S(P)}if(this.isInterruptedSocketError(h))return await this.rideOutInterruptedRequest(e,t,s,o,a);throw S(h)}}nodePath(e){if(!p(e))throw new u(400,"invalid_node_id",`invalid node id: ${JSON.stringify(e)}`);return e}jobPath(e){if(!D(e))throw new u(400,"invalid_job_id",`invalid background job id: ${JSON.stringify(e)}`);return e}cronPath(e){if(!I(e))throw new u(400,"invalid_cron_id",`invalid cron id: ${JSON.stringify(e)}`);return e}requestPath(e){if(!p(e))throw new u(400,"invalid_request_id",`invalid request id: ${JSON.stringify(e)}`);return e}ticketId(e){if(!/^[a-f0-9]{64}$/.test(e))throw new TypeError(`invalid inbox ticket id: ${JSON.stringify(e)}`);return e}reviewPath(e){if(!p(e))throw new u(400,"invalid_review_id",`invalid review id: ${JSON.stringify(e)}`);return e}commentPath(e){if(!/^[a-f0-9]{32}$/.test(e))throw new u(400,"invalid_comment_id",`invalid comment id: ${JSON.stringify(e)}`);return e}transport(e,t,s,o,a=this.timeoutMs){const P=this.baseUrl?.protocol==="https:"?N:G,c=s===void 0?void 0:JSON.stringify(s),m={accept:"application/json",...this.headers,...o};c!==void 0&&(m["content-type"]="application/json",m["content-length"]=String(Buffer.byteLength(c)));const l={method:e,path:t,headers:m,timeout:a};return this.socketPath!==void 0?l.socketPath=this.socketPath:this.baseUrl!==void 0&&(l.protocol=this.baseUrl.protocol,l.hostname=this.baseUrl.hostname,this.baseUrl.port!==""&&(l.port=this.baseUrl.port)),new Promise((f,v)=>{const q=P(l,T=>{const O=[];T.on("data",E=>O.push(E)),T.on("end",()=>{const E={};for(const[g,w]of Object.entries(T.headers))w!==void 0&&(E[g]=Array.isArray(w)?w.join(", "):w);f({status:T.statusCode??0,text:Buffer.concat(O).toString("utf8"),headers:E})}),T.on("error",v)});q.on("error",v),q.on("timeout",()=>{q.destroy(Object.assign(new Error("request timed out"),{code:"ETIMEDOUT"}))}),c!==void 0&&q.write(c),q.end()})}isColdSocketError(e){if(this.socketPath===void 0)return!1;const t=e?.code;return t==="ECONNREFUSED"||t==="ENOENT"||t==="ENOTSOCK"}isInterruptedSocketError(e){if(this.socketPath===void 0)return!1;const t=e?.code;return t==="ECONNRESET"||t==="EPIPE"}async rideOutInterruptedRequest(e,t,s,o,a){try{await this.awaitAvailability()}catch(h){throw S(h)}if(e!=="GET"&&e!=="HEAD")throw new u(503,"daemon_request_interrupted",`crtrd connection ended before this ${e} response; the request may or may not have been applied.`);try{return await this.transport(e,t,s,o,a)}catch(h){throw S(h)}}async awaitAvailability(e){await L({windowMs:this.coldStartPollWindowMs,initialError:e,probe:d(async t=>{const s=await this.transport("GET",r.healthz(),void 0,void 0,t);if(!(s.status>=200&&s.status<300)){try{if(typeof JSON.parse(s.text).startup_blocked=="string")return}catch{}throw new u(s.status,"daemon_health_unavailable",`crtrd health check returned HTTP ${s.status}: ${s.text.slice(0,500)}`)}},"probe")})}async handleColdSocket(e){const t=this.autostart&&this.onColdSocket!==void 0&&!this.coldStartAttempted;t&&(this.coldStartAttempted=!0,await this.onColdSocket());try{await this.awaitAvailability(e)}catch(s){if(t){const o=J(this.coldStartDiagnostic);if(o!==void 0){const a=S(s);throw new u(a.status,a.code,`${a.message}
1
+ var b=Object.defineProperty;var d=(n,e)=>b(n,"name",{value:e,configurable:!0});import{envHomeOverride as C}from"../shared/env.js";import{request as G}from"node:http";import{request as N}from"node:https";import{homedir as _}from"node:os";import{join as k}from"node:path";import{ApiError as u,isErrorBody as A}from"./errors.js";import{routes as r}from"./routes.js";import{isSafeNodeId as p}from"./dto/common.js";import{isSafeBashJobId as D}from"./dto/bash-jobs.js";import{isSafeCronId as I}from"./dto/crons.js";const x=".crouter",M="crtrd.sock";function B(){const n=C(),e=n!==void 0&&n!==""?n:k(_(),x,"canvas");return k(e,M)}d(B,"defaultSocketPath");const H=3e4,$=1e4,U=200;async function L({windowMs:n,probe:e,initialError:t,pollIntervalMs:s=U,retry:o=d(()=>!0,"retry"),now:a=Date.now,sleep:h=F}){const P=a()+n;let c=t;for(;;){const m=P-a();if(m<=0)throw c??new Error("crtrd availability window expired without a probe failure");try{await e(m);return}catch(f){if(c=f,!o(f))throw f}const l=P-a();if(l<=0)throw c;await h(Math.min(s,l))}}d(L,"waitForDaemonAvailability");class R{static{d(this,"CrtrClient")}socketPath;baseUrl;headers;autostart;timeoutMs;onColdSocket;coldStartDiagnostic;coldStartPollWindowMs;coldStartAttempted=!1;constructor(e){const t=e.socketPath!==void 0&&e.socketPath!=="",s=e.baseUrl!==void 0&&e.baseUrl!=="";if(t===s)throw new TypeError("CrtrClient requires exactly one of socketPath | baseUrl");t&&(this.socketPath=e.socketPath),s&&(this.baseUrl=new URL(e.baseUrl)),this.headers={...e.headers},this.autostart=e.autostart??t,this.timeoutMs=e.timeoutMs??H,e.onColdSocket!==void 0&&(this.onColdSocket=e.onColdSocket),e.coldStartDiagnostic!==void 0&&(this.coldStartDiagnostic=e.coldStartDiagnostic),this.coldStartPollWindowMs=e.coldStartPollWindowMs??$}static forLocalSocket(e){return new R({socketPath:B(),autostart:!0,...e})}healthz(){return this.request("GET",r.healthz())}async probeHealthz(e){const t=await this.transport("GET",r.healthz(),void 0,void 0,e);if(t.status===503)try{const s=JSON.parse(t.text);if(typeof s.startup_blocked=="string")return s}catch{}return y(t)}status(){return this.request("GET",r.status())}restartDaemon(){return this.request("POST",r.daemonRestart())}admitDaemon(){return this.request("POST",r.daemonAdmit())}migrateState(e){return this.request("POST",r.daemonMigrate(),e)}createNode(e){return this.request("POST",r.nodes(),e)}listNodes(e){return this.request("GET",i(r.nodes(),e))}getNode(e){return this.request("GET",r.node(this.nodePath(e)))}getNodeOutcome(e,{waitSeconds:t}={}){if(t!==void 0&&(!Number.isInteger(t)||t<0||t>25))throw new RangeError("waitSeconds must be an integer between 0 and 25");return this.request("GET",i(r.nodeOutcome(this.nodePath(e)),{wait:t}),void 0,(t??0)*1e3+this.timeoutMs)}registerOutcomeDelivery(e,t){return this.request("PUT",r.nodeOutcomeDelivery(this.nodePath(e)),t)}getOutcomeDelivery(e){return this.request("GET",r.nodeOutcomeDelivery(this.nodePath(e)))}async disarmOutcomeDelivery(e){await this.request("DELETE",r.nodeOutcomeDelivery(this.nodePath(e)))}listBashJobs(e){return this.request("GET",r.nodeJobs(this.nodePath(e)))}stopBashJob(e,t){return this.request("DELETE",r.nodeJob(this.nodePath(e),this.jobPath(t)))}sendMessage(e,t){return this.request("POST",r.nodeMessages(this.nodePath(e)),t)}interruptNode(e){return this.request("POST",r.nodeInterrupt(this.nodePath(e)),{})}pushReport(e,t){return this.request("POST",r.nodeReports(this.nodePath(e)),t)}submitResult(e,t){return this.request("POST",r.nodeResult(this.nodePath(e)),t)}forkNode(e){return this.request("POST",r.nodeFork(this.nodePath(e)),{})}reviveNode(e,t){return this.request("POST",r.nodeRevive(this.nodePath(e)),t??{})}relaunchRoot(e){return this.request("POST",r.nodeRelaunchRoot(this.nodePath(e)),{})}bindBrokerSession(e,t){return this.request("POST",r.nodeBrokerSessionBound(this.nodePath(e)),t)}settleBroker(e,t){return this.request("POST",r.nodeBrokerSettle(this.nodePath(e)),t)}completeBrokerPark(e,t){return this.request("POST",r.nodeBrokerParkComplete(this.nodePath(e)),t)}recordBrokerParkActivity(e,t){return this.request("POST",r.nodeBrokerParkActivity(this.nodePath(e)),t)}claimNodeMail(e,t){return this.request("POST",r.nodeMailClaim(this.nodePath(e)),t)}acknowledgeNodeMail(e,t){return this.request("POST",r.nodeMailAcknowledge(this.nodePath(e)),t)}recordBrokerTurn(e,t){return this.request("POST",r.brokerTurn(this.nodePath(e)),t)}mutateBrokerProviderRetry(e,t){return this.request("POST",r.brokerProviderRetry(this.nodePath(e)),t)}mutateBrokerFault(e,t){return this.request("POST",r.brokerFault(this.nodePath(e)),t)}getBrokerRecovery(e,t){return this.request("GET",`${r.brokerRecovery(this.nodePath(e))}?expected_execution_id=${encodeURIComponent(t)}`)}recordNodeFault(e,t){return this.request("POST",r.nodeFault(this.nodePath(e)),t)}clearNodeFault(e,t={}){const s=new URLSearchParams;t.link!==void 0&&s.set("link",t.link),t.preserve_episode!==void 0&&s.set("preserve_episode",String(t.preserve_episode));const o=s.size===0?"":`?${s.toString()}`;return this.request("DELETE",`${r.nodeFault(this.nodePath(e))}${o}`)}commitBrokerModel(e,t){return this.request("POST",r.nodeBrokerModel(this.nodePath(e)),t)}brokerExtensionState(e){return this.request("GET",r.nodeBrokerExtensionState(this.nodePath(e)))}commitBrokerGeneratedName(e,t){return this.request("POST",r.nodeBrokerGeneratedName(this.nodePath(e)),t)}commitBrokerPersonaAck(e,t){return this.request("POST",r.nodeBrokerPersonaAck(this.nodePath(e)),t)}closeNode(e,t){return this.request("POST",r.nodeClose(this.nodePath(e)),t??{})}recycleNode(e){return this.request("POST",r.nodeRecycle(this.nodePath(e)),{})}demoteNode(e){return this.request("POST",r.nodeDemote(this.nodePath(e)),{})}promoteNode(e,t){return this.request("POST",r.nodePromote(this.nodePath(e)),t)}yieldNode(e,t){return this.request("POST",r.nodeYield(this.nodePath(e)),t)}waitNode(e,t){return this.request("POST",r.nodeWait(this.nodePath(e)),t)}patchConfig(e,t){return this.request("PATCH",r.nodeConfig(this.nodePath(e)),t)}closeWorktree(e){return this.request("POST",r.nodeWorktreeClose(this.nodePath(e)),{})}abandonWorktree(e,t){return this.request("POST",r.nodeWorktreeAbandon(this.nodePath(e)),t)}listQuarantinedWorktrees(){return this.request("GET",r.quarantinedWorktrees())}subscribe(e,t){return this.request("POST",r.nodeSubscriptions(this.nodePath(e)),t)}listFocuses(){return this.request("GET",r.focuses())}focusOf(e){return this.request("GET",i(r.focusByNode(),{node_id:e}))}focusByPane(e){return this.request("GET",i(r.focusByPane(),{pane:e}))}registerFocus(e){return this.request("POST",r.focuses(),e)}async setFocusPane(e,t){await this.request("PATCH",r.focus(e),t)}async closeFocus(e){await this.request("DELETE",r.focus(e))}async unsubscribe(e,t){await this.request("DELETE",r.nodeSubscription(this.nodePath(e),this.nodePath(t)))}armCron(e){return this.request("POST",r.crons(),e)}listCrons(e){return this.request("GET",i(r.crons(),e))}showCron(e,t){return this.request("GET",i(r.cron(this.cronPath(e)),t))}pauseCron(e,t){return this.request("POST",i(r.cronPause(this.cronPath(e)),t),{})}resumeCron(e,t){return this.request("POST",i(r.cronResume(this.cronPath(e)),t),{})}runCron(e,t){return this.request("POST",i(r.cronRun(this.cronPath(e)),t),{})}async cancelCron(e,t){await this.request("DELETE",i(r.cron(this.cronPath(e)),t))}pokeCrons(){return this.request("POST",r.cronsPoke(),{})}ensureAttach(e,t){return this.request("POST",r.nodeAttach(this.nodePath(e)),t??{})}getReports(e,t){return this.request("GET",i(r.nodeReports(this.nodePath(e)),t))}getTranscript(e,t){return this.request("GET",i(r.nodeTranscript(this.nodePath(e)),t))}getSnapshot(e){return this.request("GET",r.nodeSnapshot(this.nodePath(e)))}nodeSubject(e){return this.request("GET",r.nodeSubject(this.nodePath(e)))}getNodeMessages(e,t){return this.request("GET",i(r.nodeMessages(this.nodePath(e)),t))}getSession(e){return this.request("GET",r.nodeSession(this.nodePath(e)))}getChatInventory(e){return this.request("GET",r.nodeChatInventory(this.nodePath(e)))}getProspectiveChatInventory(e){return this.request("GET",i(r.prospectiveChatInventory(),e))}getArtifacts(e,t){return this.request("GET",i(r.nodeArtifacts(this.nodePath(e)),t))}getContext(e){return this.request("GET",r.nodeContext(this.nodePath(e)))}peekFile(e){return this.request("GET",i(r.filePeek(),{path:e}))}resolveMemoryDoc(e,t){return this.request("GET",i(r.memoryResolve(),{name:e,node:t}))}ensureProfile(e,t){return this.request("PUT",r.profile(e),t??{})}listProfiles(){return this.request("GET",r.profiles())}getProfile(e){return this.request("GET",r.profile(e))}pauseProfile(e){return this.request("POST",r.profilePause(e),{})}resumeProfile(e){return this.request("POST",r.profileResume(e),{})}updateProfileMetadata(e,t){return this.request("PATCH",r.profileMetadata(e),t)}deleteProfile(e,t){return this.request("DELETE",r.profile(e),t)}listModelAuth(){return this.request("GET",r.modelAuths())}installCredential(e,t){return this.request("PUT",r.modelAuth(e),t)}removeCredential(e){return this.request("DELETE",r.modelAuth(e))}createReview(e){return this.request("POST",r.humanReviews(),e)}listReviews(e){return this.request("GET",i(r.humanReviews(),e))}getReview(e){return this.request("GET",r.humanReview(this.reviewPath(e)))}submitReview(e){return this.request("POST",r.humanReviewSubmit(this.reviewPath(e)),{})}cancelReview(e,t={}){return this.request("POST",r.humanReviewCancel(this.reviewPath(e)),t)}getReviewDocumentBase(e){return this.request("GET",r.humanReviewDocument(this.reviewPath(e)))}createReviewComment(e,t){const s=e===void 0?"self":this.reviewPath(e);return this.request("POST",r.humanReviewComments(s),t)}listReviewComments(e,t){const s=e===void 0?"self":this.reviewPath(e);return this.request("GET",i(r.humanReviewComments(s),t))}readReviewCommentEvents(e,t){return this.request("GET",i(r.humanReviewCommentEvents(this.reviewPath(e)),t))}updateReviewCommentRanges(e,t){return this.request("POST",r.humanReviewCommentRanges(this.reviewPath(e)),t)}getReviewComment(e){return this.request("GET",r.humanComment(this.commentPath(e)))}editReviewComment(e,t){return this.request("POST",r.humanCommentEdit(this.commentPath(e)),t)}resolveReviewComment(e,t={}){return this.request("POST",r.humanCommentResolve(this.commentPath(e)),t)}reopenReviewComment(e,t={}){return this.request("POST",r.humanCommentReopen(this.commentPath(e)),t)}deleteReviewComment(e,t={}){return this.request("POST",r.humanCommentDelete(this.commentPath(e)),t)}forkReviewComment(e){return this.request("POST",r.humanCommentFork(this.commentPath(e)),{})}listHumanInbox(){return this.request("GET",r.humanInbox())}getHumanInboxPage(e){return this.request("GET",r.humanInboxTicket(this.ticketId(e)))}getInboxHistory(e){if(e===void 0)return this.request("GET",r.humanInbox()+"/history");if(typeof e!="string"||e==="")throw new TypeError(`invalid node id: ${JSON.stringify(e)}`);return this.request("GET",i(r.humanInbox()+"/history",{node_id:e}))}respondHumanInboxPage(e,t){return this.request("POST",r.humanInboxRespond(this.ticketId(e)),t)}postInboxProgress(e,t){return this.request("POST",r.humanInboxProgress(this.ticketId(e)),{responses:t})}getInboxResponse(e){return this.request("GET",r.humanInboxResponse(this.ticketId(e)))}cancelHumanInboxTicket(e,t){return this.request("POST",r.humanInboxCancel(this.ticketId(e)),t??{})}createHumanRequest(e){return this.request("POST",r.humanRequests(),e)}getHumanRequest(e){return this.request("GET",r.humanRequest(this.requestPath(e)))}replaceHumanRequest(e,t){return this.request("POST",r.humanRequestReplace(this.requestPath(e)),t)}respondHumanRequest(e,t){return this.request("POST",r.humanRequestRespond(this.requestPath(e)),t)}dismissHumanRequest(e,t={}){return this.request("POST",r.humanRequestDismiss(this.requestPath(e)),t)}cancelHumanRequest(e,t={}){return this.request("POST",r.humanRequestCancel(this.requestPath(e)),t)}resolvePageFeedbackComment(e,t,s){if(!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(t))throw new TypeError(`invalid feedback comment id: ${JSON.stringify(t)}`);return this.request("POST",r.humanInboxFeedbackResolve(this.ticketId(e),t),{node_id:s})}async dashboard(e){const t=e?.under!==void 0?{under:e.under}:void 0,[s,o]=await Promise.all([this.listNodes(t),this.status()]);return{nodes:s,counts:o.node_counts,generated_at:new Date().toISOString()}}attention(){return this.request("GET",r.canvasAttention())}attentionCounts(e){const t={node_ids:e};return this.request("POST",r.canvasAttentionCounts(),t)}historySearch(e){return this.request("POST",r.canvasHistorySearch(),e)}historyGrep(e){return this.request("POST",r.canvasHistoryGrep(),e)}historyRead(e){return this.request("GET",i(r.canvasHistoryRead(),e))}historyStats(e){return this.request("POST",r.canvasHistoryStats(),e)}canvasSnapshot(){return this.request("GET",r.canvasSnapshot())}canvasRoster(){return this.request("GET",r.canvasRoster())}prune(e){return this.request("POST",r.canvasPrune(),e)}async request(e,t,s,o){return y(await this.send(e,t,s,void 0,o))}async send(e,t,s,o,a){try{return await this.transport(e,t,s,o,a)}catch(h){if(this.isColdSocketError(h))try{return await this.handleColdSocket(h),await this.transport(e,t,s,o,a)}catch(P){throw S(P)}if(this.isInterruptedSocketError(h))return await this.rideOutInterruptedRequest(e,t,s,o,a);throw S(h)}}nodePath(e){if(!p(e))throw new u(400,"invalid_node_id",`invalid node id: ${JSON.stringify(e)}`);return e}jobPath(e){if(!D(e))throw new u(400,"invalid_job_id",`invalid background job id: ${JSON.stringify(e)}`);return e}cronPath(e){if(!I(e))throw new u(400,"invalid_cron_id",`invalid cron id: ${JSON.stringify(e)}`);return e}requestPath(e){if(!p(e))throw new u(400,"invalid_request_id",`invalid request id: ${JSON.stringify(e)}`);return e}ticketId(e){if(!/^[a-f0-9]{64}$/.test(e))throw new TypeError(`invalid inbox ticket id: ${JSON.stringify(e)}`);return e}reviewPath(e){if(!p(e))throw new u(400,"invalid_review_id",`invalid review id: ${JSON.stringify(e)}`);return e}commentPath(e){if(!/^[a-f0-9]{32}$/.test(e))throw new u(400,"invalid_comment_id",`invalid comment id: ${JSON.stringify(e)}`);return e}transport(e,t,s,o,a=this.timeoutMs){const P=this.baseUrl?.protocol==="https:"?N:G,c=s===void 0?void 0:JSON.stringify(s),m={accept:"application/json",...this.headers,...o};c!==void 0&&(m["content-type"]="application/json",m["content-length"]=String(Buffer.byteLength(c)));const l={method:e,path:t,headers:m,timeout:a};return this.socketPath!==void 0?l.socketPath=this.socketPath:this.baseUrl!==void 0&&(l.protocol=this.baseUrl.protocol,l.hostname=this.baseUrl.hostname,this.baseUrl.port!==""&&(l.port=this.baseUrl.port)),new Promise((f,v)=>{const q=P(l,T=>{const O=[];T.on("data",E=>O.push(E)),T.on("end",()=>{const E={};for(const[g,w]of Object.entries(T.headers))w!==void 0&&(E[g]=Array.isArray(w)?w.join(", "):w);f({status:T.statusCode??0,text:Buffer.concat(O).toString("utf8"),headers:E})}),T.on("error",v)});q.on("error",v),q.on("timeout",()=>{q.destroy(Object.assign(new Error("request timed out"),{code:"ETIMEDOUT"}))}),c!==void 0&&q.write(c),q.end()})}isColdSocketError(e){if(this.socketPath===void 0)return!1;const t=e?.code;return t==="ECONNREFUSED"||t==="ENOENT"||t==="ENOTSOCK"}isInterruptedSocketError(e){if(this.socketPath===void 0)return!1;const t=e?.code;return t==="ECONNRESET"||t==="EPIPE"}async rideOutInterruptedRequest(e,t,s,o,a){try{await this.awaitAvailability()}catch(h){throw S(h)}if(e!=="GET"&&e!=="HEAD")throw new u(503,"daemon_request_interrupted",`crtrd connection ended before this ${e} response; the request may or may not have been applied.`);try{return await this.transport(e,t,s,o,a)}catch(h){throw S(h)}}async awaitAvailability(e){await L({windowMs:this.coldStartPollWindowMs,initialError:e,probe:d(async t=>{const s=await this.transport("GET",r.healthz(),void 0,void 0,t);if(!(s.status>=200&&s.status<300)){try{if(typeof JSON.parse(s.text).startup_blocked=="string")return}catch{}throw new u(s.status,"daemon_health_unavailable",`crtrd health check returned HTTP ${s.status}: ${s.text.slice(0,500)}`)}},"probe")})}async handleColdSocket(e){const t=this.autostart&&this.onColdSocket!==void 0&&!this.coldStartAttempted;t&&(this.coldStartAttempted=!0,await this.onColdSocket());try{await this.awaitAvailability(e)}catch(s){if(t){const o=J(this.coldStartDiagnostic);if(o!==void 0){const a=S(s);throw new u(a.status,a.code,`${a.message}
2
2
  ${o}`)}}throw s}}}function i(n,e){if(e===void 0)return n;const t=new URLSearchParams;for(const[o,a]of Object.entries(e))a!=null&&t.set(o,String(a));const s=t.toString();return s===""?n:`${n}?${s}`}d(i,"withQuery");function y(n){const e=n.status>=200&&n.status<300,t=n.text.trim();let s;if(t!=="")try{s=JSON.parse(t)}catch{if(e)return;throw new u(n.status,"invalid_response",n.text.slice(0,500))}if(e)return s;throw A(s)?new u(n.status,s.error.code,s.error.message,s.error.details):new u(n.status,"internal",`request failed with status ${n.status}`)}d(y,"parse");function S(n){if(n instanceof u)return n;const e=n?.code,t=n instanceof Error?n.message:String(n);return e==="ECONNREFUSED"||e==="ENOENT"||e==="ENOTSOCK"?new u(503,"daemon_unavailable",`crtrd is not reachable: ${t}`):e==="ETIMEDOUT"?new u(504,"request_timeout",`crtrd request timed out: ${t}`):new u(503,"transport_error",t)}d(S,"toTransportApiError");function F(n){return new Promise(e=>setTimeout(e,n))}d(F,"sleepMs");function J(n){if(n!==void 0)try{return n()}catch{return}}d(J,"safeColdStartDiagnostic");export{R as CrtrClient,J as safeColdStartDiagnostic,L as waitForDaemonAvailability};
@@ -28,7 +28,6 @@ export interface BrokerSettleRequest extends BrokerExecutionRequest {
28
28
  stopReason: string;
29
29
  backgroundJobsRunning: boolean;
30
30
  pushedFinal: boolean;
31
- requestedHumanReply: boolean;
32
31
  }
33
32
  /** The only consequence a settle caller may enact. crtrd has already committed
34
33
  * every canvas and placement effect before returning this directive. */
@@ -1,6 +1,12 @@
1
1
  import type { IsoTime, NodeIdDTO, NodeStatusDTO, TerminalReasonDTO } from './common.js';
2
2
  import type { DeclinedResultDTO } from './reports.js';
3
3
  export type OutcomeKindDTO = 'result' | 'failure';
4
+ /** The terminal outcome fields carried by a node-list row. */
5
+ export interface NodeOutcomeSummaryDTO {
6
+ kind: OutcomeKindDTO;
7
+ reason: TerminalReasonDTO;
8
+ settled_at: IsoTime;
9
+ }
4
10
  /** Bounded diagnostics recorded for a failed node outcome. */
5
11
  export interface NodeOutcomeDetailV1 {
6
12
  schema: 'crtr.node-outcome-detail/v1';
@@ -1,6 +1,6 @@
1
1
  import type { Cursor, ExitIntentDTO, IsoTime, LifecycleDTO, ModeDTO, NodeIdDTO, NodeStatusDTO, TerminalReasonDTO } from './common.js';
2
2
  import type { ReportDTO } from './reports.js';
3
- import type { NodeOutcomeDTO, RegisterOutcomeDeliveryRequest } from './node-outcomes.js';
3
+ import type { NodeOutcomeDTO, NodeOutcomeSummaryDTO, RegisterOutcomeDeliveryRequest } from './node-outcomes.js';
4
4
  import type { FaultLink, FaultKind, FaultRetry, FaultProviderError } from './recovery.js';
5
5
  /** `GET /v1/nodes/{id}/subject` — the node-config subject substrate gate
6
6
  * predicates evaluate against. Mirrors `NodeConfigSubject`; this narrow
@@ -105,7 +105,7 @@ export interface NodeSummaryDTO {
105
105
  final_report: string | null;
106
106
  finalized_at: IsoTime | null;
107
107
  deadline_at: IsoTime | null;
108
- outcome: NodeOutcomeDTO | null;
108
+ outcome: NodeOutcomeSummaryDTO | null;
109
109
  fault?: NodeFaultDTO | null;
110
110
  streaming?: boolean;
111
111
  /** Present only when requested with `include=activity`. */
@@ -186,7 +186,8 @@ export interface NodeFaultDTO {
186
186
  }
187
187
  /** The full node view — summary ∪ identity extras ∪ edges ∪ paths. Returned by
188
188
  * `GET /v1/nodes/{id}` and by the create/lifecycle actions that yield a node. */
189
- export interface NodeDetailDTO extends NodeSummaryDTO {
189
+ export interface NodeDetailDTO extends Omit<NodeSummaryDTO, 'outcome'> {
190
+ outcome: NodeOutcomeDTO | null;
190
191
  /** Node that created this node, or null when an external process did. */
191
192
  creator: NodeIdDTO | null;
192
193
  /** The namer's prose form of `description` — sentence case, punctuation intact
@@ -136,3 +136,11 @@ export interface ReviewCommentRangeBatchResultDTO {
136
136
  detached: number;
137
137
  unchanged: number;
138
138
  }
139
+ /** Daemon-derived result of forking the review companion onto one comment. */
140
+ export interface ReviewCommentForkDTO {
141
+ comment_id: string;
142
+ /** The newborn fork of the review companion. */
143
+ node_id: NodeIdDTO;
144
+ /** Where the fork runs, so a caller can place a viewer for it. */
145
+ cwd: string;
146
+ }
@@ -89,6 +89,7 @@ export declare const routes: {
89
89
  readonly humanCommentResolve: (commentId: string) => string;
90
90
  readonly humanCommentReopen: (commentId: string) => string;
91
91
  readonly humanCommentDelete: (commentId: string) => string;
92
+ readonly humanCommentFork: (commentId: string) => string;
92
93
  readonly humanInbox: () => string;
93
94
  readonly humanInboxTicket: (ticketId: string) => string;
94
95
  readonly humanInboxRespond: (ticketId: string) => string;
@@ -1 +1 @@
1
- var s=Object.defineProperty;var o=(e,n)=>s(e,"name",{value:n,configurable:!0});const a="v1",$="/v1",t={healthz:o(()=>"/healthz","healthz"),status:o(()=>"/v1/status","status"),daemonRestart:o(()=>"/v1/daemon/restart","daemonRestart"),daemonMigrate:o(()=>"/v1/daemon/migrate","daemonMigrate"),daemonAdmit:o(()=>"/v1/daemon/admit","daemonAdmit"),nodes:o(()=>"/v1/nodes","nodes"),reviveAll:o(()=>"/v1/nodes/revive-all","reviveAll"),node:o(e=>`/v1/nodes/${e}`,"node"),nodeOutcome:o(e=>`/v1/nodes/${e}/outcome`,"nodeOutcome"),nodeOutcomeDelivery:o(e=>`/v1/nodes/${e}/outcome-delivery`,"nodeOutcomeDelivery"),nodeSnapshot:o(e=>`/v1/nodes/${e}/snapshot`,"nodeSnapshot"),nodeSubject:o(e=>`/v1/nodes/${e}/subject`,"nodeSubject"),nodeSession:o(e=>`/v1/nodes/${e}/session`,"nodeSession"),nodeChatInventory:o(e=>`/v1/nodes/${e}/chat-inventory`,"nodeChatInventory"),prospectiveChatInventory:o(()=>"/v1/prospective-chat-inventory","prospectiveChatInventory"),nodeTranscript:o(e=>`/v1/nodes/${e}/transcript`,"nodeTranscript"),nodeContext:o(e=>`/v1/nodes/${e}/context`,"nodeContext"),nodeArtifacts:o(e=>`/v1/nodes/${e}/artifacts`,"nodeArtifacts"),nodeReports:o(e=>`/v1/nodes/${e}/reports`,"nodeReports"),nodeResult:o(e=>`/v1/nodes/${e}/result`,"nodeResult"),nodeJobs:o(e=>`/v1/nodes/${e}/jobs`,"nodeJobs"),nodeJob:o((e,n)=>`/v1/nodes/${e}/jobs/${n}`,"nodeJob"),nodeMessages:o(e=>`/v1/nodes/${e}/messages`,"nodeMessages"),nodeInterrupt:o(e=>`/v1/nodes/${e}/interrupt`,"nodeInterrupt"),nodeFork:o(e=>`/v1/nodes/${e}/fork`,"nodeFork"),nodeRevive:o(e=>`/v1/nodes/${e}/revive`,"nodeRevive"),nodeRelaunchRoot:o(e=>`/v1/nodes/${e}/relaunch-root`,"nodeRelaunchRoot"),nodeBrokerSessionBound:o(e=>`/v1/nodes/${e}/broker/session-bound`,"nodeBrokerSessionBound"),nodeBrokerSettle:o(e=>`/v1/nodes/${e}/broker/settle`,"nodeBrokerSettle"),nodeBrokerParkComplete:o(e=>`/v1/nodes/${e}/broker/park-complete`,"nodeBrokerParkComplete"),nodeBrokerParkActivity:o(e=>`/v1/nodes/${e}/broker/park-activity`,"nodeBrokerParkActivity"),nodeMailClaim:o(e=>`/v1/nodes/${e}/mail/claim`,"nodeMailClaim"),nodeMailAcknowledge:o(e=>`/v1/nodes/${e}/mail/acknowledge`,"nodeMailAcknowledge"),nodeBrokerModel:o(e=>`/v1/nodes/${e}/broker/model`,"nodeBrokerModel"),nodeBrokerExtensionState:o(e=>`/v1/nodes/${e}/broker/extension-state`,"nodeBrokerExtensionState"),nodeBrokerGeneratedName:o(e=>`/v1/nodes/${e}/broker/generated-name`,"nodeBrokerGeneratedName"),nodeBrokerPersonaAck:o(e=>`/v1/nodes/${e}/broker/persona-ack`,"nodeBrokerPersonaAck"),brokerTurn:o(e=>`/v1/broker/${e}/turn`,"brokerTurn"),brokerProviderRetry:o(e=>`/v1/broker/${e}/provider-retry`,"brokerProviderRetry"),brokerFault:o(e=>`/v1/broker/${e}/fault`,"brokerFault"),brokerRecovery:o(e=>`/v1/broker/${e}/recovery`,"brokerRecovery"),nodeFault:o(e=>`/v1/nodes/${e}/fault`,"nodeFault"),nodeClose:o(e=>`/v1/nodes/${e}/close`,"nodeClose"),nodeRecycle:o(e=>`/v1/nodes/${e}/recycle`,"nodeRecycle"),nodeDemote:o(e=>`/v1/nodes/${e}/demote`,"nodeDemote"),nodePromote:o(e=>`/v1/nodes/${e}/promote`,"nodePromote"),nodeYield:o(e=>`/v1/nodes/${e}/yield`,"nodeYield"),nodeWait:o(e=>`/v1/nodes/${e}/wait`,"nodeWait"),nodeConfig:o(e=>`/v1/nodes/${e}/config`,"nodeConfig"),nodeWorktreeClose:o(e=>`/v1/nodes/${e}/worktree/close`,"nodeWorktreeClose"),nodeWorktreeAbandon:o(e=>`/v1/nodes/${e}/worktree/abandon`,"nodeWorktreeAbandon"),quarantinedWorktrees:o(()=>"/v1/worktrees/quarantined","quarantinedWorktrees"),nodeAttach:o(e=>`/v1/nodes/${e}/attach`,"nodeAttach"),focuses:o(()=>"/v1/focuses","focuses"),focusByNode:o(()=>"/v1/focuses/by-node","focusByNode"),focusByPane:o(()=>"/v1/focuses/by-pane","focusByPane"),focus:o(e=>`/v1/focuses/${e}`,"focus"),nodeSubscriptions:o(e=>`/v1/nodes/${e}/subscriptions`,"nodeSubscriptions"),nodeSubscription:o((e,n)=>`/v1/nodes/${e}/subscriptions/${n}`,"nodeSubscription"),crons:o(()=>"/v1/crons","crons"),cron:o(e=>`/v1/crons/${e}`,"cron"),cronPause:o(e=>`/v1/crons/${e}/pause`,"cronPause"),cronResume:o(e=>`/v1/crons/${e}/resume`,"cronResume"),cronRun:o(e=>`/v1/crons/${e}/run`,"cronRun"),cronsPoke:o(()=>"/v1/crons/poke","cronsPoke"),canvasAttention:o(()=>"/v1/canvas/attention","canvasAttention"),canvasAttentionCounts:o(()=>"/v1/canvas/attention/counts","canvasAttentionCounts"),canvasHistorySearch:o(()=>"/v1/canvas/history/search","canvasHistorySearch"),canvasHistoryGrep:o(()=>"/v1/canvas/history/grep","canvasHistoryGrep"),canvasHistoryRead:o(()=>"/v1/canvas/history/read","canvasHistoryRead"),canvasHistoryStats:o(()=>"/v1/canvas/history/stats","canvasHistoryStats"),canvasSnapshot:o(()=>"/v1/canvas/snapshot","canvasSnapshot"),canvasRoster:o(()=>"/v1/canvas/roster","canvasRoster"),canvasPrune:o(()=>"/v1/canvas/prune","canvasPrune"),humanReviews:o(()=>"/v1/human/reviews","humanReviews"),humanReview:o(e=>`/v1/human/reviews/${e}`,"humanReview"),humanReviewSubmit:o(e=>`/v1/human/reviews/${e}/submit`,"humanReviewSubmit"),humanReviewCancel:o(e=>`/v1/human/reviews/${e}/cancel`,"humanReviewCancel"),humanReviewDocument:o(e=>`/v1/human/reviews/${e}/document`,"humanReviewDocument"),humanReviewComments:o(e=>`/v1/human/reviews/${e}/comments`,"humanReviewComments"),humanReviewCommentEvents:o(e=>`/v1/human/reviews/${e}/comment-events`,"humanReviewCommentEvents"),humanReviewCommentRanges:o(e=>`/v1/human/reviews/${e}/comment-ranges`,"humanReviewCommentRanges"),humanComment:o(e=>`/v1/human/comments/${e}`,"humanComment"),humanCommentEdit:o(e=>`/v1/human/comments/${e}/edit`,"humanCommentEdit"),humanCommentResolve:o(e=>`/v1/human/comments/${e}/resolve`,"humanCommentResolve"),humanCommentReopen:o(e=>`/v1/human/comments/${e}/reopen`,"humanCommentReopen"),humanCommentDelete:o(e=>`/v1/human/comments/${e}/delete`,"humanCommentDelete"),humanInbox:o(()=>"/v1/human/inbox","humanInbox"),humanInboxTicket:o(e=>`/v1/human/inbox/${e}`,"humanInboxTicket"),humanInboxRespond:o(e=>`/v1/human/inbox/${e}/respond`,"humanInboxRespond"),humanInboxProgress:o(e=>`/v1/human/inbox/${e}/progress`,"humanInboxProgress"),humanInboxResponse:o(e=>`/v1/human/inbox/${e}/response`,"humanInboxResponse"),humanInboxCancel:o(e=>`/v1/human/inbox/${e}/cancel`,"humanInboxCancel"),humanInboxFeedbackResolve:o((e,n)=>`/v1/human/inbox/${e}/feedback-comments/${n}/resolve`,"humanInboxFeedbackResolve"),humanRequests:o(()=>"/v1/human/requests","humanRequests"),humanRequest:o(e=>`/v1/human/requests/${e}`,"humanRequest"),humanRequestReplace:o(e=>`/v1/human/requests/${e}/replace`,"humanRequestReplace"),humanRequestRespond:o(e=>`/v1/human/requests/${e}/respond`,"humanRequestRespond"),humanRequestDismiss:o(e=>`/v1/human/requests/${e}/dismiss`,"humanRequestDismiss"),humanRequestCancel:o(e=>`/v1/human/requests/${e}/cancel`,"humanRequestCancel"),profiles:o(()=>"/v1/profiles","profiles"),profile:o(e=>`/v1/profiles/${e}`,"profile"),profilePause:o(e=>`/v1/profiles/${e}/pause`,"profilePause"),profileResume:o(e=>`/v1/profiles/${e}/resume`,"profileResume"),profileMetadata:o(e=>`/v1/profiles/${e}/metadata`,"profileMetadata"),modelAuths:o(()=>"/v1/model-auth","modelAuths"),modelAuth:o(e=>`/v1/model-auth/${e}`,"modelAuth"),filePeek:o(()=>"/v1/files/peek","filePeek"),memoryResolve:o(()=>"/v1/memory/resolve","memoryResolve")};export{a as API_VERSION,t as routes};
1
+ var s=Object.defineProperty;var o=(e,n)=>s(e,"name",{value:n,configurable:!0});const a="v1",$="/v1",t={healthz:o(()=>"/healthz","healthz"),status:o(()=>"/v1/status","status"),daemonRestart:o(()=>"/v1/daemon/restart","daemonRestart"),daemonMigrate:o(()=>"/v1/daemon/migrate","daemonMigrate"),daemonAdmit:o(()=>"/v1/daemon/admit","daemonAdmit"),nodes:o(()=>"/v1/nodes","nodes"),reviveAll:o(()=>"/v1/nodes/revive-all","reviveAll"),node:o(e=>`/v1/nodes/${e}`,"node"),nodeOutcome:o(e=>`/v1/nodes/${e}/outcome`,"nodeOutcome"),nodeOutcomeDelivery:o(e=>`/v1/nodes/${e}/outcome-delivery`,"nodeOutcomeDelivery"),nodeSnapshot:o(e=>`/v1/nodes/${e}/snapshot`,"nodeSnapshot"),nodeSubject:o(e=>`/v1/nodes/${e}/subject`,"nodeSubject"),nodeSession:o(e=>`/v1/nodes/${e}/session`,"nodeSession"),nodeChatInventory:o(e=>`/v1/nodes/${e}/chat-inventory`,"nodeChatInventory"),prospectiveChatInventory:o(()=>"/v1/prospective-chat-inventory","prospectiveChatInventory"),nodeTranscript:o(e=>`/v1/nodes/${e}/transcript`,"nodeTranscript"),nodeContext:o(e=>`/v1/nodes/${e}/context`,"nodeContext"),nodeArtifacts:o(e=>`/v1/nodes/${e}/artifacts`,"nodeArtifacts"),nodeReports:o(e=>`/v1/nodes/${e}/reports`,"nodeReports"),nodeResult:o(e=>`/v1/nodes/${e}/result`,"nodeResult"),nodeJobs:o(e=>`/v1/nodes/${e}/jobs`,"nodeJobs"),nodeJob:o((e,n)=>`/v1/nodes/${e}/jobs/${n}`,"nodeJob"),nodeMessages:o(e=>`/v1/nodes/${e}/messages`,"nodeMessages"),nodeInterrupt:o(e=>`/v1/nodes/${e}/interrupt`,"nodeInterrupt"),nodeFork:o(e=>`/v1/nodes/${e}/fork`,"nodeFork"),nodeRevive:o(e=>`/v1/nodes/${e}/revive`,"nodeRevive"),nodeRelaunchRoot:o(e=>`/v1/nodes/${e}/relaunch-root`,"nodeRelaunchRoot"),nodeBrokerSessionBound:o(e=>`/v1/nodes/${e}/broker/session-bound`,"nodeBrokerSessionBound"),nodeBrokerSettle:o(e=>`/v1/nodes/${e}/broker/settle`,"nodeBrokerSettle"),nodeBrokerParkComplete:o(e=>`/v1/nodes/${e}/broker/park-complete`,"nodeBrokerParkComplete"),nodeBrokerParkActivity:o(e=>`/v1/nodes/${e}/broker/park-activity`,"nodeBrokerParkActivity"),nodeMailClaim:o(e=>`/v1/nodes/${e}/mail/claim`,"nodeMailClaim"),nodeMailAcknowledge:o(e=>`/v1/nodes/${e}/mail/acknowledge`,"nodeMailAcknowledge"),nodeBrokerModel:o(e=>`/v1/nodes/${e}/broker/model`,"nodeBrokerModel"),nodeBrokerExtensionState:o(e=>`/v1/nodes/${e}/broker/extension-state`,"nodeBrokerExtensionState"),nodeBrokerGeneratedName:o(e=>`/v1/nodes/${e}/broker/generated-name`,"nodeBrokerGeneratedName"),nodeBrokerPersonaAck:o(e=>`/v1/nodes/${e}/broker/persona-ack`,"nodeBrokerPersonaAck"),brokerTurn:o(e=>`/v1/broker/${e}/turn`,"brokerTurn"),brokerProviderRetry:o(e=>`/v1/broker/${e}/provider-retry`,"brokerProviderRetry"),brokerFault:o(e=>`/v1/broker/${e}/fault`,"brokerFault"),brokerRecovery:o(e=>`/v1/broker/${e}/recovery`,"brokerRecovery"),nodeFault:o(e=>`/v1/nodes/${e}/fault`,"nodeFault"),nodeClose:o(e=>`/v1/nodes/${e}/close`,"nodeClose"),nodeRecycle:o(e=>`/v1/nodes/${e}/recycle`,"nodeRecycle"),nodeDemote:o(e=>`/v1/nodes/${e}/demote`,"nodeDemote"),nodePromote:o(e=>`/v1/nodes/${e}/promote`,"nodePromote"),nodeYield:o(e=>`/v1/nodes/${e}/yield`,"nodeYield"),nodeWait:o(e=>`/v1/nodes/${e}/wait`,"nodeWait"),nodeConfig:o(e=>`/v1/nodes/${e}/config`,"nodeConfig"),nodeWorktreeClose:o(e=>`/v1/nodes/${e}/worktree/close`,"nodeWorktreeClose"),nodeWorktreeAbandon:o(e=>`/v1/nodes/${e}/worktree/abandon`,"nodeWorktreeAbandon"),quarantinedWorktrees:o(()=>"/v1/worktrees/quarantined","quarantinedWorktrees"),nodeAttach:o(e=>`/v1/nodes/${e}/attach`,"nodeAttach"),focuses:o(()=>"/v1/focuses","focuses"),focusByNode:o(()=>"/v1/focuses/by-node","focusByNode"),focusByPane:o(()=>"/v1/focuses/by-pane","focusByPane"),focus:o(e=>`/v1/focuses/${e}`,"focus"),nodeSubscriptions:o(e=>`/v1/nodes/${e}/subscriptions`,"nodeSubscriptions"),nodeSubscription:o((e,n)=>`/v1/nodes/${e}/subscriptions/${n}`,"nodeSubscription"),crons:o(()=>"/v1/crons","crons"),cron:o(e=>`/v1/crons/${e}`,"cron"),cronPause:o(e=>`/v1/crons/${e}/pause`,"cronPause"),cronResume:o(e=>`/v1/crons/${e}/resume`,"cronResume"),cronRun:o(e=>`/v1/crons/${e}/run`,"cronRun"),cronsPoke:o(()=>"/v1/crons/poke","cronsPoke"),canvasAttention:o(()=>"/v1/canvas/attention","canvasAttention"),canvasAttentionCounts:o(()=>"/v1/canvas/attention/counts","canvasAttentionCounts"),canvasHistorySearch:o(()=>"/v1/canvas/history/search","canvasHistorySearch"),canvasHistoryGrep:o(()=>"/v1/canvas/history/grep","canvasHistoryGrep"),canvasHistoryRead:o(()=>"/v1/canvas/history/read","canvasHistoryRead"),canvasHistoryStats:o(()=>"/v1/canvas/history/stats","canvasHistoryStats"),canvasSnapshot:o(()=>"/v1/canvas/snapshot","canvasSnapshot"),canvasRoster:o(()=>"/v1/canvas/roster","canvasRoster"),canvasPrune:o(()=>"/v1/canvas/prune","canvasPrune"),humanReviews:o(()=>"/v1/human/reviews","humanReviews"),humanReview:o(e=>`/v1/human/reviews/${e}`,"humanReview"),humanReviewSubmit:o(e=>`/v1/human/reviews/${e}/submit`,"humanReviewSubmit"),humanReviewCancel:o(e=>`/v1/human/reviews/${e}/cancel`,"humanReviewCancel"),humanReviewDocument:o(e=>`/v1/human/reviews/${e}/document`,"humanReviewDocument"),humanReviewComments:o(e=>`/v1/human/reviews/${e}/comments`,"humanReviewComments"),humanReviewCommentEvents:o(e=>`/v1/human/reviews/${e}/comment-events`,"humanReviewCommentEvents"),humanReviewCommentRanges:o(e=>`/v1/human/reviews/${e}/comment-ranges`,"humanReviewCommentRanges"),humanComment:o(e=>`/v1/human/comments/${e}`,"humanComment"),humanCommentEdit:o(e=>`/v1/human/comments/${e}/edit`,"humanCommentEdit"),humanCommentResolve:o(e=>`/v1/human/comments/${e}/resolve`,"humanCommentResolve"),humanCommentReopen:o(e=>`/v1/human/comments/${e}/reopen`,"humanCommentReopen"),humanCommentDelete:o(e=>`/v1/human/comments/${e}/delete`,"humanCommentDelete"),humanCommentFork:o(e=>`/v1/human/comments/${e}/fork`,"humanCommentFork"),humanInbox:o(()=>"/v1/human/inbox","humanInbox"),humanInboxTicket:o(e=>`/v1/human/inbox/${e}`,"humanInboxTicket"),humanInboxRespond:o(e=>`/v1/human/inbox/${e}/respond`,"humanInboxRespond"),humanInboxProgress:o(e=>`/v1/human/inbox/${e}/progress`,"humanInboxProgress"),humanInboxResponse:o(e=>`/v1/human/inbox/${e}/response`,"humanInboxResponse"),humanInboxCancel:o(e=>`/v1/human/inbox/${e}/cancel`,"humanInboxCancel"),humanInboxFeedbackResolve:o((e,n)=>`/v1/human/inbox/${e}/feedback-comments/${n}/resolve`,"humanInboxFeedbackResolve"),humanRequests:o(()=>"/v1/human/requests","humanRequests"),humanRequest:o(e=>`/v1/human/requests/${e}`,"humanRequest"),humanRequestReplace:o(e=>`/v1/human/requests/${e}/replace`,"humanRequestReplace"),humanRequestRespond:o(e=>`/v1/human/requests/${e}/respond`,"humanRequestRespond"),humanRequestDismiss:o(e=>`/v1/human/requests/${e}/dismiss`,"humanRequestDismiss"),humanRequestCancel:o(e=>`/v1/human/requests/${e}/cancel`,"humanRequestCancel"),profiles:o(()=>"/v1/profiles","profiles"),profile:o(e=>`/v1/profiles/${e}`,"profile"),profilePause:o(e=>`/v1/profiles/${e}/pause`,"profilePause"),profileResume:o(e=>`/v1/profiles/${e}/resume`,"profileResume"),profileMetadata:o(e=>`/v1/profiles/${e}/metadata`,"profileMetadata"),modelAuths:o(()=>"/v1/model-auth","modelAuths"),modelAuth:o(e=>`/v1/model-auth/${e}`,"modelAuth"),filePeek:o(()=>"/v1/files/peek","filePeek"),memoryResolve:o(()=>"/v1/memory/resolve","memoryResolve")};export{a as API_VERSION,t as routes};