@north-light/api 0.0.0 → 0.3.415

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 (251) hide show
  1. package/LICENSE +18 -0
  2. package/README.md +66 -2
  3. package/dist/api/__tests__/deadline.test.d.ts +1 -0
  4. package/dist/api/__tests__/deadline.test.js +46 -0
  5. package/dist/api/__tests__/error-codes.test.d.ts +1 -0
  6. package/dist/api/__tests__/error-codes.test.js +79 -0
  7. package/dist/api/__tests__/integration/client.test.d.ts +1 -0
  8. package/dist/api/__tests__/integration/client.test.js +276 -0
  9. package/dist/api/client.d.ts +521 -0
  10. package/dist/api/client.js +1388 -0
  11. package/dist/api/command-manifest/index.d.ts +3 -0
  12. package/dist/api/command-manifest/index.js +3 -0
  13. package/dist/api/command-manifest/manifest.d.ts +51 -0
  14. package/dist/api/command-manifest/manifest.js +332 -0
  15. package/dist/api/command-manifest/result.d.ts +25 -0
  16. package/dist/api/command-manifest/result.js +97 -0
  17. package/dist/api/command-manifest/schema.d.ts +28 -0
  18. package/dist/api/command-manifest/schema.js +856 -0
  19. package/dist/api/dto/analytics.d.ts +184 -0
  20. package/dist/api/dto/analytics.js +3 -0
  21. package/dist/api/dto/attach.d.ts +22 -0
  22. package/dist/api/dto/attach.js +13 -0
  23. package/dist/api/dto/bash-jobs.d.ts +24 -0
  24. package/dist/api/dto/bash-jobs.js +9 -0
  25. package/dist/api/dto/bash.d.ts +17 -0
  26. package/dist/api/dto/bash.js +1 -0
  27. package/dist/api/dto/broker-ops.d.ts +187 -0
  28. package/dist/api/dto/broker-ops.js +6 -0
  29. package/dist/api/dto/broker-signals.d.ts +25 -0
  30. package/dist/api/dto/broker-signals.js +1 -0
  31. package/dist/api/dto/broker.d.ts +86 -0
  32. package/dist/api/dto/broker.js +20 -0
  33. package/dist/api/dto/canvas.d.ts +359 -0
  34. package/dist/api/dto/canvas.js +2 -0
  35. package/dist/api/dto/chat-inventory.d.ts +56 -0
  36. package/dist/api/dto/chat-inventory.js +11 -0
  37. package/dist/api/dto/common.d.ts +29 -0
  38. package/dist/api/dto/common.js +15 -0
  39. package/dist/api/dto/config.d.ts +46 -0
  40. package/dist/api/dto/config.js +3 -0
  41. package/dist/api/dto/crons.d.ts +164 -0
  42. package/dist/api/dto/crons.js +10 -0
  43. package/dist/api/dto/custom-objects.d.ts +66 -0
  44. package/dist/api/dto/custom-objects.js +1 -0
  45. package/dist/api/dto/delivery.d.ts +71 -0
  46. package/dist/api/dto/delivery.js +7 -0
  47. package/dist/api/dto/docs.d.ts +135 -0
  48. package/dist/api/dto/docs.js +8 -0
  49. package/dist/api/dto/files.d.ts +21 -0
  50. package/dist/api/dto/files.js +1 -0
  51. package/dist/api/dto/focus.d.ts +24 -0
  52. package/dist/api/dto/focus.js +10 -0
  53. package/dist/api/dto/grants.d.ts +28 -0
  54. package/dist/api/dto/grants.js +1 -0
  55. package/dist/api/dto/health.d.ts +116 -0
  56. package/dist/api/dto/health.js +2 -0
  57. package/dist/api/dto/human-requests.d.ts +113 -0
  58. package/dist/api/dto/human-requests.js +4 -0
  59. package/dist/api/dto/human.d.ts +28 -0
  60. package/dist/api/dto/human.js +4 -0
  61. package/dist/api/dto/inbox.d.ts +273 -0
  62. package/dist/api/dto/inbox.js +4 -0
  63. package/dist/api/dto/lifecycle.d.ts +88 -0
  64. package/dist/api/dto/lifecycle.js +3 -0
  65. package/dist/api/dto/limits.d.ts +29 -0
  66. package/dist/api/dto/limits.js +2 -0
  67. package/dist/api/dto/mail.d.ts +44 -0
  68. package/dist/api/dto/mail.js +1 -0
  69. package/dist/api/dto/messages.d.ts +104 -0
  70. package/dist/api/dto/messages.js +2 -0
  71. package/dist/api/dto/model-config.d.ts +25 -0
  72. package/dist/api/dto/model-config.js +1 -0
  73. package/dist/api/dto/modelauth.d.ts +132 -0
  74. package/dist/api/dto/modelauth.js +4 -0
  75. package/dist/api/dto/node-events.d.ts +65 -0
  76. package/dist/api/dto/node-events.js +4 -0
  77. package/dist/api/dto/node-outcomes.d.ts +88 -0
  78. package/dist/api/dto/node-outcomes.js +2 -0
  79. package/dist/api/dto/node-records.d.ts +35 -0
  80. package/dist/api/dto/node-records.js +5 -0
  81. package/dist/api/dto/nodes.d.ts +371 -0
  82. package/dist/api/dto/nodes.js +3 -0
  83. package/dist/api/dto/objects.d.ts +172 -0
  84. package/dist/api/dto/objects.js +5 -0
  85. package/dist/api/dto/profiles.d.ts +117 -0
  86. package/dist/api/dto/profiles.js +4 -0
  87. package/dist/api/dto/recovery.d.ts +104 -0
  88. package/dist/api/dto/recovery.js +1 -0
  89. package/dist/api/dto/reports.d.ts +95 -0
  90. package/dist/api/dto/reports.js +2 -0
  91. package/dist/api/dto/review-comments.d.ts +146 -0
  92. package/dist/api/dto/review-comments.js +5 -0
  93. package/dist/api/dto/reviews.d.ts +113 -0
  94. package/dist/api/dto/reviews.js +5 -0
  95. package/dist/api/dto/run-events.d.ts +295 -0
  96. package/dist/api/dto/run-events.js +6 -0
  97. package/dist/api/dto/structured-requests.d.ts +64 -0
  98. package/dist/api/dto/structured-requests.js +5 -0
  99. package/dist/api/dto/subscriptions.d.ts +14 -0
  100. package/dist/api/dto/subscriptions.js +2 -0
  101. package/dist/api/dto/usage.d.ts +27 -0
  102. package/dist/api/dto/usage.js +1 -0
  103. package/dist/api/dto/worktree.d.ts +55 -0
  104. package/dist/api/dto/worktree.js +6 -0
  105. package/dist/api/error-codes.d.ts +259 -0
  106. package/dist/api/error-codes.js +56 -0
  107. package/dist/api/errors.d.ts +47 -0
  108. package/dist/api/errors.js +66 -0
  109. package/dist/api/index.d.ts +49 -0
  110. package/dist/api/index.js +46 -0
  111. package/dist/api/long-poll.d.ts +59 -0
  112. package/dist/api/long-poll.js +67 -0
  113. package/dist/api/node-transport.d.ts +18 -0
  114. package/dist/api/node-transport.js +105 -0
  115. package/dist/api/plugin-manifest-schema.d.ts +233 -0
  116. package/dist/api/plugin-manifest-schema.js +23 -0
  117. package/dist/api/routes.d.ts +164 -0
  118. package/dist/api/routes.js +197 -0
  119. package/dist/api/runtime-version.d.ts +31 -0
  120. package/dist/api/runtime-version.js +50 -0
  121. package/dist/core/asset-root.d.ts +7 -0
  122. package/dist/core/asset-root.js +18 -0
  123. package/dist/core/canvas/boot-id.d.ts +6 -0
  124. package/dist/core/canvas/boot-id.js +26 -0
  125. package/dist/core/canvas/paths.d.ts +72 -0
  126. package/dist/core/canvas/paths.js +163 -0
  127. package/dist/core/canvas/pid.d.ts +391 -0
  128. package/dist/core/canvas/pid.js +948 -0
  129. package/dist/core/command-plugins/bundle.d.ts +149 -0
  130. package/dist/core/command-plugins/bundle.js +588 -0
  131. package/dist/core/command-plugins/endpoint.d.ts +24 -0
  132. package/dist/core/command-plugins/endpoint.js +51 -0
  133. package/dist/core/config.d.ts +233 -0
  134. package/dist/core/config.js +1120 -0
  135. package/dist/core/env-name.d.ts +6 -0
  136. package/dist/core/env-name.js +9 -0
  137. package/dist/core/errors.d.ts +38 -0
  138. package/dist/core/errors.js +90 -0
  139. package/dist/core/events/emit.d.ts +6 -0
  140. package/dist/core/events/emit.js +42 -0
  141. package/dist/core/events/envelope.d.ts +2 -0
  142. package/dist/core/events/envelope.js +84 -0
  143. package/dist/core/events/errors.d.ts +4 -0
  144. package/dist/core/events/errors.js +69 -0
  145. package/dist/core/events/operation-id.d.ts +4 -0
  146. package/dist/core/events/operation-id.js +24 -0
  147. package/dist/core/events/serialize.d.ts +4 -0
  148. package/dist/core/events/serialize.js +199 -0
  149. package/dist/core/events/source.d.ts +16 -0
  150. package/dist/core/events/source.js +31 -0
  151. package/dist/core/events/types.d.ts +68 -0
  152. package/dist/core/events/types.js +11 -0
  153. package/dist/core/exclusive-lock.d.ts +34 -0
  154. package/dist/core/exclusive-lock.js +197 -0
  155. package/dist/core/fs-utils.d.ts +44 -0
  156. package/dist/core/fs-utils.js +208 -0
  157. package/dist/core/help.d.ts +309 -0
  158. package/dist/core/help.js +406 -0
  159. package/dist/core/human/page-catalog.d.ts +57 -0
  160. package/dist/core/human/page-catalog.js +172 -0
  161. package/dist/core/installed-plugins.d.ts +2 -0
  162. package/dist/core/installed-plugins.js +79 -0
  163. package/dist/core/io.d.ts +122 -0
  164. package/dist/core/io.js +373 -0
  165. package/dist/core/keybindings/attach-control.d.ts +49 -0
  166. package/dist/core/keybindings/attach-control.js +42 -0
  167. package/dist/core/keybindings/catalog.d.ts +18 -0
  168. package/dist/core/keybindings/catalog.js +257 -0
  169. package/dist/core/keybindings/types.d.ts +42 -0
  170. package/dist/core/keybindings/types.js +1 -0
  171. package/dist/core/layout.d.ts +36 -0
  172. package/dist/core/layout.js +112 -0
  173. package/dist/core/locked-file.d.ts +27 -0
  174. package/dist/core/locked-file.js +118 -0
  175. package/dist/core/log.d.ts +9 -0
  176. package/dist/core/log.js +89 -0
  177. package/dist/core/manifest.d.ts +5 -0
  178. package/dist/core/manifest.js +15 -0
  179. package/dist/core/plugin-env.d.ts +8 -0
  180. package/dist/core/plugin-env.js +31 -0
  181. package/dist/core/plugin-extensions.d.ts +29 -0
  182. package/dist/core/plugin-extensions.js +191 -0
  183. package/dist/core/plugin-swap-lock.d.ts +9 -0
  184. package/dist/core/plugin-swap-lock.js +31 -0
  185. package/dist/core/preview-result-path.d.ts +4 -0
  186. package/dist/core/preview-result-path.js +26 -0
  187. package/dist/core/profiles/env-store.d.ts +22 -0
  188. package/dist/core/profiles/env-store.js +163 -0
  189. package/dist/core/profiles/fuzzy-match.d.ts +19 -0
  190. package/dist/core/profiles/fuzzy-match.js +92 -0
  191. package/dist/core/profiles/manifest.d.ts +120 -0
  192. package/dist/core/profiles/manifest.js +529 -0
  193. package/dist/core/rate-limit-scope.d.ts +25 -0
  194. package/dist/core/rate-limit-scope.js +64 -0
  195. package/dist/core/render.d.ts +12 -0
  196. package/dist/core/render.js +138 -0
  197. package/dist/core/resolver.d.ts +14 -0
  198. package/dist/core/resolver.js +111 -0
  199. package/dist/core/runtime/branded-host.d.ts +55 -0
  200. package/dist/core/runtime/branded-host.js +485 -0
  201. package/dist/core/runtime/broker/daemon-ops.d.ts +65 -0
  202. package/dist/core/runtime/broker/daemon-ops.js +177 -0
  203. package/dist/core/runtime/broker/signal-stream.d.ts +30 -0
  204. package/dist/core/runtime/broker/signal-stream.js +149 -0
  205. package/dist/core/scope.d.ts +32 -0
  206. package/dist/core/scope.js +184 -0
  207. package/dist/core/scoped-state/db.d.ts +17 -0
  208. package/dist/core/scoped-state/db.js +247 -0
  209. package/dist/core/scoped-state/migrate.d.ts +8 -0
  210. package/dist/core/scoped-state/migrate.js +187 -0
  211. package/dist/core/scoped-state/paths.d.ts +9 -0
  212. package/dist/core/scoped-state/paths.js +27 -0
  213. package/dist/core/scoped-state/profiles.d.ts +27 -0
  214. package/dist/core/scoped-state/profiles.js +93 -0
  215. package/dist/core/scoped-state/providers.d.ts +24 -0
  216. package/dist/core/scoped-state/providers.js +19 -0
  217. package/dist/core/scoped-state/schema.d.ts +6 -0
  218. package/dist/core/scoped-state/schema.js +43 -0
  219. package/dist/core/scoped-state/settings.d.ts +28 -0
  220. package/dist/core/scoped-state/settings.js +83 -0
  221. package/dist/core/spaces/open-beneath.d.ts +71 -0
  222. package/dist/core/spaces/open-beneath.js +581 -0
  223. package/dist/core/sqlite-statements.d.ts +4 -0
  224. package/dist/core/sqlite-statements.js +17 -0
  225. package/dist/core/subscription-state.d.ts +121 -0
  226. package/dist/core/subscription-state.js +287 -0
  227. package/dist/core/user-settings.d.ts +377 -0
  228. package/dist/core/user-settings.js +458 -0
  229. package/dist/daemon/broker-signals/bus.d.ts +30 -0
  230. package/dist/daemon/broker-signals/bus.js +87 -0
  231. package/dist/daemon/manage.d.ts +176 -0
  232. package/dist/daemon/manage.js +664 -0
  233. package/dist/daemon/pidfile.d.ts +8 -0
  234. package/dist/daemon/pidfile.js +37 -0
  235. package/dist/daemon/startup-policy.d.ts +1 -0
  236. package/dist/daemon/startup-policy.js +1 -0
  237. package/dist/native/linux.d.ts +29 -0
  238. package/dist/native/linux.js +20 -0
  239. package/dist/shared/env.d.ts +116 -0
  240. package/dist/shared/env.js +271 -0
  241. package/dist/shared/generated-context.d.ts +83 -0
  242. package/dist/shared/generated-context.js +235 -0
  243. package/dist/shared/inbox-entry-body.d.ts +22 -0
  244. package/dist/shared/inbox-entry-body.js +116 -0
  245. package/dist/shared/predicates.d.ts +2 -0
  246. package/dist/shared/predicates.js +4 -0
  247. package/dist/shared/working-activity.d.ts +9 -0
  248. package/dist/shared/working-activity.js +27 -0
  249. package/dist/types.d.ts +562 -0
  250. package/dist/types.js +186 -0
  251. package/package.json +46 -5
