@genspark/cli 1.15.4 → 1.15.5

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 (47) hide show
  1. package/README.md +31 -11
  2. package/dist/acp-serve.d.ts +2 -2
  3. package/dist/acp-serve.d.ts.map +1 -1
  4. package/dist/acp-serve.js +7 -2
  5. package/dist/acp-serve.js.map +1 -1
  6. package/dist/client.d.ts +5 -0
  7. package/dist/client.d.ts.map +1 -1
  8. package/dist/client.js +23 -12
  9. package/dist/client.js.map +1 -1
  10. package/dist/commands/aidrive-contract.generated.d.ts.map +1 -1
  11. package/dist/commands/aidrive-contract.generated.js +21 -2
  12. package/dist/commands/aidrive-contract.generated.js.map +1 -1
  13. package/dist/commands/task-status-follow.d.ts +9 -0
  14. package/dist/commands/task-status-follow.d.ts.map +1 -1
  15. package/dist/commands/task-status-follow.js +24 -4
  16. package/dist/commands/task-status-follow.js.map +1 -1
  17. package/dist/confirm.d.ts.map +1 -1
  18. package/dist/confirm.js +18 -1
  19. package/dist/confirm.js.map +1 -1
  20. package/dist/humanApproval.d.ts +48 -0
  21. package/dist/humanApproval.d.ts.map +1 -0
  22. package/dist/humanApproval.js +86 -0
  23. package/dist/humanApproval.js.map +1 -0
  24. package/dist/index.js +88 -21
  25. package/dist/index.js.map +1 -1
  26. package/dist/mediaSummary.d.ts.map +1 -1
  27. package/dist/mediaSummary.js +4 -1
  28. package/dist/mediaSummary.js.map +1 -1
  29. package/dist/task-shim.d.ts +11 -2
  30. package/dist/task-shim.d.ts.map +1 -1
  31. package/dist/task-shim.js +21 -2
  32. package/dist/task-shim.js.map +1 -1
  33. package/docs/skills.md +1 -1
  34. package/gated-skills/gsk-issue/SKILL.md +7 -0
  35. package/gated-skills/gsk-m365-apps/SKILL.md +197 -0
  36. package/gated-skills/gsk-m365-apps/references/add-genspark-ai.md +399 -0
  37. package/gated-skills/gsk-m365-apps/scripts/install-genspark-connector.mjs +548 -0
  38. package/gated-skills/gsk-m365-apps/scripts/sync-microsoft-guidance.mjs +557 -0
  39. package/package.json +1 -1
  40. package/skills/gsk-aidrive/SKILL.md +14 -2
  41. package/skills/gsk-aidrive/command-reference.md +13 -3
  42. package/skills/gsk-image-generation/SKILL.md +6 -3
  43. package/skills/gsk-phone-call/SKILL.md +33 -13
  44. package/skills/gsk-second-brain/SKILL.md +2 -2
  45. package/skills/gsk-slack/SKILL.md +4 -1
  46. package/skills/gsk-team-brain/SKILL.md +89 -22
  47. package/skills/gsk-video-generation/SKILL.md +3 -3
package/dist/index.js CHANGED
@@ -24,7 +24,7 @@ import { resolveProjectSelection } from './project-binding.js';
24
24
  import { registerDeveloperCommands } from './commands/developer-project.js';
25
25
  import { addBrainEvidenceOptions, attachBrainEvidence, checkEvidenceDestination, saveBrainEvidence, } from './commands/brain-evidence.js';
26
26
  import { registerBrainEvidenceCommand } from './commands/brain-evidence-reader.js';
27
- import { followTaskStatus, parseWaitSeconds, } from './commands/task-status-follow.js';
27
+ import { followTaskStatus, parseWaitSeconds, settleTerminalState, } from './commands/task-status-follow.js';
28
28
  import { localCommandRoute } from './commands/local-command-routing.js';
29
29
  import { localServiceUrl, parseLocalPort } from './commands/local-preview.js';
30
30
  import { registerHostedLocalCommand } from './commands/hosted-local.js';
@@ -41,13 +41,14 @@ import { tokenPassHeaders } from './native-waf.js';
41
41
  import { classifyFileArg, awaitLocalFileReady, decideAfterWait, localFileNotReadyError, passthroughWarning, urlsParamItems, } from './localFiles.js';
42
42
  import { setDebugEnabled, setOutputFormat, debug, info, warn, error as logError, output, progress, } from './logger.js';
43
43
  import { runInteractiveApprovalFlow, shouldPromptForApproval, } from './pendingApproval.js';
