@north-light/api 0.3.561 → 0.3.562

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 (87) hide show
  1. package/dist/api/client.d.ts +27 -4
  2. package/dist/api/client.js +53 -0
  3. package/dist/api/contract.d.ts +1 -1
  4. package/dist/api/contract.js +1 -1
  5. package/dist/api/dto/bash-jobs.d.ts +5 -1
  6. package/dist/api/dto/broker-ops.d.ts +25 -1
  7. package/dist/api/dto/charges.d.ts +9 -2
  8. package/dist/api/dto/delivery.d.ts +26 -2
  9. package/dist/api/dto/execution-start.d.ts +57 -0
  10. package/dist/api/dto/execution-start.js +2 -0
  11. package/dist/api/dto/modelauth.d.ts +5 -0
  12. package/dist/api/dto/node-records.d.ts +16 -0
  13. package/dist/api/dto/objects.d.ts +1 -1
  14. package/dist/api/dto/reports.d.ts +0 -3
  15. package/dist/api/dto/run-events.d.ts +7 -1
  16. package/dist/api/dto/settings.d.ts +55 -0
  17. package/dist/api/dto/settings.js +4 -0
  18. package/dist/api/index.d.ts +2 -0
  19. package/dist/api/index.js +2 -0
  20. package/dist/api/routes.d.ts +11 -0
  21. package/dist/api/routes.js +12 -0
  22. package/dist/core/canvas/paths.d.ts +0 -1
  23. package/dist/core/canvas/paths.js +0 -3
  24. package/dist/core/canvas/person-state.d.ts +26 -0
  25. package/dist/core/canvas/person-state.js +41 -0
  26. package/dist/core/command-plugins/bundle.d.ts +1 -1
  27. package/dist/core/command-plugins/bundle.js +5 -5
  28. package/dist/core/config.d.ts +16 -15
  29. package/dist/core/config.js +99 -76
  30. package/dist/core/conversation-store/client.d.ts +2 -0
  31. package/dist/core/conversation-store/client.js +111 -0
  32. package/dist/core/conversation-store/index.d.ts +96 -0
  33. package/dist/core/conversation-store/index.js +62 -0
  34. package/dist/core/conversation-store/patch.d.ts +3 -0
  35. package/dist/core/conversation-store/patch.js +192 -0
  36. package/dist/core/conversation-store/repair.d.ts +45 -0
  37. package/dist/core/conversation-store/repair.js +84 -0
  38. package/dist/core/env-name.d.ts +1 -0
  39. package/dist/core/env-name.js +16 -0
  40. package/dist/core/events/emit.js +7 -5
  41. package/dist/core/git.d.ts +28 -0
  42. package/dist/core/git.js +103 -0
  43. package/dist/core/installed-plugins.js +12 -7
  44. package/dist/core/managed-providers.d.ts +72 -0
  45. package/dist/core/managed-providers.js +61 -0
  46. package/dist/core/plugin-env.js +1 -2
  47. package/dist/core/profiles/manifest.d.ts +14 -18
  48. package/dist/core/profiles/manifest.js +79 -98
  49. package/dist/core/runtime/broker/attachments-fetch.d.ts +5 -0
  50. package/dist/core/runtime/broker/attachments-fetch.js +20 -0
  51. package/dist/core/runtime/broker/daemon-ops.d.ts +10 -1
  52. package/dist/core/runtime/broker/daemon-ops.js +41 -3
  53. package/dist/core/runtime/broker/node-token.d.ts +3 -0
  54. package/dist/core/runtime/broker/node-token.js +16 -0
  55. package/dist/core/runtime/broker/signal-stream.js +2 -2
  56. package/dist/core/scoped-state/materialized-plugins.d.ts +18 -0
  57. package/dist/core/scoped-state/materialized-plugins.js +103 -0
  58. package/dist/core/scoped-state/person-store.d.ts +72 -0
  59. package/dist/core/scoped-state/person-store.js +112 -0
  60. package/dist/core/user-settings.js +1 -1
  61. package/dist/daemon/broker-signals/bus.d.ts +48 -11
  62. package/dist/daemon/broker-signals/bus.js +116 -46
  63. package/dist/shared/inbox-entry-body.js +2 -2
  64. package/dist/types.d.ts +12 -0
  65. package/package.json +1 -1
  66. package/dist/core/canvas/legacy-person.d.ts +0 -4
  67. package/dist/core/canvas/legacy-person.js +0 -4
  68. package/dist/core/locked-file.d.ts +0 -27
  69. package/dist/core/locked-file.js +0 -121
  70. package/dist/core/profiles/env-store.d.ts +0 -22
  71. package/dist/core/profiles/env-store.js +0 -166
  72. package/dist/core/scoped-state/db.d.ts +0 -17
  73. package/dist/core/scoped-state/db.js +0 -261
  74. package/dist/core/scoped-state/migrate.d.ts +0 -8
  75. package/dist/core/scoped-state/migrate.js +0 -187
  76. package/dist/core/scoped-state/profiles.d.ts +0 -27
  77. package/dist/core/scoped-state/profiles.js +0 -94
  78. package/dist/core/scoped-state/providers.d.ts +0 -24
  79. package/dist/core/scoped-state/providers.js +0 -19
  80. package/dist/core/scoped-state/schema.d.ts +0 -10
  81. package/dist/core/scoped-state/schema.js +0 -47
  82. package/dist/core/scoped-state/settings.d.ts +0 -28
  83. package/dist/core/scoped-state/settings.js +0 -104
  84. package/dist/core/sqlite-statements.d.ts +0 -4
  85. package/dist/core/sqlite-statements.js +0 -17
  86. package/dist/core/subscription-state.d.ts +0 -129
  87. package/dist/core/subscription-state.js +0 -299
