@stigmer/sdk 3.25.0 → 3.27.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/__tests__/iam-principal.test.d.ts +2 -0
- package/__tests__/iam-principal.test.d.ts.map +1 -0
- package/__tests__/iam-principal.test.js +65 -0
- package/__tests__/iam-principal.test.js.map +1 -0
- package/authorization-config.d.ts +28 -0
- package/authorization-config.d.ts.map +1 -1
- package/authorization-config.js +26 -1
- package/authorization-config.js.map +1 -1
- package/execution/transcript.d.ts +5 -6
- package/execution/transcript.d.ts.map +1 -1
- package/execution/transcript.js +5 -6
- package/execution/transcript.js.map +1 -1
- package/gen/authorization-config.d.ts +11 -0
- package/gen/authorization-config.d.ts.map +1 -1
- package/gen/authorization-config.js +23 -0
- package/gen/authorization-config.js.map +1 -1
- package/gen/client.d.ts +4 -0
- package/gen/client.d.ts.map +1 -1
- package/gen/client.js +4 -0
- package/gen/client.js.map +1 -1
- package/gen/resource-availability.d.ts.map +1 -1
- package/gen/resource-availability.js +1 -0
- package/gen/resource-availability.js.map +1 -1
- package/gen/team.d.ts +49 -0
- package/gen/team.d.ts.map +1 -0
- package/gen/team.js +119 -0
- package/gen/team.js.map +1 -0
- package/iam-principal.d.ts +30 -0
- package/iam-principal.d.ts.map +1 -0
- package/iam-principal.js +73 -0
- package/iam-principal.js.map +1 -0
- package/index.d.ts +3 -1
- package/index.d.ts.map +1 -1
- package/index.js +3 -1
- package/index.js.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/iam-principal.test.ts +82 -0
- package/src/authorization-config.ts +48 -1
- package/src/execution/transcript.ts +5 -6
- package/src/gen/authorization-config.ts +24 -0
- package/src/gen/client.ts +5 -0
- package/src/gen/resource-availability.ts +1 -0
- package/src/gen/team.ts +132 -0
- package/src/iam-principal.ts +92 -0
- package/src/index.ts +17 -0
package/gen/team.js
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
// Code generated by stigmer-codegen. DO NOT EDIT.
|
|
2
|
+
import { wrapError } from "./errors.js";
|
|
3
|
+
import { stripUndefined } from "./proto-utils.js";
|
|
4
|
+
import { create } from "@bufbuild/protobuf";
|
|
5
|
+
import { createClient } from "@connectrpc/connect";
|
|
6
|
+
import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
7
|
+
import { ApiResourceIdSchema, ApiResourceReferenceSchema, ApiResourceDeleteInputSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/io_pb";
|
|
8
|
+
import { ApiResourceMetadataSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/metadata_pb";
|
|
9
|
+
import { TeamSchema } from "@stigmer/protos/ai/stigmer/iam/team/v1/api_pb";
|
|
10
|
+
import { TeamCommandController } from "@stigmer/protos/ai/stigmer/iam/team/v1/command_pb";
|
|
11
|
+
import { TeamQueryController } from "@stigmer/protos/ai/stigmer/iam/team/v1/query_pb";
|
|
12
|
+
import { TeamSpecSchema } from "@stigmer/protos/ai/stigmer/iam/team/v1/spec_pb";
|
|
13
|
+
/** Provides operations on team resources. */
|
|
14
|
+
export class TeamClient {
|
|
15
|
+
command;
|
|
16
|
+
query;
|
|
17
|
+
constructor(transport) {
|
|
18
|
+
this.command = createClient(TeamCommandController, transport);
|
|
19
|
+
this.query = createClient(TeamQueryController, transport);
|
|
20
|
+
}
|
|
21
|
+
async create(input) {
|
|
22
|
+
try {
|
|
23
|
+
return await this.command.create(buildTeamProto(input));
|
|
24
|
+
}
|
|
25
|
+
catch (e) {
|
|
26
|
+
throw wrapError(e);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
async update(input) {
|
|
30
|
+
try {
|
|
31
|
+
return await this.command.update(buildTeamProto(input));
|
|
32
|
+
}
|
|
33
|
+
catch (e) {
|
|
34
|
+
throw wrapError(e);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
async delete(input) {
|
|
38
|
+
try {
|
|
39
|
+
return await this.command.delete(create(ApiResourceDeleteInputSchema, {
|
|
40
|
+
resourceId: input.resourceId,
|
|
41
|
+
versionMessage: input.versionMessage,
|
|
42
|
+
force: input.force,
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
45
|
+
catch (e) {
|
|
46
|
+
throw wrapError(e);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
async get(id) {
|
|
50
|
+
try {
|
|
51
|
+
return await this.query.get(create(ApiResourceIdSchema, { value: id }));
|
|
52
|
+
}
|
|
53
|
+
catch (e) {
|
|
54
|
+
throw wrapError(e);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
async getByReference(ref) {
|
|
58
|
+
try {
|
|
59
|
+
return await this.query.getByReference(create(ApiResourceReferenceSchema, { ...ref, kind: ApiResourceKind.team }));
|
|
60
|
+
}
|
|
61
|
+
catch (e) {
|
|
62
|
+
throw wrapError(e);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
async listByOrg(input) {
|
|
66
|
+
try {
|
|
67
|
+
return await this.query.listByOrg(input);
|
|
68
|
+
}
|
|
69
|
+
catch (e) {
|
|
70
|
+
throw wrapError(e);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
export function buildTeamProto(input) {
|
|
75
|
+
return Object.assign(create(TeamSchema), {
|
|
76
|
+
apiVersion: "iam.stigmer.ai/v1",
|
|
77
|
+
kind: "Team",
|
|
78
|
+
metadata: Object.assign(create(ApiResourceMetadataSchema), {
|
|
79
|
+
...(input.id && { id: input.id }),
|
|
80
|
+
name: input.name,
|
|
81
|
+
org: input.org,
|
|
82
|
+
...(input.slug && { slug: input.slug }),
|
|
83
|
+
...(input.labels && { labels: input.labels }),
|
|
84
|
+
...(input.visibility && { visibility: input.visibility }),
|
|
85
|
+
}),
|
|
86
|
+
spec: Object.assign(create(TeamSpecSchema), stripUndefined({
|
|
87
|
+
description: input.description,
|
|
88
|
+
})),
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Maps a fetched {@link Team} to a complete {@link TeamInput} for `update()`.
|
|
93
|
+
*
|
|
94
|
+
* The update RPC replaces the ENTIRE spec — spread this mapper's output
|
|
95
|
+
* and override only the fields you edit (spread nested objects the same
|
|
96
|
+
* way):
|
|
97
|
+
*
|
|
98
|
+
* await client.update({ ...toTeamUpdateInput(res), description: next });
|
|
99
|
+
*
|
|
100
|
+
* Proto3 defaults normalize to `undefined`; resource references keep
|
|
101
|
+
* `version` (pinned refs) and `kind`.
|
|
102
|
+
*/
|
|
103
|
+
export function toTeamUpdateInput(resource) {
|
|
104
|
+
const meta = resource.metadata;
|
|
105
|
+
const spec = resource.spec ?? create(TeamSpecSchema);
|
|
106
|
+
return {
|
|
107
|
+
// Exact update addressing (id-first in the update pipeline) — for
|
|
108
|
+
// platform-scoped (org-less) kinds the org+slug fallback cannot
|
|
109
|
+
// match, so the id is the ONLY working address.
|
|
110
|
+
id: meta?.id || undefined,
|
|
111
|
+
name: meta?.name ?? "",
|
|
112
|
+
slug: meta?.slug || undefined,
|
|
113
|
+
org: meta?.org ?? "",
|
|
114
|
+
labels: meta?.labels && Object.keys(meta.labels).length > 0 ? { ...meta.labels } : undefined,
|
|
115
|
+
visibility: meta?.visibility || undefined,
|
|
116
|
+
description: spec.description || undefined,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=team.js.map
|
package/gen/team.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"team.js","sourceRoot":"","sources":["../../src/gen/team.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAElD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAA+B,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,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MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,SAAS;QAC5F,UAAU,EAAE,IAAI,EAAE,UAAU,IAAI,SAAS;QACzC,WAAW,EAAE,IAAI,CAAC,WAAW,IAAI,SAAS;KAC3C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ApiResourceRefView } from "@stigmer/protos/ai/stigmer/iam/iampolicy/v1/io_pb";
|
|
2
|
+
import { type ApiResourceRef } from "@stigmer/protos/ai/stigmer/iam/iampolicy/v1/spec_pb";
|
|
3
|
+
/** A person or a team an IAM policy can grant a role to. */
|
|
4
|
+
export type Grantee = {
|
|
5
|
+
readonly kind: "identity_account";
|
|
6
|
+
readonly id: string;
|
|
7
|
+
} | {
|
|
8
|
+
readonly kind: "team";
|
|
9
|
+
readonly id: string;
|
|
10
|
+
};
|
|
11
|
+
/** The kind of a {@link Grantee}. */
|
|
12
|
+
export type GranteeKind = Grantee["kind"];
|
|
13
|
+
/** A person, by identity account id (`ida_...`). */
|
|
14
|
+
export declare function personGrantee(id: string): Grantee;
|
|
15
|
+
/** A team, by team id (`tm_...`). */
|
|
16
|
+
export declare function teamGrantee(id: string): Grantee;
|
|
17
|
+
/**
|
|
18
|
+
* The `ApiResourceRef` an IAM policy spec names the grantee with: a person
|
|
19
|
+
* unqualified, a team as its members.
|
|
20
|
+
*/
|
|
21
|
+
export declare function granteeRef(grantee: Grantee): ApiResourceRef;
|
|
22
|
+
/**
|
|
23
|
+
* The grantee an access-list entry names, or `undefined` when the entry
|
|
24
|
+
* is not a person or a team's members (a structural principal, a kind this
|
|
25
|
+
* SDK does not know, or a team qualifier other than `member`).
|
|
26
|
+
*/
|
|
27
|
+
export declare function granteeFromView(view: Pick<ApiResourceRefView, "kind" | "id" | "relation">): Grantee | undefined;
|
|
28
|
+
/** A stable key for a grantee: its kind and id. */
|
|
29
|
+
export declare function granteeKey(grantee: Grantee): string;
|
|
30
|
+
//# sourceMappingURL=iam-principal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iam-principal.d.ts","sourceRoot":"","sources":["../src/iam-principal.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mDAAmD,CAAC;AAC5F,OAAO,EACL,KAAK,cAAc,EAEpB,MAAM,qDAAqD,CAAC;AAQ7D,4DAA4D;AAC5D,MAAM,MAAM,OAAO,GACf;IAAE,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;IAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAC1D;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnD,qCAAqC;AACrC,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAE1C,oDAAoD;AACpD,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAEjD;AAED,qCAAqC;AACrC,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAE/C;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,cAAc,CAe3D;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,IAAI,CAAC,kBAAkB,EAAE,MAAM,GAAG,IAAI,GAAG,UAAU,CAAC,GACzD,OAAO,GAAG,SAAS,CASrB;AAED,mDAAmD;AACnD,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAEnD"}
|
package/iam-principal.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Who an IAM policy grants a role to: a person or a team, in one shape a
|
|
3
|
+
* client builds grants from and reads access lists back into.
|
|
4
|
+
*
|
|
5
|
+
* The wire spells a grantee as an `ApiResourceRef`: a person is
|
|
6
|
+
* `identity_account:<id>` with no relation qualifier, a team is
|
|
7
|
+
* `team:<id>#member` (every member of the team holds the grant). This
|
|
8
|
+
* module is the one place in the SDK that knows that spelling, so no caller
|
|
9
|
+
* writes the qualifier by hand and no caller can drop it.
|
|
10
|
+
*
|
|
11
|
+
* Reading goes through the same module: `granteeFromView` turns an access
|
|
12
|
+
* list entry back into a `Grantee` and answers `undefined` for anything it
|
|
13
|
+
* does not recognise (another kind, a team with a qualifier other than
|
|
14
|
+
* `member`), so a client never acts on a principal it would misname. A
|
|
15
|
+
* revoke built from the returned grantee names the exact row the list
|
|
16
|
+
* showed, because the server's revoke matches the qualifier exactly.
|
|
17
|
+
*/
|
|
18
|
+
import { create } from "@bufbuild/protobuf";
|
|
19
|
+
import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
20
|
+
import { ApiResourceRefSchema, } from "@stigmer/protos/ai/stigmer/iam/iampolicy/v1/spec_pb";
|
|
21
|
+
const PERSON_KIND = ApiResourceKind[ApiResourceKind.identity_account];
|
|
22
|
+
const TEAM_KIND = ApiResourceKind[ApiResourceKind.team];
|
|
23
|
+
/** The relation that makes every member of a team the grantee. */
|
|
24
|
+
const TEAM_MEMBERS_RELATION = "member";
|
|
25
|
+
/** A person, by identity account id (`ida_...`). */
|
|
26
|
+
export function personGrantee(id) {
|
|
27
|
+
return { kind: "identity_account", id };
|
|
28
|
+
}
|
|
29
|
+
/** A team, by team id (`tm_...`). */
|
|
30
|
+
export function teamGrantee(id) {
|
|
31
|
+
return { kind: "team", id };
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The `ApiResourceRef` an IAM policy spec names the grantee with: a person
|
|
35
|
+
* unqualified, a team as its members.
|
|
36
|
+
*/
|
|
37
|
+
export function granteeRef(grantee) {
|
|
38
|
+
switch (grantee.kind) {
|
|
39
|
+
case "identity_account":
|
|
40
|
+
return create(ApiResourceRefSchema, { kind: PERSON_KIND, id: grantee.id });
|
|
41
|
+
case "team":
|
|
42
|
+
return create(ApiResourceRefSchema, {
|
|
43
|
+
kind: TEAM_KIND,
|
|
44
|
+
id: grantee.id,
|
|
45
|
+
relation: TEAM_MEMBERS_RELATION,
|
|
46
|
+
});
|
|
47
|
+
default: {
|
|
48
|
+
const unreachable = grantee;
|
|
49
|
+
return unreachable;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The grantee an access-list entry names, or `undefined` when the entry
|
|
55
|
+
* is not a person or a team's members (a structural principal, a kind this
|
|
56
|
+
* SDK does not know, or a team qualifier other than `member`).
|
|
57
|
+
*/
|
|
58
|
+
export function granteeFromView(view) {
|
|
59
|
+
if (!view.id)
|
|
60
|
+
return undefined;
|
|
61
|
+
if (view.kind === PERSON_KIND && view.relation === "") {
|
|
62
|
+
return personGrantee(view.id);
|
|
63
|
+
}
|
|
64
|
+
if (view.kind === TEAM_KIND && view.relation === TEAM_MEMBERS_RELATION) {
|
|
65
|
+
return teamGrantee(view.id);
|
|
66
|
+
}
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
/** A stable key for a grantee: its kind and id. */
|
|
70
|
+
export function granteeKey(grantee) {
|
|
71
|
+
return `${grantee.kind}:${grantee.id}`;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=iam-principal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iam-principal.js","sourceRoot":"","sources":["../src/iam-principal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,qFAAqF,CAAC;AAEtH,OAAO,EAEL,oBAAoB,GACrB,MAAM,qDAAqD,CAAC;AAE7D,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AAI,CAAC,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,QAAQ,KAAK,qBAAqB,EAAE,CAAC;QACvE,OAAO,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC9B,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,mDAAmD;AACnD,MAAM,UAAU,UAAU,CAAC,OAAgB;IACzC,OAAO,GAAG,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,EAAE,EAAE,CAAC;AACzC,CAAC"}
|
package/index.d.ts
CHANGED
|
@@ -6,7 +6,8 @@ export { MAX_ALLOWED_ORIGINS, LINK_TOKEN_PARAM, validateOrigin, chatPath, buildC
|
|
|
6
6
|
export { StigmerError, type ErrorCode, isNotFound, isUnauthenticated, isPermissionDenied, isRetryable, isUnimplemented, type ErrorCategory, isConnectError, classifyError, isRetryableError, isTransientStreamError, getUserMessage, type ErrorReason, getErrorReason, type RpcErrorMetadata, annotateRpcError, getRpcMetadata, } from "./errors.js";
|
|
7
7
|
export { type DeploymentMode, deploymentModeOf, isResourceAvailable, } from "./resource-availability.js";
|
|
8
8
|
export { ensureMyIdentityAccount, type EnsuredIdentityAccount, type EnsureMyIdentityAccountOptions, type IdentityAccountLane, } from "./ensure-identity-account.js";
|
|
9
|
-
export { getGrantableRoles, hasGrantableRoles, isRoleGrantable, } from "./authorization-config.js";
|
|
9
|
+
export { getGrantableRoles, hasGrantableRoles, isRoleGrantable, getTeamGrantableRoles, hasTeamGrantableRoles, isRoleTeamGrantable, } from "./authorization-config.js";
|
|
10
|
+
export { type Grantee, type GranteeKind, personGrantee, teamGrantee, granteeRef, granteeFromView, granteeKey, } from "./iam-principal.js";
|
|
10
11
|
export { iamRoleToString, iamRoleFromString, iamRoleDisplayName, iamRoleDescription, } from "./iam-role.js";
|
|
11
12
|
export { IamRole } from "@stigmer/protos/ai/stigmer/iam/v1/enum_pb";
|
|
12
13
|
export { ActivityClient, type ListRecentActivityParams, type ListRecentActivityResponse, } from "./activity.js";
|
|
@@ -32,6 +33,7 @@ export { IamPolicyClient, type IamPolicyInput, type ApiResourceRefInput, } from
|
|
|
32
33
|
export { IdentityAccountClient, toIdentityAccountUpdateInput, type IdentityAccountInput, } from "./gen/identityaccount.js";
|
|
33
34
|
export { InvitationClient, type InvitationInput } from "./gen/invitation.js";
|
|
34
35
|
export { IdentityProviderClient, toIdentityProviderUpdateInput, type IdentityProviderInput, } from "./gen/identityprovider.js";
|
|
36
|
+
export { TeamClient, toTeamUpdateInput, type TeamInput, } from "./gen/team.js";
|
|
35
37
|
export { OAuthAppClient, toOAuthAppUpdateInput, type OAuthAppInput, } from "./gen/oauthapp.js";
|
|
36
38
|
export { McpServerClient, buildMcpServerProto, toMcpServerUpdateInput, type McpServerInput, type StdioServerConfigInput, type HttpServerConfigInput, type ToolApprovalPolicyInput, } from "./gen/mcpserver.js";
|
|
37
39
|
export { MemoryClient, buildMemoryProto, toMemoryUpdateInput, type MemoryInput, type MemoryProvenanceInput, } from "./gen/memory.js";
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGvC,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAGrE,OAAO,EACL,eAAe,EACf,SAAS,EACT,KAAK,eAAe,EACpB,KAAK,cAAc,GACpB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,QAAQ,EACR,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,YAAY,EACZ,KAAK,SAAS,EACd,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,KAAK,aAAa,EAClB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,sBAAsB,EACtB,cAAc,EACd,KAAK,WAAW,EAChB,cAAc,EACd,KAAK,gBAAgB,EACrB,gBAAgB,EAChB,cAAc,GACf,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,KAAK,cAAc,EACnB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AAKpC,OAAO,EACL,uBAAuB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,8BAA8B,EACnC,KAAK,mBAAmB,GACzB,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGvC,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAGrE,OAAO,EACL,eAAe,EACf,SAAS,EACT,KAAK,eAAe,EACpB,KAAK,cAAc,GACpB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,QAAQ,EACR,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,YAAY,EACZ,KAAK,SAAS,EACd,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,KAAK,aAAa,EAClB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,sBAAsB,EACtB,cAAc,EACd,KAAK,WAAW,EAChB,cAAc,EACd,KAA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 -16,7 +16,8 @@ export { deploymentModeOf, isResourceAvailable, } from "./resource-availability.
|
|
|
16
16
|
// platform builders' own gates).
|
|
17
17
|
export { ensureMyIdentityAccount, } from "./ensure-identity-account.js";
|
|
18
18
|
// Authorization config and IAM role utilities
|
|
19
|
-
export { getGrantableRoles, hasGrantableRoles, isRoleGrantable, } from "./authorization-config.js";
|
|
19
|
+
export { getGrantableRoles, hasGrantableRoles, isRoleGrantable, getTeamGrantableRoles, hasTeamGrantableRoles, isRoleTeamGrantable, } from "./authorization-config.js";
|
|
20
|
+
export { personGrantee, teamGrantee, granteeRef, granteeFromView, granteeKey, } from "./iam-principal.js";
|
|
20
21
|
export { iamRoleToString, iamRoleFromString, iamRoleDisplayName, iamRoleDescription, } from "./iam-role.js";
|
|
21
22
|
export { IamRole } from "@stigmer/protos/ai/stigmer/iam/v1/enum_pb";
|
|
22
23
|
// Activity client (unified recents)
|
|
@@ -52,6 +53,7 @@ export { IamPolicyClient, } from "./gen/iampolicy.js";
|
|
|
52
53
|
export { IdentityAccountClient, toIdentityAccountUpdateInput, } from "./gen/identityaccount.js";
|
|
53
54
|
export { InvitationClient } from "./gen/invitation.js";
|
|
54
55
|
export { IdentityProviderClient, toIdentityProviderUpdateInput, } from "./gen/identityprovider.js";
|
|
56
|
+
export { TeamClient, toTeamUpdateInput, } from "./gen/team.js";
|
|
55
57
|
export { OAuthAppClient, toOAuthAppUpdateInput, } from "./gen/oauthapp.js";
|
|
56
58
|
export { McpServerClient, buildMcpServerProto, toMcpServerUpdateInput, } from "./gen/mcpserver.js";
|
|
57
59
|
export { MemoryClient, buildMemoryProto, toMemoryUpdateInput, } from "./gen/memory.js";
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAE9B,mBAAmB;AACnB,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,iBAAiB;A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,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,yBAAyB,EACzB,sBAAsB,EACtB,uBAAuB,EACvB,oBAAoB,EACpB,gBAAgB,GAQjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAmB,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAE,YAAY,EAA4C,MAAM,iBAAiB,CAAC;AACzF,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EACL,cAAc,EACd,qBAAqB,GAMtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,uBAAuB,EACvB,8BAA8B,GAE/B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,sBAAsB,EACtB,6BAA6B,GAE9B,MAAM,2BAA2B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stigmer/sdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.27.0",
|
|
4
4
|
"description": "Stigmer TypeScript SDK — typed API client for all Stigmer platform resources",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -41,6 +41,6 @@
|
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"@bufbuild/protobuf": "^2.0.0",
|
|
43
43
|
"@connectrpc/connect-node": "^2.0.0",
|
|
44
|
-
"@stigmer/protos": "3.
|
|
44
|
+
"@stigmer/protos": "3.27.0"
|
|
45
45
|
}
|
|
46
46
|
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pins the grantee vocabulary (`iam-principal.ts`) and the team half of the
|
|
3
|
+
* authorization config (`authorization-config.ts`):
|
|
4
|
+
*
|
|
5
|
+
* - a team is always granted as `team:<id>#member` and a person always
|
|
6
|
+
* unqualified, because the server's revoke matches the qualifier
|
|
7
|
+
* exactly and a dropped `#member` revokes nothing while reporting
|
|
8
|
+
* success;
|
|
9
|
+
* - reading an access-list entry back is the inverse of building one,
|
|
10
|
+
* and anything else (a structural principal, another team qualifier)
|
|
11
|
+
* is refused rather than guessed at;
|
|
12
|
+
* - a team may only ever be offered a subset of a person's roles, never
|
|
13
|
+
* `owner`, and nothing on `organization` (the circular grant the
|
|
14
|
+
* model's membership bound forbids).
|
|
15
|
+
*/
|
|
16
|
+
import { describe, expect, it } from "vitest";
|
|
17
|
+
import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
18
|
+
import { IamRole } from "@stigmer/protos/ai/stigmer/iam/v1/enum_pb";
|
|
19
|
+
|
|
20
|
+
import {
|
|
21
|
+
getGrantableRoles,
|
|
22
|
+
getTeamGrantableRoles,
|
|
23
|
+
hasTeamGrantableRoles,
|
|
24
|
+
isRoleTeamGrantable,
|
|
25
|
+
} from "../authorization-config";
|
|
26
|
+
import { TEAM_GRANTABLE_ROLES } from "../gen/authorization-config";
|
|
27
|
+
import {
|
|
28
|
+
granteeFromView,
|
|
29
|
+
granteeRef,
|
|
30
|
+
personGrantee,
|
|
31
|
+
teamGrantee,
|
|
32
|
+
} from "../iam-principal";
|
|
33
|
+
|
|
34
|
+
describe("granteeRef — the one spelling of a grantee on the wire", () => {
|
|
35
|
+
it("names a team as its members", () => {
|
|
36
|
+
const ref = granteeRef(teamGrantee("tm_sre"));
|
|
37
|
+
expect([ref.kind, ref.id, ref.relation]).toEqual(["team", "tm_sre", "member"]);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it("names a person with no relation qualifier", () => {
|
|
41
|
+
const ref = granteeRef(personGrantee("ida_alice"));
|
|
42
|
+
expect([ref.kind, ref.id, ref.relation]).toEqual(["identity_account", "ida_alice", ""]);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
describe("granteeFromView — reading an access-list entry back", () => {
|
|
47
|
+
it("round-trips both grantees through their wire reference", () => {
|
|
48
|
+
for (const grantee of [teamGrantee("tm_sre"), personGrantee("ida_alice")]) {
|
|
49
|
+
expect(granteeFromView(granteeRef(grantee))).toEqual(grantee);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it("refuses what it would misname: a team without its members qualifier, a qualified person, a structural principal, an empty id", () => {
|
|
54
|
+
expect(granteeFromView({ kind: "team", id: "tm_sre", relation: "" })).toBeUndefined();
|
|
55
|
+
expect(granteeFromView({ kind: "team", id: "tm_sre", relation: "maintainer" })).toBeUndefined();
|
|
56
|
+
expect(granteeFromView({ kind: "identity_account", id: "ida_alice", relation: "member" })).toBeUndefined();
|
|
57
|
+
expect(granteeFromView({ kind: "organization", id: "acme", relation: "" })).toBeUndefined();
|
|
58
|
+
expect(granteeFromView({ kind: "identity_account", id: "", relation: "" })).toBeUndefined();
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
describe("team grantable roles", () => {
|
|
63
|
+
it("are, for every kind, a subset of the person's roles and never owner", () => {
|
|
64
|
+
for (const [kind, teamRoles] of TEAM_GRANTABLE_ROLES) {
|
|
65
|
+
const personRoles = getGrantableRoles(kind);
|
|
66
|
+
for (const role of teamRoles) {
|
|
67
|
+
expect(personRoles).toContain(role);
|
|
68
|
+
expect(role).not.toBe(IamRole.owner);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it("list nothing on organization, so an organization is never shared with a team", () => {
|
|
74
|
+
expect(hasTeamGrantableRoles(ApiResourceKind.organization)).toBe(false);
|
|
75
|
+
expect(getTeamGrantableRoles(ApiResourceKind.organization)).toEqual([]);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it("answer per role on a kind a team may be shared", () => {
|
|
79
|
+
expect(isRoleTeamGrantable(ApiResourceKind.agent, IamRole.viewer)).toBe(true);
|
|
80
|
+
expect(isRoleTeamGrantable(ApiResourceKind.agent, IamRole.owner)).toBe(false);
|
|
81
|
+
});
|
|
82
|
+
});
|
|
@@ -1,6 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which roles a caller may grant on a resource kind, read from the
|
|
3
|
+
* proto-generated authorization config, so a client offers exactly the
|
|
4
|
+
* grants the server's `ValidateGrantableRole` step accepts.
|
|
5
|
+
*
|
|
6
|
+
* Two grantees, two tables: a person may be granted any role in
|
|
7
|
+
* `GRANTABLE_ROLES`; a team (Enterprise and Cloud) only the roles in
|
|
8
|
+
* `TEAM_GRANTABLE_ROLES`, always a subset of the person's. Each table has
|
|
9
|
+
* the same three readers, so a caller asks the team question with the
|
|
10
|
+
* same shape it asks the person one.
|
|
11
|
+
*/
|
|
1
12
|
import type { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
2
13
|
import { IamRole } from "@stigmer/protos/ai/stigmer/iam/v1/enum_pb";
|
|
3
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
GRANTABLE_ROLES,
|
|
16
|
+
TEAM_GRANTABLE_ROLES,
|
|
17
|
+
} from "./gen/authorization-config.js";
|
|
4
18
|
|
|
5
19
|
const EMPTY_ROLES: readonly IamRole[] = Object.freeze([]);
|
|
6
20
|
|
|
@@ -40,3 +54,36 @@ export function isRoleGrantable(
|
|
|
40
54
|
const roles = GRANTABLE_ROLES.get(kind);
|
|
41
55
|
return roles !== undefined && roles.includes(role);
|
|
42
56
|
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Returns the roles a team may be granted on the given resource kind.
|
|
60
|
+
*
|
|
61
|
+
* An empty array means the kind cannot be shared with a team. Whether the
|
|
62
|
+
* connected edition serves teams at all is a separate question, answered
|
|
63
|
+
* by `isResourceAvailable(ApiResourceKind.team, mode)`.
|
|
64
|
+
*/
|
|
65
|
+
export function getTeamGrantableRoles(
|
|
66
|
+
kind: ApiResourceKind,
|
|
67
|
+
): readonly IamRole[] {
|
|
68
|
+
return TEAM_GRANTABLE_ROLES.get(kind) ?? EMPTY_ROLES;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Whether the given resource kind can be shared with a team at all.
|
|
73
|
+
*/
|
|
74
|
+
export function hasTeamGrantableRoles(kind: ApiResourceKind): boolean {
|
|
75
|
+
const roles = TEAM_GRANTABLE_ROLES.get(kind);
|
|
76
|
+
return roles !== undefined && roles.length > 0;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Whether a team may be granted the given role on the given resource kind
|
|
81
|
+
* — the team arm of the backend's `ValidateGrantableRole` step.
|
|
82
|
+
*/
|
|
83
|
+
export function isRoleTeamGrantable(
|
|
84
|
+
kind: ApiResourceKind,
|
|
85
|
+
role: IamRole,
|
|
86
|
+
): boolean {
|
|
87
|
+
const roles = TEAM_GRANTABLE_ROLES.get(kind);
|
|
88
|
+
return roles !== undefined && roles.includes(role);
|
|
89
|
+
}
|
|
@@ -235,12 +235,11 @@ export interface FetchSessionTranscriptOptions {
|
|
|
235
235
|
/**
|
|
236
236
|
* Fetches everything a session's transcript needs and assembles it.
|
|
237
237
|
*
|
|
238
|
-
* One `listBySession` call returns the complete execution set
|
|
239
|
-
*
|
|
240
|
-
*
|
|
241
|
-
*
|
|
242
|
-
*
|
|
243
|
-
* "full-fidelity" transcript.
|
|
238
|
+
* One `listBySession` call returns the complete execution set: the RPC
|
|
239
|
+
* returns a session's executions whole by contract, and its paging fields
|
|
240
|
+
* are deprecated. A response claiming more than one page (`total_pages >
|
|
241
|
+
* 1`) fails with a descriptive error rather than silently exporting a
|
|
242
|
+
* truncated "full-fidelity" transcript.
|
|
244
243
|
*/
|
|
245
244
|
export async function fetchSessionTranscript(
|
|
246
245
|
client: SessionTranscriptClient,
|
|
@@ -17,6 +17,7 @@ export const GRANTABLE_ROLES: ReadonlyMap<ApiResourceKind, readonly IamRole[]> =
|
|
|
17
17
|
[ApiResourceKind.identity_provider, [IamRole.owner, IamRole.viewer]],
|
|
18
18
|
[ApiResourceKind.oauth_app, [IamRole.owner, IamRole.viewer]],
|
|
19
19
|
[ApiResourceKind.platform_client, [IamRole.owner, IamRole.viewer]],
|
|
20
|
+
[ApiResourceKind.team, [IamRole.member]],
|
|
20
21
|
[ApiResourceKind.organization, [IamRole.owner, IamRole.admin, IamRole.member, IamRole.viewer]],
|
|
21
22
|
[ApiResourceKind.agent, [IamRole.owner, IamRole.viewer]],
|
|
22
23
|
[ApiResourceKind.session, [IamRole.owner, IamRole.viewer]],
|
|
@@ -34,3 +35,26 @@ export const GRANTABLE_ROLES: ReadonlyMap<ApiResourceKind, readonly IamRole[]> =
|
|
|
34
35
|
[ApiResourceKind.schedule, [IamRole.owner, IamRole.viewer]],
|
|
35
36
|
[ApiResourceKind.plugin, [IamRole.owner, IamRole.viewer]],
|
|
36
37
|
]);
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Roles that can be granted on each resource kind to a team, so every
|
|
41
|
+
* member of the team holds the role.
|
|
42
|
+
*
|
|
43
|
+
* Source of truth: api_resource_kind.proto — team_grantable_roles in each
|
|
44
|
+
* kind's AuthorizationConfig, always a subset of grantable_roles.
|
|
45
|
+
*
|
|
46
|
+
* Kinds not in this map cannot be shared with a team. Teams are served by
|
|
47
|
+
* the Enterprise and Cloud editions.
|
|
48
|
+
*/
|
|
49
|
+
export const TEAM_GRANTABLE_ROLES: ReadonlyMap<ApiResourceKind, readonly IamRole[]> = new Map([
|
|
50
|
+
[ApiResourceKind.agent, [IamRole.viewer]],
|
|
51
|
+
[ApiResourceKind.skill, [IamRole.viewer]],
|
|
52
|
+
[ApiResourceKind.mcp_server, [IamRole.viewer]],
|
|
53
|
+
[ApiResourceKind.agent_instance, [IamRole.viewer]],
|
|
54
|
+
[ApiResourceKind.agent_channel, [IamRole.viewer, IamRole.participant]],
|
|
55
|
+
[ApiResourceKind.workflow, [IamRole.viewer]],
|
|
56
|
+
[ApiResourceKind.workflow_instance, [IamRole.viewer]],
|
|
57
|
+
[ApiResourceKind.workflow_execution, [IamRole.viewer]],
|
|
58
|
+
[ApiResourceKind.schedule, [IamRole.viewer]],
|
|
59
|
+
[ApiResourceKind.plugin, [IamRole.viewer]],
|
|
60
|
+
]);
|
package/src/gen/client.ts
CHANGED
|
@@ -27,6 +27,7 @@ import { ScheduleClient } from "./schedule.js";
|
|
|
27
27
|
import { SessionClient } from "./session.js";
|
|
28
28
|
import { SkillClient } from "./skill.js";
|
|
29
29
|
import { SubscriptionClient } from "./subscription.js";
|
|
30
|
+
import { TeamClient } from "./team.js";
|
|
30
31
|
import { WorkflowClient } from "./workflow.js";
|
|
31
32
|
import { WorkflowExecutionClient } from "./workflowexecution.js";
|
|
32
33
|
import { WorkflowInstanceClient } from "./workflowinstance.js";
|
|
@@ -59,6 +60,7 @@ export class GeneratedClient {
|
|
|
59
60
|
readonly session: SessionClient;
|
|
60
61
|
readonly skill: SkillClient;
|
|
61
62
|
readonly subscription: SubscriptionClient;
|
|
63
|
+
readonly team: TeamClient;
|
|
62
64
|
readonly workflow: WorkflowClient;
|
|
63
65
|
readonly workflowExecution: WorkflowExecutionClient;
|
|
64
66
|
readonly workflowInstance: WorkflowInstanceClient;
|
|
@@ -90,6 +92,7 @@ export class GeneratedClient {
|
|
|
90
92
|
this.session = new SessionClient(transport);
|
|
91
93
|
this.skill = new SkillClient(transport);
|
|
92
94
|
this.subscription = new SubscriptionClient(transport);
|
|
95
|
+
this.team = new TeamClient(transport);
|
|
93
96
|
this.workflow = new WorkflowClient(transport);
|
|
94
97
|
this.workflowExecution = new WorkflowExecutionClient(transport);
|
|
95
98
|
this.workflowInstance = new WorkflowInstanceClient(transport);
|
|
@@ -149,6 +152,8 @@ export { SkillClient } from "./skill.js";
|
|
|
149
152
|
export { type SkillInput } from "./skill.js";
|
|
150
153
|
export { SubscriptionClient } from "./subscription.js";
|
|
151
154
|
export { type SubscriptionInput } from "./subscription.js";
|
|
155
|
+
export { TeamClient } from "./team.js";
|
|
156
|
+
export { type TeamInput } from "./team.js";
|
|
152
157
|
export { WorkflowClient } from "./workflow.js";
|
|
153
158
|
export { type WorkflowInput, type WorkflowDocumentInput, type WorkflowTaskInput, type ExportInput, type FlowControlInput, type WorkflowBudgetInput } from "./workflow.js";
|
|
154
159
|
export { WorkflowExecutionClient } from "./workflowexecution.js";
|
|
@@ -20,6 +20,7 @@ export const KIND_TIERS: ReadonlyMap<ApiResourceKind, ResourceTier> = new Map([
|
|
|
20
20
|
[ApiResourceKind.identity_provider, ResourceTier.enterprise],
|
|
21
21
|
[ApiResourceKind.oauth_app, ResourceTier.open_source],
|
|
22
22
|
[ApiResourceKind.platform_client, ResourceTier.open_source],
|
|
23
|
+
[ApiResourceKind.team, ResourceTier.enterprise],
|
|
23
24
|
[ApiResourceKind.organization, ResourceTier.open_source],
|
|
24
25
|
[ApiResourceKind.platform, ResourceTier.enterprise],
|
|
25
26
|
[ApiResourceKind.agent, ResourceTier.open_source],
|