@akagilnc/pi-workflow-roles 0.1.5671 → 0.1.5679

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.
@@ -7952,22 +7952,18 @@ async function materializeCountersignInvocation(admitted, options) {
7952
7952
  );
7953
7953
  }
7954
7954
  async function loadAdmittedJudgeRequest(runDirectory) {
7955
- try {
7956
- const record = readPageSync(runDirectory, "admitted");
7957
- if (record === void 0) return void 0;
7958
- if (!packagedPublicInstructionSubject(record.role)) return void 0;
7959
- if (typeof record.instruction !== "string") return void 0;
7960
- if (typeof record.instructionEmpty !== "boolean") return void 0;
7961
- if (!Array.isArray(record.attachments)) return void 0;
7962
- const attachments = record.attachments.map((item) => normalizeAdmittedAttachment(item)).filter((item) => item !== void 0);
7963
- return {
7964
- instruction: record.instruction,
7965
- instructionEmpty: record.instructionEmpty,
7966
- attachments
7967
- };
7968
- } catch {
7969
- return void 0;
7970
- }
7955
+ const record = readPageSync(runDirectory, "admitted");
7956
+ if (record === void 0) return void 0;
7957
+ if (!packagedPublicInstructionSubject(record.role)) return void 0;
7958
+ if (typeof record.instruction !== "string") return void 0;
7959
+ if (typeof record.instructionEmpty !== "boolean") return void 0;
7960
+ if (!Array.isArray(record.attachments)) return void 0;
7961
+ const attachments = record.attachments.map((item) => normalizeAdmittedAttachment(item)).filter((item) => item !== void 0);
7962
+ return {
7963
+ instruction: record.instruction,
7964
+ instructionEmpty: record.instructionEmpty,
7965
+ attachments
7966
+ };
7971
7967
  }
7972
7968
  function parsePositivePrOption(raw) {
7973
7969
  if (raw === void 0 || raw.trim() === "") throw new CliUsageError("--pr requires a positive pull request number");
@@ -10058,8 +10054,10 @@ function buildPiTurnExtraArgs(request, authority, extraPiArgs = []) {
10058
10054
  // Envelope assembly = projectActivationFlags; pi only renders argv pairs.
10059
10055
  ...activationFlagsToPiArgv(projectActivationFlags(request)),
10060
10056
  ...piEngineModelArgs(request),
10057
+ // #1182: text single-shot keeps pi's native assistant error/aborted
10058
+ // exit (stderr + exit 1). json mode never takes that failure branch.
10061
10059
  "--mode",
10062
- "json",
10060
+ "text",
10063
10061
  ...buildSeatModelCliArgs(request.model)
10064
10062
  ];
10065
10063
  }
@@ -21570,11 +21568,6 @@ init_navigator_output();
21570
21568
  init_sha256();
21571
21569
  init_unknown_value();
21572
21570
  var NAVIGATOR_EVENT_TYPE = "ak-navigator-attendance";
21573
- function resolveNavigatorAuthorityMaterial(roleInput, fileAuthority) {
21574
- if (roleInput !== void 0 && roleInput.trim() !== "") return roleInput;
21575
- if (fileAuthority !== void 0 && fileAuthority.trim() !== "") return fileAuthority;
21576
- return void 0;
21577
- }
21578
21571
  var NAVIGATOR_TARGETS = PACKAGED_ROLE_REGISTRY.map(({ role, phases }) => ({ role, phases }));
21579
21572
  var prepareSchema = navigatorAdviceBodySchema;
21580
21573
  var INVOCATION_ENTRY = NAVIGATOR_INVOCATION_ENTRY;
