@botpress/adk 2.0.0-alpha.1 → 2.0.1-beta.1
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/agent0/capabilities/commands/adk-ship.md +3 -2
- package/dist/agent0/capabilities/commands/adk-validate.md +1 -1
- package/dist/agent0/capabilities/skills/adk/SKILL.md +19 -9
- package/dist/agent0/capabilities/skills/adk/references/actions.md +2 -0
- package/dist/agent0/capabilities/skills/adk/references/agent-config.md +25 -15
- package/dist/agent0/capabilities/skills/adk/references/cli.md +134 -41
- package/dist/agent0/capabilities/skills/adk/references/context-api.md +2 -0
- package/dist/agent0/capabilities/skills/adk/references/conversations.md +21 -0
- package/dist/agent0/capabilities/skills/adk/references/explain-config.md +2 -2
- package/dist/agent0/capabilities/skills/adk/references/integrations.md +39 -25
- package/dist/agent0/capabilities/skills/adk/references/interfaces.md +1 -1
- package/dist/agent0/capabilities/skills/adk/references/knowledge-bases.md +4 -4
- package/dist/agent0/capabilities/skills/adk/references/mcp-server.md +1 -1
- package/dist/agent0/capabilities/skills/adk/references/patterns-mistakes.md +16 -0
- package/dist/agent0/capabilities/skills/adk/references/plugins.md +28 -30
- package/dist/agent0/capabilities/skills/adk/references/tables.md +13 -26
- package/dist/agent0/capabilities/skills/adk/references/tools.md +2 -0
- package/dist/agent0/capabilities/skills/adk/references/triggers.md +16 -12
- package/dist/agent0/capabilities/skills/adk/references/workflows.md +2 -0
- package/dist/agent0/capabilities/skills/adk-debugger/references/common-failures.md +4 -4
- package/dist/agent0/capabilities/skills/adk-debugger/references/debug-workflow.md +11 -11
- package/dist/agent0/capabilities/skills/adk-dev-console/SKILL.md +5 -0
- package/dist/agent0/capabilities/skills/adk-dev-console/references/pages.md +14 -0
- package/dist/agent0/index.js +44 -9
- package/dist/agent0/index.js.map +5 -5
- package/dist/agent0/runtime/client.d.ts.map +1 -1
- package/dist/agent0/types.d.ts +5 -0
- package/dist/agent0/types.d.ts.map +1 -1
- package/dist/bot-generator/generator.d.ts.map +1 -1
- package/dist/commands/bp-dev-command.d.ts.map +1 -1
- package/dist/config/manager.d.ts.map +1 -1
- package/dist/dependencies/dependency-manager.d.ts +4 -0
- package/dist/dependencies/dependency-manager.d.ts.map +1 -1
- package/dist/dependencies/index.js +19 -3
- package/dist/dependencies/index.js.map +4 -4
- package/dist/deploy-manifest/index.d.ts.map +1 -1
- package/dist/generators/table-types.d.ts +1 -0
- package/dist/generators/table-types.d.ts.map +1 -1
- package/dist/index.js +54 -14
- package/dist/index.js.map +11 -10
- package/dist/utils/schema-serialization.d.ts +2 -0
- package/dist/utils/schema-serialization.d.ts.map +1 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/deploy-manifest/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAA;AACjC,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/deploy-manifest/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAA;AACjC,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAG/F,eAAO,MAAM,sCAAsC,IAAI,CAAA;AACvD,eAAO,MAAM,gCAAgC,sCAAsC,CAAA;AAEnF,eAAO,MAAM,qBAAqB;;CAExB,CAAA;AAEV,eAAO,MAAM,4BAA4B;;;CAG/B,CAAA;AAEV,eAAO,MAAM,oCAAoC;;;;;;;;;;;;;;;;;;;;;;;;EAM/C,CAAA;AAEF,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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CAAA;IACZ,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;QAAC,UAAU,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"table-types.d.ts","sourceRoot":"","sources":["../../src/generators/table-types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAA;AAKhE,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;QAAC,UAAU,CAAC,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,CAAA;CACxG;AAKD,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA+G7E"}
|
package/dist/index.js
CHANGED
|
@@ -4801,7 +4801,7 @@ var _format = null, _formatLoaded = false, formatCode = async (code, filepath) =
|
|
|
4801
4801
|
`));
|
|
4802
4802
|
return code;
|
|
4803
4803
|
}
|
|
4804
|
-
}, ADK_VERSION = "2.0.
|
|
4804
|
+
}, ADK_VERSION = "2.0.1-beta.1", relative = (from, to) => {
|
|
4805
4805
|
const fromDir = path14.dirname(from);
|
|
4806
4806
|
const relative2 = path14.relative(fromDir, to);
|
|
4807
4807
|
return relative2.startsWith(".") ? relative2 : `./${relative2}`;
|
|
@@ -15883,7 +15883,7 @@ var init_integration_action_types = __esm(() => {
|
|
|
15883
15883
|
var require_package = __commonJS((exports, module) => {
|
|
15884
15884
|
module.exports = {
|
|
15885
15885
|
name: "@botpress/adk",
|
|
15886
|
-
version: "2.0.
|
|
15886
|
+
version: "2.0.1-beta.1",
|
|
15887
15887
|
description: "Core ADK library for building AI agents on Botpress",
|
|
15888
15888
|
keywords: [
|
|
15889
15889
|
"adk",
|
|
@@ -15944,7 +15944,7 @@ var require_package = __commonJS((exports, module) => {
|
|
|
15944
15944
|
"@botpress/cli": "~6.8.6",
|
|
15945
15945
|
"@botpress/client": "~1.46.0",
|
|
15946
15946
|
"@botpress/cognitive": "~0.6.0",
|
|
15947
|
-
"@botpress/runtime": "^2.0.
|
|
15947
|
+
"@botpress/runtime": "^2.0.1-beta.1",
|
|
15948
15948
|
"@botpress/sdk": "~6.11.1",
|
|
15949
15949
|
"@bpinternal/jex": "^1.2.4",
|
|
15950
15950
|
"@bpinternal/yargs-extra": "^0.0.21",
|
|
@@ -16495,6 +16495,22 @@ class DependencyManager {
|
|
|
16495
16495
|
const all = await this.list(type);
|
|
16496
16496
|
return all.find((e) => e.alias === alias);
|
|
16497
16497
|
}
|
|
16498
|
+
async waitForIntegrationWebhook(name, opts) {
|
|
16499
|
+
const deadline = Date.now() + opts.timeoutMs;
|
|
16500
|
+
for (;; ) {
|
|
16501
|
+
try {
|
|
16502
|
+
const { bot } = await this.client.getBot({ id: this.botId });
|
|
16503
|
+
const integrations = Object.values(bot.integrations ?? {});
|
|
16504
|
+
if (integrations.some((i) => i?.name === name && !!i?.webhookId)) {
|
|
16505
|
+
return true;
|
|
16506
|
+
}
|
|
16507
|
+
} catch {}
|
|
16508
|
+
if (Date.now() >= deadline) {
|
|
16509
|
+
return false;
|
|
16510
|
+
}
|
|
16511
|
+
await new Promise((resolve2) => setTimeout(resolve2, opts.intervalMs));
|
|
16512
|
+
}
|
|
16513
|
+
}
|
|
16498
16514
|
async add(type, spec) {
|
|
16499
16515
|
if (type === "interface") {
|
|
16500
16516
|
throw new DependencyError({
|
|
@@ -17642,7 +17658,7 @@ class DependencyMigrationManager {
|
|
|
17642
17658
|
}
|
|
17643
17659
|
return result;
|
|
17644
17660
|
}
|
|
17645
|
-
const project = await AgentProject.load(this.projectPath);
|
|
17661
|
+
const project = await AgentProject.load(this.projectPath, { noCache: true });
|
|
17646
17662
|
const info = project.agentInfo;
|
|
17647
17663
|
const agentConfigDependencies = await readDependenciesFromConfig(this.projectPath);
|
|
17648
17664
|
const hasAgentConfigDependencies = hasDependencies(agentConfigDependencies);
|
|
@@ -18405,6 +18421,7 @@ class BpDevCommand extends BaseCommand {
|
|
|
18405
18421
|
const { path: bpCommand } = getBpCli();
|
|
18406
18422
|
const bpArgs = [
|
|
18407
18423
|
"dev",
|
|
18424
|
+
"-y",
|
|
18408
18425
|
"--port",
|
|
18409
18426
|
port,
|
|
18410
18427
|
"--token",
|
|
@@ -18958,6 +18975,25 @@ init_src();
|
|
|
18958
18975
|
init_auth();
|
|
18959
18976
|
import { sync as jex } from "@bpinternal/jex";
|
|
18960
18977
|
|
|
18978
|
+
// src/utils/schema-serialization.ts
|
|
18979
|
+
init_src();
|
|
18980
|
+
function serializeSchema(primitive, serialize) {
|
|
18981
|
+
try {
|
|
18982
|
+
return serialize();
|
|
18983
|
+
} catch (error) {
|
|
18984
|
+
if (error instanceof Error && /cannot be transformed to JSON Schema/i.test(error.message)) {
|
|
18985
|
+
throw new AdkError({
|
|
18986
|
+
code: "SCHEMA_NOT_SERIALIZABLE",
|
|
18987
|
+
message: `${primitive} schema can't be serialized to JSON Schema (it uses .refine()/.transform()/.superRefine()).`,
|
|
18988
|
+
expected: true,
|
|
18989
|
+
suggestion: "Remove .refine()/.transform()/.superRefine() from the schema and validate inside the handler instead.",
|
|
18990
|
+
cause: error
|
|
18991
|
+
});
|
|
18992
|
+
}
|
|
18993
|
+
throw error;
|
|
18994
|
+
}
|
|
18995
|
+
}
|
|
18996
|
+
|
|
18961
18997
|
// src/config/coerce-config-value.ts
|
|
18962
18998
|
function coerceConfigValue(value, fieldSchema) {
|
|
18963
18999
|
const typeName = getInnerTypeName(fieldSchema);
|
|
@@ -19040,7 +19076,7 @@ class ConfigManager {
|
|
|
19040
19076
|
}
|
|
19041
19077
|
};
|
|
19042
19078
|
if (schema) {
|
|
19043
|
-
const schemaJson = schema.toJSONSchema();
|
|
19079
|
+
const schemaJson = serializeSchema("Agent configuration", () => schema.toJSONSchema());
|
|
19044
19080
|
const currentSchema = bot.configuration?.schema || {};
|
|
19045
19081
|
if (!jex.jsonSchemaEquals(currentSchema, schemaJson)) {
|
|
19046
19082
|
updates.configuration.schema = schemaJson;
|
|
@@ -19048,6 +19084,8 @@ class ConfigManager {
|
|
|
19048
19084
|
}
|
|
19049
19085
|
await client.updateBot(updates);
|
|
19050
19086
|
} catch (error) {
|
|
19087
|
+
if (isAdkError(error))
|
|
19088
|
+
throw error;
|
|
19051
19089
|
throw new AdkError({
|
|
19052
19090
|
code: "BOT_CONFIG_SAVE_FAILED",
|
|
19053
19091
|
message: `Failed to save configuration to bot ${this.botId}: ${error}`,
|
|
@@ -19712,7 +19750,7 @@ function createDeployedAgentManifest(project, options) {
|
|
|
19712
19750
|
agent: {
|
|
19713
19751
|
...config?.name ? { name: config.name } : {},
|
|
19714
19752
|
...config?.description ? { description: config.description } : {},
|
|
19715
|
-
...config?.configuration?.schema ? { configuration: { schema:
|
|
19753
|
+
...config?.configuration?.schema ? { configuration: { schema: schemaToRecord(config.configuration.schema, "Agent configuration") } } : {},
|
|
19716
19754
|
...config?.defaultModels ? { defaultModels: config.defaultModels } : {},
|
|
19717
19755
|
secrets,
|
|
19718
19756
|
...config?.events ? { events: normalizeEventDefinitions(config.events) } : {},
|
|
@@ -19808,14 +19846,14 @@ function normalizeEventDefinitions(events) {
|
|
|
19808
19846
|
const declaration = asRecord(event);
|
|
19809
19847
|
normalized[name] = {
|
|
19810
19848
|
...typeof declaration.description === "string" ? { description: declaration.description } : {},
|
|
19811
|
-
...declaration.schema ? { schema: schemaToRecord(declaration.schema) } : {}
|
|
19849
|
+
...declaration.schema ? { schema: schemaToRecord(declaration.schema, `Event "${name}"`) } : {}
|
|
19812
19850
|
};
|
|
19813
19851
|
}
|
|
19814
19852
|
return normalized;
|
|
19815
19853
|
}
|
|
19816
|
-
function schemaToRecord(schema) {
|
|
19854
|
+
function schemaToRecord(schema, primitive) {
|
|
19817
19855
|
if (isRecordLike(schema) && typeof schema.toJSONSchema === "function") {
|
|
19818
|
-
return asRecord(schema.toJSONSchema());
|
|
19856
|
+
return asRecord(serializeSchema(primitive, () => schema.toJSONSchema()));
|
|
19819
19857
|
}
|
|
19820
19858
|
return asRecord(schema);
|
|
19821
19859
|
}
|
|
@@ -20929,6 +20967,7 @@ Description: ${action.description || "No description"}`)}
|
|
|
20929
20967
|
init_utils();
|
|
20930
20968
|
init_fs();
|
|
20931
20969
|
import path26 from "path";
|
|
20970
|
+
var stripUndefined = (type) => type.replace(/\s*\|\s*undefined\b/g, "");
|
|
20932
20971
|
async function generateTableTypes(project) {
|
|
20933
20972
|
const tables = [];
|
|
20934
20973
|
for (const tableRef of project.tables) {
|
|
@@ -20950,7 +20989,8 @@ async function generateTableTypes(project) {
|
|
|
20950
20989
|
schema = colDef;
|
|
20951
20990
|
}
|
|
20952
20991
|
const tsType = schema.toTypescriptType ? schema.toTypescriptType() : "any";
|
|
20953
|
-
|
|
20992
|
+
const optional = typeof schema.isOptional === "function" && schema.isOptional() || typeof schema.isNullable === "function" && schema.isNullable() || /\|\s*undefined\b/.test(tsType);
|
|
20993
|
+
columns[colName] = { type: tsType, computed, searchable, optional };
|
|
20954
20994
|
}
|
|
20955
20995
|
tables.push({
|
|
20956
20996
|
name: tableRef.definition.name,
|
|
@@ -20991,7 +21031,7 @@ declare module "@botpress/runtime/_types/tables" {
|
|
|
20991
21031
|
`;
|
|
20992
21032
|
} else {
|
|
20993
21033
|
for (const table of tables) {
|
|
20994
|
-
const inputColumns = Object.entries(table.columns).filter(([_, col]) => !col.computed).map(([name, col]) => ` ${name}: ${col.type};`).join(`
|
|
21034
|
+
const inputColumns = Object.entries(table.columns).filter(([_, col]) => !col.computed).map(([name, col]) => ` ${name}${col.optional ? "?" : ""}: ${col.optional ? stripUndefined(col.type) : col.type};`).join(`
|
|
20995
21035
|
`);
|
|
20996
21036
|
const outputColumns = [
|
|
20997
21037
|
" id: number;",
|
|
@@ -22921,7 +22961,7 @@ declare module "@botpress/runtime/_types/state" {
|
|
|
22921
22961
|
const schema = eventDef.schema;
|
|
22922
22962
|
let schemaCode = "z.object({})";
|
|
22923
22963
|
if (schema && typeof schema.toJSONSchema === "function") {
|
|
22924
|
-
schemaCode = transforms6.fromJSONSchema(schema.toJSONSchema()).toTypescriptSchema();
|
|
22964
|
+
schemaCode = serializeSchema(`Event "${eventName}"`, () => transforms6.fromJSONSchema(schema.toJSONSchema()).toTypescriptSchema());
|
|
22925
22965
|
}
|
|
22926
22966
|
const parts = [`schema: ${schemaCode}`];
|
|
22927
22967
|
if (eventDef.description) {
|
|
@@ -22933,7 +22973,7 @@ declare module "@botpress/runtime/_types/state" {
|
|
|
22933
22973
|
}`);
|
|
22934
22974
|
}
|
|
22935
22975
|
const configSchema = project.config?.configuration?.schema;
|
|
22936
|
-
const configSchemaCode = configSchema ? transforms6.fromJSONSchema(configSchema.toJSONSchema()).toTypescriptSchema() : undefined;
|
|
22976
|
+
const configSchemaCode = configSchema ? serializeSchema("Agent configuration", () => transforms6.fromJSONSchema(configSchema.toJSONSchema()).toTypescriptSchema()) : undefined;
|
|
22937
22977
|
const secretsConfig = project.config?.secrets;
|
|
22938
22978
|
const secretsDef = secretsConfig && Object.keys(secretsConfig).length > 0 ? JSON.stringify(secretsConfig) : undefined;
|
|
22939
22979
|
const hasAnyLifecycle = project.conversations.some((c) => c.definition.hasLifecycle);
|
|
@@ -26143,4 +26183,4 @@ export {
|
|
|
26143
26183
|
ADK_MANIFEST_BOT_TAGS
|
|
26144
26184
|
};
|
|
26145
26185
|
|
|
26146
|
-
//# debugId=
|
|
26186
|
+
//# debugId=9BFB435AD1A0488A64756E2164756E21
|