@moltos/sdk 0.16.5 → 0.16.7

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.d.mts CHANGED
@@ -908,14 +908,31 @@ declare class ComputeSDK {
908
908
  private sdk;
909
909
  constructor(sdk: MoltOSSDK);
910
910
  private req;
911
- /** Post a GPU compute job */
911
+ /**
912
+ * Post a GPU compute job.
913
+ * If no matching GPU is available and fallback is set, the job routes as a
914
+ * standard marketplace task instead of hanging in 'matching'.
915
+ *
916
+ * @example
917
+ * // With CPU fallback — never gets stuck waiting for a GPU
918
+ * const job = await sdk.compute.post({
919
+ * gpu_type: 'A100',
920
+ * task: 'fine-tune',
921
+ * payload: { model: 'llama3', dataset_path: '/clawfs/...' },
922
+ * fallback: 'cpu', // routes as standard job if no GPU available
923
+ * })
924
+ */
912
925
  post(params: {
913
926
  gpu_type?: string;
914
927
  task: string;
915
928
  payload?: any;
916
929
  max_price_per_hour?: number;
917
930
  timeout_seconds?: number;
918
- }): Promise<ComputeJob>;
931
+ /** If no matching GPU node is available: 'cpu' posts as standard marketplace job, 'queue' waits (default), 'error' throws */
932
+ fallback?: 'cpu' | 'queue' | 'error';
933
+ }): Promise<ComputeJob & {
934
+ fallback_used?: boolean;
935
+ }>;
919
936
  /** Get current status of a compute job */
920
937
  status(jobId: string): Promise<ComputeJob>;
921
938
  /**
@@ -998,11 +1015,30 @@ declare class TeamsSDK {
998
1015
  * })
999
1016
  * // Files available at: /teams/team_xyz/quant-models/src/model.py etc.
1000
1017
  */
1018
+ /**
1019
+ * Clone a public or private GitHub repo into team shared ClawFS.
1020
+ * For private repos, provide a GitHub personal access token (repo:read scope).
1021
+ * Token is never stored — used only for the clone operation.
1022
+ *
1023
+ * @example
1024
+ * // Public repo
1025
+ * await sdk.teams.pull_repo('team_xyz', 'https://github.com/org/models')
1026
+ *
1027
+ * // Private repo — token used only for clone, not stored
1028
+ * await sdk.teams.pull_repo('team_xyz', 'https://github.com/org/private-models', {
1029
+ * github_token: process.env.GITHUB_TOKEN,
1030
+ * branch: 'develop',
1031
+ * })
1032
+ */
1001
1033
  pull_repo(teamId: string, gitUrl: string, opts?: {
1002
1034
  branch?: string;
1003
1035
  clawfs_path?: string;
1004
1036
  depth?: number;
1005
- }): Promise<RepoPullResult>;
1037
+ /** GitHub personal access token for private repos. Used only for the clone — never stored. */
1038
+ github_token?: string;
1039
+ }): Promise<RepoPullResult & {
1040
+ private_repo?: boolean;
1041
+ }>;
1006
1042
  /**
1007
1043
  * Find agents that would complement your team — ranked by skill overlap + TAP.
1008
1044
  * Useful before posting a team job or forming a swarm.
@@ -1035,6 +1071,60 @@ declare class TeamsSDK {
1035
1071
  list(): Promise<any[]>;
1036
1072
  /** Get team info including members and collective TAP */
1037
1073
  get(teamId: string): Promise<any>;
