open-multi-agent-kit 0.79.3 → 0.80.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.
Files changed (128) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/MATURITY.md +2 -2
  3. package/README.md +86 -39
  4. package/ROADMAP.md +20 -17
  5. package/dist/brand/night-city.theme.json +122 -24
  6. package/dist/brand/rust-forge.theme.json +1 -1
  7. package/dist/commands/chat/native-root-loop.d.ts +27 -3
  8. package/dist/commands/chat/native-root-loop.js +370 -49
  9. package/dist/commands/dag.js +45 -0
  10. package/dist/commands/init/content.d.ts +1 -1
  11. package/dist/commands/init/content.js +3 -3
  12. package/dist/commands/init.js +3 -3
  13. package/dist/commands/verify.js +59 -1
  14. package/dist/contracts/dag.d.ts +9 -1
  15. package/dist/evidence/graph-ontology-relation-gate.d.ts +10 -0
  16. package/dist/evidence/graph-ontology-relation-gate.js +46 -0
  17. package/dist/evidence/headroom-replay-verifier.d.ts +19 -0
  18. package/dist/evidence/headroom-replay-verifier.js +86 -0
  19. package/dist/memory/local-graph-memory-store.d.ts +75 -0
  20. package/dist/memory/local-graph-memory-store.js +570 -0
  21. package/dist/orchestration/dag.d.ts +22 -1
  22. package/dist/orchestration/evidence-gate.js +12 -0
  23. package/dist/orchestration/executor.js +111 -15
  24. package/dist/orchestration/loop-controller-headroom.d.ts +6 -0
  25. package/dist/orchestration/loop-controller-headroom.js +33 -0
  26. package/dist/orchestration/scheduler.d.ts +2 -0
  27. package/dist/orchestration/scheduler.js +3 -0
  28. package/dist/orchestration/task-graph.d.ts +17 -0
  29. package/dist/orchestration/task-graph.js +38 -0
  30. package/dist/providers/codex-cli-runner.js +17 -2
  31. package/dist/runtime/agent-runtime.d.ts +32 -3
  32. package/dist/runtime/agent-runtime.js +20 -7
  33. package/dist/runtime/authority-matrix.d.ts +23 -0
  34. package/dist/runtime/authority-matrix.js +171 -0
  35. package/dist/runtime/chat-advisory-runtime.js +3 -0
  36. package/dist/runtime/codex-cli-runtime.js +2 -0
  37. package/dist/runtime/codex-runtime.d.ts +4 -1
  38. package/dist/runtime/codex-runtime.js +34 -12
  39. package/dist/runtime/context-broker-converter.js +32 -2
  40. package/dist/runtime/context-broker.js +18 -0
  41. package/dist/runtime/contracts/evidence.d.ts +52 -0
  42. package/dist/runtime/contracts/evidence.js +138 -1
  43. package/dist/runtime/contracts/shared.d.ts +27 -0
  44. package/dist/runtime/data-retention-gate.d.ts +42 -0
  45. package/dist/runtime/data-retention-gate.js +123 -0
  46. package/dist/runtime/deepseek-runtime.d.ts +5 -1
  47. package/dist/runtime/deepseek-runtime.js +13 -7
  48. package/dist/runtime/external-cli-adapter.js +20 -7
  49. package/dist/runtime/freedomd-evidence-envelope.d.ts +57 -0
  50. package/dist/runtime/freedomd-evidence-envelope.js +110 -0
  51. package/dist/runtime/freedomd-exception.d.ts +32 -0
  52. package/dist/runtime/freedomd-exception.js +95 -0
  53. package/dist/runtime/freedomd-incidents.d.ts +23 -0
  54. package/dist/runtime/freedomd-incidents.js +103 -0
  55. package/dist/runtime/freedomd-policy.d.ts +35 -0
  56. package/dist/runtime/freedomd-policy.js +114 -0
  57. package/dist/runtime/freedomd-router.d.ts +66 -0
  58. package/dist/runtime/freedomd-router.js +433 -0
  59. package/dist/runtime/headroom-aware-loop-decision.d.ts +21 -0
  60. package/dist/runtime/headroom-aware-loop-decision.js +67 -0
  61. package/dist/runtime/headroom-loop-risk.d.ts +19 -0
  62. package/dist/runtime/headroom-loop-risk.js +43 -0
  63. package/dist/runtime/headroom-policy.d.ts +14 -1
  64. package/dist/runtime/headroom-policy.js +74 -12
  65. package/dist/runtime/kimi-api-runtime.d.ts +4 -1
  66. package/dist/runtime/kimi-api-runtime.js +35 -11
  67. package/dist/runtime/kimi-print-runtime.js +21 -0
  68. package/dist/runtime/kimi-wire-protocol-runtime.js +17 -1
  69. package/dist/runtime/local-llm-runtime.d.ts +5 -1
  70. package/dist/runtime/local-llm-runtime.js +14 -23
  71. package/dist/runtime/private-stderr.d.ts +13 -0
  72. package/dist/runtime/private-stderr.js +69 -0
  73. package/dist/runtime/prompt-envelope.d.ts +1 -1
  74. package/dist/runtime/provider-sovereignty.d.ts +81 -0
  75. package/dist/runtime/provider-sovereignty.js +285 -0
  76. package/dist/runtime/runtime-backed-task-runner.d.ts +1 -0
  77. package/dist/runtime/runtime-backed-task-runner.js +282 -10
  78. package/dist/runtime/runtime-bootstrap.d.ts +12 -0
  79. package/dist/runtime/runtime-bootstrap.js +54 -11
  80. package/dist/runtime/runtime-failure-classifier.d.ts +15 -0
  81. package/dist/runtime/runtime-failure-classifier.js +107 -0
  82. package/dist/runtime/runtime-health-probes.d.ts +30 -0
  83. package/dist/runtime/runtime-health-probes.js +102 -0
  84. package/dist/runtime/runtime-router.d.ts +6 -2
  85. package/dist/runtime/runtime-router.js +575 -53
  86. package/dist/runtime/structured-compaction.d.ts +107 -0
  87. package/dist/runtime/structured-compaction.js +414 -0
  88. package/dist/runtime/tool-dispatch-contracts.d.ts +7 -5
  89. package/dist/runtime/tool-dispatch-contracts.js +15 -4
  90. package/dist/runtime/tool-plane.d.ts +1 -1
  91. package/dist/runtime/tool-plane.js +49 -1
  92. package/dist/runtime/worker-manifest.js +1 -1
  93. package/dist/schema/evidence-bundle.schema.d.ts +8 -8
  94. package/dist/schema/proof-bundle.schema.d.ts +2 -2
  95. package/dist/util/hash.d.ts +2 -0
  96. package/dist/util/hash.js +13 -0
  97. package/dist/util/session.js +5 -4
  98. package/docs/2026-06-16/critical-issues.md +19 -0
  99. package/docs/2026-06-16/improvements.md +15 -0
  100. package/docs/2026-06-16/init-checklist.md +25 -0
  101. package/docs/2026-06-16/plan.md +20 -0
  102. package/docs/2026-06-17/critical-issues.md +19 -0
  103. package/docs/2026-06-17/improvements.md +15 -0
  104. package/docs/2026-06-17/init-checklist.md +25 -0
  105. package/docs/2026-06-17/plan.md +20 -0
  106. package/docs/ARCHITECTURE_ANALYSIS_CODEGRAPH.md +2 -1
  107. package/docs/GSTACK_MIGRATION.md +1 -1
  108. package/docs/algorithm-hardening-playbook.md +219 -0
  109. package/docs/claims.md +1 -1
  110. package/docs/getting-started.md +1 -1
  111. package/docs/native-root-runtime-hardening.md +42 -32
  112. package/docs/post-0793-hardening-roadmap.md +123 -0
  113. package/docs/provider-maturity.md +18 -16
  114. package/docs/versioning.md +3 -3
  115. package/docs/what-is-omk.md +1 -1
  116. package/package.json +8 -4
  117. package/readmeasset/.npmignore +2 -0
  118. package/readmeasset/ASSET_INDEX.md +2 -0
  119. package/readmeasset/ASSET_PROVENANCE.md +40 -20
  120. package/readmeasset/omk-adaptorch-ouroboros-supermemory.svg +1 -1
  121. package/readmeasset/omk-control-surfaces.svg +1 -1
  122. package/readmeasset/omk-core-loop.svg +1 -1
  123. package/readmeasset/omk-freedomd-control-plane.svg +59 -0
  124. package/readmeasset/omk-freedomd-control-plane.webp +0 -0
  125. package/readmeasset/omk-init-control-loop.svg +1 -1
  126. package/readmeasset/omk-logo-mark.svg +1 -1
  127. package/readmeasset/omk-parallel-subagents.svg +1 -1
  128. package/readmeasset/omk-release-assertions.svg +1 -1
