@deepagents/context 3.0.1 → 4.0.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 (61) hide show
  1. package/README.md +94 -4
  2. package/dist/browser.js +88 -146
  3. package/dist/browser.js.map +3 -3
  4. package/dist/index.d.ts +1 -0
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +1085 -687
  7. package/dist/index.js.map +4 -4
  8. package/dist/lib/agent.d.ts.map +1 -1
  9. package/dist/lib/chain-summary.d.ts +1 -0
  10. package/dist/lib/chain-summary.d.ts.map +1 -1
  11. package/dist/lib/chat.d.ts.map +1 -1
  12. package/dist/lib/engine.d.ts +51 -1
  13. package/dist/lib/engine.d.ts.map +1 -1
  14. package/dist/lib/fragments/message/user.d.ts +89 -95
  15. package/dist/lib/fragments/message/user.d.ts.map +1 -1
  16. package/dist/lib/fragments/reminders/once.d.ts +22 -0
  17. package/dist/lib/fragments/reminders/once.d.ts.map +1 -0
  18. package/dist/lib/fragments/reminders/turn-predicates.d.ts +1 -1
  19. package/dist/lib/fragments/reminders/turn-predicates.d.ts.map +1 -1
  20. package/dist/lib/sandbox/agent-os-sandbox.d.ts.map +1 -1
  21. package/dist/lib/sandbox/bash-tool.d.ts +9 -4
  22. package/dist/lib/sandbox/bash-tool.d.ts.map +1 -1
  23. package/dist/lib/sandbox/daytona-sandbox.d.ts.map +1 -1
  24. package/dist/lib/sandbox/docker-sandbox.d.ts +43 -0
  25. package/dist/lib/sandbox/docker-sandbox.d.ts.map +1 -1
  26. package/dist/lib/sandbox/index.d.ts +2 -1
  27. package/dist/lib/sandbox/index.d.ts.map +1 -1
  28. package/dist/lib/sandbox/installers/bin.d.ts.map +1 -1
  29. package/dist/lib/sandbox/installers/index.d.ts +7 -7
  30. package/dist/lib/sandbox/installers/index.d.ts.map +1 -1
  31. package/dist/lib/sandbox/installers/installer.d.ts +0 -5
  32. package/dist/lib/sandbox/installers/installer.d.ts.map +1 -1
  33. package/dist/lib/sandbox/installers/url-binary.d.ts.map +1 -1
  34. package/dist/lib/sandbox/shell-quote.d.ts +10 -0
  35. package/dist/lib/sandbox/shell-quote.d.ts.map +1 -0
  36. package/dist/lib/sandbox/strace/file-change.d.ts +21 -0
  37. package/dist/lib/sandbox/strace/file-change.d.ts.map +1 -0
  38. package/dist/lib/sandbox/strace/file-changes.d.ts +66 -0
  39. package/dist/lib/sandbox/strace/file-changes.d.ts.map +1 -0
  40. package/dist/lib/sandbox/strace/index.d.ts +89 -0
  41. package/dist/lib/sandbox/strace/index.d.ts.map +1 -0
  42. package/dist/lib/sandbox/strace/index.js +285 -0
  43. package/dist/lib/sandbox/strace/index.js.map +7 -0
  44. package/dist/lib/sandbox/types.d.ts +6 -9
  45. package/dist/lib/sandbox/types.d.ts.map +1 -1
  46. package/dist/lib/sandbox/virtual-sandbox.d.ts.map +1 -1
  47. package/dist/lib/save/reminder-eval.d.ts +19 -0
  48. package/dist/lib/save/reminder-eval.d.ts.map +1 -0
  49. package/dist/lib/save/save-pipeline.d.ts +1 -7
  50. package/dist/lib/save/save-pipeline.d.ts.map +1 -1
  51. package/dist/lib/skills/skill-reminder.d.ts +2 -2
  52. package/dist/lib/skills/skill-reminder.d.ts.map +1 -1
  53. package/package.json +7 -2
  54. package/dist/lib/sandbox/file-events.d.ts +0 -42
  55. package/dist/lib/sandbox/file-events.d.ts.map +0 -1
  56. package/dist/lib/save/reminder-target-handler.d.ts +0 -36
  57. package/dist/lib/save/reminder-target-handler.d.ts.map +0 -1
  58. package/dist/lib/save/tool-output-target-handler.d.ts +0 -7
  59. package/dist/lib/save/tool-output-target-handler.d.ts.map +0 -1
  60. package/dist/lib/save/user-target-handler.d.ts +0 -7
  61. package/dist/lib/save/user-target-handler.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"docker-sandbox.d.ts","sourceRoot":"","sources":["../../../src/lib/sandbox/docker-sandbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aA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CAAC;cAIjB,IAAI,CAC3B,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,qBAAqB,GAC9B,OAAO,CAAC,aAAa,CAAC;cAkCN,YAAY,CAC7B,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,YAAY,GACrB,cAAc;cAkBQ,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAc5E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,iBAAiB,CAAC,CAqC5B;AAED;;;GAGG;AACH,wBAAsB,UAAU,CAAC,CAAC,EAChC,OAAO,EAAE,oBAAoB,EAC7B,EAAE,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC,CAAC,CAAC,GAC7C,OAAO,CAAC,CAAC,CAAC,CAOZ"}
