cccc-sdk 0.1.4 → 0.4.4

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/dist/client.js CHANGED
@@ -4,6 +4,9 @@
4
4
  import { DaemonAPIError, IncompatibleDaemonError, ErrorCodes, } from './errors.js';
5
5
  import { isStreamEvent } from './types.js';
6
6
  import { discoverEndpoint, callDaemon, openEventsStream, readLines, } from './transport.js';
7
+ function compactRecord(input) {
8
+ return Object.fromEntries(Object.entries(input).filter(([, value]) => value !== undefined));
9
+ }
7
10
  /**
8
11
  * Client for communicating with the CCCC daemon over IPC (Unix socket or TCP).
9
12
  *
@@ -274,6 +277,8 @@ export class CCCCClient {
274
277
  command: options.command,
275
278
  env: options.env,
276
279
  env_private: options.envPrivate,
280
+ capability_autoload: options.capabilityAutoload,
281
+ profile_id: options.profileId,
277
282
  default_scope_key: options.defaultScopeKey,
278
283
  submit: options.submit,
279
284
  };
@@ -291,12 +296,17 @@ export class CCCCClient {
291
296
  * Update actor
292
297
  */
293
298
  async actorUpdate(options) {
294
- return this.call('actor_update', {
299
+ const args = {
295
300
  group_id: options.groupId,
296
301
  actor_id: options.actorId,
297
- patch: options.patch,
302
+ patch: options.patch ?? {},
298
303
  by: options.by ?? 'user',
299
- });
304
+ };
305
+ if (options.profileId != null)
306
+ args['profile_id'] = options.profileId;
307
+ if (options.profileAction != null)
308
+ args['profile_action'] = options.profileAction;
309
+ return this.call('actor_update', args);
300
310
  }
