@astralform/js 3.0.1 → 3.1.0

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 CHANGED
@@ -541,6 +541,24 @@ var AstralformClient = class {
541
541
  avatarUrl: a.avatar_url
542
542
  }));
543
543
  }
544
+ /**
545
+ * List the models the caller may pick this turn — expanded from the curated
546
+ * catalog of the providers the team has connected (client-side model
547
+ * selection). Backs the composer's model picker. Scoped to the active agent
548
+ * via X-Agent-ID, same as {@link getAgentStatus}.
549
+ */
550
+ async getModels() {
551
+ const raw = await this.get("/v1/models");
552
+ return raw.map((m) => ({
553
+ provider: m.provider,
554
+ providerDisplay: m.provider_display,
555
+ model: m.model,
556
+ thinking: m.thinking,
557
+ tools: m.tools,
558
+ vision: m.vision,
559
+ thinkingMode: m.thinking_mode
560
+ }));
561
+ }
544
562
  async getSkills() {
545
563
  const raw = await this.get("/v1/skills");
546
564
  return raw.map((s) => ({
@@ -1292,6 +1310,11 @@ var ChatSession = class {
1292
1310
  this.emit({ type: "connected" });
1293
1311
  }
1294
1312
  async send(content, options) {
1313
+ if (options?.provider == null !== (options?.model == null)) {
1314
+ throw new Error(
1315
+ "`provider` and `model` must be supplied together (client-side model selection)."
1316
+ );
1317
+ }
1295
1318
  if (this.isStreaming) return;
1296
1319
  const conversationId = options?.conversationId ?? this.conversationId ?? void 0;
1297
1320
  const userMessage = {
@@ -1316,7 +1339,12 @@ var ChatSession = class {
1316
1339
  upload_ids: options?.uploadIds,
1317
1340
  agent_name: options?.agentName,
1318
1341
  enable_search: options?.enableSearch,
1319
- plan_mode: options?.planMode
1342
+ plan_mode: options?.planMode,
1343
+ // Per-request model choice (client-side model selection).
1344
+ provider: options?.provider,
1345
+ model: options?.model,
1346
+ reasoning_effort: options?.reasoningEffort,
1347
+ temperature: options?.temperature
1320
1348
  };
1321
1349
  await this.processStream(request);
1322
1350
  }
@@ -1823,6 +1851,11 @@ var StreamManager = class {
1823
1851
  }
1824
1852
  // ── Send ──────────────────────────────────────────────────────
1825
1853
  async send(content, options) {
1854
+ if (options?.provider == null !== (options?.model == null)) {
1855
+ throw new Error(
1856
+ "`provider` and `model` must be supplied together (client-side model selection)."
1857
+ );
1858
+ }
1826
1859
  if (this._state === "streaming") return;
1827
1860
  if (!this._activeConversationId) {
1828
1861
  const id = await this.session.createNewConversation();
@@ -1834,7 +1867,11 @@ var StreamManager = class {
1834
1867
  enableSearch: options?.enableSearch,
1835
1868
  agentName: options?.agentName,
1836
1869
  uploadIds: options?.uploadIds,
1837
- planMode: options?.planMode
1870
+ planMode: options?.planMode,
1871
+ provider: options?.provider,
1872
+ model: options?.model,
1873
+ reasoningEffort: options?.reasoningEffort,
1874
+ temperature: options?.temperature
1838
1875
  });
1839
1876
  } catch {
1840
1877
  }