@tagma/sdk 0.7.4 → 0.7.5
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.
- package/README.md +60 -53
- package/dist/completions/file-exists.js +1 -1
- package/dist/completions/file-exists.js.map +1 -1
- package/dist/completions/output-check.d.ts.map +1 -1
- package/dist/completions/output-check.js +17 -4
- package/dist/completions/output-check.js.map +1 -1
- package/dist/config.d.ts +4 -4
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +2 -2
- package/dist/config.js.map +1 -1
- package/dist/dataflow.d.ts +3 -0
- package/dist/dataflow.d.ts.map +1 -0
- package/dist/dataflow.js +2 -0
- package/dist/dataflow.js.map +1 -0
- package/dist/drivers/opencode.d.ts.map +1 -1
- package/dist/drivers/opencode.js +23 -71
- package/dist/drivers/opencode.js.map +1 -1
- package/dist/middlewares/static-context.d.ts.map +1 -1
- package/dist/middlewares/static-context.js +1 -2
- package/dist/middlewares/static-context.js.map +1 -1
- package/dist/pipeline-runner.d.ts.map +1 -1
- package/dist/pipeline-runner.js +2 -2
- package/dist/pipeline-runner.js.map +1 -1
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +3 -4
- package/dist/schema.js.map +1 -1
- package/dist/triggers/file.d.ts.map +1 -1
- package/dist/triggers/file.js +1 -2
- package/dist/triggers/file.js.map +1 -1
- package/dist/triggers/manual.d.ts.map +1 -1
- package/dist/triggers/manual.js +1 -2
- package/dist/triggers/manual.js.map +1 -1
- package/dist/types.d.ts +1 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -12
- package/dist/types.js.map +1 -1
- package/dist/utils-api.d.ts +1 -1
- package/dist/utils-api.d.ts.map +1 -1
- package/dist/utils-api.js +1 -1
- package/dist/utils-api.js.map +1 -1
- package/dist/validate-raw.d.ts.map +1 -1
- package/dist/validate-raw.js +5 -12
- package/dist/validate-raw.js.map +1 -1
- package/package.json +11 -24
- package/dist/adapters/stdin-approval.d.ts +0 -2
- package/dist/adapters/stdin-approval.d.ts.map +0 -1
- package/dist/adapters/stdin-approval.js +0 -2
- package/dist/adapters/stdin-approval.js.map +0 -1
- package/dist/adapters/websocket-approval.d.ts +0 -2
- package/dist/adapters/websocket-approval.d.ts.map +0 -1
- package/dist/adapters/websocket-approval.js +0 -2
- package/dist/adapters/websocket-approval.js.map +0 -1
- package/dist/core/dataflow.d.ts +0 -23
- package/dist/core/dataflow.d.ts.map +0 -1
- package/dist/core/dataflow.js +0 -99
- package/dist/core/dataflow.js.map +0 -1
- package/dist/core/log-prune.d.ts +0 -16
- package/dist/core/log-prune.d.ts.map +0 -1
- package/dist/core/log-prune.js +0 -34
- package/dist/core/log-prune.js.map +0 -1
- package/dist/core/preflight.d.ts +0 -13
- package/dist/core/preflight.d.ts.map +0 -1
- package/dist/core/preflight.js +0 -61
- package/dist/core/preflight.js.map +0 -1
- package/dist/core/run-context.d.ts +0 -55
- package/dist/core/run-context.d.ts.map +0 -1
- package/dist/core/run-context.js +0 -158
- package/dist/core/run-context.js.map +0 -1
- package/dist/core/run-state.d.ts +0 -25
- package/dist/core/run-state.d.ts.map +0 -1
- package/dist/core/run-state.js +0 -93
- package/dist/core/run-state.js.map +0 -1
- package/dist/core/scheduler.d.ts +0 -13
- package/dist/core/scheduler.d.ts.map +0 -1
- package/dist/core/scheduler.js +0 -35
- package/dist/core/scheduler.js.map +0 -1
- package/dist/core/task-executor.d.ts +0 -13
- package/dist/core/task-executor.d.ts.map +0 -1
- package/dist/core/task-executor.js +0 -610
- package/dist/core/task-executor.js.map +0 -1
- package/dist/core/trigger-errors.d.ts +0 -9
- package/dist/core/trigger-errors.d.ts.map +0 -1
- package/dist/core/trigger-errors.js +0 -15
- package/dist/core/trigger-errors.js.map +0 -1
- package/dist/dag.d.ts +0 -45
- package/dist/dag.d.ts.map +0 -1
- package/dist/dag.js +0 -177
- package/dist/dag.js.map +0 -1
- package/dist/hooks.d.ts +0 -73
- package/dist/hooks.d.ts.map +0 -1
- package/dist/hooks.js +0 -106
- package/dist/hooks.js.map +0 -1
- package/dist/pipeline-definition.d.ts +0 -3
- package/dist/pipeline-definition.d.ts.map +0 -1
- package/dist/pipeline-definition.js +0 -4
- package/dist/pipeline-definition.js.map +0 -1
- package/dist/ports.d.ts +0 -196
- package/dist/ports.d.ts.map +0 -1
- package/dist/ports.js +0 -688
- package/dist/ports.js.map +0 -1
- package/dist/prompt-doc.d.ts +0 -70
- package/dist/prompt-doc.d.ts.map +0 -1
- package/dist/prompt-doc.js +0 -154
- package/dist/prompt-doc.js.map +0 -1
- package/dist/registry.d.ts +0 -3
- package/dist/registry.d.ts.map +0 -1
- package/dist/registry.js +0 -2
- package/dist/registry.js.map +0 -1
- package/dist/task-ref.d.ts +0 -55
- package/dist/task-ref.d.ts.map +0 -1
- package/dist/task-ref.js +0 -103
- package/dist/task-ref.js.map +0 -1
- package/dist/utils.d.ts +0 -13
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js +0 -177
- package/dist/utils.js.map +0 -1
- package/src/adapters/stdin-approval.ts +0 -1
- package/src/adapters/websocket-approval.ts +0 -1
- package/src/approval.ts +0 -9
- package/src/bootstrap.ts +0 -55
- package/src/completions/exit-code.ts +0 -34
- package/src/completions/file-exists.ts +0 -66
- package/src/completions/output-check.test.ts +0 -50
- package/src/completions/output-check.ts +0 -92
- package/src/config-ops.test.ts +0 -70
- package/src/config-ops.ts +0 -328
- package/src/config.ts +0 -26
- package/src/core/dataflow.test.ts +0 -166
- package/src/core/dataflow.ts +0 -161
- package/src/core/log-prune.test.ts +0 -58
- package/src/core/log-prune.ts +0 -43
- package/src/core/preflight.test.ts +0 -49
- package/src/core/preflight.ts +0 -89
- package/src/core/run-context.test.ts +0 -291
- package/src/core/run-context.ts +0 -211
- package/src/core/run-state.test.ts +0 -98
- package/src/core/run-state.ts +0 -122
- package/src/core/scheduler.test.ts +0 -83
- package/src/core/scheduler.ts +0 -42
- package/src/core/task-executor.ts +0 -752
- package/src/core/trigger-errors.ts +0 -15
- package/src/dag.test.ts +0 -56
- package/src/dag.ts +0 -245
- package/src/drivers/opencode.ts +0 -410
- package/src/engine-ports-mixed.test.ts +0 -182
- package/src/engine-ports.test.ts +0 -210
- package/src/engine-task-type.test.ts +0 -56
- package/src/engine.ts +0 -32
- package/src/hooks.ts +0 -193
- package/src/index.ts +0 -31
- package/src/logger.ts +0 -2
- package/src/middlewares/static-context.ts +0 -49
- package/src/package-split.test.ts +0 -15
- package/src/pipeline-definition.ts +0 -5
- package/src/pipeline-runner.test.ts +0 -144
- package/src/pipeline-runner.ts +0 -194
- package/src/plugin-registry.test.ts +0 -448
- package/src/plugins.ts +0 -21
- package/src/ports.test.ts +0 -678
- package/src/ports.ts +0 -925
- package/src/prompt-doc.test.ts +0 -174
- package/src/prompt-doc.ts +0 -169
- package/src/registry.ts +0 -7
- package/src/runner.test.ts +0 -142
- package/src/runner.ts +0 -1
- package/src/runtime/adapters/stdin-approval.ts +0 -1
- package/src/runtime/adapters/websocket-approval.ts +0 -1
- package/src/runtime/bun-process-runner.ts +0 -1
- package/src/runtime-adapters.test.ts +0 -10
- package/src/runtime.ts +0 -12
- package/src/schema-ports.test.ts +0 -172
- package/src/schema.test.ts +0 -213
- package/src/schema.ts +0 -379
- package/src/tagma.test.ts +0 -317
- package/src/tagma.ts +0 -67
- package/src/task-ref.test.ts +0 -401
- package/src/task-ref.ts +0 -121
- package/src/triggers/file.test.ts +0 -79
- package/src/triggers/file.ts +0 -131
- package/src/triggers/manual.ts +0 -86
- package/src/types.ts +0 -18
- package/src/utils-api.ts +0 -8
- package/src/utils.test.ts +0 -28
- package/src/utils.ts +0 -203
- package/src/validate-raw-plugin-types.test.ts +0 -60
- package/src/validate-raw-ports.test.ts +0 -136
- package/src/validate-raw.ts +0 -852
- package/src/yaml-compiler.test.ts +0 -108
- package/src/yaml-compiler.ts +0 -110
- package/src/yaml.ts +0 -11
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from 'bun:test';
|
|
2
|
-
import { compileYamlContent } from './yaml-compiler';
|
|
3
|
-
|
|
4
|
-
describe('compileYamlContent', () => {
|
|
5
|
-
test('reports YAML syntax failures as parse errors', () => {
|
|
6
|
-
const result = compileYamlContent('pipeline:\n name: [');
|
|
7
|
-
|
|
8
|
-
expect(result.parseOk).toBe(false);
|
|
9
|
-
expect(result.success).toBe(false);
|
|
10
|
-
expect(result.validation.errors).toEqual([]);
|
|
11
|
-
expect(result.summary).toMatch(/^YAML parse error:/);
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
test('reports missing top-level pipeline as a validation error', () => {
|
|
15
|
-
const result = compileYamlContent('name: Missing Pipeline\n');
|
|
16
|
-
|
|
17
|
-
expect(result.parseOk).toBe(true);
|
|
18
|
-
expect(result.success).toBe(false);
|
|
19
|
-
expect(result.validation.errors).toEqual([
|
|
20
|
-
{ path: 'pipeline', message: 'Top-level "pipeline" key is required' },
|
|
21
|
-
]);
|
|
22
|
-
expect(result.summary).toBe('Invalid: 1 error(s), 0 warning(s)');
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
test('reports non-array tracks as a validation error, not a parse failure', () => {
|
|
26
|
-
const result = compileYamlContent(`
|
|
27
|
-
pipeline:
|
|
28
|
-
name: Bad
|
|
29
|
-
tracks:
|
|
30
|
-
id: not-an-array
|
|
31
|
-
`);
|
|
32
|
-
|
|
33
|
-
expect(result.parseOk).toBe(true);
|
|
34
|
-
expect(result.success).toBe(false);
|
|
35
|
-
expect(result.validation.errors).toEqual([
|
|
36
|
-
{ path: 'tracks', message: 'pipeline.tracks must be an array' },
|
|
37
|
-
]);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
test('reports non-array task lists as validation errors, not validation crashes', () => {
|
|
41
|
-
const result = compileYamlContent(`
|
|
42
|
-
pipeline:
|
|
43
|
-
name: Bad Tasks
|
|
44
|
-
tracks:
|
|
45
|
-
- id: t
|
|
46
|
-
name: T
|
|
47
|
-
tasks:
|
|
48
|
-
id: not-an-array
|
|
49
|
-
`);
|
|
50
|
-
|
|
51
|
-
expect(result.parseOk).toBe(true);
|
|
52
|
-
expect(result.success).toBe(false);
|
|
53
|
-
expect(result.validation.errors).toEqual([
|
|
54
|
-
{ path: 'tracks[0].tasks', message: 'Track "t": tasks must be an array' },
|
|
55
|
-
]);
|
|
56
|
-
expect(result.summary).not.toMatch(/Validation crashed/);
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
test('routes schema errors through validation when YAML syntax is valid', () => {
|
|
60
|
-
const result = compileYamlContent(`
|
|
61
|
-
pipeline:
|
|
62
|
-
name: Missing Track Name
|
|
63
|
-
tracks:
|
|
64
|
-
- id: main
|
|
65
|
-
tasks:
|
|
66
|
-
- id: task
|
|
67
|
-
prompt: hello
|
|
68
|
-
`);
|
|
69
|
-
|
|
70
|
-
expect(result.parseOk).toBe(true);
|
|
71
|
-
expect(result.success).toBe(false);
|
|
72
|
-
expect(result.validation.errors).toContainEqual({
|
|
73
|
-
path: 'tracks[0].name',
|
|
74
|
-
message: 'Track name is required',
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
test('validates pipeline, track, and task permissions shape', () => {
|
|
79
|
-
const result = compileYamlContent(`
|
|
80
|
-
pipeline:
|
|
81
|
-
name: Bad Permissions
|
|
82
|
-
permissions: { read: true, write: "yes", execute: false }
|
|
83
|
-
tracks:
|
|
84
|
-
- id: main
|
|
85
|
-
name: Main
|
|
86
|
-
permissions: { read: true, execute: false }
|
|
87
|
-
tasks:
|
|
88
|
-
- id: task
|
|
89
|
-
prompt: hello
|
|
90
|
-
permissions: nope
|
|
91
|
-
`);
|
|
92
|
-
|
|
93
|
-
expect(result.parseOk).toBe(true);
|
|
94
|
-
expect(result.success).toBe(false);
|
|
95
|
-
expect(result.validation.errors).toContainEqual({
|
|
96
|
-
path: 'permissions.write',
|
|
97
|
-
message: 'permissions.write must be a boolean',
|
|
98
|
-
});
|
|
99
|
-
expect(result.validation.errors).toContainEqual({
|
|
100
|
-
path: 'tracks[0].permissions.write',
|
|
101
|
-
message: 'permissions.write is required',
|
|
102
|
-
});
|
|
103
|
-
expect(result.validation.errors).toContainEqual({
|
|
104
|
-
path: 'tracks[0].tasks[0].permissions',
|
|
105
|
-
message: 'permissions must be an object with read/write/execute booleans',
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
});
|
package/src/yaml-compiler.ts
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import yaml from 'js-yaml';
|
|
2
|
-
import { validateRaw } from './validate-raw';
|
|
3
|
-
import type { ValidationError, KnownPluginTypes } from './validate-raw';
|
|
4
|
-
import type { RawPipelineConfig } from './types';
|
|
5
|
-
|
|
6
|
-
export interface YamlCompileResult {
|
|
7
|
-
readonly timestamp: string;
|
|
8
|
-
readonly sourceName: string;
|
|
9
|
-
readonly success: boolean;
|
|
10
|
-
readonly parseOk: boolean;
|
|
11
|
-
readonly validation: {
|
|
12
|
-
readonly errors: ReadonlyArray<Pick<ValidationError, 'path' | 'message'>>;
|
|
13
|
-
readonly warnings: ReadonlyArray<Pick<ValidationError, 'path' | 'message'>>;
|
|
14
|
-
};
|
|
15
|
-
readonly summary: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface CompileYamlOptions {
|
|
19
|
-
readonly sourceName?: string;
|
|
20
|
-
readonly knownTypes?: KnownPluginTypes;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export function compileYamlContent(
|
|
24
|
-
content: string,
|
|
25
|
-
opts: CompileYamlOptions = {},
|
|
26
|
-
): YamlCompileResult {
|
|
27
|
-
const timestamp = new Date().toISOString();
|
|
28
|
-
const sourceName = opts.sourceName ?? 'untitled';
|
|
29
|
-
|
|
30
|
-
let doc: unknown;
|
|
31
|
-
try {
|
|
32
|
-
doc = yaml.load(content);
|
|
33
|
-
} catch (err) {
|
|
34
|
-
return {
|
|
35
|
-
timestamp,
|
|
36
|
-
sourceName,
|
|
37
|
-
success: false,
|
|
38
|
-
parseOk: false,
|
|
39
|
-
validation: { errors: [], warnings: [] },
|
|
40
|
-
summary: `YAML parse error: ${errorMessage(err)}`,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const envelopeErrors = validateEnvelope(doc);
|
|
45
|
-
if (envelopeErrors.length > 0) {
|
|
46
|
-
return buildValidationResult(timestamp, sourceName, envelopeErrors);
|
|
47
|
-
}
|
|
48
|
-
const config = (doc as { pipeline: RawPipelineConfig }).pipeline;
|
|
49
|
-
|
|
50
|
-
let errors: ValidationError[];
|
|
51
|
-
try {
|
|
52
|
-
errors = validateRaw(config, opts.knownTypes);
|
|
53
|
-
} catch (err) {
|
|
54
|
-
return {
|
|
55
|
-
timestamp,
|
|
56
|
-
sourceName,
|
|
57
|
-
success: false,
|
|
58
|
-
parseOk: true,
|
|
59
|
-
validation: { errors: [], warnings: [] },
|
|
60
|
-
summary: `Validation crashed: ${errorMessage(err)}`,
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return buildValidationResult(timestamp, sourceName, errors);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function validateEnvelope(doc: unknown): ValidationError[] {
|
|
68
|
-
if (!doc || typeof doc !== 'object' || Array.isArray(doc) || !('pipeline' in doc)) {
|
|
69
|
-
return [{ path: 'pipeline', message: 'Top-level "pipeline" key is required' }];
|
|
70
|
-
}
|
|
71
|
-
const pipeline = (doc as Record<string, unknown>).pipeline;
|
|
72
|
-
if (!pipeline || typeof pipeline !== 'object' || Array.isArray(pipeline)) {
|
|
73
|
-
return [{ path: 'pipeline', message: 'pipeline must be an object' }];
|
|
74
|
-
}
|
|
75
|
-
return [];
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function buildValidationResult(
|
|
79
|
-
timestamp: string,
|
|
80
|
-
sourceName: string,
|
|
81
|
-
diagnostics: readonly ValidationError[],
|
|
82
|
-
): YamlCompileResult {
|
|
83
|
-
const validationErrors = diagnostics.filter(
|
|
84
|
-
(e) => e.severity === 'error' || e.severity == null,
|
|
85
|
-
);
|
|
86
|
-
const validationWarnings = diagnostics.filter((e) => e.severity === 'warning');
|
|
87
|
-
|
|
88
|
-
return {
|
|
89
|
-
timestamp,
|
|
90
|
-
sourceName,
|
|
91
|
-
success: validationErrors.length === 0,
|
|
92
|
-
parseOk: true,
|
|
93
|
-
validation: {
|
|
94
|
-
errors: validationErrors.map((e) => ({ path: e.path, message: e.message })),
|
|
95
|
-
warnings: validationWarnings.map((e) => ({ path: e.path, message: e.message })),
|
|
96
|
-
},
|
|
97
|
-
summary:
|
|
98
|
-
validationErrors.length === 0
|
|
99
|
-
? validationWarnings.length === 0
|
|
100
|
-
? 'Valid pipeline configuration'
|
|
101
|
-
: `Valid with ${validationWarnings.length} warning(s)`
|
|
102
|
-
: `Invalid: ${validationErrors.length} error(s), ${validationWarnings.length} warning(s)`,
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
function errorMessage(err: unknown): string {
|
|
107
|
-
if (err instanceof Error && err.message) return err.message;
|
|
108
|
-
if (typeof err === 'string') return err;
|
|
109
|
-
return 'Unknown error';
|
|
110
|
-
}
|
package/src/yaml.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export {
|
|
2
|
-
parseYaml,
|
|
3
|
-
resolveConfig,
|
|
4
|
-
loadPipeline,
|
|
5
|
-
serializePipeline,
|
|
6
|
-
deresolvePipeline,
|
|
7
|
-
validateConfig,
|
|
8
|
-
} from './schema';
|
|
9
|
-
export { compileYamlContent } from './yaml-compiler';
|
|
10
|
-
export type { YamlCompileResult, CompileYamlOptions } from './yaml-compiler';
|
|
11
|
-
|