@loopstack/llm-provider-module 0.2.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 (82) hide show
  1. package/dist/contracts/index.d.ts +3 -0
  2. package/dist/contracts/index.d.ts.map +1 -0
  3. package/dist/contracts/index.js +19 -0
  4. package/dist/contracts/index.js.map +1 -0
  5. package/dist/contracts/llm-context.d.ts +7 -0
  6. package/dist/contracts/llm-context.d.ts.map +1 -0
  7. package/dist/contracts/llm-context.js +3 -0
  8. package/dist/contracts/llm-context.js.map +1 -0
  9. package/dist/contracts/llm-provider.interface.d.ts +10 -0
  10. package/dist/contracts/llm-provider.interface.d.ts.map +1 -0
  11. package/dist/contracts/llm-provider.interface.js +3 -0
  12. package/dist/contracts/llm-provider.interface.js.map +1 -0
  13. package/dist/documents/index.d.ts +2 -0
  14. package/dist/documents/index.d.ts.map +1 -0
  15. package/dist/documents/index.js +18 -0
  16. package/dist/documents/index.js.map +1 -0
  17. package/dist/documents/llm-message.document.d.ts +50 -0
  18. package/dist/documents/llm-message.document.d.ts.map +1 -0
  19. package/dist/documents/llm-message.document.js +35 -0
  20. package/dist/documents/llm-message.document.js.map +1 -0
  21. package/dist/documents/llm-message.document.yaml +5 -0
  22. package/dist/index.d.ts +8 -0
  23. package/dist/index.d.ts.map +1 -0
  24. package/dist/index.js +24 -0
  25. package/dist/index.js.map +1 -0
  26. package/dist/llm-provider.module.d.ts +3 -0
  27. package/dist/llm-provider.module.d.ts.map +1 -0
  28. package/dist/llm-provider.module.js +46 -0
  29. package/dist/llm-provider.module.js.map +1 -0
  30. package/dist/services/index.d.ts +4 -0
  31. package/dist/services/index.d.ts.map +1 -0
  32. package/dist/services/index.js +20 -0
  33. package/dist/services/index.js.map +1 -0
  34. package/dist/services/llm-delegate.service.d.ts +12 -0
  35. package/dist/services/llm-delegate.service.d.ts.map +1 -0
  36. package/dist/services/llm-delegate.service.js +134 -0
  37. package/dist/services/llm-delegate.service.js.map +1 -0
  38. package/dist/services/llm-provider-registry.d.ts +9 -0
  39. package/dist/services/llm-provider-registry.d.ts.map +1 -0
  40. package/dist/services/llm-provider-registry.js +36 -0
  41. package/dist/services/llm-provider-registry.js.map +1 -0
  42. package/dist/services/llm-tools-helper.service.d.ts +6 -0
  43. package/dist/services/llm-tools-helper.service.d.ts.map +1 -0
  44. package/dist/services/llm-tools-helper.service.js +48 -0
  45. package/dist/services/llm-tools-helper.service.js.map +1 -0
  46. package/dist/tools/index.d.ts +5 -0
  47. package/dist/tools/index.d.ts.map +1 -0
  48. package/dist/tools/index.js +21 -0
  49. package/dist/tools/index.js.map +1 -0
  50. package/dist/tools/llm-delegate-tool-calls.tool.d.ts +55 -0
  51. package/dist/tools/llm-delegate-tool-calls.tool.d.ts.map +1 -0
  52. package/dist/tools/llm-delegate-tool-calls.tool.js +55 -0
  53. package/dist/tools/llm-delegate-tool-calls.tool.js.map +1 -0
  54. package/dist/tools/llm-generate-object.tool.d.ts +40 -0
  55. package/dist/tools/llm-generate-object.tool.d.ts.map +1 -0
  56. package/dist/tools/llm-generate-object.tool.js +81 -0
  57. package/dist/tools/llm-generate-object.tool.js.map +1 -0
  58. package/dist/tools/llm-generate-text.tool.d.ts +39 -0
  59. package/dist/tools/llm-generate-text.tool.d.ts.map +1 -0
  60. package/dist/tools/llm-generate-text.tool.js +81 -0
  61. package/dist/tools/llm-generate-text.tool.js.map +1 -0
  62. package/dist/tools/llm-update-tool-result.tool.d.ts +21 -0
  63. package/dist/tools/llm-update-tool-result.tool.d.ts.map +1 -0
  64. package/dist/tools/llm-update-tool-result.tool.js +48 -0
  65. package/dist/tools/llm-update-tool-result.tool.js.map +1 -0
  66. package/dist/types/index.d.ts +2 -0
  67. package/dist/types/index.d.ts.map +1 -0
  68. package/dist/types/index.js +18 -0
  69. package/dist/types/index.js.map +1 -0
  70. package/dist/types/llm.types.d.ts +155 -0
  71. package/dist/types/llm.types.d.ts.map +1 -0
  72. package/dist/types/llm.types.js +14 -0
  73. package/dist/types/llm.types.js.map +1 -0
  74. package/dist/utils/extract-text.util.d.ts +3 -0
  75. package/dist/utils/extract-text.util.d.ts.map +1 -0
  76. package/dist/utils/extract-text.util.js +13 -0
  77. package/dist/utils/extract-text.util.js.map +1 -0
  78. package/dist/utils/index.d.ts +2 -0
  79. package/dist/utils/index.d.ts.map +1 -0
  80. package/dist/utils/index.js +18 -0
  81. package/dist/utils/index.js.map +1 -0
  82. package/package.json +68 -0
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.LlmToolsHelperService = void 0;
10
+ const common_1 = require("@nestjs/common");
11
+ const zod_1 = require("zod");
12
+ const common_2 = require("@loopstack/common");
13
+ let LlmToolsHelperService = class LlmToolsHelperService {
14
+ getTools(tools, parent, workspace) {
15
+ const resolved = [];
16
+ for (const toolName of tools) {
17
+ const tool = (0, common_2.resolveBlockTool)(parent, toolName, workspace);
18
+ if (!tool) {
19
+ throw new Error(`Tool with name ${toolName} not available in Workflow or Workspace context.`);
20
+ }
21
+ if (tool instanceof common_2.ServerTool) {
22
+ const defaults = (0, common_2.resolveInjectToolDefaults)(parent, toolName, workspace);
23
+ const configSchema = (0, common_2.getBlockConfigSchema)(tool);
24
+ const validConfig = configSchema && defaults ? configSchema.parse(defaults) : defaults;
25
+ resolved.push({ type: 'server_tool', name: toolName, config: tool.toServerToolConfig(validConfig) });
26
+ continue;
27
+ }
28
+ const inputSchema = (0, common_2.getBlockArgsSchema)(tool);
29
+ const config = (0, common_2.getBlockConfig)(tool);
30
+ if (!config) {
31
+ throw new Error(`Block ${tool.constructor.name} is missing @BlockConfig decorator`);
32
+ }
33
+ const jsonSchema = inputSchema ? (0, zod_1.toJSONSchema)(inputSchema) : { type: 'object' };
34
+ resolved.push({
35
+ type: 'tool',
36
+ name: toolName,
37
+ description: config.description ?? '',
38
+ inputSchema: jsonSchema,
39
+ });
40
+ }
41
+ return resolved;
42
+ }
43
+ };
44
+ exports.LlmToolsHelperService = LlmToolsHelperService;
45
+ exports.LlmToolsHelperService = LlmToolsHelperService = __decorate([
46
+ (0, common_1.Injectable)()
47
+ ], LlmToolsHelperService);
48
+ //# sourceMappingURL=llm-tools-helper.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"llm-tools-helper.service.js","sourceRoot":"","sources":["../../src/services/llm-tools-helper.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAC5C,6BAAmC;AACnC,8CAS2B;AAgBpB,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAChC,QAAQ,CAAC,KAAe,EAAE,MAAyB,EAAE,SAAkB;QACrE,MAAM,QAAQ,GAAsB,EAAE,CAAC;QAEvC,KAAK,MAAM,QAAQ,IAAI,KAAK,EAAE,CAAC;YAC7B,MAAM,IAAI,GAAG,IAAA,yBAAgB,EAA6B,MAAM,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;YACvF,IAAI,CAAC,IAAI,EAAE,CAAC;gBACV,MAAM,IAAI,KAAK,CAAC,kBAAkB,QAAQ,kDAAkD,CAAC,CAAC;YAChG,CAAC;YAED,IAAI,IAAI,YAAY,mBAAU,EAAE,CAAC;gBAC/B,MAAM,QAAQ,GAAG,IAAA,kCAAyB,EAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;gBACxE,MAAM,YAAY,GAAG,IAAA,6BAAoB,EAAC,IAAI,CAAC,CAAC;gBAChD,MAAM,WAAW,GACf,YAAY,IAAI,QAAQ,CAAC,CAAC,CAAE,YAAY,CAAC,KAAK,CAAC,QAAQ,CAA6B,CAAC,CAAC,CAAC,QAAQ,CAAC;gBAClG,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;gBACrG,SAAS;YACX,CAAC;YAED,MAAM,WAAW,GAAG,IAAA,2BAAkB,EAAC,IAAI,CAAC,CAAC;YAC7C,MAAM,MAAM,GAAG,IAAA,uBAAc,EAAe,IAAI,CAAC,CAAC;YAClD,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,MAAM,IAAI,KAAK,CAAC,SAAS,IAAI,CAAC,WAAW,CAAC,IAAI,oCAAoC,CAAC,CAAC;YACtF,CAAC;YAED,MAAM,UAAU,GAAG,WAAW,CAAC,CAAC,CAAE,IAAA,kBAAY,EAAC,WAAW,CAA6B,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;YAE7G,QAAQ,CAAC,IAAI,CAAC;gBACZ,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,MAAM,CAAC,WAAW,IAAI,EAAE;gBACrC,WAAW,EAAE,UAAU;aACxB,CAAC,CAAC;QACL,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF,CAAA;AArCY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,mBAAU,GAAE;GACA,qBAAqB,CAqCjC"}
@@ -0,0 +1,5 @@
1
+ export * from './llm-generate-text.tool';
2
+ export * from './llm-generate-object.tool';
3
+ export * from './llm-delegate-tool-calls.tool';
4
+ export * from './llm-update-tool-result.tool';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,+BAA+B,CAAC"}
@@ -0,0 +1,21 @@
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
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./llm-generate-text.tool"), exports);
18
+ __exportStar(require("./llm-generate-object.tool"), exports);
19
+ __exportStar(require("./llm-delegate-tool-calls.tool"), exports);
20
+ __exportStar(require("./llm-update-tool-result.tool"), exports);
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAAyC;AACzC,6DAA2C;AAC3C,iEAA+C;AAC/C,gEAA8C"}
@@ -0,0 +1,55 @@
1
+ import { z } from 'zod';
2
+ import { BaseTool, ToolResult } from '@loopstack/common';
3
+ import type { LlmDelegateResult } from '../types';
4
+ export declare const LlmDelegateToolCallsToolSchema: z.ZodObject<{
5
+ message: z.ZodObject<{
6
+ role: z.ZodEnum<{
7
+ user: "user";
8
+ assistant: "assistant";
9
+ }>;
10
+ content: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
11
+ type: z.ZodLiteral<"text">;
12
+ text: z.ZodString;
13
+ }, z.core.$strip>, z.ZodObject<{
14
+ type: z.ZodLiteral<"thinking">;
15
+ text: z.ZodString;
16
+ }, z.core.$strip>, z.ZodObject<{
17
+ type: z.ZodLiteral<"tool_call">;
18
+ id: z.ZodString;
19
+ name: z.ZodString;
20
+ args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
21
+ }, z.core.$strip>, z.ZodObject<{
22
+ type: z.ZodLiteral<"server_tool_use">;
23
+ id: z.ZodString;
24
+ name: z.ZodString;
25
+ input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
26
+ }, z.core.$strip>, z.ZodObject<{
27
+ type: z.ZodLiteral<"server_tool_result">;
28
+ toolUseId: z.ZodString;
29
+ content: z.ZodUnknown;
30
+ }, z.core.$strip>, z.ZodObject<{
31
+ type: z.ZodLiteral<"tool_result">;
32
+ toolCallId: z.ZodString;
33
+ content: z.ZodString;
34
+ isError: z.ZodBoolean;
35
+ }, z.core.$strip>], "type">>]>;
36
+ id: z.ZodOptional<z.ZodString>;
37
+ stopReason: z.ZodOptional<z.ZodEnum<{
38
+ end_turn: "end_turn";
39
+ tool_use: "tool_use";
40
+ max_tokens: "max_tokens";
41
+ stop_sequence: "stop_sequence";
42
+ }>>;
43
+ }, z.core.$strip>;
44
+ callback: z.ZodOptional<z.ZodObject<{
45
+ transition: z.ZodString;
46
+ }, z.core.$strip>>;
47
+ }, z.core.$strip>;
48
+ type LlmDelegateToolCallsToolArgs = z.infer<typeof LlmDelegateToolCallsToolSchema>;
49
+ export declare class LlmDelegateToolCallsTool extends BaseTool {
50
+ private readonly delegateService;
51
+ call(args: LlmDelegateToolCallsToolArgs): Promise<ToolResult<LlmDelegateResult>>;
52
+ private extractToolCalls;
53
+ }
54
+ export {};
55
+ //# sourceMappingURL=llm-delegate-tool-calls.tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"llm-delegate-tool-calls.tool.d.ts","sourceRoot":"","sources":["../../src/tools/llm-delegate-tool-calls.tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAQ,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG/D,OAAO,KAAK,EAAmB,iBAAiB,EAAwB,MAAM,UAAU,CAAC;AAEzF,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAOzC,CAAC;AAEH,KAAK,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAEnF,qBAMa,wBAAyB,SAAQ,QAAQ;IAC1C,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAqB;IAEzD,IAAI,CAAC,IAAI,EAAE,4BAA4B,GAAG,OAAO,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;IAatF,OAAO,CAAC,gBAAgB;CAMzB"}
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.LlmDelegateToolCallsTool = exports.LlmDelegateToolCallsToolSchema = void 0;
13
+ const common_1 = require("@nestjs/common");
14
+ const zod_1 = require("zod");
15
+ const common_2 = require("@loopstack/common");
16
+ const llm_delegate_service_1 = require("../services/llm-delegate.service");
17
+ const types_1 = require("../types");
18
+ exports.LlmDelegateToolCallsToolSchema = zod_1.z.object({
19
+ message: types_1.LlmNormalizedMessageSchema,
20
+ callback: zod_1.z
21
+ .object({
22
+ transition: zod_1.z.string(),
23
+ })
24
+ .optional(),
25
+ });
26
+ let LlmDelegateToolCallsTool = class LlmDelegateToolCallsTool extends common_2.BaseTool {
27
+ delegateService;
28
+ async call(args) {
29
+ const message = args.message;
30
+ const toolCalls = this.extractToolCalls(message);
31
+ const result = await this.delegateService.delegateToolCalls(toolCalls, this.ctx.parent, this.ctx.workspace, args.callback);
32
+ return { data: result };
33
+ }
34
+ extractToolCalls(message) {
35
+ if (typeof message.content === 'string')
36
+ return [];
37
+ return message.content
38
+ .filter((b) => b.type === 'tool_call')
39
+ .map((b) => ({ id: b.id, name: b.name, args: b.args }));
40
+ }
41
+ };
42
+ exports.LlmDelegateToolCallsTool = LlmDelegateToolCallsTool;
43
+ __decorate([
44
+ (0, common_1.Inject)(),
45
+ __metadata("design:type", llm_delegate_service_1.LlmDelegateService)
46
+ ], LlmDelegateToolCallsTool.prototype, "delegateService", void 0);
47
+ exports.LlmDelegateToolCallsTool = LlmDelegateToolCallsTool = __decorate([
48
+ (0, common_2.Tool)({
49
+ uiConfig: {
50
+ description: 'Delegates tool calls from an LLM response. Resolves tools from the workflow and workspace.',
51
+ },
52
+ schema: exports.LlmDelegateToolCallsToolSchema,
53
+ })
54
+ ], LlmDelegateToolCallsTool);
55
+ //# sourceMappingURL=llm-delegate-tool-calls.tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"llm-delegate-tool-calls.tool.js","sourceRoot":"","sources":["../../src/tools/llm-delegate-tool-calls.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAwC;AACxC,6BAAwB;AACxB,8CAA+D;AAC/D,2EAAsE;AACtE,oCAAsD;AAGzC,QAAA,8BAA8B,GAAG,OAAC,CAAC,MAAM,CAAC;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,EAAE,sCAA8B;KACvC,CAAC;GACW,wBAAwB,CAsBpC"}
@@ -0,0 +1,40 @@
1
+ import { z } from 'zod';
2
+ import { BaseTool, ToolCallOptions, ToolResult } from '@loopstack/common';
3
+ import type { LlmGenerateObjectResult, LlmResultMeta } from '../types';
4
+ export declare const LlmGenerateObjectArgsSchema: z.ZodObject<{
5
+ prompt: z.ZodOptional<z.ZodString>;
6
+ messages: z.ZodOptional<z.ZodArray<z.ZodObject<{
7
+ role: z.ZodEnum<{
8
+ user: "user";
9
+ assistant: "assistant";
10
+ }>;
11
+ content: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodAny>]>;
12
+ }, z.core.$strip>>>;
13
+ outputSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
14
+ }, z.core.$strip>;
15
+ export declare const LlmGenerateObjectConfigSchema: z.ZodObject<{
16
+ provider: z.ZodOptional<z.ZodString>;
17
+ system: z.ZodOptional<z.ZodString>;
18
+ model: z.ZodOptional<z.ZodString>;
19
+ messagesSearchTag: z.ZodOptional<z.ZodString>;
20
+ providerConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
21
+ }, z.core.$strip>;
22
+ type LlmGenerateObjectArgs = z.infer<typeof LlmGenerateObjectArgsSchema>;
23
+ type LlmGenerateObjectConfig = z.infer<typeof LlmGenerateObjectConfigSchema>;
24
+ export declare const LlmGenerateObjectToolSchema: z.ZodObject<{
25
+ prompt: z.ZodOptional<z.ZodString>;
26
+ messages: z.ZodOptional<z.ZodArray<z.ZodObject<{
27
+ role: z.ZodEnum<{
28
+ user: "user";
29
+ assistant: "assistant";
30
+ }>;
31
+ content: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodAny>]>;
32
+ }, z.core.$strip>>>;
33
+ outputSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
34
+ }, z.core.$strip>;
35
+ export declare class LlmGenerateObjectTool extends BaseTool<LlmGenerateObjectArgs, LlmGenerateObjectConfig> {
36
+ private readonly registry;
37
+ call(args: LlmGenerateObjectArgs, options?: ToolCallOptions<LlmGenerateObjectConfig>): Promise<ToolResult<LlmGenerateObjectResult, LlmResultMeta>>;
38
+ }
39
+ export {};
40
+ //# sourceMappingURL=llm-generate-object.tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"llm-generate-object.tool.d.ts","sourceRoot":"","sources":["../../src/tools/llm-generate-object.tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAQ,eAAe,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGhF,OAAO,KAAK,EAAE,uBAAuB,EAAc,aAAa,EAAE,MAAM,UAAU,CAAC;AAEnF,eAAO,MAAM,2BAA2B;;;;;;;;;;iBAWtC,CAAC;AAEH,eAAO,MAAM,6BAA6B;;;;;;iBAMxC,CAAC;AAEH,KAAK,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AACzE,KAAK,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAG7E,eAAO,MAAM,2BAA2B;;;;;;;;;;iBAA8B,CAAC;AAEvE,qBASa,qBAAsB,SAAQ,QAAQ,CAAC,qBAAqB,EAAE,uBAAuB,CAAC;IACvF,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAsB;IAEnD,IAAI,CACR,IAAI,EAAE,qBAAqB,EAC3B,OAAO,CAAC,EAAE,eAAe,CAAC,uBAAuB,CAAC,GACjD,OAAO,CAAC,UAAU,CAAC,uBAAuB,EAAE,aAAa,CAAC,CAAC;CAgC/D"}
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.LlmGenerateObjectTool = exports.LlmGenerateObjectToolSchema = exports.LlmGenerateObjectConfigSchema = exports.LlmGenerateObjectArgsSchema = void 0;
13
+ const common_1 = require("@nestjs/common");
14
+ const zod_1 = require("zod");
15
+ const common_2 = require("@loopstack/common");
16
+ const llm_provider_registry_1 = require("../services/llm-provider-registry");
17
+ exports.LlmGenerateObjectArgsSchema = zod_1.z.object({
18
+ prompt: zod_1.z.string().optional(),
19
+ messages: zod_1.z
20
+ .array(zod_1.z.object({
21
+ role: zod_1.z.enum(['user', 'assistant']),
22
+ content: zod_1.z.union([zod_1.z.string(), zod_1.z.array(zod_1.z.any())]),
23
+ }))
24
+ .optional(),
25
+ outputSchema: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
26
+ });
27
+ exports.LlmGenerateObjectConfigSchema = zod_1.z.object({
28
+ provider: zod_1.z.string().optional(),
29
+ system: zod_1.z.string().optional(),
30
+ model: zod_1.z.string().optional(),
31
+ messagesSearchTag: zod_1.z.string().optional(),
32
+ providerConfig: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional(),
33
+ });
34
+ exports.LlmGenerateObjectToolSchema = exports.LlmGenerateObjectArgsSchema;
35
+ let LlmGenerateObjectTool = class LlmGenerateObjectTool extends common_2.BaseTool {
36
+ registry;
37
+ async call(args, options) {
38
+ const config = options?.config;
39
+ const provider = this.registry.get(config?.provider ?? 'claude');
40
+ const ctx = {
41
+ documents: this.ctx.runtime.documents,
42
+ parent: this.ctx.parent,
43
+ workspace: this.ctx.workspace,
44
+ };
45
+ const providerArgs = {
46
+ system: config?.system,
47
+ messages: args.messages,
48
+ prompt: args.prompt,
49
+ messagesSearchTag: config?.messagesSearchTag,
50
+ model: config?.model,
51
+ providerConfig: config?.providerConfig,
52
+ outputSchema: args.outputSchema,
53
+ };
54
+ const result = await provider.generateObject(providerArgs, ctx);
55
+ const usage = provider.extractUsage(result.response);
56
+ return {
57
+ data: result,
58
+ metadata: {
59
+ provider: provider.providerId,
60
+ model: config?.model ?? 'default',
61
+ ...(usage && { usage }),
62
+ },
63
+ };
64
+ }
65
+ };
66
+ exports.LlmGenerateObjectTool = LlmGenerateObjectTool;
67
+ __decorate([
68
+ (0, common_1.Inject)(),
69
+ __metadata("design:type", llm_provider_registry_1.LlmProviderRegistry)
70
+ ], LlmGenerateObjectTool.prototype, "registry", void 0);
71
+ exports.LlmGenerateObjectTool = LlmGenerateObjectTool = __decorate([
72
+ (0, common_2.Tool)({
73
+ uiConfig: {
74
+ description: 'Generates a structured object conforming to a JSON Schema using the configured LLM provider. ' +
75
+ 'Configure provider, model, and system prompt via @InjectTool config.',
76
+ },
77
+ schema: exports.LlmGenerateObjectArgsSchema,
78
+ configSchema: exports.LlmGenerateObjectConfigSchema,
79
+ })
80
+ ], LlmGenerateObjectTool);
81
+ //# sourceMappingURL=llm-generate-object.tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"llm-generate-object.tool.js","sourceRoot":"","sources":["../../src/tools/llm-generate-object.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAwC;AACxC,6BAAwB;AACxB,8CAAgF;AAEhF,6EAAwE;AAG3D,QAAA,2BAA2B,GAAG,OAAC,CAAC,MAAM,CAAC;IAClD,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,QAAQ,EAAE,OAAC;SACR,KAAK,CACJ,OAAC,CAAC,MAAM,CAAC;QACP,IAAI,EAAE,O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IAAI,CAAC,GAAG,CAAC,MAAM;YACvB,SAAS,EAAE,IAAI,CAAC,GAAG,CAAC,SAAS;SAC9B,CAAC;QAEF,MAAM,YAAY,GAAG;YACnB,MAAM,EAAE,MAAM,EAAE,MAAM;YACtB,QAAQ,EAAE,IAAI,CAAC,QAAoC;YACnD,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,iBAAiB,EAAE,MAAM,EAAE,iBAAiB;YAC5C,KAAK,EAAE,MAAM,EAAE,KAAK;YACpB,cAAc,EAAE,MAAM,EAAE,cAAc;YACtC,YAAY,EAAE,IAAI,CAAC,YAAY;SAChC,CAAC;QAEF,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,cAAc,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC;QAEhE,MAAM,KAAK,GAAG,QAAQ,CAAC,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAErD,OAAO;YACL,IAAI,EAAE,MAAM;YACZ,QAAQ,EAAE;gBACR,QAAQ,EAAE,QAAQ,CAAC,UAAU;gBAC7B,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,SAAS;gBACjC,GAAG,CAAC,KAAK,IAAI,EAAE,KAAK,EAAE,CAAC;aACxB;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AAtCY,sDAAqB;AACL;IAA1B,IAAA,eAAM,GAAE;8BAA4B,2CAAmB;uDAAC;gCAD9C,qBAAqB;IATjC,IAAA,aAAI,EAAC;QACJ,QAAQ,EAAE;YACR,WAAW,EACT,+FAA+F;gBAC/F,sEAAsE;SACzE;QACD,MAAM,EAAE,mCAA2B;QACnC,YAAY,EAAE,qCAA6B;KAC5C,CAAC;GACW,qBAAqB,CAsCjC"}
@@ -0,0 +1,39 @@
1
+ import { z } from 'zod';
2
+ import { BaseTool, ToolCallOptions, ToolResult } from '@loopstack/common';
3
+ import type { LlmGenerateTextResult, LlmResultMeta } from '../types';
4
+ export declare const LlmGenerateTextArgsSchema: z.ZodObject<{
5
+ prompt: z.ZodOptional<z.ZodString>;
6
+ messages: z.ZodOptional<z.ZodArray<z.ZodObject<{
7
+ role: z.ZodEnum<{
8
+ user: "user";
9
+ assistant: "assistant";
10
+ }>;
11
+ content: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodAny>]>;
12
+ }, z.core.$strip>>>;
13
+ }, z.core.$strip>;
14
+ export declare const LlmGenerateTextConfigSchema: z.ZodObject<{
15
+ provider: z.ZodOptional<z.ZodString>;
16
+ system: z.ZodOptional<z.ZodString>;
17
+ tools: z.ZodOptional<z.ZodArray<z.ZodString>>;
18
+ model: z.ZodOptional<z.ZodString>;
19
+ messagesSearchTag: z.ZodOptional<z.ZodString>;
20
+ providerConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
21
+ }, z.core.$strip>;
22
+ type LlmGenerateTextArgs = z.infer<typeof LlmGenerateTextArgsSchema>;
23
+ type LlmGenerateTextConfig = z.infer<typeof LlmGenerateTextConfigSchema>;
24
+ export declare const LlmGenerateTextToolSchema: z.ZodObject<{
25
+ prompt: z.ZodOptional<z.ZodString>;
26
+ messages: z.ZodOptional<z.ZodArray<z.ZodObject<{
27
+ role: z.ZodEnum<{
28
+ user: "user";
29
+ assistant: "assistant";
30
+ }>;
31
+ content: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodAny>]>;
32
+ }, z.core.$strip>>>;
33
+ }, z.core.$strip>;
34
+ export declare class LlmGenerateTextTool extends BaseTool<LlmGenerateTextArgs, LlmGenerateTextConfig> {
35
+ private readonly registry;
36
+ call(args?: LlmGenerateTextArgs, options?: ToolCallOptions<LlmGenerateTextConfig>): Promise<ToolResult<LlmGenerateTextResult, LlmResultMeta>>;
37
+ }
38
+ export {};
39
+ //# sourceMappingURL=llm-generate-text.tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"llm-generate-text.tool.d.ts","sourceRoot":"","sources":["../../src/tools/llm-generate-text.tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAQ,eAAe,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGhF,OAAO,KAAK,EAAE,qBAAqB,EAAc,aAAa,EAAE,MAAM,UAAU,CAAC;AAEjF,eAAO,MAAM,yBAAyB;;;;;;;;;iBAUpC,CAAC;AAEH,eAAO,MAAM,2BAA2B;;;;;;;iBAOtC,CAAC;AAEH,KAAK,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AACrE,KAAK,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAGzE,eAAO,MAAM,yBAAyB;;;;;;;;;iBAA4B,CAAC;AAEnE,qBASa,mBAAoB,SAAQ,QAAQ,CAAC,mBAAmB,EAAE,qBAAqB,CAAC;IACjF,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAsB;IAEnD,IAAI,CACR,IAAI,CAAC,EAAE,mBAAmB,EAC1B,OAAO,CAAC,EAAE,eAAe,CAAC,qBAAqB,CAAC,GAC/C,OAAO,CAAC,UAAU,CAAC,qBAAqB,EAAE,aAAa,CAAC,CAAC;CAgC7D"}
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.LlmGenerateTextTool = exports.LlmGenerateTextToolSchema = exports.LlmGenerateTextConfigSchema = exports.LlmGenerateTextArgsSchema = void 0;
13
+ const common_1 = require("@nestjs/common");
14
+ const zod_1 = require("zod");
15
+ const common_2 = require("@loopstack/common");
16
+ const llm_provider_registry_1 = require("../services/llm-provider-registry");
17
+ exports.LlmGenerateTextArgsSchema = zod_1.z.object({
18
+ prompt: zod_1.z.string().optional(),
19
+ messages: zod_1.z
20
+ .array(zod_1.z.object({
21
+ role: zod_1.z.enum(['user', 'assistant']),
22
+ content: zod_1.z.union([zod_1.z.string(), zod_1.z.array(zod_1.z.any())]),
23
+ }))
24
+ .optional(),
25
+ });
26
+ exports.LlmGenerateTextConfigSchema = zod_1.z.object({
27
+ provider: zod_1.z.string().optional(),
28
+ system: zod_1.z.string().optional(),
29
+ tools: zod_1.z.array(zod_1.z.string()).optional(),
30
+ model: zod_1.z.string().optional(),
31
+ messagesSearchTag: zod_1.z.string().optional(),
32
+ providerConfig: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional(),
33
+ });
34
+ exports.LlmGenerateTextToolSchema = exports.LlmGenerateTextArgsSchema;
35
+ let LlmGenerateTextTool = class LlmGenerateTextTool extends common_2.BaseTool {
36
+ registry;
37
+ async call(args, options) {
38
+ const config = options?.config;
39
+ const provider = this.registry.get(config?.provider ?? 'claude');
40
+ const ctx = {
41
+ documents: this.ctx.runtime.documents,
42
+ parent: this.ctx.parent,
43
+ workspace: this.ctx.workspace,
44
+ };
45
+ const providerArgs = {
46
+ system: config?.system,
47
+ messages: args?.messages,
48
+ prompt: args?.prompt,
49
+ messagesSearchTag: config?.messagesSearchTag,
50
+ tools: config?.tools,
51
+ model: config?.model,
52
+ providerConfig: config?.providerConfig,
53
+ };
54
+ const result = await provider.generateText(providerArgs, ctx);
55
+ const usage = provider.extractUsage(result.response);
56
+ return {
57
+ data: result,
58
+ metadata: {
59
+ provider: provider.providerId,
60
+ model: config?.model ?? 'default',
61
+ ...(usage && { usage }),
62
+ },
63
+ };
64
+ }
65
+ };
66
+ exports.LlmGenerateTextTool = LlmGenerateTextTool;
67
+ __decorate([
68
+ (0, common_1.Inject)(),
69
+ __metadata("design:type", llm_provider_registry_1.LlmProviderRegistry)
70
+ ], LlmGenerateTextTool.prototype, "registry", void 0);
71
+ exports.LlmGenerateTextTool = LlmGenerateTextTool = __decorate([
72
+ (0, common_2.Tool)({
73
+ uiConfig: {
74
+ description: 'Generates text using the configured LLM provider. ' +
75
+ 'Configure provider, model, system prompt, and tools via @InjectTool config.',
76
+ },
77
+ schema: exports.LlmGenerateTextArgsSchema,
78
+ configSchema: exports.LlmGenerateTextConfigSchema,
79
+ })
80
+ ], LlmGenerateTextTool);
81
+ //# sourceMappingURL=llm-generate-text.tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"llm-generate-text.tool.js","sourceRoot":"","sources":["../../src/tools/llm-generate-text.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAwC;AACxC,6BAAwB;AACxB,8CAAgF;AAEhF,6EAAwE;AAG3D,QAAA,yBAAyB,GAAG,OAAC,CAAC,MAAM,CAAC;IAChD,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,QAAQ,EAAE,OAAC;SACR,KAAK,CACJ,OAAC,CAAC,MAAM,CAAC;QACP,IAAI,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;QACnC,OAAO,EAAE,OAAC,CAAC,KAAK,CAAC,CAAC,OAAC,CAAC,MAAM,EAAE,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;KACjD,CAAC,CACH;SACA,QAAQ,EAAE;CACd,CAAC,CAAC;AAEU,QAAA,2BAA2B,GAAG,OAAC,CAAC,MAAM,CAAC;IAClD,QAAQ,EAAE,OAAC,CAAC,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cAAc,EAAE,MAAM,EAAE,cAAc;SACvC,CAAC;QAEF,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,YAAY,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC;QAE9D,MAAM,KAAK,GAAG,QAAQ,CAAC,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAErD,OAAO;YACL,IAAI,EAAE,MAAM;YACZ,QAAQ,EAAE;gBACR,QAAQ,EAAE,QAAQ,CAAC,UAAU;gBAC7B,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,SAAS;gBACjC,GAAG,CAAC,KAAK,IAAI,EAAE,KAAK,EAAE,CAAC;aACxB;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AAtCY,kDAAmB;AACH;IAA1B,IAAA,eAAM,GAAE;8BAA4B,2CAAmB;qDAAC;8BAD9C,mBAAmB;IAT/B,IAAA,aAAI,EAAC;QACJ,QAAQ,EAAE;YACR,WAAW,EACT,oDAAoD;gBACpD,6EAA6E;SAChF;QACD,MAAM,EAAE,iCAAyB;QACjC,YAAY,EAAE,mCAA2B;KAC1C,CAAC;GACW,mBAAmB,CAsC/B"}
@@ -0,0 +1,21 @@
1
+ import { z } from 'zod';
2
+ import { BaseTool, ToolResult } from '@loopstack/common';
3
+ import type { LlmDelegateResult } from '../types';
4
+ export declare const LlmUpdateToolResultToolSchema: z.ZodObject<{
5
+ delegateResult: z.ZodObject<{
6
+ allCompleted: z.ZodBoolean;
7
+ toolResults: z.ZodArray<z.ZodAny>;
8
+ pendingCount: z.ZodNumber;
9
+ errorCount: z.ZodOptional<z.ZodNumber>;
10
+ hasErrors: z.ZodOptional<z.ZodBoolean>;
11
+ errors: z.ZodOptional<z.ZodArray<z.ZodAny>>;
12
+ }, z.core.$strip>;
13
+ completedTool: z.ZodAny;
14
+ }, z.core.$strip>;
15
+ type LlmUpdateToolResultToolArgs = z.infer<typeof LlmUpdateToolResultToolSchema>;
16
+ export declare class LlmUpdateToolResultTool extends BaseTool {
17
+ private readonly delegateService;
18
+ call(args: LlmUpdateToolResultToolArgs): Promise<ToolResult<LlmDelegateResult>>;
19
+ }
20
+ export {};
21
+ //# sourceMappingURL=llm-update-tool-result.tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"llm-update-tool-result.tool.d.ts","sourceRoot":"","sources":["../../src/tools/llm-update-tool-result.tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAQ,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAElD,eAAO,MAAM,6BAA6B;;;;;;;;;;iBAUxC,CAAC;AAEH,KAAK,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAEjF,qBAMa,uBAAwB,SAAQ,QAAQ;IACzC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAqB;IAEzD,IAAI,CAAC,IAAI,EAAE,2BAA2B,GAAG,OAAO,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;CAUtF"}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.LlmUpdateToolResultTool = exports.LlmUpdateToolResultToolSchema = void 0;
13
+ const common_1 = require("@nestjs/common");
14
+ const zod_1 = require("zod");
15
+ const common_2 = require("@loopstack/common");
16
+ const llm_delegate_service_1 = require("../services/llm-delegate.service");
17
+ exports.LlmUpdateToolResultToolSchema = zod_1.z.object({
18
+ delegateResult: zod_1.z.object({
19
+ allCompleted: zod_1.z.boolean(),
20
+ toolResults: zod_1.z.array(zod_1.z.any()),
21
+ pendingCount: zod_1.z.number(),
22
+ errorCount: zod_1.z.number().optional(),
23
+ hasErrors: zod_1.z.boolean().optional(),
24
+ errors: zod_1.z.array(zod_1.z.any()).optional(),
25
+ }),
26
+ completedTool: zod_1.z.any(),
27
+ });
28
+ let LlmUpdateToolResultTool = class LlmUpdateToolResultTool extends common_2.BaseTool {
29
+ delegateService;
30
+ async call(args) {
31
+ const result = await this.delegateService.updateToolResult(args.delegateResult, args.completedTool, this.ctx.parent, this.ctx.workspace);
32
+ return { data: result };
33
+ }
34
+ };
35
+ exports.LlmUpdateToolResultTool = LlmUpdateToolResultTool;
36
+ __decorate([
37
+ (0, common_1.Inject)(),
38
+ __metadata("design:type", llm_delegate_service_1.LlmDelegateService)
39
+ ], LlmUpdateToolResultTool.prototype, "delegateService", void 0);
40
+ exports.LlmUpdateToolResultTool = LlmUpdateToolResultTool = __decorate([
41
+ (0, common_2.Tool)({
42
+ uiConfig: {
43
+ description: 'Handles async tool completion callbacks and updates the delegate result.',
44
+ },
45
+ schema: exports.LlmUpdateToolResultToolSchema,
46
+ })
47
+ ], LlmUpdateToolResultTool);
48
+ //# sourceMappingURL=llm-update-tool-result.tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"llm-update-tool-result.tool.js","sourceRoot":"","sources":["../../src/tools/llm-update-tool-result.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAwC;AACxC,6BAAwB;AACxB,8CAA+D;AAC/D,2EAAsE;AAGzD,QAAA,6BAA6B,GAAG,OAAC,CAAC,MA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],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
@@ -0,0 +1,18 @@
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
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./llm.types"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B"}