@quantiya/codevibe-core 2.0.92 → 2.0.94

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.
Files changed (81) hide show
  1. package/dist/adapter/registry.d.ts +2 -2
  2. package/dist/appsync/sync-deferred-inputs.d.ts +2 -2
  3. package/dist/appsync/sync-desktop-registration.d.ts +2 -2
  4. package/dist/appsync/sync-mobile-echo.d.ts +16 -16
  5. package/dist/appsync/sync-prompt-publication.d.ts +8 -8
  6. package/dist/appsync/sync-shell-source.d.ts +18 -18
  7. package/dist/appsync/sync-source-cursor.d.ts +30 -30
  8. package/dist/commerce/upgrade-handoff.d.ts +11 -0
  9. package/dist/companion-mode/codex-native-question-reply.d.ts +10 -1
  10. package/dist/companion-mode/codex-native-state.d.ts +110 -110
  11. package/dist/index.d.ts +1 -1
  12. package/dist/index.js +2605 -2306
  13. package/dist/local-executor/anchored-cas.d.ts +78 -6
  14. package/dist/local-executor/anchored-fs.d.ts +32 -0
  15. package/dist/local-executor/blob-store.d.ts +95 -0
  16. package/dist/local-executor/change-manifest-store.d.ts +32 -0
  17. package/dist/local-executor/change-manifest.d.ts +50 -0
  18. package/dist/local-executor/durable-store.d.ts +72 -15
  19. package/dist/local-executor/implementor-argv.d.ts +43 -7
  20. package/dist/local-executor/local-executor-impl.d.ts +57 -1
  21. package/dist/local-executor/nolink-apply.d.ts +22 -2
  22. package/dist/local-executor/revert-runner.d.ts +3 -0
  23. package/dist/local-executor/shadow-apply-capabilities.d.ts +31 -2
  24. package/dist/local-executor/shadow-free-space.d.ts +25 -0
  25. package/dist/local-executor/shadow-protocol.d.ts +117 -18
  26. package/dist/local-executor/shadow-recovery.d.ts +28 -3
  27. package/dist/local-executor/shadow-task-intent.d.ts +29 -0
  28. package/dist/local-executor/shadow-volume-probe.d.ts +0 -14
  29. package/dist/local-executor/sharded-list.d.ts +32 -0
  30. package/dist/local-executor/snapshot-merge.d.ts +18 -0
  31. package/dist/local-executor/spawn-sweep-binary.d.ts +33 -0
  32. package/dist/local-executor/spawn-sweep.d.ts +3 -0
  33. package/dist/local-executor/store-dir-anchor.d.ts +48 -0
  34. package/dist/local-executor/tier-self-test.d.ts +57 -0
  35. package/dist/local-executor/types.d.ts +26 -0
  36. package/dist/local-executor/verification-gates/diff-sanity.d.ts +6 -0
  37. package/dist/local-executor/workspace-materializer.d.ts +17 -1
  38. package/dist/local-executor/workspace-shadow.d.ts +209 -7
  39. package/dist/orchestration-shell/audit-summary.d.ts +22 -0
  40. package/dist/orchestration-shell/bounded-shutdown.d.ts +2 -0
  41. package/dist/orchestration-shell/cli.js +64053 -57609
  42. package/dist/orchestration-shell/components/OrchestrationApp.d.ts +6 -1
  43. package/dist/orchestration-shell/decision-attempt-recovery.d.ts +14 -0
  44. package/dist/orchestration-shell/engine-projection.d.ts +98 -0
  45. package/dist/orchestration-shell/exit-guard.d.ts +18 -0
  46. package/dist/orchestration-shell/gate-decision-submit.d.ts +2 -0
  47. package/dist/orchestration-shell/index.d.ts +18 -0
  48. package/dist/orchestration-shell/quorum-loop.d.ts +265 -21
  49. package/dist/orchestration-shell/review-bundle.d.ts +77 -0
  50. package/dist/orchestration-shell/review-receipts.d.ts +100 -0
  51. package/dist/orchestration-shell/reviewer-seat-self-test.d.ts +43 -0
  52. package/dist/orchestration-shell/team-decompose.d.ts +1 -0
  53. package/dist/orchestration-shell/types.d.ts +24 -0
  54. package/dist/reviewer/provider.d.ts +28 -0
  55. package/dist/reviewer/providers/antigravity.d.ts +4 -2
  56. package/dist/reviewer/providers/claude.d.ts +7 -2
  57. package/dist/reviewer/providers/codex.d.ts +1 -1
  58. package/dist/session-resume/cli-resume.d.ts +1 -0
  59. package/dist/substrate/bwrap.d.ts +85 -0
  60. package/dist/substrate/command-runner.d.ts +1 -0
  61. package/dist/substrate/docker.d.ts +21 -0
  62. package/dist/substrate/grant-rule.d.ts +71 -0
  63. package/dist/substrate/pasta-isolation-check.d.ts +60 -0
  64. package/dist/substrate/pasta.d.ts +8 -0
  65. package/dist/substrate/relay-channel.d.ts +80 -0
  66. package/dist/substrate/review-mask.d.ts +20 -0
  67. package/dist/substrate/sandbox-exec.d.ts +48 -1
  68. package/dist/substrate/seatbelt-grants.d.ts +46 -0
  69. package/dist/substrate/spawn-records.d.ts +95 -0
  70. package/dist/substrate/tier-relay-main.d.ts +1 -0
  71. package/dist/substrate/tier-relay.d.ts +7 -0
  72. package/dist/substrate/tier-relay.js +3 -0
  73. package/dist/substrate/types.d.ts +48 -1
  74. package/dist/substrate-launch/engage-substrate.d.ts +16 -2
  75. package/dist/substrate-launch/fallback-ladder.d.ts +109 -12
  76. package/dist/substrate-launch/index.d.ts +1 -1
  77. package/dist/substrate-launch/task-folder.d.ts +26 -0
  78. package/native/linux-arm64/codevibe-spawn-sweep +0 -0
  79. package/native/linux-x64/codevibe-spawn-sweep +0 -0
  80. package/native/spawn-sweep.json +8 -0
  81. package/package.json +10 -5
