@astralform/js 9.3.0 → 9.4.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/dist/index.cjs CHANGED
@@ -500,6 +500,79 @@ var AstralformClient = class {
500
500
  `/v1/code/projects/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}`
501
501
  );
502
502
  }
503
+ },
504
+ /**
505
+ * Code groups: a user-named container under one repository, for a feature
506
+ * whose work outlives a single session. Its sessions share one plan and one
507
+ * set of notes, so what one writes the others read.
508
+ *
509
+ * A group is a LABEL, not a binding — unlike a task's project, which is
510
+ * written once on the first turn. A task may join, move between, or leave
511
+ * groups at any time, and a deleted group's sessions survive as ungrouped.
512
+ *
513
+ * The server enforces three things worth knowing before you render a
514
+ * failure: a group that is not this user's answers `404` (never `403`, so a
515
+ * group id cannot be probed); filing a task into a group under a DIFFERENT
516
+ * repository than the task's answers `409`; and the group's plan and notes
517
+ * are deleted with the group, while each session keeps its own.
518
+ */
519
+ groups: {
520
+ /**
521
+ * This user's groups, oldest first. Pass a repository to narrow to one
522
+ * repository's — the composer's picker does; the sidebar asks once and
523
+ * nests them itself.
524
+ */
525
+ list: async (repository) => {
526
+ const query = repository ? `?repository=${encodeURIComponent(repository)}` : "";
527
+ const raw = await this.get(`/v1/code/groups${query}`);
528
+ return raw.map((g) => camelizeKeys(g));
529
+ },
530
+ /**
531
+ * Create a group under a repository. The repository goes through the same
532
+ * normaliser the Projects surface uses, so a pasted GitHub URL is accepted
533
+ * and anything that is not `owner/repo` is refused.
534
+ */
535
+ create: async (repository, title) => {
536
+ const raw = await this.post("/v1/code/groups", { repository, title });
537
+ return camelizeKeys(raw);
538
+ },
539
+ /** Rename a group. A group that is not this user's answers `404`. */
540
+ rename: async (groupId, title) => {
541
+ const raw = await this.patch(`/v1/code/groups/${encodeURIComponent(groupId)}`, { title });
542
+ return camelizeKeys(raw);
543
+ },
544
+ /**
545
+ * Delete a group. Its tasks survive and become ungrouped, each keeping its
546
+ * own plan and notes; the group's SHARED documents are deleted with it.
547
+ */
548
+ remove: async (groupId) => {
549
+ await this.del(`/v1/code/groups/${encodeURIComponent(groupId)}`);
550
+ },
551
+ /**
552
+ * File a task into a group. Idempotent — filing an already-filed task
553
+ * again is the same state, not an error. Refused with `409` when the task
554
+ * belongs to a different repository than the group, because it would
555
+ * render nowhere in the sidebar.
556
+ */
557
+ assign: async (groupId, conversationId) => {
558
+ const raw = await this.post(
559
+ `/v1/code/groups/${encodeURIComponent(groupId)}/tasks/${encodeURIComponent(conversationId)}`,
560
+ void 0
561
+ );
562
+ return camelizeKeys(raw);
563
+ },
564
+ /**
565
+ * Take a task out of its group. The task and its documents are untouched.
566
+ *
567
+ * Deliberately not strict about WHICH group the task is in: a task that is
568
+ * in a different one (or in none) already satisfies "this task should not
569
+ * be grouped", so the call clears it rather than refusing.
570
+ */
571
+ unassign: async (groupId, conversationId) => {
572
+ await this.del(
573
+ `/v1/code/groups/${encodeURIComponent(groupId)}/tasks/${encodeURIComponent(conversationId)}`
574
+ );
575
+ }
503
576
  }
504
577
  };
505
578
  if (isApiKeyConfig(config)) {