@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.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,
@@ -1059,7 +1063,7 @@ var EntityTypesResource = class {
1059
1063
  }
1060
1064
  http;
1061
1065
  /**
1062
- * Lists entity types in the workspace. Request
1066
+ * Lists entity types granted to the API key's workspace. Request
1063
1067
  * `expansion: ['attributeSchema', 'stateSchema']` for the field and state
1064
1068
  * machine definitions the codegen CLI builds types from.
1065
1069
  */
@@ -1084,7 +1088,9 @@ var EntityTypesResource = class {
1084
1088
  });
1085
1089
  }
1086
1090
  /**
1087
- * Creates or updates an entity type by workspace-scoped slug.
1091
+ * Creates or updates an entity type by deployment-wide slug.
1092
+ * A new slug is granted to the API key's workspace. A slug already shared
1093
+ * with another workspace is rejected unless the key belongs to a platform admin.
1088
1094
  * Prefer the CLI (`npx @lunnoa/client entity-types deploy`) for happy-path deploy.
1089
1095
  */
1090
1096
  upsertBySlug(definition) {
@@ -1622,10 +1628,11 @@ var QueueItemsResource = class {
1622
1628
  listRetryable(queueId) {
1623
1629
  return this.http.get(`/api/queues/${queueId}/items/retry`);
1624
1630
  }
1625
- /** Returns items with the given status. */
1626
- listByStatus(queueId, status) {
1631
+ /** Returns a page of items with the given status. */
1632
+ listByStatus(queueId, status, options = {}) {
1627
1633
  return this.http.get(
1628
- `/api/queues/${queueId}/items/status/${status}`
1634
+ `/api/queues/${queueId}/items/status/${status}`,
1635
+ { query: { limit: options.limit, offset: options.offset } }
1629
1636
  );
1630
1637
  }
1631
1638
  /** Looks an item up by the external ID your system supplied. */
@@ -1634,11 +1641,22 @@ var QueueItemsResource = class {
1634
1641
  `/api/queues/${queueId}/items/external/${externalId}`
1635
1642
  );
1636
1643
  }
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
- });
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
+ );
1642
1660
  }
1643
1661
  /** Returns per-status and per-priority counts for the queue. */
1644
1662
  stats(queueId) {
@@ -1674,10 +1692,21 @@ var QueueItemsResource = class {
1674
1692
  addError(queueId, itemId, error) {
1675
1693
  return this.http.post(
1676
1694
  `/api/queues/${queueId}/items/${itemId}/error`,
1677
- { body: error }
1695
+ {
1696
+ body: {
1697
+ error: error.error,
1698
+ errorDetails: serializeErrorDetails(error.errorDetails)
1699
+ }
1700
+ }
1678
1701
  );
1679
1702
  }
1680
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
+ }
1681
1710
 
1682
1711
  // src/resources/queues.ts
1683
1712
  var QueuesResource = class {
@@ -1804,6 +1833,32 @@ var RunsResource = class {
1804
1833
  }
1805
1834
  };
1806
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
+
1807
1862
  // src/resources/tasks.ts
1808
1863
  var TasksResource = class {
1809
1864
  constructor(http) {
@@ -1854,12 +1909,7 @@ var TasksResource = class {
1854
1909
  } : message;
1855
1910
  return this.http.post(
1856
1911
  `/api/agents/${agentId}/tasks/${taskId}/message`,
1857
- {
1858
- body: {
1859
- messages: [uiMessage],
1860
- ...options.chatMode ? { chatMode: options.chatMode } : {}
1861
- }
1862
- }
1912
+ { body: messageTaskBody(uiMessage, options) }
1863
1913
  );
1864
1914
  }
1865
1915
  };
@@ -2042,6 +2092,7 @@ var LunnoaClient = class {
2042
2092
  queues;
2043
2093
  queueItems;
2044
2094
  variables;
2095
+ scorecards;
2045
2096
  connections;
2046
2097
  projects;
2047
2098
  workflowApps;
@@ -2064,6 +2115,7 @@ var LunnoaClient = class {
2064
2115
  this.queues = new QueuesResource(this.http);
2065
2116
  this.queueItems = new QueueItemsResource(this.http);
2066
2117
  this.variables = new VariablesResource(this.http);
2118
+ this.scorecards = new ScorecardsResource(this.http);
2067
2119
  this.connections = new ConnectionsResource(this.http);
2068
2120
  this.projects = new ProjectsResource(this.http);
2069
2121
  this.discovery = new DiscoveryResource(this.http);
@@ -2597,7 +2649,6 @@ function useEntityList(initialOptions) {
2597
2649
  objectTypeSlug: initialOptions.objectTypeSlug,
2598
2650
  state: initialOptions.state,
2599
2651
  states: initialOptions.states,
2600
- ownerId: initialOptions.ownerId,
2601
2652
  search: initialOptions.search,
2602
2653
  sortBy: initialOptions.sortBy,
2603
2654
  sortOrder: initialOptions.sortOrder,
@@ -2609,7 +2660,6 @@ function useEntityList(initialOptions) {
2609
2660
  initialOptions.objectTypeSlug,
2610
2661
  initialOptions.state,
2611
2662
  initialOptions.states,
2612
- initialOptions.ownerId,
2613
2663
  initialOptions.search,
2614
2664
  initialOptions.sortBy,
2615
2665
  initialOptions.sortOrder,