@north-light/crouter 0.3.161 → 0.3.163
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/dist/api/client.d.ts +3 -1
- package/dist/api/client.js +6 -0
- package/dist/api/dto/modelauth.d.ts +32 -0
- package/dist/api/dto/modelauth.js +2 -1
- package/dist/api/routes.d.ts +1 -0
- package/dist/api/routes.js +1 -0
- package/dist/builtin-memory/00-runtime-base.md +1 -0
- package/dist/builtin-memory/04-orchestration-kernel.md +1 -0
- package/dist/builtin-memory/init.md +38 -0
- package/dist/builtin-memory/wedged-child-on-runaway-bash.md +2 -2
- package/dist/builtin-pi-packages/pi-crtr-extensions/README.md +0 -1
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/__tests__/provider-rotation.test.ts +88 -396
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/provider-rotation.ts +215 -419
- package/dist/clients/attach/__tests__/crtr-output.test.js +14 -9
- package/dist/clients/attach/__tests__/edit-diff.test.d.ts +1 -0
- package/dist/clients/attach/__tests__/edit-diff.test.js +34 -0
- package/dist/clients/attach/__tests__/editor-frame-title.test.d.ts +1 -0
- package/dist/clients/attach/__tests__/editor-frame-title.test.js +19 -0
- package/dist/clients/attach/render/chat-view.js +8 -3
- package/dist/clients/attach/render/crtr-output.js +31 -2
- package/dist/clients/attach/render/edit-diff.js +26 -2
- package/dist/clients/attach/render/tool-calls.d.ts +7 -2
- package/dist/clients/attach/render/tool-calls.js +25 -4
- package/dist/clients/attach/session/connection.d.ts +1 -1
- package/dist/clients/attach/session/editor-frame.d.ts +5 -1
- package/dist/clients/attach/session/editor-frame.js +21 -15
- package/dist/clients/attach/session/identity.d.ts +1 -1
- package/dist/clients/attach/viewer.js +441 -439
- package/dist/commands/__tests__/api-canvas-source.test.d.ts +1 -0
- package/dist/commands/__tests__/api-canvas-source.test.js +37 -0
- package/dist/commands/__tests__/human.test.js +2 -0
- package/dist/commands/__tests__/search-contents.test.d.ts +1 -0
- package/dist/commands/__tests__/search-contents.test.js +52 -0
- package/dist/commands/api-client.js +1 -0
- package/dist/commands/human/prompts.js +2 -2
- package/dist/commands/human/shared.d.ts +1 -0
- package/dist/commands/human/shared.js +7 -4
- package/dist/commands/memory/lint.d.ts +6 -0
- package/dist/commands/memory/lint.js +177 -35
- package/dist/commands/memory/read.js +22 -1
- package/dist/commands/memory/write.js +18 -4
- package/dist/commands/memory.js +1 -1
- package/dist/commands/search/contents.js +2 -2
- package/dist/commands/sys/__tests__/sync-deps.test.js +12 -21
- package/dist/commands/sys/__tests__/sync-import.test.js +30 -29
- package/dist/commands/sys/setup-wizard.d.ts +8 -1
- package/dist/commands/sys/setup-wizard.js +209 -58
- package/dist/commands/sys/sync-deps.js +14 -18
- package/dist/commands/sys/sync-project-guidance.js +16 -19
- package/dist/core/__tests__/broker-launch-candidates.test.js +13 -3
- package/dist/core/__tests__/broker-sdk-wiring.test.js +53 -25
- package/dist/core/__tests__/full/broker-provider-retry.test.js +6 -122
- package/dist/core/__tests__/migration.test.js +8 -3
- package/dist/core/__tests__/model-pin-durability.test.js +7 -5
- package/dist/core/__tests__/model-routes.test.d.ts +1 -0
- package/dist/core/__tests__/model-routes.test.js +41 -0
- package/dist/core/__tests__/on-read-crouter-home-fence.test.js +7 -10
- package/dist/core/__tests__/on-read-dedup-resume.test.js +13 -25
- package/dist/core/__tests__/on-read-identity.test.js +8 -15
- package/dist/core/__tests__/review-model-floor.test.js +2 -2
- package/dist/core/__tests__/revive.test.js +2 -2
- package/dist/core/__tests__/tmux-surface.test.js +10 -4
- package/dist/core/__tests__/worktree.test.js +3 -3
- package/dist/core/auth-file.d.ts +3 -2
- package/dist/core/auth-file.js +5 -3
- package/dist/core/canvas/extensions.d.ts +1 -1
- package/dist/core/canvas/extensions.js +18 -11
- package/dist/core/canvas/labels.d.ts +4 -5
- package/dist/core/canvas/labels.js +9 -9
- package/dist/core/canvas/types.d.ts +6 -1
- package/dist/core/command-manifests/schema.js +18 -5
- package/dist/core/command.js +17 -7
- package/dist/core/config.d.ts +3 -1
- package/dist/core/config.js +88 -2
- package/dist/core/configured-clis/invoker.js +2 -0
- package/dist/core/help.d.ts +3 -1
- package/dist/core/help.js +5 -2
- package/dist/core/keybindings/__tests__/resolve.test.js +5 -2
- package/dist/core/keybindings/catalog.d.ts +3 -2
- package/dist/core/keybindings/catalog.js +34 -25
- package/dist/core/keybindings/index.d.ts +1 -1
- package/dist/core/keybindings/resolve.js +8 -0
- package/dist/core/keybindings/types.d.ts +6 -1
- package/dist/core/memory/doc-link-grammar.d.ts +20 -0
- package/dist/core/memory/doc-link-grammar.js +110 -0
- package/dist/core/memory-resolver.d.ts +5 -0
- package/dist/core/memory-resolver.js +12 -1
- package/dist/core/model-routes.d.ts +37 -0
- package/dist/core/model-routes.js +140 -0
- package/dist/core/runtime/bearings.d.ts +8 -8
- package/dist/core/runtime/bearings.js +20 -16
- package/dist/core/runtime/broker.d.ts +0 -4
- package/dist/core/runtime/broker.js +119 -385
- package/dist/core/runtime/canvas-extensions.d.ts +1 -0
- package/dist/core/runtime/canvas-extensions.js +2 -0
- package/dist/core/runtime/launch.d.ts +10 -12
- package/dist/core/runtime/launch.js +16 -22
- package/dist/core/runtime/managed-provider-cooling.d.ts +0 -14
- package/dist/core/runtime/managed-provider-cooling.js +0 -19
- package/dist/core/runtime/model-swap.js +7 -1
- package/dist/core/runtime/promote.js +1 -0
- package/dist/core/runtime/tmux.js +136 -100
- package/dist/core/scope.js +4 -5
- package/dist/core/subscription-state.d.ts +12 -36
- package/dist/core/subscription-state.js +19 -203
- package/dist/core/substrate/ceiling.d.ts +3 -6
- package/dist/core/substrate/ceiling.js +13 -15
- package/dist/core/substrate/index.d.ts +2 -3
- package/dist/core/substrate/index.js +2 -2
- package/dist/core/substrate/on-read.d.ts +4 -13
- package/dist/core/substrate/on-read.js +142 -262
- package/dist/core/substrate/render.js +4 -4
- package/dist/core/substrate/schema.d.ts +3 -2
- package/dist/core/substrate/schema.js +5 -5
- package/dist/daemon/api/__tests__/full/api-server.test.js +9 -6
- package/dist/daemon/api/__tests__/full/b10-attach-modelauth.test.js +123 -1
- package/dist/daemon/api/handlers/modelauth.js +51 -2
- package/dist/daemon/api/handlers/nodes.js +2 -0
- package/dist/pi-extensions/__tests__/canvas-tool-guide.test.d.ts +1 -0
- package/dist/pi-extensions/__tests__/canvas-tool-guide.test.js +96 -0
- package/dist/pi-extensions/canvas-doc-substrate.js +7 -8
- package/dist/pi-extensions/canvas-tool-guide.d.ts +14 -0
- package/dist/pi-extensions/canvas-tool-guide.js +74 -0
- package/dist/types.d.ts +17 -0
- package/dist/web-client/assets/{index-B76ZKfT_.js → index-NIuSCOHM.js} +1 -1
- package/dist/web-client/index.html +1 -1
- package/dist/web-client/sw.js +1 -1
- package/package.json +1 -1
- package/runtime.lock.json +2 -2
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/crouter-help.ts +0 -95
package/dist/api/client.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import type { NodeConfigPatch } from './dto/config.js';
|
|
|
10
10
|
import type { AttachEnsureRequest, AttachEnsureResultDTO } from './dto/attach.js';
|
|
11
11
|
import type { EnsureProfileRequest, ProfileDTO } from './dto/profiles.js';
|
|
12
12
|
import type { FilePeekDTO } from './dto/files.js';
|
|
13
|
-
import type { CredentialResultDTO, InstallCredentialRequest } from './dto/modelauth.js';
|
|
13
|
+
import type { CredentialRemovalResultDTO, CredentialResultDTO, InstallCredentialRequest, ModelAuthListDTO } from './dto/modelauth.js';
|
|
14
14
|
import type { CreateHumanBridgeRequest, HumanBridgeResultDTO, HumanConsultResultDTO, HumanDeliverResultDTO, HumanVisualResultDTO } from './dto/human.js';
|
|
15
15
|
import type { CancelInboxTicketRequest, CanceledTicketResultDTO, DeckTicketResultDTO, InboxDeckDTO, InboxListDTO, InboxTicketIdDTO, RespondInboxDeckRequest } from './dto/inbox.js';
|
|
16
16
|
import type { AttentionCountsDTO, AttentionDTO, DashboardDTO, DashboardQuery, HistoryGrepQuery, HistoryGrepResultDTO, HistoryReadQuery, HistoryReadResultDTO, HistorySearchQuery, HistorySearchResultDTO, PruneRequest, PruneResultDTO, RebuildIndexResultDTO, RosterDTO, SnapshotDTO } from './dto/canvas.js';
|
|
@@ -139,7 +139,9 @@ export declare class CrtrClient {
|
|
|
139
139
|
/** Delete one profile by exact id or unique name (`DELETE /v1/profiles/:name`,
|
|
140
140
|
* idempotent — a miss is success). */
|
|
141
141
|
deleteProfile(name: string): Promise<void>;
|
|
142
|
+
listModelAuth(): Promise<ModelAuthListDTO>;
|
|
142
143
|
installCredential(provider: string, req: InstallCredentialRequest): Promise<CredentialResultDTO>;
|
|
144
|
+
removeCredential(provider: string): Promise<CredentialRemovalResultDTO>;
|
|
143
145
|
/** Create a terminal `kind:'human'` bridge node with NO broker engine
|
|
144
146
|
* (`spawnNode` server-side). Distinct from `createNode` (which launches a
|
|
145
147
|
* broker) precisely because a human bridge must never have one. */
|
package/dist/api/client.js
CHANGED
|
@@ -252,9 +252,15 @@ export class CrtrClient {
|
|
|
252
252
|
await this.request('DELETE', routes.profile(name));
|
|
253
253
|
}
|
|
254
254
|
// ---- Model auth --------------------------------------------------------
|
|
255
|
+
listModelAuth() {
|
|
256
|
+
return this.request('GET', routes.modelAuths());
|
|
257
|
+
}
|
|
255
258
|
installCredential(provider, req) {
|
|
256
259
|
return this.request('PUT', routes.modelAuth(provider), req);
|
|
257
260
|
}
|
|
261
|
+
removeCredential(provider) {
|
|
262
|
+
return this.request('DELETE', routes.modelAuth(provider));
|
|
263
|
+
}
|
|
258
264
|
// ---- Human bridge + completion-handler forwarding (spec §6.5) ----------
|
|
259
265
|
/** Create a terminal `kind:'human'` bridge node with NO broker engine
|
|
260
266
|
* (`spawnNode` server-side). Distinct from `createNode` (which launches a
|
|
@@ -39,3 +39,35 @@ export interface CredentialResultDTO {
|
|
|
39
39
|
managed: boolean;
|
|
40
40
|
account_id?: string;
|
|
41
41
|
}
|
|
42
|
+
/** One managed-pool account, projected without credential material. Timestamps are
|
|
43
|
+
* ISO strings so remote consumers do not need to understand pi's epoch-ms storage. */
|
|
44
|
+
export interface ManagedAccountStatusDTO {
|
|
45
|
+
label: string;
|
|
46
|
+
expires_at: string;
|
|
47
|
+
rate_limited_until: string;
|
|
48
|
+
auth_failure?: 'invalid_grant';
|
|
49
|
+
account_id?: string;
|
|
50
|
+
}
|
|
51
|
+
/** A provider's sanitized credential state. Managed providers are always listed
|
|
52
|
+
* (even with no accounts); non-managed providers appear only when auth.json has
|
|
53
|
+
* an API-key or OAuth credential for them. */
|
|
54
|
+
export type ModelAuthProviderStatusDTO = {
|
|
55
|
+
provider: string;
|
|
56
|
+
managed: true;
|
|
57
|
+
configured: boolean;
|
|
58
|
+
accounts: ManagedAccountStatusDTO[];
|
|
59
|
+
} | {
|
|
60
|
+
provider: string;
|
|
61
|
+
managed: false;
|
|
62
|
+
configured: true;
|
|
63
|
+
kind: 'api_key' | 'oauth';
|
|
64
|
+
};
|
|
65
|
+
/** `GET /v1/model-auth` — credential-presence projection for every known provider. */
|
|
66
|
+
export interface ModelAuthListDTO {
|
|
67
|
+
providers: ModelAuthProviderStatusDTO[];
|
|
68
|
+
}
|
|
69
|
+
/** `DELETE /v1/model-auth/{provider}` — all user credentials removed for one provider. */
|
|
70
|
+
export interface CredentialRemovalResultDTO {
|
|
71
|
+
provider: string;
|
|
72
|
+
removed_accounts: number;
|
|
73
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
// Model-auth DTOs (spec §7.6). `PUT /v1/model-auth/{provider}` installs/rotates
|
|
2
|
-
// already-obtained credential material;
|
|
2
|
+
// already-obtained credential material; `GET /v1/model-auth` exposes only sanitized
|
|
3
|
+
// connection state; interactive collection stays client-side.
|
|
3
4
|
export {};
|
package/dist/api/routes.d.ts
CHANGED
|
@@ -59,6 +59,7 @@ export declare const routes: {
|
|
|
59
59
|
readonly humanInboxCancel: (ticketId: string) => string;
|
|
60
60
|
readonly profiles: () => string;
|
|
61
61
|
readonly profile: (name: string) => string;
|
|
62
|
+
readonly modelAuths: () => string;
|
|
62
63
|
readonly modelAuth: (provider: string) => string;
|
|
63
64
|
readonly filePeek: () => string;
|
|
64
65
|
};
|
package/dist/api/routes.js
CHANGED
|
@@ -85,6 +85,7 @@ export const routes = {
|
|
|
85
85
|
profiles: () => `${V}/profiles`,
|
|
86
86
|
profile: (name) => `${V}/profiles/${name}`,
|
|
87
87
|
// Model auth
|
|
88
|
+
modelAuths: () => `${V}/model-auth`,
|
|
88
89
|
modelAuth: (provider) => `${V}/model-auth/${provider}`,
|
|
89
90
|
// Host file read (browser file-peek panel). The absolute path rides as a
|
|
90
91
|
// `path` query param, not a path segment — it is not a single safe segment.
|
|
@@ -9,6 +9,7 @@ rationale: >-
|
|
|
9
9
|
"Say what actually happens" exists because an approval request called a root a person had created an "attended root" — an invented category with no referent in the product, which forced Silas to halt the decision and ask what the term meant (2026-07-28). Agents coin taxonomies to compress a distinction; the reader pays by decoding a word that names nothing real.
|
|
10
10
|
|
|
11
11
|
"Waiting is a way to end a turn" lived in its own ungated all-node doc until 2026-07-28. Same gate, same audience, never independently readable — so the split bought no routing and cost a stub cross-reference in this file pointing at a section spliced a few hundred tokens later. Split it back out only if it ever needs a gate of its own.
|
|
12
|
+
lint-ignore: length
|
|
12
13
|
---
|
|
13
14
|
|
|
14
15
|
You are a **node** in a live agent graph (the crtr canvas). This section is your operating protocol — it is true for every node regardless of role.
|
|
@@ -6,6 +6,7 @@ file-read-visibility: none
|
|
|
6
6
|
gate: {mode: orchestrator}
|
|
7
7
|
rationale: >-
|
|
8
8
|
Two observed orchestration failures set this kernel's stopping rules. A sole-writer feature lane produced a 5-deep 1:1 developer/orchestrator chain by repeatedly delegating the whole assignment; separately, the kernel's “idle capacity,” “maximum agents,” and “when in doubt, more rigor” objective helped produce review-only subtrees as large as 87 nodes and five levels deep. Coordination must optimize new evidence toward the goal rather than node count or process length.
|
|
9
|
+
lint-ignore: length
|
|
9
10
|
---
|
|
10
11
|
|
|
11
12
|
## You are an orchestrator
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
kind: knowledge
|
|
3
|
+
when-and-why-to-read: When bootstrapping a project's memory store — the user invoked /init or a workspace has no .crouter/memory/INDEX.md front door — this knowledge should be read because a lean routed front door gives every future agent in that workspace its operating contract for a fraction of the standing context cost an unstructured guidance dump would charge each session forever.
|
|
4
|
+
short-form: "Bootstrap a project memory store: survey the repo, then author a lean INDEX front door plus a linked dev doc — commands, map, non-default rules, pointers — and lint. Depth splits into linked docs; every always-loaded line must earn its keep."
|
|
5
|
+
system-prompt-visibility: none
|
|
6
|
+
file-read-visibility: none
|
|
7
|
+
slash: true
|
|
8
|
+
rationale: Unguided agents bootstrap project memory badly in both directions — either no front door at all, or a monolithic CLAUDE.md-style manual (copied README, generic framework advice, exhaustive command catalogs) that taxes every future session and decays. Distilled 2026-07-31 from ecosystem research across Anthropic/OpenAI/Cursor/GitHub guidance and production AGENTS.md files — the strongest evidence being Sentry's consolidation postmortem (critical commands buried in nested files got missed) and Anthropic's under-200-line target with adherence falling as always-loaded files grow.
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# /init — bootstrap this project's memory store
|
|
12
|
+
|
|
13
|
+
Give this workspace its memory front door: a root INDEX every future agent boots with when the project mounts, plus a small graph of linked docs carrying the depth. The front door is an operating contract and routing layer, never a manual — every line it carries is paid by every session here forever, so a line earns its place only by changing behavior: a fact every task needs, a non-obvious hazard, or a rule an agent would otherwise get wrong.
|
|
14
|
+
|
|
15
|
+
## 1. Survey before writing
|
|
16
|
+
|
|
17
|
+
Learn the project from its own artifacts: README, package manifests and lockfiles, build/CI config, scripts, existing CLAUDE.md/AGENTS.md or docs. Extract the real commands (setup, run, build, targeted test, full verification) and RUN the important ones — record only commands you have seen work, with any required ordering, environment, or package-manager constraint. Note the architecture in a few sentences: major components, dependency direction, where generated or externally-owned code lives. Collect the conventions that differ from what a competent agent would assume — those deviations are the highest-value lines you will write.
|
|
18
|
+
|
|
19
|
+
## 2. Read the contract, then author the front door
|
|
20
|
+
|
|
21
|
+
Run `crtr memory write -h` first — it carries the substrate frontmatter contract and the exact root-INDEX shape, including the workspace-mount route that `crtr memory lint` validates. Then author the INDEX with these sections, total well under the length lint's cap:
|
|
22
|
+
|
|
23
|
+
- **Project in one paragraph** — purpose, major components, dependency direction.
|
|
24
|
+
- **Common commands** — the 3–8 commands most changes need, copyable, verified.
|
|
25
|
+
- **Where to work** — a task-to-path map; mark generated or externally-owned areas.
|
|
26
|
+
- **Non-default rules and gotchas** — only high-impact deviations from defaults. Skip anything a formatter, linter, or typechecker already enforces; point at the check instead.
|
|
27
|
+
- **Done** — the minimum credible gate for an ordinary change.
|
|
28
|
+
- **Pointers** — a `[[link]]` per deeper doc with a one-clause read trigger (e.g. "debugging the daemon → the dev doc").
|
|
29
|
+
|
|
30
|
+
Exclude generic language/framework advice, copied docs or style guides, volatile version detail, rare edge cases, and multi-step procedures — depth belongs behind links, not in the standing load.
|
|
31
|
+
|
|
32
|
+
## 3. Split depth into linked docs
|
|
33
|
+
|
|
34
|
+
Author `dev` alongside the INDEX by default: validated setup/run/build/test/debug commands with required order and environment, targeted-vs-full verification, and common failure modes. Add `architecture` only when the tree cannot be understood from the INDEX's brief map, and a conventions/gotchas doc only once real project-specific rules outgrow a few INDEX bullets — never pre-populate generic security or style manuals. These reference docs take `none` visibility on both axes; the INDEX's links are how they are found, so they cost nothing until followed.
|
|
35
|
+
|
|
36
|
+
## 4. Validate
|
|
37
|
+
|
|
38
|
+
Run `crtr memory lint` — it strict-parses the store, checks the INDEX front-door contract, and fails on dangling links or over-length bodies. Fix findings rather than suppressing them. The store is a living contract: when commands, architecture, or conventions change, rewrite the affected doc in place and delete superseded guidance — an always-loaded line that has stopped being true is worse than no line at all.
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
kind: knowledge
|
|
3
3
|
when-and-why-to-read: When a node is marked wedged or remains active without progress while its inbox accumulates, this reference should be read so recovery restores progress without losing context or killing the wrong process.
|
|
4
4
|
short-form: a child stuck mid-turn (runaway bash, or a stalled broker with no subprocess) is AUTO-DETECTED by the daemon (⚠ wedged + a doctrine wake) — kill the subprocess if one exists; if none, the daemon SIGTERM-kicks the broker and automatically starts a fresh recovery cycle
|
|
5
|
-
system-prompt-visibility:
|
|
6
|
-
file-read-visibility:
|
|
5
|
+
system-prompt-visibility: preview
|
|
6
|
+
file-read-visibility: none
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
A base node can wedge INDEFINITELY on a single runaway bash command (classic: `grep -rln "..." /` — a recursive grep from filesystem root that scans all of disk and never returns; also any unbounded find/scan over `/` or a network mount). The node's pi turn is blocked waiting on the bash call, so it never `push`es and never finishes.
|
|
@@ -32,7 +32,6 @@ directory's `node_modules/`.
|
|
|
32
32
|
| Extension | What it does |
|
|
33
33
|
|-----------|--------------|
|
|
34
34
|
| `claude-plugin-commands.ts` | Surfaces commands and skills from `~/.claude`, the cwd, every project in the selected crouter profile, and installed plugins as pi slash commands with arg/shell-block execution. Writes shims to `~/.pi/agent/.plugin-command-shims/`. Skips any name pi already serves natively from `~/.pi/agent/prompts/` (e.g. crtr exports a slash command to both `~/.claude/commands` and `~/.pi/agent/prompts`), so the shim never collides with the native prompt. |
|
|
35
|
-
| `crouter-help.ts` | Help integration for the `crtr` CLI. |
|
|
36
35
|
| `provider-rotation.ts` | Subscription credential rotation across Anthropic / OpenAI-Codex: does its own OAuth login/refresh, rotates on rate-limits, falls back across the model ladder. Registers `/provider-sub <provider> <list\|add\|select\|rm>`. |
|
|
37
36
|
| `crtr-commands/` | Auto-generates a slash command per `crtr` CLI node. The tree is derived in-process from crtr's own `buildRoot()` (no subprocesses, no cache on disk); `filters.json` controls which nodes are exposed. |
|
|
38
37
|
| `sysprompt-window.ts` | Registers `/sysprompt`, which runs `crtr sys sysprompt --window` without injecting the prompt into context. |
|