@agentforge-io/sdk-console 0.0.0-stage → 0.1.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/README.md +150 -2
- package/dist/client.d.ts +43 -0
- package/dist/client.js +58 -0
- package/dist/errors.d.ts +25 -0
- package/dist/errors.js +93 -0
- package/dist/http.d.ts +70 -0
- package/dist/http.js +288 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +55 -0
- package/dist/resources/agents.d.ts +40 -0
- package/dist/resources/agents.js +67 -0
- package/dist/resources/apps.d.ts +16 -0
- package/dist/resources/apps.js +26 -0
- package/dist/resources/auth.d.ts +29 -0
- package/dist/resources/auth.js +57 -0
- package/dist/resources/connectors.d.ts +25 -0
- package/dist/resources/connectors.js +47 -0
- package/dist/resources/marketplace.d.ts +10 -0
- package/dist/resources/marketplace.js +14 -0
- package/dist/resources/members.d.ts +62 -0
- package/dist/resources/members.js +85 -0
- package/dist/resources/playground.d.ts +22 -0
- package/dist/resources/playground.js +32 -0
- package/dist/resources/teams.d.ts +49 -0
- package/dist/resources/teams.js +78 -0
- package/dist/resources/templates.d.ts +115 -0
- package/dist/resources/templates.js +187 -0
- package/dist/resources/tenants.d.ts +12 -0
- package/dist/resources/tenants.js +25 -0
- package/dist/resources/tools.d.ts +13 -0
- package/dist/resources/tools.js +17 -0
- package/dist/resources/variables.d.ts +28 -0
- package/dist/resources/variables.js +43 -0
- package/dist/token-store.d.ts +23 -0
- package/dist/token-store.js +27 -0
- package/dist/types.d.ts +1009 -0
- package/dist/types.js +19 -0
- package/package.json +44 -4
|
@@ -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;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import type { HttpCore } from '../http';
|
|
2
|
+
import type { InstallTemplateInput, ListTemplatesInput, SaveTemplateInput, SignListingAssetInput, SignedUpload, Template, TemplateConfigField, TemplateConfigFields, TemplateInstallResult, TemplateListingPatch, TemplatePolicyCheck, TemplateReadiness, TemplateSourceStatus, TemplateVersionRow, TemplateVersionView, UpdateFromTemplateResult, UpdatesAvailable, VersionDiff, VersionHistory } from '../types';
|
|
3
|
+
export declare class TemplatesResource {
|
|
4
|
+
protected readonly http: HttpCore;
|
|
5
|
+
constructor(http: HttpCore);
|
|
6
|
+
/** `GET /public/templates`: system + public, listed rows only. */
|
|
7
|
+
listPublic(input?: Omit<ListTemplatesInput, 'publisherAppId'>): Promise<{
|
|
8
|
+
items: Template[];
|
|
9
|
+
}>;
|
|
10
|
+
/** `GET /public/templates/:id` (404 for tenant-private or unlisted rows). */
|
|
11
|
+
getPublic(templateId: string): Promise<Template>;
|
|
12
|
+
/** `GET /templates/:id` (with payload). */
|
|
13
|
+
get(templateId: string): Promise<Template>;
|
|
14
|
+
/** `PATCH /templates/:id`: metadata + listing (name, logo, cover, categories, guide, locale). */
|
|
15
|
+
updateListing(templateId: string, patch: TemplateListingPatch): Promise<Template>;
|
|
16
|
+
/** `GET /templates/:id/policy-check`: dry run of an App's template policy against a version
|
|
17
|
+
* (default: open draft, else published). `publisherAppId` defaults to the template's own publisher. */
|
|
18
|
+
policyCheck(templateId: string, input?: {
|
|
19
|
+
publisherAppId?: string;
|
|
20
|
+
version?: number;
|
|
21
|
+
}): Promise<TemplatePolicyCheck>;
|
|
22
|
+
/** `POST /templates/:id/listing-assets/sign`: PUT the bytes to `uploadUrl`, then `updateListing({ logoUrl | coverUrl: publicUrl })`. */
|
|
23
|
+
signListingAsset(templateId: string, input: SignListingAssetInput): Promise<SignedUpload>;
|
|
24
|
+
/** `GET /templates/:id/versions` (published snapshots). */
|
|
25
|
+
listVersions(templateId: string): Promise<{
|
|
26
|
+
items: TemplateVersionRow[];
|
|
27
|
+
}>;
|
|
28
|
+
/** `GET /templates/:id/version-history` */
|
|
29
|
+
versionHistory(templateId: string): Promise<VersionHistory>;
|
|
30
|
+
/** `GET /templates/:id/diff?from=&to=`; `to: 'source'` compares with the live source team. */
|
|
31
|
+
diff(templateId: string, from: number, to: number | 'source'): Promise<VersionDiff>;
|
|
32
|
+
/** `POST /templates/:id/drafts`: snapshot the source team as a new draft version. */
|
|
33
|
+
snapshotDraft(templateId: string): Promise<TemplateVersionView>;
|
|
34
|
+
/** `POST /templates/:id/versions/:v/submit`: draft -> in review. */
|
|
35
|
+
submitVersion(templateId: string, version: number, changelog: string): Promise<TemplateVersionView>;
|
|
36
|
+
/** `POST /templates/:id/versions/:v/review` */
|
|
37
|
+
reviewVersion(templateId: string, version: number, decision: 'approved' | 'changes_requested', comment?: string): Promise<TemplateVersionView>;
|
|
38
|
+
/** `POST /templates/:id/versions/:v/publish` */
|
|
39
|
+
publishVersion(templateId: string, version: number, changelog?: string): Promise<TemplateVersionView>;
|
|
40
|
+
/** `DELETE /templates/:id/versions/:v`: discard a draft. */
|
|
41
|
+
discardVersion(templateId: string, version: number): Promise<{
|
|
42
|
+
ok: true;
|
|
43
|
+
}>;
|
|
44
|
+
/** `POST /templates/:id/versions/:v/restore`: new draft from an old version. */
|
|
45
|
+
restoreVersion(templateId: string, version: number): Promise<TemplateVersionView>;
|
|
46
|
+
/** `PUT /templates/:id/source`: make a team of the template's workspace its source. */
|
|
47
|
+
linkSource(templateId: string, teamId: string): Promise<{
|
|
48
|
+
ok: true;
|
|
49
|
+
}>;
|
|
50
|
+
/** `DELETE /templates/:id/source` */
|
|
51
|
+
unlinkSource(templateId: string): Promise<{
|
|
52
|
+
ok: true;
|
|
53
|
+
}>;
|
|
54
|
+
/** `POST /templates/:id/source/copy`: create the editable copy from the published version and link it. */
|
|
55
|
+
createSourceCopy(templateId: string): Promise<{
|
|
56
|
+
teamId: string;
|
|
57
|
+
}>;
|
|
58
|
+
/** `PATCH /templates/:id/review-policy` */
|
|
59
|
+
setReviewPolicy(templateId: string, policy: {
|
|
60
|
+
requiredApprovals: number | null;
|
|
61
|
+
approverUserIds: string[] | null;
|
|
62
|
+
}): Promise<{
|
|
63
|
+
ok: true;
|
|
64
|
+
}>;
|
|
65
|
+
/** `GET /templates/:id/config-fields` (open draft, else published). */
|
|
66
|
+
configFields(templateId: string): Promise<TemplateConfigFields>;
|
|
67
|
+
/** `PUT /templates/:id/config-fields` (saved on the open draft). 400 `invalid_config_schema` if malformed. */
|
|
68
|
+
setConfigFields(templateId: string, configSchema: TemplateConfigField[]): Promise<{
|
|
69
|
+
draftVersion: number | null;
|
|
70
|
+
}>;
|
|
71
|
+
}
|
|
72
|
+
/** `forTenant(id).templates`: everything of `client.templates` plus the workspace-bound calls. */
|
|
73
|
+
export declare class TenantTemplatesResource extends TemplatesResource {
|
|
74
|
+
private readonly tenantId;
|
|
75
|
+
constructor(http: HttpCore, tenantId: string);
|
|
76
|
+
private get tenantBase();
|
|
77
|
+
/** `GET /templates?tenantId=`: system + public + this workspace's own. */
|
|
78
|
+
list(input?: ListTemplatesInput): Promise<{
|
|
79
|
+
items: Template[];
|
|
80
|
+
}>;
|
|
81
|
+
/** `POST /templates/:id/install` into this workspace. */
|
|
82
|
+
install(templateId: string, input?: InstallTemplateInput): Promise<TemplateInstallResult>;
|
|
83
|
+
/** `GET /templates/:id/install-readiness?destinationTenantId=`: what is ready / needs setup before installing here. */
|
|
84
|
+
installReadiness(templateId: string): Promise<TemplateReadiness>;
|
|
85
|
+
/** `POST /admin/tenants/:tenantId/agents/:agentId/save-as-template` */
|
|
86
|
+
saveAgentAsTemplate(agentId: string, input?: SaveTemplateInput): Promise<Template>;
|
|
87
|
+
/** `POST /admin/tenants/:tenantId/teams/:teamId/save-as-template` */
|
|
88
|
+
saveTeamAsTemplate(teamId: string, input?: SaveTemplateInput): Promise<Template>;
|
|
89
|
+
/** `POST /admin/tenants/:tenantId/agents/:agentId/publish-template-version` */
|
|
90
|
+
publishAgentTemplateVersion(agentId: string, input: {
|
|
91
|
+
templateId: string;
|
|
92
|
+
changelog?: string;
|
|
93
|
+
publisherAppId?: string | null;
|
|
94
|
+
}): Promise<Template>;
|
|
95
|
+
/** `POST /admin/tenants/:tenantId/teams/:teamId/publish-template-version` */
|
|
96
|
+
publishTeamTemplateVersion(teamId: string, input: {
|
|
97
|
+
templateId: string;
|
|
98
|
+
changelog?: string;
|
|
99
|
+
publisherAppId?: string | null;
|
|
100
|
+
}): Promise<Template>;
|
|
101
|
+
/** `GET /admin/tenants/:tenantId/teams/:teamId/template-source`: the template this team is the source of, with its version state. */
|
|
102
|
+
templateSource(teamId: string): Promise<{
|
|
103
|
+
source: TemplateSourceStatus | null;
|
|
104
|
+
}>;
|
|
105
|
+
/** `GET /me/template-updates-available?tenantId=`: installed agents/teams behind their template. */
|
|
106
|
+
updatesAvailable(): Promise<UpdatesAvailable>;
|
|
107
|
+
/** `POST /admin/tenants/:tenantId/teams/:teamId/update-from-template` */
|
|
108
|
+
updateTeamFromTemplate(teamId: string, input?: {
|
|
109
|
+
targetVersion?: number;
|
|
110
|
+
}): Promise<UpdateFromTemplateResult>;
|
|
111
|
+
/** `POST /admin/tenants/:tenantId/agents/:agentId/update-from-template` */
|
|
112
|
+
updateAgentFromTemplate(agentId: string, input?: {
|
|
113
|
+
targetVersion?: number;
|
|
114
|
+
}): Promise<UpdateFromTemplateResult>;
|
|
115
|
+
}
|