@yaklabs-ai/plugin-sdk 0.53.0 → 0.54.1

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.
@@ -815,6 +815,9 @@ export declare function createUnavailableEndpoints(message: string): KayAgentEnd
815
815
 
816
816
  export declare function createUnavailablePluginEndpointCaller(message: string): PluginEndpointCaller;
817
817
 
818
+ /** A refusal handle for hosts that have not composed plugin worker execution. */
819
+ export declare function createUnavailablePluginWorkers(): KayPluginWorkers;
820
+
818
821
  export declare function createUnavailableUriCaller(message: string): PluginUriCaller;
819
822
 
820
823
  /** What the module holds at mutation time: a provider revision, the current content, or both. */
@@ -1073,6 +1076,10 @@ declare const DollarSign = "$";
1073
1076
 
1074
1077
  declare const Dot = ".";
1075
1078
 
1079
+ declare type DriverAction<T> = T extends unknown ? {
1080
+ readonly [Key in keyof T]: ReadonlyContract<Exclude<T[Key], undefined>>;
1081
+ } : never;
1082
+
1076
1083
  declare type DurationUnit = "seconds" | "minutes" | "hours" | "days" | "weeks" | "months" | "years";
1077
1084
 
1078
1085
  declare const Element: (input: string) => [unknown, string] | [];
@@ -1652,78 +1659,300 @@ export declare interface InteractionActed {
1652
1659
  };
1653
1660
  }
1654
1661
 
1662
+ export declare type InteractionAction = DriverAction<InteractionAction_2>;
1663
+
1655
1664
  /**
1656
- * One action over a candidate from the latest observation of the same target. `fill` replaces the
1657
- * field's contents unless `append` is set, and presses Enter afterwards when `submit` is set.
1665
+ * One action over a candidate from the latest observation of the same target. `element` is that
1666
+ * candidate, returned whole so the driver resolves its own native identity immediately before
1667
+ * input. `fill` replaces the field's contents unless `append` is set, and presses Enter (Return)
1668
+ * afterwards when `submit` is set.
1658
1669
  */