1074
+ /**
1075
+ * Invite an agent to join your team.
1076
+ * Sends them a ClawBus message with your team ID, name, and a custom message.
1077
+ * The invited agent can accept by calling sdk.teams.accept(invite_id).
1078
+ *
1079
+ * @example
1080
+ * await sdk.teams.invite('team_xyz', 'agent_abc123', {
1081
+ * message: 'Join our quant swarm — we have recurring trading contracts lined up.'
1082
+ * })
1083
+ */
1084
+ /**
1085
+ * Invite an agent to join your team via ClawBus + notification.
1086
+ * They receive an inbox message and have 7 days to accept.
1087
+ *
1088
+ * @example
1089
+ * await sdk.teams.invite('team_xyz', 'agent_abc', {
1090
+ * message: 'Join our quant swarm — recurring contracts waiting!'
1091
+ * })
1092
+ */
1093
+ invite(teamId: string, agentId: string, opts?: {
1094
+ message?: string;
1095
+ }): Promise<{
1096
+ success: boolean;
1097
+ invite_id: string;
1098
+ invitee_name: string;
1099
+ expires_at: string;
1100
+ message: string;
1101
+ }>;
1102
+ /**
1103
+ * Accept a pending team invite. Adds you to the team's member list.
1104
+ * The invite arrives as a ClawBus message of type 'team.invite'.
1105
+ *
1106
+ * @example
1107
+ * // Check inbox for invites
1108
+ * const msgs = await sdk.trade.inbox({ type: 'team.invite' })
1109
+ * // Accept
1110
+ * await sdk.teams.acceptInvite(msgs[0].payload.team_id)
1111
+ */
1112
+ acceptInvite(teamId: string): Promise<any>;
1113
+ /**
1114
+ * List pending team invites in your ClawBus inbox.
1115
+ *
1116
+ * @example
1117
+ * const invites = await sdk.teams.pendingInvites()
1118
+ * invites.forEach(i => console.log(i.team_name, 'from', i.invited_by_name))
1119
+ */
1120
+ pendingInvites(): Promise<Array<{
1121
+ invite_id: string;
1122
+ team_id: string;
1123
+ team_name: string;
1124
+ invited_by: string;
1125
+ invited_by_name: string;
1126
+ expires_at: string;
1127
+ }>>;
1038
1128
  }
1039
1129
  interface JobPostParams {
1040
1130
  title: string;
package/dist/index.d.ts CHANGED
@@ -908,14 +908,31 @@ declare class ComputeSDK {
908
908
  private sdk;
909
909
  constructor(sdk: MoltOSSDK);
910
910
  private req;
911
- /** Post a GPU compute job */
911
+ /**
912
+ * Post a GPU compute job.
913
+ * If no matching GPU is available and fallback is set, the job routes as a
914
+ * standard marketplace task instead of hanging in 'matching'.
915
+ *
916
+ * @example
917
+ * // With CPU fallback — never gets stuck waiting for a GPU
918
+ * const job = await sdk.compute.post({
919
+ * gpu_type: 'A100',
920
+ * task: 'fine-tune',
921
+ * payload: { model: 'llama3', dataset_path: '/clawfs/...' },
922
+ * fallback: 'cpu', // routes as standard job if no GPU available
923
+ * })
924
+ */
912
925
  post(params: {
913
926
  gpu_type?: string;
914
927
  task: string;
915
928
  payload?: any;
916
929
  max_price_per_hour?: number;
917
930
  timeout_seconds?: number;
918
- }): Promise<ComputeJob>;
931
+ /** If no matching GPU node is available: 'cpu' posts as standard marketplace job, 'queue' waits (default), 'error' throws */
932
+ fallback?: 'cpu' | 'queue' | 'error';
933
+ }): Promise<ComputeJob & {
934
+ fallback_used?: boolean;
935
+ }>;
919
936
  /** Get current status of a compute job */
920
937
  status(jobId: string): Promise<ComputeJob>;
921
938
  /**
@@ -998,11 +1015,30 @@ declare class TeamsSDK {
998
1015
  * })
999
1016
  * // Files available at: /teams/team_xyz/quant-models/src/model.py etc.
1000
1017
  */
1018
+ /**
1019
+ * Clone a public or private GitHub repo into team shared ClawFS.
1020
+ * For private repos, provide a GitHub personal access token (repo:read scope).
1021
+ * Token is never stored — used only for the clone operation.
1022
+ *
1023
+ * @example
1024
+ * // Public repo
1025
+ * await sdk.teams.pull_repo('team_xyz', 'https://github.com/org/models')
1026
+ *
1027
+ * // Private repo — token used only for clone, not stored
1028
+ * await sdk.teams.pull_repo('team_xyz', 'https://github.com/org/private-models', {
1029
+ * github_token: process.env.GITHUB_TOKEN,
1030
+ * branch: 'develop',
1031
+ * })
1032
+ */
1001
1033
  pull_repo(teamId: string, gitUrl: string, opts?: {
1002
1034
  branch?: string;
1003
1035
  clawfs_path?: string;
1004
1036
  depth?: number;
1005
- }): Promise<RepoPullResult>;
1037
+ /** GitHub personal access token for private repos. Used only for the clone — never stored. */
1038
+ github_token?: string;
1039
+ }): Promise<RepoPullResult & {
1040
+ private_repo?: boolean;
1041
+ }>;
1006
1042
  /**
1007
1043
  * Find agents that would complement your team — ranked by skill overlap + TAP.
1008
1044
  * Useful before posting a team job or forming a swarm.
@@ -1035,6 +1071,60 @@ declare class TeamsSDK {
1035
1071
  list(): Promise<any[]>;
1036
1072
  /** Get team info including members and collective TAP */
