@yaklabs-ai/plugin-sdk 0.14.1 → 0.15.0

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.
@@ -42,7 +42,7 @@ export declare interface DecideChoiceQuestion<L extends string = string> {
42
42
  /** What a question asks: text, or a JSON object the client sends as its JSON text. */
43
43
  export declare type DecideInstructions = string | object;
44
44
 
45
- export declare type DecideModelId = "jev" | "clef" | "clef-flash";
45
+ export declare type DecideModelId = "jev" | "clef" | "clef-flash" | "gpt-6-luna";
46
46
 
47
47
  export declare type DecideQuestion = DecideBoolQuestion | DecideChoiceQuestion | DecideScoreQuestion;
48
48
 
@@ -50,10 +50,10 @@ export declare type DecideQuestion = DecideBoolQuestion | DecideChoiceQuestion |
50
50
  export declare type DecideQuestions = Readonly<Record<string, DecideQuestion>>;
51
51
 
52
52
  export declare interface DecideRequest<Q extends DecideQuestions = DecideQuestions> {
53
- /** Defaults to `jev`. */
54
- readonly model?: DecideModelId;
53
+ readonly model: DecideModelId;
55
54
  readonly state: DecideState;
56
55
  readonly questions: Q;
56
+ readonly image?: SystemOneImage;
57
57
  }
58
58
 
59
59
  export declare interface DecideScoreAnswer {
@@ -243,7 +243,7 @@ export declare interface SystemOneClient {
243
243
  decide<const Q extends DecideQuestions>(request: DecideRequest<Q>, options?: SystemOneCallOptions): Promise<Decision<Q>>;
244
244
  extract<const F extends ExtractFields>(request: ExtractRequest<F>, options?: SystemOneCallOptions): Promise<Extraction<F>>;
245
245
  /** Whether some provider in the current order can serve `(kind, model)`. Never rejects. */
246
- availability(kind: SystemOneKind, model?: SystemOneModelId): Promise<SystemOneAvailability>;
246
+ availability(kind: SystemOneKind, model: SystemOneModelId): Promise<SystemOneAvailability>;
247
247
  }
248
248
 
249
249
  /**
@@ -297,6 +297,12 @@ export declare type SystemOneFailureCause = {
297
297
  readonly kind: "invalid-answer";
298
298
  };
299
299
 
300
+ /** One PNG attachment. `data` is padded base64, without a data-URL prefix. */
301
+ export declare interface SystemOneImage {
302
+ readonly mimeType: "image/png";
303
+ readonly data: string;
304
+ }
305
+
300
306
  /**
301
307
  * ---
302
308
  * responsibility: The data shapes of the System One surface: models, the decide and extract
@@ -23,20 +23,6 @@ function isSystemOneError(error) {
23
23
  return error instanceof SystemOneError;
24
24
  }
25
25
 
26
- // packages/system-one/dist/models.js
27
- var DEFAULT_DECIDE_MODEL = "jev";
28
- var SYSTEM_ONE_LIMITS = {
29
- /** The serialized request body, in bytes. */
30
- maxBodyBytes: 64 * 1024,
31
- maxQuestions: 64,
32
- maxFields: 32,
33
- minChoiceOptions: 2,
34
- maxChoiceOptions: 255,
35
- minScoreLevels: 2,
36
- maxScoreLevels: 10,
37
- maxForecastHorizon: 64
38
- };
39
-
40
26
  // packages/system-one/dist/unavailable.js
41
27
  var NOT_SERVED = {
42
28
  available: false,
@@ -48,7 +34,7 @@ function createUnavailableSystemOneClient() {
48
34
  decide(request) {
49
35
  return Promise.reject(new SystemOneError({
50
36
  kind: "decide",
51
- model: request.model ?? DEFAULT_DECIDE_MODEL,
37
+ model: request.model,
52
38
  cause: { kind: "not-served" }
53
39
  }));
54
40
  },
@@ -62,6 +48,22 @@ function createUnavailableSystemOneClient() {
62
48
  availability: () => Promise.resolve(NOT_SERVED)
63
49
  };
64
50
  }
51
+
52
+ // packages/system-one/dist/models.js
53
+ var SYSTEM_ONE_LIMITS = {
54
+ /** The serialized state and questions, in bytes; images have a separate budget. */
55
+ maxBodyBytes: 64 * 1024,
56
+ maxImageBytes: 4 * 1024 * 1024,
57
+ maxImagePixels: 16e6,
58
+ maxImageBodyBytes: 6 * 1024 * 1024,
59
+ maxQuestions: 64,
60
+ maxFields: 32,
61
+ minChoiceOptions: 2,
62
+ maxChoiceOptions: 255,
63
+ minScoreLevels: 2,
64
+ maxScoreLevels: 10,
65
+ maxForecastHorizon: 64
66
+ };
65
67
  export {
66
68
  SystemOneError,
67
69
  createUnavailableSystemOneClient,
@@ -1,5 +1,7 @@
1
1
  import { z } from 'zod';
2
2
 
3
+ export declare const ATTACHMENTS_CUSTOM_TYPE = "attachments";
4
+
3
5
  /**
4
6
  * The ids on a session's active branch: the leaf chain walked parent-ward from
5
7
  * the tip, which a trailing `leaf` marker moves. Empty for an empty log.
@@ -43,6 +45,36 @@ export declare function matchesWorkBlock(coverage: WorkBlockCoverage, toolResult
43
45
  */
44
46
  export declare const NON_ACTIVITY_TOOL_NAMES: readonly string[];
45
47
 
48
+ /**
49
+ * What a run did to a URI. The words match the automation run wire's artifact actions. When one
50
+ * run both creates and updates a URI, the reader reports `created`.
51
+ */
52
+ declare type ProducedResourceAction = "created" | "updated";
53
+
54
+ /** One URI a tool call created or updated as a side effect. */
55
+ declare interface ProducedResourceDeclaration {
56
+ /** A `scheme://…` URI or an absolute local file path, compared as an exact string. */
57
+ readonly uri: string;
58
+ readonly action: ProducedResourceAction;
59
+ }
60
+
61
+ /**
62
+ * One tool result's declarations. `absent` covers every result that makes no claim, including a
63
+ * non-object `details` and an empty list. `malformed` means a claim was made that cannot be
64
+ * trusted; the reader reports a gap for it instead of keeping the parts that look valid.
65
+ */
66
+ declare type ProducedResourceDeclarationsRead = {
67
+ readonly kind: "absent";
68
+ } | {
69
+ readonly kind: "malformed";
70
+ } | {
71
+ readonly kind: "declared";
72
+ readonly resources: readonly ProducedResourceDeclaration[];
73
+ };
74
+
75
+ /** Read the declarations that one persisted tool result's `details` carries. */
76
+ export declare function readProducedResourceDeclarations(details: unknown): ProducedResourceDeclarationsRead;
77
+
46
78
  /**
47
79
  * The daemon's own run-start record. A run's entries begin here, before the
48
80
  * user message that opened it.
@@ -94,7 +94,47 @@ var NON_ACTIVITY_TOOL_NAMES = [
94
94
  ];
95
95
  var WORK_HEADLINE_MIN_CHARS = 12;
96
96
  var WORK_HEADLINE_MAX_CHARS = 90;
97
+
98
+ // packages/herd-transcript/dist/context-messages.js
99
+ var ATTACHMENTS_CUSTOM_TYPE = "attachments";
100
+
101
+ // packages/herd-uri/dist/produced-resources.js
102
+ var PRODUCED_RESOURCES_DETAILS_KEY = "producedResources";
103
+ var ABSENT = { kind: "absent" };
104
+ var MALFORMED = { kind: "malformed" };
105
+ var SCHEME_URI = /^[a-z][a-z0-9+.-]*:\/\/./;
106
+ var WINDOWS_ABSOLUTE_PATH = /^[A-Za-z]:[\\/]./;
107
+ function isProducedResourceUri(value) {
108
+ if (typeof value !== "string" || value.trim() !== value)
109
+ return false;
110
+ return SCHEME_URI.test(value) || value.startsWith("/") && value.length > 1 || WINDOWS_ABSOLUTE_PATH.test(value);
111
+ }
112
+ function isProducedResourceDeclaration(value) {
113
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
114
+ return false;
115
+ }
116
+ const keys = Object.keys(value);
117
+ if (keys.length !== 2 || !keys.includes("uri") || !keys.includes("action")) {
118
+ return false;
119
+ }
120
+ const record = value;
121
+ return isProducedResourceUri(record.uri) && (record.action === "created" || record.action === "updated");
122
+ }
123
+ function readProducedResourceDeclarations(details) {
124
+ if (typeof details !== "object" || details === null || Array.isArray(details) || !Object.hasOwn(details, PRODUCED_RESOURCES_DETAILS_KEY)) {
125
+ return ABSENT;
126
+ }
127
+ const claimed = details[PRODUCED_RESOURCES_DETAILS_KEY];
128
+ if (!Array.isArray(claimed))
129
+ return MALFORMED;
130
+ if (claimed.length === 0)
131
+ return ABSENT;
132
+ if (!claimed.every(isProducedResourceDeclaration))
133
+ return MALFORMED;
134
+ return { kind: "declared", resources: claimed };
135
+ }
97
136
  export {
137
+ ATTACHMENTS_CUSTOM_TYPE,
98
138
  NON_ACTIVITY_TOOL_NAMES,
99
139
  RUN_STARTED_CUSTOM_TYPE,
100
140
  RUN_TERMINAL_CUSTOM_TYPE,
@@ -105,6 +145,7 @@ export {
105
145
  branchEntryIds,
106
146
  customEntriesFromEntries,
107
147
  matchesWorkBlock,
148
+ readProducedResourceDeclarations,
108
149
  turnSegments,
109
150
  workBlockCoverage,
110
151
  workBlockKey
@@ -22,8 +22,8 @@
22
22
  * This module's `read` is a pure projection of the URI it was handed — no network, no credential.
23
23
  * Declaring `requiresAuth` anyway would not be a harmless formality: an auth-gated module whose
24
24
  * binding is unsatisfied has its public-web `urlPattern` claims suppressed and its `matches()`
25
- * wrapped to decline `http(s)` (`agent-session.ts` `_suppressPublicUrlClaims`, and
26
- * `authSuppressedCatalogModule` for discovery). A pasted Supabase link would therefore stay
25
+ * wrapped to decline `http(s)` (herd-agent's `uri-catalog-projection.ts`: `suppressPublicUrlClaims`,
26
+ * and `authSuppressedCatalogModule` for discovery). A pasted Supabase link would therefore stay
27
27
  * unbranded for every user who has not yet connected Supabase — which is exactly the user the
28
28
  * branded pill is for. The vendor's MCP tools remain gated on their own, by the MCP host.
29
29
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yaklabs-ai/plugin-sdk",
3
- "version": "0.14.1",
3
+ "version": "0.15.0",
4
4
  "description": "The Kay plugin SDK — types and helpers for authoring a Kay directory plugin.",
5
5
  "author": "YakLabs",
6
6
  "type": "module",
@@ -289,10 +289,10 @@ on the plugin's row (or on the plugin source's row, when the whole source found
289
289
 
290
290
  A directory plugin does not request workflows in its manifest. During `kay.app` activation, call
291
291
  `app.workflows.define(localId, { name, trigger, run })` to put a durable, daemon-scheduled row on
292
- the Automations page. The host raises the `workflows.define` claim for every `kay.app` plugin; a
293
- bundled install holds every grant, while a directory plugin needs the user to add that grant to its
294
- `installs` row. Source class no longer decides workflow authority, and the capability is ABSENT
295
- rather than refused when ungranted, so guard on `app.workflows === undefined`.
292
+ the Automations page. The first `define` raises the `workflows.define` claim, decided once
293
+ `activate()` resolves; a bundled install holds every grant, while a directory plugin needs the user
294
+ to add that grant to its `installs` row, and until then it does not start. Source class no longer
295
+ decides workflow authority. `app.workflows` is absent only for a plugin with no workflow namespace.
296
296
 
297
297
  The product-agent procedure is the builtin skill `create-workflow`
298
298
  (`packages/agent-runtime/src/kay/builtin-skills/`), and the API reference is the "Durable Workflows