@lucern/sdk 0.2.0-alpha.6 → 0.2.0-alpha.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/.turbo/turbo-build.log +7 -0
- package/.turbo/turbo-typecheck.log +4 -0
- package/CHANGELOG.md +13 -0
- package/examples/README.md +69 -0
- package/examples/contradiction.ts +94 -0
- package/examples/investigation-context.ts +118 -0
- package/examples/questions-and-tasks.ts +55 -0
- package/examples/quickstart.ts +97 -0
- package/examples/shared.ts +318 -0
- package/examples/strict-public-types.ts +143 -0
- package/examples/worktree-lifecycle.ts +79 -0
- package/package.json +16 -58
- package/src/README.md +6 -0
- package/src/adminClient.ts +789 -0
- package/{dist/lib/platform/sdk/answersClient.d.ts → src/answersClient.ts} +17 -4
- package/src/audiencesClient.ts +209 -0
- package/src/auditClient.ts +50 -0
- package/src/beliefsClient.ts +319 -0
- package/src/client.ts +2647 -0
- package/src/contextClient.ts +130 -0
- package/{dist/lib/platform/sdk/contextFacade.d.ts → src/contextFacade.ts} +6 -1
- package/src/contextPackCompiler.ts +828 -0
- package/src/contextPackSchema.ts +251 -0
- package/src/contextTypes.ts +153 -0
- package/src/contracts/api-enums.contract.ts +202 -0
- package/src/contracts/auth-session.contract.ts +109 -0
- package/src/contracts/context-pack.contract.ts +700 -0
- package/src/contracts/contextPack.ts +1 -0
- package/src/contracts/index.ts +10 -0
- package/src/contracts/lens-filter.contract.ts +183 -0
- package/src/contracts/lens-workflow.contract.ts +162 -0
- package/src/contracts/lensFilter.ts +1 -0
- package/src/contracts/lensWorkflow.ts +1 -0
- package/src/contracts/mcp-tools.contract.ts +3636 -0
- package/src/contracts/mcpTools.ts +1 -0
- package/src/contracts/prompt.contract.ts +50 -0
- package/src/contracts/prompt.ts +1 -0
- package/src/contracts/sdk-tools.contract.ts +1457 -0
- package/src/contracts/sdkTools.ts +1 -0
- package/src/contracts/workflow-runtime.contract.ts +440 -0
- package/src/contracts/workflowRuntime.ts +1 -0
- package/src/controlObjectOwnership.ts +286 -0
- package/src/coreClient.ts +570 -0
- package/src/customTools.ts +398 -0
- package/src/decisionsClient.ts +286 -0
- package/src/domainContext.ts +15 -0
- package/src/events.ts +531 -0
- package/src/eventsCore.ts +168 -0
- package/src/facade/beliefs.ts +83 -0
- package/src/facade/context.ts +110 -0
- package/src/facade/contradictions.ts +29 -0
- package/src/facade/edges.ts +30 -0
- package/src/facade/events.ts +23 -0
- package/src/facade/evidence.ts +41 -0
- package/src/facade/graph.ts +38 -0
- package/src/facade/identity.ts +16 -0
- package/src/facade/ontologies.ts +34 -0
- package/src/facade/questions.ts +59 -0
- package/src/facade/search.ts +16 -0
- package/src/facade/tasks.ts +37 -0
- package/src/facade/topics.ts +42 -0
- package/src/facade/webhooks.ts +58 -0
- package/src/facade/worktrees.ts +51 -0
- package/src/gatewayFacades.ts +1666 -0
- package/src/graphClient.ts +529 -0
- package/src/harnessClient.ts +585 -0
- package/src/identityClient.ts +278 -0
- package/src/learningClient.ts +95 -0
- package/src/mcpParityClient.ts +240 -0
- package/src/mcpParitySurface.ts +70 -0
- package/src/ontologyClient.ts +275 -0
- package/src/packRuntime.ts +3 -0
- package/src/packsClient.ts +260 -0
- package/src/policyClient.ts +572 -0
- package/src/realtime/index.ts +51 -0
- package/src/realtime/refs.ts +17 -0
- package/src/reportsClient.ts +99 -0
- package/src/schemaClient.ts +129 -0
- package/src/sdkSurface.ts +190 -0
- package/src/topicsClient.ts +243 -0
- package/src/types.ts +807 -0
- package/src/workflowClient.ts +826 -0
- package/tsconfig.json +9 -0
- package/dist/.generated +0 -2
- package/dist/index.d.ts +0 -3
- package/dist/index.js +0 -3
- package/dist/lib/platform/auth/credentials.d.ts +0 -5
- package/dist/lib/platform/auth/credentials.js +0 -40
- package/dist/lib/platform/sdk/adminClient.d.ts +0 -404
- package/dist/lib/platform/sdk/adminClient.js +0 -384
- package/dist/lib/platform/sdk/answersClient.js +0 -21
- package/dist/lib/platform/sdk/audiencesClient.d.ts +0 -93
- package/dist/lib/platform/sdk/audiencesClient.js +0 -111
- package/dist/lib/platform/sdk/auditClient.d.ts +0 -24
- package/dist/lib/platform/sdk/auditClient.js +0 -21
- package/dist/lib/platform/sdk/beliefsClient.d.ts +0 -157
- package/dist/lib/platform/sdk/beliefsClient.js +0 -124
- package/dist/lib/platform/sdk/client.d.ts +0 -2369
- package/dist/lib/platform/sdk/client.js +0 -1831
- package/dist/lib/platform/sdk/contextClient.d.ts +0 -21
- package/dist/lib/platform/sdk/contextClient.js +0 -86
- package/dist/lib/platform/sdk/contextFacade.js +0 -10
- package/dist/lib/platform/sdk/contextPackCompiler.d.ts +0 -100
- package/dist/lib/platform/sdk/contextPackCompiler.js +0 -534
- package/dist/lib/platform/sdk/contextTypes.d.ts +0 -133
- package/dist/lib/platform/sdk/contextTypes.js +0 -1
- package/dist/lib/platform/sdk/controlObjectOwnership.d.ts +0 -308
- package/dist/lib/platform/sdk/controlObjectOwnership.js +0 -220
- package/dist/lib/platform/sdk/coreClient.d.ts +0 -139
- package/dist/lib/platform/sdk/coreClient.js +0 -366
- package/dist/lib/platform/sdk/customTools.d.ts +0 -83
- package/dist/lib/platform/sdk/customTools.js +0 -247
- package/dist/lib/platform/sdk/decisionsClient.d.ts +0 -106
- package/dist/lib/platform/sdk/decisionsClient.js +0 -129
- package/dist/lib/platform/sdk/domainContext.d.ts +0 -1
- package/dist/lib/platform/sdk/domainContext.js +0 -1
- package/dist/lib/platform/sdk/events.d.ts +0 -176
- package/dist/lib/platform/sdk/events.js +0 -261
- package/dist/lib/platform/sdk/eventsCore.d.ts +0 -13
- package/dist/lib/platform/sdk/eventsCore.js +0 -13
- package/dist/lib/platform/sdk/gatewayFacades.d.ts +0 -586
- package/dist/lib/platform/sdk/gatewayFacades.js +0 -845
- package/dist/lib/platform/sdk/graphClient.d.ts +0 -266
- package/dist/lib/platform/sdk/graphClient.js +0 -235
- package/dist/lib/platform/sdk/harnessClient.d.ts +0 -309
- package/dist/lib/platform/sdk/harnessClient.js +0 -219
- package/dist/lib/platform/sdk/identityClient.d.ts +0 -134
- package/dist/lib/platform/sdk/identityClient.js +0 -131
- package/dist/lib/platform/sdk/index.js +0 -49
- package/dist/lib/platform/sdk/learningClient.d.ts +0 -40
- package/dist/lib/platform/sdk/learningClient.js +0 -53
- package/dist/lib/platform/sdk/mcpParityClient.d.ts +0 -69
- package/dist/lib/platform/sdk/mcpParityClient.js +0 -196
- package/dist/lib/platform/sdk/mcpParitySurface.d.ts +0 -10
- package/dist/lib/platform/sdk/mcpParitySurface.js +0 -57
- package/dist/lib/platform/sdk/ontologyClient.d.ts +0 -131
- package/dist/lib/platform/sdk/ontologyClient.js +0 -161
- package/dist/lib/platform/sdk/packRuntime.d.ts +0 -1
- package/dist/lib/platform/sdk/packRuntime.js +0 -1
- package/dist/lib/platform/sdk/packsClient.d.ts +0 -126
- package/dist/lib/platform/sdk/packsClient.js +0 -157
- package/dist/lib/platform/sdk/policyClient.d.ts +0 -293
- package/dist/lib/platform/sdk/policyClient.js +0 -277
- package/dist/lib/platform/sdk/promptCatalog.js +0 -1
- package/dist/lib/platform/sdk/reportsClient.d.ts +0 -34
- package/dist/lib/platform/sdk/reportsClient.js +0 -64
- package/dist/lib/platform/sdk/schemaClient.d.ts +0 -59
- package/dist/lib/platform/sdk/schemaClient.js +0 -71
- package/dist/lib/platform/sdk/sdkSurface.d.ts +0 -56
- package/dist/lib/platform/sdk/sdkSurface.js +0 -140
- package/dist/lib/platform/sdk/topicsClient.d.ts +0 -78
- package/dist/lib/platform/sdk/topicsClient.js +0 -118
- package/dist/lib/platform/sdk/types.d.ts +0 -692
- package/dist/lib/platform/sdk/types.js +0 -1
- package/dist/lib/platform/sdk/version.d.ts +0 -2
- package/dist/lib/platform/sdk/workflowClient.d.ts +0 -313
- package/dist/lib/platform/sdk/workflowClient.js +0 -366
- package/dist/lucern/contracts/src/api-enums.contract.d.ts +0 -58
- package/dist/lucern/contracts/src/api-enums.contract.js +0 -147
- package/dist/lucern/contracts/src/auth-context.contract.d.ts +0 -8
- package/dist/lucern/contracts/src/auth-context.contract.js +0 -8
- package/dist/lucern/contracts/src/auth-session.contract.d.ts +0 -8
- package/dist/lucern/contracts/src/auth-session.contract.js +0 -8
- package/dist/lucern/contracts/src/auth.contract.d.ts +0 -88
- package/dist/lucern/contracts/src/auth.contract.js +0 -57
- package/dist/lucern/contracts/src/context-pack.contract.d.ts +0 -494
- package/dist/lucern/contracts/src/context-pack.contract.js +0 -169
- package/dist/lucern/contracts/src/convex-admin.contract.d.ts +0 -5
- package/dist/lucern/contracts/src/convex-admin.contract.js +0 -1
- package/dist/lucern/contracts/src/events-types.contract.d.ts +0 -8
- package/dist/lucern/contracts/src/events-types.contract.js +0 -8
- package/dist/lucern/contracts/src/events.contract.d.ts +0 -176
- package/dist/lucern/contracts/src/events.contract.js +0 -159
- package/dist/lucern/contracts/src/gateway.contract.d.ts +0 -74
- package/dist/lucern/contracts/src/gateway.contract.js +0 -19
- package/dist/lucern/contracts/src/ids.contract.d.ts +0 -7
- package/dist/lucern/contracts/src/ids.contract.js +0 -24
- package/dist/lucern/contracts/src/index.d.ts +0 -29
- package/dist/lucern/contracts/src/index.js +0 -29
- package/dist/lucern/contracts/src/lens-filter.contract.d.ts +0 -70
- package/dist/lucern/contracts/src/lens-filter.contract.js +0 -95
- package/dist/lucern/contracts/src/lens-workflow.contract.d.ts +0 -84
- package/dist/lucern/contracts/src/lens-workflow.contract.js +0 -54
- package/dist/lucern/contracts/src/mcp-tools.contract.d.ts +0 -151
- package/dist/lucern/contracts/src/mcp-tools.contract.js +0 -3281
- package/dist/lucern/contracts/src/ontology-matching.contract.d.ts +0 -8
- package/dist/lucern/contracts/src/ontology-matching.contract.js +0 -8
- package/dist/lucern/contracts/src/prompt.contract.d.ts +0 -24
- package/dist/lucern/contracts/src/prompt.contract.js +0 -24
- package/dist/lucern/contracts/src/sdk-methods.contract.d.ts +0 -358
- package/dist/lucern/contracts/src/sdk-methods.contract.js +0 -19
- package/dist/lucern/contracts/src/sdk-tools.contract.d.ts +0 -92
- package/dist/lucern/contracts/src/sdk-tools.contract.js +0 -1398
- package/dist/lucern/contracts/src/text-matching.contract.d.ts +0 -53
- package/dist/lucern/contracts/src/text-matching.contract.js +0 -277
- package/dist/lucern/contracts/src/topic-scope.contract.d.ts +0 -8
- package/dist/lucern/contracts/src/topic-scope.contract.js +0 -8
- package/dist/lucern/contracts/src/workflow-runtime.contract.d.ts +0 -161
- package/dist/lucern/contracts/src/workflow-runtime.contract.js +0 -257
- package/dist/realtime-refs.d.ts +0 -1
- package/dist/realtime-refs.js +0 -1
- package/dist/realtime.d.ts +0 -1
- package/dist/realtime.js +0 -1
- /package/{dist/lib/platform/sdk/index.d.ts → src/index.ts} +0 -0
- /package/{dist/lib/platform/sdk/promptCatalog.d.ts → src/promptCatalog.ts} +0 -0
- /package/{dist/lib/platform/sdk/version.js → src/version.ts} +0 -0
|
@@ -1,293 +0,0 @@
|
|
|
1
|
-
import { type GatewayClientConfig, type GatewayScope, LucernApiError } from "./coreClient";
|
|
2
|
-
export { LucernApiError };
|
|
3
|
-
export type { GatewayScope, PlatformGatewaySuccess } from "./coreClient";
|
|
4
|
-
/** Configuration for the policy client. */
|
|
5
|
-
export type PolicyClientConfig = GatewayClientConfig;
|
|
6
|
-
/** Permission direction: read access or write access. */
|
|
7
|
-
export type PermissionKind = "read" | "write";
|
|
8
|
-
/** Permission level for a write policy rule. */
|
|
9
|
-
export type WritePolicyPermission = "allow" | "deny" | "review_required";
|
|
10
|
-
type TopicRecord = {
|
|
11
|
-
topicId?: string;
|
|
12
|
-
name?: string;
|
|
13
|
-
type?: string;
|
|
14
|
-
isOwner?: boolean;
|
|
15
|
-
[key: string]: unknown;
|
|
16
|
-
};
|
|
17
|
-
/** Structured explanation of how a policy decision was derived. */
|
|
18
|
-
export type PolicyDecisionExplanation = {
|
|
19
|
-
summary?: string;
|
|
20
|
-
matchedReasonCode?: string;
|
|
21
|
-
steps?: Array<{
|
|
22
|
-
stage?: string;
|
|
23
|
-
outcome?: string;
|
|
24
|
-
reasonCode?: string;
|
|
25
|
-
detail?: string;
|
|
26
|
-
}>;
|
|
27
|
-
[key: string]: unknown;
|
|
28
|
-
};
|
|
29
|
-
/** Result of a permission check against the policy engine. */
|
|
30
|
-
export type PermissionDecision = {
|
|
31
|
-
allowed?: boolean;
|
|
32
|
-
decision?: string;
|
|
33
|
-
reasonCode?: string;
|
|
34
|
-
principalId?: string;
|
|
35
|
-
topicId?: string;
|
|
36
|
-
permission?: string;
|
|
37
|
-
policyVersion?: string;
|
|
38
|
-
traceId?: string | null;
|
|
39
|
-
explanation?: PolicyDecisionExplanation;
|
|
40
|
-
};
|
|
41
|
-
/** A persisted write policy rule controlling mutation access. */
|
|
42
|
-
export type WritePolicyRecord = {
|
|
43
|
-
id?: string;
|
|
44
|
-
topicId?: string;
|
|
45
|
-
role?: string;
|
|
46
|
-
toolCategory?: string;
|
|
47
|
-
permission?: WritePolicyPermission;
|
|
48
|
-
maxWritesPerSession?: number;
|
|
49
|
-
enabled?: boolean;
|
|
50
|
-
rationale?: string;
|
|
51
|
-
createdAt?: number;
|
|
52
|
-
updatedAt?: number;
|
|
53
|
-
createdBy?: string;
|
|
54
|
-
resolution?: string;
|
|
55
|
-
[key: string]: unknown;
|
|
56
|
-
};
|
|
57
|
-
/** Input for creating a write policy rule. */
|
|
58
|
-
export type WritePolicyCreateInput = GatewayScope & {
|
|
59
|
-
topicId?: string;
|
|
60
|
-
role: string;
|
|
61
|
-
toolCategory: string;
|
|
62
|
-
permission: WritePolicyPermission;
|
|
63
|
-
maxWritesPerSession?: number;
|
|
64
|
-
enabled?: boolean;
|
|
65
|
-
rationale?: string;
|
|
66
|
-
createdBy?: string;
|
|
67
|
-
};
|
|
68
|
-
/** Input for partially updating an existing write policy rule. */
|
|
69
|
-
export type WritePolicyUpdateInput = GatewayScope & {
|
|
70
|
-
topicId?: string;
|
|
71
|
-
clearTopicId?: boolean;
|
|
72
|
-
role?: string;
|
|
73
|
-
toolCategory?: string;
|
|
74
|
-
permission?: WritePolicyPermission;
|
|
75
|
-
maxWritesPerSession?: number;
|
|
76
|
-
clearMaxWritesPerSession?: boolean;
|
|
77
|
-
enabled?: boolean;
|
|
78
|
-
rationale?: string;
|
|
79
|
-
clearRationale?: boolean;
|
|
80
|
-
};
|
|
81
|
-
export type TenantPolicyPermission = {
|
|
82
|
-
resource: string;
|
|
83
|
-
actions: string[];
|
|
84
|
-
};
|
|
85
|
-
export type TenantPolicyRecord = {
|
|
86
|
-
id?: string;
|
|
87
|
-
tenantId: string;
|
|
88
|
-
workspaceId?: string;
|
|
89
|
-
roleName: string;
|
|
90
|
-
description?: string;
|
|
91
|
-
permissions: TenantPolicyPermission[];
|
|
92
|
-
groupBindings: string[];
|
|
93
|
-
createdAt?: number;
|
|
94
|
-
updatedAt?: number;
|
|
95
|
-
createdBy?: string;
|
|
96
|
-
updatedBy?: string;
|
|
97
|
-
};
|
|
98
|
-
/**
|
|
99
|
-
* Create the policy client for permission checks, grants, and write policies.
|
|
100
|
-
* @param config - Gateway transport configuration.
|
|
101
|
-
* @returns An object with methods to check permissions, manage grants, and manage write policies.
|
|
102
|
-
*/
|
|
103
|
-
export declare function createPolicyClient(config?: PolicyClientConfig): {
|
|
104
|
-
/**
|
|
105
|
-
* List policy decisions in the current scope.
|
|
106
|
-
*/
|
|
107
|
-
listDecisions(query?: GatewayScope & {
|
|
108
|
-
action?: string;
|
|
109
|
-
decision?: string;
|
|
110
|
-
traceId?: string;
|
|
111
|
-
principalId?: string;
|
|
112
|
-
topicId?: string;
|
|
113
|
-
limit?: number;
|
|
114
|
-
}): Promise<import("./coreClient").PlatformGatewaySuccess<import("./types").ListResult<any, "decisions">>>;
|
|
115
|
-
/**
|
|
116
|
-
* Create a permission grant.
|
|
117
|
-
*/
|
|
118
|
-
grant(input: GatewayScope & {
|
|
119
|
-
topicId: string;
|
|
120
|
-
permission: PermissionKind;
|
|
121
|
-
principal?: string;
|
|
122
|
-
principalId?: string;
|
|
123
|
-
groupId?: string;
|
|
124
|
-
beliefClusterId?: string;
|
|
125
|
-
expiresAt?: number;
|
|
126
|
-
}, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<unknown>>;
|
|
127
|
-
/**
|
|
128
|
-
* Delete a permission grant by revoking it.
|
|
129
|
-
*/
|
|
130
|
-
revoke(input: GatewayScope & {
|
|
131
|
-
topicId: string;
|
|
132
|
-
principal?: string;
|
|
133
|
-
principalId?: string;
|
|
134
|
-
groupId?: string;
|
|
135
|
-
beliefClusterId?: string;
|
|
136
|
-
}, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<unknown>>;
|
|
137
|
-
/**
|
|
138
|
-
* List write policy rules for the current scope.
|
|
139
|
-
*/
|
|
140
|
-
listWritePolicies(query?: GatewayScope & {
|
|
141
|
-
topicId?: string;
|
|
142
|
-
role?: string;
|
|
143
|
-
toolCategory?: string;
|
|
144
|
-
enabled?: boolean;
|
|
145
|
-
}): Promise<{
|
|
146
|
-
data: {
|
|
147
|
-
policies: WritePolicyRecord[];
|
|
148
|
-
};
|
|
149
|
-
success: true;
|
|
150
|
-
correlationId: string;
|
|
151
|
-
policyTraceId: string | null;
|
|
152
|
-
idempotentReplay: boolean;
|
|
153
|
-
}>;
|
|
154
|
-
/**
|
|
155
|
-
* Create a write policy rule.
|
|
156
|
-
*/
|
|
157
|
-
createWritePolicy(input: WritePolicyCreateInput, idempotencyKey?: string): Promise<{
|
|
158
|
-
data: {
|
|
159
|
-
id: string | undefined;
|
|
160
|
-
created: boolean;
|
|
161
|
-
policy: WritePolicyRecord | null;
|
|
162
|
-
};
|
|
163
|
-
success: true;
|
|
164
|
-
correlationId: string;
|
|
165
|
-
policyTraceId: string | null;
|
|
166
|
-
idempotentReplay: boolean;
|
|
167
|
-
}>;
|
|
168
|
-
/**
|
|
169
|
-
* Update an existing write policy rule by identifier.
|
|
170
|
-
*/
|
|
171
|
-
updateWritePolicy(id: string, input: WritePolicyUpdateInput, idempotencyKey?: string): Promise<{
|
|
172
|
-
data: {
|
|
173
|
-
id: string | undefined;
|
|
174
|
-
updated: boolean;
|
|
175
|
-
policy: WritePolicyRecord | null;
|
|
176
|
-
};
|
|
177
|
-
success: true;
|
|
178
|
-
correlationId: string;
|
|
179
|
-
policyTraceId: string | null;
|
|
180
|
-
idempotentReplay: boolean;
|
|
181
|
-
}>;
|
|
182
|
-
/**
|
|
183
|
-
* Delete a write policy rule by identifier.
|
|
184
|
-
*/
|
|
185
|
-
deleteWritePolicy(id: string, scope?: GatewayScope, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<{
|
|
186
|
-
id?: string;
|
|
187
|
-
deleted?: boolean;
|
|
188
|
-
}>>;
|
|
189
|
-
/**
|
|
190
|
-
* List tenant role policies for the current scope.
|
|
191
|
-
*/
|
|
192
|
-
listRolePolicies(query?: GatewayScope): Promise<{
|
|
193
|
-
data: {
|
|
194
|
-
policies: TenantPolicyRecord[];
|
|
195
|
-
};
|
|
196
|
-
success: true;
|
|
197
|
-
correlationId: string;
|
|
198
|
-
policyTraceId: string | null;
|
|
199
|
-
idempotentReplay: boolean;
|
|
200
|
-
}>;
|
|
201
|
-
/**
|
|
202
|
-
* Create a tenant role policy.
|
|
203
|
-
*/
|
|
204
|
-
createRolePolicy(input: GatewayScope & {
|
|
205
|
-
roleName: string;
|
|
206
|
-
description?: string;
|
|
207
|
-
permissions: TenantPolicyPermission[];
|
|
208
|
-
groupBindings?: string[];
|
|
209
|
-
}, idempotencyKey?: string): Promise<{
|
|
210
|
-
data: {
|
|
211
|
-
policy: TenantPolicyRecord | null;
|
|
212
|
-
};
|
|
213
|
-
success: true;
|
|
214
|
-
correlationId: string;
|
|
215
|
-
policyTraceId: string | null;
|
|
216
|
-
idempotentReplay: boolean;
|
|
217
|
-
}>;
|
|
218
|
-
/**
|
|
219
|
-
* Update a tenant role policy by identifier.
|
|
220
|
-
*/
|
|
221
|
-
updateRolePolicy(id: string, input: GatewayScope & {
|
|
222
|
-
roleName: string;
|
|
223
|
-
description?: string;
|
|
224
|
-
permissions: TenantPolicyPermission[];
|
|
225
|
-
groupBindings?: string[];
|
|
226
|
-
}, idempotencyKey?: string): Promise<{
|
|
227
|
-
data: {
|
|
228
|
-
policy: TenantPolicyRecord | null;
|
|
229
|
-
};
|
|
230
|
-
success: true;
|
|
231
|
-
correlationId: string;
|
|
232
|
-
policyTraceId: string | null;
|
|
233
|
-
idempotentReplay: boolean;
|
|
234
|
-
}>;
|
|
235
|
-
/**
|
|
236
|
-
* Delete a tenant role policy by identifier.
|
|
237
|
-
*/
|
|
238
|
-
deleteRolePolicy(id: string, scope?: GatewayScope, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<unknown>>;
|
|
239
|
-
/**
|
|
240
|
-
* Check a permission decision for a topic or project scope.
|
|
241
|
-
*/
|
|
242
|
-
checkPermission(query: GatewayScope & {
|
|
243
|
-
topicId?: string;
|
|
244
|
-
permission?: PermissionKind;
|
|
245
|
-
principal?: string;
|
|
246
|
-
principalId?: string;
|
|
247
|
-
beliefClusterId?: string;
|
|
248
|
-
}): Promise<import("./coreClient").PlatformGatewaySuccess<PermissionDecision>>;
|
|
249
|
-
/**
|
|
250
|
-
* List accessible topics for a principal.
|
|
251
|
-
*/
|
|
252
|
-
listAccessibleTopics(query?: GatewayScope & {
|
|
253
|
-
permission?: PermissionKind;
|
|
254
|
-
includeShared?: boolean;
|
|
255
|
-
principal?: string;
|
|
256
|
-
principalId?: string;
|
|
257
|
-
limit?: number;
|
|
258
|
-
}): Promise<{
|
|
259
|
-
data: {
|
|
260
|
-
permission: PermissionKind;
|
|
261
|
-
topics: TopicRecord[];
|
|
262
|
-
total: number;
|
|
263
|
-
deniedTopics: {
|
|
264
|
-
topicId: string;
|
|
265
|
-
reasonCode: string;
|
|
266
|
-
}[];
|
|
267
|
-
};
|
|
268
|
-
success: true;
|
|
269
|
-
correlationId: string;
|
|
270
|
-
policyTraceId: string | null;
|
|
271
|
-
idempotentReplay: boolean;
|
|
272
|
-
}>;
|
|
273
|
-
/**
|
|
274
|
-
* Filter topic identifiers by permission.
|
|
275
|
-
*/
|
|
276
|
-
filterByPermission(input: GatewayScope & {
|
|
277
|
-
topicIds?: string[];
|
|
278
|
-
permission?: PermissionKind;
|
|
279
|
-
principal?: string;
|
|
280
|
-
principalId?: string;
|
|
281
|
-
}): Promise<{
|
|
282
|
-
success: boolean;
|
|
283
|
-
data: {
|
|
284
|
-
permission: PermissionKind;
|
|
285
|
-
allowedTopicIds: string[];
|
|
286
|
-
deniedTopics: {
|
|
287
|
-
topicId: string;
|
|
288
|
-
reasonCode: string;
|
|
289
|
-
}[];
|
|
290
|
-
count: number;
|
|
291
|
-
};
|
|
292
|
-
}>;
|
|
293
|
-
};
|
|
@@ -1,277 +0,0 @@
|
|
|
1
|
-
import { createGatewayRequestClient, LucernApiError, randomIdempotencyKey, toQueryString, } from "./coreClient.js";
|
|
2
|
-
import { createListResult, mapGatewayData } from "./sdkSurface.js";
|
|
3
|
-
export { LucernApiError };
|
|
4
|
-
function asTopicArray(data) {
|
|
5
|
-
if (Array.isArray(data)) {
|
|
6
|
-
return data.filter((row) => Boolean(row) && typeof row === "object");
|
|
7
|
-
}
|
|
8
|
-
return [];
|
|
9
|
-
}
|
|
10
|
-
function asWritePolicyRecord(data) {
|
|
11
|
-
if (!data || typeof data !== "object") {
|
|
12
|
-
return null;
|
|
13
|
-
}
|
|
14
|
-
return data;
|
|
15
|
-
}
|
|
16
|
-
function asWritePolicyArray(data) {
|
|
17
|
-
if (!Array.isArray(data)) {
|
|
18
|
-
return [];
|
|
19
|
-
}
|
|
20
|
-
return data
|
|
21
|
-
.map(asWritePolicyRecord)
|
|
22
|
-
.filter((row) => Boolean(row));
|
|
23
|
-
}
|
|
24
|
-
function asRolePolicyRecord(data) {
|
|
25
|
-
if (!data || typeof data !== "object") {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
return data;
|
|
29
|
-
}
|
|
30
|
-
function asRolePolicyArray(data) {
|
|
31
|
-
if (!Array.isArray(data)) {
|
|
32
|
-
return [];
|
|
33
|
-
}
|
|
34
|
-
return data
|
|
35
|
-
.map(asRolePolicyRecord)
|
|
36
|
-
.filter((row) => Boolean(row));
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Create the policy client for permission checks, grants, and write policies.
|
|
40
|
-
* @param config - Gateway transport configuration.
|
|
41
|
-
* @returns An object with methods to check permissions, manage grants, and manage write policies.
|
|
42
|
-
*/
|
|
43
|
-
export function createPolicyClient(config = {}) {
|
|
44
|
-
const gateway = createGatewayRequestClient(config);
|
|
45
|
-
return {
|
|
46
|
-
/**
|
|
47
|
-
* List policy decisions in the current scope.
|
|
48
|
-
*/
|
|
49
|
-
async listDecisions(query = {}) {
|
|
50
|
-
return gateway.request({
|
|
51
|
-
path: `/api/platform/v1/policy/decisions${toQueryString(query)}`,
|
|
52
|
-
}).then((response) => mapGatewayData(response, (data) => createListResult(Array.isArray(data) ? data : [], "decisions")));
|
|
53
|
-
},
|
|
54
|
-
/**
|
|
55
|
-
* Create a permission grant.
|
|
56
|
-
*/
|
|
57
|
-
async grant(input, idempotencyKey) {
|
|
58
|
-
return gateway.request({
|
|
59
|
-
path: "/api/platform/v1/policy/grant",
|
|
60
|
-
method: "POST",
|
|
61
|
-
body: input,
|
|
62
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
|
|
63
|
-
});
|
|
64
|
-
},
|
|
65
|
-
/**
|
|
66
|
-
* Delete a permission grant by revoking it.
|
|
67
|
-
*/
|
|
68
|
-
async revoke(input, idempotencyKey) {
|
|
69
|
-
return gateway.request({
|
|
70
|
-
path: "/api/platform/v1/policy/revoke",
|
|
71
|
-
method: "POST",
|
|
72
|
-
body: input,
|
|
73
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
|
|
74
|
-
});
|
|
75
|
-
},
|
|
76
|
-
/**
|
|
77
|
-
* List write policy rules for the current scope.
|
|
78
|
-
*/
|
|
79
|
-
async listWritePolicies(query = {}) {
|
|
80
|
-
const response = await gateway.request({
|
|
81
|
-
path: `/api/platform/v1/policy/write-policies${toQueryString(query)}`,
|
|
82
|
-
});
|
|
83
|
-
const rawPolicies = response.data && typeof response.data === "object"
|
|
84
|
-
? response.data.policies
|
|
85
|
-
: response.data;
|
|
86
|
-
return {
|
|
87
|
-
...response,
|
|
88
|
-
data: {
|
|
89
|
-
policies: asWritePolicyArray(rawPolicies),
|
|
90
|
-
},
|
|
91
|
-
};
|
|
92
|
-
},
|
|
93
|
-
/**
|
|
94
|
-
* Create a write policy rule.
|
|
95
|
-
*/
|
|
96
|
-
async createWritePolicy(input, idempotencyKey) {
|
|
97
|
-
const response = await gateway.request({
|
|
98
|
-
path: "/api/platform/v1/policy/write-policies",
|
|
99
|
-
method: "POST",
|
|
100
|
-
body: input,
|
|
101
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
|
|
102
|
-
});
|
|
103
|
-
return {
|
|
104
|
-
...response,
|
|
105
|
-
data: {
|
|
106
|
-
id: typeof response.data?.id === "string" ? response.data.id : undefined,
|
|
107
|
-
created: response.data?.created === true,
|
|
108
|
-
policy: asWritePolicyRecord(response.data?.policy),
|
|
109
|
-
},
|
|
110
|
-
};
|
|
111
|
-
},
|
|
112
|
-
/**
|
|
113
|
-
* Update an existing write policy rule by identifier.
|
|
114
|
-
*/
|
|
115
|
-
async updateWritePolicy(id, input, idempotencyKey) {
|
|
116
|
-
const response = await gateway.request({
|
|
117
|
-
path: `/api/platform/v1/policy/write-policies/${encodeURIComponent(id)}`,
|
|
118
|
-
method: "PATCH",
|
|
119
|
-
body: input,
|
|
120
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
|
|
121
|
-
});
|
|
122
|
-
return {
|
|
123
|
-
...response,
|
|
124
|
-
data: {
|
|
125
|
-
id: typeof response.data?.id === "string" ? response.data.id : undefined,
|
|
126
|
-
updated: response.data?.updated === true,
|
|
127
|
-
policy: asWritePolicyRecord(response.data?.policy),
|
|
128
|
-
},
|
|
129
|
-
};
|
|
130
|
-
},
|
|
131
|
-
/**
|
|
132
|
-
* Delete a write policy rule by identifier.
|
|
133
|
-
*/
|
|
134
|
-
async deleteWritePolicy(id, scope = {}, idempotencyKey) {
|
|
135
|
-
return gateway.request({
|
|
136
|
-
path: `/api/platform/v1/policy/write-policies/${encodeURIComponent(id)}${toQueryString(scope)}`,
|
|
137
|
-
method: "DELETE",
|
|
138
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
|
|
139
|
-
});
|
|
140
|
-
},
|
|
141
|
-
/**
|
|
142
|
-
* List tenant role policies for the current scope.
|
|
143
|
-
*/
|
|
144
|
-
async listRolePolicies(query = {}) {
|
|
145
|
-
const response = await gateway.request({
|
|
146
|
-
path: `/api/platform/v1/policy/roles${toQueryString(query)}`,
|
|
147
|
-
});
|
|
148
|
-
return {
|
|
149
|
-
...response,
|
|
150
|
-
data: {
|
|
151
|
-
policies: asRolePolicyArray(response.data?.policies),
|
|
152
|
-
},
|
|
153
|
-
};
|
|
154
|
-
},
|
|
155
|
-
/**
|
|
156
|
-
* Create a tenant role policy.
|
|
157
|
-
*/
|
|
158
|
-
async createRolePolicy(input, idempotencyKey) {
|
|
159
|
-
const response = await gateway.request({
|
|
160
|
-
path: "/api/platform/v1/policy/roles",
|
|
161
|
-
method: "POST",
|
|
162
|
-
body: input,
|
|
163
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
|
|
164
|
-
});
|
|
165
|
-
return {
|
|
166
|
-
...response,
|
|
167
|
-
data: {
|
|
168
|
-
policy: asRolePolicyRecord(response.data?.policy),
|
|
169
|
-
},
|
|
170
|
-
};
|
|
171
|
-
},
|
|
172
|
-
/**
|
|
173
|
-
* Update a tenant role policy by identifier.
|
|
174
|
-
*/
|
|
175
|
-
async updateRolePolicy(id, input, idempotencyKey) {
|
|
176
|
-
const response = await gateway.request({
|
|
177
|
-
path: `/api/platform/v1/policy/roles/${encodeURIComponent(id)}`,
|
|
178
|
-
method: "PATCH",
|
|
179
|
-
body: input,
|
|
180
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
|
|
181
|
-
});
|
|
182
|
-
return {
|
|
183
|
-
...response,
|
|
184
|
-
data: {
|
|
185
|
-
policy: asRolePolicyRecord(response.data?.policy),
|
|
186
|
-
},
|
|
187
|
-
};
|
|
188
|
-
},
|
|
189
|
-
/**
|
|
190
|
-
* Delete a tenant role policy by identifier.
|
|
191
|
-
*/
|
|
192
|
-
async deleteRolePolicy(id, scope = {}, idempotencyKey) {
|
|
193
|
-
return gateway.request({
|
|
194
|
-
path: `/api/platform/v1/policy/roles/${encodeURIComponent(id)}${toQueryString(scope)}`,
|
|
195
|
-
method: "DELETE",
|
|
196
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
|
|
197
|
-
});
|
|
198
|
-
},
|
|
199
|
-
/**
|
|
200
|
-
* Check a permission decision for a topic or project scope.
|
|
201
|
-
*/
|
|
202
|
-
async checkPermission(query) {
|
|
203
|
-
if (!query.topicId) {
|
|
204
|
-
throw new Error("topicId is required");
|
|
205
|
-
}
|
|
206
|
-
return gateway.request({
|
|
207
|
-
path: `/api/platform/v1/policy/check${toQueryString(query)}`,
|
|
208
|
-
});
|
|
209
|
-
},
|
|
210
|
-
/**
|
|
211
|
-
* List accessible topics for a principal.
|
|
212
|
-
*/
|
|
213
|
-
async listAccessibleTopics(query = {}) {
|
|
214
|
-
const permission = query.permission ?? "read";
|
|
215
|
-
const principal = query.principal ?? query.principalId;
|
|
216
|
-
const response = await gateway.request({
|
|
217
|
-
path: `/api/platform/v1/policy/topics${toQueryString({
|
|
218
|
-
tenantId: query.tenantId,
|
|
219
|
-
workspaceId: query.workspaceId,
|
|
220
|
-
permission,
|
|
221
|
-
includeShared: query.includeShared,
|
|
222
|
-
principal,
|
|
223
|
-
limit: query.limit,
|
|
224
|
-
})}`,
|
|
225
|
-
});
|
|
226
|
-
return {
|
|
227
|
-
...response,
|
|
228
|
-
data: {
|
|
229
|
-
permission,
|
|
230
|
-
topics: asTopicArray(response.data?.topics),
|
|
231
|
-
total: typeof response.data?.total === "number"
|
|
232
|
-
? response.data.total
|
|
233
|
-
: asTopicArray(response.data?.topics).length,
|
|
234
|
-
deniedTopics: Array.isArray(response.data?.deniedTopics)
|
|
235
|
-
? response.data.deniedTopics
|
|
236
|
-
: [],
|
|
237
|
-
},
|
|
238
|
-
};
|
|
239
|
-
},
|
|
240
|
-
/**
|
|
241
|
-
* Filter topic identifiers by permission.
|
|
242
|
-
*/
|
|
243
|
-
async filterByPermission(input) {
|
|
244
|
-
const permission = input.permission ?? "read";
|
|
245
|
-
const principal = input.principal ?? input.principalId;
|
|
246
|
-
const uniqueTopicIds = [...new Set(input.topicIds ?? [])].filter((topicId) => typeof topicId === "string" && topicId.trim().length > 0);
|
|
247
|
-
const response = await gateway.request({
|
|
248
|
-
path: "/api/platform/v1/policy/filter",
|
|
249
|
-
method: "POST",
|
|
250
|
-
body: {
|
|
251
|
-
tenantId: input.tenantId,
|
|
252
|
-
workspaceId: input.workspaceId,
|
|
253
|
-
topicIds: uniqueTopicIds,
|
|
254
|
-
permission,
|
|
255
|
-
principal,
|
|
256
|
-
},
|
|
257
|
-
});
|
|
258
|
-
const allowedTopicIds = Array.isArray(response.data?.allowedTopicIds)
|
|
259
|
-
? response.data.allowedTopicIds
|
|
260
|
-
: [];
|
|
261
|
-
const deniedTopics = Array.isArray(response.data?.deniedTopics)
|
|
262
|
-
? response.data.deniedTopics
|
|
263
|
-
: [];
|
|
264
|
-
return {
|
|
265
|
-
success: true,
|
|
266
|
-
data: {
|
|
267
|
-
permission,
|
|
268
|
-
allowedTopicIds,
|
|
269
|
-
deniedTopics,
|
|
270
|
-
count: typeof response.data?.count === "number"
|
|
271
|
-
? response.data.count
|
|
272
|
-
: allowedTopicIds.length,
|
|
273
|
-
},
|
|
274
|
-
};
|
|
275
|
-
},
|
|
276
|
-
};
|
|
277
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { getPromptCatalogSnapshot } from "@/lib/langfuse/prompt-catalog";
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { type GatewayClientConfig } from "./coreClient";
|
|
2
|
-
import type { TopicIdentifierInput, ReportTemplatesResponse, ReportWithSectionsResponse } from "./types";
|
|
3
|
-
/** Configuration for the reports client. */
|
|
4
|
-
export type ReportsClientConfig = GatewayClientConfig;
|
|
5
|
-
export type { ProjectReportsResponse, ReportTemplatesResponse, ReportWithSectionsResponse, } from "./types";
|
|
6
|
-
/**
|
|
7
|
-
* Create the reports client for report templates and generated reports.
|
|
8
|
-
* @param config - Gateway transport configuration.
|
|
9
|
-
* @returns An object with methods to list templates, list reports, and get a report.
|
|
10
|
-
*/
|
|
11
|
-
export declare function createReportsClient(config?: ReportsClientConfig): {
|
|
12
|
-
/**
|
|
13
|
-
* List report templates.
|
|
14
|
-
*/
|
|
15
|
-
listTemplates(args?: {
|
|
16
|
-
slug?: string;
|
|
17
|
-
}): Promise<import("./coreClient").PlatformGatewaySuccess<ReportTemplatesResponse>>;
|
|
18
|
-
/**
|
|
19
|
-
* @deprecated Use listTemplates.
|
|
20
|
-
*/
|
|
21
|
-
getTemplates(args?: {
|
|
22
|
-
slug?: string;
|
|
23
|
-
}): Promise<import("./coreClient").PlatformGatewaySuccess<ReportTemplatesResponse>>;
|
|
24
|
-
/**
|
|
25
|
-
* List reports for a topic scope.
|
|
26
|
-
*/
|
|
27
|
-
listReports(input: TopicIdentifierInput, args?: {
|
|
28
|
-
summary?: boolean;
|
|
29
|
-
}): Promise<import("./coreClient").PlatformGatewaySuccess<import("./types").ListResult<any, "reports">>>;
|
|
30
|
-
/**
|
|
31
|
-
* Get a generated report.
|
|
32
|
-
*/
|
|
33
|
-
getReport(reportId: string): Promise<import("./coreClient").PlatformGatewaySuccess<ReportWithSectionsResponse>>;
|
|
34
|
-
};
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { createGatewayRequestClient, toQueryString, } from "./coreClient.js";
|
|
2
|
-
import { createListResult, mapGatewayData, resolveTopicId } from "./sdkSurface.js";
|
|
3
|
-
/**
|
|
4
|
-
* Create the reports client for report templates and generated reports.
|
|
5
|
-
* @param config - Gateway transport configuration.
|
|
6
|
-
* @returns An object with methods to list templates, list reports, and get a report.
|
|
7
|
-
*/
|
|
8
|
-
export function createReportsClient(config = {}) {
|
|
9
|
-
const gateway = createGatewayRequestClient(config);
|
|
10
|
-
return {
|
|
11
|
-
/**
|
|
12
|
-
* List report templates.
|
|
13
|
-
*/
|
|
14
|
-
async listTemplates(args = {}) {
|
|
15
|
-
return gateway.request({
|
|
16
|
-
path: `/api/platform/v1/reports/templates${toQueryString({
|
|
17
|
-
slug: args.slug,
|
|
18
|
-
})}`,
|
|
19
|
-
}).then((response) => mapGatewayData(response, (data) => {
|
|
20
|
-
const record = data && typeof data === "object"
|
|
21
|
-
? data
|
|
22
|
-
: {};
|
|
23
|
-
const rows = Array.isArray(data)
|
|
24
|
-
? data
|
|
25
|
-
: Array.isArray(record.templates)
|
|
26
|
-
? record.templates
|
|
27
|
-
: [];
|
|
28
|
-
return createListResult(rows, "templates");
|
|
29
|
-
}));
|
|
30
|
-
},
|
|
31
|
-
/**
|
|
32
|
-
* @deprecated Use listTemplates.
|
|
33
|
-
*/
|
|
34
|
-
async getTemplates(args = {}) {
|
|
35
|
-
return this.listTemplates(args);
|
|
36
|
-
},
|
|
37
|
-
/**
|
|
38
|
-
* List reports for a topic scope.
|
|
39
|
-
*/
|
|
40
|
-
async listReports(input, args = {}) {
|
|
41
|
-
const topicId = resolveTopicId(input);
|
|
42
|
-
if (!topicId) {
|
|
43
|
-
throw new Error("topicId is required");
|
|
44
|
-
}
|
|
45
|
-
return gateway.request({
|
|
46
|
-
path: `/api/platform/v1/reports/topics/${encodeURIComponent(topicId)}${toQueryString({
|
|
47
|
-
summary: typeof args.summary === "boolean"
|
|
48
|
-
? args.summary
|
|
49
|
-
? "true"
|
|
50
|
-
: "false"
|
|
51
|
-
: undefined,
|
|
52
|
-
})}`,
|
|
53
|
-
}).then((response) => mapGatewayData(response, (data) => createListResult(Array.isArray(data) ? data : [], "reports")));
|
|
54
|
-
},
|
|
55
|
-
/**
|
|
56
|
-
* Get a generated report.
|
|
57
|
-
*/
|
|
58
|
-
async getReport(reportId) {
|
|
59
|
-
return gateway.request({
|
|
60
|
-
path: `/api/platform/v1/reports/${encodeURIComponent(reportId)}`,
|
|
61
|
-
});
|
|
62
|
-
},
|
|
63
|
-
};
|
|
64
|
-
}
|