@arcforge/types 2.0.192 → 2.0.194

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcforge/types",
3
- "version": "2.0.192",
3
+ "version": "2.0.194",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "main": "./src/index.ts",
@@ -318,6 +318,22 @@ export function intersect(
318
318
  }
319
319
 
320
320
 
321
+ /**
322
+ * The raw-shell switch under a ceiling.
323
+ *
324
+ * Returns a `{ raw }` fragment or nothing at all, because the ABSENCE of the
325
+ * key is meaningful downstream: `decideShell` escalates on an undeclared `raw`
326
+ * and refuses only on an explicit `false`. Writing `raw: false` when nobody
327
+ * said so would turn "ask" into "refuse".
328
+ */
329
+ function resolveRaw(profile: boolean | undefined, agent: boolean | undefined): { raw?: boolean } {
330
+ // Either layer's refusal stands — it is a decision somebody wrote.
331
+ if (profile === false || agent === false) return { raw: false }
332
+ if (profile === undefined && agent === undefined) return {}
333
+ // One side silent defers to the other; both present must agree.
334
+ return { raw: (profile ?? agent) === true && (agent ?? profile) === true }
335
+ }
336
+
321
337
  /**
322
338
  * Two allowlists under a ceiling: what BOTH layers admit.
323
339
  *
@@ -392,9 +408,27 @@ function mergeShell(
392
408
  ...(profile?.args || agent?.args
393
409
  ? { args: pairRules(profile?.args, agent?.args) }
394
410
  : {}),
395
- // Both must permit it. Absent means "no opinion", which for the one
396
- // switch that disarms every other rule defaults CLOSED.
397
- raw: (profile?.raw ?? false) && (agent?.raw ?? false),
411
+ /*
412
+ * Silence DEFERS; an explicit `false` refuses; two explicit `true`s agree.
413
+ *
414
+ * This read `(profile?.raw ?? false) && (agent?.raw ?? false)`, which
415
+ * treated an absent value as a written `false` — the one place in this
416
+ * file where silence is a verdict rather than "no opinion" (compare
417
+ * `intersectLists` directly below, and `pairRule`).
418
+ *
419
+ * The consequence was that a profile-level `raw: true` could not be
420
+ * expressed AT ALL. A user granting raw shell on their own machine had
421
+ * it ANDed away by every agent that simply had no `policy` block —
422
+ * which is every scaffolded agent — and the denial then said "raw shell
423
+ * is off" about a switch they had just turned on.
424
+ *
425
+ * Deferring matches how the ceiling treats every other surface: a
426
+ * profile that says nothing imposes no ceiling, and an agent that says
427
+ * nothing accepts the profile's. Both silent leaves `raw` ABSENT rather
428
+ * than false, so `decideShell` asks instead of refusing — the same rule
429
+ * the rest of the policy surface follows.
430
+ */
431
+ ...resolveRaw(profile?.raw, agent?.raw),
398
432
  spawn: {
399
433
  rule: pairRule(asRule(spawnRule(profile)), asRule(spawnRule(agent))),
400
434
  // The tighter cap wins; no cap on either side means unlimited.