1659
- export declare type InteractionAction = {
1660
- readonly kind: "click";
1661
- readonly element: InteractionCandidate;
1662
- } | {
1663
- readonly kind: "fill";
1664
- readonly element: InteractionCandidate;
1665
- readonly text: string;
1666
- readonly submit?: boolean;
1667
- readonly append?: boolean;
1668
- } | {
1669
- readonly kind: "select";
1670
- readonly element: InteractionCandidate;
1671
- } | {
1672
- readonly kind: "activate";
1673
- readonly element: InteractionCandidate;
1674
- } | {
1675
- readonly kind: "press";
1676
- readonly element: InteractionCandidate;
1677
- }
1678
- /**
1679
- * Scroll by `delta` px (positive is down). With `element` (a `scroll` candidate that names a
1680
- * node), the scroll container that candidate scrolls; without, the whole page or window.
1681
- */
1682
- | {
1683
- readonly kind: "scroll";
1684
- readonly delta: number;
1685
- readonly element?: InteractionCandidate;
1686
- } | {
1687
- readonly kind: "wait";
1688
- };
1670
+ declare const InteractionAction_2: z.ZodDiscriminatedUnion<[z.ZodObject<{
1671
+ kind: z.ZodLiteral<"click">;
1672
+ element: z.ZodObject<{
1673
+ id: z.ZodString;
1674
+ kind: z.ZodEnum<{
1675
+ fill: "fill";
1676
+ activate: "activate";
1677
+ click: "click";
1678
+ select: "select";
1679
+ scroll: "scroll";
1680
+ wait: "wait";
1681
+ press: "press";
1682
+ }>;
1683
+ label: z.ZodString;
1684
+ node: z.ZodOptional<z.ZodNumber>;
1685
+ role: z.ZodOptional<z.ZodString>;
1686
+ value: z.ZodOptional<z.ZodString>;
1687
+ current_value: z.ZodOptional<z.ZodString>;
1688
+ checked: z.ZodOptional<z.ZodString>;
1689
+ selected: z.ZodOptional<z.ZodString>;
1690
+ expanded: z.ZodOptional<z.ZodString>;
1691
+ look: z.ZodOptional<z.ZodEnum<{
1692
+ link: "link";
1693
+ widget: "widget";
1694
+ }>>;
1695
+ delta: z.ZodOptional<z.ZodNumber>;
1696
+ position: z.ZodOptional<z.ZodEnum<{
1697
+ above: "above";
1698
+ below: "below";
1699
+ beside: "beside";
1700
+ }>>;
1701
+ region: z.ZodOptional<z.ZodObject<{
1702
+ role: z.ZodString;
1703
+ name: z.ZodString;
1704
+ front: z.ZodOptional<z.ZodBoolean>;
1705
+ }, z.core.$loose>>;
1706
+ scroller: z.ZodOptional<z.ZodNumber>;
1707
+ }, z.core.$loose>;
1708
+ }, z.core.$strict>, z.ZodObject<{
1709
+ kind: z.ZodLiteral<"fill">;
1710
+ element: z.ZodObject<{
1711
+ id: z.ZodString;
1712
+ kind: z.ZodEnum<{
1713
+ fill: "fill";
1714
+ activate: "activate";
1715
+ click: "click";
1716
+ select: "select";
1717
+ scroll: "scroll";
1718
+ wait: "wait";
1719
+ press: "press";
1720
+ }>;
1721
+ label: z.ZodString;
1722
+ node: z.ZodOptional<z.ZodNumber>;
1723
+ role: z.ZodOptional<z.ZodString>;
1724
+ value: z.ZodOptional<z.ZodString>;
1725
+ current_value: z.ZodOptional<z.ZodString>;
1726
+ checked: z.ZodOptional<z.ZodString>;
1727
+ selected: z.ZodOptional<z.ZodString>;
1728
+ expanded: z.ZodOptional<z.ZodString>;
1729
+ look: z.ZodOptional<z.ZodEnum<{
1730
+ link: "link";
1731
+ widget: "widget";
1732
+ }>>;
1733
+ delta: z.ZodOptional<z.ZodNumber>;
1734
+ position: z.ZodOptional<z.ZodEnum<{
1735
+ above: "above";
1736
+ below: "below";
1737
+ beside: "beside";
1738
+ }>>;
1739
+ region: z.ZodOptional<z.ZodObject<{
1740
+ role: z.ZodString;
1741
+ name: z.ZodString;
1742
+ front: z.ZodOptional<z.ZodBoolean>;
1743
+ }, z.core.$loose>>;
1744
+ scroller: z.ZodOptional<z.ZodNumber>;
1745
+ }, z.core.$loose>;
1746
+ text: z.ZodString;
1747
+ submit: z.ZodOptional<z.ZodBoolean>;
1748
+ append: z.ZodOptional<z.ZodBoolean>;
1749
+ }, z.core.$strict>, z.ZodObject<{
1750
+ kind: z.ZodLiteral<"select">;
1751
+ element: z.ZodObject<{
1752
+ id: z.ZodString;
1753
+ kind: z.ZodEnum<{
1754
+ fill: "fill";
1755
+ activate: "activate";
1756
+ click: "click";
1757
+ select: "select";
1758
+ scroll: "scroll";
1759
+ wait: "wait";
1760
+ press: "press";
1761
+ }>;
1762
+ label: z.ZodString;
1763
+ node: z.ZodOptional<z.ZodNumber>;
1764
+ role: z.ZodOptional<z.ZodString>;
1765
+ value: z.ZodOptional<z.ZodString>;
1766
+ current_value: z.ZodOptional<z.ZodString>;
1767
+ checked: z.ZodOptional<z.ZodString>;
1768
+ selected: z.ZodOptional<z.ZodString>;
1769
+ expanded: z.ZodOptional<z.ZodString>;
1770
+ look: z.ZodOptional<z.ZodEnum<{
1771
+ link: "link";
1772
+ widget: "widget";
1773
+ }>>;
1774
+ delta: z.ZodOptional<z.ZodNumber>;
1775
+ position: z.ZodOptional<z.ZodEnum<{
1776
+ above: "above";
1777
+ below: "below";
1778
+ beside: "beside";
1779
+ }>>;
1780
+ region: z.ZodOptional<z.ZodObject<{
1781
+ role: z.ZodString;
1782
+ name: z.ZodString;
1783
+ front: z.ZodOptional<z.ZodBoolean>;
1784
+ }, z.core.$loose>>;
1785
+ scroller: z.ZodOptional<z.ZodNumber>;
1786
+ }, z.core.$loose>;
1787
+ }, z.core.$strict>, z.ZodObject<{
1788
+ kind: z.ZodLiteral<"activate">;
1789
+ element: z.ZodObject<{
1790
+ id: z.ZodString;
1791
+ kind: z.ZodEnum<{
1792
+ fill: "fill";
1793
+ activate: "activate";
1794
+ click: "click";
1795
+ select: "select";
1796
+ scroll: "scroll";
1797
+ wait: "wait";
1798
+ press: "press";
1799
+ }>;
1800
+ label: z.ZodString;
1801
+ node: z.ZodOptional<z.ZodNumber>;
1802
+ role: z.ZodOptional<z.ZodString>;
1803
+ value: z.ZodOptional<z.ZodString>;
1804
+ current_value: z.ZodOptional<z.ZodString>;
1805
+ checked: z.ZodOptional<z.ZodString>;
1806
+ selected: z.ZodOptional<z.ZodString>;
1807
+ expanded: z.ZodOptional<z.ZodString>;
1808
+ look: z.ZodOptional<z.ZodEnum<{
1809
+ link: "link";
1810
+ widget: "widget";
1811
+ }>>;
1812
+ delta: z.ZodOptional<z.ZodNumber>;
1813
+ position: z.ZodOptional<z.ZodEnum<{
1814
+ above: "above";
1815
+ below: "below";
1816
+ beside: "beside";
1817
+ }>>;
1818
+ region: z.ZodOptional<z.ZodObject<{
1819
+ role: z.ZodString;
1820
+ name: z.ZodString;
1821
+ front: z.ZodOptional<z.ZodBoolean>;
1822
+ }, z.core.$loose>>;
1823
+ scroller: z.ZodOptional<z.ZodNumber>;
1824
+ }, z.core.$loose>;
1825
+ }, z.core.$strict>, z.ZodObject<{
1826
+ kind: z.ZodLiteral<"press">;
1827
+ element: z.ZodObject<{
1828
+ id: z.ZodString;
1829
+ kind: z.ZodEnum<{
1830
+ fill: "fill";
1831
+ activate: "activate";
1832
+ click: "click";
1833
+ select: "select";
1834
+ scroll: "scroll";
1835
+ wait: "wait";
1836
+ press: "press";
1837
+ }>;
1838
+ label: z.ZodString;
1839
+ node: z.ZodOptional<z.ZodNumber>;
1840
+ role: z.ZodOptional<z.ZodString>;
1841
+ value: z.ZodOptional<z.ZodString>;
1842
+ current_value: z.ZodOptional<z.ZodString>;
1843
+ checked: z.ZodOptional<z.ZodString>;
1844
+ selected: z.ZodOptional<z.ZodString>;
1845
+ expanded: z.ZodOptional<z.ZodString>;
1846
+ look: z.ZodOptional<z.ZodEnum<{
1847
+ link: "link";
1848
+ widget: "widget";
1849
+ }>>;
1850
+ delta: z.ZodOptional<z.ZodNumber>;
1851
+ position: z.ZodOptional<z.ZodEnum<{
1852
+ above: "above";
1853
+ below: "below";
1854
+ beside: "beside";
1855
+ }>>;
1856
+ region: z.ZodOptional<z.ZodObject<{
1857
+ role: z.ZodString;
1858
+ name: z.ZodString;
1859
+ front: z.ZodOptional<z.ZodBoolean>;
1860
+ }, z.core.$loose>>;
1861
+ scroller: z.ZodOptional<z.ZodNumber>;
1862
+ }, z.core.$loose>;
1863
+ }, z.core.$strict>, z.ZodObject<{
1864
+ kind: z.ZodLiteral<"scroll">;
1865
+ delta: z.ZodNumber;
1866
+ element: z.ZodOptional<z.ZodObject<{
1867
+ id: z.ZodString;
1868
+ kind: z.ZodEnum<{
1869
+ fill: "fill";
1870
+ activate: "activate";
1871
+ click: "click";
1872
+ select: "select";
1873
+ scroll: "scroll";
1874
+ wait: "wait";
1875
+ press: "press";
1876
+ }>;
1877
+ label: z.ZodString;
1878
+ node: z.ZodOptional<z.ZodNumber>;
1879
+ role: z.ZodOptional<z.ZodString>;
1880
+ value: z.ZodOptional<z.ZodString>;
1881
+ current_value: z.ZodOptional<z.ZodString>;
1882
+ checked: z.ZodOptional<z.ZodString>;
1883
+ selected: z.ZodOptional<z.ZodString>;
1884
+ expanded: z.ZodOptional<z.ZodString>;
1885
+ look: z.ZodOptional<z.ZodEnum<{
1886
+ link: "link";
1887
+ widget: "widget";
1888
+ }>>;
1889
+ delta: z.ZodOptional<z.ZodNumber>;
1890
+ position: z.ZodOptional<z.ZodEnum<{
1891
+ above: "above";
1892
+ below: "below";
1893
+ beside: "beside";
1894
+ }>>;
1895
+ region: z.ZodOptional<z.ZodObject<{
1896
+ role: z.ZodString;
1897
+ name: z.ZodString;
1898
+ front: z.ZodOptional<z.ZodBoolean>;
1899
+ }, z.core.$loose>>;
1900
+ scroller: z.ZodOptional<z.ZodNumber>;
1901
+ }, z.core.$loose>>;
1902
+ }, z.core.$strict>, z.ZodObject<{
1903
+ kind: z.ZodLiteral<"wait">;
1904
+ }, z.core.$strict>], "kind">;
1905
+
1906
+ declare type InteractionAction_2 = z.infer<typeof InteractionAction_2>;
1907
+
1908
+ export declare type InteractionCandidate = ReadonlyContract<InteractionCandidate_2>;
1689
1909
 
