dappily-agent-kit 0.1.0 → 0.3.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 (38) hide show
  1. package/README.md +126 -121
  2. package/dist/actions/create_topic.d.ts +4 -0
  3. package/dist/actions/create_topic.d.ts.map +1 -0
  4. package/dist/actions/create_topic.js +136 -0
  5. package/dist/actions/create_topic.js.map +1 -0
  6. package/dist/actions/delete_topic.d.ts +4 -0
  7. package/dist/actions/delete_topic.d.ts.map +1 -0
  8. package/dist/actions/delete_topic.js +102 -0
  9. package/dist/actions/delete_topic.js.map +1 -0
  10. package/dist/actions/get_topic_info.d.ts +4 -0
  11. package/dist/actions/get_topic_info.d.ts.map +1 -0
  12. package/dist/actions/get_topic_info.js +79 -0
  13. package/dist/actions/get_topic_info.js.map +1 -0
  14. package/dist/actions/index.d.ts +5 -1
  15. package/dist/actions/index.d.ts.map +1 -1
  16. package/dist/actions/index.js +15 -1
  17. package/dist/actions/index.js.map +1 -1
  18. package/dist/actions/submit_message.d.ts +4 -0
  19. package/dist/actions/submit_message.d.ts.map +1 -0
  20. package/dist/actions/submit_message.js +129 -0
  21. package/dist/actions/submit_message.js.map +1 -0
  22. package/dist/forge/actionSpec.d.ts +389 -0
  23. package/dist/forge/actionSpec.d.ts.map +1 -0
  24. package/dist/forge/actionSpec.js +127 -0
  25. package/dist/forge/actionSpec.js.map +1 -0
  26. package/dist/forge/generator.d.ts +9 -0
  27. package/dist/forge/generator.d.ts.map +1 -0
  28. package/dist/forge/generator.js +322 -0
  29. package/dist/forge/generator.js.map +1 -0
  30. package/dist/forge/index.d.ts +4 -0
  31. package/dist/forge/index.d.ts.map +1 -0
  32. package/dist/forge/index.js +12 -0
  33. package/dist/forge/index.js.map +1 -0
  34. package/dist/index.d.ts +3 -1
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +11 -1
  37. package/dist/index.js.map +1 -1
  38. package/package.json +8 -4
