@fastagent-sh/fastagent 0.21.1 → 0.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -12
- package/dist/agent.d.ts +24 -37
- package/dist/agent.js +7 -15
- package/dist/atomic-write.d.ts +13 -17
- package/dist/atomic-write.js +18 -29
- package/dist/bind.d.ts +12 -22
- package/dist/bind.js +18 -27
- package/dist/channel.d.ts +11 -33
- package/dist/channels/agentcore-limits.d.ts +2 -13
- package/dist/channels/agentcore-limits.js +2 -13
- package/dist/channels/agentcore-protocol.d.ts +67 -58
- package/dist/channels/agentcore-protocol.js +23 -15
- package/dist/channels/agentcore-service.d.ts +19 -33
- package/dist/channels/agentcore-service.js +176 -59
- package/dist/channels/agentcore.d.ts +39 -33
- package/dist/channels/agentcore.js +90 -224
- package/dist/channels/body.d.ts +15 -2
- package/dist/channels/body.js +24 -2
- package/dist/channels/busy.d.ts +1 -21
- package/dist/channels/busy.js +2 -39
- package/dist/channels/control.d.ts +17 -62
- package/dist/channels/control.js +74 -182
- package/dist/channels/define-channel.d.ts +39 -0
- package/dist/channels/define-channel.js +9 -0
- package/dist/channels/discover.d.ts +10 -31
- package/dist/channels/discover.js +37 -31
- package/dist/channels/feishu/bootstrap-token.d.ts +1 -8
- package/dist/channels/feishu/bootstrap-token.js +7 -23
- package/dist/channels/feishu/card.d.ts +14 -28
- package/dist/channels/feishu/card.js +16 -30
- package/dist/channels/feishu/cloud.d.ts +1 -5
- package/dist/channels/feishu/context-buffer.d.ts +4 -23
- package/dist/channels/feishu/context-buffer.js +8 -31
- package/dist/channels/feishu/crypto.d.ts +10 -5
- package/dist/channels/feishu/crypto.js +12 -19
- package/dist/channels/feishu/feishu-api.d.ts +2 -1
- package/dist/channels/feishu/feishu-api.js +5 -4
- package/dist/channels/feishu/feishu.d.ts +4 -10
- package/dist/channels/feishu/feishu.js +113 -227
- package/dist/channels/feishu/invoke-turn.d.ts +5 -4
- package/dist/channels/feishu/invoke-turn.js +36 -54
- package/dist/channels/feishu/model.d.ts +4 -21
- package/dist/channels/feishu/model.js +1 -8
- package/dist/channels/feishu/normalize.d.ts +2 -10
- package/dist/channels/feishu/normalize.js +7 -42
- package/dist/channels/feishu/parse.d.ts +9 -29
- package/dist/channels/feishu/parse.js +8 -26
- package/dist/channels/feishu/preview.d.ts +12 -14
- package/dist/channels/feishu/preview.js +108 -207
- package/dist/channels/feishu/register-app.d.ts +8 -23
- package/dist/channels/feishu/register-app.js +7 -20
- package/dist/channels/feishu/register-webhook.d.ts +2 -9
- package/dist/channels/feishu/register-webhook.js +9 -33
- package/dist/channels/feishu/scaffold/channel.ts +27 -19
- package/dist/channels/feishu/scaffold/channel.websocket.ts +31 -0
- package/dist/channels/feishu/setup-mode.d.ts +11 -36
- package/dist/channels/feishu/setup-mode.js +7 -26
- package/dist/channels/feishu/ws-ingress.d.ts +1 -2
- package/dist/channels/feishu/ws-ingress.js +6 -8
- package/dist/channels/http.d.ts +15 -15
- package/dist/channels/http.js +19 -9
- package/dist/channels/kit/attachment-path.d.ts +4 -5
- package/dist/channels/kit/attachment-path.js +10 -34
- package/dist/channels/kit/context-buffer.d.ts +14 -21
- package/dist/channels/kit/context-buffer.js +25 -38
- package/dist/channels/kit/delivery.d.ts +35 -0
- package/dist/channels/kit/delivery.js +129 -0
- package/dist/channels/kit/event-stream.d.ts +5 -0
- package/dist/channels/kit/event-stream.js +29 -0
- package/dist/channels/kit/invoke-turn-kit.d.ts +53 -26
- package/dist/channels/kit/invoke-turn-kit.js +89 -32
- package/dist/channels/kit/preview-kit.d.ts +18 -72
- package/dist/channels/kit/preview-kit.js +22 -88
- package/dist/channels/kit/signature.d.ts +3 -9
- package/dist/channels/kit/signature.js +3 -9
- package/dist/channels/kit/state.d.ts +1 -2
- package/dist/channels/kit/state.js +5 -14
- package/dist/channels/kit/stop-command.d.ts +1 -2
- package/dist/channels/kit/stop-command.js +6 -9
- package/dist/channels/kit/tasks.d.ts +1 -1
- package/dist/channels/kit/tasks.js +8 -21
- package/dist/channels/kit/text.d.ts +2 -16
- package/dist/channels/kit/text.js +23 -31
- package/dist/channels/kit/thread-participants.d.ts +4 -17
- package/dist/channels/kit/thread-participants.js +8 -55
- package/dist/channels/kit/transport.d.ts +26 -0
- package/dist/channels/kit/transport.js +20 -0
- package/dist/channels/kit/turn-queue.d.ts +7 -11
- package/dist/channels/kit/turn-queue.js +21 -39
- package/dist/channels/kit/turn-runner.d.ts +32 -18
- package/dist/channels/kit/turn-runner.js +98 -53
- package/dist/channels/kit/turn-store.d.ts +32 -32
- package/dist/channels/kit/turn-store.js +45 -88
- package/dist/channels/lark/lark.d.ts +1 -5
- package/dist/channels/lark/onboard.d.ts +3 -12
- package/dist/channels/lark/onboard.js +3 -13
- package/dist/channels/lark/scaffold/channel.ts +27 -19
- package/dist/channels/lark/scaffold/channel.websocket.ts +31 -0
- package/dist/channels/registration.d.ts +9 -35
- package/dist/channels/registration.js +6 -37
- package/dist/channels/secret.js +2 -5
- package/dist/channels/serve.d.ts +47 -44
- package/dist/channels/serve.js +165 -101
- package/dist/channels/slack/config-api.d.ts +4 -27
- package/dist/channels/slack/config-api.js +5 -34
- package/dist/channels/slack/context-buffer.d.ts +2 -3
- package/dist/channels/slack/context-buffer.js +5 -5
- package/dist/channels/slack/invoke-turn.d.ts +3 -1
- package/dist/channels/slack/invoke-turn.js +25 -34
- package/dist/channels/slack/manifest.js +1 -3
- package/dist/channels/slack/model.d.ts +1 -2
- package/dist/channels/slack/model.js +1 -1
- package/dist/channels/slack/onboard.d.ts +4 -3
- package/dist/channels/slack/onboard.js +8 -11
- package/dist/channels/slack/onboarding-state.d.ts +3 -5
- package/dist/channels/slack/onboarding-state.js +9 -6
- package/dist/channels/slack/parse.d.ts +4 -13
- package/dist/channels/slack/parse.js +7 -28
- package/dist/channels/slack/preview.d.ts +12 -2
- package/dist/channels/slack/preview.js +292 -269
- package/dist/channels/slack/reaction.d.ts +11 -3
- package/dist/channels/slack/reaction.js +19 -8
- package/dist/channels/slack/register-webhook.js +4 -7
- package/dist/channels/slack/scaffold/channel.ts +20 -13
- package/dist/channels/slack/scaffold/slack-send.ts +2 -2
- package/dist/channels/slack/setup-server.d.ts +1 -5
- package/dist/channels/slack/setup-server.js +1 -5
- package/dist/channels/slack/shared-api.d.ts +1 -4
- package/dist/channels/slack/shared-api.js +2 -13
- package/dist/channels/slack/slack-api.d.ts +2 -1
- package/dist/channels/slack/slack-api.js +6 -4
- package/dist/channels/slack/slack.d.ts +11 -14
- package/dist/channels/slack/slack.js +121 -122
- package/dist/channels/sse.d.ts +1 -1
- package/dist/channels/sse.js +1 -1
- package/dist/channels/telegram/context-buffer.d.ts +7 -22
- package/dist/channels/telegram/context-buffer.js +6 -23
- package/dist/channels/telegram/invoke-turn.d.ts +7 -7
- package/dist/channels/telegram/invoke-turn.js +24 -43
- package/dist/channels/telegram/parse.d.ts +24 -51
- package/dist/channels/telegram/parse.js +32 -84
- package/dist/channels/telegram/preview.d.ts +10 -1
- package/dist/channels/telegram/preview.js +79 -100
- package/dist/channels/telegram/register-webhook.js +5 -23
- package/dist/channels/telegram/scaffold/channel.ts +25 -18
- package/dist/channels/telegram/scaffold/telegram-send.ts +6 -4
- package/dist/channels/telegram/telegram-api.d.ts +4 -3
- package/dist/channels/telegram/telegram-api.js +9 -7
- package/dist/channels/telegram/telegram.d.ts +4 -18
- package/dist/channels/telegram/telegram.js +38 -94
- package/dist/channels/telegram/turn-store.d.ts +11 -14
- package/dist/channels/telegram/turn-store.js +8 -6
- package/dist/channels/wait-health.d.ts +4 -6
- package/dist/channels/wait-health.js +10 -14
- package/dist/cli/add-feishu.d.ts +2 -12
- package/dist/cli/add-feishu.js +24 -71
- package/dist/cli/add-slack.d.ts +5 -3
- package/dist/cli/add-slack.js +53 -76
- package/dist/cli/auth-view.d.ts +2 -16
- package/dist/cli/auth-view.js +2 -16
- package/dist/cli/commands/add.js +25 -40
- package/dist/cli/commands/chat.d.ts +0 -1
- package/dist/cli/commands/chat.js +5 -6
- package/dist/cli/commands/deploy/agentcore.js +60 -65
- package/dist/cli/commands/deploy/docker.js +50 -23
- package/dist/cli/commands/deploy/fly.js +23 -61
- package/dist/cli/commands/deploy/railway.js +23 -18
- package/dist/cli/commands/deploy/shared.d.ts +38 -57
- package/dist/cli/commands/deploy/shared.js +40 -59
- package/dist/cli/commands/deploy.d.ts +10 -27
- package/dist/cli/commands/deploy.js +38 -60
- package/dist/cli/commands/destroy.d.ts +4 -0
- package/dist/cli/commands/destroy.js +56 -0
- package/dist/cli/commands/dev.d.ts +2 -1
- package/dist/cli/commands/dev.js +20 -23
- package/dist/cli/commands/info.d.ts +0 -2
- package/dist/cli/commands/info.js +83 -49
- package/dist/cli/commands/init.d.ts +1 -2
- package/dist/cli/commands/init.js +16 -55
- package/dist/cli/commands/invoke.d.ts +0 -1
- package/dist/cli/commands/invoke.js +5 -7
- package/dist/cli/commands/login.d.ts +2 -1
- package/dist/cli/commands/login.js +33 -38
- package/dist/cli/commands/logs.js +3 -4
- package/dist/cli/commands/models.js +1 -5
- package/dist/cli/commands/routine-run.d.ts +6 -0
- package/dist/cli/commands/routine-run.js +47 -0
- package/dist/cli/commands/routine.d.ts +25 -0
- package/dist/cli/commands/routine.js +122 -0
- package/dist/cli/commands/start.d.ts +31 -3
- package/dist/cli/commands/start.js +131 -81
- package/dist/cli/commands/tool.js +26 -12
- package/dist/cli/fail.d.ts +13 -23
- package/dist/cli/fail.js +20 -23
- package/dist/cli/invoke-stream.d.ts +1 -8
- package/dist/cli/kernel.d.ts +6 -38
- package/dist/cli/kernel.js +14 -77
- package/dist/cli/models-view.d.ts +1 -9
- package/dist/cli/models-view.js +11 -22
- package/dist/cli/program.d.ts +5 -6
- package/dist/cli/program.js +120 -157
- package/dist/cli/serve.d.ts +57 -41
- package/dist/cli/serve.js +94 -121
- package/dist/cli/shared.d.ts +15 -61
- package/dist/cli/shared.js +55 -181
- package/dist/cli.js +1 -8
- package/dist/collect.d.ts +6 -0
- package/dist/collect.js +6 -0
- package/dist/core.d.ts +4 -1
- package/dist/core.js +9 -7
- package/dist/declared-secrets.d.ts +55 -0
- package/dist/declared-secrets.js +88 -0
- package/dist/deploy/agentcore/aws-cli.d.ts +91 -0
- package/dist/deploy/agentcore/aws-cli.js +64 -0
- package/dist/deploy/agentcore/destroy.d.ts +51 -0
- package/dist/deploy/agentcore/destroy.js +273 -0
- package/dist/deploy/agentcore/forwarder.js +28 -79
- package/dist/deploy/agentcore/logs.d.ts +2 -18
- package/dist/deploy/agentcore/logs.js +27 -51
- package/dist/deploy/agentcore/plan.d.ts +85 -105
- package/dist/deploy/agentcore/plan.js +152 -314
- package/dist/deploy/agentcore/run.d.ts +28 -28
- package/dist/deploy/agentcore/run.js +227 -306
- package/dist/deploy/agentcore/zip.d.ts +2 -15
- package/dist/deploy/agentcore/zip.js +3 -17
- package/dist/deploy/build-context.d.ts +21 -0
- package/dist/deploy/build-context.js +137 -0
- package/dist/deploy/channel-ingress.d.ts +26 -39
- package/dist/deploy/channel-ingress.js +57 -28
- package/dist/deploy/container.d.ts +20 -34
- package/dist/deploy/container.js +49 -100
- package/dist/deploy/docker/plan.d.ts +12 -11
- package/dist/deploy/docker/plan.js +43 -24
- package/dist/deploy/docker/run.d.ts +22 -25
- package/dist/deploy/docker/run.js +39 -37
- package/dist/deploy/fly/plan.d.ts +15 -44
- package/dist/deploy/fly/plan.js +41 -73
- package/dist/deploy/fly/run.d.ts +16 -51
- package/dist/deploy/fly/run.js +42 -95
- package/dist/deploy/hosts.d.ts +24 -3
- package/dist/deploy/hosts.js +24 -3
- package/dist/deploy/preflight.d.ts +47 -41
- package/dist/deploy/preflight.js +282 -383
- package/dist/deploy/railway/plan.d.ts +16 -42
- package/dist/deploy/railway/plan.js +42 -60
- package/dist/deploy/railway/run.d.ts +30 -68
- package/dist/deploy/railway/run.js +86 -100
- package/dist/deploy/registration-gate.d.ts +6 -13
- package/dist/deploy/residency.d.ts +37 -0
- package/dist/deploy/residency.js +24 -0
- package/dist/deploy/runner.d.ts +10 -9
- package/dist/deploy/runner.js +7 -18
- package/dist/deploy/secrets.d.ts +40 -41
- package/dist/deploy/secrets.js +117 -103
- package/dist/deploy/workspace.d.ts +50 -0
- package/dist/deploy/workspace.js +197 -0
- package/dist/dev-supervisor.d.ts +1 -9
- package/dist/dev-supervisor.js +21 -64
- package/dist/effect-port.d.ts +50 -0
- package/dist/effect-port.js +77 -0
- package/dist/engines/pi/agent-session-factory.d.ts +50 -69
- package/dist/engines/pi/agent-session-factory.js +249 -146
- package/dist/engines/pi/auth.d.ts +15 -11
- package/dist/engines/pi/auth.js +96 -99
- package/dist/engines/pi/chat.d.ts +1 -5
- package/dist/engines/pi/chat.js +2 -14
- package/dist/engines/pi/config.d.ts +53 -51
- package/dist/engines/pi/config.js +83 -92
- package/dist/engines/pi/create.d.ts +60 -75
- package/dist/engines/pi/create.js +108 -141
- package/dist/engines/pi/definition.d.ts +14 -58
- package/dist/engines/pi/definition.js +21 -85
- package/dist/engines/pi/invoke-session.d.ts +5 -25
- package/dist/engines/pi/invoke-session.js +233 -244
- package/dist/engines/pi/login.d.ts +95 -35
- package/dist/engines/pi/login.js +259 -107
- package/dist/engines/pi/machine.d.ts +31 -0
- package/dist/engines/pi/machine.js +106 -0
- package/dist/engines/pi/models.d.ts +70 -89
- package/dist/engines/pi/models.js +188 -81
- package/dist/engines/pi/open.d.ts +65 -53
- package/dist/engines/pi/open.js +129 -69
- package/dist/engines/pi/report.d.ts +3 -12
- package/dist/engines/pi/report.js +2 -16
- package/dist/engines/pi/search-tools.d.ts +1 -9
- package/dist/engines/pi/search-tools.js +26 -57
- package/dist/engines/pi/service.d.ts +2 -16
- package/dist/engines/pi/service.js +2 -16
- package/dist/engines/pi/session-builder.d.ts +5 -9
- package/dist/engines/pi/session-builder.js +44 -82
- package/dist/engines/pi/session-control.js +286 -269
- package/dist/engines/pi/session-effects.d.ts +14 -0
- package/dist/engines/pi/session-effects.js +30 -0
- package/dist/engines/pi/session-inheritance.d.ts +9 -18
- package/dist/engines/pi/session-inheritance.js +103 -160
- package/dist/engines/pi/session-markers.d.ts +31 -30
- package/dist/engines/pi/session-markers.js +26 -25
- package/dist/engines/pi/session-settings.d.ts +6 -22
- package/dist/engines/pi/session-settings.js +10 -21
- package/dist/engines/pi/session-store.d.ts +26 -92
- package/dist/engines/pi/session-store.js +96 -310
- package/dist/engines/pi/tool-context.d.ts +17 -45
- package/dist/engines/pi/tool-context.js +7 -26
- package/dist/engines/pi/tool.d.ts +45 -36
- package/dist/engines/pi/tool.js +43 -57
- package/dist/engines/pi/turn-kit.d.ts +14 -52
- package/dist/engines/pi/turn-kit.js +18 -67
- package/dist/engines/pi/wake-tool.d.ts +2 -10
- package/dist/engines/pi/wake-tool.js +7 -27
- package/dist/env.d.ts +27 -28
- package/dist/env.js +45 -50
- package/dist/index.js +0 -2
- package/dist/lark.d.ts +1 -2
- package/dist/lark.js +1 -2
- package/dist/loader.d.ts +14 -55
- package/dist/loader.js +24 -43
- package/dist/log.d.ts +2 -12
- package/dist/log.js +3 -24
- package/dist/node.d.ts +2 -15
- package/dist/node.js +2 -18
- package/dist/observe.d.ts +2 -8
- package/dist/open-url.d.ts +1 -1
- package/dist/open-url.js +1 -1
- package/dist/paths.d.ts +70 -134
- package/dist/paths.js +165 -232
- package/dist/pi.d.ts +4 -6
- package/dist/pi.js +3 -3
- package/dist/proxy.d.ts +16 -6
- package/dist/proxy.js +52 -16
- package/dist/runtime.d.ts +18 -12
- package/dist/runtime.js +18 -11
- package/dist/scaffold/add-channel.d.ts +14 -31
- package/dist/scaffold/add-channel.js +48 -112
- package/dist/scaffold/init.d.ts +9 -31
- package/dist/scaffold/init.js +45 -138
- package/dist/scaffold/templates/env.example +6 -4
- package/dist/scaffold/templates/fastagent.config.ts +36 -0
- package/dist/scaffold/templates.d.ts +3 -3
- package/dist/scaffold/templates.js +5 -8
- package/dist/scaffold/vendor-skill.d.ts +2 -5
- package/dist/scaffold/vendor-skill.js +19 -29
- package/dist/schedule/cron.d.ts +9 -5
- package/dist/schedule/cron.js +9 -11
- package/dist/schedule/discover.d.ts +12 -12
- package/dist/schedule/discover.js +43 -34
- package/dist/schedule/routine.d.ts +43 -0
- package/dist/schedule/routine.js +32 -0
- package/dist/schedule/run.d.ts +55 -0
- package/dist/schedule/run.js +146 -0
- package/dist/schedule/scheduler.d.ts +44 -55
- package/dist/schedule/scheduler.js +291 -265
- package/dist/schedule/state.d.ts +105 -10
- package/dist/schedule/state.js +293 -19
- package/dist/schedule/wake-alarm.d.ts +10 -23
- package/dist/schedule/wake-alarm.js +91 -121
- package/dist/schedule/wakeups.d.ts +23 -39
- package/dist/schedule/wakeups.js +33 -75
- package/dist/secrets-gate.d.ts +32 -0
- package/dist/secrets-gate.js +33 -0
- package/dist/service.d.ts +137 -98
- package/dist/service.js +250 -252
- package/dist/session-remote.d.ts +33 -44
- package/dist/session-remote.js +203 -192
- package/dist/session.d.ts +166 -229
- package/dist/session.js +33 -55
- package/dist/tunnel.d.ts +8 -36
- package/dist/tunnel.js +24 -65
- package/dist/version.d.ts +2 -2
- package/dist/version.js +2 -2
- package/package.json +10 -16
- package/dist/channels/agentcore-state.d.ts +0 -77
- package/dist/channels/agentcore-state.js +0 -276
- package/dist/channels/github/github.d.ts +0 -31
- package/dist/channels/github/github.js +0 -89
- package/dist/channels/github/scaffold/channel.ts +0 -25
- package/dist/cli/commands/attach.d.ts +0 -108
- package/dist/cli/commands/attach.js +0 -637
- package/dist/cli/commands/fire.d.ts +0 -7
- package/dist/cli/commands/fire.js +0 -38
- package/dist/cli/commands/schedule.d.ts +0 -12
- package/dist/cli/commands/schedule.js +0 -87
- package/dist/github.d.ts +0 -3
- package/dist/github.js +0 -2
- package/dist/scaffold/templates/fastagent.config.mjs +0 -23
- package/dist/schedule/audit.d.ts +0 -18
- package/dist/schedule/audit.js +0 -57
- package/dist/schedule/schedule.d.ts +0 -35
- package/dist/schedule/schedule.js +0 -23
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `fastagent fire <name> [dir]`: run ONE schedule's turn immediately — the authoring loop for schedules
|
|
3
|
-
* (like `invoke` is for a prompt). Fires `schedules/<name>.ts` now, without waiting for its cron, using
|
|
4
|
-
* the schedule's stable session (faithful to the served behavior). Does NOT advance the schedule's fire
|
|
5
|
-
* state — a test run must never make the scheduler skip the real next run.
|
|
6
|
-
*/
|
|
7
|
-
import { join } from "node:path";
|
|
8
|
-
import { displayPath } from "../../paths.js";
|
|
9
|
-
import { reportModuleLoadFailures } from "../../loader.js";
|
|
10
|
-
import { createPiAgentFromDir } from "../../engines/pi/open.js";
|
|
11
|
-
import { runInvokeStream } from "../invoke-stream.js";
|
|
12
|
-
import { loadSchedules } from "../../schedule/discover.js";
|
|
13
|
-
import { scheduleSession } from "../../schedule/scheduler.js";
|
|
14
|
-
import { failStartup } from "../fail.js";
|
|
15
|
-
import { enterAgentCommand, reportAuth } from "../shared.js";
|
|
16
|
-
export async function runFire(name, dirArg, opts) {
|
|
17
|
-
const placement = await enterAgentCommand(dirArg, opts);
|
|
18
|
-
// Schedules are agent surface — discover them where dev/start/`schedule list` do (the agent
|
|
19
|
-
// dir), so `fire` sees the same set the scheduler serves.
|
|
20
|
-
const { schedules, failures } = await loadSchedules(placement.agentDir).catch(failStartup);
|
|
21
|
-
reportModuleLoadFailures(failures);
|
|
22
|
-
const schedule = schedules.find((s) => s.name === name);
|
|
23
|
-
if (!schedule) {
|
|
24
|
-
// Name the discovery path: a schedule misplaced in the workspace (outside the agent dir)
|
|
25
|
-
// should read as "wrong place", not "broken file".
|
|
26
|
-
failStartup(new Error(`unknown schedule "${name}" (looked in ${displayPath(process.cwd(), join(placement.agentDir, "schedules")) ?? "schedules"}). ` +
|
|
27
|
-
`available: ${schedules.map((s) => s.name).join(", ") || "(none)"}`));
|
|
28
|
-
}
|
|
29
|
-
const { agent, modelSpec, authPath } = await createPiAgentFromDir(placement.workspace, {
|
|
30
|
-
model: opts.model,
|
|
31
|
-
authPath: opts.authPath, // flag > FASTAGENT_AUTH_PATH > default — resolved by the opener (one owner)
|
|
32
|
-
}).catch(failStartup);
|
|
33
|
-
console.error(`[fastagent] fire: ${name} (${modelSpec})`);
|
|
34
|
-
await reportAuth(placement.agentDir, modelSpec, authPath);
|
|
35
|
-
const exitCode = await runInvokeStream(agent.invoke({ session: scheduleSession(name) }, { text: schedule.prompt }), (text) => process.stdout.write(text), (line) => console.error(line));
|
|
36
|
-
process.stdout.write("\n");
|
|
37
|
-
process.exit(exitCode);
|
|
38
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `fastagent schedule history <name> [dir]`: print the run audit for one schedule (or "wake") — fired
|
|
3
|
-
* time, outcome, duration, reply/error. Read-only (reads `<stateRoot>/schedule/runs.jsonl`); the answer
|
|
4
|
-
* to "did last night's run silently fail?". Text mode previews the reply/error; --json is the full record.
|
|
5
|
-
*/
|
|
6
|
-
export declare function runScheduleHistory(name: string, dirArg: string, json: boolean): void;
|
|
7
|
-
/** `fastagent schedule list [dir]`: everything that will fire — BOTH producers: the static `schedules/`
|
|
8
|
-
* files (with their next instant) and the agent's pending self-scheduled wake-ups. Read-only. */
|
|
9
|
-
export declare function runScheduleList(dirArg: string, json: boolean): Promise<void>;
|
|
10
|
-
/** `fastagent schedule cancel <id> [dir]`: remove a pending wake-up — the operator's kill switch (the
|
|
11
|
-
* agent's own is the `unwake` tool). Unlike unwake it is NOT session-scoped: the operator owns the box. */
|
|
12
|
-
export declare function runScheduleCancel(id: string, dirArg: string): void;
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `fastagent schedule history|list|cancel` — the operator's surface over schedule state. history and
|
|
3
|
-
* list are read-only; cancel is the kill switch for a pending wake-up (the agent's own is the `unwake`
|
|
4
|
-
* tool). All three read the SAME state root the scheduler writes (FASTAGENT_STATE_DIR may live in .env).
|
|
5
|
-
*/
|
|
6
|
-
import { resolve } from "node:path";
|
|
7
|
-
import { loadDotEnv } from "../../env.js";
|
|
8
|
-
import { resolveStateRoot } from "../../paths.js";
|
|
9
|
-
import { reportModuleLoadFailures } from "../../loader.js";
|
|
10
|
-
import { readRuns } from "../../schedule/audit.js";
|
|
11
|
-
import { nextRun } from "../../schedule/cron.js";
|
|
12
|
-
import { loadSchedules } from "../../schedule/discover.js";
|
|
13
|
-
import { listWakeups, removeWakeup } from "../../schedule/wakeups.js";
|
|
14
|
-
import { failStartup, placementOrExit } from "../fail.js";
|
|
15
|
-
/**
|
|
16
|
-
* `fastagent schedule history <name> [dir]`: print the run audit for one schedule (or "wake") — fired
|
|
17
|
-
* time, outcome, duration, reply/error. Read-only (reads `<stateRoot>/schedule/runs.jsonl`); the answer
|
|
18
|
-
* to "did last night's run silently fail?". Text mode previews the reply/error; --json is the full record.
|
|
19
|
-
*/
|
|
20
|
-
export function runScheduleHistory(name, dirArg, json) {
|
|
21
|
-
const { agentDir: target } = placementOrExit(resolve(dirArg));
|
|
22
|
-
loadDotEnv(target); // FASTAGENT_STATE_DIR may live in .env — read the SAME state root the scheduler wrote
|
|
23
|
-
const runs = readRuns(resolveStateRoot(target), name);
|
|
24
|
-
if (json) {
|
|
25
|
-
console.log(JSON.stringify(runs, null, 2));
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
if (runs.length === 0) {
|
|
29
|
-
console.error(`no recorded runs for "${name}" (state: ${resolveStateRoot(target)})`);
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
// The question is "did LAST NIGHT's run fail?" — so text mode tails the most recent runs (chronological
|
|
33
|
-
// within the tail); --json above returns the full history.
|
|
34
|
-
const TAIL = 20;
|
|
35
|
-
const shown = runs.slice(-TAIL);
|
|
36
|
-
if (runs.length > shown.length) {
|
|
37
|
-
console.error(`(showing the last ${shown.length} of ${runs.length} runs — --json for all)`);
|
|
38
|
-
}
|
|
39
|
-
for (const r of shown) {
|
|
40
|
-
const detail = r.error ?? r.reply ?? "";
|
|
41
|
-
const preview = detail.replace(/\s+/g, " ").slice(0, 100);
|
|
42
|
-
console.log(`${r.firedAt} ${r.outcome.padEnd(9)} ${String(r.ms).padStart(6)}ms ${preview}`);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
/** `fastagent schedule list [dir]`: everything that will fire — BOTH producers: the static `schedules/`
|
|
46
|
-
* files (with their next instant) and the agent's pending self-scheduled wake-ups. Read-only. */
|
|
47
|
-
export async function runScheduleList(dirArg, json) {
|
|
48
|
-
const { agentDir: target } = placementOrExit(resolve(dirArg));
|
|
49
|
-
loadDotEnv(target);
|
|
50
|
-
const { schedules, failures } = await loadSchedules(target).catch(failStartup);
|
|
51
|
-
reportModuleLoadFailures(failures);
|
|
52
|
-
const wakeups = listWakeups(resolveStateRoot(target));
|
|
53
|
-
if (json) {
|
|
54
|
-
console.log(JSON.stringify({
|
|
55
|
-
schedules: schedules.map((s) => ({ ...s, next: nextRun(s.cron, s.tz, new Date())?.toISOString() })),
|
|
56
|
-
wakeups,
|
|
57
|
-
}, null, 2));
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
if (schedules.length === 0 && wakeups.length === 0) {
|
|
61
|
-
console.error(`nothing scheduled — no schedules/ files, no pending wake-ups (state: ${resolveStateRoot(target)})`);
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
for (const s of schedules) {
|
|
65
|
-
const next = nextRun(s.cron, s.tz, new Date())?.toISOString() ?? "(never)";
|
|
66
|
-
console.log(`schedule ${s.name.padEnd(20)} ${next} cron ${s.cron}${s.tz ? ` ${s.tz}` : ""}`);
|
|
67
|
-
}
|
|
68
|
-
for (const w of wakeups) {
|
|
69
|
-
const kind = w.cron ? `cron ${w.cron}${w.tz ? ` ${w.tz}` : ""}` : "one-shot";
|
|
70
|
-
console.log(`wake ${w.id} ${w.fireAt} ${kind} session=${w.session} ${w.prompt.slice(0, 60)}`);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
/** `fastagent schedule cancel <id> [dir]`: remove a pending wake-up — the operator's kill switch (the
|
|
74
|
-
* agent's own is the `unwake` tool). Unlike unwake it is NOT session-scoped: the operator owns the box. */
|
|
75
|
-
export function runScheduleCancel(id, dirArg) {
|
|
76
|
-
const { agentDir: target } = placementOrExit(resolve(dirArg));
|
|
77
|
-
loadDotEnv(target);
|
|
78
|
-
if (removeWakeup(resolveStateRoot(target), id)) {
|
|
79
|
-
// ponytail: the store's load→save is lock-free — a serving scheduler's claim-advance can race this
|
|
80
|
-
// write (window = ms around each fire). Tell the operator to verify; a lockfile/CAS is the upgrade
|
|
81
|
-
// path if it ever bites.
|
|
82
|
-
console.error(`[fastagent] cancelled wake-up ${id} — if a server is running, verify with \`fastagent schedule list\``);
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
failStartup(new Error(`no pending wake-up ${id} (state: ${resolveStateRoot(target)}) — \`fastagent schedule list\` shows ids`));
|
|
86
|
-
}
|
|
87
|
-
}
|
package/dist/github.d.ts
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
/** `@fastagent-sh/fastagent/github` — the GitHub channel subpath export, kept off the root surface. */
|
|
2
|
-
export { githubChannel, type GithubChannelOptions, type GithubEvent, type Intent, } from "./channels/github/github.ts";
|
|
3
|
-
export type { Schema } from "@octokit/webhooks-types";
|
package/dist/github.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
// fastagent.config.mjs — deployment choices only (model / http; code tools auto-discover from tools/).
|
|
2
|
-
// Your agent's identity lives in persona.md; its capabilities in skills/ + tools/ — never here.
|
|
3
|
-
// An AGENTS.md in the WORKSPACE (the directory the agent is started in) is read as project context.
|
|
4
|
-
// Model precedence: `--model` flag > FASTAGENT_MODEL env > this default.
|
|
5
|
-
// No model is preset: `fastagent dev` shows the full model catalog (models you already have
|
|
6
|
-
// credentials for come first; picking one that needs auth logs you in inline) and writes your choice
|
|
7
|
-
// below. Or set it by hand to a "provider/modelId" (`fastagent models` lists them).
|
|
8
|
-
// Self-hosted model (vLLM/Ollama/…) or your own gateway? Declare it in a models.json next to this
|
|
9
|
-
// file and select it like any other spec — see docs/configuration.md "Custom model endpoints".
|
|
10
|
-
export default {
|
|
11
|
-
// model: "openai-codex/gpt-5.5",
|
|
12
|
-
// thinkingLevel: "high", // reasoning effort (off|minimal|low|medium|high|xhigh|max); default "medium" (pi TUI parity)
|
|
13
|
-
http: { port: 8787 },
|
|
14
|
-
// selfSchedule: true, // mount the built-in `wake` tool: the agent schedules its own follow-up turns
|
|
15
|
-
// // ("check the deploy in 10 min"). Cron jobs need no opt-in — drop a schedules/<name>.ts.
|
|
16
|
-
// sessionControl: true, // serve /control/* for remote observation + steering (fastagent attach / Web panel)
|
|
17
|
-
// deploy: what the agent needs on the box (so `fastagent deploy` doesn't need a hand-written Dockerfile
|
|
18
|
-
// or hand-set host variables). Uncomment as needed:
|
|
19
|
-
// deploy: {
|
|
20
|
-
// secrets: ["GH_TOKEN"], // extra secret env vars your tools use — deploy carries them from your local env
|
|
21
|
-
// apt: ["git"], // extra apt packages baked into the image (git, ripgrep, …; default repos only)
|
|
22
|
-
// },
|
|
23
|
-
};
|
package/dist/schedule/audit.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export interface RunRecord {
|
|
2
|
-
/** The schedule's name for a cron fire; `"wake"` for a self-scheduled wake-up (its session tells which). */
|
|
3
|
-
name: string;
|
|
4
|
-
session: string;
|
|
5
|
-
firedAt: string;
|
|
6
|
-
ms: number;
|
|
7
|
-
/** `deferred` = a wake into a busy session, re-scheduled (not a final outcome for that wake-up). */
|
|
8
|
-
outcome: "completed" | "failed" | "deferred";
|
|
9
|
-
/** The turn's full reply text (completed). Delivery is the agent's tools' job — this is the audit copy. */
|
|
10
|
-
reply?: string;
|
|
11
|
-
/** The failure details (failed). */
|
|
12
|
-
error?: string;
|
|
13
|
-
}
|
|
14
|
-
/** Append one run record. Total — an audit-write failure is logged and swallowed (never breaks a fire). */
|
|
15
|
-
export declare function appendRun(stateRoot: string, record: RunRecord): void;
|
|
16
|
-
/** Read the run history (optionally filtered by name), oldest first. A malformed line is skipped with a
|
|
17
|
-
* warn (fail-visible, like the wakeups store); a missing file is an empty history (first run). */
|
|
18
|
-
export declare function readRuns(stateRoot: string, name?: string): RunRecord[];
|
package/dist/schedule/audit.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The scheduler's run audit: ONE line per fired turn in `<stateRoot>/schedule/runs.jsonl` — the answer
|
|
3
|
-
* to cron's classic pain, "did last night's run silently fail?". Append-only JSONL (grows, never
|
|
4
|
-
* rewritten — the same shape as the core session store), carrying the FULL reply text: a run record is
|
|
5
|
-
* an immutable snapshot of what that fire produced, which the rolling session (where multiple fires
|
|
6
|
-
* interleave with user turns) cannot give you per-fire. Operational audit only — the conversational
|
|
7
|
-
* truth stays in the session store.
|
|
8
|
-
*
|
|
9
|
-
* Appending is TOTAL (failures are logged, never thrown): the audit must not be able to break a fire.
|
|
10
|
-
*/
|
|
11
|
-
import { appendFileSync, mkdirSync, readFileSync } from "node:fs";
|
|
12
|
-
import { dirname, join } from "node:path";
|
|
13
|
-
import { log } from "../log.js";
|
|
14
|
-
function runsPath(stateRoot) {
|
|
15
|
-
return join(stateRoot, "schedule", "runs.jsonl");
|
|
16
|
-
}
|
|
17
|
-
/** Append one run record. Total — an audit-write failure is logged and swallowed (never breaks a fire). */
|
|
18
|
-
export function appendRun(stateRoot, record) {
|
|
19
|
-
try {
|
|
20
|
-
const path = runsPath(stateRoot);
|
|
21
|
-
mkdirSync(dirname(path), { recursive: true });
|
|
22
|
-
appendFileSync(path, `${JSON.stringify(record)}\n`);
|
|
23
|
-
}
|
|
24
|
-
catch (e) {
|
|
25
|
-
log.warn(`[schedule] could not append the run audit (the fire itself is unaffected): ${String(e)}`);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
/** Read the run history (optionally filtered by name), oldest first. A malformed line is skipped with a
|
|
29
|
-
* warn (fail-visible, like the wakeups store); a missing file is an empty history (first run). */
|
|
30
|
-
export function readRuns(stateRoot, name) {
|
|
31
|
-
let raw;
|
|
32
|
-
try {
|
|
33
|
-
raw = readFileSync(runsPath(stateRoot), "utf8");
|
|
34
|
-
}
|
|
35
|
-
catch (e) {
|
|
36
|
-
if (e.code === "ENOENT")
|
|
37
|
-
return [];
|
|
38
|
-
throw new Error(`run audit ${runsPath(stateRoot)} is unreadable: ${String(e)}`, { cause: e });
|
|
39
|
-
}
|
|
40
|
-
const records = [];
|
|
41
|
-
for (const line of raw.split("\n")) {
|
|
42
|
-
if (line.trim() === "")
|
|
43
|
-
continue;
|
|
44
|
-
try {
|
|
45
|
-
const r = JSON.parse(line);
|
|
46
|
-
if (typeof r.name !== "string" || typeof r.firedAt !== "string" || typeof r.outcome !== "string") {
|
|
47
|
-
throw new Error("missing fields");
|
|
48
|
-
}
|
|
49
|
-
if (name === undefined || r.name === name)
|
|
50
|
-
records.push(r);
|
|
51
|
-
}
|
|
52
|
-
catch {
|
|
53
|
-
log.warn(`[schedule] skipping a malformed run-audit line: ${line.slice(0, 80)}`);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return records;
|
|
57
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Schedule authoring: `defineSchedule` (the authoring surface). Drop a file in `schedules/`,
|
|
3
|
-
* default-export `defineSchedule({...})`, and it is discovered, named from the filename, and run by the
|
|
4
|
-
* scheduler — a time-trigger (the N axis, clock form) that fires the agent on a cron.
|
|
5
|
-
*
|
|
6
|
-
* // schedules/daily-digest.ts → schedule "daily-digest"
|
|
7
|
-
* export default defineSchedule({
|
|
8
|
-
* cron: "0 9 * * *",
|
|
9
|
-
* tz: "America/New_York",
|
|
10
|
-
* prompt: "Generate today's digest and send it to the team Telegram.",
|
|
11
|
-
* });
|
|
12
|
-
*
|
|
13
|
-
* A schedule carries NO session field: a session id is runtime conversational context (the K side —
|
|
14
|
-
* host-provided per invoke, core.md §10.1 / §7), not a build-time (M) value. The scheduler derives a
|
|
15
|
-
* stable per-schedule session from the name at runtime (like
|
|
16
|
-
* the telegram channel derives one from chat.id), so a schedule's turns share one continuing
|
|
17
|
-
* conversation, persisted by the core session store. Output is the AGENT's tools' job — the scheduler
|
|
18
|
-
* only fires and logs, it does not deliver.
|
|
19
|
-
*/
|
|
20
|
-
/** A time-triggered invocation: at each `cron` instant (in `tz`, default UTC) the scheduler invokes the
|
|
21
|
-
* agent with `prompt`. */
|
|
22
|
-
export interface Schedule {
|
|
23
|
-
/** 5-field cron expression (`minute hour day-of-month month day-of-week`). */
|
|
24
|
-
cron: string;
|
|
25
|
-
/** IANA timezone for the cron (default "UTC"). Wall-clock schedules (daily 9am) need it. */
|
|
26
|
-
tz?: string;
|
|
27
|
-
/** The turn's text = the job's instruction. The agent's tools decide where any output goes. */
|
|
28
|
-
prompt: string;
|
|
29
|
-
}
|
|
30
|
-
/** Identity function for typing + IDE completion (like `defineTool`/`defineConfig`). */
|
|
31
|
-
export declare function defineSchedule(schedule: Schedule): Schedule;
|
|
32
|
-
/** A loaded schedule: its authored fields plus the name derived from its filename (authoritative). */
|
|
33
|
-
export interface LoadedSchedule extends Schedule {
|
|
34
|
-
name: string;
|
|
35
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Schedule authoring: `defineSchedule` (the authoring surface). Drop a file in `schedules/`,
|
|
3
|
-
* default-export `defineSchedule({...})`, and it is discovered, named from the filename, and run by the
|
|
4
|
-
* scheduler — a time-trigger (the N axis, clock form) that fires the agent on a cron.
|
|
5
|
-
*
|
|
6
|
-
* // schedules/daily-digest.ts → schedule "daily-digest"
|
|
7
|
-
* export default defineSchedule({
|
|
8
|
-
* cron: "0 9 * * *",
|
|
9
|
-
* tz: "America/New_York",
|
|
10
|
-
* prompt: "Generate today's digest and send it to the team Telegram.",
|
|
11
|
-
* });
|
|
12
|
-
*
|
|
13
|
-
* A schedule carries NO session field: a session id is runtime conversational context (the K side —
|
|
14
|
-
* host-provided per invoke, core.md §10.1 / §7), not a build-time (M) value. The scheduler derives a
|
|
15
|
-
* stable per-schedule session from the name at runtime (like
|
|
16
|
-
* the telegram channel derives one from chat.id), so a schedule's turns share one continuing
|
|
17
|
-
* conversation, persisted by the core session store. Output is the AGENT's tools' job — the scheduler
|
|
18
|
-
* only fires and logs, it does not deliver.
|
|
19
|
-
*/
|
|
20
|
-
/** Identity function for typing + IDE completion (like `defineTool`/`defineConfig`). */
|
|
21
|
-
export function defineSchedule(schedule) {
|
|
22
|
-
return schedule;
|
|
23
|
-
}
|