@@ -0,0 +1,521 @@
1
+ import { ApiError } from './errors.js';
2
+ import type { AppLimitsChangeDTO, LimitsDTO, SetAppLimitsRequest } from './dto/limits.js';
3
+ import type { DaemonAdmitDTO, DaemonRestartDTO, DueDTO, HealthDTO, MigrateStateDTO, MigrateStateRequest, StatusDTO } from './dto/health.js';
4
+ import type { BashJobStatusDTO, BashJobStopResultDTO } from './dto/bash-jobs.js';
5
+ import type { ContextListDTO, CreateNodeRequest, ListNodesQuery, NodeDetailDTO, NodeMessagesPageDTO, NodeMessagesQuery, NodeSessionDTO, NodeSnapshotDTO, NodeSubjectDTO, NodeSummaryDTO, TranscriptDTO, TranscriptQuery } from './dto/nodes.js';
6
+ import type { NodeOutcomeResponseDTO, OutcomeDeliveryDTO, RegisterOutcomeDeliveryRequest } from './dto/node-outcomes.js';
7
+ import type { AnalyticsDTO, AnalyticsQuery, MemoryReadsRequestDTO } from './dto/analytics.js';
8
+ import type { NodeEventsQuery } from './dto/node-events.js';
9
+ import type { BrokerSignalLineDTO } from './dto/broker-signals.js';
10
+ import type { NodeLogAppendRequest, NodeLogAppendResultDTO, NodeTelemetryRecordRequest, NodeRecapRecordRequest, NodeMessageBodyDTO, NodePushedFinalRequest, NodePushedFinalResultDTO } from './dto/node-records.js';
11
+ import type { InterruptResultDTO, MessageResultDTO, SendMessageRequest } from './dto/messages.js';
12
+ import type { CreateStructuredRequest, CreateStructuredRequestResponse, StructuredRequestDTO } from './dto/structured-requests.js';
13
+ import type { PushReportRequest, PushReportResultDTO, ReportDTO, ReportsQuery, SubmitResultDTO, SubmitResultRequest } from './dto/reports.js';
14
+ import type { CloseRequest, CloseResultDTO, PromoteRequest, RelaunchRootResultDTO, ReviveRequest, ReviveResultDTO, WaitRequest, YieldRequest } from './dto/lifecycle.js';
15
+ import type { SubscribeRequest, SubscriptionDTO } from './dto/subscriptions.js';
16
+ import type { FocusDTO, RegisterFocusRequest, SetFocusPaneRequest } from './dto/focus.js';
17
+ import { type ArmCronRequest, type CancelCronQuery, type CronDTO, type CronRunDTO, type CronScopeQuery, type CronShowDTO, type ListCronsQuery, type PokeCronsResult } from './dto/crons.js';
18
+ import type { KindListDTO, NodeConfigPatch } from './dto/config.js';
19
+ import type { AttachEnsureRequest, AttachEnsureResultDTO } from './dto/attach.js';
20
+ import type { CreateProfileRequest, DeleteProfileRequest, DeleteProfileResultDTO, EnsureProfileRequest, ProfileDTO, ProfileEnvChangeDTO, ProfileEnvNamesDTO, ProfilePauseResultDTO, UpdateProfileMetadataRequest, UpdateProfileRequest } from './dto/profiles.js';
21
+ import type { FileEncoding, FileListDTO, FilePeekDTO, FileWriteDTO } from './dto/files.js';
22
+ import type { BashRunDTO, BashRunParams } from './dto/bash.js';
23
+ import type { EdgesDTO, EdgesQuery, ObjectListDTO, ObjectListRequest, ObjectReadDTO, ObjectReadQuery, ObjectSearchDTO, ObjectSearchRequest, UnwatchQuery, UnwatchResultDTO, WatchRequest, WatchResultDTO } from './dto/objects.js';
24
+ import type { DocDeletedDTO, DocEditRequest, DocEditedDTO, DocHistoryDTO, DocHistoryQuery, DocLintDTO, DocLintRequest, DocMoveRequest, DocMovedDTO, DocWriteRequest, DocWrittenDTO, ReconcilePackagesDTO } from './dto/docs.js';
25
+ import type { BackgroundedJobDTO, BackgroundedJobRequest, DeliveryDryRunRequest, DeliveryRequest, DeliveryResponse } from './dto/delivery.js';
26
+ import type { ChatInventoryDTO, ProspectiveChatInventoryDTO, ProspectiveChatInventoryQuery } from './dto/chat-inventory.js';
27
+ import type { CredentialRemovalResultDTO, CredentialResultDTO, InstallCredentialRequest, CompleteModelAuthFlowRequest, ModelAuthFlowCompletedDTO, ModelAuthFlowDTO, ModelAuthFlowStartedDTO, ModelAuthListDTO, ModelAuthReadinessDTO, ModelAuthReadinessQuery, StartModelAuthFlowRequest } from './dto/modelauth.js';
28
+ import type { CancelReviewRequest, CreateReviewRequest, ListReviewsQuery, ReviewCancelResultDTO, ReviewDocumentBaseDTO, ReviewDTO, ReviewListDTO, ReviewSubmitResultDTO } from './dto/reviews.js';
29
+ import type { CreateReviewCommentRequest, EditReviewCommentRequest, ListReviewCommentsQuery, ReadReviewCommentEventsQuery, ReviewCommentActionRequest, ReviewCommentDetailDTO, ReviewCommentEventsDTO, ReviewCommentForkDTO, ReviewCommentListDTO, ReviewCommentMutationDTO, ReviewCommentRangeBatchRequest, ReviewCommentRangeBatchResultDTO } from './dto/review-comments.js';
30
+ import type { CancelInboxTicketRequest, CanceledTicketResultDTO, InboxListDTO, InboxPageDTO, InboxPageHistoryDTO, InboxPageResponseDTO, InboxTicketIdDTO, PageFeedbackResolutionDTO, PageResponsesDTO, PageTicketResultDTO, RespondInboxPageRequest } from './dto/inbox.js';
31
+ import type { CreateHumanRequestDTO, CreateHumanRequestRequest, HumanRequestDTO, HumanRequestIdDTO, ReplaceHumanRequestRequest, RespondHumanRequestRequest, SettleHumanRequestRequest, PageComponentListDTO } from './dto/human-requests.js';
32
+ 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 { AbandonWorktreeRequest, AbandonWorktreeResultDTO, CloseWorktreeResultDTO, QuarantinedWorktreeDTO, SpaceListDTO } from './dto/worktree.js';
34
+ import type { BrokerExtensionStateDTO, BrokerExecutionRequest, BrokerGeneratedNameRequest, BrokerGeneratedNameResultDTO, BrokerModelCommitRequest, BrokerModelCommitResultDTO, BrokerParkActivityResultDTO, BrokerParkCompleteRequest, BrokerPersonaAckRequest, BrokerPersonaAckResultDTO, BrokerSessionBoundRequest, BrokerSessionBoundResultDTO, BrokerSettleDirective, BrokerSettleRequest, BrokerTelemetryRequest } from './dto/broker-ops.js';
35
+ import type { AcknowledgeMailRequest, AcknowledgeMailResultDTO, ClaimMailRequest, ClaimMailResultDTO } from './dto/mail.js';
36
+ import type { BrokerFaultInputDTO, BrokerFaultRequest, BrokerFaultResultDTO, BrokerProviderRetryRequest, BrokerProviderRetryResultDTO, BrokerTurnRequest, BrokerTurnResultDTO, NodeFaultClearResultDTO, RecoveryStateDTO } from './dto/recovery.js';
37
+ export interface CrtrClientOptions {
38
+ /** `http(s)://host:port` for a TCP/remote transport. */
39
+ baseUrl: string;
40
+ /** Fetch implementation. The global Web fetch is used unless a caller supplies one. */
41
+ fetch?: typeof fetch;
42
+ /** Extra headers, e.g. `{ authorization: 'Bearer <token>' }` when the target
43
+ * crtrd's TCP listener has `CRTRD_TOKEN` set (unix-socket transport is
44
+ * never checked, and a TCP daemon with no token set ignores this too). */
45
+ headers?: Record<string, string>;
46
+ /** Retry a cold local connection through this hook once when enabled. */
47
+ autostart?: boolean;
48
+ /** Maximum retries for transient GET, HEAD, and DELETE requests. Defaults to 2. */
49
+ maxRetries?: number;
50
+ /** Per-request timeout in ms (default 30_000). */
51
+ timeoutMs?: number;
52
+ /** Injected daemon-start hook (spec §7.1). Called once on a cold socket when
53
+ * autostart is on; after it resolves, the client polls `/healthz` and retries
54
+ * the original request once. Absent → a cold socket throws `daemon_unavailable`. */
55
+ onColdSocket?: () => Promise<void>;
56
+ /** Injected cold-start diagnostic. Called ONLY when the bounded
57
+ * `/healthz` poll times out after `onColdSocket`, so the caller can attach
58
+ * operator-useful context (e.g. a bounded tail of `crtrd.log`) to the
59
+ * `daemon_unavailable` error instead of it staying a bare message. Must
60
+ * return synchronously and cheaply — it runs on the failure path, not the
61
+ * happy path. A thrown/undefined result is treated as "no diagnostic". */
62
+ coldStartDiagnostic?: () => string | undefined;
63
+ /** Polled during the cold-start wait: a string means the daemon this client
64
+ * started has terminally failed (it exited before becoming ready), so the
65
+ * wait ends immediately with that text instead of polling out the window. */
66
+ coldStartFailure?: () => string | undefined;
67
+ /** Strict wall-clock window (ms) for local API availability after a cold
68
+ * socket or interrupted response. Each probe is capped to the remaining
69
+ * budget. Defaults to `HEALTHZ_POLL_WINDOW_MS`. */
70
+ coldStartPollWindowMs?: number;
71
+ }
72
+ /** One strict wall-clock availability window shared by local API clients and
73
+ * daemon management. Each probe gets only the budget remaining at its start. */
74
+ export declare function waitForDaemonAvailability({ windowMs, probe, initialError, pollIntervalMs, retry, now, sleep, }: {
75
+ windowMs: number;
76
+ probe: (timeoutMs: number) => Promise<void>;
77
+ initialError?: unknown;
78
+ pollIntervalMs?: number;
79
+ retry?: (error: unknown) => boolean;
80
+ now?: () => number;
81
+ sleep?: (ms: number) => Promise<void> | void;
82
+ }): Promise<void>;
83
+ export interface CrtrRequestOptions {
84
+ headers?: Record<string, string>;
85
+ signal?: AbortSignal;
86
+ timeout?: number;
87
+ maxRetries?: number;
88
+ /** Limits the full call — every attempt, response body, and cold-socket or
89
+ * interrupted-response recovery — to one wall-clock budget, without changing
90
+ * the client's default inactivity timeout. */
91
+ budgetMs?: number;
92
+ /** The same limit as an absolute instant (epoch milliseconds), for a caller that already holds one deadline
93
+ * for a larger operation and passes it to every call inside it. With `budgetMs` too, the earlier wins. */
94
+ deadlineAt?: number;
95
+ }
96
+ /** Why a call stopped at its deadline: `elapsed` — the time ran out; `retry_after` — the server asked for a wait
97
+ * longer than the time left, so the call stopped without sleeping. */
98
+ export type DeadlineReason = 'elapsed' | 'retry_after';
99
+ /** The one error a call raises when its deadline passes (or a wait would pass it): status 504, code `deadline_exceeded`,
100
+ * `details: { deadline_at, reason, retry_after_s? }`. */
101
+ /** The longest delay a timer accepts (2^31-1 ms, about 24.8 days); a longer deadline would fire at once. */
102
+ export declare const MAX_TIMER_MS = 2147483647;
103
+ export declare function deadlineExceeded(deadlineAt: number, reason?: DeadlineReason, retryAfterS?: number): ApiError;
104
+ export declare class CrtrClient {
105
+ private readonly baseUrl;
106
+ private readonly fetch;
107
+ private readonly headers;
108
+ private readonly autostart;
109
+ private readonly timeoutMs;
110
+ private readonly maxRetries;
111
+ private readonly localSocketTransport;
112
+ private readonly onColdSocket?;
113
+ private readonly coldStartDiagnostic?;
114
+ private readonly coldStartFailure?;
115
+ private readonly coldStartPollWindowMs;
116
+ /** Set when the last availability wait ended on a daemon startup failure, whose message already says why. */
117
+ private startupFailureReported;
118
+ /** Guards against invoking the daemon-start hook more than once per client. */
119
+ private coldStartAttempted;
120
+ constructor(opts: CrtrClientOptions);
121
+ healthz(): Promise<HealthDTO>;
122
+ /** One `/healthz` observation without cold-socket recovery. Availability
123
+ * waiters own retry policy and pass their remaining wall-clock budget here. */
124
+ probeHealthz(timeoutMs: number): Promise<HealthDTO>;
125
+ status(): Promise<StatusDTO>;
126
+ /** Busy and next-due state, the truth behind sandbox sleep and wake. */
127
+ due(): Promise<DueDTO>;
128
+ /** Ask the daemon to replace itself with a successor running the currently
129
+ * selected runtime generation. Answers before the handover starts, so a
130
+ * caller living inside a node the handover will tear down still gets a
131
+ * settled result. */
132
+ restartDaemon(): Promise<DaemonRestartDTO>;
133
+ admitDaemon(): Promise<DaemonAdmitDTO>;
134
+ migrateState(req: MigrateStateRequest): Promise<MigrateStateDTO>;
135
+ appendNodeLog(id: string, req: NodeLogAppendRequest): Promise<NodeLogAppendResultDTO>;
136
+ putNodeTelemetry(id: string, req: NodeTelemetryRecordRequest): Promise<void>;
137
+ putNodeRecap(id: string, req: NodeRecapRecordRequest): Promise<void>;
138
+ readNodeInboxReport(id: string, ref: string, executionId: string): Promise<NodeMessageBodyDTO>;
139
+ readNodePassiveMessage(id: string, ref: string): Promise<NodeMessageBodyDTO>;
140
+ nodePushedFinal(id: string, req: NodePushedFinalRequest): Promise<NodePushedFinalResultDTO>;
141
+ createNode(req: CreateNodeRequest): Promise<NodeDetailDTO>;
142
+ /** List canvas nodes with composable row filters. `include: 'activity'` adds
143
+ * latest/canonical reports and pending-human counts in the same response. */
144
+ listNodes(q?: ListNodesQuery): Promise<NodeSummaryDTO[]>;
145
+ getNode(id: string): Promise<NodeDetailDTO>;
146
+ /** Read a node outcome, optionally awaiting it for at most 25 seconds. This
147
+ * is a GET so the client can safely replay it across daemon handover. */
148
+ getNodeOutcome(id: string, { waitSeconds }?: {
149
+ waitSeconds?: number;
150
+ }): Promise<NodeOutcomeResponseDTO>;
151
+ /** Open the raw server-sent event response for a node. The caller owns SSE
152
+ * parsing and must consume or cancel the response body. Streams deliberately
153
+ * have no client wall-clock timeout. */
154
+ getNodeEvents(id: string, query?: NodeEventsQuery, options?: Omit<CrtrRequestOptions, 'timeout'>): Promise<Response>;
155
+ /** Parsed NDJSON hints, consumed eagerly and line by line. The caller must
156
+ * cancel with `signal` when done; no wall-clock timeout applies to the stream. */
157
+ getBrokerSignals(id: string, executionId: string, options?: Omit<CrtrRequestOptions, 'timeout'>): AsyncIterable<BrokerSignalLineDTO>;
158
+ createStructuredRequest(req: CreateStructuredRequest, options?: CrtrRequestOptions): Promise<CreateStructuredRequestResponse>;
159
+ getStructuredRequest(requestId: string, { wait, budgetMs }?: {
160
+ wait?: number;
161
+ budgetMs?: number;
162
+ }): Promise<StructuredRequestDTO>;
163
+ cancelStructuredRequest(requestId: string, options?: CrtrRequestOptions): Promise<StructuredRequestDTO>;
164
+ /** Register or replace an armed target for terminal-outcome delivery. */
165
+ registerOutcomeDelivery(id: string, req: RegisterOutcomeDeliveryRequest): Promise<OutcomeDeliveryDTO>;
166
+ getOutcomeDelivery(id: string): Promise<OutcomeDeliveryDTO>;
167
+ /** Disarm an unsettled outcome-delivery registration. */
168
+ disarmOutcomeDelivery(id: string): Promise<void>;
169
+ listBashJobs(id: string): Promise<BashJobStatusDTO[]>;
170
+ stopBashJob(id: string, jobId: string): Promise<BashJobStopResultDTO>;
171
+ sendMessage(id: string, req: SendMessageRequest): Promise<MessageResultDTO>;
172
+ /** First-class interrupt (the human Esc): cancels pending undelivered
173
+ * human-send inbox entries, then aborts a live in-flight turn. NEVER
174
+ * revives a dormant target. */
175
+ interruptNode(id: string): Promise<InterruptResultDTO>;
176
+ pushReport(id: string, req: PushReportRequest): Promise<PushReportResultDTO>;
177
+ submitResult(id: string, req: SubmitResultRequest): Promise<SubmitResultDTO>;
178
+ forkNode(id: string): Promise<NodeDetailDTO>;
179
+ reviveNode(id: string, req?: ReviveRequest): Promise<ReviveResultDTO>;
180
+ relaunchRoot(id: string): Promise<RelaunchRootResultDTO>;
181
+ bindBrokerSession(id: string, req: BrokerSessionBoundRequest): Promise<BrokerSessionBoundResultDTO>;
182
+ settleBroker(id: string, req: BrokerSettleRequest): Promise<BrokerSettleDirective>;
183
+ completeBrokerPark(id: string, req: BrokerParkCompleteRequest): Promise<BrokerSettleDirective>;
184
+ recordBrokerParkActivity(id: string, req: BrokerExecutionRequest): Promise<BrokerParkActivityResultDTO>;
185
+ recordBrokerTelemetry(id: string, req: BrokerTelemetryRequest): Promise<void>;
186
+ claimNodeMail(id: string, req: ClaimMailRequest): Promise<ClaimMailResultDTO>;
187
+ acknowledgeNodeMail(id: string, req: AcknowledgeMailRequest): Promise<AcknowledgeMailResultDTO>;
188
+ recordBrokerTurn(id: string, req: BrokerTurnRequest): Promise<BrokerTurnResultDTO>;
189
+ mutateBrokerProviderRetry(id: string, req: BrokerProviderRetryRequest): Promise<BrokerProviderRetryResultDTO>;
190
+ mutateBrokerFault(id: string, req: BrokerFaultRequest): Promise<BrokerFaultResultDTO>;
191
+ getBrokerRecovery(id: string, expectedExecutionId: string): Promise<RecoveryStateDTO>;
192
+ recordNodeFault(id: string, req: BrokerFaultInputDTO): Promise<BrokerFaultResultDTO>;
193
+ clearNodeFault(id: string, opts?: {
194
+ link?: BrokerFaultInputDTO['link'];
195
+ preserve_episode?: boolean;
196
+ }): Promise<NodeFaultClearResultDTO>;
197
+ commitBrokerModel(id: string, req: BrokerModelCommitRequest): Promise<BrokerModelCommitResultDTO>;
198
+ brokerExtensionState(id: string): Promise<BrokerExtensionStateDTO>;
199
+ commitBrokerGeneratedName(id: string, req: BrokerGeneratedNameRequest): Promise<BrokerGeneratedNameResultDTO>;
200
+ commitBrokerPersonaAck(id: string, req: BrokerPersonaAckRequest): Promise<BrokerPersonaAckResultDTO>;
201
+ closeNode(id: string, req?: CloseRequest): Promise<CloseResultDTO>;
202
+ recycleNode(id: string): Promise<NodeDetailDTO>;
203
+ demoteNode(id: string): Promise<NodeDetailDTO>;
204
+ promoteNode(id: string, req: PromoteRequest): Promise<NodeDetailDTO>;
205
+ yieldNode(id: string, req: YieldRequest): Promise<NodeDetailDTO>;
206
+ waitNode(id: string, req: WaitRequest): Promise<NodeDetailDTO>;
207
+ listKinds(): Promise<KindListDTO>;
208
+ /** A model change may first wait up to 30 s for a starting broker's view
209
+ * socket and then 15 s for its ack, so it gets that budget on top. */
210
+ patchConfig(id: string, patch: NodeConfigPatch): Promise<NodeDetailDTO>;
211
+ /** Land + close the node's managed git worktree (spec §6.2). Server-side
212
+ * because it interleaves a canvas WRITE with a git land transaction and
213
+ * crtrd is the repo host (same principle as spawnChild's creation git). */
214
+ closeWorktree(id: string): Promise<CloseWorktreeResultDTO>;
215
+ abandonWorktree(id: string, req: AbandonWorktreeRequest): Promise<AbandonWorktreeResultDTO>;
216
+ /** Re-queue a permanently failed push delivery or daemon action with a fresh attempt budget. */
217
+ retryDelivery(deliveryId: string): Promise<{
218
+ delivery_id: string;
219
+ state: 'pending';
220
+ }>;
221
+ listQuarantinedWorktrees(): Promise<QuarantinedWorktreeDTO[]>;
222
+ /** Effective per-app memory and disk caps and whether this host enforces them. */
223
+ showLimits(): Promise<LimitsDTO>;
224
+ setAppLimits(app: string, req: SetAppLimitsRequest): Promise<AppLimitsChangeDTO>;
225
+ removeAppLimits(app: string, fields: Array<'memory' | 'disk'>): Promise<AppLimitsChangeDTO>;
226
+ /** Every space on the runtime with its size. */
227
+ listSpaces(): Promise<SpaceListDTO>;
228
+ subscribe(id: string, req: SubscribeRequest): Promise<SubscriptionDTO>;
229
+ listFocuses(): Promise<FocusDTO[]>;
230
+ focusOf(nodeId: string): Promise<FocusDTO | null>;
231
+ focusByPane(pane: string): Promise<FocusDTO | null>;
232
+ registerFocus(req: RegisterFocusRequest): Promise<FocusDTO | null>;
233
+ setFocusPane(focusId: string, req: SetFocusPaneRequest): Promise<void>;
234
+ closeFocus(focusId: string): Promise<void>;
235
+ unsubscribe(id: string, target: string): Promise<void>;
236
+ /** Arm one cron (`POST /v1/crons`) — the server mints the cron_id. */
237
+ armCron(req: ArmCronRequest): Promise<CronDTO>;
238
+ /** Crons visible to the caller (`GET /v1/crons`). With `q.profile` that is
239
+ * that profile's crons plus every global one; omit it only for a
240
+ * canvas-home-wide provenance read ("which crons did node X arm"). */
241
+ listCrons(q?: ListCronsQuery): Promise<CronDTO[]>;
242
+ /** One cron with its run-log ring (`GET /v1/crons/:cronId`). */
243
+ showCron(cronId: string, q?: CronScopeQuery): Promise<CronShowDTO>;
244
+ /** Pause one cron (`POST /v1/crons/:cronId/pause`) — stops firing, keeps config+history. */
245
+ pauseCron(cronId: string, q?: CronScopeQuery): Promise<CronDTO>;
246
+ /** Resume one paused cron (`POST /v1/crons/:cronId/resume`). */
247
+ resumeCron(cronId: string, q?: CronScopeQuery): Promise<CronDTO>;
248
+ /** Run one cron NOW, out of band (`POST /v1/crons/:cronId/run`) — synchronous:
249
+ * resolves with the settled run record after the subprocess closes. Does not
250
+ * advance the schedule or consume a one-shot; never escalates. */
251
+ runCron(cronId: string, q?: CronScopeQuery): Promise<CronRunDTO>;
252
+ /** Cancel one cron (`DELETE /v1/crons/:cronId`, idempotent). */
253
+ cancelCron(cronId: string, q?: CancelCronQuery): Promise<void>;
254
+ /** Bare eligibility poke (`POST /v1/crons/poke`): re-dues every held active
255
+ * cron now — "something changed; re-check now". Canvas-wide, label-free,
256
+ * idempotent, and free when nothing is held. */
257
+ pokeCrons(): Promise<PokeCronsResult>;
258
+ ensureAttach(id: string, req?: AttachEnsureRequest): Promise<AttachEnsureResultDTO>;
259
+ getReports(id: string, q?: ReportsQuery): Promise<ReportDTO[]>;
260
+ getTranscript(id: string, q?: TranscriptQuery): Promise<TranscriptDTO>;
261
+ getSnapshot(id: string): Promise<NodeSnapshotDTO>;
262
+ /** The node-config subject substrate gates evaluate against. */
263
+ nodeSubject(id: string): Promise<NodeSubjectDTO>;
264
+ getNodeMessages(id: string, q?: NodeMessagesQuery): Promise<NodeMessagesPageDTO>;
265
+ /** The node's conversation exactly as it ran — raw `.jsonl` bytes plus the
266
+ * assembled system prompt. For exports; `getSnapshot` is for renderers. */
267
+ getSession(id: string): Promise<NodeSessionDTO>;
268
+ /** What a non-terminal chat surface may offer for this node: the chat-capable
269
+ * slash commands its live engine registered, and the memory documents an
270
+ * inline `/name` token resolves to. Never revives — a node whose broker is
271
+ * not live answers `broker_live: false` with empty arrays. */
272
+ getChatInventory(id: string): Promise<ChatInventoryDTO>;
273
+ getProspectiveChatInventory(q?: ProspectiveChatInventoryQuery): Promise<ProspectiveChatInventoryDTO>;
274
+ getContext(id: string): Promise<ContextListDTO>;
275
+ /** Read an absolute host path (capped, `truncated` when clipped). */
276
+ peekFile(path: string, encoding?: FileEncoding, options?: CrtrRequestOptions): Promise<FilePeekDTO>;
277
+ writeFile(path: string, content: string, encoding?: FileEncoding, options?: CrtrRequestOptions): Promise<FileWriteDTO>;
278
+ listFiles(path: string, limit?: number, options?: CrtrRequestOptions): Promise<FileListDTO>;
279
+ runBash(params: BashRunParams, options?: CrtrRequestOptions): Promise<BashRunDTO>;
280
+ /** `crtr canvas` shared verbs. A ref is a name (with or without `[[ ]]`) or a raw object id. */
281
+ readonly objects: {
282
+ read: (ref: string, query?: ObjectReadQuery) => Promise<ObjectReadDTO>;
283
+ list: (query?: ObjectListRequest) => Promise<ObjectListDTO>;
284
+ search: (request: ObjectSearchRequest) => Promise<ObjectSearchDTO>;
285
+ watch: (ref: string, request?: WatchRequest) => Promise<WatchResultDTO>;
286
+ unwatch: (ref: string, query?: UnwatchQuery) => Promise<UnwatchResultDTO>;
287
+ edges: (ref: string, query?: EdgesQuery) => Promise<EdgesDTO>;
288
+ };
289
+ /** `crtr doc` write verbs. */
290
+ readonly docs: {
291
+ write: (request: DocWriteRequest) => Promise<DocWrittenDTO>;
292
+ edit: (ref: string, request: DocEditRequest) => Promise<DocEditedDTO>;
293
+ move: (ref: string, request: DocMoveRequest) => Promise<DocMovedDTO>;
294
+ delete: (ref: string) => Promise<DocDeletedDTO>;
295
+ history: (ref: string, query?: DocHistoryQuery) => Promise<DocHistoryDTO>;
296
+ lint: (request?: DocLintRequest) => Promise<DocLintDTO>;
297
+ };
298
+ /** Package (builtin and plugin) documents. */
299
+ readonly documents: {
300
+ reconcilePackages: () => Promise<ReconcilePackagesDTO>;
301
+ };
302
+ /** The broker's delivery of one node activity. */
303
+ nodeDelivery(id: string, request: DeliveryRequest): Promise<DeliveryResponse>;
304
+ /** A person's dry run of one delivery activity, for a live or hypothetical node. Writes nothing. */
305
+ deliveryDryRun(request: DeliveryDryRunRequest): Promise<DeliveryResponse>;
306
+ /** Record a backgrounded bash command as a job object. */
307
+ recordBackgroundedJob(id: string, jobId: string, request: BackgroundedJobRequest): Promise<BackgroundedJobDTO>;
308
+ /** Create-or-return by name. Supplied `projects` are shape-checked even when
309
+ * the profile already exists; their directories are only required to exist
310
+ * when this call creates the profile. */
311
+ ensureProfile(name: string, req?: EnsureProfileRequest): Promise<ProfileDTO>;
312
+ /** Create a profile of the caller's app; a name it already holds is refused. */
313
+ createProfile(req: CreateProfileRequest): Promise<ProfileDTO>;
314
+ listProfiles(): Promise<ProfileDTO[]>;
315
+ /** Rename, set the default kind, or add or remove one project. */
316
+ updateProfile(name: string, req: UpdateProfileRequest): Promise<ProfileDTO>;
317
+ listAppEnv(): Promise<{
318
+ names: string[];
319
+ }>;
320
+ setAppEnv(variable: string, value: string): Promise<{
321
+ changed: boolean;
322
+ }>;
323
+ removeAppEnv(variable: string): Promise<{
324
+ changed: boolean;
325
+ }>;
326
+ listProfileEnv(name: string): Promise<ProfileEnvNamesDTO>;
327
+ setProfileEnv(name: string, variable: string, value: string): Promise<ProfileEnvChangeDTO>;
328
+ removeProfileEnv(name: string, variable: string): Promise<ProfileEnvChangeDTO>;
329
+ getProfile(name: string): Promise<ProfileDTO>;
330
+ pauseProfile(name: string): Promise<ProfilePauseResultDTO>;
331
+ resumeProfile(name: string): Promise<ProfilePauseResultDTO>;
332
+ /** Merge and remove entries in a profile's metadata map. */
333
+ updateProfileMetadata(name: string, req: UpdateProfileMetadataRequest): Promise<ProfileDTO>;
334
+ /** Force-delete or detach one profile by exact id or unique name. */
335
+ deleteProfile(name: string, req: DeleteProfileRequest): Promise<DeleteProfileResultDTO>;
336
+ listModelAuth(): Promise<ModelAuthListDTO>;
337
+ getModelAuthReadiness(query?: ModelAuthReadinessQuery): Promise<ModelAuthReadinessDTO>;
338
+ installCredential(provider: string, req: InstallCredentialRequest): Promise<CredentialResultDTO>;
339
+ removeCredential(provider: string): Promise<CredentialRemovalResultDTO>;
340
+ /** `model_auth.start` — the daemon runs the vendor OAuth; the caller only shows `url`. */
341
+ startModelAuth(req: StartModelAuthFlowRequest): Promise<ModelAuthFlowStartedDTO>;
342
+ /** `model_auth.complete` — hand the daemon the code the vendor showed. */
343
+ completeModelAuth(flowId: string, req: CompleteModelAuthFlowRequest): Promise<ModelAuthFlowCompletedDTO>;
344
+ /** `model_auth.cancel` — end an in-flight flow the person gave up on; it writes nothing. */
345
+ cancelModelAuth(flowId: string): Promise<ModelAuthFlowDTO>;
346
+ /** A flow's state; `waitSeconds` (1-25) long-polls until it leaves `pending`. */
347
+ getModelAuthFlow(flowId: string, waitSeconds?: number): Promise<ModelAuthFlowDTO>;
348
+ createReview(req: CreateReviewRequest): Promise<ReviewDTO>;
349
+ listReviews(query?: ListReviewsQuery): Promise<ReviewListDTO>;
350
+ getReview(reviewId: string): Promise<ReviewDTO>;
351
+ submitReview(reviewId: string): Promise<ReviewSubmitResultDTO>;
352
+ cancelReview(reviewId: string, req?: CancelReviewRequest): Promise<ReviewCancelResultDTO>;
353
+ getReviewDocumentBase(reviewId: string): Promise<ReviewDocumentBaseDTO>;
354
+ createReviewComment(reviewId: string | undefined, req: CreateReviewCommentRequest): Promise<ReviewCommentMutationDTO>;
355
+ listReviewComments(reviewId?: string, query?: ListReviewCommentsQuery): Promise<ReviewCommentListDTO>;
356
+ readReviewCommentEvents(reviewId: string, query?: ReadReviewCommentEventsQuery): Promise<ReviewCommentEventsDTO>;
357
+ updateReviewCommentRanges(reviewId: string, req: ReviewCommentRangeBatchRequest): Promise<ReviewCommentRangeBatchResultDTO>;
358
+ getReviewComment(commentId: string): Promise<ReviewCommentDetailDTO>;
359
+ editReviewComment(commentId: string, req: EditReviewCommentRequest): Promise<ReviewCommentMutationDTO>;
360
+ resolveReviewComment(commentId: string, req?: ReviewCommentActionRequest): Promise<ReviewCommentMutationDTO>;
361
+ reopenReviewComment(commentId: string, req?: ReviewCommentActionRequest): Promise<ReviewCommentMutationDTO>;
362
+ deleteReviewComment(commentId: string, req?: ReviewCommentActionRequest): Promise<ReviewCommentMutationDTO>;
363
+ forkReviewComment(commentId: string): Promise<ReviewCommentForkDTO>;
364
+ /** Pending page/review tickets across every available crouter-owned
365
+ * humanloop root. */
366
+ listHumanInbox(): Promise<InboxListDTO>;
367
+ /** Read one page ticket by its opaque ticket id (pending, resolved, or canceled). */
368
+ getHumanInboxPage(ticketId: InboxTicketIdDTO): Promise<InboxPageDTO>;
369
+ /** All page tickets, oldest first (pending, resolved, or canceled) —
370
+ * home-wide, or narrowed to one raising node when `nodeId` is given. */
371
+ getInboxHistory(nodeId?: string): Promise<InboxPageHistoryDTO>;
372
+ /** Submit responses for a page ticket. Single-assignment server-side: a competing
373
+ * resolution races to `ticket_already_resolved`. */
374
+ respondHumanInboxPage(ticketId: InboxTicketIdDTO, request: RespondInboxPageRequest): Promise<PageTicketResultDTO>;
375
+ /** Autosave partial page work. Omitted slots are permitted in progress updates. */
376
+ postInboxProgress(ticketId: InboxTicketIdDTO, responses: PageResponsesDTO): Promise<void>;
377
+ /** Get the published response for a resolved page ticket. 404 if pending or canceled. */
378
+ getInboxResponse(ticketId: InboxTicketIdDTO): Promise<InboxPageResponseDTO>;
379
+ /** Cancel a ticket (terminal response, never deletion). */
380
+ cancelHumanInboxTicket(ticketId: InboxTicketIdDTO, request?: CancelInboxTicketRequest): Promise<CanceledTicketResultDTO>;
381
+ /** Create one durable human request. The minted `request_id` identifies the
382
+ * request; inbox presentation has its own ticket id. An unresolvable
383
+ * `action.name` is rejected before the page is published, leaving no inbox
384
+ * row behind. */
385
+ createHumanRequest(request: CreateHumanRequestRequest): Promise<CreateHumanRequestDTO>;
386
+ /** Product page components registered on the runtime (config + enabled plugins). */
387
+ listPageComponents(): Promise<PageComponentListDTO>;
388
+ /** Read one request: its current state, its answer when answered, and the
389
+ * delivery state of its completion action when it bound one. */
390
+ getHumanRequest(requestId: HumanRequestIdDTO): Promise<HumanRequestDTO>;
391
+ /** Revise a pending request's page in place. Identity, provenance, and the
392
+ * frozen action binding are preserved; a settled request refuses. */
393
+ replaceHumanRequest(requestId: HumanRequestIdDTO, request: ReplaceHumanRequestRequest): Promise<HumanRequestDTO>;
394
+ /** Settle a request `answered` programmatically. Races a human answer to the
395
+ * same first-writer-wins result. */
396
+ respondHumanRequest(requestId: HumanRequestIdDTO, request: RespondHumanRequestRequest): Promise<HumanRequestDTO>;
397
+ /** The recipient surface closing a request without answering. */
398
+ dismissHumanRequest(requestId: HumanRequestIdDTO, request?: SettleHumanRequestRequest): Promise<HumanRequestDTO>;
399
+ /** The requester withdrawing its own request. */
400
+ cancelHumanRequest(requestId: HumanRequestIdDTO, request?: SettleHumanRequestRequest): Promise<HumanRequestDTO>;
401
+ /** Resolve one page feedback comment — the bound companion's report that it
402
+ * has been dealt with. `nodeId` names the caller; the daemon refuses any
403
+ * node but the ticket's companion. Terminal for the comment; appends no
404
+ * chat turn. */
405
+ resolvePageFeedbackComment(ticketId: InboxTicketIdDTO, commentId: string, nodeId: string): Promise<PageFeedbackResolutionDTO>;
406
+ /** Composed client-side from `GET /v1/nodes` + `GET /v1/status` (spec §6.3 —
407
+ * the dashboard is absorbed into those two reads; there is no single route).
408
+ * `generated_at` is the client-side capture instant of the composition. */
409
+ dashboard(q?: DashboardQuery): Promise<DashboardDTO>;
410
+ attention(): Promise<AttentionDTO>;
411
+ /** Per-node pending-ticket counts for a bounded viewer slice. */
412
+ attentionCounts(node_ids: string[]): Promise<AttentionCountsDTO>;
413
+ /** Ranked/filtered content search over the per-cwd episodic corpus
414
+ * (`crtr canvas history search`). Optional query: ranked when present,
415
+ * recency browse when omitted. POST-bodied — the query carries arrays and
416
+ * free text; the whole search executes server-side (spec §6.3). */
417
+ historySearch(q: HistorySearchQuery): Promise<HistorySearchResultDTO>;
418
+ /** Required-pattern line-hit search over the per-cwd episodic corpus
419
+ * (`crtr canvas history grep`). Distinct stable schema from `historySearch`
420
+ * — POST-bodied for the same reasons. */
421
+ historyGrep(q: HistoryGrepQuery): Promise<HistoryGrepResultDTO>;
422
+ /** Resolve one `<node-id>:<relpath>` history ref to its full body
423
+ * (`crtr canvas history read`). */
424
+ historyRead(q: HistoryReadQuery): Promise<HistoryReadResultDTO>;
425
+ /** Grouped-count projection over the per-cwd episodic corpus
426
+ * (`crtr canvas history stats`). Same filters as search/grep, aggregate
427
+ * result instead of a hit page — POST-bodied for the same reasons. */
428
+ historyStats(q: HistoryStatsQuery): Promise<HistoryStatsResultDTO>;
429
+ /** The machine-readable browser canvas roster (`crtr canvas snapshot`) —
430
+ * distinct from the per-node `getSnapshot`. */
431
+ canvasSnapshot(): Promise<SnapshotDTO>;
432
+ /** The Analytics page model (`GET /v1/canvas/analytics`). The
433
+ * daemon scans transcripts for the window: a cold 7d scan of ~2 GB of
434
+ * transcripts measured 10 s, and with scan workers capped at 4 a queued
435
+ * request waits about one scan more. 60 s is 3x that worst case; past it the
436
+ * page shows the error instead of computing forever. */
437
+ analytics(q: AnalyticsQuery): Promise<AnalyticsDTO>;
438
+ /** Record memory reads/loads for one node (`POST /v1/nodes/:id/memory-reads`). */
439
+ recordMemoryReads(nodeId: string, body: MemoryReadsRequestDTO): Promise<void>;
440
+ /** The lean, set-based topology roster (`GET /v1/canvas/roster`) — exactly
441
+ * two indexed queries server-side, no per-row enrichment. The recurring
442
+ * poll target for attach/browser topology; use `canvasSnapshot` for the
443
+ * enriched on-demand view. */
444
+ canvasRoster(): Promise<RosterDTO>;
445
+ /** Explicitly compressed browse snapshot; the Node-only canvas source
446
+ * decompresses it because socketFetch does not interpret content-encoding. */
447
+ canvasBrowseCompressed(): Promise<Uint8Array>;
448
+ /** The lean attach-graph projection: display rows, topology, and focus state
449
+ * in one daemon-owned read rather than the full node-summary list. */
450
+ canvasGraph(): Promise<GraphDTO>;
451
+ prune(req: PruneRequest): Promise<PruneResultDTO>;
452
+ /** Raw request for routes not yet method-wrapped. Applies the same
453
+ * autostart + retry + error-mapping semantics. */
454
+ request<T>(method: string, path: string, body?: unknown, opts?: CrtrRequestOptions): Promise<T>;
455
+ /** Open a live response with the normal cold-socket and retry policy, without consuming its body. */
456
+ rawResponse(method: string, path: string, opts?: CrtrRequestOptions): Promise<Response>;
457
+ /** The unparsed request: cold-socket and interrupted-response recovery, plus
458
+ * the §7 retry policy (connection errors and 429/5xx on GET/HEAD/DELETE
459
+ * only — POST/PATCH are never replayed once a request has actually been
460
+ * sent). No JSON parse; every wrapper goes through here. */
461
+ private send;
462
+ private resolveBudget;
463
+ private awaitWithinBudget;
464
+ /** One transport attempt, deliberately without retry, cold-socket, or interrupted-response recovery. */
465
+ private sendOnce;
466
+ private nodePath;
467
+ /** Validate a background job id before route construction. Job ids arrive
468
+ * from the daemon's file-backed roster and must remain one path segment. */
469
+ private jobPath;
470
+ /** Validate a cron id before route construction — `routes.ts` interpolates
471
+ * it raw, so a value carrying `/`, whitespace or `?` would corrupt the
472
+ * request line rather than 404 cleanly. Mirrors `nodePath`. */
473
+ private cronPath;
474
+ /** Validate a request id before route construction. Requests use the daemon's
475
+ * node-id-shaped identifiers, while inbox presentation uses a separate ticket
476
+ * id. A malformed request id is a server-rejectable request. */
477
+ private requestPath;
478
+ /** Validate an opaque inbox ticket id before route construction. A local
479
+ * shape violation is a caller bug, not a server-rejectable request — throws
480
+ * `TypeError` (matching the existing safe-segment discipline of a local
481
+ * precondition, distinct from `nodePath`'s `ApiError` because that one IS a
482
+ * request the server could plausibly receive and reject itself). */
483
+ private ticketId;
484
+ /** Validate a review id before route construction (D-A6). Reviews are minted
485
+ * and addressed like node ids, but arrive from agent argv, so a malformed
486
+ * one is a plausible request the server would also reject — `ApiError`,
487
+ * not `TypeError`, matching `nodePath`. */
488
+ private reviewPath;
489
+ /** Validate a comment id before route construction (D-A6). Comment ids are
490
+ * daemon-minted 32-char lowercase hex, but — like `reviewPath` — arrive from
491
+ * agent argv, so a bad one is a plausible request the server would also
492
+ * reject, not a caller-bug `TypeError` like `ticketId`. */
493
+ private commentPath;
494
+ /** The one fetch path (§1). Resolves as soon as headers arrive — the body
495
+ * stays an unread `ReadableStream` on the returned `Response`, so a caller
496
+ * that wants to stream (SSE, later) never waits on a buffered body. */
497
+ private transport;
498
+ private retainRequestLifetime;
499
+ private isColdSocketError;
500
+ /** A connection torn down MID-request (Node's "socket hang up" / a broken
501
+ * pipe). It establishes only that the response was interrupted, not why. */
502
+ private isInterruptedSocketError;
503
+ /** Wait for the local API after an interrupted response. GET/HEAD can retry
504
+ * because they are idempotent. A mutation may already have been applied, so
505
+ * it never replays. */
506
+ private rideOutInterruptedRequest;
507
+ private awaitAvailability;
508
+ /** Optionally start the daemon, then observe availability before retrying the
509
+ * request. Waiting is independent from permission to spawn: externally
510
+ * managed daemons still get the same bounded readiness window. */
511
+ private handleColdSocket;
512
+ }
513
+ /** One retry wait inside a call's deadline. A server-requested wait (`retryAfterS`) is honored only against a deadline:
514
+ * when it would not finish before the deadline the call fails now with `deadline_exceeded` (`reason: 'retry_after'`)
515
+ * instead of sleeping past it; a call without a deadline keeps the plain backoff. The sleep ends early, with the same
516
+ * error, if the caller aborts. */
517
+ export declare function sleepWithin(backoffMs: number, opts: {
518
+ deadlineAt?: number;
519
+ signal?: AbortSignal;
520
+ }, retryAfterS?: number, cause?: unknown): Promise<void>;
521
+ export declare function safeColdStartDiagnostic(hook: (() => string | undefined) | undefined): string | undefined;