@yaklabs-ai/plugin-sdk 0.54.0 → 0.54.2

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.
@@ -828,6 +828,10 @@ declare const DollarSign = "$";
828
828
 
829
829
  declare const Dot = ".";
830
830
 
831
+ declare type DriverAction<T> = T extends unknown ? {
832
+ readonly [Key in keyof T]: ReadonlyContract<Exclude<T[Key], undefined>>;
833
+ } : never;
834
+
831
835
  declare type DurationUnit = "seconds" | "minutes" | "hours" | "days" | "weeks" | "months" | "years";
832
836
 
833
837
  declare const Element: (input: string) => [unknown, string] | [];
@@ -1196,7 +1200,7 @@ declare function FactorMapping(input: [unknown, unknown, unknown, unknown, unkno
1196
1200
  export declare function fauxAuthContext(overrides?: Partial<ExtensionAuthContext>): ExtensionAuthContext;
1197
1201
 
1198
1202
  /** The capability handles a `KayAgentPluginApi` always carries - authority is decided per call. */
1199
- export declare type FauxKayAgentCapabilities = Pick<KayAgentPluginApi, "uri" | "network" | "webSession" | "process" | "whiteboard" | "interaction" | "interceptToolCall" | "implementTool" | "systemOne" | "events" | "featureFlags" | "time" | "log" | "userFiles" | "familyFolder" | "vendoredMcp" | "endpoints" | "compiler">;
1203
+ export declare type FauxKayAgentCapabilities = Pick<KayAgentPluginApi, "uri" | "network" | "webSession" | "process" | "whiteboard" | "interaction" | "interceptToolCall" | "implementTool" | "systemOne" | "events" | "featureFlags" | "time" | "log" | "userFiles" | "workers" | "familyFolder" | "vendoredMcp" | "endpoints" | "compiler">;
1200
1204
 
1201
1205
  export declare function fauxKayAgentCapabilities(): FauxKayAgentCapabilities;
1202
1206
 
@@ -1383,80 +1387,248 @@ declare interface InteractionActed {
1383
1387
  }
1384
1388
 
1385
1389
  /**
1386
- * One action over a candidate from the latest observation of the same target. `fill` replaces the
1387
- * field's contents unless `append` is set, and presses Enter afterwards when `submit` is set.
1388
- */
1389
- declare type InteractionAction = {
1390
- readonly kind: "click";
1391
- readonly element: InteractionCandidate;
1392
- } | {
1393
- readonly kind: "fill";
1394
- readonly element: InteractionCandidate;
1395
- readonly text: string;
1396
- readonly submit?: boolean;
1397
- readonly append?: boolean;
1398
- } | {
1399
- readonly kind: "select";
1400
- readonly element: InteractionCandidate;
1401
- } | {
1402
- readonly kind: "activate";
1403
- readonly element: InteractionCandidate;
1404
- } | {
1405
- readonly kind: "press";
1406
- readonly element: InteractionCandidate;
1407
- }
1408
- /**
1409
- * Scroll by `delta` px (positive is down). With `element` (a `scroll` candidate that names a
1410
- * node), the scroll container that candidate scrolls; without, the whole page or window.
1411
- */
1412
- | {
1413
- readonly kind: "scroll";
1414
- readonly delta: number;
1415
- readonly element?: InteractionCandidate;
1416
- } | {
1417
- readonly kind: "wait";
1418
- };
1419
-
1420
- /**
1421
- * One element (or control) an observation offers, with the kind of action it supports. `id` is
1422
- * the driver's per-observation id; the engine mints its own session-unique ids over it. Extra
1423
- * fields are the driver's native identity (a page node number, an accessibility token), returned
1424
- * to the driver untouched in {@link InteractionAction}.
1390
+ * One action over a candidate from the latest observation of the same target. `element` is that
1391
+ * candidate, returned whole so the driver resolves its own native identity immediately before
1392
+ * input. `fill` replaces the field's contents unless `append` is set, and presses Enter (Return)
1393
+ * afterwards when `submit` is set.
1425
1394
  */
1426
- declare interface InteractionCandidate {
1427
- readonly id: string;
1428
- readonly kind: InteractionCandidateKind;
1429
- readonly label: string;
1430
- readonly node?: number | undefined;
1431
- readonly role?: string | undefined;
1432
- readonly value?: string | undefined;
1433
- readonly current_value?: string | undefined;
1434
- readonly checked?: string | undefined;
1435
- readonly selected?: string | undefined;
1436
- readonly expanded?: string | undefined;
1437
- /**
1438
- * What a page driver found the element to be in the DOM, not what the page calls it: `link` is an
1439
- * anchor that navigates to another http(s) page; `widget` is an element that is no form control.
1440
- * Absent means unknown, and the engine then treats the element as any other.
1441
- */
1442
- readonly look?: "link" | "widget" | undefined;
1443
- readonly delta?: number | undefined;
1444
- /** Where an element outside the visible area sits; absent means on screen. */
1445
- readonly position?: "above" | "below" | "beside" | undefined;
1446
- /** A `press` candidate's key (`return`, `escape`, `tab`); its id is `press_<key>` by convention. */
1447
- readonly key?: string | undefined;
1448
- /** The region the element sits in; see {@link InteractionRegion}. */
1449
- readonly region?: InteractionRegion | undefined;
1450
- /**
1451
- * The `node` of the scroll container (a list or pane that scrolls on its own) the element sits
1452
- * in, matching that container's `scroll` candidates; absent when it sits in none.
1453
- */
1454
- readonly scroller?: number | undefined;
1455
- readonly [native: string]: unknown;
1456
- }
1457
-
1458
- /** The candidate kinds a driver may offer. */
1459
- declare type InteractionCandidateKind = "click" | "fill" | "select" | "scroll" | "wait" | "activate" | "press";
1395
+ declare const InteractionAction: z.ZodDiscriminatedUnion<[z.ZodObject<{
1396
+ kind: z.ZodLiteral<"click">;
1397
+ element: z.ZodObject<{
1398
+ id: z.ZodString;
1399
+ kind: z.ZodEnum<{
1400
+ fill: "fill";
1401
+ activate: "activate";
1402
+ click: "click";
1403
+ select: "select";
1404
+ scroll: "scroll";
1405
+ wait: "wait";
1406
+ press: "press";
1407
+ }>;
1408
+ label: z.ZodString;
1409
+ node: z.ZodOptional<z.ZodNumber>;
1410
+ role: z.ZodOptional<z.ZodString>;
1411
+ value: z.ZodOptional<z.ZodString>;
1412
+ current_value: z.ZodOptional<z.ZodString>;
1413
+ checked: z.ZodOptional<z.ZodString>;
1414
+ selected: z.ZodOptional<z.ZodString>;
1415
+ expanded: z.ZodOptional<z.ZodString>;
1416
+ look: z.ZodOptional<z.ZodEnum<{
1417
+ link: "link";
1418
+ widget: "widget";
1419
+ }>>;
1420
+ delta: z.ZodOptional<z.ZodNumber>;
1421
+ position: z.ZodOptional<z.ZodEnum<{
1422
+ above: "above";
1423
+ below: "below";
1424
+ beside: "beside";
1425
+ }>>;
1426
+ region: z.ZodOptional<z.ZodObject<{
1427
+ role: z.ZodString;
1428
+ name: z.ZodString;
1429
+ front: z.ZodOptional<z.ZodBoolean>;
1430
+ }, z.core.$loose>>;
1431
+ scroller: z.ZodOptional<z.ZodNumber>;
1432
+ }, z.core.$loose>;
1433
+ }, z.core.$strict>, z.ZodObject<{
1434
+ kind: z.ZodLiteral<"fill">;
1435
+ element: z.ZodObject<{
1436
+ id: z.ZodString;
1437
+ kind: z.ZodEnum<{
1438
+ fill: "fill";
1439
+ activate: "activate";
1440
+ click: "click";
1441
+ select: "select";
1442
+ scroll: "scroll";
1443
+ wait: "wait";
1444
+ press: "press";
1445
+ }>;
1446
+ label: z.ZodString;
1447
+ node: z.ZodOptional<z.ZodNumber>;
1448
+ role: z.ZodOptional<z.ZodString>;
1449
+ value: z.ZodOptional<z.ZodString>;
1450
+ current_value: z.ZodOptional<z.ZodString>;
1451
+ checked: z.ZodOptional<z.ZodString>;
1452
+ selected: z.ZodOptional<z.ZodString>;
1453
+ expanded: z.ZodOptional<z.ZodString>;
1454
+ look: z.ZodOptional<z.ZodEnum<{
1455
+ link: "link";
1456
+ widget: "widget";
1457
+ }>>;
1458
+ delta: z.ZodOptional<z.ZodNumber>;
1459
+ position: z.ZodOptional<z.ZodEnum<{
1460
+ above: "above";
1461
+ below: "below";
1462
+ beside: "beside";
1463
+ }>>;
1464
+ region: z.ZodOptional<z.ZodObject<{
1465
+ role: z.ZodString;
1466
+ name: z.ZodString;
1467
+ front: z.ZodOptional<z.ZodBoolean>;
1468
+ }, z.core.$loose>>;
1469
+ scroller: z.ZodOptional<z.ZodNumber>;
1470
+ }, z.core.$loose>;
1471
+ text: z.ZodString;
1472
+ submit: z.ZodOptional<z.ZodBoolean>;
1473
+ append: z.ZodOptional<z.ZodBoolean>;
1474
+ }, z.core.$strict>, z.ZodObject<{
1475
+ kind: z.ZodLiteral<"select">;
1476
+ element: z.ZodObject<{
1477
+ id: z.ZodString;
1478
+ kind: z.ZodEnum<{
1479
+ fill: "fill";
1480
+ activate: "activate";
1481
+ click: "click";
1482
+ select: "select";
1483
+ scroll: "scroll";
1484
+ wait: "wait";
1485
+ press: "press";
1486
+ }>;
1487
+ label: z.ZodString;
1488
+ node: z.ZodOptional<z.ZodNumber>;
1489
+ role: z.ZodOptional<z.ZodString>;
1490
+ value: z.ZodOptional<z.ZodString>;
1491
+ current_value: z.ZodOptional<z.ZodString>;
1492
+ checked: z.ZodOptional<z.ZodString>;
1493
+ selected: z.ZodOptional<z.ZodString>;
1494
+ expanded: z.ZodOptional<z.ZodString>;
1495
+ look: z.ZodOptional<z.ZodEnum<{
1496
+ link: "link";
1497
+ widget: "widget";
1498
+ }>>;
1499
+ delta: z.ZodOptional<z.ZodNumber>;
1500
+ position: z.ZodOptional<z.ZodEnum<{
1501
+ above: "above";
1502
+ below: "below";
1503
+ beside: "beside";
1504
+ }>>;
1505
+ region: z.ZodOptional<z.ZodObject<{
1506
+ role: z.ZodString;
1507
+ name: z.ZodString;
1508
+ front: z.ZodOptional<z.ZodBoolean>;
1509
+ }, z.core.$loose>>;
1510
+ scroller: z.ZodOptional<z.ZodNumber>;
1511
+ }, z.core.$loose>;
1512
+ }, z.core.$strict>, z.ZodObject<{
1513
+ kind: z.ZodLiteral<"activate">;
1514
+ element: z.ZodObject<{
1515
+ id: z.ZodString;
1516
+ kind: z.ZodEnum<{
1517
+ fill: "fill";
1518
+ activate: "activate";
1519
+ click: "click";
1520
+ select: "select";
1521
+ scroll: "scroll";
1522
+ wait: "wait";
1523
+ press: "press";
1524
+ }>;
1525
+ label: z.ZodString;
1526
+ node: z.ZodOptional<z.ZodNumber>;
1527
+ role: z.ZodOptional<z.ZodString>;
1528
+ value: z.ZodOptional<z.ZodString>;
1529
+ current_value: z.ZodOptional<z.ZodString>;
1530
+ checked: z.ZodOptional<z.ZodString>;
1531
+ selected: z.ZodOptional<z.ZodString>;
1532
+ expanded: z.ZodOptional<z.ZodString>;
1533
+ look: z.ZodOptional<z.ZodEnum<{
1534
+ link: "link";
1535
+ widget: "widget";
1536
+ }>>;
1537
+ delta: z.ZodOptional<z.ZodNumber>;
1538
+ position: z.ZodOptional<z.ZodEnum<{
1539
+ above: "above";
1540
+ below: "below";
1541
+ beside: "beside";
1542
+ }>>;
1543
+ region: z.ZodOptional<z.ZodObject<{
1544
+ role: z.ZodString;
1545
+ name: z.ZodString;
1546
+ front: z.ZodOptional<z.ZodBoolean>;
1547
+ }, z.core.$loose>>;
1548
+ scroller: z.ZodOptional<z.ZodNumber>;
1549
+ }, z.core.$loose>;
1550
+ }, z.core.$strict>, z.ZodObject<{
1551
+ kind: z.ZodLiteral<"press">;
1552
+ element: z.ZodObject<{
1553
+ id: z.ZodString;
1554
+ kind: z.ZodEnum<{
1555
+ fill: "fill";
1556
+ activate: "activate";
1557
+ click: "click";
1558
+ select: "select";
1559
+ scroll: "scroll";
1560
+ wait: "wait";
1561
+ press: "press";
1562
+ }>;
1563
+ label: z.ZodString;
1564
+ node: z.ZodOptional<z.ZodNumber>;
1565
+ role: z.ZodOptional<z.ZodString>;
1566
+ value: z.ZodOptional<z.ZodString>;
1567
+ current_value: z.ZodOptional<z.ZodString>;
1568
+ checked: z.ZodOptional<z.ZodString>;
1569
+ selected: z.ZodOptional<z.ZodString>;
1570
+ expanded: z.ZodOptional<z.ZodString>;
1571
+ look: z.ZodOptional<z.ZodEnum<{
1572
+ link: "link";
1573
+ widget: "widget";
1574
+ }>>;
1575
+ delta: z.ZodOptional<z.ZodNumber>;
1576
+ position: z.ZodOptional<z.ZodEnum<{
1577
+ above: "above";
1578
+ below: "below";
1579
+ beside: "beside";
1580
+ }>>;
1581
+ region: z.ZodOptional<z.ZodObject<{
1582
+ role: z.ZodString;
1583
+ name: z.ZodString;
1584
+ front: z.ZodOptional<z.ZodBoolean>;
1585
+ }, z.core.$loose>>;
1586
+ scroller: z.ZodOptional<z.ZodNumber>;
1587
+ }, z.core.$loose>;
1588
+ }, z.core.$strict>, z.ZodObject<{
1589
+ kind: z.ZodLiteral<"scroll">;
1590
+ delta: z.ZodNumber;
1591
+ element: z.ZodOptional<z.ZodObject<{
1592
+ id: z.ZodString;
1593
+ kind: z.ZodEnum<{
1594
+ fill: "fill";
1595
+ activate: "activate";
1596
+ click: "click";
1597
+ select: "select";
1598
+ scroll: "scroll";
1599
+ wait: "wait";
1600
+ press: "press";
1601
+ }>;
1602
+ label: z.ZodString;
1603
+ node: z.ZodOptional<z.ZodNumber>;
1604
+ role: z.ZodOptional<z.ZodString>;
1605
+ value: z.ZodOptional<z.ZodString>;
1606
+ current_value: z.ZodOptional<z.ZodString>;
1607
+ checked: z.ZodOptional<z.ZodString>;
1608
+ selected: z.ZodOptional<z.ZodString>;
1609
+ expanded: z.ZodOptional<z.ZodString>;
1610
+ look: z.ZodOptional<z.ZodEnum<{
1611
+ link: "link";
1612
+ widget: "widget";
1613
+ }>>;
1614
+ delta: z.ZodOptional<z.ZodNumber>;
1615
+ position: z.ZodOptional<z.ZodEnum<{
1616
+ above: "above";
1617
+ below: "below";
1618
+ beside: "beside";
1619
+ }>>;
1620
+ region: z.ZodOptional<z.ZodObject<{
1621
+ role: z.ZodString;
1622
+ name: z.ZodString;
1623
+ front: z.ZodOptional<z.ZodBoolean>;
1624
+ }, z.core.$loose>>;
1625
+ scroller: z.ZodOptional<z.ZodNumber>;
1626
+ }, z.core.$loose>>;
1627
+ }, z.core.$strict>, z.ZodObject<{
1628
+ kind: z.ZodLiteral<"wait">;
1629
+ }, z.core.$strict>], "kind">;
1630
+
1631
+ declare type InteractionAction = z.infer<typeof InteractionAction>;
1460
1632
 
1461
1633
  declare interface InteractionDriver {
1462
1634
  /** Unique in the session. `builtin:` is reserved for Bonsai's own drivers. */
@@ -1469,12 +1641,12 @@ declare interface InteractionDriver {
1469
1641
  /** Whether the driver can act at all right now (platform, grants, a live connection). */
1470
1642
  isAvailable(): Promise<boolean>;
1471
1643
  targets(): Promise<InteractionOutcome<{
1472
- readonly targets: readonly InteractionTarget[];
1644
+ readonly targets: readonly ReadonlyInteractionTarget[];
1473
1645
  }>>;
1474
1646
  observe(target: string | undefined, options?: {
1475
1647
  readonly fullText?: boolean;
1476
1648
  }): Promise<InteractionOutcome<InteractionObserved>>;
1477
- act(target: string | undefined, action: InteractionAction): Promise<InteractionOutcome<InteractionActed>>;
1649
+ act(target: string | undefined, action: ReadonlyInteractionAction): Promise<InteractionOutcome<InteractionActed>>;
1478
1650
  screenshot(target: string | undefined): Promise<InteractionOutcome<{
1479
1651
  readonly png: Uint8Array;
1480
1652
  }>>;
@@ -1507,21 +1679,56 @@ declare interface InteractionFailure {
1507
1679
  readonly message: string;
1508
1680
  }
1509
1681
 
1510
- /** What a driver sees on one target. */
1511
- declare interface InteractionObservation {
1512
- readonly url: string;
1513
- readonly title: string;
1514
- /** Visible text, or the whole page's text when the observe asked for `fullText`; capped. */
1515
- readonly text: string;
1516
- readonly actions: readonly InteractionCandidate[];
1517
- /** Candidates the driver dropped to stay within its cap. */
1518
- readonly omitted_actions: number;
1519
- }
1682
+ /** What a driver sees on one target: its address, title, text, and actionable candidates. */
1683
+ declare const InteractionObservation: z.ZodObject<{
1684
+ url: z.ZodString;
1685
+ title: z.ZodString;
1686
+ text: z.ZodString;
1687
+ actions: z.ZodArray<z.ZodObject<{
1688
+ id: z.ZodString;
1689
+ kind: z.ZodEnum<{
1690
+ fill: "fill";
1691
+ activate: "activate";
1692
+ click: "click";
1693
+ select: "select";
1694
+ scroll: "scroll";
1695
+ wait: "wait";
1696
+ press: "press";
1697
+ }>;
1698
+ label: z.ZodString;
1699
+ node: z.ZodOptional<z.ZodNumber>;
1700
+ role: z.ZodOptional<z.ZodString>;
1701
+ value: z.ZodOptional<z.ZodString>;
1702
+ current_value: z.ZodOptional<z.ZodString>;
1703
+ checked: z.ZodOptional<z.ZodString>;
1704
+ selected: z.ZodOptional<z.ZodString>;
1705
+ expanded: z.ZodOptional<z.ZodString>;
1706
+ look: z.ZodOptional<z.ZodEnum<{
1707
+ link: "link";
1708
+ widget: "widget";
1709
+ }>>;
1710
+ delta: z.ZodOptional<z.ZodNumber>;
1711
+ position: z.ZodOptional<z.ZodEnum<{
1712
+ above: "above";
1713
+ below: "below";
1714
+ beside: "beside";
1715
+ }>>;
1716
+ region: z.ZodOptional<z.ZodObject<{
1717
+ role: z.ZodString;
1718
+ name: z.ZodString;
1719
+ front: z.ZodOptional<z.ZodBoolean>;
1720
+ }, z.core.$loose>>;
1721
+ scroller: z.ZodOptional<z.ZodNumber>;
1722
+ }, z.core.$loose>>;
1723
+ omitted_actions: z.ZodNumber;
1724
+ }, z.core.$strict>;
1725
+
1726
+ declare type InteractionObservation = z.infer<typeof InteractionObservation>;
1520
1727
 
1521
1728
  declare interface InteractionObserved {
1522
1729
  /** The address of the target observed; absent when the default target has no address. */
1523
1730
  readonly target?: string;
1524
- readonly observation: InteractionObservation;
1731
+ readonly observation: ReadonlyInteractionObservation;
1525
1732
  /** Lines the engine shows the agent under the observation (where the target sits, siblings). */
1526
1733
  readonly notes?: readonly string[];
1527
1734
  }
@@ -1539,20 +1746,6 @@ declare type InteractionOutcome<T> = ({
1539
1746
  readonly ok: true;
1540
1747
  } & T) | InteractionFailure;
1541
1748
 
1542
- /**
1543
- * The part of a page or window an element sits in: the open dialog, menu, or sheet it belongs to,
1544
- * else its landmark (navigation, main, a window). `front` marks the overlay covering the rest: a
1545
- * modal dialog (or one held by a full-screen overlay), a sheet, or a floating menu, the last such
1546
- * in the document; elements outside it
1547
- * usually cannot be clicked while it is open. A docked or always-visible dialog or menu is a
1548
- * region but never in front.
1549
- */
1550
- declare interface InteractionRegion {
1551
- readonly role: string;
1552
- readonly name: string;
1553
- readonly front?: boolean | undefined;
1554
- }
1555
-
1556
1749
  /**
1557
1750
  * One surface Bonsai ships, in the driver contract's own shape, so a plugin's driver is the surface
1558
1751
  * plus an identity: `{ id, label, kind, ...api.interaction.desktop }`. Each call is checked
@@ -1565,16 +1758,18 @@ declare interface InteractionRegion {
1565
1758
  declare type InteractionSurface = Pick<InteractionDriver, "isAvailable" | "targets" | "observe" | "act" | "screenshot" | "open">;
1566
1759
 
1567
1760
  /**
1568
- * One thing a driver can be pointed at. `id` is a driver-owned address, unique across every
1569
- * driver in the session (prefix it with your scheme), that the agent passes back as `target`.
1570
- * `active` marks the driver's default target.
1761
+ * One thing a driver can be pointed at: a browser page, a running app. `id` is the driver-owned
1762
+ * address the agent passes back as `target` (`kay://tabs/.../items/<item>`, `app://<bundle id>`).
1763
+ * `active` marks the default target (the page the user is looking at, the front app).
1571
1764
  */
1572
- declare interface InteractionTarget {
1573
- readonly id: string;
1574
- readonly title: string;
1575
- readonly url?: string;
1576
- readonly active: boolean;
1577
- }
1765
+ declare const InteractionTarget: z.ZodObject<{
1766
+ id: z.ZodString;
1767
+ title: z.ZodString;
1768
+ url: z.ZodOptional<z.ZodString>;
1769
+ active: z.ZodBoolean;
1770
+ }, z.core.$strict>;
1771
+
1772
+ declare type InteractionTarget = z.infer<typeof InteractionTarget>;
1578
1773
 
1579
1774
  /** Creates an Interface using the given heritage and properties. */
1580
1775
  declare function Interface<Heritage extends TSchema[], Properties extends TProperties>(heritage: [...Heritage], properties: Properties, options?: TSchemaOptions): TInterface<Heritage, Properties>;
@@ -2524,8 +2719,16 @@ declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
2524
2719
  * 0.54.0 adds named UI host grants for shared configuration/auth/account reads, retained connection
2525
2720
  * progress/dismissal and support. Built-in-only page capability scopes are removed; executable
2526
2721
  * pages declare capabilities on apps[].
2722
+ *
2723
+ * 0.54.1 adds manifest-declared plugin workers on both backend targets and exposes the canonical
2724
+ * transcript placement and answer-stretch rules through the SDK.
2725
+ *
2726
+ * 0.54.2 lets a signal list the files that came with it (epic #15668). `PluginSignal` gains an
2727
+ * optional `attachments`: each file's name, media type, size and the address its bytes are read
2728
+ * from, never the bytes. Gmail lists a mail's attachments there, so Flows can file them. Additive:
2729
+ * a plugin that publishes attachments declares ^0.54.2.
2527
2730
  */
2528
- declare const KAY_PLUGIN_SDK_VERSION: "0.54.0";
2731
+ declare const KAY_PLUGIN_SDK_VERSION: "0.54.2";
2529
2732
 
2530
2733
  declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
2531
2734
 
@@ -2781,6 +2984,8 @@ declare interface KayAgentPluginApi {
2781
2984
  * {@link KayAppUserFiles}.
2782
2985
  */
2783
2986
  readonly userFiles: KayAppUserFiles;
2987
+ /** Always present; only modules declared by this plugin may run. SDK 0.54.1. */
2988
+ readonly workers: KayPluginWorkers;
2784
2989
  /**
2785
2990
  * Publish the plugin's declared events, for example so a default notification rule can tell the
2786
2991
  * user what the agent just did. Always present, like {@link systemOne}: there is nothing to
@@ -3405,6 +3610,15 @@ declare const KayPluginProtocolVersion: z.ZodLiteral<"kay.plugin.v1">;
3405
3610
 
3406
3611
  declare type KayPluginProtocolVersion = z.infer<typeof KayPluginProtocolVersion>;
3407
3612
 
3613
+ /** Run only this plugin's declared modules in a fresh child owned by its hosting process. */
3614
+ declare interface KayPluginWorkers {
3615
+ /** The host terminates the child on deadline, caller abort or plugin disposal. */
3616
+ run<T = unknown>(workerId: string, input: unknown, options: {
3617
+ readonly timeoutMs: number;
3618
+ readonly signal?: AbortSignal;
3619
+ }): Promise<T>;
3620
+ }
3621
+
3408
3622
  /** Applies a KeyOf action to the given type. */
3409
3623
  declare function KeyOf<Type extends TSchema>(type: Type, options?: TSchemaOptions): TKeyOf_2<Type>;
3410
3624
 
@@ -4727,6 +4941,16 @@ declare function Readonly_2<Type extends TSchema>(type: Type): TAddReadonly<Type
4727
4941
 
4728
4942
  declare const Readonly_3: (input: string) => [unknown, string] | [];
4729
4943
 
4944
+ declare type ReadonlyContract<T> = T extends readonly (infer Item)[] ? readonly ReadonlyContract<Item>[] : T extends object ? {
4945
+ readonly [Key in keyof T]: ReadonlyContract<T[Key]>;
4946
+ } : T;
4947
+
4948
+ declare type ReadonlyInteractionAction = DriverAction<InteractionAction>;
4949
+
4950
+ declare type ReadonlyInteractionObservation = ReadonlyContract<InteractionObservation>;
4951
+
4952
+ declare type ReadonlyInteractionTarget = ReadonlyContract<InteractionTarget>;
4953
+
4730
4954
  declare type ReadonlyKeys<Properties extends TProperties, Result extends PropertyKey = {
4731
4955
  [Key in keyof Properties]: Properties[Key] extends TReadonly<TSchema> ? (Properties[Key] extends TOptional<Properties[Key]> ? never : Key) : never;
4732
4956
  }[keyof Properties]> = Result;
@@ -4931,6 +5155,7 @@ declare const ResolvedPluginContractV1: z.ZodObject<{
4931
5155
  eventSubscription: "eventSubscription";
4932
5156
  appDataSource: "appDataSource";
4933
5157
  whiteboardType: "whiteboardType";
5158
+ workingDocumentProvider: "workingDocumentProvider";
4934
5159
  approvalType: "approvalType";
4935
5160
  workflow: "workflow";
4936
5161
  contextContributor: "contextContributor";
@@ -4950,6 +5175,10 @@ declare const ResolvedPluginContractV1: z.ZodObject<{
4950
5175
  consumesAuthServices: z.ZodArray<z.ZodString>;
4951
5176
  explicitDependencies: z.ZodArray<z.ZodString>;
4952
5177
  dataDirSharedWith: z.ZodOptional<z.ZodString>;
5178
+ workers: z.ZodOptional<z.ZodArray<z.ZodObject<{
5179
+ localId: z.ZodString;
5180
+ module: z.ZodString;
5181
+ }, z.core.$strict>>>;
4953
5182
  workloadPurposes: z.ZodOptional<z.ZodArray<z.ZodObject<{
4954
5183
  purpose: z.ZodString;
4955
5184
  workloadClass: z.ZodEnum<{
@@ -5986,6 +6215,24 @@ declare const ResolvedPluginContractV1: z.ZodObject<{
5986
6215
  handover: z.ZodOptional<z.ZodLiteral<true>>;
5987
6216
  globalId: z.ZodString;
5988
6217
  }, z.core.$strict>>>;
6218
+ kayAppWorkingDocumentProviders: z.ZodOptional<z.ZodArray<z.ZodObject<{
6219
+ localId: z.ZodString;
6220
+ globalId: z.ZodString;
6221
+ displayName: z.ZodString;
6222
+ schemes: z.ZodArray<z.ZodString>;
6223
+ hosts: z.ZodArray<z.ZodString>;
6224
+ authServiceId: z.ZodOptional<z.ZodString>;
6225
+ authSchemeId: z.ZodOptional<z.ZodString>;
6226
+ scopeRequirement: z.ZodOptional<z.ZodObject<{
6227
+ purpose: z.ZodString;
6228
+ alternatives: z.ZodArray<z.ZodObject<{
6229
+ allOf: z.ZodArray<z.ZodObject<{
6230
+ scope: z.ZodString;
6231
+ reason: z.ZodExactOptional<z.ZodString>;
6232
+ }, z.core.$strict>>;
6233
+ }, z.core.$strict>>;
6234
+ }, z.core.$strict>>;
6235
+ }, z.core.$strict>>>;
5989
6236
  kayAppMcpServers: z.ZodOptional<z.ZodArray<z.ZodObject<{
5990
6237
  name: z.ZodString;
5991
6238
  pluginId: z.ZodString;
@@ -320,6 +320,7 @@ function fauxKayAgentCapabilities() {
320
320
  // Throws `not-served`, so the plugin's own `catch` runs. A test that wants answers overrides
321
321
  // this handle after the spread.
322
322
  systemOne: createUnavailableSystemOneClient(),
323
+ workers: { run: unwired("workers.run") },
323
324
  // Accepts and drops, like the registrations above: the real `publish` never throws, so a
324
325
  // rejecting double would fail tests for a reason production never has. A test asserting what
325
326
  // its plugin publishes overrides this handle after the spread.