@yaklabs-ai/plugin-sdk 0.14.1 → 0.15.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.
@@ -128,6 +128,8 @@ export declare interface AgentToolResult<T = JsonValue_2 | undefined> {
128
128
  * error, but `details` and `structuredContent` are kept for the UI and programmatic callers.
129
129
  */
130
130
  isError?: boolean;
131
+ /** Classification for an `isError` result; the host validates it and stamps identity and attribution. */
132
+ failure?: ToolCallFailure;
131
133
  /**
132
134
  * Hint that the agent should stop after the current tool batch.
133
135
  * Early termination only happens when every finalized tool result in the batch sets this to true.
@@ -305,6 +307,12 @@ declare interface BackgroundTaskAdoptOptions {
305
307
  readonly ownerId?: string;
306
308
  readonly inspect?: BackgroundTaskInspector;
307
309
  readonly meta?: Readonly<Record<string, unknown>>;
310
+ /**
311
+ * The task's owner waits for its result: the work was meant to finish and report back (a build,
312
+ * a test run). Absent or false: nothing waits on it (a dev server, a watcher). The kernel only
313
+ * carries this fact on the task's snapshot; what waiting means is the host's to decide.
314
+ */
315
+ readonly awaitsResult?: boolean;
308
316
  /** Scoped settlement hook for the task created by this adoption only. */
309
317
  readonly onSettled?: (completion: BackgroundTaskCompletion) => void;
310
318
  }
@@ -354,6 +362,8 @@ declare interface BackgroundTaskSnapshot {
354
362
  readonly startedAtMs: number;
355
363
  readonly updatedAtMs: number;
356
364
  readonly meta?: Readonly<Record<string, unknown>>;
365
+ /** The owner waits for this task's result; see `BackgroundTaskAdoptOptions.awaitsResult`. */
366
+ readonly awaitsResult?: boolean;
357
367
  }
358
368
 
359
369
  declare type BackgroundTaskStatus = "queued" | "running" | "completed" | "failed" | "cancelled";
