talon-agent 4.3.1 → 4.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/app.ts +1 -1
- package/src/bootstrap.ts +2 -2
- package/src/cli/skill.ts +2 -2
- package/src/core/background/cron-spec.ts +1 -1
- package/src/core/background/cron.ts +1 -1
- package/src/core/background/heartbeat/agent.ts +1 -1
- package/src/core/background/triggers/command.ts +1 -1
- package/src/core/background/triggers/exit.ts +1 -1
- package/src/core/background/triggers/output.ts +1 -1
- package/src/core/background/triggers/resume.ts +1 -1
- package/src/core/background/triggers/spawn.ts +1 -1
- package/src/core/engine/gateway-actions/cron.ts +2 -2
- package/src/core/engine/gateway-actions/goals.ts +2 -2
- package/src/core/engine/gateway-actions/scripts.ts +1 -1
- package/src/core/engine/gateway-actions/skills.ts +1 -1
- package/src/core/engine/gateway-actions/triggers.ts +2 -2
- package/src/core/engine/gateway-actions/{shared.ts → validation.ts} +2 -2
- package/src/core/prompt/assemble.ts +2 -2
- package/src/core/scripts/runner.ts +1 -1
- package/src/core/soul/forgetting.ts +2 -2
- package/src/core/soul/salience.ts +8 -4
- package/src/frontend/discord/actions/{shared.ts → buttons.ts} +3 -56
- package/src/frontend/discord/actions/channels.ts +34 -0
- package/src/frontend/discord/actions/chat-info.ts +1 -1
- package/src/frontend/discord/actions/index.ts +1 -1
- package/src/frontend/discord/actions/media.ts +1 -1
- package/src/frontend/discord/actions/messaging.ts +4 -2
- package/src/frontend/discord/actions/try-action.ts +24 -0
- package/src/frontend/discord/admin.ts +2 -2
- package/src/frontend/discord/callbacks/components/settings.ts +1 -1
- package/src/frontend/discord/callbacks/modals.ts +1 -1
- package/src/frontend/discord/commands/admin.ts +2 -2
- package/src/frontend/discord/commands/info.ts +2 -2
- package/src/frontend/discord/commands/{shared.ts → interaction.ts} +2 -1
- package/src/frontend/discord/commands/router.ts +1 -1
- package/src/frontend/discord/commands/session.ts +2 -2
- package/src/frontend/discord/commands/settings.ts +2 -2
- package/src/frontend/discord/{helpers.ts → render.ts} +2 -1
- package/src/frontend/native/extensions.ts +1 -1
- package/src/frontend/teams/chat-discovery.ts +69 -0
- package/src/frontend/teams/commands.ts +141 -0
- package/src/frontend/teams/index.ts +24 -350
- package/src/frontend/teams/outbound.ts +44 -0
- package/src/frontend/teams/poll.ts +101 -0
- package/src/frontend/teams/runtime.ts +51 -0
- package/src/frontend/teams/turn.ts +97 -0
- package/src/frontend/telegram/actions/messaging.ts +1 -1
- package/src/frontend/telegram/actions/shared.ts +4 -4
- package/src/frontend/telegram/admin.ts +1 -1
- package/src/frontend/telegram/sticker-library.ts +2 -2
- package/src/frontend/whatsapp/actions/account.ts +3 -6
- package/src/frontend/whatsapp/actions/chat-info.ts +2 -1
- package/src/frontend/whatsapp/actions/coerce.ts +30 -0
- package/src/frontend/whatsapp/actions/history.ts +1 -1
- package/src/frontend/whatsapp/actions/media-upload.ts +82 -0
- package/src/frontend/whatsapp/actions/media.ts +3 -8
- package/src/frontend/whatsapp/actions/messaging.ts +2 -7
- package/src/frontend/whatsapp/actions/moderation.ts +2 -1
- package/src/frontend/whatsapp/actions/{shared.ts → send.ts} +4 -124
- package/src/frontend/whatsapp/actions/try-action.ts +24 -0
- package/src/frontend/whatsapp/commands.ts +1 -1
- package/src/frontend/whatsapp/inbound.ts +1 -1
- package/src/frontend/whatsapp/index.ts +1 -1
- package/src/storage/repositories/cron-repo.ts +1 -1
- package/src/storage/repositories/goals-repo.ts +1 -1
- package/src/storage/repositories/scripts-repo.ts +1 -1
- package/src/storage/repositories/triggers-repo.ts +1 -1
- package/src/storage/sql/schema.sql +1 -1
- package/src/storage/sql/statements.generated.ts +2 -2
- package/src/storage/sql/triggers.sql +1 -1
- /package/src/storage/{cron-store.ts → cron.ts} +0 -0
- /package/src/storage/{goal-store.ts → goals.ts} +0 -0
- /package/src/storage/{scheduled-store.ts → scheduled.ts} +0 -0
- /package/src/storage/{script-store.ts → scripts.ts} +0 -0
- /package/src/storage/{skill-store.ts → skills.ts} +0 -0
- /package/src/storage/{sticker-store.ts → stickers.ts} +0 -0
- /package/src/storage/{trigger-store.ts → triggers.ts} +0 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run a WhatsApp action, converting a throw into a structured failure.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { logError } from "../../../util/log.js";
|
|
6
|
+
import type { ActionResult } from "../../../core/types.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Run an action, converting a throw into a structured failure. WhatsApp
|
|
10
|
+
* errors arrive as Boom objects whose message is the useful part; the
|
|
11
|
+
* model gets that text so it can adapt rather than retry blindly.
|
|
12
|
+
*/
|
|
13
|
+
export async function tryAction(
|
|
14
|
+
label: string,
|
|
15
|
+
fn: () => Promise<ActionResult>,
|
|
16
|
+
): Promise<ActionResult> {
|
|
17
|
+
try {
|
|
18
|
+
return await fn();
|
|
19
|
+
} catch (err) {
|
|
20
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
21
|
+
logError("whatsapp", `${label} failed: ${msg}`);
|
|
22
|
+
return { ok: false, error: `${label}: ${msg}` };
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
type ModelCommandDeps,
|
|
43
43
|
type ModelOverview,
|
|
44
44
|
} from "../shared/model-commands.js";
|
|
45
|
-
import { sendText } from "./actions/
|
|
45
|
+
import { sendText } from "./actions/send.js";
|
|
46
46
|
import { identityAllowed, type Identity } from "./identity.js";
|
|
47
47
|
import type { WhatsAppChatInfo } from "./registry.js";
|
|
48
48
|
import type { WhatsAppRuntime } from "./runtime.js";
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
} from "../../util/watchdog.js";
|
|
19
19
|
import { isAddressedToSelf, isGroupAllowed } from "./access.js";
|
|
20
20
|
import { handleWhatsAppCommand } from "./commands.js";
|
|
21
|
-
import { sendText } from "./actions/
|
|
21
|
+
import { sendText } from "./actions/send.js";
|
|
22
22
|
import {
|
|
23
23
|
bareId,
|
|
24
24
|
canonicalId,
|
|
@@ -25,7 +25,7 @@ import type { Gateway } from "../../core/engine/gateway.js";
|
|
|
25
25
|
import { log, logError, logWarn } from "../../util/log.js";
|
|
26
26
|
import { maxMsgIdForChatPrefix } from "../../storage/history.js";
|
|
27
27
|
import { createWhatsAppActionHandler } from "./actions/index.js";
|
|
28
|
-
import { sendText, setWhatsAppBotName } from "./actions/
|
|
28
|
+
import { sendText, setWhatsAppBotName } from "./actions/send.js";
|
|
29
29
|
import { seedMessageStore } from "./message-store.js";
|
|
30
30
|
import {
|
|
31
31
|
maxWhatsAppMsgId,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Cron repository — executes the statements in sql/cron.sql against
|
|
3
3
|
* the `cron_jobs` table; no SQL text lives here. The public store
|
|
4
|
-
* (storage/cron
|
|
4
|
+
* (storage/cron.ts) holds the domain API and validation; this
|
|
5
5
|
* module owns statement execution and the row↔domain mapping.
|
|
6
6
|
*/
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Goals repository — executes the statements in sql/goals.sql against
|
|
3
3
|
* the `goals` table; no SQL text lives here. The public store
|
|
4
|
-
* (storage/
|
|
4
|
+
* (storage/goals.ts) holds the domain API and validation; this
|
|
5
5
|
* module owns statement execution and the row↔domain mapping.
|
|
6
6
|
*/
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Scripts repository — executes the statements in sql/scripts.sql
|
|
3
3
|
* against the `scripts` table; no SQL text lives here. The public
|
|
4
|
-
* store (storage/
|
|
4
|
+
* store (storage/scripts.ts) holds the domain API, validation,
|
|
5
5
|
* and the on-disk script files; this module owns statement execution
|
|
6
6
|
* and the row↔domain mapping.
|
|
7
7
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Triggers repository — executes the statements in sql/triggers.sql
|
|
3
3
|
* against the `triggers` table; no SQL text lives here. The public
|
|
4
|
-
* store (storage/
|
|
4
|
+
* store (storage/triggers.ts) holds the domain API, validation
|
|
5
5
|
* and the on-disk script/log handling; this module owns statement
|
|
6
6
|
* execution and the row↔domain mapping.
|
|
7
7
|
*/
|
|
@@ -140,7 +140,7 @@ CREATE INDEX IF NOT EXISTS idx_goals_chat_status ON goals(chat_id, status, updat
|
|
|
140
140
|
CREATE INDEX IF NOT EXISTS idx_goals_status ON goals(status, updated_at DESC);
|
|
141
141
|
|
|
142
142
|
-- Agent-authored scripts. Metadata rows only: the script body lives on
|
|
143
|
-
-- disk under ~/.talon/workspace/scripts/ (mirroring the
|
|
143
|
+
-- disk under ~/.talon/workspace/scripts/ (mirroring the triggers store
|
|
144
144
|
-- split) so the agent can also Read/Edit a script as a normal workspace
|
|
145
145
|
-- file. Scripts are global capabilities, not chat data — no chat_id
|
|
146
146
|
-- column. `name` is the lookup key; UNIQUE enforces one per name.
|
|
@@ -145,7 +145,7 @@ CREATE INDEX IF NOT EXISTS idx_goals_chat_status ON goals(chat_id, status, updat
|
|
|
145
145
|
CREATE INDEX IF NOT EXISTS idx_goals_status ON goals(status, updated_at DESC);
|
|
146
146
|
|
|
147
147
|
-- Agent-authored scripts. Metadata rows only: the script body lives on
|
|
148
|
-
-- disk under ~/.talon/workspace/scripts/ (mirroring the
|
|
148
|
+
-- disk under ~/.talon/workspace/scripts/ (mirroring the triggers store
|
|
149
149
|
-- split) so the agent can also Read/Edit a script as a normal workspace
|
|
150
150
|
-- file. Scripts are global capabilities, not chat data — no chat_id
|
|
151
151
|
-- column. \`name\` is the lookup key; UNIQUE enforces one per name.
|
|
@@ -561,7 +561,7 @@ FROM triggers ORDER BY created_at`,
|
|
|
561
561
|
SET status = 'terminated',
|
|
562
562
|
pid = NULL,
|
|
563
563
|
ended_at = COALESCE(ended_at, ?),
|
|
564
|
-
-- Literal must match RESTART_KILL_ERROR in storage/
|
|
564
|
+
-- Literal must match RESTART_KILL_ERROR in storage/triggers.ts.
|
|
565
565
|
last_error = COALESCE(last_error, 'Talon restarted while trigger was running')
|
|
566
566
|
WHERE status IN ('running', 'pending') AND persistent = 0
|
|
567
567
|
|
|
@@ -56,7 +56,7 @@ UPDATE triggers
|
|
|
56
56
|
SET status = 'terminated',
|
|
57
57
|
pid = NULL,
|
|
58
58
|
ended_at = COALESCE(ended_at, ?),
|
|
59
|
-
-- Literal must match RESTART_KILL_ERROR in storage/
|
|
59
|
+
-- Literal must match RESTART_KILL_ERROR in storage/triggers.ts.
|
|
60
60
|
last_error = COALESCE(last_error, 'Talon restarted while trigger was running')
|
|
61
61
|
WHERE status IN ('running', 'pending') AND persistent = 0
|
|
62
62
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|