@arbidocs/sdk 0.3.56 → 0.3.58

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/index.cjs CHANGED
@@ -6957,11 +6957,13 @@ var OpenClawOrchestrator = class {
6957
6957
  agentId;
6958
6958
  sessionKey;
6959
6959
  timeoutMs;
6960
+ spawnHome;
6960
6961
  constructor(options) {
6961
6962
  this.binaryPath = options.binaryPath ?? "openclaw";
6962
6963
  this.agentId = options.agentId ?? "arbi";
6963
- this.sessionKey = `arbi:${options.sessionId}`.replace(/[^a-zA-Z0-9:_-]/g, "-");
6964
+ this.sessionKey = `arbi-${options.sessionId}`.replace(/[^a-zA-Z0-9_-]/g, "-");
6964
6965
  this.timeoutMs = options.timeoutMs ?? 3e5;
6966
+ this.spawnHome = options.spawnHome;
6965
6967
  }
6966
6968
  async prompt(prompt) {
6967
6969
  return this.spawnOpenClaw(prompt);
@@ -6981,7 +6983,8 @@ var OpenClawOrchestrator = class {
6981
6983
  "--json"
6982
6984
  ];
6983
6985
  const child = child_process.spawn(this.binaryPath, args, {
6984
- stdio: ["ignore", "pipe", "pipe"]
6986
+ stdio: ["ignore", "pipe", "pipe"],
6987
+ env: this.spawnHome ? { ...process.env, HOME: this.spawnHome } : process.env
6985
6988
  });
6986
6989
  let stdout = "";
6987
6990
  let stderr = "";
@@ -7005,12 +7008,17 @@ var OpenClawOrchestrator = class {
7005
7008
  }
7006
7009
  try {
7007
7010
  const json = JSON.parse(stdout);
7008
- const payloads = json?.result?.payloads ?? [];
7011
+ const payloads = json?.payloads ?? json?.result?.payloads ?? [];
7009
7012
  const texts = payloads.map((p2) => p2.text ?? "").filter(Boolean);
7010
7013
  if (texts.length > 0) {
7011
7014
  resolve2(texts.join("\n"));
7012
7015
  return;
7013
7016
  }
7017
+ const finalText = json?.meta?.systemPromptReport?.finalAssistantVisibleText ?? json?.meta?.systemPromptReport?.finalAssistantRawText;
7018
+ if (typeof finalText === "string" && finalText.trim()) {
7019
+ resolve2(finalText.trim());
7020
+ return;
7021
+ }
7014
7022
  resolve2(stdout.trim());
7015
7023
  } catch {
7016
7024
  resolve2(stdout.trim());
@@ -7082,6 +7090,21 @@ async function startDmListener(options) {
7082
7090
  logError("Failed to send encrypted reply", err);
7083
7091
  }
7084
7092
  };
7093
+ try {
7094
+ const unreadFromParent = (await listDMs(arbi)).filter(
7095
+ (n2) => n2.type === "user_message" && n2.read === false && n2.sender?.external_id === parentExtId
7096
+ );
7097
+ if (unreadFromParent.length > 0) {
7098
+ log(`Backfilling ${unreadFromParent.length} unread DM(s) from parent`);
7099
+ for (const n2 of unreadFromParent) {
7100
+ await handleNotification(n2).catch(
7101
+ (err) => logError("Backfill handler error", err)
7102
+ );
7103
+ }
7104
+ }
7105
+ } catch (err) {
7106
+ logError("Failed to backfill unread DMs", err);
7107
+ }
7085
7108
  const ws = await connectWithReconnect({
7086
7109
  baseUrl,
7087
7110
  accessToken,