@tagma/sdk 0.4.14 → 0.4.15

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 (59) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +569 -569
  3. package/dist/dag.d.ts.map +1 -1
  4. package/dist/dag.js +22 -56
  5. package/dist/dag.js.map +1 -1
  6. package/dist/engine.d.ts.map +1 -1
  7. package/dist/engine.js +63 -37
  8. package/dist/engine.js.map +1 -1
  9. package/dist/middlewares/static-context.d.ts.map +1 -1
  10. package/dist/middlewares/static-context.js +7 -3
  11. package/dist/middlewares/static-context.js.map +1 -1
  12. package/dist/prompt-doc.d.ts +36 -0
  13. package/dist/prompt-doc.d.ts.map +1 -0
  14. package/dist/prompt-doc.js +44 -0
  15. package/dist/prompt-doc.js.map +1 -0
  16. package/dist/sdk.d.ts +3 -0
  17. package/dist/sdk.d.ts.map +1 -1
  18. package/dist/sdk.js +4 -0
  19. package/dist/sdk.js.map +1 -1
  20. package/dist/task-ref.d.ts +55 -0
  21. package/dist/task-ref.d.ts.map +1 -0
  22. package/dist/task-ref.js +101 -0
  23. package/dist/task-ref.js.map +1 -0
  24. package/dist/templates.d.ts +20 -0
  25. package/dist/templates.d.ts.map +1 -0
  26. package/dist/templates.js +93 -0
  27. package/dist/templates.js.map +1 -0
  28. package/dist/validate-raw.d.ts.map +1 -1
  29. package/dist/validate-raw.js +27 -53
  30. package/dist/validate-raw.js.map +1 -1
  31. package/package.json +2 -2
  32. package/scripts/preinstall.js +31 -31
  33. package/src/adapters/stdin-approval.ts +106 -106
  34. package/src/adapters/websocket-approval.ts +224 -224
  35. package/src/approval.ts +131 -131
  36. package/src/bootstrap.ts +37 -37
  37. package/src/completions/exit-code.ts +34 -34
  38. package/src/completions/file-exists.ts +66 -66
  39. package/src/completions/output-check.ts +86 -86
  40. package/src/config-ops.ts +307 -307
  41. package/src/dag.ts +24 -54
  42. package/src/drivers/claude-code.ts +250 -250
  43. package/src/engine.ts +1137 -1098
  44. package/src/hooks.ts +187 -187
  45. package/src/logger.ts +182 -182
  46. package/src/middlewares/static-context.ts +49 -45
  47. package/src/pipeline-runner.ts +156 -156
  48. package/src/prompt-doc.ts +49 -0
  49. package/src/registry.ts +242 -242
  50. package/src/runner.ts +395 -395
  51. package/src/schema.test.ts +101 -101
  52. package/src/schema.ts +338 -338
  53. package/src/sdk.ts +111 -92
  54. package/src/task-ref.ts +120 -0
  55. package/src/triggers/file.ts +164 -164
  56. package/src/triggers/manual.ts +86 -86
  57. package/src/types.ts +18 -18
  58. package/src/utils.ts +203 -203
  59. package/src/validate-raw.ts +412 -442
