newmark-agent 0.4.5 → 0.4.7

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 (40) hide show
  1. package/assets/app-icon-dark.svg +6 -0
  2. package/dist/assets/app-icon-dark.svg +6 -0
  3. package/dist/cli-commands.d.ts +1 -1
  4. package/dist/cli-commands.js +90 -7
  5. package/dist/cli-discovery.js +10 -0
  6. package/dist/conversation-utility-host.bundle.cjs +293 -148
  7. package/dist/core/agent.d.ts +38 -4
  8. package/dist/core/agent.js +231 -49
  9. package/dist/core/agentKernelRunner.d.ts +3 -0
  10. package/dist/core/agentKernelRunner.js +49 -83
  11. package/dist/core/config.js +3 -0
  12. package/dist/core/dshCompatibility.d.ts +23 -6
  13. package/dist/core/dshCompatibility.js +99 -1
  14. package/dist/core/installUpdate.d.ts +67 -0
  15. package/dist/core/installUpdate.js +268 -0
  16. package/dist/core/mobilePairing.d.ts +47 -0
  17. package/dist/core/mobilePairing.js +221 -0
  18. package/dist/core/subagent.d.ts +10 -3
  19. package/dist/core/subagent.js +23 -8
  20. package/dist/core/toolPolicy.js +11 -3
  21. package/dist/launcher.js +14 -11
  22. package/dist/main.js +64 -3
  23. package/dist/preload.js +5 -0
  24. package/dist/providers/chat-completions.adapter.js +6 -2
  25. package/dist/providers/responses.adapter.js +1 -0
  26. package/dist/server.d.ts +1 -0
  27. package/dist/server.js +721 -3
  28. package/dist/toolchain/registry-seeder.js +3 -1
  29. package/dist/tools/index.js +11 -5
  30. package/dist/tools/nativeTools.js +1 -1
  31. package/dist/tui/src/adapters/core-runtime-adapter.js +17 -1
  32. package/dist/tui/src/app.js +41 -0
  33. package/dist/tui/src/data.js +1 -0
  34. package/dist/tui/src/render.js +11 -0
  35. package/dist/tui/src/settings-schema.js +3 -1
  36. package/dist/tui/src/state.js +21 -1
  37. package/dist/ui/index.html +530 -101
  38. package/dist/ui/lucide-sprite.svg +10 -0
  39. package/dist/wsl-agent-host.bundle.cjs +293 -148
  40. package/package.json +14 -8
