toilscript 0.1.37 → 0.1.39
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/dist/cli.generated.d.ts +265 -11
- package/dist/cli.js +15 -11
- package/dist/cli.js.map +3 -3
- package/dist/importmap.json +2 -2
- package/dist/toilscript.generated.d.ts +265 -11
- package/dist/toilscript.js +210 -199
- package/dist/toilscript.js.map +3 -3
- package/dist/web.js +3 -3
- package/package.json +5 -2
- package/std/assembly/bindings/toildb.ts +6 -4
- package/std/assembly/toildb.ts +4 -2
- package/std/assembly/toilscript.d.ts +103 -0
package/dist/importmap.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"imports": {
|
|
3
|
-
"toilscript": "https://cdn.jsdelivr.net/npm/toilscript@0.1.
|
|
4
|
-
"toilscript/cli": "https://cdn.jsdelivr.net/npm/toilscript@0.1.
|
|
3
|
+
"toilscript": "https://cdn.jsdelivr.net/npm/toilscript@0.1.39/dist/toilscript.js",
|
|
4
|
+
"toilscript/cli": "https://cdn.jsdelivr.net/npm/toilscript@0.1.39/dist/cli.js",
|
|
5
5
|
"binaryen": "https://cdn.jsdelivr.net/npm/binaryen@130.0.0-nightly.20260609/index.js",
|
|
6
6
|
"long": "https://cdn.jsdelivr.net/npm/long@5.3.2/index.js"
|
|
7
7
|
}
|
|
@@ -593,7 +593,21 @@ declare module "types:toilscript/src/diagnosticMessages.generated" {
|
|
|
593
593
|
Multiple_consecutive_numeric_separators_are_not_permitted = 6189,
|
|
594
594
|
This_expression_is_not_callable_because_it_is_a_get_accessor_Did_you_mean_to_use_it_without = 6234,
|
|
595
595
|
_super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class = 17009,
|
|
596
|
-
_super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class = 17011
|
|
596
|
+
_super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class = 17011,
|
|
597
|
+
Decorator_0_is_not_valid_in_the_hot_request_artifact = 9000,
|
|
598
|
+
Decorator_0_is_not_valid_in_the_cold_daemon_artifact = 9001,
|
|
599
|
+
Only_one_daemon_class_is_allowed_per_project = 9002,
|
|
600
|
+
A_project_using_stream_cannot_declare_service_or_remote = 9003,
|
|
601
|
+
Scheduled_is_only_valid_inside_a_daemon_class = 9004,
|
|
602
|
+
Stream_hook_0_is_only_valid_inside_a_stream_class = 9005,
|
|
603
|
+
Duplicate_stream_hook_0 = 9006,
|
|
604
|
+
Stream_class_0_declares_no_lifecycle_hooks = 9007,
|
|
605
|
+
Daemon_class_0_declares_no_scheduled_tasks = 9008,
|
|
606
|
+
Decorator_0_does_not_accept_arguments = 9009,
|
|
607
|
+
Scheduled_requires_a_single_string_schedule_argument = 9010,
|
|
608
|
+
Scheduled_spec_0_is_not_a_valid_interval_or_cron_expression = 9011,
|
|
609
|
+
Scheduled_handler_0_must_take_no_arguments_and_return_void = 9012,
|
|
610
|
+
Stream_scope_must_be_a_StreamScope_enum_member = 9013
|
|
597
611
|
}
|
|
598
612
|
/** Translates a diagnostic code to its respective string. */
|
|
599
613
|
export function diagnosticCodeToString(code: DiagnosticCode): string;
|
|
@@ -2956,6 +2970,10 @@ declare module "types:toilscript/src/parser" {
|
|
|
2956
2970
|
dependees: Map<string, Dependee>;
|
|
2957
2971
|
/** Normalized paths whose `@rest` runtime import has already been injected. */
|
|
2958
2972
|
restImportedSources: Set<string>;
|
|
2973
|
+
/** Normalized paths whose `@stream` module-level registry + the single
|
|
2974
|
+
* `stream_dispatch` export have already been emitted (a project may declare
|
|
2975
|
+
* several `@stream` classes, but the export is emitted exactly once). */
|
|
2976
|
+
streamExportedSources: Set<string>;
|
|
2959
2977
|
/** Monotonic id handed to each `@ratelimit` route so the edge can key one
|
|
2960
2978
|
* shared limiter per route. Program-wide (one Parser per program), assigned
|
|
2961
2979
|
* deterministically in route declaration order. */
|
|
@@ -3077,6 +3095,99 @@ declare module "types:toilscript/src/parser" {
|
|
|
3077
3095
|
* return; plus a module-level self-registration into the runtime `Rest` router.
|
|
3078
3096
|
*/
|
|
3079
3097
|
private injectRestController;
|
|
3098
|
+
/**
|
|
3099
|
+
* Synthesize the cold-artifact daemon entry for a `@daemon` class (spec 03
|
|
3100
|
+
* sections 5.2 / 5.6 / 5.7, Reconciliation Part 2 cold exports). Mirrors
|
|
3101
|
+
* `injectRestController`: it scans the class methods once (same source-order
|
|
3102
|
+
* walk the `toildaemon.catalog` builder uses, so `task_index` <-> dispatch
|
|
3103
|
+
* index stay in lockstep), synthesizes a `__tick(task)` dispatcher onto the
|
|
3104
|
+
* class, and emits the two canonical cold module-level exports:
|
|
3105
|
+
*
|
|
3106
|
+
* `daemon_start(): i32` - runs once at cold-box boot; instantiates the
|
|
3107
|
+
* `@daemon` class, holds the single box-lifetime
|
|
3108
|
+
* instance, runs the optional `onStart()`, and
|
|
3109
|
+
* returns 0 (negative = Part 3 error bridge).
|
|
3110
|
+
* `scheduled_tick(task_id: i32): i64` - dispatches `instance.__tick(task_id)`
|
|
3111
|
+
* by switching on the catalog `task_index`;
|
|
3112
|
+
* returns 0 (negative = Part 3 error bridge).
|
|
3113
|
+
*
|
|
3114
|
+
* Unlike `injectRestController`, the exports are self-contained (they do NOT
|
|
3115
|
+
* route through an external runtime `Daemon` registry import). The injected
|
|
3116
|
+
* `register(...)` in `injectRestController` is pruned when nothing reachable
|
|
3117
|
+
* references it, but a top-level EXPORT that referenced an unresolved runtime
|
|
3118
|
+
* import would be a hard compile error (TS6054), so the host-called exports
|
|
3119
|
+
* are synthesized as plain top-level `export function`s and keep the one
|
|
3120
|
+
* box-lifetime instance in a module-level singleton (doc 03 D1 / section 2:
|
|
3121
|
+
* per-domain state lives in instance fields for the box lifetime).
|
|
3122
|
+
*
|
|
3123
|
+
* Fires diagnostic 9012 for a `@scheduled` method with a non-empty parameter
|
|
3124
|
+
* list or a non-void return type, and the 9008 warning for a `@daemon` class
|
|
3125
|
+
* with zero `@scheduled` tasks (a daemon may legitimately run only `onStart`).
|
|
3126
|
+
*/
|
|
3127
|
+
private injectDaemonHandler;
|
|
3128
|
+
/**
|
|
3129
|
+
* Synthesize the hot-artifact stream entry for a `@stream` class (spec 03
|
|
3130
|
+
* sections 5.1 / 5.4, Reconciliation Part 2 hot exports). Mirrors
|
|
3131
|
+
* `injectDaemonHandler`: it scans the class methods once (same source-order
|
|
3132
|
+
* walk the `toilstream.catalog` builder + `streamHookMask` use), classifies
|
|
3133
|
+
* each by lifecycle-hook kind (`@connect`/`@message`/`@close`/`@disconnect`),
|
|
3134
|
+
* synthesizes a `__streamDispatch(event_kind)` dispatcher onto the class, and
|
|
3135
|
+
* emits the canonical hot module-level export:
|
|
3136
|
+
*
|
|
3137
|
+
* `stream_dispatch(event_kind: i32, stream_id_lo: i32, stream_id_hi: i32): i64`
|
|
3138
|
+
* - the per-connection event entry, emitted EXACTLY ONCE per module. It
|
|
3139
|
+
* reconstructs the i64 stream id from the two i32 halves, selects the
|
|
3140
|
+
* active `@stream` class's dispatch thunk from a module-level registry
|
|
3141
|
+
* (one entry per `@stream` class, in `toilstream.catalog` `stream_index`
|
|
3142
|
+
* order), switches on `event_kind` (1 connect / 2 message / 3 close /
|
|
3143
|
+
* 4 disconnect, the FIXED Part 2 ABI values), and returns the hook's
|
|
3144
|
+
* packed-i64 result (0 = no output / accept; a negative value is the
|
|
3145
|
+
* Part 3 reject/error bridge, wired with the real ring/StreamOutbound
|
|
3146
|
+
* runtime in a later increment).
|
|
3147
|
+
*
|
|
3148
|
+
* Each `@stream` class keeps its own MODULE-SINGLETON instance (a resident
|
|
3149
|
+
* per-connection box): the dispatch thunk constructs it on first use and REUSES
|
|
3150
|
+
* it across every later event, so per-connection state in instance fields
|
|
3151
|
+
* persists for the connection lifetime (the ResetMode::None resident box of
|
|
3152
|
+
* `05`). The thunk-array + the single export mirror the spec's `Streams.register`
|
|
3153
|
+
* model, but SELF-CONTAINED (no external runtime import): like
|
|
3154
|
+
* `injectDaemonHandler`, a top-level export referencing an unresolved runtime
|
|
3155
|
+
* import would be a hard compile error (TS6054), so the registry + the export
|
|
3156
|
+
* are plain module-level code emitted once (guarded by `streamExportedSources`,
|
|
3157
|
+
* exactly as `injectRestController` guards its one-per-source import).
|
|
3158
|
+
*
|
|
3159
|
+
* The `event_kind` ids are exactly the `toilstream.catalog` hook bitmask bits
|
|
3160
|
+
* plus one (connect=1 <-> bit0, message=2 <-> bit1, close=3 <-> bit2,
|
|
3161
|
+
* disconnect=4 <-> bit3, matching `streamHookMask` in `dbcatalog.ts`), so the
|
|
3162
|
+
* dispatch and the catalog never schism. `event_kind = 5` (channel, F10) is a
|
|
3163
|
+
* later increment: the base AST carries no `@channel` kind and the catalog mask
|
|
3164
|
+
* is 4-bit, so this shim emits the four lifecycle arms only.
|
|
3165
|
+
*
|
|
3166
|
+
* Active-stream selection (which registry entry a connection routes to) is
|
|
3167
|
+
* owned by the host/ring runtime (spec 5.1: the `Streams` singleton resolves the
|
|
3168
|
+
* stream identity off the ring); this increment routes to the host-selected
|
|
3169
|
+
* index, defaulting to 0, so a single-`@stream` module dispatches exactly and a
|
|
3170
|
+
* multi-`@stream` module compiles to one well-formed export.
|
|
3171
|
+
*
|
|
3172
|
+
* Only hooks the class actually declares get a dispatch arm; an event for an
|
|
3173
|
+
* absent hook falls through to `return 0` (a no-op success per the contract,
|
|
3174
|
+
* never a crash). A hook that declares parameters (the typed `@message`
|
|
3175
|
+
* `@data` arg, or a `StreamInbound`/`StreamPacket` view) is given a no-op arm
|
|
3176
|
+
* here too: the `StreamInbound`/`StreamPacket`/`StreamOutbound` runtime + the
|
|
3177
|
+
* ingress-ring read are owned by toiljs (spec 5.4) and land in a later
|
|
3178
|
+
* increment, so this self-contained shim cannot synthesize those argument
|
|
3179
|
+
* values yet; calling a zero-arg hook directly is the part that compiles and
|
|
3180
|
+
* runs today (every gating/catalog fixture uses the zero-arg/void hook form).
|
|
3181
|
+
*
|
|
3182
|
+
* Fires the 9013 warning for a `@stream` class with zero lifecycle hooks (a
|
|
3183
|
+
* hookless stream can never receive traffic), mirroring the daemon 9008 warning
|
|
3184
|
+
* shape; gating already rejects a hook outside a `@stream`.
|
|
3185
|
+
*/
|
|
3186
|
+
private injectStreamHandler;
|
|
3187
|
+
/** True if a function signature takes no parameters and returns `void` (the
|
|
3188
|
+
* required `@scheduled` handler shape, spec 03 section 3.5). A missing or
|
|
3189
|
+
* non-`void`-named return type, or any parameter, is false. */
|
|
3190
|
+
private isVoidNoArgSignature;
|
|
3080
3191
|
/**
|
|
3081
3192
|
* Bind a `@user` class to `AuthService.getUser()` typing. The lib declares
|
|
3082
3193
|
* `getUser(): AuthUser | null`; here we inject a `@global` `AuthUser` that
|
|
@@ -3317,6 +3428,8 @@ declare module "types:toilscript/src/program" {
|
|
|
3317
3428
|
instancesByName: Map<string, Element>;
|
|
3318
3429
|
/** Function decorated with `@main` (toil module entry point), if any. */
|
|
3319
3430
|
mainFunction: FunctionPrototype | null;
|
|
3431
|
+
/** Class decorated with `@daemon` (cold L4 entry), if any. At most one per project. */
|
|
3432
|
+
daemonClass: ClassPrototype | null;
|
|
3320
3433
|
/** Classes wrapping basic types like `i32`. */
|
|
3321
3434
|
wrapperClasses: Map<Type, Class>;
|
|
3322
3435
|
/** Managed classes contained in the program, by id. */
|
|
@@ -3491,6 +3604,15 @@ declare module "types:toilscript/src/program" {
|
|
|
3491
3604
|
getElementByDeclaration(declaration: DeclarationStatement): DeclaredElement | null;
|
|
3492
3605
|
/** Initializes the program and its elements prior to compilation. */
|
|
3493
3606
|
initialize(): void;
|
|
3607
|
+
/**
|
|
3608
|
+
* Enforces the project-wide rule that a compilation unit using `@stream` cannot also
|
|
3609
|
+
* declare `@service` or `@remote` anywhere (spec 03 section 4.4). The host loads one
|
|
3610
|
+
* `hot.wasm` whose surface is either a stream node or an RPC service node, never both,
|
|
3611
|
+
* so mixing them is a deploy-time ambiguity caught fail-closed at compile time. Reported
|
|
3612
|
+
* at the offending `@service`/`@remote` site. Skipped in cold mode (neither flag is
|
|
3613
|
+
* admitted there anyway).
|
|
3614
|
+
*/
|
|
3615
|
+
private enforceStreamServiceExclusion;
|
|
3494
3616
|
/** Processes overridden members by this class in a base class. */
|
|
3495
3617
|
private processOverrides;
|
|
3496
3618
|
/** Processes a single overridden member by this class in a base class. */
|
|
@@ -3649,7 +3771,15 @@ declare module "types:toilscript/src/program" {
|
|
|
3649
3771
|
/** Is a `@collection` field within a `@database` class. */
|
|
3650
3772
|
Collection = 524288,
|
|
3651
3773
|
/** Is a `@query`/`@action`/`@job`/`@derive`/`@admin` function (ToilDB kind). */
|
|
3652
|
-
DbFunction = 1048576
|
|
3774
|
+
DbFunction = 1048576,
|
|
3775
|
+
/** Is a `@stream` protocol-handler class (L2/L3, hot artifact). */
|
|
3776
|
+
Stream = 2097152,
|
|
3777
|
+
/** Is a `@daemon` L4 always-on entry class (cold artifact, at most one). */
|
|
3778
|
+
Daemon = 4194304,
|
|
3779
|
+
/** Is a `@scheduled(spec)` task method inside a `@daemon` class. */
|
|
3780
|
+
Scheduled = 8388608,
|
|
3781
|
+
/** Is a `@connect`/`@message`/`@close`/`@disconnect` stream lifecycle hook. */
|
|
3782
|
+
StreamHook = 16777216
|
|
3653
3783
|
}
|
|
3654
3784
|
export namespace DecoratorFlags {
|
|
3655
3785
|
/** Translates a decorator kind to the respective decorator flag. */
|
|
@@ -4318,11 +4448,31 @@ declare module "types:toilscript/src/dbcatalog" {
|
|
|
4318
4448
|
* `schema_version`: a hash over the ORDERED field layout (name, type, is_array),
|
|
4319
4449
|
* NOT the value-type name. Adding, removing, retyping, or REORDERING a field
|
|
4320
4450
|
* changes it - so the runtime can tell a compatible (append-only) change from a
|
|
4321
|
-
* breaking one, instead of silently misreading old rows.
|
|
4322
|
-
*
|
|
4323
|
-
*
|
|
4451
|
+
* breaking one, instead of silently misreading old rows.
|
|
4452
|
+
*
|
|
4453
|
+
* RECURSIVE into nested `@data` types: when a field's `typeName` is a KNOWN
|
|
4454
|
+
* `@data` type (a key of `typeMap`) and not already on the `seen` set (cycle
|
|
4455
|
+
* guard), the SAME running hash continues over that nested type's fields - so a
|
|
4456
|
+
* breaking change to a NESTED type bumps the OUTER `schema_version` and can be
|
|
4457
|
+
* `@migrate`d (instead of being refuse-only). This MUST stay byte-identical to
|
|
4458
|
+
* toildb's `SchemaDescriptor::layout_hash` (the runtime side): the algorithm,
|
|
4459
|
+
* the `seen` add/remove, and the declaration-order traversal are pinned in lock
|
|
4460
|
+
* step. A FLAT type (no field whose type is in `typeMap`) hashes to the SAME
|
|
4461
|
+
* value as the old flat hash, so existing pinned vectors stay green; an absent
|
|
4462
|
+
* `typeMap` (undefined) is flat/back-compatible.
|
|
4463
|
+
*
|
|
4464
|
+
* `typeMap` MUST contain the SAME set of `@data` types as the runtime's
|
|
4465
|
+
* `toildb.types` registry (collection value types + their nested types, EXCLUDING
|
|
4466
|
+
* old `*.migration.ts` shapes), or the two hashes diverge: a nested field whose
|
|
4467
|
+
* type is absent from the map on either side is treated as a LEAF on both sides.
|
|
4324
4468
|
*/
|
|
4325
|
-
export function layoutHash(fields: FieldLayout[]): number;
|
|
4469
|
+
export function layoutHash(fields: FieldLayout[], typeMap?: Map<string, FieldLayout[]> | null, seen?: Set<string> | null): number;
|
|
4470
|
+
/** The recursion type map for `layoutHash`: every `@data` type the runtime's
|
|
4471
|
+
* `toildb.types` registry also contains (collection value types + their nested
|
|
4472
|
+
* types), EXCLUDING old `*.migration.ts` shapes (which the runtime registry
|
|
4473
|
+
* excludes by design). Both sides must recurse through the SAME set, so a
|
|
4474
|
+
* nested field whose type is NOT here is a leaf on both sides. */
|
|
4475
|
+
export function recursionTypeMap(sources: Source[]): Map<string, FieldLayout[]>;
|
|
4326
4476
|
/** Extract the encoded field layout of a `@data` class, in declaration order,
|
|
4327
4477
|
* mirroring `injectDataCodec` (skip static; `Array<T>` -> element + array flag;
|
|
4328
4478
|
* else scalar/string/`Uint8Array`/nested-`@data` by its type name). */
|
|
@@ -4339,10 +4489,14 @@ declare module "types:toilscript/src/dbcatalog" {
|
|
|
4339
4489
|
sourceInternalPath: string;
|
|
4340
4490
|
}
|
|
4341
4491
|
/** Every `@migrate` function across the (non-library) sources. `layouts` maps a
|
|
4342
|
-
* `@data` class name to its field layout, for the old-version hash.
|
|
4343
|
-
*
|
|
4344
|
-
*
|
|
4345
|
-
|
|
4492
|
+
* `@data` class name to its field layout, for the old-version hash. `typeMap`
|
|
4493
|
+
* (optional) is the recursion type map (see [`recursionTypeMap`]) so the old
|
|
4494
|
+
* version hashes RECURSIVELY through its nested `@data` fields - matching the
|
|
4495
|
+
* `schema_version` that old layout was deployed under (or the migratable old
|
|
4496
|
+
* version would never match a deployed recursive hash). Absent = flat. A
|
|
4497
|
+
* migration whose param/return is not a single named type, or whose old type
|
|
4498
|
+
* has no layout, is skipped. */
|
|
4499
|
+
export function collectMigrations(sources: Source[], layouts: Map<string, FieldLayout[]>, typeMap?: Map<string, FieldLayout[]> | null): DataMigration[];
|
|
4346
4500
|
/** A resolved chain that migrates a stored OLD value all the way to a target
|
|
4347
4501
|
* type: decode `oldType`, then apply `steps` in order (each `@migrate`). For a
|
|
4348
4502
|
* direct migration `steps` has one entry; a chain `V0 -> V1 -> V2` has two. */
|
|
@@ -4363,6 +4517,94 @@ declare module "types:toilscript/src/dbcatalog" {
|
|
|
4363
4517
|
*/
|
|
4364
4518
|
export function buildToilDbCatalog(program: Program): Uint8Array | null;
|
|
4365
4519
|
export function buildToilDbTypes(program: Program): Uint8Array | null;
|
|
4520
|
+
/** Build the `toildb.route_kinds` section bytes, or `null` when no route needs
|
|
4521
|
+
* an extra runtime DB-policy clamp. The edge already derives the default kind
|
|
4522
|
+
* from the trusted HTTP method. This section only carries the stricter source
|
|
4523
|
+
* signal that the method clamp cannot infer: mutating-method routes explicitly
|
|
4524
|
+
* declared `@query`.
|
|
4525
|
+
*
|
|
4526
|
+
* Wire format (LE):
|
|
4527
|
+
* u16 format_version = 1
|
|
4528
|
+
* u16 n_routes
|
|
4529
|
+
* per route:
|
|
4530
|
+
* u8 method (same values as runtime Methods / request envelope)
|
|
4531
|
+
* u8 function_kind (0 = Query)
|
|
4532
|
+
* str route_pattern (same normalized pattern emitted into __toilMatch)
|
|
4533
|
+
*/
|
|
4534
|
+
export function buildToilDbRouteKinds(program: Program): Uint8Array | null;
|
|
4535
|
+
/** Build the `toilstream.catalog` section bytes, or `null` if the program
|
|
4536
|
+
* declares no `@stream` class. Per Part 5 (LE):
|
|
4537
|
+
*
|
|
4538
|
+
* u16 format_version = 1
|
|
4539
|
+
* u16 n_streams
|
|
4540
|
+
* per stream:
|
|
4541
|
+
* str name
|
|
4542
|
+
* str route
|
|
4543
|
+
* u8 hook_presence_bitmask (bit0 connect..bit3 disconnect)
|
|
4544
|
+
* u8 declared_scope (0 regional/L2, 1 continental/L3)
|
|
4545
|
+
* u8 message_mode (0 raw, 1 @data-typed)
|
|
4546
|
+
* u32 max_frame_bytes (0 = use plan default)
|
|
4547
|
+
* u32 ingress_ring_bytes (0 = host chooses)
|
|
4548
|
+
* u32 message_value_data_id (fnv1a(typeName); 0 when raw)
|
|
4549
|
+
* u32 message_schema_version (recursive layoutHash; 0 when raw)
|
|
4550
|
+
* u16 stream_index (0-based position in this array)
|
|
4551
|
+
*/
|
|
4552
|
+
export function buildToilStreamCatalog(program: Program): Uint8Array | null;
|
|
4553
|
+
/** Build the `toildaemon.catalog` section bytes, or `null` if the program
|
|
4554
|
+
* declares no `@daemon` class. Per Part 5 (LE):
|
|
4555
|
+
*
|
|
4556
|
+
* u16 format_version = 1
|
|
4557
|
+
* u8 has_daemon
|
|
4558
|
+
* u16 n_scheduled
|
|
4559
|
+
* per task:
|
|
4560
|
+
* str name
|
|
4561
|
+
* u16 task_index
|
|
4562
|
+
* u8 schedule_kind (0 interval, 1 cron)
|
|
4563
|
+
* u64 interval_ms
|
|
4564
|
+
* u64 cron_minute_mask (bits 0..59)
|
|
4565
|
+
* u32 cron_hour_mask
|
|
4566
|
+
* u32 cron_dom_mask
|
|
4567
|
+
* u16 cron_month_mask
|
|
4568
|
+
* u8 cron_dow_mask
|
|
4569
|
+
* u8 overlap_policy (0 default)
|
|
4570
|
+
* u8 catchup_policy (0 default)
|
|
4571
|
+
* u64 gas_hint
|
|
4572
|
+
*
|
|
4573
|
+
* Parses each `@scheduled(spec)` argument; fires diagnostics 9010/9011 for a
|
|
4574
|
+
* missing/non-string arg or an unparseable spec.
|
|
4575
|
+
*/
|
|
4576
|
+
export function buildToilDaemonCatalog(program: Program): Uint8Array | null;
|
|
4577
|
+
/** Build the `toil.surface` section bytes (always emitted per artifact). Per
|
|
4578
|
+
* Part 5 (LE):
|
|
4579
|
+
*
|
|
4580
|
+
* u16 format_version = 1
|
|
4581
|
+
* u8 target_mode (0 hot, 1 cold)
|
|
4582
|
+
* u8 reserved0 (0)
|
|
4583
|
+
* u32 surface_flags (bit0 rest..bit5 render)
|
|
4584
|
+
* u16 abi_version
|
|
4585
|
+
* str build_id
|
|
4586
|
+
* u32 fingerprint
|
|
4587
|
+
* u32 data_coherence_hash
|
|
4588
|
+
* u32 pair_coherence_hash
|
|
4589
|
+
*
|
|
4590
|
+
* `targetMode` "cold" -> 1; "hot" or null (legacy single artifact, treated as
|
|
4591
|
+
* hot per Part 5) -> 0. The two coherence hashes use the SAME `layoutHash` /
|
|
4592
|
+
* `recursionTypeMap` machinery as the toildb catalog, so a hot pass and a cold
|
|
4593
|
+
* pass over the same sources compute identical `data_coherence_hash` and
|
|
4594
|
+
* `pair_coherence_hash` independently (doc 02 AN-4). `build_id` is empty and
|
|
4595
|
+
* `abi_version` is 1 in this increment (the toiljs build-identity plumbing and
|
|
4596
|
+
* the export-name fingerprint component land with the codegen increment).
|
|
4597
|
+
*
|
|
4598
|
+
* Returns `null` (no section) for a bare AssemblyScript module compiled in
|
|
4599
|
+
* LEGACY mode (`targetMode == null`) that declares NO Toil surface at all
|
|
4600
|
+
* (`@rest`/`@stream`/`@daemon`/`@scheduled`/`@database`/`@data`), so an ordinary
|
|
4601
|
+
* AS compile stays byte-identical (the same gating philosophy as the existing
|
|
4602
|
+
* `toildb.catalog`, which is absent without `@database`). Part 5 / doc 02 AN-2
|
|
4603
|
+
* requires the section in every TOIL artifact (including a legacy single-artifact
|
|
4604
|
+
* toil build, which always carries a toil surface); a non-toil module is not a
|
|
4605
|
+
* toil artifact. An explicit `--targetMode hot|cold` always emits the section.
|
|
4606
|
+
*/
|
|
4607
|
+
export function buildToilSurface(program: Program, targetMode: string | null): Uint8Array | null;
|
|
4366
4608
|
}
|
|
4367
4609
|
declare module "types:toilscript/src/passes/pass" {
|
|
4368
4610
|
/**
|
|
@@ -4809,6 +5051,9 @@ declare module "types:toilscript/src/compiler" {
|
|
|
4809
5051
|
constructor();
|
|
4810
5052
|
/** WebAssembly target. Defaults to {@link Target.Wasm32}. */
|
|
4811
5053
|
target: Target;
|
|
5054
|
+
/** Toil compile surface mode. null = legacy single-artifact build (all surfaces allowed,
|
|
5055
|
+
* matching pre-split behavior). "hot" = request + stream surface. "cold" = daemon surface. */
|
|
5056
|
+
targetMode: string | null;
|
|
4812
5057
|
/** Runtime type. Defaults to Incremental GC. */
|
|
4813
5058
|
runtime: Runtime;
|
|
4814
5059
|
/** If true, indicates that debug information will be emitted by Binaryen. */
|
|
@@ -7972,7 +8217,14 @@ declare module "types:toilscript/src/ast" {
|
|
|
7972
8217
|
Job = 35,
|
|
7973
8218
|
Derive = 36,
|
|
7974
8219
|
Migrate = 37,
|
|
7975
|
-
Admin = 38
|
|
8220
|
+
Admin = 38,
|
|
8221
|
+
Daemon = 39,// @daemon class decorator (L4 entry; at most one per project)
|
|
8222
|
+
Scheduled = 40,// @scheduled(spec) method decorator inside a @daemon class
|
|
8223
|
+
Stream = 41,// @stream class decorator (L2/L3 stream protocol handler)
|
|
8224
|
+
Connect = 42,// @connect method in a @stream class (lifecycle hook)
|
|
8225
|
+
Message = 43,// @message method in a @stream class (lifecycle hook)
|
|
8226
|
+
Close = 44,// @close method in a @stream class (lifecycle hook)
|
|
8227
|
+
Disconnect = 45
|
|
7976
8228
|
}
|
|
7977
8229
|
export namespace DecoratorKind {
|
|
7978
8230
|
/** Returns the kind of the specified decorator name node. Defaults to {@link DecoratorKind.CUSTOM}. */
|
|
@@ -9712,6 +9964,8 @@ declare module "types:toilscript/src/index-wasm" {
|
|
|
9712
9964
|
export function setExportStart(options: Options, exportStart: string | null): void;
|
|
9713
9965
|
/** Sets the `noUnsafe` option. */
|
|
9714
9966
|
export function setNoUnsafe(options: Options, noUnsafe: boolean): void;
|
|
9967
|
+
/** Sets the `targetMode` option ("hot", "cold", or null for legacy single-artifact). */
|
|
9968
|
+
export function setTargetMode(options: Options, targetMode: string | null): void;
|
|
9715
9969
|
/** Sets the `lowMemoryLimit` option. */
|
|
9716
9970
|
export function setLowMemoryLimit(options: Options, lowMemoryLimit: number): void;
|
|
9717
9971
|
/** Sets the `exportRuntime` option. */
|