@agimon-ai/po-author 0.0.0-alpha.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/LICENSE +21 -0
- package/README.md +38 -0
- package/dist/apiContracts.cjs +348 -0
- package/dist/apiContracts.cjs.map +1 -0
- package/dist/apiContracts.d.mts +53 -0
- package/dist/apiContracts.d.mts.map +1 -0
- package/dist/apiContracts.mjs +343 -0
- package/dist/apiContracts.mjs.map +1 -0
- package/dist/authorFacade--Lc599Ft.mjs +84 -0
- package/dist/authorFacade--Lc599Ft.mjs.map +1 -0
- package/dist/authorFacade-89Eb2-sW.d.mts +132 -0
- package/dist/authorFacade-89Eb2-sW.d.mts.map +1 -0
- package/dist/authorFacade-BYvlm8Ff.cjs +119 -0
- package/dist/authorFacade-BYvlm8Ff.cjs.map +1 -0
- package/dist/authorFacade.cjs +27 -0
- package/dist/authorFacade.d.mts +3 -0
- package/dist/authorFacade.mjs +3 -0
- package/dist/extensions/server.cjs +845 -0
- package/dist/extensions/server.cjs.map +1 -0
- package/dist/extensions/server.d.mts +5 -0
- package/dist/extensions/server.d.mts.map +1 -0
- package/dist/extensions/server.mjs +838 -0
- package/dist/extensions/server.mjs.map +1 -0
- package/dist/extensions/web.mjs +4758 -0
- package/dist/extensions/web.mjs.map +1 -0
- package/dist/index.cjs +101 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.mts +435 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +70 -0
- package/dist/index.mjs.map +1 -0
- package/dist/structuredDocuments-B914GLxx.mjs +1064 -0
- package/dist/structuredDocuments-B914GLxx.mjs.map +1 -0
- package/dist/structuredDocuments-CNac1JmJ.cjs +1316 -0
- package/dist/structuredDocuments-CNac1JmJ.cjs.map +1 -0
- package/llms.txt +11 -0
- package/package.json +140 -0
- package/src/prompts/po-use-author/SKILL.md +20 -0
- package/src/types/author.ts +61 -0
- package/src/types/authorPreview.ts +98 -0
- package/src/types/structuredDocuments.ts +63 -0
- package/src/types/webAuthor.ts +94 -0
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
import { defineApiContract, jsonApiResponses } from "@agimon-ai/po-core/apiContracts";
|
|
2
|
+
import { Type } from "typebox";
|
|
3
|
+
import "@agimon-ai/po-core/pluginProtocol";
|
|
4
|
+
//#region src/schemas/authorFacade.ts
|
|
5
|
+
const AuthorCapabilityNameSchema = Type.String({
|
|
6
|
+
minLength: 1,
|
|
7
|
+
maxLength: 30,
|
|
8
|
+
pattern: "^[a-z][a-z0-9_]*$"
|
|
9
|
+
});
|
|
10
|
+
const AuthorAliasSchema = Type.String({
|
|
11
|
+
minLength: 1,
|
|
12
|
+
maxLength: 64,
|
|
13
|
+
pattern: "^[a-z][a-z0-9_-]{0,63}$"
|
|
14
|
+
});
|
|
15
|
+
Type.Object({ alias: Type.Optional(AuthorAliasSchema) }, { additionalProperties: false });
|
|
16
|
+
/** Invokes one capability exposed by the current Author viewport. */
|
|
17
|
+
const AuthorUseToolsInputSchema = Type.Object({
|
|
18
|
+
alias: Type.Optional(AuthorAliasSchema),
|
|
19
|
+
catalogToken: Type.String({
|
|
20
|
+
minLength: 1,
|
|
21
|
+
maxLength: 256
|
|
22
|
+
}),
|
|
23
|
+
name: AuthorCapabilityNameSchema,
|
|
24
|
+
arguments: Type.Record(Type.String(), Type.Unknown())
|
|
25
|
+
}, { additionalProperties: false });
|
|
26
|
+
const AuthorBridgeBase = {
|
|
27
|
+
alias: AuthorAliasSchema,
|
|
28
|
+
generation: Type.Number({ minimum: 0 })
|
|
29
|
+
};
|
|
30
|
+
/** Browser-to-server lease messages, validated before Author sees the payload. */
|
|
31
|
+
const AuthorBridgeMessageSchema = Type.Union([
|
|
32
|
+
Type.Object({
|
|
33
|
+
...AuthorBridgeBase,
|
|
34
|
+
kind: Type.Literal("register")
|
|
35
|
+
}, { additionalProperties: false }),
|
|
36
|
+
Type.Object({
|
|
37
|
+
...AuthorBridgeBase,
|
|
38
|
+
kind: Type.Literal("release")
|
|
39
|
+
}, { additionalProperties: false }),
|
|
40
|
+
Type.Object({
|
|
41
|
+
...AuthorBridgeBase,
|
|
42
|
+
kind: Type.Literal("catalog"),
|
|
43
|
+
ownerToken: Type.String({ minLength: 1 }),
|
|
44
|
+
tools: Type.Array(Type.Object({
|
|
45
|
+
name: Type.String({ minLength: 1 }),
|
|
46
|
+
label: Type.String(),
|
|
47
|
+
description: Type.String(),
|
|
48
|
+
inputSchema: Type.Record(Type.String(), Type.Unknown())
|
|
49
|
+
}, { additionalProperties: false }))
|
|
50
|
+
}, { additionalProperties: false }),
|
|
51
|
+
Type.Object({
|
|
52
|
+
...AuthorBridgeBase,
|
|
53
|
+
kind: Type.Literal("result"),
|
|
54
|
+
ownerToken: Type.String({ minLength: 1 }),
|
|
55
|
+
catalogToken: Type.String({ minLength: 1 }),
|
|
56
|
+
requestId: Type.String({ minLength: 1 }),
|
|
57
|
+
result: Type.Unknown()
|
|
58
|
+
}, { additionalProperties: false }),
|
|
59
|
+
Type.Object({
|
|
60
|
+
...AuthorBridgeBase,
|
|
61
|
+
kind: Type.Literal("cancelled"),
|
|
62
|
+
ownerToken: Type.String({ minLength: 1 }),
|
|
63
|
+
catalogToken: Type.String({ minLength: 1 }),
|
|
64
|
+
requestId: Type.String({ minLength: 1 })
|
|
65
|
+
}, { additionalProperties: false })
|
|
66
|
+
]);
|
|
67
|
+
const AuthorBridgeInputSchema = Type.Object({
|
|
68
|
+
sessionId: Type.String({ minLength: 1 }),
|
|
69
|
+
message: AuthorBridgeMessageSchema
|
|
70
|
+
}, { additionalProperties: false });
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region src/schemas/apiContracts.ts
|
|
73
|
+
const S = Type.String();
|
|
74
|
+
const N = Type.Number();
|
|
75
|
+
const B = Type.Boolean();
|
|
76
|
+
const O = Type.Optional;
|
|
77
|
+
const Json = Type.Unknown({ description: "Runtime author capability value, validated against the capability catalog inputSchema." });
|
|
78
|
+
const values = (items) => Type.Union(items.map((item) => Type.Literal(item)));
|
|
79
|
+
const Capability = Type.Object({
|
|
80
|
+
name: S,
|
|
81
|
+
label: S,
|
|
82
|
+
description: S,
|
|
83
|
+
inputSchema: Type.Record(S, Json)
|
|
84
|
+
});
|
|
85
|
+
const Accepted = Type.Object({
|
|
86
|
+
alias: AuthorAliasSchema,
|
|
87
|
+
kind: Type.Literal("accepted"),
|
|
88
|
+
generation: N,
|
|
89
|
+
ownerToken: S,
|
|
90
|
+
catalogToken: O(S),
|
|
91
|
+
leaseMs: N
|
|
92
|
+
});
|
|
93
|
+
const Identity = {
|
|
94
|
+
alias: AuthorAliasSchema,
|
|
95
|
+
generation: N,
|
|
96
|
+
ownerToken: S,
|
|
97
|
+
catalogToken: S,
|
|
98
|
+
requestId: S
|
|
99
|
+
};
|
|
100
|
+
const Request = Type.Object({
|
|
101
|
+
kind: Type.Literal("request"),
|
|
102
|
+
...Identity,
|
|
103
|
+
name: S,
|
|
104
|
+
arguments: Type.Record(S, Json)
|
|
105
|
+
});
|
|
106
|
+
const Cancel = Type.Object({
|
|
107
|
+
kind: Type.Literal("cancel"),
|
|
108
|
+
...Identity
|
|
109
|
+
});
|
|
110
|
+
const AuthorHubMessageSchema = Type.Union([
|
|
111
|
+
Accepted,
|
|
112
|
+
Request,
|
|
113
|
+
Cancel,
|
|
114
|
+
Type.Object({
|
|
115
|
+
alias: AuthorAliasSchema,
|
|
116
|
+
kind: Type.Literal("rejected"),
|
|
117
|
+
reason: S
|
|
118
|
+
})
|
|
119
|
+
]);
|
|
120
|
+
const Binding = {
|
|
121
|
+
alias: AuthorAliasSchema,
|
|
122
|
+
bindingId: S,
|
|
123
|
+
generation: Type.Integer({ minimum: 0 })
|
|
124
|
+
};
|
|
125
|
+
const Owner = {
|
|
126
|
+
...Binding,
|
|
127
|
+
ownerToken: S
|
|
128
|
+
};
|
|
129
|
+
const ResultIdentity = {
|
|
130
|
+
...Owner,
|
|
131
|
+
catalogToken: S,
|
|
132
|
+
requestId: S
|
|
133
|
+
};
|
|
134
|
+
const Format = values([
|
|
135
|
+
"markdown-slides",
|
|
136
|
+
"csv",
|
|
137
|
+
"pptx",
|
|
138
|
+
"xlsx"
|
|
139
|
+
]);
|
|
140
|
+
const Manifest = Type.Object({
|
|
141
|
+
format: Format,
|
|
142
|
+
sourceDigest: S,
|
|
143
|
+
byteLength: N,
|
|
144
|
+
fragmentCount: N,
|
|
145
|
+
metadata: Type.Record(S, Type.Union([
|
|
146
|
+
S,
|
|
147
|
+
N,
|
|
148
|
+
B
|
|
149
|
+
]))
|
|
150
|
+
});
|
|
151
|
+
const Operation = {
|
|
152
|
+
fragmentId: S,
|
|
153
|
+
replacement: S
|
|
154
|
+
};
|
|
155
|
+
const Log = Type.Array(Type.Object({
|
|
156
|
+
...Operation,
|
|
157
|
+
previous: S
|
|
158
|
+
}));
|
|
159
|
+
const Document = {
|
|
160
|
+
path: S,
|
|
161
|
+
format: Format,
|
|
162
|
+
operations: O(Type.Array(Type.Object(Operation), { maxItems: 1e5 })),
|
|
163
|
+
csvDialect: O(Type.Object({
|
|
164
|
+
delimiter: O(values([
|
|
165
|
+
",",
|
|
166
|
+
";",
|
|
167
|
+
" ",
|
|
168
|
+
"|"
|
|
169
|
+
])),
|
|
170
|
+
quote: O(values(["\"", "'"])),
|
|
171
|
+
recordDelimiter: O(values(["\n", "\r\n"]))
|
|
172
|
+
}))
|
|
173
|
+
};
|
|
174
|
+
const ParsedDocument = Type.Object({
|
|
175
|
+
manifest: Manifest,
|
|
176
|
+
fragments: Type.Array(Type.Object({
|
|
177
|
+
id: S,
|
|
178
|
+
kind: values([
|
|
179
|
+
"slide",
|
|
180
|
+
"cell",
|
|
181
|
+
"text-run"
|
|
182
|
+
]),
|
|
183
|
+
text: S,
|
|
184
|
+
readOnly: O(B),
|
|
185
|
+
location: S
|
|
186
|
+
})),
|
|
187
|
+
renderModel: Type.Object({
|
|
188
|
+
format: Format,
|
|
189
|
+
blocks: Type.Array(Type.Object({
|
|
190
|
+
id: S,
|
|
191
|
+
text: S,
|
|
192
|
+
readOnly: B
|
|
193
|
+
}))
|
|
194
|
+
})
|
|
195
|
+
});
|
|
196
|
+
const post = (id, path, schema, output) => ({
|
|
197
|
+
id,
|
|
198
|
+
scope: "session",
|
|
199
|
+
basePath: "author",
|
|
200
|
+
path,
|
|
201
|
+
method: "POST",
|
|
202
|
+
authentication: "owner",
|
|
203
|
+
description: `Author ${id}.`,
|
|
204
|
+
body: {
|
|
205
|
+
required: true,
|
|
206
|
+
contentType: "application/json",
|
|
207
|
+
schema
|
|
208
|
+
},
|
|
209
|
+
responses: jsonApiResponses(output)
|
|
210
|
+
});
|
|
211
|
+
const apiContracts = defineApiContract({
|
|
212
|
+
version: 1,
|
|
213
|
+
dynamic: ["Author capability catalogs supply input JSON Schemas and arbitrary JSON results at runtime."],
|
|
214
|
+
http: [
|
|
215
|
+
{
|
|
216
|
+
id: "author.state",
|
|
217
|
+
scope: "session",
|
|
218
|
+
basePath: "author",
|
|
219
|
+
path: "/state",
|
|
220
|
+
method: "GET",
|
|
221
|
+
authentication: "owner",
|
|
222
|
+
description: "Read author activation.",
|
|
223
|
+
responses: jsonApiResponses(Type.Object({
|
|
224
|
+
sessionId: Type.Union([S, Type.Null()]),
|
|
225
|
+
activation: values(["inactive", "active"]),
|
|
226
|
+
capabilityCount: N
|
|
227
|
+
}))
|
|
228
|
+
},
|
|
229
|
+
post("bridge.register", "/bridge/register", Type.Object(Binding), Accepted),
|
|
230
|
+
post("bridge.catalog", "/bridge/catalog", Type.Object({
|
|
231
|
+
...Owner,
|
|
232
|
+
tools: Type.Array(Capability)
|
|
233
|
+
}), Accepted),
|
|
234
|
+
post("bridge.next", "/bridge/next", Type.Object(Owner), Type.Union([Request, Cancel])),
|
|
235
|
+
post("bridge.result", "/bridge/result", Type.Object({
|
|
236
|
+
...ResultIdentity,
|
|
237
|
+
result: Json
|
|
238
|
+
}), Type.Object({ accepted: Type.Literal(true) })),
|
|
239
|
+
post("bridge.cancelled", "/bridge/cancelled", Type.Object(ResultIdentity), Type.Object({ accepted: Type.Literal(true) })),
|
|
240
|
+
post("bridge.disconnect", "/bridge/disconnect", Type.Object(Binding), Type.Object({ accepted: Type.Literal(true) })),
|
|
241
|
+
post("bridge.close", "/bridge/close", Type.Object({ alias: AuthorAliasSchema }), Type.Object({ accepted: Type.Literal(true) })),
|
|
242
|
+
{
|
|
243
|
+
id: "bridge.describe",
|
|
244
|
+
scope: "session",
|
|
245
|
+
basePath: "author",
|
|
246
|
+
path: "/bridge/describe",
|
|
247
|
+
method: "GET",
|
|
248
|
+
authentication: "owner",
|
|
249
|
+
description: "Read runtime author capabilities.",
|
|
250
|
+
responses: jsonApiResponses(Type.Object({
|
|
251
|
+
catalogToken: S,
|
|
252
|
+
tools: Type.Array(Capability),
|
|
253
|
+
canvases: Type.Array(Type.Object({
|
|
254
|
+
alias: S,
|
|
255
|
+
path: S,
|
|
256
|
+
status: values([
|
|
257
|
+
"opening",
|
|
258
|
+
"ready",
|
|
259
|
+
"unavailable"
|
|
260
|
+
])
|
|
261
|
+
}))
|
|
262
|
+
}))
|
|
263
|
+
},
|
|
264
|
+
post("bridge.invoke", "/bridge/invoke", AuthorUseToolsInputSchema, Type.Object({
|
|
265
|
+
alias: AuthorAliasSchema,
|
|
266
|
+
catalogToken: S,
|
|
267
|
+
name: S,
|
|
268
|
+
result: Json
|
|
269
|
+
})),
|
|
270
|
+
post("documents.open", "/documents/open", Type.Object({
|
|
271
|
+
...Document,
|
|
272
|
+
format: O(Format),
|
|
273
|
+
alias: O(AuthorAliasSchema)
|
|
274
|
+
}), Type.Union([Type.Object({
|
|
275
|
+
path: S,
|
|
276
|
+
byteLength: N,
|
|
277
|
+
alias: AuthorAliasSchema,
|
|
278
|
+
status: values([
|
|
279
|
+
"opening",
|
|
280
|
+
"ready",
|
|
281
|
+
"unavailable"
|
|
282
|
+
]),
|
|
283
|
+
reused: B
|
|
284
|
+
}), ParsedDocument])),
|
|
285
|
+
post("documents.preflight", "/documents/preflight", Type.Object(Document), Type.Object({
|
|
286
|
+
accepted: B,
|
|
287
|
+
digest: S,
|
|
288
|
+
sourceDigest: S,
|
|
289
|
+
operations: Log,
|
|
290
|
+
issues: Type.Array(Type.Object({
|
|
291
|
+
code: S,
|
|
292
|
+
message: S,
|
|
293
|
+
fragmentId: O(S)
|
|
294
|
+
}))
|
|
295
|
+
})),
|
|
296
|
+
post("documents.serialize", "/documents/serialize", Type.Object({
|
|
297
|
+
...Document,
|
|
298
|
+
preflightDigest: S
|
|
299
|
+
}), Type.Object({
|
|
300
|
+
bytes: S,
|
|
301
|
+
encoding: Type.Literal("base64"),
|
|
302
|
+
manifest: Manifest,
|
|
303
|
+
operationLog: Log
|
|
304
|
+
}))
|
|
305
|
+
],
|
|
306
|
+
sockets: ["global", "workspace"].flatMap((scope) => [
|
|
307
|
+
{
|
|
308
|
+
id: "author.send",
|
|
309
|
+
scope,
|
|
310
|
+
service: "author.bridge",
|
|
311
|
+
member: "send",
|
|
312
|
+
kind: "method",
|
|
313
|
+
direction: "client-to-server",
|
|
314
|
+
description: "Scoped author bridge method invoked through po.plugin.v1.",
|
|
315
|
+
input: AuthorBridgeInputSchema,
|
|
316
|
+
output: Type.Object({}, { additionalProperties: false })
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
id: "author.browser",
|
|
320
|
+
scope,
|
|
321
|
+
service: "po.hub.v1",
|
|
322
|
+
member: "author_webmcp",
|
|
323
|
+
kind: "channel",
|
|
324
|
+
direction: "client-to-server",
|
|
325
|
+
description: "Browser author channel payload.",
|
|
326
|
+
input: AuthorBridgeMessageSchema
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
id: "author.hub",
|
|
330
|
+
scope,
|
|
331
|
+
service: "po.hub.v1",
|
|
332
|
+
member: "author_webmcp",
|
|
333
|
+
kind: "channel",
|
|
334
|
+
direction: "server-to-client",
|
|
335
|
+
description: "Hub author channel payload.",
|
|
336
|
+
input: AuthorHubMessageSchema
|
|
337
|
+
}
|
|
338
|
+
])
|
|
339
|
+
});
|
|
340
|
+
//#endregion
|
|
341
|
+
export { apiContracts, apiContracts as default };
|
|
342
|
+
|
|
343
|
+
//# sourceMappingURL=apiContracts.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiContracts.mjs","names":[],"sources":["../src/schemas/authorFacade.ts","../src/schemas/apiContracts.ts"],"sourcesContent":["import type { DoomApiScope } from '@agimon-ai/po-core/packageApi';\nimport { defineDoomPluginMethod } from '@agimon-ai/po-core/pluginProtocol';\nimport { type Static, Type } from 'typebox';\n\nconst AuthorCapabilityNameSchema = Type.String({\n minLength: 1,\n maxLength: 30,\n pattern: '^[a-z][a-z0-9_]*$',\n});\n\nexport const AuthorAliasSchema = Type.String({ minLength: 1, maxLength: 64, pattern: '^[a-z][a-z0-9_-]{0,63}$' });\n\n/** Lists canvases or the capabilities of one named canvas. */\nexport const AuthorDescribeToolsInputSchema = Type.Object(\n { alias: Type.Optional(AuthorAliasSchema) },\n { additionalProperties: false },\n);\nexport type AuthorDescribeToolsInput = Static<typeof AuthorDescribeToolsInputSchema>;\n\n/** Invokes one capability exposed by the current Author viewport. */\nexport const AuthorUseToolsInputSchema = Type.Object(\n {\n alias: Type.Optional(AuthorAliasSchema),\n catalogToken: Type.String({ minLength: 1, maxLength: 256 }),\n name: AuthorCapabilityNameSchema,\n arguments: Type.Record(Type.String(), Type.Unknown()),\n },\n { additionalProperties: false },\n);\nexport type AuthorUseToolsInput = Static<typeof AuthorUseToolsInputSchema>;\n\nconst AuthorBridgeBase = {\n alias: AuthorAliasSchema,\n generation: Type.Number({ minimum: 0 }),\n};\n\n/** Browser-to-server lease messages, validated before Author sees the payload. */\nexport const AuthorBridgeMessageSchema = Type.Union([\n Type.Object({ ...AuthorBridgeBase, kind: Type.Literal('register') }, { additionalProperties: false }),\n Type.Object({ ...AuthorBridgeBase, kind: Type.Literal('release') }, { additionalProperties: false }),\n Type.Object(\n {\n ...AuthorBridgeBase,\n kind: Type.Literal('catalog'),\n ownerToken: Type.String({ minLength: 1 }),\n tools: Type.Array(\n Type.Object(\n {\n name: Type.String({ minLength: 1 }),\n label: Type.String(),\n description: Type.String(),\n inputSchema: Type.Record(Type.String(), Type.Unknown()),\n },\n { additionalProperties: false },\n ),\n ),\n },\n { additionalProperties: false },\n ),\n Type.Object(\n {\n ...AuthorBridgeBase,\n kind: Type.Literal('result'),\n ownerToken: Type.String({ minLength: 1 }),\n catalogToken: Type.String({ minLength: 1 }),\n requestId: Type.String({ minLength: 1 }),\n result: Type.Unknown(),\n },\n { additionalProperties: false },\n ),\n Type.Object(\n {\n ...AuthorBridgeBase,\n kind: Type.Literal('cancelled'),\n ownerToken: Type.String({ minLength: 1 }),\n catalogToken: Type.String({ minLength: 1 }),\n requestId: Type.String({ minLength: 1 }),\n },\n { additionalProperties: false },\n ),\n]);\n\nexport const AuthorBridgeInputSchema = Type.Object(\n { sessionId: Type.String({ minLength: 1 }), message: AuthorBridgeMessageSchema },\n { additionalProperties: false },\n);\n\nexport function authorBridgeMethod(scope: Extract<DoomApiScope, 'global' | 'workspace'>) {\n return defineDoomPluginMethod({\n service: 'author.bridge',\n method: 'send',\n scope,\n direction: 'client-to-server',\n input: AuthorBridgeInputSchema,\n output: Type.Object({}, { additionalProperties: false }),\n });\n}\n","import { defineApiContract, jsonApiResponses, type DoomHttpContract } from '@agimon-ai/po-core/apiContracts';\nimport { Type } from 'typebox';\n\nimport {\n AuthorAliasSchema,\n AuthorBridgeMessageSchema,\n AuthorBridgeInputSchema,\n AuthorUseToolsInputSchema,\n} from './authorFacade';\n\nconst S = Type.String();\nconst N = Type.Number();\nconst B = Type.Boolean();\nconst O = Type.Optional;\nconst Json = Type.Unknown({\n description: 'Runtime author capability value, validated against the capability catalog inputSchema.',\n});\nconst values = <T extends string>(items: T[]) => Type.Union(items.map((item) => Type.Literal(item)));\nconst Capability = Type.Object({ name: S, label: S, description: S, inputSchema: Type.Record(S, Json) });\nconst Accepted = Type.Object({\n alias: AuthorAliasSchema,\n kind: Type.Literal('accepted'),\n generation: N,\n ownerToken: S,\n catalogToken: O(S),\n leaseMs: N,\n});\nconst Identity = { alias: AuthorAliasSchema, generation: N, ownerToken: S, catalogToken: S, requestId: S };\nconst Request = Type.Object({ kind: Type.Literal('request'), ...Identity, name: S, arguments: Type.Record(S, Json) });\nconst Cancel = Type.Object({ kind: Type.Literal('cancel'), ...Identity });\nexport const AuthorHubMessageSchema = Type.Union([\n Accepted,\n Request,\n Cancel,\n Type.Object({ alias: AuthorAliasSchema, kind: Type.Literal('rejected'), reason: S }),\n]);\nconst Binding = { alias: AuthorAliasSchema, bindingId: S, generation: Type.Integer({ minimum: 0 }) };\nconst Owner = { ...Binding, ownerToken: S };\nconst ResultIdentity = { ...Owner, catalogToken: S, requestId: S };\nconst Format = values(['markdown-slides', 'csv', 'pptx', 'xlsx']);\nconst Manifest = Type.Object({\n format: Format,\n sourceDigest: S,\n byteLength: N,\n fragmentCount: N,\n metadata: Type.Record(S, Type.Union([S, N, B])),\n});\nconst Operation = { fragmentId: S, replacement: S };\nconst Log = Type.Array(Type.Object({ ...Operation, previous: S }));\nconst Document = {\n path: S,\n format: Format,\n operations: O(Type.Array(Type.Object(Operation), { maxItems: 100000 })),\n csvDialect: O(\n Type.Object({\n delimiter: O(values([',', ';', '\\t', '|'])),\n quote: O(values(['\"', \"'\"])),\n recordDelimiter: O(values(['\\n', '\\r\\n'])),\n }),\n ),\n};\nconst ParsedDocument = Type.Object({\n manifest: Manifest,\n fragments: Type.Array(\n Type.Object({ id: S, kind: values(['slide', 'cell', 'text-run']), text: S, readOnly: O(B), location: S }),\n ),\n renderModel: Type.Object({ format: Format, blocks: Type.Array(Type.Object({ id: S, text: S, readOnly: B })) }),\n});\nconst post = (id: string, path: string, schema: object, output: object): DoomHttpContract => ({\n id,\n scope: 'session',\n basePath: 'author',\n path,\n method: 'POST',\n authentication: 'owner',\n description: `Author ${id}.`,\n body: { required: true, contentType: 'application/json', schema },\n responses: jsonApiResponses(output),\n});\nexport const apiContracts = defineApiContract({\n version: 1,\n dynamic: ['Author capability catalogs supply input JSON Schemas and arbitrary JSON results at runtime.'],\n http: [\n {\n id: 'author.state',\n scope: 'session',\n basePath: 'author',\n path: '/state',\n method: 'GET',\n authentication: 'owner',\n description: 'Read author activation.',\n responses: jsonApiResponses(\n Type.Object({\n sessionId: Type.Union([S, Type.Null()]),\n activation: values(['inactive', 'active']),\n capabilityCount: N,\n }),\n ),\n },\n post('bridge.register', '/bridge/register', Type.Object(Binding), Accepted),\n post('bridge.catalog', '/bridge/catalog', Type.Object({ ...Owner, tools: Type.Array(Capability) }), Accepted),\n post('bridge.next', '/bridge/next', Type.Object(Owner), Type.Union([Request, Cancel])),\n post(\n 'bridge.result',\n '/bridge/result',\n Type.Object({ ...ResultIdentity, result: Json }),\n Type.Object({ accepted: Type.Literal(true) }),\n ),\n post(\n 'bridge.cancelled',\n '/bridge/cancelled',\n Type.Object(ResultIdentity),\n Type.Object({ accepted: Type.Literal(true) }),\n ),\n post(\n 'bridge.disconnect',\n '/bridge/disconnect',\n Type.Object(Binding),\n Type.Object({ accepted: Type.Literal(true) }),\n ),\n post(\n 'bridge.close',\n '/bridge/close',\n Type.Object({ alias: AuthorAliasSchema }),\n Type.Object({ accepted: Type.Literal(true) }),\n ),\n {\n id: 'bridge.describe',\n scope: 'session',\n basePath: 'author',\n path: '/bridge/describe',\n method: 'GET',\n authentication: 'owner',\n description: 'Read runtime author capabilities.',\n responses: jsonApiResponses(\n Type.Object({\n catalogToken: S,\n tools: Type.Array(Capability),\n canvases: Type.Array(Type.Object({ alias: S, path: S, status: values(['opening', 'ready', 'unavailable']) })),\n }),\n ),\n },\n post(\n 'bridge.invoke',\n '/bridge/invoke',\n AuthorUseToolsInputSchema,\n Type.Object({ alias: AuthorAliasSchema, catalogToken: S, name: S, result: Json }),\n ),\n post(\n 'documents.open',\n '/documents/open',\n Type.Object({ ...Document, format: O(Format), alias: O(AuthorAliasSchema) }),\n Type.Union([\n Type.Object({\n path: S,\n byteLength: N,\n alias: AuthorAliasSchema,\n status: values(['opening', 'ready', 'unavailable']),\n reused: B,\n }),\n ParsedDocument,\n ]),\n ),\n post(\n 'documents.preflight',\n '/documents/preflight',\n Type.Object(Document),\n Type.Object({\n accepted: B,\n digest: S,\n sourceDigest: S,\n operations: Log,\n issues: Type.Array(Type.Object({ code: S, message: S, fragmentId: O(S) })),\n }),\n ),\n post(\n 'documents.serialize',\n '/documents/serialize',\n Type.Object({ ...Document, preflightDigest: S }),\n Type.Object({ bytes: S, encoding: Type.Literal('base64'), manifest: Manifest, operationLog: Log }),\n ),\n ],\n sockets: (['global', 'workspace'] as const).flatMap((scope) => [\n {\n id: 'author.send',\n scope,\n service: 'author.bridge',\n member: 'send',\n kind: 'method',\n direction: 'client-to-server',\n description: 'Scoped author bridge method invoked through po.plugin.v1.',\n input: AuthorBridgeInputSchema,\n output: Type.Object({}, { additionalProperties: false }),\n },\n {\n id: 'author.browser',\n scope,\n service: 'po.hub.v1',\n member: 'author_webmcp',\n kind: 'channel',\n direction: 'client-to-server',\n description: 'Browser author channel payload.',\n input: AuthorBridgeMessageSchema,\n },\n {\n id: 'author.hub',\n scope,\n service: 'po.hub.v1',\n member: 'author_webmcp',\n kind: 'channel',\n direction: 'server-to-client',\n description: 'Hub author channel payload.',\n input: AuthorHubMessageSchema,\n },\n ]),\n});\nexport default apiContracts;\n"],"mappings":";;;;AAIA,MAAM,6BAA6B,KAAK,OAAO;CAC7C,WAAW;CACX,WAAW;CACX,SAAS;AACX,CAAC;AAED,MAAa,oBAAoB,KAAK,OAAO;CAAE,WAAW;CAAG,WAAW;CAAI,SAAS;AAA0B,CAAC;AAGlE,KAAK,OACjD,EAAE,OAAO,KAAK,SAAS,iBAAiB,EAAE,GAC1C,EAAE,sBAAsB,MAAM,CAChC;;AAIA,MAAa,4BAA4B,KAAK,OAC5C;CACE,OAAO,KAAK,SAAS,iBAAiB;CACtC,cAAc,KAAK,OAAO;EAAE,WAAW;EAAG,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AW,SAAS,UAAU;EAC7D;GACE,IAAI;GACJ;GACA,SAAS;GACT,QAAQ;GACR,MAAM;GACN,WAAW;GACX,aAAa;GACb,OAAO;GACP,QAAQ,KAAK,OAAO,CAAC,GAAG,EAAE,sBAAsB,MAAM,CAAC;EACzD;EACA;GACE,IAAI;GACJ;GACA,SAAS;GACT,QAAQ;GACR,MAAM;GACN,WAAW;GACX,aAAa;GACb,OAAO;EACT;EACA;GACE,IAAI;GACJ;GACA,SAAS;GACT,QAAQ;GACR,MAAM;GACN,WAAW;GACX,aAAa;GACb,OAAO;EACT;CACF,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { defineDoomPluginMethod } from "@agimon-ai/po-core/pluginProtocol";
|
|
2
|
+
import { Type } from "typebox";
|
|
3
|
+
//#region src/schemas/authorFacade.ts
|
|
4
|
+
const AuthorCapabilityNameSchema = Type.String({
|
|
5
|
+
minLength: 1,
|
|
6
|
+
maxLength: 30,
|
|
7
|
+
pattern: "^[a-z][a-z0-9_]*$"
|
|
8
|
+
});
|
|
9
|
+
const AuthorAliasSchema = Type.String({
|
|
10
|
+
minLength: 1,
|
|
11
|
+
maxLength: 64,
|
|
12
|
+
pattern: "^[a-z][a-z0-9_-]{0,63}$"
|
|
13
|
+
});
|
|
14
|
+
/** Lists canvases or the capabilities of one named canvas. */
|
|
15
|
+
const AuthorDescribeToolsInputSchema = Type.Object({ alias: Type.Optional(AuthorAliasSchema) }, { additionalProperties: false });
|
|
16
|
+
/** Invokes one capability exposed by the current Author viewport. */
|
|
17
|
+
const AuthorUseToolsInputSchema = Type.Object({
|
|
18
|
+
alias: Type.Optional(AuthorAliasSchema),
|
|
19
|
+
catalogToken: Type.String({
|
|
20
|
+
minLength: 1,
|
|
21
|
+
maxLength: 256
|
|
22
|
+
}),
|
|
23
|
+
name: AuthorCapabilityNameSchema,
|
|
24
|
+
arguments: Type.Record(Type.String(), Type.Unknown())
|
|
25
|
+
}, { additionalProperties: false });
|
|
26
|
+
const AuthorBridgeBase = {
|
|
27
|
+
alias: AuthorAliasSchema,
|
|
28
|
+
generation: Type.Number({ minimum: 0 })
|
|
29
|
+
};
|
|
30
|
+
/** Browser-to-server lease messages, validated before Author sees the payload. */
|
|
31
|
+
const AuthorBridgeMessageSchema = Type.Union([
|
|
32
|
+
Type.Object({
|
|
33
|
+
...AuthorBridgeBase,
|
|
34
|
+
kind: Type.Literal("register")
|
|
35
|
+
}, { additionalProperties: false }),
|
|
36
|
+
Type.Object({
|
|
37
|
+
...AuthorBridgeBase,
|
|
38
|
+
kind: Type.Literal("release")
|
|
39
|
+
}, { additionalProperties: false }),
|
|
40
|
+
Type.Object({
|
|
41
|
+
...AuthorBridgeBase,
|
|
42
|
+
kind: Type.Literal("catalog"),
|
|
43
|
+
ownerToken: Type.String({ minLength: 1 }),
|
|
44
|
+
tools: Type.Array(Type.Object({
|
|
45
|
+
name: Type.String({ minLength: 1 }),
|
|
46
|
+
label: Type.String(),
|
|
47
|
+
description: Type.String(),
|
|
48
|
+
inputSchema: Type.Record(Type.String(), Type.Unknown())
|
|
49
|
+
}, { additionalProperties: false }))
|
|
50
|
+
}, { additionalProperties: false }),
|
|
51
|
+
Type.Object({
|
|
52
|
+
...AuthorBridgeBase,
|
|
53
|
+
kind: Type.Literal("result"),
|
|
54
|
+
ownerToken: Type.String({ minLength: 1 }),
|
|
55
|
+
catalogToken: Type.String({ minLength: 1 }),
|
|
56
|
+
requestId: Type.String({ minLength: 1 }),
|
|
57
|
+
result: Type.Unknown()
|
|
58
|
+
}, { additionalProperties: false }),
|
|
59
|
+
Type.Object({
|
|
60
|
+
...AuthorBridgeBase,
|
|
61
|
+
kind: Type.Literal("cancelled"),
|
|
62
|
+
ownerToken: Type.String({ minLength: 1 }),
|
|
63
|
+
catalogToken: Type.String({ minLength: 1 }),
|
|
64
|
+
requestId: Type.String({ minLength: 1 })
|
|
65
|
+
}, { additionalProperties: false })
|
|
66
|
+
]);
|
|
67
|
+
const AuthorBridgeInputSchema = Type.Object({
|
|
68
|
+
sessionId: Type.String({ minLength: 1 }),
|
|
69
|
+
message: AuthorBridgeMessageSchema
|
|
70
|
+
}, { additionalProperties: false });
|
|
71
|
+
function authorBridgeMethod(scope) {
|
|
72
|
+
return defineDoomPluginMethod({
|
|
73
|
+
service: "author.bridge",
|
|
74
|
+
method: "send",
|
|
75
|
+
scope,
|
|
76
|
+
direction: "client-to-server",
|
|
77
|
+
input: AuthorBridgeInputSchema,
|
|
78
|
+
output: Type.Object({}, { additionalProperties: false })
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
//#endregion
|
|
82
|
+
export { AuthorUseToolsInputSchema as a, AuthorDescribeToolsInputSchema as i, AuthorBridgeInputSchema as n, authorBridgeMethod as o, AuthorBridgeMessageSchema as r, AuthorAliasSchema as t };
|
|
83
|
+
|
|
84
|
+
//# sourceMappingURL=authorFacade--Lc599Ft.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorFacade--Lc599Ft.mjs","names":[],"sources":["../src/schemas/authorFacade.ts"],"sourcesContent":["import type { DoomApiScope } from '@agimon-ai/po-core/packageApi';\nimport { defineDoomPluginMethod } from '@agimon-ai/po-core/pluginProtocol';\nimport { type Static, Type } from 'typebox';\n\nconst AuthorCapabilityNameSchema = Type.String({\n minLength: 1,\n maxLength: 30,\n pattern: '^[a-z][a-z0-9_]*$',\n});\n\nexport const AuthorAliasSchema = Type.String({ minLength: 1, maxLength: 64, pattern: '^[a-z][a-z0-9_-]{0,63}$' });\n\n/** Lists canvases or the capabilities of one named canvas. */\nexport const AuthorDescribeToolsInputSchema = Type.Object(\n { alias: Type.Optional(AuthorAliasSchema) },\n { additionalProperties: false },\n);\nexport type AuthorDescribeToolsInput = Static<typeof AuthorDescribeToolsInputSchema>;\n\n/** Invokes one capability exposed by the current Author viewport. */\nexport const AuthorUseToolsInputSchema = Type.Object(\n {\n alias: Type.Optional(AuthorAliasSchema),\n catalogToken: Type.String({ minLength: 1, maxLength: 256 }),\n name: AuthorCapabilityNameSchema,\n arguments: Type.Record(Type.String(), Type.Unknown()),\n },\n { additionalProperties: false },\n);\nexport type AuthorUseToolsInput = Static<typeof AuthorUseToolsInputSchema>;\n\nconst AuthorBridgeBase = {\n alias: AuthorAliasSchema,\n generation: Type.Number({ minimum: 0 }),\n};\n\n/** Browser-to-server lease messages, validated before Author sees the payload. */\nexport const AuthorBridgeMessageSchema = Type.Union([\n Type.Object({ ...AuthorBridgeBase, kind: Type.Literal('register') }, { additionalProperties: false }),\n Type.Object({ ...AuthorBridgeBase, kind: Type.Literal('release') }, { additionalProperties: false }),\n Type.Object(\n {\n ...AuthorBridgeBase,\n kind: Type.Literal('catalog'),\n ownerToken: Type.String({ minLength: 1 }),\n tools: Type.Array(\n Type.Object(\n {\n name: Type.String({ minLength: 1 }),\n label: Type.String(),\n description: Type.String(),\n inputSchema: Type.Record(Type.String(), Type.Unknown()),\n },\n { additionalProperties: false },\n ),\n ),\n },\n { additionalProperties: false },\n ),\n Type.Object(\n {\n ...AuthorBridgeBase,\n kind: Type.Literal('result'),\n ownerToken: Type.String({ minLength: 1 }),\n catalogToken: Type.String({ minLength: 1 }),\n requestId: Type.String({ minLength: 1 }),\n result: Type.Unknown(),\n },\n { additionalProperties: false },\n ),\n Type.Object(\n {\n ...AuthorBridgeBase,\n kind: Type.Literal('cancelled'),\n ownerToken: Type.String({ minLength: 1 }),\n catalogToken: Type.String({ minLength: 1 }),\n requestId: Type.String({ minLength: 1 }),\n },\n { additionalProperties: false },\n ),\n]);\n\nexport const AuthorBridgeInputSchema = Type.Object(\n { sessionId: Type.String({ minLength: 1 }), message: AuthorBridgeMessageSchema },\n { additionalProperties: false },\n);\n\nexport function authorBridgeMethod(scope: Extract<DoomApiScope, 'global' | 'workspace'>) {\n return defineDoomPluginMethod({\n service: 'author.bridge',\n method: 'send',\n scope,\n direction: 'client-to-server',\n input: AuthorBridgeInputSchema,\n output: Type.Object({}, { additionalProperties: false }),\n });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;EACE,GAAG;EACH,MAAM,KAAK,QAAQ,QAAQ;EAC3B,YAAY,KAAK,OAAO,EAAE,WAAW,EAAE,CAAC;EACxC,cAAc,KAAK,OAAO,EAAE,WAAW,EAAE,CAAC;EAC1C,WAAW,KAAK,OAAO,EAAE,WAAW,EAAE,CAAC;EACvC,QAAQ,KAAK,QAAQ;CACvB,GACA,EAAE,sBAAsB,MAAM,CAChC;CACA,KAAK,OACH;EACE,GAAG;EACH,MAAM,KAAK,QAAQ,WAAW;EAC9B,YAAY,KAAK,OAAO,EAAE,WAAW,EAAE,CAAC;EACxC,cAAc,KAAK,OAAO,EAAE,WAAW,EAAE,CAAC;EAC1C,WAAW,KAAK,OAAO,EAAE,WAAW,EAAE,CAAC;CACzC,GACA,EAAE,sBAAsB,MAAM,CAChC;AACF,CAAC;AAED,MAAa,0BAA0B,KAAK,OAC1C;CAAE,WAAW,KAAK,OAAO,EAAE,WAAW,EAAE,CAAC;CAAG,SAAS;AAA0B,GAC/E,EAAE,sBAAsB,MAAM,CAChC;AAEA,SAAgB,mBAAmB,OAAsD;CACvF,OAAO,uBAAuB;EAC5B,SAAS;EACT,QAAQ;EACR;EACA,WAAW;EACX,OAAO;EACP,QAAQ,KAAK,OAAO,CAAC,GAAG,EAAE,sBAAsB,MAAM,CAAC;CACzD,CAAC;AACH"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { Static, Type } from "typebox";
|
|
2
|
+
import { DoomApiScope } from "@agimon-ai/po-core/packageApi";
|
|
3
|
+
//#region src/schemas/authorFacade.d.ts
|
|
4
|
+
declare const AuthorAliasSchema: Type.TString;
|
|
5
|
+
/** Lists canvases or the capabilities of one named canvas. */
|
|
6
|
+
declare const AuthorDescribeToolsInputSchema: Type.TObject<{
|
|
7
|
+
alias: Type.TOptional<Type.TString>;
|
|
8
|
+
}>;
|
|
9
|
+
type AuthorDescribeToolsInput = Static<typeof AuthorDescribeToolsInputSchema>;
|
|
10
|
+
/** Invokes one capability exposed by the current Author viewport. */
|
|
11
|
+
declare const AuthorUseToolsInputSchema: Type.TObject<{
|
|
12
|
+
alias: Type.TOptional<Type.TString>;
|
|
13
|
+
catalogToken: Type.TString;
|
|
14
|
+
name: Type.TString;
|
|
15
|
+
arguments: Type.TRecord<"^.*$", Type.TUnknown>;
|
|
16
|
+
}>;
|
|
17
|
+
type AuthorUseToolsInput = Static<typeof AuthorUseToolsInputSchema>;
|
|
18
|
+
/** Browser-to-server lease messages, validated before Author sees the payload. */
|
|
19
|
+
declare const AuthorBridgeMessageSchema: Type.TUnion<[Type.TObject<{
|
|
20
|
+
alias: Type.TString;
|
|
21
|
+
generation: Type.TNumber;
|
|
22
|
+
kind: Type.TLiteral<"register">;
|
|
23
|
+
}>, Type.TObject<{
|
|
24
|
+
alias: Type.TString;
|
|
25
|
+
generation: Type.TNumber;
|
|
26
|
+
kind: Type.TLiteral<"release">;
|
|
27
|
+
}>, Type.TObject<{
|
|
28
|
+
alias: Type.TString;
|
|
29
|
+
generation: Type.TNumber;
|
|
30
|
+
kind: Type.TLiteral<"catalog">;
|
|
31
|
+
ownerToken: Type.TString;
|
|
32
|
+
tools: Type.TArray<Type.TObject<{
|
|
33
|
+
name: Type.TString;
|
|
34
|
+
label: Type.TString;
|
|
35
|
+
description: Type.TString;
|
|
36
|
+
inputSchema: Type.TRecord<"^.*$", Type.TUnknown>;
|
|
37
|
+
}>>;
|
|
38
|
+
}>, Type.TObject<{
|
|
39
|
+
alias: Type.TString;
|
|
40
|
+
generation: Type.TNumber;
|
|
41
|
+
kind: Type.TLiteral<"result">;
|
|
42
|
+
ownerToken: Type.TString;
|
|
43
|
+
catalogToken: Type.TString;
|
|
44
|
+
requestId: Type.TString;
|
|
45
|
+
result: Type.TUnknown;
|
|
46
|
+
}>, Type.TObject<{
|
|
47
|
+
alias: Type.TString;
|
|
48
|
+
generation: Type.TNumber;
|
|
49
|
+
kind: Type.TLiteral<"cancelled">;
|
|
50
|
+
ownerToken: Type.TString;
|
|
51
|
+
catalogToken: Type.TString;
|
|
52
|
+
requestId: Type.TString;
|
|
53
|
+
}>]>;
|
|
54
|
+
declare const AuthorBridgeInputSchema: Type.TObject<{
|
|
55
|
+
sessionId: Type.TString;
|
|
56
|
+
message: Type.TUnion<[Type.TObject<{
|
|
57
|
+
alias: Type.TString;
|
|
58
|
+
generation: Type.TNumber;
|
|
59
|
+
kind: Type.TLiteral<"register">;
|
|
60
|
+
}>, Type.TObject<{
|
|
61
|
+
alias: Type.TString;
|
|
62
|
+
generation: Type.TNumber;
|
|
63
|
+
kind: Type.TLiteral<"release">;
|
|
64
|
+
}>, Type.TObject<{
|
|
65
|
+
alias: Type.TString;
|
|
66
|
+
generation: Type.TNumber;
|
|
67
|
+
kind: Type.TLiteral<"catalog">;
|
|
68
|
+
ownerToken: Type.TString;
|
|
69
|
+
tools: Type.TArray<Type.TObject<{
|
|
70
|
+
name: Type.TString;
|
|
71
|
+
label: Type.TString;
|
|
72
|
+
description: Type.TString;
|
|
73
|
+
inputSchema: Type.TRecord<"^.*$", Type.TUnknown>;
|
|
74
|
+
}>>;
|
|
75
|
+
}>, Type.TObject<{
|
|
76
|
+
alias: Type.TString;
|
|
77
|
+
generation: Type.TNumber;
|
|
78
|
+
kind: Type.TLiteral<"result">;
|
|
79
|
+
ownerToken: Type.TString;
|
|
80
|
+
catalogToken: Type.TString;
|
|
81
|
+
requestId: Type.TString;
|
|
82
|
+
result: Type.TUnknown;
|
|
83
|
+
}>, Type.TObject<{
|
|
84
|
+
alias: Type.TString;
|
|
85
|
+
generation: Type.TNumber;
|
|
86
|
+
kind: Type.TLiteral<"cancelled">;
|
|
87
|
+
ownerToken: Type.TString;
|
|
88
|
+
catalogToken: Type.TString;
|
|
89
|
+
requestId: Type.TString;
|
|
90
|
+
}>]>;
|
|
91
|
+
}>;
|
|
92
|
+
declare function authorBridgeMethod(scope: Extract<DoomApiScope, 'global' | 'workspace'>): import("@agimon-ai/po-core/pluginProtocol").DoomPluginMethod<Type.TObject<{
|
|
93
|
+
sessionId: Type.TString;
|
|
94
|
+
message: Type.TUnion<[Type.TObject<{
|
|
95
|
+
alias: Type.TString;
|
|
96
|
+
generation: Type.TNumber;
|
|
97
|
+
kind: Type.TLiteral<"register">;
|
|
98
|
+
}>, Type.TObject<{
|
|
99
|
+
alias: Type.TString;
|
|
100
|
+
generation: Type.TNumber;
|
|
101
|
+
kind: Type.TLiteral<"release">;
|
|
102
|
+
}>, Type.TObject<{
|
|
103
|
+
alias: Type.TString;
|
|
104
|
+
generation: Type.TNumber;
|
|
105
|
+
kind: Type.TLiteral<"catalog">;
|
|
106
|
+
ownerToken: Type.TString;
|
|
107
|
+
tools: Type.TArray<Type.TObject<{
|
|
108
|
+
name: Type.TString;
|
|
109
|
+
label: Type.TString;
|
|
110
|
+
description: Type.TString;
|
|
111
|
+
inputSchema: Type.TRecord<"^.*$", Type.TUnknown>;
|
|
112
|
+
}>>;
|
|
113
|
+
}>, Type.TObject<{
|
|
114
|
+
alias: Type.TString;
|
|
115
|
+
generation: Type.TNumber;
|
|
116
|
+
kind: Type.TLiteral<"result">;
|
|
117
|
+
ownerToken: Type.TString;
|
|
118
|
+
catalogToken: Type.TString;
|
|
119
|
+
requestId: Type.TString;
|
|
120
|
+
result: Type.TUnknown;
|
|
121
|
+
}>, Type.TObject<{
|
|
122
|
+
alias: Type.TString;
|
|
123
|
+
generation: Type.TNumber;
|
|
124
|
+
kind: Type.TLiteral<"cancelled">;
|
|
125
|
+
ownerToken: Type.TString;
|
|
126
|
+
catalogToken: Type.TString;
|
|
127
|
+
requestId: Type.TString;
|
|
128
|
+
}>]>;
|
|
129
|
+
}>, Type.TObject<{}>>;
|
|
130
|
+
//#endregion
|
|
131
|
+
export { AuthorDescribeToolsInputSchema as a, authorBridgeMethod as c, AuthorDescribeToolsInput as i, AuthorBridgeInputSchema as n, AuthorUseToolsInput as o, AuthorBridgeMessageSchema as r, AuthorUseToolsInputSchema as s, AuthorAliasSchema as t };
|
|
132
|
+
//# sourceMappingURL=authorFacade-89Eb2-sW.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorFacade-89Eb2-sW.d.mts","names":[],"sources":["../src/schemas/authorFacade.ts"],"mappings":";;;cAUa,mBAAiB,KAAA;;cAGjB,gCAA8B,KAAA;;;KAI/B,2BAA2B,cAAc;;cAGxC,2BAAyB,KAAA;;;;;;KAS1B,sBAAsB,cAAc;;cAQnC,2BAAyB,KAAA,QAAA,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA6CzB,yBAAuB,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAKpB,mBAAmB,OAAO,QAAQ,oFAAqC,iBAAA,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAStF,KAAA"}
|