@gaunt-sloth/agent 2.0.0-alpha.4 → 2.0.0-alpha.40

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 (126) hide show
  1. package/README.md +73 -23
  2. package/cli-acp.js +21 -24
  3. package/dist/builtInToolsConfig.d.ts +17 -3
  4. package/dist/builtInToolsConfig.js +43 -41
  5. package/dist/builtInToolsConfig.js.map +1 -1
  6. package/dist/core/debugCapture.d.ts +7 -49
  7. package/dist/core/debugCapture.js +1 -1
  8. package/dist/core/debugCapture.js.map +1 -1
  9. package/dist/core/resolveAgentFactory.d.ts +15 -0
  10. package/dist/core/resolveAgentFactory.js +17 -0
  11. package/dist/core/resolveAgentFactory.js.map +1 -0
  12. package/dist/index.d.ts +5 -4
  13. package/dist/index.js +8 -5
  14. package/dist/index.js.map +1 -1
  15. package/dist/mcp/OAuthClientProviderImpl.js.map +1 -1
  16. package/dist/mcp/tlsTrust.d.ts +61 -0
  17. package/dist/mcp/tlsTrust.js +109 -0
  18. package/dist/mcp/tlsTrust.js.map +1 -0
  19. package/dist/middleware/binaryContentInjectionMiddleware.d.ts +8 -1
  20. package/dist/middleware/binaryContentInjectionMiddleware.js +11 -2
  21. package/dist/middleware/binaryContentInjectionMiddleware.js.map +1 -1
  22. package/dist/middleware/frontendImageInjectionMiddleware.d.ts +107 -0
  23. package/dist/middleware/frontendImageInjectionMiddleware.js +167 -0
  24. package/dist/middleware/frontendImageInjectionMiddleware.js.map +1 -0
  25. package/dist/middleware/registry.js +49 -1
  26. package/dist/middleware/registry.js.map +1 -1
  27. package/dist/middleware/types.d.ts +16 -2
  28. package/dist/modules/a2a/A2AClientWrapper.d.ts +56 -1
  29. package/dist/modules/a2a/A2AClientWrapper.js +131 -31
  30. package/dist/modules/a2a/A2AClientWrapper.js.map +1 -1
  31. package/dist/modules/acp/acpAgentApp.d.ts +57 -0
  32. package/dist/modules/acp/acpAgentApp.js +378 -0
  33. package/dist/modules/acp/acpAgentApp.js.map +1 -0
  34. package/dist/modules/acp/acpAgentAppV1.d.ts +52 -0
  35. package/dist/modules/acp/acpAgentAppV1.js +307 -0
  36. package/dist/modules/acp/acpAgentAppV1.js.map +1 -0
  37. package/dist/modules/acp/acpCommon.d.ts +167 -0
  38. package/dist/modules/acp/acpCommon.js +282 -0
  39. package/dist/modules/acp/acpCommon.js.map +1 -0
  40. package/dist/modules/acp/acpPermissions.d.ts +65 -0
  41. package/dist/modules/acp/acpPermissions.js +162 -0
  42. package/dist/modules/acp/acpPermissions.js.map +1 -0
  43. package/dist/modules/acp/acpPermissionsV1.d.ts +45 -0
  44. package/dist/modules/acp/acpPermissionsV1.js +110 -0
  45. package/dist/modules/acp/acpPermissionsV1.js.map +1 -0
  46. package/dist/modules/acp/acpRouter.d.ts +41 -0
  47. package/dist/modules/acp/acpRouter.js +48 -0
  48. package/dist/modules/acp/acpRouter.js.map +1 -0
  49. package/dist/modules/acp/acpStdio.d.ts +47 -0
  50. package/dist/modules/acp/acpStdio.js +71 -0
  51. package/dist/modules/acp/acpStdio.js.map +1 -0
  52. package/dist/modules/acp/acpToolCalls.d.ts +93 -0
  53. package/dist/modules/acp/acpToolCalls.js +193 -0
  54. package/dist/modules/acp/acpToolCalls.js.map +1 -0
  55. package/dist/modules/acp/acpUpdates.d.ts +48 -0
  56. package/dist/modules/acp/acpUpdates.js +142 -0
  57. package/dist/modules/acp/acpUpdates.js.map +1 -0
  58. package/dist/modules/acp/acpUpdatesV1.d.ts +61 -0
  59. package/dist/modules/acp/acpUpdatesV1.js +162 -0
  60. package/dist/modules/acp/acpUpdatesV1.js.map +1 -0
  61. package/dist/modules/apiAgUiModule.d.ts +87 -0
  62. package/dist/modules/apiAgUiModule.js +225 -32
  63. package/dist/modules/apiAgUiModule.js.map +1 -1
  64. package/dist/modules/interactiveSessionModule.js +524 -50
  65. package/dist/modules/interactiveSessionModule.js.map +1 -1
  66. package/dist/modules/slashCommands.d.ts +582 -0
  67. package/dist/modules/slashCommands.js +1001 -0
  68. package/dist/modules/slashCommands.js.map +1 -0
  69. package/dist/resolvers.js +119 -9
  70. package/dist/resolvers.js.map +1 -1
  71. package/dist/tools/GthCustomToolkit.js +95 -11
  72. package/dist/tools/GthCustomToolkit.js.map +1 -1
  73. package/dist/tools/GthDevToolkit.d.ts +9 -33
  74. package/dist/tools/GthDevToolkit.js +94 -73
  75. package/dist/tools/GthDevToolkit.js.map +1 -1
  76. package/dist/tools/GthFileSystemToolkit.d.ts +63 -0
  77. package/dist/tools/GthFileSystemToolkit.js +506 -105
  78. package/dist/tools/GthFileSystemToolkit.js.map +1 -1
  79. package/dist/tools/McpResourceTool.d.ts +31 -0
  80. package/dist/tools/McpResourceTool.js +106 -0
  81. package/dist/tools/McpResourceTool.js.map +1 -0
  82. package/dist/tools/gthChecklistTool.d.ts +30 -0
  83. package/dist/tools/gthChecklistTool.js +80 -0
  84. package/dist/tools/gthChecklistTool.js.map +1 -0
  85. package/dist/tools/gthGrepTool.d.ts +54 -0
  86. package/dist/tools/gthGrepTool.js +482 -0
  87. package/dist/tools/gthGrepTool.js.map +1 -0
  88. package/dist/tools/shell/env.js +1 -1
  89. package/dist/tools/shell/env.js.map +1 -1
  90. package/dist/tools/shell/outputBuffer.js.map +1 -1
  91. package/dist/tools/shell/workDir.d.ts +2 -0
  92. package/dist/tools/shell/workDir.js +19 -0
  93. package/dist/tools/shell/workDir.js.map +1 -0
  94. package/dist/utils/mcpAuthError.d.ts +36 -0
  95. package/dist/utils/mcpAuthError.js +89 -0
  96. package/dist/utils/mcpAuthError.js.map +1 -0
  97. package/dist/utils/mcpUtils.js +16 -0
  98. package/dist/utils/mcpUtils.js.map +1 -1
  99. package/package.json +12 -12
  100. package/dist/core/GthDeepAgent.d.ts +0 -151
  101. package/dist/core/GthDeepAgent.js +0 -604
  102. package/dist/core/GthDeepAgent.js.map +0 -1
  103. package/dist/core/deepAgentPermissions.d.ts +0 -73
  104. package/dist/core/deepAgentPermissions.js +0 -161
  105. package/dist/core/deepAgentPermissions.js.map +0 -1
  106. package/dist/core/gthAcpServer.d.ts +0 -27
  107. package/dist/core/gthAcpServer.js +0 -71
  108. package/dist/core/gthAcpServer.js.map +0 -1
  109. package/dist/core/gthDeepAgentFactory.d.ts +0 -8
  110. package/dist/core/gthDeepAgentFactory.js +0 -9
  111. package/dist/core/gthDeepAgentFactory.js.map +0 -1
  112. package/dist/modules/acpModule.d.ts +0 -40
  113. package/dist/modules/acpModule.js +0 -70
  114. package/dist/modules/acpModule.js.map +0 -1
  115. package/dist/tools/shell/allowlist.d.ts +0 -11
  116. package/dist/tools/shell/allowlist.js +0 -12
  117. package/dist/tools/shell/allowlist.js.map +0 -1
  118. package/dist/tools/shell/arity.d.ts +0 -11
  119. package/dist/tools/shell/arity.js +0 -12
  120. package/dist/tools/shell/arity.js.map +0 -1
  121. package/dist/tools/shell/hardline.d.ts +0 -15
  122. package/dist/tools/shell/hardline.js +0 -88
  123. package/dist/tools/shell/hardline.js.map +0 -1
  124. package/dist/tools/shell/normalize.d.ts +0 -10
  125. package/dist/tools/shell/normalize.js +0 -11
  126. package/dist/tools/shell/normalize.js.map +0 -1
