@arbidocs/sdk 0.3.57 → 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 +26 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +26 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -601,6 +601,15 @@ interface OpenClawOrchestratorOptions {
|
|
|
601
601
|
agentId?: string;
|
|
602
602
|
/** Timeout in ms per prompt (defaults to 300_000 = 5 min) */
|
|
603
603
|
timeoutMs?: number;
|
|
604
|
+
/**
|
|
605
|
+
* Override the HOME env for the spawned openclaw subprocess. Set this in
|
|
606
|
+
* multi-tenant deployments where ``arbi listen`` runs with a per-agent
|
|
607
|
+
* HOME (for its own .arbi config) but openclaw should still resolve its
|
|
608
|
+
* gateway config from the shared real ``/home/<user>`` — symlinks back
|
|
609
|
+
* to the global ``.openclaw`` are rejected by openclaw's exec sandbox,
|
|
610
|
+
* so a direct env override is the right escape hatch.
|
|
611
|
+
*/
|
|
612
|
+
spawnHome?: string;
|
|
604
613
|
}
|
|
605
614
|
declare class OpenClawOrchestrator implements Orchestrator {
|
|
606
615
|
readonly name = "openclaw";
|
|
@@ -608,6 +617,7 @@ declare class OpenClawOrchestrator implements Orchestrator {
|
|
|
608
617
|
private readonly agentId;
|
|
609
618
|
private readonly sessionKey;
|
|
610
619
|
private readonly timeoutMs;
|
|
620
|
+
private readonly spawnHome?;
|
|
611
621
|
constructor(options: OpenClawOrchestratorOptions);
|
|
612
622
|
prompt(prompt: string): Promise<string>;
|
|
613
623
|
close(): Promise<void>;
|
package/dist/index.d.ts
CHANGED
|
@@ -601,6 +601,15 @@ interface OpenClawOrchestratorOptions {
|
|
|
601
601
|
agentId?: string;
|
|
602
602
|
/** Timeout in ms per prompt (defaults to 300_000 = 5 min) */
|
|
603
603
|
timeoutMs?: number;
|
|
604
|
+
/**
|
|
605
|
+
* Override the HOME env for the spawned openclaw subprocess. Set this in
|
|
606
|
+
* multi-tenant deployments where ``arbi listen`` runs with a per-agent
|
|
607
|
+
* HOME (for its own .arbi config) but openclaw should still resolve its
|
|
608
|
+
* gateway config from the shared real ``/home/<user>`` — symlinks back
|
|
609
|
+
* to the global ``.openclaw`` are rejected by openclaw's exec sandbox,
|
|
610
|
+
* so a direct env override is the right escape hatch.
|
|
611
|
+
*/
|
|
612
|
+
spawnHome?: string;
|
|
604
613
|
}
|
|
605
614
|
declare class OpenClawOrchestrator implements Orchestrator {
|
|
606
615
|
readonly name = "openclaw";
|
|
@@ -608,6 +617,7 @@ declare class OpenClawOrchestrator implements Orchestrator {
|
|
|
608
617
|
private readonly agentId;
|
|
609
618
|
private readonly sessionKey;
|
|
610
619
|
private readonly timeoutMs;
|
|
620
|
+
private readonly spawnHome?;
|
|
611
621
|
constructor(options: OpenClawOrchestratorOptions);
|
|
612
622
|
prompt(prompt: string): Promise<string>;
|
|
613
623
|
close(): Promise<void>;
|
package/dist/index.js
CHANGED
|
@@ -6948,11 +6948,13 @@ var OpenClawOrchestrator = class {
|
|
|
6948
6948
|
agentId;
|
|
6949
6949
|
sessionKey;
|
|
6950
6950
|
timeoutMs;
|
|
6951
|
+
spawnHome;
|
|
6951
6952
|
constructor(options) {
|
|
6952
6953
|
this.binaryPath = options.binaryPath ?? "openclaw";
|
|
6953
6954
|
this.agentId = options.agentId ?? "arbi";
|
|
6954
|
-
this.sessionKey = `arbi
|
|
6955
|
+
this.sessionKey = `arbi-${options.sessionId}`.replace(/[^a-zA-Z0-9_-]/g, "-");
|
|
6955
6956
|
this.timeoutMs = options.timeoutMs ?? 3e5;
|
|
6957
|
+
this.spawnHome = options.spawnHome;
|
|
6956
6958
|
}
|
|
6957
6959
|
async prompt(prompt) {
|
|
6958
6960
|
return this.spawnOpenClaw(prompt);
|
|
@@ -6972,7 +6974,8 @@ var OpenClawOrchestrator = class {
|
|
|
6972
6974
|
"--json"
|
|
6973
6975
|
];
|
|
6974
6976
|
const child = spawn(this.binaryPath, args, {
|
|
6975
|
-
stdio: ["ignore", "pipe", "pipe"]
|
|
6977
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
6978
|
+
env: this.spawnHome ? { ...process.env, HOME: this.spawnHome } : process.env
|
|
6976
6979
|
});
|
|
6977
6980
|
let stdout = "";
|
|
6978
6981
|
let stderr = "";
|
|
@@ -6996,12 +6999,17 @@ var OpenClawOrchestrator = class {
|
|
|
6996
6999
|
}
|
|
6997
7000
|
try {
|
|
6998
7001
|
const json = JSON.parse(stdout);
|
|
6999
|
-
const payloads = json?.result?.payloads ?? [];
|
|
7002
|
+
const payloads = json?.payloads ?? json?.result?.payloads ?? [];
|
|
7000
7003
|
const texts = payloads.map((p2) => p2.text ?? "").filter(Boolean);
|
|
7001
7004
|
if (texts.length > 0) {
|
|
7002
7005
|
resolve2(texts.join("\n"));
|
|
7003
7006
|
return;
|
|
7004
7007
|
}
|
|
7008
|
+
const finalText = json?.meta?.systemPromptReport?.finalAssistantVisibleText ?? json?.meta?.systemPromptReport?.finalAssistantRawText;
|
|
7009
|
+
if (typeof finalText === "string" && finalText.trim()) {
|
|
7010
|
+
resolve2(finalText.trim());
|
|
7011
|
+
return;
|
|
7012
|
+
}
|
|
7005
7013
|
resolve2(stdout.trim());
|
|
7006
7014
|
} catch {
|
|
7007
7015
|
resolve2(stdout.trim());
|
|
@@ -7073,6 +7081,21 @@ async function startDmListener(options) {
|
|
|
7073
7081
|
logError("Failed to send encrypted reply", err);
|
|
7074
7082
|
}
|
|
7075
7083
|
};
|
|
7084
|
+
try {
|
|
7085
|
+
const unreadFromParent = (await listDMs(arbi)).filter(
|
|
7086
|
+
(n2) => n2.type === "user_message" && n2.read === false && n2.sender?.external_id === parentExtId
|
|
7087
|
+
);
|
|
7088
|
+
if (unreadFromParent.length > 0) {
|
|
7089
|
+
log(`Backfilling ${unreadFromParent.length} unread DM(s) from parent`);
|
|
7090
|
+
for (const n2 of unreadFromParent) {
|
|
7091
|
+
await handleNotification(n2).catch(
|
|
7092
|
+
(err) => logError("Backfill handler error", err)
|
|
7093
|
+
);
|
|
7094
|
+
}
|
|
7095
|
+
}
|
|
7096
|
+
} catch (err) {
|
|
7097
|
+
logError("Failed to backfill unread DMs", err);
|
|
7098
|
+
}
|
|
7076
7099
|
const ws = await connectWithReconnect({
|
|
7077
7100
|
baseUrl,
|
|
7078
7101
|
accessToken,
|