@@ -0,0 +1,6 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024">
2
+ <rect x="125" y="111" width="774" height="797" rx="160" fill="#000000"/>
3
+ <path fill="#ffffff" d="M 506.5 255 L 522.5 256 L 536.5 260 L 602.5 299 L 618.5 307 L 625 312.5 L 629 321.5 L 629 327.5 Q 626.5 336.5 619.5 341 L 607.5 344 L 596.5 340 L 524.5 297 Q 516.6 293.4 503.5 295 Q 492.8 296.8 485.5 302 Q 417.5 345 346.5 385 L 335 394.5 L 330 403.5 L 328 413.5 L 328 498.5 L 329 501.5 L 329 503.5 L 328 511.5 L 329 512.5 L 329 609.5 L 333 622.5 L 343.5 634 L 486.5 716 Q 496.9 723.1 514.5 723 L 524.5 721 L 539.5 714 L 668.5 642 L 682 633 L 687 626.5 L 692 613.5 L 692 467.5 Q 693.6 460.5 698.5 457 Q 704 452 716.5 454 Q 723.9 456.6 728 462.5 L 731 472.5 L 731 616.5 L 729 627.5 L 721 646.5 L 707.5 662 L 691.5 673 L 538.5 758 L 519.5 763 L 503.5 763 L 493.5 761 L 476.5 754 L 329.5 670 Q 315.8 662.2 306 650.5 Q 295.7 638.3 292 619.5 L 292 576.5 L 291 575.5 L 291 405.5 L 295 388.5 L 301 376.5 L 314.5 361 L 333.5 348 L 474.5 265 L 490.5 258 L 506.5 255 Z "/>
4
+ <path fill="#ffffff" d="M 710.5 271 L 719 309.5 Q 724.1 324.9 734.5 335 L 747.5 343 L 759.5 347 L 781.5 352 L 788 352 Q 789.4 356 782.5 354 L 760.5 359 L 749.5 363 Q 735.3 368.3 727 379.5 L 717 400.5 L 710.5 430 Q 707.2 408.3 700 390.5 Q 694.6 377.9 684.5 370 L 668.5 362 L 643.5 355 L 633.5 354 L 632 352.5 L 648.5 350 L 670.5 344 Q 684 339.5 692 329.5 Q 699.7 317.7 704 302.5 L 710.5 271 Z "/>
5
+ <path fill="#ffffff" d="M 603.5 427 Q 619.7 425.8 625 435.5 L 628 444.5 L 628 575.5 Q 630.8 577.3 629 583.5 L 627 593.5 Q 624.4 600.9 618.5 605 Q 610.4 611.9 593.5 610 Q 575.3 606.2 564.5 595 L 432.5 480 L 432 509.5 L 433 510.5 L 433 593.5 Q 431.5 602 425.5 606 Q 420.7 610.2 410.5 609 Q 402.2 606.9 398 600.5 L 395 592.5 L 395 471.5 L 394 470.5 L 395 467.5 L 394 466.5 L 394 454.5 L 397 440.5 L 402.5 434 Q 409.7 426.7 426.5 429 L 440.5 436 L 590.5 567 L 591 472.5 L 590 471.5 L 590 441.5 Q 591.2 433.7 596.5 430 L 603.5 427 Z "/>
6
+ </svg>
@@ -0,0 +1,6 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024">
2
+ <rect x="125" y="111" width="774" height="797" rx="160" fill="#000000"/>
3
+ <path fill="#ffffff" d="M 506.5 255 L 522.5 256 L 536.5 260 L 602.5 299 L 618.5 307 L 625 312.5 L 629 321.5 L 629 327.5 Q 626.5 336.5 619.5 341 L 607.5 344 L 596.5 340 L 524.5 297 Q 516.6 293.4 503.5 295 Q 492.8 296.8 485.5 302 Q 417.5 345 346.5 385 L 335 394.5 L 330 403.5 L 328 413.5 L 328 498.5 L 329 501.5 L 329 503.5 L 328 511.5 L 329 512.5 L 329 609.5 L 333 622.5 L 343.5 634 L 486.5 716 Q 496.9 723.1 514.5 723 L 524.5 721 L 539.5 714 L 668.5 642 L 682 633 L 687 626.5 L 692 613.5 L 692 467.5 Q 693.6 460.5 698.5 457 Q 704 452 716.5 454 Q 723.9 456.6 728 462.5 L 731 472.5 L 731 616.5 L 729 627.5 L 721 646.5 L 707.5 662 L 691.5 673 L 538.5 758 L 519.5 763 L 503.5 763 L 493.5 761 L 476.5 754 L 329.5 670 Q 315.8 662.2 306 650.5 Q 295.7 638.3 292 619.5 L 292 576.5 L 291 575.5 L 291 405.5 L 295 388.5 L 301 376.5 L 314.5 361 L 333.5 348 L 474.5 265 L 490.5 258 L 506.5 255 Z "/>
4
+ <path fill="#ffffff" d="M 710.5 271 L 719 309.5 Q 724.1 324.9 734.5 335 L 747.5 343 L 759.5 347 L 781.5 352 L 788 352 Q 789.4 356 782.5 354 L 760.5 359 L 749.5 363 Q 735.3 368.3 727 379.5 L 717 400.5 L 710.5 430 Q 707.2 408.3 700 390.5 Q 694.6 377.9 684.5 370 L 668.5 362 L 643.5 355 L 633.5 354 L 632 352.5 L 648.5 350 L 670.5 344 Q 684 339.5 692 329.5 Q 699.7 317.7 704 302.5 L 710.5 271 Z "/>
5
+ <path fill="#ffffff" d="M 603.5 427 Q 619.7 425.8 625 435.5 L 628 444.5 L 628 575.5 Q 630.8 577.3 629 583.5 L 627 593.5 Q 624.4 600.9 618.5 605 Q 610.4 611.9 593.5 610 Q 575.3 606.2 564.5 595 L 432.5 480 L 432 509.5 L 433 510.5 L 433 593.5 Q 431.5 602 425.5 606 Q 420.7 610.2 410.5 609 Q 402.2 606.9 398 600.5 L 395 592.5 L 395 471.5 L 394 470.5 L 395 467.5 L 394 466.5 L 394 454.5 L 397 440.5 L 402.5 434 Q 409.7 426.7 426.5 429 L 440.5 436 L 590.5 567 L 591 472.5 L 590 471.5 L 590 441.5 Q 591.2 433.7 596.5 430 L 603.5 427 Z "/>
6
+ </svg>
@@ -1,4 +1,4 @@
1
- export declare const CLI_COMMANDS: readonly ["state", "tool", "send", "validate-models", "fuzzy-inject", "skills-market", "memory-lab", "install-update", "compat", "compat-tool"];
1
+ export declare const CLI_COMMANDS: readonly ["state", "tool", "send", "validate-models", "fuzzy-inject", "skills-market", "memory-lab", "install-update", "compat", "compat-tool", "pair", "remote"];
2
2
  export declare function cliHelpRequested(args: string[]): boolean;
