@tagma/sdk 0.6.12 → 0.7.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 (110) hide show
  1. package/README.md +56 -15
  2. package/dist/bootstrap.d.ts +6 -6
  3. package/dist/bootstrap.d.ts.map +1 -1
  4. package/dist/bootstrap.js +5 -6
  5. package/dist/bootstrap.js.map +1 -1
  6. package/dist/config.d.ts +8 -0
  7. package/dist/config.d.ts.map +1 -0
  8. package/dist/config.js +5 -0
  9. package/dist/config.js.map +1 -0
  10. package/dist/core/dataflow.d.ts +23 -0
  11. package/dist/core/dataflow.d.ts.map +1 -0
  12. package/dist/core/dataflow.js +63 -0
  13. package/dist/core/dataflow.js.map +1 -0
  14. package/dist/core/log-prune.d.ts +16 -0
  15. package/dist/core/log-prune.d.ts.map +1 -0
  16. package/dist/core/log-prune.js +34 -0
  17. package/dist/core/log-prune.js.map +1 -0
  18. package/dist/core/preflight.d.ts +13 -0
  19. package/dist/core/preflight.d.ts.map +1 -0
  20. package/dist/core/preflight.js +61 -0
  21. package/dist/core/preflight.js.map +1 -0
  22. package/dist/core/run-context.d.ts +52 -0
  23. package/dist/core/run-context.d.ts.map +1 -0
  24. package/dist/core/run-context.js +156 -0
  25. package/dist/core/run-context.js.map +1 -0
  26. package/dist/core/run-state.d.ts +25 -0
  27. package/dist/core/run-state.d.ts.map +1 -0
  28. package/dist/core/run-state.js +93 -0
  29. package/dist/core/run-state.js.map +1 -0
  30. package/dist/core/scheduler.d.ts +13 -0
  31. package/dist/core/scheduler.d.ts.map +1 -0
  32. package/dist/core/scheduler.js +35 -0
  33. package/dist/core/scheduler.js.map +1 -0
  34. package/dist/core/task-executor.d.ts +13 -0
  35. package/dist/core/task-executor.d.ts.map +1 -0
  36. package/dist/core/task-executor.js +639 -0
  37. package/dist/core/task-executor.js.map +1 -0
  38. package/dist/core/trigger-errors.d.ts +9 -0
  39. package/dist/core/trigger-errors.d.ts.map +1 -0
  40. package/dist/core/trigger-errors.js +15 -0
  41. package/dist/core/trigger-errors.js.map +1 -0
  42. package/dist/engine.d.ts +6 -14
  43. package/dist/engine.d.ts.map +1 -1
  44. package/dist/engine.js +68 -1035
  45. package/dist/engine.js.map +1 -1
  46. package/dist/index.d.ts +9 -0
  47. package/dist/index.d.ts.map +1 -0
  48. package/dist/index.js +6 -0
  49. package/dist/index.js.map +1 -0
  50. package/dist/pipeline-definition.d.ts +3 -0
  51. package/dist/pipeline-definition.d.ts.map +1 -0
  52. package/dist/pipeline-definition.js +4 -0
  53. package/dist/pipeline-definition.js.map +1 -0
  54. package/dist/pipeline-runner.d.ts +2 -1
  55. package/dist/pipeline-runner.d.ts.map +1 -1
  56. package/dist/pipeline-runner.js +2 -2
  57. package/dist/pipeline-runner.js.map +1 -1
  58. package/dist/plugins.d.ts +5 -0
  59. package/dist/plugins.d.ts.map +1 -0
  60. package/dist/plugins.js +3 -0
  61. package/dist/plugins.js.map +1 -0
  62. package/dist/registry.d.ts +3 -19
  63. package/dist/registry.d.ts.map +1 -1
  64. package/dist/registry.js +7 -35
  65. package/dist/registry.js.map +1 -1
  66. package/dist/tagma.d.ts +24 -0
  67. package/dist/tagma.d.ts.map +1 -0
  68. package/dist/tagma.js +23 -0
  69. package/dist/tagma.js.map +1 -0
  70. package/dist/utils-api.d.ts +2 -0
  71. package/dist/utils-api.d.ts.map +1 -0
  72. package/dist/utils-api.js +2 -0
  73. package/dist/utils-api.js.map +1 -0
  74. package/dist/yaml.d.ts +4 -0
  75. package/dist/yaml.d.ts.map +1 -0
  76. package/dist/yaml.js +3 -0
  77. package/dist/yaml.js.map +1 -0
  78. package/package.json +52 -7
  79. package/src/bootstrap.ts +6 -6
  80. package/src/config.ts +26 -0
  81. package/src/core/dataflow.test.ts +167 -0
  82. package/src/core/dataflow.ts +118 -0
  83. package/src/core/log-prune.test.ts +58 -0
  84. package/src/core/log-prune.ts +43 -0
  85. package/src/core/preflight.test.ts +49 -0
  86. package/src/core/preflight.ts +89 -0
  87. package/src/core/run-context.test.ts +244 -0
  88. package/src/core/run-context.ts +207 -0
  89. package/src/core/run-state.test.ts +98 -0
  90. package/src/core/run-state.ts +122 -0
  91. package/src/core/scheduler.test.ts +83 -0
  92. package/src/core/scheduler.ts +42 -0
  93. package/src/core/task-executor.ts +803 -0
  94. package/src/core/trigger-errors.ts +15 -0
  95. package/src/engine.ts +80 -1248
  96. package/src/index.ts +28 -0
  97. package/src/pipeline-definition.ts +5 -0
  98. package/src/pipeline-runner.ts +3 -2
  99. package/src/plugin-registry.test.ts +7 -10
  100. package/src/plugins.ts +18 -0
  101. package/src/registry.ts +7 -49
  102. package/src/tagma.test.ts +84 -0
  103. package/src/tagma.ts +47 -0
  104. package/src/utils-api.ts +8 -0
  105. package/src/yaml.ts +11 -0
  106. package/dist/sdk.d.ts +0 -32
  107. package/dist/sdk.d.ts.map +0 -1
  108. package/dist/sdk.js +0 -41
  109. package/dist/sdk.js.map +0 -1
  110. package/src/sdk.ts +0 -151
