@alook/daemon 0.1.52 → 0.1.53

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/cli/index.js CHANGED
@@ -21973,6 +21973,21 @@ var OwnerDiagnosticReportSchema = exports_external.discriminatedUnion("status",
21973
21973
  }).strict()
21974
21974
  ]);
21975
21975
 
21976
+ // ../shared/src/runtime-models-contract.ts
21977
+ var RUNTIME_MODEL_DISCOVERY_CAPABILITY = "runtime-model-discovery-v1";
21978
+ var RuntimeModelDiscoveryRequestSchema = exports_external.strictObject({
21979
+ requestId: exports_external.string().min(1).max(128),
21980
+ runtimeId: exports_external.string().min(1).max(64)
21981
+ });
21982
+ var RuntimeModelDiscoveryCommandSchema = RuntimeModelDiscoveryRequestSchema.extend({
21983
+ type: exports_external.literal("runtime:discover_models")
21984
+ });
21985
+ var RuntimeModelDiscoveryErrorSchema = exports_external.strictObject({
21986
+ status: exports_external.literal("error"),
21987
+ code: exports_external.string().min(1).max(64),
21988
+ message: exports_external.string().min(1).max(256)
21989
+ });
21990
+
21976
21991
  // ../shared/src/community-cli-contract.ts
21977
21992
  var AGENT_EVENT_PROMPT_MAX_LENGTH = 32768;
21978
21993
  var DM_SERVER = ".dm";
@@ -22057,6 +22072,7 @@ function parseSeq(s) {
22057
22072
  return n;
22058
22073
  }
