@capybara-hq/plugin-sdk 0.1.0-rc.8 → 0.1.0-rc.80
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 +1 -1
- package/agent-docs/agent-templates.md +14 -2
- package/agent-docs/concepts.md +14 -5
- package/agent-docs/connector-templates.md +11 -3
- package/agent-docs/extension-points/channel.md +1 -1
- package/agent-docs/extension-points/context.md +15 -0
- package/agent-docs/extension-points/device-provider.md +15 -0
- package/agent-docs/extension-points/file-preview.md +3 -1
- package/agent-docs/extension-points/identity-source.md +2 -0
- package/agent-docs/extension-points/model-provider.md +3 -1
- package/agent-docs/extension-points/object-store.md +2 -0
- package/agent-docs/extension-points/push-provider.md +17 -0
- package/agent-docs/extensions.md +77 -4
- package/agent-docs/plugin-format.md +45 -10
- package/agent-docs/setup.md +54 -0
- package/dist/agent-template.d.ts +15 -6
- package/dist/agent-template.js +32 -13
- package/dist/avatar-presets.d.ts +8 -0
- package/dist/avatar-presets.js +17 -0
- package/dist/bootstrap.d.ts +109 -1
- package/dist/bootstrap.js +185 -2
- package/dist/cards.d.ts +60 -13
- package/dist/cards.js +88 -18
- package/dist/channel.d.ts +128 -47
- package/dist/channel.js +10 -5
- package/dist/client-css.d.ts +36 -0
- package/dist/client-css.js +326 -0
- package/dist/client-section.d.ts +35 -0
- package/dist/client-section.js +133 -0
- package/dist/config-ui.d.ts +28 -6
- package/dist/config-ui.js +88 -25
- package/dist/config-url-fetch.d.ts +19 -0
- package/dist/config-url-fetch.js +43 -0
- package/dist/connector-auth.d.ts +13 -2
- package/dist/connector-auth.js +82 -8
- package/dist/connector.d.ts +74 -32
- package/dist/context.d.ts +40 -0
- package/dist/context.js +2 -0
- package/dist/ctx.d.ts +224 -30
- package/dist/ctx.js +9 -1
- package/dist/define-extension.d.ts +23 -13
- package/dist/define-extension.js +19 -5
- package/dist/device-denied-paths.d.ts +20 -0
- package/dist/device-denied-paths.js +118 -0
- package/dist/device-operation.d.ts +339 -0
- package/dist/device-operation.js +312 -0
- package/dist/device-protocol.d.ts +285 -50
- package/dist/device-protocol.js +755 -90
- package/dist/device-provider.d.ts +780 -0
- package/dist/device-provider.js +409 -0
- package/dist/device-service.d.ts +126 -0
- package/dist/device-service.js +211 -0
- package/dist/dial-in.d.ts +286 -0
- package/dist/dial-in.js +213 -0
- package/dist/directory.d.ts +15 -12
- package/dist/extension-point.d.ts +2 -0
- package/dist/extension-point.js +7 -3
- package/dist/field-meta.d.ts +19 -0
- package/dist/field-meta.js +54 -0
- package/dist/file-preview.d.ts +43 -10
- package/dist/git-hosts.d.ts +53 -0
- package/dist/git-hosts.js +98 -0
- package/dist/hooks.d.ts +125 -20
- package/dist/hooks.js +5 -0
- package/dist/http-access.d.ts +71 -0
- package/dist/http-access.js +12 -0
- package/dist/identity.d.ts +70 -9
- package/dist/identity.js +46 -1
- package/dist/index.d.ts +28 -4
- package/dist/index.js +28 -4
- package/dist/model-params.d.ts +41 -22
- package/dist/model-params.js +28 -15
- package/dist/model.d.ts +210 -75
- package/dist/model.js +152 -19
- package/dist/native-failure.d.ts +13 -0
- package/dist/native-failure.js +31 -0
- package/dist/net.d.ts +52 -0
- package/dist/net.js +34 -0
- package/dist/network-classes.d.ts +98 -0
- package/dist/network-classes.js +291 -0
- package/dist/permissions.d.ts +65 -22
- package/dist/permissions.js +139 -43
- package/dist/platform-only.d.ts +27 -0
- package/dist/platform-only.js +35 -0
- package/dist/plugin-manifest.d.ts +30 -6
- package/dist/plugin-manifest.js +147 -55
- package/dist/plugin-package.d.ts +82 -39
- package/dist/plugin-package.js +68 -41
- package/dist/push.d.ts +75 -0
- package/dist/push.js +87 -0
- package/dist/sandbox-linux-runtime-source.d.ts +1 -0
- package/dist/sandbox-linux-runtime-source.js +2343 -0
- package/dist/sandbox-native-runtime-source.d.ts +10 -0
- package/dist/sandbox-native-runtime-source.js +480 -0
- package/dist/sandbox-runtime-source.d.ts +47 -0
- package/dist/sandbox-runtime-source.js +73 -0
- package/dist/sandbox-write-denies.d.ts +139 -0
- package/dist/sandbox-write-denies.js +869 -0
- package/dist/secret.d.ts +8 -2
- package/dist/secret.js +11 -4
- package/dist/setup-check.d.ts +128 -0
- package/dist/setup-check.js +142 -0
- package/dist/setup-guide-parse.d.ts +121 -0
- package/dist/setup-guide-parse.js +356 -0
- package/dist/setup-guide-render.d.ts +45 -0
- package/dist/setup-guide-render.js +351 -0
- package/dist/setup-guide.d.ts +86 -72
- package/dist/setup-guide.js +340 -108
- package/dist/shell-capabilities.d.ts +211 -0
- package/dist/shell-capabilities.js +44 -0
- package/dist/shell-environment.d.ts +57 -0
- package/dist/shell-environment.js +21 -0
- package/dist/skill-invocation.d.ts +5 -0
- package/dist/skill-invocation.js +4 -3
- package/dist/skill.d.ts +27 -17
- package/dist/skill.js +40 -26
- package/dist/storage.d.ts +52 -25
- package/dist/svg-viewbox.d.ts +10 -0
- package/dist/svg-viewbox.js +24 -0
- package/dist/theme-assets.d.ts +25 -9
- package/dist/theme-assets.js +87 -47
- package/dist/theme-tokens.generated.d.ts +26 -2
- package/dist/theme-tokens.generated.js +17 -0
- package/dist/theme.d.ts +48 -10
- package/dist/theme.js +100 -21
- package/dist/tool.d.ts +156 -30
- package/dist/tool.js +91 -9
- package/dist/ui-parts.d.ts +23 -0
- package/dist/ui-parts.js +385 -0
- package/dist/ui-resolve.d.ts +35 -0
- package/dist/ui-resolve.js +42 -0
- package/dist/ui-slots.d.ts +65 -0
- package/dist/ui-slots.js +261 -0
- package/dist/ui.d.ts +245 -77
- package/dist/ui.js +104 -27
- package/dist/url.d.ts +4 -1
- package/dist/url.js +4 -1
- package/dist/web.d.ts +26 -20
- package/package.json +12 -1
- package/schemas/bootstrap-extra.v1.schema.json +186 -0
- package/schemas/bootstrap.v1.schema.json +20 -0
- package/schemas/connector-template.v1.schema.json +62 -4
- package/schemas/plugin.v1.schema.json +74 -143
- package/schemas/theme.v1.schema.json +77 -0
- package/agent-docs/extension-points/sandbox.md +0 -15
- package/dist/org-access.d.ts +0 -27
- package/dist/org-access.js +0 -35
- package/dist/sandbox.d.ts +0 -254
- package/dist/sandbox.js +0 -153
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What restricted execution may never write inside a granted root: one policy for every consumer
|
|
3
|
+
* (the Linux launcher's broker, `native-files.py`, the device agent and, as far as its glob
|
|
4
|
+
* patterns can express it, the macOS runtime). It keeps a later unsandboxed tool run by the owner
|
|
5
|
+
* from executing what a restricted command left behind.
|
|
6
|
+
*
|
|
7
|
+
* 1. {@link SANDBOX_MANDATORY_WRITE_DENIES}: component sequences denied wherever they appear (the
|
|
8
|
+
* entry and everything beneath it): shell startup and logout files, git's global files, direnv
|
|
9
|
+
* and npm configuration, editor and agent configuration, and the OS persistence locations
|
|
10
|
+
* (launchd, systemd, environment.d, XDG and KDE autostart, X session files, fish). Entries are
|
|
11
|
+
* written already folded. {@link SANDBOX_SYSTEM_WRITE_DENIES}: absolute system paths denied
|
|
12
|
+
* with everything beneath them (the crontab and at spools), anchored at `/`.
|
|
13
|
+
* 2. Inside a `.git` directory (the first `.git` component of a path) only git's ordinary
|
|
14
|
+
* internals are writable, an allowlist ({@link SANDBOX_GIT_ALLOWED_DIRECTORIES},
|
|
15
|
+
* {@link SANDBOX_GIT_ALLOWED_FILES}, `info/exclude`). Everything else there is denied:
|
|
16
|
+
* `config`, `config.worktree`, `commondir`, `gitdir`, `hooks/**`, `info/attributes`, unknown
|
|
17
|
+
* names. The gitdirs of submodules (`modules/<name>/`, where a name may contain `/`) and
|
|
18
|
+
* worktrees (`worktrees/<name>/`) follow the same allowlist; a submodule path is refused when
|
|
19
|
+
* any reading of its name would make it a denied internal.
|
|
20
|
+
* 3. Outside `.git`, a file named `HEAD` is denied: with `objects/` and `refs/` it would make a
|
|
21
|
+
* bare-repository lookalike whose configuration git honours.
|
|
22
|
+
* 4. Moves ({@link isSandboxMoveDenied}): neither end may be a denied write; nothing leaves a
|
|
23
|
+
* protected name ({@link SANDBOX_PROTECTED_PATH_NAMES}: `.git` and the single-component
|
|
24
|
+
* entries) except within the same protected directory; a directory is not moved under a
|
|
25
|
+
* protected name from outside it; no non-directory becomes `.git` (a `gitdir:` pointer). For a
|
|
26
|
+
* multi-component entry `[a, b, …]` (or an absolute system path) a destination ending in a
|
|
27
|
+
* proper prefix of it (`…/a`) takes no non-directory (a link there would redirect the entry)
|
|
28
|
+
* and no directory holding the entry's next component (`b`): a prepared directory never moves
|
|
29
|
+
* into place, while ordinary names (`library`, `.config`) stay movable. An ancestor of an
|
|
30
|
+
* anchored path (a system path, or a consumer's resolved target) never moves away.
|
|
31
|
+
*
|
|
32
|
+
* 5. Inside an allowlisted subtree nothing can make a repository: no `.git`, no `HEAD` except
|
|
33
|
+
* where git keeps one (`logs/HEAD`, `refs/remotes/<r>/HEAD`, …), and no `objects`, `commondir`
|
|
34
|
+
* or `gitdir` beside such a `HEAD`.
|
|
35
|
+
*
|
|
36
|
+
* 6. A component starting with {@link SANDBOX_RESERVED_NAME_PREFIX} (the broker's staging and
|
|
37
|
+
* quarantine names) is denied with everything beneath it.
|
|
38
|
+
*
|
|
39
|
+
* Names are compared after Unicode NFKC normalization and full case folding
|
|
40
|
+
* ({@link sandboxFoldName}, identical to Python's `casefold`). Known limitations: a
|
|
41
|
+
* restricted command cannot `git init`, add a submodule or worktree, or create a bare repository;
|
|
42
|
+
* continuing an operation it started (`git rebase --continue`) runs the todo list it wrote, like
|
|
43
|
+
* any script it wrote; files that tools execute by convention without configuration (for example
|
|
44
|
+
* `package.json` scripts) are not covered; a forged rebase or cherry-pick in progress is possible
|
|
45
|
+
* (its state directories are writable for git's own use) and continuing it runs its `exec` lines.
|
|
46
|
+
* The macOS worker expresses this policy as ordered Seatbelt regex rules
|
|
47
|
+
* (`packages/device/src/exec/mac-write-policy.ts`).
|
|
48
|
+
*
|
|
49
|
+
* Constraints on consumers:
|
|
50
|
+
*
|
|
51
|
+
* - The policy judges the path it is given. A protected home location reached through a symbolic
|
|
52
|
+
* link (`~/.config` or `~/Library` linked elsewhere, as dotfile managers do) is denied only at
|
|
53
|
+
* its resolved target: a device worker resolves the protected home locations at operation start
|
|
54
|
+
* and adds their resolved targets as absolute denies.
|
|
55
|
+
* - The move check needs the entries of a moved directory. A consumer passes them from the source
|
|
56
|
+
* descriptor; the Python `move_denied` otherwise lists the source path, refusing when it cannot.
|
|
57
|
+
* A listing is a snapshot: a concurrent writer could add the next component between the check
|
|
58
|
+
* and the rename, so a consumer that can re-checks the destination after the rename.
|
|
59
|
+
*/
|
|
60
|
+
export declare const SANDBOX_MANDATORY_WRITE_DENIES: readonly (readonly string[])[];
|
|
61
|
+
/**
|
|
62
|
+
* Locations denied only directly under the device owner's home, with everything beneath them, never
|
|
63
|
+
* elsewhere: `~/bin`, a directory many shells put on `PATH`, where a planted program would shadow a
|
|
64
|
+
* system one in the owner's later unsandboxed shell (a project's own `bin/` stays writable).
|
|
65
|
+
* Consumers anchor each entry at the home they protect: the device workers add it, and the target
|
|
66
|
+
* of a link it is, as absolute denies; the kernel never proposes it as a write directory
|
|
67
|
+
* ({@link isSandboxHomeWriteDenied}). `~/.local/bin` and `~/.cargo/bin` are
|
|
68
|
+
* {@link SANDBOX_MANDATORY_WRITE_DENIES} entries.
|
|
69
|
+
*/
|
|
70
|
+
export declare const SANDBOX_HOME_WRITE_DENIES: readonly (readonly string[])[];
|
|
71
|
+
/**
|
|
72
|
+
* System runtime and socket directories (compared folded, anchored at `/`): other programs keep
|
|
73
|
+
* their UNIX sockets and device nodes there (`/run/user/<uid>/bus`, `/var/run/docker.sock`,
|
|
74
|
+
* `/dev`, `/proc`), so a restricted write root never is one, lies inside one or contains one
|
|
75
|
+
* ({@link sandboxRuntimeDirectoryOf}).
|
|
76
|
+
*/
|
|
77
|
+
export declare const SANDBOX_RUNTIME_DIRECTORIES: readonly string[];
|
|
78
|
+
/**
|
|
79
|
+
* Absolute system paths denied with everything beneath them, compared folded and anchored at `/`:
|
|
80
|
+
* the crontab and at spools of Linux (`/var/spool/cron` in its `crontabs` and `tabs` layouts,
|
|
81
|
+
* `/var/spool/at`) and macOS (`/private/var/at`, also spelled `/var/at`; `/usr/lib/cron/tabs` is a
|
|
82
|
+
* link resolving there). Never protected move names: a project's own `at/` or `spool/` stays
|
|
83
|
+
* ordinary.
|
|
84
|
+
*/
|
|
85
|
+
export declare const SANDBOX_SYSTEM_WRITE_DENIES: readonly string[];
|
|
86
|
+
/**
|
|
87
|
+
* The name prefix the Linux broker reserves for its own staging (a directory checked before it
|
|
88
|
+
* moves into a guarded place) and quarantine names. Any path with a component starting with it
|
|
89
|
+
* (compared folded) is denied to every sandboxed write, so nothing sandboxed can create, write
|
|
90
|
+
* into, or move into or out of such a directory.
|
|
91
|
+
*/
|
|
92
|
+
export declare const SANDBOX_RESERVED_NAME_PREFIX = ".capybara-staging-";
|
|
93
|
+
/** Directories inside a gitdir whose whole subtree is writable (objects, refs, operation state). */
|
|
94
|
+
export declare const SANDBOX_GIT_ALLOWED_DIRECTORIES: readonly string[];
|
|
95
|
+
/** Entries directly in a gitdir that are writable, each also with a `.lock` suffix. */
|
|
96
|
+
export declare const SANDBOX_GIT_ALLOWED_FILES: readonly string[];
|
|
97
|
+
/**
|
|
98
|
+
* For consumers that can only express denies as path patterns (the macOS runtime): the gitdir
|
|
99
|
+
* internals that run or redirect code, denied at any depth below `.git`. Such a consumer cannot
|
|
100
|
+
* express the allowlist or the `HEAD` rule exactly; see the rules above.
|
|
101
|
+
*/
|
|
102
|
+
export declare const SANDBOX_GIT_DENIED_INTERNALS: readonly string[];
|
|
103
|
+
/**
|
|
104
|
+
* Names nothing leaves, and no directory is moved under, from outside: `.git` and the
|
|
105
|
+
* single-component entries. A multi-component entry is guarded by its prefix rule instead (rule 4),
|
|
106
|
+
* so its first component (`library`, `.config`) stays an ordinary name.
|
|
107
|
+
*/
|
|
108
|
+
export declare const SANDBOX_PROTECTED_PATH_NAMES: readonly string[];
|
|
109
|
+
/** NFKC, then full case folding: the same as Python's `normalize("NFKC", s).casefold()`. */
|
|
110
|
+
export declare function sandboxFoldName(name: string): string;
|
|
111
|
+
/**
|
|
112
|
+
* The system runtime or socket directory a restricted write root `root` (absolute, normalized) is,
|
|
113
|
+
* lies inside or contains, or null: {@link SANDBOX_RUNTIME_DIRECTORIES} with everything beneath
|
|
114
|
+
* them; `/tmp` and `/private/tmp` themselves (a subdirectory is fine unless it is a known socket
|
|
115
|
+
* directory such as `/tmp/.X11-unix`, `/tmp/tmux-<uid>` or `/tmp/ssh-*`, or lies inside one); and
|
|
116
|
+
* every ancestor of one (`/var`, `/private`). The kernel's candidate builder and admission and the
|
|
117
|
+
* device's root check refuse such a root: a socket there may belong to a process outside the
|
|
118
|
+
* sandbox (the Linux broker also refuses every pathname UNIX connect to a socket the operation did
|
|
119
|
+
* not bind itself).
|
|
120
|
+
*/
|
|
121
|
+
export declare function sandboxRuntimeDirectoryOf(root: string): string | null;
|
|
122
|
+
/**
|
|
123
|
+
* Whether `path` (absolute, normalized) is a {@link SANDBOX_HOME_WRITE_DENIES} location under
|
|
124
|
+
* `home`, or beneath one (names compared folded).
|
|
125
|
+
*/
|
|
126
|
+
export declare function isSandboxHomeWriteDenied(path: string, home: string): boolean;
|
|
127
|
+
/** Whether restricted execution may never write `path` (an absolute, normalized path). */
|
|
128
|
+
export declare function isSandboxWriteDenied(path: string): boolean;
|
|
129
|
+
/**
|
|
130
|
+
* Whether a restricted rename or link of `source` to `destination` is refused (rule 4).
|
|
131
|
+
* `sourceEntries` are the names directly in a moved directory; the check needs them only when the
|
|
132
|
+
* destination ends in a proper prefix of a guarded entry, and without them it refuses.
|
|
133
|
+
*/
|
|
134
|
+
export declare function isSandboxMoveDenied(source: string, destination: string, sourceIsDirectory: boolean, sourceEntries?: readonly string[]): boolean;
|
|
135
|
+
/**
|
|
136
|
+
* The same policy for the Python consumers (`linux-sandbox.py`, `native-files.py`): defines
|
|
137
|
+
* `write_denied(path)` and `move_denied(source, destination, is_dir)` with identical rules.
|
|
138
|
+
*/
|
|
139
|
+
export declare const SANDBOX_WRITE_POLICY_PYTHON: string;
|