@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,104 @@
|
|
|
1
|
+
import type { InboxTierDTO, IsoTime, NodeIdDTO } from './common.js';
|
|
2
|
+
/** One runtime card supplied by a caller: the runtime renders and escapes it
|
|
3
|
+
* exactly once, so a caller cannot emit a malformed card or smuggle markup
|
|
4
|
+
* into one. `kind` must be namespaced (contain `:`) — bare kinds are
|
|
5
|
+
* crouter's own closed vocabulary. */
|
|
6
|
+
export interface RuntimeCardRequest {
|
|
7
|
+
kind: string;
|
|
8
|
+
facts?: Record<string, string | number>;
|
|
9
|
+
/** Data, not markup. */
|
|
10
|
+
body?: string;
|
|
11
|
+
}
|
|
12
|
+
/** `POST /v1/nodes/{id}/messages` body. */
|
|
13
|
+
export interface SendMessageRequest {
|
|
14
|
+
body: string;
|
|
15
|
+
tier?: InboxTierDTO;
|
|
16
|
+
/** Sender node id for feed attribution (the CLI resolves `CRTR_NODE_ID`;
|
|
17
|
+
* the daemon has no ambient caller identity). Absent → an external/human
|
|
18
|
+
* caller (`from: null`). */
|
|
19
|
+
from?: NodeIdDTO | null;
|
|
20
|
+
/** Revive with no inbox entry (`--fresh` → `reviveNode({ resume: false })`). */
|
|
21
|
+
fresh?: boolean;
|
|
22
|
+
/** Before delivery, make the target resident and clear its finalization latch
|
|
23
|
+
* when present (`--reopen`). Accepted for both durable and interactive
|
|
24
|
+
* delivery; `--fresh` retains its separate finalized-only gate. */
|
|
25
|
+
reopen?: boolean;
|
|
26
|
+
/** Hidden ambient context upserted onto the target's sidecar as a
|
|
27
|
+
* `situational` card, never visible chat (`--situational-context`).
|
|
28
|
+
* Immediate only; valid alone (no body). Prose only — its body is NOT
|
|
29
|
+
* escaped; a caller with untrusted text uses `situational_card`. */
|
|
30
|
+
situational_context?: string;
|
|
31
|
+
/** A runtime card that REPLACES the target's situational sidecar, delivered
|
|
32
|
+
* ahead of the body in the same turn and re-stated by the session-start
|
|
33
|
+
* bearings after a context refresh. Mutually exclusive with
|
|
34
|
+
* `situational_context`; valid alone (no body) on the durable path. */
|
|
35
|
+
situational_card?: RuntimeCardRequest;
|
|
36
|
+
/** One-shot runtime cards for this turn only — never persisted. Delivered in
|
|
37
|
+
* array order, after `situational_card` and ahead of the body. */
|
|
38
|
+
context_cards?: RuntimeCardRequest[];
|
|
39
|
+
/** Raw JSON-schema string installing a one-off output schema before delivery
|
|
40
|
+
* (`--output-schema`); the target answers with `crtr push result`. Immediate only. */
|
|
41
|
+
output_schema?: string;
|
|
42
|
+
/** `'interactive'`: deliver via the target's LIVE broker engine (prompt/steer
|
|
43
|
+
* on its one serialized frame loop — the same ordering a tmux viewer gets)
|
|
44
|
+
* instead of the durable inbox; a dormant or mid-revive target falls back to
|
|
45
|
+
* the durable inbox + revive (watcher delivers post-boot). Plain immediate
|
|
46
|
+
* body only — rejected with fresh/situational_context/output_schema or tier
|
|
47
|
+
* 'deferred'. Runtime cards and reopen ARE accepted: a
|
|
48
|
+
* card-bearing send is an ordinary human send that happens to carry context,
|
|
49
|
+
* and the live deliver frame places the cards ahead of the body in one turn.
|
|
50
|
+
* Absent → durable inbox (unchanged). */
|
|
51
|
+
delivery?: 'interactive';
|
|
52
|
+
}
|
|
53
|
+
/** A synchronous wake that failed after the message was durably accepted. */
|
|
54
|
+
export interface MessageWakeFailureDTO {
|
|
55
|
+
/** Stable error code (e.g. `cwd_missing`). */
|
|
56
|
+
error: string;
|
|
57
|
+
message: string;
|
|
58
|
+
/** The repair, when the failure names one. */
|
|
59
|
+
next?: string;
|
|
60
|
+
/** The accepted entry; the daemon's `message.wake_failed` error event carries
|
|
61
|
+
* the same id. */
|
|
62
|
+
message_id: string;
|
|
63
|
+
}
|
|
64
|
+
/** Result of an immediate message send. */
|
|
65
|
+
export interface MessageResultDTO {
|
|
66
|
+
node_id: NodeIdDTO;
|
|
67
|
+
/** Whether an inbox entry was appended now. */
|
|
68
|
+
delivered: boolean;
|
|
69
|
+
/** Whether this request synchronously launched the target. Ordinary durable
|
|
70
|
+
* delivery to an active or idle dormant target always reports false: the
|
|
71
|
+
* lifecycle reconciler launches it from the durable inbox entry later. */
|
|
72
|
+
revived: boolean;
|
|
73
|
+
/** Present only when this request attempted a synchronous wake and no broker
|
|
74
|
+
* slot was free. The target's row is frozen and the daemon relaunches it
|
|
75
|
+
* when one frees; the entry was durably appended either way. */
|
|
76
|
+
not_revived_reason?: 'capacity_frozen';
|
|
77
|
+
/** Present only when this request attempted a synchronous wake and it threw.
|
|
78
|
+
* The entry is still durably accepted (`delivered` stays true, so a caller
|
|
79
|
+
* must not resend); nothing will wake the target on its own until the cause
|
|
80
|
+
* is repaired. */
|
|
81
|
+
wake_failed?: MessageWakeFailureDTO;
|
|
82
|
+
/** Present only when the entry was appended ABOVE the requested tier: a
|
|
83
|
+
* terminal target never takes the later cycle `normal`/`deferred` wait for,
|
|
84
|
+
* so its mail is raised to the steering tier. */
|
|
85
|
+
delivered_tier?: InboxTierDTO;
|
|
86
|
+
delivered_at?: IsoTime;
|
|
87
|
+
/** Which channel a `delivery:'interactive'` send actually used: `'engine'`
|
|
88
|
+
* (live broker frame loop, no inbox entry) or `'inbox'` (durable fallback).
|
|
89
|
+
* Absent for non-interactive sends. */
|
|
90
|
+
delivered_via?: 'engine' | 'inbox';
|
|
91
|
+
}
|
|
92
|
+
/** `POST /v1/nodes/{id}/interrupt` result — the human Esc, first-class. Cancels
|
|
93
|
+
* pending undelivered human-send inbox entries FIRST, then aborts a live
|
|
94
|
+
* in-flight turn; a dormant target is NEVER revived. */
|
|
95
|
+
export interface InterruptResultDTO {
|
|
96
|
+
node_id: NodeIdDTO;
|
|
97
|
+
/** Primary outcome: `aborted_turn` wins over `canceled_pending` over `idle`
|
|
98
|
+
* (abort + cancel can co-occur; the flags below carry the full picture). */
|
|
99
|
+
outcome: 'aborted_turn' | 'canceled_pending' | 'idle';
|
|
100
|
+
/** True when a live in-flight turn (or `!` bash run) was actually aborted. */
|
|
101
|
+
aborted_turn: boolean;
|
|
102
|
+
/** How many pending undelivered human-send inbox entries were canceled. */
|
|
103
|
+
canceled_pending: number;
|
|
104
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type ModelStrengthDTO = 'ultra' | 'strong' | 'medium' | 'light';
|
|
2
|
+
export interface ModelRouteConfigDTO {
|
|
3
|
+
family: string;
|
|
4
|
+
credentialSource: string;
|
|
5
|
+
providerId: string;
|
|
6
|
+
models: Record<ModelStrengthDTO, string>;
|
|
7
|
+
}
|
|
8
|
+
export interface ModelRoutingDTO {
|
|
9
|
+
credentialSourceOrder?: string[];
|
|
10
|
+
familyOrder?: string[];
|
|
11
|
+
strengthFallback?: ModelStrengthDTO[];
|
|
12
|
+
}
|
|
13
|
+
export interface PutModelConfigRequest {
|
|
14
|
+
config_version: string;
|
|
15
|
+
modelRoutes: Record<string, ModelRouteConfigDTO>;
|
|
16
|
+
modelRouting: ModelRoutingDTO;
|
|
17
|
+
kinds: Record<string, {
|
|
18
|
+
model: string;
|
|
19
|
+
orchestratorModel?: string;
|
|
20
|
+
}>;
|
|
21
|
+
}
|
|
22
|
+
export interface PutModelConfigResponse {
|
|
23
|
+
config_version: string;
|
|
24
|
+
delivered: true;
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/** `PUT /v1/model-auth/{provider}` body — a discriminated union over credential
|
|
2
|
+
* kind. Idempotent upsert/rotate keyed by provider (and `account_id` for a
|
|
3
|
+
* managed account). */
|
|
4
|
+
export type InstallCredentialRequest = {
|
|
5
|
+
kind: 'api_key';
|
|
6
|
+
api_key: string;
|
|
7
|
+
} | {
|
|
8
|
+
kind: 'oauth';
|
|
9
|
+
access_token: string;
|
|
10
|
+
/** Required — pi's `OAuthCredentials` always carries both; the handler is
|
|
11
|
+
* fail-loud (400) when either is absent, so the type matches (no lenient
|
|
12
|
+
* fallback). */
|
|
13
|
+
refresh_token: string;
|
|
14
|
+
expires_at: string;
|
|
15
|
+
account_id?: string;
|
|
16
|
+
/** Provider-specific credential keys beyond the canonical tokens (e.g.
|
|
17
|
+
* github-copilot's `enterpriseUrl`), retained for enterprise routing and
|
|
18
|
+
* token refresh. */
|
|
19
|
+
extra?: Record<string, unknown>;
|
|
20
|
+
} | {
|
|
21
|
+
kind: 'managed_account';
|
|
22
|
+
/** Optional requested label. A bare provider login automatically labels a newly seen
|
|
23
|
+
* account from its identity profile. */
|
|
24
|
+
label?: string;
|
|
25
|
+
auto_label?: boolean;
|
|
26
|
+
account_id?: string;
|
|
27
|
+
access_token: string;
|
|
28
|
+
/** Required — the managed login always returns both; the handler is
|
|
29
|
+
* fail-loud (400) when either is absent. */
|
|
30
|
+
refresh_token: string;
|
|
31
|
+
expires_at: string;
|
|
32
|
+
/** Causal-cooldown floor snapshotted before the interactive login flow. Epoch ms. */
|
|
33
|
+
last_rate_limited_at?: number;
|
|
34
|
+
};
|
|
35
|
+
/** Result of a credential install/rotate. */
|
|
36
|
+
export interface CredentialResultDTO {
|
|
37
|
+
provider: string;
|
|
38
|
+
installed: true;
|
|
39
|
+
managed: boolean;
|
|
40
|
+
account_id?: string;
|
|
41
|
+
}
|
|
42
|
+
/** One managed-pool account, projected without credential material. Timestamps are
|
|
43
|
+
* ISO strings so remote consumers do not need to understand pi's epoch-ms storage. */
|
|
44
|
+
export interface ManagedAccountStatusDTO {
|
|
45
|
+
label: string;
|
|
46
|
+
expires_at: string;
|
|
47
|
+
/** Account-wide cooldown: every model on the account is cooling until this instant. */
|
|
48
|
+
rate_limited_until: string;
|
|
49
|
+
/** Per-model-family cooldowns still in force (e.g. `opus` from an Opus weekly window); other families on the account stay usable. */
|
|
50
|
+
model_cooldowns?: Array<{
|
|
51
|
+
family: string;
|
|
52
|
+
rate_limited_until: string;
|
|
53
|
+
}>;
|
|
54
|
+
auth_failure?: 'invalid_grant';
|
|
55
|
+
account_id?: string;
|
|
56
|
+
}
|
|
57
|
+
/** A provider's sanitized credential state. Managed providers are always listed
|
|
58
|
+
* (even with no accounts); non-managed providers appear only when auth.json has
|
|
59
|
+
* an API-key or OAuth credential for them. */
|
|
60
|
+
export type ModelAuthProviderStatusDTO = {
|
|
61
|
+
provider: string;
|
|
62
|
+
managed: true;
|
|
63
|
+
configured: boolean;
|
|
64
|
+
accounts: ManagedAccountStatusDTO[];
|
|
65
|
+
} | {
|
|
66
|
+
provider: string;
|
|
67
|
+
managed: false;
|
|
68
|
+
configured: true;
|
|
69
|
+
kind: 'api_key' | 'oauth';
|
|
70
|
+
};
|
|
71
|
+
/** `GET /v1/model-auth` — credential-presence projection for every known provider. */
|
|
72
|
+
export interface ModelAuthListDTO {
|
|
73
|
+
providers: ModelAuthProviderStatusDTO[];
|
|
74
|
+
}
|
|
75
|
+
/** Inputs that select the exact provider a new root node would use. */
|
|
76
|
+
export interface ModelAuthReadinessQuery {
|
|
77
|
+
profile?: string;
|
|
78
|
+
cwd?: string;
|
|
79
|
+
kind?: string;
|
|
80
|
+
model?: string;
|
|
81
|
+
}
|
|
82
|
+
/** `GET /v1/model-auth/readiness` — credential state for the provider selected by a prospective root launch. */
|
|
83
|
+
export interface ModelAuthReadinessDTO {
|
|
84
|
+
provider: string;
|
|
85
|
+
model: string;
|
|
86
|
+
credential: 'ready' | 'missing' | 'unusable';
|
|
87
|
+
reason?: 'invalid_grant';
|
|
88
|
+
rate_limited_until?: string | null;
|
|
89
|
+
}
|
|
90
|
+
/** `DELETE /v1/model-auth/{provider}` — all user credentials removed for one provider. */
|
|
91
|
+
export interface CredentialRemovalResultDTO {
|
|
92
|
+
provider: string;
|
|
93
|
+
removed_accounts: number;
|
|
94
|
+
}
|
|
95
|
+
/** `POST /v1/model-auth/flows` (`model_auth.start`) — begin a daemon-run vendor
|
|
96
|
+
* sign-in. `openai` is accepted as `openai-codex`; `openai-chatgpt` starts Sign in
|
|
97
|
+
* with ChatGPT for the runtime provider `openai`. `redirect: "loopback"` makes
|
|
98
|
+
* the daemon listen on the vendor's registered localhost port (self-host only). */
|
|
99
|
+
export interface StartModelAuthFlowRequest {
|
|
100
|
+
provider: 'anthropic' | 'openai-codex' | 'openai' | 'openai-chatgpt';
|
|
101
|
+
redirect?: 'loopback';
|
|
102
|
+
/** Name for the signed-in account; omitted, a newly seen account is auto-labeled. */
|
|
103
|
+
label?: string;
|
|
104
|
+
}
|
|
105
|
+
/** The started flow: open `url`; for Anthropic's code page paste the code back
|
|
106
|
+
* through `complete`; for OpenAI's device flow enter `user_code` at `url`; for
|
|
107
|
+
* ChatGPT paste the final redirect URL through `complete`. `provider` is the
|
|
108
|
+
* runtime provider id (`openai` for ChatGPT). */
|
|
109
|
+
export interface ModelAuthFlowStartedDTO {
|
|
110
|
+
flow_id: string;
|
|
111
|
+
provider: 'anthropic' | 'openai-codex' | 'openai';
|
|
112
|
+
url: string;
|
|
113
|
+
instructions: string;
|
|
114
|
+
user_code?: string;
|
|
115
|
+
expires_at: string;
|
|
116
|
+
}
|
|
117
|
+
/** `POST /v1/model-auth/flows/{flow_id}/complete` (`model_auth.complete`). */
|
|
118
|
+
export interface CompleteModelAuthFlowRequest {
|
|
119
|
+
input: string;
|
|
120
|
+
}
|
|
121
|
+
export interface ModelAuthFlowCompletedDTO {
|
|
122
|
+
flow_id: string;
|
|
123
|
+
provider: 'anthropic' | 'openai-codex' | 'openai';
|
|
124
|
+
status: 'connected';
|
|
125
|
+
}
|
|
126
|
+
/** `GET /v1/model-auth/flows/{flow_id}` — a flow's state. */
|
|
127
|
+
export interface ModelAuthFlowDTO {
|
|
128
|
+
flow_id: string;
|
|
129
|
+
provider: 'anthropic' | 'openai-codex' | 'openai';
|
|
130
|
+
status: 'pending' | 'connected' | 'failed' | 'expired';
|
|
131
|
+
message?: string;
|
|
132
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { NodeIdDTO, NodeStatusDTO } from './common.js';
|
|
2
|
+
import type { NodeOutcomeDTO } from './node-outcomes.js';
|
|
3
|
+
import type { ReportDTO } from './reports.js';
|
|
4
|
+
export interface NodeEventBaseDTO {
|
|
5
|
+
node_id: NodeIdDTO;
|
|
6
|
+
sequence_number: number;
|
|
7
|
+
}
|
|
8
|
+
export interface NodeOutputTextDeltaDTO extends NodeEventBaseDTO {
|
|
9
|
+
type: 'node.output_text.delta';
|
|
10
|
+
delta: string;
|
|
11
|
+
}
|
|
12
|
+
export interface NodeOutputTextDoneDTO extends NodeEventBaseDTO {
|
|
13
|
+
type: 'node.output_text.done';
|
|
14
|
+
text: string;
|
|
15
|
+
}
|
|
16
|
+
export interface NodeToolCallStartedDTO extends NodeEventBaseDTO {
|
|
17
|
+
type: 'node.tool_call.started';
|
|
18
|
+
tool_call_id: string;
|
|
19
|
+
tool: string;
|
|
20
|
+
/** Argument shape only; it never includes argument values. */
|
|
21
|
+
summary: string;
|
|
22
|
+
}
|
|
23
|
+
export interface NodeToolCallCompletedDTO extends NodeEventBaseDTO {
|
|
24
|
+
type: 'node.tool_call.completed';
|
|
25
|
+
tool_call_id: string;
|
|
26
|
+
tool: string;
|
|
27
|
+
status: 'ok' | 'error';
|
|
28
|
+
/** Argument shape only; it never includes argument values or tool output. */
|
|
29
|
+
summary: string;
|
|
30
|
+
}
|
|
31
|
+
export interface NodeTurnStartedDTO extends NodeEventBaseDTO {
|
|
32
|
+
type: 'node.turn.started';
|
|
33
|
+
}
|
|
34
|
+
export interface NodeTurnCompletedDTO extends NodeEventBaseDTO {
|
|
35
|
+
type: 'node.turn.completed';
|
|
36
|
+
}
|
|
37
|
+
export interface NodeReportPushedDTO extends NodeEventBaseDTO {
|
|
38
|
+
type: 'node.report.pushed';
|
|
39
|
+
report: ReportDTO;
|
|
40
|
+
}
|
|
41
|
+
export interface NodeStatusChangedDTO extends NodeEventBaseDTO {
|
|
42
|
+
type: 'node.status.changed';
|
|
43
|
+
/** `dormant` is stream-only: it means no broker is currently reachable. */
|
|
44
|
+
status: NodeStatusDTO | 'dormant';
|
|
45
|
+
}
|
|
46
|
+
export interface NodeSettledDTO extends NodeEventBaseDTO {
|
|
47
|
+
type: 'node.settled';
|
|
48
|
+
outcome: NodeOutcomeDTO;
|
|
49
|
+
}
|
|
50
|
+
export interface NodeEventErrorDTO {
|
|
51
|
+
type: 'error';
|
|
52
|
+
error: {
|
|
53
|
+
code: 'stream_gap' | 'stream_dropped' | 'stream_error';
|
|
54
|
+
message: string;
|
|
55
|
+
details?: {
|
|
56
|
+
earliest_sequence?: number;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
/** Every parsed server-sent event from `GET /v1/nodes/{id}/events`. */
|
|
61
|
+
export type NodeEventDTO = NodeOutputTextDeltaDTO | NodeOutputTextDoneDTO | NodeToolCallStartedDTO | NodeToolCallCompletedDTO | NodeTurnStartedDTO | NodeTurnCompletedDTO | NodeReportPushedDTO | NodeStatusChangedDTO | NodeSettledDTO | NodeEventErrorDTO;
|
|
62
|
+
/** Query accepted by the raw event-stream route. */
|
|
63
|
+
export interface NodeEventsQuery {
|
|
64
|
+
after?: number;
|
|
65
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { IsoTime, NodeIdDTO, NodeStatusDTO, TerminalReasonDTO } from './common.js';
|
|
2
|
+
import type { DeclinedResultDTO } from './reports.js';
|
|
3
|
+
export type OutcomeKindDTO = 'result' | 'failure';
|
|
4
|
+
/** The terminal outcome fields carried by a node-list row. */
|
|
5
|
+
export interface NodeOutcomeSummaryDTO {
|
|
6
|
+
kind: OutcomeKindDTO;
|
|
7
|
+
reason: TerminalReasonDTO;
|
|
8
|
+
settled_at: IsoTime;
|
|
9
|
+
}
|
|
10
|
+
/** Bounded diagnostics recorded for a failed node outcome. */
|
|
11
|
+
export interface NodeOutcomeDetailV1 {
|
|
12
|
+
schema: 'crtr.node-outcome-detail/v1';
|
|
13
|
+
message?: string;
|
|
14
|
+
fault_kind?: 'rate-limit' | 'overloaded' | 'connection' | 'auth' | 'protocol' | 'context-overflow' | 'other' | 'wedged' | 'model-not-found';
|
|
15
|
+
error_class?: 'rate_limit' | 'overloaded' | 'connection' | 'auth' | 'protocol' | 'context_overflow' | 'wedged' | 'model_not_found' | 'unknown';
|
|
16
|
+
respawn_failures?: number;
|
|
17
|
+
deadline?: {
|
|
18
|
+
deadline_at: string;
|
|
19
|
+
elapsed_ms: number;
|
|
20
|
+
};
|
|
21
|
+
/** Present only for reason `declined`: what the node gave `crtr push result --decline`. */
|
|
22
|
+
declined?: DeclinedResultDTO;
|
|
23
|
+
truncated?: true;
|
|
24
|
+
}
|
|
25
|
+
interface NodeOutcomeBaseDTO {
|
|
26
|
+
node_id: NodeIdDTO;
|
|
27
|
+
revision: number;
|
|
28
|
+
settled_at: IsoTime;
|
|
29
|
+
/** Canonical final report document ref (`<nodeId>/reports/<name>`, read with `crtr canvas read`); set for kind='result' and for a declined structured result (kind='failure', reason='declined'); else null. */
|
|
30
|
+
final_report: string | null;
|
|
31
|
+
/** Parsed context/result.json when the node ran under --output-schema; else null. */
|
|
32
|
+
structured_result: unknown | null;
|
|
33
|
+
/** Bounded diagnostics; null for kind='result'. */
|
|
34
|
+
detail: NodeOutcomeDetailV1 | null;
|
|
35
|
+
}
|
|
36
|
+
/** A settled outcome. Narrowing on `kind` then `reason` makes a declined
|
|
37
|
+
* structured result (`failure`/`declined`) a case a consumer must handle:
|
|
38
|
+
* only that case can carry `declined`; every other outcome has it null. A
|
|
39
|
+
* declined outcome latched before the decline block was recorded on the row
|
|
40
|
+
* (or reconstructed by the outcome-column backfill from `terminal_reason`
|
|
41
|
+
* alone) carries null there — the decline happened, its reason/code/retryable
|
|
42
|
+
* triple was never stored. */
|
|
43
|
+
export type NodeOutcomeDTO = (NodeOutcomeBaseDTO & {
|
|
44
|
+
kind: 'result';
|
|
45
|
+
reason: TerminalReasonDTO;
|
|
46
|
+
declined: null;
|
|
47
|
+
}) | (NodeOutcomeBaseDTO & {
|
|
48
|
+
kind: 'failure';
|
|
49
|
+
reason: 'declined';
|
|
50
|
+
declined: DeclinedResultDTO | null;
|
|
51
|
+
}) | (NodeOutcomeBaseDTO & {
|
|
52
|
+
kind: 'failure';
|
|
53
|
+
reason: Exclude<TerminalReasonDTO, 'declined'>;
|
|
54
|
+
declined: null;
|
|
55
|
+
});
|
|
56
|
+
export interface NodeOutcomeResponseDTO {
|
|
57
|
+
node_id: NodeIdDTO;
|
|
58
|
+
state: 'pending' | 'settled';
|
|
59
|
+
outcome: NodeOutcomeDTO | null;
|
|
60
|
+
node_status: NodeStatusDTO;
|
|
61
|
+
deadline_at: IsoTime | null;
|
|
62
|
+
}
|
|
63
|
+
export interface RegisterOutcomeDeliveryRequest {
|
|
64
|
+
/** A name declared in the humanActions map of scope config. */
|
|
65
|
+
action: string;
|
|
66
|
+
/** Opaque, frozen at registration, echoed verbatim in the document. */
|
|
67
|
+
payload?: unknown;
|
|
68
|
+
}
|
|
69
|
+
export type OutcomeDeliveryStateDTO = 'armed' | 'pending' | 'running' | 'accepted' | 'permanent_failed';
|
|
70
|
+
export interface OutcomeDeliveryDTO {
|
|
71
|
+
node_id: NodeIdDTO;
|
|
72
|
+
state: OutcomeDeliveryStateDTO;
|
|
73
|
+
action: string;
|
|
74
|
+
attempt: number;
|
|
75
|
+
/** ISO-8601 time of the next retry, or null before the row is scheduled. */
|
|
76
|
+
next_attempt_at: IsoTime | null;
|
|
77
|
+
accepted_at: IsoTime | null;
|
|
78
|
+
permanent_failed_at: IsoTime | null;
|
|
79
|
+
last_failure: {
|
|
80
|
+
kind: string;
|
|
81
|
+
exit_code?: number;
|
|
82
|
+
signal?: string;
|
|
83
|
+
message?: string;
|
|
84
|
+
} | null;
|
|
85
|
+
created_at: IsoTime;
|
|
86
|
+
updated_at: IsoTime;
|
|
87
|
+
}
|
|
88
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** `POST /v1/nodes/{id}/records/log` body: one serialized event record, no newline. */
|
|
2
|
+
export interface NodeLogAppendRequest {
|
|
3
|
+
record: string;
|
|
4
|
+
expected_execution_id: string;
|
|
5
|
+
}
|
|
6
|
+
export interface NodeLogAppendResultDTO {
|
|
7
|
+
appended: boolean;
|
|
8
|
+
}
|
|
9
|
+
/** `PUT /v1/nodes/{id}/records/telemetry` body. A null gauge or activity keeps the recorded value. */
|
|
10
|
+
export interface NodeTelemetryRecordRequest {
|
|
11
|
+
tokens_in: number;
|
|
12
|
+
tokens_out: number;
|
|
13
|
+
model: string;
|
|
14
|
+
context_tokens: number | null;
|
|
15
|
+
last_activity: string | null;
|
|
16
|
+
updated_at: string;
|
|
17
|
+
expected_execution_id: string;
|
|
18
|
+
}
|
|
19
|
+
/** `PUT /v1/nodes/{id}/records/recap` body. */
|
|
20
|
+
export interface NodeRecapRecordRequest {
|
|
21
|
+
briefing: string;
|
|
22
|
+
expected_execution_id: string;
|
|
23
|
+
}
|
|
24
|
+
/** `GET /v1/nodes/{id}/records/passive?ref=` result: a spilled direct-message body. */
|
|
25
|
+
export interface NodeMessageBodyDTO {
|
|
26
|
+
content: string;
|
|
27
|
+
}
|
|
28
|
+
/** `POST /v1/nodes/{id}/records/pushed-final` body. */
|
|
29
|
+
export interface NodePushedFinalRequest {
|
|
30
|
+
action: 'mark' | 'clear' | 'consume';
|
|
31
|
+
expected_execution_id: string;
|
|
32
|
+
}
|
|
33
|
+
export interface NodePushedFinalResultDTO {
|
|
34
|
+
pushedFinal: boolean;
|
|
35
|
+
}
|