@intentic/sandbox-contract 1.424.0 → 1.425.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.
- package/dist/contracts/access-profiles.contract.d.ts +7 -3
- package/dist/contracts/access-profiles.contract.d.ts.map +1 -1
- package/dist/contracts/agent.contract.d.ts +51 -10
- package/dist/contracts/agent.contract.d.ts.map +1 -1
- package/dist/contracts/agent.contract.js +1 -1
- package/dist/contracts/agent.contract.js.map +1 -1
- package/dist/contracts/agents.contract.d.ts +13 -5
- package/dist/contracts/agents.contract.d.ts.map +1 -1
- package/dist/contracts/agents.contract.js +1 -1
- package/dist/contracts/agents.contract.js.map +1 -1
- package/dist/contracts/approvals.contract.d.ts +1 -1
- package/dist/contracts/needs.contract.d.ts +41 -26
- package/dist/contracts/needs.contract.d.ts.map +1 -1
- package/dist/contracts/needs.contract.js +2 -2
- package/dist/contracts/needs.contract.js.map +1 -1
- package/dist/contracts/org.contract.d.ts +3 -0
- package/dist/contracts/org.contract.d.ts.map +1 -1
- package/dist/contracts/{personas.contract.d.ts → roles.contract.d.ts} +3 -39
- package/dist/contracts/roles.contract.d.ts.map +1 -0
- package/dist/contracts/roles.contract.js +78 -0
- package/dist/contracts/roles.contract.js.map +1 -0
- package/dist/contracts/runner.contract.d.ts +30 -6
- package/dist/contracts/runner.contract.d.ts.map +1 -1
- package/dist/contracts/sessions.contract.d.ts +5 -1
- package/dist/contracts/sessions.contract.d.ts.map +1 -1
- package/dist/contracts/settings.contract.d.ts +2 -2
- package/dist/contracts/skills.contract.d.ts +3 -3
- package/dist/contracts/skills.contract.js +1 -1
- package/dist/contracts/skills.contract.js.map +1 -1
- package/dist/contracts/system.contract.d.ts +11 -16
- package/dist/contracts/system.contract.d.ts.map +1 -1
- package/dist/events/agent-events.d.ts +20 -4
- package/dist/events/agent-events.d.ts.map +1 -1
- package/dist/events/agent-transcript.d.ts +5 -1
- package/dist/events/agent-transcript.d.ts.map +1 -1
- package/dist/events/system-events.d.ts +7 -7
- package/dist/events/system-events.d.ts.map +1 -1
- package/dist/events/system-events.js +3 -3
- package/dist/events/system-events.js.map +1 -1
- package/dist/events/transcript.d.ts +25 -5
- package/dist/events/transcript.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/models/model-roles.d.ts +1 -1
- package/dist/models/model-roles.d.ts.map +1 -1
- package/dist/models/model-roles.js +1 -1
- package/dist/models/model-roles.js.map +1 -1
- package/dist/policy/org-locks.d.ts +1 -1
- package/dist/policy/org-locks.d.ts.map +1 -1
- package/dist/policy/org-locks.js +1 -1
- package/dist/policy/org-locks.js.map +1 -1
- package/dist/policy/role-capability.d.ts +7 -0
- package/dist/policy/role-capability.d.ts.map +1 -0
- package/dist/policy/role-capability.js +3 -0
- package/dist/policy/role-capability.js.map +1 -0
- package/dist/policy/role-home.d.ts +9 -0
- package/dist/policy/role-home.d.ts.map +1 -0
- package/dist/policy/role-home.js +7 -0
- package/dist/policy/role-home.js.map +1 -0
- package/dist/protocol/member-reach.d.ts +4 -4
- package/dist/protocol/member-reach.js +3 -3
- package/dist/protocol/raw/raw-json-routes.d.ts +29 -23
- package/dist/protocol/raw/raw-json-routes.d.ts.map +1 -1
- package/dist/protocol/route-meta.d.ts +4 -4
- package/dist/schemas/access-profiles.d.ts +10 -4
- package/dist/schemas/access-profiles.d.ts.map +1 -1
- package/dist/schemas/access-profiles.js +9 -4
- package/dist/schemas/access-profiles.js.map +1 -1
- package/dist/schemas/agent.js +3 -3
- package/dist/schemas/agent.js.map +1 -1
- package/dist/schemas/agents.js +2 -2
- package/dist/schemas/agents.js.map +1 -1
- package/dist/schemas/approvals.d.ts +3 -3
- package/dist/schemas/approvals.js +3 -3
- package/dist/schemas/approvals.js.map +1 -1
- package/dist/schemas/automations.js +6 -6
- package/dist/schemas/automations.js.map +1 -1
- package/dist/schemas/chat-route.d.ts +7 -2
- package/dist/schemas/chat-route.d.ts.map +1 -1
- package/dist/schemas/chat-route.js +11 -6
- package/dist/schemas/chat-route.js.map +1 -1
- package/dist/schemas/context-trim.js +1 -1
- package/dist/schemas/context-trim.js.map +1 -1
- package/dist/schemas/diagnostics.d.ts +3 -3
- package/dist/schemas/git/git.js +1 -1
- package/dist/schemas/git/git.js.map +1 -1
- package/dist/schemas/links.d.ts +1 -1
- package/dist/schemas/links.js +4 -4
- package/dist/schemas/links.js.map +1 -1
- package/dist/schemas/loops.js +1 -1
- package/dist/schemas/loops.js.map +1 -1
- package/dist/schemas/members.d.ts +162 -20
- package/dist/schemas/members.d.ts.map +1 -1
- package/dist/schemas/members.js +19 -16
- package/dist/schemas/members.js.map +1 -1
- package/dist/schemas/needs.d.ts +37 -42
- package/dist/schemas/needs.d.ts.map +1 -1
- package/dist/schemas/needs.js +18 -16
- package/dist/schemas/needs.js.map +1 -1
- package/dist/schemas/organisation.d.ts +10 -0
- package/dist/schemas/organisation.d.ts.map +1 -1
- package/dist/schemas/organisation.js.map +1 -1
- package/dist/schemas/{personas.d.ts → roles.d.ts} +37 -72
- package/dist/schemas/roles.d.ts.map +1 -0
- package/dist/schemas/{personas.js → roles.js} +45 -67
- package/dist/schemas/roles.js.map +1 -0
- package/dist/schemas/settings-history.d.ts +1 -1
- package/dist/schemas/settings-history.d.ts.map +1 -1
- package/dist/schemas/settings-history.js +2 -1
- package/dist/schemas/settings-history.js.map +1 -1
- package/dist/schemas/settings.d.ts +11 -11
- package/dist/schemas/settings.d.ts.map +1 -1
- package/dist/schemas/settings.js +3 -3
- package/dist/schemas/settings.js.map +1 -1
- package/dist/schemas/shared.d.ts +6 -5
- package/dist/schemas/shared.d.ts.map +1 -1
- package/dist/schemas/shared.js +14 -5
- package/dist/schemas/shared.js.map +1 -1
- package/dist/schemas/system-prompt.d.ts +12 -12
- package/dist/schemas/system-prompt.d.ts.map +1 -1
- package/dist/schemas/system-prompt.js +1 -1
- package/dist/schemas/system-prompt.js.map +1 -1
- package/dist/schemas/terminal.d.ts +18 -0
- package/dist/schemas/terminal.d.ts.map +1 -1
- package/dist/schemas/terminal.js +16 -1
- package/dist/schemas/terminal.js.map +1 -1
- package/dist/schemas/tool-ceiling.d.ts +4 -2
- package/dist/schemas/tool-ceiling.d.ts.map +1 -1
- package/dist/schemas/tool-ceiling.js +29 -3
- package/dist/schemas/tool-ceiling.js.map +1 -1
- package/dist/schemas/workflows.js +1 -1
- package/dist/schemas/workflows.js.map +1 -1
- package/dist/state/definition.d.ts +4 -4
- package/dist/state/workspace-state.d.ts +4 -4
- package/dist/state/workspace-state.d.ts.map +1 -1
- package/dist/state/workspace-state.js +2 -2
- package/dist/state/workspace-state.js.map +1 -1
- package/package.json +5 -5
- package/src/contracts/agent.contract.ts +2 -2
- package/src/contracts/agents.contract.ts +1 -1
- package/src/contracts/automations.contract.ts +1 -1
- package/src/contracts/logs.contract.ts +1 -1
- package/src/contracts/needs.contract.ts +2 -2
- package/src/contracts/roles.contract.ts +108 -0
- package/src/contracts/skills.contract.ts +2 -2
- package/src/events/system-events.ts +5 -4
- package/src/index.ts +3 -3
- package/src/models/agent-runtimes.ts +8 -8
- package/src/models/model-roles.ts +3 -3
- package/src/policy/control-scopes.ts +1 -1
- package/src/policy/fence-paths.ts +2 -2
- package/src/policy/org-locks.ts +2 -1
- package/src/policy/role-capability.ts +29 -0
- package/src/policy/role-home.ts +29 -0
- package/src/policy/tests/fence-paths.test.ts +1 -1
- package/src/policy/tests/role-home.test.ts +40 -0
- package/src/protocol/member-reach.test.ts +17 -17
- package/src/protocol/member-reach.ts +7 -7
- package/src/protocol/route-meta.ts +6 -6
- package/src/schemas/access-profiles.ts +20 -9
- package/src/schemas/agent.ts +4 -4
- package/src/schemas/agents.ts +2 -2
- package/src/schemas/approvals.ts +3 -3
- package/src/schemas/automations.ts +14 -14
- package/src/schemas/capabilities.ts +1 -1
- package/src/schemas/chat-route.ts +18 -9
- package/src/schemas/context-trim.ts +1 -1
- package/src/schemas/diagnostics.ts +1 -1
- package/src/schemas/git/git.ts +1 -1
- package/src/schemas/internal.ts +1 -1
- package/src/schemas/links.ts +7 -7
- package/src/schemas/loops.ts +1 -1
- package/src/schemas/members.test.ts +31 -31
- package/src/schemas/members.ts +37 -29
- package/src/schemas/needs.ts +35 -22
- package/src/schemas/organisation.ts +2 -0
- package/src/schemas/{personas.ts → roles.ts} +83 -113
- package/src/schemas/settings-history.ts +3 -1
- package/src/schemas/settings.ts +10 -6
- package/src/schemas/shared.ts +24 -10
- package/src/schemas/state-plan.test.ts +3 -3
- package/src/schemas/system-prompt.ts +2 -1
- package/src/schemas/terminal.ts +18 -1
- package/src/schemas/tool-ceiling.test.ts +14 -8
- package/src/schemas/tool-ceiling.ts +42 -11
- package/src/schemas/workflows.ts +1 -1
- package/src/state/auth-state.ts +1 -1
- package/src/state/definition.ts +1 -1
- package/src/state/workspace-state.test.ts +5 -5
- package/src/state/workspace-state.ts +11 -11
- package/dist/contracts/personas.contract.d.ts.map +0 -1
- package/dist/contracts/personas.contract.js +0 -78
- package/dist/contracts/personas.contract.js.map +0 -1
- package/dist/policy/persona-capability.d.ts +0 -14
- package/dist/policy/persona-capability.d.ts.map +0 -1
- package/dist/policy/persona-capability.js +0 -24
- package/dist/policy/persona-capability.js.map +0 -1
- package/dist/policy/persona-home.d.ts +0 -10
- package/dist/policy/persona-home.d.ts.map +0 -1
- package/dist/policy/persona-home.js +0 -11
- package/dist/policy/persona-home.js.map +0 -1
- package/dist/schemas/personas.d.ts.map +0 -1
- package/dist/schemas/personas.js.map +0 -1
- package/src/contracts/personas.contract.ts +0 -106
- package/src/policy/persona-capability.ts +0 -64
- package/src/policy/persona-home.ts +0 -39
- package/src/policy/tests/persona-home.test.ts +0 -51
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
// The named faces a sandbox shows the outside world: which accounts each speaks for,
|
|
2
|
-
//
|
|
1
|
+
// The named faces a sandbox shows the outside world: which accounts each speaks for, where it works, what it is told and
|
|
2
|
+
// what it runs on. What a conversation wearing one may reach is access, not the card (docs/architecture/access.md).
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { type ModelSource, readyChain } from "../models/model-pins.js";
|
|
5
5
|
import { type ModelPin, ModelPinSchema } from "./agent.js";
|
|
6
6
|
import { entryId } from "./internal.js";
|
|
7
7
|
import { SkillDraftSchema, SkillNameSchema, SYSTEM_PROMPT_MAX, SystemPromptModeSchema } from "./settings.js";
|
|
8
|
-
|
|
9
|
-
//
|
|
10
|
-
// (
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
// Narrowing is enforced by absence (
|
|
14
|
-
//
|
|
15
|
-
|
|
16
|
-
export const PersonaPowersSchema = z.object({
|
|
8
|
+
import { ceilingWords, ExtensionIdSchema, intersectCeilings, type ToolCeiling } from "./tool-ceiling.js";
|
|
9
|
+
// THE SHELVES A TURN HOLDS, fully resolved: no card carries them any more. A card's limits are an access profile that
|
|
10
|
+
// lists it (schemas/access-profiles.ts `roles`), held like every other limit in the principal chain, so a turn's shelves
|
|
11
|
+
// are the full toolbox under the ceiling of everything it acts for, its role's profile included (roles.ts
|
|
12
|
+
// `turnRole`, `capRole` in the daemon). Kept as one shape because every runtime reads a turn's shelves from it.
|
|
13
|
+
// Narrowing is enforced by absence (no credential injected) or by removing tools from context; `shell` decides, since
|
|
14
|
+
// with it a session can reach anything else fenced off, turning the rest into defaults, not limits.
|
|
15
|
+
export const RolePowersSchema = z.object({
|
|
17
16
|
// "read" is look-and-search only; "write" adds creating and changing; "none" removes both.
|
|
18
17
|
files: z
|
|
19
18
|
.enum(["none", "read", "write"])
|
|
@@ -39,55 +38,40 @@ export const PersonaPowersSchema = z.object({
|
|
|
39
38
|
// Sandbox settings, manifests, and the public outbox; enforced as a path refusal, not a tool switch — there's no
|
|
40
39
|
// such tool to remove.
|
|
41
40
|
sandbox: z.boolean().default(true),
|
|
42
|
-
// By id
|
|
43
|
-
//
|
|
44
|
-
|
|
45
|
-
devices: z.array(entryId).max(50).optional(),
|
|
46
|
-
mcp: z.array(entryId).max(50).optional(),
|
|
47
|
-
// By extension id (`publisher.name`, or a git install's card id), the same tri-state. A card an extension serves
|
|
48
|
-
// rides `connectors`; this is what the extension brings of its own.
|
|
41
|
+
// By extension id (`publisher.name`, or a git install's card id): absent means every enabled one, empty means none.
|
|
42
|
+
// Resolved from the access the turn runs under (tool-ceiling.ts `extensions`). Which connectors, devices and servers
|
|
43
|
+
// it gets is decided by its credential reach, never by these shelves (secrets/credential-reach.ts in the daemon).
|
|
49
44
|
extensions: z
|
|
50
|
-
.array(
|
|
51
|
-
z
|
|
52
|
-
.string()
|
|
53
|
-
.min(1)
|
|
54
|
-
.max(121)
|
|
55
|
-
.regex(/^[a-zA-Z0-9][a-zA-Z0-9_.-]*$/),
|
|
56
|
-
)
|
|
45
|
+
.array(ExtensionIdSchema)
|
|
57
46
|
.max(100)
|
|
58
47
|
.optional()
|
|
59
48
|
.describe(
|
|
60
|
-
"Which extensions' own agent tools and agent plugin (skills, commands, subagents) it gets, by extension id. Absent means every enabled one; empty means none. The tools an extension serves for a connected card follow
|
|
49
|
+
"Which extensions' own agent tools and agent plugin (skills, commands, subagents) it gets, by extension id. Absent means every enabled one; empty means none. The tools an extension serves for a connected card follow that card's credential instead.",
|
|
61
50
|
),
|
|
62
51
|
});
|
|
63
|
-
export type
|
|
64
|
-
//
|
|
65
|
-
//
|
|
66
|
-
// this persona's folders AND that person's areas, never the wider of the two.
|
|
67
|
-
// A plain folder list rather than a named area (schemas/areas.ts), because the two answer different questions: a
|
|
68
|
-
// persona's fence is written once for that persona, while an area is a grant several people hold and one edit has to
|
|
69
|
-
// move all of them.
|
|
52
|
+
export type RolePowers = z.infer<typeof RolePowersSchema>;
|
|
53
|
+
// Where a conversation wearing the card opens. Which folders it may touch is access: the areas of a profile that lists the
|
|
54
|
+
// card (2026-11-18: `folders` left the card for that, carried into a profile by roles/role-access-step.ts).
|
|
70
55
|
// No placement field, by decision: every session already opens in its own private copy, never the shared tree.
|
|
71
|
-
export const
|
|
56
|
+
export const RoleWorkspaceSchema = z.object({
|
|
72
57
|
// Absent means the workspace root.
|
|
73
58
|
startIn: z.string().max(200).optional().describe("Which folder a conversation opens in."),
|
|
74
|
-
folders: z.array(z.string().min(1)).max(50).optional().describe("Which folders it may touch at all. Absent means the whole workspace."),
|
|
75
59
|
});
|
|
76
|
-
export type
|
|
77
|
-
// Which nested repos a checkout holds, distinct from
|
|
60
|
+
export type RoleWorkspace = z.infer<typeof RoleWorkspaceSchema>;
|
|
61
|
+
// Which nested repos a checkout holds, distinct from the areas its access fences file tools to. The
|
|
78
62
|
// root repo is always carried, never listed; absent means every repository. An object, not a list, for future sibling
|
|
79
63
|
// fields.
|
|
80
|
-
export const
|
|
64
|
+
export const RoleContextSchema = z.object({
|
|
81
65
|
repos: z
|
|
82
66
|
.array(z.string().min(1).max(200))
|
|
83
67
|
.max(50)
|
|
84
68
|
.describe(
|
|
85
|
-
"Which nested repositories a conversation on this
|
|
69
|
+
"Which nested repositories a conversation on this role carries, by workspace-relative path. The workspace itself is always carried; empty means the workspace alone.",
|
|
86
70
|
),
|
|
87
71
|
});
|
|
88
|
-
export type
|
|
72
|
+
export type RoleContext = z.infer<typeof RoleContextSchema>;
|
|
89
73
|
// What the sandbox puts in front of a user's message before the model reads it — the rows the chat shows under "Sent
|
|
90
|
-
// with your message" — and which of them a
|
|
74
|
+
// with your message" — and which of them a role card may drop. The vocabulary lives beside the card because the card
|
|
91
75
|
// editor has to name the same rows the transcript does, and two lists would drift into two vocabularies for one thing.
|
|
92
76
|
// Ids, not titles, are what a card stores: a title is display text and gets reworded, and a reworded title must not
|
|
93
77
|
// silently switch a note back on. The daemon maps each id to the titles it covers (agent/prompt/turn-briefing.ts).
|
|
@@ -190,23 +174,23 @@ export const TURN_BRIEFING_FIXTURES: readonly TurnBriefingFixture[] = [
|
|
|
190
174
|
// What the sandbox tells a turn before the user's own words (the notes above). A deny list, not a pick list:
|
|
191
175
|
// an id absent from `omit` is sent, so a note added later rides every card that never said otherwise. An object, like
|
|
192
176
|
// `context`, for future sibling fields.
|
|
193
|
-
export const
|
|
177
|
+
export const RoleBriefingSchema = z.object({
|
|
194
178
|
omit: z
|
|
195
179
|
.array(TurnBriefingNoteIdSchema)
|
|
196
180
|
.max(20)
|
|
197
181
|
.describe(
|
|
198
|
-
"Which of the notes the sandbox prepends to each message a conversation on this
|
|
182
|
+
"Which of the notes the sandbox prepends to each message a conversation on this role does NOT get. Everything not named here is sent as usual; the notes that keep a turn inside its own branch or explain a missing account cannot be named at all.",
|
|
199
183
|
),
|
|
200
184
|
});
|
|
201
|
-
export type
|
|
202
|
-
export const
|
|
203
|
-
id: entryId.describe("The
|
|
185
|
+
export type RoleBriefing = z.infer<typeof RoleBriefingSchema>;
|
|
186
|
+
export const RoleSchema = z.object({
|
|
187
|
+
id: entryId.describe("The role's id."),
|
|
204
188
|
label: z.string().max(60).optional().describe("What to call it on screen. Absent falls back to the id, which somebody chose anyway."),
|
|
205
189
|
capabilities: z
|
|
206
190
|
.array(entryId)
|
|
207
191
|
.max(50)
|
|
208
192
|
.describe(
|
|
209
|
-
"Which
|
|
193
|
+
"Which signed-in accounts it speaks through: who it is to the outside world, the one thing a card decides about reach. Named individually rather than by site, because two accounts on one site is the whole problem this solves. An account here is still reached only when whoever the turn acts for may use it. Naming one that is not connected yet is not an error: it is a card describing an account this sandbox has still to sign into.",
|
|
210
194
|
),
|
|
211
195
|
// Owner-written, not derived: a classifier routes better on prose than on a list of account ids. Absent, the router
|
|
212
196
|
// has less to go on but still tries.
|
|
@@ -215,17 +199,14 @@ export const PersonaSchema = z.object({
|
|
|
215
199
|
.max(200)
|
|
216
200
|
.optional()
|
|
217
201
|
.describe(
|
|
218
|
-
"What this
|
|
202
|
+
"What this role is for, in one line. A new chat is routed onto a role by this sentence, and the Roles page shows it under the name.",
|
|
219
203
|
),
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
),
|
|
223
|
-
workspace: PersonaWorkspaceSchema.optional().describe("Where it works. Absent means the whole workspace."),
|
|
224
|
-
context: PersonaContextSchema.optional().describe(
|
|
204
|
+
workspace: RoleWorkspaceSchema.optional().describe("Where a conversation wearing it opens. Absent means the workspace root."),
|
|
205
|
+
context: RoleContextSchema.optional().describe(
|
|
225
206
|
"Which part of the workspace a conversation wearing it carries: the repositories its checkout holds. Absent means every repository.",
|
|
226
207
|
),
|
|
227
208
|
// Sits beside `context` on purpose: one says what the tree holds, the other what the turn is handed about it.
|
|
228
|
-
briefing:
|
|
209
|
+
briefing: RoleBriefingSchema.optional().describe(
|
|
229
210
|
"Which of the notes the sandbox prepends to every message this card's conversations do without. Absent means all of them, which is what a card written before this existed keeps.",
|
|
230
211
|
),
|
|
231
212
|
// Ladder shape (a single pin is a single point of failure); picking the card moves the composer's model pill to its
|
|
@@ -242,88 +223,77 @@ export const PersonaSchema = z.object({
|
|
|
242
223
|
// prompt.
|
|
243
224
|
systemPromptMode: SystemPromptModeSchema.optional(),
|
|
244
225
|
});
|
|
245
|
-
export type
|
|
226
|
+
export type Role = z.infer<typeof RoleSchema>;
|
|
246
227
|
// Ladder filtered to connected providers, deduplicated. Empty (absent, or every provider disconnected) means the card
|
|
247
228
|
// has no opinion — the caller decides, not "run nothing".
|
|
248
|
-
export const
|
|
229
|
+
export const roleModels = (card: Pick<Role, "models">, sources: readonly ModelSource[]): readonly ModelPin[] =>
|
|
249
230
|
readyChain(sources, card.models ?? []);
|
|
250
|
-
// Which
|
|
251
|
-
// The one stock
|
|
231
|
+
// Which role a new chat belongs to is asked with what it runs on, in one reading: chat-route.ts.
|
|
232
|
+
// The one stock role id; lives here because the daemon and the automations form are separate packages that must
|
|
252
233
|
// agree on it exactly, or a Visitor chat pins to a card nobody creates.
|
|
253
|
-
export const
|
|
254
|
-
// THE TWO BUILT-IN
|
|
255
|
-
// picked by whether a person is watching (
|
|
256
|
-
// in
|
|
234
|
+
export const VISITOR_CHAT_ROLE = "visitor-chat";
|
|
235
|
+
// THE TWO BUILT-IN ROLES, postures like any card: every turn wears one, and a turn naming no card wears one of these,
|
|
236
|
+
// picked by whether a person is watching (roles.ts `turnRole` in the daemon). They are constants rather than cards
|
|
237
|
+
// in roles.json: that file is tracked in git, and "every account" is not something a card's account list can say,
|
|
257
238
|
// since the list is written once and accounts are connected later. Neither can be edited or removed, and no card may
|
|
258
239
|
// take either id. Both stay inside what the turn's principals may (docs/architecture/access.md): "every account" is
|
|
259
240
|
// every account they may use.
|
|
260
|
-
//
|
|
261
|
-
|
|
262
|
-
//
|
|
241
|
+
// All accounts: every signed-in account, what a chat a person starts without picking anyone acts as. Its id predates
|
|
242
|
+
// the label (it was "Full access" until 2026-11-18, a name the Full access tier of a person's access also carries) and
|
|
243
|
+
// is stored on automations, sender rules and links, so it stays.
|
|
244
|
+
export const FULL_ACCESS_ROLE = "full-access";
|
|
245
|
+
// No accounts: no signed-in account, what a run nobody watches acts as when it names no one, since
|
|
263
246
|
// whatever woke it may have put somebody else's words in its prompt.
|
|
264
|
-
export const
|
|
265
|
-
export type
|
|
266
|
-
export interface
|
|
267
|
-
readonly id:
|
|
247
|
+
export const NO_ACCOUNTS_ROLE = "no-accounts";
|
|
248
|
+
export type BuiltInRoleId = typeof FULL_ACCESS_ROLE | typeof NO_ACCOUNTS_ROLE;
|
|
249
|
+
export interface BuiltInRole {
|
|
250
|
+
readonly id: BuiltInRoleId;
|
|
268
251
|
// English, for the daemon's own words (a turn's standing, its notes); every screen says it through its own catalog.
|
|
269
252
|
readonly label: string;
|
|
270
253
|
// Whether its turns reach the sandbox's signed-in accounts: all of them, or none.
|
|
271
254
|
readonly accounts: "all" | "none";
|
|
272
255
|
}
|
|
273
|
-
const FULL_ACCESS:
|
|
274
|
-
const NO_ACCOUNTS:
|
|
275
|
-
export const
|
|
276
|
-
export const
|
|
277
|
-
export const
|
|
278
|
-
// Who a turn naming no card acts as:
|
|
279
|
-
export const
|
|
280
|
-
// An unwatched run's
|
|
256
|
+
const FULL_ACCESS: BuiltInRole = { id: FULL_ACCESS_ROLE, label: "All accounts", accounts: "all" };
|
|
257
|
+
const NO_ACCOUNTS: BuiltInRole = { id: NO_ACCOUNTS_ROLE, label: "No accounts", accounts: "none" };
|
|
258
|
+
export const BUILT_IN_ROLES: readonly BuiltInRole[] = [FULL_ACCESS, NO_ACCOUNTS];
|
|
259
|
+
export const isBuiltInRole = (id: string | undefined): id is BuiltInRoleId => id === FULL_ACCESS_ROLE || id === NO_ACCOUNTS_ROLE;
|
|
260
|
+
export const builtInRole = (id: BuiltInRoleId): BuiltInRole => (id === FULL_ACCESS_ROLE ? FULL_ACCESS : NO_ACCOUNTS);
|
|
261
|
+
// Who a turn naming no card acts as: All accounts with a person watching, No accounts without.
|
|
262
|
+
export const defaultRole = (unattended: boolean): BuiltInRoleId => (unattended ? NO_ACCOUNTS_ROLE : FULL_ACCESS_ROLE);
|
|
263
|
+
// An unwatched run's role pick with No accounts read as no pick: an unwatched turn naming none wears No accounts
|
|
281
264
|
// anyway, so the two are one choice, and a form shows them as one row.
|
|
282
|
-
export const unwatchedPick = (actsAs: string | undefined): string | undefined => (actsAs ===
|
|
283
|
-
// One phrase describing how bounded a card is,
|
|
284
|
-
//
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
}
|
|
290
|
-
const resolved = PersonaPowersSchema.parse(powers);
|
|
291
|
-
if (resolved.files === "read" && !resolved.shell) {
|
|
265
|
+
export const unwatchedPick = (actsAs: string | undefined): string | undefined => (actsAs === NO_ACCOUNTS_ROLE ? undefined : actsAs);
|
|
266
|
+
// One phrase describing how bounded a card is, from the access profiles that list it (schemas/access-profiles.ts
|
|
267
|
+
// `roles`), shared so the Roles page and the automation picker can't grow different vocabularies for the same card.
|
|
268
|
+
// "Read-only"/"no shell" are named; everything else collapses to a count.
|
|
269
|
+
export const roleBounds = (held: readonly { readonly tools?: ToolCeiling | undefined; readonly areas?: readonly string[] | undefined; readonly credentials?: unknown }[]): string => {
|
|
270
|
+
const ceiling = held.reduce<ToolCeiling | undefined>((at, profile) => intersectCeilings(at, profile.tools), undefined);
|
|
271
|
+
if (ceiling?.files === "read" && ceiling.shell === false) {
|
|
292
272
|
return "Read-only";
|
|
293
273
|
}
|
|
294
|
-
if (
|
|
274
|
+
if (ceiling?.shell === false) {
|
|
295
275
|
return "No shell";
|
|
296
276
|
}
|
|
297
|
-
const limits =
|
|
298
|
-
resolved.files === "none",
|
|
299
|
-
!resolved.code,
|
|
300
|
-
!resolved.web,
|
|
301
|
-
!resolved.browser,
|
|
302
|
-
!resolved.delegate,
|
|
303
|
-
!resolved.sandbox,
|
|
304
|
-
resolved.connectors !== undefined,
|
|
305
|
-
resolved.devices !== undefined,
|
|
306
|
-
resolved.mcp !== undefined,
|
|
307
|
-
].filter(Boolean).length;
|
|
277
|
+
const limits = ceilingWords(ceiling).length + (held.some((profile) => profile.areas !== undefined) ? 1 : 0) + (held.some((profile) => profile.credentials !== undefined) ? 1 : 0);
|
|
308
278
|
return limits === 0 ? "Full powers" : `${limits} limit${limits === 1 ? "" : "s"}`;
|
|
309
279
|
};
|
|
310
|
-
export const
|
|
311
|
-
// `connected` is what makes a freshly cloned workspace honest: every
|
|
280
|
+
export const RoleIdParamSchema = z.object({ id: entryId.describe("Which role.") });
|
|
281
|
+
// `connected` is what makes a freshly cloned workspace honest: every role shows even though most can't act yet. An
|
|
312
282
|
// id with no capability at all is `connected: false` too.
|
|
313
|
-
export const
|
|
314
|
-
|
|
283
|
+
export const RolesListSchema = z.object({
|
|
284
|
+
roles: z.array(RoleSchema).describe("The characters an agent can wear."),
|
|
315
285
|
connected: z
|
|
316
286
|
.array(z.string())
|
|
317
287
|
.describe(
|
|
318
|
-
"Which accounts are actually connected right now, so a
|
|
288
|
+
"Which accounts are actually connected right now, so a role naming one that has since been disconnected can be shown as broken rather than as working.",
|
|
319
289
|
),
|
|
320
290
|
});
|
|
321
291
|
// One route for the kit's prompt and skills, one folder and one screen. Skills come back as name/description only; an
|
|
322
292
|
// empty prompt means no PROMPT.md yet, sent as "" since the field is a textarea.
|
|
323
|
-
export const
|
|
293
|
+
export const RoleKitSchema = z.object({
|
|
324
294
|
prompt: z
|
|
325
295
|
.string()
|
|
326
|
-
.describe("What this
|
|
296
|
+
.describe("What this role is told, on top of everything else. Empty means it simply follows the sandbox's own instructions."),
|
|
327
297
|
skills: z
|
|
328
298
|
.array(
|
|
329
299
|
z.object({
|
|
@@ -332,22 +302,22 @@ export const PersonaKitSchema = z.object({
|
|
|
332
302
|
}),
|
|
333
303
|
)
|
|
334
304
|
.describe(
|
|
335
|
-
"Skills only this
|
|
305
|
+
"Skills only this role's conversations can reach. A different question from what the agent knows generally, with a different answer.",
|
|
336
306
|
),
|
|
337
307
|
});
|
|
338
|
-
export type
|
|
339
|
-
export const
|
|
308
|
+
export type RoleKit = z.infer<typeof RoleKitSchema>;
|
|
309
|
+
export const RolePromptSchema = RoleIdParamSchema.extend({
|
|
340
310
|
prompt: z
|
|
341
311
|
.string()
|
|
342
312
|
.max(SYSTEM_PROMPT_MAX)
|
|
343
313
|
.describe(
|
|
344
|
-
"What to tell this
|
|
314
|
+
"What to tell this role. Sending an empty one removes it entirely rather than storing a blank, so the role falls back to the sandbox's own instructions.",
|
|
345
315
|
),
|
|
346
316
|
});
|
|
347
|
-
export const
|
|
348
|
-
export const
|
|
317
|
+
export const RoleSkillSchema = RoleIdParamSchema.extend(SkillDraftSchema.shape);
|
|
318
|
+
export const RoleSkillNameSchema = RoleIdParamSchema.extend({ name: SkillNameSchema.describe("Which skill.") });
|
|
349
319
|
// Same listing/body split the sandbox's own skills make, for editing.
|
|
350
|
-
export const
|
|
320
|
+
export const RoleSkillBodySchema = z.object({
|
|
351
321
|
name: z.string().describe("The skill's name."),
|
|
352
322
|
description: z.string().describe("What it is for."),
|
|
353
323
|
body: z.string().describe("The skill itself, in full."),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { at, drop, dropAll, fold, isJsonObject, type JsonObject, mapValue, retype, transform } from "../documents/conversions.js";
|
|
2
|
+
import { at, drop, dropAll, fold, isJsonObject, type JsonObject, mapValue, rename, retype, transform } from "../documents/conversions.js";
|
|
3
3
|
import { type ModelRole, ModelRoleSchema } from "../models/model-roles.js";
|
|
4
4
|
import { setupsFromRoleLists } from "../models/model-setups.js";
|
|
5
5
|
import { ModelPinSchema, type ModelPin } from "./agent.js";
|
|
@@ -180,4 +180,6 @@ export const SETTINGS_HISTORY = [
|
|
|
180
180
|
// iq (2026-11-18): teaching agents the workspace search tool moved neither cost, calls nor searches against a held-out
|
|
181
181
|
// half over 1,480 conversations, and the tool itself was removed.
|
|
182
182
|
...dropAll(["iqSearch", "iqSearchHoldout"]),
|
|
183
|
+
// Personas were renamed roles (2026-11-18): the switch that matches a new chat to one moves with them.
|
|
184
|
+
rename("personaRouting", "roleRouting"),
|
|
183
185
|
] as const;
|
package/src/schemas/settings.ts
CHANGED
|
@@ -33,7 +33,7 @@ export const SystemPromptModeSchema = z.enum(["intentic", "claude", "custom"]);
|
|
|
33
33
|
export type SystemPromptMode = z.infer<typeof SystemPromptModeSchema>;
|
|
34
34
|
// Excludes "custom": there is nothing to fetch, it's whatever the owner already typed into the settings field.
|
|
35
35
|
export const BuiltinPromptSchema = z.object({ base: z.enum(["intentic", "claude"]) });
|
|
36
|
-
// Longest an owner's own system prompt may be, the sandbox's or a
|
|
36
|
+
// Longest an owner's own system prompt may be, the sandbox's or a role's; named so an editor can refuse a save the
|
|
37
37
|
// daemon would refuse, rather than copy the number.
|
|
38
38
|
export const SYSTEM_PROMPT_MAX = 20_000;
|
|
39
39
|
// Longest the guidance the New chat routing job reads may be (`autoModelGuidance` below).
|
|
@@ -143,10 +143,14 @@ export type RuleFirings = z.infer<typeof RuleFiringsSchema>;
|
|
|
143
143
|
// capability: something connected brought it (a CLI tool, a machine, a browser account, a VPN).
|
|
144
144
|
// extension: an installed extension ships it inside its checkout.
|
|
145
145
|
// plugin: a plugin capability cloned a repo that holds it.
|
|
146
|
-
//
|
|
146
|
+
// role: one card's own kit carries it; only turns wearing that card see it.
|
|
147
147
|
// dropped: sitting in the loaded folder by hand or by the agent, claimed by nothing else.
|
|
148
148
|
// Not a capability kind: a capability can be broken and wants a status light, a skill either exists or it doesn't.
|
|
149
|
-
|
|
149
|
+
// "role" was "persona" until personas were renamed roles (2026-11-18), which a daemon from before still answers.
|
|
150
|
+
export const SkillOriginSchema = z.preprocess(
|
|
151
|
+
(origin) => (origin === "persona" ? "role" : origin),
|
|
152
|
+
z.enum(["builtin", "own", "capability", "extension", "plugin", "role", "dropped"]),
|
|
153
|
+
);
|
|
150
154
|
export type SkillOrigin = z.infer<typeof SkillOriginSchema>;
|
|
151
155
|
// Same slug shape the SDK's loader accepts, checked here so a bad name is a refused save, not a skill that silently
|
|
152
156
|
// never loads.
|
|
@@ -289,11 +293,11 @@ export const SandboxSettingsSchema = z.object({
|
|
|
289
293
|
// message and one line per card are put to the same model that chooses what the chat runs on, in the same call.
|
|
290
294
|
// Never asked of a draft: only a sent message is a finished one. Attended chats only: routing onto a card would
|
|
291
295
|
// grant an unwatched wake accounts nobody named for it.
|
|
292
|
-
|
|
296
|
+
roleRouting: z
|
|
293
297
|
.boolean()
|
|
294
298
|
.default(true)
|
|
295
299
|
.describe(
|
|
296
|
-
"Whether a new chat is matched to one of your
|
|
300
|
+
"Whether a new chat is matched to one of your roles from its first message. It is read once the message is sent, in the same single call that chooses what the chat runs on (the New chat routing job under Models), and the chat says in its own transcript which role it landed on. Never applies to unwatched runs, which name their role themselves.",
|
|
297
301
|
),
|
|
298
302
|
// The `show_page`/`ask_page` tools and the guidance that names them (agent/pages/page-tools.ts); off, a turn is
|
|
299
303
|
// offered neither and draws no page, which costs it nothing.
|
|
@@ -344,7 +348,7 @@ export const SandboxSettingsSchema = z.object({
|
|
|
344
348
|
"Your own instructions, used only when the mode above says custom. Then it is the whole of them: both built-in bases go, and so does everything this product would otherwise add, including the guidance the chat's own cards are driven by. That is the price of total control.",
|
|
345
349
|
),
|
|
346
350
|
...claudeExperimentSettings,
|
|
347
|
-
// Rooted at the run's own starting folder (a
|
|
351
|
+
// Rooted at the run's own starting folder (a role's, an isolated conversation's worktree), not the workspace
|
|
348
352
|
// root — it maps the project containing that folder. On for new sandboxes from 2026-11-04, kept off for older ones
|
|
349
353
|
// (the daemon's settings-store.ts pins the old default, settings/earlier-defaults-step.ts writes it down where never
|
|
350
354
|
// saved).
|
package/src/schemas/shared.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Named imports rather than the `z` namespace: this module is bundled into the browser extension, where the
|
|
2
2
|
// namespace keeps zod's 60 locales (~250 kB) that esbuild can otherwise drop. _devices/webext/scripts/size-budget.mjs holds the ceiling.
|
|
3
|
-
import { enum as zEnum, literal, object, string } from "zod";
|
|
3
|
+
import { enum as zEnum, literal, looseObject, object, optional, preprocess, string, undefined as zUndefined } from "zod";
|
|
4
4
|
import type * as z from "zod";
|
|
5
5
|
// Success ack for routes that only report completion (push, disconnect, self-host register). A paused turn or missing
|
|
6
6
|
// repo/path throws an ORPCError instead.
|
|
@@ -8,19 +8,33 @@ export const OkSchema = object({
|
|
|
8
8
|
ok: literal(true)
|
|
9
9
|
.describe("Always true. A route that answers this either did the thing or refused with a status; there is no third outcome to report."),
|
|
10
10
|
});
|
|
11
|
-
// Trust tiers, ordered low to high: guest talks to the
|
|
11
|
+
// Trust tiers, ordered low to high: guest talks to the role cards it was handed and sees nothing else, viewer
|
|
12
12
|
// watches, collaborator's outward actions become requests, writer changes files inside the areas it holds and ships
|
|
13
13
|
// none of them, maintainer holds the owner's authority but is revocable, owner is the one bound identity and not a
|
|
14
14
|
// grant.
|
|
15
|
-
export const
|
|
16
|
-
export type
|
|
17
|
-
//
|
|
18
|
-
|
|
19
|
-
export
|
|
20
|
-
|
|
15
|
+
export const MemberTierSchema = zEnum(["guest", "viewer", "collaborator", "writer", "maintainer", "owner"]);
|
|
16
|
+
export type MemberTier = z.infer<typeof MemberTierSchema>;
|
|
17
|
+
// Tiers an invite can grant: everything but owner, which binds at first sign-in and is never granted. Called roles until
|
|
18
|
+
// 2026-11-18, when personas were renamed roles; the wire key a tier rides under moved from `role` to `tier`.
|
|
19
|
+
export const GrantedTierSchema = zEnum(["guest", "viewer", "collaborator", "writer", "maintainer"]);
|
|
20
|
+
export type GrantedTier = z.infer<typeof GrantedTierSchema>;
|
|
21
|
+
// Single source for tier order; every surface that gates on a tier reads this ranking. A guest is below every
|
|
21
22
|
// floor: its routes are an allowlist of its own (protocol/member-reach.ts guestReach), never a floor it can clear.
|
|
22
|
-
const
|
|
23
|
-
export const
|
|
23
|
+
const MEMBER_TIER_RANK: Record<MemberTier, number> = { guest: 0, viewer: 1, collaborator: 2, writer: 3, maintainer: 4, owner: 5 };
|
|
24
|
+
export const tierAtLeast = (tier: MemberTier, floor: MemberTier): boolean => MEMBER_TIER_RANK[tier] >= MEMBER_TIER_RANK[floor];
|
|
25
|
+
// A tier rode under `role` on the wire until 2026-11-18. What a sender from before writes (an older daemon's roster,
|
|
26
|
+
// presence or profile holders; an older editor's grant) is read as `tier`; a value that already says `tier` is read
|
|
27
|
+
// as it is.
|
|
28
|
+
const LegacyTierSchema = looseObject({ role: string(), tier: optional(zUndefined()) });
|
|
29
|
+
export const withLegacyTier = <S extends z.ZodType>(schema: S) =>
|
|
30
|
+
preprocess((raw) => {
|
|
31
|
+
const legacy = LegacyTierSchema.safeParse(raw);
|
|
32
|
+
if (!legacy.success) {
|
|
33
|
+
return raw;
|
|
34
|
+
}
|
|
35
|
+
const { role, tier: _absent, ...rest } = legacy.data;
|
|
36
|
+
return { ...rest, tier: role };
|
|
37
|
+
}, schema);
|
|
24
38
|
// Rotating a door credential (event webhook, release gate, bug intake): the old value stops working immediately; the
|
|
25
39
|
// new one is shown once to be saved.
|
|
26
40
|
export const DoorTokenSchema = object({
|
|
@@ -21,12 +21,12 @@ const clear: StatePlan = {
|
|
|
21
21
|
failures: [],
|
|
22
22
|
steps: [
|
|
23
23
|
{ document: "conversations-db-schema", change: "upgrades the conversations database schema" },
|
|
24
|
-
{ document: `${STATE_DIR}/config/
|
|
24
|
+
{ document: `${STATE_DIR}/config/roles.json`, change: `moves it from ${STATE_DIR}/identities.json` },
|
|
25
25
|
],
|
|
26
26
|
converts: [
|
|
27
|
-
{ document: `${STATE_DIR}/config/settings.json`, change: "converts
|
|
27
|
+
{ document: `${STATE_DIR}/config/settings.json`, change: "converts roleRouting from its old values", detail: '"suggest" became true' },
|
|
28
28
|
],
|
|
29
|
-
files: [`${STATE_DIR}/config/
|
|
29
|
+
files: [`${STATE_DIR}/config/roles.json`],
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
const refused: StatePlan = {
|
|
@@ -3,7 +3,8 @@ import { z } from "zod";
|
|
|
3
3
|
import { SystemPromptModeSchema } from "./settings.js";
|
|
4
4
|
|
|
5
5
|
// Every section names its mechanism: the reader asks "did my AGENTS.md arrive", not "what does paragraph nine say".
|
|
6
|
-
|
|
6
|
+
// "role" was "persona" until personas were renamed roles (2026-11-18), which a daemon from before still answers.
|
|
7
|
+
export const PromptSectionSourceSchema = z.preprocess((source) => (source === "persona" ? "role" : source), z.enum(["guidance", "role", "memory"]));
|
|
7
8
|
export type PromptSectionSource = z.infer<typeof PromptSectionSourceSchema>;
|
|
8
9
|
|
|
9
10
|
export const PromptSectionSchema = z.object({
|
package/src/schemas/terminal.ts
CHANGED
|
@@ -74,9 +74,26 @@ export const BrowserPageSchema = z.object({
|
|
|
74
74
|
),
|
|
75
75
|
// The page's title; absent mid-navigation, when a tab still needs to render.
|
|
76
76
|
title: z.string().optional().describe("The page's title. Absent mid-navigation, which is exactly when a tab still has to be drawn."),
|
|
77
|
-
url: z.string().describe("Where it is."),
|
|
77
|
+
url: z.string().describe("Where it is. On the browser's error page, the address that failed to load."),
|
|
78
78
|
// The page the agent last drove; for a finished session, the one it ended on. Exactly one page has it.
|
|
79
79
|
active: z.boolean().describe("The one the agent last touched, or for a finished session, the one it ended on. Exactly one page has this."),
|
|
80
|
+
// What a browser's own chrome says about a tab between two addresses, which the picture crops away: it turns, it
|
|
81
|
+
// names the host it waits on, and it says why it gave up. All absent from a daemon older than them.
|
|
82
|
+
loading: z
|
|
83
|
+
.boolean()
|
|
84
|
+
.optional()
|
|
85
|
+
.describe("It is on its way somewhere: a navigation in flight, or its page still loading. Absent once it has finished."),
|
|
86
|
+
navigation: z
|
|
87
|
+
.object({
|
|
88
|
+
url: z.string().describe("The address being fetched now; each redirect along the way replaces it."),
|
|
89
|
+
since: z.number().describe("When the navigation set off, in milliseconds."),
|
|
90
|
+
})
|
|
91
|
+
.optional()
|
|
92
|
+
.describe("A navigation that has set off and not arrived yet: where it is waiting, and for how long. Absent once it arrives or fails."),
|
|
93
|
+
error: z
|
|
94
|
+
.string()
|
|
95
|
+
.optional()
|
|
96
|
+
.describe("Why the last navigation failed, in the browser's own words (net::ERR_CONNECTION_TIMED_OUT), while the page shows its error page."),
|
|
80
97
|
});
|
|
81
98
|
export const BrowserSessionSchema = z.object({
|
|
82
99
|
name: z.string().describe("Its id, and what the close route takes."),
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RolePowersSchema } from "./roles.js";
|
|
2
2
|
import { capPowers, ceilingLimits, ceilingWithholds, ceilingWords, intersectCeilings } from "./tool-ceiling.js";
|
|
3
3
|
|
|
4
4
|
// A ceiling is an upper bound per shelf: an answer left out limits nothing, and two held together keep the lower of each.
|
|
5
5
|
|
|
6
|
-
const FULL =
|
|
6
|
+
const FULL = RolePowersSchema.parse({});
|
|
7
7
|
|
|
8
8
|
describe(`intersectCeilings`, () => {
|
|
9
9
|
it(`keeps the lower answer of each shelf`, () => {
|
|
@@ -23,22 +23,28 @@ describe(`intersectCeilings`, () => {
|
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
describe(`capPowers`, () => {
|
|
26
|
-
it(`lowers a
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
...powers,
|
|
26
|
+
it(`lowers a turn's shelves to the ceiling`, () => {
|
|
27
|
+
expect(capPowers(FULL, { files: `read`, shell: false, delegate: false })).toEqual({
|
|
28
|
+
...FULL,
|
|
30
29
|
files: `read`,
|
|
31
30
|
shell: false,
|
|
32
31
|
delegate: false,
|
|
33
32
|
});
|
|
34
33
|
});
|
|
35
34
|
|
|
36
|
-
it(`
|
|
35
|
+
it(`keeps only the extensions both the shelves and the ceiling allow`, () => {
|
|
36
|
+
expect(capPowers(FULL, { extensions: [`acme.crm`] }).extensions).toEqual([`acme.crm`]);
|
|
37
|
+
expect(capPowers({ ...FULL, extensions: [`acme.crm`, `acme.mail`] }, { extensions: [`acme.mail`] }).extensions).toEqual([`acme.mail`]);
|
|
38
|
+
expect(intersectCeilings({ extensions: [`a`, `b`] }, { extensions: [`b`, `c`] })).toEqual({ extensions: [`b`] });
|
|
39
|
+
expect(ceilingLimits({ extensions: [] })).toBe(true);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it(`never raises a shelf already off`, () => {
|
|
37
43
|
const readOnly = { ...FULL, files: `read` as const, shell: false };
|
|
38
44
|
expect(capPowers(readOnly, { files: `write`, shell: true })).toEqual(readOnly);
|
|
39
45
|
});
|
|
40
46
|
|
|
41
|
-
it(`returns the
|
|
47
|
+
it(`returns the shelves as they were when the ceiling limits nothing`, () => {
|
|
42
48
|
expect(capPowers(FULL, undefined)).toBe(FULL);
|
|
43
49
|
expect(capPowers(FULL, { files: `write`, web: true })).toBe(FULL);
|
|
44
50
|
});
|