@adaptic/utils 0.0.1022 → 0.0.1024

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
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var adaptic$1 = require('@adaptic/backend-legacy');
3
+ var adaptic$1 = require('@adaptic/backend');
4
4
  var dateFns = require('date-fns');
5
5
  var dateFnsTz = require('date-fns-tz');
6
6
  var require$$0$1 = require('events');
@@ -186,7 +186,7 @@ let authConfigured = false;
186
186
  /**
187
187
  * Configure the Apollo client authentication with a dynamic token provider.
188
188
  * This should be called once during app initialization before making any
189
- * @adaptic/backend-legacy API calls.
189
+ * @adaptic/backend API calls.
190
190
  *
191
191
  * The token provider function will be called for each GraphQL request,
192
192
  * allowing for dynamic token retrieval (e.g., from session storage, SecretsManager, etc.)
@@ -231,7 +231,7 @@ const isAuthConfigured = () => {
231
231
  };
232
232
  /**
233
233
  * Returns a shared Apollo client instance with connection pooling.
234
- * This should be used for all @adaptic/backend-legacy operations.
234
+ * This should be used for all @adaptic/backend operations.
235
235
  *
236
236
  * @returns {Promise<ApolloClientInstance>} The shared Apollo client instance.
237
237
  */
@@ -8733,7 +8733,7 @@ async function getConfiguration(account) {
8733
8733
  throw new Error(`Failed to fetch account configuration: ${alpacaResponse.statusText}`);
8734
8734
  }
8735
8735
  if (!freshAlpacaAccount) {
8736
- throw new Error("Failed to get Alpaca Account from @adaptic/backend-legacy.");
8736
+ throw new Error("Failed to get Alpaca Account from @adaptic/backend.");
8737
8737
  }
8738
8738
  const dataFromAlpaca = (await alpacaResponse.json());
8739
8739
  const accountWithAllocation = freshAlpacaAccount;
@@ -8917,7 +8917,7 @@ async function updateConfiguration(user, account, updatedConfig) {
8917
8917
  }
8918
8918
  const alpacaData = (await alpacaResponse.json());
8919
8919
  if (!updatedAlpacaAccount) {
8920
- throw new Error("Failed to update Alpaca Account in @adaptic/backend-legacy.");
8920
+ throw new Error("Failed to update Alpaca Account in @adaptic/backend.");
8921
8921
  }
8922
8922
  const updatedAccountWithAllocation = updatedAlpacaAccount;
8923
8923
  const selectedAllocation = (updatedConfig.allocation ||
@@ -63742,6 +63742,8 @@ async function runLeg(leg, params, execution) {
63742
63742
  content: execution.content,
63743
63743
  responseFormat: execution.responseFormat,
63744
63744
  params,
63745
+ developerPrompt: execution.developerPrompt,
63746
+ context: execution.context,
63745
63747
  signal: controller.signal,
63746
63748
  correlationId: execution.correlationId,
63747
63749
  }), budgetMs);
