@wenathlan/extension 1.1.50 → 1.1.52

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.
@@ -0,0 +1,151 @@
1
+ import type { manualrun, rulestats, triggerfamily, triggerfire, triggerstate, triggerule, workflowrecord } from "./types.js";
2
+ /**
3
+ * Trigger and scheduling engine for the 1.1.52 family.
4
+ * Every correlated rule of the trigger phase lives in this file: the trigger family and kind lists, the family payload normalizers, the five field cron parser with named weekdays and months and its timezone aware next fire computation, the interval scheduler that spreads repeated fires with the configured seeded jitter, the glob url matcher with ports, the visit origin matcher, the cooldown suppressor, the dedupe and queue discipline that keeps one pending fire per rule while a run is active, the url list planner that starts one run per url, the webhook verifier of the shared secret and payload schema, the observed event catalog matcher, the pause and resume suspension with the resume drain, the trigger evaluation that skips disabled, paused, unreviewed or cooled down rules, the manual run step preview with its confirmation outcome and the rule summaries the review panel renders.
5
+ * The engine stays pure: the launch of a run flows through the injected launch seam so tests run on plain fixtures, and no trigger fires outside the consent gates — every rule is reviewed before it arms and every launch re-passes the session, plan and origin gates.
6
+ */
7
+ /** The trigger kinds of the 1.1.52 family: one kind per trigger rule family, each arming its rule behind the explicit arm review. */
8
+ export declare const triggerkinds: string[];
9
+ /** The trigger rule families the engine matches, schedules and observes. */
10
+ export declare const triggerfamilies: triggerfamily[];
11
+ /** The observed page event catalog event rules subscribe to: the mutation, focus, banner, console, error and navigation observations the extension already watches. */
12
+ export declare const triggereventcatalog: string[];
13
+ /** The documented default cooldown window of the webhook and event families when the review configures none; it is a documented default, never a cap, and any user configured window wins. */
14
+ export declare const defaulttriggercooldown = 10000;
15
+ /** True when the kind belongs to the trigger family of the 1.1.52 release. */
16
+ export declare function istriggerkind(kind: string): boolean;
17
+ /** Maps one trigger action kind to its rule family. */
18
+ export declare function triggerfamilyof(kind: string): triggerfamily | undefined;
19
+ /** Normalizes one family payload of a trigger rule and returns the family specific fields; the shared workflowid, cooldown and review flag stay with the caller. */
20
+ export declare function triggerpayloadof(family: triggerfamily, value: unknown): Partial<triggerule> | undefined;
21
+ /** True when a webhook shared secret clears the documented entropy floor: at least twenty four characters mixing letters and digits; the floor is a floor, not a cap, and any longer secret wins. */
22
+ export declare function webhooksecretok(secret: string): boolean;
23
+ /** True when the timezone name resolves through the runtime timezone database. */
24
+ export declare function timezonevalid(timezone: string): boolean;
25
+ /** Builds one armed trigger rule from the reviewed arm payload: the family normalizer validates the match fields, the effective cooldown applies the documented default of the webhook and event families and the rule starts enabled with zeroed counters. */
26
+ export declare function armrule(input: {
27
+ id?: string;
28
+ family: triggerfamily;
29
+ workflowid: string;
30
+ label?: string;
31
+ payload: unknown;
32
+ cooldown?: number;
33
+ now: number;
34
+ }): triggerule | undefined;
35
+ /** The shared state of one rule update so enable, disable, pause, resume and fire bookkeeping stay immutable. */
36
+ export declare function updaterule(rule: triggerule, patch: {
37
+ state?: Partial<triggerstate>;
38
+ stats?: Partial<rulestats>;
39
+ }): triggerule;
40
+ /** Matches one glob url pattern against one navigation url: the schemes and hostnames must agree, an explicit pattern port must match while an absent port matches any port, and the path plus query glob accepts `*` inside one segment and `**` across segments. */
41
+ export declare function matchurl(pattern: string, url: string): boolean;
42
+ /** True when a navigation url lands on one of the reviewed origins of a visit rule. */
43
+ export declare function visitmatch(origins: string[], url: string): boolean;
44
+ /** The five field cron parser: minute, hour, day of month, month and day of week accept `*`, lists, ranges and steps, and named weekdays (sun to sat) and months (jan to dec); day of week accepts zero and seven as sunday. */
45
+ export declare function cronparse(expression: string): {
46
+ minutes: number[];
47
+ hours: number[];
48
+ daysofmonth: number[];
49
+ months: number[];
50
+ daysofweek: number[];
51
+ } | undefined;
52
+ /** Computes the next fire time of a five field cron expression strictly after the given time: minute boundaries in UTC or the reviewed timezone; a schedule that never fires inside the four year horizon returns undefined so the honest no fire outcome travels on. */
53
+ export declare function cronnext(expression: string, from: number, timezone?: string): number | undefined;
54
+ /** Computes the next fire time of a cron rule strictly after the given time. */
55
+ export declare function schedulecron(rule: {
56
+ cron: string;
57
+ timezone?: string;
58
+ }, from: number): number | undefined;
59
+ /** Computes the next fire time of an interval rule: the reviewed period after the last fire (or the arm time of the first pass) spread with the seeded jitter window so repeated fires never bunch at the minimum. */
60
+ export declare function scheduleinterval(rule: {
61
+ period: number;
62
+ jitter?: number;
63
+ }, lastfire: number | undefined, armedat: number, seed: number): number;
64
+ /** Returns every scheduled rule whose next fire time has passed; the alarm wake and the opportunistic service worker wakes drain this list. */
65
+ export declare function listdue(rules: triggerule[], now: number): Array<{
66
+ rule: triggerule;
67
+ overdueby: number;
68
+ }>;
69
+ /** Applies the cooldown window of one rule: a fire inside the window after the last fire is suppressed with the remaining window, a fire at or after it passes. */
70
+ export declare function applycooldown(rule: triggerule, now: number): {
71
+ suppressed: boolean;
72
+ remaining: number;
73
+ };
74
+ /** The outcome of one trigger evaluation: the launch plan when the rule fires or the honest suppression reason. */
75
+ export interface triggerdecision {
76
+ fired: boolean;
77
+ suppressed?: string;
78
+ remaining?: number;
79
+ fire?: triggerfire;
80
+ }
81
+ /** Evaluates one armed rule against one observation: disabled, paused and rules whose workflow lost its approved review never fire, a run of the same workflow already active dedupes, the cooldown window suppresses and every passing fire carries the triggering url, title and payload into the run context. */
82
+ export declare function evaluatetrigger(input: {
83
+ rule: triggerule;
84
+ now: number;
85
+ cause: string;
86
+ url?: string;
87
+ title?: string;
88
+ payload?: Record<string, unknown>;
89
+ runactive: boolean;
90
+ workflowreviewed: boolean;
91
+ }): triggerdecision;
92
+ /** Queues one fire that arrived while the target run or tab was busy; the queue keeps one pending fire per rule so repeated observations dedupe instead of piling up. */
93
+ export declare function queuefire(queue: triggerfire[], fire: triggerfire): {
94
+ queue: triggerfire[];
95
+ queued: boolean;
96
+ deduped: boolean;
97
+ };
98
+ /** Drains the queued fires in arrival order through the injected launch seam; a launch that throws leaves the failed fire and the remaining queue intact so the next wake retries it. */
99
+ export declare function drainqueue(queue: triggerfire[], launch: (fire: triggerfire) => Promise<void>): Promise<{
100
+ launched: number;
101
+ remaining: triggerfire[];
102
+ }>;
103
+ /** Plans one run per url of a url list rule: every url becomes its own trigger fire carrying the url into the run context; nothing is capped in code. */
104
+ export declare function runurllist(rule: triggerule, now: number): triggerfire[];
105
+ /** Verifies one webhook delivery: the shared secret must equal the reviewed secret compared character by character without early exit and the payload must satisfy every required schema field of its reviewed kind; only verified payloads persist. */
106
+ export declare function verifywebhook(input: {
107
+ rule: triggerule;
108
+ secret: string;
109
+ payload: unknown;
110
+ }): {
111
+ verified: boolean;
112
+ reason?: string;
113
+ };
114
+ /** True when one observed page event name matches an event rule subscription of the observed event catalog. */
115
+ export declare function eventrulematches(rule: triggerule, event: string): boolean;
116
+ /** Subscribes the armed event rules to one observed page event: returns every enabled, unpaused event rule whose subscription list names the event of the observed catalog, so the page observation seam (watched mutations, focus shifts, banners, console output, captured errors and navigations) can fire exactly those rules. */
117
+ export declare function observeevents(rules: triggerule[], event: string): triggerule[];
118
+ /** Suspends every enabled rule by setting its pause marker so session pauses hold fires instead of losing them. */
119
+ export declare function pauseall(rules: triggerule[], now: number): triggerule[];
120
+ /** Clears the pause marker of every rule so the resume drains the queued fires through the same gates. */
121
+ export declare function resumeall(rules: triggerule[]): triggerule[];
122
+ /** Builds the manual run step preview of one composed workflow: every expanded step with its kind, label, block and control summary so a human always sees what a run will do before confirming it. */
123
+ export declare function manualpreview(record: workflowrecord, now: number): manualrun;
124
+ /** Records the confirmation outcome of one manual run preview; an undecided preview keeps its confirmation open. */
125
+ export declare function confirmmanualrun(preview: manualrun, confirmed: boolean, now: number): manualrun;
126
+ /** Builds the review summary of one armed rule for the trigger list: the family, the match fields, the workflow reference, the effective cooldown and the schedule. */
127
+ export declare function triggersummary(rule: triggerule): {
128
+ kind: triggerfamily;
129
+ workflowid: string;
130
+ label: string;
131
+ origins?: string[];
132
+ pattern?: string;
133
+ title?: string;
134
+ command?: string;
135
+ key?: string;
136
+ cron?: string;
137
+ timezone?: string;
138
+ period?: number;
139
+ jitter?: number;
140
+ urls?: string[];
141
+ events?: string[];
142
+ fields?: number;
143
+ cooldown: number;
144
+ enabled: boolean;
145
+ nextfireat?: number;
146
+ };
147
+ /** Returns every origin a rule touches so the arm review and the fire gates can check them against the workflow grants: visit origins, the url pattern origin, the url list origins and the webhook delivery origin stay inside the workflow grant list. */
148
+ export declare function ruleorigins(rule: triggerule): string[];
149
+ /** True when every origin a rule touches stays inside the granted origin list of its workflow. */
150
+ export declare function ruleoriginsgranted(rule: triggerule, workfloworigins: string[]): boolean;
151
+ //# sourceMappingURL=trigger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trigger.d.ts","sourceRoot":"","sources":["../trigger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAgB,cAAc,EAAE,MAAM,YAAY,CAAC;AAI3I;;;;GAIG;AAEH,qIAAqI;AACrI,eAAO,MAAM,YAAY,EAAE,MAAM,EAAyI,CAAC;AAE3K,4EAA4E;AAC5E,eAAO,MAAM,eAAe,EAAE,aAAa,EAAiG,CAAC;AAE7I,uKAAuK;AACvK,eAAO,MAAM,mBAAmB,EAAE,MAAM,EAAkE,CAAC;AAE3G,8LAA8L;AAC9L,eAAO,MAAM,sBAAsB,QAAS,CAAC;AAE7C,8EAA8E;AAC9E,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEnD;AAED,uDAAuD;AACvD,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAGvE;AAuCD,oKAAoK;AACpK,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,GAAG,SAAS,CAyDvG;AAED,qMAAqM;AACrM,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAIvD;AAED,kFAAkF;AAClF,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export declare const protocolversion: "1.1.50";
1
+ export declare const protocolversion: "1.1.52";
2
2
  /** Every reviewed action kind. Read kinds observe, interaction kinds move focus, sensitive kinds change page or browser state. */
