@lunnoa/client 1.1.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.js CHANGED
@@ -456,10 +456,7 @@ var AgentChatClient = class {
456
456
  raw: true,
457
457
  signal: options.signal,
458
458
  headers: { Accept: "text/event-stream" },
459
- body: {
460
- messages: [uiMessage],
461
- ...options.chatMode ? { chatMode: options.chatMode } : {}
462
- }
459
+ body: messageTaskBody(uiMessage, options)
463
460
  }
464
461
  );
465
462
  return new AgentChatStream(response, { signal: options.signal });
@@ -498,6 +495,14 @@ var AgentChatClient = class {
498
495
  );
499
496
  }
500
497
  };
498
+ function messageTaskBody(message, options = {}) {
499
+ return {
500
+ messages: [message],
501
+ ...options.chatMode ? { chatMode: options.chatMode } : {},
502
+ ...options.data ? { data: options.data } : {},
503
+ ...options.piiResolution ? { piiResolution: options.piiResolution } : {}
504
+ };
505
+ }
501
506
  function generateMessageId() {
502
507
  const cryptoObj = globalThis.crypto;
503
508
  if (cryptoObj?.randomUUID) {
@@ -1026,7 +1031,6 @@ var EntitiesResource = class {
1026
1031
  objectTypeSlug: options.objectTypeSlug,
1027
1032
  state: options.state,
1028
1033
  states: options.states?.join(","),
1029
- ownerId: options.ownerId,
1030
1034
  search: options.search,
1031
1035
  sortBy: options.sortBy,
1032
1036
  sortOrder: options.sortOrder,
@@ -1622,10 +1626,11 @@ var QueueItemsResource = class {
1622
1626
  listRetryable(queueId) {
1623
1627
  return this.http.get(`/api/queues/${queueId}/items/retry`);
1624
1628
  }
1625
- /** Returns items with the given status. */
1626
- listByStatus(queueId, status) {
1629
+ /** Returns a page of items with the given status. */
1630
+ listByStatus(queueId, status, options = {}) {
1627
1631
  return this.http.get(
1628
- `/api/queues/${queueId}/items/status/${status}`
1632
+ `/api/queues/${queueId}/items/status/${status}`,
1633
+ { query: { limit: options.limit, offset: options.offset } }
1629
1634
  );
1630
1635
  }
1631
1636
  /** Looks an item up by the external ID your system supplied. */
@@ -1634,11 +1639,22 @@ var QueueItemsResource = class {
1634
1639
  `/api/queues/${queueId}/items/external/${externalId}`
1635
1640
  );
1636
1641
  }
1637
- /** Searches items in the queue. */
1638
- search(queueId, query) {
1639
- return this.http.get(`/api/queues/${queueId}/items/search`, {
1640
- query: { q: query }
1641
- });
1642
+ /**
1643
+ * Searches items by external id, item data, and metadata.
1644
+ * Returns one page, same shape as `list`.
1645
+ */
1646
+ search(queueId, query, options = {}) {
1647
+ return this.http.get(
1648
+ `/api/queues/${queueId}/items/search`,
1649
+ {
1650
+ query: {
1651
+ limit: options.limit,
1652
+ offset: options.offset,
1653
+ expansion: serializeCsv(options.expansion),
1654
+ filterBy: serializeFilterBy({ search: query })
1655
+ }
1656
+ }
1657
+ );
1642
1658
  }
1643
1659
  /** Returns per-status and per-priority counts for the queue. */
1644
1660
  stats(queueId) {
@@ -1674,10 +1690,21 @@ var QueueItemsResource = class {
1674
1690
  addError(queueId, itemId, error) {
1675
1691
  return this.http.post(
1676
1692
  `/api/queues/${queueId}/items/${itemId}/error`,
1677
- { body: error }
1693
+ {
1694
+ body: {
1695
+ error: error.error,
1696
+ errorDetails: serializeErrorDetails(error.errorDetails)
1697
+ }
1698
+ }
1678
1699
  );
1679
1700
  }
1680
1701
  };
1702
+ function serializeErrorDetails(value) {
1703
+ if (value === void 0) {
1704
+ return void 0;
1705
+ }
1706
+ return typeof value === "string" ? value : JSON.stringify(value);
1707
+ }
1681
1708
 
1682
1709
  // src/resources/queues.ts
1683
1710
  var QueuesResource = class {
@@ -1804,6 +1831,32 @@ var RunsResource = class {
1804
1831
  }
1805
1832
  };
1806
1833
 
1834
+ // src/resources/scorecards.ts
1835
+ var ScorecardsResource = class {
1836
+ constructor(http) {
1837
+ this.http = http;
1838
+ }
1839
+ http;
1840
+ /** Lists scorecards in the workspace. */
1841
+ list() {
1842
+ return this.http.get("/api/scorecards");
1843
+ }
1844
+ /** Returns a scorecard with objectives, measures, latest values and status. */
1845
+ get(scorecardId) {
1846
+ return this.http.get(`/api/scorecards/${scorecardId}`);
1847
+ }
1848
+ /**
1849
+ * Records a measure value. A value for the same period replaces the current
1850
+ * one; the old value is kept as superseded history.
1851
+ */
1852
+ recordValue(measureId, data) {
1853
+ return this.http.post(
1854
+ `/api/scorecards/measures/${measureId}/values`,
1855
+ { body: data }
1856
+ );
1857
+ }
1858
+ };
1859
+
1807
1860
  // src/resources/tasks.ts
1808
1861
  var TasksResource = class {
1809
1862
  constructor(http) {
@@ -1854,12 +1907,7 @@ var TasksResource = class {
1854
1907
  } : message;
1855
1908
  return this.http.post(
1856
1909
  `/api/agents/${agentId}/tasks/${taskId}/message`,
1857
- {
1858
- body: {
1859
- messages: [uiMessage],
1860
- ...options.chatMode ? { chatMode: options.chatMode } : {}
1861
- }
1862
- }
1910
+ { body: messageTaskBody(uiMessage, options) }
1863
1911
  );
1864
1912
  }
1865
1913
  };
@@ -2042,6 +2090,7 @@ var LunnoaClient = class {
2042
2090
  queues;
2043
2091
  queueItems;
2044
2092
  variables;
2093
+ scorecards;
2045
2094
  connections;
2046
2095
  projects;
2047
2096
  workflowApps;
@@ -2064,6 +2113,7 @@ var LunnoaClient = class {
2064
2113
  this.queues = new QueuesResource(this.http);
2065
2114
  this.queueItems = new QueueItemsResource(this.http);
2066
2115
  this.variables = new VariablesResource(this.http);
2116
+ this.scorecards = new ScorecardsResource(this.http);
2067
2117
  this.connections = new ConnectionsResource(this.http);
2068
2118
  this.projects = new ProjectsResource(this.http);
2069
2119
  this.discovery = new DiscoveryResource(this.http);
@@ -2597,7 +2647,6 @@ function useEntityList(initialOptions) {
2597
2647
  objectTypeSlug: initialOptions.objectTypeSlug,
2598
2648
  state: initialOptions.state,
2599
2649
  states: initialOptions.states,
2600
- ownerId: initialOptions.ownerId,
2601
2650
  search: initialOptions.search,
2602
2651
  sortBy: initialOptions.sortBy,
2603
2652
  sortOrder: initialOptions.sortOrder,
@@ -2609,7 +2658,6 @@ function useEntityList(initialOptions) {
2609
2658
  initialOptions.objectTypeSlug,
2610
2659
  initialOptions.state,
2611
2660
  initialOptions.states,
2612
- initialOptions.ownerId,
2613
2661
  initialOptions.search,
2614
2662
  initialOptions.sortBy,
2615
2663
  initialOptions.sortOrder,