package/src/index.ts ADDED
@@ -0,0 +1,28 @@
1
+ export { createTagma } from './tagma';
2
+ export type { CreateTagmaOptions, Tagma, TagmaRunOptions } from './tagma';
3
+ export { definePipeline } from './pipeline-definition';
4
+ export { PluginRegistry } from './registry';
5
+ export { TriggerBlockedError, TriggerTimeoutError } from './engine';
6
+ export type { EngineResult, RunEventPayload } from './engine';
7
+ export { RUN_PROTOCOL_VERSION, TASK_LOG_CAP } from './types';
8
+ export type {
9
+ PipelineConfig,
10
+ RawPipelineConfig,
11
+ RawTrackConfig,
12
+ RawTaskConfig,
13
+ TrackConfig,
14
+ TaskConfig,
15
+ RunSnapshotPayload,
16
+ WireRunEvent,
17
+ RunTaskState,
18
+ TaskLogLine,
19
+ ApprovalRequestInfo,
20
+ TaskStatus,
21
+ ApprovalRequest,
22
+ PluginCategory,
23
+ DriverPlugin,
24
+ TriggerPlugin,
25
+ CompletionPlugin,
26
+ MiddlewarePlugin,
27
+ RunEventPayload as PipelineRunEventPayload,
28
+ } from '@tagma/types';
@@ -0,0 +1,5 @@
1
+ import type { RawPipelineConfig } from './types';
2
+
3
+ export function definePipeline<T extends RawPipelineConfig>(pipeline: T): T {
4
+ return pipeline;
5
+ }
@@ -13,7 +13,7 @@
13
13
  //
14
14
  // const runners = new Map<string, PipelineRunner>();
15
15
  //
16
- // const runner = new PipelineRunner(config, workDir);
16
+ // const runner = new PipelineRunner(config, workDir, { registry });
17
17
  // runner.subscribe(event => ipcEmit('run_event', event));
18
18
  // runner.start();
19
19
  // runners.set(runner.instanceId, runner);
@@ -29,6 +29,7 @@ import { generateRunId } from './utils';
29
29
  export type { EngineResult };
30
30
 
31
31
  export type PipelineRunnerStatus = 'idle' | 'running' | 'done' | 'aborted';
32
+ export type PipelineRunnerOptions = Omit<RunPipelineOptions, 'signal' | 'onEvent'>;
32
33
 