3
- export type actionkind = "observe" | "inspect" | "extract" | "wait" | "waitfor" | "waittext" | "readattribute" | "readstyle" | "readgeometry" | "readvalue" | "readtext" | "readhtml" | "countelements" | "readtable" | "readlinks" | "readimages" | "readmeta" | "readforms" | "readstorage" | "highlight" | "tablist" | "windowlist" | "tabsnapshot" | "focus" | "scroll" | "hover" | "clickdeep" | "rightclick" | "doubleclick" | "scrollpage" | "scrollby" | "scrollend" | "scrolltop" | "fullscreen" | "zoomset" | "click" | "type" | "navigate" | "select" | "presskey" | "drag" | "drop" | "upload" | "clear" | "check" | "uncheck" | "toggle" | "submit" | "reload" | "back" | "forward" | "writestorage" | "setattribute" | "removeattribute" | "evaluate" | "tabcreate" | "tabactivate" | "tabclose" | "tabreload" | "windowcreate" | "windowclose" | "windowresize" | "downloadfile" | "movepointer" | "clickpoint" | "shiftclick" | "clicktext" | "clickaria" | "clickname" | "resolvexpath" | "typetime" | "appendtext" | "setvalue" | "typeedit" | "keyhold" | "keyrelease" | "submitsearch" | "selectmulti" | "chooseradio" | "setslider" | "setdate" | "setcolor" | "expanddetails" | "dismissdialog" | "pierceshadow" | "enterframe" | "retryaction" | "mapclicks" | "verifyvisible" | "verifyenabled" | "a11ytree" | "readvisible" | "readertree" | "detectlists" | "detecttables" | "readjson" | "watchmutate" | "waitquiet" | "watchbanner" | "detectinfinitescroll" | "detectvirtual" | "detectlazy" | "readscrollpos" | "readlang" | "readoutline" | "countpages" | "listshadow" | "listframes" | "classifypage" | "fingerprintsection" | "diffsnapshots" | "readselection" | "watchfocus" | "detectsticky" | "detectscrolllock" | "readopengraph" | "detectlanguage" | "deriveselector" | "openlink" | "openprivate" | "reloadcache" | "stopnav" | "waitload" | "waiturl" | "followlink" | "spanav" | "spawait" | "rewritequery" | "setfragment" | "navlist" | "navprofile" | "detecthttp" | "readredirects" | "readfinalurl" | "handleauth" | "printpdf" | "prefetch" | "preconnect" | "deeplink" | "reopentab" | "trailaudit" | "pausenav" | "navintent" | "navrate" | "openclipboard" | "checksafe" | "batchopen" | "querytabs" | "duplicatetab" | "closepattern" | "pintab" | "mutetab" | "movetab" | "movetabwindow" | "grouptabs" | "colorgroup" | "collapsegroup" | "discardtab" | "reloadtabs" | "zoomin" | "zoomout" | "watchtab" | "switchtab" | "maximizewindow" | "minimizewindow" | "restorewindow" | "focuswindow" | "scratchwindow" | "incognitowindow" | "restoretab" | "savelayout" | "restorelayout" | "findclones" | "searchtabs" | "badgetab" | "attachmeta" | "listaudio" | "reopenrun" | "snapshotsession" | "fillform" | "filllabel" | "fillplaceholder" | "detectfields" | "generatevalues" | "saveprofiles" | "asksubmit" | "submitform" | "readerrors" | "retryform" | "runwizard" | "selectchain" | "picktypeahead" | "pickdate" | "attachfile" | "handoffcaptcha" | "fillcard" | "fillcode" | "consentpassword" | "skiphoneypot" | "detectlogin" | "detecttemplate" | "scrapetable" | "exportcsv" | "exportjson" | "exportexcel" | "copytable" | "pushsheets" | "importcsv" | "looprows" | "transformvalues" | "deduperows" | "paginateextract" | "mergepages" | "stamplerows" | "previewgrid" | "streamdisk" | "resumeextract" | "logprovenance" | "batchdownload" | "pausedownload" | "resumedownload" | "verifydownload" | "interceptmime" | "exportnetlog" | "readclipboard" | "writeclipboard" | "copyscreen" | "quarantinedownload" | "scanvirus" | "namecaptures" | "cleanupartifacts" | "shotview" | "shotfullpage" | "shotelement" | "shotregion" | "contactsheet" | "capturepdf" | "recordscreen" | "captureaudio" | "captureframe" | "downloadimages" | "shotcanvas" | "probestream" | "readmedia" | "readassets" | "timelapse" | "convertimage" | "makethumbs" | "fetchurl" | "parsejson" | "parsehtml" | "callrest" | "callgraphql" | "opensocket" | "sendmessage" | "waitmessage" | "watchrequests" | "readheaders" | "capturebodies" | "subscribesse" | "longpoll" | "mapapi" | "extractapi" | "blockrequest" | "mockresponse" | "rewriteheaders" | "setcookies" | "readcookies" | "clearcookies" | "authflow" | "saveapikey" | "routeproxy" | "postform" | "postfiles" | "watchconsole" | "watcherrors" | "watchtasks" | "attachcdp" | "detachcdp" | "cdpcmd" | "watchcdp" | "setbreakpoint" | "stepcode" | "watchexpr" | "overridescript" | "measureflow" | "heapshot" | "trackmemory" | "profilecpu" | "watchshifts" | "traceload" | "annotatetrace" | "replaytrace" | "capturesourcemaps" | "emulatedevice" | "emulatenetwork" | "emulatelocate" | "setuseragent" | "overridepermission" | "blackboxscripts" | "persiststate" | "capturesession" | "restoresession" | "namedsessions" | "diffsessions" | "searchsessions" | "exportsessions" | "importsessions" | "composeworkflow" | "savetemplate" | "runworkflow" | "dryrun" | "delay" | "waitelement" | "compute" | "extractvars";
3
+ export type actionkind = "observe" | "inspect" | "extract" | "wait" | "waitfor" | "waittext" | "readattribute" | "readstyle" | "readgeometry" | "readvalue" | "readtext" | "readhtml" | "countelements" | "readtable" | "readlinks" | "readimages" | "readmeta" | "readforms" | "readstorage" | "highlight" | "tablist" | "windowlist" | "tabsnapshot" | "focus" | "scroll" | "hover" | "clickdeep" | "rightclick" | "doubleclick" | "scrollpage" | "scrollby" | "scrollend" | "scrolltop" | "fullscreen" | "zoomset" | "click" | "type" | "navigate" | "select" | "presskey" | "drag" | "drop" | "upload" | "clear" | "check" | "uncheck" | "toggle" | "submit" | "reload" | "back" | "forward" | "writestorage" | "setattribute" | "removeattribute" | "evaluate" | "tabcreate" | "tabactivate" | "tabclose" | "tabreload" | "windowcreate" | "windowclose" | "windowresize" | "downloadfile" | "movepointer" | "clickpoint" | "shiftclick" | "clicktext" | "clickaria" | "clickname" | "resolvexpath" | "typetime" | "appendtext" | "setvalue" | "typeedit" | "keyhold" | "keyrelease" | "submitsearch" | "selectmulti" | "chooseradio" | "setslider" | "setdate" | "setcolor" | "expanddetails" | "dismissdialog" | "pierceshadow" | "enterframe" | "retryaction" | "mapclicks" | "verifyvisible" | "verifyenabled" | "a11ytree" | "readvisible" | "readertree" | "detectlists" | "detecttables" | "readjson" | "watchmutate" | "waitquiet" | "watchbanner" | "detectinfinitescroll" | "detectvirtual" | "detectlazy" | "readscrollpos" | "readlang" | "readoutline" | "countpages" | "listshadow" | "listframes" | "classifypage" | "fingerprintsection" | "diffsnapshots" | "readselection" | "watchfocus" | "detectsticky" | "detectscrolllock" | "readopengraph" | "detectlanguage" | "deriveselector" | "openlink" | "openprivate" | "reloadcache" | "stopnav" | "waitload" | "waiturl" | "followlink" | "spanav" | "spawait" | "rewritequery" | "setfragment" | "navlist" | "navprofile" | "detecthttp" | "readredirects" | "readfinalurl" | "handleauth" | "printpdf" | "prefetch" | "preconnect" | "deeplink" | "reopentab" | "trailaudit" | "pausenav" | "navintent" | "navrate" | "openclipboard" | "checksafe" | "batchopen" | "querytabs" | "duplicatetab" | "closepattern" | "pintab" | "mutetab" | "movetab" | "movetabwindow" | "grouptabs" | "colorgroup" | "collapsegroup" | "discardtab" | "reloadtabs" | "zoomin" | "zoomout" | "watchtab" | "switchtab" | "maximizewindow" | "minimizewindow" | "restorewindow" | "focuswindow" | "scratchwindow" | "incognitowindow" | "restoretab" | "savelayout" | "restorelayout" | "findclones" | "searchtabs" | "badgetab" | "attachmeta" | "listaudio" | "reopenrun" | "snapshotsession" | "fillform" | "filllabel" | "fillplaceholder" | "detectfields" | "generatevalues" | "saveprofiles" | "asksubmit" | "submitform" | "readerrors" | "retryform" | "runwizard" | "selectchain" | "picktypeahead" | "pickdate" | "attachfile" | "handoffcaptcha" | "fillcard" | "fillcode" | "consentpassword" | "skiphoneypot" | "detectlogin" | "detecttemplate" | "scrapetable" | "exportcsv" | "exportjson" | "exportexcel" | "copytable" | "pushsheets" | "importcsv" | "looprows" | "transformvalues" | "deduperows" | "paginateextract" | "mergepages" | "stamplerows" | "previewgrid" | "streamdisk" | "resumeextract" | "logprovenance" | "batchdownload" | "pausedownload" | "resumedownload" | "verifydownload" | "interceptmime" | "exportnetlog" | "readclipboard" | "writeclipboard" | "copyscreen" | "quarantinedownload" | "scanvirus" | "namecaptures" | "cleanupartifacts" | "shotview" | "shotfullpage" | "shotelement" | "shotregion" | "contactsheet" | "capturepdf" | "recordscreen" | "captureaudio" | "captureframe" | "downloadimages" | "shotcanvas" | "probestream" | "readmedia" | "readassets" | "timelapse" | "convertimage" | "makethumbs" | "fetchurl" | "parsejson" | "parsehtml" | "callrest" | "callgraphql" | "opensocket" | "sendmessage" | "waitmessage" | "watchrequests" | "readheaders" | "capturebodies" | "subscribesse" | "longpoll" | "mapapi" | "extractapi" | "blockrequest" | "mockresponse" | "rewriteheaders" | "setcookies" | "readcookies" | "clearcookies" | "authflow" | "saveapikey" | "routeproxy" | "postform" | "postfiles" | "watchconsole" | "watcherrors" | "watchtasks" | "attachcdp" | "detachcdp" | "cdpcmd" | "watchcdp" | "setbreakpoint" | "stepcode" | "watchexpr" | "overridescript" | "measureflow" | "heapshot" | "trackmemory" | "profilecpu" | "watchshifts" | "traceload" | "annotatetrace" | "replaytrace" | "capturesourcemaps" | "emulatedevice" | "emulatenetwork" | "emulatelocate" | "setuseragent" | "overridepermission" | "blackboxscripts" | "persiststate" | "capturesession" | "restoresession" | "namedsessions" | "diffsessions" | "searchsessions" | "exportsessions" | "importsessions" | "composeworkflow" | "savetemplate" | "runworkflow" | "dryrun" | "delay" | "waitelement" | "compute" | "extractvars" | "condition" | "branch" | "loop" | "repeatuntil" | "whileloop" | "foreach" | "parallel" | "trycatch" | "visitrule" | "urlrule" | "menurule" | "keyrule" | "buttonrule" | "cronrule" | "intervalrule" | "urllistrule" | "webhookrule" | "eventrule";
4
4
  export type actionrisk = "read" | "interaction" | "sensitive";
