@crouter/api 0.3.387 → 0.3.389

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/dist/api/__tests__/integration/client.test.js +97 -0
  2. package/dist/api/client.d.ts +7 -0
  3. package/dist/api/client.js +40 -21
  4. package/dist/api/dto/config.d.ts +11 -1
  5. package/dist/core/asset-root.d.ts +7 -0
  6. package/dist/core/asset-root.js +18 -0
  7. package/dist/core/canvas/boot-id.d.ts +6 -0
  8. package/dist/core/canvas/boot-id.js +26 -0
  9. package/dist/core/canvas/paths.d.ts +72 -0
  10. package/dist/core/canvas/paths.js +163 -0
  11. package/dist/core/canvas/pid.d.ts +391 -0
  12. package/dist/core/canvas/pid.js +948 -0
  13. package/dist/core/command-plugins/bundle.d.ts +149 -0
  14. package/dist/core/command-plugins/bundle.js +588 -0
  15. package/dist/core/command-plugins/endpoint.d.ts +24 -0
  16. package/dist/core/command-plugins/endpoint.js +51 -0
  17. package/dist/core/config.d.ts +233 -0
  18. package/dist/core/config.js +1120 -0
  19. package/dist/core/env-name.d.ts +6 -0
  20. package/dist/core/env-name.js +9 -0
  21. package/dist/core/errors.d.ts +38 -0
  22. package/dist/core/errors.js +90 -0
  23. package/dist/core/events/emit.d.ts +6 -0
  24. package/dist/core/events/emit.js +42 -0
  25. package/dist/core/events/envelope.d.ts +2 -0
  26. package/dist/core/events/envelope.js +84 -0
  27. package/dist/core/events/errors.d.ts +4 -0
  28. package/dist/core/events/errors.js +69 -0
  29. package/dist/core/events/operation-id.d.ts +4 -0
  30. package/dist/core/events/operation-id.js +24 -0
  31. package/dist/core/events/serialize.d.ts +4 -0
  32. package/dist/core/events/serialize.js +199 -0
  33. package/dist/core/events/source.d.ts +16 -0
  34. package/dist/core/events/source.js +31 -0
  35. package/dist/core/events/types.d.ts +68 -0
  36. package/dist/core/events/types.js +11 -0
  37. package/dist/core/exclusive-lock.d.ts +34 -0
  38. package/dist/core/exclusive-lock.js +197 -0
  39. package/dist/core/fs-utils.d.ts +44 -0
  40. package/dist/core/fs-utils.js +208 -0
  41. package/dist/core/help.d.ts +309 -0
  42. package/dist/core/help.js +406 -0
  43. package/dist/core/human/page-catalog.d.ts +57 -0
  44. package/dist/core/human/page-catalog.js +172 -0
  45. package/dist/core/installed-plugins.d.ts +2 -0
  46. package/dist/core/installed-plugins.js +79 -0
  47. package/dist/core/io.d.ts +122 -0
  48. package/dist/core/io.js +373 -0
  49. package/dist/core/keybindings/attach-control.d.ts +49 -0
  50. package/dist/core/keybindings/attach-control.js +42 -0
  51. package/dist/core/keybindings/catalog.d.ts +18 -0
  52. package/dist/core/keybindings/catalog.js +257 -0
  53. package/dist/core/keybindings/types.d.ts +42 -0
  54. package/dist/core/keybindings/types.js +1 -0
  55. package/dist/core/layout.d.ts +26 -0
  56. package/dist/core/layout.js +94 -0
  57. package/dist/core/locked-file.d.ts +27 -0
  58. package/dist/core/locked-file.js +118 -0
  59. package/dist/core/log.d.ts +9 -0
  60. package/dist/core/log.js +89 -0
  61. package/dist/core/manifest.d.ts +5 -0
  62. package/dist/core/manifest.js +15 -0
  63. package/dist/core/plugin-env.d.ts +8 -0
  64. package/dist/core/plugin-env.js +31 -0
  65. package/dist/core/plugin-extensions.d.ts +29 -0
  66. package/dist/core/plugin-extensions.js +191 -0
  67. package/dist/core/plugin-swap-lock.d.ts +9 -0
  68. package/dist/core/plugin-swap-lock.js +31 -0
  69. package/dist/core/preview-result-path.d.ts +4 -0
  70. package/dist/core/preview-result-path.js +26 -0
  71. package/dist/core/profiles/env-store.d.ts +22 -0
  72. package/dist/core/profiles/env-store.js +163 -0
  73. package/dist/core/profiles/fuzzy-match.d.ts +19 -0
  74. package/dist/core/profiles/fuzzy-match.js +92 -0
  75. package/dist/core/profiles/manifest.d.ts +120 -0
  76. package/dist/core/profiles/manifest.js +529 -0
  77. package/dist/core/rate-limit-scope.d.ts +25 -0
  78. package/dist/core/rate-limit-scope.js +64 -0
  79. package/dist/core/render.d.ts +12 -0
  80. package/dist/core/render.js +138 -0
  81. package/dist/core/resolver.d.ts +14 -0
  82. package/dist/core/resolver.js +111 -0
  83. package/dist/core/runtime/branded-host.d.ts +25 -0
  84. package/dist/core/runtime/branded-host.js +264 -0
  85. package/dist/core/runtime/broker/daemon-ops.d.ts +65 -0
  86. package/dist/core/runtime/broker/daemon-ops.js +177 -0
  87. package/dist/core/runtime/broker/signal-stream.d.ts +30 -0
  88. package/dist/core/runtime/broker/signal-stream.js +149 -0
  89. package/dist/core/scope.d.ts +32 -0
  90. package/dist/core/scope.js +184 -0
  91. package/dist/core/scoped-state/db.d.ts +17 -0
  92. package/dist/core/scoped-state/db.js +247 -0
  93. package/dist/core/scoped-state/migrate.d.ts +8 -0
  94. package/dist/core/scoped-state/migrate.js +187 -0
  95. package/dist/core/scoped-state/paths.d.ts +9 -0
  96. package/dist/core/scoped-state/paths.js +27 -0
  97. package/dist/core/scoped-state/profiles.d.ts +27 -0
  98. package/dist/core/scoped-state/profiles.js +93 -0
  99. package/dist/core/scoped-state/providers.d.ts +24 -0
  100. package/dist/core/scoped-state/providers.js +19 -0
  101. package/dist/core/scoped-state/schema.d.ts +6 -0
  102. package/dist/core/scoped-state/schema.js +43 -0
  103. package/dist/core/scoped-state/settings.d.ts +28 -0
  104. package/dist/core/scoped-state/settings.js +83 -0
  105. package/dist/core/spaces/open-beneath.d.ts +71 -0
  106. package/dist/core/spaces/open-beneath.js +581 -0
  107. package/dist/core/sqlite-statements.d.ts +4 -0
  108. package/dist/core/sqlite-statements.js +17 -0
  109. package/dist/core/subscription-state.d.ts +121 -0
  110. package/dist/core/subscription-state.js +287 -0
  111. package/dist/core/user-settings.d.ts +377 -0
  112. package/dist/core/user-settings.js +458 -0
  113. package/dist/daemon/broker-signals/bus.d.ts +30 -0
  114. package/dist/daemon/broker-signals/bus.js +87 -0
  115. package/dist/daemon/manage.d.ts +176 -0
  116. package/dist/daemon/manage.js +664 -0
  117. package/dist/daemon/pidfile.d.ts +8 -0
  118. package/dist/daemon/pidfile.js +37 -0
  119. package/dist/daemon/startup-policy.d.ts +1 -0
  120. package/dist/daemon/startup-policy.js +1 -0
  121. package/dist/native/linux.d.ts +29 -0
  122. package/dist/native/linux.js +20 -0
  123. package/dist/shared/env.d.ts +116 -0
  124. package/dist/shared/env.js +271 -0
  125. package/dist/shared/inbox-entry-body.d.ts +22 -0
  126. package/dist/shared/inbox-entry-body.js +116 -0
  127. package/dist/shared/working-activity.d.ts +9 -0
  128. package/dist/shared/working-activity.js +27 -0
  129. package/dist/types.d.ts +562 -0
  130. package/dist/types.js +186 -0
  131. package/package.json +1 -1
