@sema-agent/server 4.1.2 → 4.2.0
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.
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { createHash } from "node:crypto";
|
|
8
8
|
import { readEffectiveWire } from "@sema-agent/registry-core";
|
|
9
|
+
import { centerPromptsFromEffective } from "../prompts-domain-validate.js"; // #100 worker 腿 prompts 边界归一(中立叶)
|
|
9
10
|
/** GET the effective config (Bearer + ETag). null = 304 (unchanged). Throws on transport/HTTP error, and on a
|
|
10
11
|
* payload that is not an effective config at all(非对象 / version 非有限数 / gate 域坏形——[2281] 裁B)。
|
|
11
12
|
* `domainErrors`:坏 catalog 域(schema default 已落)逐域单列——与本地腿 `FetchEffectiveResult` 同键同义,
|
|
@@ -35,6 +36,14 @@ export async function fetchEffective(baseUrl, token, etag, fetchImpl = fetch, wo
|
|
|
35
36
|
// 警告(值已被收编接受)不算 error,不进 domainErrors——与本地店同口径。
|
|
36
37
|
const warnings = [];
|
|
37
38
|
const wire = readEffectiveWire(await res.json(), (w) => warnings.push(w));
|
|
39
|
+
// #100 边界单点归一(§V2-B):worker 腿 prompts 键在**这里**定形——0.13.0 起 wire 值 verbatim 到手,
|
|
40
|
+
// 存储原文(global lane 合法下发形/emptyEffective 底座)归一为「键缺席」或 catalog 投影,下游
|
|
41
|
+
// boot/adopt/refresh/deferred/LKG 存取全部只见「缺席或消费形」(裸 `.prompts` 直读有棘轮钉拦)。
|
|
42
|
+
const centerPrompts = centerPromptsFromEffective(wire);
|
|
43
|
+
if (centerPrompts === undefined)
|
|
44
|
+
delete wire.prompts;
|
|
45
|
+
else
|
|
46
|
+
wire.prompts = centerPrompts;
|
|
38
47
|
const domainErrors = warnings
|
|
39
48
|
.filter((w) => w.kind === "domain-defaulted")
|
|
40
49
|
.map((w) => ({ domain: w.domain, error: (w.error instanceof Error ? w.error.message : String(w.error)).slice(0, 600) }));
|
package/dist/http/routes/runs.js
CHANGED
|
@@ -670,7 +670,7 @@ async function handleRunsBody(req, res, url, ctx, miss) {
|
|
|
670
670
|
leafId,
|
|
671
671
|
gate: { kind: "task_done" },
|
|
672
672
|
pendingAction: { kind: "task_done" },
|
|
673
|
-
state: { activeTools: [], nestedStats: { tokens: 0, turns: 0, tasks: 0, costMicroUsd: 0 } },
|
|
673
|
+
state: { activeTools: [], nestedStats: { tokens: 0, turns: 0, tasks: 0, costMicroUsd: 0, anyUnpriced: false } },
|
|
674
674
|
status: "pending",
|
|
675
675
|
createdAt: Date.now(),
|
|
676
676
|
sourceTaskId: taskId,
|
|
@@ -412,7 +412,10 @@ export class JournalingWorkflowRunStore {
|
|
|
412
412
|
if (!this.fleetBus)
|
|
413
413
|
return;
|
|
414
414
|
const agents = run.agents ?? [];
|
|
415
|
-
|
|
415
|
+
// [2336] doneCount 与 failedCount **不相交**:done 只数 completed。契约以此为前提(fleet-bus.ts
|
|
416
|
+
// startedCount 注的回退式 done+failed ≤ started);把 failed 也计进 done 会让全失败 workflow 的
|
|
417
|
+
// 终帧渲成 "N done"(cli 4.1.3 实测 done=2 failed=2 started=2)。
|
|
418
|
+
const done = agents.filter((a) => a.status === "completed").length;
|
|
416
419
|
const failed = agents.filter((a) => a.status === "failed").length;
|
|
417
420
|
// cli [1726] 二①:CC 规模告警的分母是 **started**(已启动),而 `totalCount`(= agents.length)是**计划总数**
|
|
418
421
|
// (含排队中)。判别口径走 core 导出的 `deriveAgentDisplayStatus` —— 一个 agent 已在 `run.agents` 里但
|
|
@@ -54,4 +54,12 @@ export declare function validatePromptsDomain(raw: unknown): {
|
|
|
54
54
|
ok: false;
|
|
55
55
|
error: string;
|
|
56
56
|
};
|
|
57
|
+
/** #100(docs/R100-PROMPTS-LANE-FIX.md §V2-B)worker 腿 effective 上 `prompts` 键的**形-肯定**判别:
|
|
58
|
+
* 消费形特征(v2 `schemaVersion` 键,或 legacy 三键 packId/contentDigest/sections)⇒ 原样返回交
|
|
59
|
+
* {@link validatePromptsDomain}(收或拒,方向不变);其余=center 存储原文(global lane [1057]①e 下发
|
|
60
|
+
* 存储形是合法输入)——catalog 在场则投影 `{schemaVersion:1, catalog}`(config-provider 本地腿先例),
|
|
61
|
+
* 否则视为「center 未发」⇒ undefined。null=有意 cleared 语义(#100 前 null 走拒,方向为宽是设计变更,
|
|
62
|
+
* 留痕于设计档)。垃圾标量原样返回(fail-loud 归 validate)。
|
|
63
|
+
* 属主放本中立叶:config-lkg 与 boot/refresh 同吃,capabilities 层会重开 S6 刚消的反向依赖边。 */
|
|
64
|
+
export declare function centerPromptsFromEffective(eff: unknown): unknown | undefined;
|
|
57
65
|
//# sourceMappingURL=prompts-domain-validate.d.ts.map
|
|
@@ -147,4 +147,26 @@ export function validatePromptsDomain(raw) {
|
|
|
147
147
|
value.identity = `${value.declarations?.contentDigest ?? "-"}+${value.catalog?.artifact.artifactDigest ?? "-"}`;
|
|
148
148
|
return { ok: true, value };
|
|
149
149
|
}
|
|
150
|
+
/** #100(docs/R100-PROMPTS-LANE-FIX.md §V2-B)worker 腿 effective 上 `prompts` 键的**形-肯定**判别:
|
|
151
|
+
* 消费形特征(v2 `schemaVersion` 键,或 legacy 三键 packId/contentDigest/sections)⇒ 原样返回交
|
|
152
|
+
* {@link validatePromptsDomain}(收或拒,方向不变);其余=center 存储原文(global lane [1057]①e 下发
|
|
153
|
+
* 存储形是合法输入)——catalog 在场则投影 `{schemaVersion:1, catalog}`(config-provider 本地腿先例),
|
|
154
|
+
* 否则视为「center 未发」⇒ undefined。null=有意 cleared 语义(#100 前 null 走拒,方向为宽是设计变更,
|
|
155
|
+
* 留痕于设计档)。垃圾标量原样返回(fail-loud 归 validate)。
|
|
156
|
+
* 属主放本中立叶:config-lkg 与 boot/refresh 同吃,capabilities 层会重开 S6 刚消的反向依赖边。 */
|
|
157
|
+
export function centerPromptsFromEffective(eff) {
|
|
158
|
+
const prompts = eff?.prompts;
|
|
159
|
+
if (prompts === undefined || prompts === null)
|
|
160
|
+
return undefined;
|
|
161
|
+
if (typeof prompts !== "object" || Array.isArray(prompts))
|
|
162
|
+
return prompts;
|
|
163
|
+
const o = prompts;
|
|
164
|
+
if ("schemaVersion" in o)
|
|
165
|
+
return prompts;
|
|
166
|
+
if ("packId" in o && "contentDigest" in o && "sections" in o)
|
|
167
|
+
return prompts;
|
|
168
|
+
if (o.catalog !== undefined)
|
|
169
|
+
return { schemaVersion: 1, catalog: o.catalog };
|
|
170
|
+
return undefined;
|
|
171
|
+
}
|
|
150
172
|
//# sourceMappingURL=prompts-domain-validate.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sema-agent/server",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"description": "Sema Server — the server/API implementation layer for Sema, wiring core, registry, model providers, and cloud agent execution. Built on @sema-agent/core.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "BUSL-1.1",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"build:binary:run-local:darwin-arm64": "bun build --compile --target=bun-darwin-arm64 src/run-local.ts --outfile dist/run-local-darwin-arm64"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@sema-agent/core": "^
|
|
58
|
-
"@sema-agent/registry-core": "^0.
|
|
57
|
+
"@sema-agent/core": "^4.0.0",
|
|
58
|
+
"@sema-agent/registry-core": "^0.13.0",
|
|
59
59
|
"e2b": "^2.28.0",
|
|
60
60
|
"libsodium-wrappers": "^0.8.4",
|
|
61
61
|
"mysql2": "^3.22.4",
|