44
+ import { approvalWaitSeconds, extractHumanApproval, waitForHumanApproval, } from './humanApproval.js';
44
45
  import { isPendingConfirmationEnvelope, LEGACY_SKIP_PARAMS, runPreCallConfirmation, STALE_SCHEMA_CACHE_MESSAGE, } from './confirm.js';
45
46
  import { repairJsonArrayArgs } from './arrayArgs.js';
46
47
  import { parseJsonObjectArgs } from './object-args.js';
47
48
  import { clearToolsCache, getCachedFeatures, loadConfigFile, getConfigPath, loadToolsCache, normalizeBaseUrl, resolveCredentialPair, resolveSbRuntimeCredential, saveToolsCache, setConfigPathOverride, updateConfigFile, } from './config.js';
48
49
  import { checkForUpdates } from './updater.js';
49
50
  import { addRegisteredCommands, collectToolCommandTokens, staleCacheMissingToken, } from './staleCache.js';
50
- import { shimLegacyTaskInvocation } from './task-shim.js';
51
+ import { legacyTaskInvokedAs, shimLegacyTaskInvocation } from './task-shim.js';
51
52
  import { getSandboxRuntime } from './runtime.js';
52
53
  import { registerDesignCommand } from './commands/design.js';
53
54
  import { collectUploadFiles, aidriveUploadHeaders, buildAidriveUploadQuery, mergeShareIntoUpload, normalizeUploadDestination, resolveAidriveUploadOperands, shareArgsFromUpload, uploadConflictFromCli, uploadConflictProblem, uploadPathForDestination, uploadShareRefusal, } from './commands/aidrive-upload.js';
@@ -63,6 +64,10 @@ import { registerMeshCommand, getMeshInvocation, runMesh, } from './commands/mes
63
64
  import { executeCloneUrl, normalizeCloneUrlForGit, } from './commands/sb-git-clone.js';
64
65
  import { afterSessionCall, bindSession, resolveSessionKey, SANDBOX_ACTIONS, SessionError, SessionStore, SESSION_ENV, } from './commands/sb-box-session.js';
65
66
  import { actionScopedDescription, serviceActionViews, } from './serviceActions.js';
67
+ // Set at startup when the pre-tree `gsk task <type>` shim rewrote argv:
68
+ // the label the caller's form maps to, sent as X-GSK-Invoked-As on the
69
+ // resulting task-create request so the server can count the shim path.
70
+ let legacyTaskInvocation;
66
71
  const require = createRequire(import.meta.url);
67
72
  const { version: VERSION } = require('../package.json');
68
73
  const DEFAULT_BASE_URL = 'https://www.genspark.ai';
@@ -1292,12 +1297,13 @@ function registerToolCommand(parentProgram, tool, clientFactory, vdProjectIdDefa
1292
1297
  if (tool.name === 'create_task' && opts.acp) {
1293
1298
  const taskType = primaryArgValue;
1294
1299
  if (!taskType) {
1295
- logError('Task type is required for ACP mode. Usage: gsk task <type> --acp');
1300
+ logError('Task type is required for ACP mode. ' +
1301
+ 'Usage: gsk task create <type> --acp');
1296
1302
  process.exit(1);
1297
1303
  }
1298
1304
  delete opts.acp;
1299
1305
  const { startAcpBridge } = await import('./acp-serve.js');
1300
- await startAcpBridge(taskType, clientFactory().getOptions());
1306
+ await startAcpBridge(taskType, clientFactory().getOptions(), legacyTaskInvocation);
1301
1307
  return;
1302
1308
  }
1303
1309
  // For create_task (non-ACP): validate required params manually.
@@ -1325,11 +1331,17 @@ function registerToolCommand(parentProgram, tool, clientFactory, vdProjectIdDefa
1325
1331
  client.setInvokedAs(`${legacyName} (legacy)`);
1326
1332
  }
1327
1333
  else {
1328
- client.setInvokedAs(tool.cli.path && tool.cli.path.length >= 2
1334
+ const canonicalForm = tool.cli.path && tool.cli.path.length >= 2
1329
1335
  ? tool.cli.path.join(' ')
1330
1336
  : tool.cli.group
1331
1337
  ? `${tool.cli.group} ${cmdName}`
1332
- : cmdName);
1338
+ : cmdName;
1339
+ // A `task create` the pre-tree shim produced is tagged with the
1340
+ // form the caller typed, so the deprecation telemetry counts the
1341
+ // shim path (#49618).
1342
+ client.setInvokedAs(canonicalForm === 'task create' && legacyTaskInvocation
1343
+ ? legacyTaskInvocation
1344
+ : canonicalForm);
1333
1345
  }
1334
1346
  // Extract and remove client-side-only options before sending to API
1335
1347
  const outputFilePath = opts.outputFile;
@@ -2284,6 +2296,11 @@ function registerToolCommand(parentProgram, tool, clientFactory, vdProjectIdDefa
2284
2296
  return pollClient.executeTool(tool.name, resolvedArgs);
2285
2297
  }, Math.max(0, waitSeconds - (performance.now() - statusWaitStarted) / 1000), info);
