@poolzin/pool-bot 2026.2.0 → 2026.2.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/CHANGELOG.md +118 -0
- package/README-header.png +0 -0
- package/dist/agents/bash-tools.exec.js +76 -25
- package/dist/agents/cli-runner/helpers.js +9 -11
- package/dist/agents/context.js +1 -1
- package/dist/agents/identity.js +47 -7
- package/dist/agents/memory-search.js +25 -8
- package/dist/agents/model-catalog.js +1 -1
- package/dist/agents/model-selection.js +21 -0
- package/dist/agents/pi-embedded-block-chunker.js +117 -42
- package/dist/agents/pi-embedded-helpers/errors.js +183 -78
- package/dist/agents/pi-embedded-helpers.js +1 -1
- package/dist/agents/pi-embedded-runner/compact.js +8 -10
- package/dist/agents/pi-embedded-runner/model.js +62 -3
- package/dist/agents/pi-embedded-runner/run/attempt.js +21 -11
- package/dist/agents/pi-embedded-runner/run.js +199 -46
- package/dist/agents/pi-embedded-runner/system-prompt.js +10 -2
- package/dist/agents/pi-embedded-subscribe.js +118 -29
- package/dist/agents/pi-tools.js +10 -5
- package/dist/agents/poolbot-tools.js +15 -10
- package/dist/agents/sandbox-paths.js +31 -0
- package/dist/agents/session-tool-result-guard.js +94 -15
- package/dist/agents/shell-utils.js +51 -0
- package/dist/agents/skills/bundled-context.js +23 -0
- package/dist/agents/skills/bundled-dir.js +41 -7
- package/dist/agents/skills-install.js +60 -23
- package/dist/agents/subagent-announce.js +79 -34
- package/dist/agents/tool-policy.conformance.js +14 -0
- package/dist/agents/tool-policy.js +24 -0
- package/dist/agents/tools/cron-tool.js +166 -19
- package/dist/agents/tools/discord-actions-presence.js +78 -0
- package/dist/agents/tools/image-tool.js +1 -1
- package/dist/agents/tools/message-tool.js +56 -2
- package/dist/agents/tools/sessions-history-tool.js +69 -1
- package/dist/agents/tools/web-search.js +211 -42
- package/dist/agents/usage.js +23 -1
- package/dist/agents/workspace-run.js +67 -0
- package/dist/agents/workspace-templates.js +44 -0
- package/dist/auto-reply/command-auth.js +121 -6
- package/dist/auto-reply/envelope.js +74 -82
- package/dist/auto-reply/reply/commands-compact.js +1 -0
- package/dist/auto-reply/reply/commands-context-report.js +1 -0
- package/dist/auto-reply/reply/commands-context.js +1 -0
- package/dist/auto-reply/reply/commands-models.js +107 -60
- package/dist/auto-reply/reply/commands-ptt.js +171 -0
- package/dist/auto-reply/reply/get-reply-run.js +2 -1
- package/dist/auto-reply/reply/inbound-context.js +5 -1
- package/dist/auto-reply/reply/mentions.js +1 -1
- package/dist/auto-reply/reply/model-selection.js +3 -3
- package/dist/auto-reply/thinking.js +88 -43
- package/dist/browser/bridge-server.js +13 -0
- package/dist/browser/cdp.helpers.js +38 -24
- package/dist/browser/client-fetch.js +50 -7
- package/dist/browser/config.js +1 -10
- package/dist/browser/extension-relay.js +101 -40
- package/dist/browser/pw-ai.js +1 -1
- package/dist/browser/pw-session.js +143 -8
- package/dist/browser/pw-tools-core.interactions.js +125 -27
- package/dist/browser/pw-tools-core.responses.js +1 -1
- package/dist/browser/pw-tools-core.state.js +1 -1
- package/dist/browser/routes/agent.act.js +86 -41
- package/dist/browser/routes/dispatcher.js +4 -4
- package/dist/browser/screenshot.js +1 -1
- package/dist/browser/server.js +13 -0
- package/dist/build-info.json +3 -3
- package/dist/canvas-host/a2ui/index.html +28 -28
- package/dist/channels/reply-prefix.js +8 -1
- package/dist/cli/cron-cli/register.cron-add.js +61 -40
- package/dist/cli/cron-cli/register.cron-edit.js +60 -34
- package/dist/cli/cron-cli/shared.js +56 -41
- package/dist/cli/dns-cli.js +26 -14
- package/dist/cli/gateway-cli/register.js +37 -19
- package/dist/cli/memory-cli.js +5 -5
- package/dist/cli/parse-bytes.js +37 -0
- package/dist/cli/update-cli.js +173 -52
- package/dist/commands/agent.js +1 -0
- package/dist/commands/auth-choice.apply.oauth.js +1 -1
- package/dist/commands/doctor-config-flow.js +61 -5
- package/dist/commands/doctor-state-migrations.js +1 -1
- package/dist/commands/health.js +1 -1
- package/dist/commands/model-allowlist.js +29 -0
- package/dist/commands/model-picker.js +2 -1
- package/dist/commands/models/list.registry.js +1 -1
- package/dist/commands/models/list.status-command.js +43 -23
- package/dist/commands/models/shared.js +15 -0
- package/dist/commands/onboard-custom.js +384 -0
- package/dist/commands/onboard-non-interactive/local/auth-choice-inference.js +35 -0
- package/dist/commands/onboard-non-interactive/local/auth-choice.js +6 -3
- package/dist/commands/onboard-skills.js +63 -38
- package/dist/commands/openai-model-default.js +41 -0
- package/dist/compat/legacy-names.js +2 -0
- package/dist/config/defaults.js +3 -2
- package/dist/config/paths.js +136 -35
- package/dist/config/plugin-auto-enable.js +21 -5
- package/dist/config/redact-snapshot.js +153 -0
- package/dist/config/schema.field-metadata.js +590 -0
- package/dist/config/schema.js +2 -2
- package/dist/config/sessions/store.js +291 -23
- package/dist/config/zod-schema.agent-defaults.js +3 -0
- package/dist/config/zod-schema.agent-runtime.js +13 -2
- package/dist/config/zod-schema.providers-core.js +142 -0
- package/dist/config/zod-schema.session.js +3 -0
- package/dist/control-ui/assets/{index-CIRDm-Lu.css → index-CSfXd2LO.css} +1 -1
- package/dist/control-ui/assets/{index-CmNMuoem.js → index-HRr1grwl.js} +446 -413
- package/dist/control-ui/assets/index-HRr1grwl.js.map +1 -0
- package/dist/control-ui/index.html +4 -4
- package/dist/cron/delivery.js +57 -0
- package/dist/cron/isolated-agent/delivery-target.js +18 -3
- package/dist/cron/isolated-agent/helpers.js +22 -5
- package/dist/cron/isolated-agent/run.js +172 -63
- package/dist/cron/isolated-agent/session.js +2 -0
- package/dist/cron/normalize.js +356 -28
- package/dist/cron/parse.js +10 -5
- package/dist/cron/run-log.js +35 -10
- package/dist/cron/schedule.js +41 -6
- package/dist/cron/service/jobs.js +208 -35
- package/dist/cron/service/ops.js +72 -16
- package/dist/cron/service/state.js +2 -0
- package/dist/cron/service/store.js +386 -14
- package/dist/cron/service/timer.js +390 -147
- package/dist/cron/session-reaper.js +86 -0
- package/dist/cron/store.js +23 -8
- package/dist/cron/validate-timestamp.js +43 -0
- package/dist/discord/monitor/agent-components.js +438 -0
- package/dist/discord/monitor/allow-list.js +28 -5
- package/dist/discord/monitor/gateway-registry.js +29 -0
- package/dist/discord/monitor/native-command.js +44 -23
- package/dist/discord/monitor/sender-identity.js +45 -0
- package/dist/discord/pluralkit.js +27 -0
- package/dist/discord/send.outbound.js +92 -5
- package/dist/discord/send.shared.js +60 -23
- package/dist/discord/targets.js +84 -1
- package/dist/entry.js +15 -9
- package/dist/extensionAPI.js +8 -0
- package/dist/gateway/control-ui.js +8 -1
- package/dist/gateway/hooks-mapping.js +3 -0
- package/dist/gateway/hooks.js +65 -0
- package/dist/gateway/net.js +96 -31
- package/dist/gateway/node-command-policy.js +50 -15
- package/dist/gateway/origin-check.js +56 -0
- package/dist/gateway/protocol/client-info.js +9 -0
- package/dist/gateway/protocol/index.js +9 -2
- package/dist/gateway/protocol/schema/agents-models-skills.js +71 -1
- package/dist/gateway/protocol/schema/cron.js +22 -10
- package/dist/gateway/protocol/schema/protocol-schemas.js +16 -2
- package/dist/gateway/protocol/schema/sessions.js +12 -0
- package/dist/gateway/server/hooks.js +1 -1
- package/dist/gateway/server-broadcast.js +26 -9
- package/dist/gateway/server-chat.js +112 -23
- package/dist/gateway/server-discovery-runtime.js +10 -2
- package/dist/gateway/server-http.js +109 -11
- package/dist/gateway/server-methods/agent-timestamp.js +60 -0
- package/dist/gateway/server-methods/agents.js +321 -2
- package/dist/gateway/server-methods/usage.js +559 -16
- package/dist/gateway/server-runtime-state.js +22 -8
- package/dist/gateway/server-startup-memory.js +16 -0
- package/dist/gateway/server.impl.js +5 -1
- package/dist/gateway/session-utils.fs.js +23 -25
- package/dist/gateway/session-utils.js +20 -10
- package/dist/gateway/sessions-patch.js +7 -22
- package/dist/gateway/test-helpers.mocks.js +11 -7
- package/dist/gateway/test-helpers.server.js +35 -2
- package/dist/imessage/constants.js +2 -0
- package/dist/imessage/monitor/deliver.js +4 -1
- package/dist/imessage/monitor/monitor-provider.js +51 -1
- package/dist/infra/bonjour-discovery.js +131 -70
- package/dist/infra/control-ui-assets.js +134 -12
- package/dist/infra/errors.js +12 -0
- package/dist/infra/exec-approvals.js +266 -57
- package/dist/infra/format-time/format-datetime.js +79 -0
- package/dist/infra/format-time/format-duration.js +81 -0
- package/dist/infra/format-time/format-relative.js +80 -0
- package/dist/infra/heartbeat-runner.js +140 -49
- package/dist/infra/home-dir.js +54 -0
- package/dist/infra/net/fetch-guard.js +122 -0
- package/dist/infra/net/ssrf.js +65 -29
- package/dist/infra/outbound/abort.js +14 -0
- package/dist/infra/outbound/message-action-runner.js +77 -13
- package/dist/infra/outbound/outbound-session.js +143 -37
- package/dist/infra/poolbot-root.js +43 -1
- package/dist/infra/session-cost-usage.js +631 -41
- package/dist/infra/state-migrations.js +317 -47
- package/dist/infra/update-global.js +35 -0
- package/dist/infra/update-runner.js +149 -43
- package/dist/infra/warning-filter.js +65 -0
- package/dist/infra/widearea-dns.js +30 -9
- package/dist/logging/redact-identifier.js +12 -0
- package/dist/media/fetch.js +81 -58
- package/dist/media/store.js +2 -0
- package/dist/media-understanding/apply.js +403 -3
- package/dist/media-understanding/attachments.js +38 -27
- package/dist/media-understanding/defaults.js +16 -0
- package/dist/media-understanding/providers/deepgram/audio.js +22 -14
- package/dist/media-understanding/providers/google/audio.js +24 -17
- package/dist/media-understanding/providers/google/video.js +24 -17
- package/dist/media-understanding/providers/image.js +3 -3
- package/dist/media-understanding/providers/index.js +4 -1
- package/dist/media-understanding/providers/openai/audio.js +22 -14
- package/dist/media-understanding/providers/shared.js +16 -11
- package/dist/media-understanding/providers/zai/index.js +6 -0
- package/dist/media-understanding/runner.js +158 -90
- package/dist/memory/batch-voyage.js +277 -0
- package/dist/memory/embeddings-voyage.js +75 -0
- package/dist/memory/embeddings.js +28 -16
- package/dist/memory/internal.js +101 -18
- package/dist/memory/manager.js +154 -48
- package/dist/memory/search-manager.js +173 -0
- package/dist/memory/session-files.js +9 -3
- package/dist/node-host/runner.js +34 -24
- package/dist/node-host/with-timeout.js +27 -0
- package/dist/plugins/commands.js +5 -1
- package/dist/plugins/config-state.js +86 -7
- package/dist/plugins/source-display.js +51 -0
- package/dist/process/exec.js +20 -2
- package/dist/routing/resolve-route.js +12 -0
- package/dist/routing/session-key.js +15 -0
- package/dist/runtime.js +2 -0
- package/dist/security/audit-extra.async.js +601 -0
- package/dist/security/audit-extra.js +2 -830
- package/dist/security/audit-extra.sync.js +505 -0
- package/dist/security/channel-metadata.js +34 -0
- package/dist/security/external-content.js +88 -6
- package/dist/security/skill-scanner.js +330 -0
- package/dist/sessions/session-key-utils.js +7 -0
- package/dist/signal/monitor/event-handler.js +80 -1
- package/dist/slack/monitor/media.js +85 -15
- package/dist/tailscale/detect.js +1 -2
- package/dist/telegram/bot/helpers.js +109 -28
- package/dist/telegram/bot-handlers.js +144 -3
- package/dist/telegram/bot-message-context.js +37 -10
- package/dist/telegram/bot-message-dispatch.js +54 -17
- package/dist/telegram/bot-native-commands.js +86 -29
- package/dist/telegram/bot.js +30 -29
- package/dist/telegram/model-buttons.js +163 -0
- package/dist/telegram/monitor.js +110 -85
- package/dist/telegram/send.js +129 -47
- package/dist/terminal/restore.js +45 -0
- package/dist/test-helpers/state-dir-env.js +16 -0
- package/dist/tts/tts.js +12 -6
- package/dist/tui/tui-session-actions.js +166 -54
- package/dist/utils/fetch-timeout.js +20 -0
- package/dist/utils/normalize-secret-input.js +19 -0
- package/dist/utils/transcript-tools.js +58 -0
- package/dist/utils.js +45 -14
- package/dist/version.js +42 -5
- package/dist/wizard/clack-prompter.js +9 -6
- package/extensions/googlechat/node_modules/.bin/poolbot +21 -0
- package/extensions/googlechat/package.json +2 -2
- package/extensions/line/node_modules/.bin/poolbot +21 -0
- package/extensions/line/package.json +1 -1
- package/extensions/matrix/node_modules/.bin/poolbot +21 -0
- package/extensions/matrix/package.json +1 -1
- package/extensions/memory-core/node_modules/.bin/poolbot +21 -0
- package/extensions/memory-core/package.json +4 -1
- package/extensions/twitch/node_modules/.bin/poolbot +21 -0
- package/extensions/twitch/package.json +1 -1
- package/package.json +183 -24
- package/dist/control-ui/assets/index-CmNMuoem.js.map +0 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
-
<title>
|
|
6
|
+
<title>Poolbot Canvas</title>
|
|
7
7
|
<script>
|
|
8
8
|
(() => {
|
|
9
9
|
try {
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
backface-visibility: hidden;
|
|
82
82
|
opacity: 0.45;
|
|
83
83
|
pointer-events: none;
|
|
84
|
-
animation:
|
|
84
|
+
animation: poolbot-grid-drift 140s ease-in-out infinite alternate;
|
|
85
85
|
}
|
|
86
86
|
:root[data-platform="android"] body::before {
|
|
87
87
|
opacity: 0.8;
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
backface-visibility: hidden;
|
|
102
102
|
transform: translate3d(0, 0, 0);
|
|
103
103
|
pointer-events: none;
|
|
104
|
-
animation:
|
|
104
|
+
animation: poolbot-glow-drift 110s ease-in-out infinite alternate;
|
|
105
105
|
}
|
|
106
106
|
:root[data-platform="android"] body::after {
|
|
107
107
|
opacity: 0.85;
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
opacity: 0.7;
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
|
-
@keyframes
|
|
119
|
+
@keyframes poolbot-grid-drift {
|
|
120
120
|
0% {
|
|
121
121
|
transform: translate3d(-12px, 8px, 0) rotate(-7deg);
|
|
122
122
|
opacity: 0.4;
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
opacity: 0.42;
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
|
-
@keyframes
|
|
133
|
+
@keyframes poolbot-glow-drift {
|
|
134
134
|
0% {
|
|
135
135
|
transform: translate3d(-18px, 12px, 0) scale(1.02);
|
|
136
136
|
opacity: 0.4;
|
|
@@ -153,14 +153,14 @@
|
|
|
153
153
|
touch-action: none;
|
|
154
154
|
z-index: 1;
|
|
155
155
|
}
|
|
156
|
-
:root[data-platform="android"] #
|
|
156
|
+
:root[data-platform="android"] #poolbot-canvas {
|
|
157
157
|
background:
|
|
158
158
|
radial-gradient(1100px 800px at 20% 15%, rgba(42, 113, 255, 0.78), rgba(0, 0, 0, 0) 58%),
|
|
159
159
|
radial-gradient(900px 650px at 82% 28%, rgba(255, 0, 138, 0.66), rgba(0, 0, 0, 0) 62%),
|
|
160
160
|
radial-gradient(1000px 900px at 60% 88%, rgba(0, 209, 255, 0.58), rgba(0, 0, 0, 0) 62%),
|
|
161
161
|
#141c33;
|
|
162
162
|
}
|
|
163
|
-
#
|
|
163
|
+
#poolbot-status {
|
|
164
164
|
position: fixed;
|
|
165
165
|
inset: 0;
|
|
166
166
|
display: none;
|
|
@@ -172,7 +172,7 @@
|
|
|
172
172
|
pointer-events: none;
|
|
173
173
|
z-index: 3;
|
|
174
174
|
}
|
|
175
|
-
#
|
|
175
|
+
#poolbot-status .card {
|
|
176
176
|
width: min(560px, 88vw);
|
|
177
177
|
text-align: left;
|
|
178
178
|
padding: 14px 16px 12px;
|
|
@@ -185,7 +185,7 @@
|
|
|
185
185
|
-webkit-backdrop-filter: blur(18px) saturate(140%);
|
|
186
186
|
backdrop-filter: blur(18px) saturate(140%);
|
|
187
187
|
}
|
|
188
|
-
#
|
|
188
|
+
#poolbot-status .title {
|
|
189
189
|
font:
|
|
190
190
|
600 12px/1.2 -apple-system,
|
|
191
191
|
BlinkMacSystemFont,
|
|
@@ -196,7 +196,7 @@
|
|
|
196
196
|
text-transform: uppercase;
|
|
197
197
|
color: rgba(255, 255, 255, 0.7);
|
|
198
198
|
}
|
|
199
|
-
#
|
|
199
|
+
#poolbot-status .subtitle {
|
|
200
200
|
margin-top: 8px;
|
|
201
201
|
font:
|
|
202
202
|
500 13px/1.45 -apple-system,
|
|
@@ -208,39 +208,39 @@
|
|
|
208
208
|
white-space: pre-wrap;
|
|
209
209
|
overflow-wrap: anywhere;
|
|
210
210
|
}
|
|
211
|
-
|
|
211
|
+
poolbot-a2ui-host {
|
|
212
212
|
display: block;
|
|
213
213
|
height: 100%;
|
|
214
214
|
position: fixed;
|
|
215
215
|
inset: 0;
|
|
216
216
|
z-index: 4;
|
|
217
|
-
--
|
|
218
|
-
--
|
|
219
|
-
--
|
|
220
|
-
--
|
|
221
|
-
--
|
|
222
|
-
--
|
|
223
|
-
--
|
|
217
|
+
--poolbot-a2ui-inset-top: 28px;
|
|
218
|
+
--poolbot-a2ui-inset-right: 0px;
|
|
219
|
+
--poolbot-a2ui-inset-bottom: 0px;
|
|
220
|
+
--poolbot-a2ui-inset-left: 0px;
|
|
221
|
+
--poolbot-a2ui-scroll-pad-bottom: 0px;
|
|
222
|
+
--poolbot-a2ui-status-top: calc(50% - 18px);
|
|
223
|
+
--poolbot-a2ui-empty-top: 18px;
|
|
224
224
|
}
|
|
225
225
|
</style>
|
|
226
226
|
</head>
|
|
227
227
|
<body>
|
|
228
|
-
<canvas id="
|
|
229
|
-
<div id="
|
|
228
|
+
<canvas id="poolbot-canvas"></canvas>
|
|
229
|
+
<div id="poolbot-status">
|
|
230
230
|
<div class="card">
|
|
231
|
-
<div class="title" id="
|
|
232
|
-
<div class="subtitle" id="
|
|
231
|
+
<div class="title" id="poolbot-status-title">Ready</div>
|
|
232
|
+
<div class="subtitle" id="poolbot-status-subtitle">Waiting for agent</div>
|
|
233
233
|
</div>
|
|
234
234
|
</div>
|
|
235
|
-
<
|
|
235
|
+
<poolbot-a2ui-host></poolbot-a2ui-host>
|
|
236
236
|
<script src="a2ui.bundle.js"></script>
|
|
237
237
|
<script>
|
|
238
238
|
(() => {
|
|
239
|
-
const canvas = document.getElementById("
|
|
239
|
+
const canvas = document.getElementById("poolbot-canvas");
|
|
240
240
|
const ctx = canvas.getContext("2d");
|
|
241
|
-
const statusEl = document.getElementById("
|
|
242
|
-
const titleEl = document.getElementById("
|
|
243
|
-
const subtitleEl = document.getElementById("
|
|
241
|
+
const statusEl = document.getElementById("poolbot-status");
|
|
242
|
+
const titleEl = document.getElementById("poolbot-status-title");
|
|
243
|
+
const subtitleEl = document.getElementById("poolbot-status-subtitle");
|
|
244
244
|
const debugStatusEnabledByQuery = (() => {
|
|
245
245
|
try {
|
|
246
246
|
const params = new URLSearchParams(window.location.search);
|
|
@@ -278,7 +278,7 @@
|
|
|
278
278
|
statusEl.style.display = "none";
|
|
279
279
|
}
|
|
280
280
|
|
|
281
|
-
window.
|
|
281
|
+
window.__poolbot = {
|
|
282
282
|
canvas,
|
|
283
283
|
ctx,
|
|
284
284
|
setDebugStatusEnabled,
|
|
@@ -14,8 +14,15 @@ export function createReplyPrefixContext(params) {
|
|
|
14
14
|
};
|
|
15
15
|
return {
|
|
16
16
|
prefixContext,
|
|
17
|
-
responsePrefix: resolveEffectiveMessagesConfig(cfg, agentId
|
|
17
|
+
responsePrefix: resolveEffectiveMessagesConfig(cfg, agentId, {
|
|
18
|
+
channel: params.channel,
|
|
19
|
+
accountId: params.accountId,
|
|
20
|
+
}).responsePrefix,
|
|
18
21
|
responsePrefixContextProvider: () => prefixContext,
|
|
19
22
|
onModelSelected,
|
|
20
23
|
};
|
|
21
24
|
}
|
|
25
|
+
export function createReplyPrefixOptions(params) {
|
|
26
|
+
const { responsePrefix, responsePrefixContextProvider, onModelSelected } = createReplyPrefixContext(params);
|
|
27
|
+
return { responsePrefix, responsePrefixContextProvider, onModelSelected };
|
|
28
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { danger } from "../../globals.js";
|
|
2
|
-
import { defaultRuntime } from "../../runtime.js";
|
|
3
2
|
import { sanitizeAgentId } from "../../routing/session-key.js";
|
|
3
|
+
import { defaultRuntime } from "../../runtime.js";
|
|
4
4
|
import { addGatewayClientOptions, callGatewayFromCli } from "../gateway-rpc.js";
|
|
5
5
|
import { parsePositiveIntOrUndefined } from "../program/helpers.js";
|
|
6
|
-
import { getCronChannelOptions,
|
|
6
|
+
import { getCronChannelOptions, parseAt, parseDurationMs, printCronList, warnIfCronSchedulerDisabled, } from "./shared.js";
|
|
7
7
|
export function registerCronStatusCommand(cron) {
|
|
8
8
|
addGatewayClientOptions(cron
|
|
9
9
|
.command("status")
|
|
@@ -53,9 +53,10 @@ export function registerCronAddCommand(cron) {
|
|
|
53
53
|
.option("--description <text>", "Optional description")
|
|
54
54
|
.option("--disabled", "Create job disabled", false)
|
|
55
55
|
.option("--delete-after-run", "Delete one-shot job after it succeeds", false)
|
|
56
|
+
.option("--keep-after-run", "Keep one-shot job after it succeeds", false)
|
|
56
57
|
.option("--agent <id>", "Agent id for this job")
|
|
57
|
-
.option("--session <target>", "Session target (main|isolated)"
|
|
58
|
-
.option("--wake <mode>", "Wake mode (now|next-heartbeat)", "
|
|
58
|
+
.option("--session <target>", "Session target (main|isolated)")
|
|
59
|
+
.option("--wake <mode>", "Wake mode (now|next-heartbeat)", "now")
|
|
59
60
|
.option("--at <when>", "Run once at time (ISO) or +duration (e.g. 20m)")
|
|
60
61
|
.option("--every <duration>", "Run every duration (e.g. 10m, 1h)")
|
|
61
62
|
.option("--cron <expr>", "Cron expression (5-field)")
|
|
@@ -65,15 +66,14 @@ export function registerCronAddCommand(cron) {
|
|
|
65
66
|
.option("--thinking <level>", "Thinking level for agent jobs (off|minimal|low|medium|high)")
|
|
66
67
|
.option("--model <model>", "Model override for agent jobs (provider/model or alias)")
|
|
67
68
|
.option("--timeout-seconds <n>", "Timeout seconds for agent jobs")
|
|
68
|
-
.option("--
|
|
69
|
+
.option("--announce", "Announce summary to a chat (subagent-style)", false)
|
|
70
|
+
.option("--deliver", "Deprecated (use --announce). Announces a summary to a chat.")
|
|
71
|
+
.option("--no-deliver", "Disable announce delivery and skip main-session summary")
|
|
69
72
|
.option("--channel <channel>", `Delivery channel (${getCronChannelOptions()})`, "last")
|
|
70
73
|
.option("--to <dest>", "Delivery destination (E.164, Telegram chatId, or Discord channel/user)")
|
|
71
74
|
.option("--best-effort-deliver", "Do not fail the job if delivery fails", false)
|
|
72
|
-
.option("--post-prefix <prefix>", "Prefix for main-session post", "Cron")
|
|
73
|
-
.option("--post-mode <mode>", "What to post back to main for isolated jobs (summary|full)", "summary")
|
|
74
|
-
.option("--post-max-chars <n>", "Max chars when --post-mode=full (default 8000)", "8000")
|
|
75
75
|
.option("--json", "Output JSON", false)
|
|
76
|
-
.action(async (opts) => {
|
|
76
|
+
.action(async (opts, cmd) => {
|
|
77
77
|
try {
|
|
78
78
|
const schedule = (() => {
|
|
79
79
|
const at = typeof opts.at === "string" ? opts.at : "";
|
|
@@ -84,15 +84,17 @@ export function registerCronAddCommand(cron) {
|
|
|
84
84
|
throw new Error("Choose exactly one schedule: --at, --every, or --cron");
|
|
85
85
|
}
|
|
86
86
|
if (at) {
|
|
87
|
-
const
|
|
88
|
-
if (!
|
|
87
|
+
const atIso = parseAt(at);
|
|
88
|
+
if (!atIso) {
|
|
89
89
|
throw new Error("Invalid --at; use ISO time or duration like 20m");
|
|
90
|
-
|
|
90
|
+
}
|
|
91
|
+
return { kind: "at", at: atIso };
|
|
91
92
|
}
|
|
92
93
|
if (every) {
|
|
93
94
|
const everyMs = parseDurationMs(every);
|
|
94
|
-
if (!everyMs)
|
|
95
|
+
if (!everyMs) {
|
|
95
96
|
throw new Error("Invalid --every; use e.g. 10m, 1h, 1d");
|
|
97
|
+
}
|
|
96
98
|
return { kind: "every", everyMs };
|
|
97
99
|
}
|
|
98
100
|
return {
|
|
@@ -101,19 +103,20 @@ export function registerCronAddCommand(cron) {
|
|
|
101
103
|
tz: typeof opts.tz === "string" && opts.tz.trim() ? opts.tz.trim() : undefined,
|
|
102
104
|
};
|
|
103
105
|
})();
|
|
104
|
-
const
|
|
105
|
-
const
|
|
106
|
-
if (sessionTarget !== "main" && sessionTarget !== "isolated") {
|
|
107
|
-
throw new Error("--session must be main or isolated");
|
|
108
|
-
}
|
|
109
|
-
const wakeModeRaw = typeof opts.wake === "string" ? opts.wake : "next-heartbeat";
|
|
110
|
-
const wakeMode = wakeModeRaw.trim() || "next-heartbeat";
|
|
106
|
+
const wakeModeRaw = typeof opts.wake === "string" ? opts.wake : "now";
|
|
107
|
+
const wakeMode = wakeModeRaw.trim() || "now";
|
|
111
108
|
if (wakeMode !== "now" && wakeMode !== "next-heartbeat") {
|
|
112
109
|
throw new Error("--wake must be now or next-heartbeat");
|
|
113
110
|
}
|
|
114
111
|
const agentId = typeof opts.agent === "string" && opts.agent.trim()
|
|
115
112
|
? sanitizeAgentId(opts.agent.trim())
|
|
116
113
|
: undefined;
|
|
114
|
+
const hasAnnounce = Boolean(opts.announce) || opts.deliver === true;
|
|
115
|
+
const hasNoDeliver = opts.deliver === false;
|
|
116
|
+
const deliveryFlagCount = [hasAnnounce, hasNoDeliver].filter(Boolean).length;
|
|
117
|
+
if (deliveryFlagCount > 1) {
|
|
118
|
+
throw new Error("Choose at most one of --announce or --no-deliver");
|
|
119
|
+
}
|
|
117
120
|
const payload = (() => {
|
|
118
121
|
const systemEvent = typeof opts.systemEvent === "string" ? opts.systemEvent.trim() : "";
|
|
119
122
|
const message = typeof opts.message === "string" ? opts.message.trim() : "";
|
|
@@ -121,8 +124,9 @@ export function registerCronAddCommand(cron) {
|
|
|
121
124
|
if (chosen !== 1) {
|
|
122
125
|
throw new Error("Choose exactly one payload: --system-event or --message");
|
|
123
126
|
}
|
|
124
|
-
if (systemEvent)
|
|
127
|
+
if (systemEvent) {
|
|
125
128
|
return { kind: "systemEvent", text: systemEvent };
|
|
129
|
+
}
|
|
126
130
|
const timeoutSeconds = parsePositiveIntOrUndefined(opts.timeoutSeconds);
|
|
127
131
|
return {
|
|
128
132
|
kind: "agentTurn",
|
|
@@ -132,35 +136,43 @@ export function registerCronAddCommand(cron) {
|
|
|
132
136
|
? opts.thinking.trim()
|
|
133
137
|
: undefined,
|
|
134
138
|
timeoutSeconds: timeoutSeconds && Number.isFinite(timeoutSeconds) ? timeoutSeconds : undefined,
|
|
135
|
-
deliver: opts.deliver ? true : undefined,
|
|
136
|
-
channel: typeof opts.channel === "string" ? opts.channel : "last",
|
|
137
|
-
to: typeof opts.to === "string" && opts.to.trim() ? opts.to.trim() : undefined,
|
|
138
|
-
bestEffortDeliver: opts.bestEffortDeliver ? true : undefined,
|
|
139
139
|
};
|
|
140
140
|
})();
|
|
141
|
+
const optionSource = typeof cmd?.getOptionValueSource === "function"
|
|
142
|
+
? (name) => cmd.getOptionValueSource(name)
|
|
143
|
+
: () => undefined;
|
|
144
|
+
const sessionSource = optionSource("session");
|
|
145
|
+
const sessionTargetRaw = typeof opts.session === "string" ? opts.session.trim() : "";
|
|
146
|
+
const inferredSessionTarget = payload.kind === "agentTurn" ? "isolated" : "main";
|
|
147
|
+
const sessionTarget = sessionSource === "cli" ? sessionTargetRaw || "" : inferredSessionTarget;
|
|
148
|
+
if (sessionTarget !== "main" && sessionTarget !== "isolated") {
|
|
149
|
+
throw new Error("--session must be main or isolated");
|
|
150
|
+
}
|
|
151
|
+
if (opts.deleteAfterRun && opts.keepAfterRun) {
|
|
152
|
+
throw new Error("Choose --delete-after-run or --keep-after-run, not both");
|
|
153
|
+
}
|
|
141
154
|
if (sessionTarget === "main" && payload.kind !== "systemEvent") {
|
|
142
155
|
throw new Error("Main jobs require --system-event (systemEvent).");
|
|
143
156
|
}
|
|
144
157
|
if (sessionTarget === "isolated" && payload.kind !== "agentTurn") {
|
|
145
158
|
throw new Error("Isolated jobs require --message (agentTurn).");
|
|
146
159
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
: undefined,
|
|
158
|
-
}
|
|
160
|
+
if ((opts.announce || typeof opts.deliver === "boolean") &&
|
|
161
|
+
(sessionTarget !== "isolated" || payload.kind !== "agentTurn")) {
|
|
162
|
+
throw new Error("--announce/--no-deliver require --session isolated.");
|
|
163
|
+
}
|
|
164
|
+
const deliveryMode = sessionTarget === "isolated" && payload.kind === "agentTurn"
|
|
165
|
+
? hasAnnounce
|
|
166
|
+
? "announce"
|
|
167
|
+
: hasNoDeliver
|
|
168
|
+
? "none"
|
|
169
|
+
: "announce"
|
|
159
170
|
: undefined;
|
|
160
171
|
const nameRaw = typeof opts.name === "string" ? opts.name : "";
|
|
161
172
|
const name = nameRaw.trim();
|
|
162
|
-
if (!name)
|
|
173
|
+
if (!name) {
|
|
163
174
|
throw new Error("--name is required");
|
|
175
|
+
}
|
|
164
176
|
const description = typeof opts.description === "string" && opts.description.trim()
|
|
165
177
|
? opts.description.trim()
|
|
166
178
|
: undefined;
|
|
@@ -168,13 +180,22 @@ export function registerCronAddCommand(cron) {
|
|
|
168
180
|
name,
|
|
169
181
|
description,
|
|
170
182
|
enabled: !opts.disabled,
|
|
171
|
-
deleteAfterRun:
|
|
183
|
+
deleteAfterRun: opts.deleteAfterRun ? true : opts.keepAfterRun ? false : undefined,
|
|
172
184
|
agentId,
|
|
173
185
|
schedule,
|
|
174
186
|
sessionTarget,
|
|
175
187
|
wakeMode,
|
|
176
188
|
payload,
|
|
177
|
-
|
|
189
|
+
delivery: deliveryMode
|
|
190
|
+
? {
|
|
191
|
+
mode: deliveryMode,
|
|
192
|
+
channel: typeof opts.channel === "string" && opts.channel.trim()
|
|
193
|
+
? opts.channel.trim()
|
|
194
|
+
: undefined,
|
|
195
|
+
to: typeof opts.to === "string" && opts.to.trim() ? opts.to.trim() : undefined,
|
|
196
|
+
bestEffort: opts.bestEffortDeliver ? true : undefined,
|
|
197
|
+
}
|
|
198
|
+
: undefined,
|
|
178
199
|
};
|
|
179
200
|
const res = await callGatewayFromCli("cron.add", opts, params);
|
|
180
201
|
defaultRuntime.log(JSON.stringify(res, null, 2));
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { danger } from "../../globals.js";
|
|
2
|
-
import { defaultRuntime } from "../../runtime.js";
|
|
3
2
|
import { sanitizeAgentId } from "../../routing/session-key.js";
|
|
3
|
+
import { defaultRuntime } from "../../runtime.js";
|
|
4
4
|
import { addGatewayClientOptions, callGatewayFromCli } from "../gateway-rpc.js";
|
|
5
|
-
import { getCronChannelOptions,
|
|
5
|
+
import { getCronChannelOptions, parseAt, parseDurationMs, warnIfCronSchedulerDisabled, } from "./shared.js";
|
|
6
6
|
const assignIf = (target, key, value, shouldAssign) => {
|
|
7
|
-
if (shouldAssign)
|
|
7
|
+
if (shouldAssign) {
|
|
8
8
|
target[key] = value;
|
|
9
|
+
}
|
|
9
10
|
};
|
|
10
11
|
export function registerCronEditCommand(cron) {
|
|
11
12
|
addGatewayClientOptions(cron
|
|
@@ -31,13 +32,13 @@ export function registerCronEditCommand(cron) {
|
|
|
31
32
|
.option("--thinking <level>", "Thinking level for agent jobs")
|
|
32
33
|
.option("--model <model>", "Model override for agent jobs")
|
|
33
34
|
.option("--timeout-seconds <n>", "Timeout seconds for agent jobs")
|
|
34
|
-
.option("--
|
|
35
|
-
.option("--
|
|
35
|
+
.option("--announce", "Announce summary to a chat (subagent-style)")
|
|
36
|
+
.option("--deliver", "Deprecated (use --announce). Announces a summary to a chat.")
|
|
37
|
+
.option("--no-deliver", "Disable announce delivery")
|
|
36
38
|
.option("--channel <channel>", `Delivery channel (${getCronChannelOptions()})`)
|
|
37
39
|
.option("--to <dest>", "Delivery destination (E.164, Telegram chatId, or Discord channel/user)")
|
|
38
40
|
.option("--best-effort-deliver", "Do not fail job if delivery fails")
|
|
39
41
|
.option("--no-best-effort-deliver", "Fail job when delivery fails")
|
|
40
|
-
.option("--post-prefix <prefix>", "Prefix for summary system event")
|
|
41
42
|
.action(async (id, opts) => {
|
|
42
43
|
try {
|
|
43
44
|
if (opts.session === "main" && opts.message) {
|
|
@@ -46,31 +47,40 @@ export function registerCronEditCommand(cron) {
|
|
|
46
47
|
if (opts.session === "isolated" && opts.systemEvent) {
|
|
47
48
|
throw new Error("Isolated jobs cannot use --system-event; use --message or --session main.");
|
|
48
49
|
}
|
|
49
|
-
if (opts.
|
|
50
|
-
throw new Error("--
|
|
50
|
+
if (opts.announce && typeof opts.deliver === "boolean") {
|
|
51
|
+
throw new Error("Choose --announce or --no-deliver (not multiple).");
|
|
51
52
|
}
|
|
52
53
|
const patch = {};
|
|
53
|
-
if (typeof opts.name === "string")
|
|
54
|
+
if (typeof opts.name === "string") {
|
|
54
55
|
patch.name = opts.name;
|
|
55
|
-
|
|
56
|
+
}
|
|
57
|
+
if (typeof opts.description === "string") {
|
|
56
58
|
patch.description = opts.description;
|
|
57
|
-
|
|
59
|
+
}
|
|
60
|
+
if (opts.enable && opts.disable) {
|
|
58
61
|
throw new Error("Choose --enable or --disable, not both");
|
|
59
|
-
|
|
62
|
+
}
|
|
63
|
+
if (opts.enable) {
|
|
60
64
|
patch.enabled = true;
|
|
61
|
-
|
|
65
|
+
}
|
|
66
|
+
if (opts.disable) {
|
|
62
67
|
patch.enabled = false;
|
|
68
|
+
}
|
|
63
69
|
if (opts.deleteAfterRun && opts.keepAfterRun) {
|
|
64
70
|
throw new Error("Choose --delete-after-run or --keep-after-run, not both");
|
|
65
71
|
}
|
|
66
|
-
if (opts.deleteAfterRun)
|
|
72
|
+
if (opts.deleteAfterRun) {
|
|
67
73
|
patch.deleteAfterRun = true;
|
|
68
|
-
|
|
74
|
+
}
|
|
75
|
+
if (opts.keepAfterRun) {
|
|
69
76
|
patch.deleteAfterRun = false;
|
|
70
|
-
|
|
77
|
+
}
|
|
78
|
+
if (typeof opts.session === "string") {
|
|
71
79
|
patch.sessionTarget = opts.session;
|
|
72
|
-
|
|
80
|
+
}
|
|
81
|
+
if (typeof opts.wake === "string") {
|
|
73
82
|
patch.wakeMode = opts.wake;
|
|
83
|
+
}
|
|
74
84
|
if (opts.agent && opts.clearAgent) {
|
|
75
85
|
throw new Error("Use --agent or --clear-agent, not both");
|
|
76
86
|
}
|
|
@@ -81,18 +91,21 @@ export function registerCronEditCommand(cron) {
|
|
|
81
91
|
patch.agentId = null;
|
|
82
92
|
}
|
|
83
93
|
const scheduleChosen = [opts.at, opts.every, opts.cron].filter(Boolean).length;
|
|
84
|
-
if (scheduleChosen > 1)
|
|
94
|
+
if (scheduleChosen > 1) {
|
|
85
95
|
throw new Error("Choose at most one schedule change");
|
|
96
|
+
}
|
|
86
97
|
if (opts.at) {
|
|
87
|
-
const
|
|
88
|
-
if (!
|
|
98
|
+
const atIso = parseAt(String(opts.at));
|
|
99
|
+
if (!atIso) {
|
|
89
100
|
throw new Error("Invalid --at");
|
|
90
|
-
|
|
101
|
+
}
|
|
102
|
+
patch.schedule = { kind: "at", at: atIso };
|
|
91
103
|
}
|
|
92
104
|
else if (opts.every) {
|
|
93
105
|
const everyMs = parseDurationMs(String(opts.every));
|
|
94
|
-
if (!everyMs)
|
|
106
|
+
if (!everyMs) {
|
|
95
107
|
throw new Error("Invalid --every");
|
|
108
|
+
}
|
|
96
109
|
patch.schedule = { kind: "every", everyMs };
|
|
97
110
|
}
|
|
98
111
|
else if (opts.cron) {
|
|
@@ -111,14 +124,16 @@ export function registerCronEditCommand(cron) {
|
|
|
111
124
|
? Number.parseInt(String(opts.timeoutSeconds), 10)
|
|
112
125
|
: undefined;
|
|
113
126
|
const hasTimeoutSeconds = Boolean(timeoutSeconds && Number.isFinite(timeoutSeconds));
|
|
127
|
+
const hasDeliveryModeFlag = opts.announce || typeof opts.deliver === "boolean";
|
|
128
|
+
const hasDeliveryTarget = typeof opts.channel === "string" || typeof opts.to === "string";
|
|
129
|
+
const hasBestEffort = typeof opts.bestEffortDeliver === "boolean";
|
|
114
130
|
const hasAgentTurnPatch = typeof opts.message === "string" ||
|
|
115
131
|
Boolean(model) ||
|
|
116
132
|
Boolean(thinking) ||
|
|
117
133
|
hasTimeoutSeconds ||
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
typeof opts.bestEffortDeliver === "boolean";
|
|
134
|
+
hasDeliveryModeFlag ||
|
|
135
|
+
hasDeliveryTarget ||
|
|
136
|
+
hasBestEffort;
|
|
122
137
|
if (hasSystemEventPatch && hasAgentTurnPatch) {
|
|
123
138
|
throw new Error("Choose at most one payload change");
|
|
124
139
|
}
|
|
@@ -134,16 +149,27 @@ export function registerCronEditCommand(cron) {
|
|
|
134
149
|
assignIf(payload, "model", model, Boolean(model));
|
|
135
150
|
assignIf(payload, "thinking", thinking, Boolean(thinking));
|
|
136
151
|
assignIf(payload, "timeoutSeconds", timeoutSeconds, hasTimeoutSeconds);
|
|
137
|
-
assignIf(payload, "deliver", opts.deliver, typeof opts.deliver === "boolean");
|
|
138
|
-
assignIf(payload, "channel", opts.channel, typeof opts.channel === "string");
|
|
139
|
-
assignIf(payload, "to", opts.to, typeof opts.to === "string");
|
|
140
|
-
assignIf(payload, "bestEffortDeliver", opts.bestEffortDeliver, typeof opts.bestEffortDeliver === "boolean");
|
|
141
152
|
patch.payload = payload;
|
|
142
153
|
}
|
|
143
|
-
if (
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
154
|
+
if (hasDeliveryModeFlag || hasDeliveryTarget || hasBestEffort) {
|
|
155
|
+
const deliveryMode = opts.announce || opts.deliver === true
|
|
156
|
+
? "announce"
|
|
157
|
+
: opts.deliver === false
|
|
158
|
+
? "none"
|
|
159
|
+
: "announce";
|
|
160
|
+
const delivery = { mode: deliveryMode };
|
|
161
|
+
if (typeof opts.channel === "string") {
|
|
162
|
+
const channel = opts.channel.trim();
|
|
163
|
+
delivery.channel = channel ? channel : undefined;
|
|
164
|
+
}
|
|
165
|
+
if (typeof opts.to === "string") {
|
|
166
|
+
const to = opts.to.trim();
|
|
167
|
+
delivery.to = to ? to : undefined;
|
|
168
|
+
}
|
|
169
|
+
if (typeof opts.bestEffortDeliver === "boolean") {
|
|
170
|
+
delivery.bestEffort = opts.bestEffortDeliver;
|
|
171
|
+
}
|
|
172
|
+
patch.delivery = delivery;
|
|
147
173
|
}
|
|
148
174
|
const res = await callGatewayFromCli("cron.update", opts, {
|
|
149
175
|
id,
|