@tomflow/proflow-task-orchestration 0.1.11 → 0.1.12
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @tomflow/proflow-task-orchestration
|
|
2
2
|
|
|
3
|
+
## 0.1.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Prune empty Task-level document recovery directories after recovery journals converge so durable recovery leaves no orphan filesystem residue.
|
|
8
|
+
|
|
9
|
+
- Harden Task-scoped Worker identity and generation semantics so reopened or invalidated executions cannot reuse stale Worker/conversation ownership or a previously consumed run generation.
|
|
10
|
+
|
|
3
11
|
## 0.1.11
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -4,7 +4,7 @@ declare const success: () => {
|
|
|
4
4
|
readonly ok: true;
|
|
5
5
|
readonly status: "SUCCEEDED";
|
|
6
6
|
readonly moduleRef: "task-orchestration";
|
|
7
|
-
readonly moduleVersion: "0.1.
|
|
7
|
+
readonly moduleVersion: "0.1.12";
|
|
8
8
|
};
|
|
9
9
|
observedEffects: string[];
|
|
10
10
|
};
|
|
@@ -17,7 +17,7 @@ export declare const behaviorAdapter: {
|
|
|
17
17
|
ok: true;
|
|
18
18
|
status: "SUCCEEDED";
|
|
19
19
|
moduleRef: "task-orchestration";
|
|
20
|
-
moduleVersion: "0.1.
|
|
20
|
+
moduleVersion: "0.1.12";
|
|
21
21
|
data: {
|
|
22
22
|
setupStatus: "READY";
|
|
23
23
|
runtimeStatus: "NOT_APPLICABLE";
|
|
@@ -32,7 +32,7 @@ export declare const behaviorAdapter: {
|
|
|
32
32
|
ok: true;
|
|
33
33
|
status: "SUCCEEDED";
|
|
34
34
|
moduleRef: "task-orchestration";
|
|
35
|
-
moduleVersion: "0.1.
|
|
35
|
+
moduleVersion: "0.1.12";
|
|
36
36
|
data: {
|
|
37
37
|
docs: string;
|
|
38
38
|
};
|
|
@@ -3,7 +3,7 @@ export declare const descriptor: {
|
|
|
3
3
|
readonly contractVersion: "1.0.0";
|
|
4
4
|
readonly moduleRef: "task-orchestration";
|
|
5
5
|
readonly packageName: "@tomflow/proflow-task-orchestration";
|
|
6
|
-
readonly moduleVersion: "0.1.
|
|
6
|
+
readonly moduleVersion: "0.1.12";
|
|
7
7
|
readonly kind: "library";
|
|
8
8
|
readonly templateVersion: "1.0.0";
|
|
9
9
|
readonly platformCompatibility: ">=1.0.0 <2.0.0";
|
|
@@ -3,7 +3,7 @@ export const descriptor = {
|
|
|
3
3
|
contractVersion: "1.0.0",
|
|
4
4
|
moduleRef: "task-orchestration",
|
|
5
5
|
packageName: "@tomflow/proflow-task-orchestration",
|
|
6
|
-
moduleVersion: "0.1.
|
|
6
|
+
moduleVersion: "0.1.12",
|
|
7
7
|
kind: "library",
|
|
8
8
|
templateVersion: "1.0.0",
|
|
9
9
|
platformCompatibility: ">=1.0.0 <2.0.0",
|
package/dist/src/contracts.js
CHANGED
|
@@ -98,6 +98,14 @@ const schemas = {
|
|
|
98
98
|
path: ["sequenceNo"],
|
|
99
99
|
});
|
|
100
100
|
}
|
|
101
|
+
input.roleBindings.forEach((binding, index) => {
|
|
102
|
+
if (binding.workerRef !== null || binding.conversationLocator !== null)
|
|
103
|
+
context.addIssue({
|
|
104
|
+
code: "custom",
|
|
105
|
+
message: "createTask roleBindings must start with workerRef and conversationLocator unset",
|
|
106
|
+
path: ["roleBindings", index],
|
|
107
|
+
});
|
|
108
|
+
});
|
|
101
109
|
const declaredAgentPackageRefs = new Set(input.roleBindings.map((binding) => binding.agentPackageRef));
|
|
102
110
|
if (declaredAgentPackageRefs.size !== requiredTaskAgentPackageRefs.length ||
|
|
103
111
|
requiredTaskAgentPackageRefs.some((agentPackageRef) => !declaredAgentPackageRefs.has(agentPackageRef))) {
|
package/dist/src/services.js
CHANGED
|
@@ -180,6 +180,17 @@ function recomputeReadiness(tx, task, timestamp, workspaceRoot) {
|
|
|
180
180
|
function matchesWorker(actorRef, workerRef) {
|
|
181
181
|
return workerRef !== null && actorRef === `worker:${workerRef}`;
|
|
182
182
|
}
|
|
183
|
+
function workerIdentityBoundToAnotherTask(tx, input) {
|
|
184
|
+
for (const task of tx.tasks.list()) {
|
|
185
|
+
if (task.taskId === input.taskId)
|
|
186
|
+
continue;
|
|
187
|
+
for (const binding of tx.roleBindings.listByTask(task.taskId))
|
|
188
|
+
if (binding.workerRef === input.workerRef ||
|
|
189
|
+
binding.conversationLocator === input.conversationLocator)
|
|
190
|
+
return true;
|
|
191
|
+
}
|
|
192
|
+
return false;
|
|
193
|
+
}
|
|
183
194
|
export function createTaskServices(options) {
|
|
184
195
|
const { store, workspaceRoot } = options;
|
|
185
196
|
const now = options.now ?? (() => new Date().toISOString());
|
|
@@ -321,13 +332,22 @@ export function createTaskServices(options) {
|
|
|
321
332
|
? taskId
|
|
322
333
|
: `id-${createHash("sha256").update(taskId).digest("hex")}`;
|
|
323
334
|
const stageDocumentPath = (taskId, type) => `.proflow/recovery/task-create/${safeTaskId(taskId)}/${type.toLowerCase().replaceAll("_", "-")}.md`;
|
|
324
|
-
const
|
|
335
|
+
const documentUpdateRecoveryTaskRoot = (taskId) => `.proflow/recovery/task-document/${safeTaskId(taskId)}`;
|
|
336
|
+
const documentUpdateRecoveryRoot = (taskId, type) => `${documentUpdateRecoveryTaskRoot(taskId)}/${type.toLowerCase().replaceAll("_", "-")}`;
|
|
325
337
|
const documentUpdateRecoveryPath = (taskId, type, idempotencyKey) => `${documentUpdateRecoveryRoot(taskId, type)}/${createHash("sha256").update(idempotencyKey).digest("hex")}`;
|
|
338
|
+
const cleanupDocumentRecoveryTaskRoot = (taskId) => {
|
|
339
|
+
const taskRootAbsolute = join(workspaceRoot, documentUpdateRecoveryTaskRoot(taskId));
|
|
340
|
+
if (existsSync(taskRootAbsolute) &&
|
|
341
|
+
readdirSync(taskRootAbsolute).length === 0)
|
|
342
|
+
rmSync(taskRootAbsolute, { recursive: true, force: true });
|
|
343
|
+
};
|
|
326
344
|
const recoverPendingDocumentUpdates = (taskId, type) => {
|
|
327
345
|
const recoveryRoot = documentUpdateRecoveryRoot(taskId, type);
|
|
328
346
|
const recoveryRootAbsolute = join(workspaceRoot, recoveryRoot);
|
|
329
|
-
if (!existsSync(recoveryRootAbsolute))
|
|
347
|
+
if (!existsSync(recoveryRootAbsolute)) {
|
|
348
|
+
cleanupDocumentRecoveryTaskRoot(taskId);
|
|
330
349
|
return;
|
|
350
|
+
}
|
|
331
351
|
const canonicalPath = relativeDocumentPath(taskId, type);
|
|
332
352
|
const canonicalAbsolute = join(workspaceRoot, canonicalPath);
|
|
333
353
|
const currentMetadata = store.read((tx) => tx.documents.get(taskId, type));
|
|
@@ -375,6 +395,7 @@ export function createTaskServices(options) {
|
|
|
375
395
|
}
|
|
376
396
|
if (readdirSync(recoveryRootAbsolute).length === 0)
|
|
377
397
|
rmSync(recoveryRootAbsolute, { recursive: true, force: true });
|
|
398
|
+
cleanupDocumentRecoveryTaskRoot(taskId);
|
|
378
399
|
};
|
|
379
400
|
const cleanupCreateStage = (taskId) => {
|
|
380
401
|
rmSync(join(workspaceRoot, `.proflow/recovery/task-create/${safeTaskId(taskId)}`), { recursive: true, force: true });
|
|
@@ -630,6 +651,8 @@ export function createTaskServices(options) {
|
|
|
630
651
|
throw new DomainError("AGENT_PACKAGE_NOT_ELIGIBLE", "Agent package is not declared by the Task.");
|
|
631
652
|
if (old.roleRef !== input.roleRef)
|
|
632
653
|
throw new DomainError("ROLE_BINDING_MISMATCH", "RoleRef does not match the declared binding.");
|
|
654
|
+
if (workerIdentityBoundToAnotherTask(tx, input))
|
|
655
|
+
throw new DomainError("TASK_ROLE_BINDING_CONFLICT", "Worker or Conversation identity is already bound to another Task.");
|
|
633
656
|
if (old.workerRef === input.workerRef &&
|
|
634
657
|
old.conversationLocator === input.conversationLocator)
|
|
635
658
|
return {
|
|
@@ -1016,11 +1039,13 @@ export function createTaskServices(options) {
|
|
|
1016
1039
|
tx.nodes.update(reopened);
|
|
1017
1040
|
for (const later of tx.nodes.listByTask(task.taskId))
|
|
1018
1041
|
if (later.sequenceNo > target.sequenceNo) {
|
|
1042
|
+
const invalidatedStartedRun = later.startedAt !== null || later.workerRef !== null;
|
|
1019
1043
|
preserveRunHistory(tx, later, later.status, timestamp);
|
|
1020
1044
|
tx.nodes.update({
|
|
1021
1045
|
...later,
|
|
1022
1046
|
status: "PENDING",
|
|
1023
1047
|
version: later.version + 1,
|
|
1048
|
+
runNo: later.runNo + (invalidatedStartedRun ? 1 : 0),
|
|
1024
1049
|
workerRef: null,
|
|
1025
1050
|
resultSummary: null,
|
|
1026
1051
|
errorCode: null,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tomflow/proflow-task-orchestration",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"@tomflow/proflow-module-contract": "^0.1.13"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@tomflow/proflow-task-migration-runner": "^0.1.11",
|
|
27
26
|
"@tomflow/proflow-deployment-conformance": "^0.1.13",
|
|
28
|
-
"@tomflow/proflow-task-
|
|
27
|
+
"@tomflow/proflow-task-migration-runner": "^0.1.11",
|
|
28
|
+
"@tomflow/proflow-task-store-sqlite": "^0.1.12"
|
|
29
29
|
},
|
|
30
30
|
"description": "Owns the Task & Orchestration public contract, domain rules and application services.",
|
|
31
31
|
"keywords": [
|
package/proflow.module.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"contractVersion": "1.0.0",
|
|
4
4
|
"moduleRef": "task-orchestration",
|
|
5
5
|
"packageName": "@tomflow/proflow-task-orchestration",
|
|
6
|
-
"moduleVersion": "0.1.
|
|
6
|
+
"moduleVersion": "0.1.12",
|
|
7
7
|
"kind": "library",
|
|
8
8
|
"templateVersion": "1.0.0",
|
|
9
9
|
"platformCompatibility": ">=1.0.0 <2.0.0",
|