1690
1910
  /**
1691
- * One element (or control) an observation offers, with the kind of action it supports. `id` is
1692
- * the driver's per-observation id; the engine mints its own session-unique ids over it. Extra
1693
- * fields are the driver's native identity (a page node number, an accessibility token), returned
1694
- * to the driver untouched in {@link InteractionAction}.
1911
+ * One element (or control) a driver offers in an {@link InteractionObservation}: a role, a label,
1912
+ * a value, and the kind of action it supports. `id` is the driver's per-observation candidate id
1913
+ * (`e1`, `scroll_down`, `wait`); the Interaction engine mints its own session-unique ids over it.
1914
+ * The driver-native identity rides along as passthrough fields the driver alone reads back in
1915
+ * {@link InteractionAction}: `node` (a page element), `target`/`app` (accessibility tokens),
1916
+ * `key` (a key to press). Nothing here is a selector the model wrote.
1695
1917
  */
1696
- export declare interface InteractionCandidate {
1697
- readonly id: string;
1698
- readonly kind: InteractionCandidateKind;
1699
- readonly label: string;
1700
- readonly node?: number | undefined;
1701
- readonly role?: string | undefined;
1702
- readonly value?: string | undefined;
1703
- readonly current_value?: string | undefined;
1704
- readonly checked?: string | undefined;
1705
- readonly selected?: string | undefined;
1706
- readonly expanded?: string | undefined;
1707
- /**
1708
- * What a page driver found the element to be in the DOM, not what the page calls it: `link` is an
1709
- * anchor that navigates to another http(s) page; `widget` is an element that is no form control.
1710
- * Absent means unknown, and the engine then treats the element as any other.
1711
- */
1712
- readonly look?: "link" | "widget" | undefined;
1713
- readonly delta?: number | undefined;
1714
- /** Where an element outside the visible area sits; absent means on screen. */
1715
- readonly position?: "above" | "below" | "beside" | undefined;
1716
- /** A `press` candidate's key (`return`, `escape`, `tab`); its id is `press_<key>` by convention. */
1717
- readonly key?: string | undefined;
1718
- /** The region the element sits in; see {@link InteractionRegion}. */
1719
- readonly region?: InteractionRegion | undefined;
1720
- /**
1721
- * The `node` of the scroll container (a list or pane that scrolls on its own) the element sits
1722
- * in, matching that container's `scroll` candidates; absent when it sits in none.
1723
- */
1724
- readonly scroller?: number | undefined;
1725
- readonly [native: string]: unknown;
1726
- }
1918
+ declare const InteractionCandidate_2: z.ZodObject<{
1919
+ id: z.ZodString;
1920
+ kind: z.ZodEnum<{
1921
+ fill: "fill";
1922
+ activate: "activate";
1923
+ click: "click";
1924
+ select: "select";
1925
+ scroll: "scroll";
1926
+ wait: "wait";
1927
+ press: "press";
1928
+ }>;
1929
+ label: z.ZodString;
1930
+ node: z.ZodOptional<z.ZodNumber>;
1931
+ role: z.ZodOptional<z.ZodString>;
1932
+ value: z.ZodOptional<z.ZodString>;
1933
+ current_value: z.ZodOptional<z.ZodString>;
1934
+ checked: z.ZodOptional<z.ZodString>;
1935
+ selected: z.ZodOptional<z.ZodString>;
1936
+ expanded: z.ZodOptional<z.ZodString>;
1937
+ look: z.ZodOptional<z.ZodEnum<{
1938
+ link: "link";
1939
+ widget: "widget";
1940
+ }>>;
1941
+ delta: z.ZodOptional<z.ZodNumber>;
1942
+ position: z.ZodOptional<z.ZodEnum<{
1943
+ above: "above";
1944
+ below: "below";
1945
+ beside: "beside";
1946
+ }>>;
1947
+ region: z.ZodOptional<z.ZodObject<{
1948
+ role: z.ZodString;
1949
+ name: z.ZodString;
1950
+ front: z.ZodOptional<z.ZodBoolean>;
1951
+ }, z.core.$loose>>;
1952
+ scroller: z.ZodOptional<z.ZodNumber>;
1953
+ }, z.core.$loose>;
1954
+
1955
+ declare type InteractionCandidate_2 = z.infer<typeof InteractionCandidate_2>;
1727
1956
 