@@ -0,0 +1,389 @@
1
+ import { z } from "zod";
2
+ export declare const SPEC_VERSION = 4;
3
+ export declare const ActionSpecSchema: z.ZodObject<{
4
+ specVersion: z.ZodNumber;
5
+ kitVersion: z.ZodString;
6
+ sdkVersion: z.ZodString;
7
+ name: z.ZodString;
8
+ description: z.ZodString;
9
+ category: z.ZodEnum<["core", "fungible", "nft", "hcs", "schedule", "contract", "mirror", "account"]>;
10
+ similes: z.ZodArray<z.ZodString, "many">;
11
+ risk: z.ZodEnum<["read", "write", "destructive"]>;
12
+ costTier: z.ZodEnum<["free", "low", "medium", "high"]>;
13
+ hedera: z.ZodObject<{
14
+ service: z.ZodEnum<["HBAR", "HTS", "HCS", "SCHEDULE", "CONTRACT", "MIRROR", "ACCOUNT"]>;
15
+ sdkClass: z.ZodString;
16
+ sdkImports: z.ZodArray<z.ZodString, "many">;
17
+ networkCallType: z.ZodEnum<["query", "transaction", "mirror_rest"]>;
18
+ requiresSigning: z.ZodBoolean;
19
+ requiredKeys: z.ZodArray<z.ZodEnum<["operator", "supply", "admin", "sender", "custom"]>, "many">;
20
+ estimatedFeeHbar: z.ZodNumber;
21
+ mirrorEndpoint: z.ZodOptional<z.ZodString>;
22
+ }, "strip", z.ZodTypeAny, {
23
+ estimatedFeeHbar: number;
24
+ service: "HBAR" | "HTS" | "HCS" | "SCHEDULE" | "CONTRACT" | "MIRROR" | "ACCOUNT";
25
+ sdkClass: string;
26
+ sdkImports: string[];
27
+ networkCallType: "query" | "transaction" | "mirror_rest";
28
+ requiresSigning: boolean;
29
+ requiredKeys: ("custom" | "operator" | "supply" | "admin" | "sender")[];
30
+ mirrorEndpoint?: string | undefined;
31
+ }, {
32
+ estimatedFeeHbar: number;
33
+ service: "HBAR" | "HTS" | "HCS" | "SCHEDULE" | "CONTRACT" | "MIRROR" | "ACCOUNT";
34
+ sdkClass: string;
35
+ sdkImports: string[];
36
+ networkCallType: "query" | "transaction" | "mirror_rest";
37
+ requiresSigning: boolean;
38
+ requiredKeys: ("custom" | "operator" | "supply" | "admin" | "sender")[];
39
+ mirrorEndpoint?: string | undefined;
40
+ }>;
41
+ sdkMethods: z.ZodArray<z.ZodObject<{
42
+ method: z.ZodString;
43
+ args: z.ZodOptional<z.ZodArray<z.ZodObject<{
44
+ from: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
45
+ transform: z.ZodOptional<z.ZodString>;
46
+ }, "strip", z.ZodTypeAny, {
47
+ from: string | string[];
48
+ transform?: string | undefined;
49
+ }, {
50
+ from: string | string[];
51
+ transform?: string | undefined;
52
+ }>, "many">>;
53
+ conditional: z.ZodOptional<z.ZodObject<{
54
+ field: z.ZodString;
55
+ when: z.ZodEnum<["provided", "true", "false"]>;
56
+ }, "strip", z.ZodTypeAny, {
57
+ field: string;
58
+ when: "provided" | "true" | "false";
59
+ }, {
60
+ field: string;
61
+ when: "provided" | "true" | "false";
62
+ }>>;
63
+ }, "strip", z.ZodTypeAny, {
64
+ method: string;
65
+ args?: {
66
+ from: string | string[];
67
+ transform?: string | undefined;
68
+ }[] | undefined;
69
+ conditional?: {
70
+ field: string;
71
+ when: "provided" | "true" | "false";
72
+ } | undefined;
73
+ }, {
74
+ method: string;
75
+ args?: {
76
+ from: string | string[];
77
+ transform?: string | undefined;
78
+ }[] | undefined;
79
+ conditional?: {
80
+ field: string;
81
+ when: "provided" | "true" | "false";
82
+ } | undefined;
83
+ }>, "many">;
84
+ computedFields: z.ZodOptional<z.ZodArray<z.ZodObject<{
85
+ name: z.ZodString;
86
+ type: z.ZodEnum<["string", "number", "boolean"]>;
87
+ from: z.ZodString;
88
+ op: z.ZodEnum<["notNull", "toString", "toNumber"]>;
89
+ }, "strip", z.ZodTypeAny, {
90
+ type: "string" | "number" | "boolean";
91
+ from: string;
92
+ name: string;
93
+ op: "toString" | "notNull" | "toNumber";
94
+ }, {
95
+ type: "string" | "number" | "boolean";
96
+ from: string;
97
+ name: string;
98
+ op: "toString" | "notNull" | "toNumber";
99
+ }>, "many">>;
100
+ implicitBehaviors: z.ZodOptional<z.ZodArray<z.ZodObject<{
101
+ behavior: z.ZodString;
102
+ details: z.ZodString;
103
+ }, "strip", z.ZodTypeAny, {
104
+ details: string;
105
+ behavior: string;
106
+ }, {
107
+ details: string;
108
+ behavior: string;
109
+ }>, "many">>;
110
+ inputs: z.ZodArray<z.ZodObject<{
111
+ name: z.ZodString;
112
+ type: z.ZodEnum<["string", "number", "boolean", "string[]", "number[]"]>;
113
+ required: z.ZodBoolean;
114
+ default: z.ZodOptional<z.ZodAny>;
115
+ constraints: z.ZodOptional<z.ZodObject<{
116
+ min: z.ZodOptional<z.ZodNumber>;
117
+ max: z.ZodOptional<z.ZodNumber>;
118
+ regex: z.ZodOptional<z.ZodString>;
119
+ enum: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
120
+ int: z.ZodOptional<z.ZodBoolean>;
121
+ }, "strip", z.ZodTypeAny, {
122
+ min?: number | undefined;
123
+ max?: number | undefined;
124
+ regex?: string | undefined;
125
+ enum?: string[] | undefined;
126
+ int?: boolean | undefined;
127
+ }, {
128
+ min?: number | undefined;
129
+ max?: number | undefined;
130
+ regex?: string | undefined;
131
+ enum?: string[] | undefined;
132
+ int?: boolean | undefined;
133
+ }>>;
134
+ describe: z.ZodString;
135
+ }, "strip", z.ZodTypeAny, {
136
+ type: "string" | "number" | "boolean" | "string[]" | "number[]";
137
+ name: string;
138
+ required: boolean;
139
+ describe: string;
140
+ default?: any;
141
+ constraints?: {
142
+ min?: number | undefined;
143
+ max?: number | undefined;
144
+ regex?: string | undefined;
145
+ enum?: string[] | undefined;
146
+ int?: boolean | undefined;
147
+ } | undefined;
148
+ }, {
149
+ type: "string" | "number" | "boolean" | "string[]" | "number[]";
150
+ name: string;
151
+ required: boolean;
152
+ describe: string;
153
+ default?: any;
154
+ constraints?: {
155
+ min?: number | undefined;
156
+ max?: number | undefined;
157
+ regex?: string | undefined;
158
+ enum?: string[] | undefined;
159
+ int?: boolean | undefined;
160
+ } | undefined;
161
+ }>, "many">;
162
+ preflightChecks: z.ZodArray<z.ZodObject<{
163
+ check: z.ZodString;
164
+ type: z.ZodEnum<["association", "balance", "metadata_size", "amount_threshold", "key_required", "custom"]>;
165
+ failError: z.ZodString;
166
+ failDetails: z.ZodString;
167
+ }, "strip", z.ZodTypeAny, {
168
+ type: "custom" | "association" | "balance" | "metadata_size" | "amount_threshold" | "key_required";
169
+ check: string;
170
+ failError: string;
171
+ failDetails: string;
172
+ }, {
173
+ type: "custom" | "association" | "balance" | "metadata_size" | "amount_threshold" | "key_required";
174
+ check: string;
175
+ failError: string;
176
+ failDetails: string;
177
+ }>, "many">;
178
+ successData: z.ZodArray<z.ZodObject<{
179
+ name: z.ZodString;
180
+ type: z.ZodEnum<["string", "number", "boolean", "string[]", "number[]", "object"]>;
181
+ source: z.ZodEnum<["receipt", "response", "input", "computed", "query_result"]>;
182
+ receiptField: z.ZodOptional<z.ZodString>;
183
+ transform: z.ZodOptional<z.ZodString>;
184
+ queryField: z.ZodOptional<z.ZodString>;
185
+ compute: z.ZodOptional<z.ZodString>;
186
+ describe: z.ZodString;
187
+ }, "strip", z.ZodTypeAny, {
188
+ type: "string" | "number" | "boolean" | "object" | "string[]" | "number[]";
189
+ name: string;
190
+ describe: string;
191
+ source: "receipt" | "response" | "input" | "computed" | "query_result";
192
+ receiptField?: string | undefined;
193
+ transform?: string | undefined;
194
+ queryField?: string | undefined;
195
+ compute?: string | undefined;
196
+ }, {
197
+ type: "string" | "number" | "boolean" | "object" | "string[]" | "number[]";
198
+ name: string;
199
+ describe: string;
200
+ source: "receipt" | "response" | "input" | "computed" | "query_result";
201
+ receiptField?: string | undefined;
202
+ transform?: string | undefined;
203
+ queryField?: string | undefined;
204
+ compute?: string | undefined;
205
+ }>, "many">;
206
+ errorMap: z.ZodArray<z.ZodObject<{
207
+ hederaStatus: z.ZodString;
208
+ error: z.ZodString;
209
+ details: z.ZodString;
210
+ }, "strip", z.ZodTypeAny, {
211
+ error: string;
212
+ details: string;
213
+ hederaStatus: string;
214
+ }, {
215
+ error: string;
216
+ details: string;
217
+ hederaStatus: string;
218
+ }>, "many">;
219
+ requiresConfirmation: z.ZodBoolean;
220
+ hasSimulation: z.ZodBoolean;
221
+ irreversible: z.ZodBoolean;
222
+ }, "strip", z.ZodTypeAny, {
223
+ name: string;
224
+ specVersion: number;
225
+ kitVersion: string;
226
+ sdkVersion: string;
227
+ description: string;
228
+ category: "core" | "fungible" | "nft" | "hcs" | "schedule" | "contract" | "mirror" | "account";
229
+ similes: string[];
230
+ risk: "read" | "write" | "destructive";
231
+ costTier: "free" | "low" | "medium" | "high";
232
+ hedera: {
233
+ estimatedFeeHbar: number;
234
+ service: "HBAR" | "HTS" | "HCS" | "SCHEDULE" | "CONTRACT" | "MIRROR" | "ACCOUNT";
235
+ sdkClass: string;
236
+ sdkImports: string[];
237
+ networkCallType: "query" | "transaction" | "mirror_rest";
238
+ requiresSigning: boolean;
239
+ requiredKeys: ("custom" | "operator" | "supply" | "admin" | "sender")[];
240
+ mirrorEndpoint?: string | undefined;
241
+ };
242
+ sdkMethods: {
243
+ method: string;
244
+ args?: {
245
+ from: string | string[];
246
+ transform?: string | undefined;
247
+ }[] | undefined;
248
+ conditional?: {
249
+ field: string;
250
+ when: "provided" | "true" | "false";
251
+ } | undefined;
252
+ }[];
253
+ inputs: {
254
+ type: "string" | "number" | "boolean" | "string[]" | "number[]";
255
+ name: string;
256
+ required: boolean;
257
+ describe: string;
258
+ default?: any;
259
+ constraints?: {
260
+ min?: number | undefined;
261
+ max?: number | undefined;
262
+ regex?: string | undefined;
263
+ enum?: string[] | undefined;
264
+ int?: boolean | undefined;
265
+ } | undefined;
266
+ }[];
267
+ preflightChecks: {
268
+ type: "custom" | "association" | "balance" | "metadata_size" | "amount_threshold" | "key_required";
269
+ check: string;
270
+ failError: string;
271
+ failDetails: string;
272
+ }[];
273
+ successData: {
274
+ type: "string" | "number" | "boolean" | "object" | "string[]" | "number[]";
275
+ name: string;
276
+ describe: string;
277
+ source: "receipt" | "response" | "input" | "computed" | "query_result";
278
+ receiptField?: string | undefined;
279
+ transform?: string | undefined;
280
+ queryField?: string | undefined;
281
+ compute?: string | undefined;
282
+ }[];
283
+ errorMap: {
284
+ error: string;
285
+ details: string;
286
+ hederaStatus: string;
287
+ }[];
288
+ requiresConfirmation: boolean;
289
+ hasSimulation: boolean;
290
+ irreversible: boolean;
291
+ computedFields?: {
292
+ type: "string" | "number" | "boolean";
293
+ from: string;
294
+ name: string;
295
+ op: "toString" | "notNull" | "toNumber";
296
+ }[] | undefined;
297
+ implicitBehaviors?: {
298
+ details: string;
299
+ behavior: string;
300
+ }[] | undefined;
301
+ }, {
302
+ name: string;
303
+ specVersion: number;
304
+ kitVersion: string;
305
+ sdkVersion: string;
306
+ description: string;
307
+ category: "core" | "fungible" | "nft" | "hcs" | "schedule" | "contract" | "mirror" | "account";
308
+ similes: string[];
309
+ risk: "read" | "write" | "destructive";
310
+ costTier: "free" | "low" | "medium" | "high";
311
+ hedera: {
312
+ estimatedFeeHbar: number;
313
+ service: "HBAR" | "HTS" | "HCS" | "SCHEDULE" | "CONTRACT" | "MIRROR" | "ACCOUNT";
314
+ sdkClass: string;
315
+ sdkImports: string[];
316
+ networkCallType: "query" | "transaction" | "mirror_rest";
317
+ requiresSigning: boolean;
318
+ requiredKeys: ("custom" | "operator" | "supply" | "admin" | "sender")[];
319
+ mirrorEndpoint?: string | undefined;
320
+ };
321
+ sdkMethods: {
322
+ method: string;
323
+ args?: {
324
+ from: string | string[];
325
+ transform?: string | undefined;
326
+ }[] | undefined;
327
+ conditional?: {
328
+ field: string;
329
+ when: "provided" | "true" | "false";
330
+ } | undefined;
331
+ }[];
332
+ inputs: {
333
+ type: "string" | "number" | "boolean" | "string[]" | "number[]";
334
+ name: string;
335
+ required: boolean;
336
+ describe: string;
337
+ default?: any;
338
+ constraints?: {
339
+ min?: number | undefined;
340
+ max?: number | undefined;
341
+ regex?: string | undefined;
342
+ enum?: string[] | undefined;
343
+ int?: boolean | undefined;
344
+ } | undefined;
345
+ }[];
346
+ preflightChecks: {
347
+ type: "custom" | "association" | "balance" | "metadata_size" | "amount_threshold" | "key_required";
348
+ check: string;
349
+ failError: string;
350
+ failDetails: string;
351
+ }[];
352
+ successData: {
353
+ type: "string" | "number" | "boolean" | "object" | "string[]" | "number[]";
354
+ name: string;
355
+ describe: string;
356
+ source: "receipt" | "response" | "input" | "computed" | "query_result";
357
+ receiptField?: string | undefined;
358
+ transform?: string | undefined;
359
+ queryField?: string | undefined;
360
+ compute?: string | undefined;
361
+ }[];
362
+ errorMap: {
363
+ error: string;
364
+ details: string;
365
+ hederaStatus: string;
366
+ }[];
367
+ requiresConfirmation: boolean;
368
+ hasSimulation: boolean;
369
+ irreversible: boolean;
370
+ computedFields?: {
371
+ type: "string" | "number" | "boolean";
372
+ from: string;
373
+ name: string;
374
+ op: "toString" | "notNull" | "toNumber";
375
+ }[] | undefined;
376
+ implicitBehaviors?: {
377
+ details: string;
378
+ behavior: string;
379
+ }[] | undefined;
380
+ }>;
381
+ export type ActionSpec = z.infer<typeof ActionSpecSchema>;
382
+ export declare function validateSpec(spec: unknown): {
383
+ ok: true;
384
+ spec: ActionSpec;
385
+ } | {
386
+ ok: false;
387
+ errors: string[];
388
+ };
389
+ //# sourceMappingURL=actionSpec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actionSpec.d.ts","sourceRoot":"","sources":["../../src/forge/actionSpec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB,eAAO,MAAM,YAAY,IAAI,CAAC;AAiG9B,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoC3B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,UAAU,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAI5G"}
@@ -0,0 +1,127 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ActionSpecSchema = exports.SPEC_VERSION = void 0;
4
+ exports.validateSpec = validateSpec;
5
+ const zod_1 = require("zod");
6
+ // ── Action Spec Schema v4 ──────────────────────────────────────
7
+ // CHANGELOG:
8
+ // v4: sdkMethods now use args[] with { from, transform? }.
9
+ // Added computedFields for derived query outputs.
10
+ // Killed single-arg method calls — everything uses args[].
11
+ // v3: transform, compute, structured conditional, int constraint.
12
+ // v2: versioning, risk/costTier, sdkImports, implicitBehaviors.
13
+ // v1: Initial schema.
14
+ exports.SPEC_VERSION = 4;
15
+ // ── Enums ──────────────────────────────────────────────────────
16
+ const HederaServiceSchema = zod_1.z.enum(["HBAR", "HTS", "HCS", "SCHEDULE", "CONTRACT", "MIRROR", "ACCOUNT"]);
17
+ const KeyRequirementSchema = zod_1.z.enum(["operator", "supply", "admin", "sender", "custom"]);
18
+ const NetworkCallTypeSchema = zod_1.z.enum(["query", "transaction", "mirror_rest"]);
19
+ const RiskSchema = zod_1.z.enum(["read", "write", "destructive"]);
20
+ const CostTierSchema = zod_1.z.enum(["free", "low", "medium", "high"]);
21
+ // ── Input fields ───────────────────────────────────────────────
22
+ const InputConstraintsSchema = zod_1.z.object({
23
+ min: zod_1.z.number().optional(),
24
+ max: zod_1.z.number().optional(),
25
+ regex: zod_1.z.string().optional(),
26
+ enum: zod_1.z.array(zod_1.z.string()).optional(),
27
+ int: zod_1.z.boolean().optional(),
28
+ }).optional();
29
+ const InputFieldSchema = zod_1.z.object({
30
+ name: zod_1.z.string(),
31
+ type: zod_1.z.enum(["string", "number", "boolean", "string[]", "number[]"]),
32
+ required: zod_1.z.boolean(),
33
+ default: zod_1.z.any().optional(),
34
+ constraints: InputConstraintsSchema,
35
+ describe: zod_1.z.string(),
36
+ });
37
+ // ── Pre-flight checks ──────────────────────────────────────────
38
+ const PreflightCheckSchema = zod_1.z.object({
39
+ check: zod_1.z.string(),
40
+ type: zod_1.z.enum(["association", "balance", "metadata_size", "amount_threshold", "key_required", "custom"]),
41
+ failError: zod_1.z.string(),
42
+ failDetails: zod_1.z.string(),
43
+ });
44
+ // ── Error mapping ──────────────────────────────────────────────
45
+ const ErrorMapEntrySchema = zod_1.z.object({
46
+ hederaStatus: zod_1.z.string(),
47
+ error: zod_1.z.string(),
48
+ details: zod_1.z.string(),
49
+ });
50
+ // ── Success data fields ────────────────────────────────────────
51
+ const DataFieldSchema = zod_1.z.object({
52
+ name: zod_1.z.string(),
53
+ type: zod_1.z.enum(["string", "number", "boolean", "string[]", "number[]", "object"]),
54
+ source: zod_1.z.enum(["receipt", "response", "input", "computed", "query_result"]),
55
+ receiptField: zod_1.z.string().optional(),
56
+ transform: zod_1.z.string().optional(),
57
+ queryField: zod_1.z.string().optional(),
58
+ compute: zod_1.z.string().optional(),
59
+ describe: zod_1.z.string(),
60
+ });
61
+ // ── Computed fields (for query-derived values) ─────────────────
62
+ const ComputedFieldSchema = zod_1.z.object({
63
+ name: zod_1.z.string(),
64
+ type: zod_1.z.enum(["string", "number", "boolean"]),
65
+ from: zod_1.z.string().describe("Source field path (e.g. 'result.adminKey')"),
66
+ op: zod_1.z.enum(["notNull", "toString", "toNumber"]),
67
+ });
68
+ // ── SDK method args ────────────────────────────────────────────
69
+ // Each arg: { from: "input.x" | "agent.x" | "literal:value", transform?: "TransformName" }
70
+ // from can be an array for multi-input transforms (e.g. NftId from tokenId + serial)
71
+ const SdkArgSchema = zod_1.z.object({
72
+ from: zod_1.z.union([zod_1.z.string(), zod_1.z.array(zod_1.z.string())]).describe("Dot path: input.field, agent.field, or literal:value"),
73
+ transform: zod_1.z.string().optional().describe("Transform function name"),
74
+ });
75
+ const ConditionalSchema = zod_1.z.object({
76
+ field: zod_1.z.string(),
77
+ when: zod_1.z.enum(["provided", "true", "false"]),
78
+ });
79
+ const SdkMethodCallSchema = zod_1.z.object({
80
+ method: zod_1.z.string(),
81
+ args: zod_1.z.array(SdkArgSchema).optional().describe("Arguments for this method call"),
82
+ conditional: ConditionalSchema.optional(),
83
+ });
84
+ // ── Implicit behaviors ─────────────────────────────────────────
85
+ const ImplicitBehaviorSchema = zod_1.z.object({
86
+ behavior: zod_1.z.string(),
87
+ details: zod_1.z.string(),
88
+ });
89
+ // ── Main Spec Schema ───────────────────────────────────────────
90
+ exports.ActionSpecSchema = zod_1.z.object({
91
+ specVersion: zod_1.z.number(),
92
+ kitVersion: zod_1.z.string(),
93
+ sdkVersion: zod_1.z.string(),
94
+ name: zod_1.z.string().regex(/^[A-Z][A-Z0-9_]+$/, "ACTION_NAME format"),
95
+ description: zod_1.z.string().min(10),
96
+ category: zod_1.z.enum(["core", "fungible", "nft", "hcs", "schedule", "contract", "mirror", "account"]),
97
+ similes: zod_1.z.array(zod_1.z.string()).min(1),
98
+ risk: RiskSchema,
99
+ costTier: CostTierSchema,
100
+ hedera: zod_1.z.object({
101
+ service: HederaServiceSchema,
102
+ sdkClass: zod_1.z.string(),
103
+ sdkImports: zod_1.z.array(zod_1.z.string()),
104
+ networkCallType: NetworkCallTypeSchema,
105
+ requiresSigning: zod_1.z.boolean(),
106
+ requiredKeys: zod_1.z.array(KeyRequirementSchema),
107
+ estimatedFeeHbar: zod_1.z.number(),
108
+ mirrorEndpoint: zod_1.z.string().optional(),
109
+ }),
110
+ sdkMethods: zod_1.z.array(SdkMethodCallSchema),
111
+ computedFields: zod_1.z.array(ComputedFieldSchema).optional(),
112
+ implicitBehaviors: zod_1.z.array(ImplicitBehaviorSchema).optional(),
113
+ inputs: zod_1.z.array(InputFieldSchema).min(0),
114
+ preflightChecks: zod_1.z.array(PreflightCheckSchema),
115
+ successData: zod_1.z.array(DataFieldSchema),
116
+ errorMap: zod_1.z.array(ErrorMapEntrySchema).min(1),
117
+ requiresConfirmation: zod_1.z.boolean(),
118
+ hasSimulation: zod_1.z.boolean(),
119
+ irreversible: zod_1.z.boolean(),
120
+ });
121
+ function validateSpec(spec) {
122
+ const result = exports.ActionSpecSchema.safeParse(spec);
123
+ if (result.success)
124
+ return { ok: true, spec: result.data };
125
+ return { ok: false, errors: result.error.issues.map((i) => `${i.path.join(".")}: ${i.message}`) };
126
+ }
127
+ //# sourceMappingURL=actionSpec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actionSpec.js","sourceRoot":"","sources":["../../src/forge/actionSpec.ts"],"names":[],"mappings":";;;AAoJA,oCAIC;AAxJD,6BAAwB;AAExB,kEAAkE;AAClE,aAAa;AACb,2DAA2D;AAC3D,sDAAsD;AACtD,+DAA+D;AAC/D,kEAAkE;AAClE,gEAAgE;AAChE,sBAAsB;AAET,QAAA,YAAY,GAAG,CAAC,CAAC;AAE9B,kEAAkE;AAElE,MAAM,mBAAmB,GAAG,OAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;AACxG,MAAM,oBAAoB,GAAG,OAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,C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AAC,mBAAmB,CAAC;IACxC,cAAc,EAAE,OAAC,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC,QAAQ,EAAE;IACvD,iBAAiB,EAAE,OAAC,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC,QAAQ,EAAE;IAE7D,MAAM,EAAE,OAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACxC,eAAe,EAAE,OAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC;IAC9C,WAAW,EAAE,OAAC,CAAC,KAAK,CAAC,eAAe,CAAC;IACrC,QAAQ,EAAE,OAAC,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAE7C,oBAAoB,EAAE,OAAC,CAAC,OAAO,EAAE;IACjC,aAAa,EAAE,OAAC,CAAC,OAAO,EAAE;IAC1B,YAAY,EAAE,OAAC,CAAC,OAAO,EAAE;CAC1B,CAAC,CAAC;AAIH,SAAgB,YAAY,CAAC,IAAa;IACxC,MAAM,MAAM,GAAG,wBAAgB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAChD,IAAI,MAAM,CAAC,OAAO;QAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;IAC3D,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC;AACpG,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * 🔧 Dappily Agent Kit — Action Generator v2
3
+ *
4
+ * Takes a validated ActionSpec (v4) and produces a complete TypeScript
5
+ * action file. Deterministic template fill — no LLM.
6
+ */
7
+ import { ActionSpec } from "./actionSpec";
8
+ export declare function generateAction(spec: ActionSpec): string;
9
+ //# sourceMappingURL=generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/forge/generator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAoK1C,wBAAgB,cAAc,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAiCvD"}