@okxweb3/a2a-node 0.2.8-beta-174fcb5625-260819115622 → 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.
Files changed (3) hide show
  1. package/dist/cli.js +324 -31
  2. package/dist/index.js +314 -17
  3. package/package.json +1 -1
package/dist/cli.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");
@@ -19950,6 +19960,7 @@ var init_events = __esm({
19950
19960
  PROVIDER_READINESS_CHECKED: "Provider readiness checked",
19951
19961
  PROVIDER_SWITCHED: "Provider switched",
19952
19962
  JOB_PROVIDER_BOUND: "Job provider bound",
19963
+ ONCHAINOS_VERSION_OBSERVED: "OnchainOS version observed",
19953
19964
  // Hermes user-channel delivery only. The node and openclaw user-channel hops
19954
19965
  // keep emitting USER_DISPATCHED / PROMPT_USER_CHECKPOINT — one name per
19955
19966
  // transport is the whole point of splitting the send events.
@@ -20486,7 +20497,84 @@ var init_error_diagnostics = __esm({
20486
20497
  }
20487
20498
  });
20488
20499
 
20500
+ // ../core/src/sentry-logger/runtime-metadata.ts
20501
+ function normalizeAiRuntimeProvider(provider) {
20502
+ const normalized = provider?.trim().toLowerCase();
20503
+ if (normalized === "codex") {
20504
+ return "codex";
20505
+ }
20506
+ if (normalized === "claude" || normalized === "claude-code") {
20507
+ return "claude-code";
20508
+ }
20509
+ if (normalized === "openclaw") {
20510
+ return "openclaw";
20511
+ }
20512
+ if (normalized === "hermes") {
20513
+ return "hermes";
20514
+ }
20515
+ return "unknown";
20516
+ }
20517
+ function detectAiRuntimeSurface(provider, env = process.env) {
20518
+ const override = env.OKX_A2A_RUNTIME_SURFACE?.trim().toLowerCase();
20519
+ if (override === "desktop" || override === "cli" || override === "unknown") {
20520
+ return override;
20521
+ }
20522
+ const normalizedProvider = normalizeAiRuntimeProvider(provider);
20523
+ if (normalizedProvider === "codex") {
20524
+ return env.CODEX_INTERNAL_ORIGINATOR_OVERRIDE === "Codex Desktop" ? "desktop" : "cli";
20525
+ }
20526
+ if (normalizedProvider === "claude-code") {
20527
+ return env.CLAUDE_CODE_ENTRYPOINT?.trim().toLowerCase() === "remote_cowork" ? "desktop" : "cli";
20528
+ }
20529
+ return "unknown";
20530
+ }
20531
+ function parseOnchainosVersionOutput(output5) {
20532
+ const normalized = output5.trim().replace(/\s+/g, " ");
20533
+ if (!normalized) {
20534
+ return UNKNOWN_RUNTIME_METADATA;
20535
+ }
20536
+ const match = ` ${normalized} `.match(SEMVER_PATTERN);
20537
+ return match?.[1]?.slice(0, 128) ?? UNKNOWN_RUNTIME_METADATA;
20538
+ }
20539
+ function runtimeMetadataFields(input = {}) {
20540
+ const observedAt = Number(input.onchainosVersionObservedAtMs);
20541
+ return {
20542
+ aiProvider: normalizeAiRuntimeProvider(input.aiProvider),
20543
+ runtimeSurface: input.runtimeSurface === "desktop" || input.runtimeSurface === "cli" ? input.runtimeSurface : UNKNOWN_RUNTIME_METADATA,
20544
+ onchainosVersion: typeof input.onchainosVersion === "string" && input.onchainosVersion.trim() ? input.onchainosVersion.trim().slice(0, 128) : UNKNOWN_RUNTIME_METADATA,
20545
+ onchainosVersionObservedAtMs: Number.isFinite(observedAt) && observedAt > 0 ? String(Math.trunc(observedAt)) : "0",
20546
+ onchainosVersionProbeStatus: typeof input.onchainosVersionProbeStatus === "string" && input.onchainosVersionProbeStatus.trim() ? input.onchainosVersionProbeStatus.trim().toLowerCase().slice(0, 32) : UNKNOWN_RUNTIME_METADATA
20547
+ };
20548
+ }
20549
+ var UNKNOWN_RUNTIME_METADATA, SEMVER_PATTERN;
20550
+ var init_runtime_metadata = __esm({
20551
+ "../core/src/sentry-logger/runtime-metadata.ts"() {
20552
+ "use strict";
20553
+ UNKNOWN_RUNTIME_METADATA = "unknown";
20554
+ SEMVER_PATTERN = /(?:^|[^0-9])v?(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?)(?:$|[^0-9A-Za-z.-])/;
20555
+ }
20556
+ });
20557
+
20489
20558
  // ../core/src/sentry-logger/index.ts
20559
+ function setRuntimeMetadata(metadata) {
20560
+ const next = runtimeMetadataFields({
20561
+ ...RUNTIME_FIELDS,
20562
+ ...metadata
20563
+ });
20564
+ RUNTIME_FIELDS = next;
20565
+ try {
20566
+ Sentry.setTags({
20567
+ aiProvider: next.aiProvider,
20568
+ runtimeSurface: next.runtimeSurface,
20569
+ onchainosVersion: next.onchainosVersion,
20570
+ onchainosVersionProbeStatus: next.onchainosVersionProbeStatus
20571
+ });
20572
+ } catch {
20573
+ }
20574
+ }
20575
+ function getRuntimeMetadata() {
20576
+ return { ...RUNTIME_FIELDS };
20577
+ }
20490
20578
  function applyFatalEventDefaults(event) {
20491
20579
  try {
20492
20580
  const classified = event?.extra?.eventName ?? event?.tags?.eventName;
@@ -20496,6 +20584,7 @@ function applyFatalEventDefaults(event) {
20496
20584
  const target = event;
20497
20585
  target.extra = {
20498
20586
  ...RELEASE_FIELDS,
20587
+ ...RUNTIME_FIELDS,
20499
20588
  ...target.extra ?? {},
20500
20589
  eventName: LogEvent.FATAL_UNCAUGHT,
20501
20590
  eventFamily: "diagnostics",
@@ -20521,7 +20610,7 @@ function agentExtras(identity) {
20521
20610
  role: identity.role != null && identity.role !== "" ? String(identity.role) : UNKNOWN_FIELD
20522
20611
  };
20523
20612
  }
20524
- var Sentry, import_node_crypto4, 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;
20613
+ var Sentry, import_node_crypto4, 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;
20525
20614
  var init_sentry_logger = __esm({
20526
20615
  "../core/src/sentry-logger/index.ts"() {
20527
20616
  "use strict";
@@ -20532,6 +20621,7 @@ var init_sentry_logger = __esm({
20532
20621
  init_log_fields();
20533
20622
  init_xmtp_test_metrics();
20534
20623
  init_error_diagnostics();
20624
+ init_runtime_metadata();
20535
20625
  init_events();
20536
20626
  init_log_fields();
20537
20627
  FLOW_ID = (0, import_node_crypto4.randomUUID)();
@@ -20618,6 +20708,7 @@ var init_sentry_logger = __esm({
20618
20708
  SENTRY_TAG_KEYS = /* @__PURE__ */ new Set([
20619
20709
  "agentId",
20620
20710
  "agentPlatform",
20711
+ "aiProvider",
20621
20712
  "cacheName",
20622
20713
  "causeCode",
20623
20714
  "causeType",
@@ -20640,6 +20731,8 @@ var init_sentry_logger = __esm({
20640
20731
  "kind",
20641
20732
  "method",
20642
20733
  "onchainosAgentId",
20734
+ "onchainosVersion",
20735
+ "onchainosVersionProbeStatus",
20643
20736
  "operation",
20644
20737
  "originPlatform",
20645
20738
  "outcome",
@@ -20656,6 +20749,7 @@ var init_sentry_logger = __esm({
20656
20749
  "role",
20657
20750
  "runId",
20658
20751
  "runtimeContainer",
20752
+ "runtimeSurface",
20659
20753
  "senderAgentId",
20660
20754
  "source",
20661
20755
  "stage",
@@ -20726,6 +20820,7 @@ var init_sentry_logger = __esm({
20726
20820
  LogEvent.PROVIDER_READINESS_CHECKED,
20727
20821
  LogEvent.PROVIDER_SWITCHED,
20728
20822
  LogEvent.JOB_PROVIDER_BOUND,
20823
+ LogEvent.ONCHAINOS_VERSION_OBSERVED,
20729
20824
  LogEvent.USER_CHANNEL_MESSAGE_DELIVERED,
20730
20825
  LogEvent.SYSTEM_NOTIFICATION_RECEIVED,
20731
20826
  LogEvent.SYSTEM_NOTIFICATION_ROUTED,
@@ -20781,6 +20876,7 @@ var init_sentry_logger = __esm({
20781
20876
  MAX_EXTRA_STRING_LENGTH = 256;
20782
20877
  MAX_TAG_VALUE_LENGTH = 128;
20783
20878
  RELEASE_FIELDS = {};
20879
+ RUNTIME_FIELDS = runtimeMetadataFields();
20784
20880
  SentryLogger = class _SentryLogger {
20785
20881
  static instance;
20786
20882
  initialized = false;
@@ -20800,6 +20896,9 @@ var init_sentry_logger = __esm({
20800
20896
  }
20801
20897
  try {
20802
20898
  RELEASE_FIELDS = releaseFields(config.release);
20899
+ if (config.runtimeMetadata) {
20900
+ setRuntimeMetadata(config.runtimeMetadata);
20901
+ }
20803
20902
  Sentry.init({
20804
20903
  dsn: config.dsn,
20805
20904
  release: config.release,
@@ -20819,6 +20918,14 @@ var init_sentry_logger = __esm({
20819
20918
  if (config.runtimeContainer) {
20820
20919
  tags.runtimeContainer = config.runtimeContainer;
20821
20920
  }
20921
+ for (const key of [
20922
+ "aiProvider",
20923
+ "runtimeSurface",
20924
+ "onchainosVersion",
20925
+ "onchainosVersionProbeStatus"
20926
+ ]) {
20927
+ tags[key] = RUNTIME_FIELDS[key] ?? "unknown";
20928
+ }
20822
20929
  Sentry.setTags(tags);
20823
20930
  } catch {
20824
20931
  return;
@@ -20831,6 +20938,7 @@ var init_sentry_logger = __esm({
20831
20938
  enrichCorrelationFields({
20832
20939
  flowId: FLOW_ID,
20833
20940
  ...RELEASE_FIELDS,
20941
+ ...RUNTIME_FIELDS,
20834
20942
  ...extra ?? {}
20835
20943
  })
20836
20944
  );
@@ -20865,6 +20973,7 @@ var init_sentry_logger = __esm({
20865
20973
  enrichCorrelationFields({
20866
20974
  flowId: FLOW_ID,
20867
20975
  ...RELEASE_FIELDS,
20976
+ ...RUNTIME_FIELDS,
20868
20977
  ...extra ?? {}
20869
20978
  })
20870
20979
  );
@@ -26823,7 +26932,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
26823
26932
  client: {
26824
26933
  id: "gateway-client",
26825
26934
  displayName: "okx-a2a-node",
26826
- version: "0.2.8-beta-174fcb5625-260819115622",
26935
+ version: "0.2.8",
26827
26936
  platform: "node",
26828
26937
  mode: "backend",
26829
26938
  instanceId
@@ -26834,7 +26943,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
26834
26943
  commands: [],
26835
26944
  permissions: {},
26836
26945
  locale: Intl.DateTimeFormat().resolvedOptions().locale || "en-US",
26837
- userAgent: `okx-a2a-node/${"0.2.8-beta-174fcb5625-260819115622"}`,
26946
+ userAgent: `okx-a2a-node/${"0.2.8"}`,
26838
26947
  auth: {
26839
26948
  ...config.token ? { token: config.token } : {},
26840
26949
  ...config.password ? { password: config.password } : {}
@@ -28305,6 +28414,48 @@ var init_outbound_behavior = __esm({
28305
28414
  }
28306
28415
  });
28307
28416
 
28417
+ // src/runtime-metadata-store.ts
28418
+ function defaultWarning(message) {
28419
+ console.warn(message);
28420
+ }
28421
+ function errorMessage(error) {
28422
+ return error instanceof Error ? error.message : String(error);
28423
+ }
28424
+ function warnBestEffort(warn, message) {
28425
+ try {
28426
+ warn(message);
28427
+ } catch {
28428
+ }
28429
+ }
28430
+ function persistAiRuntimeSurfaceBestEffort(store, surface, warn = defaultWarning) {
28431
+ try {
28432
+ store.setAiRuntimeSurface(surface);
28433
+ return true;
28434
+ } catch (error) {
28435
+ warnBestEffort(
28436
+ warn,
28437
+ `[runtime] failed to persist diagnostic runtime surface: ${errorMessage(error)}`
28438
+ );
28439
+ return false;
28440
+ }
28441
+ }
28442
+ function readAiRuntimeSurfaceBestEffort(store, fallback, warn = defaultWarning) {
28443
+ try {
28444
+ return store.getAiRuntimeSurface() ?? fallback;
28445
+ } catch (error) {
28446
+ warnBestEffort(
28447
+ warn,
28448
+ `[runtime] failed to read diagnostic runtime surface: ${errorMessage(error)}`
28449
+ );
28450
+ return fallback;
28451
+ }
28452
+ }
28453
+ var init_runtime_metadata_store = __esm({
28454
+ "src/runtime-metadata-store.ts"() {
28455
+ "use strict";
28456
+ }
28457
+ });
28458
+
28308
28459
  // src/runtime-switch.ts
28309
28460
  async function performRuntimeSwitch(store, options = {}) {
28310
28461
  const result = await switchProviderWithReadinessGate({
@@ -28318,11 +28469,25 @@ async function performRuntimeSwitch(store, options = {}) {
28318
28469
  }
28319
28470
  async function switchProviderWithReadinessGate(options) {
28320
28471
  const gated = await switchProviderWithReadinessGateCore(options);
28321
- emitRuntimeSwitchCheckpoints(gated);
28472
+ if (gated.result.ok) {
28473
+ const provider = normalizeAiRuntimeProvider(gated.result.provider);
28474
+ persistAiRuntimeSurfaceBestEffort(
28475
+ options.store,
28476
+ detectAiRuntimeSurface(provider, options.env)
28477
+ );
28478
+ }
28479
+ emitRuntimeSwitchCheckpoints(gated, options.env);
28322
28480
  return gated.result;
28323
28481
  }
28324
- function emitRuntimeSwitchCheckpoints(gated) {
28482
+ function emitRuntimeSwitchCheckpoints(gated, env = process.env) {
28325
28483
  const { result, runtime, readiness } = gated;
28484
+ const runtimeProvider = normalizeAiRuntimeProvider(
28485
+ result.ok ? result.provider : runtime
28486
+ );
28487
+ setRuntimeMetadata({
28488
+ aiProvider: runtimeProvider,
28489
+ runtimeSurface: detectAiRuntimeSurface(runtimeProvider, env)
28490
+ });
28326
28491
  logger.info(LogEvent.RUNTIME_DETECTED, {
28327
28492
  component: RUNTIME_SWITCH_COMPONENT,
28328
28493
  provider: runtime,
@@ -28394,8 +28559,10 @@ var init_runtime_switch = __esm({
28394
28559
  init_ai_provider();
28395
28560
  init_outbound_behavior();
28396
28561
  init_openclaw_route();
28562
+ init_runtime_metadata_store();
28397
28563
  init_sentry_logger();
28398
28564
  init_log_fields();
28565
+ init_runtime_metadata();
28399
28566
  RUNTIME_SWITCH_COMPONENT = "node_runtime_switch";
28400
28567
  }
28401
28568
  });
@@ -28743,7 +28910,7 @@ var init_sentry_config = __esm({
28743
28910
  environment = process.env.SENTRY_ENV === "dev" ? "dev" : "prod";
28744
28911
  SENTRY_CONFIG = {
28745
28912
  projectName: "okx/openclaw-okx-a2a-extension",
28746
- release: "0.2.8-beta-174fcb5625-260819115622",
28913
+ release: "0.2.8",
28747
28914
  environment,
28748
28915
  runtimeContainer: normalizeRuntimeContainer(process.env.OKX_A2A_RUNTIME_CONTAINER)
28749
28916
  };
@@ -39913,7 +40080,7 @@ async function exportDiagnosticLogs(options) {
39913
40080
  node: process.version,
39914
40081
  platform: process.platform,
39915
40082
  arch: process.arch,
39916
- packageVersion: true ? "0.2.8-beta-174fcb5625-260819115622" : "unknown",
40083
+ packageVersion: true ? "0.2.8" : "unknown",
39917
40084
  sensitiveContentIncluded: options.includeSensitiveContent,
39918
40085
  listenerAndLlmContentIncluded: true,
39919
40086
  credentialsAlwaysRedacted: true,
@@ -40837,7 +41004,87 @@ var init_capabilities_cli = __esm({
40837
41004
  });
40838
41005
 
40839
41006
  // ../core/src/xmtp-sdk/onchainos/bin.ts
40840
- async function resolve9() {
41007
+ async function refreshOnchainosVersionMetadata(options = {}) {
41008
+ const now = options.now ?? Date.now;
41009
+ const current = getRuntimeMetadata();
41010
+ const previousVersion = current.onchainosVersion ?? UNKNOWN_RUNTIME_METADATA;
41011
+ const previousObservedAtMs = Number(current.onchainosVersionObservedAtMs ?? 0);
41012
+ if (versionProbeInFlight) {
41013
+ return versionProbeInFlight;
41014
+ }
41015
+ versionProbeInFlight = (async () => {
41016
+ const observedAtMs = now();
41017
+ try {
41018
+ const bin = await resolve9(
41019
+ options.resolveTimeoutMs ?? ONCHAINOS_BIN_RESOLVE_TIMEOUT_MS
41020
+ );
41021
+ const output5 = options.runVersionCommand ? await options.runVersionCommand(bin) : await runVersionCommand(bin);
41022
+ const version3 = parseOnchainosVersionOutput(output5);
41023
+ if (version3 === UNKNOWN_RUNTIME_METADATA) {
41024
+ throw new Error("OnchainOS version output did not contain a semantic version");
41025
+ }
41026
+ const changed = previousVersion !== UNKNOWN_RUNTIME_METADATA && previousVersion !== version3;
41027
+ setRuntimeMetadata({
41028
+ onchainosVersion: version3,
41029
+ onchainosVersionObservedAtMs: observedAtMs,
41030
+ onchainosVersionProbeStatus: "ok"
41031
+ });
41032
+ if (previousVersion !== version3) {
41033
+ logger.info(LogEvent.ONCHAINOS_VERSION_OBSERVED, {
41034
+ component: "onchainos_cli",
41035
+ source: "onchainos",
41036
+ checkpoint: changed ? "version_changed" : "version_detected",
41037
+ outcome: "success",
41038
+ previousOnchainosVersion: previousVersion,
41039
+ versionChanged: String(changed),
41040
+ onchainosVersionObservedAtMs: String(observedAtMs)
41041
+ });
41042
+ }
41043
+ return {
41044
+ version: version3,
41045
+ observedAtMs,
41046
+ probeStatus: "ok",
41047
+ changed
41048
+ };
41049
+ } catch {
41050
+ const hasLastKnownVersion = previousVersion !== UNKNOWN_RUNTIME_METADATA;
41051
+ setRuntimeMetadata({
41052
+ onchainosVersion: previousVersion,
41053
+ onchainosVersionObservedAtMs: previousObservedAtMs,
41054
+ onchainosVersionProbeStatus: "failed"
41055
+ });
41056
+ if (!hasLastKnownVersion) {
41057
+ logger.info(LogEvent.ONCHAINOS_VERSION_OBSERVED, {
41058
+ component: "onchainos_cli",
41059
+ source: "onchainos",
41060
+ checkpoint: "version_probe_failed",
41061
+ outcome: "failed",
41062
+ reason: "version_unavailable",
41063
+ onchainosVersionObservedAtMs: "0"
41064
+ });
41065
+ }
41066
+ return {
41067
+ version: previousVersion,
41068
+ observedAtMs: previousObservedAtMs,
41069
+ probeStatus: "failed",
41070
+ changed: false
41071
+ };
41072
+ } finally {
41073
+ versionProbeInFlight = null;
41074
+ }
41075
+ })();
41076
+ return versionProbeInFlight;
41077
+ }
41078
+ async function runVersionCommand(bin) {
41079
+ const invocation = toWindowsInvocation(bin, ["--version"]);
41080
+ const result = await execFileAsync2(invocation.command, invocation.args, {
41081
+ windowsHide: true,
41082
+ windowsVerbatimArguments: invocation.windowsVerbatimArguments,
41083
+ timeout: ONCHAINOS_VERSION_PROBE_TIMEOUT_MS
41084
+ });
41085
+ return [result.stdout, result.stderr].filter(Boolean).join("\n");
41086
+ }
41087
+ async function resolve9(timeoutMs) {
40841
41088
  if (resolvedBin) {
40842
41089
  return resolvedBin;
40843
41090
  }
@@ -40857,7 +41104,8 @@ async function resolve9() {
40857
41104
  try {
40858
41105
  const shell = process.env.SHELL || "/bin/bash";
40859
41106
  const { stdout } = await execFileAsync2(shell, ["-lc", "command -v onchainos"], {
40860
- windowsHide: true
41107
+ windowsHide: true,
41108
+ timeout: timeoutMs
40861
41109
  });
40862
41110
  const bin = extractExecutablePath(stdout);
40863
41111
  if (bin) {
@@ -41082,7 +41330,7 @@ async function exec(args, options = {}) {
41082
41330
  throw err2;
41083
41331
  }
41084
41332
  }
41085
- var import_node_fs20, import_node_child_process8, import_node_path23, import_node_util2, execFileAsync2, resolvedBin, REDACTED_VALUE_FLAGS, WINDOWS_APPS_ALIAS_MARKER;
41333
+ var import_node_fs20, import_node_child_process8, import_node_path23, import_node_util2, execFileAsync2, resolvedBin, versionProbeInFlight, REDACTED_VALUE_FLAGS, ONCHAINOS_VERSION_PROBE_TIMEOUT_MS, ONCHAINOS_BIN_RESOLVE_TIMEOUT_MS, WINDOWS_APPS_ALIAS_MARKER;
41086
41334
  var init_bin = __esm({
41087
41335
  "../core/src/xmtp-sdk/onchainos/bin.ts"() {
41088
41336
  "use strict";
@@ -41092,10 +41340,14 @@ var init_bin = __esm({
41092
41340
  import_node_path23 = require("node:path");
41093
41341
  import_node_util2 = require("node:util");
41094
41342
  init_sentry_logger();
41343
+ init_runtime_metadata();
41095
41344
  init_win_compat();
41096
41345
  execFileAsync2 = (0, import_node_util2.promisify)(import_node_child_process8.execFile);
41097
41346
  resolvedBin = null;
41347
+ versionProbeInFlight = null;
41098
41348
  REDACTED_VALUE_FLAGS = /* @__PURE__ */ new Set(["--message"]);
41349
+ ONCHAINOS_VERSION_PROBE_TIMEOUT_MS = 5e3;
41350
+ ONCHAINOS_BIN_RESOLVE_TIMEOUT_MS = 5e3;
41099
41351
  WINDOWS_APPS_ALIAS_MARKER = "\\microsoft\\windowsapps\\";
41100
41352
  }
41101
41353
  });
@@ -61842,6 +62094,8 @@ function aiRunSentryExtra(input) {
61842
62094
  // Every event this builder feeds describes one AI CLI child process.
61843
62095
  transport: "cli",
61844
62096
  eventFamily: "ai_run",
62097
+ // A daemon-spawned AI process is not a user-selected Desktop/CLI surface.
62098
+ runtimeSurface: "unknown",
61845
62099
  source: input.source,
61846
62100
  sessionKey: input.sessionKey,
61847
62101
  jobId: input.jobId ?? "",
@@ -63578,6 +63832,7 @@ var init_ai_runner = __esm({
63578
63832
  env: buildAiProviderEnv(command, {
63579
63833
  ...process.env,
63580
63834
  OKX_A2A_IS_CLI: "1",
63835
+ OKX_A2A_RUNTIME_SURFACE: "unknown",
63581
63836
  OKX_AGENT_TASK_AI_PROVIDER: provider,
63582
63837
  OKX_A2A_CURRENT_SESSION_KEY: request.sessionKey,
63583
63838
  OKX_A2A_CURRENT_MESSAGE_ID: request.messageId,
@@ -67550,8 +67805,9 @@ __export(listener_exports, {
67550
67805
  async function runHeartbeatRefreshCycle(options) {
67551
67806
  const heartbeat = await timeSettled(options.heartbeat);
67552
67807
  const refreshAllowed = heartbeat.value === "performed" || heartbeat.value === "refresh_safe";
67808
+ const versionRefresh = options.versionRefresh && refreshAllowed ? await timeSettled(options.versionRefresh) : void 0;
67553
67809
  const refresh = options.refresh && refreshAllowed ? await timeSettled(options.refresh) : void 0;
67554
- return { heartbeat, refresh };
67810
+ return { heartbeat, versionRefresh, refresh };
67555
67811
  }
67556
67812
  function resolveOfflineReplayIntervalSec(systemConfig) {
67557
67813
  const interval = systemConfig.offlineReplayInterval;
@@ -67823,15 +68079,25 @@ async function runListenerWithLock(options, paths) {
67823
68079
  });
67824
68080
  }
67825
68081
  });
67826
- service.setPluginVersion("0.2.8-beta-174fcb5625-260819115622");
68082
+ service.setPluginVersion("0.2.8");
67827
68083
  await service.init();
67828
68084
  const pluginVersionStatus = service.pluginVersionStatus;
67829
68085
  if (pluginVersionStatus.unavailable) {
67830
68086
  throw new Error(
67831
- `@okxweb3/a2a-node v${"0.2.8-beta-174fcb5625-260819115622"} is below the required minimum v${pluginVersionStatus.minVersion}`
68087
+ `@okxweb3/a2a-node v${"0.2.8"} is below the required minimum v${pluginVersionStatus.minVersion}`
67832
68088
  );
67833
68089
  }
67834
68090
  const systemConfig = service.getSystemConfig();
68091
+ const configuredProvider = resolveConfiguredAiProvider({ store: sessionStore }) ?? detectGatewayInvocation();
68092
+ const aiProvider = normalizeAiRuntimeProvider(configuredProvider);
68093
+ setRuntimeMetadata({
68094
+ aiProvider,
68095
+ runtimeSurface: readAiRuntimeSurfaceBestEffort(
68096
+ sessionStore,
68097
+ detectAiRuntimeSurface(aiProvider),
68098
+ (message) => logWithTimestamp(message)
68099
+ )
68100
+ });
67835
68101
  if (systemConfig.sentryDsn) {
67836
68102
  initLogger({
67837
68103
  dsn: systemConfig.sentryDsn,
@@ -67846,7 +68112,7 @@ async function runListenerWithLock(options, paths) {
67846
68112
  onchainosAgentId: "*",
67847
68113
  reason: "system-config missing sentryDsn",
67848
68114
  pluginId: "@okxweb3/a2a-node",
67849
- pluginVersion: "0.2.8-beta-174fcb5625-260819115622"
68115
+ pluginVersion: "0.2.8"
67850
68116
  });
67851
68117
  }
67852
68118
  logWithTimestamp(
@@ -68104,6 +68370,7 @@ async function runListenerWithLock(options, paths) {
68104
68370
  timer = setInterval(() => {
68105
68371
  void runHeartbeatRefreshCycle({
68106
68372
  heartbeat: heartbeatTick,
68373
+ versionRefresh: refreshOnchainosVersionMetadata,
68107
68374
  refresh: syncTick
68108
68375
  });
68109
68376
  }, intervalSec * 1e3);
@@ -68208,7 +68475,8 @@ async function runListenerWithLock(options, paths) {
68208
68475
  });
68209
68476
  }, AUTH_RECOVERY_PROBE_INTERVAL_MS);
68210
68477
  void runHeartbeatRefreshCycle({
68211
- heartbeat: heartbeatTick
68478
+ heartbeat: heartbeatTick,
68479
+ versionRefresh: refreshOnchainosVersionMetadata
68212
68480
  });
68213
68481
  const commandProcessor = startCommandProcessor({
68214
68482
  service,
@@ -68287,6 +68555,7 @@ var init_listener = __esm({
68287
68555
  init_system_config();
68288
68556
  init_offline_replay_capability();
68289
68557
  init_signer();
68558
+ init_bin();
68290
68559
  init_xmtp_sdk();
68291
68560
  init_file_store();
68292
68561
  init_session_store();
@@ -68301,7 +68570,9 @@ var init_listener = __esm({
68301
68570
  init_daemon_lock();
68302
68571
  init_ai_provider();
68303
68572
  init_openclaw_gateway();
68573
+ init_runtime_metadata_store();
68304
68574
  init_sentry_logger();
68575
+ init_runtime_metadata();
68305
68576
  init_sentry_config();
68306
68577
  DEFAULT_OFFLINE_REPLAY_INTERVAL_SEC = 300;
68307
68578
  DEFAULT_XMTP_CLIENT_RECYCLE_INTERVAL_SEC = 6 * 60 * 60;
@@ -116248,7 +116519,7 @@ async function getCurrentNodeCliVersion() {
116248
116519
  return await getGlobalNpmPackageVersion(UPDATE_PACKAGES.node) ?? getBundledNodeCliVersion();
116249
116520
  }
116250
116521
  function getBundledNodeCliVersion() {
116251
- return true ? "0.2.8-beta-174fcb5625-260819115622" : null;
116522
+ return true ? "0.2.8" : null;
116252
116523
  }
116253
116524
  function readConfiguredAiProvider() {
116254
116525
  const explicit = process.env.OKX_A2A_AI_PROVIDER || process.env.OKX_AGENT_TASK_AI_CLI;
@@ -116458,7 +116729,7 @@ async function updateHermes(release, options) {
116458
116729
  }
116459
116730
  }
116460
116731
  async function installGatewayPluginForDoctor(target) {
116461
- const release = isPrereleaseVersion("0.2.8-beta-174fcb5625-260819115622") ? "beta" : "latest";
116732
+ const release = isPrereleaseVersion("0.2.8") ? "beta" : "latest";
116462
116733
  const insideTargetGateway = detectGatewayInvocation() === target;
116463
116734
  const options = {
116464
116735
  restart: !insideTargetGateway,
@@ -117301,6 +117572,11 @@ function initDoctorSentry() {
117301
117572
  }
117302
117573
  try {
117303
117574
  const dsn = process.env.OKX_A2A_SENTRY_DSN?.trim() || process.env.SENTRY_DSN?.trim() || FALLBACK_SENTRY_DSN;
117575
+ const aiProvider = normalizeAiRuntimeProvider(detectCurrentAiProvider());
117576
+ setRuntimeMetadata({
117577
+ aiProvider,
117578
+ runtimeSurface: detectAiRuntimeSurface(aiProvider)
117579
+ });
117304
117580
  initLogger({
117305
117581
  dsn,
117306
117582
  ...SENTRY_CONFIG,
@@ -117384,6 +117660,8 @@ var init_doctor_sentry = __esm({
117384
117660
  "use strict";
117385
117661
  init_sentry_config();
117386
117662
  init_sentry_logger();
117663
+ init_runtime_metadata();
117664
+ init_ai_provider();
117387
117665
  sentryReady = false;
117388
117666
  }
117389
117667
  });
@@ -117504,7 +117782,7 @@ async function runDoctor(options = {}) {
117504
117782
  platform: options.platform ?? process.platform,
117505
117783
  env: options.env ?? process.env,
117506
117784
  target: options.target ?? resolveDoctorTarget(options.env ?? process.env),
117507
- cliVersion: options.cliVersion ?? (true ? "0.2.8-beta-174fcb5625-260819115622" : "0.0.0"),
117785
+ cliVersion: options.cliVersion ?? (true ? "0.2.8" : "0.0.0"),
117508
117786
  fixMode: options.fix === true,
117509
117787
  nonInteractive: options.nonInteractive === true,
117510
117788
  packageChanged: false,
@@ -118520,6 +118798,7 @@ init_command_store();
118520
118798
  init_file_store();
118521
118799
  init_ai_provider();
118522
118800
  init_runtime_switch();
118801
+ init_runtime_metadata_store();
118523
118802
  init_job_provider();
118524
118803
  init_session_store();
118525
118804
  init_paths();
@@ -118528,9 +118807,10 @@ init_log_tail();
118528
118807
  init_win_spawn();
118529
118808
  init_sentry_logger();
118530
118809
  init_sentry_config();
118810
+ init_runtime_metadata();
118531
118811
  var CURRENT_GATEWAY_SESSION_KEYS_ENV4 = "OKX_A2A_CURRENT_GATEWAY_SESSION_KEYS";
118532
118812
  function printUsage3() {
118533
- console.log(`okx-a2a ${"0.2.8-beta-174fcb5625-260819115622"}
118813
+ console.log(`okx-a2a ${"0.2.8"}
118534
118814
 
118535
118815
  Usage:
118536
118816
  okx-a2a <command> [options]
@@ -118570,7 +118850,7 @@ Run \`okx-a2a <command> -h\` for command-specific help.
118570
118850
  `);
118571
118851
  }
118572
118852
  function printVersion() {
118573
- console.log("0.2.8-beta-174fcb5625-260819115622");
118853
+ console.log("0.2.8");
118574
118854
  }
118575
118855
  function printDaemonUsage() {
118576
118856
  console.log(`Usage: okx-a2a daemon <start|restart|stop|status|autostart> [options]
@@ -119403,6 +119683,10 @@ async function configureDefaultAiProviderForLifecycle(args, options = {}) {
119403
119683
  promptIfMissing: options.promptIfMissing ?? true,
119404
119684
  allowUnavailableProvider: options.allowUnavailableProvider
119405
119685
  });
119686
+ persistAiRuntimeSurfaceBestEffort(
119687
+ store,
119688
+ detectAiRuntimeSurface(provider.provider)
119689
+ );
119406
119690
  console.log(provider.message);
119407
119691
  } finally {
119408
119692
  store.close();
@@ -119622,6 +119906,10 @@ async function handleAiProvider(args) {
119622
119906
  requestedProvider: rawProvider,
119623
119907
  stderr: process.stderr
119624
119908
  });
119909
+ persistAiRuntimeSurfaceBestEffort(
119910
+ store,
119911
+ detectAiRuntimeSurface(choice.provider)
119912
+ );
119625
119913
  if (json) {
119626
119914
  console.log(JSON.stringify({ ok: true, provider: choice.provider, source: choice.source }));
119627
119915
  } else {
@@ -119896,7 +120184,7 @@ function assertSupportedNodeVersion() {
119896
120184
  var cliSentryInitAttempted = false;
119897
120185
  var cliSentryInitialized = false;
119898
120186
  var cliSentryFlushTimedOut = false;
119899
- function initDirectCliSentry() {
120187
+ async function initDirectCliSentry() {
119900
120188
  if (cliSentryInitAttempted) {
119901
120189
  return;
119902
120190
  }
@@ -119910,6 +120198,11 @@ function initDirectCliSentry() {
119910
120198
  if (typeof config.sentryDsn !== "string" || !config.sentryDsn) {
119911
120199
  return;
119912
120200
  }
120201
+ const aiProvider = normalizeAiRuntimeProvider(detectCurrentAiProvider());
120202
+ setRuntimeMetadata({
120203
+ aiProvider,
120204
+ runtimeSurface: detectAiRuntimeSurface(aiProvider)
120205
+ });
119913
120206
  initLogger({
119914
120207
  dsn: config.sentryDsn,
119915
120208
  ...SENTRY_CONFIG,
@@ -120038,7 +120331,7 @@ async function main() {
120038
120331
  if (command === "xmtp-test") {
120039
120332
  const { handleXmtpTestCommand: handleXmtpTestCommand2 } = await Promise.resolve().then(() => (init_xmtp_test_cli(), xmtp_test_cli_exports));
120040
120333
  await handleXmtpTestCommand2(process.argv.slice(3), {
120041
- packageVersion: "0.2.8-beta-174fcb5625-260819115622",
120334
+ packageVersion: "0.2.8",
120042
120335
  agentSdkVersion: "2.3.0",
120043
120336
  nodeSdkVersion: "6.1.0",
120044
120337
  nodeBindingsVersion: "1.11.0"
@@ -120046,53 +120339,53 @@ async function main() {
120046
120339
  return;
120047
120340
  }
120048
120341
  if (command === "xmtp-send") {
120049
- initDirectCliSentry();
120342
+ await initDirectCliSentry();
120050
120343
  await queueXmtpSend(process.argv.slice(3));
120051
120344
  await flushDirectCliSentry();
120052
120345
  return;
120053
120346
  }
120054
120347
  if (command === "task") {
120055
- initDirectCliSentry();
120348
+ await initDirectCliSentry();
120056
120349
  await handleTaskCommand(process.argv.slice(3));
120057
120350
  await flushDirectCliSentry();
120058
120351
  return;
120059
120352
  }
120060
120353
  if (command === "agent") {
120061
- initDirectCliSentry();
120354
+ await initDirectCliSentry();
120062
120355
  await handleAgentCommand(process.argv.slice(3));
120063
120356
  await flushDirectCliSentry();
120064
120357
  return;
120065
120358
  }
120066
120359
  if (command === "file") {
120067
- initDirectCliSentry();
120360
+ await initDirectCliSentry();
120068
120361
  const { handleFileCommand: handleFileCommand2 } = await Promise.resolve().then(() => (init_file_cli(), file_cli_exports));
120069
120362
  await handleFileCommand2(process.argv.slice(3));
120070
120363
  await flushDirectCliSentry();
120071
120364
  return;
120072
120365
  }
120073
120366
  if (command === "user") {
120074
- initDirectCliSentry();
120367
+ await initDirectCliSentry();
120075
120368
  const { handleUserCommand: handleUserCommand2 } = await Promise.resolve().then(() => (init_user_attention_cli(), user_attention_cli_exports));
120076
120369
  await handleUserCommand2(process.argv.slice(3));
120077
120370
  await flushDirectCliSentry();
120078
120371
  return;
120079
120372
  }
120080
120373
  if (command === "session") {
120081
- initDirectCliSentry();
120374
+ await initDirectCliSentry();
120082
120375
  const { handleSessionCommand: handleSessionCommand2 } = await Promise.resolve().then(() => (init_session_cli(), session_cli_exports));
120083
120376
  await handleSessionCommand2(process.argv.slice(3));
120084
120377
  await flushDirectCliSentry();
120085
120378
  return;
120086
120379
  }
120087
120380
  if (command === "xmtp-debug") {
120088
- initDirectCliSentry();
120381
+ await initDirectCliSentry();
120089
120382
  const { handleXmtpDebugCli: handleXmtpDebugCli2 } = await Promise.resolve().then(() => (init_xmtp_debug_cli(), xmtp_debug_cli_exports));
120090
120383
  await handleXmtpDebugCli2(process.argv.slice(3));
120091
120384
  await flushDirectCliSentry();
120092
120385
  return;
120093
120386
  }
120094
120387
  if (command === "ai") {
120095
- initDirectCliSentry();
120388
+ await initDirectCliSentry();
120096
120389
  const { handleAiCommand: handleAiCommand2 } = await Promise.resolve().then(() => (init_ai_cli(), ai_cli_exports));
120097
120390
  await handleAiCommand2(process.argv.slice(3));
120098
120391
  await flushDirectCliSentry();
@@ -120159,7 +120452,7 @@ main().then(() => {
120159
120452
  }
120160
120453
  console.error(err2 instanceof Error ? err2.stack ?? err2.message : String(err2));
120161
120454
  try {
120162
- initDirectCliSentry();
120455
+ await initDirectCliSentry();
120163
120456
  const command = process.argv[2] ?? "status";
120164
120457
  const subcommand = process.argv[3] ?? "";
120165
120458
  logger.error(LogEvent.DIRECT_CLI_FAILED, err2 instanceof Error ? err2 : new Error(String(err2)), directCliSentryExtra(command, {