llmz 0.8.0 → 0.9.1

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 (68) hide show
  1. package/README.md +45 -11
  2. package/dist/chat.d.ts +6 -6
  3. package/dist/{common-DdArNQhl.cjs → common-DJkSpeqw.cjs} +239 -22
  4. package/dist/{common-pgJjFu2Y.js → common-DuEhn6u3.js} +234 -23
  5. package/dist/compiler/plugins/variable-extraction.d.ts +1 -7
  6. package/dist/{compiler-C-OI9sim.cjs → compiler-BJJUmNS9.cjs} +34 -68
  7. package/dist/{compiler-CW1VjQsn.js → compiler-BPl-5CXh.js} +34 -68
  8. package/dist/{component-BXS8vAwO.cjs → component-CPKXe6Ca.cjs} +2 -2
  9. package/dist/{component-Dq7ZLdvy.js → component-DGG7d_Mz.js} +1 -1
  10. package/dist/component.default.d.ts +10 -0
  11. package/dist/context.d.ts +4 -8
  12. package/dist/{custom-client-HkM1Sdzv.cjs → custom-client-B_o56CB4.cjs} +22 -19
  13. package/dist/{custom-client-2V9lmzUf.js → custom-client-C-nDKG37.js} +17 -14
  14. package/dist/{dual-modes-Cb7ThvoV.cjs → dual-modes-BNHlj2qM.cjs} +1252 -1181
  15. package/dist/{dual-modes-Cy0_W4O2.js → dual-modes-BNIiNLrR.js} +1257 -1180
  16. package/dist/example-format.d.ts +8 -0
  17. package/dist/{execute-COIHOIKR.cjs → execute-0bvqakr7.cjs} +91 -99
  18. package/dist/{execute-Aw4cbIx-.js → execute-CWFIL5ny.js} +91 -99
  19. package/dist/{exit-DUM96DN1.cjs → exit-CGLXI0BH.cjs} +2 -2
  20. package/dist/index.cjs +265 -22
  21. package/dist/index.js +258 -15
  22. package/dist/index.workerd.js +8565 -8005
  23. package/dist/inspect.d.ts +2 -0
  24. package/dist/isPlainObject-CSxXVKCk.cjs +56 -0
  25. package/dist/isPlainObject-D39AzPO2.js +51 -0
  26. package/dist/{jsx-D5Y2cPo-.cjs → jsx-BJ6GWXI2.cjs} +3 -57
  27. package/dist/{jsx-B0iYyvfr.js → jsx-CIgdGGVs.js} +2 -50
  28. package/dist/message-stream/instructions.d.ts +8 -0
  29. package/dist/message-stream/parser.d.ts +6 -0
  30. package/dist/message-stream/response-parser.d.ts +24 -0
  31. package/dist/message-stream/response-parser.test.d.ts +1 -0
  32. package/dist/message-stream/types.d.ts +3 -2
  33. package/dist/prompts/adherence.test.d.ts +1 -0
  34. package/dist/prompts/catalogue-examples.test.d.ts +1 -0
  35. package/dist/prompts/chat-mode/protocol.d.ts +2 -0
  36. package/dist/prompts/chat-mode/system.d.ts +1 -1
  37. package/dist/prompts/chat-mode/user.d.ts +1 -1
  38. package/dist/prompts/code-examples.d.ts +2 -0
  39. package/dist/prompts/code-examples.test.d.ts +1 -0
  40. package/dist/prompts/common.d.ts +2 -1
  41. package/dist/prompts/concrete-patterns.test.d.ts +1 -0
  42. package/dist/prompts/long-search.test.d.ts +1 -0
  43. package/dist/prompts/prompt.d.ts +5 -2
  44. package/dist/prompts/protocol-basics.d.ts +5 -0
  45. package/dist/prompts/protocol-simple.test.d.ts +1 -0
  46. package/dist/prompts/protocol.d.ts +13 -0
  47. package/dist/prompts/sections.test.d.ts +1 -0
  48. package/dist/prompts/worker-mode/protocol.d.ts +2 -0
  49. package/dist/prompts/worker-mode/system.d.ts +1 -1
  50. package/dist/prompts/worker-mode/user.d.ts +1 -1
  51. package/dist/runtime/citations.test.d.ts +1 -0
  52. package/dist/runtime/fixtures/long-search.d.ts +19 -0
  53. package/dist/runtime/fixtures/protocol-languages.d.ts +74 -0
  54. package/dist/runtime/fixtures/qwen-protocol-failures.d.ts +29 -0
  55. package/dist/runtime/generate.d.ts +2 -9
  56. package/dist/runtime/generate.test.d.ts +1 -0
  57. package/dist/runtime/protocol-adherence.test.d.ts +1 -0
  58. package/dist/runtime/types.d.ts +4 -7
  59. package/dist/{tool-Bv8N4IPj.js → tool-B6Pmuk6K.js} +35 -49
  60. package/dist/{tool-Dy6AJpJH.cjs → tool-BLTrA-sL.cjs} +38 -52
  61. package/dist/tool.d.ts +5 -3
  62. package/dist/{truncator-DZqEqnpD.js → truncator-CD7QtE84.js} +11 -6
  63. package/dist/{truncator-CLkouTCO.cjs → truncator-DmCu9M4m.cjs} +13 -8
  64. package/dist/{typings-3lsqCbkn.cjs → typings-DXJMu59O.cjs} +2 -2
  65. package/dist/{utils-3ESwP3yg.cjs → utils-DGQ4sRke.cjs} +1 -1
  66. package/dist/{vm-BLsHw1da.js → vm-Cn3jvZ00.js} +109 -53
  67. package/dist/{vm-D6s1zF6M.cjs → vm-X0uTj5Aa.cjs} +109 -53
  68. package/package.json +1 -1
