@akagilnc/pi-workflow-roles 0.1.3733 → 0.1.3741

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.
@@ -6072,7 +6072,7 @@ var init_option_definitions = __esm({
6072
6072
  },
6073
6073
  config: {
6074
6074
  command: "config",
6075
- summary: "Persistent seat model, labor-engine, host, and auto-resume defaults.",
6075
+ summary: "Persistent seat model, labor-engine, host, and auto-resume defaults. Host providers live in ~/.ak-roles/host-providers.json (owner-edited).",
6076
6076
  usage: [
6077
6077
  "ak-role config set <seat> <provider/model[:thinking]> [<seat> <spec> ...]",
6078
6078
  "ak-role config unset <gatekeeper|inspector|notary>",
@@ -6080,17 +6080,14 @@ var init_option_definitions = __esm({
6080
6080
  "ak-role config unset-engine <seat>",
6081
6081
  "ak-role config set-host <seat> <name>",
6082
6082
  "ak-role config unset-host <seat>",
6083
- "ak-role config set-auto-resume-limit <N>",
6084
- "ak-role config set-provider-alias <provider> <host> <alias>",
6085
- "ak-role config unset-provider-alias <provider> <host>"
6083
+ "ak-role config set-auto-resume-limit <N>"
6086
6084
  ],
6087
6085
  examples: [
6088
6086
  "ak-role config set judge openai-codex/gpt-5.6-sol:high",
6089
6087
  "ak-role config unset gatekeeper",
6090
6088
  "ak-role config set-engine judge opus",
6091
6089
  "ak-role config set-host judge grok-build",
6092
- "ak-role config set-auto-resume-limit 3",
6093
- "ak-role config set-provider-alias xai hermes xai-oauth"
6090
+ "ak-role config set-auto-resume-limit 3"
6094
6091
  ]
6095
6092
  },
6096
6093
  help: {
@@ -8464,6 +8461,182 @@ var init_load_production_acp_host = __esm({
8464
8461
  }
8465
8462
  });
8466
8463
 
8464
+ // src/public-cli/host-providers.ts
8465
+ var host_providers_exports = {};
8466
+ __export(host_providers_exports, {
8467
+ HostProviderResolutionError: () => HostProviderResolutionError,
8468
+ hermesProviderModelsCachePath: () => hermesProviderModelsCachePath,
8469
+ hostCatalogOffersModel: () => hostCatalogOffersModel,
8470
+ hostProvidersPath: () => hostProvidersPath,
8471
+ listHermesProvidersForModel: () => listHermesProvidersForModel,
8472
+ loadHostProvidersTable: () => loadHostProvidersTable,
8473
+ parseHostProvidersTable: () => parseHostProvidersTable,
8474
+ projectHostFacingProvider: () => projectHostFacingProvider,
8475
+ renderHostProvidersTable: () => renderHostProvidersTable
8476
+ });
8477
+ import { readFileSync as readFileSync2 } from "node:fs";
8478
+ import { join as join15 } from "node:path";
8479
+ function hostProvidersPath(home) {
8480
+ if (typeof home !== "string" || home.trim() === "") {
8481
+ throw new Error("home must be explicitly provided");
8482
+ }
8483
+ return join15(home, ".ak-roles", "host-providers.json");
8484
+ }
8485
+ function hermesProviderModelsCachePath(home) {
8486
+ return join15(home, ".hermes", "provider_models_cache.json");
8487
+ }
8488
+ function parseHostProvidersTable(value) {
8489
+ if (value === null || typeof value !== "object" || Array.isArray(value)) {
8490
+ throw new Error("host-providers.json must be an object");
8491
+ }
8492
+ const out = {};
8493
+ for (const [host, byProvider] of Object.entries(value)) {
8494
+ if (host.trim() === "") {
8495
+ throw new Error("host-providers.json host key must be non-empty");
8496
+ }
8497
+ if (byProvider === null || typeof byProvider !== "object" || Array.isArray(byProvider)) {
8498
+ throw new Error(`host-providers.json[${host}] must be an object`);
8499
+ }
8500
+ const providers = {};
8501
+ for (const [seatProvider, hostProvider] of Object.entries(
8502
+ byProvider
8503
+ )) {
8504
+ if (seatProvider.trim() === "") {
8505
+ throw new Error(
8506
+ `host-providers.json[${host}] seat-provider key must be non-empty`
8507
+ );
8508
+ }
8509
+ if (typeof hostProvider !== "string" || hostProvider.trim() === "") {
8510
+ throw new Error(
8511
+ `host-providers.json[${host}][${seatProvider}] must be a non-empty string`
8512
+ );
8513
+ }
8514
+ providers[seatProvider] = hostProvider;
8515
+ }
8516
+ if (Object.keys(providers).length > 0) {
8517
+ out[host] = providers;
8518
+ }
8519
+ }
8520
+ return out;
8521
+ }
8522
+ function loadHostProvidersTable(home) {
8523
+ const path = hostProvidersPath(home);
8524
+ try {
8525
+ const raw = readFileSync2(path, "utf8");
8526
+ return parseHostProvidersTable(JSON.parse(raw));
8527
+ } catch (error) {
8528
+ if (error instanceof Error && "code" in error && error.code === "ENOENT") {
8529
+ return {};
8530
+ }
8531
+ throw error;
8532
+ }
8533
+ }
8534
+ function hostCatalogOffersModel(catalogModels, seatModel) {
8535
+ return catalogModels.some(
8536
+ (entry) => entry === seatModel || entry.endsWith(`/${seatModel}`)
8537
+ );
8538
+ }
8539
+ function listHermesProvidersForModel(home, seatModel) {
8540
+ const path = hermesProviderModelsCachePath(home);
8541
+ let text;
8542
+ try {
8543
+ text = readFileSync2(path, "utf8");
8544
+ } catch (error) {
8545
+ if (error instanceof Error && "code" in error && error.code === "ENOENT") {
8546
+ return [];
8547
+ }
8548
+ throw error;
8549
+ }
8550
+ const raw = JSON.parse(text);
8551
+ if (raw === null || typeof raw !== "object" || Array.isArray(raw)) {
8552
+ throw new Error(
8553
+ `hermes provider_models_cache.json must be an object: ${path}`
8554
+ );
8555
+ }
8556
+ const found = [];
8557
+ for (const [provider, entry] of Object.entries(raw)) {
8558
+ if (entry === null || typeof entry !== "object" || Array.isArray(entry)) {
8559
+ continue;
8560
+ }
8561
+ const models = entry.models;
8562
+ if (!Array.isArray(models)) continue;
8563
+ const names = models.filter((m) => typeof m === "string");
8564
+ if (hostCatalogOffersModel(names, seatModel)) {
8565
+ found.push(provider);
8566
+ }
8567
+ }
8568
+ return found.sort();
8569
+ }
8570
+ function listDirectoryProvidersForModel(home, host, seatModel) {
8571
+ if (host === "hermes") {
8572
+ return listHermesProvidersForModel(home, seatModel);
8573
+ }
8574
+ return void 0;
8575
+ }
8576
+ function projectHostFacingProvider(selection, host, table, home) {
8577
+ if (selection === void 0) return void 0;
8578
+ const mapped = table[host]?.[selection.provider];
8579
+ if (mapped !== void 0) {
8580
+ return mapped === selection.provider ? selection : { ...selection, provider: mapped };
8581
+ }
8582
+ const directory = listDirectoryProvidersForModel(home, host, selection.model);
8583
+ if (directory === void 0) {
8584
+ return selection;
8585
+ }
8586
+ if (directory.length === 1) {
8587
+ const only = directory[0];
8588
+ return only === selection.provider ? selection : { ...selection, provider: only };
8589
+ }
8590
+ if (directory.length === 0) {
8591
+ throw new HostProviderResolutionError({
8592
+ message: `host ${host} has no provider offering model ${selection.model}; seat provider was ${selection.provider}`,
8593
+ host,
8594
+ seatProvider: selection.provider,
8595
+ seatModel: selection.model
8596
+ });
8597
+ }
8598
+ throw new HostProviderResolutionError({
8599
+ message: `host ${host} has multiple providers for model ${selection.model}: ${directory.join(", ")}; set host-providers.json[${host}][${selection.provider}] to one of them`,
8600
+ host,
8601
+ seatProvider: selection.provider,
8602
+ seatModel: selection.model,
8603
+ candidates: directory
8604
+ });
8605
+ }
8606
+ function renderHostProvidersTable(table) {
8607
+ const lines = [];
8608
+ for (const host of Object.keys(table).sort()) {
8609
+ const byProvider = table[host];
8610
+ for (const seatProvider of Object.keys(byProvider).sort()) {
8611
+ lines.push(
8612
+ `hostProvider ${host} ${seatProvider} ${byProvider[seatProvider]}`
8613
+ );
8614
+ }
8615
+ }
8616
+ return lines.length === 0 ? "" : `${lines.join("\n")}
8617
+ `;
8618
+ }
8619
+ var HostProviderResolutionError;
8620
+ var init_host_providers = __esm({
8621
+ "src/public-cli/host-providers.ts"() {
8622
+ "use strict";
8623
+ HostProviderResolutionError = class extends Error {
8624
+ host;
8625
+ seatProvider;
8626
+ seatModel;
8627
+ candidates;
8628
+ constructor(options) {
8629
+ super(options.message);
8630
+ this.name = "HostProviderResolutionError";
8631
+ this.host = options.host;
8632
+ this.seatProvider = options.seatProvider;
8633
+ this.seatModel = options.seatModel;
8634
+ this.candidates = options.candidates ?? [];
8635
+ }
8636
+ };
8637
+ }
8638
+ });
8639
+
8467
8640
  // src/packaged-role-registry.ts
8468
8641
  function packagedRoleMetadata(role) {
8469
8642
  return PACKAGED_ROLE_REGISTRY.find((entry) => entry.role === role);
@@ -8854,7 +9027,6 @@ var init_institutional_resolution = __esm({
8854
9027
  var config_exports = {};
8855
9028
  __export(config_exports, {
8856
9029
  GATE_OFFICER_SEATS: () => GATE_OFFICER_SEATS,
8857
- applyProviderHostAlias: () => applyProviderHostAlias,
8858
9030
  buildSeatModelCliArgs: () => buildSeatModelCliArgs2,
8859
9031
  clearPersistentSeatConfig: () => clearPersistentSeatConfig,
8860
9032
  credentialProvidersFromAuthData: () => credentialProvidersFromAuthData,
@@ -8875,12 +9047,10 @@ __export(config_exports, {
8875
9047
  setPersistentSeatConfig: () => setPersistentSeatConfig,
8876
9048
  setPersistentSeatEngine: () => setPersistentSeatEngine,
8877
9049
  setPersistentSeatHost: () => setPersistentSeatHost,
8878
- setProviderHostAlias: () => setProviderHostAlias,
8879
- unsetProviderHostAlias: () => unsetProviderHostAlias,
8880
9050
  validatePublicCliConfigAxes: () => validatePublicCliConfigAxes
8881
9051
  });
8882
9052
  import { mkdir as mkdir2, readFile as readFile10, writeFile as writeFile5 } from "node:fs/promises";
8883
- import { dirname as dirname8, join as join15 } from "node:path";
9053
+ import { dirname as dirname8, join as join16 } from "node:path";
8884
9054
  function isGateOfficerSeat(value) {
8885
9055
  return GATE_OFFICER_SEATS.includes(value);
8886
9056
  }
@@ -8888,7 +9058,7 @@ function publicCliConfigPath(home) {
8888
9058
  if (typeof home !== "string" || home.trim() === "") {
8889
9059
  throw new Error("home must be explicitly provided");
8890
9060
  }
8891
- return join15(home, ".ak-roles", "public-cli.json");
9061
+ return join16(home, ".ak-roles", "public-cli.json");
8892
9062
  }
8893
9063
  async function loadPublicCliConfig(home) {
8894
9064
  const path = publicCliConfigPath(home);
@@ -9004,50 +9174,6 @@ function parseAutoResumeLimit(value) {
9004
9174
  function setAutoResumeLimit(config, limit) {
9005
9175
  return { ...config, autoResumeLimit: parseAutoResumeLimit(limit) };
9006
9176
  }
9007
- function requireNonEmptyToken(value, label) {
9008
- const trimmed = value.trim();
9009
- if (trimmed === "") {
9010
- throw new Error(`${label} must be a non-empty string`);
9011
- }
9012
- return trimmed;
9013
- }
9014
- function setProviderHostAlias(config, provider, host, alias) {
9015
- const from = requireNonEmptyToken(provider, "provider");
9016
- const hostName = requireNonEmptyToken(host, "host");
9017
- const to = requireNonEmptyToken(alias, "alias");
9018
- const previous = config.providerAliases ?? {};
9019
- return {
9020
- ...config,
9021
- providerAliases: {
9022
- ...previous,
9023
- [from]: {
9024
- ...previous[from] ?? {},
9025
- [hostName]: to
9026
- }
9027
- }
9028
- };
9029
- }
9030
- function unsetProviderHostAlias(config, provider, host) {
9031
- const from = requireNonEmptyToken(provider, "provider");
9032
- const hostName = requireNonEmptyToken(host, "host");
9033
- const previous = config.providerAliases;
9034
- if (previous === void 0 || previous[from] === void 0) return config;
9035
- const { [hostName]: _dropped, ...restHosts } = previous[from];
9036
- const nextForProvider = Object.keys(restHosts).length === 0 ? void 0 : restHosts;
9037
- const { [from]: _provider, ...restProviders } = previous;
9038
- const nextAliases = nextForProvider === void 0 ? restProviders : { ...restProviders, [from]: nextForProvider };
9039
- if (Object.keys(nextAliases).length === 0) {
9040
- const { providerAliases: _gone, ...rest } = config;
9041
- return rest;
9042
- }
9043
- return { ...config, providerAliases: nextAliases };
9044
- }
9045
- function applyProviderHostAlias(selection, host, aliases) {
9046
- if (selection === void 0 || aliases === void 0) return selection;
9047
- const mapped = aliases[selection.provider]?.[host];
9048
- if (mapped === void 0) return selection;
9049
- return { ...selection, provider: mapped };
9050
- }
9051
9177
  function validatePublicCliConfigAxes(config, _packageRoot) {
9052
9178
  for (const seat of Object.keys(config.seats)) {
9053
9179
  const row = config.seats[seat];
@@ -9117,44 +9243,9 @@ function serializePublicCliConfig(config) {
9117
9243
  ...config.unknownSeats ?? {},
9118
9244
  ...config.seats
9119
9245
  },
9120
- ...config.autoResumeLimit === void 0 ? {} : { autoResumeLimit: config.autoResumeLimit },
9121
- ...config.providerAliases === void 0 || Object.keys(config.providerAliases).length === 0 ? {} : { providerAliases: config.providerAliases }
9246
+ ...config.autoResumeLimit === void 0 ? {} : { autoResumeLimit: config.autoResumeLimit }
9122
9247
  };
9123
9248
  }
9124
- function parseProviderHostAliases(value) {
9125
- if (value === null || typeof value !== "object" || Array.isArray(value)) {
9126
- throw new Error("public CLI config.providerAliases must be an object");
9127
- }
9128
- const out = {};
9129
- for (const [provider, byHost] of Object.entries(value)) {
9130
- if (provider.trim() === "") {
9131
- throw new Error("public CLI config.providerAliases provider key must be non-empty");
9132
- }
9133
- if (byHost === null || typeof byHost !== "object" || Array.isArray(byHost)) {
9134
- throw new Error(
9135
- `public CLI config.providerAliases[${provider}] must be an object`
9136
- );
9137
- }
9138
- const hosts = {};
9139
- for (const [host, alias] of Object.entries(byHost)) {
9140
- if (host.trim() === "") {
9141
- throw new Error(
9142
- `public CLI config.providerAliases[${provider}] host key must be non-empty`
9143
- );
9144
- }
9145
- if (typeof alias !== "string" || alias.trim() === "") {
9146
- throw new Error(
9147
- `public CLI config.providerAliases[${provider}][${host}] must be a non-empty string`
9148
- );
9149
- }
9150
- hosts[host] = alias;
9151
- }
9152
- if (Object.keys(hosts).length > 0) {
9153
- out[provider] = hosts;
9154
- }
9155
- }
9156
- return out;
9157
- }
9158
9249
  function parsePublicCliConfig(value) {
9159
9250
  if (value === null || typeof value !== "object" || Array.isArray(value)) {
9160
9251
  throw new Error("public CLI config must be an object");
@@ -9164,13 +9255,6 @@ function parsePublicCliConfig(value) {
9164
9255
  if (record4.autoResumeLimit !== void 0) {
9165
9256
  autoResumeLimit = parseAutoResumeLimit(record4.autoResumeLimit);
9166
9257
  }
9167
- let providerAliases;
9168
- if (record4.providerAliases !== void 0) {
9169
- const parsed = parseProviderHostAliases(record4.providerAliases);
9170
- if (Object.keys(parsed).length > 0) {
9171
- providerAliases = parsed;
9172
- }
9173
- }
9174
9258
  const unknownSeats = {};
9175
9259
  if (record4.unknownSeats !== void 0) {
9176
9260
  if (record4.unknownSeats === null || typeof record4.unknownSeats !== "object" || Array.isArray(record4.unknownSeats)) {
@@ -9181,7 +9265,6 @@ function parsePublicCliConfig(value) {
9181
9265
  const withOpaque = (seats2) => ({
9182
9266
  seats: seats2,
9183
9267
  ...autoResumeLimit === void 0 ? {} : { autoResumeLimit },
9184
- ...providerAliases === void 0 ? {} : { providerAliases },
9185
9268
  ...Object.keys(unknownSeats).length === 0 ? {} : { unknownSeats }
9186
9269
  });
9187
9270
  if (record4.seats === void 0) {
@@ -9358,21 +9441,11 @@ function resolveEffectiveSeat(config, seat, credentials, invocation) {
9358
9441
  };
9359
9442
  }
9360
9443
  }
9361
- const withAxes = attachHostAxis(
9444
+ return attachHostAxis(
9362
9445
  attachEngineAxis(modelSeat, config, invocation),
9363
9446
  config,
9364
9447
  invocation
9365
9448
  );
9366
- const selection = applyProviderHostAlias(
9367
- withAxes.selection,
9368
- withAxes.host,
9369
- config.providerAliases
9370
- );
9371
- if (selection === void 0) {
9372
- const { selection: _dropped, ...rest } = withAxes;
9373
- return rest;
9374
- }
9375
- return { ...withAxes, selection };
9376
9449
  }
9377
9450
  function effectiveSeatConfigurations(config, credentials, invocation) {
9378
9451
  return PUBLIC_CONFIGURABLE_SEATS.map(
@@ -9394,7 +9467,7 @@ function credentialProvidersFromAuthData(data) {
9394
9467
  }
9395
9468
  async function loadCredentialProviders(agentDir) {
9396
9469
  try {
9397
- const raw = await readFile10(join15(agentDir, "auth.json"), "utf8");
9470
+ const raw = await readFile10(join16(agentDir, "auth.json"), "utf8");
9398
9471
  return credentialProvidersFromAuthData(JSON.parse(raw));
9399
9472
  } catch (error) {
9400
9473
  if (error instanceof Error && "code" in error && error.code === "ENOENT") {
@@ -9536,7 +9609,7 @@ var init_ticket_provenance_contracts = __esm({
9536
9609
  // src/ticket-provenance.ts
9537
9610
  import { createHash as createHash5 } from "node:crypto";
9538
9611
  import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync3, writeFileSync as writeFileSync3 } from "node:fs";
9539
- import { join as join16 } from "node:path";
9612
+ import { join as join17 } from "node:path";
9540
9613
  function ticketProvenanceSubject(ticketNumber) {
9541
9614
  if (!Number.isSafeInteger(ticketNumber) || ticketNumber < 1) {
9542
9615
  throw new Error(`ticket-provenance subject requires a positive ticket number, got ${String(ticketNumber)}`);
@@ -9594,7 +9667,7 @@ function resolveTicketProvenanceVolume(ticketNumber, cwd, home) {
9594
9667
  return {
9595
9668
  recordFile: path.recordFile,
9596
9669
  volumeDir: path.sessionDir,
9597
- humanViewFile: join16(path.sessionDir, TICKET_PROVENANCE_HUMAN_VIEW)
9670
+ humanViewFile: join17(path.sessionDir, TICKET_PROVENANCE_HUMAN_VIEW)
9598
9671
  };
9599
9672
  }
9600
9673
  async function readTicketProvenance(ticketNumber, cwd, home) {
@@ -9738,7 +9811,7 @@ var init_case_dossier_delivery = __esm({
9738
9811
 
9739
9812
  // src/host-transition-prior-native.ts
9740
9813
  import { access as access2, readdir as readdir3 } from "node:fs/promises";
9741
- import { dirname as dirname9, join as join17 } from "node:path";
9814
+ import { dirname as dirname9, join as join18 } from "node:path";
9742
9815
  function isEnoent2(error) {
9743
9816
  return typeof error === "object" && error !== null && error.code === "ENOENT";
9744
9817
  }
@@ -9763,7 +9836,7 @@ async function listSitianRecordPaths(sessionParent) {
9763
9836
  const recordPaths = [];
9764
9837
  for (const entry of entries) {
9765
9838
  if (!entry.isDirectory()) continue;
9766
- const recordFile = join17(sessionRoot, entry.name, "records.jsonl");
9839
+ const recordFile = join18(sessionRoot, entry.name, "records.jsonl");
9767
9840
  try {
9768
9841
  await access2(recordFile);
9769
9842
  recordPaths.push(recordFile);
@@ -9830,7 +9903,7 @@ var init_public_run_credentials = __esm({
9830
9903
  });
9831
9904
 
9832
9905
  // src/run-terminal-artifacts.ts
9833
- import { basename as basename6, dirname as dirname10, join as join18 } from "node:path";
9906
+ import { basename as basename6, dirname as dirname10, join as join19 } from "node:path";
9834
9907
  function runIdFromRunDirectory(runDirectory) {
9835
9908
  const name = basename6(runDirectory);
9836
9909
  const at = name.lastIndexOf("@");
@@ -10234,7 +10307,7 @@ var init_ledger_session_read = __esm({
10234
10307
 
10235
10308
  // src/analyst-gate-cycles-read.ts
10236
10309
  import { readdir as readdir4 } from "node:fs/promises";
10237
- import { join as join19 } from "node:path";
10310
+ import { join as join20 } from "node:path";
10238
10311
  function isRecord13(value) {
10239
10312
  return typeof value === "object" && value !== null && !Array.isArray(value);
10240
10313
  }
@@ -10496,7 +10569,7 @@ async function readAnalystGateCyclesFromAuditorRoles(auditorRolesDirectory, opti
10496
10569
  throw error;
10497
10570
  }
10498
10571
  for (const name of names) {
10499
- const path = join19(directory, name);
10572
+ const path = join20(directory, name);
10500
10573
  const fromPointer = name.endsWith(".pointer.json");
10501
10574
  const sessionPath = fromPointer ? await resolveOfficerSessionFromPointerFile(path) : path;
10502
10575
  if (sessionPath === void 0) continue;
@@ -10540,12 +10613,12 @@ var init_analyst_gate_cycles_read = __esm({
10540
10613
  // src/session-opening-materials.ts
10541
10614
  import { existsSync as existsSync6 } from "node:fs";
10542
10615
  import { readFile as readFile12 } from "node:fs/promises";
10543
- import { dirname as dirname11, join as join20 } from "node:path";
10616
+ import { dirname as dirname11, join as join21 } from "node:path";
10544
10617
  import { fileURLToPath, pathToFileURL as pathToFileURL2 } from "node:url";
10545
10618
  function resolvePackageRootDir(moduleUrl = import.meta.url) {
10546
10619
  let dir = dirname11(fileURLToPath(moduleUrl));
10547
10620
  for (let i = 0; i < 8; i += 1) {
10548
- if (existsSync6(join20(dir, "package.json")) && existsSync6(join20(dir, "souls"))) {
10621
+ if (existsSync6(join21(dir, "package.json")) && existsSync6(join21(dir, "souls"))) {
10549
10622
  return dir;
10550
10623
  }
10551
10624
  const parent = dirname11(dir);
@@ -11417,12 +11490,12 @@ var init_reviewer_dispatch = __esm({
11417
11490
  // src/public-cli/reviewer-dispatch-rejection.ts
11418
11491
  import { writeFileSync as writeFileSync4 } from "node:fs";
11419
11492
  import { readFile as readFile13, unlink as unlink3 } from "node:fs/promises";
11420
- import { join as join21 } from "node:path";
11493
+ import { join as join22 } from "node:path";
11421
11494
  function isReviewerPreflightViolation(value) {
11422
11495
  return typeof value === "string" && REVIEWER_PREFLIGHT_VIOLATIONS.includes(value);
11423
11496
  }
11424
11497
  function reviewerDispatchRejectionPath(runDirectory) {
11425
- return join21(runDirectory, REVIEWER_DISPATCH_REJECTION_FILE);
11498
+ return join22(runDirectory, REVIEWER_DISPATCH_REJECTION_FILE);
11426
11499
  }
11427
11500
  function recordReviewerDispatchRejectionSync(runDirectory, rejection) {
11428
11501
  writeFileSync4(
@@ -12588,7 +12661,7 @@ var init_collector_ledger = __esm({
12588
12661
  // src/package-resources/method-skill.ts
12589
12662
  import { createHash as createHash7 } from "node:crypto";
12590
12663
  import { readFile as readFile14, realpath as realpath7 } from "node:fs/promises";
12591
- import { join as join22 } from "node:path";
12664
+ import { join as join23 } from "node:path";
12592
12665
  function gitBlobOid(bytes) {
12593
12666
  const body = typeof bytes === "string" ? Buffer.from(bytes, "utf8") : Buffer.from(bytes);
12594
12667
  const header = Buffer.from(`blob ${body.byteLength}\0`, "utf8");
@@ -12605,10 +12678,10 @@ function packagedMethodSkillRelativeDirectory(name) {
12605
12678
  return `${METHOD_SKILL_RELATIVE_ROOT}/${name}`;
12606
12679
  }
12607
12680
  function resolvePackagedMethodSkillRoot(packageRoot, name) {
12608
- return join22(packageRoot, packagedMethodSkillRelativeDirectory(name));
12681
+ return join23(packageRoot, packagedMethodSkillRelativeDirectory(name));
12609
12682
  }
12610
12683
  function resolvePackagedMethodSkillPath(packageRoot, name) {
12611
- return join22(resolvePackagedMethodSkillRoot(packageRoot, name), "SKILL.md");
12684
+ return join23(resolvePackagedMethodSkillRoot(packageRoot, name), "SKILL.md");
12612
12685
  }
12613
12686
  function isRecord14(value) {
12614
12687
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -12702,8 +12775,8 @@ function parseProvenance(raw, expectedName) {
12702
12775
  }
12703
12776
  async function loadPackagedMethodSkillMaterial(packageRoot, name) {
12704
12777
  const rootDirectory = resolvePackagedMethodSkillRoot(packageRoot, name);
12705
- const skillPathConfigured = join22(rootDirectory, "SKILL.md");
12706
- const provenancePath = join22(rootDirectory, "provenance.json");
12778
+ const skillPathConfigured = join23(rootDirectory, "SKILL.md");
12779
+ const provenancePath = join23(rootDirectory, "provenance.json");
12707
12780
  let provenanceRaw;
12708
12781
  try {
12709
12782
  provenanceRaw = await readFile14(provenancePath, "utf8");
@@ -12720,7 +12793,7 @@ async function loadPackagedMethodSkillMaterial(packageRoot, name) {
12720
12793
  }
12721
12794
  const provenance = parseProvenance(provenanceJson, name);
12722
12795
  for (const [rel, expected] of Object.entries(provenance.files)) {
12723
- const absolute = join22(rootDirectory, rel);
12796
+ const absolute = join23(rootDirectory, rel);
12724
12797
  let bytes;
12725
12798
  try {
12726
12799
  bytes = await readFile14(absolute);
@@ -13236,7 +13309,7 @@ var init_terminal = __esm({
13236
13309
  // src/public-cli/settlement.ts
13237
13310
  import { randomUUID as randomUUID3 } from "node:crypto";
13238
13311
  import { appendFile as appendFile2, readFile as readFile15, readdir as readdir5, writeFile as writeFile6 } from "node:fs/promises";
13239
- import { dirname as dirname12, join as join23 } from "node:path";
13312
+ import { dirname as dirname12, join as join24 } from "node:path";
13240
13313
  function sealedLedgerHome(admitted) {
13241
13314
  return homeFromRunDirectory(admitted.runDirectory);
13242
13315
  }
@@ -13632,7 +13705,7 @@ async function readSessionProviderStop(sessionFile) {
13632
13705
  }
13633
13706
  }
13634
13707
  async function readBoundEvidenceChildKnownFailure(sessionFile) {
13635
- const childDirectory = join23(dirname12(sessionFile), "evidence-children");
13708
+ const childDirectory = join24(dirname12(sessionFile), "evidence-children");
13636
13709
  let names;
13637
13710
  try {
13638
13711
  names = await readdir5(childDirectory);
@@ -13643,7 +13716,7 @@ async function readBoundEvidenceChildKnownFailure(sessionFile) {
13643
13716
  for (const file of names.filter((name) => name.endsWith(".jsonl")).sort().reverse()) {
13644
13717
  let entries;
13645
13718
  try {
13646
- entries = await readBoundSessionEntries(join23(childDirectory, file));
13719
+ entries = await readBoundSessionEntries(join24(childDirectory, file));
13647
13720
  } catch (error) {
13648
13721
  throw sessionReadFailure(error, "failed to read discovered evidence-child session");
13649
13722
  }
@@ -13697,7 +13770,7 @@ async function loadBoundAuditorVolumes(sessionFile) {
13697
13770
  latestParentUserIndex = i;
13698
13771
  break;
13699
13772
  }
13700
- const childDirectories = [join23(dirname12(sessionFile), "auditor-roles")];
13773
+ const childDirectories = [join24(dirname12(sessionFile), "auditor-roles")];
13701
13774
  const valid = [];
13702
13775
  let sawAnyDirectory = false;
13703
13776
  for (const childDirectory of childDirectories) {
@@ -13712,7 +13785,7 @@ async function loadBoundAuditorVolumes(sessionFile) {
13712
13785
  for (const file of names.filter((name) => name.endsWith(".jsonl")).sort().reverse()) {
13713
13786
  let entries;
13714
13787
  try {
13715
- entries = await readBoundSessionEntries(join23(childDirectory, file));
13788
+ entries = await readBoundSessionEntries(join24(childDirectory, file));
13716
13789
  } catch (error) {
13717
13790
  throw sessionReadFailure(error, "failed to read discovered auditor session");
13718
13791
  }
@@ -14212,8 +14285,8 @@ function projectTerminalGateFact(rounds) {
14212
14285
  };
14213
14286
  }
14214
14287
  async function extractGateFactFromSessionDirectory(sessionDirectory, options = {}) {
14215
- const directories = [join23(sessionDirectory, "auditor-roles")];
14216
- const parentSessionFile = options.parentSessionFile ?? join23(sessionDirectory, "session.jsonl");
14288
+ const directories = [join24(sessionDirectory, "auditor-roles")];
14289
+ const parentSessionFile = options.parentSessionFile ?? join24(sessionDirectory, "session.jsonl");
14217
14290
  const rounds = await readAnalystGateCyclesFromAuditorRoles(directories, {
14218
14291
  parentSessionFile
14219
14292
  });
@@ -14311,8 +14384,8 @@ async function extractNavigatorFactFromAdmittedSession(sessionFile) {
14311
14384
  async function publishJudgeArtifacts(admitted, roleOutcome, coordinates) {
14312
14385
  await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
14313
14386
  const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
14314
- const reportPath = join23(artifactsDir, "report.json");
14315
- const evidencePath = join23(artifactsDir, "evidence.json");
14387
+ const reportPath = join24(artifactsDir, "report.json");
14388
+ const evidencePath = join24(artifactsDir, "evidence.json");
14316
14389
  await writeFile6(
14317
14390
  reportPath,
14318
14391
  `${JSON.stringify(
@@ -14402,8 +14475,8 @@ async function trySettleJudgeTerminalResult(admitted, authority) {
14402
14475
  async function publishDoctorArtifacts(admitted, roleOutcome, coordinates, options = {}) {
14403
14476
  await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
14404
14477
  const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
14405
- const reportPath = join23(artifactsDir, "report.json");
14406
- const evidencePath = join23(artifactsDir, "evidence.json");
14478
+ const reportPath = join24(artifactsDir, "report.json");
14479
+ const evidencePath = join24(artifactsDir, "evidence.json");
14407
14480
  await writeFile6(
14408
14481
  reportPath,
14409
14482
  `${JSON.stringify(
@@ -14636,7 +14709,7 @@ function uniqueFailureFallbackDirs(runDirectory, baseDir) {
14636
14709
  return dirs;
14637
14710
  }
14638
14711
  async function resolveFailureArtifactsBase(runDirectory) {
14639
- const artifactsDir = join23(runDirectory, "artifacts");
14712
+ const artifactsDir = join24(runDirectory, "artifacts");
14640
14713
  try {
14641
14714
  await ensureRunArtifactsDir(runDirectory);
14642
14715
  return { baseDir: artifactsDir };
@@ -14652,7 +14725,7 @@ async function writeFailureJsonRetainingCause(preferredCandidates, uniqueFallbac
14652
14725
  const candidates = [
14653
14726
  ...preferredCandidates,
14654
14727
  // One unique name per fallback dir — collisions on fixed names cannot exhaust this.
14655
- ...uniqueFallbackDirs.map((dir) => join23(dir, `${stem}.${randomUUID3()}.json`))
14728
+ ...uniqueFallbackDirs.map((dir) => join24(dir, `${stem}.${randomUUID3()}.json`))
14656
14729
  ];
14657
14730
  for (let i = 0; i < candidates.length; i += 1) {
14658
14731
  const path = candidates[i];
@@ -14697,26 +14770,26 @@ async function publishFailureArtifacts(admitted, failure2, authority) {
14697
14770
  } catch (error) {
14698
14771
  priorIssues.push(publicationAttemptFromError(sessionFile, error));
14699
14772
  }
14700
- const underArtifacts = baseDir === join23(admitted.runDirectory, "artifacts");
14773
+ const underArtifacts = baseDir === join24(admitted.runDirectory, "artifacts");
14701
14774
  const uniqueFallbackDirs = uniqueFailureFallbackDirs(
14702
14775
  admitted.runDirectory,
14703
14776
  baseDir
14704
14777
  );
14705
14778
  const errorCandidates = underArtifacts ? [
14706
- join23(baseDir, "error.json"),
14707
- join23(baseDir, "error.settlement.json"),
14708
- join23(admitted.runDirectory, "error.settlement.json")
14779
+ join24(baseDir, "error.json"),
14780
+ join24(baseDir, "error.settlement.json"),
14781
+ join24(admitted.runDirectory, "error.settlement.json")
14709
14782
  ] : [
14710
- join23(baseDir, "error.settlement.json"),
14711
- join23(baseDir, "error.json")
14783
+ join24(baseDir, "error.settlement.json"),
14784
+ join24(baseDir, "error.json")
14712
14785
  ];
14713
14786
  const evidenceCandidates = underArtifacts ? [
14714
- join23(baseDir, "evidence.json"),
14715
- join23(baseDir, "evidence.settlement.json"),
14716
- join23(admitted.runDirectory, "evidence.settlement.json")
14787
+ join24(baseDir, "evidence.json"),
14788
+ join24(baseDir, "evidence.settlement.json"),
14789
+ join24(admitted.runDirectory, "evidence.settlement.json")
14717
14790
  ] : [
14718
- join23(baseDir, "evidence.settlement.json"),
14719
- join23(baseDir, "evidence.json")
14791
+ join24(baseDir, "evidence.settlement.json"),
14792
+ join24(baseDir, "evidence.json")
14720
14793
  ];
14721
14794
  const errorPayloadBase = {
14722
14795
  kind: "error",
@@ -14987,7 +15060,7 @@ var init_settlement = __esm({
14987
15060
  import { constants as fsConstants } from "node:fs";
14988
15061
  import { randomUUID as randomUUID4 } from "node:crypto";
14989
15062
  import { lstat as lstat5, mkdir as mkdir4, open as open2 } from "node:fs/promises";
14990
- import { join as join24 } from "node:path";
15063
+ import { join as join25 } from "node:path";
14991
15064
  function presentTerminal(terminal, io) {
14992
15065
  if (terminal.roleOutcome.kind === "failure" || terminal.roleOutcome.kind === "no_receipt") {
14993
15066
  presentFailureTerminal(terminal, io);
@@ -15006,7 +15079,7 @@ async function finalizeExceptionRunBestEffort(runDirectory, io) {
15006
15079
  }
15007
15080
  }
15008
15081
  function runArtifactsDirectory(runDirectory) {
15009
- return join24(runDirectory, "artifacts");
15082
+ return join25(runDirectory, "artifacts");
15010
15083
  }
15011
15084
  async function ensureRealArtifactsDirectory(runDirectory) {
15012
15085
  const runStat = await lstat5(runDirectory);
@@ -15089,7 +15162,7 @@ function jsonSafeReplacer() {
15089
15162
  }
15090
15163
  async function retainDispatchError(admitted, principalAuthority, sessionAppender, attempt, error) {
15091
15164
  const artifactsDir = await ensureRealArtifactsDirectory(admitted.runDirectory);
15092
- const filePath = join24(
15165
+ const filePath = join25(
15093
15166
  artifactsDir,
15094
15167
  `dispatch-error-attempt-${attempt}-${randomUUID4()}.json`
15095
15168
  );
@@ -15338,7 +15411,7 @@ var init_auto_resume = __esm({
15338
15411
  // src/public-cli/post-admission.ts
15339
15412
  import { randomUUID as randomUUID5 } from "node:crypto";
15340
15413
  import { readFile as readFile16, writeFile as writeFile7 } from "node:fs/promises";
15341
- import { isAbsolute as isAbsolute7, join as join25, resolve as resolve11 } from "node:path";
15414
+ import { isAbsolute as isAbsolute7, join as join26, resolve as resolve11 } from "node:path";
15342
15415
  function appendContinuationSection(continuation, section) {
15343
15416
  const prompt = `${continuation.prompt}
15344
15417
 
@@ -15347,7 +15420,7 @@ ${section}`;
15347
15420
  }
15348
15421
  async function readInvocationHost(runDirectory) {
15349
15422
  try {
15350
- const raw = JSON.parse(await readFile16(join25(runDirectory, "invocation.json"), "utf8"));
15423
+ const raw = JSON.parse(await readFile16(join26(runDirectory, "invocation.json"), "utf8"));
15351
15424
  return typeof raw.host === "string" && raw.host.trim() !== "" ? raw.host : void 0;
15352
15425
  } catch (error) {
15353
15426
  if (error.code === "ENOENT") return void 0;
@@ -15501,7 +15574,7 @@ async function dispatchPostAdmissionTurn(input) {
15501
15574
  }
15502
15575
  try {
15503
15576
  await writeFile7(
15504
- join25(admitted.runDirectory, "stderr.log"),
15577
+ join26(admitted.runDirectory, "stderr.log"),
15505
15578
  result.stderr,
15506
15579
  "utf8"
15507
15580
  );
@@ -15610,7 +15683,7 @@ function resumeTurnRequestProjectionOptions(admitted, request, env, summonsPrepa
15610
15683
  }
15611
15684
  function isAlreadyFrozenSummonsAttachment(runDirectory, attachmentPath) {
15612
15685
  const absolute = isAbsolute7(attachmentPath) ? attachmentPath : resolve11(attachmentPath);
15613
- return pathContainedIn(join25(runDirectory, "attachments"), absolute);
15686
+ return pathContainedIn(join26(runDirectory, "attachments"), absolute);
15614
15687
  }
15615
15688
  async function prepareSummonsResumeMaterials(runDirectory, summons) {
15616
15689
  if (summons === void 0) return void 0;
@@ -16796,7 +16869,7 @@ __export(public_role_summons_exports, {
16796
16869
  summonPublicRole: () => summonPublicRole
16797
16870
  });
16798
16871
  import { existsSync as existsSync7 } from "node:fs";
16799
- import { join as join26 } from "node:path";
16872
+ import { join as join27 } from "node:path";
16800
16873
  function createCapturingIo() {
16801
16874
  const chunks = [];
16802
16875
  return {
@@ -16819,7 +16892,7 @@ function parentDir(path) {
16819
16892
  function walkPackageRoot(start) {
16820
16893
  let dir = start;
16821
16894
  for (let i = 0; i < 12; i += 1) {
16822
- if (existsSync7(join26(dir, "package.json")) && existsSync7(join26(dir, "souls"))) {
16895
+ if (existsSync7(join27(dir, "package.json")) && existsSync7(join27(dir, "souls"))) {
16823
16896
  return dir;
16824
16897
  }
16825
16898
  const parent = parentDir(dir);
@@ -16866,9 +16939,6 @@ function projectSeatEngine(seat) {
16866
16939
  function projectSeatHost(seat) {
16867
16940
  return seat.host === void 0 ? {} : { host: seat.host };
16868
16941
  }
16869
- function projectSeatModel(seat) {
16870
- return seat.selection === void 0 ? {} : { model: seat.selection };
16871
- }
16872
16942
  async function createSummonEnv(options) {
16873
16943
  const [{ piDurablePrincipalAuthority: piDurablePrincipalAuthority2 }, { appendPiSessionCustomEntry: appendPiSessionCustomEntry2, createPiRoleTurnHost: createPiRoleTurnHost2 }] = await Promise.all([
16874
16944
  Promise.resolve().then(() => (init_durable_principal(), durable_principal_exports)),
@@ -16918,6 +16988,13 @@ async function createSummonEnv(options) {
16918
16988
  }
16919
16989
  };
16920
16990
  }
16991
+ const { loadHostProvidersTable: loadHostProvidersTable2, projectHostFacingProvider: projectHostFacingProvider2 } = await Promise.resolve().then(() => (init_host_providers(), host_providers_exports));
16992
+ const hostFacingSelection = options.seat.selection === void 0 ? void 0 : projectHostFacingProvider2(
16993
+ options.seat.selection,
16994
+ hostName,
16995
+ loadHostProvidersTable2(options.home),
16996
+ options.home
16997
+ );
16921
16998
  return {
16922
16999
  home: options.home,
16923
17000
  principalAuthority,
@@ -16927,7 +17004,7 @@ async function createSummonEnv(options) {
16927
17004
  roleTurnHost,
16928
17005
  cwd: options.cwd,
16929
17006
  credentials: options.credentials,
16930
- ...projectSeatModel(options.seat),
17007
+ ...hostFacingSelection === void 0 ? {} : { model: hostFacingSelection },
16931
17008
  ...projectSeatEngine(options.seat),
16932
17009
  ...projectSeatHost(options.seat)
16933
17010
  };
@@ -16935,7 +17012,7 @@ async function createSummonEnv(options) {
16935
17012
  async function summonPublicRole(options) {
16936
17013
  const packageRoot = resolveSummonsPackageRoot(options.packageRoot);
16937
17014
  const home = await resolveSummonHome(options);
16938
- const agentDir = options.agentDir ?? process.env.PI_CODING_AGENT_DIR ?? join26(home, ".pi", "agent");
17015
+ const agentDir = options.agentDir ?? process.env.PI_CODING_AGENT_DIR ?? join27(home, ".pi", "agent");
16939
17016
  const {
16940
17017
  loadCredentialProviders: loadCredentialProviders2,
16941
17018
  loadPublicCliConfig: loadPublicCliConfig2,
@@ -17500,11 +17577,11 @@ var init_navigator_session_contracts = __esm({
17500
17577
 
17501
17578
  // src/archivist-record-topology.ts
17502
17579
  import { createHash as createHash8 } from "node:crypto";
17503
- import { join as join27 } from "node:path";
17580
+ import { join as join28 } from "node:path";
17504
17581
  function subjectKeyedRecordDirectory(input) {
17505
17582
  const ledgerHome = input.parentSessionFile !== void 0 && input.parentSessionFile.length > 0 ? resolveActivationLedgerHomeForPath(input.parentSessionFile) : resolveActivationLedgerHome(input.home);
17506
17583
  const digest = createHash8("sha256").update(input.subject).digest("hex").slice(0, 32);
17507
- return join27(
17584
+ return join28(
17508
17585
  activationBookDirectory(ledgerHome, resolveBookKeyFromGit(input.cwd)),
17509
17586
  input.kind,
17510
17587
  digest
@@ -17528,13 +17605,13 @@ __export(archivist_record_entry_exports, {
17528
17605
  createRecordSessionOpen: () => createRecordSessionOpen,
17529
17606
  subjectKeyedRecordDirectory: () => subjectKeyedRecordDirectory
17530
17607
  });
17531
- import { existsSync as existsSync9, mkdirSync as mkdirSync4, readFileSync as readFileSync2, realpathSync as realpathSync2, writeFileSync as writeFileSync5 } from "node:fs";
17532
- import { dirname as dirname13, resolve as resolve13, join as join28 } from "node:path";
17608
+ import { existsSync as existsSync9, mkdirSync as mkdirSync4, readFileSync as readFileSync3, realpathSync as realpathSync2, writeFileSync as writeFileSync5 } from "node:fs";
17609
+ import { dirname as dirname13, resolve as resolve13, join as join29 } from "node:path";
17533
17610
  import { SessionManager } from "@earendil-works/pi-coding-agent";
17534
17611
  function readCurrentSession(sessionDir) {
17535
- const ledger = join28(sessionDir, CURRENT_SESSION_LEDGER);
17612
+ const ledger = join29(sessionDir, CURRENT_SESSION_LEDGER);
17536
17613
  try {
17537
- const value = JSON.parse(readFileSync2(ledger, "utf8"));
17614
+ const value = JSON.parse(readFileSync3(ledger, "utf8"));
17538
17615
  if (typeof value !== "object" || value === null || typeof value.sessionFile !== "string" || value.sessionFile.length === 0) {
17539
17616
  throw new Error("sessionFile is missing");
17540
17617
  }
@@ -17547,7 +17624,7 @@ function readCurrentSession(sessionDir) {
17547
17624
  }
17548
17625
  }
17549
17626
  function writeCurrentSession(sessionDir, sessionFile) {
17550
- const ledger = join28(sessionDir, CURRENT_SESSION_LEDGER);
17627
+ const ledger = join29(sessionDir, CURRENT_SESSION_LEDGER);
17551
17628
  try {
17552
17629
  writeFileSync5(ledger, `${JSON.stringify({ sessionFile })}
17553
17630
  `, { flag: "wx" });
@@ -17608,7 +17685,7 @@ function createRecordSessionOpen(options) {
17608
17685
  return { session: SessionManager.inMemory(cwd), resumed: false };
17609
17686
  } else {
17610
17687
  const parentResolved = resolve13(parentFile);
17611
- sessionDir = physicallyContainedIn(ledgerHome, parentResolved) ? join28(dirname13(parentResolved), options.kind) : join28(activationBookDirectory(ledgerHome, resolveBookKeyFromGit(cwd)), options.kind);
17688
+ sessionDir = physicallyContainedIn(ledgerHome, parentResolved) ? join29(dirname13(parentResolved), options.kind) : join29(activationBookDirectory(ledgerHome, resolveBookKeyFromGit(cwd)), options.kind);
17612
17689
  parentSession = parentFile;
17613
17690
  }
17614
17691
  const nestAlreadyExists = existsSync9(sessionDir);
@@ -17647,7 +17724,7 @@ function createRecordSession(options) {
17647
17724
  return createRecordSessionOpen(options).session;
17648
17725
  }
17649
17726
  function bookDirectOfficerRunPointer(options) {
17650
- const nest = join28(dirname13(options.parentSessionFile), "auditor-roles");
17727
+ const nest = join29(dirname13(options.parentSessionFile), "auditor-roles");
17651
17728
  mkdirSync4(nest, { recursive: true });
17652
17729
  const pointer = {
17653
17730
  version: 1,
@@ -17657,7 +17734,7 @@ function bookDirectOfficerRunPointer(options) {
17657
17734
  ...options.runDirectory !== void 0 && options.runDirectory.trim() !== "" ? { runDirectory: options.runDirectory } : {}
17658
17735
  };
17659
17736
  writeFileSync5(
17660
- join28(nest, `${options.officer}.pointer.json`),
17737
+ join29(nest, `${options.officer}.pointer.json`),
17661
17738
  `${JSON.stringify(pointer)}
17662
17739
  `,
17663
17740
  "utf8"
@@ -20994,7 +21071,7 @@ var init_reviewer_role = __esm({
20994
21071
 
20995
21072
  // src/worker-submission-gates.ts
20996
21073
  import { execFileSync as execFileSync3 } from "node:child_process";
20997
- import { existsSync as existsSync10, lstatSync as lstatSync3, readdirSync as readdirSync2, readFileSync as readFileSync3, rmdirSync, rmSync } from "node:fs";
21074
+ import { existsSync as existsSync10, lstatSync as lstatSync3, readdirSync as readdirSync2, readFileSync as readFileSync4, rmdirSync, rmSync } from "node:fs";
20998
21075
  import { resolve as resolve18 } from "node:path";
20999
21076
  function git2(cwd, args) {
21000
21077
  return execFileSync3("git", args, {
@@ -21026,7 +21103,7 @@ function tryGetAll(file, key) {
21026
21103
  }
21027
21104
  function ownedHook(path) {
21028
21105
  if (!existsSync10(path)) return false;
21029
- return readFileSync3(path, "utf8").includes(HOOK_MARKER);
21106
+ return readFileSync4(path, "utf8").includes(HOOK_MARKER);
21030
21107
  }
21031
21108
  function escapeGitConfigValueRegex(value) {
21032
21109
  return value.replace(/[\\^$.*+?()[\]{}|]/g, "\\$&");
@@ -21744,8 +21821,8 @@ var init_activation_reconciliation = __esm({
21744
21821
  });
21745
21822
 
21746
21823
  // src/role-runtime.ts
21747
- import { readFileSync as readFileSync4, writeSync as writeSync4 } from "node:fs";
21748
- import { join as join30 } from "node:path";
21824
+ import { readFileSync as readFileSync5, writeSync as writeSync4 } from "node:fs";
21825
+ import { join as join31 } from "node:path";
21749
21826
  import { Value as Value5 } from "typebox/value";
21750
21827
  function decodeReviewerAdmittedInputs(getFlag) {
21751
21828
  let reviewScopeKeys;
@@ -22117,8 +22194,8 @@ function readDiaristRunCoordinates() {
22117
22194
  if (typeof runDirectory !== "string" || runDirectory.trim() === "") {
22118
22195
  throw new Error("diarist accept requires AK_ROLE_RUN_DIR");
22119
22196
  }
22120
- const admittedPath = join30(runDirectory, "admitted-request.json");
22121
- const admitted = JSON.parse(readFileSync4(admittedPath, "utf8"));
22197
+ const admittedPath = join31(runDirectory, "admitted-request.json");
22198
+ const admitted = JSON.parse(readFileSync5(admittedPath, "utf8"));
22122
22199
  if (typeof admitted.projectRoot !== "string" || admitted.projectRoot.trim() === "") {
22123
22200
  throw new Error(`diarist admitted-request missing projectRoot (${admittedPath})`);
22124
22201
  }
@@ -23360,7 +23437,7 @@ __export(in_process_session_exports, {
23360
23437
  });
23361
23438
  import { mkdtemp as mkdtemp2, rm as rm2 } from "node:fs/promises";
23362
23439
  import { tmpdir as tmpdir2 } from "node:os";
23363
- import { join as join31 } from "node:path";
23440
+ import { join as join32 } from "node:path";
23364
23441
  import {
23365
23442
  createAgentSession,
23366
23443
  DefaultResourceLoader,
@@ -23483,7 +23560,7 @@ async function openPiInProcessSession(options) {
23483
23560
  let scratchDir;
23484
23561
  let resolvedAgentDir = options.agentDir;
23485
23562
  if (resolvedAgentDir === void 0) {
23486
- scratchDir = await mkdtemp2(join31(options.credentialScratchParent ?? tmpdir2(), "ak-institutional-"));
23563
+ scratchDir = await mkdtemp2(join32(options.credentialScratchParent ?? tmpdir2(), "ak-institutional-"));
23487
23564
  resolvedAgentDir = scratchDir;
23488
23565
  }
23489
23566
  try {
@@ -24179,7 +24256,7 @@ var init_reviewer_child_executor = __esm({
24179
24256
  import { spawn as spawn4 } from "node:child_process";
24180
24257
  import { mkdtemp as mkdtemp3, rm as rm3 } from "node:fs/promises";
24181
24258
  import { tmpdir as tmpdir3 } from "node:os";
24182
- import { join as join32 } from "node:path";
24259
+ import { join as join33 } from "node:path";
24183
24260
  async function runCommand(command, args, options = {}) {
24184
24261
  return await new Promise((resolve20, reject) => {
24185
24262
  const child = spawn4(command, args, { ...options.cwd === void 0 ? {} : { cwd: options.cwd }, stdio: ["ignore", "pipe", "pipe"], signal: options.signal });
@@ -24228,8 +24305,8 @@ async function prepareSnapshot(accepted, signal, dependencies) {
24228
24305
  if (!sameReviewerPinnedTarget({ repositoryRoot: accepted.repositoryRoot, objectFormat, targetHead }, accepted)) throw new Error("Accepted Reviewer target identity no longer matches the repository");
24229
24306
  await git3(accepted.repositoryRoot, ["cat-file", "-e", `${targetHead}^{commit}`], signal);
24230
24307
  dependencies.fault?.("mirror.before-create");
24231
- mirrorRoot = await mkdtemp3(join32(tmpdir3(), "ak-reviewer-snapshot-"));
24232
- const mirrorPath = join32(mirrorRoot, "repository.git");
24308
+ mirrorRoot = await mkdtemp3(join33(tmpdir3(), "ak-reviewer-snapshot-"));
24309
+ const mirrorPath = join33(mirrorRoot, "repository.git");
24233
24310
  dependencies.fault?.("mirror.create");
24234
24311
  await runCommand("git", ["init", "--bare", `--object-format=${accepted.objectFormat}`, mirrorPath], signal === void 0 ? {} : { signal });
24235
24312
  await git3(mirrorPath, ["fetch", "--no-tags", accepted.repositoryRoot, targetHead], signal);
@@ -24246,7 +24323,7 @@ async function prepareClone(snapshot, signal, dependencies) {
24246
24323
  const target = { repositoryRoot: snapshot.repositoryRoot, objectFormat: snapshot.objectFormat, targetHead: snapshot.targetHead, refs: { ...snapshot.refs } };
24247
24324
  try {
24248
24325
  dependencies.fault?.("workspace.before-create");
24249
- workspace = await mkdtemp3(join32(tmpdir3(), "ak-reviewer-leg-"));
24326
+ workspace = await mkdtemp3(join33(tmpdir3(), "ak-reviewer-leg-"));
24250
24327
  dependencies.fault?.("workspace.init");
24251
24328
  await git3(workspace, ["init", `--object-format=${snapshot.objectFormat}`, "--initial-branch=ak-reviewer-unborn"], signal);
24252
24329
  dependencies.fault?.("workspace.fetch");
@@ -24661,9 +24738,9 @@ init_auditor_soul();
24661
24738
  init_session_opening_materials();
24662
24739
 
24663
24740
  // src/acp-host/description.ts
24664
- import { join as join33 } from "node:path";
24741
+ import { join as join34 } from "node:path";
24665
24742
  function resolveAcpBinary(description, operatorHome) {
24666
- return join33(operatorHome, ...description.binaryFromHome);
24743
+ return join34(operatorHome, ...description.binaryFromHome);
24667
24744
  }
24668
24745
  function acpStdioArgs(description, model, seat) {
24669
24746
  const { prefix, suffix, modelFlag, thinkingFlag } = description.argv;
@@ -24689,7 +24766,7 @@ init_role_runtime();
24689
24766
  import { randomUUID as randomUUID6 } from "node:crypto";
24690
24767
  import { mkdir as mkdir5, readFile as readFile18, writeFile as writeFile8 } from "node:fs/promises";
24691
24768
  import { createServer } from "node:net";
24692
- import { basename as basename7, dirname as dirname17, join as join34 } from "node:path";
24769
+ import { basename as basename7, dirname as dirname17, join as join35 } from "node:path";
24693
24770
  import { fileURLToPath as fileURLToPath2 } from "node:url";
24694
24771
 
24695
24772
  // src/acp-host/role-turn-host.ts
@@ -25061,7 +25138,7 @@ async function prepareAcpRoleEnvelope(options) {
25061
25138
  const raw = await readFile18(method.path, "utf8");
25062
25139
  methodSkills.set(name, { path: method.path, body: stripSkillFrontmatter(raw).trim() });
25063
25140
  }
25064
- let sessionFile = options.sessionFile ?? join34(request.runDirectory, "session", "session.jsonl");
25141
+ let sessionFile = options.sessionFile ?? join35(request.runDirectory, "session", "session.jsonl");
25065
25142
  await mkdir5(dirname17(sessionFile), { recursive: true });
25066
25143
  if (request.continuation.kind !== "resume") {
25067
25144
  try {
@@ -25527,12 +25604,12 @@ async function prepareAcpRoleEnvelope(options) {
25527
25604
  // src/acp-host/seat-profile-soul.ts
25528
25605
  import { constants as constants3 } from "node:fs";
25529
25606
  import { access as access4, copyFile, lstat as lstat6, mkdir as mkdir6, readlink, symlink, unlink as unlink4 } from "node:fs/promises";
25530
- import { dirname as dirname18, join as join35, relative as relative3, resolve as resolve19 } from "node:path";
25607
+ import { dirname as dirname18, join as join36, relative as relative3, resolve as resolve19 } from "node:path";
25531
25608
  function seatProfileName(spec, role) {
25532
25609
  return `${spec.namePrefix}${role}`;
25533
25610
  }
25534
25611
  function packageRoleSoulPath(packageRoot, role) {
25535
- return join35(packageRoot, "souls", `${role}.md`);
25612
+ return join36(packageRoot, "souls", `${role}.md`);
25536
25613
  }
25537
25614
  async function pathExists(path) {
25538
25615
  try {
@@ -25549,16 +25626,16 @@ async function ensureSeatProfileSoul(options) {
25549
25626
  if (!await pathExists(soulTarget)) {
25550
25627
  throw new Error(`packaged role soul missing: ${soulTarget}`);
25551
25628
  }
25552
- const profilesRoot = join35(operatorHome, ...spec.profilesRootFromHome);
25553
- const profileDir = join35(profilesRoot, profileName);
25629
+ const profilesRoot = join36(operatorHome, ...spec.profilesRootFromHome);
25630
+ const profileDir = join36(profilesRoot, profileName);
25554
25631
  const hostRoot = dirname18(profilesRoot);
25555
- const soulPath = join35(profileDir, spec.soulFileName);
25632
+ const soulPath = join36(profileDir, spec.soulFileName);
25556
25633
  if (!await pathExists(profileDir)) {
25557
25634
  await mkdir6(profileDir, { recursive: true });
25558
25635
  for (const name of ["auth.json", ".env", "config.yaml"]) {
25559
- const source = join35(hostRoot, name);
25636
+ const source = join36(hostRoot, name);
25560
25637
  if (!await pathExists(source)) continue;
25561
- await copyFile(source, join35(profileDir, name));
25638
+ await copyFile(source, join36(profileDir, name));
25562
25639
  }
25563
25640
  } else {
25564
25641
  await mkdir6(profileDir, { recursive: true });
@@ -25585,9 +25662,9 @@ async function ensureSeatProfileSoul(options) {
25585
25662
 
25586
25663
  // src/acp-host/session-identity.ts
25587
25664
  import { mkdir as mkdir7, readFile as readFile19, rename, writeFile as writeFile9 } from "node:fs/promises";
25588
- import { dirname as dirname19, join as join36 } from "node:path";
25665
+ import { dirname as dirname19, join as join37 } from "node:path";
25589
25666
  function createAcpSessionIdentityAuthority(authority, sessionBindingFile) {
25590
- const bindingPath = (principal) => join36(authority.decode(principal).sessionDirectory, sessionBindingFile);
25667
+ const bindingPath = (principal) => join37(authority.decode(principal).sessionDirectory, sessionBindingFile);
25591
25668
  return {
25592
25669
  resolveSessionFile(principal) {
25593
25670
  return authority.decode(principal).sessionFile;