@sema-agent/server 5.0.1 → 5.1.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.
|
@@ -77,7 +77,7 @@ export function createResolveSpec(ctx) {
|
|
|
77
77
|
// body.scenario is bounded to the allowlist — outside ⇒ typed 400 `scenario_not_allowed`). The ruling
|
|
78
78
|
// {scenario, allowlist} is center-RESOLVED and rides the caps view (TTL-cached, same fetch as runtimeCaps);
|
|
79
79
|
// no center / dry-run / anonymous / older center / caps blip ⇒ undefined ⇒ legacy body-or-default chain.
|
|
80
|
-
const requested = gateScenarioRequest(await principalCaps?.scenarioRuling(auth?.principal), body.scenario, config.defaultScenario);
|
|
80
|
+
const requested = gateScenarioRequest(await principalCaps?.scenarioRuling(auth?.principal), body.scenario, config.defaultScenario, Object.keys(scenarios));
|
|
81
81
|
// per-principal execution-lane policy — this worker's lane is a
|
|
82
82
|
// PROCESS identity (REMOTE_EXEC boot wiring, no per-task switch), so admission is the gate: lane ∉
|
|
83
83
|
// allowedLanes ⇒ typed 403 `execution_lane_not_allowed`. Same caps car as the scenario ruling (zero extra
|
|
@@ -196,5 +196,5 @@ export interface ScenarioRuling {
|
|
|
196
196
|
* 到现状,与 workflows 面的 fail-closed 是刻意的 posture 差异,见 runtime-caps-resolver)。
|
|
197
197
|
* - body.scenario 未给:ruling 胜者 ⇒ 指派为默认;无胜者 ⇒ defaultScenario 现状链。
|
|
198
198
|
*/
|
|
199
|
-
export declare function gateScenarioRequest(ruling: ScenarioRuling | undefined, bodyScenario: unknown, defaultScenario: string): string;
|
|
199
|
+
export declare function gateScenarioRequest(ruling: ScenarioRuling | undefined, bodyScenario: unknown, defaultScenario: string, known: readonly string[]): string;
|
|
200
200
|
//# sourceMappingURL=scenarios.d.ts.map
|
|
@@ -417,8 +417,18 @@ export function mergeUserSkills(scenarioSkills, userSkills, logger) {
|
|
|
417
417
|
* 到现状,与 workflows 面的 fail-closed 是刻意的 posture 差异,见 runtime-caps-resolver)。
|
|
418
418
|
* - body.scenario 未给:ruling 胜者 ⇒ 指派为默认;无胜者 ⇒ defaultScenario 现状链。
|
|
419
419
|
*/
|
|
420
|
-
export function gateScenarioRequest(ruling, bodyScenario, defaultScenario) {
|
|
420
|
+
export function gateScenarioRequest(ruling, bodyScenario, defaultScenario, known) {
|
|
421
421
|
if (typeof bodyScenario === "string") {
|
|
422
|
+
// [2395]D③(5.1.0):body 显式给出的**未知名**响亮 400——此前静默折 default(oa 退役后老调用方
|
|
423
|
+
// 无声换了场景=更宽工具面,与零兼容纲领相反)。词表面先于治理面:名字都不存在时谈不上 allowlist。
|
|
424
|
+
// 指派链(ruling/default)不在此验——悬空指派名仍走 resolveSpec 既有 unknown→default(runtime-caps
|
|
425
|
+
// 面的误配另案,不该让一次中心误配把每个请求 400 死)。
|
|
426
|
+
if (!known.includes(bodyScenario)) {
|
|
427
|
+
throw new HttpError(400, `unknown scenario "${bodyScenario}" — this deployment's scenarios are: ${known.join(", ")}`, {
|
|
428
|
+
code: "scenario_unknown",
|
|
429
|
+
extra: { known: [...known] },
|
|
430
|
+
});
|
|
431
|
+
}
|
|
422
432
|
const allowed = ruling?.allowlist ?? [];
|
|
423
433
|
if (allowed.length > 0 && !allowed.includes(bodyScenario)) {
|
|
424
434
|
throw new HttpError(400, `scenario "${bodyScenario}" is not in this principal's assigned allowlist`, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sema-agent/server",
|
|
3
|
-
"version": "5.0
|
|
3
|
+
"version": "5.1.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",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"sharp": "^0.35.3"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
|
-
"@sema-agent/sdk": "^4.
|
|
71
|
+
"@sema-agent/sdk": "^4.1.0",
|
|
72
72
|
"@types/libsodium-wrappers": "^0.7.14",
|
|
73
73
|
"@types/node": "22.10.2",
|
|
74
74
|
"@types/pg": "^8.20.0",
|