@@ -21649,8 +21642,6 @@ function createNavigatorAttendance(options) {
21649
21642
  let sessionReady;
21650
21643
  let session;
21651
21644
  let subjectKey = options.subjectKey;
21652
- let subject = options.subject;
21653
- let authority = options.authority;
21654
21645
  let contextError = options.contextError;
21655
21646
  let preparedAdvice;
21656
21647
  const invocationPrincipal = options.invocationId ?? mintNavigatorInvocationId();
@@ -21679,12 +21670,6 @@ function createNavigatorAttendance(options) {
21679
21670
  };
21680
21671
  const loadMaterialsAndSession = async (invocationId) => {
21681
21672
  if (contextError !== void 0) throw navigatorUnavailableError("context", contextError);
21682
- if (typeof authority !== "string" || authority.trim() === "") {
21683
- throw navigatorUnavailableError(
21684
- "context",
21685
- new Error("controlling authority content was not supplied as typed work context")
21686
- );
21687
- }
21688
21673
  const modelPromise = (async () => {
21689
21674
  try {
21690
21675
  const resolved = await resolveNavigatorSeatSelection(options.context);
@@ -21770,9 +21755,7 @@ function createNavigatorAttendance(options) {
21770
21755
  role: options.role,
21771
21756
  phase: options.phase,
21772
21757
  invocationId,
21773
- subjectKey,
21774
- subject,
21775
- authority
21758
+ subjectKey
21776
21759
  });
21777
21760
  try {
21778
21761
  try {
@@ -21849,8 +21832,6 @@ function createNavigatorAttendance(options) {
21849
21832
  closing2 = previous.dispose();
21850
21833
  }
21851
21834
  subjectKey = next.subjectKey;
21852
- subject = next.subject;
21853
- authority = next.authority;
21854
21835
  contextError = next.contextError;
21855
21836
  return closing2;
21856
21837
  },
@@ -23233,12 +23214,8 @@ function createRoleRuntimeExtension(dependencies, deliveryRequestLimit) {
23233
23214
  if (subject !== "") {
23234
23215
  const root = subjectPath(ctx.sessionManager.getSessionDir(), ctx.cwd);
23235
23216
  const subjectProvenance = "user_prompt";
23236
- const priorAuthority = navigatorWorkContext.authority;
23237
- const authority = typeof priorAuthority === "string" && priorAuthority.trim() !== "" ? priorAuthority : subject;
23238
23217
  navigatorWorkContext = {
23239
23218
  subjectKey: navigatorSubjectKey(root, subject, subjectProvenance),
23240
- subject,
23241
- authority,
23242
23219
  subjectProvenance
23243
23220
  };
23244
23221
  await navigatorAttendance.setWorkContext(navigatorWorkContext);
@@ -23680,7 +23657,7 @@ function createRoleRuntimeExtension(dependencies, deliveryRequestLimit) {
23680
23657
  if (dependencies.loadNavigatorWorkContext === void 0) {
23681
23658
  const fallbackSubjectKey = subjectPath(ctx.sessionManager.getSessionDir(), ctx.cwd);
23682
23659
  contextError = new Error("Navigator work context loader is not configured");
23683
- work = { subjectKey: fallbackSubjectKey, subject: `work subject: ${fallbackSubjectKey}`, authority: "", subjectProvenance: "placeholder" };
23660
+ work = { subjectKey: fallbackSubjectKey, subjectProvenance: "placeholder" };
23684
23661
  } else {
23685
23662
  try {
23686
23663
  work = await dependencies.loadNavigatorWorkContext({
@@ -23693,7 +23670,7 @@ function createRoleRuntimeExtension(dependencies, deliveryRequestLimit) {
23693
23670
  } catch (error) {
23694
23671
  contextError = navigatorUnavailableError("context", error);
23695
23672
  const fallbackSubjectKey = subjectPath(ctx.sessionManager.getSessionDir(), ctx.cwd);
23696
- work = { subjectKey: fallbackSubjectKey, subject: `work subject: ${fallbackSubjectKey}`, authority: "", subjectProvenance: "placeholder" };
23673
+ work = { subjectKey: fallbackSubjectKey, subjectProvenance: "placeholder" };
23697
23674
  }
23698
23675
  }
23699
23676
  navigatorWorkContext = { ...work, ...contextError === void 0 ? {} : { contextError } };
@@ -23728,8 +23705,6 @@ function createRoleRuntimeExtension(dependencies, deliveryRequestLimit) {
23728
23705
  role: entry.role,
23729
23706
  phase: invocationPhase,
23730
23707
  subjectKey: work.subjectKey,
23731
- subject: work.subject,
23732
- authority: work.authority,
23733
23708
  invocationId,
23734
23709
  deliveryRequestLimit: deliveryLimit,
23735
23710
  ...contextError === void 0 ? {} : { contextError },
@@ -24377,17 +24352,13 @@ async function prepareRoleEnvelope(options) {
24377
24352
  }
24378
24353
 
24379
24354
  // src/role-runtime-dependencies.ts
24380
- import { readFile as readFile16 } from "node:fs/promises";
24355
+ import { readFile as readFile15 } from "node:fs/promises";
24381
24356
  init_doctor_evidence();
24382
24357
 
24383
24358
  // src/navigator-work-context.ts
24384
24359
  init_role_run_placement();
24385
- init_doctor_evidence();
24386
- init_unknown_value();
24387
24360
  init_host_contracts();
24388
- import { readFile as readFile15 } from "node:fs/promises";
24389
24361
  import { resolve as resolve17 } from "node:path";
24390
- init_notary_source_run();
24391
24362
  init_packaged_role_registry();
24392
24363
  init_invocation();
24393
24364
  function navigatorInputReference(getFlag, role) {
@@ -24399,21 +24370,8 @@ function navigatorInputReference(getFlag, role) {
24399
24370
  async function loadNavigatorWorkContext(options) {
24400
24371
  const reference = navigatorInputReference(options.getFlag, options.role);
24401
24372
  const subjectMode = packagedNavigatorSubject(options.role);
24402
- const input = reference === void 0 || subjectMode === "case" || subjectMode === "source-run" ? void 0 : await readFile15(reference, "utf8");
24403
24373
  const subjectRoot = subjectPath(reference ?? options.context.sessionManager.getSessionDir(), options.context.cwd);
24404
- let subjectKey = reference === void 0 ? subjectRoot : navigatorSubjectKeyForInput(subjectRoot, reference, options.context.cwd);
24405
- let subject = input ?? `work subject: ${subjectKey}`;
24406
- let subjectProvenance = input === void 0 ? "placeholder" : "role_input";
24407
- if (subjectMode === "case" && reference !== void 0) {
24408
- const patient = await loadDoctorCase(reference);
24409
- subject = JSON.stringify({ identity: patient.identity, cost: patient.cost });
24410
- subjectProvenance = "role_input";
24411
- }
24412
- if (subjectMode === "source-run" && reference !== void 0) {
24413
- const locator = await loadNotarySourceRunLocator(reference);
24414
- subject = JSON.stringify({ sourceRun: locator });
24415
- subjectProvenance = "role_input";
24416
- }
24374
+ const subjectKey = reference === void 0 ? subjectRoot : navigatorSubjectKeyForInput(subjectRoot, reference, options.context.cwd);
24417
24375
  const publicRunDir = runDirectoryFromHostContext(options.context);
24418
24376
  const currentSessionDir = options.context.sessionManager.getSessionDir();
24419
24377
  const isBoundPublicRun = publicRunDir !== void 0 && resolve17(currentSessionDir) === resolve17(sessionDirectoryOf(publicRunDir));
@@ -24431,50 +24389,23 @@ async function loadNavigatorWorkContext(options) {
24431
24389
  );
24432
24390
  }
24433
24391
  if (!admitted.instructionEmpty && admitted.instruction.trim() !== "") {
24434
- const prose = admitted.instruction;
24435
- subjectProvenance = "role_input";
24436
- subject = prose;
24437
- subjectKey = navigatorSubjectKey(subjectRoot, prose, subjectProvenance);
24438
- return { subjectKey, subject, authority: prose, subjectProvenance };
24392
+ return {
24393
+ subjectKey: subjectRoot,
24394
+ subjectProvenance: "role_input"
24395
+ };
24439
24396
  }
24440
24397
  return {
24441
24398
  subjectKey: subjectRoot,
24442
- subject: `work subject: ${subjectRoot}`,
24443
- authority: "",
24444
24399
  subjectProvenance: "placeholder"
24445
24400
  };
24446
24401
  }
24447
- if (input !== void 0 && input.trim() !== "") {
24448
- return { subjectKey, subject, authority: input, subjectProvenance };
24449
- }
24450
- const workRoot = subjectRoot.includes("/.ak/work/") ? subjectRoot : void 0;
24451
- const authorityFiles = workRoot === void 0 ? [] : [
24452
- resolve17(workRoot, "authority.md"),
24453
- resolve17(workRoot, "authority.txt"),
24454
- resolve17(workRoot, "design-v2/owner-direction.md")
24455
- ];
24456
- let authorityMaterial;
24457
- for (const path of authorityFiles) {
24458
- try {
24459
- const content = await readFile15(path, "utf8");
24460
- if (content.trim() !== "") {
24461
- authorityMaterial = content;
24462
- break;
24463
- }
24464
- } catch (error) {
24465
- if (!isEnoent(error)) throw error;
24466
- }
24467
- }
24468
- const authority = resolveNavigatorAuthorityMaterial(input, authorityMaterial);
24469
- if (authority === void 0) {
24470
- return {
24471
- subjectKey: subjectRoot,
24472
- subject: `work subject: ${subjectRoot}`,
24473
- authority: "",
24474
- subjectProvenance: "placeholder"
24475
- };
24402
+ if (reference !== void 0) {
24403
+ return { subjectKey, subjectProvenance: "role_input" };
24476
24404
  }
24477
- return { subjectKey, subject, authority, subjectProvenance };
24405
+ return {
24406
+ subjectKey: subjectRoot,
24407
+ subjectProvenance: "placeholder"
24408
+ };
24478
24409
  }
24479
24410
 
24480
24411
  // src/role-runtime-dependencies.ts
@@ -24500,7 +24431,7 @@ function createRoleRuntimeDependencies(packageRoot) {
24500
24431
  loadRoleSoul: loadRegisteredRoleSoul,
24501
24432
  loadDoctorCase,
24502
24433
  loadNotarySourceRun: loadNotarySourceRunLocator,
24503
- loadMergerInput: async (path) => JSON.parse(await readFile16(path, "utf8")),
24434
+ loadMergerInput: async (path) => JSON.parse(await readFile15(path, "utf8")),
24504
24435
  loadNavigatorWorkContext: (options) => loadNavigatorWorkContext({
24505
24436
  context: options.context,
24506
24437
  role: options.role,
@@ -24511,8 +24442,6 @@ function createRoleRuntimeDependencies(packageRoot) {
24511
24442
  role: options.role,
24512
24443
  phase: options.phase,
24513
24444
  subjectKey: options.subjectKey,
24514
- subject: options.subject,
24515
- authority: options.authority,
24516
24445
  invocationId: options.invocationId,
24517
24446
  createSession: navigatorSessionFactory,
24518
24447
  ...options.deliveryRequestLimit === void 0 ? {} : { deliveryRequestLimit: options.deliveryRequestLimit },
@@ -9028,22 +9028,18 @@ async function materializeCountersignInvocation(admitted, options) {
9028
9028
  );
9029
9029
  }
9030
9030
  async function loadAdmittedJudgeRequest(runDirectory) {
9031
- try {
9032
- const record = readPageSync(runDirectory, "admitted");
9033
- if (record === void 0) return void 0;
9034
- if (!packagedPublicInstructionSubject(record.role)) return void 0;
9035
- if (typeof record.instruction !== "string") return void 0;
9036
- if (typeof record.instructionEmpty !== "boolean") return void 0;
9037
- if (!Array.isArray(record.attachments)) return void 0;
9038
- const attachments = record.attachments.map((item) => normalizeAdmittedAttachment(item)).filter((item) => item !== void 0);
9039
- return {
9040
- instruction: record.instruction,
9041
- instructionEmpty: record.instructionEmpty,
9042
- attachments
9043
- };
9044
- } catch {
9045
- return void 0;
9046
- }
9031
+ const record = readPageSync(runDirectory, "admitted");
9032
+ if (record === void 0) return void 0;
9033
+ if (!packagedPublicInstructionSubject(record.role)) return void 0;
9034
+ if (typeof record.instruction !== "string") return void 0;
9035
+ if (typeof record.instructionEmpty !== "boolean") return void 0;
9036
+ if (!Array.isArray(record.attachments)) return void 0;
9037
+ const attachments = record.attachments.map((item) => normalizeAdmittedAttachment(item)).filter((item) => item !== void 0);
9038
+ return {
9039
+ instruction: record.instruction,
9040
+ instructionEmpty: record.instructionEmpty,
9041
+ attachments
9042
+ };
9047
9043
  }
9048
9044
  function parsePositivePrOption(raw) {
9049
9045
  if (raw === void 0 || raw.trim() === "") throw new CliUsageError("--pr requires a positive pull request number");
@@ -10876,8 +10872,10 @@ function buildPiTurnExtraArgs(request, authority, extraPiArgs = []) {
10876
10872
  // Envelope assembly = projectActivationFlags; pi only renders argv pairs.
10877
10873
  ...activationFlagsToPiArgv(projectActivationFlags(request)),
10878
10874
  ...piEngineModelArgs(request),
10875
+ // #1182: text single-shot keeps pi's native assistant error/aborted
10876
+ // exit (stderr + exit 1). json mode never takes that failure branch.
10879
10877
  "--mode",
10880
- "json",
10878
+ "text",
10881
10879
  ...buildSeatModelCliArgs2(request.model)
10882
10880
  ];
10883
10881
  }
@@ -20456,7 +20454,7 @@ init_host_descriptions();
20456
20454
  import { randomUUID as randomUUID11 } from "node:crypto";
20457
20455
 
20458
20456
  // src/role-runtime-dependencies.ts
20459
- import { readFile as readFile16 } from "node:fs/promises";
20457
+ import { readFile as readFile15 } from "node:fs/promises";
20460
20458
  init_doctor_evidence();
20461
20459
 
20462
20460
  // src/navigator-attendance.ts
@@ -20844,11 +20842,6 @@ init_navigator_output();
20844
20842
  init_sha256();
20845
20843
  init_unknown_value();
20846
20844
  var NAVIGATOR_EVENT_TYPE = "ak-navigator-attendance";
20847
- function resolveNavigatorAuthorityMaterial(roleInput, fileAuthority) {
20848
- if (roleInput !== void 0 && roleInput.trim() !== "") return roleInput;
20849
- if (fileAuthority !== void 0 && fileAuthority.trim() !== "") return fileAuthority;
20850
- return void 0;
20851
- }
20852
20845
  var NAVIGATOR_TARGETS = PACKAGED_ROLE_REGISTRY.map(({ role, phases }) => ({ role, phases }));
20853
20846
  var prepareSchema = navigatorAdviceBodySchema;
20854
20847
  var INVOCATION_ENTRY = NAVIGATOR_INVOCATION_ENTRY;
@@ -20923,8 +20916,6 @@ function createNavigatorAttendance(options) {
20923
20916
  let sessionReady;
20924
20917
  let session;
20925
20918
  let subjectKey = options.subjectKey;
20926
- let subject = options.subject;
20927
- let authority = options.authority;
20928
20919
  let contextError = options.contextError;
20929
20920
  let preparedAdvice;
20930
20921
  const invocationPrincipal = options.invocationId ?? mintNavigatorInvocationId();
@@ -20953,12 +20944,6 @@ function createNavigatorAttendance(options) {
20953
20944
  };
20954
20945
  const loadMaterialsAndSession = async (invocationId) => {
20955
20946
  if (contextError !== void 0) throw navigatorUnavailableError("context", contextError);
20956
- if (typeof authority !== "string" || authority.trim() === "") {
20957
- throw navigatorUnavailableError(
20958
- "context",
20959
- new Error("controlling authority content was not supplied as typed work context")
20960
- );
20961
- }
20962
20947
  const modelPromise = (async () => {
20963
20948
  try {
20964
20949
  const resolved = await resolveNavigatorSeatSelection(options.context);
@@ -21044,9 +21029,7 @@ function createNavigatorAttendance(options) {
21044
21029
  role: options.role,
21045
21030
  phase: options.phase,
21046
21031
  invocationId,
21047
- subjectKey,
21048
- subject,
21049
- authority
21032
+ subjectKey
21050
21033
  });
21051
21034
  try {
21052
21035
  try {
@@ -21123,8 +21106,6 @@ function createNavigatorAttendance(options) {
21123
21106
  closing2 = previous.dispose();
21124
21107
  }
21125
21108
  subjectKey = next.subjectKey;
21126
- subject = next.subject;
21127
- authority = next.authority;
21128
21109
  contextError = next.contextError;
21129
21110
  return closing2;
21130
21111
  },
@@ -21259,12 +21240,8 @@ function createNavigatorAttendance(options) {
21259
21240
 
21260
21241
  // src/navigator-work-context.ts
21261
21242
  init_role_run_placement();
21262
- init_doctor_evidence();
21263
- init_unknown_value();
21264
21243
  init_host_contracts();
21265
- import { readFile as readFile15 } from "node:fs/promises";
21266
21244
  import { resolve as resolve15 } from "node:path";
21267
- init_notary_source_run();
21268
21245
  init_packaged_role_registry();
21269
21246
  init_invocation();
21270
21247
  function navigatorInputReference(getFlag, role) {
@@ -21276,21 +21253,8 @@ function navigatorInputReference(getFlag, role) {
21276
21253
  async function loadNavigatorWorkContext(options) {
21277
21254
  const reference = navigatorInputReference(options.getFlag, options.role);
21278
21255
  const subjectMode = packagedNavigatorSubject(options.role);
21279
- const input = reference === void 0 || subjectMode === "case" || subjectMode === "source-run" ? void 0 : await readFile15(reference, "utf8");
21280
21256
  const subjectRoot = subjectPath(reference ?? options.context.sessionManager.getSessionDir(), options.context.cwd);
21281
- let subjectKey = reference === void 0 ? subjectRoot : navigatorSubjectKeyForInput(subjectRoot, reference, options.context.cwd);
21282
- let subject = input ?? `work subject: ${subjectKey}`;
21283
- let subjectProvenance = input === void 0 ? "placeholder" : "role_input";
21284
- if (subjectMode === "case" && reference !== void 0) {
21285
- const patient = await loadDoctorCase(reference);
21286
- subject = JSON.stringify({ identity: patient.identity, cost: patient.cost });
21287
- subjectProvenance = "role_input";
21288
- }
21289
- if (subjectMode === "source-run" && reference !== void 0) {
21290
- const locator = await loadNotarySourceRunLocator(reference);
21291
- subject = JSON.stringify({ sourceRun: locator });
21292
- subjectProvenance = "role_input";
21293
- }
21257
+ const subjectKey = reference === void 0 ? subjectRoot : navigatorSubjectKeyForInput(subjectRoot, reference, options.context.cwd);
21294
21258
  const publicRunDir = runDirectoryFromHostContext(options.context);
21295
21259
  const currentSessionDir = options.context.sessionManager.getSessionDir();
21296
21260
  const isBoundPublicRun = publicRunDir !== void 0 && resolve15(currentSessionDir) === resolve15(sessionDirectoryOf(publicRunDir));
@@ -21308,50 +21272,23 @@ async function loadNavigatorWorkContext(options) {
21308
21272
  );
21309
21273
  }
21310
21274
  if (!admitted.instructionEmpty && admitted.instruction.trim() !== "") {
21311
- const prose = admitted.instruction;
21312
- subjectProvenance = "role_input";
21313
- subject = prose;
21314
- subjectKey = navigatorSubjectKey(subjectRoot, prose, subjectProvenance);
21315
- return { subjectKey, subject, authority: prose, subjectProvenance };
21275
+ return {
21276
+ subjectKey: subjectRoot,
21277
+ subjectProvenance: "role_input"
21278
+ };
21316
21279
  }
21317
21280
  return {
21318
21281
  subjectKey: subjectRoot,
21319
- subject: `work subject: ${subjectRoot}`,
21320
- authority: "",
21321
21282
  subjectProvenance: "placeholder"
21322
21283
  };
21323
21284
  }
21324
- if (input !== void 0 && input.trim() !== "") {
21325
- return { subjectKey, subject, authority: input, subjectProvenance };
21326
- }
21327
- const workRoot = subjectRoot.includes("/.ak/work/") ? subjectRoot : void 0;
21328
- const authorityFiles = workRoot === void 0 ? [] : [
21329
- resolve15(workRoot, "authority.md"),
21330
- resolve15(workRoot, "authority.txt"),
21331
- resolve15(workRoot, "design-v2/owner-direction.md")
21332
- ];
21333
- let authorityMaterial;
21334
- for (const path of authorityFiles) {
21335
- try {
21336
- const content = await readFile15(path, "utf8");
21337
- if (content.trim() !== "") {
21338
- authorityMaterial = content;
21339
- break;
21340
- }
21341
- } catch (error) {
21342
- if (!isEnoent(error)) throw error;
21343
- }
21344
- }
21345
- const authority = resolveNavigatorAuthorityMaterial(input, authorityMaterial);
21346
- if (authority === void 0) {
21347
- return {
21348
- subjectKey: subjectRoot,
21349
- subject: `work subject: ${subjectRoot}`,
21350
- authority: "",
21351
- subjectProvenance: "placeholder"
21352
- };
21285
+ if (reference !== void 0) {
21286
+ return { subjectKey, subjectProvenance: "role_input" };
21353
21287
  }
21354
- return { subjectKey, subject, authority, subjectProvenance };
21288
+ return {
21289
+ subjectKey: subjectRoot,
21290
+ subjectProvenance: "placeholder"
21291
+ };
21355
21292
  }
21356
21293
 
21357
21294
  // src/role-runtime-dependencies.ts
@@ -23297,12 +23234,8 @@ function createRoleRuntimeExtension(dependencies, deliveryRequestLimit) {
23297
23234
  if (subject !== "") {
23298
23235
  const root = subjectPath(ctx.sessionManager.getSessionDir(), ctx.cwd);
23299
23236
  const subjectProvenance = "user_prompt";
23300
- const priorAuthority = navigatorWorkContext.authority;
23301
- const authority = typeof priorAuthority === "string" && priorAuthority.trim() !== "" ? priorAuthority : subject;
23302
23237
  navigatorWorkContext = {
23303
23238
  subjectKey: navigatorSubjectKey(root, subject, subjectProvenance),
23304
- subject,
23305
- authority,
23306
23239
  subjectProvenance
23307
23240
  };
23308
23241
  await navigatorAttendance.setWorkContext(navigatorWorkContext);
@@ -23744,7 +23677,7 @@ function createRoleRuntimeExtension(dependencies, deliveryRequestLimit) {
23744
23677
  if (dependencies.loadNavigatorWorkContext === void 0) {
23745
23678
  const fallbackSubjectKey = subjectPath(ctx.sessionManager.getSessionDir(), ctx.cwd);
23746
23679
  contextError = new Error("Navigator work context loader is not configured");
23747
- work = { subjectKey: fallbackSubjectKey, subject: `work subject: ${fallbackSubjectKey}`, authority: "", subjectProvenance: "placeholder" };
23680
+ work = { subjectKey: fallbackSubjectKey, subjectProvenance: "placeholder" };
23748
23681
  } else {
23749
23682
  try {
23750
23683
  work = await dependencies.loadNavigatorWorkContext({
@@ -23757,7 +23690,7 @@ function createRoleRuntimeExtension(dependencies, deliveryRequestLimit) {
23757
23690
  } catch (error) {
23758
23691
  contextError = navigatorUnavailableError("context", error);
23759
23692
  const fallbackSubjectKey = subjectPath(ctx.sessionManager.getSessionDir(), ctx.cwd);
23760
- work = { subjectKey: fallbackSubjectKey, subject: `work subject: ${fallbackSubjectKey}`, authority: "", subjectProvenance: "placeholder" };
23693
+ work = { subjectKey: fallbackSubjectKey, subjectProvenance: "placeholder" };
23761
23694
  }
23762
23695
  }
23763
23696
  navigatorWorkContext = { ...work, ...contextError === void 0 ? {} : { contextError } };
@@ -23792,8 +23725,6 @@ function createRoleRuntimeExtension(dependencies, deliveryRequestLimit) {
23792
23725
  role: entry.role,
23793
23726
  phase: invocationPhase,
23794
23727
  subjectKey: work.subjectKey,
23795
- subject: work.subject,
23796
- authority: work.authority,
23797
23728
  invocationId,
23798
23729
  deliveryRequestLimit: deliveryLimit,
23799
23730
  ...contextError === void 0 ? {} : { contextError },
@@ -23855,7 +23786,7 @@ function createRoleRuntimeDependencies(packageRoot) {
23855
23786
  loadRoleSoul: loadRegisteredRoleSoul,
23856
23787
  loadDoctorCase,
23857
23788
  loadNotarySourceRun: loadNotarySourceRunLocator,
23858
- loadMergerInput: async (path) => JSON.parse(await readFile16(path, "utf8")),
23789
+ loadMergerInput: async (path) => JSON.parse(await readFile15(path, "utf8")),
23859
23790
  loadNavigatorWorkContext: (options) => loadNavigatorWorkContext({
23860
23791
  context: options.context,
23861
23792
  role: options.role,
@@ -23866,8 +23797,6 @@ function createRoleRuntimeDependencies(packageRoot) {
23866
23797
  role: options.role,
23867
23798
  phase: options.phase,
23868
23799
  subjectKey: options.subjectKey,
23869
- subject: options.subject,
23870
- authority: options.authority,
23871
23800
  invocationId: options.invocationId,
23872
23801
  createSession: navigatorSessionFactory,
23873
23802
  ...options.deliveryRequestLimit === void 0 ? {} : { deliveryRequestLimit: options.deliveryRequestLimit },
@@ -41,11 +41,6 @@ import {
41
41
  import { sha256Hex } from "./sha256.js";
42
42
  import { isRecord } from "./unknown-value.js";
43
43
  const NAVIGATOR_EVENT_TYPE = "ak-navigator-attendance";
44
- function resolveNavigatorAuthorityMaterial(roleInput, fileAuthority) {
45
- if (roleInput !== void 0 && roleInput.trim() !== "") return roleInput;
46
- if (fileAuthority !== void 0 && fileAuthority.trim() !== "") return fileAuthority;
47
- return void 0;
48
- }
49
44
  const NAVIGATOR_TARGETS = PACKAGED_ROLE_REGISTRY.map(({ role, phases }) => ({ role, phases }));
50
45
  const prepareSchema = navigatorAdviceBodySchema;
51
46
  const INVOCATION_ENTRY = NAVIGATOR_INVOCATION_ENTRY;
@@ -124,8 +119,6 @@ function createNavigatorAttendance(options) {
124
119
  let sessionReady;
125
120
  let session;
126
121
  let subjectKey = options.subjectKey;
127
- let subject = options.subject;
128
- let authority = options.authority;
129
122
  let contextError = options.contextError;
130
123
  let preparedAdvice;
131
124
  const invocationPrincipal = options.invocationId ?? mintNavigatorInvocationId();
@@ -154,12 +147,6 @@ function createNavigatorAttendance(options) {
154
147
  };
155
148
  const loadMaterialsAndSession = async (invocationId) => {
156
149
  if (contextError !== void 0) throw navigatorUnavailableError("context", contextError);
157
- if (typeof authority !== "string" || authority.trim() === "") {
158
- throw navigatorUnavailableError(
159
- "context",
160
- new Error("controlling authority content was not supplied as typed work context")
161
- );
162
- }
163
150
  const modelPromise = (async () => {
164
151
  try {
165
152
  const resolved = await resolveNavigatorSeatSelection(options.context);
@@ -245,9 +232,7 @@ function createNavigatorAttendance(options) {
245
232
  role: options.role,
246
233
  phase: options.phase,
247
234
  invocationId,
248
- subjectKey,
249
- subject,
250
- authority
235
+ subjectKey
251
236
  });
252
237
  try {
253
238
  try {
@@ -324,8 +309,6 @@ function createNavigatorAttendance(options) {
324
309
  closing2 = previous.dispose();
325
310
  }
326
311
  subjectKey = next.subjectKey;
327
- subject = next.subject;
328
- authority = next.authority;
329
312
  contextError = next.contextError;
330
313
  return closing2;
331
314
  },
@@ -487,7 +470,6 @@ export {
487
470
  parseNavigatorModelSetting,
488
471
  readNavigatorModelSetting,
489
472
  registerNavigatorModelCommand,
490
- resolveNavigatorAuthorityMaterial,
491
473
  resolveNavigatorSeatSelection,
492
474
  subjectPath,
493
475
  writeNavigatorModelSetting
@@ -103,8 +103,10 @@ export function buildPiTurnExtraArgs(request, authority, extraPiArgs = []) {
103
103
  // Envelope assembly = projectActivationFlags; pi only renders argv pairs.
104
104
  ...activationFlagsToPiArgv(projectActivationFlags(request)),
105
105
  ...piEngineModelArgs(request),
106
+ // #1182: text single-shot keeps pi's native assistant error/aborted
107
+ // exit (stderr + exit 1). json mode never takes that failure branch.
106
108
  "--mode",
107
- "json",
109
+ "text",
108
110
  ...buildSeatModelCliArgs(request.model),
109
111
  ];
110
112
  }
@@ -1162,32 +1162,30 @@ export async function materializeCountersignInvocation(admitted, options) {
1162
1162
  });
1163
1163
  await writeRoleInvocationLedger({ ...admitted, sessionDirectory: placement.sessionDirectory, sessionFile: placement.sessionFile }, admitted.role, options.model);
1164
1164
  }
1165
- /** Load the admitted section written at admission (Navigator work-context seam). */
1165
+ /**
1166
+ * Load the admitted section written at admission (Navigator work-context seam).
1167
+ * Missing / wrong-shape → undefined. Control-plane read faults propagate (#1187 F2).
1168
+ */
1166
1169
  export async function loadAdmittedJudgeRequest(runDirectory) {
1167
- try {
1168
- const record = readPageSync(runDirectory, "admitted");
1169
- if (record === undefined)
1170
- return undefined;
1171
- if (!packagedPublicInstructionSubject(record.role))
1172
- return undefined;
1173
- if (typeof record.instruction !== "string")
1174
- return undefined;
1175
- if (typeof record.instructionEmpty !== "boolean")
1176
- return undefined;
1177
- if (!Array.isArray(record.attachments))
1178
- return undefined;
1179
- const attachments = record.attachments
1180
- .map((item) => normalizeAdmittedAttachment(item))
1181
- .filter((item) => item !== undefined);
1182
- return {
1183
- instruction: record.instruction,
1184
- instructionEmpty: record.instructionEmpty,
1185
- attachments,
1186
- };
1187
- }
1188
- catch {
1170
+ const record = readPageSync(runDirectory, "admitted");
1171
+ if (record === undefined)
1189
1172
  return undefined;
1190
- }
1173
+ if (!packagedPublicInstructionSubject(record.role))
1174
+ return undefined;
1175
+ if (typeof record.instruction !== "string")
1176
+ return undefined;
1177
+ if (typeof record.instructionEmpty !== "boolean")
1178
+ return undefined;
1179
+ if (!Array.isArray(record.attachments))
1180
+ return undefined;
1181
+ const attachments = record.attachments
1182
+ .map((item) => normalizeAdmittedAttachment(item))
1183
+ .filter((item) => item !== undefined);
1184
+ return {
1185
+ instruction: record.instruction,
1186
+ instructionEmpty: record.instructionEmpty,
1187
+ attachments,
1188
+ };
1191
1189
  }
1192
1190
  function parsePositivePrOption(raw) {
1193
1191
  if (raw === undefined || raw.trim() === "")
@@ -17572,8 +17572,10 @@ function buildPiTurnExtraArgs(request, authority, extraPiArgs = []) {
17572
17572
  // Envelope assembly = projectActivationFlags; pi only renders argv pairs.
17573
17573
  ...activationFlagsToPiArgv(projectActivationFlags(request)),
17574
17574
  ...piEngineModelArgs(request),
17575
+ // #1182: text single-shot keeps pi's native assistant error/aborted
17576
+ // exit (stderr + exit 1). json mode never takes that failure branch.
17575
17577
  "--mode",
17576
- "json",
17578
+ "text",
17577
17579
  ...buildSeatModelCliArgs2(request.model)
17578
17580
  ];
17579
17581
  }
@@ -13,10 +13,8 @@ import type { Message } from "@earendil-works/pi-ai";
13
13
 
14
14
  import {
15
15
  registerNavigatorModelCommand,
16
- resolveNavigatorAuthorityMaterial,
17
16
  } from "../src/navigator-attendance.ts";
18
17
  import { loadNavigatorWorkContext as loadHostNeutralNavigatorWorkContext } from "../src/navigator-work-context.ts";
19
- export { resolveNavigatorAuthorityMaterial };
20
18
  import { JUDGE_OUTPUT_TOOL_NAME } from "../src/package-contracts/judge-output.ts";
21
19
  import { readOAuthKeepaliveProviders } from "../src/oauth-keepalive.ts";
22
20
  import {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akagilnc/pi-workflow-roles",
3
- "version": "0.1.5671",
3
+ "version": "0.1.5679",
4
4
  "description": "Soul-bound workflow roles for Pi",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -74,19 +74,6 @@ import { isRecord } from "./unknown-value.ts";
74
74
  export const NAVIGATOR_EVENT_TYPE = "ak-navigator-attendance" as const;
75
75
  export { NAVIGATOR_ROUTE_PLAYBOOK_FAILURE_ENTRY };
76
76
 
77
- /**
78
- * Role-input document bytes win verbatim over work-root file authority when non-empty.
79
- * Absent or whitespace-only input yields to fileAuthority; neither remains undefined.
80
- */
81
- export function resolveNavigatorAuthorityMaterial(
82
- roleInput: string | undefined,
83
- fileAuthority: string | undefined,
84
- ): string | undefined {
85
- if (roleInput !== undefined && roleInput.trim() !== "") return roleInput;
86
- if (fileAuthority !== undefined && fileAuthority.trim() !== "") return fileAuthority;
87
- return undefined;
88
- }
89
-
90
77
  /** Every public role is a lawful navigator route target (#675 — no nested-only seats). */
91
78
  export const NAVIGATOR_TARGETS = PACKAGED_ROLE_REGISTRY
92
79
  .map(({ role, phases }) => ({ role, phases }));
@@ -101,10 +88,9 @@ export type NavigatorSettlement =
101
88
 
102
89
  export type NavigatorSubjectProvenance = "placeholder" | "role_input" | "user_prompt";
103
90
 
91
+ /** #1187: auto prepare identity only — no subject/authority material fields. */
104
92
  export type NavigatorWorkContext = {
105
93
  subjectKey: string;
106
- subject: string;
107
- authority: string;
108
94
  subjectProvenance: NavigatorSubjectProvenance;
109
95
  contextError?: unknown;
110
96
  };
@@ -153,8 +139,6 @@ export type NavigatorAttendanceOptions = {
153
139
  subjectKey: string;
154
140
  createSession: NavigatorSessionFactory;
155
141
  modelSettingPath?: string;
156
- subject: string;
157
- authority: string;
158
142
  contextError?: unknown;
159
143
  /** Exact principal owned by shared role lifecycle; attendance never overrides it. */
160
144
  invocationId?: string;
@@ -277,8 +261,7 @@ export function createNavigatorAttendance(options: NavigatorAttendanceOptions) {
277
261
  let sessionReady: Promise<NavigatorPreparationSession> | undefined;
278
262
  let session: NavigatorPreparationSession | undefined;
279
263
  let subjectKey = options.subjectKey;
280
- let subject = options.subject;
281
- let authority = options.authority;
264
+ // #1187: auto prepare is identity-only (role/phase/subjectKey).
282
265
  let contextError = options.contextError;
283
266
  /** Parallel-prepare result: status-keyed prose picked at settle (#1160). */
284
267
  let preparedAdvice: PreparedNavigatorAdvice | undefined;
@@ -322,12 +305,8 @@ export function createNavigatorAttendance(options: NavigatorAttendanceOptions) {
322
305
  */
323
306
  const loadMaterialsAndSession = async (invocationId: string): Promise<NavigatorPreparationSession> => {
324
307
  if (contextError !== undefined) throw navigatorUnavailableError("context", contextError);
325
- if (typeof authority !== "string" || authority.trim() === "") {
326
- throw navigatorUnavailableError(
327
- "context",
328
- new Error("controlling authority content was not supplied as typed work context"),
329
- );
330
- }
308
+ // #1187: prepare runs from identity (role/phase/subjectKey). Parent dispatch
309
+ // and authority copies are not required materials for the auto prepare round.
331
310
  const modelPromise = (async () => {
332
311
  try {
333
312
  const resolved = await resolveNavigatorSeatSelection(options.context);
@@ -413,16 +392,14 @@ export function createNavigatorAttendance(options: NavigatorAttendanceOptions) {
413
392
  };
414
393
  const activeSession = await loadMaterialsAndSession(invocationId);
415
394
  // #1160: parallel prepare from parent start — model runs now; settle only picks.
416
- // Pass already-loaded subject/authority so the prepare run can judge progress
417
- // (ticket text lives in those materials when present — no path invention).
395
+ // #1187: identity only. Parent dispatch / authority copies stay off this wire;
396
+ // navigator reads ticket and station records itself when needed.
418
397
  const request = JSON.stringify({
419
398
  kind: "prepare",
420
399
  role: options.role,
421
400
  phase: options.phase,
422
401
  invocationId,
423
402
  subjectKey,
424
- subject,
425
- authority,
426
403
  });
427
404
  try {
428
405
  try {
@@ -520,8 +497,6 @@ export function createNavigatorAttendance(options: NavigatorAttendanceOptions) {
520
497
  closing = previous.dispose();
521
498
  }
522
499
  subjectKey = next.subjectKey;
523
- subject = next.subject;
524
- authority = next.authority;
525
500
  contextError = next.contextError;
526
501
  return closing;
527
502
  },
@@ -1,25 +1,21 @@
1
1
  /**
2
- * Host-neutral Navigator work-context loader (#590).
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.
3
5
  * Flag/input resolution is supplied by the host; no ExtensionAPI dependency.
4
6
  */
5
- import { readFile } from "node:fs/promises";
6
7
  import { resolve } from "node:path";
7
8
 
8
9
  import { sessionDirectoryOf } from "./role-run-placement.ts";
9
10
 
10
- import { loadDoctorCase } from "./doctor-evidence.ts";
11
- import { isEnoent } from "./unknown-value.ts";
12
11
  import { runDirectoryFromHostContext, type HostContext } from "./host-contracts.ts";
13
12
  import {
14
- navigatorSubjectKey,
15
13
  navigatorSubjectKeyForInput,
16
14
  navigatorUnavailableError,
17
- resolveNavigatorAuthorityMaterial,
18
15
  subjectPath,
19
16
  type NavigatorSubjectProvenance,
20
17
  type NavigatorWorkContext,
21
18
  } from "./navigator-attendance.ts";
22
- import { loadNotarySourceRunLocator } from "./notary-source-run.ts";
23
19
  import { packagedNavigatorSubject, packagedRoleInputFlag } from "./packaged-role-registry.ts";
24
20
  import { loadAdmittedJudgeRequest } from "./public-cli/invocation.ts";
25
21
 
@@ -42,37 +38,26 @@ function navigatorInputReference(
42
38
 
43
39
  /**
44
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.
45
42
  */
46
43
  export async function loadNavigatorWorkContext(
47
44
  options: NavigatorWorkContextLoaderOptions,
48
45
  ): Promise<NavigatorWorkContext> {
49
46
  const reference = navigatorInputReference(options.getFlag, options.role);
50
47
  const subjectMode = packagedNavigatorSubject(options.role);
51
- const input = reference === undefined || subjectMode === "case" || subjectMode === "source-run"
52
- ? undefined
53
- : await readFile(reference, "utf8");
54
48
  const subjectRoot = subjectPath(reference ?? options.context.sessionManager.getSessionDir(), options.context.cwd);
55
- let subjectKey = reference === undefined
49
+ const subjectKey = reference === undefined
56
50
  ? subjectRoot
57
51
  : navigatorSubjectKeyForInput(subjectRoot, reference, options.context.cwd);
58
- let subject = input ?? `work subject: ${subjectKey}`;
59
- let subjectProvenance: NavigatorSubjectProvenance = input === undefined ? "placeholder" : "role_input";
60
- if (subjectMode === "case" && reference !== undefined) {
61
- const patient = await loadDoctorCase(reference);
62
- subject = JSON.stringify({ identity: patient.identity, cost: patient.cost });
63
- subjectProvenance = "role_input";
64
- }
65
- if (subjectMode === "source-run" && reference !== undefined) {
66
- const locator = await loadNotarySourceRunLocator(reference);
67
- subject = JSON.stringify({ sourceRun: locator });
68
- subjectProvenance = "role_input";
69
- }
70
- // Public ak-role run: admitted request is the typed Navigator work-context source.
52
+
53
+ // Public ak-role run: admitted request decides empty vs concrete identity.
71
54
  const publicRunDir = runDirectoryFromHostContext(options.context);
72
55
  const currentSessionDir = options.context.sessionManager.getSessionDir();
73
56
  const isBoundPublicRun = publicRunDir !== undefined
74
57
  && resolve(currentSessionDir) === resolve(sessionDirectoryOf(publicRunDir));
75
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.
76
61
  let admitted;
77
62
  try {
78
63
  admitted = await loadAdmittedJudgeRequest(publicRunDir);
@@ -86,48 +71,27 @@ export async function loadNavigatorWorkContext(
86
71
  );
87
72
  }
88
73
  if (!admitted.instructionEmpty && admitted.instruction.trim() !== "") {
89
- const prose = admitted.instruction;
90
- subjectProvenance = "role_input";
91
- subject = prose;
92
- subjectKey = navigatorSubjectKey(subjectRoot, prose, subjectProvenance);
93
- return { subjectKey, subject, authority: prose, subjectProvenance };
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
+ };
94
81
  }
95
82
  return {
96
83
  subjectKey: subjectRoot,
97
- subject: `work subject: ${subjectRoot}`,
98
- authority: "",
99
84
  subjectProvenance: "placeholder",
100
85
  };
101
86
  }
102
- if (input !== undefined && input.trim() !== "") {
103
- return { subjectKey, subject, authority: input, subjectProvenance };
104
- }
105
- const workRoot = subjectRoot.includes("/.ak/work/") ? subjectRoot : undefined;
106
- const authorityFiles = workRoot === undefined ? [] : [
107
- resolve(workRoot, "authority.md"),
108
- resolve(workRoot, "authority.txt"),
109
- resolve(workRoot, "design-v2/owner-direction.md"),
110
- ];
111
- let authorityMaterial: string | undefined;
112
- for (const path of authorityFiles) {
113
- try {
114
- const content = await readFile(path, "utf8");
115
- if (content.trim() !== "") {
116
- authorityMaterial = content;
117
- break;
118
- }
119
- } catch (error) {
120
- if (!isEnoent(error)) throw error;
121
- }
122
- }
123
- const authority = resolveNavigatorAuthorityMaterial(input, authorityMaterial);
124
- if (authority === undefined) {
125
- return {
126
- subjectKey: subjectRoot,
127
- subject: `work subject: ${subjectRoot}`,
128
- authority: "",
129
- subjectProvenance: "placeholder",
130
- };
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 };
131
92
  }
132
- return { subjectKey, subject, authority, subjectProvenance };
93
+ return {
94
+ subjectKey: subjectRoot,
95
+ subjectProvenance: "placeholder",
96
+ };
133
97
  }
@@ -130,8 +130,10 @@ export function buildPiTurnExtraArgs(
130
130
  // Envelope assembly = projectActivationFlags; pi only renders argv pairs.
131
131
  ...activationFlagsToPiArgv(projectActivationFlags(request)),
132
132
  ...piEngineModelArgs(request),
133
+ // #1182: text single-shot keeps pi's native assistant error/aborted
134
+ // exit (stderr + exit 1). json mode never takes that failure branch.
133
135
  "--mode",
134
- "json",
136
+ "text",
135
137
  ...buildSeatModelCliArgs(request.model),
136
138
  ];
137
139
  }
@@ -1937,7 +1937,10 @@ export async function materializeCountersignInvocation(
1937
1937
  );
1938
1938
  }
1939
1939
 
1940
- /** Load the admitted section written at admission (Navigator work-context seam). */
1940
+ /**
1941
+ * Load the admitted section written at admission (Navigator work-context seam).
1942
+ * Missing / wrong-shape → undefined. Control-plane read faults propagate (#1187 F2).
1943
+ */
1941
1944
  export async function loadAdmittedJudgeRequest(
1942
1945
  runDirectory: string,
1943
1946
  ): Promise<{
@@ -1945,24 +1948,21 @@ export async function loadAdmittedJudgeRequest(
1945
1948
  instructionEmpty: boolean;
1946
1949
  attachments: readonly AdmittedAttachment[];
1947
1950
  } | undefined> {
1948
- try {
1949
- const record = readPageSync(runDirectory, "admitted");
1950
- if (record === undefined) return undefined;
1951
- if (!packagedPublicInstructionSubject(record.role)) return undefined;
1952
- if (typeof record.instruction !== "string") return undefined;
1953
- if (typeof record.instructionEmpty !== "boolean") return undefined;
1954
- if (!Array.isArray(record.attachments)) return undefined;
1955
- const attachments = record.attachments
1956
- .map((item) => normalizeAdmittedAttachment(item))
1957
- .filter((item): item is AdmittedAttachment => item !== undefined);
1958
- return {
1959
- instruction: record.instruction,
1960
- instructionEmpty: record.instructionEmpty,
1961
- attachments,
1962
- };
1963
- } catch {
1964
- return undefined;
1965
- }
1951
+ const record = readPageSync(runDirectory, "admitted");
1952
+ if (record === undefined) return undefined;
1953
+ if (!packagedPublicInstructionSubject(record.role)) return undefined;
1954
+ if (typeof record.instruction !== "string") return undefined;
1955
+ if (typeof record.instructionEmpty !== "boolean") return undefined;
1956
+ if (!Array.isArray(record.attachments)) return undefined;
1957
+ const attachments = record.attachments
1958
+ .map((item) => normalizeAdmittedAttachment(item))
1959
+ .filter((item): item is AdmittedAttachment => item !== undefined);
1960
+ return {
1961
+ instruction: record.instruction,
1962
+ instructionEmpty: record.instructionEmpty,
1963
+ attachments,
1964
+ };
1965
+
1966
1966
  }
1967
1967
 
1968
1968
  export type AdmitFixerInvocationOptions = {
@@ -58,8 +58,6 @@ export function createRoleRuntimeDependencies(packageRoot: string): RoleRuntimeD
58
58
  role: options.role,
59
59
  phase: options.phase,
60
60
  subjectKey: options.subjectKey,
61
- subject: options.subject,
62
- authority: options.authority,
63
61
  invocationId: options.invocationId,
64
62
  createSession: navigatorSessionFactory,
65
63
  ...(options.deliveryRequestLimit === undefined ? {} : { deliveryRequestLimit: options.deliveryRequestLimit }),
@@ -467,7 +467,7 @@ export type RoleRuntimeDependencies = {
467
467
  loadNotarySourceRun?(path: string): Promise<import("./notary-contracts.ts").NotarySourceRunLocator>;
468
468
  loadDoctorCase?(path: string): Promise<import("./doctor-contracts.ts").DoctorCase>;
469
469
  loadMergerInput?(path: string): Promise<unknown>;
470
- createNavigatorAttendance?(options: { context: HostContext; role: string; phase: NavigatorPhase; subjectKey: string; subject: string; authority: string; contextError?: unknown; invocationId: string; deliveryRequestLimit?: number; onEvent: (event: import("./navigator-attendance.ts").NavigatorEvent, report: import("./navigator-attendance.ts").NavigatorReport) => void | Promise<void> }): NavigatorAttendanceDependency | Promise<NavigatorAttendanceDependency>;
470
+ createNavigatorAttendance?(options: { context: HostContext; role: string; phase: NavigatorPhase; subjectKey: string; contextError?: unknown; invocationId: string; deliveryRequestLimit?: number; onEvent: (event: import("./navigator-attendance.ts").NavigatorEvent, report: import("./navigator-attendance.ts").NavigatorReport) => void | Promise<void> }): NavigatorAttendanceDependency | Promise<NavigatorAttendanceDependency>;
471
471
  loadNavigatorWorkContext?(options: { context: HostContext; role: string; phase: NavigatorPhase; getFlag?: (name: string) => unknown }): Promise<NavigatorWorkContext>;
472
472
  activationClock?(): string;
473
473
  activationTraceWriter?: (record: ActivationTraceRecord) => void | Promise<void>;
@@ -1185,22 +1185,15 @@ export function createRoleRuntimeExtension(
1185
1185
  // Soft session_start placeholders (no materials yet) recover here; hard
1186
1186
  // contextError from true loader failures stays poisoned and honest.
1187
1187
  if (navigatorWorkContext.subjectProvenance === "placeholder") {
1188
- // Navigator's own input bootstrap, not a rewrite of another role's
1189
- // output payload (#836 targets the latter): the human's own raw
1190
- // prompt bytes, copied verbatim into Navigator's work context when
1191
- // nothing else has supplied a subject yet.
1188
+ // Navigator's own input bootstrap (#836): human prompt bytes key the
1189
+ // identity when nothing else has supplied a concrete subject yet.
1190
+ // Auto prepare stays identity-only — no subject/authority material copy.
1192
1191
  const subject = prompt.trim();
1193
1192
  if (subject !== "") {
1194
1193
  const root = subjectPath(ctx.sessionManager.getSessionDir(), ctx.cwd);
1195
1194
  const subjectProvenance = "user_prompt" satisfies NavigatorSubjectProvenance;
1196
- const priorAuthority = navigatorWorkContext.authority;
1197
- const authority = typeof priorAuthority === "string" && priorAuthority.trim() !== ""
1198
- ? priorAuthority
1199
- : subject;
1200
1195
  navigatorWorkContext = {
1201
1196
  subjectKey: navigatorSubjectKey(root, subject, subjectProvenance),
1202
- subject,
1203
- authority,
1204
1197
  subjectProvenance,
1205
1198
  };
1206
1199
  await navigatorAttendance.setWorkContext(navigatorWorkContext);
@@ -1712,7 +1705,7 @@ export function createRoleRuntimeExtension(
1712
1705
  if (dependencies.loadNavigatorWorkContext === undefined) {
1713
1706
  const fallbackSubjectKey = subjectPath(ctx.sessionManager.getSessionDir(), ctx.cwd);
1714
1707
  contextError = new Error("Navigator work context loader is not configured");
1715
- work = { subjectKey: fallbackSubjectKey, subject: `work subject: ${fallbackSubjectKey}`, authority: "", subjectProvenance: "placeholder" };
1708
+ work = { subjectKey: fallbackSubjectKey, subjectProvenance: "placeholder" };
1716
1709
  } else {
1717
1710
  try {
1718
1711
  work = await dependencies.loadNavigatorWorkContext({
@@ -1726,7 +1719,7 @@ export function createRoleRuntimeExtension(
1726
1719
  // Contract: README.md#Navigator-attendance — a failed context load continues with a typed placeholder work context; the original cause is retained in contextError for the typed unavailable report.
1727
1720
  contextError = navigatorUnavailableError("context", error);
1728
1721
  const fallbackSubjectKey = subjectPath(ctx.sessionManager.getSessionDir(), ctx.cwd);
1729
- work = { subjectKey: fallbackSubjectKey, subject: `work subject: ${fallbackSubjectKey}`, authority: "", subjectProvenance: "placeholder" };
1722
+ work = { subjectKey: fallbackSubjectKey, subjectProvenance: "placeholder" };
1730
1723
  }
1731
1724
  }
1732
1725
  navigatorWorkContext = { ...work, ...(contextError === undefined ? {} : { contextError }) };
@@ -1765,8 +1758,6 @@ export function createRoleRuntimeExtension(
1765
1758
  role: entry.role,
1766
1759
  phase: invocationPhase,
1767
1760
  subjectKey: work.subjectKey,
1768
- subject: work.subject,
1769
- authority: work.authority,
1770
1761
  invocationId,
1771
1762
  deliveryRequestLimit: deliveryLimit,
1772
1763
  ...(contextError === undefined ? {} : { contextError }),