22059
22074
  var HostCommandSchema = exports_external.discriminatedUnion("type", [
22075
+ RuntimeModelDiscoveryCommandSchema,
22060
22076
  exports_external.strictObject({
22061
22077
  type: exports_external.literal("machine:heartbeat"),
22062
22078
  nonce: exports_external.string().min(1).max(128)
@@ -23349,6 +23365,17 @@ var CommunityMachineRuntimeListSchema = exports_external.array(CommunityMachineR
23349
23365
  }
23350
23366
  return out;
23351
23367
  });
23368
+ var RuntimeModelDiscoveryResultSchema = exports_external.discriminatedUnion("status", [
23369
+ exports_external.strictObject({ status: exports_external.literal("complete"), catalog: RuntimeReasoningCatalogSchema.nullable() }),
23370
+ RuntimeModelDiscoveryErrorSchema
23371
+ ]);
23372
+ var HostRuntimeModelsFrameSchema = RuntimeModelDiscoveryRequestSchema.extend({
23373
+ type: exports_external.literal("runtime_models"),
23374
+ result: exports_external.discriminatedUnion("status", [
23375
+ exports_external.strictObject({ status: exports_external.literal("complete"), runtimeReport: CommunityMachineRuntimeListSchema }),
23376
+ RuntimeModelDiscoveryErrorSchema
23377
+ ])
23378
+ });
23352
23379
  var CommunityRunningAgentListSchema = exports_external.array(exports_external.string()).transform((list) => {
23353
23380
  const seen = new Set;
23354
23381
  const out = [];
@@ -24698,6 +24725,13 @@ var communityBotAuditEventSchema = exports_external.strictObject({
24698
24725
  launchId: nullableString.optional(),
24699
24726
  createdAt: string4
24700
24727
  }).refine((event) => Object.prototype.hasOwnProperty.call(event, "payload"));
24728
+ var communityRuntimeModelsSchema = exports_external.strictObject({
24729
+ type: exports_external.literal("community:runtime.models"),
24730
+ machineId: exports_external.string().min(1),
24731
+ requestId: exports_external.string().min(1).max(128),
24732
+ runtimeId: exports_external.string().min(1).max(64),
24733
+ result: RuntimeModelDiscoveryResultSchema
24734
+ });
24701
24735
  var commonCommunityEventSchemas = [
24702
24736
  communityMessageUpdatedSchema,
24703
24737
  communityMessageEditedSchema,
@@ -24736,6 +24770,7 @@ var commonCommunityEventSchemas = [
24736
24770
  communityMachineCreatedSchema,
24737
24771
  communityMachineStatusSchema,
24738
24772
  communityMachineUpdatedSchema,
24773
+ communityRuntimeModelsSchema,
24739
24774
  communityMachineRemovedSchema,
24740
24775
  communityBotAuditEventSchema
24741
24776
  ];
@@ -24806,6 +24841,7 @@ var WS_EVENTS = {
24806
24841
  MACHINE_CREATED: "community:machine.created",
24807
24842
  MACHINE_STATUS: "community:machine.status",
24808
24843
  MACHINE_UPDATED: "community:machine.updated",
24844
+ RUNTIME_MODELS: "community:runtime.models",
24809
24845
  MACHINE_REMOVED: "community:machine.removed",
24810
24846
  BOT_AUDIT_EVENT: "community:bot.audit_event"
24811
24847
  };
@@ -26790,6 +26826,56 @@ function tryParseJsonRecord(line) {
26790
26826
  import { existsSync as existsSync2 } from "node:fs";
26791
26827
  import { homedir as homedir2 } from "node:os";
26792
26828
  import { join as join4 } from "node:path";
26829
+
26830
+ // agent-driver/dist/internal/modelCatalog.js
26831
+ var RUNTIME_MODEL_CATALOG_MAX = 1024;
26832
+ var RUNTIME_MODEL_ID_MAX = 100;
26833
+ function normalizeRuntimeModelId(value) {
26834
+ if (typeof value !== "string")
26835
+ return;
26836
+ const id3 = value.trim();
26837
+ if (!id3 || id3.length > RUNTIME_MODEL_ID_MAX || /\s/.test(id3))
26838
+ return;
26839
+ return id3;
26840
+ }
26841
+ function catalogFromIds(ids) {
26842
+ const seen = new Set;
26843
+ const models = [];
26844
+ for (const rawId of ids) {
26845
+ const id3 = normalizeRuntimeModelId(rawId);
26846
+ if (!id3 || seen.has(id3))
26847
+ continue;
26848
+ if (models.length >= RUNTIME_MODEL_CATALOG_MAX)
26849
+ break;
26850
+ seen.add(id3);
26851
+ models.push({ id: id3, supportedReasoningEfforts: [] });
26852
+ }
26853
+ if (models.length === 0)
26854
+ return;
26855
+ return { updateMode: "unsupported", models };
26856
+ }
26857
+ function parseOpenCodeModelCatalog(output2) {
26858
+ const ids = output2.split(/\r?\n/).flatMap((line) => {
26859
+ const id3 = normalizeRuntimeModelId(line);
26860
+ return id3 && /^[^/]+\/.+$/.test(id3) ? [id3] : [];
26861
+ });
26862
+ return catalogFromIds(ids);
26863
+ }
26864
+ function parsePiModelCatalog(values) {
26865
+ if (!Array.isArray(values))
26866
+ return;
26867
+ const ids = values.flatMap((value) => {
26868
+ if (!value || typeof value !== "object")
26869
+ return [];
26870
+ const model = value;
26871
+ const provider = normalizeRuntimeModelId(model.provider);
26872
+ const id3 = normalizeRuntimeModelId(model.id);
26873
+ return provider && id3 && !provider.includes("/") ? [`${provider}/${id3}`] : [];
26874
+ });
26875
+ return catalogFromIds(ids);
26876
+ }
26877
+
26878
+ // agent-driver/dist/adapters/agy/probe.js
26793
26879
  function agySpawnSpec(command, deps = {}, platform = process.platform) {
26794
26880
  const explicit = command?.trim();
26795
26881
  if (explicit)
@@ -26799,27 +26885,39 @@ function agySpawnSpec(command, deps = {}, platform = process.platform) {
26799
26885
  const selected = resolveCommandOnPath("agy", deps) ?? (existsSync2(installed) ? installed : "agy");
26800
26886
  return resolveSpawnSpec("agy", [], selected, deps, platform);
26801
26887
  }
26802
- async function probeAgy(command) {
26803
- const spec = agySpawnSpec(command);
26804
- const version3 = probeCommandVersion(spec.command);
26805
- if (!version3.ok)
26806
- return { status: "unhealthy", lastError: version3.error };
26807
- const child = spawnAgentProcess(spec.command, ["--help"], { cwd: process.cwd(), env: { ...process.env, CI: "1" }, shell: spec.shell, stdin: "ignore" });
26888
+ function parseAgyModelCatalog(output2) {
26889
+ const models = [];
26890
+ const seen = new Set;
26891
+ for (const line of output2.split(/\r?\n/)) {
26892
+ const match = line.match(/^(\S+)\t+(.+)$/);
26893
+ const id3 = normalizeRuntimeModelId(match?.[1]);
26894
+ const displayName = match?.[2]?.trim();
26895
+ if (!id3 || !displayName || seen.has(id3))
26896
+ continue;
26897
+ if (models.length === RUNTIME_MODEL_CATALOG_MAX)
26898
+ break;
26899
+ seen.add(id3);
26900
+ models.push({ id: id3, displayName: displayName.slice(0, 256), supportedReasoningEfforts: [] });
26901
+ }
26902
+ return models.length ? { updateMode: "unsupported", models } : undefined;
26903
+ }
26904
+ async function readAgyCommand(spec, args, includeStderr) {
26905
+ const child = spawnAgentProcess(spec.command, args, { cwd: process.cwd(), env: { ...process.env, CI: "1", AGY_CLI_DISABLE_AUTO_UPDATE: "true" }, shell: spec.shell, stdin: "ignore" });
26808
26906
  try {
26809
- const help = await new Promise((resolve, reject) => {
26907
+ return await new Promise((resolve, reject) => {
26810
26908
  let output2 = "";
26811
- const timer = setTimeout(() => reject(new Error("timeout")), 3000);
26909
+ const timer = setTimeout(() => reject(new Error("timeout")), includeStderr ? 5000 : 30000);
26812
26910
  const fail = () => {
26813
26911
  clearTimeout(timer);
26814
- reject(new Error("help failed"));
26912
+ reject(new Error("command failed"));
26815
26913
  };
26816
26914
  const collect = (chunk2) => {
26817
26915
  output2 += chunk2.toString();
26818
- if (Buffer.byteLength(output2) > 64 * 1024)
26916
+ if (Buffer.byteLength(output2) > (includeStderr ? 64 * 1024 : 1024 * 1024))
26819
26917
  fail();
26820
26918
  };
26821
26919
  child.stdout?.on("data", collect);
26822
- child.stderr?.on("data", collect);
26920
+ child.stderr?.on("data", includeStderr ? collect : () => {});
26823
26921
  child.on("error", fail);
26824
26922
  child.on("close", (code) => {
26825
26923
  clearTimeout(timer);
@@ -26829,14 +26927,34 @@ async function probeAgy(command) {
26829
26927
  fail();
26830
26928
  });
26831
26929
  });
26832
- return ["--input-format", "--output-format", "stream-json", "--conversation"].every((flag) => help.includes(flag)) ? { status: "healthy", version: version3.version } : { status: "unhealthy", version: version3.version, lastError: "agy_stream_incompatible" };
26833
- } catch {
26834
- return { status: "unhealthy", version: version3.version, lastError: "agy_stream_probe_failed" };
26835
26930
  } finally {
26836
26931
  if (child.pid)
26837
26932
  await killProcessTree(child.pid, { graceMs: 100 });
26838
26933
  }
26839
26934
  }
26935
+ async function probeAgy(command, includeModels = false) {
26936
+ const spec = agySpawnSpec(command);
26937
+ const version3 = probeCommandVersion(spec.command);
26938
+ if (!version3.ok)
26939
+ return { status: "unhealthy", lastError: version3.error };
26940
+ let help;
26941
+ try {
26942
+ help = await readAgyCommand(spec, ["--help"], true);
26943
+ } catch {
26944
+ return { status: "unhealthy", version: version3.version, lastError: "agy_stream_probe_failed" };
26945
+ }
26946
+ if (!["--input-format", "--output-format", "stream-json", "--conversation"].every((flag) => help.includes(flag))) {
26947
+ return { status: "unhealthy", version: version3.version, lastError: "agy_stream_incompatible" };
26948
+ }
26949
+ if (!includeModels || !/\bmodels\b/.test(help))
26950
+ return { status: "healthy", version: version3.version };
26951
+ try {
26952
+ const reasoning = parseAgyModelCatalog(await readAgyCommand(spec, ["models"], false));
26953
+ return reasoning ? { status: "healthy", version: version3.version, reasoning } : { status: "unhealthy", version: version3.version, lastError: "agy_model_catalog_invalid" };
26954
+ } catch {
26955
+ return { status: "unhealthy", version: version3.version, lastError: "agy_model_probe_failed" };
26956
+ }
26957
+ }
26840
26958
 
26841
26959
  // agent-driver/dist/internal/token-usage.js
26842
26960
  function validIdentityPart(value) {
@@ -26930,8 +27048,8 @@ class AgyDriver {
26930
27048
  constructor(launchSpec) {
26931
27049
  this.launchSpec = launchSpec;
26932
27050
  }
26933
- probe(command) {
26934
- return probeAgy(command);
27051
+ probe(command, includeModels = true) {
27052
+ return probeAgy(command, includeModels);
26935
27053
  }
26936
27054
  async openLane(ctx, options) {
26937
27055
  const spec = agySpawnSpec(resolveLaunchFieldsOrDefault(ctx.config.runtimeConfig).command);
@@ -27265,54 +27383,6 @@ async function queryNativeRows(path5, cursor, loadSqlite = async () => {
27265
27383
  }
27266
27384
  }
27267
27385
 
27268
- // agent-driver/dist/internal/modelCatalog.js
27269
- var RUNTIME_MODEL_CATALOG_MAX = 1024;
27270
- var RUNTIME_MODEL_ID_MAX = 100;
27271
- function normalizeRuntimeModelId(value) {
27272
- if (typeof value !== "string")
27273
- return;
27274
- const id3 = value.trim();
27275
- if (!id3 || id3.length > RUNTIME_MODEL_ID_MAX || /\s/.test(id3))
27276
- return;
27277
- return id3;
27278
- }
27279
- function catalogFromIds(ids) {
27280
- const seen = new Set;
27281
- const models = [];
27282
- for (const rawId of ids) {
27283
- const id3 = normalizeRuntimeModelId(rawId);
27284
- if (!id3 || seen.has(id3))
27285
- continue;
27286
- if (models.length >= RUNTIME_MODEL_CATALOG_MAX)
27287
- break;
27288
- seen.add(id3);
27289
- models.push({ id: id3, supportedReasoningEfforts: [] });
27290
- }
27291
- if (models.length === 0)
27292
- return;
27293
- return { updateMode: "unsupported", models };
27294
- }
27295
- function parseOpenCodeModelCatalog(output2) {
27296
- const ids = output2.split(/\r?\n/).flatMap((line) => {
27297
- const id3 = normalizeRuntimeModelId(line);
27298
- return id3 && /^[^/]+\/.+$/.test(id3) ? [id3] : [];
27299
- });
27300
- return catalogFromIds(ids);
27301
- }
27302
- function parsePiModelCatalog(values) {
27303
- if (!Array.isArray(values))
27304
- return;
27305
- const ids = values.flatMap((value) => {
27306
- if (!value || typeof value !== "object")
27307
- return [];
27308
- const model = value;
27309
- const provider = normalizeRuntimeModelId(model.provider);
27310
- const id3 = normalizeRuntimeModelId(model.id);
27311
- return provider && id3 && !provider.includes("/") ? [`${provider}/${id3}`] : [];
27312
- });
27313
- return catalogFromIds(ids);
27314
- }
27315
-
27316
27386
  // agent-driver/dist/adapters/antigravity/catalog.js
27317
27387
  function choices(value) {
27318
27388
  if (!Array.isArray(value))
@@ -28131,23 +28201,25 @@ function antigravitySpawnSpec(command, platform = process.platform) {
28131
28201
  }
28132
28202
  async function probeAntigravity(command, options = {}) {
28133
28203
  const spec = antigravitySpawnSpec(command);
28204
+ const includeModels = options.includeModels !== false;
28134
28205
  const identity = createHash3("sha256").update(JSON.stringify([spec.command, process.env.GEMINI_HOME ?? ""])).digest("hex").slice(0, 16);
28135
- const directory = options.cacheDirectory ?? join6(homedir5(), ".cache", "alook", "antigravity-probe", identity);
28206
+ const directory = options.cacheDirectory ?? (includeModels ? join6(homedir5(), ".cache", "alook", "antigravity-probe", identity) : homedir5());
28136
28207
  const cacheFile = join6(directory, "session");
28137
28208
  let cachedSessionId;
28138
- try {
28139
- mkdirSync3(directory, { recursive: true, mode: 448 });
28209
+ if (includeModels)
28140
28210
  try {
28141
- const value = readFileSync2(cacheFile, "utf8");
28142
- if (/^[A-Za-z0-9_-]{1,100}$/.test(value))
28143
- cachedSessionId = value;
28144
- } catch (error62) {
28145
- if (error62.code !== "ENOENT")
28146
- throw error62;
28211
+ mkdirSync3(directory, { recursive: true, mode: 448 });
28212
+ try {
28213
+ const value = readFileSync2(cacheFile, "utf8");
28214
+ if (/^[A-Za-z0-9_-]{1,100}$/.test(value))
28215
+ cachedSessionId = value;
28216
+ } catch (error62) {
28217
+ if (error62.code !== "ENOENT")
28218
+ throw error62;
28219
+ }
28220
+ } catch {
28221
+ return { status: "unhealthy", lastError: "antigravity_acp_probe_storage_failed" };
28147
28222
  }
28148
- } catch {
28149
- return { status: "unhealthy", lastError: "antigravity_acp_probe_storage_failed" };
28150
- }
28151
28223
  let proc;
28152
28224
  try {
28153
28225
  proc = (options.spawn ?? spawnAgentProcess)(spec.command, spec.args, {
@@ -28272,6 +28344,10 @@ async function probeAntigravity(command, options = {}) {
28272
28344
  return fail("antigravity_acp_incompatible");
28273
28345
  const reportedVersion = asRecord(result.agentInfo)?.version;
28274
28346
  version3 = typeof reportedVersion === "string" ? reportedVersion : undefined;
28347
+ if (!includeModels) {
28348
+ finish({ status: "healthy", ...version3 ? { version: version3 } : {} });
28349
+ continue;
28350
+ }
28275
28351
  requestSession(cachedSessionId);
28276
28352
  }
28277
28353
  });
@@ -28293,8 +28369,8 @@ class AntigravityDriver {
28293
28369
  wakeStart: "immediate",
28294
28370
  terminalOwnership: "transport_request"
28295
28371
  };
28296
- probe(command) {
28297
- return probeAntigravity(command);
28372
+ probe(command, includeModels = true) {
28373
+ return includeModels ? probeAntigravity(command) : probeAntigravity(command, { includeModels: false });
28298
28374
  }
28299
28375
  async openLane(ctx, options) {
28300
28376
  return new AntigravityAcpLane(this, ctx, { onRawStdoutLine: options?.onRawStdoutLine });
@@ -29020,13 +29096,13 @@ class ClaudeDriver {
29020
29096
  this.eventNormalizer.beginTurn();
29021
29097
  return receipt;
29022
29098
  }
29023
- probe(command) {
29099
+ probe(command, includeModels = true) {
29024
29100
  const explicit = command?.trim();
29025
29101
  const base = explicit ? (() => {
29026
29102
  const result = probeCommandVersion(explicit);
29027
29103
  return result.ok ? { status: "healthy", version: result.version } : { status: "unhealthy", lastError: result.error };
29028
29104
  })() : probeClaude();
29029
- return base.status === "healthy" ? { ...base, reasoning: CLAUDE_MODEL_CATALOG } : base;
29105
+ return base.status === "healthy" && includeModels ? { ...base, reasoning: CLAUDE_MODEL_CATALOG } : base;
29030
29106
  }
29031
29107
  async openLane(ctx, options) {
29032
29108
  return createProcessLane(this, ctx, { onRawStdoutLine: options?.onRawStdoutLine });
@@ -29821,10 +29897,12 @@ class CodexDriver {
29821
29897
  get codexHome() {
29822
29898
  return this.codexHomeRoot;
29823
29899
  }
29824
- async probe(command) {
29900
+ async probe(command, includeModels = true) {
29825
29901
  const result = await probeCliRuntime("codex", {}, command);
29826
29902
  if (result.status !== "healthy")
29827
29903
  return result;
29904
+ if (!includeModels)
29905
+ return result;
29828
29906
  return {
29829
29907
  ...result,
29830
29908
  reasoning: await this.probeReasoningCatalog(command)
@@ -31189,10 +31267,12 @@ class CursorDriver {
31189
31267
  constructor(catalogProbe = probeCursorAcpCatalog) {
31190
31268
  this.catalogProbe = catalogProbe;
31191
31269
  }
31192
- async probe(command) {
31270
+ async probe(command, includeModels = true) {
31193
31271
  const result = probeCliRuntime("cursor-agent", {}, command);
31194
31272
  if (result.status !== "healthy")
31195
31273
  return result;
31274
+ if (!includeModels)
31275
+ return result;
31196
31276
  let reasoning;
31197
31277
  try {
31198
31278
  reasoning = await this.catalogProbe(command);
@@ -31393,6 +31473,8 @@ async function probeGrokAcpCatalog(command, options = {}) {
31393
31473
  }
31394
31474
  return finish({ status: "unhealthy", lastError: "grok_acp_cached_auth_unsupported" });
31395
31475
  }
31476
+ if (options.includeModels === false)
31477
+ return finish({ status: "compatible" });
31396
31478
  catalog = catalogFromInitialize(result) ?? catalog;
31397
31479
  expectedId = 2;
31398
31480
  write("authenticate", { methodId: AUTH_METHOD_ID4 }, expectedId);
@@ -32402,13 +32484,13 @@ class GrokDriver {
32402
32484
  this.catalogProbe = catalogProbe;
32403
32485
  this.spawnProcess = spawnProcess;
32404
32486
  }
32405
- async probe(command) {
32487
+ async probe(command, includeModels = true) {
32406
32488
  const result = probeCliRuntime("grok", {}, command);
32407
32489
  if (result.status !== "healthy")
32408
32490
  return result;
32409
32491
  let acpProbe;
32410
32492
  try {
32411
- acpProbe = await this.catalogProbe(command);
32493
+ acpProbe = includeModels ? await this.catalogProbe(command) : await this.catalogProbe(command, { includeModels: false });
32412
32494
  } catch {
32413
32495
  acpProbe = { status: "unhealthy", lastError: "grok_acp_probe_failed" };
32414
32496
  }
@@ -34206,7 +34288,7 @@ class OpenCodeDriver {
34206
34288
  throw new Error("Installed OpenCode CLI could not report its version");
34207
34289
  return discoverOpenCodeRecentContext(request, { compatibility: resolveOpenCodeCompatibility(result.version) });
34208
34290
  }
34209
- probe(command) {
34291
+ probe(command, includeModels = true) {
34210
34292
  const result = this.versionProbe("opencode", {}, command);
34211
34293
  if (result.status !== "healthy")
34212
34294
  return result;
@@ -34216,6 +34298,8 @@ class OpenCodeDriver {
34216
34298
  } catch {
34217
34299
  return { ...result, status: "unhealthy", lastError: "unsupported_opencode_cli_version" };
34218
34300
  }
34301
+ if (!includeModels)
34302
+ return result;
34219
34303
  const spec = resolveSpawnSpec("opencode", [...compatibility.modelArgs], command);
34220
34304
  const output2 = this.outputProbe(spec.command, spec.args);
34221
34305
  return {
@@ -34696,16 +34780,18 @@ class PiDriver {
34696
34780
  this.loadSdk = loadSdk;
34697
34781
  this.readVersion = readVersion;
34698
34782
  }
34699
- async probe() {
34783
+ async probe(_command, includeModels = true) {
34700
34784
  const version3 = this.readVersion();
34701
34785
  if (!version3) {
34702
34786
  return { status: "unhealthy", lastError: "sdk_not_installed" };
34703
34787
  }
34788
+ if (!includeModels)
34789
+ return { status: "healthy", version: version3 };
34704
34790
  let timer;
34705
34791
  try {
34706
34792
  const reasoning = await Promise.race([
34707
34793
  this.loadSdk().then(async (sdk) => {
34708
- const modelRuntime = await sdk.ModelRuntime.create();
34794
+ const modelRuntime = sdk.ModelRegistry && sdk.AuthStorage ? sdk.ModelRegistry.create(sdk.AuthStorage.create()) : await sdk.ModelRuntime.create();
34709
34795
  return parsePiModelCatalog(await modelRuntime.getAvailable());
34710
34796
  }),
34711
34797
  new Promise((resolve4) => {
@@ -36567,7 +36653,7 @@ function createAgentDriverSdkWithRegistry(options) {
36567
36653
  const adapter = registration.createAdapter();
36568
36654
  assertAdapterCompatibility(String(registration.id), registration.capabilities, adapter);
36569
36655
  const command = capabilities2.commandOverride ? input2.command : undefined;
36570
- const result = await adapter.probe(command);
36656
+ const result = input2.includeModels === false ? await adapter.probe(command, false) : await adapter.probe(command);
36571
36657
  if (result.status === "healthy") {
36572
36658
  return {
36573
36659
  status: "healthy",
@@ -36694,7 +36780,8 @@ function getDriver(runtimeId) {
36694
36780
  return {
36695
36781
  id: id3,
36696
36782
  capabilities: capabilitiesFor(id3),
36697
- probe: () => createAgentDriverSdk2().probe({ backend: id3 })
36783
+ probe: () => createAgentDriverSdk2().probe({ backend: id3, includeModels: false }),
36784
+ discoverModels: () => createAgentDriverSdk2().probe({ backend: id3 })
36698
36785
  };
36699
36786
  }
36700
36787
  function listRuntimeIds() {
@@ -37527,6 +37614,9 @@ class WsControlChannel {
37527
37614
  }
37528
37615
  this.sendFrame(frame);
37529
37616
  }
37617
+ reportRuntimeModels(frame) {
37618
+ this.sendFrame(frame);
37619
+ }
37530
37620
  restorePendingBotAuditEvent(frame) {
37531
37621
  if (!frame.eventId || !frame.occurredAt)
37532
37622
  return;
@@ -41554,6 +41644,7 @@ class AgentRouter {
41554
41644
  pendingAgentEvents = new Map;
41555
41645
  nextWakeAdmissionOrdinal = 1;
41556
41646
  runtimes = new Map;
41647
+ modelDiscoveries = new Map;
41557
41648
  pendingResend = false;
41558
41649
  scheduleResend;
41559
41650
  log;
@@ -41585,7 +41676,7 @@ class AgentRouter {
41585
41676
  const timeZone = typeof this.opts.timeZone === "function" ? this.opts.timeZone() : this.opts.timeZone;
41586
41677
  return {
41587
41678
  runtimeReport: [...this.runtimes.values()],
41588
- capabilities: [CONTROL_HEARTBEAT_CAPABILITY],
41679
+ capabilities: [CONTROL_HEARTBEAT_CAPABILITY, ...this.opts.channel.reportRuntimeModels ? [RUNTIME_MODEL_DISCOVERY_CAPABILITY] : []],
41589
41680
  runningAgents: [...this.running],
41590
41681
  hostname: this.opts.hostname,
41591
41682
  platform: this.opts.platform,
@@ -41728,8 +41819,54 @@ class AgentRouter {
41728
41819
  });
41729
41820
  return pending;
41730
41821
  }
41822
+ discoverRuntimeModels(runtimeId) {
41823
+ const active = this.modelDiscoveries.get(runtimeId);
41824
+ if (active)
41825
+ return active;
41826
+ const pending = this.runModelDiscovery(runtimeId).finally(() => this.modelDiscoveries.delete(runtimeId));
41827
+ this.modelDiscoveries.set(runtimeId, pending);
41828
+ return pending;
41829
+ }
41830
+ async runModelDiscovery(runtimeId) {
41831
+ let deadline;
41832
+ const timeout = new Promise((resolve5) => {
41833
+ deadline = setTimeout(() => resolve5(null), 40000);
41834
+ });
41835
+ const probe = await Promise.race([
41836
+ Promise.resolve().then(() => this.opts.discoverModels?.(runtimeId) ?? getDriver(runtimeId).discoverModels()),
41837
+ timeout
41838
+ ]).finally(() => clearTimeout(deadline));
41839
+ if (probe?.status === "healthy") {
41840
+ this.runtimes.set(runtimeId, { ...this.runtimes.get(runtimeId), reasoning: probe.reasoning });
41841
+ }
41842
+ return probe;
41843
+ }
41731
41844
  async onCommand(cmd) {
41732
41845
  switch (cmd.type) {
41846
+ case "runtime:discover_models": {
41847
+ const reply = this.opts.channel.reportRuntimeModels;
41848
+ if (!reply)
41849
+ return;
41850
+ const identity = { type: "runtime_models", requestId: cmd.requestId, runtimeId: cmd.runtimeId };
41851
+ try {
41852
+ const current = this.runtimes.get(cmd.runtimeId);
41853
+ if (!current)
41854
+ throw new UnknownRuntimeError(cmd.runtimeId, [...this.runtimes.keys()]);
41855
+ const probe = await this.discoverRuntimeModels(cmd.runtimeId);
41856
+ if (!probe) {
41857
+ reply.call(this.opts.channel, { ...identity, result: { status: "error", code: "model_discovery_timeout", message: "Model discovery timed out; retry the request" } });
41858
+ return;
41859
+ }
41860
+ if (probe.status !== "healthy") {
41861
+ reply.call(this.opts.channel, { ...identity, result: { status: "error", code: probe.error.code, message: probe.error.message } });
41862
+ return;
41863
+ }
41864
+ reply.call(this.opts.channel, { ...identity, result: { status: "complete", runtimeReport: [...this.runtimes.values()] } });
41865
+ } catch {
41866
+ reply.call(this.opts.channel, { ...identity, result: { status: "error", code: "model_discovery_failed", message: "Could not discover models for this runtime" } });
41867
+ }
41868
+ return;
41869
+ }
41733
41870
  case "agent:wake":
41734
41871
  this.log.info("agent:wake received", {
41735
41872
  agentId: cmd.agentId,
package/dist/index.js CHANGED
@@ -1291,6 +1291,56 @@ function tryParseJsonRecord(line) {
1291
1291
  import { existsSync as existsSync2 } from "node:fs";
1292
1292
  import { homedir as homedir2 } from "node:os";
1293
1293
  import { join as join4 } from "node:path";
1294
+
1295
+ // agent-driver/dist/internal/modelCatalog.js
1296
+ var RUNTIME_MODEL_CATALOG_MAX = 1024;
1297
+ var RUNTIME_MODEL_ID_MAX = 100;
1298
+ function normalizeRuntimeModelId(value) {
1299
+ if (typeof value !== "string")
1300
+ return;
1301
+ const id = value.trim();
1302
+ if (!id || id.length > RUNTIME_MODEL_ID_MAX || /\s/.test(id))
1303
+ return;
1304
+ return id;
1305
+ }
1306
+ function catalogFromIds(ids) {
1307
+ const seen = new Set;
1308
+ const models = [];
1309
+ for (const rawId of ids) {
1310
+ const id = normalizeRuntimeModelId(rawId);
1311
+ if (!id || seen.has(id))
1312
+ continue;
1313
+ if (models.length >= RUNTIME_MODEL_CATALOG_MAX)
1314
+ break;
1315
+ seen.add(id);
1316
+ models.push({ id, supportedReasoningEfforts: [] });
1317
+ }
1318
+ if (models.length === 0)
1319
+ return;
1320
+ return { updateMode: "unsupported", models };
1321
+ }
1322
+ function parseOpenCodeModelCatalog(output) {
1323
+ const ids = output.split(/\r?\n/).flatMap((line) => {
1324
+ const id = normalizeRuntimeModelId(line);
1325
+ return id && /^[^/]+\/.+$/.test(id) ? [id] : [];
1326
+ });
1327
+ return catalogFromIds(ids);
1328
+ }
1329
+ function parsePiModelCatalog(values) {
1330
+ if (!Array.isArray(values))
1331
+ return;
1332
+ const ids = values.flatMap((value) => {
1333
+ if (!value || typeof value !== "object")
1334
+ return [];
1335
+ const model = value;
1336
+ const provider = normalizeRuntimeModelId(model.provider);
1337
+ const id = normalizeRuntimeModelId(model.id);
1338
+ return provider && id && !provider.includes("/") ? [`${provider}/${id}`] : [];
1339
+ });
1340
+ return catalogFromIds(ids);
1341
+ }
1342
+
1343
+ // agent-driver/dist/adapters/agy/probe.js
1294
1344
  function agySpawnSpec(command, deps = {}, platform = process.platform) {
1295
1345
  const explicit = command?.trim();
1296
1346
  if (explicit)
@@ -1300,27 +1350,39 @@ function agySpawnSpec(command, deps = {}, platform = process.platform) {
1300
1350
  const selected = resolveCommandOnPath("agy", deps) ?? (existsSync2(installed) ? installed : "agy");
1301
1351
  return resolveSpawnSpec("agy", [], selected, deps, platform);
1302
1352
  }
1303
- async function probeAgy(command) {
1304
- const spec = agySpawnSpec(command);
1305
- const version = probeCommandVersion(spec.command);
1306
- if (!version.ok)
1307
- return { status: "unhealthy", lastError: version.error };
1308
- const child = spawnAgentProcess(spec.command, ["--help"], { cwd: process.cwd(), env: { ...process.env, CI: "1" }, shell: spec.shell, stdin: "ignore" });
1353
+ function parseAgyModelCatalog(output) {
1354
+ const models = [];
1355
+ const seen = new Set;
1356
+ for (const line of output.split(/\r?\n/)) {
1357
+ const match = line.match(/^(\S+)\t+(.+)$/);
1358
+ const id = normalizeRuntimeModelId(match?.[1]);
1359
+ const displayName = match?.[2]?.trim();
1360
+ if (!id || !displayName || seen.has(id))
1361
+ continue;
1362
+ if (models.length === RUNTIME_MODEL_CATALOG_MAX)
1363
+ break;
1364
+ seen.add(id);
1365
+ models.push({ id, displayName: displayName.slice(0, 256), supportedReasoningEfforts: [] });
1366
+ }
1367
+ return models.length ? { updateMode: "unsupported", models } : undefined;
1368
+ }
1369
+ async function readAgyCommand(spec, args, includeStderr) {
1370
+ const child = spawnAgentProcess(spec.command, args, { cwd: process.cwd(), env: { ...process.env, CI: "1", AGY_CLI_DISABLE_AUTO_UPDATE: "true" }, shell: spec.shell, stdin: "ignore" });
1309
1371
  try {
1310
- const help = await new Promise((resolve, reject) => {
1372
+ return await new Promise((resolve, reject) => {
1311
1373
  let output = "";
1312
- const timer = setTimeout(() => reject(new Error("timeout")), 3000);
1374
+ const timer = setTimeout(() => reject(new Error("timeout")), includeStderr ? 5000 : 30000);
1313
1375
  const fail = () => {
1314
1376
  clearTimeout(timer);
1315
- reject(new Error("help failed"));
1377
+ reject(new Error("command failed"));
1316
1378
  };
1317
1379
  const collect = (chunk) => {
1318
1380
  output += chunk.toString();
1319
- if (Buffer.byteLength(output) > 64 * 1024)
1381
+ if (Buffer.byteLength(output) > (includeStderr ? 64 * 1024 : 1024 * 1024))
1320
1382
  fail();
1321
1383
  };
1322
1384
  child.stdout?.on("data", collect);
1323
- child.stderr?.on("data", collect);
1385
+ child.stderr?.on("data", includeStderr ? collect : () => {});
1324
1386
  child.on("error", fail);
1325
1387
  child.on("close", (code) => {
1326
1388
  clearTimeout(timer);
@@ -1330,14 +1392,34 @@ async function probeAgy(command) {
1330
1392
  fail();
1331
1393
  });
1332
1394
  });
1333
- return ["--input-format", "--output-format", "stream-json", "--conversation"].every((flag) => help.includes(flag)) ? { status: "healthy", version: version.version } : { status: "unhealthy", version: version.version, lastError: "agy_stream_incompatible" };
1334
- } catch {
1335
- return { status: "unhealthy", version: version.version, lastError: "agy_stream_probe_failed" };
1336
1395
  } finally {
1337
1396
  if (child.pid)
1338
1397
  await killProcessTree(child.pid, { graceMs: 100 });
1339
1398
  }
1340
1399
  }
1400
+ async function probeAgy(command, includeModels = false) {
1401
+ const spec = agySpawnSpec(command);
1402
+ const version = probeCommandVersion(spec.command);
1403
+ if (!version.ok)
1404
+ return { status: "unhealthy", lastError: version.error };
1405
+ let help;
1406
+ try {
1407
+ help = await readAgyCommand(spec, ["--help"], true);
1408
+ } catch {
1409
+ return { status: "unhealthy", version: version.version, lastError: "agy_stream_probe_failed" };
1410
+ }
1411
+ if (!["--input-format", "--output-format", "stream-json", "--conversation"].every((flag) => help.includes(flag))) {
1412
+ return { status: "unhealthy", version: version.version, lastError: "agy_stream_incompatible" };
1413
+ }
1414
+ if (!includeModels || !/\bmodels\b/.test(help))
1415
+ return { status: "healthy", version: version.version };
1416
+ try {
1417
+ const reasoning = parseAgyModelCatalog(await readAgyCommand(spec, ["models"], false));
1418
+ return reasoning ? { status: "healthy", version: version.version, reasoning } : { status: "unhealthy", version: version.version, lastError: "agy_model_catalog_invalid" };
1419
+ } catch {
1420
+ return { status: "unhealthy", version: version.version, lastError: "agy_model_probe_failed" };
1421
+ }
1422
+ }
1341
1423
 
1342
1424
  // agent-driver/dist/internal/token-usage.js
1343
1425
  function validIdentityPart(value) {
@@ -1431,8 +1513,8 @@ class AgyDriver {
1431
1513
  constructor(launchSpec) {
1432
1514
  this.launchSpec = launchSpec;
1433
1515
  }
1434
- probe(command) {
1435
- return probeAgy(command);
1516
+ probe(command, includeModels = true) {
1517
+ return probeAgy(command, includeModels);
1436
1518
  }
1437
1519
  async openLane(ctx, options) {
1438
1520
  const spec = agySpawnSpec(resolveLaunchFieldsOrDefault(ctx.config.runtimeConfig).command);
@@ -1766,54 +1848,6 @@ async function queryNativeRows(path4, cursor, loadSqlite = async () => {
1766
1848
  }
1767
1849
  }
1768
1850
 
1769
- // agent-driver/dist/internal/modelCatalog.js
1770
- var RUNTIME_MODEL_CATALOG_MAX = 1024;
1771
- var RUNTIME_MODEL_ID_MAX = 100;
1772
- function normalizeRuntimeModelId(value) {
1773
- if (typeof value !== "string")
1774
- return;
1775
- const id = value.trim();
1776
- if (!id || id.length > RUNTIME_MODEL_ID_MAX || /\s/.test(id))
1777
- return;
1778
- return id;
1779
- }
1780
- function catalogFromIds(ids) {
1781
- const seen = new Set;
1782
- const models = [];
1783
- for (const rawId of ids) {
1784
- const id = normalizeRuntimeModelId(rawId);
1785
- if (!id || seen.has(id))
1786
- continue;
1787
- if (models.length >= RUNTIME_MODEL_CATALOG_MAX)
1788
- break;
1789
- seen.add(id);
1790
- models.push({ id, supportedReasoningEfforts: [] });
1791
- }
1792
- if (models.length === 0)
1793
- return;
1794
- return { updateMode: "unsupported", models };
1795
- }
1796
- function parseOpenCodeModelCatalog(output) {
1797
- const ids = output.split(/\r?\n/).flatMap((line) => {
1798
- const id = normalizeRuntimeModelId(line);
1799
- return id && /^[^/]+\/.+$/.test(id) ? [id] : [];
1800
- });
1801
- return catalogFromIds(ids);
1802
- }
1803
- function parsePiModelCatalog(values) {
1804
- if (!Array.isArray(values))
1805
- return;
1806
- const ids = values.flatMap((value) => {
1807
- if (!value || typeof value !== "object")
1808
- return [];
1809
- const model = value;
1810
- const provider = normalizeRuntimeModelId(model.provider);
1811
- const id = normalizeRuntimeModelId(model.id);
1812
- return provider && id && !provider.includes("/") ? [`${provider}/${id}`] : [];
1813
- });
1814
- return catalogFromIds(ids);
1815
- }
1816
-
1817
1851
  // agent-driver/dist/adapters/antigravity/catalog.js
1818
1852
  function choices(value) {
1819
1853
  if (!Array.isArray(value))
@@ -2632,23 +2666,25 @@ function antigravitySpawnSpec(command, platform = process.platform) {
2632
2666
  }
2633
2667
  async function probeAntigravity(command, options = {}) {
2634
2668
  const spec = antigravitySpawnSpec(command);
2669
+ const includeModels = options.includeModels !== false;
2635
2670
  const identity = createHash3("sha256").update(JSON.stringify([spec.command, process.env.GEMINI_HOME ?? ""])).digest("hex").slice(0, 16);
2636
- const directory = options.cacheDirectory ?? join6(homedir5(), ".cache", "alook", "antigravity-probe", identity);
2671
+ const directory = options.cacheDirectory ?? (includeModels ? join6(homedir5(), ".cache", "alook", "antigravity-probe", identity) : homedir5());
2637
2672
  const cacheFile = join6(directory, "session");
2638
2673
  let cachedSessionId;
2639
- try {
2640
- mkdirSync2(directory, { recursive: true, mode: 448 });
2674
+ if (includeModels)
2641
2675
  try {
2642
- const value = readFileSync(cacheFile, "utf8");
2643
- if (/^[A-Za-z0-9_-]{1,100}$/.test(value))
2644
- cachedSessionId = value;
2645
- } catch (error) {
2646
- if (error.code !== "ENOENT")
2647
- throw error;
2676
+ mkdirSync2(directory, { recursive: true, mode: 448 });
2677
+ try {
2678
+ const value = readFileSync(cacheFile, "utf8");
2679
+ if (/^[A-Za-z0-9_-]{1,100}$/.test(value))
2680
+ cachedSessionId = value;
2681
+ } catch (error) {
2682
+ if (error.code !== "ENOENT")
2683
+ throw error;
2684
+ }
2685
+ } catch {
2686
+ return { status: "unhealthy", lastError: "antigravity_acp_probe_storage_failed" };
2648
2687
  }
2649
- } catch {
2650
- return { status: "unhealthy", lastError: "antigravity_acp_probe_storage_failed" };
2651
- }
2652
2688
  let proc;
2653
2689
  try {
2654
2690
  proc = (options.spawn ?? spawnAgentProcess)(spec.command, spec.args, {
@@ -2773,6 +2809,10 @@ async function probeAntigravity(command, options = {}) {
2773
2809
  return fail("antigravity_acp_incompatible");
2774
2810
  const reportedVersion = asRecord(result.agentInfo)?.version;
2775
2811
  version = typeof reportedVersion === "string" ? reportedVersion : undefined;
2812
+ if (!includeModels) {
2813
+ finish({ status: "healthy", ...version ? { version } : {} });
2814
+ continue;
2815
+ }
2776
2816
  requestSession(cachedSessionId);
2777
2817
  }
2778
2818
  });
@@ -2794,8 +2834,8 @@ class AntigravityDriver {
2794
2834
  wakeStart: "immediate",
2795
2835
  terminalOwnership: "transport_request"
2796
2836
  };
2797
- probe(command) {
2798
- return probeAntigravity(command);
2837
+ probe(command, includeModels = true) {
2838
+ return includeModels ? probeAntigravity(command) : probeAntigravity(command, { includeModels: false });
2799
2839
  }
2800
2840
  async openLane(ctx, options) {
2801
2841
  return new AntigravityAcpLane(this, ctx, { onRawStdoutLine: options?.onRawStdoutLine });
@@ -3521,13 +3561,13 @@ class ClaudeDriver {
3521
3561
  this.eventNormalizer.beginTurn();
3522
3562
  return receipt;
3523
3563
  }
3524
- probe(command) {
3564
+ probe(command, includeModels = true) {
3525
3565
  const explicit = command?.trim();
3526
3566
  const base = explicit ? (() => {
3527
3567
  const result = probeCommandVersion(explicit);
3528
3568
  return result.ok ? { status: "healthy", version: result.version } : { status: "unhealthy", lastError: result.error };
3529
3569
  })() : probeClaude();
3530
- return base.status === "healthy" ? { ...base, reasoning: CLAUDE_MODEL_CATALOG } : base;
3570
+ return base.status === "healthy" && includeModels ? { ...base, reasoning: CLAUDE_MODEL_CATALOG } : base;
3531
3571
  }
3532
3572
  async openLane(ctx, options) {
3533
3573
  return createProcessLane(this, ctx, { onRawStdoutLine: options?.onRawStdoutLine });
@@ -4322,10 +4362,12 @@ class CodexDriver {
4322
4362
  get codexHome() {
4323
4363
  return this.codexHomeRoot;
4324
4364
  }
4325
- async probe(command) {
4365
+ async probe(command, includeModels = true) {
4326
4366
  const result = await probeCliRuntime("codex", {}, command);
4327
4367
  if (result.status !== "healthy")
4328
4368
  return result;
4369
+ if (!includeModels)
4370
+ return result;
4329
4371
  return {
4330
4372
  ...result,
4331
4373
  reasoning: await this.probeReasoningCatalog(command)
@@ -5690,10 +5732,12 @@ class CursorDriver {
5690
5732
  constructor(catalogProbe = probeCursorAcpCatalog) {
5691
5733
  this.catalogProbe = catalogProbe;
5692
5734
  }
5693
- async probe(command) {
5735
+ async probe(command, includeModels = true) {
5694
5736
  const result = probeCliRuntime("cursor-agent", {}, command);
5695
5737
  if (result.status !== "healthy")
5696
5738
  return result;
5739
+ if (!includeModels)
5740
+ return result;
5697
5741
  let reasoning;
5698
5742
  try {
5699
5743
  reasoning = await this.catalogProbe(command);
@@ -5894,6 +5938,8 @@ async function probeGrokAcpCatalog(command, options = {}) {
5894
5938
  }
5895
5939
  return finish({ status: "unhealthy", lastError: "grok_acp_cached_auth_unsupported" });
5896
5940
  }
5941
+ if (options.includeModels === false)
5942
+ return finish({ status: "compatible" });
5897
5943
  catalog = catalogFromInitialize(result) ?? catalog;
5898
5944
  expectedId = 2;
5899
5945
  write("authenticate", { methodId: AUTH_METHOD_ID4 }, expectedId);
@@ -6903,13 +6949,13 @@ class GrokDriver {
6903
6949
  this.catalogProbe = catalogProbe;
6904
6950
  this.spawnProcess = spawnProcess;
6905
6951
  }
6906
- async probe(command) {
6952
+ async probe(command, includeModels = true) {
6907
6953
  const result = probeCliRuntime("grok", {}, command);
6908
6954
  if (result.status !== "healthy")
6909
6955
  return result;
6910
6956
  let acpProbe;
6911
6957
  try {
6912
- acpProbe = await this.catalogProbe(command);
6958
+ acpProbe = includeModels ? await this.catalogProbe(command) : await this.catalogProbe(command, { includeModels: false });
6913
6959
  } catch {
6914
6960
  acpProbe = { status: "unhealthy", lastError: "grok_acp_probe_failed" };
6915
6961
  }
@@ -8707,7 +8753,7 @@ class OpenCodeDriver {
8707
8753
  throw new Error("Installed OpenCode CLI could not report its version");
8708
8754
  return discoverOpenCodeRecentContext(request, { compatibility: resolveOpenCodeCompatibility(result.version) });
8709
8755
  }
8710
- probe(command) {
8756
+ probe(command, includeModels = true) {
8711
8757
  const result = this.versionProbe("opencode", {}, command);
8712
8758
  if (result.status !== "healthy")
8713
8759
  return result;
@@ -8717,6 +8763,8 @@ class OpenCodeDriver {
8717
8763
  } catch {
8718
8764
  return { ...result, status: "unhealthy", lastError: "unsupported_opencode_cli_version" };
8719
8765
  }
8766
+ if (!includeModels)
8767
+ return result;
8720
8768
  const spec = resolveSpawnSpec("opencode", [...compatibility.modelArgs], command);
8721
8769
  const output = this.outputProbe(spec.command, spec.args);
8722
8770
  return {
@@ -9197,16 +9245,18 @@ class PiDriver {
9197
9245
  this.loadSdk = loadSdk;
9198
9246
  this.readVersion = readVersion;
9199
9247
  }
9200
- async probe() {
9248
+ async probe(_command, includeModels = true) {
9201
9249
  const version = this.readVersion();
9202
9250
  if (!version) {
9203
9251
  return { status: "unhealthy", lastError: "sdk_not_installed" };
9204
9252
  }
9253
+ if (!includeModels)
9254
+ return { status: "healthy", version };
9205
9255
  let timer;
9206
9256
  try {
9207
9257
  const reasoning = await Promise.race([
9208
9258
  this.loadSdk().then(async (sdk) => {
9209
- const modelRuntime = await sdk.ModelRuntime.create();
9259
+ const modelRuntime = sdk.ModelRegistry && sdk.AuthStorage ? sdk.ModelRegistry.create(sdk.AuthStorage.create()) : await sdk.ModelRuntime.create();
9210
9260
  return parsePiModelCatalog(await modelRuntime.getAvailable());
9211
9261
  }),
9212
9262
  new Promise((resolve4) => {
@@ -11068,7 +11118,7 @@ function createAgentDriverSdkWithRegistry(options) {
11068
11118
  const adapter = registration.createAdapter();
11069
11119
  assertAdapterCompatibility(String(registration.id), registration.capabilities, adapter);
11070
11120
  const command = capabilities2.commandOverride ? input.command : undefined;
11071
- const result = await adapter.probe(command);
11121
+ const result = input.includeModels === false ? await adapter.probe(command, false) : await adapter.probe(command);
11072
11122
  if (result.status === "healthy") {
11073
11123
  return {
11074
11124
  status: "healthy",
@@ -11195,7 +11245,8 @@ function getDriver(runtimeId) {
11195
11245
  return {
11196
11246
  id,
11197
11247
  capabilities: capabilitiesFor(id),
11198
- probe: () => createAgentDriverSdk2().probe({ backend: id })
11248
+ probe: () => createAgentDriverSdk2().probe({ backend: id, includeModels: false }),
11249
+ discoverModels: () => createAgentDriverSdk2().probe({ backend: id })
11199
11250
  };
11200
11251
  }
11201
11252
  function listRuntimeIds() {
@@ -35464,6 +35515,21 @@ var BillingPortalRequestSchema = exports_external.strictObject({
35464
35515
  var BillingRedirectResponseSchema = exports_external.object({
35465
35516
  url: exports_external.string().url()
35466
35517
  });
35518
+ // ../shared/src/runtime-models-contract.ts
35519
+ var RUNTIME_MODEL_DISCOVERY_CAPABILITY = "runtime-model-discovery-v1";
35520
+ var RuntimeModelDiscoveryRequestSchema = exports_external.strictObject({
35521
+ requestId: exports_external.string().min(1).max(128),
35522
+ runtimeId: exports_external.string().min(1).max(64)
35523
+ });
35524
+ var RuntimeModelDiscoveryCommandSchema = RuntimeModelDiscoveryRequestSchema.extend({
35525
+ type: exports_external.literal("runtime:discover_models")
35526
+ });
35527
+ var RuntimeModelDiscoveryErrorSchema = exports_external.strictObject({
35528
+ status: exports_external.literal("error"),
35529
+ code: exports_external.string().min(1).max(64),
35530
+ message: exports_external.string().min(1).max(256)
35531
+ });
35532
+
35467
35533
  // ../shared/src/utils/slug.ts
35468
35534
  init_nanoid();
35469
35535
  var slugId = customAlphabet("0123456789abcdefghijklmnopqrstuvwxyz");
@@ -35570,6 +35636,7 @@ function parseSeq(s) {
35570
35636
  return n;
35571
35637
  }
35572
35638
  var HostCommandSchema = exports_external.discriminatedUnion("type", [
35639
+ RuntimeModelDiscoveryCommandSchema,
35573
35640
  exports_external.strictObject({
35574
35641
  type: exports_external.literal("machine:heartbeat"),
35575
35642
  nonce: exports_external.string().min(1).max(128)
@@ -36233,6 +36300,17 @@ var CommunityMachineRuntimeListSchema = exports_external.array(CommunityMachineR
36233
36300
  }
36234
36301
  return out;
36235
36302
  });
36303
+ var RuntimeModelDiscoveryResultSchema = exports_external.discriminatedUnion("status", [
36304
+ exports_external.strictObject({ status: exports_external.literal("complete"), catalog: RuntimeReasoningCatalogSchema.nullable() }),
36305
+ RuntimeModelDiscoveryErrorSchema
36306
+ ]);
36307
+ var HostRuntimeModelsFrameSchema = RuntimeModelDiscoveryRequestSchema.extend({
36308
+ type: exports_external.literal("runtime_models"),
36309
+ result: exports_external.discriminatedUnion("status", [
36310
+ exports_external.strictObject({ status: exports_external.literal("complete"), runtimeReport: CommunityMachineRuntimeListSchema }),
36311
+ RuntimeModelDiscoveryErrorSchema
36312
+ ])
36313
+ });
36236
36314
  var CommunityRunningAgentListSchema = exports_external.array(exports_external.string()).transform((list) => {
36237
36315
  const seen = new Set;
36238
36316
  const out = [];
@@ -37582,6 +37660,13 @@ var communityBotAuditEventSchema = exports_external.strictObject({
37582
37660
  launchId: nullableString.optional(),
37583
37661
  createdAt: string4
37584
37662
  }).refine((event) => Object.prototype.hasOwnProperty.call(event, "payload"));
37663
+ var communityRuntimeModelsSchema = exports_external.strictObject({
37664
+ type: exports_external.literal("community:runtime.models"),
37665
+ machineId: exports_external.string().min(1),
37666
+ requestId: exports_external.string().min(1).max(128),
37667
+ runtimeId: exports_external.string().min(1).max(64),
37668
+ result: RuntimeModelDiscoveryResultSchema
37669
+ });
37585
37670
  var commonCommunityEventSchemas = [
37586
37671
  communityMessageUpdatedSchema,
37587
37672
  communityMessageEditedSchema,
@@ -37620,6 +37705,7 @@ var commonCommunityEventSchemas = [
37620
37705
  communityMachineCreatedSchema,
37621
37706
  communityMachineStatusSchema,
37622
37707
  communityMachineUpdatedSchema,
37708
+ communityRuntimeModelsSchema,
37623
37709
  communityMachineRemovedSchema,
37624
37710
  communityBotAuditEventSchema
37625
37711
  ];
@@ -37690,6 +37776,7 @@ var WS_EVENTS = {
37690
37776
  MACHINE_CREATED: "community:machine.created",
37691
37777
  MACHINE_STATUS: "community:machine.status",
37692
37778
  MACHINE_UPDATED: "community:machine.updated",
37779
+ RUNTIME_MODELS: "community:runtime.models",
37693
37780
  MACHINE_REMOVED: "community:machine.removed",
37694
37781
  BOT_AUDIT_EVENT: "community:bot.audit_event"
37695
37782
  };
@@ -40325,6 +40412,7 @@ class AgentRouter {
40325
40412
  pendingAgentEvents = new Map;
40326
40413
  nextWakeAdmissionOrdinal = 1;
40327
40414
  runtimes = new Map;
40415
+ modelDiscoveries = new Map;
40328
40416
  pendingResend = false;
40329
40417
  scheduleResend;
40330
40418
  log;
@@ -40356,7 +40444,7 @@ class AgentRouter {
40356
40444
  const timeZone = typeof this.opts.timeZone === "function" ? this.opts.timeZone() : this.opts.timeZone;
40357
40445
  return {
40358
40446
  runtimeReport: [...this.runtimes.values()],
40359
- capabilities: [CONTROL_HEARTBEAT_CAPABILITY],
40447
+ capabilities: [CONTROL_HEARTBEAT_CAPABILITY, ...this.opts.channel.reportRuntimeModels ? [RUNTIME_MODEL_DISCOVERY_CAPABILITY] : []],
40360
40448
  runningAgents: [...this.running],
40361
40449
  hostname: this.opts.hostname,
40362
40450
  platform: this.opts.platform,
@@ -40499,8 +40587,54 @@ class AgentRouter {
40499
40587
  });
40500
40588
  return pending;
40501
40589
  }
40590
+ discoverRuntimeModels(runtimeId) {
40591
+ const active = this.modelDiscoveries.get(runtimeId);
40592
+ if (active)
40593
+ return active;
40594
+ const pending = this.runModelDiscovery(runtimeId).finally(() => this.modelDiscoveries.delete(runtimeId));
40595
+ this.modelDiscoveries.set(runtimeId, pending);
40596
+ return pending;
40597
+ }
40598
+ async runModelDiscovery(runtimeId) {
40599
+ let deadline;
40600
+ const timeout = new Promise((resolve4) => {
40601
+ deadline = setTimeout(() => resolve4(null), 40000);
40602
+ });
40603
+ const probe = await Promise.race([
40604
+ Promise.resolve().then(() => this.opts.discoverModels?.(runtimeId) ?? getDriver(runtimeId).discoverModels()),
40605
+ timeout
40606
+ ]).finally(() => clearTimeout(deadline));
40607
+ if (probe?.status === "healthy") {
40608
+ this.runtimes.set(runtimeId, { ...this.runtimes.get(runtimeId), reasoning: probe.reasoning });
40609
+ }
40610
+ return probe;
40611
+ }
40502
40612
  async onCommand(cmd) {
40503
40613
  switch (cmd.type) {
40614
+ case "runtime:discover_models": {
40615
+ const reply = this.opts.channel.reportRuntimeModels;
40616
+ if (!reply)
40617
+ return;
40618
+ const identity = { type: "runtime_models", requestId: cmd.requestId, runtimeId: cmd.runtimeId };
40619
+ try {
40620
+ const current = this.runtimes.get(cmd.runtimeId);
40621
+ if (!current)
40622
+ throw new UnknownRuntimeError(cmd.runtimeId, [...this.runtimes.keys()]);
40623
+ const probe = await this.discoverRuntimeModels(cmd.runtimeId);
40624
+ if (!probe) {
40625
+ reply.call(this.opts.channel, { ...identity, result: { status: "error", code: "model_discovery_timeout", message: "Model discovery timed out; retry the request" } });
40626
+ return;
40627
+ }
40628
+ if (probe.status !== "healthy") {
40629
+ reply.call(this.opts.channel, { ...identity, result: { status: "error", code: probe.error.code, message: probe.error.message } });
40630
+ return;
40631
+ }
40632
+ reply.call(this.opts.channel, { ...identity, result: { status: "complete", runtimeReport: [...this.runtimes.values()] } });
40633
+ } catch {
40634
+ reply.call(this.opts.channel, { ...identity, result: { status: "error", code: "model_discovery_failed", message: "Could not discover models for this runtime" } });
40635
+ }
40636
+ return;
40637
+ }
40504
40638
  case "agent:wake":
40505
40639
  this.log.info("agent:wake received", {
40506
40640
  agentId: cmd.agentId,
@@ -41863,6 +41997,9 @@ class WsControlChannel {
41863
41997
  }
41864
41998
  this.sendFrame(frame);
41865
41999
  }
42000
+ reportRuntimeModels(frame) {
42001
+ this.sendFrame(frame);
42002
+ }
41866
42003
  restorePendingBotAuditEvent(frame) {
41867
42004
  if (!frame.eventId || !frame.occurredAt)
41868
42005
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alook/daemon",
3
- "version": "0.1.52",
3
+ "version": "0.1.53",
4
4
  "description": "Alook agent daemon — host-side runtime backend, process manager, credential proxy, and control plane.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/alookai/alook#readme",