@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,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
|
+
}
|
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
import type { Cursor, ExitIntentDTO, IsoTime, LifecycleDTO, ModeDTO, NodeIdDTO, NodeStatusDTO, TerminalReasonDTO } from './common.js';
|
|
2
|
+
import type { ReportDTO } from './reports.js';
|
|
3
|
+
import type { NodeOutcomeDTO, NodeOutcomeSummaryDTO, RegisterOutcomeDeliveryRequest } from './node-outcomes.js';
|
|
4
|
+
import type { FaultLink, FaultKind, FaultRetry, FaultProviderError } from './recovery.js';
|
|
5
|
+
/** `GET /v1/nodes/{id}/subject` — the node-config subject substrate gate
|
|
6
|
+
* predicates evaluate against. Mirrors `NodeConfigSubject`; this narrow
|
|
7
|
+
* endpoint exists so a CLI process (a `crtr canvas read` of a document) can
|
|
8
|
+
* gate-check its delivery rules without reaching canvas state. */
|
|
9
|
+
export interface NodeSubjectDTO {
|
|
10
|
+
kind: string;
|
|
11
|
+
mode: ModeDTO;
|
|
12
|
+
lifecycle: LifecycleDTO;
|
|
13
|
+
hasManager: boolean;
|
|
14
|
+
cwd: string;
|
|
15
|
+
scope: 'user' | 'project';
|
|
16
|
+
orchestration: {
|
|
17
|
+
depth: number;
|
|
18
|
+
};
|
|
19
|
+
profile: string | null;
|
|
20
|
+
/** Effective run scopes; a null row resolves to the full runtime vocabulary. */
|
|
21
|
+
scopes: readonly string[];
|
|
22
|
+
/** Handles of the repos enclosing `cwd`, nearest first. */
|
|
23
|
+
repo: readonly string[];
|
|
24
|
+
}
|
|
25
|
+
/** `POST /v1/nodes` body. Carries the full immediate spawn recipe. */
|
|
26
|
+
export interface CreateNodeRequest {
|
|
27
|
+
/** Persona kind. Omit to resolve the selected profile's `default_kind`, then `general`. */
|
|
28
|
+
kind?: string;
|
|
29
|
+
prompt?: string;
|
|
30
|
+
profile?: string;
|
|
31
|
+
mode?: ModeDTO;
|
|
32
|
+
/** The directory the create came from. It is what the daemon selects a
|
|
33
|
+
* profile from when the request neither names one nor inherits one from a
|
|
34
|
+
* parent, and — for a node with no `pin_cwd` and no spawner to inherit from —
|
|
35
|
+
* where the node lands. */
|
|
36
|
+
cwd?: string;
|
|
37
|
+
/** Pin the node to this exact directory, overriding both the spawner's
|
|
38
|
+
* directory and the launch cwd. See `crtr node new --cwd`. */
|
|
39
|
+
pin_cwd?: string;
|
|
40
|
+
/** Display name (tmux window + resume picker). Defaults to the kind. */
|
|
41
|
+
name?: string;
|
|
42
|
+
/** Caller-supplied short description, preserved against automatic naming. */
|
|
43
|
+
description?: string;
|
|
44
|
+
parent?: NodeIdDTO | null;
|
|
45
|
+
/** Node that created this request; absent for an external process. */
|
|
46
|
+
creator?: NodeIdDTO;
|
|
47
|
+
/** Per-run allow-list. Absent inherits everything. Some scopes are recorded but not enforced in beta: llm, files:<dir>, net, provider groups, and peers. */
|
|
48
|
+
scopes?: string[];
|
|
49
|
+
/** Sticky isolation; a child cannot turn off an isolated run. */
|
|
50
|
+
isolated?: boolean;
|
|
51
|
+
root?: boolean;
|
|
52
|
+
/** Lifecycle of the new node. Roots default to `resident`; managed children
|
|
53
|
+
* default to `terminal`. Use `resident` for a child that remains wakeable
|
|
54
|
+
* without owing a final, or `terminal` for a bounded worker that must
|
|
55
|
+
* finalize. */
|
|
56
|
+
root_lifecycle?: LifecycleDTO;
|
|
57
|
+
/** Worktree branch name, or true for an auto-named managed worktree. */
|
|
58
|
+
worktree?: string | boolean;
|
|
59
|
+
fork_from?: string;
|
|
60
|
+
model?: string;
|
|
61
|
+
situational_context?: string;
|
|
62
|
+
no_kickoff?: boolean;
|
|
63
|
+
output_schema?: string;
|
|
64
|
+
/** Wall-clock bound from spawn, e.g. "45m", "2h", "1h30m". Expiry cancels the node and synthesizes a failure outcome with reason 'deadline_exceeded'. */
|
|
65
|
+
deadline?: string;
|
|
66
|
+
/** Arm outcome delivery atomically with node birth. */
|
|
67
|
+
outcome_delivery?: RegisterOutcomeDeliveryRequest;
|
|
68
|
+
/** Spawn AT this exact node id instead of a runtime-minted one — format-
|
|
69
|
+
* validated and duplicate-rejected server-side (`NodeIdConflictError` →
|
|
70
|
+
* HTTP 409 `node_id_exists`). See `crtr node new --node-id`. */
|
|
71
|
+
node_id?: string;
|
|
72
|
+
/** Serve this create from the warm pool when a pre-booted spare matches the
|
|
73
|
+
* request's frozen launch tuple (kind, mode, resolved cwd, profile, model,
|
|
74
|
+
* situational_context) — answering in milliseconds instead of waiting out a
|
|
75
|
+
* full engine boot. Only a bare root with no kickoff qualifies; anything the
|
|
76
|
+
* pool cannot honor (or an empty pool) falls back to an ordinary cold spawn,
|
|
77
|
+
* so the flag never fails a create, it only ever makes it faster. */
|
|
78
|
+
prefer_warm?: boolean;
|
|
79
|
+
}
|
|
80
|
+
/** The list/queryable projection of a node — the indexed row columns. */
|
|
81
|
+
export interface NodeSummaryDTO {
|
|
82
|
+
node_id: NodeIdDTO;
|
|
83
|
+
name: string;
|
|
84
|
+
/** Generated first-task description, absent when the node is not yet named.
|
|
85
|
+
* Paired with `name` it forms the full display label, so a roster consumer
|
|
86
|
+
* builds it without a per-node metadata fetch. */
|
|
87
|
+
description?: string;
|
|
88
|
+
/** How many times the node has been (re)launched; absent on a pre-v38 row. */
|
|
89
|
+
cycles?: number;
|
|
90
|
+
kind: string;
|
|
91
|
+
mode: ModeDTO;
|
|
92
|
+
lifecycle: LifecycleDTO;
|
|
93
|
+
status: NodeStatusDTO;
|
|
94
|
+
cwd: string;
|
|
95
|
+
host_kind: 'tmux' | 'broker' | null;
|
|
96
|
+
profile_id: string | null;
|
|
97
|
+
/** Per-run allow-list; null inherits everything. */
|
|
98
|
+
scopes: string[] | null;
|
|
99
|
+
isolated: boolean;
|
|
100
|
+
/** App that owns this node's agent folder. */
|
|
101
|
+
grantee: string;
|
|
102
|
+
/** Whether the node's profile is currently paused. */
|
|
103
|
+
profile_paused: boolean;
|
|
104
|
+
parent: NodeIdDTO | null;
|
|
105
|
+
created: IsoTime;
|
|
106
|
+
intent: ExitIntentDTO;
|
|
107
|
+
waiting_for: NodeIdDTO | null;
|
|
108
|
+
frozen_at: IsoTime | null;
|
|
109
|
+
terminal_reason: TerminalReasonDTO | null;
|
|
110
|
+
pi_pid: number | null;
|
|
111
|
+
/** Launch-time process identity paired with `pi_pid`, or null when absent. */
|
|
112
|
+
pi_pid_identity: string | null;
|
|
113
|
+
/** Current tmux placement cache. Local tmux callers re-check the pane itself before acting. */
|
|
114
|
+
window: string | null;
|
|
115
|
+
tmux_session: string | null;
|
|
116
|
+
pane: string | null;
|
|
117
|
+
/** Basename of the canonical final report, or null when this node has not finalized. */
|
|
118
|
+
final_report: string | null;
|
|
119
|
+
finalized_at: IsoTime | null;
|
|
120
|
+
deadline_at: IsoTime | null;
|
|
121
|
+
/** Cumulative input tokens reported by the broker telemetry producer. */
|
|
122
|
+
telemetry_tokens_in?: number | null;
|
|
123
|
+
/** Latest context-window token gauge reported by the broker. */
|
|
124
|
+
telemetry_context_tokens?: number | null;
|
|
125
|
+
/** Latest tool summary reported by the broker. */
|
|
126
|
+
telemetry_last_activity?: string | null;
|
|
127
|
+
/** Timestamp of the latest broker telemetry update. */
|
|
128
|
+
telemetry_updated_at?: IsoTime | null;
|
|
129
|
+
outcome: NodeOutcomeSummaryDTO | null;
|
|
130
|
+
fault?: NodeFaultDTO | null;
|
|
131
|
+
streaming?: boolean;
|
|
132
|
+
/** Present only when requested with `include=activity`. */
|
|
133
|
+
activity?: NodeActivityDTO;
|
|
134
|
+
}
|
|
135
|
+
/** Optional per-node activity payload for a list response. Reports are the
|
|
136
|
+
* stored push entries, newest first; `final_report` follows the row's canonical
|
|
137
|
+
* final-report basename rather than merely selecting the newest final-tier file. */
|
|
138
|
+
export interface NodeActivityDTO {
|
|
139
|
+
latest_report: ReportDTO | null;
|
|
140
|
+
final_report: ReportDTO | null;
|
|
141
|
+
pending_human_count: number;
|
|
142
|
+
}
|
|
143
|
+
/** The spine + subscription edges of a node (absorbs `managers`/`paths` reads). */
|
|
144
|
+
export interface NodeEdgesDTO {
|
|
145
|
+
/** Spine parent (my manager); null for a root. */
|
|
146
|
+
parent: NodeIdDTO | null;
|
|
147
|
+
/** Provenance — who spawned me. */
|
|
148
|
+
spawned_by: NodeIdDTO | null;
|
|
149
|
+
/** Publishers I subscribe to. */
|
|
150
|
+
subscribes_to: NodeIdDTO[];
|
|
151
|
+
/** Subscribers to my output (my managers). */
|
|
152
|
+
subscribers: NodeIdDTO[];
|
|
153
|
+
/** Children I spawned. */
|
|
154
|
+
children: NodeIdDTO[];
|
|
155
|
+
}
|
|
156
|
+
/** Absolute filesystem paths for a node (absorbs the `paths` read). */
|
|
157
|
+
export interface NodePathsDTO {
|
|
158
|
+
node_dir: string;
|
|
159
|
+
context_dir: string;
|
|
160
|
+
meta_path: string;
|
|
161
|
+
transcript_path: string;
|
|
162
|
+
view_socket: string;
|
|
163
|
+
}
|
|
164
|
+
/** A node's managed git worktree, if any. */
|
|
165
|
+
export interface NodeWorktreeDTO {
|
|
166
|
+
state: 'open' | 'closed' | 'abandoned';
|
|
167
|
+
/** Pending cleanup must be run manually after the owner exits. */
|
|
168
|
+
cleanup?: 'pending' | 'complete';
|
|
169
|
+
path: string;
|
|
170
|
+
branch: string;
|
|
171
|
+
repo_root: string;
|
|
172
|
+
base_ref: string;
|
|
173
|
+
base_sha: string;
|
|
174
|
+
created: IsoTime;
|
|
175
|
+
closed?: IsoTime;
|
|
176
|
+
abandoned?: {
|
|
177
|
+
branch: string;
|
|
178
|
+
tip_sha: string;
|
|
179
|
+
at: IsoTime;
|
|
180
|
+
by: string;
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
/** Immutable companion provenance and fork coordinates. Present only on a
|
|
184
|
+
* daemon-spawned companion node: a `review/companion` node for a human review
|
|
185
|
+
* (`kind` absent or `review`), or — for a page ticket's feedback conversation
|
|
186
|
+
* (`kind: 'page_feedback'`, review_id = ticket id, target_file = the page
|
|
187
|
+
* source) — a fork of the sending node itself, spawned with its kind. */
|
|
188
|
+
export interface NodeReviewBindingDTO {
|
|
189
|
+
kind?: 'review' | 'page_feedback';
|
|
190
|
+
review_id: string;
|
|
191
|
+
origin_node_id: string;
|
|
192
|
+
branch_file: string;
|
|
193
|
+
target_file: string;
|
|
194
|
+
}
|
|
195
|
+
/** The active fault projection shown by node inspection. */
|
|
196
|
+
export interface NodeFaultDTO {
|
|
197
|
+
link: FaultLink;
|
|
198
|
+
op: string;
|
|
199
|
+
kind: FaultKind;
|
|
200
|
+
retry: FaultRetry;
|
|
201
|
+
message: string;
|
|
202
|
+
since: IsoTime;
|
|
203
|
+
operation_id: string;
|
|
204
|
+
anchorEntryId?: string;
|
|
205
|
+
providerError?: FaultProviderError;
|
|
206
|
+
}
|
|
207
|
+
/** The full node view — summary ∪ identity extras ∪ edges ∪ paths. Returned by
|
|
208
|
+
* `GET /v1/nodes/{id}` and by the create/lifecycle actions that yield a node. */
|
|
209
|
+
export interface NodeDetailDTO extends Omit<NodeSummaryDTO, 'outcome'> {
|
|
210
|
+
outcome: NodeOutcomeDTO | null;
|
|
211
|
+
/** Node that created this node, or null when an external process did. */
|
|
212
|
+
creator: NodeIdDTO | null;
|
|
213
|
+
/** The namer's prose form of `description` — sentence case, punctuation intact
|
|
214
|
+
* (`NodeMeta.title`). What a surface showing this node to a person reads;
|
|
215
|
+
* absent on a node named before titles existed. */
|
|
216
|
+
title?: string;
|
|
217
|
+
/** The Nerd Font glyph the namer chose for this node's work, when it has one
|
|
218
|
+
* (`NodeMeta.icon`). Rendered ahead of the label by surfaces that want it. */
|
|
219
|
+
icon?: string;
|
|
220
|
+
/** Approximate context-window token load of the node's live/last session,
|
|
221
|
+
* used by the orchestrator yield-nudge (`childFollowUp`). Null when unknown
|
|
222
|
+
* (never launched, or no token accounting yet). */
|
|
223
|
+
context_tokens?: number | null;
|
|
224
|
+
pi_session_id?: string | null;
|
|
225
|
+
/** The node's durable model override (`NodeMeta.model_override`), or null when
|
|
226
|
+
* it runs on the kind/profile default. Surfaced so `node config --model`
|
|
227
|
+
* can report the resolved model after a patch. */
|
|
228
|
+
model_override?: string | null;
|
|
229
|
+
/** Absolute path to pi's session `.jsonl`, captured at session_start
|
|
230
|
+
* (`NodeMeta.pi_session_file`). Distinct from `paths.transcript_path` (the
|
|
231
|
+
* crtr-owned transcript mirror). Used to resume or fork the node's pi session
|
|
232
|
+
* and shown by the Inspector. */
|
|
233
|
+
pi_session_file?: string | null;
|
|
234
|
+
/** Immutable review-companion provenance — present only on nodes of kind
|
|
235
|
+
* `review/companion`. Four fields capture the invocation-time fork
|
|
236
|
+
* coordinates without duplicating the full review record. */
|
|
237
|
+
review_binding?: NodeReviewBindingDTO | null;
|
|
238
|
+
edges: NodeEdgesDTO;
|
|
239
|
+
paths: NodePathsDTO;
|
|
240
|
+
worktree?: NodeWorktreeDTO | null;
|
|
241
|
+
/** Present only on a `POST /promote` response — the roadmap/goal facts the
|
|
242
|
+
* promote primitive returns beyond the node meta (spec §6.2). A plain detail
|
|
243
|
+
* read omits them. */
|
|
244
|
+
roadmap_written?: boolean;
|
|
245
|
+
/** The node's roadmap document ref (`<node>/roadmap`). */
|
|
246
|
+
roadmap_ref?: string;
|
|
247
|
+
goal_path?: string;
|
|
248
|
+
}
|
|
249
|
+
/** `GET /v1/nodes` optional payloads. */
|
|
250
|
+
export type NodeListInclude = 'activity';
|
|
251
|
+
/** `GET /v1/nodes` query filters. Filters compose; `parent` selects direct
|
|
252
|
+
* children while `under` selects a whole subtree. */
|
|
253
|
+
export interface ListNodesQuery {
|
|
254
|
+
status?: NodeStatusDTO;
|
|
255
|
+
lifecycle?: LifecycleDTO;
|
|
256
|
+
kind?: string;
|
|
257
|
+
mode?: ModeDTO;
|
|
258
|
+
/** Exact profile id. */
|
|
259
|
+
profile_id?: string;
|
|
260
|
+
/** Profile-id prefix, for callers that own a namespaced profile family. */
|
|
261
|
+
profile_prefix?: string;
|
|
262
|
+
/** Restrict to direct children of this node. Mutually exclusive with `top_level`. */
|
|
263
|
+
parent?: NodeIdDTO;
|
|
264
|
+
/** Restrict to nodes without a parent. */
|
|
265
|
+
top_level?: boolean;
|
|
266
|
+
/** Restrict to the subtree under this node. */
|
|
267
|
+
under?: NodeIdDTO;
|
|
268
|
+
/** Only nodes with a dangling/hanging manager edge. */
|
|
269
|
+
hanging?: boolean;
|
|
270
|
+
/** Opt into richer per-node payloads that require filesystem reads. */
|
|
271
|
+
include?: NodeListInclude;
|
|
272
|
+
}
|
|
273
|
+
/** `GET /v1/nodes/{id}/snapshot` — the node's reconstructed broker snapshot
|
|
274
|
+
* (`readNodeSnapshot`): the message log, aggregate stats, and current engine
|
|
275
|
+
* state, plus the node's registered command set. */
|
|
276
|
+
export interface NodeSnapshotDTO {
|
|
277
|
+
node_id: NodeIdDTO;
|
|
278
|
+
snapshot: {
|
|
279
|
+
messages: unknown[];
|
|
280
|
+
messageIds?: string[];
|
|
281
|
+
messageVisibility: Array<'visible' | 'internal'>;
|
|
282
|
+
turnVisibility: 'visible' | 'internal';
|
|
283
|
+
stats: unknown;
|
|
284
|
+
state: Record<string, unknown>;
|
|
285
|
+
display: {
|
|
286
|
+
statuses: Record<string, string>;
|
|
287
|
+
widgets: Record<string, {
|
|
288
|
+
lines: string[];
|
|
289
|
+
placement: 'aboveEditor' | 'belowEditor';
|
|
290
|
+
}>;
|
|
291
|
+
title?: string;
|
|
292
|
+
};
|
|
293
|
+
queued?: {
|
|
294
|
+
steering: string[];
|
|
295
|
+
followUp: string[];
|
|
296
|
+
};
|
|
297
|
+
toolGroupSummaries?: Record<string, unknown>;
|
|
298
|
+
workingActivity?: string;
|
|
299
|
+
};
|
|
300
|
+
commands: {
|
|
301
|
+
name: string;
|
|
302
|
+
description: string;
|
|
303
|
+
source: string;
|
|
304
|
+
}[];
|
|
305
|
+
captured_at: IsoTime;
|
|
306
|
+
}
|
|
307
|
+
/** `GET /v1/nodes/{id}/messages` query. `cursor` walks backward from the
|
|
308
|
+
* newest messages; each returned page remains chronological. */
|
|
309
|
+
export interface NodeMessagesQuery {
|
|
310
|
+
cursor?: Cursor;
|
|
311
|
+
limit?: number;
|
|
312
|
+
}
|
|
313
|
+
/** `GET /v1/nodes/{id}/messages` — a backward-paged window over the node's
|
|
314
|
+
* cycle-flattened visible history. */
|
|
315
|
+
export interface NodeMessagesPageDTO {
|
|
316
|
+
node_id: NodeIdDTO;
|
|
317
|
+
/** pi AgentMessage[] JSON, chronological ascending within this page. */
|
|
318
|
+
messages: unknown[];
|
|
319
|
+
/** Stable session-entry ids aligned 1:1 with `messages`. */
|
|
320
|
+
message_ids?: string[];
|
|
321
|
+
/** Presentation visibility aligned 1:1 with `messages`. */
|
|
322
|
+
message_visibility: Array<'visible' | 'internal'>;
|
|
323
|
+
/** Opaque cursor toward older messages; null at the start of the session. */
|
|
324
|
+
next_cursor: Cursor | null;
|
|
325
|
+
captured_at: IsoTime;
|
|
326
|
+
}
|
|
327
|
+
/** `GET /v1/nodes/{id}/session` — the node's conversation exactly as it ran:
|
|
328
|
+
* the raw session `.jsonl` bytes plus the assembled system prompt. Unlike
|
|
329
|
+
* `NodeSnapshotDTO` nothing is reconstructed or flattened, so every
|
|
330
|
+
* session-tree entry, cycle, branch, and custom message role survives. This is
|
|
331
|
+
* what an export/download wants; `/snapshot` is what a renderer wants. */
|
|
332
|
+
export interface NodeSessionDTO {
|
|
333
|
+
node_id: NodeIdDTO;
|
|
334
|
+
/** Absolute path (inside the node's host) of the file the bytes came from. */
|
|
335
|
+
session_file: string;
|
|
336
|
+
/** Verbatim `.jsonl` contents. */
|
|
337
|
+
session_jsonl: string;
|
|
338
|
+
/** Assembled system prompt as last captured, or `null` if never written. */
|
|
339
|
+
system_prompt: string | null;
|
|
340
|
+
captured_at: IsoTime;
|
|
341
|
+
}
|
|
342
|
+
/** `GET /v1/nodes/{id}/transcript` query. */
|
|
343
|
+
export interface TranscriptQuery {
|
|
344
|
+
limit?: number;
|
|
345
|
+
cursor?: Cursor;
|
|
346
|
+
}
|
|
347
|
+
/** `GET /v1/nodes/{id}/transcript` result. The reader (`transcriptMarkdown`)
|
|
348
|
+
* renders the whole conversation as a single markdown document. */
|
|
349
|
+
export interface TranscriptDTO {
|
|
350
|
+
node_id: NodeIdDTO;
|
|
351
|
+
markdown: string;
|
|
352
|
+
}
|
|
353
|
+
/** One context root visible to a node — its own dir plus each publisher it
|
|
354
|
+
* subscribes to (the shared-document roster). */
|
|
355
|
+
export interface ContextRootDTO {
|
|
356
|
+
node_id: NodeIdDTO;
|
|
357
|
+
label: string;
|
|
358
|
+
dir: string;
|
|
359
|
+
/** True for the node's own context root. */
|
|
360
|
+
self: boolean;
|
|
361
|
+
/** Count of context files plus report documents for the root. */
|
|
362
|
+
files: number;
|
|
363
|
+
}
|
|
364
|
+
/** `GET /v1/nodes/{id}/context` result (the listing; the nvim popup stays local). */
|
|
365
|
+
export interface ContextListDTO {
|
|
366
|
+
node_id: NodeIdDTO;
|
|
367
|
+
roots: ContextRootDTO[];
|
|
368
|
+
}
|