@alquimia-ai/tools 2.3.0 → 2.5.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.
Files changed (79) hide show
  1. package/README.md +6 -0
  2. package/dist/actions/index.d.mts +2 -2
  3. package/dist/actions/index.d.ts +2 -2
  4. package/dist/actions/index.js +1 -1
  5. package/dist/actions/index.js.map +1 -1
  6. package/dist/actions/index.mjs +1 -1
  7. package/dist/actions/index.mjs.map +1 -1
  8. package/dist/actions-BjDPJdyA.d.mts +57 -0
  9. package/dist/actions-CP1d4Ye1.d.ts +57 -0
  10. package/dist/adapters/index.d.mts +2 -2
  11. package/dist/adapters/index.d.ts +2 -2
  12. package/dist/adapters/index.js.map +1 -1
  13. package/dist/genui/index.d.mts +3 -3
  14. package/dist/genui/index.d.ts +3 -3
  15. package/dist/genui/index.js +34 -2
  16. package/dist/genui/index.js.map +1 -1
  17. package/dist/genui/index.mjs +34 -2
  18. package/dist/genui/index.mjs.map +1 -1
  19. package/dist/hooks/index.d.mts +11 -10
  20. package/dist/hooks/index.d.ts +11 -10
  21. package/dist/hooks/index.js +81 -11
  22. package/dist/hooks/index.js.map +1 -1
  23. package/dist/hooks/index.mjs +81 -11
  24. package/dist/hooks/index.mjs.map +1 -1
  25. package/dist/next/index.js +19 -5
  26. package/dist/next/index.js.map +1 -1
  27. package/dist/next/index.mjs +19 -5
  28. package/dist/next/index.mjs.map +1 -1
  29. package/dist/providers/index.d.mts +4 -4
  30. package/dist/providers/index.d.ts +4 -4
  31. package/dist/providers/index.js +111 -110
  32. package/dist/providers/index.js.map +1 -1
  33. package/dist/providers/index.mjs +111 -110
  34. package/dist/providers/index.mjs.map +1 -1
  35. package/dist/{providers-BJTXCtI3.d.ts → providers-DiR9cgyo.d.mts} +8 -8
  36. package/dist/{providers-0Gi78uNQ.d.mts → providers-b5_yMyMo.d.ts} +8 -8
  37. package/dist/proxy.d.mts +4 -4
  38. package/dist/proxy.d.ts +4 -4
  39. package/dist/proxy.js +19 -5
  40. package/dist/proxy.js.map +1 -1
  41. package/dist/proxy.mjs +19 -5
  42. package/dist/proxy.mjs.map +1 -1
  43. package/dist/sdk/index.d.mts +4 -3
  44. package/dist/sdk/index.d.ts +4 -3
  45. package/dist/sdk/index.js +8 -2
  46. package/dist/sdk/index.js.map +1 -1
  47. package/dist/sdk/index.mjs +8 -2
  48. package/dist/sdk/index.mjs.map +1 -1
  49. package/dist/services/index.d.mts +3 -3
  50. package/dist/services/index.d.ts +3 -3
  51. package/dist/services/index.js.map +1 -1
  52. package/dist/services/index.mjs.map +1 -1
  53. package/dist/type-DqX3-9QS.d.mts +312 -0
  54. package/dist/type-xksRnBUW.d.ts +312 -0
  55. package/dist/types/index.d.mts +78 -302
  56. package/dist/types/index.d.ts +78 -302
  57. package/dist/types/index.js.map +1 -1
  58. package/dist/types/index.mjs.map +1 -1
  59. package/dist/types-C-6fgK1_.d.mts +111 -0
  60. package/dist/types-C-6fgK1_.d.ts +111 -0
  61. package/dist/{types-DnfWUE9V.d.mts → types-CMVbyEv8.d.mts} +3 -2
  62. package/dist/{types-DnfWUE9V.d.ts → types-CMVbyEv8.d.ts} +3 -2
  63. package/dist/utils/index.d.mts +2 -2
  64. package/dist/utils/index.d.ts +2 -2
  65. package/dist/utils/index.js +1 -1
  66. package/dist/utils/index.js.map +1 -1
  67. package/dist/utils/index.mjs +1 -1
  68. package/dist/utils/index.mjs.map +1 -1
  69. package/dist/worklog/index.d.mts +5 -2
  70. package/dist/worklog/index.d.ts +5 -2
  71. package/dist/worklog/index.js +3 -1
  72. package/dist/worklog/index.js.map +1 -1
  73. package/dist/worklog/index.mjs +3 -1
  74. package/dist/worklog/index.mjs.map +1 -1
  75. package/package.json +1 -1
  76. package/dist/actions-BebMyGqF.d.ts +0 -16
  77. package/dist/actions-Ca3ro-hX.d.mts +0 -16
  78. package/dist/types-Dvu9y4WM.d.mts +0 -53
  79. package/dist/types-Dvu9y4WM.d.ts +0 -53
