@akagilnc/pi-workflow-roles 0.1.3837 → 0.1.3873
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/dist/acp-host/production-host.js +24606 -24532
- package/dist/engine-detour-tool.js +2 -2
- package/dist/engine-detour.js +23 -7
- package/dist/headless-host/production-host.js +4197 -4139
- package/dist/host-descriptions.js +5 -2
- package/dist/pi/role-turn-host.js +20 -92
- package/dist/public-cli/load-production-acp-host.js +1 -1
- package/dist/public-cli/load-production-external-host.js +10 -0
- package/dist/public-cli/load-production-headless-host.js +1 -1
- package/dist/public-cli/main.js +95 -102
- package/dist/public-role-summons.js +7 -49
- package/dist/reviewer-agent.js +1 -0
- package/dist/reviewer-child-executor.js +3 -2
- package/dist/role-activation-flags.js +50 -0
- package/dist/role-runtime.js +8 -3
- package/package.json +1 -1
- package/scripts/build-package.mjs +2 -2
- package/src/acp-host/production-host.ts +31 -94
- package/src/acp-host/role-turn-host.ts +178 -263
- package/src/diagnostic-tail.ts +18 -0
- package/src/engine-detour-tool.ts +5 -4
- package/src/engine-detour.ts +44 -9
- package/src/external-host-turn-loop.ts +172 -0
- package/src/headless-host/production-host.ts +10 -7
- package/src/headless-host/role-turn-host.ts +271 -263
- package/src/host-descriptions.ts +5 -2
- package/src/host-session-record.ts +41 -0
- package/src/pi/role-turn-host.ts +18 -93
- package/src/prepared-role-turn.ts +68 -0
- package/src/public-cli/cli.ts +11 -20
- package/src/public-cli/load-production-acp-host.ts +2 -1
- package/src/public-cli/load-production-external-host.ts +17 -0
- package/src/public-cli/load-production-headless-host.ts +2 -1
- package/src/public-role-summons.ts +12 -69
- package/src/reviewer-agent.ts +12 -1
- package/src/reviewer-child-executor.ts +10 -2
- package/src/role-activation-flags.ts +53 -0
- package/src/{acp-host/role-envelope.ts → role-envelope.ts} +28 -84
- package/src/role-runtime-dependencies.ts +91 -0
- package/src/role-runtime.ts +14 -4
- package/src/{acp-host/session-identity.ts → session-identity.ts} +6 -6
- /package/src/{acp-host/mcp-relay.mjs → mcp-relay.mjs} +0 -0
package/dist/role-runtime.js
CHANGED
|
@@ -1090,7 +1090,12 @@ export function createRoleRuntimeExtension(dependencies) {
|
|
|
1090
1090
|
async runDispatch(dispatch, options) {
|
|
1091
1091
|
if (dependencies.runReviewerDispatch === undefined)
|
|
1092
1092
|
throw new Error("Reviewer runtime dependencies are not configured");
|
|
1093
|
-
|
|
1093
|
+
// #818: request-scoped engine flag reaches axis sub-session via same RoleHost
|
|
1094
|
+
// that parent registerEngineDetourTool reads — never ambient process.env.
|
|
1095
|
+
return dependencies.runReviewerDispatch(dispatch, {
|
|
1096
|
+
...options,
|
|
1097
|
+
getFlag: (name) => roleHost.getFlag(name),
|
|
1098
|
+
});
|
|
1094
1099
|
},
|
|
1095
1100
|
...(dependencies.shutdownReviewerAgent === undefined
|
|
1096
1101
|
? {}
|
|
@@ -1567,8 +1572,8 @@ export function createRoleRuntimeExtension(dependencies) {
|
|
|
1567
1572
|
}
|
|
1568
1573
|
}
|
|
1569
1574
|
await executeActivationStage(entry.role, activationStage(entry.role, runtime), { clock, writeTrace });
|
|
1570
|
-
// #357 T2 / #378 / #380 / #391: any role+engine activation registers the package detour tool once.
|
|
1571
|
-
// Gate is env
|
|
1575
|
+
// #357 T2 / #378 / #380 / #391 / #818: any role+engine activation registers the package detour tool once.
|
|
1576
|
+
// Gate is resolveEngineName (RoleHost flag → env fallback) — no per-engine execute branch; no role-module spawn.
|
|
1572
1577
|
if (!engineDetourRegistered) {
|
|
1573
1578
|
engineDetourRegistered = registerEngineDetourTool(roleHost, hostActions);
|
|
1574
1579
|
}
|
package/package.json
CHANGED
|
@@ -109,7 +109,7 @@ export async function buildAcpProductionHost(
|
|
|
109
109
|
});
|
|
110
110
|
// role-envelope resolves ./mcp-relay.mjs from import.meta.url — keep it beside the bundle.
|
|
111
111
|
await copyFile(
|
|
112
|
-
resolve("src/
|
|
112
|
+
resolve("src/mcp-relay.mjs"),
|
|
113
113
|
join(dirname(outfile), "mcp-relay.mjs"),
|
|
114
114
|
);
|
|
115
115
|
}
|
|
@@ -136,7 +136,7 @@ export async function buildHeadlessProductionHost(
|
|
|
136
136
|
// Shared envelope resolves ./mcp-relay.mjs from import.meta.url of the bundle
|
|
137
137
|
// (#645 headless reuses the ACP relay for AK tools under --mcp-config).
|
|
138
138
|
await copyFile(
|
|
139
|
-
resolve("src/
|
|
139
|
+
resolve("src/mcp-relay.mjs"),
|
|
140
140
|
join(dirname(outfile), "mcp-relay.mjs"),
|
|
141
141
|
);
|
|
142
142
|
}
|
|
@@ -6,108 +6,44 @@
|
|
|
6
6
|
* factory does not create a run-scoped agent home, does not rewrite HOME, and
|
|
7
7
|
* does not copy or scrub credentials. Sitian records on the run are the dossier.
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
10
|
-
import { fileURLToPath } from "node:url";
|
|
9
|
+
import { randomUUID } from "node:crypto";
|
|
11
10
|
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import
|
|
17
|
-
import { createProductionMergerGitState } from "../merger-git-state.ts";
|
|
18
|
-
import { createNativeNavigatorSessionFactory, createNavigatorAttendance } from "../navigator-attendance.ts";
|
|
19
|
-
import { loadNavigatorWorkContext } from "../navigator-work-context.ts";
|
|
20
|
-
import { loadNotarySourceRunLocator } from "../notary-source-run.ts";
|
|
21
|
-
import { loadPackagedCanonicalSkillBinding } from "../package-resources/method-skill-binding.ts";
|
|
22
|
-
import { createPerDispatchReviewerAgent } from "../reviewer-agent.ts";
|
|
23
|
-
import { formatNavigatorRoleHelp, type RoleRuntimeDependencies } from "../role-runtime.ts";
|
|
24
|
-
import { createReviewerPinnedGitReader } from "../reviewer-pinned-git.ts";
|
|
25
|
-
import { loadAuditorSoulFromSubjectInput } from "../auditor-soul.ts";
|
|
26
|
-
import { loadGatekeeperSessionMaterials, loadMainRoleSessionMaterials } from "../session-opening-materials.ts";
|
|
11
|
+
import type { DurablePrincipalAuthority, RoleTurnHost, RoleTurnRequest } from "../host-contracts.ts";
|
|
12
|
+
import { prepareRoleEnvelope } from "../role-envelope.ts";
|
|
13
|
+
import type { RoleRuntimeDependencies } from "../role-runtime.ts";
|
|
14
|
+
import { createRoleRuntimeDependencies } from "../role-runtime-dependencies.ts";
|
|
15
|
+
import { createSessionIdentityAuthority } from "../session-identity.ts";
|
|
27
16
|
import { acpStdioArgs, resolveAcpBinary, type AcpHostDescription } from "./description.ts";
|
|
28
|
-
import {
|
|
29
|
-
|
|
17
|
+
import {
|
|
18
|
+
connectAcpStdio,
|
|
19
|
+
createAcpRoleTurnHost,
|
|
20
|
+
type AcpRoleTurnHostConfig,
|
|
21
|
+
} from "./role-turn-host.ts";
|
|
30
22
|
import { ensureSeatProfileSoul } from "./seat-profile-soul.ts";
|
|
31
|
-
import { createAcpSessionIdentityAuthority } from "./session-identity.ts";
|
|
32
23
|
|
|
33
24
|
export type ProductionAcpHostOptions = Readonly<{
|
|
34
25
|
packageRoot: string;
|
|
35
26
|
principalAuthority: DurablePrincipalAuthority;
|
|
36
27
|
description: AcpHostDescription;
|
|
28
|
+
/** Seat-table host key (e.g. grok-build). */
|
|
29
|
+
hostName: string;
|
|
37
30
|
}>;
|
|
38
31
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
loadJudgeSoul: () => loadMainRoleSessionMaterials("judge"),
|
|
53
|
-
loadFixerSoul: () => loadMainRoleSessionMaterials("fixer"),
|
|
54
|
-
loadFixPacket: (path) => readFile(path, "utf8"),
|
|
55
|
-
loadCoderSoul: () => loadMainRoleSessionMaterials("coder"),
|
|
56
|
-
loadCoderTask: (path) => readFile(path, "utf8"),
|
|
57
|
-
loadReviewerSoul: () => loadMainRoleSessionMaterials("reviewer"),
|
|
58
|
-
createReviewerPinnedGitReader: () => createReviewerPinnedGitReader(),
|
|
59
|
-
createReviewerIssueFetcher: () => createGhIssueSoftFetcher(),
|
|
60
|
-
loadCollectorSoul: () => loadMainRoleSessionMaterials("collector"),
|
|
61
|
-
loadCollectorHandbookSeed: () => readFile(collectorHandbookSeedPath, "utf8"),
|
|
62
|
-
createCollectorTransport: () => createGhCollectorGitHubTransport(),
|
|
63
|
-
loadDoctorSoul: () => loadMainRoleSessionMaterials("doctor"),
|
|
64
|
-
loadDoctorCase,
|
|
65
|
-
loadInspectorSoul: () => loadMainRoleSessionMaterials("inspector"),
|
|
66
|
-
loadGatekeeperSoul: () => loadGatekeeperSessionMaterials("gatekeeper"),
|
|
67
|
-
loadNavigatorSoul: () => loadMainRoleSessionMaterials("navigator"),
|
|
68
|
-
loadAuditorSoul: () => loadAuditorSoulFromSubjectInput(),
|
|
69
|
-
loadNotarySoul: () => loadMainRoleSessionMaterials("notary"),
|
|
70
|
-
loadCountersignSoul: () => loadMainRoleSessionMaterials("countersign"),
|
|
71
|
-
loadGleanerLeftSoul: () => loadMainRoleSessionMaterials("gleaner-left"),
|
|
72
|
-
loadDiaristSoul: () => loadMainRoleSessionMaterials("diarist"),
|
|
73
|
-
loadNotarySourceRun: loadNotarySourceRunLocator,
|
|
74
|
-
loadMergerSoul: () => loadMainRoleSessionMaterials("merger"),
|
|
75
|
-
loadMergerInput: async (path) => JSON.parse(await readFile(path, "utf8")),
|
|
76
|
-
createMergerGitState: (repositoryRoot) => createProductionMergerGitState(repositoryRoot),
|
|
77
|
-
async loadCanonicalSkillBinding(name) {
|
|
78
|
-
if (name === "tdd") {
|
|
79
|
-
return loadPackagedCanonicalSkillBinding(packageRoot, "tdd");
|
|
80
|
-
}
|
|
81
|
-
if (name === "code-review") {
|
|
82
|
-
return loadPackagedCanonicalSkillBinding(packageRoot, "code-review");
|
|
83
|
-
}
|
|
84
|
-
return loadHomeCanonicalSkillBinding(name);
|
|
85
|
-
},
|
|
86
|
-
// #590: doctor compliance still on disposeCompliance path; judge→auditor is gate queue (#756).
|
|
87
|
-
auditDoctorCompliance: (options) => doctorAuditor(options),
|
|
88
|
-
runReviewerDispatch: (dispatch, options) => reviewerAgent.run(dispatch, options),
|
|
89
|
-
shutdownReviewerAgent: () => reviewerAgent.shutdown(),
|
|
90
|
-
loadNavigatorWorkContext: (options) => loadNavigatorWorkContext({
|
|
91
|
-
context: options.context,
|
|
92
|
-
role: options.role,
|
|
93
|
-
...(options.getFlag === undefined ? {} : { getFlag: options.getFlag }),
|
|
94
|
-
}),
|
|
95
|
-
createNavigatorAttendance: (options) => createNavigatorAttendance({
|
|
96
|
-
context: options.context,
|
|
97
|
-
role: options.role,
|
|
98
|
-
phase: options.phase,
|
|
99
|
-
subjectKey: options.subjectKey,
|
|
100
|
-
subject: options.subject,
|
|
101
|
-
authority: options.authority,
|
|
102
|
-
invocationId: options.invocationId,
|
|
103
|
-
loadSoul: () => loadMainRoleSessionMaterials("navigator"),
|
|
104
|
-
loadRoutePlaybook: () => readFile(navigatorRoutePlaybookPath, "utf8"),
|
|
105
|
-
loadRoleHelp: async (role) => formatNavigatorRoleHelp(role),
|
|
106
|
-
createSession: navigatorSessionFactory,
|
|
107
|
-
...(options.contextError === undefined ? {} : { contextError: options.contextError }),
|
|
108
|
-
onEvent: options.onEvent,
|
|
32
|
+
function createComposedAcpRoleTurnHost(
|
|
33
|
+
config: Omit<AcpRoleTurnHostConfig, "prepare"> & {
|
|
34
|
+
readonly roleRuntimeDependencies: RoleRuntimeDependencies;
|
|
35
|
+
readonly socketPath?: (request: RoleTurnRequest) => string;
|
|
36
|
+
},
|
|
37
|
+
) {
|
|
38
|
+
return createAcpRoleTurnHost({
|
|
39
|
+
...config,
|
|
40
|
+
prepare: (request) => prepareRoleEnvelope({
|
|
41
|
+
request,
|
|
42
|
+
dependencies: config.roleRuntimeDependencies,
|
|
43
|
+
sessionFile: config.sessionIdentity.resolveSessionFile(request.principal),
|
|
44
|
+
socketPath: config.socketPath?.(request) ?? `/tmp/ak-acp-mcp-${randomUUID()}.sock`,
|
|
109
45
|
}),
|
|
110
|
-
};
|
|
46
|
+
});
|
|
111
47
|
}
|
|
112
48
|
|
|
113
49
|
/**
|
|
@@ -116,7 +52,7 @@ export function createAcpRoleRuntimeDependencies(packageRoot: string): RoleRunti
|
|
|
116
52
|
* is sitian-only.
|
|
117
53
|
*/
|
|
118
54
|
export function createProductionAcpRoleTurnHost(options: ProductionAcpHostOptions): RoleTurnHost {
|
|
119
|
-
const { packageRoot, principalAuthority, description } = options;
|
|
55
|
+
const { packageRoot, principalAuthority, description, hostName } = options;
|
|
120
56
|
const env: NodeJS.ProcessEnv = {
|
|
121
57
|
...process.env,
|
|
122
58
|
...description.childEnv,
|
|
@@ -124,10 +60,11 @@ export function createProductionAcpRoleTurnHost(options: ProductionAcpHostOption
|
|
|
124
60
|
};
|
|
125
61
|
|
|
126
62
|
return createComposedAcpRoleTurnHost({
|
|
127
|
-
|
|
63
|
+
hostName,
|
|
64
|
+
sessionIdentity: createSessionIdentityAuthority(principalAuthority, description.sessionBindingFile),
|
|
128
65
|
boundResume: description.boundResume,
|
|
129
66
|
modelPassing: description.modelPassing,
|
|
130
|
-
roleRuntimeDependencies:
|
|
67
|
+
roleRuntimeDependencies: createRoleRuntimeDependencies(packageRoot),
|
|
131
68
|
async connect(request) {
|
|
132
69
|
const seatProfile = description.seatProfileSoul;
|
|
133
70
|
const profileName = seatProfile === undefined
|