@okxweb3/a2a-node 0.2.6 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +87 -19
- package/dist/index.js +84 -16
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -26648,7 +26648,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
|
|
|
26648
26648
|
client: {
|
|
26649
26649
|
id: "gateway-client",
|
|
26650
26650
|
displayName: "okx-a2a-node",
|
|
26651
|
-
version: "0.2.
|
|
26651
|
+
version: "0.2.7",
|
|
26652
26652
|
platform: "node",
|
|
26653
26653
|
mode: "backend",
|
|
26654
26654
|
instanceId
|
|
@@ -26659,7 +26659,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
|
|
|
26659
26659
|
commands: [],
|
|
26660
26660
|
permissions: {},
|
|
26661
26661
|
locale: Intl.DateTimeFormat().resolvedOptions().locale || "en-US",
|
|
26662
|
-
userAgent: `okx-a2a-node/${"0.2.
|
|
26662
|
+
userAgent: `okx-a2a-node/${"0.2.7"}`,
|
|
26663
26663
|
auth: {
|
|
26664
26664
|
...config.token ? { token: config.token } : {},
|
|
26665
26665
|
...config.password ? { password: config.password } : {}
|
|
@@ -28568,7 +28568,7 @@ var init_sentry_config = __esm({
|
|
|
28568
28568
|
environment = process.env.SENTRY_ENV === "dev" ? "dev" : "prod";
|
|
28569
28569
|
SENTRY_CONFIG = {
|
|
28570
28570
|
projectName: "okx/openclaw-okx-a2a-extension",
|
|
28571
|
-
release: "0.2.
|
|
28571
|
+
release: "0.2.7",
|
|
28572
28572
|
environment,
|
|
28573
28573
|
runtimeContainer: normalizeRuntimeContainer(process.env.OKX_A2A_RUNTIME_CONTAINER)
|
|
28574
28574
|
};
|
|
@@ -39738,7 +39738,7 @@ async function exportDiagnosticLogs(options) {
|
|
|
39738
39738
|
node: process.version,
|
|
39739
39739
|
platform: process.platform,
|
|
39740
39740
|
arch: process.arch,
|
|
39741
|
-
packageVersion: true ? "0.2.
|
|
39741
|
+
packageVersion: true ? "0.2.7" : "unknown",
|
|
39742
39742
|
sensitiveContentIncluded: options.includeSensitiveContent,
|
|
39743
39743
|
listenerAndLlmContentIncluded: true,
|
|
39744
39744
|
credentialsAlwaysRedacted: true,
|
|
@@ -61836,19 +61836,49 @@ function extractProviderErrorMessage(text) {
|
|
|
61836
61836
|
function createAiToolFailureTracker(provider) {
|
|
61837
61837
|
const failures = [];
|
|
61838
61838
|
const claudeToolCommands = /* @__PURE__ */ new Map();
|
|
61839
|
+
let sequence = 0;
|
|
61840
|
+
let lastCompletedSequence = null;
|
|
61841
|
+
let turnCompleted = false;
|
|
61839
61842
|
return {
|
|
61840
61843
|
failures,
|
|
61841
61844
|
processLine(line) {
|
|
61842
61845
|
if (!line) {
|
|
61843
61846
|
return;
|
|
61844
61847
|
}
|
|
61848
|
+
sequence += 1;
|
|
61849
|
+
if (provider === "codex") {
|
|
61850
|
+
lastCompletedSequence = parseCodexCompletedItemSequence(line, sequence) ?? lastCompletedSequence;
|
|
61851
|
+
turnCompleted ||= isCodexTurnCompleted(line);
|
|
61852
|
+
}
|
|
61845
61853
|
const failure = parseAiToolFailureLine(provider, line, claudeToolCommands);
|
|
61846
61854
|
if (failure) {
|
|
61847
|
-
failures.push(failure);
|
|
61855
|
+
failures.push({ ...failure, sequence });
|
|
61848
61856
|
}
|
|
61849
|
-
}
|
|
61857
|
+
},
|
|
61858
|
+
lastCompletedSequence: () => lastCompletedSequence,
|
|
61859
|
+
turnCompleted: () => turnCompleted
|
|
61850
61860
|
};
|
|
61851
61861
|
}
|
|
61862
|
+
function isCodexTurnCompleted(line) {
|
|
61863
|
+
try {
|
|
61864
|
+
const event = JSON.parse(line);
|
|
61865
|
+
return isRecord6(event) && event.type === "turn.completed";
|
|
61866
|
+
} catch {
|
|
61867
|
+
return false;
|
|
61868
|
+
}
|
|
61869
|
+
}
|
|
61870
|
+
function parseCodexCompletedItemSequence(line, sequence) {
|
|
61871
|
+
let event;
|
|
61872
|
+
try {
|
|
61873
|
+
event = JSON.parse(line);
|
|
61874
|
+
} catch {
|
|
61875
|
+
return null;
|
|
61876
|
+
}
|
|
61877
|
+
if (!isRecord6(event) || event.type !== "item.completed" || !isRecord6(event.item) || event.item.status !== "completed") {
|
|
61878
|
+
return null;
|
|
61879
|
+
}
|
|
61880
|
+
return sequence;
|
|
61881
|
+
}
|
|
61852
61882
|
function parseAiToolFailureLine(provider, line, claudeToolCommands) {
|
|
61853
61883
|
let event;
|
|
61854
61884
|
try {
|
|
@@ -61892,6 +61922,8 @@ function parseCodexCommandExecutionFailure(item, rawEvent) {
|
|
|
61892
61922
|
provider: "codex",
|
|
61893
61923
|
tool: "command_execution",
|
|
61894
61924
|
errorType: errorType === "unknown" ? "tool_failed" : errorType,
|
|
61925
|
+
origin: "command_execution",
|
|
61926
|
+
sequence: 0,
|
|
61895
61927
|
command: typeof item.command === "string" ? item.command : void 0,
|
|
61896
61928
|
exitCode,
|
|
61897
61929
|
status,
|
|
@@ -61916,6 +61948,8 @@ function parseCodexAgentMessageFailure(item, rawEvent) {
|
|
|
61916
61948
|
provider: "codex",
|
|
61917
61949
|
tool: marker.tool,
|
|
61918
61950
|
errorType: marker.errorType,
|
|
61951
|
+
origin: marker.origin,
|
|
61952
|
+
sequence: marker.sequence,
|
|
61919
61953
|
permissionKind: marker.permissionKind,
|
|
61920
61954
|
permissionTarget: marker.permissionTarget,
|
|
61921
61955
|
suggestedAddDir: marker.suggestedAddDir,
|
|
@@ -61954,6 +61988,8 @@ function normalizeCodexStructuredToolFailure(toolFailure, rawEvent) {
|
|
|
61954
61988
|
provider: "codex",
|
|
61955
61989
|
tool,
|
|
61956
61990
|
errorType: "permission_denied",
|
|
61991
|
+
origin: "structured_final",
|
|
61992
|
+
sequence: 0,
|
|
61957
61993
|
permissionKind,
|
|
61958
61994
|
permissionTarget,
|
|
61959
61995
|
suggestedAddDir,
|
|
@@ -61992,6 +62028,8 @@ function extractCodexToolFailureMarker(text) {
|
|
|
61992
62028
|
provider: "codex",
|
|
61993
62029
|
tool,
|
|
61994
62030
|
errorType: "permission_denied",
|
|
62031
|
+
origin: "permission_marker",
|
|
62032
|
+
sequence: 0,
|
|
61995
62033
|
permissionKind,
|
|
61996
62034
|
permissionTarget,
|
|
61997
62035
|
suggestedAddDir,
|
|
@@ -62027,6 +62065,9 @@ function inferPermissionDetails(failure) {
|
|
|
62027
62065
|
const normalized = text.toLowerCase();
|
|
62028
62066
|
const filesystemTarget = extractDeniedFilesystemPath(text);
|
|
62029
62067
|
if (failure.provider === "codex" && filesystemTarget && (normalized.includes("operation not permitted") || normalized.includes("permission denied"))) {
|
|
62068
|
+
if (isBroadFilesystemDiscoveryCommand(failure.command)) {
|
|
62069
|
+
return { permissionKind: "filesystem_sandbox" };
|
|
62070
|
+
}
|
|
62030
62071
|
const suggestedAddDir = getPreferredCodexWritableRoot(filesystemTarget);
|
|
62031
62072
|
return {
|
|
62032
62073
|
permissionKind: "filesystem_sandbox",
|
|
@@ -62050,6 +62091,12 @@ function inferPermissionDetails(failure) {
|
|
|
62050
62091
|
}
|
|
62051
62092
|
return { permissionKind: "unknown" };
|
|
62052
62093
|
}
|
|
62094
|
+
function isBroadFilesystemDiscoveryCommand(command) {
|
|
62095
|
+
if (!command) {
|
|
62096
|
+
return false;
|
|
62097
|
+
}
|
|
62098
|
+
return /(?:^|[\s"'`;&|()])(?:[^\s"'`;&|()]+\/)?find(?:\s+(?:-[HLPXdxsE]|-O[^\s"'`;&|()]+|-D\s+[^\s"'`;&|()]+|--))*\s+["']?(?:\/|~(?:\/(?:\.)?)?|\$(?:HOME|\{HOME\})(?:\/(?:\.)?)?|\/(?:Users|home)\/[^/\s"'`;&|()]+(?:\/(?:\.)?)?)["']?(?=$|[\s"'`;&|()])/.test(command);
|
|
62099
|
+
}
|
|
62053
62100
|
function extractDeniedFilesystemPath(text) {
|
|
62054
62101
|
const patterns = [
|
|
62055
62102
|
/(?:^|\n)[^:\n]*:\s*((?:\/|~\/)[^:\n]+):\s*(?:Operation not permitted|Permission denied)(?:\n|$)/i,
|
|
@@ -62123,6 +62170,8 @@ function parseClaudeToolFailure(event, rawEvent, claudeToolCommands) {
|
|
|
62123
62170
|
provider: "claude",
|
|
62124
62171
|
tool: "Bash",
|
|
62125
62172
|
errorType: errorType === "unknown" ? "tool_failed" : errorType,
|
|
62173
|
+
origin: "command_execution",
|
|
62174
|
+
sequence: 0,
|
|
62126
62175
|
command: toolResult?.toolUseId ? claudeToolCommands.get(toolResult.toolUseId) : void 0,
|
|
62127
62176
|
exitCode: explicitExitCode,
|
|
62128
62177
|
status: isError ? "error" : "failed",
|
|
@@ -62534,6 +62583,16 @@ function isDynamicOnchainosArg(token) {
|
|
|
62534
62583
|
function isReportableAiToolFailure(failure) {
|
|
62535
62584
|
return failure.errorType === "permission_denied";
|
|
62536
62585
|
}
|
|
62586
|
+
function selectReportableAiToolFailures(input) {
|
|
62587
|
+
const reportable = input.failures.filter(isReportableAiToolFailure);
|
|
62588
|
+
const completedSequence = input.lastCompletedSequence;
|
|
62589
|
+
if (input.provider !== "codex" || completedSequence === null || !input.runCompletedSuccessfully) {
|
|
62590
|
+
return reportable;
|
|
62591
|
+
}
|
|
62592
|
+
return reportable.filter(
|
|
62593
|
+
(failure) => (failure.sequence ?? Number.MAX_SAFE_INTEGER) >= completedSequence
|
|
62594
|
+
);
|
|
62595
|
+
}
|
|
62537
62596
|
function synthesizeCodexProsePermissionFailure(input) {
|
|
62538
62597
|
if (input.provider !== "codex" || input.errorType !== "permission_denied") {
|
|
62539
62598
|
return null;
|
|
@@ -62549,6 +62608,8 @@ function synthesizeCodexProsePermissionFailure(input) {
|
|
|
62549
62608
|
provider: "codex",
|
|
62550
62609
|
tool: "command_execution",
|
|
62551
62610
|
errorType: "permission_denied",
|
|
62611
|
+
origin: "synthetic",
|
|
62612
|
+
sequence: Number.MAX_SAFE_INTEGER,
|
|
62552
62613
|
exitCode: input.exitCode,
|
|
62553
62614
|
status: "failed",
|
|
62554
62615
|
output: output5,
|
|
@@ -63469,18 +63530,25 @@ var init_ai_runner = __esm({
|
|
|
63469
63530
|
exitCode
|
|
63470
63531
|
});
|
|
63471
63532
|
const detectedToolFailures = syntheticToolFailure ? [...toolFailures.failures, syntheticToolFailure] : toolFailures.failures;
|
|
63472
|
-
const
|
|
63533
|
+
const runCompletedSuccessfully = provider === "codex" && !timedOut && exitCode === 0 && closeResult.signal === null && aiSessionId !== null && toolFailures.turnCompleted();
|
|
63534
|
+
const reportableToolFailures = selectReportableAiToolFailures({
|
|
63535
|
+
provider,
|
|
63536
|
+
failures: detectedToolFailures,
|
|
63537
|
+
lastCompletedSequence: toolFailures.lastCompletedSequence(),
|
|
63538
|
+
runCompletedSuccessfully
|
|
63539
|
+
});
|
|
63540
|
+
const runFailureErrorType = fullOutputErrorType === "permission_denied" && reportableToolFailures.length === 0 ? void 0 : fullOutputErrorType ?? reportableToolFailures.at(-1)?.errorType;
|
|
63473
63541
|
const runFailureContext = {
|
|
63474
63542
|
provider,
|
|
63475
|
-
toolFailures: [...
|
|
63476
|
-
lastToolFailure:
|
|
63543
|
+
toolFailures: [...reportableToolFailures],
|
|
63544
|
+
lastToolFailure: reportableToolFailures.at(-1),
|
|
63477
63545
|
logPath,
|
|
63478
63546
|
exitCode,
|
|
63479
63547
|
closeSignal: closeResult.signal,
|
|
63480
63548
|
timedOut,
|
|
63481
63549
|
errorType: runFailureErrorType
|
|
63482
63550
|
};
|
|
63483
|
-
await this.reportAiToolFailures(
|
|
63551
|
+
await this.reportAiToolFailures(reportableToolFailures, {
|
|
63484
63552
|
source: request.source,
|
|
63485
63553
|
sessionKey: request.sessionKey,
|
|
63486
63554
|
jobId: request.jobId ?? null,
|
|
@@ -67580,12 +67648,12 @@ async function runListenerWithLock(options, paths) {
|
|
|
67580
67648
|
});
|
|
67581
67649
|
}
|
|
67582
67650
|
});
|
|
67583
|
-
service.setPluginVersion("0.2.
|
|
67651
|
+
service.setPluginVersion("0.2.7");
|
|
67584
67652
|
await service.init();
|
|
67585
67653
|
const pluginVersionStatus = service.pluginVersionStatus;
|
|
67586
67654
|
if (pluginVersionStatus.unavailable) {
|
|
67587
67655
|
throw new Error(
|
|
67588
|
-
`@okxweb3/a2a-node v${"0.2.
|
|
67656
|
+
`@okxweb3/a2a-node v${"0.2.7"} is below the required minimum v${pluginVersionStatus.minVersion}`
|
|
67589
67657
|
);
|
|
67590
67658
|
}
|
|
67591
67659
|
const systemConfig = service.getSystemConfig();
|
|
@@ -67603,7 +67671,7 @@ async function runListenerWithLock(options, paths) {
|
|
|
67603
67671
|
onchainosAgentId: "*",
|
|
67604
67672
|
reason: "system-config missing sentryDsn",
|
|
67605
67673
|
pluginId: "@okxweb3/a2a-node",
|
|
67606
|
-
pluginVersion: "0.2.
|
|
67674
|
+
pluginVersion: "0.2.7"
|
|
67607
67675
|
});
|
|
67608
67676
|
}
|
|
67609
67677
|
logWithTimestamp(
|
|
@@ -116005,7 +116073,7 @@ async function getCurrentNodeCliVersion() {
|
|
|
116005
116073
|
return await getGlobalNpmPackageVersion(UPDATE_PACKAGES.node) ?? getBundledNodeCliVersion();
|
|
116006
116074
|
}
|
|
116007
116075
|
function getBundledNodeCliVersion() {
|
|
116008
|
-
return true ? "0.2.
|
|
116076
|
+
return true ? "0.2.7" : null;
|
|
116009
116077
|
}
|
|
116010
116078
|
function readConfiguredAiProvider() {
|
|
116011
116079
|
const explicit = process.env.OKX_A2A_AI_PROVIDER || process.env.OKX_AGENT_TASK_AI_CLI;
|
|
@@ -116215,7 +116283,7 @@ async function updateHermes(release, options) {
|
|
|
116215
116283
|
}
|
|
116216
116284
|
}
|
|
116217
116285
|
async function installGatewayPluginForDoctor(target) {
|
|
116218
|
-
const release = isPrereleaseVersion("0.2.
|
|
116286
|
+
const release = isPrereleaseVersion("0.2.7") ? "beta" : "latest";
|
|
116219
116287
|
const insideTargetGateway = detectGatewayInvocation() === target;
|
|
116220
116288
|
const options = {
|
|
116221
116289
|
restart: !insideTargetGateway,
|
|
@@ -117261,7 +117329,7 @@ async function runDoctor(options = {}) {
|
|
|
117261
117329
|
platform: options.platform ?? process.platform,
|
|
117262
117330
|
env: options.env ?? process.env,
|
|
117263
117331
|
target: options.target ?? resolveDoctorTarget(options.env ?? process.env),
|
|
117264
|
-
cliVersion: options.cliVersion ?? (true ? "0.2.
|
|
117332
|
+
cliVersion: options.cliVersion ?? (true ? "0.2.7" : "0.0.0"),
|
|
117265
117333
|
fixMode: options.fix === true,
|
|
117266
117334
|
nonInteractive: options.nonInteractive === true,
|
|
117267
117335
|
packageChanged: false,
|
|
@@ -118283,7 +118351,7 @@ init_sentry_logger();
|
|
|
118283
118351
|
init_sentry_config();
|
|
118284
118352
|
var CURRENT_GATEWAY_SESSION_KEYS_ENV4 = "OKX_A2A_CURRENT_GATEWAY_SESSION_KEYS";
|
|
118285
118353
|
function printUsage3() {
|
|
118286
|
-
console.log(`okx-a2a ${"0.2.
|
|
118354
|
+
console.log(`okx-a2a ${"0.2.7"}
|
|
118287
118355
|
|
|
118288
118356
|
Usage:
|
|
118289
118357
|
okx-a2a <command> [options]
|
|
@@ -118323,7 +118391,7 @@ Run \`okx-a2a <command> -h\` for command-specific help.
|
|
|
118323
118391
|
`);
|
|
118324
118392
|
}
|
|
118325
118393
|
function printVersion() {
|
|
118326
|
-
console.log("0.2.
|
|
118394
|
+
console.log("0.2.7");
|
|
118327
118395
|
}
|
|
118328
118396
|
function printDaemonUsage() {
|
|
118329
118397
|
console.log(`Usage: okx-a2a daemon <start|restart|stop|status|autostart> [options]
|
|
@@ -119762,7 +119830,7 @@ async function main() {
|
|
|
119762
119830
|
if (command === "xmtp-test") {
|
|
119763
119831
|
const { handleXmtpTestCommand: handleXmtpTestCommand2 } = await Promise.resolve().then(() => (init_xmtp_test_cli(), xmtp_test_cli_exports));
|
|
119764
119832
|
await handleXmtpTestCommand2(process.argv.slice(3), {
|
|
119765
|
-
packageVersion: "0.2.
|
|
119833
|
+
packageVersion: "0.2.7",
|
|
119766
119834
|
agentSdkVersion: "2.3.0",
|
|
119767
119835
|
nodeSdkVersion: "6.1.0",
|
|
119768
119836
|
nodeBindingsVersion: "1.11.0"
|
package/dist/index.js
CHANGED
|
@@ -32148,7 +32148,7 @@ var init_sentry_config = __esm({
|
|
|
32148
32148
|
environment = process.env.SENTRY_ENV === "dev" ? "dev" : "prod";
|
|
32149
32149
|
SENTRY_CONFIG = {
|
|
32150
32150
|
projectName: "okx/openclaw-okx-a2a-extension",
|
|
32151
|
-
release: "0.2.
|
|
32151
|
+
release: "0.2.7",
|
|
32152
32152
|
environment,
|
|
32153
32153
|
runtimeContainer: normalizeRuntimeContainer(process.env.OKX_A2A_RUNTIME_CONTAINER)
|
|
32154
32154
|
};
|
|
@@ -33089,7 +33089,7 @@ async function getCurrentNodeCliVersion() {
|
|
|
33089
33089
|
return await getGlobalNpmPackageVersion(UPDATE_PACKAGES.node) ?? getBundledNodeCliVersion();
|
|
33090
33090
|
}
|
|
33091
33091
|
function getBundledNodeCliVersion() {
|
|
33092
|
-
return true ? "0.2.
|
|
33092
|
+
return true ? "0.2.7" : null;
|
|
33093
33093
|
}
|
|
33094
33094
|
function readConfiguredAiProvider() {
|
|
33095
33095
|
const explicit = process.env.OKX_A2A_AI_PROVIDER || process.env.OKX_AGENT_TASK_AI_CLI;
|
|
@@ -33299,7 +33299,7 @@ async function updateHermes(release, options) {
|
|
|
33299
33299
|
}
|
|
33300
33300
|
}
|
|
33301
33301
|
async function installGatewayPluginForDoctor(target) {
|
|
33302
|
-
const release = isPrereleaseVersion("0.2.
|
|
33302
|
+
const release = isPrereleaseVersion("0.2.7") ? "beta" : "latest";
|
|
33303
33303
|
const insideTargetGateway = detectGatewayInvocation() === target;
|
|
33304
33304
|
const options = {
|
|
33305
33305
|
restart: !insideTargetGateway,
|
|
@@ -45703,18 +45703,25 @@ var AiRunner = class {
|
|
|
45703
45703
|
exitCode
|
|
45704
45704
|
});
|
|
45705
45705
|
const detectedToolFailures = syntheticToolFailure ? [...toolFailures.failures, syntheticToolFailure] : toolFailures.failures;
|
|
45706
|
-
const
|
|
45706
|
+
const runCompletedSuccessfully = provider === "codex" && !timedOut && exitCode === 0 && closeResult.signal === null && aiSessionId !== null && toolFailures.turnCompleted();
|
|
45707
|
+
const reportableToolFailures = selectReportableAiToolFailures({
|
|
45708
|
+
provider,
|
|
45709
|
+
failures: detectedToolFailures,
|
|
45710
|
+
lastCompletedSequence: toolFailures.lastCompletedSequence(),
|
|
45711
|
+
runCompletedSuccessfully
|
|
45712
|
+
});
|
|
45713
|
+
const runFailureErrorType = fullOutputErrorType === "permission_denied" && reportableToolFailures.length === 0 ? void 0 : fullOutputErrorType ?? reportableToolFailures.at(-1)?.errorType;
|
|
45707
45714
|
const runFailureContext = {
|
|
45708
45715
|
provider,
|
|
45709
|
-
toolFailures: [...
|
|
45710
|
-
lastToolFailure:
|
|
45716
|
+
toolFailures: [...reportableToolFailures],
|
|
45717
|
+
lastToolFailure: reportableToolFailures.at(-1),
|
|
45711
45718
|
logPath,
|
|
45712
45719
|
exitCode,
|
|
45713
45720
|
closeSignal: closeResult.signal,
|
|
45714
45721
|
timedOut,
|
|
45715
45722
|
errorType: runFailureErrorType
|
|
45716
45723
|
};
|
|
45717
|
-
await this.reportAiToolFailures(
|
|
45724
|
+
await this.reportAiToolFailures(reportableToolFailures, {
|
|
45718
45725
|
source: request.source,
|
|
45719
45726
|
sessionKey: request.sessionKey,
|
|
45720
45727
|
jobId: request.jobId ?? null,
|
|
@@ -46386,19 +46393,49 @@ var CODEX_TOOL_FAILURE_MARKER = "OKX_A2A_TOOL_FAILURE_JSON:";
|
|
|
46386
46393
|
function createAiToolFailureTracker(provider) {
|
|
46387
46394
|
const failures = [];
|
|
46388
46395
|
const claudeToolCommands = /* @__PURE__ */ new Map();
|
|
46396
|
+
let sequence = 0;
|
|
46397
|
+
let lastCompletedSequence = null;
|
|
46398
|
+
let turnCompleted = false;
|
|
46389
46399
|
return {
|
|
46390
46400
|
failures,
|
|
46391
46401
|
processLine(line) {
|
|
46392
46402
|
if (!line) {
|
|
46393
46403
|
return;
|
|
46394
46404
|
}
|
|
46405
|
+
sequence += 1;
|
|
46406
|
+
if (provider === "codex") {
|
|
46407
|
+
lastCompletedSequence = parseCodexCompletedItemSequence(line, sequence) ?? lastCompletedSequence;
|
|
46408
|
+
turnCompleted ||= isCodexTurnCompleted(line);
|
|
46409
|
+
}
|
|
46395
46410
|
const failure = parseAiToolFailureLine(provider, line, claudeToolCommands);
|
|
46396
46411
|
if (failure) {
|
|
46397
|
-
failures.push(failure);
|
|
46412
|
+
failures.push({ ...failure, sequence });
|
|
46398
46413
|
}
|
|
46399
|
-
}
|
|
46414
|
+
},
|
|
46415
|
+
lastCompletedSequence: () => lastCompletedSequence,
|
|
46416
|
+
turnCompleted: () => turnCompleted
|
|
46400
46417
|
};
|
|
46401
46418
|
}
|
|
46419
|
+
function isCodexTurnCompleted(line) {
|
|
46420
|
+
try {
|
|
46421
|
+
const event = JSON.parse(line);
|
|
46422
|
+
return isRecord(event) && event.type === "turn.completed";
|
|
46423
|
+
} catch {
|
|
46424
|
+
return false;
|
|
46425
|
+
}
|
|
46426
|
+
}
|
|
46427
|
+
function parseCodexCompletedItemSequence(line, sequence) {
|
|
46428
|
+
let event;
|
|
46429
|
+
try {
|
|
46430
|
+
event = JSON.parse(line);
|
|
46431
|
+
} catch {
|
|
46432
|
+
return null;
|
|
46433
|
+
}
|
|
46434
|
+
if (!isRecord(event) || event.type !== "item.completed" || !isRecord(event.item) || event.item.status !== "completed") {
|
|
46435
|
+
return null;
|
|
46436
|
+
}
|
|
46437
|
+
return sequence;
|
|
46438
|
+
}
|
|
46402
46439
|
function parseAiToolFailureLine(provider, line, claudeToolCommands) {
|
|
46403
46440
|
let event;
|
|
46404
46441
|
try {
|
|
@@ -46442,6 +46479,8 @@ function parseCodexCommandExecutionFailure(item, rawEvent) {
|
|
|
46442
46479
|
provider: "codex",
|
|
46443
46480
|
tool: "command_execution",
|
|
46444
46481
|
errorType: errorType === "unknown" ? "tool_failed" : errorType,
|
|
46482
|
+
origin: "command_execution",
|
|
46483
|
+
sequence: 0,
|
|
46445
46484
|
command: typeof item.command === "string" ? item.command : void 0,
|
|
46446
46485
|
exitCode,
|
|
46447
46486
|
status,
|
|
@@ -46466,6 +46505,8 @@ function parseCodexAgentMessageFailure(item, rawEvent) {
|
|
|
46466
46505
|
provider: "codex",
|
|
46467
46506
|
tool: marker.tool,
|
|
46468
46507
|
errorType: marker.errorType,
|
|
46508
|
+
origin: marker.origin,
|
|
46509
|
+
sequence: marker.sequence,
|
|
46469
46510
|
permissionKind: marker.permissionKind,
|
|
46470
46511
|
permissionTarget: marker.permissionTarget,
|
|
46471
46512
|
suggestedAddDir: marker.suggestedAddDir,
|
|
@@ -46504,6 +46545,8 @@ function normalizeCodexStructuredToolFailure(toolFailure, rawEvent) {
|
|
|
46504
46545
|
provider: "codex",
|
|
46505
46546
|
tool,
|
|
46506
46547
|
errorType: "permission_denied",
|
|
46548
|
+
origin: "structured_final",
|
|
46549
|
+
sequence: 0,
|
|
46507
46550
|
permissionKind,
|
|
46508
46551
|
permissionTarget,
|
|
46509
46552
|
suggestedAddDir,
|
|
@@ -46542,6 +46585,8 @@ function extractCodexToolFailureMarker(text) {
|
|
|
46542
46585
|
provider: "codex",
|
|
46543
46586
|
tool,
|
|
46544
46587
|
errorType: "permission_denied",
|
|
46588
|
+
origin: "permission_marker",
|
|
46589
|
+
sequence: 0,
|
|
46545
46590
|
permissionKind,
|
|
46546
46591
|
permissionTarget,
|
|
46547
46592
|
suggestedAddDir,
|
|
@@ -46577,6 +46622,9 @@ function inferPermissionDetails(failure) {
|
|
|
46577
46622
|
const normalized = text.toLowerCase();
|
|
46578
46623
|
const filesystemTarget = extractDeniedFilesystemPath(text);
|
|
46579
46624
|
if (failure.provider === "codex" && filesystemTarget && (normalized.includes("operation not permitted") || normalized.includes("permission denied"))) {
|
|
46625
|
+
if (isBroadFilesystemDiscoveryCommand(failure.command)) {
|
|
46626
|
+
return { permissionKind: "filesystem_sandbox" };
|
|
46627
|
+
}
|
|
46580
46628
|
const suggestedAddDir = getPreferredCodexWritableRoot(filesystemTarget);
|
|
46581
46629
|
return {
|
|
46582
46630
|
permissionKind: "filesystem_sandbox",
|
|
@@ -46600,6 +46648,12 @@ function inferPermissionDetails(failure) {
|
|
|
46600
46648
|
}
|
|
46601
46649
|
return { permissionKind: "unknown" };
|
|
46602
46650
|
}
|
|
46651
|
+
function isBroadFilesystemDiscoveryCommand(command) {
|
|
46652
|
+
if (!command) {
|
|
46653
|
+
return false;
|
|
46654
|
+
}
|
|
46655
|
+
return /(?:^|[\s"'`;&|()])(?:[^\s"'`;&|()]+\/)?find(?:\s+(?:-[HLPXdxsE]|-O[^\s"'`;&|()]+|-D\s+[^\s"'`;&|()]+|--))*\s+["']?(?:\/|~(?:\/(?:\.)?)?|\$(?:HOME|\{HOME\})(?:\/(?:\.)?)?|\/(?:Users|home)\/[^/\s"'`;&|()]+(?:\/(?:\.)?)?)["']?(?=$|[\s"'`;&|()])/.test(command);
|
|
46656
|
+
}
|
|
46603
46657
|
function extractDeniedFilesystemPath(text) {
|
|
46604
46658
|
const patterns = [
|
|
46605
46659
|
/(?:^|\n)[^:\n]*:\s*((?:\/|~\/)[^:\n]+):\s*(?:Operation not permitted|Permission denied)(?:\n|$)/i,
|
|
@@ -46673,6 +46727,8 @@ function parseClaudeToolFailure(event, rawEvent, claudeToolCommands) {
|
|
|
46673
46727
|
provider: "claude",
|
|
46674
46728
|
tool: "Bash",
|
|
46675
46729
|
errorType: errorType === "unknown" ? "tool_failed" : errorType,
|
|
46730
|
+
origin: "command_execution",
|
|
46731
|
+
sequence: 0,
|
|
46676
46732
|
command: toolResult?.toolUseId ? claudeToolCommands.get(toolResult.toolUseId) : void 0,
|
|
46677
46733
|
exitCode: explicitExitCode,
|
|
46678
46734
|
status: isError ? "error" : "failed",
|
|
@@ -47084,6 +47140,16 @@ function isDynamicOnchainosArg(token) {
|
|
|
47084
47140
|
function isReportableAiToolFailure(failure) {
|
|
47085
47141
|
return failure.errorType === "permission_denied";
|
|
47086
47142
|
}
|
|
47143
|
+
function selectReportableAiToolFailures(input) {
|
|
47144
|
+
const reportable = input.failures.filter(isReportableAiToolFailure);
|
|
47145
|
+
const completedSequence = input.lastCompletedSequence;
|
|
47146
|
+
if (input.provider !== "codex" || completedSequence === null || !input.runCompletedSuccessfully) {
|
|
47147
|
+
return reportable;
|
|
47148
|
+
}
|
|
47149
|
+
return reportable.filter(
|
|
47150
|
+
(failure) => (failure.sequence ?? Number.MAX_SAFE_INTEGER) >= completedSequence
|
|
47151
|
+
);
|
|
47152
|
+
}
|
|
47087
47153
|
function synthesizeCodexProsePermissionFailure(input) {
|
|
47088
47154
|
if (input.provider !== "codex" || input.errorType !== "permission_denied") {
|
|
47089
47155
|
return null;
|
|
@@ -47099,6 +47165,8 @@ function synthesizeCodexProsePermissionFailure(input) {
|
|
|
47099
47165
|
provider: "codex",
|
|
47100
47166
|
tool: "command_execution",
|
|
47101
47167
|
errorType: "permission_denied",
|
|
47168
|
+
origin: "synthetic",
|
|
47169
|
+
sequence: Number.MAX_SAFE_INTEGER,
|
|
47102
47170
|
exitCode: input.exitCode,
|
|
47103
47171
|
status: "failed",
|
|
47104
47172
|
output,
|
|
@@ -60466,7 +60534,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
|
|
|
60466
60534
|
client: {
|
|
60467
60535
|
id: "gateway-client",
|
|
60468
60536
|
displayName: "okx-a2a-node",
|
|
60469
|
-
version: "0.2.
|
|
60537
|
+
version: "0.2.7",
|
|
60470
60538
|
platform: "node",
|
|
60471
60539
|
mode: "backend",
|
|
60472
60540
|
instanceId
|
|
@@ -60477,7 +60545,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
|
|
|
60477
60545
|
commands: [],
|
|
60478
60546
|
permissions: {},
|
|
60479
60547
|
locale: Intl.DateTimeFormat().resolvedOptions().locale || "en-US",
|
|
60480
|
-
userAgent: `okx-a2a-node/${"0.2.
|
|
60548
|
+
userAgent: `okx-a2a-node/${"0.2.7"}`,
|
|
60481
60549
|
auth: {
|
|
60482
60550
|
...config.token ? { token: config.token } : {},
|
|
60483
60551
|
...config.password ? { password: config.password } : {}
|
|
@@ -66664,12 +66732,12 @@ async function runListenerWithLock(options, paths) {
|
|
|
66664
66732
|
});
|
|
66665
66733
|
}
|
|
66666
66734
|
});
|
|
66667
|
-
service.setPluginVersion("0.2.
|
|
66735
|
+
service.setPluginVersion("0.2.7");
|
|
66668
66736
|
await service.init();
|
|
66669
66737
|
const pluginVersionStatus = service.pluginVersionStatus;
|
|
66670
66738
|
if (pluginVersionStatus.unavailable) {
|
|
66671
66739
|
throw new Error(
|
|
66672
|
-
`@okxweb3/a2a-node v${"0.2.
|
|
66740
|
+
`@okxweb3/a2a-node v${"0.2.7"} is below the required minimum v${pluginVersionStatus.minVersion}`
|
|
66673
66741
|
);
|
|
66674
66742
|
}
|
|
66675
66743
|
const systemConfig = service.getSystemConfig();
|
|
@@ -66687,7 +66755,7 @@ async function runListenerWithLock(options, paths) {
|
|
|
66687
66755
|
onchainosAgentId: "*",
|
|
66688
66756
|
reason: "system-config missing sentryDsn",
|
|
66689
66757
|
pluginId: "@okxweb3/a2a-node",
|
|
66690
|
-
pluginVersion: "0.2.
|
|
66758
|
+
pluginVersion: "0.2.7"
|
|
66691
66759
|
});
|
|
66692
66760
|
}
|
|
66693
66761
|
logWithTimestamp(
|
|
@@ -69385,7 +69453,7 @@ async function exportDiagnosticLogs(options) {
|
|
|
69385
69453
|
node: process.version,
|
|
69386
69454
|
platform: process.platform,
|
|
69387
69455
|
arch: process.arch,
|
|
69388
|
-
packageVersion: true ? "0.2.
|
|
69456
|
+
packageVersion: true ? "0.2.7" : "unknown",
|
|
69389
69457
|
sensitiveContentIncluded: options.includeSensitiveContent,
|
|
69390
69458
|
listenerAndLlmContentIncluded: true,
|
|
69391
69459
|
credentialsAlwaysRedacted: true,
|
|
@@ -71248,7 +71316,7 @@ async function runDoctor(options = {}) {
|
|
|
71248
71316
|
platform: options.platform ?? process.platform,
|
|
71249
71317
|
env: options.env ?? process.env,
|
|
71250
71318
|
target: options.target ?? resolveDoctorTarget(options.env ?? process.env),
|
|
71251
|
-
cliVersion: options.cliVersion ?? (true ? "0.2.
|
|
71319
|
+
cliVersion: options.cliVersion ?? (true ? "0.2.7" : "0.0.0"),
|
|
71252
71320
|
fixMode: options.fix === true,
|
|
71253
71321
|
nonInteractive: options.nonInteractive === true,
|
|
71254
71322
|
packageChanged: false,
|