oasis_test_v2 2.2.70 → 2.2.71
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/dist/index.js +986 -591
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1706,6 +1706,7 @@ function delegationEnding(record9, evidence) {
|
|
|
1706
1706
|
return hasDelegationDelivery(evidence) ? "timeout-delivered" : "timeout-empty";
|
|
1707
1707
|
}
|
|
1708
1708
|
function delegationEndingOfRecord(record9, artifacts = []) {
|
|
1709
|
+
if (record9.state === "running") return void 0;
|
|
1709
1710
|
const last = record9.roundSummaries[record9.roundSummaries.length - 1];
|
|
1710
1711
|
const lastRound = last?.round;
|
|
1711
1712
|
return delegationEnding(record9, {
|
|
@@ -2083,6 +2084,13 @@ var init_chunked_message = __esm({
|
|
|
2083
2084
|
});
|
|
2084
2085
|
|
|
2085
2086
|
// ../contract/src/command-card-copy.ts
|
|
2087
|
+
function containsInternalId(text7) {
|
|
2088
|
+
for (const re of [PREFIXED_ID_RE, UUID_RE, SHORT_ID_RE]) {
|
|
2089
|
+
re.lastIndex = 0;
|
|
2090
|
+
if (re.test(text7)) return true;
|
|
2091
|
+
}
|
|
2092
|
+
return false;
|
|
2093
|
+
}
|
|
2086
2094
|
function stripInternalIds(text7, placeholder = "\u2026") {
|
|
2087
2095
|
if (!text7) return text7;
|
|
2088
2096
|
let out = text7;
|
|
@@ -2152,7 +2160,55 @@ function commandCardDisplayLabel(command2, args, storedLabel, refs = {}) {
|
|
|
2152
2160
|
const described = command2 ? describeCommandForHuman(command2, args ?? {}, refs) : void 0;
|
|
2153
2161
|
return described ?? stripInternalIds(storedLabel ?? "");
|
|
2154
2162
|
}
|
|
2155
|
-
|
|
2163
|
+
function nodeRefPhrase(ref2, refs, neutral = NEUTRAL_NODE) {
|
|
2164
|
+
const raw = (ref2 ?? "").trim();
|
|
2165
|
+
if (!raw) return neutral;
|
|
2166
|
+
const title = refs.nodeTitle?.(raw)?.trim();
|
|
2167
|
+
if (title) return `\u300A${title}\u300B`;
|
|
2168
|
+
if (!containsInternalId(raw)) {
|
|
2169
|
+
const tail = raw.includes(":") ? raw.slice(raw.indexOf(":") + 1).trim() : raw;
|
|
2170
|
+
if (tail && !containsInternalId(tail)) return `\u300A${tail}\u300B`;
|
|
2171
|
+
}
|
|
2172
|
+
return neutral;
|
|
2173
|
+
}
|
|
2174
|
+
function actorNamePhrase(actorId, refs) {
|
|
2175
|
+
const raw = (actorId ?? "").trim();
|
|
2176
|
+
if (!raw) return NEUTRAL_APPROVER;
|
|
2177
|
+
const name = refs.actorName?.(raw)?.trim();
|
|
2178
|
+
if (name) return name;
|
|
2179
|
+
return containsInternalId(raw) ? NEUTRAL_APPROVER : raw;
|
|
2180
|
+
}
|
|
2181
|
+
function graphEditOpDisplayLabel(op, refs = {}) {
|
|
2182
|
+
const node2 = nodeRefPhrase(op?.artifactId, refs);
|
|
2183
|
+
const to = nodeRefPhrase(op?.to, refs, NEUTRAL_NODE_OTHER);
|
|
2184
|
+
switch (op?.action) {
|
|
2185
|
+
case "spawn":
|
|
2186
|
+
return `\u65B0\u5EFA ${op.type || "\u4EA7\u7269"}${op.title ? `\u300C${op.title}\u300D` : ""}`;
|
|
2187
|
+
case "seal":
|
|
2188
|
+
return `${op.reason === "accepted" ? "\u9A8C\u6536" : op.reason === "cancelled" ? "\u5E9F\u5F03" : "\u51BB\u7ED3"}${node2}`;
|
|
2189
|
+
case "reopen":
|
|
2190
|
+
return `\u91CD\u5F00${node2}`;
|
|
2191
|
+
case "link":
|
|
2192
|
+
return `\u63A5\u4F9D\u8D56${node2} \u2192 ${to}`;
|
|
2193
|
+
case "unlink":
|
|
2194
|
+
return `\u65AD\u4F9D\u8D56${node2} \u2715 ${to}`;
|
|
2195
|
+
case "pin":
|
|
2196
|
+
return `\u56FA\u5B9A${node2} \u2192 ${to}`;
|
|
2197
|
+
case "assign":
|
|
2198
|
+
return `\u6539\u6D3E${node2} \u2192 ${actorNamePhrase(op.owner, refs)}`;
|
|
2199
|
+
case "edit":
|
|
2200
|
+
return `\u7F16\u8F91${node2}`;
|
|
2201
|
+
case "annotate":
|
|
2202
|
+
return `\u7ED9${node2}\u7559\u8A00`;
|
|
2203
|
+
case "cancelPart":
|
|
2204
|
+
return `\u64A4\u90E8\u4EF6${node2}`;
|
|
2205
|
+
case "resolveEscalation":
|
|
2206
|
+
return node2 === NEUTRAL_NODE ? "\u5173\u95ED\u8FD9\u4E00\u6B65\u7684\u6C42\u52A9" : `\u5173\u95ED${node2}\u7684\u6C42\u52A9`;
|
|
2207
|
+
default:
|
|
2208
|
+
return op?.action ? stripInternalIds(op.action) : "\u53D8\u66F4";
|
|
2209
|
+
}
|
|
2210
|
+
}
|
|
2211
|
+
var PREFIXED_ID_RE, UUID_RE, SHORT_ID_RE, CARD_SUMMARY_MAX, NEUTRAL_NODE, NEUTRAL_NODE_OTHER, NEUTRAL_ESCALATION, NEUTRAL_GAP, NEUTRAL_APPROVER, argStr;
|
|
2156
2212
|
var init_command_card_copy = __esm({
|
|
2157
2213
|
"../contract/src/command-card-copy.ts"() {
|
|
2158
2214
|
"use strict";
|
|
@@ -2161,8 +2217,10 @@ var init_command_card_copy = __esm({
|
|
|
2161
2217
|
SHORT_ID_RE = /\b(?=[0-9a-f-]*[0-9])(?=[0-9a-f-]*[a-f])[0-9a-f]{8,}(?:-[0-9a-f]{4,})*\b/giu;
|
|
2162
2218
|
CARD_SUMMARY_MAX = 48;
|
|
2163
2219
|
NEUTRAL_NODE = "\u8FD9\u4E00\u6B65";
|
|
2220
|
+
NEUTRAL_NODE_OTHER = "\u53E6\u4E00\u6B65";
|
|
2164
2221
|
NEUTRAL_ESCALATION = "\u8FD9\u6761\u6C42\u52A9";
|
|
2165
2222
|
NEUTRAL_GAP = "\u8FD9\u4E2A\u7F3A\u53E3";
|
|
2223
|
+
NEUTRAL_APPROVER = "\u8D1F\u8D23\u4EBA";
|
|
2166
2224
|
argStr = (args, key2) => {
|
|
2167
2225
|
const v2 = args[key2];
|
|
2168
2226
|
return typeof v2 === "string" && v2.trim() ? v2.trim() : void 0;
|
|
@@ -9144,14 +9202,14 @@ var init_reasonix = __esm({
|
|
|
9144
9202
|
method: "_reasonix.io/session/status_update",
|
|
9145
9203
|
pick(params) {
|
|
9146
9204
|
const rec2 = (v2) => v2 && typeof v2 === "object" && !Array.isArray(v2) ? v2 : void 0;
|
|
9147
|
-
const
|
|
9205
|
+
const num5 = (v2) => typeof v2 === "number" && Number.isFinite(v2) && v2 >= 0 ? v2 : void 0;
|
|
9148
9206
|
const turn = rec2(rec2(rec2(rec2(params)?.["status"])?.["usage"])?.["turn"]);
|
|
9149
9207
|
if (!turn) return void 0;
|
|
9150
|
-
const promptTokens =
|
|
9151
|
-
const cacheHit =
|
|
9152
|
-
const cacheMiss =
|
|
9208
|
+
const promptTokens = num5(turn["promptTokens"]);
|
|
9209
|
+
const cacheHit = num5(turn["cacheHitTokens"]);
|
|
9210
|
+
const cacheMiss = num5(turn["cacheMissTokens"]);
|
|
9153
9211
|
const inputTokens = cacheMiss ?? (promptTokens === void 0 ? void 0 : Math.max(0, promptTokens - (cacheHit ?? 0)));
|
|
9154
|
-
const outputTokens =
|
|
9212
|
+
const outputTokens = num5(turn["completionTokens"]);
|
|
9155
9213
|
if (inputTokens === void 0 && outputTokens === void 0 && cacheHit === void 0) return void 0;
|
|
9156
9214
|
return {
|
|
9157
9215
|
...inputTokens !== void 0 ? { inputTokens } : {},
|
|
@@ -11529,11 +11587,11 @@ var init_chat_item_ledger = __esm({
|
|
|
11529
11587
|
this.tick();
|
|
11530
11588
|
const version2 = this.tick();
|
|
11531
11589
|
if (!this.persistEnabled) return null;
|
|
11532
|
-
const
|
|
11590
|
+
const at2 = this.now();
|
|
11533
11591
|
return {
|
|
11534
11592
|
id,
|
|
11535
11593
|
payload: payload2,
|
|
11536
|
-
at,
|
|
11594
|
+
at: at2,
|
|
11537
11595
|
version: version2,
|
|
11538
11596
|
create: {
|
|
11539
11597
|
id,
|
|
@@ -11547,7 +11605,7 @@ var init_chat_item_ledger = __esm({
|
|
|
11547
11605
|
payload: payload2,
|
|
11548
11606
|
metadata: { [CHAT_ITEM_META_LEGACY_CONTENT]: false },
|
|
11549
11607
|
providerItemKey: null,
|
|
11550
|
-
createdAt:
|
|
11608
|
+
createdAt: at2,
|
|
11551
11609
|
version: version2
|
|
11552
11610
|
}
|
|
11553
11611
|
};
|
|
@@ -12040,11 +12098,11 @@ var init_chat_item_ledger = __esm({
|
|
|
12040
12098
|
persist(row, op, what) {
|
|
12041
12099
|
const version2 = this.tick();
|
|
12042
12100
|
row.wireVersion = version2;
|
|
12043
|
-
const
|
|
12044
|
-
if (op.op === "set_status" && op.status !== "streaming") row.completedAt =
|
|
12101
|
+
const at2 = this.now();
|
|
12102
|
+
if (op.op === "set_status" && op.status !== "streaming") row.completedAt = at2;
|
|
12045
12103
|
if (!row.persist || !this.persistEnabled) return;
|
|
12046
12104
|
this.enqueue(async () => {
|
|
12047
|
-
await this.deps.items.applyOp(row.id, op, { at, version: version2 });
|
|
12105
|
+
await this.deps.items.applyOp(row.id, op, { at: at2, version: version2 });
|
|
12048
12106
|
}, what);
|
|
12049
12107
|
}
|
|
12050
12108
|
/** 串行链 + 失败吞掉计数。**串行是必须的**:append_text 依赖建行已经落地。 */
|
|
@@ -12107,7 +12165,7 @@ var init_chat_item_ledger = __esm({
|
|
|
12107
12165
|
async applyOp(itemId, op, opts) {
|
|
12108
12166
|
const row = this.rows.find((r) => r.id === itemId);
|
|
12109
12167
|
if (!row || opts?.sessionId !== void 0 && row.sessionId !== opts.sessionId) return null;
|
|
12110
|
-
const
|
|
12168
|
+
const at2 = opts?.at ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
12111
12169
|
const payload2 = row.payload && typeof row.payload === "object" && !Array.isArray(row.payload) ? { ...row.payload } : {};
|
|
12112
12170
|
if (op.op === "append_text") payload2.text = `${typeof payload2.text === "string" ? payload2.text : ""}${op.text}`;
|
|
12113
12171
|
else if (op.op === "set_text") payload2.text = op.text;
|
|
@@ -12115,13 +12173,13 @@ var init_chat_item_ledger = __esm({
|
|
|
12115
12173
|
else if (op.op === "set_payload") row.payload = op.payload;
|
|
12116
12174
|
else if (op.op === "set_status") {
|
|
12117
12175
|
row.status = op.status;
|
|
12118
|
-
if (op.status !== "streaming") row.completedAt =
|
|
12176
|
+
if (op.status !== "streaming") row.completedAt = at2;
|
|
12119
12177
|
}
|
|
12120
12178
|
if (op.op !== "set_payload") row.payload = payload2;
|
|
12121
12179
|
row.version = opts?.version === void 0 ? row.version + 1 : Math.max(row.version, opts.version);
|
|
12122
12180
|
const scope2 = this.rows.filter((r) => r.sessionId === row.sessionId && r.turnId === row.turnId);
|
|
12123
12181
|
row.turnVersion = scope2.reduce((n, r) => Math.max(n, r.turnVersion), 0) + 1;
|
|
12124
|
-
row.updatedAt =
|
|
12182
|
+
row.updatedAt = at2;
|
|
12125
12183
|
return row;
|
|
12126
12184
|
}
|
|
12127
12185
|
async bindMessage(sessionId, turnId, messageId, itemIds) {
|
|
@@ -12191,8 +12249,8 @@ function serveRestartCauseOfRun(run) {
|
|
|
12191
12249
|
if (!run || run.exitReason !== "sweep-orphan") return void 0;
|
|
12192
12250
|
const meta = run.metadata;
|
|
12193
12251
|
if (!meta || typeof meta !== "object" || Array.isArray(meta)) return void 0;
|
|
12194
|
-
const
|
|
12195
|
-
return typeof
|
|
12252
|
+
const at2 = meta[SERVE_STOPPED_IN_FLIGHT_KEY];
|
|
12253
|
+
return typeof at2 === "string" && at2.length > 0 ? "system-restart" : void 0;
|
|
12196
12254
|
}
|
|
12197
12255
|
function attributeChatExit(text7, extra, cause) {
|
|
12198
12256
|
if (extra.reason !== "cancelled") return { text: text7, extra };
|
|
@@ -12296,20 +12354,20 @@ async function openAssistantRunningRow(deps) {
|
|
|
12296
12354
|
const now = deps.now ?? (() => (/* @__PURE__ */ new Date()).toISOString());
|
|
12297
12355
|
if (typeof deps.chatStore.appendMessage !== "function") return void 0;
|
|
12298
12356
|
const id = (0, import_node_crypto14.randomUUID)();
|
|
12299
|
-
const
|
|
12357
|
+
const at2 = now();
|
|
12300
12358
|
try {
|
|
12301
12359
|
await deps.chatStore.appendMessage({
|
|
12302
12360
|
id,
|
|
12303
12361
|
sessionId: deps.chatSessionId,
|
|
12304
12362
|
role: "assistant",
|
|
12305
12363
|
content: "",
|
|
12306
|
-
createdAt:
|
|
12364
|
+
createdAt: at2,
|
|
12307
12365
|
status: "running",
|
|
12308
12366
|
...deps.runId ? { runId: deps.runId } : {},
|
|
12309
12367
|
...deps.turnId ? { turnId: deps.turnId } : {}
|
|
12310
12368
|
});
|
|
12311
12369
|
if (typeof deps.chatStore.updateSession === "function") {
|
|
12312
|
-
await deps.chatStore.updateSession(deps.chatSessionId, { touchedAt:
|
|
12370
|
+
await deps.chatStore.updateSession(deps.chatSessionId, { touchedAt: at2 }).catch(() => void 0);
|
|
12313
12371
|
}
|
|
12314
12372
|
return id;
|
|
12315
12373
|
} catch {
|
|
@@ -12358,14 +12416,14 @@ function beginInsertedAssistantSegment(deps) {
|
|
|
12358
12416
|
const nextId = (deps.newId ?? import_node_crypto14.randomUUID)();
|
|
12359
12417
|
const segment = deps.ledger.beginSegment();
|
|
12360
12418
|
deps.live.setAssistantMessageId(nextId);
|
|
12361
|
-
const
|
|
12419
|
+
const at2 = (deps.now ?? (() => (/* @__PURE__ */ new Date()).toISOString()))();
|
|
12362
12420
|
const { chatStore, closingId, segParts } = deps;
|
|
12363
12421
|
const persist = async () => {
|
|
12364
12422
|
if (closingId) {
|
|
12365
12423
|
await chatStore.updateMessage(closingId, {
|
|
12366
12424
|
content: segText,
|
|
12367
12425
|
status: "done",
|
|
12368
|
-
completedAt:
|
|
12426
|
+
completedAt: at2,
|
|
12369
12427
|
...segParts.length ? { parts: segParts } : {}
|
|
12370
12428
|
}).catch(() => void 0);
|
|
12371
12429
|
}
|
|
@@ -12374,7 +12432,7 @@ function beginInsertedAssistantSegment(deps) {
|
|
|
12374
12432
|
sessionId: deps.chatSessionId,
|
|
12375
12433
|
role: "user",
|
|
12376
12434
|
content: deps.text,
|
|
12377
|
-
createdAt:
|
|
12435
|
+
createdAt: at2,
|
|
12378
12436
|
// ADR-0166 D9.1:插入带的附件也落在**这条 user 行**上(同 `/api/chat` 那侧只存引用)。
|
|
12379
12437
|
...deps.attachments?.length ? { attachments: deps.attachments } : {},
|
|
12380
12438
|
...deps.turnId ? { turnId: deps.turnId } : {}
|
|
@@ -12385,7 +12443,7 @@ function beginInsertedAssistantSegment(deps) {
|
|
|
12385
12443
|
sessionId: deps.chatSessionId,
|
|
12386
12444
|
role: "assistant",
|
|
12387
12445
|
content: "",
|
|
12388
|
-
createdAt:
|
|
12446
|
+
createdAt: at2,
|
|
12389
12447
|
status: "running",
|
|
12390
12448
|
...deps.runId ? { runId: deps.runId } : {},
|
|
12391
12449
|
...deps.turnId ? { turnId: deps.turnId } : {}
|
|
@@ -12736,10 +12794,10 @@ async function recordChatTurnInterruption(deps) {
|
|
|
12736
12794
|
const existing = rows.find((r) => r.id === noticeId);
|
|
12737
12795
|
let version2 = await items.sessionVersionCursor(sessionId).catch(() => 0);
|
|
12738
12796
|
const touched = [];
|
|
12739
|
-
const
|
|
12797
|
+
const at2 = now();
|
|
12740
12798
|
for (const row of rows) {
|
|
12741
12799
|
if (row.status !== "streaming") continue;
|
|
12742
|
-
const updated = await items.applyOp(row.id, { op: "set_status", status: "interrupted" }, { at, version: ++version2, sessionId });
|
|
12800
|
+
const updated = await items.applyOp(row.id, { op: "set_status", status: "interrupted" }, { at: at2, version: ++version2, sessionId });
|
|
12743
12801
|
if (updated) touched.push(updated);
|
|
12744
12802
|
}
|
|
12745
12803
|
const payload2 = deps.cause === "sweep-orphan" ? {
|
|
@@ -12750,7 +12808,7 @@ async function recordChatTurnInterruption(deps) {
|
|
|
12750
12808
|
...deps.cancelledBy ? { cancelledBy: deps.cancelledBy } : {}
|
|
12751
12809
|
} : { code: "error", note: CHAT_INTERRUPT_NOTICE[deps.cause], reason: deps.reason };
|
|
12752
12810
|
if (existing) {
|
|
12753
|
-
const updated = await items.applyOp(noticeId, { op: "set_payload", payload: payload2 }, { at, version: ++version2, sessionId });
|
|
12811
|
+
const updated = await items.applyOp(noticeId, { op: "set_payload", payload: payload2 }, { at: at2, version: ++version2, sessionId });
|
|
12754
12812
|
if (updated) touched.push(updated);
|
|
12755
12813
|
return touched;
|
|
12756
12814
|
}
|
|
@@ -12766,7 +12824,7 @@ async function recordChatTurnInterruption(deps) {
|
|
|
12766
12824
|
payload: payload2,
|
|
12767
12825
|
// 这句话不进 `chat_messages.content`(那边由各自的收口路自己写),对账按这一位分流。
|
|
12768
12826
|
metadata: { [CHAT_ITEM_META_LEGACY_CONTENT]: false },
|
|
12769
|
-
createdAt:
|
|
12827
|
+
createdAt: at2,
|
|
12770
12828
|
version: ++version2
|
|
12771
12829
|
});
|
|
12772
12830
|
touched.push(created);
|
|
@@ -29212,14 +29270,14 @@ var require_object_inspect = __commonJS({
|
|
|
29212
29270
|
var gPO = (typeof Reflect === "function" ? Reflect.getPrototypeOf : Object.getPrototypeOf) || ([].__proto__ === Array.prototype ? function(O2) {
|
|
29213
29271
|
return O2.__proto__;
|
|
29214
29272
|
} : null);
|
|
29215
|
-
function addNumericSeparator(
|
|
29216
|
-
if (
|
|
29273
|
+
function addNumericSeparator(num5, str5) {
|
|
29274
|
+
if (num5 === Infinity || num5 === -Infinity || num5 !== num5 || num5 && num5 > -1e3 && num5 < 1e3 || $test.call(/e/, str5)) {
|
|
29217
29275
|
return str5;
|
|
29218
29276
|
}
|
|
29219
29277
|
var sepRegex = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;
|
|
29220
|
-
if (typeof
|
|
29221
|
-
var int2 =
|
|
29222
|
-
if (int2 !==
|
|
29278
|
+
if (typeof num5 === "number") {
|
|
29279
|
+
var int2 = num5 < 0 ? -$floor(-num5) : $floor(num5);
|
|
29280
|
+
if (int2 !== num5) {
|
|
29223
29281
|
var intStr = String(int2);
|
|
29224
29282
|
var dec2 = $slice.call(str5, intStr.length + 1);
|
|
29225
29283
|
return $replace.call(intStr, sepRegex, "$&_") + "." + $replace.call($replace.call(dec2, /([0-9]{3})/g, "$&_"), /_$/, "");
|
|
@@ -29289,7 +29347,7 @@ var require_object_inspect = __commonJS({
|
|
|
29289
29347
|
if (depth >= maxDepth && maxDepth > 0 && typeof obj2 === "object") {
|
|
29290
29348
|
return isArray(obj2) ? "[Array]" : "[Object]";
|
|
29291
29349
|
}
|
|
29292
|
-
var
|
|
29350
|
+
var indent3 = getIndent(opts, depth);
|
|
29293
29351
|
if (typeof seen === "undefined") {
|
|
29294
29352
|
seen = [];
|
|
29295
29353
|
} else if (indexOf(seen, obj2) >= 0) {
|
|
@@ -29312,7 +29370,7 @@ var require_object_inspect = __commonJS({
|
|
|
29312
29370
|
return inspect_(value2, opts, depth + 1, seen);
|
|
29313
29371
|
}
|
|
29314
29372
|
if (typeof obj2 === "function" && !isRegExp(obj2)) {
|
|
29315
|
-
var name =
|
|
29373
|
+
var name = nameOf2(obj2);
|
|
29316
29374
|
var keys = arrObjKeys(obj2, inspect);
|
|
29317
29375
|
return "[Function" + (name ? ": " + name : " (anonymous)") + "]" + (keys.length > 0 ? " { " + $join.call(keys, ", ") + " }" : "");
|
|
29318
29376
|
}
|
|
@@ -29338,8 +29396,8 @@ var require_object_inspect = __commonJS({
|
|
|
29338
29396
|
return "[]";
|
|
29339
29397
|
}
|
|
29340
29398
|
var xs = arrObjKeys(obj2, inspect);
|
|
29341
|
-
if (
|
|
29342
|
-
return "[" + indentedJoin(xs,
|
|
29399
|
+
if (indent3 && !singleLineValues(xs)) {
|
|
29400
|
+
return "[" + indentedJoin(xs, indent3) + "]";
|
|
29343
29401
|
}
|
|
29344
29402
|
return "[ " + $join.call(xs, ", ") + " ]";
|
|
29345
29403
|
}
|
|
@@ -29367,7 +29425,7 @@ var require_object_inspect = __commonJS({
|
|
|
29367
29425
|
mapParts.push(inspect(key2, obj2, true) + " => " + inspect(value2, obj2));
|
|
29368
29426
|
});
|
|
29369
29427
|
}
|
|
29370
|
-
return collectionOf("Map", mapSize.call(obj2), mapParts,
|
|
29428
|
+
return collectionOf("Map", mapSize.call(obj2), mapParts, indent3);
|
|
29371
29429
|
}
|
|
29372
29430
|
if (isSet(obj2)) {
|
|
29373
29431
|
var setParts = [];
|
|
@@ -29376,7 +29434,7 @@ var require_object_inspect = __commonJS({
|
|
|
29376
29434
|
setParts.push(inspect(value2, obj2));
|
|
29377
29435
|
});
|
|
29378
29436
|
}
|
|
29379
|
-
return collectionOf("Set", setSize.call(obj2), setParts,
|
|
29437
|
+
return collectionOf("Set", setSize.call(obj2), setParts, indent3);
|
|
29380
29438
|
}
|
|
29381
29439
|
if (isWeakMap(obj2)) {
|
|
29382
29440
|
return weakCollectionOf("WeakMap");
|
|
@@ -29415,8 +29473,8 @@ var require_object_inspect = __commonJS({
|
|
|
29415
29473
|
if (ys.length === 0) {
|
|
29416
29474
|
return tag + "{}";
|
|
29417
29475
|
}
|
|
29418
|
-
if (
|
|
29419
|
-
return tag + "{" + indentedJoin(ys,
|
|
29476
|
+
if (indent3) {
|
|
29477
|
+
return tag + "{" + indentedJoin(ys, indent3) + "}";
|
|
29420
29478
|
}
|
|
29421
29479
|
return tag + "{ " + $join.call(ys, ", ") + " }";
|
|
29422
29480
|
}
|
|
@@ -29491,7 +29549,7 @@ var require_object_inspect = __commonJS({
|
|
|
29491
29549
|
function toStr(obj2) {
|
|
29492
29550
|
return objectToString.call(obj2);
|
|
29493
29551
|
}
|
|
29494
|
-
function
|
|
29552
|
+
function nameOf2(f2) {
|
|
29495
29553
|
if (f2.name) {
|
|
29496
29554
|
return f2.name;
|
|
29497
29555
|
}
|
|
@@ -29627,8 +29685,8 @@ var require_object_inspect = __commonJS({
|
|
|
29627
29685
|
function weakCollectionOf(type) {
|
|
29628
29686
|
return type + " { ? }";
|
|
29629
29687
|
}
|
|
29630
|
-
function collectionOf(type, size, entries,
|
|
29631
|
-
var joinedEntries =
|
|
29688
|
+
function collectionOf(type, size, entries, indent3) {
|
|
29689
|
+
var joinedEntries = indent3 ? indentedJoin(entries, indent3) : $join.call(entries, ", ");
|
|
29632
29690
|
return type + " (" + size + ") {" + joinedEntries + "}";
|
|
29633
29691
|
}
|
|
29634
29692
|
function singleLineValues(xs) {
|
|
@@ -29653,12 +29711,12 @@ var require_object_inspect = __commonJS({
|
|
|
29653
29711
|
prev: $join.call(Array(depth + 1), baseIndent)
|
|
29654
29712
|
};
|
|
29655
29713
|
}
|
|
29656
|
-
function indentedJoin(xs,
|
|
29714
|
+
function indentedJoin(xs, indent3) {
|
|
29657
29715
|
if (xs.length === 0) {
|
|
29658
29716
|
return "";
|
|
29659
29717
|
}
|
|
29660
|
-
var lineJoiner = "\n" +
|
|
29661
|
-
return lineJoiner + $join.call(xs, "," + lineJoiner) + "\n" +
|
|
29718
|
+
var lineJoiner = "\n" + indent3.prev + indent3.base;
|
|
29719
|
+
return lineJoiner + $join.call(xs, "," + lineJoiner) + "\n" + indent3.prev;
|
|
29662
29720
|
}
|
|
29663
29721
|
function arrObjKeys(obj2, inspect) {
|
|
29664
29722
|
var isArr = isArray(obj2);
|
|
@@ -32847,26 +32905,26 @@ var require_permessage_deflate = __commonJS({
|
|
|
32847
32905
|
value2 = value2[0];
|
|
32848
32906
|
if (key2 === "client_max_window_bits") {
|
|
32849
32907
|
if (value2 !== true) {
|
|
32850
|
-
const
|
|
32851
|
-
if (!Number.isInteger(
|
|
32908
|
+
const num5 = +value2;
|
|
32909
|
+
if (!Number.isInteger(num5) || num5 < 8 || num5 > 15) {
|
|
32852
32910
|
throw new TypeError(
|
|
32853
32911
|
`Invalid value for parameter "${key2}": ${value2}`
|
|
32854
32912
|
);
|
|
32855
32913
|
}
|
|
32856
|
-
value2 =
|
|
32914
|
+
value2 = num5;
|
|
32857
32915
|
} else if (!this._isServer) {
|
|
32858
32916
|
throw new TypeError(
|
|
32859
32917
|
`Invalid value for parameter "${key2}": ${value2}`
|
|
32860
32918
|
);
|
|
32861
32919
|
}
|
|
32862
32920
|
} else if (key2 === "server_max_window_bits") {
|
|
32863
|
-
const
|
|
32864
|
-
if (!Number.isInteger(
|
|
32921
|
+
const num5 = +value2;
|
|
32922
|
+
if (!Number.isInteger(num5) || num5 < 8 || num5 > 15) {
|
|
32865
32923
|
throw new TypeError(
|
|
32866
32924
|
`Invalid value for parameter "${key2}": ${value2}`
|
|
32867
32925
|
);
|
|
32868
32926
|
}
|
|
32869
|
-
value2 =
|
|
32927
|
+
value2 = num5;
|
|
32870
32928
|
} else if (key2 === "client_no_context_takeover" || key2 === "server_no_context_takeover") {
|
|
32871
32929
|
if (value2 !== true) {
|
|
32872
32930
|
throw new TypeError(
|
|
@@ -33579,8 +33637,8 @@ var require_receiver = __commonJS({
|
|
|
33579
33637
|
return;
|
|
33580
33638
|
}
|
|
33581
33639
|
const buf = this.consume(8);
|
|
33582
|
-
const
|
|
33583
|
-
if (
|
|
33640
|
+
const num5 = buf.readUInt32BE(0);
|
|
33641
|
+
if (num5 > Math.pow(2, 53 - 32) - 1) {
|
|
33584
33642
|
const error2 = this.createError(
|
|
33585
33643
|
RangeError,
|
|
33586
33644
|
"Unsupported WebSocket frame: payload length > 2^53 - 1",
|
|
@@ -33591,7 +33649,7 @@ var require_receiver = __commonJS({
|
|
|
33591
33649
|
cb(error2);
|
|
33592
33650
|
return;
|
|
33593
33651
|
}
|
|
33594
|
-
this._payloadLength =
|
|
33652
|
+
this._payloadLength = num5 * Math.pow(2, 32) + buf.readUInt32BE(4);
|
|
33595
33653
|
this.haveLength(cb);
|
|
33596
33654
|
}
|
|
33597
33655
|
/**
|
|
@@ -124353,8 +124411,8 @@ ${block}
|
|
|
124353
124411
|
const s2 = String(d.getUTCSeconds()).padStart(2, "0");
|
|
124354
124412
|
return `${y}-${mo}-${day}T${h}:${mi}:${s2}+08:00`;
|
|
124355
124413
|
}
|
|
124356
|
-
function indentLines(text7,
|
|
124357
|
-
return text7.split("\n").map((line2) => `${
|
|
124414
|
+
function indentLines(text7, indent3) {
|
|
124415
|
+
return text7.split("\n").map((line2) => `${indent3}${line2}`).join("\n");
|
|
124358
124416
|
}
|
|
124359
124417
|
function escapeAttr(s2) {
|
|
124360
124418
|
return s2.replace(/"/g, """);
|
|
@@ -126570,62 +126628,62 @@ function isReviewKillable(r) {
|
|
|
126570
126628
|
if (r.cancelledAt) return false;
|
|
126571
126629
|
return true;
|
|
126572
126630
|
}
|
|
126573
|
-
function killWorkRow(state, w2,
|
|
126631
|
+
function killWorkRow(state, w2, at2) {
|
|
126574
126632
|
state.updateWork(w2.id, {
|
|
126575
|
-
deadAt: w2.deadAt ??
|
|
126576
|
-
cancelledAt: w2.cancelledAt ??
|
|
126633
|
+
deadAt: w2.deadAt ?? at2,
|
|
126634
|
+
cancelledAt: w2.cancelledAt ?? at2,
|
|
126577
126635
|
status: "dead"
|
|
126578
126636
|
});
|
|
126579
126637
|
}
|
|
126580
|
-
function killReviewRow(state, r,
|
|
126581
|
-
state.updateReview(r.id, { cancelledAt: r.cancelledAt ??
|
|
126638
|
+
function killReviewRow(state, r, at2) {
|
|
126639
|
+
state.updateReview(r.id, { cancelledAt: r.cancelledAt ?? at2, status: "dead" });
|
|
126582
126640
|
}
|
|
126583
|
-
function killLatestWork(state, nodeId,
|
|
126641
|
+
function killLatestWork(state, nodeId, at2) {
|
|
126584
126642
|
const node2 = state.node(nodeId);
|
|
126585
126643
|
if (!node2) return;
|
|
126586
126644
|
const lw = node2.latestWorkId ? state.work(node2.latestWorkId) : null;
|
|
126587
126645
|
if (!lw) return;
|
|
126588
|
-
if (isWorkKillable(lw)) killWorkRow(state, lw,
|
|
126646
|
+
if (isWorkKillable(lw)) killWorkRow(state, lw, at2);
|
|
126589
126647
|
}
|
|
126590
|
-
function supersedeLatestWork(state, nodeId,
|
|
126648
|
+
function supersedeLatestWork(state, nodeId, at2) {
|
|
126591
126649
|
const node2 = state.node(nodeId);
|
|
126592
126650
|
if (!node2) return;
|
|
126593
126651
|
const lw = node2.latestWorkId ? state.work(node2.latestWorkId) : null;
|
|
126594
126652
|
if (!lw) return;
|
|
126595
126653
|
if (isWorkFailed(lw)) return;
|
|
126596
|
-
if (isWorkKillable(lw)) killWorkRow(state, lw,
|
|
126654
|
+
if (isWorkKillable(lw)) killWorkRow(state, lw, at2);
|
|
126597
126655
|
}
|
|
126598
|
-
function supersedeReview(state, reviewId,
|
|
126656
|
+
function supersedeReview(state, reviewId, at2) {
|
|
126599
126657
|
const r = state.review(reviewId);
|
|
126600
126658
|
if (!r || !isReviewKillable(r)) return;
|
|
126601
126659
|
const failed = r.status === "failed" || !r.status && r.endedAt && !r.verdict && !r.cancelledAt;
|
|
126602
126660
|
if (failed) return;
|
|
126603
|
-
killReviewRow(state, r,
|
|
126661
|
+
killReviewRow(state, r, at2);
|
|
126604
126662
|
}
|
|
126605
|
-
function killNodeReviews(state, nodeId,
|
|
126663
|
+
function killNodeReviews(state, nodeId, at2) {
|
|
126606
126664
|
for (const r of state.allReviews()) {
|
|
126607
126665
|
if (r.nodeId === nodeId && isReviewKillable(r)) {
|
|
126608
|
-
killReviewRow(state, r,
|
|
126666
|
+
killReviewRow(state, r, at2);
|
|
126609
126667
|
}
|
|
126610
126668
|
}
|
|
126611
126669
|
}
|
|
126612
|
-
function killReview(state, reviewId,
|
|
126670
|
+
function killReview(state, reviewId, at2) {
|
|
126613
126671
|
const r = state.review(reviewId);
|
|
126614
126672
|
if (!r || !isReviewKillable(r)) return;
|
|
126615
|
-
killReviewRow(state, r,
|
|
126673
|
+
killReviewRow(state, r, at2);
|
|
126616
126674
|
}
|
|
126617
|
-
function killAllWorks(state,
|
|
126675
|
+
function killAllWorks(state, at2) {
|
|
126618
126676
|
for (const w2 of state.allWorks()) {
|
|
126619
|
-
if (!w2.endedAt && !w2.deadAt) killWorkRow(state, w2,
|
|
126677
|
+
if (!w2.endedAt && !w2.deadAt) killWorkRow(state, w2, at2);
|
|
126620
126678
|
}
|
|
126621
126679
|
for (const n of state.liveNodes()) {
|
|
126622
126680
|
const lw = n.latestWorkId ? state.work(n.latestWorkId) : null;
|
|
126623
|
-
if (lw && isWorkKillable(lw)) killWorkRow(state, lw,
|
|
126681
|
+
if (lw && isWorkKillable(lw)) killWorkRow(state, lw, at2);
|
|
126624
126682
|
}
|
|
126625
126683
|
}
|
|
126626
|
-
function killAllReviews(state,
|
|
126684
|
+
function killAllReviews(state, at2) {
|
|
126627
126685
|
for (const r of state.allReviews()) {
|
|
126628
|
-
if (isReviewKillable(r)) killReviewRow(state, r,
|
|
126686
|
+
if (isReviewKillable(r)) killReviewRow(state, r, at2);
|
|
126629
126687
|
}
|
|
126630
126688
|
}
|
|
126631
126689
|
var init_kill = __esm({
|
|
@@ -127071,10 +127129,10 @@ function findHumanRecoveryPost(state, node2, deadAt) {
|
|
|
127071
127129
|
const replies = state.repliesOf(issue2.id).sort((a, b2) => a.createdAt.localeCompare(b2.createdAt));
|
|
127072
127130
|
const last = replies[replies.length - 1];
|
|
127073
127131
|
const actorId = last?.authorActorId ?? issue2.authorActorId;
|
|
127074
|
-
const
|
|
127075
|
-
const postMs = Date.parse(
|
|
127132
|
+
const at2 = last?.createdAt ?? issue2.createdAt;
|
|
127133
|
+
const postMs = Date.parse(at2);
|
|
127076
127134
|
if (classify(actorId) === "human" && Number.isFinite(postMs) && postMs > deadMs) {
|
|
127077
|
-
candidates.push({ actorId, at, issueId: issue2.id });
|
|
127135
|
+
candidates.push({ actorId, at: at2, issueId: issue2.id });
|
|
127078
127136
|
}
|
|
127079
127137
|
}
|
|
127080
127138
|
candidates.sort((a, b2) => a.at.localeCompare(b2.at) || a.issueId.localeCompare(b2.issueId));
|
|
@@ -128635,8 +128693,8 @@ var require_postgres_date = __commonJS({
|
|
|
128635
128693
|
function bcYearToNegativeYear(year) {
|
|
128636
128694
|
return -(year - 1);
|
|
128637
128695
|
}
|
|
128638
|
-
function is0To99(
|
|
128639
|
-
return
|
|
128696
|
+
function is0To99(num5) {
|
|
128697
|
+
return num5 >= 0 && num5 < 100;
|
|
128640
128698
|
}
|
|
128641
128699
|
}
|
|
128642
128700
|
});
|
|
@@ -130776,18 +130834,18 @@ var require_buffer_writer = __commonJS({
|
|
|
130776
130834
|
oldBuffer.copy(this.buffer);
|
|
130777
130835
|
}
|
|
130778
130836
|
}
|
|
130779
|
-
addInt32(
|
|
130837
|
+
addInt32(num5) {
|
|
130780
130838
|
this.ensure(4);
|
|
130781
|
-
this.buffer[this.offset++] =
|
|
130782
|
-
this.buffer[this.offset++] =
|
|
130783
|
-
this.buffer[this.offset++] =
|
|
130784
|
-
this.buffer[this.offset++] =
|
|
130839
|
+
this.buffer[this.offset++] = num5 >>> 24 & 255;
|
|
130840
|
+
this.buffer[this.offset++] = num5 >>> 16 & 255;
|
|
130841
|
+
this.buffer[this.offset++] = num5 >>> 8 & 255;
|
|
130842
|
+
this.buffer[this.offset++] = num5 >>> 0 & 255;
|
|
130785
130843
|
return this;
|
|
130786
130844
|
}
|
|
130787
|
-
addInt16(
|
|
130845
|
+
addInt16(num5) {
|
|
130788
130846
|
this.ensure(2);
|
|
130789
|
-
this.buffer[this.offset++] =
|
|
130790
|
-
this.buffer[this.offset++] =
|
|
130847
|
+
this.buffer[this.offset++] = num5 >>> 8 & 255;
|
|
130848
|
+
this.buffer[this.offset++] = num5 >>> 0 & 255;
|
|
130791
130849
|
return this;
|
|
130792
130850
|
}
|
|
130793
130851
|
addCString(string7) {
|
|
@@ -134358,14 +134416,14 @@ var init_store_postgres = __esm({
|
|
|
134358
134416
|
);
|
|
134359
134417
|
return res.rows[0] ? toRecord(res.rows[0]) : null;
|
|
134360
134418
|
}
|
|
134361
|
-
async markEvent(seq, status, failedReason,
|
|
134419
|
+
async markEvent(seq, status, failedReason, at2) {
|
|
134362
134420
|
await this.c.query(
|
|
134363
134421
|
`UPDATE ${this.s}.events
|
|
134364
134422
|
SET status = $2, failed_reason = $3, available_at = NULL,
|
|
134365
134423
|
applied_at = CASE WHEN $2 = 'applied' THEN $4::timestamptz ELSE applied_at END,
|
|
134366
134424
|
done_at = CASE WHEN $2 = 'done' THEN $4::timestamptz ELSE done_at END
|
|
134367
134425
|
WHERE seq = $1`,
|
|
134368
|
-
[seq, status, failedReason,
|
|
134426
|
+
[seq, status, failedReason, at2]
|
|
134369
134427
|
);
|
|
134370
134428
|
}
|
|
134371
134429
|
async getEvent(seq) {
|
|
@@ -134490,7 +134548,7 @@ var init_types = __esm({
|
|
|
134490
134548
|
});
|
|
134491
134549
|
|
|
134492
134550
|
// ../engine/src/handlers/plan.ts
|
|
134493
|
-
function newNode(id, workorderId,
|
|
134551
|
+
function newNode(id, workorderId, at2, version2) {
|
|
134494
134552
|
return {
|
|
134495
134553
|
id,
|
|
134496
134554
|
workorderId,
|
|
@@ -134504,27 +134562,27 @@ function newNode(id, workorderId, at, version2) {
|
|
|
134504
134562
|
latestAcceptId: null,
|
|
134505
134563
|
isFinalOutput: false,
|
|
134506
134564
|
cancelledAt: null,
|
|
134507
|
-
createdAt:
|
|
134508
|
-
updatedAt:
|
|
134565
|
+
createdAt: at2,
|
|
134566
|
+
updatedAt: at2
|
|
134509
134567
|
};
|
|
134510
134568
|
}
|
|
134511
|
-
function markNodeForRetry(state, nodeId,
|
|
134569
|
+
function markNodeForRetry(state, nodeId, at2, resetRejectedBudget = false, resetCheckpointBudget = false) {
|
|
134512
134570
|
const node2 = state.node(nodeId);
|
|
134513
134571
|
if (!node2) return;
|
|
134514
134572
|
const lw = node2.latestWorkId ? state.work(node2.latestWorkId) : null;
|
|
134515
134573
|
if (lw && lw.deadAt && workState(lw, hasOutput(lw, state.artifactsOf(lw.id).length)) === "dead") {
|
|
134516
|
-
state.updateWork(lw.id, { retryAt:
|
|
134574
|
+
state.updateWork(lw.id, { retryAt: at2, status: "retry" });
|
|
134517
134575
|
}
|
|
134518
134576
|
if (lw && !lw.deadAt && workState(lw, hasOutput(lw, state.artifactsOf(lw.id).length)) === "success") {
|
|
134519
|
-
if (resetRejectedBudget && lw.acceptanceState === "rejected") state.updateWork(lw.id, { retryAt:
|
|
134577
|
+
if (resetRejectedBudget && lw.acceptanceState === "rejected") state.updateWork(lw.id, { retryAt: at2 });
|
|
134520
134578
|
if (resetCheckpointBudget && lw.conclusion == null && state.artifactsOf(lw.id).length > 0) {
|
|
134521
|
-
state.updateWork(lw.id, { retryAt:
|
|
134579
|
+
state.updateWork(lw.id, { retryAt: at2 });
|
|
134522
134580
|
}
|
|
134523
134581
|
for (const req of state.requirementsOf(node2.id)) {
|
|
134524
134582
|
if (!req.latestReviewId) continue;
|
|
134525
134583
|
const r = state.review(req.latestReviewId);
|
|
134526
134584
|
if (r && r.cancelledAt && reviewState(r) === "dead") {
|
|
134527
|
-
state.updateReview(r.id, { retryAt:
|
|
134585
|
+
state.updateReview(r.id, { retryAt: at2, status: "retry" });
|
|
134528
134586
|
}
|
|
134529
134587
|
}
|
|
134530
134588
|
}
|
|
@@ -134535,7 +134593,7 @@ function markNodeForRetry(state, nodeId, at, resetRejectedBudget = false, resetC
|
|
|
134535
134593
|
const replyWorks = state.replyWorksOf(nodeId).sort((a, b2) => a.createdAt.localeCompare(b2.createdAt));
|
|
134536
134594
|
const latest = replyWorks[replyWorks.length - 1];
|
|
134537
134595
|
if (latest && latest.deadAt && workState(latest, hasOutput(latest, 0)) === "dead") {
|
|
134538
|
-
state.updateWork(latest.id, { retryAt:
|
|
134596
|
+
state.updateWork(latest.id, { retryAt: at2, status: "retry" });
|
|
134539
134597
|
}
|
|
134540
134598
|
}
|
|
134541
134599
|
}
|
|
@@ -143634,11 +143692,11 @@ function bridgeLoadReadModel(input) {
|
|
|
143634
143692
|
for (let i = 1; i < workTimeRanks.length; i++) {
|
|
143635
143693
|
workTimeRanks[i].rank = Math.max(workTimeRanks[i].rank, workTimeRanks[i - 1].rank);
|
|
143636
143694
|
}
|
|
143637
|
-
const seqBefore = (
|
|
143695
|
+
const seqBefore = (at2) => {
|
|
143638
143696
|
let low = 0, high = workTimeRanks.length;
|
|
143639
143697
|
while (low < high) {
|
|
143640
143698
|
const mid = Math.floor((low + high) / 2);
|
|
143641
|
-
if (workTimeRanks[mid].at <
|
|
143699
|
+
if (workTimeRanks[mid].at < at2) low = mid + 1;
|
|
143642
143700
|
else high = mid;
|
|
143643
143701
|
}
|
|
143644
143702
|
return low === 0 ? 0 : workTimeRanks[low - 1].rank;
|
|
@@ -166407,7 +166465,7 @@ function kindOf(a, id) {
|
|
|
166407
166465
|
}
|
|
166408
166466
|
async function validateWorkorderPrincipals(plan, briefArtifactId, getActor) {
|
|
166409
166467
|
const errors = [];
|
|
166410
|
-
const
|
|
166468
|
+
const nameOf2 = (a, id) => a?.name || String(id).split(":").pop() || id;
|
|
166411
166469
|
for (const op of plan.ops) {
|
|
166412
166470
|
if (op.action !== "spawn") continue;
|
|
166413
166471
|
const isBrief = op.id === briefArtifactId;
|
|
@@ -166415,16 +166473,16 @@ async function validateWorkorderPrincipals(plan, briefArtifactId, getActor) {
|
|
|
166415
166473
|
if (op.owner) {
|
|
166416
166474
|
const a = await getActor(op.owner);
|
|
166417
166475
|
const k2 = kindOf(a, op.owner);
|
|
166418
|
-
if (a && a.status !== "active") errors.push(`${label2}\u300C${
|
|
166419
|
-
else if (isBrief && k2 === "agent") errors.push(`\u5DE5\u5355\u8D1F\u8D23\u4EBA\u5FC5\u987B\u662F\u4EBA\u7C7B\u6210\u5458\uFF08\u300C${
|
|
166476
|
+
if (a && a.status !== "active") errors.push(`${label2}\u300C${nameOf2(a, op.owner)}\u300D\u5DF2\u79BB\u5C97\uFF0C\u4E0D\u80FD\u62C5\u4EFB`);
|
|
166477
|
+
else if (isBrief && k2 === "agent") errors.push(`\u5DE5\u5355\u8D1F\u8D23\u4EBA\u5FC5\u987B\u662F\u4EBA\u7C7B\u6210\u5458\uFF08\u300C${nameOf2(a, op.owner)}\u300D\u662F AI \u5458\u5DE5\uFF09`);
|
|
166420
166478
|
}
|
|
166421
166479
|
if (isBrief) {
|
|
166422
166480
|
const manager = op.fields?.manager;
|
|
166423
166481
|
if (typeof manager === "string" && manager) {
|
|
166424
166482
|
const a = await getActor(manager);
|
|
166425
166483
|
const k2 = kindOf(a, manager);
|
|
166426
|
-
if (a && a.status !== "active") errors.push(`\u7BA1\u7406\u8005\u300C${
|
|
166427
|
-
else if (k2 === "human") errors.push(`\u5DE5\u5355\u7BA1\u7406\u8005\u5FC5\u987B\u662F AI \u5458\u5DE5\uFF08\u300C${
|
|
166484
|
+
if (a && a.status !== "active") errors.push(`\u7BA1\u7406\u8005\u300C${nameOf2(a, manager)}\u300D\u5DF2\u79BB\u5C97\uFF0C\u4E0D\u80FD\u62C5\u4EFB\u7BA1\u7406\u8005`);
|
|
166485
|
+
else if (k2 === "human") errors.push(`\u5DE5\u5355\u7BA1\u7406\u8005\u5FC5\u987B\u662F AI \u5458\u5DE5\uFF08\u300C${nameOf2(a, manager)}\u300D\u662F\u4EBA\u7C7B\uFF09`);
|
|
166428
166486
|
}
|
|
166429
166487
|
}
|
|
166430
166488
|
}
|
|
@@ -166461,7 +166519,7 @@ function newHumanAssigneesOfPlan(plan, current) {
|
|
|
166461
166519
|
}
|
|
166462
166520
|
return out;
|
|
166463
166521
|
}
|
|
166464
|
-
async function assertCompanyMembers(listMembers, companyId, assignees,
|
|
166522
|
+
async function assertCompanyMembers(listMembers, companyId, assignees, nameOf2 = async () => void 0) {
|
|
166465
166523
|
if (!listMembers || assignees.length === 0) return;
|
|
166466
166524
|
const members = await listMembers(companyId);
|
|
166467
166525
|
const listed = /* @__PURE__ */ new Set();
|
|
@@ -166474,7 +166532,7 @@ async function assertCompanyMembers(listMembers, companyId, assignees, nameOf =
|
|
|
166474
166532
|
if (rejected.length === 0) return;
|
|
166475
166533
|
const parts = [];
|
|
166476
166534
|
for (const a of rejected) {
|
|
166477
|
-
const name = (await
|
|
166535
|
+
const name = (await nameOf2(a.actor).catch(() => void 0))?.trim() || a.actor;
|
|
166478
166536
|
parts.push(`\u300C${name}\u300D\u4E0D\u662F\u672C\u516C\u53F8\u6210\u5458\uFF0C\u4E0D\u80FD\u62C5\u4EFB${a.role}`);
|
|
166479
166537
|
}
|
|
166480
166538
|
throw new NotCompanyMemberError(parts.join("\uFF1B"));
|
|
@@ -167781,7 +167839,7 @@ function buildWorkorderSummaries(model, resolveActor, resolveProject, dispatchPa
|
|
|
167781
167839
|
}
|
|
167782
167840
|
return out.sort((a, b2) => a.updatedAt < b2.updatedAt ? 1 : a.updatedAt > b2.updatedAt ? -1 : 0);
|
|
167783
167841
|
}
|
|
167784
|
-
function summaryOfWorkspace(model, workspace, arts, ref2, resolveProject, dispatchPausedOf, projectionOf, viewer, facts, resolveRoleExecutor,
|
|
167842
|
+
function summaryOfWorkspace(model, workspace, arts, ref2, resolveProject, dispatchPausedOf, projectionOf, viewer, facts, resolveRoleExecutor, nodeStateOf2) {
|
|
167785
167843
|
const members = arts.map((a) => nodeInfo(model, a));
|
|
167786
167844
|
const seed = arts.find((a) => a.id === overviewRootIdOf(arts)) ?? arts[0];
|
|
167787
167845
|
const spec = workorderSpecOf(model, arts);
|
|
@@ -167795,7 +167853,7 @@ function summaryOfWorkspace(model, workspace, arts, ref2, resolveProject, dispat
|
|
|
167795
167853
|
const info = members[i];
|
|
167796
167854
|
return {
|
|
167797
167855
|
info,
|
|
167798
|
-
state:
|
|
167856
|
+
state: nodeStateOf2 ? nodeStateOf2(a.id, info) : evaluateNodeRunState(model, a, info, projectionOf?.(a.id, info)).state,
|
|
167799
167857
|
...a.id === overviewRootId ? { overviewRoot: true } : {}
|
|
167800
167858
|
};
|
|
167801
167859
|
});
|
|
@@ -168569,9 +168627,9 @@ function buildCoordinatorActivityFromEvents(model, arts, events, ref2) {
|
|
|
168569
168627
|
const issueKindById = /* @__PURE__ */ new Map();
|
|
168570
168628
|
const issueTargetById = /* @__PURE__ */ new Map();
|
|
168571
168629
|
const edits = [];
|
|
168572
|
-
const push2 = (kind, artifactId, seq,
|
|
168630
|
+
const push2 = (kind, artifactId, seq, at2, actor, label2, detail) => {
|
|
168573
168631
|
if (!inWorkspace.has(artifactId)) return;
|
|
168574
|
-
edits.push({ seq, at, actor: ref2(actor), kind, artifactId, label: label2, ...detail ? { detail } : {} });
|
|
168632
|
+
edits.push({ seq, at: at2, actor: ref2(actor), kind, artifactId, label: label2, ...detail ? { detail } : {} });
|
|
168575
168633
|
};
|
|
168576
168634
|
const str5 = (v2) => typeof v2 === "string" && v2.trim() ? v2 : void 0;
|
|
168577
168635
|
for (const rec2 of events) {
|
|
@@ -168774,6 +168832,22 @@ var init_discuss = __esm({
|
|
|
168774
168832
|
}
|
|
168775
168833
|
});
|
|
168776
168834
|
|
|
168835
|
+
// ../server/src/domains/collab/escalation-kind.ts
|
|
168836
|
+
function escalationKindOf(issueId, authorActorId) {
|
|
168837
|
+
if (issueId.startsWith(RETRY_EXHAUSTED_ESC_PREFIX)) return "retry_exhausted";
|
|
168838
|
+
if (issueId.startsWith(REVIEW_EXHAUSTED_ESC_PREFIX2)) return "review_exhausted";
|
|
168839
|
+
return isSystemActorId(authorActorId) ? "output_stall" : "manual";
|
|
168840
|
+
}
|
|
168841
|
+
var RETRY_EXHAUSTED_ESC_PREFIX, REVIEW_EXHAUSTED_ESC_PREFIX2;
|
|
168842
|
+
var init_escalation_kind = __esm({
|
|
168843
|
+
"../server/src/domains/collab/escalation-kind.ts"() {
|
|
168844
|
+
"use strict";
|
|
168845
|
+
init_src();
|
|
168846
|
+
RETRY_EXHAUSTED_ESC_PREFIX = "esc:retry-exhausted:";
|
|
168847
|
+
REVIEW_EXHAUSTED_ESC_PREFIX2 = "esc:review-exhausted:";
|
|
168848
|
+
}
|
|
168849
|
+
});
|
|
168850
|
+
|
|
168777
168851
|
// ../server/src/domains/collab/workorder-manager.ts
|
|
168778
168852
|
function resolveWorkorderManager(snap) {
|
|
168779
168853
|
const nodes = snap.nodes;
|
|
@@ -168812,16 +168886,111 @@ function escalationContextOf(snap, escalationId) {
|
|
|
168812
168886
|
ownerActorId: snap.workorder.ownerActorId,
|
|
168813
168887
|
managerActorId: managerId
|
|
168814
168888
|
});
|
|
168815
|
-
const agentId =
|
|
168816
|
-
return { issue: issue2, gap, recipientActorId, agentId };
|
|
168889
|
+
const agentId = managerId;
|
|
168890
|
+
return { issue: issue2, gap, node: node2 ?? null, kind: escalationKindOf(issue2.id, issue2.authorActorId), recipientActorId, agentId };
|
|
168817
168891
|
}
|
|
168818
168892
|
var init_escalation_recipient = __esm({
|
|
168819
168893
|
"../server/src/domains/collab/escalation-recipient.ts"() {
|
|
168820
168894
|
"use strict";
|
|
168895
|
+
init_escalation_kind();
|
|
168821
168896
|
init_workorder_manager();
|
|
168822
168897
|
}
|
|
168823
168898
|
});
|
|
168824
168899
|
|
|
168900
|
+
// ../server/src/domains/collab/escalation-chat-context.ts
|
|
168901
|
+
function nodeStateOf(snap, node2) {
|
|
168902
|
+
if (node2.cancelledAt) {
|
|
168903
|
+
const reason = node2.sealReason;
|
|
168904
|
+
return reason === "accepted" ? "\u5DF2\u9A8C\u6536\u5F52\u6863\uFF08\u4E0D\u5728\u8BA1\u5212\u91CC\u4E86\uFF09" : reason === "frozen" ? "\u5DF2\u51BB\u7ED3\uFF08\u4E0D\u5728\u8BA1\u5212\u91CC\u4E86\uFF09" : "\u5DF2\u79FB\u51FA\u8BA1\u5212";
|
|
168905
|
+
}
|
|
168906
|
+
if (node2.latestAcceptId && node2.latestAcceptId === node2.latestProposedWorkId) return "\u5DF2\u9A8C\u6536";
|
|
168907
|
+
if (!node2.latestWorkId) return "\u8FD8\u6CA1\u5F00\u59CB\u6267\u884C";
|
|
168908
|
+
const work = snap.works.find((row) => row.id === node2.latestWorkId);
|
|
168909
|
+
switch (work?.status) {
|
|
168910
|
+
case "running":
|
|
168911
|
+
return "\u6B63\u5728\u6267\u884C";
|
|
168912
|
+
case "success":
|
|
168913
|
+
return "\u5DF2\u4EA4\u51FA\u8FD9\u4E00\u7248\uFF0C\u7B49\u9A8C\u6536 / \u8BC4\u5BA1";
|
|
168914
|
+
case "failed":
|
|
168915
|
+
return "\u4E0A\u4E00\u8F6E\u6267\u884C\u5931\u8D25";
|
|
168916
|
+
case "dead":
|
|
168917
|
+
return "\u4E0A\u4E00\u8F6E\u88AB\u4E2D\u65AD\uFF08kill / \u53D6\u4EE3 / \u53D6\u6D88\uFF09";
|
|
168918
|
+
case "retry":
|
|
168919
|
+
return "\u5DF2\u6392\u91CD\u8BD5\uFF0C\u7B49\u8C03\u5EA6";
|
|
168920
|
+
// 老快照的 works 行可能没有 status 列(那是存储态,桥接前的数据没有)——不猜,直说读不出来。
|
|
168921
|
+
default:
|
|
168922
|
+
return "\u8BFB\u4E0D\u51FA\u8FD9\u4E00\u6B65\u6700\u8FD1\u4E00\u8F6E\u7684\u72B6\u6001";
|
|
168923
|
+
}
|
|
168924
|
+
}
|
|
168925
|
+
function buildEscalationChatContext(input) {
|
|
168926
|
+
const escalationId = input.escalationId?.trim();
|
|
168927
|
+
if (!escalationId || !input.snap) return null;
|
|
168928
|
+
const snap = input.snap;
|
|
168929
|
+
const context2 = escalationContextOf(snap, escalationId);
|
|
168930
|
+
if (!context2) return null;
|
|
168931
|
+
const { issue: issue2, gap, node: node2, kind } = context2;
|
|
168932
|
+
const KIND_LABEL3 = {
|
|
168933
|
+
retry_exhausted: "\u8FDE\u8D25\u7194\u65AD\uFF08\u8FD9\u4E00\u6B65\u7684\u81EA\u52A8\u91CD\u8BD5\u5DF2\u7528\u5C3D\uFF0C\u5F15\u64CE\u4EE5\u5361\u4F4F\u7684\u6267\u884C\u4EBA\u8EAB\u4EFD\u4EE3\u5F00\uFF09",
|
|
168934
|
+
review_exhausted: "\u8BC4\u5BA1\u7194\u65AD\uFF08\u8FD9\u4E00\u8F6E\u8BC4\u5BA1\u8FDE\u7EED\u6536\u4E0D\u9F50\uFF0C\u5F15\u64CE\u4EE3\u5F00\uFF09",
|
|
168935
|
+
output_stall: "\u96F6\u4EA7\u51FA\u6B62\u635F\uFF08\u7CFB\u7EDF\u53D1\u73B0\u53CD\u590D\u7A7A\u8DD1\uFF0C\u5DF2\u6682\u505C\u6D3E\u53D1\u5E76\u4EE3\u5F00\uFF09",
|
|
168936
|
+
manual: "\u4EBA\u5DE5\u4E0A\u62A5\uFF08\u6709\u4EBA\u7528 oasis escalate \u63D0\u7684\uFF09"
|
|
168937
|
+
};
|
|
168938
|
+
const others = snap.issues.filter((row) => row.kind === "escalation" && !row.resolvedAt && row.id !== issue2.id).sort((a, b2) => String(a.createdAt).localeCompare(String(b2.createdAt)));
|
|
168939
|
+
const shown = others.slice(0, OTHER_OPEN_LIMIT);
|
|
168940
|
+
const lines = [
|
|
168941
|
+
"\u3010\u8FD9\u6761\u4F1A\u8BDD\u662F\u4EBA\u4ECE\u4E00\u6761\u4E0A\u62A5\uFF08\u5347\u7EA7\u5361\uFF09\u70B9\u8FDB\u6765\u7684\u2014\u2014\u4F60\u662F\u8FD9\u5F20\u4EFB\u52A1\u7684\u534F\u8C03\u8005\uFF0C\u4EBA\u662F\u6765\u627E\u4F60\u4E00\u8D77\u5904\u7F6E\u8FD9\u6761\u4E0A\u62A5\u7684\u3002",
|
|
168942
|
+
"\u4EE5\u4E0B\u662F\u8FD9\u6761\u4E0A\u62A5\u6B64\u523B\u7684\u4E8B\u5B9E\uFF0C\u4E0E\u4EBA\u5728\u754C\u9762\u4E0A\u770B\u5230\u7684\u90A3\u6BB5\u5F00\u573A\u767D\u540C\u6E90\u3002\u522B\u53CD\u95EE\u300C\u4F60\u8BF4\u7684\u662F\u54EA\u4EF6\u4E8B\u300D\uFF1B\u8981\u66F4\u7EC6\u7684\u73B0\u72B6\u81EA\u5DF1\u7528 `oasis status` / `oasis content <id>` \u73B0\u67E5\u56FE\u3002\u3011",
|
|
168943
|
+
"",
|
|
168944
|
+
`\u4EFB\u52A1\uFF1A${snap.workorder.title}\uFF08${snap.workorder.id}\uFF09\uFF0C\u8D1F\u8D23\u4EBA ${nameOf(input.ref, snap.workorder.ownerActorId)}`,
|
|
168945
|
+
`\u8FD9\u6761\u4E0A\u62A5\uFF1A${issue2.id}`,
|
|
168946
|
+
` \u7C7B\u522B\uFF1A${KIND_LABEL3[kind]}`,
|
|
168947
|
+
` \u63D0\u51FA\u65B9\uFF1A${nameOf(input.ref, issue2.authorActorId)}${issue2.handActorId ? `\uFF08\u7ECF\u624B ${nameOf(input.ref, issue2.handActorId)}\uFF09` : ""}\uFF0C\u65F6\u95F4 ${issue2.createdAt}`
|
|
168948
|
+
];
|
|
168949
|
+
if (node2) {
|
|
168950
|
+
lines.push(
|
|
168951
|
+
` \u6302\u5728\u8282\u70B9\uFF1A\u300A${node2.title || node2.id}\u300B\uFF08${node2.id}\uFF0C\u7C7B\u578B ${node2.type}\uFF09`,
|
|
168952
|
+
` \u8282\u70B9\u5F53\u524D\u72B6\u6001\uFF1A${nodeStateOf(snap, node2)}\uFF1B\u8D1F\u8D23\u4EBA ${nameOf(input.ref, node2.assigneeActorId)}`
|
|
168953
|
+
);
|
|
168954
|
+
} else {
|
|
168955
|
+
lines.push(" \u6302\u5728\u8282\u70B9\uFF1A\u8FD9\u6761\u4E0A\u62A5\u6CA1\u6709\u8BB0\u8282\u70B9\uFF08aboutNodeId / raisedByNodeId \u90FD\u7A7A\uFF09");
|
|
168956
|
+
}
|
|
168957
|
+
lines.push(" \u4E0A\u62A5\u6B63\u6587\uFF08\u539F\u6587\u7167\u5F55\uFF09\uFF1A", indent(issue2.body));
|
|
168958
|
+
if (gap?.body.trim()) {
|
|
168959
|
+
lines.push(` \u5173\u8054\u7F3A\u53E3 ${gap.id}${gap.resolvedAt ? "\uFF08\u5DF2\u89E3\u51B3\uFF09" : "\uFF08\u672A\u89E3\u51B3\uFF09"}\uFF1A`, indent(gap.body));
|
|
168960
|
+
}
|
|
168961
|
+
lines.push(
|
|
168962
|
+
"",
|
|
168963
|
+
others.length ? `\u8FD9\u5F20\u4EFB\u52A1\u4E0A\u8FD8\u5F00\u7740\u53E6\u5916 ${others.length} \u6761\u4E0A\u62A5\uFF1A` : "\u8FD9\u5F20\u4EFB\u52A1\u4E0A\u6CA1\u6709\u522B\u7684\u672A\u5173\u4E0A\u62A5\u3002",
|
|
168964
|
+
...shown.map((row) => ` \xB7 ${row.id}${row.aboutNodeId ? `\uFF08\u8282\u70B9 ${row.aboutNodeId}\uFF09` : ""}\uFF1A${oneLine(row.body)}`),
|
|
168965
|
+
...others.length > shown.length ? [` \xB7 \uFF08\u53E6\u6709 ${others.length - shown.length} \u6761\u6CA1\u5217\u51FA\u6765\uFF0C\u7528 \`oasis status\` \u770B\u5168\uFF09`] : [],
|
|
168966
|
+
"",
|
|
168967
|
+
'\u5904\u7F6E\u5B8C\u8FD9\u6761\u4E0A\u62A5\uFF0C\u5728\u672C\u4F1A\u8BDD\u91CC\u8DD1 `oasis resolve-escalation --reason "<\u7ED3\u8BBA>"` \u5373\u53EF\u2014\u2014\u4F1A\u8BDD\u5DF2\u7ECF\u7ED1\u7740\u8FD9\u6761\u4E0A\u62A5\uFF0C\u4E0D\u7528\u5E26 id\uFF08\u5B83\u4F1A\u8F6C\u6210\u4E00\u5F20\u5F85\u4EBA\u786E\u8BA4\u7684\u5361\uFF0C\u4E0D\u662F\u7ACB\u523B\u751F\u6548\uFF09\u3002',
|
|
168968
|
+
...kind === "output_stall" && node2 ? [`\u96F6\u4EA7\u51FA\u6B62\u635F\u540C\u65F6\u6682\u505C\u4E86\u6D3E\u53D1\uFF0C\u786E\u8BA4\u6839\u56E0\u5904\u7406\u6389\u4E4B\u540E\u8FD8\u8981 \`oasis release ${node2.id}\` \u624D\u4F1A\u91CD\u65B0\u6D3E\u3002`] : []
|
|
168969
|
+
);
|
|
168970
|
+
return lines.join("\n");
|
|
168971
|
+
}
|
|
168972
|
+
function indent(body2) {
|
|
168973
|
+
return body2.trim().split("\n").map((row) => ` ${row}`).join("\n");
|
|
168974
|
+
}
|
|
168975
|
+
var OTHER_OPEN_LIMIT, SUMMARY_LIMIT, nameOf, oneLine;
|
|
168976
|
+
var init_escalation_chat_context = __esm({
|
|
168977
|
+
"../server/src/domains/collab/escalation-chat-context.ts"() {
|
|
168978
|
+
"use strict";
|
|
168979
|
+
init_escalation_recipient();
|
|
168980
|
+
OTHER_OPEN_LIMIT = 5;
|
|
168981
|
+
SUMMARY_LIMIT = 60;
|
|
168982
|
+
nameOf = (ref2, id) => {
|
|
168983
|
+
if (typeof id !== "string" || !id) return "\u672A\u6307\u5B9A";
|
|
168984
|
+
const name = ref2(id).name?.trim();
|
|
168985
|
+
return name ? `${name}\uFF08${id}\uFF09` : id;
|
|
168986
|
+
};
|
|
168987
|
+
oneLine = (body2) => {
|
|
168988
|
+
const line2 = body2.trim().split("\n").find((row) => row.trim()) ?? "";
|
|
168989
|
+
return line2.length > SUMMARY_LIMIT ? `${line2.slice(0, SUMMARY_LIMIT)}\u2026` : line2;
|
|
168990
|
+
};
|
|
168991
|
+
}
|
|
168992
|
+
});
|
|
168993
|
+
|
|
168825
168994
|
// ../server/src/domains/chat-sessions/injected-context.ts
|
|
168826
168995
|
function matchingBlockEnd(text7, start) {
|
|
168827
168996
|
let cursor = start;
|
|
@@ -168913,6 +169082,11 @@ ${prompt2}`;
|
|
|
168913
169082
|
if (input.draftWorkspace) {
|
|
168914
169083
|
prompt2 = `\u3010\u4F60\u5DF2\u4E3A workspace ${input.draftWorkspace} \u6682\u5B58\u4E86\u4E00\u5F20\u5DE5\u5355\u8349\u6848\uFF0C\u7528\u6237\u6B63\u5728\u7F16\u8F91\u5668\u91CC\u770B\u7740\u5B83\u3002\u82E5\u8FD9\u6761\u6D88\u606F\u8981\u6539\u5B83\uFF1A**\u5C0F\u6539**\uFF08\u52A0/\u5220/\u6539\u8282\u70B9\u3001\u8FDE\u8FB9\u3001\u8C03\u6807\u9898/\u76EE\u6807/\u89C4\u683C\uFF09\u2192 \u7528\u6539\u8349\u6848\u547D\u4EE4 \`oasis spawn/edit/link/cancel \u2026 --workspace ${input.draftWorkspace}\` **\u589E\u91CF\u6539**\uFF08\u9ED8\u8BA4\uFF0C\u522B\u91CD\u8DD1\u6574\u4EFD\uFF09\uFF1B**\u63A8\u5012\u91CD\u6765**\uFF08\u65B9\u6848\u6574\u4E2A\u6362\uFF09\u624D \`oasis create-workorder --workspace ${input.draftWorkspace} \u2026\` \u91CD\u65B0\u751F\u6210\u4E00\u7248\uFF1B\u53EA\u662F\u95F2\u804A/\u8FFD\u95EE\u5C31\u6B63\u5E38\u56DE\u590D\u3001\u522B\u52A8\u8349\u6848\u3002\u6539\u5B8C\u6211\u4F1A\u81EA\u52A8\u91CD\u8F7D\u7F16\u8F91\u5668\u3002\u3011
|
|
168915
169084
|
|
|
169085
|
+
${prompt2}`;
|
|
169086
|
+
}
|
|
169087
|
+
if (input.escalationContext) {
|
|
169088
|
+
prompt2 = `${input.escalationContext}
|
|
169089
|
+
|
|
168916
169090
|
${prompt2}`;
|
|
168917
169091
|
}
|
|
168918
169092
|
if (input.pendingBroadcasts?.length) {
|
|
@@ -168944,8 +169118,8 @@ var init_injected_context = __esm({
|
|
|
168944
169118
|
|
|
168945
169119
|
// ../contract/src/discussions.ts
|
|
168946
169120
|
function isStaleProposal(r, now) {
|
|
168947
|
-
const
|
|
168948
|
-
return r.state === "proposed" &&
|
|
169121
|
+
const at2 = typeof now === "number" ? now : Date.parse(now);
|
|
169122
|
+
return r.state === "proposed" && at2 - Date.parse(r.updated_at) > DECISION_STALE_DAYS * 864e5;
|
|
168949
169123
|
}
|
|
168950
169124
|
var PROJECT_DISCUSSIONS_DIR, DECISION_STATES, DECISION_STALE_DAYS, DECISION_STATEMENT_MAX, DISCUSSION_SUMMARY_MAX;
|
|
168951
169125
|
var init_discussions = __esm({
|
|
@@ -169402,6 +169576,8 @@ async function planChatContinuation(input) {
|
|
|
169402
169576
|
...history.length ? { history: history.map(({ role, content: content3 }) => ({ role, content: content3 })) } : {},
|
|
169403
169577
|
...hintFor(historyWindow),
|
|
169404
169578
|
...input.draftWorkspace ? { draftWorkspace: input.draftWorkspace } : {},
|
|
169579
|
+
// 冷起(首轮 / 换过节点 / 无 native 会话号)才带上报上下文,理由见入参注释。
|
|
169580
|
+
...needsHistoryInjection && input.escalationContext ? { escalationContext: input.escalationContext } : {},
|
|
169405
169581
|
...pendingBroadcasts ? { pendingBroadcasts } : {},
|
|
169406
169582
|
...persistedSystemNotices ? { persistedSystemNotices } : {}
|
|
169407
169583
|
});
|
|
@@ -169412,6 +169588,8 @@ async function planChatContinuation(input) {
|
|
|
169412
169588
|
history: fallbackHistory.map(({ role, content: content3 }) => ({ role, content: content3 })),
|
|
169413
169589
|
...hintFor(fallbackWindow),
|
|
169414
169590
|
...input.draftWorkspace ? { draftWorkspace: input.draftWorkspace } : {},
|
|
169591
|
+
// 兜底正文的前提就是「resume 扑空、那边没有这段记忆」——上报上下文在这条路上无条件带。
|
|
169592
|
+
...input.escalationContext ? { escalationContext: input.escalationContext } : {},
|
|
169415
169593
|
// resume 扑空后的重派也要带上通告:那一轮才是真正送到 agent 的那一轮。
|
|
169416
169594
|
...pendingBroadcasts ? { pendingBroadcasts } : {},
|
|
169417
169595
|
...persistedSystemNotices ? { persistedSystemNotices } : {}
|
|
@@ -169533,9 +169711,9 @@ async function legacyVerdict(turns, chatStore, sid, message) {
|
|
|
169533
169711
|
if (others.some((t) => t.status !== "reserved" && t.status !== "running" && !provablyNotDispatched(t))) return "unknown";
|
|
169534
169712
|
if (others.some((t) => t.status === "reserved" || t.status === "running")) return "pending";
|
|
169535
169713
|
const rows = await read("legacy", () => chatStore.listMessages(sid, LEGACY_LOOKBACK_MESSAGES));
|
|
169536
|
-
const
|
|
169537
|
-
if (
|
|
169538
|
-
return rows.slice(
|
|
169714
|
+
const at2 = rows.findIndex((m2) => m2.id === message.id);
|
|
169715
|
+
if (at2 < 0) return "unknown";
|
|
169716
|
+
return rows.slice(at2 + 1).some((m2) => m2.role === "assistant") ? "unknown" : "retryable";
|
|
169539
169717
|
}
|
|
169540
169718
|
function provablyNotDispatched(t) {
|
|
169541
169719
|
return (t.status === "failed" || t.status === "cancelled") && !t.startedAt && !t.assistantRunId && !t.dispatchId;
|
|
@@ -169693,9 +169871,9 @@ var init_chat_workorder_files = __esm({
|
|
|
169693
169871
|
// ../server/src/chat-broadcast.ts
|
|
169694
169872
|
function isFreshTerminal(terminalAt, nowMs, maxAgeMs) {
|
|
169695
169873
|
if (!terminalAt) return true;
|
|
169696
|
-
const
|
|
169697
|
-
if (!Number.isFinite(
|
|
169698
|
-
return nowMs -
|
|
169874
|
+
const at2 = Date.parse(terminalAt);
|
|
169875
|
+
if (!Number.isFinite(at2)) return true;
|
|
169876
|
+
return nowMs - at2 <= maxAgeMs;
|
|
169699
169877
|
}
|
|
169700
169878
|
function broadcastMessageText(t) {
|
|
169701
169879
|
const head = t.kind === "workorder-settled" ? "\u5DF2\u7ED3\u6848" : "\u5DF2\u53D6\u6D88";
|
|
@@ -181466,7 +181644,7 @@ function tokenizeDefinitionStart(effects2, ok3, nok) {
|
|
|
181466
181644
|
}
|
|
181467
181645
|
}
|
|
181468
181646
|
function tokenizeDefinitionContinuation(effects2, ok3, nok) {
|
|
181469
|
-
return effects2.check(blankLine, ok3, effects2.attempt(
|
|
181647
|
+
return effects2.check(blankLine, ok3, effects2.attempt(indent2, ok3, nok));
|
|
181470
181648
|
}
|
|
181471
181649
|
function gfmFootnoteDefinitionEnd(effects2) {
|
|
181472
181650
|
effects2.exit("gfmFootnoteDefinition");
|
|
@@ -181479,14 +181657,14 @@ function tokenizeIndent2(effects2, ok3, nok) {
|
|
|
181479
181657
|
return tail && tail[1].type === "gfmFootnoteDefinitionIndent" && tail[2].sliceSerialize(tail[1], true).length === 4 ? ok3(code2) : nok(code2);
|
|
181480
181658
|
}
|
|
181481
181659
|
}
|
|
181482
|
-
var
|
|
181660
|
+
var indent2;
|
|
181483
181661
|
var init_syntax2 = __esm({
|
|
181484
181662
|
"../../node_modules/.pnpm/micromark-extension-gfm-footnote@2.1.0/node_modules/micromark-extension-gfm-footnote/lib/syntax.js"() {
|
|
181485
181663
|
init_micromark_core_commonmark();
|
|
181486
181664
|
init_micromark_factory_space();
|
|
181487
181665
|
init_micromark_util_character();
|
|
181488
181666
|
init_micromark_util_normalize_identifier();
|
|
181489
|
-
|
|
181667
|
+
indent2 = {
|
|
181490
181668
|
tokenize: tokenizeIndent2,
|
|
181491
181669
|
partial: true
|
|
181492
181670
|
};
|
|
@@ -181609,20 +181787,20 @@ var init_micromark_extension_gfm_strikethrough = __esm({
|
|
|
181609
181787
|
});
|
|
181610
181788
|
|
|
181611
181789
|
// ../../node_modules/.pnpm/micromark-extension-gfm-table@2.1.1/node_modules/micromark-extension-gfm-table/lib/edit-map.js
|
|
181612
|
-
function addImplementation(editMap,
|
|
181790
|
+
function addImplementation(editMap, at2, remove, add) {
|
|
181613
181791
|
let index2 = 0;
|
|
181614
181792
|
if (remove === 0 && add.length === 0) {
|
|
181615
181793
|
return;
|
|
181616
181794
|
}
|
|
181617
181795
|
while (index2 < editMap.map.length) {
|
|
181618
|
-
if (editMap.map[index2][0] ===
|
|
181796
|
+
if (editMap.map[index2][0] === at2) {
|
|
181619
181797
|
editMap.map[index2][1] += remove;
|
|
181620
181798
|
editMap.map[index2][2].push(...add);
|
|
181621
181799
|
return;
|
|
181622
181800
|
}
|
|
181623
181801
|
index2 += 1;
|
|
181624
181802
|
}
|
|
181625
|
-
editMap.map.push([
|
|
181803
|
+
editMap.map.push([at2, remove, add]);
|
|
181626
181804
|
}
|
|
181627
181805
|
var EditMap;
|
|
181628
181806
|
var init_edit_map = __esm({
|
|
@@ -183482,12 +183660,12 @@ var require_stringifyComment = __commonJS({
|
|
|
183482
183660
|
"../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/stringify/stringifyComment.js"(exports2) {
|
|
183483
183661
|
"use strict";
|
|
183484
183662
|
var stringifyComment = (str5) => str5.replace(/^(?!$)(?: $)?/gm, "#");
|
|
183485
|
-
function indentComment(comment,
|
|
183663
|
+
function indentComment(comment, indent3) {
|
|
183486
183664
|
if (/^\n+$/.test(comment))
|
|
183487
183665
|
return comment.substring(1);
|
|
183488
|
-
return
|
|
183666
|
+
return indent3 ? comment.replace(/^(?! *$)/gm, indent3) : comment;
|
|
183489
183667
|
}
|
|
183490
|
-
var lineComment = (str5,
|
|
183668
|
+
var lineComment = (str5, indent3, comment) => str5.endsWith("\n") ? indentComment(comment, indent3) : comment.includes("\n") ? "\n" + indentComment(comment, indent3) : (str5.endsWith(" ") ? "" : " ") + comment;
|
|
183491
183669
|
exports2.indentComment = indentComment;
|
|
183492
183670
|
exports2.lineComment = lineComment;
|
|
183493
183671
|
exports2.stringifyComment = stringifyComment;
|
|
@@ -183501,17 +183679,17 @@ var require_foldFlowLines = __commonJS({
|
|
|
183501
183679
|
var FOLD_FLOW = "flow";
|
|
183502
183680
|
var FOLD_BLOCK = "block";
|
|
183503
183681
|
var FOLD_QUOTED = "quoted";
|
|
183504
|
-
function foldFlowLines(text7,
|
|
183682
|
+
function foldFlowLines(text7, indent3, mode = "flow", { indentAtStart, lineWidth = 80, minContentWidth = 20, onFold, onOverflow } = {}) {
|
|
183505
183683
|
if (!lineWidth || lineWidth < 0)
|
|
183506
183684
|
return text7;
|
|
183507
183685
|
if (lineWidth < minContentWidth)
|
|
183508
183686
|
minContentWidth = 0;
|
|
183509
|
-
const endStep = Math.max(1 + minContentWidth, 1 + lineWidth -
|
|
183687
|
+
const endStep = Math.max(1 + minContentWidth, 1 + lineWidth - indent3.length);
|
|
183510
183688
|
if (text7.length <= endStep)
|
|
183511
183689
|
return text7;
|
|
183512
183690
|
const folds = [];
|
|
183513
183691
|
const escapedFolds = {};
|
|
183514
|
-
let end = lineWidth -
|
|
183692
|
+
let end = lineWidth - indent3.length;
|
|
183515
183693
|
if (typeof indentAtStart === "number") {
|
|
183516
183694
|
if (indentAtStart > lineWidth - Math.max(2, minContentWidth))
|
|
183517
183695
|
folds.push(0);
|
|
@@ -183525,7 +183703,7 @@ var require_foldFlowLines = __commonJS({
|
|
|
183525
183703
|
let escStart = -1;
|
|
183526
183704
|
let escEnd = -1;
|
|
183527
183705
|
if (mode === FOLD_BLOCK) {
|
|
183528
|
-
i = consumeMoreIndentedLines(text7, i,
|
|
183706
|
+
i = consumeMoreIndentedLines(text7, i, indent3.length);
|
|
183529
183707
|
if (i !== -1)
|
|
183530
183708
|
end = i + endStep;
|
|
183531
183709
|
}
|
|
@@ -183549,8 +183727,8 @@ var require_foldFlowLines = __commonJS({
|
|
|
183549
183727
|
}
|
|
183550
183728
|
if (ch === "\n") {
|
|
183551
183729
|
if (mode === FOLD_BLOCK)
|
|
183552
|
-
i = consumeMoreIndentedLines(text7, i,
|
|
183553
|
-
end = i +
|
|
183730
|
+
i = consumeMoreIndentedLines(text7, i, indent3.length);
|
|
183731
|
+
end = i + indent3.length + endStep;
|
|
183554
183732
|
split = void 0;
|
|
183555
183733
|
} else {
|
|
183556
183734
|
if (ch === " " && prev && prev !== " " && prev !== "\n" && prev !== " ") {
|
|
@@ -183595,22 +183773,22 @@ var require_foldFlowLines = __commonJS({
|
|
|
183595
183773
|
const end2 = folds[i2 + 1] || text7.length;
|
|
183596
183774
|
if (fold2 === 0)
|
|
183597
183775
|
res = `
|
|
183598
|
-
${
|
|
183776
|
+
${indent3}${text7.slice(0, end2)}`;
|
|
183599
183777
|
else {
|
|
183600
183778
|
if (mode === FOLD_QUOTED && escapedFolds[fold2])
|
|
183601
183779
|
res += `${text7[fold2]}\\`;
|
|
183602
183780
|
res += `
|
|
183603
|
-
${
|
|
183781
|
+
${indent3}${text7.slice(fold2 + 1, end2)}`;
|
|
183604
183782
|
}
|
|
183605
183783
|
}
|
|
183606
183784
|
return res;
|
|
183607
183785
|
}
|
|
183608
|
-
function consumeMoreIndentedLines(text7, i,
|
|
183786
|
+
function consumeMoreIndentedLines(text7, i, indent3) {
|
|
183609
183787
|
let end = i;
|
|
183610
183788
|
let start = i + 1;
|
|
183611
183789
|
let ch = text7[start];
|
|
183612
183790
|
while (ch === " " || ch === " ") {
|
|
183613
|
-
if (i < start +
|
|
183791
|
+
if (i < start + indent3) {
|
|
183614
183792
|
ch = text7[++i];
|
|
183615
183793
|
} else {
|
|
183616
183794
|
do {
|
|
@@ -183666,7 +183844,7 @@ var require_stringifyString = __commonJS({
|
|
|
183666
183844
|
return json;
|
|
183667
183845
|
const { implicitKey } = ctx;
|
|
183668
183846
|
const minMultiLineLength = ctx.options.doubleQuotedMinMultiLineLength;
|
|
183669
|
-
const
|
|
183847
|
+
const indent3 = ctx.indent || (containsDocumentMarker(value2) ? " " : "");
|
|
183670
183848
|
let str5 = "";
|
|
183671
183849
|
let start = 0;
|
|
183672
183850
|
for (let i = 0, ch = json[i]; ch; ch = json[++i]) {
|
|
@@ -183726,7 +183904,7 @@ var require_stringifyString = __commonJS({
|
|
|
183726
183904
|
str5 += "\n";
|
|
183727
183905
|
i += 2;
|
|
183728
183906
|
}
|
|
183729
|
-
str5 +=
|
|
183907
|
+
str5 += indent3;
|
|
183730
183908
|
if (json[i + 2] === " ")
|
|
183731
183909
|
str5 += "\\";
|
|
183732
183910
|
i += 1;
|
|
@@ -183738,15 +183916,15 @@ var require_stringifyString = __commonJS({
|
|
|
183738
183916
|
}
|
|
183739
183917
|
}
|
|
183740
183918
|
str5 = start ? str5 + json.slice(start) : json;
|
|
183741
|
-
return implicitKey ? str5 : foldFlowLines.foldFlowLines(str5,
|
|
183919
|
+
return implicitKey ? str5 : foldFlowLines.foldFlowLines(str5, indent3, foldFlowLines.FOLD_QUOTED, getFoldOptions(ctx, false));
|
|
183742
183920
|
}
|
|
183743
183921
|
function singleQuotedString(value2, ctx) {
|
|
183744
183922
|
if (ctx.options.singleQuote === false || ctx.implicitKey && value2.includes("\n") || /[ \t]\n|\n[ \t]/.test(value2))
|
|
183745
183923
|
return doubleQuotedString(value2, ctx);
|
|
183746
|
-
const
|
|
183924
|
+
const indent3 = ctx.indent || (containsDocumentMarker(value2) ? " " : "");
|
|
183747
183925
|
const res = "'" + value2.replace(/'/g, "''").replace(/\n+/g, `$&
|
|
183748
|
-
${
|
|
183749
|
-
return ctx.implicitKey ? res : foldFlowLines.foldFlowLines(res,
|
|
183926
|
+
${indent3}`) + "'";
|
|
183927
|
+
return ctx.implicitKey ? res : foldFlowLines.foldFlowLines(res, indent3, foldFlowLines.FOLD_FLOW, getFoldOptions(ctx, false));
|
|
183750
183928
|
}
|
|
183751
183929
|
function quotedString(value2, ctx) {
|
|
183752
183930
|
const { singleQuote } = ctx.options;
|
|
@@ -183776,8 +183954,8 @@ ${indent2}`) + "'";
|
|
|
183776
183954
|
if (!blockQuote2 || /\n[\t ]+$/.test(value2)) {
|
|
183777
183955
|
return quotedString(value2, ctx);
|
|
183778
183956
|
}
|
|
183779
|
-
const
|
|
183780
|
-
const literal2 = blockQuote2 === "literal" ? true : blockQuote2 === "folded" || type === Scalar.Scalar.BLOCK_FOLDED ? false : type === Scalar.Scalar.BLOCK_LITERAL ? true : !lineLengthOverLimit(value2, lineWidth,
|
|
183957
|
+
const indent3 = ctx.indent || (ctx.forceBlockIndent || containsDocumentMarker(value2) ? " " : "");
|
|
183958
|
+
const literal2 = blockQuote2 === "literal" ? true : blockQuote2 === "folded" || type === Scalar.Scalar.BLOCK_FOLDED ? false : type === Scalar.Scalar.BLOCK_LITERAL ? true : !lineLengthOverLimit(value2, lineWidth, indent3.length);
|
|
183781
183959
|
if (!value2)
|
|
183782
183960
|
return literal2 ? "|\n" : ">\n";
|
|
183783
183961
|
let chomp;
|
|
@@ -183802,7 +183980,7 @@ ${indent2}`) + "'";
|
|
|
183802
183980
|
value2 = value2.slice(0, -end.length);
|
|
183803
183981
|
if (end[end.length - 1] === "\n")
|
|
183804
183982
|
end = end.slice(0, -1);
|
|
183805
|
-
end = end.replace(blockEndNewlines, `$&${
|
|
183983
|
+
end = end.replace(blockEndNewlines, `$&${indent3}`);
|
|
183806
183984
|
}
|
|
183807
183985
|
let startWithSpace = false;
|
|
183808
183986
|
let startEnd;
|
|
@@ -183819,9 +183997,9 @@ ${indent2}`) + "'";
|
|
|
183819
183997
|
let start = value2.substring(0, startNlPos < startEnd ? startNlPos + 1 : startEnd);
|
|
183820
183998
|
if (start) {
|
|
183821
183999
|
value2 = value2.substring(start.length);
|
|
183822
|
-
start = start.replace(/\n+/g, `$&${
|
|
184000
|
+
start = start.replace(/\n+/g, `$&${indent3}`);
|
|
183823
184001
|
}
|
|
183824
|
-
const indentSize =
|
|
184002
|
+
const indentSize = indent3 ? "2" : "1";
|
|
183825
184003
|
let header = (startWithSpace ? indentSize : "") + chomp;
|
|
183826
184004
|
if (comment) {
|
|
183827
184005
|
header += " " + commentString(comment.replace(/ ?[\r\n]+/g, " "));
|
|
@@ -183829,7 +184007,7 @@ ${indent2}`) + "'";
|
|
|
183829
184007
|
onComment();
|
|
183830
184008
|
}
|
|
183831
184009
|
if (!literal2) {
|
|
183832
|
-
const foldedValue = value2.replace(/\n+/g, "\n$&").replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, "$1$2").replace(/\n+/g, `$&${
|
|
184010
|
+
const foldedValue = value2.replace(/\n+/g, "\n$&").replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, "$1$2").replace(/\n+/g, `$&${indent3}`);
|
|
183833
184011
|
let literalFallback = false;
|
|
183834
184012
|
const foldOptions = getFoldOptions(ctx, true);
|
|
183835
184013
|
if (blockQuote2 !== "folded" && type !== Scalar.Scalar.BLOCK_FOLDED) {
|
|
@@ -183837,18 +184015,18 @@ ${indent2}`) + "'";
|
|
|
183837
184015
|
literalFallback = true;
|
|
183838
184016
|
};
|
|
183839
184017
|
}
|
|
183840
|
-
const body2 = foldFlowLines.foldFlowLines(`${start}${foldedValue}${end}`,
|
|
184018
|
+
const body2 = foldFlowLines.foldFlowLines(`${start}${foldedValue}${end}`, indent3, foldFlowLines.FOLD_BLOCK, foldOptions);
|
|
183841
184019
|
if (!literalFallback)
|
|
183842
184020
|
return `>${header}
|
|
183843
|
-
${
|
|
184021
|
+
${indent3}${body2}`;
|
|
183844
184022
|
}
|
|
183845
|
-
value2 = value2.replace(/\n+/g, `$&${
|
|
184023
|
+
value2 = value2.replace(/\n+/g, `$&${indent3}`);
|
|
183846
184024
|
return `|${header}
|
|
183847
|
-
${
|
|
184025
|
+
${indent3}${start}${value2}${end}`;
|
|
183848
184026
|
}
|
|
183849
184027
|
function plainString(item, ctx, onComment, onChompKeep) {
|
|
183850
184028
|
const { type, value: value2 } = item;
|
|
183851
|
-
const { actualString, implicitKey, indent:
|
|
184029
|
+
const { actualString, implicitKey, indent: indent3, indentStep, inFlow } = ctx;
|
|
183852
184030
|
if (implicitKey && value2.includes("\n") || inFlow && /[[\]{},]/.test(value2)) {
|
|
183853
184031
|
return quotedString(value2, ctx);
|
|
183854
184032
|
}
|
|
@@ -183859,22 +184037,22 @@ ${indent2}${start}${value2}${end}`;
|
|
|
183859
184037
|
return blockString(item, ctx, onComment, onChompKeep);
|
|
183860
184038
|
}
|
|
183861
184039
|
if (containsDocumentMarker(value2)) {
|
|
183862
|
-
if (
|
|
184040
|
+
if (indent3 === "") {
|
|
183863
184041
|
ctx.forceBlockIndent = true;
|
|
183864
184042
|
return blockString(item, ctx, onComment, onChompKeep);
|
|
183865
|
-
} else if (implicitKey &&
|
|
184043
|
+
} else if (implicitKey && indent3 === indentStep) {
|
|
183866
184044
|
return quotedString(value2, ctx);
|
|
183867
184045
|
}
|
|
183868
184046
|
}
|
|
183869
184047
|
const str5 = value2.replace(/\n+/g, `$&
|
|
183870
|
-
${
|
|
184048
|
+
${indent3}`);
|
|
183871
184049
|
if (actualString) {
|
|
183872
184050
|
const test = (tag) => tag.default && tag.tag !== "tag:yaml.org,2002:str" && tag.test?.test(str5);
|
|
183873
184051
|
const { compat, tags } = ctx.doc.schema;
|
|
183874
184052
|
if (tags.some(test) || compat?.some(test))
|
|
183875
184053
|
return quotedString(value2, ctx);
|
|
183876
184054
|
}
|
|
183877
|
-
return implicitKey ? str5 : foldFlowLines.foldFlowLines(str5,
|
|
184055
|
+
return implicitKey ? str5 : foldFlowLines.foldFlowLines(str5, indent3, foldFlowLines.FOLD_FLOW, getFoldOptions(ctx, false));
|
|
183878
184056
|
}
|
|
183879
184057
|
function stringifyString(item, ctx, onComment, onChompKeep) {
|
|
183880
184058
|
const { implicitKey, inFlow } = ctx;
|
|
@@ -184046,7 +184224,7 @@ var require_stringifyPair = __commonJS({
|
|
|
184046
184224
|
var stringify = require_stringify2();
|
|
184047
184225
|
var stringifyComment = require_stringifyComment();
|
|
184048
184226
|
function stringifyPair({ key: key2, value: value2 }, ctx, onComment, onChompKeep) {
|
|
184049
|
-
const { allNullValues, doc, indent:
|
|
184227
|
+
const { allNullValues, doc, indent: indent3, indentStep, options: { commentString, indentSeq, simpleKeys } } = ctx;
|
|
184050
184228
|
let keyComment = identity.isNode(key2) && key2.comment || null;
|
|
184051
184229
|
if (simpleKeys) {
|
|
184052
184230
|
if (keyComment) {
|
|
@@ -184061,7 +184239,7 @@ var require_stringifyPair = __commonJS({
|
|
|
184061
184239
|
ctx = Object.assign({}, ctx, {
|
|
184062
184240
|
allNullValues: false,
|
|
184063
184241
|
implicitKey: !explicitKey && (simpleKeys || !allNullValues),
|
|
184064
|
-
indent:
|
|
184242
|
+
indent: indent3 + indentStep
|
|
184065
184243
|
});
|
|
184066
184244
|
let keyCommentDone = false;
|
|
184067
184245
|
let chompKeep = false;
|
|
@@ -184091,7 +184269,7 @@ var require_stringifyPair = __commonJS({
|
|
|
184091
184269
|
if (keyComment)
|
|
184092
184270
|
str5 += stringifyComment.lineComment(str5, ctx.indent, commentString(keyComment));
|
|
184093
184271
|
str5 = `? ${str5}
|
|
184094
|
-
${
|
|
184272
|
+
${indent3}:`;
|
|
184095
184273
|
} else {
|
|
184096
184274
|
str5 = `${str5}:`;
|
|
184097
184275
|
if (keyComment)
|
|
@@ -184369,7 +184547,7 @@ var require_stringifyCollection = __commonJS({
|
|
|
184369
184547
|
return stringify2(collection, ctx, options);
|
|
184370
184548
|
}
|
|
184371
184549
|
function stringifyBlockCollection({ comment, items }, ctx, { blockItemPrefix, flowChars, itemIndent, onChompKeep, onComment }) {
|
|
184372
|
-
const { indent:
|
|
184550
|
+
const { indent: indent3, options: { commentString } } = ctx;
|
|
184373
184551
|
const itemCtx = Object.assign({}, ctx, { indent: itemIndent, type: null });
|
|
184374
184552
|
let chompKeep = false;
|
|
184375
184553
|
const lines = [];
|
|
@@ -184406,11 +184584,11 @@ var require_stringifyCollection = __commonJS({
|
|
|
184406
184584
|
for (let i = 1; i < lines.length; ++i) {
|
|
184407
184585
|
const line2 = lines[i];
|
|
184408
184586
|
str5 += line2 ? `
|
|
184409
|
-
${
|
|
184587
|
+
${indent3}${line2}` : "\n";
|
|
184410
184588
|
}
|
|
184411
184589
|
}
|
|
184412
184590
|
if (comment) {
|
|
184413
|
-
str5 += "\n" + stringifyComment.indentComment(commentString(comment),
|
|
184591
|
+
str5 += "\n" + stringifyComment.indentComment(commentString(comment), indent3);
|
|
184414
184592
|
if (onComment)
|
|
184415
184593
|
onComment();
|
|
184416
184594
|
} else if (chompKeep && onChompKeep)
|
|
@@ -184418,7 +184596,7 @@ ${indent2}${line2}` : "\n";
|
|
|
184418
184596
|
return str5;
|
|
184419
184597
|
}
|
|
184420
184598
|
function stringifyFlowCollection({ items }, ctx, { flowChars, itemIndent }) {
|
|
184421
|
-
const { indent:
|
|
184599
|
+
const { indent: indent3, indentStep, flowCollectionPadding: fcPadding, options: { commentString } } = ctx;
|
|
184422
184600
|
itemIndent += indentStep;
|
|
184423
184601
|
const itemCtx = Object.assign({}, ctx, {
|
|
184424
184602
|
indent: itemIndent,
|
|
@@ -184487,19 +184665,19 @@ ${indent2}${line2}` : "\n";
|
|
|
184487
184665
|
let str5 = start;
|
|
184488
184666
|
for (const line2 of lines)
|
|
184489
184667
|
str5 += line2 ? `
|
|
184490
|
-
${indentStep}${
|
|
184668
|
+
${indentStep}${indent3}${line2}` : "\n";
|
|
184491
184669
|
return `${str5}
|
|
184492
|
-
${
|
|
184670
|
+
${indent3}${end}`;
|
|
184493
184671
|
} else {
|
|
184494
184672
|
return `${start}${fcPadding}${lines.join(" ")}${fcPadding}${end}`;
|
|
184495
184673
|
}
|
|
184496
184674
|
}
|
|
184497
184675
|
}
|
|
184498
|
-
function addCommentBefore({ indent:
|
|
184676
|
+
function addCommentBefore({ indent: indent3, options: { commentString } }, lines, comment, chompKeep) {
|
|
184499
184677
|
if (comment && chompKeep)
|
|
184500
184678
|
comment = comment.replace(/^\n+/, "");
|
|
184501
184679
|
if (comment) {
|
|
184502
|
-
const ic = stringifyComment.indentComment(commentString(comment),
|
|
184680
|
+
const ic = stringifyComment.indentComment(commentString(comment), indent3);
|
|
184503
184681
|
lines.push(ic.trimStart());
|
|
184504
184682
|
}
|
|
184505
184683
|
}
|
|
@@ -184879,9 +185057,9 @@ var require_stringifyNumber = __commonJS({
|
|
|
184879
185057
|
function stringifyNumber({ format, minFractionDigits, tag, value: value2 }) {
|
|
184880
185058
|
if (typeof value2 === "bigint")
|
|
184881
185059
|
return String(value2);
|
|
184882
|
-
const
|
|
184883
|
-
if (!isFinite(
|
|
184884
|
-
return isNaN(
|
|
185060
|
+
const num5 = typeof value2 === "number" ? value2 : Number(value2);
|
|
185061
|
+
if (!isFinite(num5))
|
|
185062
|
+
return isNaN(num5) ? ".nan" : num5 < 0 ? "-.inf" : ".inf";
|
|
184885
185063
|
let n = Object.is(value2, -0) ? "-0" : JSON.stringify(value2);
|
|
184886
185064
|
if (!format && minFractionDigits && (!tag || tag === "tag:yaml.org,2002:float") && /^-?\d/.test(n) && !n.includes("e")) {
|
|
184887
185065
|
let i = n.indexOf(".");
|
|
@@ -184921,8 +185099,8 @@ var require_float2 = __commonJS({
|
|
|
184921
185099
|
test: /^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,
|
|
184922
185100
|
resolve: (str5) => parseFloat(str5),
|
|
184923
185101
|
stringify(node2) {
|
|
184924
|
-
const
|
|
184925
|
-
return isFinite(
|
|
185102
|
+
const num5 = Number(node2.value);
|
|
185103
|
+
return isFinite(num5) ? num5.toExponential() : stringifyNumber.stringifyNumber(node2);
|
|
184926
185104
|
}
|
|
184927
185105
|
};
|
|
184928
185106
|
var float = {
|
|
@@ -185361,8 +185539,8 @@ var require_float3 = __commonJS({
|
|
|
185361
185539
|
test: /^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,
|
|
185362
185540
|
resolve: (str5) => parseFloat(str5.replace(/_/g, "")),
|
|
185363
185541
|
stringify(node2) {
|
|
185364
|
-
const
|
|
185365
|
-
return isFinite(
|
|
185542
|
+
const num5 = Number(node2.value);
|
|
185543
|
+
return isFinite(num5) ? num5.toExponential() : stringifyNumber.stringifyNumber(node2);
|
|
185366
185544
|
}
|
|
185367
185545
|
};
|
|
185368
185546
|
var float = {
|
|
@@ -185564,23 +185742,23 @@ var require_timestamp = __commonJS({
|
|
|
185564
185742
|
function parseSexagesimal(str5, asBigInt) {
|
|
185565
185743
|
const sign3 = str5[0];
|
|
185566
185744
|
const parts = sign3 === "-" || sign3 === "+" ? str5.substring(1) : str5;
|
|
185567
|
-
const
|
|
185568
|
-
const res = parts.replace(/_/g, "").split(":").reduce((res2, p2) => res2 *
|
|
185569
|
-
return sign3 === "-" ?
|
|
185745
|
+
const num5 = (n) => asBigInt ? BigInt(n) : Number(n);
|
|
185746
|
+
const res = parts.replace(/_/g, "").split(":").reduce((res2, p2) => res2 * num5(60) + num5(p2), num5(0));
|
|
185747
|
+
return sign3 === "-" ? num5(-1) * res : res;
|
|
185570
185748
|
}
|
|
185571
185749
|
function stringifySexagesimal(node2) {
|
|
185572
185750
|
let { value: value2 } = node2;
|
|
185573
|
-
let
|
|
185751
|
+
let num5 = (n) => n;
|
|
185574
185752
|
if (typeof value2 === "bigint")
|
|
185575
|
-
|
|
185753
|
+
num5 = (n) => BigInt(n);
|
|
185576
185754
|
else if (isNaN(value2) || !isFinite(value2))
|
|
185577
185755
|
return stringifyNumber.stringifyNumber(node2);
|
|
185578
185756
|
let sign3 = "";
|
|
185579
185757
|
if (value2 < 0) {
|
|
185580
185758
|
sign3 = "-";
|
|
185581
|
-
value2 *=
|
|
185759
|
+
value2 *= num5(-1);
|
|
185582
185760
|
}
|
|
185583
|
-
const _60 =
|
|
185761
|
+
const _60 = num5(60);
|
|
185584
185762
|
const parts = [value2 % _60];
|
|
185585
185763
|
if (value2 < 60) {
|
|
185586
185764
|
parts.unshift(0);
|
|
@@ -186449,10 +186627,10 @@ var require_util_flow_indent_check = __commonJS({
|
|
|
186449
186627
|
"../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/compose/util-flow-indent-check.js"(exports2) {
|
|
186450
186628
|
"use strict";
|
|
186451
186629
|
var utilContainsNewline = require_util_contains_newline();
|
|
186452
|
-
function flowIndentCheck(
|
|
186630
|
+
function flowIndentCheck(indent3, fc, onError) {
|
|
186453
186631
|
if (fc?.type === "flow-collection") {
|
|
186454
186632
|
const end = fc.end[0];
|
|
186455
|
-
if (end.indent ===
|
|
186633
|
+
if (end.indent === indent3 && (end.source === "]" || end.source === "}") && utilContainsNewline.containsNewline(fc)) {
|
|
186456
186634
|
const msg = "Flow end indicator should be more indented than parent";
|
|
186457
186635
|
onError(end, "BAD_INDENT", msg, true);
|
|
186458
186636
|
}
|
|
@@ -186970,17 +187148,17 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
186970
187148
|
let offset = scalar.offset + header.length;
|
|
186971
187149
|
let contentStart = 0;
|
|
186972
187150
|
for (let i = 0; i < chompStart; ++i) {
|
|
186973
|
-
const [
|
|
187151
|
+
const [indent3, content3] = lines[i];
|
|
186974
187152
|
if (content3 === "" || content3 === "\r") {
|
|
186975
|
-
if (header.indent === 0 &&
|
|
186976
|
-
trimIndent =
|
|
187153
|
+
if (header.indent === 0 && indent3.length > trimIndent)
|
|
187154
|
+
trimIndent = indent3.length;
|
|
186977
187155
|
} else {
|
|
186978
|
-
if (
|
|
187156
|
+
if (indent3.length < trimIndent) {
|
|
186979
187157
|
const message = "Block scalars with more-indented leading empty lines must use an explicit indentation indicator";
|
|
186980
|
-
onError(offset +
|
|
187158
|
+
onError(offset + indent3.length, "MISSING_CHAR", message);
|
|
186981
187159
|
}
|
|
186982
187160
|
if (header.indent === 0)
|
|
186983
|
-
trimIndent =
|
|
187161
|
+
trimIndent = indent3.length;
|
|
186984
187162
|
contentStart = i;
|
|
186985
187163
|
if (trimIndent === 0 && !ctx.atRoot) {
|
|
186986
187164
|
const message = "Block scalar values in collections must be indented";
|
|
@@ -186988,7 +187166,7 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
186988
187166
|
}
|
|
186989
187167
|
break;
|
|
186990
187168
|
}
|
|
186991
|
-
offset +=
|
|
187169
|
+
offset += indent3.length + content3.length + 1;
|
|
186992
187170
|
}
|
|
186993
187171
|
for (let i = lines.length - 1; i >= chompStart; --i) {
|
|
186994
187172
|
if (lines[i][0].length > trimIndent)
|
|
@@ -187000,26 +187178,26 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
187000
187178
|
for (let i = 0; i < contentStart; ++i)
|
|
187001
187179
|
value2 += lines[i][0].slice(trimIndent) + "\n";
|
|
187002
187180
|
for (let i = contentStart; i < chompStart; ++i) {
|
|
187003
|
-
let [
|
|
187004
|
-
offset +=
|
|
187181
|
+
let [indent3, content3] = lines[i];
|
|
187182
|
+
offset += indent3.length + content3.length + 1;
|
|
187005
187183
|
const crlf = content3[content3.length - 1] === "\r";
|
|
187006
187184
|
if (crlf)
|
|
187007
187185
|
content3 = content3.slice(0, -1);
|
|
187008
|
-
if (content3 &&
|
|
187186
|
+
if (content3 && indent3.length < trimIndent) {
|
|
187009
187187
|
const src = header.indent ? "explicit indentation indicator" : "first line";
|
|
187010
187188
|
const message = `Block scalar lines must not be less indented than their ${src}`;
|
|
187011
187189
|
onError(offset - content3.length - (crlf ? 2 : 1), "BAD_INDENT", message);
|
|
187012
|
-
|
|
187190
|
+
indent3 = "";
|
|
187013
187191
|
}
|
|
187014
187192
|
if (type === Scalar.Scalar.BLOCK_LITERAL) {
|
|
187015
|
-
value2 += sep6 +
|
|
187193
|
+
value2 += sep6 + indent3.slice(trimIndent) + content3;
|
|
187016
187194
|
sep6 = "\n";
|
|
187017
|
-
} else if (
|
|
187195
|
+
} else if (indent3.length > trimIndent || content3[0] === " ") {
|
|
187018
187196
|
if (sep6 === " ")
|
|
187019
187197
|
sep6 = "\n";
|
|
187020
187198
|
else if (!prevMoreIndented && sep6 === "\n")
|
|
187021
187199
|
sep6 = "\n\n";
|
|
187022
|
-
value2 += sep6 +
|
|
187200
|
+
value2 += sep6 + indent3.slice(trimIndent) + content3;
|
|
187023
187201
|
sep6 = "\n";
|
|
187024
187202
|
prevMoreIndented = true;
|
|
187025
187203
|
} else if (content3 === "") {
|
|
@@ -187055,7 +187233,7 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
187055
187233
|
}
|
|
187056
187234
|
const { source } = props[0];
|
|
187057
187235
|
const mode = source[0];
|
|
187058
|
-
let
|
|
187236
|
+
let indent3 = 0;
|
|
187059
187237
|
let chomp = "";
|
|
187060
187238
|
let error2 = -1;
|
|
187061
187239
|
for (let i = 1; i < source.length; ++i) {
|
|
@@ -187064,8 +187242,8 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
187064
187242
|
chomp = ch;
|
|
187065
187243
|
else {
|
|
187066
187244
|
const n = Number(ch);
|
|
187067
|
-
if (!
|
|
187068
|
-
|
|
187245
|
+
if (!indent3 && n)
|
|
187246
|
+
indent3 = n;
|
|
187069
187247
|
else if (error2 === -1)
|
|
187070
187248
|
error2 = offset + i;
|
|
187071
187249
|
}
|
|
@@ -187106,7 +187284,7 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
187106
187284
|
}
|
|
187107
187285
|
}
|
|
187108
187286
|
}
|
|
187109
|
-
return { mode, indent:
|
|
187287
|
+
return { mode, indent: indent3, chomp, comment, length };
|
|
187110
187288
|
}
|
|
187111
187289
|
function splitLines(source) {
|
|
187112
187290
|
const split = source.split(/\n( *)/);
|
|
@@ -187839,15 +188017,15 @@ var require_cst_scalar = __commonJS({
|
|
|
187839
188017
|
return null;
|
|
187840
188018
|
}
|
|
187841
188019
|
function createScalarToken(value2, context2) {
|
|
187842
|
-
const { implicitKey = false, indent:
|
|
188020
|
+
const { implicitKey = false, indent: indent3, inFlow = false, offset = -1, type = "PLAIN" } = context2;
|
|
187843
188021
|
const source = stringifyString.stringifyString({ type, value: value2 }, {
|
|
187844
188022
|
implicitKey,
|
|
187845
|
-
indent:
|
|
188023
|
+
indent: indent3 > 0 ? " ".repeat(indent3) : "",
|
|
187846
188024
|
inFlow,
|
|
187847
188025
|
options: { blockQuote: true, lineWidth: -1 }
|
|
187848
188026
|
});
|
|
187849
188027
|
const end = context2.end ?? [
|
|
187850
|
-
{ type: "newline", offset: -1, indent:
|
|
188028
|
+
{ type: "newline", offset: -1, indent: indent3, source: "\n" }
|
|
187851
188029
|
];
|
|
187852
188030
|
switch (source[0]) {
|
|
187853
188031
|
case "|":
|
|
@@ -187856,25 +188034,25 @@ var require_cst_scalar = __commonJS({
|
|
|
187856
188034
|
const head = source.substring(0, he);
|
|
187857
188035
|
const body2 = source.substring(he + 1) + "\n";
|
|
187858
188036
|
const props = [
|
|
187859
|
-
{ type: "block-scalar-header", offset, indent:
|
|
188037
|
+
{ type: "block-scalar-header", offset, indent: indent3, source: head }
|
|
187860
188038
|
];
|
|
187861
188039
|
if (!addEndtoBlockProps(props, end))
|
|
187862
|
-
props.push({ type: "newline", offset: -1, indent:
|
|
187863
|
-
return { type: "block-scalar", offset, indent:
|
|
188040
|
+
props.push({ type: "newline", offset: -1, indent: indent3, source: "\n" });
|
|
188041
|
+
return { type: "block-scalar", offset, indent: indent3, props, source: body2 };
|
|
187864
188042
|
}
|
|
187865
188043
|
case '"':
|
|
187866
|
-
return { type: "double-quoted-scalar", offset, indent:
|
|
188044
|
+
return { type: "double-quoted-scalar", offset, indent: indent3, source, end };
|
|
187867
188045
|
case "'":
|
|
187868
|
-
return { type: "single-quoted-scalar", offset, indent:
|
|
188046
|
+
return { type: "single-quoted-scalar", offset, indent: indent3, source, end };
|
|
187869
188047
|
default:
|
|
187870
|
-
return { type: "scalar", offset, indent:
|
|
188048
|
+
return { type: "scalar", offset, indent: indent3, source, end };
|
|
187871
188049
|
}
|
|
187872
188050
|
}
|
|
187873
188051
|
function setScalarValue(token, value2, context2 = {}) {
|
|
187874
188052
|
let { afterKey = false, implicitKey = false, inFlow = false, type } = context2;
|
|
187875
|
-
let
|
|
187876
|
-
if (afterKey && typeof
|
|
187877
|
-
|
|
188053
|
+
let indent3 = "indent" in token ? token.indent : null;
|
|
188054
|
+
if (afterKey && typeof indent3 === "number")
|
|
188055
|
+
indent3 += 2;
|
|
187878
188056
|
if (!type)
|
|
187879
188057
|
switch (token.type) {
|
|
187880
188058
|
case "single-quoted-scalar":
|
|
@@ -187894,8 +188072,8 @@ var require_cst_scalar = __commonJS({
|
|
|
187894
188072
|
type = "PLAIN";
|
|
187895
188073
|
}
|
|
187896
188074
|
const source = stringifyString.stringifyString({ type, value: value2 }, {
|
|
187897
|
-
implicitKey: implicitKey ||
|
|
187898
|
-
indent:
|
|
188075
|
+
implicitKey: implicitKey || indent3 === null,
|
|
188076
|
+
indent: indent3 !== null && indent3 > 0 ? " ".repeat(indent3) : "",
|
|
187899
188077
|
inFlow,
|
|
187900
188078
|
options: { blockQuote: true, lineWidth: -1 }
|
|
187901
188079
|
});
|
|
@@ -187926,16 +188104,16 @@ var require_cst_scalar = __commonJS({
|
|
|
187926
188104
|
token.source = body2;
|
|
187927
188105
|
} else {
|
|
187928
188106
|
const { offset } = token;
|
|
187929
|
-
const
|
|
188107
|
+
const indent3 = "indent" in token ? token.indent : -1;
|
|
187930
188108
|
const props = [
|
|
187931
|
-
{ type: "block-scalar-header", offset, indent:
|
|
188109
|
+
{ type: "block-scalar-header", offset, indent: indent3, source: head }
|
|
187932
188110
|
];
|
|
187933
188111
|
if (!addEndtoBlockProps(props, "end" in token ? token.end : void 0))
|
|
187934
|
-
props.push({ type: "newline", offset: -1, indent:
|
|
188112
|
+
props.push({ type: "newline", offset: -1, indent: indent3, source: "\n" });
|
|
187935
188113
|
for (const key2 of Object.keys(token))
|
|
187936
188114
|
if (key2 !== "type" && key2 !== "offset")
|
|
187937
188115
|
delete token[key2];
|
|
187938
|
-
Object.assign(token, { type: "block-scalar", indent:
|
|
188116
|
+
Object.assign(token, { type: "block-scalar", indent: indent3, props, source: body2 });
|
|
187939
188117
|
}
|
|
187940
188118
|
}
|
|
187941
188119
|
function addEndtoBlockProps(props, end) {
|
|
@@ -187980,12 +188158,12 @@ var require_cst_scalar = __commonJS({
|
|
|
187980
188158
|
break;
|
|
187981
188159
|
}
|
|
187982
188160
|
default: {
|
|
187983
|
-
const
|
|
188161
|
+
const indent3 = "indent" in token ? token.indent : -1;
|
|
187984
188162
|
const end = "end" in token && Array.isArray(token.end) ? token.end.filter((st) => st.type === "space" || st.type === "comment" || st.type === "newline") : [];
|
|
187985
188163
|
for (const key2 of Object.keys(token))
|
|
187986
188164
|
if (key2 !== "type" && key2 !== "offset")
|
|
187987
188165
|
delete token[key2];
|
|
187988
|
-
Object.assign(token, { type, indent:
|
|
188166
|
+
Object.assign(token, { type, indent: indent3, source, end });
|
|
187989
188167
|
}
|
|
187990
188168
|
}
|
|
187991
188169
|
}
|
|
@@ -188291,15 +188469,15 @@ var require_lexer = __commonJS({
|
|
|
188291
188469
|
continueScalar(offset) {
|
|
188292
188470
|
let ch = this.buffer[offset];
|
|
188293
188471
|
if (this.indentNext > 0) {
|
|
188294
|
-
let
|
|
188472
|
+
let indent3 = 0;
|
|
188295
188473
|
while (ch === " ")
|
|
188296
|
-
ch = this.buffer[++
|
|
188474
|
+
ch = this.buffer[++indent3 + offset];
|
|
188297
188475
|
if (ch === "\r") {
|
|
188298
|
-
const next = this.buffer[
|
|
188476
|
+
const next = this.buffer[indent3 + offset + 1];
|
|
188299
188477
|
if (next === "\n" || !next && !this.atEnd)
|
|
188300
|
-
return offset +
|
|
188478
|
+
return offset + indent3 + 1;
|
|
188301
188479
|
}
|
|
188302
|
-
return ch === "\n" ||
|
|
188480
|
+
return ch === "\n" || indent3 >= this.indentNext || !ch && !this.atEnd ? offset + indent3 : -1;
|
|
188303
188481
|
}
|
|
188304
188482
|
if (ch === "-" || ch === ".") {
|
|
188305
188483
|
const dt = this.buffer.substr(offset, 3);
|
|
@@ -188468,12 +188646,12 @@ var require_lexer = __commonJS({
|
|
|
188468
188646
|
}
|
|
188469
188647
|
*parseFlowCollection() {
|
|
188470
188648
|
let nl, sp;
|
|
188471
|
-
let
|
|
188649
|
+
let indent3 = -1;
|
|
188472
188650
|
do {
|
|
188473
188651
|
nl = yield* this.pushNewline();
|
|
188474
188652
|
if (nl > 0) {
|
|
188475
188653
|
sp = yield* this.pushSpaces(false);
|
|
188476
|
-
this.indentValue =
|
|
188654
|
+
this.indentValue = indent3 = sp;
|
|
188477
188655
|
} else {
|
|
188478
188656
|
sp = 0;
|
|
188479
188657
|
}
|
|
@@ -188482,8 +188660,8 @@ var require_lexer = __commonJS({
|
|
|
188482
188660
|
const line2 = this.getLine();
|
|
188483
188661
|
if (line2 === null)
|
|
188484
188662
|
return this.setNext("flow");
|
|
188485
|
-
if (
|
|
188486
|
-
const atFlowEndMarker =
|
|
188663
|
+
if (indent3 !== -1 && indent3 < this.indentNext && line2[0] !== "#" || indent3 === 0 && (line2.startsWith("---") || line2.startsWith("...")) && isEmpty(line2[3])) {
|
|
188664
|
+
const atFlowEndMarker = indent3 === this.indentNext - 1 && this.flowLevel === 1 && (line2[0] === "]" || line2[0] === "}");
|
|
188487
188665
|
if (!atFlowEndMarker) {
|
|
188488
188666
|
this.flowLevel = 0;
|
|
188489
188667
|
yield cst.FLOW_END;
|
|
@@ -188591,16 +188769,16 @@ var require_lexer = __commonJS({
|
|
|
188591
188769
|
}
|
|
188592
188770
|
*parseBlockScalar() {
|
|
188593
188771
|
let nl = this.pos - 1;
|
|
188594
|
-
let
|
|
188772
|
+
let indent3 = 0;
|
|
188595
188773
|
let ch;
|
|
188596
188774
|
loop: for (let i2 = this.pos; ch = this.buffer[i2]; ++i2) {
|
|
188597
188775
|
switch (ch) {
|
|
188598
188776
|
case " ":
|
|
188599
|
-
|
|
188777
|
+
indent3 += 1;
|
|
188600
188778
|
break;
|
|
188601
188779
|
case "\n":
|
|
188602
188780
|
nl = i2;
|
|
188603
|
-
|
|
188781
|
+
indent3 = 0;
|
|
188604
188782
|
break;
|
|
188605
188783
|
case "\r": {
|
|
188606
188784
|
const next = this.buffer[i2 + 1];
|
|
@@ -188616,9 +188794,9 @@ var require_lexer = __commonJS({
|
|
|
188616
188794
|
}
|
|
188617
188795
|
if (!ch && !this.atEnd)
|
|
188618
188796
|
return this.setNext("block-scalar");
|
|
188619
|
-
if (
|
|
188797
|
+
if (indent3 >= this.indentNext) {
|
|
188620
188798
|
if (this.blockScalarIndent === -1)
|
|
188621
|
-
this.indentNext =
|
|
188799
|
+
this.indentNext = indent3;
|
|
188622
188800
|
else {
|
|
188623
188801
|
this.indentNext = this.blockScalarIndent + (this.indentNext === 0 ? 1 : this.indentNext);
|
|
188624
188802
|
}
|
|
@@ -188651,7 +188829,7 @@ var require_lexer = __commonJS({
|
|
|
188651
188829
|
const lastChar = i2;
|
|
188652
188830
|
while (ch2 === " ")
|
|
188653
188831
|
ch2 = this.buffer[--i2];
|
|
188654
|
-
if (ch2 === "\n" && i2 >= this.pos && i2 + 1 +
|
|
188832
|
+
if (ch2 === "\n" && i2 >= this.pos && i2 + 1 + indent3 > lastChar)
|
|
188655
188833
|
nl = i2;
|
|
188656
188834
|
else
|
|
188657
188835
|
break;
|
|
@@ -189667,10 +189845,10 @@ var require_parser2 = __commonJS({
|
|
|
189667
189845
|
}
|
|
189668
189846
|
return null;
|
|
189669
189847
|
}
|
|
189670
|
-
atIndentedComment(start,
|
|
189848
|
+
atIndentedComment(start, indent3) {
|
|
189671
189849
|
if (this.type !== "comment")
|
|
189672
189850
|
return false;
|
|
189673
|
-
if (this.indent <=
|
|
189851
|
+
if (this.indent <= indent3)
|
|
189674
189852
|
return false;
|
|
189675
189853
|
return start.every((st) => st.type === "newline" || st.type === "space");
|
|
189676
189854
|
}
|
|
@@ -189792,8 +189970,8 @@ var require_public_api = __commonJS({
|
|
|
189792
189970
|
if (typeof options === "string")
|
|
189793
189971
|
options = options.length;
|
|
189794
189972
|
if (typeof options === "number") {
|
|
189795
|
-
const
|
|
189796
|
-
options =
|
|
189973
|
+
const indent3 = Math.round(options);
|
|
189974
|
+
options = indent3 < 1 ? void 0 : indent3 > 8 ? { indent: 8 } : { indent: indent3 };
|
|
189797
189975
|
}
|
|
189798
189976
|
if (value2 === void 0) {
|
|
189799
189977
|
const { keepUndefined } = options ?? replacer ?? {};
|
|
@@ -201129,8 +201307,8 @@ function failureSummary(kind, ctx) {
|
|
|
201129
201307
|
case "auth":
|
|
201130
201308
|
return `\u5BF9\u8BDD\u5931\u8D25\uFF1A\u8FD0\u884C\u65F6\u7684\u767B\u5F55\u5DF2\u8FC7\u671F\u6216\u51ED\u8BC1\u65E0\u6548\uFF0C\u8C03\u7528\u4E0D\u4E86\u6A21\u578B\u3002\u8BF7\u8282\u70B9\u7BA1\u7406\u5458\u5728\u90A3\u53F0\u673A\u5668\u4E0A\u91CD\u65B0\u767B\u5F55\u8FD9\u4E2A\u8FD0\u884C\u65F6\uFF08\u6216\u66F4\u65B0 API Key\uFF09\u540E\u518D\u53D1\u4E00\u6B21\uFF1B\u7740\u6025\u7684\u8BDD\u4E5F\u53EF\u4EE5${chatRebindHint("\u6362\u4E00\u4E2A\u53EF\u7528\u7684\u8FD0\u884C\u65F6")}\u3002`;
|
|
201131
201309
|
case "quota": {
|
|
201132
|
-
const
|
|
201133
|
-
return `\u5BF9\u8BDD\u5931\u8D25\uFF1A\u6A21\u578B\u989D\u5EA6\u5DF2\u7528\u5B8C${
|
|
201310
|
+
const at2 = resetTime(ctx.line);
|
|
201311
|
+
return `\u5BF9\u8BDD\u5931\u8D25\uFF1A\u6A21\u578B\u989D\u5EA6\u5DF2\u7528\u5B8C${at2 ? `\uFF0C\u9884\u8BA1 ${at2} \u6062\u590D` : ""}\u3002\u8BF7\u7B49\u989D\u5EA6\u6062\u590D\u540E\u518D\u53D1\u4E00\u6B21\uFF1B\u7740\u6025\u7684\u8BDD\u53EF\u4EE5${chatRebindHint("\u6362\u4E00\u4E2A\u989D\u5EA6\u5145\u8DB3\u7684\u8FD0\u884C\u65F6")}\u3002`;
|
|
201134
201312
|
}
|
|
201135
201313
|
case "rate-limit":
|
|
201136
201314
|
return "\u5BF9\u8BDD\u5931\u8D25\uFF1A\u6A21\u578B\u670D\u52A1\u6682\u65F6\u9650\u6D41\u6216\u7E41\u5FD9\u3002\u8BF7\u7B49\u4E00\u4E24\u5206\u949F\u518D\u53D1\u4E00\u6B21\u3002";
|
|
@@ -202369,10 +202547,10 @@ var init_service3 = __esm({
|
|
|
202369
202547
|
failureKind2 = exitReasonOf(err) === "timeout" ? "timeout" : "interrupted";
|
|
202370
202548
|
error2 = err instanceof Error ? err.message : String(err);
|
|
202371
202549
|
}
|
|
202372
|
-
const
|
|
202550
|
+
const at2 = this.now();
|
|
202373
202551
|
await turns?.settleTurn(turnId, {
|
|
202374
202552
|
status: failureKind2 ? "failed" : "succeeded",
|
|
202375
|
-
completedAt:
|
|
202553
|
+
completedAt: at2,
|
|
202376
202554
|
...error2 ? { lastError: error2 } : {}
|
|
202377
202555
|
}).catch(() => void 0);
|
|
202378
202556
|
const store = await this.options.resolveStore(companyId).catch(() => null);
|
|
@@ -202388,7 +202566,7 @@ var init_service3 = __esm({
|
|
|
202388
202566
|
合成的那句话仍写进下面子会话的占位行(用户在子会话里要看到一句交代),
|
|
202389
202567
|
通告里空正文由 `delegationReturnText` 渲染成「(这一轮没有文本产出)」。 */
|
|
202390
202568
|
text: text7 || (failureKind2 && failureKind2 !== "timeout" ? roundFailureText(failureKind2, error2) : ""),
|
|
202391
|
-
at,
|
|
202569
|
+
at: at2,
|
|
202392
202570
|
// 本轮的键 = 派发这一轮时的 dispatchSeq(`record` 就是派发时那一份,轮次账本业务键也由它算)。
|
|
202393
202571
|
dispatchSeq: record9.dispatchSeq ?? 0
|
|
202394
202572
|
};
|
|
@@ -202399,7 +202577,7 @@ var init_service3 = __esm({
|
|
|
202399
202577
|
await chatStore?.updateMessage(childRoundMessageIds(fresh.childSessionId, round).placeholderId, {
|
|
202400
202578
|
content: text7 || (failureKind2 ? roundFailureText(failureKind2, error2) : ""),
|
|
202401
202579
|
status: failureKind2 ? "error" : "done",
|
|
202402
|
-
completedAt:
|
|
202580
|
+
completedAt: at2
|
|
202403
202581
|
}).catch(() => void 0);
|
|
202404
202582
|
if (pending > 0 && !stopLoss) {
|
|
202405
202583
|
await store.appendRoundSummary(fresh.id, newSummary, { consecutiveFails }).catch(() => null);
|
|
@@ -202415,7 +202593,7 @@ var init_service3 = __esm({
|
|
|
202415
202593
|
state: failureKind2 ? "failed" : "done",
|
|
202416
202594
|
failureKind: failureKind2 ?? null,
|
|
202417
202595
|
settledSeq: settledSeqAtRound,
|
|
202418
|
-
settledAt:
|
|
202596
|
+
settledAt: at2
|
|
202419
202597
|
}).catch(() => null);
|
|
202420
202598
|
if (settled) await this.notifySettled(settled, companyId);
|
|
202421
202599
|
}
|
|
@@ -202468,14 +202646,14 @@ var init_service3 = __esm({
|
|
|
202468
202646
|
const dispatchSeq = _DelegationService.dispatchSeqOfTurn(record9, opts?.turnId);
|
|
202469
202647
|
if (roundRecorded(record9.roundSummaries, dispatchSeq)) return record9;
|
|
202470
202648
|
if (opts?.outcome === "succeeded") return this.settleSucceededFromSweep(record9, dispatchSeq, companyId);
|
|
202471
|
-
const
|
|
202649
|
+
const at2 = this.now();
|
|
202472
202650
|
const settledSeqAtRound = record9.settledSeq + 1;
|
|
202473
202651
|
const timedOut = opts?.exitReason === "timeout";
|
|
202474
202652
|
const partialAnswer = timedOut ? await this.readChildRoundAnswer(record9, dispatchSeq + 1, companyId).catch(() => "") : "";
|
|
202475
202653
|
const newSummary = {
|
|
202476
202654
|
round: (record9.roundSummaries[record9.roundSummaries.length - 1]?.round ?? 0) + 1,
|
|
202477
202655
|
text: timedOut ? partialAnswer : `\u8FD9\u4E00\u8F6E\u88AB\u65F6\u949F\u95ED\u5408\uFF1A${reason}`,
|
|
202478
|
-
at,
|
|
202656
|
+
at: at2,
|
|
202479
202657
|
settledSeq: settledSeqAtRound,
|
|
202480
202658
|
dispatchSeq
|
|
202481
202659
|
};
|
|
@@ -202486,7 +202664,7 @@ var init_service3 = __esm({
|
|
|
202486
202664
|
failureKind: timedOut ? "timeout" : "interrupted",
|
|
202487
202665
|
consecutiveFails: record9.consecutiveFails + 1,
|
|
202488
202666
|
settledSeq: settledSeqAtRound,
|
|
202489
|
-
settledAt:
|
|
202667
|
+
settledAt: at2
|
|
202490
202668
|
}).catch(() => null);
|
|
202491
202669
|
if (settled) await this.notifySettled(settled, companyId);
|
|
202492
202670
|
return settled;
|
|
@@ -202529,13 +202707,13 @@ var init_service3 = __esm({
|
|
|
202529
202707
|
const store = await this.options.resolveStore(companyId).catch(() => null);
|
|
202530
202708
|
if (!store) return record9;
|
|
202531
202709
|
const thisRound = dispatchSeq + 1;
|
|
202532
|
-
const
|
|
202710
|
+
const at2 = this.now();
|
|
202533
202711
|
const text7 = await this.readChildRoundAnswer(record9, thisRound, companyId);
|
|
202534
202712
|
const settledSeqAtRound = record9.settledSeq + 1;
|
|
202535
202713
|
const newSummary = {
|
|
202536
202714
|
round: (record9.roundSummaries[record9.roundSummaries.length - 1]?.round ?? 0) + 1,
|
|
202537
202715
|
text: text7 || "\u8FD9\u4E00\u8F6E\u5DF2\u5B8C\u6210\uFF08\u6536\u5C3E\u65F6\u6B63\u6587\u6CA1\u8BFB\u5230\uFF0C\u4EA7\u7269\u4EE5\u5DE5\u4F5C\u533A\u91CC\u7684\u6587\u4EF6\u4E3A\u51C6\uFF09\u3002",
|
|
202538
|
-
at,
|
|
202716
|
+
at: at2,
|
|
202539
202717
|
settledSeq: settledSeqAtRound,
|
|
202540
202718
|
dispatchSeq
|
|
202541
202719
|
};
|
|
@@ -202543,7 +202721,7 @@ var init_service3 = __esm({
|
|
|
202543
202721
|
state: "done",
|
|
202544
202722
|
consecutiveFails: 0,
|
|
202545
202723
|
settledSeq: settledSeqAtRound,
|
|
202546
|
-
settledAt:
|
|
202724
|
+
settledAt: at2
|
|
202547
202725
|
}).catch(() => null);
|
|
202548
202726
|
if (settled) await this.notifySettled(settled, companyId);
|
|
202549
202727
|
return settled;
|
|
@@ -203152,14 +203330,14 @@ var init_store2 = __esm({
|
|
|
203152
203330
|
this.rows.set(id, next);
|
|
203153
203331
|
return this.clone(next);
|
|
203154
203332
|
}
|
|
203155
|
-
async claimDispatch(id,
|
|
203333
|
+
async claimDispatch(id, at2, opts) {
|
|
203156
203334
|
const current = this.rows.get(id);
|
|
203157
203335
|
if (!current) return null;
|
|
203158
203336
|
if (current.dispatchedAt) {
|
|
203159
203337
|
const reclaimable = !!opts?.reclaimBefore && current.state === "running" && !current.childRunId && current.dispatchedAt < opts.reclaimBefore;
|
|
203160
203338
|
if (!reclaimable) return null;
|
|
203161
203339
|
}
|
|
203162
|
-
const next = { ...this.clone(current), dispatchedAt:
|
|
203340
|
+
const next = { ...this.clone(current), dispatchedAt: at2 };
|
|
203163
203341
|
this.rows.set(id, next);
|
|
203164
203342
|
return this.clone(next);
|
|
203165
203343
|
}
|
|
@@ -203175,11 +203353,11 @@ var init_store2 = __esm({
|
|
|
203175
203353
|
async countPendingTouches(delegationId) {
|
|
203176
203354
|
return (await this.listTouches(delegationId, { pendingOnly: true })).length;
|
|
203177
203355
|
}
|
|
203178
|
-
async markTouchesConsumed(delegationId, messageIds,
|
|
203356
|
+
async markTouchesConsumed(delegationId, messageIds, at2) {
|
|
203179
203357
|
for (const messageId of messageIds) {
|
|
203180
203358
|
const key2 = touchKey(delegationId, messageId);
|
|
203181
203359
|
const t = this.touches.get(key2);
|
|
203182
|
-
if (t && !t.consumedAt) this.touches.set(key2, { ...t, consumedAt:
|
|
203360
|
+
if (t && !t.consumedAt) this.touches.set(key2, { ...t, consumedAt: at2 });
|
|
203183
203361
|
}
|
|
203184
203362
|
}
|
|
203185
203363
|
/**
|
|
@@ -203259,8 +203437,8 @@ var init_store2 = __esm({
|
|
|
203259
203437
|
if (r) this.save();
|
|
203260
203438
|
return r;
|
|
203261
203439
|
}
|
|
203262
|
-
async claimDispatch(id,
|
|
203263
|
-
const r = await super.claimDispatch(id,
|
|
203440
|
+
async claimDispatch(id, at2, opts) {
|
|
203441
|
+
const r = await super.claimDispatch(id, at2, opts);
|
|
203264
203442
|
if (r) this.save();
|
|
203265
203443
|
return r;
|
|
203266
203444
|
}
|
|
@@ -203269,8 +203447,8 @@ var init_store2 = __esm({
|
|
|
203269
203447
|
if (r.inserted) this.save();
|
|
203270
203448
|
return r;
|
|
203271
203449
|
}
|
|
203272
|
-
async markTouchesConsumed(delegationId, messageIds,
|
|
203273
|
-
await super.markTouchesConsumed(delegationId, messageIds,
|
|
203450
|
+
async markTouchesConsumed(delegationId, messageIds, at2) {
|
|
203451
|
+
await super.markTouchesConsumed(delegationId, messageIds, at2);
|
|
203274
203452
|
this.save();
|
|
203275
203453
|
}
|
|
203276
203454
|
async appendRoundFiles(id, round, files) {
|
|
@@ -205744,8 +205922,8 @@ function retryAfterMs(response, now) {
|
|
|
205744
205922
|
if (!raw) return void 0;
|
|
205745
205923
|
const seconds = Number(raw);
|
|
205746
205924
|
if (Number.isFinite(seconds) && seconds >= 0) return Math.ceil(seconds * 1e3);
|
|
205747
|
-
const
|
|
205748
|
-
return Number.isFinite(
|
|
205925
|
+
const at2 = Date.parse(raw);
|
|
205926
|
+
return Number.isFinite(at2) ? Math.max(0, at2 - now) : void 0;
|
|
205749
205927
|
}
|
|
205750
205928
|
async function enqueueWrite(key2, intervalMs, now, sleep6, signal, operation) {
|
|
205751
205929
|
const coordinator = writeCoordinators.get(key2) ?? { tail: Promise.resolve(), nextAvailableAt: 0 };
|
|
@@ -208459,6 +208637,24 @@ async function loadWorkorderSnapshot(kernel, workorderId) {
|
|
|
208459
208637
|
if (!store) return null;
|
|
208460
208638
|
return store.transaction((tx) => tx.loadWorkorder(workorderId));
|
|
208461
208639
|
}
|
|
208640
|
+
async function escalationChatContextFor(kernel, registry2, session) {
|
|
208641
|
+
const escalationId = session?.escalationId?.trim();
|
|
208642
|
+
const workspace = session?.workspace?.trim();
|
|
208643
|
+
if (!escalationId || !workspace) return void 0;
|
|
208644
|
+
try {
|
|
208645
|
+
const snap = await loadWorkorderSnapshot(kernel, workspace);
|
|
208646
|
+
if (!snap) return void 0;
|
|
208647
|
+
const resolve11 = await draftActorResolver(registry2);
|
|
208648
|
+
const ref2 = (id) => {
|
|
208649
|
+
const extra = resolve11?.(id);
|
|
208650
|
+
return { id, ...extra?.name ? { name: extra.name } : {}, ...extra?.role ? { role: extra.role } : {} };
|
|
208651
|
+
};
|
|
208652
|
+
return buildEscalationChatContext({ snap, escalationId, ref: ref2 }) ?? void 0;
|
|
208653
|
+
} catch (err) {
|
|
208654
|
+
console.warn(`[escalation-context] \u4E0A\u62A5\u4E0A\u4E0B\u6587\u672A\u751F\u6210 escalation=${escalationId}: ${String(err)}`);
|
|
208655
|
+
return void 0;
|
|
208656
|
+
}
|
|
208657
|
+
}
|
|
208462
208658
|
function wantsChatParts(req) {
|
|
208463
208659
|
const accept = req.headers.accept;
|
|
208464
208660
|
return typeof accept === "string" && accept.includes("application/x-ndjson");
|
|
@@ -209741,11 +209937,11 @@ async function runView(kernel, oplog, engineStore, blobs, name, artifactId, para
|
|
|
209741
209937
|
if (w2.rejectedReason) rejectionByRevision.set(w2.id, w2.rejectedReason);
|
|
209742
209938
|
}
|
|
209743
209939
|
for (const a of snap?.artifacts ?? []) {
|
|
209744
|
-
const
|
|
209745
|
-
if (!
|
|
209940
|
+
const at2 = a.contentEditedAt;
|
|
209941
|
+
if (!at2) continue;
|
|
209746
209942
|
const workId = a.workId;
|
|
209747
209943
|
const prev = contentEditedByRevision.get(workId);
|
|
209748
|
-
if (!prev ||
|
|
209944
|
+
if (!prev || at2 > prev) contentEditedByRevision.set(workId, at2);
|
|
209749
209945
|
}
|
|
209750
209946
|
}
|
|
209751
209947
|
const revisionViews = revisions.map((rev) => ({
|
|
@@ -209920,7 +210116,7 @@ async function runView(kernel, oplog, engineStore, blobs, name, artifactId, para
|
|
|
209920
210116
|
if (isEmptyContent(headRev.contentKind)) {
|
|
209921
210117
|
return { kind: "empty" };
|
|
209922
210118
|
}
|
|
209923
|
-
const
|
|
210119
|
+
const at2 = {
|
|
209924
210120
|
artifactId: artifactId2,
|
|
209925
210121
|
revisionId: targetId,
|
|
209926
210122
|
isCurrentHead: targetId === artifact.currentRev,
|
|
@@ -209929,7 +210125,7 @@ async function runView(kernel, oplog, engineStore, blobs, name, artifactId, para
|
|
|
209929
210125
|
author: headRev.author
|
|
209930
210126
|
};
|
|
209931
210127
|
if (headRev.contentKind === "external-pin") {
|
|
209932
|
-
return { kind: "external-pin", ref: headRev.contentRef, at };
|
|
210128
|
+
return { kind: "external-pin", ref: headRev.contentRef, at: at2 };
|
|
209933
210129
|
}
|
|
209934
210130
|
const dec2 = new TextDecoder();
|
|
209935
210131
|
if (headRev.contentKind === "manifest") {
|
|
@@ -209938,15 +210134,15 @@ async function runView(kernel, oplog, engineStore, blobs, name, artifactId, para
|
|
|
209938
210134
|
const e = entries.find((x2) => x2.path === path44);
|
|
209939
210135
|
if (!e) throw new Error(`\u6587\u4EF6\u4E0D\u5B58\u5728: ${path44}\uFF08\u8BE5\u7248\u672C\u6709\uFF1A${entries.map((x2) => x2.path).join("\u3001")}\uFF09`);
|
|
209940
210136
|
const isText = !e.bytes.includes(0);
|
|
209941
|
-
return { kind: "file", path: path44, bytes: e.bytes.length, text: isText ? dec2.decode(e.bytes) : null, at };
|
|
210137
|
+
return { kind: "file", path: path44, bytes: e.bytes.length, text: isText ? dec2.decode(e.bytes) : null, at: at2 };
|
|
209942
210138
|
}
|
|
209943
210139
|
return {
|
|
209944
210140
|
kind: "manifest",
|
|
209945
210141
|
files: entries.map((e) => ({ path: e.path, bytes: e.bytes.length, binary: e.bytes.includes(0) })),
|
|
209946
|
-
at
|
|
210142
|
+
at: at2
|
|
209947
210143
|
};
|
|
209948
210144
|
}
|
|
209949
|
-
return { kind: "text", text: dec2.decode(await blobs.get(headRev.contentRef)), at };
|
|
210145
|
+
return { kind: "text", text: dec2.decode(await blobs.get(headRev.contentRef)), at: at2 };
|
|
209950
210146
|
}
|
|
209951
210147
|
case "queue": {
|
|
209952
210148
|
const id = need2();
|
|
@@ -210160,7 +210356,6 @@ async function startOasisServer(opts) {
|
|
|
210160
210356
|
return { accepted: r.accepted, ...r.reason ? { reason: r.reason } : {}, queued: r.queued, insertStatus: r.insertStatus };
|
|
210161
210357
|
};
|
|
210162
210358
|
const GRAPH_EDIT_SUMMARY_MAX = 60;
|
|
210163
|
-
const NEUTRAL_APPROVER = "\u8D1F\u8D23\u4EBA";
|
|
210164
210359
|
const truncateSummary = (s2) => {
|
|
210165
210360
|
const cps = [...s2];
|
|
210166
210361
|
return cps.length > GRAPH_EDIT_SUMMARY_MAX ? `${cps.slice(0, GRAPH_EDIT_SUMMARY_MAX).join("")}\u2026` : s2;
|
|
@@ -211602,7 +211797,7 @@ async function startOasisServer(opts) {
|
|
|
211602
211797
|
const receipt = authorizedCommandReceipt(command2, review.command.args, actor, commandCardRefsOf(engine.kernel.model));
|
|
211603
211798
|
notifyReviewResolved(
|
|
211604
211799
|
draftId,
|
|
211605
|
-
{ status: "approved", command: command2, effectLabel: review.command.effectLabel, authorizedBy: actor, receipt },
|
|
211800
|
+
{ status: "approved", command: command2, effectLabel: review.command.effectLabel, authorizedBy: actor, ...authorizedByName ? { authorizedByName } : {}, receipt },
|
|
211606
211801
|
{
|
|
211607
211802
|
origin: review.origin,
|
|
211608
211803
|
kind: "command",
|
|
@@ -211628,7 +211823,7 @@ async function startOasisServer(opts) {
|
|
|
211628
211823
|
const result = await engine.kernel.applyIntervention(plan, fresh.baseSeqs, actor);
|
|
211629
211824
|
notifyReviewResolved(
|
|
211630
211825
|
draftId,
|
|
211631
|
-
{ status: "approved", command: "", effectLabel: review.plan.reason, authorizedBy: actor },
|
|
211826
|
+
{ status: "approved", command: "", effectLabel: review.plan.reason, authorizedBy: actor, ...authorizedByName ? { authorizedByName } : {} },
|
|
211632
211827
|
// 状态条要的两样也得进 resume 上下文(不能只放在 resolution 里):`effectLabel` 是改图卡的
|
|
211633
211828
|
// 「改动摘要」(= plan.reason,见 diagnosis 口径 1),`authorizedBy` 是「谁批的」。
|
|
211634
211829
|
{ origin: review.origin, kind: review.kind ?? "graph-edit", authorizedBy: actor, ...authorizedByName ? { authorizedByName } : {}, effectLabel: review.plan.reason },
|
|
@@ -212200,6 +212395,29 @@ async function startOasisServer(opts) {
|
|
|
212200
212395
|
const origin = url.searchParams.get("origin");
|
|
212201
212396
|
const workspace = url.searchParams.get("workspace") ?? void 0;
|
|
212202
212397
|
const reviews = listPendingReviews(engine.kernel.model, origin === null ? workspace : void 0).filter((r) => origin === null ? true : r.origin === origin).filter((r) => !r.continuation || r.continuation.approverActorId === actor);
|
|
212398
|
+
const draftActorIds = /* @__PURE__ */ new Set();
|
|
212399
|
+
for (const r of reviews) {
|
|
212400
|
+
for (const op of r.plan.ops ?? []) {
|
|
212401
|
+
const owner = op.owner;
|
|
212402
|
+
if (typeof owner === "string" && owner) draftActorIds.add(owner);
|
|
212403
|
+
}
|
|
212404
|
+
for (const pr of r.priorRejections ?? []) {
|
|
212405
|
+
if (pr.rejectedBy) draftActorIds.add(pr.rejectedBy);
|
|
212406
|
+
}
|
|
212407
|
+
}
|
|
212408
|
+
const draftActorNames = /* @__PURE__ */ new Map();
|
|
212409
|
+
if (draftActorIds.size > 0) {
|
|
212410
|
+
const reg = engine.registry ?? opts.registry;
|
|
212411
|
+
await Promise.all([...draftActorIds].map(async (id) => {
|
|
212412
|
+
const name = (await reg?.getActor(id).catch(() => null))?.name?.trim();
|
|
212413
|
+
if (name) draftActorNames.set(id, name);
|
|
212414
|
+
}));
|
|
212415
|
+
}
|
|
212416
|
+
const draftRefs = {
|
|
212417
|
+
...commandCardRefsOf(engine.kernel.model),
|
|
212418
|
+
actorName: (id) => draftActorNames.get(id)
|
|
212419
|
+
};
|
|
212420
|
+
const displayOpsOf = (ops) => (ops ?? []).map((op) => graphEditOpDisplayLabel(op, draftRefs));
|
|
212203
212421
|
const data2 = reviews.map((r) => ({
|
|
212204
212422
|
id: r.draftId,
|
|
212205
212423
|
plan: r.plan,
|
|
@@ -212219,8 +212437,17 @@ async function startOasisServer(opts) {
|
|
|
212219
212437
|
...r.kind !== void 0 ? { kind: r.kind } : {},
|
|
212220
212438
|
...r.command !== void 0 ? { command: r.command } : {},
|
|
212221
212439
|
...r.continuation ? { continuation: r.continuation } : {},
|
|
212440
|
+
// Bug 0238:改图卡列的那几行 op,按名字现拼给前端(`plan.ops` 原样保留给 agent 面)。
|
|
212441
|
+
displayOps: displayOpsOf(r.plan.ops),
|
|
212222
212442
|
// ADR 0569 D4:显式重提的卡带着此前的驳回记录,前端在卡上列给审批人看。
|
|
212223
|
-
|
|
212443
|
+
// 同样补名字:`rejectedByName` 是「谁驳的」,`displayOps` 是「当时的改动」那几行。
|
|
212444
|
+
...r.priorRejections && r.priorRejections.length > 0 ? {
|
|
212445
|
+
priorRejections: r.priorRejections.map((pr) => ({
|
|
212446
|
+
...pr,
|
|
212447
|
+
...draftActorNames.get(pr.rejectedBy) ? { rejectedByName: draftActorNames.get(pr.rejectedBy) } : {},
|
|
212448
|
+
displayOps: displayOpsOf(pr.ops)
|
|
212449
|
+
}))
|
|
212450
|
+
} : {}
|
|
212224
212451
|
}));
|
|
212225
212452
|
res.writeHead(200, { "content-type": "application/json" }).end(JSON.stringify({ data: data2 }));
|
|
212226
212453
|
return;
|
|
@@ -212766,6 +212993,11 @@ async function startOasisServer(opts) {
|
|
|
212766
212993
|
}
|
|
212767
212994
|
heldTurn = opened.turn;
|
|
212768
212995
|
}
|
|
212996
|
+
const escalationContext = await escalationChatContextFor(
|
|
212997
|
+
engine.kernel,
|
|
212998
|
+
engine.registry ?? opts.registry,
|
|
212999
|
+
persistTarget
|
|
213000
|
+
);
|
|
212769
213001
|
let plan;
|
|
212770
213002
|
try {
|
|
212771
213003
|
plan = persistTarget && chatStore ? await planChatContinuation({
|
|
@@ -212774,7 +213006,8 @@ async function startOasisServer(opts) {
|
|
|
212774
213006
|
listMessages: (sid, limit) => chatStore.listMessages(sid, limit),
|
|
212775
213007
|
// ADR 0604:认**本轮真正会跑的那个**,不认员工 binding(见 effectiveChatTarget 那段)。
|
|
212776
213008
|
currentRuntime: effectiveChatTarget,
|
|
212777
|
-
...draftWorkspace ? { draftWorkspace } : {}
|
|
213009
|
+
...draftWorkspace ? { draftWorkspace } : {},
|
|
213010
|
+
...escalationContext ? { escalationContext } : {}
|
|
212778
213011
|
}) : null;
|
|
212779
213012
|
} catch (err) {
|
|
212780
213013
|
await heldTurn?.settle({
|
|
@@ -214557,13 +214790,13 @@ function chatSubmissionExistsMessage(state, retryable) {
|
|
|
214557
214790
|
}
|
|
214558
214791
|
function clampSubmittedAt(value2, notBefore) {
|
|
214559
214792
|
if (typeof value2 !== "string") return void 0;
|
|
214560
|
-
const
|
|
214561
|
-
if (!Number.isFinite(
|
|
214793
|
+
const at2 = Date.parse(value2);
|
|
214794
|
+
if (!Number.isFinite(at2)) return void 0;
|
|
214562
214795
|
const now = Date.now();
|
|
214563
|
-
if (
|
|
214796
|
+
if (at2 > now || now - at2 > 30 * 24 * 60 * 60 * 1e3) return void 0;
|
|
214564
214797
|
const floor = notBefore ? Date.parse(notBefore) : NaN;
|
|
214565
|
-
if (Number.isFinite(floor) &&
|
|
214566
|
-
return new Date(
|
|
214798
|
+
if (Number.isFinite(floor) && at2 < floor) return void 0;
|
|
214799
|
+
return new Date(at2).toISOString();
|
|
214567
214800
|
}
|
|
214568
214801
|
async function legacySupersedes(items, sessionId, row) {
|
|
214569
214802
|
if (!items || !row.turnId) return {};
|
|
@@ -214635,6 +214868,7 @@ var init_server3 = __esm({
|
|
|
214635
214868
|
init_workorder_detail();
|
|
214636
214869
|
init_workorders();
|
|
214637
214870
|
init_discuss();
|
|
214871
|
+
init_escalation_chat_context();
|
|
214638
214872
|
init_escalation_recipient();
|
|
214639
214873
|
init_planner();
|
|
214640
214874
|
init_chat_parts();
|
|
@@ -215791,13 +216025,13 @@ var init_memory_assistant_store = __esm({
|
|
|
215791
216025
|
async backfillAllHumansOn(humanIds, byActor2) {
|
|
215792
216026
|
let inserted = 0;
|
|
215793
216027
|
let skipped = 0;
|
|
215794
|
-
const
|
|
216028
|
+
const at2 = (/* @__PURE__ */ new Date()).toISOString();
|
|
215795
216029
|
for (const id of humanIds) {
|
|
215796
216030
|
if (this.prefs.has(id)) {
|
|
215797
216031
|
skipped++;
|
|
215798
216032
|
continue;
|
|
215799
216033
|
}
|
|
215800
|
-
this.prefs.set(id, { humanActorId: id, autoAssignAssistant: true, updatedAt:
|
|
216034
|
+
this.prefs.set(id, { humanActorId: id, autoAssignAssistant: true, updatedAt: at2, updatedBy: byActor2 });
|
|
215801
216035
|
inserted++;
|
|
215802
216036
|
}
|
|
215803
216037
|
return { inserted, skipped };
|
|
@@ -216133,10 +216367,10 @@ var init_memory_trace_store = __esm({
|
|
|
216133
216367
|
}
|
|
216134
216368
|
/* ---------- 用量账本(与 PostgresTraceStore 同语义)---------- */
|
|
216135
216369
|
/** 先写者生效;run 不存在返回 false。与 PG 一样不动 updatedAt。 */
|
|
216136
|
-
async markRuntimeStarted(runId,
|
|
216370
|
+
async markRuntimeStarted(runId, at2) {
|
|
216137
216371
|
const run = this.runs.get(runId);
|
|
216138
216372
|
if (!run || run.runtimeStartedAt != null) return false;
|
|
216139
|
-
this.runs.set(runId, { ...run, runtimeStartedAt:
|
|
216373
|
+
this.runs.set(runId, { ...run, runtimeStartedAt: at2 });
|
|
216140
216374
|
return true;
|
|
216141
216375
|
}
|
|
216142
216376
|
/** checkpoint 重放吸收;final 覆盖终值位;backfill 不覆盖已有终值点。 */
|
|
@@ -216942,8 +217176,8 @@ var init_memory_automation_store = __esm({
|
|
|
216942
217176
|
this.automations.set(id, structuredClone(merged));
|
|
216943
217177
|
return structuredClone(merged);
|
|
216944
217178
|
}
|
|
216945
|
-
async archiveAutomation(id,
|
|
216946
|
-
return this.updateAutomation(id, { archivedAt:
|
|
217179
|
+
async archiveAutomation(id, at2) {
|
|
217180
|
+
return this.updateAutomation(id, { archivedAt: at2 });
|
|
216947
217181
|
}
|
|
216948
217182
|
async pauseIfEnabled(id, reason) {
|
|
216949
217183
|
const a = this.automations.get(id);
|
|
@@ -217532,20 +217766,20 @@ var init_memory_control_plane_store = __esm({
|
|
|
217532
217766
|
async listAgentCredentials(companyId) {
|
|
217533
217767
|
return [...this.agentCredentials.values()].filter((c) => c.companyId === companyId).map((c) => ({ ...c })).sort((a, b2) => a.actorId < b2.actorId ? -1 : a.actorId > b2.actorId ? 1 : 0);
|
|
217534
217768
|
}
|
|
217535
|
-
async revokeAgentCredential(companyId, actorId,
|
|
217769
|
+
async revokeAgentCredential(companyId, actorId, at2) {
|
|
217536
217770
|
const key2 = scopedKey(companyId, actorId);
|
|
217537
217771
|
const c = this.agentCredentials.get(key2);
|
|
217538
217772
|
if (!c) return false;
|
|
217539
|
-
this.agentCredentials.set(key2, { ...c, status: "revoked", revokedAt:
|
|
217773
|
+
this.agentCredentials.set(key2, { ...c, status: "revoked", revokedAt: at2 });
|
|
217540
217774
|
return true;
|
|
217541
217775
|
}
|
|
217542
|
-
async touchAgentCredential(tokenHash,
|
|
217776
|
+
async touchAgentCredential(tokenHash, at2) {
|
|
217543
217777
|
const ref2 = this.credentialsByHash.get(tokenHash);
|
|
217544
217778
|
if (!ref2) return;
|
|
217545
217779
|
const key2 = scopedKey(ref2.companyId, ref2.actorId);
|
|
217546
217780
|
const c = this.agentCredentials.get(key2);
|
|
217547
217781
|
if (!c || c.tokenHash !== tokenHash) return;
|
|
217548
|
-
this.agentCredentials.set(key2, { ...c, lastUsedAt:
|
|
217782
|
+
this.agentCredentials.set(key2, { ...c, lastUsedAt: at2 });
|
|
217549
217783
|
}
|
|
217550
217784
|
// —— principal_bridge ——
|
|
217551
217785
|
async putPrincipalBridge(row) {
|
|
@@ -217582,7 +217816,7 @@ var init_memory_control_plane_store = __esm({
|
|
|
217582
217816
|
}
|
|
217583
217817
|
return null;
|
|
217584
217818
|
}
|
|
217585
|
-
async updateMemberOffboardingIfVersion(companyId, operationId, expectedVersion, patch,
|
|
217819
|
+
async updateMemberOffboardingIfVersion(companyId, operationId, expectedVersion, patch, at2) {
|
|
217586
217820
|
const key2 = scopedKey(companyId, operationId);
|
|
217587
217821
|
const cur = this.offboardings.get(key2);
|
|
217588
217822
|
if (!cur) return { ok: false, reason: "not_found" };
|
|
@@ -217595,7 +217829,7 @@ var init_memory_control_plane_store = __esm({
|
|
|
217595
217829
|
...patch.ownedAgents !== void 0 ? { ownedAgents: [...patch.ownedAgents] } : {},
|
|
217596
217830
|
...patch.inFlightAssignments !== void 0 ? { inFlightAssignments: patch.inFlightAssignments.map((a) => ({ ...a })) } : {},
|
|
217597
217831
|
version: cur.version + 1,
|
|
217598
|
-
updatedAt:
|
|
217832
|
+
updatedAt: at2
|
|
217599
217833
|
};
|
|
217600
217834
|
if (patch.error === null) delete next.error;
|
|
217601
217835
|
else if (patch.error !== void 0) next.error = patch.error;
|
|
@@ -221098,8 +221332,8 @@ var init_dev_store = __esm({
|
|
|
221098
221332
|
setState(chatSessionId, ids2, state, reason) {
|
|
221099
221333
|
const list2 = this.pending.get(chatSessionId);
|
|
221100
221334
|
if (!list2) return;
|
|
221101
|
-
const
|
|
221102
|
-
this.pending.set(chatSessionId, list2.map((x2) => ids2.has(x2.id) ? { ...x2, state, stateAt:
|
|
221335
|
+
const at2 = (/* @__PURE__ */ new Date()).toISOString();
|
|
221336
|
+
this.pending.set(chatSessionId, list2.map((x2) => ids2.has(x2.id) ? { ...x2, state, stateAt: at2, ...reason ? { stateReason: reason } : {} } : x2));
|
|
221103
221337
|
}
|
|
221104
221338
|
/** 撤回 = 迁到 cancelled。**不硬删**——删了轨迹就断了。 */
|
|
221105
221339
|
async removePendingMessage(chatSessionId, id) {
|
|
@@ -221154,12 +221388,12 @@ var init_dev_store = __esm({
|
|
|
221154
221388
|
return true;
|
|
221155
221389
|
}).sort((a, b2) => a.seq - b2.seq);
|
|
221156
221390
|
const claimedIds = new Set(claimed.map((x2) => x2.id));
|
|
221157
|
-
const
|
|
221391
|
+
const at2 = (/* @__PURE__ */ new Date()).toISOString();
|
|
221158
221392
|
const list2 = this.pending.get(chatSessionId);
|
|
221159
221393
|
if (list2) {
|
|
221160
|
-
this.pending.set(chatSessionId, list2.map((x2) => claimedIds.has(x2.id) ? { ...x2, state: "delivering", stateAt:
|
|
221394
|
+
this.pending.set(chatSessionId, list2.map((x2) => claimedIds.has(x2.id) ? { ...x2, state: "delivering", stateAt: at2, stateReason: x2.stateReason === "register-pending" ? "register-pending" : owner } : x2));
|
|
221161
221395
|
}
|
|
221162
|
-
return claimed.map((x2) => ({ ...x2, state: "delivering", stateAt:
|
|
221396
|
+
return claimed.map((x2) => ({ ...x2, state: "delivering", stateAt: at2, stateReason: x2.stateReason === "register-pending" ? "register-pending" : owner }));
|
|
221163
221397
|
}
|
|
221164
221398
|
/**
|
|
221165
221399
|
* 列出这条 source 已在队列责任范围内的 `sourceMessageId`(评审阻断③;Rework r4 并入 delivered)。
|
|
@@ -221318,9 +221552,9 @@ var init_dev_store = __esm({
|
|
|
221318
221552
|
return out;
|
|
221319
221553
|
}
|
|
221320
221554
|
/** 单调:第一次投递成功那一刻才是事实,重复调用不把时间往后推(同 PG 版的 `IS NULL` 闸)。 */
|
|
221321
|
-
async markMessageDeliveredToAgent(messageId,
|
|
221555
|
+
async markMessageDeliveredToAgent(messageId, at2) {
|
|
221322
221556
|
const hit = this.findById(messageId);
|
|
221323
|
-
if (hit && !hit.deliveredToAgentAt) hit.deliveredToAgentAt =
|
|
221557
|
+
if (hit && !hit.deliveredToAgentAt) hit.deliveredToAgentAt = at2 ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
221324
221558
|
}
|
|
221325
221559
|
/** 与 PG 版同口径:**公司过滤排在分页之前**(先分页再筛公司会让本公司读到空,积压查询假绿)。 */
|
|
221326
221560
|
pendingRows(opts) {
|
|
@@ -221568,8 +221802,8 @@ var init_dev_store = __esm({
|
|
|
221568
221802
|
}
|
|
221569
221803
|
// 送达标记也要落盘:它是「还没送到 agent」这条待补投队列的唯一事实来源,
|
|
221570
221804
|
// 只活在内存里的话 serve 一重启就会把已经送到的又送一遍。
|
|
221571
|
-
async markMessageDeliveredToAgent(messageId,
|
|
221572
|
-
await super.markMessageDeliveredToAgent(messageId,
|
|
221805
|
+
async markMessageDeliveredToAgent(messageId, at2) {
|
|
221806
|
+
await super.markMessageDeliveredToAgent(messageId, at2);
|
|
221573
221807
|
this.save();
|
|
221574
221808
|
}
|
|
221575
221809
|
save() {
|
|
@@ -222241,7 +222475,7 @@ var init_company_scoped_registry = __esm({
|
|
|
222241
222475
|
throw new Error(`actor ${a.id} \u5DF2\u5C5E\u4E8E\u516C\u53F8 ${existing.companyId}\uFF0C\u4E0D\u80FD\u5728 ${this.companyId} \u4E0B\u91CD\u590D\u767B\u8BB0`);
|
|
222242
222476
|
}
|
|
222243
222477
|
await this.base.upsertActor(a);
|
|
222244
|
-
const
|
|
222478
|
+
const at2 = this.now();
|
|
222245
222479
|
const prev = existing?.employee;
|
|
222246
222480
|
await this.org.upsertDigitalEmployee({
|
|
222247
222481
|
id: a.id,
|
|
@@ -222259,15 +222493,15 @@ var init_company_scoped_registry = __esm({
|
|
|
222259
222493
|
...prev?.model !== void 0 ? { model: prev.model } : {},
|
|
222260
222494
|
config: prev?.config ?? {},
|
|
222261
222495
|
status: employeeStatusOf(a.status),
|
|
222262
|
-
createdAt: prev?.createdAt ?? a.createdAt ??
|
|
222263
|
-
updatedAt:
|
|
222496
|
+
createdAt: prev?.createdAt ?? a.createdAt ?? at2,
|
|
222497
|
+
updatedAt: at2
|
|
222264
222498
|
});
|
|
222265
222499
|
await this.org.putPrincipalBridge({
|
|
222266
222500
|
companyId: this.companyId,
|
|
222267
222501
|
principalType: "agent",
|
|
222268
222502
|
principalId: a.id,
|
|
222269
222503
|
agentId: a.id,
|
|
222270
|
-
createdAt:
|
|
222504
|
+
createdAt: at2
|
|
222271
222505
|
});
|
|
222272
222506
|
return;
|
|
222273
222507
|
}
|
|
@@ -222971,7 +223205,7 @@ async function backfillOrgModel(control, registry2, opts = {}) {
|
|
|
222971
223205
|
continue;
|
|
222972
223206
|
}
|
|
222973
223207
|
if (opts.companyId && decided !== opts.companyId) continue;
|
|
222974
|
-
const
|
|
223208
|
+
const at2 = now();
|
|
222975
223209
|
if (!dryRun) {
|
|
222976
223210
|
await control.upsertDigitalEmployee({
|
|
222977
223211
|
id: a.id,
|
|
@@ -222988,10 +223222,10 @@ async function backfillOrgModel(control, registry2, opts = {}) {
|
|
|
222988
223222
|
tags: a.tags ?? [],
|
|
222989
223223
|
config: {},
|
|
222990
223224
|
status: a.status === "disabled" ? "left" : "active",
|
|
222991
|
-
createdAt: a.createdAt ??
|
|
222992
|
-
updatedAt:
|
|
223225
|
+
createdAt: a.createdAt ?? at2,
|
|
223226
|
+
updatedAt: at2
|
|
222993
223227
|
});
|
|
222994
|
-
await control.putPrincipalBridge({ companyId: decided, principalType: "agent", principalId: a.id, agentId: a.id, createdAt:
|
|
223228
|
+
await control.putPrincipalBridge({ companyId: decided, principalType: "agent", principalId: a.id, agentId: a.id, createdAt: at2 });
|
|
222995
223229
|
}
|
|
222996
223230
|
employees += 1;
|
|
222997
223231
|
bridges += 1;
|
|
@@ -223704,16 +223938,16 @@ function createLivenessProbe(store) {
|
|
|
223704
223938
|
const cur = cursors.get(sessionId);
|
|
223705
223939
|
const events = await store.listEvents(sessionId, cur ? { afterSeq: cur.seq, limit: 500 } : {});
|
|
223706
223940
|
let seq = cur?.seq ?? 0;
|
|
223707
|
-
let
|
|
223941
|
+
let at2 = cur?.at ?? null;
|
|
223708
223942
|
for (const e of events) {
|
|
223709
223943
|
if (e.seq > seq) {
|
|
223710
223944
|
seq = e.seq;
|
|
223711
|
-
|
|
223945
|
+
at2 = e.createdAt;
|
|
223712
223946
|
}
|
|
223713
223947
|
}
|
|
223714
|
-
if (events.length) cursors.set(sessionId, { seq, at });
|
|
223948
|
+
if (events.length) cursors.set(sessionId, { seq, at: at2 });
|
|
223715
223949
|
const run = await store.getRun(sessionId);
|
|
223716
|
-
const lastEventAt = maxIso2(
|
|
223950
|
+
const lastEventAt = maxIso2(at2, run?.lastProgressAt ?? null);
|
|
223717
223951
|
const toolCalls = await store.listToolCalls(sessionId);
|
|
223718
223952
|
return { lastEventAt, openToolCall: toolCalls.some((t) => t.status === "running") };
|
|
223719
223953
|
},
|
|
@@ -224252,11 +224486,11 @@ function createApiActivityLedger() {
|
|
|
224252
224486
|
},
|
|
224253
224487
|
activeDispatchIds(nowMs, windowMs) {
|
|
224254
224488
|
const out = /* @__PURE__ */ new Set();
|
|
224255
|
-
for (const [id,
|
|
224489
|
+
for (const [id, at2] of lastSeen) if (nowMs - at2 <= windowMs) out.add(id);
|
|
224256
224490
|
return out;
|
|
224257
224491
|
},
|
|
224258
224492
|
prune(nowMs, keepMs) {
|
|
224259
|
-
for (const [id,
|
|
224493
|
+
for (const [id, at2] of lastSeen) if (nowMs - at2 > keepMs) lastSeen.delete(id);
|
|
224260
224494
|
},
|
|
224261
224495
|
size: () => lastSeen.size
|
|
224262
224496
|
};
|
|
@@ -224663,7 +224897,7 @@ var init_usage_ledger = __esm({
|
|
|
224663
224897
|
* 标记 run 的 runtime 启动时刻(先写者生效)。同一 run 并发的多帧合并成一次写。永不 reject。
|
|
224664
224898
|
* `store` 用回调给:解析公司账本本身可能要读库,已标过的 run 就不该再付这一次解析。
|
|
224665
224899
|
*/
|
|
224666
|
-
mark(runId,
|
|
224900
|
+
mark(runId, at2, store) {
|
|
224667
224901
|
if (this.settled.has(runId)) return Promise.resolve();
|
|
224668
224902
|
const running = this.inflight.get(runId);
|
|
224669
224903
|
if (running) return running;
|
|
@@ -224674,7 +224908,7 @@ var init_usage_ledger = __esm({
|
|
|
224674
224908
|
this.remember(runId);
|
|
224675
224909
|
return;
|
|
224676
224910
|
}
|
|
224677
|
-
const wrote = await s2.markRuntimeStarted(runId,
|
|
224911
|
+
const wrote = await s2.markRuntimeStarted(runId, at2);
|
|
224678
224912
|
if (wrote) {
|
|
224679
224913
|
this.remember(runId);
|
|
224680
224914
|
return;
|
|
@@ -233480,9 +233714,9 @@ function buildGapThread(input) {
|
|
|
233480
233714
|
const group = gapThreadGroups(input).find((g2) => g2.executorId === executorId);
|
|
233481
233715
|
if (!group) return null;
|
|
233482
233716
|
const { ref: ref2 } = input;
|
|
233483
|
-
const
|
|
233484
|
-
const executorName =
|
|
233485
|
-
const coordinatorName =
|
|
233717
|
+
const nameOf2 = (id) => ref2(id).name?.trim() || "\u2014";
|
|
233718
|
+
const executorName = nameOf2(group.executorId);
|
|
233719
|
+
const coordinatorName = nameOf2(group.coordinatorId);
|
|
233486
233720
|
const mention = (author) => author === group.executorId ? coordinatorName : executorName;
|
|
233487
233721
|
const bubble = (o) => ({
|
|
233488
233722
|
id: o.id,
|
|
@@ -233542,8 +233776,8 @@ function buildCommentThread(input) {
|
|
|
233542
233776
|
const repliesOf = /* @__PURE__ */ new Map();
|
|
233543
233777
|
for (const r of repliesAll) repliesOf.set(r.issueId, [...repliesOf.get(r.issueId) ?? [], r]);
|
|
233544
233778
|
const { ref: ref2 } = input;
|
|
233545
|
-
const
|
|
233546
|
-
const mention = (author) =>
|
|
233779
|
+
const nameOf2 = (id) => ref2(id).name?.trim() || "\u2014";
|
|
233780
|
+
const mention = (author) => nameOf2(author === a ? b2 : a);
|
|
233547
233781
|
const bubble = (o) => ({
|
|
233548
233782
|
id: o.id,
|
|
233549
233783
|
at: o.at,
|
|
@@ -233595,8 +233829,8 @@ function buildReviewThread(input) {
|
|
|
233595
233829
|
});
|
|
233596
233830
|
if (rows.length === 0) return null;
|
|
233597
233831
|
const { ref: ref2 } = input;
|
|
233598
|
-
const
|
|
233599
|
-
const mention = (author) =>
|
|
233832
|
+
const nameOf2 = (id) => ref2(id).name?.trim() || "\u2014";
|
|
233833
|
+
const mention = (author) => nameOf2(author === a ? b2 : a);
|
|
233600
233834
|
const bubble = (o) => ({
|
|
233601
233835
|
id: o.id,
|
|
233602
233836
|
at: o.at,
|
|
@@ -233851,11 +234085,6 @@ function coordinatorRunOfGap(gap, runs) {
|
|
|
233851
234085
|
const overlapping = runs.filter((r) => (!closesAt || r.startedAt <= closesAt) && (!r.endedAt || r.endedAt >= opensAt)).sort((a, b2) => a.startedAt.localeCompare(b2.startedAt) || a.id.localeCompare(b2.id));
|
|
233852
234086
|
return overlapping.find((r) => r.startedAt >= opensAt) ?? overlapping.at(-1);
|
|
233853
234087
|
}
|
|
233854
|
-
function escalationKindOf(issueId, authorActorId) {
|
|
233855
|
-
if (issueId.startsWith(RETRY_EXHAUSTED_ESC_PREFIX)) return "retry_exhausted";
|
|
233856
|
-
if (issueId.startsWith(REVIEW_EXHAUSTED_ESC_PREFIX2)) return "review_exhausted";
|
|
233857
|
-
return isSystemActorId(authorActorId) ? "output_stall" : "manual";
|
|
233858
|
-
}
|
|
233859
234088
|
function parseStopLossFacts(kind, body2) {
|
|
233860
234089
|
if (kind === "retry_exhausted") {
|
|
233861
234090
|
const n2 = /连续\s*(\d+)\s*次执行失败/.exec(body2)?.[1];
|
|
@@ -233928,8 +234157,8 @@ function buildWorkorderActivity(input) {
|
|
|
233928
234157
|
const isSystemAccept = (by) => !!by && by.startsWith("actor:system:");
|
|
233929
234158
|
const managerId = resolveWorkorderManager(snap);
|
|
233930
234159
|
const ownerId = snap.workorder.ownerActorId;
|
|
233931
|
-
const
|
|
233932
|
-
const managerName = () =>
|
|
234160
|
+
const nameOf2 = (id) => id ? ref2(id).name ?? id : "\u2014";
|
|
234161
|
+
const managerName = () => nameOf2(managerId);
|
|
233933
234162
|
const nodeName = (nodeId) => {
|
|
233934
234163
|
if (!nodeId) return "\u2014";
|
|
233935
234164
|
const t = nodeById.get(nodeId)?.title;
|
|
@@ -234161,7 +234390,7 @@ function buildWorkorderActivity(input) {
|
|
|
234161
234390
|
fold2.updatedAt = lastStampOf(w2);
|
|
234162
234391
|
fold2.stuckReason = w2.outcomeDetail?.reason === "timeout" ? "timeout" : "failed";
|
|
234163
234392
|
fold2.foldedRounds = (fold2.foldedRounds ?? 1) + 1;
|
|
234164
|
-
fold2.status = ACTIVITY_COPY.foldedFailures(
|
|
234393
|
+
fold2.status = ACTIVITY_COPY.foldedFailures(nameOf2(fold2.executorId), name, fold2.foldedRounds);
|
|
234165
234394
|
if (tripsHere.length) fold2.stopLossTrips = [...fold2.stopLossTrips ?? [], ...tripsHere];
|
|
234166
234395
|
continue;
|
|
234167
234396
|
}
|
|
@@ -234209,7 +234438,7 @@ function buildWorkorderActivity(input) {
|
|
|
234209
234438
|
} else {
|
|
234210
234439
|
const finalReviewers = node2?.isFinalOutput ? expectedReviewers(nodeId) : [];
|
|
234211
234440
|
if (node2?.isFinalOutput && finalReviewers.length > 0) {
|
|
234212
|
-
card2.status = ACTIVITY_COPY.finalDelivered(
|
|
234441
|
+
card2.status = ACTIVITY_COPY.finalDelivered(nameOf2(finalReviewers[0]));
|
|
234213
234442
|
} else {
|
|
234214
234443
|
const awaits = snap.reviews.some((r) => r.targetWorkId === w2.id) || nodesWithRequirement.has(nodeId);
|
|
234215
234444
|
card2.status = awaits ? ACTIVITY_COPY.doneAwaitingReview(name) : ACTIVITY_COPY.done(name);
|
|
@@ -234218,20 +234447,20 @@ function buildWorkorderActivity(input) {
|
|
|
234218
234447
|
} else if (interrupt) {
|
|
234219
234448
|
card2.phase = "stuck";
|
|
234220
234449
|
card2.segmentOpen = false;
|
|
234221
|
-
card2.status = interrupt.kind === "gap" ? ACTIVITY_COPY.interruptedByGap(name,
|
|
234450
|
+
card2.status = interrupt.kind === "gap" ? ACTIVITY_COPY.interruptedByGap(name, nameOf2(managerId ?? ownerId)) : ACTIVITY_COPY.interruptedByIssue(name);
|
|
234222
234451
|
if (interrupt.kind === "gap" && interrupt.authorId) {
|
|
234223
|
-
card2.actions = [{ kind: "open_thread", label: BUTTON.view, target: gapThreadSessionId(interrupt.authorId) }];
|
|
234452
|
+
card2.actions = [{ kind: "open_thread", label: BUTTON.view, target: gapThreadSessionId(interrupt.authorId), variant: "quiet" }];
|
|
234224
234453
|
}
|
|
234225
234454
|
if (interrupt.at > card2.updatedAt) card2.updatedAt = interrupt.at;
|
|
234226
234455
|
} else if (supersededBy) {
|
|
234227
234456
|
card2.phase = "stuck";
|
|
234228
234457
|
card2.segmentOpen = false;
|
|
234229
234458
|
const editor = openerOfWork.get(supersededBy.workId);
|
|
234230
|
-
card2.status = rootBriefNodeIds.has(supersededBy.upstreamNodeId) && editor && !isSystemActorId(editor) ? ACTIVITY_COPY.interruptedBySpecChange(
|
|
234459
|
+
card2.status = rootBriefNodeIds.has(supersededBy.upstreamNodeId) && editor && !isSystemActorId(editor) ? ACTIVITY_COPY.interruptedBySpecChange(nameOf2(editor), name) : ACTIVITY_COPY.interruptedByUpstreamVersion(nodeName(supersededBy.upstreamNodeId), name);
|
|
234231
234460
|
} else if (removedHere || killedByPlan) {
|
|
234232
234461
|
card2.phase = "stuck";
|
|
234233
234462
|
card2.segmentOpen = false;
|
|
234234
|
-
card2.status = removedHere ? ACTIVITY_COPY.interruptedByNodeRemoved(name) : reassigned ? ACTIVITY_COPY.interruptedByReassign(name,
|
|
234463
|
+
card2.status = removedHere ? ACTIVITY_COPY.interruptedByNodeRemoved(name) : reassigned ? ACTIVITY_COPY.interruptedByReassign(name, nameOf2(next.assigneeActorId)) : ACTIVITY_COPY.interruptedByPlanChange(name);
|
|
234235
234464
|
if (!removedHere && !reassigned) card2.planChangeUnnamed = true;
|
|
234236
234465
|
if (removedHere && nodeCancelledAt > card2.updatedAt) card2.updatedAt = nodeCancelledAt;
|
|
234237
234466
|
} else if (failedRound) {
|
|
@@ -234242,13 +234471,11 @@ function buildWorkorderActivity(input) {
|
|
|
234242
234471
|
card2.stuckReason = stuckKind;
|
|
234243
234472
|
const killedAt = w2.deadAt ?? w2.cancelledAt;
|
|
234244
234473
|
if (killedAt) delete card2.phaseLabel;
|
|
234245
|
-
card2.status = killedAt ? killedByWorkorderPause(w2, killedAt) ? ACTIVITY_COPY.killedByWorkorderPause(name) : ACTIVITY_COPY.killed(name) : st === "retry" ? ACTIVITY_COPY.awaitingRedispatch(
|
|
234474
|
+
card2.status = killedAt ? killedByWorkorderPause(w2, killedAt) ? ACTIVITY_COPY.killedByWorkorderPause(name) : ACTIVITY_COPY.killed(name) : st === "retry" ? ACTIVITY_COPY.awaitingRedispatch(nameOf2(card2.executorId), name) : stuckKind === "timeout" ? ACTIVITY_COPY.timedOut(nameOf2(card2.executorId)) : noOutputRound(w2) ? ACTIVITY_COPY.endedWithoutOutput(nameOf2(card2.executorId), name) : ACTIVITY_COPY.failed(nameOf2(card2.executorId));
|
|
234246
234475
|
fold2 = foldableFailure ? card2 : null;
|
|
234247
234476
|
} else if (ackedRound) {
|
|
234248
234477
|
card2.phase = "done";
|
|
234249
234478
|
card2.status = ACTIVITY_COPY.upstreamAcked(name);
|
|
234250
|
-
const note = w2.upstreamAck.note;
|
|
234251
|
-
card2.detail = note.length > UPSTREAM_ACK_NOTE_CAP ? `${note.slice(0, UPSTREAM_ACK_NOTE_CAP)}\u2026` : note;
|
|
234252
234479
|
} else if (held) {
|
|
234253
234480
|
card2.phase = "stuck";
|
|
234254
234481
|
card2.segmentOpen = false;
|
|
@@ -234283,12 +234510,12 @@ function buildWorkorderActivity(input) {
|
|
|
234283
234510
|
if (rec2.handActorId) d.handActorId = rec2.handActorId;
|
|
234284
234511
|
return d;
|
|
234285
234512
|
};
|
|
234286
|
-
const cardOpenAt = (nodeId,
|
|
234513
|
+
const cardOpenAt = (nodeId, at2) => {
|
|
234287
234514
|
const list2 = worksOfNode.get(nodeId);
|
|
234288
234515
|
if (!list2) return void 0;
|
|
234289
234516
|
let hit;
|
|
234290
234517
|
for (const w2 of list2) {
|
|
234291
|
-
if (w2.createdAt >
|
|
234518
|
+
if (w2.createdAt > at2) break;
|
|
234292
234519
|
hit = w2;
|
|
234293
234520
|
}
|
|
234294
234521
|
return hit ? cardOfWork.get(hit.id) : void 0;
|
|
@@ -234322,7 +234549,7 @@ function buildWorkorderActivity(input) {
|
|
|
234322
234549
|
d.phase = "done";
|
|
234323
234550
|
d.actions = [];
|
|
234324
234551
|
d.executorId = subjectId;
|
|
234325
|
-
d.status = addressed ? ACTIVITY_COPY.commentAddressed(
|
|
234552
|
+
d.status = addressed ? ACTIVITY_COPY.commentAddressed(nameOf2(subjectId), nameOf2(authorId), nodeName(d.nodeId)) : ACTIVITY_COPY.commentResolved(nameOf2(subjectId), nodeName(d.nodeId));
|
|
234326
234553
|
};
|
|
234327
234554
|
for (const rec2 of events) {
|
|
234328
234555
|
const ev = rec2.event;
|
|
@@ -234338,26 +234565,26 @@ function buildWorkorderActivity(input) {
|
|
|
234338
234565
|
没有所指(暂停不是完成)。 */
|
|
234339
234566
|
case "workorder.paused": {
|
|
234340
234567
|
const reason = str5(ev.reason);
|
|
234341
|
-
woCard(rec2, ACTIVITY_COPY.paused(
|
|
234568
|
+
woCard(rec2, ACTIVITY_COPY.paused(nameOf2(rec2.actorId)), {
|
|
234342
234569
|
notice: true,
|
|
234343
234570
|
detail: reason === LEGACY_PAUSE_REASON ? void 0 : reason
|
|
234344
234571
|
});
|
|
234345
234572
|
break;
|
|
234346
234573
|
}
|
|
234347
234574
|
case "workorder.resumed":
|
|
234348
|
-
woCard(rec2, ACTIVITY_COPY.resumedWorkorder(
|
|
234575
|
+
woCard(rec2, ACTIVITY_COPY.resumedWorkorder(nameOf2(rec2.actorId)), { notice: true });
|
|
234349
234576
|
break;
|
|
234350
234577
|
case "workorder.meta_changed": {
|
|
234351
234578
|
const patch = ev.patch ?? {};
|
|
234352
234579
|
if (!("goal" in patch) && !("description" in patch)) break;
|
|
234353
|
-
woCard(rec2, ACTIVITY_COPY.goalChanged(
|
|
234580
|
+
woCard(rec2, ACTIVITY_COPY.goalChanged(nameOf2(rec2.actorId), managerName()));
|
|
234354
234581
|
break;
|
|
234355
234582
|
}
|
|
234356
234583
|
case "plan.update_spec": {
|
|
234357
234584
|
const nodeId = String(ev.nodeId ?? "");
|
|
234358
234585
|
const d = cardOpenAt(nodeId, rec2.createdAt);
|
|
234359
234586
|
if (d?.planChangeUnnamed) {
|
|
234360
|
-
d.status = ACTIVITY_COPY.interruptedBySpecChange(
|
|
234587
|
+
d.status = ACTIVITY_COPY.interruptedBySpecChange(nameOf2(rec2.actorId), nodeName(nodeId));
|
|
234361
234588
|
delete d.planChangeUnnamed;
|
|
234362
234589
|
}
|
|
234363
234590
|
break;
|
|
@@ -234386,7 +234613,7 @@ function buildWorkorderActivity(input) {
|
|
|
234386
234613
|
const forcedBy = str5(reasons.find((r) => r.kind === "forced")?.actorId);
|
|
234387
234614
|
const parentWorkId = str5(workById.get(workId)?.parentWorkId);
|
|
234388
234615
|
const reworkOfRejected = !!parentWorkId && workById.get(parentWorkId)?.acceptanceState === "rejected";
|
|
234389
|
-
const status = reasonKinds.has("rework") || reworkOfRejected ? ACTIVITY_COPY.reworking(nodeName(nodeId)) : reasonKinds.has("resumed") ? ACTIVITY_COPY.resumed(
|
|
234616
|
+
const status = reasonKinds.has("rework") || reworkOfRejected ? ACTIVITY_COPY.reworking(nodeName(nodeId)) : reasonKinds.has("resumed") ? ACTIVITY_COPY.resumed(nameOf2(d.executorId), nodeName(nodeId)) : reasonKinds.has("spec_changed") ? ACTIVITY_COPY.specChanged(nodeName(nodeId)) : reasonKinds.has("issue") ? ACTIVITY_COPY.issueDriven(nodeName(nodeId)) : forcedBy ? ACTIVITY_COPY.forcedRerun(nameOf2(forcedBy), nodeName(nodeId)) : ACTIVITY_COPY.working(nodeName(nodeId));
|
|
234390
234617
|
for (const r of reasons) {
|
|
234391
234618
|
if (r.kind !== "issue") continue;
|
|
234392
234619
|
const issueId = str5(r.issueId);
|
|
@@ -234397,7 +234624,7 @@ function buildWorkorderActivity(input) {
|
|
|
234397
234624
|
if (ic && commentAuthor) {
|
|
234398
234625
|
touch(ic, rec2);
|
|
234399
234626
|
ic.executorId = d.executorId;
|
|
234400
|
-
ic.status = ACTIVITY_COPY.commentHandling(
|
|
234627
|
+
ic.status = ACTIVITY_COPY.commentHandling(nameOf2(d.executorId), nameOf2(commentAuthor));
|
|
234401
234628
|
}
|
|
234402
234629
|
}
|
|
234403
234630
|
if (d.openWorkId === workId) {
|
|
@@ -234418,7 +234645,7 @@ function buildWorkorderActivity(input) {
|
|
|
234418
234645
|
const d = cardOfWork.get(String(ev.workId ?? ""));
|
|
234419
234646
|
if (!d) break;
|
|
234420
234647
|
touch(d, rec2);
|
|
234421
|
-
if (
|
|
234648
|
+
if (!isSystemActorId(rec2.actorId)) d.detail = str5(ev.reason) ?? d.detail;
|
|
234422
234649
|
break;
|
|
234423
234650
|
}
|
|
234424
234651
|
case "work.submit_output": {
|
|
@@ -234449,7 +234676,7 @@ function buildWorkorderActivity(input) {
|
|
|
234449
234676
|
const bypassed = reviewers.length > 0 && isSystemAccept(by) && !voted;
|
|
234450
234677
|
if (isSystemAccept(by) && !bypassed) break;
|
|
234451
234678
|
const existing = acceptCards.get(workId);
|
|
234452
|
-
const status = bypassed ? node2?.isFinalOutput ? ACTIVITY_COPY.autoAccepted(
|
|
234679
|
+
const status = bypassed ? node2?.isFinalOutput ? ACTIVITY_COPY.autoAccepted(nameOf2(reviewers[0])) : ACTIVITY_COPY.autoAcceptedNode(nodeName(nodeId), nameOf2(reviewers[0])) : node2?.isFinalOutput ? ACTIVITY_COPY.accepted : ACTIVITY_COPY.acceptedNode(nodeName(nodeId));
|
|
234453
234680
|
if (existing) {
|
|
234454
234681
|
touch(existing, rec2);
|
|
234455
234682
|
existing.executorId = bypassed ? reviewers[0] : by;
|
|
@@ -234489,7 +234716,7 @@ function buildWorkorderActivity(input) {
|
|
|
234489
234716
|
executorId: by,
|
|
234490
234717
|
...rec2.handActorId ? { handActorId: rec2.handActorId } : {},
|
|
234491
234718
|
phase: "done",
|
|
234492
|
-
status: ACTIVITY_COPY.gapResolved(
|
|
234719
|
+
status: ACTIVITY_COPY.gapResolved(nameOf2(by), nameOf2(stuck)),
|
|
234493
234720
|
artifacts: [],
|
|
234494
234721
|
actions: []
|
|
234495
234722
|
});
|
|
@@ -234551,10 +234778,10 @@ function buildWorkorderActivity(input) {
|
|
|
234551
234778
|
缺口走不到这里了(F4 在上面 break)。 */
|
|
234552
234779
|
phase: isBackpressure ? "stuck" : "running",
|
|
234553
234780
|
status: isBackpressure ? ACTIVITY_COPY.backpressure(
|
|
234554
|
-
|
|
234781
|
+
nameOf2(authorId),
|
|
234555
234782
|
nodeName(nodeId),
|
|
234556
|
-
|
|
234557
|
-
) : ACTIVITY_COPY.commentRaised(
|
|
234783
|
+
nameOf2((nodeId ? nodeById.get(nodeId)?.assigneeActorId : void 0) ?? ownerId)
|
|
234784
|
+
) : ACTIVITY_COPY.commentRaised(nameOf2(authorId), nameOf2(commentTargetId ?? ownerId), nodeName(nodeId)),
|
|
234558
234785
|
/* **正文一律不上卡**:缺口去缺口线、回压去产物批注、留言去留言线。
|
|
234559
234786
|
此前只有缺口/回压被排除,留言仍是「正文当小状态 + 展开区再印一遍」,
|
|
234560
234787
|
全库实测最长 8096 字印两遍(`ws:wo-56bba3c1`),一张卡顶掉整屏。 */
|
|
@@ -234563,7 +234790,7 @@ function buildWorkorderActivity(input) {
|
|
|
234563
234790
|
留言给「查看留言」直达留言线——线是投影出来的、恒存在,id 这里就能算;
|
|
234564
234791
|
回压仍给「去处理」落到产物预览栏(那儿才有批注的处置面)。
|
|
234565
234792
|
留言算不出对面是谁(该产物没负责人)时退回「去处理」,别给一个开不了的落点。 */
|
|
234566
|
-
actions: isBackpressure || !commentTargetId ? [{ kind: "open_issue", label: BUTTON.handle, target: issueId }] : [{ kind: "open_thread", label: BUTTON.view, target: commentThreadSessionId(authorId, commentTargetId) }]
|
|
234793
|
+
actions: isBackpressure || !commentTargetId ? [{ kind: "open_issue", label: BUTTON.handle, target: issueId }] : [{ kind: "open_thread", label: BUTTON.view, target: commentThreadSessionId(authorId, commentTargetId), variant: "quiet" }]
|
|
234567
234794
|
});
|
|
234568
234795
|
break;
|
|
234569
234796
|
}
|
|
@@ -234609,7 +234836,7 @@ function buildWorkorderActivity(input) {
|
|
|
234609
234836
|
if (!target || !target.stuckReason) break;
|
|
234610
234837
|
touch(target, rec2);
|
|
234611
234838
|
if (target.foldedRounds && target.foldedRounds > 1) break;
|
|
234612
|
-
target.status = target.stuckReason === "timeout" ? ACTIVITY_COPY.retriedAfterTimeout(
|
|
234839
|
+
target.status = target.stuckReason === "timeout" ? ACTIVITY_COPY.retriedAfterTimeout(nameOf2(target.executorId), nameOf2(by)) : ACTIVITY_COPY.retriedAfterFailure(nameOf2(target.executorId), nameOf2(by));
|
|
234613
234840
|
break;
|
|
234614
234841
|
}
|
|
234615
234842
|
default:
|
|
@@ -234683,7 +234910,7 @@ function buildWorkorderActivity(input) {
|
|
|
234683
234910
|
for (const { comments } of commentGroups) {
|
|
234684
234911
|
const first = comments[0];
|
|
234685
234912
|
const executorId = nodeOwnerOf(first.nodeId);
|
|
234686
|
-
const author =
|
|
234913
|
+
const author = nameOf2(first.authorId);
|
|
234687
234914
|
const node2 = nodeName(first.nodeId);
|
|
234688
234915
|
const ids2 = comments.map((c) => c.id);
|
|
234689
234916
|
const closures = ids2.map(closureOf);
|
|
@@ -234730,7 +234957,7 @@ function buildWorkorderActivity(input) {
|
|
|
234730
234957
|
phase,
|
|
234731
234958
|
status,
|
|
234732
234959
|
artifacts: [],
|
|
234733
|
-
actions: threadPeer && threadPeer !== first.authorId ? [{ kind: "open_thread", label: BUTTON.view, target: commentThreadSessionId(first.authorId, threadPeer) }] : [],
|
|
234960
|
+
actions: threadPeer && threadPeer !== first.authorId ? [{ kind: "open_thread", label: BUTTON.view, target: commentThreadSessionId(first.authorId, threadPeer), variant: "quiet" }] : [],
|
|
234734
234961
|
commentIssueIds: ids2
|
|
234735
234962
|
});
|
|
234736
234963
|
}
|
|
@@ -234752,7 +234979,7 @@ function buildWorkorderActivity(input) {
|
|
|
234752
234979
|
const gapId = issueById.get(id)?.gapId;
|
|
234753
234980
|
return typeof gapId === "string" && !!issueById.get(gapId);
|
|
234754
234981
|
};
|
|
234755
|
-
const head = kind === "retry_exhausted" ? ACTIVITY_COPY.escalationHeadRetryExhausted(nodeName(e.nodeId)) : kind === "review_exhausted" ? ACTIVITY_COPY.escalationHeadReviewExhausted(nodeName(e.nodeId)) : kind === "output_stall" ? ACTIVITY_COPY.escalationHeadOutputStall(nodeName(e.nodeId)) : gapBehind(e.id) ? ACTIVITY_COPY.escalationHeadGapEscalated(
|
|
234982
|
+
const head = kind === "retry_exhausted" ? ACTIVITY_COPY.escalationHeadRetryExhausted(nodeName(e.nodeId)) : kind === "review_exhausted" ? ACTIVITY_COPY.escalationHeadReviewExhausted(nodeName(e.nodeId)) : kind === "output_stall" ? ACTIVITY_COPY.escalationHeadOutputStall(nodeName(e.nodeId)) : gapBehind(e.id) ? ACTIVITY_COPY.escalationHeadGapEscalated(nameOf2(e.authorId), nodeName(e.nodeId)) : ACTIVITY_COPY.escalationHeadManual(nameOf2(stuckActor));
|
|
234756
234983
|
const howTo = kind === "retry_exhausted" ? ACTIVITY_COPY.escalationHowToRetryExhausted : kind === "review_exhausted" ? ACTIVITY_COPY.escalationHowToReviewExhausted : kind === "output_stall" ? ACTIVITY_COPY.escalationHowToOutputStall : void 0;
|
|
234757
234984
|
const closing = issueById.get(e.id);
|
|
234758
234985
|
const closeEvent = plainResolveEvents.get(e.id);
|
|
@@ -234761,7 +234988,7 @@ function buildWorkorderActivity(input) {
|
|
|
234761
234988
|
const noteOf = (id) => text5(issueById.get(id)?.resolvedNote) ?? text5(plainResolveEvents.get(id)?.note);
|
|
234762
234989
|
const rerunClosed = closingNote === ESCALATION_RERUN_NOTE;
|
|
234763
234990
|
const rerunOrdinal = escalations.filter((x2) => x2.nodeId === e.nodeId && noteOf(x2.id) === ESCALATION_RERUN_NOTE && (resolvedAt(x2.id) ?? "") <= (closedAt ?? "")).length;
|
|
234764
|
-
const doneStatus = rerunClosed ? ACTIVITY_COPY.escalationRerun(
|
|
234991
|
+
const doneStatus = rerunClosed ? ACTIVITY_COPY.escalationRerun(nameOf2(closedBy), Math.max(rerunOrdinal, 1)) : ACTIVITY_COPY.escalationHandled(head, nameOf2(closedBy), closingNote);
|
|
234765
234992
|
const retryExhaustedSoFar = escalations.filter((x2) => x2.nodeId === e.nodeId && escalationKindOf(x2.id, issueById.get(x2.id)?.authorActorId ?? x2.authorId) === "retry_exhausted" && x2.at <= e.at).length;
|
|
234766
234993
|
const viewerIsTarget = !input.viewerActorId || input.viewerActorId === target;
|
|
234767
234994
|
const offerRerun = kind === "retry_exhausted" && viewerIsTarget && retryExhaustedSoFar < 2 && !!e.nodeId;
|
|
@@ -234786,7 +235013,7 @@ function buildWorkorderActivity(input) {
|
|
|
234786
235013
|
卡在人身上——颜色说的是这一段的状态,不是「轮到你了没有」。 */
|
|
234787
235014
|
awaitingHuman: open3,
|
|
234788
235015
|
...open3 ? { phaseLabel: inDiscussion ? PHASE_LABEL.escalationInProgress : PHASE_LABEL.escalationPending } : {},
|
|
234789
|
-
status: open3 ? ACTIVITY_COPY.escalationPendingWith(head,
|
|
235016
|
+
status: open3 ? ACTIVITY_COPY.escalationPendingWith(head, nameOf2(target), howTo) : doneStatus,
|
|
234790
235017
|
/* 上报正文**不上卡**——与缺口 / 回压同一条口径。此前这里把整封信塞进展开区,
|
|
234791
235018
|
`ws:wo-635d7add` 那条渲染出的是一屏字,连内部 artifact id 都印在卡面上。
|
|
234792
235019
|
全文的去处,就是那个「去处理」按钮。 */
|
|
@@ -234797,13 +235024,16 @@ function buildWorkorderActivity(input) {
|
|
|
234797
235024
|
按钮文案按**查看者**分两态(Bug 0151 / PR #2003 / 用例 T-31):不是收件人就写「查看留言」
|
|
234798
235025
|
——他点进去只有只读视图,按钮不该承诺一件他做不到的事。查看者取不到时保持「去处理」。
|
|
234799
235026
|
关掉之后按钮不收走、只换成「查看留言」:那间讨论房是这条上报唯一的来龙去脉。 */
|
|
234800
|
-
actions: !open3 ? [{ kind: "discuss_escalation", label: BUTTON.view, target: e.id }] : offerRerun ? [
|
|
235027
|
+
actions: !open3 ? [{ kind: "discuss_escalation", label: BUTTON.view, target: e.id, variant: "quiet" }] : offerRerun ? [
|
|
234801
235028
|
{ kind: "rerun_node", label: BUTTON.rerun, target: e.id, variant: "primary" },
|
|
234802
235029
|
{ kind: "discuss_escalation", label: BUTTON.handle, target: e.id, variant: "secondary" }
|
|
234803
235030
|
] : [{
|
|
234804
235031
|
kind: "discuss_escalation",
|
|
234805
235032
|
label: viewerIsTarget ? BUTTON.handle : BUTTON.view,
|
|
234806
|
-
target: e.id
|
|
235033
|
+
target: e.id,
|
|
235034
|
+
/* 不是收件人 ⇒ 他点进去只有只读视图,分量跟着降到 `quiet`(Bug 0151 只换了词、
|
|
235035
|
+
没换分量,于是旁观者看到的仍是一颗和「去处理」一样重的黑钮)。 */
|
|
235036
|
+
...viewerIsTarget ? {} : { variant: "quiet" }
|
|
234807
235037
|
}]
|
|
234808
235038
|
});
|
|
234809
235039
|
}
|
|
@@ -234816,7 +235046,7 @@ function buildWorkorderActivity(input) {
|
|
|
234816
235046
|
const nodeId = gap.aboutNodeId ?? gap.raisedByNodeId;
|
|
234817
235047
|
const name = nodeName(nodeId);
|
|
234818
235048
|
const resolvedAt = gap.resolvedAt ?? null;
|
|
234819
|
-
const inWindow2 = (
|
|
235049
|
+
const inWindow2 = (at2) => !!at2 && at2 >= gap.createdAt && (!resolvedAt || at2 <= resolvedAt);
|
|
234820
235050
|
const escalated = snap.issues.find((i) => i.kind === "escalation" && escalationKindOf(i.id, i.authorActorId) === "manual" && (i.gapId === gapId || (i.aboutNodeId ?? i.raisedByNodeId) === nodeId && inWindow2(i.createdAt)));
|
|
234821
235051
|
const run = coordinatorRunOfGap(
|
|
234822
235052
|
{ createdAt: gap.createdAt, resolvedAt },
|
|
@@ -234849,12 +235079,12 @@ function buildWorkorderActivity(input) {
|
|
|
234849
235079
|
那时按 `segmentOpen` 走暖橙——真要人动手的是它升级出去的那张升级卡,红归那一张。
|
|
234850
235080
|
显式写 `false` 而不是省略:省略 = 不表态,前端会退回老规则(`stuck` + 开着 ⇒ 砖红)。 */
|
|
234851
235081
|
awaitingHuman: false,
|
|
234852
|
-
status: resolvedAt ? ACTIVITY_COPY.coordinatorFixedGap(
|
|
235082
|
+
status: resolvedAt ? ACTIVITY_COPY.coordinatorFixedGap(nameOf2(coordinatorId), nameOf2(executorId)) : escalated ? ACTIVITY_COPY.coordinatorEscalated(nameOf2(coordinatorId), name, nameOf2(recipient)) : failedRun ? ACTIVITY_COPY.coordinatorFailed(name) : ACTIVITY_COPY.coordinatingGap(nameOf2(coordinatorId), name),
|
|
234853
235083
|
artifacts: [],
|
|
234854
235084
|
/* 点进去 = **这段协调轨迹**(run 在 `agent_runs` 里,`runId` 直接给)+ 缺口线。
|
|
234855
235085
|
查不到那一段运行 ⇒ 不给轨迹入口,卡与那颗「查看留言」照旧。 */
|
|
234856
235086
|
...run ? { traceAvailable: true, runId: run.id } : {},
|
|
234857
|
-
actions: [{ kind: "open_thread", label: BUTTON.view, target: gapThreadSessionId(executorId) }]
|
|
235087
|
+
actions: [{ kind: "open_thread", label: BUTTON.view, target: gapThreadSessionId(executorId), variant: "quiet" }]
|
|
234858
235088
|
};
|
|
234859
235089
|
coordinatorCards.push(draft);
|
|
234860
235090
|
if (resolvedAt) gapsClosedByCoordinatorCard.add(gapId);
|
|
@@ -234874,7 +235104,7 @@ function buildWorkorderActivity(input) {
|
|
|
234874
235104
|
if (card2.phaseLabel !== PHASE_LABEL.failed) continue;
|
|
234875
235105
|
const last = trips.at(-1);
|
|
234876
235106
|
const name = nodeName(card2.nodeId);
|
|
234877
|
-
const who =
|
|
235107
|
+
const who = nameOf2(card2.executorId);
|
|
234878
235108
|
const n = last.count ?? card2.foldedRounds ?? card2.traceWorkIds?.length ?? 1;
|
|
234879
235109
|
const sentence = last.kind === "retry_exhausted" ? ACTIVITY_COPY.retryExhausted(who, name, n, lastFailureOf(card2, last) ?? last.lastReason) : ACTIVITY_COPY.outputStalled(who, name, n, last.cost);
|
|
234880
235110
|
card2.status = trips.length > 1 ? ACTIVITY_COPY.stopLossAgain(sentence, trips.length) : sentence;
|
|
@@ -234890,13 +235120,13 @@ function buildWorkorderActivity(input) {
|
|
|
234890
235120
|
if (pending.length === 0) continue;
|
|
234891
235121
|
const acceptor = pending[0];
|
|
234892
235122
|
const produced = cardOfWork.get(w2.id);
|
|
234893
|
-
const
|
|
235123
|
+
const at2 = produced?.updatedAt ?? w2.lastActivityAt ?? w2.endedAt ?? w2.createdAt;
|
|
234894
235124
|
acceptCards.set(w2.id, {
|
|
234895
235125
|
id: `accept:${w2.id}`,
|
|
234896
235126
|
// 待验收卡挂在其产出卡之后:借产出卡的 seq +0.5 保持相邻,不去伪造一个事件 seq。
|
|
234897
235127
|
seq: (cardOfWork.get(w2.id)?.seq ?? 0) + 0.5,
|
|
234898
|
-
at,
|
|
234899
|
-
updatedAt:
|
|
235128
|
+
at: at2,
|
|
235129
|
+
updatedAt: at2,
|
|
234900
235130
|
nodeId: w2.nodeId,
|
|
234901
235131
|
executorId: acceptor,
|
|
234902
235132
|
phase: "not_started",
|
|
@@ -234960,7 +235190,7 @@ function buildWorkorderActivity(input) {
|
|
|
234960
235190
|
/* 同一人担多个责任组时,展开区留一份**逐组结论**(只有判定词、没有意见正文)——小状态只有
|
|
234961
235191
|
一句总判定,说不清哪个组过了哪个组没过。意见正文一律走下面的意见条。 */
|
|
234962
235192
|
...summary.latest.length > 1 ? {
|
|
234963
|
-
detail: summary.latest.map((r) => `${
|
|
235193
|
+
detail: summary.latest.map((r) => `${nameOf2(r.reviewerActorId)}\uFF08\u8BC4\u5BA1\u7EC4 ${groups.indexOf(r.reviewGroup) + 1}\uFF09\uFF1A${reviewLabel(r)}`).join("\n")
|
|
234964
235194
|
} : {},
|
|
234965
235195
|
...reviewNotes.length ? { reviewNotes } : {},
|
|
234966
235196
|
...reviewLine ? { reviewThreadSessionId: reviewLine } : {},
|
|
@@ -235076,11 +235306,12 @@ function buildWorkorderActivity(input) {
|
|
|
235076
235306
|
cards.sort((a, b2) => a.at.localeCompare(b2.at) || a.seq - b2.seq || a.id.localeCompare(b2.id));
|
|
235077
235307
|
return { workorderId, cards, truncated };
|
|
235078
235308
|
}
|
|
235079
|
-
var ACTIVITY_EVENT_KINDS, LEGACY_PAUSE_REASON, ACTIVITY_EVENT_LIMIT,
|
|
235309
|
+
var ACTIVITY_EVENT_KINDS, LEGACY_PAUSE_REASON, ACTIVITY_EVENT_LIMIT, ACTIVITY_COPY, REWORK_ANNOTATION_PREFIX, RECOVERY_ANNOTATION_PREFIX, BUTTON, PHASE_LABEL, COORDINATOR_CARD_PREFIX, coordinatorCardId, isStopLoss;
|
|
235080
235310
|
var init_activity2 = __esm({
|
|
235081
235311
|
"../server/src/domains/collab/activity.ts"() {
|
|
235082
235312
|
"use strict";
|
|
235083
235313
|
init_src();
|
|
235314
|
+
init_escalation_kind();
|
|
235084
235315
|
init_src6();
|
|
235085
235316
|
init_activity_notice();
|
|
235086
235317
|
init_gap_thread();
|
|
@@ -235123,7 +235354,6 @@ var init_activity2 = __esm({
|
|
|
235123
235354
|
];
|
|
235124
235355
|
LEGACY_PAUSE_REASON = "\u6682\u505C\u6D3E\u53D1";
|
|
235125
235356
|
ACTIVITY_EVENT_LIMIT = 2e3;
|
|
235126
|
-
UPSTREAM_ACK_NOTE_CAP = 300;
|
|
235127
235357
|
ACTIVITY_COPY = {
|
|
235128
235358
|
goalConfirmed: "\u76EE\u6807\u5DF2\u786E\u8BA4\uFF0C\u4EFB\u52A1\u6309\u76EE\u6807\u5F00\u59CB\u6267\u884C\u3002",
|
|
235129
235359
|
/**
|
|
@@ -235396,7 +235626,13 @@ var init_activity2 = __esm({
|
|
|
235396
235626
|
commentUpdated: (author, node2) => `\u5DF2\u6309 ${author} \u7684\u7559\u8A00\u66F4\u65B0\u4E86\u4E00\u7248\u300A${node2}\u300B\u3002`,
|
|
235397
235627
|
commentReplied: (author) => `\u5DF2\u56DE\u590D ${author} \u7684\u7559\u8A00\uFF0C\u672C\u6B21\u4E0D\u6539\u3002`,
|
|
235398
235628
|
commentViewed: (author) => `\u770B\u8FC7 ${author} \u7684\u7559\u8A00\uFF0C\u65E0\u9700\u4FEE\u6539\u3002`,
|
|
235399
|
-
/**
|
|
235629
|
+
/**
|
|
235630
|
+
* 确认沿用(ADR 0607):上游换版,执行人确认不影响已接受的交付。
|
|
235631
|
+
*
|
|
235632
|
+
* 🚨 卡上**只有这一句**——`ack --note` 带的那段理由不再进展开区(Bug 0236)。它是执行 agent
|
|
235633
|
+
* 自由写的,除了长度截断没有任何语域约束,产品负责人 2026-09-23 在真页面上看到的是
|
|
235634
|
+
* 「任务1:…沿用 `wk:artifact:qa:…:1`,不产新版。」这种任务书编号腔 + 裸 work id。
|
|
235635
|
+
*/
|
|
235400
235636
|
upstreamAcked: (node2) => `\u4E0A\u6E38\u6709\u65B0\u7248\uFF0C\u786E\u8BA4\u4E0D\u5F71\u54CD\u300A${node2}\u300B\uFF0C\u6CBF\u7528\u4E0A\u4E00\u7248\u4EA4\u4ED8\u3002`,
|
|
235401
235637
|
commentWithdrawn: (author) => `${author} \u64A4\u56DE\u4E86\u7559\u8A00\uFF0C\u65E0\u9700\u5904\u7406\u3002`,
|
|
235402
235638
|
/** 节点被移出计划(任务还没到头):引擎把挂在上面的留言一并按「不改」关掉(`plan.delete_node`)。 */
|
|
@@ -235419,7 +235655,6 @@ var init_activity2 = __esm({
|
|
|
235419
235655
|
};
|
|
235420
235656
|
REWORK_ANNOTATION_PREFIX = "ann:rework:";
|
|
235421
235657
|
RECOVERY_ANNOTATION_PREFIX = "ann:recovery:";
|
|
235422
|
-
ENGINE_RETRY_EXHAUSTED = "failed exhausted";
|
|
235423
235658
|
BUTTON = {
|
|
235424
235659
|
approve: "\u5BA1\u6838\u901A\u8FC7",
|
|
235425
235660
|
reject: "\u5BA1\u6838\u4E0D\u901A\u8FC7",
|
|
@@ -235450,8 +235685,6 @@ var init_activity2 = __esm({
|
|
|
235450
235685
|
};
|
|
235451
235686
|
COORDINATOR_CARD_PREFIX = "coordinator:";
|
|
235452
235687
|
coordinatorCardId = (gapId) => `${COORDINATOR_CARD_PREFIX}${gapId}`;
|
|
235453
|
-
RETRY_EXHAUSTED_ESC_PREFIX = "esc:retry-exhausted:";
|
|
235454
|
-
REVIEW_EXHAUSTED_ESC_PREFIX2 = "esc:review-exhausted:";
|
|
235455
235688
|
isStopLoss = (kind) => kind === "retry_exhausted" || kind === "output_stall";
|
|
235456
235689
|
}
|
|
235457
235690
|
});
|
|
@@ -235770,10 +236003,10 @@ function changeConfirmSummary(r) {
|
|
|
235770
236003
|
}
|
|
235771
236004
|
function latestOtherLetterActivity(an, me) {
|
|
235772
236005
|
let best;
|
|
235773
|
-
const consider = (
|
|
235774
|
-
if (!
|
|
236006
|
+
const consider = (at2, by, seq) => {
|
|
236007
|
+
if (!at2 || by === void 0 || by === me) return;
|
|
235775
236008
|
const s2 = seq ?? -1;
|
|
235776
|
-
if (!best || s2 > best.seq) best = { at, by, seq: s2 };
|
|
236009
|
+
if (!best || s2 > best.seq) best = { at: at2, by, seq: s2 };
|
|
235777
236010
|
};
|
|
235778
236011
|
for (const t of an.thread) consider(t.ts, t.author, t.seq);
|
|
235779
236012
|
if (an.resolvedBy !== void 0) consider(an.resolvedAt, an.resolvedBy, an.resolvedAtSeq);
|
|
@@ -235814,7 +236047,7 @@ function buildInbox(model, me, leadOf, resolveActor, markers = [], slaMs, nowIso
|
|
|
235814
236047
|
return v2 === void 0 ? {} : { overdue: v2 };
|
|
235815
236048
|
};
|
|
235816
236049
|
const downstreamCount = (id) => consumersOf(model, id).length;
|
|
235817
|
-
const
|
|
236050
|
+
const firstSentence3 = (s2, max = 80) => (s2 ?? "").replace(/\s+/g, " ").trim().slice(0, max);
|
|
235818
236051
|
const creatorOf = /* @__PURE__ */ new Map();
|
|
235819
236052
|
for (const a of model.artifacts.values()) {
|
|
235820
236053
|
if (a.type === "brief") creatorOf.set(a.workspace, a.owner);
|
|
@@ -235935,7 +236168,7 @@ function buildInbox(model, me, leadOf, resolveActor, markers = [], slaMs, nowIso
|
|
|
235935
236168
|
// 仍回落工单详情。
|
|
235936
236169
|
...r.origin ? { chatSessionId: r.origin } : {},
|
|
235937
236170
|
...anchorArt ? { title: nodeLabel(anchorArt) } : {},
|
|
235938
|
-
detail: `${actorName(r.proposedBy) || "\u7BA1\u7406\u8005"}\uFF1A${r.command ? commandCardLine(r.command) :
|
|
236171
|
+
detail: `${actorName(r.proposedBy) || "\u7BA1\u7406\u8005"}\uFF1A${r.command ? commandCardLine(r.command) : firstSentence3(r.plan.reason)}`,
|
|
235939
236172
|
...r.kind !== "command" && opCount > 0 ? { impact: `\u6D89\u53CA ${opCount} \u5904\u6539\u52A8${r.nonMonotonicOps.length > 0 ? " \xB7 \u542B\u9500\u6BC1\u6027" : ""}` } : {},
|
|
235940
236173
|
actor: actorRef2(r.proposedBy),
|
|
235941
236174
|
...overdueField(r.at)
|
|
@@ -235959,7 +236192,7 @@ function buildInbox(model, me, leadOf, resolveActor, markers = [], slaMs, nowIso
|
|
|
235959
236192
|
actionRequired: true,
|
|
235960
236193
|
summary: `\u6709\u4EBA\u5728\u300C${label2}\u300D\u7684\u4FE1\u91CC @ \u4E86\u4F60\uFF0C\u7B49\u4F60\u56DE\u8BDD\uFF1A${(lastPost?.body ?? an.body).slice(0, 100)}`,
|
|
235961
236194
|
title: label2,
|
|
235962
|
-
detail: `${(lastPost ? actorName(lastPost.author) : "") || "\u6709\u4EBA"} @ \u4E86\u4F60\uFF1A${
|
|
236195
|
+
detail: `${(lastPost ? actorName(lastPost.author) : "") || "\u6709\u4EBA"} @ \u4E86\u4F60\uFF1A${firstSentence3(lastPost?.body ?? an.body)}`,
|
|
235963
236196
|
...lastPost ? { actor: actorRef2(lastPost.author) } : {},
|
|
235964
236197
|
...overdueField(an.createdAt)
|
|
235965
236198
|
});
|
|
@@ -235984,7 +236217,7 @@ function buildInbox(model, me, leadOf, resolveActor, markers = [], slaMs, nowIso
|
|
|
235984
236217
|
actionRequired: false,
|
|
235985
236218
|
summary: `\u4F60\u7684\u4FE1\u6709\u65B0\u52A8\u9759\uFF08${phrase}\uFF09\u300C${nodeLabel(a)}\u300D\uFF1A${lastNote.slice(0, 100)}\u2014\u2014\u4E0D\u8BA4\u53EF\u53EF\u5728\u4FE1\u4E2D\u56DE\u5E16`,
|
|
235986
236219
|
title: nodeLabel(a),
|
|
235987
|
-
detail: `${actorName(activity.by) || "\u5BF9\u65B9"} \u56DE\u5E94\u4E86\u4F60\u7684\u4FE1\uFF1A${
|
|
236220
|
+
detail: `${actorName(activity.by) || "\u5BF9\u65B9"} \u56DE\u5E94\u4E86\u4F60\u7684\u4FE1\uFF1A${firstSentence3(lastNote)}`,
|
|
235988
236221
|
actor: actorRef2(activity.by)
|
|
235989
236222
|
// 通知型不判 overdue(诊断明说),不设 overdue 字段。
|
|
235990
236223
|
});
|
|
@@ -236004,7 +236237,7 @@ function buildInbox(model, me, leadOf, resolveActor, markers = [], slaMs, nowIso
|
|
|
236004
236237
|
actionRequired: true,
|
|
236005
236238
|
summary: `\u5F85\u4F60\u9A8C\u6536\uFF1A${label2}\uFF08${pendingHead.id}\uFF09\u2014\u2014\u8BE5\u7248\u7B54\u590D\u4E86\u4F60\u7684\u4FE1`,
|
|
236006
236239
|
title: label2,
|
|
236007
|
-
detail: `${actorName(pendingHead.author) || "agent"} \u4EA4\u4E86\u65B0\u7248\u7B54\u590D\u4F60\u7684\u4FE1\uFF1A${
|
|
236240
|
+
detail: `${actorName(pendingHead.author) || "agent"} \u4EA4\u4E86\u65B0\u7248\u7B54\u590D\u4F60\u7684\u4FE1\uFF1A${firstSentence3(pendingHead.reason)}`,
|
|
236008
236241
|
actor: actorRef2(pendingHead.author),
|
|
236009
236242
|
...overdueField(pendingHead.createdAt)
|
|
236010
236243
|
});
|
|
@@ -236031,7 +236264,7 @@ function buildInbox(model, me, leadOf, resolveActor, markers = [], slaMs, nowIso
|
|
|
236031
236264
|
actionRequired: true,
|
|
236032
236265
|
summary: `\u5F85\u4F60\u5BA1\u6279\uFF1A${label2}`,
|
|
236033
236266
|
title: label2,
|
|
236034
|
-
...gp ? { detail: `${actorName(gp.headAuthor) || "\u4F5C\u8005"} \u4EA4\u4E86\u65B0\u7248\uFF1A${
|
|
236267
|
+
...gp ? { detail: `${actorName(gp.headAuthor) || "\u4F5C\u8005"} \u4EA4\u4E86\u65B0\u7248\uFF1A${firstSentence3(headReason)}`, actor: actorRef2(gp.headAuthor) } : {},
|
|
236035
236268
|
...impactParts.length > 0 ? { impact: impactParts.join(" \xB7 ") } : {},
|
|
236036
236269
|
...overdueField(gate.at)
|
|
236037
236270
|
});
|
|
@@ -236054,7 +236287,7 @@ function buildInbox(model, me, leadOf, resolveActor, markers = [], slaMs, nowIso
|
|
|
236054
236287
|
actionRequired: true,
|
|
236055
236288
|
summary: `\u4EA7\u51FA\u88AB\u6253\u56DE\uFF0C\u9700\u8FD4\u5DE5\uFF1A${label2}`,
|
|
236056
236289
|
title: label2,
|
|
236057
|
-
...rejectVote ? { detail: `${actorName(rejectVote.author) || "\u8BC4\u5BA1"} \u6253\u56DE\uFF1A${
|
|
236290
|
+
...rejectVote ? { detail: `${actorName(rejectVote.author) || "\u8BC4\u5BA1"} \u6253\u56DE\uFF1A${firstSentence3(rejectVote.note ?? "\u89C1\u8BC4\u5BA1\u610F\u89C1")}`, actor: actorRef2(rejectVote.author) } : {},
|
|
236058
236291
|
...reworkDs > 0 ? { impact: `\u6321\u7740\u4E0B\u6E38 ${reworkDs} \u4E2A\u8282\u70B9` } : {},
|
|
236059
236292
|
...overdueField(latest.createdAt)
|
|
236060
236293
|
});
|
|
@@ -236094,7 +236327,7 @@ function buildInbox(model, me, leadOf, resolveActor, markers = [], slaMs, nowIso
|
|
|
236094
236327
|
actionRequired: true,
|
|
236095
236328
|
summary: `\u4E0B\u6E38\u56DE\u538B\u5F85\u5904\u7406\uFF1A${pushback.body}`,
|
|
236096
236329
|
title: label2,
|
|
236097
|
-
detail: `\u4E0B\u6E38\u56DE\u538B\uFF1A${
|
|
236330
|
+
detail: `\u4E0B\u6E38\u56DE\u538B\uFF1A${firstSentence3(pushback.body)}`,
|
|
236098
236331
|
actor: actorRef2(pushback.author),
|
|
236099
236332
|
...pushbackDs > 0 ? { impact: `\u5B83\u88AB\u4F60\u5361\u7740 ${pushbackDs} \u4E2A\u4E0B\u6E38\u8282\u70B9` } : {},
|
|
236100
236333
|
...overdueField(pushbackSince)
|
|
@@ -236158,8 +236391,8 @@ function backfillInboxUnread(items, markers) {
|
|
|
236158
236391
|
}
|
|
236159
236392
|
}
|
|
236160
236393
|
function applyReadAllWatermark(items, markers) {
|
|
236161
|
-
const
|
|
236162
|
-
const atMs =
|
|
236394
|
+
const at2 = markers.find((m2) => m2.scope === INBOX_READ_ALL_SCOPE)?.readAt;
|
|
236395
|
+
const atMs = at2 ? Date.parse(at2) : Number.NaN;
|
|
236163
236396
|
if (!Number.isFinite(atMs)) return;
|
|
236164
236397
|
for (const item of items) {
|
|
236165
236398
|
const sinceMs = Date.parse(item.since);
|
|
@@ -236699,10 +236932,10 @@ var init_notification_store = __esm({
|
|
|
236699
236932
|
async listPending() {
|
|
236700
236933
|
return [...this.rows.values()].filter((r) => r.status === "pending");
|
|
236701
236934
|
}
|
|
236702
|
-
async refresh(id, patch,
|
|
236935
|
+
async refresh(id, patch, at2) {
|
|
236703
236936
|
const r = this.rows.get(id);
|
|
236704
236937
|
if (!r || r.status !== "pending") return;
|
|
236705
|
-
const next = { ...r, title: patch.title, updatedAt:
|
|
236938
|
+
const next = { ...r, title: patch.title, updatedAt: at2 };
|
|
236706
236939
|
for (const k2 of ["workspaceTitle", "actorId", "cardId", "item"]) {
|
|
236707
236940
|
if (patch[k2] === void 0) delete next[k2];
|
|
236708
236941
|
else next[k2] = patch[k2];
|
|
@@ -236710,11 +236943,11 @@ var init_notification_store = __esm({
|
|
|
236710
236943
|
this.rows.set(id, next);
|
|
236711
236944
|
this.save();
|
|
236712
236945
|
}
|
|
236713
|
-
async rekey(id, sourceKey, patch,
|
|
236946
|
+
async rekey(id, sourceKey, patch, at2) {
|
|
236714
236947
|
const r = this.rows.get(id);
|
|
236715
236948
|
if (!r || r.status !== "pending" || this.findLive(r.recipient, sourceKey, r.category)) return false;
|
|
236716
236949
|
this.rows.set(id, { ...r, sourceKey, ...patch.nodeId ? { nodeId: patch.nodeId } : {} });
|
|
236717
|
-
await this.refresh(id, patch,
|
|
236950
|
+
await this.refresh(id, patch, at2);
|
|
236718
236951
|
return true;
|
|
236719
236952
|
}
|
|
236720
236953
|
async close(id, closure) {
|
|
@@ -236734,21 +236967,21 @@ var init_notification_store = __esm({
|
|
|
236734
236967
|
const cur = parseCursor(opts.before);
|
|
236735
236968
|
return [...this.rows.values()].filter((r) => r.recipient === recipient).filter((r) => !opts.status || r.status === opts.status).filter((r) => !cur || r.enteredAt < cur.at || r.enteredAt === cur.at && r.id < cur.id).sort(newerFirst).slice(0, pageSize(opts.limit));
|
|
236736
236969
|
}
|
|
236737
|
-
async markRead(recipient, ids2,
|
|
236970
|
+
async markRead(recipient, ids2, at2) {
|
|
236738
236971
|
let changed = false;
|
|
236739
236972
|
for (const id of ids2) {
|
|
236740
236973
|
const r = this.rows.get(id);
|
|
236741
|
-
if (!r || r.recipient !== recipient || r.readAt && r.readAt >=
|
|
236742
|
-
this.rows.set(id, { ...r, readAt:
|
|
236974
|
+
if (!r || r.recipient !== recipient || r.readAt && r.readAt >= at2) continue;
|
|
236975
|
+
this.rows.set(id, { ...r, readAt: at2 });
|
|
236743
236976
|
changed = true;
|
|
236744
236977
|
}
|
|
236745
236978
|
if (changed) this.save();
|
|
236746
236979
|
}
|
|
236747
|
-
async markAllRead(recipient,
|
|
236980
|
+
async markAllRead(recipient, at2) {
|
|
236748
236981
|
let n = 0;
|
|
236749
236982
|
for (const [id, r] of this.rows) {
|
|
236750
236983
|
if (r.recipient !== recipient || r.readAt) continue;
|
|
236751
|
-
this.rows.set(id, { ...r, readAt:
|
|
236984
|
+
this.rows.set(id, { ...r, readAt: at2 });
|
|
236752
236985
|
n++;
|
|
236753
236986
|
}
|
|
236754
236987
|
if (n > 0) this.save();
|
|
@@ -236862,7 +237095,7 @@ var init_notification_store = __esm({
|
|
|
236862
237095
|
const r = await this.sql.query(`SELECT * FROM ${this.t} WHERE status = 'pending'`);
|
|
236863
237096
|
return r.rows.map(fromRow);
|
|
236864
237097
|
}
|
|
236865
|
-
async refresh(id, patch,
|
|
237098
|
+
async refresh(id, patch, at2) {
|
|
236866
237099
|
await this.sql.query(
|
|
236867
237100
|
`UPDATE ${this.t} SET title = $2, workspace_title = $3, actor_id = $4, card_id = $5, item = $6, updated_at = $7
|
|
236868
237101
|
WHERE id = $1 AND status = 'pending'`,
|
|
@@ -236873,11 +237106,11 @@ var init_notification_store = __esm({
|
|
|
236873
237106
|
patch.actorId ?? null,
|
|
236874
237107
|
patch.cardId ?? null,
|
|
236875
237108
|
patch.item ? JSON.stringify(patch.item) : null,
|
|
236876
|
-
|
|
237109
|
+
at2
|
|
236877
237110
|
]
|
|
236878
237111
|
);
|
|
236879
237112
|
}
|
|
236880
|
-
async rekey(id, sourceKey, patch,
|
|
237113
|
+
async rekey(id, sourceKey, patch, at2) {
|
|
236881
237114
|
try {
|
|
236882
237115
|
const r = await this.sql.query(
|
|
236883
237116
|
`UPDATE ${this.t} SET source_key = $2, node_id = COALESCE($3, node_id), title = $4, workspace_title = $5,
|
|
@@ -236892,7 +237125,7 @@ var init_notification_store = __esm({
|
|
|
236892
237125
|
patch.actorId ?? null,
|
|
236893
237126
|
patch.cardId ?? null,
|
|
236894
237127
|
patch.item ? JSON.stringify(patch.item) : null,
|
|
236895
|
-
|
|
237128
|
+
at2
|
|
236896
237129
|
]
|
|
236897
237130
|
);
|
|
236898
237131
|
return (r.rowCount ?? 0) > 0;
|
|
@@ -236936,18 +237169,18 @@ var init_notification_store = __esm({
|
|
|
236936
237169
|
);
|
|
236937
237170
|
return r.rows.map(fromRow);
|
|
236938
237171
|
}
|
|
236939
|
-
async markRead(recipient, ids2,
|
|
237172
|
+
async markRead(recipient, ids2, at2) {
|
|
236940
237173
|
if (ids2.length === 0) return;
|
|
236941
237174
|
await this.sql.query(
|
|
236942
237175
|
`UPDATE ${this.t} SET read_at = GREATEST(COALESCE(read_at, $3::timestamptz), $3::timestamptz)
|
|
236943
237176
|
WHERE recipient = $1 AND id = ANY($2::text[])`,
|
|
236944
|
-
[recipient, [...ids2],
|
|
237177
|
+
[recipient, [...ids2], at2]
|
|
236945
237178
|
);
|
|
236946
237179
|
}
|
|
236947
|
-
async markAllRead(recipient,
|
|
237180
|
+
async markAllRead(recipient, at2) {
|
|
236948
237181
|
const r = await this.sql.query(
|
|
236949
237182
|
`UPDATE ${this.t} SET read_at = $2::timestamptz WHERE recipient = $1 AND read_at IS NULL`,
|
|
236950
|
-
[recipient,
|
|
237183
|
+
[recipient, at2]
|
|
236951
237184
|
);
|
|
236952
237185
|
return r.rowCount ?? 0;
|
|
236953
237186
|
}
|
|
@@ -237055,11 +237288,11 @@ async function buildAudit(source, q2 = {}, model) {
|
|
|
237055
237288
|
items.push(model && titleOf ? enrichAudit(entry, model, titleOf, anchors) : entry);
|
|
237056
237289
|
lastCursor = cursor;
|
|
237057
237290
|
};
|
|
237058
|
-
const match = (actor, kind,
|
|
237291
|
+
const match = (actor, kind, at2) => {
|
|
237059
237292
|
if (q2.actor && actor !== q2.actor) return false;
|
|
237060
237293
|
if (q2.kind && kind !== q2.kind) return false;
|
|
237061
|
-
if (q2.from &&
|
|
237062
|
-
if (q2.to &&
|
|
237294
|
+
if (q2.from && at2 !== void 0 && at2 < q2.from) return false;
|
|
237295
|
+
if (q2.to && at2 !== void 0 && at2 > q2.to) return false;
|
|
237063
237296
|
return true;
|
|
237064
237297
|
};
|
|
237065
237298
|
if (q2.latest) {
|
|
@@ -238491,8 +238724,8 @@ var init_statistics = __esm({
|
|
|
238491
238724
|
this.active = true;
|
|
238492
238725
|
for (const s2 of v2.segments) this.amount.addSegment(s2);
|
|
238493
238726
|
this.flags.addView(v2);
|
|
238494
|
-
const
|
|
238495
|
-
if (!this.firstRun ||
|
|
238727
|
+
const at2 = v2.run.runtimeStartedAt ?? v2.run.startedAt;
|
|
238728
|
+
if (!this.firstRun || at2 < (this.firstRun.runtimeStartedAt ?? this.firstRun.startedAt)) this.firstRun = v2.run;
|
|
238496
238729
|
}
|
|
238497
238730
|
addCell(o) {
|
|
238498
238731
|
if (!o.active) return;
|
|
@@ -240973,8 +241206,8 @@ var init_service6 = __esm({
|
|
|
240973
241206
|
return this.isPast(inv.expiresAt);
|
|
240974
241207
|
}
|
|
240975
241208
|
/** 统一时间源下「这个时刻过去了没有」。邀请与链接共用,避免两处各写一次比较。 */
|
|
240976
|
-
isPast(
|
|
240977
|
-
return Date.parse(
|
|
241209
|
+
isPast(at2) {
|
|
241210
|
+
return Date.parse(at2) <= Date.parse(this.now());
|
|
240978
241211
|
}
|
|
240979
241212
|
async requireCompany(companyId) {
|
|
240980
241213
|
const c = await this.store.getCompany(companyId);
|
|
@@ -241064,7 +241297,7 @@ var init_offboarding = __esm({
|
|
|
241064
241297
|
throw new CompanyError(409, "LAST_OWNER", "\u516C\u53F8\u81F3\u5C11\u8981\u7559 1 \u4E2A owner\uFF0C\u4E0D\u80FD\u79FB\u9664\u6700\u540E\u4E00\u4E2A owner");
|
|
241065
241298
|
}
|
|
241066
241299
|
const { ownedAgents, inFlight } = await this.snapshot(companyId, accountId);
|
|
241067
|
-
const
|
|
241300
|
+
const at2 = this.now();
|
|
241068
241301
|
const started = await this.store.startMemberOffboarding({
|
|
241069
241302
|
operationId: `off:${(0, import_node_crypto58.randomUUID)()}`,
|
|
241070
241303
|
companyId,
|
|
@@ -241077,8 +241310,8 @@ var init_offboarding = __esm({
|
|
|
241077
241310
|
inFlightAssignments: inFlight,
|
|
241078
241311
|
agentDecisions: [],
|
|
241079
241312
|
assignmentDecisions: [],
|
|
241080
|
-
createdAt:
|
|
241081
|
-
updatedAt:
|
|
241313
|
+
createdAt: at2,
|
|
241314
|
+
updatedAt: at2
|
|
241082
241315
|
});
|
|
241083
241316
|
let op = started.operation;
|
|
241084
241317
|
if (!started.created) {
|
|
@@ -241087,7 +241320,7 @@ var init_offboarding = __esm({
|
|
|
241087
241320
|
op.operationId,
|
|
241088
241321
|
op.version,
|
|
241089
241322
|
{ ownedAgents: ownedAgents.map((a) => a.id), inFlightAssignments: inFlight },
|
|
241090
|
-
|
|
241323
|
+
at2
|
|
241091
241324
|
);
|
|
241092
241325
|
if (refreshed.ok) op = refreshed.operation;
|
|
241093
241326
|
else if (refreshed.reason === "stale") op = refreshed.current;
|
|
@@ -241768,9 +242001,9 @@ function looksLikeEmail(s2) {
|
|
|
241768
242001
|
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s2);
|
|
241769
242002
|
}
|
|
241770
242003
|
function maskEmail(email2) {
|
|
241771
|
-
const
|
|
241772
|
-
if (
|
|
241773
|
-
return `${email2[0]}***${email2.slice(
|
|
242004
|
+
const at2 = email2.indexOf("@");
|
|
242005
|
+
if (at2 <= 0) return "***";
|
|
242006
|
+
return `${email2[0]}***${email2.slice(at2)}`;
|
|
241774
242007
|
}
|
|
241775
242008
|
function createAuth(opts) {
|
|
241776
242009
|
const now = opts.now ?? (() => Date.now());
|
|
@@ -242478,8 +242711,8 @@ function runtimeActivityQueryOf(query) {
|
|
|
242478
242711
|
timeZone: query.get("timeZone") ?? void 0
|
|
242479
242712
|
};
|
|
242480
242713
|
}
|
|
242481
|
-
function bucketIndexOf(slice,
|
|
242482
|
-
const ms = Date.parse(
|
|
242714
|
+
function bucketIndexOf(slice, at2) {
|
|
242715
|
+
const ms = Date.parse(at2);
|
|
242483
242716
|
const { buckets, window: window3 } = slice.resolved;
|
|
242484
242717
|
if (!Number.isFinite(ms) || ms < Date.parse(window3.from) || ms > Date.parse(window3.to)) return -1;
|
|
242485
242718
|
for (let i = buckets.length - 1; i >= 0; i--) {
|
|
@@ -243790,8 +244023,8 @@ function notificationSourceKey(model, item) {
|
|
|
243790
244023
|
return gen ? `${base}@${gen}` : base;
|
|
243791
244024
|
}
|
|
243792
244025
|
function generationOfKey(sourceKey) {
|
|
243793
|
-
const
|
|
243794
|
-
return
|
|
244026
|
+
const at2 = sourceKey.lastIndexOf("@");
|
|
244027
|
+
return at2 >= 0 ? sourceKey.slice(at2 + 1) : void 0;
|
|
243795
244028
|
}
|
|
243796
244029
|
function workNumber(workId) {
|
|
243797
244030
|
const m2 = /:(\d+)$/.exec(workId);
|
|
@@ -243820,7 +244053,7 @@ function classifyClosure(row, facts) {
|
|
|
243820
244053
|
const item = row.item;
|
|
243821
244054
|
const onNode = (rec2) => node2 !== null && nodeOfEvent(rec2) === node2;
|
|
243822
244055
|
const evs = facts.events;
|
|
243823
|
-
const
|
|
244056
|
+
const at2 = (rec2) => rec2.createdAt;
|
|
243824
244057
|
if (row.kind === "change-confirm" && facts.draftOutcome) {
|
|
243825
244058
|
const o = facts.draftOutcome;
|
|
243826
244059
|
if (o.invalidated) return o.by === me ? handled2(me, "\u5DF2\u5904\u7406", facts.now) : invalidated("handled-by-other", facts.now, o.by);
|
|
@@ -243835,12 +244068,12 @@ function classifyClosure(row, facts) {
|
|
|
243835
244068
|
const e = payload(rec2, "plan.delete_node");
|
|
243836
244069
|
return !!e && e.nodeId === node2 && e.sealReason === "cancelled";
|
|
243837
244070
|
});
|
|
243838
|
-
if (sealCancel) add({ rec: sealCancel, closure: invalidated(facts.workorderCancelled ? "workorder-cancelled" : "node-cancelled",
|
|
244071
|
+
if (sealCancel) add({ rec: sealCancel, closure: invalidated(facts.workorderCancelled ? "workorder-cancelled" : "node-cancelled", at2(sealCancel), sealCancel.actorId) });
|
|
243839
244072
|
const deleted = evs.find((rec2) => {
|
|
243840
244073
|
const e = payload(rec2, "plan.delete_node");
|
|
243841
244074
|
return !!e && e.nodeId === node2 && e.sealReason !== "accepted" && e.sealReason !== "cancelled";
|
|
243842
244075
|
});
|
|
243843
|
-
if (deleted) add({ rec: deleted, closure: invalidated("node-cancelled",
|
|
244076
|
+
if (deleted) add({ rec: deleted, closure: invalidated("node-cancelled", at2(deleted), deleted.actorId) });
|
|
243844
244077
|
add(resolvedByOther(row, evs, me, onNode));
|
|
243845
244078
|
const gen = generationOfKey(row.sourceKey);
|
|
243846
244079
|
if (gen) {
|
|
@@ -243852,7 +244085,7 @@ function classifyClosure(row, facts) {
|
|
|
243852
244085
|
const s2 = payload(rec2, "work.submit_output");
|
|
243853
244086
|
return !!s2 && nodeOfWork(s2.workId) === node2 && isNewer(s2.workId);
|
|
243854
244087
|
});
|
|
243855
|
-
if (newer) add({ rec: newer, closure: invalidated("superseded",
|
|
244088
|
+
if (newer) add({ rec: newer, closure: invalidated("superseded", at2(newer), newer.actorId) });
|
|
243856
244089
|
}
|
|
243857
244090
|
const reassign = evs.find((rec2) => {
|
|
243858
244091
|
const a = payload(rec2, "plan.assign_actor");
|
|
@@ -243860,7 +244093,7 @@ function classifyClosure(row, facts) {
|
|
|
243860
244093
|
const r = payload(rec2, "plan.update_review_requirements");
|
|
243861
244094
|
return !!r && r.nodeId === node2 && reviewKinds.has(row.kind) && !r.reviewers.some((x2) => x2.reviewerActorId === me);
|
|
243862
244095
|
});
|
|
243863
|
-
if (reassign) add({ rec: reassign, closure: invalidated("reassigned",
|
|
244096
|
+
if (reassign) add({ rec: reassign, closure: invalidated("reassigned", at2(reassign), reassign.actorId) });
|
|
243864
244097
|
const myReviewPrefix = gen ? `rv:${gen}:${me}:` : void 0;
|
|
243865
244098
|
const withdrawn = evs.find((rec2) => {
|
|
243866
244099
|
const k2 = payload(rec2, "review.kill") ?? payload(rec2, "review.timeout");
|
|
@@ -243868,7 +244101,7 @@ function classifyClosure(row, facts) {
|
|
|
243868
244101
|
if (item?.waitingRowId !== void 0 && k2.reviewId === item.waitingRowId) return true;
|
|
243869
244102
|
return row.kind === "review-request" && !!myReviewPrefix && k2.reviewId.startsWith(myReviewPrefix);
|
|
243870
244103
|
});
|
|
243871
|
-
if (withdrawn) add({ rec: withdrawn, closure: invalidated("source-changed",
|
|
244104
|
+
if (withdrawn) add({ rec: withdrawn, closure: invalidated("source-changed", at2(withdrawn), withdrawn.actorId) });
|
|
243872
244105
|
const first = evidence.reduce((best, f2) => !best || f2.rec.seq < best.rec.seq ? f2 : best, null);
|
|
243873
244106
|
if (first) return first.closure;
|
|
243874
244107
|
if (facts.workorderCancelled) return invalidated("workorder-cancelled", facts.now);
|
|
@@ -244000,8 +244233,8 @@ var init_notification_ledger = __esm({
|
|
|
244000
244233
|
"issue.resolve"
|
|
244001
244234
|
];
|
|
244002
244235
|
payload = (rec2, kind) => rec2.event.kind === kind ? rec2.event : null;
|
|
244003
|
-
handled2 = (closedBy, result,
|
|
244004
|
-
invalidated = (invalidReason,
|
|
244236
|
+
handled2 = (closedBy, result, at2) => ({ status: "handled", closedAt: at2, closedBy, result });
|
|
244237
|
+
invalidated = (invalidReason, at2, closedBy) => ({ status: "invalidated", closedAt: at2, invalidReason, ...closedBy ? { closedBy } : {} });
|
|
244005
244238
|
found = (rec2, closure) => ({ rec: rec2, closure });
|
|
244006
244239
|
ownerKinds = /* @__PURE__ */ new Set(["assigned", "rework", "stale", "pushback", "work-waiting"]);
|
|
244007
244240
|
reviewKinds = /* @__PURE__ */ new Set(["review-request", "review-waiting"]);
|
|
@@ -244642,14 +244875,14 @@ function classifyGitError(fallback, err, where) {
|
|
|
244642
244875
|
const raw = err;
|
|
244643
244876
|
const msg = String(raw.stderr ?? raw.message ?? err).trim();
|
|
244644
244877
|
if (/bad permissions|invalid format|could not read Username|permission denied|authentication failed|publickey/i.test(msg)) {
|
|
244645
|
-
return new GitReadonlyBundleError("CREDENTIAL_FORMAT_ERROR", `git \u51ED\u8BC1\u683C\u5F0F\u6216\u8BA4\u8BC1\u5931\u8D25\uFF08${where}\uFF09\uFF1A${
|
|
244878
|
+
return new GitReadonlyBundleError("CREDENTIAL_FORMAT_ERROR", `git \u51ED\u8BC1\u683C\u5F0F\u6216\u8BA4\u8BC1\u5931\u8D25\uFF08${where}\uFF09\uFF1A${oneLine2(msg)}`);
|
|
244646
244879
|
}
|
|
244647
244880
|
if (/not our ref|unadvertised object|reference is not a tree|could not parse|bad object|Not a valid object name|did not match any file/i.test(msg)) {
|
|
244648
|
-
return new GitReadonlyBundleError("COMMIT_NOT_FOUND", `\u76EE\u6807 commit \u4E0D\u5B58\u5728\u6216\u4E0D\u53EF\u8BFB\uFF08${where}\uFF09\uFF1A${
|
|
244881
|
+
return new GitReadonlyBundleError("COMMIT_NOT_FOUND", `\u76EE\u6807 commit \u4E0D\u5B58\u5728\u6216\u4E0D\u53EF\u8BFB\uFF08${where}\uFF09\uFF1A${oneLine2(msg)}`);
|
|
244649
244882
|
}
|
|
244650
|
-
return new GitReadonlyBundleError(fallback, `git ${fallback}\uFF08${where}\uFF09\uFF1A${
|
|
244883
|
+
return new GitReadonlyBundleError(fallback, `git ${fallback}\uFF08${where}\uFF09\uFF1A${oneLine2(msg)}`);
|
|
244651
244884
|
}
|
|
244652
|
-
function
|
|
244885
|
+
function oneLine2(msg) {
|
|
244653
244886
|
return msg.split("\n").map((s2) => s2.trim()).filter(Boolean).slice(0, 3).join(" ");
|
|
244654
244887
|
}
|
|
244655
244888
|
var import_node_child_process16, import_node_crypto62, fs27, os8, path24, GitReadonlyBundleError, HEX40, FETCH_TIMEOUT_MS2;
|
|
@@ -247110,6 +247343,86 @@ var init_execution_continuity2 = __esm({
|
|
|
247110
247343
|
}
|
|
247111
247344
|
});
|
|
247112
247345
|
|
|
247346
|
+
// ../server/src/domains/collab/escalation-opening-body.ts
|
|
247347
|
+
function retryFacts(body2) {
|
|
247348
|
+
const n = num3(/连续\s*(\d+)\s*次执行失败/.exec(body2)?.[1]);
|
|
247349
|
+
const reason = /末次失败原因(原文):([^\n]+)/.exec(body2)?.[1]?.trim();
|
|
247350
|
+
return { ...n !== void 0 ? { count: { n, unit: "\u8F6E" } } : {}, ...reason ? { lastReason: firstSentence2(reason) } : {} };
|
|
247351
|
+
}
|
|
247352
|
+
function reviewFacts(body2) {
|
|
247353
|
+
const n = num3(/评审连续\s*(\d+)\s*次失败/.exec(body2)?.[1]);
|
|
247354
|
+
return n !== void 0 ? { count: { n, unit: "\u8F6E" } } : {};
|
|
247355
|
+
}
|
|
247356
|
+
function stallFacts(body2) {
|
|
247357
|
+
const rounds = num3(/(?:跑了|有)\s*(\d+)\s*轮/.exec(body2)?.[1]);
|
|
247358
|
+
const runs = rounds === void 0 ? num3(/(?:跑了|累计有)\s*(\d+)\s*次/.exec(body2)?.[1]) : void 0;
|
|
247359
|
+
const minutes = num3(/最近\s*(\d+)\s*分钟/.exec(body2)?.[1]);
|
|
247360
|
+
const rawCost = /约\s*\$([\d.]+)/.exec(body2)?.[1];
|
|
247361
|
+
const cost = rawCost !== void 0 && Number.isFinite(Number(rawCost)) ? `$${Number(rawCost).toFixed(2)}` : void 0;
|
|
247362
|
+
const remark = body2.split("\u6700\u8FD1\u4E00\u6B21\u8FD0\u884C\u7684\u6536\u5C3E\u53D1\u8A00\uFF08\u5F80\u5F80\u76F4\u63A5\u5199\u7740\u5361\u5728\u54EA\uFF09\uFF1A\n")[1]?.trim();
|
|
247363
|
+
const who = /^(执行人|评审员)\s+(actor:\S+)/.exec(body2.trim());
|
|
247364
|
+
return {
|
|
247365
|
+
...rounds !== void 0 ? { count: { n: rounds, unit: "\u8F6E" } } : runs !== void 0 ? { count: { n: runs, unit: "\u6B21\u8FD0\u884C" } } : {},
|
|
247366
|
+
...minutes !== void 0 ? { minutes } : {},
|
|
247367
|
+
...cost ? { cost } : {},
|
|
247368
|
+
...remark ? { remark } : {},
|
|
247369
|
+
...who ? { actorId: who[2], stalled: who[1] === "\u8BC4\u5BA1\u5458" ? "review" : "produce" } : {}
|
|
247370
|
+
};
|
|
247371
|
+
}
|
|
247372
|
+
function firstSentence2(text7) {
|
|
247373
|
+
const stripped = text7.replace(/^\s*\[[^\]]*\]\s*/, "").trim();
|
|
247374
|
+
return stripped.split(/[。!?\n]/)[0].trim() || stripped;
|
|
247375
|
+
}
|
|
247376
|
+
function stalledActorIdOf(kind, body2) {
|
|
247377
|
+
return kind === "output_stall" ? stallFacts(body2).actorId : void 0;
|
|
247378
|
+
}
|
|
247379
|
+
function renderEscalationOpeningBody(facts) {
|
|
247380
|
+
const body2 = facts.body.trim();
|
|
247381
|
+
if (facts.kind === "manual") return body2;
|
|
247382
|
+
if (facts.kind === "retry_exhausted") {
|
|
247383
|
+
const { count: count3, lastReason } = retryFacts(body2);
|
|
247384
|
+
if (!count3) return body2;
|
|
247385
|
+
return [
|
|
247386
|
+
`${facts.actorName ?? "\u8FD9\u4E00\u6B65\u7684\u6267\u884C\u4EBA"}${at(facts.nodeLabel)}\u8FDE\u7EED ${count3.n} \u8F6E\u90FD\u6CA1\u8DD1\u6210\uFF0C\u81EA\u52A8\u91CD\u8BD5\u5DF2\u7ECF\u7528\u5B8C\u2014\u2014\u8FD9\u4E00\u6B65\u4E0D\u4F1A\u518D\u81EA\u52A8\u91CD\u6765\u4E86\u3002`,
|
|
247387
|
+
...lastReason ? [`\u6700\u540E\u4E00\u6B21\u5931\u8D25\u8BB0\u4E0B\u7684\u539F\u56E0\uFF1A${lastReason}`] : [],
|
|
247388
|
+
"\u9700\u8981\u4F60\u5B9A\u4E00\u4E0B\u63A5\u4E0B\u6765\u600E\u4E48\u529E\uFF1A\u6309\u539F\u65B9\u6848\u518D\u8BD5\u4E00\u6B21\u3001\u6539\u4E86\u4EFB\u52A1\u8BF4\u660E\u518D\u8DD1\uFF0C\u8FD8\u662F\u6362\u4E2A\u4EBA\u505A\u3002"
|
|
247389
|
+
].join("\n\n");
|
|
247390
|
+
}
|
|
247391
|
+
if (facts.kind === "review_exhausted") {
|
|
247392
|
+
const { count: count3 } = reviewFacts(body2);
|
|
247393
|
+
if (!count3) return body2;
|
|
247394
|
+
return [
|
|
247395
|
+
`\u300A${facts.nodeLabel ?? "\u8FD9\u4E00\u6B65"}\u300B\u7684\u8BC4\u5BA1\u8FDE\u7EED ${count3.n} ${count3.unit}\u6CA1\u6536\u9F50\uFF0C\u8FD9\u4E00\u8F6E\u8BC4\u5BA1\u5DF2\u7ECF\u505C\u4E0B\u6765\u4E86\u3002`,
|
|
247396
|
+
"\u9700\u8981\u4F60\u5B9A\u4E00\u4E0B\u63A5\u4E0B\u6765\u600E\u4E48\u529E\uFF1A\u91CD\u5F00\u4E00\u8F6E\u8BC4\u5BA1\u3001\u6362\u8BC4\u5BA1\u4EBA\uFF0C\u8FD8\u662F\u6309\u73B0\u72B6\u5148\u653E\u884C\u3002"
|
|
247397
|
+
].join("\n\n");
|
|
247398
|
+
}
|
|
247399
|
+
const { count: count2, minutes, cost, remark, stalled } = stallFacts(body2);
|
|
247400
|
+
if (!count2) return body2;
|
|
247401
|
+
const subject = stalled ? `${facts.actorName ?? (stalled === "review" ? "\u8FD9\u4E00\u6B65\u7684\u8BC4\u5BA1\u5458" : "\u8FD9\u4E00\u6B65\u7684\u6267\u884C\u4EBA")}${at(facts.nodeLabel)}` : `\u300A${facts.nodeLabel ?? "\u8FD9\u4E00\u6B65"}\u300B`;
|
|
247402
|
+
const window3 = minutes !== void 0 ? `\u6700\u8FD1 ${minutes} \u5206\u949F\u91CC` : "\u6700\u8FD1\u4E00\u6BB5\u65F6\u95F4\u91CC";
|
|
247403
|
+
const spent = cost ? `\uFF08\u8FD9\u4E9B\u7A7A\u8DD1\u5408\u8BA1\u5DF2\u7ECF\u82B1\u6389\u7EA6 ${cost}\uFF09` : "";
|
|
247404
|
+
const each = count2.unit === "\u8F6E" ? "\u6BCF\u4E00\u8F6E" : "\u6BCF\u4E00\u6B21";
|
|
247405
|
+
const stopped = stalled === "review" ? "\u7CFB\u7EDF\u5DF2\u7ECF\u505C\u6389\u8FD9\u540D\u8BC4\u5BA1\u5458\u5728\u8FD9\u4E00\u6B65\u4E0A\u7684\u8BC4\u5BA1\u2014\u2014\u4EA4\u4ED8\u5185\u5BB9\u539F\u6837\u4FDD\u7559\uFF0C\u6062\u590D\u4E4B\u540E\u53EF\u4EE5\u63A5\u7740\u6295\u7968\u3002" : "\u7CFB\u7EDF\u5DF2\u7ECF\u5148\u628A\u8FD9\u4E00\u6B65\u7684\u6D3E\u53D1\u6682\u505C\u4E0B\u6765\u6B62\u635F\u3002";
|
|
247406
|
+
return [
|
|
247407
|
+
`${subject}${window3}${stalled === "review" ? "\u8BC4\u5BA1\u4E86" : "\u8DD1\u4E86"} ${count2.n} ${count2.unit}\uFF0C${each}\u90FD\u4EC0\u4E48\u90FD\u6CA1\u4EA4\u51FA\u6765${spent}\u3002${stopped}`,
|
|
247408
|
+
...remark ? [`\u5B83\u6700\u540E\u4E00\u6B21\u8FD0\u884C\u7684\u6536\u5C3E\u53D1\u8A00\uFF08\u5F80\u5F80\u76F4\u63A5\u5199\u7740\u5361\u5728\u54EA\uFF09\uFF1A
|
|
247409
|
+
${remark}`] : [],
|
|
247410
|
+
"\u53CD\u590D\u96F6\u4EA7\u51FA\u901A\u5E38\u4E0D\u662F\u67D0\u4E00\u6B21\u8FD0\u884C\u5931\u8D25\uFF0C\u800C\u662F\u5361\u5728\u4E00\u4E2A\u518D\u8BD5\u4E5F\u8FC7\u4E0D\u53BB\u7684\u574E\u4E0A\u2014\u2014\u7F3A\u51ED\u636E\u3001\u8FDE\u4E0D\u4E0A\u5916\u90E8\u670D\u52A1\uFF0C\u6216\u8005\u9677\u8FDB\u4E86\u4E00\u4E2A\u6B7B\u5FAA\u73AF\u3002\u9700\u8981\u4F60\u770B\u4E00\u773C\u662F\u4EC0\u4E48\u5361\u4F4F\u4E86\uFF1B\u786E\u8BA4\u4E4B\u540E\u5728\u8FD9\u91CC\u544A\u8BC9\u6211\uFF0C\u6211\u6765\u628A\u8FD9\u4E00\u6B65\u6062\u590D\u3002"
|
|
247411
|
+
].join("\n\n");
|
|
247412
|
+
}
|
|
247413
|
+
var num3, at;
|
|
247414
|
+
var init_escalation_opening_body = __esm({
|
|
247415
|
+
"../server/src/domains/collab/escalation-opening-body.ts"() {
|
|
247416
|
+
"use strict";
|
|
247417
|
+
num3 = (v2) => {
|
|
247418
|
+
if (v2 === void 0) return void 0;
|
|
247419
|
+
const n = Number(v2);
|
|
247420
|
+
return Number.isFinite(n) ? n : void 0;
|
|
247421
|
+
};
|
|
247422
|
+
at = (nodeLabel2) => nodeLabel2 ? `\u5728\u300A${nodeLabel2}\u300B\u4E0A` : "\u5728\u8FD9\u4E00\u6B65\u4E0A";
|
|
247423
|
+
}
|
|
247424
|
+
});
|
|
247425
|
+
|
|
247113
247426
|
// ../server/src/domains/collab/escalation-opening.ts
|
|
247114
247427
|
function buildEscalationOpeningMessage(input) {
|
|
247115
247428
|
const escalationId = input.escalationId?.trim();
|
|
@@ -247117,30 +247430,43 @@ function buildEscalationOpeningMessage(input) {
|
|
|
247117
247430
|
const context2 = escalationContextOf(input.snap, escalationId);
|
|
247118
247431
|
const body2 = context2?.issue.body.trim();
|
|
247119
247432
|
if (!context2 || !body2) return null;
|
|
247120
|
-
const { issue: issue2, gap, recipientActorId } = context2;
|
|
247433
|
+
const { issue: issue2, gap, node: node2, kind, recipientActorId, agentId } = context2;
|
|
247121
247434
|
const name = input.ref(recipientActorId).name?.trim();
|
|
247122
247435
|
const gapBody = gap?.body.trim();
|
|
247123
247436
|
const gapMarker = gap ? `
|
|
247124
247437
|
|
|
247125
247438
|
[\u5173\u8054\u7F3A\u53E3] ${gap.id}` : "";
|
|
247126
|
-
const
|
|
247439
|
+
const rawBody = gapBody && gapMarker && body2.endsWith(gapMarker) ? body2.slice(0, -gapMarker.length).trimEnd() : body2;
|
|
247440
|
+
const actorId = stalledActorIdOf(kind, rawBody) ?? (kind === "retry_exhausted" ? issue2.authorActorId : void 0);
|
|
247441
|
+
const actorName = actorId ? input.ref(actorId).name?.trim() : void 0;
|
|
247442
|
+
const issueBody = renderEscalationOpeningBody({
|
|
247443
|
+
kind,
|
|
247444
|
+
body: rawBody,
|
|
247445
|
+
...node2?.title ? { nodeLabel: node2.title } : {},
|
|
247446
|
+
...actorName ? { actorName } : {}
|
|
247447
|
+
});
|
|
247127
247448
|
const content3 = `${name ? `@${name} ` : ""}${issueBody}${gapBody ? `
|
|
247128
247449
|
|
|
247129
247450
|
\u5173\u8054\u7F3A\u53E3\uFF1A
|
|
247130
247451
|
${gapBody}` : ""}`;
|
|
247452
|
+
const bySelf = !!agentId && issue2.authorActorId === agentId;
|
|
247131
247453
|
return {
|
|
247132
247454
|
id: `${ESCALATION_OPENING_ID_PREFIX}${escalationId}`,
|
|
247133
247455
|
sessionId: input.sessionId,
|
|
247134
247456
|
role: "assistant",
|
|
247135
247457
|
content: content3,
|
|
247136
247458
|
seq: -1,
|
|
247137
|
-
createdAt: issue2?.createdAt ?? input.fallbackAt
|
|
247459
|
+
createdAt: issue2?.createdAt ?? input.fallbackAt,
|
|
247460
|
+
// 裸 `actor:system` 就是内核的 `SYSTEM_ACTOR`(`core/src/kernel.ts`);契约侧同一个串以前缀常量给出。
|
|
247461
|
+
...bySelf ? {} : { authorActorId: SYSTEM_ACTOR_ID_PREFIX }
|
|
247138
247462
|
};
|
|
247139
247463
|
}
|
|
247140
247464
|
var ESCALATION_OPENING_ID_PREFIX;
|
|
247141
247465
|
var init_escalation_opening = __esm({
|
|
247142
247466
|
"../server/src/domains/collab/escalation-opening.ts"() {
|
|
247143
247467
|
"use strict";
|
|
247468
|
+
init_src();
|
|
247469
|
+
init_escalation_opening_body();
|
|
247144
247470
|
init_escalation_recipient();
|
|
247145
247471
|
ESCALATION_OPENING_ID_PREFIX = "synthetic:escalation-opening:";
|
|
247146
247472
|
}
|
|
@@ -247851,10 +248177,10 @@ function createChatSessionsDomain(opts) {
|
|
|
247851
248177
|
return { add: [], resolved: [] };
|
|
247852
248178
|
});
|
|
247853
248179
|
for (const itemId of projected.resolved) {
|
|
247854
|
-
const
|
|
247855
|
-
const entry = snapshotEntries[
|
|
248180
|
+
const at2 = snapshotEntries.findIndex((e) => e.itemId === itemId);
|
|
248181
|
+
const entry = snapshotEntries[at2];
|
|
247856
248182
|
const payload2 = entry?.payload && typeof entry.payload === "object" && !Array.isArray(entry.payload) ? entry.payload : null;
|
|
247857
|
-
if (entry && payload2) snapshotEntries[
|
|
248183
|
+
if (entry && payload2) snapshotEntries[at2] = { ...entry, payload: { ...payload2, resolved: true } };
|
|
247858
248184
|
}
|
|
247859
248185
|
const legacyCards = await legacySendFailureCards(snapshotEntries, {
|
|
247860
248186
|
turns,
|
|
@@ -247865,8 +248191,8 @@ function createChatSessionsDomain(opts) {
|
|
|
247865
248191
|
return [];
|
|
247866
248192
|
});
|
|
247867
248193
|
for (const { after, entry } of [...projected.add, ...legacyCards]) {
|
|
247868
|
-
const
|
|
247869
|
-
snapshotEntries.splice(
|
|
248194
|
+
const at2 = snapshotEntries.findIndex((e) => e.itemId === after);
|
|
248195
|
+
snapshotEntries.splice(at2 + 1, 0, entry);
|
|
247870
248196
|
}
|
|
247871
248197
|
}
|
|
247872
248198
|
const outputCards = await sessionOutputCards(snapshotEntries, store2, chatSessionId).catch((e) => {
|
|
@@ -247874,8 +248200,8 @@ function createChatSessionsDomain(opts) {
|
|
|
247874
248200
|
return [];
|
|
247875
248201
|
});
|
|
247876
248202
|
for (const { after, entry } of outputCards) {
|
|
247877
|
-
const
|
|
247878
|
-
snapshotEntries.splice(
|
|
248203
|
+
const at2 = snapshotEntries.findIndex((e) => e.itemId === after);
|
|
248204
|
+
snapshotEntries.splice(at2 + 1, 0, entry);
|
|
247879
248205
|
}
|
|
247880
248206
|
const oldestOrd = snapshotEntries.find((e) => e.ord !== null)?.ord ?? null;
|
|
247881
248207
|
const body2 = {
|
|
@@ -247984,6 +248310,8 @@ function createChatSessionsDomain(opts) {
|
|
|
247984
248310
|
for (const record9 of records) {
|
|
247985
248311
|
const expert = actors ? await actors.getActor(record9.expertActorId).catch(() => null) : null;
|
|
247986
248312
|
const touches = await ledger.listTouches(record9.id).catch(() => []);
|
|
248313
|
+
const artifacts = delegationArtifactsView(record9);
|
|
248314
|
+
const ending = delegationEndingOfRecord(record9, artifacts);
|
|
247987
248315
|
items.push({
|
|
247988
248316
|
id: record9.id,
|
|
247989
248317
|
childSessionId: record9.childSessionId,
|
|
@@ -247994,8 +248322,10 @@ function createChatSessionsDomain(opts) {
|
|
|
247994
248322
|
...expert?.avatar ? { expertAvatar: expert.avatar } : {},
|
|
247995
248323
|
state: record9.state,
|
|
247996
248324
|
...record9.failureKind ? { failureKind: record9.failureKind } : {},
|
|
247997
|
-
/* 给人看的那一档由服务端算(Bug 0221):委派卡、徽章、子会话面板三处渲染同一个值。
|
|
247998
|
-
|
|
248325
|
+
/* 给人看的那一档由服务端算(Bug 0221):委派卡、徽章、子会话面板三处渲染同一个值。
|
|
248326
|
+
**还在跑的不下发**(Bug 0234):`ending` 是收口那一刻的说法,给一条 `running` 的委派
|
|
248327
|
+
配上「已完成」,卡头(读 `state`)与展开行(读 `ending`)就会当场自相矛盾。 */
|
|
248328
|
+
...ending ? { ending } : {},
|
|
247999
248329
|
settledSeq: record9.settledSeq,
|
|
248000
248330
|
...record9.label ? { label: record9.label } : {},
|
|
248001
248331
|
...record9.taskDigest ? { taskDigest: record9.taskDigest } : {},
|
|
@@ -248007,7 +248337,7 @@ function createChatSessionsDomain(opts) {
|
|
|
248007
248337
|
touches: touches.map((t) => ({ messageId: touchAnchorMessageId(t.messageId), kind: t.kind, at: t.at })),
|
|
248008
248338
|
/* 与协调者读口**同一个函数**——两侧 artifacts 有「逐字同源」的既有断言。它顺带给每份产物
|
|
248009
248339
|
填上 `childMessageId`(子会话面板把产出卡挂到产出它的那一轮下面要用)。 */
|
|
248010
|
-
artifacts
|
|
248340
|
+
artifacts,
|
|
248011
248341
|
replyAnchors: delegationReplyAnchors(record9),
|
|
248012
248342
|
createdAt: record9.createdAt,
|
|
248013
248343
|
...record9.settledAt ? { settledAt: record9.settledAt } : {}
|
|
@@ -248318,26 +248648,26 @@ function createChatSessionsDomain(opts) {
|
|
|
248318
248648
|
throw new ApiError(409, "STALE_OUTPUT", "\u8BE5\u6587\u4EF6\u5DF2\u88AB\u66F4\u65B0\u8FC7\uFF0C\u8BF7\u91CD\u65B0\u6253\u5F00\u540E\u518D\u4FDD\u5B58");
|
|
248319
248649
|
}
|
|
248320
248650
|
const blobRef2 = await blobAccess.put(new Uint8Array(bytes2));
|
|
248321
|
-
const
|
|
248651
|
+
const at2 = (/* @__PURE__ */ new Date()).toISOString();
|
|
248322
248652
|
await store2.mergeOutputCopies(session.id, [{
|
|
248323
248653
|
path: path44,
|
|
248324
248654
|
name: name2,
|
|
248325
248655
|
blobRef: blobRef2,
|
|
248326
248656
|
contentType: copy.contentType ?? null,
|
|
248327
248657
|
size: bytes2.byteLength,
|
|
248328
|
-
mtime:
|
|
248329
|
-
copiedAt:
|
|
248330
|
-
editedAt:
|
|
248658
|
+
mtime: at2,
|
|
248659
|
+
copiedAt: at2,
|
|
248660
|
+
editedAt: at2
|
|
248331
248661
|
}]);
|
|
248332
248662
|
const fingerprints = await store2.readOutputFingerprints(session.id) ?? {};
|
|
248333
|
-
await store2.writeOutputFingerprints(session.id, { ...fingerprints, [path44]: { size: bytes2.byteLength, mtime:
|
|
248663
|
+
await store2.writeOutputFingerprints(session.id, { ...fingerprints, [path44]: { size: bytes2.byteLength, mtime: at2 } });
|
|
248334
248664
|
const item2 = {
|
|
248335
248665
|
id: `workdir:${path44}`,
|
|
248336
248666
|
name: name2,
|
|
248337
248667
|
kind: "file",
|
|
248338
248668
|
content_type: copy.contentType ?? null,
|
|
248339
248669
|
size: bytes2.byteLength,
|
|
248340
|
-
updated_at:
|
|
248670
|
+
updated_at: at2,
|
|
248341
248671
|
source: "output",
|
|
248342
248672
|
blob_ref: blobRef2,
|
|
248343
248673
|
path: path44,
|
|
@@ -248611,6 +248941,63 @@ var init_chat_sessions2 = __esm({
|
|
|
248611
248941
|
}
|
|
248612
248942
|
});
|
|
248613
248943
|
|
|
248944
|
+
// ../server/src/domains/chat-sessions/agent-default-runtime-store.ts
|
|
248945
|
+
function completeOverride(s2) {
|
|
248946
|
+
const nodeId = s2.overrideNodeId?.trim();
|
|
248947
|
+
const runtimeKind = s2.overrideRuntimeKind?.trim();
|
|
248948
|
+
return nodeId && runtimeKind ? { nodeId, runtimeKind } : null;
|
|
248949
|
+
}
|
|
248950
|
+
async function agentDefaultRuntimeForNewSession(s2, deps) {
|
|
248951
|
+
if (completeOverride(s2)) return null;
|
|
248952
|
+
const resolvers = deps.resolvers();
|
|
248953
|
+
if (!resolvers) return null;
|
|
248954
|
+
const companyId = s2.companyId ?? deps.companyId();
|
|
248955
|
+
const binding = await resolvers.resolveBinding(companyId, s2.aiActorId).catch(() => null);
|
|
248956
|
+
let agentModel = null;
|
|
248957
|
+
try {
|
|
248958
|
+
agentModel = resolvers.resolveActorModel ? await resolvers.resolveActorModel(companyId, s2.aiActorId) : null;
|
|
248959
|
+
} catch {
|
|
248960
|
+
agentModel = null;
|
|
248961
|
+
}
|
|
248962
|
+
return chatSessionInitialRuntime({
|
|
248963
|
+
binding,
|
|
248964
|
+
agentModel,
|
|
248965
|
+
requested: {
|
|
248966
|
+
// 半条覆盖按「没给」处理(规矩 1 后半句);完整的那一支上面已经返回了。
|
|
248967
|
+
override: null,
|
|
248968
|
+
/* 记录上已经**显式**带了 `model` 就尊重它(`POST /api/chat-sessions` 走完三态判断之后落下来的
|
|
248969
|
+
就是这一支:`null` 在那儿的意思是「用户明确选了跟随运行时默认」,不许被员工配置顶掉)。
|
|
248970
|
+
没带这一项(其余入口都不带)= 没人表达过意见 → 抄员工那一页配的型号。 */
|
|
248971
|
+
...s2.model !== void 0 ? { model: s2.model } : {}
|
|
248972
|
+
}
|
|
248973
|
+
});
|
|
248974
|
+
}
|
|
248975
|
+
function withAgentDefaultRuntime(store, deps) {
|
|
248976
|
+
const createSession = async (s2) => {
|
|
248977
|
+
let patched = s2;
|
|
248978
|
+
try {
|
|
248979
|
+
const initial = await agentDefaultRuntimeForNewSession(s2, deps);
|
|
248980
|
+
if (initial) patched = { ...s2, ...initial };
|
|
248981
|
+
} catch (err) {
|
|
248982
|
+
console.warn(`[chat-session] \u6284\u5458\u5DE5\u9ED8\u8BA4\u8FD0\u884C\u914D\u7F6E\u5931\u8D25\uFF08\u672C\u6761\u4F1A\u8BDD\u4E09\u5217\u7559\u7A7A\uFF0C\u4E0D\u5F71\u54CD\u5EFA\u4F1A\u8BDD\uFF09\uFF1A${String(err)}`);
|
|
248983
|
+
}
|
|
248984
|
+
return store.createSession(patched);
|
|
248985
|
+
};
|
|
248986
|
+
return new Proxy(store, {
|
|
248987
|
+
get(target, prop, _receiver) {
|
|
248988
|
+
if (prop === "createSession") return createSession;
|
|
248989
|
+
const value2 = Reflect.get(target, prop, target);
|
|
248990
|
+
return typeof value2 === "function" ? value2.bind(target) : value2;
|
|
248991
|
+
}
|
|
248992
|
+
});
|
|
248993
|
+
}
|
|
248994
|
+
var init_agent_default_runtime_store = __esm({
|
|
248995
|
+
"../server/src/domains/chat-sessions/agent-default-runtime-store.ts"() {
|
|
248996
|
+
"use strict";
|
|
248997
|
+
init_session_runtime_target();
|
|
248998
|
+
}
|
|
248999
|
+
});
|
|
249000
|
+
|
|
248614
249001
|
// ../server/src/domains/playbooks/registry.ts
|
|
248615
249002
|
function deriveGraph(structure, filerReviews) {
|
|
248616
249003
|
const idOf = (n) => `${n.type}:${n.title}`;
|
|
@@ -249983,11 +250370,11 @@ function validateTitleTemplate(tpl) {
|
|
|
249983
250370
|
const unknown2 = residue.match(/\{\{[^}]*\}\}/);
|
|
249984
250371
|
return unknown2 ? unknown2[0] : null;
|
|
249985
250372
|
}
|
|
249986
|
-
function renderDate(
|
|
250373
|
+
function renderDate(at2, tz) {
|
|
249987
250374
|
try {
|
|
249988
|
-
return new Intl.DateTimeFormat("en-CA", { timeZone: tz || "UTC", year: "numeric", month: "2-digit", day: "2-digit" }).format(
|
|
250375
|
+
return new Intl.DateTimeFormat("en-CA", { timeZone: tz || "UTC", year: "numeric", month: "2-digit", day: "2-digit" }).format(at2);
|
|
249989
250376
|
} catch {
|
|
249990
|
-
return
|
|
250377
|
+
return at2.toISOString().slice(0, 10);
|
|
249991
250378
|
}
|
|
249992
250379
|
}
|
|
249993
250380
|
function eventCommandKey(runId) {
|
|
@@ -250787,8 +251174,8 @@ var init_service9 = __esm({
|
|
|
250787
251174
|
EVENT_RETRY_MAX_ATTEMPTS = 5;
|
|
250788
251175
|
eventAttempts = (run) => eventDispatchState(run).attempts ?? 0;
|
|
250789
251176
|
eventLastAttemptAt = (run) => {
|
|
250790
|
-
const
|
|
250791
|
-
return
|
|
251177
|
+
const at2 = eventDispatchState(run).lastAttemptAt;
|
|
251178
|
+
return at2 ? Date.parse(at2) : null;
|
|
250792
251179
|
};
|
|
250793
251180
|
eventLastError = (run) => eventDispatchState(run).lastError ?? null;
|
|
250794
251181
|
CHAT_REPLY_MAX = 2e4;
|
|
@@ -253188,14 +253575,14 @@ function isExplicitlyDispatchFenced(run) {
|
|
|
253188
253575
|
const fence = metadataObject(run.metadata).dispatchFence;
|
|
253189
253576
|
return fence !== null && typeof fence === "object" && !Array.isArray(fence);
|
|
253190
253577
|
}
|
|
253191
|
-
async function fenceDispatch(trace, dispatchId, reason,
|
|
253578
|
+
async function fenceDispatch(trace, dispatchId, reason, at2 = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
253192
253579
|
const run = await trace.getRun(dispatchId);
|
|
253193
253580
|
if (!run) return false;
|
|
253194
253581
|
if (isExplicitlyDispatchFenced(run)) return true;
|
|
253195
253582
|
await trace.updateRun(dispatchId, {
|
|
253196
253583
|
metadata: {
|
|
253197
253584
|
...metadataObject(run.metadata),
|
|
253198
|
-
dispatchFence: { at, reason }
|
|
253585
|
+
dispatchFence: { at: at2, reason }
|
|
253199
253586
|
}
|
|
253200
253587
|
});
|
|
253201
253588
|
return true;
|
|
@@ -256528,13 +256915,13 @@ var init_postgres_assistant_store = __esm({
|
|
|
256528
256915
|
}
|
|
256529
256916
|
async backfillAllHumansOn(humanIds, byActor2) {
|
|
256530
256917
|
if (humanIds.length === 0) return { inserted: 0, skipped: 0 };
|
|
256531
|
-
const
|
|
256918
|
+
const at2 = (/* @__PURE__ */ new Date()).toISOString();
|
|
256532
256919
|
let inserted = 0;
|
|
256533
256920
|
for (const id of humanIds) {
|
|
256534
256921
|
const r = await this.pool.query(
|
|
256535
256922
|
`INSERT INTO ${this.s}.human_prefs (human_actor_id, auto_assign_assistant, updated_at, updated_by)
|
|
256536
256923
|
VALUES ($1, true, $2, $3) ON CONFLICT (human_actor_id) DO NOTHING`,
|
|
256537
|
-
[id,
|
|
256924
|
+
[id, at2, byActor2]
|
|
256538
256925
|
);
|
|
256539
256926
|
inserted += r.rowCount ?? 0;
|
|
256540
256927
|
}
|
|
@@ -256712,11 +257099,11 @@ var init_postgres_channels = __esm({
|
|
|
256712
257099
|
[l.channelType, l.appId, l.chatId, l.chatSessionId, l.updatedAt]
|
|
256713
257100
|
);
|
|
256714
257101
|
}
|
|
256715
|
-
async markInbound(channelType, appId, messageId,
|
|
257102
|
+
async markInbound(channelType, appId, messageId, at2) {
|
|
256716
257103
|
const r = await this.pool.query(
|
|
256717
257104
|
`INSERT INTO ${this.s}.channel_inbound_dedup (channel_type, app_id, message_id, at)
|
|
256718
257105
|
VALUES ($1,$2,$3,$4) ON CONFLICT (channel_type, app_id, message_id) DO NOTHING`,
|
|
256719
|
-
[channelType, appId, messageId,
|
|
257106
|
+
[channelType, appId, messageId, at2]
|
|
256720
257107
|
);
|
|
256721
257108
|
return (r.rowCount ?? 0) > 0;
|
|
256722
257109
|
}
|
|
@@ -258329,17 +258716,17 @@ var init_postgres_control_plane = __esm({
|
|
|
258329
258716
|
);
|
|
258330
258717
|
return r.rows.map(rowToAgentCredential);
|
|
258331
258718
|
}
|
|
258332
|
-
async revokeAgentCredential(companyId, actorId,
|
|
258719
|
+
async revokeAgentCredential(companyId, actorId, at2) {
|
|
258333
258720
|
const r = await this.pool.query(
|
|
258334
258721
|
`UPDATE ${this.s}.agent_credentials SET status = 'revoked', revoked_at = $3 WHERE company_id = $1 AND agent_id = $2`,
|
|
258335
|
-
[companyId, actorId,
|
|
258722
|
+
[companyId, actorId, at2]
|
|
258336
258723
|
);
|
|
258337
258724
|
return (r.rowCount ?? 0) > 0;
|
|
258338
258725
|
}
|
|
258339
|
-
async touchAgentCredential(tokenHash,
|
|
258726
|
+
async touchAgentCredential(tokenHash, at2) {
|
|
258340
258727
|
await this.pool.query(
|
|
258341
258728
|
`UPDATE ${this.s}.agent_credentials SET last_used_at = $2 WHERE token_hash = $1`,
|
|
258342
|
-
[tokenHash,
|
|
258729
|
+
[tokenHash, at2]
|
|
258343
258730
|
);
|
|
258344
258731
|
}
|
|
258345
258732
|
// —— principal_bridge ——
|
|
@@ -258414,7 +258801,7 @@ var init_postgres_control_plane = __esm({
|
|
|
258414
258801
|
);
|
|
258415
258802
|
return r.rows[0] ? rowToOffboarding(r.rows[0]) : null;
|
|
258416
258803
|
}
|
|
258417
|
-
async updateMemberOffboardingIfVersion(companyId, operationId, expectedVersion, patch,
|
|
258804
|
+
async updateMemberOffboardingIfVersion(companyId, operationId, expectedVersion, patch, at2) {
|
|
258418
258805
|
const sets = [`version = version + 1`];
|
|
258419
258806
|
const params = [companyId, operationId, expectedVersion];
|
|
258420
258807
|
const put3 = (col, value2, cast = "") => {
|
|
@@ -258427,7 +258814,7 @@ var init_postgres_control_plane = __esm({
|
|
|
258427
258814
|
if (patch.ownedAgents !== void 0) put3("owned_agents", JSON.stringify(patch.ownedAgents), "::jsonb");
|
|
258428
258815
|
if (patch.inFlightAssignments !== void 0) put3("in_flight_assignments", JSON.stringify(patch.inFlightAssignments), "::jsonb");
|
|
258429
258816
|
if (patch.error !== void 0) put3("error", patch.error);
|
|
258430
|
-
put3("updated_at",
|
|
258817
|
+
put3("updated_at", at2);
|
|
258431
258818
|
const r = await this.pool.query(
|
|
258432
258819
|
`UPDATE ${this.s}.member_offboardings SET ${sets.join(", ")}
|
|
258433
258820
|
WHERE company_id = $1 AND operation_id = $2 AND version = $3 RETURNING *`,
|
|
@@ -259545,10 +259932,10 @@ var init_postgres_trace = __esm({
|
|
|
259545
259932
|
* 条件 UPDATE 让后到的帧成为 0 行的空操作,不需要先读再判。run 不存在同样是 0 行 → false。
|
|
259546
259933
|
* 不动 updated_at:这是观测事实的补记,不是一次 run 状态变更。
|
|
259547
259934
|
*/
|
|
259548
|
-
async markRuntimeStarted(runId,
|
|
259935
|
+
async markRuntimeStarted(runId, at2) {
|
|
259549
259936
|
const r = await this.pool.query(
|
|
259550
259937
|
`UPDATE ${this.s}.agent_runs SET runtime_started_at=$2 WHERE id=$1 AND runtime_started_at IS NULL`,
|
|
259551
|
-
[runId,
|
|
259938
|
+
[runId, at2]
|
|
259552
259939
|
);
|
|
259553
259940
|
return (r.rowCount ?? 0) > 0;
|
|
259554
259941
|
}
|
|
@@ -261289,8 +261676,8 @@ var init_postgres_automations = __esm({
|
|
|
261289
261676
|
if (r.rowCount !== 1) throw new Error(`automation not found: ${id}`);
|
|
261290
261677
|
return await this.getAutomation(id);
|
|
261291
261678
|
}
|
|
261292
|
-
async archiveAutomation(id,
|
|
261293
|
-
return this.updateAutomation(id, { archivedAt:
|
|
261679
|
+
async archiveAutomation(id, at2) {
|
|
261680
|
+
return this.updateAutomation(id, { archivedAt: at2 });
|
|
261294
261681
|
}
|
|
261295
261682
|
async pauseIfEnabled(id, reason) {
|
|
261296
261683
|
const r = await this.pool.query(
|
|
@@ -261686,13 +262073,13 @@ var init_postgres_automations = __esm({
|
|
|
261686
262073
|
);
|
|
261687
262074
|
return r.rows.map(rowToTrigger);
|
|
261688
262075
|
}
|
|
261689
|
-
async completeEventBaseline(triggerId,
|
|
262076
|
+
async completeEventBaseline(triggerId, at2) {
|
|
261690
262077
|
await this.pool.query(
|
|
261691
262078
|
`UPDATE ${this.s}.automation_triggers
|
|
261692
262079
|
SET event_filters = jsonb_set(COALESCE(event_filters, '{}'::jsonb), '{baselineAt}', to_jsonb($2::text), true),
|
|
261693
262080
|
enabled = true
|
|
261694
262081
|
WHERE id = $1 AND kind = 'event'`,
|
|
261695
|
-
[triggerId,
|
|
262082
|
+
[triggerId, at2]
|
|
261696
262083
|
);
|
|
261697
262084
|
}
|
|
261698
262085
|
async resetEventBaseline(triggerId) {
|
|
@@ -262519,11 +262906,11 @@ var init_postgres_chat_sessions = __esm({
|
|
|
262519
262906
|
* 标「已送到 agent」。`delivered_to_agent_at IS NULL` 是**单调闸**:第一次投递成功那一刻才是
|
|
262520
262907
|
* 事实,重复调用不把时间往后推(提案 §4.3.1:投递成功之后不撤回、不重投)。
|
|
262521
262908
|
*/
|
|
262522
|
-
async markMessageDeliveredToAgent(messageId,
|
|
262909
|
+
async markMessageDeliveredToAgent(messageId, at2) {
|
|
262523
262910
|
await this.pool.query(
|
|
262524
262911
|
`UPDATE ${this.s}.chat_messages SET delivered_to_agent_at = $2
|
|
262525
262912
|
WHERE id = $1 AND delivered_to_agent_at IS NULL`,
|
|
262526
|
-
[messageId,
|
|
262913
|
+
[messageId, at2 ?? (/* @__PURE__ */ new Date()).toISOString()]
|
|
262527
262914
|
);
|
|
262528
262915
|
}
|
|
262529
262916
|
/**
|
|
@@ -263513,7 +263900,7 @@ var init_postgres_chat_items = __esm({
|
|
|
263513
263900
|
}
|
|
263514
263901
|
}
|
|
263515
263902
|
async insertItem(q2, input) {
|
|
263516
|
-
const
|
|
263903
|
+
const at2 = input.createdAt ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
263517
263904
|
const status = input.status ?? "streaming";
|
|
263518
263905
|
const payload2 = JSON.stringify(scrubPgJson(input.payload));
|
|
263519
263906
|
const metadata = input.metadata === void 0 || input.metadata === null ? null : JSON.stringify(scrubPgJson(input.metadata));
|
|
@@ -263548,7 +263935,7 @@ var init_postgres_chat_items = __esm({
|
|
|
263548
263935
|
scrubPgString(input.providerItemKey ?? null),
|
|
263549
263936
|
payload2,
|
|
263550
263937
|
metadata,
|
|
263551
|
-
|
|
263938
|
+
at2,
|
|
263552
263939
|
input.version ?? null,
|
|
263553
263940
|
input.ord ?? null
|
|
263554
263941
|
]
|
|
@@ -263556,11 +263943,11 @@ var init_postgres_chat_items = __esm({
|
|
|
263556
263943
|
return rowToItem(r.rows[0]);
|
|
263557
263944
|
}
|
|
263558
263945
|
async applyOp(itemId, op, opts) {
|
|
263559
|
-
const
|
|
263946
|
+
const at2 = opts?.at ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
263560
263947
|
const bumpTurnVersion = `(SELECT COALESCE(MAX(x.turn_version), 0) + 1 FROM ${this.s}.chat_items x
|
|
263561
263948
|
WHERE x.session_id = c.session_id AND x.turn_id = c.turn_id)`;
|
|
263562
263949
|
let setExpr;
|
|
263563
|
-
const args = [itemId,
|
|
263950
|
+
const args = [itemId, at2];
|
|
263564
263951
|
switch (op.op) {
|
|
263565
263952
|
case "append_text":
|
|
263566
263953
|
args.push(scrubPgString(op.text));
|
|
@@ -264331,12 +264718,12 @@ function toRecord2(row) {
|
|
|
264331
264718
|
...row.label ? { label: row.label } : {},
|
|
264332
264719
|
...row.task_digest ? { taskDigest: row.task_digest } : {},
|
|
264333
264720
|
roundSummaries: row.round_summaries ?? [],
|
|
264334
|
-
consecutiveFails:
|
|
264335
|
-
settledSeq:
|
|
264721
|
+
consecutiveFails: num4(row.consecutive_fails),
|
|
264722
|
+
settledSeq: num4(row.settled_seq),
|
|
264336
264723
|
createdAt: iso6(row.created_at),
|
|
264337
264724
|
...row.settled_at ? { settledAt: iso6(row.settled_at) } : {},
|
|
264338
264725
|
...row.dispatched_at ? { dispatchedAt: iso6(row.dispatched_at) } : {},
|
|
264339
|
-
dispatchSeq:
|
|
264726
|
+
dispatchSeq: num4(row.dispatch_seq ?? 0)
|
|
264340
264727
|
};
|
|
264341
264728
|
}
|
|
264342
264729
|
function toTouch(row) {
|
|
@@ -264350,7 +264737,7 @@ function toTouch(row) {
|
|
|
264350
264737
|
at: iso6(row.at)
|
|
264351
264738
|
};
|
|
264352
264739
|
}
|
|
264353
|
-
var iso6,
|
|
264740
|
+
var iso6, num4, terminalGuard, PostgresDelegationStore;
|
|
264354
264741
|
var init_postgres_delegations = __esm({
|
|
264355
264742
|
"../storage/src/postgres-delegations.ts"() {
|
|
264356
264743
|
"use strict";
|
|
@@ -264358,7 +264745,7 @@ var init_postgres_delegations = __esm({
|
|
|
264358
264745
|
init_src();
|
|
264359
264746
|
init_pg_ident();
|
|
264360
264747
|
iso6 = (v2) => v2 instanceof Date ? v2.toISOString() : new Date(v2).toISOString();
|
|
264361
|
-
|
|
264748
|
+
num4 = (v2) => typeof v2 === "number" ? v2 : Number(v2);
|
|
264362
264749
|
terminalGuard = (state) => state !== void 0 && state !== "running" ? " AND state = 'running'" : "";
|
|
264363
264750
|
PostgresDelegationStore = class _PostgresDelegationStore {
|
|
264364
264751
|
constructor(pool, s2) {
|
|
@@ -264541,18 +264928,18 @@ var init_postgres_delegations = __esm({
|
|
|
264541
264928
|
);
|
|
264542
264929
|
return r.rows[0] ? toRecord2(r.rows[0]) : null;
|
|
264543
264930
|
}
|
|
264544
|
-
async claimDispatch(id,
|
|
264931
|
+
async claimDispatch(id, at2, opts) {
|
|
264545
264932
|
const r = opts?.reclaimBefore ? await this.pool.query(
|
|
264546
264933
|
`UPDATE ${this.s}.chat_session_delegations SET dispatched_at = $2
|
|
264547
264934
|
WHERE id = $1
|
|
264548
264935
|
AND (dispatched_at IS NULL
|
|
264549
264936
|
OR (state = 'running' AND child_run_id IS NULL AND dispatched_at < $3))
|
|
264550
264937
|
RETURNING *`,
|
|
264551
|
-
[id,
|
|
264938
|
+
[id, at2, opts.reclaimBefore]
|
|
264552
264939
|
) : await this.pool.query(
|
|
264553
264940
|
`UPDATE ${this.s}.chat_session_delegations SET dispatched_at = $2
|
|
264554
264941
|
WHERE id = $1 AND dispatched_at IS NULL RETURNING *`,
|
|
264555
|
-
[id,
|
|
264942
|
+
[id, at2]
|
|
264556
264943
|
);
|
|
264557
264944
|
return r.rows[0] ? toRecord2(r.rows[0]) : null;
|
|
264558
264945
|
}
|
|
@@ -264590,12 +264977,12 @@ var init_postgres_delegations = __esm({
|
|
|
264590
264977
|
);
|
|
264591
264978
|
return Number(r.rows[0]?.n ?? 0);
|
|
264592
264979
|
}
|
|
264593
|
-
async markTouchesConsumed(delegationId, messageIds,
|
|
264980
|
+
async markTouchesConsumed(delegationId, messageIds, at2) {
|
|
264594
264981
|
if (!messageIds.length) return;
|
|
264595
264982
|
await this.pool.query(
|
|
264596
264983
|
`UPDATE ${this.s}.chat_session_delegation_touches SET consumed_at = $3
|
|
264597
264984
|
WHERE delegation_id = $1 AND message_id = ANY($2::text[]) AND consumed_at IS NULL`,
|
|
264598
|
-
[delegationId, messageIds,
|
|
264985
|
+
[delegationId, messageIds, at2]
|
|
264599
264986
|
);
|
|
264600
264987
|
}
|
|
264601
264988
|
/**
|
|
@@ -265841,12 +266228,12 @@ var init_postgres_dispatches = __esm({
|
|
|
265841
266228
|
}
|
|
265842
266229
|
return out;
|
|
265843
266230
|
}
|
|
265844
|
-
async closeStaleNeverStarted(olderThanMs,
|
|
266231
|
+
async closeStaleNeverStarted(olderThanMs, at2) {
|
|
265845
266232
|
const res = await this.pool.query(
|
|
265846
266233
|
`UPDATE "${this.s}".dispatches
|
|
265847
266234
|
SET ended_at = $1::timestamptz, outcome = 'failed', reason = 'never-started'
|
|
265848
266235
|
WHERE started_at IS NULL AND ended_at IS NULL AND created_at < $1::timestamptz - ($2 || ' milliseconds')::interval`,
|
|
265849
|
-
[
|
|
266236
|
+
[at2 ?? (/* @__PURE__ */ new Date()).toISOString(), String(olderThanMs)]
|
|
265850
266237
|
);
|
|
265851
266238
|
return res.rowCount ?? 0;
|
|
265852
266239
|
}
|
|
@@ -268415,8 +268802,8 @@ var init_cutover_aware_dispatches = __esm({
|
|
|
268415
268802
|
async closeOpenByTarget(kind, targetId, opts) {
|
|
268416
268803
|
return (await this.pickWritable()).closeOpenByTarget(kind, targetId, opts);
|
|
268417
268804
|
}
|
|
268418
|
-
async closeStaleNeverStarted(olderThanMs,
|
|
268419
|
-
return (await this.pickWritable()).closeStaleNeverStarted(olderThanMs,
|
|
268805
|
+
async closeStaleNeverStarted(olderThanMs, at2) {
|
|
268806
|
+
return (await this.pickWritable()).closeStaleNeverStarted(olderThanMs, at2);
|
|
268420
268807
|
}
|
|
268421
268808
|
async listByWorkorder(workorderId) {
|
|
268422
268809
|
return (await this.pick()).listByWorkorder(workorderId);
|
|
@@ -268504,8 +268891,8 @@ var init_cutover_aware_dispatches = __esm({
|
|
|
268504
268891
|
async closeOpenByTarget(kind, targetId, opts) {
|
|
268505
268892
|
return (await this.each("closeOpenByTarget", (l) => l.closeOpenByTarget(kind, targetId, opts))).flat();
|
|
268506
268893
|
}
|
|
268507
|
-
async closeStaleNeverStarted(olderThanMs,
|
|
268508
|
-
return (await this.each("closeStaleNeverStarted", (l) => l.closeStaleNeverStarted(olderThanMs,
|
|
268894
|
+
async closeStaleNeverStarted(olderThanMs, at2) {
|
|
268895
|
+
return (await this.each("closeStaleNeverStarted", (l) => l.closeStaleNeverStarted(olderThanMs, at2))).reduce((a, b2) => a + b2, 0);
|
|
268509
268896
|
}
|
|
268510
268897
|
// ── 读:并集 ───────────────────────────────────────────────────────────────
|
|
268511
268898
|
async listOpen() {
|
|
@@ -268749,9 +269136,9 @@ var init_cutover_aware_trace = __esm({
|
|
|
268749
269136
|
// 写走 pickWritable(frozen 窗口内拒,与 updateRun 同闸);读走 pick(切走后读引擎 schema,miss 不回落)。
|
|
268750
269137
|
// 落点 store 没实现可选方法时:写返回「没写」(与上面 updateUsageAggregates 同口径);
|
|
268751
269138
|
// 统计读**抛错**而不是返回空——空数组会被当成「确认的零用量」画出来,而数据契约 §4.5 要的是 503。
|
|
268752
|
-
async markRuntimeStarted(runId,
|
|
269139
|
+
async markRuntimeStarted(runId, at2) {
|
|
268753
269140
|
const s2 = await this.pickWritable();
|
|
268754
|
-
return s2.markRuntimeStarted ? s2.markRuntimeStarted(runId,
|
|
269141
|
+
return s2.markRuntimeStarted ? s2.markRuntimeStarted(runId, at2) : false;
|
|
268755
269142
|
}
|
|
268756
269143
|
async recordUsagePoint(input) {
|
|
268757
269144
|
const s2 = await this.pickWritable();
|
|
@@ -269126,9 +269513,9 @@ var init_cutover_aware_trace = __esm({
|
|
|
269126
269513
|
if (s2.updateUsageAggregates) await s2.updateUsageAggregates(run);
|
|
269127
269514
|
}
|
|
269128
269515
|
// 用量账本的两个写:与 updateRun 同理——解析不出公司就抛,不落默认公司(落错库不会报错)。
|
|
269129
|
-
async markRuntimeStarted(runId,
|
|
269516
|
+
async markRuntimeStarted(runId, at2) {
|
|
269130
269517
|
const s2 = await this.writable(runId, "markRuntimeStarted");
|
|
269131
|
-
return s2.markRuntimeStarted ? s2.markRuntimeStarted(runId,
|
|
269518
|
+
return s2.markRuntimeStarted ? s2.markRuntimeStarted(runId, at2) : false;
|
|
269132
269519
|
}
|
|
269133
269520
|
async recordUsagePoint(input) {
|
|
269134
269521
|
const s2 = await this.writable(input.runId, "recordUsagePoint");
|
|
@@ -270580,8 +270967,8 @@ async function copyBlobsIdempotent(pool, companyId, companySchema, manifestId, o
|
|
|
270580
270967
|
distribution[r.companyId] = (distribution[r.companyId] ?? 0) + 1;
|
|
270581
270968
|
if (r.companyId !== companyId) continue;
|
|
270582
270969
|
const body2 = r.key.slice("blobs:".length);
|
|
270583
|
-
const
|
|
270584
|
-
mine.add(
|
|
270970
|
+
const at2 = body2.lastIndexOf("@");
|
|
270971
|
+
mine.add(at2 >= 0 ? body2.slice(0, at2) : body2);
|
|
270585
270972
|
}
|
|
270586
270973
|
let copied = 0;
|
|
270587
270974
|
const client = await pool.connect();
|
|
@@ -272020,7 +272407,7 @@ async function backfillUsageLedger(ledger, opts) {
|
|
|
272020
272407
|
for (const id of ids2) sample(report.runtimeStartedAt, id);
|
|
272021
272408
|
if (opts.dryRun) continue;
|
|
272022
272409
|
await inTx(ledger.pool, async (c) => {
|
|
272023
|
-
const
|
|
272410
|
+
const at2 = now();
|
|
272024
272411
|
const upd = await c.query(
|
|
272025
272412
|
`UPDATE ${s2}.agent_runs SET runtime_started_at = started_at
|
|
272026
272413
|
WHERE id = ANY($1::text[]) AND runtime_started_at IS NULL
|
|
@@ -272029,7 +272416,7 @@ async function backfillUsageLedger(ledger, opts) {
|
|
|
272029
272416
|
);
|
|
272030
272417
|
for (const r of upd.rows) {
|
|
272031
272418
|
report.runtimeStartedAt.changed += 1;
|
|
272032
|
-
await audit(c, s2, opts.manifestId, r.id, "runtime_started_at", null, r.runtime_started_at,
|
|
272419
|
+
await audit(c, s2, opts.manifestId, r.id, "runtime_started_at", null, r.runtime_started_at, at2);
|
|
272033
272420
|
}
|
|
272034
272421
|
});
|
|
272035
272422
|
}
|
|
@@ -272074,7 +272461,7 @@ async function backfillUsageLedger(ledger, opts) {
|
|
|
272074
272461
|
for (const p2 of plan) sample(report.chat, p2.id);
|
|
272075
272462
|
if (opts.dryRun || plan.length === 0) continue;
|
|
272076
272463
|
await inTx(ledger.pool, async (c) => {
|
|
272077
|
-
const
|
|
272464
|
+
const at2 = now();
|
|
272078
272465
|
for (const p2 of plan) {
|
|
272079
272466
|
let touched = false;
|
|
272080
272467
|
if (p2.session) {
|
|
@@ -272084,7 +272471,7 @@ async function backfillUsageLedger(ledger, opts) {
|
|
|
272084
272471
|
);
|
|
272085
272472
|
if (r.rowCount) {
|
|
272086
272473
|
touched = true;
|
|
272087
|
-
await audit(c, s2, opts.manifestId, p2.id, "chat_session_id", null, p2.session,
|
|
272474
|
+
await audit(c, s2, opts.manifestId, p2.id, "chat_session_id", null, p2.session, at2);
|
|
272088
272475
|
}
|
|
272089
272476
|
}
|
|
272090
272477
|
if (p2.turn) {
|
|
@@ -272095,7 +272482,7 @@ async function backfillUsageLedger(ledger, opts) {
|
|
|
272095
272482
|
if (r.rowCount) {
|
|
272096
272483
|
touched = true;
|
|
272097
272484
|
report.chat.turnFilled += 1;
|
|
272098
|
-
await audit(c, s2, opts.manifestId, p2.id, "chat_turn_id", null, p2.turn,
|
|
272485
|
+
await audit(c, s2, opts.manifestId, p2.id, "chat_turn_id", null, p2.turn, at2);
|
|
272099
272486
|
}
|
|
272100
272487
|
}
|
|
272101
272488
|
if (touched) report.chat.changed += 1;
|
|
@@ -272197,7 +272584,7 @@ async function fixClaudeResumeUsage(pool, s2, before, o) {
|
|
|
272197
272584
|
for (let i = 0; i < plan.length; i += o.batch) {
|
|
272198
272585
|
const slice = plan.slice(i, i + o.batch);
|
|
272199
272586
|
await inTx(pool, async (c) => {
|
|
272200
|
-
const
|
|
272587
|
+
const at2 = o.now();
|
|
272201
272588
|
for (const p2 of slice) {
|
|
272202
272589
|
const r = await c.query(
|
|
272203
272590
|
`UPDATE ${s2}.agent_runs SET usage = $2::jsonb WHERE id = $1 AND usage = $3::jsonb RETURNING id`,
|
|
@@ -272214,7 +272601,7 @@ async function fixClaudeResumeUsage(pool, s2, before, o) {
|
|
|
272214
272601
|
"claude_resume_usage",
|
|
272215
272602
|
{ usage: p2.current },
|
|
272216
272603
|
{ usage: p2.next },
|
|
272217
|
-
|
|
272604
|
+
at2
|
|
272218
272605
|
);
|
|
272219
272606
|
}
|
|
272220
272607
|
});
|
|
@@ -272303,7 +272690,7 @@ async function undoUsageLedgerBackfill(ledger, manifestId, opts = {}) {
|
|
|
272303
272690
|
[manifestId]
|
|
272304
272691
|
);
|
|
272305
272692
|
report.auditRows = rows.length;
|
|
272306
|
-
const
|
|
272693
|
+
const at2 = now();
|
|
272307
272694
|
for (const row of rows) {
|
|
272308
272695
|
const runId = row.run_id;
|
|
272309
272696
|
const field = row.field;
|
|
@@ -272346,7 +272733,7 @@ async function undoUsageLedgerBackfill(ledger, manifestId, opts = {}) {
|
|
|
272346
272733
|
continue;
|
|
272347
272734
|
}
|
|
272348
272735
|
report.restored += 1;
|
|
272349
|
-
await audit(c, s2, undoManifest, runId, field, after, before,
|
|
272736
|
+
await audit(c, s2, undoManifest, runId, field, after, before, at2);
|
|
272350
272737
|
}
|
|
272351
272738
|
});
|
|
272352
272739
|
return report;
|
|
@@ -273228,7 +273615,7 @@ var init_run_settlement = __esm({
|
|
|
273228
273615
|
if (delivered2) await this.markDelivered(intent.runId, key2, intent.companyId);
|
|
273229
273616
|
return { settled: false, wroteRunTerminal: false, delivered: delivered2, targetKind: existing.target.kind, key: key2 };
|
|
273230
273617
|
}
|
|
273231
|
-
const
|
|
273618
|
+
const at2 = intent.occurredAt;
|
|
273232
273619
|
const alreadyTerminal = isRunTerminalStatus(run.status);
|
|
273233
273620
|
const effectiveStatus = alreadyTerminal ? run.status : intent.status;
|
|
273234
273621
|
const settlement = {
|
|
@@ -273236,16 +273623,16 @@ var init_run_settlement = __esm({
|
|
|
273236
273623
|
target: intent.target,
|
|
273237
273624
|
status: effectiveStatus,
|
|
273238
273625
|
reason: intent.reason,
|
|
273239
|
-
at,
|
|
273626
|
+
at: at2,
|
|
273240
273627
|
delivered: false,
|
|
273241
273628
|
attempts: 0
|
|
273242
273629
|
};
|
|
273243
273630
|
const startedMs = Date.parse(run.startedAt);
|
|
273244
|
-
const endedMs = Date.parse(
|
|
273631
|
+
const endedMs = Date.parse(at2);
|
|
273245
273632
|
await this.trace.updateRun(intent.runId, {
|
|
273246
273633
|
...alreadyTerminal ? {} : {
|
|
273247
273634
|
status: intent.status,
|
|
273248
|
-
endedAt:
|
|
273635
|
+
endedAt: at2,
|
|
273249
273636
|
durationMs: Number.isFinite(startedMs) && Number.isFinite(endedMs) ? Math.max(endedMs - startedMs, 0) : null,
|
|
273250
273637
|
exitReason: intent.reason,
|
|
273251
273638
|
...intent.exitCode !== void 0 ? { exitCode: intent.exitCode } : {},
|
|
@@ -273931,6 +274318,7 @@ __export(src_exports2, {
|
|
|
273931
274318
|
actorRefFieldsOf: () => actorRefFieldsOf,
|
|
273932
274319
|
actorStats: () => actorStats,
|
|
273933
274320
|
actorsDomain: () => actorsDomain,
|
|
274321
|
+
agentDefaultRuntimeForNewSession: () => agentDefaultRuntimeForNewSession,
|
|
273934
274322
|
answerFallbackReason: () => answerFallbackReason,
|
|
273935
274323
|
appendChatMessageOnce: () => appendChatMessageOnce,
|
|
273936
274324
|
applyBuiltinSkillVariants: () => applyBuiltinSkillVariants,
|
|
@@ -274342,6 +274730,7 @@ __export(src_exports2, {
|
|
|
274342
274730
|
variableKeyFromEnv: () => variableKeyFromEnv,
|
|
274343
274731
|
warmModelPriceCache: () => warmModelPriceCache,
|
|
274344
274732
|
wireRecoveredChatTurn: () => wireRecoveredChatTurn,
|
|
274733
|
+
withAgentDefaultRuntime: () => withAgentDefaultRuntime,
|
|
274345
274734
|
workOrderFileId: () => workOrderFileId,
|
|
274346
274735
|
workRuntimeExitEvent: () => workRuntimeExitEvent,
|
|
274347
274736
|
workorderDraftChainDeleters: () => workorderDraftChainDeleters,
|
|
@@ -274443,6 +274832,7 @@ var init_src11 = __esm({
|
|
|
274443
274832
|
init_dev_store();
|
|
274444
274833
|
init_continuation3();
|
|
274445
274834
|
init_session_runtime_target();
|
|
274835
|
+
init_agent_default_runtime_store();
|
|
274446
274836
|
init_knowledge2();
|
|
274447
274837
|
init_delegations();
|
|
274448
274838
|
init_automations();
|
|
@@ -275060,7 +275450,7 @@ var DiscussionService = class {
|
|
|
275060
275450
|
const parsed = generationSchema.safeParse(raw);
|
|
275061
275451
|
if (!parsed.success) invalid("output", parsed.error.issues.map((e) => `${e.path.join(".")}: ${e.message}`).join("; "));
|
|
275062
275452
|
const output = parsed.data;
|
|
275063
|
-
const
|
|
275453
|
+
const at2 = new Date(this.now()).toISOString();
|
|
275064
275454
|
if (output.result === "update") assertSummaryLength(output.discussion.summary, "discussion.summary");
|
|
275065
275455
|
if (output.result === "update" && !input.projectId && (output.topics.length || output.decisions.length || output.removals.length || output.discussion.topics.length)) {
|
|
275066
275456
|
invalid("topics", "\u975E\u9879\u76EE\u8BA8\u8BBA\u4E0D\u80FD\u5173\u8054\u5171\u4EAB\u8BAE\u9898");
|
|
@@ -275082,7 +275472,7 @@ var DiscussionService = class {
|
|
|
275082
275472
|
if (input.projectId) {
|
|
275083
275473
|
const result = await this.applyChanges(tx, {
|
|
275084
275474
|
projectId: input.projectId,
|
|
275085
|
-
at,
|
|
275475
|
+
at: at2,
|
|
275086
275476
|
mode: "chat",
|
|
275087
275477
|
actorId: input.session.aiActorId,
|
|
275088
275478
|
sessionId: input.session.id,
|
|
@@ -275129,7 +275519,7 @@ var DiscussionService = class {
|
|
|
275129
275519
|
* 经校验后与讨论记录同一个事务生效;删除与合并把删之前的原内容写进 operation 留底。
|
|
275130
275520
|
*/
|
|
275131
275521
|
async applyChanges(tx, ctx, output, hydrated) {
|
|
275132
|
-
const { projectId: projectId2, at } = ctx;
|
|
275522
|
+
const { projectId: projectId2, at: at2 } = ctx;
|
|
275133
275523
|
const current = await this.view(projectId2, tx);
|
|
275134
275524
|
for (const [before, after] of [[ctx.before.topics, current.topics], [ctx.before.decisions, current.decisions]]) {
|
|
275135
275525
|
if (JSON.stringify(before.map((r) => [r.id, r.revision]).sort()) !== JSON.stringify(after.map((r) => [r.id, r.revision]).sort())) {
|
|
@@ -275141,7 +275531,7 @@ var DiscussionService = class {
|
|
|
275141
275531
|
projectId: projectId2,
|
|
275142
275532
|
actorId: ctx.actorId,
|
|
275143
275533
|
...ctx.sessionId ? { sessionId: ctx.sessionId } : {},
|
|
275144
|
-
at
|
|
275534
|
+
at: at2
|
|
275145
275535
|
});
|
|
275146
275536
|
const topicAliases = /* @__PURE__ */ new Map();
|
|
275147
275537
|
const topicMap = new Map(current.topics.map((t) => [t.value.topicId, t.value]));
|
|
@@ -275160,9 +275550,9 @@ var DiscussionService = class {
|
|
|
275160
275550
|
const previous3 = topicMap.get(id);
|
|
275161
275551
|
const summary = (t.summary ?? previous3?.summary ?? "").trim();
|
|
275162
275552
|
if (!summary) invalid("topics.summary", `\u8BAE\u9898\u300C${t.title}\u300D\u7F3A\u5C11\u7B80\u4ECB\uFF1A\u7528\u4E00\u53E5\u8BDD\u8BF4\u660E\u8FD9\u4E2A\u8BAE\u9898\u5728\u8BA8\u8BBA\u4EC0\u4E48`);
|
|
275163
|
-
const value2 = { projectId: projectId2, topicId: id, title: t.title, summary, updated_at: previous3?.updated_at ??
|
|
275553
|
+
const value2 = { projectId: projectId2, topicId: id, title: t.title, summary, updated_at: previous3?.updated_at ?? at2 };
|
|
275164
275554
|
if (!previous3 || previous3.title !== value2.title || previous3.summary !== value2.summary) {
|
|
275165
|
-
value2.updated_at =
|
|
275555
|
+
value2.updated_at = at2;
|
|
275166
275556
|
changedTopics.add(id);
|
|
275167
275557
|
}
|
|
275168
275558
|
topicMap.set(id, value2);
|
|
@@ -275224,7 +275614,7 @@ var DiscussionService = class {
|
|
|
275224
275614
|
...rest,
|
|
275225
275615
|
source_refs: source.refs,
|
|
275226
275616
|
supersedes: d.record.supersedes.map((s2) => decisionAliases.get(s2) ?? s2),
|
|
275227
|
-
updated_at:
|
|
275617
|
+
updated_at: at2
|
|
275228
275618
|
};
|
|
275229
275619
|
if ((!old || old.record.statement !== record9.statement) && Array.from(record9.statement).length > DECISION_STATEMENT_MAX) {
|
|
275230
275620
|
invalid("statement", `\u51B3\u7B56\u6B63\u6587\u8D85\u8FC7 ${DECISION_STATEMENT_MAX} \u5B57\uFF1A\u53EA\u5199\u5B9A\u4E86\u4EC0\u4E48\uFF0C\u7406\u7531\u653E rationale\u3001\u5176\u4ED6\u65B9\u6848\u653E alternatives\uFF0C\u64CD\u4F5C\u6B65\u9AA4\u548C\u547D\u4EE4\u4E0D\u5199\u8FDB\u51B3\u7B56`);
|
|
@@ -275239,7 +275629,7 @@ var DiscussionService = class {
|
|
|
275239
275629
|
const shipped = shippedFlag ?? wasShipped;
|
|
275240
275630
|
if (shipped && !wasShipped) {
|
|
275241
275631
|
if (!source.shipped) invalid("shipped_ref", "\u6807\u5DF2\u4E0A\u7EBF\u5FC5\u987B\u7ED9\u51FA\u8BF4\u660E\u5DF2\u5408\u5E76\u6216\u5DF2\u90E8\u7F72\u7684\u90A3\u6761\u6D88\u606F");
|
|
275242
|
-
shipment = { kind: "chat", name: source.shipped.human[1], at, source: source.shipped.source };
|
|
275632
|
+
shipment = { kind: "chat", name: source.shipped.human[1], at: at2, source: source.shipped.source };
|
|
275243
275633
|
}
|
|
275244
275634
|
if (shipped && record9.state !== "accepted" && !wasShipped) invalid("shipped", "\u53EA\u6709\u5DF2\u786E\u8BA4\u7684\u51B3\u7B56\u624D\u80FD\u6807\u5DF2\u4E0A\u7EBF");
|
|
275245
275635
|
if (shipped) record9.shipped = true;
|
|
@@ -275249,7 +275639,7 @@ var DiscussionService = class {
|
|
|
275249
275639
|
const candidates = [...source.authors, ...shipped && !wasShipped && source.shipped ? [source.shipped.human] : []];
|
|
275250
275640
|
const author = candidates.find(([, name]) => name === record9.confirmer);
|
|
275251
275641
|
if (!author) invalid("confirmer", "\u804A\u5929\u786E\u8BA4\u4EBA\u5FC5\u987B\u5BF9\u5E94\u6765\u6E90\u4E2D\u7684\u539F\u59CB\u7528\u6237\u53D1\u8A00\u4EBA");
|
|
275252
|
-
confirmation = { kind: "chat", actorId: author[0], name: author[1], fingerprint: decisionFingerprint(record9), at };
|
|
275642
|
+
confirmation = { kind: "chat", actorId: author[0], name: author[1], fingerprint: decisionFingerprint(record9), at: at2 };
|
|
275253
275643
|
}
|
|
275254
275644
|
if (!record9.confirmer) confirmation = void 0;
|
|
275255
275645
|
record9.source_refs = [...new Map([...old?.record.source_refs ?? [], ...record9.source_refs].map((r) => [JSON.stringify([r.session_id, r.message_id]), r])).values()];
|
|
@@ -275278,7 +275668,7 @@ var DiscussionService = class {
|
|
|
275278
275668
|
}));
|
|
275279
275669
|
for (const oldId of replacedIds) {
|
|
275280
275670
|
const old = decisionMap.get(oldId);
|
|
275281
|
-
decisionMap.set(oldId, { ...old, record: { ...old.record, state: "superseded", updated_at:
|
|
275671
|
+
decisionMap.set(oldId, { ...old, record: { ...old.record, state: "superseded", updated_at: at2 } });
|
|
275282
275672
|
touched.add(oldId);
|
|
275283
275673
|
}
|
|
275284
275674
|
for (const id of changedTopics) await tx.put("topic", entryId(projectId2, id), topicMap.get(id));
|
|
@@ -275354,32 +275744,32 @@ var DiscussionService = class {
|
|
|
275354
275744
|
const editable = { ...parsed, shipped: parsed.shipped ?? wasShipped };
|
|
275355
275745
|
const previous3 = { ...decisionEditSchema.parse(pickDecisionContent(old.value.record)), shipped: wasShipped };
|
|
275356
275746
|
if (JSON.stringify(previous3) === JSON.stringify(editable)) return old;
|
|
275357
|
-
const
|
|
275747
|
+
const at2 = new Date(this.now()).toISOString();
|
|
275358
275748
|
const { shipped, ...content3 } = editable;
|
|
275359
275749
|
if (shipped && !wasShipped && content3.state !== "accepted") invalid("shipped", "\u53EA\u6709\u5DF2\u786E\u8BA4\u7684\u51B3\u7B56\u624D\u80FD\u6807\u5DF2\u4E0A\u7EBF");
|
|
275360
275750
|
const record9 = {
|
|
275361
275751
|
...old.value.record,
|
|
275362
275752
|
...content3,
|
|
275363
|
-
updated_at:
|
|
275753
|
+
updated_at: at2,
|
|
275364
275754
|
confirmer: content3.state === "accepted" ? name : content3.state === "proposed" ? null : old.value.record.confirmer
|
|
275365
275755
|
};
|
|
275366
275756
|
if (shipped) record9.shipped = true;
|
|
275367
275757
|
else delete record9.shipped;
|
|
275368
275758
|
const value2 = { ...old.value, record: record9 };
|
|
275369
275759
|
if (shipped !== wasShipped) {
|
|
275370
|
-
if (shipped) value2.shipment = { kind: "page", name, at };
|
|
275760
|
+
if (shipped) value2.shipment = { kind: "page", name, at: at2 };
|
|
275371
275761
|
else delete value2.shipment;
|
|
275372
275762
|
}
|
|
275373
275763
|
const contentChanged = JSON.stringify({ ...previous3, shipped: void 0 }) !== JSON.stringify({ ...editable, shipped: void 0 });
|
|
275374
275764
|
if (!contentChanged) record9.confirmer = old.value.record.confirmer;
|
|
275375
|
-
else if (record9.state === "accepted") value2.confirmation = { kind: "page", actorId, name, fingerprint: decisionFingerprint(record9), at };
|
|
275765
|
+
else if (record9.state === "accepted") value2.confirmation = { kind: "page", actorId, name, fingerprint: decisionFingerprint(record9), at: at2 };
|
|
275376
275766
|
else if (record9.state === "proposed") delete value2.confirmation;
|
|
275377
275767
|
const current = await this.view(projectId2, tx);
|
|
275378
275768
|
this.validateGraph(current.decisions.map((d) => d.value.decisionId === decisionId ? value2 : d.value));
|
|
275379
275769
|
if (contentChanged && record9.state === "accepted") for (const oldId of record9.supersedes) {
|
|
275380
275770
|
const replaced = current.decisions.find((d) => d.value.decisionId === oldId);
|
|
275381
275771
|
assertRevision(replaced.revision, relatedRevisions[oldId] ?? 0);
|
|
275382
|
-
await tx.put("decision", replaced.id, { ...replaced.value, record: { ...replaced.value.record, state: "superseded", updated_at:
|
|
275772
|
+
await tx.put("decision", replaced.id, { ...replaced.value, record: { ...replaced.value.record, state: "superseded", updated_at: at2 } });
|
|
275383
275773
|
}
|
|
275384
275774
|
const result = await tx.put("decision", key2, value2);
|
|
275385
275775
|
await this.operation(tx, actorId, "decision", key2, old.revision, result.revision);
|
|
@@ -275443,10 +275833,10 @@ var DiscussionService = class {
|
|
|
275443
275833
|
const output = parsed.data;
|
|
275444
275834
|
for (const r of output.removals) if (r.kind === "decision" && r.source_refs.length) invalid("removals.source_refs", "\u4E00\u6B21\u6027\u6574\u7406\u4E0D\u5F15\u7528\u804A\u5929\u6765\u6E90");
|
|
275445
275835
|
return this.store.transaction(async (tx) => {
|
|
275446
|
-
const
|
|
275836
|
+
const at2 = new Date(this.now()).toISOString();
|
|
275447
275837
|
const result = await this.applyChanges(
|
|
275448
275838
|
tx,
|
|
275449
|
-
{ projectId: projectId2, at, mode: "curation", actorId, before },
|
|
275839
|
+
{ projectId: projectId2, at: at2, mode: "curation", actorId, before },
|
|
275450
275840
|
{ topics: output.topics, decisions: [], removals: output.removals },
|
|
275451
275841
|
{ decisions: [], removals: output.removals.map(() => null) }
|
|
275452
275842
|
);
|
|
@@ -275460,7 +275850,7 @@ var DiscussionService = class {
|
|
|
275460
275850
|
if (!row) invalid("shortened", `\u51B3\u7B56 ${s2.decision_id} \u4E0D\u5B58\u5728`);
|
|
275461
275851
|
if (Array.from(s2.statement).length > DECISION_STATEMENT_MAX) invalid("shortened", `\u51B3\u7B56 ${s2.decision_id} \u6539\u77ED\u540E\u4ECD\u8D85\u8FC7 ${DECISION_STATEMENT_MAX} \u5B57`);
|
|
275462
275852
|
if (s2.statement === row.value.record.statement && (s2.rationale ?? row.value.record.rationale) === row.value.record.rationale) continue;
|
|
275463
|
-
const record9 = { ...row.value.record, statement: s2.statement, rationale: s2.rationale ?? row.value.record.rationale, updated_at:
|
|
275853
|
+
const record9 = { ...row.value.record, statement: s2.statement, rationale: s2.rationale ?? row.value.record.rationale, updated_at: at2 };
|
|
275464
275854
|
const value2 = {
|
|
275465
275855
|
...row.value,
|
|
275466
275856
|
record: record9,
|
|
@@ -275474,7 +275864,7 @@ var DiscussionService = class {
|
|
|
275474
275864
|
id: s2.decision_id,
|
|
275475
275865
|
reason: "\u4E00\u6B21\u6027\u6E05\u7406\uFF1A\u51B3\u7B56\u6B63\u6587\u6309\u65B0\u89C4\u5219\u6539\u77ED",
|
|
275476
275866
|
actorId,
|
|
275477
|
-
at,
|
|
275867
|
+
at: at2,
|
|
275478
275868
|
before: row.value
|
|
275479
275869
|
});
|
|
275480
275870
|
shortened.push({ decisionId: s2.decision_id, before: row.value.record.statement, after: s2.statement });
|
|
@@ -275524,7 +275914,7 @@ var DiscussionService = class {
|
|
|
275524
275914
|
const missing = batch.filter((row) => !given.has(row.id)).map((row) => row.id);
|
|
275525
275915
|
if (missing.length) invalid("summaries", `\u8FD8\u6709 ${missing.length} \u6761\u6CA1\u4EA4\uFF1A${missing.join("\u3001")}`);
|
|
275526
275916
|
return this.store.transaction(async (tx) => {
|
|
275527
|
-
const
|
|
275917
|
+
const at2 = new Date(this.now()).toISOString();
|
|
275528
275918
|
const out = [];
|
|
275529
275919
|
for (const row of batch) {
|
|
275530
275920
|
const current = await tx.get("discussion", row.id);
|
|
@@ -275538,7 +275928,7 @@ var DiscussionService = class {
|
|
|
275538
275928
|
id: row.id,
|
|
275539
275929
|
reason: `\u4E00\u6B21\u6027\u6E05\u7406\uFF1A\u8BA8\u8BBA\u6458\u8981\u6309\u65B0\u89C4\u5219\u538B\u5230 ${DISCUSSION_SUMMARY_MAX} \u5B57\u4EE5\u5185`,
|
|
275540
275930
|
actorId,
|
|
275541
|
-
at,
|
|
275931
|
+
at: at2,
|
|
275542
275932
|
before: current.value
|
|
275543
275933
|
});
|
|
275544
275934
|
out.push({ sessionId: row.id, title: current.value.record.title, beforeChars: Array.from(current.value.record.summary).length, afterChars: Array.from(summary).length });
|
|
@@ -275652,7 +276042,7 @@ function fileSegment(raw, fallback) {
|
|
|
275652
276042
|
const cleaned = raw.replace(/[\\/:*?"<>|\u0000-\u001f]+/g, "_").replace(/\s+/g, "_").replace(/^\.+/, "").replace(/_+/g, "_").replace(/^_|_$/g, "");
|
|
275653
276043
|
return Array.from(cleaned).slice(0, 40).join("") || fallback;
|
|
275654
276044
|
}
|
|
275655
|
-
function
|
|
276045
|
+
function oneLine3(statement) {
|
|
275656
276046
|
const first = statement.trim().split(/[。;\n]/)[0].trim();
|
|
275657
276047
|
const chars = Array.from(first);
|
|
275658
276048
|
return chars.length > 60 ? `${chars.slice(0, 60).join("")}\u2026` : first;
|
|
@@ -275740,7 +276130,7 @@ function renderProjectContext(input) {
|
|
|
275740
276130
|
catalog.push(
|
|
275741
276131
|
`${i + 1}. ${star}${t.value.title}\uFF08${counts2}\uFF09\u2192 \`${topicPaths[i]}\``,
|
|
275742
276132
|
...t.value.summary ? [` \u7B80\u4ECB\uFF1A${t.value.summary}`] : [],
|
|
275743
|
-
...accepted.map((d) => ` - ${d.value.record.shipped ? "\u3010\u5DF2\u4E0A\u7EBF\u3011" : ""}${
|
|
276133
|
+
...accepted.map((d) => ` - ${d.value.record.shipped ? "\u3010\u5DF2\u4E0A\u7EBF\u3011" : ""}${oneLine3(d.value.record.statement)}`)
|
|
275744
276134
|
);
|
|
275745
276135
|
});
|
|
275746
276136
|
files["PROJECT_CONTEXT.md"] = catalog.join("\n").trimEnd() + "\n";
|
|
@@ -276985,11 +277375,11 @@ function lastActivityAt(snap, nodeId) {
|
|
|
276985
277375
|
bump(node2?.createdAt);
|
|
276986
277376
|
return max;
|
|
276987
277377
|
}
|
|
276988
|
-
function nodesScanWillTouch(snap,
|
|
277378
|
+
function nodesScanWillTouch(snap, at2, ctx) {
|
|
276989
277379
|
const touched = /* @__PURE__ */ new Set();
|
|
276990
277380
|
try {
|
|
276991
277381
|
const { events } = scan(new WorkorderState(snap), {
|
|
276992
|
-
at,
|
|
277382
|
+
at: at2,
|
|
276993
277383
|
actorId: "actor:system:engine",
|
|
276994
277384
|
...ctx.config !== void 0 ? { config: ctx.config } : {},
|
|
276995
277385
|
...ctx.policy !== void 0 ? { policy: ctx.policy } : {}
|
|
@@ -278124,6 +278514,8 @@ async function startServe(opts) {
|
|
|
278124
278514
|
let projectStateStore;
|
|
278125
278515
|
let artifactStateStore;
|
|
278126
278516
|
let chatSessionStore;
|
|
278517
|
+
let agentDefaultRuntimeResolvers = null;
|
|
278518
|
+
const wrapChatStore = (store, companyId) => withAgentDefaultRuntime(store, { companyId, resolvers: () => agentDefaultRuntimeResolvers });
|
|
278127
278519
|
let chatTurnStore;
|
|
278128
278520
|
let readMarkerStore;
|
|
278129
278521
|
let platformChatRecovery;
|
|
@@ -278132,7 +278524,7 @@ async function startServe(opts) {
|
|
|
278132
278524
|
projectStateStore = await PostgresProjectStateStore.open(pgPool, defaultCompanySchema);
|
|
278133
278525
|
artifactStateStore = await PostgresArtifactStateStore.open(pgPool, defaultCompanySchema);
|
|
278134
278526
|
const pgChatSessions = await PostgresChatSessionStore.open(pgPool, defaultCompanySchema, { companyId: defaultCompanyId });
|
|
278135
|
-
chatSessionStore = pgChatSessions;
|
|
278527
|
+
chatSessionStore = wrapChatStore(pgChatSessions, () => defaultCompanyId);
|
|
278136
278528
|
chatTurnStore = await PostgresChatTurnStore.open(pgPool, defaultCompanySchema);
|
|
278137
278529
|
platformChatRecovery = PlatformChatRecoveryStore.open(pgPool, defaultCompanySchema);
|
|
278138
278530
|
const backfilled = await pgChatSessions.backfillCompanyIds().catch((e) => {
|
|
@@ -278150,7 +278542,7 @@ async function startServe(opts) {
|
|
|
278150
278542
|
} else {
|
|
278151
278543
|
projectStateStore = await FileProjectStateStore.open(path28.join(opts.dir, "artifact-document-projects.json"));
|
|
278152
278544
|
artifactStateStore = await FileArtifactStateStore.open(path28.join(opts.dir, "artifact-document-state.json"));
|
|
278153
|
-
chatSessionStore = await FileChatSessionStore.open(path28.join(opts.dir, "chat-sessions.json"));
|
|
278545
|
+
chatSessionStore = wrapChatStore(await FileChatSessionStore.open(path28.join(opts.dir, "chat-sessions.json")), () => defaultCompanyId);
|
|
278154
278546
|
chatTurnStore = await FileChatTurnStore.open(path28.join(opts.dir, "chat-session-turns.json"));
|
|
278155
278547
|
readMarkerStore = await FileReadMarkerStore.open(path28.join(opts.dir, "inbox-read-markers.json"));
|
|
278156
278548
|
console.log("[serve] \u4EA4\u4ED8\u7269\u72B6\u6001\u4F53\u7CFB\uFF1A\u672C\u5730 JSON dev store");
|
|
@@ -278357,18 +278749,18 @@ async function startServe(opts) {
|
|
|
278357
278749
|
for (const id of await registry2.listVariableBindingTargetIds?.("project") ?? []) {
|
|
278358
278750
|
if (id !== projectId2 && !await projectExistsIn(id, companyId ?? defaultCompanyId)) orphans.push(id);
|
|
278359
278751
|
}
|
|
278360
|
-
const
|
|
278752
|
+
const at2 = (/* @__PURE__ */ new Date()).toISOString();
|
|
278361
278753
|
const actor = by ?? SYSTEM_ACTOR2;
|
|
278362
278754
|
const text7 = (t) => `${t.kind}:${t.kind === "all" ? "" : t.id}`;
|
|
278363
278755
|
for (const pid of [projectId2, ...orphans]) {
|
|
278364
|
-
for (const r of await registry2.unbindVariableTarget({ kind: "project", id: pid }, { ...by ? { updatedBy: by } : {}, updatedAt:
|
|
278756
|
+
for (const r of await registry2.unbindVariableTarget({ kind: "project", id: pid }, { ...by ? { updatedBy: by } : {}, updatedAt: at2 })) {
|
|
278365
278757
|
credentialAudit({
|
|
278366
278758
|
kind: "credential_write",
|
|
278367
278759
|
actor,
|
|
278368
278760
|
variableKey: r.key,
|
|
278369
278761
|
targetScope: `record:${r.variableId}`,
|
|
278370
278762
|
source: pid === projectId2 ? "project-delete" : "project-delete-orphan-sweep",
|
|
278371
|
-
timestamp:
|
|
278763
|
+
timestamp: at2,
|
|
278372
278764
|
api: "records",
|
|
278373
278765
|
companyId,
|
|
278374
278766
|
// D-10:删项目钩子按公司起(beforeProjectDeleteFor / onProjectDeletedFor 的 companyId)
|
|
@@ -279411,7 +279803,7 @@ async function startServe(opts) {
|
|
|
279411
279803
|
humanPrefs: (await openCompanyPlane(defaultCompanyId)).humanPrefs
|
|
279412
279804
|
},
|
|
279413
279805
|
buildStores: async (companyId) => {
|
|
279414
|
-
const chatSessions = await PostgresChatSessionStore.open(pgPool, companyEngineDirName(companyId), { companyId });
|
|
279806
|
+
const chatSessions = wrapChatStore(await PostgresChatSessionStore.open(pgPool, companyEngineDirName(companyId), { companyId }), () => companyId);
|
|
279415
279807
|
const projects = await PostgresProjectStateStore.open(pgPool, companyEngineDirName(companyId));
|
|
279416
279808
|
const artifacts = await PostgresArtifactStateStore.open(pgPool, companyEngineDirName(companyId));
|
|
279417
279809
|
const chatTurns = await PostgresChatTurnStore.open(pgPool, companyEngineDirName(companyId));
|
|
@@ -279630,14 +280022,14 @@ async function startServe(opts) {
|
|
|
279630
280022
|
const chatLiveSessions = /* @__PURE__ */ new Map();
|
|
279631
280023
|
const chatRunByDispatch = /* @__PURE__ */ new Map();
|
|
279632
280024
|
const markServeStoppedInFlight = async () => {
|
|
279633
|
-
const
|
|
280025
|
+
const at2 = (/* @__PURE__ */ new Date()).toISOString();
|
|
279634
280026
|
const runIds = [...new Set([...chatLiveSessions.values()].map((c) => c.sessionId))];
|
|
279635
280027
|
await Promise.all(runIds.map(async (runId) => {
|
|
279636
280028
|
try {
|
|
279637
280029
|
const run = await runRoutedTrace.getRun(runId);
|
|
279638
280030
|
if (!run || run.status !== "running") return;
|
|
279639
280031
|
const base = run.metadata && typeof run.metadata === "object" && !Array.isArray(run.metadata) ? run.metadata : {};
|
|
279640
|
-
await runRoutedTrace.updateRun(runId, { metadata: { ...base, [SERVE_STOPPED_IN_FLIGHT_KEY]:
|
|
280032
|
+
await runRoutedTrace.updateRun(runId, { metadata: { ...base, [SERVE_STOPPED_IN_FLIGHT_KEY]: at2 } });
|
|
279641
280033
|
} catch (err) {
|
|
279642
280034
|
console.warn(`[serve] \u505C\u673A\u7559\u75D5\u5931\u8D25 run=${runId}\uFF08\u8FD9\u4E00\u8F6E\u82E5\u6CA1\u63A5\u56DE\u6765\u5C06\u663E\u793A\u300C\u5BF9\u8BDD\u5DF2\u4E2D\u65AD\u300D\uFF09: ${String(err)}`);
|
|
279643
280035
|
}
|
|
@@ -279766,6 +280158,11 @@ async function startServe(opts) {
|
|
|
279766
280158
|
return plan && plan.injectedHistoryCount > 0 ? plan.runtimeMessage : void 0;
|
|
279767
280159
|
};
|
|
279768
280160
|
const resolveCompanyBinding = createCompanyBindingResolver({ actors, defaultCompanyId });
|
|
280161
|
+
const resolveAgentConfiguredModel = async (cid, actorId) => {
|
|
280162
|
+
const ctx = await actors.resolveCtx(cid ?? defaultCompanyId);
|
|
280163
|
+
return (await ctx.service.latestConfig(actorId))?.model ?? null;
|
|
280164
|
+
};
|
|
280165
|
+
agentDefaultRuntimeResolvers = { resolveBinding: resolveCompanyBinding, resolveActorModel: resolveAgentConfiguredModel };
|
|
279769
280166
|
if (pgPool) {
|
|
279770
280167
|
const pinPool = pgPool;
|
|
279771
280168
|
void (async () => {
|
|
@@ -280308,10 +280705,7 @@ async function startServe(opts) {
|
|
|
280308
280705
|
/* ADR 0613:建会话 / 「恢复为员工默认运行配置」这两下要读员工详情页配的型号,按**当前公司**读
|
|
280309
280706
|
(与 `resolveBinding` 同一条理由:全局 `registry` 对已切 `actor-config` 的公司是冻结旧镜像)。
|
|
280310
280707
|
⚠ 只有这两下读它;解析每一轮的模型依旧不读员工配置(ADR 0610 D1)。 */
|
|
280311
|
-
resolveActorModel:
|
|
280312
|
-
const ctx = await actors.resolveCtx(cid ?? defaultCompanyId);
|
|
280313
|
-
return (await ctx.service.latestConfig(actorId))?.model ?? null;
|
|
280314
|
-
},
|
|
280708
|
+
resolveActorModel: resolveAgentConfiguredModel,
|
|
280315
280709
|
// 按 runId 路由:切换后新会话的事件落在本公司库里,共享 store 会一条都补不出 parts。
|
|
280316
280710
|
// ⚠ `runRoutedTrace` 声明在本行**之后**:包成箭头函数避 TDZ(本域只需要 listEvents)。
|
|
280317
280711
|
trace: { listEvents: (runId, o) => runRoutedTrace.listEvents(runId, o) },
|
|
@@ -280891,7 +281285,7 @@ async function startServe(opts) {
|
|
|
280891
281285
|
...await materializeSkillFiles({ service: actors.service, actorId, runtimeKind })
|
|
280892
281286
|
}),
|
|
280893
281287
|
uploadChatAttachment: async ({ contentBase64 }) => ({ blobRef: await assets.put(new Uint8Array(Buffer.from(contentBase64, "base64"))) }),
|
|
280894
|
-
onDispatchCommandCompleted: async ({ dispatchId, command: command2, durableRefs, at, delivered, pendingSteps }) => {
|
|
281288
|
+
onDispatchCommandCompleted: async ({ dispatchId, command: command2, durableRefs, at: at2, delivered, pendingSteps }) => {
|
|
280895
281289
|
const sink = await trajectoryForDispatch(dispatchId);
|
|
280896
281290
|
if (pendingSteps && pendingSteps.length > 0) {
|
|
280897
281291
|
sink.checkpointState?.(dispatchId, { pendingSteps: [...pendingSteps] });
|
|
@@ -280904,7 +281298,7 @@ async function startServe(opts) {
|
|
|
280904
281298
|
// 稳定步骤 id = 命令名:同一步骤重跑时 id 一致(checkpoint 契约对 stable id 的要求),
|
|
280905
281299
|
// 恢复时下一趟能看出「上一趟已经 propose 过 / 已经 gap 过」。
|
|
280906
281300
|
completedStepIds: [command2],
|
|
280907
|
-
at
|
|
281301
|
+
at: at2
|
|
280908
281302
|
});
|
|
280909
281303
|
await sink.flush?.(dispatchId);
|
|
280910
281304
|
if (!delivered) return;
|
|
@@ -280923,7 +281317,7 @@ async function startServe(opts) {
|
|
|
280923
281317
|
...delivered.risks ? { risks: delivered.risks } : {},
|
|
280924
281318
|
...delivered.nextActions ? { nextActions: delivered.nextActions } : {},
|
|
280925
281319
|
...delivered.verificationGaps ? { verificationGaps: delivered.verificationGaps } : {},
|
|
280926
|
-
at
|
|
281320
|
+
at: at2
|
|
280927
281321
|
}
|
|
280928
281322
|
);
|
|
280929
281323
|
},
|
|
@@ -281633,17 +282027,17 @@ async function startServe(opts) {
|
|
|
281633
282027
|
};
|
|
281634
282028
|
const handshakeThrottleOpts = {};
|
|
281635
282029
|
{
|
|
281636
|
-
const
|
|
282030
|
+
const num5 = (name) => {
|
|
281637
282031
|
const raw = process.env[name];
|
|
281638
282032
|
if (raw === void 0 || raw.trim() === "") return void 0;
|
|
281639
282033
|
const n = Number(raw);
|
|
281640
282034
|
return Number.isFinite(n) && n > 0 ? n : void 0;
|
|
281641
282035
|
};
|
|
281642
|
-
const mf =
|
|
282036
|
+
const mf = num5("OASIS_NODE_HANDSHAKE_MAX_FAILURES");
|
|
281643
282037
|
if (mf !== void 0) handshakeThrottleOpts.maxFailures = mf;
|
|
281644
|
-
const w2 =
|
|
282038
|
+
const w2 = num5("OASIS_NODE_HANDSHAKE_WINDOW_MS");
|
|
281645
282039
|
if (w2 !== void 0) handshakeThrottleOpts.windowMs = w2;
|
|
281646
|
-
const b2 =
|
|
282040
|
+
const b2 = num5("OASIS_NODE_HANDSHAKE_BLOCK_MS");
|
|
281647
282041
|
if (b2 !== void 0) handshakeThrottleOpts.blockMs = b2;
|
|
281648
282042
|
}
|
|
281649
282043
|
const dataplaneTokens = createDataplaneTokenIssuer({ secretFile: path28.join(opts.dir, "dataplane-token-secret") });
|
|
@@ -283447,8 +283841,8 @@ async function startServe(opts) {
|
|
|
283447
283841
|
const failedWorks = snap.works.filter((w2) => w2.nodeId === node2.id && w2.outcome === "failed");
|
|
283448
283842
|
if (failedWorks.length === 0) continue;
|
|
283449
283843
|
const firstFailed = failedWorks.reduce((a, b2) => {
|
|
283450
|
-
const
|
|
283451
|
-
return
|
|
283844
|
+
const at2 = (x2) => x2.endedAt ?? x2.deadAt ?? x2.createdAt;
|
|
283845
|
+
return at2(a) < at2(b2) ? a : b2;
|
|
283452
283846
|
}, failedWorks[0]);
|
|
283453
283847
|
const firstFailedAt = firstFailed.endedAt ?? firstFailed.deadAt ?? firstFailed.createdAt;
|
|
283454
283848
|
const sinceMs = now - Date.parse(firstFailedAt);
|
|
@@ -286686,8 +287080,8 @@ function planExec(opts) {
|
|
|
286686
287080
|
function computeExitCode(code2, signal) {
|
|
286687
287081
|
if (code2 !== null) return code2;
|
|
286688
287082
|
if (signal) {
|
|
286689
|
-
const
|
|
286690
|
-
return 128 + (typeof
|
|
287083
|
+
const num5 = os12.constants.signals[signal];
|
|
287084
|
+
return 128 + (typeof num5 === "number" ? num5 : 1);
|
|
286691
287085
|
}
|
|
286692
287086
|
return 1;
|
|
286693
287087
|
}
|
|
@@ -288620,9 +289014,9 @@ function buildCommandIndex() {
|
|
|
288620
289014
|
byGroup.set(decl.group, arr);
|
|
288621
289015
|
}
|
|
288622
289016
|
const NAME_WIDTH = 22;
|
|
288623
|
-
const fmtRow = (key2,
|
|
289017
|
+
const fmtRow = (key2, indent3) => {
|
|
288624
289018
|
const decl = COMMAND_DECLS[key2];
|
|
288625
|
-
const name = " ".repeat(
|
|
289019
|
+
const name = " ".repeat(indent3) + key2;
|
|
288626
289020
|
const summary = decl ? indexSummary(decl.description) : "";
|
|
288627
289021
|
return name.length < NAME_WIDTH ? ` ${name.padEnd(NAME_WIDTH)}${summary}` : ` ${name} ${summary}`;
|
|
288628
289022
|
};
|
|
@@ -289242,15 +289636,16 @@ async function waitForCommandAuthorization(base, headers, draftId, fallback) {
|
|
|
289242
289636
|
const p2 = JSON.parse(dataLine.slice(5).trim());
|
|
289243
289637
|
if (p2.status === "approved") {
|
|
289244
289638
|
receivedTerminal = true;
|
|
289639
|
+
const approver = p2.authorizedByName?.trim() || NEUTRAL_APPROVER;
|
|
289245
289640
|
if (p2.receipt) {
|
|
289246
289641
|
const by2 = p2.authorizedBy ? `
|
|
289247
|
-
\uFF08\u5DF2\u7531 ${
|
|
289642
|
+
\uFF08\u5DF2\u7531 ${approver} \u6388\u6743\u5E76\u4EE5\u5176\u540D\u4E49\u6267\u884C\uFF09` : "";
|
|
289248
289643
|
return {
|
|
289249
289644
|
message: `${p2.receipt.message}${by2}`,
|
|
289250
289645
|
...p2.receipt.data !== void 0 ? { data: p2.receipt.data } : {}
|
|
289251
289646
|
};
|
|
289252
289647
|
}
|
|
289253
|
-
const by = p2.authorizedBy ? `\u5DF2\u7531 ${
|
|
289648
|
+
const by = p2.authorizedBy ? `\u5DF2\u7531 ${approver} \u6388\u6743\u5E76\u4EE5\u5176\u540D\u4E49\u6267\u884C` : "\u4EBA\u5DF2\u6388\u6743\u5E76\u6267\u884C";
|
|
289254
289649
|
return {
|
|
289255
289650
|
message: `\u2713 ${by}\u300C${p2.effectLabel ?? ""}\u300D\u3002`,
|
|
289256
289651
|
data: { outcome: "executed", draftId, ...p2.command ? { command: p2.command } : {} }
|
|
@@ -289292,7 +289687,7 @@ async function waitForCommandAuthorization(base, headers, draftId, fallback) {
|
|
|
289292
289687
|
}
|
|
289293
289688
|
}
|
|
289294
289689
|
}
|
|
289295
|
-
var CLI_VERSION = "2.2.
|
|
289690
|
+
var CLI_VERSION = "2.2.71" ? "2.2.71" : "dev";
|
|
289296
289691
|
function apiHeaders(token, company) {
|
|
289297
289692
|
const headers = {
|
|
289298
289693
|
authorization: `Bearer ${token}`,
|
|
@@ -292394,13 +292789,13 @@ ${res.warning}`);
|
|
|
292394
292789
|
}
|
|
292395
292790
|
break;
|
|
292396
292791
|
}
|
|
292397
|
-
const
|
|
292398
|
-
const which =
|
|
292399
|
-
println(`# ${
|
|
292400
|
-
if (
|
|
292792
|
+
const at2 = c.at;
|
|
292793
|
+
const which = at2.isCurrentHead ? "current head" : "\u5386\u53F2\u7248\u672C";
|
|
292794
|
+
println(`# ${at2.artifactId} @ ${at2.revisionId}\uFF08${which}\uFF09 by ${at2.author} "${at2.reason}"`);
|
|
292795
|
+
if (at2.deliveredHead === null) {
|
|
292401
292796
|
println(`# \u26A0 \u672C\u4EA7\u7269**\u5C1A\u672A\u4EA4\u4ED8**\uFF08\u65E0\u5DF2 conclude \u7684\u7248\u672C\uFF09\u2014\u2014\u4E0B\u6E38\u8FD8\u62FF\u4E0D\u5230\u5B83\u3002`);
|
|
292402
|
-
} else if (
|
|
292403
|
-
println(`# \u26A0 \u5DF2\u4EA4\u4ED8\u7248\u672C\u662F ${
|
|
292797
|
+
} else if (at2.deliveredHead !== at2.revisionId) {
|
|
292798
|
+
println(`# \u26A0 \u5DF2\u4EA4\u4ED8\u7248\u672C\u662F ${at2.deliveredHead}\uFF08**\u4E0B\u6E38\u6D88\u8D39\u7684\u662F\u5B83**\uFF09\u2014\u2014\u8981\u53D6\u90A3\u4E00\u7248\uFF1A\`oasis content ${at2.deliveredHead}\``);
|
|
292404
292799
|
} else {
|
|
292405
292800
|
println(`# = \u5DF2\u4EA4\u4ED8\u7248\u672C\uFF08\u4E0B\u6E38\u6D88\u8D39\u7684\u5C31\u662F\u8FD9\u4E00\u7248\uFF09`);
|
|
292406
292801
|
}
|
|
@@ -293098,7 +293493,7 @@ function shimScript() {
|
|
|
293098
293493
|
}
|
|
293099
293494
|
|
|
293100
293495
|
// src/index.ts
|
|
293101
|
-
var PKG_VERSION = true ? "2.2.
|
|
293496
|
+
var PKG_VERSION = true ? "2.2.71" : "dev";
|
|
293102
293497
|
var LOCAL_BIN = localBin();
|
|
293103
293498
|
var NPM_PREFIX = npmPrefix();
|
|
293104
293499
|
var INSTANCE = DEFAULT_INSTANCE;
|