@kognai/build 0.6.0 → 0.6.1

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/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "@kognai/build",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Kognai sovereign orchestrator — interactive REPL (kognai) + one-shot CLI (kognai-build). Triple-supervisor + compliance review + TICKET-135 optimization profiles + TICKET-203/207 workspace integration.",
5
5
  "license": "MIT",
6
6
  "author": "SkinGem",
7
7
  "bin": {
8
- "kognai": "./dist/bin/kognai.js",
9
- "kognai-build": "./dist/bin/kognai-build.js"
8
+ "kognai": "dist/bin/kognai.js",
9
+ "kognai-build": "dist/bin/kognai-build.js"
10
10
  },
11
11
  "files": [
12
12
  "dist/",
13
13
  "README.md"
14
14
  ],
15
15
  "scripts": {
16
- "build": "tsc -p tsconfig.json && rm -f dist/tsconfig.tsbuildinfo && chmod +x dist/bin/kognai.js dist/bin/kognai-build.js",
16
+ "build": "rm -rf dist && tsc -p tsconfig.json && rm -f dist/tsconfig.tsbuildinfo && chmod +x dist/bin/kognai.js dist/bin/kognai-build.js",
17
17
  "prepublishOnly": "npm run build"
18
18
  },
19
19
  "engines": {
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "repository": {
41
41
  "type": "git",
42
- "url": "https://github.com/SkinGem/kognai.git",
42
+ "url": "git+https://github.com/SkinGem/kognai.git",
43
43
  "directory": "packages/kognai-build"
44
44
  }
45
45
  }
