@crouton-kit/crouter 0.3.20 → 0.3.21
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/builtin-memory/crouter-development/marketplaces.md +2 -4
- package/dist/builtin-memory/crouter-development/personas/base-prompt.md +3 -5
- package/dist/builtin-memory/crouter-development/personas/orchestrator-prompt.md +3 -6
- package/dist/builtin-memory/crouter-development/personas.md +2 -6
- package/dist/builtin-memory/crouter-development/plugins.md +2 -4
- package/dist/builtin-memory/design.md +2 -4
- package/dist/builtin-memory/development.md +3 -3
- package/dist/builtin-memory/planning.md +3 -4
- package/dist/builtin-memory/spec.md +3 -10
- package/dist/builtin-personas/orchestration-kernel.md +1 -1
- package/dist/commands/human/queue.js +2 -2
- package/dist/commands/memory/__tests__/lint-schema.test.d.ts +1 -0
- package/dist/commands/memory/__tests__/lint-schema.test.js +29 -0
- package/dist/commands/memory/find.js +10 -15
- package/dist/commands/memory/lint.d.ts +7 -0
- package/dist/commands/memory/lint.js +10 -1
- package/dist/commands/memory/shared.js +1 -2
- package/dist/commands/memory/write.js +6 -9
- package/dist/commands/node.js +47 -25
- package/dist/commands/push.js +10 -15
- package/dist/commands/tmux-spread.js +16 -1
- package/dist/commands/view-cycle.js +9 -5
- package/dist/commands/view-run.js +3 -2
- package/dist/core/__tests__/cascade-close.test.js +3 -2
- package/dist/core/__tests__/context-intro.test.js +23 -27
- package/dist/core/__tests__/detach-focus.test.js +2 -2
- package/dist/core/__tests__/live-mutation-verbs.test.js +5 -5
- package/dist/core/__tests__/memory.test.js +4 -4
- package/dist/core/__tests__/subscription-delivery.test.js +3 -3
- package/dist/core/bootstrap.js +18 -14
- package/dist/core/help.d.ts +2 -2
- package/dist/core/help.js +1 -1
- package/dist/core/render.d.ts +4 -3
- package/dist/core/render.js +38 -41
- package/dist/core/resolver.js +1 -1
- package/dist/core/runtime/bearings.d.ts +2 -2
- package/dist/core/runtime/bearings.js +2 -2
- package/dist/core/substrate/render.d.ts +1 -2
- package/dist/core/substrate/render.js +9 -12
- package/dist/core/substrate/schema.d.ts +18 -13
- package/dist/core/substrate/schema.js +12 -11
- package/dist/pi-extensions/canvas-context-intro.js +5 -3
- package/package.json +1 -1
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
// (renderPreferencesSection) — strings the D2 `before_agent_start` extension
|
|
6
6
|
// splices into the system prompt (built by a sibling AFTER this module);
|
|
7
7
|
// • the `<crtr-context>` half — `## References` (renderReferencesBlock) — the
|
|
8
|
-
// string wired into bearings.ts's session_start message
|
|
9
|
-
// `<memory>` block.
|
|
8
|
+
// string wired into bearings.ts's session_start message.
|
|
10
9
|
//
|
|
11
10
|
// Every doc flows through the same pipeline (design §4/§6/§9):
|
|
12
11
|
// MemoryDoc → parseSubstrateDoc → (null-filter non-substrate) →
|
|
@@ -54,10 +53,9 @@ function resolverDocs(subject, kind) {
|
|
|
54
53
|
* canvas home (`nodes/<id>/context/memory/`) and is OUTSIDE the scope resolver,
|
|
55
54
|
* so it is loaded directly here, its raw frontmatter run through
|
|
56
55
|
* parseSubstrateFrontmatter (mirroring the resolver pipeline), then gate-passed.
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* replacement for the old node-local `<memory>` stanza.
|
|
56
|
+
* Non-substrate files (those with no `kind`) parse to null and drop out.
|
|
57
|
+
* Returned across ALL kinds — node-local is the catch-all this-node store and
|
|
58
|
+
* rides into the references block.
|
|
61
59
|
*
|
|
62
60
|
* IMPORTANT: node-local docs are NOT filtered by `systemPromptVisibility` rung.
|
|
63
61
|
* A migrated node-local reference defaults to rung `none`, which would make it
|
|
@@ -122,8 +120,8 @@ function renderSubSection(d) {
|
|
|
122
120
|
* resolver-provided, NOT migrated — named-plugin skills at user/project scope;
|
|
123
121
|
* the SCOPE_SKILL_PLUGIN sentinel and builtin scope are EXCLUDED because they
|
|
124
122
|
* become substrate docs). Reuses skill/shared.ts's renderCatalogSection
|
|
125
|
-
* group-collapse
|
|
126
|
-
*
|
|
123
|
+
* group-collapse for a compact, source-grouped catalog. Returns '' when nothing
|
|
124
|
+
* is in the catalog. */
|
|
127
125
|
function renderSkillCatalog(nameRungSkillDocs) {
|
|
128
126
|
let pluginSkills;
|
|
129
127
|
try {
|
|
@@ -138,8 +136,8 @@ function renderSkillCatalog(nameRungSkillDocs) {
|
|
|
138
136
|
];
|
|
139
137
|
if (entries.length === 0)
|
|
140
138
|
return '';
|
|
141
|
-
// Group by scope+plugin → forest-root names (drop nested children)
|
|
142
|
-
//
|
|
139
|
+
// Group by scope+plugin → forest-root names (drop nested children) so each
|
|
140
|
+
// source contributes only its top-level skills.
|
|
143
141
|
const bySource = new Map();
|
|
144
142
|
for (const e of entries) {
|
|
145
143
|
const key = `${e.scope}\t${e.plugin}`;
|
|
@@ -225,8 +223,7 @@ export function renderPreferencesSection(nodeId) {
|
|
|
225
223
|
* drops it when ''). Holds every eligible `kind: reference` resolver doc at its
|
|
226
224
|
* `system-prompt-visibility` (reference boot default is `none`, so only
|
|
227
225
|
* author-promoted references show) PLUS the node-local memory docs (any kind),
|
|
228
|
-
* each a `###` sub-section.
|
|
229
|
-
* nothing is eligible.
|
|
226
|
+
* each a `###` sub-section. Returns '' when nothing is eligible.
|
|
230
227
|
*
|
|
231
228
|
* DEFENSIVE: each doc is rendered in its own try/catch so a single malformed
|
|
232
229
|
* doc drops only itself (with a loud stderr warning naming the offending path),
|
|
@@ -21,15 +21,17 @@ export declare const KIND_DEFAULT_RUNGS: Record<DocKind, {
|
|
|
21
21
|
* `all`/`any`/`not` combinators (design §4). */
|
|
22
22
|
export type GatePredicate = Record<string, unknown>;
|
|
23
23
|
/** The frontmatter-derived schema of a substrate document, with kind-aware
|
|
24
|
-
* defaults applied. Required fields (`kind`/`when
|
|
25
|
-
* resolved to concrete typed values. */
|
|
24
|
+
* defaults applied. Required fields (`kind`/`when-and-why-to-read`) and
|
|
25
|
+
* optionals all resolved to concrete typed values. */
|
|
26
26
|
export interface SubstrateSchema {
|
|
27
27
|
/** Which of the three semantic kinds. */
|
|
28
28
|
kind: DocKind;
|
|
29
|
-
/**
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
/** The read-routing line — a single sentence answering WHEN to read this doc
|
|
30
|
+
* and WHY it is worth the read: "When <circumstance>, this <kind> should be
|
|
31
|
+
* read <because <payoff>>." (design §4). This is read-routing — why an agent
|
|
32
|
+
* should spend the read — NEVER justification of why the content should be
|
|
33
|
+
* obeyed. It IS the preview verbatim. Frontmatter key `when-and-why-to-read`. */
|
|
34
|
+
whenAndWhyToRead: string;
|
|
33
35
|
/** Human-facing abbreviation for `crtr memory list`. NEVER loaded into an
|
|
34
36
|
* agent's context (design §3). Empty string when absent. */
|
|
35
37
|
shortForm: string;
|
|
@@ -62,15 +64,18 @@ export interface SubstrateDoc extends SubstrateSchema {
|
|
|
62
64
|
* resolver) into a typed schema with defaults applied. Returns `null` when the
|
|
63
65
|
* record is absent or carries no valid `kind` — i.e. it is not a substrate
|
|
64
66
|
* document and cannot be classified or defaulted. Tolerant of every other
|
|
65
|
-
* imperfection (missing `when
|
|
66
|
-
* the kind default), so a renderer mapping over many docs never
|
|
67
|
+
* imperfection (a missing `when-and-why-to-read` defaults to '', a bad rung
|
|
68
|
+
* falls back to the kind default), so a renderer mapping over many docs never
|
|
69
|
+
* throws. Authoring-time enforcement of the field lives in `crtr memory lint`. */
|
|
67
70
|
export declare function parseSubstrateFrontmatter(fm: Record<string, unknown> | null): SubstrateSchema | null;
|
|
68
71
|
/** Parse a resolved MemoryDoc into a fully-typed SubstrateDoc (schema + the
|
|
69
72
|
* resolver's name/scope/path/body). Returns `null` for a non-substrate doc
|
|
70
73
|
* (no valid `kind`), so callers can `docs.map(parseSubstrateDoc).filter(...)`. */
|
|
71
74
|
export declare function parseSubstrateDoc(doc: MemoryDoc): SubstrateDoc | null;
|
|
72
|
-
/** The
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
|
|
75
|
+
/** The `preview`-rung routing line (design §4): the `when-and-why-to-read`
|
|
76
|
+
* field rendered essentially verbatim — it is already authored as the complete
|
|
77
|
+
* routing sentence ("When …, this <kind> should be read …"), so there is no
|
|
78
|
+
* template to compose. Both boot and on-read render this identical line, so it
|
|
79
|
+
* lives once here to prevent drift. Light cleanup normalizes the trailing
|
|
80
|
+
* period. */
|
|
81
|
+
export declare function previewLine(doc: Pick<SubstrateSchema, 'whenAndWhyToRead'>): string;
|
|
@@ -50,8 +50,9 @@ export const KIND_DEFAULT_RUNGS = {
|
|
|
50
50
|
* resolver) into a typed schema with defaults applied. Returns `null` when the
|
|
51
51
|
* record is absent or carries no valid `kind` — i.e. it is not a substrate
|
|
52
52
|
* document and cannot be classified or defaulted. Tolerant of every other
|
|
53
|
-
* imperfection (missing `when
|
|
54
|
-
* the kind default), so a renderer mapping over many docs never
|
|
53
|
+
* imperfection (a missing `when-and-why-to-read` defaults to '', a bad rung
|
|
54
|
+
* falls back to the kind default), so a renderer mapping over many docs never
|
|
55
|
+
* throws. Authoring-time enforcement of the field lives in `crtr memory lint`. */
|
|
55
56
|
export function parseSubstrateFrontmatter(fm) {
|
|
56
57
|
if (fm === null)
|
|
57
58
|
return null;
|
|
@@ -61,8 +62,7 @@ export function parseSubstrateFrontmatter(fm) {
|
|
|
61
62
|
const defaults = KIND_DEFAULT_RUNGS[kind];
|
|
62
63
|
return {
|
|
63
64
|
kind,
|
|
64
|
-
|
|
65
|
-
why: strField(fm.why),
|
|
65
|
+
whenAndWhyToRead: strField(fm['when-and-why-to-read']),
|
|
66
66
|
shortForm: strField(fm['short-form']),
|
|
67
67
|
systemPromptVisibility: parseRung(fm['system-prompt-visibility'], defaults.systemPrompt),
|
|
68
68
|
fileReadVisibility: parseRung(fm['file-read-visibility'], defaults.fileRead),
|
|
@@ -79,14 +79,15 @@ export function parseSubstrateDoc(doc) {
|
|
|
79
79
|
return null;
|
|
80
80
|
return { ...schema, name: doc.name, scope: doc.scope, path: doc.path, body: doc.body };
|
|
81
81
|
}
|
|
82
|
-
/** The
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
82
|
+
/** The `preview`-rung routing line (design §4): the `when-and-why-to-read`
|
|
83
|
+
* field rendered essentially verbatim — it is already authored as the complete
|
|
84
|
+
* routing sentence ("When …, this <kind> should be read …"), so there is no
|
|
85
|
+
* template to compose. Both boot and on-read render this identical line, so it
|
|
86
|
+
* lives once here to prevent drift. Light cleanup normalizes the trailing
|
|
87
|
+
* period. */
|
|
86
88
|
export function previewLine(doc) {
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
return `${when}, read this ${doc.kind}. ${why}.`;
|
|
89
|
+
const line = doc.whenAndWhyToRead.trim().replace(/\.+$/, '');
|
|
90
|
+
return line === '' ? '' : `${line}.`;
|
|
90
91
|
}
|
|
91
92
|
// ---------------------------------------------------------------------------
|
|
92
93
|
// Field coercion helpers (private).
|
|
@@ -15,9 +15,11 @@
|
|
|
15
15
|
//
|
|
16
16
|
// The block carries: the path to the node's own context dir and the framing for
|
|
17
17
|
// what belongs there (a shared document store for the other nodes). EVERY node
|
|
18
|
-
// also gets a
|
|
19
|
-
//
|
|
20
|
-
//
|
|
18
|
+
// also gets a `## References` block rendered from the document substrate —
|
|
19
|
+
// eligible `reference` docs at their system-prompt visibility rung, plus the
|
|
20
|
+
// node's own node-local substrate docs — so the bearings name what to read on
|
|
21
|
+
// demand. (Skills and preferences surface as their own `## Skills` /
|
|
22
|
+
// `## Preferences` sections of the system prompt, not in this block.) An
|
|
21
23
|
// orchestrator additionally gets the across-refresh-cycles framing (the one
|
|
22
24
|
// thing a terminal worker's bearings drop). The prose lives in
|
|
23
25
|
// core/runtime/bearings.ts (shared with the promotion guidance dump).
|