@orpc/ai-sdk 2.0.0-beta.22 → 2.0.0-beta.24

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
@@ -44,6 +44,7 @@ You can read the documentation [here](https://orpc.dev).
44
44
 
45
45
  - [@orpc/publisher](https://www.npmjs.com/package/@orpc/publisher): Pub/Sub with memory, Redis, and Upstash adapters.
46
46
  - [@orpc/ratelimit](https://www.npmjs.com/package/@orpc/ratelimit): Rate limiting with memory, Redis, and Upstash adapters.
47
+ - [@orpc/hibernation](https://www.npmjs.com/package/@orpc/hibernation): Leverage Hibernation APIs like [Cloudflare's Hibernation WebSocket](https://developers.cloudflare.com/durable-objects/best-practices/websockets/#durable-objects-hibernation-websocket-api).
47
48
  - [@orpc/json-schema](https://www.npmjs.com/package/@orpc/json-schema): Smart coercion for OpenAPI requests.
48
49
 
49
50
  **Framework & ecosystem integrations**
@@ -114,6 +115,7 @@ Like what we build over at [middleapi](https://github.com/middleapi)? You can he
114
115
  </tr>
115
116
  <tr>
116
117
  <td align="center"><a href="https://github.com/itigoore01?ref=orpc" target="_blank" rel="noopener" title="shota"><img src="https://avatars.githubusercontent.com/u/11831107?u=c976a6dc7e055eb026304c46c99100ed22b0c8e0&amp;v=4" width="139" alt="shota"/><br />shota</a></td>
118
+ <td align="center"><a href="https://github.com/ellis-driscoll?ref=orpc" target="_blank" rel="noopener" title="Ellis Driscoll"><img src="https://avatars.githubusercontent.com/u/70685966?u=c5f95bc33b5991d9744abe00052542e4a2ed3cb9&amp;v=4" width="139" alt="Ellis Driscoll"/><br />Ellis Driscoll</a></td>
117
119
  </tr>
118
120
  </table>
119
121
 
@@ -139,8 +141,9 @@ Like what we build over at [middleapi](https://github.com/middleapi)? You can he
139
141
  <td align="center"><a href="https://github.com/mr-kelly?ref=orpc" target="_blank" rel="noopener" title="Kelly Peilin Chan"><img src="https://avatars.githubusercontent.com/u/520852?u=6b0f7105f694e7b5cacf410a3f04c7044b469dc8&amp;v=4" width="119" alt="Kelly Peilin Chan"/><br />Kelly Peilin Chan</a></td>
140
142
  </tr>
141
143
  <tr>
144
+ <td align="center"><a href="https://github.com/guyariely?ref=orpc" target="_blank" rel="noopener" title="Guy Ariely"><img src="https://avatars.githubusercontent.com/u/42813496?u=edb6b7f563bf28e160a290832e7da57c0506f8ca&amp;v=4" width="119" alt="Guy Ariely"/><br />Guy Ariely</a></td>
142
145
  <td align="center"><a href="https://github.com/piscis?ref=orpc" target="_blank" rel="noopener" title="Alex"><img src="https://avatars.githubusercontent.com/u/326163?u=b245f368bd940cf51d08c0b6bf55f8257f359437&amp;v=4" width="119" alt="Alex"/><br />Alex</a></td>
143
- <td align="center"><a href="https://github.com/finom?ref=orpc" target="_blank" rel="noopener" title="Andrey Gubanov"><img src="https://avatars.githubusercontent.com/u/1082083?u=29e91400dbd4a9c217048a8f59562c4f740498e6&amp;v=4" width="119" alt="Andrey Gubanov"/><br />Andrey Gubanov</a></td>
146
+ <td align="center"><a href="https://github.com/finom?ref=orpc" target="_blank" rel="noopener" title="Andrey Gubanov"><img src="https://avatars.githubusercontent.com/u/1082083?u=c5f2daf7ebece498e85c83367bb37b4e10e2649d&amp;v=4" width="119" alt="Andrey Gubanov"/><br />Andrey Gubanov</a></td>
144
147
  </tr>
145
148
  </table>
146
149
 
package/dist/index.d.mts CHANGED
@@ -15,9 +15,10 @@ type FunctionTool<INPUT extends JSONValue | unknown | never = any, OUTPUT extend
15
15
  * Base [AI SDK Tool](https://ai-sdk.dev/docs/foundations/tools) options attached to a procedure/contract,
16
16
  * used as defaults when creating tools from it.
17
17
  *
18
+ * @remarks
18
19
  * **Note**: When defined multiple times, options are overridden by the most recent call.
19
20
  *
20
- * @see {@link https://orpc.dev/docs/integrations/ai-sdk#tool-implementer AI SDK Tool Implementer Docs}
21
+ * @see {@link https://orpc.dev/docs/integrations/ai-sdk#tool-implementer | AI SDK Integration - Tool Implementer}
21
22
  */
22
23
  type AiSdkToolMeta<TInputSchema extends AnySchema = AnySchema, TOutputSchema extends AnySchema = AnySchema> = Partial<Omit<FunctionTool<InferSchemaOutput<TInputSchema>, ToolOutput<InferSchemaInput<TOutputSchema>>>, 'inputSchema' | 'outputSchema' | 'execute'>>;
23
24
  interface AiSdkToolMetaPlugin<TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> extends MetaPlugin<TInputSchema, TOutputSchema, TErrorMap> {
@@ -30,10 +31,9 @@ interface AiSdkToolFunction {
30
31
  * Attaches base [AI SDK Tool](https://ai-sdk.dev/docs/foundations/tools) options to a procedure/contract,
31
32
  * used as defaults when creating tools from it.
32
33
  *
34
+ * @remarks
33
35
  * **Note**: When defined multiple times, options are overridden by the most recent call.
34
36
  *
35
- * @see {@link https://orpc.dev/docs/integrations/ai-sdk#tool-implementer AI SDK Tool Implementer Docs}
36
- *
37
37
  * @example
38
38
  * ```ts
39
39
  * const getWeatherContract = oc
@@ -43,13 +43,15 @@ interface AiSdkToolFunction {
43
43
  * }))
44
44
  * .input(z.object({ location: z.string() }))
45
45
  * ```
46
+ *
47
+ * @see {@link https://orpc.dev/docs/integrations/ai-sdk#tool-implementer | AI SDK Integration - Tool Implementer}
46
48
  */
47
49
  declare const aiSdkTool: AiSdkToolFunction;
48
50
  /**
49
51
  * Reads the base [AI SDK Tool](https://ai-sdk.dev/docs/foundations/tools) options
50
52
  * attached to a procedure/contract by {@link aiSdkTool}.
51
53
  *
52
- * @see {@link https://orpc.dev/docs/integrations/ai-sdk#tool-implementer AI SDK Tool Implementer Docs}
54
+ * @see {@link https://orpc.dev/docs/integrations/ai-sdk#tool-implementer | AI SDK Integration - Tool Implementer}
53
55
  */
54
56
  declare function getAiSdkToolMeta(procedureOrLazy: AnyProcedureContract | Lazy<any>): AiSdkToolMeta | undefined;
55
57
 
@@ -60,7 +62,7 @@ declare function getAiSdkToolMeta(procedureOrLazy: AnyProcedureContract | Lazy<a
60
62
  * each yielded event as a [preliminary result](https://ai-sdk.dev/docs/ai-sdk-core/tools-and-tool-calling#preliminary-tool-results)
61
63
  * and the last event becomes the final result, so the tool output is the yield type.
62
64
  *
63
- * @see {@link https://orpc.dev/docs/integrations/ai-sdk#streaming-tool-outputs AI SDK Streaming Tool Outputs Docs}
65
+ * @see {@link https://orpc.dev/docs/integrations/ai-sdk#streaming-tool-outputs | AI SDK Integration - Streaming Tool Outputs}
64
66
  */
65
67
  type ToolOutput<T> = T extends AsyncIteratorObject<infer TYield, any, any> ? TYield : T;
66
68
  interface ImplementToolFactoryOptions {
@@ -75,8 +77,8 @@ interface ToolImplementer {
75
77
  * The factory accepts oRPC related options, and the resulting builder
76
78
  * accepts a contract alongside AI SDK tool options.
77
79
  *
78
- * @info [procedures](https://orpc.dev/docs/procedure) are also compatible with [procedure contracts](https://orpc.dev/docs/contract/procedure).
79
- * @see {@link https://orpc.dev/docs/integrations/ai-sdk#tool-implementer AI SDK Tool Implementer Docs}
80
+ * @remarks
81
+ * **Note**: [Procedures](https://orpc.dev/docs/procedure) are also compatible with [procedure contracts](https://orpc.dev/docs/contract/procedure).
80
82
  *
81
83
  * @example
82
84
  * ```ts
@@ -108,6 +110,8 @@ interface ToolImplementer {
108
110
  * }),
109
111
  * })
110
112
  * ```
113
+ *
114
+ * @see {@link https://orpc.dev/docs/integrations/ai-sdk#tool-implementer | AI SDK Integration - Tool Implementer}
111
115
  */
112
116
  declare function implementToolFactory(_options?: ImplementToolFactoryOptions): ToolImplementer;
113
117
  type CreateToolFactoryOptions<TInitialContext extends Context> = ImplementToolFactoryOptions & ProcedureClientOptions<TInitialContext, Schema<unknown>, object, never, object> & Omit<ClientOptions<object>, 'context'>;
@@ -121,8 +125,6 @@ interface ToolFactory<TInitialContext extends Context> {
121
125
  * The factory accepts oRPC related options, and the resulting builder
122
126
  * accepts a procedure alongside AI SDK tool options.
123
127
  *
124
- * @see {@link https://orpc.dev/docs/integrations/ai-sdk#tool-factory AI SDK Tool Factory Docs}
125
- *
126
128
  * @example
127
129
  * ```ts
128
130
  * import { aiSdkTool, createToolFactory } from '@orpc/ai-sdk'
@@ -152,6 +154,8 @@ interface ToolFactory<TInitialContext extends Context> {
152
154
  * // ...AI SDK tool options/overrides here if needed
153
155
  * })
154
156
  * ```
157
+ *
158
+ * @see {@link https://orpc.dev/docs/integrations/ai-sdk#tool-factory | AI SDK Integration - Tool Factory}
155
159
  */
156
160
  declare function createToolFactory<TInitialContext extends Context = object>(...rest: MaybeOptionalOptions<CreateToolFactoryOptions<TInitialContext>>): ToolFactory<TInitialContext>;
157
161
 
package/dist/index.d.ts CHANGED
@@ -15,9 +15,10 @@ type FunctionTool<INPUT extends JSONValue | unknown | never = any, OUTPUT extend
15
15
  * Base [AI SDK Tool](https://ai-sdk.dev/docs/foundations/tools) options attached to a procedure/contract,
16
16
  * used as defaults when creating tools from it.
17
17
  *
18
+ * @remarks
18
19
  * **Note**: When defined multiple times, options are overridden by the most recent call.
19
20
  *
20
- * @see {@link https://orpc.dev/docs/integrations/ai-sdk#tool-implementer AI SDK Tool Implementer Docs}
21
+ * @see {@link https://orpc.dev/docs/integrations/ai-sdk#tool-implementer | AI SDK Integration - Tool Implementer}
21
22
  */
22
23
  type AiSdkToolMeta<TInputSchema extends AnySchema = AnySchema, TOutputSchema extends AnySchema = AnySchema> = Partial<Omit<FunctionTool<InferSchemaOutput<TInputSchema>, ToolOutput<InferSchemaInput<TOutputSchema>>>, 'inputSchema' | 'outputSchema' | 'execute'>>;
23
24
  interface AiSdkToolMetaPlugin<TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> extends MetaPlugin<TInputSchema, TOutputSchema, TErrorMap> {
@@ -30,10 +31,9 @@ interface AiSdkToolFunction {
30
31
  * Attaches base [AI SDK Tool](https://ai-sdk.dev/docs/foundations/tools) options to a procedure/contract,
31
32
  * used as defaults when creating tools from it.
32
33
  *
34
+ * @remarks
33
35
  * **Note**: When defined multiple times, options are overridden by the most recent call.
34
36
  *
35
- * @see {@link https://orpc.dev/docs/integrations/ai-sdk#tool-implementer AI SDK Tool Implementer Docs}
36
- *
37
37
  * @example
38
38
  * ```ts
39
39
  * const getWeatherContract = oc
@@ -43,13 +43,15 @@ interface AiSdkToolFunction {
43
43
  * }))
44
44
  * .input(z.object({ location: z.string() }))
45
45
  * ```
46
+ *
47
+ * @see {@link https://orpc.dev/docs/integrations/ai-sdk#tool-implementer | AI SDK Integration - Tool Implementer}
46
48
  */
47
49
  declare const aiSdkTool: AiSdkToolFunction;
48
50
  /**
49
51
  * Reads the base [AI SDK Tool](https://ai-sdk.dev/docs/foundations/tools) options
50
52
  * attached to a procedure/contract by {@link aiSdkTool}.
51
53
  *
52
- * @see {@link https://orpc.dev/docs/integrations/ai-sdk#tool-implementer AI SDK Tool Implementer Docs}
54
+ * @see {@link https://orpc.dev/docs/integrations/ai-sdk#tool-implementer | AI SDK Integration - Tool Implementer}
53
55
  */
54
56
  declare function getAiSdkToolMeta(procedureOrLazy: AnyProcedureContract | Lazy<any>): AiSdkToolMeta | undefined;
55
57
 
@@ -60,7 +62,7 @@ declare function getAiSdkToolMeta(procedureOrLazy: AnyProcedureContract | Lazy<a
60
62
  * each yielded event as a [preliminary result](https://ai-sdk.dev/docs/ai-sdk-core/tools-and-tool-calling#preliminary-tool-results)
61
63
  * and the last event becomes the final result, so the tool output is the yield type.
62
64
  *
63
- * @see {@link https://orpc.dev/docs/integrations/ai-sdk#streaming-tool-outputs AI SDK Streaming Tool Outputs Docs}
65
+ * @see {@link https://orpc.dev/docs/integrations/ai-sdk#streaming-tool-outputs | AI SDK Integration - Streaming Tool Outputs}
64
66
  */
65
67
  type ToolOutput<T> = T extends AsyncIteratorObject<infer TYield, any, any> ? TYield : T;
66
68
  interface ImplementToolFactoryOptions {
@@ -75,8 +77,8 @@ interface ToolImplementer {
75
77
  * The factory accepts oRPC related options, and the resulting builder
76
78
  * accepts a contract alongside AI SDK tool options.
77
79
  *
78
- * @info [procedures](https://orpc.dev/docs/procedure) are also compatible with [procedure contracts](https://orpc.dev/docs/contract/procedure).
79
- * @see {@link https://orpc.dev/docs/integrations/ai-sdk#tool-implementer AI SDK Tool Implementer Docs}
80
+ * @remarks
81
+ * **Note**: [Procedures](https://orpc.dev/docs/procedure) are also compatible with [procedure contracts](https://orpc.dev/docs/contract/procedure).
80
82
  *
81
83
  * @example
82
84
  * ```ts
@@ -108,6 +110,8 @@ interface ToolImplementer {
108
110
  * }),
109
111
  * })
110
112
  * ```
113
+ *
114
+ * @see {@link https://orpc.dev/docs/integrations/ai-sdk#tool-implementer | AI SDK Integration - Tool Implementer}
111
115
  */
112
116
  declare function implementToolFactory(_options?: ImplementToolFactoryOptions): ToolImplementer;
113
117
  type CreateToolFactoryOptions<TInitialContext extends Context> = ImplementToolFactoryOptions & ProcedureClientOptions<TInitialContext, Schema<unknown>, object, never, object> & Omit<ClientOptions<object>, 'context'>;
@@ -121,8 +125,6 @@ interface ToolFactory<TInitialContext extends Context> {
121
125
  * The factory accepts oRPC related options, and the resulting builder
122
126
  * accepts a procedure alongside AI SDK tool options.
123
127
  *
124
- * @see {@link https://orpc.dev/docs/integrations/ai-sdk#tool-factory AI SDK Tool Factory Docs}
125
- *
126
128
  * @example
127
129
  * ```ts
128
130
  * import { aiSdkTool, createToolFactory } from '@orpc/ai-sdk'
@@ -152,6 +154,8 @@ interface ToolFactory<TInitialContext extends Context> {
152
154
  * // ...AI SDK tool options/overrides here if needed
153
155
  * })
154
156
  * ```
157
+ *
158
+ * @see {@link https://orpc.dev/docs/integrations/ai-sdk#tool-factory | AI SDK Integration - Tool Factory}
155
159
  */
156
160
  declare function createToolFactory<TInitialContext extends Context = object>(...rest: MaybeOptionalOptions<CreateToolFactoryOptions<TInitialContext>>): ToolFactory<TInitialContext>;
157
161
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orpc/ai-sdk",
3
3
  "type": "module",
4
- "version": "2.0.0-beta.22",
4
+ "version": "2.0.0-beta.24",
5
5
  "license": "MIT",
6
6
  "homepage": "https://orpc.dev",
7
7
  "repository": {
@@ -29,14 +29,14 @@
29
29
  "ai": ">=7.0.31"
30
30
  },
31
31
  "dependencies": {
32
- "@orpc/contract": "2.0.0-beta.22",
33
- "@orpc/json-schema": "2.0.0-beta.22",
34
- "@orpc/server": "2.0.0-beta.22",
35
- "@orpc/shared": "2.0.0-beta.22",
36
- "@orpc/client": "2.0.0-beta.22"
32
+ "@orpc/client": "2.0.0-beta.24",
33
+ "@orpc/json-schema": "2.0.0-beta.24",
34
+ "@orpc/server": "2.0.0-beta.24",
35
+ "@orpc/shared": "2.0.0-beta.24",
36
+ "@orpc/contract": "2.0.0-beta.24"
37
37
  },
38
38
  "devDependencies": {
39
- "ai": "^7.0.37",
39
+ "ai": "^7.0.42",
40
40
  "zod": "^4.4.3"
41
41
  },
42
42
  "scripts": {