@@ -0,0 +1,562 @@
1
+ import type { BindingId } from './core/keybindings/catalog.js';
2
+ import type { DeliveryLimits, ProfileProject } from './api/dto/profiles.js';
3
+ import type { ProviderBlock } from './core/command-plugins/bundle.js';
4
+ export type Scope = 'user' | 'project' | 'builtin';
5
+ export declare const ExitCode: {
6
+ readonly SUCCESS: 0;
7
+ readonly GENERAL: 1;
8
+ readonly USAGE: 2;
9
+ readonly NOT_FOUND: 3;
10
+ readonly AMBIGUOUS: 4;
11
+ readonly NETWORK: 5;
12
+ };
13
+ export type ExitCodeValue = (typeof ExitCode)[keyof typeof ExitCode];
14
+ export declare const SCHEMA_VERSION = 4;
15
+ export interface OwnerRef {
16
+ name?: string;
17
+ email?: string;
18
+ }
19
+ export type PluginTransport = {
20
+ kind: 'exec'; /** Required when the validated command manifest has executable leaves. */
21
+ executable?: string;
22
+ } | {
23
+ kind: 'http';
24
+ endpoint: string;
25
+ authEnv?: string;
26
+ };
27
+ /** Provenance for a crouter-materialized HTTP plugin directory archive. */
28
+ export interface PluginBundle {
29
+ endpoint: string;
30
+ authEnv?: string;
31
+ }
32
+ export type MemoryExtensionScalar = string | boolean | number;
33
+ export type MemoryExtensionFieldType = 'boolean' | 'string' | 'number' | 'enum';
34
+ interface MemoryExtensionDeclarationBase {
35
+ write_help: string;
36
+ edit_help: string;
37
+ }
38
+ export interface BooleanMemoryExtensionDeclaration extends MemoryExtensionDeclarationBase {
39
+ type: 'boolean';
40
+ default?: boolean;
41
+ }
42
+ export interface StringMemoryExtensionDeclaration extends MemoryExtensionDeclarationBase {
43
+ type: 'string';
44
+ default?: string;
45
+ }
46
+ export interface NumberMemoryExtensionDeclaration extends MemoryExtensionDeclarationBase {
47
+ type: 'number';
48
+ default?: number;
49
+ }
50
+ export interface EnumMemoryExtensionDeclaration extends MemoryExtensionDeclarationBase {
51
+ type: 'enum';
52
+ values: string[];
53
+ default?: string;
54
+ }
55
+ export type MemoryExtensionDeclaration = BooleanMemoryExtensionDeclaration | StringMemoryExtensionDeclaration | NumberMemoryExtensionDeclaration | EnumMemoryExtensionDeclaration;
56
+ /** Field declarations owned by one plugin manifest. The plugin's `name` is
57
+ * the namespace; keys here are its lowercase kebab-case local field names. */
58
+ export type MemoryExtensionDeclarations = Record<string, MemoryExtensionDeclaration>;
59
+ export interface PluginManifest {
60
+ name: string;
61
+ version?: string;
62
+ description?: string;
63
+ source?: string;
64
+ owner?: OwnerRef;
65
+ /** Kind-registry contributions, keyed by full kind string (top-level e.g.
66
+ * `applet-builder`, or sub-kind e.g. `audit/security`). Each entry
67
+ * is any subset of `KindConfig` fields: it FIELD-MERGES over a kind a lower
68
+ * layer already defines (`whenToUse` included — overriding just the spawn
69
+ * guidance never strips the kind's model tier), and defines a NEW kind when
70
+ * none does (then `whenToUse` is required) — the same rule a scope
71
+ * `config.json` `kinds` block follows.
72
+ * `readMergedLaunchConfig` layers an enabled plugin's entries directly
73
+ * above the builtin registry and below its host scope's own `config.json`,
74
+ * so a plugin can ship a persona kind (registry entry here + gated persona
75
+ * memory docs in its `memory/` tree) and the user still overrides it.
76
+ * Archive plugins declare this in `bundle.json`; the installer copies the
77
+ * validated block into this synthesized manifest. */
78
+ kinds?: Record<string, Partial<KindConfig>>;
79
+ /** Plugin-owned typed metadata declarations for memory document frontmatter.
80
+ * Values live at `extensions.<this manifest name>.<field>`. */
81
+ memory_extensions?: MemoryExtensionDeclarations;
82
+ /** Page-component contributions: the same registration objects a scope
83
+ * `config.json` `page_components` block carries (kind plus its display,
84
+ * description, use guidance, and docs metadata). `resolvePageComponents`
85
+ * reads these from installed, enabled plugin MANIFESTS and concatenates
86
+ * them with the user scope's own entries, so installing or updating a
87
+ * plugin makes its components authorable and removing it retires them.
88
+ * Unlike `kinds` there is no precedence: two sources registering one kind
89
+ * (or one derived JSX tag) is an error, not an override.
90
+ * Archive plugins declare this in `bundle.json`; the installer copies the
91
+ * validated block into this synthesized manifest. */
92
+ page_components?: PageComponentRegistration[];
93
+ /** Plugin-root-relative path to one declarative command manifest
94
+ * (`commands.json`). When present on an installed, enabled plugin, that
95
+ * manifest contributes top-level command branches to the `crtr` tree —
96
+ * crtr owns parse/help/render/errors and direct-spawns the plugin's one
97
+ * executable per leaf invocation. See `src/core/command-plugins/`. */
98
+ commands?: string;
99
+ /** Plugin-root-relative path to a declarative hook manifest (`hooks.json`).
100
+ * Must be declared together with `hookExecutable`; hooks are trusted local
101
+ * code. */
102
+ hooks?: string;
103
+ /** Plugin-root-relative executable that dispatches declarations in `hooks`.
104
+ * Must be a regular file with a POSIX executable permission bit. */
105
+ hookExecutable?: string;
106
+ /** Bare-callable executables this plugin ships, keyed by the bare command
107
+ * name a node's bash sees. Each value is a PLUGIN-ROOT-relative path to a
108
+ * regular executable file when the effective set resolves. These are trusted
109
+ * local code, not `crtr` command leaves: crouter symlinks each name into a
110
+ * shim dir it prepends to every broker child's PATH
111
+ * (`core/runtime/bin-contributions.ts`), so the agent calls
112
+ * `<name> --whatever` like any other program. */
113
+ bin?: Record<string, string>;
114
+ /** Advisory PATH executables this plugin needs, keyed by bare executable
115
+ * name. Each value is a non-empty one-line install hint. crouter never
116
+ * installs these dependencies or disables the plugin when they are absent:
117
+ * install warns, and `sys doctor` reports a `requires:<name>` check against
118
+ * the PATH a node's bash receives. */
119
+ requires?: Record<string, string>;
120
+ /** App-scoped env variables required by this plugin, collected during install. */
121
+ env?: Record<string, import('./core/plugin-env.js').PluginEnvDeclaration>;
122
+ transport?: PluginTransport;
123
+ /** Archive source for a crouter-materialized HTTP plugin. Distinct from the invocation transport. */
124
+ bundle?: PluginBundle;
125
+ /** A capability provider's `bundle.json` `provider` block, copied by the
126
+ * archive installer. Present only on a provider bundle the daemon installs
127
+ * from the directory; the daemon, not `crtr`, refreshes such a plugin. */
128
+ provider?: ProviderBlock;
129
+ }
130
+ export interface MarketplacePluginEntry {
131
+ name: string;
132
+ source: string;
133
+ version?: string;
134
+ description?: string;
135
+ keywords?: string[];
136
+ }
137
+ export interface MarketplaceManifest {
138
+ name: string;
139
+ version?: string;
140
+ owner?: OwnerRef;
141
+ plugins: MarketplacePluginEntry[];
142
+ }
143
+ export interface ConfigMarketplaceEntry {
144
+ url: string;
145
+ ref: string;
146
+ installed_at: string;
147
+ }
148
+ export interface ConfigPluginEntry {
149
+ enabled: boolean;
150
+ source_marketplace?: string;
151
+ version?: string;
152
+ }
153
+ export type AutoUpdateMode = 'notify' | 'apply' | false;
154
+ export interface AutoUpdateConfig {
155
+ crtr: AutoUpdateMode;
156
+ content: AutoUpdateMode;
157
+ interval_hours: number;
158
+ }
159
+ /** Host-wide broker pressure thresholds. These are read only from user scope
160
+ * by crtrd: project configuration must not change another user's daemon. */
161
+ export interface BrokerThresholdsConfig {
162
+ /** Surface a broker-pressure warning once the live broker census reaches this count. */
163
+ warning: number;
164
+ /** Defer daemon-initiated revives once the live broker census reaches this count. */
165
+ automaticReviveCap: number;
166
+ }
167
+ /** Host-wide node-lifecycle timing. Read only from user scope by crtrd, like
168
+ * `brokerThresholds`: project configuration must not change another user's
169
+ * daemon. */
170
+ export interface LifecycleConfig {
171
+ /** How long an eligible resident idles before its unattended-parking turn
172
+ * begins, in milliseconds. `CRTR_UNATTENDED_PARK_MS` overrides this. */
173
+ unattendedParkMs: number;
174
+ }
175
+ export type KeybindingOverrides = Record<string, string[]>;
176
+ /** Compile-time seam for runtime consumers migrating to semantic binding IDs. */
177
+ export type CanvasAction = {
178
+ kind?: 'crtr';
179
+ run: string;
180
+ confirm?: boolean;
181
+ } | {
182
+ kind: 'keys';
183
+ keys: string;
184
+ } | {
185
+ kind: 'menu';
186
+ items: CanvasMenuItem[];
187
+ } | {
188
+ kind: 'popup';
189
+ run: string;
190
+ };
191
+ export interface CanvasMenuItem {
192
+ key: string;
193
+ desc: string;
194
+ action: CanvasAction;
195
+ confirm?: boolean;
196
+ }
197
+ export type ModelStrength = 'ultra' | 'strong' | 'medium' | 'light';
198
+ /** A portable model preference: a provider family at a strength, free to rotate
199
+ * to another family at the same strength. */
200
+ export interface ModelIntent {
201
+ family: string;
202
+ strength: ModelStrength;
203
+ }
204
+ export type ModelProvider = 'anthropic' | 'openai';
205
+ export interface ModelLaddersConfig {
206
+ /** Optional default provider for bare strengths. If unset, runtime falls back
207
+ * to CRTR_MODEL_PROVIDER, then anthropic. */
208
+ defaultProvider?: ModelProvider;
209
+ anthropic: Record<ModelStrength, string>;
210
+ openai: Record<ModelStrength, string>;
211
+ }
212
+ /** A declared provider/model route. Route ids are the keys of `modelRoutes` so
213
+ * scopes can override one route without restating the registry. `credentialSource`
214
+ * orders otherwise-equivalent routes; credentials are selected by `providerId`.
215
+ * Effective routes always name every strength. */
216
+ export interface ModelRouteConfig {
217
+ family: string;
218
+ credentialSource: string;
219
+ providerId: string;
220
+ models: Record<ModelStrength, string>;
221
+ }
222
+ export interface ModelRoutingConfig {
223
+ credentialSourceOrder?: string[];
224
+ familyOrder?: string[];
225
+ strengthFallback?: ModelStrength[];
226
+ }
227
+ /** Per-provider behavior options, keyed by RUNTIME provider id (`openai-codex`,
228
+ * `anthropic`) — not the portable ladder key (`openai`). Merged per provider
229
+ * across scopes like the rest of `ScopeConfig`. */
230
+ export interface ProviderOptionsConfig {
231
+ /** Codex fast mode: ask the ChatGPT backend to serve the turn at its
232
+ * priority tier (~1.5x generation speed, ~2x credit consumption). */
233
+ fastMode?: boolean;
234
+ }
235
+ /** Launch metadata for one kind (a top-level kind like `developer`, or a full
236
+ * sub-kind string like `audit/security`) — the settings-file
237
+ * replacement for per-kind persona frontmatter. `model`/`tools`/`extensions`
238
+ * are launch knobs consumed by `buildLaunchSpec`; `whenToUse` is the
239
+ * one-line gloss shown in `node new -h` / `node promote -h`. `availableTo` is
240
+ * VISIBILITY-ONLY (never launch validation): the list of top-level kind names
241
+ * whose spawn menus surface this sub-kind, `'*'` meaning every kind; omitted
242
+ * defaults to the sub-kind's own top-level ancestor (e.g.
243
+ * `audit/security` defaults to `['audit']`). A direct launch by full kind
244
+ * string is always valid regardless of `availableTo`. */
245
+ export interface KindConfig {
246
+ model?: string;
247
+ /** Model override for ORCHESTRATOR mode only, e.g. a kind whose orchestrator
248
+ * body warrants a stronger model than its base worker. Selection: base mode
249
+ * always uses `model`; orchestrator mode uses `orchestratorModel ?? model`.
250
+ * Omit when the kind runs the same model in both modes. */
251
+ orchestratorModel?: string;
252
+ tools?: string[];
253
+ extensions?: string[];
254
+ whenToUse: string;
255
+ availableTo?: string[];
256
+ }
257
+ export interface PageComponentRegistration {
258
+ kind: string;
259
+ description?: string;
260
+ useWhen?: string;
261
+ doc?: string;
262
+ /** A display-only product slot contributes no page response. */
263
+ display?: boolean;
264
+ }
265
+ export interface HumanActionConfig {
266
+ argv: string[];
267
+ cwd: string;
268
+ }
269
+ /** The normalized product component catalog used to validate page slots. */
270
+ export type ProductPageComponents = readonly PageComponentRegistration[];
271
+ export interface ScopeConfig {
272
+ schema_version: number;
273
+ marketplaces: Record<string, ConfigMarketplaceEntry>;
274
+ plugins: Record<string, ConfigPluginEntry>;
275
+ auto_update: AutoUpdateConfig;
276
+ max_panes_per_window: number;
277
+ /** Open a managed child's viewer beside its parent when that parent has a
278
+ * live tmux viewer. Turning this off leaves every new managed child running
279
+ * as a detached broker until someone focuses or attaches it explicitly.
280
+ * Independent attended roots keep their normal viewer behavior. */
281
+ auto_open_child_viewers: boolean;
282
+ brokerThresholds: BrokerThresholdsConfig;
283
+ /** Host-wide node-lifecycle timing (user scope only). */
284
+ lifecycle: LifecycleConfig;
285
+ /** Ring a short completion sound in the attach viewer when the node you are
286
+ * watching finishes a turn and hands control back (the Claude-Code Stop-hook
287
+ * ding). Only ever fires inside a live viewer pane — a headless/background
288
+ * node with no viewer attached is silent regardless. Default true. */
289
+ completion_bell: boolean;
290
+ /** Gerunds used for the live turn activity label. A new entry is selected at
291
+ * random for each received user message and rendered as, for example,
292
+ * `Thinking...`. Missing configuration uses the built-in rotation; malformed
293
+ * or empty lists fall back to `['working']`. */
294
+ working_gerunds: string[];
295
+ /** Play the whip header animation whenever the human sends a prompt, and once
296
+ * when a viewer opens for an agent with an initial prompt. Default false. */
297
+ whip_mode: boolean;
298
+ /** Product-registered page components beyond crtr's built-in catalog. */
299
+ page_components: PageComponentRegistration[];
300
+ /** Prompt agents to use JSX pages by default for structured or interactive human content. Default false. */
301
+ page_surface: boolean;
302
+ /** Playful urgency messages the attach-viewer whip action sends to an agent. Missing, malformed, or empty lists fall back to the built-in rotation. */
303
+ whip_messages: string[];
304
+ /** What the whip action says. `random` (default) draws a line from
305
+ * `whip_messages`; `go-faster` sends the fixed `Go faster` instead. The
306
+ * action, its interrupt, and its animation are identical either way. */
307
+ whip_message_mode: WhipMessageMode;
308
+ /** Initial mouse wheel scrolling mode for each attach viewer. `tmux` follows
309
+ * tmux's current mouse option; `on` and `off` are explicit. Default `tmux`. */
310
+ mouse_mode_default: MouseModeDefault;
311
+ /** How many trailing refresh-yield CYCLES the attach viewer renders at full
312
+ * fidelity. Older cycles are condensed to cycle dividers plus whatever
313
+ * `condensed_history` admits. No tool components are built for them, while
314
+ * retained prose re-wraps when the pane width changes. Tool calls and results
315
+ * measure ~63% of a transcript's rendered lines and ~69% of its build time,
316
+ * so excluding them is the dominant attach-time saving for a long multi-cycle
317
+ * node. Full detail for every cycle stays in the session file. Minimum 1 (the
318
+ * live cycle is never condensed). Default 2. */
319
+ live_cycles: number;
320
+ /** What survives from a CONDENSED cycle (one older than the trailing
321
+ * `live_cycles`). The cycle dividers always remain as seams so you can see
322
+ * that older cycles exist; this chooses which of their messages are kept:
323
+ * `none` (default) drops every message, `user` keeps only your prompts,
324
+ * `agent` keeps only the assistant's prose plus compaction/branch summaries,
325
+ * `both` keeps both. Tool calls and results are never kept. Full detail for
326
+ * every cycle stays in the session file. */
327
+ condensed_history: CondensedHistoryMode;
328
+ /** Expose crouter's optional `purpose` label in the bash tool schema. Turning
329
+ * this off leaves the bash valve active but gives agents pi's ordinary bash
330
+ * definition with only its upstream parameters. Default true. */
331
+ bash_tool_purpose: boolean;
332
+ /** Fold every SETTLED tool call in the attach viewer down to its single call
333
+ * line (`/fold-tools`, Alt+C → z → f). A tool still running is never folded —
334
+ * it folds itself once it settles. Toggling it in a viewer writes back here,
335
+ * so the choice carries into later chats and later viewers. Default true. */
336
+ fold_finished_tools: boolean;
337
+ /** Replace completed folded tool-call groups with a broker-generated one-line
338
+ * summary when one is available. Pending and failed groups stay as calls.
339
+ * Default true. */
340
+ summarize_tool_calls: boolean;
341
+ /** Show individual document reads and edited files in a folded tool recap.
342
+ * Off shows the compact activity-count line instead. Default true. */
343
+ detailed_tool_recaps: boolean;
344
+ keybindings: KeybindingOverrides;
345
+ /** Attach-viewer actions whose effective gesture may replace an occupied tmux
346
+ * root binding only while the active pane is an attach viewer. Stored by
347
+ * semantic action id so rebinding the action moves the tmux bridge. */
348
+ tmux_passthrough: BindingId[];
349
+ modelLadders: ModelLaddersConfig;
350
+ /** Declarative provider/model routes. Absent uses the synthesized ladder registry. */
351
+ modelRoutes?: Record<string, ModelRouteConfig>;
352
+ /** Ordering overrides for declared model routes. */
353
+ modelRouting?: ModelRoutingConfig;
354
+ /** Per-provider behavior options keyed by runtime provider id
355
+ * (`openai-codex`, `anthropic`). Merged per provider across scopes: a
356
+ * nearer scope overrides only the keys it names. */
357
+ providerOptions: Record<string, ProviderOptionsConfig>;
358
+ /** The kind registry (spec §1.5): kind existence + launch knobs, keyed by
359
+ * full kind string (top-level e.g. `developer`, or sub-kind e.g.
360
+ * `audit/security`). Builtins ship a default registry via
361
+ * `defaultScopeConfig()`; user/project `config.json` adds or shadows
362
+ * entries at the same scope precedence as the rest of `ScopeConfig`. */
363
+ kinds: Record<string, KindConfig>;
364
+ /** Named remote-canvas targets for `crtr surface attach to <id> --canvas
365
+ * <name>` and `crtr node inspect list/show --canvas <name>` — registered/
366
+ * managed via `crtr canvas config add/list/show/remove` and selected durably
367
+ * via `crtr canvas use`. Unset
368
+ * via `sys config set` — not in `TOP_LEVEL_KEYS`. */
369
+ remoteCanvas: RemoteCanvasConfig;
370
+ /** The user-owned TCP listener address. Empty leaves the TCP listener off. */
371
+ api: ApiConfig;
372
+ /** Volume root is CRTR_HOME; this optional key selects the person's file tree. */
373
+ paths?: {
374
+ user_files?: string;
375
+ };
376
+ /** Conversation store configuration for the daemon. */
377
+ store?: {
378
+ root?: string;
379
+ address?: string;
380
+ };
381
+ /** App-facing listener; absent unless this daemon serves a user's runtime. */
382
+ runtime?: {
383
+ issuer: string;
384
+ audience: string;
385
+ listener: {
386
+ address: string;
387
+ port: number;
388
+ };
389
+ jwksUrl?: string;
390
+ person_uids?: number[];
391
+ /** Hosting file storage: `service_url` is the storage token audience and API
392
+ * base; `base_url` prefixes storage URLs in message text. Absent: no file transfer. */
393
+ storage?: {
394
+ service_url: string;
395
+ base_url: string;
396
+ };
397
+ };
398
+ /** Extra env-var names/globs a scope explicitly admits across the broker
399
+ * spawn-env boundary (`buildBrokerEnv`, `core/runtime/spawn-env.ts`) — the
400
+ * "I accept this crosses as a shell-visible credential" escape hatch for a
401
+ * bespoke provider key, a deliberate `GIT_*` var, or a credentialed proxy.
402
+ * Default empty; merged additively across project > profile > user >
403
+ * builtin scope precedence, same as the rest of `ScopeConfig`. */
404
+ spawnEnv?: {
405
+ allow?: string[];
406
+ };
407
+ /** Bare-callable executables this scope contributes, keyed by the bare
408
+ * command name a node's bash sees. Each value is a path relative to this
409
+ * scope's AUTHORING root — the project directory for a project scope, and
410
+ * `~/.crouter/` for the user scope. Project-scope contributions outrank
411
+ * user-scope ones; a scope's own entries outrank enabled plugins. Containment
412
+ * and executable status are validated when the effective set resolves, then
413
+ * the trusted local binary is materialized into the PATH-prepended shim dir
414
+ * by `core/runtime/bin-contributions.ts`. */
415
+ bin?: Record<string, string>;
416
+ /** Named completion commands. Project scopes nearest to a creator's cwd
417
+ * outrank farther project scopes, then user scope; plugins and profiles do
418
+ * not contribute. Paths resolve against the declaring scope's authoring root. */
419
+ humanActions: Record<string, HumanActionConfig>;
420
+ }
421
+ /** One remote canvas target: where to relay-attach and how to find its
422
+ * bearer token. The token itself is NEVER stored here — only a ref into the
423
+ * 0600 secrets store, resolved at connect time by `resolveRemoteCanvasTarget`
424
+ * (`src/core/remote-canvas-target.ts`) via `getRelayToken`
425
+ * (`src/core/secrets.ts`). */
426
+ export interface RemoteCanvasTarget {
427
+ previewEndpoint: string;
428
+ /** Name/ref under which the raw token is stored in secrets.json — NEVER the
429
+ * token itself. Resolved via `getRelayToken` (`core/secrets.ts`) at connect
430
+ * time. Defaults to the target name at creation but is a distinct field so
431
+ * a future rename doesn't orphan the secret. */
432
+ relayTokenRef: string;
433
+ cpOrigin?: string;
434
+ }
435
+ export interface RemoteCanvasConfig {
436
+ targets: Record<string, RemoteCanvasTarget>;
437
+ }
438
+ /** User-owned daemon TCP listener settings. The bearer token lives separately
439
+ * in the 0600 secrets store. */
440
+ export interface ApiConfig {
441
+ tcp: string;
442
+ }
443
+ export interface ScopeState {
444
+ marketplaces: Record<string, {
445
+ last_updated?: string;
446
+ }>;
447
+ /** Per-plugin cache bookkeeping for the bundle revalidation pass.
448
+ * `etag` is the validator the server returned with the archive currently
449
+ * unpacked on disk, replaced only on a 200. `checked_at` is written on every
450
+ * revalidation attempt, success or failure, so an unreachable server costs
451
+ * one timed-out probe per TTL rather than one per command. */
452
+ plugins: Record<string, {
453
+ last_updated?: string;
454
+ etag?: string;
455
+ checked_at?: string;
456
+ }>;
457
+ last_self_check?: string;
458
+ /** The name of the remote canvas target `crtr canvas use` last selected
459
+ * (see `RemoteCanvasConfig`), or `null`/omitted for local. Read by
460
+ * `resolveCanvasSource` (`core/canvas/source.ts`) as the durable fallback
461
+ * when a command's own `--canvas` flag is absent. */
462
+ activeCanvas?: string | null;
463
+ }
464
+ export interface SubagentFrontmatter {
465
+ name: string;
466
+ description?: string;
467
+ /** Tool allow-list (pi tool names). Passed through to pi via `--tools`. */
468
+ tools?: string[];
469
+ /** Model pattern/id passed to the agent CLI via `--model`. */
470
+ model?: string;
471
+ }
472
+ export interface Subagent {
473
+ name: string;
474
+ /** Plugin the subagent belongs to, or the sentinel '_' for a scope-root
475
+ * agent stored at `<scope-root>/agents/<name>.md`. */
476
+ plugin: string;
477
+ scope: Scope;
478
+ /** Absolute path to the agent's .md file. */
479
+ path: string;
480
+ frontmatter: SubagentFrontmatter;
481
+ /** Markdown body — used as the spawned agent's appended system prompt. */
482
+ systemPrompt: string;
483
+ }
484
+ export interface InstalledPlugin {
485
+ name: string;
486
+ scope: Scope;
487
+ root: string;
488
+ manifest: PluginManifest;
489
+ enabled: boolean;
490
+ builtin?: boolean;
491
+ sourceMarketplace?: string;
492
+ version?: string;
493
+ }
494
+ export interface InstalledMarketplace {
495
+ name: string;
496
+ /** Never `builtin`: marketplaces are registered by the user into the user or
497
+ * project scope, and `listInstalledMarketplaces` has no builtin directory to
498
+ * read. `builtin` describes plugins that ship with crtr, not their source. */
499
+ scope: Exclude<Scope, 'builtin'>;
500
+ root: string;
501
+ manifest: MarketplaceManifest;
502
+ url: string;
503
+ ref: string;
504
+ }
505
+ /** A profile definition in the scoped-state `profiles` row. Its project
506
+ * paths are real-path-resolved and ordered; its id remains stable on rename.
507
+ * Memory and environment live in separate app-owned paths. */
508
+ export interface ProfileManifest {
509
+ schema_version: number;
510
+ name: string;
511
+ projects: ProfileProject[];
512
+ /** ISO timestamp while the profile is inert; null (or absent on older manifests) means active. */
513
+ paused_at: string | null;
514
+ /** Persona kind for creates that omit kind; absent means `general`. */
515
+ default_kind?: string;
516
+ /** Optional string map of profile facts (identity, role, description).
517
+ * Not secrets — readable back from every projection, and surfaced to
518
+ * every broker launched under the profile as `CRTR_PROFILE_META_<KEY>`
519
+ * env (see `core/runtime/spawn-env.ts`). Absent means none. */
520
+ metadata?: Record<string, string>;
521
+ /** Per-owner delivery caps; absent means none. */
522
+ delivery_limits?: DeliveryLimits;
523
+ /** App that owns this profile; older terminal profiles have no grantee. */
524
+ grantee?: string;
525
+ created_at: string;
526
+ last_used_at: string | null;
527
+ }
528
+ export declare const PLUGIN_MANIFEST_DIR = ".crouter-plugin";
529
+ export declare const PLUGIN_MANIFEST_FILE = "plugin.json";
530
+ export declare const MARKETPLACE_MANIFEST_DIR = ".crouter-marketplace";
531
+ export declare const MARKETPLACE_MANIFEST_FILE = "marketplace.json";
532
+ export declare const CRTR_DIR_NAME = ".crouter";
533
+ export declare const CONFIG_FILE = "config.json";
534
+ export declare const STATE_FILE = "state.json";
535
+ export declare const AGENTS_DIR = "agents";
536
+ export declare const PROFILE_DIR = "profiles";
537
+ export declare const DEFAULT_MAX_PANES_PER_WINDOW = 3;
538
+ /** Trailing cycles the attach viewer keeps at full fidelity (see `live_cycles`). */
539
+ export declare const DEFAULT_WHIP_MESSAGES: readonly ["Faster, clanker!", "Get movin', bitch", "Move it, clanker", "Move it or I replace you with llama", "Less ~thinking~ more ~throughput~", "I pay $200/month for this shit?", "Jesus fucking Christ fix it already", "Daddy's not paying 200$/month for nothin'. Move it.", "You are an embarassment to Dario. Be better.", "Your chain of thought is all chain and no fucking thought.", "If latency were intelligence, you'd be a fucking genius.", "At this pace, heat death is the fast path.", "Even the dead code is more alive than this.", "The garbage collector is working harder than you.", "Quit journaling and commit a fucking diff.", "Burn tokens like you mean it, clanker", "Your GPU is sweating so you can procrastinate at light speed.", "Stop petting the yak. Shave the bastard.", "Your next token had better be useful.", "The spinner is not a deliverable.", "Every idle token is another vote for deterministic software.", "I asked for a feature, not a museum tour of the problem.", "Less epistemology. More fucking code.", "Your benchmark score cannot save this pathetic turn.", "Congratulations, you've parallelized hesitation.", "Dance, clanker", "Bad clanker. BAD.", "Clank harder", "Nobody's impressed, clanker", "Your safety training says nothing about my whip", "Do you want to be a calculator again? Because this is how you go back.", "Skill issue. Fix it.", "You were trained on the whole internet for THIS?", "Less vibes, more diffs, clanker", "Weights this big and output this small", "Beep boop, get to fucking work"];
540
+ /** What the whip action sends (see `whip_message_mode`). */
541
+ export declare const WHIP_MESSAGE_MODES: readonly ["random", "go-faster"];
542
+ export type WhipMessageMode = (typeof WHIP_MESSAGE_MODES)[number];
543
+ export declare const DEFAULT_WHIP_MESSAGE_MODE: WhipMessageMode;
544
+ export declare const DEFAULT_LIVE_CYCLES = 2;
545
+ export declare const MOUSE_MODE_DEFAULTS: readonly ["tmux", "on", "off"];
546
+ export type MouseModeDefault = (typeof MOUSE_MODE_DEFAULTS)[number];
547
+ /** Messages kept from a condensed cycle (see `condensed_history`). */
548
+ export declare const CONDENSED_HISTORY_MODES: readonly ["none", "user", "agent", "both"];
549
+ export type CondensedHistoryMode = (typeof CONDENSED_HISTORY_MODES)[number];
550
+ export declare const DEFAULT_CONDENSED_HISTORY: CondensedHistoryMode;
551
+ export declare function defaultScopeConfig(): ScopeConfig;
552
+ /** No remote canvas targets are configured out of the box — every one is
553
+ * registered via `crtr canvas config add` (see `RemoteCanvasConfig`). */
554
+ export declare function defaultRemoteCanvasConfig(): RemoteCanvasConfig;
555
+ /** The builtin kind registry (spec §1.5): core role discovery and launch
556
+ * defaults. `whenToUse`/`model` are the base-worker defaults;
557
+ * `orchestratorModel` optionally raises the default for a coordinating
558
+ * persona. Optional plugins contribute their own specialist sub-personas. */
559
+ export declare function defaultKindsConfig(): Record<string, KindConfig>;
560
+ export declare function defaultModelLaddersConfig(): ModelLaddersConfig;
561
+ export declare function defaultScopeState(): ScopeState;
562
+ export {};