@ornexus/neocortex 4.0.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.
Potentially problematic release.
This version of @ornexus/neocortex might be problematic. Click here for more details.
- package/LICENSE +56 -0
- package/README.md +32 -0
- package/install.js +486 -0
- package/install.ps1 +1790 -0
- package/install.sh +1587 -0
- package/package.json +104 -0
- package/packages/client/dist/adapters/adapter-registry.d.ts +61 -0
- package/packages/client/dist/adapters/adapter-registry.js +106 -0
- package/packages/client/dist/adapters/antigravity-adapter.d.ts +18 -0
- package/packages/client/dist/adapters/antigravity-adapter.js +77 -0
- package/packages/client/dist/adapters/claude-code-adapter.d.ts +19 -0
- package/packages/client/dist/adapters/claude-code-adapter.js +79 -0
- package/packages/client/dist/adapters/codex-adapter.d.ts +19 -0
- package/packages/client/dist/adapters/codex-adapter.js +80 -0
- package/packages/client/dist/adapters/cursor-adapter.d.ts +19 -0
- package/packages/client/dist/adapters/cursor-adapter.js +115 -0
- package/packages/client/dist/adapters/gemini-adapter.d.ts +18 -0
- package/packages/client/dist/adapters/gemini-adapter.js +71 -0
- package/packages/client/dist/adapters/index.d.ts +19 -0
- package/packages/client/dist/adapters/index.js +21 -0
- package/packages/client/dist/adapters/platform-detector.d.ts +46 -0
- package/packages/client/dist/adapters/platform-detector.js +106 -0
- package/packages/client/dist/adapters/target-adapter.d.ts +70 -0
- package/packages/client/dist/adapters/target-adapter.js +12 -0
- package/packages/client/dist/adapters/vscode-adapter.d.ts +19 -0
- package/packages/client/dist/adapters/vscode-adapter.js +72 -0
- package/packages/client/dist/agent/refresh-stubs.d.ts +65 -0
- package/packages/client/dist/agent/refresh-stubs.js +234 -0
- package/packages/client/dist/agent/update-agent-yaml.d.ts +26 -0
- package/packages/client/dist/agent/update-agent-yaml.js +102 -0
- package/packages/client/dist/agent/update-description.d.ts +45 -0
- package/packages/client/dist/agent/update-description.js +251 -0
- package/packages/client/dist/cache/crypto-utils.d.ts +30 -0
- package/packages/client/dist/cache/crypto-utils.js +76 -0
- package/packages/client/dist/cache/encrypted-cache.d.ts +30 -0
- package/packages/client/dist/cache/encrypted-cache.js +94 -0
- package/packages/client/dist/cache/in-memory-asset-cache.d.ts +59 -0
- package/packages/client/dist/cache/in-memory-asset-cache.js +70 -0
- package/packages/client/dist/cache/index.d.ts +13 -0
- package/packages/client/dist/cache/index.js +13 -0
- package/packages/client/dist/cli.d.ts +14 -0
- package/packages/client/dist/cli.js +194 -0
- package/packages/client/dist/commands/activate.d.ts +55 -0
- package/packages/client/dist/commands/activate.js +390 -0
- package/packages/client/dist/commands/cache-status.d.ts +39 -0
- package/packages/client/dist/commands/cache-status.js +112 -0
- package/packages/client/dist/commands/invoke.d.ts +70 -0
- package/packages/client/dist/commands/invoke.js +490 -0
- package/packages/client/dist/config/resolver-selection.d.ts +40 -0
- package/packages/client/dist/config/resolver-selection.js +278 -0
- package/packages/client/dist/config/secure-config.d.ts +78 -0
- package/packages/client/dist/config/secure-config.js +269 -0
- package/packages/client/dist/constants.d.ts +25 -0
- package/packages/client/dist/constants.js +25 -0
- package/packages/client/dist/context/context-collector.d.ts +28 -0
- package/packages/client/dist/context/context-collector.js +222 -0
- package/packages/client/dist/context/context-sanitizer.d.ts +28 -0
- package/packages/client/dist/context/context-sanitizer.js +145 -0
- package/packages/client/dist/index.d.ts +55 -0
- package/packages/client/dist/index.js +38 -0
- package/packages/client/dist/license/index.d.ts +5 -0
- package/packages/client/dist/license/index.js +5 -0
- package/packages/client/dist/license/license-client.d.ts +79 -0
- package/packages/client/dist/license/license-client.js +257 -0
- package/packages/client/dist/machine/fingerprint.d.ts +34 -0
- package/packages/client/dist/machine/fingerprint.js +160 -0
- package/packages/client/dist/machine/index.d.ts +5 -0
- package/packages/client/dist/machine/index.js +5 -0
- package/packages/client/dist/resilience/circuit-breaker.d.ts +70 -0
- package/packages/client/dist/resilience/circuit-breaker.js +170 -0
- package/packages/client/dist/resilience/degradation-manager.d.ts +67 -0
- package/packages/client/dist/resilience/degradation-manager.js +164 -0
- package/packages/client/dist/resilience/freshness-indicator.d.ts +59 -0
- package/packages/client/dist/resilience/freshness-indicator.js +100 -0
- package/packages/client/dist/resilience/index.d.ts +8 -0
- package/packages/client/dist/resilience/index.js +8 -0
- package/packages/client/dist/resilience/recovery-detector.d.ts +59 -0
- package/packages/client/dist/resilience/recovery-detector.js +74 -0
- package/packages/client/dist/resolvers/asset-resolver.d.ts +79 -0
- package/packages/client/dist/resolvers/asset-resolver.js +13 -0
- package/packages/client/dist/resolvers/local-resolver.d.ts +26 -0
- package/packages/client/dist/resolvers/local-resolver.js +218 -0
- package/packages/client/dist/resolvers/remote-resolver.d.ts +91 -0
- package/packages/client/dist/resolvers/remote-resolver.js +282 -0
- package/packages/client/dist/telemetry/index.d.ts +5 -0
- package/packages/client/dist/telemetry/index.js +5 -0
- package/packages/client/dist/telemetry/offline-queue.d.ts +57 -0
- package/packages/client/dist/telemetry/offline-queue.js +131 -0
- package/packages/client/dist/tier/index.d.ts +5 -0
- package/packages/client/dist/tier/index.js +5 -0
- package/packages/client/dist/tier/tier-aware-client.d.ts +97 -0
- package/packages/client/dist/tier/tier-aware-client.js +260 -0
- package/packages/client/dist/types/index.d.ts +140 -0
- package/packages/client/dist/types/index.js +38 -0
- package/postinstall.js +272 -0
- package/targets-stubs/antigravity/README.md +36 -0
- package/targets-stubs/antigravity/gemini.md +22 -0
- package/targets-stubs/antigravity/install-antigravity.sh +44 -0
- package/targets-stubs/antigravity/mcp-config.json +9 -0
- package/targets-stubs/antigravity/skill/SKILL.md +67 -0
- package/targets-stubs/claude-code/README.md +20 -0
- package/targets-stubs/claude-code/neocortex.agent.yaml +24 -0
- package/targets-stubs/claude-code/neocortex.md +125 -0
- package/targets-stubs/codex/README.md +32 -0
- package/targets-stubs/codex/agents.md +61 -0
- package/targets-stubs/codex/config-mcp.toml +6 -0
- package/targets-stubs/codex/install-codex.sh +61 -0
- package/targets-stubs/cursor/README.md +33 -0
- package/targets-stubs/cursor/agent.md +94 -0
- package/targets-stubs/cursor/install-cursor.sh +35 -0
- package/targets-stubs/cursor/mcp.json +11 -0
- package/targets-stubs/gemini-cli/README.md +34 -0
- package/targets-stubs/gemini-cli/agent.md +101 -0
- package/targets-stubs/gemini-cli/gemini.md +16 -0
- package/targets-stubs/gemini-cli/install-gemini.sh +56 -0
- package/targets-stubs/gemini-cli/settings-mcp.json +11 -0
- package/targets-stubs/vscode/README.md +34 -0
- package/targets-stubs/vscode/agent.md +102 -0
- package/targets-stubs/vscode/copilot-instructions.md +16 -0
- package/targets-stubs/vscode/install-vscode.sh +42 -0
- package/targets-stubs/vscode/mcp.json +13 -0
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license FSL-1.1
|
|
3
|
+
* Copyright (c) 2026 OrNexus AI
|
|
4
|
+
*
|
|
5
|
+
* This file is part of Neocortex CLI, licensed under the
|
|
6
|
+
* Functional Source License, Version 1.1 (FSL-1.1).
|
|
7
|
+
*
|
|
8
|
+
* Change Date: February 20, 2029
|
|
9
|
+
* Change License: MIT
|
|
10
|
+
*
|
|
11
|
+
* See the LICENSE file in the project root for full license text.
|
|
12
|
+
*/
|
|
13
|
+
// ── Constants ────────────────────────────────────────────────────────────
|
|
14
|
+
const TIER_CACHE_KEY = 'neocortex:tier';
|
|
15
|
+
const QUOTA_CACHE_KEY_PREFIX = 'neocortex:quota:';
|
|
16
|
+
const QUOTA_TTL_MS = 5 * 60 * 1000; // 5 minutes
|
|
17
|
+
const TIER_CACHE_TTL_MS = 60 * 60 * 1000; // 1 hour (Story 31.05: reduced from 24h to align with short-lived JWTs)
|
|
18
|
+
const VALID_TIERS = new Set(['free', 'pro', 'enterprise']);
|
|
19
|
+
const DEFAULT_TIER = 'free';
|
|
20
|
+
// ── Trigger Gates (inlined from shared tier-config to avoid import issues) ─
|
|
21
|
+
const TRIGGER_GATES = {
|
|
22
|
+
'status': 'free',
|
|
23
|
+
'init': 'free',
|
|
24
|
+
'create-epic': 'free',
|
|
25
|
+
'idea-diagnose': 'free',
|
|
26
|
+
'idea-research': 'free',
|
|
27
|
+
'generate-epic': 'free',
|
|
28
|
+
'exec': 'pro',
|
|
29
|
+
'yolo': 'pro',
|
|
30
|
+
'epic': 'pro',
|
|
31
|
+
'setup-branch': 'free',
|
|
32
|
+
'diagnose': 'free',
|
|
33
|
+
'research': 'free',
|
|
34
|
+
'write-spec': 'free',
|
|
35
|
+
'create-tasks': 'free',
|
|
36
|
+
'implement': 'free',
|
|
37
|
+
'update-memory': 'free',
|
|
38
|
+
'commit': 'free',
|
|
39
|
+
'sync': 'free',
|
|
40
|
+
'create-pr': 'free',
|
|
41
|
+
'review': 'pro',
|
|
42
|
+
'merge': 'free',
|
|
43
|
+
'fix-blocked': 'free',
|
|
44
|
+
'finalize-epic': 'free',
|
|
45
|
+
'cleanup': 'free',
|
|
46
|
+
'resolve-conflicts': 'free',
|
|
47
|
+
'audit': 'free',
|
|
48
|
+
'menu': 'free',
|
|
49
|
+
'plans': 'free',
|
|
50
|
+
'billing': 'free',
|
|
51
|
+
'subscribe': 'free',
|
|
52
|
+
};
|
|
53
|
+
const TIER_HIERARCHY = {
|
|
54
|
+
free: 0,
|
|
55
|
+
pro: 1,
|
|
56
|
+
enterprise: 2,
|
|
57
|
+
};
|
|
58
|
+
// ── TierAwareClient ──────────────────────────────────────────────────────
|
|
59
|
+
export class TierAwareClient {
|
|
60
|
+
cache;
|
|
61
|
+
licenseClient;
|
|
62
|
+
cachedTier = null;
|
|
63
|
+
constructor(options) {
|
|
64
|
+
this.cache = options.cacheProvider;
|
|
65
|
+
this.licenseClient = options.licenseClient;
|
|
66
|
+
}
|
|
67
|
+
// ── Story 60.1: Tier Extraction from JWT + Cache ────────────────────
|
|
68
|
+
/**
|
|
69
|
+
* Get the current tier. Checks in-memory, then cache, then JWT token.
|
|
70
|
+
* NEVER throws - returns 'free' on failure (fail-open).
|
|
71
|
+
*/
|
|
72
|
+
async getCachedTier() {
|
|
73
|
+
try {
|
|
74
|
+
// 1. In-memory
|
|
75
|
+
if (this.cachedTier)
|
|
76
|
+
return this.cachedTier;
|
|
77
|
+
// 2. EncryptedCache
|
|
78
|
+
const cached = await this.cache.get(TIER_CACHE_KEY);
|
|
79
|
+
if (cached && VALID_TIERS.has(cached)) {
|
|
80
|
+
this.cachedTier = cached;
|
|
81
|
+
return this.cachedTier;
|
|
82
|
+
}
|
|
83
|
+
// 3. Extract from JWT
|
|
84
|
+
const token = await this.licenseClient.getToken();
|
|
85
|
+
if (token) {
|
|
86
|
+
const tier = this.extractTierFromJwt(token);
|
|
87
|
+
this.cachedTier = tier;
|
|
88
|
+
// Persist to cache (fire-and-forget)
|
|
89
|
+
this.cache.set(TIER_CACHE_KEY, tier, TIER_CACHE_TTL_MS).catch(() => { });
|
|
90
|
+
return tier;
|
|
91
|
+
}
|
|
92
|
+
return DEFAULT_TIER;
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
return DEFAULT_TIER;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Update cached tier (called when server returns tier info).
|
|
100
|
+
*/
|
|
101
|
+
async updateTier(tier) {
|
|
102
|
+
try {
|
|
103
|
+
if (!VALID_TIERS.has(tier))
|
|
104
|
+
return;
|
|
105
|
+
this.cachedTier = tier;
|
|
106
|
+
await this.cache.set(TIER_CACHE_KEY, tier, TIER_CACHE_TTL_MS).catch(() => { });
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
// Non-critical
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
// ── Story 18.8: Tier Cache Invalidation ──────────────────────────────
|
|
113
|
+
/**
|
|
114
|
+
* Invalidate all tier and quota caches.
|
|
115
|
+
* Called when a tier change is detected to ensure fresh data.
|
|
116
|
+
* NEVER throws.
|
|
117
|
+
*/
|
|
118
|
+
async invalidateTierCache() {
|
|
119
|
+
try {
|
|
120
|
+
this.cachedTier = null;
|
|
121
|
+
await this.cache.clear().catch(() => { });
|
|
122
|
+
}
|
|
123
|
+
catch {
|
|
124
|
+
// Non-critical
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
// ── Story 60.2: Pre-flight Trigger Check ────────────────────────────
|
|
128
|
+
/**
|
|
129
|
+
* Check if a trigger is allowed for the current tier WITHOUT calling the server.
|
|
130
|
+
* Returns immediately (in-memory lookup).
|
|
131
|
+
* NEVER throws - returns { allowed: true } on failure (fail-open).
|
|
132
|
+
*/
|
|
133
|
+
async preFlightCheck(trigger, tier) {
|
|
134
|
+
try {
|
|
135
|
+
const userTier = tier ?? await this.getCachedTier();
|
|
136
|
+
const requiredTier = TRIGGER_GATES[trigger] ?? 'free';
|
|
137
|
+
if (TIER_HIERARCHY[userTier] >= TIER_HIERARCHY[requiredTier]) {
|
|
138
|
+
return { allowed: true };
|
|
139
|
+
}
|
|
140
|
+
const message = this.buildUpgradeMessage(trigger, userTier, requiredTier);
|
|
141
|
+
return { allowed: false, message };
|
|
142
|
+
}
|
|
143
|
+
catch {
|
|
144
|
+
// Fail-open: allow on error
|
|
145
|
+
return { allowed: true };
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
// ── Story 60.3: Quota Cache from Response ───────────────────────────
|
|
149
|
+
/**
|
|
150
|
+
* Update cached quota from server response metadata.
|
|
151
|
+
* Called after each successful invoke.
|
|
152
|
+
*/
|
|
153
|
+
async updateQuotaFromResponse(metadata) {
|
|
154
|
+
try {
|
|
155
|
+
const quotaRemaining = metadata.quotaRemaining;
|
|
156
|
+
if (!quotaRemaining)
|
|
157
|
+
return;
|
|
158
|
+
const snapshot = {
|
|
159
|
+
stepsRemaining: quotaRemaining.stepsRemaining ?? 0,
|
|
160
|
+
invocationsRemaining: quotaRemaining.invocationsRemaining ?? 0,
|
|
161
|
+
stepsLimit: quotaRemaining.stepsLimit ?? 0,
|
|
162
|
+
invocationsLimit: quotaRemaining.invocationsLimit ?? 0,
|
|
163
|
+
cachedAt: Date.now(),
|
|
164
|
+
};
|
|
165
|
+
const dateKey = this.getQuotaCacheKey();
|
|
166
|
+
await this.cache.set(dateKey, JSON.stringify(snapshot), QUOTA_TTL_MS).catch(() => { });
|
|
167
|
+
}
|
|
168
|
+
catch {
|
|
169
|
+
// Non-critical
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Get cached quota for today.
|
|
174
|
+
* NEVER throws - returns null if cache empty or expired.
|
|
175
|
+
*/
|
|
176
|
+
async getCachedQuota() {
|
|
177
|
+
try {
|
|
178
|
+
const dateKey = this.getQuotaCacheKey();
|
|
179
|
+
const raw = await this.cache.get(dateKey);
|
|
180
|
+
if (!raw)
|
|
181
|
+
return null;
|
|
182
|
+
const snapshot = JSON.parse(raw);
|
|
183
|
+
// Validate TTL (EncryptedCache already handles this, but double-check)
|
|
184
|
+
if (Date.now() - snapshot.cachedAt > QUOTA_TTL_MS)
|
|
185
|
+
return null;
|
|
186
|
+
return snapshot;
|
|
187
|
+
}
|
|
188
|
+
catch {
|
|
189
|
+
return null;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
// ── Story 60.4: Offline Enforcement ─────────────────────────────────
|
|
193
|
+
/**
|
|
194
|
+
* Check quota in offline mode using cached data.
|
|
195
|
+
* NEVER throws - returns { allowed: true } on failure (fail-open).
|
|
196
|
+
*
|
|
197
|
+
* @param isOffline - Whether the circuit breaker is in L2+ degradation
|
|
198
|
+
*/
|
|
199
|
+
async offlineQuotaCheck(isOffline = false) {
|
|
200
|
+
try {
|
|
201
|
+
if (!isOffline)
|
|
202
|
+
return { allowed: true };
|
|
203
|
+
const quota = await this.getCachedQuota();
|
|
204
|
+
// Fail-open: if no cached quota, allow
|
|
205
|
+
if (!quota)
|
|
206
|
+
return { allowed: true };
|
|
207
|
+
// Check steps
|
|
208
|
+
if (quota.stepsRemaining <= 0 && quota.stepsLimit > 0) {
|
|
209
|
+
return {
|
|
210
|
+
allowed: false,
|
|
211
|
+
message: `Daily step limit reached (${quota.stepsLimit}/${quota.stepsLimit}). Resets at 00:00 UTC.`,
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
// Check invocations
|
|
215
|
+
if (quota.invocationsRemaining <= 0 && quota.invocationsLimit > 0) {
|
|
216
|
+
return {
|
|
217
|
+
allowed: false,
|
|
218
|
+
message: `Daily invocation limit reached (${quota.invocationsLimit}/${quota.invocationsLimit}). Resets at 00:00 UTC.`,
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
return { allowed: true };
|
|
222
|
+
}
|
|
223
|
+
catch {
|
|
224
|
+
// Fail-open
|
|
225
|
+
return { allowed: true };
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
// ── Private Helpers ─────────────────────────────────────────────────
|
|
229
|
+
/**
|
|
230
|
+
* Extract tier from JWT payload via base64url decode.
|
|
231
|
+
* No cryptographic verification - client-side is UX only.
|
|
232
|
+
*/
|
|
233
|
+
extractTierFromJwt(token) {
|
|
234
|
+
try {
|
|
235
|
+
const parts = token.split('.');
|
|
236
|
+
if (parts.length !== 3)
|
|
237
|
+
return DEFAULT_TIER;
|
|
238
|
+
// Decode base64url payload
|
|
239
|
+
const payload = parts[1];
|
|
240
|
+
const decoded = Buffer.from(payload, 'base64url').toString('utf8');
|
|
241
|
+
const claims = JSON.parse(decoded);
|
|
242
|
+
const tier = claims.tier;
|
|
243
|
+
if (tier && VALID_TIERS.has(tier)) {
|
|
244
|
+
return tier;
|
|
245
|
+
}
|
|
246
|
+
return DEFAULT_TIER;
|
|
247
|
+
}
|
|
248
|
+
catch {
|
|
249
|
+
return DEFAULT_TIER;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
buildUpgradeMessage(trigger, currentTier, requiredTier) {
|
|
253
|
+
return `The *${trigger} command requires ${requiredTier.toUpperCase()} plan. Your current plan: ${currentTier.toUpperCase()}. Upgrade: neocortex.dev/pricing`;
|
|
254
|
+
}
|
|
255
|
+
getQuotaCacheKey() {
|
|
256
|
+
const now = new Date();
|
|
257
|
+
const dateStr = now.toISOString().slice(0, 10); // YYYY-MM-DD UTC
|
|
258
|
+
return `${QUOTA_CACHE_KEY_PREFIX}${dateStr}`;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license FSL-1.1
|
|
3
|
+
* Copyright (c) 2026 OrNexus AI
|
|
4
|
+
*
|
|
5
|
+
* This file is part of Neocortex CLI, licensed under the
|
|
6
|
+
* Functional Source License, Version 1.1 (FSL-1.1).
|
|
7
|
+
*
|
|
8
|
+
* Change Date: February 20, 2029
|
|
9
|
+
* Change License: MIT
|
|
10
|
+
*
|
|
11
|
+
* See the LICENSE file in the project root for full license text.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* @neocortex/client - Type Definitions
|
|
15
|
+
*
|
|
16
|
+
* All types for the asset resolution abstraction layer.
|
|
17
|
+
*/
|
|
18
|
+
/** Mode of asset resolution */
|
|
19
|
+
export declare enum ResolverMode {
|
|
20
|
+
/** Read assets from local filesystem (development) */
|
|
21
|
+
LOCAL = "local",
|
|
22
|
+
/** Fetch assets from remote IP Protection Server (production) */
|
|
23
|
+
REMOTE = "remote"
|
|
24
|
+
}
|
|
25
|
+
/** Metadata about the codebase for context collection */
|
|
26
|
+
export interface CodebaseMetadata {
|
|
27
|
+
readonly projectName: string;
|
|
28
|
+
readonly languages: readonly string[];
|
|
29
|
+
readonly frameworks: readonly string[];
|
|
30
|
+
readonly dependencies: Readonly<Record<string, string>>;
|
|
31
|
+
readonly nodeVersion: string;
|
|
32
|
+
}
|
|
33
|
+
/** Metadata extracted from the story file */
|
|
34
|
+
export interface StoryMetadata {
|
|
35
|
+
readonly id: string;
|
|
36
|
+
readonly epicId: string;
|
|
37
|
+
readonly title: string;
|
|
38
|
+
readonly status: string;
|
|
39
|
+
readonly dependencies: readonly string[];
|
|
40
|
+
readonly acceptanceCriteria: readonly string[];
|
|
41
|
+
}
|
|
42
|
+
/** Full pipeline context sent to the server for prompt assembly */
|
|
43
|
+
export interface PipelineContext {
|
|
44
|
+
readonly storyId: string;
|
|
45
|
+
readonly stepId: string;
|
|
46
|
+
readonly epicId: string;
|
|
47
|
+
readonly storyTitle: string;
|
|
48
|
+
readonly currentStatus: string;
|
|
49
|
+
readonly stepsCompleted: readonly string[];
|
|
50
|
+
readonly branchName: string;
|
|
51
|
+
readonly platformTarget: string;
|
|
52
|
+
readonly codebaseMetadata: CodebaseMetadata;
|
|
53
|
+
readonly storyMetadata: StoryMetadata;
|
|
54
|
+
}
|
|
55
|
+
/** Content of a resolved pipeline step */
|
|
56
|
+
export interface StepContent {
|
|
57
|
+
readonly id: string;
|
|
58
|
+
readonly content: string;
|
|
59
|
+
readonly frontmatter: Readonly<Record<string, unknown>>;
|
|
60
|
+
}
|
|
61
|
+
/** Content of a resolved skill */
|
|
62
|
+
export interface SkillContent {
|
|
63
|
+
readonly id: string;
|
|
64
|
+
readonly content: string;
|
|
65
|
+
readonly metadata: Readonly<Record<string, unknown>>;
|
|
66
|
+
}
|
|
67
|
+
/** Content of a resolved standard */
|
|
68
|
+
export interface StandardContent {
|
|
69
|
+
readonly id: string;
|
|
70
|
+
readonly content: string;
|
|
71
|
+
}
|
|
72
|
+
/** Step registry entry matching core/data/step-registry.json structure */
|
|
73
|
+
export interface StepRegistryEntry {
|
|
74
|
+
readonly id: string;
|
|
75
|
+
readonly order?: number;
|
|
76
|
+
readonly name: string;
|
|
77
|
+
readonly status_after?: string;
|
|
78
|
+
readonly file: string;
|
|
79
|
+
readonly auto_continue?: boolean;
|
|
80
|
+
readonly requires_git?: boolean;
|
|
81
|
+
readonly standalone?: boolean;
|
|
82
|
+
readonly terminal?: boolean;
|
|
83
|
+
readonly returns_to?: string;
|
|
84
|
+
readonly returns_to_status?: string;
|
|
85
|
+
}
|
|
86
|
+
/** Full step registry structure */
|
|
87
|
+
export interface StepRegistry {
|
|
88
|
+
readonly version: string;
|
|
89
|
+
readonly steps: {
|
|
90
|
+
readonly core: readonly StepRegistryEntry[];
|
|
91
|
+
readonly recovery: readonly StepRegistryEntry[];
|
|
92
|
+
readonly utility: readonly StepRegistryEntry[];
|
|
93
|
+
readonly planning: readonly StepRegistryEntry[];
|
|
94
|
+
readonly epic: readonly StepRegistryEntry[];
|
|
95
|
+
};
|
|
96
|
+
readonly [key: string]: unknown;
|
|
97
|
+
}
|
|
98
|
+
/** Assembled prompt ready for execution */
|
|
99
|
+
export interface AssembledPrompt {
|
|
100
|
+
readonly prompt: string;
|
|
101
|
+
readonly variables: Readonly<Record<string, string>>;
|
|
102
|
+
readonly includedSkills: readonly string[];
|
|
103
|
+
readonly includedStandards: readonly string[];
|
|
104
|
+
}
|
|
105
|
+
/** Interface for encrypted cache (implemented in Story 42.3) */
|
|
106
|
+
export interface CacheProvider {
|
|
107
|
+
get(key: string): Promise<string | null>;
|
|
108
|
+
set(key: string, value: string, ttlMs?: number): Promise<void>;
|
|
109
|
+
clear(): Promise<void>;
|
|
110
|
+
}
|
|
111
|
+
/** No-op cache implementation for development/fallback */
|
|
112
|
+
export declare class NoOpCache implements CacheProvider {
|
|
113
|
+
get(): Promise<null>;
|
|
114
|
+
set(): Promise<void>;
|
|
115
|
+
clear(): Promise<void>;
|
|
116
|
+
}
|
|
117
|
+
/** Options for LocalResolver */
|
|
118
|
+
export interface LocalResolverOptions {
|
|
119
|
+
readonly projectRoot: string;
|
|
120
|
+
}
|
|
121
|
+
/** Options for RemoteResolver */
|
|
122
|
+
export interface RemoteResolverOptions {
|
|
123
|
+
readonly serverUrl: string;
|
|
124
|
+
readonly licenseKey: string;
|
|
125
|
+
readonly timeout?: number;
|
|
126
|
+
readonly retryCount?: number;
|
|
127
|
+
readonly cacheProvider?: CacheProvider;
|
|
128
|
+
readonly licenseClient?: import('../license/license-client.js').LicenseClient;
|
|
129
|
+
}
|
|
130
|
+
/** Options for resolver factory */
|
|
131
|
+
export interface CreateResolverOptions {
|
|
132
|
+
readonly forceLocal?: boolean;
|
|
133
|
+
/** Force offline mode: skip server, use cache exclusively (Story 42.9 - AC6) */
|
|
134
|
+
readonly forceOffline?: boolean;
|
|
135
|
+
readonly projectRoot?: string;
|
|
136
|
+
readonly serverUrl?: string;
|
|
137
|
+
readonly licenseKey?: string;
|
|
138
|
+
readonly cacheProvider?: CacheProvider;
|
|
139
|
+
readonly licenseClient?: import('../license/license-client.js').LicenseClient;
|
|
140
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license FSL-1.1
|
|
3
|
+
* Copyright (c) 2026 OrNexus AI
|
|
4
|
+
*
|
|
5
|
+
* This file is part of Neocortex CLI, licensed under the
|
|
6
|
+
* Functional Source License, Version 1.1 (FSL-1.1).
|
|
7
|
+
*
|
|
8
|
+
* Change Date: February 20, 2029
|
|
9
|
+
* Change License: MIT
|
|
10
|
+
*
|
|
11
|
+
* See the LICENSE file in the project root for full license text.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* @neocortex/client - Type Definitions
|
|
15
|
+
*
|
|
16
|
+
* All types for the asset resolution abstraction layer.
|
|
17
|
+
*/
|
|
18
|
+
// ── Resolver Mode ────────────────────────────────────────────────────────
|
|
19
|
+
/** Mode of asset resolution */
|
|
20
|
+
export var ResolverMode;
|
|
21
|
+
(function (ResolverMode) {
|
|
22
|
+
/** Read assets from local filesystem (development) */
|
|
23
|
+
ResolverMode["LOCAL"] = "local";
|
|
24
|
+
/** Fetch assets from remote IP Protection Server (production) */
|
|
25
|
+
ResolverMode["REMOTE"] = "remote";
|
|
26
|
+
})(ResolverMode || (ResolverMode = {}));
|
|
27
|
+
/** No-op cache implementation for development/fallback */
|
|
28
|
+
export class NoOpCache {
|
|
29
|
+
async get() {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
async set() {
|
|
33
|
+
// No-op: cache disabled
|
|
34
|
+
}
|
|
35
|
+
async clear() {
|
|
36
|
+
// No-op: nothing to clear
|
|
37
|
+
}
|
|
38
|
+
}
|