@akagilnc/pi-workflow-roles 0.1.1751
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/LICENSE +202 -0
- package/README.md +104 -0
- package/README.zh-CN.md +133 -0
- package/THIRD_PARTY_NOTICES.md +60 -0
- package/dist/activation-ledger-git.js +68 -0
- package/dist/activation-ledger-session.js +120 -0
- package/dist/activation-ledger-topology.js +239 -0
- package/dist/activation-reconciliation.js +61 -0
- package/dist/audit-escalation.js +108 -0
- package/dist/auditor-dossier-tool.js +35 -0
- package/dist/canonical-json.js +78 -0
- package/dist/compliance-transport.js +77 -0
- package/dist/doctor-contracts.js +172 -0
- package/dist/dossier-resolution.js +103 -0
- package/dist/evidence-child-executor.js +661 -0
- package/dist/exact-utf8.js +12 -0
- package/dist/git-object-id.js +7 -0
- package/dist/in-process-session.js +50 -0
- package/dist/merger-contracts.js +76 -0
- package/dist/navigator-attendance.js +995 -0
- package/dist/navigator-invocation-identity.js +220 -0
- package/dist/open-tool-schema.js +39 -0
- package/dist/package-contracts/collector-output.js +50 -0
- package/dist/package-contracts/fixer-output.js +72 -0
- package/dist/package-contracts/fixer-packet.js +77 -0
- package/dist/package-contracts/judge-output.js +17 -0
- package/dist/package-contracts/reviewer-output.js +82 -0
- package/dist/package-contracts/terminating-tools.js +173 -0
- package/dist/package-contracts/worker-output.js +13 -0
- package/dist/package-owned-tool-idle.js +104 -0
- package/dist/packaged-role-registry.js +34 -0
- package/dist/public-cli/main.js +23867 -0
- package/dist/public-command-renderer.js +20 -0
- package/dist/reviewer-agent.js +93 -0
- package/dist/reviewer-child-executor.js +23 -0
- package/dist/reviewer-construction.js +95 -0
- package/dist/reviewer-dispatch.js +77 -0
- package/dist/reviewer-execution-ledger.js +160 -0
- package/dist/reviewer-failure-diagnostic.js +17 -0
- package/dist/reviewer-git-snapshot.js +38 -0
- package/dist/reviewer-pinned-git.js +146 -0
- package/dist/reviewer-preflight-error.js +15 -0
- package/dist/reviewer-prompt-identity.js +10 -0
- package/dist/reviewer-scope-prompt.js +21 -0
- package/dist/reviewer-workspace.js +151 -0
- package/dist/sha256.js +5 -0
- package/dist/sitian-record-entry.js +33 -0
- package/dist/stderr-jsonl.js +26 -0
- package/dist/stream-idle-guard.js +75 -0
- package/dist/tool-execution-observation.js +141 -0
- package/dist/uuidv7.js +21 -0
- package/dist/work-subject-identity.js +53 -0
- package/extensions/role-runtime.ts +303 -0
- package/package.json +69 -0
- package/packets/fixer-prerequisites.json +6 -0
- package/packets/fixer-repair.md +5 -0
- package/packets/judge-apply.md +77 -0
- package/packets/judge-authority.md +64 -0
- package/packets/judge-plan.md +55 -0
- package/packets/judge-review.md +49 -0
- package/packets/judge-submission.md +34 -0
- package/resources/methods/code-review/SKILL.md +92 -0
- package/resources/methods/code-review/agents/openai.yaml +3 -0
- package/resources/methods/code-review/provenance.json +26 -0
- package/resources/methods/diagnosing-bugs/SKILL.md +134 -0
- package/resources/methods/diagnosing-bugs/agents/openai.yaml +3 -0
- package/resources/methods/diagnosing-bugs/provenance.json +31 -0
- package/resources/methods/diagnosing-bugs/scripts/hitl-loop.template.sh +41 -0
- package/resources/methods/resolving-merge-conflicts/SKILL.md +14 -0
- package/resources/methods/resolving-merge-conflicts/agents/openai.yaml +3 -0
- package/resources/methods/resolving-merge-conflicts/provenance.json +26 -0
- package/resources/methods/tdd/SKILL.md +38 -0
- package/resources/methods/tdd/agents/openai.yaml +3 -0
- package/resources/methods/tdd/mocking.md +59 -0
- package/resources/methods/tdd/provenance.json +36 -0
- package/resources/methods/tdd/tests.md +77 -0
- package/resources/navigator-route-playbook.md +32 -0
- package/schemas/tool-execution-observation.schema.json +107 -0
- package/scripts/build-package.mjs +65 -0
- package/scripts/generate-tool-execution-observation-schema.ts +7 -0
- package/souls/coder.md +10 -0
- package/souls/collector.md +11 -0
- package/souls/doctor-auditor.md +23 -0
- package/souls/doctor.md +8 -0
- package/souls/fixer-auditor.md +33 -0
- package/souls/fixer.md +13 -0
- package/souls/judge-auditor.md +33 -0
- package/souls/judge.md +74 -0
- package/souls/merger.md +5 -0
- package/souls/navigator.md +5 -0
- package/souls/reviewer-auditor.md +25 -0
- package/souls/reviewer.md +11 -0
- package/src/activation-ledger-git.ts +96 -0
- package/src/activation-ledger-session.ts +188 -0
- package/src/activation-ledger-topology.ts +301 -0
- package/src/activation-ledger.ts +240 -0
- package/src/activation-reconciliation.ts +163 -0
- package/src/activation-trace.ts +38 -0
- package/src/audit-escalation.ts +177 -0
- package/src/auditor-dossier-tool.ts +48 -0
- package/src/auditor-soul.ts +28 -0
- package/src/canonical-json.ts +74 -0
- package/src/canonical-skill-binding.ts +107 -0
- package/src/collector-config.ts +89 -0
- package/src/collector-evidence.ts +461 -0
- package/src/collector-github.ts +656 -0
- package/src/collector-identity.ts +161 -0
- package/src/collector-ledger.ts +827 -0
- package/src/collector-receipt.ts +87 -0
- package/src/collector-role.ts +592 -0
- package/src/collector-tool-schemas.ts +19 -0
- package/src/compliance-transport.ts +130 -0
- package/src/doctor-auditor.ts +53 -0
- package/src/doctor-contracts.ts +166 -0
- package/src/doctor-evidence.ts +47 -0
- package/src/doctor-role.ts +18 -0
- package/src/dossier-resolution.ts +137 -0
- package/src/evidence-child-executor.ts +775 -0
- package/src/exact-utf8.ts +9 -0
- package/src/factory-board.ts +1822 -0
- package/src/git-object-id.ts +11 -0
- package/src/human-format.ts +65 -0
- package/src/in-process-session.ts +78 -0
- package/src/judge-auditor.ts +55 -0
- package/src/judge-recording-anti-forge.ts +53 -0
- package/src/judge-role.ts +160 -0
- package/src/merger-contracts.ts +71 -0
- package/src/merger-git-state.ts +76 -0
- package/src/merger-role.ts +60 -0
- package/src/navigator-attendance.ts +1254 -0
- package/src/navigator-invocation-identity.ts +446 -0
- package/src/open-tool-schema.ts +46 -0
- package/src/package-contracts/collector-output.ts +109 -0
- package/src/package-contracts/fixer-output.ts +81 -0
- package/src/package-contracts/fixer-packet.ts +93 -0
- package/src/package-contracts/judge-output.ts +39 -0
- package/src/package-contracts/reviewer-output.ts +115 -0
- package/src/package-contracts/terminating-tools.ts +259 -0
- package/src/package-contracts/worker-output.ts +36 -0
- package/src/package-owned-tool-idle.ts +134 -0
- package/src/package-resources/method-skill-binding.ts +87 -0
- package/src/package-resources/method-skill.ts +358 -0
- package/src/packaged-role-registry.ts +36 -0
- package/src/public-cli/cli-errors.ts +11 -0
- package/src/public-cli/cli-io.ts +4 -0
- package/src/public-cli/cli.ts +912 -0
- package/src/public-cli/coder-run.ts +575 -0
- package/src/public-cli/collector-run.ts +375 -0
- package/src/public-cli/command-renderer.ts +8 -0
- package/src/public-cli/config.ts +346 -0
- package/src/public-cli/doctor-run.ts +355 -0
- package/src/public-cli/explicit-internal.ts +274 -0
- package/src/public-cli/fixer-run.ts +587 -0
- package/src/public-cli/host-pi-runtime.ts +112 -0
- package/src/public-cli/invocation.ts +1958 -0
- package/src/public-cli/judge-run.ts +507 -0
- package/src/public-cli/main.ts +15 -0
- package/src/public-cli/merger-run.ts +681 -0
- package/src/public-cli/public-run-credentials.ts +71 -0
- package/src/public-cli/registry.ts +153 -0
- package/src/public-cli/reviewer-run.ts +561 -0
- package/src/public-cli/run-lifecycle.ts +884 -0
- package/src/public-cli/settlement.ts +3765 -0
- package/src/public-cli/terminal.ts +325 -0
- package/src/public-command-renderer.ts +43 -0
- package/src/reviewer-agent.ts +94 -0
- package/src/reviewer-auditor.ts +53 -0
- package/src/reviewer-child-executor.ts +31 -0
- package/src/reviewer-construction.ts +137 -0
- package/src/reviewer-dispatch.ts +94 -0
- package/src/reviewer-execution-ledger.ts +206 -0
- package/src/reviewer-failure-diagnostic.ts +18 -0
- package/src/reviewer-git-snapshot.ts +53 -0
- package/src/reviewer-pinned-git.ts +144 -0
- package/src/reviewer-preflight-error.ts +14 -0
- package/src/reviewer-prompt-identity.ts +17 -0
- package/src/reviewer-role.ts +193 -0
- package/src/reviewer-scope-prompt.ts +24 -0
- package/src/reviewer-settlement.ts +63 -0
- package/src/reviewer-workspace.ts +111 -0
- package/src/role-runtime.ts +884 -0
- package/src/sha256.ts +6 -0
- package/src/sitian-record-entry.ts +57 -0
- package/src/stderr-jsonl.ts +28 -0
- package/src/stream-idle-guard.ts +98 -0
- package/src/ticket-snapshot.ts +662 -0
- package/src/ticket-trajectory.ts +1000 -0
- package/src/tool-execution-observation.ts +168 -0
- package/src/uuidv7.ts +1 -0
- package/src/work-subject-identity.ts +94 -0
- package/src/worker-role.ts +434 -0
- package/src/worker-submission-gates.ts +225 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared public-run credential seam: one owner for missing selected-provider
|
|
3
|
+
* detection, typed failure construction, pre-dispatch fail-closed payload, and
|
|
4
|
+
* post-run credential annotation. Role runners supply model/credential facts only.
|
|
5
|
+
*/
|
|
6
|
+
import {
|
|
7
|
+
missingPublicProviderCredential,
|
|
8
|
+
type CredentialProviders,
|
|
9
|
+
type SeatModelConfig,
|
|
10
|
+
} from "./config.ts";
|
|
11
|
+
import type { ExplicitInternalKnownFailure } from "./explicit-internal.ts";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Production-owned provider failure when the selected public seat provider has
|
|
15
|
+
* no configured credential. Cause/identity come from CredentialProviders, not
|
|
16
|
+
* stderr wording. Runner-supplied knownFailure still wins over this annotation.
|
|
17
|
+
*/
|
|
18
|
+
export function knownFailureForMissingProviderCredential(
|
|
19
|
+
model: SeatModelConfig | undefined,
|
|
20
|
+
credentials: CredentialProviders | undefined,
|
|
21
|
+
): ExplicitInternalKnownFailure | undefined {
|
|
22
|
+
if (model === undefined || credentials === undefined) return undefined;
|
|
23
|
+
// Only the public credential catalog is fail-closed here; offline/test providers
|
|
24
|
+
// are not represented in auth.json shape and must not be washed into MissingProviderCredential.
|
|
25
|
+
if (model.provider !== "openai-codex" && model.provider !== "xai") return undefined;
|
|
26
|
+
if (!missingPublicProviderCredential(model.provider, credentials)) {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
cause: "provider",
|
|
31
|
+
identity: {
|
|
32
|
+
name: "MissingProviderCredential",
|
|
33
|
+
code: model.provider,
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** Pre-dispatch fail-closed payload when selected public provider lacks credentials. */
|
|
39
|
+
export type MissingCredentialPreDispatchFailure = Readonly<{
|
|
40
|
+
timedOut: false;
|
|
41
|
+
code: 1;
|
|
42
|
+
stderr: string;
|
|
43
|
+
knownFailure: ExplicitInternalKnownFailure;
|
|
44
|
+
}>;
|
|
45
|
+
|
|
46
|
+
export function missingCredentialPreDispatchFailure(
|
|
47
|
+
model: SeatModelConfig | undefined,
|
|
48
|
+
credentials: CredentialProviders | undefined,
|
|
49
|
+
): MissingCredentialPreDispatchFailure | undefined {
|
|
50
|
+
const knownFailure = knownFailureForMissingProviderCredential(model, credentials);
|
|
51
|
+
if (knownFailure === undefined) return undefined;
|
|
52
|
+
return {
|
|
53
|
+
timedOut: false,
|
|
54
|
+
code: 1,
|
|
55
|
+
stderr: `Missing credential for provider ${String(knownFailure.identity?.code ?? "unknown")}`,
|
|
56
|
+
knownFailure,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Post-run credential annotation for the shared evidence-priority chain.
|
|
62
|
+
* Only annotates nonzero/timeout exits; never invents a credential failure on success.
|
|
63
|
+
*/
|
|
64
|
+
export function postRunMissingCredentialFailure(
|
|
65
|
+
result: Readonly<{ timedOut: boolean; code: number | null }>,
|
|
66
|
+
model: SeatModelConfig | undefined,
|
|
67
|
+
credentials: CredentialProviders | undefined,
|
|
68
|
+
): ExplicitInternalKnownFailure | undefined {
|
|
69
|
+
if (!(result.timedOut || result.code !== 0)) return undefined;
|
|
70
|
+
return knownFailureForMissingProviderCredential(model, credentials);
|
|
71
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed public CLI registry — sole source for discoverable commands, seats,
|
|
3
|
+
* and startup model candidates (ADR 0052 / #105).
|
|
4
|
+
*/
|
|
5
|
+
import {
|
|
6
|
+
PACKAGED_ROLE_REGISTRY,
|
|
7
|
+
type PackagedRole,
|
|
8
|
+
} from "../packaged-role-registry.ts";
|
|
9
|
+
|
|
10
|
+
/** Package-relative path of the Internal role entrypoint (explicit load only). */
|
|
11
|
+
export const INTERNAL_ROLE_ENTRYPOINT_RELATIVE = "extensions/role-runtime.ts" as const;
|
|
12
|
+
|
|
13
|
+
export const PUBLIC_CALLABLE_ROLES = PACKAGED_ROLE_REGISTRY.map(
|
|
14
|
+
(entry) => entry.role,
|
|
15
|
+
) as readonly PackagedRole[];
|
|
16
|
+
|
|
17
|
+
export type PublicCallableRole = (typeof PUBLIC_CALLABLE_ROLES)[number];
|
|
18
|
+
|
|
19
|
+
/** Automatic attendance seat — configurable, never a caller-selected command. */
|
|
20
|
+
export const AUTOMATIC_NAVIGATOR_SEAT = "navigator" as const;
|
|
21
|
+
|
|
22
|
+
export type PublicConfigurableSeat =
|
|
23
|
+
| PublicCallableRole
|
|
24
|
+
| typeof AUTOMATIC_NAVIGATOR_SEAT;
|
|
25
|
+
|
|
26
|
+
export const PUBLIC_CONFIGURABLE_SEATS = [
|
|
27
|
+
...PUBLIC_CALLABLE_ROLES,
|
|
28
|
+
AUTOMATIC_NAVIGATOR_SEAT,
|
|
29
|
+
] as const satisfies readonly PublicConfigurableSeat[];
|
|
30
|
+
|
|
31
|
+
export const PUBLIC_CLI_SUPPORT_COMMANDS = [
|
|
32
|
+
"roles",
|
|
33
|
+
"config",
|
|
34
|
+
"help",
|
|
35
|
+
"resume",
|
|
36
|
+
] as const;
|
|
37
|
+
|
|
38
|
+
export type PublicCliSupportCommand = (typeof PUBLIC_CLI_SUPPORT_COMMANDS)[number];
|
|
39
|
+
|
|
40
|
+
export type PublicThinkingLevel =
|
|
41
|
+
| "off"
|
|
42
|
+
| "minimal"
|
|
43
|
+
| "low"
|
|
44
|
+
| "medium"
|
|
45
|
+
| "high"
|
|
46
|
+
| "xhigh"
|
|
47
|
+
| "max";
|
|
48
|
+
|
|
49
|
+
export type ModelRef = {
|
|
50
|
+
provider: string;
|
|
51
|
+
model: string;
|
|
52
|
+
thinking: PublicThinkingLevel;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Package startup candidates (#11): Codex family first, then Grok 4.5.
|
|
57
|
+
* Selection among candidates is credential-driven at resolve time.
|
|
58
|
+
*/
|
|
59
|
+
const STARTUP_CANDIDATES: Record<PublicConfigurableSeat, readonly ModelRef[]> = {
|
|
60
|
+
judge: [
|
|
61
|
+
{ provider: "openai-codex", model: "gpt-5.6-sol", thinking: "high" },
|
|
62
|
+
{ provider: "xai", model: "grok-4.5", thinking: "high" },
|
|
63
|
+
],
|
|
64
|
+
reviewer: [
|
|
65
|
+
{ provider: "openai-codex", model: "gpt-5.6-sol", thinking: "medium" },
|
|
66
|
+
{ provider: "xai", model: "grok-4.5", thinking: "high" },
|
|
67
|
+
],
|
|
68
|
+
coder: [
|
|
69
|
+
{ provider: "openai-codex", model: "gpt-5.6-luna", thinking: "high" },
|
|
70
|
+
{ provider: "xai", model: "grok-4.5", thinking: "high" },
|
|
71
|
+
],
|
|
72
|
+
fixer: [
|
|
73
|
+
{ provider: "openai-codex", model: "gpt-5.6-luna", thinking: "high" },
|
|
74
|
+
{ provider: "xai", model: "grok-4.5", thinking: "high" },
|
|
75
|
+
],
|
|
76
|
+
collector: [
|
|
77
|
+
{ provider: "openai-codex", model: "gpt-5.6-luna", thinking: "high" },
|
|
78
|
+
{ provider: "xai", model: "grok-4.5", thinking: "high" },
|
|
79
|
+
],
|
|
80
|
+
doctor: [
|
|
81
|
+
{ provider: "openai-codex", model: "gpt-5.6-luna", thinking: "high" },
|
|
82
|
+
{ provider: "xai", model: "grok-4.5", thinking: "high" },
|
|
83
|
+
],
|
|
84
|
+
merger: [
|
|
85
|
+
{ provider: "openai-codex", model: "gpt-5.6-luna", thinking: "high" },
|
|
86
|
+
{ provider: "xai", model: "grok-4.5", thinking: "high" },
|
|
87
|
+
],
|
|
88
|
+
navigator: [
|
|
89
|
+
{ provider: "openai-codex", model: "gpt-5.6-luna", thinking: "medium" },
|
|
90
|
+
{ provider: "xai", model: "grok-4.5", thinking: "high" },
|
|
91
|
+
],
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export function publicStartupCandidates(
|
|
95
|
+
seat: PublicConfigurableSeat,
|
|
96
|
+
): readonly ModelRef[] {
|
|
97
|
+
return STARTUP_CANDIDATES[seat];
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export type HelpCapability =
|
|
101
|
+
| {
|
|
102
|
+
kind: "support";
|
|
103
|
+
name: PublicCliSupportCommand;
|
|
104
|
+
}
|
|
105
|
+
| {
|
|
106
|
+
kind: "role";
|
|
107
|
+
name: PublicCallableRole;
|
|
108
|
+
phases: readonly (string | null)[];
|
|
109
|
+
defaultPhase: string | null;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Typed help surface. Presentation formats these facts; tests must not assert
|
|
114
|
+
* exact help prose or layout (锚定宪法 / ADR 0016 / #105 AC).
|
|
115
|
+
*/
|
|
116
|
+
export function listHelpCapabilities(): readonly HelpCapability[] {
|
|
117
|
+
const support: HelpCapability[] = PUBLIC_CLI_SUPPORT_COMMANDS.map((name) => ({
|
|
118
|
+
kind: "support" as const,
|
|
119
|
+
name,
|
|
120
|
+
}));
|
|
121
|
+
const roles: HelpCapability[] = PACKAGED_ROLE_REGISTRY.map((entry) => {
|
|
122
|
+
const phases = entry.phases as readonly (string | null)[];
|
|
123
|
+
const defaultPhase =
|
|
124
|
+
phases.length === 1 && phases[0] === null
|
|
125
|
+
? null
|
|
126
|
+
: phases.includes("apply")
|
|
127
|
+
? "apply"
|
|
128
|
+
: (phases[0] ?? null);
|
|
129
|
+
return {
|
|
130
|
+
kind: "role" as const,
|
|
131
|
+
name: entry.role,
|
|
132
|
+
phases,
|
|
133
|
+
defaultPhase,
|
|
134
|
+
};
|
|
135
|
+
});
|
|
136
|
+
return [...support, ...roles];
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export function isPublicCallableRole(value: string): value is PublicCallableRole {
|
|
140
|
+
return (PUBLIC_CALLABLE_ROLES as readonly string[]).includes(value);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export function isPublicConfigurableSeat(
|
|
144
|
+
value: string,
|
|
145
|
+
): value is PublicConfigurableSeat {
|
|
146
|
+
return (PUBLIC_CONFIGURABLE_SEATS as readonly string[]).includes(value);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export function isPublicCliSupportCommand(
|
|
150
|
+
value: string,
|
|
151
|
+
): value is PublicCliSupportCommand {
|
|
152
|
+
return (PUBLIC_CLI_SUPPORT_COMMANDS as readonly string[]).includes(value);
|
|
153
|
+
}
|