@nanobpm/nano-workforce 0.208.3 → 0.208.5
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/AGENTS.md +17 -0
- package/CHANGELOG.md +12 -0
- package/app/agentCompletion.test.ts +155 -0
- package/app/agentCompletion.ts +39 -0
- package/app/contracts.ts +1 -1
- package/app/feature.ts +5 -2
- package/app/implementBranchContract.test.ts +168 -0
- package/app/implementReconcile.ts +8 -2
- package/app/mergePolicyLock.test.ts +44 -0
- package/app/mergePolicyLock.ts +25 -0
- package/app/mergeStatus.test.ts +14 -12
- package/app/migration132.test.ts +72 -0
- package/app/pullRequestReadModel.test.ts +1 -1
- package/app/repoEnvelope.test.ts +11 -75
- package/app/repoEnvelope.ts +122 -0
- package/app/service.test.ts +168 -1
- package/app/service.ts +182 -26
- package/build-info.json +4 -4
- package/db/migrations/132_pull_requests_merge_policy.sql +22 -0
- package/db/migrations/133_pull_requests_read_model_merge_policy.sql +51 -0
- package/e2e/feature-preflight.e2e.ts +2 -2
- package/e2e/plan-fanout.e2e.ts +105 -9
- package/nano.app.json +4 -0
- package/openapi.yaml +13 -6
- package/operations/listActivePrs.test.ts +207 -3
- package/operations/listActivePrs.ts +13 -9
- package/package.json +1 -1
- package/resources/processes/implement-cell.bpmn +80 -65
- package/workers/caps-prepare/worker.test.ts +11 -0
- package/workers/slice-branch/worker.test.ts +31 -0
- package/workers/slice-branch/worker.ts +39 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// pr.slice-branch — stamp the implement-cell agent job's deterministic per-slice `branch.create`
|
|
2
|
+
// (issue #945).
|
|
3
|
+
//
|
|
4
|
+
// Runs as the FIRST step of the `implement-cell` process, i.e. inside each slice's OWN called process
|
|
5
|
+
// instance. That is what makes the value child-local: a worker result key is propagated to the root
|
|
6
|
+
// of the process instance the job belongs to, and every implement-cell call is a separate instance —
|
|
7
|
+
// so sibling slices of one plan-fanout wave can never overwrite one another's branch (a key emitted
|
|
8
|
+
// from the plan-fanout MI body would land on the shared epic root, where a sibling's prepare could
|
|
9
|
+
// clobber it while this slice waits at its capability barrier).
|
|
10
|
+
//
|
|
11
|
+
// The value rides a result key literally NAMED `io.nanobpm.agentTask.branch.create`, which the engine
|
|
12
|
+
// materialises as a FLAT dotted process variable the c8ctl harness's `collectEnvelopeFrom` deep-merges
|
|
13
|
+
// with the whole-object seed envelope. A `<zeebe:ioMapping>` dotted target canNOT do this (it builds a
|
|
14
|
+
// nested object the harness never reads). It is derived via the ONE canonical `sliceBranchCreate`, so
|
|
15
|
+
// the envelope, the prompt's `feat/<task.id>` instruction, and the reconcile lookup share one source;
|
|
16
|
+
// a retry (record-implementing → implement-task) stays in the same instance and re-reads the SAME
|
|
17
|
+
// value, so the durable WIP checkpoint restore matches.
|
|
18
|
+
//
|
|
19
|
+
// PURE: no I/O. An implausible/missing `task.id` emits nothing (degrades to the agent cutting its own
|
|
20
|
+
// branch) rather than an unusable branch.create.
|
|
21
|
+
import type { AppJobHandler } from "@nanobpm/urban";
|
|
22
|
+
import { AGENT_TASK_BRANCH_CREATE_VAR, sliceBranchCreate } from "../../app/repoEnvelope.ts";
|
|
23
|
+
|
|
24
|
+
interface In {
|
|
25
|
+
task?: unknown;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function sliceTaskId(task: unknown): string | null {
|
|
29
|
+
if (task === null || typeof task !== "object" || Array.isArray(task)) return null;
|
|
30
|
+
const id: unknown = Reflect.get(task, "id");
|
|
31
|
+
return typeof id === "string" ? id : null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const handler: AppJobHandler<In, Record<string, unknown>> = async (job) => {
|
|
35
|
+
const branchCreate = sliceBranchCreate(sliceTaskId(job.variables.task));
|
|
36
|
+
return branchCreate !== null ? { [AGENT_TASK_BRANCH_CREATE_VAR]: branchCreate } : {};
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default handler;
|