@agimon-ai/po-dynamic-workflow 0.0.0-stage → 0.0.1-alpha.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/LICENSE ADDED
@@ -0,0 +1,149 @@
1
+ License text copyright © 2017 MariaDB Corporation Ab, All Rights Reserved.
2
+ "Business Source License" is a trademark of MariaDB Corporation Ab.
3
+
4
+ Parameters
5
+
6
+ Licensor: Agimon Pty Ltd
7
+ Licensed Work: Po, the software in the Po source repository and the
8
+ packages released from it, in each version released by
9
+ the Licensor.
10
+ The Licensed Work is (c) 2026 Agimon Pty Ltd.
11
+ Material identified as third-party in the "Third-party
12
+ components" section at the end of this file or in a
13
+ NOTICE file, and any package or directory whose own
14
+ license file grants a different license, is not part of
15
+ the Licensed Work and remains under its own license.
16
+ Additional Use Grant: You may make production use of the Licensed Work if
17
+ your use is Eligible Use. "Eligible Use" is production use that falls
18
+ within at least one of the following:
19
+
20
+ (a) Personal Use. Use by an individual for their own personal purposes,
21
+ and not on behalf of, or for the benefit of, an employer, client, or
22
+ other Organization. Use by an individual in the course of employment
23
+ or engagement by an Organization is use by that Organization.
24
+
25
+ (b) Small Organization Use. Use by or on behalf of an Organization whose
26
+ Annual Revenue is less than USD 1,000,000.
27
+
28
+ (c) Non-profit, Education and Research Use. Use, regardless of Annual
29
+ Revenue, by (i) an Organization registered or recognized as a
30
+ non-profit or charitable organization under the laws of its
31
+ jurisdiction, for its non-profit purposes; (ii) an accredited school,
32
+ college, or university, for teaching, learning, or academic research;
33
+ or (iii) a publicly funded research institution, for its research.
34
+
35
+ (d) Service Provider Use. Use by a consultant, contractor, agency, or other
36
+ service provider, regardless of its own Annual Revenue, solely to
37
+ build, deploy, host, operate, or support the Licensed Work for a client
38
+ whose own use would be Eligible Use under (a), (b), or (c). A service
39
+ provider's use for its own purposes is Eligible Use only if the service
40
+ provider itself qualifies under (b) or (c).
41
+
42
+
43
+ Hosted services. Offering the Licensed Work to third parties as a hosted
44
+ or managed service whose primary value is the Licensed Work is Eligible
45
+ Use only if each such third party's own use would be Eligible Use.
46
+
47
+ Definitions. "Organization" means any company, partnership, sole
48
+ proprietorship, trust, association, government body, or other entity, and
49
+ includes an individual acting in a business or professional capacity.
50
+ "Affiliate" means any entity that directly or indirectly controls, is
51
+ controlled by, or is under common control with an Organization, where
52
+ "control" means ownership of more than 50% of the voting interests of an
53
+ entity or the power to direct its management and policies by contract or
54
+ otherwise. "Annual Revenue" means the total gross revenue of an
55
+ Organization and all of its Affiliates combined, from all sources and
56
+ whether or not related to the Licensed Work, for its most recently
57
+ completed fiscal year, or, if it has not completed a fiscal year, for the
58
+ twelve months before the use (or since its formation, if shorter),
59
+ converted into US dollars at the average exchange rate for that period.
60
+ Proceeds of equity or debt financing are not revenue.
61
+
62
+ Threshold. If an Organization stops qualifying under (b), its existing
63
+ production use remains Eligible Use for 90 days after it stops
64
+ qualifying, after which it must obtain a commercial license or stop
65
+ production use. Use that was Eligible Use when it occurred never requires
66
+ a commercial license after the fact.
67
+ Change Date: Four years from the date a version of the Licensed Work
68
+ is first publicly released by the Licensor.
69
+ Change License: Apache License, Version 2.0
70
+
71
+ For information about alternative licensing arrangements for the Licensed
72
+ Work, please visit: https://agimon.ai/licensing
73
+
74
+ Notice
75
+
76
+ The Business Source License (this document, or the "License") is not an Open
77
+ Source license. However, the Licensed Work will eventually be made available
78
+ under an Open Source License, as stated in this License.
79
+
80
+ -----------------------------------------------------------------------------
81
+
82
+ Business Source License 1.1
83
+
84
+ Terms
85
+
86
+ The Licensor hereby grants you the right to copy, modify, create derivative
87
+ works, redistribute, and make non-production use of the Licensed Work. The
88
+ Licensor may make an Additional Use Grant, above, permitting limited
89
+ production use.
90
+
91
+ Effective on the Change Date, or the fourth anniversary of the first publicly
92
+ available distribution of a specific version of the Licensed Work under this
93
+ License, whichever comes first, the Licensor hereby grants you rights under
94
+ the terms of the Change License, and the rights granted in the paragraph
95
+ above terminate.
96
+
97
+ If your use of the Licensed Work does not comply with the requirements
98
+ currently in effect as described in this License, you must purchase a
99
+ commercial license from the Licensor, its affiliated entities, or authorized
100
+ resellers, or you must refrain from using the Licensed Work.
101
+
102
+ All copies of the original and modified Licensed Work, and derivative works
103
+ of the Licensed Work, are subject to this License. This License applies
104
+ separately for each version of the Licensed Work and the Change Date may vary
105
+ for each version of the Licensed Work released by Licensor.
106
+
107
+ You must conspicuously display this License on each original or modified copy
108
+ of the Licensed Work. If you receive the Licensed Work in original or
109
+ modified form from a third party, the terms and conditions set forth in this
110
+ License apply to your use of that work.
111
+
112
+ Any use of the Licensed Work in violation of this License will automatically
113
+ terminate your rights under this License for the current and all other
114
+ versions of the Licensed Work.
115
+
116
+ This License does not grant you any right in any trademark or logo of
117
+ Licensor or its affiliates (provided that you may use a trademark or logo of
118
+ Licensor as expressly required by this License).
119
+
120
+ TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
121
+ AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
122
+ EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
123
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
124
+ TITLE.
125
+
126
+ MariaDB hereby grants you permission to use this License’s text to license
127
+ your works, and to refer to it using the trademark “Business Source License”,
128
+ as long as you comply with the Covenants of Licensor below.
129
+
130
+ Covenants of Licensor
131
+
132
+ In consideration of the right to use this License’s text and the “Business
133
+ Source License” name and trademark, Licensor covenants to MariaDB, and to all
134
+ other recipients of the licensed work to be provided by Licensor:
135
+
136
+ 1. To specify as the Change License the GPL Version 2.0 or any later version,
137
+ or a license that is compatible with GPL Version 2.0 or a later version,
138
+ where “compatible” means that software provided under the Change License can
139
+ be included in a program with software provided under GPL Version 2.0 or a
140
+ later version. Licensor may specify additional Change Licenses without
141
+ limitation.
142
+
143
+ 2. To either: (a) specify an additional grant of rights to use that does not
144
+ impose any additional restriction on the right granted in this License, as
145
+ the Additional Use Grant; or (b) insert the text “None”.
146
+
147
+ 3. To specify a Change Date.
148
+
149
+ 4. Not to modify this License in any other way.
package/README.md CHANGED
@@ -1,3 +1,11 @@
1
- # Temporary Holding Version
1
+ # @agimon-ai/po-dynamic-workflow
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The `dynamic-workflow` layer supplies a tracked `dynamicWorkflow` code-mode namespace backed by pinned Mastra 1.78.0 and Zod 3.25.76. Mastra owns execution; Po observes lifecycle and live `team.run` transcript references.
4
+
5
+ Compose tracked steps with `then`, `parallel`, `branch`, and `foreach` over a committed item workflow with a positive numeric concurrency. Commit, `createRun()`, then await `start({inputData})`; `cancel()` and exec disposal stop active runs. Use `exec_background` for long-running work. Unsupported Mastra methods are not exposed. No raw-instance, storage, stream, resume or time-travel API is supported.
6
+
7
+ The script chooses failure policy. Returned failure data is not automatically thrown. Child-agent failures remain distinct from Mastra execution success. Undefined callback output is refused because the code-mode membrane also returns undefined for guest exceptions; return null for intentional empty output and inspect exec diagnostics for the original error.
8
+
9
+ Metadata is session-scoped and in memory. Snapshots omit prompts, schemas, source, inputs and outputs. Up to 20 terminal roots remain, active roots are retained, and groups publish at most 1000 rows with true totals, aggregate counts and an explicit truncation flag. No durable resume or historical database is provided.
10
+
11
+ See the [pinned guide](src/prompts/codemode-how-to-dynamic-workflow/SKILL.md) for usage and limitations. Web and native Activity surfaces use the `dynamic_workflow_runs` channel. Their visual implementation is gated on explicit rendered-target approval.
@@ -0,0 +1,104 @@
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
4
+ });
5
+ let _agimon_ai_po_core_apiContracts = require("@agimon-ai/po-core/apiContracts");
6
+ let typebox = require("typebox");
7
+ //#region src/schemas/apiContracts.ts
8
+ const state = typebox.Type.Union([
9
+ "pending",
10
+ "running",
11
+ "completed",
12
+ "failed",
13
+ "stopped",
14
+ "skipped"
15
+ ].map((value) => typebox.Type.Literal(value)));
16
+ const time = typebox.Type.Optional(typebox.Type.Number());
17
+ const phase = typebox.Type.Object({
18
+ key: typebox.Type.String(),
19
+ label: typebox.Type.String(),
20
+ status: state,
21
+ executionStatus: state,
22
+ startedAt: time,
23
+ finishedAt: time,
24
+ error: typebox.Type.Optional(typebox.Type.String()),
25
+ agents: typebox.Type.Array(typebox.Type.Object({
26
+ runId: typebox.Type.String(),
27
+ status: typebox.Type.Union([
28
+ "running",
29
+ "completed",
30
+ "failed",
31
+ "stopped"
32
+ ].map((value) => typebox.Type.Literal(value)))
33
+ }))
34
+ });
35
+ const shape = typebox.Type.Object({
36
+ key: typebox.Type.String(),
37
+ label: typebox.Type.String(),
38
+ kind: typebox.Type.Union([
39
+ "step",
40
+ "sequence",
41
+ "parallel",
42
+ "branch",
43
+ "foreach"
44
+ ].map((value) => typebox.Type.Literal(value))),
45
+ children: typebox.Type.Array(typebox.Type.Ref("#/$defs/Shape"))
46
+ });
47
+ const DynamicWorkflowSnapshotSchema = typebox.Type.Object({
48
+ version: typebox.Type.Literal(1),
49
+ revision: typebox.Type.Number(),
50
+ sessionId: typebox.Type.String(),
51
+ runs: typebox.Type.Array(typebox.Type.Object({
52
+ key: typebox.Type.String(),
53
+ workflowId: typebox.Type.String(),
54
+ label: typebox.Type.String(),
55
+ status: state,
56
+ executionStatus: state,
57
+ startedAt: typebox.Type.Number(),
58
+ finishedAt: time,
59
+ error: typebox.Type.Optional(typebox.Type.String()),
60
+ shape: typebox.Type.Ref("#/$defs/Shape"),
61
+ groups: typebox.Type.Array(typebox.Type.Object({
62
+ key: typebox.Type.String(),
63
+ label: typebox.Type.String(),
64
+ concurrency: typebox.Type.Optional(typebox.Type.Number()),
65
+ total: typebox.Type.Number(),
66
+ truncated: typebox.Type.Boolean(),
67
+ counts: typebox.Type.Object({
68
+ pending: typebox.Type.Number(),
69
+ running: typebox.Type.Number(),
70
+ completed: typebox.Type.Number(),
71
+ failed: typebox.Type.Number(),
72
+ stopped: typebox.Type.Number(),
73
+ skipped: typebox.Type.Number()
74
+ }),
75
+ items: typebox.Type.Array(typebox.Type.Object({
76
+ key: typebox.Type.String(),
77
+ label: typebox.Type.String(),
78
+ index: typebox.Type.Number(),
79
+ status: state,
80
+ phases: typebox.Type.Array(phase)
81
+ }))
82
+ }))
83
+ }))
84
+ }, { $defs: { Shape: shape } });
85
+ const apiContracts = (0, _agimon_ai_po_core_apiContracts.defineApiContract)({
86
+ version: 1,
87
+ http: [],
88
+ dynamic: [],
89
+ sockets: ["global", "workspace"].map((scope) => ({
90
+ id: "dynamic-workflow.runs",
91
+ scope,
92
+ service: "po.hub",
93
+ member: "dynamic_workflow_runs",
94
+ kind: "channel",
95
+ direction: "server-to-client",
96
+ description: "Tracked workflow state for one session, without callback source or input/output data.",
97
+ input: DynamicWorkflowSnapshotSchema
98
+ }))
99
+ });
100
+ //#endregion
101
+ exports.apiContracts = apiContracts;
102
+ exports.default = apiContracts;
103
+
104
+ //# sourceMappingURL=apiContracts.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apiContracts.cjs","names":["Type","defineApiContract"],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract } from '@agimon-ai/po-core/apiContracts';\nimport { Type } from 'typebox';\n\nconst state = Type.Union(\n ['pending', 'running', 'completed', 'failed', 'stopped', 'skipped'].map((value) => Type.Literal(value)),\n);\nconst time = Type.Optional(Type.Number());\nconst phase = Type.Object({\n key: Type.String(),\n label: Type.String(),\n status: state,\n executionStatus: state,\n startedAt: time,\n finishedAt: time,\n error: Type.Optional(Type.String()),\n agents: Type.Array(\n Type.Object({\n runId: Type.String(),\n status: Type.Union(['running', 'completed', 'failed', 'stopped'].map((value) => Type.Literal(value))),\n }),\n ),\n});\nconst shape = Type.Object({\n key: Type.String(),\n label: Type.String(),\n kind: Type.Union(['step', 'sequence', 'parallel', 'branch', 'foreach'].map((value) => Type.Literal(value))),\n children: Type.Array(Type.Ref('#/$defs/Shape')),\n});\nexport const DynamicWorkflowSnapshotSchema = Type.Object(\n {\n version: Type.Literal(1),\n revision: Type.Number(),\n sessionId: Type.String(),\n runs: Type.Array(\n Type.Object({\n key: Type.String(),\n workflowId: Type.String(),\n label: Type.String(),\n status: state,\n executionStatus: state,\n startedAt: Type.Number(),\n finishedAt: time,\n error: Type.Optional(Type.String()),\n shape: Type.Ref('#/$defs/Shape'),\n groups: Type.Array(\n Type.Object({\n key: Type.String(),\n label: Type.String(),\n concurrency: Type.Optional(Type.Number()),\n total: Type.Number(),\n truncated: Type.Boolean(),\n counts: Type.Object({\n pending: Type.Number(),\n running: Type.Number(),\n completed: Type.Number(),\n failed: Type.Number(),\n stopped: Type.Number(),\n skipped: Type.Number(),\n }),\n items: Type.Array(\n Type.Object({\n key: Type.String(),\n label: Type.String(),\n index: Type.Number(),\n status: state,\n phases: Type.Array(phase),\n }),\n ),\n }),\n ),\n }),\n ),\n },\n { $defs: { Shape: shape } },\n);\nexport const apiContracts = defineApiContract({\n version: 1,\n http: [],\n dynamic: [],\n sockets: (['global', 'workspace'] as const).map((scope) => ({\n id: 'dynamic-workflow.runs',\n scope,\n service: 'po.hub',\n member: 'dynamic_workflow_runs',\n kind: 'channel',\n direction: 'server-to-client',\n description: 'Tracked workflow state for one session, without callback source or input/output data.',\n input: DynamicWorkflowSnapshotSchema,\n })),\n});\nexport default apiContracts;\n"],"mappings":";;;;;;;AAGA,MAAM,QAAQA,QAAAA,KAAK,MACjB;CAAC;CAAW;CAAW;CAAa;CAAU;CAAW;AAAS,CAAC,CAAC,KAAK,UAAUA,QAAAA,KAAK,QAAQ,KAAK,CAAC,CACxG;AACA,MAAM,OAAOA,QAAAA,KAAK,SAASA,QAAAA,KAAK,OAAO,CAAC;AACxC,MAAM,QAAQA,QAAAA,KAAK,OAAO;CACxB,KAAKA,QAAAA,KAAK,OAAO;CACjB,OAAOA,QAAAA,KAAK,OAAO;CACnB,QAAQ;CACR,iBAAiB;CACjB,WAA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AA,KAAK,OAAO,CAAC;GACxC,OAAOA,QAAAA,KAAK,OAAO;GACnB,WAAWA,QAAAA,KAAK,QAAQ;GACxB,QAAQA,QAAAA,KAAK,OAAO;IAClB,SAASA,QAAAA,KAAK,OAAO;IACrB,SAASA,QAAAA,KAAK,OAAO;IACrB,WAAWA,QAAAA,KAAK,OAAO;IACvB,QAAQA,QAAAA,KAAK,OAAO;IACpB,SAASA,QAAAA,KAAK,OAAO;IACrB,SAASA,QAAAA,KAAK,OAAO;GACvB,CAAC;GACD,OAAOA,QAAAA,KAAK,MACVA,QAAAA,KAAK,OAAO;IACV,KAAKA,QAAAA,KAAK,OAAO;IACjB,OAAOA,QAAAA,KAAK,OAAO;IACnB,OAAOA,QAAAA,KAAK,OAAO;IACnB,QAAQ;IACR,QAAQA,QAAAA,KAAK,MAAM,KAAK;GAC1B,CAAC,CACH;EACF,CAAC,CACH;CACF,CAAC,CACH;AACF,GACA,EAAE,OAAO,EAAE,OAAO,MAAM,EAAE,CAC5B;AACA,MAAa,gBAAA,GAAeC,gCAAAA,kBAAAA,CAAkB;CAC5C,SAAS;CACT,MAAM,CAAC;CACP,SAAS,CAAC;CACV,SAAU,CAAC,UAAU,WAAW,CAAC,CAAW,KAAK,WAAW;EAC1D,IAAI;EACJ;EACA,SAAS;EACT,QAAQ;EACR,MAAM;EACN,WAAW;EACX,aAAa;EACb,OAAO;CACT,EAAE;AACJ,CAAC"}
@@ -0,0 +1,53 @@
1
+ import { Type } from "typebox";
2
+ //#region src/schemas/apiContracts.d.ts
3
+ export declare const apiContracts: {
4
+ version: 1;
5
+ protocols?: Record<string, string> | undefined;
6
+ schemas?: Record<string, boolean | object> | undefined;
7
+ http: {
8
+ id: string;
9
+ scope: "global" | "session" | "workspace";
10
+ basePath?: string | undefined;
11
+ path: string;
12
+ method: "DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT";
13
+ description: string;
14
+ availability?: string | undefined;
15
+ authentication: "device" | "none" | "owner";
16
+ parameters?: {
17
+ name: string;
18
+ in: "header" | "path" | "query";
19
+ required: boolean;
20
+ schema: boolean | object;
21
+ }[] | undefined;
22
+ body?: {
23
+ contentType: string;
24
+ contentTypes?: string[] | undefined;
25
+ required: boolean;
26
+ schema: boolean | object;
27
+ } | undefined;
28
+ responses: Record<string, {
29
+ description: string;
30
+ contentType?: string | undefined;
31
+ schema?: boolean | object | undefined;
32
+ events?: Record<string, boolean | object> | undefined;
33
+ }>;
34
+ }[];
35
+ sockets: {
36
+ id: string;
37
+ scope: "global" | "session" | "workspace";
38
+ description: string;
39
+ availability?: string | undefined;
40
+ service: string;
41
+ member: string;
42
+ direction: "client-to-server" | "server-to-client";
43
+ kind: "channel" | "method" | "state";
44
+ input: boolean | object;
45
+ output?: boolean | object | undefined;
46
+ errors?: boolean | object | undefined;
47
+ }[];
48
+ dynamic: string[];
49
+ gaps?: string[] | undefined;
50
+ };
51
+ //#endregion
52
+ export { apiContracts as default };
53
+ //# sourceMappingURL=apiContracts.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apiContracts.d.mts","names":[],"sources":["../src/schemas/apiContracts.ts"],"mappings":";;qBA2Ea"}
@@ -0,0 +1,99 @@
1
+ import { defineApiContract } from "@agimon-ai/po-core/apiContracts";
2
+ import { Type } from "typebox";
3
+ //#region src/schemas/apiContracts.ts
4
+ const state = Type.Union([
5
+ "pending",
6
+ "running",
7
+ "completed",
8
+ "failed",
9
+ "stopped",
10
+ "skipped"
11
+ ].map((value) => Type.Literal(value)));
12
+ const time = Type.Optional(Type.Number());
13
+ const phase = Type.Object({
14
+ key: Type.String(),
15
+ label: Type.String(),
16
+ status: state,
17
+ executionStatus: state,
18
+ startedAt: time,
19
+ finishedAt: time,
20
+ error: Type.Optional(Type.String()),
21
+ agents: Type.Array(Type.Object({
22
+ runId: Type.String(),
23
+ status: Type.Union([
24
+ "running",
25
+ "completed",
26
+ "failed",
27
+ "stopped"
28
+ ].map((value) => Type.Literal(value)))
29
+ }))
30
+ });
31
+ const shape = Type.Object({
32
+ key: Type.String(),
33
+ label: Type.String(),
34
+ kind: Type.Union([
35
+ "step",
36
+ "sequence",
37
+ "parallel",
38
+ "branch",
39
+ "foreach"
40
+ ].map((value) => Type.Literal(value))),
41
+ children: Type.Array(Type.Ref("#/$defs/Shape"))
42
+ });
43
+ const DynamicWorkflowSnapshotSchema = Type.Object({
44
+ version: Type.Literal(1),
45
+ revision: Type.Number(),
46
+ sessionId: Type.String(),
47
+ runs: Type.Array(Type.Object({
48
+ key: Type.String(),
49
+ workflowId: Type.String(),
50
+ label: Type.String(),
51
+ status: state,
52
+ executionStatus: state,
53
+ startedAt: Type.Number(),
54
+ finishedAt: time,
55
+ error: Type.Optional(Type.String()),
56
+ shape: Type.Ref("#/$defs/Shape"),
57
+ groups: Type.Array(Type.Object({
58
+ key: Type.String(),
59
+ label: Type.String(),
60
+ concurrency: Type.Optional(Type.Number()),
61
+ total: Type.Number(),
62
+ truncated: Type.Boolean(),
63
+ counts: Type.Object({
64
+ pending: Type.Number(),
65
+ running: Type.Number(),
66
+ completed: Type.Number(),
67
+ failed: Type.Number(),
68
+ stopped: Type.Number(),
69
+ skipped: Type.Number()
70
+ }),
71
+ items: Type.Array(Type.Object({
72
+ key: Type.String(),
73
+ label: Type.String(),
74
+ index: Type.Number(),
75
+ status: state,
76
+ phases: Type.Array(phase)
77
+ }))
78
+ }))
79
+ }))
80
+ }, { $defs: { Shape: shape } });
81
+ const apiContracts = defineApiContract({
82
+ version: 1,
83
+ http: [],
84
+ dynamic: [],
85
+ sockets: ["global", "workspace"].map((scope) => ({
86
+ id: "dynamic-workflow.runs",
87
+ scope,
88
+ service: "po.hub",
89
+ member: "dynamic_workflow_runs",
90
+ kind: "channel",
91
+ direction: "server-to-client",
92
+ description: "Tracked workflow state for one session, without callback source or input/output data.",
93
+ input: DynamicWorkflowSnapshotSchema
94
+ }))
95
+ });
96
+ //#endregion
97
+ export { apiContracts, apiContracts as default };
98
+
99
+ //# sourceMappingURL=apiContracts.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apiContracts.mjs","names":[],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract } from '@agimon-ai/po-core/apiContracts';\nimport { Type } from 'typebox';\n\nconst state = Type.Union(\n ['pending', 'running', 'completed', 'failed', 'stopped', 'skipped'].map((value) => Type.Literal(value)),\n);\nconst time = Type.Optional(Type.Number());\nconst phase = Type.Object({\n key: Type.String(),\n label: Type.String(),\n status: state,\n executionStatus: state,\n startedAt: time,\n finishedAt: time,\n error: Type.Optional(Type.String()),\n agents: Type.Array(\n Type.Object({\n runId: Type.String(),\n status: Type.Union(['running', 'completed', 'failed', 'stopped'].map((value) => Type.Literal(value))),\n }),\n ),\n});\nconst shape = Type.Object({\n key: Type.String(),\n label: Type.String(),\n kind: Type.Union(['step', 'sequence', 'parallel', 'branch', 'foreach'].map((value) => Type.Literal(value))),\n children: Type.Array(Type.Ref('#/$defs/Shape')),\n});\nexport const DynamicWorkflowSnapshotSchema = Type.Object(\n {\n version: Type.Literal(1),\n revision: Type.Number(),\n sessionId: Type.String(),\n runs: Type.Array(\n Type.Object({\n key: Type.String(),\n workflowId: Type.String(),\n label: Type.String(),\n status: state,\n executionStatus: state,\n startedAt: Type.Number(),\n finishedAt: time,\n error: Type.Optional(Type.String()),\n shape: Type.Ref('#/$defs/Shape'),\n groups: Type.Array(\n Type.Object({\n key: Type.String(),\n label: Type.String(),\n concurrency: Type.Optional(Type.Number()),\n total: Type.Number(),\n truncated: Type.Boolean(),\n counts: Type.Object({\n pending: Type.Number(),\n running: Type.Number(),\n completed: Type.Number(),\n failed: Type.Number(),\n stopped: Type.Number(),\n skipped: Type.Number(),\n }),\n items: Type.Array(\n Type.Object({\n key: Type.String(),\n label: Type.String(),\n index: Type.Number(),\n status: state,\n phases: Type.Array(phase),\n }),\n ),\n }),\n ),\n }),\n ),\n },\n { $defs: { Shape: shape } },\n);\nexport const apiContracts = defineApiContract({\n version: 1,\n http: [],\n dynamic: [],\n sockets: (['global', 'workspace'] as const).map((scope) => ({\n id: 'dynamic-workflow.runs',\n scope,\n service: 'po.hub',\n member: 'dynamic_workflow_runs',\n kind: 'channel',\n direction: 'server-to-client',\n description: 'Tracked workflow state for one session, without callback source or input/output data.',\n input: DynamicWorkflowSnapshotSchema,\n })),\n});\nexport default apiContracts;\n"],"mappings":";;;AAGA,MAAM,QAAQ,KAAK,MACjB;CAAC;CAAW;CAAW;CAAa;CAAU;CAAW;AAAS,CAAC,CAAC,KAAK,UAAU,KAAK,QAAQ,KAAK,CAAC,CACxG;AACA,MAAM,OAAO,KAAK,SAAS,KAAK,OAAO,CAAC;AACxC,MAAM,QAAQ,KAAK,OAAO;CACxB,KAAK,KAAK,OAAO;CACjB,OAAO,KAAK,OAAO;CACnB,QAAQ;CACR,iBAAiB;CACjB,WAAW;CACX,YAAY;CACZ,OAAO,KAAK,SAAS,KAAK,OAAO,CAAC;CAClC,QAAQ,KAAK,MACX,KAAK,OAAO;EACV,OAAO,KAAK,OAAO;EACnB,QAAQ,KAAK,MAAM;GAAC;GAAW;GAAa;GAAU;EAAS,CAAC,CAAC,KAAK,UAAU,KAAK,QAAQ,KAAK,CAAC,CAAC;CACtG,CAAC,CACH;AACF,CAAC;AACD,MAAM,QAAQ,KAAK,OAAO;CACxB,KAAK,KAAK,OAAO;CACjB,OAAO,KAAK,OAAO;CACnB,MAAM,KAAK,MAAM;EAAC;EAAQ;EAAY;EAAY;EAAU;CAAS,CAAC,CAAC,KAAK,UAAU,KAAK,QAAQ,KAAK,CAAC,CAAC;CAC1G,UAAU,KAAK,MAAM,KAAK,IAAI,eAAe,CAAC;AAChD,CAAC;AACD,MAAa,gCAAgC,KAAK,OAChD;CACE,SAAS,KAAK,QAAQ,CAAC;CACvB,UAAU,KAAK,OAAO;CACtB,WAAW,KAAK,OAAO;CACvB,MAAM,KAAK,MACT,KAAK,OAAO;EACV,KAAK,KAAK,OAAO;EACjB,YAAY,KAAK,OAAO;EACxB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