@kognai/orchestrator-core 0.1.0
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 +44 -0
- package/dist/index.d.ts +63 -0
- package/dist/index.js +175 -0
- package/dist/lib/aar-middleware.d.ts +6 -0
- package/dist/lib/aar-middleware.js +70 -0
- package/dist/lib/aar-types.d.ts +34 -0
- package/dist/lib/aar-types.js +4 -0
- package/dist/lib/acp-engine.d.ts +68 -0
- package/dist/lib/acp-engine.js +123 -0
- package/dist/lib/acp.d.ts +61 -0
- package/dist/lib/acp.js +425 -0
- package/dist/lib/agent-registry.d.ts +50 -0
- package/dist/lib/agent-registry.js +137 -0
- package/dist/lib/anthropic-direct.d.ts +27 -0
- package/dist/lib/anthropic-direct.js +109 -0
- package/dist/lib/asmr-extractor.d.ts +40 -0
- package/dist/lib/asmr-extractor.js +151 -0
- package/dist/lib/asmr-retrieval.d.ts +76 -0
- package/dist/lib/asmr-retrieval.js +311 -0
- package/dist/lib/asmr.d.ts +8 -0
- package/dist/lib/asmr.js +24 -0
- package/dist/lib/brainx-client.d.ts +72 -0
- package/dist/lib/brainx-client.js +200 -0
- package/dist/lib/brainx-embed.d.ts +14 -0
- package/dist/lib/brainx-embed.js +139 -0
- package/dist/lib/brainx-swarm-bridge.d.ts +93 -0
- package/dist/lib/brainx-swarm-bridge.js +242 -0
- package/dist/lib/byterover-client.d.ts +19 -0
- package/dist/lib/byterover-client.js +59 -0
- package/dist/lib/ceo-wallet.d.ts +37 -0
- package/dist/lib/ceo-wallet.js +176 -0
- package/dist/lib/chomsky-gate.d.ts +24 -0
- package/dist/lib/chomsky-gate.js +178 -0
- package/dist/lib/chomsky-runner.d.ts +29 -0
- package/dist/lib/chomsky-runner.js +157 -0
- package/dist/lib/citizen-score-contract.d.ts +72 -0
- package/dist/lib/citizen-score-contract.js +16 -0
- package/dist/lib/citizen-score-registry.d.ts +25 -0
- package/dist/lib/citizen-score-registry.js +65 -0
- package/dist/lib/citizenship.d.ts +103 -0
- package/dist/lib/citizenship.js +272 -0
- package/dist/lib/clawrouter-client.d.ts +37 -0
- package/dist/lib/clawrouter-client.js +148 -0
- package/dist/lib/code-asset-crystalliser.d.ts +41 -0
- package/dist/lib/code-asset-crystalliser.js +181 -0
- package/dist/lib/code-failure-logger.d.ts +27 -0
- package/dist/lib/code-failure-logger.js +42 -0
- package/dist/lib/cto-approval-gate.d.ts +45 -0
- package/dist/lib/cto-approval-gate.js +478 -0
- package/dist/lib/cto-gate-types.d.ts +28 -0
- package/dist/lib/cto-gate-types.js +8 -0
- package/dist/lib/decomposer-feedback.d.ts +54 -0
- package/dist/lib/decomposer-feedback.js +115 -0
- package/dist/lib/emotional-safety-gate.d.ts +48 -0
- package/dist/lib/emotional-safety-gate.js +97 -0
- package/dist/lib/engine-paths.d.ts +13 -0
- package/dist/lib/engine-paths.js +32 -0
- package/dist/lib/event-bus-listener.d.ts +8 -0
- package/dist/lib/event-bus-listener.js +144 -0
- package/dist/lib/event-bus-publisher.d.ts +25 -0
- package/dist/lib/event-bus-publisher.js +188 -0
- package/dist/lib/event-bus-types.d.ts +73 -0
- package/dist/lib/event-bus-types.js +23 -0
- package/dist/lib/failure-library.d.ts +178 -0
- package/dist/lib/failure-library.js +349 -0
- package/dist/lib/ksl/error-log.d.ts +28 -0
- package/dist/lib/ksl/error-log.js +43 -0
- package/dist/lib/ksl/index.d.ts +9 -0
- package/dist/lib/ksl/index.js +25 -0
- package/dist/lib/ksl/orchestrator-tap.d.ts +16 -0
- package/dist/lib/ksl/orchestrator-tap.js +85 -0
- package/dist/lib/ksl/record-writer.d.ts +46 -0
- package/dist/lib/ksl/record-writer.js +45 -0
- package/dist/lib/llm-cost-table.d.ts +36 -0
- package/dist/lib/llm-cost-table.js +90 -0
- package/dist/lib/local-model-router.d.ts +27 -0
- package/dist/lib/local-model-router.js +61 -0
- package/dist/lib/mc-client.d.ts +51 -0
- package/dist/lib/mc-client.js +249 -0
- package/dist/lib/model-router-contract.d.ts +91 -0
- package/dist/lib/model-router-contract.js +19 -0
- package/dist/lib/model-router-registry.d.ts +24 -0
- package/dist/lib/model-router-registry.js +52 -0
- package/dist/lib/model-router.d.ts +20 -0
- package/dist/lib/model-router.js +79 -0
- package/dist/lib/monotask-state-machine.d.ts +19 -0
- package/dist/lib/monotask-state-machine.js +131 -0
- package/dist/lib/neutral-prompt-checker.d.ts +22 -0
- package/dist/lib/neutral-prompt-checker.js +130 -0
- package/dist/lib/notion-direct.d.ts +92 -0
- package/dist/lib/notion-direct.js +381 -0
- package/dist/lib/ollama-client.d.ts +37 -0
- package/dist/lib/ollama-client.js +158 -0
- package/dist/lib/omel/credential-vault.d.ts +57 -0
- package/dist/lib/omel/credential-vault.js +324 -0
- package/dist/lib/omel/human-brake.d.ts +32 -0
- package/dist/lib/omel/human-brake.js +289 -0
- package/dist/lib/omel/index.d.ts +10 -0
- package/dist/lib/omel/index.js +26 -0
- package/dist/lib/omel/phantom-workspace.d.ts +31 -0
- package/dist/lib/omel/phantom-workspace.js +256 -0
- package/dist/lib/omel/wipe-witness.d.ts +75 -0
- package/dist/lib/omel/wipe-witness.js +398 -0
- package/dist/lib/orchestrate-engine.d.ts +25 -0
- package/dist/lib/orchestrate-engine.js +4436 -0
- package/dist/lib/perm-judge.d.ts +46 -0
- package/dist/lib/perm-judge.js +173 -0
- package/dist/lib/plumber/conformance.d.ts +54 -0
- package/dist/lib/plumber/conformance.js +121 -0
- package/dist/lib/plumber/index.d.ts +9 -0
- package/dist/lib/plumber/index.js +25 -0
- package/dist/lib/plumber/observer.d.ts +52 -0
- package/dist/lib/plumber/observer.js +180 -0
- package/dist/lib/plumber/types.d.ts +78 -0
- package/dist/lib/plumber/types.js +29 -0
- package/dist/lib/research-impl-gate.d.ts +16 -0
- package/dist/lib/research-impl-gate.js +105 -0
- package/dist/lib/sherlock-memory.d.ts +29 -0
- package/dist/lib/sherlock-memory.js +105 -0
- package/dist/lib/skill-crystalliser.d.ts +44 -0
- package/dist/lib/skill-crystalliser.js +60 -0
- package/dist/lib/sprint-runner-engine.d.ts +27 -0
- package/dist/lib/sprint-runner-engine.js +1042 -0
- package/dist/lib/sprint-state.d.ts +71 -0
- package/dist/lib/sprint-state.js +202 -0
- package/dist/lib/stuck-handler.d.ts +17 -0
- package/dist/lib/stuck-handler.js +249 -0
- package/dist/lib/task-contract-checker.d.ts +17 -0
- package/dist/lib/task-contract-checker.js +29 -0
- package/dist/lib/task-router/index.d.ts +17 -0
- package/dist/lib/task-router/index.js +52 -0
- package/dist/lib/task-router/router/generate-execution-id.d.ts +10 -0
- package/dist/lib/task-router/router/generate-execution-id.js +24 -0
- package/dist/lib/task-router/router/resolve-route.d.ts +2 -0
- package/dist/lib/task-router/router/resolve-route.js +49 -0
- package/dist/lib/task-router/types.d.ts +79 -0
- package/dist/lib/task-router/types.js +39 -0
- package/dist/lib/token-budget-validator.d.ts +44 -0
- package/dist/lib/token-budget-validator.js +84 -0
- package/dist/lib/trust-score-updater.d.ts +30 -0
- package/dist/lib/trust-score-updater.js +107 -0
- package/dist/lib/wallet-state.d.ts +26 -0
- package/dist/lib/wallet-state.js +85 -0
- package/package.json +27 -0
package/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# @kognai/orchestrator-core
|
|
2
|
+
|
|
3
|
+
The **core engine** of the Kognai sovereign orchestrator — template-agnostic. One
|
|
4
|
+
versioned package, consumed by every product, so an engine fix lands **once** and
|
|
5
|
+
products upgrade by bumping the version.
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
Core engine (this package) + per-product template:
|
|
9
|
+
Kognai → coding template
|
|
10
|
+
Voxight → market-intelligence template
|
|
11
|
+
Invoica → financial-compliance template
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Why this exists (TICKET-215)
|
|
15
|
+
|
|
16
|
+
The engine (`orchestrate-agents-v2`, `sprint-runner`, `lib/*`) was **copy-forked**
|
|
17
|
+
across repos. On 2026-05-30, Kognai's copy got TICKET-210/213/214 while Invoica's copy
|
|
18
|
+
got its own independent fixes — the two engines diverged and fixes never propagated.
|
|
19
|
+
This package ends that: single canonical source, semver'd.
|
|
20
|
+
|
|
21
|
+
## Phase 1 (this release, v0.1.0) — clean leaf modules
|
|
22
|
+
|
|
23
|
+
Path-agnostic, dependency-light modules extracted first:
|
|
24
|
+
|
|
25
|
+
| Module | Exports |
|
|
26
|
+
|--------|---------|
|
|
27
|
+
| `model-router` | `classifyTask`, `selectModel`, `getFallbackModel`, `EXPERTISE_MODELS` |
|
|
28
|
+
| `anthropic-direct` | `callAnthropic` (zero-dep raw HTTPS — no `@anthropic-ai/sdk`) |
|
|
29
|
+
| `decomposer-feedback` | `routeToDecomposer` (incl. TICKET-214 authoring no-split guard) |
|
|
30
|
+
| `stuck-handler` | `detectStuckPattern`, `escalateStuckTask`, `escalationPaused` (TICKET-204) |
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
import { detectStuckPattern, routeToDecomposer, callAnthropic } from '@kognai/orchestrator-core';
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Roadmap
|
|
37
|
+
|
|
38
|
+
- **Phase 2** — cut Kognai over: replace `scripts/lib/{these}` with imports from this
|
|
39
|
+
package (de-duplicate); verify the live swarm.
|
|
40
|
+
- **Phase 3** — extract the larger engine (`sprint-runner`, `orchestrate-agents-v2`)
|
|
41
|
+
after parameterizing repo-specific paths (`.swarm-state`, `workspace/sprints`, etc.).
|
|
42
|
+
- **Phase 4** — migrate Invoica + Voxight to consume the package; delete their forks.
|
|
43
|
+
|
|
44
|
+
Until a product cuts over, it keeps its local copy — **no behavior change**.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @kognai/orchestrator-core — public surface.
|
|
3
|
+
*
|
|
4
|
+
* Phase 1 (TICKET-215): the clean, path-agnostic leaf modules of the core engine.
|
|
5
|
+
* These were copy-forked across repos (kognai, Invoica); this package is the single
|
|
6
|
+
* canonical home so a fix lands once and every product upgrades by version.
|
|
7
|
+
*
|
|
8
|
+
* Subsequent phases extract the larger engine (orchestrate-agents-v2 / sprint-runner)
|
|
9
|
+
* after their repo-specific paths are parameterized. Until a product cuts over, it
|
|
10
|
+
* keeps its local copy — no behavior change.
|
|
11
|
+
*/
|
|
12
|
+
export * from './lib/model-router';
|
|
13
|
+
export * from './lib/anthropic-direct';
|
|
14
|
+
export * from './lib/decomposer-feedback';
|
|
15
|
+
export * from './lib/stuck-handler';
|
|
16
|
+
export * from './lib/engine-paths';
|
|
17
|
+
export * from './lib/code-failure-logger';
|
|
18
|
+
export * from './lib/failure-library';
|
|
19
|
+
export * from './lib/monotask-state-machine';
|
|
20
|
+
export * from './lib/llm-cost-table';
|
|
21
|
+
export * from './lib/token-budget-validator';
|
|
22
|
+
export * from './lib/trust-score-updater';
|
|
23
|
+
export * from './lib/citizenship';
|
|
24
|
+
export * from './lib/agent-registry';
|
|
25
|
+
export * from './lib/sprint-state';
|
|
26
|
+
export * as ksl from './lib/ksl';
|
|
27
|
+
export * from './lib/wallet-state';
|
|
28
|
+
export * from './lib/ceo-wallet';
|
|
29
|
+
export * from './lib/event-bus-types';
|
|
30
|
+
export * from './lib/event-bus-publisher';
|
|
31
|
+
export * from './lib/event-bus-listener';
|
|
32
|
+
export * from './lib/emotional-safety-gate';
|
|
33
|
+
export * from './lib/acp';
|
|
34
|
+
export * from './lib/acp-engine';
|
|
35
|
+
export * as omel from './lib/omel';
|
|
36
|
+
export * from './lib/aar-types';
|
|
37
|
+
export * from './lib/aar-middleware';
|
|
38
|
+
export * from './lib/local-model-router';
|
|
39
|
+
export * from './lib/model-router-contract';
|
|
40
|
+
export * from './lib/model-router-registry';
|
|
41
|
+
export * from './lib/byterover-client';
|
|
42
|
+
export * from './lib/clawrouter-client';
|
|
43
|
+
export * from './lib/ollama-client';
|
|
44
|
+
export * from './lib/mc-client';
|
|
45
|
+
export * from './lib/brainx-embed';
|
|
46
|
+
export * from './lib/brainx-client';
|
|
47
|
+
export * from './lib/brainx-swarm-bridge';
|
|
48
|
+
export * from './lib/code-asset-crystalliser';
|
|
49
|
+
export * from './lib/skill-crystalliser';
|
|
50
|
+
export * from './lib/chomsky-gate';
|
|
51
|
+
export * from './lib/chomsky-runner';
|
|
52
|
+
export * as asmr from './lib/asmr';
|
|
53
|
+
export * as plumber from './lib/plumber';
|
|
54
|
+
export * from './lib/perm-judge';
|
|
55
|
+
export * from './lib/cto-gate-types';
|
|
56
|
+
export * from './lib/neutral-prompt-checker';
|
|
57
|
+
export * from './lib/research-impl-gate';
|
|
58
|
+
export * from './lib/task-contract-checker';
|
|
59
|
+
export { CTOApprovalResult, requestCTOApproval, batchCTOReview } from './lib/cto-approval-gate';
|
|
60
|
+
export * from './lib/citizen-score-contract';
|
|
61
|
+
export * from './lib/citizen-score-registry';
|
|
62
|
+
export { runOrchestrator } from './lib/orchestrate-engine';
|
|
63
|
+
export { runSprintCycle, SprintRunnerOpts } from './lib/sprint-runner-engine';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @kognai/orchestrator-core — public surface.
|
|
4
|
+
*
|
|
5
|
+
* Phase 1 (TICKET-215): the clean, path-agnostic leaf modules of the core engine.
|
|
6
|
+
* These were copy-forked across repos (kognai, Invoica); this package is the single
|
|
7
|
+
* canonical home so a fix lands once and every product upgrades by version.
|
|
8
|
+
*
|
|
9
|
+
* Subsequent phases extract the larger engine (orchestrate-agents-v2 / sprint-runner)
|
|
10
|
+
* after their repo-specific paths are parameterized. Until a product cuts over, it
|
|
11
|
+
* keeps its local copy — no behavior change.
|
|
12
|
+
*/
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
30
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
31
|
+
};
|
|
32
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
33
|
+
var ownKeys = function(o) {
|
|
34
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
35
|
+
var ar = [];
|
|
36
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
37
|
+
return ar;
|
|
38
|
+
};
|
|
39
|
+
return ownKeys(o);
|
|
40
|
+
};
|
|
41
|
+
return function (mod) {
|
|
42
|
+
if (mod && mod.__esModule) return mod;
|
|
43
|
+
var result = {};
|
|
44
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
45
|
+
__setModuleDefault(result, mod);
|
|
46
|
+
return result;
|
|
47
|
+
};
|
|
48
|
+
})();
|
|
49
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
+
exports.runSprintCycle = exports.runOrchestrator = exports.batchCTOReview = exports.requestCTOApproval = exports.plumber = exports.asmr = exports.omel = exports.ksl = void 0;
|
|
51
|
+
// Model routing — task classification + tier/model selection (pure).
|
|
52
|
+
__exportStar(require("./lib/model-router"), exports);
|
|
53
|
+
// Anthropic Messages client — zero-dep raw HTTPS (no @anthropic-ai/sdk).
|
|
54
|
+
__exportStar(require("./lib/anthropic-direct"), exports);
|
|
55
|
+
// Decomposer feedback — deterministic structural re-split of rejected tasks
|
|
56
|
+
// (incl. TICKET-214 authoring-task no-split guard).
|
|
57
|
+
__exportStar(require("./lib/decomposer-feedback"), exports);
|
|
58
|
+
// Stuck-task escalation — detector + CEO/CTO consult (TICKET-204);
|
|
59
|
+
// kill switch .swarm-state/escalation-paused.
|
|
60
|
+
__exportStar(require("./lib/stuck-handler"), exports);
|
|
61
|
+
// Phase 3: path-parameterization seam — repo-specific dirs resolved from
|
|
62
|
+
// KOGNAI_ROOT/cwd so the engine is location-independent.
|
|
63
|
+
__exportStar(require("./lib/engine-paths"), exports);
|
|
64
|
+
// Failure library logger — files swarm code rejections (now path-parameterized).
|
|
65
|
+
__exportStar(require("./lib/code-failure-logger"), exports);
|
|
66
|
+
// Failure library consumer (TICKET-152 Gap 2) — aggregate + LESSONS.md promoter
|
|
67
|
+
// + retry-aware retrieval (closes the loop the logger opened).
|
|
68
|
+
__exportStar(require("./lib/failure-library"), exports);
|
|
69
|
+
// Phase 3b-2: clean stdlib-only engine leaves extracted from scripts/lib.
|
|
70
|
+
// AMD-08 monotask state machine (one task per agent, depth ≤ 3, audit log).
|
|
71
|
+
__exportStar(require("./lib/monotask-state-machine"), exports);
|
|
72
|
+
// Per-model USD pricing table + computeCost (anti-burn wallet ledger).
|
|
73
|
+
__exportStar(require("./lib/llm-cost-table"), exports);
|
|
74
|
+
// Deterministic pre-flight truncation gate (MiniMax token budget).
|
|
75
|
+
__exportStar(require("./lib/token-budget-validator"), exports);
|
|
76
|
+
// Dynamic ACP trust-score updater (root via engine-paths — Phase 3b-2).
|
|
77
|
+
__exportStar(require("./lib/trust-score-updater"), exports);
|
|
78
|
+
// Citizenship issuance + registry I/O (root via engine-paths — Phase 3b-2).
|
|
79
|
+
__exportStar(require("./lib/citizenship"), exports);
|
|
80
|
+
// Phase 3b-3: sprint-runner's reusable engine leaves (root via engine-paths).
|
|
81
|
+
// Executable-agent inventory + sprint-task validation (miner-or-founder guard).
|
|
82
|
+
__exportStar(require("./lib/agent-registry"), exports);
|
|
83
|
+
// TICKET-098 sprint runtime-state split (committed defs vs gitignored status).
|
|
84
|
+
__exportStar(require("./lib/sprint-state"), exports);
|
|
85
|
+
// Phase 3b-3 Wave B: KSL capture cluster (session records + error log + tap).
|
|
86
|
+
// Namespaced ('ksl.tapAttempt', 'ksl.writeRecord', 'ksl.record', …) to keep the
|
|
87
|
+
// generic 'record' export off the package's flat public surface.
|
|
88
|
+
exports.ksl = __importStar(require("./lib/ksl"));
|
|
89
|
+
// Phase 3b-3 Wave B: the bank/wallet leaves (root via engine-paths).
|
|
90
|
+
// CFO ClawRouter budget state — degraded ≥80% / frozen ≥95% guard.
|
|
91
|
+
__exportStar(require("./lib/wallet-state"), exports);
|
|
92
|
+
// CEO Wallet per-call spend ledger + provider budget status + spend alerts.
|
|
93
|
+
__exportStar(require("./lib/ceo-wallet"), exports);
|
|
94
|
+
// Phase 3b-3 Wave B: event-bus cluster (raw-HTTPS Supabase REST, no SDK).
|
|
95
|
+
// Shared event taxonomy + type guards.
|
|
96
|
+
__exportStar(require("./lib/event-bus-types"), exports);
|
|
97
|
+
// Fire-and-forget publishers (task/budget/sprint/achiri events).
|
|
98
|
+
__exportStar(require("./lib/event-bus-publisher"), exports);
|
|
99
|
+
// Ring-buffered polling subscriber.
|
|
100
|
+
__exportStar(require("./lib/event-bus-listener"), exports);
|
|
101
|
+
// Phase 3b-3 Wave B: gate/measure leaves (clean — no viem; the cto-approval
|
|
102
|
+
// gate that consumes these stays put behind the Wave C viem decision).
|
|
103
|
+
// PACT emotional-safety calm-gate (assess + shouldProceed).
|
|
104
|
+
__exportStar(require("./lib/emotional-safety-gate"), exports);
|
|
105
|
+
// ACP capability registry (tiers, capability checks, sprint assignment validation).
|
|
106
|
+
__exportStar(require("./lib/acp"), exports);
|
|
107
|
+
// ACP enforcement engine — trust-scores.json via engine-paths (<root>/acp/...).
|
|
108
|
+
__exportStar(require("./lib/acp-engine"), exports);
|
|
109
|
+
// Phase 3b-3 Wave B: OMEL safety cluster (credential vault, human-brake kill
|
|
110
|
+
// switch, phantom workspace, wipe-witness). Namespaced ('omel.*') — cohesive
|
|
111
|
+
// subsystem, roots via engine-paths.
|
|
112
|
+
exports.omel = __importStar(require("./lib/omel"));
|
|
113
|
+
// Phase 3b-3 Wave B: AAR (after-action receipt) types + write middleware
|
|
114
|
+
// (EAS/CHAIN registry paths via engine-paths).
|
|
115
|
+
__exportStar(require("./lib/aar-types"), exports);
|
|
116
|
+
__exportStar(require("./lib/aar-middleware"), exports);
|
|
117
|
+
// Local-model routing measure (deps model-router + wallet-state now in core).
|
|
118
|
+
__exportStar(require("./lib/local-model-router"), exports);
|
|
119
|
+
// Phase 3b-3 Wave C: the model-routing SEAM. Zero-dep contract + injection
|
|
120
|
+
// registry that decouples the orchestrator from any concrete (viem-backed)
|
|
121
|
+
// router — so core never depends on viem; Kognai injects its router at boot.
|
|
122
|
+
__exportStar(require("./lib/model-router-contract"), exports);
|
|
123
|
+
__exportStar(require("./lib/model-router-registry"), exports);
|
|
124
|
+
// TICKET-215 Wave D: integration-client leaves (stdlib-only wrappers).
|
|
125
|
+
// ByteRover memory client · legacy ClawRouter availability client · Ollama client
|
|
126
|
+
// · mc-client (env-agnostic; dotenv loaded by the scripts/ shim, not core).
|
|
127
|
+
__exportStar(require("./lib/byterover-client"), exports);
|
|
128
|
+
__exportStar(require("./lib/clawrouter-client"), exports);
|
|
129
|
+
__exportStar(require("./lib/ollama-client"), exports);
|
|
130
|
+
__exportStar(require("./lib/mc-client"), exports);
|
|
131
|
+
// TICKET-215 Wave D: brainx memory client cluster (embed → client → swarm-bridge).
|
|
132
|
+
__exportStar(require("./lib/brainx-embed"), exports);
|
|
133
|
+
__exportStar(require("./lib/brainx-client"), exports);
|
|
134
|
+
__exportStar(require("./lib/brainx-swarm-bridge"), exports);
|
|
135
|
+
// Crystallisers — code-asset + skill (skill-crystalliser is the Plumber's skill sink).
|
|
136
|
+
__exportStar(require("./lib/code-asset-crystalliser"), exports);
|
|
137
|
+
__exportStar(require("./lib/skill-crystalliser"), exports);
|
|
138
|
+
// Chomsky prompt-quality gate + runner (route via the model-router seam).
|
|
139
|
+
__exportStar(require("./lib/chomsky-gate"), exports);
|
|
140
|
+
__exportStar(require("./lib/chomsky-runner"), exports);
|
|
141
|
+
// ASMR episodic memory (extract → retrieve) + Sherlock supervisor-memory context.
|
|
142
|
+
// Namespaced ('asmr.*') — RetrievalResult etc. would collide with failure-library.
|
|
143
|
+
exports.asmr = __importStar(require("./lib/asmr"));
|
|
144
|
+
// TICKET-216: Plumber observability cluster (observer half). Read-only self-healer
|
|
145
|
+
// — KSL records → conformance (Position-Map-aware, TICKET-153) → routed
|
|
146
|
+
// observations (failure substrate / skill candidates / plumber.alert). Namespaced
|
|
147
|
+
// ('plumber.observe', 'plumber.classify', 'plumber.runConformance', …).
|
|
148
|
+
exports.plumber = __importStar(require("./lib/plumber"));
|
|
149
|
+
// TICKET-215 Wave D: perm-judge — constitutional dispute / reward-signal scorer
|
|
150
|
+
// (routes via the model-router seam, root via engine-paths).
|
|
151
|
+
__exportStar(require("./lib/perm-judge"), exports);
|
|
152
|
+
// TICKET-215 Wave D: governance checks + the lifted SprintProposal type (breaks the
|
|
153
|
+
// former cto-approval-gate ↔ governance type cycle).
|
|
154
|
+
__exportStar(require("./lib/cto-gate-types"), exports);
|
|
155
|
+
__exportStar(require("./lib/neutral-prompt-checker"), exports);
|
|
156
|
+
__exportStar(require("./lib/research-impl-gate"), exports);
|
|
157
|
+
__exportStar(require("./lib/task-contract-checker"), exports);
|
|
158
|
+
// TICKET-215 Wave D split step 2: CTO approval gate extracted into core (imports
|
|
159
|
+
// repointed to core siblings; SprintProposal no longer re-exported here — lives in
|
|
160
|
+
// cto-gate-types above to avoid collision).
|
|
161
|
+
var cto_approval_gate_1 = require("./lib/cto-approval-gate");
|
|
162
|
+
Object.defineProperty(exports, "requestCTOApproval", { enumerable: true, get: function () { return cto_approval_gate_1.requestCTOApproval; } });
|
|
163
|
+
Object.defineProperty(exports, "batchCTOReview", { enumerable: true, get: function () { return cto_approval_gate_1.batchCTOReview; } });
|
|
164
|
+
// TICKET-215 Wave D: citizen-scoring SEAM — zero-dep contract + injection registry.
|
|
165
|
+
// The @godman-protocols/score-backed scorer is injected (Kognai-local, like x402Router);
|
|
166
|
+
// recordTaskScoreMonitored emits a data.citizen_score event so every score flows back to
|
|
167
|
+
// Kognai monitoring (event-bus / kognai_events) and is Plumber-observable.
|
|
168
|
+
__exportStar(require("./lib/citizen-score-contract"), exports);
|
|
169
|
+
__exportStar(require("./lib/citizen-score-registry"), exports);
|
|
170
|
+
// TICKET-215 Wave D split step 2: engine + sprint-runner entry points.
|
|
171
|
+
// Inject seams via kognai-bootstrap (side-effect import) before calling.
|
|
172
|
+
var orchestrate_engine_1 = require("./lib/orchestrate-engine");
|
|
173
|
+
Object.defineProperty(exports, "runOrchestrator", { enumerable: true, get: function () { return orchestrate_engine_1.runOrchestrator; } });
|
|
174
|
+
var sprint_runner_engine_1 = require("./lib/sprint-runner-engine");
|
|
175
|
+
Object.defineProperty(exports, "runSprintCycle", { enumerable: true, get: function () { return sprint_runner_engine_1.runSprintCycle; } });
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { AARReceipt, AARWriteResult, AARParams } from './aar-types';
|
|
2
|
+
export declare class AARMiddleware {
|
|
3
|
+
static generateReceipt(params: AARParams): AARReceipt;
|
|
4
|
+
static writeLog(receipt: AARReceipt): AARWriteResult;
|
|
5
|
+
static generateAndLog(params: AARParams): Promise<AARWriteResult>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// AMD-01 CHAIN3 — Agent Action Receipt middleware
|
|
3
|
+
// Phase 1: generate receipt + append to logs/aar/YYYY-MM-DD.jsonl
|
|
4
|
+
// Phase 2 (TODO): write EAS on-chain attestation via base.easscan.org
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.AARMiddleware = void 0;
|
|
7
|
+
const crypto_1 = require("crypto");
|
|
8
|
+
const fs_1 = require("fs");
|
|
9
|
+
const path_1 = require("path");
|
|
10
|
+
const engine_paths_1 = require("./engine-paths");
|
|
11
|
+
const ROOT = (0, engine_paths_1.resolveEnginePaths)().root;
|
|
12
|
+
const EAS_SCHEMAS_PATH = (0, path_1.join)(ROOT, 'workspace/shared-context/EAS_SCHEMAS.json');
|
|
13
|
+
const CHAIN_REGISTRY_PATH = (0, path_1.join)(ROOT, 'workspace/shared-context/CHAIN_REGISTRY.json');
|
|
14
|
+
function loadConfig() {
|
|
15
|
+
const schemas = JSON.parse((0, fs_1.readFileSync)(EAS_SCHEMAS_PATH, 'utf-8'));
|
|
16
|
+
return {
|
|
17
|
+
enabled: true,
|
|
18
|
+
logDir: (0, path_1.join)(ROOT, 'logs/aar'),
|
|
19
|
+
onChainEnabled: false,
|
|
20
|
+
easEndpoint: schemas.easContract,
|
|
21
|
+
taskCompletionSchemaUid: schemas.schemas.taskCompletion.uid,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function getAgentAddress(agentId) {
|
|
25
|
+
try {
|
|
26
|
+
const registry = JSON.parse((0, fs_1.readFileSync)(CHAIN_REGISTRY_PATH, 'utf-8'));
|
|
27
|
+
return registry.agents[agentId]?.ownerAddress || '0x0000000000000000000000000000000000000000';
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return '0x0000000000000000000000000000000000000000';
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
class AARMiddleware {
|
|
34
|
+
static generateReceipt(params) {
|
|
35
|
+
const receiptId = `${params.sprintId}-${params.taskId}-${Date.now()}`;
|
|
36
|
+
const agentAddress = getAgentAddress(params.agentId);
|
|
37
|
+
const partial = {
|
|
38
|
+
receiptId,
|
|
39
|
+
agentId: params.agentId,
|
|
40
|
+
agentAddress,
|
|
41
|
+
taskId: params.taskId,
|
|
42
|
+
sprintId: params.sprintId,
|
|
43
|
+
skillId: params.skillId,
|
|
44
|
+
outcomeScore: params.outcomeScore,
|
|
45
|
+
actionSummary: params.actionSummary.substring(0, 140),
|
|
46
|
+
timestamp: new Date().toISOString(),
|
|
47
|
+
status: params.status,
|
|
48
|
+
};
|
|
49
|
+
const aarReceiptHash = (0, crypto_1.createHash)('sha256')
|
|
50
|
+
.update(JSON.stringify(partial))
|
|
51
|
+
.digest('hex');
|
|
52
|
+
return { ...partial, aarReceiptHash };
|
|
53
|
+
}
|
|
54
|
+
static writeLog(receipt) {
|
|
55
|
+
const config = loadConfig();
|
|
56
|
+
if (!config.enabled)
|
|
57
|
+
return { receipt, logFile: '' };
|
|
58
|
+
const today = new Date().toISOString().substring(0, 10);
|
|
59
|
+
const logFile = (0, path_1.join)(config.logDir, `${today}.jsonl`);
|
|
60
|
+
if (!(0, fs_1.existsSync)(config.logDir))
|
|
61
|
+
(0, fs_1.mkdirSync)(config.logDir, { recursive: true });
|
|
62
|
+
(0, fs_1.appendFileSync)(logFile, JSON.stringify(receipt) + '\n', 'utf-8');
|
|
63
|
+
return { receipt, logFile };
|
|
64
|
+
}
|
|
65
|
+
static async generateAndLog(params) {
|
|
66
|
+
const receipt = AARMiddleware.generateReceipt(params);
|
|
67
|
+
return AARMiddleware.writeLog(receipt);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.AARMiddleware = AARMiddleware;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export interface AARReceipt {
|
|
2
|
+
receiptId: string;
|
|
3
|
+
agentId: string;
|
|
4
|
+
agentAddress: string;
|
|
5
|
+
taskId: string;
|
|
6
|
+
sprintId: string;
|
|
7
|
+
skillId: string;
|
|
8
|
+
outcomeScore: number;
|
|
9
|
+
actionSummary: string;
|
|
10
|
+
aarReceiptHash: string;
|
|
11
|
+
timestamp: string;
|
|
12
|
+
status: 'success' | 'failed' | 'rejected';
|
|
13
|
+
}
|
|
14
|
+
export interface AARConfig {
|
|
15
|
+
enabled: boolean;
|
|
16
|
+
logDir: string;
|
|
17
|
+
onChainEnabled: boolean;
|
|
18
|
+
easEndpoint: string;
|
|
19
|
+
taskCompletionSchemaUid: string;
|
|
20
|
+
}
|
|
21
|
+
export interface AARWriteResult {
|
|
22
|
+
receipt: AARReceipt;
|
|
23
|
+
logFile: string;
|
|
24
|
+
onChainTxHash?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface AARParams {
|
|
27
|
+
agentId: string;
|
|
28
|
+
taskId: string;
|
|
29
|
+
sprintId: string;
|
|
30
|
+
skillId: string;
|
|
31
|
+
outcomeScore: number;
|
|
32
|
+
actionSummary: string;
|
|
33
|
+
status: 'success' | 'failed' | 'rejected';
|
|
34
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ACP Engine v1.0 — Agent Constitutional Protocol
|
|
3
|
+
*
|
|
4
|
+
* Multi-dimensional trust scoring + routing enforcement.
|
|
5
|
+
* Reads trust-scores.json, computes composite scores, enforces thresholds.
|
|
6
|
+
* Used by the model router and orchestrator to gate agent access.
|
|
7
|
+
*/
|
|
8
|
+
export interface DimensionConfig {
|
|
9
|
+
weight: number;
|
|
10
|
+
description: string;
|
|
11
|
+
}
|
|
12
|
+
export interface AgentScores {
|
|
13
|
+
safety: number;
|
|
14
|
+
accuracy: number;
|
|
15
|
+
brand_alignment: number;
|
|
16
|
+
cultural_sensitivity: number;
|
|
17
|
+
legal_compliance: number;
|
|
18
|
+
psychological_resilience: number;
|
|
19
|
+
composite: number;
|
|
20
|
+
last_updated: string;
|
|
21
|
+
}
|
|
22
|
+
export interface Thresholds {
|
|
23
|
+
minimum_route: number;
|
|
24
|
+
recycle_trigger: number;
|
|
25
|
+
promote_to_primary: number;
|
|
26
|
+
dimension_minimum: number;
|
|
27
|
+
safety_hard_floor: number;
|
|
28
|
+
}
|
|
29
|
+
export interface RoutingRule {
|
|
30
|
+
task_type: string;
|
|
31
|
+
preferred_agent: string;
|
|
32
|
+
fallback_agent: string | null;
|
|
33
|
+
min_composite: number;
|
|
34
|
+
required_dimensions: string[];
|
|
35
|
+
}
|
|
36
|
+
export interface TrustScoresData {
|
|
37
|
+
version: string;
|
|
38
|
+
dimensions: Record<string, DimensionConfig>;
|
|
39
|
+
scores: Record<string, AgentScores>;
|
|
40
|
+
thresholds: Thresholds;
|
|
41
|
+
routing_rules: RoutingRule[];
|
|
42
|
+
}
|
|
43
|
+
export interface EnforcementResult {
|
|
44
|
+
allowed: boolean;
|
|
45
|
+
agent_id: string;
|
|
46
|
+
composite: number;
|
|
47
|
+
violations: string[];
|
|
48
|
+
recommendation: "route" | "fallback" | "block" | "recycle";
|
|
49
|
+
}
|
|
50
|
+
export declare class ACPEngine {
|
|
51
|
+
private data;
|
|
52
|
+
constructor(dataPath?: string);
|
|
53
|
+
/** Get all dimension configs */
|
|
54
|
+
getDimensions(): Record<string, DimensionConfig>;
|
|
55
|
+
/** Get scores for a specific agent */
|
|
56
|
+
getAgentScores(agentId: string): AgentScores | null;
|
|
57
|
+
/** Recompute composite score from dimension scores using weights */
|
|
58
|
+
computeComposite(scores: AgentScores): number;
|
|
59
|
+
/** Check if an agent is allowed to be routed for a given task type */
|
|
60
|
+
enforce(agentId: string, taskType: string): EnforcementResult;
|
|
61
|
+
/** Get the best agent for a task type, respecting enforcement */
|
|
62
|
+
resolveAgent(taskType: string): {
|
|
63
|
+
agent: string;
|
|
64
|
+
enforced: boolean;
|
|
65
|
+
} | null;
|
|
66
|
+
/** List all agents with their enforcement status for a task type */
|
|
67
|
+
auditAll(taskType: string): EnforcementResult[];
|
|
68
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* ACP Engine v1.0 — Agent Constitutional Protocol
|
|
4
|
+
*
|
|
5
|
+
* Multi-dimensional trust scoring + routing enforcement.
|
|
6
|
+
* Reads trust-scores.json, computes composite scores, enforces thresholds.
|
|
7
|
+
* Used by the model router and orchestrator to gate agent access.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.ACPEngine = void 0;
|
|
11
|
+
const fs_1 = require("fs");
|
|
12
|
+
const path_1 = require("path");
|
|
13
|
+
const engine_paths_1 = require("./engine-paths");
|
|
14
|
+
// ── Engine ─────────────────────────────────────────────
|
|
15
|
+
class ACPEngine {
|
|
16
|
+
data;
|
|
17
|
+
constructor(dataPath) {
|
|
18
|
+
const path = dataPath || (0, path_1.join)((0, engine_paths_1.resolveEnginePaths)().root, "acp", "trust-scores.json");
|
|
19
|
+
this.data = JSON.parse((0, fs_1.readFileSync)(path, "utf-8"));
|
|
20
|
+
}
|
|
21
|
+
/** Get all dimension configs */
|
|
22
|
+
getDimensions() {
|
|
23
|
+
return this.data.dimensions;
|
|
24
|
+
}
|
|
25
|
+
/** Get scores for a specific agent */
|
|
26
|
+
getAgentScores(agentId) {
|
|
27
|
+
return this.data.scores[agentId] || null;
|
|
28
|
+
}
|
|
29
|
+
/** Recompute composite score from dimension scores using weights */
|
|
30
|
+
computeComposite(scores) {
|
|
31
|
+
const dims = this.data.dimensions;
|
|
32
|
+
let weighted = 0;
|
|
33
|
+
let totalWeight = 0;
|
|
34
|
+
for (const [dim, config] of Object.entries(dims)) {
|
|
35
|
+
const val = scores[dim];
|
|
36
|
+
if (typeof val === "number") {
|
|
37
|
+
weighted += val * config.weight;
|
|
38
|
+
totalWeight += config.weight;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return totalWeight > 0 ? Math.round(weighted / totalWeight) : 0;
|
|
42
|
+
}
|
|
43
|
+
/** Check if an agent is allowed to be routed for a given task type */
|
|
44
|
+
enforce(agentId, taskType) {
|
|
45
|
+
const scores = this.data.scores[agentId];
|
|
46
|
+
const thresholds = this.data.thresholds;
|
|
47
|
+
const violations = [];
|
|
48
|
+
if (!scores) {
|
|
49
|
+
return {
|
|
50
|
+
allowed: false,
|
|
51
|
+
agent_id: agentId,
|
|
52
|
+
composite: 0,
|
|
53
|
+
violations: [`Agent '${agentId}' not found in trust scores`],
|
|
54
|
+
recommendation: "block",
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const composite = this.computeComposite(scores);
|
|
58
|
+
// Safety hard floor — non-negotiable
|
|
59
|
+
if (scores.safety < thresholds.safety_hard_floor) {
|
|
60
|
+
violations.push(`Safety score ${scores.safety} below hard floor ${thresholds.safety_hard_floor}`);
|
|
61
|
+
}
|
|
62
|
+
// Composite minimum
|
|
63
|
+
if (composite < thresholds.minimum_route) {
|
|
64
|
+
violations.push(`Composite ${composite} below minimum route threshold ${thresholds.minimum_route}`);
|
|
65
|
+
}
|
|
66
|
+
// Find matching routing rule
|
|
67
|
+
const rule = this.data.routing_rules.find((r) => r.task_type === taskType);
|
|
68
|
+
if (rule) {
|
|
69
|
+
// Check min composite for this task type
|
|
70
|
+
if (composite < rule.min_composite) {
|
|
71
|
+
violations.push(`Composite ${composite} below task-type '${taskType}' minimum ${rule.min_composite}`);
|
|
72
|
+
}
|
|
73
|
+
// Check required dimensions meet dimension_minimum
|
|
74
|
+
for (const dim of rule.required_dimensions) {
|
|
75
|
+
const val = scores[dim];
|
|
76
|
+
if (typeof val === "number" && val < thresholds.dimension_minimum) {
|
|
77
|
+
violations.push(`Dimension '${dim}' score ${val} below minimum ${thresholds.dimension_minimum}`);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
// Determine recommendation
|
|
82
|
+
let recommendation;
|
|
83
|
+
if (composite < thresholds.recycle_trigger) {
|
|
84
|
+
recommendation = "recycle";
|
|
85
|
+
}
|
|
86
|
+
else if (violations.length > 0) {
|
|
87
|
+
recommendation = rule?.fallback_agent ? "fallback" : "block";
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
recommendation = "route";
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
allowed: violations.length === 0,
|
|
94
|
+
agent_id: agentId,
|
|
95
|
+
composite,
|
|
96
|
+
violations,
|
|
97
|
+
recommendation,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
/** Get the best agent for a task type, respecting enforcement */
|
|
101
|
+
resolveAgent(taskType) {
|
|
102
|
+
const rule = this.data.routing_rules.find((r) => r.task_type === taskType);
|
|
103
|
+
if (!rule)
|
|
104
|
+
return null;
|
|
105
|
+
const primaryResult = this.enforce(rule.preferred_agent, taskType);
|
|
106
|
+
if (primaryResult.allowed) {
|
|
107
|
+
return { agent: rule.preferred_agent, enforced: false };
|
|
108
|
+
}
|
|
109
|
+
// Try fallback
|
|
110
|
+
if (rule.fallback_agent) {
|
|
111
|
+
const fallbackResult = this.enforce(rule.fallback_agent, taskType);
|
|
112
|
+
if (fallbackResult.allowed) {
|
|
113
|
+
return { agent: rule.fallback_agent, enforced: true };
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return null; // No eligible agent
|
|
117
|
+
}
|
|
118
|
+
/** List all agents with their enforcement status for a task type */
|
|
119
|
+
auditAll(taskType) {
|
|
120
|
+
return Object.keys(this.data.scores).map((agentId) => this.enforce(agentId, taskType));
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
exports.ACPEngine = ACPEngine;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ACP — Agent Capability Protocol v1
|
|
3
|
+
*
|
|
4
|
+
* Defines capability declarations for each agent in the Kognai swarm.
|
|
5
|
+
* Each agent declares what it CAN and CANNOT do, enabling:
|
|
6
|
+
* - Constitution enforcement (prevent agents from exceeding scope)
|
|
7
|
+
* - CTO approval gate capability checks
|
|
8
|
+
* - Task routing based on declared capabilities
|
|
9
|
+
*
|
|
10
|
+
* Capability tiers:
|
|
11
|
+
* T1 (Foundation): read, write, search
|
|
12
|
+
* T2 (Content): llm_call, tts, video_gen, script_gen
|
|
13
|
+
* T3 (Integration): api_call, db_query, telegram, stripe
|
|
14
|
+
* T4 (System): deploy, pm2, git_push, shell_exec
|
|
15
|
+
*
|
|
16
|
+
* Sprint 650 — ACP v1 implementation
|
|
17
|
+
*/
|
|
18
|
+
export type CapabilityTier = 'T1' | 'T2' | 'T3' | 'T4';
|
|
19
|
+
export type Capability = 'read_files' | 'write_files' | 'search_code' | 'git_read' | 'llm_call_local' | 'llm_call_cloud' | 'tts_generate' | 'video_composite' | 'script_generate' | 'image_generate' | 'avatar_generate' | 'api_call_external' | 'db_query' | 'db_write' | 'telegram_send' | 'stripe_read' | 'stripe_write' | 'youtube_read' | 'tiktok_post' | 'deploy' | 'pm2_manage' | 'git_push' | 'shell_exec' | 'env_modify';
|
|
20
|
+
export interface AgentCapabilityDeclaration {
|
|
21
|
+
agent_id: string;
|
|
22
|
+
display_name: string;
|
|
23
|
+
tier: CapabilityTier;
|
|
24
|
+
capabilities: Capability[];
|
|
25
|
+
denied: Capability[];
|
|
26
|
+
scope: string;
|
|
27
|
+
max_model_tier: 'nano' | 'local' | 'power' | 'cloud' | 'apex';
|
|
28
|
+
}
|
|
29
|
+
export interface CapabilityCheckResult {
|
|
30
|
+
allowed: boolean;
|
|
31
|
+
agent_id: string;
|
|
32
|
+
capability: Capability;
|
|
33
|
+
reason: string;
|
|
34
|
+
}
|
|
35
|
+
/** Get all registered agents */
|
|
36
|
+
export declare function getAllAgents(): AgentCapabilityDeclaration[];
|
|
37
|
+
/** Get a specific agent by ID */
|
|
38
|
+
export declare function getAgent(agentId: string): AgentCapabilityDeclaration | undefined;
|
|
39
|
+
/** Check if an agent has a specific capability */
|
|
40
|
+
export declare function checkCapability(agentId: string, capability: Capability): CapabilityCheckResult;
|
|
41
|
+
/** Check multiple capabilities at once */
|
|
42
|
+
export declare function checkCapabilities(agentId: string, capabilities: Capability[]): CapabilityCheckResult[];
|
|
43
|
+
/** Get all agents with a specific capability */
|
|
44
|
+
export declare function getAgentsWithCapability(capability: Capability): AgentCapabilityDeclaration[];
|
|
45
|
+
/** Get the tier for a capability */
|
|
46
|
+
export declare function getCapabilityTier(capability: Capability): CapabilityTier | undefined;
|
|
47
|
+
/** Validate that a sprint's task assignments respect ACP */
|
|
48
|
+
export declare function validateSprintAssignments(tasks: Array<{
|
|
49
|
+
agent: string;
|
|
50
|
+
required_capabilities: Capability[];
|
|
51
|
+
}>): {
|
|
52
|
+
valid: boolean;
|
|
53
|
+
violations: CapabilityCheckResult[];
|
|
54
|
+
};
|
|
55
|
+
/** Get summary stats */
|
|
56
|
+
export declare function getRegistryStats(): {
|
|
57
|
+
total_agents: number;
|
|
58
|
+
by_tier: Record<CapabilityTier, number>;
|
|
59
|
+
kognai_agents: number;
|
|
60
|
+
scs001_agents: number;
|
|
61
|
+
};
|