@crouter/api 0.3.377
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/README.md +67 -0
- package/dist/api/__tests__/error-codes.test.d.ts +1 -0
- package/dist/api/__tests__/error-codes.test.js +78 -0
- package/dist/api/__tests__/integration/client.test.d.ts +1 -0
- package/dist/api/__tests__/integration/client.test.js +179 -0
- package/dist/api/client.d.ts +467 -0
- package/dist/api/client.js +1179 -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 +36 -0
- package/dist/api/dto/config.js +3 -0
- package/dist/api/dto/crons.d.ts +150 -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 +14 -0
- package/dist/api/dto/grants.js +1 -0
- package/dist/api/dto/health.d.ts +106 -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/mail.d.ts +44 -0
- package/dist/api/dto/mail.js +1 -0
- package/dist/api/dto/messages.d.ts +88 -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 +368 -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 +93 -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 +293 -0
- package/dist/api/dto/run-events.js +6 -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 +254 -0
- package/dist/api/error-codes.js +54 -0
- package/dist/api/errors.d.ts +47 -0
- package/dist/api/errors.js +66 -0
- package/dist/api/index.d.ts +42 -0
- package/dist/api/index.js +41 -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 +160 -0
- package/dist/api/routes.js +193 -0
- package/dist/shared/generated-context.d.ts +79 -0
- package/dist/shared/generated-context.js +232 -0
- package/dist/shared/predicates.d.ts +2 -0
- package/dist/shared/predicates.js +4 -0
- package/package.json +49 -0
|
@@ -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,14 @@
|
|
|
1
|
+
export interface GrantGetDTO {
|
|
2
|
+
sub: string;
|
|
3
|
+
grantee: string;
|
|
4
|
+
client_id: string;
|
|
5
|
+
grant: string;
|
|
6
|
+
exp: number;
|
|
7
|
+
rev: number;
|
|
8
|
+
resolved_scopes: {
|
|
9
|
+
scope: string;
|
|
10
|
+
mode: 'always' | 'ask';
|
|
11
|
+
}[];
|
|
12
|
+
spend_cap: number | null;
|
|
13
|
+
payer: 'user';
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,106 @@
|
|
|
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
|
+
/** `POST /v1/daemon/restart` — the ack for a daemon-owned handover.
|
|
37
|
+
*
|
|
38
|
+
* The daemon answers BEFORE it tears anything down: the caller is normally a
|
|
39
|
+
* node's own bash tool, whose broker this handover will kill, so the ack must
|
|
40
|
+
* be a settled tool result in that node's transcript before the SIGTERM lands.
|
|
41
|
+
* `accepted` is therefore a promise about the future, not a completed action —
|
|
42
|
+
* the successor daemon is spawned after `grace_ms`, and every node the
|
|
43
|
+
* teardown interrupts is resumed by it. */
|
|
44
|
+
export interface MigrateStateRequest {
|
|
45
|
+
dry_run?: boolean;
|
|
46
|
+
}
|
|
47
|
+
/** `crtr sys migrate`: the canvas import (004-canvas-documents) plan or result. */
|
|
48
|
+
export interface MigrateStateDTO {
|
|
49
|
+
/** Loose-key moves/imports (paths and names only). */
|
|
50
|
+
loose_keys?: string[];
|
|
51
|
+
/** Every store root the import found, with its owner and document count. */
|
|
52
|
+
stores: {
|
|
53
|
+
root: string;
|
|
54
|
+
owner: Record<string, unknown>;
|
|
55
|
+
docs: number;
|
|
56
|
+
skipped?: string;
|
|
57
|
+
}[];
|
|
58
|
+
/** `documents.<kind>`, `documents.owner.<type>`, `revisions`, `documents.rewritten`, `owners`, … */
|
|
59
|
+
counts: Record<string, number>;
|
|
60
|
+
rewrites: {
|
|
61
|
+
path: string;
|
|
62
|
+
from: string;
|
|
63
|
+
to: string;
|
|
64
|
+
}[];
|
|
65
|
+
dropped_fields: {
|
|
66
|
+
path: string;
|
|
67
|
+
field: string;
|
|
68
|
+
}[];
|
|
69
|
+
skipped: {
|
|
70
|
+
path: string;
|
|
71
|
+
reason: string;
|
|
72
|
+
}[];
|
|
73
|
+
/** Each clash or unreadable source the import resolved itself, one line each. */
|
|
74
|
+
resolutions: {
|
|
75
|
+
kind: string;
|
|
76
|
+
message: string;
|
|
77
|
+
paths: string[];
|
|
78
|
+
}[];
|
|
79
|
+
blockers: {
|
|
80
|
+
kind: string;
|
|
81
|
+
message: string;
|
|
82
|
+
paths: string[];
|
|
83
|
+
}[];
|
|
84
|
+
dryRun: boolean;
|
|
85
|
+
/** True while the import has not been written. */
|
|
86
|
+
pending: boolean;
|
|
87
|
+
resumed: boolean;
|
|
88
|
+
resume_error?: string;
|
|
89
|
+
}
|
|
90
|
+
/** `POST /v1/daemon/admit` — opens normal daemon work after preparation. */
|
|
91
|
+
export interface DaemonAdmitDTO {
|
|
92
|
+
/** True only for the request that began admission. */
|
|
93
|
+
admitted: boolean;
|
|
94
|
+
/** True when another request had already begun or completed admission. */
|
|
95
|
+
already_admitted: boolean;
|
|
96
|
+
startup_phase: StartupPhaseDTO;
|
|
97
|
+
}
|
|
98
|
+
export interface DaemonRestartDTO {
|
|
99
|
+
accepted: boolean;
|
|
100
|
+
/** The daemon that took the request and is about to hand over. */
|
|
101
|
+
predecessor_pid: number;
|
|
102
|
+
/** Its epoch id — the successor mints a new one. */
|
|
103
|
+
predecessor_epoch: string;
|
|
104
|
+
/** How long the daemon waits after answering before teardown begins. */
|
|
105
|
+
grace_ms: number;
|
|
106
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import type { IsoTime } from './common.js';
|
|
2
|
+
import type { InboxPageDTO, PageResponsesDTO, TicketSourceDTO } from './inbox.js';
|
|
3
|
+
/** Daemon-minted request identity. Inbox presentation has a separate opaque ticket id. */
|
|
4
|
+
export type HumanRequestIdDTO = string;
|
|
5
|
+
/** The complete authored page text, inline — never a path. */
|
|
6
|
+
export interface HumanRequestPageDTO {
|
|
7
|
+
dialect: 'jsx' | 'html';
|
|
8
|
+
source: string;
|
|
9
|
+
}
|
|
10
|
+
export interface HumanRequestDeliveryDTO {
|
|
11
|
+
placement: 'inline' | 'panel';
|
|
12
|
+
inbox: boolean;
|
|
13
|
+
reply: boolean;
|
|
14
|
+
}
|
|
15
|
+
/** Frozen at creation: the action name and its opaque payload. An omitted
|
|
16
|
+
* `payload` is frozen as JSON null, so the completion document always carries it. */
|
|
17
|
+
export interface HumanRequestActionDTO {
|
|
18
|
+
name: string;
|
|
19
|
+
payload?: unknown;
|
|
20
|
+
}
|
|
21
|
+
export interface CreateHumanRequestRequest {
|
|
22
|
+
page: HumanRequestPageDTO;
|
|
23
|
+
delivery?: HumanRequestDeliveryDTO;
|
|
24
|
+
source?: TicketSourceDTO;
|
|
25
|
+
/** The one node that receives the terminal result. Required for reply-bearing pages. */
|
|
26
|
+
requester_node_id?: string | null;
|
|
27
|
+
creator_cwd: string;
|
|
28
|
+
action?: HumanRequestActionDTO;
|
|
29
|
+
}
|
|
30
|
+
export type HumanRequestState = 'pending' | 'answered' | 'dismissed' | 'canceled';
|
|
31
|
+
export type HumanRequestDeliveryState = 'none' | 'pending' | 'running' | 'accepted' | 'permanent_failed';
|
|
32
|
+
export interface CreateHumanRequestDTO {
|
|
33
|
+
request_id: HumanRequestIdDTO;
|
|
34
|
+
/** Daemon-owned directory where the request's rendered page is projected. */
|
|
35
|
+
request_dir: string;
|
|
36
|
+
state: 'pending';
|
|
37
|
+
/** Omitted entirely when the request carries no action binding. */
|
|
38
|
+
action?: {
|
|
39
|
+
name: string;
|
|
40
|
+
};
|
|
41
|
+
delivery_state: HumanRequestDeliveryState;
|
|
42
|
+
}
|
|
43
|
+
export interface HumanRequestDeliveryFailureDTO {
|
|
44
|
+
kind: 'exit' | 'signal' | 'timeout' | 'spawn_error';
|
|
45
|
+
exit_code?: number;
|
|
46
|
+
signal?: string;
|
|
47
|
+
message?: string;
|
|
48
|
+
/** A bounded tail, not full output. */
|
|
49
|
+
stderr?: string;
|
|
50
|
+
}
|
|
51
|
+
export interface HumanRequestDeliveryDetailDTO {
|
|
52
|
+
state: HumanRequestDeliveryState;
|
|
53
|
+
/** Attempts started. */
|
|
54
|
+
attempt: number;
|
|
55
|
+
/** Present only while pending after a retryable failure. */
|
|
56
|
+
next_attempt_at?: IsoTime;
|
|
57
|
+
accepted_at?: IsoTime;
|
|
58
|
+
permanent_failed_at?: IsoTime;
|
|
59
|
+
last_failure?: HumanRequestDeliveryFailureDTO;
|
|
60
|
+
}
|
|
61
|
+
export interface HumanRequestDTO {
|
|
62
|
+
request_id: HumanRequestIdDTO;
|
|
63
|
+
/** Opaque inbox identity for inbox-only routes. */
|
|
64
|
+
inbox_ticket_id: string;
|
|
65
|
+
/** Daemon-owned directory where the request's rendered page is projected. */
|
|
66
|
+
request_dir: string;
|
|
67
|
+
kind: 'page' | 'review';
|
|
68
|
+
state: HumanRequestState;
|
|
69
|
+
title: string;
|
|
70
|
+
subtitle?: string;
|
|
71
|
+
source: TicketSourceDTO;
|
|
72
|
+
emitted_at: IsoTime;
|
|
73
|
+
/** Present unless pending. */
|
|
74
|
+
settled_at?: IsoTime;
|
|
75
|
+
/** Present only when `state` is `answered`. */
|
|
76
|
+
responses?: PageResponsesDTO;
|
|
77
|
+
reason?: string;
|
|
78
|
+
actor?: string;
|
|
79
|
+
/** `action` and `delivery` are both omitted when no action is bound. */
|
|
80
|
+
action?: {
|
|
81
|
+
name: string;
|
|
82
|
+
payload: unknown;
|
|
83
|
+
};
|
|
84
|
+
delivery?: HumanRequestDeliveryDetailDTO;
|
|
85
|
+
/** Present exactly when this request is a page. */
|
|
86
|
+
page?: InboxPageDTO;
|
|
87
|
+
}
|
|
88
|
+
export interface ReplaceHumanRequestRequest {
|
|
89
|
+
page: HumanRequestPageDTO;
|
|
90
|
+
delivery?: HumanRequestDeliveryDTO;
|
|
91
|
+
}
|
|
92
|
+
export interface RespondHumanRequestRequest {
|
|
93
|
+
responses: PageResponsesDTO;
|
|
94
|
+
actor?: string;
|
|
95
|
+
}
|
|
96
|
+
export interface SettleHumanRequestRequest {
|
|
97
|
+
reason?: string;
|
|
98
|
+
actor?: string;
|
|
99
|
+
}
|
|
100
|
+
/** One product page component registered by config or an enabled plugin. */
|
|
101
|
+
export interface PageComponentDTO {
|
|
102
|
+
kind: string;
|
|
103
|
+
description?: string;
|
|
104
|
+
useWhen?: string;
|
|
105
|
+
doc?: string;
|
|
106
|
+
/** A display-only product slot contributes no page response. */
|
|
107
|
+
display?: boolean;
|
|
108
|
+
}
|
|
109
|
+
/** `GET /v1/human/components` — the product page components the runtime's
|
|
110
|
+
* config and enabled plugins register, merged in precedence order. */
|
|
111
|
+
export interface PageComponentListDTO {
|
|
112
|
+
components: PageComponentDTO[];
|
|
113
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** One anchored review comment, mirroring crouter's canonical review result. */
|
|
2
|
+
export interface FeedbackCommentDTO {
|
|
3
|
+
id: string;
|
|
4
|
+
line: number;
|
|
5
|
+
endLine: number;
|
|
6
|
+
quote?: string;
|
|
7
|
+
colStart?: number;
|
|
8
|
+
colEnd?: number;
|
|
9
|
+
lineText: string;
|
|
10
|
+
comment: string;
|
|
11
|
+
createdAt: string;
|
|
12
|
+
}
|
|
13
|
+
/** Immutable daemon-projected review approval result. */
|
|
14
|
+
export interface FeedbackResultDTO {
|
|
15
|
+
file: string;
|
|
16
|
+
submitted: true;
|
|
17
|
+
approved: true;
|
|
18
|
+
comments: FeedbackCommentDTO[];
|
|
19
|
+
submittedAt: string;
|
|
20
|
+
savedAt: string;
|
|
21
|
+
reviewId: string;
|
|
22
|
+
changed: boolean;
|
|
23
|
+
baselineSha256: string;
|
|
24
|
+
approvedSha256: string;
|
|
25
|
+
companionNodeId: string;
|
|
26
|
+
commentsTotal: number;
|
|
27
|
+
commentsUnresolved: number;
|
|
28
|
+
}
|