tauri-agent-tools 0.6.0 → 0.7.1

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 (89) hide show
  1. package/.agents/skills/tauri-agent-tools/SKILL.md +94 -5
  2. package/.agents/skills/tauri-bridge-setup/SKILL.md +45 -13
  3. package/.agents/skills/tauri-debug-quickstart/SKILL.md +80 -0
  4. package/README.md +72 -4
  5. package/dist/bridge/client.d.ts +17 -1
  6. package/dist/bridge/client.js +82 -1
  7. package/dist/bridge/client.js.map +1 -1
  8. package/dist/bridge/tokenDiscovery.js +29 -29
  9. package/dist/bridge/tokenDiscovery.js.map +1 -1
  10. package/dist/cli.js +25 -0
  11. package/dist/cli.js.map +1 -1
  12. package/dist/commands/appPaths.d.ts +2 -0
  13. package/dist/commands/appPaths.js +97 -0
  14. package/dist/commands/appPaths.js.map +1 -0
  15. package/dist/commands/capabilitiesAudit.d.ts +2 -0
  16. package/dist/commands/capabilitiesAudit.js +105 -0
  17. package/dist/commands/capabilitiesAudit.js.map +1 -0
  18. package/dist/commands/capture.js +1 -1
  19. package/dist/commands/configInspect.d.ts +2 -0
  20. package/dist/commands/configInspect.js +223 -0
  21. package/dist/commands/configInspect.js.map +1 -0
  22. package/dist/commands/diagnose.d.ts +2 -0
  23. package/dist/commands/diagnose.js +311 -0
  24. package/dist/commands/diagnose.js.map +1 -0
  25. package/dist/commands/forensics.d.ts +2 -0
  26. package/dist/commands/forensics.js +331 -0
  27. package/dist/commands/forensics.js.map +1 -0
  28. package/dist/commands/health.d.ts +2 -0
  29. package/dist/commands/health.js +39 -0
  30. package/dist/commands/health.js.map +1 -0
  31. package/dist/commands/invoke.js +14 -4
  32. package/dist/commands/invoke.js.map +1 -1
  33. package/dist/commands/ipcMonitor.d.ts +3 -0
  34. package/dist/commands/ipcMonitor.js +22 -10
  35. package/dist/commands/ipcMonitor.js.map +1 -1
  36. package/dist/commands/osLogs.d.ts +2 -0
  37. package/dist/commands/osLogs.js +130 -0
  38. package/dist/commands/osLogs.js.map +1 -0
  39. package/dist/commands/pageState.d.ts +1 -0
  40. package/dist/commands/pageState.js +2 -2
  41. package/dist/commands/pageState.js.map +1 -1
  42. package/dist/commands/processTree.d.ts +2 -0
  43. package/dist/commands/processTree.js +45 -0
  44. package/dist/commands/processTree.js.map +1 -0
  45. package/dist/commands/sidecarReplay.d.ts +7 -0
  46. package/dist/commands/sidecarReplay.js +93 -0
  47. package/dist/commands/sidecarReplay.js.map +1 -0
  48. package/dist/commands/sidecarTap.d.ts +2 -0
  49. package/dist/commands/sidecarTap.js +118 -0
  50. package/dist/commands/sidecarTap.js.map +1 -0
  51. package/dist/commands/snapshot.js +1 -1
  52. package/dist/commands/webviewAttach.d.ts +2 -0
  53. package/dist/commands/webviewAttach.js +64 -0
  54. package/dist/commands/webviewAttach.js.map +1 -0
  55. package/dist/platform/oslog/darwin.d.ts +21 -0
  56. package/dist/platform/oslog/darwin.js +72 -0
  57. package/dist/platform/oslog/darwin.js.map +1 -0
  58. package/dist/platform/oslog/linux.d.ts +16 -0
  59. package/dist/platform/oslog/linux.js +47 -0
  60. package/dist/platform/oslog/linux.js.map +1 -0
  61. package/dist/platform/oslog/windows.d.ts +15 -0
  62. package/dist/platform/oslog/windows.js +16 -0
  63. package/dist/platform/oslog/windows.js.map +1 -0
  64. package/dist/schemas/bridge.d.ts +222 -0
  65. package/dist/schemas/bridge.js +44 -0
  66. package/dist/schemas/bridge.js.map +1 -1
  67. package/dist/schemas/osLog.d.ts +34 -0
  68. package/dist/schemas/osLog.js +18 -0
  69. package/dist/schemas/osLog.js.map +1 -0
  70. package/dist/schemas/sidecar.d.ts +33 -0
  71. package/dist/schemas/sidecar.js +17 -0
  72. package/dist/schemas/sidecar.js.map +1 -0
  73. package/dist/schemas/tauriConfig.d.ts +825 -0
  74. package/dist/schemas/tauriConfig.js +102 -0
  75. package/dist/schemas/tauriConfig.js.map +1 -0
  76. package/dist/util/ndjson.d.ts +37 -0
  77. package/dist/util/ndjson.js +82 -0
  78. package/dist/util/ndjson.js.map +1 -0
  79. package/dist/util/tauriConfig.d.ts +63 -0
  80. package/dist/util/tauriConfig.js +235 -0
  81. package/dist/util/tauriConfig.js.map +1 -0
  82. package/examples/frontend-stub/index.html +1 -0
  83. package/examples/tauri-bridge/Cargo.toml +6 -0
  84. package/examples/tauri-bridge/build.rs +3 -0
  85. package/examples/tauri-bridge/icons/icon.png +0 -0
  86. package/examples/tauri-bridge/src/dev_bridge.rs +536 -43
  87. package/examples/tauri-bridge/tauri.conf.json +25 -0
  88. package/package.json +3 -1
  89. package/rust-bridge/README.md +10 -1
