@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
package/src/schemas/members.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import type { CapabilityKind } from "./capabilities.js";
|
|
4
4
|
import { entryId } from "./internal.js";
|
|
5
|
-
import { type
|
|
5
|
+
import { type GrantedTier, GrantedTierSchema, type MemberTier, MemberTierSchema, withLegacyTier } from "./shared.js";
|
|
6
6
|
import { ToolCeilingSchema } from "./tool-ceiling.js";
|
|
7
7
|
|
|
8
8
|
// WHAT A PERSON MAY RUN BESIDES THEIR OWN WORK, one part of the sandbox at a time. Full access (the maintainer tier) holds
|
|
@@ -20,8 +20,8 @@ export type ManageRight = z.infer<typeof ManageRightSchema>;
|
|
|
20
20
|
export const MANAGE_RIGHTS: readonly ManageRight[] = ManageRightSchema.options;
|
|
21
21
|
|
|
22
22
|
/** Whether this person may run one part of the sandbox: the owner and Full access run every part, anyone else what their row names. */
|
|
23
|
-
export const holdsRight = (caller: { readonly
|
|
24
|
-
caller.
|
|
23
|
+
export const holdsRight = (caller: { readonly tier: MemberTier; readonly manages?: readonly ManageRight[] | undefined }, right: ManageRight): boolean =>
|
|
24
|
+
caller.tier === "owner" || caller.tier === "maintainer" || (caller.manages?.includes(right) ?? false);
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* Why someone who manages people may not make this change to one person's access; undefined when they may. The owner and
|
|
@@ -31,14 +31,14 @@ export const holdsRight = (caller: { readonly role: MemberRole; readonly manages
|
|
|
31
31
|
* its `manages` absent keeps the row's, as a grant reads it.
|
|
32
32
|
*/
|
|
33
33
|
export const peopleChangeRefusal = (
|
|
34
|
-
manager: { readonly email: string; readonly
|
|
34
|
+
manager: { readonly email: string; readonly tier: MemberTier; readonly manages?: readonly ManageRight[] | undefined },
|
|
35
35
|
target: {
|
|
36
36
|
readonly email: string;
|
|
37
|
-
readonly before?: { readonly
|
|
38
|
-
readonly after?: { readonly
|
|
37
|
+
readonly before?: { readonly tier: GrantedTier; readonly manages?: readonly ManageRight[] | undefined } | undefined;
|
|
38
|
+
readonly after?: { readonly tier: GrantedTier; readonly manages?: readonly ManageRight[] | undefined } | undefined;
|
|
39
39
|
},
|
|
40
40
|
): string | undefined => {
|
|
41
|
-
if (manager.
|
|
41
|
+
if (manager.tier === "owner" || manager.tier === "maintainer") {
|
|
42
42
|
return undefined;
|
|
43
43
|
}
|
|
44
44
|
if (!holdsRight(manager, "people")) {
|
|
@@ -47,10 +47,10 @@ export const peopleChangeRefusal = (
|
|
|
47
47
|
if (manager.email.toLowerCase() === target.email.toLowerCase()) {
|
|
48
48
|
return "your own access is changed by the owner or someone with Full access";
|
|
49
49
|
}
|
|
50
|
-
if (target.before?.
|
|
50
|
+
if (target.before?.tier === "maintainer") {
|
|
51
51
|
return "a Full access person's access is changed by the owner or someone with Full access";
|
|
52
52
|
}
|
|
53
|
-
if (target.after?.
|
|
53
|
+
if (target.after?.tier === "maintainer") {
|
|
54
54
|
return "Full access is granted by the owner or someone with Full access";
|
|
55
55
|
}
|
|
56
56
|
const had = new Set(target.before?.manages ?? []);
|
|
@@ -119,7 +119,7 @@ export const aiAccountAllowed = (keys: Iterable<string>, provider: string, accou
|
|
|
119
119
|
// WHAT ONE PERSON MAY DO, as three independent answers rather than one rung of a ladder: whether their conversations
|
|
120
120
|
// run agents (`agents`), where they may look (`areas`, the fence their agents run inside too) and where they may change
|
|
121
121
|
// files by hand (`edit`), and whether they manage the sandbox (the maintainer tier, which implies every other answer).
|
|
122
|
-
// The `
|
|
122
|
+
// The `tier` a row carries is the tier those answers make (`tierOf`), kept because the platform's invite record, the
|
|
123
123
|
// presence list and every route's floor read a tier; a row written before the answers existed reads as its role meant
|
|
124
124
|
// (`memberAccess`).
|
|
125
125
|
// `chat` is the guest's way of working: it talks to the assistants that work in its areas and is shown nothing else of
|
|
@@ -150,7 +150,7 @@ export interface MemberAccess {
|
|
|
150
150
|
|
|
151
151
|
// The fields of a row or a grant that decide a person's access.
|
|
152
152
|
interface AccessFields {
|
|
153
|
-
readonly
|
|
153
|
+
readonly tier: GrantedTier;
|
|
154
154
|
readonly areas?: readonly string[] | undefined;
|
|
155
155
|
readonly agents?: AgentAccess | undefined;
|
|
156
156
|
readonly edit?: EditScope | undefined;
|
|
@@ -160,12 +160,12 @@ interface AccessFields {
|
|
|
160
160
|
|
|
161
161
|
/** A row's access: what it says, and for a row written before `agents` and `edit` existed, what its role meant then. */
|
|
162
162
|
export const memberAccess = (row: AccessFields): MemberAccess => {
|
|
163
|
-
if (row.
|
|
163
|
+
if (row.tier === "maintainer") {
|
|
164
164
|
return { manage: true, agents: "run", see: undefined, edit: "all" };
|
|
165
165
|
}
|
|
166
|
-
const agents = row.agents ?? (row.
|
|
166
|
+
const agents = row.agents ?? (row.tier === "guest" ? "chat" : row.tier === "viewer" ? "off" : "run");
|
|
167
167
|
// A writer from before `edit` changes files where it sees them, which its areas always named.
|
|
168
|
-
const edit = row.edit ?? (row.
|
|
168
|
+
const edit = row.edit ?? (row.tier === "writer" && row.areas !== undefined ? [...row.areas] : "none");
|
|
169
169
|
const base: MemberAccess = { manage: false, agents, see: row.areas, edit: agents === "chat" || agents === "home" ? "none" : edit };
|
|
170
170
|
const access = row.manages !== undefined && row.manages.length > 0 ? { ...base, manages: [...row.manages] } : base;
|
|
171
171
|
return row.lands === true ? { ...access, lands: true } : access;
|
|
@@ -180,7 +180,7 @@ export const landsHere = (access: Pick<MemberAccess, "manage" | "agents" | "land
|
|
|
180
180
|
access.manage || (access.agents === "home" && access.lands === true);
|
|
181
181
|
|
|
182
182
|
/** The tier an access makes: what every route's floor, the platform's record and the presence list read. */
|
|
183
|
-
export const tierOf = (access: MemberAccess):
|
|
183
|
+
export const tierOf = (access: MemberAccess): GrantedTier => {
|
|
184
184
|
if (access.manage) {
|
|
185
185
|
return "maintainer";
|
|
186
186
|
}
|
|
@@ -230,14 +230,18 @@ const editRefusal = (access: MemberAccess): string | undefined => {
|
|
|
230
230
|
/** Why an access cannot be granted on its face, before any area or assistant is looked up; undefined when it can. */
|
|
231
231
|
export const accessRefusal = (access: MemberAccess): string | undefined => (access.manage ? undefined : (workingRefusal(access) ?? editRefusal(access)));
|
|
232
232
|
|
|
233
|
+
// A member's tier rode under `role` on the wire until 2026-11-18, when personas were renamed roles. What a sender
|
|
234
|
+
// from before writes is read as `tier` here, so an editor reads an older daemon's roster, and a daemon an older editor's
|
|
235
|
+
// grant (MemberGrantInputSchema). A row that already says `tier` is read as it is.
|
|
236
|
+
|
|
233
237
|
// One person on the roster as the daemon answers it. `areas` fences what of the workspace they reach, and with it which
|
|
234
238
|
// assistants they may talk to: absent is the whole workspace, empty is nothing.
|
|
235
|
-
export const
|
|
239
|
+
export const MemberRowSchema = z.object({
|
|
236
240
|
email: z.string().describe("Who, lowercased."),
|
|
237
|
-
|
|
241
|
+
tier: GrantedTierSchema.describe("The tier their access makes: maintainer when they manage the sandbox, else what `agents` and `edit` add up to."),
|
|
238
242
|
areas: z.array(z.string()).optional().describe("The areas they may see, and their agents work in. Absent means the whole workspace."),
|
|
239
243
|
agents: AgentAccessSchema.optional().describe(
|
|
240
|
-
"Whether their conversations run agents: off (they watch), chat (only with the assistants in their areas, nothing else of the sandbox), run, or home (only their own home conversation, nothing else of the sandbox). Absent means what their
|
|
244
|
+
"Whether their conversations run agents: off (they watch), chat (only with the assistants in their areas, nothing else of the sandbox), run, or home (only their own home conversation, nothing else of the sandbox). Absent means what their tier meant.",
|
|
241
245
|
),
|
|
242
246
|
edit: EditScopeSchema.optional().describe(
|
|
243
247
|
"Where they may change files by hand: everything they see, or these areas. Absent means nowhere, or for a writer its areas.",
|
|
@@ -261,14 +265,14 @@ export const MemberSchema = z.object({
|
|
|
261
265
|
"The AI accounts their conversations may run on, each `provider:account`, or a provider's id alone for every account of it (how an API-key endpoint is named). Absent means every one, including any connected later.",
|
|
262
266
|
),
|
|
263
267
|
tools: ToolCeilingSchema.optional().describe(
|
|
264
|
-
"The most their conversations' tools may be, shelf by shelf; a
|
|
268
|
+
"The most their conversations' tools may be, shelf by shelf; a role only narrows inside it. Absent means no limit.",
|
|
265
269
|
),
|
|
266
270
|
assistants: z
|
|
267
271
|
.array(entryId)
|
|
268
272
|
.max(50)
|
|
269
273
|
.optional()
|
|
270
274
|
.describe(
|
|
271
|
-
"For a guest who chats: which of the assistants working in their areas they may talk to, by
|
|
275
|
+
"For a guest who chats: which of the assistants working in their areas they may talk to, by role id. Absent means every one that works there.",
|
|
272
276
|
),
|
|
273
277
|
profile: entryId
|
|
274
278
|
.optional()
|
|
@@ -282,7 +286,8 @@ export const MemberSchema = z.object({
|
|
|
282
286
|
"The parts of the sandbox they run besides their own work: people and access, secrets, the privacy shield, AI accounts of their own. Never on a maintainer, who runs every part. Absent means none.",
|
|
283
287
|
),
|
|
284
288
|
});
|
|
285
|
-
export
|
|
289
|
+
export const MemberSchema = withLegacyTier(MemberRowSchema);
|
|
290
|
+
export type Member = z.infer<typeof MemberRowSchema>;
|
|
286
291
|
|
|
287
292
|
// What every roster write answers: the roster after it.
|
|
288
293
|
export const MembersListSchema = z.object({ members: z.array(MemberSchema) });
|
|
@@ -293,21 +298,21 @@ export type MembersList = z.infer<typeof MembersListSchema>;
|
|
|
293
298
|
export const MembersRosterSchema = MembersListSchema.extend({ owner: z.string().optional() });
|
|
294
299
|
export type MembersRoster = z.infer<typeof MembersRosterSchema>;
|
|
295
300
|
|
|
296
|
-
// POST /members: the
|
|
301
|
+
// POST /members: the tier is required, the one the grant makes. Areas are optional, their absence being the whole
|
|
297
302
|
// workspace; chatting with assistants needs them, since the assistants working there are the whole of that access.
|
|
298
303
|
// `emailSignIn` lets the platform's identity assertion open this sandbox for them (policy/identity-assertion.ts): true
|
|
299
304
|
// allows it, false takes it back, absent keeps what the row already says, so a re-grade from an editor that predates
|
|
300
305
|
// the field never drops it. `credentials` the same way: `all` lifts a reach, a list sets one, absent keeps the row's,
|
|
301
306
|
// so a re-grade that never mentions it can never widen what a person's conversations may spend. A maintainer may hold
|
|
302
307
|
// a list too: managing the sandbox and spending all of it are separate answers (docs/architecture/access.md).
|
|
303
|
-
// `agents` and `edit` decide the rest of the access; absent, the
|
|
308
|
+
// `agents` and `edit` decide the rest of the access; absent, the tier's own meaning stands, so an editor that predates
|
|
304
309
|
// them still grants what it always did. `lands` is written as sent: absent is no, so a re-grade that never mentions it
|
|
305
|
-
// can never hand a home-only person's agent the authority to land. The
|
|
310
|
+
// can never hand a home-only person's agent the authority to land. The tier sent must be the one the access makes (`tierOf`): two answers to one
|
|
306
311
|
// question are refused rather than one of them guessed away. `aiAccounts` reads as `credentials` does: `all` lifts it, a
|
|
307
312
|
// list sets it, absent keeps the row's, a maintainer's included. `tools` and `assistants` read the same way, except that
|
|
308
313
|
// a maintainer is refused a tool ceiling, since the tier runs every tool.
|
|
309
314
|
// `profile` names an access profile instead of answering on the row: the daemon writes that profile's answers out on
|
|
310
|
-
// the row and ignores the access fields sent beside it, and the
|
|
315
|
+
// the row and ignores the access fields sent beside it, and the tier sent must still be the one the profile makes.
|
|
311
316
|
// Absent is answers of the row's own, so a re-grade from an editor that predates profiles unlinks the row, keeping
|
|
312
317
|
// the answers it carried, rather than leaving a link the grant did not mean. A maintainer is refused one.
|
|
313
318
|
// `manages` reads as `credentials` does: a list sets the rights, `[]` takes them all back, absent keeps the row's, so a
|
|
@@ -316,7 +321,7 @@ export type MembersRoster = z.infer<typeof MembersRosterSchema>;
|
|
|
316
321
|
// sandbox is handed to a person, never through something shared.
|
|
317
322
|
export const MemberGrantSchema = z.object({
|
|
318
323
|
email: z.string(),
|
|
319
|
-
|
|
324
|
+
tier: GrantedTierSchema,
|
|
320
325
|
areas: z.array(z.string().min(1)).max(20).optional(),
|
|
321
326
|
agents: AgentAccessSchema.optional(),
|
|
322
327
|
edit: EditScopeSchema.optional(),
|
|
@@ -330,11 +335,13 @@ export const MemberGrantSchema = z.object({
|
|
|
330
335
|
manages: z.array(ManageRightSchema).max(10).optional(),
|
|
331
336
|
});
|
|
332
337
|
export type MemberGrant = z.infer<typeof MemberGrantSchema>;
|
|
338
|
+
// The grant as the daemon reads it off the wire: an editor from before 2026-11-18 sends the tier as `role`.
|
|
339
|
+
export const MemberGrantInputSchema = withLegacyTier(MemberGrantSchema);
|
|
333
340
|
|
|
334
341
|
// GET /members/self: what the signed-in person may do here, for an editor that offers only what will be taken. The
|
|
335
342
|
// owner reads as managing everything.
|
|
336
|
-
export const
|
|
337
|
-
|
|
343
|
+
export const MemberSelfRowSchema = z.object({
|
|
344
|
+
tier: MemberTierSchema.describe("Their tier on this sandbox."),
|
|
338
345
|
agents: AgentAccessSchema.describe("Whether their conversations run agents."),
|
|
339
346
|
areas: z.array(z.string()).optional().describe("The areas they may see. Absent means the whole workspace."),
|
|
340
347
|
edit: z.union([z.literal("none"), EditScopeSchema]).describe("Where they may change files by hand."),
|
|
@@ -359,7 +366,8 @@ export const MemberSelfSchema = z.object({
|
|
|
359
366
|
.optional()
|
|
360
367
|
.describe("When they asked the owner for more access, while that request is still open (POST /members/requests). Absent when they have not, or it was answered."),
|
|
361
368
|
});
|
|
362
|
-
export
|
|
369
|
+
export const MemberSelfSchema = withLegacyTier(MemberSelfRowSchema);
|
|
370
|
+
export type MemberSelf = z.infer<typeof MemberSelfRowSchema>;
|
|
363
371
|
|
|
364
372
|
// ASKING FOR MORE ACCESS, from where the person was refused: the editor draws an "Ask for access" press on a place or an
|
|
365
373
|
// action their access refuses, and whoever runs people and access sees each open request beside the roster (Access ▸
|
package/src/schemas/needs.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { KeyringShareModeSchema } from "./keyring.js";
|
|
3
3
|
import { AutomationSchema } from "./automations.js";
|
|
4
|
+
import { entryId } from "./internal.js";
|
|
4
5
|
|
|
5
6
|
// A need: something an agent cannot finish its task without that only a person can provide (a connection, a secret's
|
|
6
7
|
// value, wider reach, a tool in the image). Unlike a parked card it outlives the turn that raised it: the sandbox keeps
|
|
@@ -92,7 +93,7 @@ export type SecretNeed = z.infer<typeof SecretNeedSchema>;
|
|
|
92
93
|
export const GrantSubjectSchema = z
|
|
93
94
|
.enum(["capability", "folder", "shelf", "site"])
|
|
94
95
|
.describe(
|
|
95
|
-
"A connected capability the
|
|
96
|
+
"A connected capability the conversation's role or access leaves out, a folder outside its reach, a whole shelf of tools, or a site in the person's own browser, which only their browser extension can allow.",
|
|
96
97
|
);
|
|
97
98
|
export type GrantSubject = z.infer<typeof GrantSubjectSchema>;
|
|
98
99
|
|
|
@@ -109,18 +110,36 @@ export const GRANT_SHELVES = ["files", "shell", "code", "web", "browser", "deleg
|
|
|
109
110
|
export const GrantShelfSchema = z.enum(GRANT_SHELVES);
|
|
110
111
|
export type GrantShelf = z.infer<typeof GrantShelfSchema>;
|
|
111
112
|
|
|
113
|
+
// How far a yes went on a grant answered before 2026-11-18, when a card could lift what a role (then called a persona)
|
|
114
|
+
// withheld. Kept so those needs still read, under the words they were stored with; nothing answers with it any more.
|
|
112
115
|
export const GrantScopeSchema = z
|
|
113
116
|
.enum(["conversation", "persona"])
|
|
114
|
-
.describe("How far a yes
|
|
117
|
+
.describe("How far a yes went, on a need answered before a role's limits became access: this conversation only, or the role itself (stored as `persona`).");
|
|
115
118
|
export type GrantScope = z.infer<typeof GrantScopeSchema>;
|
|
116
119
|
|
|
120
|
+
// A role a grant need offers to switch the conversation to: one whose access allows what was asked for.
|
|
121
|
+
export const GrantRoleSchema = z.object({
|
|
122
|
+
id: entryId.describe("The role's id, or a built-in's."),
|
|
123
|
+
label: z.string().describe("Its name on screen."),
|
|
124
|
+
});
|
|
125
|
+
export type GrantRole = z.infer<typeof GrantRoleSchema>;
|
|
126
|
+
|
|
127
|
+
// What a role withholds is access (docs/architecture/access.md), and no card lifts access. What a card offers instead
|
|
128
|
+
// is to switch the conversation to a role that has it: `roles` lists them, and the answer names one.
|
|
117
129
|
export const GrantNeedSchema = z.object({
|
|
118
130
|
kind: z.literal("grant"),
|
|
119
131
|
subject: GrantSubjectSchema,
|
|
120
132
|
what: z.string().min(1).describe("The capability's id, the folder, or the shelf."),
|
|
121
133
|
label: z.string().describe("What it is, in the daemon's words: the account and its kind, the folder, the shelf's name."),
|
|
122
|
-
|
|
123
|
-
|
|
134
|
+
// Stored as `persona` until 2026-11-18 (needs-store.ts converts it).
|
|
135
|
+
role: z.string().optional().describe("The role that withholds it, when one does."),
|
|
136
|
+
// Added 2026-11-18, optional: a need raised before offered a grant instead.
|
|
137
|
+
roles: z
|
|
138
|
+
.array(GrantRoleSchema)
|
|
139
|
+
.max(50)
|
|
140
|
+
.optional()
|
|
141
|
+
.describe("The roles whose access allows it, any of which the conversation may be switched to. Empty or absent for a site."),
|
|
142
|
+
scope: GrantScopeSchema.optional().describe("How far the yes went, on a need answered before roles were switched instead."),
|
|
124
143
|
});
|
|
125
144
|
export type GrantNeed = z.infer<typeof GrantNeedSchema>;
|
|
126
145
|
|
|
@@ -141,7 +160,7 @@ export type EnvironmentNeed = z.infer<typeof EnvironmentNeedSchema>;
|
|
|
141
160
|
|
|
142
161
|
// What its check sees today, run once as the automation was proposed, so the person deciding reads the watch working
|
|
143
162
|
// rather than a promise that it would. Absent for a guard command, which the agent ran itself before asking: run here
|
|
144
|
-
// it would carry the proposed
|
|
163
|
+
// it would carry the proposed role's credentials before anyone approved them.
|
|
145
164
|
export const AutomationFirstCheckSchema = z.object({
|
|
146
165
|
pass: z.boolean().describe("Whether the check passes today, which for a watch waiting on one thing means it would fire at once."),
|
|
147
166
|
saw: z.string().describe("What it saw, or what it is still waiting for."),
|
|
@@ -195,7 +214,7 @@ export const NeedSchema = z.object({
|
|
|
195
214
|
export type Need = z.infer<typeof NeedSchema>;
|
|
196
215
|
|
|
197
216
|
// What an agent may send: the kind and what it can know about it. Names, titles and every other field the card shows are
|
|
198
|
-
// the daemon's to fill in, from the catalog, the
|
|
217
|
+
// the daemon's to fill in, from the catalog, the role, the gate policy.
|
|
199
218
|
export const NeedAskSchema = z.discriminatedUnion("kind", [
|
|
200
219
|
z.object({
|
|
201
220
|
kind: z.literal("capability"),
|
|
@@ -259,7 +278,8 @@ export const NeedAnswerSchema = z.discriminatedUnion("kind", [
|
|
|
259
278
|
z.object({ kind: z.literal("accept") }),
|
|
260
279
|
// A change to a connected capability's settings, or its removal, applied as the card showed it.
|
|
261
280
|
z.object({ kind: z.literal("apply") }),
|
|
262
|
-
|
|
281
|
+
// 2026-11-18: was `{ scope }`, a yes that lifted what the role withheld; now the role the conversation switches to.
|
|
282
|
+
z.object({ kind: z.literal("grant"), role: entryId.describe("Which of the need's roles the conversation switches to.") }),
|
|
263
283
|
z.object({ kind: z.literal("release") }),
|
|
264
284
|
z.object({ kind: z.literal("approve") }),
|
|
265
285
|
]);
|
|
@@ -335,12 +355,10 @@ export const BrokerRulePassSchema = z.object({
|
|
|
335
355
|
});
|
|
336
356
|
export type BrokerRulePass = z.infer<typeof BrokerRulePassSchema>;
|
|
337
357
|
|
|
338
|
-
// What a person allowed one conversation
|
|
339
|
-
//
|
|
358
|
+
// What a person allowed one conversation (roles/conversation-grants.ts), revocable on the Grants page. Each is a
|
|
359
|
+
// release inside its access, never a widening of it: until 2026-11-18 it also held capabilities, folders and shelves a
|
|
360
|
+
// card lifted past the conversation's role, retired when a role's limits became access.
|
|
340
361
|
export const ConversationGrantSchema = z.object({
|
|
341
|
-
capabilities: z.array(z.string()).default([]).describe("Connected capabilities it may use although its persona leaves them out."),
|
|
342
|
-
folders: z.array(z.string()).default([]).describe("Workspace folders its file tools may touch beyond its fence."),
|
|
343
|
-
shelves: z.array(GrantShelfSchema).default([]).describe("Shelves of tools opened for it."),
|
|
344
362
|
// Answered on an install card's "Allow installs for this conversation", read live by the command gate, so it holds
|
|
345
363
|
// from the install that asked onward, this turn included, and across restarts.
|
|
346
364
|
installs: z
|
|
@@ -400,15 +418,12 @@ export const OwnerGrantSchema = z.discriminatedUnion("kind", [
|
|
|
400
418
|
]);
|
|
401
419
|
export type OwnerGrant = z.infer<typeof OwnerGrantSchema>;
|
|
402
420
|
|
|
403
|
-
// Every yes still standing, by conversation
|
|
404
|
-
//
|
|
421
|
+
// Every yes still standing, by conversation, and which gated credentials a named person released to it. Reviewed and
|
|
422
|
+
// taken back from Needs you.
|
|
405
423
|
export const StandingGrantsSchema = z.object({
|
|
406
424
|
conversations: z.array(
|
|
407
425
|
z.object({
|
|
408
426
|
conversationId: z.string(),
|
|
409
|
-
capabilities: z.array(z.string()).describe("Connected capabilities allowed although its persona leaves them out."),
|
|
410
|
-
folders: z.array(z.string()).describe("Workspace folders its file tools may touch beyond its fence."),
|
|
411
|
-
shelves: z.array(GrantShelfSchema).describe("Shelves of tools opened for it."),
|
|
412
427
|
installs: z.boolean().default(false).describe("Whether its own dependency installs run without asking."),
|
|
413
428
|
secrets: z.array(z.string()).default([]).describe("Secrets it may send past their host guard without asking."),
|
|
414
429
|
everything: z.boolean().default(false).describe("Whether every request an allow-once could settle is allowed without asking."),
|
|
@@ -434,13 +449,11 @@ export type StandingGrants = z.infer<typeof StandingGrantsSchema>;
|
|
|
434
449
|
export const ConversationGrantRevokeSchema = z.object({
|
|
435
450
|
conversationId: z.string(),
|
|
436
451
|
kind: z
|
|
437
|
-
.enum(["
|
|
452
|
+
.enum(["release", "install", "secret", "everything", "rule"])
|
|
438
453
|
.describe(
|
|
439
|
-
"Which kind of yes: a
|
|
454
|
+
"Which kind of yes: a credential's release, letting its installs run unasked, a secret sent past its host guard, allowing everything, or a credential gateway rule that stopped asking.",
|
|
440
455
|
),
|
|
441
|
-
what: z
|
|
442
|
-
.string()
|
|
443
|
-
.describe("The capability id, folder, shelf, released credential or secret it named, or the rule's identity; empty for installs and everything."),
|
|
456
|
+
what: z.string().describe("The released credential or secret it named, or the rule's identity; empty for installs and everything."),
|
|
444
457
|
capability: z.string().optional().describe("For a rule, the capability whose rule it is; a rule's identity alone does not say."),
|
|
445
458
|
});
|
|
446
459
|
export type ConversationGrantRevoke = z.infer<typeof ConversationGrantRevokeSchema>;
|
|
@@ -22,6 +22,8 @@ export const ORG_SECTIONS = [
|
|
|
22
22
|
"extensions",
|
|
23
23
|
"access",
|
|
24
24
|
"areas",
|
|
25
|
+
// The Roles section. Its id predates the name (personas were renamed roles on 2026-11-18) and stays: organisations'
|
|
26
|
+
// stored policies name it, and a daemon from before reads a section it does not know as a broken policy.
|
|
25
27
|
"personas",
|
|
26
28
|
"updates",
|
|
27
29
|
] as const;
|