@frumu/tandem-client 0.4.44 → 0.5.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/dist/index.js CHANGED
@@ -395,6 +395,8 @@ var TandemClient = class {
395
395
  this.capabilities = new Capabilities(req);
396
396
  this.resources = new Resources(this.baseUrl, getToken, req);
397
397
  this.browser = new Browser(req);
398
+ this.storage = new Storage(req);
399
+ this.worktrees = new Worktrees(req);
398
400
  this.workflows = new Workflows(this.baseUrl, getToken, req);
399
401
  this.bugMonitor = new BugMonitor(req);
400
402
  this.coder = new Coder(req);
@@ -565,6 +567,47 @@ var Browser = class {
565
567
  });
566
568
  }
567
569
  };
570
+ var Storage = class {
571
+ constructor(req) {
572
+ this.req = req;
573
+ }
574
+ /**
575
+ * List files under the engine storage root.
576
+ *
577
+ * For local cleanup, sharding, and archive migration use the engine CLI:
578
+ * `tandem-engine storage cleanup`.
579
+ */
580
+ async listFiles(options) {
581
+ const params = new URLSearchParams();
582
+ if (options?.path) params.set("path", options.path);
583
+ if (options?.limit !== void 0) params.set("limit", String(options.limit));
584
+ const qs = params.toString() ? `?${params.toString()}` : "";
585
+ return this.req(`/global/storage/files${qs}`);
586
+ }
587
+ /** Force the legacy session-storage repair scan. */
588
+ async repair(options) {
589
+ return this.req("/global/storage/repair", {
590
+ method: "POST",
591
+ body: JSON.stringify({ force: options?.force ?? false })
592
+ });
593
+ }
594
+ };
595
+ var Worktrees = class {
596
+ constructor(req) {
597
+ this.req = req;
598
+ }
599
+ /** Preview or apply stale managed-worktree cleanup for a repository root. */
600
+ async cleanup(options) {
601
+ return this.req("/worktree/cleanup", {
602
+ method: "POST",
603
+ body: JSON.stringify({
604
+ repo_root: options?.repoRoot,
605
+ dry_run: options?.dryRun ?? false,
606
+ remove_orphan_dirs: options?.removeOrphanDirs ?? true
607
+ })
608
+ });
609
+ }
610
+ };
568
611
  var Workflows = class {
569
612
  constructor(baseUrl, getToken, req) {
570
613
  this.baseUrl = baseUrl;
@@ -654,9 +697,10 @@ var BugMonitor = class {
654
697
  return this.req("/config/bug-monitor");
655
698
  }
656
699
  async patchConfig(config) {
700
+ const body = config && typeof config === "object" && "bug_monitor" in config ? config : { bug_monitor: config };
657
701
  return this.req("/config/bug-monitor", {
658
702
  method: "PATCH",
659
- body: JSON.stringify(config)
703
+ body: JSON.stringify(body)
660
704
  });
661
705
  }
662
706
  async getStatus() {
@@ -692,6 +736,42 @@ var BugMonitor = class {
692
736
  body: JSON.stringify(payload ?? {})
693
737
  });
694
738
  }
739
+ async deleteIncident(id) {
740
+ return this.req(
741
+ `/bug-monitor/incidents/${encodeURIComponent(id)}`,
742
+ { method: "DELETE" }
743
+ );
744
+ }
745
+ async bulkDeleteIncidents(payload) {
746
+ return this.req("/bug-monitor/incidents/bulk-delete", {
747
+ method: "POST",
748
+ body: JSON.stringify(payload)
749
+ });
750
+ }
751
+ async deleteDraft(id) {
752
+ return this.req(
753
+ `/bug-monitor/drafts/${encodeURIComponent(id)}`,
754
+ { method: "DELETE" }
755
+ );
756
+ }
757
+ async bulkDeleteDrafts(payload) {
758
+ return this.req("/bug-monitor/drafts/bulk-delete", {
759
+ method: "POST",
760
+ body: JSON.stringify(payload)
761
+ });
762
+ }
763
+ async deletePost(id) {
764
+ return this.req(
765
+ `/bug-monitor/posts/${encodeURIComponent(id)}`,
766
+ { method: "DELETE" }
767
+ );
768
+ }
769
+ async bulkDeletePosts(payload) {
770
+ return this.req("/bug-monitor/posts/bulk-delete", {
771
+ method: "POST",
772
+ body: JSON.stringify(payload)
773
+ });
774
+ }
695
775
  async listDrafts(options) {
696
776
  const qs = options?.limit !== void 0 ? `?limit=${options.limit}` : "";
697
777
  return this.req(`/bug-monitor/drafts${qs}`);
@@ -700,6 +780,37 @@ var BugMonitor = class {
700
780
  const qs = options?.limit !== void 0 ? `?limit=${options.limit}` : "";
701
781
  return this.req(`/bug-monitor/posts${qs}`);
702
782
  }
783
+ async listIntakeKeys() {
784
+ return this.req("/bug-monitor/intake/keys");
785
+ }
786
+ async createIntakeKey(input) {
787
+ return this.req("/bug-monitor/intake/keys", {
788
+ method: "POST",
789
+ body: JSON.stringify(input)
790
+ });
791
+ }
792
+ async disableIntakeKey(id) {
793
+ return this.req(
794
+ `/bug-monitor/intake/keys/${encodeURIComponent(id)}/disable`,
795
+ { method: "POST" }
796
+ );
797
+ }
798
+ async resetLogSourceOffset(projectId, sourceId) {
799
+ return this.req(
800
+ `/bug-monitor/log-sources/${encodeURIComponent(projectId)}/${encodeURIComponent(
801
+ sourceId
802
+ )}/reset-offset`,
803
+ { method: "POST" }
804
+ );
805
+ }
806
+ async replayLatestLogSourceCandidate(projectId, sourceId) {
807
+ return this.req(
808
+ `/bug-monitor/log-sources/${encodeURIComponent(projectId)}/${encodeURIComponent(
809
+ sourceId
810
+ )}/replay-latest`,
811
+ { method: "POST" }
812
+ );
813
+ }
703
814
  async getDraft(id) {
704
815
  const raw = await this.req(
705
816
  `/bug-monitor/drafts/${encodeURIComponent(id)}`
@@ -719,9 +830,10 @@ var BugMonitor = class {
719
830
  });
720
831
  }
721
832
  async report(payload) {
833
+ const body = payload && typeof payload === "object" && "report" in payload ? payload : { report: payload };
722
834
  return this.req("/bug-monitor/report", {
723
835
  method: "POST",
724
- body: JSON.stringify(payload)
836
+ body: JSON.stringify(body)
725
837
  });
726
838
  }
727
839
  async createTriageRun(id) {
@@ -69,6 +69,80 @@ export interface BrowserSmokeTestResponse {
69
69
  closed?: boolean;
70
70
  [key: string]: unknown;
71
71
  }
72
+ export interface StorageFileRecord {
73
+ path: string;
74
+ relative_to_base?: string;
75
+ relativeToBase?: string;
76
+ size_bytes?: number;
77
+ sizeBytes?: number;
78
+ modified_at_ms?: number | null;
79
+ modifiedAtMs?: number | null;
80
+ [key: string]: unknown;
81
+ }
82
+ export interface StorageFilesResponse {
83
+ root?: string;
84
+ base?: string;
85
+ count?: number;
86
+ limit?: number;
87
+ files: StorageFileRecord[];
88
+ [key: string]: unknown;
89
+ }
90
+ export interface StorageRepairResponse {
91
+ status?: string;
92
+ marker_updated?: boolean;
93
+ markerUpdated?: boolean;
94
+ sessions_merged?: number;
95
+ sessionsMerged?: number;
96
+ messages_recovered?: number;
97
+ messagesRecovered?: number;
98
+ parts_recovered?: number;
99
+ partsRecovered?: number;
100
+ legacy_counts?: JsonObject;
101
+ legacyCounts?: JsonObject;
102
+ imported_counts?: JsonObject;
103
+ importedCounts?: JsonObject;
104
+ [key: string]: unknown;
105
+ }
106
+ export interface WorktreeCleanupStaleRecord {
107
+ path?: string;
108
+ branch?: string | null;
109
+ [key: string]: unknown;
110
+ }
111
+ export interface WorktreeCleanupActionRecord {
112
+ path?: string;
113
+ branch?: string | null;
114
+ via?: string | null;
115
+ code?: string | null;
116
+ error?: string | null;
117
+ stderr?: string | null;
118
+ branch_deleted?: boolean | null;
119
+ branchDeleteError?: string | null;
120
+ branch_delete_error?: string | null;
121
+ [key: string]: unknown;
122
+ }
123
+ export interface WorktreeCleanupResponse {
124
+ ok?: boolean;
125
+ dry_run?: boolean;
126
+ dryRun?: boolean;
127
+ repo_root?: string;
128
+ repoRoot?: string;
129
+ managed_root?: string;
130
+ managedRoot?: string;
131
+ tracked_paths?: string[];
132
+ trackedPaths?: string[];
133
+ active_paths?: string[];
134
+ activePaths?: string[];
135
+ stale_paths?: WorktreeCleanupStaleRecord[];
136
+ stalePaths?: WorktreeCleanupStaleRecord[];
137
+ cleaned_worktrees?: WorktreeCleanupActionRecord[];
138
+ cleanedWorktrees?: WorktreeCleanupActionRecord[];
139
+ orphan_dirs?: string[];
140
+ orphanDirs?: string[];
141
+ orphan_dirs_removed?: WorktreeCleanupActionRecord[];
142
+ orphanDirsRemoved?: WorktreeCleanupActionRecord[];
143
+ failures?: WorktreeCleanupActionRecord[];
144
+ [key: string]: unknown;
145
+ }
72
146
  export interface CreateSessionOptions {
73
147
  title?: string;
74
148
  directory?: string;
@@ -641,15 +715,69 @@ export interface BugMonitorConfigRow {
641
715
  require_approval_for_new_issues?: boolean;
642
716
  auto_comment_on_matched_open_issues?: boolean;
643
717
  label_mode?: string | null;
718
+ monitored_projects?: BugMonitorMonitoredProject[];
644
719
  [key: string]: unknown;
645
720
  }
721
+ export interface BugMonitorLogSource {
722
+ source_id?: string;
723
+ path?: string;
724
+ format?: "auto" | "json" | "plaintext" | string;
725
+ minimum_level?: "error" | "warn" | string;
726
+ watch_interval_seconds?: number;
727
+ enabled?: boolean;
728
+ paused?: boolean;
729
+ start_position?: "end" | "beginning" | string;
730
+ max_bytes_per_poll?: number;
731
+ max_candidates_per_poll?: number;
732
+ fingerprint_cooldown_ms?: number;
733
+ }
734
+ export interface BugMonitorMonitoredProject {
735
+ project_id?: string;
736
+ name?: string;
737
+ enabled?: boolean;
738
+ paused?: boolean;
739
+ repo?: string;
740
+ workspace_root?: string;
741
+ mcp_server?: string | null;
742
+ model_policy?: JsonObject | null;
743
+ auto_create_new_issues?: boolean;
744
+ require_approval_for_new_issues?: boolean;
745
+ auto_comment_on_matched_open_issues?: boolean;
746
+ log_sources?: BugMonitorLogSource[];
747
+ }
646
748
  export interface BugMonitorConfigResponse {
647
749
  bug_monitor: BugMonitorConfigRow;
648
750
  }
751
+ export interface BugMonitorLogSourceRuntimeStatus {
752
+ project_id?: string;
753
+ source_id?: string;
754
+ path?: string;
755
+ healthy?: boolean;
756
+ offset?: number;
757
+ inode?: string | null;
758
+ file_size?: number | null;
759
+ last_poll_at_ms?: number | null;
760
+ last_candidate_at_ms?: number | null;
761
+ last_submitted_at_ms?: number | null;
762
+ last_error?: string | null;
763
+ consecutive_errors?: number;
764
+ total_bytes_read?: number;
765
+ total_candidates?: number;
766
+ total_submitted?: number;
767
+ }
768
+ export interface BugMonitorLogWatcherStatus {
769
+ running?: boolean;
770
+ enabled_projects?: number;
771
+ enabled_sources?: number;
772
+ last_poll_at_ms?: number | null;
773
+ last_error?: string | null;
774
+ sources?: BugMonitorLogSourceRuntimeStatus[];
775
+ }
649
776
  export interface BugMonitorStatusRow {
650
777
  config?: BugMonitorConfigRow;
651
778
  readiness?: Record<string, boolean>;
652
779
  runtime?: JsonObject;
780
+ log_watcher?: BugMonitorLogWatcherStatus;
653
781
  required_capabilities?: Record<string, boolean>;
654
782
  missing_required_capabilities?: string[];
655
783
  resolved_capabilities?: JsonObject[];
@@ -677,12 +805,27 @@ export interface BugMonitorIncidentRecord {
677
805
  title?: string;
678
806
  detail?: string | null;
679
807
  excerpt?: string[];
808
+ source?: string | null;
809
+ run_id?: string | null;
810
+ session_id?: string | null;
811
+ correlation_id?: string | null;
812
+ component?: string | null;
813
+ level?: string | null;
680
814
  occurrence_count?: number;
681
815
  created_at_ms?: number;
682
816
  updated_at_ms?: number;
817
+ last_seen_at_ms?: number | null;
683
818
  draft_id?: string | null;
684
819
  triage_run_id?: string | null;
685
820
  last_error?: string | null;
821
+ duplicate_summary?: JsonObject | null;
822
+ duplicate_matches?: JsonValue[] | null;
823
+ event_payload?: JsonValue | null;
824
+ confidence?: string | null;
825
+ risk_level?: string | null;
826
+ expected_destination?: string | null;
827
+ evidence_refs?: string[];
828
+ quality_gate?: JsonObject | null;
686
829
  [key: string]: unknown;
687
830
  }
688
831
  export interface BugMonitorIncidentListResponse {
@@ -706,6 +849,11 @@ export interface BugMonitorDraftRecord {
706
849
  matched_issue_number?: number | null;
707
850
  matched_issue_state?: string | null;
708
851
  evidence_digest?: string | null;
852
+ confidence?: string | null;
853
+ risk_level?: string | null;
854
+ expected_destination?: string | null;
855
+ evidence_refs?: string[];
856
+ quality_gate?: JsonObject | null;
709
857
  last_post_error?: string | null;
710
858
  [key: string]: unknown;
711
859
  }
@@ -716,13 +864,25 @@ export interface BugMonitorDraftListResponse {
716
864
  export interface BugMonitorPostRecord {
717
865
  post_id: string;
718
866
  draft_id?: string;
867
+ incident_id?: string | null;
868
+ fingerprint?: string;
719
869
  repo?: string;
720
870
  operation?: string;
721
871
  status?: string;
722
872
  issue_number?: number | null;
723
873
  issue_url?: string | null;
874
+ comment_id?: string | null;
724
875
  comment_url?: string | null;
876
+ evidence_digest?: string | null;
877
+ confidence?: string | null;
878
+ risk_level?: string | null;
879
+ expected_destination?: string | null;
880
+ evidence_refs?: string[];
881
+ quality_gate?: JsonObject | null;
882
+ idempotency_key?: string;
883
+ response_excerpt?: string | null;
725
884
  error?: string | null;
885
+ created_at_ms?: number | null;
726
886
  updated_at_ms?: number | null;
727
887
  [key: string]: unknown;
728
888
  }
@@ -730,6 +890,60 @@ export interface BugMonitorPostListResponse {
730
890
  posts: BugMonitorPostRecord[];
731
891
  count: number;
732
892
  }
893
+ export interface BugMonitorIntakeKeyRecord {
894
+ key_id: string;
895
+ project_id: string;
896
+ name: string;
897
+ key_hash?: string;
898
+ enabled?: boolean;
899
+ scopes?: string[];
900
+ created_at_ms?: number | null;
901
+ last_used_at_ms?: number | null;
902
+ [key: string]: unknown;
903
+ }
904
+ export interface BugMonitorIntakeKeyListResponse {
905
+ keys: BugMonitorIntakeKeyRecord[];
906
+ }
907
+ export interface BugMonitorIntakeKeyCreateInput {
908
+ project_id: string;
909
+ name: string;
910
+ scopes?: string[];
911
+ }
912
+ export interface BugMonitorIntakeKeyCreateResponse {
913
+ key: BugMonitorIntakeKeyRecord;
914
+ raw_key: string;
915
+ }
916
+ export interface BugMonitorIntakeKeyDisableResponse {
917
+ key: BugMonitorIntakeKeyRecord;
918
+ }
919
+ export interface BugMonitorLogSourceStateRecord {
920
+ project_id?: string;
921
+ source_id?: string;
922
+ path?: string;
923
+ inode?: string | null;
924
+ offset?: number;
925
+ partial_line?: string | null;
926
+ partial_line_offset_start?: number | null;
927
+ last_line_hash?: string | null;
928
+ updated_at_ms?: number | null;
929
+ last_error?: string | null;
930
+ consecutive_errors?: number;
931
+ total_bytes_read?: number;
932
+ total_candidates?: number;
933
+ total_submitted?: number;
934
+ [key: string]: unknown;
935
+ }
936
+ export interface BugMonitorLogSourceResetResponse {
937
+ project_id: string;
938
+ source_id: string;
939
+ state: BugMonitorLogSourceStateRecord;
940
+ }
941
+ export interface BugMonitorLogSourceReplayResponse {
942
+ project_id: string;
943
+ source_id: string;
944
+ incident: BugMonitorIncidentRecord;
945
+ draft?: BugMonitorDraftRecord | null;
946
+ }
733
947
  export interface PackInstallRecord {
734
948
  pack_id: string;
735
949
  name: string;