@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/react.cjs CHANGED
@@ -58,7 +58,7 @@ function isBrowserEnvironment() {
58
58
  function assertApiKeyAllowedInEnvironment(apiKey) {
59
59
  if (isBrowserEnvironment()) {
60
60
  throw new Error(
61
- "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`."
61
+ "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`."
62
62
  );
63
63
  }
64
64
  if (!apiKey.startsWith(API_KEY_PREFIX)) {
@@ -140,7 +140,7 @@ var HttpClient = class {
140
140
  }
141
141
  if (!options.apiKey && !options.accessToken && !options.tokenStore) {
142
142
  throw new Error(
143
- "LunnoaClient requires an apiKey (server-side), an accessToken (user JWT), or a tokenStore (Pattern B)."
143
+ "LunnoaClient requires an accessToken or tokenStore (Lunnoa user JWT), or an apiKey for operator scripts."
144
144
  );
145
145
  }
146
146
  if (options.apiKey) {
@@ -518,7 +518,7 @@ var AgentChatClient = class {
518
518
  function messageTaskBody(message, options = {}) {
519
519
  return {
520
520
  messages: [message],
521
- ...options.chatMode ? { chatMode: options.chatMode } : {},
521
+ chatMode: options.chatMode ?? "preview",
522
522
  ...options.data ? { data: options.data } : {},
523
523
  ...options.piiResolution ? { piiResolution: options.piiResolution } : {}
524
524
  };
@@ -893,6 +893,22 @@ var SsoAuthResource = class {
893
893
  }
894
894
  };
895
895
 
896
+ // src/resources/ai-connections.ts
897
+ var AiConnectionsResource = class {
898
+ constructor(http) {
899
+ this.http = http;
900
+ }
901
+ http;
902
+ /**
903
+ * Lists AI connections the caller can assign to an agent, with the model
904
+ * ids each connection accepts. Credentials are never included.
905
+ * Requires `agents:create` (the same permission as agent deploy).
906
+ */
907
+ list() {
908
+ return this.http.get("/api/ai-connections");
909
+ }
910
+ };
911
+
896
912
  // src/resources/connections.ts
897
913
  var ConnectionsResource = class {
898
914
  constructor(http) {
@@ -2091,7 +2107,7 @@ var WorkflowsResource = class {
2091
2107
  var LunnoaClient = class {
2092
2108
  /** The underlying HTTP layer, exposed for advanced/escape-hatch requests. */
2093
2109
  http;
2094
- /** Login, refresh, SSO discovery, and session helpers (Pattern B). */
2110
+ /** Login, refresh, SSO discovery, and session helpers for Lunnoa users. */
2095
2111
  auth;
2096
2112
  agents;
2097
2113
  tasks;
@@ -2118,6 +2134,8 @@ var LunnoaClient = class {
2118
2134
  variables;
2119
2135
  scorecards;
2120
2136
  connections;
2137
+ /** AI provider connections and the model ids each one accepts. */
2138
+ aiConnections;
2121
2139
  workflowApps;
2122
2140
  discovery;
2123
2141
  constructor(options) {
@@ -2141,6 +2159,7 @@ var LunnoaClient = class {
2141
2159
  this.variables = new VariablesResource(this.http);
2142
2160
  this.scorecards = new ScorecardsResource(this.http);
2143
2161
  this.connections = new ConnectionsResource(this.http);
2162
+ this.aiConnections = new AiConnectionsResource(this.http);
2144
2163
  this.discovery = new DiscoveryResource(this.http);
2145
2164
  }
2146
2165
  };
@@ -2542,7 +2561,7 @@ function useAgentChat(agentId, taskId, options = {}) {
2542
2561
  if (!token) return {};
2543
2562
  return { Authorization: `Bearer ${token}` };
2544
2563
  },
2545
- body: chatMode ? { chatMode } : void 0,
2564
+ body: { chatMode: chatMode ?? "preview" },
2546
2565
  prepareReconnectToStreamRequest: ({ headers, credentials }) => ({
2547
2566
  api,
2548
2567
  headers,