@@ -0,0 +1,130 @@
1
+ import { Command } from 'commander';
2
+ import { spawn } from 'node:child_process';
3
+ import * as darwin from '../platform/oslog/darwin.js';
4
+ import * as linux from '../platform/oslog/linux.js';
5
+ import * as windows from '../platform/oslog/windows.js';
6
+ import { resolveTauriProject } from '../util/tauriConfig.js';
7
+ import { LineFramer } from '../util/ndjson.js';
8
+ const LEVEL_RANK = { debug: 0, info: 1, warn: 2, error: 3 };
9
+ export function registerOsLogs(program) {
10
+ const cmd = new Command('os-logs')
11
+ .description("Tail the host OS's log stream filtered to a Tauri bundle id")
12
+ .option('--config <path>', 'Path to tauri.conf.json (or its directory). Auto-detected if omitted.')
13
+ .option('--identifier <id>', 'Bundle identifier override')
14
+ .option('--product-name <name>', 'Product name override (used for log-source matching)')
15
+ .option('--since <duration>', 'How far back to start (e.g., 5m, 1h). Linux only.')
16
+ .option('--level <level>', 'Minimum level: debug | info | warn | error')
17
+ .option('--source <source>', 'Filter source: main | webview | sidecar | all', 'all')
18
+ .option('--duration <ms>', 'Stop after N milliseconds', parseIntOrInfinity)
19
+ .option('--json', 'Output as one NDJSON envelope per line (default)')
20
+ .action(async (opts) => {
21
+ const minLevel = opts.level ? validateLevel(opts.level) : null;
22
+ const sourceFilter = opts.source ?? 'all';
23
+ let identifier;
24
+ let productName;
25
+ if (opts.identifier) {
26
+ identifier = opts.identifier;
27
+ productName = opts.productName ?? opts.identifier;
28
+ }
29
+ else {
30
+ const resolved = await resolveTauriProject({ configPath: opts.config });
31
+ identifier = resolved.identifier;
32
+ productName = opts.productName ?? resolved.productName;
33
+ }
34
+ const adapter = pickAdapter();
35
+ const args = adapter.buildArgs({
36
+ identifier,
37
+ productName,
38
+ since: opts.since,
39
+ });
40
+ const child = spawn(adapter.command, args, {
41
+ stdio: ['ignore', 'pipe', 'pipe'],
42
+ });
43
+ const framer = new LineFramer();
44
+ child.stdout.setEncoding('utf-8');
45
+ child.stdout.on('data', (chunk) => {
46
+ for (const line of framer.push(chunk)) {
47
+ handleLine(line, adapter, minLevel, sourceFilter);
48
+ }
49
+ });
50
+ let stderrBuf = '';
51
+ child.stderr.setEncoding('utf-8');
52
+ child.stderr.on('data', (chunk) => {
53
+ stderrBuf += chunk;
54
+ if (stderrBuf.length > 1024 * 16)
55
+ stderrBuf = stderrBuf.slice(-1024 * 16);
56
+ });
57
+ let timeoutHandle = null;
58
+ if (opts.duration && Number.isFinite(opts.duration)) {
59
+ timeoutHandle = setTimeout(() => child.kill('SIGTERM'), opts.duration);
60
+ }
61
+ await new Promise((resolve, reject) => {
62
+ child.on('error', (err) => {
63
+ if (timeoutHandle)
64
+ clearTimeout(timeoutHandle);
65
+ if (err.code === 'ENOENT') {
66
+ reject(new Error(`${adapter.command} not found on PATH. ` +
67
+ `os-logs needs the host OS's log streaming tool.`));
68
+ return;
69
+ }
70
+ reject(err);
71
+ });
72
+ child.on('close', (code) => {
73
+ if (timeoutHandle)
74
+ clearTimeout(timeoutHandle);
75
+ const trailing = framer.flush();
76
+ if (trailing)
77
+ handleLine(trailing, adapter, minLevel, sourceFilter);
78
+ // Non-zero exits from `log stream` on SIGTERM are expected; only fail
79
+ // if we got nothing meaningful and stderr has content.
80
+ if (code && code !== 0 && code !== 143 /* SIGTERM */) {
81
+ const detail = stderrBuf.trim();
82
+ reject(new Error(`${adapter.command} exited with code ${code}${detail ? `: ${detail}` : ''}`));
83
+ return;
84
+ }
85
+ resolve();
86
+ });
87
+ });
88
+ });
89
+ program.addCommand(cmd);
90
+ }
91
+ function pickAdapter() {
92
+ if (process.platform === 'darwin') {
93
+ return { command: darwin.COMMAND, buildArgs: darwin.buildArgs, parseLine: darwin.parseLine };
94
+ }
95
+ if (process.platform === 'linux') {
96
+ return { command: linux.COMMAND, buildArgs: linux.buildArgs, parseLine: linux.parseLine };
97
+ }
98
+ if (process.platform === 'win32') {
99
+ return { command: windows.COMMAND, buildArgs: windows.buildArgs, parseLine: windows.parseLine };
100
+ }
101
+ throw new Error(`os-logs is not supported on platform: ${process.platform}`);
102
+ }
103
+ function handleLine(line, adapter, minLevel, sourceFilter) {
104
+ if (line.length === 0)
105
+ return;
106
+ const entry = adapter.parseLine(line);
107
+ if (!entry)
108
+ return;
109
+ if (minLevel && LEVEL_RANK[entry.level] < LEVEL_RANK[minLevel])
110
+ return;
111
+ if (sourceFilter !== 'all' && entry.source !== sourceFilter)
112
+ return;
113
+ console.log(JSON.stringify(entry));
114
+ }
115
+ function validateLevel(input) {
116
+ if (input === 'debug' || input === 'info' || input === 'warn' || input === 'error') {
117
+ return input;
118
+ }
119
+ throw new Error(`Invalid --level: ${input}. Expected one of: debug, info, warn, error.`);
120
+ }
121
+ function parseIntOrInfinity(value) {
122
+ if (value === 'infinity' || value === 'inf')
123
+ return Number.POSITIVE_INFINITY;
124
+ const n = parseInt(value, 10);
125
+ if (!Number.isFinite(n) || n <= 0) {
126
+ throw new Error(`--duration must be a positive integer (milliseconds), got: ${value}`);
127
+ }
128
+ return n;
129
+ }
130
+ //# sourceMappingURL=osLogs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"osLogs.js","sourceRoot":"","sources":["../../src/commands/osLogs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,KAAK,MAAM,MAAM,6BAA6B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AAK,CAAC;QAAE,OAAO;IAC9B,MAAM,KAAK,GAAG,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACtC,IAAI,CAAC,KAAK;QAAE,OAAO;IACnB,IAAI,QAAQ,IAAI,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,UAAU,CAAC,QAAQ,CAAC;QAAE,OAAO;IACvE,IAAI,YAAY,KAAK,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,YAAY;QAAE,OAAO;IACpE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;AACrC,CAAC;AAED,SAAS,aAAa,CAAC,KAAa;IAClC,IAAI,KAAK,KAAK,OAAO,IAAI,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,OAAO,EAAE,CAAC;QACnF,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,oBAAoB,KAAK,8CAA8C,CAAC,CAAC;AAC3F,CAAC;AAED,SAAS,kBAAkB,CAAC,KAAa;IACvC,IAAI,KAAK,KAAK,UAAU,IAAI,KAAK,KAAK,KAAK;QAAE,OAAO,MAAM,CAAC,iBAAiB,CAAC;IAC7E,MAAM,CAAC,GAAG,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC9B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CAAC,8DAA8D,KAAK,EAAE,CAAC,CAAC;IACzF,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC"}
@@ -1,2 +1,3 @@
1
1
  import { Command } from 'commander';
