@genspark/cli 1.0.20 β†’ 1.0.22

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.
package/README.md CHANGED
@@ -26,6 +26,7 @@
26
26
  | πŸ“± **Social Media** | Twitter/X, Instagram, Reddit β€” search posts/users, get comments, connections, and more (30 APIs) |
27
27
  | πŸ€– **Agents** | Podcasts, docs, slides, deep research, fact-checking, websites, batch media generation |
28
28
  | πŸ”Š **Voice** | Voice cloning, voice changer |
29
+ | πŸ•ΈοΈ **Mesh** | Secure SSH between your devices over a private tailnet β€” `gsk mesh join`, `ssh`, `scp`, `forward` |
29
30
 
30
31
  ## Table of Contents
31
32
 
@@ -45,6 +46,7 @@
45
46
  - [Stock Prices](#stock-prices)
46
47
  - [Social Media](#social-media)
47
48
  - [File Transfer](#file-transfer)
49
+ - [Mesh (Secure SSH)](#mesh--secure-ssh-between-your-devices)
48
50
  - [Available Models](#available-models)
49
51
  - [Configuration](#configuration)
50
52
  - [Output Conventions](#output-conventions)
@@ -876,6 +878,45 @@ export GSK_NO_AUTO_UPDATE=1
876
878
 
877
879
  This separation allows programs to parse clean JSON from stdout while humans can follow progress on stderr.
878
880
 
881
+ ## Mesh β€” Secure SSH Between Your Devices
882
+
883
+ `gsk mesh` adds peer-to-peer encrypted networking + SSH to the CLI, powered by Genspark Mesh (Tailscale-based). It reuses your `gsk` login β€” no separate authentication.
884
+
885
+ `gsk mesh` is a thin wrapper around the native `gsk-mesh` binary, fetched from the Genspark CDN on first use (~8 MB), verified by sha256, and cached at `~/.genspark-tool-cli/bin/gsk-mesh` (Apple-notarized on macOS, DigiCert-signed on Windows). Supported platforms: macOS (arm64/x64), Linux (x64/arm64), Windows (x64).
886
+
887
+ ### First Run
888
+
889
+ ```bash
890
+ gsk login # if you haven't already
891
+ gsk mesh join --name laptop # downloads gsk-mesh on first use, joins the mesh
892
+ # Joined mesh as laptop (100.64.0.5).
893
+ ```
894
+
895
+ ### Common Workflows
896
+
897
+ ```bash
898
+ gsk mesh devices # list devices on your tailnet
899
+ gsk mesh ssh laptop # SSH into another device (system ssh + ProxyCommand)
900
+ gsk mesh scp file laptop:~/ # scp via mesh
901
+ gsk mesh forward -L 8080:localhost:80 laptop # port-forward
902
+ gsk mesh status # is the mesh service healthy?
903
+ gsk mesh leave # disconnect this device
904
+ ```
905
+
906
+ Run `gsk mesh --help` for the full command list (served by the native binary).
907
+
908
+ > `gsk mesh login` is not a separate flow β€” `gsk` and `gsk mesh` share one authentication. Use `gsk login`.
909
+
910
+ ### Upgrading
911
+
912
+ ```bash
913
+ gsk mesh upgrade # check + pull the latest gsk-mesh release
914
+ gsk mesh upgrade --force # reinstall even if already at the latest
915
+ gsk mesh upgrade --prerelease # opt into the beta channel
916
+ ```
917
+
918
+ The native binary upgrades independently of `@genspark/cli`, so newer mesh features land without an `npm install -g @genspark/cli` cycle. When a binary is already installed, `gsk mesh` also checks for updates in the background on the same 4-hour cadence as the CLI's own auto-update (honoring `GSK_NO_AUTO_UPDATE` / `"auto_update": false`).
919
+
879
920
  ## Available Models
880
921
 
881
922
  <details>
@@ -0,0 +1,40 @@
1
+ /**
2
+ * `gsk mesh` β€” thin proxy to the native gsk-mesh binary.
3
+ *
4
+ * gsk-mesh is a standalone native Rust binary (Genspark Mesh: Tailscale-based
5
+ * private networking + SSH). `gsk mesh <args...>` lazily downloads + verifies
6
+ * it on first use, then exec's it with the remaining argv. Auth is shared:
7
+ * gsk-mesh reads the same ~/.genspark-tool-cli/config.json `api_key` that
8
+ * `gsk login` writes.
9
+ *
10
+ * Why this is intercepted OUTSIDE commander (see index.ts main()): a true
11
+ * passthrough needs commander's `passThroughOptions`, which requires
12
+ * `enablePositionalOptions` on the program β€” and that flips global option
13
+ * parsing for the WHOLE CLI (`gsk web_search q --debug` would break). So we
14
+ * detect `mesh` by scanning argv ourselves and forward everything verbatim,
15
+ * leaving the rest of the CLI's parsing untouched. The stub command registered
16
+ * by `registerMeshCommand` exists only so `mesh` shows up in `gsk --help`.
17
+ */
18
+ import { Command } from 'commander';
19
+ /**
20
+ * If the invocation is `gsk [global-opts] mesh [args...]`, return the args
21
+ * after `mesh` (possibly empty). Otherwise return null.
22
+ *
23
+ * `argv` is process.argv.slice(2) (no node/script prefix).
24
+ */
25
+ export declare function getMeshInvocation(argv: string[]): string[] | null;
26
+ /**
27
+ * Handle a `gsk mesh ...` invocation end-to-end. Dispatches:
28
+ * - `upgrade` β†’ TS-side version negotiation + download
29
+ * - `login` β†’ redirect to `gsk login` (shared auth; no duplicate UI)
30
+ * - everything else β†’ download-if-needed + exec the native binary verbatim
31
+ * (`whoami`, `logout`, `devices`, `join`, `ssh`, `--help`, …)
32
+ */
33
+ export declare function runMesh(args: string[], baseUrlOverride?: string): Promise<void>;
34
+ /**
35
+ * Register the stub `mesh` command so it appears in `gsk --help`. The real
36
+ * handling happens in index.ts main() via getMeshInvocation/runMesh before
37
+ * commander parses β€” this action is a safety net only.
38
+ */
39
+ export declare function registerMeshCommand(program: Command): void;
40
+ //# sourceMappingURL=mesh.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mesh.d.ts","sourceRoot":"","sources":["../../src/commands/mesh.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAmBnC;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,IAAI,CAyBjE;AA6CD;;;;;;GAMG;AACH,wBAAsB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAoCrF;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAe1D"}
@@ -0,0 +1,164 @@
1
+ /**
2
+ * `gsk mesh` β€” thin proxy to the native gsk-mesh binary.
3
+ *
4
+ * gsk-mesh is a standalone native Rust binary (Genspark Mesh: Tailscale-based
5
+ * private networking + SSH). `gsk mesh <args...>` lazily downloads + verifies
6
+ * it on first use, then exec's it with the remaining argv. Auth is shared:
7
+ * gsk-mesh reads the same ~/.genspark-tool-cli/config.json `api_key` that
8
+ * `gsk login` writes.
9
+ *
10
+ * Why this is intercepted OUTSIDE commander (see index.ts main()): a true
11
+ * passthrough needs commander's `passThroughOptions`, which requires
12
+ * `enablePositionalOptions` on the program β€” and that flips global option
13
+ * parsing for the WHOLE CLI (`gsk web_search q --debug` would break). So we
14
+ * detect `mesh` by scanning argv ourselves and forward everything verbatim,
15
+ * leaving the rest of the CLI's parsing untouched. The stub command registered
16
+ * by `registerMeshCommand` exists only so `mesh` shows up in `gsk --help`.
17
+ */
18
+ import { spawn } from 'child_process';
19
+ import { ensureMeshBinary } from '../mesh/download.js';
20
+ import { runUpgrade } from '../mesh/upgrade.js';
21
+ import { maybeAutoUpgradeMesh } from '../mesh/upgrade.js';
22
+ import { info, error as logError, debug } from '../logger.js';
23
+ // Global options (defined on `program` in index.ts) that consume the following
24
+ // argv token as their value. Used by the argv scanner to find the command name
25
+ // without mis-reading an option value as the command.
26
+ const VALUE_TAKING_GLOBALS = new Set([
27
+ '--api-key',
28
+ '--base-url',
29
+ '--project-id',
30
+ '--timeout',
31
+ '--output',
32
+ '--config',
33
+ ]);
34
+ /**
35
+ * If the invocation is `gsk [global-opts] mesh [args...]`, return the args
36
+ * after `mesh` (possibly empty). Otherwise return null.
37
+ *
38
+ * `argv` is process.argv.slice(2) (no node/script prefix).
39
+ */
40
+ export function getMeshInvocation(argv) {
41
+ let i = 0;
42
+ while (i < argv.length) {
43
+ const tok = argv[i];
44
+ if (tok === '--') {
45
+ // End-of-options marker: the next token (if any) is the command.
46
+ const cmd = argv[i + 1];
47
+ return cmd === 'mesh' ? argv.slice(i + 2) : null;
48
+ }
49
+ if (tok.startsWith('-')) {
50
+ if (tok.includes('=')) {
51
+ i++; // --opt=value : single token
52
+ continue;
53
+ }
54
+ if (VALUE_TAKING_GLOBALS.has(tok)) {
55
+ i += 2; // skip option + its value
56
+ continue;
57
+ }
58
+ i++; // boolean global (--debug / --refresh / --version …)
59
+ continue;
60
+ }
61
+ // First bare operand is the command name.
62
+ return tok === 'mesh' ? argv.slice(i + 1) : null;
63
+ }
64
+ return null;
65
+ }
66
+ const UPGRADE_USAGE = [
67
+ 'Usage: gsk mesh upgrade [options]',
68
+ '',
69
+ 'Check for and install a newer gsk-mesh release.',
70
+ '',
71
+ 'Options:',
72
+ ' --force Reinstall even if already at the latest version',
73
+ ' --prerelease Use the pre-release (beta) channel',
74
+ ' -h, --help Show this help',
75
+ ].join('\n');
76
+ /** Run `gsk mesh upgrade` with manually-parsed flags. */
77
+ async function handleUpgrade(rest, baseUrlOverride) {
78
+ if (rest.includes('-h') || rest.includes('--help')) {
79
+ info(UPGRADE_USAGE);
80
+ process.exit(0);
81
+ }
82
+ const force = rest.includes('--force');
83
+ const prerelease = rest.includes('--prerelease');
84
+ const result = await runUpgrade({ force, prerelease, baseUrlOverride });
85
+ process.exit(result === 'error' ? 1 : 0);
86
+ }
87
+ /** Exec a resolved native binary with `args`, inheriting stdio; propagate exit/signal. */
88
+ function spawnNative(bin, args) {
89
+ const child = spawn(bin, args, { stdio: 'inherit' });
90
+ child.on('error', err => {
91
+ logError(`Failed to launch gsk-mesh: ${err.message}`);
92
+ process.exit(1);
93
+ });
94
+ child.on('exit', (code, signal) => {
95
+ if (signal) {
96
+ // Re-raise the signal so our exit status mirrors the child's
97
+ // (e.g. Ctrl-C during `gsk mesh ssh`).
98
+ process.kill(process.pid, signal);
99
+ }
100
+ else {
101
+ process.exit(code ?? 1);
102
+ }
103
+ });
104
+ // execNative never returns normally β€” the process exits via the handlers.
105
+ return new Promise(() => { });
106
+ }
107
+ /**
108
+ * Handle a `gsk mesh ...` invocation end-to-end. Dispatches:
109
+ * - `upgrade` β†’ TS-side version negotiation + download
110
+ * - `login` β†’ redirect to `gsk login` (shared auth; no duplicate UI)
111
+ * - everything else β†’ download-if-needed + exec the native binary verbatim
112
+ * (`whoami`, `logout`, `devices`, `join`, `ssh`, `--help`, …)
113
+ */
114
+ export async function runMesh(args, baseUrlOverride) {
115
+ const sub = args[0];
116
+ if (sub === 'upgrade') {
117
+ await handleUpgrade(args.slice(1), baseUrlOverride);
118
+ return;
119
+ }
120
+ if (sub === 'login') {
121
+ // `gsk` and `gsk mesh` share one authentication. Don't expose a duplicate
122
+ // device-flow; point users at the single login UI. Explicit message (not a
123
+ // silent rewrite) so someone copying `gsk-mesh login` from the native docs
124
+ // understands why it differs here.
125
+ info('`gsk` and `gsk mesh` share the same authentication β€” run `gsk login` instead.');
126
+ process.exit(0);
127
+ }
128
+ // Resolve (and if needed download/repair) the binary FIRST, so its install
129
+ // settles before we kick off the background currency check β€” otherwise both
130
+ // could call downloadAndInstall at once and race.
131
+ let bin;
132
+ try {
133
+ bin = await ensureMeshBinary();
134
+ }
135
+ catch (err) {
136
+ logError(err.message);
137
+ process.exit(1);
138
+ }
139
+ // Background, throttled currency check (never blocks this invocation). Skipped
140
+ // automatically when no binary is installed yet or auto-update is disabled.
141
+ // Safe to run now: ensureMeshBinary has finished, so no concurrent install.
142
+ void maybeAutoUpgradeMesh(baseUrlOverride).catch(err => debug(`mesh autorun: ${err.message}`));
143
+ await spawnNative(bin, args);
144
+ }
145
+ /**
146
+ * Register the stub `mesh` command so it appears in `gsk --help`. The real
147
+ * handling happens in index.ts main() via getMeshInvocation/runMesh before
148
+ * commander parses β€” this action is a safety net only.
149
+ */
150
+ export function registerMeshCommand(program) {
151
+ program
152
+ .command('mesh')
153
+ .description('Genspark Mesh β€” secure SSH between your devices over a private tailnet. ' +
154
+ 'Native subcommand; downloads gsk-mesh on first use. Run `gsk mesh --help` for the full command list.')
155
+ .allowUnknownOption(true)
156
+ .helpOption(false)
157
+ .argument('[args...]', 'forwarded verbatim to the native gsk-mesh binary')
158
+ .action(async (args) => {
159
+ // Reached only if the early intercept missed (shouldn't happen). Forward
160
+ // anyway so behavior stays correct.
161
+ await runMesh(args ?? []);
162
+ });
163
+ }
164
+ //# sourceMappingURL=mesh.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mesh.js","sourceRoot":"","sources":["../../src/commands/mesh.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AACzD,OAAO,EAAE,IAAI,EAAE,KAAK,IAAI,QAAQ,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AAE7D,+EAA+E;AAC/E,+EAA+E;AAC/E,sDAAsD;AACtD,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC;IACnC,WAAW;IACX,YAAY;IACZ,cAAc;IACd,WAAW;IACX,UAAU;IACV,UAAU;CACX,CAAC,CAAA;AAEF;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAc;IAC9C,IAAI,CAAC,GAAG,CAAC,CAAA;IACT,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QACvB,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;QACnB,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;YACjB,iEAAiE;YACjE,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;YACvB,OAAO,GAAG,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;QAClD,CAAC;QACD,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACxB,IAAI,GAAG,CA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C,CAAA;QACrF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;IAED,2EAA2E;IAC3E,4EAA4E;IAC5E,kDAAkD;IAClD,IAAI,GAAW,CAAA;IACf,IAAI,CAAC;QACH,GAAG,GAAG,MAAM,gBAAgB,EAAE,CAAA;IAChC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,QAAQ,CAAE,GAAa,CAAC,OAAO,CAAC,CAAA;QAChC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;IAED,+EAA+E;IAC/E,4EAA4E;IAC5E,4EAA4E;IAC5E,KAAK,oBAAoB,CAAC,eAAe,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CACrD,KAAK,CAAC,iBAAkB,GAAa,CAAC,OAAO,EAAE,CAAC,CACjD,CAAA;IAED,MAAM,WAAW,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;AAC9B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAgB;IAClD,OAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CACV,0EAA0E;QACxE,sGAAsG,CACzG;SACA,kBAAkB,CAAC,IAAI,CAAC;SACxB,UAAU,CAAC,KAAK,CAAC;SACjB,QAAQ,CAAC,WAAW,EAAE,kDAAkD,CAAC;SACzE,MAAM,CAAC,KAAK,EAAE,IAAc,EAAE,EAAE;QAC/B,yEAAyE;QACzE,oCAAoC;QACpC,MAAM,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC,CAAA;IAC3B,CAAC,CAAC,CAAA;AACN,CAAC"}
@@ -36,6 +36,8 @@ export interface CloneUrlData {
36
36
  * fail with a confusing 403.
37
37
  */
38
38
  export declare function interpolateCloneUrl(template: string, apiKey: string, host: string): string;
39
+ /** Normalize stale server templates before execute mode spawns git. */
40
+ export declare function normalizeCloneUrlForGit(cloneUrl: string): string;
39
41
  /** Strip protocol + trailing slash from a base URL to get a bare host. */
40
42
  export declare function deriveHost(baseUrl: string): string;
41
43
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"sb-git-clone.d.ts","sourceRoot":"","sources":["../../src/commands/sb-git-clone.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AASH,4EAA4E;AAC5E,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;IACnB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,GACX,MAAM,CAwBR;AAED,0EAA0E;AAC1E,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GAAG,SAAS,GAC3B,MAAM,CAiBR;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,MAAM,CAAC,CAmBjB;AAED;;;;;;;;GAQG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE;IAC1C,IAAI,EAAE,YAAY,CAAA;IAClB,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,EAAE,MAAM,GAAG,SAAS,CAAA;CACjC,GAAG,OAAO,CAAC,MAAM,CAAC,CAmBlB"}
1
+ {"version":3,"file":"sb-git-clone.d.ts","sourceRoot":"","sources":["../../src/commands/sb-git-clone.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AASH,4EAA4E;AAC5E,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;IACnB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,GACX,MAAM,CAwBR;AAED,uEAAuE;AACvE,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAKhE;AAED,0EAA0E;AAC1E,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GAAG,SAAS,GAC3B,MAAM,CAiBR;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,MAAM,CAAC,CAmBjB;AAED;;;;;;;;GAQG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE;IAC1C,IAAI,EAAE,YAAY,CAAA;IAClB,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,EAAE,MAAM,GAAG,SAAS,CAAA;CACjC,GAAG,OAAO,CAAC,MAAM,CAAC,CAqBlB"}
@@ -52,6 +52,10 @@ export function interpolateCloneUrl(template, apiKey, host) {
52
52
  .replace(/\$GSK_API_KEY/g, () => apiKey)
53
53
  .replace(/\$GSK_HOST/g, () => host);
54
54
  }
55
+ /** Normalize stale server templates before execute mode spawns git. */
56
+ export function normalizeCloneUrlForGit(cloneUrl) {
57
+ return cloneUrl.replace(/^(https:\/\/[^/]+)\/sb-git\//, '$1/api/second-brain/');
58
+ }
55
59
  /** Strip protocol + trailing slash from a base URL to get a bare host. */
56
60
  export function deriveHost(baseUrl) {
57
61
  return baseUrl.replace(/^https?:\/\//, '').replace(/\/$/, '');
@@ -113,7 +117,7 @@ export async function executeCloneUrl(opts) {
113
117
  let cloneUrl;
114
118
  let dest;
115
119
  try {
116
- cloneUrl = interpolateCloneUrl(data.url, apiKey, deriveHost(baseUrl));
120
+ cloneUrl = normalizeCloneUrlForGit(interpolateCloneUrl(data.url, apiKey, deriveHost(baseUrl)));
117
121
  dest = resolveCloneDest(data.repo, explicitDest);
118
122
  }
119
123
  catch (e) {
@@ -1 +1 @@
1
- {"version":3,"file":"sb-git-clone.js","sourceRoot":"","sources":["../../src/commands/sb-git-clone.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACrC,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AACxB,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AACxB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAE5B,OAAO,EAAE,IAAI,EAAE,KAAK,IAAI,QAAQ,EAAE,MAAM,cAAc,CAAA;AAUtD;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CACjC,QAAgB,EAChB,MAAc,EACd,IAAY;IAEZ,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CACb,wEAAwE,CACzE,CAAA;IACH,CAAC;IACD,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CACb,2DAA2D,CAC5D,CAAA;IACH,CAAC;IACD,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;QAC1E,MAAM,IAAI,KAAK,CACb,oDAAoD,QAAQ,EAAE,CAC/D,CAAA;IACH,CAAC;IACD,wEAAwE;IACxE,qEAAqE;IACrE,mEAAmE;IACnE,uEAAuE;IACvE,sDAAsD;IACtD,OAAO,QAAQ;SAC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SAAM,CAAC;QACN,QAAQ,CAAC,8BAA8B,IAAI,EAAE,CAAC,CAAA;IAChD,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC"}
package/dist/index.js CHANGED
@@ -30,22 +30,12 @@ import { setDebugEnabled, setOutputFormat, debug, info, error as logError, outpu
30
30
  import { loadConfigFile, saveConfigFile, getConfigPath, loadToolsCache, saveToolsCache, setConfigPathOverride, } from './config.js';
31
31
  import { checkForUpdates } from './updater.js';
32
32
  import { registerDesignCommand } from './commands/design.js';
33
- import { executeCloneUrl } from './commands/sb-git-clone.js';
33
+ import { registerMeshCommand, getMeshInvocation, runMesh } from './commands/mesh.js';
34
+ import { executeCloneUrl, normalizeCloneUrlForGit, } from './commands/sb-git-clone.js';
34
35
  const require = createRequire(import.meta.url);
35
36
  const { version: VERSION } = require('../package.json');
36
37
  const DEFAULT_BASE_URL = 'https://www.genspark.ai';
37
38
  const DEFAULT_TIMEOUT = 1800000; // 30 minutes (slides/video generation can be slow)
38
- // Tools whose typical runtime (β‰₯5 min p95) exceeds Claude Code's Bash
39
- // default 2-minute absolute timeout (cli.formatted.js:317781 β€”
40
- // setTimeout(SIGKILL, Q) is one-shot, never reset by stderr activity).
41
- // When detected running inside Claude Code (CLAUDECODE=1), gsk emits a
42
- // stderr hint and exits with code 2 so the agent retries with
43
- // run_in_background=true and polls via the BashOutput tool. See #30305.
44
- const LONG_RUNNING_TOOLS = new Set([
45
- 'create_task',
46
- 'video_generation',
47
- 'audio_generation',
48
- ]);
49
39
  /**
50
40
  * Resolve a custom config path from process.env / process.argv before
51
41
  * Commander has had a chance to parse flags. We peek at argv directly
@@ -125,42 +115,6 @@ function getGlobalOptions() {
125
115
  refresh: opts.refresh || false,
126
116
  };
127
117
  }
128
- /**
129
- * If running inside Claude Code's Bash tool (CLAUDECODE=1) and invoking a
130
- * known long-running tool, print a stderr hint and exit before the
131
- * 2-minute SIGKILL would fire. The agent reads stderr and retries with
132
- * run_in_background=true + BashOutput polling. Escape hatch:
133
- * GSK_FORCE_FOREGROUND=1 skips the check.
134
- */
135
- function adviseBackgroundIfNeeded(toolName) {
136
- if (process.env.CLAUDECODE !== '1')
137
- return;
138
- if (!LONG_RUNNING_TOOLS.has(toolName))
139
- return;
140
- if (process.env.GSK_FORCE_FOREGROUND === '1')
141
- return;
142
- // POSIX-safe single-quote escaping: bare-safe chars unquoted; everything
143
- // else wrapped in single quotes with embedded `'` rendered as `'\''`.
144
- // Avoids the incomplete-sanitization trap of escaping only quotes in a
145
- // double-quoted form (CodeQL js/incomplete-sanitization).
146
- const shQuote = (arg) => /^[a-zA-Z0-9_\-./=:@]+$/.test(arg) ? arg : `'${arg.replace(/'/g, "'\\''")}'`;
147
- const cmdLine = process.argv.slice(1).map(shQuote).join(' ');
148
- // The retry command MUST carry GSK_FORCE_FOREGROUND=1. Claude Code
149
- // injects CLAUDECODE=1 into every spawned child regardless of
150
- // run_in_background, so without an inline override the retried gsk
151
- // process would hit this same check and exit 2 again β€” an infinite
152
- // loop. (Reported by Bugbot on PR #30760.)
153
- process.stderr.write(`\n⚠️ Long-running task (typical duration: 5-30 minutes).\n\n` +
154
- `Claude Code's Bash tool will SIGKILL this process at its 2-minute absolute timeout.\n` +
155
- `The backend would keep running but the result would be lost.\n\n` +
156
- `Please retry this command with run_in_background=true and poll the result via BashOutput:\n\n` +
157
- ` Bash:\n` +
158
- ` command: GSK_FORCE_FOREGROUND=1 ${cmdLine}\n` +
159
- ` run_in_background: true\n\n` +
160
- `Then call BashOutput repeatedly until status="completed" β€” the final JSON result will appear in stdout.\n\n` +
161
- `(The inline GSK_FORCE_FOREGROUND=1 is required: Claude Code re-injects CLAUDECODE=1 into the retry process, so without the override this same check would fire again.)\n`);
162
- process.exit(2);
163
- }
164
118
  function createClient() {
165
119
  const options = getGlobalOptions();
166
120
  setDebugEnabled(options.debug);
@@ -696,11 +650,6 @@ function registerToolCommand(parentProgram, tool, clientFactory, vdProjectIdDefa
696
650
  await startAcpBridge(taskType, clientFactory().getOptions());
697
651
  return;
698
652
  }
699
- // Long-running tools under Claude Code's Bash tool get SIGKILLed at
700
- // the 2-minute absolute timeout. Fail fast with a stderr hint so the
701
- // agent retries with run_in_background=true and polls via BashOutput.
702
- // See #30305 and adviseBackgroundIfNeeded below.
703
- adviseBackgroundIfNeeded(tool.name);
704
653
  // For create_task (non-ACP): validate required params manually
705
654
  if (tool.name === 'create_task') {
706
655
  for (const reqParam of required) {
@@ -843,12 +792,27 @@ function registerToolCommand(parentProgram, tool, clientFactory, vdProjectIdDefa
843
792
  // Resolve local file paths to uploaded URLs
844
793
  const resolvedArgs = await resolveLocalFiles(args, client);
845
794
  const result = await client.executeTool(tool.name, resolvedArgs);
795
+ const isSbGitCloneUrl = tool.name === 'sb-git' &&
796
+ resolvedArgs.action === 'clone-url';
797
+ if (isSbGitCloneUrl &&
798
+ result.status === 'ok' &&
799
+ result.data &&
800
+ typeof result.data === 'object') {
801
+ const data = result.data;
802
+ if (typeof data.url === 'string') {
803
+ const before = data.url;
804
+ const after = normalizeCloneUrlForGit(before);
805
+ data.url = after;
806
+ if (Array.isArray(data.commands)) {
807
+ data.commands = data.commands.map((cmd) => typeof cmd === 'string' ? cmd.replace(before, after) : cmd);
808
+ }
809
+ }
810
+ }
846
811
  // sb-git clone-url --execute: substitute placeholders + spawn
847
812
  // `git clone` locally. Backend response stays placeholder-only
848
813
  // (no secrets in stdout / logs); substitution + subprocess live
849
814
  // here because they need in-process auth + access to git.
850
- if (tool.name === 'sb-git' &&
851
- resolvedArgs.action === 'clone-url' &&
815
+ if (isSbGitCloneUrl &&
852
816
  sbGitExecuteRequested &&
853
817
  result.status === 'ok' &&
854
818
  result.data &&
@@ -927,6 +891,10 @@ function registerToolCommand(parentProgram, tool, clientFactory, vdProjectIdDefa
927
891
  // Register cc-bridge design command. Static (not server-discovered)
928
892
  // because it runs entirely client-side β€” no API roundtrip.
929
893
  registerDesignCommand(program);
894
+ // Register the `mesh` stub so it shows in `gsk --help`. Actual handling is an
895
+ // early intercept in main() (see getMeshInvocation/runMesh) β€” commander can't
896
+ // passthrough native-binary args without breaking global option parsing.
897
+ registerMeshCommand(program);
930
898
  program
931
899
  .command('list-tools')
932
900
  .alias('ls')
@@ -1506,6 +1474,22 @@ addPhoneCallOptions(program
1506
1474
  // Dynamic Tool Registration & Startup
1507
1475
  // ============================================
1508
1476
  async function main() {
1477
+ // `gsk mesh ...` is a native-binary passthrough β€” intercept it before the
1478
+ // tool-fetch path and npm self-update gating (it needs neither). Handling it
1479
+ // outside commander keeps the rest of the CLI's option parsing intact (see
1480
+ // commands/mesh.ts for why).
1481
+ const meshArgs = getMeshInvocation(process.argv.slice(2));
1482
+ if (meshArgs !== null) {
1483
+ program.parseOptions(process.argv);
1484
+ setDebugEnabled(getGlobalOptions().debug);
1485
+ // Forward an explicit `--base-url` flag only (commander leaves it at
1486
+ // DEFAULT_BASE_URL when unset); env/config/prod-default resolution happens
1487
+ // inside the mesh layer so it doesn't inherit gsk's localhost default.
1488
+ const rawBase = program.opts().baseUrl;
1489
+ const baseUrlOverride = rawBase && rawBase !== DEFAULT_BASE_URL ? rawBase : undefined;
1490
+ await runMesh(meshArgs, baseUrlOverride);
1491
+ return;
1492
+ }
1509
1493
  // Check for updates (non-blocking β€” failures are silently ignored)
1510
1494
  try {
1511
1495
  await checkForUpdates(VERSION);