@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/index.cjs CHANGED
@@ -426,10 +426,7 @@ var AgentChatClient = class {
426
426
  raw: true,
427
427
  signal: options.signal,
428
428
  headers: { Accept: "text/event-stream" },
429
- body: {
430
- messages: [uiMessage],
431
- ...options.chatMode ? { chatMode: options.chatMode } : {}
432
- }
429
+ body: messageTaskBody(uiMessage, options)
433
430
  }
434
431
  );
435
432
  return new AgentChatStream(response, { signal: options.signal });
@@ -468,6 +465,14 @@ var AgentChatClient = class {
468
465
  );
469
466
  }
470
467
  };
468
+ function messageTaskBody(message, options = {}) {
469
+ return {
470
+ messages: [message],
471
+ ...options.chatMode ? { chatMode: options.chatMode } : {},
472
+ ...options.data ? { data: options.data } : {},
473
+ ...options.piiResolution ? { piiResolution: options.piiResolution } : {}
474
+ };
475
+ }
471
476
  function generateMessageId() {
472
477
  const cryptoObj = globalThis.crypto;
473
478
  if (cryptoObj?.randomUUID) {
@@ -1047,7 +1052,6 @@ var EntitiesResource = class {
1047
1052
  objectTypeSlug: options.objectTypeSlug,
1048
1053
  state: options.state,
1049
1054
  states: options.states?.join(","),
1050
- ownerId: options.ownerId,
1051
1055
  search: options.search,
1052
1056
  sortBy: options.sortBy,
1053
1057
  sortOrder: options.sortOrder,
@@ -1643,10 +1647,11 @@ var QueueItemsResource = class {
1643
1647
  listRetryable(queueId) {
1644
1648
  return this.http.get(`/api/queues/${queueId}/items/retry`);
1645
1649
  }
1646
- /** Returns items with the given status. */
1647
- listByStatus(queueId, status) {
1650
+ /** Returns a page of items with the given status. */
1651
+ listByStatus(queueId, status, options = {}) {
1648
1652
  return this.http.get(
1649
- `/api/queues/${queueId}/items/status/${status}`
1653
+ `/api/queues/${queueId}/items/status/${status}`,
1654
+ { query: { limit: options.limit, offset: options.offset } }
1650
1655
  );
1651
1656
  }
1652
1657
  /** Looks an item up by the external ID your system supplied. */
@@ -1655,11 +1660,22 @@ var QueueItemsResource = class {
1655
1660
  `/api/queues/${queueId}/items/external/${externalId}`
1656
1661
  );
1657
1662
  }
1658
- /** Searches items in the queue. */
1659
- search(queueId, query) {
1660
- return this.http.get(`/api/queues/${queueId}/items/search`, {
1661
- query: { q: query }
1662
- });
1663
+ /**
1664
+ * Searches items by external id, item data, and metadata.
1665
+ * Returns one page, same shape as `list`.
1666
+ */
1667
+ search(queueId, query, options = {}) {
1668
+ return this.http.get(
1669
+ `/api/queues/${queueId}/items/search`,
1670
+ {
1671
+ query: {
1672
+ limit: options.limit,
1673
+ offset: options.offset,
1674
+ expansion: serializeCsv(options.expansion),
1675
+ filterBy: serializeFilterBy({ search: query })
1676
+ }
1677
+ }
1678
+ );
1663
1679
  }
1664
1680
  /** Returns per-status and per-priority counts for the queue. */
1665
1681
  stats(queueId) {
@@ -1695,10 +1711,21 @@ var QueueItemsResource = class {
1695
1711
  addError(queueId, itemId, error) {
1696
1712
  return this.http.post(
1697
1713
  `/api/queues/${queueId}/items/${itemId}/error`,
1698
- { body: error }
1714
+ {
1715
+ body: {
1716
+ error: error.error,
1717
+ errorDetails: serializeErrorDetails(error.errorDetails)
1718
+ }
1719
+ }
1699
1720
  );
1700
1721
  }
1701
1722
  };
1723
+ function serializeErrorDetails(value) {
1724
+ if (value === void 0) {
1725
+ return void 0;
1726
+ }
1727
+ return typeof value === "string" ? value : JSON.stringify(value);
1728
+ }
1702
1729
 
1703
1730
  // src/resources/queues.ts
1704
1731
  var QueuesResource = class {
@@ -1825,6 +1852,32 @@ var RunsResource = class {
1825
1852
  }
1826
1853
  };
1827
1854
 
1855
+ // src/resources/scorecards.ts
1856
+ var ScorecardsResource = class {
1857
+ constructor(http) {
1858
+ this.http = http;
1859
+ }
1860
+ http;
1861
+ /** Lists scorecards in the workspace. */
1862
+ list() {
1863
+ return this.http.get("/api/scorecards");
1864
+ }
1865
+ /** Returns a scorecard with objectives, measures, latest values and status. */
1866
+ get(scorecardId) {
1867
+ return this.http.get(`/api/scorecards/${scorecardId}`);
1868
+ }
1869
+ /**
1870
+ * Records a measure value. A value for the same period replaces the current
1871
+ * one; the old value is kept as superseded history.
1872
+ */
1873
+ recordValue(measureId, data) {
1874
+ return this.http.post(
1875
+ `/api/scorecards/measures/${measureId}/values`,
1876
+ { body: data }
1877
+ );
1878
+ }
1879
+ };
1880
+
1828
1881
  // src/resources/tasks.ts
1829
1882
  var TasksResource = class {
1830
1883
  constructor(http) {
@@ -1875,12 +1928,7 @@ var TasksResource = class {
1875
1928
  } : message;
1876
1929
  return this.http.post(
1877
1930
  `/api/agents/${agentId}/tasks/${taskId}/message`,
1878
- {
1879
- body: {
1880
- messages: [uiMessage],
1881
- ...options.chatMode ? { chatMode: options.chatMode } : {}
1882
- }
1883
- }
1931
+ { body: messageTaskBody(uiMessage, options) }
1884
1932
  );
1885
1933
  }
1886
1934
  };
@@ -2063,6 +2111,7 @@ var LunnoaClient = class {
2063
2111
  queues;
2064
2112
  queueItems;
2065
2113
  variables;
2114
+ scorecards;
2066
2115
  connections;
2067
2116
  projects;
2068
2117
  workflowApps;
@@ -2085,6 +2134,7 @@ var LunnoaClient = class {
2085
2134
  this.queues = new QueuesResource(this.http);
2086
2135
  this.queueItems = new QueueItemsResource(this.http);
2087
2136
  this.variables = new VariablesResource(this.http);
2137
+ this.scorecards = new ScorecardsResource(this.http);
2088
2138
  this.connections = new ConnectionsResource(this.http);
2089
2139
  this.projects = new ProjectsResource(this.http);
2090
2140
  this.discovery = new DiscoveryResource(this.http);
@@ -2186,6 +2236,7 @@ exports.ProjectsResource = ProjectsResource;
2186
2236
  exports.QueueItemsResource = QueueItemsResource;
2187
2237
  exports.QueuesResource = QueuesResource;
2188
2238
  exports.RunsResource = RunsResource;
2239
+ exports.ScorecardsResource = ScorecardsResource;
2189
2240
  exports.SsoAuthResource = SsoAuthResource;
2190
2241
  exports.TasksResource = TasksResource;
2191
2242
  exports.VariablesResource = VariablesResource;