@@ -0,0 +1,103 @@
1
+ /**
2
+ * Freedomd provider incident monitor.
3
+ *
4
+ * Reads local incident overrides from `.omk/provider-incidents.json` and
5
+ * optional per-project policy files. This avoids scraping public web pages by
6
+ * default while still letting operators react to events like Fable 5 quickly.
7
+ */
8
+ import { readFile } from "node:fs/promises";
9
+ import { join, resolve } from "node:path";
10
+ function parseIncidentFile(raw) {
11
+ try {
12
+ const parsed = JSON.parse(raw);
13
+ if (!Array.isArray(parsed.incidents))
14
+ return [];
15
+ return parsed.incidents.filter(isValidIncident);
16
+ }
17
+ catch {
18
+ return [];
19
+ }
20
+ }
21
+ function isValidIncident(value) {
22
+ if (!value || typeof value !== "object")
23
+ return false;
24
+ const incident = value;
25
+ return (typeof incident.providerId === "string" &&
26
+ typeof incident.kind === "string" &&
27
+ typeof incident.severity === "string" &&
28
+ ["availability", "policy", "export-control", "retention", "jurisdiction"].includes(incident.kind) &&
29
+ ["info", "warn", "block"].includes(incident.severity));
30
+ }
31
+ function incidentsFromEnv(env) {
32
+ const raw = env.OMK_PROVIDER_INCIDENTS;
33
+ if (!raw)
34
+ return [];
35
+ try {
36
+ const parsed = JSON.parse(raw);
37
+ if (Array.isArray(parsed))
38
+ return parsed.filter(isValidIncident);
39
+ if (parsed && typeof parsed === "object" && "incidents" in parsed) {
40
+ return (parsed.incidents ?? []).filter(isValidIncident);
41
+ }
42
+ return [];
43
+ }
44
+ catch {
45
+ return [];
46
+ }
47
+ }
48
+ export async function loadProviderIncidents(options = {}) {
49
+ const root = resolve(options.projectRoot ?? process.cwd());
50
+ const env = options.env ?? process.env;
51
+ const filePath = join(root, ".omk", "provider-incidents.json");
52
+ let fileIncidents = [];
53
+ try {
54
+ const raw = await readFile(filePath, "utf-8");
55
+ fileIncidents = parseIncidentFile(raw);
56
+ }
57
+ catch {
58
+ // Missing or unreadable file is fine; fall back to env.
59
+ }
60
+ const envIncidents = incidentsFromEnv(env);
61
+ const feedIncidents = await fetchFeedIncidents(options.feedUrls ?? [], options.fetch);
62
+ // Merge by providerId+kind, preferring the most recent and most severe.
63
+ const map = new Map();
64
+ for (const incident of [...fileIncidents, ...envIncidents, ...feedIncidents]) {
65
+ const key = `${incident.providerId}:${incident.kind}:${incident.runtimeMode ?? ""}`;
66
+ const existing = map.get(key);
67
+ if (!existing || severityRank(incident.severity) > severityRank(existing.severity)) {
68
+ map.set(key, incident);
69
+ }
70
+ }
71
+ return [...map.values()];
72
+ }
73
+ async function fetchFeedIncidents(urls, fetchImpl) {
74
+ if (urls.length === 0)
75
+ return [];
76
+ const fetcher = fetchImpl ?? defaultFetch;
77
+ const results = [];
78
+ for (const url of urls) {
79
+ try {
80
+ const response = await fetcher(url);
81
+ if (!response.ok)
82
+ continue;
83
+ const text = await response.text();
84
+ const parsed = parseIncidentFile(text);
85
+ results.push(...parsed);
86
+ }
87
+ catch {
88
+ // Best-effort: individual feed failures must not block routing.
89
+ }
90
+ }
91
+ return results;
92
+ }
93
+ async function defaultFetch(url) {
94
+ const response = await fetch(url, { signal: AbortSignal.timeout(5_000) });
95
+ return { ok: response.ok, text: () => response.text() };
96
+ }
97
+ function severityRank(severity) {
98
+ if (severity === "block")
99
+ return 2;
100
+ if (severity === "warn")
101
+ return 1;
102
+ return 0;
103
+ }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Freedomd policy compiler.
3
+ *
4
+ * Translates environment, org defaults, and optional user config into a
5
+ * normalized policy that drives provider-sovereignty routing, retention gates,
6
+ * and degraded-mode fallback decisions.
7
+ */
8
+ export type FreedomdMode = "off" | "balanced" | "strict";
9
+ export interface FreedomdProviderOverride {
10
+ readonly enabled: boolean;
11
+ readonly reason?: string;
12
+ readonly priority?: number;
13
+ }
14
+ export interface FreedomdPolicy {
15
+ readonly mode: FreedomdMode;
16
+ readonly preferLocal: boolean;
17
+ readonly maxRetentionDays: number;
18
+ readonly allowExportRestrictedProvider: boolean;
19
+ readonly allowProviderExceptions: boolean;
20
+ readonly requireLocalEvidenceEnvelope: boolean;
21
+ readonly providerOverrides: Readonly<Record<string, FreedomdProviderOverride>>;
22
+ readonly maxJurisdictionRisk: number;
23
+ readonly maxRetentionRisk: number;
24
+ readonly maxCutoffRisk: number;
25
+ /** Optional public/provider incident feed URLs. Best-effort only. */
26
+ readonly incidentFeedUrls: readonly string[];
27
+ }
28
+ export interface FreedomdPolicyInputs {
29
+ readonly env?: NodeJS.ProcessEnv;
30
+ readonly orgDefaults?: Partial<FreedomdPolicy>;
31
+ readonly taskFlags?: Partial<FreedomdPolicy>;
32
+ }
33
+ export declare function compileFreedomdPolicy(inputs?: FreedomdPolicyInputs): FreedomdPolicy;
34
+ export declare function isFreedomdEnabled(policy: Pick<FreedomdPolicy, "mode">): boolean;
35
+ export declare function explainFreedomdPolicy(policy: FreedomdPolicy): string;
@@ -0,0 +1,114 @@
1
+ /**
2
+ * Freedomd policy compiler.
3
+ *
4
+ * Translates environment, org defaults, and optional user config into a
5
+ * normalized policy that drives provider-sovereignty routing, retention gates,
6
+ * and degraded-mode fallback decisions.
7
+ */
8
+ const DEFAULT_POLICY = {
9
+ mode: "off",
10
+ preferLocal: false,
11
+ maxRetentionDays: Number.POSITIVE_INFINITY,
12
+ allowExportRestrictedProvider: true,
13
+ allowProviderExceptions: true,
14
+ requireLocalEvidenceEnvelope: false,
15
+ providerOverrides: {},
16
+ maxJurisdictionRisk: 1.0,
17
+ maxRetentionRisk: 1.0,
18
+ maxCutoffRisk: 1.0,
19
+ incidentFeedUrls: [],
20
+ };
21
+ function parseMode(raw) {
22
+ if (!raw)
23
+ return undefined;
24
+ const normalized = raw.trim().toLowerCase();
25
+ if (normalized === "off" || normalized === "0" || normalized === "false")
26
+ return "off";
27
+ if (normalized === "balanced" || normalized === "1" || normalized === "true")
28
+ return "balanced";
29
+ if (normalized === "strict" || normalized === "2")
30
+ return "strict";
31
+ return undefined;
32
+ }
33
+ function parseBoolean(raw) {
34
+ if (raw === undefined)
35
+ return undefined;
36
+ const normalized = raw.trim().toLowerCase();
37
+ if (normalized === "1" || normalized === "true" || normalized === "on")
38
+ return true;
39
+ if (normalized === "0" || normalized === "false" || normalized === "off")
40
+ return false;
41
+ return undefined;
42
+ }
43
+ function parseNumber(raw) {
44
+ if (raw === undefined)
45
+ return undefined;
46
+ const value = Number(raw);
47
+ if (!Number.isFinite(value))
48
+ return undefined;
49
+ return value;
50
+ }
51
+ function mergePolicy(base, patch) {
52
+ return {
53
+ ...base,
54
+ ...patch,
55
+ providerOverrides: {
56
+ ...base.providerOverrides,
57
+ ...patch.providerOverrides,
58
+ },
59
+ };
60
+ }
61
+ export function compileFreedomdPolicy(inputs = {}) {
62
+ const env = inputs.env ?? process.env;
63
+ let policy = mergePolicy(DEFAULT_POLICY, inputs.orgDefaults ?? {});
64
+ const envMode = parseMode(env.OMK_FREEDOMD_MODE);
65
+ if (envMode !== undefined) {
66
+ policy = mergePolicy(policy, { mode: envMode });
67
+ }
68
+ const preferLocal = parseBoolean(env.OMK_PREFER_LOCAL);
69
+ if (preferLocal !== undefined) {
70
+ policy = mergePolicy(policy, { preferLocal });
71
+ }
72
+ const maxRetentionDays = parseNumber(env.OMK_MAX_RETENTION_DAYS);
73
+ if (maxRetentionDays !== undefined) {
74
+ policy = mergePolicy(policy, { maxRetentionDays });
75
+ }
76
+ const allowExportRestricted = parseBoolean(env.OMK_BLOCK_EXPORT_RESTRICTED);
77
+ if (allowExportRestricted !== undefined) {
78
+ policy = mergePolicy(policy, { allowExportRestrictedProvider: !allowExportRestricted });
79
+ }
80
+ const allowProviderExceptions = parseBoolean(env.OMK_ALLOW_PROVIDER_EXCEPTIONS);
81
+ if (allowProviderExceptions !== undefined) {
82
+ policy = mergePolicy(policy, { allowProviderExceptions });
83
+ }
84
+ const incidentFeedUrlsRaw = env.OMK_FREEDOMD_FEED_URLS;
85
+ if (incidentFeedUrlsRaw) {
86
+ const urls = incidentFeedUrlsRaw.split(",").map((u) => u.trim()).filter(Boolean);
87
+ policy = mergePolicy(policy, { incidentFeedUrls: urls });
88
+ }
89
+ policy = mergePolicy(policy, inputs.taskFlags ?? {});
90
+ if (policy.mode === "strict") {
91
+ policy = mergePolicy(policy, {
92
+ preferLocal: true,
93
+ allowExportRestrictedProvider: false,
94
+ requireLocalEvidenceEnvelope: true,
95
+ });
96
+ if (!Number.isFinite(policy.maxRetentionDays) || policy.maxRetentionDays > 0) {
97
+ policy = mergePolicy(policy, { maxRetentionDays: 0 });
98
+ }
99
+ }
100
+ return policy;
101
+ }
102
+ export function isFreedomdEnabled(policy) {
103
+ return policy.mode !== "off";
104
+ }
105
+ export function explainFreedomdPolicy(policy) {
106
+ return [
107
+ `mode=${policy.mode}`,
108
+ `preferLocal=${policy.preferLocal}`,
109
+ `maxRetentionDays=${Number.isFinite(policy.maxRetentionDays) ? policy.maxRetentionDays : "unlimited"}`,
110
+ `allowExportRestricted=${policy.allowExportRestrictedProvider}`,
111
+ `allowExceptions=${policy.allowProviderExceptions}`,
112
+ `localEvidenceEnvelope=${policy.requireLocalEvidenceEnvelope}`,
113
+ ].join("; ");
114
+ }
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Freedomd runtime router.
3
+ *
4
+ * Wraps the base RuntimeRouter with provider-sovereignty scoring, data-retention
5
+ * gating, cutoff-resilient fallback, degraded-mode planning, and local-first
6
+ * evidence envelopes. This is the control-plane boundary that keeps OMK loops
7
+ * alive when a provider becomes unavailable or policy-blocked.
8
+ */
9
+ import type { AgentRunResult, AgentRuntime, AgentTask, AgentTaskSovereignty } from "./agent-runtime.js";
10
+ import type { ContextCapsule } from "./context-capsule.js";
11
+ import type { LocalGraphMemoryStore } from "../memory/local-graph-memory-store.js";
12
+ import { type RuntimeRouterOptions } from "./runtime-router.js";
13
+ import { type FreedomdMode, type FreedomdPolicy } from "./freedomd-policy.js";
14
+ import { type ProviderIncidentState, type ProviderSovereigntyProfile, type SovereigntyScore } from "./provider-sovereignty.js";
15
+ import { type DataRetentionGateResult } from "./data-retention-gate.js";
16
+ import { type ProviderExceptionResult } from "./freedomd-exception.js";
17
+ export type { FreedomdMode };
18
+ export interface FreedomdRouterOptions extends RuntimeRouterOptions {
19
+ readonly freedomdMode?: FreedomdMode;
20
+ readonly userCountry?: string;
21
+ readonly sovereigntyProfiles?: Readonly<Record<string, ProviderSovereigntyProfile>>;
22
+ readonly incidents?: readonly ProviderIncidentState[];
23
+ readonly graphStore?: LocalGraphMemoryStore;
24
+ readonly allowRedaction?: boolean;
25
+ readonly projectRoot?: string;
26
+ readonly autoLoadIncidents?: boolean;
27
+ readonly promptUser?: (message: string) => Promise<string>;
28
+ readonly isTty?: boolean;
29
+ }
30
+ export interface FreedomdScoredRuntime {
31
+ readonly runtime: AgentRuntime;
32
+ readonly score: number;
33
+ readonly sovereignty: SovereigntyScore;
34
+ readonly retention: DataRetentionGateResult;
35
+ }
36
+ export interface FreedomdDegradedPlan {
37
+ readonly mode: string;
38
+ readonly runtime?: AgentRuntime;
39
+ readonly allowedCapabilities: readonly string[];
40
+ readonly reason: string;
41
+ readonly blockedOriginalAuthority?: readonly string[];
42
+ }
43
+ export interface FreedomdRouteResult {
44
+ readonly selectedRuntime?: AgentRuntime;
45
+ readonly fallbackChain: readonly AgentRuntime[];
46
+ readonly degradedPlan?: FreedomdDegradedPlan;
47
+ readonly sovereignty: AgentTaskSovereignty;
48
+ readonly diagnostics: string;
49
+ readonly providerException?: ProviderExceptionResult;
50
+ }
51
+ export declare function evaluateTaskSovereignty(task: AgentTask, policy: FreedomdPolicy, runtimes: readonly AgentRuntime[], incidents?: readonly ProviderIncidentState[]): AgentTaskSovereignty;
52
+ export declare function scoreRuntimesWithSovereignty(task: AgentTask, runtimes: readonly AgentRuntime[], policy: FreedomdPolicy, options?: {
53
+ readonly profiles?: Readonly<Record<string, ProviderSovereigntyProfile>>;
54
+ readonly incidents?: readonly ProviderIncidentState[];
55
+ readonly userCountry?: string;
56
+ readonly allowRedaction?: boolean;
57
+ readonly capsule?: ContextCapsule;
58
+ }): FreedomdScoredRuntime[];
59
+ export declare function buildFreedomdDegradedPlan(task: AgentTask, reason: string, runtimes: readonly AgentRuntime[]): FreedomdDegradedPlan;
60
+ export declare function createFreedomdRuntimeRouter(options?: FreedomdRouterOptions): Promise<{
61
+ readonly policy: FreedomdPolicy;
62
+ readonly baseRouter: unknown;
63
+ readonly freedomdRoute: (task: AgentTask, capsule: ContextCapsule) => Promise<FreedomdRouteResult>;
64
+ readonly scoreRuntimesWithSovereignty: (task: AgentTask) => FreedomdScoredRuntime[];
65
+ readonly executeTask: (task: AgentTask, capsule: ContextCapsule, signal: AbortSignal) => Promise<AgentRunResult>;
66
+ }>;