@superjackfruitlabs/salaam 0.0.4 → 0.0.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.
Files changed (97) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/dist/src/acp-desk.js +140 -0
  3. package/dist/src/acp-outcome.js +23 -19
  4. package/dist/src/acp.js +258 -11
  5. package/dist/src/approval-rules.js +287 -0
  6. package/dist/src/attach.js +3 -1
  7. package/dist/src/autonomy.js +80 -9
  8. package/dist/src/cli-help.js +34 -4
  9. package/dist/src/cli.js +55 -3
  10. package/dist/src/command-danger.js +797 -0
  11. package/dist/src/command-sandbox.js +116 -6
  12. package/dist/src/custom-commands.js +159 -0
  13. package/dist/src/danger-classifier.js +286 -0
  14. package/dist/src/git-helpers.js +160 -0
  15. package/dist/src/hooks.js +351 -0
  16. package/dist/src/host.js +96 -4
  17. package/dist/src/house-extension.js +133 -7
  18. package/dist/src/local-coding.js +553 -58
  19. package/dist/src/local-edits.js +168 -6
  20. package/dist/src/mentions.js +277 -0
  21. package/dist/src/pi-sessions.js +5 -1
  22. package/dist/src/project-instructions.js +195 -0
  23. package/dist/src/protocol.js +4 -1
  24. package/dist/src/service.js +342 -5
  25. package/dist/src/session-pick.js +77 -0
  26. package/dist/src/shell-passthrough.js +39 -0
  27. package/dist/src/store.js +51 -4
  28. package/dist/src/supervisor.js +233 -22
  29. package/dist/src/task-context.js +8 -2
  30. package/dist/src/terminal-status.js +88 -0
  31. package/dist/src/tui-activity.js +99 -0
  32. package/dist/src/tui-classifier.js +25 -0
  33. package/dist/src/tui-client.js +186 -5
  34. package/dist/src/tui-commands.js +23 -5
  35. package/dist/src/tui-composer.js +113 -0
  36. package/dist/src/tui-keymap.js +116 -0
  37. package/dist/src/tui-mentions.js +38 -0
  38. package/dist/src/tui-modals.js +157 -34
  39. package/dist/src/tui-notify.js +62 -0
  40. package/dist/src/tui-review.js +55 -0
  41. package/dist/src/tui-turn-keys.js +52 -0
  42. package/dist/src/tui-view.js +243 -69
  43. package/dist/src/tui.js +875 -118
  44. package/dist/src/turn-checkpoints.js +221 -0
  45. package/dist/src/turn-rewind.js +168 -0
  46. package/dist/src/web-fetch.js +114 -0
  47. package/dist/src/web-guard.js +163 -0
  48. package/dist/src/web-search.js +302 -0
  49. package/npm-shrinkwrap.json +2 -2
  50. package/package.json +1 -1
  51. package/src/acp-desk.ts +155 -0
  52. package/src/acp-outcome.ts +25 -21
  53. package/src/acp.ts +338 -28
  54. package/src/approval-rules.ts +360 -0
  55. package/src/attach.ts +4 -1
  56. package/src/autonomy.ts +111 -10
  57. package/src/cli-help.ts +33 -4
  58. package/src/cli.ts +66 -2
  59. package/src/command-danger.ts +886 -0
  60. package/src/command-sandbox.ts +128 -8
  61. package/src/custom-commands.ts +175 -0
  62. package/src/danger-classifier.ts +321 -0
  63. package/src/git-helpers.ts +177 -0
  64. package/src/hooks.ts +425 -0
  65. package/src/host.ts +122 -1
  66. package/src/house-extension.ts +142 -7
  67. package/src/local-coding.ts +674 -75
  68. package/src/local-edits.ts +191 -8
  69. package/src/mentions.ts +304 -0
  70. package/src/pi-sessions.ts +9 -1
  71. package/src/project-instructions.ts +229 -0
  72. package/src/protocol.ts +19 -2
  73. package/src/service.ts +488 -5
  74. package/src/session-pick.ts +102 -0
  75. package/src/shell-passthrough.ts +38 -0
  76. package/src/store.ts +52 -3
  77. package/src/supervisor.ts +262 -24
  78. package/src/task-context.ts +9 -2
  79. package/src/terminal-status.ts +103 -0
  80. package/src/tui-activity.ts +133 -0
  81. package/src/tui-classifier.ts +38 -0
  82. package/src/tui-client.ts +239 -8
  83. package/src/tui-commands.ts +49 -10
  84. package/src/tui-composer.ts +124 -0
  85. package/src/tui-keymap.ts +152 -0
  86. package/src/tui-mentions.ts +43 -0
  87. package/src/tui-modals.ts +173 -43
  88. package/src/tui-notify.ts +77 -0
  89. package/src/tui-review.ts +76 -0
  90. package/src/tui-turn-keys.ts +77 -0
  91. package/src/tui-view.ts +341 -88
  92. package/src/tui.ts +1047 -137
  93. package/src/turn-checkpoints.ts +253 -0
  94. package/src/turn-rewind.ts +258 -0
  95. package/src/web-fetch.ts +140 -0
  96. package/src/web-guard.ts +195 -0
  97. package/src/web-search.ts +402 -0
