@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,161 @@
|
|
|
1
|
+
import { NotarySourceRunError, resolveNotarySourceRunLocator, } from "../notary-source-run.js";
|
|
2
|
+
import { engineSessionMaterialFromOptions } from "../package-resources/engine-material.js";
|
|
3
|
+
import { readRunTicketNumber } from "../run-ticket-number.js";
|
|
4
|
+
import { CliUsageError } from "./cli-errors.js";
|
|
5
|
+
import { admitNotaryInvocation, buildNotaryTransportPrompt, } from "./invocation.js";
|
|
6
|
+
import { tryResumeSameTicketSeatRun } from "./seat-ticket-binding.js";
|
|
7
|
+
import { runPostAdmissionOneShot, runPostAdmissionSeatResume, resumeTurnRequestProjectionOptions, } from "./post-admission.js";
|
|
8
|
+
import { loadResumableNotaryRun, markRunAdmitted, } from "./run-lifecycle.js";
|
|
9
|
+
import { presentStructuralRejection, trySettleNotaryTerminalResult, } from "./settlement.js";
|
|
10
|
+
import { projectRoleTurnRequest, } from "./turn-request.js";
|
|
11
|
+
/** Project admitted invocation onto the host-neutral turn request. */
|
|
12
|
+
export function buildNotaryTurnRequest(admitted, options) {
|
|
13
|
+
return projectRoleTurnRequest(admitted, {
|
|
14
|
+
activation: {
|
|
15
|
+
role: "notary",
|
|
16
|
+
sourceRun: admitted.sourceRunPath,
|
|
17
|
+
// Ticket from source-run admitted form rides activation → flag → role read surface (#635).
|
|
18
|
+
...(admitted.ticketNumber === undefined
|
|
19
|
+
? {}
|
|
20
|
+
: { ticketNumber: admitted.ticketNumber }),
|
|
21
|
+
},
|
|
22
|
+
}, options);
|
|
23
|
+
}
|
|
24
|
+
export async function runPublicNotary(argv, env, io, parseNotaryArgv) {
|
|
25
|
+
let parsed;
|
|
26
|
+
try {
|
|
27
|
+
parsed = parseNotaryArgv(argv);
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
if (error instanceof CliUsageError) {
|
|
31
|
+
presentStructuralRejection(error, io);
|
|
32
|
+
return { exitCode: 2 };
|
|
33
|
+
}
|
|
34
|
+
throw error;
|
|
35
|
+
}
|
|
36
|
+
// #637: same ticket → resume prior notary run with this summons' source-run pointer.
|
|
37
|
+
// Source-run structural failures stay usage rejections; lookup/resume failures surface
|
|
38
|
+
// (no bare catch→fresh). Only true absence of a prior run mints new.
|
|
39
|
+
const projectRoot = parsed.project ?? env.cwd;
|
|
40
|
+
let source;
|
|
41
|
+
try {
|
|
42
|
+
source = await resolveNotarySourceRunLocator({
|
|
43
|
+
projectRoot,
|
|
44
|
+
sourceRun: parsed.sourceRun,
|
|
45
|
+
home: env.home,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
if (error instanceof NotarySourceRunError) {
|
|
50
|
+
presentStructuralRejection(new CliUsageError(error.message, { cause: error }), io);
|
|
51
|
+
return { exitCode: 2 };
|
|
52
|
+
}
|
|
53
|
+
throw error;
|
|
54
|
+
}
|
|
55
|
+
const ticketNumber = await readRunTicketNumber(source.runDirectory);
|
|
56
|
+
if (ticketNumber !== undefined) {
|
|
57
|
+
const summons = {
|
|
58
|
+
sourceRunPath: source.runDirectory,
|
|
59
|
+
sourceRun: source,
|
|
60
|
+
};
|
|
61
|
+
const resumed = await tryResumeSameTicketSeatRun({
|
|
62
|
+
home: env.home,
|
|
63
|
+
projectRoot,
|
|
64
|
+
role: "notary",
|
|
65
|
+
ticketNumber,
|
|
66
|
+
freshSummons: env.freshSummons,
|
|
67
|
+
summons,
|
|
68
|
+
resume: (runId, materials) => runPublicNotaryResume({ runId, ...(materials === undefined ? {} : { summons: materials }) }, env, io),
|
|
69
|
+
});
|
|
70
|
+
if (resumed !== undefined)
|
|
71
|
+
return resumed;
|
|
72
|
+
}
|
|
73
|
+
let admitted;
|
|
74
|
+
try {
|
|
75
|
+
admitted = await admitNotaryInvocation({
|
|
76
|
+
home: env.home,
|
|
77
|
+
principalAuthority: env.principalAuthority,
|
|
78
|
+
cwd: env.cwd,
|
|
79
|
+
sourceRun: parsed.sourceRun,
|
|
80
|
+
...(parsed.project === undefined ? {} : { project: parsed.project }),
|
|
81
|
+
...(env.createRunId === undefined ? {} : { createRunId: env.createRunId }),
|
|
82
|
+
...(env.model === undefined ? {} : { model: env.model }),
|
|
83
|
+
...(env.correlationId === undefined ? {} : { correlationId: env.correlationId }),
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
if (error instanceof CliUsageError) {
|
|
88
|
+
presentStructuralRejection(error, io);
|
|
89
|
+
return { exitCode: 2 };
|
|
90
|
+
}
|
|
91
|
+
throw error;
|
|
92
|
+
}
|
|
93
|
+
await markRunAdmitted(admitted, env.principalAuthority);
|
|
94
|
+
const engineMaterial = engineSessionMaterialFromOptions({
|
|
95
|
+
...(env.engine === undefined ? {} : { engine: env.engine }),
|
|
96
|
+
packageRoot: env.packageRoot,
|
|
97
|
+
});
|
|
98
|
+
const turnRequest = buildNotaryTurnRequest(admitted, {
|
|
99
|
+
packageRoot: env.packageRoot,
|
|
100
|
+
home: env.home,
|
|
101
|
+
agentDir: env.agentDir,
|
|
102
|
+
...(env.model === undefined ? {} : { model: env.model }),
|
|
103
|
+
...(env.engine === undefined ? {} : { engine: env.engine }),
|
|
104
|
+
...(env.timeoutMs === undefined ? {} : { timeoutMs: env.timeoutMs }),
|
|
105
|
+
...(env.correlationId === undefined || env.correlationId.trim() === ""
|
|
106
|
+
? {}
|
|
107
|
+
: { correlationId: env.correlationId }),
|
|
108
|
+
continuation: {
|
|
109
|
+
kind: "initial",
|
|
110
|
+
prompt: buildNotaryTransportPrompt(admitted, engineMaterial),
|
|
111
|
+
},
|
|
112
|
+
});
|
|
113
|
+
return await runPostAdmissionOneShot({
|
|
114
|
+
admitted,
|
|
115
|
+
env,
|
|
116
|
+
io,
|
|
117
|
+
request: turnRequest,
|
|
118
|
+
adapters: notaryAdapters(),
|
|
119
|
+
...(env.engine === undefined ? {} : { effectiveEngine: env.engine }),
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
function notaryAdapters() {
|
|
123
|
+
return {
|
|
124
|
+
trySettle: (admitted, authority, scope) => trySettleNotaryTerminalResult(admitted, authority, scope),
|
|
125
|
+
// Accepted receipts and failure terminals both present via shared path.
|
|
126
|
+
shouldPresentSettled: () => true,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Resume a previously admitted Notary run (#633 / #637). Manual resume restores
|
|
131
|
+
* source-run from the durable admitted request. Same-ticket re-summons deliver
|
|
132
|
+
* this turn's source-run activation pointer while reopening the same session.
|
|
133
|
+
*/
|
|
134
|
+
export async function runPublicNotaryResume(request, env, io) {
|
|
135
|
+
return await runPostAdmissionSeatResume({
|
|
136
|
+
request,
|
|
137
|
+
env,
|
|
138
|
+
io,
|
|
139
|
+
load: async (effective) => {
|
|
140
|
+
if (effective.message !== undefined) {
|
|
141
|
+
throw new CliUsageError("notary rejects caller prompt/instruction; only zero caller-prompt continuation admitted");
|
|
142
|
+
}
|
|
143
|
+
const loaded = await loadResumableNotaryRun(env.home, effective.runId, env.principalAuthority);
|
|
144
|
+
const summons = effective.summons;
|
|
145
|
+
if (summons?.sourceRunPath !== undefined &&
|
|
146
|
+
summons.sourceRun !== undefined) {
|
|
147
|
+
return {
|
|
148
|
+
admitted: {
|
|
149
|
+
...loaded.admitted,
|
|
150
|
+
sourceRunPath: summons.sourceRunPath,
|
|
151
|
+
sourceRun: summons.sourceRun,
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
return loaded;
|
|
156
|
+
},
|
|
157
|
+
buildTurnRequest: (admitted, effective) => buildNotaryTurnRequest(admitted, resumeTurnRequestProjectionOptions(admitted, effective, env)),
|
|
158
|
+
adapters: notaryAdapters(),
|
|
159
|
+
...(env.engine === undefined ? {} : { effectiveEngine: env.engine }),
|
|
160
|
+
});
|
|
161
|
+
}
|