@tagma/sdk 0.7.3 → 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 +85 -57
- package/dist/approval.d.ts +2 -12
- package/dist/approval.d.ts.map +1 -1
- package/dist/approval.js +1 -90
- package/dist/approval.js.map +1 -1
- package/dist/bootstrap.d.ts +1 -1
- package/dist/bootstrap.d.ts.map +1 -1
- 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/engine.d.ts +5 -56
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +7 -297
- package/dist/engine.js.map +1 -1
- package/dist/index.d.ts +4 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -4
- package/dist/index.js.map +1 -1
- package/dist/logger.d.ts +2 -60
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +1 -153
- package/dist/logger.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/plugins.d.ts +2 -2
- package/dist/plugins.d.ts.map +1 -1
- package/dist/plugins.js +1 -1
- package/dist/plugins.js.map +1 -1
- package/dist/runner.d.ts +1 -35
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +1 -610
- package/dist/runner.js.map +1 -1
- package/dist/runtime/adapters/stdin-approval.d.ts +2 -0
- package/dist/runtime/adapters/stdin-approval.d.ts.map +1 -0
- package/dist/runtime/adapters/stdin-approval.js +2 -0
- package/dist/runtime/adapters/stdin-approval.js.map +1 -0
- package/dist/runtime/adapters/websocket-approval.d.ts +2 -0
- package/dist/runtime/adapters/websocket-approval.d.ts.map +1 -0
- package/dist/runtime/adapters/websocket-approval.js +2 -0
- package/dist/runtime/adapters/websocket-approval.js.map +1 -0
- package/dist/runtime/bun-process-runner.d.ts +2 -0
- package/dist/runtime/bun-process-runner.d.ts.map +1 -0
- package/dist/runtime/bun-process-runner.js +2 -0
- package/dist/runtime/bun-process-runner.js.map +1 -0
- package/dist/runtime.d.ts +2 -8
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +1 -7
- package/dist/runtime.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/tagma.d.ts +3 -4
- package/dist/tagma.d.ts.map +1 -1
- package/dist/tagma.js +2 -3
- package/dist/tagma.js.map +1 -1
- package/dist/triggers/file.d.ts.map +1 -1
- package/dist/triggers/file.js +74 -108
- 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 +20 -22
- package/dist/adapters/stdin-approval.d.ts +0 -6
- package/dist/adapters/stdin-approval.d.ts.map +0 -1
- package/dist/adapters/stdin-approval.js +0 -90
- package/dist/adapters/stdin-approval.js.map +0 -1
- package/dist/adapters/websocket-approval.d.ts +0 -28
- package/dist/adapters/websocket-approval.d.ts.map +0 -1
- package/dist/adapters/websocket-approval.js +0 -147
- 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 -601
- 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 -67
- package/dist/registry.d.ts.map +0 -1
- package/dist/registry.js +0 -293
- 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 -106
- package/src/adapters/websocket-approval.ts +0 -224
- package/src/approval.ts +0 -131
- 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 -256
- 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 -743
- 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 -156
- package/src/engine-ports.test.ts +0 -166
- package/src/engine-task-type.test.ts +0 -56
- package/src/engine.ts +0 -458
- package/src/hooks.ts +0 -193
- package/src/index.ts +0 -33
- package/src/logger.ts +0 -182
- package/src/middlewares/static-context.ts +0 -49
- package/src/pipeline-definition.ts +0 -5
- package/src/pipeline-runner.test.ts +0 -91
- package/src/pipeline-runner.ts +0 -194
- package/src/plugin-registry.test.ts +0 -382
- 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 -353
- package/src/runner.test.ts +0 -142
- package/src/runner.ts +0 -666
- package/src/runtime.ts +0 -20
- 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 -155
- package/src/tagma.ts +0 -62
- package/src/task-ref.test.ts +0 -401
- package/src/task-ref.ts +0 -121
- package/src/triggers/file.ts +0 -164
- 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
package/README.md
CHANGED
|
@@ -64,6 +64,8 @@ console.log(result.success ? 'Done' : 'Failed');
|
|
|
64
64
|
|
|
65
65
|
The package root is intentionally small. Use explicit subpaths for YAML,
|
|
66
66
|
config editing, plugin registry helpers, and low-level dataflow utilities.
|
|
67
|
+
The SDK composes `@tagma/core` with `@tagma/runtime-bun`; import those packages
|
|
68
|
+
directly only when you need lower-level package boundaries.
|
|
67
69
|
|
|
68
70
|
## Features
|
|
69
71
|
|
|
@@ -145,16 +147,16 @@ pipeline:
|
|
|
145
147
|
|
|
146
148
|
### Pipeline Fields
|
|
147
149
|
|
|
148
|
-
| Field
|
|
149
|
-
|
|
|
150
|
-
| `name`
|
|
151
|
-
| `driver`
|
|
152
|
-
| `model`
|
|
153
|
-
| `permissions` | `Permissions`
|
|
154
|
-
| `timeout`
|
|
155
|
-
| `plugins`
|
|
156
|
-
| `hooks`
|
|
157
|
-
| `tracks`
|
|
150
|
+
| Field | Type | Required | Description |
|
|
151
|
+
| ------------- | --------------- | -------- | ------------------------------------------------------------------------------------------ |
|
|
152
|
+
| `name` | `string` | Yes | Pipeline name, used in logs and run IDs |
|
|
153
|
+
| `driver` | `string` | No | Default driver for all tracks/tasks (inherited). Built-in: `opencode` |
|
|
154
|
+
| `model` | `string` | No | Default model for all tracks/tasks (inherited). Exact model name, e.g. `claude-sonnet-4-6` |
|
|
155
|
+
| `permissions` | `Permissions` | No | Default permissions inherited by all tracks/tasks (see Permissions) |
|
|
156
|
+
| `timeout` | `string` | No | Pipeline-level timeout. Format: `"30s"`, `"5m"`, `"2h"` |
|
|
157
|
+
| `plugins` | `string[]` | No | External plugin packages to load, e.g. `["@tagma/driver-codex"]` |
|
|
158
|
+
| `hooks` | `HooksConfig` | No | Shell commands to run at lifecycle events (see Hooks below) |
|
|
159
|
+
| `tracks` | `TrackConfig[]` | Yes | List of parallel execution tracks |
|
|
158
160
|
|
|
159
161
|
### Hooks Fields
|
|
160
162
|
|
|
@@ -204,8 +206,8 @@ Each hook value can be a single command string or an array of commands.
|
|
|
204
206
|
| `middlewares` | `MiddlewareConfig[]` | No | Inherited from track | Middleware override. Set `[]` to disable inherited middlewares |
|
|
205
207
|
| `trigger` | `TriggerConfig` | No | — | Gate that must resolve before the task runs (see Triggers) |
|
|
206
208
|
| `completion` | `CompletionConfig` | No | — | Post-execution check to validate task output (see Completions) |
|
|
207
|
-
| `inputs` | `TaskInputBindings` | No | — | Task input bindings for `{{inputs.<name>}}`; optional `type` enables coercion/validation
|
|
208
|
-
| `outputs` | `TaskOutputBindings` | No | — | Named outputs published after success; optional `type` enables coercion/validation
|
|
209
|
+
| `inputs` | `TaskInputBindings` | No | — | Task input bindings for `{{inputs.<name>}}`; optional `type` enables coercion/validation |
|
|
210
|
+
| `outputs` | `TaskOutputBindings` | No | — | Named outputs published after success; optional `type` enables coercion/validation |
|
|
209
211
|
|
|
210
212
|
### Permissions
|
|
211
213
|
|
|
@@ -290,15 +292,15 @@ Tasks can declare named, typed `inputs` / `outputs`. Inputs flow in from upstrea
|
|
|
290
292
|
|
|
291
293
|
#### Binding fields
|
|
292
294
|
|
|
293
|
-
| Field | Type
|
|
294
|
-
| ------------- |
|
|
295
|
-
| `value` | `unknown`
|
|
296
|
-
| `from` | `string`
|
|
297
|
-
| `default` | `unknown`
|
|
298
|
-
| `required` | `boolean`
|
|
299
|
-
| `type` | `'string' \| 'number' \| 'boolean' \| 'enum' \| 'json'` | No
|
|
300
|
-
| `description` | `string`
|
|
301
|
-
| `enum` | `string[]`
|
|
295
|
+
| Field | Type | Required | Description |
|
|
296
|
+
| ------------- | ------------------------------------------------------- | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
297
|
+
| `value` | `unknown` | No | Literal value. For inputs, this wins over `from` |
|
|
298
|
+
| `from` | `string` | No | Inputs: upstream source such as `taskId.outputs.name`, `taskId.stdout`, or `outputs.name`. Outputs: `json.<key>`, `stdout`, `stderr`, or `normalizedOutput` |
|
|
299
|
+
| `default` | `unknown` | No | Fallback value when the source is missing |
|
|
300
|
+
| `required` | `boolean` | Inputs only | When `true`, missing upstream value and no `default` blocks the task |
|
|
301
|
+
| `type` | `'string' \| 'number' \| 'boolean' \| 'enum' \| 'json'` | No | Optional coercion type. Omit it for pass-through values |
|
|
302
|
+
| `description` | `string` | No | Free-text description; rendered into the `[Inputs]` / `[Output Format]` blocks |
|
|
303
|
+
| `enum` | `string[]` | When `type: enum` | Allowed values |
|
|
302
304
|
|
|
303
305
|
#### Substitution and AI prompt blocks
|
|
304
306
|
|
|
@@ -306,8 +308,6 @@ Tasks can declare named, typed `inputs` / `outputs`. Inputs flow in from upstrea
|
|
|
306
308
|
- AI tasks get `[Output Format]` and `[Inputs]` blocks when typed bindings can be inferred from neighboring command tasks.
|
|
307
309
|
- Output extraction strategy: prefer `normalizedOutput` (AI tasks), fall back to stdout (command tasks). Find the last non-empty line that parses as a JSON object, then read each declared output key. Failures append a diagnostic to stderr; the binding is absent from `outputs` and downstream tasks see it as missing.
|
|
308
310
|
|
|
309
|
-
YAML `ports` has been replaced by typed `inputs` / `outputs`. `validateRaw` reports any `ports` field as a migration error.
|
|
310
|
-
|
|
311
311
|
---
|
|
312
312
|
|
|
313
313
|
### Built-in Triggers
|
|
@@ -403,10 +403,21 @@ YAML `ports` has been replaced by typed `inputs` / `outputs`. `validateRaw` repo
|
|
|
403
403
|
- raw validation helpers
|
|
404
404
|
- task reference helpers
|
|
405
405
|
|
|
406
|
-
### Dataflow helpers: `@tagma/sdk/
|
|
406
|
+
### Dataflow helpers: `@tagma/sdk/dataflow`
|
|
407
407
|
|
|
408
408
|
- placeholder substitution, binding resolution, output extraction, and internal prompt-contract inference
|
|
409
|
-
-
|
|
409
|
+
- stable public subpath for pure dataflow helpers; no runtime/process imports
|
|
410
|
+
|
|
411
|
+
### Runtime approval adapters
|
|
412
|
+
|
|
413
|
+
- `@tagma/sdk/runtime/adapters/stdin-approval`
|
|
414
|
+
- `@tagma/sdk/runtime/adapters/websocket-approval`
|
|
415
|
+
|
|
416
|
+
### Split packages
|
|
417
|
+
|
|
418
|
+
- `@tagma/core` -- runtime-independent orchestration, registry, approval, logging, event/result types, and the `TagmaRuntime` interface
|
|
419
|
+
- `@tagma/runtime-bun` -- Bun process execution, file watching, log storage, `bunRuntime()`, and runtime approval adapters
|
|
420
|
+
- `@tagma/sdk` -- convenience package that composes core + Bun runtime + built-in plugins
|
|
410
421
|
|
|
411
422
|
### `bootstrapBuiltins(registry)`
|
|
412
423
|
|
|
@@ -425,7 +436,7 @@ Options:
|
|
|
425
436
|
- `registry` -- use an existing `PluginRegistry` instance
|
|
426
437
|
- `builtins` -- register built-in plugins into the instance registry; defaults to `true`
|
|
427
438
|
- `plugins` -- register package-level `TagmaPlugin` capability objects into the instance registry
|
|
428
|
-
- `runtime` -- override
|
|
439
|
+
- `runtime` -- override process execution, file watching, file existence checks, log storage, time, and sleep; defaults to `bunRuntime()`
|
|
429
440
|
|
|
430
441
|
### `createTagma().run(config, options): Promise<EngineResult>`
|
|
431
442
|
|
|
@@ -446,7 +457,7 @@ Options:
|
|
|
446
457
|
- `maxLogRuns` -- number of per-run log directories to keep under `<workDir>/.tagma/logs/` (default: 20)
|
|
447
458
|
- `skipPluginLoading` -- skip the engine's built-in `loadPlugins(config.plugins)` call. Set this when the host has already pre-loaded plugins from a custom resolution path (e.g. the editor loading from the user's workspace `node_modules`) so the engine doesn't re-resolve them via Node's default cwd-based import.
|
|
448
459
|
|
|
449
|
-
> **stdout / stderr persistence.**
|
|
460
|
+
> **stdout / stderr persistence.** With the default Bun runtime, the engine streams every task's stdout and stderr to disk under `<workDir>/.tagma/logs/<runId>/<taskId>.stdout` and `.stderr`. Custom runtimes can relocate those artifacts by implementing `runtime.logStore.taskOutputPath()`. The `TaskResult.stdout` / `stderr` strings are bounded tails (8 MB / 4 MB by default) — long outputs are truncated from the head with a marker, and consumers that need the full bytes should read `TaskResult.stdoutPath` / `stderrPath`. Use `TaskResult.stdoutBytes` / `stderrBytes` to display "32 MB (truncated)" without re-stat'ing the file.
|
|
450
461
|
|
|
451
462
|
### `PipelineRunner`
|
|
452
463
|
|
|
@@ -534,6 +545,8 @@ export const HttpTrigger: TriggerPlugin = {
|
|
|
534
545
|
},
|
|
535
546
|
},
|
|
536
547
|
async watch(config, ctx) {
|
|
548
|
+
// Trigger plugins should use ctx.runtime for file IO, watching, and
|
|
549
|
+
// timing so they can run under non-Bun test/runtime implementations.
|
|
537
550
|
/* ... */
|
|
538
551
|
},
|
|
539
552
|
};
|
|
@@ -584,9 +597,7 @@ import {
|
|
|
584
597
|
moveTask,
|
|
585
598
|
transferTask,
|
|
586
599
|
} from '@tagma/sdk/config';
|
|
587
|
-
import {
|
|
588
|
-
serializePipeline,
|
|
589
|
-
} from '@tagma/sdk/yaml';
|
|
600
|
+
import { serializePipeline } from '@tagma/sdk/yaml';
|
|
590
601
|
|
|
591
602
|
// Build a config programmatically
|
|
592
603
|
let config = createEmptyPipeline('my-pipeline');
|
|
@@ -597,18 +608,18 @@ config = upsertTask(config, 'backend', { id: 'implement', prompt: 'Add /health e
|
|
|
597
608
|
const yaml = serializePipeline(config);
|
|
598
609
|
```
|
|
599
610
|
|
|
600
|
-
| Function | Description
|
|
601
|
-
| -------------------------------------------------------------------- |
|
|
602
|
-
| `createEmptyPipeline(name)` | Create a minimal pipeline config
|
|
603
|
-
| `setPipelineField(config, fields)` | Update top-level pipeline fields
|
|
604
|
-
| `upsertTrack(config, track)` | Insert or replace a track by id
|
|
605
|
-
| `removeTrack(config, trackId)` | Remove a track
|
|
606
|
-
| `moveTrack(config, trackId, toIndex)` | Reorder a track
|
|
607
|
-
| `updateTrack(config, trackId, fields)` | Patch track fields (not tasks)
|
|
608
|
-
| `upsertTask(config, trackId, task)` | Insert or replace a task
|
|
609
|
-
| `removeTask(config, trackId, taskId, cleanRefs?)` | Remove a task; pass `cleanRefs: true` to also strip dangling `depends_on` / `continue_from` references. Only refs that resolve to the deleted task are removed — same-named tasks in other tracks are unaffected
|
|
610
|
-
| `moveTask(config, trackId, taskId, toIndex)` | Reorder a task within its track
|
|
611
|
-
| `transferTask(config, fromTrackId, taskId, toTrackId, qualifyRefs?)` | Move a task across tracks (see invariants below)
|
|
611
|
+
| Function | Description |
|
|
612
|
+
| -------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
613
|
+
| `createEmptyPipeline(name)` | Create a minimal pipeline config |
|
|
614
|
+
| `setPipelineField(config, fields)` | Update top-level pipeline fields |
|
|
615
|
+
| `upsertTrack(config, track)` | Insert or replace a track by id |
|
|
616
|
+
| `removeTrack(config, trackId)` | Remove a track |
|
|
617
|
+
| `moveTrack(config, trackId, toIndex)` | Reorder a track |
|
|
618
|
+
| `updateTrack(config, trackId, fields)` | Patch track fields (not tasks) |
|
|
619
|
+
| `upsertTask(config, trackId, task)` | Insert or replace a task |
|
|
620
|
+
| `removeTask(config, trackId, taskId, cleanRefs?)` | Remove a task; pass `cleanRefs: true` to also strip dangling `depends_on` / `continue_from` references. Only refs that resolve to the deleted task are removed — same-named tasks in other tracks are unaffected |
|
|
621
|
+
| `moveTask(config, trackId, taskId, toIndex)` | Reorder a task within its track |
|
|
622
|
+
| `transferTask(config, fromTrackId, taskId, toTrackId, qualifyRefs?)` | Move a task across tracks (see invariants below) |
|
|
612
623
|
|
|
613
624
|
`transferTask` invariants — the call is a **no-op** (returns the input config unchanged) when:
|
|
614
625
|
|
|
@@ -656,17 +667,17 @@ Use `validateRaw` for editing raw configs in a UI; use `validateConfig` after `r
|
|
|
656
667
|
|
|
657
668
|
Pure helpers backing typed task bindings and internal prompt-contract inference. Safe to use in editors, simulators, and custom drivers — no I/O, no side effects.
|
|
658
669
|
|
|
659
|
-
| Function
|
|
660
|
-
|
|
|
661
|
-
| `substituteInputs(text, inputs)`
|
|
662
|
-
| `extractInputReferences(text)`
|
|
663
|
-
| `resolveTaskBindingInputs(task, upstreamData, dependsOn)`
|
|
664
|
-
| `resolveTaskInputs(task, upstreamOutputs, dependsOn)`
|
|
665
|
-
| `extractTaskBindingOutputs(outputs, stdout, stderr, normalizedOutput)` | Publish lightweight task-level `outputs` from final-line JSON, stdout/stderr, normalized output, literal values, or defaults
|
|
666
|
-
| `extractTaskOutputs(ports, stdout, normalizedOutput)`
|
|
667
|
-
| `prependContext(doc, block)`
|
|
668
|
-
| `renderInputsBlock(inputsDecl, values)`
|
|
669
|
-
| `renderOutputSchemaBlock(outputsDecl)`
|
|
670
|
+
| Function | Description |
|
|
671
|
+
| ---------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
672
|
+
| `substituteInputs(text, inputs)` | Expand `{{inputs.<name>}}` placeholders in `text`. Returns `{ text, unresolved }`. Strings pass through, numbers/booleans coerce via `String(...)`, objects/arrays via `JSON.stringify`. Caller is responsible for shell quoting |
|
|
673
|
+
| `extractInputReferences(text)` | Return the set of input port names referenced by `{{inputs.<name>}}` placeholders in `text`. Use at edit time to flag undeclared references |
|
|
674
|
+
| `resolveTaskBindingInputs(task, upstreamData, dependsOn)` | Resolve lightweight task-level `inputs` from literal values, upstream outputs, stdout/stderr, normalized output, defaults, and required flags |
|
|
675
|
+
| `resolveTaskInputs(task, upstreamOutputs, dependsOn)` | Gather the input values a task will consume from its direct upstreams. Applies `from` bindings, defaults, and type coercion. Returns `{ kind: 'ready', inputs, missingOptional }` or `{ kind: 'blocked', missingRequired, ambiguous, typeErrors, reason }` |
|
|
676
|
+
| `extractTaskBindingOutputs(outputs, stdout, stderr, normalizedOutput)` | Publish lightweight task-level `outputs` from final-line JSON, stdout/stderr, normalized output, literal values, or defaults |
|
|
677
|
+
| `extractTaskOutputs(ports, stdout, normalizedOutput)` | Internal helper for inferred prompt contracts. Strategy: prefer `normalizedOutput`; find the last non-empty line that parses as a JSON object; coerce each declared key. Returns `{ outputs, diagnostic }` |
|
|
678
|
+
| `prependContext(doc, block)` | Same shape as `appendContext` but prepends; the engine uses this to place `[Output Format]` and `[Inputs]` blocks before middleware-added context |
|
|
679
|
+
| `renderInputsBlock(inputsDecl, values)` | Build the `[Inputs]` `PromptContextBlock` rendered into AI prompts (`name: value # description` lines). Returns `null` when no inputs to render |
|
|
680
|
+
| `renderOutputSchemaBlock(outputsDecl)` | Build the `[Output Format]` `PromptContextBlock` instructing the model to emit a final-line JSON object matching the declared outputs. Returns `null` when no outputs declared |
|
|
670
681
|
|
|
671
682
|
Custom drivers that wrap the prompt in their own envelope can read `DriverContext.inputs` (resolved + coerced map keyed by port name) and call `substituteInputs` themselves — the engine has already substituted into `task.prompt` upstream, so most drivers can ignore this.
|
|
672
683
|
|
|
@@ -674,7 +685,7 @@ Custom drivers that wrap the prompt in their own envelope can read `DriverContex
|
|
|
674
685
|
|
|
675
686
|
Validates a raw pipeline config without resolving inheritance or executing anything. Returns a flat list of `{ path, message, severity? }` objects — empty array means valid. `severity` is `'error'` (default, fatal) or `'warning'` (soft hint; non-blocking).
|
|
676
687
|
|
|
677
|
-
Checks: required fields, `prompt`/`command` exclusivity, duplicate task IDs within a track, `depends_on`/`continue_from` reference integrity (including ambiguous bare refs that exist in multiple tracks — use `trackId.taskId` to disambiguate), circular dependency detection, binding shape (name format, valid `type`, duplicate names, `enum` requires non-empty `enum` array), `
|
|
688
|
+
Checks: required fields, `prompt`/`command` exclusivity, duplicate task IDs within a track, `depends_on`/`continue_from` reference integrity (including ambiguous bare refs that exist in multiple tracks — use `trackId.taskId` to disambiguate), circular dependency detection, binding shape (name format, valid `type`, duplicate names, `enum` requires non-empty `enum` array), `{{inputs.<name>}}` references resolving to a declared or inferred input binding, and `permissions` shape (must be an object with boolean `read`/`write`/`execute`). Tolerant of half-built configs — non-array `tracks` or `tasks` produce a structured error instead of throwing.
|
|
678
689
|
|
|
679
690
|
Plugin-type checks are opt-in via `knownTypes`: when provided, references to trigger/completion/middleware/driver types that are neither built-in nor in the supplied set produce a **warning** (`severity: 'warning'`) so editors can light up uninstalled plugins without blocking save / run. Omit `knownTypes` for offline / pre-load validation — no plugin warnings are emitted in that case.
|
|
680
691
|
|
|
@@ -734,7 +745,9 @@ Use `buildDag` instead when you have a fully resolved `PipelineConfig` and need
|
|
|
734
745
|
Dual-channel logger — console + file. Creates a per-run log file at `<workDir>/.tagma/logs/<runId>/pipeline.log`.
|
|
735
746
|
|
|
736
747
|
```ts
|
|
737
|
-
|
|
748
|
+
import { bunRuntime } from '@tagma/sdk';
|
|
749
|
+
|
|
750
|
+
const logger = new Logger(workDir, runId, bunRuntime().logStore);
|
|
738
751
|
logger.info('[track]', 'message'); // console + file
|
|
739
752
|
logger.warn('[track]', 'message'); // console + file
|
|
740
753
|
logger.error('[track]', 'message'); // console + file
|
|
@@ -746,13 +759,14 @@ logger.dir; // run artifact directory
|
|
|
746
759
|
logger.close(); // close the persistent file handle (called automatically when Tagma.run completes)
|
|
747
760
|
```
|
|
748
761
|
|
|
749
|
-
Pass an optional
|
|
762
|
+
Pass an optional fourth argument to stream every appended line out as a
|
|
750
763
|
structured `LogRecord`; the engine uses this to emit `task_log` events:
|
|
751
764
|
|
|
752
765
|
```ts
|
|
766
|
+
import { bunRuntime } from '@tagma/sdk';
|
|
753
767
|
import { Logger, type LogRecord } from '@tagma/sdk/logger';
|
|
754
768
|
|
|
755
|
-
const logger = new Logger(workDir, runId, (record: LogRecord) => {
|
|
769
|
+
const logger = new Logger(workDir, runId, bunRuntime().logStore, (record: LogRecord) => {
|
|
756
770
|
// record = { level, taskId, timestamp, text }
|
|
757
771
|
// level = 'info' | 'warn' | 'error' | 'debug' | 'section' | 'quiet'
|
|
758
772
|
// taskId is extracted from a '[task:<id>]' prefix, or null for untagged lines
|
|
@@ -786,11 +800,25 @@ Truncates `text` to at most `maxBytes` UTF-8 bytes (default 16 KB), appending a
|
|
|
786
800
|
| `nowISO()` | Returns `new Date().toISOString()` |
|
|
787
801
|
| `truncateForName(text, maxLen?)` | Truncates first line to `maxLen` (default 40) for display |
|
|
788
802
|
|
|
803
|
+
## Release And Version Behavior
|
|
804
|
+
|
|
805
|
+
`@tagma/sdk` depends on `@tagma/core`, `@tagma/runtime-bun`, and `@tagma/types`, so those packages must exist on npm before publishing the SDK version that references them. Package versions may remain independent; only bump the packages whose public contract changed.
|
|
806
|
+
|
|
807
|
+
Release flow:
|
|
808
|
+
|
|
809
|
+
1. Run `bun run version <package> <patch|minor|major|x.y.z>` for each package whose public contract changed, or `bun run version all patch` when a coordinated release is useful.
|
|
810
|
+
2. Run `bun run build` and `bun run publish:dry` locally before pushing a release commit.
|
|
811
|
+
3. Publish in dependency order: `@tagma/types`, `@tagma/core`, `@tagma/runtime-bun`, plugin packages, then `@tagma/sdk`.
|
|
812
|
+
|
|
813
|
+
Published packages include `dist/` only. Each package build cleans `dist/` before TypeScript compilation so removed entry points cannot leak into the tarball.
|
|
814
|
+
|
|
789
815
|
## Related Packages
|
|
790
816
|
|
|
791
817
|
| Package | Description |
|
|
792
818
|
| ---------------------------------------------------------------------------------------- | --------------------------------------------- |
|
|
793
819
|
| [@tagma/types](https://www.npmjs.com/package/@tagma/types) | Shared TypeScript types |
|
|
820
|
+
| [@tagma/core](https://www.npmjs.com/package/@tagma/core) | Runtime-independent orchestration core |
|
|
821
|
+
| [@tagma/runtime-bun](https://www.npmjs.com/package/@tagma/runtime-bun) | Bun runtime implementation |
|
|
794
822
|
| [@tagma/driver-codex](https://www.npmjs.com/package/@tagma/driver-codex) | Codex CLI driver plugin |
|
|
795
823
|
| [@tagma/driver-claude-code](https://www.npmjs.com/package/@tagma/driver-claude-code) | Claude Code CLI driver plugin |
|
|
796
824
|
| [@tagma/middleware-lightrag](https://www.npmjs.com/package/@tagma/middleware-lightrag) | LightRAG knowledge-graph retrieval middleware |
|
package/dist/approval.d.ts
CHANGED
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export type {
|
|
3
|
-
export declare class InMemoryApprovalGateway implements ApprovalGateway {
|
|
4
|
-
private readonly pendingMap;
|
|
5
|
-
private readonly listeners;
|
|
6
|
-
request(req: Omit<ApprovalRequest, 'id' | 'createdAt'>): Promise<ApprovalDecision>;
|
|
7
|
-
resolve(approvalId: string, decision: Omit<ApprovalDecision, 'approvalId' | 'decidedAt'>): boolean;
|
|
8
|
-
pending(): readonly ApprovalRequest[];
|
|
9
|
-
subscribe(listener: ApprovalListener): () => void;
|
|
10
|
-
abortAll(reason: string): void;
|
|
11
|
-
private emit;
|
|
12
|
-
}
|
|
1
|
+
export { InMemoryApprovalGateway } from '@tagma/core';
|
|
2
|
+
export type { ApprovalDecision, ApprovalEvent, ApprovalGateway, ApprovalListener, ApprovalOutcome, ApprovalRequest, } from '@tagma/core';
|
|
13
3
|
//# sourceMappingURL=approval.d.ts.map
|
package/dist/approval.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"approval.d.ts","sourceRoot":"","sources":["../src/approval.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"approval.d.ts","sourceRoot":"","sources":["../src/approval.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACtD,YAAY,EACV,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,eAAe,GAChB,MAAM,aAAa,CAAC"}
|
package/dist/approval.js
CHANGED
|
@@ -1,91 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { nowISO } from './utils';
|
|
3
|
-
export class InMemoryApprovalGateway {
|
|
4
|
-
pendingMap = new Map();
|
|
5
|
-
listeners = new Set();
|
|
6
|
-
request(req) {
|
|
7
|
-
const full = {
|
|
8
|
-
id: randomUUID(),
|
|
9
|
-
createdAt: nowISO(),
|
|
10
|
-
taskId: req.taskId,
|
|
11
|
-
trackId: req.trackId,
|
|
12
|
-
message: req.message,
|
|
13
|
-
timeoutMs: req.timeoutMs,
|
|
14
|
-
metadata: req.metadata,
|
|
15
|
-
};
|
|
16
|
-
return new Promise((resolvePromise) => {
|
|
17
|
-
let timer = null;
|
|
18
|
-
if (full.timeoutMs > 0) {
|
|
19
|
-
timer = setTimeout(() => {
|
|
20
|
-
const entry = this.pendingMap.get(full.id);
|
|
21
|
-
if (!entry)
|
|
22
|
-
return;
|
|
23
|
-
this.pendingMap.delete(full.id);
|
|
24
|
-
const decision = {
|
|
25
|
-
approvalId: full.id,
|
|
26
|
-
outcome: 'timeout',
|
|
27
|
-
reason: `Approval timed out after ${full.timeoutMs}ms`,
|
|
28
|
-
decidedAt: nowISO(),
|
|
29
|
-
};
|
|
30
|
-
this.emit({ type: 'expired', request: full });
|
|
31
|
-
resolvePromise(decision);
|
|
32
|
-
}, full.timeoutMs);
|
|
33
|
-
}
|
|
34
|
-
this.pendingMap.set(full.id, { request: full, settle: resolvePromise, timer });
|
|
35
|
-
this.emit({ type: 'requested', request: full });
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
resolve(approvalId, decision) {
|
|
39
|
-
const entry = this.pendingMap.get(approvalId);
|
|
40
|
-
if (!entry)
|
|
41
|
-
return false;
|
|
42
|
-
this.pendingMap.delete(approvalId);
|
|
43
|
-
if (entry.timer)
|
|
44
|
-
clearTimeout(entry.timer);
|
|
45
|
-
const full = {
|
|
46
|
-
approvalId,
|
|
47
|
-
outcome: decision.outcome,
|
|
48
|
-
actor: decision.actor,
|
|
49
|
-
reason: decision.reason,
|
|
50
|
-
decidedAt: nowISO(),
|
|
51
|
-
};
|
|
52
|
-
this.emit({ type: 'resolved', request: entry.request, decision: full });
|
|
53
|
-
entry.settle(full);
|
|
54
|
-
return true;
|
|
55
|
-
}
|
|
56
|
-
pending() {
|
|
57
|
-
return Array.from(this.pendingMap.values()).map((e) => e.request);
|
|
58
|
-
}
|
|
59
|
-
subscribe(listener) {
|
|
60
|
-
this.listeners.add(listener);
|
|
61
|
-
return () => {
|
|
62
|
-
this.listeners.delete(listener);
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
abortAll(reason) {
|
|
66
|
-
const entries = Array.from(this.pendingMap.entries());
|
|
67
|
-
this.pendingMap.clear();
|
|
68
|
-
for (const [id, entry] of entries) {
|
|
69
|
-
if (entry.timer)
|
|
70
|
-
clearTimeout(entry.timer);
|
|
71
|
-
this.emit({ type: 'aborted', request: entry.request, reason });
|
|
72
|
-
entry.settle({
|
|
73
|
-
approvalId: id,
|
|
74
|
-
outcome: 'aborted',
|
|
75
|
-
reason,
|
|
76
|
-
decidedAt: nowISO(),
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
emit(event) {
|
|
81
|
-
for (const listener of this.listeners) {
|
|
82
|
-
try {
|
|
83
|
-
listener(event);
|
|
84
|
-
}
|
|
85
|
-
catch (err) {
|
|
86
|
-
console.error('[approval gateway] listener error:', err);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
1
|
+
export { InMemoryApprovalGateway } from '@tagma/core';
|
|
91
2
|
//# sourceMappingURL=approval.js.map
|
package/dist/approval.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"approval.js","sourceRoot":"","sources":["../src/approval.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"approval.js","sourceRoot":"","sources":["../src/approval.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/bootstrap.d.ts
CHANGED
package/dist/bootstrap.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAsBlD,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;CAmBR,CAAC;AAExB;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,CAE9D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-exists.js","sourceRoot":"","sources":["../../src/completions/file-exists.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,OAAO,EAAE,YAAY,E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CAAC;QAChC,IAAI,OAAO,IAAI,IAAI,IAAI,CAAC,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,GAAG,CAAC,CAAC,EAAE,CAAC;YACpE,MAAM,IAAI,KAAK,CAAC,kEAAkE,CAAC,CAAC;QACtF,CAAC;QAED,IAAI,CAAC;YACH,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,CAAC;YAChC,IAAI,IAAI,KAAK,MAAM,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE;gBAAE,OAAO,KAAK,CAAC;YAClD,IAAI,IAAI,KAAK,KAAK,IAAI,CAAC,EAAE,CAAC,WAAW,EAAE;gBAAE,OAAO,KAAK,CAAC;YACtD,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,IAAI,GAAG,OAAO;gBAAE,OAAO,KAAK,CAAC;YAClF,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACtB,MAAM,IAAI,GAAI,GAA6B,CAAC,IAAI,CAAC;YACjD,IAAI,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,SAAS;gBAAE,OAAO,KAAK,CAAC;YAC1D,qEAAqE;YACrE,MAAM,GAAG,CAAC;QACZ,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output-check.d.ts","sourceRoot":"","sources":["../../src/completions/output-check.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAiC,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"output-check.d.ts","sourceRoot":"","sources":["../../src/completions/output-check.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAiC,MAAM,UAAU,CAAC;AAgBhF,eAAO,MAAM,qBAAqB,EAAE,gBA0FnC,CAAC"}
|
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { parseDuration, shellArgs } from '@tagma/core';
|
|
2
2
|
const DEFAULT_TIMEOUT_MS = 30_000;
|
|
3
|
+
async function drain(stream) {
|
|
4
|
+
if (!stream)
|
|
5
|
+
return;
|
|
6
|
+
await stream.pipeTo(new WritableStream({
|
|
7
|
+
write() {
|
|
8
|
+
// Discard check stdout; only exit status matters.
|
|
9
|
+
},
|
|
10
|
+
}));
|
|
11
|
+
}
|
|
3
12
|
export const OutputCheckCompletion = {
|
|
4
13
|
name: 'output_check',
|
|
5
14
|
schema: {
|
|
@@ -62,9 +71,13 @@ export const OutputCheckCompletion = {
|
|
|
62
71
|
throw err;
|
|
63
72
|
}
|
|
64
73
|
}
|
|
65
|
-
//
|
|
66
|
-
//
|
|
67
|
-
const [exitCode, stderr] = await Promise.all([
|
|
74
|
+
// Drain stdout and stderr concurrently so verbose check commands cannot
|
|
75
|
+
// block on pipe buffers while the parent waits for process exit.
|
|
76
|
+
const [exitCode, , stderr] = await Promise.all([
|
|
77
|
+
proc.exited,
|
|
78
|
+
drain(proc.stdout),
|
|
79
|
+
new Response(proc.stderr).text(),
|
|
80
|
+
]);
|
|
68
81
|
if (exitCode !== 0 && stderr.trim()) {
|
|
69
82
|
console.warn(`[output_check] "${checkCmd}" exit=${exitCode}: ${stderr.trim()}`);
|
|
70
83
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output-check.js","sourceRoot":"","sources":["../../src/completions/output-check.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"output-check.js","sourceRoot":"","sources":["../../src/completions/output-check.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAEvD,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAElC,KAAK,UAAU,KAAK,CAAC,MAAyC;IAC5D,IAAI,CAAC,MAAM;QAAE,OAAO;IACpB,MAAM,MAAM,CAAC,MAAM,CACjB,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IAAI,EAAE,EAAE,CAAC;gBACpC,OAAO,CAAC,IAAI,CAAC,mBAAmB,QAAQ,UAAU,QAAQ,KAAK,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAClF,CAAC;YAED,OAAO,QAAQ,KAAK,CAAC,CAAC;QACxB,CAAC;gBAAS,CAAC;YACT,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,IAAI,GAAG,CAAC,MAAM;gBAAE,GAAG,CAAC,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACnE,CAAC;IACH,CAAC;CACF,CAAC"}
|
package/dist/config.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { createEmptyPipeline, setPipelineField, upsertTrack, removeTrack, moveTrack, updateTrack, upsertTask, removeTask, moveTask, transferTask, } from './config-ops';
|
|
2
2
|
export { validateRaw } from './validate-raw';
|
|
3
3
|
export type { ValidationError, KnownPluginTypes } from './validate-raw';
|
|
4
|
-
export { buildRawDag } from '
|
|
5
|
-
export type { RawDag, RawDagNode } from '
|
|
6
|
-
export { TASK_ID_RE, isValidTaskId, qualifyTaskId, isQualifiedRef, buildTaskIndex, resolveTaskRef, AMBIGUOUS, } from '
|
|
7
|
-
export type { TaskIndex, RefResolution } from '
|
|
4
|
+
export { buildRawDag } from '@tagma/core';
|
|
5
|
+
export type { RawDag, RawDagNode } from '@tagma/core';
|
|
6
|
+
export { TASK_ID_RE, isValidTaskId, qualifyTaskId, isQualifiedRef, buildTaskIndex, resolveTaskRef, AMBIGUOUS, } from '@tagma/core';
|
|
7
|
+
export type { TaskIndex, RefResolution } from '@tagma/core';
|
|
8
8
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,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;AACtB,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,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;AACtB,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EACL,UAAU,EACV,aAAa,EACb,aAAa,EACb,cAAc,EACd,cAAc,EACd,cAAc,EACd,SAAS,GACV,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/config.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { createEmptyPipeline, setPipelineField, upsertTrack, removeTrack, moveTrack, updateTrack, upsertTask, removeTask, moveTask, transferTask, } from './config-ops';
|
|
2
2
|
export { validateRaw } from './validate-raw';
|
|
3
|
-
export { buildRawDag } from '
|
|
4
|
-
export { TASK_ID_RE, isValidTaskId, qualifyTaskId, isQualifiedRef, buildTaskIndex, resolveTaskRef, AMBIGUOUS, } from '
|
|
3
|
+
export { buildRawDag } from '@tagma/core';
|
|
4
|
+
export { TASK_ID_RE, isValidTaskId, qualifyTaskId, isQualifiedRef, buildTaskIndex, resolveTaskRef, AMBIGUOUS, } from '@tagma/core';
|
|
5
5
|
//# sourceMappingURL=config.js.map
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,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;AACtB,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,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;AACtB,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EACL,UAAU,EACV,aAAa,EACb,aAAa,EACb,cAAc,EACd,cAAc,EACd,cAAc,EACd,SAAS,GACV,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { extractInputReferences, extractTaskBindingOutputs, extractTaskOutputs, inferPromptPorts, resolveTaskBindingInputs, resolveTaskInputs, substituteInputs, } from '@tagma/core';
|
|
2
|
+
export type { BindingInputResolution, ExtractResult, InputResolution, PromptDownstreamNeighbor, PromptPortConflict, PromptPortInference, PromptUpstreamNeighbor, SubstituteResult, UpstreamBindingData, } from '@tagma/core';
|
|
3
|
+
//# sourceMappingURL=dataflow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataflow.d.ts","sourceRoot":"","sources":["../src/dataflow.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,kBAAkB,EAClB,gBAAgB,EAChB,wBAAwB,EACxB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AAErB,YAAY,EACV,sBAAsB,EACtB,aAAa,EACb,eAAe,EACf,wBAAwB,EACxB,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,aAAa,CAAC"}
|
package/dist/dataflow.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataflow.js","sourceRoot":"","sources":["../src/dataflow.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,kBAAkB,EAClB,gBAAgB,EAChB,wBAAwB,EACxB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"opencode.d.ts","sourceRoot":"","sources":["../../src/drivers/opencode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EAOb,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"opencode.d.ts","sourceRoot":"","sources":["../../src/drivers/opencode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EAOb,MAAM,UAAU,CAAC;AA4JlB,eAAO,MAAM,cAAc,EAAE,YAiL5B,CAAC"}
|