@agentforge-io/sdk-console 0.0.0-stage → 0.2.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.
Files changed (40) hide show
  1. package/README.md +172 -2
  2. package/dist/client.d.ts +43 -0
  3. package/dist/client.js +58 -0
  4. package/dist/errors.d.ts +25 -0
  5. package/dist/errors.js +93 -0
  6. package/dist/http.d.ts +76 -0
  7. package/dist/http.js +289 -0
  8. package/dist/index.d.ts +20 -0
  9. package/dist/index.js +57 -0
  10. package/dist/oauth.d.ts +37 -0
  11. package/dist/oauth.js +97 -0
  12. package/dist/resources/agents.d.ts +40 -0
  13. package/dist/resources/agents.js +67 -0
  14. package/dist/resources/apps.d.ts +16 -0
  15. package/dist/resources/apps.js +26 -0
  16. package/dist/resources/auth.d.ts +50 -0
  17. package/dist/resources/auth.js +87 -0
  18. package/dist/resources/connectors.d.ts +25 -0
  19. package/dist/resources/connectors.js +47 -0
  20. package/dist/resources/marketplace.d.ts +10 -0
  21. package/dist/resources/marketplace.js +14 -0
  22. package/dist/resources/members.d.ts +62 -0
  23. package/dist/resources/members.js +85 -0
  24. package/dist/resources/playground.d.ts +22 -0
  25. package/dist/resources/playground.js +32 -0
  26. package/dist/resources/teams.d.ts +49 -0
  27. package/dist/resources/teams.js +78 -0
  28. package/dist/resources/templates.d.ts +115 -0
  29. package/dist/resources/templates.js +187 -0
  30. package/dist/resources/tenants.d.ts +12 -0
  31. package/dist/resources/tenants.js +25 -0
  32. package/dist/resources/tools.d.ts +13 -0
  33. package/dist/resources/tools.js +17 -0
  34. package/dist/resources/variables.d.ts +28 -0
  35. package/dist/resources/variables.js +43 -0
  36. package/dist/token-store.d.ts +23 -0
  37. package/dist/token-store.js +27 -0
  38. package/dist/types.d.ts +1009 -0
  39. package/dist/types.js +19 -0
  40. package/package.json +44 -4
