agent-phonon 0.2.3 → 0.2.4

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/daemon.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { ModelInfo } from '@agent-phonon/protocol';
2
+
1
3
  /**
2
4
  * daemon 配置(bug-bash B4)。
3
5
  *
@@ -25,10 +27,12 @@ interface AdapterConfig {
25
27
  claudeBaseUrl?: string;
26
28
  claudeAuthToken?: string;
27
29
  claudeDefaultModel?: string;
30
+ claudeModels?: ModelInfo[];
28
31
  /** codex:网关 baseUrl(/v1)/key/默认模型/wireApi。 */
29
32
  codexBaseUrl?: string;
30
33
  codexApiKey?: string;
31
34
  codexDefaultModel?: string;
35
+ codexModels?: ModelInfo[];
32
36
  codexWireApi?: "responses" | "chat";
33
37
  /** hermes:默认模型/provider(用现有 hermes config)。 */
34
38
  hermesModel?: string;
package/dist/daemon.js CHANGED
@@ -4244,11 +4244,12 @@ var OpenClawGatewayAdapter = class {
4244
4244
  if (subAgents.length === 0)
4245
4245
  subAgents = [{ id: this.defaultAgent }];
4246
4246
  const now = (/* @__PURE__ */ new Date()).toISOString();
4247
+ const gatewayModels = await this.listGatewayModels();
4247
4248
  return subAgents.map((a) => {
4248
4249
  if (a.workspace)
4249
4250
  this.workspaceCache.set(`openclaw:${a.id}`, a.workspace);
4250
4251
  const primaryModel = typeof a.model === "string" ? a.model : a.model?.primary;
4251
- const models = primaryModel ? [{ id: primaryModel, available: true }] : [];
4252
+ const models = gatewayModels.length > 0 ? gatewayModels : primaryModel ? [{ id: primaryModel, available: true }] : [];
4252
4253
  return {
4253
4254
  // 复合 agentId:openclaw:<subAgentId>(design D32)
4254
4255
  agentId: `openclaw:${a.id}`,
@@ -4261,6 +4262,32 @@ var OpenClawGatewayAdapter = class {
4261
4262
  };
4262
4263
  });
4263
4264
  }
4265
+ async listGatewayModels() {
4266
+ try {
4267
+ const r = await this.gw.rpc("models.list", { view: "all" }, 8e3);
4268
+ const rows = Array.isArray(r.models) ? r.models : [];
4269
+ const models = [];
4270
+ const seen = /* @__PURE__ */ new Set();
4271
+ for (const row of rows) {
4272
+ const id = typeof row.key === "string" ? row.key : typeof row.id === "string" ? row.id : void 0;
4273
+ if (!id || seen.has(id))
4274
+ continue;
4275
+ if (row.available === false || row.missing === true)
4276
+ continue;
4277
+ seen.add(id);
4278
+ const contextWindow = typeof row.contextWindow === "number" ? row.contextWindow : typeof row.contextTokens === "number" ? row.contextTokens : void 0;
4279
+ models.push({
4280
+ id,
4281
+ ...typeof row.name === "string" ? { displayName: row.name } : {},
4282
+ ...contextWindow && contextWindow > 0 ? { contextWindow } : {},
4283
+ available: true
4284
+ });
4285
+ }
4286
+ return models;
4287
+ } catch {
4288
+ return [];
4289
+ }
4290
+ }
4264
4291
  async createSession(params) {
4265
4292
  await this.gw.connect();
4266
4293
  const subAgent = params.agentConfig?.openclawAgent ?? (params.agentId.includes(":") ? params.agentId.split(":")[1] : this.defaultAgent);
@@ -4813,10 +4840,7 @@ var CodexAdapter = class {
4813
4840
  available,
4814
4841
  ...available ? {} : { unavailableReason: "codex CLI not found" },
4815
4842
  ...version ? { version } : {},
4816
- models: [
4817
- { id: "gpt-5.5", displayName: "GPT-5.5", available: true },
4818
- { id: "gpt-5.3-codex", displayName: "GPT-5.3 Codex", available: true }
4819
- ],
4843
+ models: this.env.models?.length ? this.env.models : [{ id: this.env.defaultModel, available: true }],
4820
4844
  capabilities: CAPABILITIES2,
4821
4845
  scannedAt: (/* @__PURE__ */ new Date()).toISOString()
4822
4846
  }];
@@ -5684,11 +5708,7 @@ var ClaudeCodeAdapter = class {
5684
5708
  available,
5685
5709
  ...available ? {} : { unavailableReason: "claude CLI not found" },
5686
5710
  ...version ? { version } : {},
5687
- models: [
5688
- { id: "claude-opus-4.6", displayName: "Claude Opus 4.6", available: true },
5689
- { id: "claude-opus-4.7", displayName: "Claude Opus 4.7", available: true },
5690
- { id: "claude-sonnet-4.6", displayName: "Claude Sonnet 4.6", available: true }
5691
- ],
5711
+ models: this.env.models?.length ? this.env.models : [{ id: this.env.defaultModel, available: true }],
5692
5712
  capabilities: CAPABILITIES5,
5693
5713
  scannedAt: (/* @__PURE__ */ new Date()).toISOString()
5694
5714
  }];