@@ -1,4 +1,5 @@
1
1
  import { ApiError } from './errors.js';
2
+ import type { GitCredentialDTO, GitCredentialRequest, StartBundleDTO } from './dto/execution-start.js';
2
3
  import type { ChargeListDTO, SpendLimitListDTO, SpendLimitRemovedDTO, SpendLimitSetRequest, LimitDTO } from './dto/charges.js';
3
4
  import type { AppLimitsChangeDTO, LimitsDTO, SetAppLimitsRequest } from './dto/limits.js';
4
5
  import type { DaemonAdmitDTO, DaemonRestartDTO, DueDTO, HealthDTO, ReadyDTO, MigrateStateDTO, MigrateStateRequest, StatusDTO } from './dto/health.js';
@@ -8,7 +9,7 @@ import type { NodeOutcomeResponseDTO, OutcomeDeliveryDTO, RegisterOutcomeDeliver
8
9
  import type { AnalyticsDTO, AnalyticsQuery, MemoryReadsRequestDTO } from './dto/analytics.js';
9
10
  import type { NodeEventsQuery } from './dto/node-events.js';
10
11
  import type { BrokerSignalLineDTO } from './dto/broker-signals.js';
11
- import type { NodeLogAppendRequest, NodeLogAppendResultDTO, NodeTelemetryRecordRequest, NodeRecapRecordRequest, NodeMessageBodyDTO, NodePushedFinalRequest, NodePushedFinalResultDTO } from './dto/node-records.js';
12
+ import type { NodeLogAppendRequest, NodeLogAppendResultDTO, NodeTelemetryRecordRequest, NodeSummariesRecordRequest, NodeRecapRecordRequest, NodeMessageBodyDTO, NodeAttachmentsDTO, NodePushedFinalRequest, NodePushedFinalResultDTO } from './dto/node-records.js';
12
13
  import type { InterruptResultDTO, MessageResultDTO, SendMessageRequest } from './dto/messages.js';
13
14
  import type { CreateStructuredRequest, CreateStructuredRequestResponse, StructuredRequestDTO } from './dto/structured-requests.js';
14
15
  import type { PushReportRequest, PushReportResultDTO, ReportDTO, ReportsQuery, SubmitResultDTO, SubmitResultRequest } from './dto/reports.js';
@@ -24,16 +25,17 @@ import type { BashRunDTO, BashRunParams } from './dto/bash.js';
24
25
  import type { EdgesDTO, EdgesQuery, ObjectListDTO, ObjectListRequest, ObjectReadDTO, ObjectReadQuery, ObjectSearchDTO, ObjectSearchRequest, UnwatchQuery, UnwatchResultDTO, WatchRequest, WatchResultDTO } from './dto/objects.js';
25
26
  import type { DocDeletedDTO, DocEditRequest, DocEditedDTO, DocHistoryDTO, DocHistoryQuery, DocLintDTO, DocLintRequest, DocMoveRequest, DocMovedDTO, DocWriteRequest, DocWrittenDTO, ReconcilePackagesDTO, DocumentAccessDTO } from './dto/docs.js';
26
27
  import type { PluginAppTokenDTO, PluginCallHeadersDTO, PluginCallHeadersRequestDTO } from './dto/plugins.js';
27
- import type { BackgroundedJobDTO, BackgroundedJobRequest, DeliveryDryRunRequest, DeliveryRequest, DeliveryResponse } from './dto/delivery.js';
28
+ import type { BackgroundedJobDTO, BackgroundedJobRequest, JobPatchRequest, JobReportRequest, DeliveryDryRunRequest, DeliveryRequest, DeliveryResponse } from './dto/delivery.js';
28
29
  import type { ChatInventoryDTO, ProspectiveChatInventoryDTO, ProspectiveChatInventoryQuery } from './dto/chat-inventory.js';
29
- import type { CredentialRemovalResultDTO, CredentialResultDTO, InstallCredentialRequest, CompleteModelAuthFlowRequest, ModelAuthFlowCompletedDTO, ModelAuthFlowDTO, ModelAuthFlowStartedDTO, ModelAuthListDTO, ModelAuthReadinessDTO, ModelAuthReadinessQuery, StartModelAuthFlowRequest } from './dto/modelauth.js';
30
+ import type { PersonSettingsDTO, PutPersonSettingsRequest } from './dto/settings.js';
31
+ import type { CredentialRemovalResultDTO, CredentialResultDTO, InstallCredentialRequest, CompleteModelAuthFlowRequest, ModelAuthFlowCompletedDTO, ModelAuthFlowDTO, ModelAuthFlowStartedDTO, ModelAuthListDTO, ModelAuthProviderStatusDTO, PatchManagedAccountRequest, ModelAuthReadinessDTO, ModelAuthReadinessQuery, StartModelAuthFlowRequest } from './dto/modelauth.js';
30
32
  import type { CancelReviewRequest, CreateReviewRequest, ListReviewsQuery, ReviewCancelResultDTO, ReviewDocumentBaseDTO, ReviewDTO, ReviewListDTO, ReviewSubmitResultDTO } from './dto/reviews.js';
31
33
  import type { CreateReviewCommentRequest, EditReviewCommentRequest, ListReviewCommentsQuery, ReadReviewCommentEventsQuery, ReviewCommentActionRequest, ReviewCommentDetailDTO, ReviewCommentEventsDTO, ReviewCommentForkDTO, ReviewCommentListDTO, ReviewCommentMutationDTO, ReviewCommentRangeBatchRequest, ReviewCommentRangeBatchResultDTO } from './dto/review-comments.js';
32
34
  import type { CancelInboxTicketRequest, CanceledTicketResultDTO, InboxListDTO, InboxPageDTO, InboxPageHistoryDTO, PageTicketSummaryDTO, InboxPageResponseDTO, InboxTicketIdDTO, PageFeedbackResolutionDTO, PageResponsesDTO, PageTicketResultDTO, RespondInboxPageRequest } from './dto/inbox.js';
33
35
  import type { CreateHumanRequestDTO, CreateHumanRequestRequest, HumanRequestDTO, HumanRequestIdDTO, ReplaceHumanRequestRequest, RespondHumanRequestRequest, SettleHumanRequestRequest, PageComponentListDTO } from './dto/human-requests.js';
34
36
  import type { AttentionCountsDTO, AttentionDTO, DashboardDTO, DashboardQuery, HistoryGrepQuery, HistoryGrepResultDTO, HistoryReadQuery, HistoryStatsQuery, HistoryStatsResultDTO, HistoryReadResultDTO, HistorySearchQuery, HistorySearchResultDTO, GraphDTO, PruneRequest, PruneResultDTO, LiveRootsDTO, RosterDTO, SnapshotDTO } from './dto/canvas.js';
35
37
  import type { AbandonWorktreeRequest, AbandonWorktreeResultDTO, CloseWorktreeResultDTO, QuarantinedWorktreeDTO, SpaceListDTO } from './dto/worktree.js';
36
- import type { BrokerExtensionStateDTO, BrokerExecutionRequest, BrokerGeneratedNameRequest, BrokerGeneratedNameResultDTO, BrokerModelCommitRequest, BrokerModelCommitResultDTO, BrokerParkActivityResultDTO, BrokerParkCompleteRequest, BrokerPersonaAckRequest, BrokerPersonaAckResultDTO, BrokerSessionBoundRequest, BrokerSessionBoundResultDTO, BrokerSettleDirective, BrokerSettleRequest, BrokerTelemetryRequest } from './dto/broker-ops.js';
38
+ import type { BrokerExtensionStateDTO, BrokerExecutionRequest, BrokerGeneratedNameRequest, BrokerGoalRequest, BrokerGoalResultDTO, BrokerStructuredRequestDTO, BrokerGeneratedNameResultDTO, BrokerModelCommitRequest, BrokerModelCommitResultDTO, BrokerParkActivityResultDTO, BrokerParkCompleteRequest, BrokerPersonaAckRequest, BrokerPersonaAckResultDTO, BrokerSessionBoundRequest, BrokerSessionBoundResultDTO, BrokerSettleDirective, BrokerSettleRequest, BrokerTelemetryRequest } from './dto/broker-ops.js';
37
39
  import type { AcknowledgeMailRequest, AcknowledgeMailResultDTO, ClaimMailRequest, ClaimMailResultDTO } from './dto/mail.js';
38
40
  import type { BrokerFaultInputDTO, BrokerFaultRequest, BrokerFaultResultDTO, BrokerProviderRetryRequest, BrokerProviderRetryResultDTO, BrokerTurnRequest, BrokerTurnResultDTO, NodeFaultClearResultDTO, RecoveryStateDTO } from './dto/recovery.js';
39
41
  export interface CrtrClientOptions {
@@ -141,8 +143,12 @@ export declare class CrtrClient {
141
143
  migrateState(req: MigrateStateRequest): Promise<MigrateStateDTO>;
142
144
  appendNodeLog(id: string, req: NodeLogAppendRequest): Promise<NodeLogAppendResultDTO>;
143
145
  putNodeTelemetry(id: string, req: NodeTelemetryRecordRequest): Promise<void>;
146
+ putNodeSummaries(id: string, req: NodeSummariesRecordRequest): Promise<void>;
144
147
  putNodeRecap(id: string, req: NodeRecapRecordRequest): Promise<void>;
145
148
  readNodeInboxReport(id: string, ref: string, executionId: string): Promise<NodeMessageBodyDTO>;
149
+ listNodeAttachments(id: string): Promise<NodeAttachmentsDTO>;
150
+ /** The bytes of one of the run's attachments (`GET /v1/nodes/:id/attachments/:sha256`). */
151
+ readNodeAttachment(id: string, sha256: string): Promise<Uint8Array>;
146
152
  readNodePassiveMessage(id: string, ref: string): Promise<NodeMessageBodyDTO>;
147
153
  nodePushedFinal(id: string, req: NodePushedFinalRequest): Promise<NodePushedFinalResultDTO>;
148
154
  createNode(req: CreateNodeRequest): Promise<NodeDetailDTO>;
@@ -175,6 +181,10 @@ export declare class CrtrClient {
175
181
  disarmOutcomeDelivery(id: string): Promise<void>;
176
182
  listBashJobs(id: string): Promise<BashJobStatusDTO[]>;
177
183
  stopBashJob(id: string, jobId: string): Promise<BashJobStopResultDTO>;
184
+ /** Claim, quiet or re-arm one running job (see `JobPatchRequest`). */
185
+ patchBashJob(id: string, jobId: string, request: JobPatchRequest): Promise<void>;
186
+ /** The broker's report on a job it runs. */
187
+ reportBashJob(id: string, jobId: string, request: JobReportRequest): Promise<void>;
178
188
  sendMessage(id: string, req: SendMessageRequest): Promise<MessageResultDTO>;
179
189
  /** First-class interrupt (the human Esc): cancels pending undelivered
180
190
  * human-send inbox entries, then aborts a live in-flight turn. NEVER
@@ -187,6 +197,7 @@ export declare class CrtrClient {
187
197
  relaunchRoot(id: string): Promise<RelaunchRootResultDTO>;
188
198
  bindBrokerSession(id: string, req: BrokerSessionBoundRequest): Promise<BrokerSessionBoundResultDTO>;
189
199
  settleBroker(id: string, req: BrokerSettleRequest): Promise<BrokerSettleDirective>;
200
+ postBrokerIdle(id: string, req: BrokerExecutionRequest): Promise<void>;
190
201
  completeBrokerPark(id: string, req: BrokerParkCompleteRequest): Promise<BrokerSettleDirective>;
191
202
  recordBrokerParkActivity(id: string, req: BrokerExecutionRequest): Promise<BrokerParkActivityResultDTO>;
192
203
  recordBrokerTelemetry(id: string, req: BrokerTelemetryRequest): Promise<void>;
@@ -202,7 +213,13 @@ export declare class CrtrClient {
202
213
  preserve_episode?: boolean;
203
214
  }): Promise<NodeFaultClearResultDTO>;
204
215
  commitBrokerModel(id: string, req: BrokerModelCommitRequest): Promise<BrokerModelCommitResultDTO>;
216
+ /** The sandbox's start bundle for an execution of the calling node. */
217
+ executionStart(executionId: string): Promise<StartBundleDTO>;
218
+ /** A GitHub token limited to the environment's recipe repositories, for the calling node's environment. */
219
+ gitCredential(environmentId: string, req: GitCredentialRequest): Promise<GitCredentialDTO>;
205
220
  brokerExtensionState(id: string): Promise<BrokerExtensionStateDTO>;
221
+ brokerStructuredRequest(id: string): Promise<BrokerStructuredRequestDTO>;
222
+ captureBrokerGoal(id: string, req: BrokerGoalRequest): Promise<BrokerGoalResultDTO>;
206
223
  commitBrokerGeneratedName(id: string, req: BrokerGeneratedNameRequest): Promise<BrokerGeneratedNameResultDTO>;
207
224
  commitBrokerPersonaAck(id: string, req: BrokerPersonaAckRequest): Promise<BrokerPersonaAckResultDTO>;
208
225
  closeNode(id: string, req?: CloseRequest): Promise<CloseResultDTO>;
@@ -357,10 +374,16 @@ export declare class CrtrClient {
357
374
  updateProfileMetadata(name: string, req: UpdateProfileMetadataRequest): Promise<ProfileDTO>;
358
375
  /** Force-delete or detach one profile by exact id or unique name. */
359
376
  deleteProfile(name: string, req: DeleteProfileRequest): Promise<DeleteProfileResultDTO>;
377
+ getSettings(): Promise<PersonSettingsDTO>;
378
+ putSettings(req: PutPersonSettingsRequest): Promise<PersonSettingsDTO>;
360
379
  listModelAuth(): Promise<ModelAuthListDTO>;
361
380
  getModelAuthReadiness(query?: ModelAuthReadinessQuery): Promise<ModelAuthReadinessDTO>;
362
381
  installCredential(provider: string, req: InstallCredentialRequest): Promise<CredentialResultDTO>;
363
382
  removeCredential(provider: string): Promise<CredentialRemovalResultDTO>;
383
+ /** Rename a managed account and/or make it the preferred (first) one; answers the provider's sanitized status. */
384
+ patchModelAuthAccount(provider: string, label: string, req: PatchManagedAccountRequest): Promise<ModelAuthProviderStatusDTO>;
385
+ /** Remove one managed account; the provider's other accounts stay. */
386
+ removeModelAuthAccount(provider: string, label: string): Promise<ModelAuthProviderStatusDTO>;
364
387
  /** `model_auth.start` — the daemon runs the vendor OAuth; the caller only shows `url`. */
365
388
  startModelAuth(req: StartModelAuthFlowRequest): Promise<ModelAuthFlowStartedDTO>;
366
389
  /** `model_auth.complete` — hand the daemon the code the vendor showed. */
@@ -150,12 +150,25 @@ export class CrtrClient {
150
150
  async putNodeTelemetry(id, req) {
151
151
  await this.request('PUT', routes.nodeTelemetry(this.nodePath(id)), req);
152
152
  }
153
+ async putNodeSummaries(id, req) {
154
+ await this.request('PUT', routes.nodeSummaries(this.nodePath(id)), req);
155
+ }
153
156
  async putNodeRecap(id, req) {
154
157
  await this.request('PUT', routes.nodeRecap(this.nodePath(id)), req);
155
158
  }
156
159
  readNodeInboxReport(id, ref, executionId) {
157
160
  return this.request('GET', withQuery(routes.nodeInboxReport(this.nodePath(id)), { ref, execution_id: executionId }));
158
161
  }
162
+ listNodeAttachments(id) {
163
+ return this.request('GET', routes.nodeAttachments(this.nodePath(id)));
164
+ }
165
+ /** The bytes of one of the run's attachments (`GET /v1/nodes/:id/attachments/:sha256`). */
166
+ async readNodeAttachment(id, sha256) {
167
+ const response = await this.send('GET', routes.nodeAttachment(this.nodePath(id), sha256));
168
+ if (!response.ok)
169
+ await parse(response);
170
+ return new Uint8Array(await response.arrayBuffer());
171
+ }
159
172
  readNodePassiveMessage(id, ref) {
160
173
  return this.request('GET', withQuery(routes.nodePassiveMessage(this.nodePath(id)), { ref }));
161
174
  }
@@ -266,6 +279,14 @@ export class CrtrClient {
266
279
  stopBashJob(id, jobId) {
267
280
  return this.request('DELETE', routes.nodeJob(this.nodePath(id), this.jobPath(jobId)));
268
281
  }
282
+ /** Claim, quiet or re-arm one running job (see `JobPatchRequest`). */
283
+ async patchBashJob(id, jobId, request) {
284
+ await this.request('PATCH', routes.nodeJob(this.nodePath(id), this.jobPath(jobId)), request);
285
+ }
286
+ /** The broker's report on a job it runs. */
287
+ async reportBashJob(id, jobId, request) {
288
+ await this.request('POST', routes.nodeJobReport(this.nodePath(id), this.jobPath(jobId)), request);
289
+ }
269
290
  sendMessage(id, req) {
270
291
  return this.request('POST', routes.nodeMessages(this.nodePath(id)), req);
271
292
  }
@@ -296,6 +317,9 @@ export class CrtrClient {
296
317
  settleBroker(id, req) {
297
318
  return this.request('POST', routes.nodeBrokerSettle(this.nodePath(id)), req);
298
319
  }
320
+ async postBrokerIdle(id, req) {
321
+ await this.request('POST', routes.nodeBrokerIdle(this.nodePath(id)), req);
322
+ }
299
323
  completeBrokerPark(id, req) {
300
324
  return this.request('POST', routes.nodeBrokerParkComplete(this.nodePath(id)), req);
301
325
  }
@@ -338,9 +362,23 @@ export class CrtrClient {
338
362
  commitBrokerModel(id, req) {
339
363
  return this.request('POST', routes.nodeBrokerModel(this.nodePath(id)), req);
340
364
  }
365
+ /** The sandbox's start bundle for an execution of the calling node. */
366
+ executionStart(executionId) {
367
+ return this.request('GET', routes.executionStart(executionId));
368
+ }
369
+ /** A GitHub token limited to the environment's recipe repositories, for the calling node's environment. */
370
+ gitCredential(environmentId, req) {
371
+ return this.request('POST', routes.environmentGitCredential(environmentId), req);
372
+ }
341
373
  brokerExtensionState(id) {
342
374
  return this.request('GET', routes.nodeBrokerExtensionState(this.nodePath(id)));
343
375
  }
376
+ brokerStructuredRequest(id) {
377
+ return this.request('GET', routes.nodeBrokerStructuredRequest(this.nodePath(id)));
378
+ }
379
+ captureBrokerGoal(id, req) {
380
+ return this.request('POST', routes.nodeBrokerGoal(this.nodePath(id)), req);
381
+ }
344
382
  commitBrokerGeneratedName(id, req) {
345
383
  return this.request('POST', routes.nodeBrokerGeneratedName(this.nodePath(id)), req);
346
384
  }
@@ -632,6 +670,13 @@ export class CrtrClient {
632
670
  deleteProfile(name, req) {
633
671
  return this.request('DELETE', routes.profile(name), req);
634
672
  }
673
+ // Person settings
674
+ getSettings() {
675
+ return this.request('GET', routes.settings());
676
+ }
677
+ putSettings(req) {
678
+ return this.request('PUT', routes.settings(), req);
679
+ }
635
680
  // Model auth
636
681
  listModelAuth() {
637
682
  return this.request('GET', routes.modelAuths());
@@ -645,6 +690,14 @@ export class CrtrClient {
645
690
  removeCredential(provider) {
646
691
  return this.request('DELETE', routes.modelAuth(provider));
647
692
  }
693
+ /** Rename a managed account and/or make it the preferred (first) one; answers the provider's sanitized status. */
694
+ patchModelAuthAccount(provider, label, req) {
695
+ return this.request('PATCH', routes.modelAuthAccount(provider, label), req);
696
+ }
697
+ /** Remove one managed account; the provider's other accounts stay. */
698
+ removeModelAuthAccount(provider, label) {
699
+ return this.request('DELETE', routes.modelAuthAccount(provider, label));
700
+ }
648
701
  /** `model_auth.start` — the daemon runs the vendor OAuth; the caller only shows `url`. */
649
702
  startModelAuth(req) {
650
703
  return this.request('POST', routes.modelAuthFlows(), req, { timeout: 30_000 + this.timeoutMs });
@@ -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.34";
2
+ export declare const CONTRACT_LEVEL = "1.35";
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`. */
@@ -12,7 +12,7 @@
12
12
  //
13
13
  // PURITY (spec §3.1): Node built-ins + `src/api/*` only.
14
14
  /** The contract level this build serves and requires. Written by `scripts/contract.mjs release`; never edit by hand. */
15
- export const CONTRACT_LEVEL = '1.34';
15
+ export const CONTRACT_LEVEL = '1.35';
16
16
  /** Request header naming the one contract level the caller needs, e.g. `1.3`. Optional: absent means no check. */
17
17
  export const REQUIRED_CONTRACT_HEADER = 'Crouter-Required-Contract';
18
18
  /** Response header listing the contract levels the server serves, comma-separated, one per major, e.g. `1.3`. */
@@ -7,7 +7,11 @@ export interface BashJobStatusDTO {
7
7
  purpose: string | null;
8
8
  started_at: IsoTime;
9
9
  elapsed_ms: number;
10
- /** Persisted supervisor process group, or null for legacy jobs. */
10
+ /** Blob prefix of the job's output chunks. */
11
+ output_key: string;
12
+ /** ISO time the job is canceled unless claimed, or null for a job that runs to completion. */
13
+ deadline_at: IsoTime | null;
14
+ /** Reported supervisor process group, or null before the first report. */
11
15
  pgid: number | null;
12
16
  /** Whether the persisted process group currently exists. */
13
17
  pgid_alive: boolean;
@@ -26,7 +26,6 @@ export interface BrokerExecutionRequest {
26
26
  }
27
27
  export interface BrokerSettleRequest extends BrokerExecutionRequest {
28
28
  stopReason: string;
29
- backgroundJobsRunning: boolean;
30
29
  pushedFinal: boolean;
31
30
  }
32
31
  /** `POST /v1/nodes/{id}/broker/telemetry` body. Tokens are cumulative within
@@ -47,6 +46,11 @@ export type BrokerSettleDirective = {
47
46
  prompt: string;
48
47
  } | {
49
48
  action: 'stay_dormant';
49
+ }
50
+ /** Blaxel only: the broker stays running with nothing holding it. It posts `broker/idle` and closes its signal stream so
51
+ * the sandbox freezes with it; a wake thaws it. */
52
+ | {
53
+ action: 'stay_resident';
50
54
  } | {
51
55
  action: 'shutdown';
52
56
  };
@@ -122,6 +126,8 @@ export type BrokerExtensionSubjectDTO = NodeSubjectDTO;
122
126
  export interface BrokerExtensionStateDTO {
123
127
  node: BrokerExtensionNodeDTO;
124
128
  warm_spare: boolean;
129
+ /** Latest already-rendered situational card, or null. */
130
+ situational_card: string | null;
125
131
  ancestors: BrokerExtensionNodeDTO[];
126
132
  children: BrokerExtensionNodeDTO[];
127
133
  fork_source: BrokerExtensionNodeDTO | null;
@@ -150,6 +156,24 @@ export type BrokerGeneratedNameRequest = BrokerExecutionRequest & ({
150
156
  kind: string;
151
157
  };
152
158
  });
159
+ /** `POST /v1/nodes/{id}/broker/goal` body: a bare root's first message. The server stores it as the
160
+ * node's initial prompt only when that is still empty. */
161
+ export interface BrokerGoalRequest extends BrokerExecutionRequest {
162
+ text: string;
163
+ }
164
+ /** `GET /v1/nodes/{id}/broker/structured-request`: the node's pending structured-output request, or null. */
165
+ export interface BrokerStructuredRequestDTO {
166
+ request: {
167
+ request_id: string;
168
+ mode: 'terminal' | 'oneoff';
169
+ schema: Record<string, unknown>;
170
+ requestMessageId?: string;
171
+ } | null;
172
+ }
173
+ export interface BrokerGoalResultDTO {
174
+ /** True when this call stored the goal; false when the node already had one or the text was blank. */
175
+ captured: boolean;
176
+ }
153
177
  /** A daemon-selected Pi editor-label directive. No handler calls a broker.
154
178
  * `description`/`title`/`icon` are the values as STORED (an empty title or icon
155
179
  * is left unset), so the broker announces what the node now carries rather than
@@ -1,6 +1,6 @@
1
1
  export type ChargeKindDTO = 'model' | 'tool' | 'sandbox' | 'job' | 'storage' | 'take';
2
2
  export type FundingDTO = 'bill' | 'subscription' | 'key' | 'endpoint' | 'take' | 'legacy';
3
- export type LimitSourceDTO = 'grant_sync' | 'person' | 'operator';
3
+ export type LimitSourceDTO = 'grant_sync' | 'person' | 'operator' | 'billing' | 'card';
4
4
  /** One charge row. Every field of the ledger's `charges` table. */
5
5
  export interface ChargeDTO {
6
6
  /** `receipt:<provider>:<receipt id>` for a tool charge; `legacy:…` for a migrated aggregate; otherwise a fresh id. */
@@ -37,11 +37,18 @@ export interface ChargeDTO {
37
37
  limit: string;
38
38
  reason: string;
39
39
  } | null;
40
+ /** The principal Northlight invoices for this row; null when none or house-paid. */
41
+ account: string | null;
42
+ /** What Northlight bills for this row; null on a row it does not bill. */
43
+ billed_usd: number | null;
40
44
  }
41
45
  /** One limit row. A null filter means any. */
42
46
  export interface LimitDTO {
43
47
  id: string;
44
- payer: string;
48
+ /** Null when `account` is set. */
49
+ payer: string | null;
50
+ /** Counts the account's own charges and those of the apps it holds. */
51
+ account: string | null;
45
52
  funding: FundingDTO | null;
46
53
  grantee: string | null;
47
54
  provider: string | null;
@@ -61,10 +61,34 @@ export interface DeliveryResponse {
61
61
  names?: string[];
62
62
  plan?: unknown;
63
63
  }
64
+ /** The broker backgrounded a command: the job row's start. `deadline_at_ms` arms the claim-or-cancel deadline of an automatic handoff. */
64
65
  export interface BackgroundedJobRequest {
65
66
  command: string;
66
- job_dir: string;
67
- log_path: string;
67
+ purpose?: string | null;
68
+ deadline_at_ms?: number | null;
69
+ }
70
+ /** What the broker's reporter says about a job it runs, any subset: process identity, activity sample, exit (`vanished` when the process is gone without an exit record), and one output chunk (`seq` = chunk index, 64 KiB aligned; a growing last chunk is sent again whole). */
71
+ export interface JobReportRequest {
72
+ expected_execution_id: string;
73
+ pgid?: number;
74
+ pgid_identity?: string;
75
+ exit_code?: number;
76
+ vanished?: boolean;
77
+ activity?: {
78
+ last_ms: number;
79
+ sampled_ms: number;
80
+ files: string[];
81
+ };
82
+ output?: {
83
+ seq: number;
84
+ data_base64: string;
85
+ };
86
+ }
87
+ /** The node's change to a running job: declare it an expected wait, or arm (`deadline_at_ms`) or drop (`keep`) its cancel deadline. */
88
+ export interface JobPatchRequest {
89
+ quiet_ok?: true;
90
+ deadline_at_ms?: number;
91
+ keep?: true;
68
92
  }
69
93
  export interface BackgroundedJobDTO {
70
94
  id: string;
@@ -0,0 +1,57 @@
1
+ export interface StartBundleRepositoryDTO {
2
+ name: string;
3
+ github_full_name: string;
4
+ default_branch: string;
5
+ }
6
+ export interface StartBundleRecipeDTO {
7
+ revision: number;
8
+ repositories: StartBundleRepositoryDTO[];
9
+ setup_script: string | null;
10
+ pi_packages: string | null;
11
+ }
12
+ export interface StartBundlePluginDTO {
13
+ name: string;
14
+ source: {
15
+ marketplace: {
16
+ url: string | null;
17
+ ref: string | null;
18
+ };
19
+ } | {
20
+ path: string;
21
+ };
22
+ version: string | null;
23
+ }
24
+ /** `GET /v1/executions/{execution_id}/start`. Read-only; safe to repeat. */
25
+ export interface StartBundleDTO {
26
+ /** The execution row's `launch_json`, parsed. */
27
+ launch: unknown;
28
+ /** `environment_id` is the environment the node runs in: the id `POST /v1/environments/{id}/git-credential` takes. */
29
+ node: {
30
+ id: string;
31
+ app: string;
32
+ cwd: string;
33
+ profile: string | null;
34
+ isolated: boolean;
35
+ environment_id: string;
36
+ };
37
+ /** Null when the node's environment has no recipe. */
38
+ recipe: StartBundleRecipeDTO | null;
39
+ /** The person's GitHub login and noreply address from the GitHub app; null when the environment has no recipe repositories or the person has no GitHub link. */
40
+ git_identity: {
41
+ name: string;
42
+ email: string;
43
+ } | null;
44
+ plugins_revision: number;
45
+ plugins: StartBundlePluginDTO[];
46
+ }
47
+ /** `POST /v1/environments/{id}/git-credential` body: what git asked for. */
48
+ export interface GitCredentialRequest {
49
+ host: string;
50
+ path?: string;
51
+ }
52
+ /** The answer git's credential helper prints. */
53
+ export interface GitCredentialDTO {
54
+ username: string;
55
+ password: string;
56
+ expiry: string;
57
+ }
@@ -0,0 +1,2 @@
1
+ // The start bundle a sandbox fetches with its node token, and the git credential answer for one environment.
2
+ export {};
@@ -87,6 +87,11 @@ export interface ModelAuthReadinessDTO {
87
87
  reason?: 'invalid_grant';
88
88
  rate_limited_until?: string | null;
89
89
  }
90
+ /** `PATCH /v1/model-auth/{provider}/accounts/{label}` — `label` renames the account; `preferred` moves it to the front of the pool. */
91
+ export interface PatchManagedAccountRequest {
92
+ label?: string;
93
+ preferred?: true;
94
+ }
90
95
  /** `DELETE /v1/model-auth/{provider}` — all user credentials removed for one provider. */
91
96
  export interface CredentialRemovalResultDTO {
92
97
  provider: string;
@@ -16,6 +16,13 @@ export interface NodeTelemetryRecordRequest {
16
16
  updated_at: string;
17
17
  expected_execution_id: string;
18
18
  }
19
+ /** `PUT /v1/nodes/{id}/records/summaries` body: the broker's generated tool-group summaries and consolidated
20
+ * turn replies, each a whole-record replacement keyed as the broker keeps them. An omitted record is left as stored. */
21
+ export interface NodeSummariesRecordRequest {
22
+ tool_summaries?: Record<string, unknown>;
23
+ turn_replies?: Record<string, unknown>;
24
+ expected_execution_id: string;
25
+ }
19
26
  /** `PUT /v1/nodes/{id}/records/recap` body. */
20
27
  export interface NodeRecapRecordRequest {
21
28
  briefing: string;
@@ -33,3 +40,12 @@ export interface NodePushedFinalRequest {
33
40
  export interface NodePushedFinalResultDTO {
34
41
  pushedFinal: boolean;
35
42
  }
43
+ /** One file of a run's attachments: where the broker puts it (the path the run's prompt names) and its content hash. */
44
+ export interface NodeAttachmentDTO {
45
+ path: string;
46
+ sha256: string;
47
+ }
48
+ /** `GET /v1/nodes/{id}/attachments` result: every upload the node's run has fetched into the blob store. */
49
+ export interface NodeAttachmentsDTO {
50
+ attachments: NodeAttachmentDTO[];
51
+ }
@@ -80,7 +80,7 @@ export interface JobReadData {
80
80
  command: string;
81
81
  status: string;
82
82
  exit_code: number | null;
83
- log_path: string;
83
+ output_key: string;
84
84
  }
85
85
  /** `data` of a person, app, repo or profile read. */
86
86
  export interface OwnerReadData {
@@ -62,9 +62,6 @@ export type SubmitResultRequest = {
62
62
  export interface SubmitResultDTO {
63
63
  /** Which request this answered: `terminal` finished the node; `oneoff` left it working. */
64
64
  mode: 'terminal' | 'oneoff';
65
- /** Absolute path of the recorded artifact: context/result.json for an
66
- * answered request, context/declined.json for a declined one. */
67
- result_path: string;
68
65
  /** Present only when the request was declined. */
69
66
  declined?: DeclinedResultDTO;
70
67
  /** Ref of the report document pushed alongside the result, `<node-id>/reports/<name>`. */
@@ -216,6 +216,12 @@ export interface NodeStatusChangedEvent extends RunEventBaseDTO {
216
216
  status: NodeStatusDTO | 'dormant';
217
217
  reason: string | null;
218
218
  }
219
+ /** The node waits to start in an environment whose recipe image failed to build (D95). It stays dormant with its mail pending until a build succeeds. */
220
+ export interface EnvironmentImageFailedEvent extends RunEventBaseDTO {
221
+ type: 'environment.image_failed';
222
+ environment_id: string;
223
+ error: string;
224
+ }
219
225
  /** The run settled (the root only; a child's settlement is `child.settled`). */
220
226
  export interface NodeSettledEvent extends RunEventBaseDTO {
221
227
  type: 'node.settled';
@@ -224,7 +230,7 @@ export interface NodeSettledEvent extends RunEventBaseDTO {
224
230
  result?: unknown;
225
231
  }
226
232
  /** Every run event. Its `type`s are exactly the Vocabulary table of contract 2. */
227
- export type RunEvent = RunStartedEvent | NodeSystemPromptSetEvent | NodeMessageAcceptedEvent | NodeTurnStartedEvent | NodeThinkingDeltaEvent | NodeThinkingDoneEvent | NodeOutputTextDeltaEvent | NodeOutputTextDoneEvent | NodeToolCallStartedEvent | NodeToolCallCompletedEvent | NodeTurnCompletedEvent | RunUsageEvent | NodeReportPushedEvent | ChildStartedEvent | ChildSettledEvent | WaitingOnUserEvent | QuestionAnsweredEvent | NodeStatusChangedEvent | NodeSettledEvent;
233
+ export type RunEvent = RunStartedEvent | NodeSystemPromptSetEvent | NodeMessageAcceptedEvent | NodeTurnStartedEvent | NodeThinkingDeltaEvent | NodeThinkingDoneEvent | NodeOutputTextDeltaEvent | NodeOutputTextDoneEvent | NodeToolCallStartedEvent | NodeToolCallCompletedEvent | NodeTurnCompletedEvent | RunUsageEvent | NodeReportPushedEvent | ChildStartedEvent | ChildSettledEvent | WaitingOnUserEvent | QuestionAnsweredEvent | NodeStatusChangedEvent | EnvironmentImageFailedEvent | NodeSettledEvent;
228
234
  export type RunEventType = RunEvent['type'];
229
235
  /** The run event of one `type`. */
230
236
  export type RunEventOf<T extends RunEventType> = Extract<RunEvent, {
@@ -0,0 +1,55 @@
1
+ /** One scope's bookkeeping: marketplace and plugin check times, the last self check and the selected remote canvas. */
2
+ export interface SettingsScopeStateDTO {
3
+ marketplaces: Record<string, {
4
+ last_updated?: string;
5
+ }>;
6
+ plugins: Record<string, {
7
+ last_updated?: string;
8
+ etag?: string;
9
+ checked_at?: string;
10
+ }>;
11
+ last_self_check?: string;
12
+ activeCanvas?: string | null;
13
+ }
14
+ /** A stored profile: its id and manifest (name, projects, pause time, default kind, grantee, environment, delivery limits, metadata). */
15
+ export interface SettingsProfileDTO {
16
+ profileId: string;
17
+ manifest: object;
18
+ }
19
+ export interface PersonSettingsSnapshotDTO {
20
+ profiles: SettingsProfileDTO[];
21
+ /** Project directory → profile id. */
22
+ defaults: Record<string, string>;
23
+ /** Owner key (`user`, `profile:<id>`) → raw settings, with the `plugins` and `marketplaces` blocks rebuilt from their rows. */
24
+ settings: Record<string, Record<string, unknown>>;
25
+ state: Record<string, SettingsScopeStateDTO>;
26
+ }
27
+ export type SettingsOpDTO = {
28
+ op: 'settings.replace';
29
+ owner: string;
30
+ raw: Record<string, unknown>;
31
+ ifRevision: string;
32
+ } | {
33
+ op: 'state.write';
34
+ owner: string;
35
+ state: SettingsScopeStateDTO;
36
+ } | {
37
+ op: 'profile.insert';
38
+ profile: SettingsProfileDTO;
39
+ } | {
40
+ op: 'profile.update';
41
+ profile: SettingsProfileDTO;
42
+ } | {
43
+ op: 'profile.delete';
44
+ profileId: string;
45
+ } | {
46
+ op: 'defaults.replace';
47
+ defaults: Record<string, string>;
48
+ };
49
+ export interface PersonSettingsDTO {
50
+ person: string;
51
+ snapshot: PersonSettingsSnapshotDTO;
52
+ }
53
+ export interface PutPersonSettingsRequest {
54
+ ops: SettingsOpDTO[];
55
+ }
@@ -0,0 +1,4 @@
1
+ // Person settings DTOs: `GET /v1/settings` and `PUT /v1/settings` carry the person's profiles, scope settings, scope bookkeeping
2
+ // and plugin/marketplace install list as one snapshot. A CLI or viewer process holds no database; it reads this snapshot once and
3
+ // writes declarative ops back. A write whose `ifRevision` no longer matches the stored settings answers 409 `conflict`.
4
+ export {};
@@ -18,6 +18,7 @@ export * from './dto/limits.js';
18
18
  export * from './dto/grants.js';
19
19
  export * from './dto/usage.js';
20
20
  export * from './dto/charges.js';
21
+ export * from './dto/execution-start.js';
21
22
  export * from './dto/nodes.js';
22
23
  export * from './dto/node-outcomes.js';
23
24
  export * from './dto/node-events.js';
@@ -35,6 +36,7 @@ export * from './dto/config.js';
35
36
  export * from './dto/attach.js';
36
37
  export * from './dto/broker.js';
37
38
  export * from './dto/profiles.js';
39
+ export * from './dto/settings.js';
38
40
  export * from './dto/modelauth.js';
39
41
  export * from './dto/model-config.js';
40
42
  export * from './dto/canvas.js';
package/dist/api/index.js CHANGED
@@ -15,6 +15,7 @@ export * from './dto/limits.js';
15
15
  export * from './dto/grants.js';
16
16
  export * from './dto/usage.js';
17
17
  export * from './dto/charges.js';
18
+ export * from './dto/execution-start.js';
18
19
  export * from './dto/nodes.js';
19
20
  export * from './dto/node-outcomes.js';
20
21
  export * from './dto/node-events.js';
@@ -32,6 +33,7 @@ export * from './dto/config.js';
32
33
  export * from './dto/attach.js';
33
34
  export * from './dto/broker.js';
34
35
  export * from './dto/profiles.js';
36
+ export * from './dto/settings.js';
35
37
  export * from './dto/modelauth.js';
36
38
  export * from './dto/model-config.js';
37
39
  export * from './dto/canvas.js';