@polka-codes/core 0.10.10 → 0.10.13

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 (47) hide show
  1. package/package.json +1 -1
  2. package/dist/Agent/parseJsonFromMarkdown.test.d.ts +0 -1
  3. package/dist/index.js.map +0 -1
  4. package/dist/path.d.ts +0 -9
  5. package/dist/path.js +0 -68
  6. package/dist/path.js.map +0 -1
  7. package/dist/path.test.d.ts +0 -1
  8. package/dist/path.test.js +0 -82
  9. package/dist/path.test.js.map +0 -1
  10. package/dist/pricing/converter.test.d.ts +0 -1
  11. package/dist/pricing/pricing-service.test.d.ts +0 -1
  12. package/dist/skills/__tests__/discovery.test.d.ts +0 -1
  13. package/dist/skills/__tests__/validation.test.d.ts +0 -1
  14. package/dist/tools/askFollowupQuestion.test.d.ts +0 -1
  15. package/dist/tools/executeCommand.test.d.ts +0 -1
  16. package/dist/tools/index.d.ts +0 -15
  17. package/dist/tools/listFiles.test.d.ts +0 -1
  18. package/dist/tools/readFile.test.d.ts +0 -1
  19. package/dist/tools/removeFile.d.ts +0 -26
  20. package/dist/tools/removeFile.test.d.ts +0 -1
  21. package/dist/tools/renameFile.d.ts +0 -29
  22. package/dist/tools/renameFile.test.d.ts +0 -1
  23. package/dist/tools/replaceInFile.d.ts +0 -29
  24. package/dist/tools/replaceInFile.test.d.ts +0 -1
  25. package/dist/tools/search.d.ts +0 -26
  26. package/dist/tools/search.test.d.ts +0 -1
  27. package/dist/tools/searchFiles.d.ts +0 -32
  28. package/dist/tools/utils/index.d.ts +0 -1
  29. package/dist/tools/utils/replaceInFile.d.ts +0 -7
  30. package/dist/tools/utils/replaceInFile.test.d.ts +0 -1
  31. package/dist/tools/writeToFile.d.ts +0 -29
  32. package/dist/tools/writeToFile.test.d.ts +0 -1
  33. package/dist/utils/index.d.ts +0 -1
  34. package/dist/utils/merge.d.ts +0 -26
  35. package/dist/workflow/agent.workflow.d.ts +0 -39
  36. package/dist/workflow/agent.workflow.test.d.ts +0 -1
  37. package/dist/workflow/control-flow.test.d.ts +0 -1
  38. package/dist/workflow/dynamic-edge-cases.test.d.ts +0 -1
  39. package/dist/workflow/dynamic-types.d.ts +0 -124
  40. package/dist/workflow/dynamic.d.ts +0 -118
  41. package/dist/workflow/index.d.ts +0 -6
  42. package/dist/workflow/json-ai-types.d.ts +0 -122
  43. package/dist/workflow/json-schema-conversion.test.d.ts +0 -1
  44. package/dist/workflow/try-catch.test.d.ts +0 -1
  45. package/dist/workflow/types.d.ts +0 -103
  46. package/dist/workflow/workflow.d.ts +0 -29
  47. package/dist/workflow/workflow.test.d.ts +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polka-codes/core",
3
- "version": "0.10.10",
3
+ "version": "0.10.13",
4
4
  "license": "AGPL-3.0",
5
5
  "author": "github@polka.codes",
6
6
  "type": "module",
