@yaklabs-ai/plugin-sdk 0.12.5 → 0.13.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.
package/dist/kay-app.d.ts CHANGED
@@ -21,7 +21,7 @@ declare interface AccountIdentity {
21
21
  readonly displayName?: string;
22
22
  /** Absolute URL of the account's avatar. */
23
23
  readonly avatarUrl?: string;
24
- /** Issuer-asserted beta-tester flag; only Kay's product-account service sets it. */
24
+ /** Issuer-asserted beta-tester flag; only Bonsai's product-account service sets it. */
25
25
  readonly betaTester?: boolean;
26
26
  readonly activeOrganizationId?: string;
27
27
  readonly organizationSelectionState?: "selected" | "unresolved";
@@ -29,7 +29,7 @@ declare interface AccountIdentity {
29
29
  /**
30
30
  * Provider-native session id claim (WorkOS's `sid`), needed to call the provider's own
31
31
  * session-revocation endpoint at sign-out (`POST /user_management/sessions/revoke`, not yet
32
- * wired — see `docs/kay-account-auth.md`'s "Sign-out guarantee" section). Only Kay's WorkOS
32
+ * wired — see `docs/kay-account-auth.md`'s "Sign-out guarantee" section). Only Bonsai's WorkOS
33
33
  * product-account exchange/refresh sets it; every other provider leaves it absent.
34
34
  */
35
35
  readonly providerSessionId?: string;
@@ -762,7 +762,7 @@ export declare interface JevScoreQuestion {
762
762
  * Those are host-side (`@kay/agent-runtime`'s `kay/jev/`).
763
763
  * ---
764
764
  *
765
- * The vocabulary is Kay's own (SDK 0.12.0). Before it, `use` received TypeSafe's `TypeSafeClient`
765
+ * The vocabulary is Bonsai's own (SDK 0.12.0). Before it, `use` received TypeSafe's `TypeSafeClient`
766
766
  * and plugins coded against a vendor's types. It follows pi's classifier contract, which the host
767
767
  * runs Jev through: a yes/no question is `bool` and answers a `probability`, every instruction and
768
768
  * criterion is text, and the state is a JSON object.
@@ -904,7 +904,7 @@ declare interface KayAgentWhiteboardUpdateInput {
904
904
  }
905
905
 
906
906
  /**
907
- * The signed-in Kay account. Always present on {@link KayAppPluginApi}.
907
+ * The signed-in Bonsai account. Always present on {@link KayAppPluginApi}.
908
908
  *
909
909
  * Reading the profile is ungated: it exposes the signed-in user's own identity to a plugin they
910
910
  * explicitly enabled. The two stronger operations are separate claims, checked per call —
@@ -948,7 +948,7 @@ export declare interface KayAppAccount {
948
948
  assertResult?(): Promise<KayAppAccountAssertionResult>;
949
949
  /**
950
950
  * Change the user-editable part of the signed-in profile (today: the display name). PRESENT
951
- * only with the `update` operation granted. Runs through Kay's own profile-update path — the
951
+ * only with the `update` operation granted. Runs through Bonsai's own profile-update path — the
952
952
  * same one Account settings uses — so the change reaches WorkOS, the local account snapshot,
953
953
  * Memory's account-owned person note, and every `subscribe` listener; later sessions see the
954
954
  * new name in their prompt. Rejects when signed out or when the backend refuses the value
@@ -991,7 +991,7 @@ export declare interface KayAppAccount {
991
991
  * issuer's own JWKS.
992
992
  *
993
993
  * It is **not audience-scoped**. A plugin holding it can present itself as the user to anything
994
- * that accepts a Kay product-account token, not only to the relying party it was fetched for.
994
+ * that accepts a Bonsai product-account token, not only to the relying party it was fetched for.
995
995
  * Treat it as live secret material: never log it, never put it in an event payload or an endpoint
996
996
  * response, never persist it. Read it, use it in the outbound request, drop it.
997
997
  *
@@ -1004,7 +1004,7 @@ export declare interface KayAppAccountAssertion {
1004
1004
  /**
1005
1005
  * The OIDC issuer that can verify `token`.
1006
1006
  *
1007
- * Travels with the assertion because Kay runs one product-account provider instance per release
1007
+ * Travels with the assertion because Bonsai runs one product-account provider instance per release
1008
1008
  * channel (local-dev, Yak, production). A verifier that hardcodes the production issuer
1009
1009
  * silently rejects every other install.
1010
1010
  */
@@ -1052,8 +1052,8 @@ export declare type KayAppAccountAssertionResult = {
1052
1052
  };
1053
1053
 
1054
1054
  /**
1055
- * Who is signed in to Kay. Metadata only — this carries no secret and cannot be presented to
1056
- * anyone as proof. Derived from the Kay product-account record's stored identity.
1055
+ * Who is signed in to Bonsai. Metadata only — this carries no secret and cannot be presented to
1056
+ * anyone as proof. Derived from the Bonsai product-account record's stored identity.
1057
1057
  */
1058
1058
  export declare interface KayAppAccountProfile {
1059
1059
  /** The account's stable provider `sub`. Survives an email change; prefer it as a durable key. */
@@ -1062,7 +1062,7 @@ export declare interface KayAppAccountProfile {
1062
1062
  readonly displayName?: string;
1063
1063
  readonly avatarUrl?: string;
1064
1064
  /**
1065
- * Whether the account is a Kay beta tester, sourced from the Kay Cloud API's `GET /v1/me`
1065
+ * Whether the account is a Bonsai beta tester, sourced from the Bonsai Cloud API's `GET /v1/me`
1066
1066
  * (authoritative). Absent means unknown, not "no" — a live read that could not run, or a
1067
1067
  * grant that predates the API becoming the source, are both indistinguishable here. A present
1068
1068
  * value is refreshed on a bounded interval, not only at sign-in; see
@@ -1127,6 +1127,10 @@ export declare interface KayAppAgentDefinition {
1127
1127
  * These rules outrank the human's standing settings-page preference (they seed a level above
1128
1128
  * `user`) and cannot be removed by the running session. They are re-read from the definition at
1129
1129
  * every session activation, so a rule the plugin stops declaring stops applying.
1130
+ *
1131
+ * They also bind every subagent such a session spawns with `agent_spawn`, and every subagent
1132
+ * those spawn in turn. A subagent inherits only these rules (and {@link permissionsFallback}),
1133
+ * not this definition's instructions or tool roster.
1130
1134
  */
1131
1135
  readonly permissions?: readonly PluginAgentDefinitionPermissionRule[];
1132
1136
  /**
@@ -1151,8 +1155,8 @@ export declare interface KayAppAgentDefinition {
1151
1155
  export declare interface KayAppAgentDefinitionConfig {
1152
1156
  /**
1153
1157
  * The definition's instructions: what this agent exists to do. Rendered as the
1154
- * agent-configuration trailer at the END of Kay's own prompt document, subordinate to
1155
- * everything above it. A definition never replaces Kay's prompt; it extends it.
1158
+ * agent-configuration trailer at the END of Bonsai's own prompt document, subordinate to
1159
+ * everything above it. A definition never replaces Bonsai's prompt; it extends it.
1156
1160
  */
1157
1161
  readonly instructions?: string;
1158
1162
  readonly activeToolNames?: readonly KayAppSessionRunHostToolName[];
@@ -1161,7 +1165,7 @@ export declare interface KayAppAgentDefinitionConfig {
1161
1165
  readonly thinkingLevel?: KayAppThinkingLevel;
1162
1166
  readonly cwd?: string;
1163
1167
  /**
1164
- * The definition's structured-output contract for a settled turn. Kay's own default agent
1168
+ * The definition's structured-output contract for a settled turn. Bonsai's own default agent
1165
1169
  * carries its standing-recap contract through this field; a plugin-authored definition may
1166
1170
  * carry one too, with the same discipline: keep it optional, and use `whenToSubmit` to say
1167
1171
  * when it applies rather than making every turn terminate through it.
@@ -1493,7 +1497,7 @@ export declare type KayAppAutomationEffectInput = {
1493
1497
  /** The file this automation runs; every stored binding carries one. */
1494
1498
  readonly ref?: KayAppAutomationScriptRef;
1495
1499
  /**
1496
- * Inline source, at CREATE only: Kay saves it into the owning session's scripts folder
1500
+ * Inline source, at CREATE only: Bonsai saves it into the owning session's scripts folder
1497
1501
  * and stores a reference to that file. Pass this OR `ref`, never both.
1498
1502
  */
1499
1503
  readonly source?: string;
@@ -1503,7 +1507,7 @@ export declare type KayAppAutomationEffectInput = {
1503
1507
  /**
1504
1508
  * One thing a run created OUTSIDE this machine — today a GitHub pull request
1505
1509
  * its session opened. A sibling of {@link KayAppAutomationArtifactItem}, not a
1506
- * widening of it: an external resource has no revision, no Kay uri module, and
1510
+ * widening of it: an external resource has no revision, no Bonsai uri module, and
1507
1511
  * nothing on this machine to re-read.
1508
1512
  *
1509
1513
  * `kind` is the run-detail wire's closed external-resource vocabulary and names
@@ -1685,12 +1689,12 @@ export declare type KayAppAutomationRunOutcome = {
1685
1689
  export declare interface KayAppAutomations {
1686
1690
  list(ctx: KayAppAutomationContext): Promise<readonly KayAppAutomationBinding[]>;
1687
1691
  /**
1688
- * Kay's own recurring work. NOT session-scoped, unlike {@link list}: these
1692
+ * Bonsai's own recurring work. NOT session-scoped, unlike {@link list}: these
1689
1693
  * belong to the daemon, so every session sees the same set.
1690
1694
  */
1691
1695
  listManaged(ctx: KayAppAutomationContext): Promise<readonly KayAppManagedAutomation[]>;
1692
1696
  /**
1693
- * Run one of Kay's own automations now, without waiting for its schedule.
1697
+ * Run one of Bonsai's own automations now, without waiting for its schedule.
1694
1698
  *
1695
1699
  * Separate from {@link runNow} because it addresses a different population:
1696
1700
  * `runNow` proves the caller owns the binding, and a managed automation has
@@ -1731,7 +1735,7 @@ export declare interface KayAppAutomations {
1731
1735
  * Switch one automation on or off.
1732
1736
  *
1733
1737
  * Reaches TWO populations, and the result says which one it answered about. A binding this
1734
- * session owns comes back as a full {@link KayAppAutomationBinding}. One of Kay's OWN
1738
+ * session owns comes back as a full {@link KayAppAutomationBinding}. One of Bonsai's OWN
1735
1739
  * automations comes back as a {@link KayAppManagedAutomation} instead: its effect belongs to the
1736
1740
  * daemon and never crosses a plugin boundary, so there is no binding to hand back. That is the
1737
1741
  * whole reason this is a union rather than one shape - a caller reading `binding`
@@ -1820,9 +1824,9 @@ export declare type KayAppAutomationSuggestionItem = {
1820
1824
  });
1821
1825
 
1822
1826
  /**
1823
- * Watch one Kay URI and fire only when what it reads back CHANGES. Carries no
1827
+ * Watch one Bonsai URI and fire only when what it reads back CHANGES. Carries no
1824
1828
  * `sessionId`: unlike the fact-driven conditions, what it watches lives OUTSIDE
1825
- * Kay — which is also why it outlives the session that created it.
1829
+ * Bonsai — which is also why it outlives the session that created it.
1826
1830
  */
1827
1831
  export declare interface KayAppAutomationUriChangeCondition {
1828
1832
  readonly kind: "uri-change";
@@ -2052,6 +2056,14 @@ export declare interface KayAppCorpusEntryBatch {
2052
2056
  /** One stored session, as the granted corpus enumerates them. Keyed by its stable `sessionId`. */
2053
2057
  export declare interface KayAppCorpusSession {
2054
2058
  readonly sessionId: string;
2059
+ /**
2060
+ * Who the session is for, as stamped when it was created: a person's own session (`user`), a
2061
+ * spawned subagent, or a session Bonsai runs with nobody watching (`system`, `followup`). It lets
2062
+ * a reader skip sessions without opening their transcripts. Absent when the index does not know
2063
+ * it (a session older than origin stamping, or a row not yet rebuilt from its transcript): that
2064
+ * is unknown, not `user`.
2065
+ */
2066
+ readonly origin?: KayAppSessionOrigin | undefined;
2055
2067
  }
2056
2068
 
2057
2069
  /** Cheap identity for the current contents of one stored session transcript. */
@@ -2263,7 +2275,7 @@ export declare interface KayAppDynamicContextContribution {
2263
2275
  }
2264
2276
 
2265
2277
  /**
2266
- * One delivery pass's request. For modern Kay sends, `texts` contains one
2278
+ * One delivery pass's request. For modern Bonsai sends, `texts` contains one
2267
2279
  * source-ordered human-input projection with inline paste nodes expanded to
2268
2280
  * their exact bodies. Older paste-aware clients contribute their exact inline
2269
2281
  * paste bodies. UI-generated labels such as `[Pasted 21 lines]` never appear.
@@ -2280,7 +2292,7 @@ export declare interface KayAppDynamicContextRequest {
2280
2292
  readonly search: (opts?: KayAppDynamicContextSearchOptions) => Promise<readonly KayAppDynamicContextSearchHit[]>;
2281
2293
  }
2282
2294
 
2283
- /** One indexed reference from Kay's shared knowledge — routes plus revision identity, never answers. */
2295
+ /** One indexed reference from Bonsai's shared knowledge — routes plus revision identity, never answers. */
2284
2296
  export declare interface KayAppDynamicContextSearchHit {
2285
2297
  readonly uri: string;
2286
2298
  readonly score: number;
@@ -2310,7 +2322,7 @@ export declare interface KayAppDynamicContextSearchOptions {
2310
2322
 
2311
2323
  /**
2312
2324
  * The app-wide endpoint bus. A plugin registers named handlers a consuming surface can invoke; the
2313
- * host routes invocations (e.g. Kay Desktop forwards the renderer's frame-gated call to the daemon,
2325
+ * host routes invocations (e.g. Bonsai Desktop forwards the renderer's frame-gated call to the daemon,
2314
2326
  * where the endpoint is single-homed). The corpus is NEVER reachable here — only what the plugin
2315
2327
  * explicitly exposes. Both `payload` and the handler's return ride strict JSON on the wire.
2316
2328
  */
@@ -2383,7 +2395,7 @@ export declare interface KayAppLifecycle {
2383
2395
  * each write or run is checked against `automations.write` / `automations.run`.
2384
2396
  */
2385
2397
  /**
2386
- * One of Kay's OWN recurring automations — a bundled plugin's nightly
2398
+ * One of Bonsai's OWN recurring automations — a bundled plugin's nightly
2387
2399
  * workflow, the knowledge sweep — as a plugin may see it.
2388
2400
  *
2389
2401
  * A narrow projection rather than a binding: a managed automation's effect
@@ -2495,7 +2507,7 @@ export declare interface KayAppModelFeatures {
2495
2507
  readonly maxOutputTokens?: number;
2496
2508
  }
2497
2509
 
2498
- /** The plugin-safe projection of one model in Kay's live model catalog. */
2510
+ /** The plugin-safe projection of one model in Bonsai's live model catalog. */
2499
2511
  export declare interface KayAppModelInfo {
2500
2512
  readonly modelReference: string;
2501
2513
  readonly provider: string;
@@ -2521,7 +2533,7 @@ export declare type KayAppModelModality = "text" | "image" | "audio" | "video" |
2521
2533
  export declare interface KayAppModels {
2522
2534
  /** Returns the current projection; an empty catalog is an empty array. */
2523
2535
  list(): Promise<readonly KayAppModelInfo[]>;
2524
- /** Present when the host resolves image-model nominations (every Kay daemon does). */
2536
+ /** Present when the host resolves image-model nominations (every Bonsai daemon does). */
2525
2537
  resolveImageModel?(provider: string): Promise<KayAppImageModelInfo>;
2526
2538
  /**
2527
2539
  * Returns the four product model tiers, each with its live point-in-time resolution
@@ -2562,7 +2574,7 @@ export declare type KayAppModelSelection = {
2562
2574
  readonly provider?: string | undefined;
2563
2575
  };
2564
2576
 
2565
- /** Kay's canonical task-difficulty tier vocabulary at the plugin boundary. */
2577
+ /** Bonsai's canonical task-difficulty tier vocabulary at the plugin boundary. */
2566
2578
  export declare type KayAppModelTierId = "small" | "medium" | "large" | "ultra";
2567
2579
 
2568
2580
  /**
@@ -2609,7 +2621,7 @@ export declare interface KayAppPaths {
2609
2621
  */
2610
2622
  readonly sessionsRoot?: string;
2611
2623
  /**
2612
- * Absolute path to Kay's local telemetry directory. The live telemetry lane itself is a
2624
+ * Absolute path to Bonsai's local telemetry directory. The live telemetry lane itself is a
2613
2625
  * Postgres table (`telemetry.usage_events`), not anything under this path; it is never a
2614
2626
  * PostHog credential or a remote-export queue. This directory used to hold the retired
2615
2627
  * file-based store's JSONL journals and compacted Parquet, but those are moved aside once,
@@ -2619,7 +2631,7 @@ export declare interface KayAppPaths {
2619
2631
  */
2620
2632
  readonly telemetryRoot?: string;
2621
2633
  /**
2622
- * Absolute path to Kay's observability log directory. The two JSONL event lanes live here: the
2634
+ * Absolute path to Bonsai's observability log directory. The two JSONL event lanes live here: the
2623
2635
  * Desktop main process appends `kay-<YYYY-MM-DD>.jsonl` (fatal-startup records append into that
2624
2636
  * same lane) and the daemon appends `kay-runtime-<YYYY-MM-DD>.jsonl` — read BOTH lanes, or you
2625
2637
  * are reading half the system. Lane files rotate daily, gain a `.N` suffix past 50 MB, and are
@@ -2683,7 +2695,7 @@ export declare interface KayAppPluginApi {
2683
2695
  /** Register app-lifetime cleanup for plugin-owned processes, sockets, watchers, or timers. */
2684
2696
  readonly lifecycle: KayAppLifecycle;
2685
2697
  /**
2686
- * Manifest-declared app-data sources. Present whenever the host runs an app-data lane (every Kay
2698
+ * Manifest-declared app-data sources. Present whenever the host runs an app-data lane (every Bonsai
2687
2699
  * daemon does); absence means THIS host composed none, never that a grant is missing. Each
2688
2700
  * registration is checked against `app-data.register {source}` for the declared
2689
2701
  * `contributes.dataSources` localId it names.
@@ -2703,7 +2715,7 @@ export declare interface KayAppPluginApi {
2703
2715
  */
2704
2716
  readonly corpus: KayAppCorpus;
2705
2717
  /**
2706
- * The signed-in Kay product account. Present whenever the host runs an account service; absence
2718
+ * The signed-in Bonsai product account. Present whenever the host runs an account service; absence
2707
2719
  * means this host composed none, never that a grant is missing. Reading identity is ungated; the
2708
2720
  * two stronger operations are checked per call against `account.assert` and `account.update`.
2709
2721
  */
@@ -3409,6 +3421,14 @@ export declare interface KayAppSessions {
3409
3421
  /** Omit to inherit the opener; null explicitly selects no project. */
3410
3422
  readonly projectId?: string | null;
3411
3423
  readonly title?: string | undefined;
3424
+ /**
3425
+ * The new session's model, as a tier word (`small`, `medium`, `large`, `ultra`): the daemon
3426
+ * picks the concrete model through the same tier resolution every other tier choice takes.
3427
+ * Absent, the person's own selection applies, so a session a plugin opens on its own account
3428
+ * runs on whatever they happen to be using, Ultra included. Work that does not need a strong
3429
+ * model names a tier. A tier only: an exact model pin is not offered here.
3430
+ */
3431
+ readonly tier?: KayAppModelTierId | undefined;
3412
3432
  /**
3413
3433
  * The session asking for this one, so the daemon can record which session opened it.
3414
3434
  * Pass the calling tool's own `ctx.sessionId` and nothing else: the daemon vets the id
@@ -3447,7 +3467,7 @@ export declare interface KayAppSessions {
3447
3467
  readonly kind: "unavailable";
3448
3468
  }>;
3449
3469
  /**
3450
- * Run one hidden headless system session through Kay's harness and resolve
3470
+ * Run one hidden headless system session through Bonsai's harness and resolve
3451
3471
  * with its final output — the sole sanctioned way for a `kay.app` plugin to
3452
3472
  * spend model tokens outside a session-event handler. Checked per call against
3453
3473
  * the `sessions.run` claim. A plugin may request a model/tier and supply
@@ -3508,6 +3528,10 @@ export declare interface KayAppSignal {
3508
3528
  readonly pluginId: string;
3509
3529
  };
3510
3530
  readonly source: KayAppSignalSource;
3531
+ /** What the signal is about, when its recorder named a subject. */
3532
+ readonly subject?: KayAppSignalSubject;
3533
+ /** The id of the upstream signal this one was chained after, while that row exists. */
3534
+ readonly upstreamId?: number;
3511
3535
  readonly recordedAtMs: number;
3512
3536
  /** Keyed by question name, full probability distributions included. */
3513
3537
  readonly answers: Readonly<Record<string, KayAppSignalAnswer>>;
@@ -3567,12 +3591,20 @@ export declare interface KayAppSignalNoulAnswer {
3567
3591
  *
3568
3592
  * A repeat call over the same (plugin, detector, version, session, entry, input digest) returns
3569
3593
  * the ALREADY-STORED row with `deduplicated: true` and never calls Jev again: replay is free.
3594
+ * A call with `reuse` that finds a recent row for the same subject key returns that row with
3595
+ * `deduplicated: true` and `reused: true`; its `source` is where the row was computed.
3570
3596
  */
3571
3597
  export declare interface KayAppSignalObservation {
3572
3598
  readonly id?: number | undefined;
3573
3599
  readonly status: "classified" | "unavailable" | "invalid";
3574
3600
  readonly detector: KayAppSignalsDetectorRef;
3575
3601
  readonly source: KayAppSignalSource;
3602
+ /** The row's subject, when it was recorded with one. */
3603
+ readonly subject?: KayAppSignalSubject | undefined;
3604
+ /** The row's upstream link: the id of the row it was chained after. */
3605
+ readonly upstreamId?: number | undefined;
3606
+ /** True when the answer is a stored row found through `reuse`, not this call's own. */
3607
+ readonly reused?: boolean | undefined;
3576
3608
  readonly answers?: Record<string, unknown> | undefined;
3577
3609
  readonly model?: string | undefined;
3578
3610
  readonly usage?: {
@@ -3605,6 +3637,18 @@ export declare interface KayAppSignalPage {
3605
3637
  readonly nextCursor?: string;
3606
3638
  }
3607
3639
 
3640
+ /**
3641
+ * Reuse a stored answer for the same subject instead of asking Jev again. Before any Jev call
3642
+ * the host looks for the newest row this plugin recorded with the same detector, version,
3643
+ * subject key and input digest, recorded at most `maxAgeMs` ago, in ANY session. When one
3644
+ * exists, that row is the answer: no Jev call and no new row. The returned observation keeps the
3645
+ * row's own source (where it was computed), with `reused: true`.
3646
+ */
3647
+ declare interface KayAppSignalReuse {
3648
+ /** How old a stored answer may be, in ms: a whole number from 1 to {@link SIGNAL_TIME_MAX_MS}. */
3649
+ readonly maxAgeMs: number;
3650
+ }
3651
+
3608
3652
  /**
3609
3653
  * One question of a stored rubric, as the recording plugin wrote it. Rubrics recorded before
3610
3654
  * SDK 0.12.0 use TypeSafe's vocabulary (`noul` for yes/no, and instructions or criteria that
@@ -3733,6 +3777,12 @@ export declare interface KayAppSignalsDetectorRef extends KayAppSignalsDetectorI
3733
3777
  export declare interface KayAppSignalsObserveInput {
3734
3778
  readonly detector: KayAppSignalsDetectorInput;
3735
3779
  readonly source: KayAppSignalSource;
3780
+ /** What the signal is about. Stored on the row; not part of the dedupe key or the input digest. */
3781
+ readonly subject?: KayAppSignalSubject;
3782
+ /** The upstream row this observation is chained after. Stored on the row as its upstream link. */
3783
+ readonly after?: KayAppSignalUpstreamLink;
3784
+ /** Reuse a recent stored answer for the same subject key. Needs `subject.key`. */
3785
+ readonly reuse?: KayAppSignalReuse;
3736
3786
  /**
3737
3787
  * The exact state to send, already shaped by the caller (a turn packet, a window of messages,
3738
3788
  * or anything else). NOT stored: the row keeps its digest, and a reader re-derives it from the
@@ -3830,6 +3880,34 @@ export declare interface KayAppSignalsSessionQuery {
3830
3880
  readonly limit?: number;
3831
3881
  }
3832
3882
 
3883
+ /**
3884
+ * What a signal is about, named by the recording plugin. The host stores both values and never
3885
+ * interprets them. A signal recorded without a subject has none; every reader treats it as before.
3886
+ */
3887
+ declare interface KayAppSignalSubject {
3888
+ /**
3889
+ * The kind of thing observed, e.g. `turn`: a lowercase slug of at most 64 characters, in the
3890
+ * same grammar as a detector id.
3891
+ */
3892
+ readonly kind: string;
3893
+ /**
3894
+ * The subject's identity ACROSS sessions, when it has one (two sessions can observe the same
3895
+ * subject). Required for {@link KayAppSignalsObserveInput.reuse}. 1 to 256 characters with no
3896
+ * whitespace, `/`, `?`, `#`, or control or invisible character.
3897
+ */
3898
+ readonly key?: string;
3899
+ }
3900
+
3901
+ /**
3902
+ * The upstream signal a chained observation ran after: the stored row whose answers the caller
3903
+ * found passing. The host checks that the row exists and was recorded by the same plugin, and
3904
+ * stores the link on the new row; it never re-judges the caller's pass condition.
3905
+ */
3906
+ declare interface KayAppSignalUpstreamLink {
3907
+ /** The upstream row's `id`: a positive whole number. */
3908
+ readonly observationId: number;
3909
+ }
3910
+
3833
3911
  /** One managed skill, as the skill catalog admits it. */
3834
3912
  export declare interface KayAppSkill {
3835
3913
  /** Canonical id, `<canonical source id>/<name>`. Equal to a skill invocation's `resourceId`. */
@@ -3846,7 +3924,7 @@ export declare interface KayAppSkill {
3846
3924
  export declare interface KayAppSkillDetail extends KayAppSkill {
3847
3925
  readonly versioning: KayAppSkillVersioning;
3848
3926
  /**
3849
- * The version a session loading the skill now receives, as `git-tree:<oid>`. Absent when Kay
3927
+ * The version a session loading the skill now receives, as `git-tree:<oid>`. Absent when Bonsai
3850
3928
  * keeps no history of the skill (`unversioned`), cannot read it, or the skill's files hold
3851
3929
  * bytes no revision has recorded (`uncommitted`).
3852
3930
  */
@@ -3886,7 +3964,7 @@ export declare interface KayAppSkillNotFound {
3886
3964
  readonly message: string;
3887
3965
  }
3888
3966
 
3889
- /** Who made a revision, as Kay recorded it when the revision was made. Absent fields are unknown. */
3967
+ /** Who made a revision, as Bonsai recorded it when the revision was made. Absent fields are unknown. */
3890
3968
  export declare interface KayAppSkillProvenance {
3891
3969
  /** The session whose work the revision records. */
3892
3970
  readonly sessionId?: string;
@@ -4002,9 +4080,9 @@ export declare interface KayAppSkillsUnavailable {
4002
4080
  }
4003
4081
 
4004
4082
  /**
4005
- * Whether Kay keeps a history for the skill, and how its local copy relates to its source.
4006
- * `unversioned`: the skill's files are the user's own, and Kay keeps no history of them.
4007
- * `unavailable`: Kay does keep one and cannot read it right now.
4083
+ * Whether Bonsai keeps a history for the skill, and how its local copy relates to its source.
4084
+ * `unversioned`: the skill's files are the user's own, and Bonsai keeps no history of them.
4085
+ * `unavailable`: Bonsai does keep one and cannot read it right now.
4008
4086
  */
4009
4087
  export declare type KayAppSkillVersioning = "pristine" | "customized" | "update-available" | "diverged" | "unversioned" | "unavailable";
4010
4088
 
@@ -4020,7 +4098,7 @@ export declare interface KayAppStorage {
4020
4098
  readonly dataDir?: KayAppDataDirStorage;
4021
4099
  }
4022
4100
 
4023
- /** Kay's reasoning-effort ladder, in ascending order. */
4101
+ /** Bonsai's reasoning-effort ladder, in ascending order. */
4024
4102
  export declare type KayAppThinkingLevel = "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
4025
4103
 
4026
4104
  /**
@@ -4138,7 +4216,7 @@ export declare interface KayAppToolEvents {
4138
4216
 
4139
4217
  /**
4140
4218
  * `app.permissions` — the plugin-facing seam through which a `kay.app` target advertises the
4141
- * permission rows for tools it gates DYNAMICALLY, so they show in Kay's permission ledger with
4219
+ * permission rows for tools it gates DYNAMICALLY, so they show in Bonsai's permission ledger with
4142
4220
  * the same allow / ask / never control every statically declared tool row has.
4143
4221
  *
4144
4222
  * A tool a plugin registers at activation (`registerTool`) is already a row: the host derives it
@@ -4203,7 +4281,7 @@ export declare interface KayAppTurnSettledSessionEvent extends KayAppSessionEven
4203
4281
  */
4204
4282
  readonly runId?: string;
4205
4283
  /**
4206
- * The SCRIPTED experience that minted this session, if one did — Kay's first-run
4284
+ * The SCRIPTED experience that minted this session, if one did — Bonsai's first-run
4207
4285
  * conversation, the overnight handoff. Absent for an ordinary session, and absent whenever
4208
4286
  * the session was created by anything other than a person, so its presence means exactly
4209
4287
  * "a person's session, running a scripted arc".
@@ -4414,8 +4492,8 @@ export declare interface KayAppWhiteboardTypes {
4414
4492
  *
4415
4493
  * ## Your body can run more than once, and that is the point
4416
4494
  *
4417
- * A workflow body is durable: if Kay is killed mid-run (a crash, a quit, a machine that went to
4418
- * sleep), the run is picked up again when Kay comes back. It is picked up by RE-EXECUTING your
4495
+ * A workflow body is durable: if Bonsai is killed mid-run (a crash, a quit, a machine that went to
4496
+ * sleep), the run is picked up again when Bonsai comes back. It is picked up by RE-EXECUTING your
4419
4497
  * callback from the top — not by resuming it where it stopped, which JavaScript cannot do.
4420
4498
  *
4421
4499
  * What makes that safe is that the work you did inside `runStep` and `runAgent` is not done
@@ -4454,11 +4532,11 @@ export declare interface KayAppWorkflowContext {
4454
4532
  /**
4455
4533
  * Record a step's result for replay.
4456
4534
  *
4457
- * Once the result commits, recovery returns it without running the callback again. If Kay
4535
+ * Once the result commits, recovery returns it without running the callback again. If Bonsai
4458
4536
  * stops before that commit, the callback can run again. Use idempotency keys for external
4459
4537
  * effects whose duplicates would matter; recording a step cannot transact with an email send.
4460
4538
  *
4461
- * What you return must be plain data Kay can store (JSON): objects, arrays, strings, numbers,
4539
+ * What you return must be plain data Bonsai can store (JSON): objects, arrays, strings, numbers,
4462
4540
  * booleans, null. Not a class instance, a stream, a function or a handle.
4463
4541
  *
4464
4542
  * `name` labels the step wherever runs are inspected. Give it one; a body whose steps are all
@@ -4470,7 +4548,7 @@ export declare interface KayAppWorkflowContext {
4470
4548
  /**
4471
4549
  * Wait, durably.
4472
4550
  *
4473
- * Unlike `setTimeout`, this survives Kay being restarted: a body that sleeps for an hour and is
4551
+ * Unlike `setTimeout`, this survives Bonsai being restarted: a body that sleeps for an hour and is
4474
4552
  * killed after ten minutes wakes at the original deadline rather than starting the hour again,
4475
4553
  * and it does not hold a process open while it waits.
4476
4554
  */
@@ -4483,14 +4561,14 @@ export declare interface KayAppWorkflowContext {
4483
4561
  * callback settles and every child you admitted has drained. Admission closes the moment your
4484
4562
  * callback settles, so a call made after that is refused rather than orphaned.
4485
4563
  *
4486
- * With an input `key`, Kay records the session before its first turn. Recovery sends a
4564
+ * With an input `key`, Bonsai records the session before its first turn. Recovery sends a
4487
4565
  * continuation to that same persisted session; a new session is created only if its transcript
4488
4566
  * is gone. Settled memo results return directly. A crash after a turn settles but before its
4489
4567
  * memo commits can cause one extra continuation turn in the same session.
4490
4568
  *
4491
4569
  * A keyed child whose turn fails for a transient reason (`network`, `stream_interrupted`,
4492
4570
  * `overloaded`, `rate_limit`, `server_error`, or `timeout` when you declared no `timeoutMs`) is
4493
- * continued the same way: Kay waits, waits for the network when it can probe it, and sends a
4571
+ * continued the same way: Bonsai waits, waits for the network when it can probe it, and sends a
4494
4572
  * continuation to the same session, up to six times and for at most 20 hours after the first
4495
4573
  * failure. A continuation the host refuses counts as one attempt and keeps the failure. Only
4496
4574
  * the final outcome returns and is memoized. Unkeyed children and every other failure return at
@@ -5907,6 +5985,14 @@ export declare interface ToolDefinition<TParams extends ToolParametersWire = Too
5907
5985
  * explicit Stop.
5908
5986
  */
5909
5987
  durationClass?: "fast" | "long";
5988
+ /**
5989
+ * Set only for a tool whose rerun with the same arguments is harmless, such
5990
+ * as one keyed on its own call: after a crash cuts a call off, a pi-durable
5991
+ * session may rerun it with its recorded arguments (without `before_tool`)
5992
+ * instead of ending it as an interrupted error. Absent: never rerun. Ignored
5993
+ * on pi 0.99.1.
5994
+ */
5995
+ replaySafe?: true;
5910
5996
  /**
5911
5997
  * Optional capability⇄scheme binding. When present this tool is auth-gated: discoverable when
5912
5998
  * unauthed, callable once the binding is satisfied. The SDK's {@link withResolvedAuth}
@@ -5990,9 +6076,9 @@ export declare type ToolParametersWire = unknown;
5990
6076
  *
5991
6077
  * The host is trusted to supply honest values; a declared `kind` of `read` moves a call below
5992
6078
  * the protected-path hard-deny (which only fires for non-read kinds), so a tool that could
5993
- * touch protected config must NOT declare `read`. Kay's embedded-experience tools never touch
6079
+ * touch protected config must NOT declare `read`. Bonsai's embedded-experience tools never touch
5994
6080
  * `configDir`, so this is safe for them. `read` is also what every capability surface reports as
5995
- * "read-only" (Kay's Permissions page groups and defaults on it), so it is a claim about what the
6081
+ * "read-only" (Bonsai's Permissions page groups and defaults on it), so it is a claim about what the
5996
6082
  * tool DOES — never a way to buy silence. A tool that should raise no ask on its own account
5997
6083
  * declares {@link ToolPermissionHint.quiet} and keeps its honest `kind`.
5998
6084
  */
@@ -6033,7 +6119,7 @@ export declare interface ToolPermissionHint {
6033
6119
  * because the same tool can read on one input and execute on another, which a static `kind`
6034
6120
  * cannot express.
6035
6121
  *
6036
- * Exemplar — Kay's `mcp` proxy tool, one tool spanning every server: `search`/`describe` derive
6122
+ * Exemplar — Bonsai's `mcp` proxy tool, one tool spanning every server: `search`/`describe` derive
6037
6123
  * `{ kind: "read" }` (metadata lookups), while `call` derives
6038
6124
  * `{ kind: "execute", ruleKey: "mcp:<server>::<tool>", scheme: "<server>" }`, so a
6039
6125
  * `{ scheme: "<server>" }` rule gates a whole server and a `{ ruleKey: "mcp:<server>::<tool>" }`
@@ -6074,7 +6160,7 @@ export declare interface ToolPermissionHint {
6074
6160
  * really had — not that the result is always stricter than the target's. How much gate is left
6075
6161
  * on such a call is exactly how much the CARRIER carries: an `execute` carrier is stricter than
6076
6162
  * a `read` target and equal to a `mutate`/`destructive` one outside allow mode, while a
6077
- * {@link quiet} carrier (Kay's own `call_tool`) contributes no mode default at all, so the
6163
+ * {@link quiet} carrier (Bonsai's own `call_tool`) contributes no mode default at all, so the
6078
6164
  * fallback leaves nothing but the carrier's rules and the protected-path deny — and the carrier
6079
6165
  * names no path, so that deny has nothing to fire on. This is why a carrier must refuse a target
6080
6166
  * that is itself a carrier: no chain long or circular enough to reach the fallback can be built,
@@ -6098,7 +6184,7 @@ export declare interface ToolPermissionHint {
6098
6184
  * whose only effect is invoking the target the gate is already classifying beside it: the
6099
6185
  * target's kind, rules, resources and the protected-path deny all still decide, so a proxied
6100
6186
  * call is gated exactly like the direct one — no more, and no ask the direct call would never
6101
- * have raised. Kay's `call_tool` declares `{ kind: "execute", quiet: true }` (owner ruling,
6187
+ * have raised. Bonsai's `call_tool` declares `{ kind: "execute", quiet: true }` (owner ruling,
6102
6188
  * 2026-08-18): honest about everything it can reach, silent on its own account.
6103
6189
  *
6104
6190
  * Quiet is not ungated, but it IS nearly all the gate a lone carrier has. On a call that
@@ -6452,8 +6538,9 @@ export declare interface UriModule {
6452
6538
  readonly description?: string;
6453
6539
  readonly agentHint?: UriAgentHint;
6454
6540
  /**
6455
- * Route-aware permission facts for operations whose effect is stricter than
6456
- * the generic URI verb implies. Scheme and resource scoping remain
6541
+ * Route-aware permission facts for write/edit/delete routes whose effect is
6542
+ * stricter than the generic URI verb implies (read verbs stay `read`; see
6543
+ * {@link UriOperationPermissionPolicy}). Scheme and resource scoping remain
6457
6544
  * kernel-derived from the canonical URI.
6458
6545
  */
6459
6546
  readonly permission?: UriOperationPermissionPolicy;
@@ -6496,8 +6583,6 @@ export declare interface UriModule {
6496
6583
  readonly permissionDefaults?: UriPermissionDefaults;
6497
6584
  /** Requires a resolved URI connection before any verb handler runs. */
6498
6585
  readonly requiresConnection?: boolean;
6499
- /** Host-only marker: dispatch mutations as native file operations after locate finalization. */
6500
- readonly hostNativeFileMutations?: true;
6501
6586
  /**
6502
6587
  * This module refuses a whole-content overwrite of an address the dispatching
6503
6588
  * session has never read or written, when content is already stored there
@@ -6509,7 +6594,7 @@ export declare interface UriModule {
6509
6594
  * A module without the flag never receives the marked dispatch and behaves
6510
6595
  * exactly as before. Enforcement depth past this floor — refusing a write to
6511
6596
  * content that CHANGED since the read — stays the module's own call:
6512
- * `builtin:local-file` and host-native projections enforce both halves; the
6597
+ * `builtin:local-file` enforces both halves; the
6513
6598
  * artifact factory enforces the floor and leaves change detection to its
6514
6599
  * `edit` anchor. A module declaring this flag obligates itself to one more
6515
6600
  * thing: every revision its mutations report must be a value its own reads
@@ -6565,8 +6650,13 @@ export declare interface UriModule {
6565
6650
  * conversion stage, or an already-rendered `string` for synthesizing/text modules
6566
6651
  * (finalize passes those through its identity path). The single transport shape;
6567
6652
  * {@link finalize} (stage 2) turns it into model-facing content.
6653
+ *
6654
+ * Observes only, like `help`, `list` and `search` (the protocol contract in `@herd/uri`):
6655
+ * repeating the call must be harmless, because the kernel reruns one a crash cut off without
6656
+ * asking again.
6568
6657
  */
6569
6658
  read(input: string, ctx: UriResolveContext): Promise<RawResource>;
6659
+ /** Observes only; see {@link read}. */
6570
6660
  help?(input: string, ctx: UriResolveContext): Promise<UriHelp>;
6571
6661
  write?(input: string, content: UriPayload, ctx: UriResolveContext): Promise<UriMutationResult | void>;
6572
6662
  /** Structured write with host-resolved resources delivered beside the model-authored content. */
@@ -6583,7 +6673,9 @@ export declare interface UriModule {
6583
6673
  */
6584
6674
  writeBytes?(input: string, bytes: Uint8Array, source: UriSourceDescriptor, ctx: UriResolveContext): Promise<UriMutationResult | void>;
6585
6675
  edit?(input: string, patch: UriPayload, ctx: UriResolveContext): Promise<UriMutationResult>;
6676
+ /** Observes only; see {@link read}. */
6586
6677
  list?(input: string, params: UriListParams, ctx: UriResolveContext): Promise<UriListResult>;
6678
+ /** Observes only; see {@link read}. */
6587
6679
  search?(input: string, params: UriSearchParams, ctx: UriResolveContext): Promise<UriSearchResult>;
6588
6680
  delete?(input: string, ctx: UriResolveContext): Promise<UriMutationResult>;
6589
6681
  toMarkdown?(input: UriMarkdownRenderInput, ctx: UriResolveContext): string | undefined;
@@ -6681,7 +6773,9 @@ declare interface UriOperationPermissionClassification {
6681
6773
  /**
6682
6774
  * The operation's real effect. The permission classifier only accepts a
6683
6775
  * classification at least as restrictive as the URI verb's built-in
6684
- * classification.
6776
+ * classification, and `read` for `help`/`read`/`list`/`search` (those
6777
+ * verbs only observe; see {@link UriModule.read}). Anything else fails the
6778
+ * preflight closed.
6685
6779
  */
6686
6780
  readonly kind: ToolActionKind;
6687
6781
  /** Optional route-specific rule key (for example, `terminal:input`). */
@@ -6691,8 +6785,9 @@ declare interface UriOperationPermissionClassification {
6691
6785
  declare interface UriOperationPermissionPolicy {
6692
6786
  /**
6693
6787
  * Classify one canonical route without I/O or caller/session state. Throwing,
6694
- * returning an invalid value, or weakening the verb's built-in classification
6695
- * fails the permission preflight closed.
6788
+ * returning an invalid value, weakening the verb's built-in classification, or
6789
+ * moving a `help`/`read`/`list`/`search` route off `read` fails the permission
6790
+ * preflight closed.
6696
6791
  */
6697
6792
  classifyOperation(request: {
6698
6793
  readonly operation: UriOperation;
@@ -6897,7 +6992,7 @@ declare interface UriResolveContext_2 {
6897
6992
  * {@link UriResolveContext.sessionId} and just as un-influenceable by the caller — so a module
6898
6993
  * writing to a store it owns can record the actor without the agent being able to choose one.
6899
6994
  *
6900
- * Free text minted by the host's own runtime (Kay's form is `user`, `subagent`,
6995
+ * Free text minted by the host's own runtime (Bonsai's form is `user`, `subagent`,
6901
6996
  * `system/<surface>`, `followup/<surface>`) rather than a closed union: the surface half is the
6902
6997
  * host's vocabulary, and a second enumeration of it here would drift from the first.
6903
6998
  *