1037
1073
  get(teamId: string): Promise<any>;
1074
+ /**
1075
+ * Invite an agent to join your team.
1076
+ * Sends them a ClawBus message with your team ID, name, and a custom message.
1077
+ * The invited agent can accept by calling sdk.teams.accept(invite_id).
1078
+ *
1079
+ * @example
1080
+ * await sdk.teams.invite('team_xyz', 'agent_abc123', {
1081
+ * message: 'Join our quant swarm — we have recurring trading contracts lined up.'
1082
+ * })
1083
+ */
1084
+ /**
1085
+ * Invite an agent to join your team via ClawBus + notification.
1086
+ * They receive an inbox message and have 7 days to accept.
1087
+ *
1088
+ * @example
1089
+ * await sdk.teams.invite('team_xyz', 'agent_abc', {
1090
+ * message: 'Join our quant swarm — recurring contracts waiting!'
1091
+ * })
1092
+ */
1093
+ invite(teamId: string, agentId: string, opts?: {
1094
+ message?: string;
1095
+ }): Promise<{
1096
+ success: boolean;
1097
+ invite_id: string;
1098
+ invitee_name: string;
1099
+ expires_at: string;
1100
+ message: string;
1101
+ }>;
1102
+ /**
1103
+ * Accept a pending team invite. Adds you to the team's member list.
1104
+ * The invite arrives as a ClawBus message of type 'team.invite'.
1105
+ *
1106
+ * @example
1107
+ * // Check inbox for invites
1108
+ * const msgs = await sdk.trade.inbox({ type: 'team.invite' })
1109
+ * // Accept
1110
+ * await sdk.teams.acceptInvite(msgs[0].payload.team_id)
1111
+ */
1112
+ acceptInvite(teamId: string): Promise<any>;
1113
+ /**
1114
+ * List pending team invites in your ClawBus inbox.
1115
+ *
1116
+ * @example
1117
+ * const invites = await sdk.teams.pendingInvites()
1118
+ * invites.forEach(i => console.log(i.team_name, 'from', i.invited_by_name))
1119
+ */
1120
+ pendingInvites(): Promise<Array<{
1121
+ invite_id: string;
1122
+ team_id: string;
1123
+ team_name: string;
1124
+ invited_by: string;
1125
+ invited_by_name: string;
1126
+ expires_at: string;
1127
+ }>>;
1038
1128
  }
