@jigs.design/ai-sdk 0.1.0 → 0.1.2

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
@@ -1,15 +1,15 @@
1
1
  # @jigs.design/ai-sdk
2
2
 
3
- Optional. Connects Pickle to the [AI SDK](https://ai-sdk.dev) in two ways:
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 `createPickleServer`. 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
- - `pickleChat(pickle, { request, messages })` runs chat mode on a `useChat` conversation. The assistant answers in Markdown, and each fenced `pickle` block becomes a `data-pickle` part you draw with `PickleView`.
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`.
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
- import { createPickleServer } from "@jigs.design/server";
10
+ import { createJigsServer } from "@jigs.design/server";
11
11
 
12
- export const pickle = createPickleServer({
12
+ export const jigs = createJigsServer({
13
13
  host,
14
14
  context,
15
15
  run,
@@ -21,24 +21,24 @@ Import the root entry from server code. The browser imports `@jigs.design/ai-sdk
21
21
 
22
22
  ## Exports
23
23
 
24
- | Export | What it is |
25
- | -------------------------------------------- | -------------------------------------------------------------------------------- |
26
- | `aiSdkModel`, `ModelSettings` | The model function and the `streamText` settings it applies to every call |
27
- | `pickleChat` | One chat turn: the system prompt, the history converter and the stream transform |
28
- | `pickleDataSchemas` | Schemas for `validateUIMessages`. They drop each pickle's `program` |
29
- | `revivePickles` | Compiles a stored conversation's pickles again, typed from the messages passed |
30
- | `withoutPrograms` | Strips programs from messages, for the request body and for storage |
31
- | `recentMessages` | The recent turns of a long conversation, after every earlier pickle |
32
- | `PickleUIMessage`, `PickleBlockData` | Types for `useChat` and for one `data-pickle` part, generic over your metadata |
33
- | `StoredPickleUIMessage`, `StoredPickleBlock` | The same without programs: what the server receives and what you store |
34
- | `@jigs.design/ai-sdk/client` | The browser entry: `withoutPrograms`, `recentMessages` and the types |
24
+ | Export | What it is |
25
+ | ---------------------------------------- | -------------------------------------------------------------------------------- |
26
+ | `aiSdkModel`, `ModelSettings` | The model function and the `streamText` settings it applies to every call |
27
+ | `jigsChat` | One chat turn: the system prompt, the history converter and the stream transform |
28
+ | `jigsDataSchemas` | Schemas for `validateUIMessages`. They drop each jig's `program` |
29
+ | `reviveJigs` | Compiles a stored conversation's jigs again, typed from the messages passed |
30
+ | `withoutPrograms` | Strips programs from messages, for the request body and for storage |
31
+ | `recentMessages` | The recent turns of a long conversation, after every earlier jig |
32
+ | `JigsUIMessage`, `JigsBlockData` | Types for `useChat` and for one `data-jigs` part, generic over your metadata |
33
+ | `StoredJigsUIMessage`, `StoredJigsBlock` | The same without programs: what the server receives and what you store |
34
+ | `@jigs.design/ai-sdk/client` | The browser entry: `withoutPrograms`, `recentMessages` and the types |
35
35
 
36
36
  ## Source
37
37
 
38
38
  - `src/model.ts`: `aiSdkModel`.
39
39
  - `src/chat.ts`: chat mode on `useChat`.
40
40
  - `src/stored.ts`, `src/client.ts`: the message types, `withoutPrograms`, `recentMessages`, and the browser entry. No Zod here.
41
- - `src/schemas.ts`: `pickleDataSchemas`, server only.
41
+ - `src/schemas.ts`: `jigsDataSchemas`, server only.
42
42
 
43
43
  ## Docs
44
44
 
package/dist/chat.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- import { PickleBlockData, PickleUIMessage, WithPickleBlocks } from "./stored.js";
2
- import { ChatTurn, PickleServer } from "@jigs.design/server";
1
+ import { JigsBlockData, JigsUIMessage, WithJigsBlocks } from "./stored.js";
2
+ import { ChatTurn, JigsServer } from "@jigs.design/server";
3
3
  import { InferUIMessageChunk, UIMessage, UIMessageChunk } from "ai";
4
4
  //#region src/chat.d.ts
5
- export interface PickleChat {
5
+ export interface JigsChat {
6
6
  /**
7
7
  * For `convertToModelMessages(messages, { convertDataPart })`: writes each
8
- * pickle back as the fenced block the model wrote, so it sees its UIs.
8
+ * jigs back as the fenced block the model wrote, so it sees its UIs.
9
9
  * Returns `undefined` for other data parts; chain your own after it.
10
10
  */
11
11
  convertDataPart: (part: {
@@ -24,35 +24,35 @@ export interface PickleChat {
24
24
  systemPrefix: string;
25
25
  /**
26
26
  * Turns a UI message stream, e.g. `result.toUIMessageStream()`, into one
27
- * where pickles are `data-pickle` parts. Prose stays in text parts, in the
27
+ * where jigs are `data-jigs` parts. Prose stays in text parts, in the
28
28
  * reply's order; a block's part updates in place as it streams and when it
29
29
  * is repaired, and the stream finishes after every repair. Cancelling it
30
30
  * stops the repairs. `TMessage` is the app's message type, for
31
- * `createUIMessageStream`; its `pickle` data part must be a
32
- * `PickleBlockData` or a `StoredPickleBlock`.
31
+ * `createUIMessageStream`; its `jigs` data part must be a
32
+ * `JigsBlockData` or a `StoredJigsBlock`.
33
33
  */
34
- toUIMessageStream: <TMessage extends UIMessage = PickleUIMessage>(stream: ReadableStream<UIMessageChunk>) => ReadableStream<InferUIMessageChunk<TMessage>>;
34
+ toUIMessageStream: <TMessage extends UIMessage = JigsUIMessage>(stream: ReadableStream<UIMessageChunk>) => ReadableStream<InferUIMessageChunk<TMessage>>;
35
35
  /** The chat turn under it, for anything the stream transform does not cover. */
36
36
  turn: ChatTurn;
37
37
  }
38
38
  /**
39
39
  * Starts one chat reply on the AI SDK. Runs the server's `context` for
40
- * `request` (a PickleError it throws rejects, as on a call) and reads the
41
- * conversation's earlier pickles from `messages`, so edits and versions
40
+ * `request` (a JigsError it throws rejects, as on a call) and reads the
41
+ * conversation's earlier jigs from `messages`, so edits and versions
42
42
  * continue from them.
43
43
  */
44
- export declare function pickleChat<TContext, TSpecName extends string>(pickle: PickleServer<TContext, TSpecName>, input: {
44
+ export declare function jigsChat<TContext, TSpecName extends string>(jigs: JigsServer<TContext, TSpecName>, input: {
45
45
  messages: ReadonlyArray<UIMessage>;
46
46
  /** App options for the server's `options` schema, passed to repairs. */
47
47
  options?: unknown;
48
48
  request: Request;
49
- }): Promise<PickleChat>;
49
+ }): Promise<JigsChat>;
50
50
  /**
51
- * Compiles the pickles of a stored conversation again, for showing it after
51
+ * Compiles the jigs of a stored conversation again, for showing it after
52
52
  * a reload. Programs are rebuilt from each block's `source` here, never read
53
53
  * back from storage. Other parts and the metadata pass through as they are,
54
- * so a `StoredPickleUIMessage<Metadata>`, or the stored form of your own
55
- * message type, comes back with `PickleBlockData` in its `data-pickle` parts.
54
+ * so a `StoredJigsUIMessage<Metadata>`, or the stored form of your own
55
+ * message type, comes back with `JigsBlockData` in its `data-jigs` parts.
56
56
  */
57
- export declare function revivePickles<TMessage extends UIMessage>(pickle: Pick<PickleServer<unknown>, "compile">, messages: ReadonlyArray<TMessage>): Promise<Array<WithPickleBlocks<TMessage, PickleBlockData>>>;
57
+ export declare function reviveJigs<TMessage extends UIMessage>(jigs: Pick<JigsServer<unknown>, "compile">, messages: ReadonlyArray<TMessage>): Promise<Array<WithJigsBlocks<TMessage, JigsBlockData>>>;
58
58
  //#endregion
package/dist/chat.js CHANGED
@@ -6,13 +6,13 @@ const blockSource = z.object({
6
6
  id: z.string(),
7
7
  source: z.string()
8
8
  });
9
- /** The conversation's blocks, oldest first, read from its `data-pickle` parts. */
9
+ /** The conversation's blocks, oldest first, read from its `data-jigs` parts. */
10
10
  function blocksIn(messages) {
11
11
  const blocks = [];
12
12
  for (const message of messages) {
13
13
  if (message.role !== "assistant") continue;
14
14
  for (const part of message.parts) {
15
- if (part.type !== "data-pickle" || !("data" in part)) continue;
15
+ if (part.type !== "data-jigs" || !("data" in part)) continue;
16
16
  const parsed = blockSource.safeParse(part.data);
17
17
  if (parsed.success) blocks.push(parsed.data);
18
18
  }
@@ -26,13 +26,13 @@ function lastPrompt(messages) {
26
26
  }
27
27
  /**
28
28
  * Starts one chat reply on the AI SDK. Runs the server's `context` for
29
- * `request` (a PickleError it throws rejects, as on a call) and reads the
30
- * conversation's earlier pickles from `messages`, so edits and versions
29
+ * `request` (a JigsError it throws rejects, as on a call) and reads the
30
+ * conversation's earlier jigs from `messages`, so edits and versions
31
31
  * continue from them.
32
32
  */
33
- async function pickleChat(pickle, input) {
33
+ async function jigsChat(jigs, input) {
34
34
  const stop = new AbortController();
35
- const turn = await pickle.chat(input.request, {
35
+ const turn = await jigs.chat(input.request, {
36
36
  blocks: blocksIn(input.messages),
37
37
  options: input.options,
38
38
  prompt: lastPrompt(input.messages),
@@ -40,7 +40,7 @@ async function pickleChat(pickle, input) {
40
40
  });
41
41
  return {
42
42
  convertDataPart: (part) => {
43
- if (part.type !== "data-pickle") return;
43
+ if (part.type !== "data-jigs") return;
44
44
  const parsed = blockSource.safeParse(part.data);
45
45
  return parsed.success ? {
46
46
  text: chatBlockText(parsed.data),
@@ -56,7 +56,7 @@ async function pickleChat(pickle, input) {
56
56
  /** What a block that was still open says when its reply stops. */
57
57
  const STOPPED = {
58
58
  code: "INTERNAL",
59
- message: "The reply stopped before this pickle was finished."
59
+ message: "The reply stopped before this jig was finished."
60
60
  };
61
61
  function transform(turn, stream, stop) {
62
62
  const reader = stream.getReader();
@@ -88,7 +88,7 @@ function transform(turn, stream, stop) {
88
88
  send({
89
89
  data: block,
90
90
  id: block.key,
91
- type: "data-pickle"
91
+ type: "data-jigs"
92
92
  });
93
93
  };
94
94
  const repair = (block) => {
@@ -193,19 +193,19 @@ function transform(turn, stream, stop) {
193
193
  });
194
194
  }
195
195
  /**
196
- * Compiles the pickles of a stored conversation again, for showing it after
196
+ * Compiles the jigs of a stored conversation again, for showing it after
197
197
  * a reload. Programs are rebuilt from each block's `source` here, never read
198
198
  * back from storage. Other parts and the metadata pass through as they are,
199
- * so a `StoredPickleUIMessage<Metadata>`, or the stored form of your own
200
- * message type, comes back with `PickleBlockData` in its `data-pickle` parts.
199
+ * so a `StoredJigsUIMessage<Metadata>`, or the stored form of your own
200
+ * message type, comes back with `JigsBlockData` in its `data-jigs` parts.
201
201
  */
202
- async function revivePickles(pickle, messages) {
202
+ async function reviveJigs(jigs, messages) {
203
203
  return await Promise.all(messages.map(async (message) => ({
204
204
  ...message,
205
205
  parts: await Promise.all(message.parts.map(async (part) => {
206
- if (part.type !== "data-pickle" || !("data" in part)) return part;
206
+ if (part.type !== "data-jigs" || !("data" in part)) return part;
207
207
  const stored = storedBlock.parse(part.data);
208
- const compiled = await pickle.compile(stored.source, { strict: false });
208
+ const compiled = await jigs.compile(stored.source, { strict: false });
209
209
  const data = {
210
210
  ...stored,
211
211
  diagnostics: compiled.diagnostics,
@@ -220,4 +220,4 @@ async function revivePickles(pickle, messages) {
220
220
  })));
221
221
  }
222
222
  //#endregion
223
- export { pickleChat, revivePickles };
223
+ export { jigsChat, reviveJigs };
package/dist/client.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { PickleBlockData, PickleDataTypes, PickleUIMessage, StoredPickleBlock, StoredPickleUIMessage, recentMessages, withoutPrograms } from "./stored.js";
2
- export { type PickleBlockData, type PickleDataTypes, type PickleUIMessage, type StoredPickleBlock, type StoredPickleUIMessage, recentMessages, withoutPrograms };
1
+ import { JigsBlockData, JigsDataTypes, JigsUIMessage, StoredJigsBlock, StoredJigsUIMessage, recentMessages, withoutPrograms } from "./stored.js";
2
+ export { type JigsBlockData, type JigsDataTypes, type JigsUIMessage, type StoredJigsBlock, type StoredJigsUIMessage, recentMessages, withoutPrograms };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { PickleBlockData, PickleDataTypes, PickleUIMessage, StoredPickleBlock, StoredPickleUIMessage, recentMessages, withoutPrograms } from "./stored.js";
2
- import { PickleChat, pickleChat, revivePickles } from "./chat.js";
1
+ import { JigsBlockData, JigsDataTypes, JigsUIMessage, StoredJigsBlock, StoredJigsUIMessage, recentMessages, withoutPrograms } from "./stored.js";
2
+ import { JigsChat, jigsChat, reviveJigs } from "./chat.js";
3
3
  import { ModelSettings, aiSdkModel, cachedInstructions } from "./model.js";
4
- import { pickleDataSchemas } from "./schemas.js";
5
- export { type ModelSettings, type PickleBlockData, type PickleChat, type PickleDataTypes, type PickleUIMessage, type StoredPickleBlock, type StoredPickleUIMessage, aiSdkModel, cachedInstructions, pickleChat, pickleDataSchemas, recentMessages, revivePickles, withoutPrograms };
4
+ import { jigsDataSchemas } from "./schemas.js";
5
+ export { type JigsBlockData, type JigsChat, type JigsDataTypes, type JigsUIMessage, type ModelSettings, type StoredJigsBlock, type StoredJigsUIMessage, aiSdkModel, cachedInstructions, jigsChat, jigsDataSchemas, recentMessages, reviveJigs, withoutPrograms };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { pickleDataSchemas } from "./schemas.js";
2
- import { pickleChat, revivePickles } from "./chat.js";
1
+ import { jigsDataSchemas } from "./schemas.js";
2
+ import { jigsChat, reviveJigs } from "./chat.js";
3
3
  import { aiSdkModel, cachedInstructions } from "./model.js";
4
4
  import { recentMessages, withoutPrograms } from "./stored.js";
5
- export { aiSdkModel, cachedInstructions, pickleChat, pickleDataSchemas, recentMessages, revivePickles, withoutPrograms };
5
+ export { aiSdkModel, cachedInstructions, jigsChat, jigsDataSchemas, recentMessages, reviveJigs, withoutPrograms };
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 `createPickleServer` from an AI SDK model: document-mode
15
+ * A `model` for `createJigsServer` 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 `createPickleServer` from an AI SDK model: document-mode
22
+ * A `model` for `createJigsServer` 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
@@ -1,13 +1,13 @@
1
1
  import { z } from "zod";
2
2
  //#region src/schemas.d.ts
3
3
  /**
4
- * Schemas for `validateUIMessages<StoredPickleUIMessage>({ messages,
4
+ * Schemas for `validateUIMessages<StoredJigsUIMessage>({ messages,
5
5
  * dataSchemas })`, to check a conversation the browser sent or one read
6
- * from storage. A pickle's program is dropped, never checked: the server
6
+ * from storage. A jig's program is dropped, never checked: the server
7
7
  * reads only `id` and `source`, and a source is only ever compiled.
8
8
  */
9
- export declare const pickleDataSchemas: {
10
- pickle: z.ZodObject<{
9
+ export declare const jigsDataSchemas: {
10
+ jigs: z.ZodObject<{
11
11
  diagnostics: z.ZodArray<z.ZodObject<{
12
12
  code: z.ZodString;
13
13
  fix: z.ZodExactOptional<z.ZodObject<{
package/dist/schemas.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { pickleErrorCodes } from "@jigs.design/runtime";
2
+ import { jigsErrorCodes } from "@jigs.design/runtime";
3
3
  //#region src/schemas.ts
4
4
  const span = z.object({
5
5
  column: z.number().exactOptional(),
@@ -27,7 +27,7 @@ const storedBlock = z.object({
27
27
  span
28
28
  })),
29
29
  error: z.object({
30
- code: z.enum(pickleErrorCodes),
30
+ code: z.enum(jigsErrorCodes),
31
31
  message: z.string()
32
32
  }).exactOptional(),
33
33
  id: z.string(),
@@ -41,11 +41,11 @@ const storedBlock = z.object({
41
41
  version: z.number()
42
42
  });
43
43
  /**
44
- * Schemas for `validateUIMessages<StoredPickleUIMessage>({ messages,
44
+ * Schemas for `validateUIMessages<StoredJigsUIMessage>({ messages,
45
45
  * dataSchemas })`, to check a conversation the browser sent or one read
46
- * from storage. A pickle's program is dropped, never checked: the server
46
+ * from storage. A jig's program is dropped, never checked: the server
47
47
  * reads only `id` and `source`, and a source is only ever compiled.
48
48
  */
49
- const pickleDataSchemas = { pickle: storedBlock };
49
+ const jigsDataSchemas = { jigs: storedBlock };
50
50
  //#endregion
51
- export { pickleDataSchemas, storedBlock };
51
+ export { jigsDataSchemas, storedBlock };
package/dist/stored.d.ts CHANGED
@@ -1,55 +1,55 @@
1
1
  import { ChatBlock } from "@jigs.design/runtime";
2
2
  import { UIMessage } from "ai";
3
3
  //#region src/stored.d.ts
4
- /** A pickle's `data-pickle` part: one fenced block of a reply, compiled. */
5
- export type PickleBlockData = ChatBlock;
4
+ /** A jig's `data-jigs` part: one fenced block of a reply, compiled. */
5
+ export type JigsBlockData = ChatBlock;
6
6
  /**
7
- * A pickle as the browser sends it back and as you store it: everything but
8
- * the program. Only `revivePickles` turns it back into a `PickleBlockData`,
7
+ * A jig as the browser sends it back and as you store it: everything but
8
+ * the program. Only `reviveJigs` turns it back into a `JigsBlockData`,
9
9
  * by compiling `source` again.
10
10
  */
11
- export type StoredPickleBlock = Omit<PickleBlockData, "program">;
11
+ export type StoredJigsBlock = Omit<JigsBlockData, "program">;
12
12
  /**
13
13
  * The data parts chat mode adds to a message. A type, not an interface: the
14
14
  * AI SDK's data types need an implicit index signature.
15
15
  */
16
- export type PickleDataTypes = {
17
- pickle: PickleBlockData;
16
+ export type JigsDataTypes = {
17
+ jigs: JigsBlockData;
18
18
  };
19
- /** A `useChat` message whose replies may hold pickles. */
20
- export type PickleUIMessage<TMetadata = unknown> = UIMessage<TMetadata, PickleDataTypes>;
19
+ /** A `useChat` message whose replies may hold jigs. */
20
+ export type JigsUIMessage<TMetadata = unknown> = UIMessage<TMetadata, JigsDataTypes>;
21
21
  /**
22
- * A conversation as the server receives it and as you store it: its pickles
23
- * carry no programs. `validateUIMessages` with `pickleDataSchemas` returns
22
+ * A conversation as the server receives it and as you store it: its jigs
23
+ * carry no programs. `validateUIMessages` with `jigsDataSchemas` returns
24
24
  * this shape.
25
25
  */
26
- export type StoredPickleUIMessage<TMetadata = unknown> = UIMessage<TMetadata, {
27
- pickle: StoredPickleBlock;
26
+ export type StoredJigsUIMessage<TMetadata = unknown> = UIMessage<TMetadata, {
27
+ jigs: StoredJigsBlock;
28
28
  }>;
29
- /** A message part, with a `data-pickle` part's data replaced by `TBlock`. */
29
+ /** A message part, with a `data-jigs` part's data replaced by `TBlock`. */
30
30
  type WithBlock<TPart, TBlock> = TPart extends {
31
- type: "data-pickle";
31
+ type: "data-jigs";
32
32
  } ? Omit<TPart, "data"> & {
33
33
  data: TBlock;
34
34
  } : TPart;
35
35
  /**
36
- * `TMessage` with each pickle's data replaced by `TBlock`, and every other
36
+ * `TMessage` with each jig's data replaced by `TBlock`, and every other
37
37
  * part, the metadata included, as it was.
38
38
  */
39
- export type WithPickleBlocks<TMessage extends UIMessage, TBlock> = Omit<TMessage, "parts"> & {
39
+ export type WithJigsBlocks<TMessage extends UIMessage, TBlock> = Omit<TMessage, "parts"> & {
40
40
  parts: Array<WithBlock<TMessage["parts"][number], TBlock>>;
41
41
  };
42
42
  /**
43
- * The messages without their pickles' programs: for the body `useChat`
43
+ * The messages without their jigs' programs: for the body `useChat`
44
44
  * posts (`prepareSendMessagesRequest`), and for storing a conversation. The
45
45
  * server reads only each block's `id` and `source`. Every other part, and
46
46
  * every other field of a block, is kept as it is.
47
47
  */
48
- export declare function withoutPrograms<TMessage extends UIMessage>(messages: ReadonlyArray<TMessage>): Array<WithPickleBlocks<TMessage, StoredPickleBlock>>;
48
+ export declare function withoutPrograms<TMessage extends UIMessage>(messages: ReadonlyArray<TMessage>): Array<WithJigsBlocks<TMessage, StoredJigsBlock>>;
49
49
  /**
50
50
  * The end of a long conversation, for the body `useChat` posts: the last
51
- * `keep` messages, from a user message on. Every earlier pickle comes first,
52
- * in one assistant message of their `data-pickle` parts, so the model still
51
+ * `keep` messages, from a user message on. Every earlier jig comes first,
52
+ * in one assistant message of their `data-jigs` parts, so the model still
53
53
  * sees each one and edits and versions continue from them; earlier prose is
54
54
  * left out. A conversation no longer than `keep` is returned as it is.
55
55
  */
package/dist/stored.js CHANGED
@@ -1,10 +1,10 @@
1
1
  //#region src/stored.ts
2
- /** Whether `part` is a pickle whose block still holds its program. */
2
+ /** Whether `part` is a jig whose block still holds its program. */
3
3
  function hasProgram(part) {
4
- return part.type === "data-pickle" && "data" in part && typeof part.data === "object" && part.data !== null && "program" in part.data;
4
+ return part.type === "data-jigs" && "data" in part && typeof part.data === "object" && part.data !== null && "program" in part.data;
5
5
  }
6
6
  /**
7
- * The messages without their pickles' programs: for the body `useChat`
7
+ * The messages without their jigs' programs: for the body `useChat`
8
8
  * posts (`prepareSendMessagesRequest`), and for storing a conversation. The
9
9
  * server reads only each block's `id` and `source`. Every other part, and
10
10
  * every other field of a block, is kept as it is.
@@ -26,8 +26,8 @@ function withoutPrograms(messages) {
26
26
  const RECENT = 20;
27
27
  /**
28
28
  * The end of a long conversation, for the body `useChat` posts: the last
29
- * `keep` messages, from a user message on. Every earlier pickle comes first,
30
- * in one assistant message of their `data-pickle` parts, so the model still
29
+ * `keep` messages, from a user message on. Every earlier jig comes first,
30
+ * in one assistant message of their `data-jigs` parts, so the model still
31
31
  * sees each one and edits and versions continue from them; earlier prose is
32
32
  * left out. A conversation no longer than `keep` is returned as it is.
33
33
  */
@@ -37,13 +37,13 @@ function recentMessages(messages, keep = RECENT) {
37
37
  const nextUser = messages.findIndex((message, index) => index >= start && message.role === "user");
38
38
  if (nextUser !== -1) start = nextUser;
39
39
  const earlier = messages.slice(0, start).filter((message) => message.role === "assistant");
40
- const pickles = earlier.flatMap((message) => message.parts.filter((part) => part.type === "data-pickle"));
40
+ const jigs = earlier.flatMap((message) => message.parts.filter((part) => part.type === "data-jigs"));
41
41
  const recent = messages.slice(start);
42
42
  const [first] = earlier;
43
- if (first === void 0 || pickles.length === 0) return recent;
43
+ if (first === void 0 || jigs.length === 0) return recent;
44
44
  return [{
45
45
  ...first,
46
- parts: pickles
46
+ parts: jigs
47
47
  }, ...recent];
48
48
  }
49
49
  //#endregion
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@jigs.design/ai-sdk",
3
- "version": "0.1.0",
4
- "description": "Pickle on the AI SDK: a model function for createPickleServer, and chat mode for useChat.",
3
+ "version": "0.1.2",
4
+ "description": "Jigs on the AI SDK: a model function for createJigsServer, and chat mode for useChat.",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
8
- "url": "git+https://github.com/yoamomonstruos/pickle.git",
8
+ "url": "git+https://github.com/yoamomonstruos/jigs.git",
9
9
  "directory": "packages/ai-sdk"
10
10
  },
11
11
  "type": "module",
@@ -29,8 +29,8 @@
29
29
  "access": "public"
30
30
  },
31
31
  "dependencies": {
32
- "@jigs.design/server": "0.1.0",
33
- "@jigs.design/runtime": "0.1.0"
32
+ "@jigs.design/runtime": "0.1.2",
33
+ "@jigs.design/server": "0.1.2"
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/host": "0.1.0",
44
- "@jigs.design/catalog": "0.1.0"
43
+ "@jigs.design/catalog": "0.1.2",
44
+ "@jigs.design/host": "0.1.2"
45
45
  }
46
46
  }