301
311
  /**
302
312
  * Remove actor
@@ -359,6 +369,280 @@ export class CCCCClient {
359
369
  args['unset'] = options.unset;
360
370
  return this.call('actor_env_private_update', args);
361
371
  }
372
+ /**
373
+ * List global actor profiles.
374
+ */
375
+ async actorProfileList(by = 'user') {
376
+ return this.call('actor_profile_list', { by });
377
+ }
378
+ /**
379
+ * Get one actor profile and current usage.
380
+ */
381
+ async actorProfileGet(profileId, by = 'user') {
382
+ return this.call('actor_profile_get', { profile_id: profileId, by });
383
+ }
384
+ /**
385
+ * Create/update one actor profile.
386
+ */
387
+ async actorProfileUpsert(options) {
388
+ const profile = { ...options.profile };
389
+ if ('capabilityDefaults' in profile) {
390
+ const rawDefaults = profile['capabilityDefaults'];
391
+ delete profile['capabilityDefaults'];
392
+ if (rawDefaults != null && typeof rawDefaults === 'object' && !Array.isArray(rawDefaults)) {
393
+ const defaults = rawDefaults;
394
+ profile['capability_defaults'] = {
395
+ ...(defaults['autoloadCapabilities'] !== undefined
396
+ ? { autoload_capabilities: defaults['autoloadCapabilities'] }
397
+ : {}),
398
+ ...(defaults['defaultScope'] !== undefined
399
+ ? { default_scope: defaults['defaultScope'] }
400
+ : {}),
401
+ ...(defaults['sessionTtlSeconds'] !== undefined
402
+ ? { session_ttl_seconds: defaults['sessionTtlSeconds'] }
403
+ : {}),
404
+ };
405
+ }
406
+ else {
407
+ profile['capability_defaults'] = rawDefaults;
408
+ }
409
+ }
410
+ const args = {
411
+ profile,
412
+ by: options.by ?? 'user',
413
+ };
414
+ if (options.expectedRevision !== undefined)
415
+ args['expected_revision'] = options.expectedRevision;
416
+ return this.call('actor_profile_upsert', args);
417
+ }
418
+ /**
419
+ * Delete one actor profile (rejected when still in use).
420
+ */
421
+ async actorProfileDelete(profileId, by = 'user', forceDetach = false) {
422
+ return this.call('actor_profile_delete', { profile_id: profileId, by, force_detach: forceDetach });
423
+ }
424
+ /**
425
+ * List profile-level secret keys and masked previews.
426
+ */
427
+ async actorProfileSecretKeys(profileId, by = 'user') {
428
+ return this.call('actor_profile_secret_keys', { profile_id: profileId, by });
429
+ }
430
+ /**
431
+ * Update profile-level private env.
432
+ */
433
+ async actorProfileSecretUpdate(options) {
434
+ const args = {
435
+ profile_id: options.profileId,
436
+ by: options.by ?? 'user',
437
+ clear: options.clear ?? false,
438
+ };
439
+ if (options.set)
440
+ args['set'] = options.set;
441
+ if (options.unset)
442
+ args['unset'] = options.unset;
443
+ return this.call('actor_profile_secret_update', args);
444
+ }
445
+ /**
446
+ * Copy one actor's runtime env (public + private) into a profile's private env.
447
+ */
448
+ async actorProfileSecretCopyFromActor(options) {
449
+ return this.call('actor_profile_secret_copy_from_actor', {
450
+ profile_id: options.profileId,
451
+ group_id: options.groupId,
452
+ actor_id: options.actorId,
453
+ by: options.by ?? 'user',
454
+ });
455
+ }
456
+ /**
457
+ * Copy one profile's secrets into another profile.
458
+ */
459
+ async actorProfileSecretCopyFromProfile(options) {
460
+ return this.call('actor_profile_secret_copy_from_profile', {
461
+ profile_id: options.profileId,
462
+ source_profile_id: options.sourceProfileId,
463
+ by: options.by ?? 'user',
464
+ });
465
+ }
466
+ // ============================================================
467
+ // Convenience methods: capabilities
468
+ // ============================================================
469
+ /**
470
+ * Read the global capability overview snapshot.
471
+ */
472
+ async capabilityOverview(options = {}) {
473
+ const args = {};
474
+ if (options.query)
475
+ args['query'] = options.query;
476
+ if (options.limit !== undefined)
477
+ args['limit'] = options.limit;
478
+ if (options.includeIndexed !== undefined)
479
+ args['include_indexed'] = options.includeIndexed;
480
+ return this.call('capability_overview', args);
481
+ }
482
+ /**
483
+ * Search the capability registry for one group/caller scope.
484
+ */
485
+ async capabilitySearch(options = {}) {
486
+ return this.call('capability_search', compactRecord({
487
+ group_id: options.groupId,
488
+ by: options.by,
489
+ actor_id: options.actorId,
490
+ query: options.query,
491
+ kind: options.kind,
492
+ source_id: options.sourceId,
493
+ trust_tier: options.trustTier,
494
+ qualification_status: options.qualificationStatus,
495
+ include_external: options.includeExternal,
496
+ limit: options.limit,
497
+ }));
498
+ }
499
+ /**
500
+ * Enable or disable a capability.
501
+ */
502
+ async capabilityEnable(options) {
503
+ return this.call('capability_enable', compactRecord({
504
+ group_id: options.groupId,
505
+ capability_id: options.capabilityId,
506
+ scope: options.scope,
507
+ enabled: options.enabled,
508
+ cleanup: options.cleanup,
509
+ by: options.by,
510
+ reason: options.reason,
511
+ ttl_seconds: options.ttlSeconds,
512
+ actor_id: options.actorId,
513
+ }));
514
+ }
515
+ /**
516
+ * Block or unblock a capability.
517
+ */
518
+ async capabilityBlock(options) {
519
+ const args = {
520
+ group_id: options.groupId,
521
+ capability_id: options.capabilityId,
522
+ scope: options.scope ?? 'group',
523
+ blocked: options.blocked ?? true,
524
+ by: options.by ?? 'user',
525
+ };
526
+ if (options.ttlSeconds !== undefined)
527
+ args['ttl_seconds'] = options.ttlSeconds;
528
+ if (options.reason)
529
+ args['reason'] = options.reason;
530
+ if (options.actorId)
531
+ args['actor_id'] = options.actorId;
532
+ return this.call('capability_block', args);
533
+ }
534
+ /**
535
+ * Read effective capability exposure for one caller scope.
536
+ */
537
+ async capabilityState(options = {}, actorId) {
538
+ const args = typeof options === 'string'
539
+ ? { group_id: options, actor_id: actorId }
540
+ : {
541
+ group_id: options.groupId,
542
+ by: options.by,
543
+ actor_id: options.actorId,
544
+ };
545
+ return this.call('capability_state', compactRecord(args));
546
+ }
547
+ /**
548
+ * Read capability allowlist default, overlay, and effective snapshots.
549
+ */
550
+ async capabilityAllowlistGet(options = {}) {
551
+ return this.call('capability_allowlist_get', {
552
+ by: options.by ?? 'user',
553
+ });
554
+ }
555
+ /**
556
+ * Dry-run capability allowlist overlay validation without persistence.
557
+ */
558
+ async capabilityAllowlistValidate(options = {}) {
559
+ const args = {
560
+ mode: options.mode ?? 'patch',
561
+ };
562
+ if (options.patch !== undefined)
563
+ args['patch'] = options.patch;
564
+ if (options.overlay !== undefined)
565
+ args['overlay'] = options.overlay;
566
+ return this.call('capability_allowlist_validate', args);
567
+ }
568
+ /**
569
+ * Persist capability allowlist overlay with optional optimistic concurrency.
570
+ */
571
+ async capabilityAllowlistUpdate(options = {}) {
572
+ const args = {
573
+ by: options.by ?? 'user',
574
+ mode: options.mode ?? 'patch',
575
+ };
576
+ if (options.expectedRevision)
577
+ args['expected_revision'] = options.expectedRevision;
578
+ if (options.patch !== undefined)
579
+ args['patch'] = options.patch;
580
+ if (options.overlay !== undefined)
581
+ args['overlay'] = options.overlay;
582
+ return this.call('capability_allowlist_update', args);
583
+ }
584
+ /**
585
+ * Reset capability allowlist overlay to empty/default state.
586
+ */
587
+ async capabilityAllowlistReset(options = {}) {
588
+ return this.call('capability_allowlist_reset', {
589
+ by: options.by ?? 'user',
590
+ });
591
+ }
592
+ /**
593
+ * Import one structured capability record, with optional readiness probe.
594
+ */
595
+ async capabilityImport(options) {
596
+ const args = {
597
+ group_id: options.groupId,
598
+ record: options.record,
599
+ by: options.by ?? 'user',
600
+ dry_run: options.dryRun ?? false,
601
+ };
602
+ if (options.actorId)
603
+ args['actor_id'] = options.actorId;
604
+ if (options.probe !== undefined)
605
+ args['probe'] = options.probe;
606
+ if (options.enableAfterImport !== undefined)
607
+ args['enable_after_import'] = options.enableAfterImport;
608
+ if (options.scope)
609
+ args['scope'] = options.scope;
610
+ if (options.ttlSeconds !== undefined)
611
+ args['ttl_seconds'] = options.ttlSeconds;
612
+ if (options.reason)
613
+ args['reason'] = options.reason;
614
+ return this.call('capability_import', args);
615
+ }
616
+ /**
617
+ * Uninstall a capability from the target group scope.
618
+ */
619
+ async capabilityUninstall(options) {
620
+ const args = {
621
+ group_id: options.groupId,
622
+ capability_id: options.capabilityId,
623
+ by: options.by ?? 'user',
624
+ };
625
+ if (options.reason)
626
+ args['reason'] = options.reason;
627
+ if (options.actorId)
628
+ args['actor_id'] = options.actorId;
629
+ return this.call('capability_uninstall', args);
630
+ }
631
+ /**
632
+ * Call one enabled dynamic capability tool through daemon IPC.
633
+ */
634
+ async capabilityToolCall(options) {
635
+ const args = {
636
+ group_id: options.groupId,
637
+ tool_name: options.toolName,
638
+ by: options.by ?? 'user',
639
+ };
640
+ if (options.arguments)
641
+ args['arguments'] = options.arguments;
642
+ if (options.actorId)
643
+ args['actor_id'] = options.actorId;
644
+ return this.call('capability_tool_call', args);
645
+ }
362
646
  // ============================================================
