@osolmaz/pi-workflows 0.9.1 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +64 -19
- package/dist/builtins/autodoc.workflow.d.ts +58 -0
- package/dist/builtins/autodoc.workflow.js +266 -0
- package/dist/builtins/autodoc.workflow.js.map +1 -0
- package/dist/builtins/autoimplement.workflow.d.ts +353 -0
- package/dist/builtins/autoimplement.workflow.js +961 -0
- package/dist/builtins/autoimplement.workflow.js.map +1 -0
- package/dist/builtins/autoplan.workflow.d.ts +58 -0
- package/dist/builtins/autoplan.workflow.js +190 -0
- package/dist/builtins/autoplan.workflow.js.map +1 -0
- package/dist/builtins/catalog.js +9 -1
- package/dist/builtins/catalog.js.map +1 -1
- package/dist/builtins/index.d.ts +6 -0
- package/dist/builtins/index.js +7 -0
- package/dist/builtins/index.js.map +1 -0
- package/dist/builtins/monitor.workflow.d.ts +29 -3
- package/dist/builtins/monitor.workflow.js +325 -13
- package/dist/builtins/monitor.workflow.js.map +1 -1
- package/dist/builtins/plan-approval.workflow.d.ts +83 -0
- package/dist/builtins/plan-approval.workflow.js +148 -0
- package/dist/builtins/plan-approval.workflow.js.map +1 -0
- package/dist/builtins/plan-presentation.d.ts +7 -0
- package/dist/builtins/plan-presentation.js +44 -0
- package/dist/builtins/plan-presentation.js.map +1 -0
- package/dist/extension/decision-channels.d.ts +132 -0
- package/dist/extension/decision-channels.js +1082 -0
- package/dist/extension/decision-channels.js.map +1 -0
- package/dist/extension/index.d.ts +1 -0
- package/dist/extension/index.js +426 -11
- package/dist/extension/index.js.map +1 -1
- package/dist/extension/widget.js +26 -2
- package/dist/extension/widget.js.map +1 -1
- package/dist/extension/workflow-tool.d.ts +1 -37
- package/dist/extension/workflow-tool.js +1 -42
- package/dist/extension/workflow-tool.js.map +1 -1
- package/dist/host/rpc-bridge.js +4 -21
- package/dist/host/rpc-bridge.js.map +1 -1
- package/dist/render/graph-render.js +46 -10
- package/dist/render/graph-render.js.map +1 -1
- package/dist/viewer/render.js +36 -2
- package/dist/viewer/render.js.map +1 -1
- package/dist/workflows/catalog.d.ts +1 -0
- package/dist/workflows/catalog.js +6 -0
- package/dist/workflows/catalog.js.map +1 -1
- package/dist/workflows/composition.d.ts +45 -0
- package/dist/workflows/composition.js +485 -0
- package/dist/workflows/composition.js.map +1 -0
- package/dist/workflows/decision-presentation.d.ts +18 -0
- package/dist/workflows/decision-presentation.js +417 -0
- package/dist/workflows/decision-presentation.js.map +1 -0
- package/dist/workflows/decision.d.ts +11 -5
- package/dist/workflows/decision.js.map +1 -1
- package/dist/workflows/definition.d.ts +22 -3
- package/dist/workflows/definition.js +46 -3
- package/dist/workflows/definition.js.map +1 -1
- package/dist/workflows/engine.d.ts +2 -1
- package/dist/workflows/engine.js +199 -18
- package/dist/workflows/engine.js.map +1 -1
- package/dist/workflows/graph.js +8 -6
- package/dist/workflows/graph.js.map +1 -1
- package/dist/workflows/human-decision.d.ts +87 -0
- package/dist/workflows/human-decision.js +583 -0
- package/dist/workflows/human-decision.js.map +1 -0
- package/dist/workflows/index.d.ts +5 -2
- package/dist/workflows/index.js +4 -1
- package/dist/workflows/index.js.map +1 -1
- package/dist/workflows/loader.d.ts +5 -4
- package/dist/workflows/loader.js +118 -18
- package/dist/workflows/loader.js.map +1 -1
- package/dist/workflows/schema.d.ts +3 -1
- package/dist/workflows/schema.js +64 -2
- package/dist/workflows/schema.js.map +1 -1
- package/dist/workflows/store.js +39 -2
- package/dist/workflows/store.js.map +1 -1
- package/dist/workflows/tool-input.d.ts +72 -0
- package/dist/workflows/tool-input.js +141 -0
- package/dist/workflows/tool-input.js.map +1 -0
- package/dist/workflows/types.d.ts +300 -2
- package/docs/CONTROLLERS.md +1 -1
- package/docs/DESIGN_PHILOSOPHY.md +1 -1
- package/docs/HUMAN_DECISIONS.md +371 -0
- package/docs/HUMAN_DECISION_PRESENTATIONS.md +323 -0
- package/docs/MONITOR.md +46 -18
- package/docs/WORKFLOW_COMPOSITION.md +333 -0
- package/docs/plans/2026-08-19-human-decision-gates-plan.md +296 -0
- package/docs/plans/2026-08-19-human-decision-presentations-plan.md +172 -0
- package/docs/plans/2026-08-19-provider-compatible-workflow-tool-schema-plan.md +45 -0
- package/docs/plans/2026-08-19-workflow-composition-plan.md +308 -0
- package/docs/run-bundles.md +45 -10
- package/docs/workflows.md +106 -15
- package/examples/workflows/approved-plan.workflow.ts +58 -0
- package/examples/workflows/autoimplement.workflow.ts +1 -92
- package/examples/workflows/autoplan.workflow.ts +1 -0
- package/examples/workflows/human-decision.workflow.ts +62 -0
- package/herdr-plugin.toml +1 -1
- package/package.json +6 -1
- package/schemas/decision-presentation-v1.schema.json +83 -0
- package/schemas/human-decision-accepted-v1.schema.json +44 -0
- package/schemas/human-decision-accepted-v2.schema.json +50 -0
- package/schemas/human-decision-answer-attempt-v1.schema.json +37 -0
- package/schemas/human-decision-cancellation-v1.schema.json +15 -0
- package/schemas/human-decision-continuation-v1.schema.json +16 -0
- package/schemas/human-decision-delivery-v1.schema.json +28 -0
- package/schemas/human-decision-delivery-v2.schema.json +36 -0
- package/schemas/human-decision-receipt-v1.schema.json +33 -0
- package/schemas/human-decision-receipt-v2.schema.json +39 -0
- package/schemas/human-decision-request-v1.schema.json +59 -0
- package/schemas/human-decision-request-v2.schema.json +69 -0
- package/schemas/human-decision-resolution-v1.schema.json +27 -0
- package/schemas/human-decision-resolution-v2.schema.json +27 -0
- package/schemas/human-decision-settlement-v1.schema.json +28 -0
- package/skills/autodoc/SKILL.md +43 -0
- package/skills/autoimplement/SKILL.md +58 -0
- package/skills/autoimplement/agents/openai.yaml +4 -0
- package/skills/autoplan/SKILL.md +25 -0
- package/skills/monitor/SKILL.md +8 -1
- package/skills/pi-workflows/SKILL.md +5 -3
- package/src/builtins/autodoc.workflow.ts +325 -0
- package/src/builtins/autoimplement.workflow.ts +1123 -0
- package/src/builtins/autoplan.workflow.ts +231 -0
- package/src/builtins/catalog.ts +9 -1
- package/src/builtins/index.ts +32 -0
- package/src/builtins/monitor.workflow.ts +396 -15
- package/src/builtins/plan-approval.workflow.ts +190 -0
- package/src/builtins/plan-presentation.ts +57 -0
- package/src/extension/decision-channels.ts +1533 -0
- package/src/extension/index.ts +499 -9
- package/src/extension/widget.ts +39 -2
- package/src/extension/workflow-tool.ts +5 -81
- package/src/host/rpc-bridge.ts +7 -30
- package/src/render/graph-render.ts +54 -5
- package/src/viewer/render.ts +56 -3
- package/src/workflows/catalog.ts +7 -0
- package/src/workflows/composition.ts +642 -0
- package/src/workflows/decision-presentation.ts +501 -0
- package/src/workflows/decision.ts +12 -5
- package/src/workflows/definition.ts +118 -8
- package/src/workflows/engine.ts +257 -20
- package/src/workflows/graph.ts +8 -6
- package/src/workflows/human-decision.ts +819 -0
- package/src/workflows/index.ts +89 -0
- package/src/workflows/loader.ts +186 -18
- package/src/workflows/schema.ts +79 -2
- package/src/workflows/store.ts +45 -2
- package/src/workflows/tool-input.ts +202 -0
- package/src/workflows/types.ts +374 -2
- package/examples/workflows/elegant-solution.workflow.ts +0 -95
|
@@ -1,92 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
type AutoimplementInput = {
|
|
4
|
-
task?: string;
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
const reviewChoices = ["clean", "issues_found"] as const;
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Implement, verify, then loop a self-review until it comes back clean. The
|
|
11
|
-
* decision edge routes `issues_found` back to the fix step, and the engine's
|
|
12
|
-
* maxSteps guard bounds the loop.
|
|
13
|
-
*/
|
|
14
|
-
export default defineWorkflow({
|
|
15
|
-
name: "autoimplement",
|
|
16
|
-
title: ({ input }) => {
|
|
17
|
-
const task = (input as AutoimplementInput).task;
|
|
18
|
-
return task ? `autoimplement: ${task.slice(0, 60)}` : undefined;
|
|
19
|
-
},
|
|
20
|
-
presentationPrompt:
|
|
21
|
-
"Summarize what was implemented, what verification passed, and any remaining limitation. Be concise and direct.",
|
|
22
|
-
maxSteps: 20,
|
|
23
|
-
startAt: "implement",
|
|
24
|
-
nodes: {
|
|
25
|
-
implement: agent({
|
|
26
|
-
timeoutMs: 60 * 60_000,
|
|
27
|
-
statusDetail: "implementing",
|
|
28
|
-
prompt: ({ input }) => {
|
|
29
|
-
const task =
|
|
30
|
-
(input as AutoimplementInput).task ?? "the plan discussed so far in this conversation";
|
|
31
|
-
return [
|
|
32
|
-
`Implement ${task} end-to-end.`,
|
|
33
|
-
"Aim for the most elegant, long-term production-ready solution without gold-plating.",
|
|
34
|
-
].join("\n");
|
|
35
|
-
},
|
|
36
|
-
expectedOutput: `{ "summary": "what was implemented", "files": ["changed file", "changed file"] }`,
|
|
37
|
-
}),
|
|
38
|
-
verify: agent({
|
|
39
|
-
timeoutMs: 30 * 60_000,
|
|
40
|
-
statusDetail: "verifying",
|
|
41
|
-
prompt: () =>
|
|
42
|
-
[
|
|
43
|
-
"Verify the implementation.",
|
|
44
|
-
"Run the test suite plus any relevant builds, linters, or local smoke tests.",
|
|
45
|
-
"Do not run destructive commands.",
|
|
46
|
-
].join("\n"),
|
|
47
|
-
expectedOutput: `{ "passed": true | false, "details": "what was run and what happened" }`,
|
|
48
|
-
}),
|
|
49
|
-
review: decision({
|
|
50
|
-
choices: reviewChoices,
|
|
51
|
-
question: ({ outputs }) =>
|
|
52
|
-
[
|
|
53
|
-
"Critically review your implementation as a strict reviewer.",
|
|
54
|
-
"Look for correctness bugs, missed requirements, and failing checks.",
|
|
55
|
-
"Pick `issues_found` if anything must be fixed, otherwise `clean`.",
|
|
56
|
-
"",
|
|
57
|
-
`Verification: ${JSON.stringify(outputs.verify)}`,
|
|
58
|
-
].join("\n"),
|
|
59
|
-
}),
|
|
60
|
-
fix: agent({
|
|
61
|
-
timeoutMs: 30 * 60_000,
|
|
62
|
-
statusDetail: "fixing",
|
|
63
|
-
prompt: ({ outputs }) =>
|
|
64
|
-
[
|
|
65
|
-
"Fix the issues you found in review, then stop.",
|
|
66
|
-
"",
|
|
67
|
-
`Review: ${JSON.stringify(outputs.review)}`,
|
|
68
|
-
].join("\n"),
|
|
69
|
-
expectedOutput: `{ "fixed": "what was changed" }`,
|
|
70
|
-
}),
|
|
71
|
-
finalize: compute({
|
|
72
|
-
run: ({ outputs }) => ({
|
|
73
|
-
implementation: outputs.implement,
|
|
74
|
-
verification: outputs.verify,
|
|
75
|
-
review: outputs.review,
|
|
76
|
-
}),
|
|
77
|
-
}),
|
|
78
|
-
},
|
|
79
|
-
edges: [
|
|
80
|
-
{ from: "implement", to: "verify" },
|
|
81
|
-
{ from: "verify", to: "review" },
|
|
82
|
-
decisionEdge({
|
|
83
|
-
from: "review",
|
|
84
|
-
choices: reviewChoices,
|
|
85
|
-
cases: {
|
|
86
|
-
clean: "finalize",
|
|
87
|
-
issues_found: "fix",
|
|
88
|
-
},
|
|
89
|
-
}),
|
|
90
|
-
{ from: "fix", to: "verify" },
|
|
91
|
-
],
|
|
92
|
-
});
|
|
1
|
+
export { autoimplementWorkflow as default } from "@osolmaz/pi-workflows/builtins";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { autoplanWorkflow as default } from "@osolmaz/pi-workflows/builtins";
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import {
|
|
2
|
+
choice,
|
|
3
|
+
compute,
|
|
4
|
+
defineHumanChoices,
|
|
5
|
+
defineWorkflow,
|
|
6
|
+
humanDecision,
|
|
7
|
+
humanDecisionEdge,
|
|
8
|
+
textInput,
|
|
9
|
+
} from "@osolmaz/pi-workflows";
|
|
10
|
+
|
|
11
|
+
const choices = defineHumanChoices({
|
|
12
|
+
continue: choice({ label: "Yes, continue" }),
|
|
13
|
+
stop: choice({ label: "No, stop" }),
|
|
14
|
+
replan: choice({
|
|
15
|
+
label: "Replan",
|
|
16
|
+
input: textInput({ name: "instructions", prompt: "What should change?" }),
|
|
17
|
+
}),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export default defineWorkflow({
|
|
21
|
+
name: "human-decision-example",
|
|
22
|
+
startAt: "proposal",
|
|
23
|
+
nodes: {
|
|
24
|
+
proposal: compute({
|
|
25
|
+
run: ({ input }) => ({
|
|
26
|
+
summary: "Apply the proposed workflow change.",
|
|
27
|
+
changes: ["Keep the durable subject.", "Show readable decision text."],
|
|
28
|
+
source: input,
|
|
29
|
+
}),
|
|
30
|
+
}),
|
|
31
|
+
approve: humanDecision({
|
|
32
|
+
audience: "operator",
|
|
33
|
+
choices,
|
|
34
|
+
request: ({ outputs }) => {
|
|
35
|
+
const proposal = outputs.proposal as { summary: string; changes: string[] };
|
|
36
|
+
return {
|
|
37
|
+
title: "Approve the proposal",
|
|
38
|
+
subject: proposal,
|
|
39
|
+
presentation: {
|
|
40
|
+
schema: "pi-workflows.decision-presentation.v1",
|
|
41
|
+
summary: proposal.summary,
|
|
42
|
+
blocks: [
|
|
43
|
+
{ kind: "section", title: "Changes" },
|
|
44
|
+
{ kind: "bullets", items: proposal.changes },
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
},
|
|
49
|
+
}),
|
|
50
|
+
continued: compute({ run: ({ outputs }) => ({ status: "continue", answer: outputs.approve }) }),
|
|
51
|
+
stopped: compute({ run: ({ outputs }) => ({ status: "stop", answer: outputs.approve }) }),
|
|
52
|
+
replan: compute({ run: ({ outputs }) => ({ status: "replan", answer: outputs.approve }) }),
|
|
53
|
+
},
|
|
54
|
+
edges: [
|
|
55
|
+
{ from: "proposal", to: "approve" },
|
|
56
|
+
humanDecisionEdge({
|
|
57
|
+
from: "approve",
|
|
58
|
+
choices,
|
|
59
|
+
cases: { continue: "continued", stop: "stopped", replan: "replan" },
|
|
60
|
+
}),
|
|
61
|
+
],
|
|
62
|
+
});
|
package/herdr-plugin.toml
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@osolmaz/pi-workflows",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "Workflow and controller runtime with a live terminal viewer for the pi coding agent",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package"
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"skills",
|
|
24
24
|
"examples",
|
|
25
25
|
"docs",
|
|
26
|
+
"schemas",
|
|
26
27
|
"plugins/herdr",
|
|
27
28
|
"herdr-plugin.toml",
|
|
28
29
|
"README.md",
|
|
@@ -41,6 +42,10 @@
|
|
|
41
42
|
"./controllers": {
|
|
42
43
|
"types": "./dist/controllers/index.d.ts",
|
|
43
44
|
"default": "./dist/controllers/index.js"
|
|
45
|
+
},
|
|
46
|
+
"./builtins": {
|
|
47
|
+
"types": "./dist/builtins/index.d.ts",
|
|
48
|
+
"default": "./dist/builtins/index.js"
|
|
44
49
|
}
|
|
45
50
|
},
|
|
46
51
|
"publishConfig": {
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/osolmaz/pi-workflows/schemas/decision-presentation-v1.schema.json",
|
|
4
|
+
"title": "Pi Workflows decision presentation v1",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["schema", "summary", "blocks"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"schema": { "const": "pi-workflows.decision-presentation.v1" },
|
|
10
|
+
"summary": { "type": "string", "minLength": 1, "maxLength": 16000 },
|
|
11
|
+
"blocks": {
|
|
12
|
+
"type": "array",
|
|
13
|
+
"maxItems": 256,
|
|
14
|
+
"items": {
|
|
15
|
+
"oneOf": [
|
|
16
|
+
{
|
|
17
|
+
"type": "object",
|
|
18
|
+
"additionalProperties": false,
|
|
19
|
+
"required": ["kind", "text"],
|
|
20
|
+
"properties": {
|
|
21
|
+
"kind": { "const": "paragraph" },
|
|
22
|
+
"text": { "type": "string", "minLength": 1, "maxLength": 16000 }
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"type": "object",
|
|
27
|
+
"additionalProperties": false,
|
|
28
|
+
"required": ["kind", "title"],
|
|
29
|
+
"properties": {
|
|
30
|
+
"kind": { "const": "section" },
|
|
31
|
+
"title": { "type": "string", "minLength": 1, "maxLength": 16000 }
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"type": "object",
|
|
36
|
+
"additionalProperties": false,
|
|
37
|
+
"required": ["kind", "items"],
|
|
38
|
+
"properties": {
|
|
39
|
+
"kind": { "const": "bullets" },
|
|
40
|
+
"items": {
|
|
41
|
+
"type": "array",
|
|
42
|
+
"minItems": 1,
|
|
43
|
+
"maxItems": 256,
|
|
44
|
+
"items": { "type": "string", "minLength": 1, "maxLength": 16000 }
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"type": "object",
|
|
50
|
+
"additionalProperties": false,
|
|
51
|
+
"required": ["kind", "items"],
|
|
52
|
+
"properties": {
|
|
53
|
+
"kind": { "const": "fields" },
|
|
54
|
+
"items": {
|
|
55
|
+
"type": "array",
|
|
56
|
+
"minItems": 1,
|
|
57
|
+
"maxItems": 256,
|
|
58
|
+
"items": {
|
|
59
|
+
"type": "object",
|
|
60
|
+
"additionalProperties": false,
|
|
61
|
+
"required": ["label", "value"],
|
|
62
|
+
"properties": {
|
|
63
|
+
"label": { "type": "string", "minLength": 1, "maxLength": 16000 },
|
|
64
|
+
"value": { "type": "string", "minLength": 1, "maxLength": 16000 }
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"type": "object",
|
|
72
|
+
"additionalProperties": false,
|
|
73
|
+
"required": ["kind", "text"],
|
|
74
|
+
"properties": {
|
|
75
|
+
"kind": { "const": "preformatted" },
|
|
76
|
+
"text": { "type": "string", "minLength": 1, "maxLength": 16000 }
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/osolmaz/pi-workflows/schemas/human-decision-accepted-v1.schema.json",
|
|
4
|
+
"title": "Pi Workflows accepted human decision v1",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": [
|
|
8
|
+
"schema",
|
|
9
|
+
"decisionId",
|
|
10
|
+
"requestDigest",
|
|
11
|
+
"response",
|
|
12
|
+
"source",
|
|
13
|
+
"idempotencyKey",
|
|
14
|
+
"acceptedAt",
|
|
15
|
+
"answerDigest"
|
|
16
|
+
],
|
|
17
|
+
"properties": {
|
|
18
|
+
"schema": { "const": "pi-workflows.human-decision-accepted.v1" },
|
|
19
|
+
"decisionId": { "type": "string" },
|
|
20
|
+
"requestDigest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
|
|
21
|
+
"response": {
|
|
22
|
+
"type": "object",
|
|
23
|
+
"additionalProperties": false,
|
|
24
|
+
"required": ["choice"],
|
|
25
|
+
"properties": {
|
|
26
|
+
"choice": { "type": "string" },
|
|
27
|
+
"input": { "type": "object", "additionalProperties": { "type": "string" } }
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"source": {
|
|
31
|
+
"type": "object",
|
|
32
|
+
"additionalProperties": false,
|
|
33
|
+
"required": ["channel", "actorId", "eventId"],
|
|
34
|
+
"properties": {
|
|
35
|
+
"channel": { "type": "string" },
|
|
36
|
+
"actorId": { "type": "string" },
|
|
37
|
+
"eventId": { "type": "string" }
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"idempotencyKey": { "type": "string" },
|
|
41
|
+
"acceptedAt": { "type": "string", "format": "date-time" },
|
|
42
|
+
"answerDigest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" }
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/osolmaz/pi-workflows/schemas/human-decision-accepted-v2.schema.json",
|
|
4
|
+
"title": "Pi Workflows accepted human decision v2",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": [
|
|
8
|
+
"schema",
|
|
9
|
+
"decisionId",
|
|
10
|
+
"requestDigest",
|
|
11
|
+
"subjectDigest",
|
|
12
|
+
"presentationDigest",
|
|
13
|
+
"revision",
|
|
14
|
+
"response",
|
|
15
|
+
"source",
|
|
16
|
+
"idempotencyKey",
|
|
17
|
+
"acceptedAt",
|
|
18
|
+
"answerDigest"
|
|
19
|
+
],
|
|
20
|
+
"properties": {
|
|
21
|
+
"schema": { "const": "pi-workflows.human-decision-accepted.v2" },
|
|
22
|
+
"decisionId": { "type": "string" },
|
|
23
|
+
"requestDigest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
|
|
24
|
+
"subjectDigest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
|
|
25
|
+
"presentationDigest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
|
|
26
|
+
"revision": { "type": "integer", "minimum": 1 },
|
|
27
|
+
"response": {
|
|
28
|
+
"type": "object",
|
|
29
|
+
"additionalProperties": false,
|
|
30
|
+
"required": ["choice"],
|
|
31
|
+
"properties": {
|
|
32
|
+
"choice": { "type": "string" },
|
|
33
|
+
"input": { "type": "object", "additionalProperties": { "type": "string" } }
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"source": {
|
|
37
|
+
"type": "object",
|
|
38
|
+
"additionalProperties": false,
|
|
39
|
+
"required": ["channel", "actorId", "eventId"],
|
|
40
|
+
"properties": {
|
|
41
|
+
"channel": { "type": "string" },
|
|
42
|
+
"actorId": { "type": "string" },
|
|
43
|
+
"eventId": { "type": "string" }
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"idempotencyKey": { "type": "string" },
|
|
47
|
+
"acceptedAt": { "type": "string", "format": "date-time" },
|
|
48
|
+
"answerDigest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" }
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/osolmaz/pi-workflows/schemas/human-decision-answer-attempt-v1.schema.json",
|
|
4
|
+
"title": "Pi Workflows human decision answer attempt v1",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": [
|
|
8
|
+
"schema",
|
|
9
|
+
"attemptId",
|
|
10
|
+
"attemptedAt",
|
|
11
|
+
"decisionId",
|
|
12
|
+
"requestDigest",
|
|
13
|
+
"choice",
|
|
14
|
+
"source",
|
|
15
|
+
"idempotencyKey"
|
|
16
|
+
],
|
|
17
|
+
"properties": {
|
|
18
|
+
"schema": { "const": "pi-workflows.human-decision-answer-attempt.v1" },
|
|
19
|
+
"attemptId": { "type": "string" },
|
|
20
|
+
"attemptedAt": { "type": "string", "format": "date-time" },
|
|
21
|
+
"decisionId": { "type": "string" },
|
|
22
|
+
"requestDigest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
|
|
23
|
+
"choice": { "type": "string" },
|
|
24
|
+
"input": { "type": "object", "additionalProperties": { "type": "string" } },
|
|
25
|
+
"source": {
|
|
26
|
+
"type": "object",
|
|
27
|
+
"additionalProperties": false,
|
|
28
|
+
"required": ["channel", "actorId", "eventId"],
|
|
29
|
+
"properties": {
|
|
30
|
+
"channel": { "type": "string" },
|
|
31
|
+
"actorId": { "type": "string" },
|
|
32
|
+
"eventId": { "type": "string" }
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"idempotencyKey": { "type": "string" }
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/osolmaz/pi-workflows/schemas/human-decision-cancellation-v1.schema.json",
|
|
4
|
+
"title": "Pi Workflows human decision cancellation v1",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["schema", "decisionId", "requestDigest", "cancelledAt", "reason"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"schema": { "const": "pi-workflows.human-decision-cancellation.v1" },
|
|
10
|
+
"decisionId": { "type": "string" },
|
|
11
|
+
"requestDigest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
|
|
12
|
+
"cancelledAt": { "type": "string", "format": "date-time" },
|
|
13
|
+
"reason": { "enum": ["cancelled", "expired"] }
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/osolmaz/pi-workflows/schemas/human-decision-continuation-v1.schema.json",
|
|
4
|
+
"title": "Pi Workflows human decision continuation v1",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["schema", "decisionId", "requestDigest", "parentRunId", "runId", "createdAt"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"schema": { "const": "pi-workflows.human-decision-continuation.v1" },
|
|
10
|
+
"decisionId": { "type": "string" },
|
|
11
|
+
"requestDigest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
|
|
12
|
+
"parentRunId": { "type": "string" },
|
|
13
|
+
"runId": { "type": "string" },
|
|
14
|
+
"createdAt": { "type": "string", "format": "date-time" }
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/osolmaz/pi-workflows/schemas/human-decision-delivery-v1.schema.json",
|
|
4
|
+
"title": "Pi Workflows human decision delivery v1",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": [
|
|
8
|
+
"schema",
|
|
9
|
+
"attemptId",
|
|
10
|
+
"decisionId",
|
|
11
|
+
"requestDigest",
|
|
12
|
+
"channel",
|
|
13
|
+
"state",
|
|
14
|
+
"createdAt"
|
|
15
|
+
],
|
|
16
|
+
"properties": {
|
|
17
|
+
"schema": { "const": "pi-workflows.human-decision-delivery.v1" },
|
|
18
|
+
"attemptId": { "type": "string" },
|
|
19
|
+
"decisionId": { "type": "string" },
|
|
20
|
+
"requestDigest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
|
|
21
|
+
"channel": { "type": "string" },
|
|
22
|
+
"state": { "enum": ["intent", "confirmed", "failed", "unknown"] },
|
|
23
|
+
"createdAt": { "type": "string", "format": "date-time" },
|
|
24
|
+
"finishedAt": { "type": "string", "format": "date-time" },
|
|
25
|
+
"messageCount": { "type": "integer", "minimum": 0 },
|
|
26
|
+
"errorCode": { "type": "string" }
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/osolmaz/pi-workflows/schemas/human-decision-delivery-v2.schema.json",
|
|
4
|
+
"title": "Pi Workflows human decision delivery v2",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": [
|
|
8
|
+
"schema",
|
|
9
|
+
"attemptId",
|
|
10
|
+
"decisionId",
|
|
11
|
+
"requestDigest",
|
|
12
|
+
"presentationDigest",
|
|
13
|
+
"channel",
|
|
14
|
+
"phase",
|
|
15
|
+
"state",
|
|
16
|
+
"createdAt"
|
|
17
|
+
],
|
|
18
|
+
"properties": {
|
|
19
|
+
"schema": { "const": "pi-workflows.human-decision-delivery.v2" },
|
|
20
|
+
"attemptId": { "type": "string" },
|
|
21
|
+
"decisionId": { "type": "string" },
|
|
22
|
+
"requestDigest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
|
|
23
|
+
"presentationDigest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
|
|
24
|
+
"channel": { "type": "string" },
|
|
25
|
+
"phase": { "enum": ["intent", "part", "complete"] },
|
|
26
|
+
"state": { "enum": ["intent", "confirmed", "failed", "unknown"] },
|
|
27
|
+
"createdAt": { "type": "string", "format": "date-time" },
|
|
28
|
+
"finishedAt": { "type": "string", "format": "date-time" },
|
|
29
|
+
"recipientIndex": { "type": "integer", "minimum": 1 },
|
|
30
|
+
"partIndex": { "type": "integer", "minimum": 1 },
|
|
31
|
+
"partCount": { "type": "integer", "minimum": 1, "maximum": 20 },
|
|
32
|
+
"contentDigest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
|
|
33
|
+
"messageCount": { "type": "integer", "minimum": 0 },
|
|
34
|
+
"errorCode": { "type": "string" }
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/osolmaz/pi-workflows/schemas/human-decision-receipt-v1.schema.json",
|
|
4
|
+
"title": "Pi Workflows redacted human decision receipt v1",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": [
|
|
8
|
+
"schema",
|
|
9
|
+
"decisionId",
|
|
10
|
+
"requestDigest",
|
|
11
|
+
"nodeId",
|
|
12
|
+
"response",
|
|
13
|
+
"acceptedAt",
|
|
14
|
+
"answerDigest"
|
|
15
|
+
],
|
|
16
|
+
"properties": {
|
|
17
|
+
"schema": { "const": "pi-workflows.human-decision-receipt.v1" },
|
|
18
|
+
"decisionId": { "type": "string" },
|
|
19
|
+
"requestDigest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
|
|
20
|
+
"nodeId": { "type": "string" },
|
|
21
|
+
"response": {
|
|
22
|
+
"type": "object",
|
|
23
|
+
"additionalProperties": false,
|
|
24
|
+
"required": ["choice"],
|
|
25
|
+
"properties": {
|
|
26
|
+
"choice": { "type": "string" },
|
|
27
|
+
"input": { "type": "object", "additionalProperties": { "type": "string" } }
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"acceptedAt": { "type": "string", "format": "date-time" },
|
|
31
|
+
"answerDigest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" }
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/osolmaz/pi-workflows/schemas/human-decision-receipt-v2.schema.json",
|
|
4
|
+
"title": "Pi Workflows redacted human decision receipt v2",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": [
|
|
8
|
+
"schema",
|
|
9
|
+
"decisionId",
|
|
10
|
+
"requestDigest",
|
|
11
|
+
"subjectDigest",
|
|
12
|
+
"presentationDigest",
|
|
13
|
+
"revision",
|
|
14
|
+
"nodeId",
|
|
15
|
+
"response",
|
|
16
|
+
"acceptedAt",
|
|
17
|
+
"answerDigest"
|
|
18
|
+
],
|
|
19
|
+
"properties": {
|
|
20
|
+
"schema": { "const": "pi-workflows.human-decision-receipt.v2" },
|
|
21
|
+
"decisionId": { "type": "string" },
|
|
22
|
+
"requestDigest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
|
|
23
|
+
"subjectDigest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
|
|
24
|
+
"presentationDigest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
|
|
25
|
+
"revision": { "type": "integer", "minimum": 1 },
|
|
26
|
+
"nodeId": { "type": "string" },
|
|
27
|
+
"response": {
|
|
28
|
+
"type": "object",
|
|
29
|
+
"additionalProperties": false,
|
|
30
|
+
"required": ["choice"],
|
|
31
|
+
"properties": {
|
|
32
|
+
"choice": { "type": "string" },
|
|
33
|
+
"input": { "type": "object", "additionalProperties": { "type": "string" } }
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"acceptedAt": { "type": "string", "format": "date-time" },
|
|
37
|
+
"answerDigest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" }
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/osolmaz/pi-workflows/schemas/human-decision-request-v1.schema.json",
|
|
4
|
+
"title": "Pi Workflows human decision request v1",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": [
|
|
8
|
+
"schema",
|
|
9
|
+
"decisionId",
|
|
10
|
+
"requestDigest",
|
|
11
|
+
"runId",
|
|
12
|
+
"workflowName",
|
|
13
|
+
"nodeId",
|
|
14
|
+
"attemptId",
|
|
15
|
+
"audience",
|
|
16
|
+
"title",
|
|
17
|
+
"body",
|
|
18
|
+
"choices",
|
|
19
|
+
"createdAt"
|
|
20
|
+
],
|
|
21
|
+
"properties": {
|
|
22
|
+
"schema": { "const": "pi-workflows.human-decision-request.v1" },
|
|
23
|
+
"decisionId": { "type": "string", "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,199}$" },
|
|
24
|
+
"requestDigest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
|
|
25
|
+
"runId": { "type": "string" },
|
|
26
|
+
"workflowName": { "type": "string" },
|
|
27
|
+
"nodeId": { "type": "string" },
|
|
28
|
+
"attemptId": { "type": "string" },
|
|
29
|
+
"audience": { "type": "string" },
|
|
30
|
+
"title": { "type": "string", "minLength": 1 },
|
|
31
|
+
"body": true,
|
|
32
|
+
"choices": {
|
|
33
|
+
"type": "object",
|
|
34
|
+
"minProperties": 1,
|
|
35
|
+
"additionalProperties": {
|
|
36
|
+
"type": "object",
|
|
37
|
+
"additionalProperties": false,
|
|
38
|
+
"required": ["label"],
|
|
39
|
+
"properties": {
|
|
40
|
+
"label": { "type": "string", "minLength": 1 },
|
|
41
|
+
"input": {
|
|
42
|
+
"type": "object",
|
|
43
|
+
"additionalProperties": false,
|
|
44
|
+
"required": ["kind", "name", "prompt", "minLength", "maxLength"],
|
|
45
|
+
"properties": {
|
|
46
|
+
"kind": { "const": "text" },
|
|
47
|
+
"name": { "type": "string" },
|
|
48
|
+
"prompt": { "type": "string", "minLength": 1 },
|
|
49
|
+
"minLength": { "type": "integer", "minimum": 0 },
|
|
50
|
+
"maxLength": { "type": "integer", "minimum": 1 }
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"createdAt": { "type": "string", "format": "date-time" },
|
|
57
|
+
"expiresAt": { "type": "string", "format": "date-time" }
|
|
58
|
+
}
|
|
59
|
+
}
|