@@ -172,6 +172,25 @@ function setPointer(model, pointer, value) {
172
172
  }
173
173
 
174
174
  // src/genui/actions.ts
175
+ var DISMISS_ACTION = "userDismissedSurface";
176
+ function buildDismissResult(surfaceId, userMessage) {
177
+ const said = typeof userMessage === "string" ? userMessage.trim() : "";
178
+ return {
179
+ action: DISMISS_ACTION,
180
+ surfaceId,
181
+ componentId: "",
182
+ data: {},
183
+ ...said ? { userMessage: said } : {}
184
+ };
185
+ }
186
+ function buildSurfaceResult(action) {
187
+ return {
188
+ action: action.action,
189
+ surfaceId: action.surfaceId,
190
+ componentId: action.componentId,
191
+ data: action.payload ?? {}
192
+ };
193
+ }
175
194
  function classifyAction(action) {
176
195
  return action.wantResponse === true ? "agent-bound" : "local";
177
196
  }
@@ -209,7 +228,15 @@ var surfaceShape = z3.object({
209
228
  });
210
229
  var UAX31_ID = /^[\p{XID_Start}_][\p{XID_Continue}]*$/u;
211
230
  function validateProps(node, def2) {
212
- const { id, component, children, child, binding, action, ...props } = node;
231
+ const {
232
+ id,
233
+ component: _component,
234
+ children: _children,
235
+ child: _child,
236
+ binding: _binding,
237
+ action: _action,
238
+ ...props
239
+ } = node;
213
240
  const parsed = def2.schema.safeParse(props);
214
241
  if (parsed.success) return { ok: true, value: parsed.data, errors: [] };
215
242
  return {
@@ -346,7 +373,9 @@ function buildGenuiClause(manifest, allowlist) {
346
373
  `Components: ${names.join(", ")}.`,
347
374
  `Style each component via the semantic vocabulary (never CSS, colors, or HTML): tone (${TONES.join("/")}), size (${SIZES.join("/")}), emphasis (low/medium/high), align (start/center/end), density (compact/comfortable), plus a component-specific variant where offered.`,
348
375
  "Data components MUST carry their data: Chart takes `data` (an array of row objects) + `series` (keys to plot) + `x` (the category key); Table takes `rows` (array of row objects) + `columns` ([{ key, header }] matching the row keys); List takes `items` (array); Stat takes `label`+`value`; KeyValue takes `data` (an object). Put the data inline on the component (or in dataModel referenced via `binding`).",
349
- "To collect input, add a Button with an action { name, wantResponse: true }; its result (the data model) is returned to you. A surface with no such button is display-only.",
376
+ "To collect input, add a Button with an action { name, wantResponse: true }. You get back { action, surfaceId, componentId, data } \u2014 `data` is the collected data model and `componentId` is the id of the component that was acted on. A surface with no such button is display-only.",
377
+ "When you render several options to choose from (a grid of cards, each with its own button), give every option component a MEANINGFUL id (e.g. flight-NH107, hotel-memmo-alfama): `componentId` tells you which one the user picked, so never ask them to repeat a choice they already made.",
378
+ 'The user may ignore an interactive surface and just type instead. You then receive action "userDismissedSurface" with their words in `userMessage` \u2014 treat it as their reply, answer it directly, and do not re-render the same surface or scold them for not using it.',
350
379
  "IMPORTANT: the rendered surface IS your reply \u2014 do NOT reproduce its content as text, markdown, or ASCII; a one-line intro at most.",
351
380
  "Prefer plain text for simple replies."
352
381
  ].join(" ");
@@ -3298,13 +3327,16 @@ export {
3298
3327
  ALIGNS,
3299
3328
  CORE_CATALOG_ID,
3300
3329
  DENSITIES,
3330
+ DISMISS_ACTION,
3301
3331
  EMPHASES,
3302
3332
  SIZES,
3303
3333
  TONES,
3304
3334
  UNKNOWN_COMPONENT,
3305
3335
  assertSafeActionName,
3336
+ buildDismissResult,
3306
3337
  buildGenuiClause,
3307
3338
  buildRenderUiSchema,
3339
+ buildSurfaceResult,
3308
3340
  classifyAction,
3309
3341
  coreCatalog,
3310
3342
  core_v1_catalog_default as coreCatalogJson,