363
647
  // Convenience methods: messaging
364
648
  // ============================================================
@@ -399,6 +683,28 @@ export class CCCCClient {
399
683
  args['to'] = options.to;
400
684
  return this.call('send_cross_group', args);
401
685
  }
686
+ /**
687
+ * Create a durable task and send one linked visible message.
688
+ */
689
+ async trackedSend(options) {
690
+ const args = compactRecord({
691
+ group_id: options.groupId,
692
+ title: options.title,
693
+ text: options.text,
694
+ outcome: options.outcome,
695
+ assignee: options.assignee,
696
+ handoff_to: options.handoffTo,
697
+ waiting_on: options.waitingOn,
698
+ checklist: options.checklist,
699
+ notes: options.notes,
700
+ by: options.by ?? 'user',
701
+ to: options.to,
702
+ priority: options.priority ?? 'normal',
703
+ reply_required: options.replyRequired ?? true,
704
+ path: options.path,
705
+ });
706
+ return this.call('tracked_send', args);
707
+ }
402
708
  /**
403
709
  * Reply to a message.
404
710
  * @returns The created event and optional ack event.
@@ -438,17 +744,22 @@ export class CCCCClient {
438
744
  sinceTs: new Date().toISOString(),
439
745
  signal: options.signal,
440
746
  });
747
+ let nextItem = stream.next();
441
748
  // Now send the message
442
749
  const sendResult = await this.send(options);
443
750
  const sentEventId = sendResult.event.id;
444
751
  try {
445
- for await (const item of stream) {
752
+ while (true) {
446
753
  if (options.signal?.aborted) {
447
754
  throw new Error('sendAndWaitForReply aborted');
448
755
  }
449
756
  if (Date.now() > deadline) {
450
757
  throw new Error(`sendAndWaitForReply timed out after ${waitTimeout}ms`);
451
758
  }
759
+ const { value: item, done } = await nextItem;
760
+ if (done)
761
+ break;
762
+ nextItem = stream.next();
452
763
  if (isStreamEvent(item)) {
453
764
  const evt = item.event;
454
765
  if (evt.kind === 'chat.message') {
@@ -461,7 +772,7 @@ export class CCCCClient {
461
772
  }
462
773
  }
463
774
  finally {
464
- stream.return(undefined);
775
+ await stream.return(undefined);
465
776
  }
466
777
  throw new Error('sendAndWaitForReply: stream ended without reply');
467
778
  }
@@ -597,6 +908,375 @@ export class CCCCClient {
597
908
  dry_run: options.dryRun ?? false,
598
909
  });
599
910
  }
911
+ contextOp(groupId, op, by = 'system', dryRun = false) {
912
+ return this.contextSync({ groupId, by, dryRun, ops: [op] });
913
+ }
914
+ /** Update the shared coordination brief (Context Ops v3). */
915
+ async coordinationBriefUpdate(options) {
916
+ return this.contextOp(options.groupId, compactRecord({
917
+ op: 'coordination.brief.update',
918
+ objective: options.objective,
919
+ current_focus: options.currentFocus,
920
+ constraints: options.constraints,
921
+ project_brief: options.projectBrief,
922
+ project_brief_stale: options.projectBriefStale,
923
+ }), options.by, options.dryRun);
924
+ }
925
+ /** Add a compact coordination decision or handoff note. */
926
+ async coordinationNoteAdd(options) {
927
+ return this.contextOp(options.groupId, compactRecord({
928
+ op: 'coordination.note.add',
929
+ kind: options.kind,
930
+ summary: options.summary,
931
+ task_id: options.taskId,
932
+ }), options.by, options.dryRun);
933
+ }
934
+ /** Create a Context Ops v3 task. */
935
+ async taskCreate(options) {
936
+ return this.contextOp(options.groupId, compactRecord({
937
+ op: 'task.create',
938
+ title: options.title,
939
+ outcome: options.outcome,
940
+ status: options.status,
941
+ parent_id: options.parentId,
942
+ assignee: options.assignee,
943
+ priority: options.priority,
944
+ blocked_by: options.blockedBy,
945
+ waiting_on: options.waitingOn,
946
+ handoff_to: options.handoffTo,
947
+ task_type: options.taskType,
948
+ notes: options.notes,
949
+ checklist: options.checklist,
950
+ }), options.by, options.dryRun);
951
+ }
952
+ /** Update a Context Ops v3 task. */
953
+ async taskUpdate(options) {
954
+ return this.contextOp(options.groupId, compactRecord({
955
+ op: 'task.update',
956
+ task_id: options.taskId,
957
+ title: options.title,
958
+ outcome: options.outcome,
959
+ status: options.status,
960
+ assignee: options.assignee,
961
+ priority: options.priority,
962
+ blocked_by: options.blockedBy,
963
+ waiting_on: options.waitingOn,
964
+ handoff_to: options.handoffTo,
965
+ notes: options.notes,
966
+ checklist: options.checklist,
967
+ }), options.by, options.dryRun);
968
+ }
969
+ /** Move a task through the canonical lifecycle operation. */
970
+ async taskMove(options) {
971
+ return this.contextOp(options.groupId, {
972
+ op: 'task.move',
973
+ task_id: options.taskId,
974
+ status: options.status,
975
+ }, options.by, options.dryRun);
976
+ }
977
+ /** Restore an archived task. */
978
+ async taskRestore(options) {
979
+ return this.contextOp(options.groupId, {
980
+ op: 'task.restore',
981
+ task_id: options.taskId,
982
+ }, options.by, options.dryRun);
983
+ }
984
+ /** Update per-actor working memory. */
985
+ async agentStateUpdate(options) {
986
+ return this.contextOp(options.groupId, compactRecord({
987
+ op: 'agent_state.update',
988
+ actor_id: options.actorId,
989
+ active_task_id: options.activeTaskId,
990
+ focus: options.focus,
991
+ next_action: options.nextAction,
992
+ what_changed: options.whatChanged,
993
+ blockers: options.blockers,
994
+ open_loops: options.openLoops,
995
+ commitments: options.commitments,
996
+ environment_summary: options.environmentSummary,
997
+ user_model: options.userModel,
998
+ persona_notes: options.personaNotes,
999
+ resume_hint: options.resumeHint,
1000
+ }), options.by, options.dryRun);
1001
+ }
1002
+ /** Clear per-actor working memory. */
1003
+ async agentStateClear(options) {
1004
+ return this.contextOp(options.groupId, {
1005
+ op: 'agent_state.clear',
1006
+ actor_id: options.actorId,
1007
+ }, options.by, options.dryRun);
1008
+ }
1009
+ /** Merge restricted projection metadata. */
1010
+ async metaMerge(options) {
1011
+ return this.contextOp(options.groupId, {
1012
+ op: 'meta.merge',
1013
+ data: options.data,
1014
+ }, options.by, options.dryRun);
1015
+ }
1016
+ // ============================================================
1017
+ // Convenience methods: capability use and memory
1018
+ // ============================================================
1019
+ async capabilityUse(options) {
1020
+ const enableResult = await this.capabilityEnable(options);
1021
+ if (!options.toolName)
1022
+ return enableResult;
1023
+ return this.call('capability_tool_call', compactRecord({
1024
+ group_id: options.groupId,
1025
+ actor_id: options.actorId,
1026
+ by: options.by,
1027
+ tool_name: options.toolName,
1028
+ arguments: options.toolArguments ?? {},
1029
+ }));
1030
+ }
1031
+ async memorySearch(options) {
1032
+ return this.call('memory_search', compactRecord({
1033
+ group_id: options.groupId,
1034
+ actor_id: options.actorId,
1035
+ query: options.query,
1036
+ limit: options.limit,
1037
+ tags: options.tags,
1038
+ target: options.target,
1039
+ }));
1040
+ }
1041
+ async memoryGet(options) {
1042
+ return this.call('memory_get', compactRecord({
1043
+ group_id: options.groupId,
1044
+ actor_id: options.actorId,
1045
+ path: options.path,
1046
+ target: options.target,
1047
+ date: options.date,
1048
+ offset: options.offset,
1049
+ limit: options.limit,
1050
+ }));
1051
+ }
1052
+ async memoryWrite(options) {
1053
+ return this.call('memory_write', compactRecord({
1054
+ group_id: options.groupId,
1055
+ actor_id: options.actorId,
1056
+ target: options.target,
1057
+ content: options.content,
1058
+ tags: options.tags,
1059
+ source_refs: options.sourceRefs,
1060
+ idempotency_key: options.idempotencyKey,
1061
+ dedup_intent: options.dedupIntent,
1062
+ dedup_query: options.dedupQuery,
1063
+ }));
1064
+ }
1065
+ async memoryHealth(options = {}) {
1066
+ return this.call('memory_health', compactRecord({
1067
+ group_id: options.groupId,
1068
+ }));
1069
+ }
1070
+ async memoryProfileGet(options) {
1071
+ return this.call('memory_profile_get', compactRecord({
1072
+ group_id: options.groupId,
1073
+ actor_id: options.actorId,
1074
+ user_id: options.userId,
1075
+ tags: options.tags,
1076
+ }));
1077
+ }
1078
+ // ============================================================
1079
+ // Convenience methods: Group Space
1080
+ // ============================================================
1081
+ /**
1082
+ * Read Group Space provider and binding status.
1083
+ */
1084
+ async groupSpaceStatus(options) {
1085
+ return this.call('group_space_status', {
1086
+ group_id: options.groupId,
1087
+ provider: options.provider ?? 'notebooklm',
1088
+ });
1089
+ }
1090
+ /**
1091
+ * List available remote spaces for binding.
1092
+ */
1093
+ async groupSpaceSpaces(options) {
1094
+ return this.call('group_space_spaces', {
1095
+ group_id: options.groupId,
1096
+ provider: options.provider ?? 'notebooklm',
1097
+ });
1098
+ }
1099
+ /**
1100
+ * Read the provider capability matrix for a group.
1101
+ */
1102
+ async groupSpaceCapabilities(options) {
1103
+ return this.call('group_space_capabilities', {
1104
+ group_id: options.groupId,
1105
+ provider: options.provider ?? 'notebooklm',
1106
+ });
1107
+ }
1108
+ /**
1109
+ * Bind or unbind one Group Space lane.
1110
+ */
1111
+ async groupSpaceBind(options) {
1112
+ const args = {
1113
+ group_id: options.groupId,
1114
+ provider: options.provider ?? 'notebooklm',
1115
+ lane: options.lane,
1116
+ action: options.action ?? 'bind',
1117
+ by: options.by ?? 'user',
1118
+ };
1119
+ if (options.remoteSpaceId)
1120
+ args['remote_space_id'] = options.remoteSpaceId;
1121
+ return this.call('group_space_bind', args);
1122
+ }
1123
+ /**
1124
+ * Enqueue one Group Space ingest action.
1125
+ */
1126
+ async groupSpaceIngest(options) {
1127
+ const args = {
1128
+ group_id: options.groupId,
1129
+ provider: options.provider ?? 'notebooklm',
1130
+ lane: options.lane,
1131
+ kind: options.kind ?? 'context_sync',
1132
+ by: options.by ?? 'user',
1133
+ };
1134
+ if (options.payload)
1135
+ args['payload'] = options.payload;
1136
+ if (options.idempotencyKey)
1137
+ args['idempotency_key'] = options.idempotencyKey;
1138
+ return this.call('group_space_ingest', args);
1139
+ }
1140
+ /**
1141
+ * Query Group Space knowledge for one lane.
1142
+ */
1143
+ async groupSpaceQuery(options) {
1144
+ const args = {
1145
+ group_id: options.groupId,
1146
+ provider: options.provider ?? 'notebooklm',
1147
+ lane: options.lane,
1148
+ query: options.query,
1149
+ };
1150
+ if (options.options)
1151
+ args['options'] = options.options;
1152
+ return this.call('group_space_query', args);
1153
+ }
1154
+ /**
1155
+ * Manage remote sources in the bound Group Space lane.
1156
+ */
1157
+ async groupSpaceSources(options) {
1158
+ const args = {
1159
+ group_id: options.groupId,
1160
+ provider: options.provider ?? 'notebooklm',
1161
+ lane: options.lane,
1162
+ action: options.action ?? 'list',
1163
+ by: options.by ?? 'user',
1164
+ };
1165
+ if (options.sourceId)
1166
+ args['source_id'] = options.sourceId;
1167
+ if (options.newTitle)
1168
+ args['new_title'] = options.newTitle;
1169
+ return this.call('group_space_sources', args);
1170
+ }
1171
+ /**
1172
+ * List, generate, or download Group Space artifacts.
1173
+ */
1174
+ async groupSpaceArtifact(options) {
1175
+ const args = {
1176
+ group_id: options.groupId,
1177
+ provider: options.provider ?? 'notebooklm',
1178
+ lane: options.lane,
1179
+ action: options.action ?? 'list',
1180
+ by: options.by ?? 'user',
1181
+ };
1182
+ if (options.kind)
1183
+ args['kind'] = options.kind;
1184
+ if (options.options)
1185
+ args['options'] = options.options;
1186
+ if (options.wait !== undefined)
1187
+ args['wait'] = options.wait;
1188
+ if (options.saveToSpace !== undefined)
1189
+ args['save_to_space'] = options.saveToSpace;
1190
+ if (options.outputPath)
1191
+ args['output_path'] = options.outputPath;
1192
+ if (options.outputFormat)
1193
+ args['output_format'] = options.outputFormat;
1194
+ if (options.artifactId)
1195
+ args['artifact_id'] = options.artifactId;
1196
+ if (options.timeoutSeconds !== undefined)
1197
+ args['timeout_seconds'] = options.timeoutSeconds;
1198
+ if (options.initialInterval !== undefined)
1199
+ args['initial_interval'] = options.initialInterval;
1200
+ if (options.maxInterval !== undefined)
1201
+ args['max_interval'] = options.maxInterval;
1202
+ return this.call('group_space_artifact', args);
1203
+ }
1204
+ /**
1205
+ * List or manage Group Space jobs.
1206
+ */
1207
+ async groupSpaceJobs(options) {
1208
+ const args = {
1209
+ group_id: options.groupId,
1210
+ provider: options.provider ?? 'notebooklm',
1211
+ lane: options.lane,
1212
+ action: options.action ?? 'list',
1213
+ by: options.by ?? 'user',
1214
+ };
1215
+ if (options.jobId)
1216
+ args['job_id'] = options.jobId;
1217
+ if (options.state)
1218
+ args['state'] = options.state;
1219
+ if (options.limit !== undefined)
1220
+ args['limit'] = options.limit;
1221
+ return this.call('group_space_jobs', args);
1222
+ }
1223
+ /**
1224
+ * Read or run Group Space synchronization for one lane.
1225
+ */
1226
+ async groupSpaceSync(options) {
1227
+ return this.call('group_space_sync', {
1228
+ group_id: options.groupId,
1229
+ provider: options.provider ?? 'notebooklm',
1230
+ lane: options.lane,
1231
+ action: options.action ?? 'status',
1232
+ force: options.force ?? false,
1233
+ by: options.by ?? 'user',
1234
+ });
1235
+ }
1236
+ /**
1237
+ * Read provider credential status.
1238
+ */
1239
+ async groupSpaceProviderCredentialStatus(options = {}) {
1240
+ return this.call('group_space_provider_credential_status', {
1241
+ provider: options.provider ?? 'notebooklm',
1242
+ by: options.by ?? 'user',
1243
+ });
1244
+ }
1245
+ /**
1246
+ * Update provider credentials.
1247
+ */
1248
+ async groupSpaceProviderCredentialUpdate(options = {}) {
1249
+ const args = {
1250
+ provider: options.provider ?? 'notebooklm',
1251
+ by: options.by ?? 'user',
1252
+ clear: options.clear ?? false,
1253
+ };
1254
+ if (options.authJson)
1255
+ args['auth_json'] = options.authJson;
1256
+ return this.call('group_space_provider_credential_update', args);
1257
+ }
1258
+ /**
1259
+ * Run provider health check.
1260
+ */
1261
+ async groupSpaceProviderHealthCheck(options = {}) {
1262
+ return this.call('group_space_provider_health_check', {
1263
+ provider: options.provider ?? 'notebooklm',
1264
+ by: options.by ?? 'user',
1265
+ });
1266
+ }
1267
+ /**
1268
+ * Control provider auth flow.
1269
+ */
1270
+ async groupSpaceProviderAuth(options = {}) {
1271
+ const args = {
1272
+ provider: options.provider ?? 'notebooklm',
1273
+ action: options.action ?? 'status',
1274
+ by: options.by ?? 'user',
1275
+ };
1276
+ if (options.timeoutSeconds !== undefined)
1277
+ args['timeout_seconds'] = options.timeoutSeconds;
1278
+ return this.call('group_space_provider_auth', args);
1279
+ }
600
1280
  // ============================================================
601
1281
  // Event stream
602
1282
  // ============================================================