talon-agent 3.32.0 → 3.33.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/package.json +4 -3
- package/src/backend/claude-sdk/constants.ts +1 -6
- package/src/backend/claude-sdk/index.ts +2 -11
- package/src/backend/claude-sdk/models/parsing.ts +2 -2
- package/src/backend/claude-sdk/plan-usage.ts +0 -5
- package/src/backend/claude-sdk/stream.ts +1 -1
- package/src/backend/codex/auth.ts +2 -2
- package/src/backend/codex/constants.ts +0 -21
- package/src/backend/codex/handler/index.ts +0 -1
- package/src/backend/codex/mcp-config.ts +2 -2
- package/src/backend/codex/plan-usage.ts +0 -5
- package/src/backend/codex/state.ts +1 -1
- package/src/backend/codex/token-usage.ts +1 -1
- package/src/backend/kilo/index.ts +0 -6
- package/src/backend/kilo/server.ts +2 -22
- package/src/backend/kilo/sessions.ts +0 -3
- package/src/backend/openai-agents/handler/index.ts +0 -1
- package/src/backend/openai-agents/handler/state.ts +0 -5
- package/src/backend/openai-agents/init.ts +1 -18
- package/src/backend/opencode/index.ts +0 -4
- package/src/backend/opencode/server.ts +1 -10
- package/src/backend/opencode/sessions.ts +0 -3
- package/src/backend/remote-server/client.ts +1 -1
- package/src/backend/remote-server/events.ts +1 -1
- package/src/backend/remote-server/index.ts +4 -27
- package/src/backend/remote-server/mcp.ts +1 -4
- package/src/backend/remote-server/model-catalog/catalog.ts +1 -1
- package/src/backend/remote-server/model-catalog/index.ts +1 -15
- package/src/backend/remote-server/model-catalog/provider.ts +0 -1
- package/src/backend/remote-server/sse-stream.ts +1 -3
- package/src/backend/remote-server/turn-timeout.ts +1 -1
- package/src/backend/shared/index.ts +7 -43
- package/src/cli/logs.ts +1 -1
- package/src/cli/status.ts +1 -1
- package/src/core/agent-runtime/backend-registry.ts +1 -1
- package/src/core/agent-runtime/capabilities.ts +1 -1
- package/src/core/agent-runtime/events.ts +1 -1
- package/src/core/background/heartbeat/agent.ts +1 -1
- package/src/core/background/heartbeat/index.ts +1 -2
- package/src/core/background/isolated-agent.ts +1 -1
- package/src/core/background/triggers/exit.ts +1 -1
- package/src/core/background/triggers/index.ts +1 -1
- package/src/core/bus/events.ts +2 -2
- package/src/core/doctor.ts +1 -1
- package/src/core/engine/backend-controller/index.ts +1 -3
- package/src/core/engine/backend-controller/rebind.ts +2 -2
- package/src/core/engine/dispatcher.ts +1 -15
- package/src/core/engine/gateway-actions/index.ts +0 -3
- package/src/core/engine/gateway-actions/types.ts +1 -1
- package/src/core/frontend-runtime/capabilities.ts +0 -2
- package/src/core/frontend-runtime/index.ts +1 -6
- package/src/core/frontend-runtime/routing.ts +0 -1
- package/src/core/mcp-hub/children.ts +0 -5
- package/src/core/mesh/index.ts +1 -18
- package/src/core/models/active-model.ts +0 -19
- package/src/core/plugin/index.ts +0 -1
- package/src/core/plugin/registry.ts +1 -1
- package/src/core/prompt/templates.ts +0 -5
- package/src/core/scripting/lua-runner.ts +1 -1
- package/src/core/scripts/runner.ts +1 -1
- package/src/core/soul/critic.ts +1 -1
- package/src/core/soul/embedder.ts +2 -2
- package/src/core/soul/governance.ts +1 -1
- package/src/core/soul/hdc.ts +1 -1
- package/src/core/soul/reflex.ts +2 -2
- package/src/core/soul/retrieve.ts +1 -1
- package/src/core/soul/signals.ts +4 -4
- package/src/core/soul/types.ts +1 -1
- package/src/core/tasks/index.ts +0 -4
- package/src/core/tasks/types.ts +1 -1
- package/src/core/tools/index.ts +1 -6
- package/src/core/tools/mcp-env.ts +3 -33
- package/src/core/types.ts +1 -1
- package/src/core/update/self-update.ts +1 -1
- package/src/core/vfs/fusefs.ts +1 -1
- package/src/core/vfs/types.ts +1 -1
- package/src/core/weaver/index.ts +1 -1
- package/src/core/weaver/typing-loop.ts +1 -1
- package/src/frontend/discord/actions/types.ts +1 -1
- package/src/frontend/discord/commands/definitions.ts +1 -1
- package/src/frontend/discord/handlers/access.ts +0 -5
- package/src/frontend/discord/handlers/index.ts +2 -15
- package/src/frontend/discord/handlers/registry.ts +0 -6
- package/src/frontend/native/protocol.ts +1 -4
- package/src/frontend/native/server.ts +1 -1
- package/src/frontend/shared/status-context.ts +1 -1
- package/src/frontend/telegram/actions/types.ts +1 -1
- package/src/frontend/telegram/commands/index.ts +1 -1
- package/src/frontend/telegram/commands/state.ts +1 -1
- package/src/frontend/telegram/handlers/index.ts +0 -1
- package/src/frontend/telegram/helpers/menu.ts +1 -1
- package/src/frontend/terminal/commands.ts +1 -4
- package/src/frontend/terminal/renderer.ts +1 -1
- package/src/frontend/whatsapp/actions/chat-info.ts +0 -3
- package/src/frontend/whatsapp/actions/messaging.ts +1 -7
- package/src/frontend/whatsapp/actions/shared.ts +1 -1
- package/src/frontend/whatsapp/actions/types.ts +1 -1
- package/src/frontend/whatsapp/formatting.ts +1 -1
- package/src/frontend/whatsapp/media-store.ts +1 -1
- package/src/frontend/whatsapp/pins.ts +0 -5
- package/src/native/fusefs.ts +3 -3
- package/src/native/scheduler-core.ts +1 -1
- package/src/native/warden.ts +2 -2
- package/src/plugins/mempalace/provision.ts +1 -5
- package/src/plugins/playwright/provision.ts +1 -1
- package/src/storage/db.ts +1 -1
- package/src/storage/goal-store.ts +1 -5
- package/src/storage/metrics.ts +0 -5
- package/src/storage/repositories/scripts-repo.ts +0 -5
- package/src/storage/scheduled-store.ts +1 -5
- package/src/storage/script-store.ts +5 -13
- package/src/storage/sessions.ts +0 -3
- package/src/storage/skill-store.ts +3 -3
- package/src/util/exec-output.ts +1 -1
- package/src/util/mcp-launcher.ts +3 -0
|
@@ -32,41 +32,26 @@
|
|
|
32
32
|
* (the spawn/env contract they share is `core/tools/mcp-env.ts`).
|
|
33
33
|
*/
|
|
34
34
|
|
|
35
|
-
export {
|
|
36
|
-
normalizeForDedupe,
|
|
37
|
-
isDuplicateOfDelivered,
|
|
38
|
-
captureDeliveredText,
|
|
39
|
-
} from "./delivered-text.js";
|
|
35
|
+
export { captureDeliveredText } from "./delivered-text.js";
|
|
40
36
|
|
|
41
37
|
export {
|
|
42
|
-
FLOW_VIOLATION_REMINDER,
|
|
43
38
|
FLOW_VIOLATION_MAX_RETRIES,
|
|
44
39
|
detectFlowViolation,
|
|
45
|
-
type FlowViolationInputs,
|
|
46
|
-
type FlowViolationResult,
|
|
47
40
|
} from "./flow-violation.js";
|
|
48
41
|
|
|
49
|
-
export { registerTurnInterrupt
|
|
42
|
+
export { registerTurnInterrupt } from "./turn-interrupt.js";
|
|
50
43
|
|
|
51
|
-
export { formatUserPrompt
|
|
44
|
+
export { formatUserPrompt } from "./prompt-format.js";
|
|
52
45
|
|
|
53
46
|
export {
|
|
54
47
|
buildDeliveryContract,
|
|
55
48
|
buildFlowViolationReminder,
|
|
56
49
|
buildFirstTurnReminder,
|
|
57
|
-
deliveryToolsForFrontend,
|
|
58
|
-
registerFrontendDeliveryTools,
|
|
59
|
-
type DeliveryMode,
|
|
60
|
-
type DeliveryToolNames,
|
|
61
50
|
} from "./delivery-contract.js";
|
|
62
51
|
|
|
63
52
|
export { extractSessionName } from "../../util/session-name.js";
|
|
64
53
|
|
|
65
|
-
export {
|
|
66
|
-
cacheHitPercent,
|
|
67
|
-
summarizeUsage,
|
|
68
|
-
type TokenUsageSnapshot,
|
|
69
|
-
} from "./usage.js";
|
|
54
|
+
export { summarizeUsage } from "./usage.js";
|
|
70
55
|
|
|
71
56
|
// Only what is consumed THROUGH the barrel. Everything else in
|
|
72
57
|
// cache-telemetry.ts is imported from the module directly, matching the
|
|
@@ -79,26 +64,15 @@ export {
|
|
|
79
64
|
CACHE_LOOKBACK_BLOCKS,
|
|
80
65
|
} from "./cache-telemetry.js";
|
|
81
66
|
|
|
82
|
-
export {
|
|
83
|
-
prepareSystemPrompt,
|
|
84
|
-
appendBackendSuffix,
|
|
85
|
-
clearSystemPromptSnapshots,
|
|
86
|
-
type PrepareSystemPromptInputs,
|
|
87
|
-
type PreparedSystemPrompt,
|
|
88
|
-
} from "./system-prompt.js";
|
|
67
|
+
export { prepareSystemPrompt, appendBackendSuffix } from "./system-prompt.js";
|
|
89
68
|
|
|
90
|
-
export {
|
|
91
|
-
classifyRetry,
|
|
92
|
-
type RetryDecision,
|
|
93
|
-
type ClassifyRetryInputs,
|
|
94
|
-
} from "./model-retry.js";
|
|
69
|
+
export { classifyRetry } from "./model-retry.js";
|
|
95
70
|
|
|
96
71
|
export {
|
|
97
72
|
createStreamState,
|
|
98
73
|
appendText,
|
|
99
74
|
closeCurrentSegment,
|
|
100
75
|
markProgressDelivered,
|
|
101
|
-
undeliveredResponseText,
|
|
102
76
|
recordToolUse,
|
|
103
77
|
recordTokens,
|
|
104
78
|
pushLiveUsage,
|
|
@@ -110,25 +84,15 @@ export {
|
|
|
110
84
|
routeDelivery,
|
|
111
85
|
buildDeliveryFailureReminder,
|
|
112
86
|
TextBlockDeliveryError,
|
|
113
|
-
type DeliveryRoute,
|
|
114
|
-
type DeliveryDecision,
|
|
115
|
-
type RouteDeliveryInputs,
|
|
116
87
|
} from "./delivery.js";
|
|
117
88
|
|
|
118
89
|
export { sleep } from "./sleep.js";
|
|
119
90
|
|
|
120
|
-
export { nonTerminalFrontends } from "./frontends.js";
|
|
121
|
-
|
|
122
91
|
export {
|
|
123
92
|
recordToolCall,
|
|
124
93
|
recordTurnMetrics,
|
|
125
94
|
recordFailedTurnAccounting,
|
|
126
95
|
recordFlowViolation,
|
|
127
|
-
type TurnMetricInputs,
|
|
128
96
|
} from "./metrics.js";
|
|
129
97
|
|
|
130
|
-
export {
|
|
131
|
-
applyRetryDecision,
|
|
132
|
-
type ApplyRetryDecisionInputs,
|
|
133
|
-
type ApplyRetryDecisionResult,
|
|
134
|
-
} from "./handle-retry.js";
|
|
98
|
+
export { applyRetryDecision } from "./handle-retry.js";
|
package/src/cli/logs.ts
CHANGED
|
@@ -17,7 +17,7 @@ const LEVEL_LABELS: Record<number, string> = {
|
|
|
17
17
|
60: pc.bgRed(pc.white("FTL")),
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
function formatLogLine(line: string): string {
|
|
21
21
|
try {
|
|
22
22
|
const obj = JSON.parse(line);
|
|
23
23
|
const level = LEVEL_LABELS[obj.level as number] ?? pc.dim("???");
|
package/src/cli/status.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { findRunningInstance } from "../core/daemon/discovery.js";
|
|
|
9
9
|
import { printBanner, loadConfig } from "./config.js";
|
|
10
10
|
import { CONFIG_FILE } from "./context.js";
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
function formatUptime(seconds: number): string {
|
|
13
13
|
if (seconds < 60) return `${seconds}s`;
|
|
14
14
|
if (seconds < 3600) return `${Math.floor(seconds / 60)}m ${seconds % 60}s`;
|
|
15
15
|
return `${Math.floor(seconds / 3600)}h ${Math.floor((seconds % 3600) / 60)}m`;
|
|
@@ -58,7 +58,7 @@ export interface BackendInitContext {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
/** Result returned by a backend factory's `init` step. */
|
|
61
|
-
|
|
61
|
+
interface BackendInstance {
|
|
62
62
|
/** The fully-wired `Backend` the dispatcher will route to. */
|
|
63
63
|
backend: Backend;
|
|
64
64
|
/**
|
|
@@ -188,7 +188,7 @@ export interface SessionBackend {
|
|
|
188
188
|
* the live registry. Returns the diff so the dispatcher can log
|
|
189
189
|
* what changed.
|
|
190
190
|
*/
|
|
191
|
-
|
|
191
|
+
interface ToolRefreshResult {
|
|
192
192
|
added: string[];
|
|
193
193
|
removed: string[];
|
|
194
194
|
errors: Record<string, string>;
|
|
@@ -81,7 +81,7 @@ export interface AgentResult {
|
|
|
81
81
|
* `core/errors.ts` already produces — keep the values stable so
|
|
82
82
|
* downstream code can pattern-match deterministically.
|
|
83
83
|
*/
|
|
84
|
-
|
|
84
|
+
type AgentErrorKind =
|
|
85
85
|
| "context_overflow"
|
|
86
86
|
| "rate_limit"
|
|
87
87
|
| "overload"
|
|
@@ -83,7 +83,7 @@ export function buildHeartbeatSystemPrompt(): string {
|
|
|
83
83
|
* the heartbeat is a global agent, so it sees every chat's open goals (with
|
|
84
84
|
* chat ids for routing updates back). Exported for tests.
|
|
85
85
|
*/
|
|
86
|
-
|
|
86
|
+
function renderGoalsBlock(): { text: string; count: number } {
|
|
87
87
|
let text = "(no open goals)";
|
|
88
88
|
let count = 0;
|
|
89
89
|
try {
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
* Re-exports the same public surface the old single-file module exposed.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
export type { HeartbeatState } from "./state.js";
|
|
17
16
|
export {
|
|
18
17
|
initHeartbeat,
|
|
19
18
|
startHeartbeatTimer,
|
|
@@ -22,4 +21,4 @@ export {
|
|
|
22
21
|
forceHeartbeat,
|
|
23
22
|
getHeartbeatStatus,
|
|
24
23
|
} from "./scheduler.js";
|
|
25
|
-
export { buildHeartbeatSystemPrompt
|
|
24
|
+
export { buildHeartbeatSystemPrompt } from "./agent.js";
|
|
@@ -19,7 +19,7 @@ import type { OneShotAgentParams, OneShotUsage } from "../types.js";
|
|
|
19
19
|
import { logWarn, logError } from "../../util/log.js";
|
|
20
20
|
|
|
21
21
|
/** Default bounded grace after an abort before giving up on the backend. */
|
|
22
|
-
|
|
22
|
+
const DEFAULT_ABORT_GRACE_MS = 30 * 1000;
|
|
23
23
|
|
|
24
24
|
export interface IsolatedRunOptions {
|
|
25
25
|
readonly background: BackgroundRunner;
|
|
@@ -79,7 +79,7 @@ export async function shutdownTriggers(): Promise<void> {
|
|
|
79
79
|
await new Promise((r) => setTimeout(r, 250));
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
function killChild(id: string, child: ChildProcess): void {
|
|
83
83
|
try {
|
|
84
84
|
child.kill("SIGTERM");
|
|
85
85
|
} catch {
|
|
@@ -19,7 +19,7 @@ import { commandForLanguage } from "./command.js";
|
|
|
19
19
|
import { handleStdoutLine } from "./output.js";
|
|
20
20
|
import { handleTimeout, finalizeExit } from "./exit.js";
|
|
21
21
|
|
|
22
|
-
export { initTriggers, getRunningCount
|
|
22
|
+
export { initTriggers, getRunningCount } from "./state.js";
|
|
23
23
|
export { commandForLanguage } from "./command.js";
|
|
24
24
|
export { spawnTrigger } from "./spawn.js";
|
|
25
25
|
export { cancelTrigger, shutdownTriggers } from "./exit.js";
|
package/src/core/bus/events.ts
CHANGED
|
@@ -32,7 +32,7 @@ export interface TaskSettledEvent {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
/** A chat turn bound its warp and is about to run on the backend. */
|
|
35
|
-
|
|
35
|
+
interface TurnStartedEvent {
|
|
36
36
|
readonly type: "turn.started";
|
|
37
37
|
readonly chatId: string;
|
|
38
38
|
readonly source: string;
|
|
@@ -41,7 +41,7 @@ export interface TurnStartedEvent {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
/** A chat turn finished successfully (refusals and failures never emit this). */
|
|
44
|
-
|
|
44
|
+
interface TurnCompletedEvent {
|
|
45
45
|
readonly type: "turn.completed";
|
|
46
46
|
readonly chatId: string;
|
|
47
47
|
readonly source: string;
|
package/src/core/doctor.ts
CHANGED
|
@@ -17,7 +17,7 @@ import { execFileSync } from "node:child_process";
|
|
|
17
17
|
import { NATIVE_MODULES } from "../native/registry.js";
|
|
18
18
|
import { dirs } from "../util/paths.js";
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
type DoctorStatus = "ok" | "warn" | "fail" | "info";
|
|
21
21
|
|
|
22
22
|
export interface DoctorCheck {
|
|
23
23
|
label: string;
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
30
|
export * from "./types.js";
|
|
31
|
-
export { roleHolder
|
|
31
|
+
export { roleHolder } from "./holders.js";
|
|
32
32
|
export {
|
|
33
33
|
initBackendPool,
|
|
34
34
|
hasBackendPool,
|
|
@@ -48,8 +48,6 @@ export {
|
|
|
48
48
|
clearBackendChangeListenersForTest,
|
|
49
49
|
} from "./pool.js";
|
|
50
50
|
export {
|
|
51
|
-
rebindHolder,
|
|
52
|
-
releaseHolder,
|
|
53
51
|
rebindRole,
|
|
54
52
|
rebindChat,
|
|
55
53
|
releaseChat,
|
|
@@ -36,7 +36,7 @@ import type { BackendHolder, BackendRole, RebindResult } from "./types.js";
|
|
|
36
36
|
*
|
|
37
37
|
* Use `rebindRole` / `rebindChat` for typed wrappers.
|
|
38
38
|
*/
|
|
39
|
-
|
|
39
|
+
async function rebindHolder(
|
|
40
40
|
holder: BackendHolder,
|
|
41
41
|
newId: string,
|
|
42
42
|
config: TalonConfig,
|
|
@@ -113,7 +113,7 @@ export async function rebindHolder(
|
|
|
113
113
|
* No-op when the holder isn't bound — useful for "clear my override"
|
|
114
114
|
* flows that don't want to care whether the override was ever set.
|
|
115
115
|
*/
|
|
116
|
-
|
|
116
|
+
async function releaseHolder(holder: BackendHolder): Promise<void> {
|
|
117
117
|
const id = bindings.get(holder);
|
|
118
118
|
if (!id) return;
|
|
119
119
|
bindings.delete(holder);
|
|
@@ -11,12 +11,7 @@
|
|
|
11
11
|
import type { ExecuteParams, ExecuteResult } from "../types.js";
|
|
12
12
|
import { log } from "../../util/log.js";
|
|
13
13
|
import { taskTable, type KillOutcome } from "../tasks/index.js";
|
|
14
|
-
import {
|
|
15
|
-
initWeaver,
|
|
16
|
-
type Weaver,
|
|
17
|
-
type WeaverDeps,
|
|
18
|
-
type ThreadSnapshot,
|
|
19
|
-
} from "../weaver/index.js";
|
|
14
|
+
import { initWeaver, type Weaver, type WeaverDeps } from "../weaver/index.js";
|
|
20
15
|
|
|
21
16
|
// ── Dependencies (injected at startup) ──────────────────────────────────────
|
|
22
17
|
|
|
@@ -49,15 +44,6 @@ export function getActiveCount(): number {
|
|
|
49
44
|
return weaver?.getActiveCount() ?? 0;
|
|
50
45
|
}
|
|
51
46
|
|
|
52
|
-
/**
|
|
53
|
-
* A live view of every Thread the Loom holds — model/backend warp, in-flight
|
|
54
|
-
* count, and context state per chat. The hub's observability surface for
|
|
55
|
-
* `/status`, drift detection, and remote frontends. Empty before init.
|
|
56
|
-
*/
|
|
57
|
-
export function snapshot(): ThreadSnapshot[] {
|
|
58
|
-
return weaver?.snapshot() ?? [];
|
|
59
|
-
}
|
|
60
|
-
|
|
61
47
|
/**
|
|
62
48
|
* Stop only this chat's active turn. A later message already waiting in the
|
|
63
49
|
* per-chat FIFO is intentionally left alone and runs after the stop settles.
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import type { ActionResult } from "../../types.js";
|
|
10
10
|
import type { Backend } from "../../agent-runtime/capabilities.js";
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
type SharedActionHandler = (
|
|
13
13
|
body: Record<string, unknown>,
|
|
14
14
|
chatId: number,
|
|
15
15
|
backend?: Backend | null,
|
|
@@ -9,12 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
import "./builtins.js";
|
|
11
11
|
|
|
12
|
-
export type {
|
|
13
|
-
Frontend,
|
|
14
|
-
FrontendCreate,
|
|
15
|
-
FrontendDescriptor,
|
|
16
|
-
FrontendFactory,
|
|
17
|
-
} from "./capabilities.js";
|
|
12
|
+
export type { Frontend } from "./capabilities.js";
|
|
18
13
|
export {
|
|
19
14
|
getFrontendDescriptor,
|
|
20
15
|
hasFrontend,
|
|
@@ -82,11 +82,6 @@ function failureBackoffMs(count: number): number {
|
|
|
82
82
|
);
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
/** Test seam: forget recorded spawn failures. */
|
|
86
|
-
export function resetSpawnFailures(): void {
|
|
87
|
-
spawnFailures.clear();
|
|
88
|
-
}
|
|
89
|
-
|
|
90
85
|
/** Idle TTL for hub children; tunable for tests / tight deployments. */
|
|
91
86
|
function idleTtlMs(): number {
|
|
92
87
|
const raw = Number(process.env.TALON_MCP_HUB_IDLE_MS);
|
package/src/core/mesh/index.ts
CHANGED
|
@@ -7,21 +7,4 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
export { MeshRegistry } from "./registry.js";
|
|
10
|
-
export {
|
|
11
|
-
MeshService,
|
|
12
|
-
getMeshService,
|
|
13
|
-
setMeshService,
|
|
14
|
-
type MeshTransport,
|
|
15
|
-
type MeshServiceOptions,
|
|
16
|
-
type MeshToolResult,
|
|
17
|
-
} from "./service.js";
|
|
18
|
-
export {
|
|
19
|
-
sanitizeCapabilities,
|
|
20
|
-
toDeviceInfo,
|
|
21
|
-
toDeviceLocation,
|
|
22
|
-
type DeviceCommand,
|
|
23
|
-
type DeviceCommandResult,
|
|
24
|
-
type DeviceInfo,
|
|
25
|
-
type DeviceLocation,
|
|
26
|
-
type DevicePlatform,
|
|
27
|
-
} from "./types.js";
|
|
10
|
+
export { MeshService, getMeshService, setMeshService } from "./service.js";
|
|
@@ -307,25 +307,6 @@ export async function getActiveModelForChat(
|
|
|
307
307
|
return model;
|
|
308
308
|
}
|
|
309
309
|
|
|
310
|
-
/**
|
|
311
|
-
* Convenience: same as `resolveActiveModelForChat` but returns just
|
|
312
|
-
* the `ModelRef` (or `null`). Use when the source tag isn't needed.
|
|
313
|
-
*/
|
|
314
|
-
export async function getActiveModelRefForChat(
|
|
315
|
-
chatId: string,
|
|
316
|
-
backend: Backend | null,
|
|
317
|
-
backendId: string | null,
|
|
318
|
-
config: TalonConfig,
|
|
319
|
-
): Promise<ModelRef | null> {
|
|
320
|
-
const { ref } = await resolveActiveModelForChat(
|
|
321
|
-
chatId,
|
|
322
|
-
backend,
|
|
323
|
-
backendId,
|
|
324
|
-
config,
|
|
325
|
-
);
|
|
326
|
-
return ref;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
310
|
// ── ref enrichment ──────────────────────────────────────────────────────────
|
|
330
311
|
|
|
331
312
|
/**
|
package/src/core/plugin/index.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { pathToFileURL } from "node:url";
|
|
|
11
11
|
import { logError, logWarn } from "../../util/log.js";
|
|
12
12
|
import type { LoadedPlugin, PluginMcpEntry } from "./types.js";
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
class PluginRegistry {
|
|
15
15
|
private readonly plugins: LoadedPlugin[] = [];
|
|
16
16
|
private readonly standaloneMcpServers: PluginMcpEntry[] = [];
|
|
17
17
|
|
|
@@ -117,8 +117,3 @@ export function loadSystemTemplate(
|
|
|
117
117
|
}
|
|
118
118
|
return liquid.renderSync(parsed, vars) as string;
|
|
119
119
|
}
|
|
120
|
-
|
|
121
|
-
/** Test seam: drop the parse cache (e.g. after writing fixture templates). */
|
|
122
|
-
export function clearTemplateCache(): void {
|
|
123
|
-
parseCache.clear();
|
|
124
|
-
}
|
|
@@ -70,7 +70,7 @@ const FIRE_PREFIX = "TALON_FIRE:";
|
|
|
70
70
|
* Throws on Lua errors (message shaped `<file>:<line>: <msg>` plus
|
|
71
71
|
* traceback). Restores process.stdout.write before returning.
|
|
72
72
|
*/
|
|
73
|
-
|
|
73
|
+
async function runLuaScript(scriptPath: string): Promise<void> {
|
|
74
74
|
const source = readFileSync(scriptPath, "utf-8");
|
|
75
75
|
|
|
76
76
|
const originalWrite = process.stdout.write;
|
|
@@ -19,7 +19,7 @@ import { commandForLanguage } from "../background/triggers/index.js";
|
|
|
19
19
|
import type { Script } from "../../storage/script-store.js";
|
|
20
20
|
|
|
21
21
|
export const DEFAULT_SCRIPT_TIMEOUT_SECONDS = 60;
|
|
22
|
-
|
|
22
|
+
const MAX_SCRIPT_TIMEOUT_SECONDS = 300;
|
|
23
23
|
|
|
24
24
|
/** Cap on captured stdout/stderr — keeps tool results context-friendly. */
|
|
25
25
|
const OUTPUT_CAP_CHARS = 16_000;
|
package/src/core/soul/critic.ts
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
import { estimateTokens } from "./projector.js";
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
type FailureMode = "wall-of-text" | "sycophancy" | "emoji-overload";
|
|
21
21
|
|
|
22
22
|
export interface CritiqueFeatures {
|
|
23
23
|
readonly tokens: number;
|
|
@@ -23,13 +23,13 @@ export interface Embedder {
|
|
|
23
23
|
|
|
24
24
|
// ── Vector math ──────────────────────────────────────────────────────────────
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
function dot(a: readonly number[], b: readonly number[]): number {
|
|
27
27
|
let s = 0;
|
|
28
28
|
for (let i = 0; i < a.length; i++) s += a[i]! * b[i]!;
|
|
29
29
|
return s;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
function norm(a: readonly number[]): number {
|
|
33
33
|
return Math.sqrt(dot(a, a));
|
|
34
34
|
}
|
|
35
35
|
|
|
@@ -18,7 +18,7 @@ import { randomUUID } from "node:crypto";
|
|
|
18
18
|
import { hashPayload } from "./hash.js";
|
|
19
19
|
import type { NodePayload } from "./types.js";
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
type ProposalStatus = "pending" | "approved" | "rejected";
|
|
22
22
|
|
|
23
23
|
export interface Proposal {
|
|
24
24
|
readonly id: string;
|
package/src/core/soul/hdc.ts
CHANGED
|
@@ -25,7 +25,7 @@ import { createHash } from "node:crypto";
|
|
|
25
25
|
|
|
26
26
|
export type Hypervector = Int8Array;
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
const DEFAULT_HD_DIM = 4096;
|
|
29
29
|
|
|
30
30
|
/** Deterministic ±1 hypervector for a symbol — the same token always maps here. */
|
|
31
31
|
export function symbolVector(token: string, dim = DEFAULT_HD_DIM): Hypervector {
|
package/src/core/soul/reflex.ts
CHANGED
|
@@ -48,7 +48,7 @@ const DELIVERY_ACTIONS = new Set(["end_turn", "send", "react"]);
|
|
|
48
48
|
* Keep them small and total; compound conditions get their own named predicate
|
|
49
49
|
* rather than being expressed in the data.
|
|
50
50
|
*/
|
|
51
|
-
|
|
51
|
+
const BUILTIN_PREDICATES: Readonly<Record<string, ReflexPredicate>> = {
|
|
52
52
|
/** Always-on trigger. */
|
|
53
53
|
always: () => true,
|
|
54
54
|
|
|
@@ -85,7 +85,7 @@ function resolve(
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
/** Evaluate one reflex against a context. */
|
|
88
|
-
|
|
88
|
+
function evaluateReflex(
|
|
89
89
|
reflex: ReflexPayload,
|
|
90
90
|
ctx: ReflexContext,
|
|
91
91
|
overrides?: Readonly<Record<string, ReflexPredicate>>,
|
package/src/core/soul/signals.ts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
import type { Hash } from "./types.js";
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
interface ReactionSignal {
|
|
18
18
|
readonly kind: "reaction";
|
|
19
19
|
readonly at: number;
|
|
20
20
|
readonly emoji: string;
|
|
@@ -22,7 +22,7 @@ export interface ReactionSignal {
|
|
|
22
22
|
readonly activeNodes: readonly Hash[];
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
interface EngagementSignal {
|
|
26
26
|
readonly kind: "engagement";
|
|
27
27
|
readonly at: number;
|
|
28
28
|
/** Did the conversation continue after Talon's message, or die? */
|
|
@@ -56,14 +56,14 @@ export interface DirectiveSignal {
|
|
|
56
56
|
readonly ref?: string;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
interface ReflexFireSignal {
|
|
60
60
|
readonly kind: "reflex-fire";
|
|
61
61
|
readonly at: number;
|
|
62
62
|
readonly name: string;
|
|
63
63
|
readonly severity: "block" | "warn" | "advise";
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
interface ActivationSignal {
|
|
67
67
|
readonly kind: "activation";
|
|
68
68
|
readonly at: number;
|
|
69
69
|
readonly activeNodes: readonly Hash[];
|
package/src/core/soul/types.ts
CHANGED
|
@@ -45,7 +45,7 @@ export type NodeKind =
|
|
|
45
45
|
* Where a piece of ground truth came from. Provenance is content, not metadata:
|
|
46
46
|
* an evidence node's identity includes *who said it, when, and where*.
|
|
47
47
|
*/
|
|
48
|
-
|
|
48
|
+
interface EvidenceSource {
|
|
49
49
|
/** Origin channel: a chat correction, a logged event, a diary line, etc. */
|
|
50
50
|
readonly origin:
|
|
51
51
|
| "correction" // someone (usually Dylan) corrected behavior
|
package/src/core/tasks/index.ts
CHANGED
package/src/core/tasks/types.ts
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
/** Which unit of agent work a task represents. */
|
|
16
|
-
|
|
16
|
+
type TaskKind = "turn" | "heartbeat" | "dream" | "cron" | "trigger";
|
|
17
17
|
|
|
18
18
|
/** Task lifecycle. `done`, `failed`, and `killed` are terminal. */
|
|
19
19
|
export type TaskState = "queued" | "running" | "done" | "failed" | "killed";
|
package/src/core/tools/index.ts
CHANGED
|
@@ -241,9 +241,4 @@ export function composeTools(options: ComposeOptions = {}): ToolDefinition[] {
|
|
|
241
241
|
}
|
|
242
242
|
|
|
243
243
|
// Re-export types for convenience
|
|
244
|
-
export type {
|
|
245
|
-
ToolDefinition,
|
|
246
|
-
ToolFrontend,
|
|
247
|
-
ToolTag,
|
|
248
|
-
BridgeFunction,
|
|
249
|
-
} from "./types.js";
|
|
244
|
+
export type { ToolDefinition } from "./types.js";
|