@akagilnc/pi-workflow-roles 0.1.5207 → 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.
- package/README.md +1 -1
- package/dist/acp-host/production-host.js +133 -289
- package/dist/headless-host/production-host.js +109 -265
- package/dist/public-cli/main.js +0 -1
- package/dist/sitian-appender.js +0 -1
- package/dist/submission-ledger.js +8 -29
- package/package.json +2 -3
- package/scripts/build-package.mjs +1 -3
- package/src/host-contracts.ts +0 -100
- package/src/role-runtime.ts +4 -57
- package/src/sitian-appender.ts +0 -1
- package/src/sitian-contracts.ts +0 -3
- package/src/submission-ledger.ts +10 -31
- package/dist/pi/in-process-session.js +0 -660
- package/dist/stream-idle-guard.js +0 -67
- package/schemas/tool-execution-observation.schema.json +0 -107
- package/scripts/generate-tool-execution-observation-schema.ts +0 -7
- package/src/in-process-session.ts +0 -1
- package/src/pi/in-process-session.ts +0 -861
- package/src/stream-idle-guard.ts +0 -98
- package/src/tool-execution-observation.ts +0 -168
|
@@ -4731,7 +4731,6 @@ function appendSitianRecord(input) {
|
|
|
4731
4731
|
identity,
|
|
4732
4732
|
...input.subject === void 0 ? {} : { subject: input.subject },
|
|
4733
4733
|
...input.sessionParent === void 0 ? {} : { sessionParent: input.sessionParent },
|
|
4734
|
-
...input.priorEventId === void 0 ? {} : { priorEventId: input.priorEventId },
|
|
4735
4734
|
timestamp: timestamp2,
|
|
4736
4735
|
host,
|
|
4737
4736
|
...input.source === void 0 ? {} : { source: input.source },
|
|
@@ -12040,17 +12039,8 @@ async function restoreState(cwd, runId, scope) {
|
|
|
12040
12039
|
}
|
|
12041
12040
|
return { sequence: 0 };
|
|
12042
12041
|
}
|
|
12043
|
-
const {
|
|
12044
|
-
const last = owned.at(-1);
|
|
12042
|
+
const { owned } = located;
|
|
12045
12043
|
return {
|
|
12046
|
-
...last === void 0 ? {} : {
|
|
12047
|
-
prior: {
|
|
12048
|
-
identity: last.identity,
|
|
12049
|
-
recordFile: file,
|
|
12050
|
-
kind: last.kind,
|
|
12051
|
-
level: last.level
|
|
12052
|
-
}
|
|
12053
|
-
},
|
|
12054
12044
|
sequence: owned.reduce((maximum, record4) => {
|
|
12055
12045
|
const payload = record4.payload;
|
|
12056
12046
|
return payload?.type === "candidate" && typeof payload.sequence === "number" ? Math.max(maximum, payload.sequence) : maximum;
|
|
@@ -12078,15 +12068,10 @@ async function sealAcceptedSubmission(options) {
|
|
|
12078
12068
|
const attemptId = attemptIdentity(options.context, runId);
|
|
12079
12069
|
const sessionParent = sessionParentFromHostContext(options.context);
|
|
12080
12070
|
const home = homeFromHostContext(options.context, options.home);
|
|
12081
|
-
|
|
12082
|
-
...home === void 0 ? {} : { home },
|
|
12083
|
-
...sessionParent === void 0 ? {} : { sessionParent }
|
|
12084
|
-
});
|
|
12085
|
-
const pointer = sitianReport({
|
|
12071
|
+
sitianReport({
|
|
12086
12072
|
level: "event",
|
|
12087
12073
|
kind: "sealed",
|
|
12088
12074
|
subject: { runId, attemptId },
|
|
12089
|
-
...state.prior === void 0 ? {} : { priorEventId: state.prior.identity },
|
|
12090
12075
|
payload: {
|
|
12091
12076
|
type: "sealed",
|
|
12092
12077
|
attemptId,
|
|
@@ -12099,7 +12084,6 @@ async function sealAcceptedSubmission(options) {
|
|
|
12099
12084
|
...home !== void 0 ? { home } : {},
|
|
12100
12085
|
...sessionParent === void 0 ? {} : { sessionParent }
|
|
12101
12086
|
});
|
|
12102
|
-
state.prior = pointer;
|
|
12103
12087
|
}
|
|
12104
12088
|
function createSubmissionLedgerHost(host, outputTools, failInfrastructure2 = (error) => {
|
|
12105
12089
|
throw error;
|
|
@@ -12116,31 +12100,28 @@ function createSubmissionLedgerHost(host, outputTools, failInfrastructure2 = (er
|
|
|
12116
12100
|
states.set(runId, pending);
|
|
12117
12101
|
return pending;
|
|
12118
12102
|
})();
|
|
12119
|
-
const appendFor = (
|
|
12103
|
+
const appendFor = (context, runId, attemptId, event) => {
|
|
12120
12104
|
const home = resolveHomeFromContext(context);
|
|
12121
12105
|
const sessionParent = sessionParentFromHostContext(context);
|
|
12122
|
-
|
|
12106
|
+
return sitianReport({
|
|
12123
12107
|
level: "event",
|
|
12124
12108
|
kind: event.type,
|
|
12125
12109
|
subject: { runId, attemptId },
|
|
12126
|
-
...state.prior === void 0 ? {} : { priorEventId: state.prior.identity },
|
|
12127
12110
|
payload: event,
|
|
12128
12111
|
source: "role-runtime",
|
|
12129
12112
|
cwd: context.cwd,
|
|
12130
12113
|
...home !== void 0 ? { home } : {},
|
|
12131
12114
|
...sessionParent === void 0 ? {} : { sessionParent }
|
|
12132
12115
|
});
|
|
12133
|
-
state.prior = pointer;
|
|
12134
|
-
return pointer;
|
|
12135
12116
|
};
|
|
12136
12117
|
host.on("turn_end", async (event, context) => {
|
|
12137
12118
|
try {
|
|
12138
12119
|
const runId = runIdentity(context);
|
|
12139
12120
|
const attemptId = attemptIdentity(context, runId);
|
|
12140
|
-
const state = await stateFor(context, runId);
|
|
12141
12121
|
const calls = event.calls.map(({ toolCallId: id, toolName: name }) => ({ id, name }));
|
|
12142
12122
|
if (calls.length > 0) {
|
|
12143
|
-
|
|
12123
|
+
await stateFor(context, runId);
|
|
12124
|
+
appendFor(context, runId, attemptId, { type: "roundContext", attemptId, calls });
|
|
12144
12125
|
}
|
|
12145
12126
|
} catch (error) {
|
|
12146
12127
|
failInfrastructure2(error, context);
|
|
@@ -12164,7 +12145,7 @@ function createSubmissionLedgerHost(host, outputTools, failInfrastructure2 = (er
|
|
|
12164
12145
|
const runId = runIdentity(context);
|
|
12165
12146
|
const attemptId = attemptIdentity(context, runId);
|
|
12166
12147
|
const state = await stateFor(context, runId);
|
|
12167
|
-
const append = (event) => appendFor(
|
|
12148
|
+
const append = (event) => appendFor(context, runId, attemptId, event);
|
|
12168
12149
|
append({
|
|
12169
12150
|
type: "candidate",
|
|
12170
12151
|
attemptId,
|
|
@@ -24821,9 +24802,9 @@ init_sitian_facade();
|
|
|
24821
24802
|
init_submission_ledger();
|
|
24822
24803
|
init_collector_ledger();
|
|
24823
24804
|
import { randomUUID as randomUUID8 } from "node:crypto";
|
|
24824
|
-
import { readFileSync as readFileSync6, writeSync as
|
|
24805
|
+
import { readFileSync as readFileSync6, writeSync as writeSync2 } from "node:fs";
|
|
24825
24806
|
import { join as join46 } from "node:path";
|
|
24826
|
-
import { Value as
|
|
24807
|
+
import { Value as Value4 } from "typebox/value";
|
|
24827
24808
|
|
|
24828
24809
|
// src/activation-trace.ts
|
|
24829
24810
|
import { Type as Type14 } from "typebox";
|
|
@@ -24993,118 +24974,6 @@ function writeStderrJsonlRecord(record4, write = writeSync) {
|
|
|
24993
24974
|
}
|
|
24994
24975
|
}
|
|
24995
24976
|
|
|
24996
|
-
// src/tool-execution-observation.ts
|
|
24997
|
-
import { writeSync as writeSync2 } from "node:fs";
|
|
24998
|
-
import { Type as Type15 } from "typebox";
|
|
24999
|
-
import { Value as Value4 } from "typebox/value";
|
|
25000
|
-
var TOOL_EXECUTION_UPDATE_THROTTLE_MS = 3e4;
|
|
25001
|
-
var observationBase = {
|
|
25002
|
-
role: Type15.String({ minLength: 1 }),
|
|
25003
|
-
toolCallId: Type15.String({ minLength: 1 }),
|
|
25004
|
-
toolName: Type15.String({ minLength: 1 }),
|
|
25005
|
-
timestamp: Type15.String({ format: "date-time" })
|
|
25006
|
-
};
|
|
25007
|
-
var toolExecutionObservationRecordSchema = Type15.Union([
|
|
25008
|
-
Type15.Object({
|
|
25009
|
-
...observationBase,
|
|
25010
|
-
event: Type15.Literal("tool_execution_start")
|
|
25011
|
-
}, { additionalProperties: true }),
|
|
25012
|
-
Type15.Object({
|
|
25013
|
-
...observationBase,
|
|
25014
|
-
event: Type15.Literal("tool_execution_update")
|
|
25015
|
-
}, { additionalProperties: true }),
|
|
25016
|
-
Type15.Object({
|
|
25017
|
-
...observationBase,
|
|
25018
|
-
event: Type15.Literal("tool_execution_end"),
|
|
25019
|
-
isError: Type15.Boolean()
|
|
25020
|
-
}, { additionalProperties: true })
|
|
25021
|
-
]);
|
|
25022
|
-
function validateToolExecutionObservationRecord(record4) {
|
|
25023
|
-
if (!Value4.Check(toolExecutionObservationRecordSchema, record4)) {
|
|
25024
|
-
throw new TypeError("Tool execution observation record does not match its contract");
|
|
25025
|
-
}
|
|
25026
|
-
return record4;
|
|
25027
|
-
}
|
|
25028
|
-
function writeToolExecutionObservationRecord(record4, write = writeSync2) {
|
|
25029
|
-
writeStderrJsonlRecord(validateToolExecutionObservationRecord(record4), write);
|
|
25030
|
-
}
|
|
25031
|
-
function isProducingToolUpdate(partialResult) {
|
|
25032
|
-
if (partialResult == null) return false;
|
|
25033
|
-
if (typeof partialResult !== "object") return true;
|
|
25034
|
-
const content = partialResult.content;
|
|
25035
|
-
if (!Array.isArray(content)) return true;
|
|
25036
|
-
if (content.length === 0) return false;
|
|
25037
|
-
return content.some((part) => {
|
|
25038
|
-
if (typeof part !== "object" || part === null) return true;
|
|
25039
|
-
const text = part.text;
|
|
25040
|
-
if (typeof text === "string") return text.length > 0;
|
|
25041
|
-
return true;
|
|
25042
|
-
});
|
|
25043
|
-
}
|
|
25044
|
-
function systemToolExecutionObservationMonoNow() {
|
|
25045
|
-
return performance.now();
|
|
25046
|
-
}
|
|
25047
|
-
function createToolExecutionObservationFace(options) {
|
|
25048
|
-
const states = /* @__PURE__ */ new Map();
|
|
25049
|
-
async function emit(record4) {
|
|
25050
|
-
await options.write(validateToolExecutionObservationRecord(record4));
|
|
25051
|
-
}
|
|
25052
|
-
function activeRole() {
|
|
25053
|
-
if (!options.admitted()) return void 0;
|
|
25054
|
-
const role = options.role();
|
|
25055
|
-
return role === void 0 || role === "" ? void 0 : role;
|
|
25056
|
-
}
|
|
25057
|
-
return {
|
|
25058
|
-
reset() {
|
|
25059
|
-
states.clear();
|
|
25060
|
-
},
|
|
25061
|
-
async onStart(event) {
|
|
25062
|
-
const role = activeRole();
|
|
25063
|
-
if (role === void 0) return;
|
|
25064
|
-
states.set(event.toolCallId, { lastUpdateEmitMonoMs: void 0 });
|
|
25065
|
-
await emit({
|
|
25066
|
-
event: "tool_execution_start",
|
|
25067
|
-
role,
|
|
25068
|
-
toolCallId: event.toolCallId,
|
|
25069
|
-
toolName: event.toolName,
|
|
25070
|
-
timestamp: options.clock()
|
|
25071
|
-
});
|
|
25072
|
-
},
|
|
25073
|
-
async onUpdate(event) {
|
|
25074
|
-
const role = activeRole();
|
|
25075
|
-
if (role === void 0) return;
|
|
25076
|
-
if (!isProducingToolUpdate(event.partialResult)) return;
|
|
25077
|
-
const now = options.monoNow();
|
|
25078
|
-
const state = states.get(event.toolCallId) ?? { lastUpdateEmitMonoMs: void 0 };
|
|
25079
|
-
if (state.lastUpdateEmitMonoMs !== void 0 && now - state.lastUpdateEmitMonoMs < TOOL_EXECUTION_UPDATE_THROTTLE_MS) {
|
|
25080
|
-
return;
|
|
25081
|
-
}
|
|
25082
|
-
state.lastUpdateEmitMonoMs = now;
|
|
25083
|
-
states.set(event.toolCallId, state);
|
|
25084
|
-
await emit({
|
|
25085
|
-
event: "tool_execution_update",
|
|
25086
|
-
role,
|
|
25087
|
-
toolCallId: event.toolCallId,
|
|
25088
|
-
toolName: event.toolName,
|
|
25089
|
-
timestamp: options.clock()
|
|
25090
|
-
});
|
|
25091
|
-
},
|
|
25092
|
-
async onEnd(event) {
|
|
25093
|
-
const role = activeRole();
|
|
25094
|
-
if (role === void 0) return;
|
|
25095
|
-
states.delete(event.toolCallId);
|
|
25096
|
-
await emit({
|
|
25097
|
-
event: "tool_execution_end",
|
|
25098
|
-
role,
|
|
25099
|
-
toolCallId: event.toolCallId,
|
|
25100
|
-
toolName: event.toolName,
|
|
25101
|
-
timestamp: options.clock(),
|
|
25102
|
-
isError: event.isError
|
|
25103
|
-
});
|
|
25104
|
-
}
|
|
25105
|
-
};
|
|
25106
|
-
}
|
|
25107
|
-
|
|
25108
24977
|
// src/role-runtime.ts
|
|
25109
24978
|
init_engine_detour();
|
|
25110
24979
|
init_engine_material();
|
|
@@ -25113,10 +24982,10 @@ init_engine_material();
|
|
|
25113
24982
|
init_engine_detour();
|
|
25114
24983
|
init_engine_detour_usage();
|
|
25115
24984
|
init_run_terminal_artifacts();
|
|
25116
|
-
import { Type as
|
|
25117
|
-
var engineDetourArgsSchema =
|
|
24985
|
+
import { Type as Type15 } from "typebox";
|
|
24986
|
+
var engineDetourArgsSchema = Type15.Object(
|
|
25118
24987
|
{
|
|
25119
|
-
argv:
|
|
24988
|
+
argv: Type15.Array(Type15.String({ minLength: 1 }), {
|
|
25120
24989
|
minItems: 1,
|
|
25121
24990
|
description: "\u9996\u9879\u4E3A PATH \u4E2D\u7684\u53EF\u6267\u884C\u6587\u4EF6\uFF0C\u5176\u4F59\u9879\u4E3A\u53C2\u6570\u3002"
|
|
25122
24991
|
})
|
|
@@ -25263,63 +25132,63 @@ import { join as join45, sep as sep6 } from "node:path";
|
|
|
25263
25132
|
// src/collector-tool-schemas.ts
|
|
25264
25133
|
init_open_tool_schema();
|
|
25265
25134
|
init_terminating_infrastructure();
|
|
25266
|
-
import { Type as
|
|
25267
|
-
var collectorObserveArgsSchema =
|
|
25268
|
-
var collectorRequestArgsSchema =
|
|
25269
|
-
requestId:
|
|
25135
|
+
import { Type as Type16 } from "typebox";
|
|
25136
|
+
var collectorObserveArgsSchema = Type16.Object({}, { additionalProperties: true });
|
|
25137
|
+
var collectorRequestArgsSchema = Type16.Object({
|
|
25138
|
+
requestId: Type16.String({
|
|
25270
25139
|
minLength: 1,
|
|
25271
25140
|
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"
|
|
25272
25141
|
}),
|
|
25273
|
-
snapshotId:
|
|
25142
|
+
snapshotId: Type16.String({ minLength: 1, description: "\u6700\u65B0\u7559\u5B58\u89C2\u5BDF\u5FEB\u7167" }),
|
|
25274
25143
|
// #836 r16 class 3: body.minLength deleted — manifest-configured requestId
|
|
25275
25144
|
// ignores body, and the unknown-requestId non-empty condition is a real
|
|
25276
25145
|
// branch in src/collector-ledger.ts:922-951, not a provider shape gate.
|
|
25277
|
-
body:
|
|
25146
|
+
body: Type16.Optional(Type16.String({
|
|
25278
25147
|
description: "\u89D2\u8272\u5224\u5B9A\u7684\u8BF7\u6C42\u6B63\u6587\uFF1Brequest-manifest \u672A\u6536\u5F55\u8BE5 requestId \u65F6\u5FC5\u586B"
|
|
25279
25148
|
}))
|
|
25280
25149
|
}, { additionalProperties: true });
|
|
25281
25150
|
var COLLECTOR_HANDBOOK_MAX_BYTES = 64 * 1024;
|
|
25282
|
-
var collectorHandbookWriteArgsSchema =
|
|
25283
|
-
scope:
|
|
25284
|
-
|
|
25285
|
-
|
|
25151
|
+
var collectorHandbookWriteArgsSchema = Type16.Object({
|
|
25152
|
+
scope: Type16.Union([
|
|
25153
|
+
Type16.Literal("general"),
|
|
25154
|
+
Type16.Literal("repo")
|
|
25286
25155
|
], { description: "general\uFF1D\u901A\u7528\u624B\u518C\uFF1Brepo\uFF1D\u5F53\u524D\u4ED3\u5E93\u5DEE\u5F02" }),
|
|
25287
|
-
body:
|
|
25156
|
+
body: Type16.String({
|
|
25288
25157
|
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`
|
|
25289
25158
|
})
|
|
25290
25159
|
}, { additionalProperties: true });
|
|
25291
|
-
var collectorReadArgsSchema =
|
|
25292
|
-
evidenceId:
|
|
25160
|
+
var collectorReadArgsSchema = Type16.Object({
|
|
25161
|
+
evidenceId: Type16.String({ minLength: 1, description: "observe \u8FD4\u56DE\u7684\u6750\u6599\u8BC1\u636E id\uFF08evidenceId\uFF09" })
|
|
25293
25162
|
}, { additionalProperties: true });
|
|
25294
|
-
var collectorWaitArgsSchema =
|
|
25295
|
-
durationMs:
|
|
25163
|
+
var collectorWaitArgsSchema = Type16.Object({
|
|
25164
|
+
durationMs: Type16.Integer({
|
|
25296
25165
|
minimum: 1,
|
|
25297
25166
|
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"
|
|
25298
25167
|
})
|
|
25299
25168
|
}, { additionalProperties: true });
|
|
25300
|
-
var collectorOpenWaitWindowArgsSchema =
|
|
25301
|
-
startedAt:
|
|
25169
|
+
var collectorOpenWaitWindowArgsSchema = Type16.Object({
|
|
25170
|
+
startedAt: Type16.Optional(Type16.String({
|
|
25302
25171
|
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"
|
|
25303
25172
|
}))
|
|
25304
25173
|
}, { additionalProperties: true });
|
|
25305
|
-
var collectorBindTargetArgsSchema =
|
|
25306
|
-
prNumber:
|
|
25174
|
+
var collectorBindTargetArgsSchema = Type16.Object({
|
|
25175
|
+
prNumber: Type16.Optional(Type16.Unknown({
|
|
25307
25176
|
description: "\u672C\u4ED3 PR \u53F7\uFF08\u6B63\u6574\u6570\uFF09\u3002"
|
|
25308
25177
|
})),
|
|
25309
|
-
issueNumber:
|
|
25178
|
+
issueNumber: Type16.Optional(Type16.Unknown({
|
|
25310
25179
|
description: "\u672C\u4ED3 issue \u53F7\uFF08\u6B63\u6574\u6570\uFF09\u3002"
|
|
25311
25180
|
}))
|
|
25312
25181
|
}, { additionalProperties: true });
|
|
25313
25182
|
var collectorFindingItemDeclaration = (() => {
|
|
25314
|
-
const item =
|
|
25183
|
+
const item = Type16.Object(
|
|
25315
25184
|
{
|
|
25316
|
-
evidenceId:
|
|
25185
|
+
evidenceId: Type16.Unknown({
|
|
25317
25186
|
description: "observe \u8FD4\u56DE\u7684\u6750\u6599\u6307\u9488\uFF08\u5FC5\u586B\u8BED\u4E49\uFF09"
|
|
25318
25187
|
}),
|
|
25319
|
-
category:
|
|
25188
|
+
category: Type16.Unknown({
|
|
25320
25189
|
description: "\u7B80\u77ED\u5F52\u7C7B\u6807\u7B7E\uFF0C\u4E0D\u662F\u6458\u8981"
|
|
25321
25190
|
}),
|
|
25322
|
-
summary:
|
|
25191
|
+
summary: Type16.Unknown({
|
|
25323
25192
|
description: "\u54EA\u4E2A bot\u3001\u4EC0\u4E48\u95EE\u9898\u7684\u6458\u8981\uFF1B\u4E0D\u8A8A\u6284\u6B63\u6587"
|
|
25324
25193
|
})
|
|
25325
25194
|
},
|
|
@@ -25332,14 +25201,14 @@ var collectorFindingItemDeclaration = (() => {
|
|
|
25332
25201
|
return item;
|
|
25333
25202
|
})();
|
|
25334
25203
|
var collectorOutputBaseSchema = openToolObject(
|
|
25335
|
-
|
|
25204
|
+
Type16.Object({
|
|
25336
25205
|
// No root type:array — host must not shape-reject non-array findings (#676 C).
|
|
25337
25206
|
// Nested item declarations ride `items` for registration preservation (ADR 0057).
|
|
25338
|
-
findings:
|
|
25207
|
+
findings: Type16.Unsafe({
|
|
25339
25208
|
description: "\u672C\u6B21\u6536\u96C6\u5230\u7684\u9010\u6761 findings \u6307\u9488\u3002",
|
|
25340
25209
|
items: collectorFindingItemDeclaration
|
|
25341
25210
|
}),
|
|
25342
|
-
unfinishedReasons:
|
|
25211
|
+
unfinishedReasons: Type16.Unknown({
|
|
25343
25212
|
description: "\u672A\u5B8C\u6210\u539F\u56E0\u3002"
|
|
25344
25213
|
})
|
|
25345
25214
|
})
|
|
@@ -26181,18 +26050,18 @@ init_open_tool_schema();
|
|
|
26181
26050
|
init_terminating_infrastructure();
|
|
26182
26051
|
init_gleaner_left_contracts();
|
|
26183
26052
|
init_gleaner_left_contracts();
|
|
26184
|
-
import { Type as
|
|
26053
|
+
import { Type as Type17 } from "typebox";
|
|
26185
26054
|
var gleanerLeftOutputSchema = withTerminatingOutputDeclarations(
|
|
26186
26055
|
openToolObject(
|
|
26187
|
-
|
|
26188
|
-
status:
|
|
26056
|
+
Type17.Object({
|
|
26057
|
+
status: Type17.Unknown({
|
|
26189
26058
|
description: "completed"
|
|
26190
26059
|
}),
|
|
26191
|
-
findings:
|
|
26192
|
-
|
|
26060
|
+
findings: Type17.Array(
|
|
26061
|
+
Type17.Object(
|
|
26193
26062
|
{
|
|
26194
|
-
pointer:
|
|
26195
|
-
statement:
|
|
26063
|
+
pointer: Type17.Optional(Type17.String({ description: "\u6587\u4EF6/\u884C\u6307\u9488" })),
|
|
26064
|
+
statement: Type17.Optional(Type17.String({ description: "\u7591\u70B9\u9648\u8FF0" }))
|
|
26196
26065
|
},
|
|
26197
26066
|
{ additionalProperties: true, description: "\u4E00\u6761\u5F39\u7AE0" }
|
|
26198
26067
|
),
|
|
@@ -26232,44 +26101,44 @@ init_open_tool_schema();
|
|
|
26232
26101
|
init_terminating_infrastructure();
|
|
26233
26102
|
init_diarist_contracts();
|
|
26234
26103
|
init_diarist_contracts();
|
|
26235
|
-
import { Type as
|
|
26104
|
+
import { Type as Type18 } from "typebox";
|
|
26236
26105
|
var diaristOutputSchema = withTerminatingOutputDeclarations(
|
|
26237
26106
|
openToolObject(
|
|
26238
|
-
|
|
26239
|
-
status:
|
|
26107
|
+
Type18.Object({
|
|
26108
|
+
status: Type18.Unknown({
|
|
26240
26109
|
description: "completed | escalate"
|
|
26241
26110
|
}),
|
|
26242
|
-
ticketNumber:
|
|
26243
|
-
|
|
26111
|
+
ticketNumber: Type18.Optional(
|
|
26112
|
+
Type18.Unknown({
|
|
26244
26113
|
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"
|
|
26245
26114
|
})
|
|
26246
26115
|
),
|
|
26247
|
-
courtTicketNumbers:
|
|
26248
|
-
|
|
26116
|
+
courtTicketNumbers: Type18.Optional(
|
|
26117
|
+
Type18.Unknown({
|
|
26249
26118
|
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"
|
|
26250
26119
|
})
|
|
26251
26120
|
),
|
|
26252
|
-
reason:
|
|
26253
|
-
|
|
26121
|
+
reason: Type18.Optional(
|
|
26122
|
+
Type18.String({
|
|
26254
26123
|
description: "status \u4E3A escalate \u65F6\uFF1A\u8BA4\u4E0D\u51FA\u672C\u5EAD\u5BF9\u8C61\u7684\u539F\u56E0"
|
|
26255
26124
|
})
|
|
26256
26125
|
),
|
|
26257
|
-
sessions:
|
|
26258
|
-
|
|
26259
|
-
|
|
26126
|
+
sessions: Type18.Optional(
|
|
26127
|
+
Type18.Array(
|
|
26128
|
+
Type18.Object(
|
|
26260
26129
|
{
|
|
26261
|
-
path:
|
|
26262
|
-
|
|
26130
|
+
path: Type18.Optional(
|
|
26131
|
+
Type18.String({ description: "\u4F1A\u8BDD\u5377\u7EDD\u5BF9\u6216\u53EF\u8BFB\u8DEF\u5F84" })
|
|
26263
26132
|
),
|
|
26264
|
-
ranges:
|
|
26265
|
-
|
|
26266
|
-
|
|
26133
|
+
ranges: Type18.Optional(
|
|
26134
|
+
Type18.Array(
|
|
26135
|
+
Type18.Object(
|
|
26267
26136
|
{
|
|
26268
|
-
from:
|
|
26269
|
-
|
|
26137
|
+
from: Type18.Optional(
|
|
26138
|
+
Type18.Object(
|
|
26270
26139
|
{
|
|
26271
|
-
id:
|
|
26272
|
-
line:
|
|
26140
|
+
id: Type18.Optional(Type18.String()),
|
|
26141
|
+
line: Type18.Optional(Type18.Unknown())
|
|
26273
26142
|
},
|
|
26274
26143
|
{
|
|
26275
26144
|
additionalProperties: true,
|
|
@@ -26277,11 +26146,11 @@ var diaristOutputSchema = withTerminatingOutputDeclarations(
|
|
|
26277
26146
|
}
|
|
26278
26147
|
)
|
|
26279
26148
|
),
|
|
26280
|
-
to:
|
|
26281
|
-
|
|
26149
|
+
to: Type18.Optional(
|
|
26150
|
+
Type18.Object(
|
|
26282
26151
|
{
|
|
26283
|
-
id:
|
|
26284
|
-
line:
|
|
26152
|
+
id: Type18.Optional(Type18.String()),
|
|
26153
|
+
line: Type18.Optional(Type18.Unknown())
|
|
26285
26154
|
},
|
|
26286
26155
|
{
|
|
26287
26156
|
additionalProperties: true,
|
|
@@ -26318,23 +26187,23 @@ var DIARIST_TOOL_SPEC = {
|
|
|
26318
26187
|
init_terminating_infrastructure();
|
|
26319
26188
|
init_secretariat_contracts();
|
|
26320
26189
|
init_secretariat_contracts();
|
|
26321
|
-
import { Type as
|
|
26190
|
+
import { Type as Type19 } from "typebox";
|
|
26322
26191
|
var secretariatVerdictSchema = withTerminatingOutputDeclarations(
|
|
26323
|
-
|
|
26192
|
+
Type19.Object(
|
|
26324
26193
|
{
|
|
26325
|
-
secretariatStatus:
|
|
26194
|
+
secretariatStatus: Type19.Unknown({
|
|
26326
26195
|
description: "converged | escalate"
|
|
26327
26196
|
}),
|
|
26328
|
-
ticketNumber:
|
|
26329
|
-
|
|
26197
|
+
ticketNumber: Type19.Optional(
|
|
26198
|
+
Type19.Number({ description: "\u672C\u7968\u53F7\uFF1B\u7F72\u65F6\u6307\u5411\u6700\u7EC8\u6B63\u6587\u6240\u5728\u7968" })
|
|
26330
26199
|
),
|
|
26331
|
-
note:
|
|
26332
|
-
evidence:
|
|
26333
|
-
decisionGate:
|
|
26334
|
-
|
|
26200
|
+
note: Type19.Optional(Type19.String({ description: "\u9644\u6CE8" })),
|
|
26201
|
+
evidence: Type19.Optional(Type19.Unknown({ description: "\u7559\u5B58\u8BC1\u636E" })),
|
|
26202
|
+
decisionGate: Type19.Optional(
|
|
26203
|
+
Type19.Object(
|
|
26335
26204
|
{
|
|
26336
|
-
question:
|
|
26337
|
-
options:
|
|
26205
|
+
question: Type19.Optional(Type19.String()),
|
|
26206
|
+
options: Type19.Optional(Type19.Array(Type19.String()))
|
|
26338
26207
|
},
|
|
26339
26208
|
{ additionalProperties: true, description: "\u9700\u965B\u4E0B\u5904\u7F6E\u7684\u95EE\u9898\u4E0E\u9009\u9879" }
|
|
26340
26209
|
)
|
|
@@ -26409,12 +26278,12 @@ init_judge_role();
|
|
|
26409
26278
|
init_open_tool_schema();
|
|
26410
26279
|
init_terminating_infrastructure();
|
|
26411
26280
|
init_reviewer_output();
|
|
26412
|
-
import { Type as
|
|
26413
|
-
var reviewerAmendmentsSchema =
|
|
26414
|
-
completeness:
|
|
26281
|
+
import { Type as Type20 } from "typebox";
|
|
26282
|
+
var reviewerAmendmentsSchema = Type20.Object({
|
|
26283
|
+
completeness: Type20.Optional(Type20.String({
|
|
26415
26284
|
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"
|
|
26416
26285
|
})),
|
|
26417
|
-
correctness:
|
|
26286
|
+
correctness: Type20.Optional(Type20.String({
|
|
26418
26287
|
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"
|
|
26419
26288
|
}))
|
|
26420
26289
|
}, {
|
|
@@ -26422,15 +26291,15 @@ var reviewerAmendmentsSchema = Type21.Object({
|
|
|
26422
26291
|
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"
|
|
26423
26292
|
});
|
|
26424
26293
|
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";
|
|
26425
|
-
var reviewerOutputVariants =
|
|
26426
|
-
|
|
26427
|
-
status:
|
|
26428
|
-
amendments:
|
|
26294
|
+
var reviewerOutputVariants = Type20.Union([
|
|
26295
|
+
Type20.Object({
|
|
26296
|
+
status: Type20.Unknown({ description: REVIEWER_STATUS_DESCRIPTION }),
|
|
26297
|
+
amendments: Type20.Optional(reviewerAmendmentsSchema)
|
|
26429
26298
|
}, { additionalProperties: false }),
|
|
26430
|
-
|
|
26431
|
-
status:
|
|
26432
|
-
diagnostic:
|
|
26433
|
-
amendments:
|
|
26299
|
+
Type20.Object({
|
|
26300
|
+
status: Type20.Unknown({ description: REVIEWER_STATUS_DESCRIPTION }),
|
|
26301
|
+
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" }),
|
|
26302
|
+
amendments: Type20.Optional(reviewerAmendmentsSchema)
|
|
26434
26303
|
}, { additionalProperties: false })
|
|
26435
26304
|
]);
|
|
26436
26305
|
var reviewerOutputSchema = withTerminatingOutputDeclarations(
|
|
@@ -26479,7 +26348,7 @@ init_terminating_infrastructure();
|
|
|
26479
26348
|
init_worker_output();
|
|
26480
26349
|
init_fixer_output();
|
|
26481
26350
|
init_fixer_packet();
|
|
26482
|
-
import { Type as
|
|
26351
|
+
import { Type as Type21 } from "typebox";
|
|
26483
26352
|
|
|
26484
26353
|
// src/worker-submission-gates.ts
|
|
26485
26354
|
init_archivist_record_entry();
|
|
@@ -26745,20 +26614,20 @@ function fixerBashSeatbeltDenyReason(matched) {
|
|
|
26745
26614
|
|
|
26746
26615
|
// src/worker-role.ts
|
|
26747
26616
|
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";
|
|
26748
|
-
var coderOutputVariants =
|
|
26749
|
-
|
|
26750
|
-
status:
|
|
26751
|
-
report:
|
|
26617
|
+
var coderOutputVariants = Type21.Union([
|
|
26618
|
+
Type21.Object({
|
|
26619
|
+
status: Type21.Unknown({ description: CODER_STATUS_DESCRIPTION }),
|
|
26620
|
+
report: Type21.String({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" })
|
|
26752
26621
|
}, { additionalProperties: false }),
|
|
26753
|
-
|
|
26754
|
-
status:
|
|
26755
|
-
report:
|
|
26622
|
+
Type21.Object({
|
|
26623
|
+
status: Type21.Unknown({ description: CODER_STATUS_DESCRIPTION }),
|
|
26624
|
+
report: Type21.String({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" })
|
|
26756
26625
|
}, { additionalProperties: false }),
|
|
26757
|
-
|
|
26758
|
-
status:
|
|
26759
|
-
report:
|
|
26760
|
-
remainingScope:
|
|
26761
|
-
reason:
|
|
26626
|
+
Type21.Object({
|
|
26627
|
+
status: Type21.Unknown({ description: CODER_STATUS_DESCRIPTION }),
|
|
26628
|
+
report: Type21.String({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" }),
|
|
26629
|
+
remainingScope: Type21.String({ description: "\u672C\u5C40\u540E\u5269\u4F59\u5DE5\u4F5C" }),
|
|
26630
|
+
reason: Type21.Optional(Type21.String({
|
|
26762
26631
|
minLength: 1,
|
|
26763
26632
|
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"
|
|
26764
26633
|
}))
|
|
@@ -27206,7 +27075,7 @@ function activationStage(role, activate) {
|
|
|
27206
27075
|
};
|
|
27207
27076
|
}
|
|
27208
27077
|
function validateActivationTraceRecord(record4) {
|
|
27209
|
-
if (!
|
|
27078
|
+
if (!Value4.Check(activationTraceRecordSchema, record4)) {
|
|
27210
27079
|
throw new TypeError("Activation trace record does not match its closed contract");
|
|
27211
27080
|
}
|
|
27212
27081
|
return record4;
|
|
@@ -27232,7 +27101,7 @@ async function executeActivationStage(role, stage, infrastructure) {
|
|
|
27232
27101
|
throw activationError;
|
|
27233
27102
|
}
|
|
27234
27103
|
}
|
|
27235
|
-
function writeActivationTraceRecord(record4, write =
|
|
27104
|
+
function writeActivationTraceRecord(record4, write = writeSync2) {
|
|
27236
27105
|
writeStderrJsonlRecord(record4, write);
|
|
27237
27106
|
}
|
|
27238
27107
|
var ActivationBarrierError = class extends Error {
|
|
@@ -28009,7 +27878,6 @@ function createRoleRuntimeExtension(dependencies) {
|
|
|
28009
27878
|
disposeNavigatorAttendanceNonBlocking(attendanceToDispose);
|
|
28010
27879
|
pendingInfrastructureFailures.clear();
|
|
28011
27880
|
pendingSubmissionNonPassByToolCallId.clear();
|
|
28012
|
-
observationFace.reset();
|
|
28013
27881
|
});
|
|
28014
27882
|
const hostActions = {
|
|
28015
27883
|
failInfrastructure(error, ctx, toolCallId) {
|
|
@@ -28225,29 +28093,6 @@ function createRoleRuntimeExtension(dependencies) {
|
|
|
28225
28093
|
};
|
|
28226
28094
|
const clock = dependencies.activationClock ?? (() => (/* @__PURE__ */ new Date()).toISOString());
|
|
28227
28095
|
const writeTrace = dependencies.activationTraceWriter ?? writeActivationTraceRecord;
|
|
28228
|
-
const observationFace = createToolExecutionObservationFace({
|
|
28229
|
-
role: () => selectedRole,
|
|
28230
|
-
admitted: () => admitted,
|
|
28231
|
-
clock: dependencies.toolExecutionObservationClock ?? clock,
|
|
28232
|
-
monoNow: dependencies.toolExecutionObservationMonoNow ?? systemToolExecutionObservationMonoNow,
|
|
28233
|
-
write: dependencies.toolExecutionObservationWriter ?? writeToolExecutionObservationRecord
|
|
28234
|
-
});
|
|
28235
|
-
const observe = async (run, ctx) => {
|
|
28236
|
-
try {
|
|
28237
|
-
await run();
|
|
28238
|
-
} catch (error) {
|
|
28239
|
-
failInfrastructure(error, ctx);
|
|
28240
|
-
}
|
|
28241
|
-
};
|
|
28242
|
-
roleHost.on("tool_execution_start", async (event, ctx) => {
|
|
28243
|
-
await observe(() => observationFace.onStart(event), ctx);
|
|
28244
|
-
});
|
|
28245
|
-
roleHost.on("tool_execution_update", async (event, ctx) => {
|
|
28246
|
-
await observe(() => observationFace.onUpdate(event), ctx);
|
|
28247
|
-
});
|
|
28248
|
-
roleHost.on("tool_execution_end", async (event, ctx) => {
|
|
28249
|
-
await observe(() => observationFace.onEnd(event), ctx);
|
|
28250
|
-
});
|
|
28251
28096
|
const recordHttpObservation = async (status, provider, ctx) => {
|
|
28252
28097
|
const runDir = runDirectoryFromHostContext(ctx);
|
|
28253
28098
|
if (runDir === void 0) return;
|
|
@@ -28296,7 +28141,6 @@ function createRoleRuntimeExtension(dependencies) {
|
|
|
28296
28141
|
collectorFirstDispatchDone = false;
|
|
28297
28142
|
receiptDelivery = createReceiptDeliveryPolicy();
|
|
28298
28143
|
noReceiptRecorded = false;
|
|
28299
|
-
observationFace.reset();
|
|
28300
28144
|
pendingNavigatorPresentation = void 0;
|
|
28301
28145
|
pendingNavigatorSettlement = void 0;
|
|
28302
28146
|
pendingInfrastructureFailures.clear();
|
package/dist/public-cli/main.js
CHANGED
|
@@ -18101,7 +18101,6 @@ function appendSitianRecord(input) {
|
|
|
18101
18101
|
identity,
|
|
18102
18102
|
...input.subject === void 0 ? {} : { subject: input.subject },
|
|
18103
18103
|
...input.sessionParent === void 0 ? {} : { sessionParent: input.sessionParent },
|
|
18104
|
-
...input.priorEventId === void 0 ? {} : { priorEventId: input.priorEventId },
|
|
18105
18104
|
timestamp: timestamp2,
|
|
18106
18105
|
host,
|
|
18107
18106
|
...input.source === void 0 ? {} : { source: input.source },
|
package/dist/sitian-appender.js
CHANGED
|
@@ -240,7 +240,6 @@ function appendSitianRecord(input) {
|
|
|
240
240
|
identity,
|
|
241
241
|
...input.subject === void 0 ? {} : { subject: input.subject },
|
|
242
242
|
...input.sessionParent === void 0 ? {} : { sessionParent: input.sessionParent },
|
|
243
|
-
...input.priorEventId === void 0 ? {} : { priorEventId: input.priorEventId },
|
|
244
243
|
timestamp,
|
|
245
244
|
host,
|
|
246
245
|
...input.source === void 0 ? {} : { source: input.source },
|