@north-light/cli 0.3.504 → 0.3.506
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/api/client.d.ts +5 -1
- package/dist/api/client.js +3 -3
- package/dist/api/contract.d.ts +1 -1
- package/dist/api/contract.js +1 -1
- package/dist/api/dto/canvas.d.ts +40 -0
- package/dist/api/routes.d.ts +2 -0
- package/dist/api/routes.js +1 -1
- package/dist/builtin-memory/crouter-sdk/release-notes.md +8 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/provider-rotation.js +3 -3
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/provider-rotation.ts +3 -2
- package/dist/clients/attach/viewer.js +575 -575
- package/dist/clients/dashboard/app.d.ts +7 -0
- package/dist/clients/dashboard/app.js +2 -0
- package/dist/clients/dashboard/model.d.ts +39 -0
- package/dist/clients/dashboard/model.js +1 -0
- package/dist/clients/dashboard/render.d.ts +29 -0
- package/dist/clients/dashboard/render.js +3 -0
- package/dist/commands/canvas-browse.js +1 -1
- package/dist/commands/surface/node/focus.js +1 -1
- package/dist/commands/surface-dashboard.d.ts +2 -0
- package/dist/commands/surface-dashboard.js +3 -0
- package/dist/commands/surface.js +1 -1
- package/dist/core/canvas/browse/app.d.ts +3 -0
- package/dist/core/canvas/browse/app.js +3 -3
- package/dist/core/canvas/browse/model.d.ts +5 -1
- package/dist/core/canvas/browse/model.js +1 -1
- package/dist/core/canvas/browse/render.d.ts +5 -0
- package/dist/core/canvas/browse/render.js +3 -3
- package/dist/core/canvas/migrations.js +1 -1
- package/dist/core/canvas/recovery.d.ts +5 -0
- package/dist/core/canvas/recovery.js +2 -2
- package/dist/core/human/requests.d.ts +3 -0
- package/dist/core/human/requests.js +17 -17
- package/dist/core/keybindings/catalog.d.ts +4 -3
- package/dist/core/keybindings/catalog.js +1 -1
- package/dist/core/llm/run.js +2 -2
- package/dist/core/runtime/broker/model-adapter.d.ts +1 -2
- package/dist/core/runtime/focus-viewer.d.ts +6 -0
- package/dist/core/runtime/focus-viewer.js +1 -1
- package/dist/core/runtime/placement-tmux.d.ts +1 -1
- package/dist/core/runtime/placement-tmux.js +1 -1
- package/dist/core/runtime/tmux-bindings.js +3 -3
- package/dist/core/runtime/tmux-driver.d.ts +6 -0
- package/dist/core/runtime/tmux-driver.js +5 -5
- package/dist/core/subscription-state.d.ts +2 -0
- package/dist/core/subscription-state.js +4 -4
- package/dist/daemon/api/bridge.js +3 -3
- package/dist/daemon/api/handlers/broker-recovery.js +1 -1
- package/dist/daemon/api/handlers/canvas.js +6 -6
- package/dist/daemon/api/handlers/nodes.js +1 -1
- package/dist/daemon/api/operations.js +1 -1
- package/dist/daemon/api/viewer-presence.d.ts +3 -0
- package/dist/daemon/api/viewer-presence.js +1 -1
- package/docs/sdk/release-notes.md +8 -0
- package/package.json +2 -2
- package/packages/crouter-identity/package.json +1 -1
- package/runtime.lock.json +12 -12
package/dist/api/client.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ import type { CancelReviewRequest, CreateReviewRequest, ListReviewsQuery, Review
|
|
|
30
30
|
import type { CreateReviewCommentRequest, EditReviewCommentRequest, ListReviewCommentsQuery, ReadReviewCommentEventsQuery, ReviewCommentActionRequest, ReviewCommentDetailDTO, ReviewCommentEventsDTO, ReviewCommentForkDTO, ReviewCommentListDTO, ReviewCommentMutationDTO, ReviewCommentRangeBatchRequest, ReviewCommentRangeBatchResultDTO } from './dto/review-comments.js';
|
|
31
31
|
import type { CancelInboxTicketRequest, CanceledTicketResultDTO, InboxListDTO, InboxPageDTO, InboxPageHistoryDTO, InboxPageResponseDTO, InboxTicketIdDTO, PageFeedbackResolutionDTO, PageResponsesDTO, PageTicketResultDTO, RespondInboxPageRequest } from './dto/inbox.js';
|
|
32
32
|
import type { CreateHumanRequestDTO, CreateHumanRequestRequest, HumanRequestDTO, HumanRequestIdDTO, ReplaceHumanRequestRequest, RespondHumanRequestRequest, SettleHumanRequestRequest, PageComponentListDTO } from './dto/human-requests.js';
|
|
33
|
-
import type { AttentionCountsDTO, AttentionDTO, DashboardDTO, DashboardQuery, HistoryGrepQuery, HistoryGrepResultDTO, HistoryReadQuery, HistoryStatsQuery, HistoryStatsResultDTO, HistoryReadResultDTO, HistorySearchQuery, HistorySearchResultDTO, GraphDTO, PruneRequest, PruneResultDTO, RosterDTO, SnapshotDTO } from './dto/canvas.js';
|
|
33
|
+
import type { AttentionCountsDTO, AttentionDTO, DashboardDTO, DashboardQuery, HistoryGrepQuery, HistoryGrepResultDTO, HistoryReadQuery, HistoryStatsQuery, HistoryStatsResultDTO, HistoryReadResultDTO, HistorySearchQuery, HistorySearchResultDTO, GraphDTO, PruneRequest, PruneResultDTO, LiveRootsDTO, RosterDTO, SnapshotDTO } from './dto/canvas.js';
|
|
34
34
|
import type { AbandonWorktreeRequest, AbandonWorktreeResultDTO, CloseWorktreeResultDTO, QuarantinedWorktreeDTO, SpaceListDTO } from './dto/worktree.js';
|
|
35
35
|
import type { BrokerExtensionStateDTO, BrokerExecutionRequest, BrokerGeneratedNameRequest, BrokerGeneratedNameResultDTO, BrokerModelCommitRequest, BrokerModelCommitResultDTO, BrokerParkActivityResultDTO, BrokerParkCompleteRequest, BrokerPersonaAckRequest, BrokerPersonaAckResultDTO, BrokerSessionBoundRequest, BrokerSessionBoundResultDTO, BrokerSettleDirective, BrokerSettleRequest, BrokerTelemetryRequest } from './dto/broker-ops.js';
|
|
36
36
|
import type { AcknowledgeMailRequest, AcknowledgeMailResultDTO, ClaimMailRequest, ClaimMailResultDTO } from './dto/mail.js';
|
|
@@ -200,6 +200,7 @@ export declare class CrtrClient {
|
|
|
200
200
|
commitBrokerGeneratedName(id: string, req: BrokerGeneratedNameRequest): Promise<BrokerGeneratedNameResultDTO>;
|
|
201
201
|
commitBrokerPersonaAck(id: string, req: BrokerPersonaAckRequest): Promise<BrokerPersonaAckResultDTO>;
|
|
202
202
|
closeNode(id: string, req?: CloseRequest): Promise<CloseResultDTO>;
|
|
203
|
+
markNodeRead(id: string): Promise<void>;
|
|
203
204
|
recycleNode(id: string): Promise<NodeDetailDTO>;
|
|
204
205
|
demoteNode(id: string): Promise<NodeDetailDTO>;
|
|
205
206
|
promoteNode(id: string, req: PromoteRequest): Promise<NodeDetailDTO>;
|
|
@@ -447,6 +448,9 @@ export declare class CrtrClient {
|
|
|
447
448
|
* two indexed queries server-side, no per-row enrichment. The recurring
|
|
448
449
|
* poll target for attach/browser topology; use `canvasSnapshot` for the
|
|
449
450
|
* enriched on-demand view. */
|
|
451
|
+
liveRoots(q?: {
|
|
452
|
+
profile?: string;
|
|
453
|
+
}): Promise<LiveRootsDTO>;
|
|
450
454
|
canvasRoster(): Promise<RosterDTO>;
|
|
451
455
|
/** Explicitly compressed browse snapshot; the Node-only canvas source
|
|
452
456
|
* decompresses it because socketFetch does not interpret content-encoding. */
|
package/dist/api/client.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var D=Object.defineProperty;var a=(o,e)=>D(o,"name",{value:e,configurable:!0});import{ApiError as m,isErrorBody as A}from"./errors.js";import{routes as r}from"./routes.js";import{isSafeNodeId as y}from"./dto/common.js";import{isSafeBashJobId as
|
|
2
|
-
`))!==-1;){const P=c.slice(0,l);c=c.slice(l+1),P!==""&&(yield JSON.parse(P))}}if(c+=u.decode(),c.trim()!=="")throw new m(502,"invalid_response","broker signal stream ended mid-line")}finally{await i.cancel().catch(()=>{})}}createStructuredRequest(e,t){return e.mode==="sync"?this.sendOnce("POST","/v1/structured-requests",e,t):this.request("POST","/v1/structured-requests",e,t)}getStructuredRequest(e,{wait:t=0,budgetMs:n}={}){if(!Number.isInteger(t)||t<0||t>25)throw new RangeError("wait must be an integer between 0 and 25");return this.request("GET",d(`/v1/structured-requests/${this.requestPath(e)}`,{wait:t}),void 0,{budgetMs:n})}cancelStructuredRequest(e,t){return this.request("POST",`/v1/structured-requests/${this.requestPath(e)}/cancel`,{},t)}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)}async recordBrokerTelemetry(e,t){await this.request("POST",r.nodeBrokerTelemetry(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 n=new URLSearchParams;t.link!==void 0&&n.set("link",t.link),t.preserve_episode!==void 0&&n.set("preserve_episode",String(t.preserve_episode));const s=n.size===0?"":`?${n.toString()}`;return this.request("DELETE",`${r.nodeFault(this.nodePath(e))}${s}`)}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)}listKinds(){return this.request("GET",r.kinds())}patchConfig(e,t){return this.request("PATCH",r.nodeConfig(this.nodePath(e)),t,t.model!==void 0?{timeout:45e3+this.timeoutMs}:void 0)}closeWorktree(e){return this.request("POST",r.nodeWorktreeClose(this.nodePath(e)),{})}abandonWorktree(e,t){return this.request("POST",r.nodeWorktreeAbandon(this.nodePath(e)),t)}retryDelivery(e){return this.request("POST",r.deliveryRetry(e),{})}listQuarantinedWorktrees(){return this.request("GET",r.quarantinedWorktrees())}showLimits(){return this.request("GET",r.limits())}setAppLimits(e,t){return this.request("PUT",r.limitsApp(e),t)}removeAppLimits(e,t){return this.request("DELETE",d(r.limitsApp(e),{fields:t.join(",")}))}listSpaces(){return this.request("GET",r.spaces())}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",d(r.focusByNode(),{node_id:e}))}focusByPane(e){return this.request("GET",d(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",d(r.crons(),e))}showCron(e,t){return this.request("GET",d(r.cron(this.cronPath(e)),t))}pauseCron(e,t){return this.request("POST",d(r.cronPause(this.cronPath(e)),t),{})}resumeCron(e,t){return this.request("POST",d(r.cronResume(this.cronPath(e)),t),{})}runCron(e,t){return this.request("POST",d(r.cronRun(this.cronPath(e)),t),{})}async cancelCron(e,t){await this.request("DELETE",d(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",d(r.nodeReports(this.nodePath(e)),t))}getTranscript(e,t){return this.request("GET",d(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",d(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",d(r.prospectiveChatInventory(),e))}getContext(e){return this.request("GET",r.nodeContext(this.nodePath(e)))}peekFile(e,t,n){return this.request("GET",d(r.filePeek(),{path:e,encoding:t}),void 0,n)}writeFile(e,t,n,s){return this.request("POST",r.fileWrite(),{path:e,content:t,encoding:n},s)}listFiles(e,t,n){return this.request("GET",d(r.fileList(),{path:e,limit:t}),void 0,n)}runBash(e,t){return this.request("POST",r.bash(),e,t)}objects={read:a((e,t)=>this.request("GET",d(r.object(e),t)),"read"),list:a(e=>this.request("GET",d(r.objects(),e)),"list"),search:a(e=>this.request("POST",r.objectsSearch(),e),"search"),watch:a((e,t={})=>this.request("POST",r.objectWatch(e),t),"watch"),unwatch:a((e,t)=>this.request("DELETE",d(r.objectWatch(e),t)),"unwatch"),edges:a((e,t)=>this.request("GET",d(r.objectEdges(e),t)),"edges")};docs={write:a(e=>this.request("POST",r.docs(),e),"write"),edit:a((e,t)=>this.request("PATCH",r.doc(e),t),"edit"),move:a((e,t)=>this.request("POST",r.docMove(e),t),"move"),delete:a(e=>this.request("DELETE",r.doc(e)),"delete"),history:a((e,t)=>this.request("GET",d(r.docHistory(e),t)),"history"),lint:a((e={})=>this.request("POST",r.docsLint(),e),"lint")};documents={reconcilePackages:a(()=>this.request("POST",r.documentsReconcilePackages()),"reconcilePackages")};plugins={appToken:a(e=>this.request("GET",r.pluginAppToken(e)),"appToken"),callHeaders:a((e,t)=>this.request("POST",r.pluginCallHeaders(e),t),"callHeaders")};nodeDelivery(e,t){return this.request("POST",r.nodeDelivery(this.nodePath(e)),t)}deliveryDryRun(e){return this.request("POST",r.deliveryDryRun(),e)}recordBackgroundedJob(e,t,n){return this.request("POST",r.nodeJobBackground(this.nodePath(e),this.jobPath(t)),n)}ensureProfile(e,t){return this.request("PUT",r.profile(e),t??{})}createProfile(e){return this.request("POST",r.profiles(),e)}listProfiles(){return this.request("GET",r.profiles())}updateProfile(e,t){return this.request("PATCH",r.profile(e),t)}listAppEnv(){return this.request("GET",r.appEnv())}setAppEnv(e,t){return this.request("PUT",r.appEnvVar(e),{value:t})}removeAppEnv(e){return this.request("DELETE",r.appEnvVar(e))}listProfileEnv(e){return this.request("GET",r.profileEnv(e))}setProfileEnv(e,t,n){return this.request("PUT",r.profileEnvVar(e,t),{value:n})}removeProfileEnv(e,t){return this.request("DELETE",r.profileEnvVar(e,t))}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())}getModelAuthReadiness(e){return this.request("GET",d(r.modelAuthReadiness(),e))}installCredential(e,t){return this.request("PUT",r.modelAuth(e),t)}removeCredential(e){return this.request("DELETE",r.modelAuth(e))}startModelAuth(e){return this.request("POST",r.modelAuthFlows(),e,{timeout:3e4+this.timeoutMs})}completeModelAuth(e,t){return this.request("POST",r.modelAuthFlowComplete(e),t,{timeout:35e3+this.timeoutMs})}cancelModelAuth(e){return this.request("POST",r.modelAuthFlowCancel(e),{})}getModelAuthFlow(e,t){return this.request("GET",d(r.modelAuthFlow(e),{wait:t}),void 0,{timeout:(t??0)*1e3+this.timeoutMs})}createReview(e){return this.request("POST",r.humanReviews(),e)}listReviews(e){return this.request("GET",d(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 n=e===void 0?"self":this.reviewPath(e);return this.request("POST",r.humanReviewComments(n),t)}listReviewComments(e,t){const n=e===void 0?"self":this.reviewPath(e);return this.request("GET",d(r.humanReviewComments(n),t))}readReviewCommentEvents(e,t){return this.request("GET",d(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",d(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)}listPageComponents(){return this.request("GET",r.humanComponents())}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,n){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:n})}async dashboard(e){const t=e?.under!==void 0?{under:e.under}:void 0,[n,s]=await Promise.all([this.listNodes(t),this.status()]);return{nodes:n,counts:s.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",d(r.canvasHistoryRead(),e))}historyStats(e){return this.request("POST",r.canvasHistoryStats(),e)}canvasSnapshot(){return this.request("GET",r.canvasSnapshot())}analytics(e){return this.request("GET",d(r.canvasAnalytics(),e),void 0,{timeout:6e4})}async recordMemoryReads(e,t){await this.request("POST",r.nodeMemoryReads(this.nodePath(e)),t)}canvasRoster(){return this.request("GET",r.canvasRoster())}async canvasBrowseCompressed(){const e=await this.send("GET",r.canvasBrowse());return e.ok||await S(e),new Uint8Array(await e.arrayBuffer())}canvasGraph(){return this.request("GET",r.canvasGraph())}prune(e){return this.request("POST",r.canvasPrune(),e)}async request(e,t,n,s){try{const i=s===void 0?void 0:this.resolveBudget(s),u=await this.send(e,t,n,i);return await S(u,i?.deadlineAt)}catch(i){throw T(i,s?.signal)}}async rawResponse(e,t,n){try{return await this.send(e,t,void 0,n)}catch(s){throw T(s,n?.signal)}}async send(e,t,n,s={}){const i=this.resolveBudget(s),u=e==="GET"||e==="HEAD"||e==="DELETE",c=i.maxRetries??this.maxRetries;for(let h=0;;h++){let f;try{f=await this.transport(e,t,n,i)}catch(l){if(this.isColdSocketError(l))try{await this.handleColdSocket(l,i.deadlineAt),f=await this.transport(e,t,n,i)}catch(P){throw i.deadlineAt!==void 0&&Date.now()>=i.deadlineAt&&!G(P,i.signal)?q(i.deadlineAt):T(P,i.signal)}else{if(this.isInterruptedSocketError(l)&&this.localSocketTransport&&(!u||h<c))return await this.rideOutInterruptedRequest(e,t,n,i);if(u&&h<c&&!G(l,i.signal)&&(!this.localSocketTransport||!this.isInterruptedSocketError(l))){await _(C(h+1),i);continue}else throw T(l,i.signal)}}if(u&&h<c&&H(f.status)){await k(f,i.deadlineAt),await _(C(h+1),i,j(f));continue}return f}}resolveBudget(e){const{budgetMs:t,deadlineAt:n,...s}=e;if(t===void 0&&n===void 0)return s;if(t!==void 0&&(!Number.isFinite(t)||t<=0||t>p))throw new RangeError(`budgetMs must be a positive finite number of at most ${p}`);if(n!==void 0&&(!Number.isFinite(n)||n-Date.now()>p))throw new RangeError(`deadlineAt must be a finite epoch-millisecond instant at most ${p} ms from now`);return{...s,deadlineAt:Math.min(n??1/0,t===void 0?1/0:Date.now()+t)}}async awaitWithinBudget(e,t){if(t===void 0)return e;const n=t-Date.now();if(n<=0)throw E(t);let s;try{return await Promise.race([e,new Promise((i,u)=>{s=setTimeout(()=>u(E(t)),n)})])}finally{s!==void 0&&clearTimeout(s)}}async sendOnce(e,t,n,s={}){const i=this.resolveBudget(s);try{return await S(await this.transport(e,t,n,i))}catch(u){throw T(u,i.signal)}}nodePath(e){if(!y(e))throw new m(400,"invalid_node_id",`invalid node id: ${JSON.stringify(e)}`);return e}jobPath(e){if(!x(e))throw new m(400,"invalid_job_id",`invalid background job id: ${JSON.stringify(e)}`);return e}cronPath(e){if(!N(e))throw new m(400,"invalid_cron_id",`invalid cron id: ${JSON.stringify(e)}`);return e}requestPath(e){if(!y(e))throw new m(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(!y(e))throw new m(400,"invalid_review_id",`invalid review id: ${JSON.stringify(e)}`);return e}commentPath(e){if(!/^[a-f0-9]{32}$/.test(e))throw new m(400,"invalid_comment_id",`invalid comment id: ${JSON.stringify(e)}`);return e}transport(e,t,n,s={}){const i=s.deadlineAt===void 0?void 0:s.deadlineAt-Date.now();if(i!==void 0&&i<=0)return Promise.reject(E(s.deadlineAt));const u=n===void 0?void 0:JSON.stringify(n),c={accept:"application/json",...this.headers,...s.headers};u!==void 0&&(c["content-type"]="application/json");const h=s.timeout??this.timeoutMs,f=i===void 0?h:h>0?Math.min(h,i):i,l=new AbortController,P=i!==void 0&&(h<=0||i<=h),g=f>0?setTimeout(()=>l.abort(P?E(s.deadlineAt):new DOMException("request timed out","TimeoutError")),f):void 0,w=s.signal,O=a(()=>l.abort(w?.reason),"onExternalAbort");w!==void 0&&(w.aborted?l.abort(w.reason):w.addEventListener("abort",O,{once:!0}));const R=a(()=>{g!==void 0&&clearTimeout(g),w?.removeEventListener("abort",O)},"finish");return W(this.fetch(new URL(t,this.baseUrl),{method:e,headers:c,body:u,signal:l.signal}),l.signal).then(v=>this.retainRequestLifetime(v,R,()=>l.signal.aborted?l.signal.reason:void 0),v=>{throw R(),v})}retainRequestLifetime(e,t,n){if(e.body===null)return t(),e;const s=e.body.getReader();let i=!1;const u=a(()=>{i||(i=!0,t())},"close"),c=new ReadableStream({async pull(h){try{const{done:f,value:l}=await s.read();f?(u(),h.close()):h.enqueue(l)}catch(f){u(),h.error(n()??f)}},async cancel(h){u(),await s.cancel(h)}});return new Response(c,{status:e.status,statusText:e.statusText,headers:e.headers})}isColdSocketError(e){const t=b(e);return t==="ECONNREFUSED"||t==="ENOENT"||t==="ENOTSOCK"}isInterruptedSocketError(e){const t=b(e);return t==="ECONNRESET"||t==="EPIPE"}async rideOutInterruptedRequest(e,t,n,s={}){try{await this.awaitAvailability(void 0,s.deadlineAt)}catch(i){throw T(i,s.signal)}if(e!=="GET"&&e!=="HEAD")throw new m(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,n,s)}catch(i){throw T(i,s.signal)}}async awaitAvailability(e,t){const n=t===void 0?void 0:t-Date.now();if(n!==void 0&&n<=0)throw E(t);let s;try{await $({windowMs:Math.min(this.coldStartPollWindowMs,n??this.coldStartPollWindowMs),initialError:e,retry:a(i=>i!==s,"retry"),probe:a(async i=>{const u=this.coldStartFailure?.();if(u!==void 0)throw s=new m(503,"daemon_unavailable",`crtrd failed to start: ${u}`),s;const c=await this.transport("GET",r.healthz(),void 0,{timeout:i});if(c.status>=200&&c.status<300){await k(c);return}const h=await c.text();try{if(typeof JSON.parse(h).startup_blocked=="string")return}catch{}throw new m(c.status,"daemon_health_unavailable",`crtrd health check returned HTTP ${c.status}: ${h.slice(0,500)}`)},"probe")})}catch(i){throw i===s&&(this.startupFailureReported=!0),i}}async handleColdSocket(e,t){const n=this.autostart&&this.onColdSocket!==void 0&&!this.coldStartAttempted;n&&(this.coldStartAttempted=!0,await this.awaitWithinBudget(this.onColdSocket(),t));try{await this.awaitAvailability(e,t)}catch(s){if(n&&!this.startupFailureReported){const i=J(this.coldStartDiagnostic);if(i!==void 0){const u=T(s);throw new m(u.status,u.code,`${u.message}
|
|
3
|
-
${i}`)}}throw s}}}function
|
|
1
|
+
var D=Object.defineProperty;var a=(o,e)=>D(o,"name",{value:e,configurable:!0});import{ApiError as m,isErrorBody as A}from"./errors.js";import{routes as r}from"./routes.js";import{isSafeNodeId as y}from"./dto/common.js";import{isSafeBashJobId as N}from"./dto/bash-jobs.js";import{isSafeCronId as x}from"./dto/crons.js";const B=3e4,L=Symbol.for("@north-light/api/local-socket-fetch"),I=1e4,F=200;async function $({windowMs:o,probe:e,initialError:t,pollIntervalMs:n=F,retry:s=a(()=>!0,"retry"),now:i=Date.now,sleep:d=M}){const c=i()+o;let h=t;for(;;){const f=c-i();if(f<=0)throw h??new Error("crtrd availability window expired without a probe failure");try{await e(f);return}catch(P){if(h=P,!s(P))throw P}const l=c-i();if(l<=0)throw h;await d(Math.min(n,l))}}a($,"waitForDaemonAvailability");const p=2147483647;function w(o,e="elapsed",t){const n=e==="retry_after"?`the server asked to retry after ${t}s, which is later than the call's deadline (${new Date(o).toISOString()}); not waiting`:`the call's deadline (${new Date(o).toISOString()}) passed`;return new m(504,"deadline_exceeded",n,{deadline_at:o,reason:e,...t===void 0?{}:{retry_after_s:t}})}a(w,"deadlineExceeded");const E=a(o=>w(o??Date.now()),"budgetExhausted");class Y{static{a(this,"CrtrClient")}baseUrl;fetch;headers;autostart;timeoutMs;maxRetries;localSocketTransport;onColdSocket;coldStartDiagnostic;coldStartFailure;coldStartPollWindowMs;startupFailureReported=!1;coldStartAttempted=!1;constructor(e){if(e.baseUrl==="")throw new TypeError("CrtrClient requires baseUrl");this.baseUrl=new URL(e.baseUrl),this.fetch=e.fetch??globalThis.fetch,this.headers={...e.headers},this.autostart=e.autostart??!1,this.timeoutMs=e.timeoutMs??B,this.maxRetries=e.maxRetries??2,this.localSocketTransport=this.fetch[L]===!0,e.onColdSocket!==void 0&&(this.onColdSocket=e.onColdSocket),e.coldStartDiagnostic!==void 0&&(this.coldStartDiagnostic=e.coldStartDiagnostic),e.coldStartFailure!==void 0&&(this.coldStartFailure=e.coldStartFailure),this.coldStartPollWindowMs=e.coldStartPollWindowMs??I}healthz(){return this.request("GET",r.healthz())}async probeHealthz(e){const t=await this.transport("GET",r.healthz(),void 0,{timeout:e});if(t.status===503)try{const n=await t.clone().json();if(typeof n.startup_blocked=="string")return n}catch{}return S(t)}status(){return this.request("GET",r.status())}due(){return this.request("GET",r.due())}restartDaemon(){return this.request("POST",r.daemonRestart())}admitDaemon(){return this.request("POST",r.daemonAdmit())}migrateState(e){return this.request("POST",r.daemonMigrate(),e)}appendNodeLog(e,t){return this.request("POST",r.nodeLog(this.nodePath(e)),t)}async putNodeTelemetry(e,t){await this.request("PUT",r.nodeTelemetry(this.nodePath(e)),t)}async putNodeRecap(e,t){await this.request("PUT",r.nodeRecap(this.nodePath(e)),t)}readNodeInboxReport(e,t,n){return this.request("GET",u(r.nodeInboxReport(this.nodePath(e)),{ref:t,execution_id:n}))}readNodePassiveMessage(e,t){return this.request("GET",u(r.nodePassiveMessage(this.nodePath(e)),{ref:t}))}nodePushedFinal(e,t){return this.request("POST",r.nodePushedFinal(this.nodePath(e)),t)}createNode(e){return this.request("POST",r.nodes(),e)}listNodes(e){return this.request("GET",u(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",u(r.nodeOutcome(this.nodePath(e)),{wait:t}),void 0,{timeout:(t??0)*1e3+this.timeoutMs})}getNodeEvents(e,t={},n={}){if(t.after!==void 0&&(!Number.isSafeInteger(t.after)||t.after<0))throw new RangeError("after must be a non-negative safe integer");return this.transport("GET",u(r.nodeEvents(this.nodePath(e)),t),void 0,{...n,headers:{accept:"text/event-stream",...n.headers??{}},timeout:0})}async*getBrokerSignals(e,t,n={}){const s=await this.send("GET",u(r.nodeBrokerSignals(this.nodePath(e)),{execution_id:t}),void 0,{...n,headers:{accept:"application/x-ndjson",...n.headers??{}},timeout:0});if(!s.ok){await S(s);return}if(s.body===null)throw new m(s.status,"invalid_response","broker signal stream has no body");const i=s.body.getReader(),d=new TextDecoder;let c="";try{for(;;){const{done:h,value:f}=await i.read();if(h)break;c+=d.decode(f,{stream:!0});let l;for(;(l=c.indexOf(`
|
|
2
|
+
`))!==-1;){const P=c.slice(0,l);c=c.slice(l+1),P!==""&&(yield JSON.parse(P))}}if(c+=d.decode(),c.trim()!=="")throw new m(502,"invalid_response","broker signal stream ended mid-line")}finally{await i.cancel().catch(()=>{})}}createStructuredRequest(e,t){return e.mode==="sync"?this.sendOnce("POST","/v1/structured-requests",e,t):this.request("POST","/v1/structured-requests",e,t)}getStructuredRequest(e,{wait:t=0,budgetMs:n}={}){if(!Number.isInteger(t)||t<0||t>25)throw new RangeError("wait must be an integer between 0 and 25");return this.request("GET",u(`/v1/structured-requests/${this.requestPath(e)}`,{wait:t}),void 0,{budgetMs:n})}cancelStructuredRequest(e,t){return this.request("POST",`/v1/structured-requests/${this.requestPath(e)}/cancel`,{},t)}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)}async recordBrokerTelemetry(e,t){await this.request("POST",r.nodeBrokerTelemetry(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 n=new URLSearchParams;t.link!==void 0&&n.set("link",t.link),t.preserve_episode!==void 0&&n.set("preserve_episode",String(t.preserve_episode));const s=n.size===0?"":`?${n.toString()}`;return this.request("DELETE",`${r.nodeFault(this.nodePath(e))}${s}`)}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??{})}async markNodeRead(e){await this.request("POST",r.nodeRead(this.nodePath(e)),{})}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)}listKinds(){return this.request("GET",r.kinds())}patchConfig(e,t){return this.request("PATCH",r.nodeConfig(this.nodePath(e)),t,t.model!==void 0?{timeout:45e3+this.timeoutMs}:void 0)}closeWorktree(e){return this.request("POST",r.nodeWorktreeClose(this.nodePath(e)),{})}abandonWorktree(e,t){return this.request("POST",r.nodeWorktreeAbandon(this.nodePath(e)),t)}retryDelivery(e){return this.request("POST",r.deliveryRetry(e),{})}listQuarantinedWorktrees(){return this.request("GET",r.quarantinedWorktrees())}showLimits(){return this.request("GET",r.limits())}setAppLimits(e,t){return this.request("PUT",r.limitsApp(e),t)}removeAppLimits(e,t){return this.request("DELETE",u(r.limitsApp(e),{fields:t.join(",")}))}listSpaces(){return this.request("GET",r.spaces())}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",u(r.focusByNode(),{node_id:e}))}focusByPane(e){return this.request("GET",u(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",u(r.crons(),e))}showCron(e,t){return this.request("GET",u(r.cron(this.cronPath(e)),t))}pauseCron(e,t){return this.request("POST",u(r.cronPause(this.cronPath(e)),t),{})}resumeCron(e,t){return this.request("POST",u(r.cronResume(this.cronPath(e)),t),{})}runCron(e,t){return this.request("POST",u(r.cronRun(this.cronPath(e)),t),{})}async cancelCron(e,t){await this.request("DELETE",u(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",u(r.nodeReports(this.nodePath(e)),t))}getTranscript(e,t){return this.request("GET",u(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",u(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",u(r.prospectiveChatInventory(),e))}getContext(e){return this.request("GET",r.nodeContext(this.nodePath(e)))}peekFile(e,t,n){return this.request("GET",u(r.filePeek(),{path:e,encoding:t}),void 0,n)}writeFile(e,t,n,s){return this.request("POST",r.fileWrite(),{path:e,content:t,encoding:n},s)}listFiles(e,t,n){return this.request("GET",u(r.fileList(),{path:e,limit:t}),void 0,n)}runBash(e,t){return this.request("POST",r.bash(),e,t)}objects={read:a((e,t)=>this.request("GET",u(r.object(e),t)),"read"),list:a(e=>this.request("GET",u(r.objects(),e)),"list"),search:a(e=>this.request("POST",r.objectsSearch(),e),"search"),watch:a((e,t={})=>this.request("POST",r.objectWatch(e),t),"watch"),unwatch:a((e,t)=>this.request("DELETE",u(r.objectWatch(e),t)),"unwatch"),edges:a((e,t)=>this.request("GET",u(r.objectEdges(e),t)),"edges")};docs={write:a(e=>this.request("POST",r.docs(),e),"write"),edit:a((e,t)=>this.request("PATCH",r.doc(e),t),"edit"),move:a((e,t)=>this.request("POST",r.docMove(e),t),"move"),delete:a(e=>this.request("DELETE",r.doc(e)),"delete"),history:a((e,t)=>this.request("GET",u(r.docHistory(e),t)),"history"),lint:a((e={})=>this.request("POST",r.docsLint(),e),"lint")};documents={reconcilePackages:a(()=>this.request("POST",r.documentsReconcilePackages()),"reconcilePackages")};plugins={appToken:a(e=>this.request("GET",r.pluginAppToken(e)),"appToken"),callHeaders:a((e,t)=>this.request("POST",r.pluginCallHeaders(e),t),"callHeaders")};nodeDelivery(e,t){return this.request("POST",r.nodeDelivery(this.nodePath(e)),t)}deliveryDryRun(e){return this.request("POST",r.deliveryDryRun(),e)}recordBackgroundedJob(e,t,n){return this.request("POST",r.nodeJobBackground(this.nodePath(e),this.jobPath(t)),n)}ensureProfile(e,t){return this.request("PUT",r.profile(e),t??{})}createProfile(e){return this.request("POST",r.profiles(),e)}listProfiles(){return this.request("GET",r.profiles())}updateProfile(e,t){return this.request("PATCH",r.profile(e),t)}listAppEnv(){return this.request("GET",r.appEnv())}setAppEnv(e,t){return this.request("PUT",r.appEnvVar(e),{value:t})}removeAppEnv(e){return this.request("DELETE",r.appEnvVar(e))}listProfileEnv(e){return this.request("GET",r.profileEnv(e))}setProfileEnv(e,t,n){return this.request("PUT",r.profileEnvVar(e,t),{value:n})}removeProfileEnv(e,t){return this.request("DELETE",r.profileEnvVar(e,t))}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())}getModelAuthReadiness(e){return this.request("GET",u(r.modelAuthReadiness(),e))}installCredential(e,t){return this.request("PUT",r.modelAuth(e),t)}removeCredential(e){return this.request("DELETE",r.modelAuth(e))}startModelAuth(e){return this.request("POST",r.modelAuthFlows(),e,{timeout:3e4+this.timeoutMs})}completeModelAuth(e,t){return this.request("POST",r.modelAuthFlowComplete(e),t,{timeout:35e3+this.timeoutMs})}cancelModelAuth(e){return this.request("POST",r.modelAuthFlowCancel(e),{})}getModelAuthFlow(e,t){return this.request("GET",u(r.modelAuthFlow(e),{wait:t}),void 0,{timeout:(t??0)*1e3+this.timeoutMs})}createReview(e){return this.request("POST",r.humanReviews(),e)}listReviews(e){return this.request("GET",u(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 n=e===void 0?"self":this.reviewPath(e);return this.request("POST",r.humanReviewComments(n),t)}listReviewComments(e,t){const n=e===void 0?"self":this.reviewPath(e);return this.request("GET",u(r.humanReviewComments(n),t))}readReviewCommentEvents(e,t){return this.request("GET",u(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",u(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)}listPageComponents(){return this.request("GET",r.humanComponents())}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,n){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:n})}async dashboard(e){const t=e?.under!==void 0?{under:e.under}:void 0,[n,s]=await Promise.all([this.listNodes(t),this.status()]);return{nodes:n,counts:s.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",u(r.canvasHistoryRead(),e))}historyStats(e){return this.request("POST",r.canvasHistoryStats(),e)}canvasSnapshot(){return this.request("GET",r.canvasSnapshot())}analytics(e){return this.request("GET",u(r.canvasAnalytics(),e),void 0,{timeout:6e4})}async recordMemoryReads(e,t){await this.request("POST",r.nodeMemoryReads(this.nodePath(e)),t)}liveRoots(e={}){return this.request("GET",u(r.canvasLiveRoots(),e))}canvasRoster(){return this.request("GET",r.canvasRoster())}async canvasBrowseCompressed(){const e=await this.send("GET",r.canvasBrowse());return e.ok||await S(e),new Uint8Array(await e.arrayBuffer())}canvasGraph(){return this.request("GET",r.canvasGraph())}prune(e){return this.request("POST",r.canvasPrune(),e)}async request(e,t,n,s){try{const i=s===void 0?void 0:this.resolveBudget(s),d=await this.send(e,t,n,i);return await S(d,i?.deadlineAt)}catch(i){throw T(i,s?.signal)}}async rawResponse(e,t,n){try{return await this.send(e,t,void 0,n)}catch(s){throw T(s,n?.signal)}}async send(e,t,n,s={}){const i=this.resolveBudget(s),d=e==="GET"||e==="HEAD"||e==="DELETE",c=i.maxRetries??this.maxRetries;for(let h=0;;h++){let f;try{f=await this.transport(e,t,n,i)}catch(l){if(this.isColdSocketError(l))try{await this.handleColdSocket(l,i.deadlineAt),f=await this.transport(e,t,n,i)}catch(P){throw i.deadlineAt!==void 0&&Date.now()>=i.deadlineAt&&!G(P,i.signal)?w(i.deadlineAt):T(P,i.signal)}else{if(this.isInterruptedSocketError(l)&&this.localSocketTransport&&(!d||h<c))return await this.rideOutInterruptedRequest(e,t,n,i);if(d&&h<c&&!G(l,i.signal)&&(!this.localSocketTransport||!this.isInterruptedSocketError(l))){await _(C(h+1),i);continue}else throw T(l,i.signal)}}if(d&&h<c&&H(f.status)){await k(f,i.deadlineAt),await _(C(h+1),i,j(f));continue}return f}}resolveBudget(e){const{budgetMs:t,deadlineAt:n,...s}=e;if(t===void 0&&n===void 0)return s;if(t!==void 0&&(!Number.isFinite(t)||t<=0||t>p))throw new RangeError(`budgetMs must be a positive finite number of at most ${p}`);if(n!==void 0&&(!Number.isFinite(n)||n-Date.now()>p))throw new RangeError(`deadlineAt must be a finite epoch-millisecond instant at most ${p} ms from now`);return{...s,deadlineAt:Math.min(n??1/0,t===void 0?1/0:Date.now()+t)}}async awaitWithinBudget(e,t){if(t===void 0)return e;const n=t-Date.now();if(n<=0)throw E(t);let s;try{return await Promise.race([e,new Promise((i,d)=>{s=setTimeout(()=>d(E(t)),n)})])}finally{s!==void 0&&clearTimeout(s)}}async sendOnce(e,t,n,s={}){const i=this.resolveBudget(s);try{return await S(await this.transport(e,t,n,i))}catch(d){throw T(d,i.signal)}}nodePath(e){if(!y(e))throw new m(400,"invalid_node_id",`invalid node id: ${JSON.stringify(e)}`);return e}jobPath(e){if(!N(e))throw new m(400,"invalid_job_id",`invalid background job id: ${JSON.stringify(e)}`);return e}cronPath(e){if(!x(e))throw new m(400,"invalid_cron_id",`invalid cron id: ${JSON.stringify(e)}`);return e}requestPath(e){if(!y(e))throw new m(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(!y(e))throw new m(400,"invalid_review_id",`invalid review id: ${JSON.stringify(e)}`);return e}commentPath(e){if(!/^[a-f0-9]{32}$/.test(e))throw new m(400,"invalid_comment_id",`invalid comment id: ${JSON.stringify(e)}`);return e}transport(e,t,n,s={}){const i=s.deadlineAt===void 0?void 0:s.deadlineAt-Date.now();if(i!==void 0&&i<=0)return Promise.reject(E(s.deadlineAt));const d=n===void 0?void 0:JSON.stringify(n),c={accept:"application/json",...this.headers,...s.headers};d!==void 0&&(c["content-type"]="application/json");const h=s.timeout??this.timeoutMs,f=i===void 0?h:h>0?Math.min(h,i):i,l=new AbortController,P=i!==void 0&&(h<=0||i<=h),g=f>0?setTimeout(()=>l.abort(P?E(s.deadlineAt):new DOMException("request timed out","TimeoutError")),f):void 0,q=s.signal,O=a(()=>l.abort(q?.reason),"onExternalAbort");q!==void 0&&(q.aborted?l.abort(q.reason):q.addEventListener("abort",O,{once:!0}));const R=a(()=>{g!==void 0&&clearTimeout(g),q?.removeEventListener("abort",O)},"finish");return W(this.fetch(new URL(t,this.baseUrl),{method:e,headers:c,body:d,signal:l.signal}),l.signal).then(v=>this.retainRequestLifetime(v,R,()=>l.signal.aborted?l.signal.reason:void 0),v=>{throw R(),v})}retainRequestLifetime(e,t,n){if(e.body===null)return t(),e;const s=e.body.getReader();let i=!1;const d=a(()=>{i||(i=!0,t())},"close"),c=new ReadableStream({async pull(h){try{const{done:f,value:l}=await s.read();f?(d(),h.close()):h.enqueue(l)}catch(f){d(),h.error(n()??f)}},async cancel(h){d(),await s.cancel(h)}});return new Response(c,{status:e.status,statusText:e.statusText,headers:e.headers})}isColdSocketError(e){const t=b(e);return t==="ECONNREFUSED"||t==="ENOENT"||t==="ENOTSOCK"}isInterruptedSocketError(e){const t=b(e);return t==="ECONNRESET"||t==="EPIPE"}async rideOutInterruptedRequest(e,t,n,s={}){try{await this.awaitAvailability(void 0,s.deadlineAt)}catch(i){throw T(i,s.signal)}if(e!=="GET"&&e!=="HEAD")throw new m(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,n,s)}catch(i){throw T(i,s.signal)}}async awaitAvailability(e,t){const n=t===void 0?void 0:t-Date.now();if(n!==void 0&&n<=0)throw E(t);let s;try{await $({windowMs:Math.min(this.coldStartPollWindowMs,n??this.coldStartPollWindowMs),initialError:e,retry:a(i=>i!==s,"retry"),probe:a(async i=>{const d=this.coldStartFailure?.();if(d!==void 0)throw s=new m(503,"daemon_unavailable",`crtrd failed to start: ${d}`),s;const c=await this.transport("GET",r.healthz(),void 0,{timeout:i});if(c.status>=200&&c.status<300){await k(c);return}const h=await c.text();try{if(typeof JSON.parse(h).startup_blocked=="string")return}catch{}throw new m(c.status,"daemon_health_unavailable",`crtrd health check returned HTTP ${c.status}: ${h.slice(0,500)}`)},"probe")})}catch(i){throw i===s&&(this.startupFailureReported=!0),i}}async handleColdSocket(e,t){const n=this.autostart&&this.onColdSocket!==void 0&&!this.coldStartAttempted;n&&(this.coldStartAttempted=!0,await this.awaitWithinBudget(this.onColdSocket(),t));try{await this.awaitAvailability(e,t)}catch(s){if(n&&!this.startupFailureReported){const i=J(this.coldStartDiagnostic);if(i!==void 0){const d=T(s);throw new m(d.status,d.code,`${d.message}
|
|
3
|
+
${i}`)}}throw s}}}function u(o,e){if(e===void 0)return o;const t=new URLSearchParams;for(const[s,i]of Object.entries(e))i!=null&&t.set(s,String(i));const n=t.toString();return n===""?o:`${o}?${n}`}a(u,"withQuery");async function S(o,e){const t=o.status>=200&&o.status<300,n=(await U(o,e)).trim();let s;if(n!=="")try{s=JSON.parse(n)}catch{if(t)return;throw new m(o.status,"invalid_response",n.slice(0,500),void 0,o.headers)}if(t)return s;throw A(s)?new m(o.status,s.error.code,s.error.message,s.error.details,o.headers,s.error):new m(o.status,"internal",`request failed with status ${o.status}`,void 0,o.headers)}a(S,"parse");function H(o){return o===429||o>=500}a(H,"isRetryableStatus");async function k(o,e){const t=(async()=>{try{await o.body?.cancel()}catch{}})();if(e===void 0)return t;let n;try{await Promise.race([t,new Promise(s=>{n=setTimeout(s,Math.max(0,e-Date.now()))})])}finally{n!==void 0&&clearTimeout(n)}}a(k,"drainResponseBody");async function U(o,e){if(e===void 0)return o.text();const t=e-Date.now(),n=o.text();if(n.catch(()=>{}),t<=0)throw o.body?.cancel().catch(()=>{}),w(e);let s;try{return await Promise.race([n,new Promise((i,d)=>{s=setTimeout(()=>{o.body?.cancel().catch(()=>{}),d(w(e))},t)})])}finally{s!==void 0&&clearTimeout(s)}}a(U,"readTextWithin");function C(o){return Math.min(2e3,250*2**(o-1))}a(C,"retryDelayMs");function b(o){if(typeof o!="object"||o===null)return;const e=o.code;if(typeof e=="string")return e;const t=o.cause;if(typeof t=="object"&&t!==null){const n=t.code;if(typeof n=="string")return n}}a(b,"transportErrorCode");function G(o,e){return e?.aborted?!0:o instanceof DOMException&&(o.name==="AbortError"||o.name==="TimeoutError")}a(G,"isAbortError");function T(o,e){if(e?.aborted)return new m(0,"request_aborted","request aborted by caller signal");if(o instanceof m)return o;if(o instanceof DOMException&&o.name==="TimeoutError")return new m(504,"request_timeout",`crtrd request timed out: ${o.message}`);if(o instanceof DOMException&&o.name==="AbortError")return new m(0,"request_aborted","request aborted by caller signal");const t=b(o),n=o instanceof Error?o.message:String(o);return t==="ECONNREFUSED"||t==="ENOENT"||t==="ENOTSOCK"?new m(503,"daemon_unavailable",`crtrd is not reachable: ${n}`):t==="ETIMEDOUT"?new m(504,"request_timeout",`crtrd request timed out: ${n}`):new m(503,"transport_error",n)}a(T,"toTransportApiError");function j(o){const e=Number(o.headers.get("retry-after"));return Number.isFinite(e)&&e>0?e:void 0}a(j,"retryAfterHeaderS");async function _(o,e,t,n){const{deadlineAt:s,signal:i}=e;if(i?.aborted)throw new m(0,"request_aborted","request aborted by caller signal");const d=s!==void 0&&t!==void 0?t*1e3:void 0,c=Math.max(o,d??0);if(s!==void 0&&Date.now()+c>=s){const h=w(s,d!==void 0&&d>=o?"retry_after":"elapsed",d===void 0?void 0:t);throw n!==void 0&&Object.defineProperty(h,"cause",{value:n,configurable:!0,writable:!0}),h}if(i===void 0)return M(c);await new Promise((h,f)=>{const l=a(()=>{clearTimeout(P),i.removeEventListener("abort",l),f(new m(0,"request_aborted","request aborted by caller signal"))},"onAbort"),P=setTimeout(()=>{i.removeEventListener("abort",l),h()},c);i.addEventListener("abort",l,{once:!0})})}a(_,"sleepWithin");function W(o,e){return new Promise((t,n)=>{const s=a(()=>n(e.reason),"onAbort");e.aborted?s():e.addEventListener("abort",s,{once:!0}),o.then(i=>{e.removeEventListener("abort",s),e.aborted?i.body?.cancel().catch(()=>{}):t(i)},i=>{e.removeEventListener("abort",s),n(i)})})}a(W,"abortable");function M(o){return new Promise(e=>setTimeout(e,o))}a(M,"sleepMs");function J(o){if(o!==void 0)try{return o()}catch{return}}a(J,"safeColdStartDiagnostic");export{Y as CrtrClient,p as MAX_TIMER_MS,w as deadlineExceeded,J as safeColdStartDiagnostic,_ as sleepWithin,$ as waitForDaemonAvailability};
|
package/dist/api/contract.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** The contract level this build serves and requires. Written by `scripts/contract.mjs release`; never edit by hand. */
|
|
2
|
-
export declare const CONTRACT_LEVEL = "1.
|
|
2
|
+
export declare const CONTRACT_LEVEL = "1.18";
|
|
3
3
|
/** Request header naming the one contract level the caller needs, e.g. `1.3`. Optional: absent means no check. */
|
|
4
4
|
export declare const REQUIRED_CONTRACT_HEADER = "Crouter-Required-Contract";
|
|
5
5
|
/** Response header listing the contract levels the server serves, comma-separated, one per major, e.g. `1.3`. */
|
package/dist/api/contract.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var c=Object.defineProperty;var e=(r,t)=>c(r,"name",{value:t,configurable:!0});const f="1.
|
|
1
|
+
var c=Object.defineProperty;var e=(r,t)=>c(r,"name",{value:t,configurable:!0});const f="1.18",i="Crouter-Required-Contract",p="Crouter-Contract";function l(r){const t=/^(\d+)\.(\d+)$/.exec(r.trim());return t===null?null:{major:Number(t[1]),minor:Number(t[2])}}e(l,"parseContractLevel");function a(r){return r==null?[]:r.split(",").map(t=>l(t)).filter(t=>t!==null)}e(a,"parseServedContracts");function s(r,t){const n=l(r);return n===null?!1:(typeof t=="string"||t===null||t===void 0?a(t):t).some(u=>u.major===n.major&&u.minor>=n.minor)}e(s,"contractSatisfies");function C(r,t,n={}){if(r===void 0)return null;if(l(r)===null)return{status:400,code:"invalid_request",param:i,message:`${i} must be a contract level like 1.0.`};if(s(r,t))return null;const o=r.trim();return{status:426,code:"runtime_version_unsupported",message:t===null||a(t).length===0?`The runtime did not name its contract level; the caller requires contract ${o} or later. Roll the runtime forward.`:`The runtime serves contract ${t}; the caller requires contract ${o} or later within the same major. Roll the runtime forward, or pin an SDK whose crouterContract the runtime serves.`,details:{sdk_version:(n.legacyMinimum??"").trim(),runtime_version:n.runtimeVersion??null,required_contract:o,runtime_contract:t}}}e(C,"contractRefusal");export{p as CONTRACT_HEADER,f as CONTRACT_LEVEL,i as REQUIRED_CONTRACT_HEADER,C as contractRefusal,s as contractSatisfies,l as parseContractLevel,a as parseServedContracts};
|
package/dist/api/dto/canvas.d.ts
CHANGED
|
@@ -68,6 +68,8 @@ export interface HistorySearchQuery {
|
|
|
68
68
|
from?: string;
|
|
69
69
|
/** Weigh full body text in ranking (`--body`). */
|
|
70
70
|
weigh_body?: boolean;
|
|
71
|
+
/** One hit per node (its best-scoring artifact), every matching node, unpaginated. Requires non-empty `nodes`; each hit carries `node_id`. */
|
|
72
|
+
per_node?: boolean;
|
|
71
73
|
/** relevance | recency | oldest — already resolved to the effective sort. */
|
|
72
74
|
sort?: string;
|
|
73
75
|
snippet_lines?: number;
|
|
@@ -303,6 +305,44 @@ export interface BrowseCanvasDTO {
|
|
|
303
305
|
nodes: BrowseNodeDTO[];
|
|
304
306
|
edges: RosterEdgeDTO[];
|
|
305
307
|
}
|
|
308
|
+
/** One in-tree child of a live root, for the dashboard's expansion. */
|
|
309
|
+
export interface LiveRootChildDTO {
|
|
310
|
+
node_id: NodeIdDTO;
|
|
311
|
+
name: string;
|
|
312
|
+
status: NodeStatusDTO;
|
|
313
|
+
streaming: boolean;
|
|
314
|
+
asks: number;
|
|
315
|
+
fault: string | null;
|
|
316
|
+
}
|
|
317
|
+
/** One live root conversation with everything the dashboard row shows, counted over its whole subtree. */
|
|
318
|
+
export interface LiveRootDTO {
|
|
319
|
+
node_id: NodeIdDTO;
|
|
320
|
+
name: string;
|
|
321
|
+
cwd: string;
|
|
322
|
+
profile_id: string | null;
|
|
323
|
+
status: NodeStatusDTO;
|
|
324
|
+
/** The State line of the last recap; null before the first recap. */
|
|
325
|
+
state_line: string | null;
|
|
326
|
+
/** The persisted first message, shown while `state_line` is null. */
|
|
327
|
+
goal: string | null;
|
|
328
|
+
/** Pending inbox items (asks and reviews) from any node in the subtree. */
|
|
329
|
+
asks: number;
|
|
330
|
+
/** The oldest pending ask's inbox ticket id. */
|
|
331
|
+
first_ask_ticket_id: string | null;
|
|
332
|
+
/** The first fault in root-then-subtree order, as a short summary. */
|
|
333
|
+
fault: string | null;
|
|
334
|
+
/** Nodes in the subtree, root included, with an open turn and a live process. */
|
|
335
|
+
running_count: number;
|
|
336
|
+
/** The root settled a turn after a viewer was last shown the conversation. */
|
|
337
|
+
unread: boolean;
|
|
338
|
+
last_activity: IsoTime;
|
|
339
|
+
children: LiveRootChildDTO[];
|
|
340
|
+
}
|
|
341
|
+
/** `GET /v1/canvas/live-roots` — the dashboard's one-read projection. Person callers only. */
|
|
342
|
+
export interface LiveRootsDTO {
|
|
343
|
+
generated_at: IsoTime;
|
|
344
|
+
rows: LiveRootDTO[];
|
|
345
|
+
}
|
|
306
346
|
/** One row in `GET /v1/canvas/graph`: exactly the node fields the attach graph displays. */
|
|
307
347
|
export interface GraphNodeDTO {
|
|
308
348
|
node_id: NodeIdDTO;
|
package/dist/api/routes.d.ts
CHANGED
|
@@ -59,6 +59,7 @@ export declare const routes: {
|
|
|
59
59
|
readonly brokerRecovery: (id: string) => string;
|
|
60
60
|
readonly nodeFault: (id: string) => string;
|
|
61
61
|
readonly nodeClose: (id: string) => string;
|
|
62
|
+
readonly nodeRead: (id: string) => string;
|
|
62
63
|
readonly nodeRecycle: (id: string) => string;
|
|
63
64
|
readonly nodeDemote: (id: string) => string;
|
|
64
65
|
readonly nodePromote: (id: string) => string;
|
|
@@ -92,6 +93,7 @@ export declare const routes: {
|
|
|
92
93
|
readonly canvasHistoryRead: () => string;
|
|
93
94
|
readonly canvasHistoryStats: () => string;
|
|
94
95
|
readonly canvasSnapshot: () => string;
|
|
96
|
+
readonly canvasLiveRoots: () => string;
|
|
95
97
|
readonly canvasRoster: () => string;
|
|
96
98
|
readonly canvasBrowse: () => string;
|
|
97
99
|
readonly canvasAnalytics: () => string;
|
package/dist/api/routes.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var s=Object.defineProperty;var o=(e,n)=>s(e,"name",{value:n,configurable:!0});const t="v1",r="/v1",a={healthz:o(()=>"/healthz","healthz"),status:o(()=>"/v1/status","status"),due:o(()=>"/v1/due","due"),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"),nodeMemoryReads:o(e=>`/v1/nodes/${e}/memory-reads`,"nodeMemoryReads"),nodeOutcome:o(e=>`/v1/nodes/${e}/outcome`,"nodeOutcome"),nodeOutcomeDelivery:o(e=>`/v1/nodes/${e}/outcome-delivery`,"nodeOutcomeDelivery"),nodeEvents:o(e=>`/v1/nodes/${e}/events`,"nodeEvents"),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"),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"),nodeJobBackground:o((e,n)=>`/v1/nodes/${e}/jobs/${n}/background`,"nodeJobBackground"),nodeDelivery:o(e=>`/v1/nodes/${e}/delivery`,"nodeDelivery"),deliveryDryRun:o(()=>"/v1/delivery/dry-run","deliveryDryRun"),deliveryRetry:o(e=>`/v1/deliveries/${encodeURIComponent(e)}/retry`,"deliveryRetry"),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"),nodeBrokerTelemetry:o(e=>`/v1/nodes/${e}/broker/telemetry`,"nodeBrokerTelemetry"),nodeLog:o(e=>`/v1/nodes/${e}/records/log`,"nodeLog"),nodeTelemetry:o(e=>`/v1/nodes/${e}/records/telemetry`,"nodeTelemetry"),nodeRecap:o(e=>`/v1/nodes/${e}/records/recap`,"nodeRecap"),nodeInboxReport:o(e=>`/v1/nodes/${e}/records/inbox`,"nodeInboxReport"),nodePassiveMessage:o(e=>`/v1/nodes/${e}/records/passive`,"nodePassiveMessage"),nodePushedFinal:o(e=>`/v1/nodes/${e}/records/pushed-final`,"nodePushedFinal"),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"),nodeBrokerSignals:o(e=>`/v1/nodes/${e}/broker/signals`,"nodeBrokerSignals"),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"),kinds:o(()=>"/v1/kinds","kinds"),nodeWorktreeClose:o(e=>`/v1/nodes/${e}/worktree/close`,"nodeWorktreeClose"),nodeWorktreeAbandon:o(e=>`/v1/nodes/${e}/worktree/abandon`,"nodeWorktreeAbandon"),quarantinedWorktrees:o(()=>"/v1/worktrees/quarantined","quarantinedWorktrees"),spaces:o(()=>"/v1/spaces","spaces"),limits:o(()=>"/v1/limits","limits"),limitsApp:o(e=>`/v1/limits/apps/${encodeURIComponent(e)}`,"limitsApp"),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"),canvasBrowse:o(()=>"/v1/canvas/browse","canvasBrowse"),canvasAnalytics:o(()=>"/v1/canvas/analytics","canvasAnalytics"),canvasGraph:o(()=>"/v1/canvas/graph","canvasGraph"),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"),humanComponents:o(()=>"/v1/human/components","humanComponents"),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"),appEnv:o(()=>"/v1/apps/self/env","appEnv"),appEnvVar:o(e=>`/v1/apps/self/env/${encodeURIComponent(e)}`,"appEnvVar"),profileEnv:o(e=>`/v1/profiles/${e}/env`,"profileEnv"),profileEnvVar:o((e,n)=>`/v1/profiles/${e}/env/${n}`,"profileEnvVar"),modelAuths:o(()=>"/v1/model-auth","modelAuths"),modelAuthReadiness:o(()=>"/v1/model-auth/readiness","modelAuthReadiness"),modelAuth:o(e=>`/v1/model-auth/${e}`,"modelAuth"),modelAuthFlows:o(()=>"/v1/model-auth/flows","modelAuthFlows"),modelAuthFlow:o(e=>`/v1/model-auth/flows/${encodeURIComponent(e)}`,"modelAuthFlow"),modelAuthFlowComplete:o(e=>`/v1/model-auth/flows/${encodeURIComponent(e)}/complete`,"modelAuthFlowComplete"),modelAuthFlowCancel:o(e=>`/v1/model-auth/flows/${encodeURIComponent(e)}/cancel`,"modelAuthFlowCancel"),filePeek:o(()=>"/v1/files/peek","filePeek"),fileWrite:o(()=>"/v1/files/write","fileWrite"),fileList:o(()=>"/v1/files/list","fileList"),bash:o(()=>"/v1/bash","bash"),objects:o(()=>"/v1/objects","objects"),object:o(e=>`/v1/objects/${encodeURIComponent(e)}`,"object"),objectsSearch:o(()=>"/v1/objects/search","objectsSearch"),objectWatch:o(e=>`/v1/objects/${encodeURIComponent(e)}/watch`,"objectWatch"),customObjects:o(()=>"/v1/custom-objects","customObjects"),customObject:o(e=>`/v1/custom-objects/${encodeURIComponent(e)}`,"customObject"),customObjectEvents:o(e=>`/v1/custom-objects/${encodeURIComponent(e)}/events`,"customObjectEvents"),customObjectDeliveries:o(e=>`/v1/custom-objects/${encodeURIComponent(e)}/deliveries`,"customObjectDeliveries"),customObjectAck:o(e=>`/v1/custom-objects/${encodeURIComponent(e)}/deliveries/ack`,"customObjectAck"),objectEdges:o(e=>`/v1/objects/${encodeURIComponent(e)}/edges`,"objectEdges"),docs:o(()=>"/v1/docs","docs"),doc:o(e=>`/v1/docs/${encodeURIComponent(e)}`,"doc"),docMove:o(e=>`/v1/docs/${encodeURIComponent(e)}/move`,"docMove"),docHistory:o(e=>`/v1/docs/${encodeURIComponent(e)}/history`,"docHistory"),docsLint:o(()=>"/v1/docs/lint","docsLint"),pluginAppToken:o(e=>`/v1/plugins/${encodeURIComponent(e)}/app-token`,"pluginAppToken"),pluginCallHeaders:o(e=>`/v1/plugins/${encodeURIComponent(e)}/call-headers`,"pluginCallHeaders"),documentsReconcilePackages:o(()=>"/v1/documents/reconcile-packages","documentsReconcilePackages")};export{t as API_VERSION,a as routes};
|
|
1
|
+
var s=Object.defineProperty;var o=(e,n)=>s(e,"name",{value:n,configurable:!0});const t="v1",a="/v1",r={healthz:o(()=>"/healthz","healthz"),status:o(()=>"/v1/status","status"),due:o(()=>"/v1/due","due"),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"),nodeMemoryReads:o(e=>`/v1/nodes/${e}/memory-reads`,"nodeMemoryReads"),nodeOutcome:o(e=>`/v1/nodes/${e}/outcome`,"nodeOutcome"),nodeOutcomeDelivery:o(e=>`/v1/nodes/${e}/outcome-delivery`,"nodeOutcomeDelivery"),nodeEvents:o(e=>`/v1/nodes/${e}/events`,"nodeEvents"),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"),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"),nodeJobBackground:o((e,n)=>`/v1/nodes/${e}/jobs/${n}/background`,"nodeJobBackground"),nodeDelivery:o(e=>`/v1/nodes/${e}/delivery`,"nodeDelivery"),deliveryDryRun:o(()=>"/v1/delivery/dry-run","deliveryDryRun"),deliveryRetry:o(e=>`/v1/deliveries/${encodeURIComponent(e)}/retry`,"deliveryRetry"),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"),nodeBrokerTelemetry:o(e=>`/v1/nodes/${e}/broker/telemetry`,"nodeBrokerTelemetry"),nodeLog:o(e=>`/v1/nodes/${e}/records/log`,"nodeLog"),nodeTelemetry:o(e=>`/v1/nodes/${e}/records/telemetry`,"nodeTelemetry"),nodeRecap:o(e=>`/v1/nodes/${e}/records/recap`,"nodeRecap"),nodeInboxReport:o(e=>`/v1/nodes/${e}/records/inbox`,"nodeInboxReport"),nodePassiveMessage:o(e=>`/v1/nodes/${e}/records/passive`,"nodePassiveMessage"),nodePushedFinal:o(e=>`/v1/nodes/${e}/records/pushed-final`,"nodePushedFinal"),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"),nodeBrokerSignals:o(e=>`/v1/nodes/${e}/broker/signals`,"nodeBrokerSignals"),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"),nodeRead:o(e=>`/v1/nodes/${e}/read`,"nodeRead"),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"),kinds:o(()=>"/v1/kinds","kinds"),nodeWorktreeClose:o(e=>`/v1/nodes/${e}/worktree/close`,"nodeWorktreeClose"),nodeWorktreeAbandon:o(e=>`/v1/nodes/${e}/worktree/abandon`,"nodeWorktreeAbandon"),quarantinedWorktrees:o(()=>"/v1/worktrees/quarantined","quarantinedWorktrees"),spaces:o(()=>"/v1/spaces","spaces"),limits:o(()=>"/v1/limits","limits"),limitsApp:o(e=>`/v1/limits/apps/${encodeURIComponent(e)}`,"limitsApp"),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"),canvasLiveRoots:o(()=>"/v1/canvas/live-roots","canvasLiveRoots"),canvasRoster:o(()=>"/v1/canvas/roster","canvasRoster"),canvasBrowse:o(()=>"/v1/canvas/browse","canvasBrowse"),canvasAnalytics:o(()=>"/v1/canvas/analytics","canvasAnalytics"),canvasGraph:o(()=>"/v1/canvas/graph","canvasGraph"),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"),humanComponents:o(()=>"/v1/human/components","humanComponents"),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"),appEnv:o(()=>"/v1/apps/self/env","appEnv"),appEnvVar:o(e=>`/v1/apps/self/env/${encodeURIComponent(e)}`,"appEnvVar"),profileEnv:o(e=>`/v1/profiles/${e}/env`,"profileEnv"),profileEnvVar:o((e,n)=>`/v1/profiles/${e}/env/${n}`,"profileEnvVar"),modelAuths:o(()=>"/v1/model-auth","modelAuths"),modelAuthReadiness:o(()=>"/v1/model-auth/readiness","modelAuthReadiness"),modelAuth:o(e=>`/v1/model-auth/${e}`,"modelAuth"),modelAuthFlows:o(()=>"/v1/model-auth/flows","modelAuthFlows"),modelAuthFlow:o(e=>`/v1/model-auth/flows/${encodeURIComponent(e)}`,"modelAuthFlow"),modelAuthFlowComplete:o(e=>`/v1/model-auth/flows/${encodeURIComponent(e)}/complete`,"modelAuthFlowComplete"),modelAuthFlowCancel:o(e=>`/v1/model-auth/flows/${encodeURIComponent(e)}/cancel`,"modelAuthFlowCancel"),filePeek:o(()=>"/v1/files/peek","filePeek"),fileWrite:o(()=>"/v1/files/write","fileWrite"),fileList:o(()=>"/v1/files/list","fileList"),bash:o(()=>"/v1/bash","bash"),objects:o(()=>"/v1/objects","objects"),object:o(e=>`/v1/objects/${encodeURIComponent(e)}`,"object"),objectsSearch:o(()=>"/v1/objects/search","objectsSearch"),objectWatch:o(e=>`/v1/objects/${encodeURIComponent(e)}/watch`,"objectWatch"),customObjects:o(()=>"/v1/custom-objects","customObjects"),customObject:o(e=>`/v1/custom-objects/${encodeURIComponent(e)}`,"customObject"),customObjectEvents:o(e=>`/v1/custom-objects/${encodeURIComponent(e)}/events`,"customObjectEvents"),customObjectDeliveries:o(e=>`/v1/custom-objects/${encodeURIComponent(e)}/deliveries`,"customObjectDeliveries"),customObjectAck:o(e=>`/v1/custom-objects/${encodeURIComponent(e)}/deliveries/ack`,"customObjectAck"),objectEdges:o(e=>`/v1/objects/${encodeURIComponent(e)}/edges`,"objectEdges"),docs:o(()=>"/v1/docs","docs"),doc:o(e=>`/v1/docs/${encodeURIComponent(e)}`,"doc"),docMove:o(e=>`/v1/docs/${encodeURIComponent(e)}/move`,"docMove"),docHistory:o(e=>`/v1/docs/${encodeURIComponent(e)}/history`,"docHistory"),docsLint:o(()=>"/v1/docs/lint","docsLint"),pluginAppToken:o(e=>`/v1/plugins/${encodeURIComponent(e)}/app-token`,"pluginAppToken"),pluginCallHeaders:o(e=>`/v1/plugins/${encodeURIComponent(e)}/call-headers`,"pluginCallHeaders"),documentsReconcilePackages:o(()=>"/v1/documents/reconcile-packages","documentsReconcilePackages")};export{t as API_VERSION,r as routes};
|
|
@@ -9,6 +9,14 @@ when-and-why-to-read: When you need Release notes, this knowledge should be read
|
|
|
9
9
|
|
|
10
10
|
Changes to `@north-light/sdk` that can change what an existing app sees. Newest first.
|
|
11
11
|
|
|
12
|
+
## 0.3.505
|
|
13
|
+
|
|
14
|
+
The dashboard and `/resume` content search add two routes and two optional fields. Additive: no request or response an existing app sends or reads changes.
|
|
15
|
+
|
|
16
|
+
- `GET /v1/canvas/live-roots` returns the profile's live root conversations with their attention state (`LiveRootsDTO`).
|
|
17
|
+
- `POST /v1/nodes/{id}/read` stamps a parked conversation as read; only the person may call it.
|
|
18
|
+
- `HistorySearchQuery.per_node` (optional) returns one best hit per node for a non-empty `nodes` list; each hit then carries `node_id`.
|
|
19
|
+
|
|
12
20
|
## 0.3.502
|
|
13
21
|
|
|
14
22
|
An app can be app-paid: the directory registers the app's inference endpoint, and the runtime serves the app's `llm` calls and its runs' model calls from that endpoint instead of the person's subscription. Additive: an app registered as user-paid sees no change.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { spawn } from 'node:child_process';
|
|
2
2
|
import { createAssistantMessageEventStream, } from '@earendil-works/pi-ai';
|
|
3
3
|
import { anthropicMessagesApi, openAICodexResponsesApi, openAIResponsesApi } from '@earendil-works/pi-ai/compat';
|
|
4
|
-
import { ANTHROPIC_PROVIDER_ID, OPENAI_CHATGPT_PROVIDER_ID, OPENAI_CODEX_PROVIDER_ID, INVALID_REFRESH_TOKEN_BACKOFF_MS, openAIDeviceId, coolingUntilFor, formatCooldowns, formatStatusLine, getProviderLabel, isManagedProvider, isInvalidRefreshTokenError, addSubscription, enrichManagedLoginIdentity, markSubscriptionAuthenticationFailed, markSubscriptionRateLimited, markSubscriptionSuccess, retryAfterMsFromHeaders, retryAfterMsFromError, promoteSubscription, readRotationConfig, readSubscriptionPool, refreshSubscriptionCredential, removeManagedAccount, resolveProviderCandidates, upsertSubscriptionWithUniqueAccount, subscriptionNeedsSuccessWrite, } from '../../../core/subscription-state.js';
|
|
4
|
+
import { ANTHROPIC_PROVIDER_ID, OPENAI_CHATGPT_PROVIDER_ID, OPENAI_CODEX_PROVIDER_ID, INVALID_REFRESH_TOKEN_BACKOFF_MS, openAIDeviceId, MAX_RATE_LIMIT_COOLDOWN_MS, coolingUntilFor, formatCooldowns, formatStatusLine, getProviderLabel, isManagedProvider, isInvalidRefreshTokenError, addSubscription, enrichManagedLoginIdentity, markSubscriptionAuthenticationFailed, markSubscriptionRateLimited, markSubscriptionSuccess, retryAfterMsFromHeaders, retryAfterMsFromError, promoteSubscription, readRotationConfig, readSubscriptionPool, refreshSubscriptionCredential, removeManagedAccount, resolveProviderCandidates, upsertSubscriptionWithUniqueAccount, subscriptionNeedsSuccessWrite, } from '../../../core/subscription-state.js';
|
|
5
5
|
import { classifyRateLimit, describeRateLimitScope, rateLimitHeaders } from '../../../core/rate-limit-scope.js';
|
|
6
6
|
import { readMergedLaunchConfig } from '../../../core/config.js';
|
|
7
7
|
import { expandModelCandidates, modelRequestFromConfig, probeRouteAvailability } from '../../../core/model-routes.js';
|
|
@@ -696,7 +696,7 @@ async function runManagedProvider(state, model, context, options, stream) {
|
|
|
696
696
|
}
|
|
697
697
|
if (result.result === 'rate_limited' || result.classification?.status !== undefined || result.classification?.hadRetryAfterHeader === true)
|
|
698
698
|
sawHttpEvidence = true;
|
|
699
|
-
const cooldownMs = result.result === 'rate_limited' ? result.retryAfterMs ?? DEFAULT_RATE_LIMIT_BACKOFF_MS : TRANSIENT_ROTATE_COOLDOWN_MS;
|
|
699
|
+
const cooldownMs = Math.min(result.result === 'rate_limited' ? result.retryAfterMs ?? DEFAULT_RATE_LIMIT_BACKOFF_MS : TRANSIENT_ROTATE_COOLDOWN_MS, MAX_RATE_LIMIT_COOLDOWN_MS);
|
|
700
700
|
if (result.result === 'transient_exhausted')
|
|
701
701
|
lastTransientFailure = result;
|
|
702
702
|
if (result.result === 'rate_limited' && (result.classification?.status === 401 || result.classification?.status === 403))
|
|
@@ -754,7 +754,7 @@ async function runManagedProvider(state, model, context, options, stream) {
|
|
|
754
754
|
}
|
|
755
755
|
if (result.result === 'rate_limited' || result.classification?.status !== undefined || result.classification?.hadRetryAfterHeader === true)
|
|
756
756
|
sawHttpEvidence = true;
|
|
757
|
-
const cooldownMs = result.result === 'rate_limited' ? result.retryAfterMs ?? DEFAULT_RATE_LIMIT_BACKOFF_MS : TRANSIENT_ROTATE_COOLDOWN_MS;
|
|
757
|
+
const cooldownMs = Math.min(result.result === 'rate_limited' ? result.retryAfterMs ?? DEFAULT_RATE_LIMIT_BACKOFF_MS : TRANSIENT_ROTATE_COOLDOWN_MS, MAX_RATE_LIMIT_COOLDOWN_MS);
|
|
758
758
|
if (result.result === 'transient_exhausted')
|
|
759
759
|
lastTransientFailure = result;
|
|
760
760
|
if (result.result === 'rate_limited' && (result.classification?.status === 401 || result.classification?.status === 403))
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
OPENAI_CODEX_PROVIDER_ID,
|
|
20
20
|
INVALID_REFRESH_TOKEN_BACKOFF_MS,
|
|
21
21
|
openAIDeviceId,
|
|
22
|
+
MAX_RATE_LIMIT_COOLDOWN_MS,
|
|
22
23
|
coolingUntilFor,
|
|
23
24
|
formatCooldowns,
|
|
24
25
|
formatStatusLine,
|
|
@@ -913,7 +914,7 @@ async function runManagedProvider(
|
|
|
913
914
|
const result = await streamProviderAttempt(state, providerId, candidateModel, context, attemptOptions, undefined, stream);
|
|
914
915
|
if (result.result === 'success' || result.result === 'fatal') { state.transportOnlyExhaustedPasses = 0; stream.end(); return; }
|
|
915
916
|
if (result.result === 'rate_limited' || result.classification?.status !== undefined || result.classification?.hadRetryAfterHeader === true) sawHttpEvidence = true;
|
|
916
|
-
const cooldownMs = result.result === 'rate_limited' ? result.retryAfterMs ?? DEFAULT_RATE_LIMIT_BACKOFF_MS : TRANSIENT_ROTATE_COOLDOWN_MS;
|
|
917
|
+
const cooldownMs = Math.min(result.result === 'rate_limited' ? result.retryAfterMs ?? DEFAULT_RATE_LIMIT_BACKOFF_MS : TRANSIENT_ROTATE_COOLDOWN_MS, MAX_RATE_LIMIT_COOLDOWN_MS);
|
|
917
918
|
if (result.result === 'transient_exhausted') lastTransientFailure = result;
|
|
918
919
|
if (result.result === 'rate_limited' && (result.classification?.status === 401 || result.classification?.status === 403)) lastAuthRejection = result;
|
|
919
920
|
if (result.rateLimit && Object.keys(result.rateLimit.headers).length) lastRateLimit = { providerId, model: candidateModel, observation: result.rateLimit };
|
|
@@ -955,7 +956,7 @@ async function runManagedProvider(
|
|
|
955
956
|
}
|
|
956
957
|
if (result.result === 'fatal') { state.transportOnlyExhaustedPasses = 0; stream.end(); return; }
|
|
957
958
|
if (result.result === 'rate_limited' || result.classification?.status !== undefined || result.classification?.hadRetryAfterHeader === true) sawHttpEvidence = true;
|
|
958
|
-
const cooldownMs = result.result === 'rate_limited' ? result.retryAfterMs ?? DEFAULT_RATE_LIMIT_BACKOFF_MS : TRANSIENT_ROTATE_COOLDOWN_MS;
|
|
959
|
+
const cooldownMs = Math.min(result.result === 'rate_limited' ? result.retryAfterMs ?? DEFAULT_RATE_LIMIT_BACKOFF_MS : TRANSIENT_ROTATE_COOLDOWN_MS, MAX_RATE_LIMIT_COOLDOWN_MS);
|
|
959
960
|
if (result.result === 'transient_exhausted') lastTransientFailure = result;
|
|
960
961
|
if (result.result === 'rate_limited' && (result.classification?.status === 401 || result.classification?.status === 403)) lastAuthRejection = result;
|
|
961
962
|
if (result.rateLimit && Object.keys(result.rateLimit.headers).length) lastRateLimit = { providerId, model: candidateModel, account: freshCredential.label, observation: result.rateLimit };
|