@sema-agent/server 4.1.2 → 4.1.3

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) }));
@@ -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.1.2",
3
+ "version": "4.1.3",
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",
@@ -55,7 +55,7 @@
55
55
  },
56
56
  "dependencies": {
57
57
  "@sema-agent/core": "^3.0.0",
58
- "@sema-agent/registry-core": "^0.12.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",