@eir-labs/coltrane 0.5.1 → 0.7.2
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 +23 -0
- package/agents/bill.json +59 -0
- package/agents/deploy-agent.json +68 -0
- package/agents/deploy-scout.json +40 -0
- package/agents/john.json +42 -0
- package/agents/miles.json +44 -0
- package/charts/software-delivery-v1.json +9 -0
- package/charts/software-delivery-v2.json +39 -0
- package/dist/src/bifrost_invoker.js +5 -3
- package/dist/src/bifrost_invoker.js.map +1 -1
- package/dist/src/canonical_form.d.ts +23 -0
- package/dist/src/canonical_form.js +53 -0
- package/dist/src/canonical_form.js.map +1 -1
- package/dist/src/chart.d.ts +254 -0
- package/dist/src/chart.js +897 -0
- package/dist/src/chart.js.map +1 -0
- package/dist/src/claude_invoker.d.ts +20 -3
- package/dist/src/claude_invoker.js +30 -5
- package/dist/src/claude_invoker.js.map +1 -1
- package/dist/src/cli.d.ts +19 -4
- package/dist/src/cli.js +132 -9
- package/dist/src/cli.js.map +1 -1
- package/dist/src/composition.d.ts +24 -0
- package/dist/src/composition.js +50 -5
- package/dist/src/composition.js.map +1 -1
- package/dist/src/conduct_daemon.d.ts +59 -0
- package/dist/src/conduct_daemon.js +178 -0
- package/dist/src/conduct_daemon.js.map +1 -0
- package/dist/src/genome_schema.d.ts +1476 -146
- package/dist/src/genome_schema.js +438 -32
- package/dist/src/genome_schema.js.map +1 -1
- package/dist/src/genome_store.d.ts +79 -0
- package/dist/src/genome_store.js +503 -0
- package/dist/src/genome_store.js.map +1 -0
- package/dist/src/gig_tracker.d.ts +11 -1
- package/dist/src/gig_tracker.js +5 -0
- package/dist/src/gig_tracker.js.map +1 -1
- package/dist/src/hosted_tools.d.ts +23 -0
- package/dist/src/hosted_tools.js +170 -0
- package/dist/src/hosted_tools.js.map +1 -0
- package/dist/src/index.d.ts +4 -0
- package/dist/src/index.js +4 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/ledger.d.ts +22 -0
- package/dist/src/ledger.js +4 -0
- package/dist/src/ledger.js.map +1 -1
- package/dist/src/loader.d.ts +9 -1
- package/dist/src/loader.js +105 -5
- package/dist/src/loader.js.map +1 -1
- package/dist/src/mcp.js +52 -5
- package/dist/src/mcp.js.map +1 -1
- package/dist/src/output_mirror.d.ts +70 -0
- package/dist/src/output_mirror.js +381 -0
- package/dist/src/output_mirror.js.map +1 -0
- package/dist/src/outputs.d.ts +77 -1
- package/dist/src/outputs.js +179 -37
- package/dist/src/outputs.js.map +1 -1
- package/dist/src/play_worker.d.ts +24 -0
- package/dist/src/play_worker.js +49 -0
- package/dist/src/play_worker.js.map +1 -0
- package/dist/src/registry.d.ts +2 -0
- package/dist/src/registry.js +63 -33
- package/dist/src/registry.js.map +1 -1
- package/dist/src/reuse.d.ts +56 -0
- package/dist/src/reuse.js +0 -0
- package/dist/src/reuse.js.map +1 -1
- package/dist/src/runtime.d.ts +91 -2
- package/dist/src/runtime.js +236 -18
- package/dist/src/runtime.js.map +1 -1
- package/dist/src/seal_drill.d.ts +32 -0
- package/dist/src/seal_drill.js +138 -0
- package/dist/src/seal_drill.js.map +1 -0
- package/dist/src/server.d.ts +39 -1
- package/dist/src/server.js +760 -68
- package/dist/src/server.js.map +1 -1
- package/dist/src/skill_subprocess.js +12 -4
- package/dist/src/skill_subprocess.js.map +1 -1
- package/dist/src/supabase_genome.d.ts +28 -0
- package/dist/src/supabase_genome.js +49 -0
- package/dist/src/supabase_genome.js.map +1 -0
- package/dist/src/tool_surface.d.ts +5 -0
- package/dist/src/tool_surface.js +15 -0
- package/dist/src/tool_surface.js.map +1 -0
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/worker.d.ts +182 -0
- package/dist/src/worker.js +609 -0
- package/dist/src/worker.js.map +1 -0
- package/domain_types/branch-state.json +21 -0
- package/domain_types/change-context.json +39 -0
- package/domain_types/change-decision.json +36 -0
- package/domain_types/change-plan.json +47 -0
- package/domain_types/change-request.json +24 -0
- package/domain_types/change-set.json +46 -0
- package/domain_types/change-verdict.json +26 -0
- package/domain_types/deploy-verdict.json +23 -0
- package/domain_types/design-brief.json +37 -0
- package/domain_types/design-concept.json +36 -0
- package/domain_types/design-definition.json +37 -0
- package/domain_types/design-question.json +23 -0
- package/domain_types/design-verdict.json +27 -0
- package/domain_types/preview-deployment.json +32 -0
- package/institutions/quartet.json +344 -0
- package/package.json +21 -3
- package/skills/vercel-api/fixtures/error.json +10 -0
- package/skills/vercel-api/fixtures/ready.json +10 -0
- package/skills/vercel-api/fixtures/unsettled.json +10 -0
- package/skills/vercel-api/meta.json +10 -0
- package/skills/vercel-api/skill.mjs +63 -0
- package/standards/preview-deploy-v1.json +89 -0
- package/standards/product-design-v1.json +122 -0
- package/standards/promote-v1.json +41 -0
- package/standards/software-change-v1.json +147 -0
- package/venues/ci-deploy-room-v1.json +28 -0
- package/venues/empty-room-v1.json +19 -0
|
@@ -0,0 +1,503 @@
|
|
|
1
|
+
// genome_store.ts — the GenomeStore port. Governor ruling: GENOME IS NOT LOCAL. The hosted
|
|
2
|
+
// Coltrane MCP is the Coltrane MCP — the full tool surface, functioning against the Supabase
|
|
3
|
+
// store — so the engine needs ONE port for "where do definitions live", with two backings:
|
|
4
|
+
//
|
|
5
|
+
// * fileGenomeStore(root) — the existing loader/writer, unchanged behavior. Local dev
|
|
6
|
+
// and the stdio server keep reading/writing genome files on disk.
|
|
7
|
+
// * postgrestGenomeStore(ctx) — loads the five genome tables over PostgREST (the caller's
|
|
8
|
+
// bearer rides the Authorization header, so RLS is the scope) and reconstructs the SAME
|
|
9
|
+
// in-memory genome shape the file loader produces. Every record is validated through the
|
|
10
|
+
// genome_schema Zod parsers exactly as the loader does; rows that fail parse are load
|
|
11
|
+
// errors (LoadedGenome.load_errors — surfaced by system_health), never silent skips.
|
|
12
|
+
// Writes ride the coltrane_genome_upsert RPC as the caller.
|
|
13
|
+
//
|
|
14
|
+
// No new dependencies: plain fetch, and the Zod schemas the engine already owns.
|
|
15
|
+
import { mkdirSync, writeFileSync } from "node:fs";
|
|
16
|
+
import { join } from "node:path";
|
|
17
|
+
import { resolveGenome, GenomeLoadError, } from "./loader.js";
|
|
18
|
+
import { writeGenomeFileVersioned } from "./genome_writer.js";
|
|
19
|
+
import { defineAgent, composeStandard } from "./composition.js";
|
|
20
|
+
import { composeChart, chartEntrySeedTypes } from "./chart.js";
|
|
21
|
+
import { DomainTypeSchema, SkillSchema, ChartSchema, VenueSchema, venueDefect } from "./genome_schema.js";
|
|
22
|
+
import { domainTypeDefect } from "./registry.js";
|
|
23
|
+
import { CANONICAL_CORE_TYPES } from "./canonical_core_types.js";
|
|
24
|
+
const CLASS_SUBDIR = {
|
|
25
|
+
agent: "agents",
|
|
26
|
+
standard: "standards",
|
|
27
|
+
skill: "skills",
|
|
28
|
+
domain_type: "domain_types",
|
|
29
|
+
chart: "charts",
|
|
30
|
+
venue: "venues",
|
|
31
|
+
};
|
|
32
|
+
/** Local-dev backing: the existing loader/writer, behavior identical. load() is
|
|
33
|
+
* resolveGenome (manifest-aware, canonical-core seeding); upsert() writes the loadable
|
|
34
|
+
* file via the versioned writer (prior bytes snapshotted, atomic replace). Ledger sealing
|
|
35
|
+
* stays where it lives today — in the MCP tools (sealDefinition / sealAgentDefinition). */
|
|
36
|
+
export function fileGenomeStore(root) {
|
|
37
|
+
return {
|
|
38
|
+
async load() {
|
|
39
|
+
return resolveGenome(root);
|
|
40
|
+
},
|
|
41
|
+
async upsert(cls, payload) {
|
|
42
|
+
const slug = typeof payload["slug"] === "string" ? payload["slug"].trim() : "";
|
|
43
|
+
if (!slug)
|
|
44
|
+
throw new Error(`genome upsert: ${cls} payload has no slug`);
|
|
45
|
+
if (cls === "skill") {
|
|
46
|
+
// Skills are PACKAGE directories (the loader's only skill format) — mirror
|
|
47
|
+
// sealSkillPackage's file half: meta.json + code/md halves + fixtures.
|
|
48
|
+
const pkgDir = join(root, "skills", slug);
|
|
49
|
+
mkdirSync(pkgDir, { recursive: true });
|
|
50
|
+
const { fixtures, code, md, ...meta } = payload;
|
|
51
|
+
writeFileSync(join(pkgDir, "meta.json"), JSON.stringify(meta, null, 2) + "\n");
|
|
52
|
+
if (typeof code === "string")
|
|
53
|
+
writeFileSync(join(pkgDir, "skill.mjs"), code);
|
|
54
|
+
if (typeof md === "string")
|
|
55
|
+
writeFileSync(join(pkgDir, "skill.md"), md);
|
|
56
|
+
if (Array.isArray(fixtures)) {
|
|
57
|
+
const fxDir = join(pkgDir, "fixtures");
|
|
58
|
+
mkdirSync(fxDir, { recursive: true });
|
|
59
|
+
fixtures.forEach((fx, i) => writeFileSync(join(fxDir, `fixture-${String(i + 1).padStart(3, "0")}.json`), JSON.stringify(fx, null, 2) + "\n"));
|
|
60
|
+
}
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
writeGenomeFileVersioned(root, CLASS_SUBDIR[cls], slug, JSON.stringify(payload, null, 2) + "\n");
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
// ── PostgREST backing ─────────────────────────────────────────────────────────────
|
|
68
|
+
// The five genome tables and the columns the engine reads back. Row shapes are the
|
|
69
|
+
// round-tripped Supabase schema (org_id is RLS's concern, not the engine's).
|
|
70
|
+
const Q = {
|
|
71
|
+
core_types: "coltrane_core_types?select=slug,primitive,base_schema,description",
|
|
72
|
+
domain_types: "coltrane_domain_types?select=slug,version,extends,domain,status,schema,required_fields",
|
|
73
|
+
agents: "coltrane_agent_profiles?select=slug,version,status,primitives,input_types,output_types,domain," +
|
|
74
|
+
"identity,method,constraints,depth_profile,permissions,behavioral_primitives,skill_slots,default_skills,carried_skills",
|
|
75
|
+
standards: "coltrane_standards?select=slug,version,status,domain,phases,input_types,output_types",
|
|
76
|
+
skills: "coltrane_skills?select=slug,name,description,skill_md,tier,input_type,output_type,status",
|
|
77
|
+
charts: "coltrane_charts?select=slug,definition",
|
|
78
|
+
venues: "coltrane_venues?select=slug,definition",
|
|
79
|
+
};
|
|
80
|
+
async function restGet(ctx, pathAndQuery) {
|
|
81
|
+
const res = await fetch(`${ctx.baseUrl}/rest/v1/${pathAndQuery}`, {
|
|
82
|
+
headers: {
|
|
83
|
+
apikey: ctx.anonKey,
|
|
84
|
+
// The bearer authenticates via the header; RLS scopes what this caller may load.
|
|
85
|
+
Authorization: `Bearer ${ctx.bearer}`,
|
|
86
|
+
"Content-Type": "application/json",
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
const text = await res.text();
|
|
90
|
+
if (!res.ok) {
|
|
91
|
+
throw new GenomeLoadError(`genome load: GET ${pathAndQuery.split("?")[0]} → ${res.status}: ${text}`);
|
|
92
|
+
}
|
|
93
|
+
const parsed = text ? JSON.parse(text) : [];
|
|
94
|
+
return Array.isArray(parsed) ? parsed : [];
|
|
95
|
+
}
|
|
96
|
+
const zodWhy = (issues) => issues.map((i) => `${i.path.join(".") || "(root)"}: ${i.message}`).join("; ");
|
|
97
|
+
/** Build the engine AgentDef from an agent-profile row: the permissions jsonb unpacks to the
|
|
98
|
+
* flat schema fields; default_skills is the row's skill-binding column (skill_slugs). */
|
|
99
|
+
function agentDefFromRow(row) {
|
|
100
|
+
const perms = (row["permissions"] ?? {});
|
|
101
|
+
const def = {
|
|
102
|
+
slug: row["slug"],
|
|
103
|
+
primitives: row["primitives"],
|
|
104
|
+
input_types: row["input_types"] ?? [],
|
|
105
|
+
output_types: row["output_types"] ?? [],
|
|
106
|
+
domain: row["domain"] ?? null,
|
|
107
|
+
identity: row["identity"],
|
|
108
|
+
method: row["method"],
|
|
109
|
+
constraints: row["constraints"] ?? [],
|
|
110
|
+
behavioral_primitives: row["behavioral_primitives"],
|
|
111
|
+
allowed_tools: perms["allowed_tools"],
|
|
112
|
+
disallowed_tools: perms["disallowed_tools"],
|
|
113
|
+
model_tier: perms["model_tier"],
|
|
114
|
+
max_tool_calls: perms["max_tool_calls"],
|
|
115
|
+
code_tool_access: perms["code_tool_access"],
|
|
116
|
+
depth_profile: row["depth_profile"],
|
|
117
|
+
skill_slugs: row["default_skills"],
|
|
118
|
+
// Carried skills travel WITH the agent row (the player's own technique, portable across
|
|
119
|
+
// institutions); absent column or null → the agent simply carries none.
|
|
120
|
+
skills: row["carried_skills"] ?? undefined,
|
|
121
|
+
};
|
|
122
|
+
for (const k of Object.keys(def))
|
|
123
|
+
if (def[k] === undefined || def[k] === null)
|
|
124
|
+
delete def[k];
|
|
125
|
+
// domain is honestly nullable on the schema — restore it if the row said null.
|
|
126
|
+
if (!("domain" in def))
|
|
127
|
+
def["domain"] = null;
|
|
128
|
+
return def;
|
|
129
|
+
}
|
|
130
|
+
const REQUIRED_CORE_SLUGS = ["Signal", "Interpretation", "Judgment", "Plan", "Artifact", "Verdict"];
|
|
131
|
+
/** Reconstruct the loader's in-memory genome shape from store rows — ONE reconstruction,
|
|
132
|
+
* shared by every backing, so a JWT-loaded genome and a ctk-loaded genome cannot drift. */
|
|
133
|
+
export function reconstructGenome(rows) {
|
|
134
|
+
const { core_types: coreRows, domain_types: typeRows, agents: agentRows, standards: standardRows, skills: skillRows } = rows;
|
|
135
|
+
const load_errors = [];
|
|
136
|
+
// core types — engine-owned, immutable 6. No rows visible → seed the canonical set,
|
|
137
|
+
// exactly as loadGenome does for a root with no core_types/. A PARTIAL set is a corrupt
|
|
138
|
+
// store view and hard-fails, mirroring the loader's strict gate.
|
|
139
|
+
const core_types = new Map();
|
|
140
|
+
if (coreRows.length === 0) {
|
|
141
|
+
for (const c of CANONICAL_CORE_TYPES)
|
|
142
|
+
core_types.set(c.slug, c);
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
for (const r of coreRows) {
|
|
146
|
+
core_types.set(String(r["slug"]), {
|
|
147
|
+
slug: String(r["slug"]),
|
|
148
|
+
primitive: String(r["primitive"]),
|
|
149
|
+
description: String(r["description"] ?? ""),
|
|
150
|
+
schema: (r["base_schema"] ?? {}),
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
const missing = REQUIRED_CORE_SLUGS.filter((s) => !core_types.has(s));
|
|
154
|
+
if (missing.length > 0) {
|
|
155
|
+
throw new GenomeLoadError(`coltrane_core_types missing required slugs: ${missing.join(", ")}`);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
// domain types — the loader's three checks, in the loader's order: core-type extends,
|
|
159
|
+
// representability (domainTypeDefect), then the single Zod source. Soft-fail per row.
|
|
160
|
+
const domain_types = new Map();
|
|
161
|
+
for (const r of typeRows) {
|
|
162
|
+
const slug = typeof r["slug"] === "string" ? r["slug"] : null;
|
|
163
|
+
const path = `postgrest:coltrane_domain_types/${slug ?? "?"}`;
|
|
164
|
+
try {
|
|
165
|
+
if (!core_types.has(String(r["extends"]))) {
|
|
166
|
+
throw new Error(`field "extends" references "${String(r["extends"])}" which is not a core type`);
|
|
167
|
+
}
|
|
168
|
+
const defect = domainTypeDefect(r);
|
|
169
|
+
if (defect)
|
|
170
|
+
throw new Error(defect);
|
|
171
|
+
const check = DomainTypeSchema.safeParse(r);
|
|
172
|
+
if (!check.success)
|
|
173
|
+
throw new Error(`type schema validation failed — ${zodWhy(check.error.issues)}`);
|
|
174
|
+
const rec = check.data;
|
|
175
|
+
domain_types.set(`${rec.slug}@${rec.version}`, rec);
|
|
176
|
+
}
|
|
177
|
+
catch (e) {
|
|
178
|
+
load_errors.push({ kind: "domain_type", path, slug, error: e instanceof Error ? e.message : String(e) });
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
// agents — defineAgent is the loader's own gate (schema parse + composition rules).
|
|
182
|
+
// Hosted rows soft-fail per row: one broken profile is a reported load error, not a
|
|
183
|
+
// dead genome for every caller behind this RLS scope.
|
|
184
|
+
const agents = new Map();
|
|
185
|
+
for (const r of agentRows) {
|
|
186
|
+
const slug = typeof r["slug"] === "string" ? r["slug"] : null;
|
|
187
|
+
const path = `postgrest:coltrane_agent_profiles/${slug ?? "?"}`;
|
|
188
|
+
try {
|
|
189
|
+
if (!slug)
|
|
190
|
+
throw new Error(`missing required "slug" field`);
|
|
191
|
+
if (agents.has(slug))
|
|
192
|
+
throw new Error(`duplicate agent slug "${slug}"`);
|
|
193
|
+
agents.set(slug, defineAgent(agentDefFromRow(r)));
|
|
194
|
+
}
|
|
195
|
+
catch (e) {
|
|
196
|
+
load_errors.push({ kind: "agent", path, slug, error: e instanceof Error ? e.message : String(e) });
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
// standards — phases jsonb is already the engine phase shape; the agents a standard
|
|
200
|
+
// composes are the ones its chairs name. composeStandard is the loader's own gate.
|
|
201
|
+
const standards = new Map();
|
|
202
|
+
for (const r of standardRows) {
|
|
203
|
+
const slug = typeof r["slug"] === "string" ? r["slug"] : null;
|
|
204
|
+
const path = `postgrest:coltrane_standards/${slug ?? "?"}`;
|
|
205
|
+
try {
|
|
206
|
+
if (!slug)
|
|
207
|
+
throw new Error(`missing required "slug" field`);
|
|
208
|
+
if (standards.has(slug))
|
|
209
|
+
throw new Error(`duplicate standard slug "${slug}"`);
|
|
210
|
+
const phases = (r["phases"] ?? []);
|
|
211
|
+
const chairAgentSlugs = [
|
|
212
|
+
...new Set(phases.flatMap((p) => (p.chairs ?? []).map((c) => c.agent_slug).filter((s) => !!s))),
|
|
213
|
+
];
|
|
214
|
+
const resolved = chairAgentSlugs.map((aslug) => {
|
|
215
|
+
const a = agents.get(aslug);
|
|
216
|
+
if (!a)
|
|
217
|
+
throw new Error(`references unknown agent "${aslug}"`);
|
|
218
|
+
return a;
|
|
219
|
+
});
|
|
220
|
+
standards.set(slug, composeStandard({
|
|
221
|
+
slug,
|
|
222
|
+
domain: String(r["domain"] ?? ""),
|
|
223
|
+
agents: resolved,
|
|
224
|
+
phases,
|
|
225
|
+
status: r["status"] ?? "active",
|
|
226
|
+
// input_types is load-bearing: it names the entry-chair contracts the GIG INPUT
|
|
227
|
+
// satisfies. Dropping it fails composition at every entry chair (found live).
|
|
228
|
+
...(Array.isArray(r["input_types"]) ? { input_types: r["input_types"] } : {}),
|
|
229
|
+
...(Array.isArray(r["output_types"]) ? { output_types: r["output_types"] } : {}),
|
|
230
|
+
}));
|
|
231
|
+
}
|
|
232
|
+
catch (e) {
|
|
233
|
+
load_errors.push({ kind: "standard", path, slug, error: e instanceof Error ? e.message : String(e) });
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
// skills — the row's skill_md IS the loaded reasoning half (`md`, the prompt's Skills
|
|
237
|
+
// layer). Hosted skills carry no local package dir / code half by construction.
|
|
238
|
+
const skills = new Map();
|
|
239
|
+
for (const r of skillRows) {
|
|
240
|
+
const slug = typeof r["slug"] === "string" ? r["slug"] : null;
|
|
241
|
+
const path = `postgrest:coltrane_skills/${slug ?? "?"}`;
|
|
242
|
+
try {
|
|
243
|
+
if (!slug)
|
|
244
|
+
throw new Error(`missing required "slug" field`);
|
|
245
|
+
if (skills.has(slug))
|
|
246
|
+
throw new Error(`duplicate skill slug "${slug}"`);
|
|
247
|
+
const meta = {
|
|
248
|
+
slug,
|
|
249
|
+
description: r["description"] ?? undefined,
|
|
250
|
+
input_type: r["input_type"] ?? undefined,
|
|
251
|
+
output_type: r["output_type"] ?? undefined,
|
|
252
|
+
...(typeof r["tier"] === "number" ? { permission: { tier: r["tier"] } } : {}),
|
|
253
|
+
...(typeof r["skill_md"] === "string" ? { md: r["skill_md"] } : {}),
|
|
254
|
+
};
|
|
255
|
+
for (const k of Object.keys(meta))
|
|
256
|
+
if (meta[k] === undefined)
|
|
257
|
+
delete meta[k];
|
|
258
|
+
const check = SkillSchema.safeParse(meta);
|
|
259
|
+
if (!check.success)
|
|
260
|
+
throw new Error(`skill schema validation failed — ${zodWhy(check.error.issues)}`);
|
|
261
|
+
skills.set(slug, check.data);
|
|
262
|
+
}
|
|
263
|
+
catch (e) {
|
|
264
|
+
load_errors.push({ kind: "skill", path, slug, error: e instanceof Error ? e.message : String(e) });
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
// evals — no hosted table today; present and empty, the same shape as a genome
|
|
268
|
+
// root with no evals/ directory.
|
|
269
|
+
const evals = new Map();
|
|
270
|
+
// charts + venues — likewise: the classes exist in the engine and are authorable over the file
|
|
271
|
+
// backing, but the store has no coltrane_charts / coltrane_venues table to read yet. Present and
|
|
272
|
+
// empty is the same shape as a genome root with no charts/ or venues/ directory, so every reader
|
|
273
|
+
// (chart_browse, gig_dispatch, system_health) behaves identically against a hosted genome — it
|
|
274
|
+
// finds nothing, and says nothing was found. Adding the two tables + the upsert branches is
|
|
275
|
+
// store-side work; nothing here changes when they land.
|
|
276
|
+
const charts = new Map();
|
|
277
|
+
const venues = new Map();
|
|
278
|
+
// venues before charts — a chart names a venue, exactly the loader's ordering.
|
|
279
|
+
for (const r of rows.venues ?? []) {
|
|
280
|
+
const slug = typeof r["slug"] === "string" ? r["slug"] : null;
|
|
281
|
+
const path = `postgrest:coltrane_venues/${slug ?? "?"}`;
|
|
282
|
+
try {
|
|
283
|
+
const check = VenueSchema.safeParse(r["definition"]);
|
|
284
|
+
if (!check.success)
|
|
285
|
+
throw new Error(`venue schema validation failed — ${zodWhy(check.error.issues)}`);
|
|
286
|
+
const defect = venueDefect(check.data);
|
|
287
|
+
if (defect)
|
|
288
|
+
throw new Error(defect);
|
|
289
|
+
if (venues.has(check.data.slug))
|
|
290
|
+
throw new Error(`duplicate venue slug "${check.data.slug}"`);
|
|
291
|
+
venues.set(check.data.slug, check.data);
|
|
292
|
+
}
|
|
293
|
+
catch (e) {
|
|
294
|
+
load_errors.push({ kind: "venue", path, slug, error: e instanceof Error ? e.message : String(e) });
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
for (const r of rows.charts ?? []) {
|
|
298
|
+
const slug = typeof r["slug"] === "string" ? r["slug"] : null;
|
|
299
|
+
const path = `postgrest:coltrane_charts/${slug ?? "?"}`;
|
|
300
|
+
try {
|
|
301
|
+
const check = ChartSchema.safeParse(r["definition"]);
|
|
302
|
+
if (!check.success)
|
|
303
|
+
throw new Error(`R0: chart does not parse — ${zodWhy(check.error.issues)}`);
|
|
304
|
+
if (charts.has(check.data.slug))
|
|
305
|
+
throw new Error(`duplicate chart slug "${check.data.slug}"`);
|
|
306
|
+
const composed = composeChart({
|
|
307
|
+
chart: check.data,
|
|
308
|
+
standards,
|
|
309
|
+
agents,
|
|
310
|
+
venues,
|
|
311
|
+
// the loader's own load-time stand-in for the dispatch payload
|
|
312
|
+
payload_types: chartEntrySeedTypes(check.data, standards),
|
|
313
|
+
});
|
|
314
|
+
if (!composed.ok)
|
|
315
|
+
throw new Error(composed.violations.map((v) => `${v.rule}: ${v.detail}`).join(" | "));
|
|
316
|
+
charts.set(check.data.slug, composed.chart);
|
|
317
|
+
}
|
|
318
|
+
catch (e) {
|
|
319
|
+
load_errors.push({ kind: "chart", path, slug, error: e instanceof Error ? e.message : String(e) });
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
return { core_types, domain_types, agents, standards, skills, evals, charts, venues, load_errors };
|
|
323
|
+
}
|
|
324
|
+
/** Hosted backing: load the genome from the store's five tables and reconstruct the SAME
|
|
325
|
+
* in-memory shape the file loader produces; upsert through the governed RPC. */
|
|
326
|
+
export function postgrestGenomeStore(ctx) {
|
|
327
|
+
return {
|
|
328
|
+
async load() {
|
|
329
|
+
const [core_types, domain_types, agents, standards, skills, charts, venues] = await Promise.all([
|
|
330
|
+
restGet(ctx, Q.core_types),
|
|
331
|
+
restGet(ctx, Q.domain_types),
|
|
332
|
+
restGet(ctx, Q.agents),
|
|
333
|
+
restGet(ctx, Q.standards),
|
|
334
|
+
restGet(ctx, Q.skills),
|
|
335
|
+
restGet(ctx, Q.charts),
|
|
336
|
+
restGet(ctx, Q.venues),
|
|
337
|
+
]);
|
|
338
|
+
return reconstructGenome({ core_types, domain_types, agents, standards, skills, charts, venues });
|
|
339
|
+
},
|
|
340
|
+
async upsert(cls, payload, org_slug) {
|
|
341
|
+
const res = await fetch(`${ctx.baseUrl}/rest/v1/rpc/coltrane_genome_upsert`, {
|
|
342
|
+
method: "POST",
|
|
343
|
+
headers: {
|
|
344
|
+
apikey: ctx.anonKey,
|
|
345
|
+
Authorization: `Bearer ${ctx.bearer}`,
|
|
346
|
+
"Content-Type": "application/json",
|
|
347
|
+
},
|
|
348
|
+
body: JSON.stringify({ p_class: cls, p_payload: payload, p_org_slug: org_slug ?? null }),
|
|
349
|
+
});
|
|
350
|
+
if (!res.ok) {
|
|
351
|
+
const text = await res.text();
|
|
352
|
+
let message = text || `store error ${res.status}`;
|
|
353
|
+
try {
|
|
354
|
+
const parsed = JSON.parse(text);
|
|
355
|
+
if (parsed.message)
|
|
356
|
+
message = parsed.message;
|
|
357
|
+
}
|
|
358
|
+
catch { /* keep the raw text */ }
|
|
359
|
+
throw new Error(`genome upsert (${cls}) refused: ${message}`);
|
|
360
|
+
}
|
|
361
|
+
},
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
/** Agent-token backing: the org genome through coltrane_mcp_genome. PostgREST verifies only
|
|
365
|
+
* JWTs, so a ctk_ bearer cannot ride the REST tables — the definer RPC resolves the token's
|
|
366
|
+
* hash inside the store and returns the org's rows. Same reconstruction as every backing.
|
|
367
|
+
* Read-only by design: an agent token does not author genome (authoring is a member act,
|
|
368
|
+
* governed by the upsert RPC as auth.uid()). */
|
|
369
|
+
export function rpcGenomeStore(ctx) {
|
|
370
|
+
return {
|
|
371
|
+
async load() {
|
|
372
|
+
const res = await fetch(`${ctx.baseUrl}/rest/v1/rpc/coltrane_mcp_genome`, {
|
|
373
|
+
method: "POST",
|
|
374
|
+
headers: {
|
|
375
|
+
apikey: ctx.anonKey,
|
|
376
|
+
// The ctk bearer is NOT a JWT: it authenticates inside the definer RPC via the
|
|
377
|
+
// body; the transport rides the anon key.
|
|
378
|
+
Authorization: `Bearer ${ctx.anonKey}`,
|
|
379
|
+
"Content-Type": "application/json",
|
|
380
|
+
},
|
|
381
|
+
body: JSON.stringify({ p_bearer: ctx.agentToken }),
|
|
382
|
+
});
|
|
383
|
+
const text = await res.text();
|
|
384
|
+
if (!res.ok) {
|
|
385
|
+
let message = text || `store error ${res.status}`;
|
|
386
|
+
try {
|
|
387
|
+
const parsed = JSON.parse(text);
|
|
388
|
+
if (parsed.message)
|
|
389
|
+
message = parsed.message;
|
|
390
|
+
}
|
|
391
|
+
catch { /* keep the raw text */ }
|
|
392
|
+
throw new GenomeLoadError(`genome load (agent token): ${message}`);
|
|
393
|
+
}
|
|
394
|
+
const rows = JSON.parse(text);
|
|
395
|
+
return reconstructGenome({
|
|
396
|
+
core_types: rows.core_types ?? [],
|
|
397
|
+
domain_types: rows.domain_types ?? [],
|
|
398
|
+
agents: rows.agents ?? [],
|
|
399
|
+
standards: rows.standards ?? [],
|
|
400
|
+
skills: rows.skills ?? [],
|
|
401
|
+
charts: rows.charts ?? [],
|
|
402
|
+
venues: rows.venues ?? [],
|
|
403
|
+
});
|
|
404
|
+
},
|
|
405
|
+
async upsert() {
|
|
406
|
+
throw new Error("an agent token does not author genome — authoring is a member act through the governed upsert");
|
|
407
|
+
},
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
/** Set the caller's working organization — the formal switch, recorded in the store as a
|
|
411
|
+
* member act. After this, every member write resolves the org without being told. */
|
|
412
|
+
export function postgrestOrgUse(ctx) {
|
|
413
|
+
return async (org_slug) => {
|
|
414
|
+
const res = await fetch(`${ctx.baseUrl}/rest/v1/rpc/coltrane_org_use`, {
|
|
415
|
+
method: "POST",
|
|
416
|
+
headers: {
|
|
417
|
+
apikey: ctx.anonKey,
|
|
418
|
+
Authorization: `Bearer ${ctx.bearer}`,
|
|
419
|
+
"Content-Type": "application/json",
|
|
420
|
+
},
|
|
421
|
+
body: JSON.stringify({ p_org_slug: org_slug }),
|
|
422
|
+
});
|
|
423
|
+
const text = await res.text();
|
|
424
|
+
if (!res.ok) {
|
|
425
|
+
let message = text || `store error ${res.status}`;
|
|
426
|
+
try {
|
|
427
|
+
const parsed = JSON.parse(text);
|
|
428
|
+
if (parsed.message)
|
|
429
|
+
message = parsed.message;
|
|
430
|
+
}
|
|
431
|
+
catch { /* keep the raw text */ }
|
|
432
|
+
throw new Error(message);
|
|
433
|
+
}
|
|
434
|
+
return JSON.parse(text);
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
/** The agent-token gig-queue seam: queue one run through coltrane_mcp_dispatch, where the
|
|
438
|
+
* chair contract authorizes (the seat grants the standard; the token may only narrow).
|
|
439
|
+
* Same return shape as postgrestQueueGig so a host can swap them by bearer class. */
|
|
440
|
+
export function rpcQueueGig(ctx) {
|
|
441
|
+
return async (args) => {
|
|
442
|
+
const res = await fetch(`${ctx.baseUrl}/rest/v1/rpc/coltrane_mcp_dispatch`, {
|
|
443
|
+
method: "POST",
|
|
444
|
+
headers: {
|
|
445
|
+
apikey: ctx.anonKey,
|
|
446
|
+
Authorization: `Bearer ${ctx.anonKey}`,
|
|
447
|
+
"Content-Type": "application/json",
|
|
448
|
+
},
|
|
449
|
+
body: JSON.stringify({
|
|
450
|
+
p_bearer: ctx.agentToken,
|
|
451
|
+
p_standard: args["standard_slug"],
|
|
452
|
+
p_mode: args["mode"] ?? "live",
|
|
453
|
+
p_input: args["input"] ?? {},
|
|
454
|
+
}),
|
|
455
|
+
});
|
|
456
|
+
const text = await res.text();
|
|
457
|
+
if (!res.ok) {
|
|
458
|
+
let message = text || `store error ${res.status}`;
|
|
459
|
+
try {
|
|
460
|
+
const parsed = JSON.parse(text);
|
|
461
|
+
if (parsed.message)
|
|
462
|
+
message = parsed.message;
|
|
463
|
+
}
|
|
464
|
+
catch { /* keep the raw text */ }
|
|
465
|
+
throw new Error(message);
|
|
466
|
+
}
|
|
467
|
+
return { gig_id: JSON.parse(text), status: "queued" };
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
/** The hosted gig-queue seam for createToolSurface: queue one run through the governor-gated
|
|
471
|
+
* dispatch RPC AS THE CALLER (member JWT — RLS + the governor gate decide). Queuing only;
|
|
472
|
+
* a drain worker claims and runs it. Shape mirrors hosted_tools' member dispatch path. */
|
|
473
|
+
export function postgrestQueueGig(ctx) {
|
|
474
|
+
return async (args) => {
|
|
475
|
+
const res = await fetch(`${ctx.baseUrl}/rest/v1/rpc/coltrane_gig_dispatch`, {
|
|
476
|
+
method: "POST",
|
|
477
|
+
headers: {
|
|
478
|
+
apikey: ctx.anonKey,
|
|
479
|
+
Authorization: `Bearer ${ctx.bearer}`,
|
|
480
|
+
"Content-Type": "application/json",
|
|
481
|
+
},
|
|
482
|
+
body: JSON.stringify({
|
|
483
|
+
p_standard: args["standard_slug"],
|
|
484
|
+
p_mode: args["mode"] ?? "live",
|
|
485
|
+
p_input: args["input"] ?? {},
|
|
486
|
+
p_org_slug: args["org_slug"] ?? null,
|
|
487
|
+
}),
|
|
488
|
+
});
|
|
489
|
+
const text = await res.text();
|
|
490
|
+
if (!res.ok) {
|
|
491
|
+
let message = text || `store error ${res.status}`;
|
|
492
|
+
try {
|
|
493
|
+
const parsed = JSON.parse(text);
|
|
494
|
+
if (parsed.message)
|
|
495
|
+
message = parsed.message;
|
|
496
|
+
}
|
|
497
|
+
catch { /* keep the raw text */ }
|
|
498
|
+
throw new Error(message);
|
|
499
|
+
}
|
|
500
|
+
return { gig_id: JSON.parse(text), status: "queued" };
|
|
501
|
+
};
|
|
502
|
+
}
|
|
503
|
+
//# sourceMappingURL=genome_store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"genome_store.js","sourceRoot":"","sources":["../../src/genome_store.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,6FAA6F;AAC7F,2FAA2F;AAC3F,EAAE;AACF,6FAA6F;AAC7F,sEAAsE;AACtE,6FAA6F;AAC7F,4FAA4F;AAC5F,6FAA6F;AAC7F,0FAA0F;AAC1F,yFAAyF;AACzF,gEAAgE;AAChE,EAAE;AACF,iFAAiF;AACjF,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EACL,aAAa,EACb,e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G,IAAI,CAAC,KAAK,CAAC,IAAI,CAAyB,CAAC;gBACxD,IAAI,MAAM,CAAC,OAAO;oBAAE,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;YAC/C,CAAC;YAAC,MAAM,CAAC,CAAC,uBAAuB,CAAC,CAAC;YACnC,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC;QACD,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;IAClE,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -21,10 +21,14 @@ export interface GigChairState {
|
|
|
21
21
|
* cancelled run could only surface as `failed` carrying a kill-shaped error string —
|
|
22
22
|
* indistinguishable from a genuine crash, which is the opposite of what an operator who
|
|
23
23
|
* just cancelled it needs to see. */
|
|
24
|
-
export type GigStatus = "running" | "complete" | "failed" | "aborted";
|
|
24
|
+
export type GigStatus = "running" | "complete" | "failed" | "aborted" | "awaiting_approval";
|
|
25
25
|
export interface GigRunState {
|
|
26
26
|
gig_id: string;
|
|
27
27
|
standard_slug: string;
|
|
28
|
+
/** Set when this run is a PERFORMANCE of a chart rather than of one standard. `standard_slug`
|
|
29
|
+
* then names the standard the performance opens with — a chart has no single standard, so the
|
|
30
|
+
* arrangement is named here instead of overloading the field that means one thing. */
|
|
31
|
+
chart_slug?: string;
|
|
28
32
|
status: GigStatus;
|
|
29
33
|
started_at: string;
|
|
30
34
|
finished_at?: string;
|
|
@@ -36,6 +40,12 @@ export interface GigRunState {
|
|
|
36
40
|
run_fingerprint?: string;
|
|
37
41
|
genome_hash?: string;
|
|
38
42
|
error?: string;
|
|
43
|
+
/** Set with `awaiting_approval`: the human chair the run parked at. The status says a person
|
|
44
|
+
* is the blocker; this says WHICH seat, which is what the operator needs to act. */
|
|
45
|
+
awaiting?: {
|
|
46
|
+
phase: string;
|
|
47
|
+
role: string;
|
|
48
|
+
};
|
|
39
49
|
usage?: GigUsage;
|
|
40
50
|
/** Chairs that did not run because a sealed output stood in for them (#resume/#reuse). */
|
|
41
51
|
skipped_chairs?: Array<{
|
package/dist/src/gig_tracker.js
CHANGED
|
@@ -72,6 +72,10 @@ export function applyGigProgress(state, ev) {
|
|
|
72
72
|
case "gig_complete":
|
|
73
73
|
state.outputs_count = ev.outputs;
|
|
74
74
|
break;
|
|
75
|
+
case "gig_awaiting_approval":
|
|
76
|
+
state.status = "awaiting_approval";
|
|
77
|
+
state.awaiting = { phase: ev.phase, role: ev.role };
|
|
78
|
+
break;
|
|
75
79
|
case "gig_failed":
|
|
76
80
|
state.error = ev.error;
|
|
77
81
|
break;
|
|
@@ -124,6 +128,7 @@ export function gigEventLogLine(gig_id, ev) {
|
|
|
124
128
|
case "chair_skipped": return JSON.stringify({ ...base, ev: "chair_skipped", phase: ev.phase, role: ev.role, why: ev.reason, from_gig: ev.source_gig_id, sealed: ev.output_types });
|
|
125
129
|
case "reuse_rejected": return JSON.stringify({ ...base, ev: "reuse_rejected", phase: ev.phase, role: ev.role, reason: ev.reason, detail: ev.detail });
|
|
126
130
|
case "gig_complete": return JSON.stringify({ ...base, ev: "gig_complete", outputs: ev.outputs });
|
|
131
|
+
case "gig_awaiting_approval": return JSON.stringify({ ...base, ev: "gig_awaiting_approval", phase: ev.phase, role: ev.role });
|
|
127
132
|
case "gig_failed": return JSON.stringify({ ...base, ev: "gig_failed", error: ev.error });
|
|
128
133
|
case "gig_aborted": return JSON.stringify({ ...base, ev: "gig_aborted", reason: ev.reason });
|
|
129
134
|
case "agent_event":
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gig_tracker.js","sourceRoot":"","sources":["../../src/gig_tracker.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,EAAE;AACF,0FAA0F;AAC1F,4FAA4F;AAC5F,4FAA4F;AAC5F,0FAA0F;
|
|
1
|
+
{"version":3,"file":"gig_tracker.js","sourceRoot":"","sources":["../../src/gig_tracker.ts"],"names":[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AAC,KAAK,CAAC,IAAI,EAAE,CAAC;gBACjF,CAAC,CAAC,IAAI,CAAC;IACb,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Everything a hosted tool needs from its host: where the org store is, and who is calling. */
|
|
2
|
+
export interface HostedToolContext {
|
|
3
|
+
/** The org store's base URL (a Supabase project or PostgREST-compatible equivalent). */
|
|
4
|
+
baseUrl: string;
|
|
5
|
+
/** The store's public (anon) API key — required by PostgREST as `apikey`; not a secret. */
|
|
6
|
+
anonKey: string;
|
|
7
|
+
/** The caller's bearer: a member session JWT, or an issued ctk_ agent capability token. */
|
|
8
|
+
bearer: string;
|
|
9
|
+
}
|
|
10
|
+
export interface HostedToolResult {
|
|
11
|
+
text: string;
|
|
12
|
+
isError?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface HostedTool {
|
|
15
|
+
name: string;
|
|
16
|
+
title: string;
|
|
17
|
+
description: string;
|
|
18
|
+
/** Plain JSON Schema for the tool's params — transport-agnostic, no schema-library coupling. */
|
|
19
|
+
paramsJsonSchema: Record<string, unknown>;
|
|
20
|
+
handler(args: Record<string, unknown>, ctx: HostedToolContext): Promise<HostedToolResult>;
|
|
21
|
+
}
|
|
22
|
+
export declare const HOSTED_TOOLS: HostedTool[];
|
|
23
|
+
export declare function hostedToolByName(name: string): HostedTool;
|