@lunnoa/client 2.0.0 → 2.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.js CHANGED
@@ -6,7 +6,7 @@ function isBrowserEnvironment() {
6
6
  function assertApiKeyAllowedInEnvironment(apiKey) {
7
7
  if (isBrowserEnvironment()) {
8
8
  throw new Error(
9
- "Refusing to use a Lunnoa API key (lna_...) in a browser environment. API keys are server-side credentials: anyone opening dev tools could read the key and act as the service account across its whole workspace. Either call the Lunnoa API from your own backend which holds the key (backend-for-frontend pattern), or authenticate the end user with a Lunnoa user JWT and pass it as `accessToken`."
9
+ "Refusing to use a Lunnoa API key (lna_...) in a browser environment. API keys are for the CLI and operator scripts, not for app login. Anyone opening dev tools could read the key and act as the service account across its whole workspace. Sign the end user in with lunnoa.auth.login and pass their JWT as `accessToken`."
10
10
  );
11
11
  }
12
12
  if (!apiKey.startsWith(API_KEY_PREFIX)) {
@@ -88,7 +88,7 @@ var HttpClient = class {
88
88
  }
89
89
  if (!options.apiKey && !options.accessToken && !options.tokenStore) {
90
90
  throw new Error(
91
- "LunnoaClient requires an apiKey (server-side), an accessToken (user JWT), or a tokenStore (Pattern B)."
91
+ "LunnoaClient requires an accessToken or tokenStore (Lunnoa user JWT), or an apiKey for operator scripts."
92
92
  );
93
93
  }
94
94
  if (options.apiKey) {
@@ -466,7 +466,7 @@ var AgentChatClient = class {
466
466
  function messageTaskBody(message, options = {}) {
467
467
  return {
468
468
  messages: [message],
469
- ...options.chatMode ? { chatMode: options.chatMode } : {},
469
+ chatMode: options.chatMode ?? "preview",
470
470
  ...options.data ? { data: options.data } : {},
471
471
  ...options.piiResolution ? { piiResolution: options.piiResolution } : {}
472
472
  };
@@ -892,6 +892,22 @@ var SsoAuthResource = class {
892
892
  }
893
893
  };
894
894
 
895
+ // src/resources/ai-connections.ts
896
+ var AiConnectionsResource = class {
897
+ constructor(http) {
898
+ this.http = http;
899
+ }
900
+ http;
901
+ /**
902
+ * Lists AI connections the caller can assign to an agent, with the model
903
+ * ids each connection accepts. Credentials are never included.
904
+ * Requires `agents:create` (the same permission as agent deploy).
905
+ */
906
+ list() {
907
+ return this.http.get("/api/ai-connections");
908
+ }
909
+ };
910
+
895
911
  // src/resources/connections.ts
896
912
  var ConnectionsResource = class {
897
913
  constructor(http) {
@@ -2090,7 +2106,7 @@ var WorkflowsResource = class {
2090
2106
  var LunnoaClient = class {
2091
2107
  /** The underlying HTTP layer, exposed for advanced/escape-hatch requests. */
2092
2108
  http;
2093
- /** Login, refresh, SSO discovery, and session helpers (Pattern B). */
2109
+ /** Login, refresh, SSO discovery, and session helpers for Lunnoa users. */
2094
2110
  auth;
2095
2111
  agents;
2096
2112
  tasks;
@@ -2117,6 +2133,8 @@ var LunnoaClient = class {
2117
2133
  variables;
2118
2134
  scorecards;
2119
2135
  connections;
2136
+ /** AI provider connections and the model ids each one accepts. */
2137
+ aiConnections;
2120
2138
  workflowApps;
2121
2139
  discovery;
2122
2140
  constructor(options) {
@@ -2140,6 +2158,7 @@ var LunnoaClient = class {
2140
2158
  this.variables = new VariablesResource(this.http);
2141
2159
  this.scorecards = new ScorecardsResource(this.http);
2142
2160
  this.connections = new ConnectionsResource(this.http);
2161
+ this.aiConnections = new AiConnectionsResource(this.http);
2143
2162
  this.discovery = new DiscoveryResource(this.http);
2144
2163
  }
2145
2164
  };
@@ -2216,6 +2235,6 @@ function createServerClient(options) {
2216
2235
  });
2217
2236
  }
2218
2237
 
2219
- export { API_KEY_PREFIX, ActionsResource, AgentChatClient, AgentChatStream, AgentsResource, ApprovalsResource, AuthResource, ConnectionsResource, DEFINE_KINDS, DiscoveryResource, EntitiesResource, EntityTypesResource, ExecutionProgressStream, ExecutionTimeoutError, ExecutionsResource, HttpClient, KnowledgeResource, LunnoaApiError, LunnoaClient, QueueItemsResource, QueuesResource, RunsResource, ScorecardsResource, SsoAuthResource, TablesResource, TasksResource, VariablesResource, WorkflowAppsResource, WorkflowsResource, assertApiKeyAllowedInEnvironment, createBrowserClient, createLocalStorageTokenStore, createMemoryTokenStore, createServerClient, defineAction, defineAgent, defineAiConnection, defineConnection, defineEntityType, defineWorkflow, entityTypeDefinitionToUpsert, isBrowserEnvironment, isLoginRequires2FA, iterateOffset, iteratePages, parseSseEvents, parseSseStream, resolveActionAppId, resolveActionId };
2238
+ export { API_KEY_PREFIX, ActionsResource, AgentChatClient, AgentChatStream, AgentsResource, AiConnectionsResource, ApprovalsResource, AuthResource, ConnectionsResource, DEFINE_KINDS, DiscoveryResource, EntitiesResource, EntityTypesResource, ExecutionProgressStream, ExecutionTimeoutError, ExecutionsResource, HttpClient, KnowledgeResource, LunnoaApiError, LunnoaClient, QueueItemsResource, QueuesResource, RunsResource, ScorecardsResource, SsoAuthResource, TablesResource, TasksResource, VariablesResource, WorkflowAppsResource, WorkflowsResource, assertApiKeyAllowedInEnvironment, createBrowserClient, createLocalStorageTokenStore, createMemoryTokenStore, createServerClient, defineAction, defineAgent, defineAiConnection, defineConnection, defineEntityType, defineWorkflow, entityTypeDefinitionToUpsert, isBrowserEnvironment, isLoginRequires2FA, iterateOffset, iteratePages, parseSseEvents, parseSseStream, resolveActionAppId, resolveActionId };
2220
2239
  //# sourceMappingURL=index.js.map
2221
2240
  //# sourceMappingURL=index.js.map