@@ -0,0 +1,50 @@
1
+ import { type HttpCore } from '../http';
2
+ import type { AuthResult, AuthStrategies, AuthUser, LoginInput, RegisterInput } from '../types';
3
+ export declare class AuthResource {
4
+ private readonly http;
5
+ constructor(http: HttpCore);
6
+ /** `POST /auth/register`. Stores the session. */
7
+ register(input: RegisterInput): Promise<AuthResult>;
8
+ /** `POST /auth/login`. Stores the session. 403 `captcha_failed` when the
9
+ * server enforces Turnstile and no `captchaToken` was sent. */
10
+ login(input: LoginInput): Promise<AuthResult>;
11
+ /**
12
+ * Start a browser OAuth sign-in (PKCE). Builds `GET /auth/:provider?returnTo=&codeChallenge=`
13
+ * (no network call): open `url` in the browser, keep `codeVerifier` (in
14
+ * memory / sessionStorage), and when the browser lands on `returnTo#code=...`
15
+ * call `oauthComplete`. `returnTo` must be in the server allow-list, else
16
+ * opening `url` answers 400 `return_to_not_allowed`. Needs a global WebCrypto
17
+ * or the `crypto` client option; throws otherwise.
18
+ */
19
+ oauthStart(provider: 'google' | 'github' | (string & {}), input: {
20
+ returnTo: string;
21
+ }): Promise<{
22
+ url: string;
23
+ codeVerifier: string;
24
+ }>;
25
+ /** `POST /auth/oauth/exchange` (public): trade the one-time `code` from the
26
+ * redirect + the `codeVerifier` from `oauthStart` for a session. Stores it
27
+ * like `login`. 400 `invalid_grant` when expired, reused or mismatched. */
28
+ oauthComplete(input: {
29
+ code: string;
30
+ codeVerifier: string;
31
+ }): Promise<AuthResult>;
32
+ /** `POST /auth/refresh` with the stored refresh token (single-flight with
33
+ * the automatic refresh). Rotates and stores the new pair. Not needed in
34
+ * normal use: a 401 refreshes by itself. */
35
+ refresh(): Promise<{
36
+ accessToken: string;
37
+ refreshToken: string;
38
+ }>;
39
+ /** `POST /auth/logout` (a stateless no-op server-side), then wipes the
40
+ * stored tokens even if the call fails. Does not fire `onSignedOut`. */
41
+ logout(): Promise<void>;
42
+ /** `GET /auth/me` */
43
+ me(): Promise<AuthUser>;
44
+ /** `POST /auth/me/onboarding/complete` (idempotent). */
45
+ completeOnboarding(): Promise<void>;
46
+ /** `POST /auth/me/onboarding/reopen` (idempotent). */
47
+ reopenOnboarding(): Promise<void>;
48
+ /** `GET /auth/strategies` (public): which sign-in methods the server has configured. */
49
+ strategies(): Promise<AuthStrategies>;
50
+ }
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ // auth: dashboard-session auth. Tokens go through the TokenStore; callers never
3
+ // touch them. Routes: apps/server identity AuthController / OAuthController.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.AuthResource = void 0;
6
+ const http_1 = require("../http");
7
+ const oauth_1 = require("../oauth");
8
+ class AuthResource {
9
+ constructor(http) {
10
+ this.http = http;
11
+ }
12
+ /** `POST /auth/register`. Stores the session. */
13
+ async register(input) {
14
+ const res = await this.http.request('POST', '/auth/register', { body: input, auth: false });
15
+ await this.http.setSession(res);
16
+ return res;
17
+ }
18
+ /** `POST /auth/login`. Stores the session. 403 `captcha_failed` when the
19
+ * server enforces Turnstile and no `captchaToken` was sent. */
20
+ async login(input) {
21
+ const res = await this.http.request('POST', '/auth/login', { body: input, auth: false });
22
+ await this.http.setSession(res);
23
+ return res;
24
+ }
25
+ /**
26
+ * Start a browser OAuth sign-in (PKCE). Builds `GET /auth/:provider?returnTo=&codeChallenge=`
27
+ * (no network call): open `url` in the browser, keep `codeVerifier` (in
28
+ * memory / sessionStorage), and when the browser lands on `returnTo#code=...`
29
+ * call `oauthComplete`. `returnTo` must be in the server allow-list, else
30
+ * opening `url` answers 400 `return_to_not_allowed`. Needs a global WebCrypto
31
+ * or the `crypto` client option; throws otherwise.
32
+ */
33
+ async oauthStart(provider, input) {
34
+ if (!input?.returnTo)
35
+ throw new Error('returnTo is required');
36
+ const crypto = (0, oauth_1.resolveCrypto)(this.http.crypto);
37
+ const codeVerifier = (0, oauth_1.generateCodeVerifier)(crypto);
38
+ const codeChallenge = await (0, oauth_1.codeChallengeS256)(crypto, codeVerifier);
39
+ const query = (0, http_1.buildQuery)({ returnTo: input.returnTo, codeChallenge });
40
+ return { url: `${this.http.baseURL}/auth/${(0, http_1.seg)(provider)}${query}`, codeVerifier };
41
+ }
42
+ /** `POST /auth/oauth/exchange` (public): trade the one-time `code` from the
43
+ * redirect + the `codeVerifier` from `oauthStart` for a session. Stores it
44
+ * like `login`. 400 `invalid_grant` when expired, reused or mismatched. */
45
+ async oauthComplete(input) {
46
+ const res = await this.http.request('POST', '/auth/oauth/exchange', {
47
+ body: { code: input.code, codeVerifier: input.codeVerifier },
48
+ auth: false,
49
+ });
50
+ await this.http.setSession(res);
51
+ return res;
52
+ }
53
+ /** `POST /auth/refresh` with the stored refresh token (single-flight with
54
+ * the automatic refresh). Rotates and stores the new pair. Not needed in
55
+ * normal use: a 401 refreshes by itself. */
56
+ async refresh() {
57
+ return this.http.refreshNow();
58
+ }
59
+ /** `POST /auth/logout` (a stateless no-op server-side), then wipes the
60
+ * stored tokens even if the call fails. Does not fire `onSignedOut`. */
61
+ async logout() {
62
+ this.http.beginSessionChange();
63
+ try {
64
+ await this.http.request('POST', '/auth/logout');
65
+ }
66
+ finally {
67
+ await this.http.clearSession();
68
+ }
69
+ }
70
+ /** `GET /auth/me` */
71
+ async me() {
72
+ return this.http.request('GET', '/auth/me');
73
+ }
74
+ /** `POST /auth/me/onboarding/complete` (idempotent). */
75
+ async completeOnboarding() {
76
+ await this.http.request('POST', '/auth/me/onboarding/complete');
77
+ }
78
+ /** `POST /auth/me/onboarding/reopen` (idempotent). */
79
+ async reopenOnboarding() {
80
+ await this.http.request('POST', '/auth/me/onboarding/reopen');
81
+ }
82
+ /** `GET /auth/strategies` (public): which sign-in methods the server has configured. */
83
+ async strategies() {
84
+ return this.http.request('GET', '/auth/strategies', { auth: false });
85
+ }
86
+ }
87
+ exports.AuthResource = AuthResource;
@@ -0,0 +1,25 @@
1
+ import type { HttpCore } from '../http';
2
+ import type { AuthorizeConnectorInput, ConnectorFacets, ConnectorStatus, ListConnectorsInput } from '../types';
3
+ export declare class ConnectorsResource {
4
+ private readonly http;
5
+ private readonly tenantId;
6
+ constructor(http: HttpCore, tenantId: string);
7
+ private get tenantHeader();
8
+ /** `GET /connectors/oauth/directory` */
9
+ directory(input?: ListConnectorsInput): Promise<{
10
+ items: ConnectorStatus[];
11
+ }>;
12
+ /** `GET /connectors/oauth/directory/facets` */
13
+ facets(): Promise<ConnectorFacets>;
14
+ /** `POST /connectors/oauth/:id/authorize?tenantId=&postAuthRedirect=`:
15
+ * returns the provider consent URL to open in a browser; the grant is
16
+ * stored for this workspace. Owner/admin only. */
17
+ authorize(connectorId: string, input: AuthorizeConnectorInput): Promise<{
18
+ url: string;
19
+ }>;
20
+ /** `POST /connectors/oauth/:id/api-key?tenantId=` for `authKind: 'api_key'`
21
+ * connectors. The server pings the provider first (401 on a bad key). */
22
+ saveApiKey(connectorId: string, apiKey: string): Promise<{
23
+ connectorId: string;
24
+ }>;
25
+ }
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ // connectors for one workspace (`forTenant(id).connectors`): the directory
3
+ // with per-workspace `connected` flags, and the OAuth / API-key connect flow.
4
+ //
5
+ // The directory resolves the workspace from the `X-Tenant-Id` header (the JWT
6
+ // carries no tenant), so these calls send it. A browser therefore needs CORS
7
+ // to allow that header.
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.ConnectorsResource = void 0;
10
+ const http_1 = require("../http");
11
+ class ConnectorsResource {
12
+ constructor(http, tenantId) {
13
+ this.http = http;
14
+ this.tenantId = tenantId;
15
+ }
16
+ get tenantHeader() {
17
+ return { 'X-Tenant-Id': this.tenantId };
18
+ }
19
+ /** `GET /connectors/oauth/directory` */
20
+ async directory(input = {}) {
21
+ return this.http.request('GET', '/connectors/oauth/directory', {
22
+ query: { ...input },
23
+ headers: this.tenantHeader,
24
+ });
25
+ }
26
+ /** `GET /connectors/oauth/directory/facets` */
27
+ async facets() {
28
+ return this.http.request('GET', '/connectors/oauth/directory/facets', { headers: this.tenantHeader });
29
+ }
30
+ /** `POST /connectors/oauth/:id/authorize?tenantId=&postAuthRedirect=`:
31
+ * returns the provider consent URL to open in a browser; the grant is
32
+ * stored for this workspace. Owner/admin only. */
33
+ async authorize(connectorId, input) {
34
+ return this.http.request('POST', `/connectors/oauth/${(0, http_1.seg)(connectorId)}/authorize`, {
35
+ query: { postAuthRedirect: input.postAuthRedirect, tenantId: this.tenantId, shop: input.shop },
36
+ });
37
+ }
38
+ /** `POST /connectors/oauth/:id/api-key?tenantId=` for `authKind: 'api_key'`
39
+ * connectors. The server pings the provider first (401 on a bad key). */
40
+ async saveApiKey(connectorId, apiKey) {
41
+ return this.http.request('POST', `/connectors/oauth/${(0, http_1.seg)(connectorId)}/api-key`, {
42
+ query: { tenantId: this.tenantId },
43
+ body: { apiKey },
44
+ });
45
+ }
46
+ }
47
+ exports.ConnectorsResource = ConnectorsResource;
@@ -0,0 +1,10 @@
1
+ import type { HttpCore } from '../http';
2
+ import type { MarketplaceCategory } from '../types';
3
+ export declare class MarketplaceResource {
4
+ private readonly http;
5
+ constructor(http: HttpCore);
6
+ /** `GET /marketplace/categories` */
7
+ categories(): Promise<{
8
+ items: MarketplaceCategory[];
9
+ }>;
10
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ // marketplace: listing taxonomy. `client.marketplace`.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.MarketplaceResource = void 0;
5
+ class MarketplaceResource {
6
+ constructor(http) {
7
+ this.http = http;
8
+ }
9
+ /** `GET /marketplace/categories` */
10
+ async categories() {
11
+ return this.http.request('GET', '/marketplace/categories');
12
+ }
13
+ }
14
+ exports.MarketplaceResource = MarketplaceResource;
@@ -0,0 +1,62 @@
1
+ import type { HttpCore } from '../http';
2
+ import type { AcceptInviteInput, AuthResult, CreateInviteInput, InvitePreview, TenantInvite, TenantMember } from '../types';
3
+ export declare class MembersResource {
4
+ private readonly http;
5
+ private readonly tenantId;
6
+ constructor(http: HttpCore, tenantId: string);
7
+ private get base();
8
+ /** `GET /admin/tenants/:tenantId/members` (the owner comes with `id: null`). */
9
+ list(): Promise<{
10
+ items: TenantMember[];
11
+ }>;
12
+ /** `POST .../members`. The email must already belong to a registered user
13
+ * (404 otherwise): use `invites.create` for an unregistered one. Owner/admin only. */
14
+ add(input: {
15
+ email: string;
16
+ role?: 'member' | 'admin';
17
+ }): Promise<TenantMember>;
18
+ /** `PATCH .../members/:membershipId` (membershipId = `TenantMember.id`). Owner/admin only. */
19
+ updateRole(membershipId: string, role: 'member' | 'admin'): Promise<{
20
+ ok: true;
21
+ }>;
22
+ /** `DELETE .../members/:membershipId`. Owner/admin only. */
23
+ remove(membershipId: string): Promise<void>;
24
+ /** `POST .../members/transfer-ownership`. Owner only; the target must be a
25
+ * member. The former owner becomes admin. */
26
+ transferOwnership(input: {
27
+ toUserId?: string;
28
+ toEmail?: string;
29
+ }): Promise<void>;
30
+ }
31
+ /** Public side of invites: no session needed. `client.invites`. */
32
+ export declare class PublicInvitesResource {
33
+ protected readonly http: HttpCore;
34
+ constructor(http: HttpCore);
35
+ /** `GET /invite/:token` (public). */
36
+ getByToken(token: string): Promise<InvitePreview>;
37
+ /** `POST /invite/:token/accept` (public). Creates the account, joins the
38
+ * workspace and stores the new session. */
39
+ accept(token: string, input: AcceptInviteInput): Promise<AuthResult>;
40
+ }
41
+ /** `forTenant(id).invites`: the admin side plus the public lookups. */
42
+ export declare class InvitesResource extends PublicInvitesResource {
43
+ private readonly tenantId;
44
+ constructor(http: HttpCore, tenantId: string);
45
+ private get base();
46
+ /** `GET /admin/tenants/:tenantId/invites` (pending). */
47
+ list(): Promise<{
48
+ items: TenantInvite[];
49
+ }>;
50
+ /** `POST .../invites` */
51
+ create(input: CreateInviteInput): Promise<{
52
+ status: 'invited';
53
+ invite: TenantInvite;
54
+ }>;
55
+ /** `POST .../invites/:inviteId/resend` */
56
+ resend(inviteId: string): Promise<{
57
+ status: 'resent';
58
+ invite: TenantInvite;
59
+ }>;
60
+ /** `DELETE .../invites/:inviteId` */
61
+ revoke(inviteId: string): Promise<void>;
62
+ }
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ // members + invites of one workspace (`forTenant(id).members` / `.invites`).
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.InvitesResource = exports.PublicInvitesResource = exports.MembersResource = void 0;
5
+ const http_1 = require("../http");
6
+ class MembersResource {
7
+ constructor(http, tenantId) {
8
+ this.http = http;
9
+ this.tenantId = tenantId;
10
+ }
11
+ get base() {
12
+ return `/admin/tenants/${(0, http_1.seg)(this.tenantId)}/members`;
13
+ }
14
+ /** `GET /admin/tenants/:tenantId/members` (the owner comes with `id: null`). */
15
+ async list() {
16
+ return this.http.request('GET', this.base);
17
+ }
18
+ /** `POST .../members`. The email must already belong to a registered user
19
+ * (404 otherwise): use `invites.create` for an unregistered one. Owner/admin only. */
20
+ async add(input) {
21
+ return this.http.request('POST', this.base, { body: input });
22
+ }
23
+ /** `PATCH .../members/:membershipId` (membershipId = `TenantMember.id`). Owner/admin only. */
24
+ async updateRole(membershipId, role) {
25
+ return this.http.request('PATCH', `${this.base}/${(0, http_1.seg)(membershipId)}`, { body: { role } });
26
+ }
27
+ /** `DELETE .../members/:membershipId`. Owner/admin only. */
28
+ async remove(membershipId) {
29
+ await this.http.request('DELETE', `${this.base}/${(0, http_1.seg)(membershipId)}`);
30
+ }
31
+ /** `POST .../members/transfer-ownership`. Owner only; the target must be a
32
+ * member. The former owner becomes admin. */
33
+ async transferOwnership(input) {
34
+ await this.http.request('POST', `${this.base}/transfer-ownership`, { body: input });
35
+ }
36
+ }
37
+ exports.MembersResource = MembersResource;
38
+ /** Public side of invites: no session needed. `client.invites`. */
39
+ class PublicInvitesResource {
40
+ constructor(http) {
41
+ this.http = http;
42
+ }
43
+ /** `GET /invite/:token` (public). */
44
+ async getByToken(token) {
45
+ return this.http.request('GET', `/invite/${(0, http_1.seg)(token)}`, { auth: false });
46
+ }
47
+ /** `POST /invite/:token/accept` (public). Creates the account, joins the
48
+ * workspace and stores the new session. */
49
+ async accept(token, input) {
50
+ const res = await this.http.request('POST', `/invite/${(0, http_1.seg)(token)}/accept`, {
51
+ body: input,
52
+ auth: false,
53
+ });
54
+ await this.http.setSession(res);
55
+ return res;
56
+ }
57
+ }
58
+ exports.PublicInvitesResource = PublicInvitesResource;
59
+ /** `forTenant(id).invites`: the admin side plus the public lookups. */
60
+ class InvitesResource extends PublicInvitesResource {
61
+ constructor(http, tenantId) {
62
+ super(http);
63
+ this.tenantId = tenantId;
64
+ }
65
+ get base() {
66
+ return `/admin/tenants/${(0, http_1.seg)(this.tenantId)}/invites`;
67
+ }
68
+ /** `GET /admin/tenants/:tenantId/invites` (pending). */
69
+ async list() {
70
+ return this.http.request('GET', this.base);
71
+ }
72
+ /** `POST .../invites` */
73
+ async create(input) {
74
+ return this.http.request('POST', this.base, { body: input });
75
+ }
76
+ /** `POST .../invites/:inviteId/resend` */
77
+ async resend(inviteId) {
78
+ return this.http.request('POST', `${this.base}/${(0, http_1.seg)(inviteId)}/resend`);
79
+ }
80
+ /** `DELETE .../invites/:inviteId` */
81
+ async revoke(inviteId) {
82
+ await this.http.request('DELETE', `${this.base}/${(0, http_1.seg)(inviteId)}`);
83
+ }
84
+ }
85
+ exports.InvitesResource = InvitesResource;
@@ -0,0 +1,22 @@
1
+ import type { HttpCore } from '../http';
2
+ import type { PlaygroundRun, StartPlaygroundRunInput } from '../types';
3
+ export declare class PlaygroundResource {
4
+ private readonly http;
5
+ private readonly tenantId;
6
+ constructor(http: HttpCore, tenantId: string);
7
+ /** `GET /playgrounds/runs?tenantId=&teamId=&limit=` */
8
+ list(input?: {
9
+ teamId?: string;
10
+ limit?: number;
11
+ }): Promise<{
12
+ items: PlaygroundRun[];
13
+ }>;
14
+ /** `GET /playgrounds/runs/:id` */
15
+ get(runId: string): Promise<PlaygroundRun>;
16
+ /** `POST /playgrounds/runs`: creates a channel, joins the team and posts the scenario prompt. */
17
+ create(input: StartPlaygroundRunInput): Promise<PlaygroundRun>;
18
+ /** `POST /playgrounds/runs/:id/finalize` */
19
+ finalize(runId: string): Promise<PlaygroundRun>;
20
+ /** `POST /playgrounds/runs/:id/abort` */
21
+ abort(runId: string): Promise<PlaygroundRun>;
22
+ }
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ // playground: scripted test runs of a team (`forTenant(id).playground`).
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.PlaygroundResource = void 0;
5
+ const http_1 = require("../http");
6
+ class PlaygroundResource {
7
+ constructor(http, tenantId) {
8
+ this.http = http;
9
+ this.tenantId = tenantId;
10
+ }
11
+ /** `GET /playgrounds/runs?tenantId=&teamId=&limit=` */
12
+ async list(input = {}) {
13
+ return this.http.request('GET', '/playgrounds/runs', { query: { tenantId: this.tenantId, ...input } });
14
+ }
15
+ /** `GET /playgrounds/runs/:id` */
16
+ async get(runId) {
17
+ return this.http.request('GET', `/playgrounds/runs/${(0, http_1.seg)(runId)}`);
18
+ }
19
+ /** `POST /playgrounds/runs`: creates a channel, joins the team and posts the scenario prompt. */
20
+ async create(input) {
21
+ return this.http.request('POST', '/playgrounds/runs', { body: { tenantId: this.tenantId, ...input } });
22
+ }
23
+ /** `POST /playgrounds/runs/:id/finalize` */
24
+ async finalize(runId) {
25
+ return this.http.request('POST', `/playgrounds/runs/${(0, http_1.seg)(runId)}/finalize`);
26
+ }
27
+ /** `POST /playgrounds/runs/:id/abort` */
28
+ async abort(runId) {
29
+ return this.http.request('POST', `/playgrounds/runs/${(0, http_1.seg)(runId)}/abort`);
30
+ }
31
+ }
32
+ exports.PlaygroundResource = PlaygroundResource;
@@ -0,0 +1,49 @@
1
+ import type { HttpCore } from '../http';
2
+ import type { CreateTeamInput, Team, TeamHumanMember, TeamHumanMemberInput, TeamList, TeamPublication, TeamPublicationSummary, TeamWithMembers, UpdateTeamInput } from '../types';
3
+ export declare class TeamsResource {
4
+ private readonly http;
5
+ private readonly tenantId;
6
+ /** Workspace users attached to a team (human-in-the-loop roster). */
7
+ readonly humanMembers: TeamHumanMembersResource;
8
+ constructor(http: HttpCore, tenantId: string);
9
+ private get base();
10
+ /** `GET /admin/tenants/:tenantId/teams`. Each team carries `templateSourceOf`;
11
+ * `excludeTemplateSources: true` leaves out the template source copies. */
12
+ list(input?: {
13
+ appId?: string;
14
+ excludeTemplateSources?: boolean;
15
+ }): Promise<TeamList>;
16
+ /** `POST .../teams`. The server creates the orchestrator agent. */
17
+ create(input: CreateTeamInput): Promise<Team>;
18
+ /** `GET .../teams/:teamId` */
19
+ get(teamId: string): Promise<TeamWithMembers>;
20
+ /** `PATCH .../teams/:teamId`. `members` replaces the full ordered list. */
21
+ update(teamId: string, patch: UpdateTeamInput): Promise<Team>;
22
+ /** `DELETE .../teams/:teamId` */
23
+ delete(teamId: string): Promise<void>;
24
+ /** `GET .../teams/:teamId/publication`: status + validation issues. */
25
+ publication(teamId: string, input?: {
26
+ publisherAppId?: string;
27
+ }): Promise<TeamPublication>;
28
+ /** `GET .../teams/publication`: status of every team (no issues). */
29
+ listPublication(): Promise<{
30
+ items: TeamPublicationSummary[];
31
+ }>;
32
+ /** `POST .../teams/:teamId/publish`. 409 `team_not_publishable`
33
+ * (`ApiError.details.issues`) when the validation has errors. */
34
+ publish(teamId: string): Promise<TeamPublication>;
35
+ }
36
+ export declare class TeamHumanMembersResource {
37
+ private readonly http;
38
+ private readonly tenantId;
39
+ constructor(http: HttpCore, tenantId: string);
40
+ private base;
41
+ /** `GET .../teams/:teamId/human-members` */
42
+ list(teamId: string): Promise<TeamHumanMember[]>;
43
+ /** `POST .../teams/:teamId/human-members` */
44
+ add(teamId: string, input: TeamHumanMemberInput): Promise<TeamHumanMember>;
45
+ /** `PATCH .../human-members/:userId` */
46
+ update(teamId: string, userId: string, patch: Partial<Omit<TeamHumanMemberInput, 'userId'>>): Promise<TeamHumanMember>;
47
+ /** `DELETE .../human-members/:userId` */
48
+ remove(teamId: string, userId: string): Promise<void>;
49
+ }
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ // teams of one workspace (`forTenant(id).teams`).
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.TeamHumanMembersResource = exports.TeamsResource = void 0;
5
+ const http_1 = require("../http");
6
+ class TeamsResource {
7
+ constructor(http, tenantId) {
8
+ this.http = http;
9
+ this.tenantId = tenantId;
10
+ this.humanMembers = new TeamHumanMembersResource(http, tenantId);
11
+ }
12
+ get base() {
13
+ return `/admin/tenants/${(0, http_1.seg)(this.tenantId)}/teams`;
14
+ }
15
+ /** `GET /admin/tenants/:tenantId/teams`. Each team carries `templateSourceOf`;
16
+ * `excludeTemplateSources: true` leaves out the template source copies. */
17
+ async list(input = {}) {
18
+ return this.http.request('GET', this.base, { query: { ...input } });
19
+ }
20
+ /** `POST .../teams`. The server creates the orchestrator agent. */
21
+ async create(input) {
22
+ return this.http.request('POST', this.base, { body: input });
23
+ }
24
+ /** `GET .../teams/:teamId` */
25
+ async get(teamId) {
26
+ return this.http.request('GET', `${this.base}/${(0, http_1.seg)(teamId)}`);
27
+ }
28
+ /** `PATCH .../teams/:teamId`. `members` replaces the full ordered list. */
29
+ async update(teamId, patch) {
30
+ return this.http.request('PATCH', `${this.base}/${(0, http_1.seg)(teamId)}`, { body: patch });
31
+ }
32
+ /** `DELETE .../teams/:teamId` */
33
+ async delete(teamId) {
34
+ await this.http.request('DELETE', `${this.base}/${(0, http_1.seg)(teamId)}`);
35
+ }
36
+ /** `GET .../teams/:teamId/publication`: status + validation issues. */
37
+ async publication(teamId, input = {}) {
38
+ return this.http.request('GET', `${this.base}/${(0, http_1.seg)(teamId)}/publication`, {
39
+ query: { publisherAppId: input.publisherAppId },
40
+ });
41
+ }
42
+ /** `GET .../teams/publication`: status of every team (no issues). */
43
+ async listPublication() {
44
+ return this.http.request('GET', `${this.base}/publication`);
45
+ }
46
+ /** `POST .../teams/:teamId/publish`. 409 `team_not_publishable`
47
+ * (`ApiError.details.issues`) when the validation has errors. */
48
+ async publish(teamId) {
49
+ return this.http.request('POST', `${this.base}/${(0, http_1.seg)(teamId)}/publish`);
50
+ }
51
+ }
52
+ exports.TeamsResource = TeamsResource;
53
+ class TeamHumanMembersResource {
54
+ constructor(http, tenantId) {
55
+ this.http = http;
56
+ this.tenantId = tenantId;
57
+ }
58
+ base(teamId) {
59
+ return `/admin/tenants/${(0, http_1.seg)(this.tenantId)}/teams/${(0, http_1.seg)(teamId)}/human-members`;
60
+ }
61
+ /** `GET .../teams/:teamId/human-members` */
62
+ async list(teamId) {
63
+ return this.http.request('GET', this.base(teamId));
64
+ }
65
+ /** `POST .../teams/:teamId/human-members` */
66
+ async add(teamId, input) {
67
+ return this.http.request('POST', this.base(teamId), { body: input });
68
+ }
69
+ /** `PATCH .../human-members/:userId` */
70
+ async update(teamId, userId, patch) {
71
+ return this.http.request('PATCH', `${this.base(teamId)}/${(0, http_1.seg)(userId)}`, { body: patch });
72
+ }
73
+ /** `DELETE .../human-members/:userId` */
74
+ async remove(teamId, userId) {
75
+ await this.http.request('DELETE', `${this.base(teamId)}/${(0, http_1.seg)(userId)}`);
76
+ }
77
+ }
78
+ exports.TeamHumanMembersResource = TeamHumanMembersResource;