@probelabs/probe 0.6.0-rc334 → 0.6.0-rc336
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/bin/binaries/{probe-v0.6.0-rc334-aarch64-apple-darwin.tar.gz → probe-v0.6.0-rc336-aarch64-apple-darwin.tar.gz} +0 -0
- package/bin/binaries/{probe-v0.6.0-rc334-aarch64-unknown-linux-musl.tar.gz → probe-v0.6.0-rc336-aarch64-unknown-linux-musl.tar.gz} +0 -0
- package/bin/binaries/{probe-v0.6.0-rc334-x86_64-apple-darwin.tar.gz → probe-v0.6.0-rc336-x86_64-apple-darwin.tar.gz} +0 -0
- package/bin/binaries/{probe-v0.6.0-rc334-x86_64-pc-windows-msvc.zip → probe-v0.6.0-rc336-x86_64-pc-windows-msvc.zip} +0 -0
- package/bin/binaries/{probe-v0.6.0-rc334-x86_64-unknown-linux-musl.tar.gz → probe-v0.6.0-rc336-x86_64-unknown-linux-musl.tar.gz} +0 -0
- package/build/agent/ProbeAgent.js +43 -18
- package/build/agent/engines/codex.js +33 -14
- package/build/agent/engines/governed-answer-failure.js +18 -7
- package/build/utils/provider.js +11 -1
- package/cjs/agent/ProbeAgent.cjs +2746 -123
- package/cjs/index.cjs +2746 -123
- package/package.json +2 -1
- package/src/agent/ProbeAgent.js +43 -18
- package/src/agent/engines/codex.js +33 -14
- package/src/agent/engines/governed-answer-failure.js +18 -7
- package/src/utils/provider.js +11 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -2503,7 +2503,10 @@ export class ProbeAgent {
|
|
|
2503
2503
|
}
|
|
2504
2504
|
return this.engine;
|
|
2505
2505
|
} catch (error) {
|
|
2506
|
-
if (this.governedCodexProfile)
|
|
2506
|
+
if (this.governedCodexProfile) {
|
|
2507
|
+
throw normalizeGovernedAnswerFailure(error, 'provider_engine', null, null, null,
|
|
2508
|
+
null, null, 'acquire');
|
|
2509
|
+
}
|
|
2507
2510
|
console.warn('[WARNING] Failed to load Codex CLI engine:', error.message);
|
|
2508
2511
|
console.warn('[WARNING] Falling back to Vercel AI SDK');
|
|
2509
2512
|
this.clientApiProvider = null;
|
|
@@ -3530,8 +3533,11 @@ Follow these instructions carefully:
|
|
|
3530
3533
|
let engine, answerFailure = null;
|
|
3531
3534
|
try {
|
|
3532
3535
|
try { engine = await this.getEngine(); }
|
|
3533
|
-
catch
|
|
3534
|
-
|
|
3536
|
+
catch (error) {
|
|
3537
|
+
throw normalizeGovernedAnswerFailure(error, 'provider_engine', null, null, null,
|
|
3538
|
+
null, null, 'acquire');
|
|
3539
|
+
}
|
|
3540
|
+
if (!engine?.query) throw governedAnswerFailure('internal_contract');
|
|
3535
3541
|
const candidateChunks = [];
|
|
3536
3542
|
let runtimeAttestation;
|
|
3537
3543
|
let attestationCount = 0;
|
|
@@ -3540,31 +3546,47 @@ Follow these instructions carefully:
|
|
|
3540
3546
|
const queryOptions = hasInvocationDigest
|
|
3541
3547
|
? { abortSignal: this._abortController.signal, invocationDigest: invocationDigest }
|
|
3542
3548
|
: { abortSignal: this._abortController.signal };
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3549
|
+
try {
|
|
3550
|
+
for await (const chunk of engine.query(prompt, queryOptions)) {
|
|
3551
|
+
if (chunk.type === 'text' && chunk.content) candidateChunks.push(chunk.content);
|
|
3552
|
+
else if (chunk.type === 'metadata' && chunk.data?.attestation) {
|
|
3553
|
+
runtimeAttestation = chunk.data.attestation;
|
|
3554
|
+
attestationCount++;
|
|
3555
|
+
} else if (chunk.type === 'toolBatch') {
|
|
3556
|
+
nativeToolBatch = chunk;
|
|
3557
|
+
nativeToolBatchCount++;
|
|
3558
|
+
} else if (chunk.type === 'error') {
|
|
3559
|
+
throw normalizeGovernedAnswerFailure(chunk.error, 'provider_engine', null, null, null,
|
|
3560
|
+
null, null, 'query');
|
|
3561
|
+
}
|
|
3562
|
+
}
|
|
3563
|
+
} catch (error) {
|
|
3564
|
+
throw normalizeGovernedAnswerFailure(error, 'provider_engine', null, null, null,
|
|
3565
|
+
null, null, 'query');
|
|
3552
3566
|
}
|
|
3553
3567
|
if (hasInvocationDigest) {
|
|
3554
3568
|
const expectedAttestation = this.governedCodexProfile?.version === 'probe.governed-codex-profile/v2'
|
|
3555
3569
|
? 'probe.governed-codex-attestation/v3' : 'probe.governed-codex-attestation/v2';
|
|
3556
3570
|
if (attestationCount !== 1 || runtimeAttestation?.version !== expectedAttestation || runtimeAttestation?.executionContext?.source !== 'caller' || runtimeAttestation?.executionContext?.invocationDigest !== invocationDigest) {
|
|
3557
|
-
throw
|
|
3571
|
+
throw governedAnswerFailure('native_event_grammar', 'live_envelope_session', 'attestation', null,
|
|
3572
|
+
'invocation_attestation');
|
|
3558
3573
|
}
|
|
3559
|
-
} else if (attestationCount !== 1)
|
|
3574
|
+
} else if (attestationCount !== 1) {
|
|
3575
|
+
throw governedAnswerFailure('native_event_grammar', 'live_envelope_session', 'attestation', null,
|
|
3576
|
+
'invocation_attestation');
|
|
3577
|
+
}
|
|
3560
3578
|
if (this.governedCodexProfile?.version === 'probe.governed-codex-profile/v2') {
|
|
3561
3579
|
if (nativeToolBatchCount !== 1 || !Number.isSafeInteger(nativeToolBatch?.total) ||
|
|
3562
3580
|
!Array.isArray(nativeToolBatch?.tools) || nativeToolBatch.total !== runtimeAttestation?.observed?.nativeTools?.total ||
|
|
3563
3581
|
JSON.stringify(nativeToolBatch.tools) !== JSON.stringify(runtimeAttestation?.observed?.nativeTools?.tools)) {
|
|
3564
|
-
throw
|
|
3582
|
+
throw governedAnswerFailure('native_event_grammar', 'live_envelope_session', 'attestation', null,
|
|
3583
|
+
'native_capability_aggregate');
|
|
3565
3584
|
}
|
|
3566
3585
|
for (const toolEvent of nativeToolBatch.tools) this.events.emit('toolCall', toolEvent);
|
|
3567
|
-
} else if (nativeToolBatchCount !== 0)
|
|
3586
|
+
} else if (nativeToolBatchCount !== 0) {
|
|
3587
|
+
throw governedAnswerFailure('native_event_grammar', 'live_envelope_session', 'attestation', null,
|
|
3588
|
+
'native_capability_aggregate');
|
|
3589
|
+
}
|
|
3568
3590
|
const validation = validateJsonResponse(candidateChunks.join(''), {debug:this.debug,schema});
|
|
3569
3591
|
if (!validation.isValid) throw governedSchemaResultValidationFailure(validation);
|
|
3570
3592
|
if (hasResultIdentity) {
|
|
@@ -3577,12 +3599,15 @@ Follow these instructions carefully:
|
|
|
3577
3599
|
}
|
|
3578
3600
|
return { data: validation.parsed, runtimeAttestation };
|
|
3579
3601
|
} catch (error) {
|
|
3580
|
-
answerFailure = normalizeGovernedAnswerFailure(error, '
|
|
3602
|
+
answerFailure = normalizeGovernedAnswerFailure(error, 'internal_contract');
|
|
3581
3603
|
throw answerFailure;
|
|
3582
3604
|
} finally {
|
|
3583
3605
|
if (engine) {
|
|
3584
3606
|
try { await engine.close(); }
|
|
3585
|
-
catch
|
|
3607
|
+
catch (error) {
|
|
3608
|
+
if (!answerFailure) throw normalizeGovernedAnswerFailure(error, 'provider_engine', null, null, null,
|
|
3609
|
+
null, null, 'close');
|
|
3610
|
+
}
|
|
3586
3611
|
}
|
|
3587
3612
|
}
|
|
3588
3613
|
}
|
|
@@ -461,7 +461,11 @@ export async function createCodexEngine(options = {}) {
|
|
|
461
461
|
try { collector.observe(event); } catch (error) { evidenceFailure ??= normalizeGovernedAnswerFailure(error, 'native_event_grammar'); }
|
|
462
462
|
});
|
|
463
463
|
if (opts.abortSignal) {
|
|
464
|
-
if (opts.abortSignal.aborted)
|
|
464
|
+
if (opts.abortSignal.aborted) {
|
|
465
|
+
throw governedProfile
|
|
466
|
+
? governedAnswerFailure('provider_engine', null, null, null, null, null, null, 'query')
|
|
467
|
+
: new Error('Codex query cancelled');
|
|
468
|
+
}
|
|
465
469
|
abortHandler = () => { void cleanup(new Error('Codex query cancelled')).catch(() => {}); };
|
|
466
470
|
opts.abortSignal.addEventListener('abort', abortHandler, { once: true });
|
|
467
471
|
}
|
|
@@ -501,7 +505,8 @@ export async function createCodexEngine(options = {}) {
|
|
|
501
505
|
try { result = await resultPromise; }
|
|
502
506
|
catch (error) {
|
|
503
507
|
throw governedProfile
|
|
504
|
-
?
|
|
508
|
+
? evidenceFailure || normalizeGovernedAnswerFailure(error, 'provider_engine', null, null, null,
|
|
509
|
+
null, null, 'query')
|
|
505
510
|
: error;
|
|
506
511
|
}
|
|
507
512
|
|
|
@@ -521,20 +526,31 @@ export async function createCodexEngine(options = {}) {
|
|
|
521
526
|
internal = attestGovernedCodexSession({ profile: governedProfile,
|
|
522
527
|
events: governedProfile.version === 'probe.governed-codex-profile/v2'
|
|
523
528
|
? [collected.sessionEvent, collected.capabilities.nativeTools] : [collected.sessionEvent] });
|
|
529
|
+
} catch (error) {
|
|
530
|
+
throw normalizeGovernedAnswerFailure(error, 'native_event_grammar', 'live_envelope_session',
|
|
531
|
+
'attestation');
|
|
532
|
+
}
|
|
533
|
+
try {
|
|
524
534
|
probeMcpCallCount = governedProfile.version === 'probe.governed-codex-profile/v2'
|
|
525
535
|
? governedProbeMcpCallCount(mcpServer?.getGovernedCallEvidence()) : 0;
|
|
526
536
|
} catch (error) {
|
|
527
|
-
throw normalizeGovernedAnswerFailure(error, 'native_event_grammar', 'live_envelope_session',
|
|
537
|
+
throw normalizeGovernedAnswerFailure(error, 'native_event_grammar', 'live_envelope_session',
|
|
538
|
+
'attestation', null, null, null, null, 'native_capability_aggregate');
|
|
539
|
+
}
|
|
540
|
+
try {
|
|
541
|
+
attestation = hasInvocationDigest
|
|
542
|
+
? externalBoundReceipt(internal, dispatch, invocationDigest, {
|
|
543
|
+
nativeCallCount: collected.capabilities.nativeTools.total,
|
|
544
|
+
probeMcpCallCount,
|
|
545
|
+
})
|
|
546
|
+
: externalReceipt(internal, {
|
|
547
|
+
nativeCallCount: collected.capabilities.nativeTools.total,
|
|
548
|
+
probeMcpCallCount,
|
|
549
|
+
});
|
|
550
|
+
} catch (error) {
|
|
551
|
+
throw normalizeGovernedAnswerFailure(error, 'native_event_grammar', 'live_envelope_session',
|
|
552
|
+
'attestation', null, null, null, null, 'invocation_attestation');
|
|
528
553
|
}
|
|
529
|
-
attestation = hasInvocationDigest
|
|
530
|
-
? externalBoundReceipt(internal, dispatch, invocationDigest, {
|
|
531
|
-
nativeCallCount: collected.capabilities.nativeTools.total,
|
|
532
|
-
probeMcpCallCount,
|
|
533
|
-
})
|
|
534
|
-
: externalReceipt(internal, {
|
|
535
|
-
nativeCallCount: collected.capabilities.nativeTools.total,
|
|
536
|
-
probeMcpCallCount,
|
|
537
|
-
});
|
|
538
554
|
session.setConversationId(collected.sessionEvent.params.msg.session_id);
|
|
539
555
|
}
|
|
540
556
|
|
|
@@ -576,7 +592,7 @@ export async function createCodexEngine(options = {}) {
|
|
|
576
592
|
};
|
|
577
593
|
|
|
578
594
|
} catch (error) {
|
|
579
|
-
if (governedProfile) error = normalizeGovernedAnswerFailure(error, '
|
|
595
|
+
if (governedProfile) error = normalizeGovernedAnswerFailure(error, 'internal_contract');
|
|
580
596
|
queryError = error;
|
|
581
597
|
if (debug) {
|
|
582
598
|
console.error('[DEBUG] Codex query error:', error);
|
|
@@ -589,7 +605,10 @@ export async function createCodexEngine(options = {}) {
|
|
|
589
605
|
if (opts.abortSignal && abortHandler) opts.abortSignal.removeEventListener('abort', abortHandler);
|
|
590
606
|
if (governedProfile) {
|
|
591
607
|
try { await cleanup(); }
|
|
592
|
-
catch (cleanupError) {
|
|
608
|
+
catch (cleanupError) {
|
|
609
|
+
if (!queryError) throw normalizeGovernedAnswerFailure(cleanupError, 'provider_engine', null, null,
|
|
610
|
+
null, null, null, 'close');
|
|
611
|
+
}
|
|
593
612
|
}
|
|
594
613
|
}
|
|
595
614
|
},
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const GOVERNED_ANSWER_FAILURE_STAGES = new Set([
|
|
2
|
-
'native_event_grammar', 'provider_engine', 'schema_result_validation', 'unknown',
|
|
2
|
+
'native_event_grammar', 'provider_engine', 'schema_result_validation', 'internal_contract', 'unknown',
|
|
3
3
|
]);
|
|
4
|
+
const GOVERNED_PROVIDER_ENGINE_FAILURE_BOUNDARIES = new Set(['acquire', 'query', 'close']);
|
|
4
5
|
const GOVERNED_NATIVE_EVENT_FAILURE_BOUNDARIES = new Set([
|
|
5
6
|
'raw_item_predicate', 'live_envelope_session',
|
|
6
7
|
]);
|
|
@@ -17,6 +18,7 @@ const GOVERNED_NATIVE_EVENT_FAILURE_ATTESTATION_PREDICATES = new Set([
|
|
|
17
18
|
'network',
|
|
18
19
|
'filesystem_shape', 'filesystem_type', 'entries', 'entry', 'access', 'path_shape',
|
|
19
20
|
'path_type', 'value_shape', 'kind', 'native_tool_evidence', 'internal_contract',
|
|
21
|
+
'invocation_attestation', 'native_capability_aggregate',
|
|
20
22
|
]);
|
|
21
23
|
const GOVERNED_SCHEMA_RESULT_VALIDATION_SUBREASONS = new Set([
|
|
22
24
|
'response_json', 'schema_definition', 'schema_mismatch', 'result_identity',
|
|
@@ -73,7 +75,8 @@ function governedAttestationPredicate(error) {
|
|
|
73
75
|
export class GovernedAnswerFailure extends Error {
|
|
74
76
|
constructor(stage, nativeEventFailureBoundary = null, nativeEventFailureSubreason = null,
|
|
75
77
|
nativeEventFailureCorrelationOperand = null, nativeEventFailureAttestationPredicate = null,
|
|
76
|
-
schemaResultValidationSubreason = null, schemaResultValidationKeyword = null
|
|
78
|
+
schemaResultValidationSubreason = null, schemaResultValidationKeyword = null,
|
|
79
|
+
providerEngineFailureBoundary = null) {
|
|
77
80
|
super();
|
|
78
81
|
delete this.stack;
|
|
79
82
|
const answerFailureStage = GOVERNED_ANSWER_FAILURE_STAGES.has(stage) ? stage : 'unknown';
|
|
@@ -82,6 +85,11 @@ export class GovernedAnswerFailure extends Error {
|
|
|
82
85
|
value: answerFailureStage,
|
|
83
86
|
enumerable: true,
|
|
84
87
|
});
|
|
88
|
+
if (answerFailureStage === 'provider_engine') Object.defineProperty(this, 'providerEngineFailureBoundary', {
|
|
89
|
+
value: GOVERNED_PROVIDER_ENGINE_FAILURE_BOUNDARIES.has(providerEngineFailureBoundary)
|
|
90
|
+
? providerEngineFailureBoundary : null,
|
|
91
|
+
enumerable: true,
|
|
92
|
+
});
|
|
85
93
|
if (answerFailureStage === 'native_event_grammar') Object.defineProperty(this, 'nativeEventFailureBoundary', {
|
|
86
94
|
value: GOVERNED_NATIVE_EVENT_FAILURE_BOUNDARIES.has(nativeEventFailureBoundary)
|
|
87
95
|
? nativeEventFailureBoundary : null,
|
|
@@ -134,19 +142,22 @@ export class GovernedAnswerFailure extends Error {
|
|
|
134
142
|
|
|
135
143
|
export function governedAnswerFailure(stage, nativeEventFailureBoundary = null, nativeEventFailureSubreason = null,
|
|
136
144
|
nativeEventFailureCorrelationOperand = null, nativeEventFailureAttestationPredicate = null,
|
|
137
|
-
schemaResultValidationSubreason = null, schemaResultValidationKeyword = null
|
|
145
|
+
schemaResultValidationSubreason = null, schemaResultValidationKeyword = null,
|
|
146
|
+
providerEngineFailureBoundary = null) {
|
|
138
147
|
return new GovernedAnswerFailure(stage, nativeEventFailureBoundary, nativeEventFailureSubreason,
|
|
139
148
|
nativeEventFailureCorrelationOperand, nativeEventFailureAttestationPredicate,
|
|
140
|
-
schemaResultValidationSubreason, schemaResultValidationKeyword);
|
|
149
|
+
schemaResultValidationSubreason, schemaResultValidationKeyword, providerEngineFailureBoundary);
|
|
141
150
|
}
|
|
142
151
|
|
|
143
152
|
export function normalizeGovernedAnswerFailure(error, fallback = 'unknown', nativeEventFailureBoundary = null,
|
|
144
153
|
nativeEventFailureSubreason = null, nativeEventFailureCorrelationOperand = null,
|
|
145
|
-
schemaResultValidationSubreason = null, schemaResultValidationKeyword = null
|
|
154
|
+
schemaResultValidationSubreason = null, schemaResultValidationKeyword = null,
|
|
155
|
+
providerEngineFailureBoundary = null, nativeEventFailureAttestationPredicate = null) {
|
|
146
156
|
return error instanceof GovernedAnswerFailure ? error
|
|
147
157
|
: governedAnswerFailure(fallback, nativeEventFailureBoundary, nativeEventFailureSubreason,
|
|
148
158
|
nativeEventFailureCorrelationOperand,
|
|
149
159
|
fallback === 'native_event_grammar' && nativeEventFailureBoundary === 'live_envelope_session' &&
|
|
150
|
-
nativeEventFailureSubreason === 'attestation'
|
|
151
|
-
|
|
160
|
+
nativeEventFailureSubreason === 'attestation'
|
|
161
|
+
? nativeEventFailureAttestationPredicate ?? governedAttestationPredicate(error) : null,
|
|
162
|
+
schemaResultValidationSubreason, schemaResultValidationKeyword, providerEngineFailureBoundary);
|
|
152
163
|
}
|
package/build/utils/provider.js
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import { createAnthropic } from '@ai-sdk/anthropic';
|
|
9
9
|
import { createOpenAI } from '@ai-sdk/openai';
|
|
10
|
+
import { createOpenAICompatible } from '@ai-sdk/openai-compatible';
|
|
10
11
|
import { createGoogleGenerativeAI } from '@ai-sdk/google';
|
|
11
12
|
import { createAmazonBedrock } from '@ai-sdk/amazon-bedrock';
|
|
12
13
|
|
|
@@ -31,10 +32,19 @@ export function createProviderInstance(config) {
|
|
|
31
32
|
});
|
|
32
33
|
|
|
33
34
|
case 'openai': {
|
|
35
|
+
if (config.baseURL) {
|
|
36
|
+
// Non-OpenAI endpoints (Fireworks, etc.) — use openai-compatible provider
|
|
37
|
+
// which correctly handles reasoning_content in streaming deltas
|
|
38
|
+
const provider = createOpenAICompatible({
|
|
39
|
+
name: 'openai-compatible',
|
|
40
|
+
baseURL: config.baseURL,
|
|
41
|
+
apiKey: config.apiKey,
|
|
42
|
+
});
|
|
43
|
+
return provider;
|
|
44
|
+
}
|
|
34
45
|
const openai = createOpenAI({
|
|
35
46
|
compatibility: 'strict',
|
|
36
47
|
apiKey: config.apiKey,
|
|
37
|
-
...(config.baseURL && { baseURL: config.baseURL })
|
|
38
48
|
});
|
|
39
49
|
const chatProvider = (modelId, settings) => openai.chat(modelId, settings);
|
|
40
50
|
chatProvider.chat = openai.chat.bind(openai);
|