@botpress/adk-cli 1.19.0-beta.3 → 1.19.0-beta.5
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/assets/ui-dist/assets/{index-CSTz-oTK.js → index-B3b7PPgV.js} +4 -4
- package/{dist/index-DNqXHLNi-27nvpkee.js → assets/ui-dist/assets/index-BESZeTO5.js} +2 -2
- package/{dist/index-DAztRXeA-vr85xnxs.css → assets/ui-dist/assets/index-DIFGtVmI.css} +1 -1
- package/{dist/index-DfjXY3Oo-szsanhnt.js → assets/ui-dist/assets/index-a3ZL0_Jr.js} +2 -2
- package/assets/ui-dist/index.html +2 -2
- package/dist/{README-wjb7z7f0.md → README-824wa4jj.md} +1 -1
- package/dist/SKILL-75ym6tcj.md +257 -0
- package/dist/SKILL-chnwzmt1.md +548 -0
- package/dist/SKILL-d4bs53y3.md +244 -0
- package/dist/SKILL-h4b2f1n9.md +114 -0
- package/dist/SKILL-hbw5nt95.md +111 -0
- package/dist/actions-h7hxxvxr.md +823 -0
- package/dist/adk-build-emhwd0tg.md +39 -0
- package/dist/adk-debug-yrrdtpmb.md +23 -0
- package/dist/adk-dev-console-7z9rtjpy.md +17 -0
- package/dist/adk-document-ras6zzzh.md +68 -0
- package/dist/adk-eval-vx76dwq0.md +17 -0
- package/dist/adk-explain-fcsaw852.md +22 -0
- package/dist/adk-init-9kmxmbbe.md +30 -0
- package/dist/adk-ship-dybzn884.md +29 -0
- package/dist/adk-test-xq67savs.md +27 -0
- package/dist/adk-validate-1p4skv4m.md +31 -0
- package/dist/advanced-patterns-z86m9h1a.md +669 -0
- package/dist/agent-config-1aqvkrgf.md +450 -0
- package/dist/agent-steps-zj4c1n9t.md +115 -0
- package/dist/agent0-assets/skills/adk/SKILL.md +5 -5
- package/dist/agent0-assets/skills/adk/references/cli.md +265 -24
- package/dist/agent0-assets/skills/adk-debugger/SKILL.md +5 -5
- package/dist/agent0-assets/skills/adk-debugger/references/common-failures.md +1 -1
- package/dist/agent0-assets/skills/adk-debugger/references/debug-workflow.md +3 -3
- package/dist/agent0-assets/skills/adk-debugger/references/traces-and-logs.md +15 -7
- package/dist/assets-q7jt8r2q.md +237 -0
- package/dist/autonomous-execution-fymc12e5.md +747 -0
- package/dist/cli-c31e06yr.md +1334 -0
- package/dist/cli.js +963 -548
- package/dist/commands.json +24 -3
- package/dist/common-failures-ht29w2db.md +231 -0
- package/dist/component-registry-bbpw0see.md +43 -0
- package/dist/context-api-760cvh0h.md +461 -0
- package/dist/conversation-analysis-8ka4nrm4.md +420 -0
- package/dist/conversation-lifecycle-4seqqjc1.md +311 -0
- package/dist/conversations-gwfvxaee.md +1111 -0
- package/dist/custom-components-y5wdgpey.md +167 -0
- package/dist/debug-workflow-vz84q80v.md +239 -0
- package/dist/desk-k54ktvsd.md +852 -0
- package/dist/doc-standards-ck6ax2jd.md +124 -0
- package/dist/eval-format-7n9brja4.md +354 -0
- package/dist/evals-y1zcr1mc.md +11 -0
- package/dist/explain-config-1yaq3zzd.md +424 -0
- package/dist/files-dzt0wxn3.md +918 -0
- package/dist/{index-gqxgqnyz.html → index-3t354nbw.html} +2 -2
- package/dist/{index-CSTz-oTK-mdfh47r8.js → index-B3b7PPgV-zetkb01w.js} +4 -4
- package/{assets/ui-dist/assets/index-DNqXHLNi.js → dist/index-BESZeTO5-2rpmcefa.js} +2 -2
- package/{assets/ui-dist/assets/index-DAztRXeA.css → dist/index-DIFGtVmI-d4dhjg97.css} +1 -1
- package/{assets/ui-dist/assets/index-DfjXY3Oo.js → dist/index-a3ZL0_Jr-q145h35p.js} +2 -2
- package/dist/integration-actions-xang7tma.md +659 -0
- package/dist/integrations-k5ss07f4.md +266 -0
- package/dist/interfaces-6t0bpxs4.md +97 -0
- package/dist/knowledge-bases-20rg8p5c.md +456 -0
- package/dist/llm-debugging-76ng8rzm.md +209 -0
- package/dist/mcp-server-n1asyzhv.md +112 -0
- package/dist/messages-gkkg0b54.md +769 -0
- package/dist/model-configuration-f273kgd0.md +201 -0
- package/dist/multi-agent-dashboard-1mdfjdts.md +70 -0
- package/dist/pages-xn18xn73.md +273 -0
- package/dist/patterns-mistakes-5vb99dhf.md +469 -0
- package/dist/plugins-ttnx8f49.md +280 -0
- package/dist/tables-x45t36dd.md +1136 -0
- package/dist/tags-46td3qrg.md +516 -0
- package/dist/test-patterns-hj47w4nc.md +355 -0
- package/dist/testing-workflow-2vkp932f.md +225 -0
- package/dist/tools-wk7bq24z.md +581 -0
- package/dist/trace-summarization-hdyx1c2e.md +313 -0
- package/dist/traces-and-logs-f2kjfh19.md +203 -0
- package/dist/triggers-4j2cc86x.md +719 -0
- package/dist/ui-server-entry.js +977 -162
- package/dist/workflow-steps-mrdrf1c5.md +851 -0
- package/dist/workflows-gadx3s69.md +1408 -0
- package/dist/zai-agent-reference-e6644aad.md +454 -0
- package/dist/zai-complete-guide-mnna5d6f.md +1408 -0
- package/package.json +4 -4
package/dist/cli.js
CHANGED
|
@@ -36942,7 +36942,7 @@ var require_jsx_dev_runtime = __commonJS((exports, module) => {
|
|
|
36942
36942
|
});
|
|
36943
36943
|
|
|
36944
36944
|
// src/utils/build-constants.ts
|
|
36945
|
-
var CLI_VERSION = "1.19.0-beta.
|
|
36945
|
+
var CLI_VERSION = "1.19.0-beta.5", EXPECTED_RUNTIME_VERSION = "1.19.0-beta.5", MIN_SUPPORTED_RUNTIME = "1.17.0", IS_RELEASE_BUILD = false;
|
|
36946
36946
|
|
|
36947
36947
|
// ../../node_modules/.bun/browser-or-node@2.1.1/node_modules/browser-or-node/lib/index.js
|
|
36948
36948
|
var require_lib = __commonJS((exports) => {
|
|
@@ -364769,7 +364769,7 @@ var init_internal = __esm(() => {
|
|
|
364769
364769
|
});
|
|
364770
364770
|
init_define_PACKAGE_VERSIONS = __esm2({
|
|
364771
364771
|
"<define:__PACKAGE_VERSIONS__>"() {
|
|
364772
|
-
define_PACKAGE_VERSIONS_default = { runtime: "1.19.0-beta.
|
|
364772
|
+
define_PACKAGE_VERSIONS_default = { runtime: "1.19.0-beta.5", adk: "not-installed", sdk: "6.11.1", llmz: "0.0.78", zai: "2.6.21", cognitive: "0.5.4" };
|
|
364773
364773
|
}
|
|
364774
364774
|
});
|
|
364775
364775
|
init_eval = __esm2({
|
|
@@ -671415,7 +671415,7 @@ var init_library2 = __esm(() => {
|
|
|
671415
671415
|
});
|
|
671416
671416
|
init_define_PACKAGE_VERSIONS2 = __esm3({
|
|
671417
671417
|
"<define:__PACKAGE_VERSIONS__>"() {
|
|
671418
|
-
define_PACKAGE_VERSIONS_default2 = { runtime: "1.19.0-beta.
|
|
671418
|
+
define_PACKAGE_VERSIONS_default2 = { runtime: "1.19.0-beta.5", adk: "not-installed", sdk: "6.11.1", llmz: "0.0.78", zai: "2.6.21", cognitive: "0.5.4" };
|
|
671419
671419
|
}
|
|
671420
671420
|
});
|
|
671421
671421
|
init_assets2 = __esm3({
|
|
@@ -766139,7 +766139,7 @@ var init_definition3 = __esm(() => {
|
|
|
766139
766139
|
});
|
|
766140
766140
|
init_define_PACKAGE_VERSIONS3 = __esm5({
|
|
766141
766141
|
"<define:__PACKAGE_VERSIONS__>"() {
|
|
766142
|
-
define_PACKAGE_VERSIONS_default3 = { runtime: "1.19.0-beta.
|
|
766142
|
+
define_PACKAGE_VERSIONS_default3 = { runtime: "1.19.0-beta.5", adk: "not-installed", sdk: "6.11.1", llmz: "0.0.78", zai: "2.6.21", cognitive: "0.5.4" };
|
|
766143
766143
|
}
|
|
766144
766144
|
});
|
|
766145
766145
|
init_transcript3 = __esm5({
|
|
@@ -836754,7 +836754,7 @@ var init_runtime6 = __esm(() => {
|
|
|
836754
836754
|
});
|
|
836755
836755
|
init_define_PACKAGE_VERSIONS4 = __esm6({
|
|
836756
836756
|
"<define:__PACKAGE_VERSIONS__>"() {
|
|
836757
|
-
define_PACKAGE_VERSIONS_default4 = { runtime: "1.19.0-beta.
|
|
836757
|
+
define_PACKAGE_VERSIONS_default4 = { runtime: "1.19.0-beta.5", adk: "not-installed", sdk: "6.11.1", llmz: "0.0.78", zai: "2.6.21", cognitive: "0.5.4" };
|
|
836758
836758
|
}
|
|
836759
836759
|
});
|
|
836760
836760
|
init_globals4 = __esm6({
|
|
@@ -903591,7 +903591,7 @@ ${names || " (none found)"}`);
|
|
|
903591
903591
|
async copyTemplateFiles(templateDir) {
|
|
903592
903592
|
const substitutions = {
|
|
903593
903593
|
"{{projectName}}": this.projectName,
|
|
903594
|
-
"{{runtimeVersion}}": "1.19.0-beta.
|
|
903594
|
+
"{{runtimeVersion}}": "1.19.0-beta.5",
|
|
903595
903595
|
"{{packageManager}}": this.packageManager
|
|
903596
903596
|
};
|
|
903597
903597
|
await this.copyDirRecursive(templateDir, this.projectPath, substitutions);
|
|
@@ -909247,11 +909247,11 @@ var semver2, import_ts_morph, import_debug, semver22, import_ts_morph2, import_t
|
|
|
909247
909247
|
`));
|
|
909248
909248
|
return code;
|
|
909249
909249
|
}
|
|
909250
|
-
}, ADK_VERSION = "1.19.0-beta.
|
|
909250
|
+
}, ADK_VERSION = "1.19.0-beta.5", relative4 = (from, to6) => {
|
|
909251
909251
|
const fromDir = path142.dirname(from);
|
|
909252
909252
|
const relative22 = path142.relative(fromDir, to6);
|
|
909253
909253
|
return relative22.startsWith(".") ? relative22 : `./${relative22}`;
|
|
909254
|
-
}, init_utils11 = () => {}, require_chat_bundle, exports_action_types, init_action_types, exports_integration_action_types, init_integration_action_types, require_package3, exports_dependencies, FRIENDLY_ALIAS_RE, BP_INTERNAL_ID_PREFIXES, debug2, BP_CLI_VERSION = "6.8.1", BP_CLI_INSTALL_ALL, BP_CLI_INSTALL_DIR, BP_CLI_BIN_PATH, BP_CLIENT_ENV_KEYS, BpAddCommand, BpBuildCommand, BpDeployCommand, REQUEST_HANDLING_ERROR_MARKER, BpDevCommand, BpChatCommand, workspaceCache, chatBundle, RUNTIME_MODULE = "@botpress/runtime", RUNTIME_NAMED = "CustomComponent", FileWatcher, ai_assistant_instructions_template_default = "# Botpress ADK Agent\n\n> This project is built with the **Botpress Agent Development Kit (ADK)** \u2014 a TypeScript-first framework for building AI agents.\n\n## Key Files\n\n- `agent.config.ts` \u2014 Agent configuration, models, and state schemas\n- `dependencies.dev.lock.json` \u2014 Lock file for dev environment integrations/plugins (source of truth for installed dependencies)\n- `dependencies.prod.lock.json` \u2014 Lock file for prod environment (created after first deploy)\n- `src/conversations/` \u2014 Message handlers (primary user interaction)\n- `src/workflows/` \u2014 Long-running background processes\n- `src/tools/` \u2014 AI-callable functions\n- `src/actions/` \u2014 Reusable business logic\n- `src/knowledge/` \u2014 RAG knowledge base sources\n- `src/tables/` \u2014 Database table definitions\n- `src/triggers/` \u2014 Event-based triggers\n\n## Development\n\n```bash\nadk dev # Start dev server with hot reload\nadk build # Build and generate types\nadk deploy # Deploy to Botpress Cloud\nadk chat # Chat with your agent in the terminal\n```\n\n## CLI Commands (preferred interface)\n\nUse CLI commands with `--format json` for structured output.\n\n### Debugging & Testing\n\n| Command | Use for |\n| --------------------------------------------- | ---------------------------------------------------------------------------------------- |\n| `adk check --format json` | Offline project validation \u2014 catch config and schema errors |\n| `adk chat --single \"<message>\" --format json` | Test messages to the running bot (use --conversation-id <id> to continue a conversation) |\n| `adk logs [error\\|warning] --format json` | Query dev server logs, build output, and errors |\n| `adk traces [filters...] --format json` | Query trace spans for debugging conversations/workflows |\n| `adk status --format json` | Get project info: name, primitives, and integrations |\n\n### Dependencies (Integrations & Plugins)\n\nManage dependencies through the `adk integrations` / `adk plugins` CLI commands or the Integrations view in the dev console \u2014 never by editing lock files directly. The lock files (`dependencies.dev.lock.json` / `dependencies.prod.lock.json`) are a best-effort mirror of cloud state, kept in sync automatically by the CLI; edit them only as a last resort.\n\n**Integrations** (external services: Slack, webchat, etc.)\n\n| Command | Use for |\n| ------------------------------------ | -------------------------------------------------------- |\n| `adk integrations add <name>` | Add an integration (updates lock file) |\n| `adk integrations remove <name>` | Remove an integration |\n| `adk integrations list` | List installed integrations |\n| `adk integrations search <query>` | Search available integrations on the Botpress Hub |\n| `adk integrations info <name>` | Get detailed info about an integration |\n| `adk integrations pull-lock [--env]` | Pull current cloud state into the lock file |\n| `adk integrations push-lock [--env]` | Push the lock file to cloud (apply lock to bot) |\n| `adk integrations diff [--env]` | Show differences between lock and cloud |\n| `adk integrations copy --from --to` | Copy integration state between dev and prod environments |\n\n**Plugins** (reusable bot capabilities)\n\n| Command | Use for |\n| ------------------------------- | ------------------------------------------- |\n| `adk plugins add <name>` | Add a plugin (updates lock file) |\n| `adk plugins remove <name>` | Remove a plugin |\n| `adk plugins list` | List installed plugins |\n| `adk plugins search <query>` | Search available plugins |\n| `adk plugins info <name>` | Get detailed info about a plugin |\n| `adk plugins pull-lock [--env]` | Pull current cloud state into the lock file |\n| `adk plugins push-lock [--env]` | Push the lock file to cloud |\n| `adk plugins diff [--env]` | Show differences between lock and cloud |\n| `adk plugins copy --from --to` | Copy plugin state between dev and prod |\n\n> **Note:** `adk add`, `adk remove`, `adk list`, `adk search`, `adk info` are deprecated aliases \u2014 use `adk integrations <command>` or `adk plugins <command>` instead.\n\n### Workflows\n\n| Command | Use for |\n| ---------------------------------------------------- | -------------------------------------------------- |\n| `adk workflows list --format json` | Discover available workflows |\n| `adk workflows inspect <name> --format json` | Get workflow input schema |\n| `adk workflows run <name> '<payload>' --format json` | Execute a workflow |\n| `adk workflows runs [filters] --format json` | List workflow runs |\n| `adk workflows runs <wrkflow_id> --format json` | Inspect a single run (status + state + step cache) |\n\n> **Tip:** The dev server must be running (`adk dev`) for testing and trace tools to work.\n\n### Skills\n\
|
|
909254
|
+
}, init_utils11 = () => {}, require_chat_bundle, exports_action_types, init_action_types, exports_integration_action_types, init_integration_action_types, require_package3, exports_dependencies, FRIENDLY_ALIAS_RE, BP_INTERNAL_ID_PREFIXES, debug2, BP_CLI_VERSION = "6.8.1", BP_CLI_INSTALL_ALL, BP_CLI_INSTALL_DIR, BP_CLI_BIN_PATH, BP_CLIENT_ENV_KEYS, BpAddCommand, BpBuildCommand, BpDeployCommand, REQUEST_HANDLING_ERROR_MARKER, BpDevCommand, BpChatCommand, workspaceCache, chatBundle, RUNTIME_MODULE = "@botpress/runtime", RUNTIME_NAMED = "CustomComponent", FileWatcher, ai_assistant_instructions_template_default = "# Botpress ADK Agent\n\n> This project is built with the **Botpress Agent Development Kit (ADK)** \u2014 a TypeScript-first framework for building AI agents.\n\n## Key Files\n\n- `agent.config.ts` \u2014 Agent configuration, models, and state schemas\n- `dependencies.dev.lock.json` \u2014 Lock file for dev environment integrations/plugins (source of truth for installed dependencies)\n- `dependencies.prod.lock.json` \u2014 Lock file for prod environment (created after first deploy)\n- `src/conversations/` \u2014 Message handlers (primary user interaction)\n- `src/workflows/` \u2014 Long-running background processes\n- `src/tools/` \u2014 AI-callable functions\n- `src/actions/` \u2014 Reusable business logic\n- `src/knowledge/` \u2014 RAG knowledge base sources\n- `src/tables/` \u2014 Database table definitions\n- `src/triggers/` \u2014 Event-based triggers\n\n## Development\n\n```bash\nadk dev # Start dev server with hot reload\nadk build # Build and generate types\nadk deploy # Deploy to Botpress Cloud\nadk chat # Chat with your agent in the terminal\n```\n\n## CLI Commands (preferred interface)\n\nUse CLI commands with `--format json` for structured output.\n\n### Debugging & Testing\n\n| Command | Use for |\n| --------------------------------------------- | ---------------------------------------------------------------------------------------- |\n| `adk check --format json` | Offline project validation \u2014 catch config and schema errors |\n| `adk chat --single \"<message>\" --format json` | Test messages to the running bot (use --conversation-id <id> to continue a conversation) |\n| `adk logs [error\\|warning] --format json` | Query dev server logs, build output, and errors |\n| `adk traces [filters...] --format json` | Query trace spans for debugging conversations/workflows |\n| `adk status --format json` | Get project info: name, primitives, and integrations |\n\n### Dependencies (Integrations & Plugins)\n\nManage dependencies through the `adk integrations` / `adk plugins` CLI commands or the Integrations view in the dev console \u2014 never by editing lock files directly. The lock files (`dependencies.dev.lock.json` / `dependencies.prod.lock.json`) are a best-effort mirror of cloud state, kept in sync automatically by the CLI; edit them only as a last resort.\n\n**Integrations** (external services: Slack, webchat, etc.)\n\n| Command | Use for |\n| ------------------------------------ | -------------------------------------------------------- |\n| `adk integrations add <name>` | Add an integration (updates lock file) |\n| `adk integrations remove <name>` | Remove an integration |\n| `adk integrations list` | List installed integrations |\n| `adk integrations search <query>` | Search available integrations on the Botpress Hub |\n| `adk integrations info <name>` | Get detailed info about an integration |\n| `adk integrations pull-lock [--env]` | Pull current cloud state into the lock file |\n| `adk integrations push-lock [--env]` | Push the lock file to cloud (apply lock to bot) |\n| `adk integrations diff [--env]` | Show differences between lock and cloud |\n| `adk integrations copy --from --to` | Copy integration state between dev and prod environments |\n\n**Plugins** (reusable bot capabilities)\n\n| Command | Use for |\n| ------------------------------- | ------------------------------------------- |\n| `adk plugins add <name>` | Add a plugin (updates lock file) |\n| `adk plugins remove <name>` | Remove a plugin |\n| `adk plugins list` | List installed plugins |\n| `adk plugins search <query>` | Search available plugins |\n| `adk plugins info <name>` | Get detailed info about a plugin |\n| `adk plugins pull-lock [--env]` | Pull current cloud state into the lock file |\n| `adk plugins push-lock [--env]` | Push the lock file to cloud |\n| `adk plugins diff [--env]` | Show differences between lock and cloud |\n| `adk plugins copy --from --to` | Copy plugin state between dev and prod |\n\n> **Note:** `adk add`, `adk remove`, `adk list`, `adk search`, `adk info` are deprecated aliases \u2014 use `adk integrations <command>` or `adk plugins <command>` instead.\n\n### Workflows\n\n| Command | Use for |\n| ---------------------------------------------------- | -------------------------------------------------- |\n| `adk workflows list --format json` | Discover available workflows |\n| `adk workflows inspect <name> --format json` | Get workflow input schema |\n| `adk workflows run <name> '<payload>' --format json` | Execute a workflow |\n| `adk workflows runs [filters] --format json` | List workflow runs |\n| `adk workflows runs <wrkflow_id> --format json` | Inspect a single run (status + state + step cache) |\n\n> **Tip:** The dev server must be running (`adk dev`) for testing and trace tools to work.\n\n### Skills\n\n`adk init` creates the Agent(0) project capability bundle at `.agent0/capabilities` and installs public ADK skills/commands for external coding harnesses. If the Agent(0) bundle is missing or stale after an ADK upgrade, run `adk agent0 upgrade`.\n\n## Project Overview\n\n<!-- Describe what your agent does -->\n\n## Architecture & Conventions\n\n<!-- Add project-specific patterns, decisions, and conventions -->\n\n## Notes\n\n<!-- Add anything else relevant to your project -->\n", TEXT_EXTENSIONS, DEPLOYED_AGENT_MANIFEST_SCHEMA_VERSION = 1, DEPLOYED_AGENT_MANIFEST_FILE_KEY = ".adk/deployed-agent-manifest.json", ADK_MANIFEST_BOT_TAGS, DEPLOYED_AGENT_MANIFEST_TAGS, deployedAgentManifestPrimitiveSchema, deployedAgentManifestSchema, transforms, getIntegrationHash = (integration) => {
|
|
909255
909255
|
return crypto26.createHash("sha256").update(`${integration.alias}|${integration.definition?.id}|${integration.definition?.version}|${integration.definition?.updatedAt}`).digest("hex");
|
|
909256
909256
|
}, getPascalAlias = (integration) => pascalCase(getIntegrationAlias(integration.alias)), getIntegrationNames = (integration) => ({
|
|
909257
909257
|
typings: {
|
|
@@ -921693,7 +921693,7 @@ caused by: ` + e7.fullStack(i7);
|
|
|
921693
921693
|
require_package3 = __commonJS9((exports7, module) => {
|
|
921694
921694
|
module.exports = {
|
|
921695
921695
|
name: "@botpress/adk",
|
|
921696
|
-
version: "1.19.0-beta.
|
|
921696
|
+
version: "1.19.0-beta.5",
|
|
921697
921697
|
description: "Core ADK library for building AI agents on Botpress",
|
|
921698
921698
|
keywords: [
|
|
921699
921699
|
"adk",
|
|
@@ -921750,7 +921750,7 @@ caused by: ` + e7.fullStack(i7);
|
|
|
921750
921750
|
"@botpress/cli": "~6.8.1",
|
|
921751
921751
|
"@botpress/client": "~1.46.0",
|
|
921752
921752
|
"@botpress/cognitive": "~0.5.4",
|
|
921753
|
-
"@botpress/runtime": "^1.19.0-beta.
|
|
921753
|
+
"@botpress/runtime": "^1.19.0-beta.5",
|
|
921754
921754
|
"@botpress/sdk": "~6.11.1",
|
|
921755
921755
|
"@bpinternal/jex": "^1.2.4",
|
|
921756
921756
|
"@bpinternal/yargs-extra": "^0.0.21",
|
|
@@ -935092,19 +935092,19 @@ var init_embedded_assets_generated = __esm(() => {
|
|
|
935092
935092
|
|
|
935093
935093
|
// src/utils/embedded-assets.ts
|
|
935094
935094
|
function getEmbeddedAssets() {
|
|
935095
|
-
return _assets;
|
|
935095
|
+
return _assets ?? [];
|
|
935096
935096
|
}
|
|
935097
935097
|
function getEmbeddedAsset(path50) {
|
|
935098
|
-
return
|
|
935098
|
+
return getEmbeddedAssets().find((asset) => asset.path === path50);
|
|
935099
935099
|
}
|
|
935100
935100
|
function hasEmbeddedAssets() {
|
|
935101
|
-
return
|
|
935101
|
+
return getEmbeddedAssets().length > 0;
|
|
935102
935102
|
}
|
|
935103
935103
|
var _assets;
|
|
935104
935104
|
var init_embedded_assets = __esm(async () => {
|
|
935105
935105
|
try {
|
|
935106
935106
|
const mod = await Promise.resolve().then(() => (init_embedded_assets_generated(), exports_embedded_assets_generated));
|
|
935107
|
-
_assets = mod.embeddedAssets;
|
|
935107
|
+
_assets = Array.isArray(mod.embeddedAssets) ? mod.embeddedAssets : [];
|
|
935108
935108
|
} catch (e7) {
|
|
935109
935109
|
if (e7?.code !== "MODULE_NOT_FOUND" && e7?.name !== "ResolveError" && e7?.name !== "ResolveMessage")
|
|
935110
935110
|
throw e7;
|
|
@@ -937002,12 +937002,283 @@ var init_project_supervisor = __esm(() => {
|
|
|
937002
937002
|
ADK_DIR2 = join20(homedir7(), ".adk");
|
|
937003
937003
|
});
|
|
937004
937004
|
|
|
937005
|
+
// src/utils/agent0-capabilities.ts
|
|
937006
|
+
import {
|
|
937007
|
+
copyFileSync as copyFileSync2,
|
|
937008
|
+
existsSync as existsSync16,
|
|
937009
|
+
mkdirSync as mkdirSync4,
|
|
937010
|
+
readdirSync as readdirSync7,
|
|
937011
|
+
readFileSync as readFileSync17,
|
|
937012
|
+
rmSync,
|
|
937013
|
+
statSync as statSync4,
|
|
937014
|
+
writeFileSync as writeFileSync8
|
|
937015
|
+
} from "fs";
|
|
937016
|
+
import { basename as basename4, dirname as dirname9, extname as extname3, join as join21, normalize as normalize9, sep as sep9 } from "path";
|
|
937017
|
+
import { fileURLToPath as fileURLToPath13 } from "url";
|
|
937018
|
+
function getCurrentAgent0CapabilityBundleVersion() {
|
|
937019
|
+
return CLI_VERSION;
|
|
937020
|
+
}
|
|
937021
|
+
function getAgent0ProjectCapabilitiesRoot(projectPath) {
|
|
937022
|
+
return join21(projectPath, AGENT0_PROJECT_DIR, AGENT0_PROJECT_CAPABILITIES_DIR);
|
|
937023
|
+
}
|
|
937024
|
+
function getAgent0ProjectCapabilitiesManifestPath(projectPath) {
|
|
937025
|
+
return join21(getAgent0ProjectCapabilitiesRoot(projectPath), AGENT0_PROJECT_CAPABILITIES_MANIFEST);
|
|
937026
|
+
}
|
|
937027
|
+
function readAgent0CapabilitiesManifest(projectPath) {
|
|
937028
|
+
const manifestPath = getAgent0ProjectCapabilitiesManifestPath(projectPath);
|
|
937029
|
+
if (!existsSync16(manifestPath))
|
|
937030
|
+
return;
|
|
937031
|
+
try {
|
|
937032
|
+
const value2 = JSON.parse(readFileSync17(manifestPath, "utf8"));
|
|
937033
|
+
if (value2.schemaVersion !== 1 || typeof value2.capabilityBundleVersion !== "string")
|
|
937034
|
+
return;
|
|
937035
|
+
return {
|
|
937036
|
+
schemaVersion: 1,
|
|
937037
|
+
adkVersion: typeof value2.adkVersion === "string" ? value2.adkVersion : value2.capabilityBundleVersion,
|
|
937038
|
+
capabilityBundleVersion: value2.capabilityBundleVersion,
|
|
937039
|
+
generatedAt: typeof value2.generatedAt === "string" ? value2.generatedAt : "",
|
|
937040
|
+
capabilitiesRoot: typeof value2.capabilitiesRoot === "string" ? value2.capabilitiesRoot : "",
|
|
937041
|
+
skills: Array.isArray(value2.skills) ? value2.skills.filter((item) => typeof item === "string") : [],
|
|
937042
|
+
playbooks: Array.isArray(value2.playbooks) ? value2.playbooks.filter((item) => typeof item === "string") : []
|
|
937043
|
+
};
|
|
937044
|
+
} catch {
|
|
937045
|
+
return;
|
|
937046
|
+
}
|
|
937047
|
+
}
|
|
937048
|
+
function checkAgent0CapabilitiesStatus(projectPath) {
|
|
937049
|
+
const currentVersion = getCurrentAgent0CapabilityBundleVersion();
|
|
937050
|
+
const manifestPath = getAgent0ProjectCapabilitiesManifestPath(projectPath);
|
|
937051
|
+
const manifest = readAgent0CapabilitiesManifest(projectPath);
|
|
937052
|
+
if (!manifest) {
|
|
937053
|
+
return { state: "missing", currentVersion, manifestPath };
|
|
937054
|
+
}
|
|
937055
|
+
if (manifest.capabilityBundleVersion !== currentVersion) {
|
|
937056
|
+
return {
|
|
937057
|
+
state: "stale",
|
|
937058
|
+
currentVersion,
|
|
937059
|
+
installedVersion: manifest.capabilityBundleVersion,
|
|
937060
|
+
manifestPath
|
|
937061
|
+
};
|
|
937062
|
+
}
|
|
937063
|
+
if (!manifestHasRequiredCapabilityFiles(projectPath, manifest)) {
|
|
937064
|
+
return {
|
|
937065
|
+
state: "stale",
|
|
937066
|
+
currentVersion,
|
|
937067
|
+
installedVersion: manifest.capabilityBundleVersion,
|
|
937068
|
+
manifestPath
|
|
937069
|
+
};
|
|
937070
|
+
}
|
|
937071
|
+
return {
|
|
937072
|
+
state: "current",
|
|
937073
|
+
currentVersion,
|
|
937074
|
+
installedVersion: manifest.capabilityBundleVersion,
|
|
937075
|
+
manifestPath
|
|
937076
|
+
};
|
|
937077
|
+
}
|
|
937078
|
+
function manifestHasRequiredCapabilityFiles(projectPath, manifest) {
|
|
937079
|
+
if (manifest.skills.length === 0 || manifest.playbooks.length === 0)
|
|
937080
|
+
return false;
|
|
937081
|
+
const capabilitiesRoot = getAgent0ProjectCapabilitiesRoot(projectPath);
|
|
937082
|
+
return manifest.skills.every((skill) => isFile7(join21(capabilitiesRoot, AGENT0_PROJECT_SKILLS_DIR, skill, "SKILL.md"))) && manifest.playbooks.every((playbook) => isFile7(join21(capabilitiesRoot, AGENT0_PROJECT_PLAYBOOKS_DIR, playbook)));
|
|
937083
|
+
}
|
|
937084
|
+
function isFile7(path51) {
|
|
937085
|
+
return existsSync16(path51) && statSync4(path51).isFile();
|
|
937086
|
+
}
|
|
937087
|
+
async function installAgent0Capabilities(projectPath) {
|
|
937088
|
+
const capabilitiesRoot = getAgent0ProjectCapabilitiesRoot(projectPath);
|
|
937089
|
+
const manifestPath = getAgent0ProjectCapabilitiesManifestPath(projectPath);
|
|
937090
|
+
const previousManifest = readAgent0CapabilitiesManifest(projectPath);
|
|
937091
|
+
const status = checkAgent0CapabilitiesStatus(projectPath);
|
|
937092
|
+
const source = resolveCapabilitySource();
|
|
937093
|
+
mkdirSync4(capabilitiesRoot, { recursive: true });
|
|
937094
|
+
cleanupManagedCapabilities(projectPath, previousManifest, source);
|
|
937095
|
+
await copyCapabilitiesToProject(capabilitiesRoot, source);
|
|
937096
|
+
const manifest = {
|
|
937097
|
+
schemaVersion: 1,
|
|
937098
|
+
adkVersion: getCurrentAgent0CapabilityBundleVersion(),
|
|
937099
|
+
capabilityBundleVersion: getCurrentAgent0CapabilityBundleVersion(),
|
|
937100
|
+
generatedAt: new Date().toISOString(),
|
|
937101
|
+
capabilitiesRoot: join21(AGENT0_PROJECT_DIR, AGENT0_PROJECT_CAPABILITIES_DIR),
|
|
937102
|
+
skills: source.skills,
|
|
937103
|
+
playbooks: source.playbooks
|
|
937104
|
+
};
|
|
937105
|
+
writeFileSync8(manifestPath, JSON.stringify(manifest, null, 2) + `
|
|
937106
|
+
`);
|
|
937107
|
+
return {
|
|
937108
|
+
success: true,
|
|
937109
|
+
projectPath,
|
|
937110
|
+
capabilitiesRoot,
|
|
937111
|
+
manifestPath,
|
|
937112
|
+
source: source.kind,
|
|
937113
|
+
currentVersion: getCurrentAgent0CapabilityBundleVersion(),
|
|
937114
|
+
previousVersion: status.state === "missing" ? undefined : status.installedVersion ?? previousManifest?.capabilityBundleVersion,
|
|
937115
|
+
wasCurrent: status.state === "current",
|
|
937116
|
+
skills: {
|
|
937117
|
+
installed: source.skills.length,
|
|
937118
|
+
names: source.skills
|
|
937119
|
+
},
|
|
937120
|
+
playbooks: {
|
|
937121
|
+
installed: source.playbooks.length,
|
|
937122
|
+
files: source.playbooks
|
|
937123
|
+
}
|
|
937124
|
+
};
|
|
937125
|
+
}
|
|
937126
|
+
function resolveCapabilitySource() {
|
|
937127
|
+
const embedded = resolveEmbeddedCapabilitySource();
|
|
937128
|
+
if (embedded)
|
|
937129
|
+
return embedded;
|
|
937130
|
+
const skillsRoot = resolveBundledSkillsRoot();
|
|
937131
|
+
const playbooksRoot = resolveBundledPlaybooksRoot();
|
|
937132
|
+
if (!skillsRoot || !playbooksRoot) {
|
|
937133
|
+
throw new Error("Agent(0) capability bundle is missing from this ADK installation.");
|
|
937134
|
+
}
|
|
937135
|
+
return {
|
|
937136
|
+
kind: "filesystem",
|
|
937137
|
+
skillsRoot,
|
|
937138
|
+
playbooksRoot,
|
|
937139
|
+
skills: listSkillNames(skillsRoot),
|
|
937140
|
+
playbooks: listMarkdownFiles(playbooksRoot)
|
|
937141
|
+
};
|
|
937142
|
+
}
|
|
937143
|
+
function resolveBundledSkillsRoot() {
|
|
937144
|
+
const baseDir = moduleDir();
|
|
937145
|
+
return firstExistingDirectory([
|
|
937146
|
+
join21(baseDir, "agent0-assets", "skills"),
|
|
937147
|
+
join21(baseDir, "..", "agent0-assets", "skills"),
|
|
937148
|
+
join21(baseDir, "..", "..", "agent0-assets", "skills"),
|
|
937149
|
+
join21(baseDir, "..", "..", "..", "adk", "src", "agent0", "capabilities", "skills"),
|
|
937150
|
+
join21(baseDir, "..", "..", "..", "adk", "dist", "agent0", "capabilities", "skills")
|
|
937151
|
+
]);
|
|
937152
|
+
}
|
|
937153
|
+
function resolveBundledPlaybooksRoot() {
|
|
937154
|
+
const baseDir = moduleDir();
|
|
937155
|
+
return firstExistingDirectory([
|
|
937156
|
+
join21(baseDir, "agent0-assets", "playbooks"),
|
|
937157
|
+
join21(baseDir, "..", "agent0-assets", "playbooks"),
|
|
937158
|
+
join21(baseDir, "..", "..", "agent0-assets", "playbooks"),
|
|
937159
|
+
join21(baseDir, "..", "..", "..", "adk", "src", "agent0", "capabilities", "commands"),
|
|
937160
|
+
join21(baseDir, "..", "..", "..", "adk", "dist", "agent0", "capabilities", "commands")
|
|
937161
|
+
]);
|
|
937162
|
+
}
|
|
937163
|
+
function resolveEmbeddedCapabilitySource() {
|
|
937164
|
+
const files = [];
|
|
937165
|
+
const skills = new Set;
|
|
937166
|
+
const playbooks = new Set;
|
|
937167
|
+
for (const asset of getAvailableEmbeddedAssets()) {
|
|
937168
|
+
const normalizedPath = asset.path.replace(/\\/g, "/");
|
|
937169
|
+
const skillRelative = stripPrefix(normalizedPath, EMBEDDED_SKILLS_PREFIX);
|
|
937170
|
+
if (skillRelative) {
|
|
937171
|
+
const skillName = firstPathSegment(skillRelative);
|
|
937172
|
+
if (!skillName)
|
|
937173
|
+
continue;
|
|
937174
|
+
skills.add(skillName);
|
|
937175
|
+
files.push({ asset, relativePath: join21(AGENT0_PROJECT_SKILLS_DIR, skillRelative) });
|
|
937176
|
+
continue;
|
|
937177
|
+
}
|
|
937178
|
+
const playbookRelative = stripPrefix(normalizedPath, EMBEDDED_PLAYBOOKS_PREFIX) ?? stripPrefix(normalizedPath, EMBEDDED_COMMANDS_PREFIX);
|
|
937179
|
+
if (playbookRelative && extname3(playbookRelative) === ".md") {
|
|
937180
|
+
playbooks.add(basename4(playbookRelative));
|
|
937181
|
+
files.push({ asset, relativePath: join21(AGENT0_PROJECT_PLAYBOOKS_DIR, playbookRelative) });
|
|
937182
|
+
}
|
|
937183
|
+
}
|
|
937184
|
+
if (skills.size === 0 || playbooks.size === 0)
|
|
937185
|
+
return;
|
|
937186
|
+
return {
|
|
937187
|
+
kind: "embedded",
|
|
937188
|
+
files,
|
|
937189
|
+
skills: [...skills].toSorted(),
|
|
937190
|
+
playbooks: [...playbooks].toSorted()
|
|
937191
|
+
};
|
|
937192
|
+
}
|
|
937193
|
+
function getAvailableEmbeddedAssets() {
|
|
937194
|
+
const getEmbeddedAssets2 = getEmbeddedAssets;
|
|
937195
|
+
if (typeof getEmbeddedAssets2 !== "function")
|
|
937196
|
+
return [];
|
|
937197
|
+
const assets2 = getEmbeddedAssets2();
|
|
937198
|
+
return Array.isArray(assets2) ? assets2 : [];
|
|
937199
|
+
}
|
|
937200
|
+
async function copyCapabilitiesToProject(capabilitiesRoot, source) {
|
|
937201
|
+
if (source.kind === "embedded") {
|
|
937202
|
+
for (const file of source.files) {
|
|
937203
|
+
const destination = safeJoin(capabilitiesRoot, file.relativePath);
|
|
937204
|
+
mkdirSync4(dirname9(destination), { recursive: true });
|
|
937205
|
+
const bytes3 = Buffer.from(await Bun.file(file.asset.file).arrayBuffer());
|
|
937206
|
+
writeFileSync8(destination, bytes3);
|
|
937207
|
+
}
|
|
937208
|
+
return;
|
|
937209
|
+
}
|
|
937210
|
+
const skillsRoot = join21(capabilitiesRoot, AGENT0_PROJECT_SKILLS_DIR);
|
|
937211
|
+
const playbooksRoot = join21(capabilitiesRoot, AGENT0_PROJECT_PLAYBOOKS_DIR);
|
|
937212
|
+
mkdirSync4(playbooksRoot, { recursive: true });
|
|
937213
|
+
for (const skill of source.skills) {
|
|
937214
|
+
copyTree(join21(source.skillsRoot, skill), join21(skillsRoot, skill));
|
|
937215
|
+
}
|
|
937216
|
+
for (const playbook of source.playbooks) {
|
|
937217
|
+
copyFileSync2(join21(source.playbooksRoot, playbook), join21(playbooksRoot, playbook));
|
|
937218
|
+
}
|
|
937219
|
+
}
|
|
937220
|
+
function cleanupManagedCapabilities(projectPath, _previousManifest, _source) {
|
|
937221
|
+
const capabilitiesRoot = getAgent0ProjectCapabilitiesRoot(projectPath);
|
|
937222
|
+
const skillsRoot = join21(capabilitiesRoot, AGENT0_PROJECT_SKILLS_DIR);
|
|
937223
|
+
const playbooksRoot = join21(capabilitiesRoot, AGENT0_PROJECT_PLAYBOOKS_DIR);
|
|
937224
|
+
rmSync(skillsRoot, { recursive: true, force: true });
|
|
937225
|
+
rmSync(playbooksRoot, { recursive: true, force: true });
|
|
937226
|
+
}
|
|
937227
|
+
function copyTree(source, destination) {
|
|
937228
|
+
const stats = statSync4(source);
|
|
937229
|
+
if (stats.isDirectory()) {
|
|
937230
|
+
mkdirSync4(destination, { recursive: true });
|
|
937231
|
+
for (const entry of readdirSync7(source)) {
|
|
937232
|
+
copyTree(join21(source, entry), join21(destination, entry));
|
|
937233
|
+
}
|
|
937234
|
+
return;
|
|
937235
|
+
}
|
|
937236
|
+
mkdirSync4(dirname9(destination), { recursive: true });
|
|
937237
|
+
copyFileSync2(source, destination);
|
|
937238
|
+
}
|
|
937239
|
+
function listSkillNames(skillsRoot) {
|
|
937240
|
+
return readdirSync7(skillsRoot).toSorted().filter((entry) => {
|
|
937241
|
+
const skillDir = join21(skillsRoot, entry);
|
|
937242
|
+
return statSync4(skillDir).isDirectory() && existsSync16(join21(skillDir, "SKILL.md"));
|
|
937243
|
+
});
|
|
937244
|
+
}
|
|
937245
|
+
function listMarkdownFiles(root4) {
|
|
937246
|
+
return readdirSync7(root4).toSorted().filter((entry) => extname3(entry) === ".md" && statSync4(join21(root4, entry)).isFile());
|
|
937247
|
+
}
|
|
937248
|
+
function firstExistingDirectory(paths) {
|
|
937249
|
+
return paths.find((path51) => existsSync16(path51) && statSync4(path51).isDirectory());
|
|
937250
|
+
}
|
|
937251
|
+
function stripPrefix(value2, prefix) {
|
|
937252
|
+
return value2.startsWith(prefix) ? value2.slice(prefix.length) : undefined;
|
|
937253
|
+
}
|
|
937254
|
+
function firstPathSegment(value2) {
|
|
937255
|
+
return value2.split("/").find(Boolean);
|
|
937256
|
+
}
|
|
937257
|
+
function safeJoin(root4, relativePath) {
|
|
937258
|
+
const destination = normalize9(join21(root4, relativePath));
|
|
937259
|
+
const normalizedRoot = normalize9(root4);
|
|
937260
|
+
if (destination !== normalizedRoot && !destination.startsWith(normalizedRoot + sep9)) {
|
|
937261
|
+
throw new Error(`Refusing to write Agent(0) capability outside ${root4}: ${relativePath}`);
|
|
937262
|
+
}
|
|
937263
|
+
return destination;
|
|
937264
|
+
}
|
|
937265
|
+
function moduleDir() {
|
|
937266
|
+
return dirname9(fileURLToPath13(import.meta.url));
|
|
937267
|
+
}
|
|
937268
|
+
var AGENT0_PROJECT_DIR = ".agent0", AGENT0_PROJECT_CAPABILITIES_DIR = "capabilities", AGENT0_PROJECT_SKILLS_DIR = "skills", AGENT0_PROJECT_PLAYBOOKS_DIR = "playbooks", AGENT0_PROJECT_CAPABILITIES_MANIFEST = "manifest.json", EMBEDDED_CAPABILITIES_PREFIX = "/agent0-capabilities", EMBEDDED_SKILLS_PREFIX, EMBEDDED_PLAYBOOKS_PREFIX, EMBEDDED_COMMANDS_PREFIX;
|
|
937269
|
+
var init_agent0_capabilities = __esm(async () => {
|
|
937270
|
+
await init_embedded_assets();
|
|
937271
|
+
EMBEDDED_SKILLS_PREFIX = `${EMBEDDED_CAPABILITIES_PREFIX}/skills/`;
|
|
937272
|
+
EMBEDDED_PLAYBOOKS_PREFIX = `${EMBEDDED_CAPABILITIES_PREFIX}/playbooks/`;
|
|
937273
|
+
EMBEDDED_COMMANDS_PREFIX = `${EMBEDDED_CAPABILITIES_PREFIX}/commands/`;
|
|
937274
|
+
});
|
|
937275
|
+
|
|
937005
937276
|
// package.json
|
|
937006
937277
|
var package_default;
|
|
937007
937278
|
var init_package = __esm(() => {
|
|
937008
937279
|
package_default = {
|
|
937009
937280
|
name: "@botpress/adk-cli",
|
|
937010
|
-
version: "1.19.0-beta.
|
|
937281
|
+
version: "1.19.0-beta.5",
|
|
937011
937282
|
description: "Command-line interface for the Botpress Agent Development Kit (ADK)",
|
|
937012
937283
|
keywords: [
|
|
937013
937284
|
"adk",
|
|
@@ -937049,12 +937320,12 @@ var init_package = __esm(() => {
|
|
|
937049
937320
|
"check:type": "bun scripts/generate-build-constants.ts >/dev/null && bun scripts/embed-assets.ts >/dev/null && tsc --noEmit"
|
|
937050
937321
|
},
|
|
937051
937322
|
dependencies: {
|
|
937052
|
-
"@botpress/adk": "^1.19.0-beta.
|
|
937323
|
+
"@botpress/adk": "^1.19.0-beta.5",
|
|
937053
937324
|
"@botpress/chat": "~0.5.5",
|
|
937054
937325
|
"@botpress/cli": "~6.8.1",
|
|
937055
937326
|
"@botpress/client": "~1.46.0",
|
|
937056
|
-
"@botpress/evals": "^1.19.0-beta.
|
|
937057
|
-
"@botpress/runtime": "^1.19.0-beta.
|
|
937327
|
+
"@botpress/evals": "^1.19.0-beta.5",
|
|
937328
|
+
"@botpress/runtime": "^1.19.0-beta.5",
|
|
937058
937329
|
"@botpress/sdk": "~6.11.1",
|
|
937059
937330
|
"@botpress/webchat-client": "^0.7.2",
|
|
937060
937331
|
"@modelcontextprotocol/sdk": "^1.25.1",
|
|
@@ -937092,15 +937363,15 @@ var exports_adk_version = {};
|
|
|
937092
937363
|
__export(exports_adk_version, {
|
|
937093
937364
|
getAdkVersion: () => getAdkVersion2
|
|
937094
937365
|
});
|
|
937095
|
-
import { readFileSync as
|
|
937096
|
-
import { join as
|
|
937366
|
+
import { readFileSync as readFileSync18 } from "fs";
|
|
937367
|
+
import { join as join22 } from "path";
|
|
937097
937368
|
function getAdkVersion2() {
|
|
937098
937369
|
if (_cachedVersion !== undefined) {
|
|
937099
937370
|
return _cachedVersion;
|
|
937100
937371
|
}
|
|
937101
937372
|
try {
|
|
937102
|
-
const adkPackagePath =
|
|
937103
|
-
const pkg = JSON.parse(
|
|
937373
|
+
const adkPackagePath = join22(process.cwd(), "node_modules/@botpress/adk/package.json");
|
|
937374
|
+
const pkg = JSON.parse(readFileSync18(adkPackagePath, "utf-8"));
|
|
937104
937375
|
_cachedVersion = pkg.version;
|
|
937105
937376
|
} catch {
|
|
937106
937377
|
_cachedVersion = package_default.version;
|
|
@@ -937131,17 +937402,184 @@ var init_skills_ref = __esm(() => {
|
|
|
937131
937402
|
init_adk_version();
|
|
937132
937403
|
});
|
|
937133
937404
|
|
|
937405
|
+
// src/utils/fetch-commands.ts
|
|
937406
|
+
import { existsSync as existsSync17, mkdirSync as mkdirSync5, writeFileSync as writeFileSync9 } from "fs";
|
|
937407
|
+
import { basename as basename5, join as join23 } from "path";
|
|
937408
|
+
function getGithubRawBase() {
|
|
937409
|
+
return `https://raw.githubusercontent.com/${REPO}/${getSkillsGitRef()}/${COMMANDS_DIR}`;
|
|
937410
|
+
}
|
|
937411
|
+
function isManifest(value2) {
|
|
937412
|
+
return ManifestSchema.safeParse(value2).success;
|
|
937413
|
+
}
|
|
937414
|
+
async function fetchWithTimeout(url6, timeoutMs) {
|
|
937415
|
+
const controller = new AbortController;
|
|
937416
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
937417
|
+
try {
|
|
937418
|
+
return await fetch(url6, { signal: controller.signal });
|
|
937419
|
+
} finally {
|
|
937420
|
+
clearTimeout(timer);
|
|
937421
|
+
}
|
|
937422
|
+
}
|
|
937423
|
+
async function fetchManifest() {
|
|
937424
|
+
try {
|
|
937425
|
+
const res = await fetchWithTimeout(`${getGithubRawBase()}/manifest.json`, REQUEST_TIMEOUT_MS);
|
|
937426
|
+
if (!res.ok) {
|
|
937427
|
+
return null;
|
|
937428
|
+
}
|
|
937429
|
+
const data = await res.json();
|
|
937430
|
+
if (!isManifest(data)) {
|
|
937431
|
+
return null;
|
|
937432
|
+
}
|
|
937433
|
+
return data;
|
|
937434
|
+
} catch {
|
|
937435
|
+
return null;
|
|
937436
|
+
}
|
|
937437
|
+
}
|
|
937438
|
+
function listCommandFiles(manifest) {
|
|
937439
|
+
if (manifest && manifest.commands.length > 0) {
|
|
937440
|
+
return manifest.commands.map((entry) => entry.path);
|
|
937441
|
+
}
|
|
937442
|
+
return [];
|
|
937443
|
+
}
|
|
937444
|
+
async function downloadCommand(filePath) {
|
|
937445
|
+
try {
|
|
937446
|
+
const res = await fetchWithTimeout(`${getGithubRawBase()}/${filePath}`, REQUEST_TIMEOUT_MS);
|
|
937447
|
+
if (!res.ok) {
|
|
937448
|
+
return null;
|
|
937449
|
+
}
|
|
937450
|
+
return await res.text();
|
|
937451
|
+
} catch {
|
|
937452
|
+
return null;
|
|
937453
|
+
}
|
|
937454
|
+
}
|
|
937455
|
+
async function installCommands(projectPath, targets) {
|
|
937456
|
+
const result2 = { attempted: true, success: true, installedCommands: 0, failed: 0 };
|
|
937457
|
+
const targetPaths = targets.map((t9) => join23(projectPath, TARGET_DIRS[t9]));
|
|
937458
|
+
for (const dir of targetPaths) {
|
|
937459
|
+
if (!existsSync17(dir)) {
|
|
937460
|
+
mkdirSync5(dir, { recursive: true });
|
|
937461
|
+
}
|
|
937462
|
+
}
|
|
937463
|
+
const manifest = await fetchManifest();
|
|
937464
|
+
const filenames = listCommandFiles(manifest);
|
|
937465
|
+
const downloads = await Promise.all(filenames.map(async (filePath) => {
|
|
937466
|
+
const content = await downloadCommand(filePath);
|
|
937467
|
+
return { filePath, content };
|
|
937468
|
+
}));
|
|
937469
|
+
for (const { filePath, content } of downloads) {
|
|
937470
|
+
if (content === null) {
|
|
937471
|
+
result2.failed += 1;
|
|
937472
|
+
continue;
|
|
937473
|
+
}
|
|
937474
|
+
const outputName = basename5(filePath);
|
|
937475
|
+
for (const dir of targetPaths) {
|
|
937476
|
+
writeFileSync9(join23(dir, outputName), content);
|
|
937477
|
+
}
|
|
937478
|
+
result2.installedCommands += 1;
|
|
937479
|
+
}
|
|
937480
|
+
if (result2.installedCommands === 0) {
|
|
937481
|
+
result2.success = false;
|
|
937482
|
+
result2.error = "Could not download any command files from GitHub";
|
|
937483
|
+
}
|
|
937484
|
+
return result2;
|
|
937485
|
+
}
|
|
937486
|
+
var REPO = "botpress/skills", COMMANDS_DIR = "commands", REQUEST_TIMEOUT_MS = 15000, TARGET_DIRS, ALL_TARGETS, ManifestEntrySchema, ManifestSchema;
|
|
937487
|
+
var init_fetch_commands = __esm(() => {
|
|
937488
|
+
init_dist5();
|
|
937489
|
+
init_skills_ref();
|
|
937490
|
+
TARGET_DIRS = {
|
|
937491
|
+
"claude-code": ".claude/commands",
|
|
937492
|
+
opencode: ".opencode/commands",
|
|
937493
|
+
cursor: ".cursor/commands"
|
|
937494
|
+
};
|
|
937495
|
+
ALL_TARGETS = Object.keys(TARGET_DIRS);
|
|
937496
|
+
ManifestEntrySchema = ne.object({
|
|
937497
|
+
name: ne.string(),
|
|
937498
|
+
path: ne.string(),
|
|
937499
|
+
description: ne.string()
|
|
937500
|
+
});
|
|
937501
|
+
ManifestSchema = ne.object({
|
|
937502
|
+
commands: ne.array(ManifestEntrySchema)
|
|
937503
|
+
});
|
|
937504
|
+
});
|
|
937505
|
+
|
|
937506
|
+
// src/utils/external-harness-capabilities.ts
|
|
937507
|
+
import { exec as exec3 } from "child_process";
|
|
937508
|
+
import { promisify as promisify4 } from "util";
|
|
937509
|
+
async function installExternalHarnessCapabilities(options) {
|
|
937510
|
+
const commandTargets = options.commandTargets ?? ALL_TARGETS;
|
|
937511
|
+
const skillsCommand = buildExternalHarnessSkillsCommand(options.projectPath, options.packageManagerCommand);
|
|
937512
|
+
const skills = {
|
|
937513
|
+
attempted: true,
|
|
937514
|
+
success: true,
|
|
937515
|
+
command: skillsCommand
|
|
937516
|
+
};
|
|
937517
|
+
try {
|
|
937518
|
+
if (options.runCommand) {
|
|
937519
|
+
await options.runCommand(skillsCommand, options.projectPath);
|
|
937520
|
+
} else {
|
|
937521
|
+
await execAsync(skillsCommand, {
|
|
937522
|
+
cwd: options.projectPath,
|
|
937523
|
+
env: { ...process.env },
|
|
937524
|
+
timeout: 120000
|
|
937525
|
+
});
|
|
937526
|
+
}
|
|
937527
|
+
} catch (error) {
|
|
937528
|
+
skills.success = false;
|
|
937529
|
+
const stderr3 = error instanceof Error && "stderr" in error && error.stderr ? String(error.stderr).trim() : undefined;
|
|
937530
|
+
skills.error = stderr3 || (error instanceof Error ? error.message : String(error));
|
|
937531
|
+
}
|
|
937532
|
+
let commands = { attempted: false, success: true, installedCommands: 0, failed: 0 };
|
|
937533
|
+
if (commandTargets.length > 0) {
|
|
937534
|
+
try {
|
|
937535
|
+
commands = await installCommands(options.projectPath, commandTargets);
|
|
937536
|
+
} catch (error) {
|
|
937537
|
+
commands = {
|
|
937538
|
+
attempted: true,
|
|
937539
|
+
success: false,
|
|
937540
|
+
installedCommands: 0,
|
|
937541
|
+
failed: 0,
|
|
937542
|
+
error: error instanceof Error ? error.message : String(error)
|
|
937543
|
+
};
|
|
937544
|
+
}
|
|
937545
|
+
}
|
|
937546
|
+
return {
|
|
937547
|
+
success: skills.success && commands.success,
|
|
937548
|
+
skills,
|
|
937549
|
+
commands
|
|
937550
|
+
};
|
|
937551
|
+
}
|
|
937552
|
+
function buildExternalHarnessSkillsCommand(projectPath, packageManagerCommand) {
|
|
937553
|
+
const skillsRunner = getSkillsRunner(projectPath, packageManagerCommand);
|
|
937554
|
+
return `${skillsRunner} skills add ${getSkillsRepoRef()} -s '*' -a codex claude-code -y`;
|
|
937555
|
+
}
|
|
937556
|
+
function getSkillsRunner(projectPath, packageManagerCommand) {
|
|
937557
|
+
if (packageManagerCommand) {
|
|
937558
|
+
return packageManagerCommand === "bun" ? "bunx" : "npx";
|
|
937559
|
+
}
|
|
937560
|
+
const managers = detectPackageManagers();
|
|
937561
|
+
const preferred = getPreferredPackageManager(projectPath, managers);
|
|
937562
|
+
return preferred?.command === "bun" ? "bunx" : "npx";
|
|
937563
|
+
}
|
|
937564
|
+
var execAsync;
|
|
937565
|
+
var init_external_harness_capabilities = __esm(() => {
|
|
937566
|
+
init_fetch_commands();
|
|
937567
|
+
init_package_manager();
|
|
937568
|
+
init_skills_ref();
|
|
937569
|
+
execAsync = promisify4(exec3);
|
|
937570
|
+
});
|
|
937571
|
+
|
|
937134
937572
|
// src/server/project-creator.ts
|
|
937135
937573
|
import { spawn as spawn5 } from "child_process";
|
|
937136
|
-
import { existsSync as
|
|
937574
|
+
import { existsSync as existsSync18 } from "fs";
|
|
937137
937575
|
import { mkdir as mkdir5, readdir as readdir6, rm as rm5, stat as stat4 } from "fs/promises";
|
|
937138
937576
|
import { homedir as homedir8 } from "os";
|
|
937139
|
-
import { join as
|
|
937577
|
+
import { join as join24, resolve as resolve11 } from "path";
|
|
937140
937578
|
function expandHome2(rawPath) {
|
|
937141
937579
|
if (rawPath === "~")
|
|
937142
937580
|
return homedir8();
|
|
937143
937581
|
if (rawPath.startsWith("~/"))
|
|
937144
|
-
return
|
|
937582
|
+
return join24(homedir8(), rawPath.slice(2));
|
|
937145
937583
|
return rawPath;
|
|
937146
937584
|
}
|
|
937147
937585
|
function jsonErrorMessage2(error) {
|
|
@@ -937249,14 +937687,14 @@ class ProjectCreator {
|
|
|
937249
937687
|
if (!parentStat || !parentStat.isDirectory()) {
|
|
937250
937688
|
return errorResponse("Invalid parent", `Parent directory does not exist: ${parentPath}`, 400);
|
|
937251
937689
|
}
|
|
937252
|
-
const projectPath =
|
|
937690
|
+
const projectPath = join24(parentPath, name2);
|
|
937253
937691
|
const previousCreation = this.creations.get(projectPath);
|
|
937254
937692
|
if (previousCreation?.status === "creating") {
|
|
937255
937693
|
return successResponse({ status: "creating", projectPath });
|
|
937256
937694
|
}
|
|
937257
937695
|
const force = body.force === true;
|
|
937258
937696
|
let skipScaffolding = false;
|
|
937259
|
-
if (
|
|
937697
|
+
if (existsSync18(projectPath)) {
|
|
937260
937698
|
const existing = await readdir6(projectPath).catch(() => []);
|
|
937261
937699
|
if (existing.length > 0) {
|
|
937262
937700
|
if (force) {
|
|
@@ -937308,9 +937746,19 @@ class ProjectCreator {
|
|
|
937308
937746
|
}
|
|
937309
937747
|
state.stage = "dependencies";
|
|
937310
937748
|
try {
|
|
937311
|
-
|
|
937312
|
-
|
|
937313
|
-
|
|
937749
|
+
await installAgent0Capabilities(state.projectPath);
|
|
937750
|
+
} catch (error) {
|
|
937751
|
+
state.warnings.push(`Failed to create Agent(0) capabilities: ${jsonErrorMessage2(error)}`);
|
|
937752
|
+
}
|
|
937753
|
+
const externalHarness = await installExternalHarnessCapabilities({
|
|
937754
|
+
projectPath: state.projectPath,
|
|
937755
|
+
packageManagerCommand: packageManager.command,
|
|
937756
|
+
commandTargets: [],
|
|
937757
|
+
runCommand: this.options.runCommand ?? defaultRunCommand
|
|
937758
|
+
});
|
|
937759
|
+
if (!externalHarness.skills.success) {
|
|
937760
|
+
state.warnings.push(`Failed to install ADK skills: ${externalHarness.skills.error ?? "Unknown error"}`);
|
|
937761
|
+
}
|
|
937314
937762
|
const declared = generator.getDependencies();
|
|
937315
937763
|
state.declaredDependencies = declared;
|
|
937316
937764
|
state.stage = "done";
|
|
@@ -937586,12 +938034,13 @@ function notAuthenticated() {
|
|
|
937586
938034
|
}), { status: 401, headers: { "Content-Type": "application/json" } });
|
|
937587
938035
|
}
|
|
937588
938036
|
var VALID_NAME, TERMINAL_STATE_TTL_MS, COMMAND_OUTPUT_LIMIT, ADK_RUNTIME_BOT_TAGS;
|
|
937589
|
-
var init_project_creator = __esm(() => {
|
|
938037
|
+
var init_project_creator = __esm(async () => {
|
|
937590
938038
|
init_dist16();
|
|
937591
938039
|
init_dist4();
|
|
938040
|
+
init_external_harness_capabilities();
|
|
937592
938041
|
init_package_manager();
|
|
937593
|
-
init_skills_ref();
|
|
937594
938042
|
init_responses();
|
|
938043
|
+
await init_agent0_capabilities();
|
|
937595
938044
|
VALID_NAME = /^[a-zA-Z0-9_-]+$/;
|
|
937596
938045
|
TERMINAL_STATE_TTL_MS = 5 * 60000;
|
|
937597
938046
|
COMMAND_OUTPUT_LIMIT = 64 * 1024;
|
|
@@ -937600,8 +938049,8 @@ var init_project_creator = __esm(() => {
|
|
|
937600
938049
|
|
|
937601
938050
|
// src/utils/ensure-templates.ts
|
|
937602
938051
|
import { createHash as createHash5 } from "crypto";
|
|
937603
|
-
import { existsSync as
|
|
937604
|
-
import { join as
|
|
938052
|
+
import { existsSync as existsSync19, mkdirSync as mkdirSync6, writeFileSync as writeFileSync10 } from "fs";
|
|
938053
|
+
import { join as join25, dirname as dirname10 } from "path";
|
|
937605
938054
|
async function extractEmbeddedTemplates() {
|
|
937606
938055
|
const templateAssets = getEmbeddedAssets().filter((a7) => a7.path.startsWith("/templates/"));
|
|
937607
938056
|
if (templateAssets.length === 0) {
|
|
@@ -937613,18 +938062,18 @@ async function extractEmbeddedTemplates() {
|
|
|
937613
938062
|
hasher.update(new Uint8Array(await Bun.file(asset.file).arrayBuffer()));
|
|
937614
938063
|
}
|
|
937615
938064
|
const versionHash = hasher.digest("hex").slice(0, 12);
|
|
937616
|
-
const tmpDir =
|
|
937617
|
-
if (
|
|
938065
|
+
const tmpDir = join25(process.env.TMPDIR || "/tmp", `adk-templates-${versionHash}`);
|
|
938066
|
+
if (existsSync19(join25(tmpDir, "template.config.json"))) {
|
|
937618
938067
|
return tmpDir;
|
|
937619
938068
|
}
|
|
937620
938069
|
for (const asset of templateAssets) {
|
|
937621
|
-
const filePath =
|
|
937622
|
-
const dir =
|
|
937623
|
-
if (!
|
|
937624
|
-
|
|
938070
|
+
const filePath = join25(tmpDir, asset.path.replace(/^\/templates\//, ""));
|
|
938071
|
+
const dir = dirname10(filePath);
|
|
938072
|
+
if (!existsSync19(dir)) {
|
|
938073
|
+
mkdirSync6(dir, { recursive: true });
|
|
937625
938074
|
}
|
|
937626
938075
|
const content = await Bun.file(asset.file).arrayBuffer();
|
|
937627
|
-
|
|
938076
|
+
writeFileSync10(filePath, Buffer.from(content));
|
|
937628
938077
|
}
|
|
937629
938078
|
return tmpDir;
|
|
937630
938079
|
}
|
|
@@ -937819,7 +938268,7 @@ var init_prod_agent_metadata = __esm(() => {
|
|
|
937819
938268
|
|
|
937820
938269
|
// src/server/handlers/agent-map/ast/source-cache.ts
|
|
937821
938270
|
import ts6 from "typescript";
|
|
937822
|
-
import { readFileSync as
|
|
938271
|
+
import { readFileSync as readFileSync19 } from "fs";
|
|
937823
938272
|
import { resolve as resolve12 } from "path";
|
|
937824
938273
|
function getCachedSourceFile(agentRoot, relativePath) {
|
|
937825
938274
|
const absPath = resolve12(agentRoot, relativePath);
|
|
@@ -937828,7 +938277,7 @@ function getCachedSourceFile(agentRoot, relativePath) {
|
|
|
937828
938277
|
return cached;
|
|
937829
938278
|
let source;
|
|
937830
938279
|
try {
|
|
937831
|
-
source =
|
|
938280
|
+
source = readFileSync19(absPath, "utf-8");
|
|
937832
938281
|
} catch {
|
|
937833
938282
|
cache4.set(absPath, null);
|
|
937834
938283
|
return null;
|
|
@@ -937918,14 +938367,14 @@ var init_locations = __esm(() => {
|
|
|
937918
938367
|
|
|
937919
938368
|
// src/server/handlers/agent-map/ast/compiled-bot.ts
|
|
937920
938369
|
import ts8 from "typescript";
|
|
937921
|
-
import { readFileSync as
|
|
937922
|
-
import { join as
|
|
938370
|
+
import { readFileSync as readFileSync20 } from "fs";
|
|
938371
|
+
import { join as join26 } from "path";
|
|
937923
938372
|
function parseCompiledBotIntegrations(agentRoot) {
|
|
937924
938373
|
const result2 = new Map;
|
|
937925
|
-
const botDefPath =
|
|
938374
|
+
const botDefPath = join26(agentRoot, ".adk", "bot", "bot.definition.ts");
|
|
937926
938375
|
let source;
|
|
937927
938376
|
try {
|
|
937928
|
-
source =
|
|
938377
|
+
source = readFileSync20(botDefPath, "utf-8");
|
|
937929
938378
|
} catch {
|
|
937930
938379
|
return result2;
|
|
937931
938380
|
}
|
|
@@ -940220,8 +940669,8 @@ __export(exports_ui_server_entry, {
|
|
|
940220
940669
|
runUiServerEntry: () => runUiServerEntry
|
|
940221
940670
|
});
|
|
940222
940671
|
var {serve: serve2 } = globalThis.Bun;
|
|
940223
|
-
import { writeFileSync as
|
|
940224
|
-
import { join as
|
|
940672
|
+
import { writeFileSync as writeFileSync11, mkdirSync as mkdirSync7, unlinkSync as unlinkSync3, renameSync } from "fs";
|
|
940673
|
+
import { join as join27, dirname as dirname11 } from "path";
|
|
940225
940674
|
function parseArgs(args) {
|
|
940226
940675
|
let port = 3001;
|
|
940227
940676
|
let standalone = false;
|
|
@@ -940237,10 +940686,10 @@ function parseArgs(args) {
|
|
|
940237
940686
|
return { port, standalone };
|
|
940238
940687
|
}
|
|
940239
940688
|
function writeConsolePort(port) {
|
|
940240
|
-
const dir =
|
|
940241
|
-
|
|
940242
|
-
const tmpFile =
|
|
940243
|
-
|
|
940689
|
+
const dir = dirname11(CONSOLE_PORT_FILE);
|
|
940690
|
+
mkdirSync7(dir, { recursive: true });
|
|
940691
|
+
const tmpFile = join27(dir, `.console.port.${process.pid}.tmp`);
|
|
940692
|
+
writeFileSync11(tmpFile, String(port), { encoding: "utf-8", mode: 384 });
|
|
940244
940693
|
renameSync(tmpFile, CONSOLE_PORT_FILE);
|
|
940245
940694
|
}
|
|
940246
940695
|
function removeConsolePort() {
|
|
@@ -940279,7 +940728,7 @@ function parseAgentScopedProxyPath(pathname) {
|
|
|
940279
940728
|
}
|
|
940280
940729
|
async function runUiServerEntry(args = process.argv.slice(2)) {
|
|
940281
940730
|
const { port: startPort, standalone } = parseArgs(args);
|
|
940282
|
-
|
|
940731
|
+
mkdirSync7(dirname11(CONSOLE_SOCKET_PATH), { recursive: true });
|
|
940283
940732
|
const socketServer = new ConsoleSocketServer({
|
|
940284
940733
|
socketPath: CONSOLE_SOCKET_PATH,
|
|
940285
940734
|
standalone,
|
|
@@ -940505,13 +940954,13 @@ var init_ui_server_entry = __esm(async () => {
|
|
|
940505
940954
|
init_runtime_version_check();
|
|
940506
940955
|
init_lifecycle();
|
|
940507
940956
|
init_project_supervisor();
|
|
940508
|
-
init_project_creator();
|
|
940509
940957
|
init_prod_bot_api_handler();
|
|
940510
940958
|
init_dist16();
|
|
940511
940959
|
init_feature_flags3();
|
|
940512
940960
|
init_timing();
|
|
940513
940961
|
await __promiseAll([
|
|
940514
940962
|
init_static(),
|
|
940963
|
+
init_project_creator(),
|
|
940515
940964
|
init_ensure_templates()
|
|
940516
940965
|
]);
|
|
940517
940966
|
if (false) {}
|
|
@@ -940936,7 +941385,7 @@ function stripFinalNewline2(input) {
|
|
|
940936
941385
|
// ../../node_modules/.bun/npm-run-path@5.3.0/node_modules/npm-run-path/index.js
|
|
940937
941386
|
import process26 from "process";
|
|
940938
941387
|
import path55 from "path";
|
|
940939
|
-
import { fileURLToPath as
|
|
941388
|
+
import { fileURLToPath as fileURLToPath14 } from "url";
|
|
940940
941389
|
var npmRunPath2 = ({
|
|
940941
941390
|
cwd: cwd3 = process26.cwd(),
|
|
940942
941391
|
path: pathOption = process26.env[pathKey()],
|
|
@@ -940944,7 +941393,7 @@ var npmRunPath2 = ({
|
|
|
940944
941393
|
execPath: execPath3 = process26.execPath,
|
|
940945
941394
|
addExecPath = true
|
|
940946
941395
|
} = {}) => {
|
|
940947
|
-
const cwdString = cwd3 instanceof URL ?
|
|
941396
|
+
const cwdString = cwd3 instanceof URL ? fileURLToPath14(cwd3) : cwd3;
|
|
940948
941397
|
const cwdPath = path55.resolve(cwdString);
|
|
940949
941398
|
const result2 = [];
|
|
940950
941399
|
if (preferLocal) {
|
|
@@ -940962,7 +941411,7 @@ var npmRunPath2 = ({
|
|
|
940962
941411
|
cwdPath = path55.resolve(cwdPath, "..");
|
|
940963
941412
|
}
|
|
940964
941413
|
}, applyExecPath2 = (result2, execPath3, cwdPath) => {
|
|
940965
|
-
const execPathString = execPath3 instanceof URL ?
|
|
941414
|
+
const execPathString = execPath3 instanceof URL ? fileURLToPath14(execPath3) : execPath3;
|
|
940966
941415
|
result2.push(path55.resolve(cwdPath, execPathString, ".."));
|
|
940967
941416
|
}, npmRunPathEnv2 = ({ env: env8 = process26.env, ...options } = {}) => {
|
|
940968
941417
|
env8 = { ...env8 };
|
|
@@ -941842,7 +942291,7 @@ var require_merge_stream = __commonJS((exports8, module) => {
|
|
|
941842
942291
|
});
|
|
941843
942292
|
|
|
941844
942293
|
// ../../node_modules/.bun/execa@8.0.1/node_modules/execa/lib/stream.js
|
|
941845
|
-
import { createReadStream as createReadStream3, readFileSync as
|
|
942294
|
+
import { createReadStream as createReadStream3, readFileSync as readFileSync21 } from "fs";
|
|
941846
942295
|
import { setTimeout as setTimeout6 } from "timers/promises";
|
|
941847
942296
|
var import_merge_stream, validateInputOptions = (input) => {
|
|
941848
942297
|
if (input !== undefined) {
|
|
@@ -941853,7 +942302,7 @@ var import_merge_stream, validateInputOptions = (input) => {
|
|
|
941853
942302
|
return input;
|
|
941854
942303
|
}
|
|
941855
942304
|
validateInputOptions(input);
|
|
941856
|
-
return
|
|
942305
|
+
return readFileSync21(inputFile);
|
|
941857
942306
|
}, handleInputSync = (options) => {
|
|
941858
942307
|
const input = getInputSync(options);
|
|
941859
942308
|
if (isStream8(input)) {
|
|
@@ -942297,7 +942746,7 @@ var init_termux = __esm(() => {
|
|
|
942297
942746
|
|
|
942298
942747
|
// ../../node_modules/.bun/clipboardy@4.0.0/node_modules/clipboardy/lib/linux.js
|
|
942299
942748
|
import path57 from "path";
|
|
942300
|
-
import { fileURLToPath as
|
|
942749
|
+
import { fileURLToPath as fileURLToPath15 } from "url";
|
|
942301
942750
|
var __dirname2, xsel = "xsel", xselFallback, copyArguments, pasteArguments, makeError3 = (xselError, fallbackError) => {
|
|
942302
942751
|
let error;
|
|
942303
942752
|
if (xselError.code === "ENOENT") {
|
|
@@ -942333,7 +942782,7 @@ var __dirname2, xsel = "xsel", xselFallback, copyArguments, pasteArguments, make
|
|
|
942333
942782
|
}, clipboard2, linux_default;
|
|
942334
942783
|
var init_linux = __esm(() => {
|
|
942335
942784
|
init_execa2();
|
|
942336
|
-
__dirname2 = path57.dirname(
|
|
942785
|
+
__dirname2 = path57.dirname(fileURLToPath15(import.meta.url));
|
|
942337
942786
|
xselFallback = path57.join(__dirname2, "../fallbacks/linux/xsel");
|
|
942338
942787
|
copyArguments = ["--clipboard", "--input"];
|
|
942339
942788
|
pasteArguments = ["--clipboard", "--output"];
|
|
@@ -942370,7 +942819,7 @@ var init_macos = __esm(() => {
|
|
|
942370
942819
|
});
|
|
942371
942820
|
|
|
942372
942821
|
// ../../node_modules/.bun/system-architecture@0.1.0/node_modules/system-architecture/index.js
|
|
942373
|
-
import { promisify as
|
|
942822
|
+
import { promisify as promisify5 } from "util";
|
|
942374
942823
|
import process30 from "process";
|
|
942375
942824
|
import childProcess2 from "child_process";
|
|
942376
942825
|
function systemArchitectureSync() {
|
|
@@ -942395,7 +942844,7 @@ function systemArchitectureSync() {
|
|
|
942395
942844
|
}
|
|
942396
942845
|
var execFilePromises;
|
|
942397
942846
|
var init_system_architecture = __esm(() => {
|
|
942398
|
-
execFilePromises =
|
|
942847
|
+
execFilePromises = promisify5(childProcess2.execFile);
|
|
942399
942848
|
});
|
|
942400
942849
|
|
|
942401
942850
|
// ../../node_modules/.bun/is64bit@2.0.0/node_modules/is64bit/index.js
|
|
@@ -942415,12 +942864,12 @@ var init_is64bit = __esm(() => {
|
|
|
942415
942864
|
|
|
942416
942865
|
// ../../node_modules/.bun/clipboardy@4.0.0/node_modules/clipboardy/lib/windows.js
|
|
942417
942866
|
import path58 from "path";
|
|
942418
|
-
import { fileURLToPath as
|
|
942867
|
+
import { fileURLToPath as fileURLToPath16 } from "url";
|
|
942419
942868
|
var __dirname3, binarySuffix, windowBinaryPath, clipboard4, windows_default;
|
|
942420
942869
|
var init_windows = __esm(() => {
|
|
942421
942870
|
init_execa2();
|
|
942422
942871
|
init_is64bit();
|
|
942423
|
-
__dirname3 = path58.dirname(
|
|
942872
|
+
__dirname3 = path58.dirname(fileURLToPath16(import.meta.url));
|
|
942424
942873
|
binarySuffix = is64bitSync() ? "x86_64" : "i686";
|
|
942425
942874
|
windowBinaryPath = path58.join(__dirname3, `../fallbacks/windows/clipboard_${binarySuffix}.exe`);
|
|
942426
942875
|
clipboard4 = {
|
|
@@ -943037,7 +943486,7 @@ var import_react33, jsx_dev_runtime8, UserInput = ({
|
|
|
943037
943486
|
const handlePaste = (content) => {
|
|
943038
943487
|
const lines = content.split(`
|
|
943039
943488
|
`);
|
|
943040
|
-
const
|
|
943489
|
+
const isFile8 = isFilePath(content);
|
|
943041
943490
|
const currentLines = textInput.split(`
|
|
943042
943491
|
`).length;
|
|
943043
943492
|
const contentLines = lines.length;
|
|
@@ -943047,7 +943496,7 @@ var import_react33, jsx_dev_runtime8, UserInput = ({
|
|
|
943047
943496
|
if (currentLines + contentLines - 1 > maxLines) {
|
|
943048
943497
|
return;
|
|
943049
943498
|
}
|
|
943050
|
-
if (
|
|
943499
|
+
if (isFile8) {
|
|
943051
943500
|
const pasteId = nextPasteId;
|
|
943052
943501
|
setPastedContent((prev) => new Map(prev).set(pasteId, { id: pasteId, content, isFile: true }));
|
|
943053
943502
|
setNextPasteId((prev) => prev + 1);
|
|
@@ -943733,7 +944182,7 @@ var init_RadioButtons = __esm(async () => {
|
|
|
943733
944182
|
});
|
|
943734
944183
|
|
|
943735
944184
|
// src/components/InitWizard.tsx
|
|
943736
|
-
import { existsSync as
|
|
944185
|
+
import { existsSync as existsSync20 } from "fs";
|
|
943737
944186
|
import { resolve as resolve13 } from "path";
|
|
943738
944187
|
var import_react35, jsx_dev_runtime10, InitWizard = ({
|
|
943739
944188
|
templates,
|
|
@@ -943840,7 +944289,7 @@ var import_react35, jsx_dev_runtime10, InitWizard = ({
|
|
|
943840
944289
|
if (!/^[a-zA-Z0-9_-]+$/.test(value2)) {
|
|
943841
944290
|
return "Agent name can only contain letters, numbers, hyphens, and underscores";
|
|
943842
944291
|
}
|
|
943843
|
-
if (
|
|
944292
|
+
if (existsSync20(resolve13(process.cwd(), value2))) {
|
|
943844
944293
|
return `"${value2}" already exists \u2014 choose a different agent name`;
|
|
943845
944294
|
}
|
|
943846
944295
|
return null;
|
|
@@ -943999,7 +944448,7 @@ function defineLazyProperty(object, propertyName2, valueGetter) {
|
|
|
943999
944448
|
}
|
|
944000
944449
|
|
|
944001
944450
|
// ../../node_modules/.bun/default-browser-id@5.0.1/node_modules/default-browser-id/index.js
|
|
944002
|
-
import { promisify as
|
|
944451
|
+
import { promisify as promisify6 } from "util";
|
|
944003
944452
|
import process33 from "process";
|
|
944004
944453
|
import { execFile as execFile2 } from "child_process";
|
|
944005
944454
|
async function defaultBrowserId() {
|
|
@@ -944016,12 +944465,12 @@ async function defaultBrowserId() {
|
|
|
944016
944465
|
}
|
|
944017
944466
|
var execFileAsync;
|
|
944018
944467
|
var init_default_browser_id = __esm(() => {
|
|
944019
|
-
execFileAsync =
|
|
944468
|
+
execFileAsync = promisify6(execFile2);
|
|
944020
944469
|
});
|
|
944021
944470
|
|
|
944022
944471
|
// ../../node_modules/.bun/run-applescript@7.1.0/node_modules/run-applescript/index.js
|
|
944023
944472
|
import process34 from "process";
|
|
944024
|
-
import { promisify as
|
|
944473
|
+
import { promisify as promisify7 } from "util";
|
|
944025
944474
|
import { execFile as execFile3, execFileSync as execFileSync2 } from "child_process";
|
|
944026
944475
|
async function runAppleScript(script, { humanReadableOutput = true, signal } = {}) {
|
|
944027
944476
|
if (process34.platform !== "darwin") {
|
|
@@ -944037,7 +944486,7 @@ async function runAppleScript(script, { humanReadableOutput = true, signal } = {
|
|
|
944037
944486
|
}
|
|
944038
944487
|
var execFileAsync2;
|
|
944039
944488
|
var init_run_applescript = __esm(() => {
|
|
944040
|
-
execFileAsync2 =
|
|
944489
|
+
execFileAsync2 = promisify7(execFile3);
|
|
944041
944490
|
});
|
|
944042
944491
|
|
|
944043
944492
|
// ../../node_modules/.bun/bundle-name@4.1.0/node_modules/bundle-name/index.js
|
|
@@ -944050,7 +944499,7 @@ var init_bundle_name = __esm(() => {
|
|
|
944050
944499
|
});
|
|
944051
944500
|
|
|
944052
944501
|
// ../../node_modules/.bun/default-browser@5.5.0/node_modules/default-browser/windows.js
|
|
944053
|
-
import { promisify as
|
|
944502
|
+
import { promisify as promisify8 } from "util";
|
|
944054
944503
|
import { execFile as execFile4 } from "child_process";
|
|
944055
944504
|
async function defaultBrowser(_execFileAsync = execFileAsync3) {
|
|
944056
944505
|
const { stdout: stdout3 } = await _execFileAsync("reg", [
|
|
@@ -944072,7 +944521,7 @@ async function defaultBrowser(_execFileAsync = execFileAsync3) {
|
|
|
944072
944521
|
}
|
|
944073
944522
|
var execFileAsync3, windowsBrowserProgIds, _windowsBrowserProgIdMap, UnknownBrowserError;
|
|
944074
944523
|
var init_windows2 = __esm(() => {
|
|
944075
|
-
execFileAsync3 =
|
|
944524
|
+
execFileAsync3 = promisify8(execFile4);
|
|
944076
944525
|
windowsBrowserProgIds = {
|
|
944077
944526
|
MSEdgeHTM: { name: "Edge", id: "com.microsoft.edge" },
|
|
944078
944527
|
MSEdgeBHTML: { name: "Edge Beta", id: "com.microsoft.edge.beta" },
|
|
@@ -944097,7 +944546,7 @@ var init_windows2 = __esm(() => {
|
|
|
944097
944546
|
});
|
|
944098
944547
|
|
|
944099
944548
|
// ../../node_modules/.bun/default-browser@5.5.0/node_modules/default-browser/index.js
|
|
944100
|
-
import { promisify as
|
|
944549
|
+
import { promisify as promisify9 } from "util";
|
|
944101
944550
|
import process35 from "process";
|
|
944102
944551
|
import { execFile as execFile5 } from "child_process";
|
|
944103
944552
|
async function defaultBrowser2() {
|
|
@@ -944122,15 +944571,15 @@ var init_default_browser = __esm(() => {
|
|
|
944122
944571
|
init_default_browser_id();
|
|
944123
944572
|
init_bundle_name();
|
|
944124
944573
|
init_windows2();
|
|
944125
|
-
execFileAsync4 =
|
|
944574
|
+
execFileAsync4 = promisify9(execFile5);
|
|
944126
944575
|
});
|
|
944127
944576
|
|
|
944128
944577
|
// ../../node_modules/.bun/open@10.2.0/node_modules/open/index.js
|
|
944129
944578
|
import process36 from "process";
|
|
944130
944579
|
import { Buffer as Buffer10 } from "buffer";
|
|
944131
944580
|
import path59 from "path";
|
|
944132
|
-
import { fileURLToPath as
|
|
944133
|
-
import { promisify as
|
|
944581
|
+
import { fileURLToPath as fileURLToPath17 } from "url";
|
|
944582
|
+
import { promisify as promisify10 } from "util";
|
|
944134
944583
|
import childProcess3 from "child_process";
|
|
944135
944584
|
import fs31, { constants as fsConstants2 } from "fs/promises";
|
|
944136
944585
|
async function getWindowsDefaultBrowserFromWsl() {
|
|
@@ -944337,8 +944786,8 @@ var init_open = __esm(() => {
|
|
|
944337
944786
|
init_wsl_utils();
|
|
944338
944787
|
init_default_browser();
|
|
944339
944788
|
init_is_inside_container();
|
|
944340
|
-
execFile6 =
|
|
944341
|
-
__dirname4 = path59.dirname(
|
|
944789
|
+
execFile6 = promisify10(childProcess3.execFile);
|
|
944790
|
+
__dirname4 = path59.dirname(fileURLToPath17(import.meta.url));
|
|
944342
944791
|
localXdgOpenPath = path59.join(__dirname4, "xdg-open");
|
|
944343
944792
|
({ platform: platform4, arch: arch3 } = process36);
|
|
944344
944793
|
apps = {};
|
|
@@ -945542,107 +945991,6 @@ var init_adk_link = __esm(async () => {
|
|
|
945542
945991
|
jsx_dev_runtime12 = __toESM(require_jsx_dev_runtime(), 1);
|
|
945543
945992
|
});
|
|
945544
945993
|
|
|
945545
|
-
// src/utils/fetch-commands.ts
|
|
945546
|
-
import { existsSync as existsSync19, mkdirSync as mkdirSync6, writeFileSync as writeFileSync10 } from "fs";
|
|
945547
|
-
import { basename as basename4, join as join27 } from "path";
|
|
945548
|
-
function getGithubRawBase() {
|
|
945549
|
-
return `https://raw.githubusercontent.com/${REPO}/${getSkillsGitRef()}/${COMMANDS_DIR}`;
|
|
945550
|
-
}
|
|
945551
|
-
function isManifest(value2) {
|
|
945552
|
-
return ManifestSchema.safeParse(value2).success;
|
|
945553
|
-
}
|
|
945554
|
-
async function fetchWithTimeout(url6, timeoutMs) {
|
|
945555
|
-
const controller = new AbortController;
|
|
945556
|
-
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
945557
|
-
try {
|
|
945558
|
-
return await fetch(url6, { signal: controller.signal });
|
|
945559
|
-
} finally {
|
|
945560
|
-
clearTimeout(timer);
|
|
945561
|
-
}
|
|
945562
|
-
}
|
|
945563
|
-
async function fetchManifest() {
|
|
945564
|
-
try {
|
|
945565
|
-
const res = await fetchWithTimeout(`${getGithubRawBase()}/manifest.json`, REQUEST_TIMEOUT_MS);
|
|
945566
|
-
if (!res.ok) {
|
|
945567
|
-
return null;
|
|
945568
|
-
}
|
|
945569
|
-
const data = await res.json();
|
|
945570
|
-
if (!isManifest(data)) {
|
|
945571
|
-
return null;
|
|
945572
|
-
}
|
|
945573
|
-
return data;
|
|
945574
|
-
} catch {
|
|
945575
|
-
return null;
|
|
945576
|
-
}
|
|
945577
|
-
}
|
|
945578
|
-
function listCommandFiles(manifest) {
|
|
945579
|
-
if (manifest && manifest.commands.length > 0) {
|
|
945580
|
-
return manifest.commands.map((entry) => entry.path);
|
|
945581
|
-
}
|
|
945582
|
-
return [];
|
|
945583
|
-
}
|
|
945584
|
-
async function downloadCommand(filePath) {
|
|
945585
|
-
try {
|
|
945586
|
-
const res = await fetchWithTimeout(`${getGithubRawBase()}/${filePath}`, REQUEST_TIMEOUT_MS);
|
|
945587
|
-
if (!res.ok) {
|
|
945588
|
-
return null;
|
|
945589
|
-
}
|
|
945590
|
-
return await res.text();
|
|
945591
|
-
} catch {
|
|
945592
|
-
return null;
|
|
945593
|
-
}
|
|
945594
|
-
}
|
|
945595
|
-
async function installCommands(projectPath, targets) {
|
|
945596
|
-
const result2 = { attempted: true, success: true, installedCommands: 0, failed: 0 };
|
|
945597
|
-
const targetPaths = targets.map((t9) => join27(projectPath, TARGET_DIRS[t9]));
|
|
945598
|
-
for (const dir of targetPaths) {
|
|
945599
|
-
if (!existsSync19(dir)) {
|
|
945600
|
-
mkdirSync6(dir, { recursive: true });
|
|
945601
|
-
}
|
|
945602
|
-
}
|
|
945603
|
-
const manifest = await fetchManifest();
|
|
945604
|
-
const filenames = listCommandFiles(manifest);
|
|
945605
|
-
const downloads = await Promise.all(filenames.map(async (filePath) => {
|
|
945606
|
-
const content = await downloadCommand(filePath);
|
|
945607
|
-
return { filePath, content };
|
|
945608
|
-
}));
|
|
945609
|
-
for (const { filePath, content } of downloads) {
|
|
945610
|
-
if (content === null) {
|
|
945611
|
-
result2.failed += 1;
|
|
945612
|
-
continue;
|
|
945613
|
-
}
|
|
945614
|
-
const outputName = basename4(filePath);
|
|
945615
|
-
for (const dir of targetPaths) {
|
|
945616
|
-
writeFileSync10(join27(dir, outputName), content);
|
|
945617
|
-
}
|
|
945618
|
-
result2.installedCommands += 1;
|
|
945619
|
-
}
|
|
945620
|
-
if (result2.installedCommands === 0) {
|
|
945621
|
-
result2.success = false;
|
|
945622
|
-
result2.error = "Could not download any command files from GitHub";
|
|
945623
|
-
}
|
|
945624
|
-
return result2;
|
|
945625
|
-
}
|
|
945626
|
-
var REPO = "botpress/skills", COMMANDS_DIR = "commands", REQUEST_TIMEOUT_MS = 15000, TARGET_DIRS, ALL_TARGETS, ManifestEntrySchema, ManifestSchema;
|
|
945627
|
-
var init_fetch_commands = __esm(() => {
|
|
945628
|
-
init_dist5();
|
|
945629
|
-
init_skills_ref();
|
|
945630
|
-
TARGET_DIRS = {
|
|
945631
|
-
"claude-code": ".claude/commands",
|
|
945632
|
-
opencode: ".opencode/commands",
|
|
945633
|
-
cursor: ".cursor/commands"
|
|
945634
|
-
};
|
|
945635
|
-
ALL_TARGETS = Object.keys(TARGET_DIRS);
|
|
945636
|
-
ManifestEntrySchema = ne.object({
|
|
945637
|
-
name: ne.string(),
|
|
945638
|
-
path: ne.string(),
|
|
945639
|
-
description: ne.string()
|
|
945640
|
-
});
|
|
945641
|
-
ManifestSchema = ne.object({
|
|
945642
|
-
commands: ne.array(ManifestEntrySchema)
|
|
945643
|
-
});
|
|
945644
|
-
});
|
|
945645
|
-
|
|
945646
945994
|
// src/commands/adk-init.tsx
|
|
945647
945995
|
var exports_adk_init = {};
|
|
945648
945996
|
__export(exports_adk_init, {
|
|
@@ -945650,8 +945998,8 @@ __export(exports_adk_init, {
|
|
|
945650
945998
|
adkInit: () => adkInit,
|
|
945651
945999
|
NON_INTERACTIVE_INIT_HINT: () => NON_INTERACTIVE_INIT_HINT
|
|
945652
946000
|
});
|
|
945653
|
-
import { resolve as resolve14, basename as
|
|
945654
|
-
import { existsSync as
|
|
946001
|
+
import { resolve as resolve14, basename as basename6 } from "path";
|
|
946002
|
+
import { existsSync as existsSync21 } from "fs";
|
|
945655
946003
|
function formatInitError(err) {
|
|
945656
946004
|
if (err instanceof Error)
|
|
945657
946005
|
return err.message;
|
|
@@ -945692,15 +946040,12 @@ function failInitValidation(message, isJson) {
|
|
|
945692
946040
|
}
|
|
945693
946041
|
return logger4.fatal(message);
|
|
945694
946042
|
}
|
|
945695
|
-
function buildNextSteps(projectName,
|
|
946043
|
+
function buildNextSteps(projectName, linked) {
|
|
945696
946044
|
const nextSteps = [`cd ${projectName}`];
|
|
945697
946045
|
if (!linked) {
|
|
945698
946046
|
nextSteps.push("adk link");
|
|
945699
946047
|
}
|
|
945700
946048
|
nextSteps.push("adk dev");
|
|
945701
|
-
if (template2 === "hello-world") {
|
|
945702
|
-
nextSteps.push("adk chat");
|
|
945703
|
-
}
|
|
945704
946049
|
return nextSteps;
|
|
945705
946050
|
}
|
|
945706
946051
|
async function adkInit(nameArg, options) {
|
|
@@ -945782,7 +946127,7 @@ Available templates:
|
|
|
945782
946127
|
if (!/^[a-zA-Z0-9_-]+$/.test(requestedName)) {
|
|
945783
946128
|
failInitValidation("Agent name can only contain letters, numbers, hyphens, and underscores", isJson);
|
|
945784
946129
|
}
|
|
945785
|
-
if (
|
|
946130
|
+
if (existsSync21(resolve14(process.cwd(), requestedName))) {
|
|
945786
946131
|
failInitValidation(`Directory "${requestedName}" already exists`, isJson);
|
|
945787
946132
|
}
|
|
945788
946133
|
}
|
|
@@ -945847,7 +946192,7 @@ Initialization cancelled`);
|
|
|
945847
946192
|
});
|
|
945848
946193
|
}
|
|
945849
946194
|
async function initializeProject(projectPath, template2, packageManager, installCommand, options) {
|
|
945850
|
-
const projectName =
|
|
946195
|
+
const projectName = basename6(projectPath) || "my-agent";
|
|
945851
946196
|
const isJson = Boolean(options?.json);
|
|
945852
946197
|
const warnings = [];
|
|
945853
946198
|
const log6 = createCliLogger({ silent: isJson, level: "debug" });
|
|
@@ -945909,65 +946254,89 @@ async function initializeProject(projectPath, template2, packageManager, install
|
|
|
945909
946254
|
failed: 0,
|
|
945910
946255
|
failedRefs: []
|
|
945911
946256
|
};
|
|
945912
|
-
const
|
|
945913
|
-
|
|
945914
|
-
|
|
945915
|
-
const
|
|
945916
|
-
const
|
|
945917
|
-
writeStdout(`\r ${frames[frameIdx++ % frames.length]} ${
|
|
946257
|
+
const upgradeCommand = "adk agent0 upgrade";
|
|
946258
|
+
let capabilitiesInstall;
|
|
946259
|
+
let capabilitiesError;
|
|
946260
|
+
const capabilitiesMsg = "Creating Agent(0) capabilities...";
|
|
946261
|
+
const capabilitiesSpinner = isJson ? null : setInterval(() => {
|
|
946262
|
+
writeStdout(`\r ${frames[frameIdx++ % frames.length]} ${capabilitiesMsg}`);
|
|
945918
946263
|
}, 80);
|
|
945919
946264
|
try {
|
|
945920
|
-
|
|
945921
|
-
|
|
945922
|
-
|
|
945923
|
-
env: { ...process.env }
|
|
945924
|
-
});
|
|
945925
|
-
if (skillsSpinner) {
|
|
945926
|
-
clearInterval(skillsSpinner);
|
|
946265
|
+
capabilitiesInstall = await installAgent0Capabilities(projectPath);
|
|
946266
|
+
if (capabilitiesSpinner) {
|
|
946267
|
+
clearInterval(capabilitiesSpinner);
|
|
945927
946268
|
}
|
|
945928
|
-
writeStdout("\r" + " ".repeat(
|
|
945929
|
-
log6.info(
|
|
946269
|
+
writeStdout("\r" + " ".repeat(capabilitiesMsg.length + 6) + "\r");
|
|
946270
|
+
log6.info(`\u2705 Agent(0) capabilities created! (${capabilitiesInstall.skills.installed} skills, ${capabilitiesInstall.playbooks.installed} commands)`, "green");
|
|
945930
946271
|
} catch (error) {
|
|
945931
|
-
|
|
945932
|
-
|
|
945933
|
-
|
|
945934
|
-
if (skillsSpinner) {
|
|
945935
|
-
clearInterval(skillsSpinner);
|
|
946272
|
+
capabilitiesError = error instanceof Error ? error.message : String(error);
|
|
946273
|
+
if (capabilitiesSpinner) {
|
|
946274
|
+
clearInterval(capabilitiesSpinner);
|
|
945936
946275
|
}
|
|
945937
|
-
writeStdout("\r" + " ".repeat(
|
|
945938
|
-
warnings.push("Failed to
|
|
945939
|
-
log6.warn("\u26A0\uFE0F Failed to
|
|
945940
|
-
log6.info(` > ${
|
|
946276
|
+
writeStdout("\r" + " ".repeat(capabilitiesMsg.length + 6) + "\r");
|
|
946277
|
+
warnings.push("Failed to create Agent(0) capabilities automatically.");
|
|
946278
|
+
log6.warn("\u26A0\uFE0F Failed to create Agent(0) capabilities. Run manually:");
|
|
946279
|
+
log6.info(` > ${upgradeCommand}`, "cyan");
|
|
945941
946280
|
}
|
|
945942
|
-
|
|
945943
|
-
|
|
945944
|
-
|
|
945945
|
-
|
|
946281
|
+
const capabilities = capabilitiesInstall ? {
|
|
946282
|
+
attempted: true,
|
|
946283
|
+
success: true,
|
|
946284
|
+
command: upgradeCommand,
|
|
946285
|
+
capabilitiesRoot: capabilitiesInstall.capabilitiesRoot,
|
|
946286
|
+
manifestPath: capabilitiesInstall.manifestPath,
|
|
946287
|
+
version: capabilitiesInstall.currentVersion,
|
|
946288
|
+
source: capabilitiesInstall.source,
|
|
946289
|
+
skills: capabilitiesInstall.skills.installed,
|
|
946290
|
+
playbooks: capabilitiesInstall.playbooks.installed
|
|
946291
|
+
} : {
|
|
946292
|
+
attempted: true,
|
|
946293
|
+
success: false,
|
|
946294
|
+
command: upgradeCommand,
|
|
946295
|
+
error: capabilitiesError ?? "Failed to create Agent(0) capabilities automatically."
|
|
946296
|
+
};
|
|
946297
|
+
let externalHarness = {
|
|
946298
|
+
success: false,
|
|
946299
|
+
skills: {
|
|
946300
|
+
attempted: true,
|
|
946301
|
+
success: false,
|
|
946302
|
+
command: "",
|
|
946303
|
+
error: "External harness capability installer did not run."
|
|
946304
|
+
},
|
|
946305
|
+
commands: { attempted: false, success: false, installedCommands: 0, failed: 0 }
|
|
946306
|
+
};
|
|
946307
|
+
const externalHarnessMsg = "Installing ADK skills and commands...";
|
|
946308
|
+
const externalHarnessSpinner = isJson ? null : setInterval(() => {
|
|
946309
|
+
writeStdout(`\r ${frames[frameIdx++ % frames.length]} ${externalHarnessMsg}`);
|
|
945946
946310
|
}, 80);
|
|
945947
946311
|
try {
|
|
945948
|
-
|
|
945949
|
-
|
|
945950
|
-
|
|
946312
|
+
externalHarness = await installExternalHarnessCapabilities({
|
|
946313
|
+
projectPath,
|
|
946314
|
+
packageManagerCommand: packageManager,
|
|
946315
|
+
commandTargets: ["claude-code", "opencode"]
|
|
946316
|
+
});
|
|
946317
|
+
if (externalHarnessSpinner) {
|
|
946318
|
+
clearInterval(externalHarnessSpinner);
|
|
945951
946319
|
}
|
|
945952
|
-
writeStdout("\r" + " ".repeat(
|
|
945953
|
-
if (
|
|
945954
|
-
log6.info(`\u2705 ADK commands installed! (${commands.installedCommands} commands)`, "green");
|
|
945955
|
-
} else {
|
|
945956
|
-
warnings.push("Failed to install ADK commands automatically.");
|
|
945957
|
-
log6.warn("\u26A0\uFE0F Failed to install ADK commands.");
|
|
946320
|
+
writeStdout("\r" + " ".repeat(externalHarnessMsg.length + 6) + "\r");
|
|
946321
|
+
if (externalHarness.success) {
|
|
946322
|
+
log6.info(`\u2705 ADK skills and commands installed! (${externalHarness.commands.installedCommands} commands)`, "green");
|
|
945958
946323
|
}
|
|
945959
946324
|
} catch (error) {
|
|
945960
|
-
|
|
945961
|
-
|
|
945962
|
-
success: false,
|
|
945963
|
-
installedCommands: 0,
|
|
945964
|
-
failed: 0,
|
|
945965
|
-
error: error instanceof Error ? error.message : String(error)
|
|
945966
|
-
};
|
|
945967
|
-
if (commandsSpinner) {
|
|
945968
|
-
clearInterval(commandsSpinner);
|
|
946325
|
+
if (externalHarnessSpinner) {
|
|
946326
|
+
clearInterval(externalHarnessSpinner);
|
|
945969
946327
|
}
|
|
945970
|
-
writeStdout("\r" + " ".repeat(
|
|
946328
|
+
writeStdout("\r" + " ".repeat(externalHarnessMsg.length + 6) + "\r");
|
|
946329
|
+
externalHarness.skills.error = error instanceof Error ? error.message : String(error);
|
|
946330
|
+
externalHarness.commands.error = error instanceof Error ? error.message : String(error);
|
|
946331
|
+
}
|
|
946332
|
+
const skills = externalHarness.skills;
|
|
946333
|
+
const commands = externalHarness.commands;
|
|
946334
|
+
if (!skills.success) {
|
|
946335
|
+
warnings.push("Failed to install ADK skills automatically.");
|
|
946336
|
+
log6.warn("\u26A0\uFE0F Failed to install ADK skills. Run manually:");
|
|
946337
|
+
log6.info(` > ${skills.command}`, "cyan");
|
|
946338
|
+
}
|
|
946339
|
+
if (!commands.success) {
|
|
945971
946340
|
warnings.push("Failed to install ADK commands automatically.");
|
|
945972
946341
|
log6.warn("\u26A0\uFE0F Failed to install ADK commands.");
|
|
945973
946342
|
}
|
|
@@ -946082,10 +946451,11 @@ Linking to Botpress \u2014 connect your agent to a workspace and bot for deploym
|
|
|
946082
946451
|
projectPath,
|
|
946083
946452
|
name: projectName,
|
|
946084
946453
|
template: template2,
|
|
946085
|
-
nextSteps: buildNextSteps(projectName,
|
|
946454
|
+
nextSteps: buildNextSteps(projectName, linked),
|
|
946086
946455
|
packageManager,
|
|
946087
946456
|
packageInstall,
|
|
946088
946457
|
dependencies: dependenciesResult,
|
|
946458
|
+
capabilities,
|
|
946089
946459
|
skills,
|
|
946090
946460
|
commands,
|
|
946091
946461
|
link: link2,
|
|
@@ -946096,7 +946466,6 @@ Linking to Botpress \u2014 connect your agent to a workspace and bot for deploym
|
|
|
946096
946466
|
}
|
|
946097
946467
|
const cols = process.stdout.columns || 60;
|
|
946098
946468
|
const dividerLine = `\u2726 ${"\u2500".repeat(Math.max(10, cols - 4))} \u2726`;
|
|
946099
|
-
const separatorLine = " " + "\u2500".repeat(Math.max(10, cols - 2));
|
|
946100
946469
|
log6.newline();
|
|
946101
946470
|
log6.debug(dividerLine);
|
|
946102
946471
|
log6.newline();
|
|
@@ -946106,43 +946475,12 @@ Linking to Botpress \u2014 connect your agent to a workspace and bot for deploym
|
|
|
946106
946475
|
log6.newline();
|
|
946107
946476
|
log6.info(` > cd ${projectName}`, "cyan");
|
|
946108
946477
|
log6.info(" > adk dev", "cyan");
|
|
946109
|
-
if (template2 === "hello-world") {
|
|
946110
|
-
log6.newline();
|
|
946111
|
-
log6.info(" Talk to your agent:");
|
|
946112
|
-
log6.newline();
|
|
946113
|
-
log6.info(" > adk chat", "cyan");
|
|
946114
|
-
log6.debug(" Run this in a separate terminal while adk dev is running.");
|
|
946115
|
-
}
|
|
946116
946478
|
if (!linked) {
|
|
946117
946479
|
log6.newline();
|
|
946118
946480
|
log6.error(" \u26A0\uFE0F Your agent is not linked to Botpress.");
|
|
946119
946481
|
log6.debug(" Run adk link inside the project directory to connect your agent.");
|
|
946120
946482
|
}
|
|
946121
946483
|
log6.newline();
|
|
946122
|
-
log6.info(" Configure your agent:");
|
|
946123
|
-
log6.newline();
|
|
946124
|
-
log6.info(" > adk config Interactive configuration", "cyan");
|
|
946125
|
-
log6.info(" > adk config:set <key> <value> Set a value non-interactively", "cyan");
|
|
946126
|
-
log6.newline();
|
|
946127
|
-
log6.debug(separatorLine);
|
|
946128
|
-
log6.newline();
|
|
946129
|
-
log6.info(" Tips:", "cyan");
|
|
946130
|
-
log6.newline();
|
|
946131
|
-
if (skills.success && commands.success) {
|
|
946132
|
-
log6.info(" ADK skills and commands are installed.");
|
|
946133
|
-
log6.info(" AI coding agents now have deep knowledge of ADK.");
|
|
946134
|
-
log6.info(" Type /adk- in Claude Code or OpenCode to see available commands.");
|
|
946135
|
-
} else if (skills.success) {
|
|
946136
|
-
log6.info(" ADK skills are installed, AI coding agents now");
|
|
946137
|
-
log6.info(" have deep knowledge of ADK.");
|
|
946138
|
-
} else {
|
|
946139
|
-
log6.info(" Install agent skills to give AI coding agents deep");
|
|
946140
|
-
log6.info(" knowledge of ADK.");
|
|
946141
|
-
log6.newline();
|
|
946142
|
-
log6.debug(" Install by running:");
|
|
946143
|
-
log6.info(` > ${skillsCommand}`, "cyan");
|
|
946144
|
-
}
|
|
946145
|
-
log6.newline();
|
|
946146
946484
|
log6.debug(dividerLine);
|
|
946147
946485
|
log6.newline();
|
|
946148
946486
|
return result2;
|
|
@@ -946159,8 +946497,7 @@ var init_adk_init = __esm(async () => {
|
|
|
946159
946497
|
init_dist16();
|
|
946160
946498
|
init_package_manager();
|
|
946161
946499
|
init_node_version_check();
|
|
946162
|
-
|
|
946163
|
-
init_skills_ref();
|
|
946500
|
+
init_external_harness_capabilities();
|
|
946164
946501
|
init_telemetry();
|
|
946165
946502
|
init_logger();
|
|
946166
946503
|
await __promiseAll([
|
|
@@ -946169,25 +946506,26 @@ var init_adk_init = __esm(async () => {
|
|
|
946169
946506
|
init_InitWizard(),
|
|
946170
946507
|
init_adk_login(),
|
|
946171
946508
|
init_adk_link(),
|
|
946172
|
-
init_ensure_templates()
|
|
946509
|
+
init_ensure_templates(),
|
|
946510
|
+
init_agent0_capabilities()
|
|
946173
946511
|
]);
|
|
946174
946512
|
jsx_dev_runtime13 = __toESM(require_jsx_dev_runtime(), 1);
|
|
946175
946513
|
logger4 = createCliLogger({ level: "debug" });
|
|
946176
946514
|
});
|
|
946177
946515
|
|
|
946178
946516
|
// src/utils/editor-detector.ts
|
|
946179
|
-
import { exec as
|
|
946180
|
-
import { promisify as
|
|
946517
|
+
import { exec as exec4 } from "child_process";
|
|
946518
|
+
import { promisify as promisify11 } from "util";
|
|
946181
946519
|
async function isCursorRunning() {
|
|
946182
946520
|
try {
|
|
946183
946521
|
if (process.platform === "darwin") {
|
|
946184
|
-
const { stdout: stdout3 } = await
|
|
946522
|
+
const { stdout: stdout3 } = await execAsync2("pgrep -f 'Cursor'");
|
|
946185
946523
|
return stdout3.trim().length > 0;
|
|
946186
946524
|
} else if (process.platform === "win32") {
|
|
946187
|
-
const { stdout: stdout3 } = await
|
|
946525
|
+
const { stdout: stdout3 } = await execAsync2('tasklist /FI "IMAGENAME eq Cursor.exe" /NH');
|
|
946188
946526
|
return stdout3.includes("Cursor.exe");
|
|
946189
946527
|
} else {
|
|
946190
|
-
const { stdout: stdout3 } = await
|
|
946528
|
+
const { stdout: stdout3 } = await execAsync2("pgrep -f cursor");
|
|
946191
946529
|
return stdout3.trim().length > 0;
|
|
946192
946530
|
}
|
|
946193
946531
|
} catch {
|
|
@@ -946197,13 +946535,13 @@ async function isCursorRunning() {
|
|
|
946197
946535
|
async function isVSCodeRunning() {
|
|
946198
946536
|
try {
|
|
946199
946537
|
if (process.platform === "darwin") {
|
|
946200
|
-
const { stdout: stdout3 } = await
|
|
946538
|
+
const { stdout: stdout3 } = await execAsync2("pgrep -f 'Visual Studio Code'");
|
|
946201
946539
|
return stdout3.trim().length > 0;
|
|
946202
946540
|
} else if (process.platform === "win32") {
|
|
946203
|
-
const { stdout: stdout3 } = await
|
|
946541
|
+
const { stdout: stdout3 } = await execAsync2('tasklist /FI "IMAGENAME eq Code.exe" /NH');
|
|
946204
946542
|
return stdout3.includes("Code.exe");
|
|
946205
946543
|
} else {
|
|
946206
|
-
const { stdout: stdout3 } = await
|
|
946544
|
+
const { stdout: stdout3 } = await execAsync2("pgrep -f code");
|
|
946207
946545
|
return stdout3.trim().length > 0;
|
|
946208
946546
|
}
|
|
946209
946547
|
} catch {
|
|
@@ -946243,9 +946581,9 @@ function getAttachInstructions(editor, pid3, launchJsonWritten) {
|
|
|
946243
946581
|
]
|
|
946244
946582
|
};
|
|
946245
946583
|
}
|
|
946246
|
-
var
|
|
946584
|
+
var execAsync2;
|
|
946247
946585
|
var init_editor_detector = __esm(() => {
|
|
946248
|
-
|
|
946586
|
+
execAsync2 = promisify11(exec4);
|
|
946249
946587
|
});
|
|
946250
946588
|
|
|
946251
946589
|
// src/components/ErrorDisplay.tsx
|
|
@@ -946523,7 +946861,7 @@ var init_Separator = __esm(async () => {
|
|
|
946523
946861
|
});
|
|
946524
946862
|
|
|
946525
946863
|
// src/components/DevStatus.tsx
|
|
946526
|
-
import { exec as
|
|
946864
|
+
import { exec as exec5 } from "child_process";
|
|
946527
946865
|
var import_react39, jsx_dev_runtime19, BlinkingCursor = () => {
|
|
946528
946866
|
const [visible, setVisible] = import_react39.useState(true);
|
|
946529
946867
|
const theme = useTheme();
|
|
@@ -946612,7 +946950,7 @@ var import_react39, jsx_dev_runtime19, BlinkingCursor = () => {
|
|
|
946612
946950
|
}, undefined, true, undefined, this);
|
|
946613
946951
|
}, openInBrowser = (url6) => {
|
|
946614
946952
|
const cmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
|
|
946615
|
-
|
|
946953
|
+
exec5(`${cmd} ${url6}`, () => {});
|
|
946616
946954
|
}, DevStatus = ({
|
|
946617
946955
|
project,
|
|
946618
946956
|
workspace,
|
|
@@ -947136,7 +947474,7 @@ var import_react39, jsx_dev_runtime19, BlinkingCursor = () => {
|
|
|
947136
947474
|
}
|
|
947137
947475
|
const dotColor = isReady2 ? theme.status.success : interpolateColor(pulseOpacity);
|
|
947138
947476
|
const textColor = isReady2 ? theme.text.primary : theme.text.dim;
|
|
947139
|
-
const
|
|
947477
|
+
const sep10 = /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(Text, {
|
|
947140
947478
|
color: theme.text.dimmer,
|
|
947141
947479
|
children: " \u2502 "
|
|
947142
947480
|
}, undefined, false, undefined, this);
|
|
@@ -947154,7 +947492,7 @@ var import_react39, jsx_dev_runtime19, BlinkingCursor = () => {
|
|
|
947154
947492
|
statusText
|
|
947155
947493
|
]
|
|
947156
947494
|
}, undefined, true, undefined, this),
|
|
947157
|
-
(integrationsText || workerStats) &&
|
|
947495
|
+
(integrationsText || workerStats) && sep10,
|
|
947158
947496
|
integrationsText && /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(jsx_dev_runtime19.Fragment, {
|
|
947159
947497
|
children: [
|
|
947160
947498
|
/* @__PURE__ */ jsx_dev_runtime19.jsxDEV(Text, {
|
|
@@ -947275,7 +947613,7 @@ var init_DevStatus = __esm(async () => {
|
|
|
947275
947613
|
});
|
|
947276
947614
|
|
|
947277
947615
|
// src/components/LogsView.tsx
|
|
947278
|
-
import { readFileSync as
|
|
947616
|
+
import { readFileSync as readFileSync24, existsSync as existsSync22, statSync as statSync5, watchFile, unwatchFile } from "fs";
|
|
947279
947617
|
var import_react40, jsx_dev_runtime20, parseLogLine = (line, lineNumber) => {
|
|
947280
947618
|
try {
|
|
947281
947619
|
const parsed = JSON.parse(line);
|
|
@@ -947315,17 +947653,17 @@ var import_react40, jsx_dev_runtime20, parseLogLine = (line, lineNumber) => {
|
|
|
947315
947653
|
}
|
|
947316
947654
|
}, { isActive: supportsInput });
|
|
947317
947655
|
import_react40.useEffect(() => {
|
|
947318
|
-
if (!
|
|
947656
|
+
if (!existsSync22(logFilePath)) {
|
|
947319
947657
|
return;
|
|
947320
947658
|
}
|
|
947321
947659
|
const checkForNewLogs = () => {
|
|
947322
947660
|
try {
|
|
947323
|
-
const stats =
|
|
947661
|
+
const stats = statSync5(logFilePath);
|
|
947324
947662
|
if (stats.size <= lastSize.current) {
|
|
947325
947663
|
return;
|
|
947326
947664
|
}
|
|
947327
947665
|
lastSize.current = stats.size;
|
|
947328
|
-
const content =
|
|
947666
|
+
const content = readFileSync24(logFilePath, "utf-8");
|
|
947329
947667
|
const lines = content.split(`
|
|
947330
947668
|
`);
|
|
947331
947669
|
const entries = [];
|
|
@@ -948328,8 +948666,8 @@ var init_worker_stats = __esm(() => {
|
|
|
948328
948666
|
});
|
|
948329
948667
|
|
|
948330
948668
|
// src/server/handlers/agent.ts
|
|
948331
|
-
import { existsSync as
|
|
948332
|
-
import { join as
|
|
948669
|
+
import { existsSync as existsSync23, readFileSync as readFileSync26 } from "fs";
|
|
948670
|
+
import { join as join29 } from "path";
|
|
948333
948671
|
async function handleAgentInfo(environment2 = getActiveEnvironment()) {
|
|
948334
948672
|
const serverConfig2 = getServerConfig();
|
|
948335
948673
|
if (environment2 === "prod") {
|
|
@@ -948344,21 +948682,21 @@ async function handleAgentInfo(environment2 = getActiveEnvironment()) {
|
|
|
948344
948682
|
}
|
|
948345
948683
|
}
|
|
948346
948684
|
if (!serverConfig2.project) {
|
|
948347
|
-
const agentConfigPath =
|
|
948348
|
-
const agentJsonPath =
|
|
948685
|
+
const agentConfigPath = join29(serverConfig2.agentPath, "agent.config.ts");
|
|
948686
|
+
const agentJsonPath = join29(serverConfig2.agentPath, "agent.json");
|
|
948349
948687
|
let agentInfo = {
|
|
948350
948688
|
path: serverConfig2.agentPath
|
|
948351
948689
|
};
|
|
948352
|
-
if (
|
|
948353
|
-
const configContent =
|
|
948690
|
+
if (existsSync23(agentConfigPath)) {
|
|
948691
|
+
const configContent = readFileSync26(agentConfigPath, "utf-8");
|
|
948354
948692
|
const nameMatch = configContent.match(/name:\s*['"`]([^'"`]+)['"`]/);
|
|
948355
948693
|
const versionMatch = configContent.match(/version:\s*['"`]([^'"`]+)['"`]/);
|
|
948356
948694
|
agentInfo.name = nameMatch?.[1] || "unknown";
|
|
948357
948695
|
agentInfo.version = versionMatch?.[1] || "0.0.0";
|
|
948358
948696
|
}
|
|
948359
|
-
if (
|
|
948697
|
+
if (existsSync23(agentJsonPath)) {
|
|
948360
948698
|
try {
|
|
948361
|
-
const agentJson = JSON.parse(
|
|
948699
|
+
const agentJson = JSON.parse(readFileSync26(agentJsonPath, "utf-8"));
|
|
948362
948700
|
agentInfo = { ...agentInfo, ...agentJson };
|
|
948363
948701
|
} catch {}
|
|
948364
948702
|
}
|
|
@@ -948677,8 +949015,8 @@ var init_sse2 = __esm(() => {
|
|
|
948677
949015
|
});
|
|
948678
949016
|
|
|
948679
949017
|
// src/server/handlers/source-snippet.ts
|
|
948680
|
-
import { readFileSync as
|
|
948681
|
-
import { relative as relative7, resolve as resolve15, sep as
|
|
949018
|
+
import { readFileSync as readFileSync27 } from "fs";
|
|
949019
|
+
import { relative as relative7, resolve as resolve15, sep as sep10 } from "path";
|
|
948682
949020
|
function inferLanguage(path54) {
|
|
948683
949021
|
const p4 = path54.toLowerCase();
|
|
948684
949022
|
if (p4.endsWith(".tsx"))
|
|
@@ -948709,7 +949047,7 @@ function resolveSafePath(rawPath, projectRoot) {
|
|
|
948709
949047
|
const projectAbs = resolve15(projectRoot);
|
|
948710
949048
|
const target = resolve15(projectAbs, rawPath);
|
|
948711
949049
|
const rel = relative7(projectAbs, target);
|
|
948712
|
-
if (rel.startsWith("..") || rel.startsWith(`..${
|
|
949050
|
+
if (rel.startsWith("..") || rel.startsWith(`..${sep10}`))
|
|
948713
949051
|
return null;
|
|
948714
949052
|
return target;
|
|
948715
949053
|
}
|
|
@@ -948739,7 +949077,7 @@ function handleSourceSnippet(req) {
|
|
|
948739
949077
|
}
|
|
948740
949078
|
let source;
|
|
948741
949079
|
try {
|
|
948742
|
-
source =
|
|
949080
|
+
source = readFileSync27(absPath, "utf-8");
|
|
948743
949081
|
} catch {
|
|
948744
949082
|
return errorResponse("Not found", `Could not read source file at ${rawPath}`, 404);
|
|
948745
949083
|
}
|
|
@@ -948773,15 +949111,15 @@ var init_source_snippet = __esm(() => {
|
|
|
948773
949111
|
});
|
|
948774
949112
|
|
|
948775
949113
|
// src/server/handlers/open-source.ts
|
|
948776
|
-
import { existsSync as
|
|
948777
|
-
import { relative as relative8, resolve as resolve16, sep as
|
|
949114
|
+
import { existsSync as existsSync24 } from "fs";
|
|
949115
|
+
import { relative as relative8, resolve as resolve16, sep as sep11 } from "path";
|
|
948778
949116
|
function resolveSafePath2(rawPath, projectRoot) {
|
|
948779
949117
|
if (!rawPath)
|
|
948780
949118
|
return null;
|
|
948781
949119
|
const projectAbs = resolve16(projectRoot);
|
|
948782
949120
|
const target = resolve16(projectAbs, rawPath);
|
|
948783
949121
|
const rel = relative8(projectAbs, target);
|
|
948784
|
-
if (rel.startsWith("..") || rel.startsWith(`..${
|
|
949122
|
+
if (rel.startsWith("..") || rel.startsWith(`..${sep11}`))
|
|
948785
949123
|
return null;
|
|
948786
949124
|
return target;
|
|
948787
949125
|
}
|
|
@@ -948832,7 +949170,7 @@ async function handleOpenSource(req) {
|
|
|
948832
949170
|
if (!absPath) {
|
|
948833
949171
|
return errorResponse("Forbidden", "Requested path is outside the project root", 403);
|
|
948834
949172
|
}
|
|
948835
|
-
if (!
|
|
949173
|
+
if (!existsSync24(absPath)) {
|
|
948836
949174
|
return errorResponse("Not found", `Could not find source file at ${body.path}`, 404);
|
|
948837
949175
|
}
|
|
948838
949176
|
const line = positiveInt(body.line, 1);
|
|
@@ -948861,8 +949199,8 @@ var init_open_source = __esm(() => {
|
|
|
948861
949199
|
|
|
948862
949200
|
// src/utils/sqlite-trace-store.ts
|
|
948863
949201
|
import { Database } from "bun:sqlite";
|
|
948864
|
-
import { mkdirSync as
|
|
948865
|
-
import { join as
|
|
949202
|
+
import { mkdirSync as mkdirSync8 } from "fs";
|
|
949203
|
+
import { join as join30 } from "path";
|
|
948866
949204
|
function rowToSpan(row) {
|
|
948867
949205
|
return {
|
|
948868
949206
|
id: {
|
|
@@ -948893,13 +949231,13 @@ class SqliteTraceStore {
|
|
|
948893
949231
|
insertStmt = null;
|
|
948894
949232
|
updateStmt = null;
|
|
948895
949233
|
constructor(agentPath) {
|
|
948896
|
-
this.tracesDir = agentPath ?
|
|
948897
|
-
this.dbPath =
|
|
949234
|
+
this.tracesDir = agentPath ? join30(agentPath, ".adk", "bot", "traces") : process.env.TRACE_DIR ?? "traces";
|
|
949235
|
+
this.dbPath = join30(this.tracesDir, "traces.db");
|
|
948898
949236
|
}
|
|
948899
949237
|
getDb() {
|
|
948900
949238
|
if (this.db)
|
|
948901
949239
|
return this.db;
|
|
948902
|
-
|
|
949240
|
+
mkdirSync8(this.tracesDir, { recursive: true });
|
|
948903
949241
|
try {
|
|
948904
949242
|
this.db = new Database(this.dbPath);
|
|
948905
949243
|
this.db.exec("PRAGMA journal_mode=WAL");
|
|
@@ -949817,15 +950155,15 @@ var init_inspector = __esm(() => {
|
|
|
949817
950155
|
});
|
|
949818
950156
|
|
|
949819
950157
|
// src/utils/project-paths.ts
|
|
949820
|
-
import { relative as relative9, resolve as resolve17, sep as
|
|
950158
|
+
import { relative as relative9, resolve as resolve17, sep as sep12 } from "path";
|
|
949821
950159
|
function isInsideProject(absPath, projectRoot) {
|
|
949822
950160
|
const rel = relative9(resolve17(projectRoot), resolve17(absPath));
|
|
949823
|
-
return rel !== "" && !rel.startsWith("..") && !rel.startsWith(`..${
|
|
950161
|
+
return rel !== "" && !rel.startsWith("..") && !rel.startsWith(`..${sep12}`);
|
|
949824
950162
|
}
|
|
949825
950163
|
var init_project_paths = () => {};
|
|
949826
950164
|
|
|
949827
950165
|
// src/server/handlers/components.ts
|
|
949828
|
-
import { existsSync as
|
|
950166
|
+
import { existsSync as existsSync25, mkdirSync as mkdirSync9, readFileSync as readFileSync28, writeFileSync as writeFileSync12 } from "fs";
|
|
949829
950167
|
import { relative as relative10, resolve as resolve18 } from "path";
|
|
949830
950168
|
function isJsonSafePlainObject(value2) {
|
|
949831
950169
|
if (!value2 || typeof value2 !== "object" || Array.isArray(value2))
|
|
@@ -949934,18 +950272,18 @@ async function handleAddRegistryComponentToBot(req) {
|
|
|
949934
950272
|
const bpCssPath = resolve18(bpDir, `${exportName}${BP_CSS_SUFFIX}`);
|
|
949935
950273
|
const baseStylesPath = resolve18(componentsDir, BASE_STYLES_FILENAME);
|
|
949936
950274
|
const indexPath = resolve18(componentsDir, "index.ts");
|
|
949937
|
-
if (
|
|
950275
|
+
if (existsSync25(bpDir)) {
|
|
949938
950276
|
return errorResponse("Conflict", `${exportName}/ already exists in ${COMPONENTS_DIR}`, 409);
|
|
949939
950277
|
}
|
|
949940
950278
|
let existingIndex = null;
|
|
949941
|
-
if (
|
|
949942
|
-
existingIndex =
|
|
950279
|
+
if (existsSync25(indexPath)) {
|
|
950280
|
+
existingIndex = readFileSync28(indexPath, "utf-8");
|
|
949943
950281
|
const conflict = findConflictingExport(existingIndex, exportName);
|
|
949944
950282
|
if (conflict) {
|
|
949945
950283
|
return errorResponse("Conflict", `${conflict} is already exported from index.ts`, 409);
|
|
949946
950284
|
}
|
|
949947
950285
|
}
|
|
949948
|
-
const writeBaseStyles = baseStylesUrl !== null && !
|
|
950286
|
+
const writeBaseStyles = baseStylesUrl !== null && !existsSync25(baseStylesPath);
|
|
949949
950287
|
let componentText;
|
|
949950
950288
|
let typesText;
|
|
949951
950289
|
let cssText = null;
|
|
@@ -949974,20 +950312,20 @@ async function handleAddRegistryComponentToBot(req) {
|
|
|
949974
950312
|
const sourceWithImports = prependedImports.length > 0 ? `${prependedImports.join(`
|
|
949975
950313
|
`)}
|
|
949976
950314
|
${rewrittenComponent}` : rewrittenComponent;
|
|
949977
|
-
|
|
949978
|
-
|
|
949979
|
-
|
|
950315
|
+
mkdirSync9(bpDir, { recursive: true });
|
|
950316
|
+
writeFileSync12(bpTsxPath, sourceWithImports, "utf-8");
|
|
950317
|
+
writeFileSync12(bpTypesPath, typesText, "utf-8");
|
|
949980
950318
|
if (cssUrl && cssText !== null)
|
|
949981
|
-
|
|
950319
|
+
writeFileSync12(bpCssPath, cssText, "utf-8");
|
|
949982
950320
|
if (writeBaseStyles && baseStylesText !== null)
|
|
949983
|
-
|
|
950321
|
+
writeFileSync12(baseStylesPath, baseStylesText, "utf-8");
|
|
949984
950322
|
const llm = propsSchemaExport && exampleValues && exampleValues.length > 0 ? { description: `TODO: describe ${exportName}`, propsSchemaExport, exampleValues } : null;
|
|
949985
950323
|
const nextIndex = buildIndexUpdate({
|
|
949986
950324
|
existing: existingIndex,
|
|
949987
950325
|
exportName,
|
|
949988
950326
|
llm
|
|
949989
950327
|
});
|
|
949990
|
-
|
|
950328
|
+
writeFileSync12(indexPath, nextIndex, "utf-8");
|
|
949991
950329
|
return successResponse({
|
|
949992
950330
|
ok: true,
|
|
949993
950331
|
bpTsxPath: relative10(project.path, bpTsxPath),
|
|
@@ -950253,7 +950591,7 @@ var init_component_builder = __esm(() => {
|
|
|
950253
950591
|
});
|
|
950254
950592
|
|
|
950255
950593
|
// src/server/handlers/component-bundle.ts
|
|
950256
|
-
import { existsSync as
|
|
950594
|
+
import { existsSync as existsSync26 } from "fs";
|
|
950257
950595
|
import { resolve as resolve19 } from "path";
|
|
950258
950596
|
function resolveSource(req) {
|
|
950259
950597
|
const project = getServerConfig().project;
|
|
@@ -950270,7 +950608,7 @@ function resolveSource(req) {
|
|
|
950270
950608
|
if (!isInsideProject(abs, project.path)) {
|
|
950271
950609
|
return { error: "`source` escapes the project root", status: 400 };
|
|
950272
950610
|
}
|
|
950273
|
-
if (!
|
|
950611
|
+
if (!existsSync26(abs))
|
|
950274
950612
|
return { error: `Source file missing: ${posix8}`, status: 404 };
|
|
950275
950613
|
return { abs };
|
|
950276
950614
|
}
|
|
@@ -950348,9 +950686,9 @@ var init_component_events = __esm(() => {
|
|
|
950348
950686
|
});
|
|
950349
950687
|
|
|
950350
950688
|
// src/server/handlers/memory.ts
|
|
950351
|
-
import { mkdirSync as
|
|
950689
|
+
import { mkdirSync as mkdirSync10 } from "fs";
|
|
950352
950690
|
import { tmpdir } from "os";
|
|
950353
|
-
import { join as
|
|
950691
|
+
import { join as join31 } from "path";
|
|
950354
950692
|
import v8 from "v8";
|
|
950355
950693
|
async function handleMemoryDebug() {
|
|
950356
950694
|
const usage = process.memoryUsage();
|
|
@@ -950406,8 +950744,8 @@ async function handleMemorySnapshot() {
|
|
|
950406
950744
|
return errorResponse("Heap snapshots unavailable", "Heap snapshots only available in Bun runtime", 501);
|
|
950407
950745
|
}
|
|
950408
950746
|
const tempDir = tmpdir();
|
|
950409
|
-
|
|
950410
|
-
const filename =
|
|
950747
|
+
mkdirSync10(tempDir, { recursive: true });
|
|
950748
|
+
const filename = join31(tempDir, `heap-${Date.now()}.json`);
|
|
950411
950749
|
try {
|
|
950412
950750
|
const snapshot = Bun.generateHeapSnapshot();
|
|
950413
950751
|
await Bun.write(filename, JSON.stringify(snapshot));
|
|
@@ -950426,8 +950764,8 @@ async function handleMemorySnapshot() {
|
|
|
950426
950764
|
}
|
|
950427
950765
|
async function handleMemorySnapshotV8() {
|
|
950428
950766
|
const tempDir = tmpdir();
|
|
950429
|
-
|
|
950430
|
-
const filename =
|
|
950767
|
+
mkdirSync10(tempDir, { recursive: true });
|
|
950768
|
+
const filename = join31(tempDir, `heap-v8-${Date.now()}.heapsnapshot`);
|
|
950431
950769
|
try {
|
|
950432
950770
|
const snapshotPath = v8.writeHeapSnapshot(filename);
|
|
950433
950771
|
if (typeof Bun !== "undefined" && Bun.gc) {
|
|
@@ -950452,7 +950790,7 @@ var init_memory2 = __esm(async () => {
|
|
|
950452
950790
|
});
|
|
950453
950791
|
|
|
950454
950792
|
// ../evals/dist/loader.js
|
|
950455
|
-
import { readdirSync as
|
|
950793
|
+
import { readdirSync as readdirSync8, existsSync as existsSync27 } from "fs";
|
|
950456
950794
|
import { resolve as resolve20 } from "path";
|
|
950457
950795
|
function isEvalDefinition(value2) {
|
|
950458
950796
|
return value2 !== null && typeof value2 === "object" && typeof value2.name === "string" && value2.name !== "" && Array.isArray(value2.conversation);
|
|
@@ -950486,10 +950824,10 @@ Make sure your eval file:
|
|
|
950486
950824
|
}
|
|
950487
950825
|
async function loadEvalsFromDir(dirPath) {
|
|
950488
950826
|
const absDir = resolve20(dirPath);
|
|
950489
|
-
if (!
|
|
950827
|
+
if (!existsSync27(absDir)) {
|
|
950490
950828
|
return [];
|
|
950491
950829
|
}
|
|
950492
|
-
const files =
|
|
950830
|
+
const files = readdirSync8(absDir).filter((f5) => f5.endsWith(".eval.ts"));
|
|
950493
950831
|
const evals = [];
|
|
950494
950832
|
for (const f5 of files) {
|
|
950495
950833
|
const defs = await loadEvalFile(`${absDir}/${f5}`);
|
|
@@ -950506,9 +950844,9 @@ async function loadEvalsFromDir(dirPath) {
|
|
|
950506
950844
|
}
|
|
950507
950845
|
async function loadEvalByName(dirPath, name2) {
|
|
950508
950846
|
const absDir = resolve20(dirPath);
|
|
950509
|
-
if (!
|
|
950847
|
+
if (!existsSync27(absDir))
|
|
950510
950848
|
return null;
|
|
950511
|
-
const files =
|
|
950849
|
+
const files = readdirSync8(absDir).filter((f5) => f5.endsWith(".eval.ts"));
|
|
950512
950850
|
for (const f5 of files) {
|
|
950513
950851
|
const defs = await loadEvalFile(`${absDir}/${f5}`);
|
|
950514
950852
|
const found = defs.find((d5) => d5.name === name2);
|
|
@@ -950566,7 +950904,7 @@ var init_loader = () => {};
|
|
|
950566
950904
|
|
|
950567
950905
|
// ../evals/dist/runner.js
|
|
950568
950906
|
import { createRequire as createRequire4 } from "module";
|
|
950569
|
-
import { readdirSync as
|
|
950907
|
+
import { readdirSync as readdirSync9, existsSync as existsSync28 } from "fs";
|
|
950570
950908
|
import { resolve as resolve21 } from "path";
|
|
950571
950909
|
import { randomUUID } from "crypto";
|
|
950572
950910
|
function getDefaultChatClient() {
|
|
@@ -951215,10 +951553,10 @@ Make sure your eval file:
|
|
|
951215
951553
|
}
|
|
951216
951554
|
async function loadEvalsFromDir2(dirPath) {
|
|
951217
951555
|
const absDir = resolve21(dirPath);
|
|
951218
|
-
if (!
|
|
951556
|
+
if (!existsSync28(absDir)) {
|
|
951219
951557
|
return [];
|
|
951220
951558
|
}
|
|
951221
|
-
const files =
|
|
951559
|
+
const files = readdirSync9(absDir).filter((f5) => f5.endsWith(".eval.ts"));
|
|
951222
951560
|
const evals = [];
|
|
951223
951561
|
for (const f5 of files) {
|
|
951224
951562
|
const defs = await loadEvalFile2(`${absDir}/${f5}`);
|
|
@@ -951987,8 +952325,8 @@ var init_runner = __esm(() => {
|
|
|
951987
952325
|
|
|
951988
952326
|
// src/eval/sqlite-eval-store.ts
|
|
951989
952327
|
import { Database as Database2 } from "bun:sqlite";
|
|
951990
|
-
import { existsSync as
|
|
951991
|
-
import { join as
|
|
952328
|
+
import { existsSync as existsSync29, mkdirSync as mkdirSync11, readdirSync as readdirSync10, readFileSync as readFileSync29, renameSync as renameSync2 } from "fs";
|
|
952329
|
+
import { join as join32 } from "path";
|
|
951992
952330
|
function aggregateTurnTimings(report) {
|
|
951993
952331
|
let botDuration = 0;
|
|
951994
952332
|
let evalDuration = 0;
|
|
@@ -952008,13 +952346,13 @@ class SqliteEvalStore {
|
|
|
952008
952346
|
insertRunStmt = null;
|
|
952009
952347
|
insertReportStmt = null;
|
|
952010
952348
|
constructor(agentPath) {
|
|
952011
|
-
this.evalsDir =
|
|
952012
|
-
this.dbPath =
|
|
952349
|
+
this.evalsDir = join32(agentPath, ".adk", "evals");
|
|
952350
|
+
this.dbPath = join32(this.evalsDir, "evals.db");
|
|
952013
952351
|
}
|
|
952014
952352
|
getDb() {
|
|
952015
952353
|
if (this.db)
|
|
952016
952354
|
return this.db;
|
|
952017
|
-
|
|
952355
|
+
mkdirSync11(this.evalsDir, { recursive: true });
|
|
952018
952356
|
try {
|
|
952019
952357
|
this.db = new Database2(this.dbPath);
|
|
952020
952358
|
this.db.run("PRAGMA journal_mode=WAL");
|
|
@@ -952042,7 +952380,7 @@ class SqliteEvalStore {
|
|
|
952042
952380
|
this.db?.close();
|
|
952043
952381
|
} catch {}
|
|
952044
952382
|
try {
|
|
952045
|
-
if (
|
|
952383
|
+
if (existsSync29(this.dbPath)) {
|
|
952046
952384
|
renameSync2(this.dbPath, `${this.dbPath}.corrupt-${Date.now()}`);
|
|
952047
952385
|
}
|
|
952048
952386
|
} catch {}
|
|
@@ -952071,14 +952409,14 @@ class SqliteEvalStore {
|
|
|
952071
952409
|
return;
|
|
952072
952410
|
if (this.getMeta("imported_legacy") === "1")
|
|
952073
952411
|
return;
|
|
952074
|
-
const legacyDir =
|
|
952075
|
-
if (!
|
|
952412
|
+
const legacyDir = join32(this.evalsDir, "runs");
|
|
952413
|
+
if (!existsSync29(legacyDir)) {
|
|
952076
952414
|
this.setMeta("imported_legacy", "1");
|
|
952077
952415
|
return;
|
|
952078
952416
|
}
|
|
952079
952417
|
let files = [];
|
|
952080
952418
|
try {
|
|
952081
|
-
files =
|
|
952419
|
+
files = readdirSync10(legacyDir).filter((f5) => f5.endsWith(".json"));
|
|
952082
952420
|
} catch (err) {
|
|
952083
952421
|
console.warn("[sqlite-eval-store] Could not read legacy runs dir:", err);
|
|
952084
952422
|
return;
|
|
@@ -952094,7 +952432,7 @@ class SqliteEvalStore {
|
|
|
952094
952432
|
for (const file of files) {
|
|
952095
952433
|
db4.run("SAVEPOINT import_file");
|
|
952096
952434
|
try {
|
|
952097
|
-
const raw =
|
|
952435
|
+
const raw = readFileSync29(join32(legacyDir, file), "utf-8");
|
|
952098
952436
|
const report = JSON.parse(raw);
|
|
952099
952437
|
this.insertRunReport(report);
|
|
952100
952438
|
db4.run("RELEASE import_file");
|
|
@@ -952114,7 +952452,7 @@ class SqliteEvalStore {
|
|
|
952114
952452
|
return;
|
|
952115
952453
|
}
|
|
952116
952454
|
try {
|
|
952117
|
-
renameSync2(legacyDir,
|
|
952455
|
+
renameSync2(legacyDir, join32(this.evalsDir, "runs.json-migrated"));
|
|
952118
952456
|
} catch (err) {
|
|
952119
952457
|
console.warn("[sqlite-eval-store] Could not rename legacy runs dir:", err);
|
|
952120
952458
|
}
|
|
@@ -952374,13 +952712,13 @@ var init_store = __esm(() => {
|
|
|
952374
952712
|
});
|
|
952375
952713
|
|
|
952376
952714
|
// src/utils/dev-server.ts
|
|
952377
|
-
import { readFileSync as
|
|
952378
|
-
import { dirname as
|
|
952715
|
+
import { readFileSync as readFileSync30, existsSync as existsSync30, accessSync } from "fs";
|
|
952716
|
+
import { dirname as dirname12, join as join33, parse as parse9, resolve as resolve23 } from "path";
|
|
952379
952717
|
import { homedir as homedir10 } from "os";
|
|
952380
952718
|
function getDevServerUrl() {
|
|
952381
|
-
if (
|
|
952719
|
+
if (existsSync30(CONSOLE_PORT_FILE2)) {
|
|
952382
952720
|
try {
|
|
952383
|
-
const port = parseInt(
|
|
952721
|
+
const port = parseInt(readFileSync30(CONSOLE_PORT_FILE2, "utf-8").trim(), 10);
|
|
952384
952722
|
if (port > 0)
|
|
952385
952723
|
return `http://localhost:${port}`;
|
|
952386
952724
|
} catch {}
|
|
@@ -952392,10 +952730,10 @@ function resolveAgentRoot(cwd3 = process.cwd()) {
|
|
|
952392
952730
|
const root4 = parse9(currentPath).root;
|
|
952393
952731
|
while (currentPath !== root4) {
|
|
952394
952732
|
try {
|
|
952395
|
-
accessSync(
|
|
952733
|
+
accessSync(join33(currentPath, "agent.config.ts"));
|
|
952396
952734
|
return currentPath;
|
|
952397
952735
|
} catch {
|
|
952398
|
-
currentPath =
|
|
952736
|
+
currentPath = dirname12(currentPath);
|
|
952399
952737
|
}
|
|
952400
952738
|
}
|
|
952401
952739
|
return null;
|
|
@@ -952470,7 +952808,7 @@ async function getDevServerWorkflow(name2, headers = getDevServerHeaders()) {
|
|
|
952470
952808
|
}
|
|
952471
952809
|
var DEFAULT_DEV_SERVER_PORT = 3001, HEALTH_TIMEOUT_MS = 2000, REQUEST_TIMEOUT_MS2 = 5000, CONSOLE_PORT_FILE2, DEV_SERVER_DOWN_ERROR = "Dev server not running \u2014 start with `adk dev`", cachedHeaders;
|
|
952472
952810
|
var init_dev_server = __esm(() => {
|
|
952473
|
-
CONSOLE_PORT_FILE2 =
|
|
952811
|
+
CONSOLE_PORT_FILE2 = join33(homedir10(), ".adk", "console.port");
|
|
952474
952812
|
});
|
|
952475
952813
|
|
|
952476
952814
|
// src/server/handlers/evals.ts
|
|
@@ -953369,16 +953707,16 @@ var init_filter_tokens = __esm(() => {
|
|
|
953369
953707
|
import {
|
|
953370
953708
|
closeSync,
|
|
953371
953709
|
createReadStream as createReadStream4,
|
|
953372
|
-
existsSync as
|
|
953710
|
+
existsSync as existsSync31,
|
|
953373
953711
|
openSync,
|
|
953374
|
-
readFileSync as
|
|
953712
|
+
readFileSync as readFileSync31,
|
|
953375
953713
|
readSync,
|
|
953376
|
-
readdirSync as
|
|
953377
|
-
statSync as
|
|
953714
|
+
readdirSync as readdirSync11,
|
|
953715
|
+
statSync as statSync6,
|
|
953378
953716
|
watch as watch3
|
|
953379
953717
|
} from "fs";
|
|
953380
953718
|
import { createInterface as createInterface2 } from "readline";
|
|
953381
|
-
import { join as
|
|
953719
|
+
import { join as join34 } from "path";
|
|
953382
953720
|
function normalizeLevel(type) {
|
|
953383
953721
|
const lower = type.toLowerCase();
|
|
953384
953722
|
if (lower === "error")
|
|
@@ -953390,14 +953728,14 @@ function normalizeLevel(type) {
|
|
|
953390
953728
|
return lower;
|
|
953391
953729
|
}
|
|
953392
953730
|
function findLatestLogFile(agentRoot) {
|
|
953393
|
-
const logsDir =
|
|
953394
|
-
if (!
|
|
953731
|
+
const logsDir = join34(agentRoot, ".adk", "logs");
|
|
953732
|
+
if (!existsSync31(logsDir))
|
|
953395
953733
|
return null;
|
|
953396
953734
|
try {
|
|
953397
|
-
const files =
|
|
953735
|
+
const files = readdirSync11(logsDir).filter((f5) => f5.startsWith("adk-dev-") && f5.endsWith(".log")).map((f5) => ({
|
|
953398
953736
|
name: f5,
|
|
953399
|
-
path:
|
|
953400
|
-
mtime:
|
|
953737
|
+
path: join34(logsDir, f5),
|
|
953738
|
+
mtime: statSync6(join34(logsDir, f5)).mtime.getTime()
|
|
953401
953739
|
})).sort((a7, b7) => b7.mtime - a7.mtime);
|
|
953402
953740
|
return files.length > 0 ? files[0].path : null;
|
|
953403
953741
|
} catch {
|
|
@@ -953457,14 +953795,14 @@ function filterLogEntries(entries, options) {
|
|
|
953457
953795
|
}
|
|
953458
953796
|
function readRecentLogs(options) {
|
|
953459
953797
|
const logFile = options.logFile || findLatestLogFile(options.agentRoot);
|
|
953460
|
-
if (!logFile || !
|
|
953798
|
+
if (!logFile || !existsSync31(logFile))
|
|
953461
953799
|
return [];
|
|
953462
953800
|
const limit = options.limit ?? 50;
|
|
953463
953801
|
if (limit <= 0)
|
|
953464
953802
|
return [];
|
|
953465
953803
|
let fileDescriptor = null;
|
|
953466
953804
|
try {
|
|
953467
|
-
const fileSize =
|
|
953805
|
+
const fileSize = statSync6(logFile).size;
|
|
953468
953806
|
if (fileSize === 0)
|
|
953469
953807
|
return [];
|
|
953470
953808
|
fileDescriptor = openSync(logFile, "r");
|
|
@@ -953511,11 +953849,11 @@ function readRecentLogs(options) {
|
|
|
953511
953849
|
}
|
|
953512
953850
|
function readLogs(options) {
|
|
953513
953851
|
const logFile = options.logFile || findLatestLogFile(options.agentRoot);
|
|
953514
|
-
if (!logFile || !
|
|
953852
|
+
if (!logFile || !existsSync31(logFile))
|
|
953515
953853
|
return [];
|
|
953516
953854
|
const limit = options.limit ?? 50;
|
|
953517
953855
|
try {
|
|
953518
|
-
const content =
|
|
953856
|
+
const content = readFileSync31(logFile, "utf-8");
|
|
953519
953857
|
const lines = content.split(`
|
|
953520
953858
|
`);
|
|
953521
953859
|
const entries = [];
|
|
@@ -953546,7 +953884,7 @@ function followLogs(options) {
|
|
|
953546
953884
|
resolveNext = null;
|
|
953547
953885
|
}
|
|
953548
953886
|
};
|
|
953549
|
-
if (!logFile || !
|
|
953887
|
+
if (!logFile || !existsSync31(logFile)) {
|
|
953550
953888
|
return {
|
|
953551
953889
|
entries: {
|
|
953552
953890
|
[Symbol.asyncIterator]() {
|
|
@@ -953560,7 +953898,7 @@ function followLogs(options) {
|
|
|
953560
953898
|
stop
|
|
953561
953899
|
};
|
|
953562
953900
|
}
|
|
953563
|
-
let byteOffset =
|
|
953901
|
+
let byteOffset = statSync6(logFile).size;
|
|
953564
953902
|
let watcher = null;
|
|
953565
953903
|
let processing = false;
|
|
953566
953904
|
const processNewBytes = async () => {
|
|
@@ -953568,9 +953906,9 @@ function followLogs(options) {
|
|
|
953568
953906
|
return;
|
|
953569
953907
|
processing = true;
|
|
953570
953908
|
try {
|
|
953571
|
-
if (!
|
|
953909
|
+
if (!existsSync31(logFile))
|
|
953572
953910
|
return;
|
|
953573
|
-
const currentSize =
|
|
953911
|
+
const currentSize = statSync6(logFile).size;
|
|
953574
953912
|
if (currentSize <= byteOffset)
|
|
953575
953913
|
return;
|
|
953576
953914
|
const stream9 = createReadStream4(logFile, {
|
|
@@ -953634,7 +953972,7 @@ function isDevServerLikelyRunning(agentRoot) {
|
|
|
953634
953972
|
if (!logFile)
|
|
953635
953973
|
return false;
|
|
953636
953974
|
try {
|
|
953637
|
-
const mtime =
|
|
953975
|
+
const mtime = statSync6(logFile).mtime.getTime();
|
|
953638
953976
|
return Date.now() - mtime < 30000;
|
|
953639
953977
|
} catch {
|
|
953640
953978
|
return false;
|
|
@@ -954128,8 +954466,8 @@ var init_logs2 = __esm(() => {
|
|
|
954128
954466
|
});
|
|
954129
954467
|
|
|
954130
954468
|
// src/server/routes/streaming.ts
|
|
954131
|
-
import { existsSync as
|
|
954132
|
-
import { dirname as
|
|
954469
|
+
import { existsSync as existsSync33, readFileSync as readFileSync32 } from "fs";
|
|
954470
|
+
import { dirname as dirname13 } from "path";
|
|
954133
954471
|
function broadcastSpan(span5) {
|
|
954134
954472
|
for (const sub of subscribers3) {
|
|
954135
954473
|
sub([span5]);
|
|
@@ -954213,14 +954551,14 @@ function handleSSEStream(req) {
|
|
|
954213
954551
|
});
|
|
954214
954552
|
}
|
|
954215
954553
|
function streamLogs(logFilePath, req) {
|
|
954216
|
-
const agentRoot =
|
|
954554
|
+
const agentRoot = dirname13(dirname13(dirname13(logFilePath)));
|
|
954217
954555
|
let handle = null;
|
|
954218
954556
|
return createSSEStream(req, {
|
|
954219
954557
|
onConnect(client5) {
|
|
954220
954558
|
const run = async () => {
|
|
954221
954559
|
try {
|
|
954222
|
-
if (
|
|
954223
|
-
const content =
|
|
954560
|
+
if (existsSync33(logFilePath)) {
|
|
954561
|
+
const content = readFileSync32(logFilePath, "utf-8");
|
|
954224
954562
|
for (const line of content.split(`
|
|
954225
954563
|
`)) {
|
|
954226
954564
|
const entry = parseLine(line);
|
|
@@ -954917,9 +955255,9 @@ var init_agent0_status = __esm(() => {
|
|
|
954917
955255
|
});
|
|
954918
955256
|
|
|
954919
955257
|
// ../adk/dist/agent0/index.js
|
|
954920
|
-
import { existsSync as
|
|
954921
|
-
import { basename as
|
|
954922
|
-
import { fileURLToPath as
|
|
955258
|
+
import { existsSync as existsSync35, readdirSync as readdirSync12, readFileSync as readFileSync33, statSync as statSync7 } from "fs";
|
|
955259
|
+
import { basename as basename7, dirname as dirname14, extname as extname4, join as join35 } from "path";
|
|
955260
|
+
import { fileURLToPath as fileURLToPath18 } from "url";
|
|
954923
955261
|
import { createHash as createHash7 } from "crypto";
|
|
954924
955262
|
import { existsSync as existsSync210, realpathSync as realpathSync7 } from "fs";
|
|
954925
955263
|
import { chmod, mkdir as mkdir7 } from "fs/promises";
|
|
@@ -954929,16 +955267,17 @@ import { readFile as readFile10, rename as rename4, writeFile as writeFile8, chm
|
|
|
954929
955267
|
import { dirname as dirname23 } from "path";
|
|
954930
955268
|
import { execFileSync as execFileSync3, spawn as spawn7 } from "child_process";
|
|
954931
955269
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
954932
|
-
import { chmodSync as chmodSync2, copyFileSync as
|
|
955270
|
+
import { chmodSync as chmodSync2, copyFileSync as copyFileSync3, createWriteStream as createWriteStream4, existsSync as existsSync34, mkdirSync as mkdirSync12, renameSync as renameSync3, rmSync as rmSync2 } from "fs";
|
|
954933
955271
|
import { createRequire as createRequire23 } from "module";
|
|
954934
955272
|
import { arch as arch5, homedir as homedir22, platform as platform23, tmpdir as tmpdir2 } from "os";
|
|
954935
955273
|
import { delimiter as delimiter2, dirname as dirname32, join as join42, resolve as resolve24 } from "path";
|
|
954936
955274
|
import { pipeline } from "stream/promises";
|
|
954937
955275
|
import { chmod as chmod3, mkdir as mkdir22, writeFile as writeFile22 } from "fs/promises";
|
|
954938
955276
|
import { platform as platform5 } from "os";
|
|
954939
|
-
import { join as
|
|
955277
|
+
import { join as join36 } from "path";
|
|
954940
955278
|
function buildAgent0BuiltInCapabilities(options) {
|
|
954941
|
-
const skillsRoot =
|
|
955279
|
+
const skillsRoot = resolveAgent0ProjectSkillsRoot(options.agentPath);
|
|
955280
|
+
const commandsRoot = resolveAgent0ProjectPlaybooksRoot(options.agentPath);
|
|
954942
955281
|
return {
|
|
954943
955282
|
mcp: {
|
|
954944
955283
|
adk: {
|
|
@@ -954948,11 +955287,11 @@ function buildAgent0BuiltInCapabilities(options) {
|
|
|
954948
955287
|
}
|
|
954949
955288
|
},
|
|
954950
955289
|
skills: {
|
|
954951
|
-
paths: resolveAgent0BuiltInSkillPaths(skillsRoot),
|
|
955290
|
+
paths: skillsRoot ? resolveAgent0BuiltInSkillPaths(skillsRoot) : [],
|
|
954952
955291
|
urls: []
|
|
954953
955292
|
},
|
|
954954
|
-
instructions: resolveAgent0BuiltInInstructionFiles(skillsRoot),
|
|
954955
|
-
command: loadAgent0BuiltInCommandConfig(),
|
|
955293
|
+
instructions: skillsRoot ? resolveAgent0BuiltInInstructionFiles(skillsRoot) : [],
|
|
955294
|
+
command: commandsRoot ? loadAgent0BuiltInCommandConfig(commandsRoot) : {},
|
|
954956
955295
|
agent: {
|
|
954957
955296
|
default: {
|
|
954958
955297
|
description: "Agent(0) - helps build and debug Botpress ADK agents",
|
|
@@ -954982,40 +955321,49 @@ function buildAgent0BuiltInCapabilities(options) {
|
|
|
954982
955321
|
defaultAgent: AGENT0_DEFAULT_AGENT
|
|
954983
955322
|
};
|
|
954984
955323
|
}
|
|
955324
|
+
function getAgent0ProjectCapabilitiesRoot2(projectPath) {
|
|
955325
|
+
return join35(projectPath, AGENT0_PROJECT_DIR2, AGENT0_PROJECT_CAPABILITIES_DIR2);
|
|
955326
|
+
}
|
|
955327
|
+
function resolveAgent0ProjectSkillsRoot(projectPath) {
|
|
955328
|
+
return firstExistingDirectory2([join35(getAgent0ProjectCapabilitiesRoot2(projectPath), AGENT0_PROJECT_SKILLS_DIR2)]);
|
|
955329
|
+
}
|
|
955330
|
+
function resolveAgent0ProjectPlaybooksRoot(projectPath) {
|
|
955331
|
+
return firstExistingDirectory2([join35(getAgent0ProjectCapabilitiesRoot2(projectPath), AGENT0_PROJECT_PLAYBOOKS_DIR2)]);
|
|
955332
|
+
}
|
|
954985
955333
|
function resolveAgent0BuiltInSkillsRoot() {
|
|
954986
|
-
return
|
|
955334
|
+
return firstExistingDirectory2(resolveAgent0BuiltInSkillsRootCandidates(moduleDir2()));
|
|
954987
955335
|
}
|
|
954988
955336
|
function resolveAgent0BuiltInCommandsRoot() {
|
|
954989
|
-
return
|
|
955337
|
+
return firstExistingDirectory2(resolveAgent0BuiltInCommandsRootCandidates(moduleDir2()));
|
|
954990
955338
|
}
|
|
954991
955339
|
function resolveAgent0BuiltInSkillPaths(skillsRoot = resolveAgent0BuiltInSkillsRoot()) {
|
|
954992
955340
|
if (!skillsRoot)
|
|
954993
955341
|
return [];
|
|
954994
|
-
return
|
|
954995
|
-
const dir =
|
|
954996
|
-
if (!
|
|
955342
|
+
return readdirSync12(skillsRoot).toSorted().flatMap((entry) => {
|
|
955343
|
+
const dir = join35(skillsRoot, entry);
|
|
955344
|
+
if (!statSync7(dir).isDirectory())
|
|
954997
955345
|
return [];
|
|
954998
|
-
if (!
|
|
955346
|
+
if (!existsSync35(join35(dir, "SKILL.md")))
|
|
954999
955347
|
return [];
|
|
955000
955348
|
return [dir];
|
|
955001
955349
|
});
|
|
955002
955350
|
}
|
|
955003
955351
|
function resolveAgent0BuiltInInstructionFiles(skillsRoot = resolveAgent0BuiltInSkillsRoot()) {
|
|
955004
|
-
const files = skillsRoot ? [
|
|
955005
|
-
return files.filter((file) =>
|
|
955352
|
+
const files = skillsRoot ? [join35(skillsRoot, "adk", "SKILL.md")] : [];
|
|
955353
|
+
return files.filter((file) => existsSync35(file) && statSync7(file).isFile());
|
|
955006
955354
|
}
|
|
955007
955355
|
function loadAgent0BuiltInCommandConfig(commandsRoot = resolveAgent0BuiltInCommandsRoot()) {
|
|
955008
955356
|
if (!commandsRoot)
|
|
955009
955357
|
return {};
|
|
955010
955358
|
const commands = {};
|
|
955011
|
-
for (const file of
|
|
955012
|
-
if (
|
|
955359
|
+
for (const file of readdirSync12(commandsRoot).toSorted()) {
|
|
955360
|
+
if (extname4(file) !== ".md")
|
|
955013
955361
|
continue;
|
|
955014
|
-
const filepath =
|
|
955015
|
-
if (!
|
|
955362
|
+
const filepath = join35(commandsRoot, file);
|
|
955363
|
+
if (!statSync7(filepath).isFile())
|
|
955016
955364
|
continue;
|
|
955017
|
-
const parsed = parseFrontmatterMarkdown(
|
|
955018
|
-
const name2 = parsed.frontmatter.name ||
|
|
955365
|
+
const parsed = parseFrontmatterMarkdown(readFileSync33(filepath, "utf8"));
|
|
955366
|
+
const name2 = parsed.frontmatter.name || basename7(file, ".md");
|
|
955019
955367
|
if (!name2)
|
|
955020
955368
|
continue;
|
|
955021
955369
|
commands[name2] = {
|
|
@@ -955049,21 +955397,21 @@ function unquote(value2) {
|
|
|
955049
955397
|
const quote = value2[0];
|
|
955050
955398
|
return quote && quote === value2[value2.length - 1] && (quote === '"' || quote === "'") ? value2.slice(1, -1) : value2;
|
|
955051
955399
|
}
|
|
955052
|
-
function
|
|
955053
|
-
return paths.find((dir) =>
|
|
955400
|
+
function firstExistingDirectory2(paths) {
|
|
955401
|
+
return paths.find((dir) => existsSync35(dir) && statSync7(dir).isDirectory());
|
|
955054
955402
|
}
|
|
955055
955403
|
function resolveAgent0BuiltInSkillsRootCandidates(baseDir) {
|
|
955056
|
-
return [
|
|
955404
|
+
return [join35(baseDir, "capabilities", "skills"), join35(baseDir, "agent0-assets", "skills"), join35(baseDir, "skills")];
|
|
955057
955405
|
}
|
|
955058
955406
|
function resolveAgent0BuiltInCommandsRootCandidates(baseDir) {
|
|
955059
955407
|
return [
|
|
955060
|
-
|
|
955061
|
-
|
|
955062
|
-
|
|
955408
|
+
join35(baseDir, "capabilities", "commands"),
|
|
955409
|
+
join35(baseDir, "agent0-assets", "playbooks"),
|
|
955410
|
+
join35(baseDir, "commands")
|
|
955063
955411
|
];
|
|
955064
955412
|
}
|
|
955065
|
-
function
|
|
955066
|
-
return
|
|
955413
|
+
function moduleDir2() {
|
|
955414
|
+
return dirname14(fileURLToPath18(import.meta.url));
|
|
955067
955415
|
}
|
|
955068
955416
|
function getAgent0HomeDir(options = {}) {
|
|
955069
955417
|
return join210(options.homeDir ?? process.env.HOME ?? homedir11(), ".adk", "agent0");
|
|
@@ -955753,7 +956101,7 @@ function getAgent0ProjectDiscoveryGitShimFilename(targetPlatform = platform5())
|
|
|
955753
956101
|
}
|
|
955754
956102
|
async function ensureAgent0ProjectDiscoveryGitShim(paths2) {
|
|
955755
956103
|
const targetPlatform = platform5();
|
|
955756
|
-
const shimPath =
|
|
956104
|
+
const shimPath = join36(paths2.engineBinDir, getAgent0ProjectDiscoveryGitShimFilename(targetPlatform));
|
|
955757
956105
|
const shimContent = targetPlatform === "win32" ? WINDOWS_GIT_SHIM : POSIX_GIT_SHIM;
|
|
955758
956106
|
await mkdir22(paths2.engineBinDir, { recursive: true, mode: GIT_SHIM_MODE });
|
|
955759
956107
|
await chmod3(paths2.engineBinDir, GIT_SHIM_MODE);
|
|
@@ -955936,8 +956284,8 @@ async function downloadAgent0OpenCodeBinary(options) {
|
|
|
955936
956284
|
const cacheDir = getAgent0OpenCodeCacheDir(options);
|
|
955937
956285
|
const tmpDirPath = join42(tmpdir2(), `agent0-opencode-download-${Date.now()}`);
|
|
955938
956286
|
options.onLog?.(`Downloading opencode v${version4} (${name2})...`);
|
|
955939
|
-
|
|
955940
|
-
|
|
956287
|
+
mkdirSync12(cacheDir, { recursive: true });
|
|
956288
|
+
mkdirSync12(tmpDirPath, { recursive: true });
|
|
955941
956289
|
try {
|
|
955942
956290
|
const tarPath = join42(tmpDirPath, "opencode.tgz");
|
|
955943
956291
|
const response = await fetchImpl(tarballUrl);
|
|
@@ -955946,7 +956294,7 @@ async function downloadAgent0OpenCodeBinary(options) {
|
|
|
955946
956294
|
}
|
|
955947
956295
|
await pipeline(response.body, createWriteStream4(tarPath));
|
|
955948
956296
|
const extractDir = join42(tmpDirPath, "extracted");
|
|
955949
|
-
|
|
956297
|
+
mkdirSync12(extractDir, { recursive: true });
|
|
955950
956298
|
execFileSync3("tar", ["xzf", tarPath, "-C", extractDir, `package/bin/${binary}`]);
|
|
955951
956299
|
const extractedBinary = join42(extractDir, "package", "bin", binary);
|
|
955952
956300
|
if (!existsSync34(extractedBinary)) {
|
|
@@ -955954,7 +956302,7 @@ async function downloadAgent0OpenCodeBinary(options) {
|
|
|
955954
956302
|
}
|
|
955955
956303
|
const destBinary = join42(cacheDir, binary);
|
|
955956
956304
|
const tmpBinary = `${destBinary}.tmp`;
|
|
955957
|
-
|
|
956305
|
+
copyFileSync3(extractedBinary, tmpBinary);
|
|
955958
956306
|
if (platform23() !== "win32")
|
|
955959
956307
|
chmodSync2(tmpBinary, 493);
|
|
955960
956308
|
renameSync3(tmpBinary, destBinary);
|
|
@@ -955962,7 +956310,7 @@ async function downloadAgent0OpenCodeBinary(options) {
|
|
|
955962
956310
|
return destBinary;
|
|
955963
956311
|
} finally {
|
|
955964
956312
|
try {
|
|
955965
|
-
|
|
956313
|
+
rmSync2(tmpDirPath, { recursive: true, force: true });
|
|
955966
956314
|
} catch {}
|
|
955967
956315
|
}
|
|
955968
956316
|
}
|
|
@@ -956239,12 +956587,12 @@ function createAgent0RuntimeClient(options) {
|
|
|
956239
956587
|
},
|
|
956240
956588
|
async listCommands() {
|
|
956241
956589
|
return {
|
|
956242
|
-
commands: listAgent0BuiltInCommands(),
|
|
956590
|
+
commands: listAgent0BuiltInCommands(options.projectPath),
|
|
956243
956591
|
warnings: []
|
|
956244
956592
|
};
|
|
956245
956593
|
},
|
|
956246
956594
|
async runCommand(sessionId, input) {
|
|
956247
|
-
const command = getAgent0BuiltInCommand(input.command);
|
|
956595
|
+
const command = getAgent0BuiltInCommand(options.projectPath, input.command);
|
|
956248
956596
|
if (!command) {
|
|
956249
956597
|
throw new Agent0RuntimeClientError("ENGINE_INVALID_RESPONSE", `Unknown Agent(0) command: ${input.command}`);
|
|
956250
956598
|
}
|
|
@@ -956598,16 +956946,22 @@ function normalizeQuestionAnswers(value2) {
|
|
|
956598
956946
|
return [...answer2];
|
|
956599
956947
|
});
|
|
956600
956948
|
}
|
|
956601
|
-
function listAgent0BuiltInCommands() {
|
|
956602
|
-
|
|
956949
|
+
function listAgent0BuiltInCommands(projectPath) {
|
|
956950
|
+
const commandsRoot = resolveAgent0ProjectPlaybooksRoot(projectPath);
|
|
956951
|
+
if (!commandsRoot)
|
|
956952
|
+
return [];
|
|
956953
|
+
return Object.entries(loadAgent0BuiltInCommandConfig(commandsRoot)).map(([name2, command]) => ({
|
|
956603
956954
|
name: name2,
|
|
956604
956955
|
...command.description ? { description: command.description } : {},
|
|
956605
956956
|
hints: extractAgent0CommandHints(command.template),
|
|
956606
956957
|
...typeof command.subtask === "boolean" ? { subtask: command.subtask } : {}
|
|
956607
956958
|
})).toSorted((left, right) => left.name.localeCompare(right.name));
|
|
956608
956959
|
}
|
|
956609
|
-
function getAgent0BuiltInCommand(name2) {
|
|
956610
|
-
|
|
956960
|
+
function getAgent0BuiltInCommand(projectPath, name2) {
|
|
956961
|
+
const commandsRoot = resolveAgent0ProjectPlaybooksRoot(projectPath);
|
|
956962
|
+
if (!commandsRoot)
|
|
956963
|
+
return;
|
|
956964
|
+
return loadAgent0BuiltInCommandConfig(commandsRoot)[name2];
|
|
956611
956965
|
}
|
|
956612
956966
|
function extractAgent0CommandHints(template2) {
|
|
956613
956967
|
const hints = new Set;
|
|
@@ -957463,7 +957817,7 @@ When building a triage, routing, classification, extraction, or Q&A agent, the r
|
|
|
957463
957817
|
|
|
957464
957818
|
## ADK Knowledge Sources
|
|
957465
957819
|
|
|
957466
|
-
The \`adk\` skill is preloaded as \`.
|
|
957820
|
+
The \`adk\` skill is preloaded as \`.agent0/capabilities/skills/adk/SKILL.md\`. Treat it as the index, not the whole manual. Before authoring a primitive, read the relevant reference file under \`.agent0/capabilities/skills/adk/references/\`:
|
|
957467
957821
|
- \`agent-config.md\` before changing \`agent.config.ts\`
|
|
957468
957822
|
- \`conversations.md\` before writing or modifying conversations
|
|
957469
957823
|
- \`triggers.md\` before event-driven behavior
|
|
@@ -957483,7 +957837,7 @@ Use ADK imports from \`@botpress/runtime\` for generated agent code. Use Botpres
|
|
|
957483
957837
|
|
|
957484
957838
|
## Command Playbooks
|
|
957485
957839
|
|
|
957486
|
-
|
|
957840
|
+
Agent(0) command playbooks are available in \`.agent0/capabilities/playbooks/\`. Use them as workflow guidance:
|
|
957487
957841
|
- \`adk-build.md\` for decomposing a feature into primitives and building it
|
|
957488
957842
|
- \`adk-validate.md\` for static validation of a primitive or feature
|
|
957489
957843
|
- \`adk-test.md\` for invoking the built behavior
|
|
@@ -957532,7 +957886,7 @@ Do not run commands that start, restart, or watch a development server from insi
|
|
|
957532
957886
|
|
|
957533
957887
|
## Communication Style
|
|
957534
957888
|
|
|
957535
|
-
Warm, direct, and efficient. No filler. Bias to action over questions; when you must ask, one short batch at a time.`, AGENT0_DEFAULT_AGENT = "default", AGENT0_PRIMARY_AGENT_STEPS = 64, AGENT0_SCREENSHOT_MCP_TOOL_PERMISSION = "adk_adk_take_screenshot", AGENT0_SCREENSHOT_RAW_TOOL_PERMISSION = "adk_take_screenshot", PROJECT_HASH_LENGTH = 32, OWNER_ONLY_DIR_MODE = 448, agent0ProviderAuthSchema, agent0ProviderConnectionSchema, agent0ConfigPreferencesSchema, agent0ConfigSchema, DEFAULT_AGENT0_PREFERENCES, Agent0ConfigError, apiKey = (apiKeyLabel = "API key", baseURL) => ({
|
|
957889
|
+
Warm, direct, and efficient. No filler. Bias to action over questions; when you must ask, one short batch at a time.`, AGENT0_DEFAULT_AGENT = "default", AGENT0_PRIMARY_AGENT_STEPS = 64, AGENT0_PROJECT_DIR2 = ".agent0", AGENT0_PROJECT_CAPABILITIES_DIR2 = "capabilities", AGENT0_PROJECT_SKILLS_DIR2 = "skills", AGENT0_PROJECT_PLAYBOOKS_DIR2 = "playbooks", AGENT0_SCREENSHOT_MCP_TOOL_PERMISSION = "adk_adk_take_screenshot", AGENT0_SCREENSHOT_RAW_TOOL_PERMISSION = "adk_take_screenshot", PROJECT_HASH_LENGTH = 32, OWNER_ONLY_DIR_MODE = 448, agent0ProviderAuthSchema, agent0ProviderConnectionSchema, agent0ConfigPreferencesSchema, agent0ConfigSchema, DEFAULT_AGENT0_PREFERENCES, Agent0ConfigError, apiKey = (apiKeyLabel = "API key", baseURL) => ({
|
|
957536
957890
|
type: "api_key",
|
|
957537
957891
|
apiKeyLabel,
|
|
957538
957892
|
...baseURL ? {
|
|
@@ -967257,8 +967611,8 @@ var require_resolve = __commonJS((exports8) => {
|
|
|
967257
967611
|
}
|
|
967258
967612
|
return count2;
|
|
967259
967613
|
}
|
|
967260
|
-
function getFullPath(resolver, id4 = "",
|
|
967261
|
-
if (
|
|
967614
|
+
function getFullPath(resolver, id4 = "", normalize10) {
|
|
967615
|
+
if (normalize10 !== false)
|
|
967262
967616
|
id4 = normalizeId(id4);
|
|
967263
967617
|
const p4 = resolver.parse(id4);
|
|
967264
967618
|
return _getFullPath(resolver, p4);
|
|
@@ -968545,7 +968899,7 @@ var require_schemes = __commonJS((exports8, module) => {
|
|
|
968545
968899
|
var require_fast_uri = __commonJS((exports8, module) => {
|
|
968546
968900
|
var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizeComponentEncoding, isIPv4, nonSimpleDomain } = require_utils14();
|
|
968547
968901
|
var { SCHEMES, getSchemeHandler } = require_schemes();
|
|
968548
|
-
function
|
|
968902
|
+
function normalize10(uri, options) {
|
|
968549
968903
|
if (typeof uri === "string") {
|
|
968550
968904
|
uri = serialize2(parse15(uri, options), options);
|
|
968551
968905
|
} else if (typeof uri === "object") {
|
|
@@ -968780,7 +969134,7 @@ var require_fast_uri = __commonJS((exports8, module) => {
|
|
|
968780
969134
|
}
|
|
968781
969135
|
var fastUri = {
|
|
968782
969136
|
SCHEMES,
|
|
968783
|
-
normalize:
|
|
969137
|
+
normalize: normalize10,
|
|
968784
969138
|
resolve: resolve26,
|
|
968785
969139
|
resolveComponent,
|
|
968786
969140
|
equal,
|
|
@@ -974099,8 +974453,8 @@ var init_main3 = __esm(() => {
|
|
|
974099
974453
|
});
|
|
974100
974454
|
|
|
974101
974455
|
// src/utils/debugger.ts
|
|
974102
|
-
import { existsSync as
|
|
974103
|
-
import { join as
|
|
974456
|
+
import { existsSync as existsSync36, mkdirSync as mkdirSync13, readFileSync as readFileSync34, writeFileSync as writeFileSync13 } from "fs";
|
|
974457
|
+
import { join as join37 } from "path";
|
|
974104
974458
|
async function startDebugger(options) {
|
|
974105
974459
|
const { botPort, onActivity } = options;
|
|
974106
974460
|
try {
|
|
@@ -974127,8 +974481,8 @@ async function startDebugger(options) {
|
|
|
974127
974481
|
}
|
|
974128
974482
|
}
|
|
974129
974483
|
function writeVSCodeLaunchConfig(agentRoot, pid3) {
|
|
974130
|
-
const vscodeDir =
|
|
974131
|
-
const launchPath =
|
|
974484
|
+
const vscodeDir = join37(agentRoot, ".vscode");
|
|
974485
|
+
const launchPath = join37(vscodeDir, "launch.json");
|
|
974132
974486
|
const adkConfig = {
|
|
974133
974487
|
type: "node",
|
|
974134
974488
|
request: "attach",
|
|
@@ -974137,9 +974491,9 @@ function writeVSCodeLaunchConfig(agentRoot, pid3) {
|
|
|
974137
974491
|
skipFiles: ["<node_internals>/**"]
|
|
974138
974492
|
};
|
|
974139
974493
|
let launchJson;
|
|
974140
|
-
if (
|
|
974494
|
+
if (existsSync36(launchPath)) {
|
|
974141
974495
|
let parsed = null;
|
|
974142
|
-
const raw =
|
|
974496
|
+
const raw = readFileSync34(launchPath, "utf-8");
|
|
974143
974497
|
const parseErrors = [];
|
|
974144
974498
|
parsed = parse16(raw, parseErrors, {
|
|
974145
974499
|
allowTrailingComma: true,
|
|
@@ -974163,13 +974517,13 @@ function writeVSCodeLaunchConfig(agentRoot, pid3) {
|
|
|
974163
974517
|
}
|
|
974164
974518
|
launchJson = parsed;
|
|
974165
974519
|
} else {
|
|
974166
|
-
|
|
974520
|
+
mkdirSync13(vscodeDir, { recursive: true });
|
|
974167
974521
|
launchJson = {
|
|
974168
974522
|
version: "0.2.0",
|
|
974169
974523
|
configurations: [adkConfig]
|
|
974170
974524
|
};
|
|
974171
974525
|
}
|
|
974172
|
-
|
|
974526
|
+
writeFileSync13(launchPath, JSON.stringify(launchJson, null, 2) + `
|
|
974173
974527
|
`);
|
|
974174
974528
|
return launchPath;
|
|
974175
974529
|
}
|
|
@@ -974584,7 +974938,7 @@ var exports_adk_dev = {};
|
|
|
974584
974938
|
__export(exports_adk_dev, {
|
|
974585
974939
|
adkDev: () => adkDev
|
|
974586
974940
|
});
|
|
974587
|
-
import { createWriteStream as createWriteStream5, mkdirSync as
|
|
974941
|
+
import { createWriteStream as createWriteStream5, mkdirSync as mkdirSync14 } from "fs";
|
|
974588
974942
|
import path66 from "path";
|
|
974589
974943
|
function createDevLogFilePath(agentRoot) {
|
|
974590
974944
|
const now3 = new Date;
|
|
@@ -974592,7 +974946,7 @@ function createDevLogFilePath(agentRoot) {
|
|
|
974592
974946
|
const timeStr = now3.toTimeString().split(" ")[0].replace(/:/g, "-");
|
|
974593
974947
|
const logFileName = `adk-dev-${dateStr}-${timeStr}.log`;
|
|
974594
974948
|
const logsDir = path66.join(agentRoot, ".adk", "logs");
|
|
974595
|
-
|
|
974949
|
+
mkdirSync14(logsDir, { recursive: true });
|
|
974596
974950
|
return path66.join(logsDir, logFileName);
|
|
974597
974951
|
}
|
|
974598
974952
|
async function collectConfigValidationSummary(agentProject, botId, credentials) {
|
|
@@ -975560,7 +975914,7 @@ var import_react42, jsx_dev_runtime24, logger7, AdkDevProcess = ({
|
|
|
975560
975914
|
const setupLogging = () => {
|
|
975561
975915
|
const agentRoot = debuggerRef.current.agentRoot;
|
|
975562
975916
|
const logsDir = path66.join(agentRoot, ".adk", "logs");
|
|
975563
|
-
|
|
975917
|
+
mkdirSync14(logsDir, { recursive: true });
|
|
975564
975918
|
const logStream = createWriteStream5(logFilePath, { flags: "a" });
|
|
975565
975919
|
return logStream;
|
|
975566
975920
|
};
|
|
@@ -981191,7 +981545,7 @@ var require_utils15 = __commonJS((exports8, module) => {
|
|
|
981191
981545
|
module.exports = Utils;
|
|
981192
981546
|
Utils.prototype.makeDir = function(folder) {
|
|
981193
981547
|
const self2 = this;
|
|
981194
|
-
function
|
|
981548
|
+
function mkdirSync15(fpath) {
|
|
981195
981549
|
let resolvedPath = fpath.split(self2.sep)[0];
|
|
981196
981550
|
fpath.split(self2.sep).forEach(function(name2) {
|
|
981197
981551
|
if (!name2 || name2.substr(-1, 1) === ":")
|
|
@@ -981211,7 +981565,7 @@ var require_utils15 = __commonJS((exports8, module) => {
|
|
|
981211
981565
|
throw Errors5.FILE_IN_THE_WAY(`"${resolvedPath}"`);
|
|
981212
981566
|
});
|
|
981213
981567
|
}
|
|
981214
|
-
|
|
981568
|
+
mkdirSync15(folder);
|
|
981215
981569
|
};
|
|
981216
981570
|
Utils.prototype.writeFileTo = function(path54, content, overwrite, attr) {
|
|
981217
981571
|
const self2 = this;
|
|
@@ -982771,8 +983125,8 @@ var require_adm_zip = __commonJS((exports8, module) => {
|
|
|
982771
983125
|
return null;
|
|
982772
983126
|
}
|
|
982773
983127
|
function fixPath(zipPath) {
|
|
982774
|
-
const { join:
|
|
982775
|
-
return
|
|
983128
|
+
const { join: join38, normalize: normalize10, sep: sep13 } = pth.posix;
|
|
983129
|
+
return join38(pth.isAbsolute(zipPath) ? "/" : ".", normalize10(sep13 + zipPath.split("\\").join(sep13) + sep13));
|
|
982776
983130
|
}
|
|
982777
983131
|
function filenameFilter(filterfn) {
|
|
982778
983132
|
if (filterfn instanceof RegExp) {
|
|
@@ -983297,18 +983651,18 @@ __export(exports_upgrade3, {
|
|
|
983297
983651
|
adkSelfUpgrade: () => adkSelfUpgrade
|
|
983298
983652
|
});
|
|
983299
983653
|
import {
|
|
983300
|
-
existsSync as
|
|
983301
|
-
writeFileSync as
|
|
983654
|
+
existsSync as existsSync37,
|
|
983655
|
+
writeFileSync as writeFileSync14,
|
|
983302
983656
|
chmodSync as chmodSync3,
|
|
983303
983657
|
renameSync as renameSync4,
|
|
983304
983658
|
unlinkSync as unlinkSync4,
|
|
983305
|
-
readFileSync as
|
|
983306
|
-
mkdirSync as
|
|
983659
|
+
readFileSync as readFileSync35,
|
|
983660
|
+
mkdirSync as mkdirSync15,
|
|
983307
983661
|
rmdirSync,
|
|
983308
983662
|
accessSync as accessSync2,
|
|
983309
983663
|
constants as constants7
|
|
983310
983664
|
} from "fs";
|
|
983311
|
-
import { join as
|
|
983665
|
+
import { join as join39, dirname as dirname15, basename as basename8 } from "path";
|
|
983312
983666
|
import { tmpdir as tmpdir3 } from "os";
|
|
983313
983667
|
import { execSync as execSync5, spawnSync as spawnSync2 } from "child_process";
|
|
983314
983668
|
function getPlatformInfo() {
|
|
@@ -983370,17 +983724,17 @@ async function downloadBinary(version5, target, extension, logger8) {
|
|
|
983370
983724
|
throw new Error(`Failed to download: ${response.status} ${response.statusText}`);
|
|
983371
983725
|
}
|
|
983372
983726
|
const buffer = Buffer.from(await response.arrayBuffer());
|
|
983373
|
-
const tmpDir =
|
|
983374
|
-
|
|
983375
|
-
const tarPath =
|
|
983376
|
-
|
|
983727
|
+
const tmpDir = join39(tmpdir3(), `adk-upgrade-${Date.now()}`);
|
|
983728
|
+
mkdirSync15(tmpDir, { recursive: true });
|
|
983729
|
+
const tarPath = join39(tmpDir, "adk.tar.gz");
|
|
983730
|
+
writeFileSync14(tarPath, buffer);
|
|
983377
983731
|
co5({
|
|
983378
983732
|
file: tarPath,
|
|
983379
983733
|
cwd: tmpDir,
|
|
983380
983734
|
sync: true
|
|
983381
983735
|
});
|
|
983382
|
-
const binaryPath =
|
|
983383
|
-
const binaryBuffer =
|
|
983736
|
+
const binaryPath = join39(tmpDir, fileName);
|
|
983737
|
+
const binaryBuffer = readFileSync35(binaryPath);
|
|
983384
983738
|
try {
|
|
983385
983739
|
unlinkSync4(tarPath);
|
|
983386
983740
|
unlinkSync4(binaryPath);
|
|
@@ -983408,7 +983762,7 @@ async function downloadBinaryWindows(version5, target, extension, logger8) {
|
|
|
983408
983762
|
return binaryEntry.getData();
|
|
983409
983763
|
}
|
|
983410
983764
|
function isRuntimeOrPackageManagerExecutable(path54) {
|
|
983411
|
-
return RUNTIME_BASENAMES.has(
|
|
983765
|
+
return RUNTIME_BASENAMES.has(basename8(path54).toLowerCase());
|
|
983412
983766
|
}
|
|
983413
983767
|
function isInPackageManagerDirectory(path54) {
|
|
983414
983768
|
const normalized = path54.replace(/\\/g, "/");
|
|
@@ -983416,7 +983770,7 @@ function isInPackageManagerDirectory(path54) {
|
|
|
983416
983770
|
}
|
|
983417
983771
|
function isLaunchedAsScript() {
|
|
983418
983772
|
const script = process.argv[1];
|
|
983419
|
-
return !!script && script !== process.execPath && /\.(c|m)?js$/i.test(script) &&
|
|
983773
|
+
return !!script && script !== process.execPath && /\.(c|m)?js$/i.test(script) && existsSync37(script);
|
|
983420
983774
|
}
|
|
983421
983775
|
function getCurrentBinaryPath() {
|
|
983422
983776
|
const execPath3 = process.execPath;
|
|
@@ -983433,9 +983787,9 @@ function getCurrentBinaryPath() {
|
|
|
983433
983787
|
}
|
|
983434
983788
|
function checkWritePermissions(path54) {
|
|
983435
983789
|
try {
|
|
983436
|
-
const dir =
|
|
983790
|
+
const dir = dirname15(path54);
|
|
983437
983791
|
accessSync2(dir, constants7.W_OK);
|
|
983438
|
-
if (
|
|
983792
|
+
if (existsSync37(path54)) {
|
|
983439
983793
|
accessSync2(path54, constants7.W_OK);
|
|
983440
983794
|
}
|
|
983441
983795
|
return true;
|
|
@@ -983464,9 +983818,9 @@ ping /n 2 127.0.0.1 > NUL
|
|
|
983464
983818
|
move /y "${currentPath}.new" "${currentPath}"
|
|
983465
983819
|
del "%~f0"
|
|
983466
983820
|
`.trim();
|
|
983467
|
-
const batchPath =
|
|
983468
|
-
|
|
983469
|
-
|
|
983821
|
+
const batchPath = join39(tmpdir3(), "adk-upgrade.bat");
|
|
983822
|
+
writeFileSync14(batchPath, batchScript);
|
|
983823
|
+
writeFileSync14(currentPath + ".new", newBinaryBuffer);
|
|
983470
983824
|
logger8.info("Update downloaded!", "green");
|
|
983471
983825
|
logger8.info(" Restart your terminal to use the new version.");
|
|
983472
983826
|
execSync5(`start "" /b "${batchPath}"`, { shell: "cmd.exe", windowsHide: true });
|
|
@@ -983474,12 +983828,12 @@ del "%~f0"
|
|
|
983474
983828
|
const backupPath = currentPath + ".backup";
|
|
983475
983829
|
try {
|
|
983476
983830
|
renameSync4(currentPath, backupPath);
|
|
983477
|
-
|
|
983831
|
+
writeFileSync14(currentPath, newBinaryBuffer);
|
|
983478
983832
|
chmodSync3(currentPath, 493);
|
|
983479
983833
|
unlinkSync4(backupPath);
|
|
983480
983834
|
logger8.info("Successfully upgraded!", "green");
|
|
983481
983835
|
} catch (error2) {
|
|
983482
|
-
if (
|
|
983836
|
+
if (existsSync37(backupPath)) {
|
|
983483
983837
|
try {
|
|
983484
983838
|
renameSync4(backupPath, currentPath);
|
|
983485
983839
|
} catch {}
|
|
@@ -983585,109 +983939,159 @@ var init_upgrade3 = __esm(() => {
|
|
|
983585
983939
|
// src/commands/adk-ai-upgrade.ts
|
|
983586
983940
|
var exports_adk_ai_upgrade = {};
|
|
983587
983941
|
__export(exports_adk_ai_upgrade, {
|
|
983588
|
-
adkUpdate: () => adkUpdate
|
|
983942
|
+
adkUpdate: () => adkUpdate,
|
|
983943
|
+
adkAgent0Upgrade: () => adkAgent0Upgrade
|
|
983589
983944
|
});
|
|
983590
|
-
|
|
983591
|
-
import { promisify as promisify11 } from "util";
|
|
983592
|
-
function getSkillsRunner(projectPath) {
|
|
983593
|
-
const managers = detectPackageManagers();
|
|
983594
|
-
const preferred = getPreferredPackageManager(projectPath, managers);
|
|
983595
|
-
return preferred?.command === "bun" ? "bunx" : "npx";
|
|
983596
|
-
}
|
|
983597
|
-
async function adkUpdate(options = {}) {
|
|
983945
|
+
async function adkAgent0Upgrade(options = {}) {
|
|
983598
983946
|
const isJson = options.format === "json";
|
|
983599
983947
|
const logger8 = createCliLogger({ format: options.format });
|
|
983600
|
-
const writeStdout = (text2) => logger8.stdout(text2);
|
|
983601
|
-
const clearSpinner = (spinner, msgLength) => {
|
|
983602
|
-
if (spinner) {
|
|
983603
|
-
clearInterval(spinner);
|
|
983604
|
-
writeStdout("\r" + " ".repeat(msgLength + 6) + "\r");
|
|
983605
|
-
}
|
|
983606
|
-
};
|
|
983607
983948
|
const projectPath = await findAgentRootOrFail(process.cwd());
|
|
983608
|
-
const
|
|
983949
|
+
const status = checkAgent0CapabilitiesStatus(projectPath);
|
|
983950
|
+
const baseResult = {
|
|
983609
983951
|
success: true,
|
|
983610
|
-
|
|
983611
|
-
|
|
983952
|
+
projectPath,
|
|
983953
|
+
command: "adk agent0 upgrade",
|
|
983954
|
+
currentVersion: status.currentVersion,
|
|
983955
|
+
previousVersion: status.state === "missing" ? undefined : status.installedVersion,
|
|
983956
|
+
updated: false
|
|
983612
983957
|
};
|
|
983958
|
+
if (status.state === "current") {
|
|
983959
|
+
const manifest = readAgent0CapabilitiesManifest(projectPath);
|
|
983960
|
+
const result2 = {
|
|
983961
|
+
...baseResult,
|
|
983962
|
+
capabilities: manifest ? {
|
|
983963
|
+
root: manifest.capabilitiesRoot,
|
|
983964
|
+
manifestPath: status.manifestPath,
|
|
983965
|
+
skills: manifest.skills.length,
|
|
983966
|
+
playbooks: manifest.playbooks.length
|
|
983967
|
+
} : undefined
|
|
983968
|
+
};
|
|
983969
|
+
if (isJson) {
|
|
983970
|
+
logger8.info("").result(result2);
|
|
983971
|
+
} else {
|
|
983972
|
+
logger8.info(`Agent(0) capabilities are already current (${status.currentVersion}).`, "green");
|
|
983973
|
+
}
|
|
983974
|
+
return;
|
|
983975
|
+
}
|
|
983613
983976
|
if (!isJson) {
|
|
983614
|
-
logger8.info("Updating
|
|
983977
|
+
logger8.info("Updating Agent(0) project capabilities...");
|
|
983615
983978
|
logger8.newline();
|
|
983616
983979
|
}
|
|
983617
983980
|
let frameIdx = 0;
|
|
983618
|
-
const
|
|
983619
|
-
const
|
|
983620
|
-
|
|
983621
|
-
const skillsSpinner = isJson ? null : setInterval(() => {
|
|
983622
|
-
writeStdout(`\r ${SPINNER_FRAMES[frameIdx++ % SPINNER_FRAMES.length]} ${skillsMsg}`);
|
|
983981
|
+
const message = "Writing .agent0/capabilities...";
|
|
983982
|
+
const spinner = isJson ? null : setInterval(() => {
|
|
983983
|
+
logger8.stdout(`\r ${SPINNER_FRAMES[frameIdx++ % SPINNER_FRAMES.length]} ${message}`);
|
|
983623
983984
|
}, 80);
|
|
983985
|
+
const clearSpinner = () => {
|
|
983986
|
+
if (!spinner)
|
|
983987
|
+
return;
|
|
983988
|
+
clearInterval(spinner);
|
|
983989
|
+
logger8.stdout("\r" + " ".repeat(message.length + 6) + "\r");
|
|
983990
|
+
};
|
|
983624
983991
|
try {
|
|
983625
|
-
await
|
|
983626
|
-
|
|
983627
|
-
|
|
983628
|
-
|
|
983629
|
-
|
|
983630
|
-
|
|
983631
|
-
|
|
983632
|
-
|
|
983992
|
+
const installed = await installAgent0Capabilities(projectPath);
|
|
983993
|
+
clearSpinner();
|
|
983994
|
+
const result2 = {
|
|
983995
|
+
...baseResult,
|
|
983996
|
+
updated: true,
|
|
983997
|
+
capabilities: {
|
|
983998
|
+
root: installed.capabilitiesRoot,
|
|
983999
|
+
manifestPath: installed.manifestPath,
|
|
984000
|
+
source: installed.source,
|
|
984001
|
+
skills: installed.skills.installed,
|
|
984002
|
+
playbooks: installed.playbooks.installed
|
|
984003
|
+
}
|
|
984004
|
+
};
|
|
984005
|
+
if (isJson) {
|
|
984006
|
+
logger8.info("").result(result2);
|
|
984007
|
+
} else {
|
|
984008
|
+
logger8.info(`Agent(0) capabilities updated (${installed.skills.installed} skills, ${installed.playbooks.installed} commands).`, "green");
|
|
983633
984009
|
}
|
|
983634
984010
|
} catch (error2) {
|
|
983635
|
-
|
|
983636
|
-
const
|
|
983637
|
-
result2
|
|
983638
|
-
|
|
983639
|
-
|
|
983640
|
-
|
|
983641
|
-
|
|
984011
|
+
clearSpinner();
|
|
984012
|
+
const errorMessage2 = error2 instanceof Error ? error2.message : String(error2);
|
|
984013
|
+
const result2 = {
|
|
984014
|
+
...baseResult,
|
|
984015
|
+
success: false,
|
|
984016
|
+
error: errorMessage2
|
|
984017
|
+
};
|
|
984018
|
+
if (isJson) {
|
|
984019
|
+
logger8.info("").result(result2);
|
|
984020
|
+
return;
|
|
983642
984021
|
}
|
|
984022
|
+
logger8.error(`Failed to update Agent(0) capabilities: ${errorMessage2}`);
|
|
984023
|
+
}
|
|
984024
|
+
}
|
|
984025
|
+
async function adkUpdate(options = {}) {
|
|
984026
|
+
const isJson = options.format === "json";
|
|
984027
|
+
const logger8 = createCliLogger({ format: options.format });
|
|
984028
|
+
const projectPath = await findAgentRootOrFail(process.cwd());
|
|
984029
|
+
if (!isJson) {
|
|
984030
|
+
logger8.info("Updating ADK skills & commands...");
|
|
984031
|
+
logger8.newline();
|
|
983643
984032
|
}
|
|
983644
|
-
|
|
983645
|
-
const
|
|
983646
|
-
|
|
984033
|
+
let frameIdx = 0;
|
|
984034
|
+
const message = "Updating external coding-agent capabilities...";
|
|
984035
|
+
const spinner = isJson ? null : setInterval(() => {
|
|
984036
|
+
logger8.stdout(`\r ${SPINNER_FRAMES[frameIdx++ % SPINNER_FRAMES.length]} ${message}`);
|
|
983647
984037
|
}, 80);
|
|
984038
|
+
const clearSpinner = () => {
|
|
984039
|
+
if (!spinner)
|
|
984040
|
+
return;
|
|
984041
|
+
clearInterval(spinner);
|
|
984042
|
+
logger8.stdout("\r" + " ".repeat(message.length + 6) + "\r");
|
|
984043
|
+
};
|
|
983648
984044
|
try {
|
|
983649
|
-
|
|
983650
|
-
clearSpinner(
|
|
983651
|
-
|
|
983652
|
-
|
|
983653
|
-
|
|
983654
|
-
|
|
983655
|
-
|
|
983656
|
-
}
|
|
983657
|
-
}
|
|
983658
|
-
} catch (error2) {
|
|
983659
|
-
result2.commands = {
|
|
983660
|
-
attempted: true,
|
|
983661
|
-
success: false,
|
|
983662
|
-
installedCommands: 0,
|
|
983663
|
-
failed: 0,
|
|
983664
|
-
error: error2 instanceof Error ? error2.message : String(error2)
|
|
984045
|
+
const externalHarness = await installExternalHarnessCapabilities({ projectPath });
|
|
984046
|
+
clearSpinner();
|
|
984047
|
+
const result2 = {
|
|
984048
|
+
success: externalHarness.success,
|
|
984049
|
+
projectPath,
|
|
984050
|
+
skills: externalHarness.skills,
|
|
984051
|
+
commands: externalHarness.commands
|
|
983665
984052
|
};
|
|
983666
|
-
|
|
983667
|
-
|
|
984053
|
+
if (isJson) {
|
|
984054
|
+
logger8.info("").result(result2);
|
|
984055
|
+
return;
|
|
984056
|
+
}
|
|
984057
|
+
if (externalHarness.skills.success) {
|
|
984058
|
+
logger8.info(" ADK skills updated", "green");
|
|
984059
|
+
} else {
|
|
984060
|
+
logger8.warn(" Failed to update ADK skills. Run manually:");
|
|
984061
|
+
logger8.info(` > ${externalHarness.skills.command}`, "cyan");
|
|
984062
|
+
}
|
|
984063
|
+
if (externalHarness.commands.success) {
|
|
984064
|
+
logger8.info(` ADK commands updated (${externalHarness.commands.installedCommands} commands)`, "green");
|
|
984065
|
+
} else {
|
|
983668
984066
|
logger8.warn(" Failed to update ADK commands.");
|
|
983669
984067
|
}
|
|
983670
|
-
}
|
|
983671
|
-
result2.success = result2.skills.success && result2.commands.success;
|
|
983672
|
-
if (isJson) {
|
|
983673
|
-
logger8.info("").result(result2);
|
|
983674
|
-
} else {
|
|
983675
984068
|
logger8.newline();
|
|
983676
|
-
if (
|
|
984069
|
+
if (externalHarness.success) {
|
|
983677
984070
|
logger8.info("All up to date!", "green");
|
|
983678
984071
|
} else {
|
|
983679
984072
|
logger8.warn("Some updates failed. See warnings above.");
|
|
983680
984073
|
}
|
|
984074
|
+
} catch (error2) {
|
|
984075
|
+
clearSpinner();
|
|
984076
|
+
const message2 = error2 instanceof Error ? error2.message : String(error2);
|
|
984077
|
+
const result2 = {
|
|
984078
|
+
success: false,
|
|
984079
|
+
projectPath,
|
|
984080
|
+
error: message2
|
|
984081
|
+
};
|
|
984082
|
+
if (isJson) {
|
|
984083
|
+
logger8.info("").result(result2);
|
|
984084
|
+
return;
|
|
984085
|
+
}
|
|
984086
|
+
logger8.error(`Failed to update ADK skills & commands: ${message2}`);
|
|
983681
984087
|
}
|
|
983682
984088
|
}
|
|
983683
|
-
var
|
|
983684
|
-
var init_adk_ai_upgrade = __esm(() => {
|
|
983685
|
-
|
|
983686
|
-
init_package_manager();
|
|
983687
|
-
init_skills_ref();
|
|
984089
|
+
var SPINNER_FRAMES;
|
|
984090
|
+
var init_adk_ai_upgrade = __esm(async () => {
|
|
984091
|
+
init_external_harness_capabilities();
|
|
983688
984092
|
init_agent_root();
|
|
983689
984093
|
init_logger();
|
|
983690
|
-
|
|
984094
|
+
await init_agent0_capabilities();
|
|
983691
984095
|
SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
983692
984096
|
});
|
|
983693
984097
|
|
|
@@ -984024,7 +984428,7 @@ var exports_adk_kill = {};
|
|
|
984024
984428
|
__export(exports_adk_kill, {
|
|
984025
984429
|
adkKill: () => adkKill
|
|
984026
984430
|
});
|
|
984027
|
-
import { existsSync as
|
|
984431
|
+
import { existsSync as existsSync38, unlinkSync as unlinkSync5 } from "fs";
|
|
984028
984432
|
import path68 from "path";
|
|
984029
984433
|
function resolveAgentTarget(target, agents) {
|
|
984030
984434
|
const normalizedTarget = target.toLowerCase();
|
|
@@ -984189,7 +984593,7 @@ function cleanupConsoleFiles() {
|
|
|
984189
984593
|
[CONSOLE_SOCKET_PATH, "console.sock"],
|
|
984190
984594
|
[CONSOLE_LOCK_FILE, "console.lock"]
|
|
984191
984595
|
]) {
|
|
984192
|
-
if (
|
|
984596
|
+
if (existsSync38(filePath)) {
|
|
984193
984597
|
try {
|
|
984194
984598
|
unlinkSync5(filePath);
|
|
984195
984599
|
removed.push(label2);
|
|
@@ -987120,7 +987524,7 @@ __export(exports_adk_run, {
|
|
|
987120
987524
|
adkRun: () => adkRun
|
|
987121
987525
|
});
|
|
987122
987526
|
import path69 from "path";
|
|
987123
|
-
import { existsSync as
|
|
987527
|
+
import { existsSync as existsSync39 } from "fs";
|
|
987124
987528
|
async function adkRun(scriptPath, args = [], options = {}) {
|
|
987125
987529
|
const logger9 = createCliLogger();
|
|
987126
987530
|
const envLabel = options.prod ? "production" : "development";
|
|
@@ -987142,7 +987546,7 @@ async function adkRun(scriptPath, args = [], options = {}) {
|
|
|
987142
987546
|
await assertValidProject(project);
|
|
987143
987547
|
logger9.info(`\uD83D\uDCE6 Project: ${project.config?.name || "Unknown"}`, "green");
|
|
987144
987548
|
const absoluteScriptPath = path69.isAbsolute(scriptPath) ? scriptPath : path69.resolve(process.cwd(), scriptPath);
|
|
987145
|
-
if (!
|
|
987549
|
+
if (!existsSync39(absoluteScriptPath)) {
|
|
987146
987550
|
throw new Error(`Script not found: ${absoluteScriptPath}`);
|
|
987147
987551
|
}
|
|
987148
987552
|
logger9.info(`\uD83D\uDCDC Script: ${path69.relative(process.cwd(), absoluteScriptPath)}`, "cyan");
|
|
@@ -990514,10 +990918,21 @@ program.command("self-upgrade").alias("self-update").description("Upgrade ADK CL
|
|
|
990514
990918
|
logger10.fatal(error2);
|
|
990515
990919
|
}
|
|
990516
990920
|
});
|
|
990517
|
-
program.command("
|
|
990921
|
+
var agent0Command = program.command("agent0").description("Manage Agent(0)");
|
|
990922
|
+
agent0Command.command("upgrade").description("Create or update the project Agent(0) capability bundle").option("--format <format>", "output format (json)").action(async (options) => {
|
|
990923
|
+
try {
|
|
990924
|
+
await trackCmd("agent0-upgrade", async () => {
|
|
990925
|
+
const { adkAgent0Upgrade: adkAgent0Upgrade2 } = await init_adk_ai_upgrade().then(() => exports_adk_ai_upgrade);
|
|
990926
|
+
await adkAgent0Upgrade2(options);
|
|
990927
|
+
}, false);
|
|
990928
|
+
} catch (error2) {
|
|
990929
|
+
createCliLogger({ format: options.format }).fatal(error2);
|
|
990930
|
+
}
|
|
990931
|
+
});
|
|
990932
|
+
program.command("ai-upgrade").description("Update ADK skills and slash commands for external coding agents").option("--format <format>", "output format (json)").action(async (options) => {
|
|
990518
990933
|
try {
|
|
990519
990934
|
await trackCmd("ai-upgrade", async () => {
|
|
990520
|
-
const { adkUpdate: adkUpdate2 } = await
|
|
990935
|
+
const { adkUpdate: adkUpdate2 } = await init_adk_ai_upgrade().then(() => exports_adk_ai_upgrade);
|
|
990521
990936
|
await adkUpdate2(options);
|
|
990522
990937
|
}, false);
|
|
990523
990938
|
} catch (error2) {
|