@sema-agent/server 6.8.0 → 7.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.
@@ -426,18 +426,16 @@ export function deriveSettingsPolicy(settings, gate, workflowGate) {
426
426
  return { toolPolicy: compose(createWorkflowPlanDenyPolicy()), handsReadOnly: true, enablePlanMode: true };
427
427
  case "acceptEdits": {
428
428
  const p = compose(fsWriteGate(true), createWorkflowAskPolicy(workflowGate?.isExempt));
429
- return { ...(p ? { toolPolicy: p } : {}), ...(gate?.shellGate ? { shellGate: gate.shellGate } : {}) };
429
+ return p ? { toolPolicy: p } : {};
430
430
  }
431
431
  case "default":
432
432
  case "auto": {
433
433
  // (historical note kept: the pre-[816] impl fell through to base-only here — with no gate to attach,
434
434
  // acceptEdits-as-loosen could not be honored. The [820] factory inverts the frame: default now ADDS an ask
435
435
  // gate and acceptEdits ADDS a narrower one, both tighten-safe under the deny-wins fold.)
436
- // [1557]§四: gate.shellGate opt-in(absent = pre-此批行为 byte-for-byte)rides alongside the fs-write ask
437
- // gate on the SAME "CC manual" modes — closes the "echo > file bypasses the write gate" hole (cli[1555]②)
438
- // when the deployment explicitly opts in (config MANUAL_MODE_SHELL_GATE).
436
+ // ([1557]§四 shellGate 便车已随 #153 governance 层——见 FsWriteGateWiring 尾注。)
439
437
  const p = compose(fsWriteGate(false), createWorkflowAskPolicy(workflowGate?.isExempt));
440
- return { ...(p ? { toolPolicy: p } : {}), ...(gate?.shellGate ? { shellGate: gate.shellGate } : {}) };
438
+ return p ? { toolPolicy: p } : {};
441
439
  }
442
440
  case "bypassPermissions":
443
441
  case undefined:
@@ -454,27 +452,17 @@ export function deriveSettingsPolicy(settings, gate, workflowGate) {
454
452
  *
455
453
  * Returns `base` untouched when the parsed settings project nothing onto the spec.
456
454
  */
457
- // [1557]§四: core's tightenTaskSpec THROWS TaskSpecTightenError when an override's shellGate ranks LOWER than
458
- // base's (its contract is "the override must itself tighten", not "take the stricter of the two" — unlike
459
- // handsReadOnly, which ORs). Red-first repro: tightenTaskSpec({shellGate:"always"}, {shellGate:"classify"})
460
- // throws — so a deployment that layers autonomy=ask (→"always") UNDER this opt-in (→"classify") would 422
461
- // EVERY request on that mode. Mirrors core's own SHELL_GATE_RANK (tighten-task-spec.js) — only pass the
462
- // override through when it would not be a downgrade; otherwise the baseline already covers it (tightenTaskSpec's
463
- // base-only branch keeps `base.shellGate` unchanged either way — omitting is behaviorally identical, never a
464
- // silent weakening, just avoids the throw).
465
- const SHELL_GATE_RANK = { off: 0, classify: 1, always: 2 };
455
+ // ([1557]§四 SHELL_GATE_RANK 副本与 shellGateSafe 守卫已随 #153 runtime-governance ——
456
+ // settings 折叠不再触碰 TaskSpec.shellGate,base governance 层施加的值原样透传。)
466
457
  export function applyTaskSettings(base, settings, gate, workflowGate) {
467
- const { toolPolicy, handsReadOnly, enablePlanMode, shellGate } = deriveSettingsPolicy(settings, gate, workflowGate);
468
- const shellGateSafe = shellGate !== undefined && SHELL_GATE_RANK[shellGate] >= SHELL_GATE_RANK[base.shellGate ?? "off"] ? shellGate : undefined;
458
+ const { toolPolicy, handsReadOnly, enablePlanMode } = deriveSettingsPolicy(settings, gate, workflowGate);
469
459
  let next = base;
470
- if (toolPolicy !== undefined || handsReadOnly !== undefined || shellGateSafe !== undefined) {
460
+ if (toolPolicy !== undefined || handsReadOnly !== undefined) {
471
461
  const overrides = {};
472
462
  if (toolPolicy !== undefined)
473
463
  overrides.toolPolicy = toolPolicy;
474
464
  if (handsReadOnly !== undefined)
475
465
  overrides.handsReadOnly = handsReadOnly;
476
- if (shellGateSafe !== undefined)
477
- overrides.shellGate = shellGateSafe; // [1557]§四 opt-in; rank-guarded above
478
466
  next = tightenTaskSpec(next, overrides); // deny-wins compose + THROWS on loosen (fail-loud)
479
467
  }
480
468
  // R4: enablePlanMode (mount present_plan) is ADDITIVE — it widens NOTHING (a read-only plan workflow), so it rides
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sema-agent/server",
3
- "version": "6.8.0",
3
+ "version": "7.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",
@@ -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": "^5.12.0",
58
- "@sema-agent/registry-core": "^0.14.0",
57
+ "@sema-agent/core": "^5.13.0",
58
+ "@sema-agent/registry-core": "^0.16.0",
59
59
  "e2b": "^2.28.0",
60
60
  "libsodium-wrappers": "^0.8.4",
61
61
  "mysql2": "^3.22.4",
@@ -68,7 +68,7 @@
68
68
  "sharp": "^0.35.3"
69
69
  },
70
70
  "devDependencies": {
71
- "@sema-agent/sdk": "^6.5.0",
71
+ "@sema-agent/sdk": "^6.6.0",
72
72
  "@types/libsodium-wrappers": "^0.7.14",
73
73
  "@types/node": "22.10.2",
74
74
  "@types/pg": "^8.20.0",