@oyasmi/pipiclaw 0.9.4 → 0.9.5-beta.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.en.md +28 -22
- package/README.md +27 -21
- package/dist/agent/builtin-commands.d.ts +7 -2
- package/dist/agent/builtin-commands.js +19 -23
- package/dist/agent/channel-runner.d.ts +13 -13
- package/dist/agent/channel-runner.js +93 -76
- package/dist/agent/maintenance-context.d.ts +6 -5
- package/dist/agent/maintenance-context.js +15 -15
- package/dist/agent/prompt/manifest.js +1 -1
- package/dist/agent/prompt/resources.d.ts +1 -1
- package/dist/agent/prompt/resources.js +1 -1
- package/dist/agent/prompt/sections.js +4 -4
- package/dist/agent/runner-factory.d.ts +6 -6
- package/dist/agent/runner-factory.js +6 -7
- package/dist/agent/session/compaction-input.d.ts +6 -0
- package/dist/agent/session/compaction-input.js +75 -0
- package/dist/agent/session/compaction-snapshot.d.ts +30 -0
- package/dist/agent/session/compaction-snapshot.js +154 -0
- package/dist/agent/session/compaction-summary.d.ts +39 -0
- package/dist/agent/session/compaction-summary.js +158 -0
- package/dist/agent/session/compaction.d.ts +35 -0
- package/dist/agent/session/compaction.js +294 -0
- package/dist/agent/session/context-input.d.ts +15 -0
- package/dist/agent/session/context-input.js +82 -0
- package/dist/agent/session/context-snapshot.d.ts +11 -0
- package/dist/agent/session/context-snapshot.js +72 -0
- package/dist/agent/session/event-guards.d.ts +2 -0
- package/dist/agent/session/event-guards.js +4 -0
- package/dist/agent/session/request-tools.d.ts +3 -0
- package/dist/agent/session/request-tools.js +20 -0
- package/dist/agent/session/session-adapter.d.ts +2 -1
- package/dist/agent/session/session-adapter.js +6 -3
- package/dist/agent/session/session-events.d.ts +5 -4
- package/dist/agent/session/session-events.js +46 -59
- package/dist/agent/session/session-host.d.ts +29 -41
- package/dist/agent/session/session-host.js +86 -69
- package/dist/agent/session/settings-diagnostics.d.ts +5 -0
- package/dist/agent/session/settings-diagnostics.js +21 -0
- package/dist/agent/status-render.js +5 -2
- package/dist/{runtime → agent}/stop-watchdog.d.ts +3 -1
- package/dist/{runtime → agent}/stop-watchdog.js +7 -3
- package/dist/agent/turn/progress-formatter.d.ts +1 -3
- package/dist/agent/turn/progress-formatter.js +3 -22
- package/dist/agent/turn/task-digest.d.ts +4 -2
- package/dist/agent/turn/task-digest.js +7 -4
- package/dist/agent/turn/turn-context.d.ts +11 -7
- package/dist/agent/turn/turn-context.js +26 -18
- package/dist/agent/turn/turn-finish.d.ts +17 -5
- package/dist/agent/turn/turn-finish.js +51 -77
- package/dist/agent/turn/turn-input.d.ts +2 -2
- package/dist/agent/turn/turn-input.js +4 -3
- package/dist/agent/turn/turn-output.d.ts +19 -0
- package/dist/agent/turn/turn-output.js +41 -0
- package/dist/agent/turn/turn-pipeline.d.ts +11 -8
- package/dist/agent/turn/turn-pipeline.js +54 -55
- package/dist/agent/turn/turn-prompt.d.ts +1 -1
- package/dist/agent/turn/turn-recovery.d.ts +11 -10
- package/dist/agent/turn/turn-recovery.js +14 -29
- package/dist/agent/types.d.ts +31 -12
- package/dist/agent/types.js +2 -1
- package/dist/app/auth-command.js +1 -1
- package/dist/app/home.js +31 -15
- package/dist/channel/active-session-store.d.ts +14 -12
- package/dist/channel/active-session-store.js +29 -25
- package/dist/channel/attachments.d.ts +25 -0
- package/dist/channel/attachments.js +56 -0
- package/dist/channel/channel-context.d.ts +87 -96
- package/dist/channel/channel-context.js +1 -66
- package/dist/channel/channel-event.d.ts +51 -41
- package/dist/channel/channel-event.js +6 -11
- package/dist/channel/channel-id.d.ts +22 -0
- package/dist/channel/channel-id.js +13 -0
- package/dist/channel/channel-index.d.ts +17 -34
- package/dist/channel/channel-index.js +41 -80
- package/dist/channel/config.d.ts +10 -0
- package/dist/channel/config.js +55 -0
- package/dist/channel/ingress.d.ts +101 -0
- package/dist/channel/ingress.js +5 -0
- package/dist/channel/store.d.ts +13 -15
- package/dist/channel/store.js +21 -25
- package/dist/channel/transport.d.ts +99 -0
- package/dist/channel/turn-context.d.ts +23 -0
- package/dist/channel/turn-context.js +1 -0
- package/dist/commands/catalog.d.ts +4 -7
- package/dist/commands/catalog.js +24 -31
- package/dist/commands/router.d.ts +23 -12
- package/dist/commands/router.js +22 -24
- package/dist/config/settings.d.ts +5 -4
- package/dist/desk/bindings.d.ts +6 -0
- package/dist/desk/bindings.js +105 -0
- package/dist/desk/commands.d.ts +81 -0
- package/dist/desk/commands.js +145 -0
- package/dist/desk/default.d.ts +4 -0
- package/dist/desk/default.js +11 -0
- package/dist/desk/paths.d.ts +41 -0
- package/dist/desk/paths.js +81 -0
- package/dist/desk/registry.d.ts +17 -0
- package/dist/desk/registry.js +191 -0
- package/dist/desk/startup-error.d.ts +4 -0
- package/dist/desk/startup-error.js +7 -0
- package/dist/desk/types.d.ts +72 -0
- package/dist/desk/types.js +7 -0
- package/dist/dingtalk/bot.d.ts +18 -35
- package/dist/dingtalk/bot.js +21 -204
- package/dist/dingtalk/channel-ids.d.ts +15 -0
- package/dist/dingtalk/channel-ids.js +39 -0
- package/dist/dingtalk/config.d.ts +6 -3
- package/dist/dingtalk/config.js +13 -25
- package/dist/dingtalk/connection.d.ts +1 -0
- package/dist/dingtalk/connection.js +5 -4
- package/dist/dingtalk/conversation-meta.d.ts +10 -5
- package/dist/dingtalk/conversation-meta.js +72 -50
- package/dist/dingtalk/delivery.d.ts +30 -14
- package/dist/dingtalk/delivery.js +189 -62
- package/dist/dingtalk/inbound-media.d.ts +2 -18
- package/dist/dingtalk/inbound-media.js +0 -53
- package/dist/dingtalk/inbound.d.ts +10 -11
- package/dist/dingtalk/inbound.js +12 -19
- package/dist/dingtalk/media.d.ts +9 -11
- package/dist/dingtalk/media.js +18 -31
- package/dist/dingtalk/progress.d.ts +8 -0
- package/dist/dingtalk/progress.js +20 -0
- package/dist/dingtalk/response-mode.d.ts +13 -0
- package/dist/dingtalk/response-mode.js +31 -0
- package/dist/dingtalk/transport.d.ts +47 -0
- package/dist/dingtalk/transport.js +71 -0
- package/dist/events/commands.d.ts +7 -2
- package/dist/events/commands.js +40 -22
- package/dist/events/pre-action-error.d.ts +10 -0
- package/dist/events/pre-action-error.js +10 -0
- package/dist/events/types.d.ts +20 -2
- package/dist/events/watcher.d.ts +14 -7
- package/dist/events/watcher.js +49 -26
- package/dist/index.d.ts +4 -2
- package/dist/jobs/completion-wake.d.ts +14 -0
- package/dist/jobs/completion-wake.js +36 -0
- package/dist/jobs/manager.d.ts +27 -22
- package/dist/jobs/manager.js +58 -91
- package/dist/jobs/record.d.ts +2 -0
- package/dist/jobs/record.js +2 -0
- package/dist/log.d.ts +0 -1
- package/dist/log.js +1 -1
- package/dist/main.js +10 -3
- package/dist/memory/boundary-work.d.ts +17 -0
- package/dist/memory/boundary-work.js +162 -0
- package/dist/memory/commands.d.ts +4 -3
- package/dist/memory/commands.js +16 -16
- package/dist/memory/desk-memory-queue.d.ts +18 -0
- package/dist/memory/desk-memory-queue.js +33 -0
- package/dist/memory/index-budget.d.ts +3 -3
- package/dist/memory/index-budget.js +3 -3
- package/dist/memory/journal.d.ts +6 -6
- package/dist/memory/journal.js +14 -14
- package/dist/memory/lifecycle.d.ts +14 -21
- package/dist/memory/lifecycle.js +73 -103
- package/dist/memory/maintenance-state.d.ts +14 -15
- package/dist/memory/maintenance-state.js +43 -42
- package/dist/memory/reflect-job.d.ts +5 -4
- package/dist/memory/reflect-job.js +21 -15
- package/dist/memory/reflect.d.ts +2 -1
- package/dist/memory/reflect.js +13 -12
- package/dist/memory/render.d.ts +1 -1
- package/dist/memory/render.js +2 -2
- package/dist/memory/review-log.d.ts +4 -4
- package/dist/memory/review-log.js +5 -5
- package/dist/memory/scheduler.d.ts +12 -19
- package/dist/memory/scheduler.js +28 -64
- package/dist/memory/session-corpus.d.ts +4 -1
- package/dist/memory/session-corpus.js +70 -29
- package/dist/memory/session-search.d.ts +11 -3
- package/dist/memory/session-search.js +14 -11
- package/dist/memory/sidecar-worker.d.ts +1 -0
- package/dist/memory/sidecar-worker.js +57 -76
- package/dist/memory/source-window.d.ts +0 -6
- package/dist/memory/source-window.js +0 -20
- package/dist/memory/store.d.ts +12 -12
- package/dist/memory/store.js +44 -44
- package/dist/paths.d.ts +2 -0
- package/dist/paths.js +2 -0
- package/dist/playbooks/agent-delegation.md +16 -16
- package/dist/playbooks/background-jobs.md +5 -3
- package/dist/playbooks/event-scheduling.md +7 -5
- package/dist/playbooks/memory-and-learning.md +16 -12
- package/dist/playbooks/outbound-media.md +1 -1
- package/dist/playbooks/runtime-orientation.md +35 -23
- package/dist/playbooks/task-lead.md +13 -11
- package/dist/runtime/bootstrap.d.ts +36 -13
- package/dist/runtime/bootstrap.js +310 -138
- package/dist/runtime/channel-queue.d.ts +23 -0
- package/dist/{dingtalk → runtime}/channel-queue.js +20 -9
- package/dist/runtime/daemon-lock.d.ts +12 -0
- package/dist/runtime/daemon-lock.js +28 -0
- package/dist/runtime/desk-runtime.d.ts +131 -0
- package/dist/runtime/desk-runtime.js +402 -0
- package/dist/runtime/durable-dispatch.d.ts +11 -5
- package/dist/runtime/durable-dispatch.js +20 -8
- package/dist/runtime/inbound-images.d.ts +32 -10
- package/dist/runtime/inbound-images.js +95 -21
- package/dist/runtime/ingress-busy.d.ts +26 -0
- package/dist/runtime/ingress-busy.js +211 -0
- package/dist/runtime/ingress-commands.d.ts +7 -0
- package/dist/runtime/ingress-commands.js +162 -0
- package/dist/runtime/ingress-deps.d.ts +62 -0
- package/dist/runtime/ingress-deps.js +1 -0
- package/dist/runtime/ingress.d.ts +22 -0
- package/dist/runtime/ingress.js +376 -0
- package/dist/runtime/request-execution.d.ts +19 -0
- package/dist/runtime/request-execution.js +88 -0
- package/dist/runtime/shutdown.d.ts +13 -5
- package/dist/runtime/shutdown.js +10 -4
- package/dist/runtime/task-driver.d.ts +38 -22
- package/dist/runtime/task-driver.js +142 -116
- package/dist/runtime/task-spawn.d.ts +4 -4
- package/dist/runtime/task-spawn.js +6 -5
- package/dist/runtime/task-wake.d.ts +6 -4
- package/dist/runtime/task-wake.js +7 -7
- package/dist/runtime/transports.d.ts +32 -0
- package/dist/runtime/transports.js +101 -0
- package/dist/runtime/turn-run.d.ts +18 -9
- package/dist/runtime/turn-run.js +302 -71
- package/dist/runtime/wake-coalescing.d.ts +11 -3
- package/dist/runtime/wake-coalescing.js +10 -0
- package/dist/security/config.js +5 -10
- package/dist/security/logger.js +1 -1
- package/dist/security/path-guard.js +7 -63
- package/dist/security/types.d.ts +27 -30
- package/dist/security/types.js +0 -1
- package/dist/shared/atomic-file.d.ts +2 -0
- package/dist/shared/atomic-file.js +14 -1
- package/dist/shared/file-lock.d.ts +35 -0
- package/dist/shared/file-lock.js +195 -0
- package/dist/shared/with-timeout.d.ts +2 -0
- package/dist/shared/with-timeout.js +21 -0
- package/dist/skills/loader.d.ts +1 -1
- package/dist/skills/loader.js +2 -2
- package/dist/skills/workspace.js +2 -2
- package/dist/subagents/completion-wake.d.ts +11 -2
- package/dist/subagents/completion-wake.js +22 -9
- package/dist/subagents/discovery.js +1 -1
- package/dist/subagents/dispatch.d.ts +0 -10
- package/dist/subagents/dispatch.js +10 -28
- package/dist/subagents/external/dispatch.js +1 -1
- package/dist/subagents/external/run.d.ts +1 -1
- package/dist/subagents/external/run.js +3 -3
- package/dist/subagents/internal/run.js +1 -1
- package/dist/subagents/internal/worker.js +6 -14
- package/dist/subagents/run-archive.d.ts +11 -0
- package/dist/subagents/run-archive.js +49 -0
- package/dist/subagents/run-record.d.ts +9 -8
- package/dist/subagents/run-record.js +3 -3
- package/dist/subagents/run-registry.d.ts +5 -3
- package/dist/subagents/run-registry.js +22 -45
- package/dist/subagents/runs.d.ts +23 -13
- package/dist/subagents/runs.js +75 -82
- package/dist/subagents/task-envelope.js +9 -11
- package/dist/subagents/types.d.ts +6 -5
- package/dist/tasks/board.d.ts +1 -1
- package/dist/tasks/board.js +2 -2
- package/dist/tasks/bound-work.d.ts +2 -2
- package/dist/tasks/bound-work.js +7 -7
- package/dist/tasks/brief.d.ts +1 -1
- package/dist/tasks/brief.js +9 -9
- package/dist/tasks/commands.d.ts +11 -2
- package/dist/tasks/commands.js +66 -41
- package/dist/tasks/contract.d.ts +0 -2
- package/dist/tasks/contract.js +1 -3
- package/dist/tasks/create.d.ts +3 -1
- package/dist/tasks/create.js +10 -4
- package/dist/tasks/frontmatter.d.ts +6 -2
- package/dist/tasks/frontmatter.js +10 -10
- package/dist/tasks/loop-log.d.ts +7 -13
- package/dist/tasks/loop-log.js +14 -17
- package/dist/tasks/mutation-lock.d.ts +7 -5
- package/dist/tasks/mutation-lock.js +32 -9
- package/dist/tasks/session-path.d.ts +3 -3
- package/dist/tasks/session-path.js +5 -5
- package/dist/tasks/steer.d.ts +5 -5
- package/dist/tasks/steer.js +42 -40
- package/dist/tasks/store.d.ts +11 -11
- package/dist/tasks/store.js +32 -29
- package/dist/tools/bash.d.ts +5 -5
- package/dist/tools/bash.js +19 -18
- package/dist/tools/contract/names.d.ts +7 -0
- package/dist/tools/contract/names.js +22 -0
- package/dist/tools/edit.js +1 -1
- package/dist/tools/event-manage.d.ts +3 -1
- package/dist/tools/event-manage.js +34 -33
- package/dist/tools/glob.js +5 -5
- package/dist/tools/grep.js +2 -2
- package/dist/tools/index.d.ts +9 -8
- package/dist/tools/index.js +12 -16
- package/dist/tools/job.d.ts +4 -2
- package/dist/tools/job.js +11 -8
- package/dist/tools/memory-manage.d.ts +5 -3
- package/dist/tools/memory-manage.js +24 -24
- package/dist/tools/read.js +1 -1
- package/dist/tools/registry.d.ts +12 -8
- package/dist/tools/registry.js +13 -9
- package/dist/tools/send-media.d.ts +2 -2
- package/dist/tools/send-media.js +3 -3
- package/dist/tools/session-search.d.ts +3 -1
- package/dist/tools/session-search.js +8 -6
- package/dist/tools/subagent-manage.d.ts +2 -8
- package/dist/tools/subagent-manage.js +19 -15
- package/dist/tools/subagent.js +1 -1
- package/dist/tools/task-manage/create.js +1 -1
- package/dist/tools/task-manage/factory.js +2 -2
- package/dist/tools/task-manage/lifecycle.js +3 -1
- package/dist/tools/task-manage/log-view.js +2 -2
- package/dist/tools/task-manage/shared.js +3 -3
- package/dist/tools/task-manage/step-end.js +3 -3
- package/dist/tools/task-manage/types.d.ts +8 -3
- package/dist/tools/web-cache.d.ts +3 -3
- package/dist/tools/web-cache.js +12 -12
- package/dist/tools/web-fetch.d.ts +2 -2
- package/dist/tools/web-fetch.js +7 -7
- package/dist/tools/write-content.js +1 -1
- package/dist/tui/cli.d.ts +17 -5
- package/dist/tui/cli.js +90 -27
- package/dist/tui/client.d.ts +26 -0
- package/dist/tui/client.js +157 -0
- package/dist/tui/colors.d.ts +0 -1
- package/dist/tui/colors.js +0 -1
- package/dist/tui/commands.d.ts +10 -51
- package/dist/tui/commands.js +16 -39
- package/dist/tui/frontend.d.ts +2 -2
- package/dist/tui/frontend.js +2 -2
- package/dist/tui/pitui-frontend.d.ts +0 -2
- package/dist/tui/pitui-frontend.js +1 -6
- package/dist/tui/render.d.ts +62 -0
- package/dist/tui/render.js +123 -0
- package/dist/tui/session.d.ts +92 -0
- package/dist/tui/session.js +317 -0
- package/dist/usage/ledger.d.ts +5 -0
- package/dist/usage/ledger.js +2 -0
- package/dist/usage/render.d.ts +6 -1
- package/dist/usage/render.js +18 -13
- package/dist/webapi/auth.d.ts +13 -0
- package/dist/webapi/auth.js +29 -0
- package/dist/webapi/config.d.ts +29 -0
- package/dist/webapi/config.js +100 -0
- package/dist/webapi/errors.d.ts +39 -0
- package/dist/webapi/errors.js +32 -0
- package/dist/webapi/http.d.ts +25 -0
- package/dist/webapi/http.js +4 -0
- package/dist/webapi/ids.d.ts +9 -0
- package/dist/webapi/ids.js +20 -0
- package/dist/webapi/input.d.ts +17 -0
- package/dist/webapi/input.js +229 -0
- package/dist/webapi/items.d.ts +37 -0
- package/dist/webapi/items.js +48 -0
- package/dist/webapi/key-command.d.ts +2 -0
- package/dist/webapi/key-command.js +110 -0
- package/dist/webapi/limits.d.ts +47 -0
- package/dist/webapi/limits.js +48 -0
- package/dist/webapi/request-policy.d.ts +17 -0
- package/dist/webapi/request-policy.js +160 -0
- package/dist/webapi/response-record.d.ts +68 -0
- package/dist/webapi/response-record.js +58 -0
- package/dist/webapi/response-state.d.ts +90 -0
- package/dist/webapi/response-state.js +347 -0
- package/dist/webapi/routes/conversations.d.ts +8 -0
- package/dist/webapi/routes/conversations.js +80 -0
- package/dist/webapi/routes/models.d.ts +3 -0
- package/dist/webapi/routes/models.js +12 -0
- package/dist/webapi/routes/responses.d.ts +8 -0
- package/dist/webapi/routes/responses.js +118 -0
- package/dist/webapi/routes/websocket.d.ts +9 -0
- package/dist/webapi/routes/websocket.js +328 -0
- package/dist/webapi/server.d.ts +24 -0
- package/dist/webapi/server.js +229 -0
- package/dist/webapi/service.d.ts +130 -0
- package/dist/webapi/service.js +588 -0
- package/dist/webapi/store.d.ts +46 -0
- package/dist/webapi/store.js +245 -0
- package/dist/webapi/stream.d.ts +13 -0
- package/dist/webapi/stream.js +76 -0
- package/dist/webapi/transport.d.ts +43 -0
- package/dist/webapi/transport.js +100 -0
- package/package.json +8 -2
- package/dist/channel/channel-paths.d.ts +0 -16
- package/dist/channel/channel-paths.js +0 -53
- package/dist/channel/commands.d.ts +0 -32
- package/dist/channel/commands.js +0 -109
- package/dist/channel/project-scope-store.d.ts +0 -51
- package/dist/channel/project-scope-store.js +0 -112
- package/dist/dingtalk/channel-queue.d.ts +0 -19
- package/dist/dingtalk/handler.d.ts +0 -90
- package/dist/memory/channel-maintenance-queue.d.ts +0 -5
- package/dist/memory/channel-maintenance-queue.js +0 -8
- package/dist/runtime/task-migration.d.ts +0 -30
- package/dist/runtime/task-migration.js +0 -465
- package/dist/runtime/turn-handler.d.ts +0 -47
- package/dist/runtime/turn-handler.js +0 -318
- package/dist/security/project-scope.d.ts +0 -45
- package/dist/security/project-scope.js +0 -105
- package/dist/tui/app.d.ts +0 -16
- package/dist/tui/app.js +0 -166
- package/dist/tui/terminal-context.d.ts +0 -27
- package/dist/tui/terminal-context.js +0 -84
- package/dist/tui/terminal-media-sender.d.ts +0 -9
- package/dist/tui/terminal-media-sender.js +0 -15
- package/dist/tui/turn-controller.d.ts +0 -64
- package/dist/tui/turn-controller.js +0 -311
- /package/dist/{dingtalk/handler.js → channel/transport.js} +0 -0
package/README.en.md
CHANGED
|
@@ -18,17 +18,17 @@ What you see is one assistant, but behind it can be a well-divided AI engineerin
|
|
|
18
18
|
|
|
19
19
|
Pipiclaw supports two kinds of delegation at once: built-in sub-agents do lightweight work in-process such as retrieval and log triage; external agents launch real Claude Code, Codex CLI, or any script to handle heavy tasks that need long runs, many files, and repeated self-testing.
|
|
20
20
|
|
|
21
|
-
In DingTalk daemon mode, external tasks keep running in the background after dispatch and automatically wake the
|
|
21
|
+
In DingTalk daemon mode, external tasks keep running in the background after dispatch and automatically wake the channel that dispatched them on completion. You can use `/subagents` at any time to check run status, the actual command, and outputs, use `/subagents cancel` to terminate directly, and let the main agent keep asking follow-up questions on a finished Claude Code / Codex session. The repo ships recommended capability-and-cost entries plus earlier job-style role templates for reference.
|
|
22
22
|
|
|
23
23
|
### Work does not end when a conversation ends
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
Pipiclaw is one personal assistant: by default the terminal, DingTalk DMs and group chats all share long-term memory, a daily journal, tasks, scheduled events and working files (kept in the default desk, `default`), while each keeps its own conversation — just start chatting. Sharing also means that something you tell the assistant in a DM may be recalled in a group; when you want to keep a project or purpose apart, use the advanced [desk mechanism](https://github.com/oyasmi/pipiclaw/blob/main/docs/scaling-and-concurrency.md#按需分开工位): each desk has its own memory, tasks and files. Each task is a one-off project with goals, done criteria, and work items in a Markdown contract, and steps, dispatches, and settlements in a JSONL loop log; the built-in task driver advances runnable tasks, redeems due time tickets, and handles ticket expiry. Scheduled and recurring work uses event templates to create an independent task instance per occurrence. The runtime stops with a notice when a budget, idle-loop, or repeated-expiry boundary is reached.
|
|
26
26
|
|
|
27
27
|
### Natively at home in DingTalk
|
|
28
28
|
|
|
29
29
|
Pipiclaw uses DingTalk Stream Mode, so no self-hosted message relay or public IP is needed. AI Cards can continuously show thinking, tool execution, and status updates; while a task runs you can still use `/steer` to adjust direction, `/followup` to queue the next thing, and `/stop` to abort the current turn. Generated reports, screenshots, and exported files can be delivered as native DingTalk attachments.
|
|
30
30
|
|
|
31
|
-
A single bot instance can serve many direct and group chats at once:
|
|
31
|
+
A single bot instance can serve many direct and group chats at once: every DM and every group is a channel, and model turns in different channels can progress in parallel; within one channel turns run serially so one conversation's context is not modified by multiple turns at once. Note that isolation between desks is not code-directory isolation; if several channels point at the same project directory, you should still avoid having the main agent edit the same set of files concurrently, or prepare separate Git worktrees for parallel implementation. See [Scaling and concurrency](https://github.com/oyasmi/pipiclaw/blob/main/docs/scaling-and-concurrency.md) for the full boundaries.
|
|
32
32
|
|
|
33
33
|
### Autonomous, and always interruptible
|
|
34
34
|
|
|
@@ -43,7 +43,7 @@ Models support built-in providers, OpenAI-compatible gateways, API keys, and sub
|
|
|
43
43
|
- Providing an always-online dev assistant, internal tech support, or ops collaboration entry point in DingTalk
|
|
44
44
|
- Handing requirement analysis, implementation, review, verification, and documentation to different AI agents working together
|
|
45
45
|
- Following up on coding, investigation, migration, reporting, and periodic work that spans hours or days
|
|
46
|
-
- Keeping
|
|
46
|
+
- Keeping a separate conversation per group and direct chat, sharing one body of memory by default and splitting it with desks when needed
|
|
47
47
|
- Reusing existing model gateways, Claude Code / Codex CLI accounts, and team working conventions
|
|
48
48
|
|
|
49
49
|
Pipiclaw today targets individuals and small teams, self-hosted, single-instance. It is not a hard multi-tenant SaaS, and it does not provide an OS-level sandbox; the real permissions an external agent holds are determined together by the target CLI's sandbox parameters, the run account, and the host environment.
|
|
@@ -63,13 +63,13 @@ The first real start of `pipiclaw` or `pipiclaw tui` creates:
|
|
|
63
63
|
|
|
64
64
|
```text
|
|
65
65
|
~/.pipiclaw/
|
|
66
|
-
├── channel.json # DingTalk app
|
|
66
|
+
├── channel.json # Channel switches: DingTalk app, Web API
|
|
67
67
|
├── auth.json # model credentials
|
|
68
68
|
├── models.json # custom model providers
|
|
69
69
|
├── settings.json # default model and runtime settings
|
|
70
70
|
├── tools.json # capability switches for web tools, tasks, etc.
|
|
71
71
|
├── security.json # command, path, and network guards
|
|
72
|
-
└── workspace/ #
|
|
72
|
+
└── workspace/ # shared config and extensions; the default desk's data is in desk-default/
|
|
73
73
|
```
|
|
74
74
|
|
|
75
75
|
Set `PIPICLAW_HOME=/your/path` to relocate this directory as a whole.
|
|
@@ -86,7 +86,7 @@ export ANTHROPIC_API_KEY=sk-ant-...
|
|
|
86
86
|
pipiclaw auth login
|
|
87
87
|
```
|
|
88
88
|
|
|
89
|
-
Then
|
|
89
|
+
Then chat right in the terminal (the first run initializes the default desk):
|
|
90
90
|
|
|
91
91
|
```bash
|
|
92
92
|
pipiclaw tui
|
|
@@ -98,7 +98,7 @@ It can also be used for scripted one-shot requests:
|
|
|
98
98
|
pipiclaw tui --print "Reply with only: Pipiclaw model call succeeded"
|
|
99
99
|
```
|
|
100
100
|
|
|
101
|
-
Only an actual model reply proves that the request path works; `pipiclaw tui --help` and `/model` only prove that the CLI or model catalog is visible.
|
|
101
|
+
Only an actual model reply proves that the request path works; `pipiclaw tui --help` and `/model` only prove that the CLI or model catalog is visible. To connect an enterprise gateway, a local model, or set a default model, see [Configuration reference](https://github.com/oyasmi/pipiclaw/blob/main/docs/configuration.md).
|
|
102
102
|
|
|
103
103
|
### 3. Connect DingTalk
|
|
104
104
|
|
|
@@ -113,16 +113,21 @@ Edit `~/.pipiclaw/channel.json`:
|
|
|
113
113
|
|
|
114
114
|
```json
|
|
115
115
|
{
|
|
116
|
-
"
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
116
|
+
"dingtalk": {
|
|
117
|
+
"enabled": true,
|
|
118
|
+
"clientId": "your-dingtalk-client-id",
|
|
119
|
+
"clientSecret": "your-dingtalk-client-secret",
|
|
120
|
+
"robotCode": "",
|
|
121
|
+
"cardTemplateId": "",
|
|
122
|
+
"cardTemplateKey": "content",
|
|
123
|
+
"allowFrom": []
|
|
124
|
+
},
|
|
125
|
+
"webapi": { "enabled": false, "socket": true }
|
|
122
126
|
}
|
|
123
127
|
```
|
|
124
128
|
|
|
125
|
-
- The
|
|
129
|
+
- The `dingtalk` and `webapi` sections each have an `enabled` switch; turn on at least one. `webapi` lets scripts and other services use Pipiclaw through the official OpenAI SDK (see [Web API](https://github.com/oyasmi/pipiclaw/blob/main/docs/webapi.md)).
|
|
130
|
+
- The only hard-required DingTalk fields are `clientId` and `clientSecret`.
|
|
126
131
|
- When `robotCode` is empty it falls back to `clientId`.
|
|
127
132
|
- `cardTemplateId` can be left empty for now; configuring an AI Card is recommended for real use.
|
|
128
133
|
- `allowFrom: []` means all senders are allowed; during a limited rollout, fill in tester staff IDs.
|
|
@@ -134,7 +139,7 @@ Start the daemon:
|
|
|
134
139
|
pipiclaw
|
|
135
140
|
```
|
|
136
141
|
|
|
137
|
-
In DingTalk,
|
|
142
|
+
In DingTalk, message the bot directly or @ it in a group — there is no desk to create or bind. New DMs and groups join the default desk on their first authorized message; `allowFrom` still controls who may use it. Send `/model` to inspect the model reference, and a normal message to verify a real call:
|
|
138
143
|
|
|
139
144
|
```text
|
|
140
145
|
Please introduce yourself and explain what you can do right now
|
|
@@ -177,7 +182,7 @@ Common control entry points:
|
|
|
177
182
|
|
|
178
183
|
External agents do not go through Pipiclaw's command and path guards. The recommended entries above use permissive CLI flags; before using them, read the authorization, security boundary, and sandbox notes in the [Agent delegation guide](https://github.com/oyasmi/pipiclaw/blob/main/docs/sub-agents.md).
|
|
179
184
|
|
|
180
|
-
Long-running external delegations should run in the
|
|
185
|
+
Long-running external delegations should run in the long-lived daemon; without one, the runtime embedded in `pipiclaw tui` handles external-run completions only while the terminal is open.
|
|
181
186
|
|
|
182
187
|
### 5. Optional: enable web tools
|
|
183
188
|
|
|
@@ -195,8 +200,8 @@ Please install and initialize Pipiclaw for me:
|
|
|
195
200
|
2. Run npm install -g @oyasmi/pipiclaw; on a permission failure do not sudo on your own.
|
|
196
201
|
3. Run pipiclaw once to initialize ~/.pipiclaw/; it prompting you to complete channel.json and exiting because it is still a template is normal.
|
|
197
202
|
4. Ask me whether I want to use an API key, a custom provider, or a subscription login supported by pipiclaw auth login; do not invent missing values.
|
|
198
|
-
5. If I want to connect DingTalk, collect clientId, clientSecret, optional cardTemplateId, and allowFrom item by item, write them into channel.json, and remove all your-* placeholder values.
|
|
199
|
-
6. When configuration is done, ask first whether to start. Terminal mode uses pipiclaw tui; DingTalk mode uses pipiclaw.
|
|
203
|
+
5. If I want to connect DingTalk, collect clientId, clientSecret, optional cardTemplateId, and allowFrom item by item, write them into the `dingtalk` section of channel.json, and remove all your-* placeholder values.
|
|
204
|
+
6. When configuration is done, ask first whether to start. Terminal mode uses pipiclaw tui; DingTalk mode uses pipiclaw, and after it starts message the bot directly or @ it in a group — no desk needs to be created or bound.
|
|
200
205
|
7. Honestly list the operations performed, files changed, verification results, and information still missing; do not pretend it succeeded.
|
|
201
206
|
```
|
|
202
207
|
|
|
@@ -210,14 +215,15 @@ Please install and initialize Pipiclaw for me:
|
|
|
210
215
|
| `/stop` | Stop the current turn; a task-driven turn also pauses its task |
|
|
211
216
|
| `/steer <message>` | Adjust the running turn |
|
|
212
217
|
| `/followup <message>` | Queue the next request |
|
|
218
|
+
| `/desk [list\|new <name>\|bind <name>]` | Advanced: create a desk, or switch the current channel to another desk |
|
|
213
219
|
| `/status` | Execution status, model, context, uptime, and version |
|
|
214
|
-
| `/usage [7d\|month]` | Model usage and cost for
|
|
220
|
+
| `/usage [7d\|month]` | Model usage and cost for the current desk and globally |
|
|
215
221
|
| `/tasks ...` | View, diagnose, and control long-running tasks |
|
|
216
222
|
| `/subagents ...` | View and control delegation runs and the role directory |
|
|
217
|
-
| `/memory ...` | View
|
|
223
|
+
| `/memory ...` | View the current desk's long-term memory |
|
|
218
224
|
| `/model [ref]` | View or switch the model |
|
|
219
225
|
|
|
220
|
-
`/help`, `/stop`, `/steer`, `/followup`, `/events`, `/tasks`, `/status`, `/usage`, `/context`, and `/subagents` are handled directly by the runtime and work mid-turn. `/stop` does not cancel an already dispatched delegation run; use `/subagents cancel`.
|
|
226
|
+
`/help`, `/stop`, `/steer`, `/followup`, `/desk`, `/events`, `/tasks`, `/status`, `/usage`, `/context`, and `/subagents` are handled directly by the runtime and work mid-turn. `/stop` does not cancel an already dispatched delegation run; use `/subagents cancel`.
|
|
221
227
|
|
|
222
228
|
See [Interaction and commands](https://github.com/oyasmi/pipiclaw/blob/main/docs/interaction-and-commands.md) for full interaction details.
|
|
223
229
|
|
package/README.md
CHANGED
|
@@ -18,17 +18,17 @@ Pipiclaw 是一个面向个人和团队的 AI coding assistant runtime。它让
|
|
|
18
18
|
|
|
19
19
|
Pipiclaw 同时支持两类委派:内置子智能体在进程内完成检索、日志筛查等轻量工作;外部智能体则启动真实的 Claude Code、Codex CLI 或任意脚本,处理需要长时间运行、跨多个文件和反复自测的重型任务。
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
在钉钉常驻模式中,外部任务派发后在后台继续执行,完成时自动唤醒发起委派的频道。你可以随时用 `/subagents` 查看运行状态、实际命令和产出,用 `/subagents cancel` 直接终止,也可以让主智能体在已结束的 Claude Code / Codex 会话上继续追问。仓库附带按能力与成本组织的推荐条目,以及可参考的早期岗位角色模板。
|
|
22
22
|
|
|
23
23
|
### 工作不会随着一次对话结束
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
Pipiclaw 是你的同一个个人助手:终端、钉钉私聊和多个群聊默认共享长期记忆、按天日志、任务、定时事件和工作文件(都记在默认工位 `default` 里),各自保留独立对话,直接聊天即可。共享也意味着私聊里告诉助手的事,可能在群里被想起;需要把项目或用途分开时,再使用进阶的 [工位机制](https://github.com/oyasmi/pipiclaw/blob/main/docs/scaling-and-concurrency.md#按需分开工位):每个工位有独立的记忆、任务和文件。任务是一次性项目,用 Markdown 保存目标、完成标准和工作项,用 JSONL 循环日志记录步骤、派发与结算;内建 task driver 推进可运行任务、兑现到期等待票并处理兜底超时,周期与定时工作由事件模板每次生成独立任务实例,预算耗尽、空转或连续无法兑现等待时会停止并告诉你。
|
|
26
26
|
|
|
27
27
|
### 原生工作在钉钉里
|
|
28
28
|
|
|
29
29
|
Pipiclaw 使用钉钉 Stream Mode,不需要自建消息中转服务或公网 IP。AI Card 可以持续显示思考、工具执行和状态更新;任务进行中仍可用 `/steer` 调整方向、`/followup` 排队下一件事、`/stop` 中止当前回合。生成的报表、截图和导出文件可以作为钉钉原生附件直接交付。
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
同一个机器人实例可以同时服务多个私聊和群聊:每个私聊、每个群都是一个频道,不同频道的模型回合可以并行推进;同一频道内则串行执行,避免一段对话的上下文被多个回合同时修改。需要注意的是,工位之间的隔离不等于代码目录隔离;如果多个频道指向同一个项目目录,仍应避免让主智能体同时修改同一批文件,或为并行实现准备独立的 Git worktree。完整边界见[并发与容量](https://github.com/oyasmi/pipiclaw/blob/main/docs/scaling-and-concurrency.md)。
|
|
32
32
|
|
|
33
33
|
### 能自主,也能随时接管
|
|
34
34
|
|
|
@@ -43,7 +43,7 @@ Pipiclaw 使用钉钉 Stream Mode,不需要自建消息中转服务或公网 I
|
|
|
43
43
|
- 在钉钉中提供长期在线的研发助手、内部技术支持或运维协作入口
|
|
44
44
|
- 把需求分析、实现、评审、验证、文档整理交给不同 AI 智能体协作完成
|
|
45
45
|
- 跟进跨小时或跨天的编码、调查、迁移、报告和周期性工作
|
|
46
|
-
-
|
|
46
|
+
- 在多个群和私聊中保留各自独立的对话;默认共享同一份积累,需要分开时再用工位
|
|
47
47
|
- 复用现有模型网关、Claude Code / Codex CLI 账号和团队工作规范
|
|
48
48
|
|
|
49
49
|
Pipiclaw 当前定位是个人与小团队、自托管、单实例运行。它不是强多租户 SaaS,也不提供 OS 级沙箱;外部智能体拥有的真实权限由目标 CLI 的 sandbox 参数、运行账号和宿主环境共同决定。
|
|
@@ -63,13 +63,13 @@ pipiclaw tui --help
|
|
|
63
63
|
|
|
64
64
|
```text
|
|
65
65
|
~/.pipiclaw/
|
|
66
|
-
├── channel.json #
|
|
66
|
+
├── channel.json # 渠道开关:钉钉应用、Web API
|
|
67
67
|
├── auth.json # 模型凭据
|
|
68
68
|
├── models.json # 自定义模型提供方
|
|
69
69
|
├── settings.json # 默认模型与运行设置
|
|
70
70
|
├── tools.json # Web 工具、任务等能力开关
|
|
71
71
|
├── security.json # 命令、路径与网络守卫
|
|
72
|
-
└── workspace/ #
|
|
72
|
+
└── workspace/ # 共享配置与扩展;默认工位的数据在 desk-default/
|
|
73
73
|
```
|
|
74
74
|
|
|
75
75
|
设置 `PIPICLAW_HOME=/your/path` 可以整体迁移这个目录。
|
|
@@ -86,7 +86,7 @@ export ANTHROPIC_API_KEY=sk-ant-...
|
|
|
86
86
|
pipiclaw auth login
|
|
87
87
|
```
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
然后直接在终端里聊天(首次运行自动初始化默认工位):
|
|
90
90
|
|
|
91
91
|
```bash
|
|
92
92
|
pipiclaw tui
|
|
@@ -98,7 +98,7 @@ pipiclaw tui
|
|
|
98
98
|
pipiclaw tui --print "只回复:Pipiclaw 模型调用成功"
|
|
99
99
|
```
|
|
100
100
|
|
|
101
|
-
看到模型实际回复才表示调用链路已经跑通;`pipiclaw tui --help` 或 `/model` 只能证明 CLI
|
|
101
|
+
看到模型实际回复才表示调用链路已经跑通;`pipiclaw tui --help` 或 `/model` 只能证明 CLI 或模型目录可见。如需接入企业网关、本地模型或指定默认模型,请看[配置速查](https://github.com/oyasmi/pipiclaw/blob/main/docs/configuration.md)。
|
|
102
102
|
|
|
103
103
|
### 3. 接入钉钉
|
|
104
104
|
|
|
@@ -113,15 +113,20 @@ pipiclaw tui --print "只回复:Pipiclaw 模型调用成功"
|
|
|
113
113
|
|
|
114
114
|
```json
|
|
115
115
|
{
|
|
116
|
-
"
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
116
|
+
"dingtalk": {
|
|
117
|
+
"enabled": true,
|
|
118
|
+
"clientId": "your-dingtalk-client-id",
|
|
119
|
+
"clientSecret": "your-dingtalk-client-secret",
|
|
120
|
+
"robotCode": "",
|
|
121
|
+
"cardTemplateId": "",
|
|
122
|
+
"cardTemplateKey": "content",
|
|
123
|
+
"allowFrom": []
|
|
124
|
+
},
|
|
125
|
+
"webapi": { "enabled": false, "socket": true }
|
|
122
126
|
}
|
|
123
127
|
```
|
|
124
128
|
|
|
129
|
+
- `dingtalk` 和 `webapi` 两段各有 `enabled` 开关,至少打开一个;`webapi` 让脚本和其他服务用官方 OpenAI SDK 使用 Pipiclaw(见 [Web API](https://github.com/oyasmi/pipiclaw/blob/main/docs/webapi.md))。
|
|
125
130
|
- 硬性必填只有 `clientId` 和 `clientSecret`。
|
|
126
131
|
- `robotCode` 留空时回退到 `clientId`。
|
|
127
132
|
- `cardTemplateId` 可暂时留空;正式使用建议配置 AI Card。
|
|
@@ -134,7 +139,7 @@ pipiclaw tui --print "只回复:Pipiclaw 模型调用成功"
|
|
|
134
139
|
pipiclaw
|
|
135
140
|
```
|
|
136
141
|
|
|
137
|
-
|
|
142
|
+
在钉钉中直接私聊,或把机器人拉进群后 @它,无需创建或绑定工位。新私聊和新群默认接入默认工位;`allowFrom` 仍控制哪些发送者可以使用。发送 `/model` 检查模型引用,再发送一条普通消息验证真实调用:
|
|
138
143
|
|
|
139
144
|
```text
|
|
140
145
|
请介绍一下你自己,并说明你现在能做什么
|
|
@@ -177,7 +182,7 @@ cp "$PIPICLAW_PACKAGE_DIR"/examples/sub-agents/agents/{claude-main,codex-main}.m
|
|
|
177
182
|
|
|
178
183
|
外部智能体不会经过 Pipiclaw 的命令和路径守卫。上述推荐条目使用放开权限的 CLI 参数;使用前必须阅读[智能体委派指南](https://github.com/oyasmi/pipiclaw/blob/main/docs/sub-agents.md)中的授权、安全边界和 sandbox 说明。
|
|
179
184
|
|
|
180
|
-
|
|
185
|
+
长时间外部委派应运行在常驻 daemon 中;没有 daemon 时终端内嵌的运行时只在终端打开期间处理外部 run 的完成通知。
|
|
181
186
|
|
|
182
187
|
### 5. 可选:启用 Web 工具
|
|
183
188
|
|
|
@@ -195,8 +200,8 @@ cp "$PIPICLAW_PACKAGE_DIR"/examples/sub-agents/agents/{claude-main,codex-main}.m
|
|
|
195
200
|
2. 执行 npm install -g @oyasmi/pipiclaw;权限失败时不要自行 sudo。
|
|
196
201
|
3. 运行一次 pipiclaw 初始化 ~/.pipiclaw/;它因 channel.json 仍是模板而提示补全并退出是正常现象。
|
|
197
202
|
4. 询问我要使用 API key、自定义 provider,还是 pipiclaw auth login 支持的订阅登录;不要编造缺失值。
|
|
198
|
-
5. 如果我要接入钉钉,逐项收集 clientId、clientSecret、可选的 cardTemplateId 和 allowFrom,写入 channel.json
|
|
199
|
-
6. 配置完成后先询问是否启动。终端模式用 pipiclaw tui;钉钉模式用 pipiclaw
|
|
203
|
+
5. 如果我要接入钉钉,逐项收集 clientId、clientSecret、可选的 cardTemplateId 和 allowFrom,写入 channel.json 的 dingtalk 段,并清除所有 your-* 占位值。
|
|
204
|
+
6. 配置完成后先询问是否启动。终端模式用 pipiclaw tui;钉钉模式用 pipiclaw,启动后直接私聊或在群里 @机器人,无需创建或绑定工位。
|
|
200
205
|
7. 如实列出做过的操作、修改的文件、验证结果和仍缺少的信息,不要假装成功。
|
|
201
206
|
```
|
|
202
207
|
|
|
@@ -210,14 +215,15 @@ cp "$PIPICLAW_PACKAGE_DIR"/examples/sub-agents/agents/{claude-main,codex-main}.m
|
|
|
210
215
|
| `/stop` | 停止当前回合;任务驱动的回合会同时暂停对应任务 |
|
|
211
216
|
| `/steer <消息>` | 调整正在执行的回合 |
|
|
212
217
|
| `/followup <消息>` | 排队下一条请求 |
|
|
218
|
+
| `/desk [list\|new <名字>\|bind <名字>]` | 进阶:创建工位,或把当前频道切换到另一个工位 |
|
|
213
219
|
| `/status` | 查看执行状态、模型、上下文、运行时长和版本 |
|
|
214
|
-
| `/usage [7d\|month]` |
|
|
220
|
+
| `/usage [7d\|month]` | 查看当前工位与全局的模型用量和成本 |
|
|
215
221
|
| `/tasks ...` | 查看、诊断和控制长期任务 |
|
|
216
222
|
| `/subagents ...` | 查看、控制委派 run 和角色目录 |
|
|
217
|
-
| `/memory ...` |
|
|
223
|
+
| `/memory ...` | 查看当前工位的长期记忆 |
|
|
218
224
|
| `/model [引用]` | 查看或切换模型 |
|
|
219
225
|
|
|
220
|
-
`/help`、`/stop`、`/steer`、`/followup`、`/events`、`/tasks`、`/status`、`/usage`、`/context` 和 `/subagents` 由运行时直接处理,回合进行中也能使用。`/stop` 不会取消已经派发的委派 run;请使用 `/subagents cancel`。
|
|
226
|
+
`/help`、`/stop`、`/steer`、`/followup`、`/desk`、`/events`、`/tasks`、`/status`、`/usage`、`/context` 和 `/subagents` 由运行时直接处理,回合进行中也能使用。`/stop` 不会取消已经派发的委派 run;请使用 `/subagents cancel`。
|
|
221
227
|
|
|
222
228
|
完整交互说明见[交互与命令](https://github.com/oyasmi/pipiclaw/blob/main/docs/interaction-and-commands.md)。
|
|
223
229
|
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* "nothing to stop/steer" replies). The stateless report commands (`/tasks`, `/events`, …) never
|
|
4
4
|
* reach here — they go through `commands/router.ts`.
|
|
5
5
|
*/
|
|
6
|
-
import type { ChannelContext } from "../channel/channel-context.js";
|
|
7
6
|
import { type RunnerBuiltInCommand } from "../commands/catalog.js";
|
|
8
7
|
/** The slice of the runner a built-in command reads; everything else it needs is the command itself. */
|
|
9
8
|
export interface BuiltinCommandHost {
|
|
@@ -16,4 +15,10 @@ export interface BuiltinCommandHost {
|
|
|
16
15
|
}
|
|
17
16
|
/** A `/steer` or `/followup` needs a message: the trimmed text, or an error telling the user how. */
|
|
18
17
|
export declare function requireQueuedMessage(text: string, commandName: "steer" | "followup"): string;
|
|
19
|
-
|
|
18
|
+
/**
|
|
19
|
+
* The reply to a runner-handled built-in command. It is returned, not delivered: the caller sends
|
|
20
|
+
* it as a command reply (titled, never archived — command echoes are ephemeral control-plane
|
|
21
|
+
* traffic, not conversation, and must not be re-consumed as memory-extraction input; review
|
|
22
|
+
* 2026-08-24 §1.2).
|
|
23
|
+
*/
|
|
24
|
+
export declare function handleBuiltinCommand(host: BuiltinCommandHost, command: RunnerBuiltInCommand): Promise<string>;
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The runner-handled built-in slash commands typed on an idle channel (`/help`, `/context`, and the
|
|
3
|
+
* "nothing to stop/steer" replies). The stateless report commands (`/tasks`, `/events`, …) never
|
|
4
|
+
* reach here — they go through `commands/router.ts`.
|
|
5
|
+
*/
|
|
1
6
|
import { formatMissingQueueMessage, formatNoRunningTurn, renderBuiltInHelp, } from "../commands/catalog.js";
|
|
2
7
|
import * as log from "../log.js";
|
|
3
8
|
import { errorMessage } from "../shared/text-utils.js";
|
|
@@ -28,17 +33,13 @@ function renderHelpWithDiscovery(host, args) {
|
|
|
28
33
|
}
|
|
29
34
|
return sections.join("\n\n");
|
|
30
35
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
await ctx.flush();
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
export async function handleBuiltinCommand(host, ctx, command) {
|
|
36
|
+
/**
|
|
37
|
+
* The reply to a runner-handled built-in command. It is returned, not delivered: the caller sends
|
|
38
|
+
* it as a command reply (titled, never archived — command echoes are ephemeral control-plane
|
|
39
|
+
* traffic, not conversation, and must not be re-consumed as memory-extraction input; review
|
|
40
|
+
* 2026-08-24 §1.2).
|
|
41
|
+
*/
|
|
42
|
+
export async function handleBuiltinCommand(host, command) {
|
|
42
43
|
try {
|
|
43
44
|
// `/help` and `/context` read the session (prompt templates, active model).
|
|
44
45
|
// The session runtime is built asynchronously after construction, so a command
|
|
@@ -46,24 +47,19 @@ export async function handleBuiltinCommand(host, ctx, command) {
|
|
|
46
47
|
await host.ensureSessionReady();
|
|
47
48
|
switch (command.name) {
|
|
48
49
|
case "help":
|
|
49
|
-
|
|
50
|
-
return;
|
|
50
|
+
return renderHelpWithDiscovery(host, command.args);
|
|
51
51
|
case "context":
|
|
52
|
-
|
|
53
|
-
return;
|
|
52
|
+
return host.renderContextReport(command.args);
|
|
54
53
|
case "stop":
|
|
55
|
-
|
|
56
|
-
return;
|
|
54
|
+
return formatNoRunningTurn("stop");
|
|
57
55
|
case "steer":
|
|
58
56
|
requireQueuedMessage(command.args, "steer");
|
|
59
|
-
|
|
60
|
-
return;
|
|
57
|
+
return formatNoRunningTurn("steer");
|
|
61
58
|
case "followup":
|
|
62
59
|
requireQueuedMessage(command.args, "followup");
|
|
63
|
-
|
|
64
|
-
return;
|
|
60
|
+
return formatNoRunningTurn("followup");
|
|
65
61
|
default: {
|
|
66
|
-
// The stateless report commands (events/tasks/status/usage/subagents/
|
|
62
|
+
// The stateless report commands (events/tasks/status/usage/subagents/skills — see
|
|
67
63
|
// `BUILT_IN_COMMANDS`'s `runnerHandled: false` entries) are routed to their own
|
|
68
64
|
// handlers upstream and never reach here; the narrowed parameter type makes that a
|
|
69
65
|
// compile-time guarantee.
|
|
@@ -75,6 +71,6 @@ export async function handleBuiltinCommand(host, ctx, command) {
|
|
|
75
71
|
catch (err) {
|
|
76
72
|
const errMsg = errorMessage(err);
|
|
77
73
|
log.logWarn("agent.command.failed", "Built-in command failed", { channelId: host.channelId, reason: errMsg });
|
|
78
|
-
|
|
74
|
+
return `命令执行失败:${errMsg}`;
|
|
79
75
|
}
|
|
80
76
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { ChannelContext } from "../channel/channel-context.js";
|
|
2
2
|
import type { InboundImage } from "../channel/channel-event.js";
|
|
3
3
|
import type { ChannelStore } from "../channel/store.js";
|
|
4
|
+
import type { TurnInfo } from "../channel/transport.js";
|
|
4
5
|
import { type RunnerBuiltInCommand } from "../commands/catalog.js";
|
|
6
|
+
import type { DeskConversation } from "../desk/types.js";
|
|
5
7
|
import type { MemoryMaintenanceRuntimeContext } from "../memory/scheduler.js";
|
|
6
8
|
import type { SubAgentDiscoveryResult } from "../subagents/discovery.js";
|
|
7
9
|
import type { UsageTotals } from "../usage/totals.js";
|
|
@@ -12,21 +14,16 @@ export declare class ChannelRunner implements AgentRunner {
|
|
|
12
14
|
private readonly jobManager;
|
|
13
15
|
private readonly runManager;
|
|
14
16
|
private readonly fileStore;
|
|
17
|
+
readonly conversation: DeskConversation;
|
|
15
18
|
private readonly channelId;
|
|
16
|
-
|
|
19
|
+
/** This channel's conversation directory inside the desk: sessions, active pointer, archive. */
|
|
20
|
+
private readonly conversationDir;
|
|
17
21
|
private readonly appHomeDir;
|
|
18
22
|
private readonly authConfigPath;
|
|
19
23
|
private readonly modelsConfigPath;
|
|
20
24
|
private readonly onSessionEvent?;
|
|
21
|
-
private readonly
|
|
25
|
+
private readonly sendMedia?;
|
|
22
26
|
private readonly workspaceDir;
|
|
23
|
-
/**
|
|
24
|
-
* Frozen for the lifetime of this runner generation (spec 043, D4.2): AgentSession, the
|
|
25
|
-
* ResourceLoader, and every tool closure built in this constructor and in `createSessionRuntime`
|
|
26
|
-
* (session-topology rebuilds only rebind the session, never the scope) all read this same value.
|
|
27
|
-
* Changing project is a dispose-and-rebuild of the whole runner, not a field mutation.
|
|
28
|
-
*/
|
|
29
|
-
private readonly projectScope;
|
|
30
27
|
/** Re-read per use, not captured once: an edited security.json takes effect without a restart. */
|
|
31
28
|
private readonly loadSecurityConfig;
|
|
32
29
|
private readonly settingsManager;
|
|
@@ -34,6 +31,7 @@ export declare class ChannelRunner implements AgentRunner {
|
|
|
34
31
|
private readonly turnFinisher;
|
|
35
32
|
private readonly pipeline;
|
|
36
33
|
private readonly memoryLifecycle;
|
|
34
|
+
private readonly requestScoped;
|
|
37
35
|
private readonly ledger;
|
|
38
36
|
private readonly memoryActivityRecorder;
|
|
39
37
|
private readonly models;
|
|
@@ -43,7 +41,7 @@ export declare class ChannelRunner implements AgentRunner {
|
|
|
43
41
|
/** Set once transport-level `/new` replaces this generation. A retired runner is never reused. */
|
|
44
42
|
private retired;
|
|
45
43
|
private runState;
|
|
46
|
-
constructor(
|
|
44
|
+
constructor(conversation: DeskConversation, paths: RunnerFactoryPaths, deps: RunnerDeps);
|
|
47
45
|
private get session();
|
|
48
46
|
private get sessionManager();
|
|
49
47
|
beginTurn(taskText: string): void;
|
|
@@ -52,7 +50,7 @@ export declare class ChannelRunner implements AgentRunner {
|
|
|
52
50
|
isBusy(): boolean;
|
|
53
51
|
requestStop(): void;
|
|
54
52
|
getTurnStatus(): TurnStatus;
|
|
55
|
-
run(
|
|
53
|
+
run(info: TurnInfo, channel: ChannelContext, store: ChannelStore): Promise<{
|
|
56
54
|
stopReason: string;
|
|
57
55
|
errorMessage?: string;
|
|
58
56
|
usage: UsageTotals;
|
|
@@ -60,7 +58,7 @@ export declare class ChannelRunner implements AgentRunner {
|
|
|
60
58
|
durationMs: number;
|
|
61
59
|
silent: boolean;
|
|
62
60
|
}>;
|
|
63
|
-
handleBuiltinCommand(
|
|
61
|
+
handleBuiltinCommand(command: RunnerBuiltInCommand): Promise<string>;
|
|
64
62
|
/**
|
|
65
63
|
* True if `text` is a slash command the runtime or session layer can handle:
|
|
66
64
|
* a built-in, a session command (`/model` …), a skill (`/skill:name`), or a
|
|
@@ -73,11 +71,12 @@ export declare class ChannelRunner implements AgentRunner {
|
|
|
73
71
|
flushMemoryForShutdown(): Promise<void>;
|
|
74
72
|
dispose(): Promise<void>;
|
|
75
73
|
getMemoryMaintenanceContext(): Promise<MemoryMaintenanceRuntimeContext>;
|
|
76
|
-
getStatusSnapshot(): RunnerStatusSnapshot;
|
|
74
|
+
getStatusSnapshot(): RunnerStatusSnapshot | undefined;
|
|
77
75
|
abort(): Promise<void>;
|
|
78
76
|
isCompacting(): boolean;
|
|
79
77
|
interruptCompaction(): boolean;
|
|
80
78
|
retireForNewSession(): void;
|
|
79
|
+
retireForRecovery(): void;
|
|
81
80
|
/**
|
|
82
81
|
* `/context` — read-only prompt accounting, no LLM cost. Reports the section
|
|
83
82
|
* breakdown of the system prompt, the tool schemas (billed on top of it, and
|
|
@@ -106,5 +105,6 @@ export declare class ChannelRunner implements AgentRunner {
|
|
|
106
105
|
private recordMemoryActivity;
|
|
107
106
|
/** Best-effort: a lost activity counter delays maintenance, it never breaks a turn. */
|
|
108
107
|
private flushMemoryActivity;
|
|
108
|
+
private cancelOutput;
|
|
109
109
|
private resetRunState;
|
|
110
110
|
}
|