33
34
  export class PipelineRunner {
34
35
  /**
@@ -57,7 +58,7 @@ export class PipelineRunner {
57
58
  constructor(
58
59
  private readonly config: PipelineConfig,
59
60
  private readonly workDir: string,
60
- private readonly opts: Omit<RunPipelineOptions, 'signal' | 'onEvent'> = {},
61
+ private readonly opts: PipelineRunnerOptions,
61
62
  ) {
62
63
  this.instanceId = generateRunId();
63
64
  }
@@ -1,5 +1,5 @@
1
1
  import { describe, expect, test } from 'bun:test';
2
- import { PluginRegistry, defaultRegistry } from './registry';
2
+ import { PluginRegistry } from './registry';
3
3
  import { bootstrapBuiltins } from './bootstrap';
4
4
  import { runPipeline } from './engine';
5
5
  import type { DriverPlugin, TriggerPlugin, PipelineConfig } from './types';
@@ -80,7 +80,7 @@ describe('PluginRegistry — instance isolation', () => {
80
80
  expect(reg.getHandler<DriverPlugin>('drivers', 'mock').name).toBe('two');
81
81
  });
82
82
 
83
- test('bootstrapBuiltins(target) populates a specific instance without touching the default', () => {
83
+ test('bootstrapBuiltins(target) populates a specific instance', () => {
84
84
  const fresh = new PluginRegistry();
85
85
  expect(fresh.hasHandler('drivers', 'opencode')).toBe(false);
86
86
 
@@ -222,13 +222,9 @@ describe('runPipeline — options.registry isolation', () => {
222
222
  }
223
223
  });
224
224
 
225
- test('omitting options.registry falls back to defaultRegistry', async () => {
226
- // bootstrapBuiltins into default happens in most host callers; do it
227
- // explicitly here so the test is independent of module-load order.
228
- bootstrapBuiltins(defaultRegistry);
229
-
225
+ test('runPipeline rejects missing explicit registry', async () => {
230
226
  const config: PipelineConfig = {
231
- name: 'default-fallback',
227
+ name: 'missing-registry',
232
228
  tracks: [
233
229
  {
234
230
  id: 't',
@@ -239,8 +235,9 @@ describe('runPipeline — options.registry isolation', () => {
239
235
  };
240
236
  const tmp = mkdtempSync(join(tmpdir(), 'tagma-default-'));
241
237
  try {
242
- const res = await runPipeline(config, tmp, { skipPluginLoading: true });
243
- expect(res.success).toBe(true);
238
+ await expect(
239
+ runPipeline(config, tmp, { skipPluginLoading: true } as never),
240
+ ).rejects.toThrow(/requires options\.registry/);
244
241
  } finally {
245
242
  rmSync(tmp, { recursive: true, force: true });
246
243
  }
package/src/plugins.ts ADDED
@@ -0,0 +1,18 @@
1
+ export { bootstrapBuiltins } from './bootstrap';
2
+ export {
3
+ PluginRegistry,
4
+ isValidPluginName,
5
+ PLUGIN_NAME_RE,
6
+ readPluginManifest,
7
+ } from './registry';
8
+ export type { RegisterResult } from './registry';
9
+ export type {
10
+ PluginCategory,
11
+ PluginModule,
12
+ PluginManifest,
13
+ DriverPlugin,
14
+ TriggerPlugin,
15
+ CompletionPlugin,
16
+ MiddlewarePlugin,
17
+ } from './types';
18
+
package/src/registry.ts CHANGED
@@ -37,7 +37,7 @@ function singularCategory(category: PluginCategory): string {
37
37
  * registration time rather than crashing the engine mid-run.
38
38
  *
39
39
  * For drivers we materialize `capabilities` and assert each field is a
40
- * boolean otherwise a plugin author can write
40
+ * boolean �?otherwise a plugin author can write
41
41
  * get capabilities() { throw new Error('boom') }
42
42
  * and pass the basic typeof check, then crash preflight when the engine
43
43
  * touches `driver.capabilities.sessionResume`. (R8)
@@ -55,7 +55,7 @@ function validateContract(category: PluginCategory, handler: unknown): void {
55
55
  if (typeof h.buildCommand !== 'function') {
56
56
  throw new Error(`drivers plugin "${h.name}" must export buildCommand()`);
57
57
  }
58
- // Materialize capabilities this triggers any throwing getter NOW
58
+ // Materialize capabilities �?this triggers any throwing getter NOW
59
59
  // instead of during preflight.
60
60
  let caps: unknown;
61
61
  try {
@@ -132,7 +132,7 @@ export function isValidPluginName(name: unknown): name is string {
132
132
  *
133
133
  * Returns the strongly-typed manifest if the field is present and
134
134
  * well-formed (`category` is one of the four known categories and `type`
135
- * is a non-empty string). Returns `null` if the field is absent that
135
+ * is a non-empty string). Returns `null` if the field is absent �?that
136
136
  * is the host's signal that the package is a library, not a plugin.
137
137
  *
138
138
  * Throws if the field is present but malformed: that's a packaging bug
@@ -170,9 +170,7 @@ export function readPluginManifest(pkgJson: unknown): PluginManifest | null {
170
170
  /**
171
171
  * Instance-scoped plugin registry. Each workspace in a multi-tenant sidecar
172
172
  * owns its own PluginRegistry, so installing/uninstalling a driver in one
173
- * workspace cannot clobber another. The process-wide `defaultRegistry`
174
- * exported at the bottom of this file preserves the historical free-function
175
- * API (registerPlugin / getHandler / …) for CLI and single-tenant hosts.
173
+ * workspace cannot clobber another.
176
174
  */
177
175
  export class PluginRegistry {
178
176
  private readonly registries = {
@@ -216,12 +214,12 @@ export class PluginRegistry {
216
214
  if (wasReplaced) {
217
215
  // D18: surface silent shadowing. Hot-reload flows legitimately replace
218
216
  // handlers; installing two different plugin packages that both claim
219
- // the same (category, type) does not the second wins and breaks the
217
+ // the same (category, type) does not �?the second wins and breaks the
220
218
  // first's consumers with no audit trail. A console.warn is cheap,
221
219
  // respects existing callers that rely on 'replaced', and gives ops a
222
220
  // grep-able signal when registrations collide unexpectedly.
223
221
  console.warn(
224
- `[tagma-sdk] registerPlugin: replaced existing ${category}/${type} ` +
222
+ `[tagma-sdk] registerPlugin: replaced existing ${category}/${type} �?` +
225
223
  `check for duplicate plugin packages claiming the same type.`,
226
224
  );
227
225
  }
@@ -231,8 +229,7 @@ export class PluginRegistry {
231
229
  /**
232
230
  * Remove a plugin from the in-process registry. Returns true if a plugin
233
231
  * was actually removed. Note: ESM module caching is not affected, so
234
- * re-importing the same file after unregister will yield the cached module
235
- * callers wanting a fresh load must restart the host process.
232
+ * re-importing the same file after unregister will yield the cached module �? * callers wanting a fresh load must restart the host process.
236
233
  */
237
234
  unregisterPlugin(category: PluginCategory, type: string): boolean {
238
235
  if (!VALID_CATEGORIES.has(category)) return false;
@@ -299,42 +296,3 @@ export class PluginRegistry {
299
296
  }
300
297
  }
301
298
  }
302
-
303
- /**
304
- * Process-wide default registry. Preserves the historical free-function API
305
- * for CLI and single-tenant hosts. Multi-tenant hosts (the editor sidecar
306
- * after the one-sidecar refactor) build their own `PluginRegistry` per
307
- * workspace and pass it through `RunPipelineOptions.registry`.
308
- */
309
- export const defaultRegistry = new PluginRegistry();
310
-
311
- export function registerPlugin<T extends PluginType>(
312
- category: PluginCategory,
313
- type: string,
314
- handler: T,
315
- ): RegisterResult {
316
- return defaultRegistry.registerPlugin(category, type, handler);
317
- }
318
-
319
- export function unregisterPlugin(category: PluginCategory, type: string): boolean {
320
- return defaultRegistry.unregisterPlugin(category, type);
321
- }
322
-
323
- export function getHandler<T extends PluginType>(category: PluginCategory, type: string): T {
324
- return defaultRegistry.getHandler<T>(category, type);
325
- }
326
-
327
- export function hasHandler(category: PluginCategory, type: string): boolean {
328
- return defaultRegistry.hasHandler(category, type);
329
- }
330
-
331
- export function listRegistered(category: PluginCategory): string[] {
332
- return defaultRegistry.listRegistered(category);
333
- }
334
-
335
- export function loadPlugins(
336
- pluginNames: readonly string[],
337
- resolveFrom?: string,
338
- ): Promise<void> {
339
- return defaultRegistry.loadPlugins(pluginNames, resolveFrom);
340
- }
@@ -0,0 +1,84 @@
1
+ import { describe, expect, test } from 'bun:test';
2
+ import { mkdtempSync, rmSync } from 'node:fs';
3
+ import { tmpdir } from 'node:os';
4
+ import { join } from 'node:path';
5
+ import { createTagma } from './tagma';
6
+ import type { DriverPlugin, PipelineConfig } from './types';
7
+
8
+ function makeDir(prefix: string): string {
9
+ return mkdtempSync(join(tmpdir(), prefix));
10
+ }
11
+
12
+ function makeDriver(name: string, marker: string[]): DriverPlugin {
13
+ return {
14
+ name,
15
+ capabilities: { sessionResume: false, systemPrompt: false, outputFormat: false },
16
+ async buildCommand() {
17
+ marker.push(name);
18
+ return { args: ['echo', name] };
19
+ },
20
+ };
21
+ }
22
+
23
+ describe('createTagma', () => {
24
+ test('instances own isolated plugin registries', () => {
25
+ const seenA: string[] = [];
26
+ const seenB: string[] = [];
27
+ const tagmaA = createTagma({ builtins: false });
28
+ const tagmaB = createTagma({ builtins: false });
29
+
30
+ tagmaA.registry.registerPlugin('drivers', 'mock', makeDriver('driver-a', seenA));
31
+ tagmaB.registry.registerPlugin('drivers', 'mock', makeDriver('driver-b', seenB));
32
+
33
+ expect(tagmaA.registry.getHandler<DriverPlugin>('drivers', 'mock').name).toBe('driver-a');
34
+ expect(tagmaB.registry.getHandler<DriverPlugin>('drivers', 'mock').name).toBe('driver-b');
35
+ expect(seenA).toEqual([]);
36
+ expect(seenB).toEqual([]);
37
+ });
38
+
39
+ test('run uses only the instance registry', async () => {
40
+ const tagma = createTagma({ builtins: false });
41
+ const dir = makeDir('tagma-instance-run-');
42
+ try {
43
+ await expect(
44
+ tagma.run(
45
+ {
46
+ name: 'instance-run',
47
+ tracks: [
48
+ {
49
+ id: 't',
50
+ name: 'T',
51
+ tasks: [{ id: 'prompt', name: 'prompt', prompt: 'hello' }],
52
+ },
53
+ ],
54
+ },
55
+ {
56
+ cwd: dir,
57
+ skipPluginLoading: true,
58
+ },
59
+ ),
60
+ ).rejects.toThrow(/driver "opencode" not registered/);
61
+ } finally {
62
+ rmSync(dir, { recursive: true, force: true });
63
+ }
64
+ });
65
+
66
+ test('validate returns structural pipeline errors without running tasks', () => {
67
+ const tagma = createTagma({ builtins: false });
68
+
69
+ expect(
70
+ tagma.validate({
71
+ name: 'invalid',
72
+ tracks: [
73
+ {
74
+ id: 't',
75
+ name: 'T',
76
+ tasks: [
77
+ { id: 'a', name: 'A', command: 'echo a', depends_on: ['missing'] },
78
+ ],
79
+ },
80
+ ],
81
+ }),
82
+ ).toEqual(['Task reference "missing" not found']);
83
+ });
84
+ });
package/src/tagma.ts ADDED
@@ -0,0 +1,47 @@
1
+ import { runPipeline, type EngineResult, type RunPipelineOptions } from './engine';
2
+ import { bootstrapBuiltins } from './bootstrap';
3
+ import { PluginRegistry } from './registry';
4
+ import { validateConfig } from './schema';
5
+ import type { PipelineConfig } from './types';
6
+
7
+ export interface CreateTagmaOptions {
8
+ /**
9
+ * Registry used by this SDK instance. Omit to create an isolated registry.
10
+ */
11
+ readonly registry?: PluginRegistry;
12
+ /**
13
+ * Register built-in drivers/triggers/completions/middlewares into the
14
+ * instance registry. Defaults to true.
15
+ */
16
+ readonly builtins?: boolean;
17
+ }
18
+
19
+ export interface TagmaRunOptions extends Omit<RunPipelineOptions, 'registry'> {
20
+ readonly cwd: string;
21
+ }
22
+
23
+ export interface Tagma {
24
+ readonly registry: PluginRegistry;
25
+ run(config: PipelineConfig, options: TagmaRunOptions): Promise<EngineResult>;
26
+ validate(config: PipelineConfig): readonly string[];
27
+ }
28
+
29
+ export function createTagma(options: CreateTagmaOptions = {}): Tagma {
30
+ const registry = options.registry ?? new PluginRegistry();
31
+ if (options.builtins !== false) {
32
+ bootstrapBuiltins(registry);
33
+ }
34
+
35
+ return {
36
+ registry,
37
+ run(config, { cwd, ...runOptions }) {
38
+ return runPipeline(config, cwd, {
39
+ ...runOptions,
40
+ registry,
41
+ });
42
+ },
43
+ validate(config) {
44
+ return validateConfig(config);
45
+ },
46
+ };
47
+ }
@@ -0,0 +1,8 @@
1
+ export {
2
+ parseDuration,
3
+ validatePath,
4
+ generateRunId,
5
+ nowISO,
6
+ truncateForName,
7
+ } from './utils';
8
+
package/src/yaml.ts ADDED
@@ -0,0 +1,11 @@
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
+
package/dist/sdk.d.ts DELETED
@@ -1,32 +0,0 @@
1
- export { runPipeline, TriggerBlockedError, TriggerTimeoutError } from './engine';
2
- export type { EngineResult, RunPipelineOptions, RunEventPayload } from './engine';
3
- export { PipelineRunner } from './pipeline-runner';
4
- export type { PipelineRunnerStatus } from './pipeline-runner';
5
- export { createEmptyPipeline, setPipelineField, upsertTrack, removeTrack, moveTrack, updateTrack, upsertTask, removeTask, moveTask, transferTask, } from './config-ops';
6
- export { validateRaw } from './validate-raw';
7
- export type { ValidationError, KnownPluginTypes } from './validate-raw';
8
- export { compileYamlContent } from './yaml-compiler';
9
- export type { YamlCompileResult, CompileYamlOptions } from './yaml-compiler';
10
- export { parseYaml, resolveConfig, loadPipeline, serializePipeline, deresolvePipeline, validateConfig, } from './schema';
11
- export { buildDag, buildRawDag } from './dag';
12
- export type { DagNode, Dag, RawDagNode, RawDag } from './dag';
13
- export { bootstrapBuiltins } from './bootstrap';
14
- export { PluginRegistry, defaultRegistry, loadPlugins, registerPlugin, unregisterPlugin, getHandler, hasHandler, listRegistered, isValidPluginName, PLUGIN_NAME_RE, readPluginManifest, } from './registry';
15
- export type { RegisterResult } from './registry';
16
- export { InMemoryApprovalGateway } from './approval';
17
- export type { ApprovalGateway, ApprovalRequest, ApprovalDecision, ApprovalOutcome, ApprovalEvent, ApprovalListener, } from './approval';
18
- export { attachStdinApprovalAdapter } from './adapters/stdin-approval';
19
- export type { StdinApprovalAdapter } from './adapters/stdin-approval';
20
- export { attachWebSocketApprovalAdapter } from './adapters/websocket-approval';
21
- export type { WebSocketApprovalAdapter, WebSocketApprovalAdapterOptions, } from './adapters/websocket-approval';
22
- export { Logger, tailLines, clip } from './logger';
23
- export type { LogRecord, LogLevel, LogListener } from './logger';
24
- export type { HookResult, PipelineInfo, TrackInfo, TaskInfo } from './hooks';
25
- export { parseDuration, validatePath, generateRunId, nowISO, truncateForName, _resetShellCache, } from './utils';
26
- export { TASK_ID_RE, isValidTaskId, qualifyTaskId, isQualifiedRef, buildTaskIndex, resolveTaskRef, AMBIGUOUS, } from './task-ref';
27
- export type { TaskIndex, RefResolution } from './task-ref';
28
- export { promptDocumentFromString, serializePromptDocument, appendContext, prependContext, renderInputsBlock, renderOutputSchemaBlock, } from './prompt-doc';
29
- export { substituteInputs, extractInputReferences, resolveTaskBindingInputs, resolveTaskInputs, extractTaskBindingOutputs, extractTaskOutputs, inferPromptPorts, } from './ports';
30
- export type { SubstituteResult, BindingInputResolution, UpstreamBindingData, InputResolution, ExtractResult, PromptPortInference, PromptPortConflict, PromptUpstreamNeighbor, PromptDownstreamNeighbor, } from './ports';
31
- export * from './types';
32
- //# sourceMappingURL=sdk.d.ts.map
package/dist/sdk.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../src/sdk.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACjF,YAAY,EAAE,YAAY,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAGlF,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAG9D,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,WAAW,EACX,SAAS,EACT,WAAW,EACX,UAAU,EACV,UAAU,EACV,QAAQ,EACR,YAAY,GACb,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGxE,OAAO,EAAE,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SAAS,CAAC;AAG7E,OAAO,EACL,aAAa,EACb,YAAY,EACZ,aAAa,EACb,MAAM,EACN,eAAe,EACf,gBAAgB,GACjB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,UAAU,EACV,aAAa,EACb,aAAa,EACb,cAAc,EACd,cAAc,EACd,cAAc,EACd,SAAS,GACV,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAG3D,OAAO,EACL,wBAAwB,EACxB,uBAAuB,EACvB,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,cAAc,CAAC;AAKtB,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,wBAAwB,EACxB,iBAAiB,EACjB,yBAAyB,EACzB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,SAAS,CAAC;AACjB,YAAY,EACV,gBAAgB,EAChB,sBAAsB,EACtB,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,SAAS,CAAC;AAGjB,cAAc,SAAS,CAAC"}
package/dist/sdk.js DELETED
@@ -1,41 +0,0 @@
1
- // ═══ tagma-sdk public API ═══
2
- //
3
- // This is the SDK entry point. Import from here, not from internal modules.
4
- // The CLI (src/index.ts in the CLI project) also imports from here.
5
- // ── Core engine ──
6
- export { runPipeline, TriggerBlockedError, TriggerTimeoutError } from './engine';
7
- // ── Pipeline runner (multi-pipeline lifecycle management) ──
8
- export { PipelineRunner } from './pipeline-runner';
9
- // ── Raw config CRUD (visual editor / YAML sync) ──
10
- export { createEmptyPipeline, setPipelineField, upsertTrack, removeTrack, moveTrack, updateTrack, upsertTask, removeTask, moveTask, transferTask, } from './config-ops';
11
- // ── Raw config validation (real-time feedback) ──
12
- export { validateRaw } from './validate-raw';
13
- // ── YAML compiler (validation + compile log support) ──
14
- export { compileYamlContent } from './yaml-compiler';
15
- // ── Schema: parse / resolve / load / serialize / validate ──
16
- export { parseYaml, resolveConfig, loadPipeline, serializePipeline, deresolvePipeline, validateConfig, } from './schema';
17
- // ── DAG ──
18
- export { buildDag, buildRawDag } from './dag';
19
- // ── Plugin registry ──
20
- export { bootstrapBuiltins } from './bootstrap';
21
- export { PluginRegistry, defaultRegistry, loadPlugins, registerPlugin, unregisterPlugin, getHandler, hasHandler, listRegistered, isValidPluginName, PLUGIN_NAME_RE, readPluginManifest, } from './registry';
22
- // ── Approval gateway ──
23
- export { InMemoryApprovalGateway } from './approval';
24
- // ── Approval adapters ──
25
- export { attachStdinApprovalAdapter } from './adapters/stdin-approval';
26
- export { attachWebSocketApprovalAdapter } from './adapters/websocket-approval';
27
- // ── Logger ──
28
- export { Logger, tailLines, clip } from './logger';
29
- // ── Utils (public subset) ──
30
- export { parseDuration, validatePath, generateRunId, nowISO, truncateForName, _resetShellCache, } from './utils';
31
- // ── Task reference resolution (shared id normalization) ──
32
- export { TASK_ID_RE, isValidTaskId, qualifyTaskId, isQualifiedRef, buildTaskIndex, resolveTaskRef, AMBIGUOUS, } from './task-ref';
33
- // ── Prompt document helpers (middleware authors + drivers) ──
34
- export { promptDocumentFromString, serializePromptDocument, appendContext, prependContext, renderInputsBlock, renderOutputSchemaBlock, } from './prompt-doc';
35
- // ── Task ports (editor: substitute placeholders, resolve upstream
36
- // values, extract downstream outputs; drivers that wrap the prompt
37
- // may want substituteInputs on their own envelope) ──
38
- export { substituteInputs, extractInputReferences, resolveTaskBindingInputs, resolveTaskInputs, extractTaskBindingOutputs, extractTaskOutputs, inferPromptPorts, } from './ports';
39
- // ── All types from @tagma/types + runtime constants ──
40
- export * from './types';
41
- //# sourceMappingURL=sdk.js.map
package/dist/sdk.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"sdk.js","sourceRoot":"","sources":["../src/sdk.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,EAAE;AACF,4EAA4E;AAC5E,oEAAoE;AAEpE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,EACN,eAAe,EACf,gBAAgB,GACjB,MAAM,SAAS,CAAC;AAEjB,4DAA4D;AAC5D,OAAO,EACL,UAAU,EACV,aAAa,EACb,aAAa,EACb,cAAc,EACd,cAAc,EACd,cAAc,EACd,SAAS,GACV,MAAM,YAAY,CAAC;AAGpB,+DAA+D;AAC/D,OAAO,EACL,wBAAwB,EACxB,uBAAuB,EACvB,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,cAAc,CAAC;AAEtB,mEAAmE;AACnE,sEAAsE;AACtE,yDAAyD;AACzD,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,wBAAwB,EACxB,iBAAiB,EACjB,yBAAyB,EACzB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,SAAS,CAAC;AAajB,wDAAwD;AACxD,cAAc,SAAS,CAAC"}
package/src/sdk.ts DELETED
@@ -1,151 +0,0 @@
1
- // ═══ tagma-sdk public API ═══
2
- //
3
- // This is the SDK entry point. Import from here, not from internal modules.
4
- // The CLI (src/index.ts in the CLI project) also imports from here.
5
-
6
- // ── Core engine ──
7
- export { runPipeline, TriggerBlockedError, TriggerTimeoutError } from './engine';
8
- export type { EngineResult, RunPipelineOptions, RunEventPayload } from './engine';
9
-
10
- // ── Pipeline runner (multi-pipeline lifecycle management) ──
11
- export { PipelineRunner } from './pipeline-runner';
12
- export type { PipelineRunnerStatus } from './pipeline-runner';
13
-
14
- // ── Raw config CRUD (visual editor / YAML sync) ──
15
- export {
16
- createEmptyPipeline,
17
- setPipelineField,
18
- upsertTrack,
19
- removeTrack,
20
- moveTrack,
21
- updateTrack,
22
- upsertTask,
23
- removeTask,
24
- moveTask,
25
- transferTask,
26
- } from './config-ops';
27
-
28
- // ── Raw config validation (real-time feedback) ──
29
- export { validateRaw } from './validate-raw';
30
- export type { ValidationError, KnownPluginTypes } from './validate-raw';
31
-
32
- // ── YAML compiler (validation + compile log support) ──
33
- export { compileYamlContent } from './yaml-compiler';
34
- export type { YamlCompileResult, CompileYamlOptions } from './yaml-compiler';
35
-
36
- // ── Schema: parse / resolve / load / serialize / validate ──
37
- export {
38
- parseYaml,
39
- resolveConfig,
40
- loadPipeline,
41
- serializePipeline,
42
- deresolvePipeline,
43
- validateConfig,
44
- } from './schema';
45
-
46
- // ── DAG ──
47
- export { buildDag, buildRawDag } from './dag';
48
- export type { DagNode, Dag, RawDagNode, RawDag } from './dag';
49
-
50
- // ── Plugin registry ──
51
- export { bootstrapBuiltins } from './bootstrap';
52
- export {
53
- PluginRegistry,
54
- defaultRegistry,
55
- loadPlugins,
56
- registerPlugin,
57
- unregisterPlugin,
58
- getHandler,
59
- hasHandler,
60
- listRegistered,
61
- isValidPluginName,
62
- PLUGIN_NAME_RE,
63
- readPluginManifest,
64
- } from './registry';
65
- export type { RegisterResult } from './registry';
66
-
67
- // ── Approval gateway ──
68
- export { InMemoryApprovalGateway } from './approval';
69
- export type {
70
- ApprovalGateway,
71
- ApprovalRequest,
72
- ApprovalDecision,
73
- ApprovalOutcome,
74
- ApprovalEvent,
75
- ApprovalListener,
76
- } from './approval';
77
-
78
- // ── Approval adapters ──
79
- export { attachStdinApprovalAdapter } from './adapters/stdin-approval';
80
- export type { StdinApprovalAdapter } from './adapters/stdin-approval';
81
- export { attachWebSocketApprovalAdapter } from './adapters/websocket-approval';
82
- export type {
83
- WebSocketApprovalAdapter,
84
- WebSocketApprovalAdapterOptions,
85
- } from './adapters/websocket-approval';
86
-
87
- // ── Logger ──
88
- export { Logger, tailLines, clip } from './logger';
89
- export type { LogRecord, LogLevel, LogListener } from './logger';
90
-
91
- // ── Hook context types (useful for frontend display) ──
92
- export type { HookResult, PipelineInfo, TrackInfo, TaskInfo } from './hooks';
93
-
94
- // ── Utils (public subset) ──
95
- export {
96
- parseDuration,
97
- validatePath,
98
- generateRunId,
99
- nowISO,
100
- truncateForName,
101
- _resetShellCache,
102
- } from './utils';
103
-
104
- // ── Task reference resolution (shared id normalization) ──
105
- export {
106
- TASK_ID_RE,
107
- isValidTaskId,
108
- qualifyTaskId,
109
- isQualifiedRef,
110
- buildTaskIndex,
111
- resolveTaskRef,
112
- AMBIGUOUS,
113
- } from './task-ref';
114
- export type { TaskIndex, RefResolution } from './task-ref';
115
-
116
- // ── Prompt document helpers (middleware authors + drivers) ──
117
- export {
118
- promptDocumentFromString,
119
- serializePromptDocument,
120
- appendContext,
121
- prependContext,
122
- renderInputsBlock,
123
- renderOutputSchemaBlock,
124
- } from './prompt-doc';
125
-
126
- // ── Task ports (editor: substitute placeholders, resolve upstream
127
- // values, extract downstream outputs; drivers that wrap the prompt
128
- // may want substituteInputs on their own envelope) ──
129
- export {
130
- substituteInputs,
131
- extractInputReferences,
132
- resolveTaskBindingInputs,
133
- resolveTaskInputs,
134
- extractTaskBindingOutputs,
135
- extractTaskOutputs,
136
- inferPromptPorts,
137
- } from './ports';
138
- export type {
139
- SubstituteResult,
140
- BindingInputResolution,
141
- UpstreamBindingData,
142
- InputResolution,
143
- ExtractResult,
144
- PromptPortInference,
145
- PromptPortConflict,
146
- PromptUpstreamNeighbor,
147
- PromptDownstreamNeighbor,
148
- } from './ports';
149
-
150
- // ── All types from @tagma/types + runtime constants ──
151
- export * from './types';