@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.
Files changed (147) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +80 -2
  3. package/dist/addon-context-factory.d.ts +6 -0
  4. package/dist/addon-context-factory.js +160 -0
  5. package/dist/addon-context.d.ts +346 -0
  6. package/dist/addon-context.js +0 -0
  7. package/dist/define-addon.d.ts +57 -0
  8. package/dist/define-addon.js +53 -0
  9. package/dist/families/config.d.ts +14 -0
  10. package/dist/families/config.js +16 -0
  11. package/dist/families/content.d.ts +28 -0
  12. package/dist/families/content.js +19 -0
  13. package/dist/families/field-spec.d.ts +100 -0
  14. package/dist/families/field-spec.js +85 -0
  15. package/dist/families/hook.d.ts +37 -0
  16. package/dist/families/hook.js +25 -0
  17. package/dist/families/job.d.ts +45 -0
  18. package/dist/families/job.js +26 -0
  19. package/dist/families/json-schema-value.d.ts +12 -0
  20. package/dist/families/json-schema-value.js +243 -0
  21. package/dist/families/json-schema.d.ts +36 -0
  22. package/dist/families/json-schema.js +101 -0
  23. package/dist/families/lsp.d.ts +18 -0
  24. package/dist/families/lsp.js +18 -0
  25. package/dist/families/mcp.d.ts +18 -0
  26. package/dist/families/mcp.js +18 -0
  27. package/dist/families/registry.d.ts +9 -0
  28. package/dist/families/registry.js +34 -0
  29. package/dist/families/route.d.ts +38 -0
  30. package/dist/families/route.js +37 -0
  31. package/dist/families/source-kind.d.ts +24 -0
  32. package/dist/families/source-kind.js +21 -0
  33. package/dist/families/tool-pack.d.ts +68 -0
  34. package/dist/families/tool-pack.js +57 -0
  35. package/dist/families/transport.d.ts +52 -0
  36. package/dist/families/transport.js +29 -0
  37. package/dist/families/trigger.d.ts +97 -0
  38. package/dist/families/trigger.js +46 -0
  39. package/dist/families/view.d.ts +255 -0
  40. package/dist/families/view.js +87 -0
  41. package/dist/families/viewer.d.ts +31 -0
  42. package/dist/families/viewer.js +26 -0
  43. package/dist/families/worker.d.ts +23 -0
  44. package/dist/families/worker.js +19 -0
  45. package/dist/host-client.d.ts +11 -0
  46. package/dist/host-client.js +30 -0
  47. package/dist/index.d.ts +36 -0
  48. package/dist/index.js +36 -0
  49. package/dist/manifest/branding.d.ts +14 -0
  50. package/dist/manifest/branding.js +18 -0
  51. package/dist/manifest/connections.d.ts +21 -0
  52. package/dist/manifest/connections.js +10 -0
  53. package/dist/manifest/json-schema.d.ts +2 -0
  54. package/dist/manifest/json-schema.js +13 -0
  55. package/dist/manifest/l10n.d.ts +9 -0
  56. package/dist/manifest/l10n.js +28 -0
  57. package/dist/manifest/manifest.d.ts +112 -0
  58. package/dist/manifest/manifest.js +45 -0
  59. package/dist/manifest/validate.d.ts +14 -0
  60. package/dist/manifest/validate.js +144 -0
  61. package/dist/permissions/permissions.d.ts +31 -0
  62. package/dist/permissions/permissions.js +53 -0
  63. package/dist/process-entry.d.ts +26 -0
  64. package/dist/process-entry.js +146 -0
  65. package/dist/protocol/envelope.d.ts +115 -0
  66. package/dist/protocol/envelope.js +72 -0
  67. package/dist/protocol/error.d.ts +67 -0
  68. package/dist/protocol/error.js +61 -0
  69. package/dist/protocol/handshake.d.ts +55 -0
  70. package/dist/protocol/handshake.js +26 -0
  71. package/dist/protocol/map.d.ts +1090 -0
  72. package/dist/protocol/map.js +127 -0
  73. package/dist/protocol/meta.d.ts +31 -0
  74. package/dist/protocol/meta.js +14 -0
  75. package/dist/protocol/method-spec.d.ts +13 -0
  76. package/dist/protocol/method-spec.js +9 -0
  77. package/dist/protocol/org-service-methods.d.ts +135 -0
  78. package/dist/protocol/org-service-methods.js +106 -0
  79. package/dist/protocol/shared.d.ts +389 -0
  80. package/dist/protocol/shared.js +231 -0
  81. package/dist/protocol/source-methods.d.ts +218 -0
  82. package/dist/protocol/source-methods.js +18 -0
  83. package/dist/protocol/thread-service-methods.d.ts +50 -0
  84. package/dist/protocol/thread-service-methods.js +32 -0
  85. package/dist/runtime.d.ts +25 -0
  86. package/dist/runtime.js +229 -0
  87. package/dist/testing/fake-db.d.ts +15 -0
  88. package/dist/testing/fake-db.js +120 -0
  89. package/dist/testing/fake-files.d.ts +9 -0
  90. package/dist/testing/fake-files.js +87 -0
  91. package/dist/testing/fake-host.d.ts +115 -0
  92. package/dist/testing/fake-host.js +217 -0
  93. package/dist/testing/fake-services.d.ts +63 -0
  94. package/dist/testing/fake-services.js +277 -0
  95. package/dist/testing/fixtures.d.ts +5 -0
  96. package/dist/testing/fixtures.js +101 -0
  97. package/dist/testing/index.d.ts +4 -0
  98. package/dist/testing/index.js +2 -0
  99. package/package.json +66 -4
  100. package/src/addon-context-factory.ts +236 -0
  101. package/src/addon-context.ts +313 -0
  102. package/src/define-addon.ts +178 -0
  103. package/src/families/config.ts +24 -0
  104. package/src/families/content.ts +35 -0
  105. package/src/families/field-spec.ts +175 -0
  106. package/src/families/hook.ts +34 -0
  107. package/src/families/job.ts +41 -0
  108. package/src/families/json-schema-value.ts +322 -0
  109. package/src/families/json-schema.ts +167 -0
  110. package/src/families/lsp.ts +28 -0
  111. package/src/families/mcp.ts +28 -0
  112. package/src/families/registry.ts +44 -0
  113. package/src/families/route.ts +52 -0
  114. package/src/families/source-kind.ts +34 -0
  115. package/src/families/tool-pack.ts +92 -0
  116. package/src/families/transport.ts +52 -0
  117. package/src/families/trigger.ts +92 -0
  118. package/src/families/view.ts +144 -0
  119. package/src/families/viewer.ts +43 -0
  120. package/src/families/worker.ts +30 -0
  121. package/src/host-client.ts +52 -0
  122. package/src/index.ts +345 -0
  123. package/src/manifest/branding.ts +24 -0
  124. package/src/manifest/connections.ts +21 -0
  125. package/src/manifest/json-schema.ts +24 -0
  126. package/src/manifest/l10n.ts +39 -0
  127. package/src/manifest/manifest.ts +94 -0
  128. package/src/manifest/validate.ts +200 -0
  129. package/src/permissions/permissions.ts +79 -0
  130. package/src/process-entry.ts +205 -0
  131. package/src/protocol/envelope.ts +126 -0
  132. package/src/protocol/error.ts +81 -0
  133. package/src/protocol/handshake.ts +43 -0
  134. package/src/protocol/map.ts +339 -0
  135. package/src/protocol/meta.ts +26 -0
  136. package/src/protocol/method-spec.ts +40 -0
  137. package/src/protocol/org-service-methods.ts +148 -0
  138. package/src/protocol/shared.ts +345 -0
  139. package/src/protocol/source-methods.ts +61 -0
  140. package/src/protocol/thread-service-methods.ts +50 -0
  141. package/src/runtime.ts +332 -0
  142. package/src/testing/fake-db.ts +140 -0
  143. package/src/testing/fake-files.ts +114 -0
  144. package/src/testing/fake-host.ts +350 -0
  145. package/src/testing/fake-services.ts +345 -0
  146. package/src/testing/fixtures.ts +106 -0
  147. 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
+ };