@jigs.design/ai-sdk 0.2.0 → 0.3.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.
package/README.md CHANGED
@@ -2,17 +2,14 @@
2
2
 
3
3
  Optional. Connects Jigs to the [AI SDK](https://ai-sdk.dev) in two ways:
4
4
 
5
- - `aiSdkModel(model, settings?)` is a `model` for `createJigsServer`. It passes the host's prompt as `instructions`, streams the text through `streamText`, and reports token usage to `onTurn`. It takes a gateway id such as `"anthropic/claude-sonnet-5.5"` or any provider's `LanguageModel`.
5
+ - `aiSdkModel(model, settings?)` is a `model` for `withModel`. It passes the host's prompt as `instructions`, streams the text through `streamText`, and reports token usage to `onTurn`. It takes a gateway id such as `"anthropic/claude-sonnet-5.5"` or any provider's `LanguageModel`.
6
6
  - `jigsChat(jigs, { request, messages })` runs chat mode on a `useChat` conversation. The assistant answers in Markdown, and each fenced `jigs` block becomes a `data-jigs` part you draw with `JigsView`.
7
7
 
8
8
  ```ts
9
9
  import { aiSdkModel } from "@jigs.design/ai-sdk";
10
10
  import { createJigsServer } from "@jigs.design/server";
11
11
 
12
- export const jigs = createJigsServer({
13
- host,
14
- context,
15
- run,
12
+ export const jigs = createJigsServer({ host, context, run }).withModel({
16
13
  model: aiSdkModel("anthropic/claude-sonnet-5.5", { temperature: 0.2 }),
17
14
  });
18
15
  ```
package/dist/chat.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { JigsBlockData, JigsUIMessage, WithJigsBlocks } from "./stored.js";
2
- import { ChatTurn, JigsServer } from "@jigs.design/server";
2
+ import { ChatTurn, JigsModelServer, JigsServer } from "@jigs.design/server";
3
3
  import { InferUIMessageChunk, UIMessage, UIMessageChunk } from "ai";
4
4
  //#region src/chat.d.ts
5
5
  export interface JigsChat {
@@ -41,7 +41,7 @@ export interface JigsChat {
41
41
  * conversation's earlier jigs from `messages`, so edits and versions
42
42
  * continue from them.
43
43
  */
44
- export declare function jigsChat<TContext, TSpecName extends string>(jigs: JigsServer<TContext, TSpecName>, input: {
44
+ export declare function jigsChat<TContext, TPageName extends string>(jigs: JigsModelServer<TContext, TPageName>, input: {
45
45
  messages: ReadonlyArray<UIMessage>;
46
46
  /** App options for the server's `options` schema, passed to repairs. */
47
47
  options?: unknown;
package/dist/chat.js CHANGED
@@ -3,7 +3,7 @@ import { chatBlockText } from "@jigs.design/server";
3
3
  import { z } from "zod";
4
4
  //#region src/chat.ts
5
5
  const blockSource = z.object({
6
- id: z.string(),
6
+ name: z.string(),
7
7
  source: z.string()
8
8
  });
9
9
  /** The conversation's blocks, oldest first, read from its `data-jigs` parts. */
package/dist/model.d.ts CHANGED
@@ -12,7 +12,7 @@ export type ModelSettings = Omit<Parameters<typeof streamText>[0], "abortSignal"
12
12
  */
13
13
  export declare function cachedInstructions(system: string, prefix: string): Instructions;
14
14
  /**
15
- * A `model` for `createJigsServer` from an AI SDK model: document-mode
15
+ * A `model` for `withModel` from an AI SDK model: document-mode
16
16
  * sessions and chat repairs stream through `streamText`, and token usage
17
17
  * reaches `onTurn`. The prompt's stable start is marked for the provider's
18
18
  * cache (`cachedInstructions`).
package/dist/model.js CHANGED
@@ -19,7 +19,7 @@ function cachedInstructions(system, prefix) {
19
19
  }];
20
20
  }
21
21
  /**
22
- * A `model` for `createJigsServer` from an AI SDK model: document-mode
22
+ * A `model` for `withModel` from an AI SDK model: document-mode
23
23
  * sessions and chat repairs stream through `streamText`, and token usage
24
24
  * reaches `onTurn`. The prompt's stable start is marked for the provider's
25
25
  * cache (`cachedInstructions`).
package/dist/schemas.d.ts CHANGED
@@ -4,7 +4,7 @@ import { z } from "zod";
4
4
  * Schemas for `validateUIMessages<StoredJigsUIMessage>({ messages,
5
5
  * dataSchemas })`, to check a conversation the browser sent or one read
6
6
  * from storage. A jig's program is dropped, never checked: the server
7
- * reads only `id` and `source`, and a source is only ever compiled.
7
+ * reads only `name` and `source`, and a source is only ever compiled.
8
8
  */
9
9
  export declare const jigsDataSchemas: {
10
10
  jigs: z.ZodObject<{
@@ -51,8 +51,12 @@ export declare const jigsDataSchemas: {
51
51
  }>;
52
52
  message: z.ZodString;
53
53
  }, z.core.$strip>>;
54
- id: z.ZodString;
55
54
  key: z.ZodString;
55
+ name: z.ZodString;
56
+ ref: z.ZodExactOptional<z.ZodObject<{
57
+ name: z.ZodString;
58
+ props: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodString]>>;
59
+ }, z.core.$strip>>;
56
60
  source: z.ZodString;
57
61
  status: z.ZodEnum<{
58
62
  done: "done";
package/dist/schemas.js CHANGED
@@ -25,8 +25,16 @@ const storedBlock = z.object({
25
25
  code: z.enum(jigsErrorCodes),
26
26
  message: z.string()
27
27
  }).exactOptional(),
28
- id: z.string(),
29
28
  key: z.string(),
29
+ name: z.string(),
30
+ ref: z.object({
31
+ name: z.string(),
32
+ props: z.record(z.string(), z.union([
33
+ z.boolean(),
34
+ z.number(),
35
+ z.string()
36
+ ]))
37
+ }).exactOptional(),
30
38
  source: z.string(),
31
39
  status: z.enum([
32
40
  "streaming",
@@ -39,7 +47,7 @@ const storedBlock = z.object({
39
47
  * Schemas for `validateUIMessages<StoredJigsUIMessage>({ messages,
40
48
  * dataSchemas })`, to check a conversation the browser sent or one read
41
49
  * from storage. A jig's program is dropped, never checked: the server
42
- * reads only `id` and `source`, and a source is only ever compiled.
50
+ * reads only `name` and `source`, and a source is only ever compiled.
43
51
  */
44
52
  const jigsDataSchemas = { jigs: storedBlock };
45
53
  //#endregion
package/dist/stored.d.ts CHANGED
@@ -42,7 +42,7 @@ export type WithJigsBlocks<TMessage extends UIMessage, TBlock> = Omit<TMessage,
42
42
  /**
43
43
  * The messages without their jigs' programs: for the body `useChat`
44
44
  * posts (`prepareSendMessagesRequest`), and for storing a conversation. The
45
- * server reads only each block's `id` and `source`. Every other part, and
45
+ * server reads only each block's `name` and `source`. Every other part, and
46
46
  * every other field of a block, is kept as it is.
47
47
  */
48
48
  export declare function withoutPrograms<TMessage extends UIMessage>(messages: ReadonlyArray<TMessage>): Array<WithJigsBlocks<TMessage, StoredJigsBlock>>;
package/dist/stored.js CHANGED
@@ -6,7 +6,7 @@ function hasProgram(part) {
6
6
  /**
7
7
  * The messages without their jigs' programs: for the body `useChat`
8
8
  * posts (`prepareSendMessagesRequest`), and for storing a conversation. The
9
- * server reads only each block's `id` and `source`. Every other part, and
9
+ * server reads only each block's `name` and `source`. Every other part, and
10
10
  * every other field of a block, is kept as it is.
11
11
  */
12
12
  function withoutPrograms(messages) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jigs.design/ai-sdk",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Jigs on the AI SDK: a model function for createJigsServer, and chat mode for useChat.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -29,8 +29,8 @@
29
29
  "access": "public"
30
30
  },
31
31
  "dependencies": {
32
- "@jigs.design/server": "0.2.0",
33
- "@jigs.design/protocol": "0.2.0"
32
+ "@jigs.design/protocol": "0.3.0",
33
+ "@jigs.design/server": "0.3.0"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "ai": "^7.0.0",
@@ -40,7 +40,7 @@
40
40
  "@ai-sdk/provider": "4.0.27",
41
41
  "ai": "7.0.140",
42
42
  "zod": "4.6.7",
43
- "@jigs.design/catalog": "0.2.0",
44
- "@jigs.design/host": "0.2.0"
43
+ "@jigs.design/catalog": "0.3.0",
44
+ "@jigs.design/host": "0.3.0"
45
45
  }
46
46
  }