@harnesys/sdk 0.0.0-stage → 1.1.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-value.d.ts +12 -0
- package/dist/families/json-schema-value.js +243 -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 +36 -0
- package/dist/index.js +36 -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 +217 -0
- package/dist/testing/fake-services.d.ts +63 -0
- package/dist/testing/fake-services.js +277 -0
- package/dist/testing/fixtures.d.ts +5 -0
- package/dist/testing/fixtures.js +101 -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-value.ts +322 -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 +345 -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 +350 -0
- package/src/testing/fake-services.ts +345 -0
- package/src/testing/fixtures.ts +106 -0
- package/src/testing/index.ts +12 -0
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,255 @@
|
|
|
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 VIEW_SCHEMA_VERSION = 1;
|
|
5
|
+
export interface RouteRef {
|
|
6
|
+
route: string;
|
|
7
|
+
params?: Record<string, string>;
|
|
8
|
+
}
|
|
9
|
+
export interface Column {
|
|
10
|
+
key: string;
|
|
11
|
+
label: L10n;
|
|
12
|
+
format: 'text' | 'datetime' | 'number' | 'badge' | 'link' | 'copy';
|
|
13
|
+
}
|
|
14
|
+
export interface Action {
|
|
15
|
+
id: string;
|
|
16
|
+
label: L10n;
|
|
17
|
+
route: RouteRef;
|
|
18
|
+
confirm?: L10n;
|
|
19
|
+
destructive?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export type ViewSection = {
|
|
22
|
+
type: 'status';
|
|
23
|
+
} | {
|
|
24
|
+
type: 'capabilities';
|
|
25
|
+
} | {
|
|
26
|
+
type: 'permissions';
|
|
27
|
+
} | {
|
|
28
|
+
type: 'config';
|
|
29
|
+
fields?: string[];
|
|
30
|
+
} | {
|
|
31
|
+
type: 'connections';
|
|
32
|
+
connections?: string[];
|
|
33
|
+
} | {
|
|
34
|
+
type: 'automations';
|
|
35
|
+
triggers?: string[];
|
|
36
|
+
} | {
|
|
37
|
+
type: 'jobs';
|
|
38
|
+
} | {
|
|
39
|
+
type: 'table';
|
|
40
|
+
title: L10n;
|
|
41
|
+
source: RouteRef;
|
|
42
|
+
columns: Column[];
|
|
43
|
+
rowActions?: Action[];
|
|
44
|
+
pageSize?: number;
|
|
45
|
+
} | {
|
|
46
|
+
type: 'form';
|
|
47
|
+
title: L10n;
|
|
48
|
+
fields: FieldSpec[];
|
|
49
|
+
submit: RouteRef;
|
|
50
|
+
confirm?: L10n;
|
|
51
|
+
} | {
|
|
52
|
+
type: 'actions';
|
|
53
|
+
actions: Action[];
|
|
54
|
+
} | {
|
|
55
|
+
type: 'markdown';
|
|
56
|
+
body: L10n;
|
|
57
|
+
} | {
|
|
58
|
+
type: 'frame';
|
|
59
|
+
route: string;
|
|
60
|
+
height?: number;
|
|
61
|
+
};
|
|
62
|
+
export interface ViewDescriptor {
|
|
63
|
+
id: string;
|
|
64
|
+
title: L10n;
|
|
65
|
+
icon?: string;
|
|
66
|
+
sections: ViewSection[];
|
|
67
|
+
}
|
|
68
|
+
export declare const RouteRefSchema: z.ZodObject<{
|
|
69
|
+
route: z.ZodString;
|
|
70
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
71
|
+
}, z.core.$strip>;
|
|
72
|
+
export declare const ColumnSchema: z.ZodObject<{
|
|
73
|
+
key: z.ZodString;
|
|
74
|
+
label: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
75
|
+
format: z.ZodEnum<{
|
|
76
|
+
number: "number";
|
|
77
|
+
text: "text";
|
|
78
|
+
link: "link";
|
|
79
|
+
datetime: "datetime";
|
|
80
|
+
badge: "badge";
|
|
81
|
+
copy: "copy";
|
|
82
|
+
}>;
|
|
83
|
+
}, z.core.$strip>;
|
|
84
|
+
export declare const ActionSchema: z.ZodObject<{
|
|
85
|
+
id: z.ZodString;
|
|
86
|
+
label: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
87
|
+
route: z.ZodObject<{
|
|
88
|
+
route: z.ZodString;
|
|
89
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
90
|
+
}, z.core.$strip>;
|
|
91
|
+
confirm: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
|
|
92
|
+
destructive: z.ZodOptional<z.ZodBoolean>;
|
|
93
|
+
}, z.core.$strip>;
|
|
94
|
+
export declare const ViewSectionSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
95
|
+
type: z.ZodLiteral<"status">;
|
|
96
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
97
|
+
type: z.ZodLiteral<"capabilities">;
|
|
98
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
99
|
+
type: z.ZodLiteral<"permissions">;
|
|
100
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
101
|
+
type: z.ZodLiteral<"config">;
|
|
102
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
103
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
104
|
+
type: z.ZodLiteral<"connections">;
|
|
105
|
+
connections: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
106
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
107
|
+
type: z.ZodLiteral<"automations">;
|
|
108
|
+
triggers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
109
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
110
|
+
type: z.ZodLiteral<"jobs">;
|
|
111
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
112
|
+
type: z.ZodLiteral<"table">;
|
|
113
|
+
title: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
114
|
+
source: z.ZodObject<{
|
|
115
|
+
route: z.ZodString;
|
|
116
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
117
|
+
}, z.core.$strip>;
|
|
118
|
+
columns: z.ZodArray<z.ZodObject<{
|
|
119
|
+
key: z.ZodString;
|
|
120
|
+
label: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
121
|
+
format: z.ZodEnum<{
|
|
122
|
+
number: "number";
|
|
123
|
+
text: "text";
|
|
124
|
+
link: "link";
|
|
125
|
+
datetime: "datetime";
|
|
126
|
+
badge: "badge";
|
|
127
|
+
copy: "copy";
|
|
128
|
+
}>;
|
|
129
|
+
}, z.core.$strip>>;
|
|
130
|
+
rowActions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
131
|
+
id: z.ZodString;
|
|
132
|
+
label: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
133
|
+
route: z.ZodObject<{
|
|
134
|
+
route: z.ZodString;
|
|
135
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
136
|
+
}, z.core.$strip>;
|
|
137
|
+
confirm: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
|
|
138
|
+
destructive: z.ZodOptional<z.ZodBoolean>;
|
|
139
|
+
}, z.core.$strip>>>;
|
|
140
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
141
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
142
|
+
type: z.ZodLiteral<"form">;
|
|
143
|
+
title: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
144
|
+
fields: z.ZodArray<z.ZodType<FieldSpec, unknown, z.core.$ZodTypeInternals<FieldSpec, unknown>>>;
|
|
145
|
+
submit: z.ZodObject<{
|
|
146
|
+
route: z.ZodString;
|
|
147
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
148
|
+
}, z.core.$strip>;
|
|
149
|
+
confirm: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
|
|
150
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
151
|
+
type: z.ZodLiteral<"actions">;
|
|
152
|
+
actions: z.ZodArray<z.ZodObject<{
|
|
153
|
+
id: z.ZodString;
|
|
154
|
+
label: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
155
|
+
route: z.ZodObject<{
|
|
156
|
+
route: z.ZodString;
|
|
157
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
158
|
+
}, z.core.$strip>;
|
|
159
|
+
confirm: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
|
|
160
|
+
destructive: z.ZodOptional<z.ZodBoolean>;
|
|
161
|
+
}, z.core.$strip>>;
|
|
162
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
163
|
+
type: z.ZodLiteral<"markdown">;
|
|
164
|
+
body: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
165
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
166
|
+
type: z.ZodLiteral<"frame">;
|
|
167
|
+
route: z.ZodString;
|
|
168
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
169
|
+
}, z.core.$strip>]>;
|
|
170
|
+
export declare const ViewDescriptorSchema: z.ZodObject<{
|
|
171
|
+
id: z.ZodString;
|
|
172
|
+
title: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
173
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
174
|
+
sections: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
175
|
+
type: z.ZodLiteral<"status">;
|
|
176
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
177
|
+
type: z.ZodLiteral<"capabilities">;
|
|
178
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
179
|
+
type: z.ZodLiteral<"permissions">;
|
|
180
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
181
|
+
type: z.ZodLiteral<"config">;
|
|
182
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
183
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
184
|
+
type: z.ZodLiteral<"connections">;
|
|
185
|
+
connections: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
186
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
187
|
+
type: z.ZodLiteral<"automations">;
|
|
188
|
+
triggers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
189
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
190
|
+
type: z.ZodLiteral<"jobs">;
|
|
191
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
192
|
+
type: z.ZodLiteral<"table">;
|
|
193
|
+
title: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
194
|
+
source: z.ZodObject<{
|
|
195
|
+
route: z.ZodString;
|
|
196
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
197
|
+
}, z.core.$strip>;
|
|
198
|
+
columns: z.ZodArray<z.ZodObject<{
|
|
199
|
+
key: z.ZodString;
|
|
200
|
+
label: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
201
|
+
format: z.ZodEnum<{
|
|
202
|
+
number: "number";
|
|
203
|
+
text: "text";
|
|
204
|
+
link: "link";
|
|
205
|
+
datetime: "datetime";
|
|
206
|
+
badge: "badge";
|
|
207
|
+
copy: "copy";
|
|
208
|
+
}>;
|
|
209
|
+
}, z.core.$strip>>;
|
|
210
|
+
rowActions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
211
|
+
id: z.ZodString;
|
|
212
|
+
label: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
213
|
+
route: z.ZodObject<{
|
|
214
|
+
route: z.ZodString;
|
|
215
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
216
|
+
}, z.core.$strip>;
|
|
217
|
+
confirm: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
|
|
218
|
+
destructive: z.ZodOptional<z.ZodBoolean>;
|
|
219
|
+
}, z.core.$strip>>>;
|
|
220
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
221
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
222
|
+
type: z.ZodLiteral<"form">;
|
|
223
|
+
title: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
224
|
+
fields: z.ZodArray<z.ZodType<FieldSpec, unknown, z.core.$ZodTypeInternals<FieldSpec, unknown>>>;
|
|
225
|
+
submit: z.ZodObject<{
|
|
226
|
+
route: z.ZodString;
|
|
227
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
228
|
+
}, z.core.$strip>;
|
|
229
|
+
confirm: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
|
|
230
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
231
|
+
type: z.ZodLiteral<"actions">;
|
|
232
|
+
actions: z.ZodArray<z.ZodObject<{
|
|
233
|
+
id: z.ZodString;
|
|
234
|
+
label: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
235
|
+
route: z.ZodObject<{
|
|
236
|
+
route: z.ZodString;
|
|
237
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
238
|
+
}, z.core.$strip>;
|
|
239
|
+
confirm: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
|
|
240
|
+
destructive: z.ZodOptional<z.ZodBoolean>;
|
|
241
|
+
}, z.core.$strip>>;
|
|
242
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
243
|
+
type: z.ZodLiteral<"markdown">;
|
|
244
|
+
body: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
245
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
246
|
+
type: z.ZodLiteral<"frame">;
|
|
247
|
+
route: z.ZodString;
|
|
248
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
249
|
+
}, z.core.$strip>]>>;
|
|
250
|
+
}, z.core.$strip>;
|
|
251
|
+
export declare const viewFamily: {
|
|
252
|
+
family: string;
|
|
253
|
+
versions: number[];
|
|
254
|
+
schema: (v: number) => z.ZodType;
|
|
255
|
+
};
|