package/src/cli.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env node
2
+ import { loadDangerClassifierOptions } from './danger-classifier.js';
3
+ import { loadWebSearchConfig } from './web-search.js';
2
4
  import { SANDBOX_LEVELS, type SandboxLevel } from './command-sandbox.js';
3
5
  import { acp } from './acp.js';
4
6
  import { homedir } from 'node:os';
@@ -67,6 +69,10 @@ async function main(): Promise<void> {
67
69
  console.log('salaam ' + VERSION);
68
70
  return;
69
71
  }
72
+ if (args[0] === '-c' || args[0] === '--continue') {
73
+ const { continueArgs } = await import('./session-pick.js');
74
+ args.splice(0, args.length, ...continueArgs(args)!);
75
+ }
70
76
  if (args[0] === 'mcp') {
71
77
  // Parsed before global help: a declared command's own flags follow "--".
72
78
  const rest = args.slice(1);
@@ -517,7 +523,11 @@ async function main(): Promise<void> {
517
523
  hostToolsUser,
518
524
  hostApprovalTtlMs,
519
525
  hostAllowsUnsandboxed,
526
+ hostAllowsFullAccessSessions,
527
+ hostAllowsYoloSessions,
528
+ hostDangerClassifier,
520
529
  hostCommandNetwork,
530
+ hostReadPaths,
521
531
  } = await import('./host.js');
522
532
  if (verb?.startsWith('config-')) {
523
533
  const file = option('--manifest');
@@ -661,7 +671,18 @@ async function main(): Promise<void> {
661
671
  providerRoute: m.provider,
662
672
  approvalTtlMs: hostApprovalTtlMs(m),
663
673
  ...(hostAllowsUnsandboxed(m) ? { unsandboxedCommands: 'allow' as const } : {}),
674
+ // A host session may choose full access only when the reviewed manifest says so.
675
+ allowFullAccessSessions: hostAllowsFullAccessSessions(m),
676
+ allowYoloSessions: hostAllowsYoloSessions(m),
677
+ // The command reviewer only as the reviewed manifest names it (forbidden when absent).
678
+ ...(hostDangerClassifier(m).config
679
+ ? { dangerClassifierConfig: hostDangerClassifier(m).config }
680
+ : {}),
681
+ ...(hostDangerClassifier(m).pin
682
+ ? { dangerClassifierPin: hostDangerClassifier(m).pin }
683
+ : {}),
664
684
  ...(hostCommandNetwork(m) ? { commandNetwork: hostCommandNetwork(m)! } : {}),
685
+ ...(hostReadPaths(m).length ? { localSandboxReadPaths: hostReadPaths(m) } : {}),
665
686
  });
666
687
  if (process.connected) process.once('disconnect', () => void service.close());
667
688
  for (const signal of ['SIGTERM', 'SIGINT'] as const)
@@ -688,6 +709,20 @@ async function main(): Promise<void> {
688
709
  });
689
710
  return;
690
711
  }
