@statelyai/sdk 0.20.3 → 0.22.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.
@@ -2129,348 +2129,7 @@ interface ZodReadonly<T extends SomeType = $ZodType> extends _ZodType<$ZodReadon
2129
2129
  }
2130
2130
  declare const ZodReadonly: $constructor<ZodReadonly>;
2131
2131
  //#endregion
2132
- //#region ../../node_modules/.pnpm/xstate@6.0.0-alpha.24/node_modules/xstate/dist/declarations/src/index.d.ts
2133
- declare global {
2134
- interface SymbolConstructor {
2135
- readonly observable: symbol;
2136
- }
2137
- }
2138
- //#endregion
2139
- //#region ../../node_modules/.pnpm/@types+json-schema@7.0.15/node_modules/@types/json-schema/index.d.ts
2140
- // ==================================================================================================
2141
- // JSON Schema Draft 07
2142
- // ==================================================================================================
2143
- // https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
2144
- // --------------------------------------------------------------------------------------------------
2145
- /**
2146
- * Primitive type
2147
- * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
2148
- */
2149
- type JSONSchema7TypeName = "string" //
2150
- | "number" | "integer" | "boolean" | "object" | "array" | "null";
2151
- /**
2152
- * Primitive type
2153
- * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
2154
- */
2155
- type JSONSchema7Type = string //
2156
- | number | boolean | JSONSchema7Object | JSONSchema7Array | null;
2157
- // Workaround for infinite type recursion
2158
- interface JSONSchema7Object {
2159
- [key: string]: JSONSchema7Type;
2160
- }
2161
- // Workaround for infinite type recursion
2162
- // https://github.com/Microsoft/TypeScript/issues/3496#issuecomment-128553540
2163
- interface JSONSchema7Array extends Array<JSONSchema7Type> {}
2164
- /**
2165
- * Meta schema
2166
- *
2167
- * Recommended values:
2168
- * - 'http://json-schema.org/schema#'
2169
- * - 'http://json-schema.org/hyper-schema#'
2170
- * - 'http://json-schema.org/draft-07/schema#'
2171
- * - 'http://json-schema.org/draft-07/hyper-schema#'
2172
- *
2173
- * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-5
2174
- */
2175
- type JSONSchema7Version = string;
2176
- /**
2177
- * JSON Schema v7
2178
- * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
2179
- */
2180
- type JSONSchema7Definition = JSONSchema7 | boolean;
2181
- interface JSONSchema7 {
2182
- $id?: string | undefined;
2183
- $ref?: string | undefined;
2184
- $schema?: JSONSchema7Version | undefined;
2185
- $comment?: string | undefined;
2186
- /**
2187
- * @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-8.2.4
2188
- * @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00#appendix-A
2189
- */
2190
- $defs?: {
2191
- [key: string]: JSONSchema7Definition;
2192
- } | undefined;
2193
- /**
2194
- * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1
2195
- */
2196
- type?: JSONSchema7TypeName | JSONSchema7TypeName[] | undefined;
2197
- enum?: JSONSchema7Type[] | undefined;
2198
- const?: JSONSchema7Type | undefined;
2199
- /**
2200
- * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.2
2201
- */
2202
- multipleOf?: number | undefined;
2203
- maximum?: number | undefined;
2204
- exclusiveMaximum?: number | undefined;
2205
- minimum?: number | undefined;
2206
- exclusiveMinimum?: number | undefined;
2207
- /**
2208
- * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.3
2209
- */
2210
- maxLength?: number | undefined;
2211
- minLength?: number | undefined;
2212
- pattern?: string | undefined;
2213
- /**
2214
- * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.4
2215
- */
2216
- items?: JSONSchema7Definition | JSONSchema7Definition[] | undefined;
2217
- additionalItems?: JSONSchema7Definition | undefined;
2218
- maxItems?: number | undefined;
2219
- minItems?: number | undefined;
2220
- uniqueItems?: boolean | undefined;
2221
- contains?: JSONSchema7Definition | undefined;
2222
- /**
2223
- * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.5
2224
- */
2225
- maxProperties?: number | undefined;
2226
- minProperties?: number | undefined;
2227
- required?: string[] | undefined;
2228
- properties?: {
2229
- [key: string]: JSONSchema7Definition;
2230
- } | undefined;
2231
- patternProperties?: {
2232
- [key: string]: JSONSchema7Definition;
2233
- } | undefined;
2234
- additionalProperties?: JSONSchema7Definition | undefined;
2235
- dependencies?: {
2236
- [key: string]: JSONSchema7Definition | string[];
2237
- } | undefined;
2238
- propertyNames?: JSONSchema7Definition | undefined;
2239
- /**
2240
- * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.6
2241
- */
2242
- if?: JSONSchema7Definition | undefined;
2243
- then?: JSONSchema7Definition | undefined;
2244
- else?: JSONSchema7Definition | undefined;
2245
- /**
2246
- * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.7
2247
- */
2248
- allOf?: JSONSchema7Definition[] | undefined;
2249
- anyOf?: JSONSchema7Definition[] | undefined;
2250
- oneOf?: JSONSchema7Definition[] | undefined;
2251
- not?: JSONSchema7Definition | undefined;
2252
- /**
2253
- * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-7
2254
- */
2255
- format?: string | undefined;
2256
- /**
2257
- * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-8
2258
- */
2259
- contentMediaType?: string | undefined;
2260
- contentEncoding?: string | undefined;
2261
- /**
2262
- * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-9
2263
- */
2264
- definitions?: {
2265
- [key: string]: JSONSchema7Definition;
2266
- } | undefined;
2267
- /**
2268
- * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-10
2269
- */
2270
- title?: string | undefined;
2271
- description?: string | undefined;
2272
- default?: JSONSchema7Type | undefined;
2273
- readOnly?: boolean | undefined;
2274
- writeOnly?: boolean | undefined;
2275
- examples?: JSONSchema7Type | undefined;
2276
- }
2277
- //#endregion
2278
- //#region ../graph-tools/dist/index.d.mts
2279
- declare const LEGACY_MACHINE_PROFILES: readonly ["xstate-v5", "xstate-v6-alpha"];
2280
- type LegacyMachineProfile = (typeof LEGACY_MACHINE_PROFILES)[number];
2281
- //#endregion
2282
- //#region src/profiles/profileRefs.d.ts
2283
- type ProfileName = `@${string}/${string}`;
2284
- type ProfileSpecifier = `${ProfileName}@${string}`;
2285
- type ResolvedProfileRef = ProfileSpecifier;
2286
- type ProfileRefInput = ResolvedProfileRef | LegacyMachineProfile;
2287
- //#endregion
2288
- //#region src/codegenTypes.d.ts
2289
- interface CodeGenAction {
2290
- /** Graph-native block id, referenced by `@statelyai.action.*` transitions. */
2291
- id?: string;
2292
- type: string;
2293
- params?: Record<string, unknown>;
2294
- }
2295
- interface CodeGenGuard {
2296
- type: string;
2297
- code?: string;
2298
- params?: Record<string, unknown>;
2299
- }
2300
- /**
2301
- * Serialized inline expression directive.
2302
- *
2303
- * Code generation treats this object as JavaScript/TypeScript source, not as a
2304
- * machine config object. It is used for fields such as invoke `input` and
2305
- * `output` where XState accepts mapper expressions.
2306
- */
2307
- interface CodeExpression {
2308
- '@type': 'code';
2309
- lang: 'js' | 'ts';
2310
- expr: string;
2311
- imports?: CodeImport[];
2312
- }
2313
- interface CodeImport {
2314
- package: string;
2315
- import: string;
2316
- importKind?: 'named' | 'default' | 'namespace';
2317
- version?: string;
2318
- }
2319
- interface CodeGenInvoke {
2320
- src: string;
2321
- /** Exact authored actor-logic expression for inline/direct actor sources. */
2322
- srcExpression?: CodeExpression;
2323
- id: string;
2324
- invocationId?: string;
2325
- registryKey?: string;
2326
- timeout?: number | string | CodeExpression;
2327
- input?: Record<string, unknown> | CodeExpression;
2328
- output?: Record<string, unknown> | CodeExpression;
2329
- }
2330
- interface CodeGenNodeData {
2331
- nodeId?: string | null;
2332
- key: string;
2333
- type?: 'normal' | 'parallel' | 'final' | 'history' | 'choice' | null;
2334
- initialId?: string | null;
2335
- initialInput?: Record<string, unknown> | CodeExpression;
2336
- timeout?: number | string | CodeExpression;
2337
- route?: Record<string, unknown> | CodeExpression;
2338
- history?: 'shallow' | 'deep' | boolean;
2339
- output?: Record<string, unknown> | CodeExpression;
2340
- entry?: CodeGenAction[];
2341
- exit?: CodeGenAction[];
2342
- invokes?: CodeGenInvoke[];
2343
- tags?: Array<string | {
2344
- name: string;
2345
- }>;
2346
- description?: string | null;
2347
- meta?: Record<string, unknown> | null;
2348
- color?: string;
2349
- parentId?: string | null;
2350
- temp?: unknown;
2351
- }
2352
- interface CodeGenEdgeData {
2353
- eventType: string;
2354
- matches?: Record<string, unknown>;
2355
- transitionType?: 'normal' | 'targetless' | 'reenter';
2356
- guard?: CodeGenGuard | null;
2357
- context?: Record<string, unknown> | CodeExpression;
2358
- input?: Record<string, unknown> | CodeExpression;
2359
- actions?: CodeGenAction[];
2360
- description?: string | null;
2361
- color?: string;
2362
- meta?: Record<string, unknown> | null;
2363
- temp?: unknown;
2364
- /** Derived visualization edge for a destination state's `route` config. */
2365
- route?: boolean;
2366
- }
2367
- interface CodeGenImplementation {
2368
- id: string;
2369
- name: string;
2370
- description?: string | null;
2371
- icon?: string;
2372
- paramsSchema?: JSONSchema7 | null;
2373
- code?: {
2374
- body: string;
2375
- lang?: string;
2376
- } | null;
2377
- }
2378
- interface CodeGenActorImplementation {
2379
- id: string;
2380
- name: string;
2381
- description?: string | null;
2382
- icon?: string;
2383
- inputSchema?: JSONSchema7 | null;
2384
- outputSchema?: JSONSchema7 | null;
2385
- code?: {
2386
- body: string;
2387
- lang?: string;
2388
- } | null;
2389
- }
2390
- interface CodeGenGraphData {
2391
- profile?: ProfileRefInput;
2392
- context?: Record<string, unknown> | CodeExpression | null;
2393
- schemas?: {
2394
- context?: Record<string, JSONSchema7> | null;
2395
- events?: Record<string, JSONSchema7> | null;
2396
- input?: JSONSchema7 | null;
2397
- output?: JSONSchema7 | null;
2398
- } | null;
2399
- implementations?: {
2400
- actions: CodeGenImplementation[];
2401
- guards: CodeGenImplementation[];
2402
- actors: CodeGenActorImplementation[];
2403
- delays: CodeGenImplementation[];
2404
- } | null;
2405
- }
2406
- interface CodeGenNode {
2407
- id: string;
2408
- parentId?: string | null;
2409
- data: CodeGenNodeData;
2410
- }
2411
- interface CodeGenEdge {
2412
- id: string;
2413
- sourceId: string;
2414
- targetId: string;
2415
- data: CodeGenEdgeData;
2416
- }
2417
- interface CodeGenGraph {
2418
- id: string;
2419
- nodes: CodeGenNode[];
2420
- edges: CodeGenEdge[];
2421
- data: CodeGenGraphData;
2422
- } //#endregion
2423
- //#region src/graphToMachineConfig.d.ts
2424
- interface MachineConfigOptions {
2425
- showDescriptions?: boolean;
2426
- showMeta?: boolean;
2427
- /**
2428
- * Emit inline-code guards as a `{ type }` reference instead of an inline code
2429
- * expression directive. The simulation needs this: it can't evaluate guard
2430
- * source, so it stubs each guard by `type` (see getSimImplementations). A
2431
- * code-expression guard has no `type`, so XState reads `undefined` and throws
2432
- * "Guard 'undefined' is not implemented" the moment that transition is taken.
2433
- */
2434
- inlineGuardsAsTypeRef?: boolean;
2435
- }
2436
- declare function graphToMachineConfig(graph: CodeGenGraph, options?: MachineConfigOptions): UnknownMachineConfig; //#endregion
2437
- //#region src/serializeJS.d.ts
2438
- /**
2439
- * Serializes JavaScript values as JS source code (not JSON).
2440
- * - Unquoted keys for valid identifiers
2441
- * - Single-quoted strings
2442
- * - Omits undefined values
2443
- * - Supports RawCode for verbatim expressions
2444
- * - Supports inline expression directives for verbatim expressions
2445
- */
2446
- declare class RawCode {
2447
- code: string;
2448
- constructor(code: string);
2449
- }
2450
- declare function raw(code: string): RawCode;
2451
- declare function serializeJS(value: unknown, indent?: number, step?: number): string; //#endregion
2452
- //#region src/profiles/xgraphMetadata.d.ts
2453
- //#endregion
2454
- //#region src/graphToXStateTS.d.ts
2455
- interface XStateTSOptions extends MachineConfigOptions {
2456
- exportStyle?: 'named' | 'default' | 'none';
2457
- targetLanguage?: 'typescript' | 'javascript';
2458
- xstateVersion?: 5 | 6;
2459
- }
2460
- declare function graphToXStateTS(graph: CodeGenGraph, options?: XStateTSOptions): string; //#endregion
2461
- //#region src/jsonSchemaToTSType.d.ts
2462
- declare function jsonSchemaToTSType(schema: JSONSchema7 | undefined | null): string;
2463
- /**
2464
- * Build an inline context type string from the schemas.context record.
2465
- * Each key is a context property name, value is its JSONSchema7.
2466
- */
2467
- declare function contextSchemaToTSType(context: Record<string, JSONSchema7> | null | undefined): string | null;
2468
- /**
2469
- * Build an event union type from the schemas.events record.
2470
- * Each key is the event type name, value describes the payload properties.
2471
- */
2472
- declare function eventsSchemaToTSType(events: Record<string, JSONSchema7> | null | undefined): string | null; //#endregion
2473
- //#region src/graphPaths.d.ts
2132
+ //#region ../graph-tools/dist/patchSchema.d.mts
2474
2133
  declare const canvasColorSchema: ZodEnum<{
2475
2134
  green: "green";
2476
2135
  red: "red";
@@ -2502,8 +2161,8 @@ declare const actionLocationSchema: ZodUnion<readonly [ZodObject<{
2502
2161
  }, $strip>]>;
2503
2162
  type ActionLocation = output<typeof actionLocationSchema>;
2504
2163
  declare const implementationSourceTypeSchema: ZodEnum<{
2505
- guard: "guard";
2506
2164
  action: "action";
2165
+ guard: "guard";
2507
2166
  actor: "actor";
2508
2167
  delay: "delay";
2509
2168
  }>;
@@ -2793,8 +2452,8 @@ declare const graphPatchSchema: ZodDiscriminatedUnion<[ZodObject<{
2793
2452
  op: ZodLiteral<"createImplementation">;
2794
2453
  description: ZodOptional<ZodString>;
2795
2454
  sourceType: ZodEnum<{
2796
- guard: "guard";
2797
2455
  action: "action";
2456
+ guard: "guard";
2798
2457
  actor: "actor";
2799
2458
  delay: "delay";
2800
2459
  }>;
@@ -2807,8 +2466,8 @@ declare const graphPatchSchema: ZodDiscriminatedUnion<[ZodObject<{
2807
2466
  op: ZodLiteral<"updateImplementation">;
2808
2467
  description: ZodOptional<ZodString>;
2809
2468
  sourceType: ZodEnum<{
2810
- guard: "guard";
2811
2469
  action: "action";
2470
+ guard: "guard";
2812
2471
  actor: "actor";
2813
2472
  delay: "delay";
2814
2473
  }>;
@@ -2821,71 +2480,478 @@ declare const graphPatchSchema: ZodDiscriminatedUnion<[ZodObject<{
2821
2480
  op: ZodLiteral<"deleteImplementation">;
2822
2481
  description: ZodOptional<ZodString>;
2823
2482
  sourceType: ZodEnum<{
2824
- guard: "guard";
2825
2483
  action: "action";
2484
+ guard: "guard";
2826
2485
  actor: "actor";
2827
2486
  delay: "delay";
2828
2487
  }>;
2829
- implementationId: ZodString;
2830
- }, $strip>, ZodObject<{
2831
- op: ZodLiteral<"setGuard">;
2832
- description: ZodOptional<ZodString>;
2833
- edgeId: ZodString;
2834
- guard: ZodObject<{
2835
- type: ZodString;
2836
- code: ZodOptional<ZodString>;
2837
- params: ZodOptional<ZodRecord<ZodString, ZodUnknown>>;
2838
- }, $strip>;
2839
- }, $strip>, ZodObject<{
2840
- op: ZodLiteral<"deleteGuard">;
2841
- description: ZodOptional<ZodString>;
2842
- edgeId: ZodString;
2843
- }, $strip>, ZodObject<{
2844
- op: ZodLiteral<"createTag">;
2845
- description: ZodOptional<ZodString>;
2846
- nodeId: ZodString;
2847
- tag: ZodObject<{
2848
- name: ZodString;
2849
- }, $strip>;
2850
- }, $strip>, ZodObject<{
2851
- op: ZodLiteral<"deleteTag">;
2852
- description: ZodOptional<ZodString>;
2853
- nodeId: ZodString;
2854
- tagName: ZodString;
2855
- }, $strip>, ZodObject<{
2856
- op: ZodLiteral<"createAnnotation">;
2857
- description: ZodOptional<ZodString>;
2858
- id: ZodOptional<ZodString>;
2859
- parentId: ZodNullable<ZodString>;
2860
- content: ZodString;
2861
- x: ZodOptional<ZodNumber>;
2862
- y: ZodOptional<ZodNumber>;
2863
- }, $strip>, ZodObject<{
2864
- op: ZodLiteral<"updateAnnotation">;
2865
- description: ZodOptional<ZodString>;
2866
- annotationId: ZodString;
2867
- data: ZodObject<{
2868
- content: ZodOptional<ZodString>;
2869
- }, $strip>;
2870
- }, $strip>, ZodObject<{
2871
- op: ZodLiteral<"deleteAnnotation">;
2872
- description: ZodOptional<ZodString>;
2873
- annotationId: ZodString;
2874
- }, $strip>, ZodObject<{
2875
- op: ZodLiteral<"setContext">;
2876
- description: ZodOptional<ZodString>;
2877
- context: ZodRecord<ZodString, ZodUnknown>;
2878
- }, $strip>, ZodObject<{
2879
- op: ZodLiteral<"updateSchemas">;
2880
- description: ZodOptional<ZodString>;
2881
- schemas: ZodObject<{
2882
- context: ZodOptional<ZodNullable<ZodRecord<ZodString, ZodUnknown>>>;
2883
- events: ZodOptional<ZodNullable<ZodRecord<ZodString, ZodUnknown>>>;
2884
- input: ZodOptional<ZodNullable<ZodUnknown>>;
2885
- output: ZodOptional<ZodNullable<ZodUnknown>>;
2886
- }, $strip>;
2887
- }, $strip>], "op">;
2888
- type GraphPatch = output<typeof graphPatchSchema>;
2889
- /** AI-only schema: semantic ops + shared ops (no generic graph ops) */
2488
+ implementationId: ZodString;
2489
+ }, $strip>, ZodObject<{
2490
+ op: ZodLiteral<"setGuard">;
2491
+ description: ZodOptional<ZodString>;
2492
+ edgeId: ZodString;
2493
+ guard: ZodObject<{
2494
+ type: ZodString;
2495
+ code: ZodOptional<ZodString>;
2496
+ params: ZodOptional<ZodRecord<ZodString, ZodUnknown>>;
2497
+ }, $strip>;
2498
+ }, $strip>, ZodObject<{
2499
+ op: ZodLiteral<"deleteGuard">;
2500
+ description: ZodOptional<ZodString>;
2501
+ edgeId: ZodString;
2502
+ }, $strip>, ZodObject<{
2503
+ op: ZodLiteral<"createTag">;
2504
+ description: ZodOptional<ZodString>;
2505
+ nodeId: ZodString;
2506
+ tag: ZodObject<{
2507
+ name: ZodString;
2508
+ }, $strip>;
2509
+ }, $strip>, ZodObject<{
2510
+ op: ZodLiteral<"deleteTag">;
2511
+ description: ZodOptional<ZodString>;
2512
+ nodeId: ZodString;
2513
+ tagName: ZodString;
2514
+ }, $strip>, ZodObject<{
2515
+ op: ZodLiteral<"createAnnotation">;
2516
+ description: ZodOptional<ZodString>;
2517
+ id: ZodOptional<ZodString>;
2518
+ parentId: ZodNullable<ZodString>;
2519
+ content: ZodString;
2520
+ x: ZodOptional<ZodNumber>;
2521
+ y: ZodOptional<ZodNumber>;
2522
+ }, $strip>, ZodObject<{
2523
+ op: ZodLiteral<"updateAnnotation">;
2524
+ description: ZodOptional<ZodString>;
2525
+ annotationId: ZodString;
2526
+ data: ZodObject<{
2527
+ content: ZodOptional<ZodString>;
2528
+ }, $strip>;
2529
+ }, $strip>, ZodObject<{
2530
+ op: ZodLiteral<"deleteAnnotation">;
2531
+ description: ZodOptional<ZodString>;
2532
+ annotationId: ZodString;
2533
+ }, $strip>, ZodObject<{
2534
+ op: ZodLiteral<"setContext">;
2535
+ description: ZodOptional<ZodString>;
2536
+ context: ZodRecord<ZodString, ZodUnknown>;
2537
+ }, $strip>, ZodObject<{
2538
+ op: ZodLiteral<"updateSchemas">;
2539
+ description: ZodOptional<ZodString>;
2540
+ schemas: ZodObject<{
2541
+ context: ZodOptional<ZodNullable<ZodRecord<ZodString, ZodUnknown>>>;
2542
+ events: ZodOptional<ZodNullable<ZodRecord<ZodString, ZodUnknown>>>;
2543
+ input: ZodOptional<ZodNullable<ZodUnknown>>;
2544
+ output: ZodOptional<ZodNullable<ZodUnknown>>;
2545
+ }, $strip>;
2546
+ }, $strip>], "op">;
2547
+ type GraphPatch = output<typeof graphPatchSchema>;
2548
+ /** AI-only schema: semantic ops + shared ops (no generic graph ops) */
2549
+ //#endregion
2550
+ //#region ../../node_modules/.pnpm/xstate@6.0.0-alpha.24/node_modules/xstate/dist/declarations/src/index.d.ts
2551
+ declare global {
2552
+ interface SymbolConstructor {
2553
+ readonly observable: symbol;
2554
+ }
2555
+ }
2556
+ //#endregion
2557
+ //#region ../../node_modules/.pnpm/@types+json-schema@7.0.15/node_modules/@types/json-schema/index.d.ts
2558
+ // ==================================================================================================
2559
+ // JSON Schema Draft 07
2560
+ // ==================================================================================================
2561
+ // https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
2562
+ // --------------------------------------------------------------------------------------------------
2563
+ /**
2564
+ * Primitive type
2565
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
2566
+ */
2567
+ type JSONSchema7TypeName = "string" //
2568
+ | "number" | "integer" | "boolean" | "object" | "array" | "null";
2569
+ /**
2570
+ * Primitive type
2571
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
2572
+ */
2573
+ type JSONSchema7Type = string //
2574
+ | number | boolean | JSONSchema7Object | JSONSchema7Array | null;
2575
+ // Workaround for infinite type recursion
2576
+ interface JSONSchema7Object {
2577
+ [key: string]: JSONSchema7Type;
2578
+ }
2579
+ // Workaround for infinite type recursion
2580
+ // https://github.com/Microsoft/TypeScript/issues/3496#issuecomment-128553540
2581
+ interface JSONSchema7Array extends Array<JSONSchema7Type> {}
2582
+ /**
2583
+ * Meta schema
2584
+ *
2585
+ * Recommended values:
2586
+ * - 'http://json-schema.org/schema#'
2587
+ * - 'http://json-schema.org/hyper-schema#'
2588
+ * - 'http://json-schema.org/draft-07/schema#'
2589
+ * - 'http://json-schema.org/draft-07/hyper-schema#'
2590
+ *
2591
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-5
2592
+ */
2593
+ type JSONSchema7Version = string;
2594
+ /**
2595
+ * JSON Schema v7
2596
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
2597
+ */
2598
+ type JSONSchema7Definition = JSONSchema7 | boolean;
2599
+ interface JSONSchema7 {
2600
+ $id?: string | undefined;
2601
+ $ref?: string | undefined;
2602
+ $schema?: JSONSchema7Version | undefined;
2603
+ $comment?: string | undefined;
2604
+ /**
2605
+ * @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-8.2.4
2606
+ * @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00#appendix-A
2607
+ */
2608
+ $defs?: {
2609
+ [key: string]: JSONSchema7Definition;
2610
+ } | undefined;
2611
+ /**
2612
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1
2613
+ */
2614
+ type?: JSONSchema7TypeName | JSONSchema7TypeName[] | undefined;
2615
+ enum?: JSONSchema7Type[] | undefined;
2616
+ const?: JSONSchema7Type | undefined;
2617
+ /**
2618
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.2
2619
+ */
2620
+ multipleOf?: number | undefined;
2621
+ maximum?: number | undefined;
2622
+ exclusiveMaximum?: number | undefined;
2623
+ minimum?: number | undefined;
2624
+ exclusiveMinimum?: number | undefined;
2625
+ /**
2626
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.3
2627
+ */
2628
+ maxLength?: number | undefined;
2629
+ minLength?: number | undefined;
2630
+ pattern?: string | undefined;
2631
+ /**
2632
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.4
2633
+ */
2634
+ items?: JSONSchema7Definition | JSONSchema7Definition[] | undefined;
2635
+ additionalItems?: JSONSchema7Definition | undefined;
2636
+ maxItems?: number | undefined;
2637
+ minItems?: number | undefined;
2638
+ uniqueItems?: boolean | undefined;
2639
+ contains?: JSONSchema7Definition | undefined;
2640
+ /**
2641
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.5
2642
+ */
2643
+ maxProperties?: number | undefined;
2644
+ minProperties?: number | undefined;
2645
+ required?: string[] | undefined;
2646
+ properties?: {
2647
+ [key: string]: JSONSchema7Definition;
2648
+ } | undefined;
2649
+ patternProperties?: {
2650
+ [key: string]: JSONSchema7Definition;
2651
+ } | undefined;
2652
+ additionalProperties?: JSONSchema7Definition | undefined;
2653
+ dependencies?: {
2654
+ [key: string]: JSONSchema7Definition | string[];
2655
+ } | undefined;
2656
+ propertyNames?: JSONSchema7Definition | undefined;
2657
+ /**
2658
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.6
2659
+ */
2660
+ if?: JSONSchema7Definition | undefined;
2661
+ then?: JSONSchema7Definition | undefined;
2662
+ else?: JSONSchema7Definition | undefined;
2663
+ /**
2664
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.7
2665
+ */
2666
+ allOf?: JSONSchema7Definition[] | undefined;
2667
+ anyOf?: JSONSchema7Definition[] | undefined;
2668
+ oneOf?: JSONSchema7Definition[] | undefined;
2669
+ not?: JSONSchema7Definition | undefined;
2670
+ /**
2671
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-7
2672
+ */
2673
+ format?: string | undefined;
2674
+ /**
2675
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-8
2676
+ */
2677
+ contentMediaType?: string | undefined;
2678
+ contentEncoding?: string | undefined;
2679
+ /**
2680
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-9
2681
+ */
2682
+ definitions?: {
2683
+ [key: string]: JSONSchema7Definition;
2684
+ } | undefined;
2685
+ /**
2686
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-10
2687
+ */
2688
+ title?: string | undefined;
2689
+ description?: string | undefined;
2690
+ default?: JSONSchema7Type | undefined;
2691
+ readOnly?: boolean | undefined;
2692
+ writeOnly?: boolean | undefined;
2693
+ examples?: JSONSchema7Type | undefined;
2694
+ }
2695
+ //#endregion
2696
+ //#region ../graph-tools/dist/index.d.mts
2697
+ declare const LEGACY_MACHINE_PROFILES: readonly ["xstate-v5", "xstate-v6-alpha"];
2698
+ type LegacyMachineProfile = (typeof LEGACY_MACHINE_PROFILES)[number];
2699
+ //#endregion
2700
+ //#region src/profiles/profileRefs.d.ts
2701
+ type ProfileName = `@${string}/${string}`;
2702
+ type ProfileSpecifier = `${ProfileName}@${string}`;
2703
+ type ResolvedProfileRef = ProfileSpecifier;
2704
+ type ProfileRefInput = ResolvedProfileRef | LegacyMachineProfile;
2705
+ //#endregion
2706
+ //#region src/codegenTypes.d.ts
2707
+ interface CodeGenAction {
2708
+ /** Graph-native block id, referenced by `@statelyai.action.*` transitions. */
2709
+ id?: string;
2710
+ type: string;
2711
+ params?: Record<string, unknown>;
2712
+ }
2713
+ interface CodeGenGuard {
2714
+ type: string;
2715
+ code?: string;
2716
+ params?: Record<string, unknown>;
2717
+ }
2718
+ /**
2719
+ * Serialized inline expression directive.
2720
+ *
2721
+ * Code generation treats this object as JavaScript/TypeScript source, not as a
2722
+ * machine config object. It is used for fields such as invoke `input` and
2723
+ * `output` where XState accepts mapper expressions.
2724
+ */
2725
+ interface CodeExpression {
2726
+ '@type': 'code';
2727
+ lang: 'js' | 'ts';
2728
+ expr: string;
2729
+ imports?: CodeImport[];
2730
+ }
2731
+ interface CodeImport {
2732
+ package: string;
2733
+ import: string;
2734
+ importKind?: 'named' | 'default' | 'namespace';
2735
+ version?: string;
2736
+ }
2737
+ interface CodeGenInvoke {
2738
+ src: string;
2739
+ /** Exact authored actor-logic expression for inline/direct actor sources. */
2740
+ srcExpression?: CodeExpression;
2741
+ id: string;
2742
+ invocationId?: string;
2743
+ registryKey?: string;
2744
+ timeout?: number | string | CodeExpression;
2745
+ input?: Record<string, unknown> | CodeExpression;
2746
+ output?: Record<string, unknown> | CodeExpression;
2747
+ }
2748
+ interface CodeGenNodeData {
2749
+ nodeId?: string | null;
2750
+ key: string;
2751
+ type?: 'normal' | 'parallel' | 'final' | 'history' | 'choice' | null;
2752
+ initialId?: string | null;
2753
+ initialInput?: Record<string, unknown> | CodeExpression;
2754
+ timeout?: number | string | CodeExpression;
2755
+ route?: Record<string, unknown> | CodeExpression;
2756
+ history?: 'shallow' | 'deep' | boolean;
2757
+ output?: Record<string, unknown> | CodeExpression;
2758
+ entry?: CodeGenAction[];
2759
+ exit?: CodeGenAction[];
2760
+ invokes?: CodeGenInvoke[];
2761
+ tags?: Array<string | {
2762
+ name: string;
2763
+ }>;
2764
+ description?: string | null;
2765
+ meta?: Record<string, unknown> | null;
2766
+ color?: string;
2767
+ parentId?: string | null;
2768
+ temp?: unknown;
2769
+ }
2770
+ interface CodeGenEdgeData {
2771
+ eventType: string;
2772
+ matches?: Record<string, unknown>;
2773
+ transitionType?: 'normal' | 'targetless' | 'reenter';
2774
+ guard?: CodeGenGuard | null;
2775
+ context?: Record<string, unknown> | CodeExpression;
2776
+ input?: Record<string, unknown> | CodeExpression;
2777
+ actions?: CodeGenAction[];
2778
+ description?: string | null;
2779
+ color?: string;
2780
+ meta?: Record<string, unknown> | null;
2781
+ temp?: unknown;
2782
+ /** Derived visualization edge for a destination state's `route` config. */
2783
+ route?: boolean;
2784
+ }
2785
+ interface CodeGenImplementation {
2786
+ id: string;
2787
+ name: string;
2788
+ description?: string | null;
2789
+ icon?: string;
2790
+ paramsSchema?: JSONSchema7 | null;
2791
+ code?: {
2792
+ body: string;
2793
+ lang?: string;
2794
+ } | null;
2795
+ }
2796
+ interface CodeGenActorImplementation {
2797
+ id: string;
2798
+ name: string;
2799
+ description?: string | null;
2800
+ icon?: string;
2801
+ inputSchema?: JSONSchema7 | null;
2802
+ outputSchema?: JSONSchema7 | null;
2803
+ code?: {
2804
+ body: string;
2805
+ lang?: string;
2806
+ } | null;
2807
+ }
2808
+ interface CodeGenGraphData {
2809
+ profile?: ProfileRefInput;
2810
+ context?: Record<string, unknown> | CodeExpression | null;
2811
+ schemas?: {
2812
+ context?: Record<string, JSONSchema7> | null;
2813
+ events?: Record<string, JSONSchema7> | null;
2814
+ input?: JSONSchema7 | null;
2815
+ output?: JSONSchema7 | null;
2816
+ } | null;
2817
+ implementations?: {
2818
+ actions: CodeGenImplementation[];
2819
+ guards: CodeGenImplementation[];
2820
+ actors: CodeGenActorImplementation[];
2821
+ delays: CodeGenImplementation[];
2822
+ } | null;
2823
+ }
2824
+ interface CodeGenNode {
2825
+ id: string;
2826
+ parentId?: string | null;
2827
+ data: CodeGenNodeData;
2828
+ }
2829
+ interface CodeGenEdge {
2830
+ id: string;
2831
+ sourceId: string;
2832
+ targetId: string;
2833
+ data: CodeGenEdgeData;
2834
+ }
2835
+ interface CodeGenGraph {
2836
+ id: string;
2837
+ nodes: CodeGenNode[];
2838
+ edges: CodeGenEdge[];
2839
+ data: CodeGenGraphData;
2840
+ } //#endregion
2841
+ //#region src/graphToMachineConfig.d.ts
2842
+ interface MachineConfigOptions {
2843
+ showDescriptions?: boolean;
2844
+ showMeta?: boolean;
2845
+ /**
2846
+ * Emit inline-code guards as a `{ type }` reference instead of an inline code
2847
+ * expression directive. The simulation needs this: it can't evaluate guard
2848
+ * source, so it stubs each guard by `type` (see getSimImplementations). A
2849
+ * code-expression guard has no `type`, so XState reads `undefined` and throws
2850
+ * "Guard 'undefined' is not implemented" the moment that transition is taken.
2851
+ */
2852
+ inlineGuardsAsTypeRef?: boolean;
2853
+ }
2854
+ declare function graphToMachineConfig(graph: CodeGenGraph, options?: MachineConfigOptions): UnknownMachineConfig; //#endregion
2855
+ //#region src/serializeJS.d.ts
2856
+ /**
2857
+ * Serializes JavaScript values as JS source code (not JSON).
2858
+ * - Unquoted keys for valid identifiers
2859
+ * - Single-quoted strings
2860
+ * - Omits undefined values
2861
+ * - Supports RawCode for verbatim expressions
2862
+ * - Supports inline expression directives for verbatim expressions
2863
+ */
2864
+ declare class RawCode {
2865
+ code: string;
2866
+ constructor(code: string);
2867
+ }
2868
+ declare function raw(code: string): RawCode;
2869
+ declare function serializeJS(value: unknown, indent?: number, step?: number): string; //#endregion
2870
+ //#region src/profiles/xgraphMetadata.d.ts
2871
+ //#endregion
2872
+ //#region src/profiles/types.d.ts
2873
+ type FormatId = string;
2874
+ type ProfileFormatManifest = {
2875
+ format: FormatId;
2876
+ import?: boolean;
2877
+ export?: boolean;
2878
+ sourcePreserving?: boolean;
2879
+ warning?: string;
2880
+ };
2881
+ type ProfileEntityType = {
2882
+ kind: string;
2883
+ label: string;
2884
+ description?: string;
2885
+ authorable?: boolean;
2886
+ terminal?: boolean;
2887
+ canContain?: boolean; /** Logical, unnamespaced profile data stored canonically under the profile namespace. */
2888
+ dataSchema?: JSONSchema7;
2889
+ children?: {
2890
+ types: readonly string[];
2891
+ min?: number;
2892
+ max?: number;
2893
+ };
2894
+ };
2895
+ type ProfileValidationDefinition = {
2896
+ name: string;
2897
+ description: string;
2898
+ };
2899
+ type ProfileAuthoringManifest = {
2900
+ terminology: {
2901
+ node: string;
2902
+ edge: string;
2903
+ graph: string;
2904
+ };
2905
+ nodeTypes: readonly ProfileEntityType[];
2906
+ edgeTypes: readonly ProfileEntityType[];
2907
+ attachments?: Partial<Record<'actions' | 'guards' | 'invokes' | 'tags', boolean>>;
2908
+ supportsInitialNode?: boolean;
2909
+ supportsTargetlessEdges?: boolean;
2910
+ supportsReenterEdges?: boolean;
2911
+ };
2912
+ type ProfileManifest = {
2913
+ profile: ResolvedProfileRef;
2914
+ name: string;
2915
+ description?: string; /** Namespace for canonical profile data, for example `@mastra`. */
2916
+ namespace?: `@${string}`;
2917
+ extends?: ProfileSpecifier;
2918
+ formats: ProfileFormatManifest[];
2919
+ defaultFormat?: FormatId;
2920
+ graph?: {
2921
+ dataSchema?: JSONSchema7;
2922
+ }; /** Profile-owned editor vocabulary. The canvas itself only assumes a graph. */
2923
+ authoring?: ProfileAuthoringManifest;
2924
+ operations?: Partial<Record<'simulate' | 'validate' | 'export', boolean>>;
2925
+ restrictFormatsToListed?: boolean;
2926
+ features?: Record<string, boolean | Record<string, unknown>>;
2927
+ implementations?: Partial<Record<'actions' | 'guards' | 'actors' | 'delays', {
2928
+ mode: 'allowlist' | 'any';
2929
+ items: Record<string, Record<string, unknown>>;
2930
+ }>>;
2931
+ rules?: Array<Record<string, unknown>>;
2932
+ validation?: ProfileValidationDefinition[];
2933
+ editorDefaults?: Record<string, unknown>;
2934
+ };
2935
+ //#endregion
2936
+ //#region src/graphToXStateTS.d.ts
2937
+ interface XStateTSOptions extends MachineConfigOptions {
2938
+ exportStyle?: 'named' | 'default' | 'none';
2939
+ targetLanguage?: 'typescript' | 'javascript';
2940
+ xstateVersion?: 5 | 6;
2941
+ }
2942
+ declare function graphToXStateTS(graph: CodeGenGraph, options?: XStateTSOptions): string; //#endregion
2943
+ //#region src/jsonSchemaToTSType.d.ts
2944
+ declare function jsonSchemaToTSType(schema: JSONSchema7 | undefined | null): string;
2945
+ /**
2946
+ * Build an inline context type string from the schemas.context record.
2947
+ * Each key is a context property name, value is its JSONSchema7.
2948
+ */
2949
+ declare function contextSchemaToTSType(context: Record<string, JSONSchema7> | null | undefined): string | null;
2950
+ /**
2951
+ * Build an event union type from the schemas.events record.
2952
+ * Each key is the event type name, value describes the payload properties.
2953
+ */
2954
+ declare function eventsSchemaToTSType(events: Record<string, JSONSchema7> | null | undefined): string | null; //#endregion
2955
+ //#region src/graphPaths.d.ts
2890
2956
  //#endregion
2891
- export { $strip as A, ZodObject as C, ZodUnion as D, ZodString as E, ZodUnknown as O, ZodNumber as S, ZodRecord as T, serializeJS as _, EditorStateType as a, ZodLiteral as b, MachineConfigOptions as c, contextSchemaToTSType as d, eventsSchemaToTSType as f, raw as g, jsonSchemaToTSType as h, CodeGenGraph as i, output as k, RawCode as l, graphToXStateTS as m, CanvasColor as n, GraphPatch as o, graphToMachineConfig as p, CodeExpression as r, ImplementationSourceType as s, ActionLocation as t, XStateTSOptions as u, ZodArray as v, ZodOptional as w, ZodNullable as x, ZodEnum as y };
2957
+ export { output as A, ZodNumber as C, ZodString as D, ZodRecord as E, ZodUnion as O, ZodNullable as S, ZodOptional as T, GraphPatch as _, RawCode as a, ZodEnum as b, eventsSchemaToTSType as c, jsonSchemaToTSType as d, raw as f, EditorStateType as g, CanvasColor as h, ProfileManifest as i, $strip as j, ZodUnknown as k, graphToMachineConfig as l, ActionLocation as m, CodeGenGraph as n, XStateTSOptions as o, serializeJS as p, MachineConfigOptions as r, contextSchemaToTSType as s, CodeExpression as t, graphToXStateTS as u, ImplementationSourceType as v, ZodObject as w, ZodLiteral as x, ZodArray as y };