2286
2298
  }
2299
+ else if (tool.name === 'task_status') {
2300
+ // One exit contract for both read shapes: a plain status read of
2301
+ // a canceled / failed run exits non-zero exactly like --follow.
2302
+ result = settleTerminalState(result);
2303
+ }
2287
2304
  if (saveEvidencePath) {
2288
2305
  result = await saveBrainEvidence(saveEvidencePath, result);
2289
2306
  }
@@ -2320,6 +2337,19 @@ function registerToolCommand(parentProgram, tool, clientFactory, vdProjectIdDefa
2320
2337
  },
2321
2338
  };
2322
2339
  }
2340
+ // An agent-held token's send outside the org waits for the user's
2341
+ // approval in Genspark (#66416): wait a bounded time, then re-issue
2342
+ // the identical call once they decided.
2343
+ const humanApproval = extractHumanApproval(result);
2344
+ if (humanApproval) {
2345
+ result = await waitForHumanApproval(result, humanApproval, approvalWaitSeconds(process.env.GSK_APPROVAL_WAIT_SECONDS), {
2346
+ pollState: () => client.getAgentApprovalState(humanApproval.id),
2347
+ rerun: () => client.executeTool(tool.name, resolvedArgs),
2348
+ notify: info,
2349
+ sleep: ms => new Promise(resolve => setTimeout(resolve, ms)),
2350
+ nowMs: () => Date.now(),
2351
+ });
2352
+ }
2323
2353
  // Fail-safe: with the interactive-confirm contract active the
2324
2354
  // server should never pend — a pending envelope means the cached
2325
2355
  // schema predates this action's confirmation flag, so no prompt
@@ -3135,6 +3165,9 @@ const GATED_SKILLS = {
3135
3165
  // GenDesk issues (gk_gendesk_issue_cli). The doc tells the agent that
3136
3166
  // "my issues" means GenDesk, which is wrong for anyone without it.
3137
3167
  'gsk-issue': 'issue',
3168
+ // Microsoft 365 managed apps from GenCode (gk_m365_managed_apps): the
3169
+ // workflow, Microsoft's vendored plugin docs and the connector installer.
3170
+ 'gsk-m365-apps': 'm365',
3138
3171
  };
