@fastagent-sh/fastagent 0.19.0 → 0.20.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/dist/atomic-write.d.ts +11 -7
- package/dist/atomic-write.js +16 -11
- package/dist/channels/agentcore-limits.d.ts +9 -0
- package/dist/channels/agentcore-limits.js +9 -0
- package/dist/channels/agentcore-service.d.ts +12 -11
- package/dist/channels/agentcore-service.js +14 -18
- package/dist/channels/agentcore.d.ts +11 -19
- package/dist/channels/agentcore.js +14 -7
- package/dist/channels/control.d.ts +50 -12
- package/dist/channels/control.js +239 -96
- package/dist/channels/discover.d.ts +26 -4
- package/dist/channels/discover.js +12 -23
- package/dist/channels/feishu/feishu-api.js +5 -8
- package/dist/channels/feishu/feishu.js +35 -18
- package/dist/channels/kit/attachment-path.d.ts +12 -0
- package/dist/channels/kit/attachment-path.js +43 -0
- package/dist/channels/kit/context-buffer.d.ts +9 -0
- package/dist/channels/kit/context-buffer.js +11 -0
- package/dist/channels/kit/signature.d.ts +12 -0
- package/dist/channels/kit/signature.js +17 -0
- package/dist/channels/kit/stop-command.js +3 -3
- package/dist/channels/kit/tasks.d.ts +1 -1
- package/dist/channels/kit/tasks.js +10 -4
- package/dist/channels/kit/turn-store.d.ts +19 -3
- package/dist/channels/kit/turn-store.js +29 -2
- package/dist/channels/slack/invoke-turn.d.ts +1 -1
- package/dist/channels/slack/invoke-turn.js +5 -1
- package/dist/channels/slack/onboard.js +5 -5
- package/dist/channels/slack/onboarding-state.d.ts +7 -3
- package/dist/channels/slack/onboarding-state.js +13 -20
- package/dist/channels/slack/register-webhook.js +1 -1
- package/dist/channels/slack/scaffold/slack-send.ts +2 -17
- package/dist/channels/slack/slack-api.js +22 -54
- package/dist/channels/slack/slack.js +13 -13
- package/dist/channels/telegram/parse.d.ts +21 -1
- package/dist/channels/telegram/parse.js +65 -11
- package/dist/channels/telegram/scaffold/channel.ts +7 -3
- package/dist/channels/telegram/telegram-api.js +5 -6
- package/dist/channels/telegram/telegram.d.ts +2 -2
- package/dist/channels/telegram/telegram.js +57 -69
- package/dist/cli/add-slack.js +6 -5
- package/dist/cli/commands/add.js +1 -5
- package/dist/cli/commands/attach.d.ts +2 -4
- package/dist/cli/commands/attach.js +17 -15
- package/dist/cli/commands/deploy.d.ts +50 -5
- package/dist/cli/commands/deploy.js +183 -134
- package/dist/cli/commands/dev.js +4 -31
- package/dist/cli/commands/info.js +1 -2
- package/dist/cli/commands/init.js +1 -2
- package/dist/cli/commands/start.js +31 -41
- package/dist/cli/serve.d.ts +12 -21
- package/dist/cli/serve.js +20 -25
- package/dist/cli/shared.d.ts +40 -10
- package/dist/cli/shared.js +51 -4
- package/dist/deploy/agentcore/logs.d.ts +2 -2
- package/dist/deploy/agentcore/logs.js +2 -2
- package/dist/deploy/agentcore/plan.d.ts +12 -10
- package/dist/deploy/agentcore/plan.js +39 -31
- package/dist/deploy/agentcore/run.d.ts +5 -4
- package/dist/deploy/agentcore/run.js +13 -36
- package/dist/deploy/channel-ingress.d.ts +73 -0
- package/dist/deploy/channel-ingress.js +101 -0
- package/dist/deploy/docker/plan.d.ts +3 -7
- package/dist/deploy/docker/plan.js +4 -15
- package/dist/deploy/docker/run.d.ts +18 -1
- package/dist/deploy/docker/run.js +10 -0
- package/dist/deploy/fly/plan.d.ts +4 -5
- package/dist/deploy/fly/plan.js +7 -22
- package/dist/deploy/fly/run.d.ts +9 -23
- package/dist/deploy/fly/run.js +32 -68
- package/dist/deploy/preflight.d.ts +6 -7
- package/dist/deploy/preflight.js +26 -22
- package/dist/deploy/railway/plan.d.ts +4 -5
- package/dist/deploy/railway/plan.js +11 -26
- package/dist/deploy/railway/run.d.ts +9 -9
- package/dist/deploy/railway/run.js +40 -40
- package/dist/deploy/runner.js +22 -2
- package/dist/deploy/secrets.d.ts +18 -9
- package/dist/deploy/secrets.js +64 -12
- package/dist/dev-supervisor.js +3 -4
- package/dist/engines/pi/agent-session-factory.js +20 -39
- package/dist/engines/pi/auth.js +43 -43
- package/dist/engines/pi/config.d.ts +1 -1
- package/dist/engines/pi/create.d.ts +14 -2
- package/dist/engines/pi/create.js +2 -2
- package/dist/engines/pi/definition.d.ts +1 -1
- package/dist/engines/pi/definition.js +3 -4
- package/dist/engines/pi/login.js +32 -16
- package/dist/engines/pi/open.d.ts +1 -2
- package/dist/engines/pi/open.js +1 -1
- package/dist/engines/pi/search-tools.js +1 -1
- package/dist/engines/pi/service.d.ts +1 -1
- package/dist/engines/pi/service.js +8 -0
- package/dist/engines/pi/session-builder.js +6 -33
- package/dist/engines/pi/session-control.d.ts +19 -6
- package/dist/engines/pi/session-control.js +565 -470
- package/dist/engines/pi/session-inheritance.d.ts +8 -22
- package/dist/engines/pi/session-inheritance.js +95 -76
- package/dist/engines/pi/session-markers.d.ts +48 -0
- package/dist/engines/pi/session-markers.js +59 -0
- package/dist/engines/pi/session-settings.d.ts +4 -4
- package/dist/engines/pi/session-settings.js +7 -4
- package/dist/engines/pi/session-store.d.ts +83 -13
- package/dist/engines/pi/session-store.js +408 -55
- package/dist/engines/pi/tool-context.d.ts +21 -8
- package/dist/engines/pi/tool-context.js +29 -4
- package/dist/engines/pi/tool.js +2 -2
- package/dist/env.js +1 -2
- package/dist/loader.d.ts +49 -7
- package/dist/loader.js +79 -18
- package/dist/paths.d.ts +19 -0
- package/dist/paths.js +27 -2
- package/dist/scaffold/add-channel.js +2 -2
- package/dist/scaffold/init.js +7 -2
- package/dist/scaffold/templates/tools/fetch-url.ts +0 -2
- package/dist/schedule/discover.js +3 -15
- package/dist/schedule/wake-alarm.d.ts +13 -7
- package/dist/schedule/wake-alarm.js +88 -46
- package/dist/schedule/wakeups.d.ts +1 -1
- package/dist/schedule/wakeups.js +10 -7
- package/dist/service.d.ts +1 -2
- package/dist/service.js +27 -5
- package/dist/session-remote.d.ts +7 -2
- package/dist/session-remote.js +162 -92
- package/dist/session.d.ts +226 -92
- package/dist/session.js +61 -23
- package/dist/telegram.d.ts +1 -1
- package/dist/telegram.js +1 -1
- package/dist/tunnel.d.ts +18 -3
- package/dist/tunnel.js +32 -40
- package/package.json +1 -1
package/dist/tunnel.js
CHANGED
|
@@ -7,11 +7,10 @@
|
|
|
7
7
|
* Process orchestration, not assembly — lives outside the engine, beside dev-supervisor.ts.
|
|
8
8
|
*/
|
|
9
9
|
import { spawn } from "node:child_process";
|
|
10
|
-
import { readdirSync } from "node:fs";
|
|
11
|
-
import { join } from "node:path";
|
|
12
10
|
import { registerFeishuWebhook } from "./channels/feishu/register-webhook.js";
|
|
13
11
|
import { registerSlackWebhook } from "./channels/slack/register-webhook.js";
|
|
14
12
|
import { registerTelegramWebhook } from "./channels/telegram/register-webhook.js";
|
|
13
|
+
import { pointChannelsAt } from "./deploy/channel-ingress.js";
|
|
15
14
|
import { dotEnvPath, loadDotEnv } from "./env.js";
|
|
16
15
|
import { resolveStateRoot } from "./paths.js";
|
|
17
16
|
import { log } from "./log.js";
|
|
@@ -106,23 +105,23 @@ function lastErrorLine(tail) {
|
|
|
106
105
|
.filter(Boolean);
|
|
107
106
|
return ([...lines].reverse().find((l) => /err|error|failed/i.test(l)) ?? lines.at(-1) ?? "").slice(0, 200);
|
|
108
107
|
}
|
|
109
|
-
/** Channel basenames present in `<dir>/channels/`. */
|
|
110
|
-
function channelBasenames(dir) {
|
|
111
|
-
try {
|
|
112
|
-
return readdirSync(join(dir, "channels"))
|
|
113
|
-
.filter((n) => /\.(ts|js|mjs)$/.test(n) && !n.endsWith(".d.ts"))
|
|
114
|
-
.map((n) => n.replace(/\.(ts|js|mjs)$/, ""));
|
|
115
|
-
}
|
|
116
|
-
catch {
|
|
117
|
-
return [];
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
108
|
/**
|
|
121
109
|
* Print the public URL and wire up first-party webhook channels found under `dir` (the agent
|
|
122
110
|
* ROOT): Telegram and Feishu/Lark use runtime credentials; onboarded Slack uses its owner-local config
|
|
123
111
|
* token; GitHub and a manually scaffolded Slack app receive explicit console URLs.
|
|
112
|
+
*
|
|
113
|
+
* Returns what each registrar ANSWERED, because two kinds of caller need different things from a
|
|
114
|
+
* failure. `dev`/`start` are long-running: a webhook that did not register is a logged problem, not
|
|
115
|
+
* a reason to stop serving, and they void this. `deploy … --run` is a command that exits, and an
|
|
116
|
+
* exit 0 there tells its caller the deployment is reachable — so it feeds these through
|
|
117
|
+
* `registrationGate`, exactly as the fly/railway/agentcore runners feed their own registrar calls
|
|
118
|
+
* (docker used to be the one host that could not, because this returned nothing).
|
|
124
119
|
*/
|
|
125
|
-
export async function announceWebhooks(dir, baseUrl,
|
|
120
|
+
export async function announceWebhooks(dir, baseUrl,
|
|
121
|
+
/** Every declared channel with its ingress. Not a pre-filtered list: this used to accept "the route
|
|
122
|
+
* channels" and default to every basename in `channels/`, which pointed a webhook at a
|
|
123
|
+
* long-connection channel whenever a caller forgot to filter. {@link pointChannelsAt} filters. */
|
|
124
|
+
channels, opts = {}) {
|
|
126
125
|
log.info(`[fastagent] public URL: ${baseUrl}`);
|
|
127
126
|
try {
|
|
128
127
|
loadDotEnv(dir); // webhook registrars read channel credentials from .env
|
|
@@ -135,33 +134,26 @@ export async function announceWebhooks(dir, baseUrl, opts = {}) {
|
|
|
135
134
|
// missing-credential guidance. loadDotEnv keeps throwing for the synchronous command callers.
|
|
136
135
|
log.warn(`[fastagent] could not read ${dotEnvPath(dir)}: ${error.message} — continuing without it`);
|
|
137
136
|
}
|
|
138
|
-
//
|
|
139
|
-
//
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
//
|
|
144
|
-
// its origin connects, and the automatic registrars poll /health before configuring the platform (the
|
|
145
|
-
// same wait the deploy runners rely on). GitHub needs no wait — the operator adds that webhook by hand.
|
|
146
|
-
if (routeChannels.includes("telegram"))
|
|
147
|
-
await registerTelegramWebhook(baseUrl);
|
|
148
|
-
if (routeChannels.includes("github")) {
|
|
149
|
-
log.info(`[fastagent] github: add a webhook in your repo (Settings → Webhooks): Payload URL = ${baseUrl}/webhook, content type application/json, secret = GITHUB_WEBHOOK_SECRET`);
|
|
150
|
-
}
|
|
151
|
-
if (routeChannels.includes("slack")) {
|
|
152
|
-
await registerSlackWebhook(baseUrl, {
|
|
153
|
-
stateRoot: opts.stateRoot ?? resolveStateRoot(dir),
|
|
154
|
-
log: (message) => log.info(message),
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
// feishu/lark register programmatically too (application-v7 config PATCH — telegram-setWebhook
|
|
158
|
-
// parity), once per mounted kind (each kind is its own app with its own credentials); the registrar
|
|
159
|
-
// owns its own health wait and degrades to the manual console instruction.
|
|
137
|
+
// Readiness is the registrar's job: a fresh quick tunnel returns Cloudflare 530 for ~20-30s before its
|
|
138
|
+
// origin connects, and the automatic registrars poll /health before configuring the platform (the same
|
|
139
|
+
// wait the deploy runners rely on). GitHub needs no wait — the operator adds that webhook by hand.
|
|
140
|
+
//
|
|
141
|
+
// The registrars differ from the deploy path's in what they carry, not in which channels they answer
|
|
142
|
+
// for: this one narrates to the log and opens the console for a manual Feishu step.
|
|
160
143
|
const feishuOptions = {
|
|
161
144
|
onManualRegistration: ({ consoleUrl }) => opts.openUrl?.(consoleUrl),
|
|
162
145
|
};
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
146
|
+
return pointChannelsAt({
|
|
147
|
+
baseUrl,
|
|
148
|
+
channels,
|
|
149
|
+
log: (message) => log.info(`[fastagent] ${message}`),
|
|
150
|
+
registrars: {
|
|
151
|
+
telegram: (url) => registerTelegramWebhook(url),
|
|
152
|
+
slack: (url) => registerSlackWebhook(url, {
|
|
153
|
+
stateRoot: opts.stateRoot ?? resolveStateRoot(dir),
|
|
154
|
+
log: (message) => log.info(message),
|
|
155
|
+
}),
|
|
156
|
+
feishu: (url, kind) => registerFeishuWebhook(url, kind, feishuOptions),
|
|
157
|
+
},
|
|
158
|
+
});
|
|
167
159
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fastagent-sh/fastagent",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"description": "Vibe first. Then FastAgent: turn a local agent directory into a live service in your app, on GitHub, Telegram, Slack, or behind any channel.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|