@fastagent-sh/fastagent 0.21.1 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +209 -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 +153 -228
- 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
package/dist/log.d.ts
CHANGED
|
@@ -1,17 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Leveled logging. Runtime logs (lifecycle, warnings, errors, the debug turn trace) flow through ONE
|
|
3
|
-
* process-level logger, gated by a single level. It is a module singleton — not an injected dependency —
|
|
4
|
-
* because most runtime logs originate inside author-constructed channels (`channels/*.ts` call the
|
|
5
|
-
* channel factory themselves) and deep engine code, which the CLI cannot thread a logger into. The CLI
|
|
6
|
-
* sets the level by posture (dev → debug, start → info); `FASTAGENT_LOG_LEVEL` overrides it.
|
|
7
|
-
*
|
|
8
|
-
* This is NOT the CLI's user-facing output (help text, command results): that is the program talking to
|
|
9
|
-
* its operator and stays on plain `console`. Everything here is operational logging to stderr.
|
|
10
|
-
*/
|
|
1
|
+
/** Leveled logging. */
|
|
11
2
|
type LogLevel = "debug" | "info" | "warn" | "error";
|
|
12
|
-
/** Set the posture default.
|
|
3
|
+
/** Set the posture default. */
|
|
13
4
|
export declare function setLogLevel(level: LogLevel): void;
|
|
14
|
-
/** The process logger. Runtime code imports this and calls `log.info(...)` etc. */
|
|
15
5
|
export declare const log: {
|
|
16
6
|
debug: (msg: string) => void;
|
|
17
7
|
info: (msg: string) => void;
|
package/dist/log.js
CHANGED
|
@@ -1,28 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Leveled logging. Runtime logs (lifecycle, warnings, errors, the debug turn trace) flow through ONE
|
|
3
|
-
* process-level logger, gated by a single level. It is a module singleton — not an injected dependency —
|
|
4
|
-
* because most runtime logs originate inside author-constructed channels (`channels/*.ts` call the
|
|
5
|
-
* channel factory themselves) and deep engine code, which the CLI cannot thread a logger into. The CLI
|
|
6
|
-
* sets the level by posture (dev → debug, start → info); `FASTAGENT_LOG_LEVEL` overrides it.
|
|
7
|
-
*
|
|
8
|
-
* This is NOT the CLI's user-facing output (help text, command results): that is the program talking to
|
|
9
|
-
* its operator and stays on plain `console`. Everything here is operational logging to stderr.
|
|
10
|
-
*/
|
|
1
|
+
/** Leveled logging. */
|
|
11
2
|
const ORDER = { debug: 0, info: 1, warn: 2, error: 3 };
|
|
12
3
|
const isLevel = (s) => Object.hasOwn(ORDER, s);
|
|
13
4
|
const format = (level, msg) => `${level.toUpperCase().padEnd(5)} ${msg}`;
|
|
14
|
-
/**
|
|
15
|
-
* `FASTAGENT_LOG_LEVEL` resolved PER EMIT, not at import: this module is imported transitively by every
|
|
16
|
-
* command module, so an import-time read runs before any command reaches `loadDotEnv` and could never
|
|
17
|
-
* see the agent's `.secrets/.env` — a key that file could not carry at all.
|
|
18
|
-
*
|
|
19
|
-
* Three states: a valid value wins over the posture; an invalid value warns when it differs from the
|
|
20
|
-
* last warned value and is treated as absent, so a typo (meant to make logs louder) can never silently pin the
|
|
21
|
-
* level nor kill the posture default; absent leaves the posture. Empty is absent, matching
|
|
22
|
-
* `resolveOverridePath` — `KEY=` is how a `.env` parks a key it does not want set, not a typo to warn
|
|
23
|
-
* about. The warning is raw `console.error` because it is the logger reporting on its own gate, but
|
|
24
|
-
* reuses `format` for the same shape.
|
|
25
|
-
*/
|
|
5
|
+
/** `FASTAGENT_LOG_LEVEL` resolved PER EMIT, not at import. */
|
|
26
6
|
let posture = "info";
|
|
27
7
|
let warnedFor;
|
|
28
8
|
function effectiveLevel() {
|
|
@@ -38,7 +18,7 @@ function effectiveLevel() {
|
|
|
38
18
|
}
|
|
39
19
|
return posture;
|
|
40
20
|
}
|
|
41
|
-
/** Set the posture default.
|
|
21
|
+
/** Set the posture default. */
|
|
42
22
|
export function setLogLevel(level) {
|
|
43
23
|
posture = level;
|
|
44
24
|
}
|
|
@@ -46,5 +26,4 @@ const emit = (level) => (msg) => {
|
|
|
46
26
|
if (ORDER[level] >= ORDER[effectiveLevel()])
|
|
47
27
|
console.error(format(level, msg));
|
|
48
28
|
};
|
|
49
|
-
/** The process logger. Runtime code imports this and calls `log.info(...)` etc. */
|
|
50
29
|
export const log = { debug: emit("debug"), info: emit("info"), warn: emit("warn"), error: emit("error") };
|
package/dist/node.d.ts
CHANGED
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Binding a Fetch handler to a Node HTTP server.
|
|
3
|
-
*
|
|
4
|
-
* Its own entry point because it is the one piece of the neutral surface that is RUNTIME-specific:
|
|
5
|
-
* `@hono/node-server` bridges `node:http` ↔ Fetch, and that package is the only third-party weight
|
|
6
|
-
* anywhere behind `/core`. Keeping it here lets a channel package or another engine import the
|
|
7
|
-
* contract without pulling a Node HTTP bridge it will never call — and lets a non-Node runtime
|
|
8
|
-
* (Workers, Deno, Bun's own server) consume `/core` unchanged.
|
|
9
|
-
*
|
|
10
|
-
* Engine-neutral is not the same as runtime-neutral, and the two properties give the surface its
|
|
11
|
-
* three layers: `/core` is both (contract, fetch-shaped kit), `/node` is engine-neutral only (this
|
|
12
|
-
* file: the assembly and the HTTP binding, which need a filesystem, a clock and an environment),
|
|
13
|
-
* `/pi` is neither (it names an engine).
|
|
14
|
-
*/
|
|
1
|
+
/** Binding a Fetch handler to a Node HTTP server. */
|
|
15
2
|
export { nodeListener, serveNode } from "./channels/serve.ts";
|
|
16
|
-
export { mountAgentService, type AgentService, type MountableAgent, type MountAgentServiceOptions, } from "./service.ts";
|
|
3
|
+
export { mountAgentService, type AgentService, type HttpSurface, type MountableAgent, type MountAgentServiceOptions, } from "./service.ts";
|
package/dist/node.js
CHANGED
|
@@ -1,20 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Binding a Fetch handler to a Node HTTP server.
|
|
3
|
-
*
|
|
4
|
-
* Its own entry point because it is the one piece of the neutral surface that is RUNTIME-specific:
|
|
5
|
-
* `@hono/node-server` bridges `node:http` ↔ Fetch, and that package is the only third-party weight
|
|
6
|
-
* anywhere behind `/core`. Keeping it here lets a channel package or another engine import the
|
|
7
|
-
* contract without pulling a Node HTTP bridge it will never call — and lets a non-Node runtime
|
|
8
|
-
* (Workers, Deno, Bun's own server) consume `/core` unchanged.
|
|
9
|
-
*
|
|
10
|
-
* Engine-neutral is not the same as runtime-neutral, and the two properties give the surface its
|
|
11
|
-
* three layers: `/core` is both (contract, fetch-shaped kit), `/node` is engine-neutral only (this
|
|
12
|
-
* file: the assembly and the HTTP binding, which need a filesystem, a clock and an environment),
|
|
13
|
-
* `/pi` is neither (it names an engine).
|
|
14
|
-
*/
|
|
1
|
+
/** Binding a Fetch handler to a Node HTTP server. */
|
|
15
2
|
export { nodeListener, serveNode } from "./channels/serve.js";
|
|
16
|
-
// The assembly: a MountableAgent becomes a mounted service.
|
|
17
|
-
// contract plus three paths, so a second engine reuses it with its own opener — but NOT runtime
|
|
18
|
-
// neutral: it reads a directory, a cron and an environment. That is what makes this its entry
|
|
19
|
-
// rather than `/core`.
|
|
3
|
+
// The assembly: a MountableAgent becomes a mounted service.
|
|
20
4
|
export { mountAgentService, } from "./service.js";
|
package/dist/observe.d.ts
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The turn trace: wrap an Agent to tee each turn's loop — prompt, reasoning, tool calls (name + args)
|
|
3
|
-
*
|
|
4
|
-
* untouched; this only adds a readable line per step. Engine-neutral (the contract only).
|
|
5
|
-
*
|
|
6
|
-
* It is wired in BOTH `dev` and `start`; the level decides visibility. dev runs at debug, so the trace
|
|
7
|
-
* (including end-user content — prompt, tool args/results, reply) shows; start runs at info, so the
|
|
8
|
-
* trace is gated out entirely, keeping that content and its volume out of production logs. That gating
|
|
9
|
-
* is why the trace is debug-level rather than a switch soldered to the command path.
|
|
2
|
+
* The turn trace: wrap an Agent to tee each turn's loop — prompt, reasoning, tool calls (name + args) with results,
|
|
3
|
+
* reply, terminal — to the log at DEBUG level.
|
|
10
4
|
*/
|
|
11
5
|
import type { Agent } from "./agent.ts";
|
|
12
6
|
export declare function logAgentLoop(agent: Agent, sink?: (line: string) => void): Agent;
|
package/dist/open-url.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/** Best-effort open a URL in the default browser.
|
|
1
|
+
/** Best-effort open a URL in the default browser. */
|
|
2
2
|
export declare function openExternalUrl(url: string): void;
|
package/dist/open-url.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
|
-
/** Best-effort open a URL in the default browser.
|
|
2
|
+
/** Best-effort open a URL in the default browser. */
|
|
3
3
|
export function openExternalUrl(url) {
|
|
4
4
|
const cmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
|
|
5
5
|
spawn(cmd, [url], { stdio: "ignore", detached: true, shell: process.platform === "win32" }).on("error", () => { });
|
package/dist/paths.d.ts
CHANGED
|
@@ -1,174 +1,110 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The directory name `init` gives a nested agent (`<workspace>/fastagent/`) unless `--agent-dir` names
|
|
3
|
-
* another. A DEFAULT, not a rule: resolution reads the config marker and never a name, so renaming an
|
|
4
|
-
* agent directory changes nothing about how it resolves. Visible on purpose — the agent directory holds
|
|
5
|
-
* the AUTHOR's content (persona, skills, tool code: code, not tool configuration), so it follows the
|
|
6
|
-
* repo convention for code (a plain directory), while fastagent's own machinery inside it (`.secrets/`,
|
|
7
|
-
* `.state/`) keeps the dot prefix.
|
|
8
|
-
*/
|
|
1
|
+
/** The directory name `init` gives an agent (`<workspace>/fastagent/`) unless `--agent-dir` names another. */
|
|
9
2
|
export declare const DEFAULT_AGENT_DIRNAME = "fastagent";
|
|
10
|
-
/** The user-global machinery home under `$HOME
|
|
11
|
-
* tool homes (`~/.cargo`, `~/.docker`); unrelated to {@link DEFAULT_AGENT_DIRNAME}, which only names
|
|
12
|
-
* what `init` creates.
|
|
13
|
-
* It carries the same shape inside it as an agent dir does (`~/.fastagent/.secrets/auth.json`), so the
|
|
14
|
-
* resolvers below need no special case: `login` outside any agent simply hands them this directory. */
|
|
3
|
+
/** The user-global machinery home under `$HOME`. */
|
|
15
4
|
export declare const GLOBAL_HOME_DIR = ".fastagent";
|
|
16
|
-
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
5
|
+
/**
|
|
6
|
+
* The secrets segment inside an agent dir (or the global home). Every path fastagent resolves — `.env`,
|
|
7
|
+
* `.env.example`, auth.json, the scaffold's write — derives from it, so they cannot drift apart.
|
|
8
|
+
* `FASTAGENT_SECRETS_DIR` relocates the RESOLVED dir ({@link resolveSecretsDir}), never this name; the scaffolded
|
|
9
|
+
* ignore templates spell it out as literal text, so renaming this constant means editing them too.
|
|
10
|
+
*/
|
|
21
11
|
export declare const SECRETS_DIRNAME = ".secrets";
|
|
22
12
|
/** The state segment inside an agent dir — same rule and same template caveat as {@link SECRETS_DIRNAME}. */
|
|
23
13
|
export declare const STATE_DIRNAME = ".state";
|
|
24
|
-
/**
|
|
25
|
-
*
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
* scope must not silently drift from what the worker actually loads. */
|
|
14
|
+
/**
|
|
15
|
+
* THE config filename. One spelling, not a family: fastagent generates this file, so a choice of extension buys
|
|
16
|
+
* an author nothing and costs a precedence order plus a "you have two of them" failure path. Everything else an
|
|
17
|
+
* author writes (`tools/`, `channels/`, `routines/`) still accepts `.ts`/`.js`/`.mjs` — that is THEIR code.
|
|
18
|
+
*/
|
|
19
|
+
export declare const AGENT_CONFIG_FILE = "fastagent.config.ts";
|
|
20
|
+
/** The optional custom-model-endpoint file inside an agent dir (pi's models.json schema). */
|
|
32
21
|
export declare const AGENT_MODELS_FILE = "models.json";
|
|
33
22
|
export interface ResolvedPlacement {
|
|
34
|
-
/**
|
|
35
|
-
*
|
|
23
|
+
/**
|
|
24
|
+
* The AGENT directory — where the definition (persona.md/skills/tools/channels/routines), the config, and the
|
|
25
|
+
* machinery dirs (`.secrets/`, `.state/`) live.
|
|
26
|
+
*/
|
|
36
27
|
agentDir: string;
|
|
37
|
-
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
|
|
41
|
-
* two placements to distinguish: there is one lookup and the directory you gave it. The naming
|
|
42
|
-
* follows git: the repository sits at the root of its working tree, and WORK belongs to the tree. */
|
|
28
|
+
/**
|
|
29
|
+
* The WORKSPACE — what the agent works ON: its cwd, and the start of the ② context walk. Always the agent
|
|
30
|
+
* directory's parent, whichever of the two the command was pointed at.
|
|
31
|
+
*/
|
|
43
32
|
workspace: string;
|
|
44
33
|
}
|
|
45
34
|
/**
|
|
46
|
-
* The agents `dir` resolves over: ITSELF when it holds a config, else the ones directly inside it —
|
|
47
|
-
*
|
|
48
|
-
* same question this lookup asks: which agents would `dir` resolve over, before and after scaffolding.
|
|
35
|
+
* The agents `dir` resolves over: ITSELF when it holds a config, else the ones directly inside it — never both,
|
|
36
|
+
* because aiming at an agent can only mean that agent.
|
|
49
37
|
*/
|
|
50
38
|
export declare function agentsAt(dir: string): string[];
|
|
51
|
-
/**
|
|
52
|
-
* The one-line hint for "you pointed at the agent, but the project around it is what you meant" — or
|
|
53
|
-
* undefined. The workspace being whatever you aimed at is deliberate (a deployed box may hold nothing
|
|
54
|
-
* but the agent), and the cost is that `cd my-agent && fastagent dev` legitimately narrows the agent's
|
|
55
|
-
* WORKSPACE to its own directory: its cwd, its coding tools' root, and deploy's build context. (②
|
|
56
|
-
* context is not affected — that walk climbs ancestors either way.) Resolution must not guess which you
|
|
57
|
-
* wanted, so this is a HINT — and a hint may use the heuristic ("the parent carries an AGENTS.md or a
|
|
58
|
-
* .git") that a rule may not.
|
|
59
|
-
*
|
|
60
|
-
* It suggests a command only after RUNNING the lookup that command would run, because a hint that dead-ends
|
|
61
|
-
* is worse than none: with several agents beside this one, `..` refuses and names them — sending the
|
|
62
|
-
* reader to a refusal whose own advice points back here.
|
|
63
|
-
*/
|
|
64
|
-
export declare function workspaceHint({ agentDir, workspace }: ResolvedPlacement, env?: NodeJS.ProcessEnv): string | undefined;
|
|
65
|
-
/** The agent dir for `dir`, or undefined when there is none — {@link findPlacement} without the pair
|
|
66
|
-
* or the throw. Login and standalone channel senders also operate outside configured agents, so
|
|
67
|
-
* they need absence as a value. Filesystem errors still propagate. */
|
|
39
|
+
/** The agent dir for `dir`, or undefined when there is none — {@link findPlacement} without the pair or the throw. */
|
|
68
40
|
export declare function findAgentDir(dir: string): string | undefined;
|
|
69
41
|
/**
|
|
70
|
-
* The agent whose DEFINITION contains `dir` — scaffolding there would make the new agent part of the
|
|
71
|
-
*
|
|
72
|
-
* purpose: an agent owns only what it LOADS ({@link LOADED_SURFACE}); the rest of its directory is the
|
|
73
|
-
* author's tree, where a second agent (a monorepo package, say) is a legitimate thing to create.
|
|
74
|
-
* `enclosingAgentDir` answers a different question ("where do I `cd` to?"), and for that an agent's
|
|
75
|
-
* `src/` genuinely IS inside it.
|
|
42
|
+
* The agent whose DEFINITION contains `dir` — scaffolding there would make the new agent part of the outer one's
|
|
43
|
+
* loaded surface rather than an agent of its own.
|
|
76
44
|
*/
|
|
77
45
|
export declare function agentDefinitionOwner(dir: string): string | undefined;
|
|
78
|
-
/**
|
|
79
|
-
* Why `dir` is not an agent, when it has its OWN way out — or undefined when it is simply not near one.
|
|
80
|
-
* Two positions qualify: standing INSIDE an agent (its `tools/`, its `src/`), and standing on a
|
|
81
|
-
* directory whose several agents nothing selects between. Both matter because the generic advice ("run
|
|
82
|
-
* `fastagent init`") would not help — the agent already exists, one step away.
|
|
83
|
-
*
|
|
84
|
-
* Exported because `login` is the one command allowed to run outside an agent, and it must tell "truly
|
|
85
|
-
* outside" (→ the global credential) from "a dead end" (→ refuse, like every other command).
|
|
86
|
-
*/
|
|
46
|
+
/** Why `dir` is not an agent, when it has its OWN way out — or undefined when it is simply not near one. */
|
|
87
47
|
export declare function placementDeadEnd(dir: string, env?: NodeJS.ProcessEnv): string | undefined;
|
|
88
48
|
/**
|
|
89
|
-
* Resolve a directory into its placement — the ONE owner of the rule ({@link findPlacement})
|
|
90
|
-
* the workspace, and the agent is the single `fastagent.config.*` holder at it or one level inside.
|
|
91
|
-
* Placement is never configured and never detected from surroundings; it is that lookup and the
|
|
92
|
-
* directory you pointed at.
|
|
49
|
+
* Resolve a directory into its placement — the ONE owner of the rule ({@link findPlacement}).
|
|
93
50
|
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
51
|
+
* WHERE AN UNREADABLE CANDIDATE IS SPENT, and only here: this caller MUST produce an agent, so a directory it
|
|
52
|
+
* could not look into is the difference between "there is none" and "there might be". `placementDeadEnd` is
|
|
53
|
+
* asked a weaker question — is this place a dead end with its own way out — by callers like `login`, for which
|
|
54
|
+
* a neighbour it may not enter is environment noise, not a reason to exit instead of logging in globally. It
|
|
55
|
+
* also comes AFTER that call: with two agents to choose between, a permission problem in a third directory is
|
|
56
|
+
* not the message that gets the caller moving.
|
|
97
57
|
*/
|
|
98
58
|
export declare function resolvePlacement(dir: string, env?: NodeJS.ProcessEnv): ResolvedPlacement;
|
|
99
|
-
/** How to WRITE a path for someone standing in `cwd
|
|
100
|
-
* it climbs out (a `../../..` is noise), and undefined when it IS `cwd` (nothing to say). ONE policy,
|
|
101
|
-
* shared by `init`'s `cd` step, `add`'s next-steps paths and `fire`'s "looked in" hint — they all answer
|
|
102
|
-
* the same question, which is a placement-PRESENTATION question, not a scaffolding one. */
|
|
59
|
+
/** How to WRITE a path for someone standing in `cwd`. */
|
|
103
60
|
export declare function displayPath(cwd: string, dir: string): string | undefined;
|
|
104
|
-
/** Does a path exist? Plain fs, no placement in it — it lives here because `paths.ts` is where the
|
|
105
|
-
* neutral path helpers are, and the scaffolder is not a utility home for the CLI and deploy. */
|
|
106
61
|
export declare function exists(p: string): Promise<boolean>;
|
|
107
|
-
/** The file's text, or undefined when there is no file.
|
|
108
|
-
* exists but cannot be read (EACCES, a directory in its place) throws, because a decision made on
|
|
109
|
-
* "not there" — regenerate it, skip its gate — is the wrong one for a file that is there. */
|
|
62
|
+
/** The file's text, or undefined when there is no file. */
|
|
110
63
|
export declare function readTextIfExists(p: string): Promise<string | undefined>;
|
|
111
64
|
/**
|
|
112
|
-
* Resolve a user-supplied path override (a CLI flag or an env var) to an absolute path, expanding a
|
|
113
|
-
*
|
|
114
|
-
* never gets the shell's `~` expansion, so a bare `resolve("~/x")` would silently create a literal `~`
|
|
115
|
-
* directory — a fail-silently footgun for a secret/state path. Expanding here makes `~` mean home
|
|
116
|
-
* everywhere these knobs are read.
|
|
65
|
+
* Resolve a user-supplied path override (a CLI flag or an env var) to an absolute path, expanding a leading `~`/`~/`
|
|
66
|
+
* to the home dir FIRST.
|
|
117
67
|
*/
|
|
118
68
|
export declare function resolveOverridePath(raw: string | undefined): string | undefined;
|
|
119
69
|
/**
|
|
120
|
-
* The resolved state root — the durable machine-state home (sessions/, channels/<kind>/, schedule
|
|
121
|
-
*
|
|
122
|
-
* startup report agree regardless of cwd. Definition: mutable runtime state — single lifecycle
|
|
123
|
-
* (precious, survives redeploy), single process; a container points this at its mounted volume.
|
|
124
|
-
* Secrets are NOT here — they live under {@link resolveSecretsDir} (a different deploy lifecycle:
|
|
125
|
-
* secret store vs volume). The finer knob (`FASTAGENT_SESSIONS_DIR`) still overrides its path on top.
|
|
126
|
-
*
|
|
127
|
-
* `FASTAGENT_STATE_DIR` is an OPERATOR override, so a relative value resolves against `process.cwd()`
|
|
128
|
-
* — the CLI convention its sibling knobs share (`resolveOverridePath`), NOT against `dir`. Only the
|
|
129
|
-
* DEFAULT (`<root>/.state`) is dir-anchored.
|
|
70
|
+
* The resolved state root — the durable machine-state home (sessions/, channels/<kind>/, schedule/):
|
|
71
|
+
* `FASTAGENT_STATE_DIR` env > `<agentDir>/.state`.
|
|
130
72
|
*/
|
|
131
73
|
export declare function resolveStateRoot(dir: string, env?: NodeJS.ProcessEnv): string;
|
|
132
74
|
/**
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
75
|
+
* WHERE an agent's session records live: `<state root>/sessions`, always. Records are machine state like channel
|
|
76
|
+
* state and schedule claims, so they move with the ONE knob that moves all of it rather than with a second one that
|
|
77
|
+
* moves only them — a split every reader would then have to agree about, and which left channel state behind anyway.
|
|
78
|
+
* An embedder that really wants the records elsewhere passes `sessionsDir` to `createAgentService`; there is no env
|
|
79
|
+
* or flag spelling of it, for the reason `resolveAuthPathOverride` states.
|
|
80
|
+
*/
|
|
81
|
+
export declare function resolveSessionsDir(dir: string, env?: NodeJS.ProcessEnv): string;
|
|
82
|
+
/**
|
|
83
|
+
* The resolved secrets dir — everything fastagent manages that must NEVER leave the machine (the agent's `.env` +
|
|
84
|
+
* auth.json).
|
|
141
85
|
*/
|
|
142
86
|
export declare function resolveSecretsDir(dir: string, env?: NodeJS.ProcessEnv): string;
|
|
143
|
-
/**
|
|
144
|
-
|
|
87
|
+
/** Is this process the deployed container the generated artifacts describe? ONE reading of the
|
|
88
|
+
* environment fact the image states, so a second spelling cannot drift from it. */
|
|
89
|
+
export declare function isDeployedWorkspace(): boolean;
|
|
90
|
+
/** Is this process running inside the AgentCore Runtime? Set by the generated deploy artifacts. */
|
|
91
|
+
export declare function isAgentcoreRuntime(): boolean;
|
|
145
92
|
/**
|
|
146
|
-
*
|
|
147
|
-
*
|
|
93
|
+
* The mode of a file fastagent CREATES to hold a secret: `auth.json`, a `.env` it makes itself,
|
|
94
|
+
* a host's parameter file. That is the whole extent of its opinion about permissions — a file it did not create
|
|
95
|
+
* keeps the mode its owner gave it, and no directory's mode is ever decided or repaired. Every comparable tool
|
|
96
|
+
* draws the line here: Rails chmods the `master.key` it generates and leaves `config/` alone
|
|
97
|
+
* (rails/rails@4c6c357), the aws CLI ships a 0600 `~/.aws/config` inside a 0755 `~/.aws`.
|
|
148
98
|
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
* writer gets there first — `mkdir`'s `mode` is ignored for a directory that already exists, so a
|
|
152
|
-
* later, more careful caller silently inherits the first one's answer. Four callers create this
|
|
153
|
-
* directory (`init`, `add <channel>`, the credential store, the deploy seed) and the ordinary order
|
|
154
|
-
* is init → add → login, so the careful one is LAST: the rule has to live where all of them can
|
|
155
|
-
* reach it, and it has to chmod rather than trust the create.
|
|
99
|
+
* "Who created the file" is the load-bearing half: asking instead whether a given WRITE carries a secret has a
|
|
100
|
+
* different answer at every call site and one more with each new writer.
|
|
156
101
|
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
*/
|
|
161
|
-
export declare function ensureSecretsDir(dir: string): Promise<void>;
|
|
162
|
-
/**
|
|
163
|
-
* Guard that `<agentDir>/<name>` resolves INSIDE the agent dir — a symlink that escapes (or an
|
|
164
|
-
* absolute target) is rejected, so discovery/scaffolding never reaches out of the definition directory.
|
|
165
|
-
* A missing target is fine (nothing to guard yet).
|
|
102
|
+
* One consequence worth knowing: `writeFileAtomic` sets the mode on the temp file it renames into place, so a
|
|
103
|
+
* file it owns end-to-end (`auth.json`) is 0600 after every write, including one an operator had
|
|
104
|
+
* placed by hand. Appending to a file fastagent did not create (`.env`) cannot and does not do that.
|
|
166
105
|
*/
|
|
106
|
+
export declare const SECRET_FILE_MODE = 384;
|
|
107
|
+
/** Guard that `<agentDir>/<name>` resolves INSIDE the agent dir. */
|
|
167
108
|
export declare function assertInsideAgentDir(agentDir: string, name: string): Promise<void>;
|
|
168
|
-
/**
|
|
169
|
-
* Whether `targetPath` lives inside `baseDir` (same path counts). Used to ask "did an override move
|
|
170
|
-
* this OUT of the agent?" — the startup report's redeploy notes, `add`'s printed `.env` label, and the
|
|
171
|
-
* dev watcher's "your .env is not watched" warning all turn on that fact. Reporting only: fastagent
|
|
172
|
-
* does not act on where a user's paths point.
|
|
173
|
-
*/
|
|
109
|
+
/** Whether `targetPath` lives inside `baseDir` (same path counts). */
|
|
174
110
|
export declare function isUnderDir(targetPath: string, baseDir: string): boolean;
|