@agimon-ai/po-workflow 0.0.0-alpha.21 → 0.0.0-alpha.210
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 +110 -149
- package/README.md +155 -53
- package/dist/apiContracts.cjs +205 -36
- package/dist/apiContracts.cjs.map +1 -1
- package/dist/apiContracts.d.mts +2 -2
- package/dist/apiContracts.d.mts.map +1 -1
- package/dist/apiContracts.mjs +205 -36
- package/dist/apiContracts.mjs.map +1 -1
- package/dist/contract-BpzJeyjh.mjs +33 -0
- package/dist/contract-BpzJeyjh.mjs.map +1 -0
- package/dist/contract-D80yV2d-.cjs +68 -0
- package/dist/contract-D80yV2d-.cjs.map +1 -0
- package/dist/extensions/native.mjs +4643 -1020
- package/dist/extensions/native.mjs.map +1 -1
- package/dist/extensions/server.cjs +21507 -3593
- package/dist/extensions/server.cjs.map +1 -1
- package/dist/extensions/server.d.mts.map +1 -1
- package/dist/extensions/server.mjs +21495 -3558
- package/dist/extensions/server.mjs.map +1 -1
- package/dist/extensions/web.mjs +5224 -2610
- package/dist/extensions/web.mjs.map +1 -1
- package/dist/index-CxS__mkJ.d.mts +5210 -0
- package/dist/index-CxS__mkJ.d.mts.map +1 -0
- package/dist/index.cjs +41 -3
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.mts +104 -4
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +38 -1
- package/dist/index.mjs.map +1 -0
- package/dist/po-runtime-identity.json +1 -0
- package/dist/workflowHost-B8ludUOG.cjs +4190 -0
- package/dist/workflowHost-B8ludUOG.cjs.map +1 -0
- package/dist/workflowHost-DB4GtWpM.mjs +3974 -0
- package/dist/workflowHost-DB4GtWpM.mjs.map +1 -0
- package/dist/workflowHost.cjs +7 -0
- package/dist/workflowHost.d.mts +29 -0
- package/dist/workflowHost.d.mts.map +1 -0
- package/dist/workflowHost.mjs +3 -0
- package/dist/workflowServices-CSHleLJo.mjs +273 -0
- package/dist/workflowServices-CSHleLJo.mjs.map +1 -0
- package/dist/workflowServices-DYXhIDVE.cjs +350 -0
- package/dist/workflowServices-DYXhIDVE.cjs.map +1 -0
- package/llms.txt +10 -8
- package/locales/vi.json +492 -0
- package/locales/zh-CN.json +492 -0
- package/package.json +150 -26
- package/src/prompts/codemode-how-to-workflow/SKILL.md +226 -0
- package/src/prompts/help-how-to-workflow/SKILL.md +185 -0
- package/src/prompts/help-how-to-workflow-settings/SKILL.md +33 -0
- package/src/types/webWorkflowTerminal.ts +21 -0
- package/src/types/webWorkflows.ts +52 -2
- package/dist/workflowLaunchCommand-C69Nn3k5.cjs +0 -139
- package/dist/workflowLaunchCommand-C69Nn3k5.cjs.map +0 -1
- package/dist/workflowLaunchCommand-GGqimmTC.mjs +0 -122
- package/dist/workflowLaunchCommand-GGqimmTC.mjs.map +0 -1
- package/skills/workflow-recovery/SKILL.md +0 -85
- package/src/prompts/po-author-workflow/SKILL.md +0 -64
- package/src/prompts/po-use-workflow/SKILL.md +0 -21
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_contract = require("./contract-D80yV2d-.cjs");
|
|
3
|
+
const require_workflowServices = require("./workflowServices-DYXhIDVE.cjs");
|
|
4
|
+
exports.PO_WORKFLOW_HOST_SERVICE = require_contract.PO_WORKFLOW_HOST_SERVICE;
|
|
5
|
+
exports.PO_WORKFLOW_LIBRARY_SERVICE = require_contract.PO_WORKFLOW_LIBRARY_SERVICE;
|
|
6
|
+
exports.WORKFLOW_SESSION_PROVENANCE = require_workflowServices.WORKFLOW_SESSION_PROVENANCE;
|
|
7
|
+
exports.createWorkflowPolicyTable = require_workflowServices.createWorkflowPolicyTable;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { a as WorkflowArtifactFile, c as WorkflowHostOwner, i as StepExecutor, l as WorkflowPolicyTable, n as StepExecution, o as WorkflowDurableHost, r as StepExecutionOutcome, s as WorkflowHost, t as CommandStepRequest } from "./index-CxS__mkJ.mjs";
|
|
2
|
+
import { PoWorkflowDefinitionSource } from "@agimon-ai/po-core/workflow";
|
|
3
|
+
import "@deepseek-ai/cordis";
|
|
4
|
+
//#region src/constants/workflow.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Provenance of the child session a launch creates to own and run one workflow.
|
|
7
|
+
* Not 'workflow', which marks a step's session and keeps it out of the rail.
|
|
8
|
+
*/
|
|
9
|
+
export declare const WORKFLOW_SESSION_PROVENANCE = "workflow-session";
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/services/workflowHost/contract.d.ts
|
|
12
|
+
export declare const PO_WORKFLOW_HOST_SERVICE = "po/workflow-host";
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/services/workflowLibrary/index.d.ts
|
|
15
|
+
/** Bound at host scope by a host that keeps workflows outside the session's repository; a computer binds nothing. */
|
|
16
|
+
export declare const PO_WORKFLOW_LIBRARY_SERVICE = "po/workflow-library";
|
|
17
|
+
/**
|
|
18
|
+
* Workflow folders beside the repository, such as Po Cloud's org and personal sets. Each folder is a named source, so a
|
|
19
|
+
* run started from one is recorded and admitted by that source's name rather than as a path outside the repository.
|
|
20
|
+
*/
|
|
21
|
+
interface WorkflowLibrary {
|
|
22
|
+
readonly sources: readonly PoWorkflowDefinitionSource[];
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/services/workflowServices/index.d.ts
|
|
26
|
+
export declare const createWorkflowPolicyTable: () => WorkflowPolicyTable;
|
|
27
|
+
//#endregion
|
|
28
|
+
export type { CommandStepRequest, StepExecution, StepExecutionOutcome, StepExecutor, WorkflowArtifactFile, WorkflowDurableHost, WorkflowHost, WorkflowHostOwner, WorkflowLibrary };
|
|
29
|
+
//# sourceMappingURL=workflowHost.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflowHost.d.mts","names":[],"sources":["../src/constants/workflow.ts","../src/services/workflowHost/contract.ts","../src/services/workflowLibrary/index.ts","../src/services/workflowServices/index.ts"],"mappings":";;;;;;;;qBAiBa;;;qBCbA;;;;qBCEA;;;;;UAQI;WACN,kBAAkB;;;;qBCQhB,iCAAgC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { r as PO_WORKFLOW_LIBRARY_SERVICE, t as PO_WORKFLOW_HOST_SERVICE } from "./contract-BpzJeyjh.mjs";
|
|
2
|
+
import { d as WORKFLOW_SESSION_PROVENANCE, n as createWorkflowPolicyTable } from "./workflowServices-CSHleLJo.mjs";
|
|
3
|
+
export { PO_WORKFLOW_HOST_SERVICE, PO_WORKFLOW_LIBRARY_SERVICE, WORKFLOW_SESSION_PROVENANCE, createWorkflowPolicyTable };
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
import { isAbsolute, resolve } from "node:path";
|
|
2
|
+
import { PO_WORKFLOW_DEFINITION_SOURCES_SERVICE } from "@agimon-ai/po-core/workflow";
|
|
3
|
+
import { randomUUID } from "node:crypto";
|
|
4
|
+
import { defineServiceContract } from "@agimon-ai/po-core/serverPlugin";
|
|
5
|
+
//#region src/constants/workflow.ts
|
|
6
|
+
const LAUNCH_WORKFLOW_TOOL_NAME = "launch_workflow";
|
|
7
|
+
const WORKFLOW_TOOLS_TOOL_NAME = "workflow_tools";
|
|
8
|
+
const DELETE_WORKFLOW_DEFINITION_TOOL_NAME = "workflow_delete_definition";
|
|
9
|
+
/** Under the host home directory; its resolved path is the Node authority every run and record is scoped by. */
|
|
10
|
+
const DEFAULT_WORKFLOW_HOME = ".workflow-mcp";
|
|
11
|
+
/**
|
|
12
|
+
* One launch's own id, carried in the run's environment.
|
|
13
|
+
*
|
|
14
|
+
* A launch answers once its run registers; matching on this id, rather than on
|
|
15
|
+
* the workflow and the time, keeps two launches of one workflow apart.
|
|
16
|
+
*/
|
|
17
|
+
const WORKFLOW_LAUNCH_ID_ENV = "PO_WORKFLOW_LAUNCH_ID";
|
|
18
|
+
/**
|
|
19
|
+
* Provenance of the child session a launch creates to own and run one workflow.
|
|
20
|
+
* Not 'workflow', which marks a step's session and keeps it out of the rail.
|
|
21
|
+
*/
|
|
22
|
+
const WORKFLOW_SESSION_PROVENANCE = "workflow-session";
|
|
23
|
+
/** The cause a parked run records when a Stop, or removing its workflow session, ends its wait. */
|
|
24
|
+
const STOPPED_WHILE_WAITING = "Stopped while waiting for the person's approval.";
|
|
25
|
+
/**
|
|
26
|
+
* Run env key naming the session that launched a run into its own workflow
|
|
27
|
+
* session. PO_SESSION_ID names the owner; this names the launcher, which lists
|
|
28
|
+
* the run, is told when it ends, and releases the workflow session after success.
|
|
29
|
+
*/
|
|
30
|
+
const WORKFLOW_LAUNCHER_SESSION_ENV = "PO_WORKFLOW_LAUNCHER_SESSION_ID";
|
|
31
|
+
/** Message a workflow session sends its launcher to be released once its run succeeded. */
|
|
32
|
+
const WORKFLOW_SESSION_RELEASE_TYPE = "po-workflow.session-release";
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region src/services/workflowServices/index.ts
|
|
35
|
+
/** How long admission waits for a revived launcher's coordinator to register again. */
|
|
36
|
+
const LAUNCHER_REVIVE_TIMEOUT_MS = 6e4;
|
|
37
|
+
/** Only the host can wake a dormant launcher. Workspace mounts resolve the current host binding. */
|
|
38
|
+
const WORKFLOW_LAUNCHER_SESSIONS = defineServiceContract("po/workflow-launcher-sessions", { scope: "host" });
|
|
39
|
+
const createWorkflowPolicyTable = () => ({
|
|
40
|
+
policies: /* @__PURE__ */ new Map(),
|
|
41
|
+
waiters: /* @__PURE__ */ new Set()
|
|
42
|
+
});
|
|
43
|
+
/** Publishes the workspace's sources on a level's Context. A reused root's services do not run, so sessions call this too. */
|
|
44
|
+
const provideWorkflowSources = (services) => (scope) => {
|
|
45
|
+
scope.plugin((provider) => {
|
|
46
|
+
provider.provide(PO_WORKFLOW_DEFINITION_SOURCES_SERVICE, services);
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
/** Workspace-owned views. Authorization is attached by the owning runtime, never by a sibling lookup. */
|
|
50
|
+
function createWorkflowServices(options = {}) {
|
|
51
|
+
const reviveTimeoutMs = options.reviveTimeoutMs ?? LAUNCHER_REVIVE_TIMEOUT_MS;
|
|
52
|
+
let disposed = false;
|
|
53
|
+
const durable = options.durableHost;
|
|
54
|
+
const { policies, waiters: policyWaiters } = durable?.policyTable ?? options.policyTable ?? createWorkflowPolicyTable();
|
|
55
|
+
/** Generations registered through this copy, withdrawn when it disposes. */
|
|
56
|
+
const ownPolicies = /* @__PURE__ */ new Map();
|
|
57
|
+
/** Admissions of this copy waiting for a revived launcher; disposal releases them. */
|
|
58
|
+
const ownWaiters = /* @__PURE__ */ new Set();
|
|
59
|
+
/** Waits for `key` to register, or settles undefined on timeout, abort, disposal or `cancel`. */
|
|
60
|
+
const waitForPolicy = (key, signal) => {
|
|
61
|
+
let cancel;
|
|
62
|
+
return {
|
|
63
|
+
registered: new Promise((resolve) => {
|
|
64
|
+
const waiter = {
|
|
65
|
+
key,
|
|
66
|
+
resolve: (policy) => {
|
|
67
|
+
clearTimeout(timer);
|
|
68
|
+
signal.removeEventListener("abort", cancel);
|
|
69
|
+
policyWaiters.delete(waiter);
|
|
70
|
+
ownWaiters.delete(waiter);
|
|
71
|
+
resolve(policy);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
cancel = () => waiter.resolve(void 0);
|
|
75
|
+
const timer = setTimeout(cancel, reviveTimeoutMs);
|
|
76
|
+
signal.addEventListener("abort", cancel, { once: true });
|
|
77
|
+
policyWaiters.add(waiter);
|
|
78
|
+
ownWaiters.add(waiter);
|
|
79
|
+
}),
|
|
80
|
+
cancel
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* A launcher that went dormant (a Po restart, an idle release) holds its coordinator with it. Reopen it
|
|
85
|
+
* without a prompt, as the restart sweep does for owners, and wait for its coordinator to register again.
|
|
86
|
+
*/
|
|
87
|
+
const reviveLauncher = async (launcher, key, signal) => {
|
|
88
|
+
const host = durable === void 0 ? options.sessions?.() : void 0;
|
|
89
|
+
const revive = durable?.reviveLauncher?.bind(durable) ?? (host?.dormant().some((entry) => entry.sessionId === launcher) ? (id) => host.revive(id, { automatic: true }) : void 0);
|
|
90
|
+
if (!revive) return void 0;
|
|
91
|
+
signal.throwIfAborted();
|
|
92
|
+
const { registered, cancel } = waitForPolicy(key, signal);
|
|
93
|
+
Promise.resolve().then(() => revive(launcher)).then((outcome) => {
|
|
94
|
+
if (outcome === "paused" || outcome === "not_found") cancel();
|
|
95
|
+
}, cancel);
|
|
96
|
+
return await registered ?? policies.get(key);
|
|
97
|
+
};
|
|
98
|
+
const owners = /* @__PURE__ */ new Map();
|
|
99
|
+
const sources = /* @__PURE__ */ new Map();
|
|
100
|
+
const sourceListeners = /* @__PURE__ */ new Set();
|
|
101
|
+
const runs = /* @__PURE__ */ new Map();
|
|
102
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
103
|
+
const list = () => disposed ? [] : [...sources.values()].map(({ value }) => ({ ...value }));
|
|
104
|
+
const emitSources = () => {
|
|
105
|
+
for (const listener of sourceListeners) listener(list());
|
|
106
|
+
};
|
|
107
|
+
const read = (session, id) => {
|
|
108
|
+
const run = disposed ? void 0 : runs.get(id);
|
|
109
|
+
return run !== void 0 && (run.owner === session || run.launcher === session) ? run : void 0;
|
|
110
|
+
};
|
|
111
|
+
return {
|
|
112
|
+
registerPolicy(session, coordinator, callback, options) {
|
|
113
|
+
if (disposed || !session || !coordinator) throw new Error("Workflow policy registration is unavailable.");
|
|
114
|
+
const key = JSON.stringify([session, coordinator]);
|
|
115
|
+
const keys = new Set(options.environmentKeys);
|
|
116
|
+
for (const name of keys) if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(name) || /^(PO_|WORKFLOW_)/.test(name)) throw new Error("Protected workflow policy environment key.");
|
|
117
|
+
const generation = randomUUID();
|
|
118
|
+
const policy = {
|
|
119
|
+
generation,
|
|
120
|
+
callback,
|
|
121
|
+
keys,
|
|
122
|
+
settle: options.settle
|
|
123
|
+
};
|
|
124
|
+
policies.set(key, policy);
|
|
125
|
+
ownPolicies.set(key, generation);
|
|
126
|
+
for (const waiter of policyWaiters) if (waiter.key === key) waiter.resolve(policy);
|
|
127
|
+
return { dispose() {
|
|
128
|
+
if (policies.get(key)?.generation === generation) policies.delete(key);
|
|
129
|
+
if (ownPolicies.get(key) === generation) ownPolicies.delete(key);
|
|
130
|
+
} };
|
|
131
|
+
},
|
|
132
|
+
async beforeExecution(request) {
|
|
133
|
+
const key = JSON.stringify([request.launcherSessionId, request.binding.association.coordinator]);
|
|
134
|
+
let policy = policies.get(key);
|
|
135
|
+
if (!disposed && !policy) policy = await reviveLauncher(request.launcherSessionId, key, request.signal);
|
|
136
|
+
if (disposed) throw new Error("Workflow policy coordinator is unavailable for its source session: these services were replaced.");
|
|
137
|
+
if (!policy) {
|
|
138
|
+
const launcherPrefix = JSON.stringify([request.launcherSessionId]).slice(0, -1);
|
|
139
|
+
const known = [...policies.keys()].filter((entry) => entry.startsWith(launcherPrefix)).length;
|
|
140
|
+
throw new Error(`Workflow policy coordinator is unavailable for its source session (${String(known)} coordinator(s) registered for the launcher, ${String(policies.size)} in total).`);
|
|
141
|
+
}
|
|
142
|
+
request.signal.throwIfAborted();
|
|
143
|
+
const result = await policy.callback({
|
|
144
|
+
...structuredClone({
|
|
145
|
+
...request,
|
|
146
|
+
signal: void 0
|
|
147
|
+
}),
|
|
148
|
+
signal: request.signal
|
|
149
|
+
});
|
|
150
|
+
request.signal.throwIfAborted();
|
|
151
|
+
if (policies.get(key)?.generation !== policy.generation) throw new Error("Workflow policy registration changed during admission.");
|
|
152
|
+
for (const [name, value] of Object.entries(result?.environment ?? {})) if (!policy.keys.has(name) || typeof value !== "string") throw new Error("Workflow policy returned an unregistered environment key.");
|
|
153
|
+
return result === void 0 ? void 0 : structuredClone(result);
|
|
154
|
+
},
|
|
155
|
+
async settle(request) {
|
|
156
|
+
const key = JSON.stringify([request.launcherSessionId, request.binding.association.coordinator]);
|
|
157
|
+
const policy = policies.get(key);
|
|
158
|
+
if (disposed || !policy) return "unavailable";
|
|
159
|
+
if (!policy.settle) return "unsupported";
|
|
160
|
+
request.signal.throwIfAborted();
|
|
161
|
+
await policy.settle({
|
|
162
|
+
...structuredClone({
|
|
163
|
+
...request,
|
|
164
|
+
signal: void 0
|
|
165
|
+
}),
|
|
166
|
+
signal: request.signal
|
|
167
|
+
});
|
|
168
|
+
return policies.get(key)?.generation === policy.generation ? "delivered" : "unavailable";
|
|
169
|
+
},
|
|
170
|
+
registerOwner(session, owner) {
|
|
171
|
+
if (disposed) throw new Error("Workflow services are disposed.");
|
|
172
|
+
const generation = randomUUID();
|
|
173
|
+
owners.set(session, {
|
|
174
|
+
generation,
|
|
175
|
+
value: owner
|
|
176
|
+
});
|
|
177
|
+
return { dispose() {
|
|
178
|
+
if (owners.get(session)?.generation === generation) owners.delete(session);
|
|
179
|
+
} };
|
|
180
|
+
},
|
|
181
|
+
owner: (session) => disposed ? void 0 : owners.get(session)?.value,
|
|
182
|
+
register(value) {
|
|
183
|
+
if (disposed) throw new Error("Workflow services are disposed.");
|
|
184
|
+
if (!value.source || !isAbsolute(value.directory)) throw new Error("A workflow source requires a name and absolute directory.");
|
|
185
|
+
if (sources.has(value.source)) throw new Error(`Workflow source already registered: ${value.source}`);
|
|
186
|
+
const generation = randomUUID();
|
|
187
|
+
sources.set(value.source, {
|
|
188
|
+
generation,
|
|
189
|
+
value: {
|
|
190
|
+
source: value.source,
|
|
191
|
+
directory: resolve(value.directory)
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
emitSources();
|
|
195
|
+
return {
|
|
196
|
+
source: value.source,
|
|
197
|
+
generation,
|
|
198
|
+
dispose() {
|
|
199
|
+
if (sources.get(value.source)?.generation !== generation) return;
|
|
200
|
+
sources.delete(value.source);
|
|
201
|
+
emitSources();
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
},
|
|
205
|
+
list,
|
|
206
|
+
subscribe(listener) {
|
|
207
|
+
if (disposed) return () => {};
|
|
208
|
+
sourceListeners.add(listener);
|
|
209
|
+
listener(list());
|
|
210
|
+
return () => {
|
|
211
|
+
sourceListeners.delete(listener);
|
|
212
|
+
};
|
|
213
|
+
},
|
|
214
|
+
forSession(session) {
|
|
215
|
+
return {
|
|
216
|
+
async readConfig(id) {
|
|
217
|
+
const value = read(session, id)?.config;
|
|
218
|
+
return value === void 0 ? void 0 : structuredClone(value);
|
|
219
|
+
},
|
|
220
|
+
async readState(id) {
|
|
221
|
+
const value = read(session, id)?.state;
|
|
222
|
+
return value === void 0 ? void 0 : structuredClone(value);
|
|
223
|
+
},
|
|
224
|
+
subscribe(runId, listener) {
|
|
225
|
+
if (disposed) return () => {};
|
|
226
|
+
const entry = {
|
|
227
|
+
session,
|
|
228
|
+
runId,
|
|
229
|
+
listener
|
|
230
|
+
};
|
|
231
|
+
listeners.add(entry);
|
|
232
|
+
const state = read(session, runId)?.state;
|
|
233
|
+
if (state !== void 0) listener(structuredClone(state));
|
|
234
|
+
return () => {
|
|
235
|
+
listeners.delete(entry);
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
},
|
|
240
|
+
update(owner, state, launcher, config) {
|
|
241
|
+
if (disposed || state.run.ownerSessionId !== owner) return;
|
|
242
|
+
const previous = runs.get(state.run.runId);
|
|
243
|
+
if (previous !== void 0 && previous.owner !== owner) return;
|
|
244
|
+
runs.set(state.run.runId, {
|
|
245
|
+
owner,
|
|
246
|
+
launcher,
|
|
247
|
+
state: structuredClone(config !== void 0 && previous !== void 0 ? previous.state : state),
|
|
248
|
+
config: config === void 0 ? previous?.config : structuredClone(config)
|
|
249
|
+
});
|
|
250
|
+
for (const entry of listeners) if (entry.runId === state.run.runId && read(entry.session, entry.runId) !== void 0) entry.listener(structuredClone(runs.get(state.run.runId).state));
|
|
251
|
+
},
|
|
252
|
+
withdraw(owner) {
|
|
253
|
+
if (owners.has(owner)) return;
|
|
254
|
+
for (const [id, run] of runs) if (run.owner === owner) runs.delete(id);
|
|
255
|
+
for (const entry of listeners) if (entry.session === owner) listeners.delete(entry);
|
|
256
|
+
},
|
|
257
|
+
dispose() {
|
|
258
|
+
disposed = true;
|
|
259
|
+
for (const waiter of ownWaiters) waiter.resolve(void 0);
|
|
260
|
+
runs.clear();
|
|
261
|
+
for (const [key, generation] of ownPolicies) if (policies.get(key)?.generation === generation) policies.delete(key);
|
|
262
|
+
ownPolicies.clear();
|
|
263
|
+
owners.clear();
|
|
264
|
+
sources.clear();
|
|
265
|
+
listeners.clear();
|
|
266
|
+
sourceListeners.clear();
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
//#endregion
|
|
271
|
+
export { DEFAULT_WORKFLOW_HOME as a, STOPPED_WHILE_WAITING as c, WORKFLOW_SESSION_PROVENANCE as d, WORKFLOW_SESSION_RELEASE_TYPE as f, provideWorkflowSources as i, WORKFLOW_LAUNCHER_SESSION_ENV as l, createWorkflowPolicyTable as n, DELETE_WORKFLOW_DEFINITION_TOOL_NAME as o, WORKFLOW_TOOLS_TOOL_NAME as p, createWorkflowServices as r, LAUNCH_WORKFLOW_TOOL_NAME as s, WORKFLOW_LAUNCHER_SESSIONS as t, WORKFLOW_LAUNCH_ID_ENV as u };
|
|
272
|
+
|
|
273
|
+
//# sourceMappingURL=workflowServices-CSHleLJo.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflowServices-CSHleLJo.mjs","names":[],"sources":["../src/constants/workflow.ts","../src/services/workflowServices/index.ts"],"sourcesContent":["export const LAUNCH_WORKFLOW_TOOL_NAME = 'launch_workflow';\nexport const WORKFLOW_TOOLS_TOOL_NAME = 'workflow_tools';\nexport const DELETE_WORKFLOW_DEFINITION_TOOL_NAME = 'workflow_delete_definition';\n/** Under the host home directory; its resolved path is the Node authority every run and record is scoped by. */\nexport const DEFAULT_WORKFLOW_HOME = '.workflow-mcp';\n/**\n * One launch's own id, carried in the run's environment.\n *\n * A launch answers once its run registers; matching on this id, rather than on\n * the workflow and the time, keeps two launches of one workflow apart.\n */\nexport const WORKFLOW_LAUNCH_ID_ENV = 'PO_WORKFLOW_LAUNCH_ID';\n\n/**\n * Provenance of the child session a launch creates to own and run one workflow.\n * Not 'workflow', which marks a step's session and keeps it out of the rail.\n */\nexport const WORKFLOW_SESSION_PROVENANCE = 'workflow-session';\n\n/** The cause a parked run records when a Stop, or removing its workflow session, ends its wait. */\nexport const STOPPED_WHILE_WAITING = \"Stopped while waiting for the person's approval.\";\n\n/**\n * Run env key naming the session that launched a run into its own workflow\n * session. PO_SESSION_ID names the owner; this names the launcher, which lists\n * the run, is told when it ends, and releases the workflow session after success.\n */\nexport const WORKFLOW_LAUNCHER_SESSION_ENV = 'PO_WORKFLOW_LAUNCHER_SESSION_ID';\n\n/** Message a workflow session sends its launcher to be released once its run succeeded. */\nexport const WORKFLOW_SESSION_RELEASE_TYPE = 'po-workflow.session-release';\n\n/** Recoveries a run's owner may start without the person; the next one needs their approval. */\nexport const MAX_UNATTENDED_RECOVERIES = 3;\n","import { randomUUID } from 'node:crypto';\nimport { isAbsolute, resolve } from 'node:path';\n\nimport { defineServiceContract } from '@agimon-ai/po-core/serverPlugin';\nimport {\n PO_WORKFLOW_DEFINITION_SOURCES_SERVICE,\n type PoWorkflowConfig,\n type PoWorkflowRunState,\n type PoWorkflowDefinitionSource,\n} from '@agimon-ai/po-core/workflow';\nimport type { Context } from '@deepseek-ai/cordis';\n\nimport type { WorkflowDurableHost } from '../workflowHost/type';\nimport type { LauncherSessions, WorkflowPolicy, WorkflowPolicyTable, WorkflowServices } from './type';\n\n/** How long admission waits for a revived launcher's coordinator to register again. */\nconst LAUNCHER_REVIVE_TIMEOUT_MS = 60_000;\n\n/** Only the host can wake a dormant launcher. Workspace mounts resolve the current host binding. */\nexport const WORKFLOW_LAUNCHER_SESSIONS = defineServiceContract<LauncherSessions>('po/workflow-launcher-sessions', {\n scope: 'host',\n});\n\nexport const createWorkflowPolicyTable = (): WorkflowPolicyTable => ({ policies: new Map(), waiters: new Set() });\n\n/** Publishes the workspace's sources on a level's Context. A reused root's services do not run, so sessions call this too. */\nexport const provideWorkflowSources =\n (services: WorkflowServices) =>\n (scope: Context): void => {\n scope.plugin((provider) => {\n provider.provide(PO_WORKFLOW_DEFINITION_SOURCES_SERVICE, services);\n });\n };\n\n/** Workspace-owned views. Authorization is attached by the owning runtime, never by a sibling lookup. */\nexport function createWorkflowServices(\n options: {\n sessions?: () => LauncherSessions | undefined;\n reviveTimeoutMs?: number;\n policyTable?: WorkflowPolicyTable;\n durableHost?: Pick<WorkflowDurableHost, 'policyTable' | 'reviveLauncher'>;\n } = {},\n): WorkflowServices {\n const reviveTimeoutMs = options.reviveTimeoutMs ?? LAUNCHER_REVIVE_TIMEOUT_MS;\n let disposed = false;\n const durable = options.durableHost;\n const { policies, waiters: policyWaiters } =\n durable?.policyTable ?? options.policyTable ?? createWorkflowPolicyTable();\n /** Generations registered through this copy, withdrawn when it disposes. */\n const ownPolicies = new Map<string, string>();\n /** Admissions of this copy waiting for a revived launcher; disposal releases them. */\n const ownWaiters = new Set<{ resolve: (policy: WorkflowPolicy | undefined) => void }>();\n /** Waits for `key` to register, or settles undefined on timeout, abort, disposal or `cancel`. */\n const waitForPolicy = (key: string, signal: AbortSignal) => {\n let cancel!: () => void;\n const registered = new Promise<WorkflowPolicy | undefined>((resolve) => {\n const waiter = {\n key,\n resolve: (policy: WorkflowPolicy | undefined) => {\n clearTimeout(timer);\n signal.removeEventListener('abort', cancel);\n policyWaiters.delete(waiter);\n ownWaiters.delete(waiter);\n resolve(policy);\n },\n };\n cancel = () => waiter.resolve(undefined);\n const timer = setTimeout(cancel, reviveTimeoutMs);\n signal.addEventListener('abort', cancel, { once: true });\n policyWaiters.add(waiter);\n ownWaiters.add(waiter);\n });\n return { registered, cancel };\n };\n /**\n * A launcher that went dormant (a Po restart, an idle release) holds its coordinator with it. Reopen it\n * without a prompt, as the restart sweep does for owners, and wait for its coordinator to register again.\n */\n const reviveLauncher = async (\n launcher: string,\n key: string,\n signal: AbortSignal,\n ): Promise<WorkflowPolicy | undefined> => {\n const host = durable === undefined ? options.sessions?.() : undefined;\n const revive =\n durable?.reviveLauncher?.bind(durable) ??\n (host?.dormant().some((entry) => entry.sessionId === launcher)\n ? (id: string) => host.revive(id, { automatic: true })\n : undefined);\n if (!revive) return undefined;\n signal.throwIfAborted();\n const { registered, cancel } = waitForPolicy(key, signal);\n // The boot can itself recover work. Do not wait for it to finish once the coordinator is available.\n void Promise.resolve()\n .then(() => revive(launcher))\n .then((outcome) => {\n if (outcome === 'paused' || outcome === 'not_found') cancel();\n }, cancel);\n return (await registered) ?? policies.get(key);\n };\n const owners = new Map<string, { generation: string; value: Parameters<WorkflowServices['registerOwner']>[1] }>();\n const sources = new Map<string, { generation: string; value: PoWorkflowDefinitionSource }>();\n const sourceListeners = new Set<(sources: readonly PoWorkflowDefinitionSource[]) => void>();\n const runs = new Map<\n string,\n { owner: string; launcher?: string; state: PoWorkflowRunState; config?: PoWorkflowConfig }\n >();\n const listeners = new Set<{ session: string; runId: string; listener: (state: PoWorkflowRunState) => void }>();\n const list = (): readonly PoWorkflowDefinitionSource[] =>\n disposed ? [] : [...sources.values()].map(({ value }) => ({ ...value }));\n const emitSources = (): void => {\n for (const listener of sourceListeners) listener(list());\n };\n const read = (session: string, id: string) => {\n const run = disposed ? undefined : runs.get(id);\n return run !== undefined && (run.owner === session || run.launcher === session) ? run : undefined;\n };\n return {\n registerPolicy(session, coordinator, callback, options) {\n if (disposed || !session || !coordinator) throw new Error('Workflow policy registration is unavailable.');\n const key = JSON.stringify([session, coordinator]);\n // A remounted session runtime registers before the one it replaces disposes. The newest registration wins;\n // the stale handle's dispose is fenced by generation. One runtime refuses its own duplicates.\n const keys = new Set(options.environmentKeys);\n for (const name of keys)\n if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(name) || /^(PO_|WORKFLOW_)/.test(name))\n throw new Error('Protected workflow policy environment key.');\n const generation = randomUUID();\n const policy = { generation, callback, keys, settle: options.settle };\n policies.set(key, policy);\n ownPolicies.set(key, generation);\n for (const waiter of policyWaiters) if (waiter.key === key) waiter.resolve(policy);\n return {\n dispose() {\n if (policies.get(key)?.generation === generation) policies.delete(key);\n if (ownPolicies.get(key) === generation) ownPolicies.delete(key);\n },\n };\n },\n async beforeExecution(request) {\n const key = JSON.stringify([request.launcherSessionId, request.binding.association.coordinator]);\n let policy = policies.get(key);\n if (!disposed && !policy) policy = await reviveLauncher(request.launcherSessionId, key, request.signal);\n if (disposed)\n throw new Error(\n 'Workflow policy coordinator is unavailable for its source session: these services were replaced.',\n );\n if (!policy) {\n const launcherPrefix = JSON.stringify([request.launcherSessionId]).slice(0, -1);\n const known = [...policies.keys()].filter((entry) => entry.startsWith(launcherPrefix)).length;\n throw new Error(\n `Workflow policy coordinator is unavailable for its source session (${String(known)} coordinator(s) registered for the launcher, ${String(policies.size)} in total).`,\n );\n }\n request.signal.throwIfAborted();\n const result = await policy.callback({\n ...structuredClone({ ...request, signal: undefined }),\n signal: request.signal,\n });\n request.signal.throwIfAborted();\n if (policies.get(key)?.generation !== policy.generation)\n throw new Error('Workflow policy registration changed during admission.');\n for (const [name, value] of Object.entries(result?.environment ?? {}))\n if (!policy.keys.has(name) || typeof value !== 'string')\n throw new Error('Workflow policy returned an unregistered environment key.');\n return result === undefined ? undefined : structuredClone(result);\n },\n async settle(request) {\n const key = JSON.stringify([request.launcherSessionId, request.binding.association.coordinator]);\n const policy = policies.get(key);\n if (disposed || !policy) return 'unavailable';\n if (!policy.settle) return 'unsupported';\n request.signal.throwIfAborted();\n await policy.settle({ ...structuredClone({ ...request, signal: undefined }), signal: request.signal });\n // A coordinator replaced mid-call may not have recorded it, so the newer one is asked again.\n return policies.get(key)?.generation === policy.generation ? 'delivered' : 'unavailable';\n },\n registerOwner(session, owner) {\n // A reloaded session runtime takes over from the one it replaces, as with policies.\n if (disposed) throw new Error('Workflow services are disposed.');\n const generation = randomUUID();\n owners.set(session, { generation, value: owner });\n return {\n dispose() {\n if (owners.get(session)?.generation === generation) owners.delete(session);\n },\n };\n },\n owner: (session) => (disposed ? undefined : owners.get(session)?.value),\n register(value) {\n if (disposed) throw new Error('Workflow services are disposed.');\n if (!value.source || !isAbsolute(value.directory))\n throw new Error('A workflow source requires a name and absolute directory.');\n if (sources.has(value.source)) throw new Error(`Workflow source already registered: ${value.source}`);\n const generation = randomUUID();\n sources.set(value.source, { generation, value: { source: value.source, directory: resolve(value.directory) } });\n emitSources();\n return {\n source: value.source,\n generation,\n dispose() {\n if (sources.get(value.source)?.generation !== generation) return;\n sources.delete(value.source);\n emitSources();\n },\n };\n },\n list,\n subscribe(listener) {\n if (disposed) return () => {};\n sourceListeners.add(listener);\n listener(list());\n return () => {\n sourceListeners.delete(listener);\n };\n },\n forSession(session) {\n return {\n async readConfig(id) {\n const value = read(session, id)?.config;\n return value === undefined ? undefined : structuredClone(value);\n },\n async readState(id) {\n const value = read(session, id)?.state;\n return value === undefined ? undefined : structuredClone(value);\n },\n subscribe(runId, listener) {\n if (disposed) return () => {};\n const entry = { session, runId, listener };\n listeners.add(entry);\n const state = read(session, runId)?.state;\n if (state !== undefined) listener(structuredClone(state));\n return () => {\n listeners.delete(entry);\n };\n },\n };\n },\n update(owner, state, launcher, config) {\n if (disposed || state.run.ownerSessionId !== owner) return;\n const previous = runs.get(state.run.runId);\n if (previous !== undefined && previous.owner !== owner) return;\n runs.set(state.run.runId, {\n owner,\n launcher,\n state: structuredClone(config !== undefined && previous !== undefined ? previous.state : state),\n config: config === undefined ? previous?.config : structuredClone(config),\n });\n for (const entry of listeners)\n if (entry.runId === state.run.runId && read(entry.session, entry.runId) !== undefined)\n entry.listener(structuredClone(runs.get(state.run.runId)!.state));\n },\n withdraw(owner) {\n // A replaced runtime leaving must not take its successor's runs and listeners with it.\n if (owners.has(owner)) return;\n for (const [id, run] of runs) if (run.owner === owner) runs.delete(id);\n for (const entry of listeners) if (entry.session === owner) listeners.delete(entry);\n },\n dispose() {\n disposed = true;\n for (const waiter of ownWaiters) waiter.resolve(undefined);\n runs.clear();\n // Only this copy's registrations leave; sessions still on another copy keep theirs.\n for (const [key, generation] of ownPolicies)\n if (policies.get(key)?.generation === generation) policies.delete(key);\n ownPolicies.clear();\n owners.clear();\n sources.clear();\n listeners.clear();\n sourceListeners.clear();\n },\n };\n}\n"],"mappings":";;;;;AAAA,MAAa,4BAA4B;AACzC,MAAa,2BAA2B;AACxC,MAAa,uCAAuC;;AAEpD,MAAa,wBAAwB;;;;;;;AAOrC,MAAa,yBAAyB;;;;;AAMtC,MAAa,8BAA8B;;AAG3C,MAAa,wBAAwB;;;;;;AAOrC,MAAa,gCAAgC;;AAG7C,MAAa,gCAAgC;;;;ACd7C,MAAM,6BAA6B;;AAGnC,MAAa,6BAA6B,sBAAwC,iCAAiC,EACjH,OAAO,OACT,CAAC;AAED,MAAa,mCAAwD;CAAE,0BAAU,IAAI,IAAI;CAAG,yBAAS,IAAI,IAAI;AAAE;;AAG/G,MAAa,0BACV,cACA,UAAyB;CACxB,MAAM,QAAQ,aAAa;EACzB,SAAS,QAAQ,wCAAwC,QAAQ;CACnE,CAAC;AACH;;AAGF,SAAgB,uBACd,UAKI,CAAC,GACa;CAClB,MAAM,kBAAkB,QAAQ,mBAAmB;CACnD,IAAI,WAAW;CACf,MAAM,UAAU,QAAQ;CACxB,MAAM,EAAE,UAAU,SAAS,kBACzB,SAAS,eAAe,QAAQ,eAAe,0BAA0B;;CAE3E,MAAM,8BAAc,IAAI,IAAoB;;CAE5C,MAAM,6BAAa,IAAI,IAA+D;;CAEtF,MAAM,iBAAiB,KAAa,WAAwB;EAC1D,IAAI;EAkBJ,OAAO;GAAE,YAAA,IAjBc,SAAqC,YAAY;IACtE,MAAM,SAAS;KACb;KACA,UAAU,WAAuC;MAC/C,aAAa,KAAK;MAClB,OAAO,oBAAoB,SAAS,MAAM;MAC1C,cAAc,OAAO,MAAM;MAC3B,WAAW,OAAO,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