@@ -29,6 +29,11 @@ export declare const DefaultComponents: {
29
29
  generation: {
30
30
  usage: string;
31
31
  examples: ({
32
+ props: {
33
+ action: string;
34
+ label: string;
35
+ };
36
+ }[] | {
32
37
  props: {
33
38
  action: string;
34
39
  label: string;
@@ -194,6 +199,11 @@ export declare const DefaultComponents: {
194
199
  generation: {
195
200
  usage: string;
196
201
  examples: ({
202
+ props: {
203
+ action: string;
204
+ label: string;
205
+ };
206
+ }[] | {
197
207
  props: {
198
208
  action: string;
199
209
  label: string;
package/dist/context.d.ts CHANGED
@@ -579,14 +579,10 @@ export declare class Context implements Serializable<Context.JSON> {
579
579
  */
580
580
  maxTimeToFirstToken?: number;
581
581
  /**
582
- * Allow Cognitive to restart a failed stream on another model. With fallback
583
- * enabled, there is no buffered delivery and no final delivery queue: delta
584
- * text and completed Chat.handler sends stream immediately during generation.
585
- * A reset-only delta (restart: true) on Chat.onMessageDelta invalidates ALL
586
- * current-iteration messages, including completed sends — consumers must
587
- * retract/replace them, which is unsafe for irreversible external transports.
588
- * Only TOOL/CODE execution waits for a successful stream. Streaming-only;
589
- * defaults to false, which leaves progressive sending unchanged.
582
+ * Allow Cognitive to restart a failed stream on another model. Previews remain
583
+ * live and are retracted with a restart delta before replacement output.
584
+ * Completed sends and code always wait for a valid response and successful
585
+ * transport. Streaming-only; defaults to false.
590
586
  */
591
587
  midStreamFallback?: boolean;
592
588
  /**
@@ -1,14 +1,14 @@
1
- const require_dual_modes = require("./dual-modes-Cb7ThvoV.cjs");
1
+ const require_dual_modes = require("./dual-modes-BNHlj2qM.cjs");
2
2
  const require__overArg = require("./_overArg-C5Hy7oCi.cjs");
3
3
  const require__baseIteratee = require("./_baseIteratee-CF4qP2a8.cjs");
4
- const require_utils = require("./utils-3ESwP3yg.cjs");
4
+ const require_utils = require("./utils-DGQ4sRke.cjs");
5
5
  const require__getPrototype = require("./_getPrototype-DQDlNVVM.cjs");
6
- const require_jsx = require("./jsx-D5Y2cPo-.cjs");
7
- const require_component = require("./component-BXS8vAwO.cjs");
8
- const require_tool = require("./tool-Dy6AJpJH.cjs");
6
+ const require_isPlainObject = require("./isPlainObject-CSxXVKCk.cjs");
7
+ const require_tool = require("./tool-BLTrA-sL.cjs");
9
8
  const require_errors = require("./errors-C962uJdS.cjs");
10
- const require_exit = require("./exit-DUM96DN1.cjs");
11
- const require_truncator = require("./truncator-CLkouTCO.cjs");
9
+ const require_exit = require("./exit-CGLXI0BH.cjs");
10
+ const require_component = require("./component-CPKXe6Ca.cjs");
11
+ const require_truncator = require("./truncator-DmCu9M4m.cjs");
12
12
  let _bpinternal_zui = require("@bpinternal/zui");
13
13
  let ulid = require("ulid");
14
14
  //#region ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayEach.js
@@ -539,7 +539,7 @@ function baseUnset(object, path) {
539
539
  * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
540
540
  */
541
541
  function customOmitClone(value) {
542
- return require_jsx.isPlainObject(value) ? void 0 : value;
542
+ return require_isPlainObject.isPlainObject(value) ? void 0 : value;
543
543
  }
544
544
  //#endregion
545
545
  //#region ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/omit.js
@@ -2304,14 +2304,10 @@ var Context = class {
2304
2304
  */
2305
2305
  maxTimeToFirstToken;
2306
2306
  /**
2307
- * Allow Cognitive to restart a failed stream on another model. With fallback
2308
- * enabled, there is no buffered delivery and no final delivery queue: delta
2309
- * text and completed Chat.handler sends stream immediately during generation.
2310
- * A reset-only delta (restart: true) on Chat.onMessageDelta invalidates ALL
2311
- * current-iteration messages, including completed sends — consumers must
2312
- * retract/replace them, which is unsafe for irreversible external transports.
2313
- * Only TOOL/CODE execution waits for a successful stream. Streaming-only;
2314
- * defaults to false, which leaves progressive sending unchanged.
2307
+ * Allow Cognitive to restart a failed stream on another model. Previews remain
2308
+ * live and are retracted with a restart delta before replacement output.
2309
+ * Completed sends and code always wait for a valid response and successful
2310
+ * transport. Streaming-only; defaults to false.
2315
2311
  */
2316
2312
  midStreamFallback;
2317
2313
  /**
@@ -2353,9 +2349,9 @@ var Context = class {
2353
2349
  const variables = {};
2354
2350
  if ((lastIteration === null || lastIteration === void 0 ? void 0 : lastIteration.status.type) === "thinking_requested") {
2355
2351
  const lastThinkingVariables = lastIteration.status.thinking_requested.variables;
2356
- if (require_jsx.isPlainObject(lastThinkingVariables)) Object.assign(variables, cloneDeep(lastThinkingVariables));
2352
+ if (require_isPlainObject.isPlainObject(lastThinkingVariables)) Object.assign(variables, cloneDeep(lastThinkingVariables));
2357
2353
  }
2358
- if (require_jsx.isPlainObject(lastIteration === null || lastIteration === void 0 ? void 0 : lastIteration.variables)) Object.assign(variables, cloneDeep((lastIteration === null || lastIteration === void 0 ? void 0 : lastIteration.variables) ?? {}));
2354
+ if (require_isPlainObject.isPlainObject(lastIteration === null || lastIteration === void 0 ? void 0 : lastIteration.variables)) Object.assign(variables, cloneDeep((lastIteration === null || lastIteration === void 0 ? void 0 : lastIteration.variables) ?? {}));
2359
2355
  if (((_this$snapshot = this.snapshot) === null || _this$snapshot === void 0 ? void 0 : _this$snapshot.status.type) === "resolved") {
2360
2356
  for (const v of this.snapshot.variables) if (!v.truncated && v.value !== void 0) variables[v.name] = v.value;
2361
2357
  }
@@ -2479,7 +2475,14 @@ var Context = class {
2479
2475
  await this.version.getInvalidCodeMessage({
2480
2476
  isChatEnabled: parameters.components.length > 0,
2481
2477
  code: lastIteration.next ? `■next=${lastIteration.next.name} ${JSON.stringify(lastIteration.next.props)}` : lastIteration.code ?? "// No code generated",
2482
- message: `Invalid ■next block (${lastIteration.status.exit_error.exit}): ${lastIteration.status.exit_error.message}`
2478
+ message: `Invalid ■next block (${lastIteration.status.exit_error.exit}): ${lastIteration.status.exit_error.message}`,
2479
+ variables: lastIteration.variables,
2480
+ toolCalls: lastIteration.traces.filter((trace) => trace.type === "tool_call").map((trace) => ({
2481
+ tool: trace.tool_name,
2482
+ input: trace.input,
2483
+ success: trace.success,
2484
+ ...trace.success ? { output: trace.output } : { error: require_utils.getErrorMessage(trace.error) }
2485
+ }))
2483
2486
  })
2484
2487
  ]);
2485
2488
  }
@@ -1,14 +1,14 @@
1
- import { d as baseCreate, i as inspect, l as flatRest, r as extractType, t as DualModePrompt, u as copyArray } from "./dual-modes-Cy0_W4O2.js";
1
+ import { c as baseCreate, i as inspect, o as flatRest, r as extractType, s as copyArray, t as DualModePrompt } from "./dual-modes-BNIiNLrR.js";
2
2
  import { a as Symbol, n as isArray, o as root, r as isObjectLike } from "./_overArg-CRYbj1NH.js";
3
3
  import { D as isBuffer, E as baseUnary, M as baseAssignValue, R as isObject, T as nodeUtil, _ as baseGet, c as _getTag_default, f as getSymbols, h as Stack, k as isPrototype, s as Uint8Array, u as getAllKeys, v as toKey, x as keys, y as castPath, z as arrayMap } from "./_baseIteratee-P_firB7b.js";
4
4
  import { _ as getSymbolsIn, b as keysIn, g as getAllKeysIn, i as getErrorMessage, o as getTokenizer, x as assignValue, y as baseSlice } from "./utils-UBeAFeEI.js";
5
5
  import { t as getPrototype } from "./_getPrototype-CG7Dxrrz.js";
6
- import { a as isPlainObject } from "./jsx-B0iYyvfr.js";
7
- import { n as assertValidComponent } from "./component-Dq7ZLdvy.js";
8
- import { t as Tool } from "./tool-Bv8N4IPj.js";
6
+ import { t as isPlainObject } from "./isPlainObject-D39AzPO2.js";
7
+ import { t as Tool } from "./tool-B6Pmuk6K.js";
9
8
  import { l as ThinkSignal, o as LoopExceededError } from "./errors-Cg1G0Awu.js";
10
9
  import { t as Exit } from "./exit-CDdxDBRT.js";
11
- import { i as wrapContent, t as stripTruncationTags } from "./truncator-DZqEqnpD.js";
10
+ import { n as assertValidComponent } from "./component-DGG7d_Mz.js";
11
+ import { i as wrapContent, t as stripTruncationTags } from "./truncator-CD7QtE84.js";
12
12
  import { z } from "@bpinternal/zui";
13
13
  import { ulid } from "ulid";
14
14
  //#region ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayEach.js
@@ -2304,14 +2304,10 @@ var Context = class {
2304
2304
  */
2305
2305
  maxTimeToFirstToken;
2306
2306
  /**
2307
- * Allow Cognitive to restart a failed stream on another model. With fallback
2308
- * enabled, there is no buffered delivery and no final delivery queue: delta
2309
- * text and completed Chat.handler sends stream immediately during generation.
2310
- * A reset-only delta (restart: true) on Chat.onMessageDelta invalidates ALL
2311
- * current-iteration messages, including completed sends — consumers must
2312
- * retract/replace them, which is unsafe for irreversible external transports.
2313
- * Only TOOL/CODE execution waits for a successful stream. Streaming-only;
2314
- * defaults to false, which leaves progressive sending unchanged.
2307
+ * Allow Cognitive to restart a failed stream on another model. Previews remain
2308
+ * live and are retracted with a restart delta before replacement output.
2309
+ * Completed sends and code always wait for a valid response and successful
2310
+ * transport. Streaming-only; defaults to false.
2315
2311
  */
2316
2312
  midStreamFallback;
2317
2313
  /**
@@ -2479,7 +2475,14 @@ var Context = class {
2479
2475
  await this.version.getInvalidCodeMessage({
2480
2476
  isChatEnabled: parameters.components.length > 0,
2481
2477
  code: lastIteration.next ? `■next=${lastIteration.next.name} ${JSON.stringify(lastIteration.next.props)}` : lastIteration.code ?? "// No code generated",
2482
- message: `Invalid ■next block (${lastIteration.status.exit_error.exit}): ${lastIteration.status.exit_error.message}`
2478
+ message: `Invalid ■next block (${lastIteration.status.exit_error.exit}): ${lastIteration.status.exit_error.message}`,
2479
+ variables: lastIteration.variables,
2480
+ toolCalls: lastIteration.traces.filter((trace) => trace.type === "tool_call").map((trace) => ({
2481
+ tool: trace.tool_name,
2482
+ input: trace.input,
2483
+ success: trace.success,
2484
+ ...trace.success ? { output: trace.output } : { error: getErrorMessage(trace.error) }
2485
+ }))
2483
2486
  })
2484
2487
  ]);
2485
2488
  }