@lunnoa/client 2.1.0 → 2.3.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
@@ -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
  };
@@ -604,6 +604,40 @@ function resolveActionAppId(action) {
604
604
  `Cannot infer appId for action "${id}". Pass appId explicitly.`
605
605
  );
606
606
  }
607
+ function resolveTriggerAppId(trigger) {
608
+ if (trigger.appId?.trim()) {
609
+ return trigger.appId.trim();
610
+ }
611
+ const id = trigger.id.trim();
612
+ const marker = "_trigger_";
613
+ const markerIndex = id.indexOf(marker);
614
+ if (markerIndex > 0) {
615
+ return id.slice(0, markerIndex);
616
+ }
617
+ const dot = id.indexOf(".");
618
+ if (dot > 0) {
619
+ return id.slice(0, dot);
620
+ }
621
+ throw new Error(
622
+ `Cannot infer appId for trigger "${id}". Pass appId explicitly.`
623
+ );
624
+ }
625
+ function resolveTriggerId(trigger) {
626
+ const id = trigger.id.trim();
627
+ const appId = trigger.appId?.trim();
628
+ if (appId && id.startsWith(`${appId}.`)) {
629
+ return id.slice(appId.length + 1);
630
+ }
631
+ const marker = "_trigger_";
632
+ if (id.includes(marker)) {
633
+ return id;
634
+ }
635
+ const dot = id.indexOf(".");
636
+ if (dot > 0) {
637
+ return id.slice(dot + 1);
638
+ }
639
+ return id;
640
+ }
607
641
  function resolveActionId(action) {
608
642
  const id = action.id.trim();
609
643
  const appId = action.appId?.trim();
@@ -893,6 +927,22 @@ var SsoAuthResource = class {
893
927
  }
894
928
  };
895
929
 
930
+ // src/resources/ai-connections.ts
931
+ var AiConnectionsResource = class {
932
+ constructor(http) {
933
+ this.http = http;
934
+ }
935
+ http;
936
+ /**
937
+ * Lists AI connections the caller can assign to an agent, with the model
938
+ * ids each connection accepts. Credentials are never included.
939
+ * Requires `agents:create` (the same permission as agent deploy).
940
+ */
941
+ list() {
942
+ return this.http.get("/api/ai-connections");
943
+ }
944
+ };
945
+
896
946
  // src/resources/connections.ts
897
947
  var ConnectionsResource = class {
898
948
  constructor(http) {
@@ -2002,6 +2052,17 @@ var WorkflowAppsResource = class {
2002
2052
  };
2003
2053
 
2004
2054
  // src/resources/workflows.ts
2055
+ function triggerToUpsertInput(trigger) {
2056
+ return {
2057
+ triggerId: resolveTriggerId(trigger),
2058
+ appId: resolveTriggerAppId(trigger),
2059
+ ...trigger.connection?.id ? { connectionId: trigger.connection.id } : {},
2060
+ ...trigger.input ? { input: trigger.input } : {},
2061
+ ...trigger.inputs?.length ? { inputs: trigger.inputs } : {},
2062
+ ...trigger.name ? { name: trigger.name } : {},
2063
+ ...trigger.description ? { description: trigger.description } : {}
2064
+ };
2065
+ }
2005
2066
  function stepToUpsertInput(step) {
2006
2067
  const use = step.use;
2007
2068
  return {
@@ -2022,6 +2083,7 @@ function workflowDefinitionToUpsert(def) {
2022
2083
  name: def.name,
2023
2084
  description: def.description,
2024
2085
  isActive: def.isActive,
2086
+ ...def.trigger ? { trigger: triggerToUpsertInput(def.trigger) } : {},
2025
2087
  managedByCode: true,
2026
2088
  steps: def.steps.map(stepToUpsertInput)
2027
2089
  };
@@ -2118,6 +2180,8 @@ var LunnoaClient = class {
2118
2180
  variables;
2119
2181
  scorecards;
2120
2182
  connections;
2183
+ /** AI provider connections and the model ids each one accepts. */
2184
+ aiConnections;
2121
2185
  workflowApps;
2122
2186
  discovery;
2123
2187
  constructor(options) {
@@ -2141,6 +2205,7 @@ var LunnoaClient = class {
2141
2205
  this.variables = new VariablesResource(this.http);
2142
2206
  this.scorecards = new ScorecardsResource(this.http);
2143
2207
  this.connections = new ConnectionsResource(this.http);
2208
+ this.aiConnections = new AiConnectionsResource(this.http);
2144
2209
  this.discovery = new DiscoveryResource(this.http);
2145
2210
  }
2146
2211
  };
@@ -2542,7 +2607,7 @@ function useAgentChat(agentId, taskId, options = {}) {
2542
2607
  if (!token) return {};
2543
2608
  return { Authorization: `Bearer ${token}` };
2544
2609
  },
2545
- body: chatMode ? { chatMode } : void 0,
2610
+ body: { chatMode: chatMode ?? "preview" },
2546
2611
  prepareReconnectToStreamRequest: ({ headers, credentials }) => ({
2547
2612
  api,
2548
2613
  headers,