@@ -3,12 +3,13 @@ export * from './agent-os-sandbox.ts';
3
3
  export * from './bash-exception.ts';
4
4
  export * from './bash-meta.ts';
5
5
  export * from './bash-tool.ts';
6
- export * from './file-events.ts';
7
6
  export * from './binary-bridges.ts';
8
7
  export * from './daytona-sandbox.ts';
9
8
  export * from './docker-sandbox.ts';
9
+ export * from './strace/file-changes.ts';
10
10
  export * from './gcs.ts';
11
11
  export * from './installers/index.ts';
12
+ export * from './shell-quote.ts';
12
13
  export * from './subcommand.ts';
13
14
  export * from './types.ts';
14
15
  export * from './upload-skills.ts';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/sandbox/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/sandbox/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,UAAU,CAAC;AACzB,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../../../../src/lib/sandbox/installers/bin.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAc,MAAM,gBAAgB,CAAC;AAE9E,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAKD;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,YAAa,SAAQ,SAAS;;IACzC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAC;gBAI1B,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAwB;IASvD,OAAO,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;CAoBpD;AAED,wBAAgB,GAAG,CACjB,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,mBAAmB,GAC5B,YAAY,CAEd"}
1
+ {"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../../../../src/lib/sandbox/installers/bin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElE,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAKD;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,YAAa,SAAQ,SAAS;;IACzC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAC;gBAI1B,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAwB;IASvD,OAAO,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;CAoBpD;AAED,wBAAgB,GAAG,CACjB,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,mBAAmB,GAC5B,YAAY,CAEd"}
@@ -1,8 +1,8 @@
1
- export { Installer, type InstallerContext, type PackageManager, createInstallerContext, isDebianBased, shellQuote, } from './installer.ts';
2
- export { PackageInstaller, pkg } from './package-manager.ts';
3
- export { type ArchitectureUrls, type UrlBinaryOptions, UrlBinaryInstaller, urlBinary, } from './url-binary.ts';
4
- export { type NpmInstallerOptions, NpmInstaller, npm } from './npm.ts';
5
- export { type BinInstallerOptions, BinInstaller, bin } from './bin.ts';
6
- export { type PipInstallerOptions, PipInstaller, pip } from './pip.ts';
7
- export { type GithubReleaseOptions, GithubReleaseInstaller, githubRelease, } from './github-release.ts';
1
+ export * from './installer.ts';
2
+ export * from './bin.ts';
3
+ export * from './github-release.ts';
4
+ export * from './npm.ts';
5
+ export * from './package-manager.ts';
6
+ export * from './pip.ts';
7
+ export * from './url-binary.ts';
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/sandbox/installers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,sBAAsB,EACtB,aAAa,EACb,UAAU,GACX,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,kBAAkB,EAClB,SAAS,GACV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,KAAK,mBAAmB,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AACvE,OAAO,EAAE,KAAK,mBAAmB,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AACvE,OAAO,EAAE,KAAK,mBAAmB,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AACvE,OAAO,EACL,KAAK,oBAAoB,EACzB,sBAAsB,EACtB,aAAa,GACd,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/sandbox/installers/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAE/B,cAAc,UAAU,CAAC;AACzB,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,sBAAsB,CAAC;AACrC,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC"}
@@ -35,10 +35,5 @@ export declare abstract class Installer {
35
35
  abstract install(ctx: InstallerContext): Promise<void>;
36
36
  }
37
37
  export declare function isDebianBased(image: string): boolean;
38
- /**
39
- * POSIX shell single-quote escape: wrap in `'...'`, replace any embedded
40
- * `'` with `'\''`. Safe for arbitrary content inside `sh -c`.
41
- */
42
- export declare function shellQuote(s: string): string;
43
38
  export declare function createInstallerContext(containerId: string, image: string): InstallerContext;
44
39
  //# sourceMappingURL=installer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"installer.d.ts","sourceRoot":"","sources":["../../../../src/lib/sandbox/installers/installer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AAQ/C,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,SAAS,CAAC;AAE/C;;;;;;;;GAQG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IACxC,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACxB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IAC9C;;;;OAIG;IACH,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnD;;;;;;OAMG;IACH,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACpE;AAED,8BAAsB,SAAS;IAC7B,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;CACvD;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAKpD;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,GACZ,gBAAgB,CAyGlB"}
