@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
package/cjs/index.cjs
CHANGED
|
@@ -28791,7 +28791,7 @@ var init_dist5 = __esm({
|
|
|
28791
28791
|
return combineHeaders(await resolve(this.config.headers), headers);
|
|
28792
28792
|
}
|
|
28793
28793
|
async doGenerate(options) {
|
|
28794
|
-
var _a17, _b16, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
28794
|
+
var _a17, _b16, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
|
|
28795
28795
|
const {
|
|
28796
28796
|
command: args,
|
|
28797
28797
|
warnings,
|
|
@@ -28820,10 +28820,12 @@ var init_dist5 = __esm({
|
|
|
28820
28820
|
let isJsonResponseFromTool = false;
|
|
28821
28821
|
const jsonObjectTextExtractor = usesJsonInstruction ? new JsonObjectTextExtractor() : void 0;
|
|
28822
28822
|
for (const part of response.output.message.content) {
|
|
28823
|
-
|
|
28823
|
+
const citationText = (_b16 = (_a17 = part.citationsContent) == null ? void 0 : _a17.content) == null ? void 0 : _b16.map((generatedContent) => generatedContent.text).filter((text2) => text2 != null).join("");
|
|
28824
|
+
const text = (_c = part.text) != null ? _c : citationText ? citationText : void 0;
|
|
28825
|
+
if (text != null) {
|
|
28824
28826
|
content.push({
|
|
28825
28827
|
type: "text",
|
|
28826
|
-
text: (
|
|
28828
|
+
text: (_d = jsonObjectTextExtractor == null ? void 0 : jsonObjectTextExtractor.process(text)) != null ? _d : text
|
|
28827
28829
|
});
|
|
28828
28830
|
}
|
|
28829
28831
|
if (part.reasoningContent) {
|
|
@@ -28846,7 +28848,7 @@ var init_dist5 = __esm({
|
|
|
28846
28848
|
text: "",
|
|
28847
28849
|
providerMetadata: {
|
|
28848
28850
|
bedrock: {
|
|
28849
|
-
redactedData: (
|
|
28851
|
+
redactedData: (_e = part.reasoningContent.redactedReasoning.data) != null ? _e : ""
|
|
28850
28852
|
}
|
|
28851
28853
|
}
|
|
28852
28854
|
});
|
|
@@ -28872,17 +28874,17 @@ var init_dist5 = __esm({
|
|
|
28872
28874
|
});
|
|
28873
28875
|
} else {
|
|
28874
28876
|
const isMistral = isMistralModel(this.modelId);
|
|
28875
|
-
const rawToolCallId = (
|
|
28877
|
+
const rawToolCallId = (_g = (_f = part.toolUse) == null ? void 0 : _f.toolUseId) != null ? _g : this.config.generateId();
|
|
28876
28878
|
content.push({
|
|
28877
28879
|
type: "tool-call",
|
|
28878
28880
|
toolCallId: normalizeToolCallId(rawToolCallId, isMistral),
|
|
28879
|
-
toolName: (
|
|
28880
|
-
input: JSON.stringify((
|
|
28881
|
+
toolName: (_i = (_h = part.toolUse) == null ? void 0 : _h.name) != null ? _i : `tool-${this.config.generateId()}`,
|
|
28882
|
+
input: JSON.stringify((_k = (_j = part.toolUse) == null ? void 0 : _j.input) != null ? _k : {})
|
|
28881
28883
|
});
|
|
28882
28884
|
}
|
|
28883
28885
|
}
|
|
28884
28886
|
}
|
|
28885
|
-
const stopSequence = (
|
|
28887
|
+
const stopSequence = (_n = (_m = (_l = response.additionalModelResponseFields) == null ? void 0 : _l.delta) == null ? void 0 : _m.stop_sequence) != null ? _n : null;
|
|
28886
28888
|
const providerMetadata = response.trace || response.usage || response.performanceConfig || response.serviceTier || isJsonResponseFromTool || stopSequence ? {
|
|
28887
28889
|
bedrock: {
|
|
28888
28890
|
...response.trace && typeof response.trace === "object" ? { trace: response.trace } : {},
|
|
@@ -28892,7 +28894,7 @@ var init_dist5 = __esm({
|
|
|
28892
28894
|
...response.serviceTier && {
|
|
28893
28895
|
serviceTier: response.serviceTier
|
|
28894
28896
|
},
|
|
28895
|
-
...(((
|
|
28897
|
+
...(((_o = response.usage) == null ? void 0 : _o.cacheWriteInputTokens) != null || ((_p = response.usage) == null ? void 0 : _p.cacheDetails) != null) && {
|
|
28896
28898
|
usage: {
|
|
28897
28899
|
...response.usage.cacheWriteInputTokens != null && {
|
|
28898
28900
|
cacheWriteInputTokens: response.usage.cacheWriteInputTokens
|
|
@@ -28913,11 +28915,11 @@ var init_dist5 = __esm({
|
|
|
28913
28915
|
response.stopReason,
|
|
28914
28916
|
isJsonResponseFromTool
|
|
28915
28917
|
),
|
|
28916
|
-
raw: (
|
|
28918
|
+
raw: (_q = response.stopReason) != null ? _q : void 0
|
|
28917
28919
|
},
|
|
28918
28920
|
usage: convertBedrockUsage(response.usage),
|
|
28919
28921
|
response: {
|
|
28920
|
-
id: (
|
|
28922
|
+
id: (_r = responseHeaders == null ? void 0 : responseHeaders["x-amzn-requestid"]) != null ? _r : void 0,
|
|
28921
28923
|
timestamp: (responseHeaders == null ? void 0 : responseHeaders["date"]) != null ? new Date(responseHeaders["date"]) : void 0,
|
|
28922
28924
|
modelId: this.modelId,
|
|
28923
28925
|
headers: responseHeaders
|
|
@@ -29358,6 +29360,13 @@ var init_dist5 = __esm({
|
|
|
29358
29360
|
content: external_exports.array(
|
|
29359
29361
|
external_exports.object({
|
|
29360
29362
|
text: external_exports.string().nullish(),
|
|
29363
|
+
citationsContent: external_exports.object({
|
|
29364
|
+
content: external_exports.array(
|
|
29365
|
+
external_exports.object({
|
|
29366
|
+
text: external_exports.string().nullish()
|
|
29367
|
+
})
|
|
29368
|
+
).nullish()
|
|
29369
|
+
}).nullish(),
|
|
29361
29370
|
toolUse: BedrockToolUseSchema.nullish(),
|
|
29362
29371
|
reasoningContent: external_exports.union([
|
|
29363
29372
|
external_exports.object({
|
|
@@ -29820,7 +29829,7 @@ var init_dist5 = __esm({
|
|
|
29820
29829
|
details: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
|
|
29821
29830
|
preview: external_exports.unknown().optional()
|
|
29822
29831
|
});
|
|
29823
|
-
VERSION3 = true ? "4.0.
|
|
29832
|
+
VERSION3 = true ? "4.0.172" : "0.0.0-test";
|
|
29824
29833
|
bedrockRerankingResponseSchema = lazySchema(
|
|
29825
29834
|
() => zodSchema(
|
|
29826
29835
|
external_exports.object({
|
|
@@ -90810,6 +90819,7 @@ var require_utils2 = __commonJS({
|
|
|
90810
90819
|
"use strict";
|
|
90811
90820
|
var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
|
|
90812
90821
|
var isIPv42 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
|
|
90822
|
+
var isPort = RegExp.prototype.test.bind(/^\d*$/u);
|
|
90813
90823
|
var isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
|
|
90814
90824
|
var isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
|
|
90815
90825
|
var isPathCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u);
|
|
@@ -91275,8 +91285,12 @@ var require_utils2 = __commonJS({
|
|
|
91275
91285
|
uriTokens.push(host);
|
|
91276
91286
|
}
|
|
91277
91287
|
if (typeof component.port === "number" || typeof component.port === "string") {
|
|
91288
|
+
const port = String(component.port);
|
|
91289
|
+
if (!isPort(port)) {
|
|
91290
|
+
throw new TypeError("URI port is malformed.");
|
|
91291
|
+
}
|
|
91278
91292
|
uriTokens.push(":");
|
|
91279
|
-
uriTokens.push(
|
|
91293
|
+
uriTokens.push(port);
|
|
91280
91294
|
}
|
|
91281
91295
|
return uriTokens.length ? uriTokens.join("") : void 0;
|
|
91282
91296
|
}
|
|
@@ -91719,12 +91733,15 @@ var require_fast_uri = __commonJS({
|
|
|
91719
91733
|
}
|
|
91720
91734
|
return false;
|
|
91721
91735
|
}
|
|
91736
|
+
function isIPLiteral(host) {
|
|
91737
|
+
return host[0] === "[" && host[host.length - 1] === "]";
|
|
91738
|
+
}
|
|
91722
91739
|
function hasMalformedComponentPercentEncoding(matches) {
|
|
91723
91740
|
const host = matches[4];
|
|
91724
|
-
return hasMalformedPercentEncoding(matches[3]) || host !== void 0 && !(host
|
|
91741
|
+
return hasMalformedPercentEncoding(matches[3]) || host !== void 0 && !isIPLiteral(host) && hasMalformedPercentEncoding(host) || hasMalformedPercentEncoding(matches[6]) || hasMalformedPercentEncoding(matches[7]) || hasMalformedPercentEncoding(matches[8]);
|
|
91725
91742
|
}
|
|
91726
91743
|
function canonicalizeHost(parsed, options, schemeHandler, isIP) {
|
|
91727
|
-
if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && parsed.host
|
|
91744
|
+
if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
|
|
91728
91745
|
try {
|
|
91729
91746
|
parsed.host = new URL("http://" + parsed.host).hostname;
|
|
91730
91747
|
} catch (e) {
|
|
@@ -91811,10 +91828,11 @@ var require_fast_uri = __commonJS({
|
|
|
91811
91828
|
if (parsed.host) {
|
|
91812
91829
|
const ipv4result = isIPv42(parsed.host);
|
|
91813
91830
|
if (ipv4result === false) {
|
|
91814
|
-
const bracketedIPLiteral = parsed.host
|
|
91831
|
+
const bracketedIPLiteral = isIPLiteral(parsed.host);
|
|
91832
|
+
const hasIPLiteralBracket = parsed.host.indexOf("[") !== -1 || parsed.host.indexOf("]") !== -1;
|
|
91815
91833
|
const ipv6result = normalizeIPv6(parsed.host);
|
|
91816
91834
|
isIP = ipv6result.isIPV6 || ipv6result.isIPVFuture === true;
|
|
91817
|
-
malformedIPLiteral =
|
|
91835
|
+
malformedIPLiteral = hasIPLiteralBracket && (!bracketedIPLiteral || ipv6result.error === true);
|
|
91818
91836
|
parsed.host = isIP ? ipv6result.host : ipv6result.host.toLowerCase();
|
|
91819
91837
|
if (malformedIPLiteral) {
|
|
91820
91838
|
parsed.error = parsed.error || "URI host is malformed.";
|
|
@@ -91837,7 +91855,9 @@ var require_fast_uri = __commonJS({
|
|
|
91837
91855
|
parsed.error = parsed.error || "URI is not a " + options.reference + " reference.";
|
|
91838
91856
|
}
|
|
91839
91857
|
const schemeHandler = getSchemeHandler(options.scheme || parsed.scheme);
|
|
91840
|
-
|
|
91858
|
+
if (!malformedIPLiteral) {
|
|
91859
|
+
malformedHost = canonicalizeHost(parsed, options, schemeHandler, isIP);
|
|
91860
|
+
}
|
|
91841
91861
|
if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
|
|
91842
91862
|
if (uri.indexOf("%") !== -1) {
|
|
91843
91863
|
if (parsed.host !== void 0 && !malformedIPLiteral) {
|
|
@@ -106808,7 +106828,7 @@ var init_governed_codex_profile = __esm({
|
|
|
106808
106828
|
function governedAttestationPredicate(error40) {
|
|
106809
106829
|
return error40 instanceof TypeError ? GOVERNED_ATTESTATION_ERROR_PREDICATES.get(error40.message) ?? null : null;
|
|
106810
106830
|
}
|
|
106811
|
-
function governedAnswerFailure(stage, nativeEventFailureBoundary = null, nativeEventFailureSubreason = null, nativeEventFailureCorrelationOperand = null, nativeEventFailureAttestationPredicate = null, schemaResultValidationSubreason = null, schemaResultValidationKeyword = null) {
|
|
106831
|
+
function governedAnswerFailure(stage, nativeEventFailureBoundary = null, nativeEventFailureSubreason = null, nativeEventFailureCorrelationOperand = null, nativeEventFailureAttestationPredicate = null, schemaResultValidationSubreason = null, schemaResultValidationKeyword = null, providerEngineFailureBoundary = null) {
|
|
106812
106832
|
return new GovernedAnswerFailure(
|
|
106813
106833
|
stage,
|
|
106814
106834
|
nativeEventFailureBoundary,
|
|
@@ -106816,21 +106836,23 @@ function governedAnswerFailure(stage, nativeEventFailureBoundary = null, nativeE
|
|
|
106816
106836
|
nativeEventFailureCorrelationOperand,
|
|
106817
106837
|
nativeEventFailureAttestationPredicate,
|
|
106818
106838
|
schemaResultValidationSubreason,
|
|
106819
|
-
schemaResultValidationKeyword
|
|
106839
|
+
schemaResultValidationKeyword,
|
|
106840
|
+
providerEngineFailureBoundary
|
|
106820
106841
|
);
|
|
106821
106842
|
}
|
|
106822
|
-
function normalizeGovernedAnswerFailure(error40, fallback = "unknown", nativeEventFailureBoundary = null, nativeEventFailureSubreason = null, nativeEventFailureCorrelationOperand = null, schemaResultValidationSubreason = null, schemaResultValidationKeyword = null) {
|
|
106843
|
+
function normalizeGovernedAnswerFailure(error40, fallback = "unknown", nativeEventFailureBoundary = null, nativeEventFailureSubreason = null, nativeEventFailureCorrelationOperand = null, schemaResultValidationSubreason = null, schemaResultValidationKeyword = null, providerEngineFailureBoundary = null, nativeEventFailureAttestationPredicate = null) {
|
|
106823
106844
|
return error40 instanceof GovernedAnswerFailure ? error40 : governedAnswerFailure(
|
|
106824
106845
|
fallback,
|
|
106825
106846
|
nativeEventFailureBoundary,
|
|
106826
106847
|
nativeEventFailureSubreason,
|
|
106827
106848
|
nativeEventFailureCorrelationOperand,
|
|
106828
|
-
fallback === "native_event_grammar" && nativeEventFailureBoundary === "live_envelope_session" && nativeEventFailureSubreason === "attestation" ? governedAttestationPredicate(error40) : null,
|
|
106849
|
+
fallback === "native_event_grammar" && nativeEventFailureBoundary === "live_envelope_session" && nativeEventFailureSubreason === "attestation" ? nativeEventFailureAttestationPredicate ?? governedAttestationPredicate(error40) : null,
|
|
106829
106850
|
schemaResultValidationSubreason,
|
|
106830
|
-
schemaResultValidationKeyword
|
|
106851
|
+
schemaResultValidationKeyword,
|
|
106852
|
+
providerEngineFailureBoundary
|
|
106831
106853
|
);
|
|
106832
106854
|
}
|
|
106833
|
-
var GOVERNED_ANSWER_FAILURE_STAGES, GOVERNED_NATIVE_EVENT_FAILURE_BOUNDARIES, GOVERNED_NATIVE_EVENT_FAILURE_SUBREASONS, GOVERNED_NATIVE_EVENT_FAILURE_CORRELATION_OPERANDS, GOVERNED_NATIVE_EVENT_FAILURE_ATTESTATION_PREDICATES, GOVERNED_SCHEMA_RESULT_VALIDATION_SUBREASONS, GOVERNED_SCHEMA_RESULT_VALIDATION_KEYWORDS, GOVERNED_ATTESTATION_ERROR_PREDICATES, GovernedAnswerFailure;
|
|
106855
|
+
var GOVERNED_ANSWER_FAILURE_STAGES, GOVERNED_PROVIDER_ENGINE_FAILURE_BOUNDARIES, GOVERNED_NATIVE_EVENT_FAILURE_BOUNDARIES, GOVERNED_NATIVE_EVENT_FAILURE_SUBREASONS, GOVERNED_NATIVE_EVENT_FAILURE_CORRELATION_OPERANDS, GOVERNED_NATIVE_EVENT_FAILURE_ATTESTATION_PREDICATES, GOVERNED_SCHEMA_RESULT_VALIDATION_SUBREASONS, GOVERNED_SCHEMA_RESULT_VALIDATION_KEYWORDS, GOVERNED_ATTESTATION_ERROR_PREDICATES, GovernedAnswerFailure;
|
|
106834
106856
|
var init_governed_answer_failure = __esm({
|
|
106835
106857
|
"src/agent/engines/governed-answer-failure.js"() {
|
|
106836
106858
|
"use strict";
|
|
@@ -106838,8 +106860,10 @@ var init_governed_answer_failure = __esm({
|
|
|
106838
106860
|
"native_event_grammar",
|
|
106839
106861
|
"provider_engine",
|
|
106840
106862
|
"schema_result_validation",
|
|
106863
|
+
"internal_contract",
|
|
106841
106864
|
"unknown"
|
|
106842
106865
|
]);
|
|
106866
|
+
GOVERNED_PROVIDER_ENGINE_FAILURE_BOUNDARIES = /* @__PURE__ */ new Set(["acquire", "query", "close"]);
|
|
106843
106867
|
GOVERNED_NATIVE_EVENT_FAILURE_BOUNDARIES = /* @__PURE__ */ new Set([
|
|
106844
106868
|
"raw_item_predicate",
|
|
106845
106869
|
"live_envelope_session"
|
|
@@ -106883,7 +106907,9 @@ var init_governed_answer_failure = __esm({
|
|
|
106883
106907
|
"value_shape",
|
|
106884
106908
|
"kind",
|
|
106885
106909
|
"native_tool_evidence",
|
|
106886
|
-
"internal_contract"
|
|
106910
|
+
"internal_contract",
|
|
106911
|
+
"invocation_attestation",
|
|
106912
|
+
"native_capability_aggregate"
|
|
106887
106913
|
]);
|
|
106888
106914
|
GOVERNED_SCHEMA_RESULT_VALIDATION_SUBREASONS = /* @__PURE__ */ new Set([
|
|
106889
106915
|
"response_json",
|
|
@@ -106966,7 +106992,7 @@ var init_governed_answer_failure = __esm({
|
|
|
106966
106992
|
["Invalid profile capability overlap", "internal_contract"]
|
|
106967
106993
|
]);
|
|
106968
106994
|
GovernedAnswerFailure = class extends Error {
|
|
106969
|
-
constructor(stage, nativeEventFailureBoundary = null, nativeEventFailureSubreason = null, nativeEventFailureCorrelationOperand = null, nativeEventFailureAttestationPredicate = null, schemaResultValidationSubreason = null, schemaResultValidationKeyword = null) {
|
|
106995
|
+
constructor(stage, nativeEventFailureBoundary = null, nativeEventFailureSubreason = null, nativeEventFailureCorrelationOperand = null, nativeEventFailureAttestationPredicate = null, schemaResultValidationSubreason = null, schemaResultValidationKeyword = null, providerEngineFailureBoundary = null) {
|
|
106970
106996
|
super();
|
|
106971
106997
|
delete this.stack;
|
|
106972
106998
|
const answerFailureStage = GOVERNED_ANSWER_FAILURE_STAGES.has(stage) ? stage : "unknown";
|
|
@@ -106975,6 +107001,10 @@ var init_governed_answer_failure = __esm({
|
|
|
106975
107001
|
value: answerFailureStage,
|
|
106976
107002
|
enumerable: true
|
|
106977
107003
|
});
|
|
107004
|
+
if (answerFailureStage === "provider_engine") Object.defineProperty(this, "providerEngineFailureBoundary", {
|
|
107005
|
+
value: GOVERNED_PROVIDER_ENGINE_FAILURE_BOUNDARIES.has(providerEngineFailureBoundary) ? providerEngineFailureBoundary : null,
|
|
107006
|
+
enumerable: true
|
|
107007
|
+
});
|
|
106978
107008
|
if (answerFailureStage === "native_event_grammar") Object.defineProperty(this, "nativeEventFailureBoundary", {
|
|
106979
107009
|
value: GOVERNED_NATIVE_EVENT_FAILURE_BOUNDARIES.has(nativeEventFailureBoundary) ? nativeEventFailureBoundary : null,
|
|
106980
107010
|
enumerable: true
|
|
@@ -107985,7 +108015,9 @@ async function createCodexEngine(options = {}) {
|
|
|
107985
108015
|
}
|
|
107986
108016
|
});
|
|
107987
108017
|
if (opts.abortSignal) {
|
|
107988
|
-
if (opts.abortSignal.aborted)
|
|
108018
|
+
if (opts.abortSignal.aborted) {
|
|
108019
|
+
throw governedProfile ? governedAnswerFailure("provider_engine", null, null, null, null, null, null, "query") : new Error("Codex query cancelled");
|
|
108020
|
+
}
|
|
107989
108021
|
abortHandler = () => {
|
|
107990
108022
|
void cleanup(new Error("Codex query cancelled")).catch(() => {
|
|
107991
108023
|
});
|
|
@@ -108018,7 +108050,16 @@ async function createCodexEngine(options = {}) {
|
|
|
108018
108050
|
try {
|
|
108019
108051
|
result = await resultPromise;
|
|
108020
108052
|
} catch (error40) {
|
|
108021
|
-
throw governedProfile ?
|
|
108053
|
+
throw governedProfile ? evidenceFailure || normalizeGovernedAnswerFailure(
|
|
108054
|
+
error40,
|
|
108055
|
+
"provider_engine",
|
|
108056
|
+
null,
|
|
108057
|
+
null,
|
|
108058
|
+
null,
|
|
108059
|
+
null,
|
|
108060
|
+
null,
|
|
108061
|
+
"query"
|
|
108062
|
+
) : error40;
|
|
108022
108063
|
}
|
|
108023
108064
|
eventHandlers.delete(reqId);
|
|
108024
108065
|
governedEvidenceHandlers.delete(reqId);
|
|
@@ -108036,17 +108077,50 @@ async function createCodexEngine(options = {}) {
|
|
|
108036
108077
|
profile: governedProfile,
|
|
108037
108078
|
events: governedProfile.version === "probe.governed-codex-profile/v2" ? [collected.sessionEvent, collected.capabilities.nativeTools] : [collected.sessionEvent]
|
|
108038
108079
|
});
|
|
108080
|
+
} catch (error40) {
|
|
108081
|
+
throw normalizeGovernedAnswerFailure(
|
|
108082
|
+
error40,
|
|
108083
|
+
"native_event_grammar",
|
|
108084
|
+
"live_envelope_session",
|
|
108085
|
+
"attestation"
|
|
108086
|
+
);
|
|
108087
|
+
}
|
|
108088
|
+
try {
|
|
108039
108089
|
probeMcpCallCount = governedProfile.version === "probe.governed-codex-profile/v2" ? governedProbeMcpCallCount(mcpServer?.getGovernedCallEvidence()) : 0;
|
|
108040
108090
|
} catch (error40) {
|
|
108041
|
-
throw normalizeGovernedAnswerFailure(
|
|
108042
|
-
|
|
108043
|
-
|
|
108044
|
-
|
|
108045
|
-
|
|
108046
|
-
|
|
108047
|
-
|
|
108048
|
-
|
|
108049
|
-
|
|
108091
|
+
throw normalizeGovernedAnswerFailure(
|
|
108092
|
+
error40,
|
|
108093
|
+
"native_event_grammar",
|
|
108094
|
+
"live_envelope_session",
|
|
108095
|
+
"attestation",
|
|
108096
|
+
null,
|
|
108097
|
+
null,
|
|
108098
|
+
null,
|
|
108099
|
+
null,
|
|
108100
|
+
"native_capability_aggregate"
|
|
108101
|
+
);
|
|
108102
|
+
}
|
|
108103
|
+
try {
|
|
108104
|
+
attestation = hasInvocationDigest ? externalBoundReceipt(internal, dispatch, invocationDigest, {
|
|
108105
|
+
nativeCallCount: collected.capabilities.nativeTools.total,
|
|
108106
|
+
probeMcpCallCount
|
|
108107
|
+
}) : externalReceipt(internal, {
|
|
108108
|
+
nativeCallCount: collected.capabilities.nativeTools.total,
|
|
108109
|
+
probeMcpCallCount
|
|
108110
|
+
});
|
|
108111
|
+
} catch (error40) {
|
|
108112
|
+
throw normalizeGovernedAnswerFailure(
|
|
108113
|
+
error40,
|
|
108114
|
+
"native_event_grammar",
|
|
108115
|
+
"live_envelope_session",
|
|
108116
|
+
"attestation",
|
|
108117
|
+
null,
|
|
108118
|
+
null,
|
|
108119
|
+
null,
|
|
108120
|
+
null,
|
|
108121
|
+
"invocation_attestation"
|
|
108122
|
+
);
|
|
108123
|
+
}
|
|
108050
108124
|
session.setConversationId(collected.sessionEvent.params.msg.session_id);
|
|
108051
108125
|
}
|
|
108052
108126
|
if (result && result.content && Array.isArray(result.content)) {
|
|
@@ -108083,7 +108157,7 @@ async function createCodexEngine(options = {}) {
|
|
|
108083
108157
|
}
|
|
108084
108158
|
};
|
|
108085
108159
|
} catch (error40) {
|
|
108086
|
-
if (governedProfile) error40 = normalizeGovernedAnswerFailure(error40, "
|
|
108160
|
+
if (governedProfile) error40 = normalizeGovernedAnswerFailure(error40, "internal_contract");
|
|
108087
108161
|
queryError = error40;
|
|
108088
108162
|
if (debug) {
|
|
108089
108163
|
console.error("[DEBUG] Codex query error:", error40);
|
|
@@ -108098,7 +108172,16 @@ async function createCodexEngine(options = {}) {
|
|
|
108098
108172
|
try {
|
|
108099
108173
|
await cleanup();
|
|
108100
108174
|
} catch (cleanupError) {
|
|
108101
|
-
if (!queryError) throw
|
|
108175
|
+
if (!queryError) throw normalizeGovernedAnswerFailure(
|
|
108176
|
+
cleanupError,
|
|
108177
|
+
"provider_engine",
|
|
108178
|
+
null,
|
|
108179
|
+
null,
|
|
108180
|
+
null,
|
|
108181
|
+
null,
|
|
108182
|
+
null,
|
|
108183
|
+
"close"
|
|
108184
|
+
);
|
|
108102
108185
|
}
|
|
108103
108186
|
}
|
|
108104
108187
|
}
|
|
@@ -110202,7 +110285,18 @@ var init_ProbeAgent = __esm({
|
|
|
110202
110285
|
}
|
|
110203
110286
|
return this.engine;
|
|
110204
110287
|
} catch (error40) {
|
|
110205
|
-
if (this.governedCodexProfile)
|
|
110288
|
+
if (this.governedCodexProfile) {
|
|
110289
|
+
throw normalizeGovernedAnswerFailure(
|
|
110290
|
+
error40,
|
|
110291
|
+
"provider_engine",
|
|
110292
|
+
null,
|
|
110293
|
+
null,
|
|
110294
|
+
null,
|
|
110295
|
+
null,
|
|
110296
|
+
null,
|
|
110297
|
+
"acquire"
|
|
110298
|
+
);
|
|
110299
|
+
}
|
|
110206
110300
|
console.warn("[WARNING] Failed to load Codex CLI engine:", error40.message);
|
|
110207
110301
|
console.warn("[WARNING] Falling back to Vercel AI SDK");
|
|
110208
110302
|
this.clientApiProvider = null;
|
|
@@ -111073,38 +111167,99 @@ You are working with a workspace. Available paths: ${workspaceDesc}
|
|
|
111073
111167
|
try {
|
|
111074
111168
|
try {
|
|
111075
111169
|
engine = await this.getEngine();
|
|
111076
|
-
} catch {
|
|
111077
|
-
throw
|
|
111170
|
+
} catch (error40) {
|
|
111171
|
+
throw normalizeGovernedAnswerFailure(
|
|
111172
|
+
error40,
|
|
111173
|
+
"provider_engine",
|
|
111174
|
+
null,
|
|
111175
|
+
null,
|
|
111176
|
+
null,
|
|
111177
|
+
null,
|
|
111178
|
+
null,
|
|
111179
|
+
"acquire"
|
|
111180
|
+
);
|
|
111078
111181
|
}
|
|
111079
|
-
if (!engine?.query) throw governedAnswerFailure("
|
|
111182
|
+
if (!engine?.query) throw governedAnswerFailure("internal_contract");
|
|
111080
111183
|
const candidateChunks = [];
|
|
111081
111184
|
let runtimeAttestation;
|
|
111082
111185
|
let attestationCount = 0;
|
|
111083
111186
|
let nativeToolBatch;
|
|
111084
111187
|
let nativeToolBatchCount = 0;
|
|
111085
111188
|
const queryOptions = hasInvocationDigest ? { abortSignal: this._abortController.signal, invocationDigest } : { abortSignal: this._abortController.signal };
|
|
111086
|
-
|
|
111087
|
-
|
|
111088
|
-
|
|
111089
|
-
|
|
111090
|
-
|
|
111091
|
-
|
|
111092
|
-
|
|
111093
|
-
|
|
111094
|
-
|
|
111189
|
+
try {
|
|
111190
|
+
for await (const chunk of engine.query(prompt, queryOptions)) {
|
|
111191
|
+
if (chunk.type === "text" && chunk.content) candidateChunks.push(chunk.content);
|
|
111192
|
+
else if (chunk.type === "metadata" && chunk.data?.attestation) {
|
|
111193
|
+
runtimeAttestation = chunk.data.attestation;
|
|
111194
|
+
attestationCount++;
|
|
111195
|
+
} else if (chunk.type === "toolBatch") {
|
|
111196
|
+
nativeToolBatch = chunk;
|
|
111197
|
+
nativeToolBatchCount++;
|
|
111198
|
+
} else if (chunk.type === "error") {
|
|
111199
|
+
throw normalizeGovernedAnswerFailure(
|
|
111200
|
+
chunk.error,
|
|
111201
|
+
"provider_engine",
|
|
111202
|
+
null,
|
|
111203
|
+
null,
|
|
111204
|
+
null,
|
|
111205
|
+
null,
|
|
111206
|
+
null,
|
|
111207
|
+
"query"
|
|
111208
|
+
);
|
|
111209
|
+
}
|
|
111210
|
+
}
|
|
111211
|
+
} catch (error40) {
|
|
111212
|
+
throw normalizeGovernedAnswerFailure(
|
|
111213
|
+
error40,
|
|
111214
|
+
"provider_engine",
|
|
111215
|
+
null,
|
|
111216
|
+
null,
|
|
111217
|
+
null,
|
|
111218
|
+
null,
|
|
111219
|
+
null,
|
|
111220
|
+
"query"
|
|
111221
|
+
);
|
|
111095
111222
|
}
|
|
111096
111223
|
if (hasInvocationDigest) {
|
|
111097
111224
|
const expectedAttestation = this.governedCodexProfile?.version === "probe.governed-codex-profile/v2" ? "probe.governed-codex-attestation/v3" : "probe.governed-codex-attestation/v2";
|
|
111098
111225
|
if (attestationCount !== 1 || runtimeAttestation?.version !== expectedAttestation || runtimeAttestation?.executionContext?.source !== "caller" || runtimeAttestation?.executionContext?.invocationDigest !== invocationDigest) {
|
|
111099
|
-
throw
|
|
111226
|
+
throw governedAnswerFailure(
|
|
111227
|
+
"native_event_grammar",
|
|
111228
|
+
"live_envelope_session",
|
|
111229
|
+
"attestation",
|
|
111230
|
+
null,
|
|
111231
|
+
"invocation_attestation"
|
|
111232
|
+
);
|
|
111100
111233
|
}
|
|
111101
|
-
} else if (attestationCount !== 1)
|
|
111234
|
+
} else if (attestationCount !== 1) {
|
|
111235
|
+
throw governedAnswerFailure(
|
|
111236
|
+
"native_event_grammar",
|
|
111237
|
+
"live_envelope_session",
|
|
111238
|
+
"attestation",
|
|
111239
|
+
null,
|
|
111240
|
+
"invocation_attestation"
|
|
111241
|
+
);
|
|
111242
|
+
}
|
|
111102
111243
|
if (this.governedCodexProfile?.version === "probe.governed-codex-profile/v2") {
|
|
111103
111244
|
if (nativeToolBatchCount !== 1 || !Number.isSafeInteger(nativeToolBatch?.total) || !Array.isArray(nativeToolBatch?.tools) || nativeToolBatch.total !== runtimeAttestation?.observed?.nativeTools?.total || JSON.stringify(nativeToolBatch.tools) !== JSON.stringify(runtimeAttestation?.observed?.nativeTools?.tools)) {
|
|
111104
|
-
throw
|
|
111245
|
+
throw governedAnswerFailure(
|
|
111246
|
+
"native_event_grammar",
|
|
111247
|
+
"live_envelope_session",
|
|
111248
|
+
"attestation",
|
|
111249
|
+
null,
|
|
111250
|
+
"native_capability_aggregate"
|
|
111251
|
+
);
|
|
111105
111252
|
}
|
|
111106
111253
|
for (const toolEvent of nativeToolBatch.tools) this.events.emit("toolCall", toolEvent);
|
|
111107
|
-
} else if (nativeToolBatchCount !== 0)
|
|
111254
|
+
} else if (nativeToolBatchCount !== 0) {
|
|
111255
|
+
throw governedAnswerFailure(
|
|
111256
|
+
"native_event_grammar",
|
|
111257
|
+
"live_envelope_session",
|
|
111258
|
+
"attestation",
|
|
111259
|
+
null,
|
|
111260
|
+
"native_capability_aggregate"
|
|
111261
|
+
);
|
|
111262
|
+
}
|
|
111108
111263
|
const validation = validateJsonResponse(candidateChunks.join(""), { debug: this.debug, schema });
|
|
111109
111264
|
if (!validation.isValid) throw governedSchemaResultValidationFailure(validation);
|
|
111110
111265
|
if (hasResultIdentity) {
|
|
@@ -111120,14 +111275,23 @@ You are working with a workspace. Available paths: ${workspaceDesc}
|
|
|
111120
111275
|
}
|
|
111121
111276
|
return { data: validation.parsed, runtimeAttestation };
|
|
111122
111277
|
} catch (error40) {
|
|
111123
|
-
answerFailure = normalizeGovernedAnswerFailure(error40, "
|
|
111278
|
+
answerFailure = normalizeGovernedAnswerFailure(error40, "internal_contract");
|
|
111124
111279
|
throw answerFailure;
|
|
111125
111280
|
} finally {
|
|
111126
111281
|
if (engine) {
|
|
111127
111282
|
try {
|
|
111128
111283
|
await engine.close();
|
|
111129
|
-
} catch {
|
|
111130
|
-
if (!answerFailure) throw
|
|
111284
|
+
} catch (error40) {
|
|
111285
|
+
if (!answerFailure) throw normalizeGovernedAnswerFailure(
|
|
111286
|
+
error40,
|
|
111287
|
+
"provider_engine",
|
|
111288
|
+
null,
|
|
111289
|
+
null,
|
|
111290
|
+
null,
|
|
111291
|
+
null,
|
|
111292
|
+
null,
|
|
111293
|
+
"close"
|
|
111294
|
+
);
|
|
111131
111295
|
}
|
|
111132
111296
|
}
|
|
111133
111297
|
}
|
package/package.json
CHANGED
package/src/agent/ProbeAgent.js
CHANGED
|
@@ -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
|
}
|