@tagma/sdk 0.7.38 → 0.7.40
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 +47 -27
- package/dist/compatibility.d.ts +46 -0
- package/dist/compatibility.d.ts.map +1 -0
- package/dist/compatibility.js +317 -0
- package/dist/compatibility.js.map +1 -0
- package/dist/completions/file-exists.d.ts.map +1 -1
- package/dist/completions/file-exists.js +3 -5
- package/dist/completions/file-exists.js.map +1 -1
- package/dist/completions/output-check.js +1 -1
- package/dist/completions/output-check.js.map +1 -1
- package/dist/config-ops.d.ts +11 -7
- package/dist/config-ops.d.ts.map +1 -1
- package/dist/config-ops.js +128 -13
- package/dist/config-ops.js.map +1 -1
- package/dist/drivers/opencode.d.ts.map +1 -1
- package/dist/drivers/opencode.js +23 -18
- package/dist/drivers/opencode.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/middlewares/static-context.d.ts.map +1 -1
- package/dist/middlewares/static-context.js +6 -6
- package/dist/middlewares/static-context.js.map +1 -1
- package/dist/pipeline-runner.d.ts.map +1 -1
- package/dist/pipeline-runner.js +36 -6
- package/dist/pipeline-runner.js.map +1 -1
- package/dist/plugin-config.d.ts +6 -0
- package/dist/plugin-config.d.ts.map +1 -0
- package/dist/plugin-config.js +26 -0
- package/dist/plugin-config.js.map +1 -0
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +51 -17
- package/dist/schema.js.map +1 -1
- package/dist/tagma.d.ts +4 -1
- package/dist/tagma.d.ts.map +1 -1
- package/dist/tagma.js +13 -3
- package/dist/tagma.js.map +1 -1
- package/dist/triggers/directory.d.ts.map +1 -1
- package/dist/triggers/directory.js +4 -6
- package/dist/triggers/directory.js.map +1 -1
- package/dist/triggers/file.d.ts.map +1 -1
- package/dist/triggers/file.js +3 -4
- package/dist/triggers/file.js.map +1 -1
- package/dist/triggers/manual.d.ts.map +1 -1
- package/dist/triggers/manual.js +6 -2
- package/dist/triggers/manual.js.map +1 -1
- package/dist/validate-raw.d.ts.map +1 -1
- package/dist/validate-raw.js +187 -21
- package/dist/validate-raw.js.map +1 -1
- package/dist/workdir.d.ts +3 -0
- package/dist/workdir.d.ts.map +1 -0
- package/dist/workdir.js +12 -0
- package/dist/workdir.js.map +1 -0
- package/dist/workflow.d.ts.map +1 -1
- package/dist/workflow.js +150 -35
- package/dist/workflow.js.map +1 -1
- package/dist/yaml.d.ts +2 -0
- package/dist/yaml.d.ts.map +1 -1
- package/dist/yaml.js +1 -0
- package/dist/yaml.js.map +1 -1
- package/package.json +9 -4
package/README.md
CHANGED
|
@@ -86,6 +86,8 @@ directly only when you need lower-level package boundaries.
|
|
|
86
86
|
|
|
87
87
|
```yaml
|
|
88
88
|
pipeline:
|
|
89
|
+
requires:
|
|
90
|
+
sdk: '>=0.7.40'
|
|
89
91
|
name: my-pipeline
|
|
90
92
|
mode: trusted
|
|
91
93
|
driver: opencode
|
|
@@ -149,17 +151,20 @@ pipeline:
|
|
|
149
151
|
|
|
150
152
|
### Pipeline Fields
|
|
151
153
|
|
|
152
|
-
| Field | Type
|
|
153
|
-
| ------------- |
|
|
154
|
-
| `
|
|
155
|
-
| `
|
|
156
|
-
| `
|
|
157
|
-
| `
|
|
158
|
-
| `
|
|
159
|
-
| `
|
|
160
|
-
| `
|
|
161
|
-
| `
|
|
162
|
-
| `
|
|
154
|
+
| Field | Type | Required | Description |
|
|
155
|
+
| ------------- | ------------------ | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
156
|
+
| `requires` | `{ sdk?: string }` | No | SDK-owned compatibility gate. `serializePipeline()` adds or raises `requires.sdk` when the YAML uses features that need a newer SDK |
|
|
157
|
+
| `name` | `string` | Yes | Pipeline name, used in logs and run IDs |
|
|
158
|
+
| `mode` | `trusted \| safe` | No | Execution boundary. Defaults to `safe`; `safe` blocks shell tasks, hooks, automatic plugins, execute permissions, and non-allowlisted capabilities |
|
|
159
|
+
| `driver` | `string` | No | Default driver for all tracks/tasks (inherited). Built-in: `opencode` |
|
|
160
|
+
| `model` | `string` | No | Default model for all tracks/tasks (inherited). Exact model name, e.g. `claude-sonnet-4-6` |
|
|
161
|
+
| `permissions` | `Permissions` | No | Default permissions inherited by all tracks/tasks (see Permissions) |
|
|
162
|
+
| `timeout` | `string` | No | Pipeline-level timeout. Format: `"30s"`, `"5m"`, `"2h"` |
|
|
163
|
+
| `plugins` | `string[]` | No | External plugin packages to load, e.g. `["@tagma/driver-codex"]` |
|
|
164
|
+
| `hooks` | `HooksConfig` | No | Shell commands to run at lifecycle events (see Hooks below) |
|
|
165
|
+
| `tracks` | `TrackConfig[]` | Yes | List of parallel execution tracks |
|
|
166
|
+
|
|
167
|
+
`requires.sdk` is a lower-bound SDK gate such as `">=0.7.40"`; plain `"0.7.40"` is accepted as equivalent. Older SDKs must not run a document that declares a higher requirement. Hosts and chat agents should not guess this value manually: save through `serializePipeline()` / `serializeWorkflow()` or call `inferYamlCompatibility()` and write the returned `sdkRequirement`. If an existing document declares a higher SDK requirement, the serializer preserves it rather than downgrading.
|
|
163
168
|
|
|
164
169
|
### Hooks Fields
|
|
165
170
|
|
|
@@ -413,6 +418,7 @@ File and directory trigger watch paths may be relative to `workDir`, absolute, o
|
|
|
413
418
|
- `createTagma(options?)`
|
|
414
419
|
- `createTagma().run(config, options)` for either a single `PipelineConfig` or a `PipelineGraphConfig`
|
|
415
420
|
- `createTagma().runYaml(content, options)` for either `pipeline:` or `workflow:` YAML documents
|
|
421
|
+
- `createTagma().validate(config, { cwd? })`
|
|
416
422
|
- `detectTagmaYamlKind(content)`
|
|
417
423
|
- `loadTagmaYaml(content, workDir)`
|
|
418
424
|
- `bunRuntime()`
|
|
@@ -430,6 +436,9 @@ File and directory trigger watch paths may be relative to `workDir`, absolute, o
|
|
|
430
436
|
- `deresolvePipeline(config, workDir)`
|
|
431
437
|
- `validateConfig(config)`
|
|
432
438
|
- `compileYamlContent(content, options?)`
|
|
439
|
+
- `inferYamlCompatibility(content)`
|
|
440
|
+
- `inferPipelineCompatibility(config)`
|
|
441
|
+
- `inferWorkflowCompatibility(config)`
|
|
433
442
|
- `loadWorkflow(yaml, workDir)`
|
|
434
443
|
- `parseWorkflowYaml(content)`
|
|
435
444
|
- `serializeWorkflow(config)`
|
|
@@ -499,6 +508,11 @@ Options:
|
|
|
499
508
|
- `plugins` -- register package-level `TagmaPlugin` capability objects into the instance registry
|
|
500
509
|
- `runtime` -- override process execution, file/directory watching, file/directory existence checks, log storage, time, and sleep; defaults to `bunRuntime()`
|
|
501
510
|
|
|
511
|
+
`createTagma().validate(config, { cwd })` validates a resolved pipeline without
|
|
512
|
+
executing it. Pass `cwd` for the same cwd safety checks that `run()` performs;
|
|
513
|
+
omitting it preserves structural-only validation for callers that do not have a
|
|
514
|
+
workspace root yet.
|
|
515
|
+
|
|
502
516
|
### `createTagma().run(config, options): Promise<EngineResult>`
|
|
503
517
|
|
|
504
518
|
Executes a single pipeline. Returns `{ success, runId, logPath, summary, states }`.
|
|
@@ -530,6 +544,8 @@ Workflow graph YAML wraps multiple pipeline YAML files and lets the SDK execute
|
|
|
530
544
|
|
|
531
545
|
```yaml
|
|
532
546
|
workflow:
|
|
547
|
+
requires:
|
|
548
|
+
sdk: '>=0.7.40'
|
|
533
549
|
kind: graph
|
|
534
550
|
name: release-flow
|
|
535
551
|
max_concurrency: 2
|
|
@@ -549,6 +565,8 @@ Per-pipeline `lifecycle.max_runs` defaults to `1`. `lifecycle.stop_when` default
|
|
|
549
565
|
|
|
550
566
|
`createTagma().run(graphConfig, options)` runs a programmatic `PipelineGraphConfig`. `createTagma().runYaml(content, options)` detects either top-level `pipeline:` or `workflow:` YAML and returns `{ kind: 'pipeline' | 'workflow', result }`, so CLI hosts can route one file path through one SDK call.
|
|
551
567
|
|
|
568
|
+
`serializeWorkflow()` also adds or raises `workflow.requires.sdk`. Raw workflow YAML references external pipeline files by `path`; each referenced pipeline file is loaded and checked through `loadPipeline()`, so nested pipeline requirements are enforced at run time too.
|
|
569
|
+
|
|
552
570
|
### `PipelineRunner`
|
|
553
571
|
|
|
554
572
|
Higher-level wrapper for managing multiple concurrent pipeline runs — designed for sidecar / Tauri IPC scenarios where the frontend controls pipeline lifecycle by ID.
|
|
@@ -568,11 +586,13 @@ runner.start(); // returns Promise<EngineResult>, idempotent
|
|
|
568
586
|
// Cancel from IPC
|
|
569
587
|
runner.abort();
|
|
570
588
|
|
|
571
|
-
// Live wire-shape task mirror, maintained from run_start + task_update + task_log events.
|
|
589
|
+
// Live wire-shape task mirror, maintained from run_start + task_update + task_log + task_output events.
|
|
572
590
|
// Empty map before the first run_start; safe to read at any time.
|
|
573
591
|
// task_log entries with a non-null taskId are folded into RunTaskState.logs
|
|
574
592
|
// (capped at TASK_LOG_CAP) and totalLogCount, so hosts get a self-contained
|
|
575
593
|
// per-task view without having to buffer the event stream themselves.
|
|
594
|
+
// task_output chunks are folded into RunTaskState.stdout/stderr while a task
|
|
595
|
+
// is running; the terminal task_update replaces them with the final bounded tail.
|
|
576
596
|
// Pipeline-wide log lines (taskId: null — config dump, DAG topology,
|
|
577
597
|
// hook output without a [task:<id>] prefix) are NOT folded into any task's
|
|
578
598
|
// log buffer; subscribe at the event stream level if you need them.
|
|
@@ -656,7 +676,7 @@ export const HttpTrigger: TriggerPlugin = {
|
|
|
656
676
|
|
|
657
677
|
Trigger `watch()` methods must return `{ fired, dispose }`: the engine awaits
|
|
658
678
|
`fired` and calls `dispose()` on success, failure, task timeout, and pipeline
|
|
659
|
-
abort. The schema is purely descriptive — plugins still perform their own runtime validation. Supported field types: `string`, `number`, `boolean`, `enum`, `path`, `duration`, `number-or-list`. Each field can declare `required`, `default`, `description`, `enum`, `min`/`max`, `placeholder`. Built-in plugins (`file`/`manual` triggers; `exit_code`/`file_exists`/`output_check` completions; `static_context` middleware) all ship with schemas so editors can generate forms out of the box.
|
|
679
|
+
abort. The schema is purely descriptive — plugins still perform their own runtime validation. Supported field types: `string`, `number`, `boolean`, `enum`, `path`, `duration`, `number-or-list`, `command`, `json`. Each field can declare `required`, `default`, `description`, `enum`, `min`/`max`, `placeholder`. Built-in plugins (`file`/`manual` triggers; `exit_code`/`file_exists`/`output_check` completions; `static_context` middleware) all ship with schemas so editors can generate forms out of the box.
|
|
660
680
|
|
|
661
681
|
### `PluginRegistry.getHandler(category, type): PluginType`
|
|
662
682
|
|
|
@@ -712,18 +732,18 @@ config = upsertTask(config, 'backend', { id: 'implement', prompt: 'Add /health e
|
|
|
712
732
|
const yaml = serializePipeline(config);
|
|
713
733
|
```
|
|
714
734
|
|
|
715
|
-
| Function | Description
|
|
716
|
-
| -------------------------------------------------------------------- |
|
|
717
|
-
| `createEmptyPipeline(name)` | Create a minimal pipeline config
|
|
718
|
-
| `setPipelineField(config, fields)` | Update top-level pipeline fields
|
|
719
|
-
| `upsertTrack(config, track)` | Insert or replace a track by id
|
|
720
|
-
| `removeTrack(config, trackId)`
|
|
721
|
-
| `moveTrack(config, trackId, toIndex)` | Reorder a track
|
|
722
|
-
| `updateTrack(config, trackId, fields)` | Patch track fields (not tasks)
|
|
723
|
-
| `upsertTask(config, trackId, task)` | Insert or replace a task
|
|
724
|
-
| `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 |
|
|
725
|
-
| `moveTask(config, trackId, taskId, toIndex)` | Reorder a task within its track
|
|
726
|
-
| `transferTask(config, fromTrackId, taskId, toTrackId, qualifyRefs?)` | Move a task across tracks (see invariants below)
|
|
735
|
+
| Function | Description |
|
|
736
|
+
| -------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
737
|
+
| `createEmptyPipeline(name)` | Create a minimal pipeline config |
|
|
738
|
+
| `setPipelineField(config, fields)` | Update top-level pipeline fields |
|
|
739
|
+
| `upsertTrack(config, track)` | Insert or replace a track by id |
|
|
740
|
+
| `removeTrack(config, trackId, cleanRefs?)` | Remove a track; pass `cleanRefs: true` to also strip dangling `depends_on` / `continue_from` / `inputs.from` references to tasks removed with the track |
|
|
741
|
+
| `moveTrack(config, trackId, toIndex)` | Reorder a track |
|
|
742
|
+
| `updateTrack(config, trackId, fields)` | Patch track fields (not tasks) |
|
|
743
|
+
| `upsertTask(config, trackId, task)` | Insert or replace a task |
|
|
744
|
+
| `removeTask(config, trackId, taskId, cleanRefs?)` | Remove a task; pass `cleanRefs: true` to also strip dangling `depends_on` / `continue_from` / `inputs.from` references. Only refs that resolve to the deleted task are removed — same-named tasks in other tracks are unaffected |
|
|
745
|
+
| `moveTask(config, trackId, taskId, toIndex)` | Reorder a task within its track |
|
|
746
|
+
| `transferTask(config, fromTrackId, taskId, toTrackId, qualifyRefs?)` | Move a task across tracks (see invariants below) |
|
|
727
747
|
|
|
728
748
|
`transferTask` invariants — the call is a **no-op** (returns the input config unchanged) when:
|
|
729
749
|
|
|
@@ -734,8 +754,8 @@ It never silently drops the source task or overwrites a task in the target track
|
|
|
734
754
|
|
|
735
755
|
When `qualifyRefs` is `true` (default), reference rewriting runs in two passes so same-track shorthand stays correct after the move:
|
|
736
756
|
|
|
737
|
-
- the **moved task's own** bare `depends_on`
|
|
738
|
-
- bare references **from other tasks** that resolved to the moved task are rewritten to `toTrackId.taskId` when same-track resolution would otherwise break (i.e. no shadow task exists in the referencing track and no other track still holds the bare id globally)
|
|
757
|
+
- the **moved task's own** bare `depends_on`, `continue_from`, and `inputs.from` entries that pointed at siblings in the source track are rewritten to `fromTrackId.<dep>` (so they keep pointing at the original peers, not at coincidental same-named tasks in the destination track)
|
|
758
|
+
- bare references **from other tasks** that resolved to the moved task are rewritten to `toTrackId.taskId` when same-track resolution would otherwise break (i.e. no shadow task exists in the referencing track and no other track still holds the bare id globally); this includes `depends_on`, `continue_from`, and `inputs.from`
|
|
739
759
|
|
|
740
760
|
Pass `qualifyRefs: false` to skip both passes — useful when the caller is doing a batch move and will requalify everything itself.
|
|
741
761
|
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { PipelineConfig, PipelineGraphConfig, RawPipelineConfig, RawWorkflowConfig } from '@tagma/types';
|
|
2
|
+
export interface YamlCompatibilityFeature {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
readonly minSdkVersion: string;
|
|
5
|
+
readonly description: string;
|
|
6
|
+
}
|
|
7
|
+
export interface CompatibilityDiagnostic {
|
|
8
|
+
readonly path: string;
|
|
9
|
+
readonly message: string;
|
|
10
|
+
}
|
|
11
|
+
export interface TagmaYamlCompatibility {
|
|
12
|
+
readonly currentSdkVersion: string;
|
|
13
|
+
readonly minSdkVersion: string | null;
|
|
14
|
+
readonly sdkRequirement: string | null;
|
|
15
|
+
readonly declaredSdkRequirement: string | null;
|
|
16
|
+
readonly features: readonly YamlCompatibilityFeature[];
|
|
17
|
+
readonly diagnostics: readonly CompatibilityDiagnostic[];
|
|
18
|
+
}
|
|
19
|
+
export interface ParsedSdkRequirement {
|
|
20
|
+
readonly raw: string;
|
|
21
|
+
readonly minVersion: string;
|
|
22
|
+
}
|
|
23
|
+
export declare const TAGMA_SDK_VERSION: string;
|
|
24
|
+
/**
|
|
25
|
+
* Minimum SDK that understands the `requires.sdk` YAML metadata itself.
|
|
26
|
+
* Keep this aligned with the first package version that ships this file.
|
|
27
|
+
*/
|
|
28
|
+
export declare const YAML_REQUIRES_FIELD_MIN_SDK: string;
|
|
29
|
+
export declare const YAML_FEATURE_MIN_SDK: {
|
|
30
|
+
readonly requires: string;
|
|
31
|
+
readonly workflow: "0.7.0";
|
|
32
|
+
readonly workflow_lifecycle: "0.7.0";
|
|
33
|
+
readonly task_bindings: "0.7.0";
|
|
34
|
+
readonly safe_mode: "0.7.0";
|
|
35
|
+
};
|
|
36
|
+
export declare function compareSemver(a: string, b: string): number;
|
|
37
|
+
export declare function parseSdkRequirement(value: string): ParsedSdkRequirement | null;
|
|
38
|
+
export declare function formatSdkRequirement(version: string): string;
|
|
39
|
+
export declare function sdkRequirementSatisfied(requirement: string, currentVersion?: string): boolean;
|
|
40
|
+
export declare function validateDeclaredSdkRequirement(requires: unknown, path: string, documentLabel: 'pipeline' | 'workflow', currentVersion?: string): CompatibilityDiagnostic[];
|
|
41
|
+
export declare function inferPipelineCompatibility(config: RawPipelineConfig | PipelineConfig): TagmaYamlCompatibility;
|
|
42
|
+
export declare function inferWorkflowCompatibility(config: RawWorkflowConfig | PipelineGraphConfig): TagmaYamlCompatibility;
|
|
43
|
+
export declare function inferYamlCompatibility(content: string): TagmaYamlCompatibility;
|
|
44
|
+
export declare function withInferredPipelineSdkRequirement<T extends RawPipelineConfig | PipelineConfig>(config: T): T;
|
|
45
|
+
export declare function withInferredWorkflowSdkRequirement<T extends RawWorkflowConfig | PipelineGraphConfig>(config: T): T;
|
|
46
|
+
//# sourceMappingURL=compatibility.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compatibility.d.ts","sourceRoot":"","sources":["../src/compatibility.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EAEjB,iBAAiB,EAElB,MAAM,cAAc,CAAC;AAEtB,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;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C,GACR,CAAC,CAEH;AAED,wBAAgB,kCAAkC,CAChD,CAAC,SAAS,iBAAiB,GAAG,mBAAmB,EACjD,MAAM,EAAE,CAAC,GAAG,CAAC,CAEd"}
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
import yaml from 'js-yaml';
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
const SDK_PACKAGE_VERSION_FALLBACK = '0.0.0';
|
|
4
|
+
const SEMVER_RE = /^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/;
|
|
5
|
+
const SDK_REQUIREMENT_RE = /^(?:>=\s*)?(v?\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?)$/;
|
|
6
|
+
const INPUT_PLACEHOLDER_RE = /\{\{\s*inputs\.[A-Za-z_][A-Za-z0-9_]*\b/;
|
|
7
|
+
export const TAGMA_SDK_VERSION = readCurrentSdkVersion();
|
|
8
|
+
/**
|
|
9
|
+
* Minimum SDK that understands the `requires.sdk` YAML metadata itself.
|
|
10
|
+
* Keep this aligned with the first package version that ships this file.
|
|
11
|
+
*/
|
|
12
|
+
export const YAML_REQUIRES_FIELD_MIN_SDK = TAGMA_SDK_VERSION;
|
|
13
|
+
export const YAML_FEATURE_MIN_SDK = {
|
|
14
|
+
requires: YAML_REQUIRES_FIELD_MIN_SDK,
|
|
15
|
+
workflow: '0.7.0',
|
|
16
|
+
workflow_lifecycle: '0.7.0',
|
|
17
|
+
task_bindings: '0.7.0',
|
|
18
|
+
safe_mode: '0.7.0',
|
|
19
|
+
};
|
|
20
|
+
const FEATURE_DESCRIPTIONS = {
|
|
21
|
+
requires: 'YAML declares SDK compatibility metadata with requires.sdk',
|
|
22
|
+
workflow: 'YAML uses the workflow graph document format',
|
|
23
|
+
workflow_lifecycle: 'Workflow pipeline declares lifecycle retry policy',
|
|
24
|
+
task_bindings: 'Pipeline tasks declare inputs/outputs bindings or input placeholders',
|
|
25
|
+
safe_mode: 'Pipeline declares an explicit safe/trusted execution mode',
|
|
26
|
+
};
|
|
27
|
+
export function compareSemver(a, b) {
|
|
28
|
+
const left = parseSemver(a);
|
|
29
|
+
const right = parseSemver(b);
|
|
30
|
+
if (!left || !right) {
|
|
31
|
+
throw new Error(`Cannot compare invalid semver values "${a}" and "${b}"`);
|
|
32
|
+
}
|
|
33
|
+
for (const key of ['major', 'minor', 'patch']) {
|
|
34
|
+
const diff = left[key] - right[key];
|
|
35
|
+
if (diff !== 0)
|
|
36
|
+
return diff > 0 ? 1 : -1;
|
|
37
|
+
}
|
|
38
|
+
if (left.prerelease.length === 0 && right.prerelease.length === 0)
|
|
39
|
+
return 0;
|
|
40
|
+
if (left.prerelease.length === 0)
|
|
41
|
+
return 1;
|
|
42
|
+
if (right.prerelease.length === 0)
|
|
43
|
+
return -1;
|
|
44
|
+
const count = Math.max(left.prerelease.length, right.prerelease.length);
|
|
45
|
+
for (let i = 0; i < count; i++) {
|
|
46
|
+
const l = left.prerelease[i];
|
|
47
|
+
const r = right.prerelease[i];
|
|
48
|
+
if (l === undefined)
|
|
49
|
+
return -1;
|
|
50
|
+
if (r === undefined)
|
|
51
|
+
return 1;
|
|
52
|
+
const lNum = /^\d+$/.test(l) ? Number(l) : null;
|
|
53
|
+
const rNum = /^\d+$/.test(r) ? Number(r) : null;
|
|
54
|
+
if (lNum !== null && rNum !== null) {
|
|
55
|
+
if (lNum !== rNum)
|
|
56
|
+
return lNum > rNum ? 1 : -1;
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
if (lNum !== null)
|
|
60
|
+
return -1;
|
|
61
|
+
if (rNum !== null)
|
|
62
|
+
return 1;
|
|
63
|
+
if (l !== r)
|
|
64
|
+
return l > r ? 1 : -1;
|
|
65
|
+
}
|
|
66
|
+
return 0;
|
|
67
|
+
}
|
|
68
|
+
export function parseSdkRequirement(value) {
|
|
69
|
+
const trimmed = value.trim();
|
|
70
|
+
const match = SDK_REQUIREMENT_RE.exec(trimmed);
|
|
71
|
+
if (!match)
|
|
72
|
+
return null;
|
|
73
|
+
const version = normalizeVersion(match[1]);
|
|
74
|
+
return version ? { raw: trimmed, minVersion: version } : null;
|
|
75
|
+
}
|
|
76
|
+
export function formatSdkRequirement(version) {
|
|
77
|
+
return `>=${version}`;
|
|
78
|
+
}
|
|
79
|
+
export function sdkRequirementSatisfied(requirement, currentVersion = TAGMA_SDK_VERSION) {
|
|
80
|
+
const parsed = parseSdkRequirement(requirement);
|
|
81
|
+
if (!parsed)
|
|
82
|
+
return false;
|
|
83
|
+
return compareSemver(currentVersion, parsed.minVersion) >= 0;
|
|
84
|
+
}
|
|
85
|
+
export function validateDeclaredSdkRequirement(requires, path, documentLabel, currentVersion = TAGMA_SDK_VERSION) {
|
|
86
|
+
if (requires === undefined)
|
|
87
|
+
return [];
|
|
88
|
+
const diagnostics = [];
|
|
89
|
+
if (!isRecord(requires)) {
|
|
90
|
+
return [
|
|
91
|
+
{
|
|
92
|
+
path,
|
|
93
|
+
message: `${path} must be an object with sdk: ">=x.y.z"`,
|
|
94
|
+
},
|
|
95
|
+
];
|
|
96
|
+
}
|
|
97
|
+
for (const field of Object.keys(requires)) {
|
|
98
|
+
if (field === 'sdk')
|
|
99
|
+
continue;
|
|
100
|
+
diagnostics.push({
|
|
101
|
+
path: `${path}.${field}`,
|
|
102
|
+
message: `Unknown ${path} field "${field}"`,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
const rawSdk = requires.sdk;
|
|
106
|
+
if (rawSdk === undefined) {
|
|
107
|
+
diagnostics.push({ path: `${path}.sdk`, message: `${path}.sdk is required` });
|
|
108
|
+
return diagnostics;
|
|
109
|
+
}
|
|
110
|
+
if (typeof rawSdk !== 'string') {
|
|
111
|
+
diagnostics.push({
|
|
112
|
+
path: `${path}.sdk`,
|
|
113
|
+
message: `${path}.sdk must be a version requirement like ">=0.8.0"`,
|
|
114
|
+
});
|
|
115
|
+
return diagnostics;
|
|
116
|
+
}
|
|
117
|
+
const parsed = parseSdkRequirement(rawSdk);
|
|
118
|
+
if (!parsed) {
|
|
119
|
+
diagnostics.push({
|
|
120
|
+
path: `${path}.sdk`,
|
|
121
|
+
message: `${path}.sdk must be a version requirement like ">=0.8.0"`,
|
|
122
|
+
});
|
|
123
|
+
return diagnostics;
|
|
124
|
+
}
|
|
125
|
+
if (compareSemver(currentVersion, parsed.minVersion) < 0) {
|
|
126
|
+
diagnostics.push({
|
|
127
|
+
path: `${path}.sdk`,
|
|
128
|
+
message: `This ${documentLabel} requires @tagma/sdk >=${parsed.minVersion}, current is ${currentVersion}.`,
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
return diagnostics;
|
|
132
|
+
}
|
|
133
|
+
export function inferPipelineCompatibility(config) {
|
|
134
|
+
return buildCompatibility(config.requires, collectPipelineFeatures(config), 'pipeline');
|
|
135
|
+
}
|
|
136
|
+
export function inferWorkflowCompatibility(config) {
|
|
137
|
+
return buildCompatibility(config.requires, collectWorkflowFeatures(config), 'workflow');
|
|
138
|
+
}
|
|
139
|
+
export function inferYamlCompatibility(content) {
|
|
140
|
+
const doc = yaml.load(content);
|
|
141
|
+
if (!isRecord(doc)) {
|
|
142
|
+
throw new Error('YAML must contain a top-level "pipeline" or "workflow" key');
|
|
143
|
+
}
|
|
144
|
+
const hasPipeline = Object.prototype.hasOwnProperty.call(doc, 'pipeline');
|
|
145
|
+
const hasWorkflow = Object.prototype.hasOwnProperty.call(doc, 'workflow');
|
|
146
|
+
if (hasPipeline && hasWorkflow) {
|
|
147
|
+
throw new Error('YAML must not contain both top-level "pipeline" and "workflow" keys');
|
|
148
|
+
}
|
|
149
|
+
if (hasPipeline) {
|
|
150
|
+
if (!isRecord(doc.pipeline))
|
|
151
|
+
throw new Error('pipeline must be an object');
|
|
152
|
+
return inferPipelineCompatibility(doc.pipeline);
|
|
153
|
+
}
|
|
154
|
+
if (hasWorkflow) {
|
|
155
|
+
if (!isRecord(doc.workflow))
|
|
156
|
+
throw new Error('workflow must be an object');
|
|
157
|
+
return inferWorkflowCompatibility(doc.workflow);
|
|
158
|
+
}
|
|
159
|
+
throw new Error('YAML must contain a top-level "pipeline" or "workflow" key');
|
|
160
|
+
}
|
|
161
|
+
export function withInferredPipelineSdkRequirement(config) {
|
|
162
|
+
return withInferredSdkRequirement(config, inferPipelineCompatibility(config));
|
|
163
|
+
}
|
|
164
|
+
export function withInferredWorkflowSdkRequirement(config) {
|
|
165
|
+
return withInferredSdkRequirement(config, inferWorkflowCompatibility(config));
|
|
166
|
+
}
|
|
167
|
+
function buildCompatibility(requires, features, documentLabel) {
|
|
168
|
+
const declared = declaredSdkRequirement(requires);
|
|
169
|
+
let minSdkVersion = maxFeatureVersion(features);
|
|
170
|
+
if (declared)
|
|
171
|
+
minSdkVersion = maxVersion(minSdkVersion, declared.minVersion);
|
|
172
|
+
if (features.length > 0 || requires !== undefined) {
|
|
173
|
+
minSdkVersion = maxVersion(minSdkVersion, YAML_REQUIRES_FIELD_MIN_SDK);
|
|
174
|
+
}
|
|
175
|
+
return {
|
|
176
|
+
currentSdkVersion: TAGMA_SDK_VERSION,
|
|
177
|
+
minSdkVersion,
|
|
178
|
+
sdkRequirement: minSdkVersion ? formatSdkRequirement(minSdkVersion) : null,
|
|
179
|
+
declaredSdkRequirement: declared?.raw ?? null,
|
|
180
|
+
features,
|
|
181
|
+
diagnostics: validateDeclaredSdkRequirement(requires, 'requires', documentLabel),
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
function withInferredSdkRequirement(config, compatibility) {
|
|
185
|
+
if (!compatibility.minSdkVersion)
|
|
186
|
+
return config;
|
|
187
|
+
const declared = declaredSdkRequirement(config.requires);
|
|
188
|
+
const existingSdk = config.requires?.sdk;
|
|
189
|
+
if (existingSdk !== undefined && !declared)
|
|
190
|
+
return config;
|
|
191
|
+
const target = declared && compareSemver(declared.minVersion, compatibility.minSdkVersion) > 0
|
|
192
|
+
? declared.minVersion
|
|
193
|
+
: compatibility.minSdkVersion;
|
|
194
|
+
return {
|
|
195
|
+
...config,
|
|
196
|
+
requires: {
|
|
197
|
+
...(isRecord(config.requires) ? config.requires : {}),
|
|
198
|
+
sdk: formatSdkRequirement(target),
|
|
199
|
+
},
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
function collectPipelineFeatures(config) {
|
|
203
|
+
const features = new Map();
|
|
204
|
+
if (config.requires !== undefined)
|
|
205
|
+
addFeature(features, 'requires');
|
|
206
|
+
if (config.mode !== undefined)
|
|
207
|
+
addFeature(features, 'safe_mode');
|
|
208
|
+
const tracks = Array.isArray(config.tracks) ? config.tracks : [];
|
|
209
|
+
for (const track of tracks) {
|
|
210
|
+
const tasks = Array.isArray(track.tasks) ? track.tasks : [];
|
|
211
|
+
for (const task of tasks) {
|
|
212
|
+
if (taskUsesBindings(task))
|
|
213
|
+
addFeature(features, 'task_bindings');
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return [...features.values()];
|
|
217
|
+
}
|
|
218
|
+
function collectWorkflowFeatures(config) {
|
|
219
|
+
const features = new Map();
|
|
220
|
+
addFeature(features, 'workflow');
|
|
221
|
+
if (config.requires !== undefined)
|
|
222
|
+
addFeature(features, 'requires');
|
|
223
|
+
const pipelines = Array.isArray(config.pipelines) ? config.pipelines : [];
|
|
224
|
+
for (const pipeline of pipelines) {
|
|
225
|
+
if (isRecord(pipeline) && pipeline.lifecycle !== undefined) {
|
|
226
|
+
addFeature(features, 'workflow_lifecycle');
|
|
227
|
+
}
|
|
228
|
+
if (isRecord(pipeline) && isRecord(pipeline.config)) {
|
|
229
|
+
for (const feature of collectPipelineFeatures(pipeline.config)) {
|
|
230
|
+
features.set(feature.id, feature);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
return [...features.values()];
|
|
235
|
+
}
|
|
236
|
+
function taskUsesBindings(task) {
|
|
237
|
+
if (Object.prototype.hasOwnProperty.call(task, 'inputs'))
|
|
238
|
+
return true;
|
|
239
|
+
if (Object.prototype.hasOwnProperty.call(task, 'outputs'))
|
|
240
|
+
return true;
|
|
241
|
+
if (typeof task.command === 'string' && INPUT_PLACEHOLDER_RE.test(task.command))
|
|
242
|
+
return true;
|
|
243
|
+
if (typeof task.prompt === 'string' && INPUT_PLACEHOLDER_RE.test(task.prompt))
|
|
244
|
+
return true;
|
|
245
|
+
if (isRecord(task.command) && typeof task.command.shell === 'string') {
|
|
246
|
+
return INPUT_PLACEHOLDER_RE.test(task.command.shell);
|
|
247
|
+
}
|
|
248
|
+
if (isRecord(task.command) && Array.isArray(task.command.argv)) {
|
|
249
|
+
return task.command.argv.some((arg) => typeof arg === 'string' && INPUT_PLACEHOLDER_RE.test(arg));
|
|
250
|
+
}
|
|
251
|
+
return false;
|
|
252
|
+
}
|
|
253
|
+
function addFeature(features, id) {
|
|
254
|
+
if (features.has(id))
|
|
255
|
+
return;
|
|
256
|
+
features.set(id, {
|
|
257
|
+
id,
|
|
258
|
+
minSdkVersion: YAML_FEATURE_MIN_SDK[id],
|
|
259
|
+
description: FEATURE_DESCRIPTIONS[id],
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
function maxFeatureVersion(features) {
|
|
263
|
+
let max = null;
|
|
264
|
+
for (const feature of features)
|
|
265
|
+
max = maxVersion(max, feature.minSdkVersion);
|
|
266
|
+
return max;
|
|
267
|
+
}
|
|
268
|
+
function maxVersion(a, b) {
|
|
269
|
+
if (a === null)
|
|
270
|
+
return b;
|
|
271
|
+
if (b === null)
|
|
272
|
+
return a;
|
|
273
|
+
return compareSemver(a, b) >= 0 ? a : b;
|
|
274
|
+
}
|
|
275
|
+
function declaredSdkRequirement(requires) {
|
|
276
|
+
if (!isRecord(requires) || typeof requires.sdk !== 'string')
|
|
277
|
+
return null;
|
|
278
|
+
return parseSdkRequirement(requires.sdk);
|
|
279
|
+
}
|
|
280
|
+
function parseSemver(value) {
|
|
281
|
+
const match = SEMVER_RE.exec(value.trim());
|
|
282
|
+
if (!match)
|
|
283
|
+
return null;
|
|
284
|
+
return {
|
|
285
|
+
major: Number(match[1]),
|
|
286
|
+
minor: Number(match[2]),
|
|
287
|
+
patch: Number(match[3]),
|
|
288
|
+
prerelease: match[4] ? match[4].split('.') : [],
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
function normalizeVersion(value) {
|
|
292
|
+
if (!value)
|
|
293
|
+
return null;
|
|
294
|
+
const parsed = parseSemver(value);
|
|
295
|
+
if (!parsed)
|
|
296
|
+
return null;
|
|
297
|
+
const prerelease = parsed.prerelease.length > 0 ? `-${parsed.prerelease.join('.')}` : '';
|
|
298
|
+
return `${parsed.major}.${parsed.minor}.${parsed.patch}${prerelease}`;
|
|
299
|
+
}
|
|
300
|
+
function readCurrentSdkVersion() {
|
|
301
|
+
try {
|
|
302
|
+
const raw = readFileSync(new URL('../package.json', import.meta.url), 'utf8');
|
|
303
|
+
const parsed = JSON.parse(raw);
|
|
304
|
+
if (typeof parsed.version === 'string' && parseSemver(parsed.version)) {
|
|
305
|
+
return normalizeVersion(parsed.version) ?? SDK_PACKAGE_VERSION_FALLBACK;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
catch {
|
|
309
|
+
// Fall through to the explicit fallback. This should only happen in
|
|
310
|
+
// unusual test bundles that omit package.json.
|
|
311
|
+
}
|
|
312
|
+
return SDK_PACKAGE_VERSION_FALLBACK;
|
|
313
|
+
}
|
|
314
|
+
function isRecord(value) {
|
|
315
|
+
return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
|
|
316
|
+
}
|
|
317
|
+
//# sourceMappingURL=compatibility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compatibility.js","sourceRoot":"","sources":["../src/compatibility.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AA0CvC,MAAM,4BAA4B,GAAG,OAAO,CAAC;AAC7C,MAAM,SAAS,GAAG,+CAA+C,CAAC;AAClE,MAAM,kBAAkB,GAA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C,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-exists.d.ts","sourceRoot":"","sources":["../../src/completions/file-exists.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAiC,MAAM,cAAc,CAAC;AAKpF,eAAO,MAAM,oBAAoB,EAAE,
|
|
1
|
+
{"version":3,"file":"file-exists.d.ts","sourceRoot":"","sources":["../../src/completions/file-exists.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAiC,MAAM,cAAc,CAAC;AAKpF,eAAO,MAAM,oBAAoB,EAAE,gBA0DlC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { stat } from 'node:fs/promises';
|
|
2
|
-
import {
|
|
2
|
+
import { requiredPluginString, resolvePluginPath } from '../plugin-config';
|
|
3
3
|
export const FileExistsCompletion = {
|
|
4
4
|
name: 'file_exists',
|
|
5
5
|
schema: {
|
|
@@ -24,10 +24,8 @@ export const FileExistsCompletion = {
|
|
|
24
24
|
},
|
|
25
25
|
},
|
|
26
26
|
async check(config, _result, ctx) {
|
|
27
|
-
const filePath = config
|
|
28
|
-
|
|
29
|
-
throw new Error('file_exists completion: "path" is required');
|
|
30
|
-
const safePath = validatePath(filePath, ctx.workDir);
|
|
27
|
+
const filePath = requiredPluginString(config, 'path', 'file_exists completion');
|
|
28
|
+
const safePath = resolvePluginPath(filePath, ctx.workDir);
|
|
31
29
|
const kind = config.kind ?? 'any';
|
|
32
30
|
if (kind !== 'file' && kind !== 'dir' && kind !== 'any') {
|
|
33
31
|
throw new Error(`file_exists completion: "kind" must be "file" | "dir" | "any", got "${kind}"`);
|
|
@@ -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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I,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"}
|
|
@@ -7,7 +7,7 @@ export const OutputCheckCompletion = {
|
|
|
7
7
|
description: 'Pipe the task output into a shell command; mark success when that command exits 0. For AI driver tasks the driver-normalized text is piped (not the raw NDJSON); command tasks see their raw stdout.',
|
|
8
8
|
fields: {
|
|
9
9
|
check: {
|
|
10
|
-
type: '
|
|
10
|
+
type: 'command',
|
|
11
11
|
required: true,
|
|
12
12
|
description: 'Shell command string or { argv: string[] } to run. The task output is piped to stdin.',
|
|
13
13
|
placeholder: '{ "argv": ["grep", "-q", "PASS"] }',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output-check.js","sourceRoot":"","sources":["../../src/completions/output-check.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAEzD,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAElC,MAAM,CAAC,MAAM,qBAAqB,GAAqB;IACrD,IAAI,EAAE,cAAc;IACpB,MAAM,EAAE;QACN,WAAW,EACT,sMAAsM;QACxM,MAAM,EAAE;YACN,KAAK,EAAE;gBACL,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"output-check.js","sourceRoot":"","sources":["../../src/completions/output-check.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAEzD,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAElC,MAAM,CAAC,MAAM,qBAAqB,GAAqB;IACrD,IAAI,EAAE,cAAc;IACpB,MAAM,EAAE;QACN,WAAW,EACT,sMAAsM;QACxM,MAAM,EAAE;YACN,KAAK,EAAE;gBACL,IAAI,EAAE,SAAS;gBACf,QAAQ,EAAE,IAAI;gBACd,WAAW,EACT,uFAAuF;gBACzF,WAAW,EAAE,oCAAoC;aAClD;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,UAAU;gBAChB,OAAO,EAAE,KAAK;gBACd,WAAW,EAAE,6CAA6C;gBAC1D,WAAW,EAAE,KAAK;aACnB;SACF;KACF;IAED,KAAK,CAAC,KAAK,CACT,MAA+B,EAC/B,MAAkB,EAClB,GAAsB;QAEtB,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC;QAC9B,IACE,OAAO,QAAQ,KAAK,QAAQ;YAC5B,CAAC,CACC,QAAQ;gBACR,OAAO,QAAQ,KAAK,QAAQ;gBAC5B,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC;gBACxB,CAAC,CAAC,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