clawmini 0.0.7 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.changeset/README.md +8 -0
- package/.changeset/config.json +14 -0
- package/.github/workflows/release.yml +49 -0
- package/CHANGELOG.md +36 -0
- package/README.md +5 -4
- package/dist/adapter-discord/index.d.mts.map +1 -1
- package/dist/adapter-discord/index.mjs +465 -282
- package/dist/adapter-discord/index.mjs.map +1 -1
- package/dist/adapter-google-chat/index.mjs +367 -243
- package/dist/adapter-google-chat/index.mjs.map +1 -1
- package/dist/cli/index.mjs +684 -24
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lite.mjs +43 -13
- package/dist/cli/lite.mjs.map +1 -1
- package/dist/cli/{propose-policy.mjs → manage-policies.mjs} +270 -47
- package/dist/cli/manage-policies.mjs.map +1 -0
- package/dist/cli/run-host.d.mts +1 -0
- package/dist/cli/run-host.mjs +3090 -0
- package/dist/cli/run-host.mjs.map +1 -0
- package/dist/config-CPFQIGdG.mjs +57 -0
- package/dist/config-CPFQIGdG.mjs.map +1 -0
- package/dist/config-Dvl-Pov4.mjs +76 -0
- package/dist/config-Dvl-Pov4.mjs.map +1 -0
- package/dist/daemon/index.d.mts.map +1 -1
- package/dist/daemon/index.mjs +970 -332
- package/dist/daemon/index.mjs.map +1 -1
- package/dist/supervisor-actions-CiW56eLi.mjs +843 -0
- package/dist/supervisor-actions-CiW56eLi.mjs.map +1 -0
- package/dist/turn-log-buffer-DRgW53gl.mjs +767 -0
- package/dist/turn-log-buffer-DRgW53gl.mjs.map +1 -0
- package/dist/web/_app/immutable/chunks/{Drm9vgeP.js → 3AZlWB6U.js} +1 -1
- package/dist/web/_app/immutable/chunks/BhRSsUCh.js +2 -0
- package/dist/web/_app/immutable/chunks/BiLeM2i1.js +1 -0
- package/{web/.svelte-kit/output/client/_app/immutable/chunks/CME08kGM.js → dist/web/_app/immutable/chunks/BmBj85Ll.js} +1 -1
- package/dist/web/_app/immutable/chunks/BrERcKAH.js +1 -0
- package/dist/web/_app/immutable/chunks/Bv9252RM.js +1 -0
- package/dist/web/_app/immutable/chunks/CIXNBPKi.js +1 -0
- package/dist/web/_app/immutable/chunks/DISKL3GN.js +2 -0
- package/dist/web/_app/immutable/chunks/{Zeh-C-mx.js → DcpaLzmX.js} +1 -1
- package/dist/web/_app/immutable/chunks/DnQ3vS13.js +1 -0
- package/dist/web/_app/immutable/chunks/KsloHTKS.js +1 -0
- package/{web/.svelte-kit/output/client/_app/immutable/chunks/Ck-be5J2.js → dist/web/_app/immutable/chunks/RsHsUj-8.js} +2 -2
- package/dist/web/_app/immutable/chunks/{G_zz-Gou.js → wpfV79dV.js} +1 -1
- package/dist/web/_app/immutable/entry/app.CIw1Qj0n.js +2 -0
- package/dist/web/_app/immutable/entry/start.Di0-Jhte.js +1 -0
- package/dist/web/_app/immutable/nodes/{0.CYS8iApT.js → 0.DYyUA1au.js} +1 -1
- package/dist/web/_app/immutable/nodes/1.D-3QEMMZ.js +1 -0
- package/dist/web/_app/immutable/nodes/{2.BnwnD1Ki.js → 2.4olHnH7U.js} +1 -1
- package/{web/.svelte-kit/output/client/_app/immutable/nodes/3.Dr0ot9sV.js → dist/web/_app/immutable/nodes/3.4w0bE-m2.js} +3 -3
- package/dist/web/_app/immutable/nodes/4.CZvjhVHt.js +60 -0
- package/dist/web/_app/immutable/nodes/{5.BBGQ_i84.js → 5.DLbPVJY2.js} +1 -1
- package/dist/web/_app/version.json +1 -1
- package/dist/web/index.html +12 -12
- package/dist/workspace-oWmVh5mi.mjs +1001 -0
- package/dist/workspace-oWmVh5mi.mjs.map +1 -0
- package/docs/23_adapter_slash_autocomplete/development_log.md +19 -0
- package/docs/23_adapter_slash_autocomplete/notes.md +18 -0
- package/docs/23_adapter_slash_autocomplete/prd.md +46 -0
- package/docs/23_adapter_slash_autocomplete/questions.md +6 -0
- package/docs/23_adapter_slash_autocomplete/tickets.md +21 -0
- package/docs/24_subagent_job_policy_fixes/development_log.md +22 -0
- package/docs/24_subagent_job_policy_fixes/notes.md +28 -0
- package/docs/24_subagent_job_policy_fixes/prd.md +59 -0
- package/docs/24_subagent_job_policy_fixes/questions.md +3 -0
- package/docs/24_subagent_job_policy_fixes/tickets.md +49 -0
- package/docs/25_e2e_test_improvements/development_log.md +30 -0
- package/docs/25_e2e_test_improvements/notes.md +29 -0
- package/docs/25_e2e_test_improvements/prd.md +43 -0
- package/docs/25_e2e_test_improvements/questions.md +12 -0
- package/docs/25_e2e_test_improvements/tickets-2.md +22 -0
- package/docs/25_e2e_test_improvements/tickets.md +22 -0
- package/docs/25_policy_cwd/development_log.md +30 -0
- package/docs/25_policy_cwd/notes.md +28 -0
- package/docs/25_policy_cwd/prd.md +77 -0
- package/docs/25_policy_cwd/questions.md +6 -0
- package/docs/25_policy_cwd/tickets.md +77 -0
- package/docs/CLI_REFERENCE.md +3 -1
- package/docs/PHILOSOPHY.md +35 -0
- package/docs/adapter-visibility/SPEC.md +461 -0
- package/docs/adapter-visibility/SPEC_v2.md +202 -0
- package/docs/auto-update/SPEC.md +344 -0
- package/docs/backups/SPEC.md +296 -0
- package/docs/backups/clawmini.gitignore +69 -0
- package/docs/guides/assets/clawmini-avatar.png +0 -0
- package/docs/guides/backups.md +332 -0
- package/docs/guides/discord_adapter_setup.md +1 -1
- package/docs/guides/google_chat_adapter_setup.md +81 -0
- package/docs/unified-startup/SPEC.md +203 -0
- package/e2e/_helpers/test-environment.test.ts +49 -0
- package/e2e/_helpers/test-environment.ts +548 -0
- package/e2e/adapters/_google-chat-fixtures.ts +340 -0
- package/{src/cli/e2e → e2e/adapters}/adapter-discord.test.ts +22 -23
- package/e2e/adapters/adapter-google-chat-downtime.test.ts +157 -0
- package/e2e/adapters/adapter-google-chat-inbound.test.ts +697 -0
- package/e2e/adapters/adapter-google-chat-outbound.test.ts +297 -0
- package/e2e/adapters/adapter-google-chat-roundtrip.test.ts +56 -0
- package/e2e/adapters/adapter-google-chat-threads.test.ts +1078 -0
- package/e2e/agents/custom-api-env.test.ts +80 -0
- package/e2e/agents/export-lite-func.test.ts +104 -0
- package/e2e/agents/fallbacks.test.ts +124 -0
- package/e2e/agents/interrupt.test.ts +50 -0
- package/e2e/agents/no-reply-necessary.test.ts +57 -0
- package/e2e/agents/session-timeout-subagents.test.ts +76 -0
- package/e2e/agents/subagent-authorization.test.ts +246 -0
- package/e2e/agents/subagent-env.test.ts +49 -0
- package/e2e/agents/subagent-lifecycle.test.ts +782 -0
- package/e2e/agents/subagents-depth.test.ts +47 -0
- package/e2e/cli/agents.test.ts +176 -0
- package/e2e/cli/auto-update.test.ts +741 -0
- package/e2e/cli/basic.test.ts +44 -0
- package/{src/cli/e2e → e2e/cli}/export-lite.test.ts +16 -12
- package/e2e/cli/init-gitignore.test.ts +86 -0
- package/e2e/cli/init.test.ts +76 -0
- package/e2e/cli/messages.test.ts +363 -0
- package/e2e/cli/serve.test.ts +76 -0
- package/{src/cli/e2e → e2e/cli}/skills.test.ts +11 -10
- package/{src/cli/e2e → e2e/daemon}/daemon.test.ts +57 -195
- package/e2e/jobs/agent-jobs.test.ts +216 -0
- package/e2e/jobs/cron.test.ts +64 -0
- package/e2e/jobs/restart.test.ts +108 -0
- package/e2e/policies/approval-session.test.ts +69 -0
- package/e2e/policies/auto-create-policies-file.test.ts +35 -0
- package/e2e/policies/builtin-manage-policies.test.ts +184 -0
- package/e2e/policies/builtin-run-host.test.ts +180 -0
- package/e2e/policies/environment-policies.test.ts +177 -0
- package/e2e/policies/manage-policies.test.ts +566 -0
- package/e2e/policies/output-size.test.ts +98 -0
- package/e2e/policies/policies-context-cwd.test.ts +160 -0
- package/e2e/policies/relative-script-path.test.ts +60 -0
- package/e2e/policies/requests-show.test.ts +135 -0
- package/e2e/policies/requests.test.ts +208 -0
- package/e2e/policies/slash-policies.test.ts +308 -0
- package/e2e/policies/startup-cleanup.test.ts +48 -0
- package/e2e/routers/session-timeout.test.ts +106 -0
- package/e2e/routers/slash-model.test.ts +152 -0
- package/e2e/routers/slash-new.test.ts +50 -0
- package/e2e/routers/slash-restart-adapter.test.ts +96 -0
- package/e2e/routers/slash-restart.test.ts +114 -0
- package/e2e/routers/slash-shutdown.test.ts +55 -0
- package/e2e/routers/slash-stop.test.ts +232 -0
- package/e2e/routers/slash-upgrade.test.ts +88 -0
- package/{src/cli/e2e → e2e/sandbox}/environments.test.ts +14 -13
- package/eslint.config.js +6 -0
- package/napkin.md +1 -1
- package/package.json +8 -3
- package/src/adapter-discord/commands.test.ts +42 -0
- package/src/adapter-discord/commands.ts +33 -0
- package/src/adapter-discord/config.ts +12 -0
- package/src/adapter-discord/forwarder.test.ts +499 -21
- package/src/adapter-discord/forwarder.ts +343 -124
- package/src/adapter-discord/inbound-cache.test.ts +47 -0
- package/src/adapter-discord/inbound-cache.ts +37 -0
- package/src/adapter-discord/index.test.ts +67 -2
- package/src/adapter-discord/index.ts +84 -216
- package/src/adapter-discord/interactions.test.ts +54 -3
- package/src/adapter-discord/interactions.ts +97 -53
- package/src/adapter-discord/processMessage.ts +239 -0
- package/src/adapter-discord/state.ts +1 -0
- package/src/adapter-google-chat/auth.test.ts +9 -5
- package/src/adapter-google-chat/auth.ts +29 -23
- package/src/adapter-google-chat/cards.ts +7 -2
- package/src/adapter-google-chat/client.test.ts +37 -2
- package/src/adapter-google-chat/client.ts +138 -38
- package/src/adapter-google-chat/config.ts +19 -0
- package/src/adapter-google-chat/forwarder.test.ts +81 -56
- package/src/adapter-google-chat/forwarder.ts +394 -185
- package/src/adapter-google-chat/inbound-cache.test.ts +61 -0
- package/src/adapter-google-chat/inbound-cache.ts +36 -0
- package/src/adapter-google-chat/state.test.ts +1 -0
- package/src/adapter-google-chat/state.ts +9 -1
- package/src/adapter-google-chat/subscriptions.ts +8 -6
- package/src/cli/builtin-policies.ts +44 -0
- package/src/cli/commands/agents.ts +59 -5
- package/src/cli/commands/down.ts +54 -2
- package/src/cli/commands/environments.ts +8 -2
- package/src/cli/commands/init.ts +31 -0
- package/src/cli/commands/logs.ts +116 -0
- package/src/cli/commands/policies.ts +6 -4
- package/src/cli/commands/serve.test.ts +67 -0
- package/src/cli/commands/serve.ts +284 -0
- package/src/cli/commands/up.ts +122 -2
- package/src/cli/commands/web-api/agents.ts +3 -2
- package/src/cli/index.ts +4 -0
- package/src/cli/install-detection.test.ts +72 -0
- package/src/cli/install-detection.ts +48 -0
- package/src/cli/lite.ts +54 -22
- package/src/cli/manage-policies-utils.ts +104 -0
- package/src/cli/manage-policies.ts +291 -0
- package/src/cli/run-host.ts +45 -0
- package/src/cli/supervisor-actions.ts +267 -0
- package/src/cli/supervisor-control.test.ts +129 -0
- package/src/cli/supervisor-control.ts +155 -0
- package/src/cli/supervisor-pid.ts +68 -0
- package/src/cli/supervisor.ts +277 -0
- package/src/daemon/agent/agent-context.ts +11 -11
- package/src/daemon/agent/agent-session.ts +8 -1
- package/src/daemon/agent/chat-logger.test.ts +78 -9
- package/src/daemon/agent/chat-logger.ts +25 -5
- package/src/daemon/agent/turn-registry.test.ts +89 -0
- package/src/daemon/agent/turn-registry.ts +94 -0
- package/src/daemon/agent/types.ts +2 -0
- package/src/daemon/api/agent-policy-endpoints.ts +263 -0
- package/src/daemon/api/agent-router.ts +47 -126
- package/src/daemon/api/index.test.ts +1 -0
- package/src/daemon/api/policy-request.test.ts +7 -5
- package/src/daemon/api/router-utils.ts +6 -5
- package/src/daemon/api/subagent-router.ts +110 -74
- package/src/daemon/api/subagent-utils.test.ts +60 -0
- package/src/daemon/api/subagent-utils.ts +113 -87
- package/src/daemon/api/user-router.ts +34 -8
- package/src/daemon/auth.ts +1 -0
- package/src/daemon/cron.test.ts +62 -4
- package/src/daemon/cron.ts +42 -16
- package/src/daemon/events.ts +65 -0
- package/src/daemon/index.ts +24 -1
- package/src/daemon/message-interruption.test.ts +1 -0
- package/src/daemon/message-jobs.test.ts +1 -0
- package/src/daemon/message.ts +78 -14
- package/src/daemon/observation.test.ts +26 -18
- package/src/daemon/pending-replies.test.ts +112 -0
- package/src/daemon/pending-replies.ts +162 -0
- package/src/daemon/policy-request-service.ts +3 -1
- package/src/daemon/policy-utils.test.ts +66 -1
- package/src/daemon/policy-utils.ts +126 -1
- package/src/daemon/request-store.ts +31 -0
- package/src/daemon/routers/session-timeout.ts +4 -0
- package/src/daemon/routers/slash-model.test.ts +344 -0
- package/src/daemon/routers/slash-model.ts +207 -0
- package/src/daemon/routers/slash-policies.test.ts +38 -32
- package/src/daemon/routers/slash-policies.ts +84 -33
- package/src/daemon/routers/slash-restart.test.ts +69 -0
- package/src/daemon/routers/slash-restart.ts +36 -0
- package/src/daemon/routers/slash-shutdown.test.ts +50 -0
- package/src/daemon/routers/slash-shutdown.ts +28 -0
- package/src/daemon/routers/slash-upgrade.test.ts +116 -0
- package/src/daemon/routers/slash-upgrade.ts +76 -0
- package/src/daemon/routers/types.ts +7 -0
- package/src/daemon/routers.ts +16 -0
- package/src/shared/adapters/blockquote.test.ts +28 -0
- package/src/shared/adapters/blockquote.ts +20 -0
- package/src/shared/adapters/filtering.test.ts +224 -10
- package/src/shared/adapters/filtering.ts +95 -7
- package/src/shared/adapters/inbound-cache.test.ts +48 -0
- package/src/shared/adapters/inbound-cache.ts +54 -0
- package/src/shared/adapters/turn-log-buffer.ts +266 -0
- package/src/shared/adapters/turn-log.test.ts +389 -0
- package/src/shared/adapters/turn-log.ts +357 -0
- package/src/shared/agent-utils.ts +12 -5
- package/src/shared/chats.test.ts +4 -0
- package/src/shared/chats.ts +9 -0
- package/src/shared/config.ts +16 -1
- package/src/shared/lite.ts +76 -2
- package/src/shared/policies.ts +26 -0
- package/src/shared/template-manifest.ts +267 -0
- package/src/shared/utils/shell.ts +61 -0
- package/src/shared/version.ts +34 -0
- package/src/shared/workspace.test.ts +217 -0
- package/src/shared/workspace.ts +626 -48
- package/templates/environments/cladding/allowlist-domain.mjs +125 -0
- package/templates/environments/cladding/env.json +21 -1
- package/templates/environments/cladding/run-with-network.mjs +54 -0
- package/templates/environments/macos-proxy/allowlist-domain.mjs +95 -0
- package/templates/environments/macos-proxy/env.json +8 -1
- package/templates/environments/macos-proxy/proxy.mjs +42 -13
- package/templates/gemini/template.json +5 -0
- package/templates/gemini-claw/template.json +13 -0
- package/templates/skills/clawmini-requests/SKILL.md +69 -10
- package/templates/skills/run-host/SKILL.md +51 -0
- package/templates/skills/skill-creator/SKILL.md +4 -3
- package/templates/skills/skill-creator/scripts/validate.sh +52 -0
- package/tsdown.config.ts +10 -1
- package/vitest.config.ts +2 -2
- package/web/.svelte-kit/ambient.d.ts +292 -176
- package/web/.svelte-kit/generated/server/internal.js +1 -1
- package/web/.svelte-kit/output/client/.vite/manifest.json +127 -137
- package/web/.svelte-kit/output/client/_app/immutable/chunks/{Drm9vgeP.js → 3AZlWB6U.js} +1 -1
- package/web/.svelte-kit/output/client/_app/immutable/chunks/BhRSsUCh.js +2 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/BiLeM2i1.js +1 -0
- package/{dist/web/_app/immutable/chunks/CME08kGM.js → web/.svelte-kit/output/client/_app/immutable/chunks/BmBj85Ll.js} +1 -1
- package/web/.svelte-kit/output/client/_app/immutable/chunks/BrERcKAH.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/Bv9252RM.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/CIXNBPKi.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/DISKL3GN.js +2 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/{Zeh-C-mx.js → DcpaLzmX.js} +1 -1
- package/web/.svelte-kit/output/client/_app/immutable/chunks/DnQ3vS13.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/KsloHTKS.js +1 -0
- package/{dist/web/_app/immutable/chunks/Ck-be5J2.js → web/.svelte-kit/output/client/_app/immutable/chunks/RsHsUj-8.js} +2 -2
- package/web/.svelte-kit/output/client/_app/immutable/chunks/{G_zz-Gou.js → wpfV79dV.js} +1 -1
- package/web/.svelte-kit/output/client/_app/immutable/entry/app.CIw1Qj0n.js +2 -0
- package/web/.svelte-kit/output/client/_app/immutable/entry/start.Di0-Jhte.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/nodes/{0.CYS8iApT.js → 0.DYyUA1au.js} +1 -1
- package/web/.svelte-kit/output/client/_app/immutable/nodes/1.D-3QEMMZ.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/nodes/{2.BnwnD1Ki.js → 2.4olHnH7U.js} +1 -1
- package/{dist/web/_app/immutable/nodes/3.Dr0ot9sV.js → web/.svelte-kit/output/client/_app/immutable/nodes/3.4w0bE-m2.js} +3 -3
- package/web/.svelte-kit/output/client/_app/immutable/nodes/4.CZvjhVHt.js +60 -0
- package/web/.svelte-kit/output/client/_app/immutable/nodes/{5.BBGQ_i84.js → 5.DLbPVJY2.js} +1 -1
- package/web/.svelte-kit/output/client/_app/version.json +1 -1
- package/web/.svelte-kit/output/server/.vite/manifest.json +12 -10
- package/web/.svelte-kit/output/server/chunks/Icon.js +1 -1
- package/web/.svelte-kit/output/server/chunks/client.js +1 -1
- package/web/.svelte-kit/output/server/chunks/exports.js +1 -1
- package/web/.svelte-kit/output/server/chunks/index-server.js +2 -1
- package/web/.svelte-kit/output/server/chunks/internal.js +1 -1
- package/web/.svelte-kit/output/server/chunks/render-context.js +77 -0
- package/web/.svelte-kit/output/server/chunks/root.js +739 -788
- package/web/.svelte-kit/output/server/chunks/shared.js +234 -21
- package/web/.svelte-kit/output/server/index.js +126 -90
- package/web/.svelte-kit/output/server/manifest-full.js +1 -1
- package/web/.svelte-kit/output/server/manifest.js +1 -1
- package/web/.svelte-kit/output/server/nodes/0.js +1 -1
- package/web/.svelte-kit/output/server/nodes/1.js +1 -1
- package/web/.svelte-kit/output/server/nodes/2.js +1 -1
- package/web/.svelte-kit/output/server/nodes/3.js +1 -1
- package/web/.svelte-kit/output/server/nodes/4.js +1 -1
- package/web/.svelte-kit/output/server/nodes/5.js +1 -1
- package/web/.svelte-kit/output/server/remote-entry.js +245 -81
- package/web/.svelte-kit/tsconfig.json +4 -1
- package/dist/cli/propose-policy.mjs.map +0 -1
- package/dist/lite-CBxOT1y5.mjs +0 -241
- package/dist/lite-CBxOT1y5.mjs.map +0 -1
- package/dist/routing-D8rTxtaV.mjs +0 -245
- package/dist/routing-D8rTxtaV.mjs.map +0 -1
- package/dist/web/_app/immutable/chunks/B6YN0Nuq.js +0 -1
- package/dist/web/_app/immutable/chunks/BmRlVmv6.js +0 -1
- package/dist/web/_app/immutable/chunks/CK9JZLaG.js +0 -2
- package/dist/web/_app/immutable/chunks/Ck3rYNON.js +0 -1
- package/dist/web/_app/immutable/chunks/DMtIqaiV.js +0 -2
- package/dist/web/_app/immutable/chunks/DhD271EB.js +0 -1
- package/dist/web/_app/immutable/chunks/DpuLqk8d.js +0 -1
- package/dist/web/_app/immutable/chunks/DsIToJCP.js +0 -1
- package/dist/web/_app/immutable/chunks/bBmtyQMj.js +0 -1
- package/dist/web/_app/immutable/entry/app.CJmSwntr.js +0 -2
- package/dist/web/_app/immutable/entry/start.ZpUrT2ak.js +0 -1
- package/dist/web/_app/immutable/nodes/1.Bli0Hqzn.js +0 -1
- package/dist/web/_app/immutable/nodes/4.oBhvQhcA.js +0 -60
- package/dist/workspace-BJmJBfKi.mjs +0 -456
- package/dist/workspace-BJmJBfKi.mjs.map +0 -1
- package/src/cli/e2e/agents.test.ts +0 -140
- package/src/cli/e2e/basic.test.ts +0 -43
- package/src/cli/e2e/cron.test.ts +0 -132
- package/src/cli/e2e/export-lite-func.test.ts +0 -206
- package/src/cli/e2e/fallbacks.test.ts +0 -175
- package/src/cli/e2e/init.test.ts +0 -77
- package/src/cli/e2e/messages.test.ts +0 -332
- package/src/cli/e2e/propose-policy.test.ts +0 -203
- package/src/cli/e2e/requests.test.ts +0 -180
- package/src/cli/e2e/session-timeout.test.ts +0 -192
- package/src/cli/e2e/slash-new.test.ts +0 -93
- package/src/cli/e2e/subagents.test.ts +0 -106
- package/src/cli/e2e/utils.ts +0 -66
- package/src/cli/propose-policy.ts +0 -91
- package/web/.svelte-kit/output/client/_app/immutable/chunks/B6YN0Nuq.js +0 -1
- package/web/.svelte-kit/output/client/_app/immutable/chunks/BmRlVmv6.js +0 -1
- package/web/.svelte-kit/output/client/_app/immutable/chunks/CK9JZLaG.js +0 -2
- package/web/.svelte-kit/output/client/_app/immutable/chunks/Ck3rYNON.js +0 -1
- package/web/.svelte-kit/output/client/_app/immutable/chunks/DMtIqaiV.js +0 -2
- package/web/.svelte-kit/output/client/_app/immutable/chunks/DhD271EB.js +0 -1
- package/web/.svelte-kit/output/client/_app/immutable/chunks/DpuLqk8d.js +0 -1
- package/web/.svelte-kit/output/client/_app/immutable/chunks/DsIToJCP.js +0 -1
- package/web/.svelte-kit/output/client/_app/immutable/chunks/bBmtyQMj.js +0 -1
- package/web/.svelte-kit/output/client/_app/immutable/entry/app.CJmSwntr.js +0 -2
- package/web/.svelte-kit/output/client/_app/immutable/entry/start.ZpUrT2ak.js +0 -1
- package/web/.svelte-kit/output/client/_app/immutable/nodes/1.Bli0Hqzn.js +0 -1
- package/web/.svelte-kit/output/client/_app/immutable/nodes/4.oBhvQhcA.js +0 -60
- package/web/.svelte-kit/output/server/chunks/false.js +0 -4
- /package/dist/cli/{propose-policy.d.mts → manage-policies.d.mts} +0 -0
- /package/{src/cli/e2e → e2e/_helpers}/global-setup.ts +0 -0
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, beforeAll, afterAll } from 'vitest';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import fs from 'node:fs';
|
|
4
|
-
import { createE2EContext } from './utils.js';
|
|
5
|
-
|
|
6
|
-
const { runCli, e2eDir, setupE2E, teardownE2E } = createE2EContext('e2e-tmp-agents');
|
|
7
|
-
|
|
8
|
-
describe('E2E Agents Tests', () => {
|
|
9
|
-
beforeAll(async () => {
|
|
10
|
-
await setupE2E();
|
|
11
|
-
await runCli(['init']);
|
|
12
|
-
}, 30000);
|
|
13
|
-
|
|
14
|
-
afterAll(teardownE2E, 30000);
|
|
15
|
-
|
|
16
|
-
it('should create, list, update and delete agents', async () => {
|
|
17
|
-
const { stdout: stdoutAdd, code: codeAdd } = await runCli([
|
|
18
|
-
'agents',
|
|
19
|
-
'add',
|
|
20
|
-
'test-agent',
|
|
21
|
-
'--directory',
|
|
22
|
-
'./test-agent-dir',
|
|
23
|
-
'--env',
|
|
24
|
-
'FOO=BAR',
|
|
25
|
-
'--env',
|
|
26
|
-
'BAZ=QUX',
|
|
27
|
-
]);
|
|
28
|
-
expect(codeAdd).toBe(0);
|
|
29
|
-
expect(stdoutAdd).toContain('Agent test-agent created successfully.');
|
|
30
|
-
|
|
31
|
-
const chatSettingsPath = path.resolve(e2eDir, '.clawmini/chats/test-agent/settings.json');
|
|
32
|
-
expect(fs.existsSync(chatSettingsPath)).toBe(true);
|
|
33
|
-
const chatData = JSON.parse(fs.readFileSync(chatSettingsPath, 'utf8'));
|
|
34
|
-
expect(chatData.defaultAgent).toBe('test-agent');
|
|
35
|
-
|
|
36
|
-
const agentSettingsPath = path.resolve(e2eDir, '.clawmini/agents/test-agent/settings.json');
|
|
37
|
-
expect(fs.existsSync(agentSettingsPath)).toBe(true);
|
|
38
|
-
const agentData = JSON.parse(fs.readFileSync(agentSettingsPath, 'utf8'));
|
|
39
|
-
expect(agentData.directory).toBe('./test-agent-dir');
|
|
40
|
-
expect(agentData.env?.FOO).toBe('BAR');
|
|
41
|
-
expect(agentData.env?.BAZ).toBe('QUX');
|
|
42
|
-
|
|
43
|
-
const { stdout: stdoutList1 } = await runCli(['agents', 'list']);
|
|
44
|
-
expect(stdoutList1).toContain('- test-agent');
|
|
45
|
-
|
|
46
|
-
const { stdout: stdoutUpdate, code: codeUpdate } = await runCli([
|
|
47
|
-
'agents',
|
|
48
|
-
'update',
|
|
49
|
-
'test-agent',
|
|
50
|
-
'--directory',
|
|
51
|
-
'./new-dir',
|
|
52
|
-
'--env',
|
|
53
|
-
'FOO=NEW_BAR',
|
|
54
|
-
]);
|
|
55
|
-
expect(codeUpdate).toBe(0);
|
|
56
|
-
expect(stdoutUpdate).toContain('Agent test-agent updated successfully.');
|
|
57
|
-
|
|
58
|
-
const updatedAgentData = JSON.parse(fs.readFileSync(agentSettingsPath, 'utf8'));
|
|
59
|
-
expect(updatedAgentData.directory).toBe('./new-dir');
|
|
60
|
-
expect(updatedAgentData.env?.FOO).toBe('NEW_BAR');
|
|
61
|
-
expect(updatedAgentData.env?.BAZ).toBe('QUX');
|
|
62
|
-
|
|
63
|
-
const { stdout: stdoutDelete, code: codeDelete } = await runCli([
|
|
64
|
-
'agents',
|
|
65
|
-
'delete',
|
|
66
|
-
'test-agent',
|
|
67
|
-
]);
|
|
68
|
-
expect(codeDelete).toBe(0);
|
|
69
|
-
expect(stdoutDelete).toContain('Agent test-agent deleted successfully.');
|
|
70
|
-
expect(fs.existsSync(agentSettingsPath)).toBe(false);
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
it('should output a warning if chat already exists when adding an agent', async () => {
|
|
74
|
-
// First, manually create a chat directory
|
|
75
|
-
const chatDir = path.resolve(e2eDir, '.clawmini/chats/existing-chat');
|
|
76
|
-
fs.mkdirSync(chatDir, { recursive: true });
|
|
77
|
-
|
|
78
|
-
const { stdout, stderr, code } = await runCli(['agents', 'add', 'existing-chat']);
|
|
79
|
-
|
|
80
|
-
expect(code).toBe(0);
|
|
81
|
-
expect(stderr).toContain('Warning: Chat existing-chat already exists.');
|
|
82
|
-
expect(stdout).toContain('Agent existing-chat created successfully.');
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
it('should create an agent using a template and merge settings correctly', async () => {
|
|
86
|
-
// Create a local template
|
|
87
|
-
const templateDir = path.resolve(e2eDir, '.clawmini/templates/test-template');
|
|
88
|
-
fs.mkdirSync(templateDir, { recursive: true });
|
|
89
|
-
|
|
90
|
-
// Create some template files
|
|
91
|
-
fs.writeFileSync(path.join(templateDir, 'hello.txt'), 'Hello Template!');
|
|
92
|
-
|
|
93
|
-
// Create a settings.json that should be merged/overridden
|
|
94
|
-
const templateSettings = {
|
|
95
|
-
directory: './should-be-ignored',
|
|
96
|
-
env: {
|
|
97
|
-
TEMPLATE_VAR: 'template_value',
|
|
98
|
-
FOO: 'WILL_BE_OVERRIDDEN',
|
|
99
|
-
},
|
|
100
|
-
};
|
|
101
|
-
fs.writeFileSync(path.join(templateDir, 'settings.json'), JSON.stringify(templateSettings));
|
|
102
|
-
|
|
103
|
-
const { stdout, stderr, code } = await runCli([
|
|
104
|
-
'agents',
|
|
105
|
-
'add',
|
|
106
|
-
'test-template-agent',
|
|
107
|
-
'--template',
|
|
108
|
-
'test-template',
|
|
109
|
-
'--directory',
|
|
110
|
-
'./custom-agent-dir',
|
|
111
|
-
'--env',
|
|
112
|
-
'FOO=BAR',
|
|
113
|
-
]);
|
|
114
|
-
|
|
115
|
-
expect(code).toBe(0);
|
|
116
|
-
expect(stderr).toContain("Warning: Ignoring 'directory' field from template settings.json");
|
|
117
|
-
expect(stdout).toContain('Agent test-template-agent created successfully.');
|
|
118
|
-
const agentSettingsPath = path.resolve(
|
|
119
|
-
e2eDir,
|
|
120
|
-
'.clawmini/agents/test-template-agent/settings.json'
|
|
121
|
-
);
|
|
122
|
-
expect(fs.existsSync(agentSettingsPath)).toBe(true);
|
|
123
|
-
|
|
124
|
-
const agentData = JSON.parse(fs.readFileSync(agentSettingsPath, 'utf8'));
|
|
125
|
-
|
|
126
|
-
// Verify directory override
|
|
127
|
-
expect(agentData.directory).toBe('./custom-agent-dir');
|
|
128
|
-
|
|
129
|
-
// Verify env merge
|
|
130
|
-
expect(agentData.env?.TEMPLATE_VAR).toBe('template_value');
|
|
131
|
-
expect(agentData.env?.FOO).toBe('BAR');
|
|
132
|
-
|
|
133
|
-
// Verify template files were copied
|
|
134
|
-
const customDir = path.resolve(e2eDir, 'custom-agent-dir');
|
|
135
|
-
expect(fs.existsSync(path.join(customDir, 'hello.txt'))).toBe(true);
|
|
136
|
-
|
|
137
|
-
// Verify settings.json was deleted from the agent working dir
|
|
138
|
-
expect(fs.existsSync(path.join(customDir, 'settings.json'))).toBe(false);
|
|
139
|
-
});
|
|
140
|
-
});
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, beforeAll, afterAll } from 'vitest';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import fs from 'node:fs';
|
|
4
|
-
import { createE2EContext } from './utils.js';
|
|
5
|
-
|
|
6
|
-
const { runCli, e2eDir, setupE2E, teardownE2E } = createE2EContext('e2e-tmp-basic');
|
|
7
|
-
|
|
8
|
-
describe('E2E Basic Tests', () => {
|
|
9
|
-
beforeAll(setupE2E, 30000);
|
|
10
|
-
afterAll(teardownE2E, 30000);
|
|
11
|
-
|
|
12
|
-
it('should run init and initialize settings', async () => {
|
|
13
|
-
const { stdout, code } = await runCli(['init']);
|
|
14
|
-
|
|
15
|
-
expect(code).toBe(0);
|
|
16
|
-
expect(stdout).toContain('Initialized .clawmini/settings.json');
|
|
17
|
-
|
|
18
|
-
const clawminiDir = path.resolve(e2eDir, '.clawmini');
|
|
19
|
-
expect(fs.existsSync(path.join(clawminiDir, 'settings.json'))).toBe(true);
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('should create, list, set-default and delete chats', async () => {
|
|
23
|
-
const { stdout: stdoutAdd, code: codeAdd } = await runCli(['chats', 'add', 'test-chat']);
|
|
24
|
-
expect(codeAdd).toBe(0);
|
|
25
|
-
expect(stdoutAdd).toContain('Chat test-chat created successfully.');
|
|
26
|
-
|
|
27
|
-
const chatsDir = path.resolve(e2eDir, '.clawmini/chats');
|
|
28
|
-
expect(fs.existsSync(path.join(chatsDir, 'test-chat', 'chat.jsonl'))).toBe(true);
|
|
29
|
-
|
|
30
|
-
const { stdout: stdoutList1 } = await runCli(['chats', 'list']);
|
|
31
|
-
expect(stdoutList1).toContain('- test-chat');
|
|
32
|
-
|
|
33
|
-
const { stdout: stdoutSetDefault } = await runCli(['chats', 'set-default', 'test-chat']);
|
|
34
|
-
expect(stdoutSetDefault).toContain('Default chat set to test-chat.');
|
|
35
|
-
|
|
36
|
-
const { stdout: stdoutList2 } = await runCli(['chats', 'list']);
|
|
37
|
-
expect(stdoutList2).toContain('- test-chat *');
|
|
38
|
-
|
|
39
|
-
const { stdout: stdoutDelete } = await runCli(['chats', 'delete', 'test-chat']);
|
|
40
|
-
expect(stdoutDelete).toContain('Chat test-chat deleted successfully.');
|
|
41
|
-
expect(fs.existsSync(path.join(chatsDir, 'test-chat'))).toBe(false);
|
|
42
|
-
}, 15000);
|
|
43
|
-
});
|
package/src/cli/e2e/cron.test.ts
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, beforeAll, afterAll } from 'vitest';
|
|
2
|
-
import { createE2EContext } from './utils.js';
|
|
3
|
-
|
|
4
|
-
const { runCli, e2eDir, setupE2E, teardownE2E } = createE2EContext('e2e-tmp-cron');
|
|
5
|
-
|
|
6
|
-
describe('E2E Cron Tests', () => {
|
|
7
|
-
beforeAll(async () => {
|
|
8
|
-
await setupE2E();
|
|
9
|
-
await runCli(['init']);
|
|
10
|
-
}, 30000);
|
|
11
|
-
|
|
12
|
-
afterAll(async () => {
|
|
13
|
-
await teardownE2E();
|
|
14
|
-
}, 30000);
|
|
15
|
-
|
|
16
|
-
it('should add, list, and delete jobs', async () => {
|
|
17
|
-
// 1. Add a job
|
|
18
|
-
const { stdout: stdoutAdd, code: codeAdd } = await runCli([
|
|
19
|
-
'jobs',
|
|
20
|
-
'add',
|
|
21
|
-
'test-job-1',
|
|
22
|
-
'--message',
|
|
23
|
-
'hello world',
|
|
24
|
-
'--every',
|
|
25
|
-
'10m',
|
|
26
|
-
'--agent',
|
|
27
|
-
'my-agent',
|
|
28
|
-
'--env',
|
|
29
|
-
'FOO=BAR',
|
|
30
|
-
'--session',
|
|
31
|
-
'new',
|
|
32
|
-
]);
|
|
33
|
-
expect(codeAdd).toBe(0);
|
|
34
|
-
expect(stdoutAdd).toContain("Job 'test-job-1' created successfully.");
|
|
35
|
-
|
|
36
|
-
// 2. List jobs
|
|
37
|
-
const { stdout: stdoutList1, code: codeList1 } = await runCli(['jobs', 'list']);
|
|
38
|
-
expect(codeList1).toBe(0);
|
|
39
|
-
expect(stdoutList1).toContain('- test-job-1 (every: 10m)');
|
|
40
|
-
|
|
41
|
-
// 3. Add a second job using cron expression
|
|
42
|
-
const { stdout: stdoutAdd2, code: codeAdd2 } = await runCli([
|
|
43
|
-
'jobs',
|
|
44
|
-
'add',
|
|
45
|
-
'test-job-2',
|
|
46
|
-
'--cron',
|
|
47
|
-
'* * * * *',
|
|
48
|
-
]);
|
|
49
|
-
expect(codeAdd2).toBe(0);
|
|
50
|
-
expect(stdoutAdd2).toContain("Job 'test-job-2' created successfully.");
|
|
51
|
-
|
|
52
|
-
const { stdout: stdoutList2 } = await runCli(['jobs', 'list']);
|
|
53
|
-
expect(stdoutList2).toContain('- test-job-1 (every: 10m)');
|
|
54
|
-
expect(stdoutList2).toContain('- test-job-2 (cron: * * * * *)');
|
|
55
|
-
|
|
56
|
-
// 4. Delete the first job
|
|
57
|
-
const { stdout: stdoutDelete, code: codeDelete } = await runCli([
|
|
58
|
-
'jobs',
|
|
59
|
-
'delete',
|
|
60
|
-
'test-job-1',
|
|
61
|
-
]);
|
|
62
|
-
expect(codeDelete).toBe(0);
|
|
63
|
-
expect(stdoutDelete).toContain("Job 'test-job-1' deleted successfully.");
|
|
64
|
-
|
|
65
|
-
const { stdout: stdoutList3 } = await runCli(['jobs', 'list']);
|
|
66
|
-
expect(stdoutList3).not.toContain('test-job-1');
|
|
67
|
-
expect(stdoutList3).toContain('- test-job-2 (cron: * * * * *)');
|
|
68
|
-
}, 15000);
|
|
69
|
-
|
|
70
|
-
it('should execute a job and inherit chat default agent and session', async () => {
|
|
71
|
-
// 1. Create a specific agent for this chat
|
|
72
|
-
await runCli(['agents', 'add', 'cron-exec-agent']);
|
|
73
|
-
const fs = await import('node:fs');
|
|
74
|
-
const path = await import('node:path');
|
|
75
|
-
const agentPath = path.resolve(e2eDir, '.clawmini/agents/cron-exec-agent/settings.json');
|
|
76
|
-
const agentData = JSON.parse(fs.readFileSync(agentPath, 'utf8'));
|
|
77
|
-
agentData.commands = { new: 'echo "executed with $SESSION_ID and msg: $CLAW_CLI_MESSAGE"' };
|
|
78
|
-
fs.writeFileSync(agentPath, JSON.stringify(agentData));
|
|
79
|
-
|
|
80
|
-
// 2. Setup the chat with this agent and get a session ID
|
|
81
|
-
await runCli(['chats', 'add', 'cron-chat']);
|
|
82
|
-
const { code: codeSetup, stderr: stderrSetup } = await runCli([
|
|
83
|
-
'messages',
|
|
84
|
-
'send',
|
|
85
|
-
'setup session',
|
|
86
|
-
'-c',
|
|
87
|
-
'cron-chat',
|
|
88
|
-
'-a',
|
|
89
|
-
'cron-exec-agent',
|
|
90
|
-
]);
|
|
91
|
-
if (codeSetup !== 0) console.error(stderrSetup);
|
|
92
|
-
expect(codeSetup).toBe(0);
|
|
93
|
-
|
|
94
|
-
// 3. Schedule a job for 2 seconds in the future
|
|
95
|
-
const futureTime = new Date(Date.now() + 2000).toISOString();
|
|
96
|
-
const { stdout: stdoutAdd, code: codeAdd } = await runCli([
|
|
97
|
-
'jobs',
|
|
98
|
-
'add',
|
|
99
|
-
'test-exec-job',
|
|
100
|
-
'-c',
|
|
101
|
-
'cron-chat',
|
|
102
|
-
'--at',
|
|
103
|
-
futureTime,
|
|
104
|
-
'--message',
|
|
105
|
-
'hello from future',
|
|
106
|
-
]);
|
|
107
|
-
expect(codeAdd).toBe(0);
|
|
108
|
-
expect(stdoutAdd).toContain("Job 'test-exec-job' created successfully.");
|
|
109
|
-
|
|
110
|
-
// 4. Wait for job to execute (approx 3 seconds)
|
|
111
|
-
await new Promise((resolve) => setTimeout(resolve, 3000));
|
|
112
|
-
|
|
113
|
-
// 5. Check if the message was sent and properly inherited the agent and session
|
|
114
|
-
|
|
115
|
-
// Fallback if e2e test uses a different dir, get it from the e2eDir context
|
|
116
|
-
// Actually createE2EContext returns e2eDir, but it's not exported from the setup block directly if not destructured.
|
|
117
|
-
// wait, I can just use `runCli(['messages', 'tail', '-c', 'cron-chat', '--json'])`
|
|
118
|
-
const { stdout: stdoutHistory } = await runCli(['messages', 'tail', '-c', 'cron-chat']);
|
|
119
|
-
|
|
120
|
-
// It should have executed the cron job
|
|
121
|
-
expect(stdoutHistory).toContain('hello from future');
|
|
122
|
-
// It should have used cron-exec-agent, not default
|
|
123
|
-
expect(stdoutHistory).toContain('msg: hello from future');
|
|
124
|
-
// Session ID should not be empty or undefined, it should have been set by the previous message
|
|
125
|
-
}, 10000);
|
|
126
|
-
|
|
127
|
-
it('should reject jobs with invalid --at date format', async () => {
|
|
128
|
-
const { stderr, code } = await runCli(['jobs', 'add', 'invalid-job', '--at', 'invalid-date']);
|
|
129
|
-
expect(code).not.toBe(0);
|
|
130
|
-
expect(stderr).toContain("Invalid date format for 'at' schedule: invalid-date");
|
|
131
|
-
});
|
|
132
|
-
});
|
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, beforeAll, afterAll } from 'vitest';
|
|
2
|
-
import { spawn } from 'node:child_process';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
import fs from 'node:fs';
|
|
5
|
-
import { createE2EContext } from './utils.js';
|
|
6
|
-
|
|
7
|
-
const { runCli, e2eDir, setupE2E, teardownE2E } = createE2EContext('e2e-exp-lite');
|
|
8
|
-
|
|
9
|
-
describe('E2E Export Lite Functionality Tests', () => {
|
|
10
|
-
beforeAll(async () => {
|
|
11
|
-
await setupE2E();
|
|
12
|
-
await runCli(['init']);
|
|
13
|
-
}, 30000);
|
|
14
|
-
|
|
15
|
-
afterAll(teardownE2E, 30000);
|
|
16
|
-
|
|
17
|
-
it('should run exported clawmini-lite script and verify its functionality', async () => {
|
|
18
|
-
await runCli(['down']);
|
|
19
|
-
const settingsPath = path.resolve(e2eDir, '.clawmini/settings.json');
|
|
20
|
-
let originalSettings = '{}';
|
|
21
|
-
if (fs.existsSync(settingsPath)) {
|
|
22
|
-
originalSettings = fs.readFileSync(settingsPath, 'utf8');
|
|
23
|
-
}
|
|
24
|
-
fs.writeFileSync(
|
|
25
|
-
settingsPath,
|
|
26
|
-
JSON.stringify({
|
|
27
|
-
...JSON.parse(originalSettings),
|
|
28
|
-
api: { host: '127.0.0.1', port: 3007 },
|
|
29
|
-
})
|
|
30
|
-
);
|
|
31
|
-
await runCli(['up']);
|
|
32
|
-
|
|
33
|
-
// Export lite script
|
|
34
|
-
const litePath = path.resolve(e2eDir, 'clawmini-lite.js');
|
|
35
|
-
await runCli(['export-lite', '--out', litePath]);
|
|
36
|
-
expect(fs.existsSync(litePath)).toBe(true);
|
|
37
|
-
|
|
38
|
-
const envDumperAgentDir = path.resolve(e2eDir, 'lite-env-dumper');
|
|
39
|
-
fs.mkdirSync(envDumperAgentDir, { recursive: true });
|
|
40
|
-
await runCli(['agents', 'add', 'lite-env-dumper', '--dir', 'lite-env-dumper']);
|
|
41
|
-
|
|
42
|
-
const dumperSettings = path.resolve(e2eDir, '.clawmini/agents/lite-env-dumper/settings.json');
|
|
43
|
-
fs.mkdirSync(path.dirname(dumperSettings), { recursive: true });
|
|
44
|
-
|
|
45
|
-
const dumperScript = process.platform === 'win32' ? 'set > env.txt' : 'env > env.txt';
|
|
46
|
-
fs.writeFileSync(dumperSettings, JSON.stringify({ commands: { new: dumperScript } }));
|
|
47
|
-
|
|
48
|
-
await runCli(['chats', 'add', 'lite-chat']);
|
|
49
|
-
await runCli(['messages', 'send', 'dump', '--chat', 'lite-chat', '--agent', 'lite-env-dumper']);
|
|
50
|
-
|
|
51
|
-
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
52
|
-
|
|
53
|
-
const envTxtPath = path.resolve(envDumperAgentDir, 'env.txt');
|
|
54
|
-
expect(fs.existsSync(envTxtPath)).toBe(true);
|
|
55
|
-
const envContent = fs.readFileSync(envTxtPath, 'utf8');
|
|
56
|
-
|
|
57
|
-
const urlMatch = envContent.match(/CLAW_API_URL=(.+)/);
|
|
58
|
-
const tokenMatch = envContent.match(/CLAW_API_TOKEN=(.+)/);
|
|
59
|
-
|
|
60
|
-
expect(urlMatch).toBeTruthy();
|
|
61
|
-
expect(tokenMatch).toBeTruthy();
|
|
62
|
-
|
|
63
|
-
if (!urlMatch || !tokenMatch) {
|
|
64
|
-
throw new Error('Could not find API credentials');
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const envUrl = urlMatch[1]!.trim();
|
|
68
|
-
const envToken = tokenMatch[1]!.trim();
|
|
69
|
-
const chatLogPath = path.resolve(e2eDir, '.clawmini/chats/lite-chat/chat.jsonl');
|
|
70
|
-
|
|
71
|
-
// 1. Test reply with file
|
|
72
|
-
const replyFileProcess = spawn(
|
|
73
|
-
'node',
|
|
74
|
-
[litePath, 'reply', 'hello with file', '--file', 'env.txt'],
|
|
75
|
-
{
|
|
76
|
-
env: { ...process.env, CLAW_API_URL: envUrl, CLAW_API_TOKEN: envToken },
|
|
77
|
-
cwd: envDumperAgentDir,
|
|
78
|
-
}
|
|
79
|
-
);
|
|
80
|
-
|
|
81
|
-
let replyFileStdout = '';
|
|
82
|
-
replyFileProcess.stdout.on('data', (d) => (replyFileStdout += d.toString()));
|
|
83
|
-
replyFileProcess.stderr.on('data', (d) => (replyFileStdout += d.toString()));
|
|
84
|
-
await new Promise((resolve) => replyFileProcess.on('close', resolve));
|
|
85
|
-
expect(replyFileStdout).toContain('Reply message appended');
|
|
86
|
-
|
|
87
|
-
const chatLogContentUpdated = fs.readFileSync(chatLogPath, 'utf8');
|
|
88
|
-
expect(chatLogContentUpdated).toContain('hello with file');
|
|
89
|
-
expect(chatLogContentUpdated).toContain('"files":["lite-env-dumper/env.txt"]');
|
|
90
|
-
|
|
91
|
-
// 1.6 Test reply
|
|
92
|
-
const replyProcess = spawn('node', [litePath, 'reply', 'hello reply'], {
|
|
93
|
-
env: { ...process.env, CLAW_API_URL: envUrl, CLAW_API_TOKEN: envToken },
|
|
94
|
-
});
|
|
95
|
-
let replyStdout = '';
|
|
96
|
-
replyProcess.stdout.on('data', (d) => (replyStdout += d.toString()));
|
|
97
|
-
replyProcess.stderr.on('data', (d) => (replyStdout += d.toString()));
|
|
98
|
-
await new Promise((resolve) => replyProcess.on('close', resolve));
|
|
99
|
-
expect(replyStdout).toContain('Reply message appended');
|
|
100
|
-
|
|
101
|
-
const chatLogContentReply = fs.readFileSync(chatLogPath, 'utf8');
|
|
102
|
-
expect(chatLogContentReply).toContain('hello reply');
|
|
103
|
-
expect(chatLogContentReply).toContain('"role":"agent"');
|
|
104
|
-
|
|
105
|
-
// 1.7 Test tool
|
|
106
|
-
const toolProcess = spawn(
|
|
107
|
-
'node',
|
|
108
|
-
[litePath, 'tool', 'mytool', JSON.stringify({ key: 'value' })],
|
|
109
|
-
{
|
|
110
|
-
env: { ...process.env, CLAW_API_URL: envUrl, CLAW_API_TOKEN: envToken },
|
|
111
|
-
}
|
|
112
|
-
);
|
|
113
|
-
let toolStdout = '';
|
|
114
|
-
toolProcess.stdout.on('data', (d) => (toolStdout += d.toString()));
|
|
115
|
-
toolProcess.stderr.on('data', (d) => (toolStdout += d.toString()));
|
|
116
|
-
await new Promise((resolve) => toolProcess.on('close', resolve));
|
|
117
|
-
expect(toolStdout).toContain('Tool message appended');
|
|
118
|
-
|
|
119
|
-
const chatLogContentTool = fs.readFileSync(chatLogPath, 'utf8');
|
|
120
|
-
expect(chatLogContentTool).toContain('"name":"mytool"');
|
|
121
|
-
expect(chatLogContentTool).toContain('"role":"tool"');
|
|
122
|
-
expect(chatLogContentTool).toContain('"payload":{"key":"value"}');
|
|
123
|
-
|
|
124
|
-
// 2. Test jobs add
|
|
125
|
-
const addProcess = spawn(
|
|
126
|
-
'node',
|
|
127
|
-
[litePath, 'jobs', 'add', 'lite-job', '--cron', '* * * * *', '--message', 'lite message'],
|
|
128
|
-
{
|
|
129
|
-
env: { ...process.env, CLAW_API_URL: envUrl, CLAW_API_TOKEN: envToken },
|
|
130
|
-
}
|
|
131
|
-
);
|
|
132
|
-
let addStdout = '';
|
|
133
|
-
addProcess.stdout.on('data', (d) => (addStdout += d.toString()));
|
|
134
|
-
addProcess.stderr.on('data', (d) => (addStdout += d.toString()));
|
|
135
|
-
await new Promise((resolve) => addProcess.on('close', resolve));
|
|
136
|
-
expect(addStdout).toContain("Job 'lite-job' created successfully.");
|
|
137
|
-
|
|
138
|
-
// 3. Test jobs list
|
|
139
|
-
const listProcess = spawn('node', [litePath, 'jobs', 'list'], {
|
|
140
|
-
env: { ...process.env, CLAW_API_URL: envUrl, CLAW_API_TOKEN: envToken },
|
|
141
|
-
});
|
|
142
|
-
let listStdout = '';
|
|
143
|
-
listProcess.stdout.on('data', (d) => (listStdout += d.toString()));
|
|
144
|
-
listProcess.stderr.on('data', (d) => (listStdout += d.toString()));
|
|
145
|
-
await new Promise((resolve) => listProcess.on('close', resolve));
|
|
146
|
-
expect(listStdout).toContain('lite-job');
|
|
147
|
-
expect(listStdout).toContain('* * * * *');
|
|
148
|
-
|
|
149
|
-
// 4. Test jobs delete
|
|
150
|
-
const delProcess = spawn('node', [litePath, 'jobs', 'delete', 'lite-job'], {
|
|
151
|
-
env: { ...process.env, CLAW_API_URL: envUrl, CLAW_API_TOKEN: envToken },
|
|
152
|
-
});
|
|
153
|
-
let delStdout = '';
|
|
154
|
-
delProcess.stdout.on('data', (d) => (delStdout += d.toString()));
|
|
155
|
-
delProcess.stderr.on('data', (d) => (delStdout += d.toString()));
|
|
156
|
-
await new Promise((resolve) => delProcess.on('close', resolve));
|
|
157
|
-
expect(delStdout).toContain("Job 'lite-job' deleted successfully.");
|
|
158
|
-
|
|
159
|
-
// 5. Test fetch-pending
|
|
160
|
-
const sleepCommand =
|
|
161
|
-
process.platform === 'win32' ? 'node -e "setTimeout(() => {}, 5000)"' : 'sleep 5';
|
|
162
|
-
fs.writeFileSync(dumperSettings, JSON.stringify({ commands: { new: sleepCommand } }));
|
|
163
|
-
|
|
164
|
-
await runCli(['chats', 'add', 'sleep-chat']);
|
|
165
|
-
// Start the agent to block the queue
|
|
166
|
-
await runCli([
|
|
167
|
-
'messages',
|
|
168
|
-
'send',
|
|
169
|
-
'block queue',
|
|
170
|
-
'--chat',
|
|
171
|
-
'sleep-chat',
|
|
172
|
-
'--agent',
|
|
173
|
-
'lite-env-dumper',
|
|
174
|
-
'--no-wait',
|
|
175
|
-
]);
|
|
176
|
-
|
|
177
|
-
// Send a pending message that will be queued
|
|
178
|
-
await runCli([
|
|
179
|
-
'messages',
|
|
180
|
-
'send',
|
|
181
|
-
'my pending message',
|
|
182
|
-
'--chat',
|
|
183
|
-
'sleep-chat',
|
|
184
|
-
'--agent',
|
|
185
|
-
'lite-env-dumper',
|
|
186
|
-
'--no-wait',
|
|
187
|
-
]);
|
|
188
|
-
|
|
189
|
-
// Fetch the pending message
|
|
190
|
-
const fetchProcess = spawn('node', [litePath, 'fetch-pending'], {
|
|
191
|
-
env: { ...process.env, CLAW_API_URL: envUrl, CLAW_API_TOKEN: envToken },
|
|
192
|
-
});
|
|
193
|
-
let fetchStdout = '';
|
|
194
|
-
fetchProcess.stdout.on('data', (d) => (fetchStdout += d.toString()));
|
|
195
|
-
fetchProcess.stderr.on('data', (d) => (fetchStdout += d.toString()));
|
|
196
|
-
await new Promise((resolve) => fetchProcess.on('close', resolve));
|
|
197
|
-
|
|
198
|
-
expect(fetchStdout).toContain('<message>');
|
|
199
|
-
expect(fetchStdout).toContain('my pending message');
|
|
200
|
-
expect(fetchStdout).toContain('</message>');
|
|
201
|
-
|
|
202
|
-
await runCli(['down']);
|
|
203
|
-
fs.writeFileSync(settingsPath, originalSettings);
|
|
204
|
-
await runCli(['up']);
|
|
205
|
-
}, 30000);
|
|
206
|
-
});
|