@lunnoa/client 1.2.0 → 1.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
@@ -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,
@@ -1624,10 +1628,11 @@ var QueueItemsResource = class {
1624
1628
  listRetryable(queueId) {
1625
1629
  return this.http.get(`/api/queues/${queueId}/items/retry`);
1626
1630
  }
1627
- /** Returns items with the given status. */
1628
- listByStatus(queueId, status) {
1631
+ /** Returns a page of items with the given status. */
1632
+ listByStatus(queueId, status, options = {}) {
1629
1633
  return this.http.get(
1630
- `/api/queues/${queueId}/items/status/${status}`
1634
+ `/api/queues/${queueId}/items/status/${status}`,
1635
+ { query: { limit: options.limit, offset: options.offset } }
1631
1636
  );
1632
1637
  }
1633
1638
  /** Looks an item up by the external ID your system supplied. */
@@ -1636,11 +1641,22 @@ var QueueItemsResource = class {
1636
1641
  `/api/queues/${queueId}/items/external/${externalId}`
1637
1642
  );
1638
1643
  }
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
- });
1644
+ /**
1645
+ * Searches items by external id, item data, and metadata.
1646
+ * Returns one page, same shape as `list`.
1647
+ */
1648
+ search(queueId, query, options = {}) {
1649
+ return this.http.get(
1650
+ `/api/queues/${queueId}/items/search`,
1651
+ {
1652
+ query: {
1653
+ limit: options.limit,
1654
+ offset: options.offset,
1655
+ expansion: serializeCsv(options.expansion),
1656
+ filterBy: serializeFilterBy({ search: query })
1657
+ }
1658
+ }
1659
+ );
1644
1660
  }
1645
1661
  /** Returns per-status and per-priority counts for the queue. */
1646
1662
  stats(queueId) {
@@ -1676,10 +1692,21 @@ var QueueItemsResource = class {
1676
1692
  addError(queueId, itemId, error) {
1677
1693
  return this.http.post(
1678
1694
  `/api/queues/${queueId}/items/${itemId}/error`,
1679
- { body: error }
1695
+ {
1696
+ body: {
1697
+ error: error.error,
1698
+ errorDetails: serializeErrorDetails(error.errorDetails)
1699
+ }
1700
+ }
1680
1701
  );
1681
1702
  }
1682
1703
  };
1704
+ function serializeErrorDetails(value) {
1705
+ if (value === void 0) {
1706
+ return void 0;
1707
+ }
1708
+ return typeof value === "string" ? value : JSON.stringify(value);
1709
+ }
1683
1710
 
1684
1711
  // src/resources/queues.ts
1685
1712
  var QueuesResource = class {
@@ -1806,6 +1833,32 @@ var RunsResource = class {
1806
1833
  }
1807
1834
  };
1808
1835
 
1836
+ // src/resources/scorecards.ts
1837
+ var ScorecardsResource = class {
1838
+ constructor(http) {
1839
+ this.http = http;
1840
+ }
1841
+ http;
1842
+ /** Lists scorecards in the workspace. */
1843
+ list() {
1844
+ return this.http.get("/api/scorecards");
1845
+ }
1846
+ /** Returns a scorecard with objectives, measures, latest values and status. */
1847
+ get(scorecardId) {
1848
+ return this.http.get(`/api/scorecards/${scorecardId}`);
1849
+ }
1850
+ /**
1851
+ * Records a measure value. A value for the same period replaces the current
1852
+ * one; the old value is kept as superseded history.
1853
+ */
1854
+ recordValue(measureId, data) {
1855
+ return this.http.post(
1856
+ `/api/scorecards/measures/${measureId}/values`,
1857
+ { body: data }
1858
+ );
1859
+ }
1860
+ };
1861
+
1809
1862
  // src/resources/tasks.ts
1810
1863
  var TasksResource = class {
1811
1864
  constructor(http) {
@@ -1856,12 +1909,7 @@ var TasksResource = class {
1856
1909
  } : message;
1857
1910
  return this.http.post(
1858
1911
  `/api/agents/${agentId}/tasks/${taskId}/message`,
1859
- {
1860
- body: {
1861
- messages: [uiMessage],
1862
- ...options.chatMode ? { chatMode: options.chatMode } : {}
1863
- }
1864
- }
1912
+ { body: messageTaskBody(uiMessage, options) }
1865
1913
  );
1866
1914
  }
1867
1915
  };
@@ -2044,6 +2092,7 @@ var LunnoaClient = class {
2044
2092
  queues;
2045
2093
  queueItems;
2046
2094
  variables;
2095
+ scorecards;
2047
2096
  connections;
2048
2097
  projects;
2049
2098
  workflowApps;
@@ -2066,6 +2115,7 @@ var LunnoaClient = class {
2066
2115
  this.queues = new QueuesResource(this.http);
2067
2116
  this.queueItems = new QueueItemsResource(this.http);
2068
2117
  this.variables = new VariablesResource(this.http);
2118
+ this.scorecards = new ScorecardsResource(this.http);
2069
2119
  this.connections = new ConnectionsResource(this.http);
2070
2120
  this.projects = new ProjectsResource(this.http);
2071
2121
  this.discovery = new DiscoveryResource(this.http);
@@ -2599,7 +2649,6 @@ function useEntityList(initialOptions) {
2599
2649
  objectTypeSlug: initialOptions.objectTypeSlug,
2600
2650
  state: initialOptions.state,
2601
2651
  states: initialOptions.states,
2602
- ownerId: initialOptions.ownerId,
2603
2652
  search: initialOptions.search,
2604
2653
  sortBy: initialOptions.sortBy,
2605
2654
  sortOrder: initialOptions.sortOrder,
@@ -2611,7 +2660,6 @@ function useEntityList(initialOptions) {
2611
2660
  initialOptions.objectTypeSlug,
2612
2661
  initialOptions.state,
2613
2662
  initialOptions.states,
2614
- initialOptions.ownerId,
2615
2663
  initialOptions.search,
2616
2664
  initialOptions.sortBy,
2617
2665
  initialOptions.sortOrder,