@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
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
NeedIdParamSchema,
|
|
7
7
|
NeedRaisedSchema,
|
|
8
8
|
NeedRaiseSchema,
|
|
9
|
+
NeedReleaseInputSchema,
|
|
9
10
|
NeedSchema,
|
|
10
11
|
NeedSecretInputSchema,
|
|
11
12
|
NeedsListSchema,
|
|
@@ -19,6 +20,9 @@ import {
|
|
|
19
20
|
|
|
20
21
|
const agentDoor = procedure.meta({ agent: true, control: "never" });
|
|
21
22
|
const answerRoute = procedure.meta({ floor: "maintainer", control: "never" });
|
|
23
|
+
// A release is the one need its gate answers rather than the tier: the owner names its approvers from the whole roster
|
|
24
|
+
// (secrets.routes.ts `releasableBy`), so any member may reach the route, and the need admits exactly the people it names.
|
|
25
|
+
const releaseRoute = procedure.meta({ floor: "viewer", control: "never" });
|
|
22
26
|
|
|
23
27
|
export const needsContract = {
|
|
24
28
|
ask: agentDoor
|
|
@@ -69,6 +73,16 @@ export const needsContract = {
|
|
|
69
73
|
})
|
|
70
74
|
.input(NeedAnswerInputSchema)
|
|
71
75
|
.output(NeedSchema),
|
|
76
|
+
release: releaseRoute
|
|
77
|
+
.route({
|
|
78
|
+
method: "POST",
|
|
79
|
+
path: "/needs/{id}/release",
|
|
80
|
+
summary: "Release a gated credential, or decline",
|
|
81
|
+
description:
|
|
82
|
+
"A release need's answer, from one of the approvers its gate names, whatever their tier: release the credential to the conversation that asked, or decline. Any other need is answered through /needs/{id}/answer.",
|
|
83
|
+
})
|
|
84
|
+
.input(NeedReleaseInputSchema)
|
|
85
|
+
.output(NeedSchema),
|
|
72
86
|
provideSecret: answerRoute
|
|
73
87
|
.route({
|
|
74
88
|
method: "POST",
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { procedure } from "../protocol/route-meta.js";
|
|
2
|
+
import { OkSchema } from "../schemas/shared.js";
|
|
3
|
+
import { ServiceIdParamSchema, ServiceSchema, ServicesListSchema } from "../schemas/services.js";
|
|
4
|
+
|
|
5
|
+
// Services (ServiceSchema): who unattended work acts as. A maintainer writes automations, so a maintainer may name who
|
|
6
|
+
// they run as; what a service reaches is still never more than its steward may, whoever wrote it.
|
|
7
|
+
export const servicesContract = {
|
|
8
|
+
list: procedure
|
|
9
|
+
.route({
|
|
10
|
+
method: "GET",
|
|
11
|
+
path: "/access/services",
|
|
12
|
+
summary: "The services unattended work runs as",
|
|
13
|
+
description: "Every service: who it acts for, and the access profile its runs are held to.",
|
|
14
|
+
})
|
|
15
|
+
.meta({ floor: "maintainer" })
|
|
16
|
+
.output(ServicesListSchema),
|
|
17
|
+
// Upsert by id, re-saving the same id edits that service.
|
|
18
|
+
save: procedure
|
|
19
|
+
.route({
|
|
20
|
+
method: "POST",
|
|
21
|
+
path: "/access/services",
|
|
22
|
+
summary: "Create or edit a service",
|
|
23
|
+
description:
|
|
24
|
+
"Writes the whole service; sending an id that exists edits it. Its steward must be the owner or someone on the roster, and its profile one this sandbox has. Every automation, link and token running as it changes with it from their next turn.",
|
|
25
|
+
})
|
|
26
|
+
.input(ServiceSchema)
|
|
27
|
+
.output(OkSchema),
|
|
28
|
+
// Refused while anything still runs as it: an automation naming a service that is gone is skipped with that reason,
|
|
29
|
+
// which is a quiet failure nobody chose.
|
|
30
|
+
remove: procedure
|
|
31
|
+
.route({
|
|
32
|
+
method: "DELETE",
|
|
33
|
+
path: "/access/services/{id}",
|
|
34
|
+
summary: "Delete a service",
|
|
35
|
+
description:
|
|
36
|
+
"Removes the service. Refused while an automation, a sender rule, an inbound link or a control token still runs as it; point them elsewhere first.",
|
|
37
|
+
})
|
|
38
|
+
.input(ServiceIdParamSchema)
|
|
39
|
+
.output(OkSchema),
|
|
40
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { procedure } from "../protocol/route-meta.js";
|
|
2
|
+
import { streamOf } from "../protocol/stream-of.js";
|
|
2
3
|
import { WorkspaceHealthQuerySchema, WorkspaceHealthSchema } from "../schemas/codebase-health.js";
|
|
3
4
|
import { WorkspaceModulesSchema } from "../schemas/git/git.js";
|
|
4
5
|
import { OkSchema } from "../schemas/shared.js";
|
|
@@ -16,7 +17,7 @@ import {
|
|
|
16
17
|
WorkspaceSyncSchema,
|
|
17
18
|
} from "../schemas/workspace/workspace-repos.js";
|
|
18
19
|
import { PackageModulesParamSchema, PackageModulesSchema, WorkspaceGraphSchema } from "../schemas/workspace/workspace-graph.js";
|
|
19
|
-
import { WorkspaceSearchQuerySchema, WorkspaceSearchResultSchema } from "../schemas/workspace/workspace-search.js";
|
|
20
|
+
import { WorkspaceSearchFrameSchema, WorkspaceSearchQuerySchema, WorkspaceSearchResultSchema } from "../schemas/workspace/workspace-search.js";
|
|
20
21
|
import { WorkspaceInstallResultSchema, WorkspaceInstallSchema, WorkspaceSetupSchema } from "../schemas/workspace/workspace-setup.js";
|
|
21
22
|
import {
|
|
22
23
|
WorkspaceChildrenQuerySchema,
|
|
@@ -189,6 +190,19 @@ export const workspaceContract = {
|
|
|
189
190
|
.meta({ guest: true, control: "editor" })
|
|
190
191
|
.input(WorkspaceSearchQuerySchema)
|
|
191
192
|
.output(WorkspaceSearchResultSchema),
|
|
193
|
+
// Text search only (`mode` find): the same first page, with the files found streamed ahead of it.
|
|
194
|
+
searchStream: procedure
|
|
195
|
+
.route({
|
|
196
|
+
method: "POST",
|
|
197
|
+
path: "/workspace/search/stream",
|
|
198
|
+
summary: "Search the text, watching it as it goes",
|
|
199
|
+
description:
|
|
200
|
+
"The plain-text search a search box runs, streamed: every file with a match is sent as soon as it is found, then the first page of the finished answer, exactly as the search route would have given it, with the cursor for the rest. Matches show while a search over a large tree is still reading it.",
|
|
201
|
+
})
|
|
202
|
+
// A read, POST only because it streams; held open for as long as the search runs.
|
|
203
|
+
.meta({ floor: "viewer", guest: true, stream: true, control: "editor" })
|
|
204
|
+
.input(WorkspaceSearchQuerySchema)
|
|
205
|
+
.output(streamOf(WorkspaceSearchFrameSchema)),
|
|
192
206
|
// Per-file churn × complexity, index totals, top modules; scoped to a repo, not the whole /work drop.
|
|
193
207
|
health: procedure
|
|
194
208
|
.route({
|
|
@@ -11,7 +11,7 @@ import { AgentReplySchema, UsageWindowSchema } from "../schemas/providers/plan-l
|
|
|
11
11
|
import { PrivacyBypassSchema } from "../schemas/privacy-egress.js";
|
|
12
12
|
import { SubagentKindSchema, SubagentSdkRecordSchema, SubagentStatusSchema, SubagentVerificationSchema } from "../schemas/terminal.js";
|
|
13
13
|
import { RetryLadderSchema } from "../schemas/turn-break.js";
|
|
14
|
-
import { HandedOffSchema, HandoffOfferSchema } from "../schemas/providers/handoff.js";
|
|
14
|
+
import { FreshStartSchema, HandedOffSchema, HandoffOfferSchema } from "../schemas/providers/handoff.js";
|
|
15
15
|
import { AgentCommandSchema, browserHelpRequest, capabilityOfferRequest, CapabilityOutcomeSchema, ContextUsageSchema, credentialOfferRequest, CredentialReceiptSchema, pageAskRequest, PageSchema, paymentOfferRequest, PaymentReceiptSchema, PermissionRequestSchema, PlanRequestSchema, QuestionRequestSchema, terminalHelpRequest, TodoItemSchema, ToolCallContentSchema, ToolCallLocationSchema, ToolCallStatusSchema, ToolKindSchema } from "./requests.js";
|
|
16
16
|
import { TranscriptPatchSchema, TranscriptRowSchema, TurnNoteSchema } from "./transcript.js";
|
|
17
17
|
import { ReviewFindingsSchema } from "./review.js";
|
|
@@ -137,6 +137,8 @@ export const AgentEventSchema = z.discriminatedUnion("kind", [
|
|
|
137
137
|
held: z.boolean().optional(),
|
|
138
138
|
deps: z.object({ missing: z.number(), started: z.array(z.string()), deferred: z.boolean() }).optional(),
|
|
139
139
|
into: z.string().optional(),
|
|
140
|
+
// This land's own id, which a home conversation's card files the commit it made under (AgentSummary.commits).
|
|
141
|
+
land: z.string().optional(),
|
|
140
142
|
}),
|
|
141
143
|
// Notes the daemon prepends to the user's message before the model reads it, verbatim, one per note. Serialized
|
|
142
144
|
// from the same typed notes the wire prompt uses, so disclosure cannot drift from what the model got.
|
|
@@ -146,6 +148,8 @@ export const AgentEventSchema = z.discriminatedUnion("kind", [
|
|
|
146
148
|
ContextTrimSchema.extend({ kind: z.literal("context_trim") }),
|
|
147
149
|
// How a turn a spent allowance held continued the conversation: the whole session, a trimmed copy, or a summary.
|
|
148
150
|
HandedOffSchema.extend({ kind: z.literal("handoff") }),
|
|
151
|
+
// A home conversation going on in a fresh session rather than re-reading the whole of its old one (handoff.ts).
|
|
152
|
+
FreshStartSchema.extend({ kind: z.literal("fresh_start") }),
|
|
149
153
|
// The SDK's init handshake; carries the model it actually resolved for the turn.
|
|
150
154
|
// `prompt` names the parts the cache is keyed on, so a later turn can say which of them changed.
|
|
151
155
|
z.object({ kind: z.literal("init"), model: z.string(), prompt: PromptFingerprintSchema.optional() }),
|
|
@@ -184,6 +188,8 @@ export const AgentEventSchema = z.discriminatedUnion("kind", [
|
|
|
184
188
|
content: z.array(ToolCallContentSchema).optional(),
|
|
185
189
|
// The call's input as bounded JSON text, for a call with no one-line `target` (TranscriptTool.input).
|
|
186
190
|
input: z.string().optional(),
|
|
191
|
+
// The MCP server the call went to (TranscriptTool.server), which its display name does not say.
|
|
192
|
+
server: z.string().optional(),
|
|
187
193
|
parentToolUseId: z.string().optional(),
|
|
188
194
|
}),
|
|
189
195
|
// A later state of a call, correlated by `id`. Status and/or fresh content/locations REPLACE the prior value
|
|
@@ -196,6 +202,10 @@ export const AgentEventSchema = z.discriminatedUnion("kind", [
|
|
|
196
202
|
locations: z.array(ToolCallLocationSchema).optional(),
|
|
197
203
|
// A command's exit code, from a runtime that reports it as a number (TranscriptTool.exitCode).
|
|
198
204
|
exitCode: z.number().int().optional(),
|
|
205
|
+
// The call's input where the runtime only sends it after the card opened (an ACP agent's rawInput on an update),
|
|
206
|
+
// kept by a card that has neither target nor input yet. Until 2026-10-27 it was dropped: 57% of Devin's tool
|
|
207
|
+
// cards since 10-23 had no input at all.
|
|
208
|
+
input: z.string().optional(),
|
|
199
209
|
}),
|
|
200
210
|
// The agent started running Bash in its live `agent-<id>` tmux session; one per turn, reused across all of a turn's
|
|
201
211
|
// commands including subagents'.
|
|
@@ -64,7 +64,11 @@ export const SandboxNoticeSchema = z.discriminatedUnion("code", [
|
|
|
64
64
|
z.object({ code: z.literal("landHeld") }),
|
|
65
65
|
z.object({ code: z.literal("landConflict"), params: z.object({ files: count, repos: z.string() }) }),
|
|
66
66
|
// `deps` dependencies the turn added or changed, installing now, or `queued` behind any other install.
|
|
67
|
-
|
|
67
|
+
// `land` names this land, which a home conversation's card files its commit under (AgentSummary.commits).
|
|
68
|
+
z.object({
|
|
69
|
+
code: z.literal("landed"),
|
|
70
|
+
params: z.object({ deps: count.optional(), queued: z.boolean().optional(), land: z.string().optional() }).optional(),
|
|
71
|
+
}),
|
|
68
72
|
z.object({ code: z.literal("retrying"), params: z.object({ ...failure, attempt: count, of: count }) }),
|
|
69
73
|
z.object({ code: z.literal("retried"), params: z.object({ ...failure, made: count, of: count }) }),
|
|
70
74
|
z.object({ code: z.literal("outageWaiting"), params: z.object(failure) }),
|
|
@@ -108,6 +112,18 @@ export const SandboxNoticeSchema = z.discriminatedUnion("code", [
|
|
|
108
112
|
fellBack: z.boolean().optional(),
|
|
109
113
|
}),
|
|
110
114
|
}),
|
|
115
|
+
// A home conversation going on in a fresh session (schemas/providers/handoff.ts FreshStartSchema): `why` it did,
|
|
116
|
+
// `from` the context the old session had grown to (worded, "182k"), `model` the one that wrote its summary, and
|
|
117
|
+
// `summarized` false where it opened with the recent conversation alone.
|
|
118
|
+
z.object({
|
|
119
|
+
code: z.literal("freshStart"),
|
|
120
|
+
params: z.object({
|
|
121
|
+
why: z.enum(["budget", "cold", "asked", "cleared"]),
|
|
122
|
+
from: z.string().optional(),
|
|
123
|
+
model: z.string().optional(),
|
|
124
|
+
summarized: z.boolean(),
|
|
125
|
+
}),
|
|
126
|
+
}),
|
|
111
127
|
// An agent's own dependency install starting: into its conversation's own copy (`ownCopy`) or the main tree; the
|
|
112
128
|
// workspace root (`root`) and up to three project folders named (`projects`, each with its slash, already joined),
|
|
113
129
|
// and how many `more` were not named.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { AgentEvent } from "./agent-events.js";
|
|
2
|
+
import type { TranscriptTool } from "./transcript.js";
|
|
3
|
+
|
|
4
|
+
// The fields a tool_call_update sets on its card by plain replacement (transcript-fold.ts keeps the status and the
|
|
5
|
+
// content, which each move something else too), and the input a card that still has neither target nor input takes:
|
|
6
|
+
// an ACP agent (Devin) sends a call's arguments only on its updates, and until 2026-10-27 57% of its cards since 10-23
|
|
7
|
+
// were left with none.
|
|
8
|
+
export const takeToolUpdate = (tool: TranscriptTool, event: Extract<AgentEvent, { kind: "tool_call_update" }>): void => {
|
|
9
|
+
if (event.exitCode !== undefined) {
|
|
10
|
+
tool.exitCode = event.exitCode;
|
|
11
|
+
}
|
|
12
|
+
if (event.locations !== undefined) {
|
|
13
|
+
tool.locations = event.locations;
|
|
14
|
+
}
|
|
15
|
+
if (event.input !== undefined && tool.target === undefined && tool.input === undefined) {
|
|
16
|
+
tool.input = event.input;
|
|
17
|
+
}
|
|
18
|
+
};
|
package/src/events/transcript.ts
CHANGED
|
@@ -141,6 +141,10 @@ export const TranscriptToolSchema: z.ZodType<TranscriptTool> = z.lazy(() =>
|
|
|
141
141
|
.describe(
|
|
142
142
|
"What the call was given, as JSON text cut to a few kilobytes, on a call whose input names no one-line target: an MCP tool's arguments, a delegation's prompt. Read afterwards to learn what was asked when the card alone cannot say.",
|
|
143
143
|
),
|
|
144
|
+
server: z
|
|
145
|
+
.string()
|
|
146
|
+
.optional()
|
|
147
|
+
.describe("The MCP server the call went to, where its name does not say: `web`'s browser, an account's `browser` server and a device all show as Browser calls."),
|
|
144
148
|
startedAt: z.number().optional().describe("When the call was seen, in milliseconds. Absent on calls recorded before cards were stamped."),
|
|
145
149
|
endedAt: z
|
|
146
150
|
.number()
|
|
@@ -193,6 +197,7 @@ export interface TranscriptTool {
|
|
|
193
197
|
thinking?: string | undefined;
|
|
194
198
|
subagent?: TranscriptSubagent | undefined;
|
|
195
199
|
input?: string | undefined;
|
|
200
|
+
server?: string | undefined;
|
|
196
201
|
startedAt?: number | undefined;
|
|
197
202
|
endedAt?: number | undefined;
|
|
198
203
|
exitCode?: number | undefined;
|
package/src/index.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { RAW_JSON_ROUTES } from "./protocol/raw/raw-json-routes.js";
|
|
|
4
4
|
import { RAW_ROUTE_LIST } from "./protocol/raw/raw-routes.js";
|
|
5
5
|
import type { ContractRoute } from "./protocol/routes.js";
|
|
6
6
|
import { contractRoutes, rawRouteFingerprintsOf, requestPathFor, routeForProcedure, routeNameForRequest, routeShapes, servedRoute } from "./protocol/routes.js";
|
|
7
|
+
import { accessProfilesContract } from "./contracts/access-profiles.contract.js";
|
|
7
8
|
import { accountsContract } from "./contracts/accounts.contract.js";
|
|
8
9
|
import { activityContract } from "./contracts/activity.contract.js";
|
|
9
10
|
import { agentContract } from "./contracts/agent.contract.js";
|
|
@@ -42,6 +43,7 @@ import { pushContract } from "./contracts/push.contract.js";
|
|
|
42
43
|
import { runsContract } from "./contracts/runs.contract.js";
|
|
43
44
|
import { safetyContract } from "./contracts/safety.contract.js";
|
|
44
45
|
import { secretsContract } from "./contracts/secrets.contract.js";
|
|
46
|
+
import { servicesContract } from "./contracts/services.contract.js";
|
|
45
47
|
import { sessionsContract } from "./contracts/sessions.contract.js";
|
|
46
48
|
import { settingsContract } from "./contracts/settings.contract.js";
|
|
47
49
|
import { shareContract } from "./contracts/share.contract.js";
|
|
@@ -59,6 +61,7 @@ export { HISTORY_ROOT, HOST_STATE_ROOT, STATE_DIR, WORKSPACE_ROOT } from "@inten
|
|
|
59
61
|
// The aggregated contract; implemented server-side by per-domain route factories, consumed by the browser's typed oRPC
|
|
60
62
|
// client. Mounted at the sandbox root, alongside plain Hono routes like /health and /workspace/raw.
|
|
61
63
|
export const sandboxContract = {
|
|
64
|
+
accessProfiles: accessProfilesContract,
|
|
62
65
|
accounts: accountsContract,
|
|
63
66
|
activity: activityContract,
|
|
64
67
|
agent: agentContract,
|
|
@@ -97,6 +100,7 @@ export const sandboxContract = {
|
|
|
97
100
|
runs: runsContract,
|
|
98
101
|
safety: safetyContract,
|
|
99
102
|
secrets: secretsContract,
|
|
103
|
+
services: servicesContract,
|
|
100
104
|
sessions: sessionsContract,
|
|
101
105
|
settings: settingsContract,
|
|
102
106
|
share: shareContract,
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
// WHICH DEVICE TOOLS CARRY A DEADLINE OF THEIR OWN (2026-10-27). A post-mortem of 739k agent tool calls found 48 device
|
|
4
|
+
// calls cut at exactly 60.0 s with "The operation timed out.": the agent's MCP client gave up at its own default minute
|
|
5
|
+
// while `run_command`'s schema promised 120 s by default and 600 s at most, and the command ran on with nobody waiting.
|
|
6
|
+
// The machine (which enforces these) and the daemon (which sizes the bridge's wait on each call from them) read this one
|
|
7
|
+
// table, so a call's transport deadline follows the deadline the call itself asked for.
|
|
8
|
+
|
|
9
|
+
/** What passing a call's own deadline ends on the device. */
|
|
10
|
+
export type DeadlineEnds =
|
|
11
|
+
// The command, together with everything it started (run_command, android_shell).
|
|
12
|
+
| "command"
|
|
13
|
+
// Only the wait: the program being watched (app_status, app_logs with waitFor or untilExit) runs on.
|
|
14
|
+
| "wait";
|
|
15
|
+
|
|
16
|
+
// The arguments a deadline is read from. One of the wrong type reads as absent rather than failing the parse: such a
|
|
17
|
+
// call never runs, since the device checks its input against its own schema before anything else.
|
|
18
|
+
export const DeadlineArgumentsSchema = z.looseObject({
|
|
19
|
+
timeoutMs: z.number().positive().optional().catch(undefined),
|
|
20
|
+
waitFor: z.string().optional().catch(undefined),
|
|
21
|
+
untilExit: z.boolean().optional().catch(undefined),
|
|
22
|
+
});
|
|
23
|
+
export type DeadlineArguments = z.infer<typeof DeadlineArgumentsSchema>;
|
|
24
|
+
|
|
25
|
+
export interface OwnDeadline {
|
|
26
|
+
readonly defaultMs: number;
|
|
27
|
+
readonly maxMs: number;
|
|
28
|
+
readonly ends: DeadlineEnds;
|
|
29
|
+
/** Whether a call with these arguments waits at all; absent means it always does. */
|
|
30
|
+
readonly applies?: (args: DeadlineArguments) => boolean;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// A wait is asked for, never assumed: app_status and app_logs without one answer at once.
|
|
34
|
+
const appWait: OwnDeadline = {
|
|
35
|
+
defaultMs: 60_000,
|
|
36
|
+
maxMs: 10 * 60_000,
|
|
37
|
+
ends: "wait",
|
|
38
|
+
applies: (args) => args.waitFor !== undefined || args.untilExit === true,
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/** The device tools whose `timeoutMs` argument bounds them, by tool name. */
|
|
42
|
+
export const DEVICE_OWN_DEADLINES = {
|
|
43
|
+
// Long enough for an install or a test run, short of the hub's 15-minute ceiling.
|
|
44
|
+
run_command: { defaultMs: 120_000, maxMs: 10 * 60_000, ends: "command" },
|
|
45
|
+
android_shell: { defaultMs: 60_000, maxMs: 10 * 60_000, ends: "command" },
|
|
46
|
+
app_status: appWait,
|
|
47
|
+
app_logs: appWait,
|
|
48
|
+
} as const satisfies Readonly<Record<string, OwnDeadline>>;
|
|
49
|
+
|
|
50
|
+
const BY_TOOL = new Map<string, OwnDeadline>(Object.entries(DEVICE_OWN_DEADLINES));
|
|
51
|
+
|
|
52
|
+
/** The longest any device tool's own deadline can be asked to run. */
|
|
53
|
+
export const LONGEST_OWN_DEADLINE_MS = Math.max(...[...BY_TOOL.values()].map((own) => own.maxMs));
|
|
54
|
+
|
|
55
|
+
/** The deadline one call runs under on the device: its own `timeoutMs`, else the tool's default, never past the maximum. */
|
|
56
|
+
export const ownDeadlineOf = (tool: string, args: DeadlineArguments): { readonly ms: number; readonly ends: DeadlineEnds } | undefined => {
|
|
57
|
+
const own = BY_TOOL.get(tool);
|
|
58
|
+
if (own === undefined || own.applies?.(args) === false) {
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
return { ms: Math.min(args.timeoutMs ?? own.defaultMs, own.maxMs), ends: own.ends };
|
|
62
|
+
};
|
|
@@ -24,8 +24,8 @@ interface ModelRoleRow {
|
|
|
24
24
|
readonly kind: ModelRoleKind;
|
|
25
25
|
// Icon name from the shared icon set; kept here, not in a separate web-side map keyed by id.
|
|
26
26
|
readonly icon: string;
|
|
27
|
-
// The preset
|
|
28
|
-
//
|
|
27
|
+
// The default preset for this job in a fresh sandbox, also offered when placing it again:
|
|
28
|
+
// what the work needs, not what it costs today.
|
|
29
29
|
readonly setup: PresetSetup;
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -7,10 +7,9 @@ import { MODEL_ROLE_IDS, MODEL_ROLES, type ModelRole, PRESET_SETUPS, type Preset
|
|
|
7
7
|
|
|
8
8
|
// A setup is a named, ordered list of models that any number of jobs run on: edited once, used by every job put there.
|
|
9
9
|
// Every sandbox has three, Low, Medium and High, worked out from the accounts it has connected until the owner edits
|
|
10
|
-
// one; the owner adds any others.
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
// the settings page shows what will run.
|
|
10
|
+
// one; the owner adds any others. New settings place every job on its catalog preset (model-roles.ts `setup`).
|
|
11
|
+
// Saved assignments stay as written: a job left out runs on nothing. Every reader resolves a job through here,
|
|
12
|
+
// daemon and browser alike, so the settings page shows what will run.
|
|
14
13
|
|
|
15
14
|
export const MODEL_SETUP_ID = /^[a-z0-9][a-z0-9-]{0,39}$/;
|
|
16
15
|
|
|
@@ -49,6 +49,8 @@ export const ControlTokenSummarySchema = z.object({
|
|
|
49
49
|
expiresAt: z.number().optional(),
|
|
50
50
|
// Epoch ms of the last authorized request, coarse on purpose; absent means never used.
|
|
51
51
|
lastUsedAt: z.number().optional(),
|
|
52
|
+
// The service (schemas/services.ts) the conversations it starts act as; absent, they act for the owner, unlimited.
|
|
53
|
+
runAs: z.string().optional(),
|
|
52
54
|
});
|
|
53
55
|
export type ControlTokenSummary = z.infer<typeof ControlTokenSummarySchema>;
|
|
54
56
|
export const ControlTokensListSchema = z.object({ tokens: z.array(ControlTokenSummarySchema) });
|
|
@@ -58,6 +60,9 @@ export const ControlTokenMintSchema = z.object({
|
|
|
58
60
|
scope: ControlScopeSchema,
|
|
59
61
|
label: z.string().optional(),
|
|
60
62
|
expiresAt: z.number().optional(),
|
|
63
|
+
// Who the turns it starts act for: a service's steward, held to its profile. Absent keeps a program acting for the
|
|
64
|
+
// owner, as every token did before services existed.
|
|
65
|
+
runAs: z.string().min(1).max(60).optional(),
|
|
61
66
|
});
|
|
62
67
|
export type ControlTokenMint = z.infer<typeof ControlTokenMintSchema>;
|
|
63
68
|
// The raw token, shown exactly once.
|
package/src/policy/org-locks.ts
CHANGED
|
@@ -78,8 +78,11 @@ export const ORG_SECTION_ROUTES = {
|
|
|
78
78
|
"extensions.devReload",
|
|
79
79
|
],
|
|
80
80
|
},
|
|
81
|
-
// Leaving (`DELETE /members/self`) stays open: nobody can be held in a sandbox by a policy.
|
|
82
|
-
|
|
81
|
+
// Leaving (`DELETE /members/self`) stays open: nobody can be held in a sandbox by a policy. Profiles and services
|
|
82
|
+
// decide what people and unattended work may reach, so they are Access's too (docs/architecture/access.md).
|
|
83
|
+
access: {
|
|
84
|
+
changes: ["POST /members", "DELETE /members", "accessProfiles.save", "accessProfiles.remove", "services.save", "services.remove"],
|
|
85
|
+
},
|
|
83
86
|
areas: { changes: ["areas.save", "areas.remove"] },
|
|
84
87
|
personas: { changes: ["personas.save", "personas.remove", "personas.savePrompt", "personas.saveSkill", "personas.removeSkill"] },
|
|
85
88
|
updates: { changes: ["system.autoUpdate", "system.skipUpdate"] },
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { ATTACHMENTS_DIR } from "../state/workspace-state.js";
|
|
2
|
+
import { guestReach, memberRefusal, routeFloor } from "./member-reach.js";
|
|
3
|
+
|
|
4
|
+
describe("routeFloor", () => {
|
|
5
|
+
test("reads floor at viewer: fleet, transcripts, workspace files, git log", () => {
|
|
6
|
+
expect(routeFloor("GET", "/agents")).toBe("viewer");
|
|
7
|
+
expect(routeFloor("GET", "/agents/abc/transcript")).toBe("viewer");
|
|
8
|
+
expect(routeFloor("GET", "/workspace/file")).toBe("viewer");
|
|
9
|
+
expect(routeFloor("GET", "/events")).toBe("viewer");
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
test("watching and being present are viewer despite being POSTs", () => {
|
|
13
|
+
expect(routeFloor("POST", "/agent/attach")).toBe("viewer");
|
|
14
|
+
expect(routeFloor("POST", "/system/session")).toBe("viewer");
|
|
15
|
+
expect(routeFloor("POST", "/system/presence")).toBe("viewer");
|
|
16
|
+
expect(routeFloor("POST", "/workspace/media-ticket")).toBe("viewer");
|
|
17
|
+
expect(routeFloor("DELETE", "/members/self")).toBe("viewer");
|
|
18
|
+
// One's own passkeys are identity, like staying signed in; the handler holds another member's to the owner.
|
|
19
|
+
expect(routeFloor("GET", "/system/passkeys")).toBe("viewer");
|
|
20
|
+
expect(routeFloor("POST", "/system/passkeys/register/options")).toBe("viewer");
|
|
21
|
+
expect(routeFloor("POST", "/system/passkeys/register")).toBe("viewer");
|
|
22
|
+
expect(routeFloor("DELETE", "/system/passkeys/abc_123")).toBe("viewer");
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test("driving agents is the collaborator tier", () => {
|
|
26
|
+
expect(routeFloor("POST", "/agent")).toBe("collaborator");
|
|
27
|
+
expect(routeFloor("POST", "/agent/steer")).toBe("collaborator");
|
|
28
|
+
expect(routeFloor("POST", "/agents/abc/rename")).toBe("collaborator");
|
|
29
|
+
expect(routeFloor("POST", "/agents/abc/request-land")).toBe("collaborator");
|
|
30
|
+
expect(routeFloor("POST", "/agents/abc/assign")).toBe("collaborator");
|
|
31
|
+
// Resuming is the same turn again, so it belongs to whoever may start one; arming auto-land does not.
|
|
32
|
+
expect(routeFloor("POST", "/agent/resume")).toBe("collaborator");
|
|
33
|
+
expect(routeFloor("POST", "/agents/abc/break-policy")).toBe("collaborator");
|
|
34
|
+
expect(routeFloor("POST", "/agents/abc/auto-land")).toBe("maintainer");
|
|
35
|
+
// An attachment is part of the message it travels with, so the upload route answers at this tier for
|
|
36
|
+
// the address attachments land at — and only for that one (the workspace write below).
|
|
37
|
+
expect(routeFloor("POST", "/workspace/upload", `${ATTACHMENTS_DIR}/u1/shot.png`)).toBe("collaborator");
|
|
38
|
+
expect(routeFloor("POST", "/system/ws-ticket")).toBe("collaborator");
|
|
39
|
+
expect(routeFloor("POST", "/system/sync/pair")).toBe("collaborator");
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
test("changing files in the shared tree is the writer tier", () => {
|
|
43
|
+
expect(routeFloor("POST", "/workspace/dir")).toBe("writer");
|
|
44
|
+
expect(routeFloor("DELETE", "/workspace/entry")).toBe("writer");
|
|
45
|
+
expect(routeFloor("POST", "/workspace/move")).toBe("writer");
|
|
46
|
+
expect(routeFloor("POST", "/workspace/copy")).toBe("writer");
|
|
47
|
+
expect(routeFloor("POST", "/workspace/extract")).toBe("writer");
|
|
48
|
+
// Writing bytes into the shared tree is that same edit, whichever door it uses: the upload route only
|
|
49
|
+
// drops to collaborator for an attachment address, so a plain file, a missing target, and a path that
|
|
50
|
+
// climbs back out of the attachments dir all land here with move and delete. Where in the tree any of
|
|
51
|
+
// them may land is the fence's answer, not this one (areas/area-fence.integration.test.ts).
|
|
52
|
+
expect(routeFloor("POST", "/workspace/upload", "app/main.ts")).toBe("writer");
|
|
53
|
+
expect(routeFloor("POST", "/workspace/upload")).toBe("writer");
|
|
54
|
+
expect(routeFloor("POST", "/workspace/upload", `${ATTACHMENTS_DIR}/u1/../../../../config/hooks/lint.mjs`)).toBe("writer");
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
test("what leaves the sandbox floors at maintainer: land, discard, approvals", () => {
|
|
58
|
+
expect(routeFloor("POST", "/agents/abc/land")).toBe("maintainer");
|
|
59
|
+
expect(routeFloor("POST", "/agents/abc/discard")).toBe("maintainer");
|
|
60
|
+
expect(routeFloor("POST", "/approvals")).toBe("maintainer");
|
|
61
|
+
expect(routeFloor("DELETE", "/approvals/d1")).toBe("maintainer");
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
test("operating the tree is not editing it, and stays at maintainer", () => {
|
|
65
|
+
expect(routeFloor("POST", "/workspace/setup")).toBe("maintainer");
|
|
66
|
+
expect(routeFloor("POST", "/workspace/setup/install")).toBe("maintainer");
|
|
67
|
+
expect(routeFloor("POST", "/workspace/repos")).toBe("maintainer");
|
|
68
|
+
expect(routeFloor("POST", "/workspace/repos/new")).toBe("maintainer");
|
|
69
|
+
expect(routeFloor("POST", "/workspace/sync")).toBe("maintainer");
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
test("operator reads outrank the GET default: logs, usage, capabilities", () => {
|
|
73
|
+
expect(routeFloor("GET", "/logs")).toBe("maintainer");
|
|
74
|
+
expect(routeFloor("GET", "/system/usage")).toBe("maintainer");
|
|
75
|
+
expect(routeFloor("GET", "/capabilities")).toBe("maintainer");
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
test("the secrets surface belongs to the operating tier, reads included", () => {
|
|
79
|
+
expect(routeFloor("GET", "/secrets")).toBe("maintainer");
|
|
80
|
+
expect(routeFloor("POST", "/secrets")).toBe("maintainer");
|
|
81
|
+
expect(routeFloor("GET", "/secrets/inventory")).toBe("maintainer");
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
test("an unclassified route falls to the fail-safe defaults: viewer for reads, maintainer for mutations", () => {
|
|
85
|
+
expect(routeFloor("GET", "/no/such/route")).toBe("viewer");
|
|
86
|
+
expect(routeFloor("POST", "/no/such/route")).toBe("maintainer");
|
|
87
|
+
expect(routeFloor("POST", "/members")).toBe("maintainer");
|
|
88
|
+
expect(routeFloor("POST", "/system/sessions/revoke")).toBe("maintainer");
|
|
89
|
+
// The require-passkey switch and its recovery codes keep the mutation default under their ownership gate.
|
|
90
|
+
expect(routeFloor("POST", "/system/passkeys/policy")).toBe("maintainer");
|
|
91
|
+
expect(routeFloor("POST", "/system/passkeys/recovery")).toBe("maintainer");
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
describe("guestReach", () => {
|
|
96
|
+
test("the chat a guest drives, the cards it holds, and the reads a composer needs", () => {
|
|
97
|
+
expect(guestReach("POST", "/agent")).toBe(true);
|
|
98
|
+
expect(guestReach("POST", "/agent/attach")).toBe(true);
|
|
99
|
+
expect(guestReach("POST", "/agent/reply")).toBe(true);
|
|
100
|
+
expect(guestReach("GET", "/agents")).toBe(true);
|
|
101
|
+
expect(guestReach("GET", "/agents/abc/transcript")).toBe(true);
|
|
102
|
+
expect(guestReach("GET", "/personas")).toBe(true);
|
|
103
|
+
expect(guestReach("GET", "/providers")).toBe(true);
|
|
104
|
+
expect(guestReach("GET", "/events")).toBe(true);
|
|
105
|
+
expect(guestReach("POST", "/system/session")).toBe(true);
|
|
106
|
+
expect(guestReach("POST", "/speech/transcribe")).toBe(true);
|
|
107
|
+
expect(guestReach("DELETE", "/members/self")).toBe(true);
|
|
108
|
+
expect(guestReach("DELETE", "/system/passkeys/abc_123")).toBe(true);
|
|
109
|
+
expect(guestReach("POST", "/workspace/upload", `${ATTACHMENTS_DIR}/u1/shot.png`)).toBe(true);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
// Every guest holds an area — the roster refuses one that names none (auth.ts MemberSchema) — and each route below
|
|
113
|
+
// applies that fence itself, so none of them can answer with the whole tree.
|
|
114
|
+
test("a guest reads the workspace, which its own fence then cuts", () => {
|
|
115
|
+
expect(guestReach("GET", "/workspace/tree")).toBe(true);
|
|
116
|
+
expect(guestReach("GET", "/workspace/file")).toBe(true);
|
|
117
|
+
expect(guestReach("GET", "/workspace/search")).toBe(true);
|
|
118
|
+
expect(guestReach("GET", "/workspace/raw")).toBe(true);
|
|
119
|
+
expect(guestReach("GET", "/areas")).toBe(true);
|
|
120
|
+
// Reads only: the tier writes nothing but the attachment that rides with its own message.
|
|
121
|
+
expect(guestReach("POST", "/workspace/upload", "support/note.md")).toBe(false);
|
|
122
|
+
expect(guestReach("DELETE", "/workspace/file")).toBe(false);
|
|
123
|
+
expect(guestReach("POST", "/areas")).toBe(false);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
test("the past, the box, and every ship control stay shut, and so does anything unnamed", () => {
|
|
127
|
+
expect(guestReach("POST", "/workspace/upload", "app/main.ts")).toBe(false);
|
|
128
|
+
expect(guestReach("POST", "/workspace/upload")).toBe(false);
|
|
129
|
+
expect(guestReach("GET", "/sessions")).toBe(false);
|
|
130
|
+
expect(guestReach("GET", "/agents/search")).toBe(false);
|
|
131
|
+
expect(guestReach("POST", "/agent/route-chat")).toBe(false);
|
|
132
|
+
expect(guestReach("POST", "/personas")).toBe(false);
|
|
133
|
+
expect(guestReach("GET", "/secrets")).toBe(false);
|
|
134
|
+
expect(guestReach("POST", "/agents/abc/land")).toBe(false);
|
|
135
|
+
expect(guestReach("POST", "/agents/abc/request-land")).toBe(false);
|
|
136
|
+
expect(guestReach("POST", "/system/ws-ticket")).toBe(false);
|
|
137
|
+
expect(guestReach("GET", "/no/such/route")).toBe(false);
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
describe("memberRefusal", () => {
|
|
142
|
+
test("a tier below the floor is refused with the floor named; a guest off its list with its own sentence", () => {
|
|
143
|
+
expect(memberRefusal({ role: "viewer" }, "POST", "/agent")).toEqual({ error: "collaborator access required", floor: "collaborator", reason: "floor" });
|
|
144
|
+
expect(memberRefusal({ role: "collaborator" }, "POST", "/agent")).toBeUndefined();
|
|
145
|
+
expect(memberRefusal({ role: "guest", areas: ["support"] }, "POST", "/agent")).toBeUndefined();
|
|
146
|
+
expect(memberRefusal({ role: "guest", areas: ["support"] }, "POST", "/workspace/move")).toEqual({
|
|
147
|
+
error: "not open to a guest member",
|
|
148
|
+
floor: "viewer",
|
|
149
|
+
reason: "guest",
|
|
150
|
+
});
|
|
151
|
+
// A guest never clears a floor by rank: the list is the whole of its admission.
|
|
152
|
+
expect(memberRefusal({ role: "guest", areas: ["support"] }, "GET", "/no/such/route")).toEqual({
|
|
153
|
+
error: "not open to a guest member",
|
|
154
|
+
floor: "viewer",
|
|
155
|
+
reason: "guest",
|
|
156
|
+
});
|
|
157
|
+
expect(memberRefusal({ role: "viewer" }, "GET", "/no/such/route")).toBeUndefined();
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
test("a writer clears the file routes and nothing that ships or operates", () => {
|
|
161
|
+
expect(memberRefusal({ role: "writer", areas: ["support"] }, "POST", "/workspace/move")).toBeUndefined();
|
|
162
|
+
expect(memberRefusal({ role: "writer", areas: ["support"] }, "POST", "/workspace/upload", "support/note.md")).toBeUndefined();
|
|
163
|
+
expect(memberRefusal({ role: "collaborator" }, "POST", "/workspace/move")).toEqual({ error: "writer access required", floor: "writer", reason: "floor" });
|
|
164
|
+
expect(memberRefusal({ role: "writer", areas: ["support"] }, "POST", "/agents/abc/land")).toEqual({
|
|
165
|
+
error: "maintainer access required",
|
|
166
|
+
floor: "maintainer",
|
|
167
|
+
reason: "floor",
|
|
168
|
+
});
|
|
169
|
+
expect(memberRefusal({ role: "writer", areas: ["support"] }, "GET", "/secrets")).toEqual({
|
|
170
|
+
error: "maintainer access required",
|
|
171
|
+
floor: "maintainer",
|
|
172
|
+
reason: "floor",
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
// Editing by hand and running agents are separate answers: a person who edits without agents holds the writer tier,
|
|
178
|
+
// which clears the collaborator floor by rank, and is kept off it by their own answer.
|
|
179
|
+
describe("memberRefusal for a person with agents off", () => {
|
|
180
|
+
test("refuses every agent door and keeps the file doors open", () => {
|
|
181
|
+
const editor = { role: "writer" as const, agents: "off" as const };
|
|
182
|
+
expect(memberRefusal(editor, "POST", "/agent")).toEqual({ error: "running agents is not on for you here", floor: "collaborator", reason: "agents-off" });
|
|
183
|
+
expect(memberRefusal(editor, "POST", "/agents/abc/request-land")).toMatchObject({ floor: "collaborator" });
|
|
184
|
+
expect(memberRefusal(editor, "POST", "/workspace/dir")).toBeUndefined();
|
|
185
|
+
expect(memberRefusal(editor, "GET", "/workspace/tree")).toBeUndefined();
|
|
186
|
+
expect(memberRefusal({ role: "writer", agents: "run" }, "POST", "/agent")).toBeUndefined();
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
// A home-only member is a guest whose one conversation is its home (conversations/home/home-conversation.ts): the guest
|
|
191
|
+
// list, and the land press when its home lands by itself, which the route then admits on that home alone.
|
|
192
|
+
describe("a home-only member", () => {
|
|
193
|
+
const homeOnly = { role: "guest", agents: "home" } as const;
|
|
194
|
+
|
|
195
|
+
test("reaches what a guest reaches, and the land press only when its work lands by itself", () => {
|
|
196
|
+
expect(memberRefusal(homeOnly, "POST", "/agent")).toBeUndefined();
|
|
197
|
+
expect(memberRefusal(homeOnly, "GET", "/agents/home")).toBeUndefined();
|
|
198
|
+
expect(memberRefusal(homeOnly, "POST", "/agents/abc/land")).toEqual({ error: "not open to a guest member", floor: "viewer", reason: "guest" });
|
|
199
|
+
expect(memberRefusal({ ...homeOnly, lands: true }, "POST", "/agents/abc/land")).toBeUndefined();
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
test("never discards, settles, sets a conversation's landing, or commits, whatever it may land", () => {
|
|
203
|
+
const lands = { ...homeOnly, lands: true } as const;
|
|
204
|
+
for (const [method, path] of [
|
|
205
|
+
["POST", "/agents/abc/discard"],
|
|
206
|
+
["POST", "/agents/abc/settle"],
|
|
207
|
+
["POST", "/agents/abc/auto-land"],
|
|
208
|
+
["POST", "/git/root/commit"],
|
|
209
|
+
] as const) {
|
|
210
|
+
expect(memberRefusal(lands, method, path)).toEqual({ error: "not open to a guest member", floor: "viewer", reason: "guest" });
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
test("a chatting guest granted nothing of the kind does not reach the land press", () => {
|
|
215
|
+
expect(memberRefusal({ role: "guest", agents: "chat", lands: true }, "POST", "/agents/abc/land")).toEqual({
|
|
216
|
+
error: "not open to a guest member",
|
|
217
|
+
floor: "viewer",
|
|
218
|
+
reason: "guest",
|
|
219
|
+
});
|
|
220
|
+
});
|
|
221
|
+
});
|