@n1k1t/pipelain 0.2.1 → 0.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.
Files changed (152) hide show
  1. package/lib/src/index.d.ts +4 -0
  2. package/lib/src/index.d.ts.map +1 -1
  3. package/lib/src/index.js +4 -0
  4. package/lib/src/index.js.map +1 -1
  5. package/lib/src/models/content/factory.d.ts +3 -3
  6. package/lib/src/models/content/factory.d.ts.map +1 -1
  7. package/lib/src/models/content/factory.js +3 -3
  8. package/lib/src/models/content/factory.js.map +1 -1
  9. package/lib/src/models/content/index.d.ts +1 -0
  10. package/lib/src/models/content/index.d.ts.map +1 -1
  11. package/lib/src/models/content/index.js +1 -0
  12. package/lib/src/models/content/index.js.map +1 -1
  13. package/lib/src/models/content/kinds/article.d.ts +2 -2
  14. package/lib/src/models/content/kinds/article.d.ts.map +1 -1
  15. package/lib/src/models/content/kinds/article.js.map +1 -1
  16. package/lib/src/models/content/kinds/attachment.d.ts +3 -4
  17. package/lib/src/models/content/kinds/attachment.d.ts.map +1 -1
  18. package/lib/src/models/content/kinds/attachment.js +2 -6
  19. package/lib/src/models/content/kinds/attachment.js.map +1 -1
  20. package/lib/src/models/content/kinds/rules.d.ts.map +1 -1
  21. package/lib/src/models/content/kinds/rules.js.map +1 -1
  22. package/lib/src/models/content/kinds/sources.d.ts +1 -1
  23. package/lib/src/models/content/kinds/sources.d.ts.map +1 -1
  24. package/lib/src/models/content/kinds/sources.js +1 -1
  25. package/lib/src/models/content/kinds/sources.js.map +1 -1
  26. package/lib/src/models/content/kinds/tasks.d.ts.map +1 -1
  27. package/lib/src/models/content/kinds/tasks.js.map +1 -1
  28. package/lib/src/models/content/types.d.ts +12 -0
  29. package/lib/src/models/content/types.d.ts.map +1 -0
  30. package/lib/src/models/content/types.js +3 -0
  31. package/lib/src/models/content/types.js.map +1 -0
  32. package/lib/src/models/llm/mcp.d.ts +3 -0
  33. package/lib/src/models/llm/mcp.d.ts.map +1 -1
  34. package/lib/src/models/llm/mcp.js +21 -0
  35. package/lib/src/models/llm/mcp.js.map +1 -1
  36. package/lib/src/models/llm/providers/anthropic.d.ts.map +1 -1
  37. package/lib/src/models/llm/providers/anthropic.js +2 -1
  38. package/lib/src/models/llm/providers/anthropic.js.map +1 -1
  39. package/lib/src/models/llm/providers/google.d.ts.map +1 -1
  40. package/lib/src/models/llm/providers/google.js +2 -1
  41. package/lib/src/models/llm/providers/google.js.map +1 -1
  42. package/lib/src/models/llm/providers/mistral.d.ts.map +1 -1
  43. package/lib/src/models/llm/providers/mistral.js +2 -1
  44. package/lib/src/models/llm/providers/mistral.js.map +1 -1
  45. package/lib/src/models/llm/providers/model.d.ts +1 -1
  46. package/lib/src/models/llm/providers/model.d.ts.map +1 -1
  47. package/lib/src/models/llm/providers/openai.d.ts.map +1 -1
  48. package/lib/src/models/llm/providers/openai.js +2 -1
  49. package/lib/src/models/llm/providers/openai.js.map +1 -1
  50. package/lib/src/models/llm/providers/proxy.d.ts.map +1 -1
  51. package/lib/src/models/llm/providers/proxy.js +2 -1
  52. package/lib/src/models/llm/providers/proxy.js.map +1 -1
  53. package/lib/src/models/llm/tools/attachment.d.ts +10 -0
  54. package/lib/src/models/llm/tools/attachment.d.ts.map +1 -0
  55. package/lib/src/models/llm/tools/attachment.js +29 -0
  56. package/lib/src/models/llm/tools/attachment.js.map +1 -0
  57. package/lib/src/models/llm/tools/edit.d.ts.map +1 -1
  58. package/lib/src/models/llm/tools/edit.js +1 -4
  59. package/lib/src/models/llm/tools/edit.js.map +1 -1
  60. package/lib/src/models/llm/tools/grep.d.ts.map +1 -1
  61. package/lib/src/models/llm/tools/grep.js +0 -3
  62. package/lib/src/models/llm/tools/grep.js.map +1 -1
  63. package/lib/src/models/llm/tools/index.d.ts +1 -0
  64. package/lib/src/models/llm/tools/index.d.ts.map +1 -1
  65. package/lib/src/models/llm/tools/index.js +3 -1
  66. package/lib/src/models/llm/tools/index.js.map +1 -1
  67. package/lib/src/models/llm/tools/ls.d.ts.map +1 -1
  68. package/lib/src/models/llm/tools/ls.js +0 -3
  69. package/lib/src/models/llm/tools/ls.js.map +1 -1
  70. package/lib/src/models/llm/tools/read.d.ts.map +1 -1
  71. package/lib/src/models/llm/tools/read.js +3 -7
  72. package/lib/src/models/llm/tools/read.js.map +1 -1
  73. package/lib/src/models/llm/tools/write.d.ts +1 -1
  74. package/lib/src/models/pipeline/{steps/errors.d.ts → errors.d.ts} +1 -1
  75. package/lib/src/models/pipeline/errors.d.ts.map +1 -0
  76. package/lib/src/models/pipeline/errors.js.map +1 -0
  77. package/lib/src/models/pipeline/index.d.ts +1 -0
  78. package/lib/src/models/pipeline/index.d.ts.map +1 -1
  79. package/lib/src/models/pipeline/index.js +1 -0
  80. package/lib/src/models/pipeline/index.js.map +1 -1
  81. package/lib/src/models/pipeline/model.d.ts +14 -6
  82. package/lib/src/models/pipeline/model.d.ts.map +1 -1
  83. package/lib/src/models/pipeline/model.js +12 -3
  84. package/lib/src/models/pipeline/model.js.map +1 -1
  85. package/lib/src/models/pipeline/session.d.ts +9 -17
  86. package/lib/src/models/pipeline/session.d.ts.map +1 -1
  87. package/lib/src/models/pipeline/session.js +13 -2
  88. package/lib/src/models/pipeline/session.js.map +1 -1
  89. package/lib/src/models/pipeline/stdout/compiled/console.js +9 -9
  90. package/lib/src/models/pipeline/stdout/compiled/console.js.map +1 -1
  91. package/lib/src/models/pipeline/stdout/model.d.ts.map +1 -1
  92. package/lib/src/models/pipeline/stdout/model.js +15 -3
  93. package/lib/src/models/pipeline/stdout/model.js.map +1 -1
  94. package/lib/src/models/pipeline/steps/ai/actions/index.d.ts +3 -0
  95. package/lib/src/models/pipeline/steps/ai/actions/index.d.ts.map +1 -0
  96. package/lib/src/models/pipeline/steps/ai/actions/index.js +19 -0
  97. package/lib/src/models/pipeline/steps/ai/actions/index.js.map +1 -0
  98. package/lib/src/models/pipeline/steps/ai/actions/model.d.ts +13 -0
  99. package/lib/src/models/pipeline/steps/ai/actions/model.d.ts.map +1 -0
  100. package/lib/src/models/pipeline/steps/ai/actions/model.js +21 -0
  101. package/lib/src/models/pipeline/steps/ai/actions/model.js.map +1 -0
  102. package/lib/src/models/pipeline/steps/ai/actions/reasoning.d.ts +36 -0
  103. package/lib/src/models/pipeline/steps/ai/actions/reasoning.d.ts.map +1 -0
  104. package/lib/src/models/pipeline/steps/ai/actions/reasoning.js +59 -0
  105. package/lib/src/models/pipeline/steps/ai/actions/reasoning.js.map +1 -0
  106. package/lib/src/models/pipeline/steps/ai/actions/tool.d.ts +71 -0
  107. package/lib/src/models/pipeline/steps/ai/actions/tool.d.ts.map +1 -0
  108. package/lib/src/models/pipeline/steps/ai/actions/tool.js +160 -0
  109. package/lib/src/models/pipeline/steps/ai/actions/tool.js.map +1 -0
  110. package/lib/src/models/pipeline/steps/ai/errors.d.ts +26 -0
  111. package/lib/src/models/pipeline/steps/ai/errors.d.ts.map +1 -0
  112. package/lib/src/models/pipeline/steps/ai/errors.js +73 -0
  113. package/lib/src/models/pipeline/steps/ai/errors.js.map +1 -0
  114. package/lib/src/models/pipeline/steps/{ai.d.ts → ai/index.d.ts} +8 -20
  115. package/lib/src/models/pipeline/steps/ai/index.d.ts.map +1 -0
  116. package/lib/src/models/pipeline/steps/{ai.js → ai/index.js} +166 -224
  117. package/lib/src/models/pipeline/steps/ai/index.js.map +1 -0
  118. package/lib/src/models/pipeline/steps/ai/types.d.ts +12 -0
  119. package/lib/src/models/pipeline/steps/ai/types.d.ts.map +1 -0
  120. package/lib/src/models/pipeline/steps/ai/types.js +3 -0
  121. package/lib/src/models/pipeline/steps/ai/types.js.map +1 -0
  122. package/lib/src/models/pipeline/steps/ai/utils.d.ts +9 -0
  123. package/lib/src/models/pipeline/steps/ai/utils.d.ts.map +1 -0
  124. package/lib/src/models/pipeline/steps/ai/utils.js +34 -0
  125. package/lib/src/models/pipeline/steps/ai/utils.js.map +1 -0
  126. package/lib/src/models/pipeline/steps/loop.d.ts.map +1 -1
  127. package/lib/src/models/pipeline/steps/loop.js +1 -1
  128. package/lib/src/models/pipeline/steps/loop.js.map +1 -1
  129. package/lib/src/models/pipeline/steps/self.js +1 -1
  130. package/lib/src/models/pipeline/steps/self.js.map +1 -1
  131. package/lib/src/models/pipeline/steps/swarm.js +1 -1
  132. package/lib/src/models/pipeline/steps/swarm.js.map +1 -1
  133. package/lib/src/models/rg.js +2 -2
  134. package/lib/src/models/rg.js.map +1 -1
  135. package/lib/src/models/vfs.d.ts +2 -2
  136. package/lib/src/models/vfs.d.ts.map +1 -1
  137. package/lib/src/models/vfs.js +4 -4
  138. package/lib/src/models/vfs.js.map +1 -1
  139. package/lib/src/setup.js +1 -1
  140. package/lib/src/setup.js.map +1 -1
  141. package/lib/src/utils/common.d.ts +9 -0
  142. package/lib/src/utils/common.d.ts.map +1 -1
  143. package/lib/src/utils/common.js +16 -1
  144. package/lib/src/utils/common.js.map +1 -1
  145. package/lib/types/json2md.global.d.ts +2 -7
  146. package/lib/types/json2md.global.d.ts.map +1 -1
  147. package/package.json +1 -1
  148. package/lib/src/models/pipeline/steps/ai.d.ts.map +0 -1
  149. package/lib/src/models/pipeline/steps/ai.js.map +0 -1
  150. package/lib/src/models/pipeline/steps/errors.d.ts.map +0 -1
  151. package/lib/src/models/pipeline/steps/errors.js.map +0 -1
  152. /package/lib/src/models/pipeline/{steps/errors.js → errors.js} +0 -0
