@deepagents/context 3.1.0 → 4.1.0

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 (59) hide show
  1. package/README.md +57 -19
  2. package/dist/browser.js +48 -64
  3. package/dist/browser.js.map +3 -3
  4. package/dist/index.js +2004 -1479
  5. package/dist/index.js.map +4 -4
  6. package/dist/lib/agent.d.ts.map +1 -1
  7. package/dist/lib/chain-summary.d.ts.map +1 -1
  8. package/dist/lib/engine.d.ts +3 -3
  9. package/dist/lib/engine.d.ts.map +1 -1
  10. package/dist/lib/fragments/message/user.d.ts +51 -92
  11. package/dist/lib/fragments/message/user.d.ts.map +1 -1
  12. package/dist/lib/sandbox/agent-os-sandbox.d.ts.map +1 -1
  13. package/dist/lib/sandbox/apple-container-sandbox-errors.d.ts +44 -0
  14. package/dist/lib/sandbox/apple-container-sandbox-errors.d.ts.map +1 -0
  15. package/dist/lib/sandbox/apple-container-sandbox.d.ts +122 -0
  16. package/dist/lib/sandbox/apple-container-sandbox.d.ts.map +1 -0
  17. package/dist/lib/sandbox/bash-tool.d.ts +9 -28
  18. package/dist/lib/sandbox/bash-tool.d.ts.map +1 -1
  19. package/dist/lib/sandbox/cli-process.d.ts +24 -0
  20. package/dist/lib/sandbox/cli-process.d.ts.map +1 -0
  21. package/dist/lib/sandbox/container-engine.d.ts +149 -0
  22. package/dist/lib/sandbox/container-engine.d.ts.map +1 -0
  23. package/dist/lib/sandbox/container-sandbox-errors.d.ts +10 -0
  24. package/dist/lib/sandbox/container-sandbox-errors.d.ts.map +1 -0
  25. package/dist/lib/sandbox/container-sandbox.d.ts +90 -0
  26. package/dist/lib/sandbox/container-sandbox.d.ts.map +1 -0
  27. package/dist/lib/sandbox/daytona-sandbox.d.ts.map +1 -1
  28. package/dist/lib/sandbox/docker-sandbox-errors.d.ts +2 -2
  29. package/dist/lib/sandbox/docker-sandbox-errors.d.ts.map +1 -1
  30. package/dist/lib/sandbox/docker-sandbox.d.ts +122 -189
  31. package/dist/lib/sandbox/docker-sandbox.d.ts.map +1 -1
  32. package/dist/lib/sandbox/index.d.ts +6 -1
  33. package/dist/lib/sandbox/index.d.ts.map +1 -1
  34. package/dist/lib/sandbox/installers/bin.d.ts.map +1 -1
  35. package/dist/lib/sandbox/installers/index.d.ts +7 -7
  36. package/dist/lib/sandbox/installers/index.d.ts.map +1 -1
  37. package/dist/lib/sandbox/installers/installer.d.ts +0 -5
  38. package/dist/lib/sandbox/installers/installer.d.ts.map +1 -1
  39. package/dist/lib/sandbox/installers/url-binary.d.ts.map +1 -1
  40. package/dist/lib/sandbox/shell-quote.d.ts +10 -0
  41. package/dist/lib/sandbox/shell-quote.d.ts.map +1 -0
  42. package/dist/lib/sandbox/strace/file-change.d.ts +21 -0
  43. package/dist/lib/sandbox/strace/file-change.d.ts.map +1 -0
  44. package/dist/lib/sandbox/strace/file-changes.d.ts +66 -0
  45. package/dist/lib/sandbox/strace/file-changes.d.ts.map +1 -0
  46. package/dist/lib/sandbox/strace/index.d.ts +74 -0
  47. package/dist/lib/sandbox/strace/index.d.ts.map +1 -0
  48. package/dist/lib/sandbox/strace/index.js +296 -0
  49. package/dist/lib/sandbox/strace/index.js.map +7 -0
  50. package/dist/lib/sandbox/types.d.ts +9 -4
  51. package/dist/lib/sandbox/types.d.ts.map +1 -1
  52. package/dist/lib/sandbox/virtual-sandbox.d.ts.map +1 -1
  53. package/dist/lib/save/save-pipeline.d.ts +1 -13
  54. package/dist/lib/save/save-pipeline.d.ts.map +1 -1
  55. package/dist/lib/skills/skill-reminder.d.ts +2 -2
  56. package/dist/lib/skills/skill-reminder.d.ts.map +1 -1
  57. package/package.json +9 -3
  58. package/dist/lib/sandbox/file-changes.d.ts +0 -83
  59. package/dist/lib/sandbox/file-changes.d.ts.map +0 -1
