@wundam/orchex 1.0.0-rc.2 → 1.0.0-rc.21
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 +59 -18
- package/dist/cloud-executor.d.ts +71 -0
- package/dist/cloud-executor.js +335 -0
- package/dist/cloud-sync.d.ts +8 -0
- package/dist/cloud-sync.js +52 -0
- package/dist/config.d.ts +30 -4
- package/dist/config.js +61 -2
- package/dist/context-builder.d.ts +2 -0
- package/dist/context-builder.js +11 -3
- package/dist/cost.js +1 -1
- package/dist/entitlements/jwt.d.ts +7 -0
- package/dist/entitlements/jwt.js +78 -0
- package/dist/entitlements/resolve.d.ts +17 -0
- package/dist/entitlements/resolve.js +49 -0
- package/dist/entitlements/types.d.ts +21 -0
- package/dist/entitlements/types.js +4 -0
- package/dist/executors/base.d.ts +1 -1
- package/dist/executors/bedrock-executor.d.ts +39 -0
- package/dist/executors/bedrock-executor.js +197 -0
- package/dist/executors/index.d.ts +1 -0
- package/dist/executors/index.js +24 -1
- package/dist/index.js +468 -23
- package/dist/intelligence/index.d.ts +44 -0
- package/dist/intelligence/index.js +160 -0
- package/dist/key-cache.d.ts +31 -0
- package/dist/key-cache.js +84 -0
- package/dist/login-helpers.d.ts +25 -0
- package/dist/login-helpers.js +54 -0
- package/dist/manifest.js +18 -1
- package/dist/mcp-instructions.d.ts +1 -0
- package/dist/mcp-instructions.js +84 -0
- package/dist/mcp-resources.d.ts +8 -0
- package/dist/mcp-resources.js +420 -0
- package/dist/model-cache.d.ts +18 -0
- package/dist/model-cache.js +62 -0
- package/dist/model-validator.d.ts +20 -0
- package/dist/model-validator.js +125 -0
- package/dist/orchestrator.d.ts +14 -0
- package/dist/orchestrator.js +191 -32
- package/dist/setup/ide-registry.d.ts +13 -0
- package/dist/setup/ide-registry.js +51 -0
- package/dist/setup/index.d.ts +1 -0
- package/dist/setup/index.js +111 -0
- package/dist/tier-gating.js +0 -16
- package/dist/tiers.d.ts +35 -5
- package/dist/tiers.js +39 -3
- package/dist/tools.d.ts +6 -1
- package/dist/tools.js +852 -95
- package/dist/types.d.ts +71 -60
- package/dist/types.js +3 -0
- package/dist/waves.d.ts +1 -1
- package/dist/waves.js +29 -2
- package/package.json +41 -5
- package/src/entitlements/public-key.pem +9 -0
- package/dist/intelligence/anti-pattern-detector.d.ts +0 -117
- package/dist/intelligence/anti-pattern-detector.js +0 -327
- package/dist/intelligence/budget-enforcer.d.ts +0 -119
- package/dist/intelligence/budget-enforcer.js +0 -226
- package/dist/intelligence/context-optimizer.d.ts +0 -111
- package/dist/intelligence/context-optimizer.js +0 -282
- package/dist/intelligence/cost-tracker.d.ts +0 -114
- package/dist/intelligence/cost-tracker.js +0 -183
- package/dist/intelligence/deliverable-extractor.d.ts +0 -134
- package/dist/intelligence/deliverable-extractor.js +0 -909
- package/dist/intelligence/dependency-inferrer.d.ts +0 -87
- package/dist/intelligence/dependency-inferrer.js +0 -403
- package/dist/intelligence/diagnostics.d.ts +0 -33
- package/dist/intelligence/diagnostics.js +0 -64
- package/dist/intelligence/error-analyzer.d.ts +0 -7
- package/dist/intelligence/error-analyzer.js +0 -76
- package/dist/intelligence/file-chunker.d.ts +0 -15
- package/dist/intelligence/file-chunker.js +0 -64
- package/dist/intelligence/fix-stream-manager.d.ts +0 -59
- package/dist/intelligence/fix-stream-manager.js +0 -212
- package/dist/intelligence/heuristics.d.ts +0 -23
- package/dist/intelligence/heuristics.js +0 -124
- package/dist/intelligence/learning-engine.d.ts +0 -157
- package/dist/intelligence/learning-engine.js +0 -433
- package/dist/intelligence/learning-feedback.d.ts +0 -96
- package/dist/intelligence/learning-feedback.js +0 -202
- package/dist/intelligence/pattern-analyzer.d.ts +0 -35
- package/dist/intelligence/pattern-analyzer.js +0 -189
- package/dist/intelligence/plan-parser.d.ts +0 -124
- package/dist/intelligence/plan-parser.js +0 -498
- package/dist/intelligence/planner.d.ts +0 -29
- package/dist/intelligence/planner.js +0 -86
- package/dist/intelligence/self-healer.d.ts +0 -16
- package/dist/intelligence/self-healer.js +0 -84
- package/dist/intelligence/slicing-metrics.d.ts +0 -62
- package/dist/intelligence/slicing-metrics.js +0 -202
- package/dist/intelligence/slicing-templates.d.ts +0 -81
- package/dist/intelligence/slicing-templates.js +0 -420
- package/dist/intelligence/split-suggester.d.ts +0 -69
- package/dist/intelligence/split-suggester.js +0 -176
- package/dist/intelligence/stream-generator.d.ts +0 -90
- package/dist/intelligence/stream-generator.js +0 -452
- package/dist/telemetry/telemetry-types.d.ts +0 -85
- package/dist/telemetry/telemetry-types.js +0 -1
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { IDE_REGISTRY, detectIdes, findBySlug, FALLBACK_CONFIG_PATH, generateMcpConfig, mergeConfig, } from './ide-registry.js';
|
|
4
|
+
function parseFlags(args) {
|
|
5
|
+
const flags = { dryRun: false, force: false, help: false };
|
|
6
|
+
for (let i = 0; i < args.length; i++) {
|
|
7
|
+
if (args[i] === '--ide' && args[i + 1]) {
|
|
8
|
+
flags.ide = args[++i];
|
|
9
|
+
}
|
|
10
|
+
else if (args[i].startsWith('--ide=')) {
|
|
11
|
+
flags.ide = args[i].slice(6);
|
|
12
|
+
}
|
|
13
|
+
else if (args[i] === '--dry-run') {
|
|
14
|
+
flags.dryRun = true;
|
|
15
|
+
}
|
|
16
|
+
else if (args[i] === '--force') {
|
|
17
|
+
flags.force = true;
|
|
18
|
+
}
|
|
19
|
+
else if (args[i] === '--help') {
|
|
20
|
+
flags.help = true;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return flags;
|
|
24
|
+
}
|
|
25
|
+
function printSetupHelp() {
|
|
26
|
+
console.log(`
|
|
27
|
+
Usage: orchex setup [options]
|
|
28
|
+
|
|
29
|
+
Auto-configure Orchex MCP server for your IDE
|
|
30
|
+
|
|
31
|
+
Options:
|
|
32
|
+
--ide <name> Target specific IDE (cursor, windsurf)
|
|
33
|
+
--dry-run Show config without writing
|
|
34
|
+
--force Overwrite existing config
|
|
35
|
+
--help Show this help
|
|
36
|
+
|
|
37
|
+
Supported IDEs:
|
|
38
|
+
cursor Cursor IDE (project-level config)
|
|
39
|
+
windsurf Windsurf IDE (global config)
|
|
40
|
+
|
|
41
|
+
Examples:
|
|
42
|
+
orchex setup # Auto-detect and configure all IDEs
|
|
43
|
+
orchex setup --ide cursor # Configure Cursor only
|
|
44
|
+
orchex setup --dry-run # Preview changes
|
|
45
|
+
`.trim());
|
|
46
|
+
}
|
|
47
|
+
async function writeConfigToPath(configPath, ideName, flags) {
|
|
48
|
+
const orchexConfig = generateMcpConfig();
|
|
49
|
+
const orchexEntry = orchexConfig.mcpServers.orchex;
|
|
50
|
+
// Read existing config
|
|
51
|
+
let existing = {};
|
|
52
|
+
if (fs.existsSync(configPath)) {
|
|
53
|
+
try {
|
|
54
|
+
existing = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
console.error(`Error: invalid JSON in ${configPath}`);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
// Check if orchex already configured
|
|
61
|
+
const servers = existing.mcpServers;
|
|
62
|
+
if (servers?.orchex && !flags.force) {
|
|
63
|
+
console.log(`${ideName}: orchex already configured in ${configPath}`);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const merged = mergeConfig(existing, orchexEntry);
|
|
68
|
+
if (flags.dryRun) {
|
|
69
|
+
console.log(`Would write to ${configPath}:`);
|
|
70
|
+
console.log(JSON.stringify(merged, null, 2));
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
// Create parent directories
|
|
74
|
+
fs.mkdirSync(path.dirname(configPath), { recursive: true });
|
|
75
|
+
fs.writeFileSync(configPath, JSON.stringify(merged, null, 2) + '\n');
|
|
76
|
+
console.log(`${ideName}: wrote ${configPath}`);
|
|
77
|
+
}
|
|
78
|
+
export async function handleSetupCommand(args, projectDir = process.cwd()) {
|
|
79
|
+
const flags = parseFlags(args);
|
|
80
|
+
if (flags.help) {
|
|
81
|
+
printSetupHelp();
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (flags.ide) {
|
|
85
|
+
// Target specific IDE
|
|
86
|
+
const ide = findBySlug(flags.ide);
|
|
87
|
+
if (!ide) {
|
|
88
|
+
console.error(`Unknown IDE: ${flags.ide}. Supported: ${IDE_REGISTRY.map(i => i.slug).join(', ')}`);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
await writeConfigToPath(ide.configPath(projectDir), ide.name, flags);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
// Auto-detect IDEs
|
|
95
|
+
const detected = detectIdes(projectDir);
|
|
96
|
+
for (const ide of detected) {
|
|
97
|
+
await writeConfigToPath(ide.configPath(projectDir), ide.name, flags);
|
|
98
|
+
}
|
|
99
|
+
// Always write fallback .mcp.json
|
|
100
|
+
console.log('Writing standard MCP config (works with Claude Code, VS Code, and other MCP clients)');
|
|
101
|
+
await writeConfigToPath(FALLBACK_CONFIG_PATH(projectDir), 'Standard MCP', flags);
|
|
102
|
+
// Print next steps
|
|
103
|
+
if (!flags.dryRun) {
|
|
104
|
+
console.log(`
|
|
105
|
+
Setup complete! Next steps:
|
|
106
|
+
1. Restart your IDE/editor
|
|
107
|
+
2. Verify with: orchex_status (in MCP client)
|
|
108
|
+
3. API keys: Set ANTHROPIC_API_KEY or OPENAI_API_KEY
|
|
109
|
+
(Orchex auto-detects from environment)`);
|
|
110
|
+
}
|
|
111
|
+
}
|
package/dist/tier-gating.js
CHANGED
|
@@ -26,22 +26,6 @@ export function checkTierLimits(opts) {
|
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
// 3. maxProviders: Count distinct providers across streams with explicit provider field
|
|
30
|
-
if (tier.maxProviders !== -1) {
|
|
31
|
-
const providers = new Set();
|
|
32
|
-
for (const s of Object.values(streams)) {
|
|
33
|
-
if (s.provider)
|
|
34
|
-
providers.add(s.provider);
|
|
35
|
-
}
|
|
36
|
-
if (providers.size > tier.maxProviders) {
|
|
37
|
-
return {
|
|
38
|
-
allowed: false,
|
|
39
|
-
error: `Too many LLM providers for tier '${tier.name}'. Max allowed: ${tier.maxProviders}, requested: ${providers.size}. Upgrade to increase this limit.`,
|
|
40
|
-
code: 'MAX_PROVIDERS_EXCEEDED',
|
|
41
|
-
suggestion: `Reduce the number of distinct providers to ${tier.maxProviders} or fewer, or upgrade your tier.`,
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
29
|
return { allowed: true };
|
|
46
30
|
}
|
|
47
31
|
/**
|
package/dist/tiers.d.ts
CHANGED
|
@@ -17,8 +17,8 @@ export declare const TierSchema: z.ZodObject<{
|
|
|
17
17
|
/** Maximum # of API tokens per user (-1 = unlimited) */
|
|
18
18
|
maxApiTokens: z.ZodNumber;
|
|
19
19
|
}, "strip", z.ZodTypeAny, {
|
|
20
|
-
name: string;
|
|
21
20
|
id: "free" | "pro" | "team" | "enterprise";
|
|
21
|
+
name: string;
|
|
22
22
|
price: number;
|
|
23
23
|
cloudOrchestrations: number;
|
|
24
24
|
maxParallelAgents: number;
|
|
@@ -29,8 +29,8 @@ export declare const TierSchema: z.ZodObject<{
|
|
|
29
29
|
maxProviders: number;
|
|
30
30
|
maxApiTokens: number;
|
|
31
31
|
}, {
|
|
32
|
-
name: string;
|
|
33
32
|
id: "free" | "pro" | "team" | "enterprise";
|
|
33
|
+
name: string;
|
|
34
34
|
price: number;
|
|
35
35
|
cloudOrchestrations: number;
|
|
36
36
|
maxParallelAgents: number;
|
|
@@ -53,7 +53,7 @@ export declare const TIERS: {
|
|
|
53
53
|
readonly smartPlanning: "none";
|
|
54
54
|
readonly teamMembers: 1;
|
|
55
55
|
readonly maxWaves: 2;
|
|
56
|
-
readonly maxProviders: 1;
|
|
56
|
+
readonly maxProviders: -1;
|
|
57
57
|
readonly maxApiTokens: 2;
|
|
58
58
|
};
|
|
59
59
|
readonly pro: {
|
|
@@ -66,7 +66,7 @@ export declare const TIERS: {
|
|
|
66
66
|
readonly smartPlanning: "full";
|
|
67
67
|
readonly teamMembers: 1;
|
|
68
68
|
readonly maxWaves: 10;
|
|
69
|
-
readonly maxProviders:
|
|
69
|
+
readonly maxProviders: -1;
|
|
70
70
|
readonly maxApiTokens: 10;
|
|
71
71
|
};
|
|
72
72
|
readonly team: {
|
|
@@ -79,7 +79,7 @@ export declare const TIERS: {
|
|
|
79
79
|
readonly smartPlanning: "full";
|
|
80
80
|
readonly teamMembers: -1;
|
|
81
81
|
readonly maxWaves: 25;
|
|
82
|
-
readonly maxProviders:
|
|
82
|
+
readonly maxProviders: -1;
|
|
83
83
|
readonly maxApiTokens: 50;
|
|
84
84
|
};
|
|
85
85
|
readonly enterprise: {
|
|
@@ -98,3 +98,33 @@ export declare const TIERS: {
|
|
|
98
98
|
};
|
|
99
99
|
export declare function getTier(id: TierId): Tier;
|
|
100
100
|
export declare function isCloudTier(id: TierId): boolean;
|
|
101
|
+
/** Trial window in days — free users get Pro limits during this period if they have trial runs. */
|
|
102
|
+
export declare const TRIAL_WINDOW_DAYS = 30;
|
|
103
|
+
export interface EffectiveTierInput {
|
|
104
|
+
tier: TierId;
|
|
105
|
+
createdAt: string;
|
|
106
|
+
trialRunsRemaining: number;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Resolve the effective tier for a user.
|
|
110
|
+
* Free users within the trial window (30 days) with remaining trial runs
|
|
111
|
+
* get Pro-level limits. All other users return their stored tier.
|
|
112
|
+
*/
|
|
113
|
+
export declare function getEffectiveTier(user: EffectiveTierInput): TierId;
|
|
114
|
+
/**
|
|
115
|
+
* Minimal promotion shape for tier calculation.
|
|
116
|
+
* The full Promotion interface (with userId, promoType, stripe fields, etc.)
|
|
117
|
+
* lives in storage/promotions.ts — server-only, not published to npm.
|
|
118
|
+
* @internal
|
|
119
|
+
*/
|
|
120
|
+
export interface PublishedPromotion {
|
|
121
|
+
status: 'active' | 'expired' | 'cancelled' | 'superseded';
|
|
122
|
+
expiresAt: string;
|
|
123
|
+
limitsOverride: Partial<Pick<Tier, 'maxParallelAgents' | 'maxWaves' | 'maxProviders' | 'maxApiTokens' | 'cloudOrchestrations'>>;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Resolve effective limits for a user by merging active promotion overrides
|
|
127
|
+
* on top of the base tier limits.
|
|
128
|
+
* Returns a Tier object with overridden numeric fields.
|
|
129
|
+
*/
|
|
130
|
+
export declare function getEffectiveLimits(tierId: TierId, promotion: PublishedPromotion | null): Tier;
|
package/dist/tiers.js
CHANGED
|
@@ -60,7 +60,7 @@ export const TIERS = {
|
|
|
60
60
|
smartPlanning: 'none',
|
|
61
61
|
teamMembers: 1,
|
|
62
62
|
maxWaves: 2, // max dependency depth for free tier (decision: all docs agree on 2)
|
|
63
|
-
maxProviders: 1, //
|
|
63
|
+
maxProviders: -1, // unlimited — BYOK, zero cost regardless of provider count
|
|
64
64
|
maxApiTokens: 2,
|
|
65
65
|
},
|
|
66
66
|
pro: {
|
|
@@ -73,7 +73,7 @@ export const TIERS = {
|
|
|
73
73
|
smartPlanning: 'full',
|
|
74
74
|
teamMembers: 1,
|
|
75
75
|
maxWaves: 10, // e.g., higher but not unlimited
|
|
76
|
-
maxProviders:
|
|
76
|
+
maxProviders: -1, // unlimited
|
|
77
77
|
maxApiTokens: 10,
|
|
78
78
|
},
|
|
79
79
|
team: {
|
|
@@ -86,7 +86,7 @@ export const TIERS = {
|
|
|
86
86
|
smartPlanning: 'full',
|
|
87
87
|
teamMembers: -1, // unlimited
|
|
88
88
|
maxWaves: 25,
|
|
89
|
-
maxProviders:
|
|
89
|
+
maxProviders: -1, // unlimited
|
|
90
90
|
maxApiTokens: 50,
|
|
91
91
|
},
|
|
92
92
|
enterprise: {
|
|
@@ -112,3 +112,39 @@ export function getTier(id) {
|
|
|
112
112
|
export function isCloudTier(id) {
|
|
113
113
|
return TIERS[id].cloudOrchestrations !== 0;
|
|
114
114
|
}
|
|
115
|
+
/** Trial window in days — free users get Pro limits during this period if they have trial runs. */
|
|
116
|
+
export const TRIAL_WINDOW_DAYS = 30;
|
|
117
|
+
/**
|
|
118
|
+
* Resolve the effective tier for a user.
|
|
119
|
+
* Free users within the trial window (30 days) with remaining trial runs
|
|
120
|
+
* get Pro-level limits. All other users return their stored tier.
|
|
121
|
+
*/
|
|
122
|
+
export function getEffectiveTier(user) {
|
|
123
|
+
if (user.tier !== 'free')
|
|
124
|
+
return user.tier;
|
|
125
|
+
const accountAgeDays = (Date.now() - new Date(user.createdAt).getTime()) / (1000 * 60 * 60 * 24);
|
|
126
|
+
if (accountAgeDays <= TRIAL_WINDOW_DAYS && user.trialRunsRemaining > 0) {
|
|
127
|
+
return 'pro';
|
|
128
|
+
}
|
|
129
|
+
return 'free';
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Resolve effective limits for a user by merging active promotion overrides
|
|
133
|
+
* on top of the base tier limits.
|
|
134
|
+
* Returns a Tier object with overridden numeric fields.
|
|
135
|
+
*/
|
|
136
|
+
export function getEffectiveLimits(tierId, promotion) {
|
|
137
|
+
const base = getTier(tierId);
|
|
138
|
+
if (!promotion || promotion.status !== 'active' || new Date(promotion.expiresAt) <= new Date()) {
|
|
139
|
+
return base;
|
|
140
|
+
}
|
|
141
|
+
const override = promotion.limitsOverride;
|
|
142
|
+
return {
|
|
143
|
+
...base,
|
|
144
|
+
maxParallelAgents: override.maxParallelAgents ?? base.maxParallelAgents,
|
|
145
|
+
maxWaves: override.maxWaves ?? base.maxWaves,
|
|
146
|
+
maxProviders: override.maxProviders ?? base.maxProviders,
|
|
147
|
+
maxApiTokens: override.maxApiTokens ?? base.maxApiTokens,
|
|
148
|
+
cloudOrchestrations: override.cloudOrchestrations ?? base.cloudOrchestrations,
|
|
149
|
+
};
|
|
150
|
+
}
|
package/dist/tools.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
2
|
import type { ExecutorStrategy } from './types.js';
|
|
3
|
-
import type { TierId } from './tiers.js';
|
|
3
|
+
import type { TierId, PublishedPromotion } from './tiers.js';
|
|
4
4
|
/** @internal */
|
|
5
5
|
interface ToolUserStore {
|
|
6
6
|
getUserById(id: string): Promise<{
|
|
@@ -29,6 +29,10 @@ interface ToolHistoryStore {
|
|
|
29
29
|
}>;
|
|
30
30
|
saveRun(run: Record<string, unknown>, streams: Record<string, unknown>[], artifactData?: unknown): Promise<unknown>;
|
|
31
31
|
}
|
|
32
|
+
/** @internal Cloud-only promotion store. Only the method used by tools.ts is declared. */
|
|
33
|
+
interface IPromotionStore {
|
|
34
|
+
getActiveByUserId(userId: string): Promise<PublishedPromotion | null>;
|
|
35
|
+
}
|
|
32
36
|
export declare function setProjectDir(dir: string): void;
|
|
33
37
|
/** @internal Cloud-only context — not part of the public npm API. */
|
|
34
38
|
export interface ToolContext {
|
|
@@ -39,6 +43,7 @@ export interface ToolContext {
|
|
|
39
43
|
organizationId?: string;
|
|
40
44
|
providerKeyStore?: ToolProviderKeyStore;
|
|
41
45
|
historyStore?: ToolHistoryStore;
|
|
46
|
+
promotionStore?: IPromotionStore;
|
|
42
47
|
}
|
|
43
48
|
export declare function generatePlanTemplate(featureName: string, slug: string): string;
|
|
44
49
|
export declare function registerTools(server: McpServer, executor?: ExecutorStrategy, context?: ToolContext): void;
|