@@ -1,12 +1,14 @@
1
1
  import type { DockerSubstrateDeps } from "../substrate/docker";
2
+ import type { BubblewrapDeps } from "../substrate/bwrap";
2
3
  import type { SandboxExecDeps } from "../substrate/sandbox-exec";
3
4
  import type { CommandRunner, Substrate } from "../substrate/types";
4
- /** Which rung of the §6 Q2 ladder was selected. */
5
- export type SubstrateTier = "docker" | "sandbox_exec" | "reduced_trust";
5
+ import { resolveSpawnSweepHelper } from "../local-executor/spawn-sweep-binary";
6
+ /** Which rung of the ladder was selected. */
7
+ export type SubstrateTier = "docker" | "sandbox_exec" | "bubblewrap" | "reduced_trust";
6
8
  /**
7
- * The ladder's result. A `substrate` is present for the two real tiers; the
8
- * `reduced_trust` tier has `substrate: null` (the LE takes the legacy path +
9
- * the prominent badge).
9
+ * The ladder's result. A `substrate` is present for the real tiers; the `reduced_trust` tier has `substrate: null` —
10
+ * no confinement is possible for this spawn on this host, which WORKSPACE-HARDENING-DESIGN §6.4 turns into a refusal
11
+ * (or a one-time opt-in), never a silent unconfined run.
10
12
  */
