@genspark/cli 1.14.2 → 1.15.1-beta.0
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 +43 -1
- package/dist/client.d.ts +6 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +32 -6
- package/dist/client.js.map +1 -1
- package/dist/commands/aidrive-contract.generated.d.ts.map +1 -1
- package/dist/commands/aidrive-contract.generated.js +141 -4
- package/dist/commands/aidrive-contract.generated.js.map +1 -1
- package/dist/commands/aidrive-upload.js +2 -1
- package/dist/commands/aidrive-upload.js.map +1 -1
- package/dist/commands/sb-box-session.d.ts +128 -0
- package/dist/commands/sb-box-session.d.ts.map +1 -0
- package/dist/commands/sb-box-session.js +477 -0
- package/dist/commands/sb-box-session.js.map +1 -0
- package/dist/config.d.ts +43 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +46 -0
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +178 -31
- package/dist/index.js.map +1 -1
- package/dist/native-waf.d.ts +24 -0
- package/dist/native-waf.d.ts.map +1 -0
- package/dist/native-waf.js +183 -0
- package/dist/native-waf.js.map +1 -0
- package/dist/object-args.d.ts +4 -0
- package/dist/object-args.d.ts.map +1 -0
- package/dist/object-args.js +34 -0
- package/dist/object-args.js.map +1 -0
- package/dist/project-binding.d.ts.map +1 -1
- package/dist/project-binding.js +14 -2
- package/dist/project-binding.js.map +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/updater.d.ts +5 -0
- package/dist/updater.d.ts.map +1 -1
- package/dist/updater.js +30 -3
- package/dist/updater.js.map +1 -1
- package/docs/skills.md +9 -7
- package/package.json +1 -1
- package/skills/gsk-aidrive/SKILL.md +241 -27
- package/skills/gsk-audio-generation/SKILL.md +1 -1
- package/skills/gsk-audio-transcribe/SKILL.md +5 -2
- package/skills/gsk-calendar-search/SKILL.md +42 -0
- package/skills/gsk-calendar-source/SKILL.md +44 -0
- package/skills/gsk-connector/SKILL.md +34 -7
- package/skills/gsk-create-task/SKILL.md +1 -1
- package/skills/gsk-genteam/SKILL.md +4 -2
- package/skills/gsk-github/SKILL.md +4 -3
- package/skills/gsk-google-drive/SKILL.md +6 -5
- package/skills/gsk-google-sheets/SKILL.md +1 -1
- package/skills/gsk-image-generation/SKILL.md +3 -1
- package/skills/gsk-meeting/SKILL.md +1 -1
- package/skills/gsk-notion/SKILL.md +2 -2
- package/skills/gsk-onedrive/SKILL.md +6 -4
- package/skills/gsk-second-brain/SKILL.md +2 -2
- package/skills/gsk-shared/SKILL.md +4 -3
- package/skills/gsk-sharepoint/SKILL.md +6 -5
- package/skills/gsk-video-generation/SKILL.md +2 -1
package/dist/config.d.ts
CHANGED
|
@@ -5,6 +5,25 @@
|
|
|
5
5
|
* 1. Command-line options
|
|
6
6
|
* 2. Environment variables (GSK_API_KEY, GSK_BASE_URL)
|
|
7
7
|
* 3. Config file (~/.genspark-tool-cli/config.json)
|
|
8
|
+
*
|
|
9
|
+
* The credential and its base URL are one pair (see resolveCredentialPair):
|
|
10
|
+
* a key is only valid on the server that issued it (a `gsk-` key on www, an
|
|
11
|
+
* `sbx-` Sandbox Passport only on the sbx gateway), so the base URL follows
|
|
12
|
+
* the tier the key came from instead of being resolved independently.
|
|
13
|
+
*
|
|
14
|
+
* API key: --api-key > GSK_API_KEY > config api_key (unchanged)
|
|
15
|
+
* Base URL: 1. --base-url (explicit flag, always wins)
|
|
16
|
+
* 2. the key's own tier: GSK_BASE_URL for an env key,
|
|
17
|
+
* config base_url for a config key (the CLI tier has none)
|
|
18
|
+
* 3. the first other tier, in order env > config, that has a
|
|
19
|
+
* base URL and holds either no key or this same key
|
|
20
|
+
* 4. the default base URL
|
|
21
|
+
* With no key at all: --base-url > GSK_BASE_URL > config base_url > default.
|
|
22
|
+
*
|
|
23
|
+
* So an env key never borrows the config file's base URL when the config
|
|
24
|
+
* file holds a different key (and vice versa) — it gets the default instead.
|
|
25
|
+
* With only one tier populated, or all tiers holding the same key, the result
|
|
26
|
+
* is what plain "CLI > env > config > default" per field gives.
|
|
8
27
|
*/
|
|
9
28
|
import type { ToolSchema } from './types.js';
|
|
10
29
|
export interface ConfigFile {
|
|
@@ -30,6 +49,8 @@ export declare const GSK_CLI_CAPS = "cli-groups-v2,cli-paths-v3,cli-actions-v4,c
|
|
|
30
49
|
* override. Pass `undefined` to reset to the default location.
|
|
31
50
|
*/
|
|
32
51
|
export declare function setConfigPathOverride(absPath: string | undefined): void;
|
|
52
|
+
/** Directory for small private CLI state files (0700), next to the config. */
|
|
53
|
+
export declare function getStateDir(): string;
|
|
33
54
|
/**
|
|
34
55
|
* Get the path to the config file — honours a `--config` override.
|
|
35
56
|
*/
|
|
@@ -87,4 +108,26 @@ export declare function saveToolsCache(baseUrl: string, tools: ToolSchema[], fea
|
|
|
87
108
|
* key), so a stray value can never break the CLI.
|
|
88
109
|
*/
|
|
89
110
|
export declare function resolveRequestCredential(apiKey: string | undefined, env?: NodeJS.ProcessEnv): string;
|
|
111
|
+
/** One configuration tier's view of the credential pair; empty = unset. */
|
|
112
|
+
export interface CredentialTier {
|
|
113
|
+
apiKey?: string;
|
|
114
|
+
baseUrl?: string;
|
|
115
|
+
}
|
|
116
|
+
export interface CredentialPairSources {
|
|
117
|
+
/** `--api-key`. */
|
|
118
|
+
cliApiKey?: string;
|
|
119
|
+
/** `--base-url`, only when the user passed the flag explicitly. */
|
|
120
|
+
cliBaseUrl?: string;
|
|
121
|
+
env: CredentialTier;
|
|
122
|
+
file: CredentialTier;
|
|
123
|
+
defaultBaseUrl: string;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Resolve the API key and the base URL as one pair — precedence documented
|
|
127
|
+
* in the header comment of this file.
|
|
128
|
+
*/
|
|
129
|
+
export declare function resolveCredentialPair(sources: CredentialPairSources): {
|
|
130
|
+
apiKey: string | undefined;
|
|
131
|
+
baseUrl: string;
|
|
132
|
+
};
|
|
90
133
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAMH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAE5C,MAAM,WAAW,UAAU;IACzB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAuBD,eAAO,MAAM,YAAY,sHAC4F,CAAA;AAmCrH;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAEvE;AAYD,8EAA8E;AAC9E,wBAAgB,WAAW,IAAI,MAAM,CAEpC;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAKtC;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAExD;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,UAAU,CAiC3C;AAmFD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAEvD;AAuBD;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,EAC5B,UAAU,GAAE,CAAC,MAAM,UAAU,CAAC,EAAO,GACpC,IAAI,CASN;AAsCD,wBAAgB,iBAAiB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAEvE;AAaD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,EAAE,GAAG,IAAI,CA0CnE;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,IAAI,IAAI,CAOtC;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,UAAU,EAAE,EACnB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACjC,IAAI,CAsBN;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,MAAM,CAIR;AAED,2EAA2E;AAC3E,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,qBAAqB;IACpC,mBAAmB;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,mEAAmE;IACnE,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,GAAG,EAAE,cAAc,CAAA;IACnB,IAAI,EAAE,cAAc,CAAA;IACpB,cAAc,EAAE,MAAM,CAAA;CACvB;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,qBAAqB,GAAG;IACrE,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,OAAO,EAAE,MAAM,CAAA;CAChB,CAoBA"}
|
package/dist/config.js
CHANGED
|
@@ -5,6 +5,25 @@
|
|
|
5
5
|
* 1. Command-line options
|
|
6
6
|
* 2. Environment variables (GSK_API_KEY, GSK_BASE_URL)
|
|
7
7
|
* 3. Config file (~/.genspark-tool-cli/config.json)
|
|
8
|
+
*
|
|
9
|
+
* The credential and its base URL are one pair (see resolveCredentialPair):
|
|
10
|
+
* a key is only valid on the server that issued it (a `gsk-` key on www, an
|
|
11
|
+
* `sbx-` Sandbox Passport only on the sbx gateway), so the base URL follows
|
|
12
|
+
* the tier the key came from instead of being resolved independently.
|
|
13
|
+
*
|
|
14
|
+
* API key: --api-key > GSK_API_KEY > config api_key (unchanged)
|
|
15
|
+
* Base URL: 1. --base-url (explicit flag, always wins)
|
|
16
|
+
* 2. the key's own tier: GSK_BASE_URL for an env key,
|
|
17
|
+
* config base_url for a config key (the CLI tier has none)
|
|
18
|
+
* 3. the first other tier, in order env > config, that has a
|
|
19
|
+
* base URL and holds either no key or this same key
|
|
20
|
+
* 4. the default base URL
|
|
21
|
+
* With no key at all: --base-url > GSK_BASE_URL > config base_url > default.
|
|
22
|
+
*
|
|
23
|
+
* So an env key never borrows the config file's base URL when the config
|
|
24
|
+
* file holds a different key (and vice versa) — it gets the default instead.
|
|
25
|
+
* With only one tier populated, or all tiers holding the same key, the result
|
|
26
|
+
* is what plain "CLI > env > config > default" per field gives.
|
|
8
27
|
*/
|
|
9
28
|
import * as fs from 'fs';
|
|
10
29
|
import * as path from 'path';
|
|
@@ -69,6 +88,10 @@ function getConfigDir() {
|
|
|
69
88
|
}
|
|
70
89
|
return path.join(os.homedir(), CONFIG_DIR);
|
|
71
90
|
}
|
|
91
|
+
/** Directory for small private CLI state files (0700), next to the config. */
|
|
92
|
+
export function getStateDir() {
|
|
93
|
+
return getConfigDir();
|
|
94
|
+
}
|
|
72
95
|
/**
|
|
73
96
|
* Get the path to the config file — honours a `--config` override.
|
|
74
97
|
*/
|
|
@@ -357,4 +380,27 @@ export function resolveRequestCredential(apiKey, env = process.env) {
|
|
|
357
380
|
return turn;
|
|
358
381
|
return apiKey || '';
|
|
359
382
|
}
|
|
383
|
+
/**
|
|
384
|
+
* Resolve the API key and the base URL as one pair — precedence documented
|
|
385
|
+
* in the header comment of this file.
|
|
386
|
+
*/
|
|
387
|
+
export function resolveCredentialPair(sources) {
|
|
388
|
+
const { cliApiKey, cliBaseUrl, env, file, defaultBaseUrl } = sources;
|
|
389
|
+
const apiKey = cliApiKey || env.apiKey || file.apiKey || undefined;
|
|
390
|
+
if (cliBaseUrl)
|
|
391
|
+
return { apiKey, baseUrl: normalizeBaseUrl(cliBaseUrl) };
|
|
392
|
+
const ownTier = cliApiKey
|
|
393
|
+
? undefined
|
|
394
|
+
: env.apiKey
|
|
395
|
+
? env
|
|
396
|
+
: file.apiKey
|
|
397
|
+
? file
|
|
398
|
+
: undefined;
|
|
399
|
+
const compatible = (tier) => !!tier.baseUrl && (!apiKey || !tier.apiKey || tier.apiKey === apiKey);
|
|
400
|
+
const source = (ownTier?.baseUrl ? ownTier : undefined) ?? [env, file].find(compatible);
|
|
401
|
+
return {
|
|
402
|
+
apiKey,
|
|
403
|
+
baseUrl: normalizeBaseUrl(source?.baseUrl || defaultBaseUrl),
|
|
404
|
+
};
|
|
405
|
+
}
|
|
360
406
|
//# sourceMappingURL=config.js.map
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AACxB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AAoBnC,4EAA4E;AAC5E,yEAAyE;AACzE,6EAA6E;AAC7E,0EAA0E;AAC1E,6EAA6E;AAC7E,6EAA6E;AAC7E,mEAAmE;AACnE,6EAA6E;AAC7E,4EAA4E;AAC5E,0BAA0B;AAC1B,EAAE;AACF,+DAA+D;AAC/D,0EAA0E;AAC1E,6DAA6D;AAC7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ACA;;;;;;;;;;;;;;;;;;GAkBG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;GAkBG;AAokBH,KAAK,oBAAoB,GAAG,kBAAkB,GAAG,SAAS,GAAG,SAAS,CAAA;AAEtE,UAAU,mBAAmB;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,oBAAoB,CAAA;CAC3B;AAED,kFAAkF;AAClF,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,MAAM,EAAE,GACb,mBAAmB,EAAE,CAqBvB"}
|
package/dist/index.js
CHANGED
|
@@ -35,19 +35,21 @@ import { spawn } from 'child_process';
|
|
|
35
35
|
import { Readable } from 'stream';
|
|
36
36
|
import { pipeline } from 'stream/promises';
|
|
37
37
|
import { ApiClient, isAuthError, unauthenticatedRequest, } from './client.js';
|
|
38
|
+
import { tokenPassHeaders } from './native-waf.js';
|
|
38
39
|
import { classifyFileArg, awaitLocalFileReady, decideAfterWait, localFileNotReadyError, passthroughWarning, urlsParamItems, } from './localFiles.js';
|
|
39
40
|
import { setDebugEnabled, setOutputFormat, debug, info, warn, error as logError, output, progress, } from './logger.js';
|
|
40
41
|
import { runInteractiveApprovalFlow, shouldPromptForApproval, } from './pendingApproval.js';
|
|
41
42
|
import { isPendingConfirmationEnvelope, LEGACY_SKIP_PARAMS, runPreCallConfirmation, STALE_SCHEMA_CACHE_MESSAGE, } from './confirm.js';
|
|
42
43
|
import { repairJsonArrayArgs } from './arrayArgs.js';
|
|
43
|
-
import {
|
|
44
|
+
import { parseJsonObjectArgs } from './object-args.js';
|
|
45
|
+
import { clearToolsCache, getCachedFeatures, loadConfigFile, getConfigPath, loadToolsCache, normalizeBaseUrl, resolveCredentialPair, saveToolsCache, setConfigPathOverride, updateConfigFile, } from './config.js';
|
|
44
46
|
import { checkForUpdates } from './updater.js';
|
|
45
47
|
import { addRegisteredCommands, collectToolCommandTokens, staleCacheMissingToken, } from './staleCache.js';
|
|
46
48
|
import { shimLegacyTaskInvocation } from './task-shim.js';
|
|
47
49
|
import { getSandboxRuntime } from './runtime.js';
|
|
48
50
|
import { registerDesignCommand } from './commands/design.js';
|
|
49
51
|
import { collectUploadFiles, aidriveUploadHeaders, buildAidriveUploadQuery, mergeShareIntoUpload, normalizeUploadDestination, resolveAidriveUploadOperands, shareArgsFromUpload, uploadConflictFromCli, uploadConflictProblem, uploadPathForDestination, uploadShareRefusal, } from './commands/aidrive-upload.js';
|
|
50
|
-
import { aidriveOperandArgs, canonicalDriveAction, driveArgumentError } from './commands/aidrive-operands.js';
|
|
52
|
+
import { aidriveOperandArgs, canonicalDriveAction, driveArgumentError, } from './commands/aidrive-operands.js';
|
|
51
53
|
import { resolveAidriveDownloadOperands, normalizeDrivePath, extractReadableUrl, shouldResolveFileWrapperUrl, } from './commands/aidrive-download.js';
|
|
52
54
|
import { fileNameFromContentDisposition, genteamAttachmentEndpoint, resolveGenteamDownloadDestination, saveBodyToFile, } from './commands/genteam-download.js';
|
|
53
55
|
import { CALL_RECORDING_INFO_HELP, CALL_RECORDING_LOCAL_FILE_HELP, callRecordingEndpoint, defaultRecordingFileName, formatBytes, normalizeRecordingChannels, progressThrottle, RECORDING_CHANNEL_MODES, recordingDestinationOperands, recordingProgressLine, } from './commands/telephony-recording.js';
|
|
@@ -56,11 +58,23 @@ import { defaultPiAgentDir, mergePiModelsConfig, mergePiSettingsConfig, readJson
|
|
|
56
58
|
import { mediaItemsKeyFor, mediaSummaryLines } from './mediaSummary.js';
|
|
57
59
|
import { registerMeshCommand, getMeshInvocation, runMesh, } from './commands/mesh.js';
|
|
58
60
|
import { executeCloneUrl, normalizeCloneUrlForGit, } from './commands/sb-git-clone.js';
|
|
61
|
+
import { afterSessionCall, bindSession, defaultTemplate, resolveSessionKey, SANDBOX_ACTIONS, SessionError, SessionStore, SESSION_ENV, } from './commands/sb-box-session.js';
|
|
59
62
|
import { actionScopedDescription, serviceActionViews, } from './serviceActions.js';
|
|
60
63
|
const require = createRequire(import.meta.url);
|
|
61
64
|
const { version: VERSION } = require('../package.json');
|
|
62
65
|
const DEFAULT_BASE_URL = 'https://www.genspark.ai';
|
|
63
66
|
const DEFAULT_TIMEOUT = 1800000; // 30 minutes (slides/video generation can be slow)
|
|
67
|
+
// `gsk sb-box --session` help (commands/sb-box-session.ts). Env fallbacks
|
|
68
|
+
// are named so a host-spawned shell knows why a bare `run-code` just worked.
|
|
69
|
+
const SB_BOX_SESSION_HELP = 'Bind this session key to a sandbox instead of passing --sandbox_id: the ' +
|
|
70
|
+
'CLI reuses the sandbox it remembers for the key while it is alive ' +
|
|
71
|
+
'(frozen is fine — it resumes) and starts a new one on exec / run-code / ' +
|
|
72
|
+
'write when there is none (--template picks the image; default newest ' +
|
|
73
|
+
'public base; no hard deadline, idle-frozen when quiet). get / read / ls / ' +
|
|
74
|
+
'kill / freeze / … only use an existing binding; `kill` drops it; ' +
|
|
75
|
+
'`create --session` binds the new sandbox. Without the flag the key comes ' +
|
|
76
|
+
`from $${SESSION_ENV}, then CLAUDE_CODE_SESSION_ID (create binds only with the flag). An explicit ` +
|
|
77
|
+
'--sandbox_id always wins. Bindings: <config dir>/sb-box-sessions.json, per API host.';
|
|
64
78
|
const GENTEAM_DOWNLOAD_LOCAL_FILE_HELP = 'download: local destination path (same as a bare operand; a directory ' +
|
|
65
79
|
'receives the server-reported file name; default ./<file_name>)';
|
|
66
80
|
/**
|
|
@@ -294,16 +308,20 @@ function finalizeGlobalPassthrough() {
|
|
|
294
308
|
}
|
|
295
309
|
function getGlobalOptions() {
|
|
296
310
|
const opts = { ...program.opts(), ...activePassthroughOpts };
|
|
297
|
-
// API key
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
311
|
+
// API key and base URL resolve as one pair (#70209) — see the precedence
|
|
312
|
+
// table in config.ts.
|
|
313
|
+
const { apiKey, baseUrl } = resolveCredentialPair({
|
|
314
|
+
cliApiKey: opts.apiKey,
|
|
315
|
+
cliBaseUrl: program.getOptionValueSource('baseUrl') === 'cli'
|
|
316
|
+
? opts.baseUrl
|
|
317
|
+
: undefined,
|
|
318
|
+
env: {
|
|
319
|
+
apiKey: process.env.GSK_API_KEY,
|
|
320
|
+
baseUrl: process.env.GSK_BASE_URL,
|
|
321
|
+
},
|
|
322
|
+
file: { apiKey: fileConfig.api_key, baseUrl: fileConfig.base_url },
|
|
323
|
+
defaultBaseUrl: DEFAULT_BASE_URL,
|
|
324
|
+
});
|
|
307
325
|
// Timeout priority: CLI > config file > default
|
|
308
326
|
const timeout = opts.timeout !== String(DEFAULT_TIMEOUT)
|
|
309
327
|
? parseInt(opts.timeout, 10)
|
|
@@ -330,6 +348,16 @@ function getGlobalOptions() {
|
|
|
330
348
|
yes: opts.yes === true,
|
|
331
349
|
};
|
|
332
350
|
}
|
|
351
|
+
/**
|
|
352
|
+
* A session-binding failure (no sandbox bound yet, lock held, …) is an
|
|
353
|
+
* ordinary tool error for the agent reading stdout: SKILL.md tells it to
|
|
354
|
+
* check `status`, not the exit code, so it must be the same JSON envelope
|
|
355
|
+
* every other sb-box error uses — not a bare `[ERROR]` line on stderr with
|
|
356
|
+
* an empty stdout (James 2026-10-20). `output` still sets exit code 1.
|
|
357
|
+
*/
|
|
358
|
+
function sessionErrorEnvelope(err) {
|
|
359
|
+
output({ version: 1, status: 'error', message: err.message, data: null });
|
|
360
|
+
}
|
|
333
361
|
function createClient() {
|
|
334
362
|
const options = getGlobalOptions();
|
|
335
363
|
setDebugEnabled(options.debug);
|
|
@@ -383,7 +411,12 @@ const CONTENT_TYPE_MAP = {
|
|
|
383
411
|
'.csv': 'text/csv',
|
|
384
412
|
'.zip': 'application/zip',
|
|
385
413
|
'.mp3': 'audio/mpeg',
|
|
414
|
+
'.m4a': 'audio/mp4',
|
|
415
|
+
'.aac': 'audio/aac',
|
|
416
|
+
'.ogg': 'audio/ogg',
|
|
417
|
+
'.flac': 'audio/flac',
|
|
386
418
|
'.mp4': 'video/mp4',
|
|
419
|
+
'.mov': 'video/quicktime',
|
|
387
420
|
'.wav': 'audio/wav',
|
|
388
421
|
'.webm': 'video/webm',
|
|
389
422
|
};
|
|
@@ -552,7 +585,7 @@ async function uploadLocalFile(filePath, client) {
|
|
|
552
585
|
*
|
|
553
586
|
* This avoids the roundabout blob-upload + download_file two-step approach.
|
|
554
587
|
*/
|
|
555
|
-
async function uploadToAiDrive(filePath, uploadPath, workspace = '
|
|
588
|
+
async function uploadToAiDrive(filePath, uploadPath, workspace = '', source, onConflict, locator) {
|
|
556
589
|
const fileName = pathModule.basename(filePath);
|
|
557
590
|
const ext = pathModule.extname(filePath).toLowerCase();
|
|
558
591
|
const contentType = CONTENT_TYPE_MAP[ext] || 'application/octet-stream';
|
|
@@ -573,6 +606,8 @@ async function uploadToAiDrive(filePath, uploadPath, workspace = 'my_drive', sou
|
|
|
573
606
|
projectId: globalOpts.projectId,
|
|
574
607
|
contentType,
|
|
575
608
|
});
|
|
609
|
+
// node:https never follows redirects, so the optional pass cannot leak.
|
|
610
|
+
Object.assign(headers, await tokenPassHeaders(baseUrl, '/api/tool_cli/aidrive/upload', headers['X-Api-Key'] ?? ''));
|
|
576
611
|
debug(`AI Drive upload URL: ${uploadUrl}`);
|
|
577
612
|
const responseBody = await streamFileUpload(filePath, uploadUrl, headers, fileSize, 'POST');
|
|
578
613
|
try {
|
|
@@ -794,10 +829,8 @@ function parseBooleanFlagValue(value) {
|
|
|
794
829
|
return false;
|
|
795
830
|
throw new InvalidArgumentError(`expected true/false. If '${value}' was meant as an argument, place it before the flag or pass an explicit value (--flag true ${value}).`);
|
|
796
831
|
}
|
|
797
|
-
function addAidriveLocalOptions(cmd,
|
|
798
|
-
|
|
799
|
-
cmd.option('--workspace <value>', 'AI Drive workspace: my_drive, shared_with_me, or shared_drive');
|
|
800
|
-
}
|
|
832
|
+
function addAidriveLocalOptions(cmd, action) {
|
|
833
|
+
cmd.addOption(new Option('--workspace [type]', 'Drive location: my_drive (ls default), sb_workspace (bare flag), team_drive, genteam (channel and DM drives), shared_drive (all managed), shared_with_me').preset('sb_workspace'));
|
|
801
834
|
cmd.option('--local_file <path>', action === 'download'
|
|
802
835
|
? 'Local destination path; use --local_file with --id or --url. ' +
|
|
803
836
|
'Otherwise the second operand is the destination.'
|
|
@@ -1050,6 +1083,8 @@ function registerToolCommand(parentProgram, tool, clientFactory, vdProjectIdDefa
|
|
|
1050
1083
|
break;
|
|
1051
1084
|
if (name === tool.cli.primary_arg)
|
|
1052
1085
|
continue;
|
|
1086
|
+
if (tool.name === 'aidrive' && name === 'workspace')
|
|
1087
|
+
continue;
|
|
1053
1088
|
// For create_task, make params optional so --acp mode works without them.
|
|
1054
1089
|
// Validation of required params happens in the action handler. Likewise
|
|
1055
1090
|
// skills_save's `files` is server-required but CLI-populated (from the
|
|
@@ -1140,7 +1175,7 @@ function registerToolCommand(parentProgram, tool, clientFactory, vdProjectIdDefa
|
|
|
1140
1175
|
// For the aidrive tool, add client-side options used by the --local_file
|
|
1141
1176
|
// upload and by `download`'s local destination.
|
|
1142
1177
|
if (tool.name === 'aidrive')
|
|
1143
|
-
addAidriveLocalOptions(cmd
|
|
1178
|
+
addAidriveLocalOptions(cmd);
|
|
1144
1179
|
// genteam download saves the attachment to local disk (client-side: only
|
|
1145
1180
|
// this process can write the local filesystem). The union view takes the
|
|
1146
1181
|
// flag here; the per-action `download` subcommand registers it below.
|
|
@@ -1162,6 +1197,12 @@ function registerToolCommand(parentProgram, tool, clientFactory, vdProjectIdDefa
|
|
|
1162
1197
|
if (tool.name === 'sb-git') {
|
|
1163
1198
|
cmd.option('--execute [dest]', 'For action=clone-url: run `git clone` locally to [dest] (default: ./<repo>) instead of just printing the snippet');
|
|
1164
1199
|
}
|
|
1200
|
+
// For sb-box: `--session <key>` binds a session to a sandbox client-side
|
|
1201
|
+
// (commands/sb-box-session.ts): the CLI remembers which sandbox the key
|
|
1202
|
+
// owns, reuses it while alive and starts a new one on exec / run-code /
|
|
1203
|
+
// write when it is gone. CLI-only; the server sees the resolved sandbox_id.
|
|
1204
|
+
if (tool.name === 'sb-box')
|
|
1205
|
+
cmd.option('--session <key>', SB_BOX_SESSION_HELP);
|
|
1165
1206
|
// For skills pull: `--out [dir]` writes the returned skill files to disk.
|
|
1166
1207
|
// Client-side because an HTTP/JSON tool can't materialise a tree on the
|
|
1167
1208
|
// user's machine — same shape as sb-git's `--execute`. Default dest is
|
|
@@ -1448,6 +1489,11 @@ function registerToolCommand(parentProgram, tool, clientFactory, vdProjectIdDefa
|
|
|
1448
1489
|
}
|
|
1449
1490
|
}
|
|
1450
1491
|
}
|
|
1492
|
+
const objectError = parseJsonObjectArgs(args, props);
|
|
1493
|
+
if (objectError) {
|
|
1494
|
+
logError(objectError);
|
|
1495
|
+
process.exit(1);
|
|
1496
|
+
}
|
|
1451
1497
|
// Coerce numeric strings to numbers based on schema
|
|
1452
1498
|
for (const [name, param] of Object.entries(props)) {
|
|
1453
1499
|
if (args[name] !== undefined) {
|
|
@@ -1491,11 +1537,15 @@ function registerToolCommand(parentProgram, tool, clientFactory, vdProjectIdDefa
|
|
|
1491
1537
|
if (tool.name === 'aidrive' && typeof args.action === 'string') {
|
|
1492
1538
|
const actionNames = props.action?.enum;
|
|
1493
1539
|
const primaryAction = primaryArgValue === undefined
|
|
1494
|
-
? undefined
|
|
1540
|
+
? undefined
|
|
1541
|
+
: canonicalDriveAction(primaryArgValue);
|
|
1495
1542
|
const action = canonicalDriveAction(args.action);
|
|
1496
1543
|
args.action = action;
|
|
1497
|
-
if (primaryAction !== undefined &&
|
|
1498
|
-
|
|
1544
|
+
if (primaryAction !== undefined &&
|
|
1545
|
+
primaryAction !== action &&
|
|
1546
|
+
(invokedCmd !== cmd ||
|
|
1547
|
+
(Array.isArray(actionNames) &&
|
|
1548
|
+
actionNames.includes(primaryAction)))) {
|
|
1499
1549
|
logError(`The command line names the action ${primaryArgValue} and ` +
|
|
1500
1550
|
`--args-file names ${args.action}; pass one. Nothing was sent.`);
|
|
1501
1551
|
process.exit(1);
|
|
@@ -1504,9 +1554,12 @@ function registerToolCommand(parentProgram, tool, clientFactory, vdProjectIdDefa
|
|
|
1504
1554
|
logError(`Unknown AI Drive action: ${args.action}. Run gsk drive --help for available actions. Nothing was sent.`);
|
|
1505
1555
|
process.exit(1);
|
|
1506
1556
|
}
|
|
1507
|
-
aidriveOperands =
|
|
1508
|
-
|
|
1509
|
-
? invokedCmd.args
|
|
1557
|
+
aidriveOperands =
|
|
1558
|
+
invokedCmd !== cmd
|
|
1559
|
+
? invokedCmd.args
|
|
1560
|
+
: primaryAction !== undefined && primaryAction === action
|
|
1561
|
+
? invokedCmd.args.slice(1)
|
|
1562
|
+
: invokedCmd.args;
|
|
1510
1563
|
const mapped = aidriveOperandArgs(action, aidriveOperands, args);
|
|
1511
1564
|
if (mapped.error) {
|
|
1512
1565
|
logError(mapped.error);
|
|
@@ -1723,7 +1776,10 @@ function registerToolCommand(parentProgram, tool, clientFactory, vdProjectIdDefa
|
|
|
1723
1776
|
// intercept it with the two-call equivalent.
|
|
1724
1777
|
if (tool.name === 'aidrive' && args.action === 'download') {
|
|
1725
1778
|
const { drivePath: sourceOperand, localPath: operandDest } = resolveAidriveDownloadOperands(aidriveOperands, typeof args.path === 'string' ? args.path : undefined);
|
|
1726
|
-
const hasDownloadLocator = !!(args.id ||
|
|
1779
|
+
const hasDownloadLocator = !!(args.id ||
|
|
1780
|
+
args.url ||
|
|
1781
|
+
args.source ||
|
|
1782
|
+
args.share);
|
|
1727
1783
|
if (!sourceOperand && !hasDownloadLocator) {
|
|
1728
1784
|
logError('download needs the AI-Drive path: gsk aidrive download ' +
|
|
1729
1785
|
'<ai-drive-path> [local-path] (or --path/-p). To save an ' +
|
|
@@ -1765,7 +1821,8 @@ function registerToolCommand(parentProgram, tool, clientFactory, vdProjectIdDefa
|
|
|
1765
1821
|
const fileName = urlResult.session_state?.aidrive_result?.file_name;
|
|
1766
1822
|
const destPath = (typeof opts.local_file === 'string' ? opts.local_file : '') ||
|
|
1767
1823
|
operandDest ||
|
|
1768
|
-
pathModule.basename(fileName || resolvedDrivePath) ||
|
|
1824
|
+
pathModule.basename(fileName || resolvedDrivePath) ||
|
|
1825
|
+
'download';
|
|
1769
1826
|
const savedPath = await downloadToFile(readableUrl, destPath, client);
|
|
1770
1827
|
output({
|
|
1771
1828
|
status: 'ok',
|
|
@@ -1936,7 +1993,8 @@ function registerToolCommand(parentProgram, tool, clientFactory, vdProjectIdDefa
|
|
|
1936
1993
|
// a shared source's sharing has its own verb and admin gate.
|
|
1937
1994
|
const shareAfterUpload = shareArgsFromUpload(args);
|
|
1938
1995
|
const sharesAfterUpload = Object.keys(shareAfterUpload).length > 0;
|
|
1939
|
-
const workspace = args.workspace ||
|
|
1996
|
+
const workspace = args.workspace ||
|
|
1997
|
+
(sharesAfterUpload ? 'my_drive' : '');
|
|
1940
1998
|
const source = args.source ||
|
|
1941
1999
|
args.share;
|
|
1942
2000
|
if (!fs.existsSync(localFilePath)) {
|
|
@@ -2102,6 +2160,68 @@ function registerToolCommand(parentProgram, tool, clientFactory, vdProjectIdDefa
|
|
|
2102
2160
|
args.file_urls = [...existing, ...fileUrls];
|
|
2103
2161
|
delete args.file; // CLI-only option, not a server parameter
|
|
2104
2162
|
}
|
|
2163
|
+
// sb-box --session: resolve the session's sandbox before the call
|
|
2164
|
+
// (reuse / create), never forward the flag. An explicit sandbox_id
|
|
2165
|
+
// wins and leaves the binding alone; with neither flag the env
|
|
2166
|
+
// fallbacks (GSK_SB_BOX_SESSION, a host agent's session id) apply
|
|
2167
|
+
// to the actions that address a sandbox.
|
|
2168
|
+
let sbBoxSession;
|
|
2169
|
+
let sbBoxBind;
|
|
2170
|
+
let sbBoxStore;
|
|
2171
|
+
if (tool.name === 'sb-box') {
|
|
2172
|
+
const explicitSession = args.session;
|
|
2173
|
+
delete args.session;
|
|
2174
|
+
const action = typeof args.action === 'string' ? args.action : '';
|
|
2175
|
+
const hasSandboxId = typeof args.sandbox_id === 'string' && args.sandbox_id.trim() !== '';
|
|
2176
|
+
const key = resolveSessionKey(explicitSession);
|
|
2177
|
+
// `create` binds only on an EXPLICIT --session: a bare create
|
|
2178
|
+
// inside Claude Code must not silently rebind the conversation's
|
|
2179
|
+
// sandbox (the env fallbacks are for the actions that address one).
|
|
2180
|
+
if (key && action === 'create' && !hasSandboxId) {
|
|
2181
|
+
if (key.source === 'flag')
|
|
2182
|
+
sbBoxSession = key;
|
|
2183
|
+
}
|
|
2184
|
+
else if (key && SANDBOX_ACTIONS.has(action) && !hasSandboxId) {
|
|
2185
|
+
sbBoxSession = key;
|
|
2186
|
+
}
|
|
2187
|
+
// create without --template: newest ready public base (CLI-side).
|
|
2188
|
+
if (action === 'create' &&
|
|
2189
|
+
!(typeof args.template === 'string' && args.template.trim())) {
|
|
2190
|
+
try {
|
|
2191
|
+
args.template = await defaultTemplate(callArgs => client.executeTool('sb-box', callArgs));
|
|
2192
|
+
info(`create: no --template given, using the public base ${args.template}`);
|
|
2193
|
+
}
|
|
2194
|
+
catch (err) {
|
|
2195
|
+
if (err instanceof SessionError) {
|
|
2196
|
+
sessionErrorEnvelope(err);
|
|
2197
|
+
return;
|
|
2198
|
+
}
|
|
2199
|
+
throw err;
|
|
2200
|
+
}
|
|
2201
|
+
}
|
|
2202
|
+
if (sbBoxSession) {
|
|
2203
|
+
sbBoxStore = SessionStore.forConfig(getConfigPath(), getGlobalOptions().baseUrl);
|
|
2204
|
+
if (action !== 'create') {
|
|
2205
|
+
try {
|
|
2206
|
+
sbBoxBind = await bindSession({
|
|
2207
|
+
key: sbBoxSession,
|
|
2208
|
+
action,
|
|
2209
|
+
args,
|
|
2210
|
+
call: callArgs => client.executeTool('sb-box', callArgs),
|
|
2211
|
+
store: sbBoxStore,
|
|
2212
|
+
log: info,
|
|
2213
|
+
});
|
|
2214
|
+
}
|
|
2215
|
+
catch (err) {
|
|
2216
|
+
if (err instanceof SessionError) {
|
|
2217
|
+
sessionErrorEnvelope(err);
|
|
2218
|
+
return;
|
|
2219
|
+
}
|
|
2220
|
+
throw err;
|
|
2221
|
+
}
|
|
2222
|
+
}
|
|
2223
|
+
}
|
|
2224
|
+
}
|
|
2105
2225
|
// Resolve local file paths to uploaded URLs
|
|
2106
2226
|
// The drive's --url is the Drive link an entry is addressed by.
|
|
2107
2227
|
const uploadArgs = await resolveUploadFilePaths(args, tool.parameters.properties, source => resolveFileArg(source, client));
|
|
@@ -2112,6 +2232,15 @@ function registerToolCommand(parentProgram, tool, clientFactory, vdProjectIdDefa
|
|
|
2112
2232
|
// upgrades the stub into a live SSE follow that exits with the
|
|
2113
2233
|
// run's terminal result — the work still executes server-side.
|
|
2114
2234
|
let result = await client.executeTool(tool.name, resolvedArgs);
|
|
2235
|
+
if (sbBoxSession && sbBoxStore) {
|
|
2236
|
+
afterSessionCall({
|
|
2237
|
+
key: sbBoxSession,
|
|
2238
|
+
action: String(resolvedArgs.action ?? ''),
|
|
2239
|
+
bind: sbBoxBind,
|
|
2240
|
+
result,
|
|
2241
|
+
store: sbBoxStore,
|
|
2242
|
+
});
|
|
2243
|
+
}
|
|
2115
2244
|
const stubData = result.data;
|
|
2116
2245
|
if (attachTask &&
|
|
2117
2246
|
result.status === 'ok' &&
|
|
@@ -2372,8 +2501,11 @@ function registerToolCommand(parentProgram, tool, clientFactory, vdProjectIdDefa
|
|
|
2372
2501
|
sub.addHelpText('after', `\nExample: ${view.example}`);
|
|
2373
2502
|
}
|
|
2374
2503
|
const parameterNames = tool.name === 'aidrive'
|
|
2375
|
-
? Object.keys(props).filter(name => name !== tool.cli.primary_arg)
|
|
2504
|
+
? Object.keys(props).filter(name => name !== tool.cli.primary_arg)
|
|
2505
|
+
: view.parameters;
|
|
2376
2506
|
for (const paramName of parameterNames) {
|
|
2507
|
+
if (tool.name === 'aidrive' && paramName === 'workspace')
|
|
2508
|
+
continue;
|
|
2377
2509
|
addSchemaOption(sub, paramName, props[paramName], {
|
|
2378
2510
|
// Same relaxation as the union path: with --args-file on the
|
|
2379
2511
|
// command line, required params may live in the file, which
|
|
@@ -2389,10 +2521,12 @@ function registerToolCommand(parentProgram, tool, clientFactory, vdProjectIdDefa
|
|
|
2389
2521
|
});
|
|
2390
2522
|
}
|
|
2391
2523
|
if (tool.name === 'aidrive') {
|
|
2392
|
-
addAidriveLocalOptions(sub,
|
|
2524
|
+
addAidriveLocalOptions(sub, view.name);
|
|
2393
2525
|
const localFlags = view.name === 'upload'
|
|
2394
2526
|
? ['local_file', 'override', 'on-conflict']
|
|
2395
|
-
: view.name === 'download'
|
|
2527
|
+
: view.name === 'download'
|
|
2528
|
+
? ['local_file']
|
|
2529
|
+
: [];
|
|
2396
2530
|
for (const option of sub.options) {
|
|
2397
2531
|
const name = option.long?.slice(2) ?? '';
|
|
2398
2532
|
if (!view.parameters.includes(name) && !localFlags.includes(name))
|
|
@@ -2418,6 +2552,10 @@ function registerToolCommand(parentProgram, tool, clientFactory, vdProjectIdDefa
|
|
|
2418
2552
|
if (tool.name === 'genteam' && view.name === 'download') {
|
|
2419
2553
|
sub.option('--local_file <path>', GENTEAM_DOWNLOAD_LOCAL_FILE_HELP);
|
|
2420
2554
|
}
|
|
2555
|
+
if (tool.name === 'sb-box' &&
|
|
2556
|
+
(SANDBOX_ACTIONS.has(view.name) || view.name === 'create')) {
|
|
2557
|
+
sub.option('--session <key>', SB_BOX_SESSION_HELP);
|
|
2558
|
+
}
|
|
2421
2559
|
addGlobalPassthroughOptions(sub, props);
|
|
2422
2560
|
sub.action((opts) => runToolInvocation(view.name, opts, sub));
|
|
2423
2561
|
}
|
|
@@ -3415,7 +3553,8 @@ async function main() {
|
|
|
3415
3553
|
return;
|
|
3416
3554
|
}
|
|
3417
3555
|
if (['project', 'preflight'].includes(localRoute.command || '') ||
|
|
3418
|
-
(localRoute.command === 'hosted' &&
|
|
3556
|
+
(localRoute.command === 'hosted' &&
|
|
3557
|
+
localRoute.subcommand === 'deploy-local')) {
|
|
3419
3558
|
finalizeGlobalPassthrough();
|
|
3420
3559
|
await program.parseAsync();
|
|
3421
3560
|
return;
|
|
@@ -3574,6 +3713,14 @@ async function main() {
|
|
|
3574
3713
|
const legacyGroupForm = Boolean(hasPath && tool.cli.group);
|
|
3575
3714
|
const legacyTopLevel = Boolean(tool.cli.legacy_top_level && (tool.cli.group || hasPath));
|
|
3576
3715
|
const hasLegacyForms = legacyGroupForm || legacyTopLevel;
|
|
3716
|
+
// A renamed command's old tool: the whole command is the legacy form.
|
|
3717
|
+
if (tool.cli.deprecated_for) {
|
|
3718
|
+
registerToolCommand(program, tool, createClient, vdProjectId, {
|
|
3719
|
+
hidden: true,
|
|
3720
|
+
deprecated: { replacement: tool.cli.deprecated_for },
|
|
3721
|
+
});
|
|
3722
|
+
continue;
|
|
3723
|
+
}
|
|
3577
3724
|
// When legacy forms exist, the alias names belong to the hidden flat
|
|
3578
3725
|
// command, not the canonical form.
|
|
3579
3726
|
registerToolCommand(program, hasLegacyForms ? { ...tool, cli: { ...tool.cli, aliases: [] } } : tool, createClient, vdProjectId);
|