@probelabs/probe 0.6.0-rc335 → 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-rc335-aarch64-apple-darwin.tar.gz → probe-v0.6.0-rc336-aarch64-apple-darwin.tar.gz} +0 -0
- package/bin/binaries/{probe-v0.6.0-rc335-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-rc335-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-rc335-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-rc335-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/cjs/agent/ProbeAgent.cjs +223 -59
- package/cjs/index.cjs +223 -59
- package/package.json +1 -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
|
@@ -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
|
}
|