@@ -64285,7 +64287,7 @@ var aliases = {
64285
64287
  model_id: "openai/gpt-oss-20b",
64286
64288
  model_id_status: "confirmed",
64287
64289
  model_id_source: "DeepInfra /v1/openai/models catalogue queried against the live account 2026-09-11; tool-calling and latency verified by direct call on the same account",
64288
- model_family: "gpt-oss-20B",
64290
+ model_family: "gpt-oss-20b",
64289
64291
  lumic_model: "openai/gpt-oss-20b",
64290
64292
  params: {
64291
64293
  temperature: null,
@@ -64354,7 +64356,7 @@ var aliases = {
64354
64356
  model_id: "openai/gpt-oss-20b",
64355
64357
  model_id_status: "confirmed",
64356
64358
  model_id_source: "DeepInfra /v1/openai/models catalogue queried against the live account 2026-09-11; tool-calling and latency verified by direct call on the same account",
64357
- model_family: "gpt-oss-20B",
64359
+ model_family: "gpt-oss-20b",
64358
64360
  lumic_model: "openai/gpt-oss-20b",
64359
64361
  params: {
64360
64362
  temperature: null,
@@ -64380,7 +64382,7 @@ var aliases = {
64380
64382
  model_id: "inclusionAI/Ling-3.0-flash-Fin",
64381
64383
  model_id_status: "confirmed",
64382
64384
  model_id_source: "DeepInfra /v1/openai/models catalogue queried against the live account 2026-09-11; tool-calling and latency verified by direct call on the same account",
64383
- model_family: "Ling 3.0 Flash Fin",
64385
+ model_family: "Ling 3.0 flash Fin",
64384
64386
  lumic_model: "inclusionAI/Ling-3.0-flash-Fin",
64385
64387
  params: {
64386
64388
  temperature: null,
@@ -64941,8 +64943,16 @@ function createDirectTransport(config) {
64941
64943
  throw new DirectTransportRefusedError(route.routeKey, "the route names no lumic_model, so there is no registered model to call directly");
64942
64944
  }
64943
64945
  const call = await config.resolveCaller();
64946
+ // `developerPrompt` and `context` are named options on lumic's own call
64947
+ // surface, not body parameters, so they are forwarded explicitly rather
64948
+ // than through `request.params` — which transports send verbatim and which
64949
+ // therefore never carried them.
64944
64950
  const result = await call(request.content, request.responseFormat, {
64945
64951
  ...request.params,
64952
+ ...(request.developerPrompt !== undefined
64953
+ ? { developerPrompt: request.developerPrompt }
64954
+ : {}),
64955
+ ...(request.context !== undefined ? { context: request.context } : {}),
64946
64956
  model: route.lumicModel,
64947
64957
  signal: request.signal,
64948
64958
  timeout: route.timeoutMs,
@@ -65190,7 +65200,21 @@ function createGatewayTransport(config) {
65190
65200
  */
65191
65201
  function buildMessages(request) {
65192
65202
  const content = typeof request.content === "string" ? request.content : [...request.content];
65193
- return [{ role: "user", content }];
65203
+ const messages = [];
65204
+ // Order is the contract: the developer instruction must precede the history it
65205
+ // governs, and the history must precede the turn it is the memory for. A
65206
+ // transport that emitted only the final turn would not be sending a shorter
65207
+ // prompt — it would be asking a different question, of an unprompted model.
65208
+ if (request.developerPrompt !== undefined && request.developerPrompt !== "") {
65209
+ messages.push({ role: "system", content: request.developerPrompt });
65210
+ }
65211
+ if (request.context !== undefined) {
65212
+ for (const turn of request.context) {
65213
+ messages.push(turn);
65214
+ }
65215
+ }
65216
+ messages.push({ role: "user", content });
65217
+ return messages;
65194
65218
  }
65195
65219
  /**
65196
65220
  * Interpret the model's content according to the requested format.
@@ -65412,6 +65436,8 @@ async function callLLMByAlias(content, responseFormat = "text", options) {
65412
65436
  legs: prepareLegs(chain, options, responseFormat, gateway),
65413
65437
  content: boundContent,
65414
65438
  responseFormat,
65439
+ developerPrompt: options.developerPrompt,
65440
+ context: options.context,
65415
65441
  breakers,
65416
65442
  correlationId: options.correlationId,
65417
65443
  callerSignal: options.signal,
@@ -65444,6 +65470,8 @@ async function callLLMByAlias(content, responseFormat = "text", options) {
65444
65470
  legs: prepareLegs({ ...chain, routes: closedLegs }, options, responseFormat, direct),
65445
65471
  content: boundContent,
65446
65472
  responseFormat,
65473
+ developerPrompt: options.developerPrompt,
65474
+ context: options.context,
65447
65475
  breakers,
65448
65476
  correlationId: options.correlationId,
65449
65477
  callerSignal: options.signal,