3139
3172
  /**
3140
3173
  * Copy each gated skill the caller may use and remove an earlier copy of one
@@ -3313,7 +3346,33 @@ ${skillList}
3313
3346
  fs.writeFileSync(contextPath, content);
3314
3347
  return true;
3315
3348
  }
3349
+ const PHONE_CALL_CONTACT_FLAGS = ['phone_number', 'contact_ref', 'contact_info'];
3350
+ const PHONE_CALL_CONTACT_USAGE = 'pass exactly one contact: --phone_number <number with country code> or ' +
3351
+ '--contact_ref <calllog: contact_ref | self>';
3352
+ // The contact field to send, named as the server expects it. Exits before
3353
+ // any request on a conflict or an absent contact; the deprecated alias is
3354
+ // forwarded as-is (the server classifies it by shape) with a warning.
3355
+ function phoneCallContactField(opts) {
3356
+ const given = PHONE_CALL_CONTACT_FLAGS.filter(flag => typeof opts[flag] === 'string' && opts[flag] !== '');
3357
+ if (given.length === 0) {
3358
+ logError(`A contact is required: ${PHONE_CALL_CONTACT_USAGE}`);
3359
+ process.exit(1);
3360
+ }
3361
+ if (given.length > 1) {
3362
+ logError(`Conflicting contact flags (${given.map(flag => `--${flag}`).join(', ')}): ` +
3363
+ PHONE_CALL_CONTACT_USAGE);
3364
+ process.exit(1);
3365
+ }
3366
+ const flag = given[0];
3367
+ if (flag === 'contact_info') {
3368
+ console.error('[DEPRECATED] --contact_info still works but is deprecated — use ' +
3369
+ '--phone_number for a phone number, or --contact_ref for a calllog: ' +
3370
+ 'contact_ref / self.');
3371
+ }
3372
+ return { [flag]: opts[flag] };
3373
+ }
3316
3374
  async function phoneCallAction(recipient, opts, invokedAs) {
3375
+ const contact = phoneCallContactField(opts);
3317
3376
  try {
3318
3377
  const client = createClient();
3319
3378
  client.setInvokedAs(invokedAs);
@@ -3326,7 +3385,7 @@ async function phoneCallAction(recipient, opts, invokedAs) {
3326
3385
  info('Dry run: validating prerequisites, contact and from_number...');
3327
3386
  const result = await client.requestStreaming('/phone_call/initiate', {
3328
3387
  recipient,
3329
- contact_info: opts.contact_info,
3388
+ ...contact,
3330
3389
  purpose: opts.purpose,
3331
3390
  mode: 'dry_run',
3332
3391
  from_number: opts.from_number,
@@ -3337,7 +3396,7 @@ async function phoneCallAction(recipient, opts, invokedAs) {
3337
3396
  if (contact) {
3338
3397
  info('Contact resolved:');
3339
3398
  info(` Name: ${contact.title || recipient}`);
3340
- info(` Phone: ${contact.phone || '(from place_id)'}`);
3399
+ info(` Phone: ${contact.phone || '(unknown)'}`);
3341
3400
  if (contact.address)
3342
3401
  info(` Address: ${contact.address}`);
3343
3402
  }
@@ -3358,7 +3417,7 @@ async function phoneCallAction(recipient, opts, invokedAs) {
3358
3417
  info('Dry run: validating prerequisites and resolving contact info...');
3359
3418
  const result = await client.executeTool('phone_call', {
3360
3419
  recipient,
3361
- contact_info: opts.contact_info,
3420
+ ...contact,
3362
3421
  purpose: opts.purpose,
3363
3422
  });
3364
3423
  if (result.status === 'ok' && result.session_state) {
@@ -3369,7 +3428,7 @@ async function phoneCallAction(recipient, opts, invokedAs) {
3369
3428
  info('');
3370
3429
  info('=== Contact Resolved ===');
3371
3430
  info(` Name: ${c.title || recipient}`);
3372
- info(` Phone: ${c.phone || '(from place_id)'}`);
3431
+ info(` Phone: ${c.phone || '(unknown)'}`);
3373
3432
  if (c.address)
3374
3433
  info(` Address: ${c.address}`);
3375
3434
  if (c.rating)
@@ -3388,7 +3447,7 @@ async function phoneCallAction(recipient, opts, invokedAs) {
3388
3447
  info('');
3389
3448
  const result = await client.requestStreaming('/phone_call/initiate', {
3390
3449
  recipient,
3391
- contact_info: opts.contact_info,
3450
+ ...contact,
3392
3451
  purpose: opts.purpose,
3393
3452
  mode: opts.async ? 'async' : 'sync',
3394
3453
  ...(opts.from_number ? { from_number: opts.from_number } : {}),
@@ -3400,7 +3459,7 @@ async function phoneCallAction(recipient, opts, invokedAs) {
3400
3459
  if (contact) {
3401
3460
  info('Contact resolved:');
3402
3461
  info(` Name: ${contact.title || recipient}`);
3403
- info(` Phone: ${contact.phone || '(from place_id)'}`);
3462
+ info(` Phone: ${contact.phone || '(unknown)'}`);
3404
3463
  if (contact.address)
3405
3464
  info(` Address: ${contact.address}`);
3406
3465
  }
@@ -3437,8 +3496,9 @@ async function phoneCallAction(recipient, opts, invokedAs) {
3437
3496
  info(isFailure ? '=== Call Failed ===' : '=== Call Complete ===');
3438
3497
  info(` Recipient: ${data.recipient || recipient}`);
3439
3498
  info(` Status: ${callStatus}`);
3440
- // duration_seconds is the real audio duration when the step recorded
3441
- // one (request wall-clock only as legacy fallback; see request_seconds).
3499
+ // duration_seconds is the real audio duration and is absent when no
3500
+ // call was placed (purpose rejected, pre-dial failure) — the request
3501
+ // wall-clock lives in request_seconds and is never printed as Duration.
3442
3502
  // 0.0 is a legitimate value (callee never reached) — check the type, or
3443
3503
  // JS falsiness hides the line exactly when the truthful zero matters.
3444
3504
  if (typeof data.duration_seconds === 'number')
@@ -3473,12 +3533,17 @@ async function phoneCallAction(recipient, opts, invokedAs) {
3473
3533
  function addPhoneCallOptions(cmd) {
3474
3534
  return cmd
3475
3535
  .argument('<recipient>', 'Name of the person or business to call')
3476
- .requiredOption('-c, --contact_info <value>', 'Phone number (e.g. +1-555-123-4567), calllog: contact_ref, or Google ' +
3477
- 'Maps place_id — the type is detected automatically')
3536
+ .option('-n, --phone_number <value>', 'Phone number in E.164 (+<country calling code><national number>; ' +
3537
+ 'a number without + and its country calling code is refused); ' +
3538
+ 'exactly one of --phone_number / --contact_ref')
3539
+ .option('-r, --contact_ref <value>', 'A calllog: contact_ref from `gsk telephony call log --view contacts`, ' +
3540
+ 'or `self` (your own verified number); exactly one of ' +
3541
+ '--phone_number / --contact_ref')
3542
+ .addOption(new Option('-c, --contact_info <value>', 'Deprecated: use --phone_number or --contact_ref').hideHelp())
3478
3543
  .requiredOption('-p, --purpose <value>', "Purpose of the call (e.g. 'Check reservation availability')")
3479
3544
  .option('--dry-run', 'Only validate and resolve contact info (and --from_number when ' +
3480
3545
  'given), do not initiate the call')
3481
- .option('--async', 'Return right after dialing starts; poll with `gsk telephony call status`, stop with `gsk telephony call hangup`')
3546
+ .option('--async', 'Return as soon as the call is dispatched, before the purpose review and the dial (call_status preparing); poll with `gsk telephony call status`, stop with `gsk telephony call hangup`')
3482
3547
  .option('--from_number <value>', 'Dial from this number (strict E.164, e.g. +14155550123) — one of ' +
3483
3548
  'your verified caller IDs or active purchased numbers');
3484
3549
  }
@@ -3493,9 +3558,9 @@ const telephonyCmd = program
3493
3558
  const telephonyCallCmd = telephonyCmd
3494
3559
  .command('call')
3495
3560
  .description('Make an AI phone call on your behalf, and inspect or control your calls (see subcommands).')
3496
- .addHelpText('after', '\nDialing is the default subcommand: `gsk telephony call <recipient> -c <number> -p <purpose>`.\n' +
3561
+ .addHelpText('after', '\nDialing is the default subcommand: `gsk telephony call <recipient> -n <number> -p <purpose>`.\n' +
3497
3562
  'If the recipient name collides with a subcommand word (status, log, ...), use the explicit form:\n' +
3498
- ' gsk telephony call dial <recipient> -c <number> -p <purpose>\n');
3563
+ ' gsk telephony call dial <recipient> -n <number> -p <purpose>\n');
3499
3564
  addPhoneCallOptions(telephonyCallCmd
3500
3565
  .command('dial', { isDefault: true })
3501
3566
  .description('Make an AI phone call on your behalf. Validates prerequisites, resolves contact info, and initiates the call. (default subcommand)')).action((recipient, opts) => phoneCallAction(recipient, opts, 'telephony call dial'));
@@ -3510,7 +3575,7 @@ const phoneCallCmd = program
3510
3575
  .alias('call-for-me')
3511
3576
  .description('[deprecated: use `gsk telephony call`] Make an AI phone call on your behalf, and inspect or control your calls (see subcommands).')
3512
3577
  .addHelpText('after', '\nDeprecated: use `gsk telephony call` instead.\n' +
3513
- 'Dialing is the default subcommand: `gsk phone-call <recipient> -c <number> -p <purpose>`.\n');
3578
+ 'Dialing is the default subcommand: `gsk phone-call <recipient> -n <number> -p <purpose>`.\n');
3514
3579
  addPhoneCallOptions(phoneCallCmd
3515
3580
  .command('dial', { isDefault: true })
3516
3581
  .description('[deprecated: use `gsk telephony call dial`] Make an AI phone call on your behalf. (default subcommand)')).action((recipient, opts) => {
@@ -3729,9 +3794,11 @@ async function main() {
3729
3794
  return;
3730
3795
  }
3731
3796
  // Pre-tree `gsk task <type>` compat (see shimLegacyTaskInvocation).
3797
+ const rawArgs = process.argv.slice(2);
3798
+ legacyTaskInvocation = legacyTaskInvokedAs(rawArgs);
3732
3799
  process.argv = [
3733
3800
  ...process.argv.slice(0, 2),
3734
- ...shimLegacyTaskInvocation(process.argv.slice(2)),
3801
+ ...shimLegacyTaskInvocation(rawArgs),
3735
3802
  ];
3736
3803
  // `gsk mesh ...` is a native-binary passthrough — intercept it before the
3737
3804
  // tool-fetch path and npm self-update gating (it needs neither). Handling it