@lushly-dev/afd-server 0.1.0 → 0.3.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/LICENSE +21 -26
- package/README.md +475 -381
- package/dist/bootstrap/afd-docs.d.ts +1 -1
- package/dist/bootstrap/afd-docs.d.ts.map +1 -1
- package/dist/bootstrap/afd-docs.js +3 -3
- package/dist/bootstrap/afd-docs.js.map +1 -1
- package/dist/bootstrap/afd-help.d.ts +2 -1
- package/dist/bootstrap/afd-help.d.ts.map +1 -1
- package/dist/bootstrap/afd-help.js +4 -3
- package/dist/bootstrap/afd-help.js.map +1 -1
- package/dist/bootstrap/afd-schema.d.ts +1 -1
- package/dist/bootstrap/afd-schema.d.ts.map +1 -1
- package/dist/bootstrap/afd-schema.js +13 -13
- package/dist/bootstrap/afd-schema.js.map +1 -1
- package/dist/bootstrap/index.d.ts +1 -1
- package/dist/bootstrap/index.js +1 -1
- package/dist/bootstrap/registry.d.ts.map +1 -1
- package/dist/bootstrap/registry.js +3 -1
- package/dist/bootstrap/registry.js.map +1 -1
- package/dist/handoff-schema.d.ts +245 -0
- package/dist/handoff-schema.d.ts.map +1 -0
- package/dist/handoff-schema.js +97 -0
- package/dist/handoff-schema.js.map +1 -0
- package/dist/index.d.ts +8 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -8
- package/dist/index.js.map +1 -1
- package/dist/middleware.d.ts +217 -3
- package/dist/middleware.d.ts.map +1 -1
- package/dist/middleware.js +266 -4
- package/dist/middleware.js.map +1 -1
- package/dist/schema.d.ts +49 -4
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +37 -4
- package/dist/schema.js.map +1 -1
- package/dist/server.d.ts +11 -9
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +539 -161
- package/dist/server.js.map +1 -1
- package/dist/validation.d.ts +68 -79
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +96 -102
- package/dist/validation.js.map +1 -1
- package/package.json +19 -4
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Generate markdown documentation for commands.
|
|
5
5
|
*/
|
|
6
|
-
import { z } from 'zod';
|
|
7
6
|
import type { CommandDefinition } from '@lushly-dev/afd-core';
|
|
7
|
+
import { z } from 'zod';
|
|
8
8
|
declare const inputSchema: z.ZodObject<{
|
|
9
9
|
command: z.ZodOptional<z.ZodString>;
|
|
10
10
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"afd-docs.d.ts","sourceRoot":"","sources":["../../src/bootstrap/afd-docs.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"afd-docs.d.ts","sourceRoot":"","sources":["../../src/bootstrap/afd-docs.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,QAAA,MAAM,WAAW;;;;;;EAEf,CAAC;AAEH,KAAK,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAE7C,UAAU,UAAU;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CACnC,WAAW,EAAE,MAAM,iBAAiB,EAAE,GACpC,iBAAiB,CAAC,SAAS,EAAE,UAAU,CAAC,CAiG1C"}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Generate markdown documentation for commands.
|
|
5
5
|
*/
|
|
6
|
-
import { z } from 'zod';
|
|
7
6
|
import { success } from '@lushly-dev/afd-core';
|
|
7
|
+
import { z } from 'zod';
|
|
8
8
|
const inputSchema = z.object({
|
|
9
9
|
command: z.string().optional().describe('Specific command name, or omit for all'),
|
|
10
10
|
});
|
|
@@ -28,7 +28,7 @@ export function createAfdDocsCommand(getCommands) {
|
|
|
28
28
|
const allCommands = getCommands();
|
|
29
29
|
// Filter to specific command if provided
|
|
30
30
|
const commands = input.command
|
|
31
|
-
? allCommands.filter(cmd => cmd.name === input.command)
|
|
31
|
+
? allCommands.filter((cmd) => cmd.name === input.command)
|
|
32
32
|
: allCommands;
|
|
33
33
|
if (input.command && commands.length === 0) {
|
|
34
34
|
return success({ markdown: '', commandCount: 0 }, { reasoning: `Command "${input.command}" not found`, confidence: 1.0 });
|
|
@@ -56,7 +56,7 @@ export function createAfdDocsCommand(getCommands) {
|
|
|
56
56
|
lines.push('');
|
|
57
57
|
// Tags
|
|
58
58
|
if (cmd.tags && cmd.tags.length > 0) {
|
|
59
|
-
lines.push(`**Tags:** ${cmd.tags.map(t => `\`${t}\``).join(', ')}`);
|
|
59
|
+
lines.push(`**Tags:** ${cmd.tags.map((t) => `\`${t}\``).join(', ')}`);
|
|
60
60
|
lines.push('');
|
|
61
61
|
}
|
|
62
62
|
// Mutation info
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"afd-docs.js","sourceRoot":"","sources":["../../src/bootstrap/afd-docs.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"afd-docs.js","sourceRoot":"","sources":["../../src/bootstrap/afd-docs.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,wCAAwC,CAAC;CACjF,CAAC,CAAC;AASH;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CACnC,WAAsC;IAEtC,OAAO;QACN,IAAI,EAAE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C,+BAA+B,QAAQ,CAAC,MAAM,WAAW;gBAC5D,UAAU,EAAE,GAAG;aACf,CACD,CAAC;QACH,CAAC;KACD,CAAC;AACH,CAAC"}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* List all available commands with tags and grouping.
|
|
5
5
|
*/
|
|
6
|
-
import { z } from 'zod';
|
|
7
6
|
import type { CommandDefinition } from '@lushly-dev/afd-core';
|
|
7
|
+
import { z } from 'zod';
|
|
8
8
|
declare const inputSchema: z.ZodObject<{
|
|
9
9
|
filter: z.ZodOptional<z.ZodString>;
|
|
10
10
|
format: z.ZodDefault<z.ZodEnum<["brief", "full"]>>;
|
|
@@ -22,6 +22,7 @@ interface CommandInfo {
|
|
|
22
22
|
category?: string;
|
|
23
23
|
tags?: string[];
|
|
24
24
|
mutation?: boolean;
|
|
25
|
+
requires?: string[];
|
|
25
26
|
}
|
|
26
27
|
interface HelpOutput {
|
|
27
28
|
commands: CommandInfo[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"afd-help.d.ts","sourceRoot":"","sources":["../../src/bootstrap/afd-help.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"afd-help.d.ts","sourceRoot":"","sources":["../../src/bootstrap/afd-help.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,QAAA,MAAM,WAAW;;;;;;;;;EAGf,CAAC;AAEH,KAAK,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAE7C,UAAU,WAAW;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,UAAU,UAAU;IACnB,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC;CACjD;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CACnC,WAAW,EAAE,MAAM,iBAAiB,EAAE,GACpC,iBAAiB,CAAC,SAAS,EAAE,UAAU,CAAC,CAwE1C"}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* List all available commands with tags and grouping.
|
|
5
5
|
*/
|
|
6
|
-
import { z } from 'zod';
|
|
7
6
|
import { success } from '@lushly-dev/afd-core';
|
|
7
|
+
import { z } from 'zod';
|
|
8
8
|
const inputSchema = z.object({
|
|
9
9
|
filter: z.string().optional().describe('Tag filter: e.g., "todo" or "read"'),
|
|
10
10
|
format: z.enum(['brief', 'full']).default('brief').describe('Output format'),
|
|
@@ -33,12 +33,12 @@ export function createAfdHelpCommand(getCommands) {
|
|
|
33
33
|
const filtered = !!input.filter;
|
|
34
34
|
if (input.filter) {
|
|
35
35
|
const filterTag = input.filter.toLowerCase();
|
|
36
|
-
commands = allCommands.filter(cmd => cmd.tags?.some(tag => tag.toLowerCase().includes(filterTag)) ||
|
|
36
|
+
commands = allCommands.filter((cmd) => cmd.tags?.some((tag) => tag.toLowerCase().includes(filterTag)) ||
|
|
37
37
|
cmd.category?.toLowerCase().includes(filterTag) ||
|
|
38
38
|
cmd.name.toLowerCase().includes(filterTag));
|
|
39
39
|
}
|
|
40
40
|
// Map to output format
|
|
41
|
-
const commandInfos = commands.map(cmd => {
|
|
41
|
+
const commandInfos = commands.map((cmd) => {
|
|
42
42
|
const info = {
|
|
43
43
|
name: cmd.name,
|
|
44
44
|
description: cmd.description,
|
|
@@ -47,6 +47,7 @@ export function createAfdHelpCommand(getCommands) {
|
|
|
47
47
|
info.category = cmd.category;
|
|
48
48
|
info.tags = cmd.tags;
|
|
49
49
|
info.mutation = cmd.mutation;
|
|
50
|
+
info.requires = cmd.requires;
|
|
50
51
|
}
|
|
51
52
|
return info;
|
|
52
53
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"afd-help.js","sourceRoot":"","sources":["../../src/bootstrap/afd-help.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"afd-help.js","sourceRoot":"","sources":["../../src/bootstrap/afd-help.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oCAAoC,CAAC;IAC5E,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,eAAe,CAAC;CAC5E,CAAC,CAAC;AAoBH;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CACnC,WAAsC;IAEtC,OAAO;QACN,IAAI,EAAE,UAAU;QAChB,WAAW,EAAE,oDAAoD;QACjE,QAAQ,EAAE,WAAW;QACrB,IAAI,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC;QACnC,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,OAAO;QAChB,UAAU,EAAE;YACX,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE;YAC9E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AC7B,IAAI,CAAC,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;gBAC9B,CAAC;gBAED,OAAO,IAAI,CAAC;YACb,CAAC,CAAC,CAAC;YAEH,oBAAoB;YACpB,MAAM,iBAAiB,GAAkC,EAAE,CAAC;YAC5D,KAAK,MAAM,GAAG,IAAI,YAAY,EAAE,CAAC;gBAChC,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,IAAI,eAAe,CAAC;gBACjD,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,EAAE,CAAC;oBAClC,iBAAiB,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC;gBAClC,CAAC;gBACD,iBAAiB,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACvC,CAAC;YAED,MAAM,MAAM,GAAe;gBAC1B,QAAQ,EAAE,YAAY;gBACtB,KAAK,EAAE,YAAY,CAAC,MAAM;gBAC1B,QAAQ;gBACR,iBAAiB;aACjB,CAAC;YAEF,OAAO,OAAO,CAAC,MAAM,EAAE;gBACtB,SAAS,EAAE,QAAQ;oBAClB,CAAC,CAAC,SAAS,YAAY,CAAC,MAAM,uBAAuB,KAAK,CAAC,MAAM,GAAG;oBACpE,CAAC,CAAC,eAAe,YAAY,CAAC,MAAM,qBAAqB;gBAC1D,UAAU,EAAE,GAAG;aACf,CAAC,CAAC;QACJ,CAAC;KACD,CAAC;AACH,CAAC"}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Export JSON schemas for all commands.
|
|
5
5
|
*/
|
|
6
|
-
import { z } from 'zod';
|
|
7
6
|
import type { CommandDefinition } from '@lushly-dev/afd-core';
|
|
7
|
+
import { z } from 'zod';
|
|
8
8
|
declare const inputSchema: z.ZodObject<{
|
|
9
9
|
format: z.ZodDefault<z.ZodEnum<["json", "typescript"]>>;
|
|
10
10
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"afd-schema.d.ts","sourceRoot":"","sources":["../../src/bootstrap/afd-schema.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"afd-schema.d.ts","sourceRoot":"","sources":["../../src/bootstrap/afd-schema.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,QAAA,MAAM,WAAW;;;;;;EAEf,CAAC;AAEH,KAAK,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAE7C,UAAU,UAAU;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC;AAED,UAAU,YAAY;IACrB,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,GAAG,YAAY,CAAC;CAC9B;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACrC,WAAW,EAAE,MAAM,iBAAiB,EAAE,EACtC,aAAa,CAAC,EAAE,CAAC,GAAG,EAAE,iBAAiB,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACjE,iBAAiB,CAAC,SAAS,EAAE,YAAY,CAAC,CAyE5C"}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Export JSON schemas for all commands.
|
|
5
5
|
*/
|
|
6
|
-
import { z } from 'zod';
|
|
7
6
|
import { success } from '@lushly-dev/afd-core';
|
|
7
|
+
import { z } from 'zod';
|
|
8
8
|
const inputSchema = z.object({
|
|
9
9
|
format: z.enum(['json', 'typescript']).default('json').describe('Output format'),
|
|
10
10
|
});
|
|
@@ -22,12 +22,10 @@ export function createAfdSchemaCommand(getCommands, getJsonSchema) {
|
|
|
22
22
|
tags: ['bootstrap', 'read', 'safe'],
|
|
23
23
|
mutation: false,
|
|
24
24
|
version: '1.0.0',
|
|
25
|
-
parameters: [
|
|
26
|
-
{ name: 'format', type: 'string', required: false, description: 'Output format' },
|
|
27
|
-
],
|
|
25
|
+
parameters: [{ name: 'format', type: 'string', required: false, description: 'Output format' }],
|
|
28
26
|
async handler(input) {
|
|
29
27
|
const commands = getCommands();
|
|
30
|
-
const schemas = commands.map(cmd => {
|
|
28
|
+
const schemas = commands.map((cmd) => {
|
|
31
29
|
// Try to get JSON schema from the command or use getJsonSchema function
|
|
32
30
|
let schema = {};
|
|
33
31
|
if (getJsonSchema) {
|
|
@@ -40,18 +38,20 @@ export function createAfdSchemaCommand(getCommands, getJsonSchema) {
|
|
|
40
38
|
// Build basic schema from parameters
|
|
41
39
|
schema = {
|
|
42
40
|
type: 'object',
|
|
43
|
-
properties: Object.fromEntries(cmd.parameters.map(p => [
|
|
41
|
+
properties: Object.fromEntries(cmd.parameters.map((p) => [
|
|
44
42
|
p.name,
|
|
45
43
|
{
|
|
46
|
-
type: p.type === 'string'
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
type: p.type === 'string'
|
|
45
|
+
? 'string'
|
|
46
|
+
: p.type === 'number'
|
|
47
|
+
? 'number'
|
|
48
|
+
: p.type === 'boolean'
|
|
49
|
+
? 'boolean'
|
|
50
|
+
: 'any',
|
|
49
51
|
description: p.description,
|
|
50
|
-
}
|
|
52
|
+
},
|
|
51
53
|
])),
|
|
52
|
-
required: cmd.parameters
|
|
53
|
-
.filter(p => p.required)
|
|
54
|
-
.map(p => p.name),
|
|
54
|
+
required: cmd.parameters.filter((p) => p.required).map((p) => p.name),
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"afd-schema.js","sourceRoot":"","sources":["../../src/bootstrap/afd-schema.ts"],"names":[],"mappings":"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AAC;YAED,OAAO,OAAO,CACb,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,EAClD;gBACC,SAAS,EAAE,6BAA6B,OAAO,CAAC,MAAM,WAAW;gBACjE,UAAU,EAAE,GAAG;aACf,CACD,CAAC;QACH,CAAC;KACD,CAAC;AACH,CAAC"}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* These tools are automatically added to every AFD MCP server to enable
|
|
5
5
|
* agent discovery and onboarding.
|
|
6
6
|
*/
|
|
7
|
-
export { createAfdHelpCommand } from './afd-help.js';
|
|
8
7
|
export { createAfdDocsCommand } from './afd-docs.js';
|
|
8
|
+
export { createAfdHelpCommand } from './afd-help.js';
|
|
9
9
|
export { createAfdSchemaCommand } from './afd-schema.js';
|
|
10
10
|
export { getBootstrapCommands } from './registry.js';
|
|
11
11
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/bootstrap/index.js
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* These tools are automatically added to every AFD MCP server to enable
|
|
5
5
|
* agent discovery and onboarding.
|
|
6
6
|
*/
|
|
7
|
-
export { createAfdHelpCommand } from './afd-help.js';
|
|
8
7
|
export { createAfdDocsCommand } from './afd-docs.js';
|
|
8
|
+
export { createAfdHelpCommand } from './afd-help.js';
|
|
9
9
|
export { createAfdSchemaCommand } from './afd-schema.js';
|
|
10
10
|
export { getBootstrapCommands } from './registry.js';
|
|
11
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/bootstrap/registry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAK9D;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CACnC,WAAW,EAAE,MAAM,iBAAiB,EAAE,EACtC,OAAO,CAAC,EAAE;IACT,aAAa,CAAC,EAAE,CAAC,GAAG,EAAE,iBAAiB,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpE,GACC,iBAAiB,EAAE,
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/bootstrap/registry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAK9D;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CACnC,WAAW,EAAE,MAAM,iBAAiB,EAAE,EACtC,OAAO,CAAC,EAAE;IACT,aAAa,CAAC,EAAE,CAAC,GAAG,EAAE,iBAAiB,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpE,GACC,iBAAiB,EAAE,CAQrB"}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Provides a function to get all bootstrap commands for an AFD server.
|
|
5
5
|
*/
|
|
6
|
-
import { createAfdHelpCommand } from './afd-help.js';
|
|
7
6
|
import { createAfdDocsCommand } from './afd-docs.js';
|
|
7
|
+
import { createAfdHelpCommand } from './afd-help.js';
|
|
8
8
|
import { createAfdSchemaCommand } from './afd-schema.js';
|
|
9
9
|
/**
|
|
10
10
|
* Get all bootstrap commands for an AFD server.
|
|
@@ -14,6 +14,8 @@ import { createAfdSchemaCommand } from './afd-schema.js';
|
|
|
14
14
|
* @returns Array of bootstrap command definitions
|
|
15
15
|
*/
|
|
16
16
|
export function getBootstrapCommands(getCommands, options) {
|
|
17
|
+
// SAFETY: Each creator returns CommandDefinition<SpecificInput, SpecificOutput>, which is structurally
|
|
18
|
+
// compatible with CommandDefinition but TypeScript's invariant generics require the double cast.
|
|
17
19
|
return [
|
|
18
20
|
createAfdHelpCommand(getCommands),
|
|
19
21
|
createAfdDocsCommand(getCommands),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/bootstrap/registry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAEzD;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CACnC,WAAsC,EACtC,OAEC;IAED,OAAO;QACN,oBAAoB,CAAC,WAAW,CAAiC;QACjE,oBAAoB,CAAC,WAAW,CAAiC;QACjE,sBAAsB,CAAC,WAAW,EAAE,OAAO,EAAE,aAAa,CAAiC;KAC3F,CAAC;AACH,CAAC"}
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/bootstrap/registry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAEzD;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CACnC,WAAsC,EACtC,OAEC;IAED,uGAAuG;IACvG,iGAAiG;IACjG,OAAO;QACN,oBAAoB,CAAC,WAAW,CAAiC;QACjE,oBAAoB,CAAC,WAAW,CAAiC;QACjE,sBAAsB,CAAC,WAAW,EAAE,OAAO,EAAE,aAAa,CAAiC;KAC3F,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Zod schemas for handoff types
|
|
3
|
+
*
|
|
4
|
+
* These schemas provide runtime validation for HandoffResult and related types.
|
|
5
|
+
* Use these when defining handoff commands or validating handoff data.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
/**
|
|
9
|
+
* Zod schema for HandoffCredentials.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* const credentials = HandoffCredentialsSchema.parse({
|
|
14
|
+
* token: 'abc123',
|
|
15
|
+
* sessionId: 'session-xyz'
|
|
16
|
+
* });
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare const HandoffCredentialsSchema: z.ZodObject<{
|
|
20
|
+
/** Bearer token for authentication */
|
|
21
|
+
token: z.ZodOptional<z.ZodString>;
|
|
22
|
+
/** Additional headers to include */
|
|
23
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
24
|
+
/** Session ID for correlation */
|
|
25
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
26
|
+
}, "strip", z.ZodTypeAny, {
|
|
27
|
+
token?: string | undefined;
|
|
28
|
+
headers?: Record<string, string> | undefined;
|
|
29
|
+
sessionId?: string | undefined;
|
|
30
|
+
}, {
|
|
31
|
+
token?: string | undefined;
|
|
32
|
+
headers?: Record<string, string> | undefined;
|
|
33
|
+
sessionId?: string | undefined;
|
|
34
|
+
}>;
|
|
35
|
+
/**
|
|
36
|
+
* Zod schema for HandoffMetadata.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```typescript
|
|
40
|
+
* const metadata = HandoffMetadataSchema.parse({
|
|
41
|
+
* capabilities: ['text', 'presence'],
|
|
42
|
+
* reconnect: { allowed: true, maxAttempts: 5 }
|
|
43
|
+
* });
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export declare const HandoffMetadataSchema: z.ZodObject<{
|
|
47
|
+
/** Expected latency in ms (hint for client) */
|
|
48
|
+
expectedLatency: z.ZodOptional<z.ZodNumber>;
|
|
49
|
+
/** Capabilities the channel supports */
|
|
50
|
+
capabilities: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
51
|
+
/** When the handoff credentials expire (ISO 8601) */
|
|
52
|
+
expiresAt: z.ZodOptional<z.ZodString>;
|
|
53
|
+
/** Reconnection policy */
|
|
54
|
+
reconnect: z.ZodOptional<z.ZodObject<{
|
|
55
|
+
/** Whether reconnection is allowed */
|
|
56
|
+
allowed: z.ZodBoolean;
|
|
57
|
+
/** Maximum number of reconnection attempts */
|
|
58
|
+
maxAttempts: z.ZodOptional<z.ZodNumber>;
|
|
59
|
+
/** Base backoff time in milliseconds */
|
|
60
|
+
backoffMs: z.ZodOptional<z.ZodNumber>;
|
|
61
|
+
}, "strip", z.ZodTypeAny, {
|
|
62
|
+
allowed: boolean;
|
|
63
|
+
maxAttempts?: number | undefined;
|
|
64
|
+
backoffMs?: number | undefined;
|
|
65
|
+
}, {
|
|
66
|
+
allowed: boolean;
|
|
67
|
+
maxAttempts?: number | undefined;
|
|
68
|
+
backoffMs?: number | undefined;
|
|
69
|
+
}>>;
|
|
70
|
+
/** Human-readable description of the handoff */
|
|
71
|
+
description: z.ZodOptional<z.ZodString>;
|
|
72
|
+
}, "strip", z.ZodTypeAny, {
|
|
73
|
+
expectedLatency?: number | undefined;
|
|
74
|
+
capabilities?: string[] | undefined;
|
|
75
|
+
expiresAt?: string | undefined;
|
|
76
|
+
reconnect?: {
|
|
77
|
+
allowed: boolean;
|
|
78
|
+
maxAttempts?: number | undefined;
|
|
79
|
+
backoffMs?: number | undefined;
|
|
80
|
+
} | undefined;
|
|
81
|
+
description?: string | undefined;
|
|
82
|
+
}, {
|
|
83
|
+
expectedLatency?: number | undefined;
|
|
84
|
+
capabilities?: string[] | undefined;
|
|
85
|
+
expiresAt?: string | undefined;
|
|
86
|
+
reconnect?: {
|
|
87
|
+
allowed: boolean;
|
|
88
|
+
maxAttempts?: number | undefined;
|
|
89
|
+
backoffMs?: number | undefined;
|
|
90
|
+
} | undefined;
|
|
91
|
+
description?: string | undefined;
|
|
92
|
+
}>;
|
|
93
|
+
/**
|
|
94
|
+
* Zod schema for HandoffResult.
|
|
95
|
+
*
|
|
96
|
+
* Use this as the outputSchema for handoff commands.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```typescript
|
|
100
|
+
* import { defineCommand } from '@lushly-dev/afd-server';
|
|
101
|
+
*
|
|
102
|
+
* const connectChat = defineCommand({
|
|
103
|
+
* name: 'chat-connect',
|
|
104
|
+
* description: 'Connect to a chat room',
|
|
105
|
+
* handoff: true,
|
|
106
|
+
* input: z.object({ roomId: z.string() }),
|
|
107
|
+
* outputSchema: HandoffResultSchema,
|
|
108
|
+
* async handler(input, ctx) {
|
|
109
|
+
* return success({
|
|
110
|
+
* protocol: 'websocket',
|
|
111
|
+
* endpoint: `wss://chat.example.com/rooms/${input.roomId}`,
|
|
112
|
+
* credentials: { token: ctx.session.token }
|
|
113
|
+
* });
|
|
114
|
+
* }
|
|
115
|
+
* });
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
export declare const HandoffResultSchema: z.ZodObject<{
|
|
119
|
+
/** Protocol type for client dispatch */
|
|
120
|
+
protocol: z.ZodString;
|
|
121
|
+
/** Full URL to connect to */
|
|
122
|
+
endpoint: z.ZodString;
|
|
123
|
+
/** Authentication credentials for the handoff */
|
|
124
|
+
credentials: z.ZodOptional<z.ZodObject<{
|
|
125
|
+
/** Bearer token for authentication */
|
|
126
|
+
token: z.ZodOptional<z.ZodString>;
|
|
127
|
+
/** Additional headers to include */
|
|
128
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
129
|
+
/** Session ID for correlation */
|
|
130
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
131
|
+
}, "strip", z.ZodTypeAny, {
|
|
132
|
+
token?: string | undefined;
|
|
133
|
+
headers?: Record<string, string> | undefined;
|
|
134
|
+
sessionId?: string | undefined;
|
|
135
|
+
}, {
|
|
136
|
+
token?: string | undefined;
|
|
137
|
+
headers?: Record<string, string> | undefined;
|
|
138
|
+
sessionId?: string | undefined;
|
|
139
|
+
}>>;
|
|
140
|
+
/** Metadata for client decision-making */
|
|
141
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
142
|
+
/** Expected latency in ms (hint for client) */
|
|
143
|
+
expectedLatency: z.ZodOptional<z.ZodNumber>;
|
|
144
|
+
/** Capabilities the channel supports */
|
|
145
|
+
capabilities: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
146
|
+
/** When the handoff credentials expire (ISO 8601) */
|
|
147
|
+
expiresAt: z.ZodOptional<z.ZodString>;
|
|
148
|
+
/** Reconnection policy */
|
|
149
|
+
reconnect: z.ZodOptional<z.ZodObject<{
|
|
150
|
+
/** Whether reconnection is allowed */
|
|
151
|
+
allowed: z.ZodBoolean;
|
|
152
|
+
/** Maximum number of reconnection attempts */
|
|
153
|
+
maxAttempts: z.ZodOptional<z.ZodNumber>;
|
|
154
|
+
/** Base backoff time in milliseconds */
|
|
155
|
+
backoffMs: z.ZodOptional<z.ZodNumber>;
|
|
156
|
+
}, "strip", z.ZodTypeAny, {
|
|
157
|
+
allowed: boolean;
|
|
158
|
+
maxAttempts?: number | undefined;
|
|
159
|
+
backoffMs?: number | undefined;
|
|
160
|
+
}, {
|
|
161
|
+
allowed: boolean;
|
|
162
|
+
maxAttempts?: number | undefined;
|
|
163
|
+
backoffMs?: number | undefined;
|
|
164
|
+
}>>;
|
|
165
|
+
/** Human-readable description of the handoff */
|
|
166
|
+
description: z.ZodOptional<z.ZodString>;
|
|
167
|
+
}, "strip", z.ZodTypeAny, {
|
|
168
|
+
expectedLatency?: number | undefined;
|
|
169
|
+
capabilities?: string[] | undefined;
|
|
170
|
+
expiresAt?: string | undefined;
|
|
171
|
+
reconnect?: {
|
|
172
|
+
allowed: boolean;
|
|
173
|
+
maxAttempts?: number | undefined;
|
|
174
|
+
backoffMs?: number | undefined;
|
|
175
|
+
} | undefined;
|
|
176
|
+
description?: string | undefined;
|
|
177
|
+
}, {
|
|
178
|
+
expectedLatency?: number | undefined;
|
|
179
|
+
capabilities?: string[] | undefined;
|
|
180
|
+
expiresAt?: string | undefined;
|
|
181
|
+
reconnect?: {
|
|
182
|
+
allowed: boolean;
|
|
183
|
+
maxAttempts?: number | undefined;
|
|
184
|
+
backoffMs?: number | undefined;
|
|
185
|
+
} | undefined;
|
|
186
|
+
description?: string | undefined;
|
|
187
|
+
}>>;
|
|
188
|
+
}, "strip", z.ZodTypeAny, {
|
|
189
|
+
protocol: string;
|
|
190
|
+
endpoint: string;
|
|
191
|
+
credentials?: {
|
|
192
|
+
token?: string | undefined;
|
|
193
|
+
headers?: Record<string, string> | undefined;
|
|
194
|
+
sessionId?: string | undefined;
|
|
195
|
+
} | undefined;
|
|
196
|
+
metadata?: {
|
|
197
|
+
expectedLatency?: number | undefined;
|
|
198
|
+
capabilities?: string[] | undefined;
|
|
199
|
+
expiresAt?: string | undefined;
|
|
200
|
+
reconnect?: {
|
|
201
|
+
allowed: boolean;
|
|
202
|
+
maxAttempts?: number | undefined;
|
|
203
|
+
backoffMs?: number | undefined;
|
|
204
|
+
} | undefined;
|
|
205
|
+
description?: string | undefined;
|
|
206
|
+
} | undefined;
|
|
207
|
+
}, {
|
|
208
|
+
protocol: string;
|
|
209
|
+
endpoint: string;
|
|
210
|
+
credentials?: {
|
|
211
|
+
token?: string | undefined;
|
|
212
|
+
headers?: Record<string, string> | undefined;
|
|
213
|
+
sessionId?: string | undefined;
|
|
214
|
+
} | undefined;
|
|
215
|
+
metadata?: {
|
|
216
|
+
expectedLatency?: number | undefined;
|
|
217
|
+
capabilities?: string[] | undefined;
|
|
218
|
+
expiresAt?: string | undefined;
|
|
219
|
+
reconnect?: {
|
|
220
|
+
allowed: boolean;
|
|
221
|
+
maxAttempts?: number | undefined;
|
|
222
|
+
backoffMs?: number | undefined;
|
|
223
|
+
} | undefined;
|
|
224
|
+
description?: string | undefined;
|
|
225
|
+
} | undefined;
|
|
226
|
+
}>;
|
|
227
|
+
/**
|
|
228
|
+
* Inferred type from HandoffCredentialsSchema.
|
|
229
|
+
* Matches the HandoffCredentials interface in @lushly-dev/afd-core.
|
|
230
|
+
*/
|
|
231
|
+
export type HandoffCredentialsInput = z.input<typeof HandoffCredentialsSchema>;
|
|
232
|
+
export type HandoffCredentialsOutput = z.output<typeof HandoffCredentialsSchema>;
|
|
233
|
+
/**
|
|
234
|
+
* Inferred type from HandoffMetadataSchema.
|
|
235
|
+
* Matches the HandoffMetadata interface in @lushly-dev/afd-core.
|
|
236
|
+
*/
|
|
237
|
+
export type HandoffMetadataInput = z.input<typeof HandoffMetadataSchema>;
|
|
238
|
+
export type HandoffMetadataOutput = z.output<typeof HandoffMetadataSchema>;
|
|
239
|
+
/**
|
|
240
|
+
* Inferred type from HandoffResultSchema.
|
|
241
|
+
* Matches the HandoffResult interface in @lushly-dev/afd-core.
|
|
242
|
+
*/
|
|
243
|
+
export type HandoffResultInput = z.input<typeof HandoffResultSchema>;
|
|
244
|
+
export type HandoffResultOutput = z.output<typeof HandoffResultSchema>;
|
|
245
|
+
//# sourceMappingURL=handoff-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handoff-schema.d.ts","sourceRoot":"","sources":["../src/handoff-schema.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB;;;;;;;;;;GAUG;AACH,eAAO,MAAM,wBAAwB;IACpC,sCAAsC;;IAEtC,oCAAoC;;IAEpC,iCAAiC;;;;;;;;;;EAEhC,CAAC;AAEH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,qBAAqB;IACjC,+CAA+C;;IAE/C,wCAAwC;;IAExC,qDAAqD;;IAErD,0BAA0B;;QAGxB,sCAAsC;;QAEtC,8CAA8C;;QAE9C,wCAAwC;;;;;;;;;;;IAI1C,gDAAgD;;;;;;;;;;;;;;;;;;;;;;EAE/C,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,mBAAmB;IAC/B,wCAAwC;;IAExC,6BAA6B;;IAE7B,iDAAiD;;QAvEjD,sCAAsC;;QAEtC,oCAAoC;;QAEpC,iCAAiC;;;;;;;;;;;IAqEjC,0CAA0C;;QArD1C,+CAA+C;;QAE/C,wCAAwC;;QAExC,qDAAqD;;QAErD,0BAA0B;;YAGxB,sCAAsC;;YAEtC,8CAA8C;;YAE9C,wCAAwC;;;;;;;;;;;QAI1C,gDAAgD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsC/C,CAAC;AAMH;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC/E,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAEjF;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACzE,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAE3E;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AACrE,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Zod schemas for handoff types
|
|
3
|
+
*
|
|
4
|
+
* These schemas provide runtime validation for HandoffResult and related types.
|
|
5
|
+
* Use these when defining handoff commands or validating handoff data.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
9
|
+
// ZOD SCHEMAS
|
|
10
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
11
|
+
/**
|
|
12
|
+
* Zod schema for HandoffCredentials.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* const credentials = HandoffCredentialsSchema.parse({
|
|
17
|
+
* token: 'abc123',
|
|
18
|
+
* sessionId: 'session-xyz'
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export const HandoffCredentialsSchema = z.object({
|
|
23
|
+
/** Bearer token for authentication */
|
|
24
|
+
token: z.string().optional(),
|
|
25
|
+
/** Additional headers to include */
|
|
26
|
+
headers: z.record(z.string()).optional(),
|
|
27
|
+
/** Session ID for correlation */
|
|
28
|
+
sessionId: z.string().optional(),
|
|
29
|
+
});
|
|
30
|
+
/**
|
|
31
|
+
* Zod schema for HandoffMetadata.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```typescript
|
|
35
|
+
* const metadata = HandoffMetadataSchema.parse({
|
|
36
|
+
* capabilities: ['text', 'presence'],
|
|
37
|
+
* reconnect: { allowed: true, maxAttempts: 5 }
|
|
38
|
+
* });
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export const HandoffMetadataSchema = z.object({
|
|
42
|
+
/** Expected latency in ms (hint for client) */
|
|
43
|
+
expectedLatency: z.number().optional(),
|
|
44
|
+
/** Capabilities the channel supports */
|
|
45
|
+
capabilities: z.array(z.string()).optional(),
|
|
46
|
+
/** When the handoff credentials expire (ISO 8601) */
|
|
47
|
+
expiresAt: z.string().datetime().optional(),
|
|
48
|
+
/** Reconnection policy */
|
|
49
|
+
reconnect: z
|
|
50
|
+
.object({
|
|
51
|
+
/** Whether reconnection is allowed */
|
|
52
|
+
allowed: z.boolean(),
|
|
53
|
+
/** Maximum number of reconnection attempts */
|
|
54
|
+
maxAttempts: z.number().optional(),
|
|
55
|
+
/** Base backoff time in milliseconds */
|
|
56
|
+
backoffMs: z.number().optional(),
|
|
57
|
+
})
|
|
58
|
+
.optional(),
|
|
59
|
+
/** Human-readable description of the handoff */
|
|
60
|
+
description: z.string().optional(),
|
|
61
|
+
});
|
|
62
|
+
/**
|
|
63
|
+
* Zod schema for HandoffResult.
|
|
64
|
+
*
|
|
65
|
+
* Use this as the outputSchema for handoff commands.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```typescript
|
|
69
|
+
* import { defineCommand } from '@lushly-dev/afd-server';
|
|
70
|
+
*
|
|
71
|
+
* const connectChat = defineCommand({
|
|
72
|
+
* name: 'chat-connect',
|
|
73
|
+
* description: 'Connect to a chat room',
|
|
74
|
+
* handoff: true,
|
|
75
|
+
* input: z.object({ roomId: z.string() }),
|
|
76
|
+
* outputSchema: HandoffResultSchema,
|
|
77
|
+
* async handler(input, ctx) {
|
|
78
|
+
* return success({
|
|
79
|
+
* protocol: 'websocket',
|
|
80
|
+
* endpoint: `wss://chat.example.com/rooms/${input.roomId}`,
|
|
81
|
+
* credentials: { token: ctx.session.token }
|
|
82
|
+
* });
|
|
83
|
+
* }
|
|
84
|
+
* });
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
export const HandoffResultSchema = z.object({
|
|
88
|
+
/** Protocol type for client dispatch */
|
|
89
|
+
protocol: z.string(),
|
|
90
|
+
/** Full URL to connect to */
|
|
91
|
+
endpoint: z.string().url(),
|
|
92
|
+
/** Authentication credentials for the handoff */
|
|
93
|
+
credentials: HandoffCredentialsSchema.optional(),
|
|
94
|
+
/** Metadata for client decision-making */
|
|
95
|
+
metadata: HandoffMetadataSchema.optional(),
|
|
96
|
+
});
|
|
97
|
+
//# sourceMappingURL=handoff-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handoff-schema.js","sourceRoot":"","sources":["../src/handoff-schema.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,kFAAkF;AAClF,cAAc;AACd,kFAAkF;AAElF;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,sCAAsC;IACtC,KAAK,EAAE,CAAC,CAAC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