plugsuits 1.0.0
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/cli.js +3 -0
- package/dist/agent-reasoning-default.test.d.ts +2 -0
- package/dist/agent-reasoning-default.test.d.ts.map +1 -0
- package/dist/agent-reasoning-default.test.js +38 -0
- package/dist/agent-reasoning-default.test.js.map +1 -0
- package/dist/agent.d.ts +61 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +308 -0
- package/dist/agent.js.map +1 -0
- package/dist/agent.test.d.ts +2 -0
- package/dist/agent.test.d.ts.map +1 -0
- package/dist/agent.test.js +38 -0
- package/dist/agent.test.js.map +1 -0
- package/dist/cli-args.d.ts +15 -0
- package/dist/cli-args.d.ts.map +1 -0
- package/dist/cli-args.js +63 -0
- package/dist/cli-args.js.map +1 -0
- package/dist/cli-args.test.d.ts +2 -0
- package/dist/cli-args.test.d.ts.map +1 -0
- package/dist/cli-args.test.js +105 -0
- package/dist/cli-args.test.js.map +1 -0
- package/dist/commands/aliases-and-tool-fallback.test.d.ts +2 -0
- package/dist/commands/aliases-and-tool-fallback.test.d.ts.map +1 -0
- package/dist/commands/aliases-and-tool-fallback.test.js +132 -0
- package/dist/commands/aliases-and-tool-fallback.test.js.map +1 -0
- package/dist/commands/clear.d.ts +3 -0
- package/dist/commands/clear.d.ts.map +1 -0
- package/dist/commands/clear.js +12 -0
- package/dist/commands/clear.js.map +1 -0
- package/dist/commands/factories/create-toggle-command.d.ts +13 -0
- package/dist/commands/factories/create-toggle-command.d.ts.map +1 -0
- package/dist/commands/factories/create-toggle-command.js +38 -0
- package/dist/commands/factories/create-toggle-command.js.map +1 -0
- package/dist/commands/help.d.ts +3 -0
- package/dist/commands/help.d.ts.map +1 -0
- package/dist/commands/help.js +23 -0
- package/dist/commands/help.js.map +1 -0
- package/dist/commands/index.d.ts +18 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +82 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/model.d.ts +15 -0
- package/dist/commands/model.d.ts.map +1 -0
- package/dist/commands/model.js +100 -0
- package/dist/commands/model.js.map +1 -0
- package/dist/commands/reasoning-mode.d.ts +3 -0
- package/dist/commands/reasoning-mode.d.ts.map +1 -0
- package/dist/commands/reasoning-mode.js +47 -0
- package/dist/commands/reasoning-mode.js.map +1 -0
- package/dist/commands/render.d.ts +19 -0
- package/dist/commands/render.d.ts.map +1 -0
- package/dist/commands/render.js +140 -0
- package/dist/commands/render.js.map +1 -0
- package/dist/commands/render.test.d.ts +2 -0
- package/dist/commands/render.test.d.ts.map +1 -0
- package/dist/commands/render.test.js +36 -0
- package/dist/commands/render.test.js.map +1 -0
- package/dist/commands/tool-fallback.d.ts +3 -0
- package/dist/commands/tool-fallback.d.ts.map +1 -0
- package/dist/commands/tool-fallback.js +38 -0
- package/dist/commands/tool-fallback.js.map +1 -0
- package/dist/commands/translate.d.ts +3 -0
- package/dist/commands/translate.d.ts.map +1 -0
- package/dist/commands/translate.js +12 -0
- package/dist/commands/translate.js.map +1 -0
- package/dist/commands/translate.test.d.ts +2 -0
- package/dist/commands/translate.test.d.ts.map +1 -0
- package/dist/commands/translate.test.js +49 -0
- package/dist/commands/translate.test.js.map +1 -0
- package/dist/commands/types.d.ts +17 -0
- package/dist/commands/types.d.ts.map +1 -0
- package/dist/commands/types.js +2 -0
- package/dist/commands/types.js.map +1 -0
- package/dist/context/environment-context.d.ts +2 -0
- package/dist/context/environment-context.d.ts.map +1 -0
- package/dist/context/environment-context.js +11 -0
- package/dist/context/environment-context.js.map +1 -0
- package/dist/context/paths.d.ts +3 -0
- package/dist/context/paths.d.ts.map +1 -0
- package/dist/context/paths.js +3 -0
- package/dist/context/paths.js.map +1 -0
- package/dist/context/session.d.ts +4 -0
- package/dist/context/session.d.ts.map +1 -0
- package/dist/context/session.js +16 -0
- package/dist/context/session.js.map +1 -0
- package/dist/context/skill-command-prefix.d.ts +4 -0
- package/dist/context/skill-command-prefix.d.ts.map +1 -0
- package/dist/context/skill-command-prefix.js +15 -0
- package/dist/context/skill-command-prefix.js.map +1 -0
- package/dist/context/skills-integration.test.d.ts +2 -0
- package/dist/context/skills-integration.test.d.ts.map +1 -0
- package/dist/context/skills-integration.test.js +87 -0
- package/dist/context/skills-integration.test.js.map +1 -0
- package/dist/context/skills.d.ts +18 -0
- package/dist/context/skills.d.ts.map +1 -0
- package/dist/context/skills.js +431 -0
- package/dist/context/skills.js.map +1 -0
- package/dist/context/skills.test.d.ts +2 -0
- package/dist/context/skills.test.d.ts.map +1 -0
- package/dist/context/skills.test.js +20 -0
- package/dist/context/skills.test.js.map +1 -0
- package/dist/context/system-prompt.d.ts +2 -0
- package/dist/context/system-prompt.d.ts.map +1 -0
- package/dist/context/system-prompt.js +100 -0
- package/dist/context/system-prompt.js.map +1 -0
- package/dist/context/translation-integration.test.d.ts +2 -0
- package/dist/context/translation-integration.test.d.ts.map +1 -0
- package/dist/context/translation-integration.test.js +138 -0
- package/dist/context/translation-integration.test.js.map +1 -0
- package/dist/context/translation.d.ts +21 -0
- package/dist/context/translation.d.ts.map +1 -0
- package/dist/context/translation.js +82 -0
- package/dist/context/translation.js.map +1 -0
- package/dist/context/translation.test.d.ts +2 -0
- package/dist/context/translation.test.d.ts.map +1 -0
- package/dist/context/translation.test.js +129 -0
- package/dist/context/translation.test.js.map +1 -0
- package/dist/entrypoints/cli-input-rendering.test.d.ts +2 -0
- package/dist/entrypoints/cli-input-rendering.test.d.ts.map +1 -0
- package/dist/entrypoints/cli-input-rendering.test.js +192 -0
- package/dist/entrypoints/cli-input-rendering.test.js.map +1 -0
- package/dist/entrypoints/cli.d.ts +3 -0
- package/dist/entrypoints/cli.d.ts.map +1 -0
- package/dist/entrypoints/cli.js +1268 -0
- package/dist/entrypoints/cli.js.map +1 -0
- package/dist/entrypoints/headless-agent-config.d.ts +21 -0
- package/dist/entrypoints/headless-agent-config.d.ts.map +1 -0
- package/dist/entrypoints/headless-agent-config.js +15 -0
- package/dist/entrypoints/headless-agent-config.js.map +1 -0
- package/dist/entrypoints/headless-agent-config.test.d.ts +2 -0
- package/dist/entrypoints/headless-agent-config.test.d.ts.map +1 -0
- package/dist/entrypoints/headless-agent-config.test.js +63 -0
- package/dist/entrypoints/headless-agent-config.test.js.map +1 -0
- package/dist/entrypoints/headless.d.ts +3 -0
- package/dist/entrypoints/headless.d.ts.map +1 -0
- package/dist/entrypoints/headless.js +396 -0
- package/dist/entrypoints/headless.js.map +1 -0
- package/dist/env.d.ts +8 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +14 -0
- package/dist/env.js.map +1 -0
- package/dist/friendli-models.d.ts +21 -0
- package/dist/friendli-models.d.ts.map +1 -0
- package/dist/friendli-models.js +57 -0
- package/dist/friendli-models.js.map +1 -0
- package/dist/friendli-reasoning.d.ts +10 -0
- package/dist/friendli-reasoning.d.ts.map +1 -0
- package/dist/friendli-reasoning.js +181 -0
- package/dist/friendli-reasoning.js.map +1 -0
- package/dist/friendli-reasoning.test.d.ts +2 -0
- package/dist/friendli-reasoning.test.d.ts.map +1 -0
- package/dist/friendli-reasoning.test.js +77 -0
- package/dist/friendli-reasoning.test.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/interaction/colors.d.ts +22 -0
- package/dist/interaction/colors.d.ts.map +1 -0
- package/dist/interaction/colors.js +24 -0
- package/dist/interaction/colors.js.map +1 -0
- package/dist/interaction/pi-tui-stream-renderer.d.ts +19 -0
- package/dist/interaction/pi-tui-stream-renderer.d.ts.map +1 -0
- package/dist/interaction/pi-tui-stream-renderer.js +1509 -0
- package/dist/interaction/pi-tui-stream-renderer.js.map +1 -0
- package/dist/interaction/pi-tui-stream-renderer.test.d.ts +2 -0
- package/dist/interaction/pi-tui-stream-renderer.test.d.ts.map +1 -0
- package/dist/interaction/pi-tui-stream-renderer.test.js +1314 -0
- package/dist/interaction/pi-tui-stream-renderer.test.js.map +1 -0
- package/dist/interaction/spinner.d.ts +13 -0
- package/dist/interaction/spinner.d.ts.map +1 -0
- package/dist/interaction/spinner.js +51 -0
- package/dist/interaction/spinner.js.map +1 -0
- package/dist/middleware/index.d.ts +7 -0
- package/dist/middleware/index.d.ts.map +1 -0
- package/dist/middleware/index.js +15 -0
- package/dist/middleware/index.js.map +1 -0
- package/dist/middleware/todo-continuation.d.ts +11 -0
- package/dist/middleware/todo-continuation.d.ts.map +1 -0
- package/dist/middleware/todo-continuation.js +103 -0
- package/dist/middleware/todo-continuation.js.map +1 -0
- package/dist/middleware/trim-leading-newlines.d.ts +3 -0
- package/dist/middleware/trim-leading-newlines.d.ts.map +1 -0
- package/dist/middleware/trim-leading-newlines.js +49 -0
- package/dist/middleware/trim-leading-newlines.js.map +1 -0
- package/dist/reasoning-mode.d.ts +5 -0
- package/dist/reasoning-mode.d.ts.map +1 -0
- package/dist/reasoning-mode.js +30 -0
- package/dist/reasoning-mode.js.map +1 -0
- package/dist/reasoning-mode.test.d.ts +2 -0
- package/dist/reasoning-mode.test.d.ts.map +1 -0
- package/dist/reasoning-mode.test.js +22 -0
- package/dist/reasoning-mode.test.js.map +1 -0
- package/dist/tool-fallback-mode.d.ts +6 -0
- package/dist/tool-fallback-mode.d.ts.map +1 -0
- package/dist/tool-fallback-mode.js +25 -0
- package/dist/tool-fallback-mode.js.map +1 -0
- package/dist/tools/execute/shell-execute.d.ts +17 -0
- package/dist/tools/execute/shell-execute.d.ts.map +1 -0
- package/dist/tools/execute/shell-execute.js +55 -0
- package/dist/tools/execute/shell-execute.js.map +1 -0
- package/dist/tools/execute/shell-execute.test.d.ts +2 -0
- package/dist/tools/execute/shell-execute.test.d.ts.map +1 -0
- package/dist/tools/execute/shell-execute.test.js +86 -0
- package/dist/tools/execute/shell-execute.test.js.map +1 -0
- package/dist/tools/execute/shell-interact.d.ts +10 -0
- package/dist/tools/execute/shell-interact.d.ts.map +1 -0
- package/dist/tools/execute/shell-interact.js +122 -0
- package/dist/tools/execute/shell-interact.js.map +1 -0
- package/dist/tools/execute/shell-interact.test.d.ts +2 -0
- package/dist/tools/execute/shell-interact.test.d.ts.map +1 -0
- package/dist/tools/execute/shell-interact.test.js +175 -0
- package/dist/tools/execute/shell-interact.test.js.map +1 -0
- package/dist/tools/explore/glob.d.ts +15 -0
- package/dist/tools/explore/glob.d.ts.map +1 -0
- package/dist/tools/explore/glob.js +107 -0
- package/dist/tools/explore/glob.js.map +1 -0
- package/dist/tools/explore/glob.test.d.ts +2 -0
- package/dist/tools/explore/glob.test.d.ts.map +1 -0
- package/dist/tools/explore/glob.test.js +183 -0
- package/dist/tools/explore/glob.test.js.map +1 -0
- package/dist/tools/explore/grep.d.ts +27 -0
- package/dist/tools/explore/grep.d.ts.map +1 -0
- package/dist/tools/explore/grep.js +203 -0
- package/dist/tools/explore/grep.js.map +1 -0
- package/dist/tools/explore/grep.test.d.ts +2 -0
- package/dist/tools/explore/grep.test.d.ts.map +1 -0
- package/dist/tools/explore/grep.test.js +132 -0
- package/dist/tools/explore/grep.test.js.map +1 -0
- package/dist/tools/explore/read-file.d.ts +23 -0
- package/dist/tools/explore/read-file.d.ts.map +1 -0
- package/dist/tools/explore/read-file.js +84 -0
- package/dist/tools/explore/read-file.js.map +1 -0
- package/dist/tools/explore/read-file.test.d.ts +2 -0
- package/dist/tools/explore/read-file.test.d.ts.map +1 -0
- package/dist/tools/explore/read-file.test.js +278 -0
- package/dist/tools/explore/read-file.test.js.map +1 -0
- package/dist/tools/index.d.ts +71 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +26 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/modify/delete-file.d.ts +19 -0
- package/dist/tools/modify/delete-file.d.ts.map +1 -0
- package/dist/tools/modify/delete-file.js +71 -0
- package/dist/tools/modify/delete-file.js.map +1 -0
- package/dist/tools/modify/delete-file.test.d.ts +2 -0
- package/dist/tools/modify/delete-file.test.d.ts.map +1 -0
- package/dist/tools/modify/delete-file.test.js +136 -0
- package/dist/tools/modify/delete-file.test.js.map +1 -0
- package/dist/tools/modify/edit-file-diagnostics.d.ts +17 -0
- package/dist/tools/modify/edit-file-diagnostics.d.ts.map +1 -0
- package/dist/tools/modify/edit-file-diagnostics.js +157 -0
- package/dist/tools/modify/edit-file-diagnostics.js.map +1 -0
- package/dist/tools/modify/edit-file-repair.d.ts +13 -0
- package/dist/tools/modify/edit-file-repair.d.ts.map +1 -0
- package/dist/tools/modify/edit-file-repair.js +135 -0
- package/dist/tools/modify/edit-file-repair.js.map +1 -0
- package/dist/tools/modify/edit-file-stress.test.d.ts +2 -0
- package/dist/tools/modify/edit-file-stress.test.d.ts.map +1 -0
- package/dist/tools/modify/edit-file-stress.test.js +163 -0
- package/dist/tools/modify/edit-file-stress.test.js.map +1 -0
- package/dist/tools/modify/edit-file-validation.d.ts +9 -0
- package/dist/tools/modify/edit-file-validation.d.ts.map +1 -0
- package/dist/tools/modify/edit-file-validation.js +86 -0
- package/dist/tools/modify/edit-file-validation.js.map +1 -0
- package/dist/tools/modify/edit-file-whitespace.test.d.ts +2 -0
- package/dist/tools/modify/edit-file-whitespace.test.d.ts.map +1 -0
- package/dist/tools/modify/edit-file-whitespace.test.js +90 -0
- package/dist/tools/modify/edit-file-whitespace.test.js.map +1 -0
- package/dist/tools/modify/edit-file.d.ts +33 -0
- package/dist/tools/modify/edit-file.d.ts.map +1 -0
- package/dist/tools/modify/edit-file.js +177 -0
- package/dist/tools/modify/edit-file.js.map +1 -0
- package/dist/tools/modify/edit-file.test.d.ts +2 -0
- package/dist/tools/modify/edit-file.test.d.ts.map +1 -0
- package/dist/tools/modify/edit-file.test.js +948 -0
- package/dist/tools/modify/edit-file.test.js.map +1 -0
- package/dist/tools/modify/write-file.d.ts +17 -0
- package/dist/tools/modify/write-file.d.ts.map +1 -0
- package/dist/tools/modify/write-file.js +39 -0
- package/dist/tools/modify/write-file.js.map +1 -0
- package/dist/tools/modify/write-file.test.d.ts +2 -0
- package/dist/tools/modify/write-file.test.d.ts.map +1 -0
- package/dist/tools/modify/write-file.test.js +168 -0
- package/dist/tools/modify/write-file.test.js.map +1 -0
- package/dist/tools/planning/load-skill.d.ts +13 -0
- package/dist/tools/planning/load-skill.d.ts.map +1 -0
- package/dist/tools/planning/load-skill.js +101 -0
- package/dist/tools/planning/load-skill.js.map +1 -0
- package/dist/tools/planning/load-skill.test.d.ts +2 -0
- package/dist/tools/planning/load-skill.test.d.ts.map +1 -0
- package/dist/tools/planning/load-skill.test.js +37 -0
- package/dist/tools/planning/load-skill.test.js.map +1 -0
- package/dist/tools/planning/todo-write.d.ts +49 -0
- package/dist/tools/planning/todo-write.d.ts.map +1 -0
- package/dist/tools/planning/todo-write.js +118 -0
- package/dist/tools/planning/todo-write.js.map +1 -0
- package/dist/tools/planning/todo-write.test.d.ts +2 -0
- package/dist/tools/planning/todo-write.test.d.ts.map +1 -0
- package/dist/tools/planning/todo-write.test.js +82 -0
- package/dist/tools/planning/todo-write.test.js.map +1 -0
- package/dist/tools/utils/execute/format-utils.d.ts +4 -0
- package/dist/tools/utils/execute/format-utils.d.ts.map +1 -0
- package/dist/tools/utils/execute/format-utils.js +31 -0
- package/dist/tools/utils/execute/format-utils.js.map +1 -0
- package/dist/tools/utils/execute/format-utils.test.d.ts +2 -0
- package/dist/tools/utils/execute/format-utils.test.d.ts.map +1 -0
- package/dist/tools/utils/execute/format-utils.test.js +40 -0
- package/dist/tools/utils/execute/format-utils.test.js.map +1 -0
- package/dist/tools/utils/execute/noninteractive-wrapper.d.ts +12 -0
- package/dist/tools/utils/execute/noninteractive-wrapper.d.ts.map +1 -0
- package/dist/tools/utils/execute/noninteractive-wrapper.js +269 -0
- package/dist/tools/utils/execute/noninteractive-wrapper.js.map +1 -0
- package/dist/tools/utils/execute/noninteractive-wrapper.test.d.ts +2 -0
- package/dist/tools/utils/execute/noninteractive-wrapper.test.d.ts.map +1 -0
- package/dist/tools/utils/execute/noninteractive-wrapper.test.js +233 -0
- package/dist/tools/utils/execute/noninteractive-wrapper.test.js.map +1 -0
- package/dist/tools/utils/execute/output-handler.d.ts +14 -0
- package/dist/tools/utils/execute/output-handler.d.ts.map +1 -0
- package/dist/tools/utils/execute/output-handler.js +71 -0
- package/dist/tools/utils/execute/output-handler.js.map +1 -0
- package/dist/tools/utils/execute/output-handler.test.d.ts +2 -0
- package/dist/tools/utils/execute/output-handler.test.d.ts.map +1 -0
- package/dist/tools/utils/execute/output-handler.test.js +58 -0
- package/dist/tools/utils/execute/output-handler.test.js.map +1 -0
- package/dist/tools/utils/execute/process-manager.d.ts +17 -0
- package/dist/tools/utils/execute/process-manager.d.ts.map +1 -0
- package/dist/tools/utils/execute/process-manager.js +229 -0
- package/dist/tools/utils/execute/process-manager.js.map +1 -0
- package/dist/tools/utils/execute/process-manager.test.d.ts +2 -0
- package/dist/tools/utils/execute/process-manager.test.d.ts.map +1 -0
- package/dist/tools/utils/execute/process-manager.test.js +139 -0
- package/dist/tools/utils/execute/process-manager.test.js.map +1 -0
- package/dist/tools/utils/execute/shell-detection.d.ts +3 -0
- package/dist/tools/utils/execute/shell-detection.d.ts.map +1 -0
- package/dist/tools/utils/execute/shell-detection.js +56 -0
- package/dist/tools/utils/execute/shell-detection.js.map +1 -0
- package/dist/tools/utils/execute/shell-detection.test.d.ts +2 -0
- package/dist/tools/utils/execute/shell-detection.test.d.ts.map +1 -0
- package/dist/tools/utils/execute/shell-detection.test.js +86 -0
- package/dist/tools/utils/execute/shell-detection.test.js.map +1 -0
- package/dist/tools/utils/hashline/autocorrect-replacement-lines.d.ts +5 -0
- package/dist/tools/utils/hashline/autocorrect-replacement-lines.d.ts.map +1 -0
- package/dist/tools/utils/hashline/autocorrect-replacement-lines.js +113 -0
- package/dist/tools/utils/hashline/autocorrect-replacement-lines.js.map +1 -0
- package/dist/tools/utils/hashline/constants.d.ts +5 -0
- package/dist/tools/utils/hashline/constants.d.ts.map +1 -0
- package/dist/tools/utils/hashline/constants.js +11 -0
- package/dist/tools/utils/hashline/constants.js.map +1 -0
- package/dist/tools/utils/hashline/diff-utils.d.ts +7 -0
- package/dist/tools/utils/hashline/diff-utils.d.ts.map +1 -0
- package/dist/tools/utils/hashline/diff-utils.js +50 -0
- package/dist/tools/utils/hashline/diff-utils.js.map +1 -0
- package/dist/tools/utils/hashline/diff-utils.test.d.ts +2 -0
- package/dist/tools/utils/hashline/diff-utils.test.d.ts.map +1 -0
- package/dist/tools/utils/hashline/diff-utils.test.js +46 -0
- package/dist/tools/utils/hashline/diff-utils.test.js.map +1 -0
- package/dist/tools/utils/hashline/edit-deduplication.d.ts +6 -0
- package/dist/tools/utils/hashline/edit-deduplication.d.ts.map +1 -0
- package/dist/tools/utils/hashline/edit-deduplication.js +32 -0
- package/dist/tools/utils/hashline/edit-deduplication.js.map +1 -0
- package/dist/tools/utils/hashline/edit-operation-primitives.d.ts +11 -0
- package/dist/tools/utils/hashline/edit-operation-primitives.d.ts.map +1 -0
- package/dist/tools/utils/hashline/edit-operation-primitives.js +93 -0
- package/dist/tools/utils/hashline/edit-operation-primitives.js.map +1 -0
- package/dist/tools/utils/hashline/edit-operations.d.ts +9 -0
- package/dist/tools/utils/hashline/edit-operations.d.ts.map +1 -0
- package/dist/tools/utils/hashline/edit-operations.js +101 -0
- package/dist/tools/utils/hashline/edit-operations.js.map +1 -0
- package/dist/tools/utils/hashline/edit-operations.test.d.ts +2 -0
- package/dist/tools/utils/hashline/edit-operations.test.d.ts.map +1 -0
- package/dist/tools/utils/hashline/edit-operations.test.js +135 -0
- package/dist/tools/utils/hashline/edit-operations.test.js.map +1 -0
- package/dist/tools/utils/hashline/edit-ordering.d.ts +5 -0
- package/dist/tools/utils/hashline/edit-ordering.d.ts.map +1 -0
- package/dist/tools/utils/hashline/edit-ordering.js +54 -0
- package/dist/tools/utils/hashline/edit-ordering.js.map +1 -0
- package/dist/tools/utils/hashline/edit-text-normalization.d.ts +9 -0
- package/dist/tools/utils/hashline/edit-text-normalization.d.ts.map +1 -0
- package/dist/tools/utils/hashline/edit-text-normalization.js +135 -0
- package/dist/tools/utils/hashline/edit-text-normalization.js.map +1 -0
- package/dist/tools/utils/hashline/file-text-canonicalization.d.ts +8 -0
- package/dist/tools/utils/hashline/file-text-canonicalization.d.ts.map +1 -0
- package/dist/tools/utils/hashline/file-text-canonicalization.js +42 -0
- package/dist/tools/utils/hashline/file-text-canonicalization.js.map +1 -0
- package/dist/tools/utils/hashline/hash-computation.d.ts +14 -0
- package/dist/tools/utils/hashline/hash-computation.d.ts.map +1 -0
- package/dist/tools/utils/hashline/hash-computation.js +158 -0
- package/dist/tools/utils/hashline/hash-computation.js.map +1 -0
- package/dist/tools/utils/hashline/hash-computation.test.d.ts +2 -0
- package/dist/tools/utils/hashline/hash-computation.test.d.ts.map +1 -0
- package/dist/tools/utils/hashline/hash-computation.test.js +63 -0
- package/dist/tools/utils/hashline/hash-computation.test.js.map +1 -0
- package/dist/tools/utils/hashline/hashline-chunk-formatter.d.ts +11 -0
- package/dist/tools/utils/hashline/hashline-chunk-formatter.d.ts.map +1 -0
- package/dist/tools/utils/hashline/hashline-chunk-formatter.js +41 -0
- package/dist/tools/utils/hashline/hashline-chunk-formatter.js.map +1 -0
- package/dist/tools/utils/hashline/hashline-edit-diff.d.ts +2 -0
- package/dist/tools/utils/hashline/hashline-edit-diff.d.ts.map +1 -0
- package/dist/tools/utils/hashline/hashline-edit-diff.js +27 -0
- package/dist/tools/utils/hashline/hashline-edit-diff.js.map +1 -0
- package/dist/tools/utils/hashline/index.d.ts +14 -0
- package/dist/tools/utils/hashline/index.d.ts.map +1 -0
- package/dist/tools/utils/hashline/index.js +11 -0
- package/dist/tools/utils/hashline/index.js.map +1 -0
- package/dist/tools/utils/hashline/merge-expansion.d.ts +4 -0
- package/dist/tools/utils/hashline/merge-expansion.d.ts.map +1 -0
- package/dist/tools/utils/hashline/merge-expansion.js +105 -0
- package/dist/tools/utils/hashline/merge-expansion.js.map +1 -0
- package/dist/tools/utils/hashline/normalize-edits.d.ts +11 -0
- package/dist/tools/utils/hashline/normalize-edits.d.ts.map +1 -0
- package/dist/tools/utils/hashline/normalize-edits.js +81 -0
- package/dist/tools/utils/hashline/normalize-edits.js.map +1 -0
- package/dist/tools/utils/hashline/types.d.ts +18 -0
- package/dist/tools/utils/hashline/types.d.ts.map +1 -0
- package/dist/tools/utils/hashline/types.js +2 -0
- package/dist/tools/utils/hashline/types.js.map +1 -0
- package/dist/tools/utils/hashline/validation.d.ts +19 -0
- package/dist/tools/utils/hashline/validation.d.ts.map +1 -0
- package/dist/tools/utils/hashline/validation.js +161 -0
- package/dist/tools/utils/hashline/validation.js.map +1 -0
- package/dist/tools/utils/hashline/validation.test.d.ts +2 -0
- package/dist/tools/utils/hashline/validation.test.d.ts.map +1 -0
- package/dist/tools/utils/hashline/validation.test.js +86 -0
- package/dist/tools/utils/hashline/validation.test.js.map +1 -0
- package/dist/tools/utils/safety-utils.d.ts +66 -0
- package/dist/tools/utils/safety-utils.d.ts.map +1 -0
- package/dist/tools/utils/safety-utils.js +681 -0
- package/dist/tools/utils/safety-utils.js.map +1 -0
- package/dist/utils/tools-manager.d.ts +16 -0
- package/dist/utils/tools-manager.d.ts.map +1 -0
- package/dist/utils/tools-manager.js +257 -0
- package/dist/utils/tools-manager.js.map +1 -0
- package/package.json +49 -0
- package/src/AGENTS.md +52 -0
- package/src/agent-reasoning-default.test.ts +48 -0
- package/src/agent.test.ts +49 -0
- package/src/agent.ts +455 -0
- package/src/cli-args.test.ts +152 -0
- package/src/cli-args.ts +90 -0
- package/src/commands/aliases-and-tool-fallback.test.ts +172 -0
- package/src/commands/clear.ts +14 -0
- package/src/commands/factories/create-toggle-command.ts +68 -0
- package/src/commands/help.ts +30 -0
- package/src/commands/index.ts +125 -0
- package/src/commands/model.ts +146 -0
- package/src/commands/reasoning-mode.ts +55 -0
- package/src/commands/render.test.ts +47 -0
- package/src/commands/render.ts +205 -0
- package/src/commands/tool-fallback.ts +47 -0
- package/src/commands/translate.test.ts +62 -0
- package/src/commands/translate.ts +14 -0
- package/src/commands/types.ts +18 -0
- package/src/context/environment-context.ts +11 -0
- package/src/context/paths.ts +2 -0
- package/src/context/session.ts +18 -0
- package/src/context/skill-command-prefix.ts +18 -0
- package/src/context/skills-integration.test.ts +113 -0
- package/src/context/skills.test.ts +25 -0
- package/src/context/skills.ts +566 -0
- package/src/context/system-prompt.ts +100 -0
- package/src/context/translation-integration.test.ts +194 -0
- package/src/context/translation.test.ts +186 -0
- package/src/context/translation.ts +122 -0
- package/src/entrypoints/AGENTS.md +33 -0
- package/src/entrypoints/cli-input-rendering.test.ts +236 -0
- package/src/entrypoints/cli.ts +1845 -0
- package/src/entrypoints/headless-agent-config.test.ts +82 -0
- package/src/entrypoints/headless-agent-config.ts +42 -0
- package/src/entrypoints/headless.ts +622 -0
- package/src/env.ts +14 -0
- package/src/friendli-models.ts +81 -0
- package/src/friendli-reasoning.test.ts +147 -0
- package/src/friendli-reasoning.ts +280 -0
- package/src/index.ts +3 -0
- package/src/interaction/colors.ts +24 -0
- package/src/interaction/pi-tui-stream-renderer.test.ts +1471 -0
- package/src/interaction/pi-tui-stream-renderer.ts +2150 -0
- package/src/interaction/spinner.ts +61 -0
- package/src/middleware/index.ts +32 -0
- package/src/middleware/todo-continuation.ts +128 -0
- package/src/middleware/trim-leading-newlines.ts +66 -0
- package/src/reasoning-mode.test.ts +24 -0
- package/src/reasoning-mode.ts +40 -0
- package/src/skills/example/SKILL.md +44 -0
- package/src/skills/example/references/api.md +37 -0
- package/src/skills/example/scripts/setup.sh +13 -0
- package/src/skills/git-workflow.md +405 -0
- package/src/tool-fallback-mode.ts +34 -0
- package/src/tools/AGENTS.md +44 -0
- package/src/tools/execute/shell-execute.test.ts +114 -0
- package/src/tools/execute/shell-execute.ts +74 -0
- package/src/tools/execute/shell-execute.txt +27 -0
- package/src/tools/execute/shell-interact.test.ts +236 -0
- package/src/tools/execute/shell-interact.ts +151 -0
- package/src/tools/execute/shell-interact.txt +15 -0
- package/src/tools/explore/glob-files.txt +8 -0
- package/src/tools/explore/glob.test.ts +217 -0
- package/src/tools/explore/glob.ts +137 -0
- package/src/tools/explore/grep-files.txt +12 -0
- package/src/tools/explore/grep.test.ts +183 -0
- package/src/tools/explore/grep.ts +266 -0
- package/src/tools/explore/read-file.test.ts +355 -0
- package/src/tools/explore/read-file.ts +102 -0
- package/src/tools/explore/read-file.txt +24 -0
- package/src/tools/index.ts +29 -0
- package/src/tools/modify/AGENTS.md +38 -0
- package/src/tools/modify/delete-file.test.ts +200 -0
- package/src/tools/modify/delete-file.ts +95 -0
- package/src/tools/modify/delete-file.txt +9 -0
- package/src/tools/modify/edit-file-diagnostics.ts +210 -0
- package/src/tools/modify/edit-file-repair.ts +183 -0
- package/src/tools/modify/edit-file-stress.test.ts +200 -0
- package/src/tools/modify/edit-file-validation.ts +134 -0
- package/src/tools/modify/edit-file-whitespace.test.ts +117 -0
- package/src/tools/modify/edit-file.test.ts +1231 -0
- package/src/tools/modify/edit-file.ts +252 -0
- package/src/tools/modify/edit-file.txt +73 -0
- package/src/tools/modify/write-file.test.ts +240 -0
- package/src/tools/modify/write-file.ts +56 -0
- package/src/tools/modify/write-file.txt +9 -0
- package/src/tools/planning/load-skill.test.ts +48 -0
- package/src/tools/planning/load-skill.ts +136 -0
- package/src/tools/planning/load-skill.txt +6 -0
- package/src/tools/planning/todo-write.test.ts +91 -0
- package/src/tools/planning/todo-write.ts +141 -0
- package/src/tools/planning/todo-write.txt +7 -0
- package/src/tools/utils/execute/format-utils.test.ts +53 -0
- package/src/tools/utils/execute/format-utils.ts +37 -0
- package/src/tools/utils/execute/noninteractive-wrapper.test.ts +306 -0
- package/src/tools/utils/execute/noninteractive-wrapper.ts +314 -0
- package/src/tools/utils/execute/output-handler.test.ts +72 -0
- package/src/tools/utils/execute/output-handler.ts +101 -0
- package/src/tools/utils/execute/process-manager.test.ts +175 -0
- package/src/tools/utils/execute/process-manager.ts +310 -0
- package/src/tools/utils/execute/shell-detection.test.ts +112 -0
- package/src/tools/utils/execute/shell-detection.ts +72 -0
- package/src/tools/utils/hashline/autocorrect-replacement-lines.ts +159 -0
- package/src/tools/utils/hashline/constants.ts +13 -0
- package/src/tools/utils/hashline/diff-utils.test.ts +61 -0
- package/src/tools/utils/hashline/diff-utils.ts +64 -0
- package/src/tools/utils/hashline/edit-deduplication.ts +40 -0
- package/src/tools/utils/hashline/edit-operation-primitives.ts +149 -0
- package/src/tools/utils/hashline/edit-operations.test.ts +154 -0
- package/src/tools/utils/hashline/edit-operations.ts +132 -0
- package/src/tools/utils/hashline/edit-ordering.ts +60 -0
- package/src/tools/utils/hashline/edit-text-normalization.ts +180 -0
- package/src/tools/utils/hashline/file-text-canonicalization.ts +58 -0
- package/src/tools/utils/hashline/hash-computation.test.ts +82 -0
- package/src/tools/utils/hashline/hash-computation.ts +199 -0
- package/src/tools/utils/hashline/hashline-chunk-formatter.ts +61 -0
- package/src/tools/utils/hashline/hashline-edit-diff.ts +35 -0
- package/src/tools/utils/hashline/index.ts +55 -0
- package/src/tools/utils/hashline/merge-expansion.ts +120 -0
- package/src/tools/utils/hashline/normalize-edits.ts +127 -0
- package/src/tools/utils/hashline/types.ts +20 -0
- package/src/tools/utils/hashline/validation.test.ts +109 -0
- package/src/tools/utils/hashline/validation.ts +212 -0
- package/src/tools/utils/safety-utils.ts +938 -0
- package/src/utils/tools-manager.ts +353 -0
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
|
|
2
|
+
import type { ModelMessage, ToolSet } from "ai";
|
|
3
|
+
import { generateText, wrapLanguageModel } from "ai";
|
|
4
|
+
import type { ModelType } from "../agent";
|
|
5
|
+
import { env } from "../env";
|
|
6
|
+
import {
|
|
7
|
+
applyFriendliInterleavedField,
|
|
8
|
+
buildFriendliChatTemplateKwargs,
|
|
9
|
+
} from "../friendli-reasoning";
|
|
10
|
+
import { colors } from "../interaction/colors";
|
|
11
|
+
import { Spinner } from "../interaction/spinner";
|
|
12
|
+
import { buildMiddlewares } from "../middleware";
|
|
13
|
+
import type { ReasoningMode } from "../reasoning-mode";
|
|
14
|
+
import type { ToolFallbackMode } from "../tool-fallback-mode";
|
|
15
|
+
import type { Command, CommandResult } from "./types";
|
|
16
|
+
|
|
17
|
+
interface RenderData {
|
|
18
|
+
instructions: string;
|
|
19
|
+
messages: ModelMessage[];
|
|
20
|
+
model: string;
|
|
21
|
+
modelType: ModelType;
|
|
22
|
+
reasoningMode: ReasoningMode;
|
|
23
|
+
toolFallbackMode: ToolFallbackMode;
|
|
24
|
+
tools: ToolSet;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const NEXT_USER_PROMPT_SENTINEL =
|
|
28
|
+
"THE NEXT USER PROMPT IS LOCATED HERE.";
|
|
29
|
+
|
|
30
|
+
export const appendNextUserPromptSentinel = (
|
|
31
|
+
messages: ModelMessage[]
|
|
32
|
+
): ModelMessage[] => {
|
|
33
|
+
return [
|
|
34
|
+
...messages,
|
|
35
|
+
{
|
|
36
|
+
role: "user",
|
|
37
|
+
content: NEXT_USER_PROMPT_SENTINEL,
|
|
38
|
+
},
|
|
39
|
+
];
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Render chat prompt to raw text.
|
|
44
|
+
*
|
|
45
|
+
* Why use generateText + capturedText pattern:
|
|
46
|
+
* - Request: Must go through AI SDK middleware and conversion layer
|
|
47
|
+
* to match actual API request format (tool definitions, message format, etc.)
|
|
48
|
+
* - Response: Must show raw text AS-IS, but AI SDK parses XML tool calls
|
|
49
|
+
* and strips them from result.text
|
|
50
|
+
*
|
|
51
|
+
* Solution: Capture raw API response before AI SDK processes it,
|
|
52
|
+
* return empty content to AI SDK so it has nothing to parse.
|
|
53
|
+
*/
|
|
54
|
+
async function renderChatPrompt({
|
|
55
|
+
model,
|
|
56
|
+
modelType,
|
|
57
|
+
instructions,
|
|
58
|
+
tools,
|
|
59
|
+
messages,
|
|
60
|
+
reasoningMode,
|
|
61
|
+
toolFallbackMode,
|
|
62
|
+
}: RenderData): Promise<string> {
|
|
63
|
+
const isDedicated = modelType === "dedicated";
|
|
64
|
+
const baseURL = isDedicated
|
|
65
|
+
? "https://api.friendli.ai/dedicated/v1"
|
|
66
|
+
: "https://api.friendli.ai/serverless/v1";
|
|
67
|
+
|
|
68
|
+
const chatTemplateKwargs = buildFriendliChatTemplateKwargs(
|
|
69
|
+
model,
|
|
70
|
+
reasoningMode
|
|
71
|
+
);
|
|
72
|
+
const messagesWithSentinel = appendNextUserPromptSentinel(messages);
|
|
73
|
+
const preparedMessages = applyFriendliInterleavedField(
|
|
74
|
+
messagesWithSentinel,
|
|
75
|
+
model,
|
|
76
|
+
reasoningMode
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
let capturedText = "";
|
|
80
|
+
|
|
81
|
+
const customFetch = Object.assign(
|
|
82
|
+
async (
|
|
83
|
+
_url: RequestInfo | URL,
|
|
84
|
+
options?: RequestInit
|
|
85
|
+
): Promise<Response> => {
|
|
86
|
+
const parsedBody = options?.body
|
|
87
|
+
? JSON.parse(options.body as string)
|
|
88
|
+
: {};
|
|
89
|
+
const { tool_choice: _ignored, ...bodyWithoutToolChoice } = parsedBody;
|
|
90
|
+
|
|
91
|
+
const endpoint = isDedicated
|
|
92
|
+
? "https://api.friendli.ai/dedicated/v1/chat/render"
|
|
93
|
+
: "https://api.friendli.ai/serverless/v1/chat/render";
|
|
94
|
+
|
|
95
|
+
const resp = await fetch(endpoint, {
|
|
96
|
+
...options,
|
|
97
|
+
method: "POST",
|
|
98
|
+
headers: {
|
|
99
|
+
"Content-Type": "application/json",
|
|
100
|
+
...options?.headers,
|
|
101
|
+
},
|
|
102
|
+
body: JSON.stringify({
|
|
103
|
+
...bodyWithoutToolChoice,
|
|
104
|
+
...(chatTemplateKwargs
|
|
105
|
+
? { chat_template_kwargs: chatTemplateKwargs }
|
|
106
|
+
: {}),
|
|
107
|
+
}),
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
if (!resp.ok) {
|
|
111
|
+
const errorText = await resp.text();
|
|
112
|
+
throw new Error(`API error ${resp.status}: ${errorText}`);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const data = (await resp.json()) as { text: string };
|
|
116
|
+
capturedText = data.text;
|
|
117
|
+
|
|
118
|
+
const result = {
|
|
119
|
+
id: "chatcmpl-render",
|
|
120
|
+
model: "dummy",
|
|
121
|
+
object: "chat.completion",
|
|
122
|
+
choices: [
|
|
123
|
+
{
|
|
124
|
+
index: 0,
|
|
125
|
+
message: {
|
|
126
|
+
role: "assistant",
|
|
127
|
+
content: "",
|
|
128
|
+
},
|
|
129
|
+
finish_reason: "stop",
|
|
130
|
+
},
|
|
131
|
+
],
|
|
132
|
+
usage: { prompt_tokens: 0, completion_tokens: 0, total_tokens: 0 },
|
|
133
|
+
created: Date.now(),
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
return new Response(JSON.stringify(result), {
|
|
137
|
+
status: 200,
|
|
138
|
+
headers: { "Content-Type": "application/json" },
|
|
139
|
+
});
|
|
140
|
+
},
|
|
141
|
+
{ preconnect: fetch.preconnect }
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
const friendli = createOpenAICompatible({
|
|
145
|
+
name: "friendli",
|
|
146
|
+
apiKey: env.FRIENDLI_TOKEN,
|
|
147
|
+
baseURL,
|
|
148
|
+
fetch: customFetch,
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
await generateText({
|
|
152
|
+
model: wrapLanguageModel({
|
|
153
|
+
model: friendli(model),
|
|
154
|
+
middleware: buildMiddlewares({
|
|
155
|
+
toolFallbackMode,
|
|
156
|
+
}),
|
|
157
|
+
}),
|
|
158
|
+
system: instructions,
|
|
159
|
+
tools,
|
|
160
|
+
messages: preparedMessages,
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
return capturedText;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const RENDER_TIMEOUT_MS = 5000;
|
|
167
|
+
|
|
168
|
+
function withTimeout<T>(promise: Promise<T>, ms: number): Promise<T> {
|
|
169
|
+
return Promise.race([
|
|
170
|
+
promise,
|
|
171
|
+
new Promise<never>((_, reject) =>
|
|
172
|
+
setTimeout(() => reject(new Error("timeout")), ms)
|
|
173
|
+
),
|
|
174
|
+
]);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export const createRenderCommand = (
|
|
178
|
+
getData: () => RenderData | Promise<RenderData>
|
|
179
|
+
): Command => ({
|
|
180
|
+
name: "render",
|
|
181
|
+
description: "Render conversation as raw prompt text",
|
|
182
|
+
execute: async (): Promise<CommandResult> => {
|
|
183
|
+
const spinner = new Spinner("Rendering prompt...");
|
|
184
|
+
const data = await getData();
|
|
185
|
+
|
|
186
|
+
if (data.messages.length === 0) {
|
|
187
|
+
return { success: false, message: "No messages to render." };
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
try {
|
|
191
|
+
spinner.start();
|
|
192
|
+
const text = await withTimeout(renderChatPrompt(data), RENDER_TIMEOUT_MS);
|
|
193
|
+
spinner.stop();
|
|
194
|
+
const styledText = text
|
|
195
|
+
? `${colors.dim}${text}${colors.reset}`
|
|
196
|
+
: "(empty render result)";
|
|
197
|
+
return { success: true, message: styledText };
|
|
198
|
+
} catch (error) {
|
|
199
|
+
spinner.stop();
|
|
200
|
+
const errorMessage =
|
|
201
|
+
error instanceof Error ? error.message : "Unknown error";
|
|
202
|
+
return { success: false, message: `Render failed: ${errorMessage}` };
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { agentManager } from "../agent";
|
|
2
|
+
import {
|
|
3
|
+
parseToolFallbackMode,
|
|
4
|
+
TOOL_FALLBACK_MODES,
|
|
5
|
+
} from "../tool-fallback-mode";
|
|
6
|
+
import type { Command } from "./types";
|
|
7
|
+
|
|
8
|
+
const TOOL_FALLBACK_USAGE = TOOL_FALLBACK_MODES.join("|");
|
|
9
|
+
|
|
10
|
+
export const createToolFallbackCommand = (): Command => ({
|
|
11
|
+
name: "tool-fallback",
|
|
12
|
+
description:
|
|
13
|
+
"Set tool call fallback mode for models without native tool support",
|
|
14
|
+
argumentSuggestions: [...TOOL_FALLBACK_MODES],
|
|
15
|
+
execute: ({ args }) => {
|
|
16
|
+
if (args.length === 0) {
|
|
17
|
+
const currentMode = agentManager.getToolFallbackMode();
|
|
18
|
+
return {
|
|
19
|
+
success: true,
|
|
20
|
+
message: `Tool fallback mode: ${currentMode}\nUsage: /tool-fallback <${TOOL_FALLBACK_USAGE}>`,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const rawMode = args[0] ?? "";
|
|
25
|
+
const mode = parseToolFallbackMode(rawMode);
|
|
26
|
+
if (!mode) {
|
|
27
|
+
return {
|
|
28
|
+
success: false,
|
|
29
|
+
message: `Invalid mode: ${rawMode}. Use one of: ${TOOL_FALLBACK_USAGE}`,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const currentMode = agentManager.getToolFallbackMode();
|
|
34
|
+
if (mode === currentMode) {
|
|
35
|
+
return {
|
|
36
|
+
success: true,
|
|
37
|
+
message: `Already using tool fallback mode: ${mode}`,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
agentManager.setToolFallbackMode(mode);
|
|
42
|
+
return {
|
|
43
|
+
success: true,
|
|
44
|
+
message: `Tool fallback mode set to: ${mode}`,
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
});
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, it } from "bun:test";
|
|
2
|
+
import { agentManager } from "../agent";
|
|
3
|
+
import { createTranslateCommand } from "./translate";
|
|
4
|
+
|
|
5
|
+
describe("translate command", () => {
|
|
6
|
+
const command = createTranslateCommand();
|
|
7
|
+
|
|
8
|
+
beforeEach(() => { agentManager.resetForTesting(); });
|
|
9
|
+
|
|
10
|
+
it("reports current translation state when called without args", async () => {
|
|
11
|
+
agentManager.setTranslationEnabled(true);
|
|
12
|
+
|
|
13
|
+
const result = await command.execute({ args: [] });
|
|
14
|
+
|
|
15
|
+
expect(result?.success).toBe(true);
|
|
16
|
+
expect(result?.message).toContain("Translation is currently");
|
|
17
|
+
expect(result?.message).toContain("enabled");
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it("enables translation with on/enable/true", async () => {
|
|
21
|
+
const onResult = await command.execute({ args: ["on"] });
|
|
22
|
+
expect(onResult?.success).toBe(true);
|
|
23
|
+
expect(agentManager.isTranslationEnabled()).toBe(true);
|
|
24
|
+
expect(onResult?.message).toContain("Translation enabled");
|
|
25
|
+
|
|
26
|
+
const enableResult = await command.execute({ args: ["enable"] });
|
|
27
|
+
expect(enableResult?.success).toBe(true);
|
|
28
|
+
expect(agentManager.isTranslationEnabled()).toBe(true);
|
|
29
|
+
|
|
30
|
+
const trueResult = await command.execute({ args: ["true"] });
|
|
31
|
+
expect(trueResult?.success).toBe(true);
|
|
32
|
+
expect(agentManager.isTranslationEnabled()).toBe(true);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it("disables translation with off/disable/false", async () => {
|
|
36
|
+
agentManager.setTranslationEnabled(true);
|
|
37
|
+
|
|
38
|
+
const offResult = await command.execute({ args: ["off"] });
|
|
39
|
+
expect(offResult?.success).toBe(true);
|
|
40
|
+
expect(agentManager.isTranslationEnabled()).toBe(false);
|
|
41
|
+
expect(offResult?.message).toContain("Translation disabled");
|
|
42
|
+
|
|
43
|
+
agentManager.setTranslationEnabled(true);
|
|
44
|
+
const disableResult = await command.execute({ args: ["disable"] });
|
|
45
|
+
expect(disableResult?.success).toBe(true);
|
|
46
|
+
expect(agentManager.isTranslationEnabled()).toBe(false);
|
|
47
|
+
|
|
48
|
+
agentManager.setTranslationEnabled(true);
|
|
49
|
+
const falseResult = await command.execute({ args: ["false"] });
|
|
50
|
+
expect(falseResult?.success).toBe(true);
|
|
51
|
+
expect(agentManager.isTranslationEnabled()).toBe(false);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it("rejects invalid arguments", async () => {
|
|
55
|
+
const result = await command.execute({ args: ["maybe"] });
|
|
56
|
+
|
|
57
|
+
expect(result?.success).toBe(false);
|
|
58
|
+
expect(result?.message).toContain("Invalid argument");
|
|
59
|
+
expect(result?.message).toContain("on");
|
|
60
|
+
expect(result?.message).toContain("off");
|
|
61
|
+
});
|
|
62
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { agentManager } from "../agent";
|
|
2
|
+
import { createToggleCommand } from "./factories/create-toggle-command";
|
|
3
|
+
import type { Command } from "./types";
|
|
4
|
+
|
|
5
|
+
export const createTranslateCommand = (): Command =>
|
|
6
|
+
createToggleCommand({
|
|
7
|
+
name: "translate",
|
|
8
|
+
description: "Toggle auto-translation of non-English prompts",
|
|
9
|
+
getter: () => agentManager.isTranslationEnabled(),
|
|
10
|
+
setter: (value) => agentManager.setTranslationEnabled(value),
|
|
11
|
+
featureName: "Translation",
|
|
12
|
+
enabledMessage: "Translation enabled",
|
|
13
|
+
disabledMessage: "Translation disabled",
|
|
14
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface CommandContext {
|
|
2
|
+
args: string[];
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export interface CommandResult {
|
|
6
|
+
action?: "new-session";
|
|
7
|
+
message?: string;
|
|
8
|
+
success: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface Command {
|
|
12
|
+
aliases?: string[];
|
|
13
|
+
argumentSuggestions?: string[];
|
|
14
|
+
description: string;
|
|
15
|
+
displayName?: string;
|
|
16
|
+
execute: (context: CommandContext) => CommandResult | Promise<CommandResult>;
|
|
17
|
+
name: string;
|
|
18
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const getEnvironmentContext = (): string => {
|
|
2
|
+
const cwd = process.cwd();
|
|
3
|
+
|
|
4
|
+
return `
|
|
5
|
+
## Environment
|
|
6
|
+
|
|
7
|
+
- **Working Directory**: ${cwd}
|
|
8
|
+
- **Path Resolution**: All relative paths are resolved from the working directory
|
|
9
|
+
- **Shell Execution Model**: Each shell_execute invocation is isolated (no retained terminal context)
|
|
10
|
+
`;
|
|
11
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
let currentSessionId: string | null = null;
|
|
3
|
+
|
|
4
|
+
export function initializeSession(): string {
|
|
5
|
+
currentSessionId = `session-${randomUUID()}`;
|
|
6
|
+
return currentSessionId;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function getSessionId(): string {
|
|
10
|
+
if (!currentSessionId) {
|
|
11
|
+
throw new Error("Session not initialized. Call initializeSession() first.");
|
|
12
|
+
}
|
|
13
|
+
return currentSessionId;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function hasActiveSession(): boolean {
|
|
17
|
+
return currentSessionId !== null;
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const PROMPTS_COMMAND_PREFIX = "prompts:";
|
|
2
|
+
|
|
3
|
+
export const toPromptsCommandName = (skillId: string): string => {
|
|
4
|
+
if (skillId.startsWith(PROMPTS_COMMAND_PREFIX)) {
|
|
5
|
+
return skillId;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
return `${PROMPTS_COMMAND_PREFIX}${skillId}`;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const parsePromptsCommandName = (commandName: string): string | null => {
|
|
12
|
+
if (!commandName.startsWith(PROMPTS_COMMAND_PREFIX)) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const skillId = commandName.slice(PROMPTS_COMMAND_PREFIX.length);
|
|
17
|
+
return skillId.length > 0 ? skillId : null;
|
|
18
|
+
};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { executeLoadSkill } from "../tools/planning/load-skill";
|
|
3
|
+
import {
|
|
4
|
+
parsePromptsCommandName,
|
|
5
|
+
toPromptsCommandName,
|
|
6
|
+
} from "./skill-command-prefix";
|
|
7
|
+
import { loadAllSkills, loadSkillById } from "./skills";
|
|
8
|
+
|
|
9
|
+
describe("Skills Integration Tests", () => {
|
|
10
|
+
test("loads both legacy and v2 skills", async () => {
|
|
11
|
+
const skills = await loadAllSkills();
|
|
12
|
+
|
|
13
|
+
// Should have at least git-workflow (legacy) and example (v2)
|
|
14
|
+
expect(skills.length).toBeGreaterThanOrEqual(2);
|
|
15
|
+
|
|
16
|
+
const legacySkill = skills.find((s) => s.id === "git-workflow");
|
|
17
|
+
expect(legacySkill?.format).toBe("legacy");
|
|
18
|
+
|
|
19
|
+
const v2Skill = skills.find((s) => s.id === "example");
|
|
20
|
+
expect(v2Skill?.format).toBe("v2");
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
test("loads v2 skill with proper metadata", async () => {
|
|
24
|
+
const result = await loadSkillById("example");
|
|
25
|
+
expect(result).toBeTruthy();
|
|
26
|
+
|
|
27
|
+
if (result) {
|
|
28
|
+
expect(result.info.format).toBe("v2");
|
|
29
|
+
expect(result.info.name).toBe("example");
|
|
30
|
+
expect(result.info.description).toContain("agentskills.io");
|
|
31
|
+
expect(result.info.dirPath).toBeTruthy();
|
|
32
|
+
expect(result.content).toContain("# Example Skill");
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
test("executeLoadSkill works with v2 skills", async () => {
|
|
37
|
+
const result = await executeLoadSkill({ skillName: "example" });
|
|
38
|
+
|
|
39
|
+
expect(result).toContain("# Skill Loaded: example");
|
|
40
|
+
expect(result).toContain("[Bundled (v2)]");
|
|
41
|
+
expect(result).toContain("# Example Skill");
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test("executeLoadSkill loads subdirectory files with relativePath", async () => {
|
|
45
|
+
const setupScript = await executeLoadSkill({
|
|
46
|
+
skillName: "example",
|
|
47
|
+
relativePath: "scripts/setup.sh",
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
expect(setupScript).toContain("# Skill File: example/scripts/setup.sh");
|
|
51
|
+
expect(setupScript).toContain("#!/bin/bash");
|
|
52
|
+
expect(setupScript).toContain("Setup script for example skill");
|
|
53
|
+
|
|
54
|
+
const apiDocs = await executeLoadSkill({
|
|
55
|
+
skillName: "example",
|
|
56
|
+
relativePath: "references/api.md",
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
expect(apiDocs).toContain("# Skill File: example/references/api.md");
|
|
60
|
+
expect(apiDocs).toContain("# API Reference");
|
|
61
|
+
expect(apiDocs).toContain("/api/health");
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
test("executeLoadSkill prevents path traversal", async () => {
|
|
65
|
+
const result = await executeLoadSkill({
|
|
66
|
+
skillName: "example",
|
|
67
|
+
relativePath: "../../../package.json",
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
expect(result).toContain("Error: Invalid relative path");
|
|
71
|
+
expect(result).toContain("cannot contain '..'");
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
test("executeLoadSkill rejects absolute paths", async () => {
|
|
75
|
+
const result = await executeLoadSkill({
|
|
76
|
+
skillName: "example",
|
|
77
|
+
relativePath: "/etc/passwd",
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
expect(result).toContain("Error: Invalid relative path");
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
test("executeLoadSkill with relativePath only works with v2 skills", async () => {
|
|
84
|
+
const result = await executeLoadSkill({
|
|
85
|
+
skillName: "git-workflow",
|
|
86
|
+
relativePath: "some-file.txt",
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
expect(result).toContain(
|
|
90
|
+
"Error: Skill 'git-workflow' is a legacy format skill"
|
|
91
|
+
);
|
|
92
|
+
expect(result).toContain("Only v2 skills support subdirectory files");
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
test("formats prompts-prefixed slash command names", () => {
|
|
96
|
+
expect(toPromptsCommandName("rams")).toBe("prompts:rams");
|
|
97
|
+
expect(toPromptsCommandName("prompts:rams")).toBe("prompts:rams");
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
test("parses prompts-prefixed slash command names", () => {
|
|
101
|
+
expect(parsePromptsCommandName("prompts:rams")).toBe("rams");
|
|
102
|
+
expect(parsePromptsCommandName("prompts:")).toBeNull();
|
|
103
|
+
expect(parsePromptsCommandName("rams")).toBeNull();
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
test("loads v2 skill by prompts-prefixed name", async () => {
|
|
107
|
+
const result = await loadSkillById("prompts:example");
|
|
108
|
+
|
|
109
|
+
expect(result).toBeTruthy();
|
|
110
|
+
expect(result?.info.id).toBe("example");
|
|
111
|
+
expect(result?.info.format).toBe("v2");
|
|
112
|
+
});
|
|
113
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { describe, expect, it } from "bun:test";
|
|
2
|
+
import { loadSkillsMetadata } from "./skills";
|
|
3
|
+
|
|
4
|
+
describe("loadSkillsMetadata", () => {
|
|
5
|
+
it("loads git-workflow skill metadata successfully", async () => {
|
|
6
|
+
const metadata = await loadSkillsMetadata();
|
|
7
|
+
|
|
8
|
+
expect(metadata).toContain("Git Workflow");
|
|
9
|
+
expect(metadata).toContain("git-workflow");
|
|
10
|
+
expect(metadata).toContain("Available Skills");
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it("includes skill description", async () => {
|
|
14
|
+
const metadata = await loadSkillsMetadata();
|
|
15
|
+
|
|
16
|
+
expect(metadata).toContain("Complete git workflow");
|
|
17
|
+
expect(metadata).toContain("load_skill");
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it("returns empty string if no skills directory", async () => {
|
|
21
|
+
const metadata = await loadSkillsMetadata();
|
|
22
|
+
|
|
23
|
+
expect(typeof metadata).toBe("string");
|
|
24
|
+
});
|
|
25
|
+
});
|