@akagilnc/pi-workflow-roles 0.1.5842 → 0.1.5853

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.
Files changed (67) hide show
  1. package/README.md +4 -4
  2. package/README.zh-CN.md +4 -4
  3. package/dist/acp-host/production-host.js +348 -1254
  4. package/dist/acp-host/role-turn-host.js +4 -98
  5. package/dist/headless-host/production-host.js +15731 -16582
  6. package/dist/headless-host/role-turn-host.js +6 -31
  7. package/dist/migrate-book-topology.js +31 -16
  8. package/dist/navigator-attendance.js +54 -404
  9. package/dist/navigator-invocation-identity.js +0 -2
  10. package/dist/navigator-lookup-host.js +41 -0
  11. package/dist/navigator-lookup.js +68 -0
  12. package/dist/navigator-route-table.js +42 -0
  13. package/dist/package-contracts/navigator-output.js +3 -11
  14. package/dist/packaged-role-registry.js +3 -27
  15. package/dist/public-cli/instruction-seat-run.js +4 -1
  16. package/dist/public-cli/invocation.js +13 -26
  17. package/dist/public-cli/main.js +286 -114
  18. package/dist/public-cli/option-definitions.js +24 -4
  19. package/dist/public-cli/post-admission.js +0 -9
  20. package/dist/public-cli/role-seat-runtime.js +14 -0
  21. package/dist/public-cli/settlement.js +14 -40
  22. package/dist/public-cli/terminal.js +1 -8
  23. package/dist/public-cli/turn-request.js +0 -3
  24. package/dist/public-role-summons.js +0 -1
  25. package/dist/receipt-delivery-policy.js +0 -23
  26. package/dist/role-runtime-dependencies.js +4 -11
  27. package/dist/role-runtime.js +18 -194
  28. package/dist/submission-ledger.js +19 -15
  29. package/dist/ticket-progress.js +23 -5
  30. package/extensions/role-runtime.ts +0 -16
  31. package/package.json +1 -1
  32. package/scripts/build-package.mjs +3 -7
  33. package/souls/notary.md +1 -1
  34. package/src/acp-host/role-turn-host.ts +8 -97
  35. package/src/headless-host/description.ts +0 -2
  36. package/src/headless-host/role-turn-host.ts +7 -32
  37. package/src/host-contracts.ts +5 -7
  38. package/src/navigator-attendance.ts +86 -549
  39. package/src/navigator-invocation-identity.ts +0 -2
  40. package/src/navigator-lookup-host.ts +45 -0
  41. package/src/navigator-lookup.ts +98 -0
  42. package/src/navigator-route-table.ts +92 -0
  43. package/src/package-contracts/navigator-output.ts +4 -15
  44. package/src/packaged-role-registry.ts +3 -32
  45. package/src/public-cli/instruction-seat-run.ts +3 -0
  46. package/src/public-cli/invocation.ts +18 -30
  47. package/src/public-cli/option-definitions.ts +25 -4
  48. package/src/public-cli/post-admission.ts +0 -11
  49. package/src/public-cli/role-seat-runtime.ts +14 -0
  50. package/src/public-cli/settlement.ts +23 -51
  51. package/src/public-cli/terminal.ts +3 -18
  52. package/src/public-cli/turn-request.ts +0 -5
  53. package/src/public-role-summons.ts +0 -8
  54. package/src/receipt-delivery-policy.ts +0 -21
  55. package/src/role-runtime-dependencies.ts +4 -11
  56. package/src/role-runtime.ts +19 -210
  57. package/src/submission-ledger.ts +23 -16
  58. package/src/ticket-progress.ts +32 -5
  59. package/dist/navigator-public-session.js +0 -205
  60. package/dist/navigator-role.js +0 -6
  61. package/dist/navigator-session-contracts.js +0 -227
  62. package/dist/navigator-work-context.js +0 -72
  63. package/resources/navigator-route-playbook.md +0 -33
  64. package/src/navigator-public-session.ts +0 -305
  65. package/src/navigator-role.ts +0 -15
  66. package/src/navigator-session-contracts.ts +0 -320
  67. package/src/navigator-work-context.ts +0 -97
