@akagilnc/pi-workflow-roles 0.1.3572 → 0.1.3621
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 +20239 -10556
- package/dist/analyst-gate-cycles-read.js +387 -0
- package/dist/archivist-record-entry.js +22 -1
- package/dist/audit-escalation.js +6 -0
- package/dist/auditor-soul.js +74 -0
- package/dist/collector-config.js +86 -0
- package/dist/collector-evidence.js +316 -0
- package/dist/collector-github.js +527 -0
- package/dist/collector-ledger.js +853 -0
- package/dist/collector-tool-schemas.js +33 -0
- package/dist/compliance-transport.js +104 -52
- package/dist/diarist-mechanical.js +411 -0
- package/dist/diarist-ticket-resolution.js +177 -0
- package/dist/diarist.js +311 -0
- package/dist/doctor-auditor.js +25 -0
- package/dist/doctor-contracts.js +2 -0
- package/dist/doctor-evidence.js +142 -0
- package/dist/gatekeeper-role.js +104 -81
- package/dist/host-transition-prior-native.js +78 -0
- package/dist/institutional-resolution.js +1 -95
- package/dist/judge-auditor.js +26 -0
- package/dist/ledger-session-read.js +227 -0
- package/dist/merger-git-state.js +78 -0
- package/dist/navigator-attendance.js +15 -7
- package/dist/navigator-public-session.js +170 -0
- package/dist/navigator-session-contracts.js +36 -40
- package/dist/notary-source-run.js +122 -0
- package/dist/package-contracts/auditor-output.js +66 -0
- package/dist/package-contracts/evidence-child-output.js +34 -0
- package/dist/package-contracts/judge-output.js +2 -0
- package/dist/package-contracts/terminating-tools.js +25 -2
- package/dist/package-resources/method-skill.js +254 -0
- package/dist/packaged-role-registry.js +36 -0
- package/dist/pi/durable-principal.js +61 -0
- package/dist/pi/in-process-session.js +25 -6
- package/dist/pi/known-failure.js +52 -0
- package/dist/pi/role-turn-host.js +430 -0
- package/dist/public-cli/auto-resume.js +414 -0
- package/dist/public-cli/cli-errors.js +8 -0
- package/dist/public-cli/cli-io.js +1 -0
- package/dist/public-cli/command-renderer.js +5 -0
- package/dist/public-cli/doctor-run.js +84 -0
- package/dist/public-cli/inspector-run.js +136 -0
- package/dist/public-cli/instruction-seat-run.js +256 -0
- package/dist/public-cli/invocation.js +2225 -0
- package/dist/public-cli/judge-run.js +118 -0
- package/dist/public-cli/load-production-acp-host.js +40 -0
- package/dist/public-cli/main.js +1140 -652
- package/dist/public-cli/notary-run.js +161 -0
- package/dist/public-cli/option-definitions.js +1192 -0
- package/dist/public-cli/post-admission.js +667 -0
- package/dist/public-cli/public-run-credentials.js +49 -0
- package/dist/public-cli/registry.js +4 -1
- package/dist/public-cli/reviewer-dispatch-rejection.js +77 -0
- package/dist/public-cli/run-lifecycle.js +1344 -0
- package/dist/public-cli/seat-ticket-binding.js +113 -0
- package/dist/public-cli/settlement.js +3441 -0
- package/dist/public-cli/terminal.js +135 -0
- package/dist/public-cli/turn-request.js +25 -0
- package/dist/public-role-summons.js +301 -0
- package/dist/receipt-delivery-policy.js +10 -0
- package/dist/reviewer-child-executor.js +80 -8
- package/dist/reviewer-execution-ledger.js +2 -1
- package/dist/run-terminal-artifacts.js +195 -0
- package/dist/run-ticket-number.js +40 -0
- package/dist/session-assistant-usage.js +107 -0
- package/dist/shape-unreadable-failure.js +34 -0
- package/dist/submission-errors.js +3 -0
- package/dist/submission-ledger.js +388 -0
- package/dist/ticket-provenance-contracts.js +115 -0
- package/dist/ticket-provenance.js +340 -0
- package/extensions/role-runtime.ts +7 -0
- package/package.json +1 -1
- package/scripts/build-package.mjs +2 -1
- package/souls/doctor-auditor.md +1 -0
- package/souls/evidence-child.md +1 -0
- package/src/acp-host/production-host.ts +3 -0
- package/src/acp-host/role-envelope.ts +2 -2
- package/src/acp-host/role-turn-host.ts +9 -1
- package/src/analyst-gate-cycles-read.ts +37 -2
- package/src/archivist-record-entry.ts +45 -1
- package/src/audit-escalation.ts +17 -0
- package/src/auditor-role.ts +22 -0
- package/src/auditor-soul.ts +42 -0
- package/src/compliance-transport.ts +177 -66
- package/src/doctor-auditor.ts +10 -14
- package/src/doctor-contracts.ts +1 -0
- package/src/doctor-role.ts +2 -2
- package/src/evidence-child-role.ts +22 -0
- package/src/gatekeeper-pass-envelope.ts +109 -0
- package/src/gatekeeper-role.ts +145 -104
- package/src/host-contracts.ts +9 -1
- package/src/institutional-resolution.ts +8 -163
- package/src/judge-auditor.ts +10 -15
- package/src/judge-role.ts +8 -0
- package/src/navigator-attendance.ts +25 -9
- package/src/navigator-public-session.ts +217 -0
- package/src/navigator-session-contracts.ts +61 -54
- package/src/notary-source-run.ts +3 -1
- package/src/package-contracts/auditor-output.ts +82 -0
- package/src/package-contracts/evidence-child-output.ts +51 -0
- package/src/package-contracts/judge-output.ts +1 -0
- package/src/package-contracts/reviewer-output.ts +2 -2
- package/src/package-contracts/terminating-tools.ts +31 -1
- package/src/packaged-role-registry.ts +43 -0
- package/src/pi/adapter.ts +2 -1
- package/src/pi/in-process-session.ts +38 -12
- package/src/pi/role-turn-host.ts +34 -0
- package/src/public-cli/cli.ts +14 -6
- package/src/public-cli/instruction-seat-run.ts +289 -50
- package/src/public-cli/invocation.ts +66 -25
- package/src/public-cli/option-definitions.ts +61 -0
- package/src/public-cli/post-admission.ts +7 -1
- package/src/public-cli/registry.ts +4 -1
- package/src/public-cli/run-lifecycle.ts +22 -3
- package/src/public-cli/settlement.ts +120 -5
- package/src/public-cli/terminal.ts +2 -0
- package/src/public-role-summons.ts +431 -0
- package/src/receipt-delivery-policy.ts +10 -0
- package/src/reviewer-agent.ts +1 -1
- package/src/reviewer-child-executor.ts +114 -12
- package/src/reviewer-execution-ledger.ts +3 -2
- package/src/role-runtime.ts +158 -17
- package/src/session-assistant-usage.ts +119 -0
- package/src/session-opening-materials.ts +1 -1
- package/src/shape-unreadable-failure.ts +49 -0
- package/src/submission-errors.ts +3 -0
- package/dist/evidence-child-executor.js +0 -829
- package/src/evidence-child-executor.ts +0 -1140
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { engineSessionMaterialFromOptions } from "../package-resources/engine-material.js";
|
|
2
|
+
import { CliUsageError } from "./cli-errors.js";
|
|
3
|
+
import { admitJudgeInvocation, buildJudgeTransportPrompt, } from "./invocation.js";
|
|
4
|
+
import { resolveSeatTicketBinding } from "./seat-ticket-binding.js";
|
|
5
|
+
import { loadResumableJudgeRun, markRunAdmitted, buildResumeContinuationPrompt, } from "./run-lifecycle.js";
|
|
6
|
+
import { presentStructuralRejection, readEngineDetourInfrastructureFailure, trySettleJudgeTerminalResult, } from "./settlement.js";
|
|
7
|
+
import { projectRoleTurnRequest, } from "./turn-request.js";
|
|
8
|
+
import { runPostAdmissionResumable, runPostAdmissionSeatResume, resumeTurnRequestProjectionOptions, } from "./post-admission.js";
|
|
9
|
+
/** Project admitted invocation onto the host-neutral turn request. */
|
|
10
|
+
export function buildJudgeTurnRequest(admitted, options) {
|
|
11
|
+
return projectRoleTurnRequest(admitted, { activation: { role: "judge" } }, options);
|
|
12
|
+
}
|
|
13
|
+
function judgeAdapters() {
|
|
14
|
+
return {
|
|
15
|
+
trySettle: (admitted, authority) => trySettleJudgeTerminalResult(admitted, authority),
|
|
16
|
+
resolveRunnerKnownFailure: async ({ result, sessionFile }) => {
|
|
17
|
+
const infrastructureFailure = await readEngineDetourInfrastructureFailure(sessionFile);
|
|
18
|
+
return (result.knownFailure ??
|
|
19
|
+
(infrastructureFailure === undefined
|
|
20
|
+
? undefined
|
|
21
|
+
: {
|
|
22
|
+
cause: infrastructureFailure.cause,
|
|
23
|
+
diagnostic: infrastructureFailure.diagnostic,
|
|
24
|
+
...(infrastructureFailure.identity === undefined
|
|
25
|
+
? {}
|
|
26
|
+
: { identity: infrastructureFailure.identity }),
|
|
27
|
+
}));
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export async function runPublicJudge(argv, env, io, parseJudgeArgv) {
|
|
32
|
+
let admitted;
|
|
33
|
+
try {
|
|
34
|
+
const parsed = parseJudgeArgv(argv);
|
|
35
|
+
admitted = await admitJudgeInvocation({
|
|
36
|
+
home: env.home,
|
|
37
|
+
principalAuthority: env.principalAuthority,
|
|
38
|
+
cwd: env.cwd,
|
|
39
|
+
instruction: parsed.instruction,
|
|
40
|
+
attachmentPaths: parsed.attachmentPaths,
|
|
41
|
+
...(parsed.project === undefined ? {} : { project: parsed.project }),
|
|
42
|
+
...(env.createRunId === undefined ? {} : { createRunId: env.createRunId }),
|
|
43
|
+
...(env.model === undefined ? {} : { model: env.model }),
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
if (error instanceof CliUsageError) {
|
|
48
|
+
presentStructuralRejection(error, io);
|
|
49
|
+
return { exitCode: 2 };
|
|
50
|
+
}
|
|
51
|
+
throw error;
|
|
52
|
+
}
|
|
53
|
+
await markRunAdmitted(admitted, env.principalAuthority);
|
|
54
|
+
return await runPostAdmissionResumable({
|
|
55
|
+
admitted,
|
|
56
|
+
env,
|
|
57
|
+
io,
|
|
58
|
+
buildInitialRequest: () => buildJudgeTurnRequest(admitted, {
|
|
59
|
+
packageRoot: env.packageRoot,
|
|
60
|
+
home: env.home,
|
|
61
|
+
agentDir: env.agentDir,
|
|
62
|
+
...(env.model === undefined ? {} : { model: env.model }),
|
|
63
|
+
...(env.engine === undefined ? {} : { engine: env.engine }),
|
|
64
|
+
...(env.timeoutMs === undefined ? {} : { timeoutMs: env.timeoutMs }),
|
|
65
|
+
...(admitted.correlationId === undefined && env.correlationId === undefined
|
|
66
|
+
? {}
|
|
67
|
+
: { correlationId: admitted.correlationId ?? env.correlationId }),
|
|
68
|
+
continuation: {
|
|
69
|
+
kind: "initial",
|
|
70
|
+
prompt: buildJudgeTransportPrompt(admitted, engineSessionMaterialFromOptions({
|
|
71
|
+
...(env.engine === undefined ? {} : { engine: env.engine }),
|
|
72
|
+
packageRoot: env.packageRoot,
|
|
73
|
+
})),
|
|
74
|
+
},
|
|
75
|
+
}),
|
|
76
|
+
buildResumeRequest: () => buildJudgeTurnRequest(admitted, {
|
|
77
|
+
packageRoot: env.packageRoot,
|
|
78
|
+
home: env.home,
|
|
79
|
+
agentDir: env.agentDir,
|
|
80
|
+
...(env.model === undefined ? {} : { model: env.model }),
|
|
81
|
+
...(env.engine === undefined ? {} : { engine: env.engine }),
|
|
82
|
+
...(env.timeoutMs === undefined ? {} : { timeoutMs: env.timeoutMs }),
|
|
83
|
+
...(admitted.correlationId === undefined && env.correlationId === undefined
|
|
84
|
+
? {}
|
|
85
|
+
: { correlationId: admitted.correlationId ?? env.correlationId }),
|
|
86
|
+
continuation: {
|
|
87
|
+
kind: "resume",
|
|
88
|
+
prompt: buildResumeContinuationPrompt({
|
|
89
|
+
packageRoot: env.packageRoot,
|
|
90
|
+
...(env.engine === undefined ? {} : { engine: env.engine }),
|
|
91
|
+
}),
|
|
92
|
+
},
|
|
93
|
+
}),
|
|
94
|
+
adapters: {
|
|
95
|
+
...judgeAdapters(),
|
|
96
|
+
beforeDispatch: async (admittedSeat) => {
|
|
97
|
+
await resolveSeatTicketBinding(admittedSeat, env);
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
...(env.engine === undefined ? {} : { effectiveEngine: env.engine }),
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Resume a previously admitted Role run after a typed HTTP 429 interruption.
|
|
105
|
+
* Restores role/project/instruction/attachments/session identity; model override
|
|
106
|
+
* is temporary for this invocation only.
|
|
107
|
+
*/
|
|
108
|
+
export async function runPublicResume(request, env, io) {
|
|
109
|
+
return await runPostAdmissionSeatResume({
|
|
110
|
+
request,
|
|
111
|
+
env,
|
|
112
|
+
io,
|
|
113
|
+
load: (effective) => loadResumableJudgeRun(env.home, effective.runId, env.principalAuthority),
|
|
114
|
+
buildTurnRequest: (admitted, effective) => buildJudgeTurnRequest(admitted, resumeTurnRequestProjectionOptions(admitted, effective, env)),
|
|
115
|
+
adapters: judgeAdapters(),
|
|
116
|
+
...(env.engine === undefined ? {} : { effectiveEngine: env.engine }),
|
|
117
|
+
});
|
|
118
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
return path;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Deferred loader for the packaged generic ACP RoleTurnHost factory.
|
|
11
|
+
*
|
|
12
|
+
* Public ak-role bin must not statically value-import the production host (or its
|
|
13
|
+
* role-runtime / pi-coding-agent edges). Specifier is runtime-constructed so
|
|
14
|
+
* esbuild leaves this import external (ADR 0052 discovery stays peer-free).
|
|
15
|
+
*
|
|
16
|
+
* Host selection is a description-table lookup: the row for the seat's host key
|
|
17
|
+
* is the factory input. There is no host-name fork here.
|
|
18
|
+
*/
|
|
19
|
+
import { existsSync } from "node:fs";
|
|
20
|
+
import { join } from "node:path";
|
|
21
|
+
import { pathToFileURL } from "node:url";
|
|
22
|
+
import { lookupHostDescription } from "../host-descriptions.js";
|
|
23
|
+
/**
|
|
24
|
+
* Resolve the production ACP host factory for one registered host key without a
|
|
25
|
+
* static graph edge into the public CLI bundle.
|
|
26
|
+
*/
|
|
27
|
+
export async function loadProductionAcpHostFactory(packageRoot, host) {
|
|
28
|
+
const description = lookupHostDescription(host);
|
|
29
|
+
if (description === undefined) {
|
|
30
|
+
throw new Error(`unregistered host: ${host}`);
|
|
31
|
+
}
|
|
32
|
+
const built = join(packageRoot, "dist/acp-host/production-host.js");
|
|
33
|
+
const source = join(packageRoot, "src/acp-host/production-host.ts");
|
|
34
|
+
// Prefer the built artifact (plain node); fall back to source under tsx tests.
|
|
35
|
+
const target = existsSync(built) ? built : source;
|
|
36
|
+
const href = pathToFileURL(target).href;
|
|
37
|
+
const mod = (await import(__rewriteRelativeImportExtension(href)));
|
|
38
|
+
const create = mod.createProductionAcpRoleTurnHost;
|
|
39
|
+
return (options) => create({ ...options, description });
|
|
40
|
+
}
|