@genspark/cli 1.15.1-beta.1 → 1.15.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.
- package/README.md +67 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +7 -1
- package/dist/client.js.map +1 -1
- package/dist/commands/aidrive-upload.d.ts.map +1 -1
- package/dist/commands/aidrive-upload.js +6 -1
- package/dist/commands/aidrive-upload.js.map +1 -1
- package/dist/commands/brain-evidence-reader.d.ts +5 -0
- package/dist/commands/brain-evidence-reader.d.ts.map +1 -0
- package/dist/commands/brain-evidence-reader.js +75 -0
- package/dist/commands/brain-evidence-reader.js.map +1 -0
- package/dist/commands/brain-evidence.d.ts +22 -0
- package/dist/commands/brain-evidence.d.ts.map +1 -0
- package/dist/commands/brain-evidence.js +151 -0
- package/dist/commands/brain-evidence.js.map +1 -0
- package/dist/commands/task-status-follow.d.ts +8 -0
- package/dist/commands/task-status-follow.d.ts.map +1 -0
- package/dist/commands/task-status-follow.js +101 -0
- package/dist/commands/task-status-follow.js.map +1 -0
- package/dist/config.d.ts +23 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +59 -0
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +111 -12
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/skills/gsk-aidrive/SKILL.md +3 -3
package/dist/index.js
CHANGED
|
@@ -22,6 +22,9 @@ import { resolveUploadFilePaths } from './file-path-uploads.js';
|
|
|
22
22
|
import { Command, CommanderError, InvalidArgumentError, Option, } from 'commander';
|
|
23
23
|
import { resolveProjectSelection } from './project-binding.js';
|
|
24
24
|
import { registerDeveloperCommands } from './commands/developer-project.js';
|
|
25
|
+
import { addBrainEvidenceOptions, attachBrainEvidence, checkEvidenceDestination, saveBrainEvidence, } from './commands/brain-evidence.js';
|
|
26
|
+
import { registerBrainEvidenceCommand } from './commands/brain-evidence-reader.js';
|
|
27
|
+
import { followTaskStatus, parseWaitSeconds, } from './commands/task-status-follow.js';
|
|
25
28
|
import { localCommandRoute } from './commands/local-command-routing.js';
|
|
26
29
|
import { localServiceUrl, parseLocalPort } from './commands/local-preview.js';
|
|
27
30
|
import { registerHostedLocalCommand } from './commands/hosted-local.js';
|
|
@@ -42,7 +45,7 @@ import { runInteractiveApprovalFlow, shouldPromptForApproval, } from './pendingA
|
|
|
42
45
|
import { isPendingConfirmationEnvelope, LEGACY_SKIP_PARAMS, runPreCallConfirmation, STALE_SCHEMA_CACHE_MESSAGE, } from './confirm.js';
|
|
43
46
|
import { repairJsonArrayArgs } from './arrayArgs.js';
|
|
44
47
|
import { parseJsonObjectArgs } from './object-args.js';
|
|
45
|
-
import { clearToolsCache, getCachedFeatures, loadConfigFile, getConfigPath, loadToolsCache, normalizeBaseUrl, resolveCredentialPair, saveToolsCache, setConfigPathOverride, updateConfigFile, } from './config.js';
|
|
48
|
+
import { clearToolsCache, getCachedFeatures, loadConfigFile, getConfigPath, loadToolsCache, normalizeBaseUrl, resolveCredentialPair, resolveSbRuntimeCredential, saveToolsCache, setConfigPathOverride, updateConfigFile, } from './config.js';
|
|
46
49
|
import { checkForUpdates } from './updater.js';
|
|
47
50
|
import { addRegisteredCommands, collectToolCommandTokens, staleCacheMissingToken, } from './staleCache.js';
|
|
48
51
|
import { shimLegacyTaskInvocation } from './task-shim.js';
|
|
@@ -310,7 +313,11 @@ function getGlobalOptions() {
|
|
|
310
313
|
const opts = { ...program.opts(), ...activePassthroughOpts };
|
|
311
314
|
// API key and base URL resolve as one pair (#70209) — see the precedence
|
|
312
315
|
// table in config.ts.
|
|
313
|
-
|
|
316
|
+
// A Second Brain chat turn on the runtime-Passport CLI lane: the managed
|
|
317
|
+
// file's pair, read now (renewal lands on the next call). An explicit
|
|
318
|
+
// --api-key still wins (the user chose a credential).
|
|
319
|
+
const sbRuntime = opts.apiKey ? undefined : resolveSbRuntimeCredential();
|
|
320
|
+
const normal = resolveCredentialPair({
|
|
314
321
|
cliApiKey: opts.apiKey,
|
|
315
322
|
cliBaseUrl: program.getOptionValueSource('baseUrl') === 'cli'
|
|
316
323
|
? opts.baseUrl
|
|
@@ -322,6 +329,7 @@ function getGlobalOptions() {
|
|
|
322
329
|
file: { apiKey: fileConfig.api_key, baseUrl: fileConfig.base_url },
|
|
323
330
|
defaultBaseUrl: DEFAULT_BASE_URL,
|
|
324
331
|
});
|
|
332
|
+
const { apiKey, baseUrl } = sbRuntime ?? normal;
|
|
325
333
|
// Timeout priority: CLI > config file > default
|
|
326
334
|
const timeout = opts.timeout !== String(DEFAULT_TIMEOUT)
|
|
327
335
|
? parseInt(opts.timeout, 10)
|
|
@@ -330,7 +338,9 @@ function getGlobalOptions() {
|
|
|
330
338
|
const debugMode = opts.debug || fileConfig.debug || false;
|
|
331
339
|
// Project ID priority: CLI > env > nearest checkout binding > global config.
|
|
332
340
|
const projectId = resolveProjectSelection({
|
|
333
|
-
|
|
341
|
+
// The logical server: a runtime-Passport call is routed to the sbx
|
|
342
|
+
// gateway origin, but a checkout binding names the server it stands in for.
|
|
343
|
+
baseUrl: normal.baseUrl,
|
|
334
344
|
explicit: opts.projectId,
|
|
335
345
|
environment: process.env.GSK_PROJECT_ID,
|
|
336
346
|
legacy: fileConfig.project_id,
|
|
@@ -1145,6 +1155,14 @@ function registerToolCommand(parentProgram, tool, clientFactory, vdProjectIdDefa
|
|
|
1145
1155
|
// In per-action subcommand mode the subcommands own the flag — on the
|
|
1146
1156
|
// parent it would be consumed pre-dispatch and lost (see actionViews).
|
|
1147
1157
|
const outputFileKeys = tool.cli.output_file_keys || [];
|
|
1158
|
+
if (tool.name === 'team-brain') {
|
|
1159
|
+
addBrainEvidenceOptions(cmd);
|
|
1160
|
+
registerBrainEvidenceCommand(cmd, output);
|
|
1161
|
+
}
|
|
1162
|
+
if (tool.name === 'task_status') {
|
|
1163
|
+
cmd.option('--follow', 'Follow data.state until terminal or the wait budget expires; never resubmit', false);
|
|
1164
|
+
cmd.option('--wait-seconds <seconds>', 'Wait budget with --follow (0..60, default 45)');
|
|
1165
|
+
}
|
|
1148
1166
|
if (outputFileKeys.length > 0 && !actionViews) {
|
|
1149
1167
|
cmd.option('-o, --output-file <path>', 'Download the generated file to a local path');
|
|
1150
1168
|
}
|
|
@@ -1157,6 +1175,8 @@ function registerToolCommand(parentProgram, tool, clientFactory, vdProjectIdDefa
|
|
|
1157
1175
|
}
|
|
1158
1176
|
// For create_task, add --acp flag to enter ACP stdio bridge mode
|
|
1159
1177
|
if (tool.name === 'create_task') {
|
|
1178
|
+
cmd.option('--evidence-file <path>', 'Attach saved Team Brain retrieval JSON with full versioned citations');
|
|
1179
|
+
cmd.option('--evidence-sources <ids>', 'Only attach these comma-separated source ids from --evidence-file');
|
|
1160
1180
|
cmd.option('--acp', 'Start as ACP (Agent Client Protocol) stdio agent instead of one-shot execution', false);
|
|
1161
1181
|
cmd.option('--follow', 'After the async submit, follow the durable run live (SSE) and exit with the terminal result', false);
|
|
1162
1182
|
cmd.option('-o, --output-file <path>', 'Export the artifact (pptx/docx/xlsx) to a local file after task completes');
|
|
@@ -1306,13 +1326,10 @@ function registerToolCommand(parentProgram, tool, clientFactory, vdProjectIdDefa
|
|
|
1306
1326
|
// Skipped when --args-file is present — required params may live in
|
|
1307
1327
|
// the file, and the post-merge revalidation below enforces them.
|
|
1308
1328
|
if (tool.name === 'create_task' && !opts.argsFile) {
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
logError(`Missing required option: --${reqParam}`);
|
|
1314
|
-
process.exit(1);
|
|
1315
|
-
}
|
|
1329
|
+
const missing = required.filter(name => name !== tool.cli.primary_arg && opts[name] == null);
|
|
1330
|
+
if (missing.length) {
|
|
1331
|
+
logError(`Missing required options: ${missing.map(name => `--${name}`).join(', ')}. Run gsk task create --help. Nothing was submitted.`);
|
|
1332
|
+
process.exit(1);
|
|
1316
1333
|
}
|
|
1317
1334
|
}
|
|
1318
1335
|
const client = clientFactory();
|
|
@@ -1343,7 +1360,41 @@ function registerToolCommand(parentProgram, tool, clientFactory, vdProjectIdDefa
|
|
|
1343
1360
|
// -o exports an artifact of the FINISHED project — an async submit
|
|
1344
1361
|
// stub has nothing to export yet, so an export request implies the
|
|
1345
1362
|
// live follow.
|
|
1346
|
-
const attachTask = !!opts.follow || !!outputFilePath;
|
|
1363
|
+
const attachTask = tool.name !== 'task_status' && (!!opts.follow || !!outputFilePath);
|
|
1364
|
+
const followStatus = tool.name === 'task_status' && !!opts.follow;
|
|
1365
|
+
const waitSeconds = tool.name === 'task_status' ? parseWaitSeconds(opts.waitSeconds) : 0;
|
|
1366
|
+
if (tool.name === 'task_status' &&
|
|
1367
|
+
opts.waitSeconds !== undefined &&
|
|
1368
|
+
!followStatus) {
|
|
1369
|
+
throw new Error('--wait-seconds requires --follow.');
|
|
1370
|
+
}
|
|
1371
|
+
if (tool.name === 'task_status')
|
|
1372
|
+
delete opts.waitSeconds;
|
|
1373
|
+
const saveEvidencePath = tool.name === 'team-brain'
|
|
1374
|
+
? (opts.saveEvidence ?? cmd.opts().saveEvidence)
|
|
1375
|
+
: undefined;
|
|
1376
|
+
const evidenceFile = tool.name === 'create_task'
|
|
1377
|
+
? opts.evidenceFile
|
|
1378
|
+
: undefined;
|
|
1379
|
+
const evidenceSources = tool.name === 'create_task'
|
|
1380
|
+
? opts.evidenceSources
|
|
1381
|
+
: undefined;
|
|
1382
|
+
if (tool.name === 'team-brain')
|
|
1383
|
+
delete opts.saveEvidence;
|
|
1384
|
+
if (tool.name === 'create_task') {
|
|
1385
|
+
delete opts.evidenceFile;
|
|
1386
|
+
delete opts.evidenceSources;
|
|
1387
|
+
}
|
|
1388
|
+
for (const [flag, value] of [
|
|
1389
|
+
['--save-evidence', saveEvidencePath],
|
|
1390
|
+
['--evidence-file', evidenceFile],
|
|
1391
|
+
]) {
|
|
1392
|
+
if (value !== undefined && !value.trim())
|
|
1393
|
+
throw new Error(`${flag} requires a non-empty file path. Nothing was sent.`);
|
|
1394
|
+
}
|
|
1395
|
+
if (evidenceSources !== undefined && !evidenceFile) {
|
|
1396
|
+
throw new Error('--evidence-sources requires --evidence-file.');
|
|
1397
|
+
}
|
|
1347
1398
|
delete opts.follow; // client-side only
|
|
1348
1399
|
delete opts.sessionId; // get-project flag is client-side only
|
|
1349
1400
|
// In per-action subcommand mode the PARENT registers --args-file
|
|
@@ -2224,6 +2275,18 @@ function registerToolCommand(parentProgram, tool, clientFactory, vdProjectIdDefa
|
|
|
2224
2275
|
}
|
|
2225
2276
|
}
|
|
2226
2277
|
}
|
|
2278
|
+
if (saveEvidencePath &&
|
|
2279
|
+
!['ask', 'ask-public'].includes(String(args.action))) {
|
|
2280
|
+
throw new Error('--save-evidence is only available for team-brain ask and ask-public.');
|
|
2281
|
+
}
|
|
2282
|
+
if (saveEvidencePath && args.mode === 'answer') {
|
|
2283
|
+
throw new Error('--save-evidence requires retrieval mode. Nothing was queried.');
|
|
2284
|
+
}
|
|
2285
|
+
if (saveEvidencePath)
|
|
2286
|
+
await checkEvidenceDestination(saveEvidencePath);
|
|
2287
|
+
if (evidenceFile) {
|
|
2288
|
+
await attachBrainEvidence(args, evidenceFile, evidenceSources);
|
|
2289
|
+
}
|
|
2227
2290
|
// Resolve local file paths to uploaded URLs
|
|
2228
2291
|
// The drive's --url is the Drive link an entry is addressed by.
|
|
2229
2292
|
const uploadArgs = await resolveUploadFilePaths(args, tool.parameters.properties, source => resolveFileArg(source, client));
|
|
@@ -2233,13 +2296,35 @@ function registerToolCommand(parentProgram, tool, clientFactory, vdProjectIdDefa
|
|
|
2233
2296
|
// run_id, stream_url}) unless `--wait true` was passed. --attach
|
|
2234
2297
|
// upgrades the stub into a live SSE follow that exits with the
|
|
2235
2298
|
// run's terminal result — the work still executes server-side.
|
|
2236
|
-
|
|
2299
|
+
const statusWaitStarted = performance.now();
|
|
2300
|
+
const executionClient = followStatus
|
|
2301
|
+
? new ApiClient({
|
|
2302
|
+
...client.getOptions(),
|
|
2303
|
+
timeout: Math.min(client.getOptions().timeout, (waitSeconds === 0 ? 60 : waitSeconds) * 1000),
|
|
2304
|
+
})
|
|
2305
|
+
: client;
|
|
2306
|
+
if (followStatus)
|
|
2307
|
+
executionClient.setInvokedAs('task status');
|
|
2308
|
+
let result = await executionClient.executeTool(tool.name, resolvedArgs,
|
|
2237
2309
|
// A paid render's task ids arrive mid-stream; on stderr at once, so
|
|
2238
2310
|
// a wait that is cut later still leaves the id in the render log.
|
|
2239
2311
|
msg => {
|
|
2240
2312
|
for (const line of mediaProgressLines(tool.name, msg))
|
|
2241
2313
|
info(line);
|
|
2242
2314
|
});
|
|
2315
|
+
if (followStatus) {
|
|
2316
|
+
result = await followTaskStatus(result, remainingMs => {
|
|
2317
|
+
const pollClient = new ApiClient({
|
|
2318
|
+
...client.getOptions(),
|
|
2319
|
+
timeout: Math.min(client.getOptions().timeout, Math.max(1, Math.ceil(remainingMs))),
|
|
2320
|
+
});
|
|
2321
|
+
pollClient.setInvokedAs('task status');
|
|
2322
|
+
return pollClient.executeTool(tool.name, resolvedArgs);
|
|
2323
|
+
}, Math.max(0, waitSeconds - (performance.now() - statusWaitStarted) / 1000), info);
|
|
2324
|
+
}
|
|
2325
|
+
if (saveEvidencePath) {
|
|
2326
|
+
result = await saveBrainEvidence(saveEvidencePath, result);
|
|
2327
|
+
}
|
|
2243
2328
|
if (sbBoxSession && sbBoxStore) {
|
|
2244
2329
|
afterSessionCall({
|
|
2245
2330
|
key: sbBoxSession,
|
|
@@ -2560,6 +2645,10 @@ function registerToolCommand(parentProgram, tool, clientFactory, vdProjectIdDefa
|
|
|
2560
2645
|
if (tool.name === 'genteam' && view.name === 'download') {
|
|
2561
2646
|
sub.option('--local_file <path>', GENTEAM_DOWNLOAD_LOCAL_FILE_HELP);
|
|
2562
2647
|
}
|
|
2648
|
+
if (tool.name === 'team-brain' &&
|
|
2649
|
+
['ask', 'ask-public'].includes(view.name)) {
|
|
2650
|
+
addBrainEvidenceOptions(sub);
|
|
2651
|
+
}
|
|
2563
2652
|
if (tool.name === 'sb-box' &&
|
|
2564
2653
|
(SANDBOX_ACTIONS.has(view.name) || view.name === 'create')) {
|
|
2565
2654
|
sub.option('--session <key>', SB_BOX_SESSION_HELP);
|
|
@@ -3529,6 +3618,16 @@ taskCmd
|
|
|
3529
3618
|
// ============================================
|
|
3530
3619
|
async function main() {
|
|
3531
3620
|
const localRoute = localCommandRoute(process.argv.slice(2));
|
|
3621
|
+
if (localRoute.command === 'team-brain' &&
|
|
3622
|
+
localRoute.subcommand === 'evidence') {
|
|
3623
|
+
registerBrainEvidenceCommand(program.command('team-brain'), result => {
|
|
3624
|
+
setOutputFormat(program.opts().output);
|
|
3625
|
+
output(result);
|
|
3626
|
+
});
|
|
3627
|
+
finalizeGlobalPassthrough();
|
|
3628
|
+
await program.parseAsync();
|
|
3629
|
+
return;
|
|
3630
|
+
}
|
|
3532
3631
|
if (localRoute.local &&
|
|
3533
3632
|
['service-url', 'get_service_url'].includes(localRoute.command || '')) {
|
|
3534
3633
|
program.exitOverride();
|