@@ -1 +0,0 @@
1
- export {};
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,MAAM,CAAA;AACpB,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,QAAQ,CAAA;AACtB,cAAc,SAAS,CAAA;AACvB,OAAO,EAAE,aAAa,IAAI,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAClF,cAAc,cAAc,CAAA;AAC5B,cAAc,SAAS,CAAA;AACvB,cAAc,2BAA2B,CAAA;AACzC,cAAc,oBAAoB,CAAA;AAClC,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA"}
package/dist/path.d.ts DELETED
@@ -1,9 +0,0 @@
1
- /**
2
- * Returns the directory portion of a path string.
3
- * Strips trailing slashes, then takes everything up to the last slash.
4
- */
5
- export declare function dirname(path: string): string;
6
- /**
7
- * Joins all given path segments, then normalizes the result.
8
- */
9
- export declare function join(...parts: string[]): string;
package/dist/path.js DELETED
@@ -1,68 +0,0 @@
1
- /**
2
- * Returns the directory portion of a path string.
3
- * Strips trailing slashes, then takes everything up to the last slash.
4
- */
5
- export function dirname(path) {
6
- if (path.length === 0)
7
- return '.';
8
- const isRooted = path[0] === '/';
9
- // Trim trailing slashes (but leave root "/")
10
- let end = path.length - 1;
11
- while (end > 0 && path[end] === '/')
12
- end--;
13
- const idx = path.lastIndexOf('/', end);
14
- if (idx < 0) {
15
- return isRooted ? '/' : '.';
16
- }
17
- if (isRooted && idx === 0) {
18
- return '/';
19
- }
20
- return path.slice(0, idx);
21
- }
22
- /**
23
- * Normalizes a path by resolving "." and ".." segments.
24
- */
25
- function normalize(path) {
26
- const isAbsolute = path.startsWith('/');
27
- const segments = path.split('/').filter(Boolean);
28
- const stack = [];
29
- for (const seg of segments) {
30
- if (seg === '.')
31
- continue;
32
- if (seg === '..') {
33
- if (stack.length && stack[stack.length - 1] !== '..') {
34
- stack.pop();
35
- }
36
- else if (!isAbsolute) {
37
- stack.push('..');
38
- }
39
- }
40
- else {
41
- stack.push(seg);
42
- }
43
- }
44
- let result = stack.join('/');
45
- if (!result && !isAbsolute)
46
- return '.';
47
- if (result && path.endsWith('/'))
48
- result += '/';
49
- return (isAbsolute ? '/' : '') + result;
50
- }
51
- /**
52
- * Joins all given path segments, then normalizes the result.
53
- */
54
- export function join(...parts) {
55
- if (parts.length === 0)
56
- return '.';
57
- let combined = '';
58
- for (const p of parts) {
59
- if (typeof p !== 'string') {
60
- throw new TypeError('Arguments to join must be strings');
61
- }
62
- if (p) {
63
- combined = combined ? `${combined}/${p}` : p;
64
- }
65
- }
66
- return normalize(combined);
67
- }
68
- //# sourceMappingURL=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.js DELETED
@@ -1,82 +0,0 @@
1
- // generated by polka.codes
2
- import { describe, expect, it } from 'bun:test';
3
- import { dirname, join } from './path';
4
- describe('dirname', () => {
5
- it('should return dot for empty string', () => {
6
- expect(dirname('')).toBe('.');
7
- });
8
- it('should return dot for simple filename', () => {
9
- expect(dirname('file.txt')).toBe('.');
10
- });
11
- it('should return directory for simple path', () => {
12
- expect(dirname('dir/file.txt')).toBe('dir');
13
- });
14
- it('should handle nested paths', () => {
15
- expect(dirname('a/b/c/file.txt')).toBe('a/b/c');
16
- });
17
- it('should return root for file at root', () => {
18
- expect(dirname('/file.txt')).toBe('/');
19
- });
20
- it('should handle root directory', () => {
21
- expect(dirname('/')).toBe('/');
22
- });
23
- it('should handle absolute paths', () => {
24
- expect(dirname('/home/user/file.txt')).toBe('/home/user');
25
- });
26
- it('should strip trailing slashes', () => {
27
- expect(dirname('dir/')).toBe('.');
28
- expect(dirname('dir/subdir/')).toBe('dir');
29
- expect(dirname('/dir/subdir/')).toBe('/dir');
30
- });
31
- it('should handle multiple trailing slashes', () => {
32
- expect(dirname('dir///')).toBe('.');
33
- });
34
- });
35
- describe('join', () => {
36
- it('should return dot for no arguments', () => {
37
- expect(join()).toBe('.');
38
- });
39
- it('should return single argument as-is', () => {
40
- expect(join('file.txt')).toBe('file.txt');
41
- });
42
- it('should join two parts', () => {
43
- expect(join('dir', 'file.txt')).toBe('dir/file.txt');
44
- });
45
- it('should join multiple parts', () => {
46
- expect(join('a', 'b', 'c')).toBe('a/b/c');
47
- });
48
- it('should handle absolute paths', () => {
49
- expect(join('/home', 'user')).toBe('/home/user');
50
- });
51
- it('should normalize dots', () => {
52
- expect(join('a', '.', 'b')).toBe('a/b');
53
- });
54
- it('should normalize double dots', () => {
55
- expect(join('a', 'b', '..', 'c')).toBe('a/c');
56
- });
57
- it('should handle double dots at start', () => {
58
- expect(join('..', 'a')).toBe('../a');
59
- });
60
- it('should handle empty segments', () => {
61
- expect(join('a', '', 'b')).toBe('a/b');
62
- });
63
- it('should throw for non-string arguments', () => {
64
- expect(() => join(123)).toThrow('Arguments to join must be strings');
65
- });
66
- it('should handle leading slashes in non-first parts', () => {
67
- expect(join('/home', '/user')).toBe('/home/user');
68
- });
69
- it('should handle trailing slashes', () => {
70
- expect(join('a/', 'b')).toBe('a/b');
71
- });
72
- it('should handle complex normalization', () => {
73
- expect(join('a', '../b', './c')).toBe('b/c');
74
- });
75
- it('should handle absolute path with parent references', () => {
76
- expect(join('/a/b', '../c')).toBe('/a/c');
77
- });
78
- it('should not go above root for absolute paths', () => {
79
- expect(join('/', '..')).toBe('/');
80
- });
81
- });
82
- //# sourceMappingURL=path.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"path.test.js","sourceRoot":"","sources":["../src/path.test.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,UAAU,CAAA;AAC/C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAEtC,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;IACvB,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAC5C,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAC/B,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;QAC/C,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACvC,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,yCAAyC,EAAE,GAAG,EAAE;QACjD,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAC7C,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,4BAA4B,EAAE,GAAG,EAAE;QACpC,MAAM,CAAC,OAAO,CAAC,gBAAgB,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 -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,15 +0,0 @@
1
- export { default as askFollowupQuestion } from './askFollowupQuestion';
2
- export { default as executeCommand } from './executeCommand';
3
- export { default as fetchUrl } from './fetchUrl';
4
- export { default as listFiles } from './listFiles';
5
- export * from './provider';
6
- export { default as readBinaryFile } from './readBinaryFile';
7
- export { default as readFile } from './readFile';
8
- export { default as removeFile } from './removeFile';
9
- export { default as renameFile } from './renameFile';
10
- export { default as replaceInFile } from './replaceInFile';
11
- export { createErrorResponse, createProviderErrorResponse, createSuccessResponse, createValidationErrorResponse, } from './response-builders';
12
- export { default as search } from './search';
13
- export { default as searchFiles } from './searchFiles';
14
- export * from './todo';
15
- export { default as writeToFile } from './writeToFile';
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,26 +0,0 @@
1
- import { z } from 'zod';
2
- import type { ToolHandler } from '../tool';
3
- import type { FilesystemProvider } from './provider';
4
- export declare const toolInfo: {
5
- readonly name: "removeFile";
6
- readonly description: "Request to remove a file at the specified path.";
7
- readonly parameters: z.ZodObject<{
8
- path: z.ZodString;
9
- }, z.core.$strip>;
10
- };
11
- export declare const handler: ToolHandler<typeof toolInfo, FilesystemProvider>;
12
- declare const _default: {
13
- handler: ToolHandler<{
14
- readonly name: "removeFile";
15
- readonly description: "Request to remove a file at the specified path.";
16
- readonly parameters: z.ZodObject<{
17
- path: z.ZodString;
18
- }, z.core.$strip>;
19
- }, FilesystemProvider>;
20
- name: "removeFile";
21
- description: "Request to remove a file at the specified path.";
22
- parameters: z.ZodObject<{
23
- path: z.ZodString;
24
- }, z.core.$strip>;
25
- };
26
- export default _default;
@@ -1 +0,0 @@
1
- export {};
@@ -1,29 +0,0 @@
1
- import { z } from 'zod';
2
- import type { ToolHandler } from '../tool';
3
- import type { FilesystemProvider } from './provider';
4
- export declare const toolInfo: {
5
- readonly name: "renameFile";
6
- readonly description: "Request to rename a file from source path to target path.";
7
- readonly parameters: z.ZodObject<{
8
- source_path: z.ZodString;
9
- target_path: z.ZodString;
10
- }, z.core.$strip>;
11
- };
12
- export declare const handler: ToolHandler<typeof toolInfo, FilesystemProvider>;
13
- declare const _default: {
14
- handler: ToolHandler<{
15
- readonly name: "renameFile";
16
- readonly description: "Request to rename a file from source path to target path.";
17
- readonly parameters: z.ZodObject<{
18
- source_path: z.ZodString;
19
- target_path: z.ZodString;
20
- }, z.core.$strip>;
21
- }, FilesystemProvider>;
22
- name: "renameFile";
23
- description: "Request to rename a file from source path to target path.";
24
- parameters: z.ZodObject<{
25
- source_path: z.ZodString;
26
- target_path: z.ZodString;
27
- }, z.core.$strip>;
28
- };
29
- export default _default;
@@ -1 +0,0 @@
1
- export {};
@@ -1,29 +0,0 @@
1
- import { z } from 'zod';
2
- import type { ToolHandler } from '../tool';
3
- import type { FilesystemProvider } from './provider';
4
- export declare const toolInfo: {
5
- readonly name: "replaceInFile";
6
- readonly description: "Request to replace sections of content in an existing file using\nSEARCH/REPLACE blocks.\n\nWhen to use:\n- Making targeted changes to specific parts of a file\n- Replacing variable names, function signatures, imports\n- Fixing bugs in existing code\n- When you know the exact content to replace\n\nWhen NOT to use:\n- For creating new files: Use writeToFile instead\n- For completely replacing file contents: Use writeToFile instead\n- When you don't know the exact content: Read file first\n\nSEARCH/REPLACE FORMAT:\n<<<<<<< SEARCH\n[exact content to find]\n=======\n[new content to replace with]\n>>>>>>> REPLACE\n\nCritical rules:\n1. SEARCH content must match EXACTLY (character-for-character including whitespace)\n2. Each block replaces only first occurrence\n3. Include just enough lines for uniqueness (not too many, not too few)\n4. Keep blocks concise (don't include long unchanged sections)\n5. List blocks in order they appear in file\n6. Use multiple blocks for multiple independent changes\n\nSpecial operations:\n- Move code: Two blocks (delete from original + insert at new location)\n- Delete code: Empty REPLACE section\n\nIMPORTANT CONSTRAINTS:\n- SEARCH text must match file content exactly\n- Each block is independent (doesn't affect other blocks)\n- Cannot use for appending or inserting without SEARCH context";
7
- readonly parameters: z.ZodObject<{
8
- path: z.ZodString;
9
- diff: z.ZodString;
10
- }, z.core.$strip>;
11
- };
12
- export declare const handler: ToolHandler<typeof toolInfo, FilesystemProvider>;
13
- declare const _default: {
14
- handler: ToolHandler<{
15
- readonly name: "replaceInFile";
16
- readonly description: "Request to replace sections of content in an existing file using\nSEARCH/REPLACE blocks.\n\nWhen to use:\n- Making targeted changes to specific parts of a file\n- Replacing variable names, function signatures, imports\n- Fixing bugs in existing code\n- When you know the exact content to replace\n\nWhen NOT to use:\n- For creating new files: Use writeToFile instead\n- For completely replacing file contents: Use writeToFile instead\n- When you don't know the exact content: Read file first\n\nSEARCH/REPLACE FORMAT:\n<<<<<<< SEARCH\n[exact content to find]\n=======\n[new content to replace with]\n>>>>>>> REPLACE\n\nCritical rules:\n1. SEARCH content must match EXACTLY (character-for-character including whitespace)\n2. Each block replaces only first occurrence\n3. Include just enough lines for uniqueness (not too many, not too few)\n4. Keep blocks concise (don't include long unchanged sections)\n5. List blocks in order they appear in file\n6. Use multiple blocks for multiple independent changes\n\nSpecial operations:\n- Move code: Two blocks (delete from original + insert at new location)\n- Delete code: Empty REPLACE section\n\nIMPORTANT CONSTRAINTS:\n- SEARCH text must match file content exactly\n- Each block is independent (doesn't affect other blocks)\n- Cannot use for appending or inserting without SEARCH context";
17
- readonly parameters: z.ZodObject<{
18
- path: z.ZodString;
19
- diff: z.ZodString;
20
- }, z.core.$strip>;
21
- }, FilesystemProvider>;
22
- name: "replaceInFile";
23
- description: "Request to replace sections of content in an existing file using\nSEARCH/REPLACE blocks.\n\nWhen to use:\n- Making targeted changes to specific parts of a file\n- Replacing variable names, function signatures, imports\n- Fixing bugs in existing code\n- When you know the exact content to replace\n\nWhen NOT to use:\n- For creating new files: Use writeToFile instead\n- For completely replacing file contents: Use writeToFile instead\n- When you don't know the exact content: Read file first\n\nSEARCH/REPLACE FORMAT:\n<<<<<<< SEARCH\n[exact content to find]\n=======\n[new content to replace with]\n>>>>>>> REPLACE\n\nCritical rules:\n1. SEARCH content must match EXACTLY (character-for-character including whitespace)\n2. Each block replaces only first occurrence\n3. Include just enough lines for uniqueness (not too many, not too few)\n4. Keep blocks concise (don't include long unchanged sections)\n5. List blocks in order they appear in file\n6. Use multiple blocks for multiple independent changes\n\nSpecial operations:\n- Move code: Two blocks (delete from original + insert at new location)\n- Delete code: Empty REPLACE section\n\nIMPORTANT CONSTRAINTS:\n- SEARCH text must match file content exactly\n- Each block is independent (doesn't affect other blocks)\n- Cannot use for appending or inserting without SEARCH context";
24
- parameters: z.ZodObject<{
25
- path: z.ZodString;
26
- diff: z.ZodString;
27
- }, z.core.$strip>;
28
- };
29
- export default _default;
@@ -1 +0,0 @@
1
- export {};
@@ -1,26 +0,0 @@
1
- import { z } from 'zod';
2
- import type { ToolHandler } from '../tool';
3
- import type { WebProvider } from './provider';
4
- export declare const toolInfo: {
5
- readonly name: "search";
6
- readonly description: "Search the web for information using Google Search. Use this tool to find current information, facts, news, documentation, or research that is not available in your training data. Returns comprehensive search results with relevant content extracted from the web.";
7
- readonly parameters: z.ZodObject<{
8
- query: z.ZodString;
9
- }, z.core.$strip>;
10
- };
11
- export declare const handler: ToolHandler<typeof toolInfo, WebProvider>;
12
- declare const _default: {
13
- handler: ToolHandler<{
14
- readonly name: "search";
15
- readonly description: "Search the web for information using Google Search. Use this tool to find current information, facts, news, documentation, or research that is not available in your training data. Returns comprehensive search results with relevant content extracted from the web.";
16
- readonly parameters: z.ZodObject<{
17
- query: z.ZodString;
18
- }, z.core.$strip>;
19
- }, WebProvider>;
20
- name: "search";
21
- description: "Search the web for information using Google Search. Use this tool to find current information, facts, news, documentation, or research that is not available in your training data. Returns comprehensive search results with relevant content extracted from the web.";
22
- parameters: z.ZodObject<{
23
- query: z.ZodString;
24
- }, z.core.$strip>;
25
- };
26
- export default _default;
@@ -1 +0,0 @@
1
- export {};
@@ -1,32 +0,0 @@
1
- import { z } from 'zod';
2
- import type { ToolHandler } from '../tool';
3
- import type { FilesystemProvider } from './provider';
4
- export declare const toolInfo: {
5
- readonly name: "searchFiles";
6
- readonly description: "Request to perform a regex search across files in a specified directory, outputting context-rich results that include surrounding lines. This tool searches for patterns or specific content across multiple files, displaying each match with encapsulating context.";
7
- readonly parameters: z.ZodObject<{
8
- path: z.ZodString;
9
- regex: z.ZodString;
10
- filePattern: z.ZodOptional<z.ZodString>;
11
- }, z.core.$strip>;
12
- };
13
- export declare const handler: ToolHandler<typeof toolInfo, FilesystemProvider>;
14
- declare const _default: {
15
- handler: ToolHandler<{
16
- readonly name: "searchFiles";
17
- readonly description: "Request to perform a regex search across files in a specified directory, outputting context-rich results that include surrounding lines. This tool searches for patterns or specific content across multiple files, displaying each match with encapsulating context.";
18
- readonly parameters: z.ZodObject<{
19
- path: z.ZodString;
20
- regex: z.ZodString;
21
- filePattern: z.ZodOptional<z.ZodString>;
22
- }, z.core.$strip>;
23
- }, FilesystemProvider>;
24
- name: "searchFiles";
25
- description: "Request to perform a regex search across files in a specified directory, outputting context-rich results that include surrounding lines. This tool searches for patterns or specific content across multiple files, displaying each match with encapsulating context.";
26
- parameters: z.ZodObject<{
27
- path: z.ZodString;
28
- regex: z.ZodString;
29
- filePattern: z.ZodOptional<z.ZodString>;
30
- }, z.core.$strip>;
31
- };
32
- export default _default;
@@ -1 +0,0 @@
1
- export * from './replaceInFile';
@@ -1,7 +0,0 @@
1
- export type ReplaceResult = {
2
- content: string;
3
- status: 'no_diff_applied' | 'some_diff_applied' | 'all_diff_applied';
4
- appliedCount: number;
5
- totalCount: number;
6
- };
7
- export declare const replaceInFile: (fileContent: string, diff: string) => ReplaceResult;
@@ -1 +0,0 @@
1
- export {};
@@ -1,29 +0,0 @@
1
- import { z } from 'zod';
2
- import type { ToolHandler } from '../tool';
3
- import type { FilesystemProvider } from './provider';
4
- export declare const toolInfo: {
5
- readonly name: "writeToFile";
6
- readonly description: "Request to write content to a file at the specified path.\n\nWhen to use:\n- Creating new files\n- Completely replacing file contents\n- When you have the complete intended content\n\nWhen NOT to use:\n- For modifying existing files: Use replaceInFile instead\n- For appending content: Use executeCommand with echo >> instead\n- For targeted edits: Use replaceInFile instead\n\nFeatures:\n- Automatically creates any directories needed\n- Overwrites existing files completely\n- Must provide complete file content (no truncation)\n\nIMPORTANT CONSTRAINT:\n- Always provide COMPLETE intended content (no omissions)\n- Ensure no incorrect escape sequences (&lt;, &gt;, &amp;)\n- Ensure no unwanted CDATA tags in content";
7
- readonly parameters: z.ZodObject<{
8
- path: z.ZodString;
9
- content: z.ZodString;
10
- }, z.core.$strip>;
11
- };
12
- export declare const handler: ToolHandler<typeof toolInfo, FilesystemProvider>;
13
- declare const _default: {
14
- handler: ToolHandler<{
15
- readonly name: "writeToFile";
16
- readonly description: "Request to write content to a file at the specified path.\n\nWhen to use:\n- Creating new files\n- Completely replacing file contents\n- When you have the complete intended content\n\nWhen NOT to use:\n- For modifying existing files: Use replaceInFile instead\n- For appending content: Use executeCommand with echo >> instead\n- For targeted edits: Use replaceInFile instead\n\nFeatures:\n- Automatically creates any directories needed\n- Overwrites existing files completely\n- Must provide complete file content (no truncation)\n\nIMPORTANT CONSTRAINT:\n- Always provide COMPLETE intended content (no omissions)\n- Ensure no incorrect escape sequences (&lt;, &gt;, &amp;)\n- Ensure no unwanted CDATA tags in content";
17
- readonly parameters: z.ZodObject<{
18
- path: z.ZodString;
19
- content: z.ZodString;
20
- }, z.core.$strip>;
21
- }, FilesystemProvider>;
22
- name: "writeToFile";
23
- description: "Request to write content to a file at the specified path.\n\nWhen to use:\n- Creating new files\n- Completely replacing file contents\n- When you have the complete intended content\n\nWhen NOT to use:\n- For modifying existing files: Use replaceInFile instead\n- For appending content: Use executeCommand with echo >> instead\n- For targeted edits: Use replaceInFile instead\n\nFeatures:\n- Automatically creates any directories needed\n- Overwrites existing files completely\n- Must provide complete file content (no truncation)\n\nIMPORTANT CONSTRAINT:\n- Always provide COMPLETE intended content (no omissions)\n- Ensure no incorrect escape sequences (&lt;, &gt;, &amp;)\n- Ensure no unwanted CDATA tags in content";
24
- parameters: z.ZodObject<{
25
- path: z.ZodString;
26
- content: z.ZodString;
27
- }, z.core.$strip>;
28
- };
29
- export default _default;
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export { deepMerge } from './merge';
@@ -1,26 +0,0 @@
1
- /**
2
- * Deep merge utility with EXPLICIT path specification
3
- *
4
- * This utility performs a shallow merge by default, with deep merging
5
- * ONLY for paths explicitly specified. This prevents accidental deep
6
- * merging of unexpected properties.
7
- *
8
- * @example
9
- * ```typescript
10
- * const config = { a: 1, b: { x: 1, y: 2 }, c: { z: 3 } }
11
- * const override = { a: 2, b: { x: 10 }, c: 'not-an-object' }
12
- *
13
- * // Deep merge only 'b', shallow merge everything else
14
- * const result = deepMerge(config, override, ['b'])
15
- * // Result: { a: 2, b: { x: 10, y: 2 }, c: 'not-an-object' }
16
- *
17
- * // Note: 'c' was NOT deep merged because it's not in deepPaths
18
- * // Note: 'b.x' was updated while 'b.y' was preserved (deep merge)
19
- * ```
20
- *
21
- * @param base - The base object to merge into
22
- * @param override - The object with values to override
23
- * @param deepPaths - Array of keys that should be deep merged (must be plain objects)
24
- * @returns A new object with merged values
25
- */
26
- export declare function deepMerge<T extends object>(base: T, override: Partial<T>, deepPaths: Array<keyof T>): T;
@@ -1,39 +0,0 @@
1
- import { type ToolSet } from 'ai';
2
- import { z } from 'zod';
3
- import type { FullToolInfo, ToolResponse } from '../tool';
4
- import type { JsonModelMessage, JsonResponseMessage, JsonUserModelMessage } from './json-ai-types';
5
- import { type ExitReason, type TaskEvent } from './types';
6
- import type { WorkflowFn } from './workflow';
7
- export type AgentWorkflowInput = {
8
- tools: Readonly<FullToolInfo[]>;
9
- maxToolRoundTrips?: number;
10
- userMessage: readonly JsonUserModelMessage[];
11
- outputSchema?: z.ZodSchema;
12
- model?: string;
13
- } & ({
14
- messages: JsonModelMessage[];
15
- } | {
16
- systemPrompt: string;
17
- });
18
- export type AgentToolRegistry = {
19
- generateText: {
20
- input: {
21
- messages: JsonModelMessage[];
22
- tools: ToolSet;
23
- model?: string;
24
- };
25
- output: JsonResponseMessage[];
26
- };
27
- taskEvent: {
28
- input: TaskEvent;
29
- output: void;
30
- };
31
- invokeTool: {
32
- input: {
33
- toolName: string;
34
- input: unknown;
35
- };
36
- output: ToolResponse;
37
- };
38
- };
39
- export declare const agentWorkflow: WorkflowFn<AgentWorkflowInput, ExitReason, AgentToolRegistry>;
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,124 +0,0 @@
1
- import { z } from 'zod';
2
- export type ValidationResult = {
3
- success: true;
4
- } | {
5
- success: false;
6
- errors: string[];
7
- };
8
- export interface WhileLoopStep {
9
- id: string;
10
- while: {
11
- condition: string;
12
- steps: WorkflowControlFlowStep[];
13
- };
14
- output?: string | null;
15
- }
16
- export interface IfElseStep {
17
- id: string;
18
- if: {
19
- condition: string;
20
- thenBranch: WorkflowControlFlowStep[];
21
- elseBranch?: WorkflowControlFlowStep[];
22
- };
23
- output?: string | null;
24
- }
25
- export interface BreakStep {
26
- break: true;
27
- }
28
- export interface ContinueStep {
29
- continue: true;
30
- }
31
- export interface TryCatchStep {
32
- id: string;
33
- try: {
34
- trySteps: WorkflowControlFlowStep[];
35
- catchSteps: WorkflowControlFlowStep[];
36
- };
37
- output?: string | null;
38
- }
39
- export type WorkflowControlFlowStep = z.infer<typeof WorkflowStepDefinitionSchema> | WhileLoopStep | IfElseStep | BreakStep | ContinueStep | TryCatchStep;
40
- export declare const WorkflowInputDefinitionSchema: z.ZodObject<{
41
- id: z.ZodString;
42
- description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
43
- default: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
44
- }, z.core.$strip>;
45
- /**
46
- * Basic workflow step - executes a task
47
- */
48
- export declare const WorkflowStepDefinitionSchema: z.ZodObject<{
49
- id: z.ZodString;
50
- tools: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
51
- task: z.ZodString;
52
- output: z.ZodOptional<z.ZodNullable<z.ZodString>>;
53
- expected_outcome: z.ZodOptional<z.ZodNullable<z.ZodString>>;
54
- outputSchema: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
55
- timeout: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
56
- }, z.core.$strip>;
57
- /**
58
- * Control flow step types
59
- */
60
- /**
61
- * While loop - repeats steps while condition is true
62
- */
63
- export declare const WhileLoopStepSchema: z.ZodType<WhileLoopStep>;
64
- /**
65
- * If/else branch - conditionally executes steps
66
- */
67
- export declare const IfElseStepSchema: z.ZodType<IfElseStep>;
68
- /**
69
- * Break statement - exits the nearest enclosing loop
70
- */
71
- export declare const BreakStepSchema: z.ZodObject<{
72
- break: z.ZodLiteral<true>;
73
- }, z.core.$strip>;
74
- /**
75
- * Continue statement - skips to next iteration of nearest enclosing loop
76
- */
77
- export declare const ContinueStepSchema: z.ZodObject<{
78
- continue: z.ZodLiteral<true>;
79
- }, z.core.$strip>;
80
- /**
81
- * Try/catch block - error handling
82
- */
83
- export declare const TryCatchStepSchema: z.ZodObject<{
84
- id: z.ZodString;
85
- try: z.ZodObject<{
86
- trySteps: z.ZodArray<z.ZodLazy<z.ZodType<WorkflowControlFlowStep, unknown, z.core.$ZodTypeInternals<WorkflowControlFlowStep, unknown>>>>;
87
- catchSteps: z.ZodArray<z.ZodLazy<z.ZodType<WorkflowControlFlowStep, unknown, z.core.$ZodTypeInternals<WorkflowControlFlowStep, unknown>>>>;
88
- }, z.core.$strip>;
89
- output: z.ZodOptional<z.ZodNullable<z.ZodString>>;
90
- }, z.core.$strip>;
91
- /**
92
- * Any step that can appear in a workflow's steps array
93
- * Can be a basic step, control flow, or jump statement
94
- */
95
- export declare const WorkflowControlFlowStepSchema: z.ZodType<WorkflowControlFlowStep>;
96
- /**
97
- * Workflow definition - now supports control flow in steps
98
- */
99
- export declare const WorkflowDefinitionSchema: z.ZodObject<{
100
- task: z.ZodString;
101
- inputs: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
102
- id: z.ZodString;
103
- description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
104
- default: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
105
- }, z.core.$strip>>>>;
106
- steps: z.ZodArray<z.ZodType<WorkflowControlFlowStep, unknown, z.core.$ZodTypeInternals<WorkflowControlFlowStep, unknown>>>;
107
- output: z.ZodOptional<z.ZodNullable<z.ZodString>>;
108
- }, z.core.$strip>;
109
- export declare const WorkflowFileSchema: z.ZodObject<{
110
- workflows: z.ZodRecord<z.ZodString, z.ZodObject<{
111
- task: z.ZodString;
112
- inputs: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
113
- id: z.ZodString;
114
- description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
115
- default: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
116
- }, z.core.$strip>>>>;
117
- steps: z.ZodArray<z.ZodType<WorkflowControlFlowStep, unknown, z.core.$ZodTypeInternals<WorkflowControlFlowStep, unknown>>>;
118
- output: z.ZodOptional<z.ZodNullable<z.ZodString>>;
119
- }, z.core.$strip>>;
120
- }, z.core.$strip>;
121
- export type WorkflowInputDefinition = z.infer<typeof WorkflowInputDefinitionSchema>;
122
- export type WorkflowStepDefinition = z.infer<typeof WorkflowStepDefinitionSchema>;
123
- export type WorkflowDefinition = z.infer<typeof WorkflowDefinitionSchema>;
124
- export type WorkflowFile = z.infer<typeof WorkflowFileSchema>;
@@ -1,118 +0,0 @@
1
- import { z } from 'zod';
2
- import type { FullToolInfo } from '../tool';
3
- import { type ValidationResult, type WorkflowFile, type WorkflowStepDefinition } from './dynamic-types';
4
- import type { BaseWorkflowContext, Logger, StepFn, ToolRegistry, WorkflowFn, WorkflowTools } from './workflow';
5
- /**
6
- * JSON Schema type to Zod type mapping
7
- */
8
- type JsonSchemaType = 'string' | 'number' | 'integer' | 'boolean' | 'object' | 'array' | 'null';
9
- /**
10
- * JSON Schema enum values - can be string, number, or boolean
11
- */
12
- type JsonSchemaEnum = (string | number | boolean)[];
13
- interface JsonSchema {
14
- type?: JsonSchemaType | JsonSchemaType[];
15
- enum?: JsonSchemaEnum;
16
- properties?: Record<string, JsonSchema>;
17
- required?: string[];
18
- items?: JsonSchema;
19
- additionalProperties?: boolean | JsonSchema;
20
- description?: string;
21
- [key: string]: unknown;
22
- }
23
- /**
24
- * Convert a JSON Schema to a Zod schema
25
- * Supports a subset of JSON SchemaDraft 7
26
- *
27
- * This is exported to allow reuse in other parts of the codebase that need to
28
- * convert JSON schemas to Zod schemas (e.g., MCP server tool schema conversion).
29
- */
30
- export declare function convertJsonSchemaToZod(schema: JsonSchema): z.ZodTypeAny;
31
- /**
32
- * Tool groups that can be used in step.tools arrays.
33
- * - "readonly": File reading operations only
34
- * - "readwrite": Full file system access
35
- * - "internet": Network operations (fetch, search)
36
- * - "all": All available tools (special keyword, not in this map)
37
- */
38
- export declare const TOOL_GROUPS: Record<string, string[]>;
39
- /**
40
- * Type for the runWorkflow tool that allows workflows to call other workflows
41
- */
42
- export type RunWorkflowTool = {
43
- input: {
44
- workflowId: string;
45
- input?: Record<string, unknown>;
46
- };
47
- output: unknown;
48
- };
49
- export type DynamicWorkflowRegistry = ToolRegistry & {
50
- runWorkflow: RunWorkflowTool;
51
- };
52
- export type DynamicWorkflowParseResult = {
53
- success: true;
54
- definition: WorkflowFile;
55
- } | {
56
- success: false;
57
- error: string;
58
- };
59
- /**
60
- * Validate a workflow file for common issues
61
- */
62
- export declare function validateWorkflowFile(definition: WorkflowFile): ValidationResult;
63
- export declare function parseDynamicWorkflowDefinition(source: string): DynamicWorkflowParseResult;
64
- export type DynamicStepRuntimeContext<TTools extends ToolRegistry> = {
65
- workflowId: string;
66
- stepId: string;
67
- input: Record<string, unknown>;
68
- state: Record<string, unknown>;
69
- tools: WorkflowTools<TTools>;
70
- logger: Logger;
71
- step: StepFn;
72
- runWorkflow: (workflowId: string, input?: Record<string, unknown>) => Promise<unknown>;
73
- toolInfo: Readonly<FullToolInfo[]> | undefined;
74
- agentTools: Record<string, (input: unknown) => Promise<unknown>>;
75
- };
76
- export type DynamicWorkflowRunnerOptions = {
77
- /**
78
- * Tool definitions used when a step does not have persisted `code`
79
- * and needs to be executed via `agentWorkflow`.
80
- */
81
- toolInfo?: Readonly<FullToolInfo[]>;
82
- /**
83
- * Model id forwarded to `agentWorkflow` for agent-executed steps.
84
- */
85
- model?: string;
86
- /**
87
- * Maximum round trips for agent-executed steps.
88
- */
89
- maxToolRoundTrips?: number;
90
- /**
91
- * Customize per-step system prompt for agent-executed steps.
92
- */
93
- stepSystemPrompt?: (args: {
94
- workflowId: string;
95
- step: WorkflowStepDefinition;
96
- input: Record<string, unknown>;
97
- state: Record<string, unknown>;
98
- }) => string;
99
- /**
100
- * Whether to wrap plain text agent responses in an object { result: ... }.
101
- * Defaults to false.
102
- */
103
- wrapAgentResultInObject?: boolean;
104
- /**
105
- * Built-in workflows that can be called by name if not found in the definition.
106
- */
107
- builtInWorkflows?: Record<string, WorkflowFn<any, any, any>>;
108
- /**
109
- * Allow unsafe code execution in condition expressions.
110
- * When false (default), only simple comparisons and property access are allowed.
111
- * When true, arbitrary JavaScript code can be executed in conditions.
112
- * WARNING: Setting to true with untrusted workflow definitions is a security risk.
113
- * @default false
114
- */
115
- allowUnsafeCodeExecution?: boolean;
116
- };
117
- export declare function createDynamicWorkflow<TTools extends ToolRegistry = DynamicWorkflowRegistry, TContext extends BaseWorkflowContext<TTools> = BaseWorkflowContext<TTools>>(definition: WorkflowFile | string, options?: DynamicWorkflowRunnerOptions): (workflowId: string, input: Record<string, unknown>, context: TContext) => Promise<unknown>;
118
- export {};
@@ -1,6 +0,0 @@
1
- export * from './agent.workflow';
2
- export * from './dynamic';
3
- export * from './dynamic-types';
4
- export * from './json-ai-types';
5
- export * from './types';
6
- export * from './workflow';
@@ -1,122 +0,0 @@
1
- import type { JSONValue } from '@ai-sdk/provider';
2
- import type { ModelMessage, ProviderOptions, ReasoningPart, SystemModelMessage, TextPart, ToolApprovalRequest, ToolModelMessage, ToolResultPart } from '@ai-sdk/provider-utils';
3
- type JsonDataContent = {
4
- type: 'base64' | 'url';
5
- value: string;
6
- };
7
- export interface JsonImagePart {
8
- type: 'image';
9
- /**
10
- Image data. Can either be:
11
-
12
- - data: a base64-encoded string, a Uint8Array, an ArrayBuffer, or a Buffer
13
- - URL: a URL that points to the image
14
- */
15
- image: JsonDataContent;
16
- /**
17
- Optional IANA media type of the image.
18
-
19
- @see https://www.iana.org/assignments/media-types/media-types.xhtml
20
- */
21
- mediaType?: string;
22
- /**
23
- Additional provider-specific metadata. They are passed through
24
- to the provider from the AI SDK and enable provider-specific
25
- functionality that can be fully encapsulated in the provider.
26
- */
27
- providerOptions?: ProviderOptions;
28
- }
29
- /**
30
- File content part of a prompt. It contains a file.
31
- */
32
- export interface JsonFilePart {
33
- type: 'file';
34
- /**
35
- File data. Can either be:
36
-
37
- - data: a base64-encoded string, a Uint8Array, an ArrayBuffer, or a Buffer
38
- - URL: a URL that points to the image
39
- */
40
- data: JsonDataContent;
41
- /**
42
- Optional filename of the file.
43
- */
44
- filename?: string;
45
- /**
46
- IANA media type of the file.
47
-
48
- @see https://www.iana.org/assignments/media-types/media-types.xhtml
49
- */
50
- mediaType: string;
51
- /**
52
- Additional provider-specific metadata. They are passed through
53
- to the provider from the AI SDK and enable provider-specific
54
- functionality that can be fully encapsulated in the provider.
55
- */
56
- providerOptions?: ProviderOptions;
57
- }
58
- /**
59
- A user message. It can contain text or a combination of text and images.
60
- */
61
- export type JsonUserModelMessage = {
62
- role: 'user';
63
- content: JsonUserContent;
64
- /**
65
- Additional provider-specific metadata. They are passed through
66
- to the provider from the AI SDK and enable provider-specific
67
- functionality that can be fully encapsulated in the provider.
68
- */
69
- providerOptions?: ProviderOptions;
70
- };
71
- /**
72
- Content of a user message. It can be a string or an array of text and image parts.
73
- */
74
- export type JsonUserContent = string | Array<TextPart | JsonImagePart | JsonFilePart>;
75
- /**
76
- An assistant message. It can contain text, tool calls, or a combination of text and tool calls.
77
- */
78
- type JsonAssistantModelMessage = {
79
- role: 'assistant';
80
- content: JsonAssistantContent;
81
- /**
82
- Additional provider-specific metadata. They are passed through
83
- to the provider from the AI SDK and enable provider-specific
84
- functionality that can be fully encapsulated in the provider.
85
- */
86
- providerOptions?: ProviderOptions;
87
- };
88
- interface JsonToolCallPart {
89
- type: 'tool-call';
90
- /**
91
- ID of the tool call. This ID is used to match the tool call with the tool result.
92
- */
93
- toolCallId: string;
94
- /**
95
- Name of the tool that is being called.
96
- */
97
- toolName: string;
98
- /**
99
- Arguments of the tool call. This is a JSON-serializable object that matches the tool's input schema.
100
- */
101
- input: JSONValue;
102
- /**
103
- Additional provider-specific metadata. They are passed through
104
- to the provider from the AI SDK and enable provider-specific
105
- functionality that can be fully encapsulated in the provider.
106
- */
107
- providerOptions?: ProviderOptions;
108
- /**
109
- Whether the tool call was executed by the provider.
110
- */
111
- providerExecuted?: boolean;
112
- }
113
- /**
114
- Content of an assistant message.
115
- It can be a string or an array of text, image, reasoning, redacted reasoning, and tool call parts.
116
- */
117
- type JsonAssistantContent = string | Array<TextPart | JsonFilePart | ReasoningPart | JsonToolCallPart | ToolResultPart | ToolApprovalRequest>;
118
- export type JsonModelMessage = SystemModelMessage | JsonUserModelMessage | JsonAssistantModelMessage | ToolModelMessage;
119
- export type JsonResponseMessage = JsonAssistantModelMessage | ToolModelMessage;
120
- export declare const toJsonModelMessage: (msg: ModelMessage) => JsonModelMessage;
121
- export declare const fromJsonModelMessage: (msg: JsonModelMessage) => ModelMessage;
122
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,103 +0,0 @@
1
- import type { ToolResponseResult } from '../tool';
2
- import type { JsonModelMessage } from './json-ai-types';
3
- /**
4
- * Enum representing different kinds of task events
5
- */
6
- export declare enum TaskEventKind {
7
- StartTask = "StartTask",
8
- StartRequest = "StartRequest",
9
- EndRequest = "EndRequest",
10
- Text = "Text",
11
- Reasoning = "Reasoning",
12
- ToolUse = "ToolUse",
13
- ToolReply = "ToolReply",
14
- ToolError = "ToolError",
15
- UsageExceeded = "UsageExceeded",
16
- EndTask = "EndTask"
17
- }
18
- /**
19
- * Base interface for all task events
20
- */
21
- export interface TaskEventBase {
22
- kind: TaskEventKind;
23
- }
24
- /**
25
- * Event for task start
26
- */
27
- export interface TaskEventStartTask extends TaskEventBase {
28
- kind: TaskEventKind.StartTask;
29
- systemPrompt: string;
30
- }
31
- /**
32
- * Event for request start
33
- */
34
- export interface TaskEventStartRequest extends TaskEventBase {
35
- kind: TaskEventKind.StartRequest;
36
- userMessage: readonly JsonModelMessage[];
37
- }
38
- /**
39
- * Event for request end
40
- */
41
- export interface TaskEventEndRequest extends TaskEventBase {
42
- kind: TaskEventKind.EndRequest;
43
- message: string;
44
- }
45
- /**
46
- * Event for text/reasoning updates
47
- */
48
- export interface TaskEventText extends TaskEventBase {
49
- kind: TaskEventKind.Text | TaskEventKind.Reasoning;
50
- newText: string;
51
- }
52
- /**
53
- * Event for tool-related updates
54
- */
55
- export interface TaskEventToolUse extends TaskEventBase {
56
- kind: TaskEventKind.ToolUse;
57
- tool: string;
58
- params: Record<string, any>;
59
- }
60
- export interface TaskEventToolResult extends TaskEventBase {
61
- kind: TaskEventKind.ToolReply;
62
- tool: string;
63
- content: ToolResponseResult;
64
- }
65
- export interface TaskEventToolError extends TaskEventBase {
66
- kind: TaskEventKind.ToolError;
67
- tool: string;
68
- error: ToolResponseResult;
69
- }
70
- /**
71
- * Event for task usage exceeded
72
- */
73
- export interface TaskEventUsageExceeded extends TaskEventBase {
74
- kind: TaskEventKind.UsageExceeded;
75
- }
76
- /**
77
- * Event for task end
78
- */
79
- export interface TaskEventEndTask extends TaskEventBase {
80
- kind: TaskEventKind.EndTask;
81
- exitReason: ExitReason;
82
- }
83
- /**
84
- * Union type of all possible task events
85
- */
86
- export type TaskEvent = TaskEventStartTask | TaskEventStartRequest | TaskEventEndRequest | TaskEventText | TaskEventToolUse | TaskEventToolResult | TaskEventToolError | TaskEventUsageExceeded | TaskEventEndTask;
87
- export type TaskEventCallback = (event: TaskEvent) => void | Promise<void>;
88
- export type ExitReason = {
89
- type: 'UsageExceeded';
90
- messages: JsonModelMessage[];
91
- } | {
92
- type: 'Exit';
93
- message: string;
94
- object?: any;
95
- messages: JsonModelMessage[];
96
- } | {
97
- type: 'Error';
98
- error: {
99
- message: string;
100
- stack?: string;
101
- };
102
- messages: JsonModelMessage[];
103
- };
@@ -1,29 +0,0 @@
1
- export interface Logger {
2
- debug: (...args: any[]) => void;
3
- info: (...args: any[]) => void;
4
- warn: (...args: any[]) => void;
5
- error: (...args: any[]) => void;
6
- }
7
- export type ToolSignature<I, O> = {
8
- input: I;
9
- output: O;
10
- };
11
- export type ToolRegistry = Record<string, ToolSignature<any, any>>;
12
- export type WorkflowTools<TTools extends ToolRegistry> = {
13
- [K in keyof TTools]: (input: TTools[K]['input']) => Promise<TTools[K]['output']>;
14
- };
15
- export type StepOptions = {
16
- retry?: number;
17
- };
18
- export interface StepFn {
19
- <T>(name: string, fn: () => Promise<T>): Promise<T>;
20
- <T>(name: string, options: StepOptions, fn: () => Promise<T>): Promise<T>;
21
- }
22
- export interface BaseWorkflowContext<TTools extends ToolRegistry> {
23
- step: StepFn;
24
- logger: Logger;
25
- tools: WorkflowTools<TTools>;
26
- }
27
- export type WorkflowFn<TInput, TOutput, TTools extends ToolRegistry, TContext extends BaseWorkflowContext<TTools> = BaseWorkflowContext<TTools>> = (input: TInput, context: TContext) => Promise<TOutput>;
28
- export declare function createContext<TTools extends ToolRegistry>(tools: WorkflowTools<TTools>, stepFn?: StepFn, logger?: Logger): BaseWorkflowContext<TTools>;
29
- export declare const makeStepFn: () => StepFn;
@@ -1 +0,0 @@
1
- export {};