@yaklabs-ai/plugin-sdk 0.9.0 → 0.9.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/README.md CHANGED
@@ -13,7 +13,7 @@ it under the name your plugin code actually imports:
13
13
  ```json
14
14
  {
15
15
  "dependencies": {
16
- "@kay/plugin-sdk": "npm:@yaklabs-ai/plugin-sdk@^0.9.0"
16
+ "@kay/plugin-sdk": "npm:@yaklabs-ai/plugin-sdk@^0.9.1"
17
17
  }
18
18
  }
19
19
  ```
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "package": "@yaklabs-ai/plugin-sdk",
4
- "version": "0.9.0",
4
+ "version": "0.9.1",
5
5
  "target": "npm",
6
6
  "firstPartyLicense": "MIT",
7
7
  "bundled": [
package/dist/kay-app.d.ts CHANGED
@@ -299,6 +299,93 @@ declare type ConstrainedSamplingConfig = {
299
299
  variants: GrammarVariants;
300
300
  };
301
301
 
302
+ export declare interface CorpusResourceInvocation {
303
+ readonly eventId: string;
304
+ /** Envelope recording time, never a run/message/incident identifier. */
305
+ readonly at: string;
306
+ readonly kind: CorpusResourceKind;
307
+ readonly sessionId: string;
308
+ /** Falls back to sessionId for legacy events without a recorded root. */
309
+ readonly rootSessionId: string;
310
+ readonly name: string;
311
+ readonly sourceId?: string;
312
+ /** Absent on unresolved legacy rows; names/aliases are not a substitute. */
313
+ readonly resourceId?: string;
314
+ readonly version?: string;
315
+ readonly variantId?: string;
316
+ readonly rootProvenance: SessionProvenanceRecord;
317
+ /** Current index hints, not the session's historical context at invocation. */
318
+ readonly currentContext: {
319
+ readonly cwd: string;
320
+ readonly projectId?: string;
321
+ };
322
+ }
323
+
324
+ /** Exclusive keyset position; preserve timestamp precision when returning it. */
325
+ export declare const CorpusResourceInvocationCursor: z.ZodObject<{
326
+ at: z.ZodISODateTime;
327
+ eventId: z.ZodString;
328
+ }, z.core.$strict>;
329
+
330
+ export declare type CorpusResourceInvocationCursor = z.infer<typeof CorpusResourceInvocationCursor>;
331
+
332
+ export declare interface CorpusResourceInvocationExclusion {
333
+ readonly eventId: string;
334
+ readonly sessionId: string;
335
+ readonly rootSessionId: string;
336
+ readonly reason: "session-missing" | "root-missing" | "root-provenance-unverified" | "root-creator-filtered";
337
+ }
338
+
339
+ export declare type CorpusResourceInvocationPage = {
340
+ readonly state: "available";
341
+ readonly items: readonly CorpusResourceInvocation[];
342
+ /** Absent only when this recording-time window is exhausted. */
343
+ readonly next?: CorpusResourceInvocationCursor;
344
+ /** Telemetry import succeeded; exclusions still describe missing or filtered index facts. */
345
+ readonly coverage: {
346
+ readonly scanned: number;
347
+ readonly exclusions: readonly CorpusResourceInvocationExclusion[];
348
+ };
349
+ } | {
350
+ readonly state: "unavailable";
351
+ readonly reason: "not-wired" | "telemetry-unavailable" | "telemetry-incomplete" | "index-unavailable" | "invalid-record";
352
+ readonly message: string;
353
+ };
354
+
355
+ /** Half-open recording-time window. Limits bound scanned rows, including exclusions. */
356
+ export declare const CorpusResourceInvocationQuery: z.ZodObject<{
357
+ kind: z.ZodEnum<{
358
+ skill: "skill";
359
+ "context-file": "context-file";
360
+ "prompt-command": "prompt-command";
361
+ }>;
362
+ since: z.ZodISODateTime;
363
+ until: z.ZodISODateTime;
364
+ after: z.ZodOptional<z.ZodObject<{
365
+ at: z.ZodISODateTime;
366
+ eventId: z.ZodString;
367
+ }, z.core.$strict>>;
368
+ limit: z.ZodOptional<z.ZodNumber>;
369
+ rootCreatedByKind: z.ZodOptional<z.ZodEnum<{
370
+ human: "human";
371
+ agent: "agent";
372
+ plugin: "plugin";
373
+ trigger: "trigger";
374
+ daemon: "daemon";
375
+ }>>;
376
+ }, z.core.$strict>;
377
+
378
+ export declare type CorpusResourceInvocationQuery = z.infer<typeof CorpusResourceInvocationQuery>;
379
+
380
+ /** Roster invocation facts, not evidence that a read completed successfully. */
381
+ export declare const CorpusResourceKind: z.ZodEnum<{
382
+ skill: "skill";
383
+ "context-file": "context-file";
384
+ "prompt-command": "prompt-command";
385
+ }>;
386
+
387
+ export declare type CorpusResourceKind = z.infer<typeof CorpusResourceKind>;
388
+
302
389
  /**
303
390
  * The `signals` a host with no Jev lane or no signals store binds: `observe` never touches the
304
391
  * network, answers `invalid` for an input that breaks the recorded-name grammar exactly as a
@@ -1495,6 +1582,8 @@ export declare type KayAppAutomationScriptRef = {
1495
1582
 
1496
1583
  /** A receipt-attributed skill candidate, with live status only for that exact revision. */
1497
1584
  export declare type KayAppAutomationSuggestionItem = {
1585
+ /** Only literal 1 proves physical addressing; other historical values remain uninterpreted. */
1586
+ readonly locatorVersion?: unknown;
1498
1587
  readonly sourceId: string;
1499
1588
  readonly skillName: string;
1500
1589
  readonly suggestionId: string;
@@ -1682,17 +1771,31 @@ export declare interface KayAppContextContributor {
1682
1771
  * Raw read access to every stored session's transcript. Always present on
1683
1772
  * {@link KayAppPluginApi}; each read is checked against the `corpus.read` claim, and refused
1684
1773
  * unless the user has granted it. Data is raw and un-redacted — the plugin filters to what it
1685
- * needs. Both reads are async iterables so a corpus pass never loads the whole corpus into memory
1686
- * at once (the bound is one session at a time).
1774
+ * needs. Invocation queries are bounded pages. Transcript reads materialize a whole session
1775
+ * before yielding; the iterable does not promise per-entry streaming or an allocation bound.
1687
1776
  */
1688
1777
  export declare interface KayAppCorpus {
1778
+ /** Page invocation leads under the live grant; inspect exclusions even on available empty pages. */
1779
+ listResourceInvocations(query: CorpusResourceInvocationQuery): Promise<CorpusResourceInvocationPage>;
1689
1780
  /** Enumerate every stored session, newest-first. */
1690
1781
  listSessions(): AsyncIterable<KayAppCorpusSession>;
1691
1782
  /**
1692
- * Stream one session's full entry log oldest→newest; an unknown id yields nothing. Treat the
1783
+ * Yield one session's full entry log oldest→newest; an unknown id yields nothing. Treat the
1693
1784
  * entries as read-only: for a session the daemon holds in memory they are its live objects.
1694
1785
  */
1695
1786
  readEntries(sessionId: string): AsyncIterable<SessionTreeEntry>;
1787
+ /**
1788
+ * Read one bounded physical JSONL page. The host resolves `sessionId` to its authoritative
1789
+ * indexed path and validates the opaque cursor before opening it. When `throughEntryId` is
1790
+ * supplied, the cursor stops at that entry's transaction line; a V4 line may carry later
1791
+ * entries, which are returned for the caller to filter and are replayed on the next page.
1792
+ */
1793
+ readEntryBatch?(sessionId: string, options?: {
1794
+ readonly cursor?: JsonValue_4;
1795
+ readonly throughEntryId?: string;
1796
+ /** Host-only cancellation for the bounded physical read. */
1797
+ readonly signal?: AbortSignal;
1798
+ }): Promise<KayAppCorpusEntryBatch>;
1696
1799
  /**
1697
1800
  * Read a cheap transcript change marker without loading the entry log. Unknown or deleted
1698
1801
  * sessions yield `undefined`.
@@ -1700,6 +1803,20 @@ export declare interface KayAppCorpus {
1700
1803
  readSessionSourceMark(sessionId: string): Promise<KayAppCorpusSourceMark | undefined>;
1701
1804
  }
1702
1805
 
1806
+ /** One bounded physical page from the host's incremental JSONL reader. */
1807
+ export declare interface KayAppCorpusEntryBatch {
1808
+ readonly entries: readonly SessionTreeEntry[];
1809
+ /** Opaque JSON cursor after the physical page; only the host may interpret it or open its path. */
1810
+ readonly cursor: JsonValue_4;
1811
+ /** Opaque cursor at the physical page start, for a partial logical chunk. */
1812
+ readonly pageStartCursor?: JsonValue_4;
1813
+ readonly mode: "replace" | "append";
1814
+ readonly status: "complete" | "more" | "awaiting-append" | "record-too-large";
1815
+ /** Present when a caller supplied `throughEntryId`. */
1816
+ readonly anchorFound?: boolean;
1817
+ readonly malformedRecords: number;
1818
+ }
1819
+
1703
1820
  /** One stored session, as the granted corpus enumerates them. Keyed by its stable `sessionId`. */
1704
1821
  export declare interface KayAppCorpusSession {
1705
1822
  readonly sessionId: string;
@@ -1962,6 +2079,13 @@ export declare interface KayAppEndpoints {
1962
2079
  register(name: string, handler: (payload: unknown) => unknown | Promise<unknown>): void;
1963
2080
  }
1964
2081
 
2082
+ /** A real human carrier projected into the source session's transcript. */
2083
+ export declare interface KayAppHumanMessageSessionEvent extends KayAppSessionEventBase {
2084
+ readonly type: "human-message";
2085
+ /** Exact prior persisted boundary captured by the host at projection time; `null` means empty history. */
2086
+ readonly throughEntryId: string | null;
2087
+ }
2088
+
1965
2089
  /**
1966
2090
  * A provider's nominated image model, resolved now: what a session on one of that
1967
2091
  * provider's text-only models spawns to read images. `resolved` absent = nothing
@@ -2584,17 +2708,16 @@ export declare type KayAppSessionCreator = SessionCreator;
2584
2708
 
2585
2709
  export declare type KayAppSessionDefiner = SessionDefiner;
2586
2710
 
2587
- export declare type KayAppSessionEvent = KayAppTurnSettledSessionEvent | KayAppPhaseShiftSessionEvent;
2711
+ export declare type KayAppSessionEvent = KayAppHumanMessageSessionEvent | KayAppTurnSettledSessionEvent | KayAppPhaseShiftSessionEvent;
2588
2712
 
2589
2713
  declare interface KayAppSessionEventBase {
2590
2714
  readonly sessionId: string;
2591
2715
  /**
2592
- * The event's own anchor entry: the settled turn's own last entry, or the phase-shift
2593
- * observation's `observationEntryId`. A handler bounds its OWN corpus read using this id (via
2594
- * whatever packet-building helpers the plugin already owns); the door hands out no
2595
- * `readEntries()` closure, and re-validating what was read against the CURRENT branch — a
2596
- * rewind can race between publish and read — is the handler's own job, exactly as
2597
- * `resolveClosedPhase` already does today for the phase extractor.
2716
+ * The event's own anchor entry: the projected human carrier, the settled turn's own last
2717
+ * entry, or the phase-shift observation's `observationEntryId`. A handler bounds its OWN logical
2718
+ * corpus interval using this id (via whatever packet-building helpers the plugin already owns);
2719
+ * the door hands out no `readEntries()` closure, and re-validating what was read against the
2720
+ * CURRENT branch — a rewind can race between publish and read — is the handler's own job.
2598
2721
  */
2599
2722
  readonly entryId: string;
2600
2723
  /** ISO-8601 publish time. */
@@ -2631,6 +2754,8 @@ export declare type KayAppSessionEventCause = {
2631
2754
  * substitute a run id resolved another way.
2632
2755
  */
2633
2756
  readonly runId?: string;
2757
+ /** Exact prior persisted boundary for a projected human-message event; null means empty history. */
2758
+ readonly throughEntryId?: string | null;
2634
2759
  };
2635
2760
  /**
2636
2761
  * Exact-match dedupe key. The host REFUSES a second run carrying the same key outright (a
@@ -2693,12 +2818,12 @@ export declare interface KayAppSessionEventsSubscribeOptions {
2693
2818
  }
2694
2819
 
2695
2820
  /**
2696
- * A closed, extensible union: today's two root events a lane could fire on
2697
- * (`turn-settled`) and react to (`phase-shift`), collapsed onto one subscribable set now that
2698
- * there is no dispatcher chaining one lane's completion into another's `when`. Adding a third
2699
- * type is additive, never breaking.
2821
+ * A closed, extensible union: a projected human message, a settled turn, or an accepted
2822
+ * phase-shift observation. They share one subscribable set now that there is no dispatcher
2823
+ * chaining one job's completion into another's `when`. Adding a fourth type is additive, never
2824
+ * breaking.
2700
2825
  */
2701
- export declare type KayAppSessionEventType = "turn-settled" | "phase-shift";
2826
+ export declare type KayAppSessionEventType = "human-message" | "turn-settled" | "phase-shift";
2702
2827
 
2703
2828
  export declare type KayAppSessionIntent = SessionIntent;
2704
2829
 
@@ -4501,9 +4626,11 @@ declare const SessionCausedByEvent: z.ZodObject<{
4501
4626
  type: z.ZodEnum<{
4502
4627
  "turn-settled": "turn-settled";
4503
4628
  "phase-shift": "phase-shift";
4629
+ "human-message": "human-message";
4504
4630
  }>;
4505
4631
  entryId: z.ZodString;
4506
4632
  runId: z.ZodOptional<z.ZodString>;
4633
+ throughEntryId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
4507
4634
  }, z.core.$strict>>;
4508
4635
  dedupeKey: z.ZodOptional<z.ZodString>;
4509
4636
  }, z.core.$strict>;
@@ -4697,9 +4824,11 @@ declare const SessionProvenanceRecord: z.ZodObject<{
4697
4824
  type: z.ZodEnum<{
4698
4825
  "turn-settled": "turn-settled";
4699
4826
  "phase-shift": "phase-shift";
4827
+ "human-message": "human-message";
4700
4828
  }>;
4701
4829
  entryId: z.ZodString;
4702
4830
  runId: z.ZodOptional<z.ZodString>;
4831
+ throughEntryId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
4703
4832
  }, z.core.$strict>>;
4704
4833
  dedupeKey: z.ZodOptional<z.ZodString>;
4705
4834
  }, z.core.$strict>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yaklabs-ai/plugin-sdk",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "description": "The Kay plugin SDK — types and helpers for authoring a Kay directory plugin.",
5
5
  "author": "YakLabs",
6
6
  "type": "module",