@smthrs/gateway 0.33.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.
@@ -0,0 +1,164 @@
1
+ import { getRequiredScopeForGatewayMethod } from "../rpc/index.js";
2
+
3
+ /** @typedef {(typeof GATEWAY_SCOPE_VALUES)[number]} GatewayScope */
4
+
5
+ export const GATEWAY_SCOPE_VALUES = /** @type {const} */ ([
6
+ "run:read",
7
+ "run:write",
8
+ "run:admin",
9
+ "approval:submit",
10
+ "signal:submit",
11
+ "cron:read",
12
+ "cron:write",
13
+ "account:read",
14
+ "memory:read",
15
+ "prompt:read",
16
+ "score:read",
17
+ "ticket:read",
18
+ "ticket:write",
19
+ "observability:read",
20
+ ]);
21
+
22
+ /** @type {Record<GatewayScope, string>} */
23
+ export const GATEWAY_SCOPE_DESCRIPTIONS = {
24
+ "run:read": "Read run state, summaries, event streams, node output, and node diffs.",
25
+ "run:write": "Launch, resume, and cancel runs.",
26
+ "run:admin": "Perform elevated run control such as hijack and rewind.",
27
+ "approval:submit": "Submit approval decisions.",
28
+ "signal:submit": "Submit workflow signals.",
29
+ "cron:read": "List cron schedules.",
30
+ "cron:write": "Create, delete, and trigger cron schedules.",
31
+ "account:read": "List registered agent accounts (API keys redacted).",
32
+ "memory:read": "List cross-run memory facts.",
33
+ "prompt:read": "List registered prompts.",
34
+ "score:read": "List scorer/eval results for a run.",
35
+ "ticket:read": "List work docs (tickets/plans/specs/proposals).",
36
+ "ticket:write": "Create, update, and soft-delete work docs.",
37
+ "observability:read": "Read DevTools and other observability streams.",
38
+ };
39
+
40
+ /** @type {GatewayScope[]} */
41
+ const RUN_SCOPE_ORDER = ["run:read", "run:write", "run:admin"];
42
+ /** @type {GatewayScope[]} */
43
+ const CRON_SCOPE_ORDER = ["cron:read", "cron:write"];
44
+ /** @type {GatewayScope[]} */
45
+ const TICKET_SCOPE_ORDER = ["ticket:read", "ticket:write"];
46
+
47
+ /**
48
+ * @param {string} scope
49
+ * @returns {scope is GatewayScope}
50
+ */
51
+ export function isGatewayScope(scope) {
52
+ return /** @type {readonly string[]} */ (GATEWAY_SCOPE_VALUES).includes(scope);
53
+ }
54
+
55
+ /**
56
+ * @param {GatewayScope} granted
57
+ * @param {GatewayScope} required
58
+ * @returns {boolean}
59
+ */
60
+ function gatewayScopeImplies(granted, required) {
61
+ if (granted === required) {
62
+ return true;
63
+ }
64
+ if (granted.startsWith("run:") && required.startsWith("run:")) {
65
+ return RUN_SCOPE_ORDER.indexOf(granted) >= RUN_SCOPE_ORDER.indexOf(required);
66
+ }
67
+ if (granted.startsWith("cron:") && required.startsWith("cron:")) {
68
+ return CRON_SCOPE_ORDER.indexOf(granted) >= CRON_SCOPE_ORDER.indexOf(required);
69
+ }
70
+ if (granted.startsWith("ticket:") && required.startsWith("ticket:")) {
71
+ return TICKET_SCOPE_ORDER.indexOf(granted) >= TICKET_SCOPE_ORDER.indexOf(required);
72
+ }
73
+ return false;
74
+ }
75
+
76
+ /**
77
+ * @param {string} scope
78
+ * @param {GatewayScope} required
79
+ * @returns {boolean}
80
+ */
81
+ function legacyAccessImplies(scope, required) {
82
+ switch (scope) {
83
+ case "read":
84
+ return (
85
+ required === "run:read" ||
86
+ required === "cron:read" ||
87
+ required === "account:read" ||
88
+ required === "memory:read" ||
89
+ required === "prompt:read" ||
90
+ required === "score:read" ||
91
+ required === "ticket:read" ||
92
+ required === "observability:read"
93
+ );
94
+ case "execute":
95
+ return (
96
+ required === "run:read" ||
97
+ required === "run:write" ||
98
+ required === "signal:submit" ||
99
+ required === "cron:read" ||
100
+ required === "cron:write" ||
101
+ required === "ticket:read" ||
102
+ required === "ticket:write"
103
+ );
104
+ case "approve":
105
+ return required === "approval:submit" || legacyAccessImplies("execute", required);
106
+ case "admin":
107
+ return true;
108
+ default:
109
+ return false;
110
+ }
111
+ }
112
+
113
+ /**
114
+ * A name grant ("getRun") or wildcard-prefix grant ("runs.*") authorizes a
115
+ * method invocation, but it must never escalate beyond the scope that method
116
+ * itself requires: holding "getRun" lets you call getRun (a run:read method),
117
+ * not a run:admin method that happens to share the matched name/prefix. We gate
118
+ * the grant on the dispatched method's own required scope so a name/prefix grant
119
+ * can confer at most what that method legitimately needs.
120
+ *
121
+ * @param {string} methodName
122
+ * @param {GatewayScope} requiredScope
123
+ * @returns {boolean}
124
+ */
125
+ function methodGrantSatisfiesRequiredScope(methodName, requiredScope) {
126
+ const methodScope = getRequiredScopeForGatewayMethod(methodName);
127
+ if (methodScope === undefined) {
128
+ return false;
129
+ }
130
+ return gatewayScopeImplies(methodScope, requiredScope);
131
+ }
132
+
133
+ /**
134
+ * @param {readonly string[]} grantedScopes
135
+ * @param {GatewayScope} requiredScope
136
+ * @param {string} [methodName]
137
+ * @returns {boolean}
138
+ */
139
+ export function hasGatewayScope(grantedScopes, requiredScope, methodName) {
140
+ const normalized = grantedScopes.map((scope) => scope.trim()).filter(Boolean);
141
+ if (normalized.includes("*")) {
142
+ return true;
143
+ }
144
+ for (const granted of normalized) {
145
+ if (methodName && granted === methodName && methodGrantSatisfiesRequiredScope(methodName, requiredScope)) {
146
+ return true;
147
+ }
148
+ if (
149
+ methodName &&
150
+ granted.endsWith(".*") &&
151
+ methodName.startsWith(granted.slice(0, -1)) &&
152
+ methodGrantSatisfiesRequiredScope(methodName, requiredScope)
153
+ ) {
154
+ return true;
155
+ }
156
+ if (isGatewayScope(granted) && gatewayScopeImplies(granted, requiredScope)) {
157
+ return true;
158
+ }
159
+ if (legacyAccessImplies(granted, requiredScope)) {
160
+ return true;
161
+ }
162
+ }
163
+ return false;
164
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,316 @@
1
+ import { SmithersApiVersion as SmithersApiVersion$2, GatewayRpcMethod as GatewayRpcMethod$2, GatewayRpcErrorCode as GatewayRpcErrorCode$2, GatewayComparisonScoreRow as GatewayComparisonScoreRow$2, GatewayScoreDetail as GatewayScoreDetail$2, CancelRunRequest as CancelRunRequest$1, CancelRunResponse as CancelRunResponse$1, CreateTicketRequest as CreateTicketRequest$1, CronCreateRequest as CronCreateRequest$1, CronDeleteRequest as CronDeleteRequest$1, CronListRequest as CronListRequest$1, CronRunRequest as CronRunRequest$1, DeleteTicketRequest as DeleteTicketRequest$1, GatewayAccount as GatewayAccount$1, GatewayApprovalSummary as GatewayApprovalSummary$1, GatewayDocKind as GatewayDocKind$1, GatewayDocRow as GatewayDocRow$1, GatewayMemoryFact as GatewayMemoryFact$1, GatewayPrompt as GatewayPrompt$1, GatewayRunDescendant as GatewayRunDescendant$1, GatewayRunSummary as GatewayRunSummary$1, GatewayScoreRow as GatewayScoreRow$1, GatewayTicketRow as GatewayTicketRow$1, GatewayWorkflowSummary as GatewayWorkflowSummary$1, GetDevToolsSnapshotRequest as GetDevToolsSnapshotRequest$1, GetDevToolsSnapshotResponse as GetDevToolsSnapshotResponse$1, GetRunRequest as GetRunRequest$1, GetSchemaSignatureRequest as GetSchemaSignatureRequest$1, GetSchemaSignatureResponse as GetSchemaSignatureResponse$1, GetScoreDetailRequest as GetScoreDetailRequest$1, GetScoreDetailResponse as GetScoreDetailResponse$1, HijackRunRequest as HijackRunRequest$1, HijackRunResponse as HijackRunResponse$1, LaunchRunRequest as LaunchRunRequest$1, LaunchRunResponse as LaunchRunResponse$1, ListAccountsRequest as ListAccountsRequest$1, ListAccountsResponse as ListAccountsResponse$1, ListApprovalsRequest as ListApprovalsRequest$1, ListApprovalsResponse as ListApprovalsResponse$1, ListDocsRequest as ListDocsRequest$1, ListDocsResponse as ListDocsResponse$1, ListMemoryFactsRequest as ListMemoryFactsRequest$1, ListMemoryFactsResponse as ListMemoryFactsResponse$1, ListPromptsRequest as ListPromptsRequest$1, ListPromptsResponse as ListPromptsResponse$1, ListRunDescendantsRequest as ListRunDescendantsRequest$1, ListRunDescendantsResponse as ListRunDescendantsResponse$1, ListRunsRequest as ListRunsRequest$1, ListRunsResponse as ListRunsResponse$1, ListScoresForRunsRequest as ListScoresForRunsRequest$1, ListScoresForRunsResponse as ListScoresForRunsResponse$1, ListScoresRequest as ListScoresRequest$1, ListScoresResponse as ListScoresResponse$1, ListTicketsRequest as ListTicketsRequest$1, ListTicketsResponse as ListTicketsResponse$1, ListWorkflowsRequest as ListWorkflowsRequest$1, ListWorkflowsResponse as ListWorkflowsResponse$1, NodeRequest as NodeRequest$1, PauseRunRequest as PauseRunRequest$1, PauseRunResponse as PauseRunResponse$1, ResumeRunRequest as ResumeRunRequest$1, ResumeRunResponse as ResumeRunResponse$1, RewindRunRequest as RewindRunRequest$1, StreamDevToolsRequest as StreamDevToolsRequest$1, StreamRunEventsRequest as StreamRunEventsRequest$1, StreamRunEventsResponse as StreamRunEventsResponse$1, SubmitApprovalRequest as SubmitApprovalRequest$1, SubmitApprovalResponse as SubmitApprovalResponse$1, SubmitSignalRequest as SubmitSignalRequest$1, UpdateTicketRequest as UpdateTicketRequest$1 } from '@smthrs/protocol/gateway-rpc';
2
+
3
+ /**
4
+ * @param {string} scope
5
+ * @returns {scope is GatewayScope}
6
+ */
7
+ declare function isGatewayScope(scope: string): scope is GatewayScope$2;
8
+ /**
9
+ * @param {readonly string[]} grantedScopes
10
+ * @param {GatewayScope} requiredScope
11
+ * @param {string} [methodName]
12
+ * @returns {boolean}
13
+ */
14
+ declare function hasGatewayScope(grantedScopes: readonly string[], requiredScope: GatewayScope$2, methodName?: string): boolean;
15
+ /** @typedef {(typeof GATEWAY_SCOPE_VALUES)[number]} GatewayScope */
16
+ declare const GATEWAY_SCOPE_VALUES: readonly ["run:read", "run:write", "run:admin", "approval:submit", "signal:submit", "cron:read", "cron:write", "account:read", "memory:read", "prompt:read", "score:read", "ticket:read", "ticket:write", "observability:read"];
17
+ /** @type {Record<GatewayScope, string>} */
18
+ declare const GATEWAY_SCOPE_DESCRIPTIONS: Record<GatewayScope$2, string>;
19
+ type GatewayScope$2 = (typeof GATEWAY_SCOPE_VALUES)[number];
20
+
21
+ /**
22
+ * Gateway-owned RPC catalog metadata plus compatibility re-exports for the
23
+ * protocol-owned wire contract.
24
+ *
25
+ * This file deliberately does not share a basename with `index.js`: a
26
+ * same-basename `.js`/`.ts` pair both compile to one `.d.ts` and the type-only
27
+ * twin silently drops every value export from the `.js`.
28
+ */
29
+
30
+ type JsonSchema$2 = {
31
+ readonly type?: string | readonly string[];
32
+ readonly description?: string;
33
+ readonly enum?: readonly unknown[];
34
+ readonly const?: unknown;
35
+ readonly format?: string;
36
+ readonly minimum?: number;
37
+ readonly maximum?: number;
38
+ readonly minLength?: number;
39
+ readonly maxLength?: number;
40
+ readonly minItems?: number;
41
+ readonly maxItems?: number;
42
+ readonly default?: unknown;
43
+ readonly nullable?: boolean;
44
+ readonly items?: JsonSchema$2;
45
+ readonly properties?: Record<string, JsonSchema$2>;
46
+ readonly required?: readonly string[];
47
+ readonly additionalProperties?: boolean | JsonSchema$2;
48
+ readonly oneOf?: readonly JsonSchema$2[];
49
+ readonly anyOf?: readonly JsonSchema$2[];
50
+ };
51
+ type GatewayRpcErrorDefinition$2 = {
52
+ readonly version: SmithersApiVersion$2;
53
+ readonly code: GatewayRpcErrorCode$2;
54
+ readonly httpStatus: number;
55
+ readonly description: string;
56
+ };
57
+ type GatewayRpcDefinition$2 = {
58
+ readonly version: SmithersApiVersion$2;
59
+ readonly method: GatewayRpcMethod$2;
60
+ readonly title: string;
61
+ readonly description: string;
62
+ readonly maturity: "stable";
63
+ readonly transport: "http" | "websocket" | "http+websocket";
64
+ readonly requiredScope: GatewayScope$2;
65
+ readonly requestSchema: JsonSchema$2;
66
+ readonly responseSchema: JsonSchema$2;
67
+ readonly errors: readonly GatewayRpcErrorCode$2[];
68
+ readonly exampleRequest: unknown;
69
+ readonly exampleResponse: unknown;
70
+ };
71
+
72
+ /**
73
+ * @param {string} method
74
+ * @returns {GatewayRpcMethod | undefined}
75
+ */
76
+ declare function canonicalGatewayRpcMethod(method: string): GatewayRpcMethod$1 | undefined;
77
+ /**
78
+ * @param {string} method
79
+ * @returns {GatewayRpcDefinition | undefined}
80
+ */
81
+ declare function getGatewayRpcDefinition(method: string): GatewayRpcDefinition$1 | undefined;
82
+ /**
83
+ * @param {string} method
84
+ * @returns {GatewayScope | undefined}
85
+ */
86
+ declare function getRequiredScopeForGatewayMethod(method: string): GatewayScope$1 | undefined;
87
+ /**
88
+ * @returns {readonly GatewayRpcMethod[]}
89
+ */
90
+ declare function listGatewayRpcMethods(): readonly GatewayRpcMethod$1[];
91
+ /**
92
+ * @param {string} method
93
+ * @returns {method is GatewayRpcMethod}
94
+ */
95
+ declare function isGatewayRpcMethod(method: string): method is GatewayRpcMethod$1;
96
+ /**
97
+ * @returns {readonly GatewayScope[]}
98
+ */
99
+ declare function getGatewayScopeValues(): readonly GatewayScope$1[];
100
+ declare const SMITHERS_API_VERSION: SmithersApiVersion$1;
101
+ declare const GATEWAY_EVENT_WINDOW_DEFAULT: 10000;
102
+ /** @type {JsonSchema} */
103
+ declare const anyJsonSchema: JsonSchema$1;
104
+ /** @type {Record<GatewayRpcErrorCode, GatewayRpcErrorDefinition>} */
105
+ declare const GATEWAY_RPC_ERRORS: Record<GatewayRpcErrorCode$1, GatewayRpcErrorDefinition$1>;
106
+ /** @type {Record<string, GatewayRpcMethod>} */
107
+ declare const GATEWAY_RPC_LEGACY_METHOD_ALIASES: Record<string, GatewayRpcMethod$1>;
108
+ /** @type {readonly GatewayRpcDefinition[]} */
109
+ declare const GATEWAY_RPC_DEFINITIONS: readonly GatewayRpcDefinition$1[];
110
+ type SmithersApiVersion$1 = SmithersApiVersion$2;
111
+ type JsonSchema$1 = JsonSchema$2;
112
+ type GatewayRpcErrorCode$1 = GatewayRpcErrorCode$2;
113
+ type GatewayRpcErrorDefinition$1 = GatewayRpcErrorDefinition$2;
114
+ type GatewayRpcDefinition$1 = GatewayRpcDefinition$2;
115
+ type GatewayRpcMethod$1 = GatewayRpcMethod$2;
116
+ type GatewayScope$1 = GatewayScope$2;
117
+
118
+ /**
119
+ * @template {Record<string, unknown>} Row
120
+ * @param {Row} row
121
+ * @returns {Row}
122
+ */
123
+ declare function serializeAccountRow<Row extends Record<string, unknown>>(row: Row): Row;
124
+
125
+ declare const apiCollectionNames: readonly ["runs", "run_events", "nodes", "node_outputs", "approvals", "crons", "tickets", "docs"];
126
+
127
+ /**
128
+ * @param {Record<string, unknown>} row
129
+ * @returns {{
130
+ * runId: unknown,
131
+ * workflowKey?: unknown,
132
+ * nodeId: unknown,
133
+ * iteration: unknown,
134
+ * requestTitle: unknown,
135
+ * requestSummary: unknown,
136
+ * requestedAtMs: unknown,
137
+ * approvalMode: unknown,
138
+ * options: unknown,
139
+ * allowedScopes: unknown,
140
+ * allowedUsers: unknown,
141
+ * autoApprove: unknown,
142
+ * }}
143
+ */
144
+ declare function serializeApprovalRow(row: Record<string, unknown>): {
145
+ runId: unknown;
146
+ workflowKey?: unknown;
147
+ nodeId: unknown;
148
+ iteration: unknown;
149
+ requestTitle: unknown;
150
+ requestSummary: unknown;
151
+ requestedAtMs: unknown;
152
+ approvalMode: unknown;
153
+ options: unknown;
154
+ allowedScopes: unknown;
155
+ allowedUsers: unknown;
156
+ autoApprove: unknown;
157
+ };
158
+
159
+ /**
160
+ * @template {Record<string, unknown>} Row
161
+ * @param {Row} row
162
+ * @returns {Row}
163
+ */
164
+ declare function serializeCronRow<Row extends Record<string, unknown>>(row: Row): Row;
165
+
166
+ /**
167
+ * @template {Record<string, unknown>} Row
168
+ * @param {Row} row
169
+ * @returns {Row}
170
+ */
171
+ declare function serializeDocRow<Row extends Record<string, unknown>>(row: Row): Row;
172
+
173
+ /**
174
+ * @template {Record<string, unknown>} Row
175
+ * @param {Row} row
176
+ * @returns {Row}
177
+ */
178
+ declare function serializeMemoryFactRow<Row extends Record<string, unknown>>(row: Row): Row;
179
+
180
+ /**
181
+ * @template {Record<string, unknown>} Row
182
+ * @param {Row} row
183
+ * @returns {Row}
184
+ */
185
+ declare function serializePromptRow<Row extends Record<string, unknown>>(row: Row): Row;
186
+
187
+ /**
188
+ * @template {Record<string, unknown>} Row
189
+ * @param {Row} row
190
+ * @returns {Row}
191
+ */
192
+ declare function serializeRunEventRow<Row extends Record<string, unknown>>(row: Row): Row;
193
+
194
+ /**
195
+ * @template {Record<string, unknown>} Row
196
+ * @param {Row} row
197
+ * @returns {Row}
198
+ */
199
+ declare function serializeRunRow<Row extends Record<string, unknown>>(row: Row): Row;
200
+
201
+ /** @typedef {import("../rpc/gatewayRpcTypes.ts").GatewayComparisonScoreRow} GatewayComparisonScoreRow */
202
+ /**
203
+ * @param {Record<string, unknown>} row
204
+ * @returns {GatewayComparisonScoreRow}
205
+ */
206
+ declare function serializeComparisonScoreRow(row: Record<string, unknown>): GatewayComparisonScoreRow$1;
207
+ type GatewayComparisonScoreRow$1 = GatewayComparisonScoreRow$2;
208
+
209
+ /** @typedef {import("../rpc/gatewayRpcTypes.ts").GatewayScoreDetail} GatewayScoreDetail */
210
+ /**
211
+ * Serialize an already-decoded score detail row. JSON parsing deliberately
212
+ * stays in the server so malformed persistence can fail explicitly instead of
213
+ * being hidden by a wire serializer.
214
+ * @param {Record<string, unknown>} row
215
+ * @returns {GatewayScoreDetail}
216
+ */
217
+ declare function serializeScoreDetailRow(row: Record<string, unknown>): GatewayScoreDetail$1;
218
+ type GatewayScoreDetail$1 = GatewayScoreDetail$2;
219
+
220
+ /**
221
+ * @template {Record<string, unknown>} Row
222
+ * @param {Row} row
223
+ * @returns {Row}
224
+ */
225
+ declare function serializeScoreRow<Row extends Record<string, unknown>>(row: Row): Row;
226
+
227
+ /**
228
+ * @template {Record<string, unknown>} Row
229
+ * @param {Row} row
230
+ * @returns {Row}
231
+ */
232
+ declare function serializeTicketRow<Row extends Record<string, unknown>>(row: Row): Row;
233
+
234
+ /**
235
+ * @template {Record<string, unknown>} Row
236
+ * @param {Row} row
237
+ * @returns {Row}
238
+ */
239
+ declare function serializeWorkflowRow<Row extends Record<string, unknown>>(row: Row): Row;
240
+
241
+ type GatewayScope = GatewayScope$2;
242
+ type SmithersApiVersion = SmithersApiVersion$2;
243
+ type JsonSchema = JsonSchema$2;
244
+ type GatewayRpcErrorCode = GatewayRpcErrorCode$2;
245
+ type GatewayRpcErrorDefinition = GatewayRpcErrorDefinition$2;
246
+ type GatewayRpcDefinition = GatewayRpcDefinition$2;
247
+ type GatewayRpcMethod = GatewayRpcMethod$2;
248
+ type LaunchRunRequest = LaunchRunRequest$1;
249
+ type LaunchRunResponse = LaunchRunResponse$1;
250
+ type ResumeRunRequest = ResumeRunRequest$1;
251
+ type ResumeRunResponse = ResumeRunResponse$1;
252
+ type CancelRunRequest = CancelRunRequest$1;
253
+ type CancelRunResponse = CancelRunResponse$1;
254
+ type PauseRunRequest = PauseRunRequest$1;
255
+ type PauseRunResponse = PauseRunResponse$1;
256
+ type HijackRunRequest = HijackRunRequest$1;
257
+ type HijackRunResponse = HijackRunResponse$1;
258
+ type RewindRunRequest = RewindRunRequest$1;
259
+ type SubmitApprovalRequest = SubmitApprovalRequest$1;
260
+ type SubmitApprovalResponse = SubmitApprovalResponse$1;
261
+ type SubmitSignalRequest = SubmitSignalRequest$1;
262
+ type GetRunRequest = GetRunRequest$1;
263
+ type ListRunsRequest = ListRunsRequest$1;
264
+ type GatewayRunSummary = GatewayRunSummary$1;
265
+ type ListRunsResponse = ListRunsResponse$1;
266
+ type ListRunDescendantsRequest = ListRunDescendantsRequest$1;
267
+ type GatewayRunDescendant = GatewayRunDescendant$1;
268
+ type ListRunDescendantsResponse = ListRunDescendantsResponse$1;
269
+ type GetSchemaSignatureRequest = GetSchemaSignatureRequest$1;
270
+ type GetSchemaSignatureResponse = GetSchemaSignatureResponse$1;
271
+ type GatewayWorkflowSummary = GatewayWorkflowSummary$1;
272
+ type ListWorkflowsRequest = ListWorkflowsRequest$1;
273
+ type ListWorkflowsResponse = ListWorkflowsResponse$1;
274
+ type GatewayApprovalSummary = GatewayApprovalSummary$1;
275
+ type ListApprovalsRequest = ListApprovalsRequest$1;
276
+ type ListApprovalsResponse = ListApprovalsResponse$1;
277
+ type GatewayDocRow = GatewayDocRow$1;
278
+ type ListDocsRequest = ListDocsRequest$1;
279
+ type ListDocsResponse = ListDocsResponse$1;
280
+ type StreamRunEventsRequest = StreamRunEventsRequest$1;
281
+ type StreamRunEventsResponse = StreamRunEventsResponse$1;
282
+ type StreamDevToolsRequest = StreamDevToolsRequest$1;
283
+ type GetDevToolsSnapshotRequest = GetDevToolsSnapshotRequest$1;
284
+ type GetDevToolsSnapshotResponse = GetDevToolsSnapshotResponse$1;
285
+ type NodeRequest = NodeRequest$1;
286
+ type CronListRequest = CronListRequest$1;
287
+ type CronCreateRequest = CronCreateRequest$1;
288
+ type CronDeleteRequest = CronDeleteRequest$1;
289
+ type CronRunRequest = CronRunRequest$1;
290
+ type GatewayAccount = GatewayAccount$1;
291
+ type ListAccountsRequest = ListAccountsRequest$1;
292
+ type ListAccountsResponse = ListAccountsResponse$1;
293
+ type GatewayMemoryFact = GatewayMemoryFact$1;
294
+ type ListMemoryFactsRequest = ListMemoryFactsRequest$1;
295
+ type ListMemoryFactsResponse = ListMemoryFactsResponse$1;
296
+ type GatewayPrompt = GatewayPrompt$1;
297
+ type ListPromptsRequest = ListPromptsRequest$1;
298
+ type ListPromptsResponse = ListPromptsResponse$1;
299
+ type GatewayScoreRow = GatewayScoreRow$1;
300
+ type ListScoresRequest = ListScoresRequest$1;
301
+ type ListScoresResponse = ListScoresResponse$1;
302
+ type GatewayComparisonScoreRow = GatewayComparisonScoreRow$2;
303
+ type ListScoresForRunsRequest = ListScoresForRunsRequest$1;
304
+ type ListScoresForRunsResponse = ListScoresForRunsResponse$1;
305
+ type GetScoreDetailRequest = GetScoreDetailRequest$1;
306
+ type GatewayScoreDetail = GatewayScoreDetail$2;
307
+ type GetScoreDetailResponse = GetScoreDetailResponse$1;
308
+ type GatewayDocKind = GatewayDocKind$1;
309
+ type GatewayTicketRow = GatewayTicketRow$1;
310
+ type ListTicketsRequest = ListTicketsRequest$1;
311
+ type ListTicketsResponse = ListTicketsResponse$1;
312
+ type CreateTicketRequest = CreateTicketRequest$1;
313
+ type UpdateTicketRequest = UpdateTicketRequest$1;
314
+ type DeleteTicketRequest = DeleteTicketRequest$1;
315
+
316
+ export { type CancelRunRequest, type CancelRunResponse, type CreateTicketRequest, type CronCreateRequest, type CronDeleteRequest, type CronListRequest, type CronRunRequest, type DeleteTicketRequest, GATEWAY_EVENT_WINDOW_DEFAULT, GATEWAY_RPC_DEFINITIONS, GATEWAY_RPC_ERRORS, GATEWAY_RPC_LEGACY_METHOD_ALIASES, GATEWAY_SCOPE_DESCRIPTIONS, GATEWAY_SCOPE_VALUES, type GatewayAccount, type GatewayApprovalSummary, type GatewayComparisonScoreRow, type GatewayDocKind, type GatewayDocRow, type GatewayMemoryFact, type GatewayPrompt, type GatewayRpcDefinition, type GatewayRpcErrorCode, type GatewayRpcErrorDefinition, type GatewayRpcMethod, type GatewayRunDescendant, type GatewayRunSummary, type GatewayScope, type GatewayScoreDetail, type GatewayScoreRow, type GatewayTicketRow, type GatewayWorkflowSummary, type GetDevToolsSnapshotRequest, type GetDevToolsSnapshotResponse, type GetRunRequest, type GetSchemaSignatureRequest, type GetSchemaSignatureResponse, type GetScoreDetailRequest, type GetScoreDetailResponse, type HijackRunRequest, type HijackRunResponse, type JsonSchema, type LaunchRunRequest, type LaunchRunResponse, type ListAccountsRequest, type ListAccountsResponse, type ListApprovalsRequest, type ListApprovalsResponse, type ListDocsRequest, type ListDocsResponse, type ListMemoryFactsRequest, type ListMemoryFactsResponse, type ListPromptsRequest, type ListPromptsResponse, type ListRunDescendantsRequest, type ListRunDescendantsResponse, type ListRunsRequest, type ListRunsResponse, type ListScoresForRunsRequest, type ListScoresForRunsResponse, type ListScoresRequest, type ListScoresResponse, type ListTicketsRequest, type ListTicketsResponse, type ListWorkflowsRequest, type ListWorkflowsResponse, type NodeRequest, type PauseRunRequest, type PauseRunResponse, type ResumeRunRequest, type ResumeRunResponse, type RewindRunRequest, SMITHERS_API_VERSION, type SmithersApiVersion, type StreamDevToolsRequest, type StreamRunEventsRequest, type StreamRunEventsResponse, type SubmitApprovalRequest, type SubmitApprovalResponse, type SubmitSignalRequest, type UpdateTicketRequest, anyJsonSchema, apiCollectionNames, canonicalGatewayRpcMethod, getGatewayRpcDefinition, getGatewayScopeValues, getRequiredScopeForGatewayMethod, hasGatewayScope, isGatewayRpcMethod, isGatewayScope, listGatewayRpcMethods, serializeAccountRow, serializeApprovalRow, serializeComparisonScoreRow, serializeCronRow, serializeDocRow, serializeMemoryFactRow, serializePromptRow, serializeRunEventRow, serializeRunRow, serializeScoreDetailRow, serializeScoreRow, serializeTicketRow, serializeWorkflowRow };
package/src/index.js ADDED
@@ -0,0 +1,108 @@
1
+ // @smithers-type-exports-begin
2
+ /** @typedef {import("./auth/scopes.js").GatewayScope} GatewayScope */
3
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").SmithersApiVersion} SmithersApiVersion */
4
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").JsonSchema} JsonSchema */
5
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").GatewayRpcErrorCode} GatewayRpcErrorCode */
6
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").GatewayRpcErrorDefinition} GatewayRpcErrorDefinition */
7
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").GatewayRpcDefinition} GatewayRpcDefinition */
8
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").GatewayRpcMethod} GatewayRpcMethod */
9
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").LaunchRunRequest} LaunchRunRequest */
10
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").LaunchRunResponse} LaunchRunResponse */
11
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").ResumeRunRequest} ResumeRunRequest */
12
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").ResumeRunResponse} ResumeRunResponse */
13
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").CancelRunRequest} CancelRunRequest */
14
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").CancelRunResponse} CancelRunResponse */
15
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").PauseRunRequest} PauseRunRequest */
16
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").PauseRunResponse} PauseRunResponse */
17
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").HijackRunRequest} HijackRunRequest */
18
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").HijackRunResponse} HijackRunResponse */
19
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").RewindRunRequest} RewindRunRequest */
20
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").SubmitApprovalRequest} SubmitApprovalRequest */
21
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").SubmitApprovalResponse} SubmitApprovalResponse */
22
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").SubmitSignalRequest} SubmitSignalRequest */
23
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").GetRunRequest} GetRunRequest */
24
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").ListRunsRequest} ListRunsRequest */
25
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").GatewayRunSummary} GatewayRunSummary */
26
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").ListRunsResponse} ListRunsResponse */
27
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").ListRunDescendantsRequest} ListRunDescendantsRequest */
28
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").GatewayRunDescendant} GatewayRunDescendant */
29
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").ListRunDescendantsResponse} ListRunDescendantsResponse */
30
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").GetSchemaSignatureRequest} GetSchemaSignatureRequest */
31
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").GetSchemaSignatureResponse} GetSchemaSignatureResponse */
32
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").GatewayWorkflowSummary} GatewayWorkflowSummary */
33
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").ListWorkflowsRequest} ListWorkflowsRequest */
34
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").ListWorkflowsResponse} ListWorkflowsResponse */
35
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").GatewayApprovalSummary} GatewayApprovalSummary */
36
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").ListApprovalsRequest} ListApprovalsRequest */
37
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").ListApprovalsResponse} ListApprovalsResponse */
38
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").GatewayDocRow} GatewayDocRow */
39
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").ListDocsRequest} ListDocsRequest */
40
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").ListDocsResponse} ListDocsResponse */
41
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").StreamRunEventsRequest} StreamRunEventsRequest */
42
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").StreamRunEventsResponse} StreamRunEventsResponse */
43
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").StreamDevToolsRequest} StreamDevToolsRequest */
44
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").GetDevToolsSnapshotRequest} GetDevToolsSnapshotRequest */
45
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").GetDevToolsSnapshotResponse} GetDevToolsSnapshotResponse */
46
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").NodeRequest} NodeRequest */
47
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").CronListRequest} CronListRequest */
48
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").CronCreateRequest} CronCreateRequest */
49
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").CronDeleteRequest} CronDeleteRequest */
50
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").CronRunRequest} CronRunRequest */
51
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").GatewayAccount} GatewayAccount */
52
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").ListAccountsRequest} ListAccountsRequest */
53
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").ListAccountsResponse} ListAccountsResponse */
54
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").GatewayMemoryFact} GatewayMemoryFact */
55
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").ListMemoryFactsRequest} ListMemoryFactsRequest */
56
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").ListMemoryFactsResponse} ListMemoryFactsResponse */
57
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").GatewayPrompt} GatewayPrompt */
58
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").ListPromptsRequest} ListPromptsRequest */
59
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").ListPromptsResponse} ListPromptsResponse */
60
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").GatewayScoreRow} GatewayScoreRow */
61
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").ListScoresRequest} ListScoresRequest */
62
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").ListScoresResponse} ListScoresResponse */
63
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").GatewayComparisonScoreRow} GatewayComparisonScoreRow */
64
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").ListScoresForRunsRequest} ListScoresForRunsRequest */
65
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").ListScoresForRunsResponse} ListScoresForRunsResponse */
66
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").GetScoreDetailRequest} GetScoreDetailRequest */
67
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").GatewayScoreDetail} GatewayScoreDetail */
68
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").GetScoreDetailResponse} GetScoreDetailResponse */
69
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").GatewayDocKind} GatewayDocKind */
70
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").GatewayTicketRow} GatewayTicketRow */
71
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").ListTicketsRequest} ListTicketsRequest */
72
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").ListTicketsResponse} ListTicketsResponse */
73
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").CreateTicketRequest} CreateTicketRequest */
74
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").UpdateTicketRequest} UpdateTicketRequest */
75
+ /** @typedef {import("./rpc/gatewayRpcTypes.ts").DeleteTicketRequest} DeleteTicketRequest */
76
+ // @smithers-type-exports-end
77
+
78
+ export {
79
+ SMITHERS_API_VERSION,
80
+ GATEWAY_EVENT_WINDOW_DEFAULT,
81
+ anyJsonSchema,
82
+ GATEWAY_RPC_ERRORS,
83
+ GATEWAY_RPC_LEGACY_METHOD_ALIASES,
84
+ GATEWAY_RPC_DEFINITIONS,
85
+ canonicalGatewayRpcMethod,
86
+ getGatewayRpcDefinition,
87
+ getRequiredScopeForGatewayMethod,
88
+ listGatewayRpcMethods,
89
+ isGatewayRpcMethod,
90
+ getGatewayScopeValues,
91
+ } from "./rpc/index.js";
92
+ export {
93
+ apiCollectionNames,
94
+ serializeAccountRow,
95
+ serializeApprovalRow,
96
+ serializeCronRow,
97
+ serializeDocRow,
98
+ serializeMemoryFactRow,
99
+ serializePromptRow,
100
+ serializeRunEventRow,
101
+ serializeRunRow,
102
+ serializeComparisonScoreRow,
103
+ serializeScoreDetailRow,
104
+ serializeScoreRow,
105
+ serializeTicketRow,
106
+ serializeWorkflowRow,
107
+ } from "./api/index.js";
108
+ export { GATEWAY_SCOPE_VALUES, GATEWAY_SCOPE_DESCRIPTIONS, isGatewayScope, hasGatewayScope } from "./auth/scopes.js";