712
+ if (group === 'code' || group === 'here') {
713
+ const { parseCodeStart } = await import('./session-pick.js');
714
+ const start = parseCodeStart(args.slice(1));
715
+ const { tui } = await import('./tui.js');
716
+ await tui({
717
+ state,
718
+ start,
719
+ cwd: option('--cwd'),
720
+ takeover: args.includes('--takeover'),
721
+ codingRoot: option('--coding-root'),
722
+ codingSocket: option('--coding-socket'),
723
+ });
724
+ return;
725
+ }
691
726
  if (
692
727
  !group ||
693
728
  group === 'tui' ||
@@ -841,7 +876,7 @@ async function main(): Promise<void> {
841
876
  return;
842
877
  }
843
878
  if (group === 'acp') {
844
- await acp(state, { coding: args.includes('--coding') });
879
+ await acp(state, { coding: args.includes('--coding'), local: args.includes('--local') });
845
880
  return;
846
881
  }
847
882
  if (group === 'providers' && verb === 'list') {
@@ -1634,7 +1669,26 @@ async function main(): Promise<void> {
1634
1669
  toolsUser = option('--tools-user') ?? (process.env.SALAAM_TOOLS_USER || undefined),
1635
1670
  localSandbox = option('--local-sandbox') ?? (process.env.SALAAM_LOCAL_SANDBOX || undefined),
1636
1671
  unsandboxedCommands =
1637
- option('--unsandboxed-commands') ?? (process.env.SALAAM_UNSANDBOXED_COMMANDS || undefined);
1672
+ option('--unsandboxed-commands') ?? (process.env.SALAAM_UNSANDBOXED_COMMANDS || undefined),
1673
+ localSandboxRead = (
1674
+ option('--local-sandbox-read') ??
1675
+ (process.env.SALAAM_LOCAL_SANDBOX_READ || '')
1676
+ )
1677
+ .split(',')
1678
+ .map((p) => p.trim())
1679
+ .filter(Boolean),
1680
+ webSearchConfig =
1681
+ option('--web-search-config') ?? (process.env.SALAAM_WEB_SEARCH_CONFIG || undefined),
1682
+ dangerClassifierConfig =
1683
+ option('--danger-classifier-config') ??
1684
+ (process.env.SALAAM_DANGER_CLASSIFIER_CONFIG || undefined);
1685
+ // Fail early on a bad command-reviewer config; its key is read from the named variable, never printed.
1686
+ if (dangerClassifierConfig)
1687
+ loadDangerClassifierOptions(
1688
+ JSON.parse(readFileSync(resolve(dangerClassifierConfig), 'utf8')),
1689
+ );
1690
+ // Fail early on a bad web search config; its keys are read, never printed.
1691
+ if (webSearchConfig) loadWebSearchConfig(resolve(webSearchConfig));
1638
1692
  if (localSandbox !== undefined && !(SANDBOX_LEVELS as readonly string[]).includes(localSandbox))
1639
1693
  throw Error('--local-sandbox is read-only, workspace-write or full-access');
1640
1694
  if (unsandboxedCommands !== undefined && unsandboxedCommands !== 'allow')
@@ -1653,6 +1707,11 @@ async function main(): Promise<void> {
1653
1707
  toolsUser,
1654
1708
  ...(localSandbox ? { localSandbox: localSandbox as SandboxLevel } : {}),
1655
1709
  ...(unsandboxedCommands ? { unsandboxedCommands: 'allow' as const } : {}),
1710
+ ...(localSandboxRead.length ? { localSandboxReadPaths: localSandboxRead } : {}),
1711
+ ...(webSearchConfig ? { webSearchConfig: resolve(webSearchConfig) } : {}),
1712
+ ...(dangerClassifierConfig
1713
+ ? { dangerClassifierConfig: resolve(dangerClassifierConfig) }
1714
+ : {}),
1656
1715
  effectConnector: effectSocket
1657
1716
  ? new SocketEffectConnector(resolve(effectSocket), { opaque })
1658
1717
  : undefined,
@@ -1746,6 +1805,11 @@ async function main(): Promise<void> {
1746
1805
  ...(toolsUser ? ['--tools-user', toolsUser] : []),
1747
1806
  ...(localSandbox ? ['--local-sandbox', localSandbox] : []),
1748
1807
  ...(unsandboxedCommands ? ['--unsandboxed-commands', 'allow'] : []),
1808
+ ...(localSandboxRead.length ? ['--local-sandbox-read', localSandboxRead.join(',')] : []),
1809
+ ...(webSearchConfig ? ['--web-search-config', resolve(webSearchConfig)] : []),
1810
+ ...(dangerClassifierConfig
1811
+ ? ['--danger-classifier-config', resolve(dangerClassifierConfig)]
1812
+ : []),
1749
1813
  ],
1750
1814
  { detached: true, stdio: ['ignore', fd, fd] },
1751
1815
  );