@intentic/sandbox-contract 1.363.0 → 1.365.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/README.md +7 -0
- package/dist/contracts/access-profiles.contract.d.ts +91 -0
- package/dist/contracts/access-profiles.contract.d.ts.map +1 -0
- package/dist/contracts/access-profiles.contract.js +33 -0
- package/dist/contracts/access-profiles.contract.js.map +1 -0
- package/dist/contracts/agent.contract.d.ts +18 -0
- package/dist/contracts/agent.contract.d.ts.map +1 -1
- package/dist/contracts/agents.contract.d.ts +260 -0
- package/dist/contracts/agents.contract.d.ts.map +1 -1
- package/dist/contracts/agents.contract.js +18 -0
- package/dist/contracts/agents.contract.js.map +1 -1
- package/dist/contracts/automations.contract.d.ts +5 -0
- package/dist/contracts/automations.contract.d.ts.map +1 -1
- package/dist/contracts/extensions.contract.d.ts +6 -0
- package/dist/contracts/extensions.contract.d.ts.map +1 -1
- package/dist/contracts/needs.contract.d.ts +246 -0
- package/dist/contracts/needs.contract.d.ts.map +1 -1
- package/dist/contracts/needs.contract.js +11 -1
- package/dist/contracts/needs.contract.js.map +1 -1
- package/dist/contracts/org.contract.d.ts +49 -0
- package/dist/contracts/org.contract.d.ts.map +1 -1
- package/dist/contracts/runner.contract.d.ts +38 -0
- package/dist/contracts/runner.contract.d.ts.map +1 -1
- package/dist/contracts/services.contract.d.ts +26 -0
- package/dist/contracts/services.contract.d.ts.map +1 -0
- package/dist/contracts/services.contract.js +33 -0
- package/dist/contracts/services.contract.js.map +1 -0
- package/dist/contracts/sessions.contract.d.ts +2 -0
- package/dist/contracts/sessions.contract.d.ts.map +1 -1
- package/dist/contracts/settings.contract.d.ts +2 -0
- package/dist/contracts/settings.contract.d.ts.map +1 -1
- package/dist/contracts/system.contract.d.ts +36 -0
- package/dist/contracts/system.contract.d.ts.map +1 -1
- package/dist/contracts/workspace.contract.d.ts +232 -0
- package/dist/contracts/workspace.contract.d.ts.map +1 -1
- package/dist/contracts/workspace.contract.js +12 -1
- package/dist/contracts/workspace.contract.js.map +1 -1
- package/dist/events/agent-events.d.ts +22 -0
- package/dist/events/agent-events.d.ts.map +1 -1
- package/dist/events/agent-events.js +5 -1
- package/dist/events/agent-events.js.map +1 -1
- package/dist/events/agent-transcript.d.ts +2 -0
- package/dist/events/agent-transcript.d.ts.map +1 -1
- package/dist/events/sandbox-notice.d.ts +14 -0
- package/dist/events/sandbox-notice.d.ts.map +1 -1
- package/dist/events/sandbox-notice.js +13 -1
- package/dist/events/sandbox-notice.js.map +1 -1
- package/dist/events/system-events.d.ts +26 -0
- package/dist/events/system-events.d.ts.map +1 -1
- package/dist/events/tool-update.d.ts +6 -0
- package/dist/events/tool-update.d.ts.map +1 -0
- package/dist/events/tool-update.js +12 -0
- package/dist/events/tool-update.js.map +1 -0
- package/dist/events/transcript.d.ts +11 -0
- package/dist/events/transcript.d.ts.map +1 -1
- package/dist/events/transcript.js +4 -0
- package/dist/events/transcript.js.map +1 -1
- package/dist/index.d.ts +1014 -43
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/models/device-deadlines.d.ts +34 -0
- package/dist/models/device-deadlines.d.ts.map +1 -0
- package/dist/models/device-deadlines.js +28 -0
- package/dist/models/device-deadlines.js.map +1 -0
- package/dist/models/model-setups.d.ts.map +1 -1
- package/dist/models/model-setups.js.map +1 -1
- package/dist/policy/control-scopes.d.ts +3 -0
- package/dist/policy/control-scopes.d.ts.map +1 -1
- package/dist/policy/control-scopes.js +2 -0
- package/dist/policy/control-scopes.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 +3 -1
- package/dist/policy/org-locks.js.map +1 -1
- package/dist/protocol/member-reach.d.ts +18 -0
- package/dist/protocol/member-reach.d.ts.map +1 -0
- package/dist/protocol/member-reach.js +31 -0
- package/dist/protocol/member-reach.js.map +1 -0
- package/dist/protocol/raw/raw-json-routes.d.ts +423 -1
- package/dist/protocol/raw/raw-json-routes.d.ts.map +1 -1
- package/dist/protocol/raw/raw-json-routes.js +7 -2
- package/dist/protocol/raw/raw-json-routes.js.map +1 -1
- package/dist/protocol/raw/raw-routes.d.ts +18 -0
- package/dist/protocol/raw/raw-routes.d.ts.map +1 -1
- package/dist/protocol/raw/raw-routes.js +8 -3
- package/dist/protocol/raw/raw-routes.js.map +1 -1
- package/dist/schemas/access-profiles.d.ts +153 -0
- package/dist/schemas/access-profiles.d.ts.map +1 -0
- package/dist/schemas/access-profiles.js +56 -0
- package/dist/schemas/access-profiles.js.map +1 -0
- package/dist/schemas/agents-list.d.ts +27 -0
- package/dist/schemas/agents-list.d.ts.map +1 -1
- package/dist/schemas/agents.d.ts +50 -0
- package/dist/schemas/agents.d.ts.map +1 -1
- package/dist/schemas/agents.js +17 -0
- package/dist/schemas/agents.js.map +1 -1
- package/dist/schemas/automations.d.ts +10 -0
- package/dist/schemas/automations.d.ts.map +1 -1
- package/dist/schemas/automations.js +7 -0
- package/dist/schemas/automations.js.map +1 -1
- package/dist/schemas/dev-rebuild-log.d.ts +16 -0
- package/dist/schemas/dev-rebuild-log.d.ts.map +1 -1
- package/dist/schemas/dev-rebuild-log.js +38 -2
- package/dist/schemas/dev-rebuild-log.js.map +1 -1
- package/dist/schemas/device-commands.d.ts +7 -1
- package/dist/schemas/device-commands.d.ts.map +1 -1
- package/dist/schemas/device-commands.js +14 -2
- package/dist/schemas/device-commands.js.map +1 -1
- package/dist/schemas/environment.d.ts +32 -0
- package/dist/schemas/environment.d.ts.map +1 -1
- package/dist/schemas/environment.js +12 -0
- package/dist/schemas/environment.js.map +1 -1
- package/dist/schemas/extension-updates.d.ts +12 -0
- package/dist/schemas/extension-updates.d.ts.map +1 -1
- package/dist/schemas/links.d.ts +6 -1
- package/dist/schemas/links.d.ts.map +1 -1
- package/dist/schemas/links.js +8 -1
- package/dist/schemas/links.js.map +1 -1
- package/dist/schemas/members.d.ts +127 -0
- package/dist/schemas/members.d.ts.map +1 -1
- package/dist/schemas/members.js +32 -0
- package/dist/schemas/members.js.map +1 -1
- package/dist/schemas/needs.d.ts +23 -0
- package/dist/schemas/needs.d.ts.map +1 -1
- package/dist/schemas/needs.js +3 -0
- package/dist/schemas/needs.js.map +1 -1
- package/dist/schemas/organisation.d.ts +164 -0
- package/dist/schemas/organisation.d.ts.map +1 -1
- package/dist/schemas/organisation.js +17 -0
- package/dist/schemas/organisation.js.map +1 -1
- package/dist/schemas/personas.d.ts.map +1 -1
- package/dist/schemas/personas.js +2 -2
- package/dist/schemas/personas.js.map +1 -1
- package/dist/schemas/providers/handoff.d.ts +24 -0
- package/dist/schemas/providers/handoff.d.ts.map +1 -1
- package/dist/schemas/providers/handoff.js +32 -0
- package/dist/schemas/providers/handoff.js.map +1 -1
- package/dist/schemas/providers/usage.d.ts +6 -0
- package/dist/schemas/providers/usage.d.ts.map +1 -1
- package/dist/schemas/providers/usage.js +2 -0
- package/dist/schemas/providers/usage.js.map +1 -1
- package/dist/schemas/services.d.ts +24 -0
- package/dist/schemas/services.d.ts.map +1 -0
- package/dist/schemas/services.js +19 -0
- package/dist/schemas/services.js.map +1 -0
- package/dist/schemas/settings-experiments.d.ts.map +1 -1
- package/dist/schemas/settings-experiments.js +1 -1
- package/dist/schemas/settings-experiments.js.map +1 -1
- package/dist/schemas/settings.d.ts +2 -0
- package/dist/schemas/settings.d.ts.map +1 -1
- package/dist/schemas/settings.js +9 -3
- package/dist/schemas/settings.js.map +1 -1
- package/dist/schemas/tool-ceiling.d.ts +24 -0
- package/dist/schemas/tool-ceiling.d.ts.map +1 -0
- package/dist/schemas/tool-ceiling.js +86 -0
- package/dist/schemas/tool-ceiling.js.map +1 -0
- package/dist/schemas/workspace/workspace-search.d.ts +93 -0
- package/dist/schemas/workspace/workspace-search.d.ts.map +1 -1
- package/dist/schemas/workspace/workspace-search.js +10 -0
- package/dist/schemas/workspace/workspace-search.js.map +1 -1
- package/dist/state/definition.d.ts +4 -0
- package/dist/state/definition.d.ts.map +1 -1
- package/dist/state/locked-folders.d.ts +2 -0
- package/dist/state/locked-folders.d.ts.map +1 -0
- package/dist/state/locked-folders.js +11 -0
- package/dist/state/locked-folders.js.map +1 -0
- package/dist/state/runtime-state.d.ts +3 -0
- package/dist/state/runtime-state.d.ts.map +1 -1
- package/dist/state/runtime-state.js +1 -0
- package/dist/state/runtime-state.js.map +1 -1
- package/dist/text/land-rows.d.ts.map +1 -1
- package/dist/text/land-rows.js +5 -2
- package/dist/text/land-rows.js.map +1 -1
- package/dist/text/notice-rows.d.ts +8 -0
- package/dist/text/notice-rows.d.ts.map +1 -0
- package/dist/text/notice-rows.js +14 -0
- package/dist/text/notice-rows.js.map +1 -0
- package/dist/text/transcript-fold.d.ts.map +1 -1
- package/dist/text/transcript-fold.js +25 -26
- package/dist/text/transcript-fold.js.map +1 -1
- package/package.json +5 -5
- package/src/contracts/access-profiles.contract.ts +43 -0
- package/src/contracts/agents.contract.ts +21 -0
- package/src/contracts/needs.contract.ts +14 -0
- package/src/contracts/services.contract.ts +40 -0
- package/src/contracts/workspace.contract.ts +15 -1
- package/src/events/agent-events.ts +11 -1
- package/src/events/sandbox-notice.ts +17 -1
- package/src/events/tool-update.ts +18 -0
- package/src/events/transcript.ts +5 -0
- package/src/index.ts +4 -0
- package/src/models/device-deadlines.ts +62 -0
- package/src/models/model-roles.ts +2 -2
- package/src/models/model-setups.ts +3 -4
- package/src/policy/control-scopes.ts +5 -0
- package/src/policy/org-locks.ts +5 -2
- package/src/protocol/member-reach.test.ts +221 -0
- package/src/protocol/member-reach.ts +78 -0
- package/src/protocol/raw/raw-json-routes.ts +15 -1
- package/src/protocol/raw/raw-routes.ts +12 -4
- package/src/schemas/access-profiles.test.ts +50 -0
- package/src/schemas/access-profiles.ts +104 -0
- package/src/schemas/agents.ts +30 -0
- package/src/schemas/automations.ts +15 -1
- package/src/schemas/dev-rebuild-log.test.ts +46 -1
- package/src/schemas/dev-rebuild-log.ts +71 -3
- package/src/schemas/device-commands.ts +30 -2
- package/src/schemas/environment.ts +31 -0
- package/src/schemas/links.ts +13 -2
- package/src/schemas/members.ts +59 -1
- package/src/schemas/needs.ts +4 -0
- package/src/schemas/organisation.ts +25 -0
- package/src/schemas/personas.ts +15 -11
- package/src/schemas/providers/handoff.test.ts +23 -1
- package/src/schemas/providers/handoff.ts +49 -0
- package/src/schemas/providers/usage.ts +4 -0
- package/src/schemas/services.ts +32 -0
- package/src/schemas/settings-experiments.ts +5 -1
- package/src/schemas/settings.test.ts +23 -1
- package/src/schemas/settings.ts +17 -4
- package/src/schemas/shared.ts +1 -1
- package/src/schemas/tool-ceiling.test.ts +70 -0
- package/src/schemas/tool-ceiling.ts +113 -0
- package/src/schemas/workspace/workspace-search.ts +16 -0
- package/src/state/locked-folders.test.ts +29 -0
- package/src/state/locked-folders.ts +17 -0
- package/src/state/runtime-state.ts +5 -0
- package/src/state/workspace-state.ts +1 -1
- package/src/text/land-rows.ts +6 -2
- package/src/text/notice-rows.ts +21 -0
- package/src/text/transcript-fold.test.ts +102 -2
- package/src/text/transcript-fold.ts +29 -30
|
@@ -83,6 +83,11 @@ export const EnvironmentRecurringSchema = z.object({
|
|
|
83
83
|
tool: z.string(),
|
|
84
84
|
kind: RuntimeInstallKindSchema,
|
|
85
85
|
sessions: z.number(),
|
|
86
|
+
// The evidence behind the count, so the owner judges the need without opening the ledger: the conversations that
|
|
87
|
+
// installed it (newest last, capped) and the last few commands that did, secrets already masked. Absent from a daemon
|
|
88
|
+
// released before they were carried.
|
|
89
|
+
sessionIds: z.array(z.string()).optional(),
|
|
90
|
+
commands: z.array(z.string()).optional(),
|
|
86
91
|
lastAt: z.number(),
|
|
87
92
|
live: z.boolean(),
|
|
88
93
|
drafted: z.boolean().optional(),
|
|
@@ -125,6 +130,26 @@ export type EnvironmentRebuildWait = z.infer<typeof EnvironmentRebuildWaitSchema
|
|
|
125
130
|
// Asks for that rebuild: the approved overlay's hash and the device that rebuilds this sandbox.
|
|
126
131
|
export const EnvironmentRebuildWhenIdleSchema = z.object({ host: z.string().min(1), hash: z.string().min(1) });
|
|
127
132
|
export type EnvironmentRebuildWhenIdle = z.infer<typeof EnvironmentRebuildWhenIdleSchema>;
|
|
133
|
+
// A CHECKOUT REBUILD'S RESTART, LET THROUGH ONCE NO AGENT IS MID-TURN. The rebuild holds at its swap gate (the hold file,
|
|
134
|
+
// dev-rebuild-log.ts) and the sandbox, which is the one that knows who is mid-turn, lets it through when nobody is. Kept
|
|
135
|
+
// by the sandbox for the same reason as the rebuild wait above, and in memory for the same reason: this sandbox
|
|
136
|
+
// restarting for anything else is the interruption it was waiting to spare.
|
|
137
|
+
export const EnvironmentDevSwapWaitSchema = z.object({
|
|
138
|
+
// The connected device that runs the rebuild, and so holds its gate.
|
|
139
|
+
host: z.string(),
|
|
140
|
+
requestedAt: z.number(),
|
|
141
|
+
// waiting: the gate is held until nobody is mid-turn. released: let through, the restart is under way.
|
|
142
|
+
// failed: the device could not be told; said until the owner picks again.
|
|
143
|
+
phase: z.enum(["waiting", "released", "failed"]),
|
|
144
|
+
// Who it waits on, by the title the board shows them under; empty once it is no longer waiting.
|
|
145
|
+
waitingOn: z.array(z.string()),
|
|
146
|
+
// The device's own words for a failed one.
|
|
147
|
+
message: z.string().optional(),
|
|
148
|
+
});
|
|
149
|
+
export type EnvironmentDevSwapWait = z.infer<typeof EnvironmentDevSwapWaitSchema>;
|
|
150
|
+
// Asks for that wait: the device the rebuild runs on.
|
|
151
|
+
export const EnvironmentDevSwapWhenIdleSchema = z.object({ host: z.string().min(1) });
|
|
152
|
+
export type EnvironmentDevSwapWhenIdle = z.infer<typeof EnvironmentDevSwapWhenIdleSchema>;
|
|
128
153
|
export const EnvironmentSchema = z.object({
|
|
129
154
|
proposal: environmentFileSchema.optional(),
|
|
130
155
|
// The owner-approved agent-written custom section (.intentic/config/environment.custom.Dockerfile).
|
|
@@ -140,8 +165,14 @@ export const EnvironmentSchema = z.object({
|
|
|
140
165
|
recurring: z.array(EnvironmentRecurringSchema).optional(),
|
|
141
166
|
// Absent on a sandbox running a published image, which is every sandbox but a dogfooding one.
|
|
142
167
|
localImage: EnvironmentLocalImageSchema.optional(),
|
|
168
|
+
// Set only on a sandbox Docker Compose runs (SANDBOX_MANAGER): it updates with `docker compose pull && up` from the
|
|
169
|
+
// folder holding its file, so the update card offers that rather than an `ic` swap. Absent from an older daemon too,
|
|
170
|
+
// which is why the card still names the compose way beside the `ic` one when it cannot tell.
|
|
171
|
+
manager: z.literal("compose").optional(),
|
|
143
172
|
// A rebuild waiting for the agents to be idle, or started or refused once they were; absent when none is asked.
|
|
144
173
|
rebuildWhenIdle: EnvironmentRebuildWaitSchema.optional(),
|
|
174
|
+
// A checkout rebuild's restart held until no agent is mid-turn; absent when none is asked.
|
|
175
|
+
devSwapWhenIdle: EnvironmentDevSwapWaitSchema.optional(),
|
|
145
176
|
// This sandbox can hold a rebuild until no agent is mid-turn (POST /environment/rebuild-when-idle), and resume the
|
|
146
177
|
// turns a restart the owner starts cuts when asked (a device swap's `resumeTurns`). Absent from one too old to,
|
|
147
178
|
// where the rebuild dialog offers only "Rebuild now" and the cut turns wait to be continued, as before.
|
package/src/schemas/links.ts
CHANGED
|
@@ -27,6 +27,12 @@ export const LinkTermsSchema = z.object({
|
|
|
27
27
|
.describe(
|
|
28
28
|
"The persona every task through this link wears: its accounts, its shelves, its folders, its model. Absent, the task runs with no signed-in account and the full toolbox, as any unattended wake does.",
|
|
29
29
|
),
|
|
30
|
+
// Who the link's tasks act for (schemas/services.ts), the hard half beside the persona's posture.
|
|
31
|
+
runAs: entryId
|
|
32
|
+
.optional()
|
|
33
|
+
.describe(
|
|
34
|
+
"The service every task through this link acts as: whose authority it uses, held to that service's access profile. Absent means this sandbox's owner, limited only by the persona.",
|
|
35
|
+
),
|
|
30
36
|
approve: z
|
|
31
37
|
.boolean()
|
|
32
38
|
.default(false)
|
|
@@ -84,8 +90,13 @@ export type InboundLinkMint = z.infer<typeof InboundLinkMintSchema>;
|
|
|
84
90
|
// The raw token, shown exactly once.
|
|
85
91
|
export const InboundLinkMintedSchema = z.object({ id: z.string(), token: z.string() });
|
|
86
92
|
export type InboundLinkMinted = z.infer<typeof InboundLinkMintedSchema>;
|
|
87
|
-
// POST /system/links/{id}: new terms, whole fields replaced, the rest kept.
|
|
88
|
-
|
|
93
|
+
// POST /system/links/{id}: new terms, whole fields replaced, the rest kept. `null` on the persona or the service takes it
|
|
94
|
+
// off (2026-10-26): absence keeps a field, so before this neither could be cleared once set.
|
|
95
|
+
export const InboundLinkTermsUpdateSchema = LinkTermsSchema.partial().extend({
|
|
96
|
+
label: z.string().trim().min(1).max(60).optional(),
|
|
97
|
+
actsAs: entryId.nullable().optional().describe("The persona every task wears; null takes it off."),
|
|
98
|
+
runAs: entryId.nullable().optional().describe("The service every task acts as; null takes it off, so tasks act for this sandbox's owner."),
|
|
99
|
+
});
|
|
89
100
|
export type InboundLinkTermsUpdate = z.infer<typeof InboundLinkTermsUpdateSchema>;
|
|
90
101
|
// POST /system/links/{id}/requests/{request}: the owner's answer to one waiting task.
|
|
91
102
|
export const LinkRequestDecisionSchema = z.object({ approve: z.boolean() });
|
package/src/schemas/members.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
// members: the daemon's shared-access roster (GET/POST/DELETE /members), who besides the owner reaches this sandbox
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import type { CapabilityKind } from "./capabilities.js";
|
|
4
|
+
import { entryId } from "./internal.js";
|
|
4
5
|
import { type GrantedRole, GrantedRoleSchema, MemberRoleSchema } from "./shared.js";
|
|
6
|
+
import { ToolCeilingSchema } from "./tool-ceiling.js";
|
|
5
7
|
|
|
6
8
|
// WHAT A PERSON'S CONVERSATIONS MAY SPEND: the connected capabilities (by id) and the stored secrets (by name) an agent
|
|
7
9
|
// working for them is handed. Enforced by the daemon, not told to the model: a capability outside it is never mounted
|
|
@@ -191,6 +193,21 @@ export const MemberSchema = z.object({
|
|
|
191
193
|
.describe(
|
|
192
194
|
"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.",
|
|
193
195
|
),
|
|
196
|
+
tools: ToolCeilingSchema.optional().describe(
|
|
197
|
+
"The most their conversations' tools may be, shelf by shelf; a persona only narrows inside it. Absent means no limit.",
|
|
198
|
+
),
|
|
199
|
+
assistants: z
|
|
200
|
+
.array(entryId)
|
|
201
|
+
.max(50)
|
|
202
|
+
.optional()
|
|
203
|
+
.describe(
|
|
204
|
+
"For a guest who chats: which of the assistants working in their areas they may talk to, by persona id. Absent means every one that works there.",
|
|
205
|
+
),
|
|
206
|
+
profile: entryId
|
|
207
|
+
.optional()
|
|
208
|
+
.describe(
|
|
209
|
+
"The access profile their answers come from (docs/architecture/access.md). Its answers are written out on this row too, and saving the profile rewrites them. Absent means answers of their own.",
|
|
210
|
+
),
|
|
194
211
|
});
|
|
195
212
|
export type Member = z.infer<typeof MemberSchema>;
|
|
196
213
|
|
|
@@ -214,7 +231,12 @@ export type MembersRoster = z.infer<typeof MembersRosterSchema>;
|
|
|
214
231
|
// them still grants what it always did. `lands` is written as sent: absent is no, so a re-grade that never mentions it
|
|
215
232
|
// can never hand a home-only person's agent the authority to land. The role sent must be the tier the access makes (`tierOf`): two answers to one
|
|
216
233
|
// question are refused rather than one of them guessed away. `aiAccounts` reads as `credentials` does: `all` lifts it, a
|
|
217
|
-
// list sets it, absent keeps the row's; a maintainer is refused a list, since the tier runs on every account.
|
|
234
|
+
// list sets it, absent keeps the row's; a maintainer is refused a list, since the tier runs on every account. `tools` and
|
|
235
|
+
// `assistants` read the same way.
|
|
236
|
+
// `profile` names an access profile instead of answering on the row: the daemon writes that profile's answers out on
|
|
237
|
+
// the row and ignores the access fields sent beside it, and the role sent must still be the tier the profile makes.
|
|
238
|
+
// Absent is answers of the row's own, so a re-grade from an editor that predates profiles unlinks the row, keeping
|
|
239
|
+
// the answers it carried, rather than leaving a link the grant did not mean. A maintainer is refused one.
|
|
218
240
|
export const MemberGrantSchema = z.object({
|
|
219
241
|
email: z.string(),
|
|
220
242
|
role: GrantedRoleSchema,
|
|
@@ -225,6 +247,9 @@ export const MemberGrantSchema = z.object({
|
|
|
225
247
|
emailSignIn: z.boolean().optional(),
|
|
226
248
|
credentials: z.union([z.literal("all"), CredentialReachSchema]).optional(),
|
|
227
249
|
aiAccounts: z.union([z.literal("all"), z.array(AiAccountKeySchema).max(500)]).optional(),
|
|
250
|
+
tools: z.union([z.literal("all"), ToolCeilingSchema]).optional(),
|
|
251
|
+
assistants: z.union([z.literal("all"), z.array(entryId).max(50)]).optional(),
|
|
252
|
+
profile: entryId.optional(),
|
|
228
253
|
});
|
|
229
254
|
export type MemberGrant = z.infer<typeof MemberGrantSchema>;
|
|
230
255
|
|
|
@@ -243,8 +268,41 @@ export const MemberSelfSchema = z.object({
|
|
|
243
268
|
.array(AiAccountKeySchema)
|
|
244
269
|
.optional()
|
|
245
270
|
.describe("The AI accounts their conversations may run on, as the roster keys them, so a picker offers only those. Absent means every one."),
|
|
271
|
+
tools: ToolCeilingSchema.optional().describe("The most their conversations' tools may be. Absent means no limit."),
|
|
272
|
+
assistants: z.array(entryId).optional().describe("For a guest who chats: the assistants they may talk to. Absent means every one in their areas."),
|
|
273
|
+
profile: entryId.optional().describe("The access profile their access comes from. Absent means answers of their own."),
|
|
274
|
+
askedAt: z
|
|
275
|
+
.number()
|
|
276
|
+
.int()
|
|
277
|
+
.optional()
|
|
278
|
+
.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."),
|
|
246
279
|
});
|
|
247
280
|
export type MemberSelf = z.infer<typeof MemberSelfSchema>;
|
|
248
281
|
|
|
282
|
+
// ASKING THE OWNER FOR MORE ACCESS, from where the person was refused: the editor draws an "Ask for access" press on a
|
|
283
|
+
// place or an action their access refuses, and the owner sees each open request beside the roster (Access ▸ People),
|
|
284
|
+
// where granting the person what they asked for answers it. One open request per person: a later ask replaces theirs.
|
|
285
|
+
// `want` is what stood in the way, in the terms a grant answers: a tier (`viewer` is a guest asking to see more),
|
|
286
|
+
// running agents (`agents`), or a folder outside their areas (`areas`).
|
|
287
|
+
export const AccessWantSchema = z.enum(["viewer", "collaborator", "writer", "maintainer", "agents", "areas"]);
|
|
288
|
+
export type AccessWant = z.infer<typeof AccessWantSchema>;
|
|
289
|
+
|
|
290
|
+
// POST /members/requests: what the person asks for, and where they were when they asked.
|
|
291
|
+
export const AccessAskSchema = z.object({
|
|
292
|
+
want: AccessWantSchema.describe("What stood in the way: a tier, running agents, or a folder outside their areas."),
|
|
293
|
+
place: z.string().min(1).max(80).describe("Where they were, as that page or section is titled (\"Secrets\"), so the owner knows what it is for."),
|
|
294
|
+
});
|
|
295
|
+
export type AccessAsk = z.infer<typeof AccessAskSchema>;
|
|
296
|
+
|
|
297
|
+
export const AccessRequestSchema = AccessAskSchema.extend({
|
|
298
|
+
email: z.string().describe("Who asked."),
|
|
299
|
+
at: z.number().int().describe("When they asked, in ms since the epoch."),
|
|
300
|
+
});
|
|
301
|
+
export type AccessRequest = z.infer<typeof AccessRequestSchema>;
|
|
302
|
+
|
|
303
|
+
// GET /members/requests, and the answer to dismissing one: every open request, newest first.
|
|
304
|
+
export const AccessRequestsSchema = z.object({ requests: z.array(AccessRequestSchema) });
|
|
305
|
+
export type AccessRequests = z.infer<typeof AccessRequestsSchema>;
|
|
306
|
+
|
|
249
307
|
// DELETE /members: whose access to take back.
|
|
250
308
|
export const MemberEmailSchema = z.object({ email: z.string() });
|
package/src/schemas/needs.ts
CHANGED
|
@@ -256,6 +256,10 @@ export type NeedAnswer = z.infer<typeof NeedAnswerSchema>;
|
|
|
256
256
|
|
|
257
257
|
export const NeedIdParamSchema = z.object({ id: z.string().min(1).describe("Which need.") });
|
|
258
258
|
export const NeedAnswerInputSchema = NeedIdParamSchema.extend({ answer: NeedAnswerSchema });
|
|
259
|
+
// POST /needs/{id}/release: a release need's own answer, from the people its gate names, whatever their tier.
|
|
260
|
+
export const NeedReleaseInputSchema = NeedIdParamSchema.extend({
|
|
261
|
+
answer: z.enum(["release", "decline"]).describe("Release the credential to the conversation, or decline it."),
|
|
262
|
+
});
|
|
259
263
|
export const NeedSecretInputSchema = NeedIdParamSchema.extend({
|
|
260
264
|
value: z.string().min(1).max(64_000).describe("The secret's value. Stored, never echoed, never written into a transcript."),
|
|
261
265
|
// "Keep it on my computer": the value is sealed to that computer's keyring inbox (schemas/keyring.ts) and kept there,
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { AccessProfileSchema } from "./access-profiles.js";
|
|
2
3
|
import { PRESET_GROUPS, type PresetGroup, PresetGroupSchema } from "./compliance.js";
|
|
4
|
+
import { AiAccountKeySchema } from "./members.js";
|
|
5
|
+
import { ToolCeilingSchema } from "./tool-ceiling.js";
|
|
3
6
|
|
|
4
7
|
// An ORGANISATION'S POLICY as a sandbox holds it (docs/architecture/organisations.md). A sandbox that belongs to an
|
|
5
8
|
// organisation is handed this by the platform it is registered with; a personal sandbox never holds one, and nothing
|
|
@@ -30,6 +33,20 @@ export type OrgSection = z.infer<typeof OrgSectionSchema>;
|
|
|
30
33
|
export const OrgSectionModeSchema = z.enum(["open", "locked", "hidden"]);
|
|
31
34
|
export type OrgSectionMode = z.infer<typeof OrgSectionModeSchema>;
|
|
32
35
|
|
|
36
|
+
// THE ORGANISATION'S CEILING: one more limit in every turn of a bound sandbox, the owner's included
|
|
37
|
+
// (docs/architecture/access.md). Only what means the same in every sandbox: tool shelves, and the AI accounts a turn may
|
|
38
|
+
// run on, by provider (`claude`) or by one provider's account. Connections and areas are each sandbox's own ids, so an
|
|
39
|
+
// organisation holds those through the profiles it hands out instead.
|
|
40
|
+
export const OrgCeilingSchema = z.object({
|
|
41
|
+
tools: ToolCeilingSchema.optional().describe("The most any turn's tools may be, shelf by shelf. Absent means no limit."),
|
|
42
|
+
aiAccounts: z
|
|
43
|
+
.array(AiAccountKeySchema)
|
|
44
|
+
.max(100)
|
|
45
|
+
.optional()
|
|
46
|
+
.describe("The AI accounts any turn may run on, a provider alone or `provider:account`. Absent means every one."),
|
|
47
|
+
});
|
|
48
|
+
export type OrgCeiling = z.infer<typeof OrgCeilingSchema>;
|
|
49
|
+
|
|
33
50
|
// Omitted policy sections stay open. preset pins effective settings and refuses undoing writes, regardless of underlying files.
|
|
34
51
|
// Unknown preset groups are skipped/reported as unenforced so newer policies still reach older daemons; the platform validates saved names.
|
|
35
52
|
// membersOnly fences roster grants/removals by organisation membership, excluding the owner who is not a roster entry.
|
|
@@ -48,6 +65,14 @@ export const OrgPolicyRulesSchema = z.object({
|
|
|
48
65
|
.boolean()
|
|
49
66
|
.optional()
|
|
50
67
|
.describe("Only the organisation's members may be on a bound sandbox's roster; removing someone from the organisation removes them everywhere."),
|
|
68
|
+
// Listed in every bound sandbox beside its own profiles, read-only there; a local profile cannot take one's id.
|
|
69
|
+
// Optional like the rest, so a policy stored before them hands out none.
|
|
70
|
+
profiles: z
|
|
71
|
+
.array(AccessProfileSchema)
|
|
72
|
+
.max(50)
|
|
73
|
+
.optional()
|
|
74
|
+
.describe("Access profiles every bound sandbox may grant, read-only there. Areas and connections they name are each sandbox's own ids."),
|
|
75
|
+
ceiling: OrgCeilingSchema.optional().describe("What no turn in a bound sandbox may exceed, the owner's included."),
|
|
51
76
|
});
|
|
52
77
|
export type OrgPolicyRules = z.infer<typeof OrgPolicyRulesSchema>;
|
|
53
78
|
|
package/src/schemas/personas.ts
CHANGED
|
@@ -6,11 +6,13 @@ 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
8
|
// A named face the sandbox shows outward: who it speaks as, what it may do, where it works, what it's told, what it
|
|
9
|
-
// runs on. No credential lives on the card; accounts stay private, per-sandbox.
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
//
|
|
9
|
+
// runs on. No credential lives on the card; accounts stay private, per-sandbox. POSTURE, NOT ACCESS
|
|
10
|
+
// (docs/architecture/access.md): what a turn may reach is decided by who it acts for, the people in its conversation
|
|
11
|
+
// or the service an unattended run acts as, each held to an access profile. A card only narrows inside that, for a
|
|
12
|
+
// watched chat and an unattended run alike, and never widens it.
|
|
13
|
+
// Narrowing is enforced by absence (`connectors`/`devices`/`mcp`: no credential injected) or by removing tools from
|
|
14
|
+
// context; `shell` decides, since with it a session can reach anything else fenced off, turning the rest into defaults,
|
|
15
|
+
// not limits. Absent `powers` means the full toolbox, inside whatever the principals allow.
|
|
14
16
|
export const PersonaPowersSchema = z.object({
|
|
15
17
|
// "read" is look-and-search only; "write" adds creating and changing; "none" removes both.
|
|
16
18
|
files: z
|
|
@@ -208,7 +210,7 @@ export const PersonaSchema = z.object({
|
|
|
208
210
|
.array(entryId)
|
|
209
211
|
.max(50)
|
|
210
212
|
.describe(
|
|
211
|
-
"Which connected accounts
|
|
213
|
+
"Which connected accounts it speaks through. Named individually rather than by site, because two accounts on one site is the whole problem this solves. It narrows: 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.",
|
|
212
214
|
),
|
|
213
215
|
// Owner-written, not derived: a classifier routes better on prose than on a list of account ids. Absent, the router
|
|
214
216
|
// has less to go on but still tries.
|
|
@@ -220,7 +222,7 @@ export const PersonaSchema = z.object({
|
|
|
220
222
|
"What this persona is for, in one line. A new chat is routed onto a persona by this sentence, and the Personas page shows it under the name.",
|
|
221
223
|
),
|
|
222
224
|
powers: PersonaPowersSchema.optional().describe(
|
|
223
|
-
"What a conversation wearing it may do. Absent means the full toolbox, so a card written before this existed behaves exactly as it did.",
|
|
225
|
+
"What a conversation wearing it may do, inside what whoever it acts for may. Absent means the full toolbox, so a card written before this existed behaves exactly as it did.",
|
|
224
226
|
),
|
|
225
227
|
workspace: PersonaWorkspaceSchema.optional().describe("Where it works. Absent means the whole workspace."),
|
|
226
228
|
context: PersonaContextSchema.optional().describe(
|
|
@@ -253,10 +255,12 @@ export const personaModels = (card: Pick<Persona, "models">, sources: readonly M
|
|
|
253
255
|
// The one stock persona id; lives here because the daemon and the automations form are separate packages that must
|
|
254
256
|
// agree on it exactly, or a Visitor chat pins to a card nobody creates.
|
|
255
257
|
export const VISITOR_CHAT_PERSONA = "visitor-chat";
|
|
256
|
-
// THE TWO BUILT-IN PERSONAS
|
|
257
|
-
// person is watching (personas.ts `turnPersona` in the daemon). They are constants rather than cards
|
|
258
|
-
// that file is tracked in git, and "every account" is not something a card's account list can say,
|
|
259
|
-
// written once and accounts are connected later. Neither can be edited or removed, and no card may
|
|
258
|
+
// THE TWO BUILT-IN PERSONAS, postures like any card: every turn wears one, and a turn naming no card wears one of these,
|
|
259
|
+
// picked by whether a person is watching (personas.ts `turnPersona` in the daemon). They are constants rather than cards
|
|
260
|
+
// in personas.json: that file is tracked in git, and "every account" is not something a card's account list can say,
|
|
261
|
+
// since the list is written once and accounts are connected later. Neither can be edited or removed, and no card may
|
|
262
|
+
// take either id. Both stay inside what the turn's principals may (docs/architecture/access.md): "every account" is
|
|
263
|
+
// every account they may use.
|
|
260
264
|
// Full access: every tool and every signed-in account, what a chat a person starts without picking anyone acts as.
|
|
261
265
|
export const FULL_ACCESS_PERSONA = "full-access";
|
|
262
266
|
// No accounts: every tool but no signed-in account, what a run nobody watches acts as when it names no one, since
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type HandoffMode, handedOffLine, handedOffNotice, suggestHandoff } from "./handoff.js";
|
|
1
|
+
import { freshStartLine, freshStartNotice, type HandoffMode, handedOffLine, handedOffNotice, suggestHandoff } from "./handoff.js";
|
|
2
2
|
|
|
3
3
|
const THRESHOLDS = { carryUnder: 150_000, summaryOver: 700_000 };
|
|
4
4
|
const all = (): boolean => true;
|
|
@@ -40,3 +40,25 @@ describe("handedOffLine", () => {
|
|
|
40
40
|
expect(handedOffNotice({ mode: "summary", fellBack: true })).toStrictEqual({ code: "handedOff", params: { mode: "summary", fellBack: true } });
|
|
41
41
|
});
|
|
42
42
|
});
|
|
43
|
+
|
|
44
|
+
describe("a home's fresh start", () => {
|
|
45
|
+
it("says why the chat started over and what the fresh session opened with", () => {
|
|
46
|
+
expect(freshStartLine({ why: "cold", from: 90_000, summarized: false })).toBe(
|
|
47
|
+
"This chat had been idle long enough that re-reading it at about 90k tokens would cost more than starting over, so it went on in a fresh session, opened with its latest messages and the work in hand.",
|
|
48
|
+
);
|
|
49
|
+
expect(freshStartLine({ why: "asked", summarized: true })).toBe(
|
|
50
|
+
"Started fresh, as you asked, opened with a summary of the conversation and its latest messages.",
|
|
51
|
+
);
|
|
52
|
+
expect(freshStartLine({ why: "cleared", summarized: false })).toBe("History cleared: started fresh, opened with its latest messages and the work in hand.");
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it("carries only the facts it has", () => {
|
|
56
|
+
expect(freshStartNotice({ why: "asked", summarized: false })).toEqual({ code: "freshStart", params: { why: "asked", summarized: false } });
|
|
57
|
+
expect(freshStartNotice({ why: "budget", from: 151_400, model: "haiku", summarized: true }).params).toEqual({
|
|
58
|
+
why: "budget",
|
|
59
|
+
from: "151k",
|
|
60
|
+
model: "haiku",
|
|
61
|
+
summarized: true,
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
});
|
|
@@ -126,3 +126,52 @@ export const handedOffLine = (event: HandedOff): string => {
|
|
|
126
126
|
return `Continued in a fresh session opened with a summary of the conversation${event.model === undefined ? "" : ` written by ${event.model}`}.`;
|
|
127
127
|
}
|
|
128
128
|
};
|
|
129
|
+
|
|
130
|
+
// HOW A HOME CONVERSATION STAYS CHEAP (the daemon's conversations/home/home-rollover.ts). A home is one chat kept for
|
|
131
|
+
// good, so its session would grow until the model's window forced a compaction, every call of every turn re-reading all
|
|
132
|
+
// of it on the way. Instead, once it has grown past the sandbox's budget (`homeFreshOver`), or half of it with the
|
|
133
|
+
// prompt cache already cold, its next turn opens a fresh session: a summary where a model is set for hand-off summaries,
|
|
134
|
+
// the newest part of the conversation word for word, its subagents and what they hold, and its home policy again. Its
|
|
135
|
+
// person may also start one fresh by hand, or clear its history. The chat itself keeps every row; only what the model
|
|
136
|
+
// re-reads starts over.
|
|
137
|
+
export const FRESH_START_WHYS = ["budget", "cold", "asked", "cleared"] as const;
|
|
138
|
+
export const FreshStartWhySchema = z.enum(FRESH_START_WHYS);
|
|
139
|
+
export type FreshStartWhy = z.infer<typeof FreshStartWhySchema>;
|
|
140
|
+
|
|
141
|
+
export const FreshStartSchema = z.object({
|
|
142
|
+
why: FreshStartWhySchema.describe(
|
|
143
|
+
"Why the conversation went on in a fresh session: it outgrew the budget (`budget`), it had grown past half of it while its prompt cache was already cold (`cold`), its person asked (`asked`), or its person cleared its history (`cleared`).",
|
|
144
|
+
),
|
|
145
|
+
from: z.number().optional().describe("The context the old session had grown to, in tokens. Absent where nothing measured it."),
|
|
146
|
+
model: z.string().optional().describe("The model that wrote the summary the fresh session opened with."),
|
|
147
|
+
summarized: z.boolean().describe("Whether a summary was written; false where the fresh session opened with the recent conversation alone."),
|
|
148
|
+
});
|
|
149
|
+
export type FreshStart = z.infer<typeof FreshStartSchema>;
|
|
150
|
+
|
|
151
|
+
export const freshStartNotice = (event: FreshStart): Extract<SandboxNotice, { code: "freshStart" }> => {
|
|
152
|
+
const params: Extract<SandboxNotice, { code: "freshStart" }>["params"] = { why: event.why, summarized: event.summarized };
|
|
153
|
+
if (event.from !== undefined) {
|
|
154
|
+
params.from = tokensLabel(event.from);
|
|
155
|
+
}
|
|
156
|
+
if (event.model !== undefined) {
|
|
157
|
+
params.model = event.model;
|
|
158
|
+
}
|
|
159
|
+
return { code: "freshStart", params };
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
/** The transcript's line for a fresh session, in the English the record keeps. */
|
|
163
|
+
export const freshStartLine = (event: FreshStart): string => {
|
|
164
|
+
const from = event.from === undefined ? "" : ` at about ${tokensLabel(event.from)} tokens`;
|
|
165
|
+
const why =
|
|
166
|
+
event.why === "budget"
|
|
167
|
+
? `This chat's memory was full${from}, so it went on in a fresh session`
|
|
168
|
+
: event.why === "cold"
|
|
169
|
+
? `This chat had been idle long enough that re-reading it${from} would cost more than starting over, so it went on in a fresh session`
|
|
170
|
+
: event.why === "asked"
|
|
171
|
+
? "Started fresh, as you asked"
|
|
172
|
+
: "History cleared: started fresh";
|
|
173
|
+
const carried = event.summarized
|
|
174
|
+
? `, opened with a summary of the conversation${event.model === undefined ? "" : ` written by ${event.model}`} and its latest messages.`
|
|
175
|
+
: ", opened with its latest messages and the work in hand.";
|
|
176
|
+
return `${why}${carried}`;
|
|
177
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Durable spend ledger: per-account token and cost totals.
|
|
2
2
|
import { z } from "zod";
|
|
3
|
+
import { FreshStartWhySchema } from "./handoff.js";
|
|
3
4
|
// One row per attributed turn, appended at turn end and never pruned, unlike the activity log which shrinks as it
|
|
4
5
|
// prunes. Rollups project this on read, so a new grouping needs no new storage.
|
|
5
6
|
export const UsageTurnSchema = z.object({
|
|
@@ -107,6 +108,9 @@ export const UsageTurnSchema = z.object({
|
|
|
107
108
|
// Assigned on cold-eligible follow-ups only, including controls; cleared results only when a copy was resumed.
|
|
108
109
|
coldTrimArm: z.boolean().optional(),
|
|
109
110
|
coldTrimmed: z.number().int().min(0).optional(),
|
|
111
|
+
// A home conversation's turn that opened a fresh session rather than resuming its old one, and why (handoff.ts
|
|
112
|
+
// FreshStartSchema). Absent on every other turn, a home's included. What `bench:home` reads the rollover's cost off.
|
|
113
|
+
homeFresh: FreshStartWhySchema.optional(),
|
|
110
114
|
// What became of pre-turn retrieval on this turn, and how long it took. Assignment and DELIVERY are different
|
|
111
115
|
// facts: the first version of this mechanism was assigned to every eligible turn and reached four in five of them,
|
|
112
116
|
// which is the difference between a null result and a mechanism that never ran. Absent means the flag was off, so
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { entryId } from "./internal.js";
|
|
3
|
+
|
|
4
|
+
// A SERVICE: a named non-human principal unattended work acts as (docs/architecture/access.md). An automation, one of its
|
|
5
|
+
// sender rules, an inbound link or a control token names one in `runAs`, and every turn it starts acts for the service's
|
|
6
|
+
// steward, a person, narrowed by the service's access profile. An agent so never holds more than the person it acts for,
|
|
7
|
+
// and a steward who leaves the roster takes the reach of every service they steward with them.
|
|
8
|
+
// Holds no credential: a steward is an address on the roster, a profile an id.
|
|
9
|
+
export const ServiceSchema = z.object({
|
|
10
|
+
id: entryId.describe("The service's id, what `runAs` names."),
|
|
11
|
+
label: z.string().max(60).optional().describe("What to call it on screen, like 'Marketing bot'. Absent falls back to the id."),
|
|
12
|
+
brief: z.string().max(200).optional().describe("What it does, in one line."),
|
|
13
|
+
steward: z
|
|
14
|
+
.string()
|
|
15
|
+
.min(3)
|
|
16
|
+
.max(320)
|
|
17
|
+
.describe(
|
|
18
|
+
"Who it acts for, by email: the sandbox's owner or someone on its roster. Its runs reach at most what this person may, and nothing once they leave.",
|
|
19
|
+
),
|
|
20
|
+
profile: entryId
|
|
21
|
+
.optional()
|
|
22
|
+
.describe("The access profile its runs are held to, inside what its steward may. Absent means everything its steward may."),
|
|
23
|
+
});
|
|
24
|
+
export type Service = z.infer<typeof ServiceSchema>;
|
|
25
|
+
|
|
26
|
+
export const ServicesListSchema = z.object({ services: z.array(ServiceSchema).describe("Every service unattended work here may run as.") });
|
|
27
|
+
export type ServicesList = z.infer<typeof ServicesListSchema>;
|
|
28
|
+
|
|
29
|
+
export const ServiceIdParamSchema = z.object({ id: entryId.describe("Which service.") });
|
|
30
|
+
|
|
31
|
+
// What a `runAs` holds: one service's id.
|
|
32
|
+
export const ServiceRefSchema = entryId.describe("Which service it acts as.");
|
|
@@ -14,11 +14,15 @@ export const claudeExperimentSettings = {
|
|
|
14
14
|
"Load the schemas of connected tools (browsers, devices, accounts, phones) only when the agent looks one up, instead of sending all of them with every request. The tools the agent leans on every turn stay loaded. Applies to Claude models on the Claude Code loop.",
|
|
15
15
|
),
|
|
16
16
|
// Both arms set the CLI's switch explicitly, so a shielded turn and an unshielded one compare the same two things.
|
|
17
|
+
// Measured and closed on 2026-10-26: Opus 5.5 turns on this loop, 273 deferred against 272 loaded over the same days
|
|
18
|
+
// (10-18 to 10-26), opened at 52k prompt tokens against 110k, read 120k cached tokens per model call against 194k and
|
|
19
|
+
// cost $0.055 a call against $0.072 ($5.03 a turn against $7.81 on average). Nothing is held out by default now; an
|
|
20
|
+
// owner who wants the comparison back sets a share here.
|
|
17
21
|
toolSearchHoldout: z
|
|
18
22
|
.number()
|
|
19
23
|
.min(0)
|
|
20
24
|
.max(1)
|
|
21
|
-
.default(0
|
|
25
|
+
.default(0)
|
|
22
26
|
.describe(
|
|
23
27
|
"What share of conversations to run with every tool loaded up front, so the two can be compared. Whole conversations rather than individual turns, because switching mid-conversation would rewrite the prompt the cache holds.",
|
|
24
28
|
),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { convertDocument } from "../documents/conversions.js";
|
|
2
|
-
import type
|
|
2
|
+
import { MODEL_ROLES, type ModelRole } from "../models/model-roles.js";
|
|
3
3
|
import { rolePins } from "../models/model-setups.js";
|
|
4
4
|
import { SETTINGS_HISTORY } from "./settings-history.js";
|
|
5
5
|
import { RepoChecksFileSchema, RuleSchema, SandboxSettingsSchema, SandboxSettingsWriteSchema } from "./settings.js";
|
|
@@ -245,3 +245,25 @@ describe(`restore points' retention, renamed so a stored zero is the owner's own
|
|
|
245
245
|
expect(read({ restorePointDays: 0, restorePointKeepDays: 5 }).retention.restorePointKeepDays).toBe(5);
|
|
246
246
|
});
|
|
247
247
|
});
|
|
248
|
+
|
|
249
|
+
describe(`default job setups`, () => {
|
|
250
|
+
test(`new settings place every job on its suggested preset`, () => {
|
|
251
|
+
const settings = SandboxSettingsSchema.parse({});
|
|
252
|
+
expect(settings.roleSetups).toEqual(Object.fromEntries(MODEL_ROLES.map((role) => [role.id, role.setup])));
|
|
253
|
+
expect(settings.roleSetups[`commit-message`]).toBe(`low`);
|
|
254
|
+
expect(settings.roleSetups[`safety-judge`]).toBe(`medium`);
|
|
255
|
+
expect(settings.roleSetups[`pipeline-fix`]).toBe(`high`);
|
|
256
|
+
const sources = [{ provider: `claude`, ready: true, models: [`claude-haiku-4-5`, `claude-sonnet-5`, `claude-opus-5`] }] as const;
|
|
257
|
+
expect(rolePins(settings, `commit-message`, sources)).toEqual([{ provider: `claude`, model: `claude-haiku-4-5` }]);
|
|
258
|
+
expect(rolePins(settings, `safety-judge`, sources)).toEqual([{ provider: `claude`, model: `claude-sonnet-5` }]);
|
|
259
|
+
expect(rolePins(settings, `pipeline-fix`, sources)).toEqual([{ provider: `claude`, model: `claude-opus-5` }]);
|
|
260
|
+
expect(rolePins(settings, `pipeline-fix`, [])).toEqual([]);
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
test(`saved assignments keep their choices and jobs left off`, () => {
|
|
264
|
+
expect(SandboxSettingsSchema.parse({ roleSetups: {} }).roleSetups).toEqual({});
|
|
265
|
+
expect(SandboxSettingsSchema.parse({ roleSetups: { "commit-message": `high` } }).roleSetups).toEqual({ "commit-message": `high` });
|
|
266
|
+
const saved = SandboxSettingsSchema.parse({ roleSetups: {} });
|
|
267
|
+
expect(SandboxSettingsWriteSchema.parse({ ...saved, commandJudge: `watch` }).roleSetups).toEqual({});
|
|
268
|
+
});
|
|
269
|
+
});
|
package/src/schemas/settings.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { claudeExperimentSettings, iqSearchSettings } from "./settings-experiments.js";
|
|
4
4
|
import { CommandJudgeModeSchema, ProjectInstallModeSchema } from "../policy/safety-policy.js";
|
|
5
|
-
import { ModelRoleSchema } from "../models/model-roles.js";
|
|
5
|
+
import { MODEL_ROLES, ModelRoleSchema } from "../models/model-roles.js";
|
|
6
6
|
import { MODEL_SETUP_ID, ModelSetupSchema } from "../models/model-setups.js";
|
|
7
7
|
import { AdmissionPolicySchema, AdmissionRuleSchema } from "./command-admission.js";
|
|
8
8
|
import { KeepWarmSettingsSchema } from "./keep-warm.js";
|
|
@@ -383,12 +383,13 @@ export const SandboxSettingsSchema = z.object({
|
|
|
383
383
|
"The model setups jobs run on: Low, Medium and High, which every sandbox has, and any you make. Each is an ordered list of models, tried in order so one spent account does not take its jobs down. A preset left out of this list, or listed without models, is worked out from the accounts you have connected. A setup runs only the jobs put on it (`roleSetups`).",
|
|
384
384
|
),
|
|
385
385
|
// `partialRecord`, not `record`: an exhaustive one would force every settings file to list every role, and adding
|
|
386
|
-
// one would invalidate them all.
|
|
386
|
+
// one would invalidate them all. A fresh sandbox places every job on its suggested preset; an explicit
|
|
387
|
+
// map stays as written, including an empty one or a job removed from it.
|
|
387
388
|
roleSetups: z
|
|
388
389
|
.partialRecord(ModelRoleSchema, z.string().regex(MODEL_SETUP_ID))
|
|
389
|
-
.default(
|
|
390
|
+
.default(() => Object.fromEntries(MODEL_ROLES.map((role) => [role.id, role.setup])))
|
|
390
391
|
.describe(
|
|
391
|
-
"Which setup each job runs on: commit messages, session titles, the safety judge, pipeline fixes and every other place this sandbox picks a model for you.
|
|
392
|
+
"Which setup each job runs on: commit messages, session titles, the safety judge, pipeline fixes and every other place this sandbox picks a model for you. Defaults to each job’s suggested Low, Medium or High setup. In a saved map, a job left out, or on a setup with no models, has none, so a one-shot job does not run and a whole session opens on whatever your own chat is set to.",
|
|
392
393
|
),
|
|
393
394
|
// Folded into the router's prompt (agent/prompt/chat-router.ts), never into a turn's own. Capped small on
|
|
394
395
|
// purpose: the reading runs under a 5s deadline, and this text is paid for on every chat that opens on Auto.
|
|
@@ -456,6 +457,18 @@ export const SandboxSettingsSchema = z.object({
|
|
|
456
457
|
.describe(
|
|
457
458
|
"For the suggested hand-off: at or above this many tokens of context, suggest a summary rather than a trimmed session, where a model is set for hand-off summaries.",
|
|
458
459
|
),
|
|
460
|
+
// A home conversation is one chat kept for good (handoff.ts FreshStartSchema): past this, its next turn opens a fresh
|
|
461
|
+
// session instead of re-reading all of the old one. 150k sits under where a typical conversation here peaked (the spend
|
|
462
|
+
// ledger, 2026-10-13..27: median peak 172k), and a turn ending at 100-150k cost about $1 on average there against about
|
|
463
|
+
// $9 for one ending at 300-500k.
|
|
464
|
+
homeFreshOver: z
|
|
465
|
+
.number()
|
|
466
|
+
.int()
|
|
467
|
+
.min(0)
|
|
468
|
+
.default(150_000)
|
|
469
|
+
.describe(
|
|
470
|
+
"How large a home conversation's context may grow, in tokens, before its next message starts a fresh session: a summary and its latest messages instead of the whole conversation re-read on every call. Half of it is enough once the prompt cache has gone cold, since re-reading then costs a full write anyway. The chat keeps every message; only what the model reads starts over. Zero never starts one by itself.",
|
|
471
|
+
),
|
|
459
472
|
// Off by default: every refresh spends the account's own allowance on a conversation nobody is using yet. Before
|
|
460
473
|
// 2026-09-26 these were four top-level settings (settings-history.ts folds them).
|
|
461
474
|
keepWarm: KeepWarmSettingsSchema.prefault({}).describe(
|
package/src/schemas/shared.ts
CHANGED
|
@@ -18,7 +18,7 @@ export type MemberRole = z.infer<typeof MemberRoleSchema>;
|
|
|
18
18
|
export const GrantedRoleSchema = zEnum(["guest", "viewer", "collaborator", "writer", "maintainer"]);
|
|
19
19
|
export type GrantedRole = z.infer<typeof GrantedRoleSchema>;
|
|
20
20
|
// Single source for role order; every surface that gates on a role reads this ranking. A guest is below every
|
|
21
|
-
// floor: its routes are an allowlist of its own (
|
|
21
|
+
// floor: its routes are an allowlist of its own (protocol/member-reach.ts guestReach), never a floor it can clear.
|
|
22
22
|
const MEMBER_ROLE_RANK: Record<MemberRole, number> = { guest: 0, viewer: 1, collaborator: 2, writer: 3, maintainer: 4, owner: 5 };
|
|
23
23
|
export const roleAtLeast = (role: MemberRole, floor: MemberRole): boolean => MEMBER_ROLE_RANK[role] >= MEMBER_ROLE_RANK[floor];
|
|
24
24
|
// Rotating a door credential (event webhook, release gate, bug intake): the old value stops working immediately; the
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { PersonaPowersSchema } from "./personas.js";
|
|
2
|
+
import { capPowers, ceilingLimits, ceilingWithholds, ceilingWords, intersectCeilings } from "./tool-ceiling.js";
|
|
3
|
+
|
|
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
|
+
|
|
6
|
+
const FULL = PersonaPowersSchema.parse({});
|
|
7
|
+
|
|
8
|
+
describe(`intersectCeilings`, () => {
|
|
9
|
+
it(`keeps the lower answer of each shelf`, () => {
|
|
10
|
+
expect(intersectCeilings({ files: `read`, shell: false }, { files: `none`, web: false })).toEqual({ files: `none`, shell: false, web: false });
|
|
11
|
+
expect(intersectCeilings({ files: `write` }, { files: `read` })).toEqual({ files: `read` });
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it(`reads undefined as no ceiling at all`, () => {
|
|
15
|
+
expect(intersectCeilings(undefined, { shell: false })).toEqual({ shell: false });
|
|
16
|
+
expect(intersectCeilings({ code: false }, undefined)).toEqual({ code: false });
|
|
17
|
+
expect(intersectCeilings(undefined, undefined)).toBeUndefined();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it(`drops a shelf both answer true, since true is no limit`, () => {
|
|
21
|
+
expect(intersectCeilings({ shell: true }, { shell: true })).toEqual({});
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
describe(`capPowers`, () => {
|
|
26
|
+
it(`lowers a persona's shelves to the ceiling and keeps its connector lists`, () => {
|
|
27
|
+
const powers = { ...FULL, connectors: [`github`] };
|
|
28
|
+
expect(capPowers(powers, { files: `read`, shell: false, delegate: false })).toEqual({
|
|
29
|
+
...powers,
|
|
30
|
+
files: `read`,
|
|
31
|
+
shell: false,
|
|
32
|
+
delegate: false,
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it(`never raises a shelf the persona switched off`, () => {
|
|
37
|
+
const readOnly = { ...FULL, files: `read` as const, shell: false };
|
|
38
|
+
expect(capPowers(readOnly, { files: `write`, shell: true })).toEqual(readOnly);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it(`returns the persona's own shelves when the ceiling limits nothing`, () => {
|
|
42
|
+
expect(capPowers(FULL, undefined)).toBe(FULL);
|
|
43
|
+
expect(capPowers(FULL, { files: `write`, web: true })).toBe(FULL);
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
describe(`ceilingLimits and ceilingWithholds`, () => {
|
|
48
|
+
it(`counts only an answer below the top as a limit`, () => {
|
|
49
|
+
expect(ceilingLimits(undefined)).toBe(false);
|
|
50
|
+
expect(ceilingLimits({ files: `write`, shell: true })).toBe(false);
|
|
51
|
+
expect(ceilingLimits({ files: `read` })).toBe(true);
|
|
52
|
+
expect(ceilingLimits({ browser: false })).toBe(true);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it(`withholds files below write, and a switch answered false`, () => {
|
|
56
|
+
expect(ceilingWithholds({ files: `read` }, `files`)).toBe(true);
|
|
57
|
+
expect(ceilingWithholds({ files: `write` }, `files`)).toBe(false);
|
|
58
|
+
expect(ceilingWithholds({ shell: false }, `shell`)).toBe(true);
|
|
59
|
+
expect(ceilingWithholds({ shell: false }, `web`)).toBe(false);
|
|
60
|
+
expect(ceilingWithholds(undefined, `shell`)).toBe(false);
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
describe(`ceilingWords`, () => {
|
|
65
|
+
it(`names each limit in the order the shelves are listed`, () => {
|
|
66
|
+
expect(ceilingWords({ files: `read`, shell: false, sandbox: false })).toEqual([`read-only files`, `no commands`, `no sandbox settings`]);
|
|
67
|
+
expect(ceilingWords({ files: `none` })).toEqual([`no files`]);
|
|
68
|
+
expect(ceilingWords(undefined)).toEqual([]);
|
|
69
|
+
});
|
|
70
|
+
});
|