@wundam/orchex 1.0.0-rc.7 → 1.0.0-rc.8
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/dist/config.d.ts +4 -0
- package/dist/config.js +15 -0
- package/dist/index.js +1 -1
- package/dist/intelligence/cost-tracker.d.ts +1 -1
- package/dist/intelligence/event-types.d.ts +89 -0
- package/dist/intelligence/event-types.js +1 -0
- package/dist/intelligence/learning-engine.d.ts +1 -1
- package/dist/intelligence/pattern-analyzer.d.ts +1 -1
- package/dist/intelligence/slicing-metrics.d.ts +1 -1
- package/package.json +2 -1
package/dist/config.d.ts
CHANGED
|
@@ -7,6 +7,10 @@ export type LLMProvider = z.infer<typeof LLMProviderSchema>;
|
|
|
7
7
|
* Priority: ORCHEX_PROVIDER env var > first available API key
|
|
8
8
|
*/
|
|
9
9
|
export declare function detectProvider(): LLMProvider;
|
|
10
|
+
/**
|
|
11
|
+
* Log the detected provider and masked key at startup.
|
|
12
|
+
*/
|
|
13
|
+
export declare function logProviderDetection(): void;
|
|
10
14
|
/**
|
|
11
15
|
* Get the API key for a specific provider from environment variables.
|
|
12
16
|
*/
|
package/dist/config.js
CHANGED
|
@@ -3,6 +3,8 @@ import * as path from 'path';
|
|
|
3
3
|
import * as os from 'os';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import { TierIdSchema } from './tiers.js';
|
|
6
|
+
import { createLogger } from './logging.js';
|
|
7
|
+
const log = createLogger('config');
|
|
6
8
|
// Well-known URLs
|
|
7
9
|
export const PRODUCTION_URL = 'https://orchex.dev';
|
|
8
10
|
// ============================================================================
|
|
@@ -35,6 +37,19 @@ export function detectProvider() {
|
|
|
35
37
|
// Default to Anthropic (original behavior)
|
|
36
38
|
return 'anthropic';
|
|
37
39
|
}
|
|
40
|
+
function maskKey(key) {
|
|
41
|
+
if (key.length <= 8)
|
|
42
|
+
return '****';
|
|
43
|
+
return key.slice(0, 4) + '...' + key.slice(-4);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Log the detected provider and masked key at startup.
|
|
47
|
+
*/
|
|
48
|
+
export function logProviderDetection() {
|
|
49
|
+
const provider = detectProvider();
|
|
50
|
+
const key = getProviderApiKey(provider);
|
|
51
|
+
log.info({ provider, key: key ? maskKey(key) : 'none' }, 'provider_detected');
|
|
52
|
+
}
|
|
38
53
|
/**
|
|
39
54
|
* Get the API key for a specific provider from environment variables.
|
|
40
55
|
*/
|
package/dist/index.js
CHANGED
|
@@ -209,7 +209,7 @@ CONFIG:
|
|
|
209
209
|
orchex config --staging Configure for staging server (reads ORCHEX_API_URL)
|
|
210
210
|
|
|
211
211
|
ENVIRONMENT VARIABLES:
|
|
212
|
-
ORCHEX_API_URL Override API server URL (e.g. https://
|
|
212
|
+
ORCHEX_API_URL Override API server URL (e.g. https://orchex.dev)
|
|
213
213
|
Priority: --api-url flag > ORCHEX_API_URL > config file > default
|
|
214
214
|
|
|
215
215
|
MCP SERVER (invoked by your AI assistant):
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Token cost tracking and estimation for Orchex Learn.
|
|
3
3
|
* Provides cost estimation and aggregation for multi-provider token usage.
|
|
4
4
|
*/
|
|
5
|
-
import type { TelemetryEvent } from '
|
|
5
|
+
import type { TelemetryEvent } from './event-types.js';
|
|
6
6
|
/**
|
|
7
7
|
* Token costs per 1000 tokens (in USD).
|
|
8
8
|
* Prices as of February 2026 - should be updated periodically.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { ErrorCategory } from './error-analyzer.js';
|
|
2
|
+
import type { BudgetViolationType } from '../types.js';
|
|
3
|
+
export interface TelemetryEvent {
|
|
4
|
+
id: string;
|
|
5
|
+
sessionHash: string;
|
|
6
|
+
eventType: 'orchestration_start' | 'orchestration_complete' | 'stream_complete' | 'stream_failed' | 'self_heal_triggered';
|
|
7
|
+
timestamp: string;
|
|
8
|
+
durationMs?: number;
|
|
9
|
+
streamCount?: number;
|
|
10
|
+
waveCount?: number;
|
|
11
|
+
parallelCount?: number;
|
|
12
|
+
success?: boolean;
|
|
13
|
+
errorCategory?: ErrorCategory;
|
|
14
|
+
retryCount?: number;
|
|
15
|
+
selfHealCount?: number;
|
|
16
|
+
complexityScore?: number;
|
|
17
|
+
tokensInput?: number;
|
|
18
|
+
tokensOutput?: number;
|
|
19
|
+
provider?: string;
|
|
20
|
+
model?: string;
|
|
21
|
+
tier?: string;
|
|
22
|
+
/** Estimated context tokens before execution */
|
|
23
|
+
contextTokensEstimated?: number;
|
|
24
|
+
/** Actual context tokens from API response */
|
|
25
|
+
contextTokensActual?: number;
|
|
26
|
+
/** Budget utilization ratio (0-1) */
|
|
27
|
+
contextBudgetUtilization?: number;
|
|
28
|
+
/** Whether budget limits were exceeded */
|
|
29
|
+
budgetViolationType?: BudgetViolationType;
|
|
30
|
+
/** Provider's context window limit for this model */
|
|
31
|
+
providerContextLimit?: number;
|
|
32
|
+
/** Whether cache was hit */
|
|
33
|
+
cacheHit?: boolean;
|
|
34
|
+
/** Tokens read from cache */
|
|
35
|
+
cacheReadTokens?: number;
|
|
36
|
+
/** Tokens written to cache */
|
|
37
|
+
cacheWriteTokens?: number;
|
|
38
|
+
/** Milliseconds saved by parallel execution */
|
|
39
|
+
timeSavedMs?: number;
|
|
40
|
+
/** Hypothetical sequential execution time in ms */
|
|
41
|
+
sequentialMs?: number;
|
|
42
|
+
/** Actual parallel execution time in ms */
|
|
43
|
+
parallelMs?: number;
|
|
44
|
+
/** Stream name for category-based analysis */
|
|
45
|
+
streamName?: string;
|
|
46
|
+
/** SHA-256 hash of the prompt sent to LLM */
|
|
47
|
+
promptHash?: string;
|
|
48
|
+
/** SHA-256 hash of the artifact response */
|
|
49
|
+
artifactHash?: string;
|
|
50
|
+
}
|
|
51
|
+
export interface TelemetryAggregate {
|
|
52
|
+
period: string;
|
|
53
|
+
orchestrationsTotal: number;
|
|
54
|
+
orchestrationsSuccess: number;
|
|
55
|
+
orchestrationsFailed: number;
|
|
56
|
+
streamsTotal: number;
|
|
57
|
+
streamsSuccess: number;
|
|
58
|
+
streamsFailed: number;
|
|
59
|
+
avgDurationMs?: number;
|
|
60
|
+
p50DurationMs?: number;
|
|
61
|
+
p95DurationMs?: number;
|
|
62
|
+
errorsByCategory: Record<ErrorCategory, number>;
|
|
63
|
+
selfHealTriggered: number;
|
|
64
|
+
selfHealSuccess: number;
|
|
65
|
+
tokensInputTotal: number;
|
|
66
|
+
tokensOutputTotal: number;
|
|
67
|
+
/** Average context budget utilization (0-1) */
|
|
68
|
+
avgContextUtilization?: number;
|
|
69
|
+
/** Count of soft limit violations */
|
|
70
|
+
softViolationCount: number;
|
|
71
|
+
/** Count of hard limit violations */
|
|
72
|
+
hardViolationCount: number;
|
|
73
|
+
/** Streams that failed due to context exceeded */
|
|
74
|
+
contextExceededFailures: number;
|
|
75
|
+
/** Cache hit rate (0-1) */
|
|
76
|
+
cacheHitRate?: number;
|
|
77
|
+
/** Total tokens read from cache */
|
|
78
|
+
cacheReadTokensTotal: number;
|
|
79
|
+
/** Total tokens written to cache */
|
|
80
|
+
cacheWriteTokensTotal: number;
|
|
81
|
+
/** Estimated cost savings from cache */
|
|
82
|
+
estimatedCacheSavings?: number;
|
|
83
|
+
/** Total milliseconds saved by parallel execution */
|
|
84
|
+
timeSavedMsTotal: number;
|
|
85
|
+
/** Total hypothetical sequential time in ms */
|
|
86
|
+
sequentialMsTotal: number;
|
|
87
|
+
/** Total actual parallel time in ms */
|
|
88
|
+
parallelMsTotal: number;
|
|
89
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Learning engine for adaptive threshold adjustment in Orchex Learn.
|
|
3
3
|
* Correlates context characteristics with execution success and adapts thresholds.
|
|
4
4
|
*/
|
|
5
|
-
import type { TelemetryEvent } from '
|
|
5
|
+
import type { TelemetryEvent } from './event-types.js';
|
|
6
6
|
/**
|
|
7
7
|
* Stream categories for per-category learning.
|
|
8
8
|
* Canonical source of truth for stream categorization across all intelligence modules.
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* NOTE: StreamCategory and categorizeStream are imported from learning-engine.ts
|
|
6
6
|
* to maintain a single source of truth for stream categorization.
|
|
7
7
|
*/
|
|
8
|
-
import type { TelemetryEvent } from '
|
|
8
|
+
import type { TelemetryEvent } from './event-types.js';
|
|
9
9
|
import type { StreamResult } from '../types.js';
|
|
10
10
|
import { type StreamCategory, categorizeStream as categorizeStreamFromLearningEngine } from './learning-engine.js';
|
|
11
11
|
export type { StreamCategory };
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wundam/orchex",
|
|
3
|
-
"
|
|
3
|
+
"mcpName": "com.orchex/orchex",
|
|
4
|
+
"version": "1.0.0-rc.8",
|
|
4
5
|
"description": "Autopilot AI orchestration — auto-plan, parallelize, and execute with ownership enforcement",
|
|
5
6
|
"type": "module",
|
|
6
7
|
"main": "dist/index.js",
|