@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/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");
@@ -19265,6 +19275,7 @@ var init_events = __esm({
19265
19275
  PROVIDER_READINESS_CHECKED: "Provider readiness checked",
19266
19276
  PROVIDER_SWITCHED: "Provider switched",
19267
19277
  JOB_PROVIDER_BOUND: "Job provider bound",
19278
+ ONCHAINOS_VERSION_OBSERVED: "OnchainOS version observed",
19268
19279
  // Hermes user-channel delivery only. The node and openclaw user-channel hops
19269
19280
  // keep emitting USER_DISPATCHED / PROMPT_USER_CHECKPOINT — one name per
19270
19281
  // transport is the whole point of splitting the send events.
@@ -19801,7 +19812,84 @@ var init_error_diagnostics = __esm({
19801
19812
  }
19802
19813
  });
19803
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
+
19804
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
+ }
19805
19893
  function applyFatalEventDefaults(event) {
19806
19894
  try {
19807
19895
  const classified = event?.extra?.eventName ?? event?.tags?.eventName;
@@ -19811,6 +19899,7 @@ function applyFatalEventDefaults(event) {
19811
19899
  const target = event;
19812
19900
  target.extra = {
19813
19901
  ...RELEASE_FIELDS,
19902
+ ...RUNTIME_FIELDS,
19814
19903
  ...target.extra ?? {},
19815
19904
  eventName: LogEvent.FATAL_UNCAUGHT,
19816
19905
  eventFamily: "diagnostics",
@@ -19831,6 +19920,9 @@ function applyFatalEventDefaults(event) {
19831
19920
  function isInfoEventAllowlisted(name) {
19832
19921
  return SENTRY_INFO_ALLOWLIST.has(name);
19833
19922
  }
19923
+ function isTagKey(key) {
19924
+ return SENTRY_TAG_KEYS.has(key);
19925
+ }
19834
19926
  function agentExtras(identity) {
19835
19927
  return {
19836
19928
  walletAddress: identity.walletAddress || UNKNOWN_FIELD,
@@ -19839,7 +19931,7 @@ function agentExtras(identity) {
19839
19931
  role: identity.role != null && identity.role !== "" ? String(identity.role) : UNKNOWN_FIELD
19840
19932
  };
19841
19933
  }
19842
- 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;
19843
19935
  var init_sentry_logger = __esm({
19844
19936
  "../core/src/sentry-logger/index.ts"() {
19845
19937
  "use strict";
@@ -19850,6 +19942,7 @@ var init_sentry_logger = __esm({
19850
19942
  init_log_fields();
19851
19943
  init_xmtp_test_metrics();
19852
19944
  init_error_diagnostics();
19945
+ init_runtime_metadata();
19853
19946
  init_events();
19854
19947
  init_log_fields();
19855
19948
  FLOW_ID = (0, import_node_crypto3.randomUUID)();
@@ -19936,6 +20029,7 @@ var init_sentry_logger = __esm({
19936
20029
  SENTRY_TAG_KEYS = /* @__PURE__ */ new Set([
19937
20030
  "agentId",
19938
20031
  "agentPlatform",
20032
+ "aiProvider",
19939
20033
  "cacheName",
19940
20034
  "causeCode",
19941
20035
  "causeType",
@@ -19958,6 +20052,8 @@ var init_sentry_logger = __esm({
19958
20052
  "kind",
19959
20053
  "method",
19960
20054
  "onchainosAgentId",
20055
+ "onchainosVersion",
20056
+ "onchainosVersionProbeStatus",
19961
20057
  "operation",
19962
20058
  "originPlatform",
19963
20059
  "outcome",
@@ -19974,6 +20070,7 @@ var init_sentry_logger = __esm({
19974
20070
  "role",
19975
20071
  "runId",
19976
20072
  "runtimeContainer",
20073
+ "runtimeSurface",
19977
20074
  "senderAgentId",
19978
20075
  "source",
19979
20076
  "stage",
@@ -20044,6 +20141,7 @@ var init_sentry_logger = __esm({
20044
20141
  LogEvent.PROVIDER_READINESS_CHECKED,
20045
20142
  LogEvent.PROVIDER_SWITCHED,
20046
20143
  LogEvent.JOB_PROVIDER_BOUND,
20144
+ LogEvent.ONCHAINOS_VERSION_OBSERVED,
20047
20145
  LogEvent.USER_CHANNEL_MESSAGE_DELIVERED,
20048
20146
  LogEvent.SYSTEM_NOTIFICATION_RECEIVED,
20049
20147
  LogEvent.SYSTEM_NOTIFICATION_ROUTED,
@@ -20099,6 +20197,7 @@ var init_sentry_logger = __esm({
20099
20197
  MAX_EXTRA_STRING_LENGTH = 256;
20100
20198
  MAX_TAG_VALUE_LENGTH = 128;
20101
20199
  RELEASE_FIELDS = {};
20200
+ RUNTIME_FIELDS = runtimeMetadataFields();
20102
20201
  SentryLogger = class _SentryLogger {
20103
20202
  static instance;
20104
20203
  initialized = false;
@@ -20118,6 +20217,9 @@ var init_sentry_logger = __esm({
20118
20217
  }
20119
20218
  try {
20120
20219
  RELEASE_FIELDS = releaseFields(config.release);
20220
+ if (config.runtimeMetadata) {
20221
+ setRuntimeMetadata(config.runtimeMetadata);
20222
+ }
20121
20223
  Sentry.init({
20122
20224
  dsn: config.dsn,
20123
20225
  release: config.release,
@@ -20137,6 +20239,14 @@ var init_sentry_logger = __esm({
20137
20239
  if (config.runtimeContainer) {
20138
20240
  tags.runtimeContainer = config.runtimeContainer;
20139
20241
  }
20242
+ for (const key of [
20243
+ "aiProvider",
20244
+ "runtimeSurface",
20245
+ "onchainosVersion",
20246
+ "onchainosVersionProbeStatus"
20247
+ ]) {
20248
+ tags[key] = RUNTIME_FIELDS[key] ?? "unknown";
20249
+ }
20140
20250
  Sentry.setTags(tags);
20141
20251
  } catch {
20142
20252
  return;
@@ -20149,6 +20259,7 @@ var init_sentry_logger = __esm({
20149
20259
  enrichCorrelationFields({
20150
20260
  flowId: FLOW_ID,
20151
20261
  ...RELEASE_FIELDS,
20262
+ ...RUNTIME_FIELDS,
20152
20263
  ...extra ?? {}
20153
20264
  })
20154
20265
  );
@@ -20183,6 +20294,7 @@ var init_sentry_logger = __esm({
20183
20294
  enrichCorrelationFields({
20184
20295
  flowId: FLOW_ID,
20185
20296
  ...RELEASE_FIELDS,
20297
+ ...RUNTIME_FIELDS,
20186
20298
  ...extra ?? {}
20187
20299
  })
20188
20300
  );
@@ -32323,7 +32435,7 @@ var init_sentry_config = __esm({
32323
32435
  environment = process.env.SENTRY_ENV === "dev" ? "dev" : "prod";
32324
32436
  SENTRY_CONFIG = {
32325
32437
  projectName: "okx/openclaw-okx-a2a-extension",
32326
- release: "0.2.8-beta-174fcb5625-260819115622",
32438
+ release: "0.2.8",
32327
32439
  environment,
32328
32440
  runtimeContainer: normalizeRuntimeContainer(process.env.OKX_A2A_RUNTIME_CONTAINER)
32329
32441
  };
@@ -33264,7 +33376,7 @@ async function getCurrentNodeCliVersion() {
33264
33376
  return await getGlobalNpmPackageVersion(UPDATE_PACKAGES.node) ?? getBundledNodeCliVersion();
33265
33377
  }
33266
33378
  function getBundledNodeCliVersion() {
33267
- return true ? "0.2.8-beta-174fcb5625-260819115622" : null;
33379
+ return true ? "0.2.8" : null;
33268
33380
  }
33269
33381
  function readConfiguredAiProvider() {
33270
33382
  const explicit = process.env.OKX_A2A_AI_PROVIDER || process.env.OKX_AGENT_TASK_AI_CLI;
@@ -33474,7 +33586,7 @@ async function updateHermes(release, options) {
33474
33586
  }
33475
33587
  }
33476
33588
  async function installGatewayPluginForDoctor(target) {
33477
- const release = isPrereleaseVersion("0.2.8-beta-174fcb5625-260819115622") ? "beta" : "latest";
33589
+ const release = isPrereleaseVersion("0.2.8") ? "beta" : "latest";
33478
33590
  const insideTargetGateway = detectGatewayInvocation() === target;
33479
33591
  const options = {
33480
33592
  restart: !insideTargetGateway,
@@ -44073,6 +44185,11 @@ function initDoctorSentry() {
44073
44185
  }
44074
44186
  try {
44075
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
+ });
44076
44193
  initLogger({
44077
44194
  dsn,
44078
44195
  ...SENTRY_CONFIG,
@@ -44156,6 +44273,8 @@ var init_doctor_sentry = __esm({
44156
44273
  "use strict";
44157
44274
  init_sentry_config();
44158
44275
  init_sentry_logger();
44276
+ init_runtime_metadata();
44277
+ init_ai_provider();
44159
44278
  sentryReady = false;
44160
44279
  }
44161
44280
  });
@@ -44276,6 +44395,7 @@ __export(index_exports, {
44276
44395
  createUserAttentionWatchParentMonitor: () => createUserAttentionWatchParentMonitor,
44277
44396
  currentOpenClawGatewaySessionKey: () => currentOpenClawGatewaySessionKey,
44278
44397
  detectAiProviders: () => detectAiProviders,
44398
+ detectAiRuntimeSurface: () => detectAiRuntimeSurface,
44279
44399
  detectCurrentAiProvider: () => detectCurrentAiProvider,
44280
44400
  detectGatewayInvocation: () => detectGatewayInvocation,
44281
44401
  detectMessageEligibleOfflineReplaySupport: () => detectMessageEligibleOfflineReplaySupport,
@@ -44296,6 +44416,7 @@ __export(index_exports, {
44296
44416
  getA2ACapabilities: () => getA2ACapabilities,
44297
44417
  getDaemonStatus: () => getDaemonStatus,
44298
44418
  getHermesGatewayPluginStatus: () => getHermesGatewayPluginStatus,
44419
+ getRuntimeMetadata: () => getRuntimeMetadata,
44299
44420
  getSessionBusyTracker: () => getSessionBusyTracker,
44300
44421
  handleCapabilitiesCommand: () => handleCapabilitiesCommand,
44301
44422
  handleDoctorCommand: () => handleDoctorCommand,
@@ -44323,6 +44444,7 @@ __export(index_exports, {
44323
44444
  isRetryableOpenClawGatewayError: () => isRetryableOpenClawGatewayError,
44324
44445
  isSqliteBusyError: () => isSqliteBusyError,
44325
44446
  isSystemdManagerUnavailableMessage: () => isSystemdManagerUnavailableMessage,
44447
+ isTagKey: () => isTagKey,
44326
44448
  isWindowsElevated: () => isWindowsElevated,
44327
44449
  killProcessTree: () => killProcessTree,
44328
44450
  launchdPlistHasCurrentRestartPolicy: () => launchdPlistHasCurrentRestartPolicy,
@@ -44334,16 +44456,19 @@ __export(index_exports, {
44334
44456
  messageEligibleHelpAdvertisesOfflineReplay: () => messageEligibleHelpAdvertisesOfflineReplay,
44335
44457
  nodeVersionSatisfies: () => nodeVersionSatisfies,
44336
44458
  normalizeAiProvider: () => normalizeAiProvider,
44459
+ normalizeAiRuntimeProvider: () => normalizeAiRuntimeProvider,
44337
44460
  normalizeHermesOkxA2aPluginConfig: () => normalizeHermesOkxA2aPluginConfig,
44338
44461
  notifyAgentMessageToUserAttention: () => notifyAgentMessageToUserAttention,
44339
44462
  notifyDirectToUserAttention: () => notifyDirectToUserAttention,
44340
44463
  notifySystemMessageToUser: () => notifySystemMessageToUser,
44341
44464
  notifyUserAttentionChanged: () => notifyUserAttentionChanged,
44342
44465
  parseLogsExportArgs: () => parseLogsExportArgs,
44466
+ parseOnchainosVersionOutput: () => parseOnchainosVersionOutput,
44343
44467
  parsePluginYamlVersion: () => parsePluginYamlVersion,
44344
44468
  parseWalletLoginStatus: () => parseWalletLoginStatus,
44345
44469
  parseWindowsParentProcessJson: () => parseWindowsParentProcessJson,
44346
44470
  performRuntimeSwitch: () => performRuntimeSwitch,
44471
+ persistAiRuntimeSurfaceBestEffort: () => persistAiRuntimeSurfaceBestEffort,
44347
44472
  persistCurrentRuntimeSelectionForNewJob: () => persistCurrentRuntimeSelectionForNewJob,
44348
44473
  pickOnchainosWin32Candidate: () => pickOnchainosWin32Candidate,
44349
44474
  prepareAndBindCurrentRuntimeForNewJob: () => prepareAndBindCurrentRuntimeForNewJob,
@@ -44353,11 +44478,13 @@ __export(index_exports, {
44353
44478
  processFileMessage: () => processFileMessage,
44354
44479
  queryWalletLoginStatus: () => queryWalletLoginStatus,
44355
44480
  readAiProviderTimeoutMs: () => readAiProviderTimeoutMs,
44481
+ readAiRuntimeSurfaceBestEffort: () => readAiRuntimeSurfaceBestEffort,
44356
44482
  readCachedCodexReadiness: () => readCachedCodexReadiness,
44357
44483
  readLastLines: () => readLastLines,
44358
44484
  readParentProcessCommandForPlatform: () => readParentProcessCommandForPlatform,
44359
44485
  readUserAttentionWatcherEvent: () => readUserAttentionWatcherEvent,
44360
44486
  refreshAgentsAndWait: () => refreshAgentsAndWait,
44487
+ refreshOnchainosVersionMetadata: () => refreshOnchainosVersionMetadata,
44361
44488
  registerUserAttentionWatcher: () => registerUserAttentionWatcher,
44362
44489
  releaseActiveDaemon: () => releaseActiveDaemon,
44363
44490
  removeUserAttentionWatcher: () => removeUserAttentionWatcher,
@@ -44399,8 +44526,10 @@ __export(index_exports, {
44399
44526
  runDoctor: () => runDoctor,
44400
44527
  runHeartbeatRefreshCycle: () => runHeartbeatRefreshCycle,
44401
44528
  runListener: () => runListener,
44529
+ runtimeMetadataFields: () => runtimeMetadataFields,
44402
44530
  scanUserAttentionWatchers: () => scanUserAttentionWatchers,
44403
44531
  setOpenClawWebSocketFactoryForTests: () => setOpenClawWebSocketFactoryForTests,
44532
+ setRuntimeMetadata: () => setRuntimeMetadata,
44404
44533
  shouldDelegateToSupervisor: () => shouldDelegateToSupervisor,
44405
44534
  shouldRouteThroughWindowsShell: () => shouldRouteThroughWindowsShell,
44406
44535
  spawnCompat: () => spawnCompat,
@@ -45438,6 +45567,8 @@ function aiRunSentryExtra(input) {
45438
45567
  // Every event this builder feeds describes one AI CLI child process.
45439
45568
  transport: "cli",
45440
45569
  eventFamily: "ai_run",
45570
+ // A daemon-spawned AI process is not a user-selected Desktop/CLI surface.
45571
+ runtimeSurface: "unknown",
45441
45572
  source: input.source,
45442
45573
  sessionKey: input.sessionKey,
45443
45574
  jobId: input.jobId ?? "",
@@ -45757,6 +45888,7 @@ var AiRunner = class {
45757
45888
  env: buildAiProviderEnv(command, {
45758
45889
  ...process.env,
45759
45890
  OKX_A2A_IS_CLI: "1",
45891
+ OKX_A2A_RUNTIME_SURFACE: "unknown",
45760
45892
  OKX_AGENT_TASK_AI_PROVIDER: provider,
45761
45893
  OKX_A2A_CURRENT_SESSION_KEY: request.sessionKey,
45762
45894
  OKX_A2A_CURRENT_MESSAGE_ID: request.messageId,
@@ -58927,14 +59059,99 @@ var import_node_child_process6 = require("node:child_process");
58927
59059
  var import_node_path22 = require("node:path");
58928
59060
  var import_node_util2 = require("node:util");
58929
59061
  init_sentry_logger();
59062
+ init_runtime_metadata();
58930
59063
  init_win_compat();
58931
59064
  var execFileAsync2 = (0, import_node_util2.promisify)(import_node_child_process6.execFile);
58932
59065
  var resolvedBin = null;
59066
+ var versionProbeInFlight = null;
58933
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;
58934
59070
  function resetResolvedOnchainosBinForTests() {
58935
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");
58936
59153
  }
58937
- async function resolve6() {
59154
+ async function resolve6(timeoutMs) {
58938
59155
  if (resolvedBin) {
58939
59156
  return resolvedBin;
58940
59157
  }
@@ -58954,7 +59171,8 @@ async function resolve6() {
58954
59171
  try {
58955
59172
  const shell = process.env.SHELL || "/bin/bash";
58956
59173
  const { stdout } = await execFileAsync2(shell, ["-lc", "command -v onchainos"], {
58957
- windowsHide: true
59174
+ windowsHide: true,
59175
+ timeout: timeoutMs
58958
59176
  });
58959
59177
  const bin = extractExecutablePath(stdout);
58960
59178
  if (bin) {
@@ -60715,7 +60933,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
60715
60933
  client: {
60716
60934
  id: "gateway-client",
60717
60935
  displayName: "okx-a2a-node",
60718
- version: "0.2.8-beta-174fcb5625-260819115622",
60936
+ version: "0.2.8",
60719
60937
  platform: "node",
60720
60938
  mode: "backend",
60721
60939
  instanceId
@@ -60726,7 +60944,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
60726
60944
  commands: [],
60727
60945
  permissions: {},
60728
60946
  locale: Intl.DateTimeFormat().resolvedOptions().locale || "en-US",
60729
- userAgent: `okx-a2a-node/${"0.2.8-beta-174fcb5625-260819115622"}`,
60947
+ userAgent: `okx-a2a-node/${"0.2.8"}`,
60730
60948
  auth: {
60731
60949
  ...config.token ? { token: config.token } : {},
60732
60950
  ...config.password ? { password: config.password } : {}
@@ -66474,7 +66692,47 @@ function userWatchEventDeliveredSentryExtra(event) {
66474
66692
  // src/listener.ts
66475
66693
  init_daemon_lock();
66476
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
66477
66734
  init_sentry_logger();
66735
+ init_runtime_metadata();
66478
66736
  init_sentry_config();
66479
66737
  var DEFAULT_OFFLINE_REPLAY_INTERVAL_SEC = 300;
66480
66738
  var DEFAULT_XMTP_CLIENT_RECYCLE_INTERVAL_SEC = 6 * 60 * 60;
@@ -66485,8 +66743,9 @@ var AUTH_RECOVERY_REFRESH_BACKOFF_MS = [6e4, 12e4, 3e5];
66485
66743
  async function runHeartbeatRefreshCycle(options) {
66486
66744
  const heartbeat = await timeSettled(options.heartbeat);
66487
66745
  const refreshAllowed = heartbeat.value === "performed" || heartbeat.value === "refresh_safe";
66746
+ const versionRefresh = options.versionRefresh && refreshAllowed ? await timeSettled(options.versionRefresh) : void 0;
66488
66747
  const refresh = options.refresh && refreshAllowed ? await timeSettled(options.refresh) : void 0;
66489
- return { heartbeat, refresh };
66748
+ return { heartbeat, versionRefresh, refresh };
66490
66749
  }
66491
66750
  var AgentRefreshAuthGate = class {
66492
66751
  authBlocked = false;
@@ -66913,15 +67172,25 @@ async function runListenerWithLock(options, paths) {
66913
67172
  });
66914
67173
  }
66915
67174
  });
66916
- service.setPluginVersion("0.2.8-beta-174fcb5625-260819115622");
67175
+ service.setPluginVersion("0.2.8");
66917
67176
  await service.init();
66918
67177
  const pluginVersionStatus = service.pluginVersionStatus;
66919
67178
  if (pluginVersionStatus.unavailable) {
66920
67179
  throw new Error(
66921
- `@okxweb3/a2a-node v${"0.2.8-beta-174fcb5625-260819115622"} is below the required minimum v${pluginVersionStatus.minVersion}`
67180
+ `@okxweb3/a2a-node v${"0.2.8"} is below the required minimum v${pluginVersionStatus.minVersion}`
66922
67181
  );
66923
67182
  }
66924
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
+ });
66925
67194
  if (systemConfig.sentryDsn) {
66926
67195
  initLogger({
66927
67196
  dsn: systemConfig.sentryDsn,
@@ -66936,7 +67205,7 @@ async function runListenerWithLock(options, paths) {
66936
67205
  onchainosAgentId: "*",
66937
67206
  reason: "system-config missing sentryDsn",
66938
67207
  pluginId: "@okxweb3/a2a-node",
66939
- pluginVersion: "0.2.8-beta-174fcb5625-260819115622"
67208
+ pluginVersion: "0.2.8"
66940
67209
  });
66941
67210
  }
66942
67211
  logWithTimestamp(
@@ -67194,6 +67463,7 @@ async function runListenerWithLock(options, paths) {
67194
67463
  timer = setInterval(() => {
67195
67464
  void runHeartbeatRefreshCycle({
67196
67465
  heartbeat: heartbeatTick,
67466
+ versionRefresh: refreshOnchainosVersionMetadata,
67197
67467
  refresh: syncTick
67198
67468
  });
67199
67469
  }, intervalSec * 1e3);
@@ -67298,7 +67568,8 @@ async function runListenerWithLock(options, paths) {
67298
67568
  });
67299
67569
  }, AUTH_RECOVERY_PROBE_INTERVAL_MS);
67300
67570
  void runHeartbeatRefreshCycle({
67301
- heartbeat: heartbeatTick
67571
+ heartbeat: heartbeatTick,
67572
+ versionRefresh: refreshOnchainosVersionMetadata
67302
67573
  });
67303
67574
  const commandProcessor = startCommandProcessor({
67304
67575
  service,
@@ -68281,6 +68552,7 @@ var JOB_PROVIDER_BINDING_SOURCES = [
68281
68552
 
68282
68553
  // src/index.ts
68283
68554
  init_sentry_logger();
68555
+ init_runtime_metadata();
68284
68556
  init_update_cli();
68285
68557
  init_win_spawn();
68286
68558
 
@@ -69634,7 +69906,7 @@ async function exportDiagnosticLogs(options) {
69634
69906
  node: process.version,
69635
69907
  platform: process.platform,
69636
69908
  arch: process.arch,
69637
- packageVersion: true ? "0.2.8-beta-174fcb5625-260819115622" : "unknown",
69909
+ packageVersion: true ? "0.2.8" : "unknown",
69638
69910
  sensitiveContentIncluded: options.includeSensitiveContent,
69639
69911
  listenerAndLlmContentIncluded: true,
69640
69912
  credentialsAlwaysRedacted: true,
@@ -70539,6 +70811,7 @@ async function refreshAgentsAndWait(timeoutMs = 6e4) {
70539
70811
  init_ai_provider();
70540
70812
  init_sentry_logger();
70541
70813
  init_log_fields();
70814
+ init_runtime_metadata();
70542
70815
  var RUNTIME_SWITCH_COMPONENT = "node_runtime_switch";
70543
70816
  async function performRuntimeSwitch(store, options = {}) {
70544
70817
  const result = await switchProviderWithReadinessGate({
@@ -70552,11 +70825,25 @@ async function performRuntimeSwitch(store, options = {}) {
70552
70825
  }
70553
70826
  async function switchProviderWithReadinessGate(options) {
70554
70827
  const gated = await switchProviderWithReadinessGateCore(options);
70555
- emitRuntimeSwitchCheckpoints(gated);
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);
70556
70836
  return gated.result;
70557
70837
  }
70558
- function emitRuntimeSwitchCheckpoints(gated) {
70838
+ function emitRuntimeSwitchCheckpoints(gated, env = process.env) {
70559
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
+ });
70560
70847
  logger.info(LogEvent.RUNTIME_DETECTED, {
70561
70848
  component: RUNTIME_SWITCH_COMPONENT,
70562
70849
  provider: runtime,
@@ -71501,7 +71788,7 @@ async function runDoctor(options = {}) {
71501
71788
  platform: options.platform ?? process.platform,
71502
71789
  env: options.env ?? process.env,
71503
71790
  target: options.target ?? resolveDoctorTarget(options.env ?? process.env),
71504
- cliVersion: options.cliVersion ?? (true ? "0.2.8-beta-174fcb5625-260819115622" : "0.0.0"),
71791
+ cliVersion: options.cliVersion ?? (true ? "0.2.8" : "0.0.0"),
71505
71792
  fixMode: options.fix === true,
71506
71793
  nonInteractive: options.nonInteractive === true,
71507
71794
  packageChanged: false,
@@ -71835,6 +72122,7 @@ init_autostart_windows();
71835
72122
  createUserAttentionWatchParentMonitor,
71836
72123
  currentOpenClawGatewaySessionKey,
71837
72124
  detectAiProviders,
72125
+ detectAiRuntimeSurface,
71838
72126
  detectCurrentAiProvider,
71839
72127
  detectGatewayInvocation,
71840
72128
  detectMessageEligibleOfflineReplaySupport,
@@ -71855,6 +72143,7 @@ init_autostart_windows();
71855
72143
  getA2ACapabilities,
71856
72144
  getDaemonStatus,
71857
72145
  getHermesGatewayPluginStatus,
72146
+ getRuntimeMetadata,
71858
72147
  getSessionBusyTracker,
71859
72148
  handleCapabilitiesCommand,
71860
72149
  handleDoctorCommand,
@@ -71882,6 +72171,7 @@ init_autostart_windows();
71882
72171
  isRetryableOpenClawGatewayError,
71883
72172
  isSqliteBusyError,
71884
72173
  isSystemdManagerUnavailableMessage,
72174
+ isTagKey,
71885
72175
  isWindowsElevated,
71886
72176
  killProcessTree,
71887
72177
  launchdPlistHasCurrentRestartPolicy,
@@ -71893,16 +72183,19 @@ init_autostart_windows();
71893
72183
  messageEligibleHelpAdvertisesOfflineReplay,
71894
72184
  nodeVersionSatisfies,
71895
72185
  normalizeAiProvider,
72186
+ normalizeAiRuntimeProvider,
71896
72187
  normalizeHermesOkxA2aPluginConfig,
71897
72188
  notifyAgentMessageToUserAttention,
71898
72189
  notifyDirectToUserAttention,
71899
72190
  notifySystemMessageToUser,
71900
72191
  notifyUserAttentionChanged,
71901
72192
  parseLogsExportArgs,
72193
+ parseOnchainosVersionOutput,
71902
72194
  parsePluginYamlVersion,
71903
72195
  parseWalletLoginStatus,
71904
72196
  parseWindowsParentProcessJson,
71905
72197
  performRuntimeSwitch,
72198
+ persistAiRuntimeSurfaceBestEffort,
71906
72199
  persistCurrentRuntimeSelectionForNewJob,
71907
72200
  pickOnchainosWin32Candidate,
71908
72201
  prepareAndBindCurrentRuntimeForNewJob,
@@ -71912,11 +72205,13 @@ init_autostart_windows();
71912
72205
  processFileMessage,
71913
72206
  queryWalletLoginStatus,
71914
72207
  readAiProviderTimeoutMs,
72208
+ readAiRuntimeSurfaceBestEffort,
71915
72209
  readCachedCodexReadiness,
71916
72210
  readLastLines,
71917
72211
  readParentProcessCommandForPlatform,
71918
72212
  readUserAttentionWatcherEvent,
71919
72213
  refreshAgentsAndWait,
72214
+ refreshOnchainosVersionMetadata,
71920
72215
  registerUserAttentionWatcher,
71921
72216
  releaseActiveDaemon,
71922
72217
  removeUserAttentionWatcher,
@@ -71958,8 +72253,10 @@ init_autostart_windows();
71958
72253
  runDoctor,
71959
72254
  runHeartbeatRefreshCycle,
71960
72255
  runListener,
72256
+ runtimeMetadataFields,
71961
72257
  scanUserAttentionWatchers,
71962
72258
  setOpenClawWebSocketFactoryForTests,
72259
+ setRuntimeMetadata,
71963
72260
  shouldDelegateToSupervisor,
71964
72261
  shouldRouteThroughWindowsShell,
71965
72262
  spawnCompat,