11
13
  export type SubstrateSelection = {
12
14
  tier: "docker";
@@ -19,16 +21,33 @@ export type SubstrateSelection = {
19
21
  /** Coarse egress (loopback-only) — reduced-trust BADGE per §3.1. */
20
22
  reducedTrust: true;
21
23
  reducedTrustReason: string;
24
+ } | {
25
+ tier: "bubblewrap";
26
+ substrate: Substrate;
27
+ /** §6.2: the broker tier (no network) is strict; the pasta tier (open egress) is coarse. */
28
+ reducedTrust: boolean;
29
+ reducedTrustReason?: string;
30
+ /** §6.2: `loopback` = the broker tier (fd-3 relay); `open` = the pasta tier. */
31
+ networkPosture: "loopback" | "open";
22
32
  } | {
23
33
  tier: "reduced_trust";
24
34
  substrate: null;
25
- /** No substrate — the moat is OFF this session (legacy path). */
35
+ /** No substrate — the moat is OFF (§6.4: refuse, or run only with the user's opt-in). */
26
36
  reducedTrust: true;
27
37
  reducedTrustReason: string;
28
38
  };
39
+ /**
40
+ * WORKSPACE-HARDENING-DESIGN §6.2 "Tier order on Linux" — what the spawn is, because the Linux tier depends on it:
41
+ * Claude/Codex → Docker when `docker version` succeeds, else the bubblewrap tier; agy → the bubblewrap tier under
42
+ * pasta; reviewer seats → the bubblewrap tier (§8.2, never Docker); anything else → §6.4.
43
+ */
44
+ export interface LadderRequest {
45
+ agent: "CLAUDE" | "CODEX" | "ANTIGRAVITY" | "GEMINI";
46
+ role: "implementor" | "reviewer";
47
+ }
29
48
  /** Injectable deps for the ladder (so it is testable without a real daemon). */
30
49
  export interface FallbackLadderDeps {
31
- /** Process layer for the `docker version` probe (default real). */
50
+ /** Process layer for the `docker version` / bubblewrap probes (default real). */
32
51
  runner?: CommandRunner;
33
52
  /** Platform override (default `process.platform`). */
34
53
  platform?: NodeJS.Platform;
@@ -36,14 +55,92 @@ export interface FallbackLadderDeps {
36
55
  dockerDeps?: DockerSubstrateDeps;
37
56
  /** Deps forwarded to the chosen SandboxExecSubstrate. */
38
57
  sandboxExecDeps?: SandboxExecDeps;
58
+ /** Deps forwarded to the chosen BubblewrapSubstrate. */
59
+ bubblewrapDeps?: BubblewrapDeps;
39
60
  /** Substrate factory overrides (tests inject stubs). */
40
61
  makeDocker?: (deps?: DockerSubstrateDeps) => Substrate;
41
62
  makeSandboxExec?: (deps?: SandboxExecDeps) => Substrate;
63
+ makeBubblewrap?: (deps?: BubblewrapDeps) => Substrate;
64
+ /** §6.5 probe override (tests); default {@link probeBubblewrapTier}, once per session. */
65
+ probeBubblewrap?: (runner: CommandRunner) => Promise<BubblewrapAvailability>;
66
+ }
67
+ /**
68
+ * §6.5 session-start checks for the bubblewrap tier. `broker` = what both tiers need (bubblewrap ≥ 0.9, a user
69
+ * namespace it can actually create, `setpriv`, `bash`, the shipped spawn-sweep helper answering `--selftest`); `open`
70
+ * = the broker tier's needs plus `pasta` running. A failed check names itself, so the §6.4 message can say how to
71
+ * fix it.
72
+ */
73
+ export interface BubblewrapAvailability {
74
+ broker: {
75
+ ok: true;
76
+ } | {
77
+ ok: false;
78
+ reason: string;
79
+ };
80
+ open: {
81
+ ok: true;
82
+ } | {
83
+ ok: false;
84
+ reason: string;
85
+ };
86
+ }
87
+ export interface ProbeBubblewrapDeps {
88
+ /** The packaged sweep helper (default `resolveSpawnSweepHelper`; tests inject it). */
89
+ resolveHelper?: typeof resolveSpawnSweepHelper;
90
+ /** §6.2 isolation self-check (default: the cached real check). */
91
+ checkIsolation?: (runner: CommandRunner) => Promise<{
92
+ ok: true;
93
+ } | {
94
+ ok: false;
95
+ reason: string;
96
+ }>;
42
97
  }
43
98
  /**
44
- * Resolve the §6 Q2 ladder. Returns the chosen substrate + tier, or the
45
- * reduced-trust sentinel. NEVER throws for "no substrate available" — that is a
46
- * VALID (reduced-trust) outcome the LE surfaces with a badge; it throws only on
47
- * a programming error.
99
+ * §6.2 — the isolation self-check, cached beside the tier checks in `~/.codevibe/substrate-checks/` by the pasta
100
+ * binary's SHA-256 and the host's IPv6 state (stable fields). A cached failure stays a failure until either changes.
101
+ */
102
+ export declare function cachedIsolationCheck(runner: CommandRunner, cacheDir?: string): Promise<{
103
+ ok: true;
104
+ } | {
105
+ ok: false;
106
+ reason: string;
107
+ }>;
108
+ export declare function probeBubblewrapTier(runner: CommandRunner, deps?: ProbeBubblewrapDeps): Promise<BubblewrapAvailability>;
109
+ /** @internal tests */
110
+ export declare function _resetBubblewrapProbeForTests(): void;
111
+ /**
112
+ * Resolve the ladder for one spawn. Returns the chosen substrate + tier, or the reduced-trust sentinel with the reason
113
+ * no confinement is possible (§6.4). NEVER throws for "no substrate available"; it throws only on a programming error.
114
+ */
115
+ export declare function selectSubstrate(deps?: FallbackLadderDeps, request?: LadderRequest): Promise<SubstrateSelection>;
116
+ /** §6.1 A-WEB (Hendry 2026-10-31): why a web-browsing turn cannot be confined — shared by the preflight and the engage. */
117
+ export declare function webTurnUnconfinableReason(agent: string): string;
118
+ /**
119
+ * WORKSPACE-HARDENING-DESIGN §6.4 — can an implementor of this agent be confined on this machine? Asked before a task
120
+ * starts: a task whose agent cannot be confined does not start, and the user is told why and offered to run it
121
+ * unconfined this once. The same rules as the spawn-time engage: a web-browsing turn cannot be confined (§6.1 A-WEB),
122
+ * Gemini is refused (§6.3), and otherwise the ladder decides (on Linux after the §6.5 session-start checks).
123
+ */
124
+ export declare function confinementPreflight(input: {
125
+ agentKind: LadderRequest["agent"];
126
+ webTurn: boolean;
127
+ }, deps?: FallbackLadderDeps): Promise<{
128
+ confinable: true;
129
+ tier: "docker" | "sandbox_exec" | "bubblewrap";
130
+ } | {
131
+ confinable: false;
132
+ reason: string;
133
+ }>;
134
+ /**
135
+ * §6.4 — the Linux bubblewrap tier's parts of the tier self-test cache key: the seccomp program's SHA-256 (it reaches
136
+ * bubblewrap through a file descriptor, so it is not in the argv), `bwrap --version`, the resolved `setpriv` and `bash`
137
+ * paths (both tiers start under the `setpriv` prefix and end in the `bash` step), and for an open-egress mode the
138
+ * pasta binary's SHA-256.
48
139
  */
49
- export declare function selectSubstrate(deps?: FallbackLadderDeps): Promise<SubstrateSelection>;
140
+ export declare function linuxTierSelfTestKeyParts(open: boolean, runner?: CommandRunner): Promise<{
141
+ filterSha256: string;
142
+ bwrapVersion: string;
143
+ setprivPath: string;
144
+ bashPath: string;
145
+ pastaSha256?: string;
146
+ }>;
@@ -1,6 +1,6 @@
1
1
  export { engageSubstrate, providerForAgent, } from "./engage-substrate";
2
2
  export type { EngageSubstrateInput, EngageResult, SubstrateEngaged, ReducedTrustEngaged, } from "./engage-substrate";
3
- export { selectSubstrate } from "./fallback-ladder";
3
+ export { confinementPreflight, linuxTierSelfTestKeyParts, selectSubstrate } from "./fallback-ladder";
4
4
  export type { SubstrateSelection, SubstrateTier, FallbackLadderDeps, } from "./fallback-ladder";
5
5
  export { buildSanitizedBaseEnv, assertNoAmbientCreds, SAFE_ENV_ALLOWLIST, SANDBOX_DEFAULT_PATH, } from "./sanitized-env";
6
6
  export type { SanitizedEnvInput } from "./sanitized-env";
@@ -0,0 +1,26 @@
1
+ /** S2-C7: record the copy location the desktop resolved for this session (null clears it, and every task record). */
2
+ export declare function setSessionCopyRoot(root: string | null): void;
3
+ /** R2-F4: the start tried and could not resolve the session copy location — nothing falls back to the raw cache path. */
4
+ export declare function markSessionCopyRootUnresolved(reason: string): void;
5
+ /**
6
+ * R2-F4: `WorkspaceShadow.create` chose `root` for `taskId`'s copy — that task's folders live there. A session whose
7
+ * start could not resolve its location takes this one too.
8
+ */
9
+ export declare function recordTaskCopyRoot(taskId: string, root: string): void;
10
+ /** S2-C7: the copy location every per-task, per-spawn and advisory folder of this session lives in. */
11
+ export declare function sessionCopyRoot(opts?: {
12
+ platform?: NodeJS.Platform;
13
+ homedir?: string;
14
+ xdgCacheHome?: string | undefined;
15
+ }): string;
16
+ export declare function taskFolderFor(taskId: string, opts?: {
17
+ platform?: NodeJS.Platform;
18
+ homedir?: string;
19
+ xdgCacheHome?: string | undefined;
20
+ }): string;
21
+ /** §8.1–§8.2: a review round's bundle (read-only to seats) and one private scratch folder per seat — siblings. */
22
+ export declare function reviewRoundFolders(taskFolder: string, gateId: string): {
23
+ round: string;
24
+ bundle: string;
25
+ seat: (n: number) => string;
26
+ };
@@ -0,0 +1,8 @@
1
+ {
2
+ "version": 1,
3
+ "coreRsSha": "d5841f2aec361083229dfd057cc4342e1f8eb1b6",
4
+ "targets": {
5
+ "linux-x64": { "sha256": "a3c90e8cc484ea99c2ed086aba5ed41b6ff6bda98cc14c4f05fad5f3a617c927", "versionId": "u2Yf4Fgxj9dDLGWVFSmkse9xHccG4.Cx" },
6
+ "linux-arm64": { "sha256": "a6cb98fa7d448fe6e5f78dfa0d5fde8e473191478c87deb9d2b58061110fc9ca", "versionId": "66SZgqKY6pLImVzc3j31ITtIft2UJkGf" }
7
+ }
8
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quantiya/codevibe-core",
3
- "version": "2.0.92",
3
+ "version": "2.0.94",
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",
@@ -12,19 +12,24 @@
12
12
  "dist/index.js",
13
13
  "dist/orchestration-shell/cli.js",
14
14
  "dist/orchestration-shell/web-extract-worker.js",
15
- "bin"
15
+ "bin",
16
+ "dist/substrate/tier-relay.js",
17
+ "native/spawn-sweep.json",
18
+ "native/linux-x64/codevibe-spawn-sweep",
19
+ "native/linux-arm64/codevibe-spawn-sweep"
16
20
  ],
17
21
  "scripts": {
18
22
  "typecheck": "tsc --noEmit",
19
23
  "emit-types": "tsc -p tsconfig.types.json --emitDeclarationOnly",
20
- "build": "rm -rf dist && npm run emit-types && esbuild src/index.ts --bundle --platform=node --target=node18 --minify --packages=external --define:__CODEVIBE_TEST_BUILD__=false --outfile=dist/index.js && esbuild src/orchestration-shell/cli.ts --bundle --platform=node --target=node18 --minify-syntax --packages=external --define:__CODEVIBE_TEST_BUILD__=false --outfile=dist/orchestration-shell/cli.js --banner:js=\"#!/usr/bin/env node\" && esbuild src/orchestration-shell/web/web-extract-worker.ts --bundle --platform=node --target=node18 --minify --packages=external --outfile=dist/orchestration-shell/web-extract-worker.js && npm run verify-no-test-hooks && npm run verify-no-test-types",
21
- "verify-no-test-hooks": "if grep -ERl 'CODEVIBE_TEST_FORCE_QUOTA_FAIL|CODEVIBE_TEST_FORCE_IMPLEMENTOR_AGENT|CODEVIBE_ANCHORED_PUBLICATION_AUTHORITY_ROOT|codevibe-anchored-publications-|cv-publication-authority-vitest-|codevibe\\.test\\.publication-authority-|setPublicationAuthorityRootForTestBuild|__CODEVIBE_TEST_BUILD__|_onBeforeLinkForTesting|_onBeforeSummariesLockForTesting|__codevibe_test_on_before_link|__codevibe_test_on_before_summaries_lock|simulatePostPublicationError' dist; then echo 'ERROR: a test-only hook leaked into a published artifact (prod-unreachability invariant)'; exit 1; fi; echo 'OK \u2014 no test-only hooks in published artifacts'",
24
+ "build": "rm -rf dist && npm run emit-types && esbuild src/index.ts --bundle --platform=node --target=node18 --minify --packages=external --define:__CODEVIBE_TEST_BUILD__=false --outfile=dist/index.js && esbuild src/orchestration-shell/cli.ts --bundle --platform=node --target=node18 --minify-syntax --packages=external --define:__CODEVIBE_TEST_BUILD__=false --outfile=dist/orchestration-shell/cli.js --banner:js=\"#!/usr/bin/env node\" && esbuild src/orchestration-shell/web/web-extract-worker.ts --bundle --platform=node --target=node18 --minify --packages=external --outfile=dist/orchestration-shell/web-extract-worker.js && esbuild src/substrate/tier-relay-main.ts --bundle --platform=node --target=node18 --minify --outfile=dist/substrate/tier-relay.js && npm run verify-no-test-hooks && npm run verify-no-test-types",
25
+ "verify-no-test-hooks": "if grep -ERl 'CODEVIBE_TEST_FORCE_QUOTA_FAIL|CODEVIBE_TEST_FORCE_IMPLEMENTOR_AGENT|CODEVIBE_ANCHORED_PUBLICATION_AUTHORITY_ROOT|codevibe-anchored-publications-|cv-publication-authority-vitest-|codevibe\\.test\\.publication-authority-|setPublicationAuthorityRootForTestBuild|__CODEVIBE_TEST_BUILD__|_onBeforeLinkForTesting|_onBeforeSummariesLockForTesting|__codevibe_test_on_before_link|__codevibe_test_on_before_summaries_lock|simulatePostPublicationError' dist; then echo 'ERROR: a test-only hook leaked into a published artifact (prod-unreachability invariant)'; exit 1; fi; echo 'OK — no test-only hooks in published artifacts'",
22
26
  "verify-no-test-types": "if find dist -type f \\( -path '*/__tests__/*' -o -name '*.test.d.ts' -o -name 'test-publication-authority-setup.d.ts' \\) | grep -q .; then echo 'verify-no-test-types: test declarations present in dist (tsconfig.types.json must exclude test sources)' >&2; exit 1; fi",
23
27
  "clean": "rm -rf dist",
24
28
  "prepublishOnly": "npm run build",
25
29
  "test": "vitest run",
26
30
  "test:watch": "vitest",
27
- "test:live": "QUORUM_LIVE_SMOKE=1 vitest run"
31
+ "test:live": "QUORUM_LIVE_SMOKE=1 vitest run",
32
+ "prepack": "node scripts/stage-spawn-sweep.mjs --s3"
28
33
  },
29
34
  "dependencies": {
30
35
  "@iarna/toml": "^2.2.5",