5
5
  export type planstate = "draft" | "pending" | "approved" | "rejected" | "expired" | "completed" | "cancelled";
6
- export type auditkind = "configure" | "session" | "observe" | "proposal" | "approval" | "action" | "error" | "stop" | "pause" | "resume" | "complete" | "capability" | "tab" | "window" | "download" | "pointer" | "dialog" | "hold" | "retry" | "observation" | "watch" | "diff" | "navigation" | "redirect" | "auth" | "prefetch" | "rate" | "group" | "layout" | "discard" | "badge" | "fill" | "submit" | "consent" | "handoff" | "scrape" | "export" | "stream" | "provenance" | "resume" | "intercept" | "clipboard" | "quarantine" | "cleanup" | "capture" | "media" | "call" | "socket" | "replay" | "control" | "timeline" | "debugger" | "profile" | "emulation" | "workflow";
6
+ export type auditkind = "configure" | "session" | "observe" | "proposal" | "approval" | "action" | "error" | "stop" | "pause" | "resume" | "complete" | "capability" | "tab" | "window" | "download" | "pointer" | "dialog" | "hold" | "retry" | "observation" | "watch" | "diff" | "navigation" | "redirect" | "auth" | "prefetch" | "rate" | "group" | "layout" | "discard" | "badge" | "fill" | "submit" | "consent" | "handoff" | "scrape" | "export" | "stream" | "provenance" | "resume" | "intercept" | "clipboard" | "quarantine" | "cleanup" | "capture" | "media" | "call" | "socket" | "replay" | "control" | "timeline" | "debugger" | "profile" | "emulation" | "workflow" | "trigger";
7
7
  /** Observation mode classes: passive capture, watched lifetimes and diffing passes. */
