@poe-platform/safe-bash 0.1.791 → 0.1.793

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.
@@ -4,7 +4,7 @@ import {
4
4
 
5
5
  // packages/safe-bash/src/commands/llm/index.ts
6
6
  init_platform();
7
- import { createElevenLabsProvider, createLlmCommand, createLlmCommands, createLlmConfiguration, createLlmService, createLlmTemplateStore, createOpenAiProvider, evaluateLlmTemplate, findExtractedRange, getLlmModelAliases, llmCommands, llmTemplateUsesInput, parseLlmSchemaDsl, resolveLlmSchemaInput, templateYaml, validateLlmTemplateParameters, validateModelOptions } from "../../safe-bash-command-llm/index.js";
7
+ import { createElevenLabsProvider, createLlmCommand, createLlmCommands, createLlmConfiguration, createLlmService, createLlmTemplateStore, createOpenAiProvider, evaluateLlmTemplate, findExtractedRange, getLlmModelAliases, llmCommands, llmTemplateUsesInput, parseLlmSchemaDsl, resolveLlmSchemaInput, selectLlmModelByQuery, templateYaml, validateLlmTemplateParameters, validateModelOptions } from "../../safe-bash-command-llm/index.js";
8
8
 
9
9
  export {
10
10
  createElevenLabsProvider,
@@ -21,6 +21,7 @@ export {
21
21
  llmTemplateUsesInput,
22
22
  parseLlmSchemaDsl,
23
23
  resolveLlmSchemaInput,
24
+ selectLlmModelByQuery,
24
25
  templateYaml,
25
26
  validateLlmTemplateParameters,
26
27
  validateModelOptions
@@ -13614,7 +13614,7 @@ async function umaskBuiltin(context, state) {
13614
13614
 
13615
13615
  // packages/safe-bash/src/shell/runtime.ts
13616
13616
  import { abortManagedController as abortManagedController2, addAbortSignalWaiter as addAbortSignalWaiter2, combineManagedSignals as combineManagedSignals2, createManagedControlController as createManagedControlController2, getRuntimeBackingFileSystem as getRuntimeBackingFileSystem2, interruptible as interruptible2, isSyncResolved as isSyncResolved5, registerRuntimeBackingFileSystem, removeAbortSignalWaiter as removeAbortSignalWaiter2, toNativeAbortSignal } from "../../safe-bash-contracts/runtime-control.js";
13617
- var sharedCaptureDecoder = new TextDecoder();
13617
+ var sharedCaptureDecoder = new TextDecoder("utf-8", { ignoreBOM: true });
13618
13618
  var cachedCaptureAsciiBytes = new Uint8Array(4096);
13619
13619
  var cachedCaptureAsciiLen = 0;
13620
13620
  var cachedCaptureAsciiStr = "";
@@ -22613,14 +22613,14 @@ var Runtime = class _Runtime {
22613
22613
  posMut = m ? { varName: m[1], op: m[2], posIdx: Number(m[3] ?? m[4]) - 1 } : null;
22614
22614
  expr._cachedPosMut = posMut;
22615
22615
  }
22616
- if (posMut !== null && posMut.varName !== "OPTIND" && posMut.varName !== "PIPESTATUS" && !store?.get(posMut.varName)) {
22616
+ if (!hasActiveVariableAttributes(rawState) && posMut !== null && posMut.varName !== "OPTIND" && posMut.varName !== "PIPESTATUS" && !store?.get(posMut.varName)) {
22617
22617
  const posVal = (this._fastSubPositional ?? rawState.positional)[posMut.posIdx];
22618
- if (posVal !== void 0 && posVal.length > 0 && posVal.length <= 12) {
22618
+ if (posVal !== void 0 && /^-?(?:0|[1-9][0-9]{0,12})$/.test(posVal)) {
22619
22619
  const rhsNum = Number(posVal);
22620
22620
  if (Number.isSafeInteger(rhsNum)) {
22621
22621
  const curVal = this._syncArithRawWriteOnly && this._syncArithTouched?.has(posMut.varName) ? rawState.variables[posMut.varName] ?? "0" : monitor.values.get(posMut.varName, rawState.variables[posMut.varName] ?? "0") ?? rawState.variables[posMut.varName] ?? "0";
22622
22622
  const curNum = curVal === "" ? 0 : Number(curVal);
22623
- if (typeof curVal === "string" && Number.isSafeInteger(curNum)) {
22623
+ if (typeof curVal === "string" && (curVal === "" || /^-?(?:0|[1-9][0-9]{0,12})$/.test(curVal)) && Number.isSafeInteger(curNum)) {
22624
22624
  const nextNum = posMut.op === "=" ? rhsNum : posMut.op === "+=" ? curNum + rhsNum : curNum - rhsNum;
22625
22625
  if (Number.isSafeInteger(nextNum)) {
22626
22626
  this.budget.parsing.admit(4);
@@ -10,16 +10,16 @@ function duration(arguments_) {
10
10
  const base = 1000000000n;
11
11
  const maximum = BigInt(Number.MAX_SAFE_INTEGER);
12
12
  const columns = /* @__PURE__ */ new Map();
13
- for (const rawValue of arguments_) {
14
- const value = /^[ \t\n\r\v\f]*-0[smhd]?$/.test(rawValue) ? rawValue.replace("-", "+") : rawValue;
15
- const match = /^[ \t\n\r\v\f]*\+?((?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?|0[xX](?:[\da-fA-F]+(?:\.[\da-fA-F]*)?|\.[\da-fA-F]+)(?:[pP][+-]?\d+)?)([smhd]?)$/.exec(value);
13
+ for (const value of arguments_) {
14
+ const match = /^[ \t\n\r\v\f]*([+-]?)((?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?|0[xX](?:[\da-fA-F]+(?:\.[\da-fA-F]*)?|\.[\da-fA-F]+)(?:[pP][+-]?\d+)?)([smhd]?)$/.exec(value);
16
15
  if (!match) throw new CommandFailure(`invalid time interval: ${value}`);
17
- const hexadecimal = /^0[xX]([\da-fA-F]*)(?:\.([\da-fA-F]*))?(?:[pP]([+-]?\d+))?$/.exec(match[1]);
16
+ const hexadecimal = /^0[xX]([\da-fA-F]*)(?:\.([\da-fA-F]*))?(?:[pP]([+-]?\d+))?$/.exec(match[2]);
18
17
  let digits, scale;
19
18
  if (hexadecimal) {
20
19
  const fraction = hexadecimal[2] ?? "";
21
20
  let coefficient2 = BigInt(`0x${hexadecimal[1]}${fraction}`);
22
21
  if (!coefficient2) continue;
22
+ if (match[1] === "-") throw new CommandFailure(`invalid time interval: ${value}`);
23
23
  const exponent = BigInt(hexadecimal[3] ?? "0") - 4n * BigInt(fraction.length);
24
24
  const bits = BigInt(coefficient2.toString(2).length);
25
25
  if (bits + exponent > 44n) throw new CommandFailure("time interval exceeds supported finite range");
@@ -33,13 +33,14 @@ function duration(arguments_) {
33
33
  }
34
34
  digits = coefficient2.toString();
35
35
  } else {
36
- const parts = /^(\d*)(?:\.(\d*))?(?:[eE]([+-]?\d+))?$/.exec(match[1]);
36
+ const parts = /^(\d*)(?:\.(\d*))?(?:[eE]([+-]?\d+))?$/.exec(match[2]);
37
37
  const fraction = parts[2] ?? "";
38
38
  digits = `${parts[1]}${fraction}`.replace(/^0+/, "");
39
39
  scale = BigInt(parts[3] ?? "0") - BigInt(fraction.length) + 3n;
40
40
  }
41
41
  if (!digits) continue;
42
- const multiplier = match[2] === "d" ? 86400n : match[2] === "h" ? 3600n : match[2] === "m" ? 60n : 1n;
42
+ if (match[1] === "-") throw new CommandFailure(`invalid time interval: ${value}`);
43
+ const multiplier = match[3] === "d" ? 86400n : match[3] === "h" ? 3600n : match[3] === "m" ? 60n : 1n;
43
44
  const coefficient = (BigInt(digits) * multiplier).toString();
44
45
  if (BigInt(coefficient.length) + scale > 16n) throw new CommandFailure("time interval exceeds supported finite range");
45
46
  const shift = (scale % 9n + 9n) % 9n;
@@ -13,7 +13,7 @@ import {
13
13
  // packages/safe-bash-command-llm/src/command.ts
14
14
  init_buffer();
15
15
  import { createOutputOperation, getCommandArguments, FsError as FsError7 } from "../../safe-bash-contracts/index.js";
16
- import { inheritYieldCheckpoint, yieldTurn as yieldTurn2 } from "../../safe-bash-contracts/yield.js";
16
+ import { inheritYieldCheckpoint, yieldTurn as yieldTurn3 } from "../../safe-bash-contracts/yield.js";
17
17
  import { writeDiagnostic } from "../../safe-bash-contracts/escaping.js";
18
18
  import { pathOf as pathOf4 } from "../../safe-bash-contracts/path.js";
19
19
 
@@ -1172,6 +1172,34 @@ async function listOptions(configuration, output, diagnostic) {
1172
1172
 
1173
1173
  // packages/safe-bash-command-llm/src/models-list.ts
1174
1174
  init_buffer();
1175
+
1176
+ // packages/safe-bash-command-llm/src/model-selection.ts
1177
+ init_buffer();
1178
+ import { yieldTurn as yieldTurn2 } from "../../safe-bash-contracts/yield.js";
1179
+ function getLlmModelAliases({ provider, model }, configured) {
1180
+ const aliases = new Set(model.aliases);
1181
+ for (const [alias, target] of Object.entries(configured)) {
1182
+ if (target === model.id || target === `${provider.name}/${model.id}` || model.aliases?.includes(target)) aliases.add(alias);
1183
+ }
1184
+ return [...aliases];
1185
+ }
1186
+ async function selectLlmModelByQuery(models, queries, configuredAliases = {}, signal) {
1187
+ if (!queries.length) throw new TypeError("Model selection requires a query");
1188
+ let selected;
1189
+ const normalized = queries.map((query) => query.toLowerCase());
1190
+ for (let index = 0; index < models.length; index++) {
1191
+ signal?.throwIfAborted();
1192
+ if (signal && index && index % 256 === 0) await yieldTurn2(signal);
1193
+ const entry = models[index];
1194
+ const terms = [`${entry.provider.name}: ${entry.model.id}`, ...getLlmModelAliases(entry, configuredAliases)].map((value) => value.toLowerCase());
1195
+ if (normalized.every((query) => terms.some((term) => term.includes(query))) && (!selected || [...entry.model.id].length < [...selected.model.id].length)) selected = entry;
1196
+ }
1197
+ signal?.throwIfAborted();
1198
+ if (!selected) throw new Error(`No model found matching queries ${queries.join(", ")}`);
1199
+ return selected;
1200
+ }
1201
+
1202
+ // packages/safe-bash-command-llm/src/models-list.ts
1175
1203
  var modelsGroupHelp = "Usage: llm models [OPTIONS] COMMAND [ARGS]...\n\n Manage available models\n\nOptions:\n -h, --help Show this message and exit.\n\nCommands:\n list* List available models\n default Show or set the default model\n options Manage default options for models\n";
1176
1204
  var LlmModelsUsageError = class extends Error {
1177
1205
  constructor(message, usage = true) {
@@ -1192,13 +1220,6 @@ function wrapDescription(description) {
1192
1220
  if (line) lines.push(line);
1193
1221
  return lines.join("\n ");
1194
1222
  }
1195
- function getLlmModelAliases({ provider, model }, configured) {
1196
- const aliases = new Set(model.aliases);
1197
- for (const [alias, target] of Object.entries(configured)) {
1198
- if (target === model.id || target === `${provider.name}/${model.id}` || model.aliases?.includes(target)) aliases.add(alias);
1199
- }
1200
- return [...aliases];
1201
- }
1202
1223
  async function listLlmModels(context, service, tokens, emit, step) {
1203
1224
  const explicit = tokens[0] === "list";
1204
1225
  const terminator = tokens.indexOf("--");
@@ -1306,7 +1327,7 @@ async function listLlmModels(context, service, tokens, emit, step) {
1306
1327
 
1307
1328
  // packages/safe-bash-command-llm/src/command.ts
1308
1329
  async function parse(length, text, step) {
1309
- const parsed = { prompt: "", params: {}, options: /* @__PURE__ */ Object.create(null), attachments: [] };
1330
+ const parsed = { prompt: "", queries: [], params: {}, options: /* @__PURE__ */ Object.create(null), attachments: [] };
1310
1331
  const operands = [];
1311
1332
  let ended = false;
1312
1333
  for (let index = 0; index < length; index++) {
@@ -1338,9 +1359,10 @@ async function parse(length, text, step) {
1338
1359
  if (++index >= length) throw new Error(`Option ${flag} requires an argument`);
1339
1360
  return text(index);
1340
1361
  };
1341
- if (!["-m", "--model", "-s", "--system", "-o", "--option", "-a", "--attachment", "--at", "--attachment-type", "-t", "--template", "--save", "-p", "--param", "--key", "--schema", "--schema-multi"].includes(flag)) throw new Error(`Unknown option: ${flag}`);
1362
+ if (!["-q", "--query", "-m", "--model", "-s", "--system", "-o", "--option", "-a", "--attachment", "--at", "--attachment-type", "-t", "--template", "--save", "-p", "--param", "--key", "--schema", "--schema-multi"].includes(flag)) throw new Error(`Unknown option: ${flag}`);
1342
1363
  const value = attached ?? take();
1343
- if (flag === "-t" || flag === "--template") parsed.template = value;
1364
+ if (flag === "-q" || flag === "--query") parsed.queries.push(value);
1365
+ else if (flag === "-t" || flag === "--template") parsed.template = value;
1344
1366
  else if (flag === "--schema") parsed.schema = value;
1345
1367
  else if (flag === "--schema-multi") parsed.schemaMulti = value;
1346
1368
  else if (flag === "--key") parsed.key = value;
@@ -1399,7 +1421,7 @@ async function execute(context, service, limits, templateLoaderOptions) {
1399
1421
  signal.throwIfAborted();
1400
1422
  if (closed) throw new Error("LLM invocation is closed");
1401
1423
  work++;
1402
- if (work % 256 === 0) await yieldTurn2(signal);
1424
+ if (work % 256 === 0) await yieldTurn3(signal);
1403
1425
  };
1404
1426
  let outputSpool;
1405
1427
  let outputBytes = 0;
@@ -1508,6 +1530,13 @@ async function execute(context, service, limits, templateLoaderOptions) {
1508
1530
  const promptOffset = argumentsValue.args[0] === "prompt" ? 1 : 0;
1509
1531
  const args = await parse(argumentsValue.args.length - promptOffset, (index) => argumentText(index + promptOffset), step);
1510
1532
  const configuration = createLlmConfiguration(context);
1533
+ if (args.model === void 0 && args.queries.length) {
1534
+ try {
1535
+ args.model = (await selectLlmModelByQuery(service.models, args.queries, await configuration.aliases(), signal)).model.id;
1536
+ } catch (error) {
1537
+ throw new Error(`Error: ${error instanceof Error ? error.message : "Model selection failed"}`);
1538
+ }
1539
+ }
1511
1540
  const templateStore = createLlmTemplateStore(context, templateLoaderOptions);
1512
1541
  const schemaInput = args.schemaMulti ?? args.schema;
1513
1542
  let schema = schemaInput ? await resolveLlmSchemaInput({ ...context, signal }, schemaInput, {
@@ -1795,6 +1824,7 @@ export {
1795
1824
  parseLlmSchemaDsl,
1796
1825
  resolveLlmSchemaInput,
1797
1826
  getLlmModelAliases,
1827
+ selectLlmModelByQuery,
1798
1828
  createLlmCommand,
1799
1829
  createLlmCommands,
1800
1830
  llmCommands
@@ -13,10 +13,11 @@ import {
13
13
  llmTemplateUsesInput,
14
14
  parseLlmSchemaDsl,
15
15
  resolveLlmSchemaInput,
16
+ selectLlmModelByQuery,
16
17
  templateYaml,
17
18
  validateLlmTemplateParameters,
18
19
  validateModelOptions
19
- } from "../../chunks/chunk-DVSLGXQU.js";
20
+ } from "../../chunks/chunk-C2NYCU7O.js";
20
21
  import "../../chunks/chunk-YG5WAHK7.js";
21
22
  export {
22
23
  createElevenLabsProvider,
@@ -33,6 +34,7 @@ export {
33
34
  llmTemplateUsesInput,
34
35
  parseLlmSchemaDsl,
35
36
  resolveLlmSchemaInput,
37
+ selectLlmModelByQuery,
36
38
  templateYaml,
37
39
  validateLlmTemplateParameters,
38
40
  validateModelOptions
@@ -4,5 +4,5 @@ export { baseAgentCommands, createBoundedRegexProvider } from "./registry-entry.
4
4
  export { agentCommands, createAgentCommands } from "./plugins/index.browser.js";
5
5
  export { EreLedger, EreProfileLimitError, EreSyntaxError, EreUnsupportedError, EreUsageUnknownError, RegexExecutionError, RegexExecutor, RegexSession, compileEre, matchEre } from "./commands/regex-execution/public.browser.js";
6
6
  export { PythonFailure, PythonPackageConflictError, createPythonCommands, createPythonExecutorPool, createPythonHostBridge, createPythonJspiAssets, createPythonJspiExecutor, createPythonJspiNativeCall, createPythonJspiStatResult, createPythonJspiTrampoline, createPythonLlmCapability, createPythonPackageCache, createPythonPackageEnvironment, createPythonPackageManifestStore, createPythonShellCapability, inspectPythonCapabilities, pythonCommands, pythonDocumentPackages, pythonHostFailureCode } from "./commands/python/index.browser.js";
7
- export { createElevenLabsProvider, createLlmCommand, createLlmCommands, createLlmConfiguration, createLlmService, createLlmTemplateStore, createOpenAiProvider, evaluateLlmTemplate, findExtractedRange, getLlmModelAliases, llmCommands, llmTemplateUsesInput, parseLlmSchemaDsl, resolveLlmSchemaInput, templateYaml, validateLlmTemplateParameters, validateModelOptions } from "./commands/llm/index.browser.js";
7
+ export { createElevenLabsProvider, createLlmCommand, createLlmCommands, createLlmConfiguration, createLlmService, createLlmTemplateStore, createOpenAiProvider, evaluateLlmTemplate, findExtractedRange, getLlmModelAliases, llmCommands, llmTemplateUsesInput, parseLlmSchemaDsl, resolveLlmSchemaInput, selectLlmModelByQuery, templateYaml, validateLlmTemplateParameters, validateModelOptions } from "./commands/llm/index.browser.js";
8
8
  import "./chunks/chunk-KV7PKOHV.js";
@@ -57,7 +57,7 @@ import {
57
57
  parseShell,
58
58
  searchCommands,
59
59
  unrtfCommands
60
- } from "./chunks/chunk-6AKPBNRF.js";
60
+ } from "./chunks/chunk-HEENNMEW.js";
61
61
  import {
62
62
  createYqCommand,
63
63
  createYqCommands,
@@ -411,10 +411,11 @@ import {
411
411
  llmTemplateUsesInput,
412
412
  parseLlmSchemaDsl,
413
413
  resolveLlmSchemaInput,
414
+ selectLlmModelByQuery,
414
415
  templateYaml,
415
416
  validateLlmTemplateParameters,
416
417
  validateModelOptions
417
- } from "./chunks/chunk-DVSLGXQU.js";
418
+ } from "./chunks/chunk-C2NYCU7O.js";
418
419
  import {
419
420
  init_platform
420
421
  } from "./chunks/chunk-YG5WAHK7.js";
@@ -1904,6 +1905,7 @@ export {
1904
1905
  restoreEnvironment,
1905
1906
  safeJsNodeCommands as safeJsCommands,
1906
1907
  searchCommands,
1908
+ selectLlmModelByQuery,
1907
1909
  selectOpBackendContext,
1908
1910
  selectOpGlobalFlags,
1909
1911
  sha512sumCommands,
@@ -4,7 +4,7 @@ import { compareSyncJqStrings, splitSyncJqExpression } from "./sync-jq-expressio
4
4
  import { wcDisplayWidth } from "../commands/wc-width.js";
5
5
  import { text as awkValueText, compare as awkCompare, inputValue as awkInputValue, numeric as awkNumeric, number as awkNumber, string as awkString } from "../commands/text-programs/awk-values.js";
6
6
  import { bytesToHex, latin1Text } from "../byte-encoding.js";
7
- const sharedCaptureDecoder = new TextDecoder();
7
+ const sharedCaptureDecoder = new TextDecoder("utf-8", { ignoreBOM: true });
8
8
  const cachedCaptureAsciiBytes = new Uint8Array(4096);
9
9
  let cachedCaptureAsciiLen = 0;
10
10
  let cachedCaptureAsciiStr = "";
@@ -10412,16 +10412,16 @@ export class Runtime {
10412
10412
  posMut = m ? { varName: m[1], op: m[2], posIdx: Number(m[3] ?? m[4]) - 1 } : null;
10413
10413
  expr._cachedPosMut = posMut;
10414
10414
  }
10415
- if (posMut !== null && posMut.varName !== "OPTIND" && posMut.varName !== "PIPESTATUS" && !store?.get(posMut.varName)) {
10415
+ if (!hasActiveVariableAttributes(rawState) && posMut !== null && posMut.varName !== "OPTIND" && posMut.varName !== "PIPESTATUS" && !store?.get(posMut.varName)) {
10416
10416
  const posVal = (this._fastSubPositional ?? rawState.positional)[posMut.posIdx];
10417
- if (posVal !== undefined && posVal.length > 0 && posVal.length <= 12) {
10417
+ if (posVal !== undefined && /^-?(?:0|[1-9][0-9]{0,12})$/.test(posVal)) {
10418
10418
  const rhsNum = Number(posVal);
10419
10419
  if (Number.isSafeInteger(rhsNum)) {
10420
10420
  const curVal = (this._syncArithRawWriteOnly && this._syncArithTouched?.has(posMut.varName))
10421
10421
  ? (rawState.variables[posMut.varName] ?? "0")
10422
10422
  : (monitor.values.get(posMut.varName, rawState.variables[posMut.varName] ?? "0") ?? rawState.variables[posMut.varName] ?? "0");
10423
10423
  const curNum = curVal === "" ? 0 : Number(curVal);
10424
- if (typeof curVal === "string" && Number.isSafeInteger(curNum)) {
10424
+ if (typeof curVal === "string" && (curVal === "" || /^-?(?:0|[1-9][0-9]{0,12})$/.test(curVal)) && Number.isSafeInteger(curNum)) {
10425
10425
  const nextNum = posMut.op === "=" ? rhsNum : posMut.op === "+=" ? curNum + rhsNum : curNum - rhsNum;
10426
10426
  if (Number.isSafeInteger(nextNum)) {
10427
10427
  this.budget.parsing.admit(4);
@@ -4,7 +4,7 @@ import {
4
4
  ShellSyntaxError,
5
5
  cloudflareWorkerLimits,
6
6
  parseShell
7
- } from "./chunks/chunk-6AKPBNRF.js";
7
+ } from "./chunks/chunk-HEENNMEW.js";
8
8
  import "./chunks/chunk-AKC46AF6.js";
9
9
  import "./chunks/chunk-D2XB7XIC.js";
10
10
  import "./chunks/chunk-U5NUZPCC.js";
@@ -2,7 +2,7 @@ import {
2
2
  createLlmCommand,
3
3
  createLlmCommands,
4
4
  llmCommands
5
- } from "../safe-bash/command-chunks/chunk-UVHLUL62.js";
5
+ } from "../safe-bash/command-chunks/chunk-YFSDDFGV.js";
6
6
  import "../safe-bash/command-chunks/chunk-PFHJSI27.js";
7
7
  import "../safe-bash/command-chunks/chunk-56W542VW.js";
8
8
  import "../safe-bash/command-chunks/chunk-PHFOL7T3.js";
@@ -11,4 +11,4 @@ export { templateYaml } from "./template-yaml.js";
11
11
  export { findExtractedRange } from "./extract-range.js";
12
12
  export { parseLlmSchemaDsl } from "./schemas.js";
13
13
  export { resolveLlmSchemaInput, type LlmSchemaInputOptions } from "./schema-input.js";
14
- export { getLlmModelAliases } from "./models-list.js";
14
+ export { getLlmModelAliases, selectLlmModelByQuery } from "./model-selection.js";
@@ -22,8 +22,9 @@ import {
22
22
  llmTemplateUsesInput,
23
23
  parseLlmSchemaDsl,
24
24
  resolveLlmSchemaInput,
25
+ selectLlmModelByQuery,
25
26
  validateLlmTemplateParameters
26
- } from "../safe-bash/command-chunks/chunk-UVHLUL62.js";
27
+ } from "../safe-bash/command-chunks/chunk-YFSDDFGV.js";
27
28
  import {
28
29
  createLlmService,
29
30
  validateModelOptions
@@ -52,6 +53,7 @@ export {
52
53
  llmTemplateUsesInput,
53
54
  parseLlmSchemaDsl,
54
55
  resolveLlmSchemaInput,
56
+ selectLlmModelByQuery,
55
57
  templateYaml,
56
58
  validateLlmTemplateParameters,
57
59
  validateModelOptions
@@ -0,0 +1,5 @@
1
+ import type { LlmServiceModel } from "./service.js";
2
+ /** Combine catalog and persisted aliases with the same matching rules for every API. */
3
+ export declare function getLlmModelAliases({ provider, model }: LlmServiceModel, configured: Readonly<Record<string, string>>): readonly string[];
4
+ /** Select the shortest matching ID, preserving catalog order for equal lengths. */
5
+ export declare function selectLlmModelByQuery(models: readonly LlmServiceModel[], queries: readonly string[], configuredAliases?: Readonly<Record<string, string>>, signal?: AbortSignal): Promise<LlmServiceModel>;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createSleepWithSettings
3
- } from "../safe-bash/command-chunks/chunk-PU3BDSCA.js";
3
+ } from "../safe-bash/command-chunks/chunk-KYSFBW35.js";
4
4
  import {
5
5
  init_buffer
6
6
  } from "../safe-bash/command-chunks/chunk-HX3SHTCE.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createSleepWithSettings
3
- } from "../safe-bash/command-chunks/chunk-PU3BDSCA.js";
3
+ } from "../safe-bash/command-chunks/chunk-KYSFBW35.js";
4
4
  import "../safe-bash/command-chunks/chunk-HX3SHTCE.js";
5
5
  export {
6
6
  createSleepWithSettings
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poe-platform/safe-bash",
3
- "version": "0.1.791",
3
+ "version": "0.1.793",
4
4
  "description": "Extensible virtual shell with pluggable filesystems and streaming commands",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -869,7 +869,7 @@
869
869
  "access": "public"
870
870
  },
871
871
  "dependencies": {
872
- "@poe-platform/safe-fs": "0.1.791",
872
+ "@poe-platform/safe-fs": "0.1.793",
873
873
  "pdf-lib": "1.17.1",
874
874
  "@noble/hashes": "2.4.0",
875
875
  "pako": "3.0.1",
@@ -1,10 +0,0 @@
1
- import type { CommandContext } from "../safe-bash-contracts/index.js";
2
- import type { LlmService, LlmServiceModel } from "./service.js";
3
- export declare const modelsGroupHelp = "Usage: llm models [OPTIONS] COMMAND [ARGS]...\n\n Manage available models\n\nOptions:\n -h, --help Show this message and exit.\n\nCommands:\n list* List available models\n default Show or set the default model\n options Manage default options for models\n";
4
- export declare class LlmModelsUsageError extends Error {
5
- constructor(message: string, usage?: boolean);
6
- }
7
- /** Combine catalog and persisted aliases with the same matching rules for every API. */
8
- export declare function getLlmModelAliases({ provider, model }: LlmServiceModel, configured: Readonly<Record<string, string>>): readonly string[];
9
- /** Reference model-list query semantics for the configured host catalog. */
10
- export declare function listLlmModels(context: CommandContext, service: LlmService, tokens: readonly string[], emit: (text: string) => Promise<void>, step: () => Promise<void>): Promise<void>;