@harnesys/sdk 0.0.0-stage → 1.0.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 +80 -2
- package/dist/addon-context-factory.d.ts +6 -0
- package/dist/addon-context-factory.js +160 -0
- package/dist/addon-context.d.ts +346 -0
- package/dist/addon-context.js +0 -0
- package/dist/define-addon.d.ts +57 -0
- package/dist/define-addon.js +53 -0
- package/dist/families/config.d.ts +14 -0
- package/dist/families/config.js +16 -0
- package/dist/families/content.d.ts +28 -0
- package/dist/families/content.js +19 -0
- package/dist/families/field-spec.d.ts +100 -0
- package/dist/families/field-spec.js +85 -0
- package/dist/families/hook.d.ts +37 -0
- package/dist/families/hook.js +25 -0
- package/dist/families/job.d.ts +45 -0
- package/dist/families/job.js +26 -0
- package/dist/families/json-schema.d.ts +36 -0
- package/dist/families/json-schema.js +101 -0
- package/dist/families/lsp.d.ts +18 -0
- package/dist/families/lsp.js +18 -0
- package/dist/families/mcp.d.ts +18 -0
- package/dist/families/mcp.js +18 -0
- package/dist/families/registry.d.ts +9 -0
- package/dist/families/registry.js +34 -0
- package/dist/families/route.d.ts +38 -0
- package/dist/families/route.js +37 -0
- package/dist/families/source-kind.d.ts +24 -0
- package/dist/families/source-kind.js +21 -0
- package/dist/families/tool-pack.d.ts +68 -0
- package/dist/families/tool-pack.js +57 -0
- package/dist/families/transport.d.ts +52 -0
- package/dist/families/transport.js +29 -0
- package/dist/families/trigger.d.ts +97 -0
- package/dist/families/trigger.js +46 -0
- package/dist/families/view.d.ts +255 -0
- package/dist/families/view.js +87 -0
- package/dist/families/viewer.d.ts +31 -0
- package/dist/families/viewer.js +26 -0
- package/dist/families/worker.d.ts +23 -0
- package/dist/families/worker.js +19 -0
- package/dist/host-client.d.ts +11 -0
- package/dist/host-client.js +30 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.js +35 -0
- package/dist/manifest/branding.d.ts +14 -0
- package/dist/manifest/branding.js +18 -0
- package/dist/manifest/connections.d.ts +21 -0
- package/dist/manifest/connections.js +10 -0
- package/dist/manifest/json-schema.d.ts +2 -0
- package/dist/manifest/json-schema.js +13 -0
- package/dist/manifest/l10n.d.ts +9 -0
- package/dist/manifest/l10n.js +28 -0
- package/dist/manifest/manifest.d.ts +112 -0
- package/dist/manifest/manifest.js +45 -0
- package/dist/manifest/validate.d.ts +14 -0
- package/dist/manifest/validate.js +144 -0
- package/dist/permissions/permissions.d.ts +31 -0
- package/dist/permissions/permissions.js +53 -0
- package/dist/process-entry.d.ts +26 -0
- package/dist/process-entry.js +146 -0
- package/dist/protocol/envelope.d.ts +115 -0
- package/dist/protocol/envelope.js +72 -0
- package/dist/protocol/error.d.ts +67 -0
- package/dist/protocol/error.js +61 -0
- package/dist/protocol/handshake.d.ts +55 -0
- package/dist/protocol/handshake.js +26 -0
- package/dist/protocol/map.d.ts +1090 -0
- package/dist/protocol/map.js +127 -0
- package/dist/protocol/meta.d.ts +31 -0
- package/dist/protocol/meta.js +14 -0
- package/dist/protocol/method-spec.d.ts +13 -0
- package/dist/protocol/method-spec.js +9 -0
- package/dist/protocol/org-service-methods.d.ts +135 -0
- package/dist/protocol/org-service-methods.js +106 -0
- package/dist/protocol/shared.d.ts +389 -0
- package/dist/protocol/shared.js +231 -0
- package/dist/protocol/source-methods.d.ts +218 -0
- package/dist/protocol/source-methods.js +18 -0
- package/dist/protocol/thread-service-methods.d.ts +50 -0
- package/dist/protocol/thread-service-methods.js +32 -0
- package/dist/runtime.d.ts +25 -0
- package/dist/runtime.js +229 -0
- package/dist/testing/fake-db.d.ts +15 -0
- package/dist/testing/fake-db.js +120 -0
- package/dist/testing/fake-files.d.ts +9 -0
- package/dist/testing/fake-files.js +87 -0
- package/dist/testing/fake-host.d.ts +115 -0
- package/dist/testing/fake-host.js +152 -0
- package/dist/testing/fake-services.d.ts +63 -0
- package/dist/testing/fake-services.js +277 -0
- package/dist/testing/fixtures.d.ts +4 -0
- package/dist/testing/fixtures.js +84 -0
- package/dist/testing/index.d.ts +4 -0
- package/dist/testing/index.js +2 -0
- package/package.json +66 -4
- package/src/addon-context-factory.ts +236 -0
- package/src/addon-context.ts +313 -0
- package/src/define-addon.ts +178 -0
- package/src/families/config.ts +24 -0
- package/src/families/content.ts +35 -0
- package/src/families/field-spec.ts +175 -0
- package/src/families/hook.ts +34 -0
- package/src/families/job.ts +41 -0
- package/src/families/json-schema.ts +167 -0
- package/src/families/lsp.ts +28 -0
- package/src/families/mcp.ts +28 -0
- package/src/families/registry.ts +44 -0
- package/src/families/route.ts +52 -0
- package/src/families/source-kind.ts +34 -0
- package/src/families/tool-pack.ts +92 -0
- package/src/families/transport.ts +52 -0
- package/src/families/trigger.ts +92 -0
- package/src/families/view.ts +144 -0
- package/src/families/viewer.ts +43 -0
- package/src/families/worker.ts +30 -0
- package/src/host-client.ts +52 -0
- package/src/index.ts +341 -0
- package/src/manifest/branding.ts +24 -0
- package/src/manifest/connections.ts +21 -0
- package/src/manifest/json-schema.ts +24 -0
- package/src/manifest/l10n.ts +39 -0
- package/src/manifest/manifest.ts +94 -0
- package/src/manifest/validate.ts +200 -0
- package/src/permissions/permissions.ts +79 -0
- package/src/process-entry.ts +205 -0
- package/src/protocol/envelope.ts +126 -0
- package/src/protocol/error.ts +81 -0
- package/src/protocol/handshake.ts +43 -0
- package/src/protocol/map.ts +339 -0
- package/src/protocol/meta.ts +26 -0
- package/src/protocol/method-spec.ts +40 -0
- package/src/protocol/org-service-methods.ts +148 -0
- package/src/protocol/shared.ts +345 -0
- package/src/protocol/source-methods.ts +61 -0
- package/src/protocol/thread-service-methods.ts +50 -0
- package/src/runtime.ts +332 -0
- package/src/testing/fake-db.ts +140 -0
- package/src/testing/fake-files.ts +114 -0
- package/src/testing/fake-host.ts +261 -0
- package/src/testing/fake-services.ts +345 -0
- package/src/testing/fixtures.ts +88 -0
- package/src/testing/index.ts +12 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { configFamily } from "./config.js";
|
|
2
|
+
import { contentFamily } from "./content.js";
|
|
3
|
+
import { hookFamily } from "./hook.js";
|
|
4
|
+
import { jobFamily } from "./job.js";
|
|
5
|
+
import { lspFamily } from "./lsp.js";
|
|
6
|
+
import { mcpFamily } from "./mcp.js";
|
|
7
|
+
import { routeFamily } from "./route.js";
|
|
8
|
+
import { sourceKindFamily } from "./source-kind.js";
|
|
9
|
+
import { toolPackFamily } from "./tool-pack.js";
|
|
10
|
+
import { transportFamily } from "./transport.js";
|
|
11
|
+
import { triggerFamily } from "./trigger.js";
|
|
12
|
+
import { viewFamily } from "./view.js";
|
|
13
|
+
import { viewerFamily } from "./viewer.js";
|
|
14
|
+
import { workerFamily } from "./worker.js";
|
|
15
|
+
export const familyRegistry = {
|
|
16
|
+
'tool-pack': toolPackFamily,
|
|
17
|
+
trigger: triggerFamily,
|
|
18
|
+
job: jobFamily,
|
|
19
|
+
worker: workerFamily,
|
|
20
|
+
route: routeFamily,
|
|
21
|
+
transport: transportFamily,
|
|
22
|
+
hook: hookFamily,
|
|
23
|
+
content: contentFamily,
|
|
24
|
+
config: configFamily,
|
|
25
|
+
view: viewFamily,
|
|
26
|
+
'source-kind': sourceKindFamily,
|
|
27
|
+
mcp: mcpFamily,
|
|
28
|
+
lsp: lspFamily,
|
|
29
|
+
viewer: viewerFamily,
|
|
30
|
+
};
|
|
31
|
+
export const FAMILY_NAMES = Object.keys(familyRegistry);
|
|
32
|
+
export function familyDefinition(family) {
|
|
33
|
+
return familyRegistry[family];
|
|
34
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const ROUTE_SCHEMA_VERSION = 1;
|
|
3
|
+
export type RouteMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
4
|
+
export interface RouteDescriptor {
|
|
5
|
+
id: string;
|
|
6
|
+
method: RouteMethod;
|
|
7
|
+
path: string;
|
|
8
|
+
role?: 'member' | 'admin';
|
|
9
|
+
exposure?: 'org' | 'public';
|
|
10
|
+
bodyLimitKb?: number;
|
|
11
|
+
requestSchema?: Record<string, unknown>;
|
|
12
|
+
}
|
|
13
|
+
export declare const RouteDescriptorSchema: z.ZodObject<{
|
|
14
|
+
id: z.ZodString;
|
|
15
|
+
method: z.ZodEnum<{
|
|
16
|
+
GET: "GET";
|
|
17
|
+
POST: "POST";
|
|
18
|
+
PUT: "PUT";
|
|
19
|
+
PATCH: "PATCH";
|
|
20
|
+
DELETE: "DELETE";
|
|
21
|
+
}>;
|
|
22
|
+
path: z.ZodString;
|
|
23
|
+
role: z.ZodOptional<z.ZodEnum<{
|
|
24
|
+
member: "member";
|
|
25
|
+
admin: "admin";
|
|
26
|
+
}>>;
|
|
27
|
+
exposure: z.ZodOptional<z.ZodEnum<{
|
|
28
|
+
org: "org";
|
|
29
|
+
public: "public";
|
|
30
|
+
}>>;
|
|
31
|
+
bodyLimitKb: z.ZodOptional<z.ZodNumber>;
|
|
32
|
+
requestSchema: z.ZodOptional<z.ZodLazy<z.ZodType<import("./json-schema.ts").JsonSchemaSubset, unknown, z.core.$ZodTypeInternals<import("./json-schema.ts").JsonSchemaSubset, unknown>>>>;
|
|
33
|
+
}, z.core.$strip>;
|
|
34
|
+
export declare const routeFamily: {
|
|
35
|
+
family: string;
|
|
36
|
+
versions: number[];
|
|
37
|
+
schema: (v: number) => z.ZodType;
|
|
38
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { JsonSchemaSubsetSchema, validateInputSchema } from "./json-schema.js";
|
|
3
|
+
export const ROUTE_SCHEMA_VERSION = 1;
|
|
4
|
+
export const RouteDescriptorSchema = z
|
|
5
|
+
.object({
|
|
6
|
+
id: z.string().min(1),
|
|
7
|
+
method: z.enum(['GET', 'POST', 'PUT', 'PATCH', 'DELETE']),
|
|
8
|
+
path: z
|
|
9
|
+
.string()
|
|
10
|
+
.regex(/^\/[A-Za-z0-9/_:.-]*$/, 'path must start with / and use :param segments'),
|
|
11
|
+
role: z.enum(['member', 'admin']).optional(),
|
|
12
|
+
exposure: z.enum(['org', 'public']).optional(),
|
|
13
|
+
bodyLimitKb: z.number().int().positive().optional(),
|
|
14
|
+
requestSchema: JsonSchemaSubsetSchema.optional(),
|
|
15
|
+
})
|
|
16
|
+
.superRefine((descriptor, ctx) => {
|
|
17
|
+
if (descriptor.requestSchema === undefined) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
for (const violation of validateInputSchema(descriptor.requestSchema)) {
|
|
21
|
+
ctx.addIssue({
|
|
22
|
+
code: 'custom',
|
|
23
|
+
path: ['requestSchema', violation.path],
|
|
24
|
+
message: `${violation.code}: ${violation.message}`,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
export const routeFamily = {
|
|
29
|
+
family: 'route',
|
|
30
|
+
versions: [ROUTE_SCHEMA_VERSION],
|
|
31
|
+
schema: (v) => {
|
|
32
|
+
if (v !== ROUTE_SCHEMA_VERSION) {
|
|
33
|
+
throw new Error(`route descriptor schema version ${v} is not supported`);
|
|
34
|
+
}
|
|
35
|
+
return RouteDescriptorSchema;
|
|
36
|
+
},
|
|
37
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { L10n } from '../manifest/l10n.ts';
|
|
3
|
+
export declare const SOURCE_KIND_SCHEMA_VERSION = 1;
|
|
4
|
+
export interface SourceKindDescriptor {
|
|
5
|
+
id: string;
|
|
6
|
+
title: L10n;
|
|
7
|
+
connection?: string;
|
|
8
|
+
supportsRootMount?: boolean;
|
|
9
|
+
supportsSearch?: boolean;
|
|
10
|
+
rootTitle?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const SourceKindDescriptorSchema: z.ZodObject<{
|
|
13
|
+
id: z.ZodString;
|
|
14
|
+
title: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
15
|
+
connection: z.ZodOptional<z.ZodString>;
|
|
16
|
+
supportsRootMount: z.ZodOptional<z.ZodBoolean>;
|
|
17
|
+
supportsSearch: z.ZodOptional<z.ZodBoolean>;
|
|
18
|
+
rootTitle: z.ZodOptional<z.ZodString>;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
export declare const sourceKindFamily: {
|
|
21
|
+
family: string;
|
|
22
|
+
versions: number[];
|
|
23
|
+
schema: (v: number) => z.ZodType;
|
|
24
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { L10nSchema } from "../manifest/l10n.js";
|
|
3
|
+
export const SOURCE_KIND_SCHEMA_VERSION = 1;
|
|
4
|
+
export const SourceKindDescriptorSchema = z.object({
|
|
5
|
+
id: z.string().min(1),
|
|
6
|
+
title: L10nSchema,
|
|
7
|
+
connection: z.string().min(1).optional(),
|
|
8
|
+
supportsRootMount: z.boolean().optional(),
|
|
9
|
+
supportsSearch: z.boolean().optional(),
|
|
10
|
+
rootTitle: z.string().min(1).optional(),
|
|
11
|
+
});
|
|
12
|
+
export const sourceKindFamily = {
|
|
13
|
+
family: 'source-kind',
|
|
14
|
+
versions: [SOURCE_KIND_SCHEMA_VERSION],
|
|
15
|
+
schema: (v) => {
|
|
16
|
+
if (v !== SOURCE_KIND_SCHEMA_VERSION) {
|
|
17
|
+
throw new Error(`source-kind descriptor schema version ${v} is not supported`);
|
|
18
|
+
}
|
|
19
|
+
return SourceKindDescriptorSchema;
|
|
20
|
+
},
|
|
21
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { L10n } from '../manifest/l10n.ts';
|
|
3
|
+
import type { FieldSpec } from './field-spec.ts';
|
|
4
|
+
import { type JsonSchemaSubset } from './json-schema.ts';
|
|
5
|
+
export declare const TOOL_PACK_SCHEMA_VERSION = 1;
|
|
6
|
+
export type ToolEffect = 'read' | 'write' | 'destructive';
|
|
7
|
+
export interface ToolDescriptor {
|
|
8
|
+
name: string;
|
|
9
|
+
description: L10n;
|
|
10
|
+
inputSchema: JsonSchemaSubset;
|
|
11
|
+
outputSchema?: JsonSchemaSubset;
|
|
12
|
+
effect: ToolEffect;
|
|
13
|
+
idempotent?: boolean;
|
|
14
|
+
timeoutSec?: number;
|
|
15
|
+
maxResultKb?: number;
|
|
16
|
+
}
|
|
17
|
+
export interface ToolPackDescriptor {
|
|
18
|
+
name: string;
|
|
19
|
+
title: L10n;
|
|
20
|
+
description: L10n;
|
|
21
|
+
icon?: string;
|
|
22
|
+
connection?: string;
|
|
23
|
+
specFields?: FieldSpec[];
|
|
24
|
+
skills?: string[];
|
|
25
|
+
tools: ToolDescriptor[];
|
|
26
|
+
}
|
|
27
|
+
export declare const ToolDescriptorSchema: z.ZodObject<{
|
|
28
|
+
name: z.ZodString;
|
|
29
|
+
description: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
30
|
+
inputSchema: z.ZodLazy<z.ZodType<JsonSchemaSubset, unknown, z.core.$ZodTypeInternals<JsonSchemaSubset, unknown>>>;
|
|
31
|
+
outputSchema: z.ZodOptional<z.ZodLazy<z.ZodType<JsonSchemaSubset, unknown, z.core.$ZodTypeInternals<JsonSchemaSubset, unknown>>>>;
|
|
32
|
+
effect: z.ZodEnum<{
|
|
33
|
+
read: "read";
|
|
34
|
+
write: "write";
|
|
35
|
+
destructive: "destructive";
|
|
36
|
+
}>;
|
|
37
|
+
idempotent: z.ZodOptional<z.ZodBoolean>;
|
|
38
|
+
timeoutSec: z.ZodOptional<z.ZodNumber>;
|
|
39
|
+
maxResultKb: z.ZodOptional<z.ZodNumber>;
|
|
40
|
+
}, z.core.$strip>;
|
|
41
|
+
export declare const ToolPackDescriptorSchema: z.ZodObject<{
|
|
42
|
+
name: z.ZodString;
|
|
43
|
+
title: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
44
|
+
description: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
45
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
46
|
+
connection: z.ZodOptional<z.ZodString>;
|
|
47
|
+
specFields: z.ZodOptional<z.ZodArray<z.ZodType<FieldSpec, unknown, z.core.$ZodTypeInternals<FieldSpec, unknown>>>>;
|
|
48
|
+
skills: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
49
|
+
tools: z.ZodArray<z.ZodObject<{
|
|
50
|
+
name: z.ZodString;
|
|
51
|
+
description: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
52
|
+
inputSchema: z.ZodLazy<z.ZodType<JsonSchemaSubset, unknown, z.core.$ZodTypeInternals<JsonSchemaSubset, unknown>>>;
|
|
53
|
+
outputSchema: z.ZodOptional<z.ZodLazy<z.ZodType<JsonSchemaSubset, unknown, z.core.$ZodTypeInternals<JsonSchemaSubset, unknown>>>>;
|
|
54
|
+
effect: z.ZodEnum<{
|
|
55
|
+
read: "read";
|
|
56
|
+
write: "write";
|
|
57
|
+
destructive: "destructive";
|
|
58
|
+
}>;
|
|
59
|
+
idempotent: z.ZodOptional<z.ZodBoolean>;
|
|
60
|
+
timeoutSec: z.ZodOptional<z.ZodNumber>;
|
|
61
|
+
maxResultKb: z.ZodOptional<z.ZodNumber>;
|
|
62
|
+
}, z.core.$strip>>;
|
|
63
|
+
}, z.core.$strip>;
|
|
64
|
+
export declare const toolPackFamily: {
|
|
65
|
+
family: string;
|
|
66
|
+
versions: number[];
|
|
67
|
+
schema: (v: number) => z.ZodType;
|
|
68
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { L10nSchema } from "../manifest/l10n.js";
|
|
3
|
+
import { FieldSpecSchema } from "./field-spec.js";
|
|
4
|
+
import { JsonSchemaSubsetSchema, validateInputSchema, } from "./json-schema.js";
|
|
5
|
+
export const TOOL_PACK_SCHEMA_VERSION = 1;
|
|
6
|
+
const inputSchemaIssues = (descriptor, ctx) => {
|
|
7
|
+
descriptor.tools.forEach((tool, index) => {
|
|
8
|
+
for (const violation of validateInputSchema(tool.inputSchema)) {
|
|
9
|
+
ctx.addIssue({
|
|
10
|
+
code: 'custom',
|
|
11
|
+
path: ['tools', index, 'inputSchema', violation.path],
|
|
12
|
+
message: `${violation.code}: ${violation.message}`,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
if (tool.outputSchema !== undefined) {
|
|
16
|
+
for (const violation of validateInputSchema(tool.outputSchema)) {
|
|
17
|
+
ctx.addIssue({
|
|
18
|
+
code: 'custom',
|
|
19
|
+
path: ['tools', index, 'outputSchema', violation.path],
|
|
20
|
+
message: `${violation.code}: ${violation.message}`,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
export const ToolDescriptorSchema = z.object({
|
|
27
|
+
name: z.string().min(1),
|
|
28
|
+
description: L10nSchema,
|
|
29
|
+
inputSchema: JsonSchemaSubsetSchema,
|
|
30
|
+
outputSchema: JsonSchemaSubsetSchema.optional(),
|
|
31
|
+
effect: z.enum(['read', 'write', 'destructive']),
|
|
32
|
+
idempotent: z.boolean().optional(),
|
|
33
|
+
timeoutSec: z.number().int().positive().optional(),
|
|
34
|
+
maxResultKb: z.number().int().positive().optional(),
|
|
35
|
+
});
|
|
36
|
+
export const ToolPackDescriptorSchema = z
|
|
37
|
+
.object({
|
|
38
|
+
name: z.string().min(1),
|
|
39
|
+
title: L10nSchema,
|
|
40
|
+
description: L10nSchema,
|
|
41
|
+
icon: z.string().optional(),
|
|
42
|
+
connection: z.string().min(1).optional(),
|
|
43
|
+
specFields: z.array(FieldSpecSchema).optional(),
|
|
44
|
+
skills: z.array(z.string().min(1)).optional(),
|
|
45
|
+
tools: z.array(ToolDescriptorSchema).min(1),
|
|
46
|
+
})
|
|
47
|
+
.superRefine(inputSchemaIssues);
|
|
48
|
+
export const toolPackFamily = {
|
|
49
|
+
family: 'tool-pack',
|
|
50
|
+
versions: [TOOL_PACK_SCHEMA_VERSION],
|
|
51
|
+
schema: (v) => {
|
|
52
|
+
if (v !== TOOL_PACK_SCHEMA_VERSION) {
|
|
53
|
+
throw new Error(`tool-pack descriptor schema version ${v} is not supported`);
|
|
54
|
+
}
|
|
55
|
+
return ToolPackDescriptorSchema;
|
|
56
|
+
},
|
|
57
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { L10n } from '../manifest/l10n.ts';
|
|
3
|
+
export declare const TRANSPORT_SCHEMA_VERSION = 1;
|
|
4
|
+
export interface TransportCapabilities {
|
|
5
|
+
threads: boolean;
|
|
6
|
+
edit: boolean;
|
|
7
|
+
typing: boolean;
|
|
8
|
+
attachments: boolean;
|
|
9
|
+
topics?: boolean;
|
|
10
|
+
reactions?: boolean;
|
|
11
|
+
readReceipts?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface TransportDescriptor {
|
|
14
|
+
provider: string;
|
|
15
|
+
title: L10n;
|
|
16
|
+
connection: string;
|
|
17
|
+
capabilities: TransportCapabilities;
|
|
18
|
+
limits: {
|
|
19
|
+
textMax: number;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export declare const TransportCapabilitiesSchema: z.ZodObject<{
|
|
23
|
+
threads: z.ZodBoolean;
|
|
24
|
+
edit: z.ZodBoolean;
|
|
25
|
+
typing: z.ZodBoolean;
|
|
26
|
+
attachments: z.ZodBoolean;
|
|
27
|
+
topics: z.ZodOptional<z.ZodBoolean>;
|
|
28
|
+
reactions: z.ZodOptional<z.ZodBoolean>;
|
|
29
|
+
readReceipts: z.ZodOptional<z.ZodBoolean>;
|
|
30
|
+
}, z.core.$strip>;
|
|
31
|
+
export declare const TransportDescriptorSchema: z.ZodObject<{
|
|
32
|
+
provider: z.ZodString;
|
|
33
|
+
title: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
34
|
+
connection: z.ZodString;
|
|
35
|
+
capabilities: z.ZodObject<{
|
|
36
|
+
threads: z.ZodBoolean;
|
|
37
|
+
edit: z.ZodBoolean;
|
|
38
|
+
typing: z.ZodBoolean;
|
|
39
|
+
attachments: z.ZodBoolean;
|
|
40
|
+
topics: z.ZodOptional<z.ZodBoolean>;
|
|
41
|
+
reactions: z.ZodOptional<z.ZodBoolean>;
|
|
42
|
+
readReceipts: z.ZodOptional<z.ZodBoolean>;
|
|
43
|
+
}, z.core.$strip>;
|
|
44
|
+
limits: z.ZodObject<{
|
|
45
|
+
textMax: z.ZodNumber;
|
|
46
|
+
}, z.core.$strip>;
|
|
47
|
+
}, z.core.$strip>;
|
|
48
|
+
export declare const transportFamily: {
|
|
49
|
+
family: string;
|
|
50
|
+
versions: number[];
|
|
51
|
+
schema: (v: number) => z.ZodType;
|
|
52
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { L10nSchema } from "../manifest/l10n.js";
|
|
3
|
+
export const TRANSPORT_SCHEMA_VERSION = 1;
|
|
4
|
+
export const TransportCapabilitiesSchema = z.object({
|
|
5
|
+
threads: z.boolean(),
|
|
6
|
+
edit: z.boolean(),
|
|
7
|
+
typing: z.boolean(),
|
|
8
|
+
attachments: z.boolean(),
|
|
9
|
+
topics: z.boolean().optional(),
|
|
10
|
+
reactions: z.boolean().optional(),
|
|
11
|
+
readReceipts: z.boolean().optional(),
|
|
12
|
+
});
|
|
13
|
+
export const TransportDescriptorSchema = z.object({
|
|
14
|
+
provider: z.string().min(1),
|
|
15
|
+
title: L10nSchema,
|
|
16
|
+
connection: z.string().min(1),
|
|
17
|
+
capabilities: TransportCapabilitiesSchema,
|
|
18
|
+
limits: z.object({ textMax: z.number().int().positive() }),
|
|
19
|
+
});
|
|
20
|
+
export const transportFamily = {
|
|
21
|
+
family: 'transport',
|
|
22
|
+
versions: [TRANSPORT_SCHEMA_VERSION],
|
|
23
|
+
schema: (v) => {
|
|
24
|
+
if (v !== TRANSPORT_SCHEMA_VERSION) {
|
|
25
|
+
throw new Error(`transport descriptor schema version ${v} is not supported`);
|
|
26
|
+
}
|
|
27
|
+
return TransportDescriptorSchema;
|
|
28
|
+
},
|
|
29
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { L10n } from '../manifest/l10n.ts';
|
|
3
|
+
import type { FieldSpec } from './field-spec.ts';
|
|
4
|
+
export declare const TRIGGER_SCHEMA_VERSION = 1;
|
|
5
|
+
export interface TriggerLimits {
|
|
6
|
+
perDay?: number;
|
|
7
|
+
throttleSec?: number;
|
|
8
|
+
maxBurst?: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Overrides for the standard trigger-form blocks the host renders for every
|
|
12
|
+
* trigger (name + agent, wake thread, run mode, instructions). Developers get
|
|
13
|
+
* them out of the box; each block can be relabeled or disabled.
|
|
14
|
+
*/
|
|
15
|
+
export interface StandardFieldOverride {
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
label?: string;
|
|
18
|
+
help?: string;
|
|
19
|
+
required?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface TriggerStandardBlocks {
|
|
22
|
+
name?: StandardFieldOverride;
|
|
23
|
+
agent?: StandardFieldOverride;
|
|
24
|
+
target?: StandardFieldOverride;
|
|
25
|
+
mode?: StandardFieldOverride;
|
|
26
|
+
instructions?: StandardFieldOverride;
|
|
27
|
+
}
|
|
28
|
+
export declare const StandardFieldOverrideSchema: z.ZodObject<{
|
|
29
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
30
|
+
label: z.ZodOptional<z.ZodString>;
|
|
31
|
+
help: z.ZodOptional<z.ZodString>;
|
|
32
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
33
|
+
}, z.core.$strip>;
|
|
34
|
+
export interface TriggerDescriptor {
|
|
35
|
+
kind: string;
|
|
36
|
+
title: L10n;
|
|
37
|
+
description: L10n;
|
|
38
|
+
/** Lucide icon name shown on trigger cards (picker, lists). */
|
|
39
|
+
icon?: string;
|
|
40
|
+
/** Brand color as `#RRGGBB`; falls back to the addon manifest color. */
|
|
41
|
+
color?: string;
|
|
42
|
+
configFields: FieldSpec[];
|
|
43
|
+
connection?: string;
|
|
44
|
+
limits?: TriggerLimits;
|
|
45
|
+
standard?: TriggerStandardBlocks;
|
|
46
|
+
}
|
|
47
|
+
export declare const TriggerDescriptorSchema: z.ZodObject<{
|
|
48
|
+
kind: z.ZodString;
|
|
49
|
+
title: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
50
|
+
description: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
51
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
52
|
+
color: z.ZodOptional<z.ZodString>;
|
|
53
|
+
configFields: z.ZodArray<z.ZodType<FieldSpec, unknown, z.core.$ZodTypeInternals<FieldSpec, unknown>>>;
|
|
54
|
+
connection: z.ZodOptional<z.ZodString>;
|
|
55
|
+
limits: z.ZodOptional<z.ZodObject<{
|
|
56
|
+
perDay: z.ZodOptional<z.ZodNumber>;
|
|
57
|
+
throttleSec: z.ZodOptional<z.ZodNumber>;
|
|
58
|
+
maxBurst: z.ZodOptional<z.ZodNumber>;
|
|
59
|
+
}, z.core.$strip>>;
|
|
60
|
+
standard: z.ZodOptional<z.ZodObject<{
|
|
61
|
+
name: z.ZodOptional<z.ZodObject<{
|
|
62
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
63
|
+
label: z.ZodOptional<z.ZodString>;
|
|
64
|
+
help: z.ZodOptional<z.ZodString>;
|
|
65
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
66
|
+
}, z.core.$strip>>;
|
|
67
|
+
agent: z.ZodOptional<z.ZodObject<{
|
|
68
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
69
|
+
label: z.ZodOptional<z.ZodString>;
|
|
70
|
+
help: z.ZodOptional<z.ZodString>;
|
|
71
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
72
|
+
}, z.core.$strip>>;
|
|
73
|
+
target: z.ZodOptional<z.ZodObject<{
|
|
74
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
75
|
+
label: z.ZodOptional<z.ZodString>;
|
|
76
|
+
help: z.ZodOptional<z.ZodString>;
|
|
77
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
78
|
+
}, z.core.$strip>>;
|
|
79
|
+
mode: z.ZodOptional<z.ZodObject<{
|
|
80
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
81
|
+
label: z.ZodOptional<z.ZodString>;
|
|
82
|
+
help: z.ZodOptional<z.ZodString>;
|
|
83
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
84
|
+
}, z.core.$strip>>;
|
|
85
|
+
instructions: z.ZodOptional<z.ZodObject<{
|
|
86
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
87
|
+
label: z.ZodOptional<z.ZodString>;
|
|
88
|
+
help: z.ZodOptional<z.ZodString>;
|
|
89
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
90
|
+
}, z.core.$strip>>;
|
|
91
|
+
}, z.core.$strip>>;
|
|
92
|
+
}, z.core.$strip>;
|
|
93
|
+
export declare const triggerFamily: {
|
|
94
|
+
family: string;
|
|
95
|
+
versions: number[];
|
|
96
|
+
schema: (v: number) => z.ZodType;
|
|
97
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { HexColorSchema, LucideIconNameSchema } from "../manifest/branding.js";
|
|
3
|
+
import { L10nSchema } from "../manifest/l10n.js";
|
|
4
|
+
import { FieldSpecSchema } from "./field-spec.js";
|
|
5
|
+
export const TRIGGER_SCHEMA_VERSION = 1;
|
|
6
|
+
export const StandardFieldOverrideSchema = z.object({
|
|
7
|
+
disabled: z.boolean().optional(),
|
|
8
|
+
label: z.string().optional(),
|
|
9
|
+
help: z.string().optional(),
|
|
10
|
+
required: z.boolean().optional(),
|
|
11
|
+
});
|
|
12
|
+
export const TriggerDescriptorSchema = z.object({
|
|
13
|
+
kind: z.string().min(1),
|
|
14
|
+
title: L10nSchema,
|
|
15
|
+
description: L10nSchema,
|
|
16
|
+
icon: LucideIconNameSchema.optional(),
|
|
17
|
+
color: HexColorSchema.optional(),
|
|
18
|
+
configFields: z.array(FieldSpecSchema),
|
|
19
|
+
connection: z.string().min(1).optional(),
|
|
20
|
+
limits: z
|
|
21
|
+
.object({
|
|
22
|
+
perDay: z.number().int().positive().optional(),
|
|
23
|
+
throttleSec: z.number().int().nonnegative().optional(),
|
|
24
|
+
maxBurst: z.number().int().positive().optional(),
|
|
25
|
+
})
|
|
26
|
+
.optional(),
|
|
27
|
+
standard: z
|
|
28
|
+
.object({
|
|
29
|
+
name: StandardFieldOverrideSchema.optional(),
|
|
30
|
+
agent: StandardFieldOverrideSchema.optional(),
|
|
31
|
+
target: StandardFieldOverrideSchema.optional(),
|
|
32
|
+
mode: StandardFieldOverrideSchema.optional(),
|
|
33
|
+
instructions: StandardFieldOverrideSchema.optional(),
|
|
34
|
+
})
|
|
35
|
+
.optional(),
|
|
36
|
+
});
|
|
37
|
+
export const triggerFamily = {
|
|
38
|
+
family: 'trigger',
|
|
39
|
+
versions: [TRIGGER_SCHEMA_VERSION],
|
|
40
|
+
schema: (v) => {
|
|
41
|
+
if (v !== TRIGGER_SCHEMA_VERSION) {
|
|
42
|
+
throw new Error(`trigger descriptor schema version ${v} is not supported`);
|
|
43
|
+
}
|
|
44
|
+
return TriggerDescriptorSchema;
|
|
45
|
+
},
|
|
46
|
+
};
|