talon-agent 3.32.1 → 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 +1 -1
- 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
package/package.json
CHANGED
|
@@ -6,14 +6,9 @@
|
|
|
6
6
|
* additions live next to the rest of the chat-handler config).
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
ALLOWED_TOOLS_CORE,
|
|
11
|
-
ALLOWED_TOOLS_BACKGROUND,
|
|
12
|
-
} from "../../core/constants.js";
|
|
9
|
+
import { ALLOWED_TOOLS_CORE } from "../../core/constants.js";
|
|
13
10
|
|
|
14
11
|
// Re-export so existing backend imports keep working
|
|
15
|
-
export { ALLOWED_TOOLS_CORE, ALLOWED_TOOLS_BACKGROUND };
|
|
16
|
-
|
|
17
12
|
/**
|
|
18
13
|
* Whitelist of built-in tools available to the main chat handler.
|
|
19
14
|
*
|
|
@@ -8,14 +8,5 @@
|
|
|
8
8
|
export { initAgent, updateSystemPrompt } from "./state.js";
|
|
9
9
|
export { warmSession } from "./warm.js";
|
|
10
10
|
export { getActiveQuery } from "./handler.js";
|
|
11
|
-
export {
|
|
12
|
-
|
|
13
|
-
buildPluginMcpServers,
|
|
14
|
-
getActiveFrontends,
|
|
15
|
-
} from "./options.js";
|
|
16
|
-
export { getBridgePort } from "./state.js";
|
|
17
|
-
export {
|
|
18
|
-
runOneShotAgent,
|
|
19
|
-
evictOrphanSubprocesses,
|
|
20
|
-
initClaudeOneShot,
|
|
21
|
-
} from "./one-shot.js";
|
|
11
|
+
export { buildMcpServers, buildPluginMcpServers } from "./options.js";
|
|
12
|
+
export { runOneShotAgent, evictOrphanSubprocesses } from "./one-shot.js";
|
|
@@ -167,7 +167,7 @@ export function describeSdkModel(model: SdkModelInfo): ParsedModelIdentity {
|
|
|
167
167
|
};
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
-
|
|
170
|
+
function buildFamilyKey(identity: ParsedModelIdentity): string | null {
|
|
171
171
|
return identity.family
|
|
172
172
|
? `${identity.family}:${identity.version ?? "*"}`
|
|
173
173
|
: null;
|
|
@@ -178,7 +178,7 @@ export function buildFamilyKey(identity: ParsedModelIdentity): string | null {
|
|
|
178
178
|
* context size. Base and 1M variants of one family+version land in separate
|
|
179
179
|
* buckets so both surface in the picker, while redundant longhand ids collapse.
|
|
180
180
|
*/
|
|
181
|
-
|
|
181
|
+
function buildVariantKey(identity: ParsedModelIdentity): string | null {
|
|
182
182
|
const familyKey = buildFamilyKey(identity);
|
|
183
183
|
if (!familyKey) return null;
|
|
184
184
|
return `${familyKey}:${identity.isOneMillion ? "1m" : "base"}`;
|
|
@@ -163,8 +163,3 @@ export async function getPlanUsage(): Promise<PlanUsage | undefined> {
|
|
|
163
163
|
export function invalidatePlanUsage(): void {
|
|
164
164
|
if (cache) cache.fetchedAt = 0;
|
|
165
165
|
}
|
|
166
|
-
|
|
167
|
-
export function resetPlanUsageForTest(): void {
|
|
168
|
-
cache = undefined;
|
|
169
|
-
inFlight = undefined;
|
|
170
|
-
}
|
|
@@ -214,7 +214,7 @@ export function processStreamDelta(
|
|
|
214
214
|
}
|
|
215
215
|
|
|
216
216
|
/** A tool call extracted from an assistant message. */
|
|
217
|
-
|
|
217
|
+
type ToolCall = {
|
|
218
218
|
/** The SDK's tool_use block id — matches the later tool_result. */
|
|
219
219
|
id: string;
|
|
220
220
|
name: string;
|
|
@@ -45,7 +45,7 @@ import { existsSync, readFileSync } from "node:fs";
|
|
|
45
45
|
import { join } from "node:path";
|
|
46
46
|
|
|
47
47
|
/** Detected auth mode. */
|
|
48
|
-
|
|
48
|
+
type CodexAuthMode = "api-key" | "chatgpt" | "none";
|
|
49
49
|
|
|
50
50
|
export type CodexApiKeySource =
|
|
51
51
|
| "env:CODEX_API_KEY"
|
|
@@ -80,7 +80,7 @@ export interface DetectCodexAuthInput {
|
|
|
80
80
|
env?: NodeJS.ProcessEnv;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
function normalizeCodexBaseUrl(
|
|
84
84
|
baseUrl: string | undefined,
|
|
85
85
|
): string | undefined {
|
|
86
86
|
const trimmed = baseUrl?.trim();
|
|
@@ -46,27 +46,6 @@ export const CODEX_DEFAULT_MODEL = "gpt-5-codex";
|
|
|
46
46
|
*/
|
|
47
47
|
export const CODEX_CHATGPT_DEFAULT_MODEL = "gpt-5.5";
|
|
48
48
|
|
|
49
|
-
/**
|
|
50
|
-
* Set of Codex models that require an API key (i.e. won't work under
|
|
51
|
-
* ChatGPT OAuth). Used by the handler's recovery ladder to detect a
|
|
52
|
-
* model-not-supported error and automatically fall back to a
|
|
53
|
-
* chatgpt-compatible model on retry.
|
|
54
|
-
*
|
|
55
|
-
* Keep this list in sync with `CODEX_MODELS` in `models.ts` — every
|
|
56
|
-
* entry there with `apiKeyOnly: true` should appear here.
|
|
57
|
-
*/
|
|
58
|
-
export const CODEX_API_KEY_ONLY_MODELS: ReadonlySet<string> = new Set([
|
|
59
|
-
"gpt-5-codex",
|
|
60
|
-
]);
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Default working directory for thread runs. Codex enforces a git-repo
|
|
64
|
-
* check by default; we set `skipGitRepoCheck: true` and use a known
|
|
65
|
-
* directory under the user's Talon workspace.
|
|
66
|
-
*/
|
|
67
|
-
export const CODEX_DEFAULT_WORKING_DIRECTORY =
|
|
68
|
-
process.env.HOME ?? process.cwd();
|
|
69
|
-
|
|
70
49
|
/**
|
|
71
50
|
* ThreadOptions permission settings shared by both the chat handler and
|
|
72
51
|
* the heartbeat/dream one-shot path.
|
|
@@ -49,7 +49,7 @@ import { frontendsForChat } from "../shared/frontends.js";
|
|
|
49
49
|
* short-circuits to `true` for this server. Equivalent
|
|
50
50
|
* to saying "Talon trusts this server, don't ask."
|
|
51
51
|
*/
|
|
52
|
-
|
|
52
|
+
type CodexToolApprovalMode = "auto" | "prompt" | "approve";
|
|
53
53
|
|
|
54
54
|
/** TOML-compatible record shape Codex's CLI accepts (HTTP transport). */
|
|
55
55
|
export interface CodexMcpServer {
|
|
@@ -100,7 +100,7 @@ export function asCodexConfig(
|
|
|
100
100
|
* reasoning. Exposed as a module-level constant rather than a
|
|
101
101
|
* literal-everywhere so behaviour changes happen in exactly one place.
|
|
102
102
|
*/
|
|
103
|
-
|
|
103
|
+
const TALON_MCP_DEFAULT_APPROVAL: CodexToolApprovalMode = "approve";
|
|
104
104
|
|
|
105
105
|
/**
|
|
106
106
|
* Build the Codex `mcp_servers` config map for a given chat.
|
|
@@ -161,8 +161,3 @@ export async function getPlanUsage(): Promise<PlanUsage | undefined> {
|
|
|
161
161
|
if (loaded) cache = { value: loaded, fetchedAt: loaded.fetchedAt };
|
|
162
162
|
return loaded ?? cache?.value;
|
|
163
163
|
}
|
|
164
|
-
|
|
165
|
-
export function resetCodexPlanUsageForTest(): void {
|
|
166
|
-
cache = undefined;
|
|
167
|
-
inFlight = undefined;
|
|
168
|
-
}
|
|
@@ -20,7 +20,7 @@ import type { FrontendName } from "../../core/agent-runtime/backend-registry.js"
|
|
|
20
20
|
* window, description); the api-key path (`/v1/models`) is sparse and
|
|
21
21
|
* leaves these fields undefined.
|
|
22
22
|
*/
|
|
23
|
-
|
|
23
|
+
interface DiscoveredModelMetadata {
|
|
24
24
|
displayName?: string;
|
|
25
25
|
contextWindow?: number;
|
|
26
26
|
description?: string;
|
|
@@ -47,7 +47,7 @@ export interface CodexLastTokenUsage {
|
|
|
47
47
|
* want per-turn usage must snapshot before the turn and diff after
|
|
48
48
|
* (see the terminator-abort fallback in `handler.ts`).
|
|
49
49
|
*/
|
|
50
|
-
|
|
50
|
+
interface CodexTokenTotals {
|
|
51
51
|
inputTokens: number;
|
|
52
52
|
cachedInputTokens: number;
|
|
53
53
|
outputTokens: number;
|
|
@@ -22,10 +22,6 @@
|
|
|
22
22
|
|
|
23
23
|
// ── Models ─────────────────────────────────────────────────────────────────
|
|
24
24
|
export {
|
|
25
|
-
type OpenCodeModelCatalogEntry,
|
|
26
|
-
type OpenCodeModelCatalog,
|
|
27
|
-
type OpenCodeModelResolution,
|
|
28
|
-
type ModelButton,
|
|
29
25
|
getOpenCodeModelSelectionValue,
|
|
30
26
|
resolveOpenCodeModelInput,
|
|
31
27
|
getOpenCodeQuickPickModels,
|
|
@@ -36,8 +32,6 @@ export {
|
|
|
36
32
|
export {
|
|
37
33
|
summarizeKiloAssistantMessages,
|
|
38
34
|
getKiloSessionSnapshot,
|
|
39
|
-
type KiloAssistantInfo,
|
|
40
|
-
type KiloSessionSnapshot,
|
|
41
35
|
} from "./sessions.js";
|
|
42
36
|
|
|
43
37
|
// ── Server / lifecycle ─────────────────────────────────────────────────────
|
|
@@ -27,8 +27,6 @@ import { buildDeliveryContract } from "../shared/delivery-contract.js";
|
|
|
27
27
|
import {
|
|
28
28
|
guessProviderID,
|
|
29
29
|
getBucketPriority,
|
|
30
|
-
normalizeModelLookup,
|
|
31
|
-
parseRemoteModelQuery as parseOpenCodeModelQuery,
|
|
32
30
|
} from "../remote-server/model-catalog/index.js";
|
|
33
31
|
import {
|
|
34
32
|
createRemoteServerState,
|
|
@@ -44,23 +42,19 @@ import {
|
|
|
44
42
|
resolveProviderID as resolveProviderIDShared,
|
|
45
43
|
getRegisteredMcpServerNames as getRegisteredMcpServerNamesShared,
|
|
46
44
|
errMsg as sharedErrMsg,
|
|
47
|
-
TALON_MCP_SERVER_NAME as SHARED_TALON_MCP_SERVER_NAME,
|
|
48
45
|
type RemoteServerState,
|
|
49
46
|
} from "../remote-server/index.js";
|
|
50
47
|
|
|
51
48
|
// ── Constants ───────────────────────────────────────────────────────────────
|
|
52
49
|
|
|
53
50
|
/** Loopback hostname Talon binds the Kilo server on — never exposed externally. */
|
|
54
|
-
|
|
51
|
+
const KILO_HOSTNAME = "127.0.0.1";
|
|
55
52
|
/** Default TCP port for the local Kilo server. Overridable via `KILO_PORT`
|
|
56
53
|
* env var so integration tests can spawn an isolated Kilo server alongside
|
|
57
54
|
* a running production Talon (which holds the default 4097). */
|
|
58
|
-
|
|
55
|
+
const KILO_PORT = Number(process.env.KILO_PORT ?? 4097);
|
|
59
56
|
/** Convenience URL composed from KILO_HOSTNAME + KILO_PORT. */
|
|
60
57
|
export const KILO_BASE_URL = `http://${KILO_HOSTNAME}:${KILO_PORT}`;
|
|
61
|
-
/** Re-export of the chat MCP server name prefix shared across backends. */
|
|
62
|
-
export const TALON_MCP_SERVER_NAME = SHARED_TALON_MCP_SERVER_NAME;
|
|
63
|
-
|
|
64
58
|
/**
|
|
65
59
|
* System-prompt suffix appended to the user-configured system prompt.
|
|
66
60
|
*
|
|
@@ -314,21 +308,7 @@ export function getRegisteredMcpServerNames(): string[] {
|
|
|
314
308
|
return getRegisteredMcpServerNamesShared(state);
|
|
315
309
|
}
|
|
316
310
|
|
|
317
|
-
export function getGatewayPortFn(): () => number {
|
|
318
|
-
return state.gatewayPortFn;
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
export function getFrontendName(): FrontendName {
|
|
322
|
-
return state.frontendName;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
311
|
/** Common error→message helper, re-exported for legacy importers. */
|
|
326
312
|
export const errMsg = sharedErrMsg;
|
|
327
313
|
|
|
328
314
|
// Re-export the model-helper imports for kilo-internal consumers
|
|
329
|
-
export {
|
|
330
|
-
guessProviderID,
|
|
331
|
-
getBucketPriority,
|
|
332
|
-
normalizeModelLookup,
|
|
333
|
-
parseOpenCodeModelQuery,
|
|
334
|
-
};
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
|
|
14
14
|
import type { KiloClient } from "@kilocode/sdk/v2";
|
|
15
15
|
import {
|
|
16
|
-
REMOTE_SESSION_MESSAGE_LIMIT,
|
|
17
16
|
extractPartsSummary as extractPartsSummaryShared,
|
|
18
17
|
extractAssistantUsage as extractAssistantUsageShared,
|
|
19
18
|
summarizeAssistantMessages,
|
|
@@ -29,8 +28,6 @@ import { ensureServer } from "./server.js";
|
|
|
29
28
|
|
|
30
29
|
// ── Constants / type aliases (Kilo-named surface) ──────────────────────────
|
|
31
30
|
|
|
32
|
-
export const KILO_SESSION_MESSAGE_LIMIT = REMOTE_SESSION_MESSAGE_LIMIT;
|
|
33
|
-
|
|
34
31
|
/** Subset of Kilo's `Message.info` used by Talon for usage accounting. */
|
|
35
32
|
export type KiloAssistantInfo = RemoteAssistantInfo;
|
|
36
33
|
|
|
@@ -6,8 +6,3 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
export const activeAborts = new Map<string, AbortController>();
|
|
9
|
-
|
|
10
|
-
/** Get the in-flight abort controller for a chat, if a turn is running. */
|
|
11
|
-
export function getActiveAbort(chatId: string): AbortController | undefined {
|
|
12
|
-
return activeAborts.get(chatId);
|
|
13
|
-
}
|
|
@@ -48,7 +48,7 @@ import type { FrontendName } from "../../core/agent-runtime/backend-registry.js"
|
|
|
48
48
|
import { log, logWarn } from "../../util/log.js";
|
|
49
49
|
import { nonTerminalFrontends } from "../shared/frontends.js";
|
|
50
50
|
import { getState } from "./state.js";
|
|
51
|
-
import { startDiscovery
|
|
51
|
+
import { startDiscovery } from "./discovery.js";
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
54
|
* Initialise the OpenAI Agents backend.
|
|
@@ -180,23 +180,6 @@ export function initOpenAIAgentsAgent(
|
|
|
180
180
|
void startDiscovery(effectiveBaseURL, apiKey);
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
-
/**
|
|
184
|
-
* Trigger a fresh discovery fetch using the resolved endpoint stored
|
|
185
|
-
* on state at init time. Returns the new promise so callers can await
|
|
186
|
-
* if they want; safe to fire-and-forget.
|
|
187
|
-
*
|
|
188
|
-
* Useful when the operator wants to refresh the catalog without
|
|
189
|
-
* restarting Talon — e.g. after an endpoint outage clears or a new
|
|
190
|
-
* model is published.
|
|
191
|
-
*/
|
|
192
|
-
export function triggerDiscoveryRefresh(): Promise<void> {
|
|
193
|
-
const state = getState();
|
|
194
|
-
if (!state.baseURL) {
|
|
195
|
-
return Promise.resolve();
|
|
196
|
-
}
|
|
197
|
-
return refreshDiscovery(state.baseURL, state.apiKey);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
183
|
/**
|
|
201
184
|
* Get the OpenAI API key Talon should use for the Agents SDK.
|
|
202
185
|
*
|
|
@@ -44,7 +44,6 @@ import {
|
|
|
44
44
|
resolveProviderID as resolveProviderIDShared,
|
|
45
45
|
getRegisteredMcpServerNames as getRegisteredMcpServerNamesShared,
|
|
46
46
|
errMsg as sharedErrMsg,
|
|
47
|
-
TALON_MCP_SERVER_NAME as SHARED_TALON_MCP_SERVER_NAME,
|
|
48
47
|
type RemoteServerState,
|
|
49
48
|
} from "../remote-server/index.js";
|
|
50
49
|
|
|
@@ -55,7 +54,6 @@ const OPENCODE_HOSTNAME = "127.0.0.1";
|
|
|
55
54
|
// isolated server alongside a running production Talon (which holds 4096).
|
|
56
55
|
const OPENCODE_PORT = Number(process.env.OPENCODE_PORT ?? 4096);
|
|
57
56
|
const OPENCODE_BASE_URL = `http://${OPENCODE_HOSTNAME}:${OPENCODE_PORT}`;
|
|
58
|
-
const TALON_MCP_SERVER_NAME = SHARED_TALON_MCP_SERVER_NAME;
|
|
59
57
|
// Text-preferred delivery: plain assistant text is the reply; tools
|
|
60
58
|
// only for genuine side effects. Single-sourced from the shared
|
|
61
59
|
// contract templates (prompts/system/contract-text-preferred.md).
|
|
@@ -238,11 +236,4 @@ export function getRegisteredMcpServerNames(): string[] {
|
|
|
238
236
|
|
|
239
237
|
const errMsg = sharedErrMsg;
|
|
240
238
|
|
|
241
|
-
export {
|
|
242
|
-
OPENCODE_HOSTNAME,
|
|
243
|
-
OPENCODE_PORT,
|
|
244
|
-
OPENCODE_BASE_URL,
|
|
245
|
-
TALON_MCP_SERVER_NAME,
|
|
246
|
-
OPENCODE_SYSTEM_PROMPT_SUFFIX,
|
|
247
|
-
errMsg,
|
|
248
|
-
};
|
|
239
|
+
export { OPENCODE_BASE_URL, OPENCODE_SYSTEM_PROMPT_SUFFIX, errMsg };
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
|
|
12
12
|
import type { OpencodeClient } from "@opencode-ai/sdk/v2";
|
|
13
13
|
import {
|
|
14
|
-
REMOTE_SESSION_MESSAGE_LIMIT,
|
|
15
14
|
extractPartsSummary as extractPartsSummaryShared,
|
|
16
15
|
extractAssistantUsage as extractAssistantUsageShared,
|
|
17
16
|
summarizeAssistantMessages,
|
|
@@ -27,8 +26,6 @@ import { ensureServer } from "./server.js";
|
|
|
27
26
|
|
|
28
27
|
// ── Constants / type aliases (OpenCode-named surface) ──────────────────────
|
|
29
28
|
|
|
30
|
-
export const OPENCODE_SESSION_MESSAGE_LIMIT = REMOTE_SESSION_MESSAGE_LIMIT;
|
|
31
|
-
|
|
32
29
|
/** Subset of OpenCode's `Message.info` used by Talon for usage accounting. */
|
|
33
30
|
export type OpenCodeAssistantInfo = RemoteAssistantInfo;
|
|
34
31
|
|
|
@@ -365,7 +365,7 @@ export function maybeFireStreamDelta(
|
|
|
365
365
|
// ── Sync-response parts backfill ───────────────────────────────────────────
|
|
366
366
|
|
|
367
367
|
/** Shape returned by a backend's parts-summary extractor. */
|
|
368
|
-
|
|
368
|
+
interface PartsSummary {
|
|
369
369
|
text: string;
|
|
370
370
|
toolCalls: number;
|
|
371
371
|
syntheticErrorText?: string;
|
|
@@ -30,31 +30,19 @@
|
|
|
30
30
|
* agnostic and live in `core/` and `backend/shared/`.
|
|
31
31
|
*/
|
|
32
32
|
|
|
33
|
-
export type {
|
|
34
|
-
RemoteAgentClient,
|
|
35
|
-
RemoteMcpServerConfig,
|
|
36
|
-
RemotePermissionRule,
|
|
37
|
-
} from "./client.js";
|
|
33
|
+
export type { RemoteAgentClient } from "./client.js";
|
|
38
34
|
|
|
39
35
|
export {
|
|
40
36
|
type RemoteServerState,
|
|
41
|
-
type RemoteServerStateInputs,
|
|
42
37
|
createRemoteServerState,
|
|
43
38
|
errMsg,
|
|
44
39
|
} from "./state.js";
|
|
45
40
|
|
|
46
|
-
export {
|
|
47
|
-
type EnsureRemoteServerInputs,
|
|
48
|
-
ensureRemoteServer,
|
|
49
|
-
stopRemoteServer,
|
|
50
|
-
} from "./lifecycle.js";
|
|
41
|
+
export { ensureRemoteServer, stopRemoteServer } from "./lifecycle.js";
|
|
51
42
|
|
|
52
43
|
export {
|
|
53
44
|
TALON_MCP_SERVER_NAME,
|
|
54
|
-
TALON_PLUGIN_MCP_SERVER_NAME,
|
|
55
45
|
getChatMcpServerName,
|
|
56
|
-
getPluginMcpServerName,
|
|
57
|
-
safeMcpNamePart,
|
|
58
46
|
isTalonToolID,
|
|
59
47
|
ensureChatMcpServer,
|
|
60
48
|
ensurePluginMcpServers,
|
|
@@ -64,17 +52,6 @@ export {
|
|
|
64
52
|
getRegisteredMcpServerNames,
|
|
65
53
|
} from "./mcp.js";
|
|
66
54
|
|
|
67
|
-
export {
|
|
68
|
-
buildPermissionRuleset,
|
|
69
|
-
ensureRemoteSession,
|
|
70
|
-
warmRemoteSession,
|
|
71
|
-
type RemoteWarmDeps,
|
|
72
|
-
} from "./sessions.js";
|
|
73
|
-
|
|
74
|
-
export { type ProviderResolverHooks, resolveProviderID } from "./providers.js";
|
|
55
|
+
export { ensureRemoteSession, warmRemoteSession } from "./sessions.js";
|
|
75
56
|
|
|
76
|
-
export {
|
|
77
|
-
RemoteTurnTimeoutError,
|
|
78
|
-
remoteTurnTimeoutMs,
|
|
79
|
-
awaitRemoteTurn,
|
|
80
|
-
} from "./turn-timeout.js";
|
|
57
|
+
export { resolveProviderID } from "./providers.js";
|
|
@@ -92,10 +92,7 @@ export function safeMcpNamePart(value: string, fallback: string): string {
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
/** Per-chat registration name for a plugin-provided MCP server. */
|
|
95
|
-
|
|
96
|
-
pluginName: string,
|
|
97
|
-
chatId: string,
|
|
98
|
-
): string {
|
|
95
|
+
function getPluginMcpServerName(pluginName: string, chatId: string): string {
|
|
99
96
|
return `${TALON_PLUGIN_MCP_SERVER_NAME}-${safeMcpNamePart(chatId, "chat")}-${safeMcpNamePart(pluginName, "plugin")}`;
|
|
100
97
|
}
|
|
101
98
|
|
|
@@ -164,7 +164,7 @@ function extractReasoningLevels(rawModel: RemoteRawModel) {
|
|
|
164
164
|
]);
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
-
|
|
167
|
+
function buildModelCatalog(
|
|
168
168
|
providersData: RemoteRawProvidersData,
|
|
169
169
|
authMap: Record<string, Array<RemoteAuthMethod>>,
|
|
170
170
|
): RemoteModelCatalog {
|
|
@@ -25,20 +25,13 @@ import type {
|
|
|
25
25
|
|
|
26
26
|
export type {
|
|
27
27
|
ModelButton,
|
|
28
|
-
RemoteAuthMethod,
|
|
29
28
|
RemoteModelCatalog,
|
|
30
29
|
RemoteModelCatalogEntry,
|
|
31
30
|
RemoteModelResolution,
|
|
32
|
-
RemoteProviderCatalogEntry,
|
|
33
|
-
RemoteProviderClient,
|
|
34
|
-
RemoteRawModel,
|
|
35
|
-
RemoteRawProvider,
|
|
36
|
-
RemoteRawProvidersData,
|
|
37
31
|
} from "./types.js";
|
|
38
|
-
export {
|
|
32
|
+
export { sortCatalogModels } from "./catalog.js";
|
|
39
33
|
export {
|
|
40
34
|
getBucketPriority,
|
|
41
|
-
getRemoteModelInfo,
|
|
42
35
|
getRemoteModelSelectionValue,
|
|
43
36
|
guessProviderID,
|
|
44
37
|
normalizeModelLookup,
|
|
@@ -46,14 +39,7 @@ export {
|
|
|
46
39
|
resolveRemoteModelInput,
|
|
47
40
|
} from "./resolve.js";
|
|
48
41
|
export { formatRemoteUnavailableModel } from "./presentation.js";
|
|
49
|
-
export type { RemoteModelPresentation } from "./presentation.js";
|
|
50
42
|
export { createRemoteModelProvider } from "./provider.js";
|
|
51
|
-
export type {
|
|
52
|
-
RemoteModelProvider,
|
|
53
|
-
RemoteModelProviderDeps,
|
|
54
|
-
} from "./provider.js";
|
|
55
|
-
export type { RemoteModelCatalogStore } from "./catalog.js";
|
|
56
|
-
|
|
57
43
|
export interface RemoteModelCatalogModuleOptions {
|
|
58
44
|
/** Human label — "OpenCode" / "Kilo" — used in headers and errors. */
|
|
59
45
|
label: string;
|
|
@@ -68,9 +68,7 @@ export async function subscribeSseStream(
|
|
|
68
68
|
* Pull the iterable `stream` field out of a `global.event()` response.
|
|
69
69
|
* Exported for tests; production code should call `subscribeSseStream`.
|
|
70
70
|
*/
|
|
71
|
-
|
|
72
|
-
result: unknown,
|
|
73
|
-
): AsyncIterable<unknown> | undefined {
|
|
71
|
+
function narrowSseResult(result: unknown): AsyncIterable<unknown> | undefined {
|
|
74
72
|
if (!result || typeof result !== "object") return undefined;
|
|
75
73
|
const stream = (result as { stream?: unknown }).stream;
|
|
76
74
|
if (!stream || typeof stream !== "object") return undefined;
|
|
@@ -4,7 +4,7 @@ import { logWarn } from "../../util/log.js";
|
|
|
4
4
|
|
|
5
5
|
const DEFAULT_REMOTE_TURN_TIMEOUT_MS = 10 * 60_000;
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
function remoteTurnTimeoutMs(): number {
|
|
8
8
|
const configured = Number(process.env.TALON_REMOTE_TURN_TIMEOUT_MS);
|
|
9
9
|
return Number.isFinite(configured) && configured > 0
|
|
10
10
|
? configured
|
|
@@ -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("???");
|