@astralform/js 3.0.1 → 3.2.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,29 @@ 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
+ // Coerce so the non-optional `supportsEffort: boolean` stays honest even
561
+ // against an older backend that omits `supports_effort` (→ false = safe:
562
+ // the effort control is hidden). Unlike the always-present siblings above,
563
+ // this field can be absent, so it's the one that needs coercion.
564
+ supportsEffort: Boolean(m.supports_effort)
565
+ }));
566
+ }
544
567
  async getSkills() {
545
568
  const raw = await this.get("/v1/skills");
546
569
  return raw.map((s) => ({
@@ -1292,6 +1315,11 @@ var ChatSession = class {
1292
1315
  this.emit({ type: "connected" });
1293
1316
  }
1294
1317
  async send(content, options) {
1318
+ if (options?.provider == null !== (options?.model == null)) {
1319
+ throw new Error(
1320
+ "`provider` and `model` must be supplied together (client-side model selection)."
1321
+ );
1322
+ }
1295
1323
  if (this.isStreaming) return;
1296
1324
  const conversationId = options?.conversationId ?? this.conversationId ?? void 0;
1297
1325
  const userMessage = {
@@ -1316,7 +1344,12 @@ var ChatSession = class {
1316
1344
  upload_ids: options?.uploadIds,
1317
1345
  agent_name: options?.agentName,
1318
1346
  enable_search: options?.enableSearch,
1319
- plan_mode: options?.planMode
1347
+ plan_mode: options?.planMode,
1348
+ // Per-request model choice (client-side model selection).
1349
+ provider: options?.provider,
1350
+ model: options?.model,
1351
+ reasoning_effort: options?.reasoningEffort,
1352
+ temperature: options?.temperature
1320
1353
  };
1321
1354
  await this.processStream(request);
1322
1355
  }
@@ -1823,6 +1856,11 @@ var StreamManager = class {
1823
1856
  }
1824
1857
  // ── Send ──────────────────────────────────────────────────────
1825
1858
  async send(content, options) {
1859
+ if (options?.provider == null !== (options?.model == null)) {
1860
+ throw new Error(
1861
+ "`provider` and `model` must be supplied together (client-side model selection)."
1862
+ );
1863
+ }
1826
1864
  if (this._state === "streaming") return;
1827
1865
  if (!this._activeConversationId) {
1828
1866
  const id = await this.session.createNewConversation();
@@ -1834,7 +1872,11 @@ var StreamManager = class {
1834
1872
  enableSearch: options?.enableSearch,
1835
1873
  agentName: options?.agentName,
1836
1874
  uploadIds: options?.uploadIds,
1837
- planMode: options?.planMode
1875
+ planMode: options?.planMode,
1876
+ provider: options?.provider,
1877
+ model: options?.model,
1878
+ reasoningEffort: options?.reasoningEffort,
1879
+ temperature: options?.temperature
1838
1880
  });
1839
1881
  } catch {
1840
1882
  }