@@ -1,88 +0,0 @@
1
- /**
2
- * @module tools/shell/hardline
3
- *
4
- * Unbypassable hardline blocklist for the shell tool. These are catastrophic,
5
- * non-recoverable commands (wipe the root filesystem, format a disk, overwrite a
6
- * raw block device, fork-bomb, take the host down). They are refused inside
7
- * `executeCommand` itself — BEFORE spawn — so the refusal fires regardless of
8
- * yolo (`shellYolo`), any allow-list, or the confirmation path. yolo deliberately
9
- * bypasses the *confirmation*; it does NOT bypass this floor.
10
- *
11
- * Recoverable-but-costly operations (e.g. `git reset --hard`, `rm -rf ./build`,
12
- * `chmod -R 777 ./dir`, `curl | sh`) are intentionally NOT here — those are what
13
- * the confirmation dialog / yolo are for.
14
- *
15
- * Patterns match the NORMALIZED command ({@link ./normalize.js}) so obfuscation
16
- * (ANSI/fullwidth/backslash splits/whitespace padding) cannot bypass them.
17
- *
18
- * Patterned after hermes-agent `tools/approval.py` HARDLINE_PATTERNS.
19
- */
20
- import { normalizeCommand } from '#src/tools/shell/normalize.js';
21
- // Matches a position where the shell would begin parsing a NEW command: start of
22
- // string, after a separator (; & | newline), after `$(` or backtick, optionally
23
- // consuming leading wrappers (sudo/env VAR=VAL/exec/nohup/setsid/time). Used by
24
- // the shutdown-family patterns so they don't false-positive on `echo reboot`.
25
- const CMD_POS = '(?:^|[;&|\\n`]|\\$\\()' +
26
- '\\s*' +
27
- '(?:sudo\\s+(?:-[^\\s]+\\s+)*)?' +
28
- '(?:env\\s+(?:\\w+=\\S*\\s+)*)?' +
29
- '(?:(?:exec|nohup|setsid|time)\\s+)*' +
30
- '\\s*';
31
- /**
32
- * Hardline patterns: [regex, human description]. Matched case-insensitively
33
- * against the normalized command.
34
- */
35
- export const HARDLINE_PATTERNS = [
36
- // rm -rf targeting the root filesystem (`/`, `/*`).
37
- [/\brm\s+(?:-[^\s]*\s+)*\/\s*\*?\s*(?:$|[;&|])/, 'recursive delete of root filesystem'],
38
- // rm -rf targeting protected system directories (with optional /* suffix).
39
- [
40
- /\brm\s+(?:-[^\s]*\s+)*(?:\/(?:home|root|etc|usr|var|bin|sbin|boot|lib|lib64|opt|sys|proc))(?:\/\*)?\s*(?:$|[;&|])/,
41
- 'recursive delete of system directory',
42
- ],
43
- // rm -rf targeting the home directory (~ or $HOME).
44
- // Note: patterns match the LOWERCASED normalized command, so $HOME → $home.
45
- [
46
- /\brm\s+(?:-[^\s]*\s+)*(?:~|\$home)(?:\/\*)?\s*(?:$|[;&|])/,
47
- 'recursive delete of home directory',
48
- ],
49
- // Filesystem format.
50
- [/\bmkfs(?:\.[a-z0-9]+)?\b/, 'format filesystem (mkfs)'],
51
- // dd writing to a raw block device.
52
- [/\bdd\b[^\n]*\bof=\/dev\/(?:sd|nvme|hd|mmcblk|vd|xvd)[a-z0-9]*/, 'dd to raw block device'],
53
- // Shell redirection to a raw block device (`> /dev/sda`).
54
- [/>\s*\/dev\/(?:sd|nvme|hd|mmcblk|vd|xvd)[a-z0-9]*\b/, 'redirect to raw block device'],
55
- // Classic fork bomb `:(){ :|:& };:`.
56
- [/:\s*\(\s*\)\s*\{\s*:\s*\|\s*:\s*&\s*\}\s*;\s*:/, 'fork bomb'],
57
- // chmod -R 777 / (recursive world-writable on root).
58
- [
59
- /\bchmod\s+(?:-[^\s]*\s+)*(?:-r|--recursive)\s+(?:-[^\s]*\s+)*777\s+\//,
60
- 'recursive chmod 777 of root',
61
- ],
62
- // Kill every process on the system (`kill -1`, `kill -9 -1`).
63
- [/\bkill\s+(?:-[^\s]+\s+)*-1\b/, 'kill all processes'],
64
- // System shutdown / reboot — anchored to a command position so `echo reboot`
65
- // and `grep shutdown log` don't trip it.
66
- [new RegExp(CMD_POS + '(?:shutdown|reboot|halt|poweroff)\\b'), 'system shutdown/reboot'],
67
- [new RegExp(CMD_POS + 'init\\s+[06]\\b'), 'init 0/6 (shutdown/reboot)'],
68
- [
69
- new RegExp(CMD_POS + 'systemctl\\s+(?:poweroff|reboot|halt|kexec)\\b'),
70
- 'systemctl poweroff/reboot',
71
- ],
72
- [new RegExp(CMD_POS + 'telinit\\s+[06]\\b'), 'telinit 0/6 (shutdown/reboot)'],
73
- ];
74
- /**
75
- * Check a raw command against the hardline blocklist. Normalizes first so
76
- * obfuscated variants are caught. Returns the match (with a description) when the
77
- * command is catastrophic, or `null` when it is allowed to proceed.
78
- */
79
- export function checkHardline(command) {
80
- const normalized = normalizeCommand(command).toLowerCase();
81
- for (const [pattern, description] of HARDLINE_PATTERNS) {
82
- if (pattern.test(normalized)) {
83
- return { description };
84
- }
85
- }
86
- return null;
87
- }
88
- //# sourceMappingURL=hardline.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hardline.js","sourceRoot":"","sources":["../../../src/tools/shell/hardline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;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AO,EAAE,WAAW,CAAC,IAAI,iBAAiB,EAAE,CAAC;QACvD,IAAI,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;YAC7B,OAAO,EAAE,WAAW,EAAE,CAAC;QACzB,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -1,10 +0,0 @@
1
- /**
2
- * @module tools/shell/normalize
3
- *
4
- * Re-export of the canonical command normalizer, which now lives in
5
- * `@gaunt-sloth/core` (`core/shell/normalize`) so the core runner's EXT-9 Tier-2
6
- * allow-list classifier and the agent's Tier-1 hardline blocklist share ONE
7
- * implementation. Kept as a stable import path for existing agent-side consumers
8
- * (`tools/shell/hardline`, specs).
9
- */
10
- export { normalizeCommand } from '@gaunt-sloth/core/core/shell/normalize.js';
@@ -1,11 +0,0 @@
1
- /**
2
- * @module tools/shell/normalize
3
- *
4
- * Re-export of the canonical command normalizer, which now lives in
5
- * `@gaunt-sloth/core` (`core/shell/normalize`) so the core runner's EXT-9 Tier-2
6
- * allow-list classifier and the agent's Tier-1 hardline blocklist share ONE
7
- * implementation. Kept as a stable import path for existing agent-side consumers
8
- * (`tools/shell/hardline`, specs).
9
- */
10
- export { normalizeCommand } from '@gaunt-sloth/core/core/shell/normalize.js';
11
- //# sourceMappingURL=normalize.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"normalize.js","sourceRoot":"","sources":["../../../src/tools/shell/normalize.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC"}