@keemakr/agent-sdk 0.15.0 → 0.16.0-dev-20260924112033

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.
@@ -0,0 +1,49 @@
1
+ /** Any card. Open by construction: a client may render a `type` this SDK predates. */
2
+ export type Canvas = {
3
+ type: string;
4
+ } & Record<string, unknown>;
5
+ /** A titled markdown document — a run summary, a written answer, a table of results. */
6
+ export interface ReportCanvas {
7
+ type: 'report';
8
+ markdown: string;
9
+ title?: string;
10
+ }
11
+ /**
12
+ * A picture, shown inline in the chat.
13
+ *
14
+ * Prefer this over putting the URL in `reply`. Clients do preview a URL a reply merely names, but
15
+ * the card is the better copy on both sides of the wire: core validates the URL at ingestion, the
16
+ * card carries its own alt text and dimensions, and a client that shows the card suppresses the
17
+ * duplicate preview of the same URL in your prose.
18
+ */
19
+ export interface ImageCanvas {
20
+ type: 'image';
21
+ url: string;
22
+ /** What the picture shows. This is the fallback text, so write it for someone who cannot see it. */
23
+ alt?: string;
24
+ /** The prompt that produced it, when it was generated. Shown as a caption. */
25
+ prompt?: string;
26
+ width?: number;
27
+ height?: number;
28
+ }
29
+ /**
30
+ * Build an image card, refusing a URL that would not reach a reader.
31
+ *
32
+ * Two different things drop a URL on the way, and both are silent from here — the delegation
33
+ * succeeds, the card never appears, and nothing in your logs says why:
34
+ *
35
+ * - Core's ingestion default-denies anything that is not http(s). A `data:`, `file:` or
36
+ * `javascript:` URL is never persisted.
37
+ * - The dashboards are served over https, so an `http:` image is mixed content the browser
38
+ * refuses after upgrading the request. Core stores it happily; nobody ever sees it.
39
+ *
40
+ * So this is stricter than ingestion on purpose: https only. Throwing at construction turns a
41
+ * picture that quietly never arrives into an error where the mistake was made.
42
+ */
43
+ export declare function imageCanvas(input: {
44
+ url: string;
45
+ alt?: string;
46
+ prompt?: string;
47
+ width?: number;
48
+ height?: number;
49
+ }): ImageCanvas;
@@ -0,0 +1,47 @@
1
+ // Canvases — the inline cards an agent's reply can carry back to the Operator.
2
+ //
3
+ // A department returns `canvases` on its DelegationResult and core persists each one as a content
4
+ // block the clients render. The wire is deliberately permissive (core validates a canvas is
5
+ // `{ type, … }` and nothing more, so a client that knows a card can render it even if core has
6
+ // never heard of it), which is right for the pipe and unhelpful when you are writing the agent:
7
+ // nothing tells you a card exists, what it is called, or which fields it needs.
8
+ //
9
+ // So this is a floor, not a schema. The types name the cards clients render today, and the helper
10
+ // refuses the one mistake that is silent end to end — a URL core will drop at ingestion, leaving
11
+ // an agent that believes it delivered a picture and a user who sees nothing.
12
+ /**
13
+ * Build an image card, refusing a URL that would not reach a reader.
14
+ *
15
+ * Two different things drop a URL on the way, and both are silent from here — the delegation
16
+ * succeeds, the card never appears, and nothing in your logs says why:
17
+ *
18
+ * - Core's ingestion default-denies anything that is not http(s). A `data:`, `file:` or
19
+ * `javascript:` URL is never persisted.
20
+ * - The dashboards are served over https, so an `http:` image is mixed content the browser
21
+ * refuses after upgrading the request. Core stores it happily; nobody ever sees it.
22
+ *
23
+ * So this is stricter than ingestion on purpose: https only. Throwing at construction turns a
24
+ * picture that quietly never arrives into an error where the mistake was made.
25
+ */
26
+ export function imageCanvas(input) {
27
+ let parsed;
28
+ try {
29
+ parsed = new URL(input.url);
30
+ }
31
+ catch {
32
+ throw new TypeError(`imageCanvas: not a URL: ${input.url}`);
33
+ }
34
+ if (parsed.protocol !== 'https:') {
35
+ throw new TypeError(`imageCanvas: images must be https; "${parsed.protocol}" either never reaches the ` +
36
+ 'transcript (core drops non-http(s) at ingestion) or is blocked as mixed content by the ' +
37
+ 'browser that would show it');
38
+ }
39
+ return {
40
+ type: 'image',
41
+ url: input.url,
42
+ ...(input.alt === undefined ? {} : { alt: input.alt }),
43
+ ...(input.prompt === undefined ? {} : { prompt: input.prompt }),
44
+ ...(input.width === undefined ? {} : { width: input.width }),
45
+ ...(input.height === undefined ? {} : { height: input.height }),
46
+ };
47
+ }
package/dist/index.d.ts CHANGED
@@ -3,3 +3,4 @@ export { verifyGrant, type VerifiedGrant } from './verify-grant.js';
3
3
  export { useKee, MemoryConflictError, RecordConflictError, RecordValidationError, type Kee, type KeeConnection, type KeeContext, type KeeError, type KeeMemory, type KeeRecords, type KeeKb, type KBHit, type KeeTools, type KeeConfig, type MemoryEntry, type MemorySearchHit, type RecordEntry, } from './client.js';
4
4
  export { keemakrToolDirectory } from './tool-directory.js';
5
5
  export { refreshGrant, REFRESH_THRESHOLD_SECONDS } from './refresh.js';
6
+ export { imageCanvas, type Canvas, type ImageCanvas, type ReportCanvas } from './canvases.js';
package/dist/index.js CHANGED
@@ -13,3 +13,4 @@ export { verifyGrant } from './verify-grant.js';
13
13
  export { useKee, MemoryConflictError, RecordConflictError, RecordValidationError, } from './client.js';
14
14
  export { keemakrToolDirectory } from './tool-directory.js';
15
15
  export { refreshGrant, REFRESH_THRESHOLD_SECONDS } from './refresh.js';
16
+ export { imageCanvas } from './canvases.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keemakr/agent-sdk",
3
- "version": "0.15.0",
3
+ "version": "0.16.0-dev-20260924112033",
4
4
  "description": "The floor for keemakr marketplace agents: verify the capability grant and reach tenant connections, memory, and shared platform tools through keemakr-core — without holding raw secrets or resolving the tenant yourself.",
5
5
  "license": "MIT",
6
6
  "type": "module",