@ganglion/xacpx 0.15.2 → 0.15.3
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/bridge/bridge-main.js +22 -0
- package/dist/cli.js +21 -1
- package/dist/control/control-service.d.ts +5 -0
- package/package.json +1 -1
|
@@ -820,6 +820,13 @@ var init_streaming_prompt = __esm(() => {
|
|
|
820
820
|
];
|
|
821
821
|
});
|
|
822
822
|
|
|
823
|
+
// src/transport/model-not-advertised.ts
|
|
824
|
+
function isModelNotAdvertisedError(text) {
|
|
825
|
+
if (!text)
|
|
826
|
+
return false;
|
|
827
|
+
return /Cannot (?:apply --model|replay saved model)\b/i.test(text) || /did not advertise (?:that model|model support)/i.test(text);
|
|
828
|
+
}
|
|
829
|
+
|
|
823
830
|
// src/recovery/discover-parent-package-paths.ts
|
|
824
831
|
import { spawn as spawn2 } from "node:child_process";
|
|
825
832
|
import { createRequire as createRequire2 } from "node:module";
|
|
@@ -3913,6 +3920,21 @@ class BridgeRuntime {
|
|
|
3913
3920
|
throw new Error(message);
|
|
3914
3921
|
}
|
|
3915
3922
|
async ensureSession(input, onProgress) {
|
|
3923
|
+
try {
|
|
3924
|
+
return await this.attemptEnsureSession(input, onProgress);
|
|
3925
|
+
} catch (error) {
|
|
3926
|
+
const requestedModel = input.model?.trim();
|
|
3927
|
+
if (requestedModel && error instanceof EnsureSessionFailedError && isModelNotAdvertisedError(error.message)) {
|
|
3928
|
+
onProgress?.({
|
|
3929
|
+
kind: "note",
|
|
3930
|
+
text: `agent did not advertise model "${requestedModel}"; retrying with the agent's default model`
|
|
3931
|
+
});
|
|
3932
|
+
return await this.attemptEnsureSession({ ...input, model: undefined }, onProgress);
|
|
3933
|
+
}
|
|
3934
|
+
throw error;
|
|
3935
|
+
}
|
|
3936
|
+
}
|
|
3937
|
+
async attemptEnsureSession(input, onProgress) {
|
|
3916
3938
|
onProgress?.("spawn");
|
|
3917
3939
|
const timeoutMs = this.sessionInitTimeoutMs();
|
|
3918
3940
|
const now = this.options.now ?? Date.now;
|
package/dist/cli.js
CHANGED
|
@@ -31587,6 +31587,13 @@ var init_acpx_bridge_transport = __esm(() => {
|
|
|
31587
31587
|
init_quota_gated_reply_sink();
|
|
31588
31588
|
});
|
|
31589
31589
|
|
|
31590
|
+
// src/transport/model-not-advertised.ts
|
|
31591
|
+
function isModelNotAdvertisedError(text) {
|
|
31592
|
+
if (!text)
|
|
31593
|
+
return false;
|
|
31594
|
+
return /Cannot (?:apply --model|replay saved model)\b/i.test(text) || /did not advertise (?:that model|model support)/i.test(text);
|
|
31595
|
+
}
|
|
31596
|
+
|
|
31590
31597
|
// src/transport/prompt-media.ts
|
|
31591
31598
|
import { mkdtemp, open as open4, rm as rm9, writeFile as writeFile7 } from "node:fs/promises";
|
|
31592
31599
|
import { tmpdir as defaultTmpdir } from "node:os";
|
|
@@ -32481,6 +32488,18 @@ class AcpxCliTransport {
|
|
|
32481
32488
|
this.streamingHooks = streamingHooks;
|
|
32482
32489
|
}
|
|
32483
32490
|
async ensureSession(session3, _onProgress) {
|
|
32491
|
+
try {
|
|
32492
|
+
await this.runEnsureSession(session3);
|
|
32493
|
+
} catch (error2) {
|
|
32494
|
+
const requestedModel = session3.model?.trim();
|
|
32495
|
+
if (requestedModel && isModelNotAdvertisedError(error2 instanceof Error ? error2.message : null)) {
|
|
32496
|
+
await this.runEnsureSession({ ...session3, model: undefined });
|
|
32497
|
+
return;
|
|
32498
|
+
}
|
|
32499
|
+
throw error2;
|
|
32500
|
+
}
|
|
32501
|
+
}
|
|
32502
|
+
async runEnsureSession(session3) {
|
|
32484
32503
|
const args = this.buildArgs(session3, [
|
|
32485
32504
|
"sessions",
|
|
32486
32505
|
"new",
|
|
@@ -33841,7 +33860,8 @@ class ControlService {
|
|
|
33841
33860
|
workspace: session3.workspace,
|
|
33842
33861
|
transportSession: session3.transportSession,
|
|
33843
33862
|
running: this.deps.activeTurns.isActiveAnywhere(session3.alias),
|
|
33844
|
-
archived: session3.archived === true
|
|
33863
|
+
archived: session3.archived === true,
|
|
33864
|
+
...session3.agentCommand ? { agentCommand: session3.agentCommand } : {}
|
|
33845
33865
|
}));
|
|
33846
33866
|
}
|
|
33847
33867
|
async listNativeSessions(_chatKey, agent3, workspace3) {
|
|
@@ -18,6 +18,11 @@ export interface ControlSessionInfo {
|
|
|
18
18
|
transportSession: string;
|
|
19
19
|
running: boolean;
|
|
20
20
|
archived: boolean;
|
|
21
|
+
/** The agent adapter command this session runs (acpx-recorded, or the agent's resolved
|
|
22
|
+
* default). Surfaced so the web can avoid seeding a new session's model picker from a
|
|
23
|
+
* session on a different adapter version (whose advertised model ids may be in an
|
|
24
|
+
* incompatible format). Omitted when unknown. */
|
|
25
|
+
agentCommand?: string;
|
|
21
26
|
}
|
|
22
27
|
export interface ControlAgentInfo {
|
|
23
28
|
name: string;
|