@eigenpal/automations 0.0.0-stage → 0.20.49

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/CHANGELOG.md ADDED
@@ -0,0 +1,21 @@
1
+ # @eigenpal/automations
2
+
3
+ ## 0.20.49
4
+
5
+ ### Patch Changes
6
+
7
+ - 430b899: Agent definitions preserve explicitly unconstrained JSON schemas (`{}`), allowing existing agents to move to TypeScript without adding validation constraints.
8
+
9
+ ## 0.20.48
10
+
11
+ ### Minor Changes
12
+
13
+ - c14d0ad: The open-source TypeScript authoring SDK provides `createAgent`, typed input/output schemas, and a compiler for agent configuration. Existing agents continue running unchanged; TypeScript source integration follows separately.
14
+
15
+ ### Patch Changes
16
+
17
+ - c236909: Preserve special JSON Schema keys during compilation without changing schema data.
18
+
19
+ ## Unreleased
20
+
21
+ - Define agents in TypeScript and compile their configuration and schemas into portable JSON.
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for describing the origin of the Work and
141
+ reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may accept and charge a
167
+ fee for, or grant any of the foregoing rights, accept support,
168
+ warranty, indemnity, or other liability obligations and/or rights
169
+ consistent with this License. However, in accepting such obligations,
170
+ You may act only on Your own behalf and on Your sole responsibility,
171
+ not on behalf of any other Contributor, and only if You agree to
172
+ indemnify, defend, and hold each Contributor harmless for any
173
+ liability incurred by, or claims asserted against, such Contributor
174
+ by reason of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Eigenpal
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,95 @@
1
- # Temporary Holding Version
1
+ # EigenPal automation authoring
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Open-source TypeScript authoring SDK for EigenPal agents. This package defines
4
+ configuration; it does not itself change agent discovery, releases, or execution.
5
+ Worker authoring will extend the same package in a later release.
6
+
7
+ ```sh
8
+ npm install @eigenpal/automations zod
9
+ ```
10
+
11
+ Source: [eigenpal/automations](https://github.com/eigenpal/automations).
12
+ Requires Node.js 22 or later to run the compiled ESM package.
13
+
14
+ ```ts
15
+ import { createAgent, type InferInput } from '@eigenpal/automations';
16
+ import { z } from 'zod';
17
+
18
+ export const invoice = createAgent({
19
+ name: 'Invoice assistant',
20
+ model: 'organization-model',
21
+ inputSchema: z.object({ text: z.string() }),
22
+ outputSchema: z.strictObject({ supplier: z.string(), total: z.number() }),
23
+ });
24
+
25
+ export type InvoiceInput = InferInput<typeof invoice>;
26
+ export default invoice;
27
+ ```
28
+
29
+ `AGENT.md`, skills, rules, knowledge, and templates remain ordinary package files.
30
+ The existing folder path determines agent identity; `name` is a display name.
31
+ Configuration includes existing API/email triggers, exact-version workspace
32
+ dependencies, and evaluator composition. There are no workflow or worker APIs,
33
+ tool callbacks, model execution, secret values, or administrative operations.
34
+
35
+ ## Compilation boundary
36
+
37
+ ```ts
38
+ import { compileAgent } from '@eigenpal/automations/compiler';
39
+ import invoice from './agent.js';
40
+
41
+ const compiled = compileAgent(invoice);
42
+ // { schemaVersion: 1, kind: 'agent', manifest, inputSchema?, outputSchema? }
43
+ ```
44
+
45
+ The compiler accepts an already loaded definition and returns JSON data. It does
46
+ not read files, load TypeScript, write generated files, publish, or run agents.
47
+ The manifest retains today's schema version and fields. The platform's existing
48
+ manifest/schema validation still applies at release and execution boundaries.
49
+ Full JSON Schema meta-validation is not performed by this package.
50
+
51
+ Schemas may be Zod 4 schemas or raw JSON Schema objects. Raw schemas preserve
52
+ existing `input-schema.json` and `output-schema.json` contracts, including file
53
+ extensions, references, defaults, and annotations, for migration. Their inferred
54
+ TypeScript value type is `unknown`. Schema roots must have `type: 'object'`, or be exactly `{}` to explicitly
55
+ declare no constraints.
56
+ Absent schemas remain absent. Raw schemas must contain only JSON values.
57
+
58
+ Zod is an authoring convenience for JSON Schema validation, not a runtime parser.
59
+ Compilation rejects transforms, coercion, defaults, catches, custom refinements,
60
+ and overwrites such as `.trim()`, including inside nested schemas. JSON Schema
61
+ cannot execute that parsing logic. Use representable constraints or raw JSON
62
+ Schema. Normal Zod objects compile in input mode; use `z.strictObject()` when
63
+ additional properties should be rejected. Standard JSON Schema annotations such
64
+ as defaults are preserved as data and do not promise Zod parsing behavior.
65
+
66
+ Omitted configuration stays omitted. In particular, an absent email sender
67
+ allowlist is different from `allowlist: []`. Defaults continue to be applied by
68
+ the existing platform contract. The returned definition envelope is frozen;
69
+ compilation revalidates its configuration.
70
+
71
+ The versioned `CompiledDefinition<K>` envelope separates source syntax from
72
+ runtime data. A later worker definition can share that envelope and schema
73
+ types without changing agent configuration or adding a worker engine here.
74
+
75
+ Existing agents will be converted by a coordinated platform migration. Agent
76
+ source conversion is internal migration tooling, not part of this authoring API.
77
+
78
+ ## Development
79
+
80
+ ```sh
81
+ bun install
82
+ bun test
83
+ bun run typecheck
84
+ bun run verify-pack
85
+ ```
86
+
87
+ `verify-pack` builds and packs the real package, extracts it into a temporary
88
+ consumer, and verifies Node ESM imports and public TypeScript declarations.
89
+ It reuses installed Zod without registry access. The tarball contains compiled
90
+ JavaScript/declarations, the README and license, with no private platform imports.
91
+
92
+ The public repository is a release source mirror, maintained under Apache-2.0.
93
+ Release tags use the platform release version. The platform release workflow
94
+ publishes to npm with GitHub Actions OIDC, then mirrors the published source here.
95
+ Please report SDK issues in the public repository.
@@ -0,0 +1,3 @@
1
+ import type { AgentDefinition, CompiledAgent } from './definition.js';
2
+ /** Accepts an already loaded definition. Loading/executing tenant TS is a separate boundary. */
3
+ export declare function compileAgent(definition: AgentDefinition): CompiledAgent;
@@ -0,0 +1,56 @@
1
+ import { z } from 'zod';
2
+ import { agentConfigSchema } from './config.js';
3
+ import { copyJsonSchema } from './json-schema.js';
4
+ const portableChecks = new Set([
5
+ 'less_than',
6
+ 'greater_than',
7
+ 'multiple_of',
8
+ 'number_format',
9
+ 'max_length',
10
+ 'min_length',
11
+ 'length_equals',
12
+ 'string_format',
13
+ ]);
14
+ function compileSchema(schema, field) {
15
+ try {
16
+ const json = schema instanceof z.ZodType
17
+ ? z.toJSONSchema(schema, {
18
+ target: 'draft-7',
19
+ io: 'input',
20
+ unrepresentable: 'throw',
21
+ override: ({ zodSchema }) => {
22
+ const def = zodSchema._zod.def;
23
+ // JSON Schema validates data; it cannot execute parsing/defaulting logic.
24
+ if (['default', 'prefault', 'catch', 'pipe', 'transform'].includes(def.type) ||
25
+ ('coerce' in def && def.coerce) ||
26
+ def.checks?.some((check) => !portableChecks.has(check._zod.def.check))) {
27
+ throw new Error('Parsing effects and custom refinements are not portable; use JSON Schema constraints');
28
+ }
29
+ },
30
+ })
31
+ : schema;
32
+ const parsed = copyJsonSchema(json);
33
+ if (Object.keys(parsed).length !== 0 && parsed.type !== 'object')
34
+ throw new Error('Root schema type must be object');
35
+ return parsed;
36
+ }
37
+ catch (error) {
38
+ throw new Error(`${field}: ${error instanceof Error ? error.message : String(error)}`);
39
+ }
40
+ }
41
+ /** Accepts an already loaded definition. Loading/executing tenant TS is a separate boundary. */
42
+ export function compileAgent(definition) {
43
+ if (definition.kind !== 'agent')
44
+ throw new Error('compileAgent expects an agent definition');
45
+ return {
46
+ schemaVersion: 1,
47
+ kind: 'agent',
48
+ manifest: { schemaVersion: 1, ...agentConfigSchema.parse(definition.config) },
49
+ ...(definition.inputSchema === undefined
50
+ ? {}
51
+ : { inputSchema: compileSchema(definition.inputSchema, 'inputSchema') }),
52
+ ...(definition.outputSchema === undefined
53
+ ? {}
54
+ : { outputSchema: compileSchema(definition.outputSchema, 'outputSchema') }),
55
+ };
56
+ }
@@ -0,0 +1,28 @@
1
+ import { z } from 'zod';
2
+ export declare const agentConfigSchema: z.ZodObject<{
3
+ name: z.ZodString;
4
+ description: z.ZodOptional<z.ZodString>;
5
+ model: z.ZodOptional<z.ZodString>;
6
+ triggers: z.ZodOptional<z.ZodObject<{
7
+ api: z.ZodOptional<z.ZodBoolean>;
8
+ email: z.ZodOptional<z.ZodObject<{
9
+ enabled: z.ZodOptional<z.ZodBoolean>;
10
+ aliases: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
11
+ address: z.ZodString;
12
+ allowlist: z.ZodOptional<z.ZodArray<z.ZodString>>;
13
+ replyConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
14
+ requireSenderAuth: z.ZodOptional<z.ZodBoolean>;
15
+ enabled: z.ZodOptional<z.ZodBoolean>;
16
+ }, z.core.$strict>]>>>;
17
+ }, z.core.$strict>>;
18
+ }, z.core.$strict>>;
19
+ dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
20
+ evaluators: z.ZodOptional<z.ZodObject<{
21
+ passThreshold: z.ZodOptional<z.ZodNumber>;
22
+ items: z.ZodOptional<z.ZodArray<z.ZodObject<{
23
+ use: z.ZodString;
24
+ weight: z.ZodOptional<z.ZodNumber>;
25
+ version: z.ZodOptional<z.ZodString>;
26
+ }, z.core.$strict>>>;
27
+ }, z.core.$strict>>;
28
+ }, z.core.$strict>;
package/dist/config.js ADDED
@@ -0,0 +1,68 @@
1
+ import { z } from 'zod';
2
+ const segment = '[a-z0-9][a-z0-9_-]*';
3
+ const exactVersion = z.string().regex(/^[0-9]+\.[0-9]+\.[0-9]+$/);
4
+ const dependencyName = z
5
+ .string()
6
+ .regex(new RegExp(`^workspace:(agents|resources)\\.${segment}(\\.${segment})*$`));
7
+ const evaluatorName = z
8
+ .string()
9
+ .refine((value) => (value.startsWith('./evaluators/') &&
10
+ value.endsWith('.yaml') &&
11
+ !value.includes('..') &&
12
+ !value.includes('\\')) ||
13
+ new RegExp(`^workspace:evaluators\\.${segment}(\\.${segment})*$`).test(value), 'Use ./evaluators/<file>.yaml or workspace:evaluators.<name>');
14
+ const evaluatorItem = z
15
+ .strictObject({
16
+ use: evaluatorName,
17
+ weight: z.number().min(0).optional(),
18
+ version: exactVersion.optional(),
19
+ })
20
+ .superRefine((item, context) => {
21
+ if (item.use.startsWith('workspace:') && !item.version)
22
+ context.addIssue({
23
+ code: 'custom',
24
+ path: ['version'],
25
+ message: 'Shared evaluators require an exact version',
26
+ });
27
+ if (item.use.startsWith('./') && item.version !== undefined)
28
+ context.addIssue({
29
+ code: 'custom',
30
+ path: ['version'],
31
+ message: 'Local evaluators do not take a version',
32
+ });
33
+ });
34
+ // Deliberately no defaults: preserve omitted fields for the existing platform parser.
35
+ export const agentConfigSchema = z.strictObject({
36
+ name: z.string().min(1),
37
+ description: z.string().optional(),
38
+ model: z.string().optional(),
39
+ triggers: z
40
+ .strictObject({
41
+ api: z.boolean().optional(),
42
+ email: z
43
+ .strictObject({
44
+ enabled: z.boolean().optional(),
45
+ aliases: z
46
+ .array(z.union([
47
+ z.string().includes('@'),
48
+ z.strictObject({
49
+ address: z.string().includes('@'),
50
+ allowlist: z.array(z.string()).optional(),
51
+ replyConfig: z.record(z.string(), z.json()).optional(),
52
+ requireSenderAuth: z.boolean().optional(),
53
+ enabled: z.boolean().optional(),
54
+ }),
55
+ ]))
56
+ .optional(),
57
+ })
58
+ .optional(),
59
+ })
60
+ .optional(),
61
+ dependencies: z.record(dependencyName, exactVersion).optional(),
62
+ evaluators: z
63
+ .strictObject({
64
+ passThreshold: z.number().min(0).max(1).optional(),
65
+ items: z.array(evaluatorItem).optional(),
66
+ })
67
+ .optional(),
68
+ });
@@ -0,0 +1,68 @@
1
+ import type { z } from 'zod';
2
+ /** JSON Schema stays available for lossless migration of existing schema files. */
3
+ export type JsonValue = string | number | boolean | null | JsonValue[] | {
4
+ [key: string]: JsonValue;
5
+ };
6
+ export type JsonSchema = {
7
+ [key: string]: JsonValue;
8
+ };
9
+ export type DefinitionSchema = z.ZodType | JsonSchema;
10
+ export type InferSchema<S> = [S] extends [never] ? unknown : S extends z.ZodType ? z.output<S> : unknown;
11
+ /** Shared envelope; future worker definitions can use this without changing agents. */
12
+ export interface AutomationDefinition<K extends string, I, O> {
13
+ readonly kind: K;
14
+ readonly inputSchema?: I;
15
+ readonly outputSchema?: O;
16
+ }
17
+ export interface AgentEmailAlias {
18
+ address: string;
19
+ /** Omitted leaves platform ownership unchanged; [] explicitly denies all senders. */
20
+ allowlist?: string[];
21
+ replyConfig?: {
22
+ [key: string]: JsonValue;
23
+ };
24
+ requireSenderAuth?: boolean;
25
+ enabled?: boolean;
26
+ }
27
+ export interface AgentConfig {
28
+ name: string;
29
+ description?: string;
30
+ model?: string;
31
+ triggers?: {
32
+ api?: boolean;
33
+ email?: {
34
+ enabled?: boolean;
35
+ aliases?: (string | AgentEmailAlias)[];
36
+ };
37
+ };
38
+ dependencies?: Record<string, string>;
39
+ evaluators?: {
40
+ passThreshold?: number;
41
+ items?: {
42
+ use: string;
43
+ weight?: number;
44
+ version?: string;
45
+ }[];
46
+ };
47
+ }
48
+ export interface AgentOptions<I = DefinitionSchema, O = DefinitionSchema> extends AgentConfig {
49
+ inputSchema?: I;
50
+ outputSchema?: O;
51
+ }
52
+ export interface AgentDefinition<I = DefinitionSchema | undefined, O = DefinitionSchema | undefined> extends AutomationDefinition<'agent', I, O> {
53
+ readonly config: Readonly<AgentConfig>;
54
+ }
55
+ export type InferInput<T extends AutomationDefinition<string, unknown, unknown>> = InferSchema<NonNullable<T['inputSchema']>>;
56
+ export type InferOutput<T extends AutomationDefinition<string, unknown, unknown>> = InferSchema<NonNullable<T['outputSchema']>>;
57
+ /** Versioned data, separate from source syntax and from any execution engine. */
58
+ export interface CompiledDefinition<K extends string> {
59
+ schemaVersion: 1;
60
+ kind: K;
61
+ inputSchema?: JsonSchema;
62
+ outputSchema?: JsonSchema;
63
+ }
64
+ export interface CompiledAgent extends CompiledDefinition<'agent'> {
65
+ manifest: AgentConfig & {
66
+ schemaVersion: 1;
67
+ };
68
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import type { AgentDefinition, AgentOptions, DefinitionSchema } from './definition.js';
2
+ export type { AgentConfig, AgentDefinition, AgentEmailAlias, AgentOptions, AutomationDefinition, CompiledAgent, CompiledDefinition, DefinitionSchema, InferInput, InferOutput, JsonSchema, JsonValue, } from './definition.js';
3
+ /** Define configuration only. Instructions and resources stay in the agent folder. */
4
+ export declare function createAgent<I extends DefinitionSchema | undefined = undefined, O extends DefinitionSchema | undefined = undefined>(options: AgentOptions<I, O>): AgentDefinition<I, O>;
package/dist/index.js ADDED
@@ -0,0 +1,11 @@
1
+ import { agentConfigSchema } from './config.js';
2
+ /** Define configuration only. Instructions and resources stay in the agent folder. */
3
+ export function createAgent(options) {
4
+ const { inputSchema, outputSchema, ...config } = options;
5
+ return Object.freeze({
6
+ kind: 'agent',
7
+ config: agentConfigSchema.parse(config),
8
+ ...(inputSchema === undefined ? {} : { inputSchema }),
9
+ ...(outputSchema === undefined ? {} : { outputSchema }),
10
+ });
11
+ }
@@ -0,0 +1,3 @@
1
+ import type { JsonSchema } from './definition.js';
2
+ /** Validate and copy JSON without dropping keys such as __proto__ or constructor. */
3
+ export declare function copyJsonSchema(schema: unknown): JsonSchema;
@@ -0,0 +1,31 @@
1
+ /** Validate and copy JSON without dropping keys such as __proto__ or constructor. */
2
+ export function copyJsonSchema(schema) {
3
+ const ancestors = new Set();
4
+ function copy(value) {
5
+ if (value === null || typeof value === 'string' || typeof value === 'boolean')
6
+ return value;
7
+ if (typeof value === 'number' && Number.isFinite(value))
8
+ return value;
9
+ if (typeof value !== 'object' || value === null)
10
+ throw new Error('Expected a JSON value');
11
+ if (ancestors.has(value))
12
+ throw new Error('Cyclic JSON value');
13
+ if (!Array.isArray(value) && ![Object.prototype, null].includes(Object.getPrototypeOf(value)))
14
+ throw new Error('Expected a plain JSON object');
15
+ if (Object.getOwnPropertySymbols(value).length)
16
+ throw new Error('Symbol keys are not JSON');
17
+ ancestors.add(value);
18
+ try {
19
+ if (Array.isArray(value))
20
+ return Array.from(value, copy);
21
+ return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, copy(item)]));
22
+ }
23
+ finally {
24
+ ancestors.delete(value);
25
+ }
26
+ }
27
+ const result = copy(schema);
28
+ if (result === null || typeof result !== 'object' || Array.isArray(result))
29
+ throw new Error('Expected a JSON Schema object');
30
+ return result;
31
+ }
package/package.json CHANGED
@@ -1,6 +1,53 @@
1
1
  {
2
2
  "name": "@eigenpal/automations",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.20.49",
4
+ "description": "TypeScript definitions for EigenPal agents.",
5
+ "type": "module",
6
+ "license": "Apache-2.0",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/eigenpal/automations.git"
10
+ },
11
+ "homepage": "https://github.com/eigenpal/automations#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/eigenpal/automations/issues"
14
+ },
15
+ "publishConfig": {
16
+ "access": "public"
17
+ },
18
+ "engines": {
19
+ "node": ">=22"
20
+ },
21
+ "sideEffects": false,
22
+ "main": "./dist/index.js",
23
+ "types": "./dist/index.d.ts",
24
+ "exports": {
25
+ ".": {
26
+ "types": "./dist/index.d.ts",
27
+ "import": "./dist/index.js"
28
+ },
29
+ "./compiler": {
30
+ "types": "./dist/compiler.d.ts",
31
+ "import": "./dist/compiler.js"
32
+ }
33
+ },
34
+ "files": [
35
+ "dist",
36
+ "README.md",
37
+ "LICENSE",
38
+ "CHANGELOG.md"
39
+ ],
40
+ "scripts": {
41
+ "build": "tsc -p tsconfig.build.json",
42
+ "typecheck": "tsc --noEmit -p tsconfig.json && tsc --noEmit -p tsconfig.tests.json",
43
+ "test": "bun test src",
44
+ "verify-pack": "bun scripts/verify-pack.ts"
45
+ },
46
+ "peerDependencies": {
47
+ "zod": "^4.4.3"
48
+ },
49
+ "devDependencies": {
50
+ "typescript": "^6.0.3",
51
+ "zod": "^4.4.3"
52
+ }
53
+ }