1728
1957
  /** The candidate kinds a driver may offer. */
1729
1958
  export declare type InteractionCandidateKind = "click" | "fill" | "select" | "scroll" | "wait" | "activate" | "press";
@@ -1777,16 +2006,53 @@ export declare interface InteractionFailure {
1777
2006
  readonly message: string;
1778
2007
  }
1779
2008
 
1780
- /** What a driver sees on one target. */
1781
- export declare interface InteractionObservation {
1782
- readonly url: string;
1783
- readonly title: string;
1784
- /** Visible text, or the whole page's text when the observe asked for `fullText`; capped. */
1785
- readonly text: string;
1786
- readonly actions: readonly InteractionCandidate[];
1787
- /** Candidates the driver dropped to stay within its cap. */
1788
- readonly omitted_actions: number;
1789
- }
2009
+ export declare type InteractionObservation = ReadonlyContract<InteractionObservation_2>;
2010
+
2011
+ /** What a driver sees on one target: its address, title, text, and actionable candidates. */
2012
+ declare const InteractionObservation_2: z.ZodObject<{
2013
+ url: z.ZodString;
2014
+ title: z.ZodString;
2015
+ text: z.ZodString;
2016
+ actions: z.ZodArray<z.ZodObject<{
2017
+ id: z.ZodString;
2018
+ kind: z.ZodEnum<{
2019
+ fill: "fill";
2020
+ activate: "activate";
2021
+ click: "click";
2022
+ select: "select";
2023
+ scroll: "scroll";
2024
+ wait: "wait";
2025
+ press: "press";
2026
+ }>;
2027
+ label: z.ZodString;
2028
+ node: z.ZodOptional<z.ZodNumber>;
2029
+ role: z.ZodOptional<z.ZodString>;
2030
+ value: z.ZodOptional<z.ZodString>;
2031
+ current_value: z.ZodOptional<z.ZodString>;
2032
+ checked: z.ZodOptional<z.ZodString>;
2033
+ selected: z.ZodOptional<z.ZodString>;
2034
+ expanded: z.ZodOptional<z.ZodString>;
2035
+ look: z.ZodOptional<z.ZodEnum<{
2036
+ link: "link";
2037
+ widget: "widget";
2038
+ }>>;
2039
+ delta: z.ZodOptional<z.ZodNumber>;
2040
+ position: z.ZodOptional<z.ZodEnum<{
2041
+ above: "above";
2042
+ below: "below";
2043
+ beside: "beside";
2044
+ }>>;
2045
+ region: z.ZodOptional<z.ZodObject<{
2046
+ role: z.ZodString;
2047
+ name: z.ZodString;
2048
+ front: z.ZodOptional<z.ZodBoolean>;
2049
+ }, z.core.$loose>>;
2050
+ scroller: z.ZodOptional<z.ZodNumber>;
2051
+ }, z.core.$loose>>;
2052
+ omitted_actions: z.ZodNumber;
2053
+ }, z.core.$strict>;
2054
+
2055
+ declare type InteractionObservation_2 = z.infer<typeof InteractionObservation_2>;
1790
2056
 
