instar 1.3.486 → 1.3.487
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/commands/reflect.d.ts.map +1 -1
- package/dist/commands/reflect.js +4 -0
- package/dist/commands/reflect.js.map +1 -1
- package/dist/commands/route.d.ts.map +1 -1
- package/dist/commands/route.js +3 -0
- package/dist/commands/route.js.map +1 -1
- package/dist/commands/server.d.ts.map +1 -1
- package/dist/commands/server.js +14 -0
- package/dist/commands/server.js.map +1 -1
- package/dist/core/CircuitBreakingIntelligenceProvider.d.ts +7 -0
- package/dist/core/CircuitBreakingIntelligenceProvider.d.ts.map +1 -1
- package/dist/core/CircuitBreakingIntelligenceProvider.js +50 -0
- package/dist/core/CircuitBreakingIntelligenceProvider.js.map +1 -1
- package/dist/core/ClaudeCliIntelligenceProvider.d.ts +5 -0
- package/dist/core/ClaudeCliIntelligenceProvider.d.ts.map +1 -1
- package/dist/core/ClaudeCliIntelligenceProvider.js +6 -1
- package/dist/core/ClaudeCliIntelligenceProvider.js.map +1 -1
- package/dist/core/CodexCliIntelligenceProvider.d.ts +58 -0
- package/dist/core/CodexCliIntelligenceProvider.d.ts.map +1 -1
- package/dist/core/CodexCliIntelligenceProvider.js +293 -27
- package/dist/core/CodexCliIntelligenceProvider.js.map +1 -1
- package/dist/core/GeminiCliIntelligenceProvider.d.ts +8 -0
- package/dist/core/GeminiCliIntelligenceProvider.d.ts.map +1 -1
- package/dist/core/GeminiCliIntelligenceProvider.js +8 -0
- package/dist/core/GeminiCliIntelligenceProvider.js.map +1 -1
- package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
- package/dist/core/PostUpdateMigrator.js +40 -0
- package/dist/core/PostUpdateMigrator.js.map +1 -1
- package/dist/core/SafeGitExecutor.d.ts.map +1 -1
- package/dist/core/SafeGitExecutor.js +79 -1
- package/dist/core/SafeGitExecutor.js.map +1 -1
- package/dist/core/componentCategories.d.ts.map +1 -1
- package/dist/core/componentCategories.js +10 -0
- package/dist/core/componentCategories.js.map +1 -1
- package/dist/core/intelligenceProviderFactory.d.ts +8 -0
- package/dist/core/intelligenceProviderFactory.d.ts.map +1 -1
- package/dist/core/intelligenceProviderFactory.js +1 -0
- package/dist/core/intelligenceProviderFactory.js.map +1 -1
- package/dist/core/types.d.ts +17 -9
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js.map +1 -1
- package/dist/messaging/slack/SlackAdapter.d.ts +3 -0
- package/dist/messaging/slack/SlackAdapter.d.ts.map +1 -1
- package/dist/messaging/slack/SlackAdapter.js +8 -1
- package/dist/messaging/slack/SlackAdapter.js.map +1 -1
- package/dist/monitoring/FeatureMetricsLedger.d.ts +123 -1
- package/dist/monitoring/FeatureMetricsLedger.d.ts.map +1 -1
- package/dist/monitoring/FeatureMetricsLedger.js +211 -25
- package/dist/monitoring/FeatureMetricsLedger.js.map +1 -1
- package/dist/providers/adapters/anthropic-interactive-pool/index.d.ts.map +1 -1
- package/dist/providers/adapters/anthropic-interactive-pool/index.js +1 -0
- package/dist/providers/adapters/anthropic-interactive-pool/index.js.map +1 -1
- package/dist/providers/adapters/openai-codex/transport/codexSpawn.d.ts +93 -0
- package/dist/providers/adapters/openai-codex/transport/codexSpawn.d.ts.map +1 -1
- package/dist/providers/adapters/openai-codex/transport/codexSpawn.js +339 -0
- package/dist/providers/adapters/openai-codex/transport/codexSpawn.js.map +1 -1
- package/dist/providers/adapters/openai-codex/transport/codexUsageParser.d.ts +84 -0
- package/dist/providers/adapters/openai-codex/transport/codexUsageParser.d.ts.map +1 -0
- package/dist/providers/adapters/openai-codex/transport/codexUsageParser.js +208 -0
- package/dist/providers/adapters/openai-codex/transport/codexUsageParser.js.map +1 -0
- package/dist/providers/uxConfirm/OverrideDetector.d.ts.map +1 -1
- package/dist/providers/uxConfirm/OverrideDetector.js +1 -0
- package/dist/providers/uxConfirm/OverrideDetector.js.map +1 -1
- package/dist/providers/uxConfirm/TaskClassifier.d.ts.map +1 -1
- package/dist/providers/uxConfirm/TaskClassifier.js +1 -0
- package/dist/providers/uxConfirm/TaskClassifier.js.map +1 -1
- package/dist/scaffold/templates.d.ts.map +1 -1
- package/dist/scaffold/templates.js +3 -2
- package/dist/scaffold/templates.js.map +1 -1
- package/dist/security/LLMSanitizer.d.ts.map +1 -1
- package/dist/security/LLMSanitizer.js +7 -1
- package/dist/security/LLMSanitizer.js.map +1 -1
- package/dist/server/CapabilityIndex.js +1 -1
- package/dist/server/CapabilityIndex.js.map +1 -1
- package/dist/server/routes.d.ts.map +1 -1
- package/dist/server/routes.js +10 -1
- package/dist/server/routes.js.map +1 -1
- package/dist/threadline/PipeSessionSpawner.d.ts.map +1 -1
- package/dist/threadline/PipeSessionSpawner.js +2 -0
- package/dist/threadline/PipeSessionSpawner.js.map +1 -1
- package/dist/threadline/WarrantsReplyGate.d.ts.map +1 -1
- package/dist/threadline/WarrantsReplyGate.js +5 -1
- package/dist/threadline/WarrantsReplyGate.js.map +1 -1
- package/package.json +4 -2
- package/scripts/lint-llm-attribution.js +418 -0
- package/scripts/lint-no-direct-destructive.js +4 -0
- package/scripts/pre-push-gate.js +24 -0
- package/src/data/builtin-manifest.json +63 -63
- package/src/scaffold/templates.ts +3 -2
- package/upgrades/1.3.487.md +39 -0
- package/upgrades/side-effects/token-audit-completeness.md +84 -0
|
@@ -47,6 +47,11 @@ export interface FeatureMetricsRecorder {
|
|
|
47
47
|
*/
|
|
48
48
|
tokensIn?: number;
|
|
49
49
|
tokensOut?: number;
|
|
50
|
+
/**
|
|
51
|
+
* Cache-read input tokens — an informational SUBSET of tokensIn
|
|
52
|
+
* (token-audit-completeness). Fresh cost = tokensIn − tokensCached.
|
|
53
|
+
*/
|
|
54
|
+
tokensCached?: number;
|
|
50
55
|
/**
|
|
51
56
|
* Observable Intelligence: the resolved model + framework that actually
|
|
52
57
|
* served this call, surfaced by the provider via IntelligenceOptions.onModel.
|
|
@@ -61,6 +66,8 @@ export interface FeatureMetricsRecorder {
|
|
|
61
66
|
}
|
|
62
67
|
export declare function setFeatureMetricsRecorder(recorder: FeatureMetricsRecorder | null): void;
|
|
63
68
|
export declare function getFeatureMetricsRecorder(): FeatureMetricsRecorder | null;
|
|
69
|
+
/** Test-only seam. */
|
|
70
|
+
export declare function _resetUnlabeledEmissionForTest(): void;
|
|
64
71
|
export declare class CircuitBreakingIntelligenceProvider implements IntelligenceProvider {
|
|
65
72
|
private readonly inner;
|
|
66
73
|
private readonly breaker;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CircuitBreakingIntelligenceProvider.d.ts","sourceRoot":"","sources":["../../src/core/CircuitBreakingIntelligenceProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAC5E,OAAO,EACL,iBAAiB,EAKlB,MAAM,wBAAwB,CAAC;AAEhC;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACrC,MAAM,CAAC,KAAK,EAAE;QACZ,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC;QACvB,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;QAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB;;;;;WAKG;QACH,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB;;;;;WAKG;QACH,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,kFAAkF;QAClF,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,GAAG,IAAI,CAAC;CACV;AAOD,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,sBAAsB,GAAG,IAAI,GAAG,IAAI,CAEvF;AACD,wBAAgB,yBAAyB,IAAI,sBAAsB,GAAG,IAAI,CAEzE;AAED,qBAAa,mCAAoC,YAAW,oBAAoB;IAE5E,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBADP,KAAK,EAAE,oBAAoB,EAC3B,OAAO,GAAE,iBAA0C;IAGtE;;;;;;;;;;OAUG;IACH,OAAO,CAAC,YAAY;
|
|
1
|
+
{"version":3,"file":"CircuitBreakingIntelligenceProvider.d.ts","sourceRoot":"","sources":["../../src/core/CircuitBreakingIntelligenceProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAC5E,OAAO,EACL,iBAAiB,EAKlB,MAAM,wBAAwB,CAAC;AAEhC;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACrC,MAAM,CAAC,KAAK,EAAE;QACZ,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC;QACvB,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;QAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB;;;;;WAKG;QACH,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB;;;WAGG;QACH,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB;;;;;WAKG;QACH,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,kFAAkF;QAClF,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,GAAG,IAAI,CAAC;CACV;AAOD,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,sBAAsB,GAAG,IAAI,GAAG,IAAI,CAEvF;AACD,wBAAgB,yBAAyB,IAAI,sBAAsB,GAAG,IAAI,CAEzE;AAoCD,sBAAsB;AACtB,wBAAgB,8BAA8B,IAAI,IAAI,CAErD;AAED,qBAAa,mCAAoC,YAAW,oBAAoB;IAE5E,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBADP,KAAK,EAAE,oBAAoB,EAC3B,OAAO,GAAE,iBAA0C;IAGtE;;;;;;;;;;OAUG;IACH,OAAO,CAAC,YAAY;IAkCd,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC;CAyG/E;AAED;;;;GAIG;AACH,wBAAgB,kCAAkC,CAChD,QAAQ,EAAE,oBAAoB,GAAG,IAAI,GAAG,SAAS,EACjD,OAAO,CAAC,EAAE,iBAAiB,GAC1B,oBAAoB,GAAG,IAAI,CAO7B"}
|
|
@@ -35,6 +35,42 @@ export function setFeatureMetricsRecorder(recorder) {
|
|
|
35
35
|
export function getFeatureMetricsRecorder() {
|
|
36
36
|
return _featureMetricsRecorder;
|
|
37
37
|
}
|
|
38
|
+
// ── unlabeled-call runtime backstop (token-audit-completeness, Slice 3) ─────
|
|
39
|
+
//
|
|
40
|
+
// With the attribution baseline driven to zero (every funnel callsite tagged
|
|
41
|
+
// + the lint ratchet), ANY unlabeled llm row is a real escape — conditional
|
|
42
|
+
// attribution or helper-wrapper indirection the lexical lint can't see.
|
|
43
|
+
// Emission is gated to ONCE PER PROCESS LIFETIME: the DegradationReporter
|
|
44
|
+
// legacy path files an external feedback report per event with no
|
|
45
|
+
// feedback-side cooldown, so per-call emission would be fleet-spam (P17).
|
|
46
|
+
// The durable surfaces are unlabeledCallShare / unlabeledTokenShare in
|
|
47
|
+
// /metrics/features. The feature string is a FIXED CONSTANT (the Telegram
|
|
48
|
+
// dedup key — a fixed constant prevents the P17 unique-source dodge).
|
|
49
|
+
const UNLABELED_LLM_CALL_FEATURE = 'unlabeled-llm-call';
|
|
50
|
+
let emittedUnlabeledLlmCall = false;
|
|
51
|
+
function emitUnlabeledLlmCallOnce() {
|
|
52
|
+
if (emittedUnlabeledLlmCall)
|
|
53
|
+
return;
|
|
54
|
+
emittedUnlabeledLlmCall = true;
|
|
55
|
+
// Lazy import: core/ stays constructible without the monitoring layer.
|
|
56
|
+
void import('../monitoring/DegradationReporter.js')
|
|
57
|
+
.then(({ DegradationReporter }) => {
|
|
58
|
+
DegradationReporter.getInstance().report({
|
|
59
|
+
feature: UNLABELED_LLM_CALL_FEATURE,
|
|
60
|
+
primary: 'every funnel LLM call carries attribution.component (zero-baseline ratchet)',
|
|
61
|
+
fallback: 'an LLM call recorded under the "unlabeled" bucket',
|
|
62
|
+
reason: 'a funnel callsite reached evaluate() without attribution.component',
|
|
63
|
+
impact: 'token spend is unattributable for that caller; see unlabeledCallShare/unlabeledTokenShare in /metrics/features',
|
|
64
|
+
});
|
|
65
|
+
})
|
|
66
|
+
.catch(() => {
|
|
67
|
+
/* @silent-fallback-ok: the backstop is a signal, never a gate */
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
/** Test-only seam. */
|
|
71
|
+
export function _resetUnlabeledEmissionForTest() {
|
|
72
|
+
emittedUnlabeledLlmCall = false;
|
|
73
|
+
}
|
|
38
74
|
export class CircuitBreakingIntelligenceProvider {
|
|
39
75
|
inner;
|
|
40
76
|
breaker;
|
|
@@ -54,6 +90,10 @@ export class CircuitBreakingIntelligenceProvider {
|
|
|
54
90
|
* load can't masquerade as completed work (the 0ms-latency confound).
|
|
55
91
|
*/
|
|
56
92
|
recordMetric(feature, outcome, latencyMs, waited, waitMs, extra) {
|
|
93
|
+
// Runtime backstop: an unlabeled llm row is a real escape past the
|
|
94
|
+
// zero-baseline attribution ratchet. Signal-only, once per process.
|
|
95
|
+
if (feature === 'unlabeled')
|
|
96
|
+
emitUnlabeledLlmCallOnce();
|
|
57
97
|
const rec = _featureMetricsRecorder;
|
|
58
98
|
if (!rec)
|
|
59
99
|
return;
|
|
@@ -62,6 +102,7 @@ export class CircuitBreakingIntelligenceProvider {
|
|
|
62
102
|
feature, kind: 'llm', outcome, latencyMs,
|
|
63
103
|
waited, waitMs: waited ? waitMs : undefined,
|
|
64
104
|
tokensIn: extra?.tokensIn, tokensOut: extra?.tokensOut,
|
|
105
|
+
tokensCached: extra?.tokensCached,
|
|
65
106
|
model: extra?.model, framework: extra?.framework,
|
|
66
107
|
verdictId: extra?.verdictId,
|
|
67
108
|
});
|
|
@@ -138,6 +179,7 @@ export class CircuitBreakingIntelligenceProvider {
|
|
|
138
179
|
this.recordMetric(feature, outcome, Date.now() - startedAt, waited, options?.rateLimitWaitMs, {
|
|
139
180
|
tokensIn: usage?.inputTokens,
|
|
140
181
|
tokensOut: usage?.outputTokens,
|
|
182
|
+
tokensCached: usage?.cachedTokens,
|
|
141
183
|
model: resolved?.model,
|
|
142
184
|
framework: resolved?.framework,
|
|
143
185
|
verdictId,
|
|
@@ -147,7 +189,15 @@ export class CircuitBreakingIntelligenceProvider {
|
|
|
147
189
|
catch (err) {
|
|
148
190
|
const message = err instanceof Error ? err.message : String(err);
|
|
149
191
|
const parsed = classifyRateLimit(message);
|
|
192
|
+
// Error rows carry already-burned cost (token-audit-completeness): a
|
|
193
|
+
// provider that parsed usage before failing (timeout-killed codex sweep,
|
|
194
|
+
// post-success extraction failure) invoked onUsage before rejecting, so
|
|
195
|
+
// the captured `usage` is in scope here. Dropping it would systematically
|
|
196
|
+
// under-report flaky features' true cost — the inversion of auditability.
|
|
150
197
|
this.recordMetric(feature, 'error', Date.now() - startedAt, waited, options?.rateLimitWaitMs, {
|
|
198
|
+
tokensIn: usage?.inputTokens,
|
|
199
|
+
tokensOut: usage?.outputTokens,
|
|
200
|
+
tokensCached: usage?.cachedTokens,
|
|
151
201
|
model: resolved?.model,
|
|
152
202
|
framework: resolved?.framework,
|
|
153
203
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CircuitBreakingIntelligenceProvider.js","sourceRoot":"","sources":["../../src/core/CircuitBreakingIntelligenceProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAGH,OAAO,EAEL,mBAAmB,EACnB,cAAc,EACd,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"CircuitBreakingIntelligenceProvider.js","sourceRoot":"","sources":["../../src/core/CircuitBreakingIntelligenceProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAGH,OAAO,EAEL,mBAAmB,EACnB,cAAc,EACd,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,wBAAwB,CAAC;AA0ChC,4EAA4E;AAC5E,8EAA8E;AAC9E,gFAAgF;AAChF,gEAAgE;AAChE,IAAI,uBAAuB,GAAkC,IAAI,CAAC;AAClE,MAAM,UAAU,yBAAyB,CAAC,QAAuC;IAC/E,uBAAuB,GAAG,QAAQ,CAAC;AACrC,CAAC;AACD,MAAM,UAAU,yBAAyB;IACvC,OAAO,uBAAuB,CAAC;AACjC,CAAC;AAED,+EAA+E;AAC/E,EAAE;AACF,6EAA6E;AAC7E,4EAA4E;AAC5E,wEAAwE;AACxE,0EAA0E;AAC1E,kEAAkE;AAClE,0EAA0E;AAC1E,uEAAuE;AACvE,0EAA0E;AAC1E,sEAAsE;AACtE,MAAM,0BAA0B,GAAG,oBAAoB,CAAC;AACxD,IAAI,uBAAuB,GAAG,KAAK,CAAC;AAEpC,SAAS,wBAAwB;IAC/B,IAAI,uBAAuB;QAAE,OAAO;IACpC,uBAAuB,GAAG,IAAI,CAAC;IAC/B,uEAAuE;IACvE,KAAK,MAAM,CAAC,sCAAsC,CAAC;SAChD,IAAI,CAAC,CAAC,EAAE,mBAAmB,EAAE,EAAE,EAAE;QAChC,mBAAmB,CAAC,W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;AACH,MAAM,UAAU,kCAAkC,CAChD,QAAiD,EACjD,OAA2B;IAE3B,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC3B,IAAI,QAAQ,YAAY,mCAAmC;QAAE,OAAO,QAAQ,CAAC;IAC7E,+EAA+E;IAC/E,iFAAiF;IACjF,gFAAgF;IAChF,OAAO,IAAI,mCAAmC,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AACpE,CAAC"}
|
|
@@ -28,9 +28,14 @@ export declare class ClaudeCliIntelligenceProvider implements IntelligenceProvid
|
|
|
28
28
|
* creation + cache read), since each is a real cost; tokensOut is
|
|
29
29
|
* output_tokens. Missing fields count as 0. onUsage fires only when at least
|
|
30
30
|
* one token count is present, and never throws into the caller.
|
|
31
|
+
* - cachedTokens (token-audit-completeness) is cache_read_input_tokens ONLY —
|
|
32
|
+
* a SUBSET of tokensIn (tokensIn's meaning unchanged). Cache CREATION costs
|
|
33
|
+
* ~1.25× fresh and stays plain input; cache READS cost ~0.1× — collapsing
|
|
34
|
+
* them would point the cost signal in two directions at once.
|
|
31
35
|
*/
|
|
32
36
|
export declare function parseJsonResult(stdout: string, onUsage?: (usage: {
|
|
33
37
|
inputTokens: number;
|
|
34
38
|
outputTokens: number;
|
|
39
|
+
cachedTokens?: number;
|
|
35
40
|
}) => void): string;
|
|
36
41
|
//# sourceMappingURL=ClaudeCliIntelligenceProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClaudeCliIntelligenceProvider.d.ts","sourceRoot":"","sources":["../../src/core/ClaudeCliIntelligenceProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAO5E,qBAAa,6BAA8B,YAAW,oBAAoB;IACxE,OAAO,CAAC,UAAU,CAAS;gBAEf,UAAU,EAAE,MAAM;IAYxB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC;CAwD/E;AAED
|
|
1
|
+
{"version":3,"file":"ClaudeCliIntelligenceProvider.d.ts","sourceRoot":"","sources":["../../src/core/ClaudeCliIntelligenceProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAO5E,qBAAa,6BAA8B,YAAW,oBAAoB;IACxE,OAAO,CAAC,UAAU,CAAS;gBAEf,UAAU,EAAE,MAAM;IAYxB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC;CAwD/E;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,KAAK,IAAI,GAC9F,MAAM,CA8BR"}
|
|
@@ -95,6 +95,10 @@ export class ClaudeCliIntelligenceProvider {
|
|
|
95
95
|
* creation + cache read), since each is a real cost; tokensOut is
|
|
96
96
|
* output_tokens. Missing fields count as 0. onUsage fires only when at least
|
|
97
97
|
* one token count is present, and never throws into the caller.
|
|
98
|
+
* - cachedTokens (token-audit-completeness) is cache_read_input_tokens ONLY —
|
|
99
|
+
* a SUBSET of tokensIn (tokensIn's meaning unchanged). Cache CREATION costs
|
|
100
|
+
* ~1.25× fresh and stays plain input; cache READS cost ~0.1× — collapsing
|
|
101
|
+
* them would point the cost signal in two directions at once.
|
|
98
102
|
*/
|
|
99
103
|
export function parseJsonResult(stdout, onUsage) {
|
|
100
104
|
const trimmed = stdout.trim();
|
|
@@ -113,8 +117,9 @@ export function parseJsonResult(stdout, onUsage) {
|
|
|
113
117
|
const num = (v) => (typeof v === 'number' && Number.isFinite(v) ? v : 0);
|
|
114
118
|
const inputTokens = num(u.input_tokens) + num(u.cache_creation_input_tokens) + num(u.cache_read_input_tokens);
|
|
115
119
|
const outputTokens = num(u.output_tokens);
|
|
120
|
+
const cachedTokens = num(u.cache_read_input_tokens);
|
|
116
121
|
if (inputTokens > 0 || outputTokens > 0) {
|
|
117
|
-
onUsage({ inputTokens, outputTokens });
|
|
122
|
+
onUsage({ inputTokens, outputTokens, cachedTokens });
|
|
118
123
|
}
|
|
119
124
|
}
|
|
120
125
|
catch {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClaudeCliIntelligenceProvider.js","sourceRoot":"","sources":["../../src/core/ClaudeCliIntelligenceProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAEhE,MAAM,aAAa,GAAG,MAAM,CAAC;AAC7B,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAElC,MAAM,OAAO,6BAA6B;IAChC,UAAU,CAAS;IAE3B,YAAY,UAAkB;QAC5B,wEAAwE;QACxE,mEAAmE;QACnE,oEAAoE;QACpE,qEAAqE;QACrE,mEAAmE;QACnE,wEAAwE;QACxE,yDAAyD;QACzD,mBAAmB,CAAC,+BAA+B,CAAC,CAAC;QACrD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,MAAc,EAAE,OAA6B;QAC1D,MAAM,KAAK,GAAG,cAAc,CAAC,OAAO,EAAE,KAAK,IAAI,aAAa,CAAC,CAAC;QAC9D,0EAA0E;QAC1E,2EAA2E;QAC3E,IAAI,CAAC;YAAC,OAAO,EAAE,OAAO,EAAE,C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,CAAC,CAAC,aAAa,CAAC,CAAC;YAC1C,MAAM,YAAY,GAAG,GAAG,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC;YACpD,IAAI,WAAW,GAAG,CAAC,IAAI,YAAY,GAAG,CAAC,EAAE,CAAC;gBACxC,OAAO,CAAC,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC,CAAC;YACvD,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,uDAAuD;QACzD,CAAC;IACH,CAAC;IACD,IAAI,GAAG,IAAI,OAAO,GAAG,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC1C,OAAO,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;IAC3B,CAAC;IACD,6DAA6D;IAC7D,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -10,8 +10,33 @@
|
|
|
10
10
|
* implementation. Reviewers, sentinels, canaries, and JobReflector now
|
|
11
11
|
* have a non-Claude path. The composition root picks the right
|
|
12
12
|
* implementation based on the agent's configured framework.
|
|
13
|
+
*
|
|
14
|
+
* token-audit-completeness: by default calls run as `codex exec --json`
|
|
15
|
+
* (streaming event parse → per-call token usage via onUsage; result read
|
|
16
|
+
* ONLY from the --output-last-message file). The kill-switch
|
|
17
|
+
* `intelligence.codexExecJson: false` (or env `INSTAR_CODEX_EXEC_JSON=0`)
|
|
18
|
+
* restores the previous plain-output invocation byte-for-byte.
|
|
13
19
|
*/
|
|
14
20
|
import type { IntelligenceProvider, IntelligenceOptions } from './types.js';
|
|
21
|
+
/**
|
|
22
|
+
* Build the per-call kill-switch resolver for construction sites that have a
|
|
23
|
+
* project dir. Pinned closure body (spec): a TTL-cached (30 s) raw
|
|
24
|
+
* `readFileSync` + `JSON.parse` of `.instar/config.json` reading ONLY
|
|
25
|
+
* `intelligence.codexExecJson` — never `loadConfig()` (which drags a
|
|
26
|
+
* synchronous SecretStore keychain execFileSync onto every judgment call),
|
|
27
|
+
* and never a boot-time closure over the in-memory config object (no config
|
|
28
|
+
* hot-reload exists, so it would never see a disk flip).
|
|
29
|
+
*
|
|
30
|
+
* Resolution order: the config key wins when the file parses AND the key is
|
|
31
|
+
* present; otherwise — including parse/read failure — fall through to the
|
|
32
|
+
* env lever (itself default-on). An operator hand-editing config under
|
|
33
|
+
* pressure who leaves a JSON slip gets a once-per-process parse-failure
|
|
34
|
+
* warning and a still-working env lever, not a silently-ignored kill-switch.
|
|
35
|
+
* A config flip applies within 30 s, no restart.
|
|
36
|
+
*/
|
|
37
|
+
export declare function createCodexExecJsonConfigResolver(configPath?: string, ttlMs?: number): () => boolean;
|
|
38
|
+
/** Test-only seam. */
|
|
39
|
+
export declare function _resetUsageDriftEmissionForTest(): void;
|
|
15
40
|
export interface CodexCliIntelligenceProviderOptions {
|
|
16
41
|
/** Absolute path to the `codex` CLI binary. */
|
|
17
42
|
codexPath: string;
|
|
@@ -29,11 +54,44 @@ export interface CodexCliIntelligenceProviderOptions {
|
|
|
29
54
|
* cwd content, so ignoring this value is safe.
|
|
30
55
|
*/
|
|
31
56
|
workingDirectory?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Per-call kill-switch read for exec-json mode (token-audit-completeness).
|
|
59
|
+
* The IntelligenceRouter caches built providers, so a PER-CALL closure read
|
|
60
|
+
* is what survives that caching. Construction sites with config thread
|
|
61
|
+
* `createCodexExecJsonConfigResolver()`; absent the closure, the provider
|
|
62
|
+
* resolves env `INSTAR_CODEX_EXEC_JSON !== '0'` so config-less sites keep a
|
|
63
|
+
* working rollback lever.
|
|
64
|
+
*/
|
|
65
|
+
resolveExecJson?: () => boolean;
|
|
32
66
|
}
|
|
33
67
|
export declare class CodexCliIntelligenceProvider implements IntelligenceProvider {
|
|
34
68
|
private readonly codexPath;
|
|
35
69
|
private readonly sandboxMode;
|
|
70
|
+
private readonly resolveExecJson;
|
|
36
71
|
constructor(options: CodexCliIntelligenceProviderOptions);
|
|
72
|
+
/** Hygiene args shared by BOTH modes (clean-call spec; pinned by the
|
|
73
|
+
* both-modes unit test). */
|
|
74
|
+
private hygieneArgs;
|
|
37
75
|
evaluate(prompt: string, options?: IntelligenceOptions): Promise<string>;
|
|
76
|
+
/**
|
|
77
|
+
* Kill-switch path — the pre-exec-json invocation, byte-for-byte (result
|
|
78
|
+
* semantics included: stdout.trim(), empty answer resolves '').
|
|
79
|
+
*
|
|
80
|
+
* SECURITY NOTE (disclosed tradeoff, not a regression): this legacy path
|
|
81
|
+
* passes the prompt as a positional argv element (ps-visible to local
|
|
82
|
+
* users) and execFile's error.message embeds the full command line —
|
|
83
|
+
* including the prompt — into thrown Errors. The exec-json path fixes
|
|
84
|
+
* both (prompt via stdin; errors carry only a bounded stderr tail).
|
|
85
|
+
* Flipping the kill-switch therefore re-opens this pre-existing
|
|
86
|
+
* prompt-disclosure channel in addition to going token-blind.
|
|
87
|
+
*/
|
|
88
|
+
private evaluatePlain;
|
|
89
|
+
/**
|
|
90
|
+
* Default path — `codex exec --json` with streaming usage parse. The
|
|
91
|
+
* result is read from the --output-last-message file, AND ONLY from there
|
|
92
|
+
* (stdout events never become the result: injection surface; Signal vs
|
|
93
|
+
* Authority — events are observability signal, the file is the authority).
|
|
94
|
+
*/
|
|
95
|
+
private evaluateExecJson;
|
|
38
96
|
}
|
|
39
97
|
//# sourceMappingURL=CodexCliIntelligenceProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodexCliIntelligenceProvider.d.ts","sourceRoot":"","sources":["../../src/core/CodexCliIntelligenceProvider.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"CodexCliIntelligenceProvider.d.ts","sourceRoot":"","sources":["../../src/core/CodexCliIntelligenceProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAMH,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAsF5E;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,iCAAiC,CAC/C,UAAU,GAAE,MAAsD,EAClE,KAAK,GAAE,MAAe,GACrB,MAAM,OAAO,CAwCf;AAoCD,sBAAsB;AACtB,wBAAgB,+BAA+B,IAAI,IAAI,CAGtD;AAED,MAAM,WAAW,mCAAmC;IAClD,+CAA+C;IAC/C,SAAS,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,WAAW,CAAC,EAAE,WAAW,GAAG,iBAAiB,GAAG,oBAAoB,CAAC;IACrE;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE,MAAM,OAAO,CAAC;CACjC;AAED,qBAAa,4BAA6B,YAAW,oBAAoB;IACvE,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAyD;IACrF,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAgB;gBAEpC,OAAO,EAAE,mCAAmC;IAoBxD;gCAC4B;IAC5B,OAAO,CAAC,WAAW;IA8Bb,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC;IAmB9E;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,aAAa;IAgErB;;;;;OAKG;YACW,gBAAgB;CA6F/B"}
|