@melite/estate-queue 0.2.0-alpha → 0.2.3-rc.4
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 +0 -5
- package/lib/bench.js +30 -3
- package/lib/cardsCompose.d.ts +31 -0
- package/lib/cardsCompose.js +65 -1
- package/lib/cardsDangling.js +17 -7
- package/lib/cardsDroppable.d.ts +11 -0
- package/lib/cardsDroppable.js +50 -0
- package/lib/cardsFacts.d.ts +37 -0
- package/lib/cardsFacts.js +47 -1
- package/lib/cardsLanes.d.ts +18 -0
- package/lib/cardsLanes.js +2 -1
- package/lib/cardsRegistry.d.ts +12 -20
- package/lib/cardsRegistry.js +288 -96
- package/lib/discloseRegistry.d.ts +5 -0
- package/lib/discloseRegistry.js +3 -3
- package/lib/filmLead.js +9 -1
- package/lib/filmMemoryWarn.js +1 -0
- package/lib/flowsData.d.ts +110 -21
- package/lib/flowsData.js +201 -23
- package/lib/flowsFamilyCompose.js +1 -0
- package/lib/flowsParamsOverlay.d.ts +8 -1
- package/lib/flowsParamsOverlay.js +47 -2
- package/lib/flowsRegistryRows.d.ts +0 -4
- package/lib/flowsRegistryRows.js +177 -371
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -4
- package/lib/ledgerTail.js +1 -0
- package/lib/loadPlane.d.ts +46 -4
- package/lib/loadPlane.js +109 -7
- package/lib/loadRegistry.js +9 -2
- package/lib/managePlane.d.ts +5 -0
- package/lib/managePlane.js +412 -51
- package/lib/managePreflight.js +38 -6
- package/lib/manageProbe.d.ts +35 -0
- package/lib/manageProbe.js +141 -2
- package/lib/manageRegistry.d.ts +10 -0
- package/lib/manageRegistry.js +7 -1
- package/lib/managerRail.js +1 -0
- package/lib/queueCore.js +3 -1
- package/lib/queueLock.js +22 -10
- package/lib/queueResurrect.d.ts +0 -3
- package/lib/queueResurrect.js +5 -3
- package/lib/queueRetry.d.ts +12 -10
- package/lib/queueRetry.js +2 -4
- package/lib/queueSidecar.d.ts +36 -1
- package/lib/queueSidecar.js +30 -2
- package/lib/queueSubmit.d.ts +4 -1
- package/lib/queueSubmit.js +28 -5
- package/lib/queueSweep.d.ts +38 -11
- package/lib/queueSweep.js +73 -16
- package/lib/runsChange.d.ts +5 -4
- package/lib/runsExecute.d.ts +16 -1
- package/lib/runsExecute.js +102 -50
- package/lib/runsGates.d.ts +11 -3
- package/lib/runsGates.js +12 -3
- package/lib/runsList.d.ts +59 -3
- package/lib/runsList.js +228 -36
- package/lib/runsRegistry.d.ts +87 -6
- package/lib/runsRegistry.js +664 -98
- package/lib/runsSourceEcho.js +9 -3
- package/lib/runsStart.d.ts +6 -4
- package/lib/runsStart.js +32 -25
- package/lib/runsTypes.d.ts +54 -1
- package/lib/runsTypes.js +82 -3
- package/lib/runsValidate.d.ts +1 -0
- package/lib/runsValidate.js +5 -0
- package/lib/runsValidateArms.js +48 -2
- package/lib/runsValidateServe.js +15 -12
- package/lib/runsValidateShared.d.ts +8 -10
- package/lib/runsValidateShared.js +41 -15
- package/lib/runsValidateStages.d.ts +1 -1
- package/lib/runsValidateStages.js +90 -50
- package/lib/runtimeProvision.js +10 -2
- package/lib/skillAuthored.d.ts +50 -0
- package/lib/skillAuthored.js +178 -0
- package/lib/skillFs.js +3 -0
- package/lib/skillPlane.d.ts +40 -2
- package/lib/skillPlane.js +63 -13
- package/lib/skillRegistry.d.ts +24 -1
- package/lib/skillRegistry.js +69 -5
- package/lib/skillRows.d.ts +13 -3
- package/lib/skillRows.js +52 -9
- package/lib/vocab.d.ts +29 -0
- package/lib/vocab.js +78 -0
- package/package.json +24 -14
- package/lib/resurrect.d.ts +0 -6
- package/lib/resurrect.js +0 -18
package/lib/skillPlane.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SkillDraft } from "./skillAuthored.js";
|
|
1
2
|
import type { FlowsSeat } from "./flowsData.js";
|
|
2
3
|
import type { FamilyModelsSeat } from "./flowsFamilyCompose.js";
|
|
3
4
|
export { disclosureRoot } from "./skillFs.js";
|
|
@@ -73,7 +74,28 @@ export interface BindingRow {
|
|
|
73
74
|
readonly skills: number;
|
|
74
75
|
readonly entrance: string | null;
|
|
75
76
|
}
|
|
76
|
-
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
export declare function buildSkillIndex(repo: string, queueStateRoot?: string): Record<string, unknown>;
|
|
77
99
|
/** The inline agent block (lane_disclosure._agent_block 780-793):
|
|
78
100
|
|
|
79
101
|
/** Skill lookup across flow + model + card rows
|
|
@@ -82,7 +104,7 @@ export declare function buildSkillIndex(repo: string): Record<string, unknown>;
|
|
|
82
104
|
/** @param modelsSeat the context's models service when mounted — the
|
|
83
105
|
* flow rows compose from the seat the runs doors thread (the
|
|
84
106
|
* lane-seat law); the booted singleton otherwise */
|
|
85
|
-
export declare function findSkill(repo: string, sid: string, modelsSeat?: FamilyModelsSeat | null, flowsSeat?: FlowsSeat | null): {
|
|
107
|
+
export declare function findSkill(repo: string, sid: string, modelsSeat?: FamilyModelsSeat | null, flowsSeat?: FlowsSeat | null, stateRoot?: string): {
|
|
86
108
|
row: SkillRow;
|
|
87
109
|
path: string | null;
|
|
88
110
|
bodyText: string | null;
|
|
@@ -96,4 +118,20 @@ export declare function hSkillRead(repo: string, stateRoot: string, sid: string,
|
|
|
96
118
|
status: number;
|
|
97
119
|
payload: unknown;
|
|
98
120
|
};
|
|
121
|
+
/** POST /v1/skills: land one authored skill doc (the agent's write
|
|
122
|
+
* door — melite_skill_write). The doc lands in the state root's
|
|
123
|
+
* authored plane and the same walk that serves tracked skills serves
|
|
124
|
+
* it: written and read are one law. The write ledgers skill.write,
|
|
125
|
+
* so which skills the agent authored is auditable exactly as which
|
|
126
|
+
* it read.
|
|
127
|
+
* @param repo the checkout root (the family seat is verified there)
|
|
128
|
+
* @param stateRoot the estate's state root
|
|
129
|
+
* @param draft the skill as the door's caller stated it
|
|
130
|
+
* @returns 200 with the served answer, or 400 carrying the refusal
|
|
131
|
+
* voice (missing field, unsafe leaf, unseated family, or an
|
|
132
|
+
* existing doc without replace) */
|
|
133
|
+
export declare function hSkillWrite(repo: string, stateRoot: string, draft: SkillDraft): {
|
|
134
|
+
status: number;
|
|
135
|
+
payload: unknown;
|
|
136
|
+
};
|
|
99
137
|
//# sourceMappingURL=skillPlane.d.ts.map
|
package/lib/skillPlane.js
CHANGED
|
@@ -18,6 +18,7 @@ import { readFileSync } from "node:fs";
|
|
|
18
18
|
import { join } from "node:path";
|
|
19
19
|
import { benchPicksSync } from "./bench.js";
|
|
20
20
|
import { appendLedger } from "./queue.js";
|
|
21
|
+
import { writeAuthoredSkill } from "./skillAuthored.js";
|
|
21
22
|
import { engineDirs, modelRows, cardRows, flowRows } from "./skillRows.js";
|
|
22
23
|
// the extracted planes re-export through the skill plane's door
|
|
23
24
|
export { disclosureRoot } from "./skillFs.js";
|
|
@@ -58,7 +59,28 @@ export function wireSkill(r) {
|
|
|
58
59
|
out["step_count"] = r.stepCount;
|
|
59
60
|
return out;
|
|
60
61
|
}
|
|
61
|
-
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
export function buildSkillIndex(repo, queueStateRoot) {
|
|
62
84
|
const engines = engineDirs(join(repo, "packages", "engines"));
|
|
63
85
|
const families = new Map();
|
|
64
86
|
const cards = new Map();
|
|
@@ -70,14 +92,17 @@ export function buildSkillIndex(repo) {
|
|
|
70
92
|
// vocabulary door is melite_discover (a paid tool call), never
|
|
71
93
|
// this index. The full-catalog dump below was the last leak —
|
|
72
94
|
// it handed the agent every card entrance for one cheap scan.
|
|
73
|
-
// ONE ROOT (audit 004/C1
|
|
74
|
-
// tree
|
|
75
|
-
//
|
|
76
|
-
//
|
|
77
|
-
//
|
|
78
|
-
//
|
|
79
|
-
//
|
|
80
|
-
const
|
|
95
|
+
// ONE ROOT (audit 004/C1; the §8.3 orphan cure): the bench
|
|
96
|
+
// reader rides the WRITER's tree, <queueStateRoot>/storage —
|
|
97
|
+
// the same derivation the composition hands the drafts row
|
|
98
|
+
// (one root spelled once per side, one identity behind both).
|
|
99
|
+
// The MELITE_BENCH_STORAGE seam (race-class rec 1, debt 11)
|
|
100
|
+
// still moves writer AND reader together — never the reader
|
|
101
|
+
// alone; the walls pin it over any caller root.
|
|
102
|
+
const writerRoot = queueStateRoot === undefined ? undefined : join(queueStateRoot, "storage");
|
|
103
|
+
const picks = benchPicksSync(process.env["MELITE_BENCH_STORAGE"] ??
|
|
104
|
+
writerRoot ??
|
|
105
|
+
join(repo, "data", "runs", "storage"));
|
|
81
106
|
const pickedCards = new Set(picks.map((p) => p.card).filter((c) => c !== null));
|
|
82
107
|
const pickedModels = new Set(picks.map((p) => p.model).filter((m) => m !== null));
|
|
83
108
|
const selectionEmpty = pickedCards.size === 0 && pickedModels.size === 0;
|
|
@@ -93,7 +118,7 @@ export function buildSkillIndex(repo) {
|
|
|
93
118
|
};
|
|
94
119
|
}
|
|
95
120
|
for (const engine of engines) {
|
|
96
|
-
for (const r of modelRows(engine)) {
|
|
121
|
+
for (const r of modelRows(engine, queueStateRoot)) {
|
|
97
122
|
if (r.row.scope.endsWith("-spawn"))
|
|
98
123
|
continue;
|
|
99
124
|
const mid = r.row.model;
|
|
@@ -162,7 +187,7 @@ export function buildSkillIndex(repo) {
|
|
|
162
187
|
/** @param modelsSeat the context's models service when mounted — the
|
|
163
188
|
* flow rows compose from the seat the runs doors thread (the
|
|
164
189
|
* lane-seat law); the booted singleton otherwise */
|
|
165
|
-
export function findSkill(repo, sid, modelsSeat, flowsSeat) {
|
|
190
|
+
export function findSkill(repo, sid, modelsSeat, flowsSeat, stateRoot) {
|
|
166
191
|
for (const fr of flowRows(repo, modelsSeat, flowsSeat)) {
|
|
167
192
|
if (fr.row.id === sid) {
|
|
168
193
|
return { row: fr.row, path: fr.bodyPath, bodyText: fr.bodyText };
|
|
@@ -170,7 +195,7 @@ export function findSkill(repo, sid, modelsSeat, flowsSeat) {
|
|
|
170
195
|
}
|
|
171
196
|
const engines = engineDirs(join(repo, "packages", "engines"));
|
|
172
197
|
for (const engine of engines) {
|
|
173
|
-
for (const r of modelRows(engine)) {
|
|
198
|
+
for (const r of modelRows(engine, stateRoot)) {
|
|
174
199
|
if (r.row.id === sid)
|
|
175
200
|
return { row: r.row, path: r.bodyText === undefined ? r.path : null, bodyText: r.bodyText ?? null };
|
|
176
201
|
}
|
|
@@ -188,7 +213,7 @@ export function findSkill(repo, sid, modelsSeat, flowsSeat) {
|
|
|
188
213
|
* same seat-threading law as findSkill) */
|
|
189
214
|
export function hSkillRead(repo, stateRoot, sid, modelsSeat, flowsSeat) {
|
|
190
215
|
try {
|
|
191
|
-
const found = findSkill(repo, sid, modelsSeat, flowsSeat);
|
|
216
|
+
const found = findSkill(repo, sid, modelsSeat, flowsSeat, stateRoot);
|
|
192
217
|
if (found === null) {
|
|
193
218
|
return { status: 404, payload: { error: "no such skill: " + JSON.stringify(sid) } };
|
|
194
219
|
}
|
|
@@ -266,4 +291,29 @@ export function hSkillRead(repo, stateRoot, sid, modelsSeat, flowsSeat) {
|
|
|
266
291
|
return { status: 500, payload: { error: e.message } };
|
|
267
292
|
}
|
|
268
293
|
}
|
|
294
|
+
/** POST /v1/skills: land one authored skill doc (the agent's write
|
|
295
|
+
* door — melite_skill_write). The doc lands in the state root's
|
|
296
|
+
* authored plane and the same walk that serves tracked skills serves
|
|
297
|
+
* it: written and read are one law. The write ledgers skill.write,
|
|
298
|
+
* so which skills the agent authored is auditable exactly as which
|
|
299
|
+
* it read.
|
|
300
|
+
* @param repo the checkout root (the family seat is verified there)
|
|
301
|
+
* @param stateRoot the estate's state root
|
|
302
|
+
* @param draft the skill as the door's caller stated it
|
|
303
|
+
* @returns 200 with the served answer, or 400 carrying the refusal
|
|
304
|
+
* voice (missing field, unsafe leaf, unseated family, or an
|
|
305
|
+
* existing doc without replace) */
|
|
306
|
+
export function hSkillWrite(repo, stateRoot, draft) {
|
|
307
|
+
try {
|
|
308
|
+
const written = writeAuthoredSkill(repo, stateRoot, draft);
|
|
309
|
+
appendLedger(stateRoot, "skill.write", { id: written.id, path: written.path, replaced: written.replaced });
|
|
310
|
+
return { status: 200, payload: written };
|
|
311
|
+
}
|
|
312
|
+
catch (e) {
|
|
313
|
+
return {
|
|
314
|
+
status: 400,
|
|
315
|
+
payload: { error: e instanceof Error ? e.message : String(e) },
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
}
|
|
269
319
|
//# sourceMappingURL=skillPlane.js.map
|
package/lib/skillRegistry.d.ts
CHANGED
|
@@ -1,13 +1,36 @@
|
|
|
1
1
|
import { Service } from "@deepseek-ai/cordis";
|
|
2
2
|
import type { Context } from "@deepseek-ai/cordis";
|
|
3
|
+
declare module "@deepseek-ai/dsh-typert-protocol" {
|
|
4
|
+
interface RemoteErrorDetailsMap {
|
|
5
|
+
/** The writer refused the draft (its own verbatim voice). */
|
|
6
|
+
"melite/skill-refused": Record<string, never>;
|
|
7
|
+
/** No skill carries that id (the read door's absence). */
|
|
8
|
+
"melite/skill-unknown": {
|
|
9
|
+
readonly skillId: string;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
}
|
|
3
13
|
export declare class SkillDirectoryService extends Service {
|
|
4
14
|
static inject: string[];
|
|
5
15
|
constructor(ctx: Context);
|
|
6
|
-
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
7
23
|
index(): Record<string, unknown>;
|
|
8
24
|
/** GET /v1/skills/:id — the doc; 404s answer the door's voice
|
|
9
25
|
* ("no such skill: <id>"), the read ledgers skill.read. */
|
|
10
26
|
read(sid: string, signal: AbortSignal): Record<string, unknown>;
|
|
27
|
+
/** POST /v1/skills — the agent's write door (melite_skill_write):
|
|
28
|
+
* land one authored skill doc. The body is the WIRE (untyped JSON),
|
|
29
|
+
* so the fields are validated here, once; the plane's writer owns
|
|
30
|
+
* the law and speaks the refusal voice. The doc lands in the state
|
|
31
|
+
* root's authored plane and the same walk that serves tracked
|
|
32
|
+
* skills serves it — written and read are one law. */
|
|
33
|
+
write(body: unknown): Record<string, unknown>;
|
|
11
34
|
}
|
|
12
35
|
/** The skills row: gates on the queue seat (the ledger seam). */
|
|
13
36
|
export declare const skillProvider: {
|
package/lib/skillRegistry.js
CHANGED
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
//
|
|
6
6
|
// Erasable-syntax TS only (node --experimental-strip-types).
|
|
7
7
|
import { Service } from "@deepseek-ai/cordis";
|
|
8
|
+
import { RemoteError } from "@deepseek-ai/dsh-typert-protocol";
|
|
8
9
|
import { resolveRepoRoot } from "@melite/comfyui-cordis";
|
|
9
|
-
import { buildSkillIndex, hSkillRead } from "./skillPlane.js";
|
|
10
|
+
import { buildSkillIndex, hSkillRead, hSkillWrite } from "./skillPlane.js";
|
|
10
11
|
// ROLE (cookbook adding-a-package role table): Directory: index/read over skill docs. Key "meliteSkills" —
|
|
11
12
|
|
|
12
13
|
// dsh-skill package registers `super(ctx, "skills")`, and in any
|
|
@@ -21,9 +22,15 @@ export class SkillDirectoryService extends Service {
|
|
|
21
22
|
constructor(ctx) {
|
|
22
23
|
super(ctx, "meliteSkills");
|
|
23
24
|
}
|
|
24
|
-
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
25
32
|
index() {
|
|
26
|
-
return buildSkillIndex(resolveRepoRoot());
|
|
33
|
+
return buildSkillIndex(resolveRepoRoot(), this.ctx.queue.stateRoot);
|
|
27
34
|
}
|
|
28
35
|
/** GET /v1/skills/:id — the doc; 404s answer the door's voice
|
|
29
36
|
* ("no such skill: <id>"), the read ledgers skill.read. */
|
|
@@ -37,12 +44,69 @@ export class SkillDirectoryService extends Service {
|
|
|
37
44
|
if (answer.status === 200)
|
|
38
45
|
return answer.payload;
|
|
39
46
|
const err = answer.payload;
|
|
40
|
-
|
|
47
|
+
const message = typeof err.error === "string"
|
|
41
48
|
? err.error
|
|
42
49
|
:
|
|
43
50
|
|
|
44
|
-
"skill read failed"
|
|
51
|
+
"skill read failed";
|
|
52
|
+
// 404-class: the id names nothing (the door's absence, never a
|
|
53
|
+
// transport failure)
|
|
54
|
+
throw new RemoteError("melite/skill-unknown", message, { skillId: sid });
|
|
45
55
|
}
|
|
56
|
+
/** POST /v1/skills — the agent's write door (melite_skill_write):
|
|
57
|
+
* land one authored skill doc. The body is the WIRE (untyped JSON),
|
|
58
|
+
* so the fields are validated here, once; the plane's writer owns
|
|
59
|
+
* the law and speaks the refusal voice. The doc lands in the state
|
|
60
|
+
* root's authored plane and the same walk that serves tracked
|
|
61
|
+
* skills serves it — written and read are one law. */
|
|
62
|
+
write(body) {
|
|
63
|
+
const draft = parseDraft(body);
|
|
64
|
+
const answer = hSkillWrite(resolveRepoRoot(), this.ctx.queue.stateRoot, draft);
|
|
65
|
+
if (answer.status === 200)
|
|
66
|
+
return answer.payload;
|
|
67
|
+
const err = answer.payload;
|
|
68
|
+
const message = typeof err.error === "string"
|
|
69
|
+
? err.error
|
|
70
|
+
: /* v8 ignore next -- the writer always shapes { error: string } */
|
|
71
|
+
"skill write failed";
|
|
72
|
+
// 400-class: the draft is the caller's to fix (the writer's
|
|
73
|
+
// voice rides verbatim)
|
|
74
|
+
throw new RemoteError("melite/skill-refused", message, {});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/** A wire string ("" for anything else — the writer refuses the
|
|
78
|
+
* empty required fields with its own voice). */
|
|
79
|
+
function wireStr(v) {
|
|
80
|
+
return typeof v === "string" ? v.trim() : "";
|
|
81
|
+
}
|
|
82
|
+
/** A wire string list (non-strings dropped rather than stringified:
|
|
83
|
+
* an example the caller did not state is never invented). */
|
|
84
|
+
function wireList(v) {
|
|
85
|
+
if (!Array.isArray(v))
|
|
86
|
+
return [];
|
|
87
|
+
const out = [];
|
|
88
|
+
for (const x of v) {
|
|
89
|
+
if (typeof x !== "string")
|
|
90
|
+
continue;
|
|
91
|
+
const t = x.trim();
|
|
92
|
+
if (t !== "")
|
|
93
|
+
out.push(t);
|
|
94
|
+
}
|
|
95
|
+
return out;
|
|
96
|
+
}
|
|
97
|
+
/** The wire body as the draft the plane validates. */
|
|
98
|
+
function parseDraft(body) {
|
|
99
|
+
const b = (typeof body === "object" && body !== null ? body : {});
|
|
100
|
+
return {
|
|
101
|
+
model: wireStr(b.model),
|
|
102
|
+
name: wireStr(b.name),
|
|
103
|
+
description: wireStr(b.description),
|
|
104
|
+
trigger_words: wireList(b.trigger_words),
|
|
105
|
+
examples: wireList(b.examples),
|
|
106
|
+
body: wireStr(b.body),
|
|
107
|
+
lora: wireStr(b.lora),
|
|
108
|
+
replace: b.replace === true,
|
|
109
|
+
};
|
|
46
110
|
}
|
|
47
111
|
/** The skills row: gates on the queue seat (the ledger seam). */
|
|
48
112
|
export const skillProvider = {
|
package/lib/skillRows.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { DocRow, SkillRow } from "./skillPlane.js";
|
|
2
2
|
import type { FlowsSeat } from "./flowsData.js";
|
|
3
3
|
import type { FamilyModelsSeat } from "./flowsFamilyCompose.js";
|
|
4
|
-
/** One registry
|
|
4
|
+
/** One registry flow-tool property, projected to the frozen
|
|
5
5
|
* FlowToolDecl shape (always ptype + description; enum / default /
|
|
6
6
|
* minimum / maximum ride only when the registry declares them —
|
|
7
7
|
* nulls never serve). */
|
|
@@ -38,7 +38,7 @@ interface FlowDecl {
|
|
|
38
38
|
* silently — the registry is code, so a declaration bug throws LOUD
|
|
39
39
|
* out of expandRegistryFlow instead of marking a row). Skips the
|
|
40
40
|
* registry when flows/ is absent (_flow_rows 387-388: not-a-dir
|
|
41
|
-
* -> []). The
|
|
41
|
+
* -> []). The flow tool rides the registry declaration
|
|
42
42
|
* verbatim (projected to the frozen row shape); hasSkillMd reads
|
|
43
43
|
* the flows/<id>/SKILL.md leaf live. skillRefs ride the registry
|
|
44
44
|
* declaration (empty today — the frozen refs pointed at the RETIRED flow.py rows and the retired enhance recipes).
|
|
@@ -67,7 +67,17 @@ export declare function spawnRows(cdir: string, prefix: string, scope: "card-spa
|
|
|
67
67
|
export declare function engineDirs(enginesRoot: string): string[];
|
|
68
68
|
/** LEVEL 1+3 model docs (lane_disclosure._model_rows 259-312):
|
|
69
69
|
* GUIDE.md / agents/AGENT.md / agents/skills/* per model dir. */
|
|
70
|
-
|
|
70
|
+
/** THE AUTHORED SKILL WALK (skillAuthored.ts): docs the agent wrote
|
|
71
|
+
* live under <stateRoot>/skills/<family>/<stem>/SKILL.md and serve
|
|
72
|
+
* under the per-model id shape (`model:<family>:<stem>`), so a
|
|
73
|
+
* written skill is discoverable in melite_load and read by
|
|
74
|
+
* melite_skill_read with no extra door.
|
|
75
|
+
* @param stateRoot the estate's state root (the authored plane)
|
|
76
|
+
* @param mid the model family id
|
|
77
|
+
* @param genre the family's genre, for the row's scoping
|
|
78
|
+
* @returns rows in stem order (a stable index) */
|
|
79
|
+
export declare function authoredRows(stateRoot: string, mid: string, genre: string | null): DocRow[];
|
|
80
|
+
export declare function modelRows(engine: string, stateRoot?: string): DocRow[];
|
|
71
81
|
export interface CardWalk {
|
|
72
82
|
readonly rows: DocRow[];
|
|
73
83
|
readonly buckets: Map<string, {
|
package/lib/skillRows.js
CHANGED
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
// skillPlane.ts): tool properties, flow declarations, doc/spawn
|
|
3
3
|
// rows, engine/model/card/flow rows — module truth over paths.
|
|
4
4
|
import { readdirSync } from "node:fs";
|
|
5
|
-
import { join } from "node:path";
|
|
5
|
+
import { basename, join } from "node:path";
|
|
6
6
|
import { DIR_ID_ALIASES, isDir, isFile, subdirs, readText, stem } from "./skillFs.js";
|
|
7
|
+
import { authoredSkillDoc } from "./skillAuthored.js";
|
|
7
8
|
import { frontmatter, gateSkill } from "./skillFrontmatter.js";
|
|
8
9
|
import { LaneWireError } from "./skillPlane.js";
|
|
9
10
|
import { expandRegistryFlow, registrySkillBody, seedFlowsSeat } from "./flowsData.js";
|
|
10
11
|
import { composeFamilyStages, liveFamilySeat } from "./flowsFamilyCompose.js";
|
|
11
|
-
/** One registry
|
|
12
|
+
/** One registry flow-tool property, projected to the frozen
|
|
12
13
|
* FlowToolDecl shape (always ptype + description; enum / default /
|
|
13
14
|
* minimum / maximum ride only when the registry declares them —
|
|
14
15
|
* nulls never serve). */
|
|
@@ -36,7 +37,7 @@ export function projectToolProperties(properties) {
|
|
|
36
37
|
* silently — the registry is code, so a declaration bug throws LOUD
|
|
37
38
|
* out of expandRegistryFlow instead of marking a row). Skips the
|
|
38
39
|
* registry when flows/ is absent (_flow_rows 387-388: not-a-dir
|
|
39
|
-
* -> []). The
|
|
40
|
+
* -> []). The flow tool rides the registry declaration
|
|
40
41
|
* verbatim (projected to the frozen row shape); hasSkillMd reads
|
|
41
42
|
* the flows/<id>/SKILL.md leaf live. skillRefs ride the registry
|
|
42
43
|
* declaration (empty today — the frozen refs pointed at the RETIRED flow.py rows and the retired enhance recipes).
|
|
@@ -115,8 +116,9 @@ export function readDoc(path, sid, scope, genre, card, model) {
|
|
|
115
116
|
if (text === null)
|
|
116
117
|
return null;
|
|
117
118
|
const fm = frontmatter(text);
|
|
118
|
-
// (
|
|
119
|
-
|
|
119
|
+
// (basename: the doc path is a native fs path — a posix split
|
|
120
|
+
// pins the leaf wrong on win32, where the separator is "\")
|
|
121
|
+
const leaf = basename(path);
|
|
120
122
|
const gated = gateSkill(sid, fm.name !== "" ? fm.name : stem(leaf),
|
|
121
123
|
|
|
122
124
|
// long prompts and skills — that is intentional"): the authored
|
|
@@ -242,7 +244,37 @@ function familyLane(mdir, mid, genre, skillRows) {
|
|
|
242
244
|
}
|
|
243
245
|
/** LEVEL 1+3 model docs (lane_disclosure._model_rows 259-312):
|
|
244
246
|
* GUIDE.md / agents/AGENT.md / agents/skills/* per model dir. */
|
|
245
|
-
|
|
247
|
+
/** THE AUTHORED SKILL WALK (skillAuthored.ts): docs the agent wrote
|
|
248
|
+
* live under <stateRoot>/skills/<family>/<stem>/SKILL.md and serve
|
|
249
|
+
* under the per-model id shape (`model:<family>:<stem>`), so a
|
|
250
|
+
* written skill is discoverable in melite_load and read by
|
|
251
|
+
* melite_skill_read with no extra door.
|
|
252
|
+
* @param stateRoot the estate's state root (the authored plane)
|
|
253
|
+
* @param mid the model family id
|
|
254
|
+
* @param genre the family's genre, for the row's scoping
|
|
255
|
+
* @returns rows in stem order (a stable index) */
|
|
256
|
+
export function authoredRows(stateRoot, mid, genre) {
|
|
257
|
+
const rows = [];
|
|
258
|
+
const root = join(stateRoot, "skills", mid);
|
|
259
|
+
let names;
|
|
260
|
+
try {
|
|
261
|
+
names = readdirSync(root).sort();
|
|
262
|
+
}
|
|
263
|
+
catch {
|
|
264
|
+
// no authored skill for this family (the absent root is the
|
|
265
|
+
// empty case, never an error)
|
|
266
|
+
return rows;
|
|
267
|
+
}
|
|
268
|
+
for (const sname of names) {
|
|
269
|
+
if (sname.startsWith("."))
|
|
270
|
+
continue;
|
|
271
|
+
const r = readDoc(authoredSkillDoc(stateRoot, mid, sname), "model:" + mid + ":" + sname, "model-skill", genre, null, mid);
|
|
272
|
+
if (r !== null)
|
|
273
|
+
rows.push(r);
|
|
274
|
+
}
|
|
275
|
+
return rows;
|
|
276
|
+
}
|
|
277
|
+
export function modelRows(engine, stateRoot) {
|
|
246
278
|
const rows = [];
|
|
247
279
|
const modelsRoot = join(engine, "models");
|
|
248
280
|
if (!isDir(modelsRoot))
|
|
@@ -256,6 +288,14 @@ export function modelRows(engine) {
|
|
|
256
288
|
const agent = readDoc(join(mdir, "agents", "AGENT.md"), "model:" + mid, "model", genre, null, mid);
|
|
257
289
|
if (agent !== null)
|
|
258
290
|
rows.push(agent);
|
|
291
|
+
// THE AUTHORED PLANE (skillAuthored.ts): the agent writes skills
|
|
292
|
+
// into the state root — a written doc is walked here so the same
|
|
293
|
+
// index and read doors serve it as the tracked ones (the lora
|
|
294
|
+
// hand-off's skill lands this way).
|
|
295
|
+
if (stateRoot !== undefined) {
|
|
296
|
+
for (const r of authoredRows(stateRoot, mid, genre))
|
|
297
|
+
rows.push(r);
|
|
298
|
+
}
|
|
259
299
|
// THE SPAWN PLANE (subagent-only; the index filters, the
|
|
260
300
|
// spawn reader resolves — never listed to the constructor).
|
|
261
301
|
// Walked BEFORE the skills loop: a spawn-only model dir (no
|
|
@@ -267,6 +307,7 @@ export function modelRows(engine) {
|
|
|
267
307
|
let sks;
|
|
268
308
|
try {
|
|
269
309
|
sks = readdirSync(join(mdir, "agents", "skills")).sort();
|
|
310
|
+
// a model dir with no agents/skills subtree ships no skills of its own — the skip is the answer, its spawn rows already walked above
|
|
270
311
|
}
|
|
271
312
|
catch {
|
|
272
313
|
continue;
|
|
@@ -339,9 +380,10 @@ export function cardUnitDirs(engine, repo) {
|
|
|
339
380
|
// owner is comfyui-cordis (factsPath in cardsRegistry.ts hardcodes it;
|
|
340
381
|
// packages/engines/comfyui/src/ holds only action_cards tenants, it is
|
|
341
382
|
// never itself an engine entry).
|
|
342
|
-
// (
|
|
343
|
-
//
|
|
344
|
-
|
|
383
|
+
// (basename: engine is a native fs path — a posix split never
|
|
384
|
+
// matches on win32, so the owner-engine gate misfired and the
|
|
385
|
+
// domains walk came back empty there)
|
|
386
|
+
if (basename(engine) !== "comfyui-cordis")
|
|
345
387
|
return out.sort((a, b) => (a.cname < b.cname ? -1 : a.cname > b.cname ? 1 : /* v8 ignore next */ 0));
|
|
346
388
|
for (const genre of ["3d", "audio", "image", "motion", "video"]) {
|
|
347
389
|
const droot = join(repo, "packages", genre);
|
|
@@ -382,6 +424,7 @@ export function cardRows(engine, repo) {
|
|
|
382
424
|
let sks;
|
|
383
425
|
try {
|
|
384
426
|
sks = readdirSync(join(cdir, "agents", "skills")).sort();
|
|
427
|
+
// a card dir with no agents/skills subtree ships no skills — the empty list lets the walk fall through to the spawn plane
|
|
385
428
|
}
|
|
386
429
|
catch {
|
|
387
430
|
sks = [];
|
package/lib/vocab.d.ts
CHANGED
|
@@ -3,4 +3,33 @@ export declare const RETIRED_RUNNER_KNOBS: readonly string[];
|
|
|
3
3
|
export declare const RETIRED_CARRY_KEYS: readonly string[];
|
|
4
4
|
/** The door vocabulary _strict_body allows past the `_` gate. */
|
|
5
5
|
export declare const DOOR_KEYS: readonly string[];
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
export declare const CARD_ENVELOPE_KEYS: readonly string[];
|
|
6
35
|
//# sourceMappingURL=vocab.d.ts.map
|
package/lib/vocab.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
// ONCE in gateway-core params.ts; that package is dead, and the
|
|
4
4
|
|
|
5
|
+
import { WIRE_STAGE_KEYS } from "@melite/contracts/benchStage";
|
|
5
6
|
export const RETIRED_RUNNER_KNOBS = [
|
|
6
7
|
"start_from",
|
|
7
8
|
"stop_after",
|
|
@@ -15,4 +16,81 @@ export const RETIRED_RUNNER_KNOBS = [
|
|
|
15
16
|
export const RETIRED_CARRY_KEYS = ["pipe", "stage_id"];
|
|
16
17
|
/** The door vocabulary _strict_body allows past the `_` gate. */
|
|
17
18
|
export const DOOR_KEYS = ["yaml", "flow", "flow_inline", "model"];
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
export const CARD_ENVELOPE_KEYS = [
|
|
48
|
+
...DOOR_KEYS,
|
|
49
|
+
// …every wire coordinate EXCEPT `params` — and the exception is the
|
|
50
|
+
// load-bearing one. `params` is the row's knob CONTAINER: the run
|
|
51
|
+
// body's `{model, params:{…}}` stanza is what liftCardParams
|
|
52
|
+
// unwraps (the stanza law, benchStage's own), and filtering the
|
|
53
|
+
// container BEFORE that unwrap would drop every knob a caller sent
|
|
54
|
+
// — the first cut of this list did exactly that and turned every
|
|
55
|
+
// run into "this lane requires 'prompt'". A coordinate selects the
|
|
56
|
+
// graph; the knobs ride inside `params`, never as a key of it.
|
|
57
|
+
...WIRE_STAGE_KEYS.filter((k) => k !== "params"),
|
|
58
|
+
"draft_id",
|
|
59
|
+
"test",
|
|
60
|
+
"service",
|
|
61
|
+
// press_key is the submit door's retry-dedup coordinate
|
|
62
|
+
// (queueSubmit names ONE press across retries) — door
|
|
63
|
+
// vocabulary, never a card knob. It rode unregistered and the
|
|
64
|
+
// live Run press refused "unknown param(s) … press_key" while the
|
|
65
|
+
|
|
66
|
+
// no wall drove a press_key-carrying body.
|
|
67
|
+
"press_key",
|
|
68
|
+
// bench_stage_id is the SINGLE-CARD press's bench identity (the
|
|
69
|
+
|
|
70
|
+
// vocabulary — the card never sees it as a knob, and the composed
|
|
71
|
+
// stage stamps it (runsRegistry's card arm) so the run sidecar's
|
|
72
|
+
// digest names the row the operator pressed, which is what the
|
|
73
|
+
// bench read's `last_run` binds to. Unregistered, it would land in
|
|
74
|
+
// every card's params as an unknown knob and refuse the press.
|
|
75
|
+
"bench_stage_id",
|
|
76
|
+
// seeds is the submit door's seed-sweep coordinate (friction #9,
|
|
77
|
+
|
|
78
|
+
// door vocabulary consumed before any card composes, never a card
|
|
79
|
+
// knob. The per-run body carries the SEAT's `seed` (a real knob,
|
|
80
|
+
// deliberately NOT on this list — liftCardParams must carry it
|
|
81
|
+
// into the card's params); the sweep key itself rides the envelope.
|
|
82
|
+
"seeds",
|
|
83
|
+
// the bench row's own non-wire coordinates (benchStage's stage row
|
|
84
|
+
// carries these beside the wire keys; they select, they never ride)
|
|
85
|
+
"author",
|
|
86
|
+
"rev",
|
|
87
|
+
"stage",
|
|
88
|
+
"title",
|
|
89
|
+
"inputOutputs",
|
|
90
|
+
"result",
|
|
91
|
+
"runStatus",
|
|
92
|
+
"expect_rev",
|
|
93
|
+
"provenance",
|
|
94
|
+
"capability",
|
|
95
|
+
];
|
|
18
96
|
//# sourceMappingURL=vocab.js.map
|