@@ -1,101 +1,101 @@
1
- import { describe, expect, test } from 'bun:test';
2
- import yaml from 'js-yaml';
3
- import type { PipelineConfig, RawPipelineConfig } from './types';
4
- import { deresolvePipeline, serializePipeline } from './schema';
5
-
6
- function parsePipelineYaml(content: string): RawPipelineConfig {
7
- const doc = yaml.load(content) as { pipeline: RawPipelineConfig };
8
- return doc.pipeline;
9
- }
10
-
11
- describe('completion default serialization', () => {
12
- test('serializePipeline omits default exit_code completions from raw configs', () => {
13
- const raw: RawPipelineConfig = {
14
- name: 'Serialize Defaults',
15
- tracks: [
16
- {
17
- id: 'track_a',
18
- name: 'Track A',
19
- tasks: [
20
- { id: 'task_1', prompt: 'hello', completion: { type: 'exit_code' } },
21
- { id: 'task_2', prompt: 'world', completion: { type: 'exit_code', expect: 0 } },
22
- { id: 'task_3', prompt: 'keep me', completion: { type: 'exit_code', expect: 2 } },
23
- ],
24
- },
25
- ],
26
- };
27
-
28
- const parsed = parsePipelineYaml(serializePipeline(raw));
29
- expect(parsed.tracks[0].tasks[0].completion).toBeUndefined();
30
- expect(parsed.tracks[0].tasks[1].completion).toBeUndefined();
31
- expect(parsed.tracks[0].tasks[2].completion).toEqual({ type: 'exit_code', expect: 2 });
32
- });
33
-
34
- test('serializePipeline preserves non-default completion plugins', () => {
35
- const raw: RawPipelineConfig = {
36
- name: 'Serialize Explicit',
37
- tracks: [
38
- {
39
- id: 'track_a',
40
- name: 'Track A',
41
- tasks: [
42
- {
43
- id: 'task_1',
44
- prompt: 'check file',
45
- completion: { type: 'file_exists', path: './out.txt' },
46
- },
47
- ],
48
- },
49
- ],
50
- };
51
-
52
- const parsed = parsePipelineYaml(serializePipeline(raw));
53
- expect(parsed.tracks[0].tasks[0].completion).toEqual({
54
- type: 'file_exists',
55
- path: './out.txt',
56
- });
57
- });
58
-
59
- test('deresolvePipeline also omits the default exit_code completion', () => {
60
- const resolved: PipelineConfig = {
61
- name: 'Deresolve Defaults',
62
- tracks: [
63
- {
64
- id: 'track_a',
65
- name: 'Track A',
66
- driver: 'claude-code',
67
- permissions: { read: true, write: false, execute: false },
68
- on_failure: 'skip_downstream',
69
- cwd: 'D:/workspace',
70
- tasks: [
71
- {
72
- id: 'task_1',
73
- name: 'Task 1',
74
- prompt: 'hello',
75
- driver: 'claude-code',
76
- permissions: { read: true, write: false, execute: false },
77
- cwd: 'D:/workspace',
78
- completion: { type: 'exit_code', expect: 0 },
79
- },
80
- {
81
- id: 'task_2',
82
- name: 'Task 2',
83
- prompt: 'custom',
84
- driver: 'claude-code',
85
- permissions: { read: true, write: false, execute: false },
86
- cwd: 'D:/workspace',
87
- completion: { type: 'output_check', check: 'test -f ./done.txt' },
88
- },
89
- ],
90
- },
91
- ],
92
- };
93
-
94
- const raw = deresolvePipeline(resolved, 'D:/workspace');
95
- expect(raw.tracks[0].tasks[0].completion).toBeUndefined();
96
- expect(raw.tracks[0].tasks[1].completion).toEqual({
97
- type: 'output_check',
98
- check: 'test -f ./done.txt',
99
- });
100
- });
101
- });
1
+ import { describe, expect, test } from 'bun:test';
2
+ import yaml from 'js-yaml';
3
+ import type { PipelineConfig, RawPipelineConfig } from './types';
4
+ import { deresolvePipeline, serializePipeline } from './schema';
5
+
6
+ function parsePipelineYaml(content: string): RawPipelineConfig {
7
+ const doc = yaml.load(content) as { pipeline: RawPipelineConfig };
8
+ return doc.pipeline;
9
+ }
10
+
11
+ describe('completion default serialization', () => {
12
+ test('serializePipeline omits default exit_code completions from raw configs', () => {
13
+ const raw: RawPipelineConfig = {
14
+ name: 'Serialize Defaults',
15
+ tracks: [
16
+ {
17
+ id: 'track_a',
18
+ name: 'Track A',
19
+ tasks: [
20
+ { id: 'task_1', prompt: 'hello', completion: { type: 'exit_code' } },
21
+ { id: 'task_2', prompt: 'world', completion: { type: 'exit_code', expect: 0 } },
22
+ { id: 'task_3', prompt: 'keep me', completion: { type: 'exit_code', expect: 2 } },
23
+ ],
24
+ },
25
+ ],
26
+ };
27
+
28
+ const parsed = parsePipelineYaml(serializePipeline(raw));
29
+ expect(parsed.tracks[0].tasks[0].completion).toBeUndefined();
30
+ expect(parsed.tracks[0].tasks[1].completion).toBeUndefined();
31
+ expect(parsed.tracks[0].tasks[2].completion).toEqual({ type: 'exit_code', expect: 2 });
32
+ });
33
+
34
+ test('serializePipeline preserves non-default completion plugins', () => {
35
+ const raw: RawPipelineConfig = {
36
+ name: 'Serialize Explicit',
37
+ tracks: [
38
+ {
39
+ id: 'track_a',
40
+ name: 'Track A',
41
+ tasks: [
42
+ {
43
+ id: 'task_1',
44
+ prompt: 'check file',
45
+ completion: { type: 'file_exists', path: './out.txt' },
46
+ },
47
+ ],
48
+ },
49
+ ],
50
+ };
51
+
52
+ const parsed = parsePipelineYaml(serializePipeline(raw));
53
+ expect(parsed.tracks[0].tasks[0].completion).toEqual({
54
+ type: 'file_exists',
55
+ path: './out.txt',
56
+ });
57
+ });
58
+
59
+ test('deresolvePipeline also omits the default exit_code completion', () => {
60
+ const resolved: PipelineConfig = {
61
+ name: 'Deresolve Defaults',
62
+ tracks: [
63
+ {
64
+ id: 'track_a',
65
+ name: 'Track A',
66
+ driver: 'claude-code',
67
+ permissions: { read: true, write: false, execute: false },
68
+ on_failure: 'skip_downstream',
69
+ cwd: 'D:/workspace',
70
+ tasks: [
71
+ {
72
+ id: 'task_1',
73
+ name: 'Task 1',
74
+ prompt: 'hello',
75
+ driver: 'claude-code',
76
+ permissions: { read: true, write: false, execute: false },
77
+ cwd: 'D:/workspace',
78
+ completion: { type: 'exit_code', expect: 0 },
79
+ },
80
+ {
81
+ id: 'task_2',
82
+ name: 'Task 2',
83
+ prompt: 'custom',
84
+ driver: 'claude-code',
85
+ permissions: { read: true, write: false, execute: false },
86
+ cwd: 'D:/workspace',
87
+ completion: { type: 'output_check', check: 'test -f ./done.txt' },
88
+ },
89
+ ],
90
+ },
91
+ ],
92
+ };
93
+
94
+ const raw = deresolvePipeline(resolved, 'D:/workspace');
95
+ expect(raw.tracks[0].tasks[0].completion).toBeUndefined();
96
+ expect(raw.tracks[0].tasks[1].completion).toEqual({
97
+ type: 'output_check',
98
+ check: 'test -f ./done.txt',
99
+ });
100
+ });
101
+ });