@north-light/api 0.0.0-stage → 0.3.414
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +18 -0
- package/README.md +66 -2
- package/dist/api/__tests__/error-codes.test.d.ts +1 -0
- package/dist/api/__tests__/error-codes.test.js +79 -0
- package/dist/api/__tests__/integration/client.test.d.ts +1 -0
- package/dist/api/__tests__/integration/client.test.js +276 -0
- package/dist/api/client.d.ts +501 -0
- package/dist/api/client.js +1281 -0
- package/dist/api/command-manifest/index.d.ts +3 -0
- package/dist/api/command-manifest/index.js +3 -0
- package/dist/api/command-manifest/manifest.d.ts +51 -0
- package/dist/api/command-manifest/manifest.js +332 -0
- package/dist/api/command-manifest/result.d.ts +25 -0
- package/dist/api/command-manifest/result.js +97 -0
- package/dist/api/command-manifest/schema.d.ts +28 -0
- package/dist/api/command-manifest/schema.js +856 -0
- package/dist/api/dto/analytics.d.ts +184 -0
- package/dist/api/dto/analytics.js +3 -0
- package/dist/api/dto/attach.d.ts +22 -0
- package/dist/api/dto/attach.js +13 -0
- package/dist/api/dto/bash-jobs.d.ts +24 -0
- package/dist/api/dto/bash-jobs.js +9 -0
- package/dist/api/dto/bash.d.ts +17 -0
- package/dist/api/dto/bash.js +1 -0
- package/dist/api/dto/broker-ops.d.ts +187 -0
- package/dist/api/dto/broker-ops.js +6 -0
- package/dist/api/dto/broker-signals.d.ts +25 -0
- package/dist/api/dto/broker-signals.js +1 -0
- package/dist/api/dto/broker.d.ts +86 -0
- package/dist/api/dto/broker.js +20 -0
- package/dist/api/dto/canvas.d.ts +359 -0
- package/dist/api/dto/canvas.js +2 -0
- package/dist/api/dto/chat-inventory.d.ts +56 -0
- package/dist/api/dto/chat-inventory.js +11 -0
- package/dist/api/dto/common.d.ts +29 -0
- package/dist/api/dto/common.js +15 -0
- package/dist/api/dto/config.d.ts +46 -0
- package/dist/api/dto/config.js +3 -0
- package/dist/api/dto/crons.d.ts +158 -0
- package/dist/api/dto/crons.js +10 -0
- package/dist/api/dto/custom-objects.d.ts +66 -0
- package/dist/api/dto/custom-objects.js +1 -0
- package/dist/api/dto/delivery.d.ts +71 -0
- package/dist/api/dto/delivery.js +7 -0
- package/dist/api/dto/docs.d.ts +135 -0
- package/dist/api/dto/docs.js +8 -0
- package/dist/api/dto/files.d.ts +21 -0
- package/dist/api/dto/files.js +1 -0
- package/dist/api/dto/focus.d.ts +24 -0
- package/dist/api/dto/focus.js +10 -0
- package/dist/api/dto/grants.d.ts +28 -0
- package/dist/api/dto/grants.js +1 -0
- package/dist/api/dto/health.d.ts +116 -0
- package/dist/api/dto/health.js +2 -0
- package/dist/api/dto/human-requests.d.ts +113 -0
- package/dist/api/dto/human-requests.js +4 -0
- package/dist/api/dto/human.d.ts +28 -0
- package/dist/api/dto/human.js +4 -0
- package/dist/api/dto/inbox.d.ts +273 -0
- package/dist/api/dto/inbox.js +4 -0
- package/dist/api/dto/lifecycle.d.ts +88 -0
- package/dist/api/dto/lifecycle.js +3 -0
- package/dist/api/dto/limits.d.ts +29 -0
- package/dist/api/dto/limits.js +2 -0
- package/dist/api/dto/mail.d.ts +44 -0
- package/dist/api/dto/mail.js +1 -0
- package/dist/api/dto/messages.d.ts +104 -0
- package/dist/api/dto/messages.js +2 -0
- package/dist/api/dto/model-config.d.ts +25 -0
- package/dist/api/dto/model-config.js +1 -0
- package/dist/api/dto/modelauth.d.ts +132 -0
- package/dist/api/dto/modelauth.js +4 -0
- package/dist/api/dto/node-events.d.ts +65 -0
- package/dist/api/dto/node-events.js +4 -0
- package/dist/api/dto/node-outcomes.d.ts +88 -0
- package/dist/api/dto/node-outcomes.js +2 -0
- package/dist/api/dto/node-records.d.ts +35 -0
- package/dist/api/dto/node-records.js +5 -0
- package/dist/api/dto/nodes.d.ts +371 -0
- package/dist/api/dto/nodes.js +3 -0
- package/dist/api/dto/objects.d.ts +172 -0
- package/dist/api/dto/objects.js +5 -0
- package/dist/api/dto/profiles.d.ts +117 -0
- package/dist/api/dto/profiles.js +4 -0
- package/dist/api/dto/recovery.d.ts +104 -0
- package/dist/api/dto/recovery.js +1 -0
- package/dist/api/dto/reports.d.ts +95 -0
- package/dist/api/dto/reports.js +2 -0
- package/dist/api/dto/review-comments.d.ts +146 -0
- package/dist/api/dto/review-comments.js +5 -0
- package/dist/api/dto/reviews.d.ts +113 -0
- package/dist/api/dto/reviews.js +5 -0
- package/dist/api/dto/run-events.d.ts +295 -0
- package/dist/api/dto/run-events.js +6 -0
- package/dist/api/dto/structured-requests.d.ts +64 -0
- package/dist/api/dto/structured-requests.js +5 -0
- package/dist/api/dto/subscriptions.d.ts +14 -0
- package/dist/api/dto/subscriptions.js +2 -0
- package/dist/api/dto/worktree.d.ts +55 -0
- package/dist/api/dto/worktree.js +6 -0
- package/dist/api/error-codes.d.ts +259 -0
- package/dist/api/error-codes.js +56 -0
- package/dist/api/errors.d.ts +47 -0
- package/dist/api/errors.js +66 -0
- package/dist/api/index.d.ts +48 -0
- package/dist/api/index.js +45 -0
- package/dist/api/long-poll.d.ts +59 -0
- package/dist/api/long-poll.js +67 -0
- package/dist/api/node-transport.d.ts +18 -0
- package/dist/api/node-transport.js +105 -0
- package/dist/api/plugin-manifest-schema.d.ts +233 -0
- package/dist/api/plugin-manifest-schema.js +23 -0
- package/dist/api/routes.d.ts +164 -0
- package/dist/api/routes.js +197 -0
- package/dist/api/runtime-version.d.ts +31 -0
- package/dist/api/runtime-version.js +50 -0
- package/dist/core/asset-root.d.ts +7 -0
- package/dist/core/asset-root.js +18 -0
- package/dist/core/canvas/boot-id.d.ts +6 -0
- package/dist/core/canvas/boot-id.js +26 -0
- package/dist/core/canvas/paths.d.ts +72 -0
- package/dist/core/canvas/paths.js +163 -0
- package/dist/core/canvas/pid.d.ts +391 -0
- package/dist/core/canvas/pid.js +948 -0
- package/dist/core/command-plugins/bundle.d.ts +149 -0
- package/dist/core/command-plugins/bundle.js +588 -0
- package/dist/core/command-plugins/endpoint.d.ts +24 -0
- package/dist/core/command-plugins/endpoint.js +51 -0
- package/dist/core/config.d.ts +233 -0
- package/dist/core/config.js +1120 -0
- package/dist/core/env-name.d.ts +6 -0
- package/dist/core/env-name.js +9 -0
- package/dist/core/errors.d.ts +38 -0
- package/dist/core/errors.js +90 -0
- package/dist/core/events/emit.d.ts +6 -0
- package/dist/core/events/emit.js +42 -0
- package/dist/core/events/envelope.d.ts +2 -0
- package/dist/core/events/envelope.js +84 -0
- package/dist/core/events/errors.d.ts +4 -0
- package/dist/core/events/errors.js +69 -0
- package/dist/core/events/operation-id.d.ts +4 -0
- package/dist/core/events/operation-id.js +24 -0
- package/dist/core/events/serialize.d.ts +4 -0
- package/dist/core/events/serialize.js +199 -0
- package/dist/core/events/source.d.ts +16 -0
- package/dist/core/events/source.js +31 -0
- package/dist/core/events/types.d.ts +68 -0
- package/dist/core/events/types.js +11 -0
- package/dist/core/exclusive-lock.d.ts +34 -0
- package/dist/core/exclusive-lock.js +197 -0
- package/dist/core/fs-utils.d.ts +44 -0
- package/dist/core/fs-utils.js +208 -0
- package/dist/core/help.d.ts +309 -0
- package/dist/core/help.js +406 -0
- package/dist/core/human/page-catalog.d.ts +57 -0
- package/dist/core/human/page-catalog.js +172 -0
- package/dist/core/installed-plugins.d.ts +2 -0
- package/dist/core/installed-plugins.js +79 -0
- package/dist/core/io.d.ts +122 -0
- package/dist/core/io.js +373 -0
- package/dist/core/keybindings/attach-control.d.ts +49 -0
- package/dist/core/keybindings/attach-control.js +42 -0
- package/dist/core/keybindings/catalog.d.ts +18 -0
- package/dist/core/keybindings/catalog.js +257 -0
- package/dist/core/keybindings/types.d.ts +42 -0
- package/dist/core/keybindings/types.js +1 -0
- package/dist/core/layout.d.ts +34 -0
- package/dist/core/layout.js +106 -0
- package/dist/core/locked-file.d.ts +27 -0
- package/dist/core/locked-file.js +118 -0
- package/dist/core/log.d.ts +9 -0
- package/dist/core/log.js +89 -0
- package/dist/core/manifest.d.ts +5 -0
- package/dist/core/manifest.js +15 -0
- package/dist/core/plugin-env.d.ts +8 -0
- package/dist/core/plugin-env.js +31 -0
- package/dist/core/plugin-extensions.d.ts +29 -0
- package/dist/core/plugin-extensions.js +191 -0
- package/dist/core/plugin-swap-lock.d.ts +9 -0
- package/dist/core/plugin-swap-lock.js +31 -0
- package/dist/core/preview-result-path.d.ts +4 -0
- package/dist/core/preview-result-path.js +26 -0
- package/dist/core/profiles/env-store.d.ts +22 -0
- package/dist/core/profiles/env-store.js +163 -0
- package/dist/core/profiles/fuzzy-match.d.ts +19 -0
- package/dist/core/profiles/fuzzy-match.js +92 -0
- package/dist/core/profiles/manifest.d.ts +120 -0
- package/dist/core/profiles/manifest.js +529 -0
- package/dist/core/rate-limit-scope.d.ts +25 -0
- package/dist/core/rate-limit-scope.js +64 -0
- package/dist/core/render.d.ts +12 -0
- package/dist/core/render.js +138 -0
- package/dist/core/resolver.d.ts +14 -0
- package/dist/core/resolver.js +111 -0
- package/dist/core/runtime/branded-host.d.ts +55 -0
- package/dist/core/runtime/branded-host.js +485 -0
- package/dist/core/runtime/broker/daemon-ops.d.ts +65 -0
- package/dist/core/runtime/broker/daemon-ops.js +177 -0
- package/dist/core/runtime/broker/signal-stream.d.ts +30 -0
- package/dist/core/runtime/broker/signal-stream.js +149 -0
- package/dist/core/scope.d.ts +32 -0
- package/dist/core/scope.js +184 -0
- package/dist/core/scoped-state/db.d.ts +17 -0
- package/dist/core/scoped-state/db.js +247 -0
- package/dist/core/scoped-state/migrate.d.ts +8 -0
- package/dist/core/scoped-state/migrate.js +187 -0
- package/dist/core/scoped-state/paths.d.ts +9 -0
- package/dist/core/scoped-state/paths.js +27 -0
- package/dist/core/scoped-state/profiles.d.ts +27 -0
- package/dist/core/scoped-state/profiles.js +93 -0
- package/dist/core/scoped-state/providers.d.ts +24 -0
- package/dist/core/scoped-state/providers.js +19 -0
- package/dist/core/scoped-state/schema.d.ts +6 -0
- package/dist/core/scoped-state/schema.js +43 -0
- package/dist/core/scoped-state/settings.d.ts +28 -0
- package/dist/core/scoped-state/settings.js +83 -0
- package/dist/core/spaces/open-beneath.d.ts +71 -0
- package/dist/core/spaces/open-beneath.js +581 -0
- package/dist/core/sqlite-statements.d.ts +4 -0
- package/dist/core/sqlite-statements.js +17 -0
- package/dist/core/subscription-state.d.ts +121 -0
- package/dist/core/subscription-state.js +287 -0
- package/dist/core/user-settings.d.ts +377 -0
- package/dist/core/user-settings.js +458 -0
- package/dist/daemon/broker-signals/bus.d.ts +30 -0
- package/dist/daemon/broker-signals/bus.js +87 -0
- package/dist/daemon/manage.d.ts +176 -0
- package/dist/daemon/manage.js +664 -0
- package/dist/daemon/pidfile.d.ts +8 -0
- package/dist/daemon/pidfile.js +37 -0
- package/dist/daemon/startup-policy.d.ts +1 -0
- package/dist/daemon/startup-policy.js +1 -0
- package/dist/native/linux.d.ts +29 -0
- package/dist/native/linux.js +20 -0
- package/dist/shared/env.d.ts +116 -0
- package/dist/shared/env.js +271 -0
- package/dist/shared/generated-context.d.ts +83 -0
- package/dist/shared/generated-context.js +235 -0
- package/dist/shared/inbox-entry-body.d.ts +22 -0
- package/dist/shared/inbox-entry-body.js +116 -0
- package/dist/shared/predicates.d.ts +2 -0
- package/dist/shared/predicates.js +4 -0
- package/dist/shared/working-activity.d.ts +9 -0
- package/dist/shared/working-activity.js +27 -0
- package/dist/types.d.ts +562 -0
- package/dist/types.js +186 -0
- package/package.json +47 -4
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import type { IsoTime, NodeIdDTO } from './common.js';
|
|
2
|
+
export type CronScopeDTO = 'profile' | 'global';
|
|
3
|
+
export type CronOverlapDTO = 'skip' | 'queue' | 'replace';
|
|
4
|
+
export type CronOnOutputDTO = 'silent' | 'on-failure' | 'always' | 'on-change';
|
|
5
|
+
export type CronStateDTO = 'active' | 'paused';
|
|
6
|
+
export type CronRunStateDTO = 'idle' | 'running';
|
|
7
|
+
/** Is this a safe single path segment for `routes.cron*()` interpolation?
|
|
8
|
+
* Cron ids are server-minted UUIDs, but the route builders carry no logic, so
|
|
9
|
+
* every interpolated id is gated here first (the `isSafeNodeId` discipline). */
|
|
10
|
+
export declare function isSafeCronId(id: string): boolean;
|
|
11
|
+
/** The last settled run, carried on every cron projection so `cron list` shows
|
|
12
|
+
* recent health without a `cron show` per row. Null until the first run. */
|
|
13
|
+
export interface CronLastRunDTO {
|
|
14
|
+
/** When the run settled (UTC). */
|
|
15
|
+
finished: IsoTime | null;
|
|
16
|
+
/** -1 = timeout kill; null = no exit observed (process error / skip marker). */
|
|
17
|
+
exit_code: number | null;
|
|
18
|
+
/** What the sink did with the output, or why it didn't. */
|
|
19
|
+
delivered: string | null;
|
|
20
|
+
}
|
|
21
|
+
/** A cron row projection (`GET /v1/crons`). */
|
|
22
|
+
export interface CronDTO {
|
|
23
|
+
cron_id: string;
|
|
24
|
+
/** Agent-legible label; how the cron shows in list. */
|
|
25
|
+
name: string;
|
|
26
|
+
/** Provenance only — the node that armed it, if any; never a cascade anchor. */
|
|
27
|
+
created_by: NodeIdDTO | null;
|
|
28
|
+
/** The bash command each fire runs. */
|
|
29
|
+
command: string;
|
|
30
|
+
/** The shell and any spawned node stay isolated when armed from an isolated node. */
|
|
31
|
+
isolated: boolean;
|
|
32
|
+
/** Next occurrence (UTC). */
|
|
33
|
+
fire_at: IsoTime;
|
|
34
|
+
/** Recur JSON (interval or cron); null for a one-shot. */
|
|
35
|
+
recur: string | null;
|
|
36
|
+
/** IANA zone for a calendar cadence; null otherwise. */
|
|
37
|
+
tz: string | null;
|
|
38
|
+
/** Clock bound; the row is deleted when passed. Null = no bound. */
|
|
39
|
+
expires_at: IsoTime | null;
|
|
40
|
+
/** Opt-in node coupling (cascades on that node's deletion); null = detached. */
|
|
41
|
+
anchor_node: NodeIdDTO | null;
|
|
42
|
+
cancel_on_wake: boolean;
|
|
43
|
+
/** Execution context, snapshotted at arm time. */
|
|
44
|
+
cwd: string;
|
|
45
|
+
profile: string | null;
|
|
46
|
+
scope: CronScopeDTO;
|
|
47
|
+
/** Names of the extra env vars snapshotted onto the row — KEYS ONLY: the
|
|
48
|
+
* values are the caller's to know and may be secrets. */
|
|
49
|
+
env_keys: string[];
|
|
50
|
+
run_timeout_s: number;
|
|
51
|
+
overlap: CronOverlapDTO;
|
|
52
|
+
on_output: CronOnOutputDTO;
|
|
53
|
+
/** Where deliveries go — the raw sink spec (`node:<id>` | `spawn:<kind>` |
|
|
54
|
+
* `human`), or null when the disposition never delivers. */
|
|
55
|
+
sink: string | null;
|
|
56
|
+
tier: string;
|
|
57
|
+
state: CronStateDTO;
|
|
58
|
+
/** True while the row is parked by the exit-75 owed-gate disposition: the
|
|
59
|
+
* last scheduled run declared "owed but not currently eligible", so the
|
|
60
|
+
* occurrence was not spent. A daemon poke re-dues it now; otherwise a
|
|
61
|
+
* recurring row re-checks at its natural `fire_at` slot (the backstop) and
|
|
62
|
+
* a held one-shot waits for a poke until `expires_at` deletes it. `state`
|
|
63
|
+
* stays honest (active|paused) — renderers derive; an active held row must
|
|
64
|
+
* never present as paused. */
|
|
65
|
+
held: boolean;
|
|
66
|
+
run_state: CronRunStateDTO;
|
|
67
|
+
/** Recent health: the most recent settled run, or null if it never ran. */
|
|
68
|
+
last_run: CronLastRunDTO | null;
|
|
69
|
+
created: IsoTime;
|
|
70
|
+
updated: IsoTime;
|
|
71
|
+
}
|
|
72
|
+
/** `GET /v1/crons` query. `profile` is the CALLER's profile, which is what
|
|
73
|
+
* scoping means here: a profile-scoped cron belongs to its profile, a global
|
|
74
|
+
* one is canvas-home-wide. Omitting `profile` means the caller stands outside
|
|
75
|
+
* every profile (a plain shell, or a provenance read such as "which crons did
|
|
76
|
+
* node X arm") and sees the whole canvas home. This is a namespacing
|
|
77
|
+
* boundary between profiles, not a security boundary. */
|
|
78
|
+
export interface ListCronsQuery {
|
|
79
|
+
profile?: string;
|
|
80
|
+
}
|
|
81
|
+
/** Caller identity for the per-cron routes (show/pause/resume/run/cancel).
|
|
82
|
+
* Same rule as `ListCronsQuery`: a cron outside the caller's scope is 404,
|
|
83
|
+
* and an absent profile sees everything. */
|
|
84
|
+
export interface CronScopeQuery {
|
|
85
|
+
profile?: string | null;
|
|
86
|
+
}
|
|
87
|
+
/** Cancellation-only query. `run_id` is set automatically inside a cron run,
|
|
88
|
+
* letting crtrd distinguish a run ending itself from an external cancellation
|
|
89
|
+
* that must terminate an in-flight process. */
|
|
90
|
+
export interface CancelCronQuery extends CronScopeQuery {
|
|
91
|
+
run_id?: string;
|
|
92
|
+
}
|
|
93
|
+
/** One settled run-log entry (`GET /v1/crons/:cronId`, `POST /v1/crons/:cronId/run`). */
|
|
94
|
+
export interface CronRunDTO {
|
|
95
|
+
run_id: string;
|
|
96
|
+
started: IsoTime;
|
|
97
|
+
finished: IsoTime | null;
|
|
98
|
+
duration_ms: number | null;
|
|
99
|
+
/** null = no exit observed (spawn/process error, or a skip marker); -1 = timeout kill. */
|
|
100
|
+
exit_code: number | null;
|
|
101
|
+
stdout_head: string | null;
|
|
102
|
+
stderr_head: string | null;
|
|
103
|
+
/** What the sink did with this run's output, or why it didn't. */
|
|
104
|
+
delivered: string | null;
|
|
105
|
+
}
|
|
106
|
+
/** `POST /v1/crons/poke` — the bare daemon-level eligibility poke. Re-dues
|
|
107
|
+
* every held active cron now; paused rows keep their held state. Idempotent
|
|
108
|
+
* and free when nothing is held. */
|
|
109
|
+
export interface PokeCronsResult {
|
|
110
|
+
/** How many held rows were re-dued — for the caller's log line. */
|
|
111
|
+
unparked: number;
|
|
112
|
+
/** The poke receipt instant (UTC). */
|
|
113
|
+
at: IsoTime;
|
|
114
|
+
}
|
|
115
|
+
/** `GET /v1/crons/:cronId` — one cron with its run-log ring (most recent first). */
|
|
116
|
+
export interface CronShowDTO {
|
|
117
|
+
cron: CronDTO;
|
|
118
|
+
runs: CronRunDTO[];
|
|
119
|
+
}
|
|
120
|
+
/** `POST /v1/crons` — arm one cron. The CLI resolves timing client-side
|
|
121
|
+
* (parseWhen/parseCadence) and sends the settled `fire_at`/`recur`/`tz`;
|
|
122
|
+
* the server mints the cron_id and applies spec defaults for everything
|
|
123
|
+
* omitted. */
|
|
124
|
+
export interface ArmCronRequest {
|
|
125
|
+
name: string;
|
|
126
|
+
command: string;
|
|
127
|
+
fire_at: IsoTime;
|
|
128
|
+
recur?: string | null;
|
|
129
|
+
tz?: string | null;
|
|
130
|
+
created_by?: NodeIdDTO | null;
|
|
131
|
+
isolated?: boolean;
|
|
132
|
+
/** Execution context, snapshotted at arm time — chosen by the client, else
|
|
133
|
+
* inherited from the creating node; never re-resolved at run time. Omitted
|
|
134
|
+
* means the daemon's default: the creating node's folder for an isolated
|
|
135
|
+
* cron, else the app's files directory. A runtime whose cron runs are
|
|
136
|
+
* sandboxed refuses (400 `cwd_not_mounted`) a chosen cwd the run's mounts do
|
|
137
|
+
* not reach, so a cron is never armed with a directory it cannot start in. */
|
|
138
|
+
cwd?: string;
|
|
139
|
+
/** `cwd` is the caller's own current directory rather than a choice. A
|
|
140
|
+
* sandboxed runtime then replaces it with the default when the run cannot
|
|
141
|
+
* reach it, instead of refusing. */
|
|
142
|
+
cwd_is_default?: boolean;
|
|
143
|
+
/** Extra env for every run, as a JSON object of string values. */
|
|
144
|
+
env_json?: string | null;
|
|
145
|
+
profile?: string | null;
|
|
146
|
+
/** `profile` (default when a profile is resolved) requires a profile. */
|
|
147
|
+
scope?: CronScopeDTO;
|
|
148
|
+
on_output?: CronOnOutputDTO;
|
|
149
|
+
/** Raw sink spec: `node:<id>` | `spawn:<kind>` | `human`. Required by the
|
|
150
|
+
* always/on-change dispositions; meaningless otherwise. */
|
|
151
|
+
sink?: string | null;
|
|
152
|
+
tier?: string;
|
|
153
|
+
expires_at?: IsoTime | null;
|
|
154
|
+
anchor_node?: NodeIdDTO | null;
|
|
155
|
+
cancel_on_wake?: boolean;
|
|
156
|
+
run_timeout_s?: number;
|
|
157
|
+
overlap?: CronOverlapDTO;
|
|
158
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Cron DTOs (the cron-spec scheduler — arm/list/show/run/pause/resume/cancel).
|
|
2
|
+
/** Is this a safe single path segment for `routes.cron*()` interpolation?
|
|
3
|
+
* Cron ids are server-minted UUIDs, but the route builders carry no logic, so
|
|
4
|
+
* every interpolated id is gated here first (the `isSafeNodeId` discipline). */
|
|
5
|
+
export function isSafeCronId(id) {
|
|
6
|
+
return typeof id === 'string'
|
|
7
|
+
&& id !== '' && id !== '.' && id !== '..'
|
|
8
|
+
&& !/[\\/\0\s?#%]/u.test(id)
|
|
9
|
+
&& Buffer.byteLength(id, 'utf8') <= 128;
|
|
10
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export interface CustomEventSpecDTO {
|
|
2
|
+
level: number;
|
|
3
|
+
supersedes?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export type CustomReceiverDTO = 'queue' | {
|
|
6
|
+
url: string;
|
|
7
|
+
} | {
|
|
8
|
+
argv: string[];
|
|
9
|
+
cwd: string;
|
|
10
|
+
};
|
|
11
|
+
export interface RegisterCustomObjectRequestDTO {
|
|
12
|
+
kind: string;
|
|
13
|
+
name: string;
|
|
14
|
+
owner?: string;
|
|
15
|
+
description: string;
|
|
16
|
+
events: Record<string, CustomEventSpecDTO>;
|
|
17
|
+
receiver?: CustomReceiverDTO;
|
|
18
|
+
rotate_token?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface RegisterCustomObjectResponseDTO {
|
|
21
|
+
id: string;
|
|
22
|
+
name: string;
|
|
23
|
+
token?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface PublishCustomObjectRequestDTO {
|
|
26
|
+
event: string;
|
|
27
|
+
summary: string;
|
|
28
|
+
state?: unknown;
|
|
29
|
+
cause?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface PublishCustomObjectResponseDTO {
|
|
32
|
+
message_id: string | null;
|
|
33
|
+
delivered: number;
|
|
34
|
+
depth: number;
|
|
35
|
+
}
|
|
36
|
+
/** Pending deliveries replay on every connection until acknowledged, regardless of `after`. Blank-line heartbeats arrive every 15 seconds. */
|
|
37
|
+
export interface QueueLineDTO {
|
|
38
|
+
/** Acknowledge this delivery by its delivery_id. */
|
|
39
|
+
delivery_id: string;
|
|
40
|
+
/** The source event id to pass as `publish({ cause: line.message_id })` when reacting. */
|
|
41
|
+
message_id: string;
|
|
42
|
+
/** Durable ordering number, not an acknowledgement checkpoint. */
|
|
43
|
+
seq: number;
|
|
44
|
+
event: string;
|
|
45
|
+
level: number;
|
|
46
|
+
object: {
|
|
47
|
+
id: string;
|
|
48
|
+
type: string;
|
|
49
|
+
name: string;
|
|
50
|
+
owner: string | null;
|
|
51
|
+
};
|
|
52
|
+
actor: string | null;
|
|
53
|
+
attrs: Record<string, unknown>;
|
|
54
|
+
summary?: string;
|
|
55
|
+
state?: unknown;
|
|
56
|
+
pointer?: string;
|
|
57
|
+
depth: number;
|
|
58
|
+
created_at: string;
|
|
59
|
+
}
|
|
60
|
+
export interface AckCustomDeliveriesRequestDTO {
|
|
61
|
+
delivery_ids: string[];
|
|
62
|
+
}
|
|
63
|
+
export interface AckCustomDeliveriesResponseDTO {
|
|
64
|
+
acknowledged: number;
|
|
65
|
+
unknown?: string[];
|
|
66
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { NodeSubjectDTO } from './nodes.js';
|
|
2
|
+
export type DeliveryActivity = 'boot' | 'system-prompt' | 'compact' | 'persona' | 'file-read' | 'command' | 'pre-command' | 'slash-command' | 'names'
|
|
3
|
+
/** Dry run only: a live node's workspace-open arrives inside its boot. */
|
|
4
|
+
| 'workspace-open'
|
|
5
|
+
/** Dry run only: what reading the document named by `subject` delivers alongside it. */
|
|
6
|
+
| 'document-read';
|
|
7
|
+
export interface DeliveryRequest {
|
|
8
|
+
expected_execution_id?: string;
|
|
9
|
+
activity: DeliveryActivity;
|
|
10
|
+
subject?: string;
|
|
11
|
+
inherited?: boolean;
|
|
12
|
+
dry_run?: boolean;
|
|
13
|
+
subject_override?: Partial<NodeSubjectDTO>;
|
|
14
|
+
}
|
|
15
|
+
/** A node that does not exist, for `POST /v1/delivery/dry-run`. Unset fields
|
|
16
|
+
* come from `node` when one is named, else from defaults. */
|
|
17
|
+
export interface HypotheticalNodeDTO {
|
|
18
|
+
cwd?: string;
|
|
19
|
+
/** Profile id or name; null for no profile. Defaults to the profile pinned to `cwd`. */
|
|
20
|
+
profile?: string | null;
|
|
21
|
+
grantee?: string;
|
|
22
|
+
kind?: string;
|
|
23
|
+
mode?: 'base' | 'orchestrator';
|
|
24
|
+
lifecycle?: 'terminal' | 'resident';
|
|
25
|
+
has_manager?: boolean;
|
|
26
|
+
depth?: number;
|
|
27
|
+
}
|
|
28
|
+
/** `POST /v1/delivery/dry-run` — a person's dry run of one delivery activity,
|
|
29
|
+
* for a live node (`node`), a node that does not exist (`hypothetical`), or a
|
|
30
|
+
* live node dialled away from (both). Writes nothing. */
|
|
31
|
+
export interface DeliveryDryRunRequest {
|
|
32
|
+
activity: DeliveryActivity;
|
|
33
|
+
subject?: string;
|
|
34
|
+
node?: string;
|
|
35
|
+
hypothetical?: HypotheticalNodeDTO;
|
|
36
|
+
subject_override?: Partial<NodeSubjectDTO>;
|
|
37
|
+
}
|
|
38
|
+
/** One resolvable inline memory reference — the broker's `RefMeta`. Metadata
|
|
39
|
+
* only, never the document body or its source path. */
|
|
40
|
+
export interface DeliveryRefDTO {
|
|
41
|
+
name: string;
|
|
42
|
+
kind: 'knowledge' | 'preference';
|
|
43
|
+
scope: 'node' | 'project' | 'profile' | 'user' | 'builtin';
|
|
44
|
+
shortForm: string;
|
|
45
|
+
gatewayVisible: boolean;
|
|
46
|
+
}
|
|
47
|
+
export interface DeliveryCommandDTO {
|
|
48
|
+
name: string;
|
|
49
|
+
command_name: string;
|
|
50
|
+
description: string;
|
|
51
|
+
canonical_body: string;
|
|
52
|
+
execution_body: string;
|
|
53
|
+
}
|
|
54
|
+
export interface DeliveryResponse {
|
|
55
|
+
content: string;
|
|
56
|
+
inherited?: boolean;
|
|
57
|
+
commands?: DeliveryCommandDTO[];
|
|
58
|
+
blocks?: string[];
|
|
59
|
+
execution_body?: string;
|
|
60
|
+
refs?: DeliveryRefDTO[];
|
|
61
|
+
names?: string[];
|
|
62
|
+
plan?: unknown;
|
|
63
|
+
}
|
|
64
|
+
export interface BackgroundedJobRequest {
|
|
65
|
+
command: string;
|
|
66
|
+
job_dir: string;
|
|
67
|
+
log_path: string;
|
|
68
|
+
}
|
|
69
|
+
export interface BackgroundedJobDTO {
|
|
70
|
+
id: string;
|
|
71
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Delivery DTOs — `POST /v1/nodes/:id/delivery`, the broker's one route for
|
|
2
|
+
// rule-driven document delivery, plus the backgrounded-job record route.
|
|
3
|
+
//
|
|
4
|
+
// PURITY (spec §3.1): Node built-ins + `src/api/*` only (type-only imports).
|
|
5
|
+
// Never reach into src/core here: the publish-api job compiles this package
|
|
6
|
+
// alone, and core modules pull in workspace packages it does not build.
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import type { ObjectDTO, PrivacyName } from './objects.js';
|
|
2
|
+
export declare const RULE_ON: readonly ["boot", "workspace-open", "file-read", "document-read", "command", "pre-command", "slash-command"];
|
|
3
|
+
export type RuleOnName = typeof RULE_ON[number];
|
|
4
|
+
export declare const RULE_DELIVER: readonly ["name", "preview", "content"];
|
|
5
|
+
export type RuleDeliverName = typeof RULE_DELIVER[number];
|
|
6
|
+
export interface DeliveryRuleDTO {
|
|
7
|
+
on: RuleOnName;
|
|
8
|
+
match?: string[];
|
|
9
|
+
match_frontmatter?: Record<string, unknown>;
|
|
10
|
+
if?: unknown;
|
|
11
|
+
deliver: RuleDeliverName;
|
|
12
|
+
}
|
|
13
|
+
/** The `--owner` value: whose document it is. */
|
|
14
|
+
export type DocOwnerFlag = 'node' | 'user' | 'profile' | `profile:${string}` | 'app' | 'repo' | `repo:${string}`;
|
|
15
|
+
export declare const DOC_KINDS: readonly ["knowledge", "preference"];
|
|
16
|
+
export type DocKindName = typeof DOC_KINDS[number];
|
|
17
|
+
export interface DocWriteRequest {
|
|
18
|
+
name: string;
|
|
19
|
+
body: string;
|
|
20
|
+
preview: string;
|
|
21
|
+
owner?: DocOwnerFlag;
|
|
22
|
+
kind?: DocKindName;
|
|
23
|
+
summary?: string;
|
|
24
|
+
privacy?: PrivacyName;
|
|
25
|
+
rules?: DeliveryRuleDTO[];
|
|
26
|
+
why_it_exists?: string;
|
|
27
|
+
unlisted?: boolean;
|
|
28
|
+
lint_ignore?: string[];
|
|
29
|
+
extensions?: Record<string, Record<string, unknown>>;
|
|
30
|
+
/** The caller's cwd, for `--owner repo` resolution. */
|
|
31
|
+
cwd?: string;
|
|
32
|
+
}
|
|
33
|
+
/** `name` is canonical: `<owner-handle>/<name>`. */
|
|
34
|
+
/** `unresolved_links`: names that match nothing in the writer's view. `remote_links`: names whose
|
|
35
|
+
* first segment is no owner on this runtime — on another runtime, or misspelled. */
|
|
36
|
+
export interface DocLinkReportDTO {
|
|
37
|
+
unresolved_links?: string[];
|
|
38
|
+
remote_links?: string[];
|
|
39
|
+
}
|
|
40
|
+
export interface DocWrittenDTO extends DocLinkReportDTO {
|
|
41
|
+
id: string;
|
|
42
|
+
name: string;
|
|
43
|
+
}
|
|
44
|
+
export declare const DOC_UNSET_FIELDS: readonly ["summary", "why_it_exists", "unlisted", "lint_ignore", "extensions", "rules"];
|
|
45
|
+
export type DocUnsetField = typeof DOC_UNSET_FIELDS[number];
|
|
46
|
+
export interface DocEditRequest {
|
|
47
|
+
body?: string;
|
|
48
|
+
replace?: Array<{
|
|
49
|
+
old: string;
|
|
50
|
+
new: string;
|
|
51
|
+
}>;
|
|
52
|
+
rationale: string;
|
|
53
|
+
/** The heads key the edit was made from. Absent → the caller's last read of the document. */
|
|
54
|
+
base?: string;
|
|
55
|
+
verbatim?: boolean;
|
|
56
|
+
preview?: string;
|
|
57
|
+
summary?: string;
|
|
58
|
+
privacy?: PrivacyName;
|
|
59
|
+
rules?: DeliveryRuleDTO[];
|
|
60
|
+
why_it_exists?: string;
|
|
61
|
+
unlisted?: boolean;
|
|
62
|
+
lint_ignore?: string[];
|
|
63
|
+
extensions?: Record<string, Record<string, unknown>>;
|
|
64
|
+
unset?: DocUnsetField[];
|
|
65
|
+
}
|
|
66
|
+
export interface DocEditedDTO extends DocLinkReportDTO {
|
|
67
|
+
id: string;
|
|
68
|
+
name: string;
|
|
69
|
+
revision: number;
|
|
70
|
+
}
|
|
71
|
+
/** Body of the 409 `stale_revision` error's `details`. */
|
|
72
|
+
export interface DocStaleDTO {
|
|
73
|
+
stale: {
|
|
74
|
+
revision: number;
|
|
75
|
+
heads_key: string;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
export interface DocMoveRequest {
|
|
79
|
+
new_name?: string;
|
|
80
|
+
owner?: DocOwnerFlag;
|
|
81
|
+
cwd?: string;
|
|
82
|
+
}
|
|
83
|
+
export interface DocMovedDTO {
|
|
84
|
+
id: string;
|
|
85
|
+
name: string;
|
|
86
|
+
}
|
|
87
|
+
export interface DocDeletedDTO {
|
|
88
|
+
id: string;
|
|
89
|
+
name: string;
|
|
90
|
+
}
|
|
91
|
+
export interface DocHistoryQuery {
|
|
92
|
+
diff?: number;
|
|
93
|
+
}
|
|
94
|
+
export interface DocRevisionDTO {
|
|
95
|
+
rev_id: string;
|
|
96
|
+
number: number;
|
|
97
|
+
author_id: string | null;
|
|
98
|
+
rationale: string | null;
|
|
99
|
+
verbatim: boolean;
|
|
100
|
+
created_at: string;
|
|
101
|
+
parents: string[];
|
|
102
|
+
}
|
|
103
|
+
export interface DocHistoryDTO {
|
|
104
|
+
object: ObjectDTO;
|
|
105
|
+
revisions: DocRevisionDTO[];
|
|
106
|
+
diff?: string;
|
|
107
|
+
}
|
|
108
|
+
export interface DocLintRequest {
|
|
109
|
+
owner?: DocOwnerFlag;
|
|
110
|
+
cwd?: string;
|
|
111
|
+
}
|
|
112
|
+
export interface DocLintFindingDTO {
|
|
113
|
+
name: string;
|
|
114
|
+
severity: 'error' | 'warning';
|
|
115
|
+
rule: string;
|
|
116
|
+
message: string;
|
|
117
|
+
}
|
|
118
|
+
export interface DocLintDTO {
|
|
119
|
+
findings: DocLintFindingDTO[];
|
|
120
|
+
}
|
|
121
|
+
export interface ReconcilePackagesDTO {
|
|
122
|
+
created: number;
|
|
123
|
+
updated: number;
|
|
124
|
+
deleted: number;
|
|
125
|
+
/** plugins whose handle another owner holds; their documents are not on the canvas */
|
|
126
|
+
conflicts: Array<{
|
|
127
|
+
plugin: string;
|
|
128
|
+
message: string;
|
|
129
|
+
}>;
|
|
130
|
+
/** package files that are not documents (unparseable frontmatter, a name another file holds) */
|
|
131
|
+
invalid: Array<{
|
|
132
|
+
path: string;
|
|
133
|
+
error: string;
|
|
134
|
+
}>;
|
|
135
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Document DTOs — the `/v1/docs` write verbs behind `crtr doc`, plus the
|
|
2
|
+
// package-document reconcile route.
|
|
3
|
+
//
|
|
4
|
+
// PURITY (spec §3.1): Node built-ins + `src/api/*` only.
|
|
5
|
+
export const RULE_ON = ['boot', 'workspace-open', 'file-read', 'document-read', 'command', 'pre-command', 'slash-command'];
|
|
6
|
+
export const RULE_DELIVER = ['name', 'preview', 'content'];
|
|
7
|
+
export const DOC_KINDS = ['knowledge', 'preference'];
|
|
8
|
+
export const DOC_UNSET_FIELDS = ['summary', 'why_it_exists', 'unlisted', 'lint_ignore', 'extensions', 'rules'];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type FileEncoding = 'utf8' | 'base64';
|
|
2
|
+
export interface FilePeekDTO {
|
|
3
|
+
path: string;
|
|
4
|
+
content: string;
|
|
5
|
+
truncated: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface FileWriteDTO {
|
|
8
|
+
path: string;
|
|
9
|
+
bytes_written: number;
|
|
10
|
+
}
|
|
11
|
+
export interface FileEntryDTO {
|
|
12
|
+
name: string;
|
|
13
|
+
type: 'file' | 'dir' | 'other';
|
|
14
|
+
size: number;
|
|
15
|
+
modified: string;
|
|
16
|
+
}
|
|
17
|
+
export interface FileListDTO {
|
|
18
|
+
path: string;
|
|
19
|
+
entries: FileEntryDTO[];
|
|
20
|
+
truncated: boolean;
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { NodeIdDTO } from './common.js';
|
|
2
|
+
/** One viewer row: a node's single on-screen pane in a tmux session. */
|
|
3
|
+
export interface FocusDTO {
|
|
4
|
+
focus_id: string;
|
|
5
|
+
pane: string | null;
|
|
6
|
+
session: string | null;
|
|
7
|
+
node_id: NodeIdDTO;
|
|
8
|
+
}
|
|
9
|
+
/** `POST /v1/focuses` body — register a viewer pane as a node's focus row.
|
|
10
|
+
* UNIQUE(node_id): returns the existing row (no insert) when the pane or node
|
|
11
|
+
* is already registered. `window` is accepted for the call contract but not
|
|
12
|
+
* stored (the table keys on pane + session). */
|
|
13
|
+
export interface RegisterFocusRequest {
|
|
14
|
+
node_id: NodeIdDTO;
|
|
15
|
+
pane: string;
|
|
16
|
+
session: string | null;
|
|
17
|
+
window: string | null;
|
|
18
|
+
}
|
|
19
|
+
/** `PATCH /v1/focuses/{focus_id}` body — re-point a viewer row's pane + its
|
|
20
|
+
* derived session cache after the pane moves. */
|
|
21
|
+
export interface SetFocusPaneRequest {
|
|
22
|
+
pane: string | null;
|
|
23
|
+
session: string | null;
|
|
24
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Focus DTOs (the viewer registry — canvas.db `focuses` table). A FOCUS is one
|
|
2
|
+
// durable on-screen viewport bound to one node (UNIQUE node_id ⇒ ≤1 per node).
|
|
3
|
+
// The wire shape mirrors the internal `FocusRow` 1:1 — the registry is a flat
|
|
4
|
+
// pane↔node binding with no projection to reshape.
|
|
5
|
+
//
|
|
6
|
+
// The reads GC lazily server-side (a row whose pane is gone is pruned on read),
|
|
7
|
+
// so a returned row is always live. The mutations are the tmux-driven CLI
|
|
8
|
+
// surfaces' (surface-tmux-spread, focus placement) writes: the tmux verbs run
|
|
9
|
+
// LOCALLY in the caller's session; only the canvas.db focus rows route here.
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** A provider's setup state for the account (directory spec, "Provider setup state"). */
|
|
2
|
+
export type SetupState = 'not_started' | 'pending' | 'ready' | 'failed';
|
|
3
|
+
/** One provider the grantee requires, as the directory's grant sync carried it. */
|
|
4
|
+
export interface ProviderDependency {
|
|
5
|
+
state: SetupState;
|
|
6
|
+
/** The provider's own sentence for `pending` and `failed` (its `message_pending` / `message_failed`); absent for `not_started` and `ready`. */
|
|
7
|
+
message?: string;
|
|
8
|
+
/** Absolute URL of the directory's setup page for this provider and this app (`<issuer>/connect/setup/<provider>?client_id=<grantee>`); the app may append `return_to` (its own registered redirect origin) so Continue brings the person back. */
|
|
9
|
+
next: string;
|
|
10
|
+
}
|
|
11
|
+
export interface GrantGetDTO {
|
|
12
|
+
sub: string;
|
|
13
|
+
grantee: string;
|
|
14
|
+
client_id: string;
|
|
15
|
+
grant: string;
|
|
16
|
+
exp: number;
|
|
17
|
+
rev: number;
|
|
18
|
+
resolved_scopes: {
|
|
19
|
+
scope: string;
|
|
20
|
+
mode: 'always' | 'ask';
|
|
21
|
+
}[];
|
|
22
|
+
spend_cap: number | null;
|
|
23
|
+
payer: 'user';
|
|
24
|
+
/** `{ <provider id>: ProviderDependency }` as the directory's grant sync carried it; `{}` when the grantee has none. The daemon performs no `requires` check: an app follows this with the SDK grant watch (`oauth.watchGrants`, or `grant.get` with `wait`/`since`) and refuses its own operation with `provider_setup_pending`. When an entry's `state` is not `ready`, show its `message` (the provider's own sentence, when it has one) and send the person to its `next` (the directory's setup page) — never copy the provider's prose into the app. */
|
|
25
|
+
dependencies: Record<string, ProviderDependency>;
|
|
26
|
+
/** Opaque; changes exactly when `rev`, `resolved_scopes`, `spend_cap`, `payer` or `dependencies` changes (never on a periodic sync alone or a new token). Pass it back as `since` with `wait` to hold the read until it changes. */
|
|
27
|
+
version: string;
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import type { NodeStatusDTO } from './common.js';
|
|
2
|
+
/** Ephemeral daemon lifecycle phase reported by health and status. */
|
|
3
|
+
export type StartupPhaseDTO = 'initializing' | 'blocked' | 'prepared' | 'recovering' | 'ready';
|
|
4
|
+
/** `GET /healthz` — substrate readiness probe. Versions are informational, never
|
|
5
|
+
* a gate. Used by the provisioning ladder. */
|
|
6
|
+
export interface HealthDTO {
|
|
7
|
+
ok: boolean;
|
|
8
|
+
daemon_up: boolean;
|
|
9
|
+
store_accessible: boolean;
|
|
10
|
+
brokers_reconciled: boolean;
|
|
11
|
+
/** Present while corpus migration or normal daemon startup is incomplete. */
|
|
12
|
+
startup_blocked?: string;
|
|
13
|
+
/** Always present; only `ready` admits normal daemon work. */
|
|
14
|
+
startup_phase: StartupPhaseDTO;
|
|
15
|
+
}
|
|
16
|
+
/** `GET /v1/status` — daemon status snapshot. Backs `crtr sys daemon status`
|
|
17
|
+
* state and the `crtr canvas dashboard` header. `runtime_version` is also
|
|
18
|
+
* checked by Core's minimum-runtime capability gate. */
|
|
19
|
+
export interface StatusDTO {
|
|
20
|
+
daemon_pid: number;
|
|
21
|
+
tick_interval_ms: number;
|
|
22
|
+
/** Node counts keyed by status. */
|
|
23
|
+
node_counts: Partial<Record<NodeStatusDTO, number>>;
|
|
24
|
+
/** Nodes genuinely mid-turn: their busy marker exists and their recorded pid is alive. Unlike `node_counts.active`, this excludes live-but-waiting, parked, or blocked engines. */
|
|
25
|
+
busy_node_count: number;
|
|
26
|
+
/** Bound listener addresses. `tcp` is null when the TCP listener is off. */
|
|
27
|
+
listeners: {
|
|
28
|
+
socket_path: string;
|
|
29
|
+
tcp: string | null;
|
|
30
|
+
};
|
|
31
|
+
runtime_version: string;
|
|
32
|
+
api_version: string;
|
|
33
|
+
/** Always present; only `ready` admits normal daemon work. */
|
|
34
|
+
startup_phase: StartupPhaseDTO;
|
|
35
|
+
}
|
|
36
|
+
/** `GET /v1/due` — whether this runtime has work in flight or due, and when its
|
|
37
|
+
* next timed work is. `busy` is true while a non-spare node is mid-turn with a
|
|
38
|
+
* live pid, a cron or bash job is running, or any timed lane has work due now.
|
|
39
|
+
* `next_due_at` (ISO) is the earliest time any timed lane owes work, null when
|
|
40
|
+
* none. A sandbox may sleep only while `busy` is false and must wake by
|
|
41
|
+
* `next_due_at`. */
|
|
42
|
+
export interface DueDTO {
|
|
43
|
+
busy: boolean;
|
|
44
|
+
next_due_at: string | null;
|
|
45
|
+
}
|
|
46
|
+
/** `POST /v1/daemon/restart` — the ack for a daemon-owned handover.
|
|
47
|
+
*
|
|
48
|
+
* The daemon answers BEFORE it tears anything down: the caller is normally a
|
|
49
|
+
* node's own bash tool, whose broker this handover will kill, so the ack must
|
|
50
|
+
* be a settled tool result in that node's transcript before the SIGTERM lands.
|
|
51
|
+
* `accepted` is therefore a promise about the future, not a completed action —
|
|
52
|
+
* the successor daemon is spawned after `grace_ms`, and every node the
|
|
53
|
+
* teardown interrupts is resumed by it. */
|
|
54
|
+
export interface MigrateStateRequest {
|
|
55
|
+
dry_run?: boolean;
|
|
56
|
+
}
|
|
57
|
+
/** `crtr sys migrate`: the canvas import (004-canvas-documents) plan or result. */
|
|
58
|
+
export interface MigrateStateDTO {
|
|
59
|
+
/** Loose-key moves/imports (paths and names only). */
|
|
60
|
+
loose_keys?: string[];
|
|
61
|
+
/** Every store root the import found, with its owner and document count. */
|
|
62
|
+
stores: {
|
|
63
|
+
root: string;
|
|
64
|
+
owner: Record<string, unknown>;
|
|
65
|
+
docs: number;
|
|
66
|
+
skipped?: string;
|
|
67
|
+
}[];
|
|
68
|
+
/** `documents.<kind>`, `documents.owner.<type>`, `revisions`, `documents.rewritten`, `owners`, … */
|
|
69
|
+
counts: Record<string, number>;
|
|
70
|
+
rewrites: {
|
|
71
|
+
path: string;
|
|
72
|
+
from: string;
|
|
73
|
+
to: string;
|
|
74
|
+
}[];
|
|
75
|
+
dropped_fields: {
|
|
76
|
+
path: string;
|
|
77
|
+
field: string;
|
|
78
|
+
}[];
|
|
79
|
+
skipped: {
|
|
80
|
+
path: string;
|
|
81
|
+
reason: string;
|
|
82
|
+
}[];
|
|
83
|
+
/** Each clash or unreadable source the import resolved itself, one line each. */
|
|
84
|
+
resolutions: {
|
|
85
|
+
kind: string;
|
|
86
|
+
message: string;
|
|
87
|
+
paths: string[];
|
|
88
|
+
}[];
|
|
89
|
+
blockers: {
|
|
90
|
+
kind: string;
|
|
91
|
+
message: string;
|
|
92
|
+
paths: string[];
|
|
93
|
+
}[];
|
|
94
|
+
dryRun: boolean;
|
|
95
|
+
/** True while the import has not been written. */
|
|
96
|
+
pending: boolean;
|
|
97
|
+
resumed: boolean;
|
|
98
|
+
resume_error?: string;
|
|
99
|
+
}
|
|
100
|
+
/** `POST /v1/daemon/admit` — opens normal daemon work after preparation. */
|
|
101
|
+
export interface DaemonAdmitDTO {
|
|
102
|
+
/** True only for the request that began admission. */
|
|
103
|
+
admitted: boolean;
|
|
104
|
+
/** True when another request had already begun or completed admission. */
|
|
105
|
+
already_admitted: boolean;
|
|
106
|
+
startup_phase: StartupPhaseDTO;
|
|
107
|
+
}
|
|
108
|
+
export interface DaemonRestartDTO {
|
|
109
|
+
accepted: boolean;
|
|
110
|
+
/** The daemon that took the request and is about to hand over. */
|
|
111
|
+
predecessor_pid: number;
|
|
112
|
+
/** Its epoch id — the successor mints a new one. */
|
|
113
|
+
predecessor_epoch: string;
|
|
114
|
+
/** How long the daemon waits after answering before teardown begins. */
|
|
115
|
+
grace_ms: number;
|
|
116
|
+
}
|