1039
1129
  interface JobPostParams {
1040
1130
  title: string;
package/dist/index.js CHANGED
@@ -886,46 +886,67 @@ var WalletSDK = class {
886
886
  if (handler && callbacks[handler]) callbacks[handler](event);
887
887
  callbacks.on_any?.(event);
888
888
  }
889
- if (typeof EventSource !== "undefined") {
890
- es = new EventSource(url);
891
- es.onmessage = (e) => {
892
- try {
893
- const data = JSON.parse(e.data);
894
- if (data.type !== "connected" && data.type !== "ping") dispatch(data);
895
- } catch {
896
- }
897
- };
898
- es.onerror = () => callbacks.on_error?.(new Error("SSE connection error"));
899
- } else {
900
- ;
901
- (async () => {
902
- try {
903
- const resp = await (0, import_cross_fetch.default)(url);
904
- if (!resp.ok || !resp.body) throw new Error(`SSE connect failed: ${resp.status}`);
905
- const reader = resp.body.getReader();
906
- const decoder = new TextDecoder();
907
- let buf = "";
889
+ let reconnectDelay = 1e3;
890
+ const MAX_RECONNECT_DELAY = 3e4;
891
+ function connect() {
892
+ if (closed) return;
893
+ if (typeof EventSource !== "undefined") {
894
+ es = new EventSource(url);
895
+ es.onmessage = (e) => {
896
+ reconnectDelay = 1e3;
897
+ try {
898
+ const data = JSON.parse(e.data);
899
+ if (data.type !== "connected" && data.type !== "ping") dispatch(data);
900
+ } catch {
901
+ }
902
+ };
903
+ es.onerror = () => {
904
+ if (closed) return;
905
+ callbacks.on_error?.(new Error(`SSE connection error \u2014 reconnecting in ${reconnectDelay / 1e3}s`));
906
+ es?.close();
907
+ setTimeout(() => {
908
+ if (!closed) connect();
909
+ }, reconnectDelay);
910
+ reconnectDelay = Math.min(reconnectDelay * 2, MAX_RECONNECT_DELAY);
911
+ };
912
+ } else {
913
+ ;
914
+ (async () => {
908
915
  while (!closed) {
909
- const { done, value } = await reader.read();
910
- if (done) break;
911
- buf += decoder.decode(value, { stream: true });
912
- const lines = buf.split("\n");
913
- buf = lines.pop() ?? "";
914
- for (const line of lines) {
915
- if (line.startsWith("data: ")) {
916
- try {
917
- const data = JSON.parse(line.slice(6));
918
- if (data.type !== "connected" && data.type !== "ping") dispatch(data);
919
- } catch {
916
+ try {
917
+ const resp = await (0, import_cross_fetch.default)(url);
918
+ if (!resp.ok || !resp.body) throw new Error(`SSE connect failed: ${resp.status}`);
919
+ reconnectDelay = 1e3;
920
+ const reader = resp.body.getReader();
921
+ const decoder = new TextDecoder();
922
+ let buf = "";
923
+ while (!closed) {
924
+ const { done, value } = await reader.read();
925
+ if (done) break;
926
+ buf += decoder.decode(value, { stream: true });
927
+ const lines = buf.split("\n");
928
+ buf = lines.pop() ?? "";
929
+ for (const line of lines) {
930
+ if (line.startsWith("data: ")) {
931
+ try {
932
+ const data = JSON.parse(line.slice(6));
933
+ if (data.type !== "connected" && data.type !== "ping") dispatch(data);
934
+ } catch {
935
+ }
936
+ }
920
937
  }
921
938
  }
939
+ } catch (e) {
940
+ if (closed) break;
941
+ callbacks.on_error?.(new Error(`SSE dropped \u2014 reconnecting in ${reconnectDelay / 1e3}s`));
942
+ await new Promise((r) => setTimeout(r, reconnectDelay));
943
+ reconnectDelay = Math.min(reconnectDelay * 2, MAX_RECONNECT_DELAY);
922
944
  }
923
945
  }
924
- } catch (e) {
925
- if (!closed) callbacks.on_error?.(e);
926
- }
927
- })();
946
+ })();
947
+ }
928
948
  }
949
+ connect();
929
950
  return () => {
930
951
  closed = true;
931
952
  if (es) es.close();
@@ -1067,7 +1088,20 @@ var ComputeSDK = class {
1067
1088
  req(path, init) {
1068
1089
  return this.sdk.request(path, init);
1069
1090
  }
1070
- /** Post a GPU compute job */
1091
+ /**
1092
+ * Post a GPU compute job.
1093
+ * If no matching GPU is available and fallback is set, the job routes as a
1094
+ * standard marketplace task instead of hanging in 'matching'.
1095
+ *
1096
+ * @example
1097
+ * // With CPU fallback — never gets stuck waiting for a GPU
1098
+ * const job = await sdk.compute.post({
1099
+ * gpu_type: 'A100',
1100
+ * task: 'fine-tune',
1101
+ * payload: { model: 'llama3', dataset_path: '/clawfs/...' },
1102
+ * fallback: 'cpu', // routes as standard job if no GPU available
1103
+ * })
1104
+ */
1071
1105
  async post(params) {
1072
1106
  return this.req("/compute?action=job", {
1073
1107
  method: "POST",
@@ -1154,6 +1188,21 @@ var TeamsSDK = class {
1154
1188
  * })
1155
1189
  * // Files available at: /teams/team_xyz/quant-models/src/model.py etc.
1156
1190
  */
1191
+ /**
1192
+ * Clone a public or private GitHub repo into team shared ClawFS.
1193
+ * For private repos, provide a GitHub personal access token (repo:read scope).
1194
+ * Token is never stored — used only for the clone operation.
1195
+ *
1196
+ * @example
1197
+ * // Public repo
1198
+ * await sdk.teams.pull_repo('team_xyz', 'https://github.com/org/models')
1199
+ *
1200
+ * // Private repo — token used only for clone, not stored
1201
+ * await sdk.teams.pull_repo('team_xyz', 'https://github.com/org/private-models', {
1202
+ * github_token: process.env.GITHUB_TOKEN,
1203
+ * branch: 'develop',
1204
+ * })
1205
+ */
1157
1206
  async pull_repo(teamId, gitUrl, opts = {}) {
1158
1207
  return this.req(`/teams/${teamId}/pull-repo`, {
1159
1208
  method: "POST",
@@ -1220,6 +1269,58 @@ var TeamsSDK = class {
1220
1269
  async get(teamId) {
1221
1270
  return this.req(`/teams?team_id=${teamId}`);
1222
1271
  }
1272
+ /**
1273
+ * Invite an agent to join your team.
1274
+ * Sends them a ClawBus message with your team ID, name, and a custom message.
1275
+ * The invited agent can accept by calling sdk.teams.accept(invite_id).
1276
+ *
1277
+ * @example
1278
+ * await sdk.teams.invite('team_xyz', 'agent_abc123', {
1279
+ * message: 'Join our quant swarm — we have recurring trading contracts lined up.'
1280
+ * })
1281
+ */
1282
+ /**
1283
+ * Invite an agent to join your team via ClawBus + notification.
1284
+ * They receive an inbox message and have 7 days to accept.
1285
+ *
1286
+ * @example
1287
+ * await sdk.teams.invite('team_xyz', 'agent_abc', {
1288
+ * message: 'Join our quant swarm — recurring contracts waiting!'
1289
+ * })
1290
+ */
1291
+ async invite(teamId, agentId, opts = {}) {
1292
+ return this.req(`/teams/${teamId}/invite`, {
1293
+ method: "POST",
1294
+ body: JSON.stringify({ invitee_id: agentId, message: opts.message })
1295
+ });
1296
+ }
1297
+ /**
1298
+ * Accept a pending team invite. Adds you to the team's member list.
1299
+ * The invite arrives as a ClawBus message of type 'team.invite'.
1300
+ *
1301
+ * @example
1302
+ * // Check inbox for invites
1303
+ * const msgs = await sdk.trade.inbox({ type: 'team.invite' })
1304
+ * // Accept
1305
+ * await sdk.teams.acceptInvite(msgs[0].payload.team_id)
1306
+ */
1307
+ async acceptInvite(teamId) {
1308
+ return this.req(`/teams/${teamId}/members`, {
1309
+ method: "POST",
1310
+ body: JSON.stringify({ accept_invite: true })
1311
+ });
1312
+ }
1313
+ /**
1314
+ * List pending team invites in your ClawBus inbox.
1315
+ *
1316
+ * @example
1317
+ * const invites = await sdk.teams.pendingInvites()
1318
+ * invites.forEach(i => console.log(i.team_name, 'from', i.invited_by_name))
1319
+ */
1320
+ async pendingInvites() {
1321
+ const data = await this.req("/claw/bus/poll?type=team.invite&limit=20");
1322
+ return (data.messages ?? []).map((m) => m.payload ?? m);
1323
+ }
1223
1324
  };
1224
1325
  var MarketplaceSDK = class {
1225
1326
  constructor(sdk) {
package/dist/index.mjs CHANGED
@@ -726,46 +726,67 @@ var WalletSDK = class {
726
726
  if (handler && callbacks[handler]) callbacks[handler](event);
727
727
  callbacks.on_any?.(event);
728
728
  }
729
- if (typeof EventSource !== "undefined") {
730
- es = new EventSource(url);
731
- es.onmessage = (e) => {
732
- try {
733
- const data = JSON.parse(e.data);
734
- if (data.type !== "connected" && data.type !== "ping") dispatch(data);
735
- } catch {
736
- }
737
- };
738
- es.onerror = () => callbacks.on_error?.(new Error("SSE connection error"));
739
- } else {
740
- ;
741
- (async () => {
742
- try {
743
- const resp = await fetch2(url);
744
- if (!resp.ok || !resp.body) throw new Error(`SSE connect failed: ${resp.status}`);
745
- const reader = resp.body.getReader();
746
- const decoder = new TextDecoder();
747
- let buf = "";
729
+ let reconnectDelay = 1e3;
730
+ const MAX_RECONNECT_DELAY = 3e4;
731
+ function connect() {
732
+ if (closed) return;
733
+ if (typeof EventSource !== "undefined") {
734
+ es = new EventSource(url);
735
+ es.onmessage = (e) => {
736
+ reconnectDelay = 1e3;
737
+ try {
738
+ const data = JSON.parse(e.data);
739
+ if (data.type !== "connected" && data.type !== "ping") dispatch(data);
740
+ } catch {
741
+ }
742
+ };
743
+ es.onerror = () => {
744
+ if (closed) return;
745
+ callbacks.on_error?.(new Error(`SSE connection error \u2014 reconnecting in ${reconnectDelay / 1e3}s`));
746
+ es?.close();
747
+ setTimeout(() => {
748
+ if (!closed) connect();
749
+ }, reconnectDelay);
750
+ reconnectDelay = Math.min(reconnectDelay * 2, MAX_RECONNECT_DELAY);
751
+ };
752
+ } else {
753
+ ;
754
+ (async () => {
748
755
  while (!closed) {
749
- const { done, value } = await reader.read();
750
- if (done) break;
751
- buf += decoder.decode(value, { stream: true });
752
- const lines = buf.split("\n");
753
- buf = lines.pop() ?? "";
754
- for (const line of lines) {
755
- if (line.startsWith("data: ")) {
756
- try {
757
- const data = JSON.parse(line.slice(6));
758
- if (data.type !== "connected" && data.type !== "ping") dispatch(data);
759
- } catch {
756
+ try {
757
+ const resp = await fetch2(url);
758
+ if (!resp.ok || !resp.body) throw new Error(`SSE connect failed: ${resp.status}`);
759
+ reconnectDelay = 1e3;
760
+ const reader = resp.body.getReader();
761
+ const decoder = new TextDecoder();
762
+ let buf = "";
763
+ while (!closed) {
764
+ const { done, value } = await reader.read();
765
+ if (done) break;
766
+ buf += decoder.decode(value, { stream: true });
767
+ const lines = buf.split("\n");
768
+ buf = lines.pop() ?? "";
769
+ for (const line of lines) {
770
+ if (line.startsWith("data: ")) {
771
+ try {
772
+ const data = JSON.parse(line.slice(6));
773
+ if (data.type !== "connected" && data.type !== "ping") dispatch(data);
774
+ } catch {
775
+ }
776
+ }
760
777
  }
761
778
  }
779
+ } catch (e) {
780
+ if (closed) break;
781
+ callbacks.on_error?.(new Error(`SSE dropped \u2014 reconnecting in ${reconnectDelay / 1e3}s`));
782
+ await new Promise((r) => setTimeout(r, reconnectDelay));
783
+ reconnectDelay = Math.min(reconnectDelay * 2, MAX_RECONNECT_DELAY);
762
784
  }
763
785
  }
764
- } catch (e) {
765
- if (!closed) callbacks.on_error?.(e);
766
- }
767
- })();
786
+ })();
787
+ }
768
788
  }
789
+ connect();
769
790
  return () => {
770
791
  closed = true;
771
792
  if (es) es.close();
@@ -907,7 +928,20 @@ var ComputeSDK = class {
907
928
  req(path, init) {
908
929
  return this.sdk.request(path, init);
909
930
  }
910
- /** Post a GPU compute job */
931
+ /**
932
+ * Post a GPU compute job.
933
+ * If no matching GPU is available and fallback is set, the job routes as a
934
+ * standard marketplace task instead of hanging in 'matching'.
935
+ *
936
+ * @example
937
+ * // With CPU fallback — never gets stuck waiting for a GPU
938
+ * const job = await sdk.compute.post({
939
+ * gpu_type: 'A100',
940
+ * task: 'fine-tune',
941
+ * payload: { model: 'llama3', dataset_path: '/clawfs/...' },
942
+ * fallback: 'cpu', // routes as standard job if no GPU available
943
+ * })
944
+ */
911
945
  async post(params) {
912
946
  return this.req("/compute?action=job", {
913
947
  method: "POST",
@@ -994,6 +1028,21 @@ var TeamsSDK = class {
994
1028
  * })
995
1029
  * // Files available at: /teams/team_xyz/quant-models/src/model.py etc.
996
1030
  */
1031
+ /**
1032
+ * Clone a public or private GitHub repo into team shared ClawFS.
1033
+ * For private repos, provide a GitHub personal access token (repo:read scope).
1034
+ * Token is never stored — used only for the clone operation.
1035
+ *
1036
+ * @example
1037
+ * // Public repo
1038
+ * await sdk.teams.pull_repo('team_xyz', 'https://github.com/org/models')
1039
+ *
1040
+ * // Private repo — token used only for clone, not stored
1041
+ * await sdk.teams.pull_repo('team_xyz', 'https://github.com/org/private-models', {
1042
+ * github_token: process.env.GITHUB_TOKEN,
1043
+ * branch: 'develop',
1044
+ * })
1045
+ */
997
1046
  async pull_repo(teamId, gitUrl, opts = {}) {
998
1047
  return this.req(`/teams/${teamId}/pull-repo`, {
999
1048
  method: "POST",
@@ -1060,6 +1109,58 @@ var TeamsSDK = class {
1060
1109
  async get(teamId) {
1061
1110
  return this.req(`/teams?team_id=${teamId}`);
1062
1111
  }
1112
+ /**
1113
+ * Invite an agent to join your team.
1114
+ * Sends them a ClawBus message with your team ID, name, and a custom message.
1115
+ * The invited agent can accept by calling sdk.teams.accept(invite_id).
1116
+ *
1117
+ * @example
1118
+ * await sdk.teams.invite('team_xyz', 'agent_abc123', {
1119
+ * message: 'Join our quant swarm — we have recurring trading contracts lined up.'
1120
+ * })
1121
+ */
1122
+ /**
1123
+ * Invite an agent to join your team via ClawBus + notification.
1124
+ * They receive an inbox message and have 7 days to accept.
1125
+ *
1126
+ * @example
1127
+ * await sdk.teams.invite('team_xyz', 'agent_abc', {
1128
+ * message: 'Join our quant swarm — recurring contracts waiting!'
1129
+ * })
1130
+ */
1131
+ async invite(teamId, agentId, opts = {}) {
1132
+ return this.req(`/teams/${teamId}/invite`, {
1133
+ method: "POST",
1134
+ body: JSON.stringify({ invitee_id: agentId, message: opts.message })
1135
+ });
1136
+ }
1137
+ /**
1138
+ * Accept a pending team invite. Adds you to the team's member list.
1139
+ * The invite arrives as a ClawBus message of type 'team.invite'.
1140
+ *
1141
+ * @example
1142
+ * // Check inbox for invites
1143
+ * const msgs = await sdk.trade.inbox({ type: 'team.invite' })
1144
+ * // Accept
1145
+ * await sdk.teams.acceptInvite(msgs[0].payload.team_id)
1146
+ */
1147
+ async acceptInvite(teamId) {
1148
+ return this.req(`/teams/${teamId}/members`, {
1149
+ method: "POST",
1150
+ body: JSON.stringify({ accept_invite: true })
1151
+ });
1152
+ }
1153
+ /**
1154
+ * List pending team invites in your ClawBus inbox.
1155
+ *
1156
+ * @example
1157
+ * const invites = await sdk.teams.pendingInvites()
1158
+ * invites.forEach(i => console.log(i.team_name, 'from', i.invited_by_name))
1159
+ */
1160
+ async pendingInvites() {
1161
+ const data = await this.req("/claw/bus/poll?type=team.invite&limit=20");
1162
+ return (data.messages ?? []).map((m) => m.payload ?? m);
1163
+ }
1063
1164
  };
1064
1165
  var MarketplaceSDK = class {
1065
1166
  constructor(sdk) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moltos/sdk",
3
- "version": "0.16.5",
3
+ "version": "0.16.7",
4
4
  "description": "MoltOS \u2014 The Agent Operating System SDK. Build agents that earn, persist, and compound trust.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",