8
8
  export type observationmode = "passive" | "watching" | "diffing";
9
9
  export interface toolstep {
@@ -174,6 +174,8 @@ export interface runsettings {
174
174
  emulationretention?: number;
175
175
  /** Retention window for stored session record sections such as tab form state, local storage and cookies; an absent window keeps every section while the record metadata always survives and the value stays a user choice with no code ceiling. */
176
176
  sessionretention?: number;
177
+ /** Retention window for stored trigger fire records; an absent window keeps every fire record and the rule counters always survive. */
178
+ triggerretention?: number;
177
179
  /** Retention window for stored workflow runlog entries; an absent window keeps every entry while the run summaries always survive for the audit trail. */
178
180
  runlogretention?: number;
179
181
  }
@@ -2528,4 +2530,249 @@ export interface runlogentry {
2528
2530
  checkpoint?: boolean;
2529
2531
  details?: Record<string, unknown>;
2530
2532
  }
2533
+ /** One condition payload of the 1.1.51 control flow family: the expression tested over the extracted values with no page side effect. */
2534
+ export interface conditionstep {
2535
+ expression: expressiontype;
2536
+ }
2537
+ /** One branch path of a branch step: the path name, the optional match expression over page state and extracted values, and the child steps of the path. */
2538
+ export interface branchpath {
2539
+ name: string;
2540
+ /** Expression a path must satisfy to be chosen; the else path carries none. */
2541
+ when?: expressiontype;
2542
+ steps: workflowstep[];
2543
+ }
2544
+ /** One branch payload: the named paths with their match expressions and the mandatory else path that terminates every branch. */
2545
+ export interface branchstep {
2546
+ paths: branchpath[];
2547
+ else: branchpath;
2548
+ }
2549
+ /** One loop payload: the list variable iterated, the item and index variables bound per iteration, the optional user configured safety bound and the child steps of the body. */
2550
+ export interface loopstep {
2551
+ list: string;
2552
+ item: string;
2553
+ index: string;
2554
+ /** User configured maximum iteration count; an absent bound keeps the documented default. */
2555
+ bound?: number;
2556
+ steps: workflowstep[];
2557
+ }
2558
+ /** One repeat until payload: the convergence expression, the optional user configured safety bound and the child steps of the body. */
2559
+ export interface repeatuntilstep {
2560
+ until: expressiontype;
2561
+ /** User configured maximum iteration count; an absent bound keeps the documented default. */
2562
+ bound?: number;
2563
+ steps: workflowstep[];
2564
+ }
2565
+ /** One while payload: the loop condition, the mandatory user configured safety bound and the child steps of the body. */
2566
+ export interface whilestep {
2567
+ while: expressiontype;
2568
+ /** User configured maximum iteration count; a while loop without a safety bound is refused. */
2569
+ bound: number;
2570
+ steps: workflowstep[];
2571
+ }
2572
+ /** One foreach payload: the selector resolved into element references, the item and index variables bound per iteration and the child steps of the body. */
2573
+ export interface foreachstep {
2574
+ selector: string;
2575
+ item: string;
2576
+ index: string;
2577
+ steps: workflowstep[];
2578
+ }
2579
+ /** One parallel branch: the branch id and its child steps executed concurrently in an isolated scope. */
2580
+ export interface parallelbranch {
2581
+ id: string;
2582
+ steps: workflowstep[];
2583
+ }
2584
+ /** The join policy of a parallel step: the reviewed merge strategy of conflicting variable writes and whether sibling branches cancel or continue on branch failure. */
2585
+ export interface joinstep {
2586
+ strategy: "first" | "last" | "fail";
2587
+ onfail: "cancel" | "continue";
2588
+ }
2589
+ /** One parallel payload: the concurrent branches and the join policy that merges their outcomes. */
2590
+ export interface parallelstep {
2591
+ branches: parallelbranch[];
2592
+ join: joinstep;
2593
+ }
2594
+ /** The retry policy of a fragile block: the user configured attempt count with no code ceiling, the backoff shape with base and jitter and the retryable error classes. */
2595
+ export interface retrypolicy {
2596
+ attempts: number;
2597
+ backoff: {
2598
+ shape: "fixed" | "exponential";
2599
+ base: number;
2600
+ jitter: number;
2601
+ };
2602
+ retryable: string[];
2603
+ }
2604
+ /** The error handler of a try step: the catch steps executed on failure and the optional rerun of the body after the handler. */
2605
+ export interface errorhandler {
2606
+ steps: workflowstep[];
2607
+ /** True when the body reruns once after the handler steps. */
2608
+ rerun?: boolean;
2609
+ }
2610
+ /** The timeout policy of a try step: the per step and per run millisecond budgets, both user configured positive values with no code ceiling. */
2611
+ export interface timeoutpolicy {
2612
+ stepms?: number;
2613
+ runms?: number;
2614
+ }
2615
+ /** One try payload: the fragile body steps, the error handler, the optional retry policy and the optional timeout policy. */
2616
+ export interface trystep {
2617
+ steps: workflowstep[];
2618
+ catch: errorhandler;
2619
+ retry?: retrypolicy;
2620
+ timeout?: timeoutpolicy;
2621
+ }
2622
+ /** One loop counter of a run: the step, the iteration path with its nested index trail, the outcome flag and the time, recorded for audit. */
2623
+ export interface loopcounter {
2624
+ stepid: string;
2625
+ path: string;
2626
+ iteration: number;
2627
+ ok: boolean;
2628
+ at: number;
2629
+ }
2630
+ /** One branch outcome of a run: the step, the chosen path and the reason it was chosen. */
2631
+ export interface branchoutcome {
2632
+ stepid: string;
2633
+ path: string;
2634
+ reason: string;
2635
+ at: number;
2636
+ }
2637
+ /** One retry attempt of a run: the step, the attempt number, the backoff delay in milliseconds, the error class and the time. */
2638
+ export interface retryattempt {
2639
+ stepid: string;
2640
+ attempt: number;
2641
+ delay: number;
2642
+ errorclass: string;
2643
+ at: number;
2644
+ }
2645
+ /** One timeout abort of a run: the step, the exceeded budget in milliseconds, the abort scope and the time. */
2646
+ export interface timeoutabort {
2647
+ stepid: string;
2648
+ budget: number;
2649
+ scope: "step" | "run";
2650
+ at: number;
2651
+ }
2652
+ /** One join record of a run: the step, the reviewed merge strategy, the conflicting variable names and the merged variable names. */
2653
+ export interface joinrecord {
2654
+ stepid: string;
2655
+ strategy: string;
2656
+ conflicts: string[];
2657
+ merged: string[];
2658
+ at: number;
2659
+ }
2660
+ /** One parallel branch outcome: the branch id, its ok flag, its summary and the cancelled marker when the join policy cancelled it. */
2661
+ export interface paralleloutcome {
2662
+ branchid: string;
2663
+ ok: boolean;
2664
+ summary: string;
2665
+ cancelled?: boolean;
2666
+ }
2667
+ /** One control flow decision of a run stored for audit: the branch, loop, retry, timeout, join, parallel or catch decision of one control step. */
2668
+ export interface controlflowdecision {
2669
+ runid: string;
2670
+ stepid: string;
2671
+ kind: "branch" | "loop" | "retry" | "timeout" | "join" | "parallel" | "catch";
2672
+ at: number;
2673
+ branch?: branchoutcome;
2674
+ loops?: loopcounter[];
2675
+ retries?: retryattempt[];
2676
+ timeouts?: timeoutabort[];
2677
+ join?: joinrecord;
2678
+ branches?: paralleloutcome[];
2679
+ catch?: {
2680
+ errorclass: string;
2681
+ message: string;
2682
+ rerun: boolean;
2683
+ };
2684
+ }
2685
+ /** The trigger rule families of the 1.1.52 release: page visits, url patterns, context menu entries, keyboard shortcuts, the toolbar button, cron schedules, intervals, url lists, webhooks and page events. */
2686
+ export type triggerfamily = "visit" | "url" | "menu" | "key" | "button" | "cron" | "interval" | "urllist" | "webhook" | "event";
2687
+ /** One armed trigger rule: the family, the reviewed match payload, the workflow reference, the runtime state with its cooldown and the per rule counters; every rule passes the arm review before it can fire. */
2688
+ export interface triggerule {
2689
+ id: string;
2690
+ kind: triggerfamily;
2691
+ /** The composed workflow this rule launches; evaluation skips the rule when the workflow is no longer composed. */
2692
+ workflowid: string;
2693
+ /** Human readable label of the rule shown in the trigger list. */
2694
+ label: string;
2695
+ /** Visited HTTPS origins a visit rule fires on. */
2696
+ origins?: string[];
2697
+ /** Glob url pattern a url rule matches against navigations. */
2698
+ pattern?: string;
2699
+ /** Context menu entry title of a menu rule. */
2700
+ title?: string;
2701
+ /** Command name of a keyboard shortcut rule plus the suggested key binding. */
2702
+ command?: string;
2703
+ key?: string;
2704
+ /** Five field cron expression of a cron rule with its optional timezone name. */
2705
+ cron?: string;
2706
+ timezone?: string;
2707
+ /** Interval period in milliseconds with the optional jitter window of an interval rule. */
2708
+ period?: number;
2709
+ jitter?: number;
2710
+ /** Url list a urllist rule runs its workflow across. */
2711
+ urls?: string[];
2712
+ /** Shared secret of a webhook rule; it never leaves the store and only its verified payloads persist. */
2713
+ secret?: string;
2714
+ /** Payload schema of a webhook rule: named fields of reviewed primitive kinds, required ones enforced at verification. */
2715
+ schema?: webhookfield[];
2716
+ /** Observed page event names an event rule subscribes to, drawn from the observed event catalog. */
2717
+ events?: string[];
2718
+ /** User configured cooldown window in milliseconds; an absent value keeps the documented family default. */
2719
+ cooldown?: number;
2720
+ state: triggerstate;
2721
+ stats: rulestats;
2722
+ createdat: number;
2723
+ }
2724
+ /** One webhook payload schema field of a webhook rule: the field name, its primitive kind and whether verification requires it. */
2725
+ export interface webhookfield {
2726
+ name: string;
2727
+ kind: "string" | "number" | "boolean";
2728
+ required?: boolean;
2729
+ }
2730
+ /** The runtime state of one armed trigger rule: the enabled flag, the effective cooldown window, the pause marker, the last and next fire times. */
2731
+ export interface triggerstate {
2732
+ enabled: boolean;
2733
+ /** Effective cooldown window in milliseconds between two fires of the rule. */
2734
+ cooldown: number;
2735
+ /** Time of the last fire; fires inside the cooldown window after it are suppressed. */
2736
+ lastfireat?: number;
2737
+ /** Next scheduled fire time of a cron or interval rule. */
2738
+ nextfireat?: number;
2739
+ /** Pause marker set while the session pauses; queued fires drain on resume. */
2740
+ pausedat?: number;
2741
+ }
2742
+ /** The per rule counters of the trigger history view: fires, launches and cooldown or dedupe suppressions. */
2743
+ export interface rulestats {
2744
+ fires: number;
2745
+ launches: number;
2746
+ suppressions: number;
2747
+ }
2748
+ /** One trigger fire record: the rule, the time, the cause, the triggering url, title and payload carried into the run context. */
2749
+ export interface triggerfire {
2750
+ id: string;
2751
+ ruleid: string;
2752
+ at: number;
2753
+ cause: string;
2754
+ /** Triggering url of a visit, url, urllist or navigation driven fire. */
2755
+ url?: string;
2756
+ /** Triggering page title carried into the run context. */
2757
+ title?: string;
2758
+ /** Trigger payload such as the verified webhook body or the observed event name. */
2759
+ payload?: Record<string, unknown>;
2760
+ }
2761
+ /** One manual run request with its step preview: the expanded step list rendered before confirmation so a human always sees what a run will do. */
2762
+ export interface manualrun {
2763
+ id: string;
2764
+ workflowid: string;
2765
+ /** The rendered step preview shown before confirmation. */
2766
+ preview: Array<{
2767
+ stepid: string;
2768
+ kind: string;
2769
+ label: string;
2770
+ block?: string;
2771
+ control?: Record<string, unknown>;
2772
+ }>;
2773
+ /** The confirmation outcome after the user approved or cancelled; an undecided preview stays open. */
2774
+ confirmed?: boolean;
2775
+ decidedat?: number;
2776
+ at: number;
2777
+ }
2531
2778
  //# sourceMappingURL=types.d.ts.map