oasis_test 0.1.140 → 0.1.141
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 +676 -1298
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -703,42 +703,6 @@ var init_daemon_protocol = __esm({
|
|
|
703
703
|
}
|
|
704
704
|
});
|
|
705
705
|
|
|
706
|
-
// ../contract/src/link-windows.ts
|
|
707
|
-
var LINK_WINDOWS;
|
|
708
|
-
var init_link_windows = __esm({
|
|
709
|
-
"../contract/src/link-windows.ts"() {
|
|
710
|
-
"use strict";
|
|
711
|
-
LINK_WINDOWS = {
|
|
712
|
-
/** 服务端在 NDJSON 静默段写空行的周期(`server.ts` 的 `startStreamKeepalive`)。 */
|
|
713
|
-
browserKeepaliveIntervalMs: 15e3,
|
|
714
|
-
/**
|
|
715
|
-
* 浏览器判半开连接的静默阈值(`chat.tsx` 的 `STREAM_SILENCE_MS`)。
|
|
716
|
-
* 判据是「多久没从连接上收到**字节**」——含 keepalive 空行,不是「多久没出帧」:
|
|
717
|
-
* 长思考 / 拼工具入参的静默段本来就没有帧,按帧判必然误杀健康连接。
|
|
718
|
-
*/
|
|
719
|
-
browserStaleAfterMs: 45e3,
|
|
720
|
-
/**
|
|
721
|
-
* 会话进程发完 `session_exited` 后等 ack 的时限(`session-process.ts`)。
|
|
722
|
-
*
|
|
723
|
-
* ADR 0300 D7:取 90 s 覆盖一次 serve 重启(实测停服 27.6~27.9 s,数据面会话最慢 38.6 s 连回,
|
|
724
|
-
* 证据 C/D)。会话进程在这段时间里**不退出**、保持数据面重连;serve 回来后 `ws.on("open")` 会
|
|
725
|
-
* 重发 outbox 里未回执的 `session_exited`(`session-process.ts` 的 `for (const m of this.outbox)`),
|
|
726
|
-
* 服务端 `reconcileChatExitFrame` 按 `dispatchId` 幂等收口——退出帧不再随停服窗口蒸发、账本不再
|
|
727
|
-
* 停在 running 等时钟扫描判孤儿。仍小于会话自尽窗 `SESSION_LIMITS.suicideAfterUnreachableMs`(5 min),
|
|
728
|
-
* 等 ack 期间不会先自尽。**更狠的一层**(进程被 TTL/自尽强杀于窗口内时把未回执帧落 `exit.json`、
|
|
729
|
-
* 由 daemon 信使补发)属 D7 后续,另计。
|
|
730
|
-
*/
|
|
731
|
-
exitAckWaitMs: 9e4,
|
|
732
|
-
/** hub 对「暂无人认领」的会话在 serve 冷启动后挂起重判的宽限(`daemon-hub.ts`)。 */
|
|
733
|
-
hubColdStartGraceMs: 9e4,
|
|
734
|
-
/** orphan-sweep 判「账上在跑、四张认领表都不认」为孤儿的宽限(`serve.ts`)。 */
|
|
735
|
-
orphanGraceMs: 12e4,
|
|
736
|
-
/** orphan-sweep 在 serve 冷启动后推迟判孤儿的窗口(`serve.ts`)。 */
|
|
737
|
-
orphanColdStartGraceMs: 18e4
|
|
738
|
-
};
|
|
739
|
-
}
|
|
740
|
-
});
|
|
741
|
-
|
|
742
706
|
// ../contract/src/registry.ts
|
|
743
707
|
var AGENT_PREFS_DEFAULTS;
|
|
744
708
|
var init_registry = __esm({
|
|
@@ -945,13 +909,6 @@ var init_playbook = __esm({
|
|
|
945
909
|
}
|
|
946
910
|
});
|
|
947
911
|
|
|
948
|
-
// ../contract/src/experiments.ts
|
|
949
|
-
var init_experiments = __esm({
|
|
950
|
-
"../contract/src/experiments.ts"() {
|
|
951
|
-
"use strict";
|
|
952
|
-
}
|
|
953
|
-
});
|
|
954
|
-
|
|
955
912
|
// ../contract/src/chat.ts
|
|
956
913
|
var init_chat = __esm({
|
|
957
914
|
"../contract/src/chat.ts"() {
|
|
@@ -1029,7 +986,6 @@ var init_src = __esm({
|
|
|
1029
986
|
init_runtime();
|
|
1030
987
|
init_parse_extra_args();
|
|
1031
988
|
init_daemon_protocol();
|
|
1032
|
-
init_link_windows();
|
|
1033
989
|
init_registry();
|
|
1034
990
|
init_credential_ref();
|
|
1035
991
|
init_credential_gap();
|
|
@@ -1039,7 +995,6 @@ var init_src = __esm({
|
|
|
1039
995
|
init_execution_continuity();
|
|
1040
996
|
init_automation();
|
|
1041
997
|
init_playbook();
|
|
1042
|
-
init_experiments();
|
|
1043
998
|
init_chat();
|
|
1044
999
|
init_live_protocol();
|
|
1045
1000
|
init_chat_turn();
|
|
@@ -7929,7 +7884,7 @@ function scan(state, ctx) {
|
|
|
7929
7884
|
}
|
|
7930
7885
|
const blockers = scanBlockersForNode(state, node2, lw);
|
|
7931
7886
|
const selfStop = blockers.some(
|
|
7932
|
-
(b2) => b2.
|
|
7887
|
+
(b2) => b2.kind === "open-gap" || b2.kind === "escalation" || b2.kind === "open-self-annotation"
|
|
7933
7888
|
);
|
|
7934
7889
|
if (selfStop && !passDispatch(blockers, node2.assigneeActorId)) {
|
|
7935
7890
|
continue;
|
|
@@ -10221,20 +10176,20 @@ var require_utils = __commonJS({
|
|
|
10221
10176
|
}
|
|
10222
10177
|
return config2;
|
|
10223
10178
|
}
|
|
10224
|
-
var escapeIdentifier2 = function(
|
|
10225
|
-
return '"' +
|
|
10179
|
+
var escapeIdentifier2 = function(str2) {
|
|
10180
|
+
return '"' + str2.replace(/"/g, '""') + '"';
|
|
10226
10181
|
};
|
|
10227
|
-
var escapeLiteral2 = function(
|
|
10182
|
+
var escapeLiteral2 = function(str2) {
|
|
10228
10183
|
let hasBackslash = false;
|
|
10229
10184
|
let escaped = "'";
|
|
10230
|
-
if (
|
|
10185
|
+
if (str2 == null) {
|
|
10231
10186
|
return "''";
|
|
10232
10187
|
}
|
|
10233
|
-
if (typeof
|
|
10188
|
+
if (typeof str2 !== "string") {
|
|
10234
10189
|
return "''";
|
|
10235
10190
|
}
|
|
10236
|
-
for (let i = 0; i <
|
|
10237
|
-
const c =
|
|
10191
|
+
for (let i = 0; i < str2.length; i++) {
|
|
10192
|
+
const c = str2[i];
|
|
10238
10193
|
if (c === "'") {
|
|
10239
10194
|
escaped += c + c;
|
|
10240
10195
|
} else if (c === "\\") {
|
|
@@ -10649,22 +10604,22 @@ var require_type_overrides = __commonJS({
|
|
|
10649
10604
|
var require_pg_connection_string = __commonJS({
|
|
10650
10605
|
"../../node_modules/.pnpm/pg-connection-string@2.13.0/node_modules/pg-connection-string/index.js"(exports2, module2) {
|
|
10651
10606
|
"use strict";
|
|
10652
|
-
function parse5(
|
|
10653
|
-
if (
|
|
10654
|
-
const config3 =
|
|
10607
|
+
function parse5(str2, options = {}) {
|
|
10608
|
+
if (str2.charAt(0) === "/") {
|
|
10609
|
+
const config3 = str2.split(" ");
|
|
10655
10610
|
return { host: config3[0], database: config3[1] };
|
|
10656
10611
|
}
|
|
10657
10612
|
const config2 = /* @__PURE__ */ Object.create(null);
|
|
10658
10613
|
let result;
|
|
10659
10614
|
let dummyHost = false;
|
|
10660
|
-
if (/ |%[^a-f0-9]|%[a-f0-9][^a-f0-9]/i.test(
|
|
10661
|
-
|
|
10615
|
+
if (/ |%[^a-f0-9]|%[a-f0-9][^a-f0-9]/i.test(str2)) {
|
|
10616
|
+
str2 = encodeURI(str2).replace(/%25(\d\d)/g, "%$1");
|
|
10662
10617
|
}
|
|
10663
10618
|
try {
|
|
10664
10619
|
try {
|
|
10665
|
-
result = new URL(
|
|
10620
|
+
result = new URL(str2, "postgres://base");
|
|
10666
10621
|
} catch (e) {
|
|
10667
|
-
result = new URL(
|
|
10622
|
+
result = new URL(str2.replace("@/", "@___DUMMY___/"), "postgres://base");
|
|
10668
10623
|
dummyHost = true;
|
|
10669
10624
|
}
|
|
10670
10625
|
} catch (err) {
|
|
@@ -10807,8 +10762,8 @@ var require_pg_connection_string = __commonJS({
|
|
|
10807
10762
|
}, /* @__PURE__ */ Object.create(null));
|
|
10808
10763
|
return poolConfig;
|
|
10809
10764
|
}
|
|
10810
|
-
function parseIntoClientConfig(
|
|
10811
|
-
return toClientConfig(parse5(
|
|
10765
|
+
function parseIntoClientConfig(str2) {
|
|
10766
|
+
return toClientConfig(parse5(str2));
|
|
10812
10767
|
}
|
|
10813
10768
|
function deprecatedSslModeWarning(sslmode) {
|
|
10814
10769
|
if (!deprecatedSslModeWarning.warned && typeof process !== "undefined" && process.emitWarning) {
|
|
@@ -13156,11 +13111,11 @@ var require_client = __commonJS({
|
|
|
13156
13111
|
// escapeIdentifier and escapeLiteral moved to utility functions & exported
|
|
13157
13112
|
// on PG
|
|
13158
13113
|
// re-exported here for backwards compatibility
|
|
13159
|
-
escapeIdentifier(
|
|
13160
|
-
return utils.escapeIdentifier(
|
|
13114
|
+
escapeIdentifier(str2) {
|
|
13115
|
+
return utils.escapeIdentifier(str2);
|
|
13161
13116
|
}
|
|
13162
|
-
escapeLiteral(
|
|
13163
|
-
return utils.escapeLiteral(
|
|
13117
|
+
escapeLiteral(str2) {
|
|
13118
|
+
return utils.escapeLiteral(str2);
|
|
13164
13119
|
}
|
|
13165
13120
|
_pulseQueryQueue() {
|
|
13166
13121
|
if (this.readyForQuery === true) {
|
|
@@ -15763,10 +15718,6 @@ var init_issue = __esm({
|
|
|
15763
15718
|
apply(e, state, ctx) {
|
|
15764
15719
|
const issue2 = state.issue(e.issueId);
|
|
15765
15720
|
if (!issue2 || issue2.resolvedAt !== null) return;
|
|
15766
|
-
const humanResolution = e.by.startsWith("actor:human:") && e.by === ctx.actorId;
|
|
15767
|
-
if (e.semanticsVersion === 2 && issue2.kind === "escalation" && !humanResolution) {
|
|
15768
|
-
throw new Error("\u5173\u95ED\u5347\u7EA7\u9700\u8981\u4EBA\u660E\u786E\u786E\u8BA4\uFF1Bagent \u8BF7\u63D0\u4EA4\u5173\u95ED\u6388\u6743\u7533\u8BF7");
|
|
15769
|
-
}
|
|
15770
15721
|
state.updateIssue(e.issueId, {
|
|
15771
15722
|
proposedResolution: null,
|
|
15772
15723
|
proposedBy: null,
|
|
@@ -15777,7 +15728,7 @@ var init_issue = __esm({
|
|
|
15777
15728
|
resolvedNote: e.note,
|
|
15778
15729
|
resolvedViaWorkId: e.viaWorkId
|
|
15779
15730
|
});
|
|
15780
|
-
if (issue2.kind === "gap"
|
|
15731
|
+
if (issue2.kind === "gap") {
|
|
15781
15732
|
for (const other of state.allIssues()) {
|
|
15782
15733
|
if (other.kind === "escalation" && other.resolvedAt === null && other.workorderId === issue2.workorderId && other.gapId === issue2.id) {
|
|
15783
15734
|
state.updateIssue(other.id, {
|
|
@@ -16023,7 +15974,7 @@ var init_review = __esm({
|
|
|
16023
15974
|
const workStartedOrCreated = w2.startedAt ?? w2.createdAt;
|
|
16024
15975
|
for (const issue2 of state.allIssues()) {
|
|
16025
15976
|
if (issue2.resolvedAt !== null) continue;
|
|
16026
|
-
if (issue2.kind !== "change_request" &&
|
|
15977
|
+
if (issue2.kind !== "change_request" && issue2.kind !== "escalation") continue;
|
|
16027
15978
|
if (issue2.aboutNodeId !== w2.nodeId) continue;
|
|
16028
15979
|
if (issue2.aboutWorkId === e.workId) continue;
|
|
16029
15980
|
if (issue2.createdAt > workStartedOrCreated) continue;
|
|
@@ -16174,12 +16125,6 @@ var init_handlers = __esm({
|
|
|
16174
16125
|
});
|
|
16175
16126
|
|
|
16176
16127
|
// ../engine/src/bus.ts
|
|
16177
|
-
function versionEscalationResolution(event) {
|
|
16178
|
-
if (event.kind === "work.accept" || event.kind === "issue.resolve") {
|
|
16179
|
-
return { ...event, semanticsVersion: 2 };
|
|
16180
|
-
}
|
|
16181
|
-
return event;
|
|
16182
|
-
}
|
|
16183
16128
|
function emptySnapshotPlaceholder(record8) {
|
|
16184
16129
|
return {
|
|
16185
16130
|
workorder: {
|
|
@@ -16392,7 +16337,7 @@ var init_bus = __esm({
|
|
|
16392
16337
|
workorderId: input.workorderId,
|
|
16393
16338
|
actorId: input.actorId,
|
|
16394
16339
|
handActorId: input.handActorId ?? null,
|
|
16395
|
-
event:
|
|
16340
|
+
event: input.event,
|
|
16396
16341
|
causedBySeq: null,
|
|
16397
16342
|
origin: "command",
|
|
16398
16343
|
dedupKey: input.dedupKey ?? null,
|
|
@@ -16652,7 +16597,7 @@ var init_bus = __esm({
|
|
|
16652
16597
|
workorderId: record8.workorderId,
|
|
16653
16598
|
actorId: SYSTEM_ACTOR2,
|
|
16654
16599
|
handActorId: null,
|
|
16655
|
-
event
|
|
16600
|
+
event,
|
|
16656
16601
|
causedBySeq: record8.seq,
|
|
16657
16602
|
origin: "apply",
|
|
16658
16603
|
dedupKey: null,
|
|
@@ -16749,7 +16694,7 @@ var init_bus = __esm({
|
|
|
16749
16694
|
workorderId: record8.workorderId,
|
|
16750
16695
|
actorId: b2.actorId ?? SYSTEM_ACTOR2,
|
|
16751
16696
|
handActorId: null,
|
|
16752
|
-
event:
|
|
16697
|
+
event: b2.event,
|
|
16753
16698
|
causedBySeq: record8.seq,
|
|
16754
16699
|
origin: "effect",
|
|
16755
16700
|
dedupKey: b2.dedupKey ?? null,
|
|
@@ -16787,7 +16732,7 @@ var init_bus = __esm({
|
|
|
16787
16732
|
workorderId,
|
|
16788
16733
|
actorId: SYSTEM_ACTOR2,
|
|
16789
16734
|
handActorId: null,
|
|
16790
|
-
event
|
|
16735
|
+
event,
|
|
16791
16736
|
causedBySeq: null,
|
|
16792
16737
|
origin: "apply",
|
|
16793
16738
|
dedupKey: null,
|
|
@@ -16839,7 +16784,7 @@ var init_bus = __esm({
|
|
|
16839
16784
|
workorderId: record8.workorderId,
|
|
16840
16785
|
actorId: SYSTEM_ACTOR2,
|
|
16841
16786
|
handActorId: null,
|
|
16842
|
-
event
|
|
16787
|
+
event,
|
|
16843
16788
|
causedBySeq: record8.seq,
|
|
16844
16789
|
origin: "apply",
|
|
16845
16790
|
dedupKey: null,
|
|
@@ -19249,17 +19194,12 @@ var init_kernel_bridge = __esm({
|
|
|
19249
19194
|
handActorId: args.hand ?? null,
|
|
19250
19195
|
...args.intent !== void 0 ? { intent: args.intent } : {},
|
|
19251
19196
|
...args.source !== void 0 ? { source: args.source } : {},
|
|
19252
|
-
|
|
19253
|
-
// Human/team lead delivery additionally uses the same live recipient projection as the Inbox.
|
|
19254
|
-
recipients: [...new Set([brief?.owner ?? art?.owner].filter((id) => !!id))],
|
|
19197
|
+
recipients: [this.model.artifacts.get(args.artifactId)?.owner ?? ""],
|
|
19255
19198
|
attachments: []
|
|
19256
19199
|
}
|
|
19257
19200
|
});
|
|
19258
19201
|
}
|
|
19259
19202
|
async resolveEscalation(args) {
|
|
19260
|
-
if (!args.actor.startsWith("actor:human:")) {
|
|
19261
|
-
throw new Error("\u5173\u95ED\u5347\u7EA7\u9700\u8981\u4EBA\u660E\u786E\u786E\u8BA4\uFF1Bagent \u8BF7\u63D0\u4EA4\u5173\u95ED\u6388\u6743\u7533\u8BF7");
|
|
19262
|
-
}
|
|
19263
19203
|
if (args.escalationId) {
|
|
19264
19204
|
for (const [artifactId, escs] of this.model.escalations) {
|
|
19265
19205
|
if (escs.some((e) => e.escalationId === args.escalationId)) {
|
|
@@ -19348,7 +19288,7 @@ var init_kernel_bridge = __esm({
|
|
|
19348
19288
|
});
|
|
19349
19289
|
}
|
|
19350
19290
|
/**
|
|
19351
|
-
*
|
|
19291
|
+
* 暂停派发。
|
|
19352
19292
|
*
|
|
19353
19293
|
* ★ 2026-08-27(docs/proposals/hold-is-not-reject.md §A):**暂停不是驳回。**
|
|
19354
19294
|
*
|
|
@@ -19402,10 +19342,6 @@ var init_kernel_bridge = __esm({
|
|
|
19402
19342
|
return { kind: "reviews-stopped", workId: headWork.id, reviewIds: killable.map((r) => r.id) };
|
|
19403
19343
|
}
|
|
19404
19344
|
const latestWork = snap?.works.filter((w2) => w2.nodeId === args.artifactId).sort((a, b2) => b2.createdAt.localeCompare(a.createdAt))[0];
|
|
19405
|
-
if (!latestWork) return { kind: "nothing-to-stop", workId: null };
|
|
19406
|
-
if ((!headWork || !isWorkKillable(headWork)) && !isWorkKillable(latestWork) && !(snap?.reviews ?? []).some((r) => r.nodeId === args.artifactId && isReviewKillable(r))) {
|
|
19407
|
-
return { kind: "nothing-to-stop", workId: latestWork.id };
|
|
19408
|
-
}
|
|
19409
19345
|
await this.commit({
|
|
19410
19346
|
companyId: "",
|
|
19411
19347
|
workorderId: wid,
|
|
@@ -19414,11 +19350,11 @@ var init_kernel_bridge = __esm({
|
|
|
19414
19350
|
kind: "work.kill",
|
|
19415
19351
|
workorderId: wid,
|
|
19416
19352
|
nodeId: args.artifactId,
|
|
19417
|
-
workId: latestWork.
|
|
19353
|
+
workId: latestWork?.id ?? `wk:${args.artifactId}:unknown`,
|
|
19418
19354
|
reason
|
|
19419
19355
|
}
|
|
19420
19356
|
});
|
|
19421
|
-
return { kind: "work-killed", workId: latestWork
|
|
19357
|
+
return { kind: "work-killed", workId: latestWork?.id ?? null };
|
|
19422
19358
|
}
|
|
19423
19359
|
async release(args) {
|
|
19424
19360
|
await this.refreshTracked();
|
|
@@ -29915,11 +29851,11 @@ var require_mime_types = __commonJS({
|
|
|
29915
29851
|
}
|
|
29916
29852
|
return false;
|
|
29917
29853
|
}
|
|
29918
|
-
function contentType(
|
|
29919
|
-
if (!
|
|
29854
|
+
function contentType(str2) {
|
|
29855
|
+
if (!str2 || typeof str2 !== "string") {
|
|
29920
29856
|
return false;
|
|
29921
29857
|
}
|
|
29922
|
-
var mime =
|
|
29858
|
+
var mime = str2.indexOf("/") === -1 ? exports2.lookup(str2) : str2;
|
|
29923
29859
|
if (!mime) {
|
|
29924
29860
|
return false;
|
|
29925
29861
|
}
|
|
@@ -30482,14 +30418,14 @@ var require_implementation = __commonJS({
|
|
|
30482
30418
|
return arr;
|
|
30483
30419
|
};
|
|
30484
30420
|
var joiny = function(arr, joiner) {
|
|
30485
|
-
var
|
|
30421
|
+
var str2 = "";
|
|
30486
30422
|
for (var i = 0; i < arr.length; i += 1) {
|
|
30487
|
-
|
|
30423
|
+
str2 += arr[i];
|
|
30488
30424
|
if (i + 1 < arr.length) {
|
|
30489
|
-
|
|
30425
|
+
str2 += joiner;
|
|
30490
30426
|
}
|
|
30491
30427
|
}
|
|
30492
|
-
return
|
|
30428
|
+
return str2;
|
|
30493
30429
|
};
|
|
30494
30430
|
module2.exports = function bind(that) {
|
|
30495
30431
|
var target = this;
|
|
@@ -31061,8 +30997,8 @@ var require_form_data = __commonJS({
|
|
|
31061
30997
|
var setToStringTag = require_es_set_tostringtag();
|
|
31062
30998
|
var hasOwn = require_hasown();
|
|
31063
30999
|
var populate = require_populate();
|
|
31064
|
-
function escapeHeaderParam(
|
|
31065
|
-
return String(
|
|
31000
|
+
function escapeHeaderParam(str2) {
|
|
31001
|
+
return String(str2).replace(/\r/g, "%0D").replace(/\n/g, "%0A").replace(/"/g, "%22");
|
|
31066
31002
|
}
|
|
31067
31003
|
function FormData2(options) {
|
|
31068
31004
|
if (!(this instanceof FormData2)) {
|
|
@@ -31456,13 +31392,13 @@ var require_ms = __commonJS({
|
|
|
31456
31392
|
"val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
|
|
31457
31393
|
);
|
|
31458
31394
|
};
|
|
31459
|
-
function parse5(
|
|
31460
|
-
|
|
31461
|
-
if (
|
|
31395
|
+
function parse5(str2) {
|
|
31396
|
+
str2 = String(str2);
|
|
31397
|
+
if (str2.length > 100) {
|
|
31462
31398
|
return;
|
|
31463
31399
|
}
|
|
31464
31400
|
var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
|
|
31465
|
-
|
|
31401
|
+
str2
|
|
31466
31402
|
);
|
|
31467
31403
|
if (!match) {
|
|
31468
31404
|
return;
|
|
@@ -32063,7 +31999,7 @@ var require_node = __commonJS({
|
|
|
32063
31999
|
var { formatters } = module2.exports;
|
|
32064
32000
|
formatters.o = function(v2) {
|
|
32065
32001
|
this.inspectOpts.colors = this.useColors;
|
|
32066
|
-
return util2.inspect(v2, this.inspectOpts).split("\n").map((
|
|
32002
|
+
return util2.inspect(v2, this.inspectOpts).split("\n").map((str2) => str2.trim()).join(" ");
|
|
32067
32003
|
};
|
|
32068
32004
|
formatters.O = function(v2) {
|
|
32069
32005
|
this.inspectOpts.colors = this.useColors;
|
|
@@ -32653,8 +32589,8 @@ var require_axios = __commonJS({
|
|
|
32653
32589
|
var { getPrototypeOf } = Object;
|
|
32654
32590
|
var { iterator, toStringTag } = Symbol;
|
|
32655
32591
|
var kindOf3 = /* @__PURE__ */ ((cache) => (thing) => {
|
|
32656
|
-
const
|
|
32657
|
-
return cache[
|
|
32592
|
+
const str2 = toString2.call(thing);
|
|
32593
|
+
return cache[str2] || (cache[str2] = str2.slice(8, -1).toLowerCase());
|
|
32658
32594
|
})(/* @__PURE__ */ Object.create(null));
|
|
32659
32595
|
var kindOfTest = (type) => {
|
|
32660
32596
|
type = type.toLowerCase();
|
|
@@ -32728,8 +32664,8 @@ var require_axios = __commonJS({
|
|
|
32728
32664
|
"Response",
|
|
32729
32665
|
"Headers"
|
|
32730
32666
|
].map(kindOfTest);
|
|
32731
|
-
var trim = (
|
|
32732
|
-
return
|
|
32667
|
+
var trim = (str2) => {
|
|
32668
|
+
return str2.trim ? str2.trim() : str2.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
32733
32669
|
};
|
|
32734
32670
|
function forEach(obj, fn, { allOwnKeys = false } = {}) {
|
|
32735
32671
|
if (obj === null || typeof obj === "undefined") {
|
|
@@ -32865,13 +32801,13 @@ var require_axios = __commonJS({
|
|
|
32865
32801
|
} while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
|
|
32866
32802
|
return destObj;
|
|
32867
32803
|
};
|
|
32868
|
-
var endsWith = (
|
|
32869
|
-
|
|
32870
|
-
if (position2 === void 0 || position2 >
|
|
32871
|
-
position2 =
|
|
32804
|
+
var endsWith = (str2, searchString, position2) => {
|
|
32805
|
+
str2 = String(str2);
|
|
32806
|
+
if (position2 === void 0 || position2 > str2.length) {
|
|
32807
|
+
position2 = str2.length;
|
|
32872
32808
|
}
|
|
32873
32809
|
position2 -= searchString.length;
|
|
32874
|
-
const lastIndex =
|
|
32810
|
+
const lastIndex = str2.indexOf(searchString, position2);
|
|
32875
32811
|
return lastIndex !== -1 && lastIndex === position2;
|
|
32876
32812
|
};
|
|
32877
32813
|
var toArray = (thing) => {
|
|
@@ -32899,17 +32835,17 @@ var require_axios = __commonJS({
|
|
|
32899
32835
|
fn.call(obj, pair[0], pair[1]);
|
|
32900
32836
|
}
|
|
32901
32837
|
};
|
|
32902
|
-
var matchAll = (regExp,
|
|
32838
|
+
var matchAll = (regExp, str2) => {
|
|
32903
32839
|
let matches;
|
|
32904
32840
|
const arr = [];
|
|
32905
|
-
while ((matches = regExp.exec(
|
|
32841
|
+
while ((matches = regExp.exec(str2)) !== null) {
|
|
32906
32842
|
arr.push(matches);
|
|
32907
32843
|
}
|
|
32908
32844
|
return arr;
|
|
32909
32845
|
};
|
|
32910
32846
|
var isHTMLForm = kindOfTest("HTMLFormElement");
|
|
32911
|
-
var toCamelCase = (
|
|
32912
|
-
return
|
|
32847
|
+
var toCamelCase = (str2) => {
|
|
32848
|
+
return str2.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m2, p1, p2) {
|
|
32913
32849
|
return p1.toUpperCase() + p2;
|
|
32914
32850
|
});
|
|
32915
32851
|
};
|
|
@@ -33262,7 +33198,7 @@ var require_axios = __commonJS({
|
|
|
33262
33198
|
build(obj);
|
|
33263
33199
|
return formData;
|
|
33264
33200
|
}
|
|
33265
|
-
function encode$1(
|
|
33201
|
+
function encode$1(str2) {
|
|
33266
33202
|
const charMap = {
|
|
33267
33203
|
"!": "%21",
|
|
33268
33204
|
"'": "%27",
|
|
@@ -33272,7 +33208,7 @@ var require_axios = __commonJS({
|
|
|
33272
33208
|
"%20": "+",
|
|
33273
33209
|
"%00": "\0"
|
|
33274
33210
|
};
|
|
33275
|
-
return encodeURIComponent(
|
|
33211
|
+
return encodeURIComponent(str2).replace(/[!'()~]|%20|%00/g, function replacer(match) {
|
|
33276
33212
|
return charMap[match];
|
|
33277
33213
|
});
|
|
33278
33214
|
}
|
|
@@ -33397,14 +33333,14 @@ var require_axios = __commonJS({
|
|
|
33397
33333
|
ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
|
|
33398
33334
|
};
|
|
33399
33335
|
var generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
|
|
33400
|
-
let
|
|
33336
|
+
let str2 = "";
|
|
33401
33337
|
const { length } = alphabet;
|
|
33402
33338
|
const randomValues = new Uint32Array(size);
|
|
33403
33339
|
crypto__default["default"].randomFillSync(randomValues);
|
|
33404
33340
|
for (let i = 0; i < size; i++) {
|
|
33405
|
-
|
|
33341
|
+
str2 += alphabet[randomValues[i] % length];
|
|
33406
33342
|
}
|
|
33407
|
-
return
|
|
33343
|
+
return str2;
|
|
33408
33344
|
};
|
|
33409
33345
|
var platform$1 = {
|
|
33410
33346
|
isNode: true,
|
|
@@ -33433,14 +33369,14 @@ var require_axios = __commonJS({
|
|
|
33433
33369
|
navigator: _navigator,
|
|
33434
33370
|
origin
|
|
33435
33371
|
});
|
|
33436
|
-
var
|
|
33372
|
+
var platform = {
|
|
33437
33373
|
...utils,
|
|
33438
33374
|
...platform$1
|
|
33439
33375
|
};
|
|
33440
33376
|
function toURLEncodedForm(data, options) {
|
|
33441
|
-
return toFormData(data, new
|
|
33377
|
+
return toFormData(data, new platform.classes.URLSearchParams(), {
|
|
33442
33378
|
visitor: function(value2, key, path42, helpers) {
|
|
33443
|
-
if (
|
|
33379
|
+
if (platform.isNode && utils$1.isBuffer(value2)) {
|
|
33444
33380
|
this.append(key, value2.toString("base64"));
|
|
33445
33381
|
return false;
|
|
33446
33382
|
}
|
|
@@ -33593,8 +33529,8 @@ var require_axios = __commonJS({
|
|
|
33593
33529
|
maxContentLength: -1,
|
|
33594
33530
|
maxBodyLength: -1,
|
|
33595
33531
|
env: {
|
|
33596
|
-
FormData:
|
|
33597
|
-
Blob:
|
|
33532
|
+
FormData: platform.classes.FormData,
|
|
33533
|
+
Blob: platform.classes.Blob
|
|
33598
33534
|
},
|
|
33599
33535
|
validateStatus: function validateStatus(status) {
|
|
33600
33536
|
return status >= 200 && status < 300;
|
|
@@ -33663,16 +33599,16 @@ var require_axios = __commonJS({
|
|
|
33663
33599
|
}
|
|
33664
33600
|
return utils$1.isArray(value2) ? value2.map(normalizeValue) : String(value2);
|
|
33665
33601
|
}
|
|
33666
|
-
function parseTokens(
|
|
33602
|
+
function parseTokens(str2) {
|
|
33667
33603
|
const tokens = /* @__PURE__ */ Object.create(null);
|
|
33668
33604
|
const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
|
33669
33605
|
let match;
|
|
33670
|
-
while (match = tokensRE.exec(
|
|
33606
|
+
while (match = tokensRE.exec(str2)) {
|
|
33671
33607
|
tokens[match[1]] = match[2];
|
|
33672
33608
|
}
|
|
33673
33609
|
return tokens;
|
|
33674
33610
|
}
|
|
33675
|
-
var isValidHeaderName = (
|
|
33611
|
+
var isValidHeaderName = (str2) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str2.trim());
|
|
33676
33612
|
function matchHeaderValue(context2, value2, header, filter, isHeaderNameFilter) {
|
|
33677
33613
|
if (utils$1.isFunction(filter)) {
|
|
33678
33614
|
return filter.call(this, value2, header);
|
|
@@ -33689,8 +33625,8 @@ var require_axios = __commonJS({
|
|
|
33689
33625
|
}
|
|
33690
33626
|
}
|
|
33691
33627
|
function formatHeader(header) {
|
|
33692
|
-
return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w2, char,
|
|
33693
|
-
return char.toUpperCase() +
|
|
33628
|
+
return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w2, char, str2) => {
|
|
33629
|
+
return char.toUpperCase() + str2;
|
|
33694
33630
|
});
|
|
33695
33631
|
}
|
|
33696
33632
|
function buildAccessors(obj, header) {
|
|
@@ -33957,7 +33893,7 @@ var require_axios = __commonJS({
|
|
|
33957
33893
|
}
|
|
33958
33894
|
var DATA_URL_PATTERN = /^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;
|
|
33959
33895
|
function fromDataURI(uri, asBlob, options) {
|
|
33960
|
-
const _Blob = options && options.Blob ||
|
|
33896
|
+
const _Blob = options && options.Blob || platform.classes.Blob;
|
|
33961
33897
|
const protocol = parseProtocol(uri);
|
|
33962
33898
|
if (asBlob === void 0 && _Blob) {
|
|
33963
33899
|
asBlob = true;
|
|
@@ -34115,7 +34051,7 @@ var require_axios = __commonJS({
|
|
|
34115
34051
|
}
|
|
34116
34052
|
};
|
|
34117
34053
|
var readBlob$1 = readBlob;
|
|
34118
|
-
var BOUNDARY_ALPHABET =
|
|
34054
|
+
var BOUNDARY_ALPHABET = platform.ALPHABET.ALPHA_DIGIT + "-_";
|
|
34119
34055
|
var textEncoder = typeof TextEncoder === "function" ? new TextEncoder() : new util__default["default"].TextEncoder();
|
|
34120
34056
|
var CRLF = "\r\n";
|
|
34121
34057
|
var CRLF_BYTES = textEncoder.encode(CRLF);
|
|
@@ -34161,7 +34097,7 @@ var require_axios = __commonJS({
|
|
|
34161
34097
|
const {
|
|
34162
34098
|
tag = "form-data-boundary",
|
|
34163
34099
|
size = 25,
|
|
34164
|
-
boundary = tag + "-" +
|
|
34100
|
+
boundary = tag + "-" + platform.generateString(size, BOUNDARY_ALPHABET)
|
|
34165
34101
|
} = options || {};
|
|
34166
34102
|
if (!utils$1.isFormData(form)) {
|
|
34167
34103
|
throw TypeError("FormData instance required");
|
|
@@ -34390,7 +34326,7 @@ var require_axios = __commonJS({
|
|
|
34390
34326
|
var isBrotliSupported = utils$1.isFunction(zlib__default["default"].createBrotliDecompress);
|
|
34391
34327
|
var { http: httpFollow, https: httpsFollow } = followRedirects__default["default"];
|
|
34392
34328
|
var isHttps = /https:?/;
|
|
34393
|
-
var supportedProtocols =
|
|
34329
|
+
var supportedProtocols = platform.protocols.map((protocol) => {
|
|
34394
34330
|
return protocol + ":";
|
|
34395
34331
|
});
|
|
34396
34332
|
var flushOnFinish = (stream2, [throttled, flush]) => {
|
|
@@ -34642,7 +34578,7 @@ var require_axios = __commonJS({
|
|
|
34642
34578
|
}
|
|
34643
34579
|
});
|
|
34644
34580
|
const fullPath = buildFullPath(config2.baseURL, config2.url, config2.allowAbsoluteUrls);
|
|
34645
|
-
const parsed = new URL(fullPath,
|
|
34581
|
+
const parsed = new URL(fullPath, platform.hasBrowserEnv ? platform.origin : void 0);
|
|
34646
34582
|
const protocol = parsed.protocol || supportedProtocols[0];
|
|
34647
34583
|
if (protocol === "data:") {
|
|
34648
34584
|
if (config2.maxContentLength > -1) {
|
|
@@ -35050,14 +34986,14 @@ var require_axios = __commonJS({
|
|
|
35050
34986
|
}
|
|
35051
34987
|
});
|
|
35052
34988
|
};
|
|
35053
|
-
var isURLSameOrigin =
|
|
35054
|
-
url2 = new URL(url2,
|
|
34989
|
+
var isURLSameOrigin = platform.hasStandardBrowserEnv ? /* @__PURE__ */ ((origin2, isMSIE) => (url2) => {
|
|
34990
|
+
url2 = new URL(url2, platform.origin);
|
|
35055
34991
|
return origin2.protocol === url2.protocol && origin2.host === url2.host && (isMSIE || origin2.port === url2.port);
|
|
35056
34992
|
})(
|
|
35057
|
-
new URL(
|
|
35058
|
-
|
|
34993
|
+
new URL(platform.origin),
|
|
34994
|
+
platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
|
|
35059
34995
|
) : () => true;
|
|
35060
|
-
var cookies =
|
|
34996
|
+
var cookies = platform.hasStandardBrowserEnv ? (
|
|
35061
34997
|
// Standard browser envs support document.cookie
|
|
35062
34998
|
{
|
|
35063
34999
|
write(name, value2, expires, path42, domain2, secure, sameSite) {
|
|
@@ -35198,7 +35134,7 @@ var require_axios = __commonJS({
|
|
|
35198
35134
|
);
|
|
35199
35135
|
}
|
|
35200
35136
|
if (utils$1.isFormData(data)) {
|
|
35201
|
-
if (
|
|
35137
|
+
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
|
|
35202
35138
|
headers.setContentType(void 0);
|
|
35203
35139
|
} else if (utils$1.isFunction(data.getHeaders)) {
|
|
35204
35140
|
const formHeaders = data.getHeaders();
|
|
@@ -35210,7 +35146,7 @@ var require_axios = __commonJS({
|
|
|
35210
35146
|
});
|
|
35211
35147
|
}
|
|
35212
35148
|
}
|
|
35213
|
-
if (
|
|
35149
|
+
if (platform.hasStandardBrowserEnv) {
|
|
35214
35150
|
withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
|
|
35215
35151
|
if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(newConfig.url)) {
|
|
35216
35152
|
const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
|
|
@@ -35348,7 +35284,7 @@ var require_axios = __commonJS({
|
|
|
35348
35284
|
}
|
|
35349
35285
|
}
|
|
35350
35286
|
const protocol = parseProtocol(_config.url);
|
|
35351
|
-
if (protocol &&
|
|
35287
|
+
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
|
35352
35288
|
reject(
|
|
35353
35289
|
new AxiosError$1(
|
|
35354
35290
|
"Unsupported protocol " + protocol + ":",
|
|
@@ -35505,10 +35441,10 @@ var require_axios = __commonJS({
|
|
|
35505
35441
|
return false;
|
|
35506
35442
|
}
|
|
35507
35443
|
const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
|
|
35508
|
-
const encodeText = isFetchSupported && (typeof TextEncoder$1 === "function" ? /* @__PURE__ */ ((encoder) => (
|
|
35444
|
+
const encodeText = isFetchSupported && (typeof TextEncoder$1 === "function" ? /* @__PURE__ */ ((encoder) => (str2) => encoder.encode(str2))(new TextEncoder$1()) : async (str2) => new Uint8Array(await new Request(str2).arrayBuffer()));
|
|
35509
35445
|
const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
|
|
35510
35446
|
let duplexAccessed = false;
|
|
35511
|
-
const hasContentType = new Request(
|
|
35447
|
+
const hasContentType = new Request(platform.origin, {
|
|
35512
35448
|
body: new ReadableStream$1(),
|
|
35513
35449
|
method: "POST",
|
|
35514
35450
|
get duplex() {
|
|
@@ -35545,7 +35481,7 @@ var require_axios = __commonJS({
|
|
|
35545
35481
|
return body2.size;
|
|
35546
35482
|
}
|
|
35547
35483
|
if (utils$1.isSpecCompliantForm(body2)) {
|
|
35548
|
-
const _request = new Request(
|
|
35484
|
+
const _request = new Request(platform.origin, {
|
|
35549
35485
|
method: "POST",
|
|
35550
35486
|
body: body2
|
|
35551
35487
|
});
|
|
@@ -36308,20 +36244,20 @@ var require_object_inspect = __commonJS({
|
|
|
36308
36244
|
var gPO = (typeof Reflect === "function" ? Reflect.getPrototypeOf : Object.getPrototypeOf) || ([].__proto__ === Array.prototype ? function(O2) {
|
|
36309
36245
|
return O2.__proto__;
|
|
36310
36246
|
} : null);
|
|
36311
|
-
function addNumericSeparator(num2,
|
|
36312
|
-
if (num2 === Infinity || num2 === -Infinity || num2 !== num2 || num2 && num2 > -1e3 && num2 < 1e3 || $test.call(/e/,
|
|
36313
|
-
return
|
|
36247
|
+
function addNumericSeparator(num2, str2) {
|
|
36248
|
+
if (num2 === Infinity || num2 === -Infinity || num2 !== num2 || num2 && num2 > -1e3 && num2 < 1e3 || $test.call(/e/, str2)) {
|
|
36249
|
+
return str2;
|
|
36314
36250
|
}
|
|
36315
36251
|
var sepRegex = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;
|
|
36316
36252
|
if (typeof num2 === "number") {
|
|
36317
36253
|
var int2 = num2 < 0 ? -$floor(-num2) : $floor(num2);
|
|
36318
36254
|
if (int2 !== num2) {
|
|
36319
36255
|
var intStr = String(int2);
|
|
36320
|
-
var dec2 = $slice.call(
|
|
36256
|
+
var dec2 = $slice.call(str2, intStr.length + 1);
|
|
36321
36257
|
return $replace.call(intStr, sepRegex, "$&_") + "." + $replace.call($replace.call(dec2, /([0-9]{3})/g, "$&_"), /_$/, "");
|
|
36322
36258
|
}
|
|
36323
36259
|
}
|
|
36324
|
-
return $replace.call(
|
|
36260
|
+
return $replace.call(str2, sepRegex, "$&_");
|
|
36325
36261
|
}
|
|
36326
36262
|
var utilInspect = require_util_inspect();
|
|
36327
36263
|
var inspectCustom = utilInspect.custom;
|
|
@@ -36371,8 +36307,8 @@ var require_object_inspect = __commonJS({
|
|
|
36371
36307
|
if (obj === 0) {
|
|
36372
36308
|
return Infinity / obj > 0 ? "0" : "-0";
|
|
36373
36309
|
}
|
|
36374
|
-
var
|
|
36375
|
-
return numericSeparator ? addNumericSeparator(obj,
|
|
36310
|
+
var str2 = String(obj);
|
|
36311
|
+
return numericSeparator ? addNumericSeparator(obj, str2) : str2;
|
|
36376
36312
|
}
|
|
36377
36313
|
if (typeof obj === "bigint") {
|
|
36378
36314
|
var bigIntStr = String(obj) + "n";
|
|
@@ -36692,15 +36628,15 @@ var require_object_inspect = __commonJS({
|
|
|
36692
36628
|
}
|
|
36693
36629
|
return typeof x2.nodeName === "string" && typeof x2.getAttribute === "function";
|
|
36694
36630
|
}
|
|
36695
|
-
function inspectString(
|
|
36696
|
-
if (
|
|
36697
|
-
var remaining =
|
|
36631
|
+
function inspectString(str2, opts) {
|
|
36632
|
+
if (str2.length > opts.maxStringLength) {
|
|
36633
|
+
var remaining = str2.length - opts.maxStringLength;
|
|
36698
36634
|
var trailer = "... " + remaining + " more character" + (remaining > 1 ? "s" : "");
|
|
36699
|
-
return inspectString($slice.call(
|
|
36635
|
+
return inspectString($slice.call(str2, 0, opts.maxStringLength), opts) + trailer;
|
|
36700
36636
|
}
|
|
36701
36637
|
var quoteRE = quoteREs[opts.quoteStyle || "single"];
|
|
36702
36638
|
quoteRE.lastIndex = 0;
|
|
36703
|
-
var s2 = $replace.call($replace.call(
|
|
36639
|
+
var s2 = $replace.call($replace.call(str2, quoteRE, "\\$1"), /[\x00-\x1f]/g, lowbyte);
|
|
36704
36640
|
return wrapQuotes(s2, "single", opts);
|
|
36705
36641
|
}
|
|
36706
36642
|
function lowbyte(c) {
|
|
@@ -36717,8 +36653,8 @@ var require_object_inspect = __commonJS({
|
|
|
36717
36653
|
}
|
|
36718
36654
|
return "\\x" + (n < 16 ? "0" : "") + $toUpperCase.call(n.toString(16));
|
|
36719
36655
|
}
|
|
36720
|
-
function markBoxed(
|
|
36721
|
-
return "Object(" +
|
|
36656
|
+
function markBoxed(str2) {
|
|
36657
|
+
return "Object(" + str2 + ")";
|
|
36722
36658
|
}
|
|
36723
36659
|
function weakCollectionOf(type) {
|
|
36724
36660
|
return type + " { ? }";
|
|
@@ -37250,8 +37186,8 @@ var require_utils3 = __commonJS({
|
|
|
37250
37186
|
return acc;
|
|
37251
37187
|
}, target);
|
|
37252
37188
|
};
|
|
37253
|
-
var decode2 = function(
|
|
37254
|
-
var strWithoutPlus =
|
|
37189
|
+
var decode2 = function(str2, defaultDecoder, charset) {
|
|
37190
|
+
var strWithoutPlus = str2.replace(/\+/g, " ");
|
|
37255
37191
|
if (charset === "iso-8859-1") {
|
|
37256
37192
|
return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);
|
|
37257
37193
|
}
|
|
@@ -37262,15 +37198,15 @@ var require_utils3 = __commonJS({
|
|
|
37262
37198
|
}
|
|
37263
37199
|
};
|
|
37264
37200
|
var limit = 1024;
|
|
37265
|
-
var encode = function encode2(
|
|
37266
|
-
if (
|
|
37267
|
-
return
|
|
37201
|
+
var encode = function encode2(str2, defaultEncoder, charset, kind, format) {
|
|
37202
|
+
if (str2.length === 0) {
|
|
37203
|
+
return str2;
|
|
37268
37204
|
}
|
|
37269
|
-
var string7 =
|
|
37270
|
-
if (typeof
|
|
37271
|
-
string7 = Symbol.prototype.toString.call(
|
|
37272
|
-
} else if (typeof
|
|
37273
|
-
string7 = String(
|
|
37205
|
+
var string7 = str2;
|
|
37206
|
+
if (typeof str2 === "symbol") {
|
|
37207
|
+
string7 = Symbol.prototype.toString.call(str2);
|
|
37208
|
+
} else if (typeof str2 !== "string") {
|
|
37209
|
+
string7 = String(str2);
|
|
37274
37210
|
}
|
|
37275
37211
|
if (charset === "iso-8859-1") {
|
|
37276
37212
|
return escape(string7).replace(/%u[0-9a-f]{4}/gi, function($0) {
|
|
@@ -37694,8 +37630,8 @@ var require_parse = __commonJS({
|
|
|
37694
37630
|
strictNullHandling: false,
|
|
37695
37631
|
throwOnLimitExceeded: false
|
|
37696
37632
|
};
|
|
37697
|
-
var interpretNumericEntities = function(
|
|
37698
|
-
return
|
|
37633
|
+
var interpretNumericEntities = function(str2) {
|
|
37634
|
+
return str2.replace(/&#(\d+);/g, function($0, numberStr) {
|
|
37699
37635
|
return String.fromCharCode(parseInt(numberStr, 10));
|
|
37700
37636
|
});
|
|
37701
37637
|
};
|
|
@@ -37710,9 +37646,9 @@ var require_parse = __commonJS({
|
|
|
37710
37646
|
};
|
|
37711
37647
|
var isoSentinel = "utf8=%26%2310003%3B";
|
|
37712
37648
|
var charsetSentinel = "utf8=%E2%9C%93";
|
|
37713
|
-
var parseValues = function parseQueryStringValues(
|
|
37649
|
+
var parseValues = function parseQueryStringValues(str2, options) {
|
|
37714
37650
|
var obj = { __proto__: null };
|
|
37715
|
-
var cleanStr = options.ignoreQueryPrefix ?
|
|
37651
|
+
var cleanStr = options.ignoreQueryPrefix ? str2.replace(/^\?/, "") : str2;
|
|
37716
37652
|
cleanStr = cleanStr.replace(/%5B/gi, "[").replace(/%5D/gi, "]");
|
|
37717
37653
|
var limit = options.parameterLimit === Infinity ? void 0 : options.parameterLimit;
|
|
37718
37654
|
var parts = cleanStr.split(
|
|
@@ -37960,17 +37896,17 @@ var require_parse = __commonJS({
|
|
|
37960
37896
|
throwOnLimitExceeded: typeof opts.throwOnLimitExceeded === "boolean" ? opts.throwOnLimitExceeded : false
|
|
37961
37897
|
};
|
|
37962
37898
|
};
|
|
37963
|
-
module2.exports = function(
|
|
37899
|
+
module2.exports = function(str2, opts) {
|
|
37964
37900
|
var options = normalizeParseOptions(opts);
|
|
37965
|
-
if (
|
|
37901
|
+
if (str2 === "" || str2 === null || typeof str2 === "undefined") {
|
|
37966
37902
|
return options.plainObjects ? { __proto__: null } : {};
|
|
37967
37903
|
}
|
|
37968
|
-
var tempObj = typeof
|
|
37904
|
+
var tempObj = typeof str2 === "string" ? parseValues(str2, options) : str2;
|
|
37969
37905
|
var obj = options.plainObjects ? { __proto__: null } : {};
|
|
37970
37906
|
var keys = Object.keys(tempObj);
|
|
37971
37907
|
for (var i = 0; i < keys.length; ++i) {
|
|
37972
37908
|
var key = keys[i];
|
|
37973
|
-
var newObj = parseKeys(key, tempObj[key], options, typeof
|
|
37909
|
+
var newObj = parseKeys(key, tempObj[key], options, typeof str2 === "string");
|
|
37974
37910
|
obj = utils.merge(obj, newObj, options);
|
|
37975
37911
|
}
|
|
37976
37912
|
if (options.allowSparse === true) {
|
|
@@ -44317,27 +44253,27 @@ var require_umd = __commonJS({
|
|
|
44317
44253
|
}
|
|
44318
44254
|
Long.fromBits = fromBits;
|
|
44319
44255
|
var pow_dbl = Math.pow;
|
|
44320
|
-
function fromString(
|
|
44321
|
-
if (
|
|
44256
|
+
function fromString(str2, unsigned, radix) {
|
|
44257
|
+
if (str2.length === 0) throw Error("empty string");
|
|
44322
44258
|
if (typeof unsigned === "number") {
|
|
44323
44259
|
radix = unsigned;
|
|
44324
44260
|
unsigned = false;
|
|
44325
44261
|
} else {
|
|
44326
44262
|
unsigned = !!unsigned;
|
|
44327
44263
|
}
|
|
44328
|
-
if (
|
|
44264
|
+
if (str2 === "NaN" || str2 === "Infinity" || str2 === "+Infinity" || str2 === "-Infinity")
|
|
44329
44265
|
return unsigned ? UZERO : ZERO;
|
|
44330
44266
|
radix = radix || 10;
|
|
44331
44267
|
if (radix < 2 || 36 < radix) throw RangeError("radix");
|
|
44332
44268
|
var p2;
|
|
44333
|
-
if ((p2 =
|
|
44269
|
+
if ((p2 = str2.indexOf("-")) > 0) throw Error("interior hyphen");
|
|
44334
44270
|
else if (p2 === 0) {
|
|
44335
|
-
return fromString(
|
|
44271
|
+
return fromString(str2.substring(1), unsigned, radix).neg();
|
|
44336
44272
|
}
|
|
44337
44273
|
var radixToPower = fromNumber(pow_dbl(radix, 8));
|
|
44338
44274
|
var result = ZERO;
|
|
44339
|
-
for (var i = 0; i <
|
|
44340
|
-
var size = Math.min(8,
|
|
44275
|
+
for (var i = 0; i < str2.length; i += 8) {
|
|
44276
|
+
var size = Math.min(8, str2.length - i), value2 = parseInt(str2.substring(i, i + size), radix);
|
|
44341
44277
|
if (size < 8) {
|
|
44342
44278
|
var power = fromNumber(pow_dbl(radix, size));
|
|
44343
44279
|
result = result.mul(power).add(fromNumber(value2));
|
|
@@ -44986,8 +44922,8 @@ var require_minimal = __commonJS({
|
|
|
44986
44922
|
writable: true
|
|
44987
44923
|
});
|
|
44988
44924
|
};
|
|
44989
|
-
util2.lcFirst = function lcFirst(
|
|
44990
|
-
return
|
|
44925
|
+
util2.lcFirst = function lcFirst(str2) {
|
|
44926
|
+
return str2.charAt(0).toLowerCase() + str2.substring(1);
|
|
44991
44927
|
};
|
|
44992
44928
|
function newError(name) {
|
|
44993
44929
|
function CustomError(message, properties) {
|
|
@@ -137505,14 +137441,14 @@ function promiseAllObject(promisesObj) {
|
|
|
137505
137441
|
}
|
|
137506
137442
|
function randomString(length = 10) {
|
|
137507
137443
|
const chars = "abcdefghijklmnopqrstuvwxyz";
|
|
137508
|
-
let
|
|
137444
|
+
let str2 = "";
|
|
137509
137445
|
for (let i = 0; i < length; i++) {
|
|
137510
|
-
|
|
137446
|
+
str2 += chars[Math.floor(Math.random() * chars.length)];
|
|
137511
137447
|
}
|
|
137512
|
-
return
|
|
137448
|
+
return str2;
|
|
137513
137449
|
}
|
|
137514
|
-
function esc(
|
|
137515
|
-
return JSON.stringify(
|
|
137450
|
+
function esc(str2) {
|
|
137451
|
+
return JSON.stringify(str2);
|
|
137516
137452
|
}
|
|
137517
137453
|
function isObject(data) {
|
|
137518
137454
|
return typeof data === "object" && data !== null && !Array.isArray(data);
|
|
@@ -137540,8 +137476,8 @@ function numKeys(data) {
|
|
|
137540
137476
|
}
|
|
137541
137477
|
return keyCount;
|
|
137542
137478
|
}
|
|
137543
|
-
function escapeRegex(
|
|
137544
|
-
return
|
|
137479
|
+
function escapeRegex(str2) {
|
|
137480
|
+
return str2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
137545
137481
|
}
|
|
137546
137482
|
function clone(inst, def, params) {
|
|
137547
137483
|
const cl = new inst._zod.constr(def ?? inst._zod.def);
|
|
@@ -143155,7 +143091,7 @@ var require_code = __commonJS({
|
|
|
143155
143091
|
}
|
|
143156
143092
|
exports2._ = _2;
|
|
143157
143093
|
var plus = new _Code("+");
|
|
143158
|
-
function
|
|
143094
|
+
function str2(strs, ...args) {
|
|
143159
143095
|
const expr = [safeStringify(strs[0])];
|
|
143160
143096
|
let i = 0;
|
|
143161
143097
|
while (i < args.length) {
|
|
@@ -143166,7 +143102,7 @@ var require_code = __commonJS({
|
|
|
143166
143102
|
optimize(expr);
|
|
143167
143103
|
return new _Code(expr);
|
|
143168
143104
|
}
|
|
143169
|
-
exports2.str =
|
|
143105
|
+
exports2.str = str2;
|
|
143170
143106
|
function addCodeArg(code2, arg) {
|
|
143171
143107
|
if (arg instanceof _Code)
|
|
143172
143108
|
code2.push(...arg._items);
|
|
@@ -143209,7 +143145,7 @@ var require_code = __commonJS({
|
|
|
143209
143145
|
return;
|
|
143210
143146
|
}
|
|
143211
143147
|
function strConcat(c1, c2) {
|
|
143212
|
-
return c2.emptyStr() ? c1 : c1.emptyStr() ? c2 :
|
|
143148
|
+
return c2.emptyStr() ? c1 : c1.emptyStr() ? c2 : str2`${c1}${c2}`;
|
|
143213
143149
|
}
|
|
143214
143150
|
exports2.strConcat = strConcat;
|
|
143215
143151
|
function interpolate(x2) {
|
|
@@ -144171,22 +144107,22 @@ var require_util = __commonJS({
|
|
|
144171
144107
|
return (0, codegen_1._)`${topSchemaRef}${schemaPath}${(0, codegen_1.getProperty)(keyword)}`;
|
|
144172
144108
|
}
|
|
144173
144109
|
exports2.schemaRefOrVal = schemaRefOrVal;
|
|
144174
|
-
function unescapeFragment(
|
|
144175
|
-
return unescapeJsonPointer(decodeURIComponent(
|
|
144110
|
+
function unescapeFragment(str2) {
|
|
144111
|
+
return unescapeJsonPointer(decodeURIComponent(str2));
|
|
144176
144112
|
}
|
|
144177
144113
|
exports2.unescapeFragment = unescapeFragment;
|
|
144178
|
-
function escapeFragment(
|
|
144179
|
-
return encodeURIComponent(escapeJsonPointer(
|
|
144114
|
+
function escapeFragment(str2) {
|
|
144115
|
+
return encodeURIComponent(escapeJsonPointer(str2));
|
|
144180
144116
|
}
|
|
144181
144117
|
exports2.escapeFragment = escapeFragment;
|
|
144182
|
-
function escapeJsonPointer(
|
|
144183
|
-
if (typeof
|
|
144184
|
-
return `${
|
|
144185
|
-
return
|
|
144118
|
+
function escapeJsonPointer(str2) {
|
|
144119
|
+
if (typeof str2 == "number")
|
|
144120
|
+
return `${str2}`;
|
|
144121
|
+
return str2.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
144186
144122
|
}
|
|
144187
144123
|
exports2.escapeJsonPointer = escapeJsonPointer;
|
|
144188
|
-
function unescapeJsonPointer(
|
|
144189
|
-
return
|
|
144124
|
+
function unescapeJsonPointer(str2) {
|
|
144125
|
+
return str2.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
144190
144126
|
}
|
|
144191
144127
|
exports2.unescapeJsonPointer = unescapeJsonPointer;
|
|
144192
144128
|
function eachItem(xs, f2) {
|
|
@@ -145211,8 +145147,8 @@ var require_json_schema_traverse = __commonJS({
|
|
|
145211
145147
|
post(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
|
|
145212
145148
|
}
|
|
145213
145149
|
}
|
|
145214
|
-
function escapeJsonPtr(
|
|
145215
|
-
return
|
|
145150
|
+
function escapeJsonPtr(str2) {
|
|
145151
|
+
return str2.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
145216
145152
|
}
|
|
145217
145153
|
}
|
|
145218
145154
|
});
|
|
@@ -146276,10 +146212,10 @@ var require_utils4 = __commonJS({
|
|
|
146276
146212
|
return { host, isIPV6: false };
|
|
146277
146213
|
}
|
|
146278
146214
|
}
|
|
146279
|
-
function findToken(
|
|
146215
|
+
function findToken(str2, token) {
|
|
146280
146216
|
let ind = 0;
|
|
146281
|
-
for (let i = 0; i <
|
|
146282
|
-
if (
|
|
146217
|
+
for (let i = 0; i < str2.length; i++) {
|
|
146218
|
+
if (str2[i] === token) ind++;
|
|
146283
146219
|
}
|
|
146284
146220
|
return ind;
|
|
146285
146221
|
}
|
|
@@ -147016,7 +146952,7 @@ var require_core = __commonJS({
|
|
|
147016
146952
|
var util_1 = require_util();
|
|
147017
146953
|
var $dataRefSchema = require_data();
|
|
147018
146954
|
var uri_1 = require_uri2();
|
|
147019
|
-
var defaultRegExp = (
|
|
146955
|
+
var defaultRegExp = (str2, flags) => new RegExp(str2, flags);
|
|
147020
146956
|
defaultRegExp.code = "new RegExp";
|
|
147021
146957
|
var META_IGNORE_OPTIONS = ["removeAdditional", "useDefaults", "coerceTypes"];
|
|
147022
146958
|
var EXT_SCOPE_NAMES = /* @__PURE__ */ new Set([
|
|
@@ -147811,16 +147747,16 @@ var require_ucs2length = __commonJS({
|
|
|
147811
147747
|
"../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/ucs2length.js"(exports2) {
|
|
147812
147748
|
"use strict";
|
|
147813
147749
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
147814
|
-
function ucs2length(
|
|
147815
|
-
const len =
|
|
147750
|
+
function ucs2length(str2) {
|
|
147751
|
+
const len = str2.length;
|
|
147816
147752
|
let length = 0;
|
|
147817
147753
|
let pos = 0;
|
|
147818
147754
|
let value2;
|
|
147819
147755
|
while (pos < len) {
|
|
147820
147756
|
length++;
|
|
147821
|
-
value2 =
|
|
147757
|
+
value2 = str2.charCodeAt(pos++);
|
|
147822
147758
|
if (value2 >= 55296 && value2 <= 56319 && pos < len) {
|
|
147823
|
-
value2 =
|
|
147759
|
+
value2 = str2.charCodeAt(pos);
|
|
147824
147760
|
if ((value2 & 64512) === 56320)
|
|
147825
147761
|
pos++;
|
|
147826
147762
|
}
|
|
@@ -149703,8 +149639,8 @@ var require_formats2 = __commonJS({
|
|
|
149703
149639
|
}
|
|
149704
149640
|
var DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
|
|
149705
149641
|
var DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
149706
|
-
function date3(
|
|
149707
|
-
const matches = DATE.exec(
|
|
149642
|
+
function date3(str2) {
|
|
149643
|
+
const matches = DATE.exec(str2);
|
|
149708
149644
|
if (!matches)
|
|
149709
149645
|
return false;
|
|
149710
149646
|
const year = +matches[1];
|
|
@@ -149723,8 +149659,8 @@ var require_formats2 = __commonJS({
|
|
|
149723
149659
|
}
|
|
149724
149660
|
var TIME = /^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;
|
|
149725
149661
|
function getTime(strictTimeZone) {
|
|
149726
|
-
return function time3(
|
|
149727
|
-
const matches = TIME.exec(
|
|
149662
|
+
return function time3(str2) {
|
|
149663
|
+
const matches = TIME.exec(str2);
|
|
149728
149664
|
if (!matches)
|
|
149729
149665
|
return false;
|
|
149730
149666
|
const hr = +matches[1];
|
|
@@ -149770,8 +149706,8 @@ var require_formats2 = __commonJS({
|
|
|
149770
149706
|
var DATE_TIME_SEPARATOR = /t|\s/i;
|
|
149771
149707
|
function getDateTime(strictTimeZone) {
|
|
149772
149708
|
const time3 = getTime(strictTimeZone);
|
|
149773
|
-
return function date_time(
|
|
149774
|
-
const dateTime =
|
|
149709
|
+
return function date_time(str2) {
|
|
149710
|
+
const dateTime = str2.split(DATE_TIME_SEPARATOR);
|
|
149775
149711
|
return dateTime.length === 2 && date3(dateTime[0]) && time3(dateTime[1]);
|
|
149776
149712
|
};
|
|
149777
149713
|
}
|
|
@@ -149796,13 +149732,13 @@ var require_formats2 = __commonJS({
|
|
|
149796
149732
|
}
|
|
149797
149733
|
var NOT_URI_FRAGMENT = /\/|:/;
|
|
149798
149734
|
var URI = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
|
|
149799
|
-
function uri(
|
|
149800
|
-
return NOT_URI_FRAGMENT.test(
|
|
149735
|
+
function uri(str2) {
|
|
149736
|
+
return NOT_URI_FRAGMENT.test(str2) && URI.test(str2);
|
|
149801
149737
|
}
|
|
149802
149738
|
var BYTE = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;
|
|
149803
|
-
function byte(
|
|
149739
|
+
function byte(str2) {
|
|
149804
149740
|
BYTE.lastIndex = 0;
|
|
149805
|
-
return BYTE.test(
|
|
149741
|
+
return BYTE.test(str2);
|
|
149806
149742
|
}
|
|
149807
149743
|
var MIN_INT32 = -(2 ** 31);
|
|
149808
149744
|
var MAX_INT32 = 2 ** 31 - 1;
|
|
@@ -149816,11 +149752,11 @@ var require_formats2 = __commonJS({
|
|
|
149816
149752
|
return true;
|
|
149817
149753
|
}
|
|
149818
149754
|
var Z_ANCHOR = /[^\\]\\Z/;
|
|
149819
|
-
function regex(
|
|
149820
|
-
if (Z_ANCHOR.test(
|
|
149755
|
+
function regex(str2) {
|
|
149756
|
+
if (Z_ANCHOR.test(str2))
|
|
149821
149757
|
return false;
|
|
149822
149758
|
try {
|
|
149823
|
-
new RegExp(
|
|
149759
|
+
new RegExp(str2);
|
|
149824
149760
|
return true;
|
|
149825
149761
|
} catch (e) {
|
|
149826
149762
|
return false;
|
|
@@ -150261,40 +150197,6 @@ var init_live_chat = __esm({
|
|
|
150261
150197
|
}
|
|
150262
150198
|
};
|
|
150263
150199
|
}
|
|
150264
|
-
/**
|
|
150265
|
-
* serve 重启后**重挂**一个占位轮(ADR 0300 D4)。该会话在本进程注册表里已有轮(真轮或另一个占位轮)
|
|
150266
|
-
* 则不动、返回 null——保证幂等且绝不覆盖真轮。占位轮 status=running、缓冲为空、句柄不带 appendInput
|
|
150267
|
-
* (`canAppend` 因此为 false),`kill()` 走注入的 `onStop`(账本收口)并把本轮标 error 让在挂的观众
|
|
150268
|
-
* 就地收到终止。节点重连时恢复路的 {@link start} 会替掉它。
|
|
150269
|
-
*/
|
|
150270
|
-
reopenForRecovery(chatSessionId, opts) {
|
|
150271
|
-
if (this.turns.has(chatSessionId)) return null;
|
|
150272
|
-
let ctrl;
|
|
150273
|
-
const handle = {
|
|
150274
|
-
runtimeSessionId: opts.runtimeSessionId,
|
|
150275
|
-
...opts.runId ? { runId: opts.runId } : {},
|
|
150276
|
-
canAppendInput: false,
|
|
150277
|
-
kill: () => {
|
|
150278
|
-
try {
|
|
150279
|
-
opts.onStop?.();
|
|
150280
|
-
} finally {
|
|
150281
|
-
ctrl?.finish("error");
|
|
150282
|
-
}
|
|
150283
|
-
}
|
|
150284
|
-
};
|
|
150285
|
-
ctrl = this.start(chatSessionId, handle);
|
|
150286
|
-
const turn = this.turns.get(chatSessionId);
|
|
150287
|
-
if (turn) turn.recovering = true;
|
|
150288
|
-
return ctrl;
|
|
150289
|
-
}
|
|
150290
|
-
/** 占位轮的最后一个观众断开即回收:没真 runtime 喂它,留着只会占内存、也会让 `isRunning` 恒真。 */
|
|
150291
|
-
evictIfEmptyRecovering(chatSessionId, turn) {
|
|
150292
|
-
if (!turn.recovering || turn.status !== "running") return;
|
|
150293
|
-
if (turn.subscribers.size > 0 || turn.liveSubscribers.size > 0) return;
|
|
150294
|
-
if (this.turns.get(chatSessionId) !== turn) return;
|
|
150295
|
-
if (turn.evictTimer) clearTimeout(turn.evictTimer);
|
|
150296
|
-
this.turns.delete(chatSessionId);
|
|
150297
|
-
}
|
|
150298
150200
|
emitLive(turn, event) {
|
|
150299
150201
|
turn.liveTurnId = event.turnId;
|
|
150300
150202
|
const mergeField = this.mergeableLiveField(event);
|
|
@@ -150368,7 +150270,6 @@ var init_live_chat = __esm({
|
|
|
150368
150270
|
gap,
|
|
150369
150271
|
detach: () => {
|
|
150370
150272
|
turn.subscribers.delete(sub);
|
|
150371
|
-
this.evictIfEmptyRecovering(chatSessionId, turn);
|
|
150372
150273
|
}
|
|
150373
150274
|
};
|
|
150374
150275
|
}
|
|
@@ -150388,7 +150289,6 @@ var init_live_chat = __esm({
|
|
|
150388
150289
|
epoch: turn.liveEpoch,
|
|
150389
150290
|
detach: () => {
|
|
150390
150291
|
turn.liveSubscribers.delete(sub);
|
|
150391
|
-
this.evictIfEmptyRecovering(chatSessionId, turn);
|
|
150392
150292
|
}
|
|
150393
150293
|
};
|
|
150394
150294
|
}
|
|
@@ -150453,37 +150353,6 @@ var init_live_chat = __esm({
|
|
|
150453
150353
|
}
|
|
150454
150354
|
const fn = turn.handle.appendInput;
|
|
150455
150355
|
if (typeof fn !== "function") return say({ accepted: false, reason: "unsupported" });
|
|
150456
|
-
const pendingItemId = !opts?.system && opts?.clientMessageKey ? `oasis-user:${opts.clientMessageKey}` : void 0;
|
|
150457
|
-
const pendingAttachments = opts?.attachments?.map((a) => ({
|
|
150458
|
-
name: a.name,
|
|
150459
|
-
...a.blobRef ? { blobRef: a.blobRef } : {},
|
|
150460
|
-
...a.contentType ? { contentType: a.contentType } : {}
|
|
150461
|
-
}));
|
|
150462
|
-
if (pendingItemId) {
|
|
150463
|
-
this.emitLive(turn, {
|
|
150464
|
-
protocolVersion: 2,
|
|
150465
|
-
streamId: turn.liveStreamId,
|
|
150466
|
-
turnId: turn.liveTurnId,
|
|
150467
|
-
itemId: pendingItemId,
|
|
150468
|
-
itemType: "message",
|
|
150469
|
-
operation: "started",
|
|
150470
|
-
payload: { role: "user", text: opts?.displayText ?? text5, pending: true, ...pendingAttachments?.length ? { attachments: pendingAttachments } : {} }
|
|
150471
|
-
});
|
|
150472
|
-
}
|
|
150473
|
-
const failPending = () => {
|
|
150474
|
-
if (!pendingItemId) return;
|
|
150475
|
-
const t = this.turns.get(chatSessionId);
|
|
150476
|
-
if (!t) return;
|
|
150477
|
-
this.emitLive(t, {
|
|
150478
|
-
protocolVersion: 2,
|
|
150479
|
-
streamId: t.liveStreamId,
|
|
150480
|
-
turnId: t.liveTurnId,
|
|
150481
|
-
itemId: pendingItemId,
|
|
150482
|
-
itemType: "message",
|
|
150483
|
-
operation: "failed",
|
|
150484
|
-
payload: { role: "user" }
|
|
150485
|
-
});
|
|
150486
|
-
};
|
|
150487
150356
|
let res;
|
|
150488
150357
|
try {
|
|
150489
150358
|
res = await fn.call(turn.handle, {
|
|
@@ -150493,16 +150362,11 @@ var init_live_chat = __esm({
|
|
|
150493
150362
|
...opts?.binaryFiles && Object.keys(opts.binaryFiles).length ? { binaryFiles: opts.binaryFiles } : {}
|
|
150494
150363
|
});
|
|
150495
150364
|
} catch (e) {
|
|
150496
|
-
failPending();
|
|
150497
150365
|
return say({ accepted: false, reason: "rejected" }, { err: String(e) });
|
|
150498
150366
|
}
|
|
150499
|
-
if (!res.accepted) {
|
|
150500
|
-
failPending();
|
|
150501
|
-
return say(res, { from: "runtime" });
|
|
150502
|
-
}
|
|
150367
|
+
if (!res.accepted) return say(res, { from: "runtime" });
|
|
150503
150368
|
if (opts?.system) return say({ accepted: true }, { system: true });
|
|
150504
150369
|
if (this.turns.get(chatSessionId) !== turn || turn.status !== "running") {
|
|
150505
|
-
failPending();
|
|
150506
150370
|
return say({ accepted: false, reason: "turn-finished" }, { turnStatus: turn.status, replaced: this.turns.get(chatSessionId) !== turn });
|
|
150507
150371
|
}
|
|
150508
150372
|
const shown = opts?.displayText ?? text5;
|
|
@@ -150548,9 +150412,7 @@ var init_live_chat = __esm({
|
|
|
150548
150412
|
* 建单草案 submit 发生在这一轮内:用它给草案盖上「产出轮次」标记,供 friday 重进对话页把每版
|
|
150549
150413
|
* 草案归位到产出它的那条助手消息(message.runId 对齐)。 */
|
|
150550
150414
|
runFor(chatSessionId) {
|
|
150551
|
-
|
|
150552
|
-
if (!turn || turn.recovering) return void 0;
|
|
150553
|
-
return turn.runId;
|
|
150415
|
+
return this.turns.get(chatSessionId)?.runId;
|
|
150554
150416
|
}
|
|
150555
150417
|
/**
|
|
150556
150418
|
* 反查该会话当前驻留那一轮**这一段**的 assistant 行 id(无进行中/grace 轮、或还没落库时
|
|
@@ -150559,9 +150421,7 @@ var init_live_chat = __esm({
|
|
|
150559
150421
|
* 两段共用同一个 runId,钉不出前后段的区别,而那正是本字段存在的理由。
|
|
150560
150422
|
*/
|
|
150561
150423
|
messageFor(chatSessionId) {
|
|
150562
|
-
|
|
150563
|
-
if (!turn || turn.recovering) return void 0;
|
|
150564
|
-
return turn.assistantMessageId;
|
|
150424
|
+
return this.turns.get(chatSessionId)?.assistantMessageId;
|
|
150565
150425
|
}
|
|
150566
150426
|
/** 测试/排障用:当前驻留的会话数。 */
|
|
150567
150427
|
size() {
|
|
@@ -153175,21 +153035,21 @@ function buildCoordinatorActivityFromEvents(model, arts, events, ref2) {
|
|
|
153175
153035
|
if (!inWorkspace.has(artifactId)) return;
|
|
153176
153036
|
edits.push({ seq, at, actor: ref2(actor), kind, artifactId, label, ...detail ? { detail } : {} });
|
|
153177
153037
|
};
|
|
153178
|
-
const
|
|
153038
|
+
const str2 = (v2) => typeof v2 === "string" && v2.trim() ? v2 : void 0;
|
|
153179
153039
|
for (const rec of events) {
|
|
153180
153040
|
const ev = rec.event;
|
|
153181
153041
|
const kind = ev.kind;
|
|
153182
153042
|
if (kind === "issue.create") {
|
|
153183
153043
|
const issueId = String(ev.issueId ?? "");
|
|
153184
153044
|
const issueKind = String(ev.issueKind ?? "");
|
|
153185
|
-
const target =
|
|
153045
|
+
const target = str2(ev.aboutNodeId ?? ev.raisedByNodeId);
|
|
153186
153046
|
if (issueId) {
|
|
153187
153047
|
issueKindById.set(issueId, issueKind);
|
|
153188
153048
|
if (target) issueTargetById.set(issueId, target);
|
|
153189
153049
|
}
|
|
153190
153050
|
if (!target) continue;
|
|
153191
|
-
if (issueKind === "gap") push2("report_gap", target, rec.seq, rec.createdAt, rec.actorId, "\u62A5\u544A\u7F3A\u53E3",
|
|
153192
|
-
else if (issueKind === "escalation") push2("escalate", target, rec.seq, rec.createdAt, rec.actorId, "\u4E0A\u62A5\u9700\u4EBA\u4ECB\u5165",
|
|
153051
|
+
if (issueKind === "gap") push2("report_gap", target, rec.seq, rec.createdAt, rec.actorId, "\u62A5\u544A\u7F3A\u53E3", str2(ev.body) ?? void 0);
|
|
153052
|
+
else if (issueKind === "escalation") push2("escalate", target, rec.seq, rec.createdAt, rec.actorId, "\u4E0A\u62A5\u9700\u4EBA\u4ECB\u5165", str2(ev.body) ?? void 0);
|
|
153193
153053
|
continue;
|
|
153194
153054
|
}
|
|
153195
153055
|
if (kind === "issue.resolve") {
|
|
@@ -153197,8 +153057,8 @@ function buildCoordinatorActivityFromEvents(model, arts, events, ref2) {
|
|
|
153197
153057
|
const target = issueTargetById.get(issueId);
|
|
153198
153058
|
if (!target) continue;
|
|
153199
153059
|
if (issueKindById.get(issueId) === "escalation")
|
|
153200
|
-
push2("resolve_escalation", target, rec.seq, rec.createdAt, rec.actorId, "\u5173\u95ED\u4E0A\u62A5",
|
|
153201
|
-
else push2("resolve_gap", target, rec.seq, rec.createdAt, rec.actorId, "\u89E3\u9664\u7F3A\u53E3",
|
|
153060
|
+
push2("resolve_escalation", target, rec.seq, rec.createdAt, rec.actorId, "\u5173\u95ED\u4E0A\u62A5", str2(ev.note) ?? void 0);
|
|
153061
|
+
else push2("resolve_gap", target, rec.seq, rec.createdAt, rec.actorId, "\u89E3\u9664\u7F3A\u53E3", str2(ev.note) ?? void 0);
|
|
153202
153062
|
continue;
|
|
153203
153063
|
}
|
|
153204
153064
|
if (managerActor && rec.actorId !== managerActor) continue;
|
|
@@ -153206,40 +153066,40 @@ function buildCoordinatorActivityFromEvents(model, arts, events, ref2) {
|
|
|
153206
153066
|
const ev2 = ev;
|
|
153207
153067
|
for (const n of ev2.addNodes ?? []) {
|
|
153208
153068
|
if (!n.id || firstRevisionAt && rec.createdAt < firstRevisionAt) continue;
|
|
153209
|
-
push2("spawn_artifact", n.id, rec.seq, rec.createdAt, rec.actorId, "\u65B0\u5EFA\u4EA4\u4ED8\u7269",
|
|
153069
|
+
push2("spawn_artifact", n.id, rec.seq, rec.createdAt, rec.actorId, "\u65B0\u5EFA\u4EA4\u4ED8\u7269", str2(n.title) ?? void 0);
|
|
153210
153070
|
}
|
|
153211
153071
|
for (const n of ev2.updateNodes ?? []) {
|
|
153212
153072
|
if (!n.id) continue;
|
|
153213
|
-
push2("edit_artifact", n.id, rec.seq, rec.createdAt, rec.actorId, "\u6539\u4EA4\u4ED8\u7269\u4FE1\u606F",
|
|
153073
|
+
push2("edit_artifact", n.id, rec.seq, rec.createdAt, rec.actorId, "\u6539\u4EA4\u4ED8\u7269\u4FE1\u606F", str2(n.title) ?? void 0);
|
|
153214
153074
|
}
|
|
153215
153075
|
for (const e of ev2.addEdges ?? []) {
|
|
153216
153076
|
if (!e.fromNodeId || firstRevisionAt && rec.createdAt < firstRevisionAt) continue;
|
|
153217
|
-
push2("link_input", e.fromNodeId, rec.seq, rec.createdAt, rec.actorId, "\u63A5\u5165\u4F9D\u8D56",
|
|
153077
|
+
push2("link_input", e.fromNodeId, rec.seq, rec.createdAt, rec.actorId, "\u63A5\u5165\u4F9D\u8D56", str2(e.toNodeId) ?? void 0);
|
|
153218
153078
|
}
|
|
153219
153079
|
for (const e of ev2.removeEdges ?? []) {
|
|
153220
153080
|
if (!e.fromNodeId) continue;
|
|
153221
|
-
push2("unlink_input", e.fromNodeId, rec.seq, rec.createdAt, rec.actorId, "\u79FB\u9664\u4F9D\u8D56",
|
|
153081
|
+
push2("unlink_input", e.fromNodeId, rec.seq, rec.createdAt, rec.actorId, "\u79FB\u9664\u4F9D\u8D56", str2(e.toNodeId) ?? void 0);
|
|
153222
153082
|
}
|
|
153223
153083
|
continue;
|
|
153224
153084
|
}
|
|
153225
153085
|
if (kind === "plan.add_node") {
|
|
153226
|
-
const id =
|
|
153086
|
+
const id = str2(ev.nodeId);
|
|
153227
153087
|
if (!id || firstRevisionAt && rec.createdAt < firstRevisionAt) continue;
|
|
153228
|
-
push2("spawn_artifact", id, rec.seq, rec.createdAt, rec.actorId, "\u65B0\u5EFA\u4EA4\u4ED8\u7269",
|
|
153088
|
+
push2("spawn_artifact", id, rec.seq, rec.createdAt, rec.actorId, "\u65B0\u5EFA\u4EA4\u4ED8\u7269", str2(ev.title) ?? void 0);
|
|
153229
153089
|
} else if (kind === "plan.add_edge") {
|
|
153230
|
-
const id =
|
|
153090
|
+
const id = str2(ev.fromNodeId);
|
|
153231
153091
|
if (!id || firstRevisionAt && rec.createdAt < firstRevisionAt) continue;
|
|
153232
|
-
push2("link_input", id, rec.seq, rec.createdAt, rec.actorId, "\u63A5\u5165\u4F9D\u8D56",
|
|
153092
|
+
push2("link_input", id, rec.seq, rec.createdAt, rec.actorId, "\u63A5\u5165\u4F9D\u8D56", str2(ev.toNodeId) ?? void 0);
|
|
153233
153093
|
} else if (kind === "plan.delete_edge") {
|
|
153234
|
-
const id =
|
|
153094
|
+
const id = str2(ev.fromNodeId);
|
|
153235
153095
|
if (!id) continue;
|
|
153236
|
-
push2("unlink_input", id, rec.seq, rec.createdAt, rec.actorId, "\u79FB\u9664\u4F9D\u8D56",
|
|
153096
|
+
push2("unlink_input", id, rec.seq, rec.createdAt, rec.actorId, "\u79FB\u9664\u4F9D\u8D56", str2(ev.toNodeId) ?? void 0);
|
|
153237
153097
|
} else if (kind === "plan.assign_actor") {
|
|
153238
|
-
const id =
|
|
153098
|
+
const id = str2(ev.nodeId);
|
|
153239
153099
|
if (!id) continue;
|
|
153240
|
-
push2("assign_owner", id, rec.seq, rec.createdAt, rec.actorId, "\u6539\u6D3E",
|
|
153100
|
+
push2("assign_owner", id, rec.seq, rec.createdAt, rec.actorId, "\u6539\u6D3E", str2(ev.assigneeActorId) ?? void 0);
|
|
153241
153101
|
} else if (kind === "plan.update_spec" || kind === "plan.update_fields" || kind === "plan.update_review_requirements") {
|
|
153242
|
-
const id =
|
|
153102
|
+
const id = str2(ev.nodeId);
|
|
153243
153103
|
if (!id) continue;
|
|
153244
153104
|
push2("edit_artifact", id, rec.seq, rec.createdAt, rec.actorId, "\u6539\u4EA4\u4ED8\u7269\u4FE1\u606F");
|
|
153245
153105
|
}
|
|
@@ -167093,13 +166953,13 @@ var require_Collection = __commonJS({
|
|
|
167093
166953
|
var require_stringifyComment = __commonJS({
|
|
167094
166954
|
"../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/stringify/stringifyComment.js"(exports2) {
|
|
167095
166955
|
"use strict";
|
|
167096
|
-
var stringifyComment = (
|
|
166956
|
+
var stringifyComment = (str2) => str2.replace(/^(?!$)(?: $)?/gm, "#");
|
|
167097
166957
|
function indentComment(comment, indent2) {
|
|
167098
166958
|
if (/^\n+$/.test(comment))
|
|
167099
166959
|
return comment.substring(1);
|
|
167100
166960
|
return indent2 ? comment.replace(/^(?! *$)/gm, indent2) : comment;
|
|
167101
166961
|
}
|
|
167102
|
-
var lineComment = (
|
|
166962
|
+
var lineComment = (str2, indent2, comment) => str2.endsWith("\n") ? indentComment(comment, indent2) : comment.includes("\n") ? "\n" + indentComment(comment, indent2) : (str2.endsWith(" ") ? "" : " ") + comment;
|
|
167103
166963
|
exports2.indentComment = indentComment;
|
|
167104
166964
|
exports2.lineComment = lineComment;
|
|
167105
166965
|
exports2.stringifyComment = stringifyComment;
|
|
@@ -167253,16 +167113,16 @@ var require_stringifyString = __commonJS({
|
|
|
167253
167113
|
lineWidth: ctx.options.lineWidth,
|
|
167254
167114
|
minContentWidth: ctx.options.minContentWidth
|
|
167255
167115
|
});
|
|
167256
|
-
var containsDocumentMarker = (
|
|
167257
|
-
function lineLengthOverLimit(
|
|
167116
|
+
var containsDocumentMarker = (str2) => /^(%|---|\.\.\.)/m.test(str2);
|
|
167117
|
+
function lineLengthOverLimit(str2, lineWidth, indentLength) {
|
|
167258
167118
|
if (!lineWidth || lineWidth < 0)
|
|
167259
167119
|
return false;
|
|
167260
167120
|
const limit = lineWidth - indentLength;
|
|
167261
|
-
const strLen =
|
|
167121
|
+
const strLen = str2.length;
|
|
167262
167122
|
if (strLen <= limit)
|
|
167263
167123
|
return false;
|
|
167264
167124
|
for (let i = 0, start = 0; i < strLen; ++i) {
|
|
167265
|
-
if (
|
|
167125
|
+
if (str2[i] === "\n") {
|
|
167266
167126
|
if (i - start > limit)
|
|
167267
167127
|
return true;
|
|
167268
167128
|
start = i + 1;
|
|
@@ -167279,11 +167139,11 @@ var require_stringifyString = __commonJS({
|
|
|
167279
167139
|
const { implicitKey } = ctx;
|
|
167280
167140
|
const minMultiLineLength = ctx.options.doubleQuotedMinMultiLineLength;
|
|
167281
167141
|
const indent2 = ctx.indent || (containsDocumentMarker(value2) ? " " : "");
|
|
167282
|
-
let
|
|
167142
|
+
let str2 = "";
|
|
167283
167143
|
let start = 0;
|
|
167284
167144
|
for (let i = 0, ch = json[i]; ch; ch = json[++i]) {
|
|
167285
167145
|
if (ch === " " && json[i + 1] === "\\" && json[i + 2] === "n") {
|
|
167286
|
-
|
|
167146
|
+
str2 += json.slice(start, i) + "\\ ";
|
|
167287
167147
|
i += 1;
|
|
167288
167148
|
start = i;
|
|
167289
167149
|
ch = "\\";
|
|
@@ -167292,38 +167152,38 @@ var require_stringifyString = __commonJS({
|
|
|
167292
167152
|
switch (json[i + 1]) {
|
|
167293
167153
|
case "u":
|
|
167294
167154
|
{
|
|
167295
|
-
|
|
167155
|
+
str2 += json.slice(start, i);
|
|
167296
167156
|
const code2 = json.substr(i + 2, 4);
|
|
167297
167157
|
switch (code2) {
|
|
167298
167158
|
case "0000":
|
|
167299
|
-
|
|
167159
|
+
str2 += "\\0";
|
|
167300
167160
|
break;
|
|
167301
167161
|
case "0007":
|
|
167302
|
-
|
|
167162
|
+
str2 += "\\a";
|
|
167303
167163
|
break;
|
|
167304
167164
|
case "000b":
|
|
167305
|
-
|
|
167165
|
+
str2 += "\\v";
|
|
167306
167166
|
break;
|
|
167307
167167
|
case "001b":
|
|
167308
|
-
|
|
167168
|
+
str2 += "\\e";
|
|
167309
167169
|
break;
|
|
167310
167170
|
case "0085":
|
|
167311
|
-
|
|
167171
|
+
str2 += "\\N";
|
|
167312
167172
|
break;
|
|
167313
167173
|
case "00a0":
|
|
167314
|
-
|
|
167174
|
+
str2 += "\\_";
|
|
167315
167175
|
break;
|
|
167316
167176
|
case "2028":
|
|
167317
|
-
|
|
167177
|
+
str2 += "\\L";
|
|
167318
167178
|
break;
|
|
167319
167179
|
case "2029":
|
|
167320
|
-
|
|
167180
|
+
str2 += "\\P";
|
|
167321
167181
|
break;
|
|
167322
167182
|
default:
|
|
167323
167183
|
if (code2.substr(0, 2) === "00")
|
|
167324
|
-
|
|
167184
|
+
str2 += "\\x" + code2.substr(2);
|
|
167325
167185
|
else
|
|
167326
|
-
|
|
167186
|
+
str2 += json.substr(i, 6);
|
|
167327
167187
|
}
|
|
167328
167188
|
i += 5;
|
|
167329
167189
|
start = i + 1;
|
|
@@ -167333,14 +167193,14 @@ var require_stringifyString = __commonJS({
|
|
|
167333
167193
|
if (implicitKey || json[i + 2] === '"' || json.length < minMultiLineLength) {
|
|
167334
167194
|
i += 1;
|
|
167335
167195
|
} else {
|
|
167336
|
-
|
|
167196
|
+
str2 += json.slice(start, i) + "\n\n";
|
|
167337
167197
|
while (json[i + 2] === "\\" && json[i + 3] === "n" && json[i + 4] !== '"') {
|
|
167338
|
-
|
|
167198
|
+
str2 += "\n";
|
|
167339
167199
|
i += 2;
|
|
167340
167200
|
}
|
|
167341
|
-
|
|
167201
|
+
str2 += indent2;
|
|
167342
167202
|
if (json[i + 2] === " ")
|
|
167343
|
-
|
|
167203
|
+
str2 += "\\";
|
|
167344
167204
|
i += 1;
|
|
167345
167205
|
start = i + 1;
|
|
167346
167206
|
}
|
|
@@ -167349,8 +167209,8 @@ var require_stringifyString = __commonJS({
|
|
|
167349
167209
|
i += 1;
|
|
167350
167210
|
}
|
|
167351
167211
|
}
|
|
167352
|
-
|
|
167353
|
-
return implicitKey ?
|
|
167212
|
+
str2 = start ? str2 + json.slice(start) : json;
|
|
167213
|
+
return implicitKey ? str2 : foldFlowLines.foldFlowLines(str2, indent2, foldFlowLines.FOLD_QUOTED, getFoldOptions(ctx, false));
|
|
167354
167214
|
}
|
|
167355
167215
|
function singleQuotedString(value2, ctx) {
|
|
167356
167216
|
if (ctx.options.singleQuote === false || ctx.implicitKey && value2.includes("\n") || /[ \t]\n|\n[ \t]/.test(value2))
|
|
@@ -167478,15 +167338,15 @@ ${indent2}${start}${value2}${end}`;
|
|
|
167478
167338
|
return quotedString(value2, ctx);
|
|
167479
167339
|
}
|
|
167480
167340
|
}
|
|
167481
|
-
const
|
|
167341
|
+
const str2 = value2.replace(/\n+/g, `$&
|
|
167482
167342
|
${indent2}`);
|
|
167483
167343
|
if (actualString) {
|
|
167484
|
-
const test = (tag) => tag.default && tag.tag !== "tag:yaml.org,2002:str" && tag.test?.test(
|
|
167344
|
+
const test = (tag) => tag.default && tag.tag !== "tag:yaml.org,2002:str" && tag.test?.test(str2);
|
|
167485
167345
|
const { compat, tags } = ctx.doc.schema;
|
|
167486
167346
|
if (tags.some(test) || compat?.some(test))
|
|
167487
167347
|
return quotedString(value2, ctx);
|
|
167488
167348
|
}
|
|
167489
|
-
return implicitKey ?
|
|
167349
|
+
return implicitKey ? str2 : foldFlowLines.foldFlowLines(str2, indent2, foldFlowLines.FOLD_FLOW, getFoldOptions(ctx, false));
|
|
167490
167350
|
}
|
|
167491
167351
|
function stringifyString(item, ctx, onComment, onChompKeep) {
|
|
167492
167352
|
const { implicitKey, inFlow } = ctx;
|
|
@@ -167638,11 +167498,11 @@ var require_stringify2 = __commonJS({
|
|
|
167638
167498
|
const props = stringifyProps(node2, tagObj, ctx);
|
|
167639
167499
|
if (props.length > 0)
|
|
167640
167500
|
ctx.indentAtStart = (ctx.indentAtStart ?? 0) + props.length + 1;
|
|
167641
|
-
const
|
|
167501
|
+
const str2 = typeof tagObj.stringify === "function" ? tagObj.stringify(node2, ctx, onComment, onChompKeep) : identity.isScalar(node2) ? stringifyString.stringifyString(node2, ctx, onComment, onChompKeep) : node2.toString(ctx, onComment, onChompKeep);
|
|
167642
167502
|
if (!props)
|
|
167643
|
-
return
|
|
167644
|
-
return identity.isScalar(node2) ||
|
|
167645
|
-
${ctx.indent}${
|
|
167503
|
+
return str2;
|
|
167504
|
+
return identity.isScalar(node2) || str2[0] === "{" || str2[0] === "[" ? `${props} ${str2}` : `${props}
|
|
167505
|
+
${ctx.indent}${str2}`;
|
|
167646
167506
|
}
|
|
167647
167507
|
exports2.createStringifyContext = createStringifyContext;
|
|
167648
167508
|
exports2.stringify = stringify;
|
|
@@ -167677,8 +167537,8 @@ var require_stringifyPair = __commonJS({
|
|
|
167677
167537
|
});
|
|
167678
167538
|
let keyCommentDone = false;
|
|
167679
167539
|
let chompKeep = false;
|
|
167680
|
-
let
|
|
167681
|
-
if (!explicitKey && !ctx.inFlow &&
|
|
167540
|
+
let str2 = stringify.stringify(key, ctx, () => keyCommentDone = true, () => chompKeep = true);
|
|
167541
|
+
if (!explicitKey && !ctx.inFlow && str2.length > 1024) {
|
|
167682
167542
|
if (simpleKeys)
|
|
167683
167543
|
throw new Error("With simple keys, single line scalar must not span more than 1024 characters");
|
|
167684
167544
|
explicitKey = true;
|
|
@@ -167687,27 +167547,27 @@ var require_stringifyPair = __commonJS({
|
|
|
167687
167547
|
if (allNullValues || value2 == null) {
|
|
167688
167548
|
if (keyCommentDone && onComment)
|
|
167689
167549
|
onComment();
|
|
167690
|
-
return
|
|
167550
|
+
return str2 === "" ? "?" : explicitKey ? `? ${str2}` : str2;
|
|
167691
167551
|
}
|
|
167692
167552
|
} else if (allNullValues && !simpleKeys || value2 == null && explicitKey) {
|
|
167693
|
-
|
|
167553
|
+
str2 = `? ${str2}`;
|
|
167694
167554
|
if (keyComment && !keyCommentDone) {
|
|
167695
|
-
|
|
167555
|
+
str2 += stringifyComment.lineComment(str2, ctx.indent, commentString(keyComment));
|
|
167696
167556
|
} else if (chompKeep && onChompKeep)
|
|
167697
167557
|
onChompKeep();
|
|
167698
|
-
return
|
|
167558
|
+
return str2;
|
|
167699
167559
|
}
|
|
167700
167560
|
if (keyCommentDone)
|
|
167701
167561
|
keyComment = null;
|
|
167702
167562
|
if (explicitKey) {
|
|
167703
167563
|
if (keyComment)
|
|
167704
|
-
|
|
167705
|
-
|
|
167564
|
+
str2 += stringifyComment.lineComment(str2, ctx.indent, commentString(keyComment));
|
|
167565
|
+
str2 = `? ${str2}
|
|
167706
167566
|
${indent2}:`;
|
|
167707
167567
|
} else {
|
|
167708
|
-
|
|
167568
|
+
str2 = `${str2}:`;
|
|
167709
167569
|
if (keyComment)
|
|
167710
|
-
|
|
167570
|
+
str2 += stringifyComment.lineComment(str2, ctx.indent, commentString(keyComment));
|
|
167711
167571
|
}
|
|
167712
167572
|
let vsb, vcb, valueComment;
|
|
167713
167573
|
if (identity.isNode(value2)) {
|
|
@@ -167723,7 +167583,7 @@ ${indent2}:`;
|
|
|
167723
167583
|
}
|
|
167724
167584
|
ctx.implicitKey = false;
|
|
167725
167585
|
if (!explicitKey && !keyComment && identity.isScalar(value2))
|
|
167726
|
-
ctx.indentAtStart =
|
|
167586
|
+
ctx.indentAtStart = str2.length + 1;
|
|
167727
167587
|
chompKeep = false;
|
|
167728
167588
|
if (!indentSeq && indentStep.length >= 2 && !ctx.inFlow && !explicitKey && identity.isSeq(value2) && !value2.flow && !value2.tag && !value2.anchor) {
|
|
167729
167589
|
ctx.indent = ctx.indent.substring(2);
|
|
@@ -167767,16 +167627,16 @@ ${ctx.indent}`;
|
|
|
167767
167627
|
} else if (valueStr === "" || valueStr[0] === "\n") {
|
|
167768
167628
|
ws = "";
|
|
167769
167629
|
}
|
|
167770
|
-
|
|
167630
|
+
str2 += ws + valueStr;
|
|
167771
167631
|
if (ctx.inFlow) {
|
|
167772
167632
|
if (valueCommentDone && onComment)
|
|
167773
167633
|
onComment();
|
|
167774
167634
|
} else if (valueComment && !valueCommentDone) {
|
|
167775
|
-
|
|
167635
|
+
str2 += stringifyComment.lineComment(str2, ctx.indent, commentString(valueComment));
|
|
167776
167636
|
} else if (chompKeep && onChompKeep) {
|
|
167777
167637
|
onChompKeep();
|
|
167778
167638
|
}
|
|
167779
|
-
return
|
|
167639
|
+
return str2;
|
|
167780
167640
|
}
|
|
167781
167641
|
exports2.stringifyPair = stringifyPair;
|
|
167782
167642
|
}
|
|
@@ -168003,31 +167863,31 @@ var require_stringifyCollection = __commonJS({
|
|
|
168003
167863
|
}
|
|
168004
167864
|
}
|
|
168005
167865
|
chompKeep = false;
|
|
168006
|
-
let
|
|
167866
|
+
let str3 = stringify.stringify(item, itemCtx, () => comment2 = null, () => chompKeep = true);
|
|
168007
167867
|
if (comment2)
|
|
168008
|
-
|
|
167868
|
+
str3 += stringifyComment.lineComment(str3, itemIndent, commentString(comment2));
|
|
168009
167869
|
if (chompKeep && comment2)
|
|
168010
167870
|
chompKeep = false;
|
|
168011
|
-
lines.push(blockItemPrefix +
|
|
167871
|
+
lines.push(blockItemPrefix + str3);
|
|
168012
167872
|
}
|
|
168013
|
-
let
|
|
167873
|
+
let str2;
|
|
168014
167874
|
if (lines.length === 0) {
|
|
168015
|
-
|
|
167875
|
+
str2 = flowChars.start + flowChars.end;
|
|
168016
167876
|
} else {
|
|
168017
|
-
|
|
167877
|
+
str2 = lines[0];
|
|
168018
167878
|
for (let i = 1; i < lines.length; ++i) {
|
|
168019
167879
|
const line = lines[i];
|
|
168020
|
-
|
|
167880
|
+
str2 += line ? `
|
|
168021
167881
|
${indent2}${line}` : "\n";
|
|
168022
167882
|
}
|
|
168023
167883
|
}
|
|
168024
167884
|
if (comment) {
|
|
168025
|
-
|
|
167885
|
+
str2 += "\n" + stringifyComment.indentComment(commentString(comment), indent2);
|
|
168026
167886
|
if (onComment)
|
|
168027
167887
|
onComment();
|
|
168028
167888
|
} else if (chompKeep && onChompKeep)
|
|
168029
167889
|
onChompKeep();
|
|
168030
|
-
return
|
|
167890
|
+
return str2;
|
|
168031
167891
|
}
|
|
168032
167892
|
function stringifyFlowCollection({ items }, ctx, { flowChars, itemIndent }) {
|
|
168033
167893
|
const { indent: indent2, indentStep, flowCollectionPadding: fcPadding, options: { commentString } } = ctx;
|
|
@@ -168070,21 +167930,21 @@ ${indent2}${line}` : "\n";
|
|
|
168070
167930
|
}
|
|
168071
167931
|
if (comment)
|
|
168072
167932
|
reqNewline = true;
|
|
168073
|
-
let
|
|
168074
|
-
reqNewline || (reqNewline = lines.length > linesAtValue ||
|
|
167933
|
+
let str2 = stringify.stringify(item, itemCtx, () => comment = null);
|
|
167934
|
+
reqNewline || (reqNewline = lines.length > linesAtValue || str2.includes("\n"));
|
|
168075
167935
|
if (i < items.length - 1) {
|
|
168076
|
-
|
|
167936
|
+
str2 += ",";
|
|
168077
167937
|
} else if (ctx.options.trailingComma) {
|
|
168078
167938
|
if (ctx.options.lineWidth > 0) {
|
|
168079
|
-
reqNewline || (reqNewline = lines.reduce((sum, line) => sum + line.length + 2, 2) + (
|
|
167939
|
+
reqNewline || (reqNewline = lines.reduce((sum, line) => sum + line.length + 2, 2) + (str2.length + 2) > ctx.options.lineWidth);
|
|
168080
167940
|
}
|
|
168081
167941
|
if (reqNewline) {
|
|
168082
|
-
|
|
167942
|
+
str2 += ",";
|
|
168083
167943
|
}
|
|
168084
167944
|
}
|
|
168085
167945
|
if (comment)
|
|
168086
|
-
|
|
168087
|
-
lines.push(
|
|
167946
|
+
str2 += stringifyComment.lineComment(str2, itemIndent, commentString(comment));
|
|
167947
|
+
lines.push(str2);
|
|
168088
167948
|
linesAtValue = lines.length;
|
|
168089
167949
|
}
|
|
168090
167950
|
const { start, end } = flowChars;
|
|
@@ -168096,11 +167956,11 @@ ${indent2}${line}` : "\n";
|
|
|
168096
167956
|
reqNewline = ctx.options.lineWidth > 0 && len > ctx.options.lineWidth;
|
|
168097
167957
|
}
|
|
168098
167958
|
if (reqNewline) {
|
|
168099
|
-
let
|
|
167959
|
+
let str2 = start;
|
|
168100
167960
|
for (const line of lines)
|
|
168101
|
-
|
|
167961
|
+
str2 += line ? `
|
|
168102
167962
|
${indentStep}${indent2}${line}` : "\n";
|
|
168103
|
-
return `${
|
|
167963
|
+
return `${str2}
|
|
168104
167964
|
${indent2}${end}`;
|
|
168105
167965
|
} else {
|
|
168106
167966
|
return `${start}${fcPadding}${lines.join(" ")}${fcPadding}${end}`;
|
|
@@ -168432,7 +168292,7 @@ var require_string = __commonJS({
|
|
|
168432
168292
|
identify: (value2) => typeof value2 === "string",
|
|
168433
168293
|
default: true,
|
|
168434
168294
|
tag: "tag:yaml.org,2002:str",
|
|
168435
|
-
resolve: (
|
|
168295
|
+
resolve: (str2) => str2,
|
|
168436
168296
|
stringify(item, ctx, onComment, onChompKeep) {
|
|
168437
168297
|
ctx = Object.assign({ actualString: true }, ctx);
|
|
168438
168298
|
return stringifyString.stringifyString(item, ctx, onComment, onChompKeep);
|
|
@@ -168470,7 +168330,7 @@ var require_bool = __commonJS({
|
|
|
168470
168330
|
default: true,
|
|
168471
168331
|
tag: "tag:yaml.org,2002:bool",
|
|
168472
168332
|
test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
|
|
168473
|
-
resolve: (
|
|
168333
|
+
resolve: (str2) => new Scalar.Scalar(str2[0] === "t" || str2[0] === "T"),
|
|
168474
168334
|
stringify({ source, value: value2 }, ctx) {
|
|
168475
168335
|
if (source && boolTag.test.test(source)) {
|
|
168476
168336
|
const sv = source[0] === "t" || source[0] === "T";
|
|
@@ -168522,7 +168382,7 @@ var require_float2 = __commonJS({
|
|
|
168522
168382
|
default: true,
|
|
168523
168383
|
tag: "tag:yaml.org,2002:float",
|
|
168524
168384
|
test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
|
|
168525
|
-
resolve: (
|
|
168385
|
+
resolve: (str2) => str2.slice(-3).toLowerCase() === "nan" ? NaN : str2[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
|
|
168526
168386
|
stringify: stringifyNumber.stringifyNumber
|
|
168527
168387
|
};
|
|
168528
168388
|
var floatExp = {
|
|
@@ -168531,7 +168391,7 @@ var require_float2 = __commonJS({
|
|
|
168531
168391
|
tag: "tag:yaml.org,2002:float",
|
|
168532
168392
|
format: "EXP",
|
|
168533
168393
|
test: /^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,
|
|
168534
|
-
resolve: (
|
|
168394
|
+
resolve: (str2) => parseFloat(str2),
|
|
168535
168395
|
stringify(node2) {
|
|
168536
168396
|
const num2 = Number(node2.value);
|
|
168537
168397
|
return isFinite(num2) ? num2.toExponential() : stringifyNumber.stringifyNumber(node2);
|
|
@@ -168542,11 +168402,11 @@ var require_float2 = __commonJS({
|
|
|
168542
168402
|
default: true,
|
|
168543
168403
|
tag: "tag:yaml.org,2002:float",
|
|
168544
168404
|
test: /^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,
|
|
168545
|
-
resolve(
|
|
168546
|
-
const node2 = new Scalar.Scalar(parseFloat(
|
|
168547
|
-
const dot =
|
|
168548
|
-
if (dot !== -1 &&
|
|
168549
|
-
node2.minFractionDigits =
|
|
168405
|
+
resolve(str2) {
|
|
168406
|
+
const node2 = new Scalar.Scalar(parseFloat(str2));
|
|
168407
|
+
const dot = str2.indexOf(".");
|
|
168408
|
+
if (dot !== -1 && str2[str2.length - 1] === "0")
|
|
168409
|
+
node2.minFractionDigits = str2.length - dot - 1;
|
|
168550
168410
|
return node2;
|
|
168551
168411
|
},
|
|
168552
168412
|
stringify: stringifyNumber.stringifyNumber
|
|
@@ -168563,7 +168423,7 @@ var require_int = __commonJS({
|
|
|
168563
168423
|
"use strict";
|
|
168564
168424
|
var stringifyNumber = require_stringifyNumber();
|
|
168565
168425
|
var intIdentify = (value2) => typeof value2 === "bigint" || Number.isInteger(value2);
|
|
168566
|
-
var intResolve = (
|
|
168426
|
+
var intResolve = (str2, offset, radix, { intAsBigInt }) => intAsBigInt ? BigInt(str2) : parseInt(str2.substring(offset), radix);
|
|
168567
168427
|
function intStringify(node2, radix, prefix) {
|
|
168568
168428
|
const { value: value2 } = node2;
|
|
168569
168429
|
if (intIdentify(value2) && value2 >= 0)
|
|
@@ -168576,7 +168436,7 @@ var require_int = __commonJS({
|
|
|
168576
168436
|
tag: "tag:yaml.org,2002:int",
|
|
168577
168437
|
format: "OCT",
|
|
168578
168438
|
test: /^0o[0-7]+$/,
|
|
168579
|
-
resolve: (
|
|
168439
|
+
resolve: (str2, _onError, opt) => intResolve(str2, 2, 8, opt),
|
|
168580
168440
|
stringify: (node2) => intStringify(node2, 8, "0o")
|
|
168581
168441
|
};
|
|
168582
168442
|
var int2 = {
|
|
@@ -168584,7 +168444,7 @@ var require_int = __commonJS({
|
|
|
168584
168444
|
default: true,
|
|
168585
168445
|
tag: "tag:yaml.org,2002:int",
|
|
168586
168446
|
test: /^[-+]?[0-9]+$/,
|
|
168587
|
-
resolve: (
|
|
168447
|
+
resolve: (str2, _onError, opt) => intResolve(str2, 0, 10, opt),
|
|
168588
168448
|
stringify: stringifyNumber.stringifyNumber
|
|
168589
168449
|
};
|
|
168590
168450
|
var intHex = {
|
|
@@ -168593,7 +168453,7 @@ var require_int = __commonJS({
|
|
|
168593
168453
|
tag: "tag:yaml.org,2002:int",
|
|
168594
168454
|
format: "HEX",
|
|
168595
168455
|
test: /^0x[0-9a-fA-F]+$/,
|
|
168596
|
-
resolve: (
|
|
168456
|
+
resolve: (str2, _onError, opt) => intResolve(str2, 2, 16, opt),
|
|
168597
168457
|
stringify: (node2) => intStringify(node2, 16, "0x")
|
|
168598
168458
|
};
|
|
168599
168459
|
exports2.int = int2;
|
|
@@ -168646,7 +168506,7 @@ var require_schema2 = __commonJS({
|
|
|
168646
168506
|
identify: (value2) => typeof value2 === "string",
|
|
168647
168507
|
default: true,
|
|
168648
168508
|
tag: "tag:yaml.org,2002:str",
|
|
168649
|
-
resolve: (
|
|
168509
|
+
resolve: (str2) => str2,
|
|
168650
168510
|
stringify: stringifyJSON
|
|
168651
168511
|
},
|
|
168652
168512
|
{
|
|
@@ -168663,7 +168523,7 @@ var require_schema2 = __commonJS({
|
|
|
168663
168523
|
default: true,
|
|
168664
168524
|
tag: "tag:yaml.org,2002:bool",
|
|
168665
168525
|
test: /^true$|^false$/,
|
|
168666
|
-
resolve: (
|
|
168526
|
+
resolve: (str2) => str2 === "true",
|
|
168667
168527
|
stringify: stringifyJSON
|
|
168668
168528
|
},
|
|
168669
168529
|
{
|
|
@@ -168671,7 +168531,7 @@ var require_schema2 = __commonJS({
|
|
|
168671
168531
|
default: true,
|
|
168672
168532
|
tag: "tag:yaml.org,2002:int",
|
|
168673
168533
|
test: /^-?(?:0|[1-9][0-9]*)$/,
|
|
168674
|
-
resolve: (
|
|
168534
|
+
resolve: (str2, _onError, { intAsBigInt }) => intAsBigInt ? BigInt(str2) : parseInt(str2, 10),
|
|
168675
168535
|
stringify: ({ value: value2 }) => intIdentify(value2) ? value2.toString() : JSON.stringify(value2)
|
|
168676
168536
|
},
|
|
168677
168537
|
{
|
|
@@ -168679,7 +168539,7 @@ var require_schema2 = __commonJS({
|
|
|
168679
168539
|
default: true,
|
|
168680
168540
|
tag: "tag:yaml.org,2002:float",
|
|
168681
168541
|
test: /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,
|
|
168682
|
-
resolve: (
|
|
168542
|
+
resolve: (str2) => parseFloat(str2),
|
|
168683
168543
|
stringify: stringifyJSON
|
|
168684
168544
|
}
|
|
168685
168545
|
];
|
|
@@ -168687,9 +168547,9 @@ var require_schema2 = __commonJS({
|
|
|
168687
168547
|
default: true,
|
|
168688
168548
|
tag: "",
|
|
168689
168549
|
test: /^/,
|
|
168690
|
-
resolve(
|
|
168691
|
-
onError(`Unresolved plain scalar ${JSON.stringify(
|
|
168692
|
-
return
|
|
168550
|
+
resolve(str2, onError) {
|
|
168551
|
+
onError(`Unresolved plain scalar ${JSON.stringify(str2)}`);
|
|
168552
|
+
return str2;
|
|
168693
168553
|
}
|
|
168694
168554
|
};
|
|
168695
168555
|
var schema = [map.map, seq.seq].concat(jsonScalars, jsonError);
|
|
@@ -168721,10 +168581,10 @@ var require_binary = __commonJS({
|
|
|
168721
168581
|
if (typeof node_buffer.Buffer === "function") {
|
|
168722
168582
|
return node_buffer.Buffer.from(src, "base64");
|
|
168723
168583
|
} else if (typeof atob === "function") {
|
|
168724
|
-
const
|
|
168725
|
-
const buffer = new Uint8Array(
|
|
168726
|
-
for (let i = 0; i <
|
|
168727
|
-
buffer[i] =
|
|
168584
|
+
const str2 = atob(src.replace(/[\n\r]/g, ""));
|
|
168585
|
+
const buffer = new Uint8Array(str2.length);
|
|
168586
|
+
for (let i = 0; i < str2.length; ++i)
|
|
168587
|
+
buffer[i] = str2.charCodeAt(i);
|
|
168728
168588
|
return buffer;
|
|
168729
168589
|
} else {
|
|
168730
168590
|
onError("This environment does not support reading binary tags; either Buffer or atob is required");
|
|
@@ -168735,28 +168595,28 @@ var require_binary = __commonJS({
|
|
|
168735
168595
|
if (!value2)
|
|
168736
168596
|
return "";
|
|
168737
168597
|
const buf = value2;
|
|
168738
|
-
let
|
|
168598
|
+
let str2;
|
|
168739
168599
|
if (typeof node_buffer.Buffer === "function") {
|
|
168740
|
-
|
|
168600
|
+
str2 = buf instanceof node_buffer.Buffer ? buf.toString("base64") : node_buffer.Buffer.from(buf.buffer).toString("base64");
|
|
168741
168601
|
} else if (typeof btoa === "function") {
|
|
168742
168602
|
let s2 = "";
|
|
168743
168603
|
for (let i = 0; i < buf.length; ++i)
|
|
168744
168604
|
s2 += String.fromCharCode(buf[i]);
|
|
168745
|
-
|
|
168605
|
+
str2 = btoa(s2);
|
|
168746
168606
|
} else {
|
|
168747
168607
|
throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");
|
|
168748
168608
|
}
|
|
168749
168609
|
type ?? (type = Scalar.Scalar.BLOCK_LITERAL);
|
|
168750
168610
|
if (type !== Scalar.Scalar.QUOTE_DOUBLE) {
|
|
168751
168611
|
const lineWidth = Math.max(ctx.options.lineWidth - ctx.indent.length, ctx.options.minContentWidth);
|
|
168752
|
-
const n = Math.ceil(
|
|
168612
|
+
const n = Math.ceil(str2.length / lineWidth);
|
|
168753
168613
|
const lines = new Array(n);
|
|
168754
168614
|
for (let i = 0, o = 0; i < n; ++i, o += lineWidth) {
|
|
168755
|
-
lines[i] =
|
|
168615
|
+
lines[i] = str2.substr(o, lineWidth);
|
|
168756
168616
|
}
|
|
168757
|
-
|
|
168617
|
+
str2 = lines.join(type === Scalar.Scalar.BLOCK_LITERAL ? "\n" : " ");
|
|
168758
168618
|
}
|
|
168759
|
-
return stringifyString.stringifyString({ comment, type, value:
|
|
168619
|
+
return stringifyString.stringifyString({ comment, type, value: str2 }, ctx, onComment, onChompKeep);
|
|
168760
168620
|
}
|
|
168761
168621
|
};
|
|
168762
168622
|
exports2.binary = binary;
|
|
@@ -168962,7 +168822,7 @@ var require_float3 = __commonJS({
|
|
|
168962
168822
|
default: true,
|
|
168963
168823
|
tag: "tag:yaml.org,2002:float",
|
|
168964
168824
|
test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
|
|
168965
|
-
resolve: (
|
|
168825
|
+
resolve: (str2) => str2.slice(-3).toLowerCase() === "nan" ? NaN : str2[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
|
|
168966
168826
|
stringify: stringifyNumber.stringifyNumber
|
|
168967
168827
|
};
|
|
168968
168828
|
var floatExp = {
|
|
@@ -168971,7 +168831,7 @@ var require_float3 = __commonJS({
|
|
|
168971
168831
|
tag: "tag:yaml.org,2002:float",
|
|
168972
168832
|
format: "EXP",
|
|
168973
168833
|
test: /^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,
|
|
168974
|
-
resolve: (
|
|
168834
|
+
resolve: (str2) => parseFloat(str2.replace(/_/g, "")),
|
|
168975
168835
|
stringify(node2) {
|
|
168976
168836
|
const num2 = Number(node2.value);
|
|
168977
168837
|
return isFinite(num2) ? num2.toExponential() : stringifyNumber.stringifyNumber(node2);
|
|
@@ -168982,11 +168842,11 @@ var require_float3 = __commonJS({
|
|
|
168982
168842
|
default: true,
|
|
168983
168843
|
tag: "tag:yaml.org,2002:float",
|
|
168984
168844
|
test: /^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,
|
|
168985
|
-
resolve(
|
|
168986
|
-
const node2 = new Scalar.Scalar(parseFloat(
|
|
168987
|
-
const dot =
|
|
168845
|
+
resolve(str2) {
|
|
168846
|
+
const node2 = new Scalar.Scalar(parseFloat(str2.replace(/_/g, "")));
|
|
168847
|
+
const dot = str2.indexOf(".");
|
|
168988
168848
|
if (dot !== -1) {
|
|
168989
|
-
const f2 =
|
|
168849
|
+
const f2 = str2.substring(dot + 1).replace(/_/g, "");
|
|
168990
168850
|
if (f2[f2.length - 1] === "0")
|
|
168991
168851
|
node2.minFractionDigits = f2.length;
|
|
168992
168852
|
}
|
|
@@ -169006,34 +168866,34 @@ var require_int2 = __commonJS({
|
|
|
169006
168866
|
"use strict";
|
|
169007
168867
|
var stringifyNumber = require_stringifyNumber();
|
|
169008
168868
|
var intIdentify = (value2) => typeof value2 === "bigint" || Number.isInteger(value2);
|
|
169009
|
-
function intResolve(
|
|
169010
|
-
const sign3 =
|
|
168869
|
+
function intResolve(str2, offset, radix, { intAsBigInt }) {
|
|
168870
|
+
const sign3 = str2[0];
|
|
169011
168871
|
if (sign3 === "-" || sign3 === "+")
|
|
169012
168872
|
offset += 1;
|
|
169013
|
-
|
|
168873
|
+
str2 = str2.substring(offset).replace(/_/g, "");
|
|
169014
168874
|
if (intAsBigInt) {
|
|
169015
168875
|
switch (radix) {
|
|
169016
168876
|
case 2:
|
|
169017
|
-
|
|
168877
|
+
str2 = `0b${str2}`;
|
|
169018
168878
|
break;
|
|
169019
168879
|
case 8:
|
|
169020
|
-
|
|
168880
|
+
str2 = `0o${str2}`;
|
|
169021
168881
|
break;
|
|
169022
168882
|
case 16:
|
|
169023
|
-
|
|
168883
|
+
str2 = `0x${str2}`;
|
|
169024
168884
|
break;
|
|
169025
168885
|
}
|
|
169026
|
-
const n2 = BigInt(
|
|
168886
|
+
const n2 = BigInt(str2);
|
|
169027
168887
|
return sign3 === "-" ? BigInt(-1) * n2 : n2;
|
|
169028
168888
|
}
|
|
169029
|
-
const n = parseInt(
|
|
168889
|
+
const n = parseInt(str2, radix);
|
|
169030
168890
|
return sign3 === "-" ? -1 * n : n;
|
|
169031
168891
|
}
|
|
169032
168892
|
function intStringify(node2, radix, prefix) {
|
|
169033
168893
|
const { value: value2 } = node2;
|
|
169034
168894
|
if (intIdentify(value2)) {
|
|
169035
|
-
const
|
|
169036
|
-
return value2 < 0 ? "-" + prefix +
|
|
168895
|
+
const str2 = value2.toString(radix);
|
|
168896
|
+
return value2 < 0 ? "-" + prefix + str2.substr(1) : prefix + str2;
|
|
169037
168897
|
}
|
|
169038
168898
|
return stringifyNumber.stringifyNumber(node2);
|
|
169039
168899
|
}
|
|
@@ -169043,7 +168903,7 @@ var require_int2 = __commonJS({
|
|
|
169043
168903
|
tag: "tag:yaml.org,2002:int",
|
|
169044
168904
|
format: "BIN",
|
|
169045
168905
|
test: /^[-+]?0b[0-1_]+$/,
|
|
169046
|
-
resolve: (
|
|
168906
|
+
resolve: (str2, _onError, opt) => intResolve(str2, 2, 2, opt),
|
|
169047
168907
|
stringify: (node2) => intStringify(node2, 2, "0b")
|
|
169048
168908
|
};
|
|
169049
168909
|
var intOct = {
|
|
@@ -169052,7 +168912,7 @@ var require_int2 = __commonJS({
|
|
|
169052
168912
|
tag: "tag:yaml.org,2002:int",
|
|
169053
168913
|
format: "OCT",
|
|
169054
168914
|
test: /^[-+]?0[0-7_]+$/,
|
|
169055
|
-
resolve: (
|
|
168915
|
+
resolve: (str2, _onError, opt) => intResolve(str2, 1, 8, opt),
|
|
169056
168916
|
stringify: (node2) => intStringify(node2, 8, "0")
|
|
169057
168917
|
};
|
|
169058
168918
|
var int2 = {
|
|
@@ -169060,7 +168920,7 @@ var require_int2 = __commonJS({
|
|
|
169060
168920
|
default: true,
|
|
169061
168921
|
tag: "tag:yaml.org,2002:int",
|
|
169062
168922
|
test: /^[-+]?[0-9][0-9_]*$/,
|
|
169063
|
-
resolve: (
|
|
168923
|
+
resolve: (str2, _onError, opt) => intResolve(str2, 0, 10, opt),
|
|
169064
168924
|
stringify: stringifyNumber.stringifyNumber
|
|
169065
168925
|
};
|
|
169066
168926
|
var intHex = {
|
|
@@ -169069,7 +168929,7 @@ var require_int2 = __commonJS({
|
|
|
169069
168929
|
tag: "tag:yaml.org,2002:int",
|
|
169070
168930
|
format: "HEX",
|
|
169071
168931
|
test: /^[-+]?0x[0-9a-fA-F_]+$/,
|
|
169072
|
-
resolve: (
|
|
168932
|
+
resolve: (str2, _onError, opt) => intResolve(str2, 2, 16, opt),
|
|
169073
168933
|
stringify: (node2) => intStringify(node2, 16, "0x")
|
|
169074
168934
|
};
|
|
169075
168935
|
exports2.int = int2;
|
|
@@ -169173,9 +169033,9 @@ var require_timestamp = __commonJS({
|
|
|
169173
169033
|
"../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js"(exports2) {
|
|
169174
169034
|
"use strict";
|
|
169175
169035
|
var stringifyNumber = require_stringifyNumber();
|
|
169176
|
-
function parseSexagesimal(
|
|
169177
|
-
const sign3 =
|
|
169178
|
-
const parts = sign3 === "-" || sign3 === "+" ?
|
|
169036
|
+
function parseSexagesimal(str2, asBigInt) {
|
|
169037
|
+
const sign3 = str2[0];
|
|
169038
|
+
const parts = sign3 === "-" || sign3 === "+" ? str2.substring(1) : str2;
|
|
169179
169039
|
const num2 = (n) => asBigInt ? BigInt(n) : Number(n);
|
|
169180
169040
|
const res = parts.replace(/_/g, "").split(":").reduce((res2, p2) => res2 * num2(60) + num2(p2), num2(0));
|
|
169181
169041
|
return sign3 === "-" ? num2(-1) * res : res;
|
|
@@ -169212,7 +169072,7 @@ var require_timestamp = __commonJS({
|
|
|
169212
169072
|
tag: "tag:yaml.org,2002:int",
|
|
169213
169073
|
format: "TIME",
|
|
169214
169074
|
test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,
|
|
169215
|
-
resolve: (
|
|
169075
|
+
resolve: (str2, _onError, { intAsBigInt }) => parseSexagesimal(str2, intAsBigInt),
|
|
169216
169076
|
stringify: stringifySexagesimal
|
|
169217
169077
|
};
|
|
169218
169078
|
var floatTime = {
|
|
@@ -169221,7 +169081,7 @@ var require_timestamp = __commonJS({
|
|
|
169221
169081
|
tag: "tag:yaml.org,2002:float",
|
|
169222
169082
|
format: "TIME",
|
|
169223
169083
|
test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,
|
|
169224
|
-
resolve: (
|
|
169084
|
+
resolve: (str2) => parseSexagesimal(str2, false),
|
|
169225
169085
|
stringify: stringifySexagesimal
|
|
169226
169086
|
};
|
|
169227
169087
|
var timestamp = {
|
|
@@ -169232,8 +169092,8 @@ var require_timestamp = __commonJS({
|
|
|
169232
169092
|
// may be omitted altogether, resulting in a date format. In such a case, the time part is
|
|
169233
169093
|
// assumed to be 00:00:00Z (start of day, UTC).
|
|
169234
169094
|
test: RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),
|
|
169235
|
-
resolve(
|
|
169236
|
-
const match =
|
|
169095
|
+
resolve(str2) {
|
|
169096
|
+
const match = str2.match(timestamp.test);
|
|
169237
169097
|
if (!match)
|
|
169238
169098
|
throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");
|
|
169239
169099
|
const [, year, month, day, hour, minute, second] = match.map(Number);
|
|
@@ -184745,16 +184605,16 @@ var init_tool_home = __esm({
|
|
|
184745
184605
|
});
|
|
184746
184606
|
|
|
184747
184607
|
// ../connectors/src/_base/install.ts
|
|
184748
|
-
function installPlan(cmd,
|
|
184608
|
+
function installPlan(cmd, platform, toolsPrefix) {
|
|
184749
184609
|
if (cmd === "lark-cli") {
|
|
184750
|
-
const npm =
|
|
184610
|
+
const npm = platform === "win32" ? "npm.cmd" : "npm";
|
|
184751
184611
|
return [{ file: npm, args: ["install", "-g", "--prefix", toolsPrefix, "@larksuite/cli"], ensureDir: toolsPrefix }];
|
|
184752
184612
|
}
|
|
184753
184613
|
const pkg = cmd === "gh" ? { brew: "gh", apt: "gh", dnf: "gh", pacman: "github-cli", apk: "github-cli", winget: "GitHub.cli", choco: "gh", scoop: "gh" } : { brew: "git", apt: "git", dnf: "git", pacman: "git", apk: "git", winget: "Git.Git", choco: "git", scoop: "git" };
|
|
184754
|
-
if (
|
|
184614
|
+
if (platform === "darwin") {
|
|
184755
184615
|
return [{ file: "brew", args: ["install", pkg.brew], requires: "brew" }];
|
|
184756
184616
|
}
|
|
184757
|
-
if (
|
|
184617
|
+
if (platform === "win32") {
|
|
184758
184618
|
return [
|
|
184759
184619
|
{ file: "winget", args: ["install", "--silent", "--accept-package-agreements", "--accept-source-agreements", "-e", "--id", pkg.winget], requires: "winget" },
|
|
184760
184620
|
{ file: "choco", args: ["install", "-y", pkg.choco], requires: "choco" },
|
|
@@ -191943,11 +191803,7 @@ async function runProtocolSession(job, cfg) {
|
|
|
191943
191803
|
child.kill("SIGTERM");
|
|
191944
191804
|
}
|
|
191945
191805
|
} catch (error2) {
|
|
191946
|
-
if (!exited) {
|
|
191947
|
-
const msg = error2 instanceof Error ? error2.message : String(error2);
|
|
191948
|
-
const reason = killReason ?? (isSessionNotFoundError(msg) ? "session-not-found" : "error");
|
|
191949
|
-
finish({ code: null, reason, transcriptRef, errorMessage: msg });
|
|
191950
|
-
}
|
|
191806
|
+
if (!exited) finish({ code: null, reason: killReason ?? "error", transcriptRef, errorMessage: error2 instanceof Error ? error2.message : String(error2) });
|
|
191951
191807
|
child.kill("SIGTERM");
|
|
191952
191808
|
}
|
|
191953
191809
|
})();
|
|
@@ -191998,7 +191854,6 @@ var init_protocol_session = __esm({
|
|
|
191998
191854
|
init_container_runtime();
|
|
191999
191855
|
init_materialize_bundle();
|
|
192000
191856
|
init_session_paths();
|
|
192001
|
-
init_resume_classify();
|
|
192002
191857
|
init_sync_skills();
|
|
192003
191858
|
init_transcript();
|
|
192004
191859
|
init_filter_extra_args();
|
|
@@ -192532,11 +192387,17 @@ var init_codex = __esm({
|
|
|
192532
192387
|
}),
|
|
192533
192388
|
async start(send, currentJob, dir, task, state) {
|
|
192534
192389
|
const threadParams = currentJob.resumeRuntimeSession && currentJob.runtimeSessionId ? { threadId: currentJob.runtimeSessionId, cwd: dir, model: resolvedModel2 ?? null, approvalPolicy: "never", sandbox: "danger-full-access" } : { cwd: dir, model: resolvedModel2 ?? null, approvalPolicy: "never", sandbox: "danger-full-access" };
|
|
192535
|
-
|
|
192536
|
-
|
|
192537
|
-
|
|
192538
|
-
|
|
192539
|
-
|
|
192390
|
+
let thread;
|
|
192391
|
+
try {
|
|
192392
|
+
thread = await send({
|
|
192393
|
+
jsonrpc: "2.0",
|
|
192394
|
+
method: currentJob.resumeRuntimeSession && currentJob.runtimeSessionId ? "thread/resume" : "thread/start",
|
|
192395
|
+
params: threadParams
|
|
192396
|
+
});
|
|
192397
|
+
} catch (error2) {
|
|
192398
|
+
if (!(currentJob.resumeRuntimeSession && currentJob.runtimeSessionId)) throw error2;
|
|
192399
|
+
thread = await send({ jsonrpc: "2.0", method: "thread/start", params: { cwd: dir, model: resolvedModel2 ?? null, approvalPolicy: "never", sandbox: "danger-full-access" } });
|
|
192400
|
+
}
|
|
192540
192401
|
const threadId = thread.thread?.id ?? thread.id;
|
|
192541
192402
|
if (typeof threadId !== "string" || !threadId) throw new Error("codex app-server returned no thread id");
|
|
192542
192403
|
state.threadId = threadId;
|
|
@@ -194582,35 +194443,6 @@ ${task}` : task;
|
|
|
194582
194443
|
}
|
|
194583
194444
|
});
|
|
194584
194445
|
|
|
194585
|
-
// ../adapters/src/_core/pdeathsig.ts
|
|
194586
|
-
function pdeathsigAvailable(probe = defaultProbe) {
|
|
194587
|
-
if (cachedAvailable === void 0) cachedAvailable = probe();
|
|
194588
|
-
return cachedAvailable;
|
|
194589
|
-
}
|
|
194590
|
-
function defaultProbe() {
|
|
194591
|
-
if (os6.platform() !== "linux") return false;
|
|
194592
|
-
try {
|
|
194593
|
-
const help = (0, import_node_child_process13.execFileSync)("setpriv", ["--help"], { stdio: ["ignore", "pipe", "ignore"], timeout: 2e3 }).toString();
|
|
194594
|
-
return help.includes("--pdeathsig");
|
|
194595
|
-
} catch {
|
|
194596
|
-
return false;
|
|
194597
|
-
}
|
|
194598
|
-
}
|
|
194599
|
-
function pdeathsigWrap(bin, args) {
|
|
194600
|
-
return { bin: "setpriv", args: ["--pdeathsig", "SIGKILL", "--", bin, ...args] };
|
|
194601
|
-
}
|
|
194602
|
-
function shouldBindRuntimePdeathsig() {
|
|
194603
|
-
return process.env["OASIS_BIND_RUNTIME_PDEATHSIG"] === "1" && pdeathsigAvailable();
|
|
194604
|
-
}
|
|
194605
|
-
var import_node_child_process13, os6, cachedAvailable;
|
|
194606
|
-
var init_pdeathsig = __esm({
|
|
194607
|
-
"../adapters/src/_core/pdeathsig.ts"() {
|
|
194608
|
-
"use strict";
|
|
194609
|
-
import_node_child_process13 = require("node:child_process");
|
|
194610
|
-
os6 = __toESM(require("node:os"), 1);
|
|
194611
|
-
}
|
|
194612
|
-
});
|
|
194613
|
-
|
|
194614
194446
|
// ../adapters/src/_core/subprocess.ts
|
|
194615
194447
|
async function materialize(job, cfg) {
|
|
194616
194448
|
const slug6 = job.artifactId.replace(/[^a-zA-Z0-9_-]+/g, "_").slice(0, 32);
|
|
@@ -194716,12 +194548,11 @@ async function runStreamJson(job, cfg) {
|
|
|
194716
194548
|
...cfg.workRoot !== void 0 ? { workRoot: cfg.workRoot } : {},
|
|
194717
194549
|
...cfg.env !== void 0 ? { extraEnvEarly: cfg.env } : {}
|
|
194718
194550
|
});
|
|
194719
|
-
const
|
|
194720
|
-
const child = containerized ? (0, import_node_child_process14.spawn)(containerized.bin, containerized.args, {
|
|
194551
|
+
const child = containerized ? (0, import_node_child_process13.spawn)(containerized.bin, containerized.args, {
|
|
194721
194552
|
cwd: dir,
|
|
194722
194553
|
env: scrubLeakyEnv(process.env),
|
|
194723
194554
|
stdio: ["ignore", "pipe", "pipe"]
|
|
194724
|
-
}) : (0,
|
|
194555
|
+
}) : (0, import_node_child_process13.spawn)(cfg.bin, args, {
|
|
194725
194556
|
cwd: dir,
|
|
194726
194557
|
env: buildEnv(job, cfg),
|
|
194727
194558
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -194826,12 +194657,11 @@ async function runOneShotText(job, cfg) {
|
|
|
194826
194657
|
...cfg.workRoot !== void 0 ? { workRoot: cfg.workRoot } : {},
|
|
194827
194658
|
...cfg.env !== void 0 ? { extraEnvEarly: cfg.env } : {}
|
|
194828
194659
|
});
|
|
194829
|
-
const
|
|
194830
|
-
const child = containerized ? (0, import_node_child_process14.spawn)(containerized.bin, containerized.args, {
|
|
194660
|
+
const child = containerized ? (0, import_node_child_process13.spawn)(containerized.bin, containerized.args, {
|
|
194831
194661
|
cwd: dir,
|
|
194832
194662
|
env: scrubLeakyEnv(process.env),
|
|
194833
194663
|
stdio: ["ignore", "pipe", "pipe"]
|
|
194834
|
-
}) : (0,
|
|
194664
|
+
}) : (0, import_node_child_process13.spawn)(cfg.bin, args, {
|
|
194835
194665
|
cwd: dir,
|
|
194836
194666
|
env: buildEnv(job, cfg),
|
|
194837
194667
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -194910,11 +194740,11 @@ async function runOneShotText(job, cfg) {
|
|
|
194910
194740
|
}
|
|
194911
194741
|
});
|
|
194912
194742
|
}
|
|
194913
|
-
var
|
|
194743
|
+
var import_node_child_process13, import_node_crypto29, fs15, path17, readline4;
|
|
194914
194744
|
var init_subprocess = __esm({
|
|
194915
194745
|
"../adapters/src/_core/subprocess.ts"() {
|
|
194916
194746
|
"use strict";
|
|
194917
|
-
|
|
194747
|
+
import_node_child_process13 = require("node:child_process");
|
|
194918
194748
|
import_node_crypto29 = require("node:crypto");
|
|
194919
194749
|
fs15 = __toESM(require("node:fs"), 1);
|
|
194920
194750
|
path17 = __toESM(require("node:path"), 1);
|
|
@@ -194927,7 +194757,6 @@ var init_subprocess = __esm({
|
|
|
194927
194757
|
init_transcript();
|
|
194928
194758
|
init_filter_extra_args();
|
|
194929
194759
|
init_root_bypass();
|
|
194930
|
-
init_pdeathsig();
|
|
194931
194760
|
}
|
|
194932
194761
|
});
|
|
194933
194762
|
|
|
@@ -195554,7 +195383,7 @@ function truncateOutput(text5) {
|
|
|
195554
195383
|
return text5.length > CHAT_OUTPUT_LIMIT ? `${text5.slice(0, CHAT_OUTPUT_LIMIT)}
|
|
195555
195384
|
...[truncated]` : text5;
|
|
195556
195385
|
}
|
|
195557
|
-
function startStreamKeepalive(res, ms =
|
|
195386
|
+
function startStreamKeepalive(res, ms = 15e3) {
|
|
195558
195387
|
const timer = setInterval(() => {
|
|
195559
195388
|
if (res.destroyed || !res.writable) return;
|
|
195560
195389
|
try {
|
|
@@ -196545,8 +196374,8 @@ ${acceptanceCriteria.map((c) => `- ${c}`).join("\n")}`] : []
|
|
|
196545
196374
|
source: optStr(args, "source") ?? "human",
|
|
196546
196375
|
...optStr(args, "reason") !== void 0 ? { reason: optStr(args, "reason") } : {}
|
|
196547
196376
|
});
|
|
196548
|
-
const message = outcome.kind === "reviews-stopped" ? `\u8282\u70B9\u5DF2\u505C\u6B62\u8BC4\u5BA1\uFF08review.kill \xD7${outcome.reviewIds.length}\uFF09\uFF1A${artifactId}\u3002\u4EA4\u4ED8\u7248 ${outcome.workId} \u539F\u6837\u4FDD\u7559\uFF0Crelease \u540E\u53EF\u7EE7\u7EED\u6295\u7968\u3002` : outcome.kind === "nothing-to-stop" ? `\u5F53\u524D\u6CA1\u6709\
|
|
196549
|
-
return { message
|
|
196377
|
+
const message = outcome.kind === "reviews-stopped" ? `\u8282\u70B9\u5DF2\u505C\u6B62\u8BC4\u5BA1\uFF08review.kill \xD7${outcome.reviewIds.length}\uFF09\uFF1A${artifactId}\u3002\u4EA4\u4ED8\u7248 ${outcome.workId} \u539F\u6837\u4FDD\u7559\uFF0Crelease \u540E\u53EF\u7EE7\u7EED\u6295\u7968\u3002` : outcome.kind === "nothing-to-stop" ? `\u8282\u70B9\u5F53\u524D\u6CA1\u6709\u5728\u8DD1\u7684\u8FD0\u884C\u6216\u8BC4\u5BA1\uFF0C\u65E0\u9700\u505C\u6B62\uFF1A${artifactId}\uFF08\u4EA4\u4ED8\u7248 ${outcome.workId} \u672A\u53D7\u5F71\u54CD\uFF09\u3002` : `\u8282\u70B9\u5DF2\u505C\u6B62\u8FD0\u884C\uFF08work.kill\uFF09\uFF1A${artifactId}\u3002\u91CD\u8DD1\u7528 rerun / release\u3002`;
|
|
196378
|
+
return { message };
|
|
196550
196379
|
}
|
|
196551
196380
|
case "release": {
|
|
196552
196381
|
await kernel.release({
|
|
@@ -196554,7 +196383,7 @@ ${acceptanceCriteria.map((c) => `- ${c}`).join("\n")}`] : []
|
|
|
196554
196383
|
actor,
|
|
196555
196384
|
...optStr(args, "reason") !== void 0 ? { reason: optStr(args, "reason") } : {}
|
|
196556
196385
|
});
|
|
196557
|
-
return { message: `\
|
|
196386
|
+
return { message: `\u8282\u70B9\u5DF2\u89E3\u963B\uFF08release\uFF09\uFF1A${str(args, "artifactId")}\u2014\u2014\u6295\u5F71\u4E0B\u4E00\u62CD\u4F1A\u91CD\u63A8\u8BE5\u8282\u70B9\u5F53\u4E0B\u6B20\u7684\u6D3B\u3002` };
|
|
196558
196387
|
}
|
|
196559
196388
|
case "rerun": {
|
|
196560
196389
|
await kernel.rerunNode({ artifactId: str(args, "artifactId"), actor });
|
|
@@ -196938,14 +196767,10 @@ async function startOasisServer(opts) {
|
|
|
196938
196767
|
if (first !== void 0) terminalReviews.delete(first);
|
|
196939
196768
|
}
|
|
196940
196769
|
const waiters = reviewWaiters.get(draftId);
|
|
196941
|
-
const
|
|
196942
|
-
const hadWaiters = !!waiters && Array.from(waiters).some((w2) => now < w2.expiresAt);
|
|
196770
|
+
const hadWaiters = !!waiters && waiters.size > 0;
|
|
196943
196771
|
if (waiters) {
|
|
196944
196772
|
reviewWaiters.delete(draftId);
|
|
196945
|
-
for (const w2 of waiters)
|
|
196946
|
-
w2.cleanup();
|
|
196947
|
-
w2.onResolve(r);
|
|
196948
|
-
}
|
|
196773
|
+
for (const w2 of waiters) w2(r);
|
|
196949
196774
|
}
|
|
196950
196775
|
if (resume?.origin) {
|
|
196951
196776
|
const needsAgentDelivery = resume.kind === "command" && !hadWaiters;
|
|
@@ -198056,45 +197881,18 @@ async function startOasisServer(opts) {
|
|
|
198056
197881
|
set = /* @__PURE__ */ new Set();
|
|
198057
197882
|
reviewWaiters.set(draftId, set);
|
|
198058
197883
|
}
|
|
198059
|
-
|
|
198060
|
-
const waitMsRaw = url.searchParams.get("waitMs");
|
|
198061
|
-
const waitMsNum = waitMsRaw !== null ? Number(waitMsRaw) : Number.NaN;
|
|
198062
|
-
const declaredWaitMs = Number.isFinite(waitMsNum) && waitMsNum >= 0 ? waitMsNum : DEFAULT_WAITER_MAX_MS;
|
|
198063
|
-
const graceMsRaw = Number(process.env["OASIS_WAITER_GRACE_MS"] ?? 5e3);
|
|
198064
|
-
const graceMs = Number.isFinite(graceMsRaw) && graceMsRaw >= 0 ? graceMsRaw : 5e3;
|
|
198065
|
-
const nowMs = Date.now();
|
|
198066
|
-
const expiresAt2 = nowMs + declaredWaitMs;
|
|
198067
|
-
const lifetimeMs = declaredWaitMs + graceMs;
|
|
198068
|
-
let entry;
|
|
198069
|
-
const removeEntry = () => {
|
|
198070
|
-
const s2 = reviewWaiters.get(draftId);
|
|
198071
|
-
s2?.delete(entry);
|
|
198072
|
-
if (s2 && s2.size === 0) reviewWaiters.delete(draftId);
|
|
198073
|
-
};
|
|
198074
|
-
const dispose = () => {
|
|
198075
|
-
if (settled) return;
|
|
198076
|
-
settled = true;
|
|
198077
|
-
if (heartbeat) clearInterval(heartbeat);
|
|
198078
|
-
entry.cleanup();
|
|
198079
|
-
removeEntry();
|
|
198080
|
-
try {
|
|
198081
|
-
res.end();
|
|
198082
|
-
} catch {
|
|
198083
|
-
}
|
|
198084
|
-
};
|
|
198085
|
-
const expiryTimer = setTimeout(dispose, lifetimeMs);
|
|
198086
|
-
expiryTimer.unref?.();
|
|
198087
|
-
entry = {
|
|
198088
|
-
onResolve,
|
|
198089
|
-
expiresAt: expiresAt2,
|
|
198090
|
-
cleanup: () => clearTimeout(expiryTimer)
|
|
198091
|
-
};
|
|
198092
|
-
set.add(entry);
|
|
197884
|
+
set.add(onResolve);
|
|
198093
197885
|
heartbeat = setInterval(() => {
|
|
198094
197886
|
if (!settled) res.write(":hb\n\n");
|
|
198095
197887
|
}, 15e3);
|
|
198096
197888
|
heartbeat.unref?.();
|
|
198097
|
-
req.on("close",
|
|
197889
|
+
req.on("close", () => {
|
|
197890
|
+
settled = true;
|
|
197891
|
+
if (heartbeat) clearInterval(heartbeat);
|
|
197892
|
+
const s2 = reviewWaiters.get(draftId);
|
|
197893
|
+
s2?.delete(onResolve);
|
|
197894
|
+
if (s2 && s2.size === 0) reviewWaiters.delete(draftId);
|
|
197895
|
+
});
|
|
198098
197896
|
return;
|
|
198099
197897
|
}
|
|
198100
197898
|
if (url.pathname === "/api/inbox/discuss" && req.method === "POST" && opts.dispatchChat) {
|
|
@@ -198472,22 +198270,6 @@ async function startOasisServer(opts) {
|
|
|
198472
198270
|
return;
|
|
198473
198271
|
}
|
|
198474
198272
|
const fromSeq = Math.max(0, Number(url.searchParams.get("fromSeq") ?? "0") || 0);
|
|
198475
|
-
const reopenRecoveringTurn = async () => {
|
|
198476
|
-
if (!opts.chatTurns) return;
|
|
198477
|
-
const active = await opts.chatTurns.activeTurn(sid).catch(() => null);
|
|
198478
|
-
if (!active || active.status !== "running") return;
|
|
198479
|
-
liveChat.reopenForRecovery(sid, {
|
|
198480
|
-
runtimeSessionId: cs.runtimeSessionId ?? active.dispatchId ?? "",
|
|
198481
|
-
...active.assistantRunId ? { runId: active.assistantRunId } : {},
|
|
198482
|
-
onStop: () => {
|
|
198483
|
-
void opts.chatTurns?.settleTurn(active.id, {
|
|
198484
|
-
status: "cancelled",
|
|
198485
|
-
completedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
198486
|
-
lastError: `\u7528\u6237\u5728 serve \u91CD\u542F\u6062\u590D\u7A97\u53E3\u5185\u505C\u6B62\uFF08\u8F6E ${active.id}\uFF09`
|
|
198487
|
-
}).catch(() => void 0);
|
|
198488
|
-
}
|
|
198489
|
-
});
|
|
198490
|
-
};
|
|
198491
198273
|
const liveProtocol = url.searchParams.get("protocol") === "v2" || wantsLiveProtocol(req);
|
|
198492
198274
|
if (liveProtocol) {
|
|
198493
198275
|
const sub2 = (frame) => {
|
|
@@ -198496,11 +198278,7 @@ async function startOasisServer(opts) {
|
|
|
198496
198278
|
`);
|
|
198497
198279
|
if (frame.operation === "turn_completed" || frame.operation === "turn_failed") res.end();
|
|
198498
198280
|
};
|
|
198499
|
-
|
|
198500
|
-
if (!att2) {
|
|
198501
|
-
await reopenRecoveringTurn();
|
|
198502
|
-
att2 = liveChat.attachLive(sid, fromSeq, sub2);
|
|
198503
|
-
}
|
|
198281
|
+
const att2 = liveChat.attachLive(sid, fromSeq, sub2);
|
|
198504
198282
|
if (!att2) {
|
|
198505
198283
|
res.writeHead(204).end();
|
|
198506
198284
|
return;
|
|
@@ -198527,10 +198305,9 @@ async function startOasisServer(opts) {
|
|
|
198527
198305
|
res.end();
|
|
198528
198306
|
return;
|
|
198529
198307
|
}
|
|
198530
|
-
const attached2 = att2;
|
|
198531
198308
|
res.on("close", () => {
|
|
198532
198309
|
stopKa2();
|
|
198533
|
-
|
|
198310
|
+
att2.detach();
|
|
198534
198311
|
});
|
|
198535
198312
|
return;
|
|
198536
198313
|
}
|
|
@@ -198540,11 +198317,7 @@ async function startOasisServer(opts) {
|
|
|
198540
198317
|
`);
|
|
198541
198318
|
if (part.type === "done") res.end();
|
|
198542
198319
|
};
|
|
198543
|
-
|
|
198544
|
-
if (!att) {
|
|
198545
|
-
await reopenRecoveringTurn();
|
|
198546
|
-
att = liveChat.attach(sid, fromSeq, sub);
|
|
198547
|
-
}
|
|
198320
|
+
const att = liveChat.attach(sid, fromSeq, sub);
|
|
198548
198321
|
if (!att) {
|
|
198549
198322
|
res.writeHead(204).end();
|
|
198550
198323
|
return;
|
|
@@ -198570,10 +198343,9 @@ async function startOasisServer(opts) {
|
|
|
198570
198343
|
res.end();
|
|
198571
198344
|
return;
|
|
198572
198345
|
}
|
|
198573
|
-
const attached = att;
|
|
198574
198346
|
res.on("close", () => {
|
|
198575
198347
|
stopKa();
|
|
198576
|
-
|
|
198348
|
+
att.detach();
|
|
198577
198349
|
});
|
|
198578
198350
|
return;
|
|
198579
198351
|
}
|
|
@@ -198777,8 +198549,6 @@ async function startOasisServer(opts) {
|
|
|
198777
198549
|
role: "user",
|
|
198778
198550
|
content: persistedUserMessage,
|
|
198779
198551
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
198780
|
-
...heldTurn ? { turnId: heldTurn.id } : {},
|
|
198781
|
-
// ADR 0300 D1:这条 user 消息属于哪一轮
|
|
198782
198552
|
...persistAttachments.length ? { attachments: persistAttachments } : {}
|
|
198783
198553
|
}).catch(() => void 0);
|
|
198784
198554
|
}
|
|
@@ -198793,9 +198563,7 @@ async function startOasisServer(opts) {
|
|
|
198793
198563
|
content: "",
|
|
198794
198564
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
198795
198565
|
status: "running",
|
|
198796
|
-
...session.runId ? { runId: session.runId } : {}
|
|
198797
|
-
...heldTurn ? { turnId: heldTurn.id } : {}
|
|
198798
|
-
// ADR 0300 D1:回合稳定身份,跨 resume 恒定
|
|
198566
|
+
...session.runId ? { runId: session.runId } : {}
|
|
198799
198567
|
}).then(() => {
|
|
198800
198568
|
assistantMsgId = id;
|
|
198801
198569
|
}).catch(() => void 0);
|
|
@@ -198912,9 +198680,7 @@ async function startOasisServer(opts) {
|
|
|
198912
198680
|
createdAt: at,
|
|
198913
198681
|
// ADR-0166 D9.1:插入带的附件也落在**这条 user 行**上——否则重载后这条气泡
|
|
198914
198682
|
// 只剩一行字,而同样带图直接发送的那条有缩略图。同 `/api/chat` 那侧只存引用。
|
|
198915
|
-
...insertedAttachments?.length ? { attachments: insertedAttachments } : {}
|
|
198916
|
-
...heldTurn ? { turnId: heldTurn.id } : {}
|
|
198917
|
-
// 插话切段仍属同一轮(同 turnId)
|
|
198683
|
+
...insertedAttachments?.length ? { attachments: insertedAttachments } : {}
|
|
198918
198684
|
}).catch(() => void 0);
|
|
198919
198685
|
await store.appendMessage({
|
|
198920
198686
|
id: nextId,
|
|
@@ -198923,8 +198689,7 @@ async function startOasisServer(opts) {
|
|
|
198923
198689
|
content: "",
|
|
198924
198690
|
createdAt: at,
|
|
198925
198691
|
status: "running",
|
|
198926
|
-
...session.runId ? { runId: session.runId } : {}
|
|
198927
|
-
...heldTurn ? { turnId: heldTurn.id } : {}
|
|
198692
|
+
...session.runId ? { runId: session.runId } : {}
|
|
198928
198693
|
}).catch(() => void 0);
|
|
198929
198694
|
}).catch(() => void 0);
|
|
198930
198695
|
});
|
|
@@ -198972,21 +198737,10 @@ async function startOasisServer(opts) {
|
|
|
198972
198737
|
if (live) detachViewer = liveProtocol ? live.subscribeLive(writeLiveToRes) : live.subscribe(writeToRes);
|
|
198973
198738
|
let sawTextOutput = false;
|
|
198974
198739
|
let liveStreamId = `oasis-live:${body2.chatSessionId ?? session.id}`;
|
|
198975
|
-
let liveTurnId =
|
|
198740
|
+
let liveTurnId = `oasis-turn:${session.id}`;
|
|
198976
198741
|
let liveTerminalEmitted = false;
|
|
198977
198742
|
const hasLiveProtocol = session.supportsLiveProtocol === true;
|
|
198978
198743
|
let fallbackLiveStarted = false;
|
|
198979
|
-
if (liveProtocol && live && !hasLiveProtocol) {
|
|
198980
|
-
live.emitLive({
|
|
198981
|
-
protocolVersion: 2,
|
|
198982
|
-
streamId: liveStreamId,
|
|
198983
|
-
turnId: liveTurnId,
|
|
198984
|
-
itemId: `${liveTurnId}:control`,
|
|
198985
|
-
itemType: "control",
|
|
198986
|
-
operation: "turn_started",
|
|
198987
|
-
payload: { sessionId: session.id, ...heldTurn ? { turnId: heldTurn.id } : {} }
|
|
198988
|
-
});
|
|
198989
|
-
}
|
|
198990
198744
|
session.onOutput((chunk) => {
|
|
198991
198745
|
sawTextOutput = true;
|
|
198992
198746
|
if (!liveProtocol && !hasLiveProtocol) {
|
|
@@ -200053,7 +199807,6 @@ var init_server3 = __esm({
|
|
|
200053
199807
|
init_chat_system_message();
|
|
200054
199808
|
init_src();
|
|
200055
199809
|
init_src();
|
|
200056
|
-
init_src();
|
|
200057
199810
|
init_build_info();
|
|
200058
199811
|
init_command_policy();
|
|
200059
199812
|
init_service();
|
|
@@ -200995,8 +200748,6 @@ var init_memory_trace_store = __esm({
|
|
|
200995
200748
|
effectiveModel: null,
|
|
200996
200749
|
modelSource: null,
|
|
200997
200750
|
transcriptRef: null,
|
|
200998
|
-
oasisGitSha: input.oasisGitSha ?? null,
|
|
200999
|
-
actorConfigVersion: input.actorConfigVersion ?? null,
|
|
201000
200751
|
metadata: input.metadata ?? {},
|
|
201001
200752
|
createdAt: startedAt,
|
|
201002
200753
|
updatedAt: startedAt
|
|
@@ -205587,7 +205338,6 @@ async function sweepOrphanRuns(deps) {
|
|
|
205587
205338
|
const inFlight = await deps.inFlightRunIds();
|
|
205588
205339
|
const aliveArtifacts = await deps.aliveArtifactIds?.() ?? /* @__PURE__ */ new Set();
|
|
205589
205340
|
const apiActive = await deps.apiActiveDispatchIds?.() ?? /* @__PURE__ */ new Set();
|
|
205590
|
-
const liveSessions = await deps.liveSessionRunIds?.() ?? /* @__PURE__ */ new Set();
|
|
205591
205341
|
const orphaned = [];
|
|
205592
205342
|
const cappedOut = [];
|
|
205593
205343
|
const rescued = [];
|
|
@@ -205613,7 +205363,7 @@ async function sweepOrphanRuns(deps) {
|
|
|
205613
205363
|
}
|
|
205614
205364
|
continue;
|
|
205615
205365
|
}
|
|
205616
|
-
const claimed = inFlight.has(run.id) || run.artifactId !== null && aliveArtifacts.has(run.artifactId) || apiActive.has(run.id)
|
|
205366
|
+
const claimed = inFlight.has(run.id) || run.artifactId !== null && aliveArtifacts.has(run.artifactId) || apiActive.has(run.id);
|
|
205617
205367
|
if (!inFlight.has(run.id) && !(run.artifactId !== null && aliveArtifacts.has(run.artifactId)) && apiActive.has(run.id) && ageMs > deps.orphanGraceMs) {
|
|
205618
205368
|
rescued.push(run.id);
|
|
205619
205369
|
deps.log?.(
|
|
@@ -205650,7 +205400,7 @@ async function sweepDroppedDispatches(deps) {
|
|
|
205650
205400
|
const result = {
|
|
205651
205401
|
scanned: 0,
|
|
205652
205402
|
redispatched: [],
|
|
205653
|
-
skipped: { inFlight: 0, ledgerOpen: 0, backoff: 0, notAgent: 0,
|
|
205403
|
+
skipped: { inFlight: 0, ledgerOpen: 0, backoff: 0, notAgent: 0, failed: 0 }
|
|
205654
205404
|
};
|
|
205655
205405
|
const createdBefore = new Date(deps.now - deps.graceMs).toISOString();
|
|
205656
205406
|
const candidates = await deps.listNeverStarted(createdBefore, CANDIDATE_LIMIT);
|
|
@@ -205683,10 +205433,6 @@ async function sweepDroppedDispatches(deps) {
|
|
|
205683
205433
|
continue;
|
|
205684
205434
|
}
|
|
205685
205435
|
try {
|
|
205686
|
-
if (deps.beforeRedispatch && !await deps.beforeRedispatch(c)) {
|
|
205687
|
-
result.skipped.blocked++;
|
|
205688
|
-
continue;
|
|
205689
|
-
}
|
|
205690
205436
|
await deps.redispatch(c.workId, c.workorderId);
|
|
205691
205437
|
result.redispatched.push(c.workId);
|
|
205692
205438
|
} catch {
|
|
@@ -205740,35 +205486,6 @@ var init_dispatch_mapping_rebuild = __esm({
|
|
|
205740
205486
|
}
|
|
205741
205487
|
});
|
|
205742
205488
|
|
|
205743
|
-
// ../server/src/dispatch-binding-diagnosis.ts
|
|
205744
|
-
async function prepareDroppedDispatch(work, deps) {
|
|
205745
|
-
const { kernel } = deps;
|
|
205746
|
-
await kernel.refreshModel?.();
|
|
205747
|
-
const node2 = kernel.model.artifacts.get(work.nodeId);
|
|
205748
|
-
const snap = await kernel.getStore().transaction((tx) => tx.loadWorkorder(work.workorderId));
|
|
205749
|
-
const current = snap?.works.find((w2) => w2.id === work.workId);
|
|
205750
|
-
if (!snap || !current || current.status !== "running" || current.startedAt || current.sessionRef || current.endedAt || !snap.nodes.some((n) => n.id === work.nodeId && n.latestWorkId === current.id && !n.cancelledAt) || !node2 || node2.workspace !== work.workorderId || lifecycleOf(kernel.model, node2.id) !== "active" || kernel.model.pausedWorkorders.has(work.workorderId) || isHeld(kernel.model, node2.id)) return false;
|
|
205751
|
-
if (snap.issues.some((i) => i.kind === "escalation" && i.aboutNodeId === node2.id && !i.resolvedAt && i.intent !== "advisory")) return false;
|
|
205752
|
-
if (!work.assigneeActorId) return false;
|
|
205753
|
-
const binding = await deps.bindingFor(work.assigneeActorId);
|
|
205754
|
-
if (!binding?.nodeId) return true;
|
|
205755
|
-
const runtimeNode = await deps.nodeFor(binding.nodeId);
|
|
205756
|
-
if (runtimeNode && runtimeNode.status !== "deleted") return true;
|
|
205757
|
-
await kernel.escalate({
|
|
205758
|
-
artifactId: node2.id,
|
|
205759
|
-
actor: SYSTEM_ACTOR,
|
|
205760
|
-
source: "dispatch:missing-node",
|
|
205761
|
-
reason: `\u8FD9\u4E00\u6B65\u8FD8\u6CA1\u6709\u542F\u52A8\uFF1A\u6267\u884C\u4EBA\u7684\u8FD0\u884C\u65F6\u7ED1\u5B9A\u6307\u5411${runtimeNode ? "\u5DF2\u5220\u9664" : "\u672A\u6CE8\u518C"}\u7684\u8282\u70B9 ${binding.nodeId}\u3002\u8BF7\u6062\u590D\u8BE5\u8282\u70B9\uFF0C\u6216\u4E3A\u6267\u884C\u4EBA ${work.assigneeActorId} \u9009\u62E9\u5DF2\u6709\u4E14\u914D\u7F6E\u6B63\u786E\u7684\u8282\u70B9\uFF1B\u4FEE\u590D\u540E\u5173\u95ED\u8FD9\u6761\u4E0A\u62A5\uFF0C\u6D41\u7A0B\u624D\u4F1A\u7EE7\u7EED\u3002\u672C\u6B21\u68C0\u67E5\u6CA1\u6709\u7EC8\u6B62\u4F1A\u8BDD\uFF0C\u4E5F\u6CA1\u6709\u6D88\u8017 work \u91CD\u8BD5\u6B21\u6570\u3002`
|
|
205762
|
-
});
|
|
205763
|
-
return false;
|
|
205764
|
-
}
|
|
205765
|
-
var init_dispatch_binding_diagnosis = __esm({
|
|
205766
|
-
"../server/src/dispatch-binding-diagnosis.ts"() {
|
|
205767
|
-
"use strict";
|
|
205768
|
-
init_src5();
|
|
205769
|
-
}
|
|
205770
|
-
});
|
|
205771
|
-
|
|
205772
205489
|
// ../server/src/zero-output-breaker.ts
|
|
205773
205490
|
function absorb(b2, r, startedMs) {
|
|
205774
205491
|
b2.count += 1;
|
|
@@ -206293,14 +206010,14 @@ function classifyDeployRun(facts) {
|
|
|
206293
206010
|
if (facts.anyContainingInProgress) return { kind: "running", note: "\u627F\u8F7D\u672C\u6B21\u4EA4\u4ED8\u7684\u90E8\u7F72 run \u4ECD\u5728\u8FDB\u884C" };
|
|
206294
206011
|
return { kind: "pending", note: "\u8FD8\u6CA1\u770B\u5230\u627F\u8F7D\u672C\u6B21\u4EA4\u4ED8\u7684\u90E8\u7F72 run" };
|
|
206295
206012
|
}
|
|
206296
|
-
var
|
|
206013
|
+
var import_node_child_process14, import_node_util5, execFile5, GhDeployProvider;
|
|
206297
206014
|
var init_deploy_provider = __esm({
|
|
206298
206015
|
"../server/src/git/deploy-provider.ts"() {
|
|
206299
206016
|
"use strict";
|
|
206300
|
-
|
|
206017
|
+
import_node_child_process14 = require("node:child_process");
|
|
206301
206018
|
import_node_util5 = require("node:util");
|
|
206302
206019
|
init_remote_util();
|
|
206303
|
-
execFile5 = (0, import_node_util5.promisify)(
|
|
206020
|
+
execFile5 = (0, import_node_util5.promisify)(import_node_child_process14.execFile);
|
|
206304
206021
|
GhDeployProvider = class {
|
|
206305
206022
|
constructor(opts = {}) {
|
|
206306
206023
|
this.opts = opts;
|
|
@@ -206536,14 +206253,14 @@ function makeDefaultBranchResolver(opts) {
|
|
|
206536
206253
|
}
|
|
206537
206254
|
};
|
|
206538
206255
|
}
|
|
206539
|
-
var
|
|
206256
|
+
var import_node_child_process15, import_node_util6, execFile6;
|
|
206540
206257
|
var init_default_branch = __esm({
|
|
206541
206258
|
"../server/src/git/default-branch.ts"() {
|
|
206542
206259
|
"use strict";
|
|
206543
|
-
|
|
206260
|
+
import_node_child_process15 = require("node:child_process");
|
|
206544
206261
|
import_node_util6 = require("node:util");
|
|
206545
206262
|
init_remote_util();
|
|
206546
|
-
execFile6 = (0, import_node_util6.promisify)(
|
|
206263
|
+
execFile6 = (0, import_node_util6.promisify)(import_node_child_process15.execFile);
|
|
206547
206264
|
}
|
|
206548
206265
|
});
|
|
206549
206266
|
|
|
@@ -206811,8 +206528,6 @@ var init_sink = __esm({
|
|
|
206811
206528
|
checkpointIntervalMs;
|
|
206812
206529
|
now;
|
|
206813
206530
|
health;
|
|
206814
|
-
buildSha;
|
|
206815
|
-
resolveActorConfigVersion;
|
|
206816
206531
|
sessions = /* @__PURE__ */ new Map();
|
|
206817
206532
|
constructor(opts) {
|
|
206818
206533
|
this.store = opts.store;
|
|
@@ -206826,33 +206541,6 @@ var init_sink = __esm({
|
|
|
206826
206541
|
throw new Error("checkpointIntervalMs must be positive");
|
|
206827
206542
|
}
|
|
206828
206543
|
this.health = opts.health;
|
|
206829
|
-
if (opts.buildSha) this.buildSha = opts.buildSha;
|
|
206830
|
-
if (opts.resolveActorConfigVersion) this.resolveActorConfigVersion = opts.resolveActorConfigVersion;
|
|
206831
|
-
}
|
|
206832
|
-
/**
|
|
206833
|
-
* 归因两列的取值(`oasis_git_sha` / `actor_config_version`)。
|
|
206834
|
-
* 未注入 → 两项都不写(落 null);解析抛错 → 该项记 null 并走 onError,**绝不冒泡**:
|
|
206835
|
-
* 建 run 失败会让整条会话的观测流熄火,而归因只是锦上添花。
|
|
206836
|
-
*/
|
|
206837
|
-
async attribution(actorId) {
|
|
206838
|
-
const out = {};
|
|
206839
|
-
if (this.buildSha) {
|
|
206840
|
-
try {
|
|
206841
|
-
out.oasisGitSha = this.buildSha() ?? null;
|
|
206842
|
-
} catch (e) {
|
|
206843
|
-
out.oasisGitSha = null;
|
|
206844
|
-
this.onError(e);
|
|
206845
|
-
}
|
|
206846
|
-
}
|
|
206847
|
-
if (this.resolveActorConfigVersion) {
|
|
206848
|
-
try {
|
|
206849
|
-
out.actorConfigVersion = await this.resolveActorConfigVersion(actorId) ?? null;
|
|
206850
|
-
} catch (e) {
|
|
206851
|
-
out.actorConfigVersion = null;
|
|
206852
|
-
this.onError(e);
|
|
206853
|
-
}
|
|
206854
|
-
}
|
|
206855
|
-
return out;
|
|
206856
206544
|
}
|
|
206857
206545
|
/** 为一个 run 造事件通道 appender(seq 两道防线 + 健康度上报都收在这里)。 */
|
|
206858
206546
|
makeAppender(runId) {
|
|
@@ -207061,11 +206749,9 @@ var init_sink = __esm({
|
|
|
207061
206749
|
this.sessions.set(session.runId, st);
|
|
207062
206750
|
this.scheduleCheckpointTimer(st);
|
|
207063
206751
|
st.chain = st.chain.then(async () => {
|
|
207064
|
-
const attribution = await this.attribution(session.actor);
|
|
207065
206752
|
await this.store.createRun({
|
|
207066
206753
|
id: session.runId,
|
|
207067
206754
|
actorId: session.actor,
|
|
207068
|
-
...attribution,
|
|
207069
206755
|
runtimeKind: this.runtimeKindFor(session),
|
|
207070
206756
|
...session.runtimeInstanceId ? { runtimeInstanceId: session.runtimeInstanceId } : {},
|
|
207071
206757
|
triggerKind: "dispatch",
|
|
@@ -207128,11 +206814,9 @@ var init_sink = __esm({
|
|
|
207128
206814
|
st.chain = st.chain.then(async () => {
|
|
207129
206815
|
const existing = await this.store.getRun(session.runId);
|
|
207130
206816
|
if (!existing) {
|
|
207131
|
-
const attribution = await this.attribution(session.actor);
|
|
207132
206817
|
await this.store.createRun({
|
|
207133
206818
|
id: session.runId,
|
|
207134
206819
|
actorId: session.actor,
|
|
207135
|
-
...attribution,
|
|
207136
206820
|
runtimeKind: this.runtimeKindFor(session),
|
|
207137
206821
|
...session.runtimeInstanceId ? { runtimeInstanceId: session.runtimeInstanceId } : {},
|
|
207138
206822
|
triggerKind: "dispatch",
|
|
@@ -207912,7 +207596,6 @@ var init_daemon_hub = __esm({
|
|
|
207912
207596
|
"../server/src/daemon-hub.ts"() {
|
|
207913
207597
|
"use strict";
|
|
207914
207598
|
init_wrapper();
|
|
207915
|
-
init_src();
|
|
207916
207599
|
init_handshake_throttle();
|
|
207917
207600
|
DaemonHub = class _DaemonHub {
|
|
207918
207601
|
daemons = /* @__PURE__ */ new Map();
|
|
@@ -207927,14 +207610,6 @@ var init_daemon_hub = __esm({
|
|
|
207927
207610
|
sessionMeta = /* @__PURE__ */ new Map();
|
|
207928
207611
|
sessionConnectListeners = [];
|
|
207929
207612
|
sessionDisconnectListeners = [];
|
|
207930
|
-
// ── ADR 0300 D2「日志复制」:帧号 + 累积 ackSeq + 幂等摄入 ────────────────────────────
|
|
207931
|
-
// 只对自报 supportsFrameSeq 的会话生效;老会话这三张表始终为空、逐字走原 outbox 语义。
|
|
207932
|
-
/** 自报支持帧号的 dispatchId。 */
|
|
207933
|
-
frameSeqSupported = /* @__PURE__ */ new Set();
|
|
207934
|
-
/** 每 dispatch 已按序摄入的最高节点帧号(累积水位)。跨重连保留、`session_exited` 后延迟清。 */
|
|
207935
|
-
frameWatermark = /* @__PURE__ */ new Map();
|
|
207936
|
-
/** 每 dispatch 上次回 ackSeq 的时刻——把流式期间的回执节流到 ~250ms 一次。 */
|
|
207937
|
-
lastAckSeqAt = /* @__PURE__ */ new Map();
|
|
207938
207613
|
/**
|
|
207939
207614
|
* 「这次派发归谁管、现在什么状态」的认领口。**必须由 hub 汇总,不能各 adapter 自己判**——
|
|
207940
207615
|
* serve 里同时有两个 DaemonHubAdapter(chat 一个、dispatch 一个),一次派发只属于其中一个。
|
|
@@ -207999,7 +207674,7 @@ var init_daemon_hub = __esm({
|
|
|
207999
207674
|
this.resolveNode = resolveNode;
|
|
208000
207675
|
this.getNodeStatus = opts.getNodeStatus;
|
|
208001
207676
|
this.resolveDataplane = opts.resolveDataplane;
|
|
208002
|
-
this.coldStartGraceMs = opts.coldStartGraceMs ??
|
|
207677
|
+
this.coldStartGraceMs = opts.coldStartGraceMs ?? 9e4;
|
|
208003
207678
|
this.onHandshakeRejected = opts.onHandshakeRejected;
|
|
208004
207679
|
this.throttle = new HandshakeThrottle(opts.throttle);
|
|
208005
207680
|
this.wss = new import_websocket_server.default({
|
|
@@ -208169,33 +207844,12 @@ var init_daemon_hub = __esm({
|
|
|
208169
207844
|
for (const l of this.sessionConnectListeners) l({ dispatchId, sessionId: msg.sessionId, nodeId });
|
|
208170
207845
|
void this.judgeSession(dispatchId, ws);
|
|
208171
207846
|
}
|
|
208172
|
-
if (msg.supportsFrameSeq) {
|
|
208173
|
-
this.frameSeqSupported.add(dispatchId);
|
|
208174
|
-
this.sendAckSeq(ws, dispatchId, true);
|
|
208175
|
-
}
|
|
208176
207847
|
return;
|
|
208177
207848
|
}
|
|
208178
207849
|
if (!registered) {
|
|
208179
207850
|
ws.close(1008, "session_hello required first");
|
|
208180
207851
|
return;
|
|
208181
207852
|
}
|
|
208182
|
-
if (this.frameSeqSupported.has(dispatchId)) {
|
|
208183
|
-
const seq = typeof msg.seq === "number" ? msg.seq : void 0;
|
|
208184
|
-
if (seq !== void 0) {
|
|
208185
|
-
const wm = this.frameWatermark.get(dispatchId) ?? 0;
|
|
208186
|
-
if (seq <= wm) {
|
|
208187
|
-
this.sendAckSeq(ws, dispatchId, false);
|
|
208188
|
-
return;
|
|
208189
|
-
}
|
|
208190
|
-
this.frameWatermark.set(dispatchId, seq);
|
|
208191
|
-
}
|
|
208192
|
-
for (const listener of this.messageListeners) listener(nodeId, msg);
|
|
208193
|
-
this.onMessage?.(nodeId, msg);
|
|
208194
|
-
const isExit = msg.type === "session_exited";
|
|
208195
|
-
this.sendAckSeq(ws, dispatchId, isExit);
|
|
208196
|
-
if (isExit) this.scheduleFrameStateCleanup(dispatchId);
|
|
208197
|
-
return;
|
|
208198
|
-
}
|
|
208199
207853
|
for (const listener of this.messageListeners) listener(nodeId, msg);
|
|
208200
207854
|
this.onMessage?.(nodeId, msg);
|
|
208201
207855
|
if (msg.type === "session_exited" && ws.readyState === import_websocket.default.OPEN) {
|
|
@@ -208211,23 +207865,6 @@ var init_daemon_hub = __esm({
|
|
|
208211
207865
|
});
|
|
208212
207866
|
ws.on("error", (err) => console.error(`[hub] session ${dispatchId} error:`, err.message));
|
|
208213
207867
|
}
|
|
208214
|
-
/** ADR 0300 D2:回带当前摄入水位的累积回执。流式期间节流到 ~250ms 一次,hello / 收尾帧立即回。 */
|
|
208215
|
-
sendAckSeq(ws, dispatchId, force) {
|
|
208216
|
-
if (ws.readyState !== import_websocket.default.OPEN) return;
|
|
208217
|
-
const now = Date.now();
|
|
208218
|
-
if (!force && now - (this.lastAckSeqAt.get(dispatchId) ?? 0) < 250) return;
|
|
208219
|
-
this.lastAckSeqAt.set(dispatchId, now);
|
|
208220
|
-
ws.send(JSON.stringify({ type: "ack", dispatchId, ackSeq: this.frameWatermark.get(dispatchId) ?? 0 }));
|
|
208221
|
-
}
|
|
208222
|
-
/** `session_exited` 后延迟清帧号状态:给重连重放的收尾帧留一个去重窗口,之后回收避免无界增长。 */
|
|
208223
|
-
scheduleFrameStateCleanup(dispatchId) {
|
|
208224
|
-
const t = setTimeout(() => {
|
|
208225
|
-
this.frameSeqSupported.delete(dispatchId);
|
|
208226
|
-
this.frameWatermark.delete(dispatchId);
|
|
208227
|
-
this.lastAckSeqAt.delete(dispatchId);
|
|
208228
|
-
}, 6e4);
|
|
208229
|
-
t.unref?.();
|
|
208230
|
-
}
|
|
208231
207868
|
/**
|
|
208232
207869
|
* 注册一个认领判断。返回:
|
|
208233
207870
|
* live —— 这次派发在我这儿还活着(别动它)
|
|
@@ -208340,22 +207977,6 @@ var init_daemon_hub = __esm({
|
|
|
208340
207977
|
hasSession(dispatchId) {
|
|
208341
207978
|
return this.sessionSockets.get(dispatchId)?.readyState === import_websocket.default.OPEN;
|
|
208342
207979
|
}
|
|
208343
|
-
/**
|
|
208344
|
-
* 当前持有**活着数据面连接**的全部 dispatchId(ADR-0300 D8:hub 有活连接即认领)。
|
|
208345
|
-
*
|
|
208346
|
-
* orphan-sweep 的认领来源此前只有 dispatcher 在途表、chat 在途表、节点 hello、HTTP 活性——
|
|
208347
|
-
* 独立会话进程(协调者、D2′ 后搬出 daemon 的会话)**不在这四者里**,但它们自己握着一根到 hub 的
|
|
208348
|
-
* 数据面 WS。这些会话 `run.id === dispatchId`(协调者:`job.dispatchId = coordinate:*`),
|
|
208349
|
-
* 于是「hub 此刻还连着它」就是最直接的判活。不接这条线,7 天里 183 条协调者会话被误判孤儿闭合
|
|
208350
|
-
* (ADR-0300 证据 E)。只增不减:命中只能**阻止**误闭合,永不会导致误闭合。
|
|
208351
|
-
*/
|
|
208352
|
-
liveSessionDispatchIds() {
|
|
208353
|
-
const ids2 = /* @__PURE__ */ new Set();
|
|
208354
|
-
for (const [dispatchId, ws] of this.sessionSockets) {
|
|
208355
|
-
if (ws.readyState === import_websocket.default.OPEN) ids2.add(dispatchId);
|
|
208356
|
-
}
|
|
208357
|
-
return ids2;
|
|
208358
|
-
}
|
|
208359
207980
|
/** 往会话进程直投一帧(kill / append_input / ping)。返回是否写进了 OPEN 的 socket。 */
|
|
208360
207981
|
sendToSession(dispatchId, msg) {
|
|
208361
207982
|
const ws = this.sessionSockets.get(dispatchId);
|
|
@@ -215194,7 +214815,6 @@ function buildInbox(model, me, leadOf, resolveActor, markers = [], slaMs, nowIso
|
|
|
215194
214815
|
if (!isOwnerRecipient && !isLeadRecipient) continue;
|
|
215195
214816
|
const gaps = unresolvedGapsOf(model, a.id);
|
|
215196
214817
|
const escalations = unresolvedEscalationsOf(model, a.id);
|
|
215197
|
-
const representedEscalations = /* @__PURE__ */ new Set();
|
|
215198
214818
|
const who = isOwnerRecipient ? "\uFF08\u4F60\u662F\u5DE5\u5355\u5F52\u5C5E\u4EBA\uFF09" : "\uFF08\u4F60\u662F\u5361\u4F4F\u8282\u70B9 owner \u7684\u4E0A\u7EA7\uFF09";
|
|
215199
214819
|
for (const gap of gaps) {
|
|
215200
214820
|
const byGapId = escalations.filter((entry) => entry.gapId === gap.gapId);
|
|
@@ -215208,7 +214828,6 @@ function buildInbox(model, me, leadOf, resolveActor, markers = [], slaMs, nowIso
|
|
|
215208
214828
|
const exactEscalation = byGapId.at(-1) ?? (samePartGaps.length === 1 ? samePartEscalations.at(-1) : void 0) ?? (gaps.length === 1 ? partlessEscalations.at(-1) : void 0);
|
|
215209
214829
|
const gapSince = exactEscalation?.at ?? gap.lastReportedAt ?? model.lastOpAt.get(a.id) ?? "";
|
|
215210
214830
|
const gapReportCount = gap.reportCount ?? 1;
|
|
215211
|
-
if (exactEscalation) representedEscalations.add(exactEscalation.escalationId);
|
|
215212
214831
|
gapItems.push({
|
|
215213
214832
|
kind: "gap-escalation",
|
|
215214
214833
|
artifactId: a.id,
|
|
@@ -215237,8 +214856,8 @@ function buildInbox(model, me, leadOf, resolveActor, markers = [], slaMs, nowIso
|
|
|
215237
214856
|
}
|
|
215238
214857
|
});
|
|
215239
214858
|
}
|
|
215240
|
-
if (escalations.length > 0) {
|
|
215241
|
-
for (const e of escalations
|
|
214859
|
+
if (gaps.length === 0 && escalations.length > 0) {
|
|
214860
|
+
for (const e of escalations) {
|
|
215242
214861
|
gapItems.push({
|
|
215243
214862
|
kind: "gap-escalation",
|
|
215244
214863
|
artifactId: a.id,
|
|
@@ -215489,152 +215108,6 @@ var init_inbox = __esm({
|
|
|
215489
215108
|
}
|
|
215490
215109
|
});
|
|
215491
215110
|
|
|
215492
|
-
// ../server/src/domains/collab/escalation-attention.ts
|
|
215493
|
-
function escalationDeliveryConfig(env) {
|
|
215494
|
-
const positive = (key, fallback) => {
|
|
215495
|
-
if (!env[key]) return fallback;
|
|
215496
|
-
const n = Number(env[key]);
|
|
215497
|
-
if (!Number.isFinite(n) || n <= 0) throw new Error(`${key} must be a positive number`);
|
|
215498
|
-
return n;
|
|
215499
|
-
};
|
|
215500
|
-
const policy = {
|
|
215501
|
-
reminderMs: positive("OASIS_ESCALATION_REMINDER_MS", DEFAULT_ESCALATION_REMINDERS.reminderMs),
|
|
215502
|
-
acknowledgedReminderMs: positive("OASIS_ESCALATION_ACK_REMINDER_MS", DEFAULT_ESCALATION_REMINDERS.acknowledgedReminderMs)
|
|
215503
|
-
};
|
|
215504
|
-
const webhooks = /* @__PURE__ */ new Map();
|
|
215505
|
-
if (env.OASIS_ESCALATION_WEBHOOKS) {
|
|
215506
|
-
try {
|
|
215507
|
-
const entries = JSON.parse(env.OASIS_ESCALATION_WEBHOOKS);
|
|
215508
|
-
if (!entries || Array.isArray(entries) || typeof entries !== "object") throw new Error();
|
|
215509
|
-
for (const [companyId, endpoint] of Object.entries(entries)) {
|
|
215510
|
-
const url = new URL(endpoint.url);
|
|
215511
|
-
if (!companyId || !["https:", "http:"].includes(url.protocol) || url.username || url.password || endpoint.token !== void 0 && typeof endpoint.token !== "string") throw new Error();
|
|
215512
|
-
webhooks.set(companyId, endpoint);
|
|
215513
|
-
}
|
|
215514
|
-
} catch {
|
|
215515
|
-
throw new Error("OASIS_ESCALATION_WEBHOOKS must map company IDs to { url, token? } endpoints");
|
|
215516
|
-
}
|
|
215517
|
-
}
|
|
215518
|
-
return { policy, webhooks };
|
|
215519
|
-
}
|
|
215520
|
-
function withEscalationAttention(items, companyId, markers, now, policy = DEFAULT_ESCALATION_REMINDERS) {
|
|
215521
|
-
const byScope = new Map(markers.map((m2) => [m2.scope, m2.readAt]));
|
|
215522
|
-
return items.map((item) => {
|
|
215523
|
-
if (item.kind !== "gap-escalation" || !item.escalationId) return item;
|
|
215524
|
-
const start = Date.parse(item.since);
|
|
215525
|
-
if (!Number.isFinite(start)) return item;
|
|
215526
|
-
const ackAt = byScope.get(escalationAttentionScope(companyId, item.escalationId, "ack"));
|
|
215527
|
-
const ack = ackAt ? Date.parse(ackAt) : NaN;
|
|
215528
|
-
const acknowledged = Number.isFinite(ack) && ack >= start;
|
|
215529
|
-
const firstDue = acknowledged ? ack + policy.acknowledgedReminderMs : start;
|
|
215530
|
-
const due = now >= firstDue;
|
|
215531
|
-
const step = Math.max(0, Math.floor((now - firstDue) / policy.reminderMs));
|
|
215532
|
-
const dueAt = new Date(firstDue + step * policy.reminderMs).toISOString();
|
|
215533
|
-
const deliveredAt = byScope.get(escalationAttentionScope(companyId, item.escalationId, "webhook"));
|
|
215534
|
-
return { ...item, attention: {
|
|
215535
|
-
reminderKey: `${item.escalationId}:${dueAt}`,
|
|
215536
|
-
dueAt,
|
|
215537
|
-
needsAcknowledgement: due,
|
|
215538
|
-
...acknowledged ? { acknowledgedAt: ackAt } : {},
|
|
215539
|
-
...deliveredAt ? { deliveredAt } : {}
|
|
215540
|
-
} };
|
|
215541
|
-
});
|
|
215542
|
-
}
|
|
215543
|
-
async function sendEscalationWebhook(url, token, batch, item, deliveryId) {
|
|
215544
|
-
const response = await fetch(url, {
|
|
215545
|
-
method: "POST",
|
|
215546
|
-
redirect: "error",
|
|
215547
|
-
signal: AbortSignal.timeout(1e4),
|
|
215548
|
-
headers: { "content-type": "application/json", ...token ? { authorization: `Bearer ${token}` } : {} },
|
|
215549
|
-
body: JSON.stringify({ deliveryId, companyId: batch.companyId, recipientActorId: batch.actorId, item })
|
|
215550
|
-
});
|
|
215551
|
-
await response.body?.cancel();
|
|
215552
|
-
if (!response.ok) throw new Error(`Delivery HTTP ${response.status}`);
|
|
215553
|
-
}
|
|
215554
|
-
var escalationAttentionScope, DEFAULT_ESCALATION_REMINDERS, EscalationDeliveryWorker;
|
|
215555
|
-
var init_escalation_attention = __esm({
|
|
215556
|
-
"../server/src/domains/collab/escalation-attention.ts"() {
|
|
215557
|
-
"use strict";
|
|
215558
|
-
escalationAttentionScope = (companyId, issueId, kind) => `escalation-${kind}:${JSON.stringify([companyId, issueId])}`;
|
|
215559
|
-
DEFAULT_ESCALATION_REMINDERS = {
|
|
215560
|
-
reminderMs: 15 * 6e4,
|
|
215561
|
-
acknowledgedReminderMs: 4 * 60 * 6e4
|
|
215562
|
-
};
|
|
215563
|
-
EscalationDeliveryWorker = class {
|
|
215564
|
-
constructor(deps) {
|
|
215565
|
-
this.deps = deps;
|
|
215566
|
-
}
|
|
215567
|
-
running = false;
|
|
215568
|
-
stopped = false;
|
|
215569
|
-
cursor = "";
|
|
215570
|
-
/** Already-started transport is bounded by its timeout; do not start new deliveries during shutdown. */
|
|
215571
|
-
stop() {
|
|
215572
|
-
this.stopped = true;
|
|
215573
|
-
}
|
|
215574
|
-
async tick() {
|
|
215575
|
-
if (this.running || this.stopped) return;
|
|
215576
|
-
this.running = true;
|
|
215577
|
-
try {
|
|
215578
|
-
const pending = [];
|
|
215579
|
-
let attempts = 0;
|
|
215580
|
-
for (const batch of await this.deps.batches()) {
|
|
215581
|
-
if (this.stopped) return;
|
|
215582
|
-
const markers = await this.deps.markers.listMarkers(batch.actorId);
|
|
215583
|
-
const items = withEscalationAttention(
|
|
215584
|
-
batch.items,
|
|
215585
|
-
batch.companyId,
|
|
215586
|
-
markers,
|
|
215587
|
-
(this.deps.now ?? Date.now)(),
|
|
215588
|
-
this.deps.policy
|
|
215589
|
-
);
|
|
215590
|
-
for (const item of items) {
|
|
215591
|
-
const attention2 = item.attention;
|
|
215592
|
-
if (!item.escalationId || !attention2?.needsAcknowledgement) continue;
|
|
215593
|
-
if (attention2.deliveredAt && Date.parse(attention2.deliveredAt) >= Date.parse(attention2.dueAt)) continue;
|
|
215594
|
-
pending.push({ batch, item, key: JSON.stringify([batch.companyId, batch.actorId, item.escalationId]) });
|
|
215595
|
-
}
|
|
215596
|
-
}
|
|
215597
|
-
pending.sort((a, b2) => a.key < b2.key ? -1 : a.key > b2.key ? 1 : 0);
|
|
215598
|
-
const afterCursor = pending.findIndex((p2) => p2.key > this.cursor);
|
|
215599
|
-
const start = afterCursor < 0 ? 0 : afterCursor;
|
|
215600
|
-
for (let offset = 0; offset < pending.length; offset++) {
|
|
215601
|
-
if (this.stopped) break;
|
|
215602
|
-
if (attempts++ >= (this.deps.maxPerTick ?? 20)) break;
|
|
215603
|
-
const { batch, item: queued, key } = pending[(start + offset) % pending.length];
|
|
215604
|
-
this.cursor = key;
|
|
215605
|
-
try {
|
|
215606
|
-
const current = this.deps.currentItem ? await this.deps.currentItem(batch, queued.escalationId) : queued;
|
|
215607
|
-
if (!current) continue;
|
|
215608
|
-
const item = withEscalationAttention(
|
|
215609
|
-
[current],
|
|
215610
|
-
batch.companyId,
|
|
215611
|
-
await this.deps.markers.listMarkers(batch.actorId),
|
|
215612
|
-
(this.deps.now ?? Date.now)(),
|
|
215613
|
-
this.deps.policy
|
|
215614
|
-
)[0];
|
|
215615
|
-
const attention2 = item.attention;
|
|
215616
|
-
if (this.stopped || !attention2.needsAcknowledgement || attention2.deliveredAt && Date.parse(attention2.deliveredAt) >= Date.parse(attention2.dueAt)) continue;
|
|
215617
|
-
const id = JSON.stringify([batch.companyId, batch.actorId, attention2.reminderKey]);
|
|
215618
|
-
await this.deps.send(batch, item, id);
|
|
215619
|
-
await this.deps.markers.markRead(
|
|
215620
|
-
batch.actorId,
|
|
215621
|
-
escalationAttentionScope(batch.companyId, item.escalationId, "webhook"),
|
|
215622
|
-
attention2.dueAt
|
|
215623
|
-
);
|
|
215624
|
-
} catch {
|
|
215625
|
-
this.deps.log(`[escalation-delivery] delivery failed; retained for retry (${key})`);
|
|
215626
|
-
}
|
|
215627
|
-
}
|
|
215628
|
-
} catch {
|
|
215629
|
-
this.deps.log("[escalation-delivery] scan failed; will retry");
|
|
215630
|
-
} finally {
|
|
215631
|
-
this.running = false;
|
|
215632
|
-
}
|
|
215633
|
-
}
|
|
215634
|
-
};
|
|
215635
|
-
}
|
|
215636
|
-
});
|
|
215637
|
-
|
|
215638
215111
|
// ../server/src/domains/collab/inbox-chat.ts
|
|
215639
215112
|
function mergeInbox(kernelItems, chatItems) {
|
|
215640
215113
|
if (chatItems.length === 0) return kernelItems;
|
|
@@ -217082,23 +216555,7 @@ function collabDomain(opts) {
|
|
|
217082
216555
|
const { reviews, works } = collectWaitingRows(snaps, me, policy);
|
|
217083
216556
|
waitingItems = buildWaitingInbox(reviews, works, policy, (/* @__PURE__ */ new Date()).toISOString(), me);
|
|
217084
216557
|
}
|
|
217085
|
-
|
|
217086
|
-
return { status: 200, body: { items: opts.readMarkers ? withEscalationAttention(items, req.auth.companyId ?? opts.defaultCompanyId ?? "", markers, Date.now(), opts.escalationReminders) : items } };
|
|
217087
|
-
});
|
|
217088
|
-
router.post("/api/inbox/escalations/:id/acknowledge", async (req) => {
|
|
217089
|
-
if (!opts.readMarkers) return { status: 503, body: { error: { code: "not_configured", message: "\u63A5\u624B\u8BB0\u5F55\u672A\u88C5\u914D" } } };
|
|
217090
|
-
const { kernel, registry: registry2 } = await resolveCtx(req.auth.companyId);
|
|
217091
|
-
await kernel.refreshModel?.();
|
|
217092
|
-
const leadOf = await buildLeadResolver(registry2);
|
|
217093
|
-
const item = buildInbox(kernel.model, req.auth.actor, leadOf).find((i) => i.escalationId === req.params.id);
|
|
217094
|
-
if (!item?.escalationId) return { status: 404, body: { error: { code: "not_found", message: "\u5F85\u529E\u4E0D\u5B58\u5728\u6216\u4E0D\u5C5E\u4E8E\u4F60" } } };
|
|
217095
|
-
const acknowledgedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
217096
|
-
await opts.readMarkers.markRead(
|
|
217097
|
-
req.auth.actor,
|
|
217098
|
-
escalationAttentionScope(req.auth.companyId ?? opts.defaultCompanyId ?? "", item.escalationId, "ack"),
|
|
217099
|
-
acknowledgedAt
|
|
217100
|
-
);
|
|
217101
|
-
return { status: 200, body: { acknowledgedAt } };
|
|
216558
|
+
return { status: 200, body: { items: mergeInbox(kernelItems, [...chatItems, ...waitingItems]) } };
|
|
217102
216559
|
});
|
|
217103
216560
|
const companyOf = (req) => req.auth.companyId ?? "company:default";
|
|
217104
216561
|
const noTagStore = { status: 501, body: { error: { code: "not_implemented", message: "\u672C\u90E8\u7F72\u672A\u542F\u7528\u5DE5\u5355\u6807\u7B7E" } } };
|
|
@@ -217337,7 +216794,6 @@ var init_collab = __esm({
|
|
|
217337
216794
|
init_workorders();
|
|
217338
216795
|
init_workorder_detail();
|
|
217339
216796
|
init_inbox();
|
|
217340
|
-
init_escalation_attention();
|
|
217341
216797
|
init_inbox_chat();
|
|
217342
216798
|
init_waiting_inbox();
|
|
217343
216799
|
init_src3();
|
|
@@ -217351,7 +216807,6 @@ var init_collab = __esm({
|
|
|
217351
216807
|
init_workorder_detail();
|
|
217352
216808
|
init_workorder_metrics();
|
|
217353
216809
|
init_inbox();
|
|
217354
|
-
init_escalation_attention();
|
|
217355
216810
|
init_letter_read_backfill();
|
|
217356
216811
|
init_audit();
|
|
217357
216812
|
init_dashboard();
|
|
@@ -217378,7 +216833,7 @@ function prepareReadonlyGitBundles(input) {
|
|
|
217378
216833
|
if (repos.length === 0) return null;
|
|
217379
216834
|
const targets = collectTargets(repos, input.pinnedRevisions);
|
|
217380
216835
|
if (targets.length === 0) return null;
|
|
217381
|
-
const bundleRoot = input.bundleRoot ??
|
|
216836
|
+
const bundleRoot = input.bundleRoot ?? os6.tmpdir();
|
|
217382
216837
|
fs24.mkdirSync(bundleRoot, { recursive: true });
|
|
217383
216838
|
const root = fs24.mkdtempSync(path25.join(bundleRoot, "oasis-git-bundles-"));
|
|
217384
216839
|
const files = {};
|
|
@@ -217525,7 +216980,7 @@ function createBundle(root, target, input) {
|
|
|
217525
216980
|
function verifyBundleReadable(dir, bundlePath, _bundleRef, commit, expectedTree, env) {
|
|
217526
216981
|
fs24.rmSync(dir, { recursive: true, force: true });
|
|
217527
216982
|
try {
|
|
217528
|
-
(0,
|
|
216983
|
+
(0, import_node_child_process16.execFileSync)("git", ["clone", bundlePath, dir], { stdio: "ignore", ...env ? { env } : {} });
|
|
217529
216984
|
git2(dir, ["cat-file", "-e", `${commit}^{commit}`], env, "COMMIT_NOT_FOUND");
|
|
217530
216985
|
const head = git2(dir, ["rev-parse", "HEAD"], env, "COMMIT_NOT_FOUND").trim();
|
|
217531
216986
|
if (head.toLowerCase() !== commit.toLowerCase()) {
|
|
@@ -217567,11 +217022,11 @@ function ensureSourceRepo(work, repo, commit, env) {
|
|
|
217567
217022
|
function gitInitBare(dir, env) {
|
|
217568
217023
|
if (fs24.existsSync(path25.join(dir, "objects"))) return;
|
|
217569
217024
|
fs24.mkdirSync(dir, { recursive: true });
|
|
217570
|
-
(0,
|
|
217025
|
+
(0, import_node_child_process16.execFileSync)("git", ["init", "--bare", dir], { stdio: "ignore", ...env ? { env } : {} });
|
|
217571
217026
|
}
|
|
217572
217027
|
function git2(cwd, args, env, fallback, timeout) {
|
|
217573
217028
|
try {
|
|
217574
|
-
return (0,
|
|
217029
|
+
return (0, import_node_child_process16.execFileSync)("git", ["-C", cwd, ...args], {
|
|
217575
217030
|
encoding: "utf8",
|
|
217576
217031
|
stdio: ["ignore", "pipe", "pipe"],
|
|
217577
217032
|
...timeout ? { timeout } : {},
|
|
@@ -217595,14 +217050,14 @@ function classifyGitError(fallback, err, where) {
|
|
|
217595
217050
|
function oneLine(msg) {
|
|
217596
217051
|
return msg.split("\n").map((s2) => s2.trim()).filter(Boolean).slice(0, 3).join(" ");
|
|
217597
217052
|
}
|
|
217598
|
-
var
|
|
217053
|
+
var import_node_child_process16, import_node_crypto45, fs24, os6, path25, GitReadonlyBundleError, HEX40, FETCH_TIMEOUT_MS2;
|
|
217599
217054
|
var init_readonly_bundle = __esm({
|
|
217600
217055
|
"../server/src/git/readonly-bundle.ts"() {
|
|
217601
217056
|
"use strict";
|
|
217602
|
-
|
|
217057
|
+
import_node_child_process16 = require("node:child_process");
|
|
217603
217058
|
import_node_crypto45 = require("node:crypto");
|
|
217604
217059
|
fs24 = __toESM(require("node:fs"), 1);
|
|
217605
|
-
|
|
217060
|
+
os6 = __toESM(require("node:os"), 1);
|
|
217606
217061
|
path25 = __toESM(require("node:path"), 1);
|
|
217607
217062
|
init_remote_util();
|
|
217608
217063
|
GitReadonlyBundleError = class extends Error {
|
|
@@ -217730,128 +217185,6 @@ var init_create_seeded_workorder = __esm({
|
|
|
217730
217185
|
}
|
|
217731
217186
|
});
|
|
217732
217187
|
|
|
217733
|
-
// ../server/src/domains/experiments/routes.ts
|
|
217734
|
-
function parsePlan2(raw) {
|
|
217735
|
-
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
217736
|
-
throw new ApiError(400, "BAD_PLAN", "plan \u5FC5\u987B\u662F { nodes: [...] } \u5BF9\u8C61");
|
|
217737
|
-
}
|
|
217738
|
-
const nodes = raw.nodes;
|
|
217739
|
-
if (!Array.isArray(nodes) || nodes.length === 0) {
|
|
217740
|
-
throw new ApiError(400, "BAD_PLAN", "plan.nodes \u5FC5\u987B\u662F\u975E\u7A7A\u6570\u7EC4");
|
|
217741
|
-
}
|
|
217742
|
-
const out = [];
|
|
217743
|
-
const seen = /* @__PURE__ */ new Set();
|
|
217744
|
-
for (const [i, node2] of nodes.entries()) {
|
|
217745
|
-
if (!node2 || typeof node2 !== "object") {
|
|
217746
|
-
throw new ApiError(400, "BAD_PLAN", `plan.nodes[${i}] \u4E0D\u662F\u5BF9\u8C61`);
|
|
217747
|
-
}
|
|
217748
|
-
const n = node2;
|
|
217749
|
-
const type = str2(n.type)?.toLowerCase();
|
|
217750
|
-
if (!type) throw new ApiError(400, "BAD_PLAN", `plan.nodes[${i}].type \u5FC5\u586B`);
|
|
217751
|
-
const title = str2(n.title);
|
|
217752
|
-
const key = `${type}:${(title ?? "").toLowerCase()}`;
|
|
217753
|
-
if (seen.has(key)) {
|
|
217754
|
-
throw new ApiError(400, "BAD_PLAN", `plan \u91CC\u6709\u91CD\u590D\u8282\u70B9 ${key}\uFF08\u540C type \u4E0B title \u5FC5\u987B\u552F\u4E00\uFF09`);
|
|
217755
|
-
}
|
|
217756
|
-
seen.add(key);
|
|
217757
|
-
if (title?.includes(":")) {
|
|
217758
|
-
throw new ApiError(400, "BAD_PLAN", `plan.nodes[${i}].title \u4E0D\u80FD\u542B\u534A\u89D2\u5192\u53F7\uFF08dependsOn \u7528\u5B83\u4F5C\u5206\u9694\u7B26\uFF09`);
|
|
217759
|
-
}
|
|
217760
|
-
const owner = str2(n.owner);
|
|
217761
|
-
if (owner && !owner.startsWith("actor:")) {
|
|
217762
|
-
throw new ApiError(400, "BAD_PLAN", `plan.nodes[${i}].owner \u5FC5\u987B\u662F actor id\uFF1A${owner}`);
|
|
217763
|
-
}
|
|
217764
|
-
const reviewers = Array.isArray(n.reviewers) ? n.reviewers.filter((r) => typeof r === "string") : void 0;
|
|
217765
|
-
if (reviewers?.some((r) => !r.startsWith("actor:"))) {
|
|
217766
|
-
throw new ApiError(400, "BAD_PLAN", `plan.nodes[${i}].reviewers \u5FC5\u987B\u90FD\u662F actor id`);
|
|
217767
|
-
}
|
|
217768
|
-
const reviewRoles = Array.isArray(n.reviewRoles) ? n.reviewRoles.filter((r) => typeof r === "string" && r.trim().length > 0).map((r) => r.trim()) : void 0;
|
|
217769
|
-
const dependsOn = Array.isArray(n.dependsOn) ? n.dependsOn.filter((d) => typeof d === "string").map((d) => d.trim().toLowerCase()).filter(Boolean) : void 0;
|
|
217770
|
-
out.push({
|
|
217771
|
-
type,
|
|
217772
|
-
...title ? { title } : {},
|
|
217773
|
-
...dependsOn ? { dependsOn } : {},
|
|
217774
|
-
...str2(n.brief) ? { brief: str2(n.brief) } : {},
|
|
217775
|
-
...n.isFinalOutput === true ? { isFinalOutput: true } : {},
|
|
217776
|
-
...owner ? { owner } : {},
|
|
217777
|
-
...reviewers ? { reviewers } : {},
|
|
217778
|
-
...reviewRoles ? { reviewRoles } : {}
|
|
217779
|
-
});
|
|
217780
|
-
}
|
|
217781
|
-
const notes = Array.isArray(raw.notes) ? raw.notes.filter((x2) => typeof x2 === "string") : void 0;
|
|
217782
|
-
return { nodes: out, ...notes?.length ? { notes } : {} };
|
|
217783
|
-
}
|
|
217784
|
-
function experimentsDomain(opts) {
|
|
217785
|
-
return (router) => {
|
|
217786
|
-
router.post("/api/experiments/workorders", async (req) => {
|
|
217787
|
-
const b2 = req.body ?? {};
|
|
217788
|
-
const title = str2(b2.title);
|
|
217789
|
-
const brief = str2(b2.brief);
|
|
217790
|
-
if (!title) throw new ApiError(400, "BAD_REQUEST", "title \u5FC5\u586B");
|
|
217791
|
-
if (!brief) throw new ApiError(400, "BAD_REQUEST", "brief \u5FC5\u586B");
|
|
217792
|
-
const plan = parsePlan2(b2.plan);
|
|
217793
|
-
const projectId2 = str2(b2.projectId);
|
|
217794
|
-
if (projectId2 && opts.projectExists && !await opts.projectExists(projectId2)) {
|
|
217795
|
-
throw new ApiError(400, "PROJECT_NOT_FOUND", `\u76EE\u6807\u9879\u76EE\u4E0D\u5B58\u5728\uFF1A${projectId2}`);
|
|
217796
|
-
}
|
|
217797
|
-
const idempotencyKey2 = str2(b2.idempotencyKey);
|
|
217798
|
-
const reused = Boolean(
|
|
217799
|
-
idempotencyKey2 && opts.workorderExists?.(workspaceForKey(idempotencyKey2))
|
|
217800
|
-
);
|
|
217801
|
-
const dispatch = b2.dispatch === false ? false : true;
|
|
217802
|
-
const acceptanceCriteria = Array.isArray(b2.acceptanceCriteria) ? b2.acceptanceCriteria.filter((x2) => typeof x2 === "string" && x2.trim().length > 0) : void 0;
|
|
217803
|
-
const result = await opts.create({
|
|
217804
|
-
title,
|
|
217805
|
-
brief,
|
|
217806
|
-
...str2(b2.goal) ? { goal: str2(b2.goal) } : {},
|
|
217807
|
-
...acceptanceCriteria?.length ? { acceptanceCriteria } : {},
|
|
217808
|
-
plan,
|
|
217809
|
-
...projectId2 ? { projectId: projectId2 } : {},
|
|
217810
|
-
actor: req.auth.actor,
|
|
217811
|
-
// brief.owner 必须是真人,否则 apply 硬闸 INVALID_PRINCIPALS 拒(决策 0026)。
|
|
217812
|
-
// 平台用 operator token 调用,其 actor 就是部署机上的系统用户(human),满足该闸。
|
|
217813
|
-
humanActorId: req.auth.actor,
|
|
217814
|
-
...dispatch ? {} : { dispatch: false },
|
|
217815
|
-
...idempotencyKey2 ? { idempotencyKey: idempotencyKey2 } : {}
|
|
217816
|
-
});
|
|
217817
|
-
const body2 = {
|
|
217818
|
-
workspaceId: result.workspace,
|
|
217819
|
-
rootArtifactId: result.rootArtifactId,
|
|
217820
|
-
spawned: result.spawned.map((s2) => ({ id: s2.id, type: s2.type, owner: s2.owner })),
|
|
217821
|
-
reused
|
|
217822
|
-
};
|
|
217823
|
-
return { status: 201, body: body2 };
|
|
217824
|
-
});
|
|
217825
|
-
};
|
|
217826
|
-
}
|
|
217827
|
-
var str2;
|
|
217828
|
-
var init_routes7 = __esm({
|
|
217829
|
-
"../server/src/domains/experiments/routes.ts"() {
|
|
217830
|
-
"use strict";
|
|
217831
|
-
init_router();
|
|
217832
|
-
init_create_seeded_workorder();
|
|
217833
|
-
str2 = (v2) => typeof v2 === "string" && v2.trim() ? v2.trim() : void 0;
|
|
217834
|
-
}
|
|
217835
|
-
});
|
|
217836
|
-
|
|
217837
|
-
// ../server/src/domains/experiments/index.ts
|
|
217838
|
-
function createExperimentsDomain(opts) {
|
|
217839
|
-
return {
|
|
217840
|
-
register: experimentsDomain({
|
|
217841
|
-
create: opts.create,
|
|
217842
|
-
...opts.projectExists ? { projectExists: opts.projectExists } : {},
|
|
217843
|
-
...opts.workorderExists ? { workorderExists: opts.workorderExists } : {}
|
|
217844
|
-
})
|
|
217845
|
-
};
|
|
217846
|
-
}
|
|
217847
|
-
var init_experiments2 = __esm({
|
|
217848
|
-
"../server/src/domains/experiments/index.ts"() {
|
|
217849
|
-
"use strict";
|
|
217850
|
-
init_routes7();
|
|
217851
|
-
init_routes7();
|
|
217852
|
-
}
|
|
217853
|
-
});
|
|
217854
|
-
|
|
217855
217188
|
// ../server/src/domains/trace/service.ts
|
|
217856
217189
|
function rawObj(event) {
|
|
217857
217190
|
const payload = event.payload;
|
|
@@ -218547,7 +217880,7 @@ function traceDomain(opts) {
|
|
|
218547
217880
|
});
|
|
218548
217881
|
};
|
|
218549
217882
|
}
|
|
218550
|
-
var
|
|
217883
|
+
var init_routes7 = __esm({
|
|
218551
217884
|
"../server/src/domains/trace/routes.ts"() {
|
|
218552
217885
|
"use strict";
|
|
218553
217886
|
init_src();
|
|
@@ -218589,9 +217922,9 @@ var init_trace2 = __esm({
|
|
|
218589
217922
|
"../server/src/domains/trace/index.ts"() {
|
|
218590
217923
|
"use strict";
|
|
218591
217924
|
init_service6();
|
|
218592
|
-
|
|
217925
|
+
init_routes7();
|
|
218593
217926
|
init_service6();
|
|
218594
|
-
|
|
217927
|
+
init_routes7();
|
|
218595
217928
|
init_sink();
|
|
218596
217929
|
init_chat_parts();
|
|
218597
217930
|
init_trace_health();
|
|
@@ -218772,7 +218105,7 @@ function executionContinuityDomain(service) {
|
|
|
218772
218105
|
};
|
|
218773
218106
|
}
|
|
218774
218107
|
var HANDOFF_OUTCOMES, AGENT_CHECKPOINT_TRIGGERS, EXTERNAL_EFFECT_STATUSES;
|
|
218775
|
-
var
|
|
218108
|
+
var init_routes8 = __esm({
|
|
218776
218109
|
"../server/src/domains/execution-continuity/routes.ts"() {
|
|
218777
218110
|
"use strict";
|
|
218778
218111
|
init_router();
|
|
@@ -220021,10 +219354,10 @@ function createExecutionContinuityDomain(opts) {
|
|
|
220021
219354
|
var init_execution_continuity2 = __esm({
|
|
220022
219355
|
"../server/src/domains/execution-continuity/index.ts"() {
|
|
220023
219356
|
"use strict";
|
|
220024
|
-
|
|
219357
|
+
init_routes8();
|
|
220025
219358
|
init_service7();
|
|
220026
219359
|
init_service7();
|
|
220027
|
-
|
|
219360
|
+
init_routes8();
|
|
220028
219361
|
init_handoff_work_bridge();
|
|
220029
219362
|
init_upstream_handoff_input();
|
|
220030
219363
|
init_node_conclusions();
|
|
@@ -220334,9 +219667,7 @@ function createChatSessionsDomain(opts) {
|
|
|
220334
219667
|
router.get("/api/chat-sessions/:id/turns/active", async (req) => {
|
|
220335
219668
|
if (!opts.chatTurns) throw new ApiError(404, "NOT_FOUND", "\u672C\u5B9E\u4F8B\u672A\u63A5\u4F1A\u8BDD\u8F6E\u6B21\u8D26\u672C");
|
|
220336
219669
|
const session = await store.getSession(req.params.id);
|
|
220337
|
-
if (!session || session.humanActorId !== req.auth.actor
|
|
220338
|
-
throw new ApiError(404, "NOT_FOUND", "session not found");
|
|
220339
|
-
}
|
|
219670
|
+
if (!session || session.humanActorId !== req.auth.actor) throw new ApiError(404, "NOT_FOUND", "session not found");
|
|
220340
219671
|
const turn = await opts.chatTurns.activeTurn(req.params.id);
|
|
220341
219672
|
return { status: 200, body: { turn } };
|
|
220342
219673
|
});
|
|
@@ -223686,7 +223017,7 @@ function automationsDomain(opts) {
|
|
|
223686
223017
|
};
|
|
223687
223018
|
}
|
|
223688
223019
|
var RECENT_LIMIT2, TARGET_ISSUE_MESSAGE;
|
|
223689
|
-
var
|
|
223020
|
+
var init_routes9 = __esm({
|
|
223690
223021
|
"../server/src/domains/automations/routes.ts"() {
|
|
223691
223022
|
"use strict";
|
|
223692
223023
|
init_src();
|
|
@@ -223805,9 +223136,9 @@ var init_automations = __esm({
|
|
|
223805
223136
|
"use strict";
|
|
223806
223137
|
init_service8();
|
|
223807
223138
|
init_webhook();
|
|
223808
|
-
|
|
223139
|
+
init_routes9();
|
|
223809
223140
|
init_service8();
|
|
223810
|
-
|
|
223141
|
+
init_routes9();
|
|
223811
223142
|
init_projection2();
|
|
223812
223143
|
init_webhook();
|
|
223813
223144
|
init_attribution();
|
|
@@ -223980,7 +223311,7 @@ function playbooksDomain(opts) {
|
|
|
223980
223311
|
};
|
|
223981
223312
|
}
|
|
223982
223313
|
var import_node_crypto51;
|
|
223983
|
-
var
|
|
223314
|
+
var init_routes10 = __esm({
|
|
223984
223315
|
"../server/src/domains/playbooks/routes.ts"() {
|
|
223985
223316
|
"use strict";
|
|
223986
223317
|
import_node_crypto51 = require("node:crypto");
|
|
@@ -224082,9 +223413,9 @@ function createPlaybooksDomain(opts) {
|
|
|
224082
223413
|
var init_playbooks = __esm({
|
|
224083
223414
|
"../server/src/domains/playbooks/index.ts"() {
|
|
224084
223415
|
"use strict";
|
|
224085
|
-
|
|
223416
|
+
init_routes10();
|
|
224086
223417
|
init_registry3();
|
|
224087
|
-
|
|
223418
|
+
init_routes10();
|
|
224088
223419
|
init_overrides();
|
|
224089
223420
|
}
|
|
224090
223421
|
});
|
|
@@ -225046,11 +224377,11 @@ var init_engine = __esm({
|
|
|
225046
224377
|
constructor(table = /* @__PURE__ */ new Map()) {
|
|
225047
224378
|
this.table = table;
|
|
225048
224379
|
}
|
|
225049
|
-
set(
|
|
225050
|
-
this.table.set(`${
|
|
224380
|
+
set(platform, platformUserId, actor) {
|
|
224381
|
+
this.table.set(`${platform}:${platformUserId}`, actor);
|
|
225051
224382
|
}
|
|
225052
|
-
resolve(
|
|
225053
|
-
return this.table.get(`${
|
|
224383
|
+
resolve(platform, platformUserId) {
|
|
224384
|
+
return this.table.get(`${platform}:${platformUserId}`) ?? null;
|
|
225054
224385
|
}
|
|
225055
224386
|
};
|
|
225056
224387
|
}
|
|
@@ -225589,7 +224920,7 @@ ${HIGH_RISK_COMMANDS}`;
|
|
|
225589
224920
|
const downstreams = consumersOf(m2, p2.id).map((a) => a.id);
|
|
225590
224921
|
const task = [
|
|
225591
224922
|
`## \u672C\u6B21\u4E3A\u4EC0\u4E48\u5524\u8D77\u4F60`,
|
|
225592
|
-
`\u8282\u70B9 **${p2.id}**${brief ? `\uFF08${brief}\uFF09` : ""} \u5DF2\u963B\u585E\u7EA6 **${mins} \u5206\u949F**\u6CA1\u8FDB\u5C55\u3002\u673A\u68B0\u8BCA\u65AD\
|
|
224923
|
+
`\u8282\u70B9 **${p2.id}**${brief ? `\uFF08${brief}\uFF09` : ""} \u5DF2\u963B\u585E\u7EA6 **${mins} \u5206\u949F**\u6CA1\u8FDB\u5C55\u3002\u7CFB\u7EDF\u5DF2\u673A\u68B0\u8BCA\u65AD\u3001\u786E\u8BA4**\u8FD9\u662F\u56FE\u75C5\u6216\u673A\u68B0\u5B9A\u4F4D\u4E0D\u5230\u7684\u6B8B\u5DEE**\uFF08\u8D44\u6E90 / \u4EBA / \u8FD0\u884C\u65F6\u7C7B\u75C5\u56E0\u5DF2\u6392\u9664\uFF09\u3002`,
|
|
225593
224924
|
``,
|
|
225594
224925
|
`## \u75C5\u5386\uFF08\u673A\u68B0\u8BCA\u65AD\uFF1B\u5148\u8BFB\u8FD9\u4E2A\uFF09`,
|
|
225595
224926
|
caseFile,
|
|
@@ -226720,7 +226051,6 @@ var init_src10 = __esm({
|
|
|
226720
226051
|
init_orphan_sweep();
|
|
226721
226052
|
init_dispatch_drop_sweep();
|
|
226722
226053
|
init_dispatch_mapping_rebuild();
|
|
226723
|
-
init_dispatch_binding_diagnosis();
|
|
226724
226054
|
init_zero_output_breaker();
|
|
226725
226055
|
init_dispatch_exit_reconcile();
|
|
226726
226056
|
init_session_exit_outcome();
|
|
@@ -226759,7 +226089,6 @@ var init_src10 = __esm({
|
|
|
226759
226089
|
init_node_store();
|
|
226760
226090
|
init_tokens();
|
|
226761
226091
|
init_collab();
|
|
226762
|
-
init_collab();
|
|
226763
226092
|
init_closure_report();
|
|
226764
226093
|
init_workorders();
|
|
226765
226094
|
init_workorder_detail();
|
|
@@ -226767,7 +226096,6 @@ var init_src10 = __esm({
|
|
|
226767
226096
|
init_readonly_bundle();
|
|
226768
226097
|
init_tags();
|
|
226769
226098
|
init_create_seeded_workorder();
|
|
226770
|
-
init_experiments2();
|
|
226771
226099
|
init_trace2();
|
|
226772
226100
|
init_execution_continuity2();
|
|
226773
226101
|
init_chat_sessions();
|
|
@@ -229535,8 +228863,6 @@ var init_postgres_trace = __esm({
|
|
|
229535
228863
|
await pool.query(`ALTER TABLE "${s2}".agent_runs ADD COLUMN IF NOT EXISTS handoff_id text`);
|
|
229536
228864
|
await pool.query(`ALTER TABLE "${s2}".agent_runs ADD COLUMN IF NOT EXISTS continuity_mode text`);
|
|
229537
228865
|
await pool.query(`ALTER TABLE "${s2}".agent_runs ADD COLUMN IF NOT EXISTS part text`);
|
|
229538
|
-
await pool.query(`ALTER TABLE "${s2}".agent_runs ADD COLUMN IF NOT EXISTS oasis_git_sha text`);
|
|
229539
|
-
await pool.query(`ALTER TABLE "${s2}".agent_runs ADD COLUMN IF NOT EXISTS actor_config_version integer`);
|
|
229540
228866
|
await pool.query(`
|
|
229541
228867
|
UPDATE "${s2}".agent_runs
|
|
229542
228868
|
SET part=substring(job_key FROM char_length('produce::' || node_id || '::') + 1)
|
|
@@ -230044,8 +229370,6 @@ var init_postgres_trace = __esm({
|
|
|
230044
229370
|
effectiveModel: null,
|
|
230045
229371
|
modelSource: null,
|
|
230046
229372
|
transcriptRef: null,
|
|
230047
|
-
oasisGitSha: input.oasisGitSha ?? null,
|
|
230048
|
-
actorConfigVersion: input.actorConfigVersion ?? null,
|
|
230049
229373
|
metadata: input.metadata ?? {},
|
|
230050
229374
|
createdAt: startedAt,
|
|
230051
229375
|
updatedAt: startedAt
|
|
@@ -230057,9 +229381,9 @@ var init_postgres_trace = __esm({
|
|
|
230057
229381
|
artifact_id, node_id, work_order_id, role, attempt_no, runtime_session_id, input_refs, output_refs, handoff_id, continuity_mode,
|
|
230058
229382
|
op_id, project_id, parent_run_id, root_run_id, job_key, part, action, started_at, ended_at,
|
|
230059
229383
|
duration_ms, exit_code, exit_reason, error_code, error_message, usage, effective_model, model_source,
|
|
230060
|
-
transcript_ref, metadata, created_at, updated_at
|
|
229384
|
+
transcript_ref, metadata, created_at, updated_at)
|
|
230061
229385
|
VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15::jsonb,$16::jsonb,$17,$18,
|
|
230062
|
-
$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32,$33::jsonb,$34,$35,$36,$37::jsonb,$38,$39
|
|
229386
|
+
$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32,$33::jsonb,$34,$35,$36,$37::jsonb,$38,$39)
|
|
230063
229387
|
ON CONFLICT (id) DO NOTHING`,
|
|
230064
229388
|
[
|
|
230065
229389
|
run.id,
|
|
@@ -230100,9 +229424,7 @@ var init_postgres_trace = __esm({
|
|
|
230100
229424
|
run.transcriptRef,
|
|
230101
229425
|
JSON.stringify(scrubPgJson(run.metadata)),
|
|
230102
229426
|
run.createdAt,
|
|
230103
|
-
run.updatedAt
|
|
230104
|
-
run.oasisGitSha,
|
|
230105
|
-
run.actorConfigVersion
|
|
229427
|
+
run.updatedAt
|
|
230106
229428
|
]
|
|
230107
229429
|
);
|
|
230108
229430
|
if (client) await client.query("COMMIT");
|
|
@@ -230152,8 +229474,6 @@ var init_postgres_trace = __esm({
|
|
|
230152
229474
|
effectiveModel: { col: "effective_model" },
|
|
230153
229475
|
modelSource: { col: "model_source" },
|
|
230154
229476
|
lastProgressAt: { col: "last_progress_at" },
|
|
230155
|
-
oasisGitSha: { col: "oasis_git_sha" },
|
|
230156
|
-
actorConfigVersion: { col: "actor_config_version" },
|
|
230157
229477
|
transcriptRef: { col: "transcript_ref" },
|
|
230158
229478
|
metadata: { col: "metadata", json: true }
|
|
230159
229479
|
};
|
|
@@ -231202,8 +230522,6 @@ var init_postgres_trace = __esm({
|
|
|
231202
230522
|
effectiveModel: row.effective_model ?? null,
|
|
231203
230523
|
modelSource: row.model_source ?? null,
|
|
231204
230524
|
transcriptRef: row.transcript_ref ?? null,
|
|
231205
|
-
oasisGitSha: row.oasis_git_sha ?? null,
|
|
231206
|
-
actorConfigVersion: row.actor_config_version == null ? null : Number(row.actor_config_version),
|
|
231207
230525
|
metadata: row.metadata ?? {},
|
|
231208
230526
|
toolCallCount: Number(row.tool_call_count ?? 0),
|
|
231209
230527
|
...row.created_at != null ? { createdAt: row.created_at } : {},
|
|
@@ -231355,7 +230673,7 @@ var init_postgres_chat_turns = __esm({
|
|
|
231355
230673
|
} catch (err) {
|
|
231356
230674
|
if (!isUniqueViolation2(err)) throw err;
|
|
231357
230675
|
const mine = await this.getTurnBySourceRun(input.source, input.sourceRunId);
|
|
231358
|
-
if (mine
|
|
230676
|
+
if (mine) return { outcome: "resumed", turn: mine };
|
|
231359
230677
|
const active = await this.activeTurn(input.chatSessionId);
|
|
231360
230678
|
if (active) return { outcome: "busy", activeTurn: active };
|
|
231361
230679
|
throw err;
|
|
@@ -232187,9 +231505,8 @@ var init_postgres_automations = __esm({
|
|
|
232187
231505
|
await client.query("ROLLBACK");
|
|
232188
231506
|
await client.query("BEGIN");
|
|
232189
231507
|
const mine = await client.query(
|
|
232190
|
-
`SELECT * FROM ${this.s}.chat_session_turns
|
|
232191
|
-
|
|
232192
|
-
[input.source, input.sourceRunId, input.chatSessionId]
|
|
231508
|
+
`SELECT * FROM ${this.s}.chat_session_turns WHERE source = $1 AND source_run_id = $2`,
|
|
231509
|
+
[input.source, input.sourceRunId]
|
|
232193
231510
|
);
|
|
232194
231511
|
if (mine.rows[0]) {
|
|
232195
231512
|
await client.query("COMMIT");
|
|
@@ -232422,7 +231739,6 @@ var init_postgres_chat_sessions = __esm({
|
|
|
232422
231739
|
await pool.query(`DROP INDEX IF EXISTS "${s2}".chat_pending_client_key_uq`);
|
|
232423
231740
|
await pool.query(`CREATE UNIQUE INDEX IF NOT EXISTS chat_pending_client_key_uq ON "${s2}".chat_pending_messages (chat_session_id, client_key) WHERE client_key IS NOT NULL AND state = 'queued'`);
|
|
232424
231741
|
await pool.query(`ALTER TABLE "${s2}".chat_messages ADD COLUMN IF NOT EXISTS run_id text`);
|
|
232425
|
-
await pool.query(`ALTER TABLE "${s2}".chat_messages ADD COLUMN IF NOT EXISTS turn_id text`);
|
|
232426
231742
|
await pool.query(`ALTER TABLE "${s2}".chat_messages ADD COLUMN IF NOT EXISTS parts jsonb`);
|
|
232427
231743
|
await pool.query(`ALTER TABLE "${s2}".chat_messages ADD COLUMN IF NOT EXISTS attachments jsonb`);
|
|
232428
231744
|
await pool.query(`ALTER TABLE "${s2}".chat_messages ADD COLUMN IF NOT EXISTS status text`);
|
|
@@ -232583,11 +231899,11 @@ var init_postgres_chat_sessions = __esm({
|
|
|
232583
231899
|
async appendMessageOnce(m2) {
|
|
232584
231900
|
const insert = async () => {
|
|
232585
231901
|
const r = await this.pool.query(
|
|
232586
|
-
`INSERT INTO ${this.s}.chat_messages (id, session_id, role, content, seq, created_at, run_id, parts, attachments, status, completed_at, message_key, needs_agent_delivery, delivered_to_agent_at
|
|
232587
|
-
SELECT $1,$2,$3,$4, COALESCE(MAX(seq),0)+1, $5,$6,$7,$8,$9,$10,$11,$12,$13
|
|
231902
|
+
`INSERT INTO ${this.s}.chat_messages (id, session_id, role, content, seq, created_at, run_id, parts, attachments, status, completed_at, message_key, needs_agent_delivery, delivered_to_agent_at)
|
|
231903
|
+
SELECT $1,$2,$3,$4, COALESCE(MAX(seq),0)+1, $5,$6,$7,$8,$9,$10,$11,$12,$13
|
|
232588
231904
|
FROM ${this.s}.chat_messages WHERE session_id = $2
|
|
232589
231905
|
RETURNING seq`,
|
|
232590
|
-
[m2.id, m2.sessionId, m2.role, m2.content, m2.createdAt, m2.runId ?? null, m2.parts !== void 0 ? JSON.stringify(m2.parts) : null, m2.attachments !== void 0 ? JSON.stringify(m2.attachments) : null, m2.status ?? null, m2.completedAt ?? null, m2.messageKey ?? null, m2.needsAgentDelivery ?? null, m2.deliveredToAgentAt ?? null
|
|
231906
|
+
[m2.id, m2.sessionId, m2.role, m2.content, m2.createdAt, m2.runId ?? null, m2.parts !== void 0 ? JSON.stringify(m2.parts) : null, m2.attachments !== void 0 ? JSON.stringify(m2.attachments) : null, m2.status ?? null, m2.completedAt ?? null, m2.messageKey ?? null, m2.needsAgentDelivery ?? null, m2.deliveredToAgentAt ?? null]
|
|
232591
231907
|
);
|
|
232592
231908
|
return Number(r.rows[0].seq);
|
|
232593
231909
|
};
|
|
@@ -232963,7 +232279,6 @@ var init_postgres_chat_sessions = __esm({
|
|
|
232963
232279
|
seq: Number(row.seq),
|
|
232964
232280
|
createdAt: new Date(row.created_at).toISOString(),
|
|
232965
232281
|
...row.run_id != null ? { runId: row.run_id } : {},
|
|
232966
|
-
...row.turn_id != null ? { turnId: row.turn_id } : {},
|
|
232967
232282
|
...row.parts != null ? { parts: row.parts } : {},
|
|
232968
232283
|
...row.attachments != null ? { attachments: row.attachments } : {},
|
|
232969
232284
|
...row.status != null ? { status: row.status } : {},
|
|
@@ -234725,22 +234040,22 @@ var init_trajectory = __esm({
|
|
|
234725
234040
|
|
|
234726
234041
|
// src/index.ts
|
|
234727
234042
|
var fs44 = __toESM(require("node:fs"));
|
|
234728
|
-
var
|
|
234043
|
+
var os13 = __toESM(require("node:os"));
|
|
234729
234044
|
var path41 = __toESM(require("node:path"));
|
|
234730
|
-
var
|
|
234045
|
+
var import_node_child_process23 = require("node:child_process");
|
|
234731
234046
|
var import_node_crypto66 = require("node:crypto");
|
|
234732
234047
|
|
|
234733
234048
|
// ../cli/src/cli.ts
|
|
234734
234049
|
var fs39 = __toESM(require("node:fs"), 1);
|
|
234735
|
-
var
|
|
234050
|
+
var os11 = __toESM(require("node:os"), 1);
|
|
234736
234051
|
var path36 = __toESM(require("node:path"), 1);
|
|
234737
234052
|
var import_node_crypto64 = require("node:crypto");
|
|
234738
234053
|
|
|
234739
234054
|
// ../cli/src/serve.ts
|
|
234740
234055
|
var fs32 = __toESM(require("node:fs"), 1);
|
|
234741
|
-
var
|
|
234056
|
+
var os7 = __toESM(require("node:os"), 1);
|
|
234742
234057
|
var path29 = __toESM(require("node:path"), 1);
|
|
234743
|
-
var
|
|
234058
|
+
var import_node_child_process17 = require("node:child_process");
|
|
234744
234059
|
var import_node_crypto60 = require("node:crypto");
|
|
234745
234060
|
var import_node_url7 = require("node:url");
|
|
234746
234061
|
|
|
@@ -235053,12 +234368,12 @@ function renderStallCard(st, now, fmtSince) {
|
|
|
235053
234368
|
` : "";
|
|
235054
234369
|
const repeatNote = st.priorCards > 0 && st.sinceLastReportMs !== void 0 ? `
|
|
235055
234370
|
|
|
235056
|
-
\uFF08\u8FD9\u662F\u540C\u4E00\u4E2A\u95EE\u9898\u7684\u7B2C ${st.priorCards + 1} \u6B21\u63D0\u9192\uFF0C\u4E0A\u4E00\u6B21\u662F ${fmtSince(new Date(now - st.sinceLastReportMs).toISOString(), now)}\u3002\
|
|
234371
|
+
\uFF08\u8FD9\u662F\u540C\u4E00\u4E2A\u95EE\u9898\u7684\u7B2C ${st.priorCards + 1} \u6B21\u63D0\u9192\uFF0C\u4E0A\u4E00\u6B21\u662F ${fmtSince(new Date(now - st.sinceLastReportMs).toISOString(), now)}\u3002\u5173\u6389\u5361\u7247\u53EA\u8868\u793A\u300C\u6211\u770B\u5230\u4E86\u300D\uFF0C\u95EE\u9898\u6CA1\u6D88\u5931\u5C31\u8FD8\u4F1A\u6309 1 \u5C0F\u65F6 \u2192 4 \u5C0F\u65F6 \u2192 12 \u5C0F\u65F6\u7684\u95F4\u9694\u518D\u63D0\u9192\u3002\uFF09` : "";
|
|
235057
234372
|
return {
|
|
235058
234373
|
// ★ 通知型(提案 3c):只在等待面陈列,不挡派发/收口/自动验收——以前它与人提的上报共用
|
|
235059
234374
|
// 三轴 veto,于是**告警在制造它要报告的那个现象**。
|
|
235060
234375
|
intent: "advisory",
|
|
235061
|
-
// ★ source 按**判据**分档(提案 §4b
|
|
234376
|
+
// ★ source 按**判据**分档(提案 §4b):自动关卡按它反查,绝不做卡面文案匹配。
|
|
235062
234377
|
source: st.source,
|
|
235063
234378
|
reason: `${st.headline}
|
|
235064
234379
|
|
|
@@ -235067,6 +234382,19 @@ ${idleNote}${st.detail}
|
|
|
235067
234382
|
${st.action}${repeatNote}`
|
|
235068
234383
|
};
|
|
235069
234384
|
}
|
|
234385
|
+
function collectRecoveredStallCards(snap, stalledNodeIds) {
|
|
234386
|
+
const out = [];
|
|
234387
|
+
for (const i of snap.issues) {
|
|
234388
|
+
if (!isStallSource(i.source) || i.resolvedAt !== null) continue;
|
|
234389
|
+
const nodeId = i.aboutNodeId;
|
|
234390
|
+
if (!nodeId || stalledNodeIds.has(nodeId)) continue;
|
|
234391
|
+
const node2 = snap.nodes.find((n) => n.id === nodeId);
|
|
234392
|
+
const lw = node2?.latestWorkId ? snap.works.find((w2) => w2.id === node2.latestWorkId) : void 0;
|
|
234393
|
+
const reason = !node2 ? "\u8BE5\u8282\u70B9\u5DF2\u4E0D\u5728\u8BA1\u5212\u91CC" : node2.cancelledAt ? "\u8BE5\u8282\u70B9\u5DF2\u4F5C\u5E9F" : node2.latestAcceptId === node2.latestWorkId ? "\u8BE5\u7248\u672C\u5DF2\u7ECF\u6536\u53E3" : lw && lw.status !== "success" ? "\u8BE5\u8282\u70B9\u53C8\u8D77\u4E86\u65B0\u4E00\u7248\uFF08\u6B63\u5728\u8DD1\u6216\u5DF2\u5931\u8D25\uFF0C\u53E6\u6709\u673A\u5236\u63A5\u7BA1\uFF09" : snap.workorder.dispatchPaused || snap.workorder.lifecycle !== "active" ? "\u8BE5\u5DE5\u5355\u5DF2\u6682\u505C\u6D3E\u53D1" : "\u8BE5\u8282\u70B9\u5DF2\u4E0D\u6EE1\u8DB3\u4EFB\u4F55\u4E00\u6761\u6EDE\u7559\u5224\u636E";
|
|
234394
|
+
out.push({ artifactId: nodeId, issueId: i.id, reason });
|
|
234395
|
+
}
|
|
234396
|
+
return out;
|
|
234397
|
+
}
|
|
235070
234398
|
|
|
235071
234399
|
// ../cli/src/serve-lock.ts
|
|
235072
234400
|
var fs29 = __toESM(require("node:fs"), 1);
|
|
@@ -235240,7 +234568,6 @@ init_src8();
|
|
|
235240
234568
|
init_src7();
|
|
235241
234569
|
init_src11();
|
|
235242
234570
|
init_src10();
|
|
235243
|
-
init_src10();
|
|
235244
234571
|
init_src9();
|
|
235245
234572
|
init_src();
|
|
235246
234573
|
init_trajectory();
|
|
@@ -235305,10 +234632,8 @@ var SESSION_TOKEN_GRACE_MS = 15 * 6e4;
|
|
|
235305
234632
|
function makeResumeRetryProxy(first, spawnFallback) {
|
|
235306
234633
|
const outCbs = [];
|
|
235307
234634
|
const telCbs = [];
|
|
235308
|
-
const liveCbs = [];
|
|
235309
234635
|
const outBuf = [];
|
|
235310
234636
|
const telBuf = [];
|
|
235311
|
-
const liveBuf = [];
|
|
235312
234637
|
let sawOutput = false;
|
|
235313
234638
|
let active = first;
|
|
235314
234639
|
const fanOut = (chunk) => {
|
|
@@ -235319,17 +234644,12 @@ function makeResumeRetryProxy(first, spawnFallback) {
|
|
|
235319
234644
|
if (telCbs.length) for (const cb of telCbs) cb(e);
|
|
235320
234645
|
else telBuf.push(e);
|
|
235321
234646
|
};
|
|
235322
|
-
const fanLive = (e) => {
|
|
235323
|
-
if (liveCbs.length) for (const cb of liveCbs) cb(e);
|
|
235324
|
-
else liveBuf.push(e);
|
|
235325
|
-
};
|
|
235326
234647
|
const wire = (s2) => {
|
|
235327
234648
|
s2.onOutput((c) => {
|
|
235328
234649
|
sawOutput = true;
|
|
235329
234650
|
fanOut(c);
|
|
235330
234651
|
});
|
|
235331
234652
|
s2.onTelemetry?.((e) => fanTel(e));
|
|
235332
|
-
s2.onLiveEvent?.((e) => fanLive(e));
|
|
235333
234653
|
};
|
|
235334
234654
|
wire(first);
|
|
235335
234655
|
const isSessionNotFound2 = (err) => {
|
|
@@ -235361,10 +234681,6 @@ function makeResumeRetryProxy(first, spawnFallback) {
|
|
|
235361
234681
|
for (const e of telBuf.splice(0)) cb(e);
|
|
235362
234682
|
telCbs.push(cb);
|
|
235363
234683
|
},
|
|
235364
|
-
onLiveEvent(cb) {
|
|
235365
|
-
for (const e of liveBuf.splice(0)) cb(e);
|
|
235366
|
-
liveCbs.push(cb);
|
|
235367
|
-
},
|
|
235368
234684
|
done,
|
|
235369
234685
|
kill: () => active.kill?.() ?? Promise.resolve(),
|
|
235370
234686
|
// ADR-0093 chat 道:插入能力必须穿过这层代理,否则「带 sessionId 的 resume」这条**常路径**
|
|
@@ -235375,11 +234691,6 @@ function makeResumeRetryProxy(first, spawnFallback) {
|
|
|
235375
234691
|
get canAppendInput() {
|
|
235376
234692
|
return active.canAppendInput !== false && typeof active.appendInput === "function";
|
|
235377
234693
|
},
|
|
235378
|
-
// supportsLiveProtocol 恒读 active(兜底重派后 active 换成 second):不能按 first 快照,否则回退会话的
|
|
235379
|
-
// 能力位会指向已死的首次尝试。
|
|
235380
|
-
get supportsLiveProtocol() {
|
|
235381
|
-
return active.supportsLiveProtocol === true;
|
|
235382
|
-
},
|
|
235383
234694
|
get nativeSessionId() {
|
|
235384
234695
|
return active.nativeSessionId;
|
|
235385
234696
|
}
|
|
@@ -235438,18 +234749,7 @@ function oasisWrapperScript() {
|
|
|
235438
234749
|
const repoRoot = (0, import_node_url7.fileURLToPath)(new URL("../../../", __esm_import_meta_url));
|
|
235439
234750
|
const tsx = path29.join(repoRoot, "node_modules/.bin/tsx");
|
|
235440
234751
|
const main = path29.join(repoRoot, "packages/cli/src/main.ts");
|
|
235441
|
-
const
|
|
235442
|
-
const uid = typeof process.getuid === "function" ? process.getuid() : "na";
|
|
235443
|
-
const stable = path29.join(os8.tmpdir(), `oasis-cli-wrapper-${uid}-${key}`);
|
|
235444
|
-
let dir;
|
|
235445
|
-
try {
|
|
235446
|
-
fs32.mkdirSync(stable, { recursive: true, mode: 448 });
|
|
235447
|
-
const st = fs32.lstatSync(stable);
|
|
235448
|
-
const mine = st.isDirectory() && !st.isSymbolicLink() && (typeof process.getuid !== "function" || st.uid === process.getuid());
|
|
235449
|
-
dir = mine ? stable : fs32.mkdtempSync(path29.join(os8.tmpdir(), "oasis-cli-"));
|
|
235450
|
-
} catch {
|
|
235451
|
-
dir = fs32.mkdtempSync(path29.join(os8.tmpdir(), "oasis-cli-"));
|
|
235452
|
-
}
|
|
234752
|
+
const dir = fs32.mkdtempSync(path29.join(os7.tmpdir(), "oasis-cli-"));
|
|
235453
234753
|
const wrapper = path29.join(dir, "oasis");
|
|
235454
234754
|
fs32.writeFileSync(wrapper, `#!/usr/bin/env bash
|
|
235455
234755
|
exec ${JSON.stringify(tsx)} ${JSON.stringify(main)} "$@"
|
|
@@ -235526,7 +234826,7 @@ async function runDeterministicKnowledgeLint(service, config2) {
|
|
|
235526
234826
|
if (!wrapper) throw new Error(`\u8FDE\u63A5\u5668 ${config2.connectorSlug} \u5C1A\u672A\u914D\u7F6E\u6216 wrapper \u4E0D\u53EF\u7528`);
|
|
235527
234827
|
const args = [...connector.knowledgeLintArgs({ libraryRef: config2.libraryRef, rootRef: config2.rootRef })];
|
|
235528
234828
|
const result = await new Promise((resolveResult) => {
|
|
235529
|
-
(0,
|
|
234829
|
+
(0, import_node_child_process17.execFile)(wrapper, args, {
|
|
235530
234830
|
env: { ...process.env, ...provision.env },
|
|
235531
234831
|
timeout: 12e4,
|
|
235532
234832
|
maxBuffer: 10 * 1024 * 1024
|
|
@@ -235796,7 +235096,7 @@ async function startServe(opts) {
|
|
|
235796
235096
|
);
|
|
235797
235097
|
const issuer = createTokenIssuer({ secretFile: path29.join(opts.dir, "session-token-secret") });
|
|
235798
235098
|
const apiActivity = createApiActivityLedger();
|
|
235799
|
-
const operatorActor = `actor:human:${
|
|
235099
|
+
const operatorActor = `actor:human:${os7.userInfo().username}`;
|
|
235800
235100
|
const operatorToken = issuer.issue(operatorActor);
|
|
235801
235101
|
fs32.writeFileSync(path29.join(opts.dir, "operator-token"), operatorToken, { mode: 384 });
|
|
235802
235102
|
let nodeTokens = createNodeTokenStore(path29.join(opts.dir, "node-tokens.json"));
|
|
@@ -235917,7 +235217,6 @@ async function startServe(opts) {
|
|
|
235917
235217
|
let chatSessionStore;
|
|
235918
235218
|
let chatTurnStore;
|
|
235919
235219
|
let readMarkerStore;
|
|
235920
|
-
const escalationDelivery = escalationDeliveryConfig(process.env);
|
|
235921
235220
|
if (pgDsn && pgPool) {
|
|
235922
235221
|
projectStateStore = await PostgresProjectStateStore.open(pgPool, pgSchema);
|
|
235923
235222
|
artifactStateStore = await PostgresArtifactStateStore.open(pgPool, pgSchema);
|
|
@@ -236042,10 +235341,6 @@ async function startServe(opts) {
|
|
|
236042
235341
|
runtimeKind: "auto",
|
|
236043
235342
|
continuityMode,
|
|
236044
235343
|
health: traceHealth,
|
|
236045
|
-
// 归因两列(A/B 评测的前提):这一趟活是哪个 oasis commit 派的、用的该员工第几版配置。
|
|
236046
|
-
// gitSha 与 /healthz 同源(getBuildInfo 进程内只算一次);配置版本走登记域,解析失败由 sink 吞成 null。
|
|
236047
|
-
buildSha: () => getBuildInfo().gitSha,
|
|
236048
|
-
resolveActorConfigVersion: async (actorId) => (await registryStore.latestConfig(actorId))?.version ?? null,
|
|
236049
235344
|
onError: (err) => console.warn(`[trace-sink] \u5199\u89C2\u6D4B\u6D41\u5931\u8D25\uFF08\u7EE7\u7EED\u3001\u4E0D\u5F71\u54CD\u6D3E\u53D1\uFF09: ${String(err)}`)
|
|
236050
235345
|
});
|
|
236051
235346
|
const executionContinuity = createExecutionContinuityDomain({
|
|
@@ -236141,13 +235436,6 @@ async function startServe(opts) {
|
|
|
236141
235436
|
return r.agentId;
|
|
236142
235437
|
}
|
|
236143
235438
|
});
|
|
236144
|
-
const experiments = createExperimentsDomain({
|
|
236145
|
-
create: createSeededWorkorder,
|
|
236146
|
-
projectExists: async (id) => Boolean(await projectStateStore.getProject(id)),
|
|
236147
|
-
// 幂等键命中既有工单时如实回报 reused=true:Runner 靠它区分「我刚建的」和
|
|
236148
|
-
// 「上次崩溃前已经建好的」,判错会让同一趟实验被记成两次。
|
|
236149
|
-
workorderExists: (workspaceId) => [...kernel.model.artifacts.values()].some((a) => a.workspace === workspaceId)
|
|
236150
|
-
});
|
|
236151
235439
|
let automationDispatchChat = null;
|
|
236152
235440
|
const inspectChatTarget = async (args) => {
|
|
236153
235441
|
const session = await chatSessionStore.getSession(args.sessionId).catch(() => null);
|
|
@@ -236965,8 +236253,6 @@ async function startServe(opts) {
|
|
|
236965
236253
|
chatSession: chatSessionStore,
|
|
236966
236254
|
// ADR-0086:chat 知会条目(与 readMarkers 成对)
|
|
236967
236255
|
readMarkers: readMarkerStore,
|
|
236968
|
-
escalationReminders: escalationDelivery.policy,
|
|
236969
|
-
defaultCompanyId,
|
|
236970
236256
|
// 工单标签词表(组织级受控、旁账,与 playbook-overrides 同款侧存)。
|
|
236971
236257
|
tags: workorderTagStore,
|
|
236972
236258
|
...opts.sla ? { sla: opts.sla } : {},
|
|
@@ -236978,7 +236264,6 @@ async function startServe(opts) {
|
|
|
236978
236264
|
executionContinuity.register,
|
|
236979
236265
|
automations.register,
|
|
236980
236266
|
playbooks.register,
|
|
236981
|
-
experiments.register,
|
|
236982
236267
|
...chatSessionStore ? [createChatSessionsDomain({
|
|
236983
236268
|
store: chatSessionStore,
|
|
236984
236269
|
registry: registryStore,
|
|
@@ -237575,10 +236860,6 @@ async function startServe(opts) {
|
|
|
237575
236860
|
let traceChain = traceStore.createRun({
|
|
237576
236861
|
id: traceRunId,
|
|
237577
236862
|
actorId,
|
|
237578
|
-
// 归因两列与派发路同源(见 TraceStoreSink 的 buildSha / resolveActorConfigVersion)。
|
|
237579
|
-
// chat 路没有 sink,故在此就地取;配置版本解析失败落 null,不影响开会话。
|
|
237580
|
-
oasisGitSha: getBuildInfo().gitSha,
|
|
237581
|
-
actorConfigVersion: await registryStore.latestConfig(actorId).then((c) => c?.version ?? null).catch(() => null),
|
|
237582
236863
|
runtimeKind: traceRuntimeKind(binding.runtimeKind),
|
|
237583
236864
|
runtimeInstanceId: `runtime:${binding.nodeId}:${binding.runtimeKind}`,
|
|
237584
236865
|
triggerKind: "api",
|
|
@@ -238513,8 +237794,6 @@ async function startServe(opts) {
|
|
|
238513
237794
|
ledgerWarn("cancel(map-miss)")(err);
|
|
238514
237795
|
}
|
|
238515
237796
|
},
|
|
238516
|
-
// Inbox is the notification contract (ADR 0090). Escalation delivery reconciles persisted Inbox
|
|
238517
|
-
// items below; it must not depend on this one-shot effect or its legacy recipient list.
|
|
238518
237797
|
async notify(_actorIds, _payload) {
|
|
238519
237798
|
}
|
|
238520
237799
|
};
|
|
@@ -238535,14 +237814,6 @@ async function startServe(opts) {
|
|
|
238535
237814
|
return live;
|
|
238536
237815
|
},
|
|
238537
237816
|
isAgent: async (actorId) => await executorKindOf(actorId) === "agent",
|
|
238538
|
-
beforeRedispatch: async (work) => {
|
|
238539
|
-
return prepareDroppedDispatch(work, {
|
|
238540
|
-
kernel: newKernel,
|
|
238541
|
-
// This sweep belongs to the default engine; legacy workorder.companyId is often empty.
|
|
238542
|
-
bindingFor: async (actorId) => (await actors.resolveCtx(defaultCompanyId)).service.resolveBinding()(actorId),
|
|
238543
|
-
nodeFor: (nodeId) => nodeStore.getNode(nodeId)
|
|
238544
|
-
});
|
|
238545
|
-
},
|
|
238546
237817
|
// resumeEligible=false:补派一律起**全新会话**。引擎那次派发的取值是节点状态的函数
|
|
238547
237818
|
//(activate.ts:`latestAcceptId == null && !lastProposedRejected`),本模块拿不到,
|
|
238548
237819
|
// 而两个方向的代价不对称——该续没续只是少一点上下文,不该续却续了就把返工要隔离的
|
|
@@ -239214,6 +238485,8 @@ async function startServe(opts) {
|
|
|
239214
238485
|
const quotaStarvationMs = opts.sla?.quotaStarvationMs ?? 6 * 36e5;
|
|
239215
238486
|
const nodeIdleFallbackMs = opts.sla?.nodeIdleFallbackMs ?? opts.sla?.reviewStallMs ?? (Number(process.env["OASIS_SLA_NODE_IDLE_FALLBACK_MS"]) || 2 * 36e5);
|
|
239216
238487
|
console.log(`[sla] \u8282\u70B9\u9759\u6B62\u515C\u5E95\u9608\u503C nodeIdleFallbackMs=${nodeIdleFallbackMs}ms\uFF08${Math.round(nodeIdleFallbackMs / 6e4)} \u5206\u949F\uFF09`);
|
|
238488
|
+
const stallRecoveryMisses = /* @__PURE__ */ new Map();
|
|
238489
|
+
const STALL_RECOVERY_TICKS = 2;
|
|
239217
238490
|
const fmtSince = (iso5, now) => {
|
|
239218
238491
|
const min2 = Math.floor(Math.max(0, now - Date.parse(iso5)) / 6e4);
|
|
239219
238492
|
if (!Number.isFinite(min2)) return "\u521A\u624D";
|
|
@@ -239359,12 +238632,14 @@ async function startServe(opts) {
|
|
|
239359
238632
|
const fused = [];
|
|
239360
238633
|
const starving = [];
|
|
239361
238634
|
const stuck = [];
|
|
238635
|
+
const recovered = [];
|
|
239362
238636
|
const activeIds = await store.transaction((tx) => tx.listActiveWorkorders());
|
|
239363
238637
|
for (const wid of activeIds) {
|
|
239364
238638
|
const snap = await store.transaction((tx) => tx.loadWorkorder(wid));
|
|
239365
238639
|
if (!snap) continue;
|
|
239366
238640
|
const stallSignals = collectReviewStallSignals(snap, now, { idleFallbackMs, policy });
|
|
239367
238641
|
stuck.push(...stallSignals);
|
|
238642
|
+
recovered.push(...collectRecoveredStallCards(snap, new Set(stallSignals.map((x2) => x2.artifactId))));
|
|
239368
238643
|
for (const node2 of snap.nodes) {
|
|
239369
238644
|
if (node2.cancelledAt) continue;
|
|
239370
238645
|
if (!node2.latestWorkId) continue;
|
|
@@ -239396,49 +238671,11 @@ async function startServe(opts) {
|
|
|
239396
238671
|
}
|
|
239397
238672
|
}
|
|
239398
238673
|
}
|
|
239399
|
-
return { fused, starving, stuck };
|
|
238674
|
+
return { fused, starving, stuck, recovered };
|
|
239400
238675
|
}
|
|
239401
238676
|
const slaEscalating = /* @__PURE__ */ new Set();
|
|
239402
|
-
const escalationDeliveryWorker = new EscalationDeliveryWorker({
|
|
239403
|
-
markers: readMarkerStore,
|
|
239404
|
-
policy: escalationDelivery.policy,
|
|
239405
|
-
batches: async () => {
|
|
239406
|
-
const batches = [];
|
|
239407
|
-
for (const companyId of escalationDelivery.webhooks.keys()) {
|
|
239408
|
-
const companyEngine = await getEngine(companyId);
|
|
239409
|
-
await companyEngine.kernel.refreshModel();
|
|
239410
|
-
const leadOf2 = await buildLeadResolver(companyEngine.registry);
|
|
239411
|
-
const recipients = /* @__PURE__ */ new Set();
|
|
239412
|
-
for (const node2 of companyEngine.kernel.model.artifacts.values()) {
|
|
239413
|
-
recipients.add(node2.owner);
|
|
239414
|
-
const lead = leadOf2?.(node2.owner);
|
|
239415
|
-
if (lead) recipients.add(lead);
|
|
239416
|
-
}
|
|
239417
|
-
for (const actorId of recipients) {
|
|
239418
|
-
const items = buildInbox(companyEngine.kernel.model, actorId, leadOf2).filter((item) => item.escalationId && item.artifactId && lifecycleOf(companyEngine.kernel.model, item.artifactId) === "active");
|
|
239419
|
-
if (items.length) batches.push({ companyId, actorId, items });
|
|
239420
|
-
}
|
|
239421
|
-
}
|
|
239422
|
-
return batches;
|
|
239423
|
-
},
|
|
239424
|
-
currentItem: async (batch, issueId) => {
|
|
239425
|
-
const companyEngine = await getEngine(batch.companyId);
|
|
239426
|
-
await companyEngine.kernel.refreshModel();
|
|
239427
|
-
const leadOf2 = await buildLeadResolver(companyEngine.registry);
|
|
239428
|
-
return buildInbox(companyEngine.kernel.model, batch.actorId, leadOf2).find((item) => item.escalationId === issueId && item.artifactId && lifecycleOf(companyEngine.kernel.model, item.artifactId) === "active");
|
|
239429
|
-
},
|
|
239430
|
-
send: async (batch, item, deliveryId) => {
|
|
239431
|
-
const endpoint = escalationDelivery.webhooks.get(batch.companyId);
|
|
239432
|
-
await sendEscalationWebhook(endpoint.url, endpoint.token, batch, item, deliveryId);
|
|
239433
|
-
},
|
|
239434
|
-
log: (message) => console.warn(message)
|
|
239435
|
-
});
|
|
239436
|
-
if (!escalationDelivery.webhooks.size) {
|
|
239437
|
-
console.warn("[escalation-delivery] \u7AD9\u5916\u6E20\u9053\u672A\u914D\u7F6E\uFF1A\u5347\u7EA7\u5C06\u901A\u8FC7 Inbox \u5F39\u7A97\u548C\u50AC\u529E\u63D0\u9192\uFF1B\u6D4F\u89C8\u5668\u5173\u95ED\u65F6\u65E0\u6CD5\u7AD9\u5916\u9001\u8FBE\u3002\u914D\u7F6E OASIS_ESCALATION_WEBHOOKS \u53EF\u63A5\u90AE\u4EF6/IM \u7F51\u5173\u3002");
|
|
239438
|
-
}
|
|
239439
238677
|
const slaTimer = setInterval(() => {
|
|
239440
|
-
void
|
|
239441
|
-
return (async () => {
|
|
238678
|
+
void (async () => {
|
|
239442
238679
|
const now = Date.now();
|
|
239443
238680
|
for (const a of kernel.model.artifacts.values()) {
|
|
239444
238681
|
if (slaEscalating.has(a.id)) continue;
|
|
@@ -239462,6 +238699,7 @@ async function startServe(opts) {
|
|
|
239462
238699
|
const fusedAll = [];
|
|
239463
238700
|
const starvingAll = [];
|
|
239464
238701
|
const stuckAll = [];
|
|
238702
|
+
const recoveredAll = [];
|
|
239465
238703
|
const newEngineStore = newEngine.kernel.getStore?.();
|
|
239466
238704
|
if (newEngineStore) {
|
|
239467
238705
|
try {
|
|
@@ -239469,6 +238707,7 @@ async function startServe(opts) {
|
|
|
239469
238707
|
fusedAll.push(...newSla.fused);
|
|
239470
238708
|
starvingAll.push(...newSla.starving);
|
|
239471
238709
|
stuckAll.push(...newSla.stuck);
|
|
238710
|
+
recoveredAll.push(...newSla.recovered);
|
|
239472
238711
|
} catch (err) {
|
|
239473
238712
|
console.error("[sla] \u65B0\u5F15\u64CE SLA \u4FE1\u53F7\u6536\u96C6\u5931\u8D25:", err);
|
|
239474
238713
|
}
|
|
@@ -239556,6 +238795,26 @@ ${nodeFault}` : "");
|
|
|
239556
238795
|
console.error(`[sla] \u6EDE\u7559\u5347\u7EA7\u5931\u8D25 ${st.artifactId}: ${String(err)}`);
|
|
239557
238796
|
}
|
|
239558
238797
|
}
|
|
238798
|
+
for (const rec of recoveredAll) {
|
|
238799
|
+
const misses = (stallRecoveryMisses.get(rec.issueId)?.misses ?? 0) + 1;
|
|
238800
|
+
stallRecoveryMisses.set(rec.issueId, { misses, artifactId: rec.artifactId });
|
|
238801
|
+
if (misses < STALL_RECOVERY_TICKS) continue;
|
|
238802
|
+
try {
|
|
238803
|
+
await kernel.resolveEscalation({
|
|
238804
|
+
escalationId: rec.issueId,
|
|
238805
|
+
actor: SYSTEM_ACTOR,
|
|
238806
|
+
reason: `\u7CFB\u7EDF\u81EA\u52A8\u5173\u95ED\uFF1A${rec.reason}\uFF08\u8FDE\u7EED ${STALL_RECOVERY_TICKS} \u62CD\u4E0D\u518D\u547D\u4E2D\u300C\u4EA4\u4ED8\u6210\u529F\u5374\u6536\u4E0D\u4E86\u53E3\u300D\uFF09\u3002`
|
|
238807
|
+
});
|
|
238808
|
+
stallRecoveryMisses.delete(rec.issueId);
|
|
238809
|
+
console.log(`[sla] ${rec.artifactId} \u8BC4\u5BA1\u6EDE\u7559\u5361\u81EA\u52A8\u5173\u95ED\uFF1A${rec.reason}`);
|
|
238810
|
+
} catch (err) {
|
|
238811
|
+
console.error(`[sla] \u8BC4\u5BA1\u6EDE\u7559\u5361\u81EA\u52A8\u5173\u95ED\u5931\u8D25 ${rec.issueId}: ${String(err)}`);
|
|
238812
|
+
}
|
|
238813
|
+
}
|
|
238814
|
+
const stuckNodeIds = new Set(stuckAll.map((x2) => x2.artifactId));
|
|
238815
|
+
for (const [issueId, st] of [...stallRecoveryMisses]) {
|
|
238816
|
+
if (stuckNodeIds.has(st.artifactId)) stallRecoveryMisses.delete(issueId);
|
|
238817
|
+
}
|
|
239559
238818
|
})().catch((err) => console.error(`[sla] \u626B\u63CF\u5931\u8D25: ${String(err)}`));
|
|
239560
238819
|
}, opts.sla?.scanMs ?? 6e4);
|
|
239561
238820
|
let mirrorTimer;
|
|
@@ -239717,9 +238976,9 @@ ${nodeFault}` : "");
|
|
|
239717
238976
|
}
|
|
239718
238977
|
const orphanIntervalMs = opts.orphanSweep?.intervalMs ?? 3e4;
|
|
239719
238978
|
if (orphanIntervalMs > 0) {
|
|
239720
|
-
const orphanGraceMs = opts.orphanSweep?.graceMs ??
|
|
238979
|
+
const orphanGraceMs = opts.orphanSweep?.graceMs ?? 12e4;
|
|
239721
238980
|
const orphanAbsoluteMaxMs = opts.orphanSweep?.absoluteMaxMs ?? 150 * 6e4;
|
|
239722
|
-
const orphanColdStartGraceMs = opts.orphanSweep?.coldStartGraceMs ?? Number(process.env["OASIS_ORPHAN_COLD_START_GRACE_MS"] ??
|
|
238981
|
+
const orphanColdStartGraceMs = opts.orphanSweep?.coldStartGraceMs ?? Number(process.env["OASIS_ORPHAN_COLD_START_GRACE_MS"] ?? 18e4);
|
|
239723
238982
|
const serverStartedAtMs = Date.parse(serverStartedAt);
|
|
239724
238983
|
const inFlightRunIds = () => {
|
|
239725
238984
|
const ids2 = /* @__PURE__ */ new Set();
|
|
@@ -239727,7 +238986,6 @@ ${nodeFault}` : "");
|
|
|
239727
238986
|
for (const c of chatLiveSessions.values()) ids2.add(c.sessionId);
|
|
239728
238987
|
return ids2;
|
|
239729
238988
|
};
|
|
239730
|
-
const liveSessionRunIds = () => hub?.liveSessionDispatchIds() ?? /* @__PURE__ */ new Set();
|
|
239731
238989
|
const aliveArtifactIds = () => {
|
|
239732
238990
|
const ids2 = /* @__PURE__ */ new Set();
|
|
239733
238991
|
for (const d of hub?.connectedDaemons() ?? []) {
|
|
@@ -239758,8 +239016,6 @@ ${nodeFault}` : "");
|
|
|
239758
239016
|
aliveArtifactIds,
|
|
239759
239017
|
apiActiveDispatchIds,
|
|
239760
239018
|
// D1(ADR-0078):判活第二条线
|
|
239761
|
-
liveSessionRunIds,
|
|
239762
|
-
// ADR-0300 D8:hub 活数据面连接(协调者/独立会话进程)
|
|
239763
239019
|
closeRun,
|
|
239764
239020
|
now: Date.now(),
|
|
239765
239021
|
orphanGraceMs,
|
|
@@ -239939,7 +239195,6 @@ ${nodeFault}` : "");
|
|
|
239939
239195
|
close: async () => {
|
|
239940
239196
|
for (const timer of dispatchTimers) clearInterval(timer);
|
|
239941
239197
|
clearInterval(slaTimer);
|
|
239942
|
-
escalationDeliveryWorker.stop();
|
|
239943
239198
|
if (mirrorTimer) clearInterval(mirrorTimer);
|
|
239944
239199
|
if (gitTimer) clearInterval(gitTimer);
|
|
239945
239200
|
if (coordTimer) clearInterval(coordTimer);
|
|
@@ -240039,7 +239294,7 @@ function log2(tag, msg, extra) {
|
|
|
240039
239294
|
}
|
|
240040
239295
|
|
|
240041
239296
|
// ../cli/src/daemon/session-lock.ts
|
|
240042
|
-
var
|
|
239297
|
+
var import_node_child_process18 = require("node:child_process");
|
|
240043
239298
|
var fs33 = __toESM(require("node:fs"), 1);
|
|
240044
239299
|
var path30 = __toESM(require("node:path"), 1);
|
|
240045
239300
|
var flockAvailable = null;
|
|
@@ -240047,7 +239302,7 @@ function hasFlock() {
|
|
|
240047
239302
|
if (flockAvailable !== null) return flockAvailable;
|
|
240048
239303
|
if (process.platform !== "linux") return flockAvailable = false;
|
|
240049
239304
|
try {
|
|
240050
|
-
const r = (0,
|
|
239305
|
+
const r = (0, import_node_child_process18.spawnSync)("flock", ["--version"], { stdio: "ignore", timeout: 3e3 });
|
|
240051
239306
|
flockAvailable = r.status === 0;
|
|
240052
239307
|
} catch {
|
|
240053
239308
|
flockAvailable = false;
|
|
@@ -240062,7 +239317,7 @@ function acquireSessionLock(lockPath) {
|
|
|
240062
239317
|
fs33.unlinkSync(readyFile);
|
|
240063
239318
|
} catch {
|
|
240064
239319
|
}
|
|
240065
|
-
const child = (0,
|
|
239320
|
+
const child = (0, import_node_child_process18.spawn)("flock", ["-n", lockPath, "-c", `printf ok > '${readyFile}'; exec cat`], {
|
|
240066
239321
|
stdio: ["pipe", "ignore", "ignore"],
|
|
240067
239322
|
detached: true
|
|
240068
239323
|
});
|
|
@@ -240073,7 +239328,7 @@ function acquireSessionLock(lockPath) {
|
|
|
240073
239328
|
ready = true;
|
|
240074
239329
|
break;
|
|
240075
239330
|
}
|
|
240076
|
-
(0,
|
|
239331
|
+
(0, import_node_child_process18.spawnSync)("sleep", ["0.02"], { stdio: "ignore" });
|
|
240077
239332
|
}
|
|
240078
239333
|
try {
|
|
240079
239334
|
fs33.unlinkSync(readyFile);
|
|
@@ -240104,7 +239359,7 @@ function isSessionLocked(lockPath) {
|
|
|
240104
239359
|
if (!hasFlock()) return false;
|
|
240105
239360
|
if (!fs33.existsSync(lockPath)) return false;
|
|
240106
239361
|
try {
|
|
240107
|
-
const r = (0,
|
|
239362
|
+
const r = (0, import_node_child_process18.spawnSync)("flock", ["-n", lockPath, "-c", "true"], { stdio: "ignore", timeout: 3e3 });
|
|
240108
239363
|
return r.status !== 0;
|
|
240109
239364
|
} catch {
|
|
240110
239365
|
return true;
|
|
@@ -240178,11 +239433,8 @@ async function runSession(dispatchId, job, deps) {
|
|
|
240178
239433
|
// ../cli/src/daemon/session-process.ts
|
|
240179
239434
|
var RECONNECT_MIN_MS = 1e3;
|
|
240180
239435
|
var RECONNECT_MAX_MS = 3e4;
|
|
240181
|
-
var EXIT_ACK_WAIT_MS =
|
|
240182
|
-
var OUTBOX_MAX_FRAMES = 8e3;
|
|
240183
|
-
var isKeyFrame = (m2) => m2.type === "session_started" || m2.type === "session_exited";
|
|
239436
|
+
var EXIT_ACK_WAIT_MS = 1e4;
|
|
240184
239437
|
async function runSessionProcess(specFile, adapter) {
|
|
240185
|
-
process.env["OASIS_BIND_RUNTIME_PDEATHSIG"] = "1";
|
|
240186
239438
|
const spec = readSpec(specFile);
|
|
240187
239439
|
const { dispatchId, job, auth, sessionDir } = spec;
|
|
240188
239440
|
const lock = acquireSessionLock(path31.join(sessionDir, "lock"));
|
|
@@ -240236,10 +239488,6 @@ var SessionProcessState = class {
|
|
|
240236
239488
|
* 而会话其实正在跑。
|
|
240237
239489
|
*/
|
|
240238
239490
|
outbox = [];
|
|
240239
|
-
/** ADR 0300 D2:每 dispatch 单调帧号,任何副作用之前分配。 */
|
|
240240
|
-
frameSeq = 0;
|
|
240241
|
-
/** 收到过带 `ackSeq` 的 ack = 本服务端会按帧号去重;只有它为真,重连才敢重放**全部**帧(含输出)。 */
|
|
240242
|
-
serverSupportsDedup = false;
|
|
240243
239491
|
/** append_input 串行链——保证回帧次序 = 到达次序(server 侧按 FIFO 认领等待者)。 */
|
|
240244
239492
|
appendChain = Promise.resolve();
|
|
240245
239493
|
async run() {
|
|
@@ -240305,12 +239553,9 @@ var SessionProcessState = class {
|
|
|
240305
239553
|
daemonVersion: this.spec.daemonVersion,
|
|
240306
239554
|
// 自报身份要够服务端对上账:chat 道的对账键是 artifactId(run.id=chat-run:* ≠ dispatchId),
|
|
240307
239555
|
// 只报 dispatchId 的话 serve 重启后它认不出这是条活会话,会当成野进程 evict 掉。
|
|
240308
|
-
...this.spec.job.artifactId ? { jobArtifactId: this.spec.job.artifactId } : {}
|
|
240309
|
-
// ADR 0300 D2:自报支持帧号;新服务端据此回带 ackSeq 的 hello-ack,届时才把 serverSupportsDedup 置真。
|
|
240310
|
-
supportsFrameSeq: true
|
|
239556
|
+
...this.spec.job.artifactId ? { jobArtifactId: this.spec.job.artifactId } : {}
|
|
240311
239557
|
});
|
|
240312
|
-
const
|
|
240313
|
-
for (const m2 of toResend) this.rawSend(m2);
|
|
239558
|
+
for (const m2 of this.outbox) this.rawSend(m2);
|
|
240314
239559
|
});
|
|
240315
239560
|
ws.on("message", (raw) => {
|
|
240316
239561
|
let msg;
|
|
@@ -240358,14 +239603,8 @@ var SessionProcessState = class {
|
|
|
240358
239603
|
}
|
|
240359
239604
|
case "ack":
|
|
240360
239605
|
if (msg.dispatchId !== this.spec.dispatchId) return;
|
|
240361
|
-
|
|
240362
|
-
|
|
240363
|
-
const wm = msg.ackSeq;
|
|
240364
|
-
this.outbox = this.outbox.filter((f2) => (f2.seq ?? 0) > wm);
|
|
240365
|
-
} else {
|
|
240366
|
-
this.outbox.length = 0;
|
|
240367
|
-
}
|
|
240368
|
-
if (this.outbox.length === 0) this.exitAckResolve?.();
|
|
239606
|
+
this.outbox.length = 0;
|
|
239607
|
+
this.exitAckResolve?.();
|
|
240369
239608
|
return;
|
|
240370
239609
|
case "ping":
|
|
240371
239610
|
this.rawSend({ type: "pong" });
|
|
@@ -240380,20 +239619,14 @@ var SessionProcessState = class {
|
|
|
240380
239619
|
this.ws.send(JSON.stringify(msg));
|
|
240381
239620
|
return true;
|
|
240382
239621
|
}
|
|
240383
|
-
/**
|
|
240384
|
-
stampAndBuffer(msg) {
|
|
240385
|
-
const framed = { ...msg, seq: ++this.frameSeq };
|
|
240386
|
-
this.outbox.push(framed);
|
|
240387
|
-
if (this.outbox.length > OUTBOX_MAX_FRAMES) this.outbox.splice(0, this.outbox.length - OUTBOX_MAX_FRAMES);
|
|
240388
|
-
return framed;
|
|
240389
|
-
}
|
|
240390
|
-
/** 关键帧(started/exited):必达,进 outbox,ack 到达(按 ackSeq 或整清)才删。 */
|
|
239622
|
+
/** 必达:先进 outbox 再尽力发;ack 到达才清。 */
|
|
240391
239623
|
sendKeyFrame(msg) {
|
|
240392
|
-
this.
|
|
239624
|
+
this.outbox.push(msg);
|
|
239625
|
+
this.rawSend(msg);
|
|
240393
239626
|
}
|
|
240394
|
-
/**
|
|
239627
|
+
/** 可丢:连着就发,断着就算了。输出流不值得为它攒内存——真需要补的是必达帧。 */
|
|
240395
239628
|
sendStream(msg) {
|
|
240396
|
-
this.rawSend(
|
|
239629
|
+
this.rawSend(msg);
|
|
240397
239630
|
}
|
|
240398
239631
|
// ── 看门狗(D2′.5 防线 3 + 防线 1 后半)──────────────────────────────────
|
|
240399
239632
|
startWatchdog() {
|
|
@@ -240418,7 +239651,7 @@ var SessionProcessState = class {
|
|
|
240418
239651
|
await this.handle?.kill();
|
|
240419
239652
|
} catch {
|
|
240420
239653
|
}
|
|
240421
|
-
this.
|
|
239654
|
+
this.rawSend({
|
|
240422
239655
|
type: "session_exited",
|
|
240423
239656
|
dispatchId: this.spec.dispatchId,
|
|
240424
239657
|
sessionId: this.handle?.id ?? this.spec.dispatchId,
|
|
@@ -240465,7 +239698,7 @@ init_src8();
|
|
|
240465
239698
|
init_src7();
|
|
240466
239699
|
|
|
240467
239700
|
// ../cli/src/daemon/detect-adapters.ts
|
|
240468
|
-
var
|
|
239701
|
+
var import_node_child_process19 = require("node:child_process");
|
|
240469
239702
|
init_src7();
|
|
240470
239703
|
var KNOWN2 = [
|
|
240471
239704
|
{ adapter: "claude-code", binary: "claude" },
|
|
@@ -240489,7 +239722,7 @@ var LIVE_PROTOCOL_RUNTIMES = /* @__PURE__ */ new Set(["claude-code"]);
|
|
|
240489
239722
|
function resolveOnPath2(binary) {
|
|
240490
239723
|
try {
|
|
240491
239724
|
const cmd = process.platform === "win32" ? "where" : "which";
|
|
240492
|
-
const out = (0,
|
|
239725
|
+
const out = (0, import_node_child_process19.execFileSync)(cmd, [binary], { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] });
|
|
240493
239726
|
const first = out.split("\n")[0]?.trim();
|
|
240494
239727
|
return first || binary;
|
|
240495
239728
|
} catch {
|
|
@@ -240498,7 +239731,7 @@ function resolveOnPath2(binary) {
|
|
|
240498
239731
|
}
|
|
240499
239732
|
function versionOf(binary) {
|
|
240500
239733
|
try {
|
|
240501
|
-
return (0,
|
|
239734
|
+
return (0, import_node_child_process19.execFileSync)(binary, ["--version"], {
|
|
240502
239735
|
encoding: "utf8",
|
|
240503
239736
|
stdio: ["ignore", "pipe", "ignore"],
|
|
240504
239737
|
timeout: 1500
|
|
@@ -241454,7 +240687,7 @@ async function startNode(opts) {
|
|
|
241454
240687
|
}
|
|
241455
240688
|
|
|
241456
240689
|
// ../cli/src/exec.ts
|
|
241457
|
-
var
|
|
240690
|
+
var os10 = __toESM(require("node:os"), 1);
|
|
241458
240691
|
var UnsafeExecArgvError = class extends Error {
|
|
241459
240692
|
code = "ERR_UNSAFE_EXEC_ARGV";
|
|
241460
240693
|
constructor(message) {
|
|
@@ -241491,7 +240724,7 @@ function planExec(opts) {
|
|
|
241491
240724
|
function computeExitCode(code2, signal) {
|
|
241492
240725
|
if (code2 !== null) return code2;
|
|
241493
240726
|
if (signal) {
|
|
241494
|
-
const num2 =
|
|
240727
|
+
const num2 = os10.constants.signals[signal];
|
|
241495
240728
|
return 128 + (typeof num2 === "number" ? num2 : 1);
|
|
241496
240729
|
}
|
|
241497
240730
|
return 1;
|
|
@@ -241515,7 +240748,7 @@ function forwardSignal(child, sig, killGroup = (pgid, signal) => {
|
|
|
241515
240748
|
}
|
|
241516
240749
|
|
|
241517
240750
|
// ../cli/src/daemon/machine-id.ts
|
|
241518
|
-
var
|
|
240751
|
+
var import_node_child_process20 = require("node:child_process");
|
|
241519
240752
|
var import_node_fs20 = require("node:fs");
|
|
241520
240753
|
var import_node_crypto62 = require("node:crypto");
|
|
241521
240754
|
var import_node_os12 = require("node:os");
|
|
@@ -241531,7 +240764,7 @@ function linuxMachineId() {
|
|
|
241531
240764
|
}
|
|
241532
240765
|
function macMachineId() {
|
|
241533
240766
|
try {
|
|
241534
|
-
const out = (0,
|
|
240767
|
+
const out = (0, import_node_child_process20.execFileSync)("ioreg", ["-rd1", "-c", "IOPlatformExpertDevice"], {
|
|
241535
240768
|
encoding: "utf8",
|
|
241536
240769
|
timeout: 2e3,
|
|
241537
240770
|
stdio: ["ignore", "pipe", "ignore"]
|
|
@@ -241544,7 +240777,7 @@ function macMachineId() {
|
|
|
241544
240777
|
}
|
|
241545
240778
|
function windowsMachineId() {
|
|
241546
240779
|
try {
|
|
241547
|
-
const out = (0,
|
|
240780
|
+
const out = (0, import_node_child_process20.execFileSync)("reg", [
|
|
241548
240781
|
"query",
|
|
241549
240782
|
"HKLM\\SOFTWARE\\Microsoft\\Cryptography",
|
|
241550
240783
|
"/v",
|
|
@@ -241805,6 +241038,30 @@ var COMMAND_DECLS = {
|
|
|
241805
241038
|
],
|
|
241806
241039
|
examples: ["oasis kb lint"]
|
|
241807
241040
|
},
|
|
241041
|
+
delegate: {
|
|
241042
|
+
group: "\u59D4\u6D3E\u4E13\u5BB6",
|
|
241043
|
+
usage: 'oasis delegate --to <role|actorId> --task "<\u4EFB\u52A1\u4E66>" [--as <\u77ED\u540D>] [--file <\u8DEF\u5F84>]... [--json true]\n oasis delegate --continue <\u5F15\u7528> --text "<...>" [--file <\u8DEF\u5F84>]...\n oasis delegate --status <\u5F15\u7528> [--json true]\n oasis delegate --list [--all] [--json true]',
|
|
241044
|
+
description: "\u628A\u4E00\u4EF6\u4E8B\u4EA4\u7ED9\u7EC4\u7EC7\u91CC\u5BF9\u53E3\u7684\u4E13\u5BB6\u53BB\u505A\uFF08\u5F02\u6B65\uFF09\u3002\u547D\u4EE4\u7ACB\u5373\u8FD4\u56DE\uFF0C\u4E13\u5BB6\u5E72\u5B8C\u4E86\u7ED3\u679C\u81EA\u5DF1\u56DE\u5230\u8FD9\u6761\u5BF9\u8BDD\u2014\u2014**\u4E0D\u8981\u5728\u8FD9\u91CC\u7B49**\u3002",
|
|
241045
|
+
flags: [
|
|
241046
|
+
{ name: "to", desc: "\u6D3E\u7ED9\u8C01\uFF1A\u5C97\u4F4D\u540D\u6216 actorId\uFF08\u5C97\u4F4D 0 \u4EBA\u5728\u5C97 / \u7ED1\u5B9A\u4E0D\u53EF\u7528\u4F1A\u5F53\u573A\u62A5\u9519\uFF0C\u90A3\u65F6\u81EA\u5DF1\u505A\uFF09" },
|
|
241047
|
+
{ name: "task", desc: "\u4EFB\u52A1\u4E66\u5168\u6587\u2014\u2014\u4E13\u5BB6**\u552F\u4E00**\u7684\u4E0A\u4E0B\u6587\u6765\u6E90\uFF0C\u5199\u5168\uFF1B\u4E0D\u8BBE\u957F\u5EA6\u4E0A\u9650\u3001\u4E0D\u622A\u65AD" },
|
|
241048
|
+
{ name: "as", desc: "\u7ED9\u8FD9\u6B21\u59D4\u6D3E\u8D77\u4E2A\u77ED\u540D\uFF0C\u4E4B\u540E\u7528\u5B83 --continue\uFF1B\u649E\u540D\u670D\u52A1\u7AEF\u81EA\u52A8\u52A0\u540E\u7F00\uFF0C**\u4EE5\u8F93\u51FA\u91CC\u90A3\u4E2A\u4E3A\u51C6**" },
|
|
241049
|
+
{ name: "file", desc: "\u4E00\u8D77\u5E26\u8FC7\u53BB\u7684\u6587\u4EF6\uFF08\u4F60\u5DE5\u4F5C\u76EE\u5F55\u4E0B\u7684\u76F8\u5BF9\u8DEF\u5F84\uFF0C\u53EF\u7ED9\u591A\u6B21\uFF1B\u5355\u4E2A \u22642MB\u3001\u4E00\u6B21 \u226420 \u4E2A / 20MB\uFF09" },
|
|
241050
|
+
{ name: "continue", desc: "\u5F80\u5DF2\u6709\u59D4\u6D3E\u91CC\u518D\u8F6C\u8FBE\u4E00\u53E5\uFF1A\u7ED9 label / \u4E13\u5BB6\u540D / delegationId \u524D\u7F00" },
|
|
241051
|
+
{ name: "text", desc: "\u8F6C\u8FBE\u5185\u5BB9\uFF08\u914D --continue\uFF09\u3002\u6539\u65B9\u5411\u5C31\u660E\u8BF4\u300C\u6539\u65B9\u5411\u300D\uFF0C\u4E13\u5BB6\u4F1A\u81EA\u5DF1\u5224\u65AD\u8981\u4E0D\u8981\u653E\u5F03\u624B\u4E0A\u90A3\u6BB5" },
|
|
241052
|
+
{ name: "status", desc: "\u770B\u4E00\u4E2A\u59D4\u6D3E\u7684\u8BE6\u60C5\uFF1A\u5168\u91CF\u5404\u8F6E\u5C0F\u7ED3 + \u4EA7\u7269\u6E05\u5355" },
|
|
241053
|
+
{ name: "list", desc: "\u5217\u51FA\u8FD9\u6761\u5BF9\u8BDD\u6D3E\u51FA\u53BB\u7684\u6D3B\uFF1B\u9ED8\u8BA4\u53EA\u7ED9\u8FDB\u884C\u4E2D + \u6700\u8FD1 10 \u6761", boolean: true },
|
|
241054
|
+
{ name: "all", desc: "\u914D --list\uFF1A\u8FDE\u5386\u53F2\u59D4\u6D3E\u4E00\u8D77\u5217", boolean: true },
|
|
241055
|
+
{ name: "json", desc: "\u8F93\u51FA JSON" }
|
|
241056
|
+
],
|
|
241057
|
+
examples: [
|
|
241058
|
+
'oasis delegate --to \u8BBE\u8BA1\u5E08 --task "\u628A\u767B\u5F55\u9875\u91CD\u753B\u4E00\u7248\uFF1A\u6DF1\u8272\u3001\u5706\u89D2 8px\u3001\u4E3B\u8272 #3B82F6\u3002\u4EA4\u4ED8\u7269\u653E outputs/\u3002" --as \u767B\u5F55\u9875',
|
|
241059
|
+
'oasis delegate --to \u8BBE\u8BA1\u5E08 --task "\u6309\u8FD9\u5F20\u53C2\u8003\u56FE\u91CD\u753B" --file inputs/attachments/ref.png',
|
|
241060
|
+
'oasis delegate --continue \u767B\u5F55\u9875 --text "\u7528\u6237\u6539\u65B9\u5411\uFF1A\u4E3B\u8272\u6362\u6210\u7EFF\u8272\uFF08\u624B\u4E0A\u8FD9\u6BB5\u53EF\u80FD\u8981\u4F5C\u5E9F\uFF0C\u4F60\u81EA\u5DF1\u5224\u65AD\uFF09"',
|
|
241061
|
+
"oasis delegate --list",
|
|
241062
|
+
"oasis delegate --status \u767B\u5F55\u9875"
|
|
241063
|
+
]
|
|
241064
|
+
},
|
|
241808
241065
|
"node-token": {
|
|
241809
241066
|
group: "\u57FA\u7840\u8BBE\u65BD",
|
|
241810
241067
|
usage: "oasis node-token issue [--id node-xxx] | list | revoke <token>",
|
|
@@ -242875,20 +242132,20 @@ var COMMAND_DECLS = {
|
|
|
242875
242132
|
hold: {
|
|
242876
242133
|
group: "\u56FE\u673A\u5236\uFF08\xA76/\xA77\uFF09",
|
|
242877
242134
|
usage: "oasis hold <artifactId> [--reason <t>] [--source <t>]",
|
|
242878
|
-
description: "\u505C\
|
|
242135
|
+
description: "\u6682\u505C\u67D0\u4EA7\u7269\u7684\u6D3E\u53D1\uFF08node-hold\uFF09\u2014\u2014\u53EA\u6321 agent \u6D3E\u53D1\u3001\u4E0D\u9501\u5185\u5BB9\uFF08\u2260 oasis freeze\uFF09\uFF1B\u6062\u590D\u7528 oasis release\u3002",
|
|
242879
242136
|
positional: [
|
|
242880
242137
|
{ name: "<artifactId>", required: true, desc: "\u4EA7\u7269 id" }
|
|
242881
242138
|
],
|
|
242882
242139
|
flags: [
|
|
242883
|
-
{ name: "reason", desc: "\u505C\
|
|
242140
|
+
{ name: "reason", desc: "\u6682\u505C\u539F\u56E0" },
|
|
242884
242141
|
{ name: "source", desc: "\u89E6\u53D1\u6765\u6E90\u6807\u8BB0\uFF08\u7528\u4E8E\u5206\u7C7B\u5F52\u56E0\uFF1B\u8FDB\u64CD\u4F5C\u65E5\u5FD7\uFF09" }
|
|
242885
242142
|
],
|
|
242886
|
-
examples: ['oasis hold artifact:dev:abc --reason "\
|
|
242143
|
+
examples: ['oasis hold artifact:dev:abc --reason "\u7B49\u5F85\u4E0A\u6E38 PRD \u66F4\u65B0"']
|
|
242887
242144
|
},
|
|
242888
242145
|
release: {
|
|
242889
242146
|
group: "\u56FE\u673A\u5236\uFF08\xA76/\xA77\uFF09",
|
|
242890
242147
|
usage: "oasis release <artifactId> [--reason <t>]",
|
|
242891
|
-
description: "\
|
|
242148
|
+
description: "\u91CA\u653E\u6682\u505C\u7684\u4EA7\u7269\uFF08\u6062\u590D\u6D3E\u53D1\uFF09\u3002",
|
|
242892
242149
|
positional: [
|
|
242893
242150
|
{ name: "<artifactId>", required: true, desc: "\u4EA7\u7269 id" }
|
|
242894
242151
|
],
|
|
@@ -243202,6 +242459,7 @@ var GROUP_ORDER = [
|
|
|
243202
242459
|
"\u56FE\u673A\u5236\uFF08\xA76/\xA77\uFF09",
|
|
243203
242460
|
"\u957F\u671F\u8BB0\u5FC6\uFF08ADR-0084/0102\uFF09",
|
|
243204
242461
|
"\u77E5\u8BC6\u5E93",
|
|
242462
|
+
"\u59D4\u6D3E\u4E13\u5BB6",
|
|
243205
242463
|
"\u751F\u547D\u5468\u671F",
|
|
243206
242464
|
"\u89D2\u8272 & \u4EBA\u5458",
|
|
243207
242465
|
"\u8BFB\u4EA7\u7269",
|
|
@@ -243266,7 +242524,7 @@ function ownFlagsFromDecl(command) {
|
|
|
243266
242524
|
|
|
243267
242525
|
// ../cli/src/connector-effect-runner.ts
|
|
243268
242526
|
var import_node_crypto63 = require("node:crypto");
|
|
243269
|
-
var
|
|
242527
|
+
var import_node_child_process21 = require("node:child_process");
|
|
243270
242528
|
init_src8();
|
|
243271
242529
|
function stableKey(effect) {
|
|
243272
242530
|
const keyFields = Object.fromEntries(Object.entries(effect.keyFields).sort(([a], [b2]) => a.localeCompare(b2)));
|
|
@@ -243325,7 +242583,7 @@ function productionApi() {
|
|
|
243325
242583
|
}
|
|
243326
242584
|
function execute(bin, args) {
|
|
243327
242585
|
return new Promise((resolve12, reject) => {
|
|
243328
|
-
const child = (0,
|
|
242586
|
+
const child = (0, import_node_child_process21.spawn)(bin, args, { stdio: "inherit", env: process.env });
|
|
243329
242587
|
child.once("error", reject);
|
|
243330
242588
|
child.once("exit", (code2, signal) => resolve12(code2 ?? (signal ? 128 : 1)));
|
|
243331
242589
|
});
|
|
@@ -243345,7 +242603,7 @@ async function runConnectorEffectCli(argv) {
|
|
|
243345
242603
|
}
|
|
243346
242604
|
|
|
243347
242605
|
// ../cli/src/workspace-recovery.ts
|
|
243348
|
-
var
|
|
242606
|
+
var import_node_child_process22 = require("node:child_process");
|
|
243349
242607
|
var import_node_zlib3 = require("node:zlib");
|
|
243350
242608
|
var fs38 = __toESM(require("node:fs"), 1);
|
|
243351
242609
|
var path35 = __toESM(require("node:path"), 1);
|
|
@@ -243399,7 +242657,7 @@ function findRuntimeWorkdir(cwd = process.cwd()) {
|
|
|
243399
242657
|
}
|
|
243400
242658
|
}
|
|
243401
242659
|
function git3(cwd, args) {
|
|
243402
|
-
return (0,
|
|
242660
|
+
return (0, import_node_child_process22.execFileSync)("git", ["-C", cwd, ...args], {
|
|
243403
242661
|
encoding: "utf8",
|
|
243404
242662
|
stdio: ["ignore", "pipe", "ignore"],
|
|
243405
242663
|
maxBuffer: 64 * 1024 * 1024,
|
|
@@ -243602,6 +242860,7 @@ var HISTORICAL_REVIEW_GUIDANCE = "\u672C\u7968\u4E0D\u53C2\u4E0E\u672C\u8F6E quo
|
|
|
243602
242860
|
function parseArgs(argv) {
|
|
243603
242861
|
const positional = [];
|
|
243604
242862
|
const flags = /* @__PURE__ */ new Map();
|
|
242863
|
+
const repeated = /* @__PURE__ */ new Map();
|
|
243605
242864
|
const booleanFlags = /* @__PURE__ */ new Set([
|
|
243606
242865
|
...declaredBooleanFlags(),
|
|
243607
242866
|
"checkpoint",
|
|
@@ -243628,13 +242887,14 @@ function parseArgs(argv) {
|
|
|
243628
242887
|
flags.set(key, "true");
|
|
243629
242888
|
} else {
|
|
243630
242889
|
flags.set(key, value2);
|
|
242890
|
+
repeated.set(key, [...repeated.get(key) ?? [], value2]);
|
|
243631
242891
|
i++;
|
|
243632
242892
|
}
|
|
243633
242893
|
} else {
|
|
243634
242894
|
positional.push(a);
|
|
243635
242895
|
}
|
|
243636
242896
|
}
|
|
243637
|
-
return { positional, flags };
|
|
242897
|
+
return { positional, flags, repeated };
|
|
243638
242898
|
}
|
|
243639
242899
|
function need(flags, name) {
|
|
243640
242900
|
const v2 = flags.get(name);
|
|
@@ -243729,7 +242989,7 @@ async function waitForCommandAuthorization(base, headers, draftId, fallback) {
|
|
|
243729
242989
|
process.stderr.write("\u4ECD\u5728\u7B49\u5F85\u4EBA\u5DE5\u6388\u6743\u2026\u2026\uFF08\u65E0\u9700\u5E72\u9884\uFF0C\u4EBA\u70B9\u786E\u8BA4\u540E\u672C\u547D\u4EE4\u4F1A\u50CF\u666E\u901A\u547D\u4EE4\u4E00\u6837\u8FD4\u56DE\uFF09\n");
|
|
243730
242990
|
}, 3e4);
|
|
243731
242991
|
try {
|
|
243732
|
-
const res = await fetch(`${base}/api/intervention/wait?draftId=${encodeURIComponent(draftId)}
|
|
242992
|
+
const res = await fetch(`${base}/api/intervention/wait?draftId=${encodeURIComponent(draftId)}`, {
|
|
243733
242993
|
method: "GET",
|
|
243734
242994
|
headers: { ...headers, accept: "text/event-stream" },
|
|
243735
242995
|
signal: controller.signal
|
|
@@ -243965,7 +243225,7 @@ async function runCli(argv, println = console.log, progressln = console.error) {
|
|
|
243965
243225
|
println(USAGE);
|
|
243966
243226
|
return;
|
|
243967
243227
|
}
|
|
243968
|
-
const { positional, flags } = parseArgs(rest);
|
|
243228
|
+
const { positional, flags, repeated } = parseArgs(rest);
|
|
243969
243229
|
if (flags.get("help") === "true") {
|
|
243970
243230
|
const fullKey = [command, ...positional].join(" ");
|
|
243971
243231
|
if (COMMAND_HELP[fullKey]) {
|
|
@@ -243997,7 +243257,7 @@ async function runCli(argv, println = console.log, progressln = console.error) {
|
|
|
243997
243257
|
const res = await fetch(`${httpBase2}/api/nodes/exchange`, {
|
|
243998
243258
|
method: "POST",
|
|
243999
243259
|
headers: { "content-type": "application/json" },
|
|
244000
|
-
body: JSON.stringify({ enrollToken, nodeId, hostname:
|
|
243260
|
+
body: JSON.stringify({ enrollToken, nodeId, hostname: os11.hostname() })
|
|
244001
243261
|
});
|
|
244002
243262
|
if (!res.ok) throw new Error(`enroll token exchange failed: HTTP ${res.status}`);
|
|
244003
243263
|
const body2 = await res.json();
|
|
@@ -244030,7 +243290,7 @@ async function runCli(argv, println = console.log, progressln = console.error) {
|
|
|
244030
243290
|
const binPath = path36.join(prefix, "bin", "oasis_test");
|
|
244031
243291
|
const svcArgs = `node --server-ws ${serverUrl} --dir ${dir}${nodeName ? ` --name ${nodeName}` : ""}`;
|
|
244032
243292
|
if (process.platform === "linux") {
|
|
244033
|
-
const svcFile = path36.join(
|
|
243293
|
+
const svcFile = path36.join(os11.homedir(), ".config/systemd/user/oasis-node.service");
|
|
244034
243294
|
fs39.mkdirSync(path36.dirname(svcFile), { recursive: true });
|
|
244035
243295
|
if (spawnSync3("systemctl", ["--user", "is-active", "--quiet", "oasis-node"], {}).status === 0)
|
|
244036
243296
|
spawnSync3("systemctl", ["--user", "stop", "oasis-node"], { stdio: "inherit" });
|
|
@@ -244043,7 +243303,7 @@ async function runCli(argv, println = console.log, progressln = console.error) {
|
|
|
244043
243303
|
`ExecStart=${binPath} ${svcArgs}`,
|
|
244044
243304
|
// Carry the install-time PATH so the detached daemon detects CLIs in user dirs
|
|
244045
243305
|
// (~/.npm-global/bin, ~/.local/bin) — systemd --user otherwise gives a minimal PATH.
|
|
244046
|
-
`Environment=PATH=${process.env["PATH"] ?? ""}:${path36.join(
|
|
243306
|
+
`Environment=PATH=${process.env["PATH"] ?? ""}:${path36.join(os11.homedir(), ".npm-global/bin")}:${path36.join(os11.homedir(), ".local/bin")}:/usr/local/bin`,
|
|
244047
243307
|
"Restart=on-failure",
|
|
244048
243308
|
"RestartSec=5",
|
|
244049
243309
|
"StandardOutput=journal",
|
|
@@ -244055,23 +243315,23 @@ async function runCli(argv, println = console.log, progressln = console.error) {
|
|
|
244055
243315
|
].join("\n"));
|
|
244056
243316
|
spawnSync3("systemctl", ["--user", "daemon-reload"], { stdio: "inherit" });
|
|
244057
243317
|
spawnSync3("systemctl", ["--user", "enable", "--now", "oasis-node"], { stdio: "inherit" });
|
|
244058
|
-
spawnSync3("loginctl", ["enable-linger",
|
|
243318
|
+
spawnSync3("loginctl", ["enable-linger", os11.userInfo().username], { stdio: "ignore" });
|
|
244059
243319
|
println("\u2713 Oasis node service started (systemd --user oasis-node)");
|
|
244060
243320
|
println(" Status : systemctl --user status oasis-node");
|
|
244061
243321
|
println(" Logs : journalctl --user -u oasis-node -f");
|
|
244062
243322
|
println(" Stop : systemctl --user stop oasis-node");
|
|
244063
243323
|
} else if (process.platform === "darwin") {
|
|
244064
|
-
const plist = path36.join(
|
|
243324
|
+
const plist = path36.join(os11.homedir(), "Library/LaunchAgents/com.oasis.node.plist");
|
|
244065
243325
|
fs39.mkdirSync(path36.dirname(plist), { recursive: true });
|
|
244066
243326
|
spawnSync3("launchctl", ["unload", plist], { stdio: "ignore" });
|
|
244067
243327
|
const argXml = [binPath, "node", "--server-ws", serverUrl, "--dir", dir, ...nodeName ? ["--name", nodeName] : []].map((a) => `<string>${a}</string>`).join("");
|
|
244068
|
-
fs39.writeFileSync(plist, `<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><dict><key>Label</key><string>com.oasis.node</string><key>ProgramArguments</key><array>${argXml}</array><key>RunAtLoad</key><true/><key>KeepAlive</key><true/><key>StandardOutPath</key><string>${
|
|
243328
|
+
fs39.writeFileSync(plist, `<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><dict><key>Label</key><string>com.oasis.node</string><key>ProgramArguments</key><array>${argXml}</array><key>RunAtLoad</key><true/><key>KeepAlive</key><true/><key>StandardOutPath</key><string>${os11.homedir()}/.oasis-node.log</string><key>StandardErrorPath</key><string>${os11.homedir()}/.oasis-node.err</string></dict></plist>`);
|
|
244069
243329
|
spawnSync3("launchctl", ["load", plist], { stdio: "inherit" });
|
|
244070
243330
|
println("\u2713 Oasis node service started (macOS LaunchAgent com.oasis.node)");
|
|
244071
|
-
println(` Logs : tail -f ${
|
|
243331
|
+
println(` Logs : tail -f ${os11.homedir()}/.oasis-node.log`);
|
|
244072
243332
|
println(` Stop : launchctl unload ${plist}`);
|
|
244073
243333
|
} else {
|
|
244074
|
-
spawnSync3("sh", ["-c", `nohup ${binPath} ${svcArgs} > ${path36.join(
|
|
243334
|
+
spawnSync3("sh", ["-c", `nohup ${binPath} ${svcArgs} > ${path36.join(os11.homedir(), ".oasis-node.log")} 2>&1 &`], { stdio: "inherit" });
|
|
244075
243335
|
println(`\u2713 Oasis node started in background (nohup). Logs: ~/.oasis-node.log`);
|
|
244076
243336
|
println(" Note: no automatic restart on reboot in this environment.");
|
|
244077
243337
|
}
|
|
@@ -244170,8 +243430,8 @@ async function runCli(argv, println = console.log, progressln = console.error) {
|
|
|
244170
243430
|
if (command === "serve" && positional[0] === "install") {
|
|
244171
243431
|
const absDir = path36.resolve(dir);
|
|
244172
243432
|
const name = `oasis-serve-${path36.basename(absDir)}`;
|
|
244173
|
-
const unitDir = flags.get("unit-dir") ?? path36.join(
|
|
244174
|
-
const bin = flags.get("bin") ?? path36.join(
|
|
243433
|
+
const unitDir = flags.get("unit-dir") ?? path36.join(os11.homedir(), ".config", "systemd", "user");
|
|
243434
|
+
const bin = flags.get("bin") ?? path36.join(os11.homedir(), ".local", "bin", "oasis");
|
|
244175
243435
|
const port = flags.get("port") ?? "7320";
|
|
244176
243436
|
const extra = (flags.get("dispatch") === "true" ? ` --dispatch true` : "") + (flags.has("model") ? ` --model ${flags.get("model")}` : "");
|
|
244177
243437
|
const unit = [
|
|
@@ -244344,6 +243604,124 @@ async function runCli(argv, println = console.log, progressln = console.error) {
|
|
|
244344
243604
|
return;
|
|
244345
243605
|
}
|
|
244346
243606
|
switch (command) {
|
|
243607
|
+
// ⚠️ **没有 `--wait-ms`**:一期只做异步。理由不是墙钟不够(chat 墙钟 120 分钟),是三条:
|
|
243608
|
+
// 阻塞期间主会话那一轮一直挂着(用户看着「正在输入」十几分钟、他这期间说的话只能排队)、
|
|
243609
|
+
// 一个进程挂着空等不产出任何东西、这十几分钟里 serve 重启或节点掉线那一轮就白丢了
|
|
243610
|
+
// ——而它本来只是在等一个别处正常跑着的东西(§6.1.1)。
|
|
243611
|
+
case "delegate": {
|
|
243612
|
+
const unsupported = (err) => {
|
|
243613
|
+
const detail = err instanceof Error ? err.message : String(err);
|
|
243614
|
+
if (/\b404\b|not_?found/i.test(detail)) {
|
|
243615
|
+
throw new Error(
|
|
243616
|
+
"\u5F53\u524D\u670D\u52A1\u7AEF\u4E0D\u652F\u6301\u59D4\u6D3E\uFF1A\u5B83\u6CA1\u6709\u63D0\u4F9B /api/delegations \u8FD9\u7EC4\u63A5\u53E3\u3002\u786E\u8BA4\u4F60\u8FDE\u7684\u662F\u542F\u7528\u4E86\u59D4\u6D3E\u57DF\u7684\u90A3\u5957\u90E8\u7F72\uFF08--server / $OASIS_SERVER\uFF09\u3002"
|
|
243617
|
+
);
|
|
243618
|
+
}
|
|
243619
|
+
throw err;
|
|
243620
|
+
};
|
|
243621
|
+
const asJson = flags.get("json") === "true";
|
|
243622
|
+
const fileArgs = repeated.get("file") ?? (flags.get("file") ? [flags.get("file")] : []);
|
|
243623
|
+
const listDelegations = async (all2) => (await api.request("GET", `/api/delegations${all2 ? "?all=true" : ""}`).catch(unsupported)).items ?? [];
|
|
243624
|
+
const describe = (item) => {
|
|
243625
|
+
const bits = [
|
|
243626
|
+
`${item.label ?? "(\u65E0\u77ED\u540D)"}`,
|
|
243627
|
+
`${item.expertName ?? item.expertActorId}`,
|
|
243628
|
+
`${item.state}${item.failureKind ? `/${item.failureKind}` : ""}`,
|
|
243629
|
+
`id=${item.id.slice(0, 8)}`
|
|
243630
|
+
];
|
|
243631
|
+
if (item.pendingInputs > 0) bits.push(`\u5F85\u8F6C\u8FBE ${item.pendingInputs}`);
|
|
243632
|
+
const tail = item.taskDigest ?? item.lastSummaryLine;
|
|
243633
|
+
return ` ${bits.join(" ")}${tail ? `
|
|
243634
|
+
${tail}` : ""}`;
|
|
243635
|
+
};
|
|
243636
|
+
const resolveRef2 = async (raw) => {
|
|
243637
|
+
const ref2 = raw.trim();
|
|
243638
|
+
if (!ref2) throw new Error("\u5F15\u7528\u662F\u7A7A\u7684\uFF1A\u7ED9 label / \u4E13\u5BB6\u540D / delegationId \u524D\u7F00");
|
|
243639
|
+
const items = await listDelegations(true);
|
|
243640
|
+
if (items.length === 0) throw new Error("\u8FD9\u6761\u5BF9\u8BDD\u8FD8\u6CA1\u6D3E\u51FA\u53BB\u8FC7\u4EFB\u4F55\u6D3B\uFF08oasis delegate --list \u53EF\u786E\u8BA4\uFF09");
|
|
243641
|
+
const lower = ref2.toLowerCase();
|
|
243642
|
+
const byLabel = items.filter((x2) => (x2.label ?? "").toLowerCase() === lower);
|
|
243643
|
+
const byId = items.filter((x2) => x2.id.startsWith(ref2) || x2.id.replace(/-/g, "").startsWith(ref2));
|
|
243644
|
+
const byExpert = items.filter((x2) => (x2.expertName ?? "").toLowerCase() === lower || x2.expertActorId === ref2 || x2.expertActorId.endsWith(`:${ref2}`));
|
|
243645
|
+
for (const bucket of [byLabel, byId, byExpert]) {
|
|
243646
|
+
if (bucket.length === 1) return bucket[0];
|
|
243647
|
+
if (bucket.length > 1) {
|
|
243648
|
+
const lines = ["`" + ref2 + "` \u649E\u5230\u591A\u4E2A\u59D4\u6D3E\uFF0C\u6311\u4E00\u4E2A\u66F4\u5177\u4F53\u7684\u91CD\u53D1\uFF08\u7528 label \u6216 id \u524D\u7F00\uFF09\uFF1A", ...bucket.map(describe)];
|
|
243649
|
+
throw new Error(lines.join("\n"));
|
|
243650
|
+
}
|
|
243651
|
+
}
|
|
243652
|
+
throw new Error(`\u6CA1\u6709\u5339\u914D \`${ref2}\` \u7684\u59D4\u6D3E\u2014\u2014\`oasis delegate --list --all\` \u770B\u770B\u6709\u54EA\u4E9B`);
|
|
243653
|
+
};
|
|
243654
|
+
if (flags.get("list") === "true") {
|
|
243655
|
+
const items = await listDelegations(flags.get("all") === "true");
|
|
243656
|
+
if (asJson) {
|
|
243657
|
+
println(JSON.stringify(items, null, 2));
|
|
243658
|
+
break;
|
|
243659
|
+
}
|
|
243660
|
+
if (items.length === 0) {
|
|
243661
|
+
println("\u8FD9\u6761\u5BF9\u8BDD\u8FD8\u6CA1\u6D3E\u51FA\u53BB\u8FC7\u4EFB\u4F55\u6D3B\u3002");
|
|
243662
|
+
break;
|
|
243663
|
+
}
|
|
243664
|
+
println(`\u6D3E\u51FA\u53BB\u7684\u6D3B\uFF08${items.length} \u6761${flags.get("all") === "true" ? "\uFF0C\u5168\u91CF" : "\uFF1B\u9ED8\u8BA4\u53EA\u5217\u8FDB\u884C\u4E2D + \u6700\u8FD1 10 \u6761\uFF0C--all \u770B\u5168\u90E8"}\uFF09\uFF1A`);
|
|
243665
|
+
for (const item of items) println(describe(item));
|
|
243666
|
+
break;
|
|
243667
|
+
}
|
|
243668
|
+
const statusRef = flags.get("status");
|
|
243669
|
+
if (statusRef !== void 0) {
|
|
243670
|
+
if (statusRef === "true") throw new Error("--status \u8981\u8DDF\u4E00\u4E2A\u5F15\u7528\uFF1Alabel / \u4E13\u5BB6\u540D / delegationId \u524D\u7F00");
|
|
243671
|
+
const target = await resolveRef2(statusRef);
|
|
243672
|
+
const detail = await api.request("GET", `/api/delegations/${encodeURIComponent(target.id)}`).catch(unsupported);
|
|
243673
|
+
if (asJson) {
|
|
243674
|
+
println(JSON.stringify(detail, null, 2));
|
|
243675
|
+
break;
|
|
243676
|
+
}
|
|
243677
|
+
println(`${detail.label ?? "(\u65E0\u77ED\u540D)"} ${detail.expertName ?? detail.expertActorId} ${detail.state}${detail.failureKind ? `/${detail.failureKind}` : ""}`);
|
|
243678
|
+
println(`id=${detail.id} \u5B50\u4F1A\u8BDD=${detail.childSessionId} \u5F85\u8F6C\u8FBE=${detail.pendingInputs} \u8FDE\u7EED\u5931\u8D25=${detail.consecutiveFails}`);
|
|
243679
|
+
if (detail.taskDigest) println(`\u4EFB\u52A1\uFF1A${detail.taskDigest}`);
|
|
243680
|
+
for (const round of detail.roundSummaries) println(`
|
|
243681
|
+
\u7B2C ${round.round} \u8F6E\uFF08${round.at}\uFF09\uFF1A
|
|
243682
|
+
${round.text}`);
|
|
243683
|
+
if (detail.artifacts.length > 0) {
|
|
243684
|
+
println("\n\u4EA7\u7269\uFF1A");
|
|
243685
|
+
for (const artifact of detail.artifacts) println(` ${artifact.name}\uFF08\u7B2C ${artifact.round} \u8F6E\uFF09`);
|
|
243686
|
+
}
|
|
243687
|
+
break;
|
|
243688
|
+
}
|
|
243689
|
+
const continueRef = flags.get("continue");
|
|
243690
|
+
if (continueRef !== void 0) {
|
|
243691
|
+
if (continueRef === "true") throw new Error("--continue \u8981\u8DDF\u4E00\u4E2A\u5F15\u7528\uFF1Alabel / \u4E13\u5BB6\u540D / delegationId \u524D\u7F00");
|
|
243692
|
+
const text5 = flags.get("text");
|
|
243693
|
+
if (!text5) throw new Error('--continue \u8981\u914D --text "<\u8981\u8F6C\u8FBE\u7684\u8BDD>"');
|
|
243694
|
+
const target = await resolveRef2(continueRef);
|
|
243695
|
+
await api.post(
|
|
243696
|
+
`/api/delegations/${encodeURIComponent(target.id)}/messages`,
|
|
243697
|
+
{ text: text5, ...fileArgs.length ? { files: fileArgs } : {} }
|
|
243698
|
+
).catch(unsupported);
|
|
243699
|
+
if (asJson) {
|
|
243700
|
+
println(JSON.stringify({ delegationId: target.id, label: target.label, files: fileArgs }, null, 2));
|
|
243701
|
+
break;
|
|
243702
|
+
}
|
|
243703
|
+
println(`\u5DF2\u8F6C\u8FBE\u7ED9 ${target.expertName ?? target.expertActorId}\uFF08${target.label ?? target.id.slice(0, 8)}\uFF09\u3002`);
|
|
243704
|
+
if (fileArgs.length) println(` \u4E00\u8D77\u5E26\u8FC7\u53BB\u7684\u6587\u4EF6\uFF1A${fileArgs.join("\u3001")}`);
|
|
243705
|
+
println("\u8FD9\u4E00\u8F6E\u5230\u6B64\u4E3A\u6B62\uFF1A\u7ED3\u679C\u4F1A\u81EA\u5DF1\u56DE\u5230\u8FD9\u6761\u5BF9\u8BDD\uFF0C\u4E0D\u8981\u5728\u8FD9\u91CC\u7B49\u3002");
|
|
243706
|
+
break;
|
|
243707
|
+
}
|
|
243708
|
+
const to = need(flags, "to");
|
|
243709
|
+
const task = need(flags, "task");
|
|
243710
|
+
const started = await api.post(
|
|
243711
|
+
"/api/delegations",
|
|
243712
|
+
{ to, task, ...flags.get("as") ? { as: flags.get("as") } : {}, ...fileArgs.length ? { files: fileArgs } : {} }
|
|
243713
|
+
).catch(unsupported);
|
|
243714
|
+
if (asJson) {
|
|
243715
|
+
println(JSON.stringify(started, null, 2));
|
|
243716
|
+
break;
|
|
243717
|
+
}
|
|
243718
|
+
println(`\u5DF2\u4EA4\u7ED9 ${to} \u53BB\u505A\uFF08\u5F02\u6B65\uFF0C\u4E0D\u7528\u7B49\uFF09\u3002`);
|
|
243719
|
+
println(` \u77ED\u540D\uFF08--continue \u7528\u8FD9\u4E2A\uFF09\uFF1A${started.label}`);
|
|
243720
|
+
println(` delegationId\uFF1A${started.delegationId}`);
|
|
243721
|
+
if (started.attachedFiles?.length) println(` \u5E26\u8FC7\u53BB\u7684\u6587\u4EF6\uFF1A${started.attachedFiles.join("\u3001")}`);
|
|
243722
|
+
println("\u7ED3\u679C\u5E72\u5B8C\u4E86\u4F1A\u81EA\u5DF1\u56DE\u5230\u8FD9\u6761\u5BF9\u8BDD\u3002\u8FD9\u4E00\u8F6E\u5148\u6536\u5C3E\u2014\u2014\u53EF\u4EE5\u987A\u624B\u8DDF\u7528\u6237\u8BF4\u4E00\u53E5\u4F60\u628A\u8FD9\u4EF6\u4E8B\u6D3E\u51FA\u53BB\u4E86\u3002");
|
|
243723
|
+
break;
|
|
243724
|
+
}
|
|
244347
243725
|
case "kb": {
|
|
244348
243726
|
const action = needPos(positional, 0, "oasis kb <ask|ingest|status|maintain|lint> ...");
|
|
244349
243727
|
const asJson = flags.get("json") === "true";
|
|
@@ -244515,7 +243893,7 @@ Trace: ${run.traceRunId}`);
|
|
|
244515
243893
|
if (plan.inject.mode === "env") {
|
|
244516
243894
|
childEnv[plan.inject.envName] = value2;
|
|
244517
243895
|
} else {
|
|
244518
|
-
tmpDir = await fs39.promises.mkdtemp(path36.join(
|
|
243896
|
+
tmpDir = await fs39.promises.mkdtemp(path36.join(os11.tmpdir(), "oasis-var-exec-"));
|
|
244519
243897
|
const keyfile = path36.join(tmpDir, "value");
|
|
244520
243898
|
await fs39.promises.writeFile(keyfile, value2, { mode: 384 });
|
|
244521
243899
|
childEnv[plan.inject.fileEnv] = keyfile;
|
|
@@ -245302,7 +244680,7 @@ ${res.warning}`);
|
|
|
245302
244680
|
for (const a of st.artifacts) println(` - ${a.path}\uFF08${a.kind ?? "?"}\uFF09status=${a.status ?? "?"}${a.mtime ? ` \xB7 ${new Date(a.mtime).toISOString()}` : ""}`);
|
|
245303
244681
|
if (flags.get("pull") === "true") {
|
|
245304
244682
|
const odPublic2 = (flags.get("od-public-url") ?? process.env["OASIS_OPEN_DESIGN_PUBLIC_URL"] ?? "https://design.open-friday.com").replace(/\/$/, "");
|
|
245305
|
-
const { dir: dir3, entry: entry2 } = await harvestBoard(odBase2, fetch, odPublic2,
|
|
244683
|
+
const { dir: dir3, entry: entry2 } = await harvestBoard(odBase2, fetch, odPublic2, os11.tmpdir(), st.boardKey, st.runs[0]?.runId ?? "status-pull");
|
|
245306
244684
|
println(`[design] \u5DF2\u62C9\u5230\u672C\u5730\uFF1A${dir3}\uFF08\u5165\u53E3 ${entry2}\uFF09`);
|
|
245307
244685
|
println(`[design] \u8BFB\u5B8C\u6EE1\u610F\u5373\u4EA4\u7A3F\uFF1Aoasis propose ${artifactId2} --from-dir ${dir3} --reason "<\u8FD9\u7248\u505A\u4E86\u4EC0\u4E48>"`);
|
|
245308
244686
|
} else {
|
|
@@ -246672,10 +246050,10 @@ function runtimeAssetSourceRoots(input) {
|
|
|
246672
246050
|
|
|
246673
246051
|
// src/paths.ts
|
|
246674
246052
|
var fs42 = __toESM(require("node:fs"));
|
|
246675
|
-
var
|
|
246053
|
+
var os12 = __toESM(require("node:os"));
|
|
246676
246054
|
var path39 = __toESM(require("node:path"));
|
|
246677
246055
|
var DEFAULT_INSTANCE = "default";
|
|
246678
|
-
var home = () =>
|
|
246056
|
+
var home = () => os12.homedir();
|
|
246679
246057
|
var oasisDir = () => path39.join(home(), ".oasis");
|
|
246680
246058
|
var versionsDir = () => path39.join(oasisDir(), "versions");
|
|
246681
246059
|
var versionDir = (label) => path39.join(versionsDir(), label);
|
|
@@ -246874,7 +246252,7 @@ function shimScript() {
|
|
|
246874
246252
|
}
|
|
246875
246253
|
|
|
246876
246254
|
// src/index.ts
|
|
246877
|
-
var PKG_VERSION = true ? "0.1.
|
|
246255
|
+
var PKG_VERSION = true ? "0.1.141" : "dev";
|
|
246878
246256
|
var LOCAL_BIN = localBin();
|
|
246879
246257
|
var NPM_PREFIX = npmPrefix();
|
|
246880
246258
|
var INSTANCE = DEFAULT_INSTANCE;
|
|
@@ -246974,7 +246352,7 @@ function installSoftware(label) {
|
|
|
246974
246352
|
function setupAutostart(name) {
|
|
246975
246353
|
const inst = instancePaths(name);
|
|
246976
246354
|
const cmd = `${process.execPath} "${inst.binFile}" --_daemon --instance ${name}`;
|
|
246977
|
-
const home2 =
|
|
246355
|
+
const home2 = os13.homedir();
|
|
246978
246356
|
const pnpmHome = process.env["PNPM_HOME"] || path41.join(home2, ".local", "share", "pnpm");
|
|
246979
246357
|
const extraBins = [
|
|
246980
246358
|
path41.join(home2, ".npm-global", "bin"),
|
|
@@ -246984,7 +246362,7 @@ function setupAutostart(name) {
|
|
|
246984
246362
|
];
|
|
246985
246363
|
const daemonPath = sanitizeDaemonPath([process.env["PATH"] ?? "", ...extraBins].filter(Boolean).join(":"));
|
|
246986
246364
|
if (process.platform === "linux") {
|
|
246987
|
-
const unitDir = path41.join(
|
|
246365
|
+
const unitDir = path41.join(os13.homedir(), ".config", "systemd", "user");
|
|
246988
246366
|
fs44.mkdirSync(unitDir, { recursive: true });
|
|
246989
246367
|
const unit = systemdUnitName(name);
|
|
246990
246368
|
fs44.mkdirSync(path41.dirname(inst.logFile), { recursive: true });
|
|
@@ -246997,19 +246375,19 @@ function setupAutostart(name) {
|
|
|
246997
246375
|
}));
|
|
246998
246376
|
if (name === DEFAULT_INSTANCE) {
|
|
246999
246377
|
try {
|
|
247000
|
-
(0,
|
|
246378
|
+
(0, import_node_child_process23.execSync)(`systemctl --user disable --now ${LEGACY_SYSTEMD_UNIT} 2>/dev/null`, { stdio: "ignore" });
|
|
247001
246379
|
} catch {
|
|
247002
246380
|
}
|
|
247003
246381
|
}
|
|
247004
246382
|
try {
|
|
247005
|
-
(0,
|
|
246383
|
+
(0, import_node_child_process23.execSync)(`systemctl --user daemon-reload && systemctl --user enable --now ${unit}`, { stdio: "ignore" });
|
|
247006
246384
|
return true;
|
|
247007
246385
|
} catch {
|
|
247008
246386
|
}
|
|
247009
246387
|
return false;
|
|
247010
246388
|
} else if (process.platform === "darwin") {
|
|
247011
246389
|
const label = launchdLabel(name);
|
|
247012
|
-
const plist = path41.join(
|
|
246390
|
+
const plist = path41.join(os13.homedir(), "Library", "LaunchAgents", `${label}.plist`);
|
|
247013
246391
|
fs44.mkdirSync(path41.dirname(plist), { recursive: true });
|
|
247014
246392
|
fs44.writeFileSync(plist, `<?xml version="1.0" encoding="UTF-8"?>
|
|
247015
246393
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
@@ -247022,7 +246400,7 @@ function setupAutostart(name) {
|
|
|
247022
246400
|
<key>StandardErrorPath</key><string>${inst.logFile}</string>
|
|
247023
246401
|
</dict></plist>`);
|
|
247024
246402
|
try {
|
|
247025
|
-
(0,
|
|
246403
|
+
(0, import_node_child_process23.execSync)(`launchctl load "${plist}"`, { stdio: "ignore" });
|
|
247026
246404
|
return true;
|
|
247027
246405
|
} catch {
|
|
247028
246406
|
}
|
|
@@ -247033,7 +246411,7 @@ function setupAutostart(name) {
|
|
|
247033
246411
|
function spawnDaemon() {
|
|
247034
246412
|
fs44.mkdirSync(path41.dirname(LOG_FILE), { recursive: true });
|
|
247035
246413
|
const log3 = fs44.openSync(LOG_FILE, "a");
|
|
247036
|
-
const child = (0,
|
|
246414
|
+
const child = (0, import_node_child_process23.spawn)(process.execPath, [INST.binFile, "--_daemon", "--instance", INSTANCE], {
|
|
247037
246415
|
detached: true,
|
|
247038
246416
|
stdio: ["ignore", log3, log3],
|
|
247039
246417
|
// 与 systemd unit 里那条 Environment 等价——detached 兜底路径不能少,否则同一实例在两条
|
|
@@ -247058,24 +246436,24 @@ function stopDaemon(name) {
|
|
|
247058
246436
|
}
|
|
247059
246437
|
if (process.platform === "linux") {
|
|
247060
246438
|
try {
|
|
247061
|
-
(0,
|
|
246439
|
+
(0, import_node_child_process23.execSync)(`systemctl --user stop ${systemdUnitName(name)} 2>/dev/null`, { stdio: "ignore" });
|
|
247062
246440
|
} catch {
|
|
247063
246441
|
}
|
|
247064
246442
|
if (name === DEFAULT_INSTANCE) {
|
|
247065
246443
|
try {
|
|
247066
|
-
(0,
|
|
246444
|
+
(0, import_node_child_process23.execSync)(`systemctl --user stop ${LEGACY_SYSTEMD_UNIT} 2>/dev/null`, { stdio: "ignore" });
|
|
247067
246445
|
} catch {
|
|
247068
246446
|
}
|
|
247069
246447
|
}
|
|
247070
246448
|
} else if (process.platform === "darwin") {
|
|
247071
246449
|
const label = launchdLabel(name);
|
|
247072
246450
|
try {
|
|
247073
|
-
(0,
|
|
246451
|
+
(0, import_node_child_process23.execSync)(`launchctl unload "$HOME/Library/LaunchAgents/${label}.plist" 2>/dev/null`, { stdio: "ignore" });
|
|
247074
246452
|
} catch {
|
|
247075
246453
|
}
|
|
247076
246454
|
if (name === DEFAULT_INSTANCE && label !== LEGACY_LAUNCHD_LABEL) {
|
|
247077
246455
|
try {
|
|
247078
|
-
(0,
|
|
246456
|
+
(0, import_node_child_process23.execSync)(`launchctl unload "$HOME/Library/LaunchAgents/${LEGACY_LAUNCHD_LABEL}.plist" 2>/dev/null`, { stdio: "ignore" });
|
|
247079
246457
|
} catch {
|
|
247080
246458
|
}
|
|
247081
246459
|
}
|
|
@@ -247094,7 +246472,7 @@ function selfUpdate() {
|
|
|
247094
246472
|
const inner = `{ echo "[oasis] self-update \u2192 ${PKG_NAME}@latest (registry ${OFFICIAL}, \u5931\u8D25\u56DE\u843D\u9ED8\u8BA4\u6E90)"; sleep 2; { ${installOfficial} || ${installFallback}; } && ${printVersion} && ${startCmd}; } >> '${LOG_FILE}' 2>&1`;
|
|
247095
246473
|
const hasSystemd = process.platform === "linux" && (() => {
|
|
247096
246474
|
try {
|
|
247097
|
-
(0,
|
|
246475
|
+
(0, import_node_child_process23.execSync)("systemd-run --user --scope --quiet -- true", { stdio: "ignore" });
|
|
247098
246476
|
return true;
|
|
247099
246477
|
} catch {
|
|
247100
246478
|
return false;
|
|
@@ -247102,13 +246480,13 @@ function selfUpdate() {
|
|
|
247102
246480
|
})();
|
|
247103
246481
|
const log3 = fs44.openSync(LOG_FILE, "a");
|
|
247104
246482
|
if (hasSystemd) {
|
|
247105
|
-
const child = (0,
|
|
246483
|
+
const child = (0, import_node_child_process23.spawn)("systemd-run", ["--user", "--scope", "--quiet", "sh", "-c", inner], {
|
|
247106
246484
|
detached: true,
|
|
247107
246485
|
stdio: ["ignore", log3, log3]
|
|
247108
246486
|
});
|
|
247109
246487
|
child.unref();
|
|
247110
246488
|
} else {
|
|
247111
|
-
const child = (0,
|
|
246489
|
+
const child = (0, import_node_child_process23.spawn)("sh", ["-c", inner], { detached: true, stdio: ["ignore", log3, log3] });
|
|
247112
246490
|
child.unref();
|
|
247113
246491
|
}
|
|
247114
246492
|
}
|
|
@@ -247170,7 +246548,7 @@ async function startOneInstance(o) {
|
|
|
247170
246548
|
const res = await fetch(`${httpBase(serverUrl)}/api/nodes/exchange`, {
|
|
247171
246549
|
method: "POST",
|
|
247172
246550
|
headers: { "content-type": "application/json" },
|
|
247173
|
-
body: JSON.stringify({ enrollToken, nodeId: derivedNodeId, hostname:
|
|
246551
|
+
body: JSON.stringify({ enrollToken, nodeId: derivedNodeId, hostname: os13.hostname() })
|
|
247174
246552
|
});
|
|
247175
246553
|
if (!res.ok) throw new Error(`enroll token exchange failed: HTTP ${res.status}`);
|
|
247176
246554
|
const body2 = await res.json();
|
|
@@ -247221,7 +246599,7 @@ function derivedNodeIdFor(name) {
|
|
|
247221
246599
|
if (name === DEFAULT_INSTANCE) return resolveNodeId();
|
|
247222
246600
|
const user = (() => {
|
|
247223
246601
|
try {
|
|
247224
|
-
return
|
|
246602
|
+
return os13.userInfo().username;
|
|
247225
246603
|
} catch {
|
|
247226
246604
|
return process.env["USER"] ?? process.env["USERNAME"] ?? "unknown";
|
|
247227
246605
|
}
|
|
@@ -247231,7 +246609,7 @@ function derivedNodeIdFor(name) {
|
|
|
247231
246609
|
function userScopeAvailable() {
|
|
247232
246610
|
if (process.platform !== "linux") return false;
|
|
247233
246611
|
try {
|
|
247234
|
-
(0,
|
|
246612
|
+
(0, import_node_child_process23.execSync)("systemd-run --user --scope --quiet -- true", { stdio: "ignore" });
|
|
247235
246613
|
return true;
|
|
247236
246614
|
} catch {
|
|
247237
246615
|
return false;
|
|
@@ -247262,11 +246640,11 @@ function spawnSessionProcess(spec) {
|
|
|
247262
246640
|
const logFd = fs44.openSync(path41.join(dir, "session.log"), "a");
|
|
247263
246641
|
const argv = [INST.binFile, "--_session", specFile];
|
|
247264
246642
|
const env = { ...process.env, OASIS_CLI_HOME: pinnedDir };
|
|
247265
|
-
const child = userScopeAvailable() ? (0,
|
|
246643
|
+
const child = userScopeAvailable() ? (0, import_node_child_process23.spawn)(
|
|
247266
246644
|
"systemd-run",
|
|
247267
246645
|
["--user", "--scope", "--quiet", `--setenv=OASIS_CLI_HOME=${pinnedDir}`, process.execPath, ...argv],
|
|
247268
246646
|
{ detached: true, stdio: ["ignore", logFd, logFd], env }
|
|
247269
|
-
) : (0,
|
|
246647
|
+
) : (0, import_node_child_process23.spawn)(process.execPath, argv, { detached: true, stdio: ["ignore", logFd, logFd], env });
|
|
247270
246648
|
child.unref();
|
|
247271
246649
|
return true;
|
|
247272
246650
|
} catch (e) {
|