3
3
  /**
4
4
  * Compatibility discovery reads third-party metadata outside the selected
@@ -49,7 +49,8 @@ const compat_1 = require("./core/compat");
49
49
  const dshCompatibility_1 = require("./core/dshCompatibility");
50
50
  const memoryLab_1 = require("./core/memoryLab");
51
51
  const installUpdate_1 = require("./core/installUpdate");
52
- exports.CLI_COMMANDS = ['state', 'tool', 'send', 'validate-models', 'fuzzy-inject', 'skills-market', 'memory-lab', 'install-update', 'compat', 'compat-tool'];
52
+ const mobilePairing_1 = require("./core/mobilePairing");
53
+ exports.CLI_COMMANDS = ['state', 'tool', 'send', 'validate-models', 'fuzzy-inject', 'skills-market', 'memory-lab', 'install-update', 'compat', 'compat-tool', 'pair', 'remote'];
53
54
  const CLI_COMMAND_HELP = {
54
55
  state: [
55
56
  'Usage: Newmark.exe state [--root <dir>]',
@@ -80,9 +81,17 @@ const CLI_COMMAND_HELP = {
80
81
  'Usage: Newmark.exe memory-lab [--read|--component <name>|--update ...|--reindex] [--root <dir>]',
81
82
  'Read or update the local Memory Lab index and components.',
82
83
  ],
84
+ pair: [
85
+ 'Usage: Newmark.exe pair [--root <dir>]',
86
+ 'Print a Tailscale pairing QR code and URL for the Newmark mobile app.',
87
+ ],
88
+ remote: [
89
+ 'Usage: Newmark.exe remote --on|--off [--root <dir>]',
90
+ 'Enable or disable mobile remote-touch on the same LAN / Tailscale network.',
91
+ ],
83
92
  'install-update': [
84
- 'Usage: Newmark.exe install-update (--source <path>|--check-github|--from-github) [options] [--root <dir>]',
85
- 'Inspect or apply a local/GitHub update using the selected install target.',
93
+ 'Usage: Newmark.exe install-update (--source <path>|--check-github|--from-github|--msi <path>) [options] [--root <dir>]',
94
+ 'Inspect or apply a local/GitHub update, or run a managed MSI install with process confirmation, previous-version uninstall, and legacy cleanup.',
86
95
  ],
87
96
  compat: [
88
97
  'Usage: Newmark.exe compat [--target all|tools|plugins|dsh|marketplaces|skills|agents|subagents] [--root <dir>]',
@@ -104,12 +113,13 @@ const CLI_VALUE_FLAGS = new Set([
104
113
  '--candidate-models', '--protocol', '--query', '--type', '--path', '--component', '--source-id',
105
114
  '--remove-source', '--enable-source', '--disable-source', '--source', '--target', '--target-file',
106
115
  '--expected-version', '--preserve', '--repo', '--tag', '--asset', '--version', '--content-file',
107
- '--content', '--description', '--tags',
116
+ '--content', '--description', '--tags', '--msi', '--log-dir',
108
117
  ]);
109
118
  const CLI_BOOLEAN_FLAGS = new Set([
110
119
  '--persist', '--agent-only', '--list', '--preview-only', '--sources', '--add-source', '--check-github',
111
120
  '--from-github', '--dry-run', '--read', '--index', '--reindex', '--update', '--version', '--folder', '--help', '-h',
112
- '--branch-communication',
121
+ '--branch-communication', '--yes', '--confirm-stop', '--confirm-remove-legacy', '--no-uninstall-previous', '--no-elevate',
122
+ '--on', '--off',
113
123
  ]);
114
124
  function invalidCliCommandArgument(args) {
115
125
  let skipNext = false;
@@ -712,6 +722,41 @@ async function runCliCommand(root, args) {
712
722
  }
713
723
  agent.setMode(requestedMode);
714
724
  }
725
+ if (command === 'pair') {
726
+ const qr = await (0, mobilePairing_1.pairingQrAscii)(root);
727
+ safeStdout(qr.ascii + '\n');
728
+ safeStdout(`\nPairing URL: ${qr.session.url}\n`);
729
+ safeStdout(`Token file: ${(0, mobilePairing_1.pairingTokenPath)(root)}\n`);
730
+ const expiresIn = Math.max(0, Math.round((qr.session.expiresAt - Date.now()) / 1000));
731
+ safeStdout(`Window: ${expiresIn}s — scan with the Newmark mobile app. Waiting for confirmation...\n`);
732
+ const deadline = qr.session.expiresAt + 1000;
733
+ while (Date.now() < deadline) {
734
+ await new Promise(resolve => setTimeout(resolve, 1000));
735
+ const status = (0, mobilePairing_1.pairingStatus)(root);
736
+ if (status.confirmed) {
737
+ safeStdout('\n✓ Paired successfully. QR window closed.\n');
738
+ return true;
739
+ }
740
+ if (status.expired || !status.active) {
741
+ safeStdout("\n✗ Pairing window expired. Run 'pair' again for a new QR.\n");
742
+ return false;
743
+ }
744
+ }
745
+ return false;
746
+ }
747
+ if (command === 'remote') {
748
+ const on = args.includes('--on');
749
+ const off = args.includes('--off');
750
+ if (on === off) {
751
+ safeStderr('Usage: Newmark.exe remote --on|--off\n');
752
+ process.exitCode = 2;
753
+ return true;
754
+ }
755
+ agent.config.set('remote', 'touch_enabled', on);
756
+ agent.config.save();
757
+ safeStdout(`Remote touch ${on ? 'enabled' : 'disabled'}\n`);
758
+ return true;
759
+ }
715
760
  if (command === 'state') {
716
761
  printJson(safeState(agent, root));
717
762
  return true;
@@ -963,10 +1008,47 @@ async function runCliCommand(root, args) {
963
1008
  process.exitCode = 1;
964
1009
  return true;
965
1010
  }
1011
+ if (args.includes('--msi')) {
1012
+ const msiPath = argValue(args, '--msi') || positionalAfter(args, 'install-update')[0] || '';
1013
+ const confirmAll = args.includes('--yes');
1014
+ const stopConfirmed = confirmAll || args.includes('--confirm-stop');
1015
+ const removeLegacyConfirmed = confirmAll || args.includes('--confirm-remove-legacy');
1016
+ const options = {
1017
+ stopConfirmed,
1018
+ removeLegacyConfirmed,
1019
+ uninstallPrevious: !args.includes('--no-uninstall-previous'),
1020
+ allowElevate: !args.includes('--no-elevate'),
1021
+ logDir: argValue(args, '--log-dir') || root,
1022
+ };
1023
+ const plan = (0, installUpdate_1.planManagedMsiInstall)(msiPath, options);
1024
+ if (!plan.ok) {
1025
+ printJson(plan);
1026
+ safeStderr(`Managed MSI install cannot start: ${plan.error || 'unknown error'}\n`);
1027
+ process.exitCode = 1;
1028
+ return true;
1029
+ }
1030
+ if (plan.needsStopConfirmation) {
1031
+ printJson(plan);
1032
+ safeStderr('Running Newmark processes were found. Re-run with --confirm-stop (or --yes) to stop them before installing.\n');
1033
+ process.exitCode = 2;
1034
+ return true;
1035
+ }
1036
+ if (plan.needsLegacyRemovalConfirmation) {
1037
+ printJson(plan);
1038
+ safeStderr('Legacy Newmark executables were found outside the install target. Re-run with --confirm-remove-legacy (or --yes) to remove them.\n');
1039
+ process.exitCode = 2;
1040
+ return true;
1041
+ }
1042
+ const result = (0, installUpdate_1.executeManagedMsiInstall)(msiPath, options);
1043
+ printJson(result);
1044
+ if (!result.ok)
1045
+ process.exitCode = 1;
1046
+ return true;
1047
+ }
966
1048
  const source = pathArgValue(args, '--source') || positionalAfter(args, 'install-update')[0] || '';
967
1049
  const target = pathArgValue(args, '--target') || root;
968
1050
  if (!source) {
969
- safeStderr('Usage: Newmark.exe install-update (--source <portable-exe-or-unpacked-dir>|--check-github|--from-github) [--repo owner/name] [--tag vX.Y.Z] [--asset name] [--target <dir>] [--target-file <path>] [--expected-version <version>] [--preserve csv] [--dry-run] [--root <dir>]\n');
1051
+ safeStderr('Usage: Newmark.exe install-update (--source <portable-exe-or-unpacked-dir>|--check-github|--from-github|--msi <path>) [--repo owner/name] [--tag vX.Y.Z] [--asset name] [--target <dir>] [--target-file <path>] [--expected-version <version>] [--preserve csv] [--dry-run] [--root <dir>]\n');
970
1052
  process.exitCode = 1;
971
1053
  return true;
972
1054
  }
@@ -1082,7 +1164,8 @@ function cliCommandUsage() {
1082
1164
  ' Newmark.exe fuzzy-inject [--name <provider>] [--env-file <PowerShell-or-dotenv-file>|--env-file-env <ENV_WITH_FILE_PATH>] [--endpoint-env <ENV_WITH_BASE_URL>] [--key-env <ENV_WITH_API_KEY>] [--protocol openai|anthropic] [--preview-only] [--root <dir>]',
1083
1165
  ' Newmark.exe skills-market [--query <text>|--sources|--add-source --name <name> (--url <url>|--path <path>) [--type json|skill-url|local-dir]|--remove-source <id>|--enable-source <id>|--disable-source <id>] [--root <dir>]',
1084
1166
  ' Newmark.exe memory-lab [--read|--component <name>|--update --name <name> --description <text> --tags <csv> --content-file <path> [--folder]|--reindex] [--root <dir>]',
1085
- ' Newmark.exe install-update (--source <portable-exe-or-unpacked-dir>|--check-github|--from-github) [--repo owner/name] [--tag vX.Y.Z] [--asset name] [--target <dir>] [--target-file <path>] [--expected-version <version>] [--preserve csv] [--dry-run] [--root <dir>]',
1167
+ ' Newmark.exe pair [--root <dir>]',
1168
+ ' Newmark.exe install-update (--source <portable-exe-or-unpacked-dir>|--check-github|--from-github|--msi <path>) [--repo owner/name] [--tag vX.Y.Z] [--asset name] [--target <dir>] [--target-file <path>] [--expected-version <version>] [--preserve csv] [--dry-run] [--confirm-stop|--confirm-remove-legacy|--yes] [--no-uninstall-previous] [--no-elevate] [--log-dir <dir>] [--root <dir>]',
1086
1169
  ' Newmark.exe compat [--target all|tools|plugins|marketplaces|skills|agents|subagents] [--root <dir>]',
1087
1170
  ' Newmark.exe compat-tool --list | --name <opencode-tool> [json-args | --args-file path] [--root <dir>]',
1088
1171
  `Working directory fallback: ${path.resolve('.')}`,
@@ -64,6 +64,8 @@ const VALUE_FLAGS = new Set([
64
64
  '--inspect-port',
65
65
  '--js-flags',
66
66
  '--viewer-request',
67
+ '--msi',
68
+ '--log-dir',
67
69
  ]);
68
70
  const BOOLEAN_FLAGS = new Set([
69
71
  '--tui',
@@ -76,6 +78,7 @@ const BOOLEAN_FLAGS = new Set([
76
78
  '-v',
77
79
  '-version',
78
80
  '--automation-wake',
81
+ '--no-browser',
79
82
  '--newmark-viewer',
80
83
  '--allow-multiple-instances',
81
84
  '--disable-gpu',
@@ -101,6 +104,13 @@ const BOOLEAN_FLAGS = new Set([
101
104
  '--limit',
102
105
  '--scopes',
103
106
  '--web',
107
+ '--yes',
108
+ '--confirm-stop',
109
+ '--confirm-remove-legacy',
110
+ '--no-uninstall-previous',
111
+ '--no-elevate',
112
+ '--on',
113
+ '--off',
104
114
  ]);
105
115
  /** Public version spellings accepted by every Newmark entrypoint. */
106
116
  function isVersionArgument(args) {