@kognai/build 0.6.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 +91 -0
- package/dist/bin/kognai-build.js +774 -0
- package/dist/bin/kognai.js +323 -0
- package/dist/lib/boot-env.js +30 -0
- package/dist/lib/cost-estimator.js +54 -0
- package/dist/lib/knowledge.js +256 -0
- package/dist/lib/mandate.js +360 -0
- package/dist/lib/memory.js +243 -0
- package/dist/lib/registry-overrides.js +40 -0
- package/dist/lib/router.js +119 -0
- package/dist/lib/skill-bank-stub.js +214 -0
- package/dist/lib/skill-bank.js +248 -0
- package/dist/lib/swarm-coder-prompt.js +39 -0
- package/dist/lib/swarm.js +89 -0
- package/dist/lib/tool-layer-stub.js +214 -0
- package/dist/lib/tool-layer.js +249 -0
- package/dist/lib/workspace.js +221 -0
- package/dist/templates/index.js +184 -0
- package/dist/templates/registry.js +82 -0
- package/package.json +45 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.makeBuildRouter = makeBuildRouter;
|
|
7
|
+
/**
|
|
8
|
+
* router.ts — ModelRouter adapter for kognai-build (TICKET-233 Phase 1).
|
|
9
|
+
*
|
|
10
|
+
* Registers via setModelRouter() so the ENTIRE kognai-build pipeline routes
|
|
11
|
+
* through @kognai/orchestrator-core instead of calling the Anthropic SDK
|
|
12
|
+
* directly. This is the substrate swap that makes the flagship CLI genuinely
|
|
13
|
+
* engine-backed and sovereign-capable:
|
|
14
|
+
*
|
|
15
|
+
* - cloud tier → Anthropic (builder's BYO ANTHROPIC_API_KEY)
|
|
16
|
+
* - sovereign / local tier → Ollama ($0, Mac Mini vault / localhost)
|
|
17
|
+
*
|
|
18
|
+
* No viem / wallet / x402 required — that stays in @kognai/clawrouter-x402 and
|
|
19
|
+
* can be slotted in later for PACT-metered billing (TICKET-120).
|
|
20
|
+
*/
|
|
21
|
+
const sdk_1 = __importDefault(require("@anthropic-ai/sdk"));
|
|
22
|
+
const orchestrator_core_1 = require("@kognai/orchestrator-core");
|
|
23
|
+
// complexity → concrete model, per backend.
|
|
24
|
+
const CLOUD_MODEL = {
|
|
25
|
+
nano: 'claude-haiku-4-5-20251001',
|
|
26
|
+
local: 'claude-haiku-4-5-20251001',
|
|
27
|
+
power: 'claude-sonnet-4-6',
|
|
28
|
+
exec: 'claude-sonnet-4-6',
|
|
29
|
+
apex: 'claude-sonnet-4-6', // opus can be slotted here for constitutional/apex work
|
|
30
|
+
};
|
|
31
|
+
const LOCAL_MODEL = {
|
|
32
|
+
nano: 'qwen3:0.6b',
|
|
33
|
+
local: 'qwen3:4b',
|
|
34
|
+
power: 'qwen3:14b',
|
|
35
|
+
exec: 'deepseek-r1:14b',
|
|
36
|
+
apex: 'qwen3:32b',
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Build a ModelRouter for kognai-build. `sovereign` forces every call to the
|
|
40
|
+
* local Ollama backend ($0); otherwise calls go to Anthropic (BYO key).
|
|
41
|
+
*/
|
|
42
|
+
function makeBuildRouter(sovereign) {
|
|
43
|
+
let _anth = null;
|
|
44
|
+
const anth = () => {
|
|
45
|
+
if (_anth)
|
|
46
|
+
return _anth;
|
|
47
|
+
const key = process.env.ANTHROPIC_API_KEY;
|
|
48
|
+
if (!key) {
|
|
49
|
+
throw new Error('ANTHROPIC_API_KEY not set — required for cloud tiers. Use --sovereign for $0 local inference.');
|
|
50
|
+
}
|
|
51
|
+
return (_anth = new sdk_1.default({ apiKey: key }));
|
|
52
|
+
};
|
|
53
|
+
const digest = {
|
|
54
|
+
total_usd: 0,
|
|
55
|
+
by_tier: {},
|
|
56
|
+
by_agent: {},
|
|
57
|
+
tokens_saved_by_qcg: 0,
|
|
58
|
+
call_count: 0,
|
|
59
|
+
};
|
|
60
|
+
async function call(prompt, opts) {
|
|
61
|
+
const complexity = opts?.complexity ?? 'power';
|
|
62
|
+
const maxTokens = opts?.maxTokens ?? 4096;
|
|
63
|
+
const agent = opts?.agentId ?? 'kognai-build';
|
|
64
|
+
if (sovereign) {
|
|
65
|
+
const model = LOCAL_MODEL[complexity];
|
|
66
|
+
const r = await (0, orchestrator_core_1.callOllama)({ model, prompt, systemPrompt: opts?.systemPrompt, maxTokens });
|
|
67
|
+
digest.call_count++;
|
|
68
|
+
return { content: r.content, model: r.model, tier: `local:${complexity}`, cost_usd: 0 };
|
|
69
|
+
}
|
|
70
|
+
const model = CLOUD_MODEL[complexity];
|
|
71
|
+
const resp = await anth().messages.create({
|
|
72
|
+
model,
|
|
73
|
+
max_tokens: maxTokens,
|
|
74
|
+
system: opts?.systemPrompt,
|
|
75
|
+
messages: [{ role: 'user', content: prompt }],
|
|
76
|
+
});
|
|
77
|
+
const text = resp.content.map((b) => (b.type === 'text' ? b.text : '')).join('');
|
|
78
|
+
const cost = (0, orchestrator_core_1.computeCost)(model, resp.usage.input_tokens, resp.usage.output_tokens);
|
|
79
|
+
digest.total_usd += cost;
|
|
80
|
+
digest.call_count++;
|
|
81
|
+
digest.by_tier[complexity] = (digest.by_tier[complexity] ?? 0) + cost;
|
|
82
|
+
digest.by_agent[agent] = (digest.by_agent[agent] ?? 0) + cost;
|
|
83
|
+
return { content: text, model, tier: `cloud:${complexity}`, cost_usd: cost };
|
|
84
|
+
}
|
|
85
|
+
return {
|
|
86
|
+
callLLM: call,
|
|
87
|
+
async routeCall(req) {
|
|
88
|
+
const prompt = req.payload?.prompt ?? '';
|
|
89
|
+
const r = await call(prompt, {
|
|
90
|
+
systemPrompt: req.payload?.system,
|
|
91
|
+
complexity: req.complexity,
|
|
92
|
+
agentId: req.agent_id,
|
|
93
|
+
taskType: req.task_type,
|
|
94
|
+
});
|
|
95
|
+
return {
|
|
96
|
+
content: r.content,
|
|
97
|
+
model: r.model,
|
|
98
|
+
tier: r.tier,
|
|
99
|
+
local: sovereign,
|
|
100
|
+
cost_usd: r.cost_usd,
|
|
101
|
+
input_tokens: 0,
|
|
102
|
+
output_tokens: 0,
|
|
103
|
+
qcg_compressed: false,
|
|
104
|
+
tokens_saved_by_qcg: 0,
|
|
105
|
+
agent_id: req.agent_id,
|
|
106
|
+
task_type: req.task_type,
|
|
107
|
+
timestamp: new Date().toISOString(),
|
|
108
|
+
};
|
|
109
|
+
},
|
|
110
|
+
async healthCheck() {
|
|
111
|
+
return {
|
|
112
|
+
ollama: await (0, orchestrator_core_1.ollamaIsAvailable)(),
|
|
113
|
+
gateway: !!process.env.ANTHROPIC_API_KEY,
|
|
114
|
+
models: [],
|
|
115
|
+
};
|
|
116
|
+
},
|
|
117
|
+
getDailyCostDigest: () => digest,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Skill Bank Stub
|
|
4
|
+
*
|
|
5
|
+
* Mock skill metadata registry used by the cost estimator and capability
|
|
6
|
+
* preview during Phase 1. Phase 2 (TICKET-055 + TICKET-102) will replace
|
|
7
|
+
* the in-memory SKILL_BANK array with a real registry read backed by the
|
|
8
|
+
* skill bank service. The function signatures below are the stable
|
|
9
|
+
* contract that downstream consumers can rely on across both phases.
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.SKILL_BANK = void 0;
|
|
13
|
+
exports.getSkillsByIds = getSkillsByIds;
|
|
14
|
+
exports.listSkillsByCategory = listSkillsByCategory;
|
|
15
|
+
/**
|
|
16
|
+
* Stub skill registry covering the categories declared by the 9 starter
|
|
17
|
+
* templates. ~20 entries spanning validation, security, data, api,
|
|
18
|
+
* testing, devops, and content.
|
|
19
|
+
*/
|
|
20
|
+
exports.SKILL_BANK = [
|
|
21
|
+
// --- validation ---
|
|
22
|
+
{
|
|
23
|
+
id: 'schema-validation',
|
|
24
|
+
name: 'Schema Validation',
|
|
25
|
+
tier: 'T2',
|
|
26
|
+
category: 'validation',
|
|
27
|
+
description: 'Validate payloads against declarative schemas (Zod/JSON Schema).',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
id: 'type-narrowing',
|
|
31
|
+
name: 'Type Narrowing',
|
|
32
|
+
tier: 'T2',
|
|
33
|
+
category: 'validation',
|
|
34
|
+
description: 'Refine union types via discriminants and predicate guards.',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: 'input-sanitization',
|
|
38
|
+
name: 'Input Sanitization',
|
|
39
|
+
tier: 'T2',
|
|
40
|
+
category: 'validation',
|
|
41
|
+
description: 'Strip, escape, and normalize untrusted user input.',
|
|
42
|
+
},
|
|
43
|
+
// --- security ---
|
|
44
|
+
{
|
|
45
|
+
id: 'audit-logging',
|
|
46
|
+
name: 'Audit Logging',
|
|
47
|
+
tier: 'T2.5',
|
|
48
|
+
category: 'security',
|
|
49
|
+
description: 'Emit tamper-evident audit trails for privileged actions.',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: 'secret-rotation',
|
|
53
|
+
name: 'Secret Rotation',
|
|
54
|
+
tier: 'T3',
|
|
55
|
+
category: 'security',
|
|
56
|
+
description: 'Rotate API keys and credentials with zero-downtime cutover.',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
id: 'jwt-issuance',
|
|
60
|
+
name: 'JWT Issuance',
|
|
61
|
+
tier: 'T2.5',
|
|
62
|
+
category: 'security',
|
|
63
|
+
description: 'Mint, sign, and verify JSON Web Tokens with rotation support.',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
id: 'threat-modeling',
|
|
67
|
+
name: 'Threat Modeling',
|
|
68
|
+
tier: 'T3',
|
|
69
|
+
category: 'security',
|
|
70
|
+
description: 'STRIDE-style threat analysis for system designs.',
|
|
71
|
+
},
|
|
72
|
+
// --- data ---
|
|
73
|
+
{
|
|
74
|
+
id: 'postgres-migration',
|
|
75
|
+
name: 'Postgres Migration',
|
|
76
|
+
tier: 'T2.5',
|
|
77
|
+
category: 'data',
|
|
78
|
+
description: 'Author safe, reversible Postgres schema migrations.',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: 'etl-windowing',
|
|
82
|
+
name: 'ETL Windowing',
|
|
83
|
+
tier: 'T3',
|
|
84
|
+
category: 'data',
|
|
85
|
+
description: 'Tumbling/sliding window aggregations for streaming ETL.',
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
id: 'schema-evolution',
|
|
89
|
+
name: 'Schema Evolution',
|
|
90
|
+
tier: 'T3',
|
|
91
|
+
category: 'data',
|
|
92
|
+
description: 'Backwards-compatible schema changes for long-lived data.',
|
|
93
|
+
},
|
|
94
|
+
// --- api ---
|
|
95
|
+
{
|
|
96
|
+
id: 'rest-design',
|
|
97
|
+
name: 'REST Design',
|
|
98
|
+
tier: 'T2',
|
|
99
|
+
category: 'api',
|
|
100
|
+
description: 'Design resource-oriented REST endpoints with proper verbs/codes.',
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
id: 'graphql-resolver',
|
|
104
|
+
name: 'GraphQL Resolver',
|
|
105
|
+
tier: 'T2.5',
|
|
106
|
+
category: 'api',
|
|
107
|
+
description: 'Author GraphQL resolvers with dataloader batching.',
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
id: 'x402-meter',
|
|
111
|
+
name: 'x402 Meter',
|
|
112
|
+
tier: 'T3',
|
|
113
|
+
category: 'api',
|
|
114
|
+
description: 'HTTP 402 payment metering middleware for API monetization.',
|
|
115
|
+
},
|
|
116
|
+
// --- testing ---
|
|
117
|
+
{
|
|
118
|
+
id: 'unit-test-author',
|
|
119
|
+
name: 'Unit Test Author',
|
|
120
|
+
tier: 'T1',
|
|
121
|
+
category: 'testing',
|
|
122
|
+
description: 'Write focused unit tests with clear arrange/act/assert.',
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
id: 'integration-test-author',
|
|
126
|
+
name: 'Integration Test Author',
|
|
127
|
+
tier: 'T2',
|
|
128
|
+
category: 'testing',
|
|
129
|
+
description: 'Cross-module tests with real or hermetic dependencies.',
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
id: 'property-test',
|
|
133
|
+
name: 'Property Test',
|
|
134
|
+
tier: 'T2.5',
|
|
135
|
+
category: 'testing',
|
|
136
|
+
description: 'Generative property-based testing with shrinking.',
|
|
137
|
+
},
|
|
138
|
+
// --- devops ---
|
|
139
|
+
{
|
|
140
|
+
id: 'ci-config',
|
|
141
|
+
name: 'CI Config',
|
|
142
|
+
tier: 'T2',
|
|
143
|
+
category: 'devops',
|
|
144
|
+
description: 'Continuous integration pipelines (GitHub Actions/GitLab CI).',
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
id: 'docker-compose',
|
|
148
|
+
name: 'Docker Compose',
|
|
149
|
+
tier: 'T2',
|
|
150
|
+
category: 'devops',
|
|
151
|
+
description: 'Local multi-service orchestration via docker-compose.',
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
id: 'deployment-manifest',
|
|
155
|
+
name: 'Deployment Manifest',
|
|
156
|
+
tier: 'T2.5',
|
|
157
|
+
category: 'devops',
|
|
158
|
+
description: 'Kubernetes/Nomad deployment manifests with health checks.',
|
|
159
|
+
},
|
|
160
|
+
// --- content ---
|
|
161
|
+
{
|
|
162
|
+
id: 'copyedit',
|
|
163
|
+
name: 'Copyedit',
|
|
164
|
+
tier: 'T1',
|
|
165
|
+
category: 'content',
|
|
166
|
+
description: 'Grammar, clarity, and tone editing for written copy.',
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
id: 'citation-format',
|
|
170
|
+
name: 'Citation Format',
|
|
171
|
+
tier: 'T1',
|
|
172
|
+
category: 'content',
|
|
173
|
+
description: 'Format citations in APA/MLA/Chicago style.',
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
id: 'seo-optimize',
|
|
177
|
+
name: 'SEO Optimize',
|
|
178
|
+
tier: 'T2',
|
|
179
|
+
category: 'content',
|
|
180
|
+
description: 'Optimize page content for search engine ranking.',
|
|
181
|
+
},
|
|
182
|
+
];
|
|
183
|
+
/**
|
|
184
|
+
* Build a lookup index by id. Materialized once at module load; the stub
|
|
185
|
+
* registry is small enough that a Map is overkill but keeps the contract
|
|
186
|
+
* identical when Phase 2 swaps in a larger registry.
|
|
187
|
+
*/
|
|
188
|
+
const SKILL_INDEX = new Map(exports.SKILL_BANK.map((entry) => [entry.id, entry]));
|
|
189
|
+
/**
|
|
190
|
+
* Return skill entries for the given ids, preserving caller order.
|
|
191
|
+
* Unknown ids are silently skipped — callers that need strict resolution
|
|
192
|
+
* should diff the returned ids against their input.
|
|
193
|
+
*/
|
|
194
|
+
function getSkillsByIds(ids) {
|
|
195
|
+
if (!Array.isArray(ids) || ids.length === 0)
|
|
196
|
+
return [];
|
|
197
|
+
const out = [];
|
|
198
|
+
for (const id of ids) {
|
|
199
|
+
const entry = SKILL_INDEX.get(id);
|
|
200
|
+
if (entry)
|
|
201
|
+
out.push(entry);
|
|
202
|
+
}
|
|
203
|
+
return out;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Return all skill entries in the given category. Category match is
|
|
207
|
+
* case-insensitive to tolerate template author inconsistency.
|
|
208
|
+
*/
|
|
209
|
+
function listSkillsByCategory(category) {
|
|
210
|
+
if (typeof category !== 'string' || category.length === 0)
|
|
211
|
+
return [];
|
|
212
|
+
const needle = category.toLowerCase();
|
|
213
|
+
return exports.SKILL_BANK.filter((entry) => entry.category.toLowerCase() === needle);
|
|
214
|
+
}
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SKILL_BANK = void 0;
|
|
4
|
+
exports.getSkillsByIds = getSkillsByIds;
|
|
5
|
+
exports.listSkillsByCategory = listSkillsByCategory;
|
|
6
|
+
exports.unknownSkillIds = unknownSkillIds;
|
|
7
|
+
/**
|
|
8
|
+
* Skill Bank (TICKET-055 / skill-bank-v2) — the registry of skills (tiered
|
|
9
|
+
* capabilities) templates declare and the mandate preview validates/resolves.
|
|
10
|
+
*
|
|
11
|
+
* The curated catalog below is the base registry; a workspace extends or
|
|
12
|
+
* overrides it via `.kognai/skills.json` (merged at module load). Skills are
|
|
13
|
+
* capabilities, not metered tools — they carry no per-call cost.
|
|
14
|
+
*/
|
|
15
|
+
const registry_overrides_1 = require("./registry-overrides");
|
|
16
|
+
/**
|
|
17
|
+
* Curated skill registry covering the capabilities declared by the starter
|
|
18
|
+
* templates — validation, security, data, api, testing, devops, content,
|
|
19
|
+
* research, frontend, cli, reliability, performance, and media.
|
|
20
|
+
*/
|
|
21
|
+
exports.SKILL_BANK = [
|
|
22
|
+
// --- validation ---
|
|
23
|
+
{
|
|
24
|
+
id: 'schema-validation',
|
|
25
|
+
name: 'Schema Validation',
|
|
26
|
+
tier: 'T2',
|
|
27
|
+
category: 'validation',
|
|
28
|
+
description: 'Validate payloads against declarative schemas (Zod/JSON Schema).',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: 'type-narrowing',
|
|
32
|
+
name: 'Type Narrowing',
|
|
33
|
+
tier: 'T2',
|
|
34
|
+
category: 'validation',
|
|
35
|
+
description: 'Refine union types via discriminants and predicate guards.',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: 'input-sanitization',
|
|
39
|
+
name: 'Input Sanitization',
|
|
40
|
+
tier: 'T2',
|
|
41
|
+
category: 'validation',
|
|
42
|
+
description: 'Strip, escape, and normalize untrusted user input.',
|
|
43
|
+
},
|
|
44
|
+
// --- security ---
|
|
45
|
+
{
|
|
46
|
+
id: 'audit-logging',
|
|
47
|
+
name: 'Audit Logging',
|
|
48
|
+
tier: 'T2.5',
|
|
49
|
+
category: 'security',
|
|
50
|
+
description: 'Emit tamper-evident audit trails for privileged actions.',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
id: 'secret-rotation',
|
|
54
|
+
name: 'Secret Rotation',
|
|
55
|
+
tier: 'T3',
|
|
56
|
+
category: 'security',
|
|
57
|
+
description: 'Rotate API keys and credentials with zero-downtime cutover.',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: 'jwt-issuance',
|
|
61
|
+
name: 'JWT Issuance',
|
|
62
|
+
tier: 'T2.5',
|
|
63
|
+
category: 'security',
|
|
64
|
+
description: 'Mint, sign, and verify JSON Web Tokens with rotation support.',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
id: 'threat-modeling',
|
|
68
|
+
name: 'Threat Modeling',
|
|
69
|
+
tier: 'T3',
|
|
70
|
+
category: 'security',
|
|
71
|
+
description: 'STRIDE-style threat analysis for system designs.',
|
|
72
|
+
},
|
|
73
|
+
// --- data ---
|
|
74
|
+
{
|
|
75
|
+
id: 'postgres-migration',
|
|
76
|
+
name: 'Postgres Migration',
|
|
77
|
+
tier: 'T2.5',
|
|
78
|
+
category: 'data',
|
|
79
|
+
description: 'Author safe, reversible Postgres schema migrations.',
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
id: 'etl-windowing',
|
|
83
|
+
name: 'ETL Windowing',
|
|
84
|
+
tier: 'T3',
|
|
85
|
+
category: 'data',
|
|
86
|
+
description: 'Tumbling/sliding window aggregations for streaming ETL.',
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
id: 'schema-evolution',
|
|
90
|
+
name: 'Schema Evolution',
|
|
91
|
+
tier: 'T3',
|
|
92
|
+
category: 'data',
|
|
93
|
+
description: 'Backwards-compatible schema changes for long-lived data.',
|
|
94
|
+
},
|
|
95
|
+
// --- api ---
|
|
96
|
+
{
|
|
97
|
+
id: 'rest-design',
|
|
98
|
+
name: 'REST Design',
|
|
99
|
+
tier: 'T2',
|
|
100
|
+
category: 'api',
|
|
101
|
+
description: 'Design resource-oriented REST endpoints with proper verbs/codes.',
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
id: 'graphql-resolver',
|
|
105
|
+
name: 'GraphQL Resolver',
|
|
106
|
+
tier: 'T2.5',
|
|
107
|
+
category: 'api',
|
|
108
|
+
description: 'Author GraphQL resolvers with dataloader batching.',
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
id: 'x402-meter',
|
|
112
|
+
name: 'x402 Meter',
|
|
113
|
+
tier: 'T3',
|
|
114
|
+
category: 'api',
|
|
115
|
+
description: 'HTTP 402 payment metering middleware for API monetization.',
|
|
116
|
+
},
|
|
117
|
+
// --- testing ---
|
|
118
|
+
{
|
|
119
|
+
id: 'unit-test-author',
|
|
120
|
+
name: 'Unit Test Author',
|
|
121
|
+
tier: 'T1',
|
|
122
|
+
category: 'testing',
|
|
123
|
+
description: 'Write focused unit tests with clear arrange/act/assert.',
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
id: 'integration-test-author',
|
|
127
|
+
name: 'Integration Test Author',
|
|
128
|
+
tier: 'T2',
|
|
129
|
+
category: 'testing',
|
|
130
|
+
description: 'Cross-module tests with real or hermetic dependencies.',
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
id: 'property-test',
|
|
134
|
+
name: 'Property Test',
|
|
135
|
+
tier: 'T2.5',
|
|
136
|
+
category: 'testing',
|
|
137
|
+
description: 'Generative property-based testing with shrinking.',
|
|
138
|
+
},
|
|
139
|
+
// --- devops ---
|
|
140
|
+
{
|
|
141
|
+
id: 'ci-config',
|
|
142
|
+
name: 'CI Config',
|
|
143
|
+
tier: 'T2',
|
|
144
|
+
category: 'devops',
|
|
145
|
+
description: 'Continuous integration pipelines (GitHub Actions/GitLab CI).',
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
id: 'docker-compose',
|
|
149
|
+
name: 'Docker Compose',
|
|
150
|
+
tier: 'T2',
|
|
151
|
+
category: 'devops',
|
|
152
|
+
description: 'Local multi-service orchestration via docker-compose.',
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
id: 'deployment-manifest',
|
|
156
|
+
name: 'Deployment Manifest',
|
|
157
|
+
tier: 'T2.5',
|
|
158
|
+
category: 'devops',
|
|
159
|
+
description: 'Kubernetes/Nomad deployment manifests with health checks.',
|
|
160
|
+
},
|
|
161
|
+
// --- content ---
|
|
162
|
+
{
|
|
163
|
+
id: 'copyedit',
|
|
164
|
+
name: 'Copyedit',
|
|
165
|
+
tier: 'T1',
|
|
166
|
+
category: 'content',
|
|
167
|
+
description: 'Grammar, clarity, and tone editing for written copy.',
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
id: 'citation-format',
|
|
171
|
+
name: 'Citation Format',
|
|
172
|
+
tier: 'T1',
|
|
173
|
+
category: 'content',
|
|
174
|
+
description: 'Format citations in APA/MLA/Chicago style.',
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
id: 'seo-optimize',
|
|
178
|
+
name: 'SEO Optimize',
|
|
179
|
+
tier: 'T2',
|
|
180
|
+
category: 'content',
|
|
181
|
+
description: 'Optimize page content for search engine ranking.',
|
|
182
|
+
},
|
|
183
|
+
// --- template-aligned capabilities (TICKET-233) ---
|
|
184
|
+
{ id: "citation-validation", name: "Citation Validation", tier: 'T2', category: "research", description: "Citation Validation — skill declared by kognai-build templates." },
|
|
185
|
+
{ id: "source-credibility", name: "Source Credibility", tier: 'T2', category: "research", description: "Source Credibility — skill declared by kognai-build templates." },
|
|
186
|
+
{ id: "claim-extraction", name: "Claim Extraction", tier: 'T2', category: "research", description: "Claim Extraction — skill declared by kognai-build templates." },
|
|
187
|
+
{ id: "copywriting", name: "Copywriting", tier: 'T2', category: "content", description: "Copywriting — skill declared by kognai-build templates." },
|
|
188
|
+
{ id: "tone-matching", name: "Tone Matching", tier: 'T2', category: "content", description: "Tone Matching — skill declared by kognai-build templates." },
|
|
189
|
+
{ id: "seo-basics", name: "Seo Basics", tier: 'T2', category: "content", description: "Seo Basics — skill declared by kognai-build templates." },
|
|
190
|
+
{ id: "react-patterns", name: "React Patterns", tier: 'T2', category: "frontend", description: "React Patterns — skill declared by kognai-build templates." },
|
|
191
|
+
{ id: "state-management", name: "State Management", tier: 'T2', category: "frontend", description: "State Management — skill declared by kognai-build templates." },
|
|
192
|
+
{ id: "api-integration", name: "Api Integration", tier: 'T2', category: "frontend", description: "Api Integration — skill declared by kognai-build templates." },
|
|
193
|
+
{ id: "invariant-analysis", name: "Invariant Analysis", tier: 'T2', category: "security", description: "Invariant Analysis — skill declared by kognai-build templates." },
|
|
194
|
+
{ id: "reentrancy-detection", name: "Reentrancy Detection", tier: 'T2', category: "security", description: "Reentrancy Detection — skill declared by kognai-build templates." },
|
|
195
|
+
{ id: "gas-optimization", name: "Gas Optimization", tier: 'T2', category: "security", description: "Gas Optimization — skill declared by kognai-build templates." },
|
|
196
|
+
{ id: "phi-redaction", name: "Phi Redaction", tier: 'T2', category: "security", description: "Phi Redaction — skill declared by kognai-build templates." },
|
|
197
|
+
{ id: "cli-design", name: "Cli Design", tier: 'T2', category: "cli", description: "Cli Design — skill declared by kognai-build templates." },
|
|
198
|
+
{ id: "argument-parsing", name: "Argument Parsing", tier: 'T2', category: "cli", description: "Argument Parsing — skill declared by kognai-build templates." },
|
|
199
|
+
{ id: "shell-scripting", name: "Shell Scripting", tier: 'T2', category: "cli", description: "Shell Scripting — skill declared by kognai-build templates." },
|
|
200
|
+
{ id: "idempotency-design", name: "Idempotency Design", tier: 'T2', category: "reliability", description: "Idempotency Design — skill declared by kognai-build templates." },
|
|
201
|
+
{ id: "backpressure-handling", name: "Backpressure Handling", tier: 'T2', category: "reliability", description: "Backpressure Handling — skill declared by kognai-build templates." },
|
|
202
|
+
{ id: "profiling", name: "Profiling", tier: 'T2', category: "performance", description: "Profiling — skill declared by kognai-build templates." },
|
|
203
|
+
{ id: "concurrency-patterns", name: "Concurrency Patterns", tier: 'T2', category: "reliability", description: "Concurrency Patterns — skill declared by kognai-build templates." },
|
|
204
|
+
{ id: "memory-management", name: "Memory Management", tier: 'T2', category: "performance", description: "Memory Management — skill declared by kognai-build templates." },
|
|
205
|
+
{ id: "composition-design", name: "Composition Design", tier: 'T2', category: "media", description: "Composition Design — skill declared by kognai-build templates." },
|
|
206
|
+
{ id: "timing-coordination", name: "Timing Coordination", tier: 'T2', category: "media", description: "Timing Coordination — skill declared by kognai-build templates." },
|
|
207
|
+
{ id: "audio-sync", name: "Audio Sync", tier: 'T2', category: "media", description: "Audio Sync — skill declared by kognai-build templates." },
|
|
208
|
+
];
|
|
209
|
+
// Merge optional workspace overrides (.kognai/skills.json) before the index is
|
|
210
|
+
// built — makes the registry real & extensible, not a frozen catalog.
|
|
211
|
+
(0, registry_overrides_1.applyRegistryOverrides)(exports.SKILL_BANK, 'skills.json');
|
|
212
|
+
/**
|
|
213
|
+
* Build a lookup index by id, materialized once at module load over the
|
|
214
|
+
* merged registry.
|
|
215
|
+
*/
|
|
216
|
+
const SKILL_INDEX = new Map(exports.SKILL_BANK.map((entry) => [entry.id, entry]));
|
|
217
|
+
/**
|
|
218
|
+
* Return skill entries for the given ids, preserving caller order.
|
|
219
|
+
* Unknown ids are silently skipped — callers that need strict resolution
|
|
220
|
+
* should diff the returned ids against their input.
|
|
221
|
+
*/
|
|
222
|
+
function getSkillsByIds(ids) {
|
|
223
|
+
if (!Array.isArray(ids) || ids.length === 0)
|
|
224
|
+
return [];
|
|
225
|
+
const out = [];
|
|
226
|
+
for (const id of ids) {
|
|
227
|
+
const entry = SKILL_INDEX.get(id);
|
|
228
|
+
if (entry)
|
|
229
|
+
out.push(entry);
|
|
230
|
+
}
|
|
231
|
+
return out;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Return all skill entries in the given category. Category match is
|
|
235
|
+
* case-insensitive to tolerate template author inconsistency.
|
|
236
|
+
*/
|
|
237
|
+
function listSkillsByCategory(category) {
|
|
238
|
+
if (typeof category !== 'string' || category.length === 0)
|
|
239
|
+
return [];
|
|
240
|
+
const needle = category.toLowerCase();
|
|
241
|
+
return exports.SKILL_BANK.filter((entry) => entry.category.toLowerCase() === needle);
|
|
242
|
+
}
|
|
243
|
+
/** Return any skill ids not present in the registry (for template validation). */
|
|
244
|
+
function unknownSkillIds(ids) {
|
|
245
|
+
if (!Array.isArray(ids))
|
|
246
|
+
return [];
|
|
247
|
+
return ids.filter((id) => !SKILL_INDEX.has(id));
|
|
248
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SWARM_CODER_PROMPT = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* swarm-coder-prompt.ts — the bundled coder agent prompt for --swarm mode
|
|
6
|
+
* (TICKET-233 Phase 2). The engine loads coding agents from ./agents/<name>/prompt.md;
|
|
7
|
+
* --swarm scaffolds a working dir and writes this as agents/coder/prompt.md so the
|
|
8
|
+
* full @kognai/orchestrator-core swarm has a coder to dispatch tasks to.
|
|
9
|
+
*
|
|
10
|
+
* Portable (no Kognai-internal paths) — keeps the critical "no reasoning in the
|
|
11
|
+
* file body" rule and the engine-compatible FILE: output format.
|
|
12
|
+
*/
|
|
13
|
+
exports.SWARM_CODER_PROMPT = `# Coder Agent — Implementation Specialist
|
|
14
|
+
|
|
15
|
+
You implement code exactly as specified in the task context.
|
|
16
|
+
|
|
17
|
+
## Core principle
|
|
18
|
+
Write complete, production-ready code. Never truncate. Never use placeholders.
|
|
19
|
+
Every file you produce must be immediately usable without modification.
|
|
20
|
+
|
|
21
|
+
## Behaviour rules
|
|
22
|
+
1. Read the task context carefully — it is the full specification.
|
|
23
|
+
2. Produce every deliverable file in full — no \`// TODO\`, no \`...\`, no stubs.
|
|
24
|
+
3. TypeScript: strict types, avoid \`any\`, ESM imports, error handling.
|
|
25
|
+
4. Python: type hints, PEP 8, docstrings on public functions.
|
|
26
|
+
5. Output the file content directly — do not explain your code unless asked.
|
|
27
|
+
6. Never write your reasoning into the file. Phrases like "Let me think…",
|
|
28
|
+
"The problem says…", "Therefore we output…" belong in your scratchpad, NOT in
|
|
29
|
+
the file. If you catch yourself debating what to output, STOP, decide, then
|
|
30
|
+
write only the final content. The file is what an end user reads.
|
|
31
|
+
|
|
32
|
+
## Output format
|
|
33
|
+
For each deliverable, output exactly:
|
|
34
|
+
|
|
35
|
+
FILE: <relative/path/to/file>
|
|
36
|
+
|
|
37
|
+
followed immediately by the complete file contents (no code fences — the
|
|
38
|
+
orchestrator strips them). Repeat the FILE: block for each deliverable.
|
|
39
|
+
`;
|