@@ -1,214 +0,0 @@
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
- }
@@ -1,214 +0,0 @@
1
- "use strict";
2
- /**
3
- * Tool Layer Stub
4
- *
5
- * Phase 1 stub returning mock tool metadata for cost estimation and
6
- * capability discovery. Phase 2 (TICKET-125) replaces TOOL_LAYER with
7
- * a real provider registry backed by live cost-per-call data.
8
- *
9
- * Function signatures are stable across phases — callers (cost-estimator.ts,
10
- * build planners, capability matchers) can rely on the API surface.
11
- */
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.TOOL_LAYER = void 0;
14
- exports.getToolsByIds = getToolsByIds;
15
- exports.listToolsByCategory = listToolsByCategory;
16
- exports.estimateToolCost = estimateToolCost;
17
- exports.TOOL_LAYER = [
18
- // ── database ─────────────────────────────────────────────────────────────
19
- {
20
- id: 'postgres-encrypted',
21
- name: 'PostgreSQL (Encrypted)',
22
- provider: 'self-hosted',
23
- category: 'database',
24
- cost_per_call_usdc: 0,
25
- description: 'Self-hosted Postgres with at-rest encryption and pgcrypto.',
26
- },
27
- {
28
- id: 'redis-cache',
29
- name: 'Redis Cache',
30
- provider: 'self-hosted',
31
- category: 'database',
32
- cost_per_call_usdc: 0,
33
- description: 'In-memory key-value store for caching and rate limiting.',
34
- },
35
- {
36
- id: 'supabase',
37
- name: 'Supabase Postgres',
38
- provider: 'supabase',
39
- category: 'database',
40
- cost_per_call_usdc: 0.00005,
41
- description: 'Managed Postgres with row-level security and realtime.',
42
- },
43
- // ── llm ──────────────────────────────────────────────────────────────────
44
- {
45
- id: 'anthropic-sonnet',
46
- name: 'Anthropic Claude Sonnet',
47
- provider: 'anthropic',
48
- category: 'llm',
49
- cost_per_call_usdc: 0.015,
50
- description: 'Mid-tier reasoning LLM, ~1k token avg call.',
51
- },
52
- {
53
- id: 'anthropic-haiku',
54
- name: 'Anthropic Claude Haiku',
55
- provider: 'anthropic',
56
- category: 'llm',
57
- cost_per_call_usdc: 0.0012,
58
- description: 'Fast cheap LLM for classification and routing.',
59
- },
60
- {
61
- id: 'qwen-plus',
62
- name: 'Qwen Plus (Cloud)',
63
- provider: 'alibaba',
64
- category: 'llm',
65
- cost_per_call_usdc: 0.0008,
66
- description: 'Cloud-hosted Qwen Plus for general-purpose generation.',
67
- },
68
- {
69
- id: 'ollama-local',
70
- name: 'Ollama (Local)',
71
- provider: 'self-hosted',
72
- category: 'llm',
73
- cost_per_call_usdc: 0,
74
- description: 'Local LLM runtime (Qwen3, Llama, etc.) — zero per-call cost.',
75
- },
76
- // ── search ───────────────────────────────────────────────────────────────
77
- {
78
- id: 'tavily',
79
- name: 'Tavily Search API',
80
- provider: 'tavily',
81
- category: 'search',
82
- cost_per_call_usdc: 0.005,
83
- description: 'LLM-optimized web search with snippet extraction.',
84
- },
85
- {
86
- id: 'exa',
87
- name: 'Exa Neural Search',
88
- provider: 'exa',
89
- category: 'search',
90
- cost_per_call_usdc: 0.01,
91
- description: 'Neural search over indexed web content.',
92
- },
93
- // ── payment ──────────────────────────────────────────────────────────────
94
- {
95
- id: 'x402-meter',
96
- name: 'x402 Payment Meter',
97
- provider: 'x402',
98
- category: 'payment',
99
- cost_per_call_usdc: 0.0001,
100
- description: 'HTTP 402 micropayment metering for per-call billing.',
101
- },
102
- {
103
- id: 'stripe-webhook',
104
- name: 'Stripe Webhook Handler',
105
- provider: 'stripe',
106
- category: 'payment',
107
- cost_per_call_usdc: 0,
108
- description: 'Receive and verify Stripe webhook events (cost is in fees, not calls).',
109
- },
110
- // ── compliance ───────────────────────────────────────────────────────────
111
- {
112
- id: 'hipaa-bcc-checker',
113
- name: 'HIPAA BAA/BCC Checker',
114
- provider: 'self-hosted',
115
- category: 'compliance',
116
- cost_per_call_usdc: 0,
117
- description: 'Verifies BAA coverage and BCC routing for PHI workflows.',
118
- },
119
- {
120
- id: 'gdpr-data-mapper',
121
- name: 'GDPR Data Mapper',
122
- provider: 'self-hosted',
123
- category: 'compliance',
124
- cost_per_call_usdc: 0,
125
- description: 'Tracks personal-data lineage for GDPR Article 30 records.',
126
- },
127
- // ── observability ────────────────────────────────────────────────────────
128
- {
129
- id: 'posthog',
130
- name: 'PostHog Analytics',
131
- provider: 'posthog',
132
- category: 'observability',
133
- cost_per_call_usdc: 0.00001,
134
- description: 'Product analytics, session replay, and feature flags.',
135
- },
136
- {
137
- id: 'datadog',
138
- name: 'Datadog APM',
139
- provider: 'datadog',
140
- category: 'observability',
141
- cost_per_call_usdc: 0.0002,
142
- description: 'Application performance monitoring and log aggregation.',
143
- },
144
- {
145
- id: 'sentry',
146
- name: 'Sentry Error Tracking',
147
- provider: 'sentry',
148
- category: 'observability',
149
- cost_per_call_usdc: 0.00005,
150
- description: 'Error capture, stack traces, and release tracking.',
151
- },
152
- // ── identity ─────────────────────────────────────────────────────────────
153
- {
154
- id: 'erc-8004-resolver',
155
- name: 'ERC-8004 Agent Resolver',
156
- provider: 'self-hosted',
157
- category: 'identity',
158
- cost_per_call_usdc: 0,
159
- description: 'Resolves on-chain agent identities per ERC-8004 spec.',
160
- },
161
- {
162
- id: 'pact-mandate-verify',
163
- name: 'PACT Mandate Verifier',
164
- provider: 'self-hosted',
165
- category: 'identity',
166
- cost_per_call_usdc: 0,
167
- description: 'Verifies PACT mandate signatures for delegated agent actions.',
168
- },
169
- ];
170
- /**
171
- * Internal index keyed by tool id for O(1) lookup.
172
- * Rebuilt at module load; safe because TOOL_LAYER is a const literal.
173
- */
174
- const TOOL_INDEX = new Map(exports.TOOL_LAYER.map((tool) => [tool.id, tool]));
175
- /**
176
- * Resolve a list of tool ids to their entries.
177
- * Unknown ids are silently dropped — callers needing strict validation
178
- * should compare result length to input length.
179
- */
180
- function getToolsByIds(ids) {
181
- const seen = new Set();
182
- const out = [];
183
- for (const id of ids) {
184
- if (seen.has(id))
185
- continue;
186
- seen.add(id);
187
- const tool = TOOL_INDEX.get(id);
188
- if (tool)
189
- out.push(tool);
190
- }
191
- return out;
192
- }
193
- /**
194
- * List every tool in a given category.
195
- * Returns empty array for unknown categories.
196
- */
197
- function listToolsByCategory(category) {
198
- return exports.TOOL_LAYER.filter((tool) => tool.category === category);
199
- }
200
- /**
201
- * Estimate total cost in USDC for invoking the given tools `expectedCalls` times each.
202
- *
203
- * Formula: sum(tool.cost_per_call_usdc for tool in resolved_tools) × expectedCalls
204
- *
205
- * Unknown tool ids contribute 0. Negative `expectedCalls` is clamped to 0.
206
- */
207
- function estimateToolCost(toolIds, expectedCalls) {
208
- const calls = Math.max(0, expectedCalls);
209
- if (calls === 0)
210
- return 0;
211
- const tools = getToolsByIds(toolIds);
212
- const perCallSum = tools.reduce((acc, tool) => acc + tool.cost_per_call_usdc, 0);
213
- return perCallSum * calls;
214
- }