@@ -1,83 +0,0 @@
1
- import type { DisposableSandbox } from './types.ts';
2
- /**
3
- * A single filesystem mutation observed for one tool call. Ops are
4
- * deliberately coarse: strace cannot distinguish a brand-new file from an
5
- * overwrite within a single command (both are `O_CREAT|O_TRUNC`), so
6
- * content-touching syscalls collapse to `write`. `delete` and `rename` are
7
- * unambiguous. Reads are not tracked — strace's syscall filter excludes them.
8
- */
9
- export type FileChangeOp = 'write' | 'delete' | 'rename';
10
- export interface FileChange {
11
- op: FileChangeOp;
12
- path: string;
13
- /** Source path for a `rename`. */
14
- from?: string;
15
- timestamp: number;
16
- }
17
- export type StraceUnavailableReason = 'ptrace-blocked' | 'strace-missing' | 'trace-unparseable';
18
- /**
19
- * Thrown by {@link selfTestStrace} when per-command strace tracking cannot be
20
- * used. `reason` lets callers branch (fix-image vs fix-caps vs fix-arch). This
21
- * is a hard failure by design — there is no silent degrade to the snapshot
22
- * observer.
23
- */
24
- export declare class StraceUnavailableError extends Error {
25
- readonly reason: StraceUnavailableReason;
26
- readonly diagnostics: string;
27
- constructor(reason: StraceUnavailableReason, diagnostics: string);
28
- }
29
- export interface ParseStraceOptions {
30
- destination: string;
31
- traceFile?: string;
32
- traceDir?: string;
33
- }
34
- /**
35
- * Parse one command's strace output into a coarse `FileChange[]`. Failed
36
- * syscalls are skipped; paths are filtered to `destination`; the trace file and
37
- * `/proc`,`/sys`,`/dev` are excluded. Per-path final state collapses repeated
38
- * writes to one `write`; a path written then deleted within the command is
39
- * treated as transient and dropped.
40
- */
41
- export declare function parseStraceTrace(raw: string, options: ParseStraceOptions): FileChange[];
42
- export interface TraceFileChangesOptions {
43
- destination: string;
44
- onFileChanges?: (changes: FileChange[]) => void | Promise<void>;
45
- /**
46
- * Called when `onFileChanges` throws on the `spawn` path — its only failure
47
- * signal, since spawn has no tool result and no exception catcher upstream. A
48
- * throw on the tool-call path fails the command instead, so it never reaches
49
- * here. Defaults to `console.warn`.
50
- */
51
- onError?: (error: unknown) => void;
52
- traceDir?: string;
53
- }
54
- /**
55
- * Decorates a sandbox so each `executeCommand` is traced and its filesystem
56
- * mutations parsed into a per-call `FileChange[]`. Per-call attribution is
57
- * structural — one trace file per `callId` — so it is safe under concurrent
58
- * tool calls. Each call's manifest is surfaced two stateless ways: attached to
59
- * the tool result via the bash-meta channel (`meta.fileChanges`, hidden from the
60
- * model) and passed to `onFileChanges`. No buffer is retained.
61
- *
62
- * `readFile` passes through unchanged; `writeFiles` is observed directly (it
63
- * mutates outside strace's view) — each written file under the observation root
64
- * becomes a `write` change fed to onFileChanges. `dispose` also sweeps the trace
65
- * dir. `spawn` is traced the same way — its trace is read when the process exits
66
- * (strace is the top process, so the trace is fully flushed by then). `spawn`
67
- * carries no bash-meta scope, so its changes go to `onFileChanges` only.
68
- *
69
- * The trace file is always swept once parsed. A throwing `onFileChanges` on the
70
- * tool-call path propagates to `withBashExceptionCatch` one level up: a caller's
71
- * `BashException` becomes the tool result (via its `format()`), any other error
72
- * fails the tool call. The `spawn` path has no exception catcher, so its throw is
73
- * isolated and surfaced only via `onError` (exit result preserved).
74
- */
75
- export declare function traceFileChanges(sandbox: DisposableSandbox, options: TraceFileChangesOptions): DisposableSandbox;
76
- /**
77
- * One-time probe at sandbox setup. Runs a known create/write/rename sequence
78
- * under strace and asserts the trace is clean and parseable. Throws
79
- * {@link StraceUnavailableError} (hard-fail) when ptrace is blocked, strace is
80
- * absent, or the trace is garbled (e.g. amd64 under Rosetta).
81
- */
82
- export declare function selfTestStrace(sandbox: DisposableSandbox): Promise<void>;
83
- //# sourceMappingURL=file-changes.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"file-changes.d.ts","sourceRoot":"","sources":["../../../src/lib/sandbox/file-changes.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEzD,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,YAAY,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;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