@tangle-network/agent-provider-tangle 4.4.4 → 4.4.5

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.
@@ -4,6 +4,7 @@ import { mkdtemp, open, rm } from "node:fs/promises";
4
4
  import { tmpdir } from "node:os";
5
5
  import { join } from "node:path";
6
6
  import { EvidenceJsonArray } from "./tangle-evidence-json.js";
7
+ import { NATIVE_OMIT_CONTENT_DIRECTORIES } from "./tangle-evidence-omission.js";
7
8
  const MAX_ENTRIES = 100_000;
8
9
  // Match the shipped Sandbox archive reader: a valid producer manifest or NDJSON
9
10
  // record must not be rejected after capture solely by this consumer's bound.
@@ -101,7 +102,7 @@ export async function prepareNativeDirectoryEvidence(session, maxBytes, signal)
101
102
  const destination = join(temporary, "export");
102
103
  const remove = () => rm(temporary, { recursive: true, force: true });
103
104
  try {
104
- const response = record(await session.exportRawEvidence(destination, { maxBytes, maxFiles: MAX_ENTRIES, signal }));
105
+ const response = record(await session.exportRawEvidence(destination, { maxBytes, maxFiles: MAX_ENTRIES, omitContent: NATIVE_OMIT_CONTENT_DIRECTORIES, signal }));
105
106
  if (response.status === "unavailable") {
106
107
  return { native: response, payloads: new WeakMap(), remove };
107
108
  }
@@ -0,0 +1,11 @@
1
+ export type HarnessContentOmission = "harness-install" | "harness-cache";
2
+ /** Why a native file keeps only its metadata, or undefined when its bytes are session state. */
3
+ export declare function harnessContentOmission(rootScope: string, path: string): HarnessContentOmission | undefined;
4
+ /**
5
+ * Session-home directories whose bytes the Sidecar leaves on the box (`exportRawEvidence`
6
+ * `omitContent`). Derived from the rules above, never written separately: every file the Sidecar
7
+ * omits must be one this capture would keep as metadata anyway, and a prefix that covered the
8
+ * native session store would be refused by the Sidecar (400). Each copy of a codex HOME was about
9
+ * 99 MB and 4-6 s with these bytes, 4.4 MB and under 0.6 s without them (2026-10-19, Beelink).
10
+ */
11
+ export declare const NATIVE_OMIT_CONTENT_DIRECTORIES: readonly string[];
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Codex caches under its home that it downloads again on start: plugin template assets and
3
+ * the remote plugin and apps catalogs. Session state (`.codex/sessions`, the thread sqlite,
4
+ * config) stays. One canary's capture was 84% these directories (186.8 MB of evidence).
5
+ */
6
+ const HARNESS_CACHE_DIRECTORIES = [".codex/plugins/cache/", ".codex/cache/remote_plugin_catalog/", ".codex/cache/codex_apps_tools/"];
7
+ /** Installed harness packages under a session home, as concrete directories. */
8
+ const HARNESS_INSTALL_DIRECTORIES = [".config/opencode/node_modules/"];
9
+ /** Why a native file keeps only its metadata, or undefined when its bytes are session state. */
10
+ export function harnessContentOmission(rootScope, path) {
11
+ // A harness's installed packages, e.g. `.config/opencode/node_modules`.
12
+ if (path.split("/").includes("node_modules"))
13
+ return "harness-install";
14
+ if (rootScope === "session-home" && HARNESS_CACHE_DIRECTORIES.some((directory) => path.startsWith(directory)))
15
+ return "harness-cache";
16
+ return undefined;
17
+ }
18
+ /**
19
+ * Session-home directories whose bytes the Sidecar leaves on the box (`exportRawEvidence`
20
+ * `omitContent`). Derived from the rules above, never written separately: every file the Sidecar
21
+ * omits must be one this capture would keep as metadata anyway, and a prefix that covered the
22
+ * native session store would be refused by the Sidecar (400). Each copy of a codex HOME was about
23
+ * 99 MB and 4-6 s with these bytes, 4.4 MB and under 0.6 s without them (2026-10-19, Beelink).
24
+ */
25
+ export const NATIVE_OMIT_CONTENT_DIRECTORIES = [...HARNESS_CACHE_DIRECTORIES, ...HARNESS_INSTALL_DIRECTORIES];
26
+ for (const directory of NATIVE_OMIT_CONTENT_DIRECTORIES) {
27
+ if (!directory.endsWith("/") || harnessContentOmission("session-home", directory + "file") === undefined) {
28
+ throw new Error(`Tangle evidence would omit ${directory} without keeping its files as metadata`);
29
+ }
30
+ }
@@ -1,6 +1,7 @@
1
1
  import { type AgentExactRunControlRef, type AgentProfile } from "@tangle-network/agent-interface";
2
2
  import type { AgentEnvironment } from "@tangle-network/agent-interface/environment-provider";
3
3
  import type { NativeCaptureProofLike, SandboxInstanceLike, TangleEvidenceAttemptLike, TangleEvidenceSourceLike } from "./tangle-types.js";
4
+ import { type HarnessContentOmission } from "./tangle-evidence-omission.js";
4
5
  interface WorkspaceEntryMetadata {
5
6
  path: string;
6
7
  type: "file" | "directory" | "symlink";
@@ -205,5 +206,4 @@ export declare function captureTangleEnvironmentEvidenceToDirectory(environment:
205
206
  export declare function captureTangleSandboxEvidenceToDirectory(box: SandboxInstanceLike, options: TangleSandboxEvidenceOptions & TangleDirectoryEvidenceOptions): Promise<TangleDirectoryEvidence>;
206
207
  /** Export exact Sandbox session and workspace evidence before its owning box is deleted. */
207
208
  export declare function captureTangleSandboxEvidence(box: SandboxInstanceLike, options: TangleSandboxEvidenceOptions): Promise<TangleEnvironmentEvidence>;
208
- type HarnessContentOmission = "harness-install" | "harness-cache";
209
209
  export {};
@@ -6,6 +6,7 @@ import { AgentExactRunControlRefSchema } from "@tangle-network/agent-interface";
6
6
  import { requireNativeCaptureProof } from "./tangle-native-capture-proof.js";
7
7
  import { retainedCaptureAttribution } from "./tangle-retained-attribution.js";
8
8
  import { readWorkspaceArchive } from "./tangle-evidence-tar.js";
9
+ import { harnessContentOmission } from "./tangle-evidence-omission.js";
9
10
  const handles = new WeakMap();
10
11
  const blockedNames = new Set([".ssh", ".config", ".claude", ".codex", ".opencode", ".env", ".env.local", ".npmrc", ".sidecar"]);
11
12
  const MAX_ENTRIES = 100_000;
@@ -1127,21 +1128,6 @@ function withoutRepeatedFrameText(record, previous) {
1127
1128
  return record;
1128
1129
  return { ...record, frames: frames.map(compact) };
1129
1130
  }
1130
- /**
1131
- * Codex caches under its home that it downloads again on start: plugin template assets and
1132
- * the remote plugin and apps catalogs. Session state (`.codex/sessions`, the thread sqlite,
1133
- * config) stays. One canary's capture was 84% these directories (186.8 MB of evidence).
1134
- */
1135
- const HARNESS_CACHE_DIRECTORIES = [".codex/plugins/cache/", ".codex/cache/remote_plugin_catalog/", ".codex/cache/codex_apps_tools/"];
1136
- /** Why a native file keeps only its metadata, or undefined when its bytes are session state. */
1137
- function harnessContentOmission(rootScope, path) {
1138
- // A harness's installed packages, e.g. `.config/opencode/node_modules`.
1139
- if (path.split("/").includes("node_modules"))
1140
- return "harness-install";
1141
- if (rootScope === "session-home" && HARNESS_CACHE_DIRECTORIES.some((directory) => path.startsWith(directory)))
1142
- return "harness-cache";
1143
- return undefined;
1144
- }
1145
1131
  function withoutNativeContent(source) {
1146
1132
  const metadata = { ...source };
1147
1133
  delete metadata.contentBase64;
@@ -743,6 +743,8 @@ export interface SandboxSessionLike {
743
743
  maxBytes: number;
744
744
  maxFiles: number;
745
745
  maxArchiveBytes?: number;
746
+ /** Session-home directories whose files are listed with metadata only; ignored by an older SDK. */
747
+ omitContent?: readonly string[];
746
748
  signal?: AbortSignal;
747
749
  }): Promise<unknown>;
748
750
  /** Exact native coding-agent TUI bound to this session id. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-provider-tangle",
3
- "version": "4.4.4",
3
+ "version": "4.4.5",
4
4
  "description": "AgentEnvironmentProvider adapter for Tangle sandboxes",
5
5
  "type": "module",
6
6
  "license": "MIT",