@mnmal-ai/cortext 1.0.0-alpha.10 → 1.0.0-alpha.11
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/bootstrap.js +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/kernel/layout.d.ts +14 -8
- package/dist/kernel/migrations/0001_baseline.d.ts +4 -0
- package/dist/kernel/migrations/0002_drop_engine_owned_indexes.d.ts +2 -1
- package/dist/kernel/substrate-contract.d.ts +1 -1
- package/dist/kernel-bootstrap.js +1 -1
- package/dist/kernel.js +1 -1
- package/dist/namespace.d.ts +2 -1
- package/dist/{plugin-CujP_pvT.js → plugin-BtBVkZpZ.js} +21 -13
- package/dist/{src-DAeiNhDw.js → src-DJA6hyG-.js} +75 -3
- package/package.json +3 -3
package/dist/bootstrap.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { A as CORTEXT_NAMESPACE, O as ARCHITECTURE_NAMESPACE } from "./plugin-
|
|
1
|
+
import { D as isMonotonicAuth, T as DEFAULT_AUTH, t as createCortextPlugin } from "./src-DJA6hyG-.js";
|
|
2
|
+
import { A as CORTEXT_NAMESPACE, O as ARCHITECTURE_NAMESPACE } from "./plugin-BtBVkZpZ.js";
|
|
3
3
|
import "./kernel.js";
|
|
4
4
|
import { defineBootstrap } from "@mnmal-ai/substrate/sdk";
|
|
5
5
|
import { z } from "zod";
|
package/dist/index.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ import type { CortextPluginConfig } from './config.js';
|
|
|
26
26
|
export { buildAuthPolicies, DEFAULT_AUTH, isMonotonicAuth } from './auth-policy.js';
|
|
27
27
|
export { type CompactResult, registerCompactRoute, runCompact } from './compact.js';
|
|
28
28
|
export type { CortextAuthConfig, CortextAuthMode, CortextPluginConfig } from './config.js';
|
|
29
|
-
export { AGENT_MESSAGE_STATUS_VOCAB, AGENT_RULE_CATEGORY_VOCAB, AGENT_RULE_SEVERITY_ALIASES, AGENT_RULE_SEVERITY_VOCAB, ARCHITECTURE_TYPE_NAMES, buildArchitectureNamespace, buildClaudeNamespace, CLAUDE_TYPE_NAMES, DECISION_STATUS_ALIASES, DECISION_STATUS_VOCAB, HOST_INSTALL_CHECK_STATES, HOST_INSTALL_FRAGMENT_STATES, TODO_RESOLUTION_ALIASES, TODO_STATUS_ALIASES, TODO_STATUS_IMPLIES } from './namespace.js';
|
|
29
|
+
export { AGENT_MESSAGE_STATUS_VOCAB, AGENT_RULE_CATEGORY_VOCAB, AGENT_RULE_SEVERITY_ALIASES, AGENT_RULE_SEVERITY_VOCAB, ARCHITECTURE_TYPE_NAMES, buildArchitectureNamespace, buildClaudeNamespace, CLAUDE_TYPE_NAMES, DECISION_STATUS_ALIASES, DECISION_STATUS_VOCAB, HOST_INSTALL_CHECK_STATES, HOST_INSTALL_FRAGMENT_STATES, TASK_STATUS_VOCAB, TODO_RESOLUTION_ALIASES, TODO_STATUS_ALIASES, TODO_STATUS_IMPLIES } from './namespace.js';
|
|
30
30
|
export { registerOnboardRoute } from './onboard.js';
|
|
31
31
|
export { buildReleaseSurface, bumpClass, classifySurfaceChange, classSatisfies, type ReleaseClass, type ReleaseSurface, type SurfaceChange, type SurfaceField } from './release-surface.js';
|
|
32
32
|
export { type ClosedTodoText, inferTodoResolution, type TodoResolution } from './todo-resolution.js';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
import { _ as AGENT_MESSAGE_STATUS_VOCAB } from "./plugin-
|
|
1
|
+
import { C as registerCompactRoute, D as isMonotonicAuth, E as buildAuthPolicies, S as buildClaudeNamespace, T as DEFAULT_AUTH, _ as TASK_STATUS_VOCAB, a as classSatisfies, b as TODO_STATUS_IMPLIES, c as AGENT_RULE_CATEGORY_VOCAB, d as ARCHITECTURE_TYPE_NAMES, f as CLAUDE_TYPE_NAMES, g as HOST_INSTALL_FRAGMENT_STATES, h as HOST_INSTALL_CHECK_STATES, i as bumpClass, l as AGENT_RULE_SEVERITY_ALIASES, m as DECISION_STATUS_VOCAB, n as inferTodoResolution, o as classifySurfaceChange, p as DECISION_STATUS_ALIASES, r as buildReleaseSurface, s as registerOnboardRoute, t as createCortextPlugin, u as AGENT_RULE_SEVERITY_VOCAB, v as TODO_RESOLUTION_ALIASES, w as runCompact, x as buildArchitectureNamespace, y as TODO_STATUS_ALIASES } from "./src-DJA6hyG-.js";
|
|
2
|
+
import { _ as AGENT_MESSAGE_STATUS_VOCAB } from "./plugin-BtBVkZpZ.js";
|
|
3
3
|
import "./kernel.js";
|
|
4
4
|
|
|
5
|
-
export { AGENT_MESSAGE_STATUS_VOCAB, AGENT_RULE_CATEGORY_VOCAB, AGENT_RULE_SEVERITY_ALIASES, AGENT_RULE_SEVERITY_VOCAB, ARCHITECTURE_TYPE_NAMES, CLAUDE_TYPE_NAMES, DECISION_STATUS_ALIASES, DECISION_STATUS_VOCAB, DEFAULT_AUTH, HOST_INSTALL_CHECK_STATES, HOST_INSTALL_FRAGMENT_STATES, TODO_RESOLUTION_ALIASES, TODO_STATUS_ALIASES, TODO_STATUS_IMPLIES, buildArchitectureNamespace, buildAuthPolicies, buildClaudeNamespace, buildReleaseSurface, bumpClass, classSatisfies, classifySurfaceChange, createCortextPlugin, inferTodoResolution, isMonotonicAuth, registerCompactRoute, registerOnboardRoute, runCompact };
|
|
5
|
+
export { AGENT_MESSAGE_STATUS_VOCAB, AGENT_RULE_CATEGORY_VOCAB, AGENT_RULE_SEVERITY_ALIASES, AGENT_RULE_SEVERITY_VOCAB, ARCHITECTURE_TYPE_NAMES, CLAUDE_TYPE_NAMES, DECISION_STATUS_ALIASES, DECISION_STATUS_VOCAB, DEFAULT_AUTH, HOST_INSTALL_CHECK_STATES, HOST_INSTALL_FRAGMENT_STATES, TASK_STATUS_VOCAB, TODO_RESOLUTION_ALIASES, TODO_STATUS_ALIASES, TODO_STATUS_IMPLIES, buildArchitectureNamespace, buildAuthPolicies, buildClaudeNamespace, buildReleaseSurface, bumpClass, classSatisfies, classifySurfaceChange, createCortextPlugin, inferTodoResolution, isMonotonicAuth, registerCompactRoute, registerOnboardRoute, runCompact };
|
package/dist/kernel/layout.d.ts
CHANGED
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* partitioned by namespace and type (`partitioned`)
|
|
2
|
+
* How the store keeps rows: one shared `rows` table (`legacy`), `rows`
|
|
3
|
+
* partitioned by namespace and type (`partitioned`), or one table per type
|
|
4
|
+
* listed in `substrate_type_tables` (`tables`, the only layout substrate
|
|
5
|
+
* 1.0.0-alpha.12 and later boots).
|
|
4
6
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* `
|
|
9
|
-
* indexes per
|
|
7
|
+
* cortext's raw DDL targets `rows` on `legacy` only. On `partitioned`,
|
|
8
|
+
* Postgres refuses a UNIQUE index that lacks the partition keys and clones
|
|
9
|
+
* every parent-level index and CHECK onto other plugins' partitions; on
|
|
10
|
+
* `tables` there is no `rows` at all. On both, the engine builds cortext's
|
|
11
|
+
* declared indexes, `indexed: true` fields and enum CHECKs per type.
|
|
10
12
|
*/
|
|
11
|
-
export type StoreLayout = 'legacy' | 'partitioned';
|
|
13
|
+
export type StoreLayout = 'legacy' | 'partitioned' | 'tables';
|
|
14
|
+
/** Whether `layout` has a shared `rows` table for cortext's raw DDL to target. */
|
|
15
|
+
export declare const hasRowsTable: (layout: unknown) => boolean;
|
|
12
16
|
/**
|
|
13
17
|
* The layout as the catalog reports it. Migrations read `ctx.layout` instead;
|
|
14
18
|
* this is for boot-time code, whose lifecycle context does not carry it.
|
|
19
|
+
* A schema with neither table reads as `legacy`, whose audit then reports
|
|
20
|
+
* every object missing.
|
|
15
21
|
*/
|
|
16
22
|
export declare function storeLayout(sql: unknown): Promise<StoreLayout>;
|
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
* body (see `CORTEXT_PROMOTED_COLUMNS`), their indexes, and the invariants
|
|
4
4
|
* on cortext's own types.
|
|
5
5
|
*
|
|
6
|
+
* Only a store with a shared `rows` table gets any of it; on per-type tables
|
|
7
|
+
* the engine builds the columns, indexes and enum CHECKs from cortext's
|
|
8
|
+
* namespace definition, so both `apply` and `rollback` return first.
|
|
9
|
+
*
|
|
6
10
|
* The kernel runner does not wrap `apply` in a transaction, so each statement
|
|
7
11
|
* commits on its own and a run that dies part-way re-applies cleanly: every
|
|
8
12
|
* statement is idempotent.
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* the engine serves the same reads: the derived recipient index for the
|
|
4
4
|
* inbox, and the `indexed: true` indexes on project and status.
|
|
5
5
|
*
|
|
6
|
-
* A partitioned `rows` never had them
|
|
6
|
+
* A partitioned `rows` never had them, and a per-type tables store has no
|
|
7
|
+
* `rows` at all. Idempotent, like 0001: the runner does
|
|
7
8
|
* not wrap `apply` in a transaction.
|
|
8
9
|
*/
|
|
9
10
|
import type { KernelMigration } from '@mnmal-ai/substrate/sdk';
|
|
@@ -16,4 +16,4 @@
|
|
|
16
16
|
* by reflex: widen it only after reading what the new major changed.
|
|
17
17
|
* `substrate-contract-parity.test.ts` holds the manifest to this literal.
|
|
18
18
|
*/
|
|
19
|
-
export declare const SUBSTRATE_CONTRACT_RANGE = ">=1.0.0-alpha.
|
|
19
|
+
export declare const SUBSTRATE_CONTRACT_RANGE = ">=1.0.0-alpha.12 <2.0.0";
|
package/dist/kernel-bootstrap.js
CHANGED
package/dist/kernel.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { A as CORTEXT_NAMESPACE, C as auditObjects, D as scopedNamespace, E as resolveCortextNamespaces, O as ARCHITECTURE_NAMESPACE, S as auditNamespaceCoverage, T as reportInvariantAudit, _ as AGENT_MESSAGE_STATUS_VOCAB, a as repairInvariants, b as TODO_RESOLUTION_VOCAB, c as ENGINE_OWNED_INDEXES, d as VOCAB_CONSTRAINTS, f as countDuplicateHostInstallKeys, g as rescopeVocabConstraint, h as rescopeKidUniqueIndex, i as repairIfRequested, k as CORTEXT_COORDINATOR_NAME, l as cortextDropEngineOwnedIndexesMigration, m as rescopeHostInstallKeyIndex, n as SUBSTRATE_CONTRACT_RANGE, o as repairOutcomeMessage, p as countDuplicateKids, r as REPAIR_ENV_VAR, s as repairRequested, t as createCortextKernelPlugin, u as cortextBaselineMigration, v as TODO_LIFECYCLE_VOCAB, w as findingMessage, x as INVARIANT_OBJECTS, y as TODO_PRIORITY_VOCAB } from "./plugin-
|
|
1
|
+
import { A as CORTEXT_NAMESPACE, C as auditObjects, D as scopedNamespace, E as resolveCortextNamespaces, O as ARCHITECTURE_NAMESPACE, S as auditNamespaceCoverage, T as reportInvariantAudit, _ as AGENT_MESSAGE_STATUS_VOCAB, a as repairInvariants, b as TODO_RESOLUTION_VOCAB, c as ENGINE_OWNED_INDEXES, d as VOCAB_CONSTRAINTS, f as countDuplicateHostInstallKeys, g as rescopeVocabConstraint, h as rescopeKidUniqueIndex, i as repairIfRequested, k as CORTEXT_COORDINATOR_NAME, l as cortextDropEngineOwnedIndexesMigration, m as rescopeHostInstallKeyIndex, n as SUBSTRATE_CONTRACT_RANGE, o as repairOutcomeMessage, p as countDuplicateKids, r as REPAIR_ENV_VAR, s as repairRequested, t as createCortextKernelPlugin, u as cortextBaselineMigration, v as TODO_LIFECYCLE_VOCAB, w as findingMessage, x as INVARIANT_OBJECTS, y as TODO_PRIORITY_VOCAB } from "./plugin-BtBVkZpZ.js";
|
|
2
2
|
|
|
3
3
|
export { AGENT_MESSAGE_STATUS_VOCAB, ARCHITECTURE_NAMESPACE, CORTEXT_COORDINATOR_NAME, CORTEXT_NAMESPACE, ENGINE_OWNED_INDEXES, INVARIANT_OBJECTS, REPAIR_ENV_VAR, SUBSTRATE_CONTRACT_RANGE, TODO_LIFECYCLE_VOCAB, TODO_PRIORITY_VOCAB, TODO_RESOLUTION_VOCAB, VOCAB_CONSTRAINTS, auditNamespaceCoverage, auditObjects, cortextBaselineMigration, cortextDropEngineOwnedIndexesMigration, countDuplicateHostInstallKeys, countDuplicateKids, createCortextKernelPlugin, findingMessage, repairIfRequested, repairInvariants, repairOutcomeMessage, repairRequested, reportInvariantAudit, rescopeHostInstallKeyIndex, rescopeKidUniqueIndex, rescopeVocabConstraint, resolveCortextNamespaces, scopedNamespace };
|
package/dist/namespace.d.ts
CHANGED
|
@@ -141,9 +141,10 @@ export { AGENT_MESSAGE_STATUS_VOCAB } from './kernel/index.js';
|
|
|
141
141
|
export declare const HOST_INSTALL_FRAGMENT_STATES: readonly ['current', 'stale', 'missing', 'undigested', 'uncomparable', 'source', 'absent'];
|
|
142
142
|
/** HostInstall's per-check verdicts: the worst finding each check produced. */
|
|
143
143
|
export declare const HOST_INSTALL_CHECK_STATES: readonly ['ok', 'warn', 'unknown'];
|
|
144
|
+
export declare const TASK_STATUS_VOCAB: readonly ['active', 'paused', 'done'];
|
|
144
145
|
export declare function buildClaudeNamespace(ns: string): NamespaceDefinition;
|
|
145
146
|
/** The canonical ordered list of type names registered by this namespace. */
|
|
146
|
-
export declare const CLAUDE_TYPE_NAMES: readonly ['SessionLog', 'Decision', 'Todo', 'AgentRule', 'CouncilSession', 'CouncilAdvisor', 'Memory', 'AnchorIntent', 'Concept', 'ConceptLink', 'Skill', 'AgentIdentity', 'AgentMessage', 'HostInstall'];
|
|
147
|
+
export declare const CLAUDE_TYPE_NAMES: readonly ['SessionLog', 'Decision', 'Todo', 'AgentRule', 'CouncilSession', 'CouncilAdvisor', 'Memory', 'AnchorIntent', 'Concept', 'ConceptLink', 'Skill', 'AgentIdentity', 'AgentMessage', 'HostInstall', 'Task', 'ExecutionCheckpoint'];
|
|
147
148
|
/**
|
|
148
149
|
* Architecture namespace — Claude-lineage code-review findings. Kept separate
|
|
149
150
|
* from the claude context namespace so lifecycle (compaction, retention,
|
|
@@ -98,15 +98,22 @@ const CORTEXT_PROMOTED_COLUMNS = {
|
|
|
98
98
|
|
|
99
99
|
//#endregion
|
|
100
100
|
//#region src/kernel/layout.ts
|
|
101
|
+
/** Whether `layout` has a shared `rows` table for cortext's raw DDL to target. */
|
|
102
|
+
const hasRowsTable = (layout) => layout === "legacy" || layout === "partitioned";
|
|
101
103
|
/**
|
|
102
104
|
* The layout as the catalog reports it. Migrations read `ctx.layout` instead;
|
|
103
105
|
* this is for boot-time code, whose lifecycle context does not carry it.
|
|
106
|
+
* A schema with neither table reads as `legacy`, whose audit then reports
|
|
107
|
+
* every object missing.
|
|
104
108
|
*/
|
|
105
109
|
async function storeLayout(sql) {
|
|
106
110
|
const [row] = await sql`
|
|
107
|
-
SELECT c.relkind
|
|
111
|
+
SELECT (SELECT c.relkind FROM pg_class c WHERE c.oid = to_regclass('rows')) AS kind,
|
|
112
|
+
to_regclass('substrate_type_tables') IS NOT NULL AS tables
|
|
108
113
|
`;
|
|
109
|
-
|
|
114
|
+
if (row?.kind === "p") return "partitioned";
|
|
115
|
+
if (row?.kind == null && row?.tables === true) return "tables";
|
|
116
|
+
return "legacy";
|
|
110
117
|
}
|
|
111
118
|
|
|
112
119
|
//#endregion
|
|
@@ -360,11 +367,11 @@ function findingMessage(finding) {
|
|
|
360
367
|
* structured channel this belongs in.
|
|
361
368
|
*/
|
|
362
369
|
async function reportInvariantAudit(ctx, warn = console.warn) {
|
|
363
|
-
let findings = [...auditNamespaceCoverage(ctx.coordinatorNamespaces, ctx.coordinatorNamespacesByPlugin)];
|
|
364
|
-
const target = ctx.coordinatorNamespaces.includes("cortext") ? CORTEXT_NAMESPACE : resolveCortextNamespaces(ctx.coordinatorNamespacesByPlugin)?.[0] ?? "cortext";
|
|
365
370
|
const catalogRead = ctx.sql !== null && ctx.sql !== void 0;
|
|
366
|
-
let objectsChecked = 0;
|
|
367
371
|
const layout = catalogRead ? await storeLayout(ctx.sql).catch(() => "legacy") : null;
|
|
372
|
+
let findings = layout !== null && layout !== "legacy" ? [] : auditNamespaceCoverage(ctx.coordinatorNamespaces, ctx.coordinatorNamespacesByPlugin);
|
|
373
|
+
const target = ctx.coordinatorNamespaces.includes("cortext") ? CORTEXT_NAMESPACE : resolveCortextNamespaces(ctx.coordinatorNamespacesByPlugin)?.[0] ?? "cortext";
|
|
374
|
+
let objectsChecked = 0;
|
|
368
375
|
if (catalogRead && layout === "legacy") try {
|
|
369
376
|
const result = await auditObjects(ctx.sql, target);
|
|
370
377
|
if (target !== "cortext" && result.findings.length === 0) findings = findings.filter((f) => f.kind !== "namespace_drifted");
|
|
@@ -602,7 +609,7 @@ const cortextBaselineMigration = {
|
|
|
602
609
|
id: "0001_baseline",
|
|
603
610
|
apply: async (ctx) => {
|
|
604
611
|
const { sql, metric } = ctx;
|
|
605
|
-
if (sql === null) return;
|
|
612
|
+
if (sql === null || !hasRowsTable(ctx.layout)) return;
|
|
606
613
|
const s = sql;
|
|
607
614
|
await s.unsafe(`
|
|
608
615
|
ALTER TABLE rows
|
|
@@ -620,8 +627,8 @@ const cortextBaselineMigration = {
|
|
|
620
627
|
await rescopeKidUniqueIndex(s, CORTEXT_NAMESPACE);
|
|
621
628
|
await rescopeHostInstallKeyIndex(s, CORTEXT_NAMESPACE);
|
|
622
629
|
},
|
|
623
|
-
rollback: async ({ sql }) => {
|
|
624
|
-
if (sql === null) return;
|
|
630
|
+
rollback: async ({ sql, layout }) => {
|
|
631
|
+
if (sql === null || !hasRowsTable(layout)) return;
|
|
625
632
|
const s = sql;
|
|
626
633
|
for (const { constraint } of VOCAB_CONSTRAINTS) await s.unsafe(`ALTER TABLE rows DROP CONSTRAINT IF EXISTS ${constraint}`);
|
|
627
634
|
await s.unsafe("DROP INDEX IF EXISTS rows_agent_identity_kid_unique, rows_host_install_key_unique");
|
|
@@ -641,7 +648,7 @@ const ENGINE_OWNED_INDEXES = [
|
|
|
641
648
|
const cortextDropEngineOwnedIndexesMigration = {
|
|
642
649
|
id: "0002_drop_engine_owned_indexes",
|
|
643
650
|
apply: async ({ sql, layout }) => {
|
|
644
|
-
if (sql === null || layout
|
|
651
|
+
if (sql === null || layout !== "legacy") return;
|
|
645
652
|
await sql.unsafe(`DROP INDEX IF EXISTS ${ENGINE_OWNED_INDEXES.join(", ")}`);
|
|
646
653
|
},
|
|
647
654
|
rollback: async () => {}
|
|
@@ -740,9 +747,10 @@ async function repairIfRequested(ctx, warn = console.warn) {
|
|
|
740
747
|
ctx.metric("cortext_kernel.repair_declined", { reason: "target_unknown" });
|
|
741
748
|
return null;
|
|
742
749
|
}
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
750
|
+
const layout = await storeLayout(ctx.sql).catch(() => "legacy");
|
|
751
|
+
if (layout !== "legacy") {
|
|
752
|
+
warn(`[cortext-kernel] ${REPAIR_ENV_VAR} is set, but the store layout is ${layout}: the engine owns cortext's indexes and CHECKs there, and there are no objects on rows to repair. Nothing to do.`);
|
|
753
|
+
ctx.metric("cortext_kernel.repair_declined", { reason: layout });
|
|
746
754
|
return null;
|
|
747
755
|
}
|
|
748
756
|
warn(`[cortext-kernel] ${REPAIR_ENV_VAR} is set — re-scoping kernel invariants to '${ctx.namespace}'. This takes ACCESS EXCLUSIVE on rows and briefly blocks writes.` + (ctx.namespace === "cortext" ? " Target matches the built-in scope literal, so this is a no-op rebuild." : ""));
|
|
@@ -789,7 +797,7 @@ async function repairIfRequested(ctx, warn = console.warn) {
|
|
|
789
797
|
* by reflex: widen it only after reading what the new major changed.
|
|
790
798
|
* `substrate-contract-parity.test.ts` holds the manifest to this literal.
|
|
791
799
|
*/
|
|
792
|
-
const SUBSTRATE_CONTRACT_RANGE = ">=1.0.0-alpha.
|
|
800
|
+
const SUBSTRATE_CONTRACT_RANGE = ">=1.0.0-alpha.12 <2.0.0";
|
|
793
801
|
|
|
794
802
|
//#endregion
|
|
795
803
|
//#region src/kernel/plugin.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as CORTEXT_NAMESPACE, O as ARCHITECTURE_NAMESPACE, _ as AGENT_MESSAGE_STATUS_VOCAB, b as TODO_RESOLUTION_VOCAB, j as CORTEXT_PROMOTED_COLUMNS, k as CORTEXT_COORDINATOR_NAME, n as SUBSTRATE_CONTRACT_RANGE, v as TODO_LIFECYCLE_VOCAB, y as TODO_PRIORITY_VOCAB } from "./plugin-
|
|
1
|
+
import { A as CORTEXT_NAMESPACE, O as ARCHITECTURE_NAMESPACE, _ as AGENT_MESSAGE_STATUS_VOCAB, b as TODO_RESOLUTION_VOCAB, j as CORTEXT_PROMOTED_COLUMNS, k as CORTEXT_COORDINATOR_NAME, n as SUBSTRATE_CONTRACT_RANGE, v as TODO_LIFECYCLE_VOCAB, y as TODO_PRIORITY_VOCAB } from "./plugin-BtBVkZpZ.js";
|
|
2
2
|
import { JSON_HEADERS, RESERVED_AUTOCRUD_FIELDS, ResolverFrameError, and, createResolverWithEdges, defineNamespace, deleteResolver, denyAll, denyVerbs, field, formatQualifiedKey, getResolver, grantOf, grantedIn, jsonResponse, listResolver, makeCtx, or, queryAll, requireIdentity, resolveEntityRow, resolveIdentity, selectAll, updateResolver } from "@mnmal-ai/substrate/sdk";
|
|
3
3
|
|
|
4
4
|
//#region src/auth-policy.ts
|
|
@@ -932,6 +932,11 @@ const HOST_INSTALL_CHECK_STATES = [
|
|
|
932
932
|
"warn",
|
|
933
933
|
"unknown"
|
|
934
934
|
];
|
|
935
|
+
const TASK_STATUS_VOCAB = [
|
|
936
|
+
"active",
|
|
937
|
+
"paused",
|
|
938
|
+
"done"
|
|
939
|
+
];
|
|
935
940
|
const CONCEPT_NAME_TTL_MS = 6e4;
|
|
936
941
|
/** Long-form length past which `embed.source` appends the long form to the synopsis. */
|
|
937
942
|
const LONGFORM_EMBED_CHARS = 1200;
|
|
@@ -1349,6 +1354,45 @@ function buildClaudeNamespace(ns) {
|
|
|
1349
1354
|
where: "live",
|
|
1350
1355
|
name: "rows_host_install_key_unique"
|
|
1351
1356
|
}]
|
|
1357
|
+
},
|
|
1358
|
+
Task: { fields: {
|
|
1359
|
+
title: field.string(),
|
|
1360
|
+
status: field.enum(TASK_STATUS_VOCAB, { default: "active" }),
|
|
1361
|
+
todo: field.crossRef(ns, "Todo", {
|
|
1362
|
+
nullable: true,
|
|
1363
|
+
onDelete: "set_null"
|
|
1364
|
+
}),
|
|
1365
|
+
archived: field.boolean({ default: false }),
|
|
1366
|
+
project: field.string({
|
|
1367
|
+
nullable: true,
|
|
1368
|
+
indexed: true
|
|
1369
|
+
})
|
|
1370
|
+
} },
|
|
1371
|
+
ExecutionCheckpoint: {
|
|
1372
|
+
fields: {
|
|
1373
|
+
task: field.crossRef(ns, "Task", { onDelete: "cascade" }),
|
|
1374
|
+
revision: field.number(),
|
|
1375
|
+
completed: field.string({ indexed: false }),
|
|
1376
|
+
nextAction: field.string({ indexed: false }),
|
|
1377
|
+
blockers: field.string({
|
|
1378
|
+
nullable: true,
|
|
1379
|
+
indexed: false
|
|
1380
|
+
}),
|
|
1381
|
+
refs: field.list(field.string(), { nullable: true }),
|
|
1382
|
+
project: field.string({
|
|
1383
|
+
nullable: true,
|
|
1384
|
+
indexed: true
|
|
1385
|
+
})
|
|
1386
|
+
},
|
|
1387
|
+
indexes: [{
|
|
1388
|
+
fields: ["task", {
|
|
1389
|
+
field: "revision",
|
|
1390
|
+
dir: "desc"
|
|
1391
|
+
}],
|
|
1392
|
+
unique: true,
|
|
1393
|
+
where: "live",
|
|
1394
|
+
name: "rows_execution_checkpoint_task_revision_unique"
|
|
1395
|
+
}]
|
|
1352
1396
|
}
|
|
1353
1397
|
};
|
|
1354
1398
|
const definition = defineNamespace(ns, types, {
|
|
@@ -1393,7 +1437,9 @@ const CLAUDE_TYPE_NAMES = [
|
|
|
1393
1437
|
"Skill",
|
|
1394
1438
|
"AgentIdentity",
|
|
1395
1439
|
"AgentMessage",
|
|
1396
|
-
"HostInstall"
|
|
1440
|
+
"HostInstall",
|
|
1441
|
+
"Task",
|
|
1442
|
+
"ExecutionCheckpoint"
|
|
1397
1443
|
];
|
|
1398
1444
|
/**
|
|
1399
1445
|
* Architecture namespace — Claude-lineage code-review findings. Kept separate
|
|
@@ -1690,6 +1736,32 @@ function buildBody(namespace, retention) {
|
|
|
1690
1736
|
settingsEnv: "json — allowlisted non-secret switch values, plus whether the identity keys are set (nullable)"
|
|
1691
1737
|
},
|
|
1692
1738
|
writeWhen: ["Written by the cold-start of every session with an agent identity; agents read it, they do not write it"]
|
|
1739
|
+
},
|
|
1740
|
+
Task: {
|
|
1741
|
+
purpose: "A unit of work in flight: the stable identity a fresh session resumes by after a reset, independent of session id. Not a backlog ticket; link one via `todo`",
|
|
1742
|
+
fields: {
|
|
1743
|
+
id: "auto-generated",
|
|
1744
|
+
title: "what the work is",
|
|
1745
|
+
status: `${vocabUnion(TASK_STATUS_VOCAB)} (default active)`,
|
|
1746
|
+
todo: "UUID crossRef to the Todo this work implements, set_null on delete (nullable)",
|
|
1747
|
+
archived: "true if retired",
|
|
1748
|
+
project: "repo basename; null = cross-cutting"
|
|
1749
|
+
},
|
|
1750
|
+
writeWhen: ["When starting work that may outlive the context window", "Flip status to done when the work is finished, paused when set aside"]
|
|
1751
|
+
},
|
|
1752
|
+
ExecutionCheckpoint: {
|
|
1753
|
+
purpose: "One acknowledged step of a Task: what was completed and the next action. The latest is the Task's highest revision",
|
|
1754
|
+
fields: {
|
|
1755
|
+
id: "auto-generated",
|
|
1756
|
+
task: "UUID crossRef to the Task, cascade on delete",
|
|
1757
|
+
revision: "one higher than the Task's latest; unique per Task, so a second write at the same revision is refused",
|
|
1758
|
+
completed: "what this step finished (not indexed)",
|
|
1759
|
+
nextAction: "the exact next operation (not indexed)",
|
|
1760
|
+
blockers: "what stands in the way (not indexed, nullable)",
|
|
1761
|
+
refs: "file paths, #shortIds, PR or commit references (nullable)",
|
|
1762
|
+
project: "repo basename; null = cross-cutting"
|
|
1763
|
+
},
|
|
1764
|
+
writeWhen: ["After a completed subtask, a blocker, or before a reset; point at files and rows, never retell them", "Treat the step as done only once the write is acknowledged; on a refused revision, re-read the latest and retry"]
|
|
1693
1765
|
}
|
|
1694
1766
|
},
|
|
1695
1767
|
mutations: buildMutations(),
|
|
@@ -2069,4 +2141,4 @@ function createCortextPlugin(cfg) {
|
|
|
2069
2141
|
}
|
|
2070
2142
|
|
|
2071
2143
|
//#endregion
|
|
2072
|
-
export {
|
|
2144
|
+
export { registerCompactRoute as C, isMonotonicAuth as D, buildAuthPolicies as E, buildClaudeNamespace as S, DEFAULT_AUTH as T, TASK_STATUS_VOCAB as _, classSatisfies as a, TODO_STATUS_IMPLIES as b, AGENT_RULE_CATEGORY_VOCAB as c, ARCHITECTURE_TYPE_NAMES as d, CLAUDE_TYPE_NAMES as f, HOST_INSTALL_FRAGMENT_STATES as g, HOST_INSTALL_CHECK_STATES as h, bumpClass as i, AGENT_RULE_SEVERITY_ALIASES as l, DECISION_STATUS_VOCAB as m, inferTodoResolution as n, classifySurfaceChange as o, DECISION_STATUS_ALIASES as p, buildReleaseSurface as r, registerOnboardRoute as s, createCortextPlugin as t, AGENT_RULE_SEVERITY_VOCAB as u, TODO_RESOLUTION_ALIASES as v, runCompact as w, buildArchitectureNamespace as x, TODO_STATUS_ALIASES as y };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mnmal-ai/cortext",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.11",
|
|
4
4
|
"description": "Cortext: the agent-neutral coordination context store for Substrate (Todos, Decisions, SessionLogs, AgentRules, Memory, Concepts, Councils, …) plus architecture findings. One package carrying two plugins: the coordinator that registers the namespaces, and the kernel plugin that owns their Postgres invariants.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -62,10 +62,10 @@
|
|
|
62
62
|
"zod": "^4.6.5"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
|
-
"@mnmal-ai/substrate": ">=1.0.0-alpha.
|
|
65
|
+
"@mnmal-ai/substrate": ">=1.0.0-alpha.12 <2.0.0"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@mnmal-ai/substrate": "1.0.0-alpha.
|
|
68
|
+
"@mnmal-ai/substrate": "1.0.0-alpha.12",
|
|
69
69
|
"@types/node": "^26.6.4",
|
|
70
70
|
"tsdown": "^0.23.0",
|
|
71
71
|
"typescript": "^7.0.2",
|