@visulima/task-runner 1.0.0-alpha.7 → 1.0.0-alpha.8

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 (54) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/index.d.ts +2507 -49
  3. package/dist/index.js +9 -7
  4. package/dist/packem_shared/{TaskOrchestrator-rf45vW5c.js → TaskOrchestrator-UCMHCx8c.js} +68 -2
  5. package/dist/packem_shared/{buildForwardDependencyMap-DLPgKEto.js → buildForwardDependencyMap-0BJFMMPv.js} +1 -2
  6. package/dist/packem_shared/{computeTaskHash-DYqfrDGq.js → computeTaskHash-B5APHW7e.js} +1 -1
  7. package/dist/packem_shared/{createTaskGraph-B7nH0kY_.js → createTaskGraph-B5YrfAMx.js} +6 -2
  8. package/dist/packem_shared/{defaultTaskRunner-Cp7jCmIl.js → defaultTaskRunner-DzR0ld8F.js} +36 -4
  9. package/dist/packem_shared/expandTokensInString-C03AGAjh.js +46 -0
  10. package/dist/packem_shared/{extractPackageName-BllKetnz.js → extractPackageName-CbVNW-dr.js} +1 -2
  11. package/dist/packem_shared/getCurrentBranch-DsKPDoVj.js +153 -0
  12. package/dist/packem_shared/{parseCommands-D-IgF8Zh.js → parseCommands-CJ16ohOB.js} +7 -2
  13. package/index.js +556 -723
  14. package/package.json +12 -12
  15. package/dist/affected.d.ts +0 -82
  16. package/dist/archive.d.ts +0 -38
  17. package/dist/cache.d.ts +0 -138
  18. package/dist/chrome-trace.d.ts +0 -53
  19. package/dist/command-parser/expand-arguments.d.ts +0 -11
  20. package/dist/command-parser/expand-shortcut.d.ts +0 -15
  21. package/dist/command-parser/expand-wildcard.d.ts +0 -13
  22. package/dist/command-parser/index.d.ts +0 -18
  23. package/dist/command-parser/strip-quotes.d.ts +0 -6
  24. package/dist/concurrent-fallback.d.ts +0 -16
  25. package/dist/concurrent.d.ts +0 -23
  26. package/dist/default-task-runner.d.ts +0 -44
  27. package/dist/detect-shell.d.ts +0 -19
  28. package/dist/file-access-tracker.d.ts +0 -59
  29. package/dist/fingerprint.d.ts +0 -54
  30. package/dist/flow-controllers/index.d.ts +0 -7
  31. package/dist/flow-controllers/input-handler.d.ts +0 -44
  32. package/dist/flow-controllers/log-timings.d.ts +0 -18
  33. package/dist/flow-controllers/restart-process.d.ts +0 -21
  34. package/dist/flow-controllers/teardown.d.ts +0 -22
  35. package/dist/framework-inference.d.ts +0 -35
  36. package/dist/graph-visualizer.d.ts +0 -74
  37. package/dist/incremental-hasher.d.ts +0 -76
  38. package/dist/life-cycle.d.ts +0 -38
  39. package/dist/lockfile-hasher.d.ts +0 -73
  40. package/dist/log-reporter.d.ts +0 -34
  41. package/dist/native-binding.d.ts +0 -106
  42. package/dist/output-resolver.d.ts +0 -20
  43. package/dist/project-constraints.d.ts +0 -9
  44. package/dist/remote-cache.d.ts +0 -100
  45. package/dist/run-summary.d.ts +0 -111
  46. package/dist/task-graph-utils.d.ts +0 -39
  47. package/dist/task-graph.d.ts +0 -22
  48. package/dist/task-hasher.d.ts +0 -104
  49. package/dist/task-orchestrator.d.ts +0 -38
  50. package/dist/task-scheduler.d.ts +0 -41
  51. package/dist/terminal-buffer.d.ts +0 -29
  52. package/dist/tracked-executor.d.ts +0 -46
  53. package/dist/types.d.ts +0 -757
  54. package/dist/utils.d.ts +0 -39