@@ -1,4 +1,18 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
2
16
  var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
3
17
  if (value !== null && value !== void 0) {
4
18
  if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
@@ -55,45 +69,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
55
69
  return (mod && mod.__esModule) ? mod : { "default": mod };
56
70
  };
57
71
  Object.defineProperty(exports, "__esModule", { value: true });
58
- exports.PipelineAiStep = exports.PipelineAiStepCompiler = exports.PipelineAiStepError = void 0;
72
+ exports.PipelineAiStep = exports.PipelineAiStepCompiler = void 0;
59
73
  const lodash_1 = __importDefault(require("lodash"));
60
- const zocker_1 = require("zocker");
61
74
  const ai_1 = require("ai");
62
- const model_1 = require("./model");
63
- const utils_1 = require("../../../utils");
64
- const content_1 = require("../../content");
65
- const errors_1 = require("./errors");
66
- const vfs_1 = require("../../vfs");
67
- const llm_1 = require("../../llm");
68
- const file_1 = require("../../file");
69
- const renderDebugHeader = (title) => [
70
- '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@',
71
- title.toUpperCase().padStart(40, ' '),
72
- '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@',
73
- ].join('\n');
74
- class PipelineAiStepError extends Error {
75
- constructor(type, reason = 'none') {
76
- super(`Got error [${type}] while generation. Reason: ${reason}`);
77
- this.type = type;
78
- this.reason = reason;
79
- }
80
- is(types) {
81
- return types.includes(this.type);
82
- }
83
- static convert(error) {
84
- if (error instanceof PipelineAiStepError) {
85
- return error;
86
- }
87
- if (ai_1.APICallError.isInstance(error)) {
88
- return new PipelineAiStepError('BAD_API_CALL', error.message);
89
- }
90
- if (ai_1.NoObjectGeneratedError.isInstance(error)) {
91
- return new PipelineAiStepError('WRONG_RESPONSE', error.message);
92
- }
93
- return new PipelineAiStepError('BAD_API_CALL', String(lodash_1.default.isObject(error) && 'message' in error ? error.message : error));
94
- }
95
- }
96
- exports.PipelineAiStepError = PipelineAiStepError;
75
+ const model_1 = require("../model");
76
+ const actions_1 = require("./actions");
77
+ const content_1 = require("../../../content");
78
+ const utils_1 = require("../../../../utils");
79
+ const errors_1 = require("../../errors");
80
+ const vfs_1 = require("../../../vfs");
81
+ const llm_1 = require("../../../llm");
82
+ const errors_2 = require("./errors");
83
+ const utils_2 = require("./utils");
84
+ __exportStar(require("./actions"), exports);
85
+ __exportStar(require("./errors"), exports);
97
86
  class PipelineAiStepCompiler extends model_1.PipelineStepCompiler {
98
87
  constructor(definition) {
99
88
  super();
@@ -126,7 +115,7 @@ class PipelineAiStepCompiler extends model_1.PipelineStepCompiler {
126
115
  }
127
116
  return new PipelineAiStep(this.type, {
128
117
  title: this.definition.title,
129
- debug: this.definition.debug,
118
+ debug: this.definition.debug ?? provided.pipeline.debug,
130
119
  prompt: this.definition.prompt,
131
120
  schema: this.definition.schema,
132
121
  llm: this.definition.llm,
@@ -191,20 +180,18 @@ class PipelineAiStep extends model_1.PipelineStep {
191
180
  return tasks.push(...segment.payload);
192
181
  }
193
182
  if (content_1.ContentFactory.is('attachment', segment)) {
194
- if (segment.payload.isVirtual) {
195
- return vfs.register({
196
- title: segment.payload.title,
197
- path: segment.payload.path,
198
- content: segment.render(),
199
- });
200
- }
201
- return sources.push(...content_1.SourcesContent
202
- .build([{ location: segment.payload.path, title: segment.payload.title }])
203
- .serialize());
183
+ return vfs.register({
184
+ title: segment.payload.title,
185
+ key: segment.payload.key,
186
+ content: segment.render(),
187
+ });
204
188
  }
205
189
  });
206
- for (const file of vfs.values()) {
207
- sources.push(...content_1.SourcesContent.build([{ location: file.path, title: file.title }]).serialize());
190
+ if (articles.length) {
191
+ system.push(...articles);
192
+ }
193
+ if (rules.length) {
194
+ system.push(content_1.ArticleContent.build({ title: 'Rules', content: [{ ol: rules }] }).render());
208
195
  }
209
196
  if (llm.skills.length) {
210
197
  system.push(content_1.ArticleContent
@@ -217,26 +204,37 @@ class PipelineAiStep extends model_1.PipelineStep {
217
204
  if (sources.length) {
218
205
  system.push(content_1.ArticleContent
219
206
  .build({
220
- title: 'Sources. Read **ALL** the files below **(IMPORTANT: FOLLOW THE ORDER)**',
207
+ title: 'Sources. Read **ALL** the content below using `read` tool **(IMPORTANT: FOLLOW THE ORDER)**',
221
208
  content: [{ ol: sources }],
222
209
  })
223
210
  .render());
224
211
  }
225
- if (rules.length) {
226
- system.push(content_1.ArticleContent.build({ title: 'Rules', content: [{ ol: rules }] }).render());
227
- }
228
- if (articles.length) {
229
- system.push(...articles);
212
+ if (vfs.size) {
213
+ system.push(content_1.ArticleContent
214
+ .build({
215
+ title: 'Attachments. Read **ALL** the content below using `attachment` tool **(IMPORTANT: FOLLOW THE ORDER)**',
216
+ content: [{
217
+ ol: content_1.SourcesContent
218
+ .build([...vfs.values()].map((file) => ({ path: file.key, title: file.title })))
219
+ .serialize()
220
+ }],
221
+ })
222
+ .render());
230
223
  }
231
224
  if (tasks.length) {
232
225
  user.push(content_1.ArticleContent
233
- .build({ title: '**Task** (complete following list step by step)', content: [{ ol: tasks }] })
226
+ .build({
227
+ title: '**Task** (complete following list step by step)',
228
+ tag: 'h1',
229
+ content: [{ ol: tasks }]
230
+ })
234
231
  .render());
235
232
  }
236
233
  const tools = Object
237
- .entries(llm.skills.length
238
- ? Object.assign({}, llm.tools, { skill: llm_1.skill })
239
- : llm.tools)
234
+ .entries(Object.assign({}, llm.tools, {
235
+ ...(llm.skills.length && { skill: llm_1.skill }),
236
+ ...(vfs.size && { attachment: llm_1.attachment }),
237
+ }))
240
238
  .reduce((acc, [name, compiler]) => lodash_1.default.set(acc, name, compiler.compile(parameters.extend({ vfs, step: this }))), {});
241
239
  await Promise.all(mcp.entity.map(async (client) => Object
242
240
  .entries(await client.tools())
@@ -276,6 +274,7 @@ class PipelineAiStep extends model_1.PipelineStep {
276
274
  const actions = {
277
275
  sequence: (0, utils_1.cast)([]),
278
276
  map: (0, utils_1.cast)({}),
277
+ trace: (0, utils_1.cast)(undefined),
279
278
  };
280
279
  const info = provided.messages.info ?? content_1.ArticleContent
281
280
  .build({
@@ -298,54 +297,35 @@ class PipelineAiStep extends model_1.PipelineStep {
298
297
  },
299
298
  ];
300
299
  if (provided.messages.history?.length) {
301
- provided.messages.history.forEach((record) => messages.push({
302
- role: 'assistant',
303
- providerOptions: record.provider,
304
- content: record.actions.map((action) => {
305
- if (action.type === 'reasoning') {
306
- return {
307
- type: 'reasoning',
308
- text: action.text,
309
- providerOptions: action.provider,
310
- id: action.id,
311
- };
312
- }
313
- return {
314
- type: 'tool-call',
315
- providerOptions: action.provider,
316
- toolName: action.name,
317
- toolCallId: action.id,
318
- input: action.input.value,
319
- };
320
- }),
321
- }, {
322
- role: 'tool',
323
- providerOptions: record.provider,
324
- content: record.actions.filter((action) => action.type === 'tool').map((action) => ({
325
- type: 'tool-result',
326
- providerOptions: action.provider,
327
- toolCallId: action.id,
328
- toolName: action.name,
329
- output: {
330
- type: action.output.type === 'error' ? 'error-text' : action.output.type,
331
- value: action.output.value,
332
- },
333
- })),
334
- }));
300
+ provided.messages.history.forEach((record) => {
301
+ if (record.actions.every((action) => action instanceof actions_1.PipelineAiReasoningAction)) {
302
+ return messages.push({
303
+ role: 'assistant',
304
+ providerOptions: record.trace,
305
+ content: record.actions.map((action) => action.format()),
306
+ });
307
+ }
308
+ messages.push({
309
+ role: 'assistant',
310
+ providerOptions: record.trace,
311
+ content: record.actions.map((action) => action instanceof actions_1.PipelineAiReasoningAction
312
+ ? action.format()
313
+ : action.format('call-part')),
314
+ }, {
315
+ role: 'tool',
316
+ providerOptions: record.trace,
317
+ content: record.actions
318
+ .filter((action) => action instanceof actions_1.PipelineAiToolAction)
319
+ .map((action) => action.format('result-part')),
320
+ });
321
+ });
335
322
  }
336
323
  if (this.definition.debug) {
337
- const location = `${new Date().toLocaleTimeString()}-${this.pipeline.session.id}`;
338
- const title = this.trace().reverse().map((entity) => lodash_1.default.kebabCase(entity.title)).join('.');
339
- const file = await file_1.File.build(`.pipeline/${location}/${title}.md`);
340
- file.append([
341
- `${renderDebugHeader('tools')}\n`,
342
- ...Object
343
- .entries(provided.tools ?? {})
344
- .map(([name, tool]) => `# \`${name}\`\n\n${tool.description}\n\n---\n`)
345
- ].join('\n'));
346
- messages.forEach((message) => file.append([`${renderDebugHeader(message.role)}\n`, message.content].join('\n')));
347
- await file.write(file.content.trim());
348
- return provided.schema ? (0, zocker_1.zocker)(provided.schema).generate() : 'DEBUG AI OUTPUT';
324
+ return (0, utils_2.useStepDebug)(this, {
325
+ messages,
326
+ schema: provided.schema,
327
+ tools: provided.tools,
328
+ });
349
329
  }
350
330
  try {
351
331
  const stream = (0, ai_1.streamText)({
@@ -371,121 +351,76 @@ class PipelineAiStep extends model_1.PipelineStep {
371
351
  model: provided.llm.tag,
372
352
  tools: provided.tools,
373
353
  onError: () => undefined,
354
+ onFinish: ({ providerMetadata }) => {
355
+ actions.trace = providerMetadata;
356
+ },
374
357
  });
375
358
  for await (const fragment of stream.fullStream) {
376
- if (fragment.type === 'tool-call') {
377
- const action = {
378
- type: 'tool',
379
- meta: (0, utils_1.buildMetaManager)(),
380
- id: fragment.toolCallId,
381
- name: fragment.toolName,
382
- provider: fragment.providerMetadata,
383
- input: {
384
- preview: lodash_1.default.isObject(fragment.input) ? (0, utils_1.preview)(fragment.input) : String(fragment.input),
385
- value: fragment.input,
386
- },
387
- output: {
388
- type: 'text',
389
- value: undefined,
390
- },
391
- };
392
- actions.map[fragment.toolCallId] = action;
393
- this.pipeline.session.emit('step:llm:tool', {
394
- step: this,
395
- name: fragment.toolName,
396
- meta: action.meta.init(),
397
- message: action.input.preview,
398
- });
399
- }
400
- if (fragment.type === 'tool-result') {
401
- const action = actions.map[fragment.toolCallId];
402
- if (action?.type === 'tool') {
403
- if (fragment.providerMetadata) {
404
- action.provider = fragment.providerMetadata;
359
+ switch (fragment.type) {
360
+ case 'tool-call':
361
+ {
362
+ const action = actions_1.PipelineAiToolAction.build(this, fragment);
363
+ actions.map[action.id] = action;
364
+ this.pipeline.session.emit('step:ai:tool', action);
365
+ continue;
405
366
  }
406
- action.output = {
407
- type: lodash_1.default.isObject(fragment.output) ? 'json' : 'text',
408
- value: fragment.output,
409
- };
410
- actions.sequence.push(fragment.toolCallId);
411
- this.pipeline.session.emit('step:llm:tool', {
412
- step: this,
413
- name: fragment.toolName,
414
- meta: action.meta.done(),
415
- message: action.input.preview,
416
- });
417
- }
418
- }
419
- if (fragment.type === 'tool-error') {
420
- const action = actions.map[fragment.toolCallId];
421
- if (action?.type === 'tool') {
422
- if (fragment.providerMetadata) {
423
- action.provider = fragment.providerMetadata;
367
+ ;
368
+ case 'tool-result':
369
+ {
370
+ const action = actions.map[fragment.toolCallId];
371
+ if (action instanceof actions_1.PipelineAiToolAction) {
372
+ actions.sequence.push(action.id);
373
+ this.pipeline.session.emit('step:ai:tool', action.complete('DONE', fragment));
374
+ }
375
+ ;
376
+ continue;
424
377
  }
425
- action.output = {
426
- type: 'error',
427
- value: fragment.error instanceof Error ? fragment.error.message : String(fragment.error),
428
- };
429
- actions.sequence.push(fragment.toolCallId);
430
- this.pipeline.session.emit('step:llm:tool', {
431
- step: this,
432
- name: fragment.toolName,
433
- meta: action.meta.error(),
434
- message: action.input.preview,
435
- });
436
- }
437
- }
438
- if (fragment.type === 'reasoning-start') {
439
- const action = {
440
- type: 'reasoning',
441
- meta: (0, utils_1.buildMetaManager)(),
442
- id: fragment.id,
443
- provider: fragment.providerMetadata,
444
- text: '',
445
- };
446
- actions.map[fragment.id] = action;
447
- this.pipeline.session.emit('step:llm:reasoning', {
448
- step: this,
449
- meta: action.meta.init(),
450
- message: 'Thinking',
451
- });
452
- }
453
- if (fragment.type === 'reasoning-delta') {
454
- const action = actions.map[fragment.id];
455
- if (action?.type === 'reasoning') {
456
- if (fragment.providerMetadata) {
457
- action.provider = fragment.providerMetadata;
378
+ ;
379
+ case 'tool-error':
380
+ {
381
+ const action = actions.map[fragment.toolCallId];
382
+ if (action instanceof actions_1.PipelineAiToolAction) {
383
+ actions.sequence.push(action.id);
384
+ this.pipeline.session.emit('step:ai:tool', action.complete('ERROR', fragment));
385
+ }
386
+ ;
387
+ continue;
458
388
  }
459
- this.pipeline.session.emit('step:llm:reasoning', {
460
- step: this,
461
- meta: action.meta.pending(),
462
- message: fragment.text,
463
- });
464
- action.text += fragment.text;
465
- action.meta = (0, utils_1.buildMetaManager)();
466
- }
467
- }
468
- if (fragment.type === 'reasoning-end') {
469
- const action = actions.map[fragment.id];
470
- if (action?.type === 'reasoning') {
471
- if (fragment.providerMetadata) {
472
- action.provider = fragment.providerMetadata;
389
+ ;
390
+ case 'reasoning-start':
391
+ {
392
+ const action = actions_1.PipelineAiReasoningAction.build(this, fragment);
393
+ actions.map[action.id] = action;
394
+ this.pipeline.session.emit('step:ai:reasoning', action);
395
+ continue;
473
396
  }
474
- actions.sequence.push(fragment.id);
475
- this.pipeline.session.emit('step:llm:reasoning', {
476
- step: this,
477
- meta: action.meta.done(),
478
- message: action.text,
479
- });
480
- }
481
- }
482
- if (fragment.type === 'error' && fragment.error instanceof Error) {
483
- throw PipelineAiStepError.convert(fragment.error);
397
+ ;
398
+ case 'reasoning-delta':
399
+ {
400
+ const action = actions.map[fragment.id];
401
+ if (action instanceof actions_1.PipelineAiReasoningAction) {
402
+ this.pipeline.session.emit('step:ai:reasoning', action.enrich(fragment));
403
+ }
404
+ ;
405
+ continue;
406
+ }
407
+ ;
408
+ case 'reasoning-end':
409
+ {
410
+ const action = actions.map[fragment.id];
411
+ if (action instanceof actions_1.PipelineAiReasoningAction) {
412
+ actions.sequence.push(action.id);
413
+ this.pipeline.session.emit('step:ai:reasoning', action.complete(fragment));
414
+ }
415
+ ;
416
+ continue;
417
+ }
418
+ ;
484
419
  }
485
420
  }
486
421
  const output = await stream.output;
487
422
  if (typeof output === 'string' && !output.length) {
488
- throw new PipelineAiStepError('EMPTY_OUTPUT');
423
+ throw errors_2.PipelineAiError.build({ type: 'EMPTY_OUTPUT', llm: provided.llm });
489
424
  }
490
425
  const usage = await stream.usage;
491
426
  if (usage.inputTokens) {
@@ -497,20 +432,24 @@ class PipelineAiStep extends model_1.PipelineStep {
497
432
  return output;
498
433
  }
499
434
  catch (error) {
500
- const converted = PipelineAiStepError.convert(error);
435
+ const converted = errors_2.PipelineAiError.convert({ error, llm: provided.llm });
501
436
  if (actions.sequence.length) {
502
- converted.type = 'EMPTY_OUTPUT';
437
+ converted.assign({ type: 'EMPTY_OUTPUT' });
503
438
  }
504
- const errors = (converted.is(['EMPTY_OUTPUT']) ? [] : (provided.errors ?? [])).concat([converted]);
439
+ const errors = {
440
+ global: provided.errors?.global ?? [],
441
+ local: (converted.is(['EMPTY_OUTPUT']) ? [] : (provided.errors?.local ?? [])).concat(converted),
442
+ };
505
443
  const enough = (iteration < provided.llm.limit && !converted.is(['EMPTY_OUTPUT', 'WRONG_RESPONSE'])) ||
506
444
  iteration >= provided.llm.limit ||
507
- errors.filter((nested) => nested.is(['WRONG_RESPONSE'])).length >= 3;
445
+ errors.local.filter((nested) => nested.is(['WRONG_RESPONSE'])).length >= 3;
508
446
  const fallback = enough ? provided.llm.next() : null;
509
447
  if (!fallback && enough) {
510
- throw converted;
448
+ throw converted.assign({ sequence: errors.global });
511
449
  }
512
450
  if (fallback) {
513
- this.pipeline.session.emit('step:llm:fallback', {
451
+ this.pipeline.session.emit('step:ai:fallback', {
452
+ reason: converted,
514
453
  step: this,
515
454
  providers: {
516
455
  old: provided.llm,
@@ -526,7 +465,10 @@ class PipelineAiStep extends model_1.PipelineStep {
526
465
  schema: provided.schema,
527
466
  tools: provided.tools,
528
467
  ...(fallback && {
529
- errors: [],
468
+ errors: {
469
+ global: errors.global.concat(converted),
470
+ local: undefined,
471
+ },
530
472
  llm: fallback.provider,
531
473
  iteration: undefined,
532
474
  }),
@@ -535,19 +477,19 @@ class PipelineAiStep extends model_1.PipelineStep {
535
477
  system: provided.messages.system,
536
478
  user: provided.messages.user,
537
479
  history: converted.is(['EMPTY_OUTPUT'])
538
- ? (provided.messages.history ?? []).concat([{
539
- provider: Object.values(actions.map).find((action) => action.provider)?.provider,
540
- actions: actions.sequence.map((id) => actions.map[id]),
541
- }])
480
+ ? (provided.messages.history ?? []).concat({
481
+ actions: actions.sequence.map((id) => actions.map[id]),
482
+ trace: actions.trace,
483
+ })
542
484
  : provided.messages.history,
543
485
  ...(fallback?.strategy === 'restart' && {
544
486
  history: undefined,
545
487
  info: undefined,
546
- })
488
+ }),
547
489
  },
548
490
  });
549
491
  }
550
492
  }
551
493
  }
552
494
  exports.PipelineAiStep = PipelineAiStep;
553
- //# sourceMappingURL=ai.js.map
495
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/models/pipeline/steps/ai/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAuB;AAEvB,2BAA8F;AAG9F,oCAAmF;AAEnF,uCAA4E;AAC5E,8CAAkF;AAElF,6CAAsE;AACtE,yCAA4D;AAE5D,sCAAiD;AACjD,sCAAiD;AACjD,qCAA2C;AAC3C,mCAAuC;AAIvC,4CAA0B;AAC1B,2CAAyB;AAEzB,MAAa,sBAGX,SAAQ,4BAA6B;IAGrC,YAAsB,UAAgD;QACpE,KAAK,EAAE,CAAC;QADY,eAAU,GAAV,UAAU,CAAsC;QAF9D,SAAI,GAAqC,IAAI,CAAC;IAItD,CAAC;IAED,qCAAqC;IAC9B,MAAM,CACX,SAA8E;QAE9E,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,SAAS,CAAC;QACnC,OAAuB,IAAI,CAAC;IAC9B,CAAC;IAED,8BAA8B;IACvB,MAAM,CAAC,SAAgD;QAC5D,IAAI,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AAC,QAAQ,CAAC,MAAM;oBAChC,IAAI,EAAE,QAAQ,CAAC,QAAQ,CAAC,IAAI;oBAE5B,OAAO,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,cAAc,CAAC,CAAC;wBACrC,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;4BACzC,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;4BACtD,KAAK,EAAE,OAAO,CAAC,KAAK;yBACrB,CAAC;wBACF,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO;oBAE7B,GAAG,CAAC,QAAQ,EAAE,QAAQ,KAAK,SAAS,IAAI;wBACtC,OAAO,EAAE,SAAS;wBAClB,IAAI,EAAE,SAAS;qBAChB,CAAC;iBACH;aACF,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF;AAjdD,wCAidC"}
@@ -0,0 +1,12 @@
1
+ import type { ZodType } from 'zod/v3';
2
+ import type { IPipelineConfiguration, TPipelineContentPredicate } from '../../types';
3
+ import type { TPipelineStepNestedHandler } from '../types';
4
+ import type { IPipelineStepDefinition } from '../model';
5
+ import type { LlmProvider } from '../../../llm';
6
+ export interface IDefinition<TConfiguration extends IPipelineConfiguration> extends IPipelineStepDefinition {
7
+ prompt: TPipelineContentPredicate | TPipelineStepNestedHandler<TConfiguration, TPipelineContentPredicate>;
8
+ schema?: ZodType | TPipelineStepNestedHandler<TConfiguration, ZodType>;
9
+ llm?: LlmProvider | TPipelineStepNestedHandler<TConfiguration, LlmProvider>;
10
+ debug?: boolean;
11
+ }
12
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/models/pipeline/steps/ai/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEtC,OAAO,KAAK,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AACrF,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAC;AAC3D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,MAAM,WAAW,WAAW,CAAC,cAAc,SAAS,sBAAsB,CAAE,SAAQ,uBAAuB;IACzG,MAAM,EAAE,yBAAyB,GAAG,0BAA0B,CAAC,cAAc,EAAE,yBAAyB,CAAC,CAAC;IAE1G,MAAM,CAAC,EAAE,OAAO,GAAG,0BAA0B,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IACvE,GAAG,CAAC,EAAE,WAAW,GAAG,0BAA0B,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;IAE5E,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../src/models/pipeline/steps/ai/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ import { ModelMessage, Tool } from 'ai';
2
+ import { ZodType } from 'zod/v3';
3
+ import type { PipelineAiStep } from './index';
4
+ export declare const useStepDebug: <TSchema>(step: PipelineAiStep, parameters: {
5
+ messages: ModelMessage[];
6
+ schema?: ZodType<TSchema>;
7
+ tools?: Record<string, Tool>;
8
+ }) => Promise<TSchema>;
9
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../src/models/pipeline/steps/ai/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAsC,IAAI,EAAE,MAAM,IAAI,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAGjC,OAAO,KAAK,EAA6B,cAAc,EAAwB,MAAM,SAAS,CAAC;AAS/F,eAAO,MAAM,YAAY,GAAU,OAAO,QAAQ,cAAc,cAAc;IAC5E,QAAQ,EAAE,YAAY,EAAE,CAAC;IAEzB,MAAM,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;CAC9B,KAAG,OAAO,CAAC,OAAO,CAwBlB,CAAA"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.useStepDebug = void 0;
7
+ const lodash_1 = __importDefault(require("lodash"));
8
+ const zocker_1 = require("zocker");
9
+ const file_1 = require("../../../file");
10
+ const renderDebugHeader = (title) => [
11
+ '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@',
12
+ title.toUpperCase().padStart(40, ' '),
13
+ '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@',
14
+ ].join('\n');
15
+ const useStepDebug = async (step, parameters) => {
16
+ const location = `${new Date(step.pipeline.session.timestamp).toLocaleTimeString()}-${step.pipeline.session.id}`;
17
+ const title = step.trace().reverse().map((entity) => lodash_1.default.kebabCase(entity.title)).join('.');
18
+ const file = await file_1.File.build([
19
+ '.pipeline',
20
+ location,
21
+ `${step.pipeline.session.meta.counters.steps(0)}.${title}.md`,
22
+ ]);
23
+ file.append([
24
+ `${renderDebugHeader('tools')}\n`,
25
+ ...Object
26
+ .entries(parameters.tools ?? {})
27
+ .map(([name, tool]) => `# \`${name}\`\n\n${tool.description}\n\n---\n`)
28
+ ].join('\n'));
29
+ parameters.messages.forEach((message) => file.append([`\n${renderDebugHeader(message.role)}\n`, message.content].join('\n')));
30
+ await file.write(file.content.trim());
31
+ return parameters.schema ? (0, zocker_1.zocker)(parameters.schema).generate() : 'DEBUG AI OUTPUT';
32
+ };
33
+ exports.useStepDebug = useStepDebug;
34
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../../src/models/pipeline/steps/ai/utils.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AAIvB,mCAAgC;AAGhC,wCAAqC;AAErC,MAAM,iBAAiB,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC;IACnD,6EAA6E;IAC7E,KAAK,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,GAAG,CAAC;IACrC,6EAA6E;CAC9E,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEN,MAAM,YAAY,GAAG,KAAK,EAAW,IAAoB,EAAE,UAKjE,EAAoB,EAAE;IACrB,MAAM,QAAQ,GAAG,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,kBAAkB,EAAE,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC;IACjH,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,gBAAC,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAE1F,MAAM,IAAI,GAAG,MAAM,WAAI,CAAC,KAAK,CAAC;QAC5B,WAAW;QACX,QAAQ;QACR,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAA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