oasis_test_v2 2.2.126 → 2.2.128
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 +122 -32
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1720,6 +1720,22 @@ function formatOverlapCandidate(c5, timeZone) {
|
|
|
1720
1720
|
bits.push(`\u4EA7\u51FA ${c5.artifactCount} \u4E2A`);
|
|
1721
1721
|
return ` ${bits.join(" ")}`;
|
|
1722
1722
|
}
|
|
1723
|
+
function formatOverlapForExpert(r5, timeZone) {
|
|
1724
|
+
const all2 = [...r5.active, ...r5.done];
|
|
1725
|
+
if (all2.length === 0) return "";
|
|
1726
|
+
return [
|
|
1727
|
+
"---",
|
|
1728
|
+
"## \u76F8\u8FD1\u7684\u4E8B\u9879\uFF08\u7CFB\u7EDF\u7C97\u7B5B\uFF0C\u672A\u786E\u8BA4\uFF09",
|
|
1729
|
+
"",
|
|
1730
|
+
"\u7CFB\u7EDF\u7C97\u7B5B\u5230\u4EE5\u4E0B\u76F8\u8FD1\u7684\u4E8B\u9879\uFF08\u672A\u786E\u8BA4\uFF09\u3002**\u5F00\u5DE5\u524D**\u5148\u7528 id \u9010\u6761\u67E5\u8BE6\u60C5\uFF1A`oasis todo show <\u5F85\u529Eid>` / `oasis workorder <\u5DE5\u5355id>` / `oasis delegate --status <\u59D4\u6D3Eid>`\uFF08\u522B\u4EBA\u5BF9\u8BDD\u91CC\u6D3E\u7684\u4E5F\u80FD\u8BFB\u6458\u8981\uFF09\u3002",
|
|
1731
|
+
"",
|
|
1732
|
+
...all2.map((c5) => formatOverlapCandidate(c5, timeZone)),
|
|
1733
|
+
"",
|
|
1734
|
+
"- \u6709\u73B0\u6210\u7ED3\u679C\u80FD\u76F4\u63A5\u7528\uFF0C\u6216\u80FD\u5728\u5B83\u57FA\u7840\u4E0A\u6539 \u2192 \u7528\u5B83\uFF0C\u4EA4\u56DE\u65F6\u5199\u660E\u7528\u4E86\u54EA\u6761\uFF08id\uFF09\u3002",
|
|
1735
|
+
"- \u786E\u5B9E\u662F\u540C\u4E00\u4EF6\u4E8B\uFF08\u522B\u4EBA\u6B63\u5728\u505A\uFF0C\u6216\u5DF2\u7ECF\u505A\u5B8C\u3001\u7167\u505A\u5C31\u662F\u91CD\u590D\uFF09\u2192 **\u5148\u522B\u505A**\uFF0C\u76F4\u63A5\u4EA4\u56DE\uFF1A\u8BF4\u660E\u662F\u54EA\u6761\uFF08id\uFF09\u3001\u4E3A\u4EC0\u4E48\u5224\u65AD\u662F\u91CD\u590D\u3001\u5EFA\u8BAE\u600E\u4E48\u5904\u7406\uFF08\u5408\u5E76 / \u590D\u7528 / \u4ECD\u8981\u91CD\u505A\uFF09\uFF0C\u7531\u6D3E\u6D3B\u65B9\u8F6C\u544A\u7528\u6237\u51B3\u5B9A\u3002",
|
|
1736
|
+
"- \u90FD\u4E0D\u76F8\u5173 \u2192 \u7167\u5E38\u5E72\u6D3B\uFF0C\u4EA4\u56DE\u65F6\u4E0D\u7528\u63D0\u3002"
|
|
1737
|
+
].join("\n");
|
|
1738
|
+
}
|
|
1723
1739
|
function formatOverlapLines(r5, timeZone) {
|
|
1724
1740
|
const all2 = [...r5.active, ...r5.done];
|
|
1725
1741
|
if (all2.length === 0) return [];
|
|
@@ -210633,7 +210649,7 @@ async function seedChildRoundRows(chatStore, childSessionId, round, prompt2, now
|
|
|
210633
210649
|
createdAt: now
|
|
210634
210650
|
});
|
|
210635
210651
|
}
|
|
210636
|
-
var import_node_crypto42, DelegationError, DIGEST_CHARS, PENDING_QUEUE_OWNER, DISPATCH_LEASE_MS, CONSECUTIVE_FAIL_LIMIT, roundTurnKey, roundTurnId, DelegationService;
|
|
210652
|
+
var import_node_crypto42, DelegationError, DELEGATION_OVERLAP_TIMEOUT_MS, DIGEST_CHARS, PENDING_QUEUE_OWNER, DISPATCH_LEASE_MS, CONSECUTIVE_FAIL_LIMIT, roundTurnKey, roundTurnId, DelegationService;
|
|
210637
210653
|
var init_service3 = __esm({
|
|
210638
210654
|
"../server/src/domains/delegations/service.ts"() {
|
|
210639
210655
|
"use strict";
|
|
@@ -210654,6 +210670,7 @@ var init_service3 = __esm({
|
|
|
210654
210670
|
this.name = "DelegationError";
|
|
210655
210671
|
}
|
|
210656
210672
|
};
|
|
210673
|
+
DELEGATION_OVERLAP_TIMEOUT_MS = 3e3;
|
|
210657
210674
|
DIGEST_CHARS = 200;
|
|
210658
210675
|
PENDING_QUEUE_OWNER = "delegation-dispatch";
|
|
210659
210676
|
DISPATCH_LEASE_MS = 10 * 60 * 1e3;
|
|
@@ -211019,7 +211036,11 @@ var init_service3 = __esm({
|
|
|
211019
211036
|
`\u8FD9\u6761\u4F1A\u8BDD\u91CC\u53EB\u300C${desiredLabel}\u300D\u7684\u59D4\u6D3E\u592A\u591A\u4E86\uFF0C\u6362\u4E00\u4E2A --as \u77ED\u540D\u518D\u6D3E\u3002`
|
|
211020
211037
|
);
|
|
211021
211038
|
}
|
|
211022
|
-
await this.
|
|
211039
|
+
const overlap = inserted ? await this.overlapForExpert(input.task, record10, caller, companyId) : void 0;
|
|
211040
|
+
const expertTask = overlap ? `${input.task}
|
|
211041
|
+
|
|
211042
|
+
${overlap.block}` : input.task;
|
|
211043
|
+
await this.materializeChild({ record: record10, chatStore, parent, expert, task: expertTask, companyId, now });
|
|
211023
211044
|
await store.appendTouch({
|
|
211024
211045
|
delegationId: record10.id,
|
|
211025
211046
|
messageId: parentMessageId,
|
|
@@ -211035,9 +211056,41 @@ var init_service3 = __esm({
|
|
|
211035
211056
|
);
|
|
211036
211057
|
const turns = await this.resolveTurns(companyId);
|
|
211037
211058
|
const claimed = await this.claim(store, record10.id, now, Boolean(turns));
|
|
211038
|
-
if (claimed) this.track(this.dispatchExpert(claimed,
|
|
211059
|
+
if (claimed) this.track(this.dispatchExpert(claimed, expertTask, companyId, snapshot, turns, { inbound }));
|
|
211039
211060
|
if (inserted) this.options.metrics?.recordCreated();
|
|
211040
|
-
return { record: record10, created: inserted };
|
|
211061
|
+
return { record: record10, created: inserted, ...overlap ? { overlap: { count: overlap.count, lines: overlap.lines } } : {} };
|
|
211062
|
+
}
|
|
211063
|
+
/**
|
|
211064
|
+
* 派活之前那一次比对(ADR 0640 D-C9)。返回要拼进任务书末尾的那一段与条数;没候选、没接比对、出错、超时都回 undefined——
|
|
211065
|
+
* **绝不挡住派活**。超时那一枝不等比对自己结束(它在后台跑完也只是多记一条比对事件)。
|
|
211066
|
+
*/
|
|
211067
|
+
async overlapForExpert(task, record10, caller, companyId) {
|
|
211068
|
+
if (!this.options.overlapForTask) return void 0;
|
|
211069
|
+
const timeoutMs = this.options.overlapTimeoutMs ?? DELEGATION_OVERLAP_TIMEOUT_MS;
|
|
211070
|
+
let timer;
|
|
211071
|
+
try {
|
|
211072
|
+
const r5 = await Promise.race([
|
|
211073
|
+
this.options.overlapForTask({
|
|
211074
|
+
...companyId ? { companyId } : {},
|
|
211075
|
+
actor: caller.actor,
|
|
211076
|
+
parentSessionId: record10.parentSessionId,
|
|
211077
|
+
delegationId: record10.id,
|
|
211078
|
+
task
|
|
211079
|
+
}),
|
|
211080
|
+
new Promise((resolve13) => {
|
|
211081
|
+
timer = setTimeout(() => resolve13(void 0), timeoutMs);
|
|
211082
|
+
})
|
|
211083
|
+
]);
|
|
211084
|
+
if (!r5?.enabled) return void 0;
|
|
211085
|
+
const block = formatOverlapForExpert(r5, r5.timeZone);
|
|
211086
|
+
if (!block) return void 0;
|
|
211087
|
+
return { block, count: r5.active.length + r5.done.length, lines: formatOverlapLines(r5, r5.timeZone).filter((l3) => l3.startsWith(" ")) };
|
|
211088
|
+
} catch (error3) {
|
|
211089
|
+
console.warn(`[delegation] \u6D3E\u6D3B\u524D\u7684\u9632\u91CD\u53E0\u6BD4\u5BF9\u5931\u8D25\uFF0C\u8FD9\u6B21\u4E0D\u9644\u5019\u9009\u3001\u7167\u5E38\u6D3E\u6D3B\uFF08${record10.id}\uFF09: ${String(error3)}`);
|
|
211090
|
+
return void 0;
|
|
211091
|
+
} finally {
|
|
211092
|
+
if (timer) clearTimeout(timer);
|
|
211093
|
+
}
|
|
211041
211094
|
}
|
|
211042
211095
|
/**
|
|
211043
211096
|
* 把子会话与它的两条起始消息**补齐到该有的样子**——可以重复调用,缺什么补什么。
|
|
@@ -212073,14 +212126,16 @@ function delegationRoutes(service) {
|
|
|
212073
212126
|
const body2 = { to, task, ...as ? { as } : {}, ...files?.length ? { files } : {} };
|
|
212074
212127
|
const invocationId = trustedDelegationInvocationId(body2, req.auth.dispatch);
|
|
212075
212128
|
try {
|
|
212076
|
-
const { record: record10, created } = await service.create(body2, callerOf(req, invocationId));
|
|
212129
|
+
const { record: record10, created, overlap } = await service.create(body2, callerOf(req, invocationId));
|
|
212077
212130
|
const payload2 = {
|
|
212078
212131
|
delegationId: record10.id,
|
|
212079
212132
|
childSessionId: record10.childSessionId,
|
|
212080
212133
|
// **实际生效**的 label(撞名后服务端加了后缀)。协调者引用时用这个返回值,
|
|
212081
212134
|
// 不用它自己传进去的那个——引用错了会静默指到另一条委派上(§6.2.8)。
|
|
212082
212135
|
label: record10.label ?? "",
|
|
212083
|
-
...files?.length ? { attachedFiles: files } : {}
|
|
212136
|
+
...files?.length ? { attachedFiles: files } : {},
|
|
212137
|
+
// 派活之前比出来、已附进专家任务书的相近事项(ADR 0640 D-C9)。派活方只据此说一句「附了 N 条」。
|
|
212138
|
+
...overlap ? { overlapAttached: overlap.count, overlap: overlap.lines } : {}
|
|
212084
212139
|
};
|
|
212085
212140
|
return { status: created ? 202 : 200, body: payload2 };
|
|
212086
212141
|
} catch (error3) {
|
|
@@ -213340,6 +213395,14 @@ var init_github_app_timing = __esm({
|
|
|
213340
213395
|
});
|
|
213341
213396
|
|
|
213342
213397
|
// ../server/src/manifest-text.ts
|
|
213398
|
+
function decodeUtf8Text(bytes2) {
|
|
213399
|
+
if (bytes2.includes(0)) return null;
|
|
213400
|
+
try {
|
|
213401
|
+
return new TextDecoder("utf-8", { fatal: true }).decode(bytes2);
|
|
213402
|
+
} catch {
|
|
213403
|
+
return null;
|
|
213404
|
+
}
|
|
213405
|
+
}
|
|
213343
213406
|
async function renderManifestText(blobs, manifestRef) {
|
|
213344
213407
|
const CAP = 256 * 1024;
|
|
213345
213408
|
let entries;
|
|
@@ -213349,13 +213412,11 @@ async function renderManifestText(blobs, manifestRef) {
|
|
|
213349
213412
|
return `\u591A\u6587\u4EF6\uFF08\u88C5\u7BB1\u5355 ${manifestRef.slice(0, 12)}\u2026\uFF09\u2014\u2014 \u8BFB\u53D6\u5931\u8D25\uFF1A${e5 instanceof Error ? e5.message : String(e5)}`;
|
|
213350
213413
|
}
|
|
213351
213414
|
if (entries.length === 0) return "\uFF08\u7A7A\u4EA4\u4ED8\u7269\uFF09";
|
|
213352
|
-
const dec2 = new TextDecoder();
|
|
213353
213415
|
const single = entries.length === 1;
|
|
213354
213416
|
const parts = [];
|
|
213355
213417
|
let total = 0;
|
|
213356
213418
|
for (const e5 of entries) {
|
|
213357
|
-
|
|
213358
|
-
let body2 = isText ? dec2.decode(e5.bytes) : `\uFF08\u4E8C\u8FDB\u5236\u6587\u4EF6\uFF0C${e5.bytes.length} \u5B57\u8282\uFF09`;
|
|
213419
|
+
let body2 = decodeUtf8Text(e5.bytes) ?? `\uFF08\u4E8C\u8FDB\u5236\u6587\u4EF6\uFF0C${e5.bytes.length} \u5B57\u8282\uFF09`;
|
|
213359
213420
|
if (total + body2.length > CAP) body2 = body2.slice(0, Math.max(0, CAP - total)) + "\n\u2026\uFF08\u5DF2\u622A\u65AD\uFF09";
|
|
213360
213421
|
total += body2.length;
|
|
213361
213422
|
parts.push(single ? body2 : `===== ${e5.path} =====
|
|
@@ -214873,12 +214934,11 @@ async function runView(kernel, oplog, engineStore, blobs, name, artifactId, para
|
|
|
214873
214934
|
if (path50 !== null) {
|
|
214874
214935
|
const e5 = entries.find((x2) => x2.path === path50);
|
|
214875
214936
|
if (!e5) throw new Error(`\u6587\u4EF6\u4E0D\u5B58\u5728: ${path50}\uFF08\u8BE5\u7248\u672C\u6709\uFF1A${entries.map((x2) => x2.path).join("\u3001")}\uFF09`);
|
|
214876
|
-
|
|
214877
|
-
return { kind: "file", path: path50, bytes: e5.bytes.length, text: isText ? dec2.decode(e5.bytes) : null, at: at2 };
|
|
214937
|
+
return { kind: "file", path: path50, bytes: e5.bytes.length, text: decodeUtf8Text(e5.bytes), at: at2 };
|
|
214878
214938
|
}
|
|
214879
214939
|
return {
|
|
214880
214940
|
kind: "manifest",
|
|
214881
|
-
files: entries.map((e5) => ({ path: e5.path, bytes: e5.bytes.length, binary: e5.bytes
|
|
214941
|
+
files: entries.map((e5) => ({ path: e5.path, bytes: e5.bytes.length, binary: decodeUtf8Text(e5.bytes) === null })),
|
|
214882
214942
|
at: at2
|
|
214883
214943
|
};
|
|
214884
214944
|
}
|
|
@@ -215026,6 +215086,7 @@ async function startOasisServer(opts) {
|
|
|
215026
215086
|
resolveChatTurns: async (companyId) => (opts.resolveChatTurns ? await opts.resolveChatTurns(companyId) : void 0) ?? opts.chatTurns,
|
|
215027
215087
|
...opts.delegationProbeRuntime ? { probeRuntime: opts.delegationProbeRuntime } : {},
|
|
215028
215088
|
...opts.delegationProbeAllocation ? { probeAllocation: opts.delegationProbeAllocation } : {},
|
|
215089
|
+
...opts.delegationOverlap ? { overlapForTask: opts.delegationOverlap } : {},
|
|
215029
215090
|
...opts.chatDelegationEnabled ? { enabled: opts.chatDelegationEnabled } : {},
|
|
215030
215091
|
...opts.delegationWorkdir ? { workdir: opts.delegationWorkdir } : {},
|
|
215031
215092
|
...opts.delegationMetrics ? { metrics: opts.delegationMetrics } : {}
|
|
@@ -255856,7 +255917,7 @@ function metaString(meta, key2) {
|
|
|
255856
255917
|
}
|
|
255857
255918
|
return null;
|
|
255858
255919
|
}
|
|
255859
|
-
var SEG_TURN_CAP, RUN_PAGE, RUN_CAP, NODE_WORK_CAP, MAX_CHAIN_NODES, MESSAGE_CAP, SIGNAL_TEXT_CAP, EXOGENOUS_TEXT_CAP, FIND_DEFAULT_LIMIT, FIND_BATCH_MAX, FIND_MAX_LIMIT, RUN_ROW_CAP, TURN_TERMINAL, REVIEW_ENDED, DELEGATION_ENDED, SYSTEM_CANCEL_REASONS, EXOGENOUS_RUN_STATUS, UnitError, ms, turnStart, turnEnd, UnitService, unitTypeOf, segId, clipField, outcomeFetchCmd, exogenousFetchCmd, UnitReader;
|
|
255920
|
+
var SEG_TURN_CAP, RUN_PAGE, RUN_CAP, NODE_WORK_CAP, MAX_CHAIN_NODES, MESSAGE_CAP, SIGNAL_TEXT_CAP, EXOGENOUS_TEXT_CAP, EXOGENOUS_SUMMARY_CAP, FIND_DEFAULT_LIMIT, FIND_BATCH_MAX, FIND_MAX_LIMIT, RUN_ROW_CAP, TURN_TERMINAL, REVIEW_ENDED, DELEGATION_ENDED, SYSTEM_CANCEL_REASONS, EXOGENOUS_RUN_STATUS, UnitError, ms, turnStart, turnEnd, UnitService, unitTypeOf, segId, clipField, outcomeFetchCmd, exogenousFetchCmd, UnitReader;
|
|
255860
255921
|
var init_units = __esm({
|
|
255861
255922
|
"../server/src/domains/trace/units.ts"() {
|
|
255862
255923
|
"use strict";
|
|
@@ -255871,6 +255932,7 @@ var init_units = __esm({
|
|
|
255871
255932
|
MESSAGE_CAP = 1e3;
|
|
255872
255933
|
SIGNAL_TEXT_CAP = 2e3;
|
|
255873
255934
|
EXOGENOUS_TEXT_CAP = 500;
|
|
255935
|
+
EXOGENOUS_SUMMARY_CAP = 120;
|
|
255874
255936
|
FIND_DEFAULT_LIMIT = 20;
|
|
255875
255937
|
FIND_BATCH_MAX = 200;
|
|
255876
255938
|
FIND_MAX_LIMIT = 200;
|
|
@@ -256728,11 +256790,14 @@ var init_units = __esm({
|
|
|
256728
256790
|
});
|
|
256729
256791
|
}
|
|
256730
256792
|
}
|
|
256731
|
-
if (u.kind === "work") facts.push(...await this.upstreamFacts(u.work, field));
|
|
256793
|
+
if (u.kind === "work") facts.push(...await this.upstreamFacts(u.work, field, opts.full === true));
|
|
256732
256794
|
return facts;
|
|
256733
256795
|
}
|
|
256734
|
-
/**
|
|
256735
|
-
|
|
256796
|
+
/**
|
|
256797
|
+
* 单元时间窗里上游(输入节点、brief)收到的 issue、出的新版本。
|
|
256798
|
+
* `full`:issue 摘要给原文全文——摘要里的截断标记指向的就是 `--full`,不能在 `--full` 下仍给同一截断(旧版 CLI 只打摘要,也靠这一行取全文)。
|
|
256799
|
+
*/
|
|
256800
|
+
async upstreamFacts(w2, field, full) {
|
|
256736
256801
|
const out = [];
|
|
256737
256802
|
const from = w2.startedAt ?? w2.createdAt;
|
|
256738
256803
|
const to = w2.endedAt ?? w2.deadAt ?? new Date(this.nowMs).toISOString();
|
|
@@ -256745,11 +256810,13 @@ var init_units = __esm({
|
|
|
256745
256810
|
const nodeIds = [...nodes5];
|
|
256746
256811
|
for (const i5 of await this.data.issuesInWorkorder(w2.workorderId, { aboutNodeIds: nodeIds, fromIso: from, toIso: to, limit: 50 })) {
|
|
256747
256812
|
const b6 = field(i5.body);
|
|
256813
|
+
const head = (i5.body.split("\n")[0] ?? "").slice(0, EXOGENOUS_SUMMARY_CAP);
|
|
256814
|
+
const more = head.length < i5.body.length ? ` \u2026\uFF08\u5168\u6587 ${i5.body.length} \u5B57 \u2192 ${b6.fetchCmd}\uFF09` : "";
|
|
256748
256815
|
out.push({
|
|
256749
256816
|
kind: "upstream-issue",
|
|
256750
256817
|
at: i5.createdAt,
|
|
256751
256818
|
runId: null,
|
|
256752
|
-
summary: `\u6267\u884C\u671F\u95F4\u4E0A\u6E38\u8282\u70B9 ${i5.aboutNodeId} \u6536\u5230 ${i5.kind}\uFF1A${
|
|
256819
|
+
summary: `\u6267\u884C\u671F\u95F4\u4E0A\u6E38\u8282\u70B9 ${i5.aboutNodeId} \u6536\u5230 ${i5.kind}\uFF1A${full ? i5.body : `${head}${more}`}`,
|
|
256753
256820
|
detail: { issueId: i5.id, kind: i5.kind, aboutNodeId: i5.aboutNodeId, author: i5.authorActorId, resolved: i5.resolvedAt != null, body: b6 }
|
|
256754
256821
|
});
|
|
256755
256822
|
}
|
|
@@ -326728,6 +326795,7 @@ __export(src_exports2, {
|
|
|
326728
326795
|
DEFAULT_SIMPLE_QUERY_MAX_CHARS: () => DEFAULT_SIMPLE_QUERY_MAX_CHARS,
|
|
326729
326796
|
DEFAULT_TERMINAL_MAX_AGE_MS: () => DEFAULT_TERMINAL_MAX_AGE_MS,
|
|
326730
326797
|
DEFAULT_TIME_ZONE_ENV: () => DEFAULT_TIME_ZONE_ENV,
|
|
326798
|
+
DELEGATION_OVERLAP_TIMEOUT_MS: () => DELEGATION_OVERLAP_TIMEOUT_MS,
|
|
326731
326799
|
DELIVERY_REPAIR_BATCH: () => DELIVERY_REPAIR_BATCH,
|
|
326732
326800
|
DENY_ALL_TRACE_READ: () => DENY_ALL_TRACE_READ,
|
|
326733
326801
|
DISPATCH_DROP_BACKOFF_MS: () => DISPATCH_DROP_BACKOFF_MS,
|
|
@@ -330331,7 +330399,8 @@ var OverlapService = class {
|
|
|
330331
330399
|
...input.subjectId?.trim() ? { subjectId: input.subjectId.trim() } : {},
|
|
330332
330400
|
...input.chatSessionId?.trim() ? { chatSessionId: input.chatSessionId.trim() } : {},
|
|
330333
330401
|
candidates: picked.map((c5) => ({ kind: c5.kind, phase: c5.phase, id: overlapCandidateId(c5), score: c5.score })),
|
|
330334
|
-
minScore
|
|
330402
|
+
minScore,
|
|
330403
|
+
deliveredTo: input.deliveredTo ?? "caller"
|
|
330335
330404
|
};
|
|
330336
330405
|
try {
|
|
330337
330406
|
await (await this.deps.events(companyId)).append(event);
|
|
@@ -331036,15 +331105,16 @@ var PostgresOverlapEventStore = class _PostgresOverlapEventStore {
|
|
|
331036
331105
|
candidates jsonb NOT NULL,
|
|
331037
331106
|
min_score double precision NOT NULL
|
|
331038
331107
|
)`);
|
|
331108
|
+
await pool.query(`ALTER TABLE ${store.s}.overlap_events ADD COLUMN IF NOT EXISTS delivered_to text`);
|
|
331039
331109
|
await pool.query(`CREATE INDEX IF NOT EXISTS overlap_events_at_idx ON ${store.s}.overlap_events (at DESC)`);
|
|
331040
331110
|
});
|
|
331041
331111
|
return store;
|
|
331042
331112
|
}
|
|
331043
331113
|
async append(e5) {
|
|
331044
331114
|
await this.pool.query(
|
|
331045
|
-
`INSERT INTO ${this.s}.overlap_events (id,at,principal_actor_id,actor_id,action,subject_id,chat_session_id,candidates,min_score)
|
|
331046
|
-
VALUES ($1,$2,$3,$4,$5,$6,$7,$8::jsonb,$9) ON CONFLICT (id) DO NOTHING`,
|
|
331047
|
-
[e5.id, e5.at, e5.principalActorId, e5.actorId, e5.action, e5.subjectId ?? null, e5.chatSessionId ?? null, JSON.stringify(e5.candidates), e5.minScore]
|
|
331115
|
+
`INSERT INTO ${this.s}.overlap_events (id,at,principal_actor_id,actor_id,action,subject_id,chat_session_id,candidates,min_score,delivered_to)
|
|
331116
|
+
VALUES ($1,$2,$3,$4,$5,$6,$7,$8::jsonb,$9,$10) ON CONFLICT (id) DO NOTHING`,
|
|
331117
|
+
[e5.id, e5.at, e5.principalActorId, e5.actorId, e5.action, e5.subjectId ?? null, e5.chatSessionId ?? null, JSON.stringify(e5.candidates), e5.minScore, e5.deliveredTo ?? null]
|
|
331048
331118
|
);
|
|
331049
331119
|
}
|
|
331050
331120
|
async listRecent(limit) {
|
|
@@ -331058,7 +331128,8 @@ var PostgresOverlapEventStore = class _PostgresOverlapEventStore {
|
|
|
331058
331128
|
...row.subject_id ? { subjectId: row.subject_id } : {},
|
|
331059
331129
|
...row.chat_session_id ? { chatSessionId: row.chat_session_id } : {},
|
|
331060
331130
|
candidates: row.candidates,
|
|
331061
|
-
minScore: Number(row.min_score)
|
|
331131
|
+
minScore: Number(row.min_score),
|
|
331132
|
+
deliveredTo: row.delivered_to === "expert" ? "expert" : "caller"
|
|
331062
331133
|
}));
|
|
331063
331134
|
}
|
|
331064
331135
|
};
|
|
@@ -335601,6 +335672,17 @@ async function startServe(opts) {
|
|
|
335601
335672
|
* 用 `tryAllocate`(不抛、不消耗重试次数):这里只是问「挑不挑得出来」,真正的分配在
|
|
335602
335673
|
* 那一轮派发时再跑一次——两次之间机器状态可能变,以派发那一次为准。
|
|
335603
335674
|
*/
|
|
335675
|
+
// 防重叠比对(ADR 0640 D-C9):委派在派活之前比一次(代表派活那段对话的真人),候选附进专家任务书;比对事件标「附给专家」。
|
|
335676
|
+
delegationOverlap: async ({ companyId, actor, parentSessionId, delegationId, task }) => {
|
|
335677
|
+
const cid = companyId ?? defaultCompanyId;
|
|
335678
|
+
return overlapRuntime.service.check(cid, await overlapRuntime.resolveCaller(actor, cid), {
|
|
335679
|
+
action: "delegate",
|
|
335680
|
+
text: task,
|
|
335681
|
+
subjectId: delegationId,
|
|
335682
|
+
chatSessionId: parentSessionId,
|
|
335683
|
+
deliveredTo: "expert"
|
|
335684
|
+
});
|
|
335685
|
+
},
|
|
335604
335686
|
delegationProbeAllocation: async ({ actorId, actorName, companyId }) => {
|
|
335605
335687
|
const result = await runtimeAllocatorFor(companyId ?? defaultCompanyId).tryAllocate({
|
|
335606
335688
|
actorId,
|
|
@@ -342823,7 +342905,7 @@ var COMMAND_DECLS = {
|
|
|
342823
342905
|
delegate: {
|
|
342824
342906
|
group: "\u59D4\u6D3E\u4E13\u5BB6",
|
|
342825
342907
|
usage: 'oasis delegate --to <role|actorId> --task "<\u4EFB\u52A1\u4E66>" [--as <\u77ED\u540D>] [--file <\u8DEF\u5F84>]... [--json true]\n oasis delegate --follow-up <\u5F15\u7528> --text "<...>" [--file <\u8DEF\u5F84>]...\n oasis delegate --status <\u5F15\u7528|\u59D4\u6D3Eid> [--json true]\n oasis delegate --list [--all] [--json true]',
|
|
342826
|
-
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\
|
|
342908
|
+
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\u6D3E\u6D3B\u4E4B\u524D\u7CFB\u7EDF\u4F1A\u62FF\u4EFB\u52A1\u4E66\u6BD4\u4E00\u4E0B\u672C\u516C\u53F8\u6709\u6CA1\u6709\u4EBA\u5728\u505A\u6216\u505A\u8FC7\u76F8\u8FD1\u7684\u4E8B\uFF0C\u6709\u7684\u8BDD\u9644\u5728\u4E13\u5BB6\u4EFB\u52A1\u4E66\u672B\u5C3E\u3001\u7531\u4E13\u5BB6\u5F00\u5DE5\u524D\u6838\u5BF9\uFF08\u8F93\u51FA\u91CC\u591A\u4E00\u884C\u300C\u5DF2\u628A N \u6761\u76F8\u8FD1\u4E8B\u9879\u9644\u7ED9\u4E13\u5BB6\u300D\uFF0C--json \u5728 overlapAttached / overlap \u5B57\u6BB5\uFF09\uFF1B\u4F60\u4E0D\u7528\u53BB\u67E5\uFF0C\u7167\u5E38\u6536\u5C3E\u3002",
|
|
342827
342909
|
flags: [
|
|
342828
342910
|
{ 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" },
|
|
342829
342911
|
{ 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" },
|
|
@@ -343935,7 +344017,7 @@ var COMMAND_DECLS = {
|
|
|
343935
344017
|
"trace exogenous": {
|
|
343936
344018
|
group: "\u6267\u884C\u8BB0\u5F55\uFF08trace\uFF09",
|
|
343937
344019
|
usage: "oasis trace exogenous <unit> [--full] [--json]",
|
|
343938
|
-
description: "\u5916\u90E8\u56E0\u7D20\u4E8B\u5B9E\uFF1Arun \u8D85\u65F6 / \u88AB\u6740 / \u5931\u8054\u3001\u767B\u5F55\u5931\u6548\u4E0E\u989D\u5EA6\u4E00\u7C7B\u9519\u8BEF\u7801\u3001\u6362\u673A\u3001\u7CFB\u7EDF\u539F\u56E0\u7684\u53EB\u505C\u3001\u534F\u8BAE\u6062\u590D\u3001\u4E0A\u6E38 issue\u3001\u6267\u884C\u671F\u95F4\u9700\u6C42\u53D8\u4E86\u3002\u53CD\u601D\u65F6\u5148\u770B\u5B83\uFF0C\u5C5E\u4E8E\u5916\u90E8\u539F\u56E0\u7684\u6539\u8FDB\u70B9\u6807 category=external\u3002\u9519\u8BEF\u4FE1\u606F\u4E0E issue \
|
|
344020
|
+
description: "\u5916\u90E8\u56E0\u7D20\u4E8B\u5B9E\uFF1Arun \u8D85\u65F6 / \u88AB\u6740 / \u5931\u8054\u3001\u767B\u5F55\u5931\u6548\u4E0E\u989D\u5EA6\u4E00\u7C7B\u9519\u8BEF\u7801\u3001\u6362\u673A\u3001\u7CFB\u7EDF\u539F\u56E0\u7684\u53EB\u505C\u3001\u534F\u8BAE\u6062\u590D\u3001\u4E0A\u6E38 issue\u3001\u6267\u884C\u671F\u95F4\u9700\u6C42\u53D8\u4E86\u3002\u53CD\u601D\u65F6\u5148\u770B\u5B83\uFF0C\u5C5E\u4E8E\u5916\u90E8\u539F\u56E0\u7684\u6539\u8FDB\u70B9\u6807 category=external\u3002\u6BCF\u6761\u4E8B\u5B9E\u4E0B\u65B9\u7F29\u8FDB\u6253\u51FA run \u7684\u9519\u8BEF\u4FE1\u606F\u4E0E\u4E0A\u6E38 issue \u6B63\u6587\uFF1B\u8FC7\u957F\u65F6\u622A\u65AD\u5E76\u5E26 `[\u5DF2\u7701\u7565 N \u5B57 \u2192 oasis trace exogenous <unit> --full]`\uFF0C\u52A0 --full \u6253\u51FA\u5168\u6587\u3002",
|
|
343939
344021
|
positional: [{ name: "<unit>", required: true, desc: "\u5355\u5143 id \u6216 run id" }],
|
|
343940
344022
|
flags: [
|
|
343941
344023
|
{ name: "full", desc: "\u957F\u6587\u672C\u4E0D\u622A\u65AD", boolean: true, own: true },
|
|
@@ -345058,6 +345140,9 @@ var fmtMs = (ms2) => {
|
|
|
345058
345140
|
return s3 < 120 ? `${s3}s` : `${Math.round(s3 / 60)}min`;
|
|
345059
345141
|
};
|
|
345060
345142
|
var scalar = (v2) => typeof v2 === "string" ? v2 : JSON.stringify(v2);
|
|
345143
|
+
var isTruncatedField = (v2) => typeof v2 === "object" && v2 !== null && typeof v2.text === "string" && typeof v2.truncated === "boolean" && typeof v2.fullChars === "number";
|
|
345144
|
+
var EXOGENOUS_TEXT_LABELS = { errorMessage: "\u9519\u8BEF\u4FE1\u606F", body: "\u6B63\u6587" };
|
|
345145
|
+
var EXOGENOUS_TEXT_INDENT = " ";
|
|
345061
345146
|
function renderEventPreview(e5, opts = {}) {
|
|
345062
345147
|
const head = `#${e5.seq} [${e5.eventType}] ${e5.kind}${e5.toolName ? ` ${e5.toolName}` : ""}${e5.level === "error" ? " \u26A0error" : ""}`;
|
|
345063
345148
|
const tail = e5.ingestTruncated ? " [\u5165\u5E93\u524D\u5DF2\u88AB\u9002\u914D\u5668\u622A\u65AD\uFF0C\u539F\u6837\u7ED9\u51FA]" : "";
|
|
@@ -345096,7 +345181,14 @@ function renderTrace(sub, data, flags, println) {
|
|
|
345096
345181
|
return;
|
|
345097
345182
|
}
|
|
345098
345183
|
println(`${r5.unitId} \u7684\u5916\u90E8\u56E0\u7D20\uFF08${r5.facts.length} \u6761\uFF09\uFF1A`);
|
|
345099
|
-
for (const f6 of r5.facts)
|
|
345184
|
+
for (const f6 of r5.facts) {
|
|
345185
|
+
println(` [${f6.kind}] ${orDash(f6.at)}${f6.runId ? ` ${f6.runId}` : ""} ${oneLine3(f6.summary)}`);
|
|
345186
|
+
for (const [k6, v2] of Object.entries(f6.detail ?? {})) {
|
|
345187
|
+
if (!isTruncatedField(v2)) continue;
|
|
345188
|
+
println(` ${EXOGENOUS_TEXT_LABELS[k6] ?? k6}\uFF08\u5171 ${v2.fullChars} \u5B57${v2.truncated ? `\uFF0C\u5DF2\u622A\u65AD\uFF0C\u53D6\u5168\u6587\uFF1A${v2.fetchCmd}` : ""}\uFF09\uFF1A`);
|
|
345189
|
+
println(v2.text.replace(/^/gm, EXOGENOUS_TEXT_INDENT));
|
|
345190
|
+
}
|
|
345191
|
+
}
|
|
345100
345192
|
return;
|
|
345101
345193
|
}
|
|
345102
345194
|
case "runs": {
|
|
@@ -346025,7 +346117,7 @@ async function waitForCommandAuthorization(base, headers, draftId, fallback2) {
|
|
|
346025
346117
|
}
|
|
346026
346118
|
}
|
|
346027
346119
|
}
|
|
346028
|
-
var CLI_VERSION = "2.2.
|
|
346120
|
+
var CLI_VERSION = "2.2.128" ? "2.2.128" : "dev";
|
|
346029
346121
|
function apiHeaders(token2, company) {
|
|
346030
346122
|
const headers = {
|
|
346031
346123
|
authorization: `Bearer ${token2}`,
|
|
@@ -346831,17 +346923,15 @@ ${round.text}`);
|
|
|
346831
346923
|
{ to, task, ...flags.get("as") ? { as: flags.get("as") } : {}, ...fileArgs.length ? { files: fileArgs } : {} }
|
|
346832
346924
|
);
|
|
346833
346925
|
if (asJson2) {
|
|
346834
|
-
|
|
346835
|
-
println(JSON.stringify({ ...started, ...overlap2.length ? { overlap: overlap2 } : {} }, null, 2));
|
|
346926
|
+
println(JSON.stringify(started, null, 2));
|
|
346836
346927
|
break;
|
|
346837
346928
|
}
|
|
346838
346929
|
println(`\u5DF2\u4EA4\u7ED9 ${to} \u53BB\u505A\uFF08\u5F02\u6B65\uFF0C\u4E0D\u7528\u7B49\uFF09\u3002`);
|
|
346839
346930
|
println(` \u77ED\u540D\uFF08--follow-up \u7528\u8FD9\u4E2A\uFF09\uFF1A${started.label}`);
|
|
346840
346931
|
println(` delegationId\uFF1A${started.delegationId}`);
|
|
346841
346932
|
if (started.attachedFiles?.length) println(` \u5E26\u8FC7\u53BB\u7684\u6587\u4EF6\uFF1A${started.attachedFiles.join("\u3001")}`);
|
|
346842
|
-
|
|
346843
|
-
|
|
346844
|
-
println(overlap.length ? "\u7ED3\u679C\u5E72\u5B8C\u4E86\u4F1A\u81EA\u5DF1\u56DE\u5230\u8FD9\u6761\u5BF9\u8BDD\u3002\u6536\u5C3E\u524D\u5148\u6309\u4E0A\u9762\u300C\u76F8\u8FD1\u7684\u4E8B\u9879\u300D\u9010\u6761\u67E5\u5B8C\uFF08\u786E\u5B9E\u76F8\u5173\u624D\u987A\u5E26\u544A\u8BC9\u7528\u6237\uFF09\uFF0C\u7136\u540E\u8FD9\u4E00\u8F6E\u5C31\u6536\u5C3E\u2014\u2014\u4E0D\u7528\u7B49\u4E13\u5BB6\u3002" : "\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");
|
|
346933
|
+
if (started.overlapAttached) println(` \u5DF2\u628A ${started.overlapAttached} \u6761\u76F8\u8FD1\u4E8B\u9879\u9644\u7ED9\u4E13\u5BB6\uFF0C\u4E13\u5BB6\u5F00\u5DE5\u524D\u4F1A\u6838\u5BF9\u3002`);
|
|
346934
|
+
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");
|
|
346845
346935
|
break;
|
|
346846
346936
|
}
|
|
346847
346937
|
case "kb": {
|
|
@@ -350339,7 +350429,7 @@ function shimScript() {
|
|
|
350339
350429
|
}
|
|
350340
350430
|
|
|
350341
350431
|
// src/index.ts
|
|
350342
|
-
var PKG_VERSION = true ? "2.2.
|
|
350432
|
+
var PKG_VERSION = true ? "2.2.128" : "dev";
|
|
350343
350433
|
var LOCAL_BIN = localBin();
|
|
350344
350434
|
var NPM_PREFIX = npmPrefix();
|
|
350345
350435
|
var INSTANCE = DEFAULT_INSTANCE;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oasis_test_v2",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.128",
|
|
4
4
|
"description": "Oasis node daemon + CLI — background daemon, auto-start, full server CLI",
|
|
5
5
|
"bin": {
|
|
6
6
|
"oasis": "./dist/index.js"
|
|
@@ -26,6 +26,6 @@
|
|
|
26
26
|
"node": ">=20"
|
|
27
27
|
},
|
|
28
28
|
"oasisRelease": {
|
|
29
|
-
"sourceHead": "
|
|
29
|
+
"sourceHead": "04f9ff49b5d972690f1ff184c248f9683de3e8b1"
|
|
30
30
|
}
|
|
31
31
|
}
|