@@ -1,97 +0,0 @@
1
- /**
2
- * Host-neutral Navigator work-context loader (#590 / #1187).
3
- * Auto prepare is identity-only: subjectKey + provenance. No parent dispatch,
4
- * role-input bytes, or work-root authority files are loaded as materials.
5
- * Flag/input resolution is supplied by the host; no ExtensionAPI dependency.
6
- */
7
- import { resolve } from "node:path";
8
-
9
- import { sessionDirectoryOf } from "./role-run-placement.ts";
10
-
11
- import { runDirectoryFromHostContext, type HostContext } from "./host-contracts.ts";
12
- import {
13
- navigatorSubjectKeyForInput,
14
- navigatorUnavailableError,
15
- subjectPath,
16
- type NavigatorSubjectProvenance,
17
- type NavigatorWorkContext,
18
- } from "./navigator-attendance.ts";
19
- import { packagedNavigatorSubject, packagedRoleInputFlag } from "./packaged-role-registry.ts";
20
- import { loadAdmittedJudgeRequest } from "./public-cli/invocation.ts";
21
-
22
- export type NavigatorWorkContextLoaderOptions = {
23
- context: HostContext;
24
- role: string;
25
- /** Host flag reader for role input paths (Pi getFlag / grok activation flags). */
26
- getFlag?: (name: string) => unknown;
27
- };
28
-
29
- function navigatorInputReference(
30
- getFlag: ((name: string) => unknown) | undefined,
31
- role: string,
32
- ): string | undefined {
33
- if (getFlag === undefined) return undefined;
34
- const name = packagedRoleInputFlag(role);
35
- const value = name === undefined ? undefined : getFlag(name);
36
- return typeof value === "string" && value !== "" ? resolve(value) : undefined;
37
- }
38
-
39
- /**
40
- * Resolve typed Navigator work context from host flags and/or the public admitted request.
41
- * Returns identity (subjectKey + provenance) only — auto prepare does not consume materials.
42
- */
43
- export async function loadNavigatorWorkContext(
44
- options: NavigatorWorkContextLoaderOptions,
45
- ): Promise<NavigatorWorkContext> {
46
- const reference = navigatorInputReference(options.getFlag, options.role);
47
- const subjectMode = packagedNavigatorSubject(options.role);
48
- const subjectRoot = subjectPath(reference ?? options.context.sessionManager.getSessionDir(), options.context.cwd);
49
- const subjectKey = reference === undefined
50
- ? subjectRoot
51
- : navigatorSubjectKeyForInput(subjectRoot, reference, options.context.cwd);
52
-
53
- // Public ak-role run: admitted request decides empty vs concrete identity.
54
- const publicRunDir = runDirectoryFromHostContext(options.context);
55
- const currentSessionDir = options.context.sessionManager.getSessionDir();
56
- const isBoundPublicRun = publicRunDir !== undefined
57
- && resolve(currentSessionDir) === resolve(sessionDirectoryOf(publicRunDir));
58
- if (subjectMode === "public-instruction" && isBoundPublicRun) {
59
- // Control-plane read faults keep their real cause inside context-error (#1187 F2).
60
- // Only true absence / wrong-shape is undefined → generic missing message.
61
- let admitted;
62
- try {
63
- admitted = await loadAdmittedJudgeRequest(publicRunDir);
64
- } catch (error) {
65
- throw navigatorUnavailableError("context", error);
66
- }
67
- if (admitted === undefined) {
68
- throw navigatorUnavailableError(
69
- "context",
70
- new Error("public Judge admitted request was missing or malformed"),
71
- );
72
- }
73
- if (!admitted.instructionEmpty && admitted.instruction.trim() !== "") {
74
- // #1187: non-empty public admission starts parallel prepare by identity.
75
- // Parent instruction remains the parent role's own dispatch; auto navigator
76
- // does not receive that prose (or a duplicate authority copy) as material.
77
- return {
78
- subjectKey: subjectRoot,
79
- subjectProvenance: "role_input",
80
- };
81
- }
82
- return {
83
- subjectKey: subjectRoot,
84
- subjectProvenance: "placeholder",
85
- };
86
- }
87
-
88
- // Concrete role-input path (file/case/source-run flag) is identity enough to start prepare.
89
- // Navigator reads ticket and station records itself when needed — no material copy here.
90
- if (reference !== undefined) {
91
- return { subjectKey, subjectProvenance: "role_input" satisfies NavigatorSubjectProvenance };
92
- }
93
- return {
94
- subjectKey: subjectRoot,
95
- subjectProvenance: "placeholder",
96
- };
97
- }