@jcheesepkg/nanobot 0.9.1 → 0.9.2
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/README.md +18 -18
- package/dist/agent/context.d.mts +4 -4
- package/dist/agent/context.d.mts.map +1 -1
- package/dist/agent/context.mjs +27 -28
- package/dist/agent/context.mjs.map +1 -1
- package/dist/agent/loop.d.mts +5 -3
- package/dist/agent/loop.d.mts.map +1 -1
- package/dist/agent/loop.mjs +64 -55
- package/dist/agent/loop.mjs.map +1 -1
- package/dist/agent/memory.d.mts.map +1 -1
- package/dist/agent/memory.mjs +3 -3
- package/dist/agent/memory.mjs.map +1 -1
- package/dist/agent/skills.d.mts.map +1 -1
- package/dist/agent/skills.mjs +4 -4
- package/dist/agent/skills.mjs.map +1 -1
- package/dist/agent/subagent.d.mts.map +1 -1
- package/dist/agent/subagent.mjs +22 -22
- package/dist/agent/subagent.mjs.map +1 -1
- package/dist/agent/tools/base.mjs +2 -2
- package/dist/agent/tools/base.mjs.map +1 -1
- package/dist/agent/tools/cron.d.mts +1 -1
- package/dist/agent/tools/cron.d.mts.map +1 -1
- package/dist/agent/tools/cron.mjs +11 -11
- package/dist/agent/tools/cron.mjs.map +1 -1
- package/dist/agent/tools/filesystem.d.mts +4 -4
- package/dist/agent/tools/filesystem.d.mts.map +1 -1
- package/dist/agent/tools/filesystem.mjs +20 -20
- package/dist/agent/tools/filesystem.mjs.map +1 -1
- package/dist/agent/tools/flex.d.mts +1 -1
- package/dist/agent/tools/flex.d.mts.map +1 -1
- package/dist/agent/tools/flex.mjs +112 -112
- package/dist/agent/tools/flex.mjs.map +1 -1
- package/dist/agent/tools/flex.test.mjs +60 -59
- package/dist/agent/tools/flex.test.mjs.map +1 -1
- package/dist/agent/tools/message.d.mts +1 -1
- package/dist/agent/tools/message.d.mts.map +1 -1
- package/dist/agent/tools/message.mjs +4 -4
- package/dist/agent/tools/message.mjs.map +1 -1
- package/dist/agent/tools/registry.d.mts.map +1 -1
- package/dist/agent/tools/registry.mjs +4 -4
- package/dist/agent/tools/registry.mjs.map +1 -1
- package/dist/agent/tools/shell.d.mts +1 -1
- package/dist/agent/tools/shell.mjs +4 -4
- package/dist/agent/tools/shell.mjs.map +1 -1
- package/dist/agent/tools/spawn.d.mts +1 -1
- package/dist/agent/tools/spawn.d.mts.map +1 -1
- package/dist/agent/tools/spawn.mjs +4 -4
- package/dist/agent/tools/spawn.mjs.map +1 -1
- package/dist/agent/tools/web.d.mts +2 -2
- package/dist/agent/tools/web.d.mts.map +1 -1
- package/dist/agent/tools/web.mjs +36 -36
- package/dist/agent/tools/web.mjs.map +1 -1
- package/dist/bus/events.mjs +1 -1
- package/dist/bus/events.mjs.map +1 -1
- package/dist/bus/queue.d.mts.map +1 -1
- package/dist/bus/queue.mjs.map +1 -1
- package/dist/channels/base.d.mts.map +1 -1
- package/dist/channels/base.mjs +2 -2
- package/dist/channels/base.mjs.map +1 -1
- package/dist/channels/line.d.mts +1 -0
- package/dist/channels/line.d.mts.map +1 -1
- package/dist/channels/line.mjs +65 -65
- package/dist/channels/line.mjs.map +1 -1
- package/dist/channels/line.test.mjs +26 -27
- package/dist/channels/line.test.mjs.map +1 -1
- package/dist/channels/manager.d.mts.map +1 -1
- package/dist/channels/manager.mjs +9 -9
- package/dist/channels/manager.mjs.map +1 -1
- package/dist/channels/telegram.mjs +34 -34
- package/dist/channels/telegram.mjs.map +1 -1
- package/dist/cli/index.mjs +36 -36
- package/dist/cli/index.mjs.map +1 -1
- package/dist/config/loader.d.mts.map +1 -1
- package/dist/config/loader.mjs +1 -1
- package/dist/config/loader.mjs.map +1 -1
- package/dist/config/schema.d.mts +387 -387
- package/dist/config/schema.d.mts.map +1 -1
- package/dist/config/schema.mjs +42 -42
- package/dist/config/schema.mjs.map +1 -1
- package/dist/gateway/server.d.mts.map +1 -1
- package/dist/gateway/server.mjs +48 -54
- package/dist/gateway/server.mjs.map +1 -1
- package/dist/heartbeat/service.d.mts.map +1 -1
- package/dist/heartbeat/service.mjs +8 -8
- package/dist/heartbeat/service.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/dist/node_modules/{@jridgewell → .bun/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell}/sourcemap-codec/dist/sourcemap-codec.mjs +1 -1
- package/dist/node_modules/.bun/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map +1 -0
- package/dist/node_modules/{@vitest → .bun/@vitest_expect@2.1.9/node_modules/@vitest}/expect/dist/index.mjs +8 -8
- package/dist/node_modules/.bun/@vitest_expect@2.1.9/node_modules/@vitest/expect/dist/index.mjs.map +1 -0
- package/dist/node_modules/{@vitest → .bun/@vitest_pretty-format@2.1.9/node_modules/@vitest}/pretty-format/dist/index.mjs +2 -2
- package/dist/node_modules/.bun/@vitest_pretty-format@2.1.9/node_modules/@vitest/pretty-format/dist/index.mjs.map +1 -0
- package/dist/node_modules/{@vitest → .bun/@vitest_runner@2.1.9/node_modules/@vitest}/runner/dist/chunk-tasks.mjs +1 -1
- package/dist/node_modules/.bun/@vitest_runner@2.1.9/node_modules/@vitest/runner/dist/chunk-tasks.mjs.map +1 -0
- package/dist/node_modules/{@vitest → .bun/@vitest_runner@2.1.9/node_modules/@vitest}/runner/dist/index.mjs +6 -6
- package/dist/node_modules/.bun/@vitest_runner@2.1.9/node_modules/@vitest/runner/dist/index.mjs.map +1 -0
- package/dist/node_modules/{@vitest → .bun/@vitest_snapshot@2.1.9/node_modules/@vitest}/snapshot/dist/index.mjs +5 -5
- package/dist/node_modules/.bun/@vitest_snapshot@2.1.9/node_modules/@vitest/snapshot/dist/index.mjs.map +1 -0
- package/dist/node_modules/{@vitest → .bun/@vitest_spy@2.1.9/node_modules/@vitest}/spy/dist/index.mjs +2 -2
- package/dist/node_modules/.bun/@vitest_spy@2.1.9/node_modules/@vitest/spy/dist/index.mjs.map +1 -0
- package/dist/node_modules/{@vitest → .bun/@vitest_utils@2.1.9/node_modules/@vitest}/utils/dist/chunk-_commonjsHelpers.mjs +3 -3
- package/dist/node_modules/.bun/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.mjs.map +1 -0
- package/dist/node_modules/{@vitest → .bun/@vitest_utils@2.1.9/node_modules/@vitest}/utils/dist/diff.mjs +4 -4
- package/dist/node_modules/.bun/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/diff.mjs.map +1 -0
- package/dist/node_modules/{@vitest → .bun/@vitest_utils@2.1.9/node_modules/@vitest}/utils/dist/error.mjs +3 -3
- package/dist/node_modules/.bun/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/error.mjs.map +1 -0
- package/dist/node_modules/{@vitest → .bun/@vitest_utils@2.1.9/node_modules/@vitest}/utils/dist/helpers.mjs +1 -1
- package/dist/node_modules/.bun/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/helpers.mjs.map +1 -0
- package/dist/node_modules/{@vitest → .bun/@vitest_utils@2.1.9/node_modules/@vitest}/utils/dist/index.mjs +3 -3
- package/dist/node_modules/.bun/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/index.mjs.map +1 -0
- package/dist/node_modules/{@vitest → .bun/@vitest_utils@2.1.9/node_modules/@vitest}/utils/dist/source-map.mjs +1 -1
- package/dist/node_modules/.bun/@vitest_utils@2.1.9/node_modules/@vitest/utils/dist/source-map.mjs.map +1 -0
- package/dist/node_modules/{chai → .bun/chai@5.3.3/node_modules/chai}/index.mjs +1 -1
- package/dist/node_modules/.bun/chai@5.3.3/node_modules/chai/index.mjs.map +1 -0
- package/dist/node_modules/{loupe → .bun/loupe@3.2.1/node_modules/loupe}/lib/arguments.mjs +1 -1
- package/dist/node_modules/.bun/loupe@3.2.1/node_modules/loupe/lib/arguments.mjs.map +1 -0
- package/dist/node_modules/{loupe → .bun/loupe@3.2.1/node_modules/loupe}/lib/array.mjs +1 -1
- package/dist/node_modules/.bun/loupe@3.2.1/node_modules/loupe/lib/array.mjs.map +1 -0
- package/dist/node_modules/{loupe → .bun/loupe@3.2.1/node_modules/loupe}/lib/bigint.mjs +1 -1
- package/dist/node_modules/.bun/loupe@3.2.1/node_modules/loupe/lib/bigint.mjs.map +1 -0
- package/dist/node_modules/{loupe → .bun/loupe@3.2.1/node_modules/loupe}/lib/class.mjs +1 -1
- package/dist/node_modules/.bun/loupe@3.2.1/node_modules/loupe/lib/class.mjs.map +1 -0
- package/dist/node_modules/{loupe → .bun/loupe@3.2.1/node_modules/loupe}/lib/date.mjs +1 -1
- package/dist/node_modules/.bun/loupe@3.2.1/node_modules/loupe/lib/date.mjs.map +1 -0
- package/dist/node_modules/{loupe → .bun/loupe@3.2.1/node_modules/loupe}/lib/error.mjs +1 -1
- package/dist/node_modules/.bun/loupe@3.2.1/node_modules/loupe/lib/error.mjs.map +1 -0
- package/dist/node_modules/{loupe → .bun/loupe@3.2.1/node_modules/loupe}/lib/function.mjs +1 -1
- package/dist/node_modules/.bun/loupe@3.2.1/node_modules/loupe/lib/function.mjs.map +1 -0
- package/dist/node_modules/{loupe → .bun/loupe@3.2.1/node_modules/loupe}/lib/helpers.mjs +1 -1
- package/dist/node_modules/.bun/loupe@3.2.1/node_modules/loupe/lib/helpers.mjs.map +1 -0
- package/dist/node_modules/{loupe → .bun/loupe@3.2.1/node_modules/loupe}/lib/html.mjs +1 -1
- package/dist/node_modules/.bun/loupe@3.2.1/node_modules/loupe/lib/html.mjs.map +1 -0
- package/dist/node_modules/{loupe → .bun/loupe@3.2.1/node_modules/loupe}/lib/index.mjs +1 -1
- package/dist/node_modules/.bun/loupe@3.2.1/node_modules/loupe/lib/index.mjs.map +1 -0
- package/dist/node_modules/{loupe → .bun/loupe@3.2.1/node_modules/loupe}/lib/map.mjs +1 -1
- package/dist/node_modules/.bun/loupe@3.2.1/node_modules/loupe/lib/map.mjs.map +1 -0
- package/dist/node_modules/{loupe → .bun/loupe@3.2.1/node_modules/loupe}/lib/number.mjs +1 -1
- package/dist/node_modules/.bun/loupe@3.2.1/node_modules/loupe/lib/number.mjs.map +1 -0
- package/dist/node_modules/{loupe → .bun/loupe@3.2.1/node_modules/loupe}/lib/object.mjs +1 -1
- package/dist/node_modules/.bun/loupe@3.2.1/node_modules/loupe/lib/object.mjs.map +1 -0
- package/dist/node_modules/.bun/loupe@3.2.1/node_modules/loupe/lib/promise.mjs +6 -0
- package/dist/node_modules/.bun/loupe@3.2.1/node_modules/loupe/lib/promise.mjs.map +1 -0
- package/dist/node_modules/{loupe → .bun/loupe@3.2.1/node_modules/loupe}/lib/regexp.mjs +1 -1
- package/dist/node_modules/.bun/loupe@3.2.1/node_modules/loupe/lib/regexp.mjs.map +1 -0
- package/dist/node_modules/{loupe → .bun/loupe@3.2.1/node_modules/loupe}/lib/set.mjs +1 -1
- package/dist/node_modules/.bun/loupe@3.2.1/node_modules/loupe/lib/set.mjs.map +1 -0
- package/dist/node_modules/{loupe → .bun/loupe@3.2.1/node_modules/loupe}/lib/string.mjs +1 -1
- package/dist/node_modules/.bun/loupe@3.2.1/node_modules/loupe/lib/string.mjs.map +1 -0
- package/dist/node_modules/{loupe → .bun/loupe@3.2.1/node_modules/loupe}/lib/symbol.mjs +1 -1
- package/dist/node_modules/.bun/loupe@3.2.1/node_modules/loupe/lib/symbol.mjs.map +1 -0
- package/dist/node_modules/{loupe → .bun/loupe@3.2.1/node_modules/loupe}/lib/typedarray.mjs +1 -1
- package/dist/node_modules/.bun/loupe@3.2.1/node_modules/loupe/lib/typedarray.mjs.map +1 -0
- package/dist/node_modules/{magic-string → .bun/magic-string@0.30.21/node_modules/magic-string}/dist/magic-string.es.mjs +2 -2
- package/dist/node_modules/.bun/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.mjs.map +1 -0
- package/dist/node_modules/{@vitest/snapshot → .bun/pathe@1.1.2}/node_modules/pathe/dist/shared/pathe.ff20891b.mjs +1 -1
- package/dist/node_modules/.bun/pathe@1.1.2/node_modules/pathe/dist/shared/pathe.ff20891b.mjs.map +1 -0
- package/dist/node_modules/{tinyrainbow → .bun/tinyrainbow@1.2.0/node_modules/tinyrainbow}/dist/chunk-BVHSVHOK.mjs +1 -1
- package/dist/node_modules/.bun/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.mjs.map +1 -0
- package/dist/node_modules/{tinyrainbow → .bun/tinyrainbow@1.2.0/node_modules/tinyrainbow}/dist/node.mjs +1 -1
- package/dist/node_modules/.bun/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/node.mjs.map +1 -0
- package/dist/node_modules/{tinyspy → .bun/tinyspy@3.0.2/node_modules/tinyspy}/dist/index.mjs +1 -1
- package/dist/node_modules/.bun/tinyspy@3.0.2/node_modules/tinyspy/dist/index.mjs.map +1 -0
- package/dist/node_modules/{vitest → .bun/vitest@2.1.9_7700f9e9ace41f23/node_modules/vitest}/dist/chunks/_commonjsHelpers.BFTU3MAI.mjs +1 -1
- package/dist/node_modules/.bun/vitest@2.1.9_7700f9e9ace41f23/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.mjs.map +1 -0
- package/dist/node_modules/{vitest → .bun/vitest@2.1.9_7700f9e9ace41f23/node_modules/vitest}/dist/chunks/date.W2xKR2qe.mjs +1 -1
- package/dist/node_modules/.bun/vitest@2.1.9_7700f9e9ace41f23/node_modules/vitest/dist/chunks/date.W2xKR2qe.mjs.map +1 -0
- package/dist/node_modules/{vitest → .bun/vitest@2.1.9_7700f9e9ace41f23/node_modules/vitest}/dist/chunks/utils.C8RiOc4B.mjs +2 -2
- package/dist/node_modules/.bun/vitest@2.1.9_7700f9e9ace41f23/node_modules/vitest/dist/chunks/utils.C8RiOc4B.mjs.map +1 -0
- package/dist/node_modules/{vitest → .bun/vitest@2.1.9_7700f9e9ace41f23/node_modules/vitest}/dist/chunks/vi.DgezovHB.mjs +11 -11
- package/dist/node_modules/.bun/vitest@2.1.9_7700f9e9ace41f23/node_modules/vitest/dist/chunks/vi.DgezovHB.mjs.map +1 -0
- package/dist/providers/base.d.mts +2 -2
- package/dist/providers/base.d.mts.map +1 -1
- package/dist/providers/openai-provider.d.mts.map +1 -1
- package/dist/providers/openai-provider.mjs +10 -9
- package/dist/providers/openai-provider.mjs.map +1 -1
- package/dist/providers/registry.d.mts +1 -1
- package/dist/providers/registry.d.mts.map +1 -1
- package/dist/providers/registry.mjs +99 -99
- package/dist/providers/registry.mjs.map +1 -1
- package/dist/session/manager.d.mts +2 -2
- package/dist/session/manager.d.mts.map +1 -1
- package/dist/session/manager.mjs +18 -19
- package/dist/session/manager.mjs.map +1 -1
- package/dist/utils/helpers.d.mts.map +1 -1
- package/dist/utils/helpers.mjs.map +1 -1
- package/package.json +11 -11
- package/skills/cron/SKILL.md +12 -8
- package/skills/daily-summary/SKILL.md +4 -0
- package/skills/english/SKILL.md +21 -7
- package/skills/expense/SKILL.md +11 -7
- package/skills/fortune/SKILL.md +24 -20
- package/skills/habit/SKILL.md +2 -1
- package/skills/hydration/SKILL.md +3 -0
- package/skills/memory/SKILL.md +1 -0
- package/skills/mood/SKILL.md +10 -6
- package/skills/skill-creator/SKILL.md +3 -0
- package/skills/summarize/SKILL.md +1 -0
- package/skills/weather/SKILL.md +10 -8
- package/dist/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map +0 -1
- package/dist/node_modules/@vitest/expect/dist/index.mjs.map +0 -1
- package/dist/node_modules/@vitest/pretty-format/dist/index.mjs.map +0 -1
- package/dist/node_modules/@vitest/runner/dist/chunk-tasks.mjs.map +0 -1
- package/dist/node_modules/@vitest/runner/dist/index.mjs.map +0 -1
- package/dist/node_modules/@vitest/snapshot/dist/index.mjs.map +0 -1
- package/dist/node_modules/@vitest/snapshot/node_modules/pathe/dist/shared/pathe.ff20891b.mjs.map +0 -1
- package/dist/node_modules/@vitest/spy/dist/index.mjs.map +0 -1
- package/dist/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.mjs.map +0 -1
- package/dist/node_modules/@vitest/utils/dist/diff.mjs.map +0 -1
- package/dist/node_modules/@vitest/utils/dist/error.mjs.map +0 -1
- package/dist/node_modules/@vitest/utils/dist/helpers.mjs.map +0 -1
- package/dist/node_modules/@vitest/utils/dist/index.mjs.map +0 -1
- package/dist/node_modules/@vitest/utils/dist/source-map.mjs.map +0 -1
- package/dist/node_modules/chai/index.mjs.map +0 -1
- package/dist/node_modules/loupe/lib/arguments.mjs.map +0 -1
- package/dist/node_modules/loupe/lib/array.mjs.map +0 -1
- package/dist/node_modules/loupe/lib/bigint.mjs.map +0 -1
- package/dist/node_modules/loupe/lib/class.mjs.map +0 -1
- package/dist/node_modules/loupe/lib/date.mjs.map +0 -1
- package/dist/node_modules/loupe/lib/error.mjs.map +0 -1
- package/dist/node_modules/loupe/lib/function.mjs.map +0 -1
- package/dist/node_modules/loupe/lib/helpers.mjs.map +0 -1
- package/dist/node_modules/loupe/lib/html.mjs.map +0 -1
- package/dist/node_modules/loupe/lib/index.mjs.map +0 -1
- package/dist/node_modules/loupe/lib/map.mjs.map +0 -1
- package/dist/node_modules/loupe/lib/number.mjs.map +0 -1
- package/dist/node_modules/loupe/lib/object.mjs.map +0 -1
- package/dist/node_modules/loupe/lib/promise.mjs +0 -6
- package/dist/node_modules/loupe/lib/promise.mjs.map +0 -1
- package/dist/node_modules/loupe/lib/regexp.mjs.map +0 -1
- package/dist/node_modules/loupe/lib/set.mjs.map +0 -1
- package/dist/node_modules/loupe/lib/string.mjs.map +0 -1
- package/dist/node_modules/loupe/lib/symbol.mjs.map +0 -1
- package/dist/node_modules/loupe/lib/typedarray.mjs.map +0 -1
- package/dist/node_modules/magic-string/dist/magic-string.es.mjs.map +0 -1
- package/dist/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.mjs.map +0 -1
- package/dist/node_modules/tinyrainbow/dist/node.mjs.map +0 -1
- package/dist/node_modules/tinyspy/dist/index.mjs.map +0 -1
- package/dist/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.mjs.map +0 -1
- package/dist/node_modules/vitest/dist/chunks/date.W2xKR2qe.mjs.map +0 -1
- package/dist/node_modules/vitest/dist/chunks/utils.C8RiOc4B.mjs.map +0 -1
- package/dist/node_modules/vitest/dist/chunks/vi.DgezovHB.mjs.map +0 -1
- /package/dist/node_modules/{@vitest → .bun/@vitest_runner@2.1.9/node_modules/@vitest}/runner/dist/utils.mjs +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cron.mjs","names":[],"sources":["../../../src/agent/tools/cron.ts"],"sourcesContent":["import { Tool } from \"./base.js\";\n\n/** Tool to schedule reminders and recurring tasks via the DO scheduler. */\nexport class CronTool extends Tool {\n readonly name = \"cron\";\n readonly description =\n \"Schedule one-off or recurring tasks. Actions: add, list, remove.\";\n readonly parameters = {\n
|
|
1
|
+
{"version":3,"file":"cron.mjs","names":[],"sources":["../../../src/agent/tools/cron.ts"],"sourcesContent":["import { Tool } from \"./base.js\";\n\n/** Tool to schedule reminders and recurring tasks via the DO scheduler. */\nexport class CronTool extends Tool {\n readonly name = \"cron\";\n readonly description =\n \"Schedule one-off or recurring tasks. Actions: add, list, remove.\";\n readonly parameters = {\n properties: {\n action: {\n type: \"string\",\n enum: [\"add\", \"list\", \"remove\"],\n description: \"Action to perform\",\n },\n message: {\n type: \"string\",\n description: \"Reminder message or task prompt (for add)\",\n },\n kind: {\n type: \"string\",\n enum: [\"direct\", \"task\"],\n description:\n \"direct: send message verbatim to user (default, for reminders). task: run message through the agent and deliver result.\",\n },\n every_seconds: {\n type: \"integer\",\n description: \"Interval in seconds (for recurring tasks)\",\n },\n cron_expr: {\n type: \"string\",\n description:\n \"Cron expression in the USER's LOCAL time (e.g. '0 8 * * *' for 8am local). The server converts to UTC automatically.\",\n },\n timezone: {\n type: \"string\",\n description:\n \"IANA timezone of the user (e.g. 'Asia/Tokyo'). Required with cron_expr. Read from USER.md or system prompt.\",\n },\n at: {\n type: \"string\",\n description:\n \"Run once at a specific time. ISO 8601 string (e.g. '2025-03-01T09:00:00Z')\",\n },\n job_id: {\n type: \"string\",\n description: \"Job ID (for remove)\",\n },\n },\n required: [\"action\"],\n type: \"object\",\n };\n\n private channel = \"\";\n private chatId = \"\";\n\n /** Worker URL for DO scheduling. */\n private workerUrl: string;\n /** User ID for DO scheduling. */\n private userId: string;\n\n constructor() {\n super();\n this.workerUrl = process.env.WORKER_URL ?? \"\";\n this.userId = process.env.NANOBOT_USER_ID ?? \"\";\n }\n\n /** Set the current session context for delivery. */\n setContext(channel: string, chatId: string): void {\n this.channel = channel;\n this.chatId = chatId;\n }\n\n async execute(args: Record<string, unknown>): Promise<string> {\n if (!this.workerUrl || !this.userId) {\n return \"Error: cron scheduling requires WORKER_URL and NANOBOT_USER_ID\";\n }\n\n const action = String(args.action);\n switch (action) {\n case \"add\": {\n return this.addJob(args);\n }\n case \"list\": {\n return this.listJobs();\n }\n case \"remove\": {\n return this.removeJob(args);\n }\n default: {\n return `Unknown action: ${action}`;\n }\n }\n }\n\n private async addJob(args: Record<string, unknown>): Promise<string> {\n const message = args.message ? String(args.message) : \"\";\n const kind = args.kind === \"task\" ? \"task\" : \"direct\"; // default: direct\n const everySeconds = args.every_seconds ? Number(args.every_seconds) : null;\n const cronExpr = args.cron_expr ? String(args.cron_expr) : null;\n const timezone = args.timezone ? String(args.timezone) : null;\n const atRaw = args.at ? String(args.at) : null;\n\n if (!message) {\n return \"Error: message is required for add\";\n }\n if (!this.channel || !this.chatId) {\n return \"Error: no session context (channel/chatId)\";\n }\n\n let schedule: string | number;\n if (atRaw) {\n const atMs = Date.parse(atRaw);\n if (Number.isNaN(atMs)) {\n return `Error: could not parse time '${atRaw}' — use ISO 8601 format`;\n }\n if (atMs <= Date.now()) {\n return \"Error: scheduled time is in the past\";\n }\n\n schedule = atRaw;\n } else if (everySeconds) {\n // For recurring by interval, use seconds\n schedule = everySeconds;\n } else if (cronExpr) {\n schedule = cronExpr;\n } else {\n return \"Error: one of 'at', 'every_seconds', or 'cron_expr' is required\";\n }\n\n try {\n const res = await fetch(\n `${this.workerUrl}/api/users/${this.userId}/cron`,\n {\n body: JSON.stringify({\n name: message,\n type: everySeconds ? \"every\" : cronExpr ? \"cron\" : \"scheduled\",\n schedule,\n message,\n kind,\n deliver: true,\n channel: this.channel,\n chatId: this.chatId,\n ...(timezone && cronExpr ? { timezone } : {}),\n }),\n headers: { \"Content-Type\": \"application/json\" },\n method: \"POST\",\n signal: AbortSignal.timeout(10_000),\n }\n );\n const data = (await res.json()) as { id?: string; error?: string };\n if (!res.ok) {\n return `Error: ${data.error ?? res.statusText}`;\n }\n return `Created ${kind} job (id: ${data.id})`;\n } catch (error) {\n return `Error scheduling job: ${error instanceof Error ? error.message : error}`;\n }\n }\n\n private async listJobs(): Promise<string> {\n try {\n const res = await fetch(\n `${this.workerUrl}/api/users/${this.userId}/cron`,\n { signal: AbortSignal.timeout(10_000) }\n );\n const data = (await res.json()) as {\n crons: {\n id: string;\n type: string;\n name: string;\n message: string;\n nextRunAt: number;\n }[];\n };\n if (data.crons.length === 0) {\n return \"No scheduled jobs.\";\n }\n const lines = data.crons.map(\n (c) =>\n `- ${c.name} (id: ${c.id}, ${c.type}, next: ${new Date(c.nextRunAt).toISOString()})`\n );\n return \"Scheduled jobs:\\n\" + lines.join(\"\\n\");\n } catch (error) {\n return `Error listing jobs: ${error instanceof Error ? error.message : error}`;\n }\n }\n\n private async removeJob(args: Record<string, unknown>): Promise<string> {\n const jobId = args.job_id ? String(args.job_id) : null;\n if (!jobId) {\n return \"Error: job_id is required for remove\";\n }\n\n try {\n const res = await fetch(\n `${this.workerUrl}/api/users/${this.userId}/cron/${jobId}`,\n {\n method: \"DELETE\",\n signal: AbortSignal.timeout(10_000),\n }\n );\n const data = (await res.json()) as { ok: boolean };\n return data.ok ? `Removed job ${jobId}` : `Job ${jobId} not found`;\n } catch (error) {\n return `Error removing job: ${error instanceof Error ? error.message : error}`;\n }\n }\n}\n"],"mappings":";;;;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,sBAJO,KAAK,MAAM,KACtB,MACC,KAAK,EAAE,KAAK,QAAQ,EAAE,GAAG,IAAI,EAAE,KAAK,UAAU,IAAI,KAAK,EAAE,UAAU,CAAC,aAAa,CAAC,GACrF,CACkC,KAAK,KAAK;WACtC,OAAO;AACd,UAAO,uBAAuB,iBAAiB,QAAQ,MAAM,UAAU;;;CAI3E,MAAc,UAAU,MAAgD;EACtE,MAAM,QAAQ,KAAK,SAAS,OAAO,KAAK,OAAO,GAAG;AAClD,MAAI,CAAC,MACH,QAAO;AAGT,MAAI;AASF,WADc,OAPF,MAAM,MAChB,GAAG,KAAK,UAAU,aAAa,KAAK,OAAO,QAAQ,SACnD;IACE,QAAQ;IACR,QAAQ,YAAY,QAAQ,IAAO;IACpC,CACF,EACuB,MAAM,EAClB,KAAK,eAAe,UAAU,OAAO,MAAM;WAChD,OAAO;AACd,UAAO,uBAAuB,iBAAiB,QAAQ,MAAM,UAAU"}
|
|
@@ -6,7 +6,6 @@ declare class ReadFileTool extends Tool {
|
|
|
6
6
|
readonly name = "read_file";
|
|
7
7
|
readonly description = "Read the contents of a file.";
|
|
8
8
|
readonly parameters: {
|
|
9
|
-
type: string;
|
|
10
9
|
properties: {
|
|
11
10
|
path: {
|
|
12
11
|
type: string;
|
|
@@ -19,6 +18,7 @@ declare class ReadFileTool extends Tool {
|
|
|
19
18
|
};
|
|
20
19
|
};
|
|
21
20
|
required: string[];
|
|
21
|
+
type: string;
|
|
22
22
|
};
|
|
23
23
|
private allowedDir?;
|
|
24
24
|
private readOnlyPaths?;
|
|
@@ -33,7 +33,6 @@ declare class WriteFileTool extends Tool {
|
|
|
33
33
|
readonly name = "write_file";
|
|
34
34
|
readonly description = "Write content to a file. Creates parent directories if needed.";
|
|
35
35
|
readonly parameters: {
|
|
36
|
-
type: string;
|
|
37
36
|
properties: {
|
|
38
37
|
path: {
|
|
39
38
|
type: string;
|
|
@@ -45,6 +44,7 @@ declare class WriteFileTool extends Tool {
|
|
|
45
44
|
};
|
|
46
45
|
};
|
|
47
46
|
required: string[];
|
|
47
|
+
type: string;
|
|
48
48
|
};
|
|
49
49
|
private allowedDir?;
|
|
50
50
|
constructor(params?: {
|
|
@@ -57,7 +57,6 @@ declare class EditFileTool extends Tool {
|
|
|
57
57
|
readonly name = "edit_file";
|
|
58
58
|
readonly description = "Edit a file by replacing the first occurrence of old_text with new_text. Provide enough context in old_text to uniquely identify the target.";
|
|
59
59
|
readonly parameters: {
|
|
60
|
-
type: string;
|
|
61
60
|
properties: {
|
|
62
61
|
path: {
|
|
63
62
|
type: string;
|
|
@@ -73,6 +72,7 @@ declare class EditFileTool extends Tool {
|
|
|
73
72
|
};
|
|
74
73
|
};
|
|
75
74
|
required: string[];
|
|
75
|
+
type: string;
|
|
76
76
|
};
|
|
77
77
|
private allowedDir?;
|
|
78
78
|
constructor(params?: {
|
|
@@ -85,7 +85,6 @@ declare class ListDirTool extends Tool {
|
|
|
85
85
|
readonly name = "list_dir";
|
|
86
86
|
readonly description = "List files and directories at the given path.";
|
|
87
87
|
readonly parameters: {
|
|
88
|
-
type: string;
|
|
89
88
|
properties: {
|
|
90
89
|
path: {
|
|
91
90
|
type: string;
|
|
@@ -93,6 +92,7 @@ declare class ListDirTool extends Tool {
|
|
|
93
92
|
};
|
|
94
93
|
};
|
|
95
94
|
required: string[];
|
|
95
|
+
type: string;
|
|
96
96
|
};
|
|
97
97
|
private allowedDir?;
|
|
98
98
|
private readOnlyPaths?;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filesystem.d.mts","names":[],"sources":["../../../src/agent/tools/filesystem.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"filesystem.d.mts","names":[],"sources":["../../../src/agent/tools/filesystem.ts"],"mappings":";;;;cAuDa,YAAA,SAAqB,IAAA;EAAA,SACvB,IAAA;EAAA,SACA,WAAA;EAAA,SACA,UAAA;;;;;;;;;;;;;;;UAaD,UAAA;EAAA,QACA,aAAA;cAEI,MAAA;IAAW,UAAA;IAAqB,aAAA;EAAA;EAMtC,OAAA,CAAQ,IAAA,EAAM,MAAA,oBAA0B,OAAA;AAAA;;cA6BnC,aAAA,SAAsB,IAAA;EAAA,SACxB,IAAA;EAAA,SACA,WAAA;EAAA,SAEA,UAAA;;;;;;;;;;;;;;UASD,UAAA;cAEI,MAAA;IAAW,UAAA;EAAA;EAKjB,OAAA,CAAQ,IAAA,EAAM,MAAA,oBAA0B,OAAA;AAAA;;cAuBnC,YAAA,SAAqB,IAAA;EAAA,SACvB,IAAA;EAAA,SACA,WAAA;EAAA,SAEA,UAAA;;;;;;;;;;;;;;;;;;UAUD,UAAA;cAEI,MAAA;IAAW,UAAA;EAAA;EAKjB,OAAA,CAAQ,IAAA,EAAM,MAAA,oBAA0B,OAAA;AAAA;;cA4BnC,WAAA,SAAoB,IAAA;EAAA,SACtB,IAAA;EAAA,SACA,WAAA;EAAA,SACA,UAAA;;;;;;;;;;UAQD,UAAA;EAAA,QACA,aAAA;cAEI,MAAA;IAAW,UAAA;IAAqB,aAAA;EAAA;EAMtC,OAAA,CAAQ,IAAA,EAAM,MAAA,oBAA0B,OAAA;AAAA"}
|
|
@@ -28,7 +28,6 @@ var ReadFileTool = class extends Tool {
|
|
|
28
28
|
name = "read_file";
|
|
29
29
|
description = "Read the contents of a file.";
|
|
30
30
|
parameters = {
|
|
31
|
-
type: "object",
|
|
32
31
|
properties: {
|
|
33
32
|
path: {
|
|
34
33
|
type: "string",
|
|
@@ -40,7 +39,8 @@ var ReadFileTool = class extends Tool {
|
|
|
40
39
|
minimum: 1
|
|
41
40
|
}
|
|
42
41
|
},
|
|
43
|
-
required: ["path"]
|
|
42
|
+
required: ["path"],
|
|
43
|
+
type: "object"
|
|
44
44
|
};
|
|
45
45
|
allowedDir;
|
|
46
46
|
readOnlyPaths;
|
|
@@ -56,11 +56,11 @@ var ReadFileTool = class extends Tool {
|
|
|
56
56
|
if (denied) return denied;
|
|
57
57
|
try {
|
|
58
58
|
if (!existsSync(filePath)) return `Error: File not found: ${filePath}`;
|
|
59
|
-
let content = readFileSync(filePath, "
|
|
59
|
+
let content = readFileSync(filePath, "utf8");
|
|
60
60
|
if (maxChars && content.length > maxChars) content = content.slice(0, maxChars) + "\n... (truncated)";
|
|
61
61
|
return content;
|
|
62
|
-
} catch (
|
|
63
|
-
return `Error reading file: ${
|
|
62
|
+
} catch (error) {
|
|
63
|
+
return `Error reading file: ${error instanceof Error ? error.message : error}`;
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
};
|
|
@@ -69,7 +69,6 @@ var WriteFileTool = class extends Tool {
|
|
|
69
69
|
name = "write_file";
|
|
70
70
|
description = "Write content to a file. Creates parent directories if needed.";
|
|
71
71
|
parameters = {
|
|
72
|
-
type: "object",
|
|
73
72
|
properties: {
|
|
74
73
|
path: {
|
|
75
74
|
type: "string",
|
|
@@ -80,7 +79,8 @@ var WriteFileTool = class extends Tool {
|
|
|
80
79
|
description: "Content to write"
|
|
81
80
|
}
|
|
82
81
|
},
|
|
83
|
-
required: ["path", "content"]
|
|
82
|
+
required: ["path", "content"],
|
|
83
|
+
type: "object"
|
|
84
84
|
};
|
|
85
85
|
allowedDir;
|
|
86
86
|
constructor(params) {
|
|
@@ -95,10 +95,10 @@ var WriteFileTool = class extends Tool {
|
|
|
95
95
|
try {
|
|
96
96
|
const dir = dirname(filePath);
|
|
97
97
|
if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
|
|
98
|
-
writeFileSync(filePath, content, "
|
|
98
|
+
writeFileSync(filePath, content, "utf8");
|
|
99
99
|
return `Written ${content.length} chars to ${filePath}`;
|
|
100
|
-
} catch (
|
|
101
|
-
return `Error writing file: ${
|
|
100
|
+
} catch (error) {
|
|
101
|
+
return `Error writing file: ${error instanceof Error ? error.message : error}`;
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
};
|
|
@@ -107,7 +107,6 @@ var EditFileTool = class extends Tool {
|
|
|
107
107
|
name = "edit_file";
|
|
108
108
|
description = "Edit a file by replacing the first occurrence of old_text with new_text. Provide enough context in old_text to uniquely identify the target.";
|
|
109
109
|
parameters = {
|
|
110
|
-
type: "object",
|
|
111
110
|
properties: {
|
|
112
111
|
path: {
|
|
113
112
|
type: "string",
|
|
@@ -126,7 +125,8 @@ var EditFileTool = class extends Tool {
|
|
|
126
125
|
"path",
|
|
127
126
|
"old_text",
|
|
128
127
|
"new_text"
|
|
129
|
-
]
|
|
128
|
+
],
|
|
129
|
+
type: "object"
|
|
130
130
|
};
|
|
131
131
|
allowedDir;
|
|
132
132
|
constructor(params) {
|
|
@@ -141,12 +141,12 @@ var EditFileTool = class extends Tool {
|
|
|
141
141
|
if (denied) return denied;
|
|
142
142
|
try {
|
|
143
143
|
if (!existsSync(filePath)) return `Error: File not found: ${filePath}`;
|
|
144
|
-
const content = readFileSync(filePath, "
|
|
144
|
+
const content = readFileSync(filePath, "utf8");
|
|
145
145
|
if (!content.includes(oldText)) return `Error: old_text not found in ${filePath}`;
|
|
146
|
-
writeFileSync(filePath, content.replace(oldText, newText), "
|
|
146
|
+
writeFileSync(filePath, content.replace(oldText, newText), "utf8");
|
|
147
147
|
return `Edited ${filePath}: replaced ${oldText.length} chars`;
|
|
148
|
-
} catch (
|
|
149
|
-
return `Error editing file: ${
|
|
148
|
+
} catch (error) {
|
|
149
|
+
return `Error editing file: ${error instanceof Error ? error.message : error}`;
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
};
|
|
@@ -155,12 +155,12 @@ var ListDirTool = class extends Tool {
|
|
|
155
155
|
name = "list_dir";
|
|
156
156
|
description = "List files and directories at the given path.";
|
|
157
157
|
parameters = {
|
|
158
|
-
type: "object",
|
|
159
158
|
properties: { path: {
|
|
160
159
|
type: "string",
|
|
161
160
|
description: "Directory path to list"
|
|
162
161
|
} },
|
|
163
|
-
required: ["path"]
|
|
162
|
+
required: ["path"],
|
|
163
|
+
type: "object"
|
|
164
164
|
};
|
|
165
165
|
allowedDir;
|
|
166
166
|
readOnlyPaths;
|
|
@@ -186,8 +186,8 @@ var ListDirTool = class extends Tool {
|
|
|
186
186
|
lines.push(`?\t${entry}`);
|
|
187
187
|
}
|
|
188
188
|
return lines.length > 0 ? lines.join("\n") : "(empty directory)";
|
|
189
|
-
} catch (
|
|
190
|
-
return `Error listing directory: ${
|
|
189
|
+
} catch (error) {
|
|
190
|
+
return `Error listing directory: ${error instanceof Error ? error.message : error}`;
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
193
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filesystem.mjs","names":[],"sources":["../../../src/agent/tools/filesystem.ts"],"sourcesContent":["import {\n readFileSync,\n writeFileSync,\n readdirSync,\n existsSync,\n statSync,\n mkdirSync,\n} from \"node:fs\";\nimport { join, dirname, resolve } from \"node:path\";\nimport { Tool } from \"./base.js\";\n\n/** Check if a resolved path is within the allowed directory or any read-only paths. */\nfunction checkAllowedDir(\n filePath: string,\n allowedDir?: string,\n readOnlyPaths?: string[],\n): string | null {\n if (!allowedDir) return null;\n const resolved = resolve(filePath);\n const allowed = resolve(allowedDir);\n if (resolved.startsWith(allowed + \"/\") || resolved === allowed) {\n return null;\n }\n // Check read-only paths\n if (readOnlyPaths) {\n for (const ro of readOnlyPaths) {\n const roResolved = resolve(ro);\n if (resolved.startsWith(roResolved + \"/\") || resolved === roResolved) {\n return null;\n }\n }\n }\n return `Error: Access denied — path must be within ${allowedDir}`;\n}\n\n/** Check if a resolved path is within the allowed directory (no read-only fallback). */\nfunction checkWriteAllowedDir(filePath: string, allowedDir?: string): string | null {\n if (!allowedDir) return null;\n const resolved = resolve(filePath);\n const allowed = resolve(allowedDir);\n if (!resolved.startsWith(allowed + \"/\") && resolved !== allowed) {\n return `Error: Access denied — path must be within ${allowedDir}`;\n }\n return null;\n}\n\n/** Read a file's contents. */\nexport class ReadFileTool extends Tool {\n readonly name = \"read_file\";\n readonly description = \"Read the contents of a file.\";\n readonly parameters = {\n type: \"object\",\n properties: {\n path: { type: \"string\", description: \"File path to read\" },\n maxChars: {\n type: \"integer\",\n description: \"Max characters to return\",\n minimum: 1,\n },\n },\n required: [\"path\"],\n };\n\n private allowedDir?: string;\n private readOnlyPaths?: string[];\n\n constructor(params?: { allowedDir?: string; readOnlyPaths?: string[] }) {\n super();\n this.allowedDir = params?.allowedDir;\n this.readOnlyPaths = params?.readOnlyPaths;\n }\n\n async execute(args: Record<string, unknown>): Promise<string> {\n const filePath = String(args.path);\n const maxChars = args.maxChars ? Number(args.maxChars) : undefined;\n\n const denied = checkAllowedDir(filePath, this.allowedDir, this.readOnlyPaths);\n if (denied) return denied;\n\n try {\n if (!existsSync(filePath)) {\n return `Error: File not found: ${filePath}`;\n }\n let content = readFileSync(filePath, \"utf-8\");\n if (maxChars && content.length > maxChars) {\n content = content.slice(0, maxChars) + \"\\n... (truncated)\";\n }\n return content;\n } catch (err) {\n return `Error reading file: ${err instanceof Error ? err.message : err}`;\n }\n }\n}\n\n/** Write content to a file. */\nexport class WriteFileTool extends Tool {\n readonly name = \"write_file\";\n readonly description = \"Write content to a file. Creates parent directories if needed.\";\n readonly parameters = {\n type: \"object\",\n properties: {\n path: { type: \"string\", description: \"File path to write\" },\n content: { type: \"string\", description: \"Content to write\" },\n },\n required: [\"path\", \"content\"],\n };\n\n private allowedDir?: string;\n\n constructor(params?: { allowedDir?: string }) {\n super();\n this.allowedDir = params?.allowedDir;\n }\n\n async execute(args: Record<string, unknown>): Promise<string> {\n const filePath = String(args.path);\n const content = String(args.content);\n\n const denied = checkWriteAllowedDir(filePath, this.allowedDir);\n if (denied) return denied;\n\n try {\n const dir = dirname(filePath);\n if (!existsSync(dir)) {\n mkdirSync(dir, { recursive: true });\n }\n writeFileSync(filePath, content, \"utf-8\");\n return `Written ${content.length} chars to ${filePath}`;\n } catch (err) {\n return `Error writing file: ${err instanceof Error ? err.message : err}`;\n }\n }\n}\n\n/** Edit a file by replacing text. */\nexport class EditFileTool extends Tool {\n readonly name = \"edit_file\";\n readonly description =\n \"Edit a file by replacing the first occurrence of old_text with new_text. Provide enough context in old_text to uniquely identify the target.\";\n readonly parameters = {\n type: \"object\",\n properties: {\n path: { type: \"string\", description: \"File path to edit\" },\n old_text: { type: \"string\", description: \"Text to find and replace\" },\n new_text: { type: \"string\", description: \"Replacement text\" },\n },\n required: [\"path\", \"old_text\", \"new_text\"],\n };\n\n private allowedDir?: string;\n\n constructor(params?: { allowedDir?: string }) {\n super();\n this.allowedDir = params?.allowedDir;\n }\n\n async execute(args: Record<string, unknown>): Promise<string> {\n const filePath = String(args.path);\n const oldText = String(args.old_text);\n const newText = String(args.new_text);\n\n const denied = checkWriteAllowedDir(filePath, this.allowedDir);\n if (denied) return denied;\n\n try {\n if (!existsSync(filePath)) {\n return `Error: File not found: ${filePath}`;\n }\n const content = readFileSync(filePath, \"utf-8\");\n if (!content.includes(oldText)) {\n return `Error: old_text not found in ${filePath}`;\n }\n const newContent = content.replace(oldText, newText);\n writeFileSync(filePath, newContent, \"utf-8\");\n return `Edited ${filePath}: replaced ${oldText.length} chars`;\n } catch (err) {\n return `Error editing file: ${err instanceof Error ? err.message : err}`;\n }\n }\n}\n\n/** List directory contents. */\nexport class ListDirTool extends Tool {\n readonly name = \"list_dir\";\n readonly description = \"List files and directories at the given path.\";\n readonly parameters = {\n type: \"object\",\n properties: {\n path: { type: \"string\", description: \"Directory path to list\" },\n },\n required: [\"path\"],\n };\n\n private allowedDir?: string;\n private readOnlyPaths?: string[];\n\n constructor(params?: { allowedDir?: string; readOnlyPaths?: string[] }) {\n super();\n this.allowedDir = params?.allowedDir;\n this.readOnlyPaths = params?.readOnlyPaths;\n }\n\n async execute(args: Record<string, unknown>): Promise<string> {\n const dirPath = String(args.path);\n\n const denied = checkAllowedDir(dirPath, this.allowedDir, this.readOnlyPaths);\n if (denied) return denied;\n\n try {\n if (!existsSync(dirPath)) {\n return `Error: Directory not found: ${dirPath}`;\n }\n const entries = readdirSync(dirPath);\n const lines: string[] = [];\n for (const entry of entries) {\n try {\n const fullPath = join(dirPath, entry);\n const stat = statSync(fullPath);\n const type = stat.isDirectory() ? \"dir\" : \"file\";\n const size = stat.isDirectory() ? \"\" : ` (${stat.size}b)`;\n lines.push(`${type}\\t${entry}${size}`);\n } catch {\n lines.push(`?\\t${entry}`);\n }\n }\n return lines.length > 0 ? lines.join(\"\\n\") : \"(empty directory)\";\n } catch (err) {\n return `Error listing directory: ${err instanceof Error ? err.message : err}`;\n }\n }\n}\n"],"mappings":";;;;;;AAYA,SAAS,gBACP,UACA,YACA,eACe;AACf,KAAI,CAAC,WAAY,QAAO;CACxB,MAAM,WAAW,QAAQ,SAAS;CAClC,MAAM,UAAU,QAAQ,WAAW;AACnC,KAAI,SAAS,WAAW,UAAU,IAAI,IAAI,aAAa,QACrD,QAAO;AAGT,KAAI,cACF,MAAK,MAAM,MAAM,eAAe;EAC9B,MAAM,aAAa,QAAQ,GAAG;AAC9B,MAAI,SAAS,WAAW,aAAa,IAAI,IAAI,aAAa,WACxD,QAAO;;AAIb,QAAO,8CAA8C;;;AAIvD,SAAS,qBAAqB,UAAkB,YAAoC;AAClF,KAAI,CAAC,WAAY,QAAO;CACxB,MAAM,WAAW,QAAQ,SAAS;CAClC,MAAM,UAAU,QAAQ,WAAW;AACnC,KAAI,CAAC,SAAS,WAAW,UAAU,IAAI,IAAI,aAAa,QACtD,QAAO,8CAA8C;AAEvD,QAAO;;;AAIT,IAAa,eAAb,cAAkC,KAAK;CACrC,AAAS,OAAO;CAChB,AAAS,cAAc;CACvB,AAAS,aAAa;EACpB,MAAM;EACN,YAAY;GACV,MAAM;IAAE,MAAM;IAAU,aAAa;IAAqB;GAC1D,UAAU;IACR,MAAM;IACN,aAAa;IACb,SAAS;IACV;GACF;EACD,UAAU,CAAC,OAAO;EACnB;CAED,AAAQ;CACR,AAAQ;CAER,YAAY,QAA4D;AACtE,SAAO;AACP,OAAK,aAAa,QAAQ;AAC1B,OAAK,gBAAgB,QAAQ;;CAG/B,MAAM,QAAQ,MAAgD;EAC5D,MAAM,WAAW,O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AI,OAAQ,QAAO;AAEnB,MAAI;AACF,OAAI,CAAC,WAAW,QAAQ,CACtB,QAAO,+BAA+B;GAExC,MAAM,UAAU,YAAY,QAAQ;GACpC,MAAM,QAAkB,EAAE;AAC1B,QAAK,MAAM,SAAS,QAClB,KAAI;IAEF,MAAM,OAAO,SADI,KAAK,SAAS,MAAM,CACN;IAC/B,MAAM,OAAO,KAAK,aAAa,GAAG,QAAQ;IAC1C,MAAM,OAAO,KAAK,aAAa,GAAG,KAAK,KAAK,KAAK,KAAK;AACtD,UAAM,KAAK,GAAG,KAAK,IAAI,QAAQ,OAAO;WAChC;AACN,UAAM,KAAK,MAAM,QAAQ;;AAG7B,UAAO,MAAM,SAAS,IAAI,MAAM,KAAK,KAAK,GAAG;WACtC,KAAK;AACZ,UAAO,4BAA4B,eAAe,QAAQ,IAAI,UAAU"}
|
|
1
|
+
{"version":3,"file":"filesystem.mjs","names":[],"sources":["../../../src/agent/tools/filesystem.ts"],"sourcesContent":["import {\n readFileSync,\n writeFileSync,\n readdirSync,\n existsSync,\n statSync,\n mkdirSync,\n} from \"node:fs\";\nimport { join, dirname, resolve } from \"node:path\";\n\nimport { Tool } from \"./base.js\";\n\n/** Check if a resolved path is within the allowed directory or any read-only paths. */\nfunction checkAllowedDir(\n filePath: string,\n allowedDir?: string,\n readOnlyPaths?: string[]\n): string | null {\n if (!allowedDir) {\n return null;\n }\n const resolved = resolve(filePath);\n const allowed = resolve(allowedDir);\n if (resolved.startsWith(allowed + \"/\") || resolved === allowed) {\n return null;\n }\n // Check read-only paths\n if (readOnlyPaths) {\n for (const ro of readOnlyPaths) {\n const roResolved = resolve(ro);\n if (resolved.startsWith(roResolved + \"/\") || resolved === roResolved) {\n return null;\n }\n }\n }\n return `Error: Access denied — path must be within ${allowedDir}`;\n}\n\n/** Check if a resolved path is within the allowed directory (no read-only fallback). */\nfunction checkWriteAllowedDir(\n filePath: string,\n allowedDir?: string\n): string | null {\n if (!allowedDir) {\n return null;\n }\n const resolved = resolve(filePath);\n const allowed = resolve(allowedDir);\n if (!resolved.startsWith(allowed + \"/\") && resolved !== allowed) {\n return `Error: Access denied — path must be within ${allowedDir}`;\n }\n return null;\n}\n\n/** Read a file's contents. */\nexport class ReadFileTool extends Tool {\n readonly name = \"read_file\";\n readonly description = \"Read the contents of a file.\";\n readonly parameters = {\n properties: {\n path: { type: \"string\", description: \"File path to read\" },\n maxChars: {\n type: \"integer\",\n description: \"Max characters to return\",\n minimum: 1,\n },\n },\n required: [\"path\"],\n type: \"object\",\n };\n\n private allowedDir?: string;\n private readOnlyPaths?: string[];\n\n constructor(params?: { allowedDir?: string; readOnlyPaths?: string[] }) {\n super();\n this.allowedDir = params?.allowedDir;\n this.readOnlyPaths = params?.readOnlyPaths;\n }\n\n async execute(args: Record<string, unknown>): Promise<string> {\n const filePath = String(args.path);\n const maxChars = args.maxChars ? Number(args.maxChars) : undefined;\n\n const denied = checkAllowedDir(\n filePath,\n this.allowedDir,\n this.readOnlyPaths\n );\n if (denied) {\n return denied;\n }\n\n try {\n if (!existsSync(filePath)) {\n return `Error: File not found: ${filePath}`;\n }\n let content = readFileSync(filePath, \"utf8\");\n if (maxChars && content.length > maxChars) {\n content = content.slice(0, maxChars) + \"\\n... (truncated)\";\n }\n return content;\n } catch (error) {\n return `Error reading file: ${error instanceof Error ? error.message : error}`;\n }\n }\n}\n\n/** Write content to a file. */\nexport class WriteFileTool extends Tool {\n readonly name = \"write_file\";\n readonly description =\n \"Write content to a file. Creates parent directories if needed.\";\n readonly parameters = {\n properties: {\n path: { type: \"string\", description: \"File path to write\" },\n content: { type: \"string\", description: \"Content to write\" },\n },\n required: [\"path\", \"content\"],\n type: \"object\",\n };\n\n private allowedDir?: string;\n\n constructor(params?: { allowedDir?: string }) {\n super();\n this.allowedDir = params?.allowedDir;\n }\n\n async execute(args: Record<string, unknown>): Promise<string> {\n const filePath = String(args.path);\n const content = String(args.content);\n\n const denied = checkWriteAllowedDir(filePath, this.allowedDir);\n if (denied) {\n return denied;\n }\n\n try {\n const dir = dirname(filePath);\n if (!existsSync(dir)) {\n mkdirSync(dir, { recursive: true });\n }\n writeFileSync(filePath, content, \"utf8\");\n return `Written ${content.length} chars to ${filePath}`;\n } catch (error) {\n return `Error writing file: ${error instanceof Error ? error.message : error}`;\n }\n }\n}\n\n/** Edit a file by replacing text. */\nexport class EditFileTool extends Tool {\n readonly name = \"edit_file\";\n readonly description =\n \"Edit a file by replacing the first occurrence of old_text with new_text. Provide enough context in old_text to uniquely identify the target.\";\n readonly parameters = {\n properties: {\n path: { type: \"string\", description: \"File path to edit\" },\n old_text: { type: \"string\", description: \"Text to find and replace\" },\n new_text: { type: \"string\", description: \"Replacement text\" },\n },\n required: [\"path\", \"old_text\", \"new_text\"],\n type: \"object\",\n };\n\n private allowedDir?: string;\n\n constructor(params?: { allowedDir?: string }) {\n super();\n this.allowedDir = params?.allowedDir;\n }\n\n async execute(args: Record<string, unknown>): Promise<string> {\n const filePath = String(args.path);\n const oldText = String(args.old_text);\n const newText = String(args.new_text);\n\n const denied = checkWriteAllowedDir(filePath, this.allowedDir);\n if (denied) {\n return denied;\n }\n\n try {\n if (!existsSync(filePath)) {\n return `Error: File not found: ${filePath}`;\n }\n const content = readFileSync(filePath, \"utf8\");\n if (!content.includes(oldText)) {\n return `Error: old_text not found in ${filePath}`;\n }\n const newContent = content.replace(oldText, newText);\n writeFileSync(filePath, newContent, \"utf8\");\n return `Edited ${filePath}: replaced ${oldText.length} chars`;\n } catch (error) {\n return `Error editing file: ${error instanceof Error ? error.message : error}`;\n }\n }\n}\n\n/** List directory contents. */\nexport class ListDirTool extends Tool {\n readonly name = \"list_dir\";\n readonly description = \"List files and directories at the given path.\";\n readonly parameters = {\n properties: {\n path: { type: \"string\", description: \"Directory path to list\" },\n },\n required: [\"path\"],\n type: \"object\",\n };\n\n private allowedDir?: string;\n private readOnlyPaths?: string[];\n\n constructor(params?: { allowedDir?: string; readOnlyPaths?: string[] }) {\n super();\n this.allowedDir = params?.allowedDir;\n this.readOnlyPaths = params?.readOnlyPaths;\n }\n\n async execute(args: Record<string, unknown>): Promise<string> {\n const dirPath = String(args.path);\n\n const denied = checkAllowedDir(\n dirPath,\n this.allowedDir,\n this.readOnlyPaths\n );\n if (denied) {\n return denied;\n }\n\n try {\n if (!existsSync(dirPath)) {\n return `Error: Directory not found: ${dirPath}`;\n }\n const entries = readdirSync(dirPath);\n const lines: string[] = [];\n for (const entry of entries) {\n try {\n const fullPath = join(dirPath, entry);\n const stat = statSync(fullPath);\n const type = stat.isDirectory() ? \"dir\" : \"file\";\n const size = stat.isDirectory() ? \"\" : ` (${stat.size}b)`;\n lines.push(`${type}\\t${entry}${size}`);\n } catch {\n lines.push(`?\\t${entry}`);\n }\n }\n return lines.length > 0 ? lines.join(\"\\n\") : \"(empty directory)\";\n } catch (error) {\n return `Error listing directory: ${error instanceof Error ? error.message : error}`;\n }\n }\n}\n"],"mappings":";;;;;;AAaA,SAAS,gBACP,UACA,YACA,eACe;AACf,KAAI,CAAC,WACH,QAAO;CAET,MAAM,WAAW,QAAQ,SAAS;CAClC,MAAM,UAAU,QAAQ,WAAW;AACnC,KAAI,SAAS,WAAW,UAAU,IAAI,IAAI,aAAa,QACrD,QAAO;AAGT,KAAI,cACF,MAAK,MAAM,MAAM,eAAe;EAC9B,MAAM,aAAa,QAAQ,GAAG;AAC9B,MAAI,SAAS,WAAW,aAAa,IAAI,IAAI,aAAa,WACxD,QAAO;;AAIb,QAAO,8CAA8C;;;AAIvD,SAAS,qBACP,UACA,YACe;AACf,KAAI,CAAC,WACH,QAAO;CAET,MAAM,WAAW,QAAQ,SAAS;CAClC,MAAM,UAAU,QAAQ,WAAW;AACnC,KAAI,CAAC,SAAS,WAAW,UAAU,IAAI,IAAI,aAAa,QACtD,QAAO,8CAA8C;AAEvD,QAAO;;;AAIT,IAAa,eAAb,cAAkC,KAAK;CACrC,AAAS,OAAO;CAChB,AAAS,cAAc;CACvB,AAAS,aAAa;EACpB,YAAY;GACV,MAAM;IAAE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ClB,MAAM;EACP;CAED,AAAQ;CACR,AAAQ;CAER,YAAY,QAA4D;AACtE,SAAO;AACP,OAAK,aAAa,QAAQ;AAC1B,OAAK,gBAAgB,QAAQ;;CAG/B,MAAM,QAAQ,MAAgD;EAC5D,MAAM,UAAU,OAAO,KAAK,KAAK;EAEjC,MAAM,SAAS,gBACb,SACA,KAAK,YACL,KAAK,cACN;AACD,MAAI,OACF,QAAO;AAGT,MAAI;AACF,OAAI,CAAC,WAAW,QAAQ,CACtB,QAAO,+BAA+B;GAExC,MAAM,UAAU,YAAY,QAAQ;GACpC,MAAM,QAAkB,EAAE;AAC1B,QAAK,MAAM,SAAS,QAClB,KAAI;IAEF,MAAM,OAAO,SADI,KAAK,SAAS,MAAM,CACN;IAC/B,MAAM,OAAO,KAAK,aAAa,GAAG,QAAQ;IAC1C,MAAM,OAAO,KAAK,aAAa,GAAG,KAAK,KAAK,KAAK,KAAK;AACtD,UAAM,KAAK,GAAG,KAAK,IAAI,QAAQ,OAAO;WAChC;AACN,UAAM,KAAK,MAAM,QAAQ;;AAG7B,UAAO,MAAM,SAAS,IAAI,MAAM,KAAK,KAAK,GAAG;WACtC,OAAO;AACd,UAAO,4BAA4B,iBAAiB,QAAQ,MAAM,UAAU"}
|
|
@@ -12,7 +12,6 @@ declare class FlexTool extends Tool {
|
|
|
12
12
|
readonly name = "flex_message";
|
|
13
13
|
readonly description = "Build a LINE Flex Message from a template. Returns JSON that will be rendered as a rich card in LINE. Use this instead of outputting raw JSON.";
|
|
14
14
|
readonly parameters: {
|
|
15
|
-
type: string;
|
|
16
15
|
properties: {
|
|
17
16
|
template: {
|
|
18
17
|
type: string;
|
|
@@ -154,6 +153,7 @@ declare class FlexTool extends Tool {
|
|
|
154
153
|
};
|
|
155
154
|
};
|
|
156
155
|
required: string[];
|
|
156
|
+
type: string;
|
|
157
157
|
};
|
|
158
158
|
execute(args: Record<string, unknown>): Promise<string>;
|
|
159
159
|
private buildFortune;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flex.d.mts","names":[],"sources":["../../../src/agent/tools/flex.ts"],"mappings":";;;;;AASA;;;;;cAAa,QAAA,SAAiB,IAAA;EAAA,SACnB,IAAA;EAAA,SACA,WAAA;EAAA,SAEA,UAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"flex.d.mts","names":[],"sources":["../../../src/agent/tools/flex.ts"],"mappings":";;;;;AASA;;;;;cAAa,QAAA,SAAiB,IAAA;EAAA,SACnB,IAAA;EAAA,SACA,WAAA;EAAA,SAEA,UAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgHH,OAAA,CAAQ,IAAA,EAAM,MAAA,oBAA0B,OAAA;EAAA,QAgDtC,YAAA;EAAA,QA4EA,aAAA;EAAA,QA8BA,kBAAA;EAAA,QAwCA,YAAA;EAAA,QA+CA,mBAAA;EAAA,QA2EA,cAAA;EAAA,QAwCA,WAAA;AAAA"}
|