@botpress/adk-cli 1.11.7 → 1.11.9
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/cli.js +1388 -145
- package/dist/commands.json +2 -2
- package/package.json +3 -3
- package/dist/CLAUDE.template.md +0 -1260
package/dist/cli.js
CHANGED
|
@@ -348574,7 +348574,7 @@ var init_internal = __esm(() => {
|
|
|
348574
348574
|
});
|
|
348575
348575
|
init_define_PACKAGE_VERSIONS = __esm2({
|
|
348576
348576
|
"<define:__PACKAGE_VERSIONS__>"() {
|
|
348577
|
-
define_PACKAGE_VERSIONS_default = { runtime: "1.11.
|
|
348577
|
+
define_PACKAGE_VERSIONS_default = { runtime: "1.11.9", adk: "1.11.9", sdk: "4.20.2", llmz: "0.0.33", zai: "2.5.0", cognitive: "0.2.0" };
|
|
348578
348578
|
}
|
|
348579
348579
|
});
|
|
348580
348580
|
init_asset = __esm2({
|
|
@@ -654980,7 +654980,7 @@ var init_library2 = __esm(() => {
|
|
|
654980
654980
|
});
|
|
654981
654981
|
init_define_PACKAGE_VERSIONS2 = __esm4({
|
|
654982
654982
|
"<define:__PACKAGE_VERSIONS__>"() {
|
|
654983
|
-
define_PACKAGE_VERSIONS_default2 = { runtime: "1.11.
|
|
654983
|
+
define_PACKAGE_VERSIONS_default2 = { runtime: "1.11.9", adk: "1.11.9", sdk: "4.20.2", llmz: "0.0.33", zai: "2.5.0", cognitive: "0.2.0" };
|
|
654984
654984
|
}
|
|
654985
654985
|
});
|
|
654986
654986
|
init_assets2 = __esm4({
|
|
@@ -696621,7 +696621,6 @@ import { EventEmitter as EventEmitter24 } from "events";
|
|
|
696621
696621
|
import path14 from "path";
|
|
696622
696622
|
import * as fs11 from "fs";
|
|
696623
696623
|
import * as path15 from "path";
|
|
696624
|
-
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
696625
696624
|
import path16 from "path";
|
|
696626
696625
|
import crypto24 from "crypto";
|
|
696627
696626
|
import path17 from "path";
|
|
@@ -696650,14 +696649,14 @@ import { existsSync as existsSync52 } from "fs";
|
|
|
696650
696649
|
import crypto42 from "crypto";
|
|
696651
696650
|
import path332 from "path";
|
|
696652
696651
|
import fs16 from "fs/promises";
|
|
696653
|
-
import { readFileSync as
|
|
696652
|
+
import { readFileSync as readFileSync6 } from "fs";
|
|
696654
696653
|
import { join as join72 } from "path";
|
|
696655
696654
|
import { watch as watch2, readdirSync as readdirSync22 } from "fs";
|
|
696656
696655
|
import { EventEmitter as EventEmitter32 } from "events";
|
|
696657
696656
|
import { join as join82, relative as relative3 } from "path";
|
|
696658
696657
|
import { existsSync as existsSync7 } from "fs";
|
|
696659
696658
|
import path342 from "path";
|
|
696660
|
-
import { readFileSync as
|
|
696659
|
+
import { readFileSync as readFileSync22 } from "fs";
|
|
696661
696660
|
import { join as join9 } from "path";
|
|
696662
696661
|
|
|
696663
696662
|
class ValidationErrors {
|
|
@@ -699802,7 +699801,7 @@ class AgentProjectGenerator {
|
|
|
699802
699801
|
deploy: "adk deploy"
|
|
699803
699802
|
},
|
|
699804
699803
|
dependencies: {
|
|
699805
|
-
"@botpress/runtime": "^1.11.
|
|
699804
|
+
"@botpress/runtime": "^1.11.9"
|
|
699806
699805
|
},
|
|
699807
699806
|
devDependencies: {
|
|
699808
699807
|
typescript: "^5.9.3"
|
|
@@ -699966,9 +699965,7 @@ A Botpress Agent built with the ADK.
|
|
|
699966
699965
|
await this.writeFormattedFile("README.md", readme);
|
|
699967
699966
|
}
|
|
699968
699967
|
createClaudeMd() {
|
|
699969
|
-
|
|
699970
|
-
const claudeMd = fs11.readFileSync(templatePath, "utf-8");
|
|
699971
|
-
this.writeFile("CLAUDE.md", claudeMd);
|
|
699968
|
+
this.writeFile("CLAUDE.md", CLAUDE_template_default);
|
|
699972
699969
|
}
|
|
699973
699970
|
async createSourceStructure() {
|
|
699974
699971
|
const srcPath = path15.join(this.projectPath, "src");
|
|
@@ -702028,13 +702025,8 @@ configuration: {
|
|
|
702028
702025
|
"check:type": "tsc --noEmit"
|
|
702029
702026
|
},
|
|
702030
702027
|
private: true,
|
|
702031
|
-
dependencies: {
|
|
702032
|
-
"@botpress/client": "1.24.2",
|
|
702033
|
-
"@botpress/sdk": "4.15.7",
|
|
702034
|
-
"@botpress/runtime": "workspace:*"
|
|
702035
|
-
},
|
|
702028
|
+
dependencies: {},
|
|
702036
702029
|
devDependencies: {
|
|
702037
|
-
"@types/node": "^22.16.4",
|
|
702038
702030
|
typescript: "^5.9.3"
|
|
702039
702031
|
}
|
|
702040
702032
|
};
|
|
@@ -704062,11 +704054,1271 @@ var import_ts_morph, __defProp11, __commonJS7 = (cb4, mod) => () => (mod || cb4(
|
|
|
704062
704054
|
`));
|
|
704063
704055
|
return code;
|
|
704064
704056
|
}
|
|
704065
|
-
}, ADK_VERSION = "1.11.
|
|
704057
|
+
}, ADK_VERSION = "1.11.9", relative22 = (from, to3) => {
|
|
704066
704058
|
const fromDir = path102.dirname(from);
|
|
704067
704059
|
const relative32 = path102.relative(fromDir, to3);
|
|
704068
704060
|
return relative32.startsWith(".") ? relative32 : `./${relative32}`;
|
|
704069
|
-
}, init_utils8, exports_action_types, init_action_types, exports_integration_action_types, init_integration_action_types, require_package3, bpCliImporter, auth, BP_CLI_VERSION = "4.27.3", BP_CLI_INSTALL_ALL, BP_CLI_INSTALL_DIR, BP_CLI_BIN_PATH, BpAddCommand, BpBuildCommand, BpDeployCommand, BpDevCommand, BpChatCommand, workspaceCache, agentInfoKeyOrder, dependenciesKeyOrder, integrationKeyOrder, defaultAdkFolder = ".adk", integrationRefSchema, versionSchema, HubCache, AgentProject, FileWatcher,
|
|
704061
|
+
}, init_utils8, exports_action_types, init_action_types, exports_integration_action_types, init_integration_action_types, require_package3, bpCliImporter, auth, BP_CLI_VERSION = "4.27.3", BP_CLI_INSTALL_ALL, BP_CLI_INSTALL_DIR, BP_CLI_BIN_PATH, BpAddCommand, BpBuildCommand, BpDeployCommand, BpDevCommand, BpChatCommand, workspaceCache, agentInfoKeyOrder, dependenciesKeyOrder, integrationKeyOrder, defaultAdkFolder = ".adk", integrationRefSchema, versionSchema, HubCache, AgentProject, FileWatcher, CLAUDE_template_default = `# Botpress ADK Project Context
|
|
704062
|
+
|
|
704063
|
+
This project is built with the **Botpress Agent Development Kit (ADK)** - a TypeScript-first framework for building AI agents.
|
|
704064
|
+
|
|
704065
|
+
## Table of Contents
|
|
704066
|
+
|
|
704067
|
+
- [Quick Reference: Use the Botpress MCP Server](#quick-reference-use-the-botpress-mcp-server)
|
|
704068
|
+
- [What is the ADK?](#what-is-the-adk)
|
|
704069
|
+
- [ADK CLI](#adk-cli)
|
|
704070
|
+
- [Core Concepts](#core-concepts)
|
|
704071
|
+
- [1. Agent Configuration](#1-agent-configuration-agentconfigts)
|
|
704072
|
+
- [2. Conversations](#2-conversations-srcconversations)
|
|
704073
|
+
- [3. Workflows](#3-workflows-srcworkflows)
|
|
704074
|
+
- [4. Tools](#4-tools-srctools)
|
|
704075
|
+
- [5. Knowledge Bases](#5-knowledge-bases-srcknowledge)
|
|
704076
|
+
- [6. Actions](#6-actions-srcactions)
|
|
704077
|
+
- [7. Zai Library](#7-zai-library)
|
|
704078
|
+
- [Project Structure](#project-structure)
|
|
704079
|
+
- [Development Workflow](#development-workflow)
|
|
704080
|
+
- [Examples](#examples)
|
|
704081
|
+
- [Best Practices](#best-practices)
|
|
704082
|
+
- [Common APIs](#common-apis)
|
|
704083
|
+
- [Advanced Autonomous Execution](#advanced-autonomous-execution)
|
|
704084
|
+
- [State and Metadata Management](#state-and-metadata-management)
|
|
704085
|
+
- [Advanced Table Operations](#advanced-table-operations)
|
|
704086
|
+
- [Knowledge Base Operations](#knowledge-base-operations)
|
|
704087
|
+
- [Advanced Conversation Patterns](#advanced-conversation-patterns)
|
|
704088
|
+
- [Citations System](#citations-system)
|
|
704089
|
+
- [When Making Changes](#when-making-changes)
|
|
704090
|
+
- [Resources](#resources)
|
|
704091
|
+
|
|
704092
|
+
## Quick Reference: Use the Botpress MCP Server
|
|
704093
|
+
|
|
704094
|
+
**IMPORTANT**: When working on this project, always search the Botpress documentation using the \`mcp__botpress-docs__SearchBotpress\` tool before making changes. The ADK has specific patterns and APIs that are well-documented.
|
|
704095
|
+
|
|
704096
|
+
## What is the ADK?
|
|
704097
|
+
|
|
704098
|
+
The ADK allows developers to build Botpress agents using **code instead of the Studio interface**. It provides:
|
|
704099
|
+
|
|
704100
|
+
- Project scaffolding with TypeScript
|
|
704101
|
+
- Hot reloading development server (\`adk dev\`)
|
|
704102
|
+
- Type-safe APIs and auto-generated types
|
|
704103
|
+
- Build and deploy to Botpress Cloud
|
|
704104
|
+
|
|
704105
|
+
## ADK CLI
|
|
704106
|
+
|
|
704107
|
+
The ADK CLI is installed globally. You can run it using \`adk <command>\`.
|
|
704108
|
+
Always use bash to run ADK. (\`Bash(adk)\`)
|
|
704109
|
+
To install an integration: \`adk install <integration>\`
|
|
704110
|
+
To generate types without running in dev mode: \`adk build\`
|
|
704111
|
+
|
|
704112
|
+
## Core Concepts
|
|
704113
|
+
|
|
704114
|
+
### 1. Agent Configuration (\`agent.config.ts\`)
|
|
704115
|
+
|
|
704116
|
+
The main configuration file defines:
|
|
704117
|
+
|
|
704118
|
+
- **Agent name and description**
|
|
704119
|
+
- **Default models** for autonomous and zai operations
|
|
704120
|
+
- **State schemas** (bot-level and user-level state using Zod)
|
|
704121
|
+
- **Configuration variables** (encrypted, secure storage for API keys)
|
|
704122
|
+
- **Integration dependencies** (webchat, chat, etc.)
|
|
704123
|
+
|
|
704124
|
+
\`\`\`typescript
|
|
704125
|
+
export default defineConfig({
|
|
704126
|
+
name: "my-agent",
|
|
704127
|
+
defaultModels: {
|
|
704128
|
+
autonomous: "cerebras:gpt-oss-120b",
|
|
704129
|
+
zai: "cerebras:gpt-oss-120b",
|
|
704130
|
+
},
|
|
704131
|
+
bot: { state: z.object({}) },
|
|
704132
|
+
user: { state: z.object({}) },
|
|
704133
|
+
dependencies: {
|
|
704134
|
+
integrations: {
|
|
704135
|
+
webchat: { version: "webchat@0.3.0", enabled: true },
|
|
704136
|
+
},
|
|
704137
|
+
},
|
|
704138
|
+
});
|
|
704139
|
+
\`\`\`
|
|
704140
|
+
|
|
704141
|
+
### 2. Conversations (\`src/conversations/\`)
|
|
704142
|
+
|
|
704143
|
+
**Primary way agents handle user messages**. Each conversation handler:
|
|
704144
|
+
|
|
704145
|
+
- Responds to messages from specific channels
|
|
704146
|
+
- Uses \`execute()\` to run autonomous AI logic
|
|
704147
|
+
- Can access conversation state, send messages, and call tools
|
|
704148
|
+
|
|
704149
|
+
**Key Pattern**: The \`execute()\` function runs the agent's AI loop:
|
|
704150
|
+
|
|
704151
|
+
\`\`\`typescript
|
|
704152
|
+
export default new Conversation({
|
|
704153
|
+
channel: "webchat.channel",
|
|
704154
|
+
handler: async ({ execute, conversation, state }) => {
|
|
704155
|
+
await execute({
|
|
704156
|
+
instructions: "Your agent's instructions here",
|
|
704157
|
+
tools: [myTool1, myTool2],
|
|
704158
|
+
knowledge: [myKnowledgeBase],
|
|
704159
|
+
});
|
|
704160
|
+
},
|
|
704161
|
+
});
|
|
704162
|
+
\`\`\`
|
|
704163
|
+
|
|
704164
|
+
### 3. Workflows (\`src/workflows/\`)
|
|
704165
|
+
|
|
704166
|
+
**Long-running processes** for complex, multi-step operations:
|
|
704167
|
+
|
|
704168
|
+
- Can run on schedules (cron syntax)
|
|
704169
|
+
- Run independently or triggered by events
|
|
704170
|
+
- NOT the same as Studio Workflows
|
|
704171
|
+
- Use \`step()\` for durable execution (survives restarts)
|
|
704172
|
+
|
|
704173
|
+
\`\`\`typescript
|
|
704174
|
+
export default new Workflow({
|
|
704175
|
+
name: "periodic-indexing",
|
|
704176
|
+
schedule: "0 */6 * * *",
|
|
704177
|
+
handler: async ({ step }) => {
|
|
704178
|
+
await step("task-name", async () => {
|
|
704179
|
+
// Your logic here
|
|
704180
|
+
});
|
|
704181
|
+
},
|
|
704182
|
+
});
|
|
704183
|
+
\`\`\`
|
|
704184
|
+
|
|
704185
|
+
#### Advanced Workflow Step Methods
|
|
704186
|
+
|
|
704187
|
+
Beyond basic \`step()\`, workflows have powerful methods for complex orchestration:
|
|
704188
|
+
|
|
704189
|
+
**Parallel Processing:**
|
|
704190
|
+
|
|
704191
|
+
- \`step.map()\` - Process array items in parallel with concurrency control
|
|
704192
|
+
- \`step.forEach()\` - Like map but for side effects (returns void)
|
|
704193
|
+
- \`step.batch()\` - Process in sequential batches
|
|
704194
|
+
|
|
704195
|
+
\`\`\`typescript
|
|
704196
|
+
// Process items in parallel
|
|
704197
|
+
const results = await step.map(
|
|
704198
|
+
'process-items',
|
|
704199
|
+
items,
|
|
704200
|
+
async (item, { i }) => processItem(item),
|
|
704201
|
+
{ concurrency: 5, maxAttempts: 3 }
|
|
704202
|
+
)
|
|
704203
|
+
|
|
704204
|
+
// Batch processing
|
|
704205
|
+
await step.batch(
|
|
704206
|
+
'bulk-insert',
|
|
704207
|
+
records,
|
|
704208
|
+
async (batch) => database.bulkInsert(batch),
|
|
704209
|
+
{ batchSize: 100 }
|
|
704210
|
+
)
|
|
704211
|
+
\`\`\`
|
|
704212
|
+
|
|
704213
|
+
**Workflow Coordination:**
|
|
704214
|
+
|
|
704215
|
+
- \`step.waitForWorkflow()\` - Wait for another workflow to complete
|
|
704216
|
+
- \`step.executeWorkflow()\` - Start and wait in one call
|
|
704217
|
+
|
|
704218
|
+
\`\`\`typescript
|
|
704219
|
+
const result = await step.executeWorkflow('run-child', ChildWorkflow, { input })
|
|
704220
|
+
\`\`\`
|
|
704221
|
+
|
|
704222
|
+
**Timing Control:**
|
|
704223
|
+
|
|
704224
|
+
- \`step.sleep()\` - Pause execution (< 10s in-memory, >= 10s uses listening mode)
|
|
704225
|
+
- \`step.sleepUntil()\` - Sleep until specific time
|
|
704226
|
+
- \`step.listen()\` - Pause and wait for external event
|
|
704227
|
+
|
|
704228
|
+
\`\`\`typescript
|
|
704229
|
+
await step.sleep('wait-5s', 5000)
|
|
704230
|
+
await step.sleepUntil('wait-until-noon', new Date('2025-01-15T12:00:00Z'))
|
|
704231
|
+
\`\`\`
|
|
704232
|
+
|
|
704233
|
+
**Request Data from Conversation:**
|
|
704234
|
+
|
|
704235
|
+
\`\`\`typescript
|
|
704236
|
+
// In workflow
|
|
704237
|
+
const { topic } = await step.request('topic', 'What topic should I research?')
|
|
704238
|
+
|
|
704239
|
+
// In conversation
|
|
704240
|
+
if (isWorkflowDataRequest(event)) {
|
|
704241
|
+
await workflow.provide(event, { topic: userInput })
|
|
704242
|
+
}
|
|
704243
|
+
\`\`\`
|
|
704244
|
+
|
|
704245
|
+
**Execution Control:**
|
|
704246
|
+
|
|
704247
|
+
- \`step.fail()\` - Mark workflow as failed
|
|
704248
|
+
- \`step.abort()\` - Abort without failing
|
|
704249
|
+
- \`step.progress()\` - Record progress checkpoint
|
|
704250
|
+
|
|
704251
|
+
### 4. Tools (\`src/tools/\`)
|
|
704252
|
+
|
|
704253
|
+
**AI-callable functions** that enable agents to perform actions:
|
|
704254
|
+
|
|
704255
|
+
- Must have clear name and description
|
|
704256
|
+
- Use Zod schemas for input/output
|
|
704257
|
+
- Can be passed to \`execute()\`
|
|
704258
|
+
|
|
704259
|
+
\`\`\`typescript
|
|
704260
|
+
export default new Autonomous.Tool({
|
|
704261
|
+
name: "searchDatabase",
|
|
704262
|
+
description: "Search the database",
|
|
704263
|
+
input: z.object({ query: z.string() }),
|
|
704264
|
+
output: z.object({ results: z.array(z.any()) }),
|
|
704265
|
+
handler: async ({ query }) => {
|
|
704266
|
+
// Tool logic
|
|
704267
|
+
return { results: [] };
|
|
704268
|
+
},
|
|
704269
|
+
});
|
|
704270
|
+
\`\`\`
|
|
704271
|
+
|
|
704272
|
+
### 5. Knowledge Bases (\`src/knowledge/\`)
|
|
704273
|
+
|
|
704274
|
+
**RAG (Retrieval-Augmented Generation)** for providing context:
|
|
704275
|
+
|
|
704276
|
+
- Website scraping
|
|
704277
|
+
- Document ingestion
|
|
704278
|
+
- Can be passed to \`execute()\` via \`knowledge\` parameter
|
|
704279
|
+
|
|
704280
|
+
### 6. Actions (\`src/actions/\`)
|
|
704281
|
+
|
|
704282
|
+
**Reusable business logic** that can:
|
|
704283
|
+
|
|
704284
|
+
- Be called from anywhere (import \`actions\` from \`@botpress/runtime\`)
|
|
704285
|
+
- Be converted to tools with \`.asTool()\`
|
|
704286
|
+
- Encapsulate logic not tied to conversational flow
|
|
704287
|
+
|
|
704288
|
+
### 7. Zai Library
|
|
704289
|
+
|
|
704290
|
+
**Zai** is an LLM utility library that provides a clean, type-safe API for common AI operations. It's designed to work seamlessly with the ADK and SDK to process LLM inputs and outputs programmatically.
|
|
704291
|
+
|
|
704292
|
+
#### Importing Zai in ADK
|
|
704293
|
+
|
|
704294
|
+
In the ADK, Zai is available from \`@botpress/runtime\`:
|
|
704295
|
+
|
|
704296
|
+
\`\`\`typescript
|
|
704297
|
+
import { adk } from '@botpress/runtime'
|
|
704298
|
+
// then adk.zai.<method_name>
|
|
704299
|
+
\`\`\`
|
|
704300
|
+
|
|
704301
|
+
The default model for Zai operations is configured in \`agent.config.ts\`:
|
|
704302
|
+
|
|
704303
|
+
\`\`\`typescript
|
|
704304
|
+
export default defineConfig({
|
|
704305
|
+
defaultModels: {
|
|
704306
|
+
autonomous: "cerebras:gpt-oss-120b",
|
|
704307
|
+
zai: "cerebras:gpt-oss-120b", // Model used for Zai operations
|
|
704308
|
+
},
|
|
704309
|
+
})
|
|
704310
|
+
\`\`\`
|
|
704311
|
+
|
|
704312
|
+
#### When to Use Zai
|
|
704313
|
+
|
|
704314
|
+
Use Zai when you need to:
|
|
704315
|
+
- Extract structured data from unstructured text
|
|
704316
|
+
- Answer questions from documents with source citations
|
|
704317
|
+
- Verify Boolean conditions in content
|
|
704318
|
+
- Summarize long text into concise summaries
|
|
704319
|
+
- Generate text programmatically based on prompts
|
|
704320
|
+
|
|
704321
|
+
**Use Zai instead of \`execute()\` when**: You need deterministic, structured outputs for specific AI tasks (extraction, validation, summarization) rather than conversational interactions.
|
|
704322
|
+
|
|
704323
|
+
#### Zai Methods
|
|
704324
|
+
|
|
704325
|
+
**1. \`answer()\` - Answer Questions with Citations**
|
|
704326
|
+
|
|
704327
|
+
Answers questions from documents with intelligent source citations.
|
|
704328
|
+
|
|
704329
|
+
\`\`\`typescript
|
|
704330
|
+
const documents = [
|
|
704331
|
+
'Botpress was founded in 2016.',
|
|
704332
|
+
'The company is based in Quebec, Canada.',
|
|
704333
|
+
]
|
|
704334
|
+
|
|
704335
|
+
const result = await zai.answer(documents, 'When was Botpress founded?')
|
|
704336
|
+
|
|
704337
|
+
if (result.type === 'answer') {
|
|
704338
|
+
console.log(result.answer) // "Botpress was founded in 2016."
|
|
704339
|
+
console.log(result.citations) // Array of citations with source references
|
|
704340
|
+
}
|
|
704341
|
+
\`\`\`
|
|
704342
|
+
|
|
704343
|
+
**When to use**: When you need to answer questions from a set of documents with traceable sources (e.g., custom RAG implementations, document Q&A).
|
|
704344
|
+
|
|
704345
|
+
**2. \`extract()\` - Extract Structured Data**
|
|
704346
|
+
|
|
704347
|
+
Extracts structured data from unstructured input using Zod schemas.
|
|
704348
|
+
|
|
704349
|
+
\`\`\`typescript
|
|
704350
|
+
import { z, adk } from '@botpress/runtime'
|
|
704351
|
+
|
|
704352
|
+
const userSchema = z.object({
|
|
704353
|
+
name: z.string(),
|
|
704354
|
+
email: z.string().email(),
|
|
704355
|
+
age: z.number()
|
|
704356
|
+
})
|
|
704357
|
+
|
|
704358
|
+
const input = "My name is John Doe, I'm 30 years old and my email is john@example.com"
|
|
704359
|
+
// zai.extract returns the extracted data DIRECTLY (not wrapped in { output: ... })
|
|
704360
|
+
const result = await adk.zai.extract(input, userSchema)
|
|
704361
|
+
|
|
704362
|
+
console.log(result)
|
|
704363
|
+
// { name: "John Doe", email: "john@example.com", age: 30 }
|
|
704364
|
+
\`\`\`
|
|
704365
|
+
|
|
704366
|
+
**When to use**: When you need to parse unstructured user input into structured data (e.g., form extraction from natural language, parsing contact information).
|
|
704367
|
+
|
|
704368
|
+
**3. \`check()\` - Verify Boolean Conditions**
|
|
704369
|
+
|
|
704370
|
+
Verifies a condition against some input and returns a boolean with explanation.
|
|
704371
|
+
|
|
704372
|
+
\`\`\`typescript
|
|
704373
|
+
const email = "Get rich quick! Click here now!!!"
|
|
704374
|
+
const { output } = await zai.check(email, 'is spam').result()
|
|
704375
|
+
|
|
704376
|
+
console.log(output.value) // true
|
|
704377
|
+
console.log(output.explanation) // "This email contains typical spam indicators..."
|
|
704378
|
+
\`\`\`
|
|
704379
|
+
|
|
704380
|
+
**When to use**: When you need to validate content or make binary decisions (e.g., content moderation, intent verification, condition checking).
|
|
704381
|
+
|
|
704382
|
+
**4. \`summarize()\` - Summarize Text**
|
|
704383
|
+
|
|
704384
|
+
Creates concise summaries of lengthy text to a desired length.
|
|
704385
|
+
|
|
704386
|
+
\`\`\`typescript
|
|
704387
|
+
const longArticle = "..." // Long article content
|
|
704388
|
+
|
|
704389
|
+
const summary = await zai.summarize(longArticle, {
|
|
704390
|
+
length: 100, // tokens
|
|
704391
|
+
prompt: 'key findings and main conclusions'
|
|
704392
|
+
})
|
|
704393
|
+
\`\`\`
|
|
704394
|
+
|
|
704395
|
+
**When to use**: When you need to condense long content (e.g., article summaries, transcript summaries, document overviews).
|
|
704396
|
+
|
|
704397
|
+
**5. \`text()\` - Generate Text**
|
|
704398
|
+
|
|
704399
|
+
Generates text of the desired length according to a prompt.
|
|
704400
|
+
|
|
704401
|
+
\`\`\`typescript
|
|
704402
|
+
const generated = await zai.text('Write a welcome message for new users', {
|
|
704403
|
+
length: 50 // tokens
|
|
704404
|
+
})
|
|
704405
|
+
\`\`\`
|
|
704406
|
+
|
|
704407
|
+
**When to use**: When you need to generate specific text content programmatically (e.g., dynamic content generation, templated responses).
|
|
704408
|
+
|
|
704409
|
+
#### Response Methods
|
|
704410
|
+
|
|
704411
|
+
All Zai operations return a Response object with promise-like behavior and additional functionality:
|
|
704412
|
+
|
|
704413
|
+
\`\`\`typescript
|
|
704414
|
+
// Await the result directly
|
|
704415
|
+
const result = await zai.extract(input, schema)
|
|
704416
|
+
|
|
704417
|
+
// Or use .result() for explicit promise handling
|
|
704418
|
+
const { output } = await zai.check(content, 'is valid').result()
|
|
704419
|
+
\`\`\`
|
|
704420
|
+
|
|
704421
|
+
## Project Structure
|
|
704422
|
+
|
|
704423
|
+
\`\`\`
|
|
704424
|
+
agent.config.ts # Main configuration
|
|
704425
|
+
src/
|
|
704426
|
+
conversations/ # Message handlers (primary user interaction)
|
|
704427
|
+
workflows/ # Long-running processes
|
|
704428
|
+
tools/ # AI-callable functions
|
|
704429
|
+
actions/ # Reusable business logic
|
|
704430
|
+
knowledge/ # Knowledge bases for RAG
|
|
704431
|
+
triggers/ # Event-based triggers
|
|
704432
|
+
tables/ # Database tables
|
|
704433
|
+
.botpress/ # Auto-generated types (DO NOT EDIT)
|
|
704434
|
+
\`\`\`
|
|
704435
|
+
|
|
704436
|
+
## Development Workflow
|
|
704437
|
+
|
|
704438
|
+
1. **Start dev server**: \`adk dev\` (http://localhost:3001 for console)
|
|
704439
|
+
2. **Add integrations**: \`adk add webchat@latest\`
|
|
704440
|
+
3. **Build**: \`adk build\`
|
|
704441
|
+
4. **Deploy**: \`adk deploy\`
|
|
704442
|
+
5. **Chat in CLI**: \`adk chat\`
|
|
704443
|
+
|
|
704444
|
+
## Examples
|
|
704445
|
+
|
|
704446
|
+
Official examples: https://github.com/botpress/adk/tree/main/examples
|
|
704447
|
+
|
|
704448
|
+
### subagents
|
|
704449
|
+
|
|
704450
|
+
**What you'll learn:** How to build a multi-agent system where an orchestrator delegates to specialists.
|
|
704451
|
+
|
|
704452
|
+
Shows the \`SubAgent\` pattern where each specialist (HR, IT, Sales, etc.) runs in its own context with \`mode: "worker"\`, returns structured results via custom exits, and reports progress through \`onTrace\` hooks.
|
|
704453
|
+
|
|
704454
|
+
### webchat-rag
|
|
704455
|
+
|
|
704456
|
+
**What you'll learn:** How to build a RAG assistant with scheduled indexing, guardrails, and admin features.
|
|
704457
|
+
|
|
704458
|
+
Shows \`Autonomous.Object\` for dynamic tool grouping, \`onBeforeTool\` hooks to enforce knowledge search before answering, scheduled workflows for KB refresh, and \`ThinkSignal\` for interrupting execution.
|
|
704459
|
+
|
|
704460
|
+
### deep-research
|
|
704461
|
+
|
|
704462
|
+
**What you'll learn:** How to build complex, long-running workflows with progress tracking.
|
|
704463
|
+
|
|
704464
|
+
Shows \`step()\` and \`step.map()\` for workflow phases, \`Reference.Workflow\` for conversation-workflow linking, Tables for activity tracking, and extensive Zai usage (\`extract\`, \`answer\`, \`filter\`, \`text\`).
|
|
704465
|
+
|
|
704466
|
+
## Best Practices
|
|
704467
|
+
|
|
704468
|
+
1. **Search Botpress docs first** - Use the MCP tool before implementing
|
|
704469
|
+
2. **Keep tools focused** - Single responsibility per tool
|
|
704470
|
+
3. **Use Zod schemas** with \`.describe()\` for clarity
|
|
704471
|
+
4. **State management** - Minimize large variables in main workflow
|
|
704472
|
+
5. **Type safety** - Run \`adk dev\` or \`adk build\` to regenerate types after config changes
|
|
704473
|
+
6. **Conversations vs Workflows**:
|
|
704474
|
+
- Conversations: User interactions, real-time responses
|
|
704475
|
+
- Workflows: Background tasks, scheduled jobs, long-running processes
|
|
704476
|
+
|
|
704477
|
+
## Common APIs
|
|
704478
|
+
|
|
704479
|
+
### Conversation Handler
|
|
704480
|
+
|
|
704481
|
+
\`\`\`typescript
|
|
704482
|
+
handler: async ({
|
|
704483
|
+
execute, // Run autonomous AI loop
|
|
704484
|
+
conversation, // Send messages, manage conversation
|
|
704485
|
+
state, // Conversation state (persisted)
|
|
704486
|
+
message, // Incoming message
|
|
704487
|
+
client, // Botpress API client
|
|
704488
|
+
}) => {};
|
|
704489
|
+
\`\`\`
|
|
704490
|
+
|
|
704491
|
+
### Execute Function
|
|
704492
|
+
|
|
704493
|
+
\`\`\`typescript
|
|
704494
|
+
await execute({
|
|
704495
|
+
instructions: "String or function returning instructions",
|
|
704496
|
+
tools: [tool1, tool2], // Optional tools
|
|
704497
|
+
knowledge: [kb1, kb2], // Optional knowledge bases
|
|
704498
|
+
exits: [customExit], // Optional custom exits
|
|
704499
|
+
hooks: { onTrace, onBeforeTool }, // Optional hooks
|
|
704500
|
+
mode: "worker", // Optional: autonomous until exit
|
|
704501
|
+
iterations: 10, // Max loops (default 10)
|
|
704502
|
+
});
|
|
704503
|
+
\`\`\`
|
|
704504
|
+
|
|
704505
|
+
## Advanced Autonomous Execution
|
|
704506
|
+
|
|
704507
|
+
### Autonomous Namespace
|
|
704508
|
+
|
|
704509
|
+
The \`Autonomous\` namespace provides powerful primitives for controlling LLM behavior:
|
|
704510
|
+
|
|
704511
|
+
#### Autonomous.Exit - Custom Exit Conditions
|
|
704512
|
+
|
|
704513
|
+
Define custom exits for autonomous execution loops:
|
|
704514
|
+
|
|
704515
|
+
\`\`\`typescript
|
|
704516
|
+
import { Autonomous, z } from '@botpress/runtime'
|
|
704517
|
+
|
|
704518
|
+
const AnswerExit = new Autonomous.Exit({
|
|
704519
|
+
name: 'answer',
|
|
704520
|
+
description: 'Return when you have the final answer',
|
|
704521
|
+
schema: z.object({
|
|
704522
|
+
answer: z.string(),
|
|
704523
|
+
confidence: z.number()
|
|
704524
|
+
})
|
|
704525
|
+
})
|
|
704526
|
+
|
|
704527
|
+
const NoAnswerExit = new Autonomous.Exit({
|
|
704528
|
+
name: 'no_answer',
|
|
704529
|
+
description: 'No answer could be found'
|
|
704530
|
+
})
|
|
704531
|
+
|
|
704532
|
+
const result = await execute({
|
|
704533
|
+
instructions: 'Research and answer the question',
|
|
704534
|
+
exits: [AnswerExit, NoAnswerExit],
|
|
704535
|
+
mode: 'worker' // Run until exit triggered
|
|
704536
|
+
})
|
|
704537
|
+
|
|
704538
|
+
// \u2705 CORRECT - Use result.is() and result.output
|
|
704539
|
+
if (result.is(AnswerExit)) {
|
|
704540
|
+
console.log(result.output.answer) // Type-safe access
|
|
704541
|
+
console.log(result.output.confidence)
|
|
704542
|
+
} else if (result.is(NoAnswerExit)) {
|
|
704543
|
+
console.log('No answer found')
|
|
704544
|
+
}
|
|
704545
|
+
|
|
704546
|
+
// \u274C WRONG - Don't use result.exit.name or result.exit.value
|
|
704547
|
+
// if (result.exit?.name === 'answer') { ... }
|
|
704548
|
+
\`\`\`
|
|
704549
|
+
|
|
704550
|
+
#### Autonomous.ThinkSignal - Inject Context
|
|
704551
|
+
|
|
704552
|
+
Provide context to the LLM without continuing execution:
|
|
704553
|
+
|
|
704554
|
+
\`\`\`typescript
|
|
704555
|
+
const results = await fetchData()
|
|
704556
|
+
|
|
704557
|
+
if (!results.length) {
|
|
704558
|
+
throw new ThinkSignal('error', 'No results found')
|
|
704559
|
+
}
|
|
704560
|
+
|
|
704561
|
+
// Inject formatted results into LLM context
|
|
704562
|
+
throw new ThinkSignal('results ready', formatResults(results))
|
|
704563
|
+
\`\`\`
|
|
704564
|
+
|
|
704565
|
+
#### Autonomous.Object - Dynamic Tool Grouping
|
|
704566
|
+
|
|
704567
|
+
Group tools dynamically based on state:
|
|
704568
|
+
|
|
704569
|
+
\`\`\`typescript
|
|
704570
|
+
const adminTools = new Autonomous.Object({
|
|
704571
|
+
name: 'admin',
|
|
704572
|
+
description: user.isAdmin ? 'Admin tools available' : 'Login required',
|
|
704573
|
+
tools: user.isAdmin ? [refreshKB, manageBots] : [generateLoginCode]
|
|
704574
|
+
})
|
|
704575
|
+
|
|
704576
|
+
await execute({
|
|
704577
|
+
objects: [adminTools]
|
|
704578
|
+
})
|
|
704579
|
+
\`\`\`
|
|
704580
|
+
|
|
704581
|
+
### Execution Hooks
|
|
704582
|
+
|
|
704583
|
+
Full control over the autonomous execution loop:
|
|
704584
|
+
|
|
704585
|
+
\`\`\`typescript
|
|
704586
|
+
await execute({
|
|
704587
|
+
instructions: '...',
|
|
704588
|
+
hooks: {
|
|
704589
|
+
// Before tool execution - can modify input
|
|
704590
|
+
onBeforeTool: async ({ iteration, tool, input, controller }) => {
|
|
704591
|
+
console.log(\`About to call \${tool.name}\`)
|
|
704592
|
+
return { input: modifiedInput } // Optional: transform input
|
|
704593
|
+
},
|
|
704594
|
+
|
|
704595
|
+
// After tool execution - can modify output
|
|
704596
|
+
onAfterTool: async ({ iteration, tool, input, output, controller }) => {
|
|
704597
|
+
console.log(\`\${tool.name} returned:\`, output)
|
|
704598
|
+
return { output: modifiedOutput } // Optional: transform output
|
|
704599
|
+
},
|
|
704600
|
+
|
|
704601
|
+
// Before code execution in iteration
|
|
704602
|
+
onBeforeExecution: async (iteration, controller) => {
|
|
704603
|
+
return { code: modifiedCode } // Optional: transform generated code
|
|
704604
|
+
},
|
|
704605
|
+
|
|
704606
|
+
// When exit is triggered
|
|
704607
|
+
onExit: async (result) => {
|
|
704608
|
+
console.log('Exited with:', result)
|
|
704609
|
+
},
|
|
704610
|
+
|
|
704611
|
+
// After each iteration completes
|
|
704612
|
+
onIterationEnd: async (iteration, controller) => {
|
|
704613
|
+
if (iteration > 5) {
|
|
704614
|
+
controller.abort() // Stop execution
|
|
704615
|
+
}
|
|
704616
|
+
},
|
|
704617
|
+
|
|
704618
|
+
// On trace events (synchronous, non-blocking)
|
|
704619
|
+
onTrace: ({ trace, iteration }) => {
|
|
704620
|
+
if (trace.type === 'comment') {
|
|
704621
|
+
console.log('LLM thinking:', trace.comment)
|
|
704622
|
+
}
|
|
704623
|
+
if (trace.type === 'tool_call') {
|
|
704624
|
+
console.log('Calling:', trace.tool_name)
|
|
704625
|
+
}
|
|
704626
|
+
}
|
|
704627
|
+
}
|
|
704628
|
+
})
|
|
704629
|
+
\`\`\`
|
|
704630
|
+
|
|
704631
|
+
**Hook use cases:**
|
|
704632
|
+
- Logging and debugging
|
|
704633
|
+
- Input/output validation and transformation
|
|
704634
|
+
- Rate limiting tool calls
|
|
704635
|
+
- Custom abort conditions
|
|
704636
|
+
- Injecting dynamic context
|
|
704637
|
+
|
|
704638
|
+
## State and Metadata Management
|
|
704639
|
+
|
|
704640
|
+
### Tags - Key-Value Metadata
|
|
704641
|
+
|
|
704642
|
+
Track metadata for any entity (bot, user, conversation, workflow):
|
|
704643
|
+
|
|
704644
|
+
\`\`\`typescript
|
|
704645
|
+
import { TrackedTags } from '@botpress/runtime'
|
|
704646
|
+
|
|
704647
|
+
// Create tags instance
|
|
704648
|
+
const tags = TrackedTags.create({
|
|
704649
|
+
type: 'bot', // or 'user' | 'conversation' | 'workflow'
|
|
704650
|
+
id: entityId,
|
|
704651
|
+
client: botClient,
|
|
704652
|
+
initialTags: { status: 'active' }
|
|
704653
|
+
})
|
|
704654
|
+
|
|
704655
|
+
// Load from server
|
|
704656
|
+
await tags.load()
|
|
704657
|
+
|
|
704658
|
+
// Modify tags
|
|
704659
|
+
tags.tags = {
|
|
704660
|
+
...tags.tags,
|
|
704661
|
+
lastSync: new Date().toISOString()
|
|
704662
|
+
}
|
|
704663
|
+
|
|
704664
|
+
// Check if modified
|
|
704665
|
+
if (tags.isDirty()) {
|
|
704666
|
+
await tags.save()
|
|
704667
|
+
}
|
|
704668
|
+
|
|
704669
|
+
// Batch operations
|
|
704670
|
+
await TrackedTags.saveAllDirty()
|
|
704671
|
+
await TrackedTags.loadAll()
|
|
704672
|
+
\`\`\`
|
|
704673
|
+
|
|
704674
|
+
**Access via workflow instance:**
|
|
704675
|
+
|
|
704676
|
+
\`\`\`typescript
|
|
704677
|
+
workflow.tags = { status: 'processing' }
|
|
704678
|
+
await workflow.save()
|
|
704679
|
+
\`\`\`
|
|
704680
|
+
|
|
704681
|
+
### Reference.Workflow - Typed Workflow References
|
|
704682
|
+
|
|
704683
|
+
Serialize workflow references in state that auto-hydrate on access:
|
|
704684
|
+
|
|
704685
|
+
\`\`\`typescript
|
|
704686
|
+
import { Reference, z } from '@botpress/runtime'
|
|
704687
|
+
|
|
704688
|
+
// In conversation state schema
|
|
704689
|
+
state: z.object({
|
|
704690
|
+
research: Reference.Workflow('deep_research').optional()
|
|
704691
|
+
// or untyped: Reference.Workflow().optional()
|
|
704692
|
+
})
|
|
704693
|
+
|
|
704694
|
+
// In handler - always a WorkflowInstance
|
|
704695
|
+
handler: async ({ state }) => {
|
|
704696
|
+
if (state.research) {
|
|
704697
|
+
// state.research is typed WorkflowInstance
|
|
704698
|
+
console.log(state.research.status) // 'running' | 'completed' | etc
|
|
704699
|
+
console.log(state.research.output) // Typed output
|
|
704700
|
+
|
|
704701
|
+
if (state.research.status === 'completed') {
|
|
704702
|
+
// Access completed workflow data
|
|
704703
|
+
}
|
|
704704
|
+
}
|
|
704705
|
+
}
|
|
704706
|
+
\`\`\`
|
|
704707
|
+
|
|
704708
|
+
### Context Object - Runtime Access
|
|
704709
|
+
|
|
704710
|
+
Global context for accessing runtime information:
|
|
704711
|
+
|
|
704712
|
+
\`\`\`typescript
|
|
704713
|
+
import { context } from '@botpress/runtime'
|
|
704714
|
+
|
|
704715
|
+
// Get specific context
|
|
704716
|
+
const client = context.get('client')
|
|
704717
|
+
const citations = context.get('citations')
|
|
704718
|
+
const logger = context.get('logger')
|
|
704719
|
+
|
|
704720
|
+
// Get all context
|
|
704721
|
+
const { client, cognitive, logger, operation } = context.getAll()
|
|
704722
|
+
\`\`\`
|
|
704723
|
+
|
|
704724
|
+
**Available context properties:**
|
|
704725
|
+
- \`client\` - Botpress API client
|
|
704726
|
+
- \`cognitive\` - LLM access
|
|
704727
|
+
- \`logger\` - Logging
|
|
704728
|
+
- \`operation\` - Current operation info
|
|
704729
|
+
- \`citations\` - Citation tracking
|
|
704730
|
+
- \`chat\` - Chat interface
|
|
704731
|
+
- \`bot\` - Bot tags and metadata
|
|
704732
|
+
- \`user\` - User information
|
|
704733
|
+
- \`conversation\` - Current conversation
|
|
704734
|
+
- \`message\` - Incoming message
|
|
704735
|
+
- \`event\` - Current event
|
|
704736
|
+
- \`workflow\` - Current workflow
|
|
704737
|
+
- \`workflowControlContext\` - Workflow control (abort, fail, restart)
|
|
704738
|
+
|
|
704739
|
+
### State Management
|
|
704740
|
+
|
|
704741
|
+
Access and modify tracked state:
|
|
704742
|
+
|
|
704743
|
+
\`\`\`typescript
|
|
704744
|
+
import { bot, user } from '@botpress/runtime'
|
|
704745
|
+
|
|
704746
|
+
// Bot state
|
|
704747
|
+
bot.state.lastIndexed = new Date().toISOString()
|
|
704748
|
+
bot.state.config = { theme: 'dark' }
|
|
704749
|
+
|
|
704750
|
+
// User state
|
|
704751
|
+
user.state.preferences = { notifications: true }
|
|
704752
|
+
user.state.lastActive = Date.now()
|
|
704753
|
+
\`\`\`
|
|
704754
|
+
|
|
704755
|
+
State persists automatically across executions.
|
|
704756
|
+
|
|
704757
|
+
## Advanced Table Operations
|
|
704758
|
+
|
|
704759
|
+
### Table Naming Rules
|
|
704760
|
+
|
|
704761
|
+
**IMPORTANT**: Tables have strict naming requirements:
|
|
704762
|
+
|
|
704763
|
+
\`\`\`typescript
|
|
704764
|
+
// \u2705 CORRECT - Name must end with "Table"
|
|
704765
|
+
export const MyDataTable = new Table({
|
|
704766
|
+
name: "mydataTable", // Must end with "Table"
|
|
704767
|
+
columns: { ... }
|
|
704768
|
+
});
|
|
704769
|
+
|
|
704770
|
+
// \u274C WRONG - Missing "Table" suffix
|
|
704771
|
+
name: "mydata"
|
|
704772
|
+
name: "my_data"
|
|
704773
|
+
\`\`\`
|
|
704774
|
+
|
|
704775
|
+
**Reserved column names** - Cannot use these as column names:
|
|
704776
|
+
- \`id\` (auto-generated)
|
|
704777
|
+
- \`createdAt\` (auto-generated)
|
|
704778
|
+
- \`updatedAt\` (auto-generated)
|
|
704779
|
+
- \`computed\`
|
|
704780
|
+
- \`stale\`
|
|
704781
|
+
|
|
704782
|
+
\`\`\`typescript
|
|
704783
|
+
// \u274C WRONG - Using reserved column name
|
|
704784
|
+
columns: {
|
|
704785
|
+
createdAt: z.string() // Reserved!
|
|
704786
|
+
}
|
|
704787
|
+
|
|
704788
|
+
// \u2705 CORRECT - Use alternative name
|
|
704789
|
+
columns: {
|
|
704790
|
+
savedAt: z.string()
|
|
704791
|
+
}
|
|
704792
|
+
\`\`\`
|
|
704793
|
+
|
|
704794
|
+
### Auto-Registration
|
|
704795
|
+
|
|
704796
|
+
Files in \`src/tables/\` are **auto-registered** by the ADK. Do NOT re-export from index.ts:
|
|
704797
|
+
|
|
704798
|
+
\`\`\`typescript
|
|
704799
|
+
// src/tables/index.ts
|
|
704800
|
+
// \u274C WRONG - Causes duplicate registration errors
|
|
704801
|
+
export { MyTable } from "./myTable";
|
|
704802
|
+
|
|
704803
|
+
// \u2705 CORRECT - Leave empty or add comment
|
|
704804
|
+
// Tables are auto-registered from src/tables/*.ts files
|
|
704805
|
+
\`\`\`
|
|
704806
|
+
|
|
704807
|
+
Same applies to \`src/conversations/\`, \`src/workflows/\`, \`src/triggers/\`, etc.
|
|
704808
|
+
|
|
704809
|
+
Beyond basic CRUD, Tables support powerful query and manipulation features:
|
|
704810
|
+
|
|
704811
|
+
### Complex Filtering
|
|
704812
|
+
|
|
704813
|
+
Use logical operators and conditions:
|
|
704814
|
+
|
|
704815
|
+
\`\`\`typescript
|
|
704816
|
+
await MyTable.findRows({
|
|
704817
|
+
filter: {
|
|
704818
|
+
$and: [
|
|
704819
|
+
{ status: 'open' },
|
|
704820
|
+
{ priority: { $in: ['high', 'urgent'] } }
|
|
704821
|
+
],
|
|
704822
|
+
$or: [
|
|
704823
|
+
{ assignee: userId },
|
|
704824
|
+
{ reporter: userId }
|
|
704825
|
+
],
|
|
704826
|
+
title: { $regex: 'bug|error', $options: 'i' }
|
|
704827
|
+
}
|
|
704828
|
+
})
|
|
704829
|
+
\`\`\`
|
|
704830
|
+
|
|
704831
|
+
**Filter operators:**
|
|
704832
|
+
- \`$eq\`, \`$ne\` - Equal, not equal
|
|
704833
|
+
- \`$gt\`, \`$gte\`, \`$lt\`, \`$lte\` - Comparisons
|
|
704834
|
+
- \`$in\`, \`$nin\` - In array, not in array
|
|
704835
|
+
- \`$exists\` - Field exists
|
|
704836
|
+
- \`$regex\` - Regular expression match
|
|
704837
|
+
- \`$options\` - Regex options (e.g., 'i' for case-insensitive)
|
|
704838
|
+
- \`$and\`, \`$or\` - Logical operators
|
|
704839
|
+
|
|
704840
|
+
### Full-Text Search
|
|
704841
|
+
|
|
704842
|
+
Search across searchable columns:
|
|
704843
|
+
|
|
704844
|
+
\`\`\`typescript
|
|
704845
|
+
await MyTable.findRows({
|
|
704846
|
+
search: 'query string',
|
|
704847
|
+
filter: { status: 'active' }
|
|
704848
|
+
})
|
|
704849
|
+
\`\`\`
|
|
704850
|
+
|
|
704851
|
+
Mark columns as searchable in schema:
|
|
704852
|
+
|
|
704853
|
+
\`\`\`typescript
|
|
704854
|
+
columns: {
|
|
704855
|
+
title: z.string().searchable(),
|
|
704856
|
+
description: z.string().searchable()
|
|
704857
|
+
}
|
|
704858
|
+
\`\`\`
|
|
704859
|
+
|
|
704860
|
+
### Aggregation and Grouping
|
|
704861
|
+
|
|
704862
|
+
Group and aggregate data:
|
|
704863
|
+
|
|
704864
|
+
\`\`\`typescript
|
|
704865
|
+
await MyTable.findRows({
|
|
704866
|
+
group: {
|
|
704867
|
+
status: 'count',
|
|
704868
|
+
priority: ['sum', 'avg'],
|
|
704869
|
+
complexity: ['max', 'min']
|
|
704870
|
+
}
|
|
704871
|
+
})
|
|
704872
|
+
\`\`\`
|
|
704873
|
+
|
|
704874
|
+
**Aggregation operations:** \`key\`, \`count\`, \`sum\`, \`avg\`, \`max\`, \`min\`, \`unique\`
|
|
704875
|
+
|
|
704876
|
+
### Computed Columns
|
|
704877
|
+
|
|
704878
|
+
Columns with values computed from row data:
|
|
704879
|
+
|
|
704880
|
+
\`\`\`typescript
|
|
704881
|
+
columns: {
|
|
704882
|
+
fullName: {
|
|
704883
|
+
computed: true,
|
|
704884
|
+
schema: z.string(),
|
|
704885
|
+
dependencies: ['firstName', 'lastName'],
|
|
704886
|
+
value: async (row) => \`\${row.firstName} \${row.lastName}\`
|
|
704887
|
+
},
|
|
704888
|
+
age: {
|
|
704889
|
+
computed: true,
|
|
704890
|
+
schema: z.number(),
|
|
704891
|
+
dependencies: ['birthDate'],
|
|
704892
|
+
value: async (row) => {
|
|
704893
|
+
const today = new Date()
|
|
704894
|
+
const birth = new Date(row.birthDate)
|
|
704895
|
+
return today.getFullYear() - birth.getFullYear()
|
|
704896
|
+
}
|
|
704897
|
+
}
|
|
704898
|
+
}
|
|
704899
|
+
\`\`\`
|
|
704900
|
+
|
|
704901
|
+
### Upsert Operations
|
|
704902
|
+
|
|
704903
|
+
Insert or update based on key column:
|
|
704904
|
+
|
|
704905
|
+
\`\`\`typescript
|
|
704906
|
+
await MyTable.upsertRows({
|
|
704907
|
+
rows: [
|
|
704908
|
+
{ externalId: '123', name: 'Item 1' },
|
|
704909
|
+
{ externalId: '456', name: 'Item 2' }
|
|
704910
|
+
],
|
|
704911
|
+
keyColumn: 'externalId', // Update if exists, insert if not
|
|
704912
|
+
waitComputed: true // Wait for computed columns to update
|
|
704913
|
+
})
|
|
704914
|
+
\`\`\`
|
|
704915
|
+
|
|
704916
|
+
### Bulk Operations
|
|
704917
|
+
|
|
704918
|
+
Efficient batch operations:
|
|
704919
|
+
|
|
704920
|
+
\`\`\`typescript
|
|
704921
|
+
// Delete by filter
|
|
704922
|
+
await MyTable.deleteRows({
|
|
704923
|
+
filter: { status: 'archived', createdAt: { $lt: '2024-01-01' } }
|
|
704924
|
+
})
|
|
704925
|
+
|
|
704926
|
+
// Delete by IDs
|
|
704927
|
+
await MyTable.deleteRowIds([1, 2, 3])
|
|
704928
|
+
|
|
704929
|
+
// Delete all
|
|
704930
|
+
await MyTable.deleteAllRows()
|
|
704931
|
+
|
|
704932
|
+
// Update multiple
|
|
704933
|
+
await MyTable.updateRows({
|
|
704934
|
+
rows: [
|
|
704935
|
+
{ id: 1, status: 'active' },
|
|
704936
|
+
{ id: 2, status: 'inactive' }
|
|
704937
|
+
],
|
|
704938
|
+
waitComputed: true
|
|
704939
|
+
})
|
|
704940
|
+
\`\`\`
|
|
704941
|
+
|
|
704942
|
+
### Error Handling
|
|
704943
|
+
|
|
704944
|
+
Collect errors and warnings from bulk operations:
|
|
704945
|
+
|
|
704946
|
+
\`\`\`typescript
|
|
704947
|
+
const { errors, warnings } = await MyTable.createRows({
|
|
704948
|
+
rows: data,
|
|
704949
|
+
waitComputed: true
|
|
704950
|
+
})
|
|
704951
|
+
|
|
704952
|
+
if (errors?.length) {
|
|
704953
|
+
console.error('Failed rows:', errors)
|
|
704954
|
+
}
|
|
704955
|
+
if (warnings?.length) {
|
|
704956
|
+
console.warn('Warnings:', warnings)
|
|
704957
|
+
}
|
|
704958
|
+
\`\`\`
|
|
704959
|
+
|
|
704960
|
+
## Knowledge Base Operations
|
|
704961
|
+
|
|
704962
|
+
### Data Sources
|
|
704963
|
+
|
|
704964
|
+
Multiple source types for knowledge bases:
|
|
704965
|
+
|
|
704966
|
+
#### Directory Source
|
|
704967
|
+
|
|
704968
|
+
\`\`\`typescript
|
|
704969
|
+
import { DataSource } from '@botpress/runtime'
|
|
704970
|
+
|
|
704971
|
+
const docs = DataSource.Directory.fromPath('src/knowledge', {
|
|
704972
|
+
id: 'docs',
|
|
704973
|
+
filter: (path) => path.endsWith('.md') || path.endsWith('.txt')
|
|
704974
|
+
})
|
|
704975
|
+
\`\`\`
|
|
704976
|
+
|
|
704977
|
+
#### Website Source
|
|
704978
|
+
|
|
704979
|
+
\`\`\`typescript
|
|
704980
|
+
const siteDocs = DataSource.Website.fromSitemap('https://example.com/sitemap.xml', {
|
|
704981
|
+
id: 'website',
|
|
704982
|
+
maxPages: 500,
|
|
704983
|
+
fetch: 'node:fetch' // or custom fetch implementation
|
|
704984
|
+
})
|
|
704985
|
+
\`\`\`
|
|
704986
|
+
|
|
704987
|
+
### Knowledge Base Definition
|
|
704988
|
+
|
|
704989
|
+
\`\`\`typescript
|
|
704990
|
+
import { Knowledge } from '@botpress/runtime'
|
|
704991
|
+
|
|
704992
|
+
export default new Knowledge({
|
|
704993
|
+
name: 'docs',
|
|
704994
|
+
description: 'Product documentation',
|
|
704995
|
+
sources: [docsDirectory, websiteSource]
|
|
704996
|
+
})
|
|
704997
|
+
\`\`\`
|
|
704998
|
+
|
|
704999
|
+
### Refresh Operations
|
|
705000
|
+
|
|
705001
|
+
Manually refresh knowledge base content:
|
|
705002
|
+
|
|
705003
|
+
\`\`\`typescript
|
|
705004
|
+
// Refresh entire knowledge base
|
|
705005
|
+
await DocsKB.refresh({ force: true })
|
|
705006
|
+
|
|
705007
|
+
// Refresh specific source
|
|
705008
|
+
await DocsKB.refreshSource('website', { force: true })
|
|
705009
|
+
\`\`\`
|
|
705010
|
+
|
|
705011
|
+
**Options:**
|
|
705012
|
+
- \`force: true\` - Force refresh even if recently updated
|
|
705013
|
+
- Automatic refresh via scheduled workflows recommended
|
|
705014
|
+
|
|
705015
|
+
### Using Knowledge in Execute
|
|
705016
|
+
|
|
705017
|
+
\`\`\`typescript
|
|
705018
|
+
await execute({
|
|
705019
|
+
instructions: 'Answer using the documentation',
|
|
705020
|
+
knowledge: [DocsKB, APIKB],
|
|
705021
|
+
tools: [searchTool]
|
|
705022
|
+
})
|
|
705023
|
+
\`\`\`
|
|
705024
|
+
|
|
705025
|
+
Knowledge bases are automatically searchable via the \`search_knowledge\` tool.
|
|
705026
|
+
|
|
705027
|
+
## Advanced Conversation Patterns
|
|
705028
|
+
|
|
705029
|
+
### Multiple Channel Support
|
|
705030
|
+
|
|
705031
|
+
Handle messages from multiple channels in one handler:
|
|
705032
|
+
|
|
705033
|
+
\`\`\`typescript
|
|
705034
|
+
export default new Conversation({
|
|
705035
|
+
channel: ['chat.channel', 'webchat.channel', 'slack.dm'],
|
|
705036
|
+
handler: async ({ channel, execute }) => {
|
|
705037
|
+
console.log(\`Message from: \${channel}\`)
|
|
705038
|
+
await execute({ instructions: '...' })
|
|
705039
|
+
}
|
|
705040
|
+
})
|
|
705041
|
+
\`\`\`
|
|
705042
|
+
|
|
705043
|
+
### Event Handling
|
|
705044
|
+
|
|
705045
|
+
Subscribe to integration events:
|
|
705046
|
+
|
|
705047
|
+
\`\`\`typescript
|
|
705048
|
+
export default new Conversation({
|
|
705049
|
+
channel: 'webchat.channel',
|
|
705050
|
+
events: ['webchat:conversationStarted', 'webchat:conversationEnded'],
|
|
705051
|
+
handler: async ({ type, event, message }) => {
|
|
705052
|
+
if (type === 'event' && event.type === 'webchat:conversationStarted') {
|
|
705053
|
+
// Send welcome message
|
|
705054
|
+
await conversation.send({
|
|
705055
|
+
type: 'text',
|
|
705056
|
+
payload: { text: 'Welcome!' }
|
|
705057
|
+
})
|
|
705058
|
+
}
|
|
705059
|
+
|
|
705060
|
+
if (type === 'message' && message?.type === 'text') {
|
|
705061
|
+
// Handle regular messages
|
|
705062
|
+
await execute({ instructions: '...' })
|
|
705063
|
+
}
|
|
705064
|
+
}
|
|
705065
|
+
})
|
|
705066
|
+
\`\`\`
|
|
705067
|
+
|
|
705068
|
+
### Workflow Request Handling
|
|
705069
|
+
|
|
705070
|
+
Handle data requests from workflows:
|
|
705071
|
+
|
|
705072
|
+
\`\`\`typescript
|
|
705073
|
+
import { isWorkflowDataRequest } from '@botpress/runtime'
|
|
705074
|
+
|
|
705075
|
+
handler: async ({ type, event, execute }) => {
|
|
705076
|
+
// Check if this is a workflow requesting data
|
|
705077
|
+
if (type === 'workflow_request' && isWorkflowDataRequest(event)) {
|
|
705078
|
+
const userInput = await promptUser(event.payload.message)
|
|
705079
|
+
|
|
705080
|
+
// Provide data back to workflow
|
|
705081
|
+
await workflow.provide(event, { topic: userInput })
|
|
705082
|
+
return
|
|
705083
|
+
}
|
|
705084
|
+
|
|
705085
|
+
// Regular message handling
|
|
705086
|
+
await execute({ instructions: '...' })
|
|
705087
|
+
}
|
|
705088
|
+
\`\`\`
|
|
705089
|
+
|
|
705090
|
+
### Typed Workflow Interactions
|
|
705091
|
+
|
|
705092
|
+
Work with typed workflow instances:
|
|
705093
|
+
|
|
705094
|
+
\`\`\`typescript
|
|
705095
|
+
import { isWorkflow, ResearchWorkflow } from '@botpress/runtime'
|
|
705096
|
+
|
|
705097
|
+
handler: async ({ state }) => {
|
|
705098
|
+
if (state.research && isWorkflow(state.research, 'research')) {
|
|
705099
|
+
// state.research is now typed as ResearchWorkflow
|
|
705100
|
+
console.log(state.research.status)
|
|
705101
|
+
console.log(state.research.output) // Typed output
|
|
705102
|
+
|
|
705103
|
+
if (state.research.status === 'completed') {
|
|
705104
|
+
await conversation.send({
|
|
705105
|
+
type: 'text',
|
|
705106
|
+
payload: { text: state.research.output.result }
|
|
705107
|
+
})
|
|
705108
|
+
}
|
|
705109
|
+
}
|
|
705110
|
+
}
|
|
705111
|
+
\`\`\`
|
|
705112
|
+
|
|
705113
|
+
### Dynamic Tools Based on State
|
|
705114
|
+
|
|
705115
|
+
Provide different tools based on conversation state:
|
|
705116
|
+
|
|
705117
|
+
\`\`\`typescript
|
|
705118
|
+
handler: async ({ state, execute }) => {
|
|
705119
|
+
const tools = () => {
|
|
705120
|
+
if (state.workflowRunning) {
|
|
705121
|
+
return [cancelWorkflowTool, checkStatusTool]
|
|
705122
|
+
} else {
|
|
705123
|
+
return [startWorkflowTool, browseTool, searchTool]
|
|
705124
|
+
}
|
|
705125
|
+
}
|
|
705126
|
+
|
|
705127
|
+
await execute({
|
|
705128
|
+
instructions: '...',
|
|
705129
|
+
tools: tools()
|
|
705130
|
+
})
|
|
705131
|
+
}
|
|
705132
|
+
\`\`\`
|
|
705133
|
+
|
|
705134
|
+
### Message Sending
|
|
705135
|
+
|
|
705136
|
+
Send different message types:
|
|
705137
|
+
|
|
705138
|
+
\`\`\`typescript
|
|
705139
|
+
// Text message
|
|
705140
|
+
await conversation.send({
|
|
705141
|
+
type: 'text',
|
|
705142
|
+
payload: { text: 'Hello!' }
|
|
705143
|
+
})
|
|
705144
|
+
|
|
705145
|
+
// Custom message type (integration-specific)
|
|
705146
|
+
await conversation.send({
|
|
705147
|
+
type: 'custom:messageType',
|
|
705148
|
+
payload: { data: 'custom payload' }
|
|
705149
|
+
})
|
|
705150
|
+
\`\`\`
|
|
705151
|
+
|
|
705152
|
+
## Citations System
|
|
705153
|
+
|
|
705154
|
+
Track and manage source citations for LLM responses:
|
|
705155
|
+
|
|
705156
|
+
### CitationsManager
|
|
705157
|
+
|
|
705158
|
+
Access via context:
|
|
705159
|
+
|
|
705160
|
+
\`\`\`typescript
|
|
705161
|
+
import { context } from '@botpress/runtime'
|
|
705162
|
+
|
|
705163
|
+
const citations = context.get('citations')
|
|
705164
|
+
\`\`\`
|
|
705165
|
+
|
|
705166
|
+
### Registering Sources
|
|
705167
|
+
|
|
705168
|
+
Register sources that can be cited:
|
|
705169
|
+
|
|
705170
|
+
\`\`\`typescript
|
|
705171
|
+
// Register with URL
|
|
705172
|
+
const { tag } = citations.registerSource({
|
|
705173
|
+
url: 'https://example.com/doc',
|
|
705174
|
+
title: 'Documentation Page'
|
|
705175
|
+
})
|
|
705176
|
+
|
|
705177
|
+
// Register with file reference
|
|
705178
|
+
const { tag } = citations.registerSource({
|
|
705179
|
+
file: fileKey,
|
|
705180
|
+
title: 'Internal Document'
|
|
705181
|
+
})
|
|
705182
|
+
\`\`\`
|
|
705183
|
+
|
|
705184
|
+
### Using Citation Tags
|
|
705185
|
+
|
|
705186
|
+
Inject citation tags into LLM content:
|
|
705187
|
+
|
|
705188
|
+
\`\`\`typescript
|
|
705189
|
+
const results = await searchKnowledgeBase(query)
|
|
705190
|
+
|
|
705191
|
+
for (const result of results) {
|
|
705192
|
+
const { tag } = citations.registerSource({
|
|
705193
|
+
file: result.file.key,
|
|
705194
|
+
title: result.file.name
|
|
705195
|
+
})
|
|
705196
|
+
|
|
705197
|
+
content += \`\${result.content} \${tag}\\n\`
|
|
705198
|
+
}
|
|
705199
|
+
|
|
705200
|
+
// Return cited content
|
|
705201
|
+
throw new ThinkSignal('results', content)
|
|
705202
|
+
\`\`\`
|
|
705203
|
+
|
|
705204
|
+
### Citation Format
|
|
705205
|
+
|
|
705206
|
+
Citations are automatically formatted with tags like \`[1]\`, \`[2]\`, etc., and tracked by the system for reference.
|
|
705207
|
+
|
|
705208
|
+
### Example: Tool with Citations
|
|
705209
|
+
|
|
705210
|
+
\`\`\`typescript
|
|
705211
|
+
export default new Autonomous.Tool({
|
|
705212
|
+
name: 'search_docs',
|
|
705213
|
+
description: 'Search documentation',
|
|
705214
|
+
handler: async ({ query }) => {
|
|
705215
|
+
const citations = context.get('citations')
|
|
705216
|
+
const results = await searchDocs(query)
|
|
705217
|
+
|
|
705218
|
+
let response = ''
|
|
705219
|
+
for (const doc of results) {
|
|
705220
|
+
const { tag } = citations.registerSource({
|
|
705221
|
+
url: doc.url,
|
|
705222
|
+
title: doc.title
|
|
705223
|
+
})
|
|
705224
|
+
response += \`\${doc.content} \${tag}\\n\\n\`
|
|
705225
|
+
}
|
|
705226
|
+
|
|
705227
|
+
return response
|
|
705228
|
+
}
|
|
705229
|
+
})
|
|
705230
|
+
\`\`\`
|
|
705231
|
+
|
|
705232
|
+
## Common Mistakes to Avoid
|
|
705233
|
+
|
|
705234
|
+
### 1. Wrong Zai Import
|
|
705235
|
+
\`\`\`typescript
|
|
705236
|
+
// \u274C WRONG
|
|
705237
|
+
import { zai } from '@botpress/runtime'
|
|
705238
|
+
const result = await zai.extract(...)
|
|
705239
|
+
|
|
705240
|
+
// \u2705 CORRECT
|
|
705241
|
+
import { adk } from '@botpress/runtime'
|
|
705242
|
+
const result = await adk.zai.extract(...)
|
|
705243
|
+
\`\`\`
|
|
705244
|
+
|
|
705245
|
+
### 2. Expecting \`.output\` from zai.extract
|
|
705246
|
+
\`\`\`typescript
|
|
705247
|
+
// \u274C WRONG - zai.extract returns data directly
|
|
705248
|
+
const result = await adk.zai.extract(input, schema)
|
|
705249
|
+
console.log(result.output) // undefined!
|
|
705250
|
+
|
|
705251
|
+
// \u2705 CORRECT
|
|
705252
|
+
const result = await adk.zai.extract(input, schema)
|
|
705253
|
+
console.log(result) // { name: "John", age: 30 }
|
|
705254
|
+
\`\`\`
|
|
705255
|
+
|
|
705256
|
+
### 3. Wrong Exit Result Handling
|
|
705257
|
+
\`\`\`typescript
|
|
705258
|
+
// \u274C WRONG
|
|
705259
|
+
if (result.exit?.name === 'my_exit') {
|
|
705260
|
+
const data = result.exit.value
|
|
705261
|
+
}
|
|
705262
|
+
|
|
705263
|
+
// \u2705 CORRECT
|
|
705264
|
+
if (result.is(MyExit)) {
|
|
705265
|
+
const data = result.output // Type-safe!
|
|
705266
|
+
}
|
|
705267
|
+
\`\`\`
|
|
705268
|
+
|
|
705269
|
+
### 4. Reserved Table Column Names
|
|
705270
|
+
\`\`\`typescript
|
|
705271
|
+
// \u274C WRONG - These are reserved
|
|
705272
|
+
columns: {
|
|
705273
|
+
id: z.string(),
|
|
705274
|
+
createdAt: z.string(),
|
|
705275
|
+
updatedAt: z.string()
|
|
705276
|
+
}
|
|
705277
|
+
|
|
705278
|
+
// \u2705 CORRECT - Use alternatives
|
|
705279
|
+
columns: {
|
|
705280
|
+
visibleId: z.string(),
|
|
705281
|
+
savedAt: z.string(),
|
|
705282
|
+
modifiedAt: z.string()
|
|
705283
|
+
}
|
|
705284
|
+
\`\`\`
|
|
705285
|
+
|
|
705286
|
+
### 5. Re-exporting Auto-Registered Files
|
|
705287
|
+
\`\`\`typescript
|
|
705288
|
+
// \u274C WRONG - src/tables/index.ts
|
|
705289
|
+
export { MyTable } from "./myTable" // Causes duplicates!
|
|
705290
|
+
|
|
705291
|
+
// \u2705 CORRECT - Leave index.ts empty
|
|
705292
|
+
// Files in src/tables/, src/conversations/, etc. are auto-registered
|
|
705293
|
+
\`\`\`
|
|
705294
|
+
|
|
705295
|
+
### 6. Table Name Missing "Table" Suffix
|
|
705296
|
+
\`\`\`typescript
|
|
705297
|
+
// \u274C WRONG
|
|
705298
|
+
name: "users"
|
|
705299
|
+
name: "user_data"
|
|
705300
|
+
|
|
705301
|
+
// \u2705 CORRECT
|
|
705302
|
+
name: "usersTable"
|
|
705303
|
+
name: "userdataTable"
|
|
705304
|
+
\`\`\`
|
|
705305
|
+
|
|
705306
|
+
## When Making Changes
|
|
705307
|
+
|
|
705308
|
+
1. **Always search Botpress docs** using \`mcp__botpress-docs__SearchBotpress\`
|
|
705309
|
+
2. **Check examples** for patterns
|
|
705310
|
+
3. **Regenerate types** after changing \`agent.config.ts\` (run \`adk dev\`)
|
|
705311
|
+
4. **Test in dev mode** with hot reloading (\`adk dev\`)
|
|
705312
|
+
5. **Follow TypeScript types** - They're auto-generated from integrations
|
|
705313
|
+
|
|
705314
|
+
## Resources
|
|
705315
|
+
|
|
705316
|
+
- [ADK Overview](https://botpress.com/docs/for-developers/adk/overview)
|
|
705317
|
+
- [ADK Getting Started](https://botpress.com/docs/for-developers/adk/getting-started)
|
|
705318
|
+
- [Project Structure](https://botpress.com/docs/for-developers/adk/project-structure)
|
|
705319
|
+
- [Conversations](https://botpress.com/docs/for-developers/adk/concepts/conversations)
|
|
705320
|
+
- [Workflows](https://botpress.com/docs/for-developers/adk/concepts/workflows)
|
|
705321
|
+
`, getIntegrationHash = (integration) => {
|
|
704070
705322
|
return crypto24.createHash("sha256").update(`${integration.alias}|${integration.definition?.id}|${integration.definition?.version}|${integration.definition?.updatedAt}`).digest("hex");
|
|
704071
705323
|
}, getPascalAlias = (integration) => pascalCase(getIntegrationAlias(integration.alias)), getIntegrationNames = (integration) => ({
|
|
704072
705324
|
typings: {
|
|
@@ -704111,7 +705363,7 @@ var import_ts_morph, __defProp11, __commonJS7 = (cb4, mod) => () => (mod || cb4(
|
|
|
704111
705363
|
} catch {
|
|
704112
705364
|
try {
|
|
704113
705365
|
const adkPackagePath = join72(process.cwd(), "node_modules/@botpress/adk/package.json");
|
|
704114
|
-
const pkg = JSON.parse(
|
|
705366
|
+
const pkg = JSON.parse(readFileSync6(adkPackagePath, "utf-8"));
|
|
704115
705367
|
return pkg.version;
|
|
704116
705368
|
} catch {
|
|
704117
705369
|
return "unknown";
|
|
@@ -704124,7 +705376,7 @@ var import_ts_morph, __defProp11, __commonJS7 = (cb4, mod) => () => (mod || cb4(
|
|
|
704124
705376
|
} catch {
|
|
704125
705377
|
try {
|
|
704126
705378
|
const adkPackagePath = join9(process.cwd(), "node_modules/@botpress/adk/package.json");
|
|
704127
|
-
const pkg = JSON.parse(
|
|
705379
|
+
const pkg = JSON.parse(readFileSync22(adkPackagePath, "utf-8"));
|
|
704128
705380
|
return pkg.version;
|
|
704129
705381
|
} catch {
|
|
704130
705382
|
return "unknown";
|
|
@@ -704278,7 +705530,7 @@ var init_dist17 = __esm(() => {
|
|
|
704278
705530
|
require_package3 = __commonJS7((exports7, module) => {
|
|
704279
705531
|
module.exports = {
|
|
704280
705532
|
name: "@botpress/adk",
|
|
704281
|
-
version: "1.11.
|
|
705533
|
+
version: "1.11.9",
|
|
704282
705534
|
description: "Core ADK library for building AI agents on Botpress",
|
|
704283
705535
|
type: "module",
|
|
704284
705536
|
main: "dist/index.js",
|
|
@@ -704325,7 +705577,7 @@ var init_dist17 = __esm(() => {
|
|
|
704325
705577
|
"@botpress/cli": "^4.27.3",
|
|
704326
705578
|
"@botpress/client": "^1.27.2",
|
|
704327
705579
|
"@botpress/cognitive": "^0.2.0",
|
|
704328
|
-
"@botpress/runtime": "^1.11.
|
|
705580
|
+
"@botpress/runtime": "^1.11.9",
|
|
704329
705581
|
"@botpress/sdk": "^4.18.1",
|
|
704330
705582
|
"@bpinternal/jex": "^1.2.4",
|
|
704331
705583
|
"@bpinternal/yargs-extra": "^0.0.21",
|
|
@@ -705684,8 +706936,6 @@ ${this.stderrLines.join(`
|
|
|
705684
706936
|
init_agent_resolver();
|
|
705685
706937
|
init_types6();
|
|
705686
706938
|
init_utils8();
|
|
705687
|
-
__filename2 = fileURLToPath7(import.meta.url);
|
|
705688
|
-
__dirname2 = path15.dirname(__filename2);
|
|
705689
706939
|
init_fs();
|
|
705690
706940
|
init_utils8();
|
|
705691
706941
|
init_utils8();
|
|
@@ -706091,7 +707341,7 @@ function pathKey2(options = {}) {
|
|
|
706091
707341
|
// ../../node_modules/clipboardy/node_modules/execa/node_modules/npm-run-path/index.js
|
|
706092
707342
|
import process26 from "process";
|
|
706093
707343
|
import path35 from "path";
|
|
706094
|
-
import { fileURLToPath as
|
|
707344
|
+
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
706095
707345
|
var npmRunPath2 = ({
|
|
706096
707346
|
cwd: cwd4 = process26.cwd(),
|
|
706097
707347
|
path: pathOption = process26.env[pathKey2()],
|
|
@@ -706099,7 +707349,7 @@ var npmRunPath2 = ({
|
|
|
706099
707349
|
execPath: execPath3 = process26.execPath,
|
|
706100
707350
|
addExecPath = true
|
|
706101
707351
|
} = {}) => {
|
|
706102
|
-
const cwdString = cwd4 instanceof URL ?
|
|
707352
|
+
const cwdString = cwd4 instanceof URL ? fileURLToPath7(cwd4) : cwd4;
|
|
706103
707353
|
const cwdPath = path35.resolve(cwdString);
|
|
706104
707354
|
const result = [];
|
|
706105
707355
|
if (preferLocal) {
|
|
@@ -706117,7 +707367,7 @@ var npmRunPath2 = ({
|
|
|
706117
707367
|
cwdPath = path35.resolve(cwdPath, "..");
|
|
706118
707368
|
}
|
|
706119
707369
|
}, applyExecPath2 = (result, execPath3, cwdPath) => {
|
|
706120
|
-
const execPathString = execPath3 instanceof URL ?
|
|
707370
|
+
const execPathString = execPath3 instanceof URL ? fileURLToPath7(execPath3) : execPath3;
|
|
706121
707371
|
result.push(path35.resolve(cwdPath, execPathString, ".."));
|
|
706122
707372
|
}, npmRunPathEnv2 = ({ env: env6 = process26.env, ...options } = {}) => {
|
|
706123
707373
|
env6 = { ...env6 };
|
|
@@ -707452,8 +708702,8 @@ var init_termux = __esm(() => {
|
|
|
707452
708702
|
|
|
707453
708703
|
// ../../node_modules/clipboardy/lib/linux.js
|
|
707454
708704
|
import path38 from "path";
|
|
707455
|
-
import { fileURLToPath as
|
|
707456
|
-
var
|
|
708705
|
+
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
708706
|
+
var __dirname2, xsel = "xsel", xselFallback, copyArguments, pasteArguments, makeError3 = (xselError, fallbackError) => {
|
|
707457
708707
|
let error;
|
|
707458
708708
|
if (xselError.code === "ENOENT") {
|
|
707459
708709
|
error = new Error("Couldn't find the `xsel` binary and fallback didn't work. On Debian/Ubuntu you can install xsel with: sudo apt install xsel");
|
|
@@ -707488,8 +708738,8 @@ var __dirname3, xsel = "xsel", xselFallback, copyArguments, pasteArguments, make
|
|
|
707488
708738
|
}, clipboard2, linux_default;
|
|
707489
708739
|
var init_linux = __esm(() => {
|
|
707490
708740
|
init_execa2();
|
|
707491
|
-
|
|
707492
|
-
xselFallback = path38.join(
|
|
708741
|
+
__dirname2 = path38.dirname(fileURLToPath8(import.meta.url));
|
|
708742
|
+
xselFallback = path38.join(__dirname2, "../fallbacks/linux/xsel");
|
|
707493
708743
|
copyArguments = ["--clipboard", "--input"];
|
|
707494
708744
|
pasteArguments = ["--clipboard", "--output"];
|
|
707495
708745
|
clipboard2 = {
|
|
@@ -707570,14 +708820,14 @@ var init_is64bit = __esm(() => {
|
|
|
707570
708820
|
|
|
707571
708821
|
// ../../node_modules/clipboardy/lib/windows.js
|
|
707572
708822
|
import path39 from "path";
|
|
707573
|
-
import { fileURLToPath as
|
|
707574
|
-
var
|
|
708823
|
+
import { fileURLToPath as fileURLToPath9 } from "url";
|
|
708824
|
+
var __dirname3, binarySuffix, windowBinaryPath, clipboard4, windows_default;
|
|
707575
708825
|
var init_windows = __esm(() => {
|
|
707576
708826
|
init_execa2();
|
|
707577
708827
|
init_is64bit();
|
|
707578
|
-
|
|
708828
|
+
__dirname3 = path39.dirname(fileURLToPath9(import.meta.url));
|
|
707579
708829
|
binarySuffix = is64bitSync() ? "x86_64" : "i686";
|
|
707580
|
-
windowBinaryPath = path39.join(
|
|
708830
|
+
windowBinaryPath = path39.join(__dirname3, `../fallbacks/windows/clipboard_${binarySuffix}.exe`);
|
|
707581
708831
|
clipboard4 = {
|
|
707582
708832
|
copy: async (options) => execa2(windowBinaryPath, ["--copy"], options),
|
|
707583
708833
|
async paste(options) {
|
|
@@ -709289,7 +710539,7 @@ var init_default_browser = __esm(() => {
|
|
|
709289
710539
|
import process36 from "process";
|
|
709290
710540
|
import { Buffer as Buffer8 } from "buffer";
|
|
709291
710541
|
import path40 from "path";
|
|
709292
|
-
import { fileURLToPath as
|
|
710542
|
+
import { fileURLToPath as fileURLToPath10 } from "url";
|
|
709293
710543
|
import { promisify as promisify9 } from "util";
|
|
709294
710544
|
import childProcess3 from "child_process";
|
|
709295
710545
|
import fs25, { constants as fsConstants2 } from "fs/promises";
|
|
@@ -709333,7 +710583,7 @@ function detectPlatformBinary({ [platform4]: platformBinary }, { wsl }) {
|
|
|
709333
710583
|
}
|
|
709334
710584
|
return detectArchBinary(platformBinary);
|
|
709335
710585
|
}
|
|
709336
|
-
var execFile5,
|
|
710586
|
+
var execFile5, __dirname4, localXdgOpenPath, platform4, arch3, pTryEach = async (array, mapper) => {
|
|
709337
710587
|
let latestError;
|
|
709338
710588
|
for (const item of array) {
|
|
709339
710589
|
try {
|
|
@@ -709446,7 +710696,7 @@ var execFile5, __dirname6, localXdgOpenPath, platform4, arch3, pTryEach = async
|
|
|
709446
710696
|
if (app) {
|
|
709447
710697
|
command = app;
|
|
709448
710698
|
} else {
|
|
709449
|
-
const isBundled = !
|
|
710699
|
+
const isBundled = !__dirname4 || __dirname4 === "/";
|
|
709450
710700
|
let exeLocalXdgOpen = false;
|
|
709451
710701
|
try {
|
|
709452
710702
|
await fs25.access(localXdgOpenPath, fsConstants2.X_OK);
|
|
@@ -709498,8 +710748,8 @@ var init_open = __esm(() => {
|
|
|
709498
710748
|
init_default_browser();
|
|
709499
710749
|
init_is_inside_container();
|
|
709500
710750
|
execFile5 = promisify9(childProcess3.execFile);
|
|
709501
|
-
|
|
709502
|
-
localXdgOpenPath = path40.join(
|
|
710751
|
+
__dirname4 = path40.dirname(fileURLToPath10(import.meta.url));
|
|
710752
|
+
localXdgOpenPath = path40.join(__dirname4, "xdg-open");
|
|
709503
710753
|
({ platform: platform4, arch: arch3 } = process36);
|
|
709504
710754
|
apps = {};
|
|
709505
710755
|
defineLazyProperty(apps, "chrome", () => detectPlatformBinary({
|
|
@@ -710874,7 +712124,7 @@ var init_Separator = __esm(async () => {
|
|
|
710874
712124
|
var require_package4 = __commonJS((exports7, module) => {
|
|
710875
712125
|
module.exports = {
|
|
710876
712126
|
name: "@botpress/adk",
|
|
710877
|
-
version: "1.11.
|
|
712127
|
+
version: "1.11.9",
|
|
710878
712128
|
description: "Core ADK library for building AI agents on Botpress",
|
|
710879
712129
|
type: "module",
|
|
710880
712130
|
main: "dist/index.js",
|
|
@@ -710921,7 +712171,7 @@ var require_package4 = __commonJS((exports7, module) => {
|
|
|
710921
712171
|
"@botpress/cli": "^4.27.3",
|
|
710922
712172
|
"@botpress/client": "^1.27.2",
|
|
710923
712173
|
"@botpress/cognitive": "^0.2.0",
|
|
710924
|
-
"@botpress/runtime": "^1.11.
|
|
712174
|
+
"@botpress/runtime": "^1.11.9",
|
|
710925
712175
|
"@botpress/sdk": "^4.18.1",
|
|
710926
712176
|
"@bpinternal/jex": "^1.2.4",
|
|
710927
712177
|
"@bpinternal/yargs-extra": "^0.0.21",
|
|
@@ -712832,19 +714082,16 @@ function getInstalledRuntimeVersion(agentRoot) {
|
|
|
712832
714082
|
function checkRuntimeVersion(agentRoot) {
|
|
712833
714083
|
const expectedVersion = EXPECTED_RUNTIME_VERSION;
|
|
712834
714084
|
const installedVersion = getInstalledRuntimeVersion(agentRoot);
|
|
712835
|
-
if (expectedVersion === "BUILD_TIME_REPLACEMENT" || installedVersion === null) {
|
|
712836
|
-
return;
|
|
712837
|
-
}
|
|
712838
714085
|
const expected = semver2.parse(expectedVersion);
|
|
712839
714086
|
const installed = semver2.parse(installedVersion);
|
|
712840
714087
|
if (!expected || !installed) {
|
|
712841
714088
|
return;
|
|
712842
714089
|
}
|
|
712843
|
-
if (semver2.
|
|
714090
|
+
if (!semver2.satisfies(installed, SUPPORTED_RUNTIME_RANGE)) {
|
|
712844
714091
|
console.error(source_default.red.bold(`
|
|
712845
|
-
\u2717 Runtime Version
|
|
714092
|
+
\u2717 Runtime Version Incompatible`));
|
|
712846
714093
|
console.error(source_default.red(` Your project is using @botpress/runtime v${installedVersion}`));
|
|
712847
|
-
console.error(source_default.red(` This CLI requires @botpress/runtime
|
|
714094
|
+
console.error(source_default.red(` This CLI requires @botpress/runtime ${SUPPORTED_RUNTIME_RANGE}
|
|
712848
714095
|
`));
|
|
712849
714096
|
console.error(source_default.yellow(" To fix this, update your package.json:"));
|
|
712850
714097
|
console.error(source_default.white(` "@botpress/runtime": "^${expectedVersion}"
|
|
@@ -712854,21 +714101,17 @@ function checkRuntimeVersion(agentRoot) {
|
|
|
712854
714101
|
`));
|
|
712855
714102
|
process.exit(1);
|
|
712856
714103
|
}
|
|
712857
|
-
if (semver2.
|
|
712858
|
-
console.warn(source_default.yellow
|
|
712859
|
-
\u26A0
|
|
712860
|
-
console.warn(source_default.
|
|
712861
|
-
console.warn(source_default.yellow(` This CLI was built for @botpress/runtime v${expectedVersion}
|
|
712862
|
-
`));
|
|
712863
|
-
console.warn(source_default.dim(" Consider upgrading your CLI to the latest version:"));
|
|
712864
|
-
console.warn(source_default.dim(` adk self-upgrade
|
|
714104
|
+
if (semver2.lt(installed, expected)) {
|
|
714105
|
+
console.warn(source_default.yellow(`
|
|
714106
|
+
\u26A0 A newer version of @botpress/runtime is available (v${expectedVersion})`));
|
|
714107
|
+
console.warn(source_default.dim(` You are using v${installedVersion}
|
|
712865
714108
|
`));
|
|
712866
|
-
console.warn(source_default.dim("
|
|
714109
|
+
console.warn(source_default.dim(" To upgrade, update your package.json:"));
|
|
712867
714110
|
console.warn(source_default.dim(` "@botpress/runtime": "^${expectedVersion}"
|
|
712868
714111
|
`));
|
|
712869
714112
|
}
|
|
712870
714113
|
}
|
|
712871
|
-
var semver2, EXPECTED_RUNTIME_VERSION = "1.11.
|
|
714114
|
+
var semver2, EXPECTED_RUNTIME_VERSION = "1.11.9", SUPPORTED_RUNTIME_RANGE = ">=1.11.0";
|
|
712872
714115
|
var init_runtime_version_check = __esm(() => {
|
|
712873
714116
|
init_source();
|
|
712874
714117
|
semver2 = __toESM(require_semver2(), 1);
|
|
@@ -716646,17 +717889,17 @@ function getContentType(pathname) {
|
|
|
716646
717889
|
import { readFileSync as readFileSync14, existsSync as existsSync15 } from "fs";
|
|
716647
717890
|
import { join as join16, resolve as resolve5 } from "path";
|
|
716648
717891
|
import path41 from "path";
|
|
716649
|
-
import { fileURLToPath as
|
|
717892
|
+
import { fileURLToPath as fileURLToPath11 } from "url";
|
|
716650
717893
|
function getUIDistPath() {
|
|
716651
|
-
const
|
|
716652
|
-
const
|
|
716653
|
-
const isBinary = !
|
|
717894
|
+
const __filename2 = fileURLToPath11(import.meta.url);
|
|
717895
|
+
const __dirname5 = path41.dirname(__filename2);
|
|
717896
|
+
const isBinary = !__filename2.endsWith(".js") && !__filename2.endsWith(".ts");
|
|
716654
717897
|
if (isBinary) {
|
|
716655
717898
|
const execDir = path41.dirname(process.execPath);
|
|
716656
717899
|
return resolve5(execDir, "assets/ui-dist");
|
|
716657
717900
|
} else {
|
|
716658
|
-
const isCompiledDist =
|
|
716659
|
-
return isCompiledDist ? resolve5(
|
|
717901
|
+
const isCompiledDist = __filename2.includes("/dist/");
|
|
717902
|
+
return isCompiledDist ? resolve5(__dirname5, "../assets/ui-dist") : resolve5(__dirname5, "../../assets/ui-dist");
|
|
716660
717903
|
}
|
|
716661
717904
|
}
|
|
716662
717905
|
function serveStaticFile(pathname, uiDistPath) {
|
|
@@ -722748,7 +723991,7 @@ var stripTrailingSlashes = (str) => {
|
|
|
722748
723991
|
|
|
722749
723992
|
// ../../node_modules/tar/dist/esm/list.js
|
|
722750
723993
|
import fs28 from "fs";
|
|
722751
|
-
import { dirname as
|
|
723994
|
+
import { dirname as dirname4, parse as parse9 } from "path";
|
|
722752
723995
|
var onReadEntryFunction = (opt) => {
|
|
722753
723996
|
const onReadEntry = opt.onReadEntry;
|
|
722754
723997
|
opt.onReadEntry = onReadEntry ? (e6) => {
|
|
@@ -722768,7 +724011,7 @@ var onReadEntryFunction = (opt) => {
|
|
|
722768
724011
|
if (m2 !== undefined) {
|
|
722769
724012
|
ret = m2;
|
|
722770
724013
|
} else {
|
|
722771
|
-
ret = mapHas(
|
|
724014
|
+
ret = mapHas(dirname4(file), root5);
|
|
722772
724015
|
}
|
|
722773
724016
|
}
|
|
722774
724017
|
map.set(file, ret);
|
|
@@ -727981,7 +729224,7 @@ __export(exports_upgrade, {
|
|
|
727981
729224
|
adkSelfUpgrade: () => adkSelfUpgrade
|
|
727982
729225
|
});
|
|
727983
729226
|
import { existsSync as existsSync17, writeFileSync as writeFileSync6, chmodSync, renameSync, unlinkSync, readFileSync as readFileSync16, mkdirSync as mkdirSync5, rmdirSync, accessSync, constants as constants8 } from "fs";
|
|
727984
|
-
import { join as join19, dirname as
|
|
729227
|
+
import { join as join19, dirname as dirname5 } from "path";
|
|
727985
729228
|
import { tmpdir } from "os";
|
|
727986
729229
|
import { execSync as execSync4 } from "child_process";
|
|
727987
729230
|
function getPlatformInfo() {
|
|
@@ -728069,7 +729312,7 @@ function getCurrentBinaryPath() {
|
|
|
728069
729312
|
}
|
|
728070
729313
|
function checkWritePermissions(path36) {
|
|
728071
729314
|
try {
|
|
728072
|
-
const dir =
|
|
729315
|
+
const dir = dirname5(path36);
|
|
728073
729316
|
accessSync(dir, constants8.W_OK);
|
|
728074
729317
|
if (existsSync17(path36)) {
|
|
728075
729318
|
accessSync(path36, constants8.W_OK);
|
|
@@ -744043,8 +745286,8 @@ var init_dist18 = __esm(() => {
|
|
|
744043
745286
|
n3 && E && (a2 = E(n3.prototype));
|
|
744044
745287
|
}
|
|
744045
745288
|
return ye3[t9] = a2, a2;
|
|
744046
|
-
}, Io3 = { __proto__: null, "%ArrayBufferPrototype%": ["ArrayBuffer", "prototype"], "%ArrayPrototype%": ["Array", "prototype"], "%ArrayProto_entries%": ["Array", "prototype", "entries"], "%ArrayProto_forEach%": ["Array", "prototype", "forEach"], "%ArrayProto_keys%": ["Array", "prototype", "keys"], "%ArrayProto_values%": ["Array", "prototype", "values"], "%AsyncFunctionPrototype%": ["AsyncFunction", "prototype"], "%AsyncGenerator%": ["AsyncGeneratorFunction", "prototype"], "%AsyncGeneratorPrototype%": ["AsyncGeneratorFunction", "prototype", "prototype"], "%BooleanPrototype%": ["Boolean", "prototype"], "%DataViewPrototype%": ["DataView", "prototype"], "%DatePrototype%": ["Date", "prototype"], "%ErrorPrototype%": ["Error", "prototype"], "%EvalErrorPrototype%": ["EvalError", "prototype"], "%Float32ArrayPrototype%": ["Float32Array", "prototype"], "%Float64ArrayPrototype%": ["Float64Array", "prototype"], "%FunctionPrototype%": ["Function", "prototype"], "%Generator%": ["GeneratorFunction", "prototype"], "%GeneratorPrototype%": ["GeneratorFunction", "prototype", "prototype"], "%Int8ArrayPrototype%": ["Int8Array", "prototype"], "%Int16ArrayPrototype%": ["Int16Array", "prototype"], "%Int32ArrayPrototype%": ["Int32Array", "prototype"], "%JSONParse%": ["JSON", "parse"], "%JSONStringify%": ["JSON", "stringify"], "%MapPrototype%": ["Map", "prototype"], "%NumberPrototype%": ["Number", "prototype"], "%ObjectPrototype%": ["Object", "prototype"], "%ObjProto_toString%": ["Object", "prototype", "toString"], "%ObjProto_valueOf%": ["Object", "prototype", "valueOf"], "%PromisePrototype%": ["Promise", "prototype"], "%PromiseProto_then%": ["Promise", "prototype", "then"], "%Promise_all%": ["Promise", "all"], "%Promise_reject%": ["Promise", "reject"], "%Promise_resolve%": ["Promise", "resolve"], "%RangeErrorPrototype%": ["RangeError", "prototype"], "%ReferenceErrorPrototype%": ["ReferenceError", "prototype"], "%RegExpPrototype%": ["RegExp", "prototype"], "%SetPrototype%": ["Set", "prototype"], "%SharedArrayBufferPrototype%": ["SharedArrayBuffer", "prototype"], "%StringPrototype%": ["String", "prototype"], "%SymbolPrototype%": ["Symbol", "prototype"], "%SyntaxErrorPrototype%": ["SyntaxError", "prototype"], "%TypedArrayPrototype%": ["TypedArray", "prototype"], "%TypeErrorPrototype%": ["TypeError", "prototype"], "%Uint8ArrayPrototype%": ["Uint8Array", "prototype"], "%Uint8ClampedArrayPrototype%": ["Uint8ClampedArray", "prototype"], "%Uint16ArrayPrototype%": ["Uint16Array", "prototype"], "%Uint32ArrayPrototype%": ["Uint32Array", "prototype"], "%URIErrorPrototype%": ["URIError", "prototype"], "%WeakMapPrototype%": ["WeakMap", "prototype"], "%WeakSetPrototype%": ["WeakSet", "prototype"] }, Ke3 = ge2(), lt5 = Ys4(), Tk3 = Ke3.call(Ve, Array.prototype.concat), Ck3 = Ke3.call(Ao3, Array.prototype.splice), ko3 = Ke3.call(Ve, String.prototype.replace),
|
|
744047
|
-
var a2 =
|
|
745289
|
+
}, Io3 = { __proto__: null, "%ArrayBufferPrototype%": ["ArrayBuffer", "prototype"], "%ArrayPrototype%": ["Array", "prototype"], "%ArrayProto_entries%": ["Array", "prototype", "entries"], "%ArrayProto_forEach%": ["Array", "prototype", "forEach"], "%ArrayProto_keys%": ["Array", "prototype", "keys"], "%ArrayProto_values%": ["Array", "prototype", "values"], "%AsyncFunctionPrototype%": ["AsyncFunction", "prototype"], "%AsyncGenerator%": ["AsyncGeneratorFunction", "prototype"], "%AsyncGeneratorPrototype%": ["AsyncGeneratorFunction", "prototype", "prototype"], "%BooleanPrototype%": ["Boolean", "prototype"], "%DataViewPrototype%": ["DataView", "prototype"], "%DatePrototype%": ["Date", "prototype"], "%ErrorPrototype%": ["Error", "prototype"], "%EvalErrorPrototype%": ["EvalError", "prototype"], "%Float32ArrayPrototype%": ["Float32Array", "prototype"], "%Float64ArrayPrototype%": ["Float64Array", "prototype"], "%FunctionPrototype%": ["Function", "prototype"], "%Generator%": ["GeneratorFunction", "prototype"], "%GeneratorPrototype%": ["GeneratorFunction", "prototype", "prototype"], "%Int8ArrayPrototype%": ["Int8Array", "prototype"], "%Int16ArrayPrototype%": ["Int16Array", "prototype"], "%Int32ArrayPrototype%": ["Int32Array", "prototype"], "%JSONParse%": ["JSON", "parse"], "%JSONStringify%": ["JSON", "stringify"], "%MapPrototype%": ["Map", "prototype"], "%NumberPrototype%": ["Number", "prototype"], "%ObjectPrototype%": ["Object", "prototype"], "%ObjProto_toString%": ["Object", "prototype", "toString"], "%ObjProto_valueOf%": ["Object", "prototype", "valueOf"], "%PromisePrototype%": ["Promise", "prototype"], "%PromiseProto_then%": ["Promise", "prototype", "then"], "%Promise_all%": ["Promise", "all"], "%Promise_reject%": ["Promise", "reject"], "%Promise_resolve%": ["Promise", "resolve"], "%RangeErrorPrototype%": ["RangeError", "prototype"], "%ReferenceErrorPrototype%": ["ReferenceError", "prototype"], "%RegExpPrototype%": ["RegExp", "prototype"], "%SetPrototype%": ["Set", "prototype"], "%SharedArrayBufferPrototype%": ["SharedArrayBuffer", "prototype"], "%StringPrototype%": ["String", "prototype"], "%SymbolPrototype%": ["Symbol", "prototype"], "%SyntaxErrorPrototype%": ["SyntaxError", "prototype"], "%TypedArrayPrototype%": ["TypedArray", "prototype"], "%TypeErrorPrototype%": ["TypeError", "prototype"], "%Uint8ArrayPrototype%": ["Uint8Array", "prototype"], "%Uint8ClampedArrayPrototype%": ["Uint8ClampedArray", "prototype"], "%Uint16ArrayPrototype%": ["Uint16Array", "prototype"], "%Uint32ArrayPrototype%": ["Uint32Array", "prototype"], "%URIErrorPrototype%": ["URIError", "prototype"], "%WeakMapPrototype%": ["WeakMap", "prototype"], "%WeakSetPrototype%": ["WeakSet", "prototype"] }, Ke3 = ge2(), lt5 = Ys4(), Tk3 = Ke3.call(Ve, Array.prototype.concat), Ck3 = Ke3.call(Ao3, Array.prototype.splice), ko3 = Ke3.call(Ve, String.prototype.replace), gt3 = Ke3.call(Ve, String.prototype.slice), wk3 = Ke3.call(Ve, RegExp.prototype.exec), Uk3 = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g, Gk3 = /\\(\\)?/g, Ek3 = function(t9) {
|
|
745290
|
+
var a2 = gt3(t9, 0, 1), r = gt3(t9, -1);
|
|
744048
745291
|
if (a2 === "%" && r !== "%")
|
|
744049
745292
|
throw new Ce3("invalid intrinsic syntax, expected closing `%`");
|
|
744050
745293
|
if (r === "%" && a2 !== "%")
|
|
@@ -744073,7 +745316,7 @@ var init_dist18 = __esm(() => {
|
|
|
744073
745316
|
var r = Ek3(t9), n3 = r.length > 0 ? r[0] : "", o2 = Lk3("%" + n3 + "%", a2), i2 = o2.name, p = o2.value, u2 = false, s2 = o2.alias;
|
|
744074
745317
|
s2 && (n3 = s2[0], Ck3(r, Tk3([0, 1], s2)));
|
|
744075
745318
|
for (var y = 1, P = true;y < r.length; y += 1) {
|
|
744076
|
-
var q3 = r[y], x =
|
|
745319
|
+
var q3 = r[y], x = gt3(q3, 0, 1), f = gt3(q3, -1);
|
|
744077
745320
|
if ((x === '"' || x === "'" || x === "`" || f === '"' || f === "'" || f === "`") && x !== f)
|
|
744078
745321
|
throw new Ce3("property names with quotes must have matching quotes");
|
|
744079
745322
|
if ((q3 === "constructor" || !P) && (u2 = true), n3 += "." + q3, i2 = "%" + n3 + "%", lt5(ye3, i2))
|
|
@@ -745989,7 +747232,7 @@ __export(exports_dist9, {
|
|
|
745989
747232
|
Plugin: () => ql3,
|
|
745990
747233
|
ParseStatus: () => Tt5,
|
|
745991
747234
|
ParseInputLazyPath: () => Ot5,
|
|
745992
|
-
OK: () =>
|
|
747235
|
+
OK: () => gt3,
|
|
745993
747236
|
NEVER: () => UP3,
|
|
745994
747237
|
InterfaceDefinition: () => Kl5,
|
|
745995
747238
|
IntegrationSpecificClient: () => ni3,
|
|
@@ -752536,7 +753779,7 @@ var import_browser_or_node9, Xa3, $v3, jv3, Kv3, ot5 = (t9, e11) => () => (t9 &&
|
|
|
752536
753779
|
}
|
|
752537
753780
|
return { status: e11.value, value: r };
|
|
752538
753781
|
}
|
|
752539
|
-
}, Tt5, pe3, Vn3,
|
|
753782
|
+
}, Tt5, pe3, Vn3, gt3, _o3, bo3, jr5, Si3, ue3, ki3, Kr5, Ii3, Lr5, Nx4, lg5, Dx5, Hx5, ug3 = class {
|
|
752540
753783
|
constructor(e11 = [], n3 = {}) {
|
|
752541
753784
|
this._options = b6(b6({}, Hx5), n3), this._items = [];
|
|
752542
753785
|
for (let r of e11)
|
|
@@ -754563,7 +755806,7 @@ var init_dist19 = __esm(() => {
|
|
|
754563
755806
|
Jv3 = {};
|
|
754564
755807
|
aa5(Jv3, { errors: () => sf5, fromJSONSchema: () => Xg3, fromJSONSchemaLegacy: () => lB3, fromObject: () => xo3, toJSONSchema: () => st5, toJSONSchemaLegacy: () => MB3, toTypescriptSchema: () => Ho5, toTypescriptType: () => Eo3 });
|
|
754565
755808
|
X3 = {};
|
|
754566
|
-
aa5(X3, { BRAND: () => Ux5, DIRTY: () => Vn3, EMPTY_PATH: () => Mx3, INVALID: () => pe3, NEVER: () => UP3, OK: () =>
|
|
755809
|
+
aa5(X3, { BRAND: () => Ux5, DIRTY: () => Vn3, EMPTY_PATH: () => Mx3, INVALID: () => pe3, NEVER: () => UP3, OK: () => gt3, ParseInputLazyPath: () => Ot5, ParseStatus: () => Tt5, Schema: () => he5, ZodAny: () => Kr5, ZodArray: () => Lr5, ZodBigInt: () => jo3, ZodBoolean: () => Ko5, ZodBranded: () => Lo3, ZodCatch: () => Fo3, ZodDate: () => Wo3, ZodDefault: () => ma5, ZodDiscriminatedUnion: () => gg3, ZodEffects: () => Sn3, ZodEnum: () => ir3, ZodError: () => Wt5, ZodFirstPartyTypeKind: () => tg3, ZodFunction: () => mg5, ZodIntersection: () => qo3, ZodIssueCode: () => G, ZodLazy: () => Go5, ZodLiteral: () => Vo3, ZodMap: () => vg5, ZodNaN: () => _g5, ZodNativeEnum: () => Jo3, ZodNever: () => zr5, ZodNull: () => Yo5, ZodNullable: () => Qn3, ZodNumber: () => Xo3, ZodObject: () => er3, ZodOptional: () => ln5, ZodParsedType: () => ne5, ZodPipeline: () => Qo3, ZodPromise: () => va5, ZodReadonly: () => Ta5, ZodRecord: () => Sg3, ZodRef: () => Ig5, ZodSchema: () => he5, ZodSet: () => Ag3, ZodString: () => yt5, ZodSymbol: () => jg3, ZodTransformer: () => Sn3, ZodTuple: () => nr3, ZodType: () => he5, ZodUndefined: () => _a5, ZodUnion: () => es5, ZodUnknown: () => Dr5, ZodVoid: () => Wg5, addIssueToContext: () => te3, agent: () => Wx3, aimodel: () => Jx5, any: () => sP3, array: () => fP3, bigint: () => nP3, boolean: () => Gg5, coerce: () => HP3, conversation: () => Kx3, createZodEnum: () => ha5, cuid2Regex: () => Og3, cuidRegex: () => Cg3, custom: () => dg3, datasource: () => Yx5, date: () => rP3, default: () => CP3, discriminatedUnion: () => yP3, effect: () => Jc5, emailRegex: () => Ng4, enum: () => EP3, errorUtil: () => ue3, event: () => zx5, function: () => xP3, getErrorMap: () => $r5, getParsedType: () => sn5, instanceof: () => eP3, intent: () => Vx4, intersection: () => mP3, ipv4Regex: () => Hg3, ipv6Regex: () => Ug3, isAborted: () => _o3, isAsync: () => Si3, isDirty: () => bo3, isEmojiRegex: () => Zx5, isValid: () => jr5, knowledgebase: () => Xx5, late: () => Qx3, lazy: () => PP3, literal: () => BP3, makeIssue: () => Ei3, map: () => bP3, message: () => Fx5, nan: () => tP3, nativeEnum: () => SP3, never: () => uP3, null: () => oP3, nullable: () => AP3, number: () => qg3, object: () => dP3, objectUtil: () => To5, oboolean: () => DP3, onumber: () => NP3, optional: () => IP3, ostring: () => MP3, pipeline: () => RP3, preprocess: () => OP3, processCreateParams: () => me3, promise: () => kP3, quotelessJson: () => Rx5, readonly: () => _P3, record: () => vP3, ref: () => TP3, set: () => wP3, setErrorMap: () => ig3, strictObject: () => pP3, string: () => zg5, symbol: () => iP3, table: () => qx5, tablerow: () => Gx3, transformer: () => Jc5, tuple: () => hP3, ulidRegex: () => Rg3, undefined: () => aP3, union: () => gP3, unknown: () => lP3, user: () => Lx3, util: () => be5, uuidRegex: () => Mg5, variable: () => jx5, void: () => cP3 });
|
|
754567
755810
|
d5(nf3, "primitiveToTypscriptLiteralType");
|
|
754568
755811
|
d5(se3, "primitiveToTypescriptValue");
|
|
754569
755812
|
d5(Jn3, "unknownToTypescriptValue");
|
|
@@ -755661,7 +756904,7 @@ declare function ${r}${i2};${l4}`);
|
|
|
755661
756904
|
Tt5 = ag5;
|
|
755662
756905
|
pe3 = Object.freeze({ status: "aborted" });
|
|
755663
756906
|
Vn3 = d5((t9) => ({ status: "dirty", value: t9 }), "DIRTY");
|
|
755664
|
-
|
|
756907
|
+
gt3 = d5((t9) => ({ status: "valid", value: t9 }), "OK");
|
|
755665
756908
|
_o3 = d5((t9) => t9.status === "aborted", "isAborted");
|
|
755666
756909
|
bo3 = d5((t9) => t9.status === "dirty", "isDirty");
|
|
755667
756910
|
jr5 = d5((t9) => t9.status === "valid", "isValid");
|
|
@@ -755674,7 +756917,7 @@ declare function ${r}${i2};${l4}`);
|
|
|
755674
756917
|
super(...arguments), this._any = true;
|
|
755675
756918
|
}
|
|
755676
756919
|
_parse(e11) {
|
|
755677
|
-
return
|
|
756920
|
+
return gt3(e11.data);
|
|
755678
756921
|
}
|
|
755679
756922
|
isEqual(e11) {
|
|
755680
756923
|
return e11 instanceof sg5;
|
|
@@ -755818,7 +757061,7 @@ declare function ${r}${i2};${l4}`);
|
|
|
755818
757061
|
let r = this._getOrReturnCtx(e11);
|
|
755819
757062
|
return te3(r, { code: G.invalid_type, expected: ne5.boolean, received: r.parsedType }), pe3;
|
|
755820
757063
|
}
|
|
755821
|
-
return
|
|
757064
|
+
return gt3(e11.data);
|
|
755822
757065
|
}
|
|
755823
757066
|
isEqual(e11) {
|
|
755824
757067
|
return e11 instanceof cg5 ? this._def.coerce === e11._def.coerce : false;
|
|
@@ -756045,7 +757288,7 @@ declare function ${r}${i2};${l4}`);
|
|
|
756045
757288
|
let n3 = this._getOrReturnCtx(e11), r = this._def.values;
|
|
756046
757289
|
return te3(n3, { received: n3.data, code: G.invalid_enum_value, options: r }), pe3;
|
|
756047
757290
|
}
|
|
756048
|
-
return
|
|
757291
|
+
return gt3(e11.data);
|
|
756049
757292
|
}
|
|
756050
757293
|
get options() {
|
|
756051
757294
|
return this._def.values;
|
|
@@ -756113,7 +757356,7 @@ declare function ${r}${i2};${l4}`);
|
|
|
756113
757356
|
let o2 = { errorMap: n3.common.contextualErrorMap }, i2 = n3.data;
|
|
756114
757357
|
if (this._def.returns instanceof va5) {
|
|
756115
757358
|
let s2 = this;
|
|
756116
|
-
return
|
|
757359
|
+
return gt3(async function(...l4) {
|
|
756117
757360
|
let f = new Wt5([]), p = await s2._def.args.parseAsync(l4, o2).catch((h4) => {
|
|
756118
757361
|
throw f.addIssue(r(l4, h4)), f;
|
|
756119
757362
|
}), y = await Reflect.apply(i2, this, p);
|
|
@@ -756123,7 +757366,7 @@ declare function ${r}${i2};${l4}`);
|
|
|
756123
757366
|
});
|
|
756124
757367
|
} else {
|
|
756125
757368
|
let s2 = this;
|
|
756126
|
-
return
|
|
757369
|
+
return gt3(function(...l4) {
|
|
756127
757370
|
let f = s2._def.args.safeParse(l4, o2);
|
|
756128
757371
|
if (!f.success)
|
|
756129
757372
|
throw new Wt5([r(l4, f.error)]);
|
|
@@ -756316,7 +757559,7 @@ declare function ${r}${i2};${l4}`);
|
|
|
756316
757559
|
let a2 = be5.objectValues(n3);
|
|
756317
757560
|
return te3(r, { received: r.data, code: G.invalid_enum_value, options: a2 }), pe3;
|
|
756318
757561
|
}
|
|
756319
|
-
return
|
|
757562
|
+
return gt3(e11.data);
|
|
756320
757563
|
}
|
|
756321
757564
|
get enum() {
|
|
756322
757565
|
return this._def.values;
|
|
@@ -756346,7 +757589,7 @@ declare function ${r}${i2};${l4}`);
|
|
|
756346
757589
|
let r = this._getOrReturnCtx(e11);
|
|
756347
757590
|
return te3(r, { code: G.invalid_type, expected: ne5.null, received: r.parsedType }), pe3;
|
|
756348
757591
|
}
|
|
756349
|
-
return
|
|
757592
|
+
return gt3(e11.data);
|
|
756350
757593
|
}
|
|
756351
757594
|
isEqual(e11) {
|
|
756352
757595
|
return e11 instanceof xg3;
|
|
@@ -756366,7 +757609,7 @@ declare function ${r}${i2};${l4}`);
|
|
|
756366
757609
|
return new Br5(N5(b6({}, this._def), { innerType: this._def.innerType.clone() }));
|
|
756367
757610
|
}
|
|
756368
757611
|
_parse(e11) {
|
|
756369
|
-
return this._getType(e11) === ne5.null ?
|
|
757612
|
+
return this._getType(e11) === ne5.null ? gt3(null) : this._def.innerType._parse(e11);
|
|
756370
757613
|
}
|
|
756371
757614
|
unwrap() {
|
|
756372
757615
|
return this._def.innerType;
|
|
@@ -756639,7 +757882,7 @@ declare function ${r}${i2};${l4}`);
|
|
|
756639
757882
|
return new wi3(N5(b6({}, this._def), { innerType: this._def.innerType.clone() }));
|
|
756640
757883
|
}
|
|
756641
757884
|
_parse(e11) {
|
|
756642
|
-
return this._getType(e11) === ne5.undefined ?
|
|
757885
|
+
return this._getType(e11) === ne5.undefined ? gt3(undefined) : this._def.innerType._parse(e11);
|
|
756643
757886
|
}
|
|
756644
757887
|
unwrap() {
|
|
756645
757888
|
return this._def.innerType;
|
|
@@ -756706,7 +757949,7 @@ declare function ${r}${i2};${l4}`);
|
|
|
756706
757949
|
if (n3.parsedType !== ne5.promise && n3.common.async === false)
|
|
756707
757950
|
return te3(n3, { code: G.invalid_type, expected: ne5.promise, received: n3.parsedType }), pe3;
|
|
756708
757951
|
let r = n3.parsedType === ne5.promise ? n3.data : Promise.resolve(n3.data);
|
|
756709
|
-
return
|
|
757952
|
+
return gt3(r.then((a2) => this._def.type.parseAsync(a2, { path: n3.path, errorMap: n3.common.contextualErrorMap })));
|
|
756710
757953
|
}
|
|
756711
757954
|
isEqual(e11) {
|
|
756712
757955
|
return e11 instanceof xi3 ? this._def.type.isEqual(e11._def.type) : false;
|
|
@@ -757041,7 +758284,7 @@ declare function ${r}${i2};${l4}`);
|
|
|
757041
758284
|
let r = this._getOrReturnCtx(e11);
|
|
757042
758285
|
return te3(r, { code: G.invalid_type, expected: ne5.symbol, received: r.parsedType }), pe3;
|
|
757043
758286
|
}
|
|
757044
|
-
return
|
|
758287
|
+
return gt3(e11.data);
|
|
757045
758288
|
}
|
|
757046
758289
|
isEqual(e11) {
|
|
757047
758290
|
return e11 instanceof $g3;
|
|
@@ -757184,7 +758427,7 @@ declare function ${r}${i2};${l4}`);
|
|
|
757184
758427
|
let r = this._getOrReturnCtx(e11);
|
|
757185
758428
|
return te3(r, { code: G.invalid_type, expected: ne5.undefined, received: r.parsedType }), pe3;
|
|
757186
758429
|
}
|
|
757187
|
-
return
|
|
758430
|
+
return gt3(e11.data);
|
|
757188
758431
|
}
|
|
757189
758432
|
isEqual(e11) {
|
|
757190
758433
|
return e11 instanceof Kg5;
|
|
@@ -757261,7 +758504,7 @@ declare function ${r}${i2};${l4}`);
|
|
|
757261
758504
|
super(...arguments), this._unknown = true;
|
|
757262
758505
|
}
|
|
757263
758506
|
_parse(e11) {
|
|
757264
|
-
return
|
|
758507
|
+
return gt3(e11.data);
|
|
757265
758508
|
}
|
|
757266
758509
|
isEqual(e11) {
|
|
757267
758510
|
return e11 instanceof Lg5;
|
|
@@ -757276,7 +758519,7 @@ declare function ${r}${i2};${l4}`);
|
|
|
757276
758519
|
let r = this._getOrReturnCtx(e11);
|
|
757277
758520
|
return te3(r, { code: G.invalid_type, expected: ne5.void, received: r.parsedType }), pe3;
|
|
757278
758521
|
}
|
|
757279
|
-
return
|
|
758522
|
+
return gt3(e11.data);
|
|
757280
758523
|
}
|
|
757281
758524
|
isEqual(e11) {
|
|
757282
758525
|
return e11 instanceof Fg3;
|
|
@@ -872057,7 +873300,7 @@ function dew18() {
|
|
|
872057
873300
|
exports$114.Url = Url2;
|
|
872058
873301
|
return exports$114;
|
|
872059
873302
|
}
|
|
872060
|
-
function
|
|
873303
|
+
function fileURLToPath12(path210) {
|
|
872061
873304
|
if (typeof path210 === "string")
|
|
872062
873305
|
path210 = new URL(path210);
|
|
872063
873306
|
else if (!(path210 instanceof URL)) {
|
|
@@ -885768,8 +887011,8 @@ Use Chrome, Firefox or Internet Explorer 11`);
|
|
|
885768
887011
|
r7.negative = t62.negative ^ i6.negative, r7.length = 19;
|
|
885769
887012
|
var vt6 = (a7 + (h7 = Math.imul(m6, F42)) | 0) + ((8191 & (n7 = (n7 = Math.imul(m6, C42)) + Math.imul(f8, F42) | 0)) << 13) | 0;
|
|
885770
887013
|
a7 = ((e92 = Math.imul(f8, C42)) + (n7 >>> 13) | 0) + (vt6 >>> 26) | 0, vt6 &= 67108863, h7 = Math.imul(p7, F42), n7 = (n7 = Math.imul(p7, C42)) + Math.imul(M52, F42) | 0, e92 = Math.imul(M52, C42);
|
|
885771
|
-
var
|
|
885772
|
-
a7 = ((e92 = e92 + Math.imul(f8, J32) | 0) + (n7 >>> 13) | 0) + (
|
|
887014
|
+
var gt4 = (a7 + (h7 = h7 + Math.imul(m6, H32) | 0) | 0) + ((8191 & (n7 = (n7 = n7 + Math.imul(m6, J32) | 0) + Math.imul(f8, H32) | 0)) << 13) | 0;
|
|
887015
|
+
a7 = ((e92 = e92 + Math.imul(f8, J32) | 0) + (n7 >>> 13) | 0) + (gt4 >>> 26) | 0, gt4 &= 67108863, h7 = Math.imul(g62, F42), n7 = (n7 = Math.imul(g62, C42)) + Math.imul(c72, F42) | 0, e92 = Math.imul(c72, C42), h7 = h7 + Math.imul(p7, H32) | 0, n7 = (n7 = n7 + Math.imul(p7, J32) | 0) + Math.imul(M52, H32) | 0, e92 = e92 + Math.imul(M52, J32) | 0;
|
|
885773
887016
|
var ct6 = (a7 + (h7 = h7 + Math.imul(m6, G32) | 0) | 0) + ((8191 & (n7 = (n7 = n7 + Math.imul(m6, Q32) | 0) + Math.imul(f8, G32) | 0)) << 13) | 0;
|
|
885774
887017
|
a7 = ((e92 = e92 + Math.imul(f8, Q32) | 0) + (n7 >>> 13) | 0) + (ct6 >>> 26) | 0, ct6 &= 67108863, h7 = Math.imul(y7, F42), n7 = (n7 = Math.imul(y7, C42)) + Math.imul(b62, F42) | 0, e92 = Math.imul(b62, C42), h7 = h7 + Math.imul(g62, H32) | 0, n7 = (n7 = n7 + Math.imul(g62, J32) | 0) + Math.imul(c72, H32) | 0, e92 = e92 + Math.imul(c72, J32) | 0, h7 = h7 + Math.imul(p7, G32) | 0, n7 = (n7 = n7 + Math.imul(p7, Q32) | 0) + Math.imul(M52, G32) | 0, e92 = e92 + Math.imul(M52, Q32) | 0;
|
|
885775
887018
|
var wt6 = (a7 + (h7 = h7 + Math.imul(m6, W32) | 0) | 0) + ((8191 & (n7 = (n7 = n7 + Math.imul(m6, X32) | 0) + Math.imul(f8, W32) | 0)) << 13) | 0;
|
|
@@ -885803,7 +887046,7 @@ Use Chrome, Firefox or Internet Explorer 11`);
|
|
|
885803
887046
|
var It4 = (a7 + (h7 = h7 + Math.imul(z5, pt4) | 0) | 0) + ((8191 & (n7 = (n7 = n7 + Math.imul(z5, Mt6) | 0) + Math.imul(E42, pt4) | 0)) << 13) | 0;
|
|
885804
887047
|
a7 = ((e92 = e92 + Math.imul(E42, Mt6) | 0) + (n7 >>> 13) | 0) + (It4 >>> 26) | 0, It4 &= 67108863;
|
|
885805
887048
|
var Tt6 = (a7 + (h7 = Math.imul(j4, pt4)) | 0) + ((8191 & (n7 = (n7 = Math.imul(j4, Mt6)) + Math.imul(K3, pt4) | 0)) << 13) | 0;
|
|
885806
|
-
return a7 = ((e92 = Math.imul(K3, Mt6)) + (n7 >>> 13) | 0) + (Tt6 >>> 26) | 0, Tt6 &= 67108863, u7[0] = vt6, u7[1] =
|
|
887049
|
+
return a7 = ((e92 = Math.imul(K3, Mt6)) + (n7 >>> 13) | 0) + (Tt6 >>> 26) | 0, Tt6 &= 67108863, u7[0] = vt6, u7[1] = gt4, u7[2] = ct6, u7[3] = wt6, u7[4] = yt6, u7[5] = bt4, u7[6] = _t22, u7[7] = kt4, u7[8] = At6, u7[9] = xt, u7[10] = St4, u7[11] = Zt6, u7[12] = Rt4, u7[13] = qt4, u7[14] = Bt6, u7[15] = Nt3, u7[16] = Lt6, u7[17] = It4, u7[18] = Tt6, a7 !== 0 && (u7[19] = a7, r7.length++), r7;
|
|
885807
887050
|
};
|
|
885808
887051
|
function M42(t62, i6, r7) {
|
|
885809
887052
|
return new v62().mulp(t62, i6, r7);
|
|
@@ -893611,8 +894854,8 @@ Use Chrome, Firefox or Internet Explorer 11`);
|
|
|
893611
894854
|
init_buffer22();
|
|
893612
894855
|
init_process22();
|
|
893613
894856
|
var compare = require_compare2();
|
|
893614
|
-
var
|
|
893615
|
-
module2.exports =
|
|
894857
|
+
var gt4 = (a6, b52, loose) => compare(a6, b52, loose) > 0;
|
|
894858
|
+
module2.exports = gt4;
|
|
893616
894859
|
}
|
|
893617
894860
|
});
|
|
893618
894861
|
require_lt2 = __commonJS8({
|
|
@@ -893672,7 +894915,7 @@ Use Chrome, Firefox or Internet Explorer 11`);
|
|
|
893672
894915
|
init_process22();
|
|
893673
894916
|
var eq7 = require_eq2();
|
|
893674
894917
|
var neq = require_neq2();
|
|
893675
|
-
var
|
|
894918
|
+
var gt4 = require_gt2();
|
|
893676
894919
|
var gte5 = require_gte2();
|
|
893677
894920
|
var lt6 = require_lt2();
|
|
893678
894921
|
var lte4 = require_lte2();
|
|
@@ -893701,7 +894944,7 @@ Use Chrome, Firefox or Internet Explorer 11`);
|
|
|
893701
894944
|
case "!=":
|
|
893702
894945
|
return neq(a6, b52, loose);
|
|
893703
894946
|
case ">":
|
|
893704
|
-
return
|
|
894947
|
+
return gt4(a6, b52, loose);
|
|
893705
894948
|
case ">=":
|
|
893706
894949
|
return gte5(a6, b52, loose);
|
|
893707
894950
|
case "<":
|
|
@@ -894293,7 +895536,7 @@ Use Chrome, Firefox or Internet Explorer 11`);
|
|
|
894293
895536
|
init_buffer22();
|
|
894294
895537
|
init_process22();
|
|
894295
895538
|
var Range = require_range22();
|
|
894296
|
-
var
|
|
895539
|
+
var satisfies2 = (version42, range4, options) => {
|
|
894297
895540
|
try {
|
|
894298
895541
|
range4 = new Range(range4, options);
|
|
894299
895542
|
} catch (er4) {
|
|
@@ -894301,7 +895544,7 @@ Use Chrome, Firefox or Internet Explorer 11`);
|
|
|
894301
895544
|
}
|
|
894302
895545
|
return range4.test(version42);
|
|
894303
895546
|
};
|
|
894304
|
-
module2.exports =
|
|
895547
|
+
module2.exports = satisfies2;
|
|
894305
895548
|
}
|
|
894306
895549
|
});
|
|
894307
895550
|
require_to_comparators2 = __commonJS8({
|
|
@@ -894379,7 +895622,7 @@ Use Chrome, Firefox or Internet Explorer 11`);
|
|
|
894379
895622
|
init_process22();
|
|
894380
895623
|
var SemVer = require_semver6();
|
|
894381
895624
|
var Range = require_range22();
|
|
894382
|
-
var
|
|
895625
|
+
var gt4 = require_gt2();
|
|
894383
895626
|
var minVersion = (range4, loose) => {
|
|
894384
895627
|
range4 = new Range(range4, loose);
|
|
894385
895628
|
let minver = new SemVer("0.0.0");
|
|
@@ -894406,7 +895649,7 @@ Use Chrome, Firefox or Internet Explorer 11`);
|
|
|
894406
895649
|
compver.raw = compver.format();
|
|
894407
895650
|
case "":
|
|
894408
895651
|
case ">=":
|
|
894409
|
-
if (!setMin ||
|
|
895652
|
+
if (!setMin || gt4(compver, setMin)) {
|
|
894410
895653
|
setMin = compver;
|
|
894411
895654
|
}
|
|
894412
895655
|
break;
|
|
@@ -894417,7 +895660,7 @@ Use Chrome, Firefox or Internet Explorer 11`);
|
|
|
894417
895660
|
throw new Error(`Unexpected operation: ${comparator.operator}`);
|
|
894418
895661
|
}
|
|
894419
895662
|
});
|
|
894420
|
-
if (setMin && (!minver ||
|
|
895663
|
+
if (setMin && (!minver || gt4(minver, setMin))) {
|
|
894421
895664
|
minver = setMin;
|
|
894422
895665
|
}
|
|
894423
895666
|
}
|
|
@@ -894454,8 +895697,8 @@ Use Chrome, Firefox or Internet Explorer 11`);
|
|
|
894454
895697
|
var Comparator = require_comparator2();
|
|
894455
895698
|
var { ANY } = Comparator;
|
|
894456
895699
|
var Range = require_range22();
|
|
894457
|
-
var
|
|
894458
|
-
var
|
|
895700
|
+
var satisfies2 = require_satisfies2();
|
|
895701
|
+
var gt4 = require_gt2();
|
|
894459
895702
|
var lt6 = require_lt2();
|
|
894460
895703
|
var lte4 = require_lte2();
|
|
894461
895704
|
var gte5 = require_gte2();
|
|
@@ -894465,7 +895708,7 @@ Use Chrome, Firefox or Internet Explorer 11`);
|
|
|
894465
895708
|
let gtfn, ltefn, ltfn, comp, ecomp;
|
|
894466
895709
|
switch (hilo) {
|
|
894467
895710
|
case ">":
|
|
894468
|
-
gtfn =
|
|
895711
|
+
gtfn = gt4;
|
|
894469
895712
|
ltefn = lte4;
|
|
894470
895713
|
ltfn = lt6;
|
|
894471
895714
|
comp = ">";
|
|
@@ -894474,14 +895717,14 @@ Use Chrome, Firefox or Internet Explorer 11`);
|
|
|
894474
895717
|
case "<":
|
|
894475
895718
|
gtfn = lt6;
|
|
894476
895719
|
ltefn = gte5;
|
|
894477
|
-
ltfn =
|
|
895720
|
+
ltfn = gt4;
|
|
894478
895721
|
comp = "<";
|
|
894479
895722
|
ecomp = "<=";
|
|
894480
895723
|
break;
|
|
894481
895724
|
default:
|
|
894482
895725
|
throw new TypeError('Must provide a hilo val of "<" or ">"');
|
|
894483
895726
|
}
|
|
894484
|
-
if (
|
|
895727
|
+
if (satisfies2(version42, range4, options)) {
|
|
894485
895728
|
return false;
|
|
894486
895729
|
}
|
|
894487
895730
|
for (let i6 = 0;i6 < range4.set.length; ++i6) {
|
|
@@ -894553,7 +895796,7 @@ Use Chrome, Firefox or Internet Explorer 11`);
|
|
|
894553
895796
|
init_dirname2();
|
|
894554
895797
|
init_buffer22();
|
|
894555
895798
|
init_process22();
|
|
894556
|
-
var
|
|
895799
|
+
var satisfies2 = require_satisfies2();
|
|
894557
895800
|
var compare = require_compare2();
|
|
894558
895801
|
module2.exports = (versions32, range4, options) => {
|
|
894559
895802
|
const set2 = [];
|
|
@@ -894561,7 +895804,7 @@ Use Chrome, Firefox or Internet Explorer 11`);
|
|
|
894561
895804
|
let prev = null;
|
|
894562
895805
|
const v62 = versions32.sort((a6, b52) => compare(a6, b52, options));
|
|
894563
895806
|
for (const version42 of v62) {
|
|
894564
|
-
const included =
|
|
895807
|
+
const included = satisfies2(version42, range4, options);
|
|
894565
895808
|
if (included) {
|
|
894566
895809
|
prev = version42;
|
|
894567
895810
|
if (!first) {
|
|
@@ -894606,7 +895849,7 @@ Use Chrome, Firefox or Internet Explorer 11`);
|
|
|
894606
895849
|
var Range = require_range22();
|
|
894607
895850
|
var Comparator = require_comparator2();
|
|
894608
895851
|
var { ANY } = Comparator;
|
|
894609
|
-
var
|
|
895852
|
+
var satisfies2 = require_satisfies2();
|
|
894610
895853
|
var compare = require_compare2();
|
|
894611
895854
|
var subset = (sub, dom, options = {}) => {
|
|
894612
895855
|
if (sub === dom) {
|
|
@@ -894653,10 +895896,10 @@ Use Chrome, Firefox or Internet Explorer 11`);
|
|
|
894653
895896
|
}
|
|
894654
895897
|
}
|
|
894655
895898
|
const eqSet = /* @__PURE__ */ new Set;
|
|
894656
|
-
let
|
|
895899
|
+
let gt4, lt6;
|
|
894657
895900
|
for (const c62 of sub) {
|
|
894658
895901
|
if (c62.operator === ">" || c62.operator === ">=") {
|
|
894659
|
-
|
|
895902
|
+
gt4 = higherGT(gt4, c62, options);
|
|
894660
895903
|
} else if (c62.operator === "<" || c62.operator === "<=") {
|
|
894661
895904
|
lt6 = lowerLT(lt6, c62, options);
|
|
894662
895905
|
} else {
|
|
@@ -894667,23 +895910,23 @@ Use Chrome, Firefox or Internet Explorer 11`);
|
|
|
894667
895910
|
return null;
|
|
894668
895911
|
}
|
|
894669
895912
|
let gtltComp;
|
|
894670
|
-
if (
|
|
894671
|
-
gtltComp = compare(
|
|
895913
|
+
if (gt4 && lt6) {
|
|
895914
|
+
gtltComp = compare(gt4.semver, lt6.semver, options);
|
|
894672
895915
|
if (gtltComp > 0) {
|
|
894673
895916
|
return null;
|
|
894674
|
-
} else if (gtltComp === 0 && (
|
|
895917
|
+
} else if (gtltComp === 0 && (gt4.operator !== ">=" || lt6.operator !== "<=")) {
|
|
894675
895918
|
return null;
|
|
894676
895919
|
}
|
|
894677
895920
|
}
|
|
894678
895921
|
for (const eq7 of eqSet) {
|
|
894679
|
-
if (
|
|
895922
|
+
if (gt4 && !satisfies2(eq7, String(gt4), options)) {
|
|
894680
895923
|
return null;
|
|
894681
895924
|
}
|
|
894682
|
-
if (lt6 && !
|
|
895925
|
+
if (lt6 && !satisfies2(eq7, String(lt6), options)) {
|
|
894683
895926
|
return null;
|
|
894684
895927
|
}
|
|
894685
895928
|
for (const c62 of dom) {
|
|
894686
|
-
if (!
|
|
895929
|
+
if (!satisfies2(eq7, String(c62), options)) {
|
|
894687
895930
|
return false;
|
|
894688
895931
|
}
|
|
894689
895932
|
}
|
|
@@ -894692,25 +895935,25 @@ Use Chrome, Firefox or Internet Explorer 11`);
|
|
|
894692
895935
|
let higher, lower;
|
|
894693
895936
|
let hasDomLT, hasDomGT;
|
|
894694
895937
|
let needDomLTPre = lt6 && !options.includePrerelease && lt6.semver.prerelease.length ? lt6.semver : false;
|
|
894695
|
-
let needDomGTPre =
|
|
895938
|
+
let needDomGTPre = gt4 && !options.includePrerelease && gt4.semver.prerelease.length ? gt4.semver : false;
|
|
894696
895939
|
if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt6.operator === "<" && needDomLTPre.prerelease[0] === 0) {
|
|
894697
895940
|
needDomLTPre = false;
|
|
894698
895941
|
}
|
|
894699
895942
|
for (const c62 of dom) {
|
|
894700
895943
|
hasDomGT = hasDomGT || c62.operator === ">" || c62.operator === ">=";
|
|
894701
895944
|
hasDomLT = hasDomLT || c62.operator === "<" || c62.operator === "<=";
|
|
894702
|
-
if (
|
|
895945
|
+
if (gt4) {
|
|
894703
895946
|
if (needDomGTPre) {
|
|
894704
895947
|
if (c62.semver.prerelease && c62.semver.prerelease.length && c62.semver.major === needDomGTPre.major && c62.semver.minor === needDomGTPre.minor && c62.semver.patch === needDomGTPre.patch) {
|
|
894705
895948
|
needDomGTPre = false;
|
|
894706
895949
|
}
|
|
894707
895950
|
}
|
|
894708
895951
|
if (c62.operator === ">" || c62.operator === ">=") {
|
|
894709
|
-
higher = higherGT(
|
|
894710
|
-
if (higher === c62 && higher !==
|
|
895952
|
+
higher = higherGT(gt4, c62, options);
|
|
895953
|
+
if (higher === c62 && higher !== gt4) {
|
|
894711
895954
|
return false;
|
|
894712
895955
|
}
|
|
894713
|
-
} else if (
|
|
895956
|
+
} else if (gt4.operator === ">=" && !satisfies2(gt4.semver, String(c62), options)) {
|
|
894714
895957
|
return false;
|
|
894715
895958
|
}
|
|
894716
895959
|
}
|
|
@@ -894725,18 +895968,18 @@ Use Chrome, Firefox or Internet Explorer 11`);
|
|
|
894725
895968
|
if (lower === c62 && lower !== lt6) {
|
|
894726
895969
|
return false;
|
|
894727
895970
|
}
|
|
894728
|
-
} else if (lt6.operator === "<=" && !
|
|
895971
|
+
} else if (lt6.operator === "<=" && !satisfies2(lt6.semver, String(c62), options)) {
|
|
894729
895972
|
return false;
|
|
894730
895973
|
}
|
|
894731
895974
|
}
|
|
894732
|
-
if (!c62.operator && (lt6 ||
|
|
895975
|
+
if (!c62.operator && (lt6 || gt4) && gtltComp !== 0) {
|
|
894733
895976
|
return false;
|
|
894734
895977
|
}
|
|
894735
895978
|
}
|
|
894736
|
-
if (
|
|
895979
|
+
if (gt4 && hasDomLT && !lt6 && gtltComp !== 0) {
|
|
894737
895980
|
return false;
|
|
894738
895981
|
}
|
|
894739
|
-
if (lt6 && hasDomGT && !
|
|
895982
|
+
if (lt6 && hasDomGT && !gt4 && gtltComp !== 0) {
|
|
894740
895983
|
return false;
|
|
894741
895984
|
}
|
|
894742
895985
|
if (needDomGTPre || needDomLTPre) {
|
|
@@ -894785,7 +896028,7 @@ Use Chrome, Firefox or Internet Explorer 11`);
|
|
|
894785
896028
|
var compareBuild = require_compare_build2();
|
|
894786
896029
|
var sort2 = require_sort2();
|
|
894787
896030
|
var rsort = require_rsort2();
|
|
894788
|
-
var
|
|
896031
|
+
var gt4 = require_gt2();
|
|
894789
896032
|
var lt6 = require_lt2();
|
|
894790
896033
|
var eq7 = require_eq2();
|
|
894791
896034
|
var neq = require_neq2();
|
|
@@ -894795,7 +896038,7 @@ Use Chrome, Firefox or Internet Explorer 11`);
|
|
|
894795
896038
|
var coerce22 = require_coerce2();
|
|
894796
896039
|
var Comparator = require_comparator2();
|
|
894797
896040
|
var Range = require_range22();
|
|
894798
|
-
var
|
|
896041
|
+
var satisfies2 = require_satisfies2();
|
|
894799
896042
|
var toComparators = require_to_comparators2();
|
|
894800
896043
|
var maxSatisfying = require_max_satisfying2();
|
|
894801
896044
|
var minSatisfying = require_min_satisfying2();
|
|
@@ -894823,7 +896066,7 @@ Use Chrome, Firefox or Internet Explorer 11`);
|
|
|
894823
896066
|
compareBuild,
|
|
894824
896067
|
sort: sort2,
|
|
894825
896068
|
rsort,
|
|
894826
|
-
gt:
|
|
896069
|
+
gt: gt4,
|
|
894827
896070
|
lt: lt6,
|
|
894828
896071
|
eq: eq7,
|
|
894829
896072
|
neq,
|
|
@@ -894833,7 +896076,7 @@ Use Chrome, Firefox or Internet Explorer 11`);
|
|
|
894833
896076
|
coerce: coerce22,
|
|
894834
896077
|
Comparator,
|
|
894835
896078
|
Range,
|
|
894836
|
-
satisfies,
|
|
896079
|
+
satisfies: satisfies2,
|
|
894837
896080
|
toComparators,
|
|
894838
896081
|
maxSatisfying,
|
|
894839
896082
|
minSatisfying,
|
|
@@ -896765,7 +898008,7 @@ Use Chrome, Firefox or Internet Explorer 11`);
|
|
|
896765
898008
|
URL: () => _URL,
|
|
896766
898009
|
Url: () => Url,
|
|
896767
898010
|
default: () => exports19,
|
|
896768
|
-
fileURLToPath: () =>
|
|
898011
|
+
fileURLToPath: () => fileURLToPath12,
|
|
896769
898012
|
format: () => format23,
|
|
896770
898013
|
parse: () => parse17,
|
|
896771
898014
|
pathToFileURL: () => pathToFileURL,
|
|
@@ -896808,7 +898051,7 @@ Use Chrome, Firefox or Internet Explorer 11`);
|
|
|
896808
898051
|
processPlatform = typeof Deno !== "undefined" ? Deno.build.os === "windows" ? "win32" : Deno.build.os : undefined;
|
|
896809
898052
|
exports19.URL = typeof URL !== "undefined" ? URL : null;
|
|
896810
898053
|
exports19.pathToFileURL = pathToFileURL;
|
|
896811
|
-
exports19.fileURLToPath =
|
|
898054
|
+
exports19.fileURLToPath = fileURLToPath12;
|
|
896812
898055
|
Url = exports19.Url;
|
|
896813
898056
|
format23 = exports19.format;
|
|
896814
898057
|
resolve7 = exports19.resolve;
|
|
@@ -905205,14 +906448,14 @@ var init_tools = __esm(() => {
|
|
|
905205
906448
|
});
|
|
905206
906449
|
|
|
905207
906450
|
// src/mcp/server.ts
|
|
905208
|
-
import { fileURLToPath as
|
|
905209
|
-
import { dirname as
|
|
906451
|
+
import { fileURLToPath as fileURLToPath13 } from "url";
|
|
906452
|
+
import { dirname as dirname6, join as join25 } from "path";
|
|
905210
906453
|
import { readFileSync as readFileSync18 } from "fs";
|
|
905211
906454
|
function getMcpServerVersion() {
|
|
905212
906455
|
try {
|
|
905213
|
-
const
|
|
905214
|
-
const
|
|
905215
|
-
const packageJsonPath = join25(
|
|
906456
|
+
const __filename2 = fileURLToPath13(import.meta.url);
|
|
906457
|
+
const __dirname5 = dirname6(__filename2);
|
|
906458
|
+
const packageJsonPath = join25(__dirname5, "../../package.json");
|
|
905216
906459
|
const packageJson = JSON.parse(readFileSync18(packageJsonPath, "utf-8"));
|
|
905217
906460
|
return packageJson.version ?? "0.0.0";
|
|
905218
906461
|
} catch {
|
|
@@ -905279,7 +906522,7 @@ var init_adk_mcp = __esm(() => {
|
|
|
905279
906522
|
|
|
905280
906523
|
// src/mcp/config-generator.ts
|
|
905281
906524
|
import { existsSync as existsSync22, mkdirSync as mkdirSync6, writeFileSync as writeFileSync7, readFileSync as readFileSync19 } from "fs";
|
|
905282
|
-
import { dirname as
|
|
906525
|
+
import { dirname as dirname7, resolve as resolve9 } from "path";
|
|
905283
906526
|
function validatePath(basePath, relativePath) {
|
|
905284
906527
|
const resolvedBase = resolve9(basePath);
|
|
905285
906528
|
const resolvedPath = resolve9(basePath, relativePath);
|
|
@@ -905372,7 +906615,7 @@ function generateConfig(tool, cwd5, options = {}) {
|
|
|
905372
906615
|
};
|
|
905373
906616
|
}
|
|
905374
906617
|
try {
|
|
905375
|
-
const dir =
|
|
906618
|
+
const dir = dirname7(configPath);
|
|
905376
906619
|
if (!existsSync22(dir)) {
|
|
905377
906620
|
mkdirSync6(dir, { recursive: true });
|
|
905378
906621
|
}
|
|
@@ -906128,8 +907371,8 @@ var {
|
|
|
906128
907371
|
|
|
906129
907372
|
// src/cli.ts
|
|
906130
907373
|
import { readFileSync as readFileSync20 } from "fs";
|
|
906131
|
-
import { join as join28, dirname as
|
|
906132
|
-
import { fileURLToPath as
|
|
907374
|
+
import { join as join28, dirname as dirname8 } from "path";
|
|
907375
|
+
import { fileURLToPath as fileURLToPath14 } from "url";
|
|
906133
907376
|
|
|
906134
907377
|
// src/utils/version-check.tsx
|
|
906135
907378
|
await init_build2();
|
|
@@ -906559,12 +907802,12 @@ if (!checkNodeVersion(true)) {
|
|
|
906559
907802
|
checkNodeVersion(false);
|
|
906560
907803
|
process.exit(1);
|
|
906561
907804
|
}
|
|
906562
|
-
var CLI_VERSION = "1.11.
|
|
907805
|
+
var CLI_VERSION = "1.11.9";
|
|
906563
907806
|
if (CLI_VERSION.startsWith("<<") && CLI_VERSION.endsWith(">>")) {
|
|
906564
907807
|
try {
|
|
906565
|
-
const
|
|
906566
|
-
const
|
|
906567
|
-
const packageJson = JSON.parse(readFileSync20(join28(
|
|
907808
|
+
const __filename2 = fileURLToPath14(import.meta.url);
|
|
907809
|
+
const __dirname5 = dirname8(__filename2);
|
|
907810
|
+
const packageJson = JSON.parse(readFileSync20(join28(__dirname5, "../package.json"), "utf-8"));
|
|
906568
907811
|
CLI_VERSION = packageJson.version;
|
|
906569
907812
|
} catch {}
|
|
906570
907813
|
}
|