@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.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import adaptic$1, { stopClient, setTokenProvider, getApolloClient } from '@adaptic/backend-legacy';
1
+ import adaptic$1, { stopClient, setTokenProvider, getApolloClient } from '@adaptic/backend';
2
2
  import { format, sub, set, add, startOfDay, endOfDay, isBefore, differenceInMilliseconds } from 'date-fns';
3
3
  import { formatInTimeZone, toZonedTime, fromZonedTime } from 'date-fns-tz';
4
4
  import require$$0$4, { EventEmitter } from 'events';
@@ -184,7 +184,7 @@ let authConfigured = false;
184
184
  /**
185
185
  * Configure the Apollo client authentication with a dynamic token provider.
186
186
  * This should be called once during app initialization before making any
187
- * @adaptic/backend-legacy API calls.
187
+ * @adaptic/backend API calls.
188
188
  *
189
189
  * The token provider function will be called for each GraphQL request,
190
190
  * allowing for dynamic token retrieval (e.g., from session storage, SecretsManager, etc.)
@@ -229,7 +229,7 @@ const isAuthConfigured = () => {
229
229
  };
230
230
  /**
231
231
  * Returns a shared Apollo client instance with connection pooling.
232
- * This should be used for all @adaptic/backend-legacy operations.
232
+ * This should be used for all @adaptic/backend operations.
233
233
  *
234
234
  * @returns {Promise<ApolloClientInstance>} The shared Apollo client instance.
235
235
  */
@@ -8731,7 +8731,7 @@ async function getConfiguration(account) {
8731
8731
  throw new Error(`Failed to fetch account configuration: ${alpacaResponse.statusText}`);
8732
8732
  }
8733
8733
  if (!freshAlpacaAccount) {
8734
- throw new Error("Failed to get Alpaca Account from @adaptic/backend-legacy.");
8734
+ throw new Error("Failed to get Alpaca Account from @adaptic/backend.");
8735
8735
  }
8736
8736
  const dataFromAlpaca = (await alpacaResponse.json());
8737
8737
  const accountWithAllocation = freshAlpacaAccount;
@@ -8915,7 +8915,7 @@ async function updateConfiguration(user, account, updatedConfig) {
8915
8915
  }
8916
8916
  const alpacaData = (await alpacaResponse.json());
8917
8917
  if (!updatedAlpacaAccount) {
8918
- throw new Error("Failed to update Alpaca Account in @adaptic/backend-legacy.");
8918
+ throw new Error("Failed to update Alpaca Account in @adaptic/backend.");
8919
8919
  }
8920
8920
  const updatedAccountWithAllocation = updatedAlpacaAccount;
8921
8921
  const selectedAllocation = (updatedConfig.allocation ||
@@ -63740,6 +63740,8 @@ async function runLeg(leg, params, execution) {
63740
63740
  content: execution.content,
63741
63741
  responseFormat: execution.responseFormat,
63742
63742
  params,
63743
+ developerPrompt: execution.developerPrompt,
63744
+ context: execution.context,
63743
63745
  signal: controller.signal,
63744
63746
  correlationId: execution.correlationId,
63745
63747
  }), budgetMs);
@@ -64283,7 +64285,7 @@ var aliases = {
64283
64285
  model_id: "openai/gpt-oss-20b",
64284
64286
  model_id_status: "confirmed",
64285
64287
  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",
64286
- model_family: "gpt-oss-20B",
64288
+ model_family: "gpt-oss-20b",
64287
64289
  lumic_model: "openai/gpt-oss-20b",
64288
64290
  params: {
64289
64291
  temperature: null,
@@ -64352,7 +64354,7 @@ var aliases = {
64352
64354
  model_id: "openai/gpt-oss-20b",
64353
64355
  model_id_status: "confirmed",
64354
64356
  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",
64355
- model_family: "gpt-oss-20B",
64357
+ model_family: "gpt-oss-20b",
64356
64358
  lumic_model: "openai/gpt-oss-20b",
64357
64359
  params: {
64358
64360
  temperature: null,
@@ -64378,7 +64380,7 @@ var aliases = {
64378
64380
  model_id: "inclusionAI/Ling-3.0-flash-Fin",
64379
64381
  model_id_status: "confirmed",
64380
64382
  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",
64381
- model_family: "Ling 3.0 Flash Fin",
64383
+ model_family: "Ling 3.0 flash Fin",
64382
64384
  lumic_model: "inclusionAI/Ling-3.0-flash-Fin",
64383
64385
  params: {
64384
64386
  temperature: null,
@@ -64939,8 +64941,16 @@ function createDirectTransport(config) {
64939
64941
  throw new DirectTransportRefusedError(route.routeKey, "the route names no lumic_model, so there is no registered model to call directly");
64940
64942
  }
64941
64943
  const call = await config.resolveCaller();
64944
+ // `developerPrompt` and `context` are named options on lumic's own call
64945
+ // surface, not body parameters, so they are forwarded explicitly rather
64946
+ // than through `request.params` — which transports send verbatim and which
64947
+ // therefore never carried them.
64942
64948
  const result = await call(request.content, request.responseFormat, {
64943
64949
  ...request.params,
64950
+ ...(request.developerPrompt !== undefined
64951
+ ? { developerPrompt: request.developerPrompt }
64952
+ : {}),
64953
+ ...(request.context !== undefined ? { context: request.context } : {}),
64944
64954
  model: route.lumicModel,
64945
64955
  signal: request.signal,
64946
64956
  timeout: route.timeoutMs,
@@ -65188,7 +65198,21 @@ function createGatewayTransport(config) {
65188
65198
  */
65189
65199
  function buildMessages(request) {
65190
65200
  const content = typeof request.content === "string" ? request.content : [...request.content];
65191
- return [{ role: "user", content }];
65201
+ const messages = [];
65202
+ // Order is the contract: the developer instruction must precede the history it
65203
+ // governs, and the history must precede the turn it is the memory for. A
65204
+ // transport that emitted only the final turn would not be sending a shorter
65205
+ // prompt — it would be asking a different question, of an unprompted model.
65206
+ if (request.developerPrompt !== undefined && request.developerPrompt !== "") {
65207
+ messages.push({ role: "system", content: request.developerPrompt });
65208
+ }
65209
+ if (request.context !== undefined) {
65210
+ for (const turn of request.context) {
65211
+ messages.push(turn);
65212
+ }
65213
+ }
65214
+ messages.push({ role: "user", content });
65215
+ return messages;
65192
65216
  }
65193
65217
  /**
65194
65218
  * Interpret the model's content according to the requested format.
@@ -65410,6 +65434,8 @@ async function callLLMByAlias(content, responseFormat = "text", options) {
65410
65434
  legs: prepareLegs(chain, options, responseFormat, gateway),
65411
65435
  content: boundContent,
65412
65436
  responseFormat,
65437
+ developerPrompt: options.developerPrompt,
65438
+ context: options.context,
65413
65439
  breakers,
65414
65440
  correlationId: options.correlationId,
65415
65441
  callerSignal: options.signal,
@@ -65442,6 +65468,8 @@ async function callLLMByAlias(content, responseFormat = "text", options) {
65442
65468
  legs: prepareLegs({ ...chain, routes: closedLegs }, options, responseFormat, direct),
65443
65469
  content: boundContent,
65444
65470
  responseFormat,
65471
+ developerPrompt: options.developerPrompt,
65472
+ context: options.context,
65445
65473
  breakers,
65446
65474
  correlationId: options.correlationId,
65447
65475
  callerSignal: options.signal,