@probelabs/probe 0.6.0-rc335 → 0.6.0-rc337
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-rc337-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-rc337-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-rc337-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-rc337-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-rc337-x86_64-unknown-linux-musl.tar.gz} +0 -0
- package/build/agent/ProbeAgent.js +44 -20
- package/build/agent/engines/codex.js +33 -14
- package/build/agent/engines/governed-answer-failure.js +18 -7
- package/cjs/agent/ProbeAgent.cjs +224 -61
- package/cjs/index.cjs +224 -61
- package/package.json +1 -1
- package/src/agent/ProbeAgent.js +44 -20
- package/src/agent/engines/codex.js +33 -14
- package/src/agent/engines/governed-answer-failure.js +18 -7
package/cjs/agent/ProbeAgent.cjs
CHANGED
|
@@ -26535,7 +26535,7 @@ var init_dist5 = __esm({
|
|
|
26535
26535
|
return combineHeaders(await resolve(this.config.headers), headers);
|
|
26536
26536
|
}
|
|
26537
26537
|
async doGenerate(options) {
|
|
26538
|
-
var _a17, _b16, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
26538
|
+
var _a17, _b16, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
|
|
26539
26539
|
const {
|
|
26540
26540
|
command: args,
|
|
26541
26541
|
warnings,
|
|
@@ -26564,10 +26564,12 @@ var init_dist5 = __esm({
|
|
|
26564
26564
|
let isJsonResponseFromTool = false;
|
|
26565
26565
|
const jsonObjectTextExtractor = usesJsonInstruction ? new JsonObjectTextExtractor() : void 0;
|
|
26566
26566
|
for (const part of response.output.message.content) {
|
|
26567
|
-
|
|
26567
|
+
const citationText = (_b16 = (_a17 = part.citationsContent) == null ? void 0 : _a17.content) == null ? void 0 : _b16.map((generatedContent) => generatedContent.text).filter((text2) => text2 != null).join("");
|
|
26568
|
+
const text = (_c = part.text) != null ? _c : citationText ? citationText : void 0;
|
|
26569
|
+
if (text != null) {
|
|
26568
26570
|
content.push({
|
|
26569
26571
|
type: "text",
|
|
26570
|
-
text: (
|
|
26572
|
+
text: (_d = jsonObjectTextExtractor == null ? void 0 : jsonObjectTextExtractor.process(text)) != null ? _d : text
|
|
26571
26573
|
});
|
|
26572
26574
|
}
|
|
26573
26575
|
if (part.reasoningContent) {
|
|
@@ -26590,7 +26592,7 @@ var init_dist5 = __esm({
|
|
|
26590
26592
|
text: "",
|
|
26591
26593
|
providerMetadata: {
|
|
26592
26594
|
bedrock: {
|
|
26593
|
-
redactedData: (
|
|
26595
|
+
redactedData: (_e = part.reasoningContent.redactedReasoning.data) != null ? _e : ""
|
|
26594
26596
|
}
|
|
26595
26597
|
}
|
|
26596
26598
|
});
|
|
@@ -26616,17 +26618,17 @@ var init_dist5 = __esm({
|
|
|
26616
26618
|
});
|
|
26617
26619
|
} else {
|
|
26618
26620
|
const isMistral = isMistralModel(this.modelId);
|
|
26619
|
-
const rawToolCallId = (
|
|
26621
|
+
const rawToolCallId = (_g = (_f = part.toolUse) == null ? void 0 : _f.toolUseId) != null ? _g : this.config.generateId();
|
|
26620
26622
|
content.push({
|
|
26621
26623
|
type: "tool-call",
|
|
26622
26624
|
toolCallId: normalizeToolCallId(rawToolCallId, isMistral),
|
|
26623
|
-
toolName: (
|
|
26624
|
-
input: JSON.stringify((
|
|
26625
|
+
toolName: (_i = (_h = part.toolUse) == null ? void 0 : _h.name) != null ? _i : `tool-${this.config.generateId()}`,
|
|
26626
|
+
input: JSON.stringify((_k = (_j = part.toolUse) == null ? void 0 : _j.input) != null ? _k : {})
|
|
26625
26627
|
});
|
|
26626
26628
|
}
|
|
26627
26629
|
}
|
|
26628
26630
|
}
|
|
26629
|
-
const stopSequence = (
|
|
26631
|
+
const stopSequence = (_n = (_m = (_l = response.additionalModelResponseFields) == null ? void 0 : _l.delta) == null ? void 0 : _m.stop_sequence) != null ? _n : null;
|
|
26630
26632
|
const providerMetadata = response.trace || response.usage || response.performanceConfig || response.serviceTier || isJsonResponseFromTool || stopSequence ? {
|
|
26631
26633
|
bedrock: {
|
|
26632
26634
|
...response.trace && typeof response.trace === "object" ? { trace: response.trace } : {},
|
|
@@ -26636,7 +26638,7 @@ var init_dist5 = __esm({
|
|
|
26636
26638
|
...response.serviceTier && {
|
|
26637
26639
|
serviceTier: response.serviceTier
|
|
26638
26640
|
},
|
|
26639
|
-
...(((
|
|
26641
|
+
...(((_o = response.usage) == null ? void 0 : _o.cacheWriteInputTokens) != null || ((_p = response.usage) == null ? void 0 : _p.cacheDetails) != null) && {
|
|
26640
26642
|
usage: {
|
|
26641
26643
|
...response.usage.cacheWriteInputTokens != null && {
|
|
26642
26644
|
cacheWriteInputTokens: response.usage.cacheWriteInputTokens
|
|
@@ -26657,11 +26659,11 @@ var init_dist5 = __esm({
|
|
|
26657
26659
|
response.stopReason,
|
|
26658
26660
|
isJsonResponseFromTool
|
|
26659
26661
|
),
|
|
26660
|
-
raw: (
|
|
26662
|
+
raw: (_q = response.stopReason) != null ? _q : void 0
|
|
26661
26663
|
},
|
|
26662
26664
|
usage: convertBedrockUsage(response.usage),
|
|
26663
26665
|
response: {
|
|
26664
|
-
id: (
|
|
26666
|
+
id: (_r = responseHeaders == null ? void 0 : responseHeaders["x-amzn-requestid"]) != null ? _r : void 0,
|
|
26665
26667
|
timestamp: (responseHeaders == null ? void 0 : responseHeaders["date"]) != null ? new Date(responseHeaders["date"]) : void 0,
|
|
26666
26668
|
modelId: this.modelId,
|
|
26667
26669
|
headers: responseHeaders
|
|
@@ -27102,6 +27104,13 @@ var init_dist5 = __esm({
|
|
|
27102
27104
|
content: external_exports.array(
|
|
27103
27105
|
external_exports.object({
|
|
27104
27106
|
text: external_exports.string().nullish(),
|
|
27107
|
+
citationsContent: external_exports.object({
|
|
27108
|
+
content: external_exports.array(
|
|
27109
|
+
external_exports.object({
|
|
27110
|
+
text: external_exports.string().nullish()
|
|
27111
|
+
})
|
|
27112
|
+
).nullish()
|
|
27113
|
+
}).nullish(),
|
|
27105
27114
|
toolUse: BedrockToolUseSchema.nullish(),
|
|
27106
27115
|
reasoningContent: external_exports.union([
|
|
27107
27116
|
external_exports.object({
|
|
@@ -27564,7 +27573,7 @@ var init_dist5 = __esm({
|
|
|
27564
27573
|
details: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
|
|
27565
27574
|
preview: external_exports.unknown().optional()
|
|
27566
27575
|
});
|
|
27567
|
-
VERSION3 = true ? "4.0.
|
|
27576
|
+
VERSION3 = true ? "4.0.172" : "0.0.0-test";
|
|
27568
27577
|
bedrockRerankingResponseSchema = lazySchema(
|
|
27569
27578
|
() => zodSchema(
|
|
27570
27579
|
external_exports.object({
|
|
@@ -90864,6 +90873,7 @@ var require_utils2 = __commonJS({
|
|
|
90864
90873
|
"use strict";
|
|
90865
90874
|
var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
|
|
90866
90875
|
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);
|
|
90876
|
+
var isPort = RegExp.prototype.test.bind(/^\d*$/u);
|
|
90867
90877
|
var isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
|
|
90868
90878
|
var isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
|
|
90869
90879
|
var isPathCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u);
|
|
@@ -91329,8 +91339,12 @@ var require_utils2 = __commonJS({
|
|
|
91329
91339
|
uriTokens.push(host);
|
|
91330
91340
|
}
|
|
91331
91341
|
if (typeof component.port === "number" || typeof component.port === "string") {
|
|
91342
|
+
const port = String(component.port);
|
|
91343
|
+
if (!isPort(port)) {
|
|
91344
|
+
throw new TypeError("URI port is malformed.");
|
|
91345
|
+
}
|
|
91332
91346
|
uriTokens.push(":");
|
|
91333
|
-
uriTokens.push(
|
|
91347
|
+
uriTokens.push(port);
|
|
91334
91348
|
}
|
|
91335
91349
|
return uriTokens.length ? uriTokens.join("") : void 0;
|
|
91336
91350
|
}
|
|
@@ -91773,12 +91787,15 @@ var require_fast_uri = __commonJS({
|
|
|
91773
91787
|
}
|
|
91774
91788
|
return false;
|
|
91775
91789
|
}
|
|
91790
|
+
function isIPLiteral(host) {
|
|
91791
|
+
return host[0] === "[" && host[host.length - 1] === "]";
|
|
91792
|
+
}
|
|
91776
91793
|
function hasMalformedComponentPercentEncoding(matches) {
|
|
91777
91794
|
const host = matches[4];
|
|
91778
|
-
return hasMalformedPercentEncoding(matches[3]) || host !== void 0 && !(host
|
|
91795
|
+
return hasMalformedPercentEncoding(matches[3]) || host !== void 0 && !isIPLiteral(host) && hasMalformedPercentEncoding(host) || hasMalformedPercentEncoding(matches[6]) || hasMalformedPercentEncoding(matches[7]) || hasMalformedPercentEncoding(matches[8]);
|
|
91779
91796
|
}
|
|
91780
91797
|
function canonicalizeHost(parsed, options, schemeHandler, isIP) {
|
|
91781
|
-
if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && parsed.host
|
|
91798
|
+
if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
|
|
91782
91799
|
try {
|
|
91783
91800
|
parsed.host = new URL("http://" + parsed.host).hostname;
|
|
91784
91801
|
} catch (e) {
|
|
@@ -91865,10 +91882,11 @@ var require_fast_uri = __commonJS({
|
|
|
91865
91882
|
if (parsed.host) {
|
|
91866
91883
|
const ipv4result = isIPv42(parsed.host);
|
|
91867
91884
|
if (ipv4result === false) {
|
|
91868
|
-
const bracketedIPLiteral = parsed.host
|
|
91885
|
+
const bracketedIPLiteral = isIPLiteral(parsed.host);
|
|
91886
|
+
const hasIPLiteralBracket = parsed.host.indexOf("[") !== -1 || parsed.host.indexOf("]") !== -1;
|
|
91869
91887
|
const ipv6result = normalizeIPv6(parsed.host);
|
|
91870
91888
|
isIP = ipv6result.isIPV6 || ipv6result.isIPVFuture === true;
|
|
91871
|
-
malformedIPLiteral =
|
|
91889
|
+
malformedIPLiteral = hasIPLiteralBracket && (!bracketedIPLiteral || ipv6result.error === true);
|
|
91872
91890
|
parsed.host = isIP ? ipv6result.host : ipv6result.host.toLowerCase();
|
|
91873
91891
|
if (malformedIPLiteral) {
|
|
91874
91892
|
parsed.error = parsed.error || "URI host is malformed.";
|
|
@@ -91891,7 +91909,9 @@ var require_fast_uri = __commonJS({
|
|
|
91891
91909
|
parsed.error = parsed.error || "URI is not a " + options.reference + " reference.";
|
|
91892
91910
|
}
|
|
91893
91911
|
const schemeHandler = getSchemeHandler(options.scheme || parsed.scheme);
|
|
91894
|
-
|
|
91912
|
+
if (!malformedIPLiteral) {
|
|
91913
|
+
malformedHost = canonicalizeHost(parsed, options, schemeHandler, isIP);
|
|
91914
|
+
}
|
|
91895
91915
|
if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
|
|
91896
91916
|
if (uri.indexOf("%") !== -1) {
|
|
91897
91917
|
if (parsed.host !== void 0 && !malformedIPLiteral) {
|
|
@@ -106862,7 +106882,7 @@ var init_governed_codex_profile = __esm({
|
|
|
106862
106882
|
function governedAttestationPredicate(error40) {
|
|
106863
106883
|
return error40 instanceof TypeError ? GOVERNED_ATTESTATION_ERROR_PREDICATES.get(error40.message) ?? null : null;
|
|
106864
106884
|
}
|
|
106865
|
-
function governedAnswerFailure(stage, nativeEventFailureBoundary = null, nativeEventFailureSubreason = null, nativeEventFailureCorrelationOperand = null, nativeEventFailureAttestationPredicate = null, schemaResultValidationSubreason = null, schemaResultValidationKeyword = null) {
|
|
106885
|
+
function governedAnswerFailure(stage, nativeEventFailureBoundary = null, nativeEventFailureSubreason = null, nativeEventFailureCorrelationOperand = null, nativeEventFailureAttestationPredicate = null, schemaResultValidationSubreason = null, schemaResultValidationKeyword = null, providerEngineFailureBoundary = null) {
|
|
106866
106886
|
return new GovernedAnswerFailure(
|
|
106867
106887
|
stage,
|
|
106868
106888
|
nativeEventFailureBoundary,
|
|
@@ -106870,21 +106890,23 @@ function governedAnswerFailure(stage, nativeEventFailureBoundary = null, nativeE
|
|
|
106870
106890
|
nativeEventFailureCorrelationOperand,
|
|
106871
106891
|
nativeEventFailureAttestationPredicate,
|
|
106872
106892
|
schemaResultValidationSubreason,
|
|
106873
|
-
schemaResultValidationKeyword
|
|
106893
|
+
schemaResultValidationKeyword,
|
|
106894
|
+
providerEngineFailureBoundary
|
|
106874
106895
|
);
|
|
106875
106896
|
}
|
|
106876
|
-
function normalizeGovernedAnswerFailure(error40, fallback = "unknown", nativeEventFailureBoundary = null, nativeEventFailureSubreason = null, nativeEventFailureCorrelationOperand = null, schemaResultValidationSubreason = null, schemaResultValidationKeyword = null) {
|
|
106897
|
+
function normalizeGovernedAnswerFailure(error40, fallback = "unknown", nativeEventFailureBoundary = null, nativeEventFailureSubreason = null, nativeEventFailureCorrelationOperand = null, schemaResultValidationSubreason = null, schemaResultValidationKeyword = null, providerEngineFailureBoundary = null, nativeEventFailureAttestationPredicate = null) {
|
|
106877
106898
|
return error40 instanceof GovernedAnswerFailure ? error40 : governedAnswerFailure(
|
|
106878
106899
|
fallback,
|
|
106879
106900
|
nativeEventFailureBoundary,
|
|
106880
106901
|
nativeEventFailureSubreason,
|
|
106881
106902
|
nativeEventFailureCorrelationOperand,
|
|
106882
|
-
fallback === "native_event_grammar" && nativeEventFailureBoundary === "live_envelope_session" && nativeEventFailureSubreason === "attestation" ? governedAttestationPredicate(error40) : null,
|
|
106903
|
+
fallback === "native_event_grammar" && nativeEventFailureBoundary === "live_envelope_session" && nativeEventFailureSubreason === "attestation" ? nativeEventFailureAttestationPredicate ?? governedAttestationPredicate(error40) : null,
|
|
106883
106904
|
schemaResultValidationSubreason,
|
|
106884
|
-
schemaResultValidationKeyword
|
|
106905
|
+
schemaResultValidationKeyword,
|
|
106906
|
+
providerEngineFailureBoundary
|
|
106885
106907
|
);
|
|
106886
106908
|
}
|
|
106887
|
-
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;
|
|
106909
|
+
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;
|
|
106888
106910
|
var init_governed_answer_failure = __esm({
|
|
106889
106911
|
"src/agent/engines/governed-answer-failure.js"() {
|
|
106890
106912
|
"use strict";
|
|
@@ -106892,8 +106914,10 @@ var init_governed_answer_failure = __esm({
|
|
|
106892
106914
|
"native_event_grammar",
|
|
106893
106915
|
"provider_engine",
|
|
106894
106916
|
"schema_result_validation",
|
|
106917
|
+
"internal_contract",
|
|
106895
106918
|
"unknown"
|
|
106896
106919
|
]);
|
|
106920
|
+
GOVERNED_PROVIDER_ENGINE_FAILURE_BOUNDARIES = /* @__PURE__ */ new Set(["acquire", "query", "close"]);
|
|
106897
106921
|
GOVERNED_NATIVE_EVENT_FAILURE_BOUNDARIES = /* @__PURE__ */ new Set([
|
|
106898
106922
|
"raw_item_predicate",
|
|
106899
106923
|
"live_envelope_session"
|
|
@@ -106937,7 +106961,9 @@ var init_governed_answer_failure = __esm({
|
|
|
106937
106961
|
"value_shape",
|
|
106938
106962
|
"kind",
|
|
106939
106963
|
"native_tool_evidence",
|
|
106940
|
-
"internal_contract"
|
|
106964
|
+
"internal_contract",
|
|
106965
|
+
"invocation_attestation",
|
|
106966
|
+
"native_capability_aggregate"
|
|
106941
106967
|
]);
|
|
106942
106968
|
GOVERNED_SCHEMA_RESULT_VALIDATION_SUBREASONS = /* @__PURE__ */ new Set([
|
|
106943
106969
|
"response_json",
|
|
@@ -107020,7 +107046,7 @@ var init_governed_answer_failure = __esm({
|
|
|
107020
107046
|
["Invalid profile capability overlap", "internal_contract"]
|
|
107021
107047
|
]);
|
|
107022
107048
|
GovernedAnswerFailure = class extends Error {
|
|
107023
|
-
constructor(stage, nativeEventFailureBoundary = null, nativeEventFailureSubreason = null, nativeEventFailureCorrelationOperand = null, nativeEventFailureAttestationPredicate = null, schemaResultValidationSubreason = null, schemaResultValidationKeyword = null) {
|
|
107049
|
+
constructor(stage, nativeEventFailureBoundary = null, nativeEventFailureSubreason = null, nativeEventFailureCorrelationOperand = null, nativeEventFailureAttestationPredicate = null, schemaResultValidationSubreason = null, schemaResultValidationKeyword = null, providerEngineFailureBoundary = null) {
|
|
107024
107050
|
super();
|
|
107025
107051
|
delete this.stack;
|
|
107026
107052
|
const answerFailureStage = GOVERNED_ANSWER_FAILURE_STAGES.has(stage) ? stage : "unknown";
|
|
@@ -107029,6 +107055,10 @@ var init_governed_answer_failure = __esm({
|
|
|
107029
107055
|
value: answerFailureStage,
|
|
107030
107056
|
enumerable: true
|
|
107031
107057
|
});
|
|
107058
|
+
if (answerFailureStage === "provider_engine") Object.defineProperty(this, "providerEngineFailureBoundary", {
|
|
107059
|
+
value: GOVERNED_PROVIDER_ENGINE_FAILURE_BOUNDARIES.has(providerEngineFailureBoundary) ? providerEngineFailureBoundary : null,
|
|
107060
|
+
enumerable: true
|
|
107061
|
+
});
|
|
107032
107062
|
if (answerFailureStage === "native_event_grammar") Object.defineProperty(this, "nativeEventFailureBoundary", {
|
|
107033
107063
|
value: GOVERNED_NATIVE_EVENT_FAILURE_BOUNDARIES.has(nativeEventFailureBoundary) ? nativeEventFailureBoundary : null,
|
|
107034
107064
|
enumerable: true
|
|
@@ -108039,7 +108069,9 @@ async function createCodexEngine(options = {}) {
|
|
|
108039
108069
|
}
|
|
108040
108070
|
});
|
|
108041
108071
|
if (opts.abortSignal) {
|
|
108042
|
-
if (opts.abortSignal.aborted)
|
|
108072
|
+
if (opts.abortSignal.aborted) {
|
|
108073
|
+
throw governedProfile ? governedAnswerFailure("provider_engine", null, null, null, null, null, null, "query") : new Error("Codex query cancelled");
|
|
108074
|
+
}
|
|
108043
108075
|
abortHandler = () => {
|
|
108044
108076
|
void cleanup(new Error("Codex query cancelled")).catch(() => {
|
|
108045
108077
|
});
|
|
@@ -108072,7 +108104,16 @@ async function createCodexEngine(options = {}) {
|
|
|
108072
108104
|
try {
|
|
108073
108105
|
result = await resultPromise;
|
|
108074
108106
|
} catch (error40) {
|
|
108075
|
-
throw governedProfile ?
|
|
108107
|
+
throw governedProfile ? evidenceFailure || normalizeGovernedAnswerFailure(
|
|
108108
|
+
error40,
|
|
108109
|
+
"provider_engine",
|
|
108110
|
+
null,
|
|
108111
|
+
null,
|
|
108112
|
+
null,
|
|
108113
|
+
null,
|
|
108114
|
+
null,
|
|
108115
|
+
"query"
|
|
108116
|
+
) : error40;
|
|
108076
108117
|
}
|
|
108077
108118
|
eventHandlers.delete(reqId);
|
|
108078
108119
|
governedEvidenceHandlers.delete(reqId);
|
|
@@ -108090,17 +108131,50 @@ async function createCodexEngine(options = {}) {
|
|
|
108090
108131
|
profile: governedProfile,
|
|
108091
108132
|
events: governedProfile.version === "probe.governed-codex-profile/v2" ? [collected.sessionEvent, collected.capabilities.nativeTools] : [collected.sessionEvent]
|
|
108092
108133
|
});
|
|
108134
|
+
} catch (error40) {
|
|
108135
|
+
throw normalizeGovernedAnswerFailure(
|
|
108136
|
+
error40,
|
|
108137
|
+
"native_event_grammar",
|
|
108138
|
+
"live_envelope_session",
|
|
108139
|
+
"attestation"
|
|
108140
|
+
);
|
|
108141
|
+
}
|
|
108142
|
+
try {
|
|
108093
108143
|
probeMcpCallCount = governedProfile.version === "probe.governed-codex-profile/v2" ? governedProbeMcpCallCount(mcpServer?.getGovernedCallEvidence()) : 0;
|
|
108094
108144
|
} catch (error40) {
|
|
108095
|
-
throw normalizeGovernedAnswerFailure(
|
|
108096
|
-
|
|
108097
|
-
|
|
108098
|
-
|
|
108099
|
-
|
|
108100
|
-
|
|
108101
|
-
|
|
108102
|
-
|
|
108103
|
-
|
|
108145
|
+
throw normalizeGovernedAnswerFailure(
|
|
108146
|
+
error40,
|
|
108147
|
+
"native_event_grammar",
|
|
108148
|
+
"live_envelope_session",
|
|
108149
|
+
"attestation",
|
|
108150
|
+
null,
|
|
108151
|
+
null,
|
|
108152
|
+
null,
|
|
108153
|
+
null,
|
|
108154
|
+
"native_capability_aggregate"
|
|
108155
|
+
);
|
|
108156
|
+
}
|
|
108157
|
+
try {
|
|
108158
|
+
attestation = hasInvocationDigest ? externalBoundReceipt(internal, dispatch, invocationDigest, {
|
|
108159
|
+
nativeCallCount: collected.capabilities.nativeTools.total,
|
|
108160
|
+
probeMcpCallCount
|
|
108161
|
+
}) : externalReceipt(internal, {
|
|
108162
|
+
nativeCallCount: collected.capabilities.nativeTools.total,
|
|
108163
|
+
probeMcpCallCount
|
|
108164
|
+
});
|
|
108165
|
+
} catch (error40) {
|
|
108166
|
+
throw normalizeGovernedAnswerFailure(
|
|
108167
|
+
error40,
|
|
108168
|
+
"native_event_grammar",
|
|
108169
|
+
"live_envelope_session",
|
|
108170
|
+
"attestation",
|
|
108171
|
+
null,
|
|
108172
|
+
null,
|
|
108173
|
+
null,
|
|
108174
|
+
null,
|
|
108175
|
+
"invocation_attestation"
|
|
108176
|
+
);
|
|
108177
|
+
}
|
|
108104
108178
|
session.setConversationId(collected.sessionEvent.params.msg.session_id);
|
|
108105
108179
|
}
|
|
108106
108180
|
if (result && result.content && Array.isArray(result.content)) {
|
|
@@ -108137,7 +108211,7 @@ async function createCodexEngine(options = {}) {
|
|
|
108137
108211
|
}
|
|
108138
108212
|
};
|
|
108139
108213
|
} catch (error40) {
|
|
108140
|
-
if (governedProfile) error40 = normalizeGovernedAnswerFailure(error40, "
|
|
108214
|
+
if (governedProfile) error40 = normalizeGovernedAnswerFailure(error40, "internal_contract");
|
|
108141
108215
|
queryError = error40;
|
|
108142
108216
|
if (debug) {
|
|
108143
108217
|
console.error("[DEBUG] Codex query error:", error40);
|
|
@@ -108152,7 +108226,16 @@ async function createCodexEngine(options = {}) {
|
|
|
108152
108226
|
try {
|
|
108153
108227
|
await cleanup();
|
|
108154
108228
|
} catch (cleanupError) {
|
|
108155
|
-
if (!queryError) throw
|
|
108229
|
+
if (!queryError) throw normalizeGovernedAnswerFailure(
|
|
108230
|
+
cleanupError,
|
|
108231
|
+
"provider_engine",
|
|
108232
|
+
null,
|
|
108233
|
+
null,
|
|
108234
|
+
null,
|
|
108235
|
+
null,
|
|
108236
|
+
null,
|
|
108237
|
+
"close"
|
|
108238
|
+
);
|
|
108156
108239
|
}
|
|
108157
108240
|
}
|
|
108158
108241
|
}
|
|
@@ -110239,7 +110322,6 @@ var init_ProbeAgent = __esm({
|
|
|
110239
110322
|
agent: this,
|
|
110240
110323
|
// Pass reference to ProbeAgent for tool access
|
|
110241
110324
|
systemPrompt,
|
|
110242
|
-
customPrompt: this.customPrompt,
|
|
110243
110325
|
sessionId: this.options?.sessionId,
|
|
110244
110326
|
debug: this.debug,
|
|
110245
110327
|
allowedTools: this.allowedTools,
|
|
@@ -110256,7 +110338,18 @@ var init_ProbeAgent = __esm({
|
|
|
110256
110338
|
}
|
|
110257
110339
|
return this.engine;
|
|
110258
110340
|
} catch (error40) {
|
|
110259
|
-
if (this.governedCodexProfile)
|
|
110341
|
+
if (this.governedCodexProfile) {
|
|
110342
|
+
throw normalizeGovernedAnswerFailure(
|
|
110343
|
+
error40,
|
|
110344
|
+
"provider_engine",
|
|
110345
|
+
null,
|
|
110346
|
+
null,
|
|
110347
|
+
null,
|
|
110348
|
+
null,
|
|
110349
|
+
null,
|
|
110350
|
+
"acquire"
|
|
110351
|
+
);
|
|
110352
|
+
}
|
|
110260
110353
|
console.warn("[WARNING] Failed to load Codex CLI engine:", error40.message);
|
|
110261
110354
|
console.warn("[WARNING] Falling back to Vercel AI SDK");
|
|
110262
110355
|
this.clientApiProvider = null;
|
|
@@ -110937,7 +111030,7 @@ Workspace: ${this.allowedFolders.join(", ")}`;
|
|
|
110937
111030
|
const { prompt } = this._prepareGovernedAnswerPrompt(message, options);
|
|
110938
111031
|
const systemPrompt = await this._getCachedCodexNativeSystemPrompt();
|
|
110939
111032
|
const { previewGovernedCodexInitialDispatch: previewGovernedCodexInitialDispatch2 } = await Promise.resolve().then(() => (init_codex(), codex_exports));
|
|
110940
|
-
return previewGovernedCodexInitialDispatch2({ systemPrompt,
|
|
111033
|
+
return previewGovernedCodexInitialDispatch2({ systemPrompt, prompt });
|
|
110941
111034
|
}
|
|
110942
111035
|
/**
|
|
110943
111036
|
* Get the system message with instructions for the AI (XML Tool Format)
|
|
@@ -111127,38 +111220,99 @@ You are working with a workspace. Available paths: ${workspaceDesc}
|
|
|
111127
111220
|
try {
|
|
111128
111221
|
try {
|
|
111129
111222
|
engine = await this.getEngine();
|
|
111130
|
-
} catch {
|
|
111131
|
-
throw
|
|
111223
|
+
} catch (error40) {
|
|
111224
|
+
throw normalizeGovernedAnswerFailure(
|
|
111225
|
+
error40,
|
|
111226
|
+
"provider_engine",
|
|
111227
|
+
null,
|
|
111228
|
+
null,
|
|
111229
|
+
null,
|
|
111230
|
+
null,
|
|
111231
|
+
null,
|
|
111232
|
+
"acquire"
|
|
111233
|
+
);
|
|
111132
111234
|
}
|
|
111133
|
-
if (!engine?.query) throw governedAnswerFailure("
|
|
111235
|
+
if (!engine?.query) throw governedAnswerFailure("internal_contract");
|
|
111134
111236
|
const candidateChunks = [];
|
|
111135
111237
|
let runtimeAttestation;
|
|
111136
111238
|
let attestationCount = 0;
|
|
111137
111239
|
let nativeToolBatch;
|
|
111138
111240
|
let nativeToolBatchCount = 0;
|
|
111139
111241
|
const queryOptions = hasInvocationDigest ? { abortSignal: this._abortController.signal, invocationDigest } : { abortSignal: this._abortController.signal };
|
|
111140
|
-
|
|
111141
|
-
|
|
111142
|
-
|
|
111143
|
-
|
|
111144
|
-
|
|
111145
|
-
|
|
111146
|
-
|
|
111147
|
-
|
|
111148
|
-
|
|
111242
|
+
try {
|
|
111243
|
+
for await (const chunk of engine.query(prompt, queryOptions)) {
|
|
111244
|
+
if (chunk.type === "text" && chunk.content) candidateChunks.push(chunk.content);
|
|
111245
|
+
else if (chunk.type === "metadata" && chunk.data?.attestation) {
|
|
111246
|
+
runtimeAttestation = chunk.data.attestation;
|
|
111247
|
+
attestationCount++;
|
|
111248
|
+
} else if (chunk.type === "toolBatch") {
|
|
111249
|
+
nativeToolBatch = chunk;
|
|
111250
|
+
nativeToolBatchCount++;
|
|
111251
|
+
} else if (chunk.type === "error") {
|
|
111252
|
+
throw normalizeGovernedAnswerFailure(
|
|
111253
|
+
chunk.error,
|
|
111254
|
+
"provider_engine",
|
|
111255
|
+
null,
|
|
111256
|
+
null,
|
|
111257
|
+
null,
|
|
111258
|
+
null,
|
|
111259
|
+
null,
|
|
111260
|
+
"query"
|
|
111261
|
+
);
|
|
111262
|
+
}
|
|
111263
|
+
}
|
|
111264
|
+
} catch (error40) {
|
|
111265
|
+
throw normalizeGovernedAnswerFailure(
|
|
111266
|
+
error40,
|
|
111267
|
+
"provider_engine",
|
|
111268
|
+
null,
|
|
111269
|
+
null,
|
|
111270
|
+
null,
|
|
111271
|
+
null,
|
|
111272
|
+
null,
|
|
111273
|
+
"query"
|
|
111274
|
+
);
|
|
111149
111275
|
}
|
|
111150
111276
|
if (hasInvocationDigest) {
|
|
111151
111277
|
const expectedAttestation = this.governedCodexProfile?.version === "probe.governed-codex-profile/v2" ? "probe.governed-codex-attestation/v3" : "probe.governed-codex-attestation/v2";
|
|
111152
111278
|
if (attestationCount !== 1 || runtimeAttestation?.version !== expectedAttestation || runtimeAttestation?.executionContext?.source !== "caller" || runtimeAttestation?.executionContext?.invocationDigest !== invocationDigest) {
|
|
111153
|
-
throw
|
|
111279
|
+
throw governedAnswerFailure(
|
|
111280
|
+
"native_event_grammar",
|
|
111281
|
+
"live_envelope_session",
|
|
111282
|
+
"attestation",
|
|
111283
|
+
null,
|
|
111284
|
+
"invocation_attestation"
|
|
111285
|
+
);
|
|
111154
111286
|
}
|
|
111155
|
-
} else if (attestationCount !== 1)
|
|
111287
|
+
} else if (attestationCount !== 1) {
|
|
111288
|
+
throw governedAnswerFailure(
|
|
111289
|
+
"native_event_grammar",
|
|
111290
|
+
"live_envelope_session",
|
|
111291
|
+
"attestation",
|
|
111292
|
+
null,
|
|
111293
|
+
"invocation_attestation"
|
|
111294
|
+
);
|
|
111295
|
+
}
|
|
111156
111296
|
if (this.governedCodexProfile?.version === "probe.governed-codex-profile/v2") {
|
|
111157
111297
|
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)) {
|
|
111158
|
-
throw
|
|
111298
|
+
throw governedAnswerFailure(
|
|
111299
|
+
"native_event_grammar",
|
|
111300
|
+
"live_envelope_session",
|
|
111301
|
+
"attestation",
|
|
111302
|
+
null,
|
|
111303
|
+
"native_capability_aggregate"
|
|
111304
|
+
);
|
|
111159
111305
|
}
|
|
111160
111306
|
for (const toolEvent of nativeToolBatch.tools) this.events.emit("toolCall", toolEvent);
|
|
111161
|
-
} else if (nativeToolBatchCount !== 0)
|
|
111307
|
+
} else if (nativeToolBatchCount !== 0) {
|
|
111308
|
+
throw governedAnswerFailure(
|
|
111309
|
+
"native_event_grammar",
|
|
111310
|
+
"live_envelope_session",
|
|
111311
|
+
"attestation",
|
|
111312
|
+
null,
|
|
111313
|
+
"native_capability_aggregate"
|
|
111314
|
+
);
|
|
111315
|
+
}
|
|
111162
111316
|
const validation = validateJsonResponse(candidateChunks.join(""), { debug: this.debug, schema });
|
|
111163
111317
|
if (!validation.isValid) throw governedSchemaResultValidationFailure(validation);
|
|
111164
111318
|
if (hasResultIdentity) {
|
|
@@ -111174,14 +111328,23 @@ You are working with a workspace. Available paths: ${workspaceDesc}
|
|
|
111174
111328
|
}
|
|
111175
111329
|
return { data: validation.parsed, runtimeAttestation };
|
|
111176
111330
|
} catch (error40) {
|
|
111177
|
-
answerFailure = normalizeGovernedAnswerFailure(error40, "
|
|
111331
|
+
answerFailure = normalizeGovernedAnswerFailure(error40, "internal_contract");
|
|
111178
111332
|
throw answerFailure;
|
|
111179
111333
|
} finally {
|
|
111180
111334
|
if (engine) {
|
|
111181
111335
|
try {
|
|
111182
111336
|
await engine.close();
|
|
111183
|
-
} catch {
|
|
111184
|
-
if (!answerFailure) throw
|
|
111337
|
+
} catch (error40) {
|
|
111338
|
+
if (!answerFailure) throw normalizeGovernedAnswerFailure(
|
|
111339
|
+
error40,
|
|
111340
|
+
"provider_engine",
|
|
111341
|
+
null,
|
|
111342
|
+
null,
|
|
111343
|
+
null,
|
|
111344
|
+
null,
|
|
111345
|
+
null,
|
|
111346
|
+
"close"
|
|
111347
|
+
);
|
|
111185
111348
|
}
|
|
111186
111349
|
}
|
|
111187
111350
|
}
|