@lunnoa/client 1.2.0 → 1.4.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
@@ -458,10 +458,7 @@ var AgentChatClient = class {
458
458
  raw: true,
459
459
  signal: options.signal,
460
460
  headers: { Accept: "text/event-stream" },
461
- body: {
462
- messages: [uiMessage],
463
- ...options.chatMode ? { chatMode: options.chatMode } : {}
464
- }
461
+ body: messageTaskBody(uiMessage, options)
465
462
  }
466
463
  );
467
464
  return new AgentChatStream(response, { signal: options.signal });
@@ -500,6 +497,14 @@ var AgentChatClient = class {
500
497
  );
501
498
  }
502
499
  };
500
+ function messageTaskBody(message, options = {}) {
501
+ return {
502
+ messages: [message],
503
+ ...options.chatMode ? { chatMode: options.chatMode } : {},
504
+ ...options.data ? { data: options.data } : {},
505
+ ...options.piiResolution ? { piiResolution: options.piiResolution } : {}
506
+ };
507
+ }
503
508
  function generateMessageId() {
504
509
  const cryptoObj = globalThis.crypto;
505
510
  if (cryptoObj?.randomUUID) {
@@ -1028,7 +1033,6 @@ var EntitiesResource = class {
1028
1033
  objectTypeSlug: options.objectTypeSlug,
1029
1034
  state: options.state,
1030
1035
  states: options.states?.join(","),
1031
- ownerId: options.ownerId,
1032
1036
  search: options.search,
1033
1037
  sortBy: options.sortBy,
1034
1038
  sortOrder: options.sortOrder,
@@ -1061,7 +1065,7 @@ var EntityTypesResource = class {
1061
1065
  }
1062
1066
  http;
1063
1067
  /**
1064
- * Lists entity types in the workspace. Request
1068
+ * Lists entity types granted to the API key's workspace. Request
1065
1069
  * `expansion: ['attributeSchema', 'stateSchema']` for the field and state
1066
1070
  * machine definitions the codegen CLI builds types from.
1067
1071
  */
@@ -1086,7 +1090,9 @@ var EntityTypesResource = class {
1086
1090
  });
1087
1091
  }
1088
1092
  /**
1089
- * Creates or updates an entity type by workspace-scoped slug.
1093
+ * Creates or updates an entity type by deployment-wide slug.
1094
+ * A new slug is granted to the API key's workspace. A slug already shared
1095
+ * with another workspace is rejected unless the key belongs to a platform admin.
1090
1096
  * Prefer the CLI (`npx @lunnoa/client entity-types deploy`) for happy-path deploy.
1091
1097
  */
1092
1098
  upsertBySlug(definition) {
@@ -1624,10 +1630,11 @@ var QueueItemsResource = class {
1624
1630
  listRetryable(queueId) {
1625
1631
  return this.http.get(`/api/queues/${queueId}/items/retry`);
1626
1632
  }
1627
- /** Returns items with the given status. */
1628
- listByStatus(queueId, status) {
1633
+ /** Returns a page of items with the given status. */
1634
+ listByStatus(queueId, status, options = {}) {
1629
1635
  return this.http.get(
1630
- `/api/queues/${queueId}/items/status/${status}`
1636
+ `/api/queues/${queueId}/items/status/${status}`,
1637
+ { query: { limit: options.limit, offset: options.offset } }
1631
1638
  );
1632
1639
  }
1633
1640
  /** Looks an item up by the external ID your system supplied. */
@@ -1636,11 +1643,22 @@ var QueueItemsResource = class {
1636
1643
  `/api/queues/${queueId}/items/external/${externalId}`
1637
1644
  );
1638
1645
  }
1639
- /** Searches items in the queue. */
1640
- search(queueId, query) {
1641
- return this.http.get(`/api/queues/${queueId}/items/search`, {
1642
- query: { q: query }
1643
- });
1646
+ /**
1647
+ * Searches items by external id, item data, and metadata.
1648
+ * Returns one page, same shape as `list`.
1649
+ */
1650
+ search(queueId, query, options = {}) {
1651
+ return this.http.get(
1652
+ `/api/queues/${queueId}/items/search`,
1653
+ {
1654
+ query: {
1655
+ limit: options.limit,
1656
+ offset: options.offset,
1657
+ expansion: serializeCsv(options.expansion),
1658
+ filterBy: serializeFilterBy({ search: query })
1659
+ }
1660
+ }
1661
+ );
1644
1662
  }
1645
1663
  /** Returns per-status and per-priority counts for the queue. */
1646
1664
  stats(queueId) {
@@ -1676,10 +1694,21 @@ var QueueItemsResource = class {
1676
1694
  addError(queueId, itemId, error) {
1677
1695
  return this.http.post(
1678
1696
  `/api/queues/${queueId}/items/${itemId}/error`,
1679
- { body: error }
1697
+ {
1698
+ body: {
1699
+ error: error.error,
1700
+ errorDetails: serializeErrorDetails(error.errorDetails)
1701
+ }
1702
+ }
1680
1703
  );
1681
1704
  }
1682
1705
  };
1706
+ function serializeErrorDetails(value) {
1707
+ if (value === void 0) {
1708
+ return void 0;
1709
+ }
1710
+ return typeof value === "string" ? value : JSON.stringify(value);
1711
+ }
1683
1712
 
1684
1713
  // src/resources/queues.ts
1685
1714
  var QueuesResource = class {
@@ -1806,6 +1835,32 @@ var RunsResource = class {
1806
1835
  }
1807
1836
  };
1808
1837
 
1838
+ // src/resources/scorecards.ts
1839
+ var ScorecardsResource = class {
1840
+ constructor(http) {
1841
+ this.http = http;
1842
+ }
1843
+ http;
1844
+ /** Lists scorecards in the workspace. */
1845
+ list() {
1846
+ return this.http.get("/api/scorecards");
1847
+ }
1848
+ /** Returns a scorecard with objectives, measures, latest values and status. */
1849
+ get(scorecardId) {
1850
+ return this.http.get(`/api/scorecards/${scorecardId}`);
1851
+ }
1852
+ /**
1853
+ * Records a measure value. A value for the same period replaces the current
1854
+ * one; the old value is kept as superseded history.
1855
+ */
1856
+ recordValue(measureId, data) {
1857
+ return this.http.post(
1858
+ `/api/scorecards/measures/${measureId}/values`,
1859
+ { body: data }
1860
+ );
1861
+ }
1862
+ };
1863
+
1809
1864
  // src/resources/tasks.ts
1810
1865
  var TasksResource = class {
1811
1866
  constructor(http) {
@@ -1856,12 +1911,7 @@ var TasksResource = class {
1856
1911
  } : message;
1857
1912
  return this.http.post(
1858
1913
  `/api/agents/${agentId}/tasks/${taskId}/message`,
1859
- {
1860
- body: {
1861
- messages: [uiMessage],
1862
- ...options.chatMode ? { chatMode: options.chatMode } : {}
1863
- }
1864
- }
1914
+ { body: messageTaskBody(uiMessage, options) }
1865
1915
  );
1866
1916
  }
1867
1917
  };
@@ -2044,6 +2094,7 @@ var LunnoaClient = class {
2044
2094
  queues;
2045
2095
  queueItems;
2046
2096
  variables;
2097
+ scorecards;
2047
2098
  connections;
2048
2099
  projects;
2049
2100
  workflowApps;
@@ -2066,6 +2117,7 @@ var LunnoaClient = class {
2066
2117
  this.queues = new QueuesResource(this.http);
2067
2118
  this.queueItems = new QueueItemsResource(this.http);
2068
2119
  this.variables = new VariablesResource(this.http);
2120
+ this.scorecards = new ScorecardsResource(this.http);
2069
2121
  this.connections = new ConnectionsResource(this.http);
2070
2122
  this.projects = new ProjectsResource(this.http);
2071
2123
  this.discovery = new DiscoveryResource(this.http);
@@ -2599,7 +2651,6 @@ function useEntityList(initialOptions) {
2599
2651
  objectTypeSlug: initialOptions.objectTypeSlug,
2600
2652
  state: initialOptions.state,
2601
2653
  states: initialOptions.states,
2602
- ownerId: initialOptions.ownerId,
2603
2654
  search: initialOptions.search,
2604
2655
  sortBy: initialOptions.sortBy,
2605
2656
  sortOrder: initialOptions.sortOrder,
@@ -2611,7 +2662,6 @@ function useEntityList(initialOptions) {
2611
2662
  initialOptions.objectTypeSlug,
2612
2663
  initialOptions.state,
2613
2664
  initialOptions.states,
2614
- initialOptions.ownerId,
2615
2665
  initialOptions.search,
2616
2666
  initialOptions.sortBy,
2617
2667
  initialOptions.sortOrder,