@quantiya/codevibe-core 2.0.80 → 2.0.82

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.
@@ -605,6 +605,22 @@ export declare function parseTaskCommand(text: string): {
605
605
  ordinal: number | null;
606
606
  } | null;
607
607
  };
608
+ export declare const AGY_ADVISORY_LISTING_MAX_ENTRIES = 500;
609
+ export declare const AGY_ADVISORY_LISTING_MAX_BYTES = 16384;
610
+ export declare const AGY_ADVISORY_IGNORED_DIRS: Set<string>;
611
+ /**
612
+ * Warning and instructions injected into advisory Antigravity turns under macOS Seatbelt sandbox.
613
+ * In plan mode under Seatbelt confinement, command execution is denied; files must be read via read_file.
614
+ */
615
+ export declare const AGY_COMMAND_TOOL_SEATBELT_WARNING = "Your command tool cannot run in this sandbox: do not call it. CodeVibe listed the folder for you below (relative paths with '/' separator; literal backslashes escaped as \\\\, control characters escaped as \\xNN or \\uNNNN; a trailing / marks a folder). Read files with your file-reading tool, using absolute paths under the folder.";
616
+ /**
617
+ * Bounds-checked directory walk for advisory Antigravity turns under macOS Seatbelt.
618
+ * In read-only plan mode, agy cannot execute command tools without PTY/tmpdir permissions.
619
+ * Providing this bounded folder listing directly in the prompt context allows agy to know
620
+ * the workspace layout and inspect target files via read_file without running shell commands.
621
+ */
622
+ export declare function formatAgyWorkspaceListing(workdir: string, maxEntries?: number, maxBytes?: number): string;
623
+ export declare function agyReadOnlyWorkdirPreamble(workdir: string, listing?: string): string;
608
624
  export declare function readOnlyAgentPrompt(args: {
609
625
  agent: LocalExecutorAgentKind;
610
626
  intent: AgentMentionIntent;
@@ -612,6 +628,7 @@ export declare function readOnlyAgentPrompt(args: {
612
628
  workingDir: string;
613
629
  allowRepositoryTools: boolean;
614
630
  hasRetainedPage?: boolean;
631
+ folderListing?: string;
615
632
  }): string;
616
633
  export declare function readOnlyAdvisoryAllowsRepositoryTools(_input: string): boolean;
617
634
  export declare function applyReadOnlyAdvisoryToolPolicy(agent: LocalExecutorAgentKind, plan: ReturnType<typeof buildImplementorArgv>, allowRepositoryTools: boolean, workingDir?: string, attachments?: readonly string[]): ReturnType<typeof buildImplementorArgv>;
@@ -0,0 +1,93 @@
1
+ import { type WorkspaceRootAuthority } from '../local-executor/workspace-authority';
2
+ import type { HostDescendantReap } from '../local-executor/descendant-reaper';
3
+ import type { CommandRunner, EgressFidelity, Substrate, SubstrateHandle, SubstrateProc, SubstrateSpec } from './types';
4
+ export declare const SECCOMP_RET_KILL_PROCESS = 2147483648;
5
+ export declare const SECCOMP_RET_ALLOW = 2147418112;
6
+ export declare const SECCOMP_RET_ERRNO = 327680;
7
+ export declare const EAFNOSUPPORT = 97;
8
+ export declare const ENOSYS = 38;
9
+ export declare const AUDIT_ARCH_X86_64 = 3221225534;
10
+ export declare const AUDIT_ARCH_AARCH64 = 3221225655;
11
+ export declare const AUDIT_ARCH_I386 = 1073741827;
12
+ export declare const AUDIT_ARCH_ARM = 1073741864;
13
+ /**
14
+ * Generates the exact 56-instruction classic-BPF seccomp filter (448 bytes)
15
+ * specified in WORKSPACE-HARDENING-DESIGN §6.2.
16
+ *
17
+ * Rules:
18
+ * - socket(AF_VSOCK, …) and socket(AF_UNIX, …) → EAFNOSUPPORT (97)
19
+ * - socketpair() → EAFNOSUPPORT unless type low 4 bits is SOCK_STREAM (1) or SOCK_SEQPACKET (5)
20
+ * - io_uring_setup, io_uring_enter, io_uring_register → ENOSYS (38)
21
+ * - Branches on ABI: x86_64, x32, i386 (socketcall SYS_SOCKET and SYS_SOCKETPAIR → ENOSYS),
22
+ * aarch64, arm (socketcall SYS_SOCKET and SYS_SOCKETPAIR → ENOSYS)
23
+ * - Any other ABI → SECCOMP_RET_KILL_PROCESS
24
+ * - All other system calls allowed
25
+ */
26
+ export declare function generateSeccompBpfFilter(): Buffer;
27
+ export interface BubblewrapDeps {
28
+ runner?: CommandRunner;
29
+ platform?: NodeJS.Platform;
30
+ stateRoot?: string;
31
+ cacheRoot?: string;
32
+ desktopPid?: number;
33
+ uid?: number;
34
+ gid?: number;
35
+ homedir?: string;
36
+ fsShim?: {
37
+ lstatSync?: (p: string) => {
38
+ isSymbolicLink: () => boolean;
39
+ };
40
+ readlinkSync?: (p: string) => string;
41
+ existsSync?: (p: string) => boolean;
42
+ realpathSync?: (p: string) => string;
43
+ };
44
+ }
45
+ export declare class BubblewrapHandle implements SubstrateHandle {
46
+ readonly id: string;
47
+ readonly egressFidelity: EgressFidelity;
48
+ private readonly runner;
49
+ private readonly fullPrefix;
50
+ private readonly filterPath;
51
+ private readonly cleanupPaths;
52
+ private readonly workdir;
53
+ private readonly workdirAuthority?;
54
+ private readonly scratchAuthority?;
55
+ private proc;
56
+ private procExited;
57
+ private tornDown;
58
+ private teardownStarted;
59
+ private executed;
60
+ private inFlightExec;
61
+ private teardownPromise;
62
+ constructor(opts: {
63
+ id: string;
64
+ runner: CommandRunner;
65
+ fullPrefix: readonly string[];
66
+ filterPath: string;
67
+ cleanupPaths: string[];
68
+ workdir: string;
69
+ workdirAuthority?: WorkspaceRootAuthority;
70
+ scratchAuthority?: WorkspaceRootAuthority;
71
+ });
72
+ exec(argv: string[], opts: {
73
+ stdinTty: boolean;
74
+ timeoutMs?: number;
75
+ signal?: AbortSignal;
76
+ descendantReap?: HostDescendantReap;
77
+ }): Promise<SubstrateProc>;
78
+ teardown(): Promise<void>;
79
+ private performTeardown;
80
+ }
81
+ export declare class BubblewrapSubstrate implements Substrate {
82
+ private readonly runner;
83
+ private readonly platform;
84
+ private readonly stateRoot;
85
+ private readonly cacheRoot?;
86
+ private readonly desktopPid;
87
+ private readonly uid;
88
+ private readonly gid;
89
+ private readonly homedir;
90
+ private readonly fsShim?;
91
+ constructor(deps?: BubblewrapDeps);
92
+ launch(spec: SubstrateSpec): Promise<SubstrateHandle>;
93
+ }
@@ -17,6 +17,7 @@ export declare class ChildProcessCommandRunner implements CommandRunner {
17
17
  signal?: AbortSignal;
18
18
  env?: Readonly<Record<string, string>>;
19
19
  cwd?: string;
20
+ detached?: boolean;
20
21
  cwdAuthority?: WorkspaceRootAuthority;
21
22
  launchPathAuthorities?: readonly WorkspaceRootAuthority[];
22
23
  descendantReap?: HostDescendantReap;
@@ -4,6 +4,10 @@ export { DockerSubstrate } from "./docker";
4
4
  export type { DockerSubstrateDeps } from "./docker";
5
5
  export { SandboxExecSubstrate, buildSeatbeltProfile } from "./sandbox-exec";
6
6
  export type { SandboxExecDeps } from "./sandbox-exec";
7
+ export { BubblewrapSubstrate, generateSeccompBpfFilter } from "./bwrap";
8
+ export type { BubblewrapDeps } from "./bwrap";
9
+ export { buildPastaArgv, buildSetprivPrefix, IN_TIER_CLEANUP_PASTA, IN_TIER_CLEANUP_BROKER, } from "./pasta";
10
+ export type { PastaOptions } from "./pasta";
7
11
  export { SubstrateUnavailableError, SubstrateLaunchError } from "./errors";
8
12
  export { ChildProcessCommandRunner } from "./command-runner";
9
13
  export { HostEgressForwarder, defaultForwarderFactory } from "./forwarder";
@@ -0,0 +1,36 @@
1
+ export interface PastaOptions {
2
+ /**
3
+ * The namespace-to-host TCP port of the per-spawn broker proxy.
4
+ * - 'none' (or omitted): no port forwarding (-T none) — used for broker-less Antigravity.
5
+ * - number: forwards 127.0.0.1:<port> and [::1]:<port> to host — used for web-browsing Claude/Codex.
6
+ */
7
+ brokerPort?: number | 'none';
8
+ /**
9
+ * DNS forwarding address. Defaults to 169.254.1.1 per §6.2.
10
+ */
11
+ dnsForward?: string;
12
+ /**
13
+ * Executable name or path for pasta. Defaults to 'pasta'.
14
+ */
15
+ pastaBin?: string;
16
+ }
17
+ /**
18
+ * Builds the pasta command line prefix up to and including the `--` terminator.
19
+ */
20
+ export declare function buildPastaArgv(opts?: PastaOptions): string[];
21
+ /**
22
+ * Builds the setpriv parent-death checking wrapper prefix per §6.2.
23
+ * Compares $PPID with the desktop PID and exits 97 if mismatched before execing payload.
24
+ */
25
+ export declare function buildSetprivPrefix(desktopPid?: number): string[];
26
+ /**
27
+ * In-tier bash step for the open-egress (pasta) tier:
28
+ * Closes all fds above 2, opens filter as fd 9, and execs bwrap with --seccomp 9.
29
+ */
30
+ export declare const IN_TIER_CLEANUP_PASTA = "for f in /proc/self/fd/*; do n=${f##*/}; case $n in 0|1|2) ;; *) eval \"exec $n>&-\" 2>/dev/null;; esac; done; exec 9<\"$0\" && exec bwrap --seccomp 9 \"$@\"";
31
+ /**
32
+ * In-tier bash step for the isolated broker tier (no pasta):
33
+ * Keeps fds 0-3 (fd 3 is the broker relay socketpair), closes fds above 3,
34
+ * opens filter as fd 9, and execs bwrap with --seccomp 9.
35
+ */
36
+ export declare const IN_TIER_CLEANUP_BROKER = "for f in /proc/self/fd/*; do n=${f##*/}; case $n in 0|1|2|3) ;; *) eval \"exec $n>&-\" 2>/dev/null;; esac; done; exec 9<\"$0\" && exec bwrap --seccomp 9 \"$@\"";
@@ -6,7 +6,7 @@ import type { HostDescendantReap } from "../local-executor/descendant-reaper";
6
6
  * A3-after-C2] — declared so the union admits the hosted runner without
7
7
  * reopening the contract; not implemented in Rung 1.
8
8
  */
9
- export type IsolationTech = "docker" | "sandbox_exec" | "firecracker";
9
+ export type IsolationTech = "docker" | "sandbox_exec" | "bubblewrap" | "firecracker";
10
10
  /**
11
11
  * How tightly the substrate can pin egress to the single broker
12
12
  * destination.
@@ -275,6 +275,8 @@ export interface CommandRunner {
275
275
  env?: Readonly<Record<string, string>>;
276
276
  /** Child working directory. Absent → inherit the parent's cwd. */
277
277
  cwd?: string;
278
+ /** Whether the child process is spawned detached from parent process group. */
279
+ detached?: boolean;
278
280
  /** Exact cwd incarnation held through native process creation. */
279
281
  cwdAuthority?: WorkspaceRootAuthority;
280
282
  /**
@@ -46,6 +46,10 @@ export interface EngageSubstrateInput {
46
46
  * Default true (writes permitted to workdir).
47
47
  */
48
48
  writableWorkdir?: boolean;
49
+ /** Optional spawn identifier for per-spawn private homes / filters. */
50
+ spawnId?: string;
51
+ /** Optional home dir override (injectable for tests). */
52
+ homedir?: string;
49
53
  /** F-P46a-4 — the implementor spawn's process-tree id (descendant reaping marker). */
50
54
  processTreeId?: string;
51
55
  /** Ladder deps (injectable for tests). */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quantiya/codevibe-core",
3
- "version": "2.0.80",
3
+ "version": "2.0.82",
4
4
  "description": "Core library for CodeVibe plugins - shared keychain, crypto, AppSync, and auth functionality",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",