@agentproto/workflow 0.1.0-alpha.1
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/LICENSE +21 -0
- package/README.md +23 -0
- package/dist/chunk-LS5EPMQB.mjs +28 -0
- package/dist/chunk-LS5EPMQB.mjs.map +1 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.mjs +14 -0
- package/dist/index.mjs.map +1 -0
- package/dist/manifest/index.d.ts +79 -0
- package/dist/manifest/index.mjs +28 -0
- package/dist/manifest/index.mjs.map +1 -0
- package/dist/types-DO_05pfH.d.ts +289 -0
- package/package.json +68 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 agentproto contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# @agentproto/workflow
|
|
2
|
+
|
|
3
|
+
AIP-15 `WORKFLOW.md` reference implementation. A markdown + frontmatter format for declaring a multi-step agent workflow's abstract orchestration shape — its steps, branching, parallelism, approval gates, suspend/resume, and compensation. Pairs with the standard `defineWorkflow` / `defineStep` signatures. Implementation lives entirely in the per-step TOOL.md contracts and their AIP-30 DRIVER bindings; workflows themselves are pure orchestration data.
|
|
4
|
+
|
|
5
|
+
> **Status: 0.1.0-alpha.** Generated by `scripts/scaffold-aip.mjs` — `build()` and `validate()` bodies are TODOs.
|
|
6
|
+
|
|
7
|
+
Spec: <https://agentproto.sh/docs/aip-15>
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { defineWorkflow } from "@agentproto/workflow"
|
|
13
|
+
|
|
14
|
+
const x = defineWorkflow({
|
|
15
|
+
id: "my-workflow",
|
|
16
|
+
description: "Short purpose.",
|
|
17
|
+
// ...
|
|
18
|
+
})
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## License
|
|
22
|
+
|
|
23
|
+
MIT — see [LICENSE](./LICENSE).
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createDoctype } from '@agentproto/define-doctype';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @agentproto/workflow v0.1.0-alpha
|
|
6
|
+
* AIP-15 WORKFLOW.md `defineWorkflow` reference implementation.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
var workflowFrontmatterSchema = z.object({ "name": z.string().min(1).max(80), "id": z.string().regex(new RegExp("^[a-z][a-z0-9-]*[a-z0-9]$")).min(2).max(64), "description": z.string().min(1).max(2e3), "version": z.string().regex(new RegExp("^\\d+\\.\\d+\\.\\d+(?:[-+][a-zA-Z0-9.-]+)?$")), "entry": z.string().optional(), "inputs": z.any().describe("Defined by AIP-16 \u2014 the IO `inputs` block."), "outputs": z.any().describe("Defined by AIP-16 \u2014 the IO `outputs` block."), "result": z.union([z.record(z.string(), z.any()).describe("Optional value expression mapping step results to the workflow output, using the same reference grammar as a step's `inputs` ($input.*, $steps.<id>.*, literals). Omitted \u21D2 the output is the final step's result. Its shape SHOULD satisfy `outputs`."), z.string().describe("Optional value expression mapping step results to the workflow output, using the same reference grammar as a step's `inputs` ($input.*, $steps.<id>.*, literals). Omitted \u21D2 the output is the final step's result. Its shape SHOULD satisfy `outputs`.")]).describe("Optional value expression mapping step results to the workflow output, using the same reference grammar as a step's `inputs` ($input.*, $steps.<id>.*, literals). Omitted \u21D2 the output is the final step's result. Its shape SHOULD satisfy `outputs`.").optional(), "steps": z.array(z.any()).min(1), "start": z.string().optional(), "suspendable": z.boolean().optional(), "triggers": z.array(z.any()).default([]), "requires": z.object({ "network": z.array(z.string()).optional(), "fs.read": z.array(z.string()).optional(), "fs.write": z.array(z.string()).optional(), "env": z.array(z.string()).optional(), "secrets": z.array(z.string()).optional(), "tools": z.array(z.string()).optional() }).strict().optional(), "approval": z.any().default("per-step"), "risk_level": z.number().int().gte(0).lte(3).optional(), "timeout_ms": z.number().int().gte(1).default(6e5), "max_steps": z.number().int().gte(1).default(100), "retry": z.any().optional(), "cost_class": z.enum(["trivial", "metered", "expensive"]).default("metered"), "tags": z.array(z.string().regex(new RegExp("^[a-z][a-z0-9-]*$"))).default([]), "metadata": z.record(z.string(), z.any()).default({}), "inputsFiles": z.any().describe("Defined by AIP-16 \u2014 the IO `inputsFiles` block.").optional(), "outputsFiles": z.any().describe("Defined by AIP-16 \u2014 the IO `outputsFiles` block.").optional(), "runtime": z.any().describe("Defined by AIP-17 \u2014 the runner block.").optional() }).strict().describe("Validates the YAML frontmatter portion of an AIP-15 WORKFLOW.md manifest.");
|
|
10
|
+
var defineWorkflow = createDoctype({
|
|
11
|
+
aip: 15,
|
|
12
|
+
name: "workflow",
|
|
13
|
+
validate(def) {
|
|
14
|
+
const result = workflowFrontmatterSchema.safeParse(def);
|
|
15
|
+
if (!result.success) {
|
|
16
|
+
throw new Error(
|
|
17
|
+
`defineWorkflow (AIP-15): ${result.error.issues.map((i) => `${i.path.join(".")}: ${i.message}`).join("; ")}`
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
build(def) {
|
|
22
|
+
return { ...def };
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export { defineWorkflow, workflowFrontmatterSchema };
|
|
27
|
+
//# sourceMappingURL=chunk-LS5EPMQB.mjs.map
|
|
28
|
+
//# sourceMappingURL=chunk-LS5EPMQB.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/schema.ts","../src/define-workflow.ts"],"names":[],"mappings":"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","file":"chunk-LS5EPMQB.mjs","sourcesContent":["/**\n * AIP-15 WORKFLOW.md frontmatter zod schema.\n *\n * Generated from `resources/aip-15/draft/WORKFLOW.schema.json` via\n * json-schema-to-zod. Imported by both `define-workflow.ts` (TS path\n * validation) and `manifest/index.ts` (.md path validation) so every\n * field-level constraint runs in both authoring paths from a single\n * source of truth — re-run scaffold-aip to refresh after spec changes.\n *\n * Cross-field rules (if/then/allOf in JSON Schema) don't translate\n * cleanly and live in `define-workflow.ts`'s `validate(def)` instead.\n */\n\nimport { z } from \"zod\"\n\nexport const workflowFrontmatterSchema = z.object({ \"name\": z.string().min(1).max(80), \"id\": z.string().regex(new RegExp(\"^[a-z][a-z0-9-]*[a-z0-9]$\")).min(2).max(64), \"description\": z.string().min(1).max(2000), \"version\": z.string().regex(new RegExp(\"^\\\\d+\\\\.\\\\d+\\\\.\\\\d+(?:[-+][a-zA-Z0-9.-]+)?$\")), \"entry\": z.string().optional(), \"inputs\": z.any().describe(\"Defined by AIP-16 — the IO `inputs` block.\"), \"outputs\": z.any().describe(\"Defined by AIP-16 — the IO `outputs` block.\"), \"result\": z.union([z.record(z.string(), z.any()).describe(\"Optional value expression mapping step results to the workflow output, using the same reference grammar as a step's `inputs` ($input.*, $steps.<id>.*, literals). Omitted ⇒ the output is the final step's result. Its shape SHOULD satisfy `outputs`.\"), z.string().describe(\"Optional value expression mapping step results to the workflow output, using the same reference grammar as a step's `inputs` ($input.*, $steps.<id>.*, literals). Omitted ⇒ the output is the final step's result. Its shape SHOULD satisfy `outputs`.\")]).describe(\"Optional value expression mapping step results to the workflow output, using the same reference grammar as a step's `inputs` ($input.*, $steps.<id>.*, literals). Omitted ⇒ the output is the final step's result. Its shape SHOULD satisfy `outputs`.\").optional(), \"steps\": z.array(z.any()).min(1), \"start\": z.string().optional(), \"suspendable\": z.boolean().optional(), \"triggers\": z.array(z.any()).default([] as never), \"requires\": z.object({ \"network\": z.array(z.string()).optional(), \"fs.read\": z.array(z.string()).optional(), \"fs.write\": z.array(z.string()).optional(), \"env\": z.array(z.string()).optional(), \"secrets\": z.array(z.string()).optional(), \"tools\": z.array(z.string()).optional() }).strict().optional(), \"approval\": z.any().default(\"per-step\"), \"risk_level\": z.number().int().gte(0).lte(3).optional(), \"timeout_ms\": z.number().int().gte(1).default(600000), \"max_steps\": z.number().int().gte(1).default(100), \"retry\": z.any().optional(), \"cost_class\": z.enum([\"trivial\",\"metered\",\"expensive\"]).default(\"metered\"), \"tags\": z.array(z.string().regex(new RegExp(\"^[a-z][a-z0-9-]*$\"))).default([] as never), \"metadata\": z.record(z.string(), z.any()).default({} as never), \"inputsFiles\": z.any().describe(\"Defined by AIP-16 — the IO `inputsFiles` block.\").optional(), \"outputsFiles\": z.any().describe(\"Defined by AIP-16 — the IO `outputsFiles` block.\").optional(), \"runtime\": z.any().describe(\"Defined by AIP-17 — the runner block.\").optional() }).strict().describe(\"Validates the YAML frontmatter portion of an AIP-15 WORKFLOW.md manifest.\")\n\nexport type WorkflowFrontmatter = z.infer<typeof workflowFrontmatterSchema>\n","import { createDoctype } from \"@agentproto/define-doctype\"\nimport { workflowFrontmatterSchema } from \"./schema.js\"\nimport type { WorkflowDefinition, WorkflowHandle } from \"./types.js\"\n\n/**\n * AIP-15 reference implementation of `defineWorkflow`.\n *\n * Built on `createDoctype` so the cross-AIP invariants (id pattern,\n * description length, top-level freeze, \"defineWorkflow (AIP-15): …\"\n * error prefix) run uniformly with every other AIP defineX.\n *\n * Field-level validation runs the schema-derived zod from\n * `./schema.ts` against the input. Same source of truth as the .md\n * path uses (`parseWorkflowManifest`), so a malformed TS-authored\n * definition fails with the same diagnostic as a malformed manifest.\n * Cross-field rules go in `validate(def)` after the zod check.\n */\nexport const defineWorkflow = createDoctype<WorkflowDefinition, WorkflowHandle>({\n aip: 15,\n name: \"workflow\",\n validate(def) {\n const result = workflowFrontmatterSchema.safeParse(def)\n if (!result.success) {\n throw new Error(\n `defineWorkflow (AIP-15): ${result.error.issues\n .map((i) => `${i.path.join(\".\")}: ${i.message}`)\n .join(\"; \")}`,\n )\n }\n // TODO: spec-15-specific cross-field rules (if/then/allOf in\n // the JSON Schema) — those don't translate to zod cleanly and\n // belong here. See @agentproto/operator's autonomy=gated rule.\n },\n build(def) {\n // Default build: spread the validated definition into a fresh object.\n // Hand-tune for nested freezing (Object.freeze on arrays/objects) and\n // for fields that need defaults applied — see @agentproto/operator\n // for a reference shape.\n return { ...def } as WorkflowHandle\n },\n})\n"]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { W as WorkflowDefinition } from './types-DO_05pfH.js';
|
|
2
|
+
export { a as WorkflowHandle } from './types-DO_05pfH.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* AIP-15 reference implementation of `defineWorkflow`.
|
|
6
|
+
*
|
|
7
|
+
* Built on `createDoctype` so the cross-AIP invariants (id pattern,
|
|
8
|
+
* description length, top-level freeze, "defineWorkflow (AIP-15): …"
|
|
9
|
+
* error prefix) run uniformly with every other AIP defineX.
|
|
10
|
+
*
|
|
11
|
+
* Field-level validation runs the schema-derived zod from
|
|
12
|
+
* `./schema.ts` against the input. Same source of truth as the .md
|
|
13
|
+
* path uses (`parseWorkflowManifest`), so a malformed TS-authored
|
|
14
|
+
* definition fails with the same diagnostic as a malformed manifest.
|
|
15
|
+
* Cross-field rules go in `validate(def)` after the zod check.
|
|
16
|
+
*/
|
|
17
|
+
declare const defineWorkflow: (def: WorkflowDefinition) => Readonly<WorkflowDefinition>;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @agentproto/workflow — AIP-15 WORKFLOW.md `defineWorkflow` reference impl.
|
|
21
|
+
*
|
|
22
|
+
* A markdown + frontmatter format for declaring a multi-step agent workflow's abstract orchestration shape — its steps, branching, parallelism, approval gates, suspend/resume, and compensation. Pairs with the standard `defineWorkflow` / `defineStep` signatures. Implementation lives entirely in the per-step TOOL.md contracts and their AIP-30 DRIVER bindings; workflows themselves are pure orchestration data.
|
|
23
|
+
*
|
|
24
|
+
* Spec: https://agentproto.sh/docs/aip-15
|
|
25
|
+
*
|
|
26
|
+
* Authoring paths:
|
|
27
|
+
* - TS: `defineWorkflow({...})` → `WorkflowHandle`
|
|
28
|
+
* - MD: `parseWorkflowManifest(src) → workflowFromManifest({...})` → `WorkflowHandle`
|
|
29
|
+
*/
|
|
30
|
+
declare const SPEC_NAME: "agentworkflow/v1";
|
|
31
|
+
declare const SPEC_VERSION: "1.0.0-alpha";
|
|
32
|
+
|
|
33
|
+
export { SPEC_NAME, SPEC_VERSION, WorkflowDefinition, defineWorkflow };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { defineWorkflow } from './chunk-LS5EPMQB.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @agentproto/workflow v0.1.0-alpha
|
|
5
|
+
* AIP-15 WORKFLOW.md `defineWorkflow` reference implementation.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// src/index.ts
|
|
9
|
+
var SPEC_NAME = "agentworkflow/v1";
|
|
10
|
+
var SPEC_VERSION = "1.0.0-alpha";
|
|
11
|
+
|
|
12
|
+
export { SPEC_NAME, SPEC_VERSION };
|
|
13
|
+
//# sourceMappingURL=index.mjs.map
|
|
14
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;AAYO,IAAM,SAAA,GAAY;AAClB,IAAM,YAAA,GAAe","file":"index.mjs","sourcesContent":["/**\n * @agentproto/workflow — AIP-15 WORKFLOW.md `defineWorkflow` reference impl.\n *\n * A markdown + frontmatter format for declaring a multi-step agent workflow's abstract orchestration shape — its steps, branching, parallelism, approval gates, suspend/resume, and compensation. Pairs with the standard `defineWorkflow` / `defineStep` signatures. Implementation lives entirely in the per-step TOOL.md contracts and their AIP-30 DRIVER bindings; workflows themselves are pure orchestration data.\n *\n * Spec: https://agentproto.sh/docs/aip-15\n *\n * Authoring paths:\n * - TS: `defineWorkflow({...})` → `WorkflowHandle`\n * - MD: `parseWorkflowManifest(src) → workflowFromManifest({...})` → `WorkflowHandle`\n */\n\nexport const SPEC_NAME = \"agentworkflow/v1\" as const\nexport const SPEC_VERSION = \"1.0.0-alpha\" as const\n\nexport { defineWorkflow } from \"./define-workflow.js\"\nexport type { WorkflowDefinition, WorkflowHandle } from \"./types.js\"\n"]}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { a as WorkflowHandle } from '../types-DO_05pfH.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* AIP-15 WORKFLOW.md frontmatter zod schema.
|
|
6
|
+
*
|
|
7
|
+
* Generated from `resources/aip-15/draft/WORKFLOW.schema.json` via
|
|
8
|
+
* json-schema-to-zod. Imported by both `define-workflow.ts` (TS path
|
|
9
|
+
* validation) and `manifest/index.ts` (.md path validation) so every
|
|
10
|
+
* field-level constraint runs in both authoring paths from a single
|
|
11
|
+
* source of truth — re-run scaffold-aip to refresh after spec changes.
|
|
12
|
+
*
|
|
13
|
+
* Cross-field rules (if/then/allOf in JSON Schema) don't translate
|
|
14
|
+
* cleanly and live in `define-workflow.ts`'s `validate(def)` instead.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
declare const workflowFrontmatterSchema: z.ZodObject<{
|
|
18
|
+
name: z.ZodString;
|
|
19
|
+
id: z.ZodString;
|
|
20
|
+
description: z.ZodString;
|
|
21
|
+
version: z.ZodString;
|
|
22
|
+
entry: z.ZodOptional<z.ZodString>;
|
|
23
|
+
inputs: z.ZodAny;
|
|
24
|
+
outputs: z.ZodAny;
|
|
25
|
+
result: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodString]>>;
|
|
26
|
+
steps: z.ZodArray<z.ZodAny>;
|
|
27
|
+
start: z.ZodOptional<z.ZodString>;
|
|
28
|
+
suspendable: z.ZodOptional<z.ZodBoolean>;
|
|
29
|
+
triggers: z.ZodDefault<z.ZodArray<z.ZodAny>>;
|
|
30
|
+
requires: z.ZodOptional<z.ZodObject<{
|
|
31
|
+
network: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
32
|
+
"fs.read": z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
33
|
+
"fs.write": z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
34
|
+
env: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
35
|
+
secrets: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
36
|
+
tools: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
37
|
+
}, z.core.$strict>>;
|
|
38
|
+
approval: z.ZodDefault<z.ZodAny>;
|
|
39
|
+
risk_level: z.ZodOptional<z.ZodNumber>;
|
|
40
|
+
timeout_ms: z.ZodDefault<z.ZodNumber>;
|
|
41
|
+
max_steps: z.ZodDefault<z.ZodNumber>;
|
|
42
|
+
retry: z.ZodOptional<z.ZodAny>;
|
|
43
|
+
cost_class: z.ZodDefault<z.ZodEnum<{
|
|
44
|
+
trivial: "trivial";
|
|
45
|
+
metered: "metered";
|
|
46
|
+
expensive: "expensive";
|
|
47
|
+
}>>;
|
|
48
|
+
tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
49
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
50
|
+
inputsFiles: z.ZodOptional<z.ZodAny>;
|
|
51
|
+
outputsFiles: z.ZodOptional<z.ZodAny>;
|
|
52
|
+
runtime: z.ZodOptional<z.ZodAny>;
|
|
53
|
+
}, z.core.$strict>;
|
|
54
|
+
type WorkflowFrontmatter = z.infer<typeof workflowFrontmatterSchema>;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* AIP-15 WORKFLOW.md sidecar parser + manifest-to-handle constructor.
|
|
58
|
+
*
|
|
59
|
+
* Mirror of `@agentproto/tool/manifest` and `@agentproto/driver/manifest`:
|
|
60
|
+
* the .md provides metadata; the TS module supplies any spec-specific
|
|
61
|
+
* runtime bits (schemas, execute bodies, …) that can't live in
|
|
62
|
+
* frontmatter. Both inputs end up in `defineWorkflow` so the cross-AIP
|
|
63
|
+
* invariants run uniformly.
|
|
64
|
+
*
|
|
65
|
+
*
|
|
66
|
+
* The frontmatter zod schema below was generated from
|
|
67
|
+
* `resources/aip-15/draft/WORKFLOW.schema.json` via json-schema-to-zod.
|
|
68
|
+
* Re-run scaffold-aip to refresh after spec changes (or hand-tune
|
|
69
|
+
* any constraint the converter doesn't capture cleanly).
|
|
70
|
+
*/
|
|
71
|
+
|
|
72
|
+
interface WorkflowManifest {
|
|
73
|
+
frontmatter: WorkflowFrontmatter;
|
|
74
|
+
body: string;
|
|
75
|
+
}
|
|
76
|
+
declare function parseWorkflowManifest(source: string): WorkflowManifest;
|
|
77
|
+
declare function workflowFromManifest(manifest: WorkflowManifest): WorkflowHandle;
|
|
78
|
+
|
|
79
|
+
export { type WorkflowFrontmatter, type WorkflowManifest, parseWorkflowManifest, workflowFromManifest, workflowFrontmatterSchema };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { workflowFrontmatterSchema, defineWorkflow } from '../chunk-LS5EPMQB.mjs';
|
|
2
|
+
export { workflowFrontmatterSchema } from '../chunk-LS5EPMQB.mjs';
|
|
3
|
+
import matter from 'gray-matter';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @agentproto/workflow v0.1.0-alpha
|
|
7
|
+
* AIP-15 WORKFLOW.md `defineWorkflow` reference implementation.
|
|
8
|
+
*/
|
|
9
|
+
function parseWorkflowManifest(source) {
|
|
10
|
+
const parsed = matter(source);
|
|
11
|
+
if (Object.keys(parsed.data).length === 0) {
|
|
12
|
+
throw new Error("parseWorkflowManifest: missing or empty frontmatter");
|
|
13
|
+
}
|
|
14
|
+
const result = workflowFrontmatterSchema.safeParse(parsed.data);
|
|
15
|
+
if (!result.success) {
|
|
16
|
+
throw new Error(
|
|
17
|
+
`parseWorkflowManifest: invalid frontmatter \u2014 ${result.error.issues.map((i) => `${i.path.join(".")}: ${i.message}`).join("; ")}`
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
return { frontmatter: result.data, body: parsed.content };
|
|
21
|
+
}
|
|
22
|
+
function workflowFromManifest(manifest) {
|
|
23
|
+
return defineWorkflow(manifest.frontmatter);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { parseWorkflowManifest, workflowFromManifest };
|
|
27
|
+
//# sourceMappingURL=index.mjs.map
|
|
28
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/manifest/index.ts"],"names":[],"mappings":";;;;;;;;AA8BO,SAAS,sBAAsB,MAAA,EAAkC;AACtE,EAAA,MAAM,MAAA,GAAS,OAAO,MAAM,CAAA;AAC5B,EAAA,IAAI,OAAO,IAAA,CAAK,MAAA,CAAO,IAAI,CAAA,CAAE,WAAW,CAAA,EAAG;AACzC,IAAA,MAAM,IAAI,MAAM,qDAAqD,CAAA;AAAA,EACvE;AACA,EAAA,MAAM,MAAA,GAAS,yBAAA,CAA0B,SAAA,CAAU,MAAA,CAAO,IAAI,CAAA;AAC9D,EAAA,IAAI,CAAC,OAAO,OAAA,EAAS;AACnB,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,CAAA,kDAAA,EAAgD,OAAO,KAAA,CAAM,MAAA,CAC1D,IAAI,CAAC,CAAA,KAAM,GAAG,CAAA,CAAE,IAAA,CAAK,KAAK,GAAG,CAAC,KAAK,CAAA,CAAE,OAAO,EAAE,CAAA,CAC9C,IAAA,CAAK,IAAI,CAAC,CAAA;AAAA,KACf;AAAA,EACF;AACA,EAAA,OAAO,EAAE,WAAA,EAAa,MAAA,CAAO,IAAA,EAAM,IAAA,EAAM,OAAO,OAAA,EAAQ;AAC1D;AAEO,SAAS,qBAAqB,QAAA,EAA4C;AAK/E,EAAA,OAAO,cAAA,CAAe,SAAS,WAA4C,CAAA;AAC7E","file":"index.mjs","sourcesContent":["/**\n * AIP-15 WORKFLOW.md sidecar parser + manifest-to-handle constructor.\n *\n * Mirror of `@agentproto/tool/manifest` and `@agentproto/driver/manifest`:\n * the .md provides metadata; the TS module supplies any spec-specific\n * runtime bits (schemas, execute bodies, …) that can't live in\n * frontmatter. Both inputs end up in `defineWorkflow` so the cross-AIP\n * invariants run uniformly.\n *\n *\n * The frontmatter zod schema below was generated from\n * `resources/aip-15/draft/WORKFLOW.schema.json` via json-schema-to-zod.\n * Re-run scaffold-aip to refresh after spec changes (or hand-tune\n * any constraint the converter doesn't capture cleanly).\n */\n\nimport matter from \"gray-matter\"\nimport { workflowFrontmatterSchema, type WorkflowFrontmatter } from \"../schema.js\"\nimport { defineWorkflow } from \"../define-workflow.js\"\nimport type { WorkflowDefinition, WorkflowHandle } from \"../types.js\"\n\n// Re-export so consumers can import the schema + inferred type either\n// from \"@@agentproto/workflow/manifest\" or directly from \"@@agentproto/workflow/schema\".\nexport { workflowFrontmatterSchema, type WorkflowFrontmatter }\n\nexport interface WorkflowManifest {\n frontmatter: WorkflowFrontmatter\n body: string\n}\n\nexport function parseWorkflowManifest(source: string): WorkflowManifest {\n const parsed = matter(source)\n if (Object.keys(parsed.data).length === 0) {\n throw new Error(\"parseWorkflowManifest: missing or empty frontmatter\")\n }\n const result = workflowFrontmatterSchema.safeParse(parsed.data)\n if (!result.success) {\n throw new Error(\n `parseWorkflowManifest: invalid frontmatter — ${result.error.issues\n .map((i) => `${i.path.join(\".\")}: ${i.message}`)\n .join(\"; \")}`,\n )\n }\n return { frontmatter: result.data, body: parsed.content }\n}\n\nexport function workflowFromManifest(manifest: WorkflowManifest): WorkflowHandle {\n // The zod-validated frontmatter is structurally compatible with\n // WorkflowDefinition; the cast pins the typing once the manifest\n // schema and the TS interface diverge (e.g. handle has frozen fields\n // a literal config doesn't carry yet).\n return defineWorkflow(manifest.frontmatter as unknown as WorkflowDefinition)\n}\n"]}
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AIP-15 WorkflowDefinition + WorkflowHandle.
|
|
3
|
+
*
|
|
4
|
+
* `WorkflowDefinition` was generated from
|
|
5
|
+
* `resources/aip-15/draft/WORKFLOW.schema.json` via json-schema-to-typescript.
|
|
6
|
+
* `WorkflowHandle` is the readonly view of the same shape; tighten it
|
|
7
|
+
* by hand for fields that get defaults applied in build().
|
|
8
|
+
*/
|
|
9
|
+
type Step = StepCommon & (StepTool | StepBranch | StepParallel | StepSuspend | StepApproval | StepMap | StepLoop | StepSubworkflow);
|
|
10
|
+
type Approval = ("auto" | "always" | "on-mutate" | "per-step") | string;
|
|
11
|
+
type Trigger = {
|
|
12
|
+
kind: "schedule";
|
|
13
|
+
cron: string;
|
|
14
|
+
timezone?: string;
|
|
15
|
+
} | {
|
|
16
|
+
kind: "webhook";
|
|
17
|
+
path: string;
|
|
18
|
+
} | {
|
|
19
|
+
kind: "event";
|
|
20
|
+
name: string;
|
|
21
|
+
} | {
|
|
22
|
+
kind: "manual";
|
|
23
|
+
label?: string;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Validates the YAML frontmatter portion of an AIP-15 WORKFLOW.md manifest.
|
|
27
|
+
*/
|
|
28
|
+
interface WorkflowDefinition {
|
|
29
|
+
name: string;
|
|
30
|
+
id: string;
|
|
31
|
+
description: string;
|
|
32
|
+
version: string;
|
|
33
|
+
entry?: string;
|
|
34
|
+
inputs: Inputs;
|
|
35
|
+
outputs: Outputs;
|
|
36
|
+
/**
|
|
37
|
+
* Optional value expression mapping step results to the workflow output,
|
|
38
|
+
* using the same reference grammar as a step's `inputs` ($input.*,
|
|
39
|
+
* $steps.<id>.*, literals). Omitted ⇒ the output is the final step's result.
|
|
40
|
+
* Its shape SHOULD satisfy `outputs`.
|
|
41
|
+
*/
|
|
42
|
+
result?: Record<string, unknown> | string;
|
|
43
|
+
/**
|
|
44
|
+
* @minItems 1
|
|
45
|
+
*/
|
|
46
|
+
steps: [Step, ...Step[]];
|
|
47
|
+
start?: string;
|
|
48
|
+
suspendable?: boolean;
|
|
49
|
+
triggers?: Trigger[];
|
|
50
|
+
requires?: {
|
|
51
|
+
network?: string[];
|
|
52
|
+
"fs.read"?: string[];
|
|
53
|
+
"fs.write"?: string[];
|
|
54
|
+
env?: string[];
|
|
55
|
+
secrets?: string[];
|
|
56
|
+
tools?: string[];
|
|
57
|
+
};
|
|
58
|
+
approval?: ("auto" | "always" | "on-mutate" | "per-step") | string;
|
|
59
|
+
risk_level?: number;
|
|
60
|
+
timeout_ms?: number;
|
|
61
|
+
max_steps?: number;
|
|
62
|
+
retry?: Retry;
|
|
63
|
+
cost_class?: "trivial" | "metered" | "expensive";
|
|
64
|
+
tags?: string[];
|
|
65
|
+
metadata?: {
|
|
66
|
+
[k: string]: unknown;
|
|
67
|
+
};
|
|
68
|
+
inputsFiles?: InputsFiles;
|
|
69
|
+
outputsFiles?: OutputsFiles;
|
|
70
|
+
runtime?: Runner;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Defined by AIP-16 — the IO `inputs` block.
|
|
74
|
+
*/
|
|
75
|
+
interface Inputs {
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Defined by AIP-16 — the IO `outputs` block.
|
|
79
|
+
*/
|
|
80
|
+
interface Outputs {
|
|
81
|
+
}
|
|
82
|
+
interface StepCommon {
|
|
83
|
+
id: string;
|
|
84
|
+
name?: string;
|
|
85
|
+
description?: string;
|
|
86
|
+
kind: "tool" | "branch" | "parallel" | "suspend" | "approval" | "map" | "loop" | "subworkflow";
|
|
87
|
+
inputs?: {};
|
|
88
|
+
outputs?: JsonSchema;
|
|
89
|
+
next?: string;
|
|
90
|
+
approval?: Approval;
|
|
91
|
+
risk_level?: number;
|
|
92
|
+
timeout_ms?: number;
|
|
93
|
+
retry?: Retry;
|
|
94
|
+
compensation?: string;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Any JSON Schema draft 2020-12 document. Validation deferred to a meta-validator.
|
|
98
|
+
*/
|
|
99
|
+
interface JsonSchema {
|
|
100
|
+
}
|
|
101
|
+
interface Retry {
|
|
102
|
+
max_attempts: number;
|
|
103
|
+
backoff: "fixed" | "exponential";
|
|
104
|
+
initial_ms?: number;
|
|
105
|
+
}
|
|
106
|
+
interface StepTool {
|
|
107
|
+
kind: "tool";
|
|
108
|
+
tool: string | {
|
|
109
|
+
entry: string;
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
interface StepBranch {
|
|
113
|
+
kind: "branch";
|
|
114
|
+
/**
|
|
115
|
+
* @minItems 1
|
|
116
|
+
*/
|
|
117
|
+
branches: [
|
|
118
|
+
{
|
|
119
|
+
when: string;
|
|
120
|
+
next: string;
|
|
121
|
+
},
|
|
122
|
+
...{
|
|
123
|
+
when: string;
|
|
124
|
+
next: string;
|
|
125
|
+
}[]
|
|
126
|
+
];
|
|
127
|
+
default?: string;
|
|
128
|
+
}
|
|
129
|
+
interface StepParallel {
|
|
130
|
+
kind: "parallel";
|
|
131
|
+
/**
|
|
132
|
+
* @minItems 2
|
|
133
|
+
*/
|
|
134
|
+
branches: [
|
|
135
|
+
{
|
|
136
|
+
id: string;
|
|
137
|
+
steps: Step[];
|
|
138
|
+
next?: string;
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
id: string;
|
|
142
|
+
steps: Step[];
|
|
143
|
+
next?: string;
|
|
144
|
+
},
|
|
145
|
+
...{
|
|
146
|
+
id: string;
|
|
147
|
+
steps: Step[];
|
|
148
|
+
next?: string;
|
|
149
|
+
}[]
|
|
150
|
+
];
|
|
151
|
+
}
|
|
152
|
+
interface StepSuspend {
|
|
153
|
+
kind: "suspend";
|
|
154
|
+
resume: {
|
|
155
|
+
/**
|
|
156
|
+
* @minItems 1
|
|
157
|
+
*/
|
|
158
|
+
on: [string, ...string[]];
|
|
159
|
+
timeout_ms?: number;
|
|
160
|
+
on_timeout?: string;
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
interface StepApproval {
|
|
164
|
+
kind: "approval";
|
|
165
|
+
prompt: string;
|
|
166
|
+
artifacts?: string[];
|
|
167
|
+
/**
|
|
168
|
+
* @minItems 1
|
|
169
|
+
*/
|
|
170
|
+
approvers: [
|
|
171
|
+
({
|
|
172
|
+
role: string;
|
|
173
|
+
} | {
|
|
174
|
+
userId: string;
|
|
175
|
+
}),
|
|
176
|
+
...({
|
|
177
|
+
role: string;
|
|
178
|
+
} | {
|
|
179
|
+
userId: string;
|
|
180
|
+
})[]
|
|
181
|
+
];
|
|
182
|
+
timeout_ms?: number;
|
|
183
|
+
on_approve?: {
|
|
184
|
+
next?: string;
|
|
185
|
+
};
|
|
186
|
+
on_reject?: {
|
|
187
|
+
next?: string;
|
|
188
|
+
};
|
|
189
|
+
on_timeout?: string;
|
|
190
|
+
}
|
|
191
|
+
interface StepMap {
|
|
192
|
+
kind: "map";
|
|
193
|
+
over: string;
|
|
194
|
+
parallelism?: number;
|
|
195
|
+
steps: Step[];
|
|
196
|
+
}
|
|
197
|
+
interface StepLoop {
|
|
198
|
+
kind: "loop";
|
|
199
|
+
while: string;
|
|
200
|
+
max_iterations: number;
|
|
201
|
+
steps: Step[];
|
|
202
|
+
}
|
|
203
|
+
interface StepSubworkflow {
|
|
204
|
+
kind: "subworkflow";
|
|
205
|
+
workflow: string;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Defined by AIP-16 — the IO `inputsFiles` block.
|
|
209
|
+
*/
|
|
210
|
+
interface InputsFiles {
|
|
211
|
+
[k: string]: FileContractEntry;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* A single declared file in inputsFiles/outputsFiles.
|
|
215
|
+
*/
|
|
216
|
+
interface FileContractEntry {
|
|
217
|
+
/**
|
|
218
|
+
* Workspace-relative path. outputsFiles entries MAY use the tokens <runId>, <workflowId>, <toolId>, <isoDate> for per-run path interpolation.
|
|
219
|
+
*/
|
|
220
|
+
path: string;
|
|
221
|
+
/**
|
|
222
|
+
* Convention only — not enforced by the contract. `ro` for inputs is the typical default; `rw` for outputs.
|
|
223
|
+
*/
|
|
224
|
+
mode?: "ro" | "rw";
|
|
225
|
+
/**
|
|
226
|
+
* Informational MIME type. Hosts MAY surface in audit logs / UIs.
|
|
227
|
+
*/
|
|
228
|
+
contentType?: string;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Defined by AIP-16 — the IO `outputsFiles` block.
|
|
232
|
+
*/
|
|
233
|
+
interface OutputsFiles {
|
|
234
|
+
[k: string]: FileContractEntry;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Defined by AIP-17 — the runner block.
|
|
238
|
+
*/
|
|
239
|
+
interface Runner {
|
|
240
|
+
/**
|
|
241
|
+
* Where the process runs. `subprocess` (default): host-local Node `--permission` child. `sandbox`: real container via the host's SandboxProviderAdapter. `in-process`: dynamic import inside the host process; reserved for trusted/vendor code, silently downgraded to `subprocess` for untrusted origins.
|
|
242
|
+
*/
|
|
243
|
+
engine?: "subprocess" | "sandbox" | "in-process";
|
|
244
|
+
/**
|
|
245
|
+
* Sandbox template id from the host registry. Only meaningful for `engine: sandbox`. When omitted, the host auto-picks via `needs`.
|
|
246
|
+
*/
|
|
247
|
+
image?: string;
|
|
248
|
+
/**
|
|
249
|
+
* Declarative dependency requirements. Hosts use these to auto-pick an image, install missing deps at cold-start, and surface them in trust UIs.
|
|
250
|
+
*/
|
|
251
|
+
needs?: {
|
|
252
|
+
/**
|
|
253
|
+
* Primary language runtime.
|
|
254
|
+
*/
|
|
255
|
+
language?: "node" | "python" | "multi";
|
|
256
|
+
/**
|
|
257
|
+
* OS-level package names. Default convention: Debian/Ubuntu apt names.
|
|
258
|
+
*/
|
|
259
|
+
native?: string[];
|
|
260
|
+
/**
|
|
261
|
+
* Additional npm packages installed via `npm install` after lockfile-driven `npm ci`.
|
|
262
|
+
*/
|
|
263
|
+
npm?: string[];
|
|
264
|
+
/**
|
|
265
|
+
* Additional pip packages installed via `pip install --user`.
|
|
266
|
+
*/
|
|
267
|
+
pip?: string[];
|
|
268
|
+
};
|
|
269
|
+
/**
|
|
270
|
+
* Resource caps. Advisory but enforceable when the isolation primitive supports it.
|
|
271
|
+
*/
|
|
272
|
+
limits?: {
|
|
273
|
+
/**
|
|
274
|
+
* Hard memory cap in MiB.
|
|
275
|
+
*/
|
|
276
|
+
memory_mb?: number;
|
|
277
|
+
/**
|
|
278
|
+
* Hard wall-clock cap in ms.
|
|
279
|
+
*/
|
|
280
|
+
timeout_ms?: number;
|
|
281
|
+
/**
|
|
282
|
+
* CPU-time cap in ms. Hosts that can't enforce it ignore this field.
|
|
283
|
+
*/
|
|
284
|
+
cpu_ms?: number;
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
type WorkflowHandle = Readonly<WorkflowDefinition>;
|
|
288
|
+
|
|
289
|
+
export type { WorkflowDefinition as W, WorkflowHandle as a };
|
package/package.json
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agentproto/workflow",
|
|
3
|
+
"version": "0.1.0-alpha.1",
|
|
4
|
+
"description": "@agentproto/workflow — AIP-15 WORKFLOW.md reference implementation. A markdown + frontmatter format for declaring a multi-step agent workflow's abstract orchestration shape — its steps, branching, parallelism, approval gates, suspend/resume, and compensation. Pairs with the standard `defineWorkflow` / `defineStep` signatures. Implementation lives entirely in the per-step TOOL.md contracts and their AIP-30 DRIVER bindings; workflows themselves are pure orchestration data.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"agentproto",
|
|
7
|
+
"aip-15",
|
|
8
|
+
"workflow",
|
|
9
|
+
"defineWorkflow",
|
|
10
|
+
"open-standard",
|
|
11
|
+
"agentic"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://agentproto.sh/docs/aip-15",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/agentproto/ts",
|
|
17
|
+
"directory": "packages/workflow"
|
|
18
|
+
},
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/agentproto/ts/issues"
|
|
21
|
+
},
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"type": "module",
|
|
24
|
+
"main": "dist/index.mjs",
|
|
25
|
+
"module": "dist/index.mjs",
|
|
26
|
+
"types": "dist/index.d.ts",
|
|
27
|
+
"exports": {
|
|
28
|
+
".": {
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"import": "./dist/index.mjs",
|
|
31
|
+
"default": "./dist/index.mjs"
|
|
32
|
+
},
|
|
33
|
+
"./manifest": {
|
|
34
|
+
"types": "./dist/manifest/index.d.ts",
|
|
35
|
+
"import": "./dist/manifest/index.mjs",
|
|
36
|
+
"default": "./dist/manifest/index.mjs"
|
|
37
|
+
},
|
|
38
|
+
"./package.json": "./package.json"
|
|
39
|
+
},
|
|
40
|
+
"files": [
|
|
41
|
+
"dist",
|
|
42
|
+
"README.md",
|
|
43
|
+
"LICENSE"
|
|
44
|
+
],
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public"
|
|
47
|
+
},
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"gray-matter": "^4.0.3",
|
|
50
|
+
"zod": "^4.4.3",
|
|
51
|
+
"@agentproto/define-doctype": "0.1.0"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@types/node": "^25.6.2",
|
|
55
|
+
"tsup": "^8.5.1",
|
|
56
|
+
"typescript": "^5.9.3",
|
|
57
|
+
"vitest": "^3.2.4",
|
|
58
|
+
"@agentproto/tooling": "0.1.0-alpha.0"
|
|
59
|
+
},
|
|
60
|
+
"scripts": {
|
|
61
|
+
"dev": "tsup --watch",
|
|
62
|
+
"build": "tsup",
|
|
63
|
+
"clean": "rm -rf dist",
|
|
64
|
+
"check-types": "tsc --noEmit",
|
|
65
|
+
"test": "vitest run --passWithNoTests",
|
|
66
|
+
"test:watch": "vitest"
|
|
67
|
+
}
|
|
68
|
+
}
|