@opengeni/api-router 0.22.2 → 0.26.1
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/dist/app.d.ts +2 -2
- package/dist/app.js +1 -1
- package/dist/auth/managed-auth.d.ts +0 -30
- package/dist/browser-controller-authority.d.ts +43 -0
- package/dist/browser-state-authority.d.ts +27 -0
- package/dist/{chunk-HWXJW5C7.js → chunk-JIKNR5YL.js} +27993 -14546
- package/dist/chunk-JIKNR5YL.js.map +1 -0
- package/dist/codemode.d.ts +23 -0
- package/dist/editable-artifact-live-hints.d.ts +11 -0
- package/dist/editable-artifact-native-kernel.d.ts +37 -0
- package/dist/editable-artifact-office-import.d.ts +22 -0
- package/dist/editable-artifact-production.d.ts +29 -0
- package/dist/editable-artifact-websocket.d.ts +49 -0
- package/dist/editable-artifact-workspace-files.d.ts +23 -0
- package/dist/github-browser-flow.d.ts +6 -0
- package/dist/http/cors.d.ts +1 -0
- package/dist/http/sse.d.ts +2 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1824 -30
- package/dist/index.js.map +1 -1
- package/dist/integrations/api-integrations.d.ts +24 -0
- package/dist/integrations/atlassian.d.ts +176 -0
- package/dist/integrations/github-skill-source.d.ts +5 -0
- package/dist/integrations/google-drive.d.ts +85 -0
- package/dist/integrations/oauth-client.d.ts +30 -1
- package/dist/integrations/provider-oauth.d.ts +19 -0
- package/dist/integrations/slack-bot.d.ts +4 -0
- package/dist/integrations/slack-interactions.d.ts +14 -2
- package/dist/integrations/social-api.d.ts +2 -1
- package/dist/mcp/editable-artifact-query-schema.d.ts +4 -0
- package/dist/mcp/editable-artifacts.d.ts +13 -0
- package/dist/mcp/receipts.d.ts +28 -0
- package/dist/mcp/scheduled-task-view.d.ts +518 -0
- package/dist/mcp/server.d.ts +14 -3
- package/dist/memory-slack-delivery.d.ts +9 -0
- package/dist/routes/api-integrations.d.ts +8 -0
- package/dist/routes/browser-identities.d.ts +5 -0
- package/dist/routes/browser-sessions.d.ts +6 -0
- package/dist/routes/company-profile.d.ts +3 -0
- package/dist/routes/computer-sessions.d.ts +6 -0
- package/dist/routes/editable-artifacts.d.ts +44 -0
- package/dist/routes/integration-features.d.ts +3 -0
- package/dist/routes/memory-slack-publications.d.ts +6 -0
- package/dist/routes/plugins.d.ts +8 -0
- package/dist/routes/sessions.d.ts +17 -2
- package/dist/routes/skills.d.ts +6 -0
- package/dist/routes/video-generation.d.ts +3 -0
- package/dist/sandbox/auth-callout.d.ts +2 -0
- package/dist/sandbox/channel-a.d.ts +59 -2
- package/dist/sandbox/metrics-ingestion.d.ts +6 -1
- package/dist/sandbox/viewer.d.ts +4 -2
- package/dist/temporal-schedule-cleanup.d.ts +26 -0
- package/package.json +19 -14
- package/src/app.ts +277 -41
- package/src/auth/managed-auth.ts +0 -16
- package/src/browser-controller-authority.ts +137 -0
- package/src/browser-state-authority.ts +236 -0
- package/src/codemode.ts +186 -0
- package/src/editable-artifact-live-hints.ts +64 -0
- package/src/editable-artifact-native-kernel.ts +659 -0
- package/src/editable-artifact-office-import.ts +230 -0
- package/src/editable-artifact-production.ts +419 -0
- package/src/editable-artifact-websocket.ts +311 -0
- package/src/editable-artifact-workspace-files.ts +186 -0
- package/src/github-browser-flow.ts +35 -6
- package/src/http/auth.ts +2 -0
- package/src/http/cors.ts +3 -0
- package/src/http/sse.ts +101 -6
- package/src/index.ts +147 -23
- package/src/integrations/api-integrations.ts +350 -0
- package/src/integrations/atlassian.ts +1621 -0
- package/src/integrations/github-skill-source.ts +142 -0
- package/src/integrations/google-drive.ts +1000 -64
- package/src/integrations/oauth-client.ts +159 -89
- package/src/integrations/provider-oauth.ts +777 -0
- package/src/integrations/slack-bot.ts +31 -2
- package/src/integrations/slack-interactions.ts +610 -42
- package/src/integrations/social-api.ts +11 -0
- package/src/mcp/documents.ts +74 -26
- package/src/mcp/editable-artifact-query-schema.ts +236 -0
- package/src/mcp/editable-artifacts.ts +448 -0
- package/src/mcp/receipts.ts +95 -0
- package/src/mcp/scheduled-task-view.ts +642 -0
- package/src/mcp/server.ts +1718 -310
- package/src/memory-slack-delivery.ts +209 -0
- package/src/observability.ts +3 -3
- package/src/routes/api-integrations.ts +407 -0
- package/src/routes/api-keys.ts +7 -1
- package/src/routes/browser-identities.ts +136 -0
- package/src/routes/browser-sessions.ts +2543 -0
- package/src/routes/codex.ts +7 -4
- package/src/routes/company-profile.ts +255 -0
- package/src/routes/computer-sessions.ts +1247 -0
- package/src/routes/connections.ts +358 -102
- package/src/routes/documents.ts +22 -3
- package/src/routes/editable-artifacts.ts +1159 -0
- package/src/routes/enrollments.ts +54 -12
- package/src/routes/environments.ts +60 -11
- package/src/routes/files.ts +277 -65
- package/src/routes/github.ts +18 -2
- package/src/routes/install.ts +38 -2
- package/src/routes/integration-features.ts +258 -0
- package/src/routes/machines.ts +1 -1
- package/src/routes/memory-slack-publications.ts +216 -0
- package/src/routes/packs.ts +437 -7
- package/src/routes/plugins.ts +751 -0
- package/src/routes/rigs.ts +77 -20
- package/src/routes/scheduled-tasks.ts +94 -42
- package/src/routes/sessions.ts +475 -234
- package/src/routes/skills.ts +174 -0
- package/src/routes/transcription-recordings.ts +65 -33
- package/src/routes/video-generation.ts +132 -0
- package/src/routes/workspaces.ts +46 -24
- package/src/sandbox/auth-callout.ts +16 -4
- package/src/sandbox/channel-a.ts +809 -85
- package/src/sandbox/enrollment.ts +13 -3
- package/src/sandbox/machines.ts +1 -1
- package/src/sandbox/metrics-ingestion.ts +121 -3
- package/src/sandbox/rematerialize.ts +35 -47
- package/src/sandbox/viewer.ts +58 -29
- package/src/temporal-schedule-cleanup.ts +135 -0
- package/dist/chunk-HWXJW5C7.js.map +0 -1
- package/dist/mcp/toolspace.d.ts +0 -62
- package/src/mcp/toolspace.ts +0 -1186
|
@@ -39,6 +39,17 @@ type ConnectionRef = { workspaceId: string; connectionId: string; subjectId?: st
|
|
|
39
39
|
|
|
40
40
|
const MAX_LIVE_RESULTS = 50;
|
|
41
41
|
|
|
42
|
+
export function assertSocialConnectionProvider(
|
|
43
|
+
connection: Pick<SocialConnection, "provider">,
|
|
44
|
+
expected: "x" | "reddit",
|
|
45
|
+
): void {
|
|
46
|
+
if (connection.provider !== expected) {
|
|
47
|
+
throw new Error(
|
|
48
|
+
`Selected account belongs to ${connection.provider}, not the ${expected} integration`,
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
42
53
|
export async function socialSearchLive(
|
|
43
54
|
deps: SocialApiDeps,
|
|
44
55
|
ref: ConnectionRef,
|
package/src/mcp/documents.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { DocumentSearchResponse } from "@opengeni/contracts";
|
|
1
|
+
import { DocumentSearchResponse, ListIndexedDocumentsResponse } from "@opengeni/contracts";
|
|
2
2
|
import {
|
|
3
3
|
getDocumentChunk,
|
|
4
4
|
listDocumentBases,
|
|
5
|
+
listEffectiveIndexedDocuments,
|
|
5
6
|
searchEffectiveDocuments,
|
|
6
7
|
type DocumentAccessFilter,
|
|
7
8
|
type DocumentServices,
|
|
@@ -9,6 +10,7 @@ import {
|
|
|
9
10
|
import { createKnowledgeMemory, listKnowledgeMemories, type Database } from "@opengeni/db";
|
|
10
11
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
11
12
|
import * as z from "zod/v4";
|
|
13
|
+
import { mcpMutationReceipt } from "./receipts";
|
|
12
14
|
|
|
13
15
|
const SearchInputSchema = {
|
|
14
16
|
query: z.string().min(1),
|
|
@@ -112,6 +114,36 @@ export function buildDocumentsMcpServer(
|
|
|
112
114
|
),
|
|
113
115
|
);
|
|
114
116
|
|
|
117
|
+
server.registerTool(
|
|
118
|
+
"list_indexed_documents",
|
|
119
|
+
{
|
|
120
|
+
description:
|
|
121
|
+
"List agent-authorized documents that became ready after an opaque checkpoint, ordered by durable indexing completion. Results include source and authority/ingestion provenance. Persist nextCheckpoint only after successfully processing the returned page, then pass it on the next scheduled run to avoid repeats.",
|
|
122
|
+
inputSchema: {
|
|
123
|
+
checkpoint: z.string().min(1).max(1_024).optional(),
|
|
124
|
+
limit: z.number().int().positive().max(100).optional(),
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
async ({ checkpoint, limit }) => ({
|
|
128
|
+
content: [
|
|
129
|
+
{
|
|
130
|
+
type: "text",
|
|
131
|
+
text: JSON.stringify(
|
|
132
|
+
ListIndexedDocumentsResponse.parse(
|
|
133
|
+
await listEffectiveIndexedDocuments(db, {
|
|
134
|
+
accountId,
|
|
135
|
+
workspaceId,
|
|
136
|
+
initiatingSubjectId: options.initiatingSubjectId,
|
|
137
|
+
...(checkpoint ? { checkpoint } : {}),
|
|
138
|
+
...(limit ? { limit } : {}),
|
|
139
|
+
}),
|
|
140
|
+
),
|
|
141
|
+
),
|
|
142
|
+
},
|
|
143
|
+
],
|
|
144
|
+
}),
|
|
145
|
+
);
|
|
146
|
+
|
|
115
147
|
server.registerTool(
|
|
116
148
|
"fetch_document_chunk",
|
|
117
149
|
{
|
|
@@ -192,31 +224,47 @@ export function buildDocumentsMcpServer(
|
|
|
192
224
|
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
193
225
|
},
|
|
194
226
|
},
|
|
195
|
-
async ({ text, kind, scope, sourceRefs, confidence, metadata }) =>
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
227
|
+
async ({ text, kind, scope, sourceRefs, confidence, metadata }) => {
|
|
228
|
+
const memory = await createKnowledgeMemory(db, {
|
|
229
|
+
accountId,
|
|
230
|
+
workspaceId,
|
|
231
|
+
status: "proposed",
|
|
232
|
+
kind: kind ?? "semantic",
|
|
233
|
+
scope: scope ?? "workspace",
|
|
234
|
+
text,
|
|
235
|
+
sourceRefs:
|
|
236
|
+
sourceRefs?.map((sourceRef) => ({
|
|
237
|
+
...sourceRef,
|
|
238
|
+
metadata: sourceRef.metadata ?? {},
|
|
239
|
+
})) ?? [],
|
|
240
|
+
confidence: confidence ?? 0.5,
|
|
241
|
+
metadata: metadata ?? {},
|
|
242
|
+
createdBySessionId: options.createdBySessionId,
|
|
243
|
+
});
|
|
244
|
+
return {
|
|
245
|
+
content: [
|
|
246
|
+
{
|
|
247
|
+
type: "text",
|
|
248
|
+
text: JSON.stringify(
|
|
249
|
+
mcpMutationReceipt({
|
|
250
|
+
operation: "memory_propose",
|
|
251
|
+
committed: true,
|
|
252
|
+
outcome: "created",
|
|
253
|
+
changed: true,
|
|
254
|
+
resource: {
|
|
255
|
+
type: "knowledge_memory",
|
|
256
|
+
id: memory.id,
|
|
257
|
+
state: memory.status,
|
|
258
|
+
},
|
|
259
|
+
timestamp: memory.updatedAt,
|
|
260
|
+
idempotency: { status: "not_supported" },
|
|
261
|
+
nextAction: { tool: "memory_search", arguments: {} },
|
|
262
|
+
}),
|
|
263
|
+
),
|
|
264
|
+
},
|
|
265
|
+
],
|
|
266
|
+
};
|
|
267
|
+
},
|
|
220
268
|
);
|
|
221
269
|
|
|
222
270
|
return server;
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DOCUMENT_ARTIFACT_QUERY_MAX_ITEMS,
|
|
3
|
+
DOCUMENT_ARTIFACT_QUERY_MAX_TABLE_CELLS,
|
|
4
|
+
DOCUMENT_ARTIFACT_QUERY_MAX_TEXT_UTF16,
|
|
5
|
+
DOCUMENT_ARTIFACT_MAX_STRUCTURAL_COUNTER,
|
|
6
|
+
PRESENTATION_ARTIFACT_MAX_COORDINATE,
|
|
7
|
+
PRESENTATION_ARTIFACT_QUERY_MAX_NODES,
|
|
8
|
+
PRESENTATION_ARTIFACT_QUERY_MAX_SLIDES,
|
|
9
|
+
PRESENTATION_ARTIFACT_QUERY_MAX_TEXT_BYTES,
|
|
10
|
+
PRESENTATION_ARTIFACT_QUERY_RESPONSE_MAX_BYTES,
|
|
11
|
+
SPREADSHEET_ARTIFACT_METADATA_MAX_SHEETS,
|
|
12
|
+
SPREADSHEET_ARTIFACT_METADATA_MIN_RESPONSE_BYTES,
|
|
13
|
+
SPREADSHEET_ARTIFACT_PROJECTION_MAX_BYTES,
|
|
14
|
+
SPREADSHEET_ARTIFACT_VIEWPORT_MAX_AREA,
|
|
15
|
+
SPREADSHEET_ARTIFACT_VIEWPORT_MAX_CELLS,
|
|
16
|
+
SPREADSHEET_ARTIFACT_VIEWPORT_MIN_RESPONSE_BYTES,
|
|
17
|
+
type EditableArtifactStableId,
|
|
18
|
+
} from "@opengeni/contracts/editable-artifacts";
|
|
19
|
+
import type { EditableArtifactAgentQuery } from "@opengeni/core/editable-artifacts";
|
|
20
|
+
import * as z from "zod/v4";
|
|
21
|
+
|
|
22
|
+
const UINT32_MAX = 0xffff_ffff;
|
|
23
|
+
|
|
24
|
+
const Uint32 = z.number().int().min(0).max(UINT32_MAX);
|
|
25
|
+
const PositiveUint32 = z.number().int().min(1).max(UINT32_MAX);
|
|
26
|
+
const SafeCursor = z.number().int().min(0).max(Number.MAX_SAFE_INTEGER);
|
|
27
|
+
const CanonicalStableId = z
|
|
28
|
+
.string()
|
|
29
|
+
.regex(/^[0-9a-f]{32}$/u)
|
|
30
|
+
.transform((value): EditableArtifactStableId => value as EditableArtifactStableId);
|
|
31
|
+
const SpreadsheetSheetId = z
|
|
32
|
+
.string()
|
|
33
|
+
.regex(/^[0-9a-f]{32}$/u)
|
|
34
|
+
.refine(
|
|
35
|
+
(value) => value.slice(0, 16) !== "0000000000000000" && value.slice(16) !== "0000000000000000",
|
|
36
|
+
"Object id must have allocated namespace and counter halves",
|
|
37
|
+
)
|
|
38
|
+
.transform((value): EditableArtifactStableId => value as EditableArtifactStableId);
|
|
39
|
+
const DocumentSectionId = z
|
|
40
|
+
.string()
|
|
41
|
+
.regex(/^sec\/[0-9a-f]{32}$/u)
|
|
42
|
+
.refine((value) => {
|
|
43
|
+
const counter = BigInt(`0x${value.slice(-16)}`);
|
|
44
|
+
return counter > 0n && counter <= BigInt(DOCUMENT_ARTIFACT_MAX_STRUCTURAL_COUNTER);
|
|
45
|
+
}, "Section id counter must be allocated and within the document limit");
|
|
46
|
+
|
|
47
|
+
const SpreadsheetMetadataRequest = z
|
|
48
|
+
.object({
|
|
49
|
+
kind: z.literal("workbook-metadata"),
|
|
50
|
+
query: z
|
|
51
|
+
.object({
|
|
52
|
+
maxSheets: z.number().int().min(1).max(SPREADSHEET_ARTIFACT_METADATA_MAX_SHEETS),
|
|
53
|
+
maxBytes: z
|
|
54
|
+
.number()
|
|
55
|
+
.int()
|
|
56
|
+
.min(SPREADSHEET_ARTIFACT_METADATA_MIN_RESPONSE_BYTES)
|
|
57
|
+
.max(SPREADSHEET_ARTIFACT_PROJECTION_MAX_BYTES),
|
|
58
|
+
})
|
|
59
|
+
.strict(),
|
|
60
|
+
})
|
|
61
|
+
.strict();
|
|
62
|
+
|
|
63
|
+
const SpreadsheetViewportRequest = z
|
|
64
|
+
.object({
|
|
65
|
+
kind: z.literal("viewport"),
|
|
66
|
+
query: z
|
|
67
|
+
.object({
|
|
68
|
+
sheetId: SpreadsheetSheetId,
|
|
69
|
+
startRow: Uint32,
|
|
70
|
+
startColumn: Uint32,
|
|
71
|
+
rowCount: PositiveUint32,
|
|
72
|
+
columnCount: PositiveUint32,
|
|
73
|
+
maxCells: z.number().int().min(1).max(SPREADSHEET_ARTIFACT_VIEWPORT_MAX_CELLS),
|
|
74
|
+
maxBytes: z
|
|
75
|
+
.number()
|
|
76
|
+
.int()
|
|
77
|
+
.min(SPREADSHEET_ARTIFACT_VIEWPORT_MIN_RESPONSE_BYTES)
|
|
78
|
+
.max(SPREADSHEET_ARTIFACT_PROJECTION_MAX_BYTES),
|
|
79
|
+
})
|
|
80
|
+
.strict()
|
|
81
|
+
.superRefine((query, context) => {
|
|
82
|
+
const area = query.rowCount * query.columnCount;
|
|
83
|
+
if (!Number.isSafeInteger(area) || area > SPREADSHEET_ARTIFACT_VIEWPORT_MAX_AREA) {
|
|
84
|
+
context.addIssue({
|
|
85
|
+
code: "custom",
|
|
86
|
+
message: `Viewport area must not exceed ${SPREADSHEET_ARTIFACT_VIEWPORT_MAX_AREA}`,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
if (
|
|
90
|
+
query.rowCount - 1 > UINT32_MAX - query.startRow ||
|
|
91
|
+
query.columnCount - 1 > UINT32_MAX - query.startColumn
|
|
92
|
+
) {
|
|
93
|
+
context.addIssue({
|
|
94
|
+
code: "custom",
|
|
95
|
+
message: "Viewport extent exceeds spreadsheet coordinates",
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}),
|
|
99
|
+
})
|
|
100
|
+
.strict();
|
|
101
|
+
|
|
102
|
+
const DocumentLimits = z
|
|
103
|
+
.object({
|
|
104
|
+
maxItems: z.number().int().min(1).max(DOCUMENT_ARTIFACT_QUERY_MAX_ITEMS),
|
|
105
|
+
maxTextUtf16: z.number().int().min(1).max(DOCUMENT_ARTIFACT_QUERY_MAX_TEXT_UTF16),
|
|
106
|
+
maxTableCells: z.number().int().min(1).max(DOCUMENT_ARTIFACT_QUERY_MAX_TABLE_CELLS),
|
|
107
|
+
})
|
|
108
|
+
.strict();
|
|
109
|
+
|
|
110
|
+
const DocumentSummaryRequest = z.object({ kind: z.literal("summary") }).strict();
|
|
111
|
+
const DocumentBodyRequest = z
|
|
112
|
+
.object({ kind: z.literal("body"), startBlock: SafeCursor, limits: DocumentLimits })
|
|
113
|
+
.strict();
|
|
114
|
+
const DocumentStoryRequest = z
|
|
115
|
+
.object({
|
|
116
|
+
kind: z.literal("story"),
|
|
117
|
+
sectionId: DocumentSectionId,
|
|
118
|
+
storyKind: z.enum(["header", "footer"]),
|
|
119
|
+
variant: z.enum(["default", "first", "even"]),
|
|
120
|
+
startBlock: SafeCursor,
|
|
121
|
+
limits: DocumentLimits,
|
|
122
|
+
})
|
|
123
|
+
.strict();
|
|
124
|
+
const DocumentSectionsRequest = z
|
|
125
|
+
.object({ kind: z.literal("sections"), startSection: SafeCursor, limits: DocumentLimits })
|
|
126
|
+
.strict();
|
|
127
|
+
const DocumentReviewRequest = z
|
|
128
|
+
.object({ kind: z.literal("review"), startItem: SafeCursor, limits: DocumentLimits })
|
|
129
|
+
.strict();
|
|
130
|
+
|
|
131
|
+
const PresentationOwner = z
|
|
132
|
+
.object({ kind: z.enum(["master", "layout", "slide"]), id: CanonicalStableId })
|
|
133
|
+
.strict();
|
|
134
|
+
const PresentationCoordinate = z
|
|
135
|
+
.number()
|
|
136
|
+
.int()
|
|
137
|
+
.min(-PRESENTATION_ARTIFACT_MAX_COORDINATE)
|
|
138
|
+
.max(PRESENTATION_ARTIFACT_MAX_COORDINATE);
|
|
139
|
+
const PresentationExtent = z.number().int().min(1).max(PRESENTATION_ARTIFACT_MAX_COORDINATE);
|
|
140
|
+
const PresentationRect = z
|
|
141
|
+
.object({
|
|
142
|
+
x: PresentationCoordinate,
|
|
143
|
+
y: PresentationCoordinate,
|
|
144
|
+
width: PresentationExtent,
|
|
145
|
+
height: PresentationExtent,
|
|
146
|
+
})
|
|
147
|
+
.strict()
|
|
148
|
+
.superRefine((rect, context) => {
|
|
149
|
+
if (
|
|
150
|
+
Math.abs(rect.x + rect.width) > PRESENTATION_ARTIFACT_MAX_COORDINATE ||
|
|
151
|
+
Math.abs(rect.y + rect.height) > PRESENTATION_ARTIFACT_MAX_COORDINATE
|
|
152
|
+
) {
|
|
153
|
+
context.addIssue({
|
|
154
|
+
code: "custom",
|
|
155
|
+
message: "Viewport extent exceeds presentation coordinates",
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
const PresentationNodeLimit = z.number().int().min(1).max(PRESENTATION_ARTIFACT_QUERY_MAX_NODES);
|
|
160
|
+
const PresentationTextLimit = z
|
|
161
|
+
.number()
|
|
162
|
+
.int()
|
|
163
|
+
.min(1)
|
|
164
|
+
.max(PRESENTATION_ARTIFACT_QUERY_MAX_TEXT_BYTES);
|
|
165
|
+
const presentationResponseBytes = (minimum: number) =>
|
|
166
|
+
z.number().int().min(minimum).max(PRESENTATION_ARTIFACT_QUERY_RESPONSE_MAX_BYTES);
|
|
167
|
+
|
|
168
|
+
const PresentationViewportRequest = z
|
|
169
|
+
.object({
|
|
170
|
+
kind: z.literal("viewport"),
|
|
171
|
+
owner: PresentationOwner,
|
|
172
|
+
viewport: PresentationRect,
|
|
173
|
+
maxNodes: PresentationNodeLimit,
|
|
174
|
+
maxBytes: presentationResponseBytes(89),
|
|
175
|
+
})
|
|
176
|
+
.strict();
|
|
177
|
+
const PresentationHitTestRequest = z
|
|
178
|
+
.object({
|
|
179
|
+
kind: z.literal("hit-test"),
|
|
180
|
+
owner: PresentationOwner,
|
|
181
|
+
x: PresentationCoordinate,
|
|
182
|
+
y: PresentationCoordinate,
|
|
183
|
+
maxNodes: PresentationNodeLimit,
|
|
184
|
+
maxBytes: presentationResponseBytes(89),
|
|
185
|
+
})
|
|
186
|
+
.strict();
|
|
187
|
+
const PresentationResolvedSlideRequest = z
|
|
188
|
+
.object({
|
|
189
|
+
kind: z.literal("resolved-slide"),
|
|
190
|
+
slideId: CanonicalStableId,
|
|
191
|
+
maxNodes: PresentationNodeLimit,
|
|
192
|
+
maxBytes: presentationResponseBytes(56),
|
|
193
|
+
})
|
|
194
|
+
.strict();
|
|
195
|
+
const PresentationMetadataRequest = z
|
|
196
|
+
.object({ kind: z.literal("metadata"), maxBytes: presentationResponseBytes(84) })
|
|
197
|
+
.strict();
|
|
198
|
+
const PresentationSlideCatalogRequest = z
|
|
199
|
+
.object({
|
|
200
|
+
kind: z.literal("slide-catalog"),
|
|
201
|
+
startSlide: Uint32,
|
|
202
|
+
maxSlides: z.number().int().min(1).max(PRESENTATION_ARTIFACT_QUERY_MAX_SLIDES),
|
|
203
|
+
maxTextBytes: PresentationTextLimit,
|
|
204
|
+
maxBytes: presentationResponseBytes(53),
|
|
205
|
+
})
|
|
206
|
+
.strict();
|
|
207
|
+
const PresentationEditorSlideRequest = z
|
|
208
|
+
.object({
|
|
209
|
+
kind: z.literal("editor-slide"),
|
|
210
|
+
slideId: CanonicalStableId,
|
|
211
|
+
maxNodes: PresentationNodeLimit,
|
|
212
|
+
maxTextBytes: PresentationTextLimit,
|
|
213
|
+
maxBytes: presentationResponseBytes(75),
|
|
214
|
+
})
|
|
215
|
+
.strict();
|
|
216
|
+
|
|
217
|
+
/** Exact bounded query union shared by the model-facing direct inspect tool. */
|
|
218
|
+
export const EditableArtifactQueryRequestSchema: z.ZodType<EditableArtifactAgentQuery["query"]> = z
|
|
219
|
+
.union([
|
|
220
|
+
SpreadsheetMetadataRequest,
|
|
221
|
+
SpreadsheetViewportRequest,
|
|
222
|
+
DocumentSummaryRequest,
|
|
223
|
+
DocumentBodyRequest,
|
|
224
|
+
DocumentStoryRequest,
|
|
225
|
+
DocumentSectionsRequest,
|
|
226
|
+
DocumentReviewRequest,
|
|
227
|
+
PresentationViewportRequest,
|
|
228
|
+
PresentationHitTestRequest,
|
|
229
|
+
PresentationResolvedSlideRequest,
|
|
230
|
+
PresentationMetadataRequest,
|
|
231
|
+
PresentationSlideCatalogRequest,
|
|
232
|
+
PresentationEditorSlideRequest,
|
|
233
|
+
])
|
|
234
|
+
.describe(
|
|
235
|
+
"Exact bounded query for the selected modality. Spreadsheet requests retain their required nested query envelope; document and presentation requests use the fields shown by this schema.",
|
|
236
|
+
);
|