1
+ {"version":3,"file":"installer.d.ts","sourceRoot":"","sources":["../../../../src/lib/sandbox/installers/installer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AAS/C,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,SAAS,CAAC;AAE/C;;;;;;;;GAQG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IACxC,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACxB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IAC9C;;;;OAIG;IACH,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnD;;;;;;OAMG;IACH,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACpE;AAED,8BAAsB,SAAS;IAC7B,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;CACvD;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAKpD;AAED,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,GACZ,gBAAgB,CAyGlB"}
@@ -1 +1 @@
1
- {"version":3,"file":"url-binary.d.ts","sourceRoot":"","sources":["../../../../src/lib/sandbox/installers/url-binary.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAc,MAAM,gBAAgB,CAAC;AAE9E,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAC;IACb,0EAA0E;IAC1E,GAAG,EAAE,MAAM,GAAG,gBAAgB,CAAC;IAC/B,qEAAqE;IACrE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,qBAAa,kBAAmB,SAAQ,SAAS;IAC/C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAC;gBAEvB,OAAO,EAAE,gBAAgB;IAM/B,OAAO,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;CASpD;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,kBAAkB,CAEvE;AAqBD,wBAAsB,kBAAkB,CACtC,GAAG,EAAE,gBAAgB,EACrB,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,EACX,UAAU,CAAC,EAAE,MAAM,EACnB,MAAM,GAAE,KAAK,GAAG,gBAAwB,GACvC,OAAO,CAAC,IAAI,CAAC,CAkBf"}
1
+ {"version":3,"file":"url-binary.d.ts","sourceRoot":"","sources":["../../../../src/lib/sandbox/installers/url-binary.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElE,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAC;IACb,0EAA0E;IAC1E,GAAG,EAAE,MAAM,GAAG,gBAAgB,CAAC;IAC/B,qEAAqE;IACrE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,qBAAa,kBAAmB,SAAQ,SAAS;IAC/C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAC;gBAEvB,OAAO,EAAE,gBAAgB;IAM/B,OAAO,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;CASpD;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,kBAAkB,CAEvE;AAqBD,wBAAsB,kBAAkB,CACtC,GAAG,EAAE,gBAAgB,EACrB,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,EACX,UAAU,CAAC,EAAE,MAAM,EACnB,MAAM,GAAE,KAAK,GAAG,gBAAwB,GACvC,OAAO,CAAC,IAAI,CAAC,CAkBf"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * POSIX shell single-quote escape: wrap in `'...'`, replace any embedded
3
+ * `'` with `'\''`. Safe for arbitrary content inside `sh -c`.
4
+ *
5
+ * Lives in its own zero-import module so node-builtins-only consumers (e.g. the
6
+ * lean `./sandbox/strace` leaf entry) can use it without dragging in the
7
+ * installer/runtime surface.
8
+ */
9
+ export declare function shellQuote(s: string): string;
10
+ //# sourceMappingURL=shell-quote.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shell-quote.d.ts","sourceRoot":"","sources":["../../../src/lib/sandbox/shell-quote.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAE5C"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * A single observed filesystem mutation — the shared output type of file-change
3
+ * tracking. It is producer-agnostic: the strace trace parser and the direct
4
+ * `writeFiles` observer both emit it. It lives in its own zero-import module so
5
+ * the lean `./sandbox/strace` leaf and the framework decorator can each depend
6
+ * on it without either owning the other.
7
+ *
8
+ * Ops are deliberately coarse — content-touching changes collapse to `write`
9
+ * (the strace producer cannot distinguish a brand-new file from an overwrite;
10
+ * both are `O_CREAT|O_TRUNC`), while `delete` and `rename` are unambiguous.
11
+ * Reads are not tracked.
12
+ */
13
+ export type FileChangeOp = 'write' | 'delete' | 'rename';
14
+ export interface FileChange {
15
+ op: FileChangeOp;
16
+ path: string;
17
+ /** Source path for a `rename`. */
18
+ from?: string;
19
+ timestamp: number;
20
+ }
21
+ //# sourceMappingURL=file-change.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-change.d.ts","sourceRoot":"","sources":["../../../../src/lib/sandbox/strace/file-change.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;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;IACd,SAAS,EAAE,MAAM,CAAC;CACnB"}
@@ -0,0 +1,66 @@
1
+ import type { DisposableSandbox } from '../types.ts';
2
+ import type { FileChange } from './file-change.ts';
3
+ export type { FileChange, FileChangeOp } from './file-change.ts';
4
+ export interface WithStraceFileChangesOptions {
5
+ /**
6
+ * Glob patterns (matched against absolute paths via Node's
7
+ * `path.matchesGlob`) selecting which file changes to report. Scope to a
8
+ * workspace with `[root, `${root}/**`]`. A path must match at least one
9
+ * pattern to be reported.
10
+ */
11
+ include: string[];
12
+ /**
13
+ * Glob patterns subtracted from `include` — a path matching any of these is
14
+ * dropped even if it also matches `include`. Use to keep framework-written
15
+ * files (e.g. an uploaded skills directory) out of the change stream.
16
+ */
17
+ exclude?: string[];
18
+ onFileChanges?: (changes: FileChange[]) => void | Promise<void>;
19
+ /**
20
+ * Called when `onFileChanges` throws on the `spawn` path — its only failure
21
+ * signal, since spawn has no tool result and no exception catcher upstream. A
22
+ * throw on the tool-call path fails the command instead, so it never reaches
23
+ * here. Defaults to `console.warn`.
24
+ */
25
+ onError?: (error: unknown) => void;
26
+ traceDir?: string;
27
+ }
28
+ /**
29
+ * A `with*` decorator that wraps the sandbox so each `executeCommand` is traced
30
+ * and its filesystem mutations parsed into a per-call `FileChange[]`. Per-call
31
+ * attribution is structural — one UUID-keyed trace file per call — so it is safe under
32
+ * concurrent tool calls. Each call's manifest is surfaced two stateless ways: attached to
33
+ * the tool result via the bash-meta channel (`meta.fileChanges`, hidden from the
34
+ * model) and passed to `onFileChanges`. No buffer is retained.
35
+ *
36
+ * This decorator lives on the main barrel (not the lean `./sandbox/strace`
37
+ * leaf) on purpose: the `meta.fileChanges` channel works by sharing one
38
+ * `bash-meta` AsyncLocalStorage with `createBashTool`, and AsyncLocalStorage
39
+ * context does not cross bundle boundaries — so the decorator must be bundled
40
+ * with `createBashTool`. The leaf carries only the self-contained probe.
41
+ *
42
+ * This decorator TRUSTS that strace tracing works in the sandbox; it does not
43
+ * self-test. "strace works here" is an invariant of the (image + host kernel +
44
+ * seccomp/caps) that is constant for the container's lifetime, so verifying it
45
+ * is the consumer's once-per-container responsibility — run `selfTestStrace`
46
+ * (from `@deepagents/context/sandbox/strace`) once at startup (e.g. a daemon
47
+ * boot gate), which throws `StraceUnavailableError` if strace is unusable.
48
+ * Re-proving it per composition would re-pay several host→container round-trips
49
+ * on every tool call for no new information.
50
+ *
51
+ * `readFile` passes through unchanged; `writeFiles` is observed directly (it
52
+ * mutates outside strace's view) — each written file matching the
53
+ * `include`/`exclude` globs becomes a `write` change fed to onFileChanges.
54
+ * `dispose` also sweeps the trace
55
+ * dir. `spawn` is traced the same way — its trace is read when the process exits
56
+ * (strace is the top process, so the trace is fully flushed by then). `spawn`
57
+ * carries no bash-meta scope, so its changes go to `onFileChanges` only.
58
+ *
59
+ * The trace file is always swept once parsed. A throwing `onFileChanges` on the
60
+ * tool-call path propagates to `withBashExceptionCatch` one level up: a caller's
61
+ * `BashException` becomes the tool result (via its `format()`), any other error
62
+ * fails the tool call. The `spawn` path has no exception catcher, so its throw is
63
+ * isolated and surfaced only via `onError`.
64
+ */
65
+ export declare function withStraceFileChanges(sandbox: DisposableSandbox, options: WithStraceFileChangesOptions): Promise<DisposableSandbox>;
66
+ //# sourceMappingURL=file-changes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-changes.d.ts","sourceRoot":"","sources":["../../../../src/lib/sandbox/strace/file-changes.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AASnD,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAajE,MAAM,WAAW,4BAA4B;IAC3C;;;;;OAKG;IACH,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChE;;;;;OAKG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AASD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,iBAAiB,EAC1B,OAAO,EAAE,4BAA4B,GACpC,OAAO,CAAC,iBAAiB,CAAC,CAuI5B"}
@@ -0,0 +1,89 @@
1
+ import type { FileChange } from './file-change.ts';
2
+ export type { FileChange, FileChangeOp } from './file-change.ts';
3
+ export type StraceUnavailableReason = 'ptrace-blocked' | 'strace-missing' | 'trace-unparseable';
4
+ /**
5
+ * Thrown by {@link selfTestStrace} when per-command strace tracking cannot be
6
+ * used. `reason` lets callers branch (fix-image vs fix-caps vs fix-arch). This
7
+ * is a hard failure by design — there is no silent degrade to the snapshot
8
+ * observer.
9
+ */
10
+ export declare class StraceUnavailableError extends Error {
11
+ readonly reason: StraceUnavailableReason;
12
+ readonly diagnostics: string;
13
+ constructor(reason: StraceUnavailableReason, diagnostics: string);
14
+ }
15
+ /**
16
+ * Wraps `command` so its filesystem syscalls are traced to `traceFile`. Both
17
+ * the inner command and this wrapper are re-parsed by a shell (`sh -c`), so the
18
+ * single-quoting via {@link shellQuote} composes with the backend's own
19
+ * `sh -c`. strace propagates the traced command's exit code. The `mkdir -p`
20
+ * runs before strace (so it isn't traced) and self-heals the trace dir per
21
+ * command — if it ever disappears mid-session, the next command recreates it
22
+ * rather than strace failing to open `-o` and skipping the command entirely.
23
+ */
24
+ export declare function buildStraceCommand(command: string, traceFile: string, traceDir: string): string;
25
+ /**
26
+ * Like {@link buildStraceCommand}, but dumps the (base64) trace inline on stdout
27
+ * after `sentinel`, then exits with the traced command's code. This lets one
28
+ * `executeCommand` round-trip carry both the command output and its trace — no
29
+ * second `readFile` exec to pull the trace out of the container. Pair with
30
+ * {@link splitTracedOutput}. `sentinel` must be unguessable (a UUID) so the
31
+ * command's own stdout cannot contain it. `base64` keeps the trace stream-safe
32
+ * and its stderr is dropped so a missing trace (strace failed) doesn't leak into
33
+ * the command's stderr.
34
+ */
35
+ export declare function buildTracedCommand(command: string, traceFile: string, traceDir: string, sentinel: string): string;
36
+ /**
37
+ * Split {@link buildTracedCommand} output into the command's own stdout and its
38
+ * decoded strace trace. A missing sentinel (strace produced nothing) yields an
39
+ * empty trace so the caller degrades to "no changes".
40
+ */
41
+ export declare function splitTracedOutput(stdout: string, sentinel: string): {
42
+ stdout: string;
43
+ trace: string;
44
+ };
45
+ export interface ParseStraceOptions {
46
+ include: string[];
47
+ exclude?: string[];
48
+ traceFile?: string;
49
+ traceDir?: string;
50
+ }
51
+ /** A path is tracked when it matches an `include` glob and no `exclude` glob. */
52
+ export declare function matchesGlobs(path: string, include: string[], exclude?: string[]): boolean;
53
+ /**
54
+ * Parse one command's strace output into a coarse `FileChange[]`. Failed
55
+ * syscalls are skipped; paths are filtered to `destination`; the trace file and
56
+ * `/proc`,`/sys`,`/dev` are excluded. Per-path final state collapses repeated
57
+ * writes to one `write`; a path written then deleted within the command is
58
+ * treated as transient and dropped.
59
+ */
60
+ export declare function parseStraceTrace(raw: string, options: ParseStraceOptions): FileChange[];
61
+ /**
62
+ * The minimal structural surface {@link selfTestStrace} needs from its host.
63
+ * Deliberately narrower than `DisposableSandbox` so the probe can run anywhere:
64
+ * a remote/docker caller passes its sandbox unchanged (it satisfies this shape
65
+ * structurally), and an in-process caller (e.g. a daemon running as PID 1
66
+ * inside the container) implements just these two methods over
67
+ * `node:child_process` + `node:fs`.
68
+ */
69
+ export interface StraceHost {
70
+ executeCommand(command: string): Promise<{
71
+ exitCode: number;
72
+ stderr: string;
73
+ }>;
74
+ readFile(path: string): Promise<string>;
75
+ }
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
+ * "strace works in this sandbox" is an invariant of the (image + host kernel +
83
+ * seccomp/caps) — constant across every tool call and chat turn in a given
84
+ * container — so this is the consumer's once-per-container responsibility (e.g.
85
+ * a daemon boot gate), NOT a per-tool cost. `createBashTool` /
86
+ * `withStraceFileChanges` no longer call it.
87
+ */
88
+ export declare function selfTestStrace(host: StraceHost): Promise<void>;
89
+ //# sour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,EAAE,EACjB,OAAO,CAAC,EAAE,MAAM,EAAE,GACjB,OAAO,CAKT;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,kBAAkB,GAC1B,UAAU,EAAE,CAiGd;AASD;;;;;;;GAOG;AACH,MAAM,WAAW,UAAU;IACzB,cAAc,CACZ,OAAO,EAAE,MAAM,GACd,OAAO,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACjD,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACzC;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAsDpE"}
@@ -0,0 +1,285 @@
1
+ // packages/context/src/lib/sandbox/strace/index.ts
2
+ import { randomUUID } from "node:crypto";
3
+ import { posix } from "node:path";
4
+
5
+ // packages/context/src/lib/sandbox/shell-quote.ts
6
+ function shellQuote(s) {
7
+ return `'${s.replace(/'/g, `'\\''`)}'`;
8
+ }
9
+
10
+ // packages/context/src/lib/sandbox/strace/index.ts
11
+ var REASON_HINT = {
12
+ "ptrace-blocked": "ptrace is denied by the sandbox runtime. Modern Docker permits it by default; on a hardened host, relax the runtime seccomp/ptrace policy (allow the ptrace syscall, or add the SYS_PTRACE capability).",
13
+ "strace-missing": "strace is not installed in the sandbox image. Bake `strace` into the image.",
14
+ "trace-unparseable": "strace ran but its output is unusable \u2014 the sandbox is likely running under emulation (e.g. amd64 via Rosetta). Use a native-architecture sandbox."
15
+ };
16
+ var StraceUnavailableError = class extends Error {
17
+ reason;
18
+ diagnostics;
19
+ constructor(reason, diagnostics) {
20
+ super(
21
+ `strace file-change tracking unavailable (${reason}): ${REASON_HINT[reason]}`
22
+ );
23
+ this.name = "StraceUnavailableError";
24
+ this.reason = reason;
25
+ this.diagnostics = diagnostics;
26
+ }
27
+ };
28
+ var STRACE_FLAGS = "-f -y -qq -e trace=%file,write,pwrite64,writev";
29
+ function buildStraceCommand(command, traceFile, traceDir) {
30
+ return `mkdir -p ${shellQuote(traceDir)} 2>/dev/null; strace ${STRACE_FLAGS} -o ${shellQuote(traceFile)} -- sh -c ${shellQuote(command)}`;
31
+ }
32
+ function buildTracedCommand(command, traceFile, traceDir, sentinel) {
33
+ return `mkdir -p ${shellQuote(traceDir)} 2>/dev/null; strace ${STRACE_FLAGS} -o ${shellQuote(traceFile)} -- sh -c ${shellQuote(command)}; __dat_rc=$?; printf '\\n%s\\n' ${shellQuote(sentinel)}; base64 ${shellQuote(traceFile)} 2>/dev/null; rm -f ${shellQuote(traceFile)} 2>/dev/null; exit $__dat_rc`;
34
+ }
35
+ function splitTracedOutput(stdout, sentinel) {
36
+ const marker = `
37
+ ${sentinel}
38
+ `;
39
+ const at = stdout.indexOf(marker);
40
+ if (at === -1) return { stdout, trace: "" };
41
+ const base64 = stdout.slice(at + marker.length);
42
+ return {
43
+ stdout: stdout.slice(0, at),
44
+ trace: base64 ? Buffer.from(base64, "base64").toString("utf8") : ""
45
+ };
46
+ }
47
+ var CREATE_OR_TRUNC_FLAGS = /O_(CREAT|TRUNC)/;
48
+ var RENAME_SYSCALLS = /* @__PURE__ */ new Set(["rename", "renameat", "renameat2"]);
49
+ var DELETE_SYSCALLS = /* @__PURE__ */ new Set(["unlink", "unlinkat", "rmdir"]);
50
+ var MKDIR_SYSCALLS = /* @__PURE__ */ new Set(["mkdir", "mkdirat"]);
51
+ var LINK_SYSCALLS = /* @__PURE__ */ new Set(["link", "linkat", "symlink", "symlinkat"]);
52
+ var OPEN_SYSCALLS = /* @__PURE__ */ new Set(["open", "openat", "openat2", "creat"]);
53
+ var WRITE_SYSCALLS = /* @__PURE__ */ new Set([
54
+ "write",
55
+ "pwrite64",
56
+ "pwrite",
57
+ "writev",
58
+ "pwritev2"
59
+ ]);
60
+ var TRUNCATE_SYSCALLS = /* @__PURE__ */ new Set(["truncate", "ftruncate"]);
61
+ function stitchLines(raw) {
62
+ const pending = /* @__PURE__ */ new Map();
63
+ const out = [];
64
+ for (const original of raw.split("\n")) {
65
+ const line = original.trimEnd();
66
+ if (!line) continue;
67
+ const pid = line.match(/^\s*(\d+)\s+/)?.[1] ?? "0";
68
+ if (/<unfinished \.\.\.>\s*$/.test(line)) {
69
+ pending.set(pid, line.replace(/<unfinished \.\.\.>\s*$/, ""));
70
+ continue;
71
+ }
72
+ const resumed = line.match(/<\.\.\.\s+\S+\s+resumed>(.*)$/);
73
+ if (resumed) {
74
+ const head = pending.get(pid);
75
+ pending.delete(pid);
76
+ if (head !== void 0) out.push(head + resumed[1]);
77
+ continue;
78
+ }
79
+ out.push(line);
80
+ }
81
+ return out;
82
+ }
83
+ function parseCall(line) {
84
+ const m = line.match(
85
+ /^\s*(?:\d+\s+)?([a-z_][a-z0-9_]*)\((.*)\)\s*=\s*(.+?)\s*$/
86
+ );
87
+ if (!m) return null;
88
+ const [, syscall, args, rest] = m;
89
+ const errnoMatch = rest.match(/^(-?\d+)\s+([A-Z][A-Z0-9_]*)/);
90
+ if (errnoMatch) {
91
+ return { syscall, args, retval: errnoMatch[1], errno: errnoMatch[2] };
92
+ }
93
+ return { syscall, args, retval: rest.split(/\s+/)[0] };
94
+ }
95
+ var STRACE_ESCAPE = {
96
+ n: 10,
97
+ t: 9,
98
+ r: 13,
99
+ v: 11,
100
+ f: 12,
101
+ '"': 34,
102
+ "\\": 92
103
+ };
104
+ function decodeStraceString(s) {
105
+ const bytes = [];
106
+ for (let i = 0; i < s.length; ) {
107
+ if (s[i] === "\\" && i + 1 < s.length) {
108
+ const octal = s.slice(i + 1, i + 4).match(/^[0-7]{1,3}/)?.[0];
109
+ if (octal) {
110
+ bytes.push(parseInt(octal, 8) & 255);
111
+ i += 1 + octal.length;
112
+ continue;
113
+ }
114
+ const mapped = STRACE_ESCAPE[s[i + 1]];
115
+ bytes.push(mapped ?? s.charCodeAt(i + 1));
116
+ i += 2;
117
+ continue;
118
+ }
119
+ const code = s.charCodeAt(i);
120
+ if (code < 128) bytes.push(code);
121
+ else for (const b of Buffer.from(s[i], "utf8")) bytes.push(b);
122
+ i += 1;
123
+ }
124
+ return Buffer.from(bytes).toString("utf8");
125
+ }
126
+ function quotedStrings(args) {
127
+ const out = [];
128
+ const re = /"((?:[^"\\]|\\.)*)"/g;
129
+ let m;
130
+ while ((m = re.exec(args)) !== null) {
131
+ out.push(decodeStraceString(m[1]));
132
+ }
133
+ return out;
134
+ }
135
+ function dirfdPath(args) {
136
+ return args.match(/^\s*(?:AT_FDCWD|-?\d+)<([^>]*)>/)?.[1] ?? "/";
137
+ }
138
+ function fdPath(args) {
139
+ return args.match(/^\s*-?\d+<([^>]*)>/)?.[1] ?? null;
140
+ }
141
+ function openFlags(args) {
142
+ return args.match(/\bO_[A-Z_]+(?:\|O_[A-Z_]+)*/)?.[0] ?? "";
143
+ }
144
+ function matchesGlobs(path, include, exclude) {
145
+ return include.some((glob) => posix.matchesGlob(path, glob)) && !exclude?.some((glob) => posix.matchesGlob(path, glob));
146
+ }
147
+ function parseStraceTrace(raw, options) {
148
+ const { include, exclude, traceDir, traceFile } = options;
149
+ const now = Date.now();
150
+ const state = /* @__PURE__ */ new Map();
151
+ const renames = [];
152
+ const resolve = (dir, p) => posix.normalize(p.startsWith("/") ? p : posix.join(dir, p));
153
+ const write = (path) => {
154
+ state.set(path, "write");
155
+ };
156
+ const remove = (path) => {
157
+ if (state.get(path) === "write") state.delete(path);
158
+ else state.set(path, "delete");
159
+ };
160
+ for (const line of stitchLines(raw)) {
161
+ const call = parseCall(line);
162
+ if (!call || call.errno || call.retval === "-1") continue;
163
+ const { syscall, args } = call;
164
+ const dir = dirfdPath(args);
165
+ if (RENAME_SYSCALLS.has(syscall)) {
166
+ const strings = quotedStrings(args);
167
+ if (strings.length < 2) continue;
168
+ const from = resolve(dir, strings[0]);
169
+ const to = resolve(dir, strings[strings.length - 1]);
170
+ state.delete(from);
171
+ renames.push({ from, to });
172
+ continue;
173
+ }
174
+ if (DELETE_SYSCALLS.has(syscall)) {
175
+ const strings = quotedStrings(args);
176
+ if (strings.length) remove(resolve(dir, strings[0]));
177
+ continue;
178
+ }
179
+ if (MKDIR_SYSCALLS.has(syscall)) {
180
+ const strings = quotedStrings(args);
181
+ if (strings.length) write(resolve(dir, strings[0]));
182
+ continue;
183
+ }
184
+ if (LINK_SYSCALLS.has(syscall)) {
185
+ const strings = quotedStrings(args);
186
+ if (strings.length) write(resolve(dir, strings[strings.length - 1]));
187
+ continue;
188
+ }
189
+ if (OPEN_SYSCALLS.has(syscall)) {
190
+ if (!CREATE_OR_TRUNC_FLAGS.test(openFlags(args))) continue;
191
+ const strings = quotedStrings(args);
192
+ if (strings.length) write(resolve(dir, strings[0]));
193
+ continue;
194
+ }
195
+ if (WRITE_SYSCALLS.has(syscall)) {
196
+ const p = fdPath(args);
197
+ if (p && Number(call.retval) > 0) write(posix.normalize(p));
198
+ continue;
199
+ }
200
+ if (TRUNCATE_SYSCALLS.has(syscall)) {
201
+ const p = fdPath(args) ?? quotedStrings(args)[0];
202
+ if (p) write(resolve(dir, p));
203
+ }
204
+ }
205
+ const keep = (path) => {
206
+ if (traceFile && path === traceFile) return false;
207
+ if (traceDir && (path === traceDir || path.startsWith(`${traceDir}/`))) {
208
+ return false;
209
+ }
210
+ if (/^\/(proc|sys|dev)(\/|$)/.test(path)) return false;
211
+ return matchesGlobs(path, include, exclude);
212
+ };
213
+ const changes = [];
214
+ const emittedRenameTargets = /* @__PURE__ */ new Set();
215
+ for (const { from, to } of renames) {
216
+ if (!keep(to)) continue;
217
+ if (state.get(to) === "delete") continue;
218
+ changes.push({ op: "rename", path: to, from, timestamp: now });
219
+ emittedRenameTargets.add(to);
220
+ }
221
+ const tail = [];
222
+ for (const [path, op] of state) {
223
+ if (emittedRenameTargets.has(path)) continue;
224
+ if (keep(path)) tail.push({ op, path, timestamp: now });
225
+ }
226
+ tail.sort((a, b) => {
227
+ if (a.path < b.path) return -1;
228
+ if (a.path > b.path) return 1;
229
+ return 0;
230
+ });
231
+ changes.push(...tail);
232
+ return changes;
233
+ }
234
+ var PTRACE_DENIED = /strace:[^\n]*(?:PTRACE_TRACEME|ptrace|Operation not permitted|EPERM)/i;
235
+ var STRACE_MISSING = /strace:?\s+(?:command\s+)?not found/i;
236
+ async function selfTestStrace(host) {
237
+ const probeDir = `/tmp/dat-strace-${randomUUID()}`;
238
+ const traceFile = `/tmp/dat-strace-${randomUUID()}.trace`;
239
+ const q = shellQuote;
240
+ const sequence = `mkdir -p ${q(probeDir)} && echo hi > ${q(`${probeDir}/a.txt`)} && mv ${q(`${probeDir}/a.txt`)} ${q(`${probeDir}/b.txt`)} && echo more > ${q(`${probeDir}/c.txt`)}`;
241
+ const wrapped = buildStraceCommand(sequence, traceFile, "/tmp");
242
+ let result;
243
+ let raw = "";
244
+ try {
245
+ result = await host.executeCommand(wrapped);
246
+ raw = await host.readFile(traceFile).catch(() => "");
247
+ const diagnostics = `exit=${result.exitCode}
248
+ stderr=${result.stderr}
249
+ trace[0:600]=${raw.slice(0, 600)}`;
250
+ if (PTRACE_DENIED.test(result.stderr)) {
251
+ throw new StraceUnavailableError("ptrace-blocked", diagnostics);
252
+ }
253
+ if (!raw || result.exitCode === 127 || STRACE_MISSING.test(result.stderr)) {
254
+ throw new StraceUnavailableError("strace-missing", diagnostics);
255
+ }
256
+ const changes = parseStraceTrace(raw, {
257
+ include: [probeDir, `${probeDir}/**`],
258
+ traceFile
259
+ });
260
+ const hasRealFdPath = raw.includes(`<${probeDir}/`);
261
+ const hasRename = changes.some(
262
+ (c) => c.op === "rename" && c.from === `${probeDir}/a.txt` && c.path === `${probeDir}/b.txt`
263
+ );
264
+ const hasWrite = changes.some((c) => c.op === "write");
265
+ const allUnderDir = changes.every(
266
+ (c) => c.path === probeDir || c.path.startsWith(`${probeDir}/`)
267
+ );
268
+ if (!hasRealFdPath || !hasRename || !hasWrite || !allUnderDir) {
269
+ throw new StraceUnavailableError("trace-unparseable", diagnostics);
270
+ }
271
+ } finally {
272
+ void host.executeCommand(`rm -rf ${q(probeDir)} ${q(traceFile)}`).catch(() => {
273
+ });
274
+ }
275
+ }
276
+ export {
277
+ StraceUnavailableError,
278
+ buildStraceCommand,
279
+ buildTracedCommand,
280
+ matchesGlobs,
281
+ parseStraceTrace,
282
+ selfTestStrace,
283
+ splitTracedOutput
284
+ };
285
+ //# sourceMappingURL=index.js.map