@tagma/sdk 0.6.0 → 0.6.2

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 (48) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +573 -573
  3. package/dist/bootstrap.d.ts +11 -1
  4. package/dist/bootstrap.d.ts.map +1 -1
  5. package/dist/bootstrap.js +18 -9
  6. package/dist/bootstrap.js.map +1 -1
  7. package/dist/drivers/opencode.d.ts.map +1 -1
  8. package/dist/drivers/opencode.js +47 -17
  9. package/dist/drivers/opencode.js.map +1 -1
  10. package/dist/engine.d.ts +8 -0
  11. package/dist/engine.d.ts.map +1 -1
  12. package/dist/engine.js +17 -16
  13. package/dist/engine.js.map +1 -1
  14. package/dist/plugin-registry.test.d.ts +2 -0
  15. package/dist/plugin-registry.test.d.ts.map +1 -0
  16. package/dist/plugin-registry.test.js +188 -0
  17. package/dist/plugin-registry.test.js.map +1 -0
  18. package/dist/registry.d.ts +52 -28
  19. package/dist/registry.d.ts.map +1 -1
  20. package/dist/registry.js +126 -91
  21. package/dist/registry.js.map +1 -1
  22. package/dist/sdk.d.ts +1 -1
  23. package/dist/sdk.d.ts.map +1 -1
  24. package/dist/sdk.js +1 -1
  25. package/dist/sdk.js.map +1 -1
  26. package/package.json +2 -2
  27. package/src/bootstrap.ts +46 -37
  28. package/src/completions/output-check.ts +92 -92
  29. package/src/dag.ts +245 -245
  30. package/src/drivers/opencode.ts +410 -371
  31. package/src/engine.ts +1228 -1220
  32. package/src/hooks.ts +193 -193
  33. package/src/middlewares/static-context.ts +49 -49
  34. package/src/pipeline-runner.ts +173 -173
  35. package/src/plugin-registry.test.ts +230 -0
  36. package/src/prompt-doc.ts +49 -49
  37. package/src/registry.ts +316 -267
  38. package/src/runner.ts +460 -460
  39. package/src/schema.test.ts +101 -101
  40. package/src/schema.ts +338 -338
  41. package/src/sdk.ts +120 -118
  42. package/src/task-ref.test.ts +401 -401
  43. package/src/task-ref.ts +120 -120
  44. package/src/validate-raw.ts +412 -412
  45. package/dist/drivers/claude-code.d.ts +0 -3
  46. package/dist/drivers/claude-code.d.ts.map +0 -1
  47. package/dist/drivers/claude-code.js +0 -225
  48. package/dist/drivers/claude-code.js.map +0 -1
@@ -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: 'opencode',
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: 'opencode',
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: 'opencode',
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: 'opencode',
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: 'opencode',
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: 'opencode',
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
+ });