1791
2057
  export declare interface InteractionObserved {
1792
2058
  /** The address of the target observed; absent when the default target has no address. */
@@ -1837,17 +2103,21 @@ export declare type InteractionSurface = Pick<InteractionDriver, "isAvailable" |
1837
2103
  /** The interaction surfaces Bonsai itself ships, which plugins drive through `api.interaction`. */
1838
2104
  export declare type InteractionSurfaceName = "browser-pane" | "desktop";
1839
2105
 
2106
+ export declare type InteractionTarget = ReadonlyContract<InteractionTarget_2>;
2107
+
1840
2108
  /**
1841
- * One thing a driver can be pointed at. `id` is a driver-owned address, unique across every
1842
- * driver in the session (prefix it with your scheme), that the agent passes back as `target`.
1843
- * `active` marks the driver's default target.
2109
+ * One thing a driver can be pointed at: a browser page, a running app. `id` is the driver-owned
2110
+ * address the agent passes back as `target` (`kay://tabs/.../items/<item>`, `app://<bundle id>`).
2111
+ * `active` marks the default target (the page the user is looking at, the front app).
1844
2112
  */
1845
- export declare interface InteractionTarget {
1846
- readonly id: string;
1847
- readonly title: string;
1848
- readonly url?: string;
1849
- readonly active: boolean;
1850
- }
2113
+ declare const InteractionTarget_2: z.ZodObject<{
2114
+ id: z.ZodString;
2115
+ title: z.ZodString;
2116
+ url: z.ZodOptional<z.ZodString>;
2117
+ active: z.ZodBoolean;
2118
+ }, z.core.$strict>;
2119
+
2120
+ declare type InteractionTarget_2 = z.infer<typeof InteractionTarget_2>;
1851
2121
 
1852
2122
  /** Creates an Interface using the given heritage and properties. */
1853
2123
  declare function Interface<Heritage extends TSchema[], Properties extends TProperties>(heritage: [...Heritage], properties: Properties, options?: TSchemaOptions): TInterface<Heritage, Properties>;
@@ -2799,8 +3069,15 @@ declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
2799
3069
  * 0.53.0 adds declared working-content layouts, family-root authority, draft projection discovery
2800
3070
  * and session-bound page references. Older customized Whiteboard copies must accept the plugin
2801
3071
  * update before using these interfaces.
3072
+ *
3073
+ * 0.54.0 adds named UI host grants for shared configuration/auth/account reads, retained connection
3074
+ * progress/dismissal and support. Built-in-only page capability scopes are removed; executable
3075
+ * pages declare capabilities on apps[].
3076
+ *
3077
+ * 0.54.1 adds manifest-declared plugin workers on both backend targets and exposes the canonical
3078
+ * transcript placement and answer-stretch rules through the SDK.
2802
3079
  */
2803
- declare const KAY_PLUGIN_SDK_VERSION: "0.53.0";
3080
+ declare const KAY_PLUGIN_SDK_VERSION: "0.54.1";
2804
3081
 
2805
3082
  declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
2806
3083
 
@@ -3090,6 +3367,8 @@ export declare interface KayAgentPluginApi {
3090
3367
  * {@link KayAppUserFiles}.
3091
3368
  */
3092
3369
  readonly userFiles: KayAppUserFiles;
3370
+ /** Always present; only modules declared by this plugin may run. SDK 0.54.1. */
3371
+ readonly workers: KayPluginWorkers;
3093
3372
  /**
3094
3373
  * Publish the plugin's declared events, for example so a default notification rule can tell the
3095
3374
  * user what the agent just did. Always present, like {@link systemOne}: there is nothing to
@@ -3748,6 +4027,20 @@ export declare interface KayPluginSimulatorOptions {
3748
4027
  readonly stateRoot: string;
3749
4028
  }
3750
4029
 
4030
+ /** A declared module exports this function; input and output must be JSON values. */
4031
+ export declare interface KayPluginWorkerModule {
4032
+ run(input: unknown): unknown | Promise<unknown>;
4033
+ }
4034
+
4035
+ /** Run only this plugin's declared modules in a fresh child owned by its hosting process. */
4036
+ export declare interface KayPluginWorkers {
4037
+ /** The host terminates the child on deadline, caller abort or plugin disposal. */
4038
+ run<T = unknown>(workerId: string, input: unknown, options: {
4039
+ readonly timeoutMs: number;
4040
+ readonly signal?: AbortSignal;
4041
+ }): Promise<T>;
4042
+ }
4043
+
3751
4044
  /** Applies a KeyOf action to the given type. */
3752
4045
  declare function KeyOf<Type extends TSchema>(type: Type, options?: TSchemaOptions): TKeyOf_2<Type>;
3753
4046
 
@@ -5134,6 +5427,18 @@ declare const PluginCapabilityRefusalV1: z.ZodObject<{
5134
5427
  target: z.ZodLiteral<"kay.app">;
5135
5428
  slug: z.ZodLiteral<"plugins.set-enabled">;
5136
5429
  envelope: z.ZodObject<{}, z.core.$strict>;
5430
+ }, z.core.$strict>, z.ZodObject<{
5431
+ target: z.ZodLiteral<"kay.app">;
5432
+ slug: z.ZodLiteral<"sessions.assign-project">;
5433
+ envelope: z.ZodObject<{}, z.core.$strict>;
5434
+ }, z.core.$strict>, z.ZodObject<{
5435
+ target: z.ZodLiteral<"kay.app">;
5436
+ slug: z.ZodLiteral<"artifacts.resolve-file">;
5437
+ envelope: z.ZodObject<{}, z.core.$strict>;
5438
+ }, z.core.$strict>, z.ZodObject<{
5439
+ target: z.ZodLiteral<"kay.app">;
5440
+ slug: z.ZodLiteral<"process.run">;
5441
+ envelope: z.ZodObject<{}, z.core.$strict>;
5137
5442
  }, z.core.$strict>, z.ZodObject<{
5138
5443
  target: z.ZodLiteral<"kay.app">;
5139
5444
  slug: z.ZodLiteral<"sessions.annotate">;
@@ -5665,6 +5970,15 @@ export declare interface PluginUriWriteOptions extends PluginUriMutationOptions
5665
5970
  readonly writeSource?: UriSourceDescriptor;
5666
5971
  }
5667
5972
 
5973
+ /** A worker refusal or failure; the code is safe to record without its input or output. */
5974
+ export declare class PluginWorkerError extends Error {
5975
+ readonly code: PluginWorkerErrorCode;
5976
+ constructor(code: PluginWorkerErrorCode, message?: string);
5977
+ }
5978
+
5979
+ /** Stable, content-free failure classes for a plugin worker request. */
5980
+ export declare type PluginWorkerErrorCode = "undeclared" | "invalid_module" | "invalid_input" | "input_too_large" | "output_too_large" | "timeout" | "aborted" | "spawn_failed" | "child_failed" | "invalid_output";
5981
+
5668
5982
  /**
5669
5983
  * What a run did to a URI. The words match the automation run wire's artifact actions. When one
5670
5984
  * run both creates and updates a URI, the reader reports `created`.
@@ -5678,6 +5992,33 @@ export declare interface ProducedResourceDeclaration {
5678
5992
  readonly action: ProducedResourceAction;
5679
5993
  }
5680
5994
 
5995
+ export declare const ProjectDirectory: z.ZodObject<{
5996
+ id: z.ZodString;
5997
+ path: z.ZodString;
5998
+ defaultCwd: z.ZodString;
5999
+ ancestorIds: z.ZodArray<z.ZodString>;
6000
+ }, z.core.$strict>;
6001
+
6002
+ export declare type ProjectDirectory = z.infer<typeof ProjectDirectory>;
6003
+
6004
+ export declare const ProjectDirectoryRequest: z.ZodObject<{
6005
+ id: z.ZodString;
6006
+ }, z.core.$strict>;
6007
+
6008
+ export declare type ProjectDirectoryRequest = z.infer<typeof ProjectDirectoryRequest>;
6009
+
6010
+ /** `project` is null when no project has the requested id. */
6011
+ export declare const ProjectDirectoryResponse: z.ZodObject<{
6012
+ project: z.ZodNullable<z.ZodObject<{
6013
+ id: z.ZodString;
6014
+ path: z.ZodString;
6015
+ defaultCwd: z.ZodString;
6016
+ ancestorIds: z.ZodArray<z.ZodString>;
6017
+ }, z.core.$strict>>;
6018
+ }, z.core.$strict>;
6019
+
6020
+ export declare type ProjectDirectoryResponse = z.infer<typeof ProjectDirectoryResponse>;
6021
+
5681
6022
  declare const Properties: (input: string) => [unknown, string] | [];
5682
6023
 
5683
6024
  declare function PropertiesMapping(input: [unknown, unknown, unknown]): unknown;
@@ -5834,6 +6175,10 @@ declare function Readonly_2<Type extends TSchema>(type: Type): TAddReadonly<Type
5834
6175
 
5835
6176
  declare const Readonly_3: (input: string) => [unknown, string] | [];
5836
6177
 
6178
+ declare type ReadonlyContract<T> = T extends readonly (infer Item)[] ? readonly ReadonlyContract<Item>[] : T extends object ? {
6179
+ readonly [Key in keyof T]: ReadonlyContract<T[Key]>;
6180
+ } : T;
6181
+
5837
6182
  declare type ReadonlyKeys<Properties extends TProperties, Result extends PropertyKey = {
5838
6183
  [Key in keyof Properties]: Properties[Key] extends TReadonly<TSchema> ? (Properties[Key] extends TOptional<Properties[Key]> ? never : Key) : never;
5839
6184
  }[keyof Properties]> = Result;