@base44-preview/sdk 0.8.32-pr.205.36088fe → 0.8.32-pr.205.c20240d
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/dist/index.d.ts +1 -1
- package/dist/modules/agents/agents.types.d.ts +15 -3
- package/dist/modules/agents/gateway.d.ts +9 -0
- package/dist/modules/agents/provider.d.ts +1 -3
- package/dist/modules/agents/providers/openai-compatible.d.ts +1 -6
- package/dist/modules/entities.types.d.ts +3 -2
- package/dist/modules/functions.types.d.ts +16 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -14,5 +14,5 @@ export type { AppLogsModule } from "./modules/app-logs.types.js";
|
|
|
14
14
|
export type { SsoModule, SsoAccessTokenResponse } from "./modules/sso.types.js";
|
|
15
15
|
export type { ConnectorsModule, UserConnectorsModule, } from "./modules/connectors.types.js";
|
|
16
16
|
export type { CustomIntegrationsModule, CustomIntegrationCallParams, CustomIntegrationCallResponse, } from "./modules/custom-integrations.types.js";
|
|
17
|
-
export type { Tool, JSONSchema, ChatMessage, Step, RunUsage, RunResult, RunInput, RunOptions, ToolChoice, AgentConfig, Agent, } from "./modules/agents/agents.types.js";
|
|
17
|
+
export type { Tool, JSONSchema, ChatMessage, Step, RunUsage, RunResult, RunInput, RunOptions, ToolChoice, AgentConfig, Agent, FinishReason, } from "./modules/agents/agents.types.js";
|
|
18
18
|
export type { GetAccessTokenOptions, SaveAccessTokenOptions, RemoveAccessTokenOptions, GetLoginUrlOptions, } from "./utils/auth-utils.types.js";
|
|
@@ -18,7 +18,12 @@ export interface Tool {
|
|
|
18
18
|
/** Runs the tool. Receives parsed arguments; returns any JSON-serializable value (or a string). */
|
|
19
19
|
execute: (args: any) => Promise<unknown> | unknown;
|
|
20
20
|
}
|
|
21
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Why the agent run ended.
|
|
23
|
+
* `"max_steps"` is set by the SDK when the step cap is hit; all other values come from the model/normalization layer.
|
|
24
|
+
*/
|
|
25
|
+
export type FinishReason = "stop" | "length" | "tool-calls" | "content-filter" | "error" | "other";
|
|
26
|
+
/** An OpenAI-shaped chat message accepted by {@linkcode Agent.run}. */
|
|
22
27
|
export interface ChatMessage {
|
|
23
28
|
role: "system" | "user" | "assistant" | "tool";
|
|
24
29
|
content?: string | null;
|
|
@@ -56,8 +61,12 @@ export interface RunResult {
|
|
|
56
61
|
text: string;
|
|
57
62
|
/** The loop history (one entry per step that made tool calls). */
|
|
58
63
|
steps: Step[];
|
|
59
|
-
/**
|
|
60
|
-
|
|
64
|
+
/**
|
|
65
|
+
* Why the run ended.
|
|
66
|
+
* Values come from the model/normalization layer (`"stop"`, `"length"`, `"tool-calls"`, `"content-filter"`, `"error"`, `"other"`)
|
|
67
|
+
* or from the SDK itself (`"max_steps"`, set when the step cap is reached).
|
|
68
|
+
*/
|
|
69
|
+
finishReason: FinishReason | "max_steps";
|
|
61
70
|
/** Token and credit usage from the final completion. */
|
|
62
71
|
usage: RunUsage;
|
|
63
72
|
/** Summed across all model calls in the loop; `usage` is the final call only. */
|
|
@@ -167,6 +176,7 @@ export interface AgentConfig {
|
|
|
167
176
|
* When set, the request is sent with `response_format: { type: "json_schema", … }`.
|
|
168
177
|
* The model's response will be valid JSON matching the schema; access it by parsing
|
|
169
178
|
* `RunResult.text`.
|
|
179
|
+
* The schema is sent with strict JSON-schema mode, so it should have `additionalProperties: false` and list every property in `required` (otherwise the provider may reject it).
|
|
170
180
|
*
|
|
171
181
|
* @example
|
|
172
182
|
* ```typescript
|
|
@@ -275,6 +285,8 @@ export interface Agent {
|
|
|
275
285
|
* @param opts.name - Optional display name for the tool. Defaults to the
|
|
276
286
|
* agent config's model alias when omitted.
|
|
277
287
|
* @returns A {@linkcode Tool} that can be passed in another agent's `tools` map.
|
|
288
|
+
* @note The sub-agent runs independently — the parent's `abortSignal` is not propagated and
|
|
289
|
+
* the sub-agent's token/credit usage is not included in the parent's `totalUsage`.
|
|
278
290
|
*
|
|
279
291
|
* @example
|
|
280
292
|
* ```typescript
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal transport shape used by provider adapters to send completions requests.
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export type GatewayTransport = {
|
|
6
|
+
complete(body: Record<string, unknown>, opts?: {
|
|
7
|
+
signal?: AbortSignal;
|
|
8
|
+
}): Promise<unknown>;
|
|
9
|
+
};
|
|
1
10
|
/** @internal */
|
|
2
11
|
export interface GatewayConfig {
|
|
3
12
|
serverUrl: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Tool, ToolChoice, JSONSchema, RunUsage } from "./agents.types.js";
|
|
1
|
+
import type { Tool, ToolChoice, JSONSchema, RunUsage, FinishReason } from "./agents.types.js";
|
|
2
2
|
/** A parsed tool call the model wants to make. Args are already parsed (object), never a JSON string. @internal */
|
|
3
3
|
export interface ModelToolCall {
|
|
4
4
|
id: string;
|
|
@@ -26,8 +26,6 @@ export type ModelMessage = {
|
|
|
26
26
|
toolName?: string;
|
|
27
27
|
result: string;
|
|
28
28
|
};
|
|
29
|
-
/** Finish reasons normalized across providers. @internal */
|
|
30
|
-
export type FinishReason = "stop" | "length" | "tool-calls" | "content-filter" | "error" | "other";
|
|
31
29
|
/** A request to a language model. @internal */
|
|
32
30
|
export interface GenerateRequest {
|
|
33
31
|
model: string;
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import type { LanguageModel } from "../provider.js";
|
|
2
|
-
|
|
3
|
-
complete(body: Record<string, unknown>, opts?: {
|
|
4
|
-
signal?: AbortSignal;
|
|
5
|
-
}): Promise<any>;
|
|
6
|
-
}
|
|
2
|
+
import type { GatewayTransport } from "../gateway.js";
|
|
7
3
|
/**
|
|
8
4
|
* OpenAI-compatible provider: speaks the Chat Completions wire format over the Base44
|
|
9
5
|
* gateway transport.
|
|
10
6
|
* @internal
|
|
11
7
|
*/
|
|
12
8
|
export declare function openAICompatibleProvider(transport: GatewayTransport): LanguageModel;
|
|
13
|
-
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Tool } from "./agents/agents.types.js";
|
|
1
2
|
/**
|
|
2
3
|
* Event types for realtime entity updates.
|
|
3
4
|
*/
|
|
@@ -646,7 +647,7 @@ export interface EntityHandler<T = any> {
|
|
|
646
647
|
* Read-only by default, pass `operations` to opt into writes. Spread the result into an agent's `tools`.
|
|
647
648
|
*
|
|
648
649
|
* @param opts - Optional `operations` (`"read" | "create" | "update" | "delete"`, default `["read"]`).
|
|
649
|
-
* @returns A map of tool-name
|
|
650
|
+
* @returns A map of tool-name to {@linkcode Tool}. Keys follow the pattern `read_<EntityName>`, `create_<EntityName>`, `update_<EntityName>`, `delete_<EntityName>`.
|
|
650
651
|
*
|
|
651
652
|
* @example
|
|
652
653
|
* ```typescript
|
|
@@ -658,7 +659,7 @@ export interface EntityHandler<T = any> {
|
|
|
658
659
|
*/
|
|
659
660
|
asTool(opts?: {
|
|
660
661
|
operations?: ("read" | "create" | "update" | "delete")[];
|
|
661
|
-
}): Record<string,
|
|
662
|
+
}): Record<string, Tool>;
|
|
662
663
|
}
|
|
663
664
|
/**
|
|
664
665
|
* Typed entities module - maps registry keys to typed handlers (full record type).
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Tool } from "./agents/agents.types.js";
|
|
1
2
|
/**
|
|
2
3
|
* Registry of function names. The [`types generate`](/developers/references/cli/commands/types-generate) command fills this registry, then [`FunctionName`](#functionname) resolves to a union of the keys.
|
|
3
4
|
*/
|
|
@@ -94,11 +95,25 @@ export interface FunctionsModule {
|
|
|
94
95
|
*
|
|
95
96
|
* @param name - The backend function name.
|
|
96
97
|
* @param opts - `description` (required) and optional JSON Schema `parameters`.
|
|
98
|
+
* @returns A {@linkcode Tool} for use in an agent's `tools` map.
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```typescript
|
|
102
|
+
* const emailTool = base44.functions.asTool("sendOrderEmail", {
|
|
103
|
+
* description: "Send an order confirmation email to the customer.",
|
|
104
|
+
* parameters: {
|
|
105
|
+
* type: "object",
|
|
106
|
+
* properties: { orderId: { type: "string" } },
|
|
107
|
+
* required: ["orderId"],
|
|
108
|
+
* },
|
|
109
|
+
* });
|
|
110
|
+
* const agent = base44.agents.create({ model: "claude_sonnet_4_6", tools: { emailTool } });
|
|
111
|
+
* ```
|
|
97
112
|
*/
|
|
98
113
|
asTool(name: FunctionName, opts: {
|
|
99
114
|
description: string;
|
|
100
115
|
parameters?: Record<string, unknown>;
|
|
101
|
-
}):
|
|
116
|
+
}): Tool;
|
|
102
117
|
/**
|
|
103
118
|
* Performs a direct HTTP request to a backend function path and returns the native `Response`.
|
|
104
119
|
*
|