@@ -768,7 +778,7 @@ declare interface DecideChoiceQuestion<L extends string = string> {
768
778
  /** What a question asks: text, or a JSON object the client sends as its JSON text. */
769
779
  declare type DecideInstructions = string | object;
770
780
 
771
- declare type DecideModelId = "jev" | "clef" | "clef-flash";
781
+ declare type DecideModelId = "jev" | "clef" | "clef-flash" | "gpt-6-luna";
772
782
 
773
783
  declare type DecideQuestion = DecideBoolQuestion | DecideChoiceQuestion | DecideScoreQuestion;
774
784
 
@@ -776,10 +786,10 @@ declare type DecideQuestion = DecideBoolQuestion | DecideChoiceQuestion | Decide
776
786
  declare type DecideQuestions = Readonly<Record<string, DecideQuestion>>;
777
787
 
778
788
  declare interface DecideRequest<Q extends DecideQuestions = DecideQuestions> {
779
- /** Defaults to `jev`. */
780
- readonly model?: DecideModelId;
789
+ readonly model: DecideModelId;
781
790
  readonly state: DecideState;
782
791
  readonly questions: Q;
792
+ readonly image?: SystemOneImage;
783
793
  }
784
794
 
785
795
  declare interface DecideScoreAnswer {
@@ -1179,7 +1189,10 @@ export declare interface ExtensionAuthContext {
1179
1189
 
1180
1190
  /** Optional extension-facing APIs for background task orchestration. */
1181
1191
  declare interface ExtensionBackgroundTasksApi {
1182
- adopt(taskKind: BackgroundTaskKind, label: string, run: BackgroundTaskRun, options?: BackgroundTaskAdoptOptions): string;
1192
+ adopt(taskKind: BackgroundTaskKind, label: string, run: BackgroundTaskRun, options?: BackgroundTaskAdoptOptions & {
1193
+ readonly awaitsResult?: false;
1194
+ }): string;
1195
+ adopt(taskKind: BackgroundTaskKind, label: string, run: BackgroundTaskRun, options: BackgroundTaskAdoptOptions): string | Promise<string>;
1183
1196
  list(): readonly BackgroundTaskSnapshot[];
1184
1197
  get(taskId: string): BackgroundTaskSnapshot | undefined;
1185
1198
  }
@@ -2022,8 +2035,8 @@ export declare class KayAgentCapabilityError extends Error {
2022
2035
  */
2023
2036
  export declare interface KayAgentEvents {
2024
2037
  /**
2025
- * Publish one event the plugin declares in its `kay.app` `eventDefinitions`, with a payload that
2026
- * matches that definition's `payloadSchema`.
2038
+ * Publish one event the plugin declares in its `kay.app` `eventDefinitions`, with its resource URI and optional
2039
+ * payload matching that definition's `payloadSchema` when declared.
2027
2040
  *
2028
2041
  * The host stamps the publisher (this plugin) and the session this activation belongs to; the
2029
2042
  * plugin names neither. Fire-and-forget: it returns nothing and never throws. A publish the host
@@ -2031,7 +2044,7 @@ export declare interface KayAgentEvents {
2031
2044
  * is reported to the host's diagnostics and dropped, so the work that raised the event never
2032
2045
  * fails because the event did not go out.
2033
2046
  */
2034
- publish(localId: string, payload: unknown): void;
2047
+ publish(localId: string, input: PluginEventPublishInput): void;
2035
2048
  }
2036
2049
 
2037
2050
  /** This plugin's folder in the session family's shared Whiteboard. */
@@ -2856,16 +2869,16 @@ declare const KayPluginManifestV1: z.ZodObject<{
2856
2869
  responseSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue_3, unknown, z.core.$ZodTypeInternals<JsonValue_3, unknown>>>>;
2857
2870
  }, z.core.$strict>>>;
2858
2871
  uriModules: z.ZodOptional<z.ZodArray<z.ZodObject<{
2872
+ localId: z.ZodString;
2859
2873
  displayName: z.ZodOptional<z.ZodString>;
2860
2874
  schemes: z.ZodArray<z.ZodString>;
2861
- localId: z.ZodString;
2862
2875
  }, z.core.$strict>>>;
2863
2876
  dataSources: z.ZodOptional<z.ZodArray<z.ZodObject<{
2864
2877
  localId: z.ZodString;
2865
2878
  scope: z.ZodEnum<{
2866
2879
  session: "session";
2867
- account: "account";
2868
2880
  runtime: "runtime";
2881
+ account: "account";
2869
2882
  }>;
2870
2883
  snapshot: z.ZodObject<{
2871
2884
  version: z.ZodNumber;
@@ -2915,7 +2928,9 @@ declare const KayPluginManifestV1: z.ZodObject<{
2915
2928
  displayName: z.ZodOptional<z.ZodString>;
2916
2929
  description: z.ZodOptional<z.ZodString>;
2917
2930
  version: z.ZodDefault<z.ZodNumber>;
2918
- payloadSchema: z.ZodRecord<z.ZodString, z.ZodType<JsonValue_3, unknown, z.core.$ZodTypeInternals<JsonValue_3, unknown>>>;
2931
+ uriScheme: z.ZodString;
2932
+ relatedKeys: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
2933
+ payloadSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue_3, unknown, z.core.$ZodTypeInternals<JsonValue_3, unknown>>>>;
2919
2934
  }, z.core.$strict>>>;
2920
2935
  notificationRules: z.ZodOptional<z.ZodArray<z.ZodObject<{
2921
2936
  localId: z.ZodString;
@@ -2954,6 +2969,7 @@ declare const KayPluginManifestV1: z.ZodObject<{
2954
2969
  url: z.ZodString;
2955
2970
  auth: z.ZodOptional<z.ZodEnum<{
2956
2971
  oauth: "oauth";
2972
+ "api-key": "api-key";
2957
2973
  none: "none";
2958
2974
  }>>;
2959
2975
  authService: z.ZodOptional<z.ZodString>;
@@ -3060,6 +3076,8 @@ declare const KayPluginManifestV1: z.ZodObject<{
3060
3076
  "skills.read": "skills.read";
3061
3077
  "automations.run": "automations.run";
3062
3078
  "navigation.open-session": "navigation.open-session";
3079
+ "artifacts.read": "artifacts.read";
3080
+ "artifacts.preview": "artifacts.preview";
3063
3081
  "cost.read": "cost.read";
3064
3082
  "billing.read": "billing.read";
3065
3083
  "context.read": "context.read";
@@ -3072,6 +3090,16 @@ declare const KayPluginManifestV1: z.ZodObject<{
3072
3090
  "workspace.arrange": "workspace.arrange";
3073
3091
  }>>>;
3074
3092
  }, z.core.$strict>>;
3093
+ activityRail: z.ZodOptional<z.ZodObject<{
3094
+ section: z.ZodOptional<z.ZodEnum<{
3095
+ primary: "primary";
3096
+ plugins: "plugins";
3097
+ }>>;
3098
+ order: z.ZodOptional<z.ZodNumber>;
3099
+ icon: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
3100
+ svg: z.ZodString;
3101
+ }, z.core.$strict>]>>;
3102
+ }, z.core.$strict>>;
3075
3103
  }, z.core.$strict>>>;
3076
3104
  themes: z.ZodOptional<z.ZodArray<z.ZodObject<{
3077
3105
  localId: z.ZodString;
@@ -5174,6 +5202,42 @@ export declare interface PluginDelegatedServiceEntry {
5174
5202
  readonly scheme: PluginDelegatedScheme;
5175
5203
  }
5176
5204
 
5205
+ export declare const PluginEventEnvelope: z.ZodObject<{
5206
+ id: z.ZodString;
5207
+ localId: z.ZodString;
5208
+ type: z.ZodString;
5209
+ version: z.ZodNumber;
5210
+ uri: z.ZodString;
5211
+ related: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>>;
5212
+ key: z.ZodOptional<z.ZodString>;
5213
+ occurredAt: z.ZodISODateTime;
5214
+ publishedAt: z.ZodISODateTime;
5215
+ source: z.ZodObject<{
5216
+ poller: z.ZodOptional<z.ZodString>;
5217
+ runId: z.ZodOptional<z.ZodString>;
5218
+ layer: z.ZodLiteral<"runtime">;
5219
+ pluginId: z.ZodString;
5220
+ sessionId: z.ZodOptional<z.ZodString>;
5221
+ }, z.core.$strict>;
5222
+ payload: z.ZodOptional<z.ZodType<JsonValue_3, unknown, z.core.$ZodTypeInternals<JsonValue_3, unknown>>>;
5223
+ }, z.core.$strict>;
5224
+
5225
+ export declare type PluginEventEnvelope = z.infer<typeof PluginEventEnvelope>;
5226
+
5227
+ export declare const PluginEventPublishInput: z.ZodObject<{
5228
+ uri: z.ZodString;
5229
+ related: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>>;
5230
+ key: z.ZodOptional<z.ZodString>;
5231
+ occurredAt: z.ZodOptional<z.ZodISODateTime>;
5232
+ source: z.ZodOptional<z.ZodObject<{
5233
+ poller: z.ZodOptional<z.ZodString>;
5234
+ runId: z.ZodOptional<z.ZodString>;
5235
+ }, z.core.$strict>>;
5236
+ payload: z.ZodOptional<z.ZodType<JsonValue_3, unknown, z.core.$ZodTypeInternals<JsonValue_3, unknown>>>;
5237
+ }, z.core.$strict>;
5238
+
5239
+ export declare type PluginEventPublishInput = z.infer<typeof PluginEventPublishInput>;
5240
+
5177
5241
  /**
5178
5242
  * An external-CLI readiness scheme the plugin declares: a non-injectable marker for a
5179
5243
  * host-probed local binary (e.g. `osascript`, `gh`). Connecting runs `binary probeArgs`
@@ -6388,7 +6452,7 @@ declare interface SystemOneClient {
6388
6452
  decide<const Q extends DecideQuestions>(request: DecideRequest<Q>, options?: SystemOneCallOptions): Promise<Decision<Q>>;
6389
6453
  extract<const F extends ExtractFields>(request: ExtractRequest<F>, options?: SystemOneCallOptions): Promise<Extraction<F>>;
6390
6454
  /** Whether some provider in the current order can serve `(kind, model)`. Never rejects. */
6391
- availability(kind: SystemOneKind, model?: SystemOneModelId): Promise<Availability>;
6455
+ availability(kind: SystemOneKind, model: SystemOneModelId): Promise<Availability>;
6392
6456
  }
6393
6457
 
6394
6458
  /**
@@ -6423,6 +6487,12 @@ declare type SystemOneFailureCause = {
6423
6487
  readonly kind: "invalid-answer";
6424
6488
  };
6425
6489
 
6490
+ /** One PNG attachment. `data` is padded base64, without a data-URL prefix. */
6491
+ declare interface SystemOneImage {
6492
+ readonly mimeType: "image/png";
6493
+ readonly data: string;
6494
+ }
6495
+
6426
6496
  /**
6427
6497
  * ---
6428
6498
  * responsibility: The data shapes of the System One surface: models, the decide and extract
@@ -8614,6 +8684,14 @@ declare type TOmitDeferred<Type extends TSchema, Indexer extends TSchema> = (TDe
8614
8684
 
8615
8685
  declare type TOmitInstantiate<Context extends TProperties, State extends TState, Type extends TSchema, Indexer extends TSchema, InstantiatedType extends TSchema = TInstantiateType<Context, State, Type>, InstantiatedIndexer extends TSchema = TInstantiateType<Context, State, Indexer>> = TOmitAction<InstantiatedType, InstantiatedIndexer>;
8616
8686
 
8687
+ /**
8688
+ * The closed vocabulary of tool call failure codes. The engine and the tools
8689
+ * mint only these; a returned failure with a code outside it is not a
8690
+ * classification (the engine records the rejection on an unexplained failure),
8691
+ * and a stored record with one reads as none.
8692
+ */
8693
+ declare const TOOL_CALL_FAILURE_CODES: readonly ["tool.invalid_input", "tool.blocked", "tool.cancelled", "tool.timeout", "tool.not_found", "tool.unavailable", "tool.execution_failed", "provider.http", "provider.api", "provider.transport", "uri.not_found", "uri.unsupported_operation", "uri.not_connected", "uri.auth_unavailable", "permission.denied", "edit.empty_edits", "edit.text_not_found", "edit.text_not_unique", "edit.empty_old_text", "edit.overlapping_edits", "edit.no_change"];
8694
+
8617
8695
  /**
8618
8696
  * ---
8619
8697
  * responsibility: The declarative permission classification a tool carries on its definition
@@ -8643,6 +8721,56 @@ export declare interface ToolAvailability {
8643
8721
  description: string;
8644
8722
  }
8645
8723
 
8724
+ /**
8725
+ * The lane's classification of why one tool invocation failed: a searchable
8726
+ * machine code and the cause the tool or engine classified at execution.
8727
+ */
8728
+ export declare interface ToolCallFailure extends ToolCallFailureCause {
8729
+ readonly code: ToolCallFailureCode;
8730
+ }
8731
+
8732
+ declare type ToolCallFailureCause = z.infer<typeof toolCallFailureCauseSchema>;
8733
+
8734
+ declare const toolCallFailureCauseSchema: z.ZodObject<{
8735
+ category: z.ZodEnum<{
8736
+ cancelled: "cancelled";
8737
+ timeout: "timeout";
8738
+ unknown: "unknown";
8739
+ provider: "provider";
8740
+ "invalid-input": "invalid-input";
8741
+ "not-connected": "not-connected";
8742
+ "unsupported-operation": "unsupported-operation";
8743
+ "not-found": "not-found";
8744
+ permission: "permission";
8745
+ unavailable: "unavailable";
8746
+ }>;
8747
+ retryable: z.ZodBoolean;
8748
+ action: z.ZodEnum<{
8749
+ unknown: "unknown";
8750
+ none: "none";
8751
+ retry: "retry";
8752
+ "correct-input": "correct-input";
8753
+ connect: "connect";
8754
+ }>;
8755
+ details: z.ZodOptional<z.ZodObject<{
8756
+ moduleId: z.ZodOptional<z.ZodString>;
8757
+ toolOwnerId: z.ZodOptional<z.ZodString>;
8758
+ operation: z.ZodOptional<z.ZodString>;
8759
+ uri: z.ZodOptional<z.ZodString>;
8760
+ path: z.ZodOptional<z.ZodString>;
8761
+ validationField: z.ZodOptional<z.ZodString>;
8762
+ errorName: z.ZodOptional<z.ZodString>;
8763
+ errorCode: z.ZodOptional<z.ZodString>;
8764
+ providerCode: z.ZodOptional<z.ZodString>;
8765
+ status: z.ZodOptional<z.ZodNumber>;
8766
+ editIndex: z.ZodOptional<z.ZodNumber>;
8767
+ occurrences: z.ZodOptional<z.ZodNumber>;
8768
+ retryAfterMs: z.ZodOptional<z.ZodNumber>;
8769
+ }, z.core.$strict>>;
8770
+ }, z.core.$strict>;
8771
+
8772
+ declare type ToolCallFailureCode = (typeof TOOL_CALL_FAILURE_CODES)[number];
8773
+
8646
8774
  /**
8647
8775
  * The neutral around-execution hook: return `next()`'s result (possibly transformed) to run the
8648
8776
  * real tool, or return a result without calling `next()` to substitute one — the tool then never
@@ -8925,6 +9053,14 @@ export declare type ToolParametersWire = unknown;
8925
9053
  * declares {@link ToolPermissionHint.quiet} and keeps its honest `kind`.
8926
9054
  */
8927
9055
  declare interface ToolPermissionHint {
9056
+ /**
9057
+ * Names this exact call for the approval card, from its validated input: a title and optional
9058
+ * labelled facts. Render-only: never matched against a rule, never one-tap approval grounds.
9059
+ * The tool says what its input claims, so the gate shows it as the tool's claim, not as the
9060
+ * daemon's attestation. The host admits only display-safe text; a throw, a blank title or an
9061
+ * unsafe string costs the description and the call is asked about as before.
9062
+ */
9063
+ readonly describePreview?: (input: Record<string, unknown>) => ToolPreviewDescription | undefined;
8928
9064
  readonly kind?: ToolActionKind;
8929
9065
  readonly scheme?: string;
8930
9066
  readonly ruleKey?: string;
@@ -9051,6 +9187,16 @@ declare interface ToolPermissionHint {
9051
9187
  readonly defaultPermission?: "allow" | "ask" | "never";
9052
9188
  }
9053
9189
 
9190
+ /** What {@link ToolPermissionHint.describePreview} answers. */
9191
+ declare interface ToolPreviewDescription {
9192
+ readonly title: string;
9193
+ readonly description?: string;
9194
+ readonly fields?: readonly {
9195
+ readonly label: string;
9196
+ readonly value: string;
9197
+ }[];
9198
+ }
9199
+
9054
9200
  /** Controls whether a tool is expected to complete inline or via background adoption. */
9055
9201
  export declare type ToolRunPolicy = "inline" | "background";
9056
9202
 
@@ -2884,6 +2884,7 @@ declare const SessionProvenanceRecord: z.ZodObject<{
2884
2884
  cron: "cron";
2885
2885
  occurrence: "occurrence";
2886
2886
  "uri-change": "uri-change";
2887
+ "plugin-event": "plugin-event";
2887
2888
  manual: "manual";
2888
2889
  }>;
2889
2890
  }, z.core.$strict>, z.ZodObject<{