@akagilnc/pi-workflow-roles 0.1.5204 → 0.1.5212

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.
@@ -4493,7 +4493,6 @@ function appendSitianRecord(input) {
4493
4493
  identity,
4494
4494
  ...input.subject === void 0 ? {} : { subject: input.subject },
4495
4495
  ...input.sessionParent === void 0 ? {} : { sessionParent: input.sessionParent },
4496
- ...input.priorEventId === void 0 ? {} : { priorEventId: input.priorEventId },
4497
4496
  timestamp: timestamp2,
4498
4497
  host,
4499
4498
  ...input.source === void 0 ? {} : { source: input.source },
@@ -23155,17 +23154,8 @@ async function restoreState(cwd, runId, scope) {
23155
23154
  }
23156
23155
  return { sequence: 0 };
23157
23156
  }
23158
- const { file, owned } = located;
23159
- const last = owned.at(-1);
23157
+ const { owned } = located;
23160
23158
  return {
23161
- ...last === void 0 ? {} : {
23162
- prior: {
23163
- identity: last.identity,
23164
- recordFile: file,
23165
- kind: last.kind,
23166
- level: last.level
23167
- }
23168
- },
23169
23159
  sequence: owned.reduce((maximum, record4) => {
23170
23160
  const payload = record4.payload;
23171
23161
  return payload?.type === "candidate" && typeof payload.sequence === "number" ? Math.max(maximum, payload.sequence) : maximum;
@@ -23193,15 +23183,10 @@ async function sealAcceptedSubmission(options) {
23193
23183
  const attemptId = attemptIdentity(options.context, runId);
23194
23184
  const sessionParent = sessionParentFromHostContext(options.context);
23195
23185
  const home = homeFromHostContext(options.context, options.home);
23196
- const state = await restoreState(options.context.cwd, runId, {
23197
- ...home === void 0 ? {} : { home },
23198
- ...sessionParent === void 0 ? {} : { sessionParent }
23199
- });
23200
- const pointer = sitianReport({
23186
+ sitianReport({
23201
23187
  level: "event",
23202
23188
  kind: "sealed",
23203
23189
  subject: { runId, attemptId },
23204
- ...state.prior === void 0 ? {} : { priorEventId: state.prior.identity },
23205
23190
  payload: {
23206
23191
  type: "sealed",
23207
23192
  attemptId,
@@ -23214,7 +23199,6 @@ async function sealAcceptedSubmission(options) {
23214
23199
  ...home !== void 0 ? { home } : {},
23215
23200
  ...sessionParent === void 0 ? {} : { sessionParent }
23216
23201
  });
23217
- state.prior = pointer;
23218
23202
  }
23219
23203
  function createSubmissionLedgerHost(host, outputTools, failInfrastructure2 = (error) => {
23220
23204
  throw error;
@@ -23231,31 +23215,28 @@ function createSubmissionLedgerHost(host, outputTools, failInfrastructure2 = (er
23231
23215
  states.set(runId, pending);
23232
23216
  return pending;
23233
23217
  })();
23234
- const appendFor = (state, context, runId, attemptId, event) => {
23218
+ const appendFor = (context, runId, attemptId, event) => {
23235
23219
  const home = resolveHomeFromContext(context);
23236
23220
  const sessionParent = sessionParentFromHostContext(context);
23237
- const pointer = sitianReport({
23221
+ return sitianReport({
23238
23222
  level: "event",
23239
23223
  kind: event.type,
23240
23224
  subject: { runId, attemptId },
23241
- ...state.prior === void 0 ? {} : { priorEventId: state.prior.identity },
23242
23225
  payload: event,
23243
23226
  source: "role-runtime",
23244
23227
  cwd: context.cwd,
23245
23228
  ...home !== void 0 ? { home } : {},
23246
23229
  ...sessionParent === void 0 ? {} : { sessionParent }
23247
23230
  });
23248
- state.prior = pointer;
23249
- return pointer;
23250
23231
  };
23251
23232
  host.on("turn_end", async (event, context) => {
23252
23233
  try {
23253
23234
  const runId = runIdentity(context);
23254
23235
  const attemptId = attemptIdentity(context, runId);
23255
- const state = await stateFor(context, runId);
23256
23236
  const calls = event.calls.map(({ toolCallId: id, toolName: name }) => ({ id, name }));
23257
23237
  if (calls.length > 0) {
23258
- appendFor(state, context, runId, attemptId, { type: "roundContext", attemptId, calls });
23238
+ await stateFor(context, runId);
23239
+ appendFor(context, runId, attemptId, { type: "roundContext", attemptId, calls });
23259
23240
  }
23260
23241
  } catch (error) {
23261
23242
  failInfrastructure2(error, context);
@@ -23279,7 +23260,7 @@ function createSubmissionLedgerHost(host, outputTools, failInfrastructure2 = (er
23279
23260
  const runId = runIdentity(context);
23280
23261
  const attemptId = attemptIdentity(context, runId);
23281
23262
  const state = await stateFor(context, runId);
23282
- const append = (event) => appendFor(state, context, runId, attemptId, event);
23263
+ const append = (event) => appendFor(context, runId, attemptId, event);
23283
23264
  append({
23284
23265
  type: "candidate",
23285
23266
  attemptId,
@@ -23766,9 +23747,9 @@ init_sitian_facade();
23766
23747
  init_submission_ledger();
23767
23748
  init_collector_ledger();
23768
23749
  import { randomUUID as randomUUID8 } from "node:crypto";
23769
- import { readFileSync as readFileSync6, writeSync as writeSync3 } from "node:fs";
23750
+ import { readFileSync as readFileSync6, writeSync as writeSync2 } from "node:fs";
23770
23751
  import { join as join46 } from "node:path";
23771
- import { Value as Value5 } from "typebox/value";
23752
+ import { Value as Value4 } from "typebox/value";
23772
23753
 
23773
23754
  // src/activation-trace.ts
23774
23755
  import { Type as Type12 } from "typebox";
@@ -23938,118 +23919,6 @@ function writeStderrJsonlRecord(record4, write = writeSync) {
23938
23919
  }
23939
23920
  }
23940
23921
 
23941
- // src/tool-execution-observation.ts
23942
- import { writeSync as writeSync2 } from "node:fs";
23943
- import { Type as Type13 } from "typebox";
23944
- import { Value as Value3 } from "typebox/value";
23945
- var TOOL_EXECUTION_UPDATE_THROTTLE_MS = 3e4;
23946
- var observationBase = {
23947
- role: Type13.String({ minLength: 1 }),
23948
- toolCallId: Type13.String({ minLength: 1 }),
23949
- toolName: Type13.String({ minLength: 1 }),
23950
- timestamp: Type13.String({ format: "date-time" })
23951
- };
23952
- var toolExecutionObservationRecordSchema = Type13.Union([
23953
- Type13.Object({
23954
- ...observationBase,
23955
- event: Type13.Literal("tool_execution_start")
23956
- }, { additionalProperties: true }),
23957
- Type13.Object({
23958
- ...observationBase,
23959
- event: Type13.Literal("tool_execution_update")
23960
- }, { additionalProperties: true }),
23961
- Type13.Object({
23962
- ...observationBase,
23963
- event: Type13.Literal("tool_execution_end"),
23964
- isError: Type13.Boolean()
23965
- }, { additionalProperties: true })
23966
- ]);
23967
- function validateToolExecutionObservationRecord(record4) {
23968
- if (!Value3.Check(toolExecutionObservationRecordSchema, record4)) {
23969
- throw new TypeError("Tool execution observation record does not match its contract");
23970
- }
23971
- return record4;
23972
- }
23973
- function writeToolExecutionObservationRecord(record4, write = writeSync2) {
23974
- writeStderrJsonlRecord(validateToolExecutionObservationRecord(record4), write);
23975
- }
23976
- function isProducingToolUpdate(partialResult) {
23977
- if (partialResult == null) return false;
23978
- if (typeof partialResult !== "object") return true;
23979
- const content = partialResult.content;
23980
- if (!Array.isArray(content)) return true;
23981
- if (content.length === 0) return false;
23982
- return content.some((part) => {
23983
- if (typeof part !== "object" || part === null) return true;
23984
- const text = part.text;
23985
- if (typeof text === "string") return text.length > 0;
23986
- return true;
23987
- });
23988
- }
23989
- function systemToolExecutionObservationMonoNow() {
23990
- return performance.now();
23991
- }
23992
- function createToolExecutionObservationFace(options) {
23993
- const states = /* @__PURE__ */ new Map();
23994
- async function emit(record4) {
23995
- await options.write(validateToolExecutionObservationRecord(record4));
23996
- }
23997
- function activeRole() {
23998
- if (!options.admitted()) return void 0;
23999
- const role = options.role();
24000
- return role === void 0 || role === "" ? void 0 : role;
24001
- }
24002
- return {
24003
- reset() {
24004
- states.clear();
24005
- },
24006
- async onStart(event) {
24007
- const role = activeRole();
24008
- if (role === void 0) return;
24009
- states.set(event.toolCallId, { lastUpdateEmitMonoMs: void 0 });
24010
- await emit({
24011
- event: "tool_execution_start",
24012
- role,
24013
- toolCallId: event.toolCallId,
24014
- toolName: event.toolName,
24015
- timestamp: options.clock()
24016
- });
24017
- },
24018
- async onUpdate(event) {
24019
- const role = activeRole();
24020
- if (role === void 0) return;
24021
- if (!isProducingToolUpdate(event.partialResult)) return;
24022
- const now = options.monoNow();
24023
- const state = states.get(event.toolCallId) ?? { lastUpdateEmitMonoMs: void 0 };
24024
- if (state.lastUpdateEmitMonoMs !== void 0 && now - state.lastUpdateEmitMonoMs < TOOL_EXECUTION_UPDATE_THROTTLE_MS) {
24025
- return;
24026
- }
24027
- state.lastUpdateEmitMonoMs = now;
24028
- states.set(event.toolCallId, state);
24029
- await emit({
24030
- event: "tool_execution_update",
24031
- role,
24032
- toolCallId: event.toolCallId,
24033
- toolName: event.toolName,
24034
- timestamp: options.clock()
24035
- });
24036
- },
24037
- async onEnd(event) {
24038
- const role = activeRole();
24039
- if (role === void 0) return;
24040
- states.delete(event.toolCallId);
24041
- await emit({
24042
- event: "tool_execution_end",
24043
- role,
24044
- toolCallId: event.toolCallId,
24045
- toolName: event.toolName,
24046
- timestamp: options.clock(),
24047
- isError: event.isError
24048
- });
24049
- }
24050
- };
24051
- }
24052
-
24053
23922
  // src/role-runtime.ts
24054
23923
  init_engine_detour();
24055
23924
  init_engine_material();
@@ -24058,10 +23927,10 @@ init_engine_material();
24058
23927
  init_engine_detour();
24059
23928
  init_engine_detour_usage();
24060
23929
  init_run_terminal_artifacts();
24061
- import { Type as Type14 } from "typebox";
24062
- var engineDetourArgsSchema = Type14.Object(
23930
+ import { Type as Type13 } from "typebox";
23931
+ var engineDetourArgsSchema = Type13.Object(
24063
23932
  {
24064
- argv: Type14.Array(Type14.String({ minLength: 1 }), {
23933
+ argv: Type13.Array(Type13.String({ minLength: 1 }), {
24065
23934
  minItems: 1,
24066
23935
  description: "\u9996\u9879\u4E3A PATH \u4E2D\u7684\u53EF\u6267\u884C\u6587\u4EF6\uFF0C\u5176\u4F59\u9879\u4E3A\u53C2\u6570\u3002"
24067
23936
  })
@@ -24208,63 +24077,63 @@ import { join as join41, sep as sep6 } from "node:path";
24208
24077
  // src/collector-tool-schemas.ts
24209
24078
  init_open_tool_schema();
24210
24079
  init_terminating_infrastructure();
24211
- import { Type as Type15 } from "typebox";
24212
- var collectorObserveArgsSchema = Type15.Object({}, { additionalProperties: true });
24213
- var collectorRequestArgsSchema = Type15.Object({
24214
- requestId: Type15.String({
24080
+ import { Type as Type14 } from "typebox";
24081
+ var collectorObserveArgsSchema = Type14.Object({}, { additionalProperties: true });
24082
+ var collectorRequestArgsSchema = Type14.Object({
24083
+ requestId: Type14.String({
24215
24084
  minLength: 1,
24216
24085
  description: "\u8BF7\u6C42\u8EAB\u4EFD\uFF08\u914D\u7F6E id \u6216\u89D2\u8272\u5224\u5B9A\u7684\u7A33\u5B9A id\uFF1B\u9996\u5C3E\u65E0\u7A7A\u767D\uFF09"
24217
24086
  }),
24218
- snapshotId: Type15.String({ minLength: 1, description: "\u6700\u65B0\u7559\u5B58\u89C2\u5BDF\u5FEB\u7167" }),
24087
+ snapshotId: Type14.String({ minLength: 1, description: "\u6700\u65B0\u7559\u5B58\u89C2\u5BDF\u5FEB\u7167" }),
24219
24088
  // #836 r16 class 3: body.minLength deleted — manifest-configured requestId
24220
24089
  // ignores body, and the unknown-requestId non-empty condition is a real
24221
24090
  // branch in src/collector-ledger.ts:922-951, not a provider shape gate.
24222
- body: Type15.Optional(Type15.String({
24091
+ body: Type14.Optional(Type14.String({
24223
24092
  description: "\u89D2\u8272\u5224\u5B9A\u7684\u8BF7\u6C42\u6B63\u6587\uFF1Brequest-manifest \u672A\u6536\u5F55\u8BE5 requestId \u65F6\u5FC5\u586B"
24224
24093
  }))
24225
24094
  }, { additionalProperties: true });
24226
24095
  var COLLECTOR_HANDBOOK_MAX_BYTES = 64 * 1024;
24227
- var collectorHandbookWriteArgsSchema = Type15.Object({
24228
- scope: Type15.Union([
24229
- Type15.Literal("general"),
24230
- Type15.Literal("repo")
24096
+ var collectorHandbookWriteArgsSchema = Type14.Object({
24097
+ scope: Type14.Union([
24098
+ Type14.Literal("general"),
24099
+ Type14.Literal("repo")
24231
24100
  ], { description: "general\uFF1D\u901A\u7528\u624B\u518C\uFF1Brepo\uFF1D\u5F53\u524D\u4ED3\u5E93\u5DEE\u5F02" }),
24232
- body: Type15.String({
24101
+ body: Type14.String({
24233
24102
  description: `\u624B\u518C\u5168\u6587\uFF08opaque \u5DE5\u4F5C\u8BB0\u5FC6\uFF1B\u6574\u4EFD\u66FF\u6362\uFF1BUTF-8 \u81F3\u591A ${COLLECTOR_HANDBOOK_MAX_BYTES} \u5B57\u8282\uFF09`
24234
24103
  })
24235
24104
  }, { additionalProperties: true });
24236
- var collectorReadArgsSchema = Type15.Object({
24237
- evidenceId: Type15.String({ minLength: 1, description: "observe \u8FD4\u56DE\u7684\u6750\u6599\u8BC1\u636E id\uFF08evidenceId\uFF09" })
24105
+ var collectorReadArgsSchema = Type14.Object({
24106
+ evidenceId: Type14.String({ minLength: 1, description: "observe \u8FD4\u56DE\u7684\u6750\u6599\u8BC1\u636E id\uFF08evidenceId\uFF09" })
24238
24107
  }, { additionalProperties: true });
24239
- var collectorWaitArgsSchema = Type15.Object({
24240
- durationMs: Type15.Integer({
24108
+ var collectorWaitArgsSchema = Type14.Object({
24109
+ durationMs: Type14.Integer({
24241
24110
  minimum: 1,
24242
24111
  description: "\u7B49\u5F85\u6BEB\u79D2\uFF1B\u5B9E\u9645\u7761\u7720\u4E0D\u8D85\u8FC7\u5269\u4F59\u7B49\u5F85\u7A97\uFF08#678\uFF1B\u65E0\u5305\u5185\u5355\u6B21\u4EFB\u610F\u4E0A\u9650\uFF09"
24243
24112
  })
24244
24113
  }, { additionalProperties: true });
24245
- var collectorOpenWaitWindowArgsSchema = Type15.Object({
24246
- startedAt: Type15.Optional(Type15.String({
24114
+ var collectorOpenWaitWindowArgsSchema = Type14.Object({
24115
+ startedAt: Type14.Optional(Type14.String({
24247
24116
  description: "\u7B49\u5F85\u7A97\u8D77\u70B9 ISO \u65F6\u95F4\uFF1B\u65B0\u5EFA PR \u7528\u521B\u5EFA\u6210\u529F\u65F6\u523B\uFF1B\u7701\u7565\uFF1D\u73B0\u5728\uFF08\u89E6\u53D1\u9636\u6BB5\u7ED3\u675F\uFF09"
24248
24117
  }))
24249
24118
  }, { additionalProperties: true });
24250
- var collectorBindTargetArgsSchema = Type15.Object({
24251
- prNumber: Type15.Optional(Type15.Unknown({
24119
+ var collectorBindTargetArgsSchema = Type14.Object({
24120
+ prNumber: Type14.Optional(Type14.Unknown({
24252
24121
  description: "\u672C\u4ED3 PR \u53F7\uFF08\u6B63\u6574\u6570\uFF09\u3002"
24253
24122
  })),
24254
- issueNumber: Type15.Optional(Type15.Unknown({
24123
+ issueNumber: Type14.Optional(Type14.Unknown({
24255
24124
  description: "\u672C\u4ED3 issue \u53F7\uFF08\u6B63\u6574\u6570\uFF09\u3002"
24256
24125
  }))
24257
24126
  }, { additionalProperties: true });
24258
24127
  var collectorFindingItemDeclaration = (() => {
24259
- const item = Type15.Object(
24128
+ const item = Type14.Object(
24260
24129
  {
24261
- evidenceId: Type15.Unknown({
24130
+ evidenceId: Type14.Unknown({
24262
24131
  description: "observe \u8FD4\u56DE\u7684\u6750\u6599\u6307\u9488\uFF08\u5FC5\u586B\u8BED\u4E49\uFF09"
24263
24132
  }),
24264
- category: Type15.Unknown({
24133
+ category: Type14.Unknown({
24265
24134
  description: "\u7B80\u77ED\u5F52\u7C7B\u6807\u7B7E\uFF0C\u4E0D\u662F\u6458\u8981"
24266
24135
  }),
24267
- summary: Type15.Unknown({
24136
+ summary: Type14.Unknown({
24268
24137
  description: "\u54EA\u4E2A bot\u3001\u4EC0\u4E48\u95EE\u9898\u7684\u6458\u8981\uFF1B\u4E0D\u8A8A\u6284\u6B63\u6587"
24269
24138
  })
24270
24139
  },
@@ -24277,14 +24146,14 @@ var collectorFindingItemDeclaration = (() => {
24277
24146
  return item;
24278
24147
  })();
24279
24148
  var collectorOutputBaseSchema = openToolObject(
24280
- Type15.Object({
24149
+ Type14.Object({
24281
24150
  // No root type:array — host must not shape-reject non-array findings (#676 C).
24282
24151
  // Nested item declarations ride `items` for registration preservation (ADR 0057).
24283
- findings: Type15.Unsafe({
24152
+ findings: Type14.Unsafe({
24284
24153
  description: "\u672C\u6B21\u6536\u96C6\u5230\u7684\u9010\u6761 findings \u6307\u9488\u3002",
24285
24154
  items: collectorFindingItemDeclaration
24286
24155
  }),
24287
- unfinishedReasons: Type15.Unknown({
24156
+ unfinishedReasons: Type14.Unknown({
24288
24157
  description: "\u672A\u5B8C\u6210\u539F\u56E0\u3002"
24289
24158
  })
24290
24159
  })
@@ -25126,18 +24995,18 @@ init_open_tool_schema();
25126
24995
  init_terminating_infrastructure();
25127
24996
  init_gleaner_left_contracts();
25128
24997
  init_gleaner_left_contracts();
25129
- import { Type as Type16 } from "typebox";
24998
+ import { Type as Type15 } from "typebox";
25130
24999
  var gleanerLeftOutputSchema = withTerminatingOutputDeclarations(
25131
25000
  openToolObject(
25132
- Type16.Object({
25133
- status: Type16.Unknown({
25001
+ Type15.Object({
25002
+ status: Type15.Unknown({
25134
25003
  description: "completed"
25135
25004
  }),
25136
- findings: Type16.Array(
25137
- Type16.Object(
25005
+ findings: Type15.Array(
25006
+ Type15.Object(
25138
25007
  {
25139
- pointer: Type16.Optional(Type16.String({ description: "\u6587\u4EF6/\u884C\u6307\u9488" })),
25140
- statement: Type16.Optional(Type16.String({ description: "\u7591\u70B9\u9648\u8FF0" }))
25008
+ pointer: Type15.Optional(Type15.String({ description: "\u6587\u4EF6/\u884C\u6307\u9488" })),
25009
+ statement: Type15.Optional(Type15.String({ description: "\u7591\u70B9\u9648\u8FF0" }))
25141
25010
  },
25142
25011
  { additionalProperties: true, description: "\u4E00\u6761\u5F39\u7AE0" }
25143
25012
  ),
@@ -25177,44 +25046,44 @@ init_open_tool_schema();
25177
25046
  init_terminating_infrastructure();
25178
25047
  init_diarist_contracts();
25179
25048
  init_diarist_contracts();
25180
- import { Type as Type17 } from "typebox";
25049
+ import { Type as Type16 } from "typebox";
25181
25050
  var diaristOutputSchema = withTerminatingOutputDeclarations(
25182
25051
  openToolObject(
25183
- Type17.Object({
25184
- status: Type17.Unknown({
25052
+ Type16.Object({
25053
+ status: Type16.Unknown({
25185
25054
  description: "completed | escalate"
25186
25055
  }),
25187
- ticketNumber: Type17.Optional(
25188
- Type17.Unknown({
25056
+ ticketNumber: Type16.Optional(
25057
+ Type16.Unknown({
25189
25058
  description: "\u672C\u5EAD\u5BF9\u8C61\u7968\u53F7\uFF08\u6B63\u6574\u6570\uFF09\u6216 null/\u7701\u7565\uFF1D\u771F\u65E0\u7968\uFF1B\u4E0B\u6E38\u8D70 typed \u952E\uFF1B\u8BA4\u4E0D\u51FA\u7528 status=escalate\uFF0C\u4E0D\u6D17\u6210\u65E0\u5F55\u3002\u673A\u68B0\u5C42\u4E0D\u91CD\u5224\u3002"
25190
25059
  })
25191
25060
  ),
25192
- courtTicketNumbers: Type17.Optional(
25193
- Type17.Unknown({
25061
+ courtTicketNumbers: Type16.Optional(
25062
+ Type16.Unknown({
25194
25063
  description: "#871 \u672C\u6B21\u5408\u5BA1\u5E94\u5404\u81EA\u6210\u5F55\u7684\u7968\u53F7\u96C6\u5408\uFF08\u6B63\u6574\u6570\u6570\u7EC4\uFF0C\u542B\u4E3B\u7968\uFF09\uFF1B\u5355\u7968\u53EF\u7701\u7565\u3002\u673A\u68B0\u5C42\u53EA\u505A\u7C7B\u578B/\u53BB\u91CD\u6295\u5F71\uFF0C\u4E0D\u4ECE\u6563\u6587\u731C\u7968\u3002"
25195
25064
  })
25196
25065
  ),
25197
- reason: Type17.Optional(
25198
- Type17.String({
25066
+ reason: Type16.Optional(
25067
+ Type16.String({
25199
25068
  description: "status \u4E3A escalate \u65F6\uFF1A\u8BA4\u4E0D\u51FA\u672C\u5EAD\u5BF9\u8C61\u7684\u539F\u56E0"
25200
25069
  })
25201
25070
  ),
25202
- sessions: Type17.Optional(
25203
- Type17.Array(
25204
- Type17.Object(
25071
+ sessions: Type16.Optional(
25072
+ Type16.Array(
25073
+ Type16.Object(
25205
25074
  {
25206
- path: Type17.Optional(
25207
- Type17.String({ description: "\u4F1A\u8BDD\u5377\u7EDD\u5BF9\u6216\u53EF\u8BFB\u8DEF\u5F84" })
25075
+ path: Type16.Optional(
25076
+ Type16.String({ description: "\u4F1A\u8BDD\u5377\u7EDD\u5BF9\u6216\u53EF\u8BFB\u8DEF\u5F84" })
25208
25077
  ),
25209
- ranges: Type17.Optional(
25210
- Type17.Array(
25211
- Type17.Object(
25078
+ ranges: Type16.Optional(
25079
+ Type16.Array(
25080
+ Type16.Object(
25212
25081
  {
25213
- from: Type17.Optional(
25214
- Type17.Object(
25082
+ from: Type16.Optional(
25083
+ Type16.Object(
25215
25084
  {
25216
- id: Type17.Optional(Type17.String()),
25217
- line: Type17.Optional(Type17.Unknown())
25085
+ id: Type16.Optional(Type16.String()),
25086
+ line: Type16.Optional(Type16.Unknown())
25218
25087
  },
25219
25088
  {
25220
25089
  additionalProperties: true,
@@ -25222,11 +25091,11 @@ var diaristOutputSchema = withTerminatingOutputDeclarations(
25222
25091
  }
25223
25092
  )
25224
25093
  ),
25225
- to: Type17.Optional(
25226
- Type17.Object(
25094
+ to: Type16.Optional(
25095
+ Type16.Object(
25227
25096
  {
25228
- id: Type17.Optional(Type17.String()),
25229
- line: Type17.Optional(Type17.Unknown())
25097
+ id: Type16.Optional(Type16.String()),
25098
+ line: Type16.Optional(Type16.Unknown())
25230
25099
  },
25231
25100
  {
25232
25101
  additionalProperties: true,
@@ -25263,23 +25132,23 @@ var DIARIST_TOOL_SPEC = {
25263
25132
  init_terminating_infrastructure();
25264
25133
  init_secretariat_contracts();
25265
25134
  init_secretariat_contracts();
25266
- import { Type as Type18 } from "typebox";
25135
+ import { Type as Type17 } from "typebox";
25267
25136
  var secretariatVerdictSchema = withTerminatingOutputDeclarations(
25268
- Type18.Object(
25137
+ Type17.Object(
25269
25138
  {
25270
- secretariatStatus: Type18.Unknown({
25139
+ secretariatStatus: Type17.Unknown({
25271
25140
  description: "converged | escalate"
25272
25141
  }),
25273
- ticketNumber: Type18.Optional(
25274
- Type18.Number({ description: "\u672C\u7968\u53F7\uFF1B\u7F72\u65F6\u6307\u5411\u6700\u7EC8\u6B63\u6587\u6240\u5728\u7968" })
25142
+ ticketNumber: Type17.Optional(
25143
+ Type17.Number({ description: "\u672C\u7968\u53F7\uFF1B\u7F72\u65F6\u6307\u5411\u6700\u7EC8\u6B63\u6587\u6240\u5728\u7968" })
25275
25144
  ),
25276
- note: Type18.Optional(Type18.String({ description: "\u9644\u6CE8" })),
25277
- evidence: Type18.Optional(Type18.Unknown({ description: "\u7559\u5B58\u8BC1\u636E" })),
25278
- decisionGate: Type18.Optional(
25279
- Type18.Object(
25145
+ note: Type17.Optional(Type17.String({ description: "\u9644\u6CE8" })),
25146
+ evidence: Type17.Optional(Type17.Unknown({ description: "\u7559\u5B58\u8BC1\u636E" })),
25147
+ decisionGate: Type17.Optional(
25148
+ Type17.Object(
25280
25149
  {
25281
- question: Type18.Optional(Type18.String()),
25282
- options: Type18.Optional(Type18.Array(Type18.String()))
25150
+ question: Type17.Optional(Type17.String()),
25151
+ options: Type17.Optional(Type17.Array(Type17.String()))
25283
25152
  },
25284
25153
  { additionalProperties: true, description: "\u9700\u965B\u4E0B\u5904\u7F6E\u7684\u95EE\u9898\u4E0E\u9009\u9879" }
25285
25154
  )
@@ -25350,7 +25219,7 @@ init_packaged_role_registry();
25350
25219
  init_activation_ledger_topology();
25351
25220
  import { resolve as resolve18 } from "node:path";
25352
25221
  import "@earendil-works/pi-coding-agent";
25353
- import { Type as Type20 } from "typebox";
25222
+ import { Type as Type19 } from "typebox";
25354
25223
 
25355
25224
  // src/navigator-public-session.ts
25356
25225
  init_sitian_facade();
@@ -25358,8 +25227,8 @@ import { existsSync as existsSync13 } from "node:fs";
25358
25227
  import { basename as basename11 } from "node:path";
25359
25228
 
25360
25229
  // src/navigator-session-contracts.ts
25361
- import { Type as Type19 } from "typebox";
25362
- import { Value as Value4 } from "typebox/value";
25230
+ import { Type as Type18 } from "typebox";
25231
+ import { Value as Value3 } from "typebox/value";
25363
25232
  var NAVIGATOR_PREPARE_TOOL_NAME = "ak_navigator_prepare";
25364
25233
  var NAVIGATOR_UNAVAILABLE_KEYS = /* @__PURE__ */ new Set([
25365
25234
  "context",
@@ -25466,26 +25335,26 @@ function navigatorProviderFailureFromPublicTerminal(outcome) {
25466
25335
  if (typed !== void 0) return { source: typed, cause: typed };
25467
25336
  return { source: "unknown", cause: "unknown" };
25468
25337
  }
25469
- var navigatorProviderFailureSchema = Type19.Object({
25470
- source: Type19.Union([
25471
- Type19.Literal("context"),
25472
- Type19.Literal("session"),
25473
- Type19.Literal("model"),
25474
- Type19.Literal("thinking"),
25475
- Type19.Literal("auth"),
25476
- Type19.Literal("quota"),
25477
- Type19.Literal("transport"),
25478
- Type19.Literal("unknown")
25338
+ var navigatorProviderFailureSchema = Type18.Object({
25339
+ source: Type18.Union([
25340
+ Type18.Literal("context"),
25341
+ Type18.Literal("session"),
25342
+ Type18.Literal("model"),
25343
+ Type18.Literal("thinking"),
25344
+ Type18.Literal("auth"),
25345
+ Type18.Literal("quota"),
25346
+ Type18.Literal("transport"),
25347
+ Type18.Literal("unknown")
25479
25348
  ]),
25480
- cause: Type19.Union([
25481
- Type19.Literal("context"),
25482
- Type19.Literal("session"),
25483
- Type19.Literal("model"),
25484
- Type19.Literal("thinking"),
25485
- Type19.Literal("auth"),
25486
- Type19.Literal("quota"),
25487
- Type19.Literal("transport"),
25488
- Type19.Literal("unknown")
25349
+ cause: Type18.Union([
25350
+ Type18.Literal("context"),
25351
+ Type18.Literal("session"),
25352
+ Type18.Literal("model"),
25353
+ Type18.Literal("thinking"),
25354
+ Type18.Literal("auth"),
25355
+ Type18.Literal("quota"),
25356
+ Type18.Literal("transport"),
25357
+ Type18.Literal("unknown")
25489
25358
  ])
25490
25359
  }, { additionalProperties: false });
25491
25360
  function parseNavigatorModelSetting(value) {
@@ -25865,8 +25734,8 @@ function resolveNavigatorAuthorityMaterial(roleInput, fileAuthority) {
25865
25734
  return void 0;
25866
25735
  }
25867
25736
  var NAVIGATOR_TARGETS = PACKAGED_ROLE_REGISTRY.map(({ role, phases }) => ({ role, phases }));
25868
- var prepareSchema = Type20.Object({
25869
- prose: Type20.Optional(Type20.Unknown({
25737
+ var prepareSchema = Type19.Object({
25738
+ prose: Type19.Optional(Type19.Unknown({
25870
25739
  description: "\u6E38\u5955\u4F7F\u6563\u6587\u5EFA\u8BAE\uFF0C\u539F\u6837\u5448\u73B0\u3002\u4E0D\u8981\u6C42 candidates/next \u7ED3\u6784\u3002"
25871
25740
  }))
25872
25741
  }, { additionalProperties: true });
@@ -26314,12 +26183,12 @@ init_judge_role();
26314
26183
  init_open_tool_schema();
26315
26184
  init_terminating_infrastructure();
26316
26185
  init_reviewer_output();
26317
- import { Type as Type21 } from "typebox";
26318
- var reviewerAmendmentsSchema = Type21.Object({
26319
- completeness: Type21.Optional(Type21.String({
26186
+ import { Type as Type20 } from "typebox";
26187
+ var reviewerAmendmentsSchema = Type20.Object({
26188
+ completeness: Type20.Optional(Type20.String({
26320
26189
  description: "completeness lens \u5B8C\u6574\u62A5\u544A\uFF1Acandidates\u3001\u9010\u6761\u5904\u7F6E\u4E0E verdict\uFF1B\u975E\u4EC5 verdict \u4E00\u884C\u3002hard-stop\uFF0Fusage error \u4E3A refused \u65F6\uFF0C\u82E5\u5DF2\u4EA7\u51FA\u62A5\u544A\u4ECD\u7167\u5F55\u4E8E\u6B64"
26321
26190
  })),
26322
- correctness: Type21.Optional(Type21.String({
26191
+ correctness: Type20.Optional(Type20.String({
26323
26192
  description: "correctness lens \u5B8C\u6574\u62A5\u544A\uFF1Acandidates\u3001\u9010\u6761\u5904\u7F6E\u4E0E verdict\uFF1B\u975E\u4EC5 verdict \u4E00\u884C\u3002hard-stop\uFF0Fusage error \u4E3A refused \u65F6\uFF0C\u82E5\u5DF2\u4EA7\u51FA\u62A5\u544A\u4ECD\u7167\u5F55\u4E8E\u6B64"
26324
26193
  }))
26325
26194
  }, {
@@ -26327,15 +26196,15 @@ var reviewerAmendmentsSchema = Type21.Object({
26327
26196
  description: "\u5DF2\u8FD0\u884C lens \u7684 amendments \u627F\u8F7D candidates\u3001\u9010\u6761\u5904\u7F6E\u4E0E verdict \u7684\u5B8C\u6574\u62A5\u544A\uFF08\u975E\u4EC5 verdict \u884C\uFF09\uFF1B\u663E\u5F0F\u5355\u8F74\u65F6\u53E6\u4E00\u8F74\u53EF\u7701\u7565\u3002hard-stop\uFF0Fusage error \u4E3A refused \u65F6\uFF0C\u5DF2\u4EA7\u51FA\u62A5\u544A\u4ECD\u7167\u5F55\u5BF9\u5E94 lens \u5B57\u6BB5\u3002"
26328
26197
  });
26329
26198
  var REVIEWER_STATUS_DESCRIPTION = "completed | refused\u3002\u4E24\u79CD\u6B63\u5E38 lens verdict\uFF08completeness / correctness\uFF09\u5747 completed\uFF1Bhard-stop \u4E0E usage error \u4E3A refused\uFF08\u5DF2\u4EA7\u51FA\u62A5\u544A\u4ECD\u7167\u5F55\u8FDB\u6240\u9009 lens amendments\uFF09\u3002";
26330
- var reviewerOutputVariants = Type21.Union([
26331
- Type21.Object({
26332
- status: Type21.Unknown({ description: REVIEWER_STATUS_DESCRIPTION }),
26333
- amendments: Type21.Optional(reviewerAmendmentsSchema)
26199
+ var reviewerOutputVariants = Type20.Union([
26200
+ Type20.Object({
26201
+ status: Type20.Unknown({ description: REVIEWER_STATUS_DESCRIPTION }),
26202
+ amendments: Type20.Optional(reviewerAmendmentsSchema)
26334
26203
  }, { additionalProperties: false }),
26335
- Type21.Object({
26336
- status: Type21.Unknown({ description: REVIEWER_STATUS_DESCRIPTION }),
26337
- diagnostic: Type21.String({ description: "\u62D2\u7EDD\u8BCA\u65AD\u8BF4\u660E\uFF1Bhard-stop\uFF0Fusage error \u539F\u56E0\u8FDB\u6B64\u5B57\u6BB5\uFF0C\u5DF2\u4EA7\u51FA\u62A5\u544A\u53E6\u7167\u5F55 amendments" }),
26338
- amendments: Type21.Optional(reviewerAmendmentsSchema)
26204
+ Type20.Object({
26205
+ status: Type20.Unknown({ description: REVIEWER_STATUS_DESCRIPTION }),
26206
+ diagnostic: Type20.String({ description: "\u62D2\u7EDD\u8BCA\u65AD\u8BF4\u660E\uFF1Bhard-stop\uFF0Fusage error \u539F\u56E0\u8FDB\u6B64\u5B57\u6BB5\uFF0C\u5DF2\u4EA7\u51FA\u62A5\u544A\u53E6\u7167\u5F55 amendments" }),
26207
+ amendments: Type20.Optional(reviewerAmendmentsSchema)
26339
26208
  }, { additionalProperties: false })
26340
26209
  ]);
26341
26210
  var reviewerOutputSchema = withTerminatingOutputDeclarations(
@@ -26384,7 +26253,7 @@ init_terminating_infrastructure();
26384
26253
  init_worker_output();
26385
26254
  init_fixer_output();
26386
26255
  init_fixer_packet();
26387
- import { Type as Type22 } from "typebox";
26256
+ import { Type as Type21 } from "typebox";
26388
26257
 
26389
26258
  // src/worker-submission-gates.ts
26390
26259
  init_archivist_record_entry();
@@ -26650,20 +26519,20 @@ function fixerBashSeatbeltDenyReason(matched) {
26650
26519
 
26651
26520
  // src/worker-role.ts
26652
26521
  var CODER_STATUS_DESCRIPTION = "planned | completed | refused | partially_completed | unfinished\u3002unfinished\uFF1A\u7F3A\u524D\u7F6E\u6216\u8FDD\u5BAA\u7EA6\u675F\u81F4\u672C\u5C40\u672A\u5B8C\u6210\u3002";
26653
- var coderOutputVariants = Type22.Union([
26654
- Type22.Object({
26655
- status: Type22.Unknown({ description: CODER_STATUS_DESCRIPTION }),
26656
- report: Type22.String({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" })
26522
+ var coderOutputVariants = Type21.Union([
26523
+ Type21.Object({
26524
+ status: Type21.Unknown({ description: CODER_STATUS_DESCRIPTION }),
26525
+ report: Type21.String({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" })
26657
26526
  }, { additionalProperties: false }),
26658
- Type22.Object({
26659
- status: Type22.Unknown({ description: CODER_STATUS_DESCRIPTION }),
26660
- report: Type22.String({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" })
26527
+ Type21.Object({
26528
+ status: Type21.Unknown({ description: CODER_STATUS_DESCRIPTION }),
26529
+ report: Type21.String({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" })
26661
26530
  }, { additionalProperties: false }),
26662
- Type22.Object({
26663
- status: Type22.Unknown({ description: CODER_STATUS_DESCRIPTION }),
26664
- report: Type22.String({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" }),
26665
- remainingScope: Type22.String({ description: "\u672C\u5C40\u540E\u5269\u4F59\u5DE5\u4F5C" }),
26666
- reason: Type22.Optional(Type22.String({
26531
+ Type21.Object({
26532
+ status: Type21.Unknown({ description: CODER_STATUS_DESCRIPTION }),
26533
+ report: Type21.String({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" }),
26534
+ remainingScope: Type21.String({ description: "\u672C\u5C40\u540E\u5269\u4F59\u5DE5\u4F5C" }),
26535
+ reason: Type21.Optional(Type21.String({
26667
26536
  minLength: 1,
26668
26537
  description: "\u963B\u65AD\u539F\u56E0\uFF1A\u7F3A\u524D\u7F6E\u6216\u8FDD\u5BAA\u7EA6\u675F\u3002\u7F3A\u5F85\u51B3 owner \u51B3\u5B9A\u6216\u7B54\u590D\u5C5E\u7F3A\u524D\u7F6E\u3002"
26669
26538
  }))
@@ -27111,7 +26980,7 @@ function activationStage(role, activate) {
27111
26980
  };
27112
26981
  }
27113
26982
  function validateActivationTraceRecord(record4) {
27114
- if (!Value5.Check(activationTraceRecordSchema, record4)) {
26983
+ if (!Value4.Check(activationTraceRecordSchema, record4)) {
27115
26984
  throw new TypeError("Activation trace record does not match its closed contract");
27116
26985
  }
27117
26986
  return record4;
@@ -27137,7 +27006,7 @@ async function executeActivationStage(role, stage, infrastructure) {
27137
27006
  throw activationError;
27138
27007
  }
27139
27008
  }
27140
- function writeActivationTraceRecord(record4, write = writeSync3) {
27009
+ function writeActivationTraceRecord(record4, write = writeSync2) {
27141
27010
  writeStderrJsonlRecord(record4, write);
27142
27011
  }
27143
27012
  var ActivationBarrierError = class extends Error {
@@ -27914,7 +27783,6 @@ function createRoleRuntimeExtension(dependencies) {
27914
27783
  disposeNavigatorAttendanceNonBlocking(attendanceToDispose);
27915
27784
  pendingInfrastructureFailures.clear();
27916
27785
  pendingSubmissionNonPassByToolCallId.clear();
27917
- observationFace.reset();
27918
27786
  });
27919
27787
  const hostActions = {
27920
27788
  failInfrastructure(error, ctx, toolCallId) {
@@ -28130,29 +27998,6 @@ function createRoleRuntimeExtension(dependencies) {
28130
27998
  };
28131
27999
  const clock = dependencies.activationClock ?? (() => (/* @__PURE__ */ new Date()).toISOString());
28132
28000
  const writeTrace = dependencies.activationTraceWriter ?? writeActivationTraceRecord;
28133
- const observationFace = createToolExecutionObservationFace({
28134
- role: () => selectedRole,
28135
- admitted: () => admitted,
28136
- clock: dependencies.toolExecutionObservationClock ?? clock,
28137
- monoNow: dependencies.toolExecutionObservationMonoNow ?? systemToolExecutionObservationMonoNow,
28138
- write: dependencies.toolExecutionObservationWriter ?? writeToolExecutionObservationRecord
28139
- });
28140
- const observe = async (run, ctx) => {
28141
- try {
28142
- await run();
28143
- } catch (error) {
28144
- failInfrastructure(error, ctx);
28145
- }
28146
- };
28147
- roleHost.on("tool_execution_start", async (event, ctx) => {
28148
- await observe(() => observationFace.onStart(event), ctx);
28149
- });
28150
- roleHost.on("tool_execution_update", async (event, ctx) => {
28151
- await observe(() => observationFace.onUpdate(event), ctx);
28152
- });
28153
- roleHost.on("tool_execution_end", async (event, ctx) => {
28154
- await observe(() => observationFace.onEnd(event), ctx);
28155
- });
28156
28001
  const recordHttpObservation = async (status, provider, ctx) => {
28157
28002
  const runDir = runDirectoryFromHostContext(ctx);
28158
28003
  if (runDir === void 0) return;
@@ -28201,7 +28046,6 @@ function createRoleRuntimeExtension(dependencies) {
28201
28046
  collectorFirstDispatchDone = false;
28202
28047
  receiptDelivery = createReceiptDeliveryPolicy();
28203
28048
  noReceiptRecorded = false;
28204
- observationFace.reset();
28205
28049
  pendingNavigatorPresentation = void 0;
28206
28050
  pendingNavigatorSettlement = void 0;
28207
28051
  pendingInfrastructureFailures.clear();