@okxweb3/a2a-node 0.2.8-beta-174fcb5625-260819112349 → 0.2.8
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 +427 -58
- package/dist/index.js +419 -44
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1536,6 +1536,16 @@ var init_session_store = __esm({
|
|
|
1536
1536
|
}
|
|
1537
1537
|
return null;
|
|
1538
1538
|
}
|
|
1539
|
+
setAiRuntimeSurface(surface) {
|
|
1540
|
+
if (surface !== "desktop" && surface !== "cli" && surface !== "unknown") {
|
|
1541
|
+
throw new Error(`Unsupported AI runtime surface: ${surface}`);
|
|
1542
|
+
}
|
|
1543
|
+
this.setSetting("ai_runtime_surface", surface);
|
|
1544
|
+
}
|
|
1545
|
+
getAiRuntimeSurface() {
|
|
1546
|
+
const value = this.getSetting("ai_runtime_surface");
|
|
1547
|
+
return value === "desktop" || value === "cli" || value === "unknown" ? value : null;
|
|
1548
|
+
}
|
|
1539
1549
|
setAiProviderCommand(provider, command) {
|
|
1540
1550
|
assertAiProvider(provider);
|
|
1541
1551
|
assertNonEmpty(command, "command");
|
|
@@ -2712,7 +2722,7 @@ __export(autostart_exports, {
|
|
|
2712
2722
|
uninstallSystemdAutostart: () => uninstallSystemdAutostart
|
|
2713
2723
|
});
|
|
2714
2724
|
function isSystemdManagerUnavailableMessage(message) {
|
|
2715
|
-
return /spawn systemctl ENOENT|system has not been booted with systemd|failed to connect to bus/i.test(message);
|
|
2725
|
+
return /spawn systemctl ENOENT|system has not been booted with systemd|failed to connect to bus|systemctl shim:\s*unsupported unit\b/i.test(message);
|
|
2716
2726
|
}
|
|
2717
2727
|
function isAutostartManagerUnavailableError(error) {
|
|
2718
2728
|
return error instanceof AutostartManagerUnavailableError || typeof error === "object" && error !== null && "code" in error && error.code === "AUTOSTART_MANAGER_UNAVAILABLE";
|
|
@@ -2842,35 +2852,81 @@ async function runSystemctl(args, options = {}) {
|
|
|
2842
2852
|
throw new Error(message);
|
|
2843
2853
|
}
|
|
2844
2854
|
}
|
|
2845
|
-
async function
|
|
2855
|
+
async function systemdRuntimePresence() {
|
|
2856
|
+
if (process.platform !== "linux") {
|
|
2857
|
+
return "unknown";
|
|
2858
|
+
}
|
|
2859
|
+
if ((0, import_node_fs6.existsSync)("/run/systemd/system")) {
|
|
2860
|
+
return "present";
|
|
2861
|
+
}
|
|
2862
|
+
const runtimeDir = process.env.XDG_RUNTIME_DIR?.trim();
|
|
2863
|
+
if (runtimeDir && (0, import_node_fs6.existsSync)((0, import_node_path9.join)(runtimeDir, "systemd"))) {
|
|
2864
|
+
return "present";
|
|
2865
|
+
}
|
|
2866
|
+
try {
|
|
2867
|
+
const initName = (await (0, import_promises3.readFile)("/proc/1/comm", "utf8")).trim();
|
|
2868
|
+
return initName === "systemd" ? "present" : "absent";
|
|
2869
|
+
} catch {
|
|
2870
|
+
return "unknown";
|
|
2871
|
+
}
|
|
2872
|
+
}
|
|
2873
|
+
function isDefinitiveSystemdUnavailableMessage(message) {
|
|
2874
|
+
return /spawn systemctl ENOENT|system has not been booted with systemd|systemctl shim:\s*unsupported unit\b/i.test(message);
|
|
2875
|
+
}
|
|
2876
|
+
async function classifyFailedSystemdProbe(message, options = {}) {
|
|
2877
|
+
if (isDefinitiveSystemdUnavailableMessage(message)) {
|
|
2878
|
+
return "unavailable";
|
|
2879
|
+
}
|
|
2880
|
+
if (options.previouslyAvailable) {
|
|
2881
|
+
return "unknown";
|
|
2882
|
+
}
|
|
2883
|
+
const runtime = await systemdRuntimePresence();
|
|
2884
|
+
if (runtime === "absent") {
|
|
2885
|
+
return "unavailable";
|
|
2886
|
+
}
|
|
2887
|
+
if (runtime === "present") {
|
|
2888
|
+
return "unknown";
|
|
2889
|
+
}
|
|
2890
|
+
return isSystemdManagerUnavailableMessage(message) ? "unavailable" : "unknown";
|
|
2891
|
+
}
|
|
2892
|
+
async function probeSystemdManager(options = {}) {
|
|
2846
2893
|
const manager = await runSystemctl(["show", "--property=Version", "--value"], { tolerateFailure: true });
|
|
2847
2894
|
if (!manager.ok) {
|
|
2848
2895
|
const message = (manager.stderr || manager.stdout).trim();
|
|
2849
2896
|
return {
|
|
2850
|
-
|
|
2897
|
+
state: await classifyFailedSystemdProbe(message, options),
|
|
2851
2898
|
message: message || "systemd user manager is unavailable"
|
|
2852
2899
|
};
|
|
2853
2900
|
}
|
|
2854
|
-
return {
|
|
2901
|
+
return { state: "available" };
|
|
2855
2902
|
}
|
|
2856
|
-
async function probeSystemdUnitOwnership() {
|
|
2857
|
-
const manager = await probeSystemdManager();
|
|
2858
|
-
if (
|
|
2859
|
-
return manager;
|
|
2903
|
+
async function probeSystemdUnitOwnership(options = {}) {
|
|
2904
|
+
const manager = await probeSystemdManager({ previouslyAvailable: options.managerPreviouslyAvailable });
|
|
2905
|
+
if (manager.state !== "available") {
|
|
2906
|
+
return { state: manager.state, ...manager.message ? { message: manager.message } : {} };
|
|
2860
2907
|
}
|
|
2861
2908
|
const unit = await runSystemctl(
|
|
2862
2909
|
["show", SERVICE_NAME, "--property=LoadState", "--value"],
|
|
2863
2910
|
{ tolerateFailure: true }
|
|
2864
2911
|
);
|
|
2865
2912
|
const loadState = unit.stdout.trim().toLowerCase();
|
|
2866
|
-
if (
|
|
2867
|
-
|
|
2913
|
+
if (unit.ok) {
|
|
2914
|
+
if (loadState === "loaded") {
|
|
2915
|
+
return { state: "managed" };
|
|
2916
|
+
}
|
|
2868
2917
|
return {
|
|
2869
|
-
|
|
2870
|
-
message:
|
|
2918
|
+
state: "unmanaged",
|
|
2919
|
+
message: `systemd reports ${SERVICE_NAME} LoadState=${loadState || "unknown"}`
|
|
2871
2920
|
};
|
|
2872
2921
|
}
|
|
2873
|
-
|
|
2922
|
+
const detail = (unit.stderr || unit.stdout).trim();
|
|
2923
|
+
if (loadState || isSystemdMissingServiceMessage(detail)) {
|
|
2924
|
+
return { state: "unmanaged", ...detail ? { message: detail } : {} };
|
|
2925
|
+
}
|
|
2926
|
+
return {
|
|
2927
|
+
state: await classifyFailedSystemdProbe(detail, { previouslyAvailable: true }),
|
|
2928
|
+
message: detail || `could not verify whether systemd manages ${SERVICE_NAME}`
|
|
2929
|
+
};
|
|
2874
2930
|
}
|
|
2875
2931
|
async function runLaunchctl(args, options = {}) {
|
|
2876
2932
|
try {
|
|
@@ -2906,20 +2962,16 @@ async function installSystemdAutostart() {
|
|
|
2906
2962
|
const paths = resolveSystemdAutostartPaths();
|
|
2907
2963
|
const previousContent = (0, import_node_fs6.existsSync)(paths.servicePath) ? await (0, import_promises3.readFile)(paths.servicePath, "utf8") : null;
|
|
2908
2964
|
const manager = await probeSystemdManager();
|
|
2909
|
-
if (
|
|
2965
|
+
if (manager.state === "unavailable") {
|
|
2910
2966
|
await (0, import_promises3.rm)(paths.servicePath, { force: true });
|
|
2911
2967
|
throw new AutostartManagerUnavailableError(
|
|
2912
2968
|
manager.message || "systemd user manager is unavailable"
|
|
2913
2969
|
);
|
|
2914
2970
|
}
|
|
2915
|
-
if (
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
throw new AutostartManagerUnavailableError(
|
|
2920
|
-
ownership.message || `systemd does not manage ${SERVICE_NAME}`
|
|
2921
|
-
);
|
|
2922
|
-
}
|
|
2971
|
+
if (manager.state === "unknown") {
|
|
2972
|
+
throw new Error(
|
|
2973
|
+
`could not verify systemd user manager availability${manager.message ? `: ${manager.message}` : ""}`
|
|
2974
|
+
);
|
|
2923
2975
|
}
|
|
2924
2976
|
await (0, import_promises3.mkdir)(paths.serviceDir, { recursive: true });
|
|
2925
2977
|
await (0, import_promises3.writeFile)(paths.servicePath, buildSystemdUserService(), "utf8");
|
|
@@ -2927,11 +2979,21 @@ async function installSystemdAutostart() {
|
|
|
2927
2979
|
await runSystemctl(["daemon-reload"]);
|
|
2928
2980
|
await runSystemctl(["enable", "--now", SERVICE_NAME]);
|
|
2929
2981
|
} catch (error) {
|
|
2930
|
-
|
|
2982
|
+
const managerAfterFailure = await probeSystemdManager({ previouslyAvailable: true });
|
|
2983
|
+
if (managerAfterFailure.state === "unavailable") {
|
|
2984
|
+
await (0, import_promises3.rm)(paths.servicePath, { force: true });
|
|
2985
|
+
throw new AutostartManagerUnavailableError(
|
|
2986
|
+
managerAfterFailure.message || (error instanceof Error ? error.message : String(error))
|
|
2987
|
+
);
|
|
2988
|
+
}
|
|
2989
|
+
if (previousContent === null) {
|
|
2931
2990
|
await (0, import_promises3.rm)(paths.servicePath, { force: true });
|
|
2932
2991
|
} else {
|
|
2933
2992
|
await (0, import_promises3.writeFile)(paths.servicePath, previousContent, "utf8");
|
|
2934
2993
|
}
|
|
2994
|
+
if (isAutostartManagerUnavailableError(error)) {
|
|
2995
|
+
throw new Error(error instanceof Error ? error.message : String(error));
|
|
2996
|
+
}
|
|
2935
2997
|
throw error;
|
|
2936
2998
|
}
|
|
2937
2999
|
return { platform: "linux-systemd", path: paths.servicePath };
|
|
@@ -2962,7 +3024,7 @@ async function stopSystemdAutostart() {
|
|
|
2962
3024
|
return {
|
|
2963
3025
|
platform: "linux-systemd",
|
|
2964
3026
|
path: paths.servicePath,
|
|
2965
|
-
stopped: !missing,
|
|
3027
|
+
stopped: result.ok && !missing,
|
|
2966
3028
|
...message ? { message } : {}
|
|
2967
3029
|
};
|
|
2968
3030
|
}
|
|
@@ -2977,7 +3039,7 @@ async function restartSystemdAutostart() {
|
|
|
2977
3039
|
};
|
|
2978
3040
|
}
|
|
2979
3041
|
const ownership = await probeSystemdUnitOwnership();
|
|
2980
|
-
if (
|
|
3042
|
+
if (ownership.state === "unavailable") {
|
|
2981
3043
|
await (0, import_promises3.rm)(paths.servicePath, { force: true });
|
|
2982
3044
|
return {
|
|
2983
3045
|
platform: "linux-systemd",
|
|
@@ -2987,11 +3049,27 @@ async function restartSystemdAutostart() {
|
|
|
2987
3049
|
...ownership.message ? { message: ownership.message } : {}
|
|
2988
3050
|
};
|
|
2989
3051
|
}
|
|
3052
|
+
if (ownership.state === "unknown") {
|
|
3053
|
+
return {
|
|
3054
|
+
platform: "linux-systemd",
|
|
3055
|
+
path: paths.servicePath,
|
|
3056
|
+
restarted: false,
|
|
3057
|
+
message: ownership.message || `could not verify whether systemd manages ${SERVICE_NAME}`
|
|
3058
|
+
};
|
|
3059
|
+
}
|
|
3060
|
+
if (ownership.state === "unmanaged") {
|
|
3061
|
+
const installed = await installSystemdAutostart();
|
|
3062
|
+
return {
|
|
3063
|
+
...installed,
|
|
3064
|
+
restarted: true,
|
|
3065
|
+
...ownership.message ? { message: `systemd service was not loaded; reinstalled autostart. ${ownership.message}` } : {}
|
|
3066
|
+
};
|
|
3067
|
+
}
|
|
2990
3068
|
const result = await runSystemctl(["restart", SERVICE_NAME], { tolerateFailure: true });
|
|
2991
3069
|
const message = (result.stderr || result.stdout).trim();
|
|
2992
3070
|
if (!result.ok) {
|
|
2993
|
-
const ownershipAfterFailure = await probeSystemdUnitOwnership();
|
|
2994
|
-
if (
|
|
3071
|
+
const ownershipAfterFailure = await probeSystemdUnitOwnership({ managerPreviouslyAvailable: true });
|
|
3072
|
+
if (ownershipAfterFailure.state === "unavailable") {
|
|
2995
3073
|
await (0, import_promises3.rm)(paths.servicePath, { force: true });
|
|
2996
3074
|
return {
|
|
2997
3075
|
platform: "linux-systemd",
|
|
@@ -3001,6 +3079,14 @@ async function restartSystemdAutostart() {
|
|
|
3001
3079
|
message: ownershipAfterFailure.message || message
|
|
3002
3080
|
};
|
|
3003
3081
|
}
|
|
3082
|
+
if (ownershipAfterFailure.state === "unmanaged") {
|
|
3083
|
+
const installed = await installSystemdAutostart();
|
|
3084
|
+
return {
|
|
3085
|
+
...installed,
|
|
3086
|
+
restarted: true,
|
|
3087
|
+
message: ownershipAfterFailure.message || message
|
|
3088
|
+
};
|
|
3089
|
+
}
|
|
3004
3090
|
}
|
|
3005
3091
|
return {
|
|
3006
3092
|
platform: "linux-systemd",
|
|
@@ -19189,6 +19275,7 @@ var init_events = __esm({
|
|
|
19189
19275
|
PROVIDER_READINESS_CHECKED: "Provider readiness checked",
|
|
19190
19276
|
PROVIDER_SWITCHED: "Provider switched",
|
|
19191
19277
|
JOB_PROVIDER_BOUND: "Job provider bound",
|
|
19278
|
+
ONCHAINOS_VERSION_OBSERVED: "OnchainOS version observed",
|
|
19192
19279
|
// Hermes user-channel delivery only. The node and openclaw user-channel hops
|
|
19193
19280
|
// keep emitting USER_DISPATCHED / PROMPT_USER_CHECKPOINT — one name per
|
|
19194
19281
|
// transport is the whole point of splitting the send events.
|
|
@@ -19725,7 +19812,84 @@ var init_error_diagnostics = __esm({
|
|
|
19725
19812
|
}
|
|
19726
19813
|
});
|
|
19727
19814
|
|
|
19815
|
+
// ../core/src/sentry-logger/runtime-metadata.ts
|
|
19816
|
+
function normalizeAiRuntimeProvider(provider) {
|
|
19817
|
+
const normalized = provider?.trim().toLowerCase();
|
|
19818
|
+
if (normalized === "codex") {
|
|
19819
|
+
return "codex";
|
|
19820
|
+
}
|
|
19821
|
+
if (normalized === "claude" || normalized === "claude-code") {
|
|
19822
|
+
return "claude-code";
|
|
19823
|
+
}
|
|
19824
|
+
if (normalized === "openclaw") {
|
|
19825
|
+
return "openclaw";
|
|
19826
|
+
}
|
|
19827
|
+
if (normalized === "hermes") {
|
|
19828
|
+
return "hermes";
|
|
19829
|
+
}
|
|
19830
|
+
return "unknown";
|
|
19831
|
+
}
|
|
19832
|
+
function detectAiRuntimeSurface(provider, env = process.env) {
|
|
19833
|
+
const override = env.OKX_A2A_RUNTIME_SURFACE?.trim().toLowerCase();
|
|
19834
|
+
if (override === "desktop" || override === "cli" || override === "unknown") {
|
|
19835
|
+
return override;
|
|
19836
|
+
}
|
|
19837
|
+
const normalizedProvider = normalizeAiRuntimeProvider(provider);
|
|
19838
|
+
if (normalizedProvider === "codex") {
|
|
19839
|
+
return env.CODEX_INTERNAL_ORIGINATOR_OVERRIDE === "Codex Desktop" ? "desktop" : "cli";
|
|
19840
|
+
}
|
|
19841
|
+
if (normalizedProvider === "claude-code") {
|
|
19842
|
+
return env.CLAUDE_CODE_ENTRYPOINT?.trim().toLowerCase() === "remote_cowork" ? "desktop" : "cli";
|
|
19843
|
+
}
|
|
19844
|
+
return "unknown";
|
|
19845
|
+
}
|
|
19846
|
+
function parseOnchainosVersionOutput(output) {
|
|
19847
|
+
const normalized = output.trim().replace(/\s+/g, " ");
|
|
19848
|
+
if (!normalized) {
|
|
19849
|
+
return UNKNOWN_RUNTIME_METADATA;
|
|
19850
|
+
}
|
|
19851
|
+
const match = ` ${normalized} `.match(SEMVER_PATTERN);
|
|
19852
|
+
return match?.[1]?.slice(0, 128) ?? UNKNOWN_RUNTIME_METADATA;
|
|
19853
|
+
}
|
|
19854
|
+
function runtimeMetadataFields(input = {}) {
|
|
19855
|
+
const observedAt = Number(input.onchainosVersionObservedAtMs);
|
|
19856
|
+
return {
|
|
19857
|
+
aiProvider: normalizeAiRuntimeProvider(input.aiProvider),
|
|
19858
|
+
runtimeSurface: input.runtimeSurface === "desktop" || input.runtimeSurface === "cli" ? input.runtimeSurface : UNKNOWN_RUNTIME_METADATA,
|
|
19859
|
+
onchainosVersion: typeof input.onchainosVersion === "string" && input.onchainosVersion.trim() ? input.onchainosVersion.trim().slice(0, 128) : UNKNOWN_RUNTIME_METADATA,
|
|
19860
|
+
onchainosVersionObservedAtMs: Number.isFinite(observedAt) && observedAt > 0 ? String(Math.trunc(observedAt)) : "0",
|
|
19861
|
+
onchainosVersionProbeStatus: typeof input.onchainosVersionProbeStatus === "string" && input.onchainosVersionProbeStatus.trim() ? input.onchainosVersionProbeStatus.trim().toLowerCase().slice(0, 32) : UNKNOWN_RUNTIME_METADATA
|
|
19862
|
+
};
|
|
19863
|
+
}
|
|
19864
|
+
var UNKNOWN_RUNTIME_METADATA, SEMVER_PATTERN;
|
|
19865
|
+
var init_runtime_metadata = __esm({
|
|
19866
|
+
"../core/src/sentry-logger/runtime-metadata.ts"() {
|
|
19867
|
+
"use strict";
|
|
19868
|
+
UNKNOWN_RUNTIME_METADATA = "unknown";
|
|
19869
|
+
SEMVER_PATTERN = /(?:^|[^0-9])v?(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?)(?:$|[^0-9A-Za-z.-])/;
|
|
19870
|
+
}
|
|
19871
|
+
});
|
|
19872
|
+
|
|
19728
19873
|
// ../core/src/sentry-logger/index.ts
|
|
19874
|
+
function setRuntimeMetadata(metadata) {
|
|
19875
|
+
const next = runtimeMetadataFields({
|
|
19876
|
+
...RUNTIME_FIELDS,
|
|
19877
|
+
...metadata
|
|
19878
|
+
});
|
|
19879
|
+
RUNTIME_FIELDS = next;
|
|
19880
|
+
try {
|
|
19881
|
+
Sentry.setTags({
|
|
19882
|
+
aiProvider: next.aiProvider,
|
|
19883
|
+
runtimeSurface: next.runtimeSurface,
|
|
19884
|
+
onchainosVersion: next.onchainosVersion,
|
|
19885
|
+
onchainosVersionProbeStatus: next.onchainosVersionProbeStatus
|
|
19886
|
+
});
|
|
19887
|
+
} catch {
|
|
19888
|
+
}
|
|
19889
|
+
}
|
|
19890
|
+
function getRuntimeMetadata() {
|
|
19891
|
+
return { ...RUNTIME_FIELDS };
|
|
19892
|
+
}
|
|
19729
19893
|
function applyFatalEventDefaults(event) {
|
|
19730
19894
|
try {
|
|
19731
19895
|
const classified = event?.extra?.eventName ?? event?.tags?.eventName;
|
|
@@ -19735,6 +19899,7 @@ function applyFatalEventDefaults(event) {
|
|
|
19735
19899
|
const target = event;
|
|
19736
19900
|
target.extra = {
|
|
19737
19901
|
...RELEASE_FIELDS,
|
|
19902
|
+
...RUNTIME_FIELDS,
|
|
19738
19903
|
...target.extra ?? {},
|
|
19739
19904
|
eventName: LogEvent.FATAL_UNCAUGHT,
|
|
19740
19905
|
eventFamily: "diagnostics",
|
|
@@ -19755,6 +19920,9 @@ function applyFatalEventDefaults(event) {
|
|
|
19755
19920
|
function isInfoEventAllowlisted(name) {
|
|
19756
19921
|
return SENTRY_INFO_ALLOWLIST.has(name);
|
|
19757
19922
|
}
|
|
19923
|
+
function isTagKey(key) {
|
|
19924
|
+
return SENTRY_TAG_KEYS.has(key);
|
|
19925
|
+
}
|
|
19758
19926
|
function agentExtras(identity) {
|
|
19759
19927
|
return {
|
|
19760
19928
|
walletAddress: identity.walletAddress || UNKNOWN_FIELD,
|
|
@@ -19763,7 +19931,7 @@ function agentExtras(identity) {
|
|
|
19763
19931
|
role: identity.role != null && identity.role !== "" ? String(identity.role) : UNKNOWN_FIELD
|
|
19764
19932
|
};
|
|
19765
19933
|
}
|
|
19766
|
-
var Sentry, import_node_crypto3, FLOW_ID, SENTRY_EXTRA_BLOCKLIST, SENTRY_EXTRA_BLOCKED_KEY_PARTS, SENTRY_FULL_STRING_EXTRA_KEYS, SENTRY_TAG_KEYS, SENTRY_FINGERPRINT_KEYS, SENTRY_INFO_ALLOWLIST, MAX_EXTRA_STRING_LENGTH, MAX_TAG_VALUE_LENGTH, RELEASE_FIELDS, SentryLogger, logger, initLogger, shutdown, UNKNOWN_FIELD;
|
|
19934
|
+
var Sentry, import_node_crypto3, FLOW_ID, SENTRY_EXTRA_BLOCKLIST, SENTRY_EXTRA_BLOCKED_KEY_PARTS, SENTRY_FULL_STRING_EXTRA_KEYS, SENTRY_TAG_KEYS, SENTRY_FINGERPRINT_KEYS, SENTRY_INFO_ALLOWLIST, MAX_EXTRA_STRING_LENGTH, MAX_TAG_VALUE_LENGTH, RELEASE_FIELDS, RUNTIME_FIELDS, SentryLogger, logger, initLogger, shutdown, UNKNOWN_FIELD;
|
|
19767
19935
|
var init_sentry_logger = __esm({
|
|
19768
19936
|
"../core/src/sentry-logger/index.ts"() {
|
|
19769
19937
|
"use strict";
|
|
@@ -19774,6 +19942,7 @@ var init_sentry_logger = __esm({
|
|
|
19774
19942
|
init_log_fields();
|
|
19775
19943
|
init_xmtp_test_metrics();
|
|
19776
19944
|
init_error_diagnostics();
|
|
19945
|
+
init_runtime_metadata();
|
|
19777
19946
|
init_events();
|
|
19778
19947
|
init_log_fields();
|
|
19779
19948
|
FLOW_ID = (0, import_node_crypto3.randomUUID)();
|
|
@@ -19860,6 +20029,7 @@ var init_sentry_logger = __esm({
|
|
|
19860
20029
|
SENTRY_TAG_KEYS = /* @__PURE__ */ new Set([
|
|
19861
20030
|
"agentId",
|
|
19862
20031
|
"agentPlatform",
|
|
20032
|
+
"aiProvider",
|
|
19863
20033
|
"cacheName",
|
|
19864
20034
|
"causeCode",
|
|
19865
20035
|
"causeType",
|
|
@@ -19882,6 +20052,8 @@ var init_sentry_logger = __esm({
|
|
|
19882
20052
|
"kind",
|
|
19883
20053
|
"method",
|
|
19884
20054
|
"onchainosAgentId",
|
|
20055
|
+
"onchainosVersion",
|
|
20056
|
+
"onchainosVersionProbeStatus",
|
|
19885
20057
|
"operation",
|
|
19886
20058
|
"originPlatform",
|
|
19887
20059
|
"outcome",
|
|
@@ -19898,6 +20070,7 @@ var init_sentry_logger = __esm({
|
|
|
19898
20070
|
"role",
|
|
19899
20071
|
"runId",
|
|
19900
20072
|
"runtimeContainer",
|
|
20073
|
+
"runtimeSurface",
|
|
19901
20074
|
"senderAgentId",
|
|
19902
20075
|
"source",
|
|
19903
20076
|
"stage",
|
|
@@ -19968,6 +20141,7 @@ var init_sentry_logger = __esm({
|
|
|
19968
20141
|
LogEvent.PROVIDER_READINESS_CHECKED,
|
|
19969
20142
|
LogEvent.PROVIDER_SWITCHED,
|
|
19970
20143
|
LogEvent.JOB_PROVIDER_BOUND,
|
|
20144
|
+
LogEvent.ONCHAINOS_VERSION_OBSERVED,
|
|
19971
20145
|
LogEvent.USER_CHANNEL_MESSAGE_DELIVERED,
|
|
19972
20146
|
LogEvent.SYSTEM_NOTIFICATION_RECEIVED,
|
|
19973
20147
|
LogEvent.SYSTEM_NOTIFICATION_ROUTED,
|
|
@@ -20023,6 +20197,7 @@ var init_sentry_logger = __esm({
|
|
|
20023
20197
|
MAX_EXTRA_STRING_LENGTH = 256;
|
|
20024
20198
|
MAX_TAG_VALUE_LENGTH = 128;
|
|
20025
20199
|
RELEASE_FIELDS = {};
|
|
20200
|
+
RUNTIME_FIELDS = runtimeMetadataFields();
|
|
20026
20201
|
SentryLogger = class _SentryLogger {
|
|
20027
20202
|
static instance;
|
|
20028
20203
|
initialized = false;
|
|
@@ -20042,6 +20217,9 @@ var init_sentry_logger = __esm({
|
|
|
20042
20217
|
}
|
|
20043
20218
|
try {
|
|
20044
20219
|
RELEASE_FIELDS = releaseFields(config.release);
|
|
20220
|
+
if (config.runtimeMetadata) {
|
|
20221
|
+
setRuntimeMetadata(config.runtimeMetadata);
|
|
20222
|
+
}
|
|
20045
20223
|
Sentry.init({
|
|
20046
20224
|
dsn: config.dsn,
|
|
20047
20225
|
release: config.release,
|
|
@@ -20061,6 +20239,14 @@ var init_sentry_logger = __esm({
|
|
|
20061
20239
|
if (config.runtimeContainer) {
|
|
20062
20240
|
tags.runtimeContainer = config.runtimeContainer;
|
|
20063
20241
|
}
|
|
20242
|
+
for (const key of [
|
|
20243
|
+
"aiProvider",
|
|
20244
|
+
"runtimeSurface",
|
|
20245
|
+
"onchainosVersion",
|
|
20246
|
+
"onchainosVersionProbeStatus"
|
|
20247
|
+
]) {
|
|
20248
|
+
tags[key] = RUNTIME_FIELDS[key] ?? "unknown";
|
|
20249
|
+
}
|
|
20064
20250
|
Sentry.setTags(tags);
|
|
20065
20251
|
} catch {
|
|
20066
20252
|
return;
|
|
@@ -20073,6 +20259,7 @@ var init_sentry_logger = __esm({
|
|
|
20073
20259
|
enrichCorrelationFields({
|
|
20074
20260
|
flowId: FLOW_ID,
|
|
20075
20261
|
...RELEASE_FIELDS,
|
|
20262
|
+
...RUNTIME_FIELDS,
|
|
20076
20263
|
...extra ?? {}
|
|
20077
20264
|
})
|
|
20078
20265
|
);
|
|
@@ -20107,6 +20294,7 @@ var init_sentry_logger = __esm({
|
|
|
20107
20294
|
enrichCorrelationFields({
|
|
20108
20295
|
flowId: FLOW_ID,
|
|
20109
20296
|
...RELEASE_FIELDS,
|
|
20297
|
+
...RUNTIME_FIELDS,
|
|
20110
20298
|
...extra ?? {}
|
|
20111
20299
|
})
|
|
20112
20300
|
);
|
|
@@ -32247,7 +32435,7 @@ var init_sentry_config = __esm({
|
|
|
32247
32435
|
environment = process.env.SENTRY_ENV === "dev" ? "dev" : "prod";
|
|
32248
32436
|
SENTRY_CONFIG = {
|
|
32249
32437
|
projectName: "okx/openclaw-okx-a2a-extension",
|
|
32250
|
-
release: "0.2.8
|
|
32438
|
+
release: "0.2.8",
|
|
32251
32439
|
environment,
|
|
32252
32440
|
runtimeContainer: normalizeRuntimeContainer(process.env.OKX_A2A_RUNTIME_CONTAINER)
|
|
32253
32441
|
};
|
|
@@ -33188,7 +33376,7 @@ async function getCurrentNodeCliVersion() {
|
|
|
33188
33376
|
return await getGlobalNpmPackageVersion(UPDATE_PACKAGES.node) ?? getBundledNodeCliVersion();
|
|
33189
33377
|
}
|
|
33190
33378
|
function getBundledNodeCliVersion() {
|
|
33191
|
-
return true ? "0.2.8
|
|
33379
|
+
return true ? "0.2.8" : null;
|
|
33192
33380
|
}
|
|
33193
33381
|
function readConfiguredAiProvider() {
|
|
33194
33382
|
const explicit = process.env.OKX_A2A_AI_PROVIDER || process.env.OKX_AGENT_TASK_AI_CLI;
|
|
@@ -33398,7 +33586,7 @@ async function updateHermes(release, options) {
|
|
|
33398
33586
|
}
|
|
33399
33587
|
}
|
|
33400
33588
|
async function installGatewayPluginForDoctor(target) {
|
|
33401
|
-
const release = isPrereleaseVersion("0.2.8
|
|
33589
|
+
const release = isPrereleaseVersion("0.2.8") ? "beta" : "latest";
|
|
33402
33590
|
const insideTargetGateway = detectGatewayInvocation() === target;
|
|
33403
33591
|
const options = {
|
|
33404
33592
|
restart: !insideTargetGateway,
|
|
@@ -43997,6 +44185,11 @@ function initDoctorSentry() {
|
|
|
43997
44185
|
}
|
|
43998
44186
|
try {
|
|
43999
44187
|
const dsn = process.env.OKX_A2A_SENTRY_DSN?.trim() || process.env.SENTRY_DSN?.trim() || FALLBACK_SENTRY_DSN;
|
|
44188
|
+
const aiProvider = normalizeAiRuntimeProvider(detectCurrentAiProvider());
|
|
44189
|
+
setRuntimeMetadata({
|
|
44190
|
+
aiProvider,
|
|
44191
|
+
runtimeSurface: detectAiRuntimeSurface(aiProvider)
|
|
44192
|
+
});
|
|
44000
44193
|
initLogger({
|
|
44001
44194
|
dsn,
|
|
44002
44195
|
...SENTRY_CONFIG,
|
|
@@ -44080,6 +44273,8 @@ var init_doctor_sentry = __esm({
|
|
|
44080
44273
|
"use strict";
|
|
44081
44274
|
init_sentry_config();
|
|
44082
44275
|
init_sentry_logger();
|
|
44276
|
+
init_runtime_metadata();
|
|
44277
|
+
init_ai_provider();
|
|
44083
44278
|
sentryReady = false;
|
|
44084
44279
|
}
|
|
44085
44280
|
});
|
|
@@ -44200,6 +44395,7 @@ __export(index_exports, {
|
|
|
44200
44395
|
createUserAttentionWatchParentMonitor: () => createUserAttentionWatchParentMonitor,
|
|
44201
44396
|
currentOpenClawGatewaySessionKey: () => currentOpenClawGatewaySessionKey,
|
|
44202
44397
|
detectAiProviders: () => detectAiProviders,
|
|
44398
|
+
detectAiRuntimeSurface: () => detectAiRuntimeSurface,
|
|
44203
44399
|
detectCurrentAiProvider: () => detectCurrentAiProvider,
|
|
44204
44400
|
detectGatewayInvocation: () => detectGatewayInvocation,
|
|
44205
44401
|
detectMessageEligibleOfflineReplaySupport: () => detectMessageEligibleOfflineReplaySupport,
|
|
@@ -44220,6 +44416,7 @@ __export(index_exports, {
|
|
|
44220
44416
|
getA2ACapabilities: () => getA2ACapabilities,
|
|
44221
44417
|
getDaemonStatus: () => getDaemonStatus,
|
|
44222
44418
|
getHermesGatewayPluginStatus: () => getHermesGatewayPluginStatus,
|
|
44419
|
+
getRuntimeMetadata: () => getRuntimeMetadata,
|
|
44223
44420
|
getSessionBusyTracker: () => getSessionBusyTracker,
|
|
44224
44421
|
handleCapabilitiesCommand: () => handleCapabilitiesCommand,
|
|
44225
44422
|
handleDoctorCommand: () => handleDoctorCommand,
|
|
@@ -44247,6 +44444,7 @@ __export(index_exports, {
|
|
|
44247
44444
|
isRetryableOpenClawGatewayError: () => isRetryableOpenClawGatewayError,
|
|
44248
44445
|
isSqliteBusyError: () => isSqliteBusyError,
|
|
44249
44446
|
isSystemdManagerUnavailableMessage: () => isSystemdManagerUnavailableMessage,
|
|
44447
|
+
isTagKey: () => isTagKey,
|
|
44250
44448
|
isWindowsElevated: () => isWindowsElevated,
|
|
44251
44449
|
killProcessTree: () => killProcessTree,
|
|
44252
44450
|
launchdPlistHasCurrentRestartPolicy: () => launchdPlistHasCurrentRestartPolicy,
|
|
@@ -44258,16 +44456,19 @@ __export(index_exports, {
|
|
|
44258
44456
|
messageEligibleHelpAdvertisesOfflineReplay: () => messageEligibleHelpAdvertisesOfflineReplay,
|
|
44259
44457
|
nodeVersionSatisfies: () => nodeVersionSatisfies,
|
|
44260
44458
|
normalizeAiProvider: () => normalizeAiProvider,
|
|
44459
|
+
normalizeAiRuntimeProvider: () => normalizeAiRuntimeProvider,
|
|
44261
44460
|
normalizeHermesOkxA2aPluginConfig: () => normalizeHermesOkxA2aPluginConfig,
|
|
44262
44461
|
notifyAgentMessageToUserAttention: () => notifyAgentMessageToUserAttention,
|
|
44263
44462
|
notifyDirectToUserAttention: () => notifyDirectToUserAttention,
|
|
44264
44463
|
notifySystemMessageToUser: () => notifySystemMessageToUser,
|
|
44265
44464
|
notifyUserAttentionChanged: () => notifyUserAttentionChanged,
|
|
44266
44465
|
parseLogsExportArgs: () => parseLogsExportArgs,
|
|
44466
|
+
parseOnchainosVersionOutput: () => parseOnchainosVersionOutput,
|
|
44267
44467
|
parsePluginYamlVersion: () => parsePluginYamlVersion,
|
|
44268
44468
|
parseWalletLoginStatus: () => parseWalletLoginStatus,
|
|
44269
44469
|
parseWindowsParentProcessJson: () => parseWindowsParentProcessJson,
|
|
44270
44470
|
performRuntimeSwitch: () => performRuntimeSwitch,
|
|
44471
|
+
persistAiRuntimeSurfaceBestEffort: () => persistAiRuntimeSurfaceBestEffort,
|
|
44271
44472
|
persistCurrentRuntimeSelectionForNewJob: () => persistCurrentRuntimeSelectionForNewJob,
|
|
44272
44473
|
pickOnchainosWin32Candidate: () => pickOnchainosWin32Candidate,
|
|
44273
44474
|
prepareAndBindCurrentRuntimeForNewJob: () => prepareAndBindCurrentRuntimeForNewJob,
|
|
@@ -44277,11 +44478,13 @@ __export(index_exports, {
|
|
|
44277
44478
|
processFileMessage: () => processFileMessage,
|
|
44278
44479
|
queryWalletLoginStatus: () => queryWalletLoginStatus,
|
|
44279
44480
|
readAiProviderTimeoutMs: () => readAiProviderTimeoutMs,
|
|
44481
|
+
readAiRuntimeSurfaceBestEffort: () => readAiRuntimeSurfaceBestEffort,
|
|
44280
44482
|
readCachedCodexReadiness: () => readCachedCodexReadiness,
|
|
44281
44483
|
readLastLines: () => readLastLines,
|
|
44282
44484
|
readParentProcessCommandForPlatform: () => readParentProcessCommandForPlatform,
|
|
44283
44485
|
readUserAttentionWatcherEvent: () => readUserAttentionWatcherEvent,
|
|
44284
44486
|
refreshAgentsAndWait: () => refreshAgentsAndWait,
|
|
44487
|
+
refreshOnchainosVersionMetadata: () => refreshOnchainosVersionMetadata,
|
|
44285
44488
|
registerUserAttentionWatcher: () => registerUserAttentionWatcher,
|
|
44286
44489
|
releaseActiveDaemon: () => releaseActiveDaemon,
|
|
44287
44490
|
removeUserAttentionWatcher: () => removeUserAttentionWatcher,
|
|
@@ -44323,8 +44526,10 @@ __export(index_exports, {
|
|
|
44323
44526
|
runDoctor: () => runDoctor,
|
|
44324
44527
|
runHeartbeatRefreshCycle: () => runHeartbeatRefreshCycle,
|
|
44325
44528
|
runListener: () => runListener,
|
|
44529
|
+
runtimeMetadataFields: () => runtimeMetadataFields,
|
|
44326
44530
|
scanUserAttentionWatchers: () => scanUserAttentionWatchers,
|
|
44327
44531
|
setOpenClawWebSocketFactoryForTests: () => setOpenClawWebSocketFactoryForTests,
|
|
44532
|
+
setRuntimeMetadata: () => setRuntimeMetadata,
|
|
44328
44533
|
shouldDelegateToSupervisor: () => shouldDelegateToSupervisor,
|
|
44329
44534
|
shouldRouteThroughWindowsShell: () => shouldRouteThroughWindowsShell,
|
|
44330
44535
|
spawnCompat: () => spawnCompat,
|
|
@@ -44336,6 +44541,7 @@ __export(index_exports, {
|
|
|
44336
44541
|
startUserAttentionWatcherCoordinator: () => startUserAttentionWatcherCoordinator,
|
|
44337
44542
|
stopDaemon: () => stopDaemon,
|
|
44338
44543
|
stopOpenClawGateway: () => stopOpenClawGateway,
|
|
44544
|
+
stopSystemdAutostart: () => stopSystemdAutostart,
|
|
44339
44545
|
subscribeUserAttentionEvents: () => subscribeUserAttentionEvents,
|
|
44340
44546
|
summarizeXmtpTestEvents: () => summarizeXmtpTestEvents,
|
|
44341
44547
|
switchProvider: () => switchProvider,
|
|
@@ -45361,6 +45567,8 @@ function aiRunSentryExtra(input) {
|
|
|
45361
45567
|
// Every event this builder feeds describes one AI CLI child process.
|
|
45362
45568
|
transport: "cli",
|
|
45363
45569
|
eventFamily: "ai_run",
|
|
45570
|
+
// A daemon-spawned AI process is not a user-selected Desktop/CLI surface.
|
|
45571
|
+
runtimeSurface: "unknown",
|
|
45364
45572
|
source: input.source,
|
|
45365
45573
|
sessionKey: input.sessionKey,
|
|
45366
45574
|
jobId: input.jobId ?? "",
|
|
@@ -45680,6 +45888,7 @@ var AiRunner = class {
|
|
|
45680
45888
|
env: buildAiProviderEnv(command, {
|
|
45681
45889
|
...process.env,
|
|
45682
45890
|
OKX_A2A_IS_CLI: "1",
|
|
45891
|
+
OKX_A2A_RUNTIME_SURFACE: "unknown",
|
|
45683
45892
|
OKX_AGENT_TASK_AI_PROVIDER: provider,
|
|
45684
45893
|
OKX_A2A_CURRENT_SESSION_KEY: request.sessionKey,
|
|
45685
45894
|
OKX_A2A_CURRENT_MESSAGE_ID: request.messageId,
|
|
@@ -58850,14 +59059,99 @@ var import_node_child_process6 = require("node:child_process");
|
|
|
58850
59059
|
var import_node_path22 = require("node:path");
|
|
58851
59060
|
var import_node_util2 = require("node:util");
|
|
58852
59061
|
init_sentry_logger();
|
|
59062
|
+
init_runtime_metadata();
|
|
58853
59063
|
init_win_compat();
|
|
58854
59064
|
var execFileAsync2 = (0, import_node_util2.promisify)(import_node_child_process6.execFile);
|
|
58855
59065
|
var resolvedBin = null;
|
|
59066
|
+
var versionProbeInFlight = null;
|
|
58856
59067
|
var REDACTED_VALUE_FLAGS = /* @__PURE__ */ new Set(["--message"]);
|
|
59068
|
+
var ONCHAINOS_VERSION_PROBE_TIMEOUT_MS = 5e3;
|
|
59069
|
+
var ONCHAINOS_BIN_RESOLVE_TIMEOUT_MS = 5e3;
|
|
58857
59070
|
function resetResolvedOnchainosBinForTests() {
|
|
58858
59071
|
resolvedBin = null;
|
|
59072
|
+
versionProbeInFlight = null;
|
|
59073
|
+
}
|
|
59074
|
+
async function refreshOnchainosVersionMetadata(options = {}) {
|
|
59075
|
+
const now = options.now ?? Date.now;
|
|
59076
|
+
const current = getRuntimeMetadata();
|
|
59077
|
+
const previousVersion = current.onchainosVersion ?? UNKNOWN_RUNTIME_METADATA;
|
|
59078
|
+
const previousObservedAtMs = Number(current.onchainosVersionObservedAtMs ?? 0);
|
|
59079
|
+
if (versionProbeInFlight) {
|
|
59080
|
+
return versionProbeInFlight;
|
|
59081
|
+
}
|
|
59082
|
+
versionProbeInFlight = (async () => {
|
|
59083
|
+
const observedAtMs = now();
|
|
59084
|
+
try {
|
|
59085
|
+
const bin = await resolve6(
|
|
59086
|
+
options.resolveTimeoutMs ?? ONCHAINOS_BIN_RESOLVE_TIMEOUT_MS
|
|
59087
|
+
);
|
|
59088
|
+
const output = options.runVersionCommand ? await options.runVersionCommand(bin) : await runVersionCommand(bin);
|
|
59089
|
+
const version3 = parseOnchainosVersionOutput(output);
|
|
59090
|
+
if (version3 === UNKNOWN_RUNTIME_METADATA) {
|
|
59091
|
+
throw new Error("OnchainOS version output did not contain a semantic version");
|
|
59092
|
+
}
|
|
59093
|
+
const changed = previousVersion !== UNKNOWN_RUNTIME_METADATA && previousVersion !== version3;
|
|
59094
|
+
setRuntimeMetadata({
|
|
59095
|
+
onchainosVersion: version3,
|
|
59096
|
+
onchainosVersionObservedAtMs: observedAtMs,
|
|
59097
|
+
onchainosVersionProbeStatus: "ok"
|
|
59098
|
+
});
|
|
59099
|
+
if (previousVersion !== version3) {
|
|
59100
|
+
logger.info(LogEvent.ONCHAINOS_VERSION_OBSERVED, {
|
|
59101
|
+
component: "onchainos_cli",
|
|
59102
|
+
source: "onchainos",
|
|
59103
|
+
checkpoint: changed ? "version_changed" : "version_detected",
|
|
59104
|
+
outcome: "success",
|
|
59105
|
+
previousOnchainosVersion: previousVersion,
|
|
59106
|
+
versionChanged: String(changed),
|
|
59107
|
+
onchainosVersionObservedAtMs: String(observedAtMs)
|
|
59108
|
+
});
|
|
59109
|
+
}
|
|
59110
|
+
return {
|
|
59111
|
+
version: version3,
|
|
59112
|
+
observedAtMs,
|
|
59113
|
+
probeStatus: "ok",
|
|
59114
|
+
changed
|
|
59115
|
+
};
|
|
59116
|
+
} catch {
|
|
59117
|
+
const hasLastKnownVersion = previousVersion !== UNKNOWN_RUNTIME_METADATA;
|
|
59118
|
+
setRuntimeMetadata({
|
|
59119
|
+
onchainosVersion: previousVersion,
|
|
59120
|
+
onchainosVersionObservedAtMs: previousObservedAtMs,
|
|
59121
|
+
onchainosVersionProbeStatus: "failed"
|
|
59122
|
+
});
|
|
59123
|
+
if (!hasLastKnownVersion) {
|
|
59124
|
+
logger.info(LogEvent.ONCHAINOS_VERSION_OBSERVED, {
|
|
59125
|
+
component: "onchainos_cli",
|
|
59126
|
+
source: "onchainos",
|
|
59127
|
+
checkpoint: "version_probe_failed",
|
|
59128
|
+
outcome: "failed",
|
|
59129
|
+
reason: "version_unavailable",
|
|
59130
|
+
onchainosVersionObservedAtMs: "0"
|
|
59131
|
+
});
|
|
59132
|
+
}
|
|
59133
|
+
return {
|
|
59134
|
+
version: previousVersion,
|
|
59135
|
+
observedAtMs: previousObservedAtMs,
|
|
59136
|
+
probeStatus: "failed",
|
|
59137
|
+
changed: false
|
|
59138
|
+
};
|
|
59139
|
+
} finally {
|
|
59140
|
+
versionProbeInFlight = null;
|
|
59141
|
+
}
|
|
59142
|
+
})();
|
|
59143
|
+
return versionProbeInFlight;
|
|
59144
|
+
}
|
|
59145
|
+
async function runVersionCommand(bin) {
|
|
59146
|
+
const invocation = toWindowsInvocation(bin, ["--version"]);
|
|
59147
|
+
const result = await execFileAsync2(invocation.command, invocation.args, {
|
|
59148
|
+
windowsHide: true,
|
|
59149
|
+
windowsVerbatimArguments: invocation.windowsVerbatimArguments,
|
|
59150
|
+
timeout: ONCHAINOS_VERSION_PROBE_TIMEOUT_MS
|
|
59151
|
+
});
|
|
59152
|
+
return [result.stdout, result.stderr].filter(Boolean).join("\n");
|
|
58859
59153
|
}
|
|
58860
|
-
async function resolve6() {
|
|
59154
|
+
async function resolve6(timeoutMs) {
|
|
58861
59155
|
if (resolvedBin) {
|
|
58862
59156
|
return resolvedBin;
|
|
58863
59157
|
}
|
|
@@ -58877,7 +59171,8 @@ async function resolve6() {
|
|
|
58877
59171
|
try {
|
|
58878
59172
|
const shell = process.env.SHELL || "/bin/bash";
|
|
58879
59173
|
const { stdout } = await execFileAsync2(shell, ["-lc", "command -v onchainos"], {
|
|
58880
|
-
windowsHide: true
|
|
59174
|
+
windowsHide: true,
|
|
59175
|
+
timeout: timeoutMs
|
|
58881
59176
|
});
|
|
58882
59177
|
const bin = extractExecutablePath(stdout);
|
|
58883
59178
|
if (bin) {
|
|
@@ -60638,7 +60933,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
|
|
|
60638
60933
|
client: {
|
|
60639
60934
|
id: "gateway-client",
|
|
60640
60935
|
displayName: "okx-a2a-node",
|
|
60641
|
-
version: "0.2.8
|
|
60936
|
+
version: "0.2.8",
|
|
60642
60937
|
platform: "node",
|
|
60643
60938
|
mode: "backend",
|
|
60644
60939
|
instanceId
|
|
@@ -60649,7 +60944,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
|
|
|
60649
60944
|
commands: [],
|
|
60650
60945
|
permissions: {},
|
|
60651
60946
|
locale: Intl.DateTimeFormat().resolvedOptions().locale || "en-US",
|
|
60652
|
-
userAgent: `okx-a2a-node/${"0.2.8
|
|
60947
|
+
userAgent: `okx-a2a-node/${"0.2.8"}`,
|
|
60653
60948
|
auth: {
|
|
60654
60949
|
...config.token ? { token: config.token } : {},
|
|
60655
60950
|
...config.password ? { password: config.password } : {}
|
|
@@ -66397,7 +66692,47 @@ function userWatchEventDeliveredSentryExtra(event) {
|
|
|
66397
66692
|
// src/listener.ts
|
|
66398
66693
|
init_daemon_lock();
|
|
66399
66694
|
init_ai_provider();
|
|
66695
|
+
|
|
66696
|
+
// src/runtime-metadata-store.ts
|
|
66697
|
+
function defaultWarning(message) {
|
|
66698
|
+
console.warn(message);
|
|
66699
|
+
}
|
|
66700
|
+
function errorMessage(error) {
|
|
66701
|
+
return error instanceof Error ? error.message : String(error);
|
|
66702
|
+
}
|
|
66703
|
+
function warnBestEffort(warn, message) {
|
|
66704
|
+
try {
|
|
66705
|
+
warn(message);
|
|
66706
|
+
} catch {
|
|
66707
|
+
}
|
|
66708
|
+
}
|
|
66709
|
+
function persistAiRuntimeSurfaceBestEffort(store, surface, warn = defaultWarning) {
|
|
66710
|
+
try {
|
|
66711
|
+
store.setAiRuntimeSurface(surface);
|
|
66712
|
+
return true;
|
|
66713
|
+
} catch (error) {
|
|
66714
|
+
warnBestEffort(
|
|
66715
|
+
warn,
|
|
66716
|
+
`[runtime] failed to persist diagnostic runtime surface: ${errorMessage(error)}`
|
|
66717
|
+
);
|
|
66718
|
+
return false;
|
|
66719
|
+
}
|
|
66720
|
+
}
|
|
66721
|
+
function readAiRuntimeSurfaceBestEffort(store, fallback, warn = defaultWarning) {
|
|
66722
|
+
try {
|
|
66723
|
+
return store.getAiRuntimeSurface() ?? fallback;
|
|
66724
|
+
} catch (error) {
|
|
66725
|
+
warnBestEffort(
|
|
66726
|
+
warn,
|
|
66727
|
+
`[runtime] failed to read diagnostic runtime surface: ${errorMessage(error)}`
|
|
66728
|
+
);
|
|
66729
|
+
return fallback;
|
|
66730
|
+
}
|
|
66731
|
+
}
|
|
66732
|
+
|
|
66733
|
+
// src/listener.ts
|
|
66400
66734
|
init_sentry_logger();
|
|
66735
|
+
init_runtime_metadata();
|
|
66401
66736
|
init_sentry_config();
|
|
66402
66737
|
var DEFAULT_OFFLINE_REPLAY_INTERVAL_SEC = 300;
|
|
66403
66738
|
var DEFAULT_XMTP_CLIENT_RECYCLE_INTERVAL_SEC = 6 * 60 * 60;
|
|
@@ -66408,8 +66743,9 @@ var AUTH_RECOVERY_REFRESH_BACKOFF_MS = [6e4, 12e4, 3e5];
|
|
|
66408
66743
|
async function runHeartbeatRefreshCycle(options) {
|
|
66409
66744
|
const heartbeat = await timeSettled(options.heartbeat);
|
|
66410
66745
|
const refreshAllowed = heartbeat.value === "performed" || heartbeat.value === "refresh_safe";
|
|
66746
|
+
const versionRefresh = options.versionRefresh && refreshAllowed ? await timeSettled(options.versionRefresh) : void 0;
|
|
66411
66747
|
const refresh = options.refresh && refreshAllowed ? await timeSettled(options.refresh) : void 0;
|
|
66412
|
-
return { heartbeat, refresh };
|
|
66748
|
+
return { heartbeat, versionRefresh, refresh };
|
|
66413
66749
|
}
|
|
66414
66750
|
var AgentRefreshAuthGate = class {
|
|
66415
66751
|
authBlocked = false;
|
|
@@ -66836,15 +67172,25 @@ async function runListenerWithLock(options, paths) {
|
|
|
66836
67172
|
});
|
|
66837
67173
|
}
|
|
66838
67174
|
});
|
|
66839
|
-
service.setPluginVersion("0.2.8
|
|
67175
|
+
service.setPluginVersion("0.2.8");
|
|
66840
67176
|
await service.init();
|
|
66841
67177
|
const pluginVersionStatus = service.pluginVersionStatus;
|
|
66842
67178
|
if (pluginVersionStatus.unavailable) {
|
|
66843
67179
|
throw new Error(
|
|
66844
|
-
`@okxweb3/a2a-node v${"0.2.8
|
|
67180
|
+
`@okxweb3/a2a-node v${"0.2.8"} is below the required minimum v${pluginVersionStatus.minVersion}`
|
|
66845
67181
|
);
|
|
66846
67182
|
}
|
|
66847
67183
|
const systemConfig = service.getSystemConfig();
|
|
67184
|
+
const configuredProvider = resolveConfiguredAiProvider({ store: sessionStore }) ?? detectGatewayInvocation();
|
|
67185
|
+
const aiProvider = normalizeAiRuntimeProvider(configuredProvider);
|
|
67186
|
+
setRuntimeMetadata({
|
|
67187
|
+
aiProvider,
|
|
67188
|
+
runtimeSurface: readAiRuntimeSurfaceBestEffort(
|
|
67189
|
+
sessionStore,
|
|
67190
|
+
detectAiRuntimeSurface(aiProvider),
|
|
67191
|
+
(message) => logWithTimestamp(message)
|
|
67192
|
+
)
|
|
67193
|
+
});
|
|
66848
67194
|
if (systemConfig.sentryDsn) {
|
|
66849
67195
|
initLogger({
|
|
66850
67196
|
dsn: systemConfig.sentryDsn,
|
|
@@ -66859,7 +67205,7 @@ async function runListenerWithLock(options, paths) {
|
|
|
66859
67205
|
onchainosAgentId: "*",
|
|
66860
67206
|
reason: "system-config missing sentryDsn",
|
|
66861
67207
|
pluginId: "@okxweb3/a2a-node",
|
|
66862
|
-
pluginVersion: "0.2.8
|
|
67208
|
+
pluginVersion: "0.2.8"
|
|
66863
67209
|
});
|
|
66864
67210
|
}
|
|
66865
67211
|
logWithTimestamp(
|
|
@@ -67117,6 +67463,7 @@ async function runListenerWithLock(options, paths) {
|
|
|
67117
67463
|
timer = setInterval(() => {
|
|
67118
67464
|
void runHeartbeatRefreshCycle({
|
|
67119
67465
|
heartbeat: heartbeatTick,
|
|
67466
|
+
versionRefresh: refreshOnchainosVersionMetadata,
|
|
67120
67467
|
refresh: syncTick
|
|
67121
67468
|
});
|
|
67122
67469
|
}, intervalSec * 1e3);
|
|
@@ -67221,7 +67568,8 @@ async function runListenerWithLock(options, paths) {
|
|
|
67221
67568
|
});
|
|
67222
67569
|
}, AUTH_RECOVERY_PROBE_INTERVAL_MS);
|
|
67223
67570
|
void runHeartbeatRefreshCycle({
|
|
67224
|
-
heartbeat: heartbeatTick
|
|
67571
|
+
heartbeat: heartbeatTick,
|
|
67572
|
+
versionRefresh: refreshOnchainosVersionMetadata
|
|
67225
67573
|
});
|
|
67226
67574
|
const commandProcessor = startCommandProcessor({
|
|
67227
67575
|
service,
|
|
@@ -68204,6 +68552,7 @@ var JOB_PROVIDER_BINDING_SOURCES = [
|
|
|
68204
68552
|
|
|
68205
68553
|
// src/index.ts
|
|
68206
68554
|
init_sentry_logger();
|
|
68555
|
+
init_runtime_metadata();
|
|
68207
68556
|
init_update_cli();
|
|
68208
68557
|
init_win_spawn();
|
|
68209
68558
|
|
|
@@ -69557,7 +69906,7 @@ async function exportDiagnosticLogs(options) {
|
|
|
69557
69906
|
node: process.version,
|
|
69558
69907
|
platform: process.platform,
|
|
69559
69908
|
arch: process.arch,
|
|
69560
|
-
packageVersion: true ? "0.2.8
|
|
69909
|
+
packageVersion: true ? "0.2.8" : "unknown",
|
|
69561
69910
|
sensitiveContentIncluded: options.includeSensitiveContent,
|
|
69562
69911
|
listenerAndLlmContentIncluded: true,
|
|
69563
69912
|
credentialsAlwaysRedacted: true,
|
|
@@ -70462,6 +70811,7 @@ async function refreshAgentsAndWait(timeoutMs = 6e4) {
|
|
|
70462
70811
|
init_ai_provider();
|
|
70463
70812
|
init_sentry_logger();
|
|
70464
70813
|
init_log_fields();
|
|
70814
|
+
init_runtime_metadata();
|
|
70465
70815
|
var RUNTIME_SWITCH_COMPONENT = "node_runtime_switch";
|
|
70466
70816
|
async function performRuntimeSwitch(store, options = {}) {
|
|
70467
70817
|
const result = await switchProviderWithReadinessGate({
|
|
@@ -70475,11 +70825,25 @@ async function performRuntimeSwitch(store, options = {}) {
|
|
|
70475
70825
|
}
|
|
70476
70826
|
async function switchProviderWithReadinessGate(options) {
|
|
70477
70827
|
const gated = await switchProviderWithReadinessGateCore(options);
|
|
70478
|
-
|
|
70828
|
+
if (gated.result.ok) {
|
|
70829
|
+
const provider = normalizeAiRuntimeProvider(gated.result.provider);
|
|
70830
|
+
persistAiRuntimeSurfaceBestEffort(
|
|
70831
|
+
options.store,
|
|
70832
|
+
detectAiRuntimeSurface(provider, options.env)
|
|
70833
|
+
);
|
|
70834
|
+
}
|
|
70835
|
+
emitRuntimeSwitchCheckpoints(gated, options.env);
|
|
70479
70836
|
return gated.result;
|
|
70480
70837
|
}
|
|
70481
|
-
function emitRuntimeSwitchCheckpoints(gated) {
|
|
70838
|
+
function emitRuntimeSwitchCheckpoints(gated, env = process.env) {
|
|
70482
70839
|
const { result, runtime, readiness } = gated;
|
|
70840
|
+
const runtimeProvider = normalizeAiRuntimeProvider(
|
|
70841
|
+
result.ok ? result.provider : runtime
|
|
70842
|
+
);
|
|
70843
|
+
setRuntimeMetadata({
|
|
70844
|
+
aiProvider: runtimeProvider,
|
|
70845
|
+
runtimeSurface: detectAiRuntimeSurface(runtimeProvider, env)
|
|
70846
|
+
});
|
|
70483
70847
|
logger.info(LogEvent.RUNTIME_DETECTED, {
|
|
70484
70848
|
component: RUNTIME_SWITCH_COMPONENT,
|
|
70485
70849
|
provider: runtime,
|
|
@@ -71424,7 +71788,7 @@ async function runDoctor(options = {}) {
|
|
|
71424
71788
|
platform: options.platform ?? process.platform,
|
|
71425
71789
|
env: options.env ?? process.env,
|
|
71426
71790
|
target: options.target ?? resolveDoctorTarget(options.env ?? process.env),
|
|
71427
|
-
cliVersion: options.cliVersion ?? (true ? "0.2.8
|
|
71791
|
+
cliVersion: options.cliVersion ?? (true ? "0.2.8" : "0.0.0"),
|
|
71428
71792
|
fixMode: options.fix === true,
|
|
71429
71793
|
nonInteractive: options.nonInteractive === true,
|
|
71430
71794
|
packageChanged: false,
|
|
@@ -71758,6 +72122,7 @@ init_autostart_windows();
|
|
|
71758
72122
|
createUserAttentionWatchParentMonitor,
|
|
71759
72123
|
currentOpenClawGatewaySessionKey,
|
|
71760
72124
|
detectAiProviders,
|
|
72125
|
+
detectAiRuntimeSurface,
|
|
71761
72126
|
detectCurrentAiProvider,
|
|
71762
72127
|
detectGatewayInvocation,
|
|
71763
72128
|
detectMessageEligibleOfflineReplaySupport,
|
|
@@ -71778,6 +72143,7 @@ init_autostart_windows();
|
|
|
71778
72143
|
getA2ACapabilities,
|
|
71779
72144
|
getDaemonStatus,
|
|
71780
72145
|
getHermesGatewayPluginStatus,
|
|
72146
|
+
getRuntimeMetadata,
|
|
71781
72147
|
getSessionBusyTracker,
|
|
71782
72148
|
handleCapabilitiesCommand,
|
|
71783
72149
|
handleDoctorCommand,
|
|
@@ -71805,6 +72171,7 @@ init_autostart_windows();
|
|
|
71805
72171
|
isRetryableOpenClawGatewayError,
|
|
71806
72172
|
isSqliteBusyError,
|
|
71807
72173
|
isSystemdManagerUnavailableMessage,
|
|
72174
|
+
isTagKey,
|
|
71808
72175
|
isWindowsElevated,
|
|
71809
72176
|
killProcessTree,
|
|
71810
72177
|
launchdPlistHasCurrentRestartPolicy,
|
|
@@ -71816,16 +72183,19 @@ init_autostart_windows();
|
|
|
71816
72183
|
messageEligibleHelpAdvertisesOfflineReplay,
|
|
71817
72184
|
nodeVersionSatisfies,
|
|
71818
72185
|
normalizeAiProvider,
|
|
72186
|
+
normalizeAiRuntimeProvider,
|
|
71819
72187
|
normalizeHermesOkxA2aPluginConfig,
|
|
71820
72188
|
notifyAgentMessageToUserAttention,
|
|
71821
72189
|
notifyDirectToUserAttention,
|
|
71822
72190
|
notifySystemMessageToUser,
|
|
71823
72191
|
notifyUserAttentionChanged,
|
|
71824
72192
|
parseLogsExportArgs,
|
|
72193
|
+
parseOnchainosVersionOutput,
|
|
71825
72194
|
parsePluginYamlVersion,
|
|
71826
72195
|
parseWalletLoginStatus,
|
|
71827
72196
|
parseWindowsParentProcessJson,
|
|
71828
72197
|
performRuntimeSwitch,
|
|
72198
|
+
persistAiRuntimeSurfaceBestEffort,
|
|
71829
72199
|
persistCurrentRuntimeSelectionForNewJob,
|
|
71830
72200
|
pickOnchainosWin32Candidate,
|
|
71831
72201
|
prepareAndBindCurrentRuntimeForNewJob,
|
|
@@ -71835,11 +72205,13 @@ init_autostart_windows();
|
|
|
71835
72205
|
processFileMessage,
|
|
71836
72206
|
queryWalletLoginStatus,
|
|
71837
72207
|
readAiProviderTimeoutMs,
|
|
72208
|
+
readAiRuntimeSurfaceBestEffort,
|
|
71838
72209
|
readCachedCodexReadiness,
|
|
71839
72210
|
readLastLines,
|
|
71840
72211
|
readParentProcessCommandForPlatform,
|
|
71841
72212
|
readUserAttentionWatcherEvent,
|
|
71842
72213
|
refreshAgentsAndWait,
|
|
72214
|
+
refreshOnchainosVersionMetadata,
|
|
71843
72215
|
registerUserAttentionWatcher,
|
|
71844
72216
|
releaseActiveDaemon,
|
|
71845
72217
|
removeUserAttentionWatcher,
|
|
@@ -71881,8 +72253,10 @@ init_autostart_windows();
|
|
|
71881
72253
|
runDoctor,
|
|
71882
72254
|
runHeartbeatRefreshCycle,
|
|
71883
72255
|
runListener,
|
|
72256
|
+
runtimeMetadataFields,
|
|
71884
72257
|
scanUserAttentionWatchers,
|
|
71885
72258
|
setOpenClawWebSocketFactoryForTests,
|
|
72259
|
+
setRuntimeMetadata,
|
|
71886
72260
|
shouldDelegateToSupervisor,
|
|
71887
72261
|
shouldRouteThroughWindowsShell,
|
|
71888
72262
|
spawnCompat,
|
|
@@ -71894,6 +72268,7 @@ init_autostart_windows();
|
|
|
71894
72268
|
startUserAttentionWatcherCoordinator,
|
|
71895
72269
|
stopDaemon,
|
|
71896
72270
|
stopOpenClawGateway,
|
|
72271
|
+
stopSystemdAutostart,
|
|
71897
72272
|
subscribeUserAttentionEvents,
|
|
71898
72273
|
summarizeXmtpTestEvents,
|
|
71899
72274
|
switchProvider,
|