@@ -1,100 +0,0 @@
1
- /**
2
- * Compression algorithm used for artifact tarballs on the wire.
3
- * - `"gzip"` (default): tar+gzip, matches Turborepo's protocol format
4
- * and stays interop-safe with existing remote cache servers.
5
- * - `"brotli"`: tar + Node brotli (BROTLI_MODE_TEXT, quality 4) — a
6
- * solid ratio/speed trade-off for source-tree tarballs. Both upload
7
- * and download sides must agree; switching invalidates existing
8
- * remote entries (they will simply re-populate on next run).
9
- */
10
- export type RemoteCacheCompression = "brotli" | "gzip";
11
- /**
12
- * HMAC signing configuration for cache integrity.
13
- *
14
- * When set, every upload carries an `X-Artifact-Signature` header
15
- * containing the HMAC-SHA256 digest of `hash | body`. On download,
16
- * the client recomputes the HMAC and rejects any artifact whose
17
- * signature doesn't match using a constant-time comparison.
18
- *
19
- * Prevents cache poisoning in shared team environments where a
20
- * compromised cache server (or a MITM) could inject malicious
21
- * artifacts. Unsigned entries (written before signing was enabled)
22
- * are accepted only when `verifyOnDownload === false` — the default.
23
- */
24
- export interface RemoteCacheSigning {
25
- /** Shared secret. Must be at least 16 characters. */
26
- secret: string;
27
- /**
28
- * Reject downloads whose signature doesn't match or is missing.
29
- * Set to `true` once every upload on your server is signed.
30
- * @default false
31
- */
32
- verifyOnDownload?: boolean;
33
- }
34
- /**
35
- * Options for the remote cache.
36
- */
37
- interface RemoteCacheOptions {
38
- /**
39
- * Compression format for artifact tarballs. Defaults to `"gzip"`
40
- * for Turborepo protocol compatibility.
41
- */
42
- compression?: RemoteCacheCompression;
43
- /**
44
- * Called when a fire-and-forget upload fails.
45
- * Since uploads are non-blocking, errors are silently swallowed by default.
46
- * Provide this callback to log or report upload failures.
47
- */
48
- onUploadError?: (hash: string, error: unknown) => void;
49
- /** Whether to enable remote cache reads */
50
- read?: boolean;
51
- /**
52
- * HMAC-SHA256 signing for upload integrity. When set, every
53
- * uploaded artifact carries an `X-Artifact-Signature` header;
54
- * downloads with `verifyOnDownload: true` reject unsigned or
55
- * tampered payloads.
56
- */
57
- signing?: RemoteCacheSigning;
58
- /** Team ID or namespace for cache isolation */
59
- teamId?: string;
60
- /** Request timeout in milliseconds (default: 30000) */
61
- timeout?: number;
62
- /** Authentication token for the remote cache */
63
- token?: string;
64
- /** Remote cache server URL (e.g., "https://cache.example.com") */
65
- url: string;
66
- /** Whether to enable remote cache writes */
67
- write?: boolean;
68
- }
69
- /**
70
- * HTTP-based remote cache compatible with the Turborepo remote cache protocol.
71
- *
72
- * Protocol:
73
- * - GET /v8/artifacts/{hash}?teamId={team} -> retrieve cached artifact (gzipped tar)
74
- * - PUT /v8/artifacts/{hash}?teamId={team} -> store artifact
75
- * - POST /v8/artifacts/events -> analytics (optional)
76
- *
77
- * Authentication via `Authorization: Bearer {token}` header.
78
- *
79
- * The cache entry is a gzipped tarball containing the cache directory contents
80
- * (code, terminalOutput, fingerprint.json, outputs/, .commit).
81
- */
82
- declare class RemoteCache {
83
- #private;
84
- constructor(options: RemoteCacheOptions);
85
- /**
86
- * Retrieves a cached artifact from the remote cache.
87
- * Returns the local path to the extracted cache entry, or undefined if not found.
88
- */
89
- retrieve(hash: string, localCacheDirectory: string): Promise<boolean>;
90
- /**
91
- * Stores a cache entry in the remote cache.
92
- */
93
- store(hash: string, localCacheDirectory: string): Promise<boolean>;
94
- /**
95
- * Checks if an artifact exists in the remote cache without downloading it.
96
- */
97
- exists(hash: string): Promise<boolean>;
98
- }
99
- export type { RemoteCacheOptions };
100
- export { RemoteCache };
@@ -1,111 +0,0 @@
1
- import type { OutputSpec, TaskGraph, TaskHashDetails, TaskResults } from "./types.d.ts";
2
- /**
3
- * Summary of a single task execution.
4
- */
5
- interface TaskSummary {
6
- /** Whether the task was cacheable */
7
- cacheable: boolean;
8
- /** Cache status */
9
- cacheStatus: "HIT" | "MISS" | "REMOTE_HIT" | "SKIPPED";
10
- /** Dependencies on other tasks */
11
- dependencies: string[];
12
- /** Duration in milliseconds */
13
- duration: number | undefined;
14
- /** End time (ISO 8601) */
15
- endTime: string | undefined;
16
- /** Exit code */
17
- exitCode: number | undefined;
18
- /** The computed cache hash */
19
- hash: string | undefined;
20
- /** Detailed hash information */
21
- hashDetails: TaskHashDetails | undefined;
22
- /** The task's declared outputs (glob patterns, literals, or `{ auto: true }`). */
23
- outputs: OutputSpec[];
24
- /** Start time (ISO 8601) */
25
- startTime: string | undefined;
26
- /** The task target */
27
- target: {
28
- configuration?: string;
29
- project: string;
30
- target: string;
31
- };
32
- /** The task ID (e.g., "app:build") */
33
- taskId: string;
34
- }
35
- /**
36
- * Complete summary of a task runner execution.
37
- */
38
- interface RunSummary {
39
- /** Total duration in milliseconds */
40
- duration: number;
41
- /** Run end time (ISO 8601) */
42
- endTime: string;
43
- /** Environment info */
44
- environment: {
45
- /** Architecture */
46
- arch: string;
47
- /** Node.js version */
48
- nodeVersion: string;
49
- /** Platform */
50
- platform: string;
51
- };
52
- /** Unique run ID */
53
- id: string;
54
- /** Run start time (ISO 8601) */
55
- startTime: string;
56
- /** Overall execution statistics */
57
- stats: {
58
- /** Number of cached tasks (local + remote) */
59
- cached: number;
60
- /** Number of failed tasks */
61
- failed: number;
62
- /** Number of skipped tasks */
63
- skipped: number;
64
- /** Number of successful tasks */
65
- succeeded: number;
66
- /** Total number of tasks */
67
- total: number;
68
- };
69
- /** The task graph used for this run */
70
- taskGraph: {
71
- dependencies: Record<string, string[]>;
72
- roots: string[];
73
- };
74
- /** Summary of each task */
75
- tasks: TaskSummary[];
76
- }
77
- /**
78
- * Generates a run summary from task results.
79
- */
80
- declare const generateRunSummary: (results: TaskResults, taskGraph: TaskGraph, startTime: number) => RunSummary;
81
- /**
82
- * Writes the run summary to a JSON file in the `.task-runner/runs/` directory.
83
- * @param summary The run summary to write
84
- * @param workspaceRoot The workspace root directory
85
- * @returns The path to the written summary file
86
- */
87
- declare const writeRunSummary: (summary: RunSummary, workspaceRoot: string) => Promise<string>;
88
- /**
89
- * Path where the most-recent run summary is persisted.
90
- * Consumers (e.g. CLIs exposing `--last-details`) read this file
91
- * to replay or render the previous run without re-executing.
92
- */
93
- declare const getLastRunSummaryPath: (workspaceRoot: string) => string;
94
- /**
95
- * Persists `summary` as the most-recent run summary at
96
- * `.task-runner/last-summary.json`, overwriting any previous entry.
97
- *
98
- * This is the companion to {@link readLastRunSummary} and powers
99
- * CLI surfaces that display "last run" details without re-running tasks.
100
- * @returns The path to the written summary file
101
- */
102
- declare const writeLastRunSummary: (summary: RunSummary, workspaceRoot: string) => Promise<string>;
103
- /**
104
- * Reads the most-recent run summary written by {@link writeLastRunSummary}.
105
- * Returns `undefined` when no previous run has been recorded or the file
106
- * cannot be parsed — callers should render an informational message
107
- * instead of treating this as an error.
108
- */
109
- declare const readLastRunSummary: (workspaceRoot: string) => Promise<RunSummary | undefined>;
110
- export type { RunSummary, TaskSummary };
111
- export { generateRunSummary, getLastRunSummaryPath, readLastRunSummary, writeLastRunSummary, writeRunSummary };
@@ -1,39 +0,0 @@
1
- import type { TaskGraph } from "./types.d.ts";
2
- /**
3
- * Finds a single cycle in the task graph, if one exists.
4
- * Returns the cycle as an array of task IDs, or null if no cycle exists.
5
- */
6
- export declare const findCycle: (taskGraph: TaskGraph) => string[] | undefined;
7
- /**
8
- * Finds all cycles in the task graph.
9
- */
10
- export declare const findCycles: (taskGraph: TaskGraph) => string[][];
11
- /**
12
- * Walks the task graph in topological order (dependencies before dependents),
13
- * calling the callback for each task.
14
- *
15
- * Note: If the graph contains cycles, tasks involved in cycles will not be visited.
16
- * Use `findCycle` to detect cycles before walking if complete traversal is required.
17
- */
18
- export declare const walkTaskGraph: (taskGraph: TaskGraph, callback: (taskId: string) => void) => void;
19
- /**
20
- * Returns a reversed copy of the task graph (edges point in the opposite direction).
21
- */
22
- export declare const reverseTaskGraph: (taskGraph: TaskGraph) => TaskGraph;
23
- /**
24
- * Returns the leaf tasks (tasks with no dependencies of their own).
25
- */
26
- export declare const getLeafTasks: (taskGraph: TaskGraph) => string[];
27
- /**
28
- * Removes edges that form cycles, making the graph acyclic.
29
- * Returns a new task graph without the cycle-forming edges.
30
- */
31
- export declare const makeAcyclic: (taskGraph: TaskGraph) => TaskGraph;
32
- /**
33
- * Gets all tasks that depend on the given task (directly or transitively).
34
- */
35
- export declare const getDependentTasks: (taskGraph: TaskGraph, taskId: string) => string[];
36
- /**
37
- * Gets all tasks that the given task depends on (directly or transitively).
38
- */
39
- export declare const getTransitiveDependencies: (taskGraph: TaskGraph, taskId: string) => string[];
@@ -1,22 +0,0 @@
1
- import type { ProjectGraph, TargetConfiguration, Task, TaskGraph, TaskTarget, WorkspaceConfiguration } from "./types.d.ts";
2
- interface CreateTaskGraphOptions {
3
- /** The project graph */
4
- projectGraph: ProjectGraph;
5
- /** Target default configurations */
6
- targetDefaults?: Record<string, Partial<TargetConfiguration>>;
7
- /** The workspace configuration */
8
- workspace: WorkspaceConfiguration;
9
- }
10
- /**
11
- * Creates a unique task ID from a target.
12
- */
13
- declare const getTaskId: (target: TaskTarget) => string;
14
- /**
15
- * Parses a task ID into its component parts.
16
- */
17
- declare const parseTaskId: (taskId: string) => TaskTarget;
18
- /**
19
- * Creates a task graph from a list of tasks, resolving all dependencies.
20
- */
21
- declare const createTaskGraph: (initialTasks: Task[], options: CreateTaskGraphOptions) => TaskGraph;
22
- export { createTaskGraph, getTaskId, parseTaskId };
@@ -1,104 +0,0 @@
1
- import type { IncrementalFileHasher } from "./incremental-hasher.d.ts";
2
- import type { NamedInputs, ProjectConfiguration, TargetConfiguration, Task, TaskHashDetails } from "./types.d.ts";
3
- /**
4
- * Interface for task hashers.
5
- */
6
- interface TaskHasher {
7
- hashTask: (task: Task) => Promise<TaskHashDetails>;
8
- /**
9
- * Rehashes a single file bypassing any in-memory cache. Optional to keep
10
- * external/custom hashers backward compatible; the orchestrator skips
11
- * self-modifying-task detection when the implementation is absent.
12
- */
13
- rehashFile?: (filePath: string) => Promise<string | undefined>;
14
- }
15
- /**
16
- * Options for creating an InProcessTaskHasher.
17
- */
18
- interface TaskHasherOptions {
19
- /**
20
- * When true, scan each task's resolved command for `$VAR`/`${VAR}`
21
- * references and auto-fingerprint them. Catches the common case of
22
- * a script reading `$VERCEL_URL` or `${NEXT_PUBLIC_API}` without
23
- * the user remembering to declare it in `envVars`/`globalEnv`.
24
- * @default false
25
- */
26
- autoEnvVars?: boolean;
27
- /** Additional environment variables to include in hash */
28
- envVars?: string[];
29
- /**
30
- * Enable framework environment variable inference.
31
- * When true, auto-detects frameworks and includes their public
32
- * env var prefixes in the task hash.
33
- * @default false
34
- */
35
- frameworkInference?: boolean;
36
- /**
37
- * Global environment variables that invalidate all task hashes.
38
- */
39
- globalEnv?: string[];
40
- /**
41
- * Global input files that invalidate all task hashes when changed.
42
- * These are workspace-root-relative paths (e.g., "pnpm-lock.yaml").
43
- */
44
- globalInputs?: string[];
45
- /**
46
- * Optional persistent mtime/size-indexed file snapshot. When set,
47
- * `#hashFile` consults the snapshot first and only re-reads file
48
- * contents when the file's mtime or size has changed since the
49
- * previous run. Cuts cold-cache fingerprint time dramatically on
50
- * large workspaces where most source files don't change run-to-run.
51
- *
52
- * The caller is responsible for `load()`ing the snapshot before
53
- * using the hasher and `save()`ing it after the run completes.
54
- */
55
- incrementalHasher?: IncrementalFileHasher;
56
- /** Named input definitions */
57
- namedInputs?: NamedInputs;
58
- /** Project configurations keyed by project name */
59
- projects: Record<string, ProjectConfiguration>;
60
- /**
61
- * Enable smart lockfile hashing.
62
- * When true, instead of hashing the entire lockfile, only the resolved
63
- * versions of a package's actual dependencies are hashed.
64
- * This means changing the lockfile only busts cache for affected packages.
65
- *
66
- * Matches Turborepo's smart lockfile hashing behavior.
67
- * @default false
68
- */
69
- smartLockfileHashing?: boolean;
70
- /** Target default configurations */
71
- targetDefaults?: Record<string, Partial<TargetConfiguration>>;
72
- /** The workspace root directory */
73
- workspaceRoot: string;
74
- }
75
- /**
76
- * Computes hashes for tasks based on their inputs.
77
- * Used to determine if a cached result can be reused.
78
- */
79
- declare class InProcessTaskHasher implements TaskHasher {
80
- #private;
81
- constructor(options: TaskHasherOptions);
82
- hashTask(task: Task): Promise<TaskHashDetails>;
83
- clearCache(): void;
84
- /**
85
- * Reads `filePath` fresh and returns its content hash, bypassing the
86
- * in-memory cache used during the initial `hashTask` pass.
87
- *
88
- * Used to detect tasks that modify their own tracked inputs: compare
89
- * a pre-execution hash (from `task.hashDetails.nodes`) against the
90
- * post-execution result of this method.
91
- * @param filePath Absolute path to the file.
92
- * @returns The fresh xxh3 hash, or `undefined` if the file cannot be read.
93
- */
94
- rehashFile(filePath: string): Promise<string | undefined>;
95
- }
96
- /**
97
- * Computes the final hash for a task from its hash details.
98
- * Uses native Rust xxh3-128 when available, otherwise pure TS xxh3-ts.
99
- * Both produce identical xxh3-128 hashes, ensuring cache compatibility
100
- * regardless of whether the native addon is loaded.
101
- */
102
- declare const computeTaskHash: (hashDetails: TaskHashDetails) => string;
103
- export { computeTaskHash, InProcessTaskHasher };
104
- export type { TaskHasher, TaskHasherOptions };
@@ -1,38 +0,0 @@
1
- import type { Cache } from "./cache.d.ts";
2
- import type { RemoteCache } from "./remote-cache.d.ts";
3
- import type { TaskHasher } from "./task-hasher.d.ts";
4
- import type { TaskScheduler } from "./task-scheduler.d.ts";
5
- import type { LifeCycleInterface, Task, TaskExecutor, TaskGraph, TaskResults } from "./types.d.ts";
6
- /**
7
- * Options for the TaskOrchestrator.
8
- */
9
- interface TaskOrchestratorOptions {
10
- autoFingerprint?: boolean;
11
- cache: Cache;
12
- cacheDiagnostics?: boolean;
13
- captureOutput?: boolean;
14
- dryRun?: boolean;
15
- fingerprintEnvPatterns?: string[];
16
- lifeCycle: LifeCycleInterface;
17
- remoteCache?: RemoteCache;
18
- resolveCommand?: (task: Task) => string | undefined;
19
- scheduler: TaskScheduler;
20
- skipCache?: boolean;
21
- summarize?: boolean;
22
- taskExecutor: TaskExecutor;
23
- taskGraph?: TaskGraph;
24
- taskHasher: TaskHasher;
25
- untrackedEnvVars?: string[];
26
- workspaceRoot: string;
27
- }
28
- /**
29
- * Orchestrates the execution of tasks, handling caching,
30
- * scheduling, and lifecycle events.
31
- */
32
- declare class TaskOrchestrator {
33
- #private;
34
- constructor(options: TaskOrchestratorOptions);
35
- run(): Promise<TaskResults>;
36
- }
37
- export { TaskOrchestrator };
38
- export type { TaskOrchestratorOptions };
@@ -1,41 +0,0 @@
1
- import type { ProjectGraph, Task, TaskGraph } from "./types.d.ts";
2
- /**
3
- * Options for partitioning tasks across CI runners.
4
- */
5
- export interface PartitionOptions {
6
- /** 1-based partition index (e.g., 1 for the first partition) */
7
- index: number;
8
- /** Total number of partitions */
9
- total: number;
10
- }
11
- /**
12
- * Parses a partition string like "1/4" into PartitionOptions.
13
- * Also supports the VIS_PARTITION environment variable as fallback.
14
- */
15
- export declare const parsePartition: (value?: string) => PartitionOptions | undefined;
16
- /**
17
- * Manages the scheduling order of tasks based on dependencies,
18
- * parallelism constraints, and estimated execution times.
19
- */
20
- export declare class TaskScheduler {
21
- #private;
22
- /**
23
- * Partitions a list of tasks for distributed CI execution.
24
- * Tasks are sorted by ID for deterministic distribution, then split
25
- * using ceiling division so partitions differ by at most one task.
26
- * @param tasks The full list of tasks to partition
27
- * @param partition The partition configuration (1-based index and total)
28
- * @returns The subset of tasks assigned to this partition
29
- */
30
- static partitionTasks(tasks: Task[], partition: PartitionOptions): Task[];
31
- constructor(taskGraph: TaskGraph, projectGraph: ProjectGraph, maxParallel?: number);
32
- /**
33
- * Returns the next batch of tasks that are ready to execute.
34
- */
35
- getNextBatch(): Task[];
36
- startTask(taskId: string): void;
37
- completeTask(taskId: string): void;
38
- isComplete(): boolean;
39
- get remainingCount(): number;
40
- get runningCount(): number;
41
- }
@@ -1,29 +0,0 @@
1
- /**
2
- * Minimal virtual terminal buffer that processes ANSI escape sequences
3
- * for cursor movement and line erasure. This allows PTY output from
4
- * interactive tools (inquirer, etc.) to render correctly by updating
5
- * lines in place rather than always appending.
6
- *
7
- * Supported sequences:
8
- * - \r carriage return (cursor to column 0)
9
- * - \n line feed (new line)
10
- * - \x1b[nA cursor up n lines
11
- * - \x1b[nB cursor down n lines
12
- * - \x1b[nC cursor forward n columns
13
- * - \x1b[nD cursor back n columns
14
- * - \x1b[nG cursor to column n
15
- * - \x1b[r;cH cursor position
16
- * - \x1b[K erase from cursor to end of line (0K, 1K, 2K)
17
- * - \x1b[J erase from cursor to end of display (0J, 1J, 2J)
18
- * - \x1b[...m SGR (colors/styles) — passed through into output
19
- */
20
- export declare class TerminalBuffer {
21
- #private;
22
- constructor(maxBytes?: number);
23
- /**
24
- * Process raw PTY output data.
25
- */
26
- write(data: string): void;
27
- /** Get the current buffer content as a string. */
28
- toString(): string;
29
- }
@@ -1,46 +0,0 @@
1
- import type { FileAccess } from "./file-access-tracker.d.ts";
2
- import type { Task, TaskExecutionOptions } from "./types.d.ts";
3
- /**
4
- * Result of a tracked task execution.
5
- */
6
- export interface TrackedExecutionResult {
7
- /** File accesses recorded during execution */
8
- accesses: FileAccess[];
9
- /** The command exit code */
10
- code: number;
11
- /** The command stdout + stderr output */
12
- terminalOutput: string;
13
- }
14
- /**
15
- * A task executor that tracks file accesses during command execution.
16
- *
17
- * Tracking strategies (in priority order):
18
- * 1. **Linux**: strace-based syscall interception (most complete)
19
- * 2. **macOS/Windows**: Node.js preload script that patches `fs` module
20
- * (works for Node.js processes, not native binaries)
21
- * 3. **Fallback**: No tracking (accesses array will be empty)
22
- */
23
- export declare class TrackedTaskExecutor {
24
- #private;
25
- constructor(workspaceRoot: string);
26
- /**
27
- * Returns true if file access tracking is supported on the current platform.
28
- * strace tracking (Linux) or preload script (any Node.js process).
29
- */
30
- get isTrackingSupported(): boolean;
31
- /**
32
- * Returns true if the platform supports full syscall-level tracking (strace).
33
- */
34
- get isStraceSupported(): boolean;
35
- /**
36
- * Executes a task command and tracks all file system accesses.
37
- *
38
- * On Linux, uses strace for comprehensive tracking.
39
- * On other platforms, uses a Node.js preload script (for Node processes).
40
- */
41
- execute(task: Task, options: TaskExecutionOptions, command: string): Promise<TrackedExecutionResult>;
42
- /**
43
- * Kills all active child processes. Called on abort/signal to prevent orphans.
44
- */
45
- killAll(): void;
46
- }