2
+ export declare const PAGE_STATE_SCRIPT = "(() => {\n var state = {\n url: window.location.href,\n title: document.title,\n viewport: { width: window.innerWidth, height: window.innerHeight },\n scroll: { x: Math.round(window.scrollX), y: Math.round(window.scrollY) },\n document: { width: document.documentElement.scrollWidth, height: document.documentElement.scrollHeight },\n hasTauri: !!(window.__TAURI_INTERNALS__ || window.__TAURI__)\n };\n return JSON.stringify(state);\n})()";
2
3
  export declare function registerPageState(program: Command): void;
@@ -1,14 +1,14 @@
1
1
  import { Command } from 'commander';
2
2
  import { addBridgeOptions, resolveBridge } from './shared.js';
3
3
  import { PageStateSchema } from '../schemas/commands.js';
4
- const PAGE_STATE_SCRIPT = `(() => {
4
+ export const PAGE_STATE_SCRIPT = `(() => {
5
5
  var state = {
6
6
  url: window.location.href,
7
7
  title: document.title,
8
8
  viewport: { width: window.innerWidth, height: window.innerHeight },
9
9
  scroll: { x: Math.round(window.scrollX), y: Math.round(window.scrollY) },
10
10
  document: { width: document.documentElement.scrollWidth, height: document.documentElement.scrollHeight },
11
- hasTauri: !!(window.__TAURI__)
11
+ hasTauri: !!(window.__TAURI_INTERNALS__ || window.__TAURI__)
12
12
  };
13
13
  return JSON.stringify(state);
14
14
  })()`;
@@ -1 +1 @@
1
- {"version":3,"file":"pageState.js","sourceRoot":"","sources":["../../src/commands/pageState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAGzD,MAAM,iBAAiB,GAAG;;;;;;;;;;KAUrB,CAAC;AAEN,SAAS,eAAe,CAAC,KAAgB;IACvC,MAAM,KAAK,GAAG;QACZ,oBAAoB,KAAK,CAAC,GAAG,EAAE;QAC/B,oBAAoB,KAAK,CAAC,KAAK,EAAE;QACjC,oBAAoB,KAAK,CAAC,QAAQ,CAAC,KAAK,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE;QACnE,oBAAoB,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE;QACvD,oBAAoB,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GAAG,CAAC,CAAC,CAAC,CAAC;QAE7D,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC9C,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;QACtC,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerProcessTree(program: Command): void;
@@ -0,0 +1,45 @@
1
+ import { Command } from 'commander';
2
+ import { addBridgeOptions, resolveBridge } from './shared.js';
3
+ export function registerProcessTree(program) {
4
+ const cmd = new Command('process-tree')
5
+ .description('Show the Tauri PID and its registered sidecar processes (requires bridge v0.7.0+)')
6
+ .option('--json', 'Output as JSON');
7
+ addBridgeOptions(cmd);
8
+ cmd.action(async (opts) => {
9
+ const bridge = await resolveBridge(opts);
10
+ const proc = await bridge.process();
11
+ if (opts.json) {
12
+ console.log(JSON.stringify(proc, null, 2));
13
+ return;
14
+ }
15
+ renderHuman(proc);
16
+ });
17
+ program.addCommand(cmd);
18
+ }
19
+ function renderHuman(p) {
20
+ const uptimeSec = Math.floor(p.tauri.uptime_ms / 1000);
21
+ console.log(`tauri pid=${p.tauri.pid} uptime=${uptimeSec}s`);
22
+ if (p.tauri.exe)
23
+ console.log(` exe=${p.tauri.exe}`);
24
+ if (p.tauri.args.length > 0)
25
+ console.log(` args=[${p.tauri.args.join(', ')}]`);
26
+ if (p.sidecars.length === 0) {
27
+ console.log(`└── (no sidecars registered)`);
28
+ console.log(` Tip: use \`dev_bridge::spawn_sidecar_monitored(name, cmd, args, &buf, Some(&registry))\``);
29
+ console.log(` or call \`dev_bridge::register_sidecar(&registry, ...)\` after spawning your own.`);
30
+ return;
31
+ }
32
+ for (let i = 0; i < p.sidecars.length; i++) {
33
+ const s = p.sidecars[i];
34
+ const last = i === p.sidecars.length - 1;
35
+ const connector = last ? '└──' : '├──';
36
+ const alive = s.alive === null || s.alive === undefined ? '?' : s.alive ? 'alive' : 'DEAD';
37
+ console.log(`${connector} ${s.name} pid=${s.pid} ${alive}`);
38
+ const indent = last ? ' ' : '│ ';
39
+ if (s.exe)
40
+ console.log(`${indent}exe=${s.exe}`);
41
+ if (s.args.length > 0)
42
+ console.log(`${indent}args=[${s.args.join(', ')}]`);
43
+ }
44
+ }
45
+ //# sourceMappingURL=processTree.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"processTree.js","sourceRoot":"","sources":["../../src/commands/processTree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAI9D,MAAM,UAAU,mBAAmB,CAAC,OAAgB;IAClD,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,cAAc,CAAC;SACpC,WAAW,CAAC,mFAAmF,CAAC;SAChG,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;IAEtC,gBAAgB,CAAC,GAAG,CAAC,CAAC;IAEtB,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,IAAqC,EAAE,EAAE;QACzD,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,IAAI,CAAC,CAAC;QACzC,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC;QACpC,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;YAC3C,OAAO;QACT,CAAC;QACD,WAAW,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,UA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,IAAI,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;QAC3F,OAAO,CAAC,GAAG,CAAC,GAAG,SAAS,IAAI,CAAC,CAAC,IAAI,SAAS,CAAC,CAAC,GAAG,KAAK,KAAK,EAAE,CAAC,CAAC;QAC9D,MAAM,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;QACtC,IAAI,CAAC,CAAC,GAAG;YAAE,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;QAChD,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC;YAAE,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7E,CAAC;AACH,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { Command } from 'commander';
2
+ /**
3
+ * Register the `sidecar` parent command's `replay` subcommand alongside `tap`.
4
+ * Note: this file does NOT define a top-level "sidecar" parent — that lives in
5
+ * sidecarTap.ts. Instead we expose a helper that the CLI bootstrap composes.
6
+ */
7
+ export declare function registerSidecarReplay(program: Command): void;
@@ -0,0 +1,93 @@
1
+ import { spawn } from 'node:child_process';
2
+ import { readFile } from 'node:fs/promises';
3
+ import { existsSync } from 'node:fs';
4
+ /**
5
+ * Register the `sidecar` parent command's `replay` subcommand alongside `tap`.
6
+ * Note: this file does NOT define a top-level "sidecar" parent — that lives in
7
+ * sidecarTap.ts. Instead we expose a helper that the CLI bootstrap composes.
8
+ */
9
+ export function registerSidecarReplay(program) {
10
+ // Find the existing "sidecar" parent command registered by sidecarTap.
11
+ const sidecar = program.commands.find((c) => c.name() === 'sidecar');
12
+ if (!sidecar) {
13
+ throw new Error('registerSidecarReplay must run after registerSidecarTap');
14
+ }
15
+ sidecar
16
+ .command('replay')
17
+ .description('Replay a recorded NDJSON stream (from `sidecar tap --record`)')
18
+ .argument('<file>', 'Path to NDJSON file produced by `sidecar tap --record`')
19
+ .option('--to-stdout', 'Emit lines verbatim to stdout (default)')
20
+ .option('--to-exec <cmd>', 'Pipe lines into the stdin of this command (split with spaces for args)')
21
+ .option('--rate <lps>', 'Lines per second (default: unlimited — emit as fast as possible)')
22
+ .option('--loop', 'After EOF, restart the file from the top until interrupted')
23
+ .action(async (file, opts) => {
24
+ if (!existsSync(file)) {
25
+ throw new Error(`Recording file not found: ${file}`);
26
+ }
27
+ const rate = opts.rate ? parseRate(opts.rate) : Number.POSITIVE_INFINITY;
28
+ const delayMs = Number.isFinite(rate) ? Math.round(1000 / rate) : 0;
29
+ const lines = (await readFile(file, 'utf-8'))
30
+ .split(/\r?\n/)
31
+ .filter((l) => l.length > 0);
32
+ if (lines.length === 0) {
33
+ process.stderr.write(`[sidecar-replay] recording is empty: ${file}\n`);
34
+ return;
35
+ }
36
+ if (opts.toExec) {
37
+ await replayToExec(lines, opts.toExec, delayMs, opts.loop ?? false);
38
+ }
39
+ else {
40
+ await replayToStdout(lines, delayMs, opts.loop ?? false);
41
+ }
42
+ });
43
+ }
44
+ function parseRate(input) {
45
+ const n = Number(input);
46
+ if (!Number.isFinite(n) || n <= 0) {
47
+ throw new Error(`--rate must be a positive number (lines per second), got: ${input}`);
48
+ }
49
+ return n;
50
+ }
51
+ async function replayToStdout(lines, delayMs, loop) {
52
+ do {
53
+ for (const line of lines) {
54
+ process.stdout.write(line + '\n');
55
+ if (delayMs > 0)
56
+ await sleep(delayMs);
57
+ }
58
+ } while (loop);
59
+ }
60
+ async function replayToExec(lines, cmdLine, delayMs, loop) {
61
+ // Naive whitespace split. Users with quoted args should pre-tokenize via shell.
62
+ const [exec, ...args] = cmdLine.split(/\s+/);
63
+ if (!exec)
64
+ throw new Error('--to-exec must include a command');
65
+ const child = spawn(exec, args, { stdio: ['pipe', 'inherit', 'inherit'] });
66
+ const closed = new Promise((resolve, reject) => {
67
+ child.on('error', (err) => reject(err));
68
+ child.on('close', (code) => resolve(code ?? 0));
69
+ });
70
+ try {
71
+ do {
72
+ for (const line of lines) {
73
+ if (!child.stdin.write(line + '\n')) {
74
+ await new Promise((r) => child.stdin.once('drain', r));
75
+ }
76
+ if (delayMs > 0)
77
+ await sleep(delayMs);
78
+ }
79
+ } while (loop);
80
+ child.stdin.end();
81
+ }
82
+ catch (err) {
83
+ child.kill('SIGTERM');
84
+ throw err;
85
+ }
86
+ const exitCode = await closed;
87
+ if (exitCode !== 0)
88
+ process.exitCode = exitCode;
89
+ }
90
+ function sleep(ms) {
91
+ return new Promise((r) => setTimeout(r, ms));
92
+ }
93
+ //# sourceMappingURL=sidecarReplay.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sidecarReplay.js","sourceRoot":"","sources":["../../src/commands/sidecarReplay.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AASrC;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAAgB;IACpD,uEAAuE;IACvE,MAAM,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,SAAS,CAAC,CAAC;IACrE,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;IAC7E,CAAC;IAED,OAAO;SACJ,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,+DAA+D,CAAC;SAC5E,QAAQ,CAAC,QAAQ,EAAE,wDAAwD,CAAC;SAC5E,MAAM,CAAC,aAA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E,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;QACxC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC;QACH,GAAG,CAAC;YACF,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;gBACzB,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC;oBACpC,MAAM,IAAI,OAAO,CAAO,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;gBAC/D,CAAC;gBACD,IAAI,OAAO,GAAG,CAAC;oBAAE,MAAM,KAAK,CAAC,OAAO,CAAC,CAAC;YACxC,CAAC;QACH,CAAC,QAAQ,IAAI,EAAE;QACf,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;IACpB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACtB,MAAM,GAAG,CAAC;IACZ,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC;IAC9B,IAAI,QAAQ,KAAK,CAAC;QAAE,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAClD,CAAC;AAED,SAAS,KAAK,CAAC,EAAU;IACvB,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AAC/C,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerSidecarTap(program: Command): void;
@@ -0,0 +1,118 @@
1
+ import { Command } from 'commander';
2
+ import { spawn } from 'node:child_process';
3
+ import { readFile, appendFile, writeFile } from 'node:fs/promises';
4
+ import { existsSync } from 'node:fs';
5
+ import { LineFramer, NdjsonValidator } from '../util/ndjson.js';
6
+ export function registerSidecarTap(program) {
7
+ const cmd = new Command('sidecar')
8
+ .description('Sidecar process tools (wrap-and-run NDJSON tap, recorded replay)');
9
+ cmd
10
+ .command('tap')
11
+ .description('Spawn a sidecar via its exec command, frame stdout as NDJSON, optionally validate + record')
12
+ .argument('<command...>', 'Sidecar command and args (use -- to delimit)')
13
+ .option('--schema <path>', 'JSON Schema (file path) to validate each envelope against')
14
+ .option('--record <path>', 'Append the raw NDJSON stream to this file as it arrives')
15
+ .option('--raw', 'Echo the original sidecar stdout to our stdout (alongside structured envelopes on stderr)')
16
+ .option('--json', 'Emit structured envelopes as JSON (default)')
17
+ .action(async (commandTokens, opts) => {
18
+ if (commandTokens.length === 0) {
19
+ throw new Error('sidecar tap requires a command. Example: sidecar tap -- node my-sidecar.js');
20
+ }
21
+ const [exec, ...args] = commandTokens;
22
+ let validator;
23
+ if (opts.schema) {
24
+ if (!existsSync(opts.schema)) {
25
+ throw new Error(`Schema file not found: ${opts.schema}`);
26
+ }
27
+ const text = await readFile(opts.schema, 'utf-8');
28
+ let schemaJson;
29
+ try {
30
+ schemaJson = JSON.parse(text);
31
+ }
32
+ catch (err) {
33
+ throw new Error(`Failed to parse schema ${opts.schema}: ${err instanceof Error ? err.message : String(err)}`);
34
+ }
35
+ validator = new NdjsonValidator(schemaJson);
36
+ }
37
+ else {
38
+ validator = new NdjsonValidator();
39
+ }
40
+ if (opts.record) {
41
+ // Reset the recording file at the start of a tap session.
42
+ await writeFile(opts.record, '');
43
+ }
44
+ const child = spawn(exec, args, { stdio: ['ignore', 'pipe', 'pipe'] });
45
+ const framer = new LineFramer();
46
+ child.stdout.setEncoding('utf-8');
47
+ let envelopesEmitted = 0;
48
+ let invalidCount = 0;
49
+ child.stdout.on('data', async (chunk) => {
50
+ const lines = framer.push(chunk);
51
+ for (const line of lines) {
52
+ if (line.length === 0)
53
+ continue;
54
+ await processLine(line, validator, opts);
55
+ envelopesEmitted++;
56
+ if (!validator.parse(line).ok)
57
+ invalidCount++;
58
+ }
59
+ });
60
+ let stderrBuf = '';
61
+ child.stderr.setEncoding('utf-8');
62
+ child.stderr.on('data', (chunk) => {
63
+ // Forward sidecar stderr to ours, prefixed so it's distinguishable.
64
+ stderrBuf += chunk;
65
+ process.stderr.write(`[sidecar-stderr] ${chunk}`);
66
+ });
67
+ const exitCode = await new Promise((resolve, reject) => {
68
+ child.on('error', (err) => {
69
+ if (err.code === 'ENOENT') {
70
+ reject(new Error(`sidecar exec not found: ${exec}`));
71
+ return;
72
+ }
73
+ reject(err);
74
+ });
75
+ child.on('close', async (code) => {
76
+ const trailing = framer.flush();
77
+ if (trailing) {
78
+ await processLine(trailing, validator, opts);
79
+ envelopesEmitted++;
80
+ }
81
+ resolve(code ?? 0);
82
+ });
83
+ });
84
+ // Final summary on stderr so it doesn't pollute the NDJSON stream on stdout.
85
+ process.stderr.write(`[sidecar-tap] exited code=${exitCode} envelopes=${envelopesEmitted} invalid=${invalidCount}${stderrBuf.length > 0 ? ' stderr_bytes=' + stderrBuf.length : ''}\n`);
86
+ if (exitCode !== 0)
87
+ process.exitCode = exitCode;
88
+ });
89
+ program.addCommand(cmd);
90
+ }
91
+ async function processLine(line, validator, opts) {
92
+ if (opts.record) {
93
+ await appendFile(opts.record, line + '\n');
94
+ }
95
+ if (opts.raw) {
96
+ // Echo original line verbatim
97
+ process.stdout.write(line + '\n');
98
+ return;
99
+ }
100
+ const result = validator.parse(line);
101
+ const envelope = result.ok
102
+ ? {
103
+ ts: new Date().toISOString(),
104
+ direction: 'sidecar→',
105
+ valid: result.valid,
106
+ payload: result.value,
107
+ ...(result.errors.length > 0 ? { schemaErrors: result.errors } : {}),
108
+ }
109
+ : {
110
+ ts: new Date().toISOString(),
111
+ direction: 'sidecar→',
112
+ valid: false,
113
+ rawLine: line,
114
+ parseError: result.error,
115
+ };
116
+ console.log(JSON.stringify(envel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AAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACrE;QACH,CAAC,CAAC;YACE,EAAE,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YAC5B,SAAS,EAAE,UAAU;YACrB,KAAK,EAAE,KAAK;YACZ,OAAO,EAAE,IAAI;YACb,UAAU,EAAE,MAAM,CAAC,KAAK;SACzB,CAAC;IAEN,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;AACxC,CAAC"}
@@ -12,7 +12,7 @@ const PAGE_STATE_SCRIPT = `(() => {
12
12
  viewport: { width: window.innerWidth, height: window.innerHeight },
13
13
  scroll: { x: Math.round(window.scrollX), y: Math.round(window.scrollY) },
14
14
  document: { width: document.documentElement.scrollWidth, height: document.documentElement.scrollHeight },
15
- hasTauri: !!(window.__TAURI__)
15
+ hasTauri: !!(window.__TAURI_INTERNALS__ || window.__TAURI__)
16
16
  });
17
17
  })()`;
18
18
  const STORAGE_SCRIPT = `(() => {
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerWebviewAttach(program: Command): void;
@@ -0,0 +1,64 @@
1
+ import { Command } from 'commander';
2
+ import { exec } from '../util/exec.js';
3
+ import { addBridgeOptions, resolveBridge } from './shared.js';
4
+ export function registerWebviewAttach(program) {
5
+ const cmd = new Command('webview')
6
+ .description('Webview/devtools introspection (requires bridge v0.7.0+)');
7
+ const sub = cmd
8
+ .command('attach')
9
+ .description('Print the platform devtools URL or hint, optionally open in a browser')
10
+ .option('--print-url', 'Print only the inspector URL (or empty string if none)')
11
+ .option('--open', 'Open the inspector URL in the default browser (if available)')
12
+ .option('--json', 'Output as JSON');
13
+ addBridgeOptions(sub);
14
+ sub.action(async (opts) => {
15
+ const bridge = await resolveBridge(opts);
16
+ const dt = await bridge.devtools();
17
+ if (opts.json) {
18
+ console.log(JSON.stringify(dt, null, 2));
19
+ return;
20
+ }
21
+ if (opts.printUrl) {
22
+ console.log(dt.url ?? '');
23
+ return;
24
+ }
25
+ renderHuman(dt);
26
+ if (opts.open) {
27
+ if (!dt.url) {
28
+ console.error('--open requested but no inspector URL is available on this platform.');
29
+ process.exitCode = 2;
30
+ return;
31
+ }
32
+ await openInBrowser(dt.url);
33
+ }
34
+ });
35
+ program.addCommand(cmd);
36
+ }
37
+ function renderHuman(dt) {
38
+ console.log(`Webview platform: ${dt.platform}`);
39
+ console.log(`Inspectable: ${dt.inspectable ? 'yes' : 'no'}`);
40
+ if (dt.url) {
41
+ console.log(`Inspector URL: ${dt.url}`);
42
+ }
43
+ else {
44
+ console.log(`Inspector URL: (not exposed)`);
45
+ }
46
+ console.log(`Hint: ${dt.hint}`);
47
+ }
48
+ async function openInBrowser(url) {
49
+ // Cross-platform default-browser open via the host's standard tool.
50
+ const bin = process.platform === 'darwin'
51
+ ? 'open'
52
+ : process.platform === 'win32'
53
+ ? 'cmd'
54
+ : 'xdg-open';
55
+ const args = process.platform === 'win32' ? ['/c', 'start', '', url] : [url];
56
+ try {
57
+ await exec(bin, args, { timeout: 5000 });
58
+ }
59
+ catch (err) {
60
+ console.error(`Failed to launch browser: ${err instanceof Error ? err.message : String(err)}`);
61
+ process.exitCode = 2;
62
+ }
63
+ }
64
+ //# sourceMappingURL=webviewAttach.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webviewAttach.js","sourceRoot":"","sources":["../../src/commands/webviewAttach.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAU9D,MAAM,UAAU,qBAAqB,CAAC,OAAgB;IACpD,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,SAAS,CAAC;SAC/B,W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ACvB,CAAC;AACH,CAAC"}
@@ -0,0 +1,21 @@
1
+ import type { NormalizedLogEntry } from '../../schemas/osLog.js';
2
+ export interface DarwinSpawnArgs {
3
+ identifier: string;
4
+ productName: string;
5
+ since?: string;
6
+ }
7
+ /**
8
+ * Build `log stream` args for the macOS unified log. We filter by either the
9
+ * subsystem (matches `OSLog.Logger`/Rust `tracing` subsystem when configured)
10
+ * or by sender image path (catches everything the app process emits even when
11
+ * the subsystem isn't set). Returns argv suitable for execFile.
12
+ */
13
+ export declare function buildArgs({ identifier, productName, since }: DarwinSpawnArgs): string[];
14
+ /**
15
+ * Parse a single `log stream --style ndjson` line into our normalized shape.
16
+ * Returns null when the line is metadata (e.g., the initial "Filtering the
17
+ * log data using…" line which is not valid JSON).
18
+ */
19
+ export declare function parseLine(line: string): NormalizedLogEntry | null;
20
+ /** The actual command binary the adapter shells out to. */
21
+ export declare const COMMAND = "log";