@intentic/sandbox-contract 1.422.0 → 1.423.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chores/chores.d.ts.map +1 -1
- package/dist/chores/chores.js +1 -48
- package/dist/chores/chores.js.map +1 -1
- package/dist/chores/index.d.ts +1 -1
- package/dist/chores/index.d.ts.map +1 -1
- package/dist/chores/index.js +1 -1
- package/dist/chores/index.js.map +1 -1
- package/dist/chores/prompt.d.ts +0 -1
- package/dist/chores/prompt.d.ts.map +1 -1
- package/dist/chores/prompt.js +0 -2
- package/dist/chores/prompt.js.map +1 -1
- package/dist/contracts/capabilities.contract.d.ts +0 -28
- package/dist/contracts/capabilities.contract.d.ts.map +1 -1
- package/dist/contracts/issues.contract.d.ts +6 -0
- package/dist/contracts/issues.contract.d.ts.map +1 -1
- package/dist/contracts/offload.contract.d.ts +14 -14
- package/dist/contracts/panels.contract.d.ts +0 -7
- package/dist/contracts/panels.contract.d.ts.map +1 -1
- package/dist/contracts/runner.contract.d.ts +246 -246
- package/dist/contracts/secrets.contract.d.ts +2 -17
- package/dist/contracts/secrets.contract.d.ts.map +1 -1
- package/dist/contracts/secrets.contract.js +2 -2
- package/dist/contracts/secrets.contract.js.map +1 -1
- package/dist/contracts/settings.contract.d.ts +0 -135
- package/dist/contracts/settings.contract.d.ts.map +1 -1
- package/dist/contracts/system.contract.d.ts +18 -18
- package/dist/contracts/workspace.contract.d.ts +0 -60
- package/dist/contracts/workspace.contract.d.ts.map +1 -1
- package/dist/contracts/workspace.contract.js +1 -11
- package/dist/contracts/workspace.contract.js.map +1 -1
- package/dist/ids/project-id.d.ts +3 -0
- package/dist/ids/project-id.d.ts.map +1 -0
- package/dist/ids/project-id.js +25 -0
- package/dist/ids/project-id.js.map +1 -0
- package/dist/ids/tunnel-ids.d.ts +0 -1
- package/dist/ids/tunnel-ids.d.ts.map +1 -1
- package/dist/ids/tunnel-ids.js +0 -1
- package/dist/ids/tunnel-ids.js.map +1 -1
- package/dist/index.d.ts +0 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -4
- package/dist/index.js.map +1 -1
- package/dist/models/model-roles.d.ts +1 -1
- package/dist/models/model-roles.d.ts.map +1 -1
- package/dist/models/model-roles.js +1 -1
- package/dist/models/model-roles.js.map +1 -1
- package/dist/protocol/doors/sandbox-pass.d.ts +22 -0
- package/dist/protocol/doors/sandbox-pass.d.ts.map +1 -0
- package/dist/protocol/doors/sandbox-pass.js +72 -0
- package/dist/protocol/doors/sandbox-pass.js.map +1 -0
- package/dist/protocol/raw/raw-json-routes.d.ts +92 -9
- package/dist/protocol/raw/raw-json-routes.d.ts.map +1 -1
- package/dist/protocol/raw/raw-json-routes.js +6 -2
- package/dist/protocol/raw/raw-json-routes.js.map +1 -1
- package/dist/protocol/raw/raw-routes.d.ts +16 -7
- package/dist/protocol/raw/raw-routes.d.ts.map +1 -1
- package/dist/protocol/raw/raw-routes.js +4 -2
- package/dist/protocol/raw/raw-routes.js.map +1 -1
- package/dist/schemas/capabilities.d.ts +0 -14
- package/dist/schemas/capabilities.d.ts.map +1 -1
- package/dist/schemas/capabilities.js +0 -4
- package/dist/schemas/capabilities.js.map +1 -1
- package/dist/schemas/certificate-request.d.ts +0 -2
- package/dist/schemas/certificate-request.d.ts.map +1 -1
- package/dist/schemas/issues.d.ts +133 -0
- package/dist/schemas/issues.d.ts.map +1 -1
- package/dist/schemas/issues.js +34 -0
- package/dist/schemas/issues.js.map +1 -1
- package/dist/schemas/maintenance.d.ts.map +1 -1
- package/dist/schemas/maintenance.js +16 -10
- package/dist/schemas/maintenance.js.map +1 -1
- package/dist/schemas/metrics.d.ts.map +1 -1
- package/dist/schemas/metrics.js.map +1 -1
- package/dist/schemas/panels.d.ts +0 -14
- package/dist/schemas/panels.d.ts.map +1 -1
- package/dist/schemas/panels.js +0 -6
- package/dist/schemas/panels.js.map +1 -1
- package/dist/schemas/personas.d.ts.map +1 -1
- package/dist/schemas/personas.js +0 -6
- package/dist/schemas/personas.js.map +1 -1
- package/dist/schemas/providers/usage.d.ts +0 -12
- package/dist/schemas/providers/usage.d.ts.map +1 -1
- package/dist/schemas/providers/usage.js +0 -5
- package/dist/schemas/providers/usage.js.map +1 -1
- package/dist/schemas/secrets.d.ts +1 -22
- package/dist/schemas/secrets.d.ts.map +1 -1
- package/dist/schemas/secrets.js +3 -13
- package/dist/schemas/secrets.js.map +1 -1
- package/dist/schemas/settings-experiments.d.ts +0 -4
- package/dist/schemas/settings-experiments.d.ts.map +1 -1
- package/dist/schemas/settings-experiments.js +0 -12
- package/dist/schemas/settings-experiments.js.map +1 -1
- package/dist/schemas/settings-history.d.ts +1 -1
- package/dist/schemas/settings-history.d.ts.map +1 -1
- package/dist/schemas/settings-history.js +1 -0
- package/dist/schemas/settings-history.js.map +1 -1
- package/dist/schemas/settings-savings.d.ts +0 -144
- package/dist/schemas/settings-savings.d.ts.map +1 -1
- package/dist/schemas/settings-savings.js +1 -3
- package/dist/schemas/settings-savings.js.map +1 -1
- package/dist/schemas/settings.d.ts +0 -4
- package/dist/schemas/settings.d.ts.map +1 -1
- package/dist/schemas/settings.js +2 -3
- package/dist/schemas/settings.js.map +1 -1
- package/dist/schemas/short-codes.d.ts +0 -10
- package/dist/schemas/short-codes.d.ts.map +1 -1
- package/dist/schemas/short-codes.js +1 -9
- package/dist/schemas/short-codes.js.map +1 -1
- package/dist/schemas/workspace/workspace-search.d.ts +0 -12
- package/dist/schemas/workspace/workspace-search.d.ts.map +1 -1
- package/dist/schemas/workspace/workspace-search.js +5 -12
- package/dist/schemas/workspace/workspace-search.js.map +1 -1
- package/dist/state/definition.d.ts +0 -24
- package/dist/state/definition.d.ts.map +1 -1
- package/dist/state/update-probation.d.ts +1 -1
- package/dist/state/update-probation.d.ts.map +1 -1
- package/dist/state/update-probation.js +1 -1
- package/dist/state/update-probation.js.map +1 -1
- package/dist/state/workspace-state.d.ts +6 -1
- package/dist/state/workspace-state.d.ts.map +1 -1
- package/dist/state/workspace-state.js +7 -1
- package/dist/state/workspace-state.js.map +1 -1
- package/package.json +27 -5
- package/src/chores/chores.test.ts +1 -2
- package/src/chores/chores.ts +2 -62
- package/src/chores/index.ts +1 -1
- package/src/chores/prompt.ts +1 -6
- package/src/chores/verdict.test.ts +3 -44
- package/src/contracts/secrets.contract.ts +4 -5
- package/src/contracts/workspace.contract.ts +2 -14
- package/src/events/system-events.ts +2 -2
- package/src/ids/project-id.test.ts +26 -0
- package/src/ids/project-id.ts +34 -0
- package/src/ids/tunnel-ids.test.ts +2 -23
- package/src/ids/tunnel-ids.ts +0 -4
- package/src/index.ts +0 -6
- package/src/models/model-roles.ts +3 -1
- package/src/policy/persona-capability.ts +1 -1
- package/src/protocol/doors/sandbox-pass.test.ts +51 -0
- package/src/protocol/doors/sandbox-pass.ts +119 -0
- package/src/protocol/headers.ts +2 -2
- package/src/protocol/member-reach.test.ts +0 -1
- package/src/protocol/raw/raw-json-routes.ts +14 -2
- package/src/protocol/raw/raw-routes.ts +9 -5
- package/src/protocol/routes.test.ts +0 -4
- package/src/schemas/capabilities.ts +0 -6
- package/src/schemas/issues.ts +54 -0
- package/src/schemas/maintenance.ts +20 -12
- package/src/schemas/metrics.ts +2 -0
- package/src/schemas/panels.ts +0 -8
- package/src/schemas/personas.ts +2 -6
- package/src/schemas/providers/usage.ts +5 -14
- package/src/schemas/secrets.ts +8 -20
- package/src/schemas/settings-experiments.ts +0 -17
- package/src/schemas/settings-history.ts +3 -0
- package/src/schemas/settings-savings.ts +2 -9
- package/src/schemas/settings.test.ts +16 -9
- package/src/schemas/settings.ts +4 -4
- package/src/schemas/short-codes.ts +2 -14
- package/src/schemas/version-seam.test.ts +2 -2
- package/src/schemas/workspace/workspace-search.ts +12 -25
- package/src/state/update-probation.ts +4 -3
- package/src/state/workspace-state.test.ts +2 -2
- package/src/state/workspace-state.ts +10 -1
- package/src/text/path-refs.test.ts +1 -1
- package/dist/contracts/intentic.contract.d.ts +0 -30
- package/dist/contracts/intentic.contract.d.ts.map +0 -1
- package/dist/contracts/intentic.contract.js +0 -34
- package/dist/contracts/intentic.contract.js.map +0 -1
- package/dist/contracts/inventory.contract.d.ts +0 -138
- package/dist/contracts/inventory.contract.d.ts.map +0 -1
- package/dist/contracts/inventory.contract.js +0 -31
- package/dist/contracts/inventory.contract.js.map +0 -1
- package/dist/schemas/codebase-health.d.ts +0 -56
- package/dist/schemas/codebase-health.d.ts.map +0 -1
- package/dist/schemas/codebase-health.js +0 -43
- package/dist/schemas/codebase-health.js.map +0 -1
- package/dist/schemas/intentic.d.ts +0 -5
- package/dist/schemas/intentic.d.ts.map +0 -1
- package/dist/schemas/intentic.js +0 -3
- package/dist/schemas/intentic.js.map +0 -1
- package/dist/schemas/inventory.d.ts +0 -175
- package/dist/schemas/inventory.d.ts.map +0 -1
- package/dist/schemas/inventory.js +0 -62
- package/dist/schemas/inventory.js.map +0 -1
- package/src/contracts/intentic.contract.ts +0 -45
- package/src/contracts/inventory.contract.ts +0 -35
- package/src/schemas/codebase-health.ts +0 -60
- package/src/schemas/intentic.ts +0 -2
- package/src/schemas/inventory.ts +0 -83
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { procedure } from "../protocol/route-meta.js";
|
|
2
2
|
import { streamOf } from "../protocol/stream-of.js";
|
|
3
|
-
import { WorkspaceHealthQuerySchema, WorkspaceHealthSchema } from "../schemas/codebase-health.js";
|
|
4
3
|
import { WorkspaceModulesSchema } from "../schemas/git/git.js";
|
|
5
4
|
import { OkSchema } from "../schemas/shared.js";
|
|
6
5
|
import {
|
|
@@ -194,14 +193,14 @@ export const workspaceContract = {
|
|
|
194
193
|
.meta({ guest: true })
|
|
195
194
|
.input(WorkspaceResolveQuerySchema)
|
|
196
195
|
.output(WorkspaceResolveSchema),
|
|
197
|
-
// `mode`
|
|
196
|
+
// `mode` picks text (the default) or file names; both are ripgrep walks of the tree as it is on disk.
|
|
198
197
|
search: procedure
|
|
199
198
|
.route({
|
|
200
199
|
method: "GET",
|
|
201
200
|
path: "/workspace/search",
|
|
202
201
|
summary: "Search the code",
|
|
203
202
|
description:
|
|
204
|
-
"
|
|
203
|
+
"Matching lines across the whole workspace grouped by file, or with the files mode the files whose names match, best first. Both read the tree as it is on disk, with no index in between. Long result sets resume from the cursor it hands back.",
|
|
205
204
|
})
|
|
206
205
|
.meta({ guest: true, control: "editor" })
|
|
207
206
|
.input(WorkspaceSearchQuerySchema)
|
|
@@ -219,17 +218,6 @@ export const workspaceContract = {
|
|
|
219
218
|
.meta({ floor: "viewer", guest: true, stream: true, control: "editor" })
|
|
220
219
|
.input(WorkspaceSearchQuerySchema)
|
|
221
220
|
.output(streamOf(WorkspaceSearchFrameSchema)),
|
|
222
|
-
// Per-file churn × complexity, index totals, top modules; scoped to a repo, not the whole /work drop.
|
|
223
|
-
health: procedure
|
|
224
|
-
.route({
|
|
225
|
-
method: "GET",
|
|
226
|
-
path: "/workspace/health",
|
|
227
|
-
summary: "A repo's shape in numbers",
|
|
228
|
-
description:
|
|
229
|
-
"Where one repo's risk sits: the files that change often and are complicated at once, what the index holds, and which modules the rest of the code leans on most. Scoped to a repo, because a codebase is a repo rather than the whole drop.",
|
|
230
|
-
})
|
|
231
|
-
.input(WorkspaceHealthQuerySchema)
|
|
232
|
-
.output(WorkspaceHealthSchema),
|
|
233
221
|
// Deterministic, no-LLM classification into coarse buckets; read-only, applied only via the move route.
|
|
234
222
|
classify: procedure
|
|
235
223
|
.route({
|
|
@@ -8,8 +8,8 @@ import { WorkspaceTreeDeltaSchema } from "../schemas/workspace/workspace-tree.js
|
|
|
8
8
|
// Frames about the sandbox rather than a turn: liveness, boot progress, what moved (repos, refs, running processes,
|
|
9
9
|
// presence, the fleet), and account headroom. One stream carries them all.
|
|
10
10
|
|
|
11
|
-
// One
|
|
12
|
-
//
|
|
11
|
+
// One progress line a streamed run yields (a capability's apply, an exit's start, a disk's mount); open-ended, so any
|
|
12
|
+
// string `kind` plus extra fields pass through.
|
|
13
13
|
export const IntenticLineSchema = z.looseObject({ kind: z.string() });
|
|
14
14
|
export type IntenticLine = z.infer<typeof IntenticLineSchema>;
|
|
15
15
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { normalizeProjectId } from "./project-id.js";
|
|
2
|
+
|
|
3
|
+
describe("project id", () => {
|
|
4
|
+
it("reads every remote spelling of one repository as one project", () => {
|
|
5
|
+
for (const remote of [
|
|
6
|
+
"git@github.com:Acme/App.git",
|
|
7
|
+
"https://github.com/acme/app",
|
|
8
|
+
"https://user:token@github.com/acme/app.git",
|
|
9
|
+
"ssh://git@github.com:22/acme/app.git",
|
|
10
|
+
"github.com/acme/app/",
|
|
11
|
+
" GitHub.com/Acme/App ",
|
|
12
|
+
]) {
|
|
13
|
+
expect(normalizeProjectId(remote)).toBe("github.com/acme/app");
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it("keeps nested groups", () => {
|
|
18
|
+
expect(normalizeProjectId("git@gitlab.com:group/sub/repo.git")).toBe("gitlab.com/group/sub/repo");
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it("refuses what names no repository", () => {
|
|
22
|
+
for (const text of ["", "app", "github.com", "/local/path/repo", "file:///tmp/repo", "github.com/acme app"]) {
|
|
23
|
+
expect(normalizeProjectId(text)).toBeUndefined();
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// One spelling for "a project" across account-level report routing: the platform keys claims by it, the sending daemon
|
|
2
|
+
// resolves by it, the receiving daemon checks a pass against it. A project is a repository, named the way its remote
|
|
3
|
+
// names it, so `git@github.com:Acme/App.git`, `https://github.com/acme/app` and `github.com/acme/app/` are one project:
|
|
4
|
+
// `github.com/acme/app`. Host and path are lowercased; the hosts people use are case-insensitive about owners and repos.
|
|
5
|
+
|
|
6
|
+
// host + at least one path segment, each a conservative charset; nothing that could be a URL with a query or a port.
|
|
7
|
+
const PROJECT_ID = /^[a-z0-9.-]+\.[a-z]{2,}(\/[a-z0-9._~-]+)+$/;
|
|
8
|
+
|
|
9
|
+
export const PROJECT_ID_MAX = 200;
|
|
10
|
+
|
|
11
|
+
// The normalized id, or undefined when the text does not name a repository.
|
|
12
|
+
export const normalizeProjectId = (raw: string): string | undefined => {
|
|
13
|
+
let text = raw.trim();
|
|
14
|
+
if (text === "") {
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
// scp-like ssh: user@host:path
|
|
18
|
+
const scp = /^[^@/\s]+@([^:/\s]+):(.+)$/.exec(text);
|
|
19
|
+
if (scp !== null) {
|
|
20
|
+
text = `${scp[1]}/${scp[2]}`;
|
|
21
|
+
} else {
|
|
22
|
+
text = text.replace(/^[a-z+]+:\/\//i, "");
|
|
23
|
+
// credentials and ports never belong to a project's identity
|
|
24
|
+
text = text.replace(/^[^@/]*@/, "");
|
|
25
|
+
text = text.replace(/^([^/:]+):\d+\//, "$1/");
|
|
26
|
+
}
|
|
27
|
+
text = text
|
|
28
|
+
.replace(/[?#].*$/, "")
|
|
29
|
+
.replace(/\/+$/, "")
|
|
30
|
+
.replace(/\.git$/i, "")
|
|
31
|
+
.replace(/\/+/g, "/")
|
|
32
|
+
.toLowerCase();
|
|
33
|
+
return text.length <= PROJECT_ID_MAX && PROJECT_ID.test(text) ? text : undefined;
|
|
34
|
+
};
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { readFileSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { repoRoot } from "@intentic/constants/node";
|
|
4
|
-
import {
|
|
4
|
+
import { PORT_SLOT_COUNT, portSlotsFromToken, sandboxIdFromToken } from "./tunnel-ids.js";
|
|
5
5
|
|
|
6
|
-
// The digests every language spells again (ic's util.rs,
|
|
6
|
+
// The digests every language spells again (ic's util.rs, sandbox-run's Web Crypto twin) are held to the
|
|
7
7
|
// run contract's names.fixture.json, which each of them is tested against. SAFETY: the fixture is this repository's own
|
|
8
8
|
// file; the assertions below fail on any field it lacks.
|
|
9
9
|
const SHARED = JSON.parse(readFileSync(join(repoRoot(import.meta.url), "_shared/sandbox-run/src/names.fixture.json"), "utf8")) as {
|
|
10
10
|
readonly sandboxIds: { readonly vectors: { readonly token: string; readonly id: string }[] };
|
|
11
|
-
readonly hostSshIds: { readonly vectors: { readonly token: string; readonly hostName: string; readonly id: string }[] };
|
|
12
11
|
};
|
|
13
12
|
|
|
14
13
|
const TOKEN = "connect-token-one";
|
|
@@ -21,11 +20,6 @@ test("the sandbox id is a stable 12-hex digest of the connect token, and absent
|
|
|
21
20
|
expect(sandboxIdFromToken("")).toBeUndefined();
|
|
22
21
|
});
|
|
23
22
|
|
|
24
|
-
test("a host ssh id is salted per host, so two deploy targets never collide", () => {
|
|
25
|
-
expect(hostSshIdFromToken(TOKEN, "web-1")).toMatch(/^[0-9a-f]{12}$/);
|
|
26
|
-
expect(hostSshIdFromToken(TOKEN, "web-1")).not.toBe(hostSshIdFromToken(TOKEN, "web-2"));
|
|
27
|
-
});
|
|
28
|
-
|
|
29
23
|
test("port slots are a fixed-size pool of DNS-safe labels, stable per token", () => {
|
|
30
24
|
const slots = portSlotsFromToken(TOKEN);
|
|
31
25
|
expect(slots).toHaveLength(PORT_SLOT_COUNT);
|
|
@@ -50,18 +44,3 @@ test("slots are not derivable from the sandbox id: only from the token behind it
|
|
|
50
44
|
test.each(SHARED.sandboxIds.vectors)("the sandbox id of $token is $id, the digest ic and the browser derive too", ({ token, id }) => {
|
|
51
45
|
expect(sandboxIdFromToken(token)).toBe(id);
|
|
52
46
|
});
|
|
53
|
-
|
|
54
|
-
test.each(SHARED.hostSshIds.vectors)("the host ssh id of $token on $hostName is $id", ({ token, hostName, id }) => {
|
|
55
|
-
expect(hostSshIdFromToken(token, hostName)).toBe(id);
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
// connect-host.ps1 digests a server's id itself when a code's answer carries no HOST_ID, and no PowerShell runs in the
|
|
59
|
-
// suites. What can be held is its source: the same salted input (`<token>:<host name>`), the same hash, the same cut, over
|
|
60
|
-
// UTF-8 bytes, so a change to one half reads as a change to the other here.
|
|
61
|
-
test("connect-host.ps1 digests the host ssh id the way hostSshIdFromToken does", () => {
|
|
62
|
-
const script = readFileSync(join(repoRoot(import.meta.url), "_site/site/public/scripts/connect-host.ps1"), "utf8");
|
|
63
|
-
expect(script).toContain("$slugInput = '{0}:{1}' -f $ConnectToken, $HostName");
|
|
64
|
-
expect(script).toContain("[System.Security.Cryptography.SHA256]::Create()");
|
|
65
|
-
expect(script).toContain("[System.Text.Encoding]::UTF8.GetBytes($slugInput)");
|
|
66
|
-
expect(script).toContain("-replace '-', '').Substring(0, 12).ToLower()");
|
|
67
|
-
});
|
package/src/ids/tunnel-ids.ts
CHANGED
|
@@ -11,10 +11,6 @@ export { SANDBOX_ID } from "./sandbox-id.js";
|
|
|
11
11
|
export const sandboxIdFromToken = (connectToken: string): string | undefined =>
|
|
12
12
|
connectToken === "" ? undefined : sha256Hex(connectToken).slice(0, 12);
|
|
13
13
|
|
|
14
|
-
// A per-host SSH tunnel's stable 12-hex id, salted with the host name so each enrolled deploy target gets its own
|
|
15
|
-
// ssh-<id>.<zone>. Shared by the CLI and the platform API, which must derive the identical id.
|
|
16
|
-
export const hostSshIdFromToken = (connectToken: string, hostName: string): string => sha256Hex(`${connectToken}:${hostName}`).slice(0, 12);
|
|
17
|
-
|
|
18
14
|
// Eight is enough for a monorepo's dev servers, and the hard cap on preview DNS records one sandbox can cost.
|
|
19
15
|
export const PORT_SLOT_COUNT = 8;
|
|
20
16
|
|
package/src/index.ts
CHANGED
|
@@ -23,8 +23,6 @@ import { extensionsContract } from "./contracts/extensions.contract.js";
|
|
|
23
23
|
import { gitContract } from "./contracts/git.contract.js";
|
|
24
24
|
import { historyContract } from "./contracts/history.contract.js";
|
|
25
25
|
import { hubContract } from "./contracts/hub.contract.js";
|
|
26
|
-
import { intenticContract } from "./contracts/intentic.contract.js";
|
|
27
|
-
import { inventoryContract } from "./contracts/inventory.contract.js";
|
|
28
26
|
import { issuesContract } from "./contracts/issues.contract.js";
|
|
29
27
|
import { logsContract } from "./contracts/logs.contract.js";
|
|
30
28
|
import { loopsContract } from "./contracts/loops.contract.js";
|
|
@@ -82,8 +80,6 @@ export const sandboxContract: {
|
|
|
82
80
|
git: typeof gitContract;
|
|
83
81
|
history: typeof historyContract;
|
|
84
82
|
hub: typeof hubContract;
|
|
85
|
-
intentic: typeof intenticContract;
|
|
86
|
-
inventory: typeof inventoryContract;
|
|
87
83
|
issues: typeof issuesContract;
|
|
88
84
|
logs: typeof logsContract;
|
|
89
85
|
loops: typeof loopsContract;
|
|
@@ -135,8 +131,6 @@ export const sandboxContract: {
|
|
|
135
131
|
git: gitContract,
|
|
136
132
|
history: historyContract,
|
|
137
133
|
hub: hubContract,
|
|
138
|
-
intentic: intenticContract,
|
|
139
|
-
inventory: inventoryContract,
|
|
140
134
|
issues: issuesContract,
|
|
141
135
|
logs: logsContract,
|
|
142
136
|
loops: loopsContract,
|
|
@@ -142,7 +142,9 @@ export const MODEL_ROLES = [
|
|
|
142
142
|
{
|
|
143
143
|
id: "refactor-run",
|
|
144
144
|
label: "Refactors",
|
|
145
|
-
|
|
145
|
+
// Started from the Health tab, removed with iq (2026-11-18). The id stays: every saved roleSetups names it, and a
|
|
146
|
+
// newer editor reads an older daemon's settings with this enum.
|
|
147
|
+
blurb: "Kept so settings saved before the Health tab was removed still read; nothing starts a refactor run now.",
|
|
146
148
|
kind: "run",
|
|
147
149
|
icon: "hammer",
|
|
148
150
|
setup: "high",
|
|
@@ -30,7 +30,7 @@ const listed = (list: readonly string[] | undefined, id: string): boolean => lis
|
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* Whether a persona carrying these accounts (its `capabilities`) and these shelves may act through a capability. A kind
|
|
33
|
-
* absent from the switch (an agent runtime, a
|
|
33
|
+
* absent from the switch (an agent runtime, a VPN) passes untouched, so a new kind is never silently
|
|
34
34
|
* denied.
|
|
35
35
|
*/
|
|
36
36
|
export const personaAllowsCapability = (capability: CapabilityRef, accounts: readonly string[], shelves: PersonaShelves): boolean => {
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { generateKeyPairSync } from "node:crypto";
|
|
2
|
+
import { mintIdentityAssertion, verifyIdentityAssertion } from "../../policy/identity-assertion.js";
|
|
3
|
+
import { isSandboxPass, mintSandboxPass, SANDBOX_PASS_MAX_TTL_MS, SANDBOX_PASS_TTL_MS, verifySandboxPass } from "./sandbox-pass.js";
|
|
4
|
+
|
|
5
|
+
const pemPair = (): { privateKey: string; publicKey: string } =>
|
|
6
|
+
generateKeyPairSync("ed25519", { publicKeyEncoding: { type: "spki", format: "pem" }, privateKeyEncoding: { type: "pkcs8", format: "pem" } });
|
|
7
|
+
const { privateKey: privatePem, publicKey: publicPem } = pemPair();
|
|
8
|
+
const NOW = 1_800_000_000_000;
|
|
9
|
+
const A = "0123456789ab";
|
|
10
|
+
const B = "ba9876543210";
|
|
11
|
+
|
|
12
|
+
const mint = (overrides: Partial<Parameters<typeof mintSandboxPass>[1]> = {}): string =>
|
|
13
|
+
mintSandboxPass(privatePem, { from: A, fromName: "ops", to: B, project: "github.com/acme/app", issuedAtMs: NOW, ...overrides });
|
|
14
|
+
|
|
15
|
+
describe("sandbox pass", () => {
|
|
16
|
+
it("round-trips the claim and expires when it says", () => {
|
|
17
|
+
const pass = mint();
|
|
18
|
+
expect(isSandboxPass(pass)).toBe(true);
|
|
19
|
+
expect(verifySandboxPass(publicPem, pass, NOW + 1_000)).toEqual({
|
|
20
|
+
from: A,
|
|
21
|
+
fromName: "ops",
|
|
22
|
+
to: B,
|
|
23
|
+
project: "github.com/acme/app",
|
|
24
|
+
issuedAt: NOW / 1000,
|
|
25
|
+
expiresAt: (NOW + SANDBOX_PASS_TTL_MS) / 1000,
|
|
26
|
+
});
|
|
27
|
+
expect(verifySandboxPass(publicPem, pass, NOW + SANDBOX_PASS_TTL_MS)).toBeUndefined();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it("refuses another key, a tampered payload, and a claim from the future", () => {
|
|
31
|
+
expect(verifySandboxPass(pemPair().publicKey, mint(), NOW)).toBeUndefined();
|
|
32
|
+
const [prefix, payload, signature] = mint().split(".");
|
|
33
|
+
const forged = Buffer.from(Buffer.from(payload ?? "", "base64url").toString("utf8").replace(B, A.replace("0", "f")), "utf8").toString("base64url");
|
|
34
|
+
expect(verifySandboxPass(publicPem, `${prefix}.${forged}.${signature}`, NOW)).toBeUndefined();
|
|
35
|
+
expect(verifySandboxPass(publicPem, mint({ issuedAtMs: NOW + 120_000 }), NOW)).toBeUndefined();
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it("is never an identity assertion, nor the reverse, under the same key", () => {
|
|
39
|
+
const pass = mint();
|
|
40
|
+
expect(verifyIdentityAssertion(publicPem, pass, NOW)).toBeUndefined();
|
|
41
|
+
const assertion = mintIdentityAssertion(privatePem, { sandboxId: B, email: "a@b.org", method: "email", issuedAtMs: NOW });
|
|
42
|
+
expect(verifySandboxPass(publicPem, assertion, NOW)).toBeUndefined();
|
|
43
|
+
expect(verifySandboxPass(publicPem, assertion.replace(/^pa1/, "sp1"), NOW)).toBeUndefined();
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it("refuses to mint a pass to itself or one that lives too long", () => {
|
|
47
|
+
expect(() => mint({ to: A })).toThrow();
|
|
48
|
+
expect(() => mint({ ttlMs: SANDBOX_PASS_MAX_TTL_MS + 1 })).toThrow();
|
|
49
|
+
expect(() => mint({ project: " " })).toThrow();
|
|
50
|
+
});
|
|
51
|
+
});
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { createPrivateKey, createPublicKey, randomBytes, sign as edSign, verify as edVerify } from "node:crypto";
|
|
2
|
+
import { parseJsonWith } from "@intentic/base/json";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { SANDBOX_ID } from "../../ids/tunnel-ids.js";
|
|
5
|
+
|
|
6
|
+
// The platform's signed word that one sandbox may report to another ON THE SAME ACCOUNT about one project: the
|
|
7
|
+
// credential behind account-level report routing. The sending daemon asks the platform who owns a project
|
|
8
|
+
// (`projectResolve`, authenticated by its connect token, so `from` is the platform's own reading, never the sender's
|
|
9
|
+
// claim); the platform answers with the owner's address and this pass; the receiving daemon checks it against the
|
|
10
|
+
// platform's identity key it already holds (the announce answer's `identityKey`). Signed with the same key as the
|
|
11
|
+
// identity assertion, under its own prefix, so neither can ever stand in for the other.
|
|
12
|
+
|
|
13
|
+
const PASS_PREFIX = "sp1";
|
|
14
|
+
|
|
15
|
+
// Long enough for an outbox to drain a few reports through one resolve; short enough that a lifted pass is soon dead.
|
|
16
|
+
export const SANDBOX_PASS_TTL_MS = 10 * 60_000;
|
|
17
|
+
// What a daemon accepts whatever the claim says, so a platform minting with a wrong ttl cannot hand out a long credential.
|
|
18
|
+
export const SANDBOX_PASS_MAX_TTL_MS = 15 * 60_000;
|
|
19
|
+
|
|
20
|
+
// The header a pass rides on the receiving daemon's `/account/` routes.
|
|
21
|
+
export const SANDBOX_PASS_HEADER = "x-intentic-sandbox-pass";
|
|
22
|
+
|
|
23
|
+
export interface SandboxPass {
|
|
24
|
+
// The sending sandbox's tunnel id, and the name its owner gave it (for the inbox; display only).
|
|
25
|
+
readonly from: string;
|
|
26
|
+
readonly fromName: string;
|
|
27
|
+
// The receiving sandbox's tunnel id: a daemon refuses a pass addressed to anyone else.
|
|
28
|
+
readonly to: string;
|
|
29
|
+
// The normalized project id the receiver claims (project-id.ts).
|
|
30
|
+
readonly project: string;
|
|
31
|
+
readonly issuedAt: number;
|
|
32
|
+
readonly expiresAt: number;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const base64url = (bytes: Buffer): string => bytes.toString("base64url");
|
|
36
|
+
|
|
37
|
+
// The prefix is part of what is signed: a pass is never a valid signature over an identity assertion, nor the reverse.
|
|
38
|
+
const signedBytes = (payload: Buffer): Buffer => Buffer.concat([Buffer.from(`${PASS_PREFIX}.`, "utf8"), payload]);
|
|
39
|
+
|
|
40
|
+
export const isSandboxPass = (token: string): boolean => token.startsWith(`${PASS_PREFIX}.`);
|
|
41
|
+
|
|
42
|
+
export const mintSandboxPass = (
|
|
43
|
+
privateKeyPem: string,
|
|
44
|
+
claim: {
|
|
45
|
+
readonly from: string;
|
|
46
|
+
readonly fromName: string;
|
|
47
|
+
readonly to: string;
|
|
48
|
+
readonly project: string;
|
|
49
|
+
readonly issuedAtMs: number;
|
|
50
|
+
readonly ttlMs?: number;
|
|
51
|
+
},
|
|
52
|
+
): string => {
|
|
53
|
+
if (!SANDBOX_ID.test(claim.from) || !SANDBOX_ID.test(claim.to)) {
|
|
54
|
+
throw new Error("a sandbox pass names two 12-hex sandbox ids");
|
|
55
|
+
}
|
|
56
|
+
if (claim.from === claim.to) {
|
|
57
|
+
throw new Error("a sandbox pass is from one sandbox to another");
|
|
58
|
+
}
|
|
59
|
+
if (claim.project.trim() === "") {
|
|
60
|
+
throw new Error("a sandbox pass names a project");
|
|
61
|
+
}
|
|
62
|
+
const ttlMs = claim.ttlMs ?? SANDBOX_PASS_TTL_MS;
|
|
63
|
+
if (ttlMs <= 0 || ttlMs > SANDBOX_PASS_MAX_TTL_MS) {
|
|
64
|
+
throw new Error(`a sandbox pass lives at most ${SANDBOX_PASS_MAX_TTL_MS} ms`);
|
|
65
|
+
}
|
|
66
|
+
const payload = Buffer.from(
|
|
67
|
+
JSON.stringify({
|
|
68
|
+
v: 1,
|
|
69
|
+
iss: claim.from,
|
|
70
|
+
name: claim.fromName.slice(0, 120),
|
|
71
|
+
aud: claim.to,
|
|
72
|
+
prj: claim.project,
|
|
73
|
+
iat: Math.floor(claim.issuedAtMs / 1000),
|
|
74
|
+
exp: Math.floor((claim.issuedAtMs + ttlMs) / 1000),
|
|
75
|
+
jti: base64url(randomBytes(12)),
|
|
76
|
+
}),
|
|
77
|
+
"utf8",
|
|
78
|
+
);
|
|
79
|
+
const signature = edSign(null, signedBytes(payload), createPrivateKey(privateKeyPem));
|
|
80
|
+
return `${PASS_PREFIX}.${base64url(payload)}.${base64url(signature)}`;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const PassPayloadSchema = z.object({
|
|
84
|
+
v: z.literal(1),
|
|
85
|
+
iss: z.string().regex(SANDBOX_ID),
|
|
86
|
+
name: z.string(),
|
|
87
|
+
aud: z.string().regex(SANDBOX_ID),
|
|
88
|
+
prj: z.string().min(1),
|
|
89
|
+
iat: z.number(),
|
|
90
|
+
exp: z.number(),
|
|
91
|
+
jti: z.string().min(1),
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
// Verifies a pass against the platform's public key at nowMs; undefined for any way of being invalid (wrong prefix, bad
|
|
95
|
+
// signature, malformed claim, expired, issued in the future, living longer than allowed). The caller checks `to`
|
|
96
|
+
// against its own id and `project` against its own claims.
|
|
97
|
+
export const verifySandboxPass = (publicKeyPem: string, token: string, nowMs: number): SandboxPass | undefined => {
|
|
98
|
+
const [prefix, encodedPayload, encodedSignature, ...rest] = token.split(".");
|
|
99
|
+
if (prefix !== PASS_PREFIX || encodedPayload === undefined || encodedSignature === undefined || rest.length > 0) {
|
|
100
|
+
return undefined;
|
|
101
|
+
}
|
|
102
|
+
const payload = Buffer.from(encodedPayload, "base64url");
|
|
103
|
+
try {
|
|
104
|
+
if (!edVerify(null, signedBytes(payload), createPublicKey(publicKeyPem), Buffer.from(encodedSignature, "base64url"))) {
|
|
105
|
+
return undefined;
|
|
106
|
+
}
|
|
107
|
+
} catch {
|
|
108
|
+
// allow(silent-catch): a key or signature that does not parse verifies nothing: the pass is invalid, said as undefined.
|
|
109
|
+
return undefined;
|
|
110
|
+
}
|
|
111
|
+
const claim = parseJsonWith(payload.toString("utf8"), PassPayloadSchema);
|
|
112
|
+
if (claim === undefined || claim.iss === claim.aud) {
|
|
113
|
+
return undefined;
|
|
114
|
+
}
|
|
115
|
+
if (claim.exp * 1000 <= nowMs || claim.iat * 1000 > nowMs + 60_000 || (claim.exp - claim.iat) * 1000 > SANDBOX_PASS_MAX_TTL_MS) {
|
|
116
|
+
return undefined;
|
|
117
|
+
}
|
|
118
|
+
return { from: claim.iss, fromName: claim.name, to: claim.aud, project: claim.prj, issuedAt: claim.iat, expiresAt: claim.exp };
|
|
119
|
+
};
|
package/src/protocol/headers.ts
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
export const REQUEST_ID_HEADER = "x-intentic-request-id";
|
|
5
5
|
|
|
6
6
|
// The header a sandbox's connect token travels in: the platform's routes a sandbox calls as itself
|
|
7
|
-
// (api-contract's PLATFORM_INGRESS)
|
|
8
|
-
//
|
|
7
|
+
// (api-contract's PLATFORM_INGRESS) and the daemon's own gate, which takes the token from `ic` and the owner's
|
|
8
|
+
// browser. `ic` spells it in Rust; api-contract's ingress test holds that spelling to this value.
|
|
9
9
|
export const CONNECT_TOKEN_HEADER = "x-intentic-connect";
|
|
10
10
|
|
|
11
11
|
// The header an extension's backend and its processes present their per-extension token in, checked against the
|
|
@@ -143,7 +143,6 @@ describe("memberRefusal for a person given part of the sandbox", () => {
|
|
|
143
143
|
expect(memberRefusal(maintainer, "GET", "/members")).toBeUndefined();
|
|
144
144
|
expect(memberRefusal(maintainer, "POST", "/privacy/reveal")).toBeUndefined();
|
|
145
145
|
expect(memberRefusal(maintainer, "POST", "/settings/agent-domain")).toBeUndefined();
|
|
146
|
-
expect(memberRefusal(maintainer, "POST", "/system/enroll/code")).toBeUndefined();
|
|
147
146
|
expect(memberRefusal(maintainer, "POST", "/system/passkeys/policy")).toMatchObject({ floor: "owner" });
|
|
148
147
|
expect(memberRefusal(maintainer, "POST", "/platform/relink")).toMatchObject({ floor: "owner" });
|
|
149
148
|
});
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
PhonePasswordsPairSchema,
|
|
38
38
|
} from "../../schemas/phone-passwords.js";
|
|
39
39
|
import { OkSchema } from "../../schemas/shared.js";
|
|
40
|
-
import {
|
|
40
|
+
import { PeerPairingAnswerSchema, SyncPairAnswerSchema, SyncPairRequestSchema } from "../../schemas/short-codes.js";
|
|
41
41
|
import { SpeechStatusSchema, SpeechTranscriptSchema, SpeechWakeClaimSchema, SpeechWakeGrantSchema } from "../../schemas/speech.js";
|
|
42
42
|
import {
|
|
43
43
|
AuthenticationOptionsSchema,
|
|
@@ -74,6 +74,14 @@ import {
|
|
|
74
74
|
LinkWriteAnswerSchema,
|
|
75
75
|
LinkWriteSchema,
|
|
76
76
|
} from "../../schemas/links.js";
|
|
77
|
+
import {
|
|
78
|
+
AccountOutboxSchema,
|
|
79
|
+
AccountProjectsSchema,
|
|
80
|
+
AccountReportSchema,
|
|
81
|
+
AccountSendOutcomeSchema,
|
|
82
|
+
AccountSendSchema,
|
|
83
|
+
IssueAcceptedSchema,
|
|
84
|
+
} from "../../schemas/issues.js";
|
|
77
85
|
import { UploadManifestSchema, UploadSkipSchema } from "../../schemas/workspace/workspace-upload.js";
|
|
78
86
|
import {
|
|
79
87
|
ArrivalAbandonedSchema,
|
|
@@ -111,7 +119,6 @@ export const RAW_JSON_ROUTES = {
|
|
|
111
119
|
// The voices a sandbox speaks with, for the Voice settings (schemas/voice.ts).
|
|
112
120
|
"GET /speech/voices": { output: VoicesViewSchema },
|
|
113
121
|
// A server-connect code for the owner's command (short-codes.ts).
|
|
114
|
-
"POST /system/enroll/code": { input: EnrollCodeRequestSchema, output: EnrollCodeAnswerSchema },
|
|
115
122
|
// The roster is ownership's; every write answers the roster after it.
|
|
116
123
|
"GET /members": { output: MembersRosterSchema },
|
|
117
124
|
"POST /members": { input: MemberGrantSchema, output: MembersListSchema },
|
|
@@ -185,6 +192,11 @@ export const RAW_JSON_ROUTES = {
|
|
|
185
192
|
"POST /system/links/{id}": { input: InboundLinkTermsUpdateSchema, output: InboundLinkSummarySchema },
|
|
186
193
|
"DELETE /system/links/{id}": { output: OkSchema },
|
|
187
194
|
"POST /system/links/{id}/requests/{request}": { input: LinkRequestDecisionSchema, output: InboundLinkSummarySchema },
|
|
195
|
+
// Another sandbox on the owner's account reporting a problem about a project this one claims (schemas/issues.ts).
|
|
196
|
+
"POST /account/report": { input: AccountReportSchema, output: IssueAcceptedSchema },
|
|
197
|
+
"POST /account/outbox": { input: AccountSendSchema, output: AccountSendOutcomeSchema },
|
|
198
|
+
"GET /account/outbox": { output: AccountOutboxSchema },
|
|
199
|
+
"GET /account/projects": { output: AccountProjectsSchema },
|
|
188
200
|
// The link doors, as the asking sandbox's daemon reads them. A status takes `?after=<version>&wait=<seconds>` to
|
|
189
201
|
// be held until it moves past that version.
|
|
190
202
|
"GET /link": { output: LinkHelloSchema },
|
|
@@ -66,11 +66,6 @@ export const RAW_ROUTES = {
|
|
|
66
66
|
"GET /system/browser-view": { auth: "door", beforeBoot: true, control: "never" },
|
|
67
67
|
// The sandbox's own desktop, watched and driven by the owner (desktop/desktop-view.ts); the same query ticket.
|
|
68
68
|
"GET /system/desktop-view": { auth: "door", beforeBoot: true, control: "never" },
|
|
69
|
-
// Deploy-target enrollment, gated by the connect token.
|
|
70
|
-
"POST /enroll": { auth: "door", control: "never" },
|
|
71
|
-
// A server-connect code for the command that connects a server: its single-use enroll token stands in for the connect
|
|
72
|
-
// token. Anybody who operates the sandbox may connect a server to it.
|
|
73
|
-
"POST /system/enroll/code": { control: "never" },
|
|
74
69
|
// An event automation's webhook, gated by the automation's own token.
|
|
75
70
|
"POST /automations/{id}/fire": { auth: "door" },
|
|
76
71
|
// The release gate a pipeline runner waits on, gated by the workflow's minted gate token.
|
|
@@ -304,6 +299,15 @@ export const RAW_ROUTES = {
|
|
|
304
299
|
"POST /system/links/{id}": { control: "never" },
|
|
305
300
|
"DELETE /system/links/{id}": { control: "never" },
|
|
306
301
|
"POST /system/links/{id}/requests/{request}": { control: "never" },
|
|
302
|
+
// Account-level report routing: another sandbox on the owner's account reporting a problem about a project this one
|
|
303
|
+
// claims. Checked in the handler against a pass the platform signed (policy/sandbox-pass.ts); it only ever records
|
|
304
|
+
// into the issues inbox, and wakes an agent only as the inbox's own escalation rule says.
|
|
305
|
+
"POST /account/report": { auth: "door", control: "never" },
|
|
306
|
+
// The sending side, for the `projects` command on the agent's PATH: report a problem to whichever sandbox claims a
|
|
307
|
+
// project (delivered now or kept in the outbox), what is still waiting, and the projects this sandbox claims.
|
|
308
|
+
"POST /account/outbox": { agent: true, control: "never" },
|
|
309
|
+
"GET /account/outbox": { agent: true, control: "never" },
|
|
310
|
+
"GET /account/projects": { agent: true, control: "never" },
|
|
307
311
|
// The link doors, called by the asking sandbox's daemon: each checks the link token itself (x-intentic-link) and
|
|
308
312
|
// reaches only the conversations that link opened, which is the whole of a link's reach.
|
|
309
313
|
"GET /link": { auth: "door", control: "never" },
|
|
@@ -346,8 +346,6 @@ describe(`the real sandbox contract`, () => {
|
|
|
346
346
|
`exit.rotate`,
|
|
347
347
|
`exit.start`,
|
|
348
348
|
`exit.use`,
|
|
349
|
-
`intentic.applyEvents`,
|
|
350
|
-
`intentic.run`,
|
|
351
349
|
`netdisk.mount`,
|
|
352
350
|
`system.events`,
|
|
353
351
|
`system.manageDeviceSandbox`,
|
|
@@ -362,8 +360,6 @@ describe(`the real sandbox contract`, () => {
|
|
|
362
360
|
`exit.rotate`,
|
|
363
361
|
`exit.start`,
|
|
364
362
|
`exit.use`,
|
|
365
|
-
`intentic.applyEvents`,
|
|
366
|
-
`intentic.run`,
|
|
367
363
|
`netdisk.mount`,
|
|
368
364
|
`system.events`,
|
|
369
365
|
`system.manageDeviceSandbox`,
|
|
@@ -13,8 +13,6 @@ import { PhoneConfigSchema } from "./phone.js";
|
|
|
13
13
|
// truth for what's active, and `mcp`-kind entries also feed the agent's MCP servers each turn.
|
|
14
14
|
|
|
15
15
|
export const CapabilityKindSchema = z.enum([
|
|
16
|
-
"devops",
|
|
17
|
-
"monorepo",
|
|
18
16
|
"mcp",
|
|
19
17
|
"cli",
|
|
20
18
|
"plugin",
|
|
@@ -365,10 +363,6 @@ export type DeviceConfig = z.infer<typeof DeviceConfigSchema>;
|
|
|
365
363
|
export type AcpAgentConfig = z.infer<typeof AcpAgentConfigSchema>;
|
|
366
364
|
export type EndpointConfig = z.infer<typeof EndpointConfigSchema>;
|
|
367
365
|
export const CapabilitySchema = z.discriminatedUnion("kind", [
|
|
368
|
-
z.object({ id: entryId, kind: z.literal("devops"), config: z.object({}) }),
|
|
369
|
-
// A pnpm+turbo monorepo the user scaffolds as its own repo, named by `id`; apps are added afterwards from its
|
|
370
|
-
// operator panel.
|
|
371
|
-
z.object({ id: entryId, kind: z.literal("monorepo"), config: z.object({}) }),
|
|
372
366
|
z.object({ id: entryId, kind: z.literal("mcp"), config: McpConfigSchema }),
|
|
373
367
|
z.object({ id: entryId, kind: z.literal("cli"), config: CliConfigSchema }),
|
|
374
368
|
z.object({ id: entryId, kind: z.literal("plugin"), config: PluginConfigSchema }),
|
package/src/schemas/issues.ts
CHANGED
|
@@ -83,6 +83,58 @@ export const IssueRunSchema = z.object({
|
|
|
83
83
|
});
|
|
84
84
|
export type IssueRun = z.infer<typeof IssueRunSchema>;
|
|
85
85
|
|
|
86
|
+
// Who reported it, when the reporter was another sandbox on the owner's account (account-level report routing). Read
|
|
87
|
+
// from the platform-signed pass, except `conversationId`, which the sending daemon names for its own conversation.
|
|
88
|
+
export const IssueSenderSchema = z.object({
|
|
89
|
+
sandboxId: z.string().max(40).describe("The reporting sandbox's id."),
|
|
90
|
+
sandboxName: z.string().max(120).describe("Its name on your account."),
|
|
91
|
+
project: z.string().max(200).describe("The project it reported about, as this sandbox claims it."),
|
|
92
|
+
conversationId: z.string().max(120).optional().describe("The conversation over there that reported it."),
|
|
93
|
+
});
|
|
94
|
+
export type IssueSender = z.infer<typeof IssueSenderSchema>;
|
|
95
|
+
|
|
96
|
+
// POSTed to /account/report by another of the owner's sandboxes, under a pass (sandbox-contract policy/sandbox-pass.ts).
|
|
97
|
+
// Only what groups: an agent's problem is a `detection` (or a `crash` with a stack), never an ungrouped `report`, so five
|
|
98
|
+
// sandboxes seeing one broken thing fold into one issue. `times` carries repeats the sender folded while it could not
|
|
99
|
+
// deliver.
|
|
100
|
+
export const AccountProblemSchema = IssueReportSchema.extend({ kind: z.enum(["crash", "detection"]) });
|
|
101
|
+
export type AccountProblem = z.infer<typeof AccountProblemSchema>;
|
|
102
|
+
export const AccountReportSchema = z.object({
|
|
103
|
+
report: AccountProblemSchema,
|
|
104
|
+
conversationId: z.string().max(120).optional(),
|
|
105
|
+
times: z.number().int().min(1).max(10_000).optional(),
|
|
106
|
+
});
|
|
107
|
+
export type AccountReport = z.infer<typeof AccountReportSchema>;
|
|
108
|
+
|
|
109
|
+
// The sending side, over loopback from the `projects report` command: a problem for whichever sandbox on the owner's
|
|
110
|
+
// account claims `project`, and what came of it (delivered now, waiting in the outbox, or refused for good).
|
|
111
|
+
export const AccountSendSchema = z.object({
|
|
112
|
+
project: z.string().min(1).max(300),
|
|
113
|
+
report: AccountProblemSchema,
|
|
114
|
+
});
|
|
115
|
+
export type AccountSend = z.infer<typeof AccountSendSchema>;
|
|
116
|
+
export const AccountSendOutcomeSchema = z.discriminatedUnion("state", [
|
|
117
|
+
z.object({ state: z.literal("delivered"), to: z.string(), id: z.string() }),
|
|
118
|
+
z.object({ state: z.literal("queued"), to: z.string().optional(), reason: z.string(), times: z.number() }),
|
|
119
|
+
z.object({ state: z.literal("refused"), reason: z.string() }),
|
|
120
|
+
]);
|
|
121
|
+
export type AccountSendOutcome = z.infer<typeof AccountSendOutcomeSchema>;
|
|
122
|
+
export const AccountOutboxSchema = z.object({
|
|
123
|
+
waiting: z.array(
|
|
124
|
+
z.object({
|
|
125
|
+
id: z.string(),
|
|
126
|
+
project: z.string(),
|
|
127
|
+
title: z.string(),
|
|
128
|
+
times: z.number(),
|
|
129
|
+
firstAt: z.number(),
|
|
130
|
+
nextAt: z.number(),
|
|
131
|
+
lastError: z.string().optional(),
|
|
132
|
+
}),
|
|
133
|
+
),
|
|
134
|
+
});
|
|
135
|
+
export type AccountOutbox = z.infer<typeof AccountOutboxSchema>;
|
|
136
|
+
export const AccountProjectsSchema = z.object({ projects: z.array(z.string()) });
|
|
137
|
+
|
|
86
138
|
// One group; the id is the fingerprint and the filename, never in the body, so a body cannot disagree with its own
|
|
87
139
|
// grouping.
|
|
88
140
|
export const IssueSchema = z.object({
|
|
@@ -106,6 +158,8 @@ export const IssueSchema = z.object({
|
|
|
106
158
|
// Stored, since a restart can't derive it from a count and timestamp.
|
|
107
159
|
firedAt: z.number().optional().describe("What the count stood at the last time this woke an agent."),
|
|
108
160
|
runs: z.array(IssueRunSchema).max(20).optional().describe("The turns started for it."),
|
|
161
|
+
// Set only by the daemon, from a pass the platform signed: never a field a reporter can type.
|
|
162
|
+
sender: IssueSenderSchema.optional().describe("The sandbox on your account that reported the latest one, when another sandbox did."),
|
|
109
163
|
});
|
|
110
164
|
export type Issue = z.infer<typeof IssueSchema>;
|
|
111
165
|
|