talon-agent 3.8.1 → 3.9.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 +1 -1
- package/package.json +1 -2
- package/src/backend/claude-sdk/handler.ts +1 -1
- package/src/backend/codex/handler/message.ts +1 -1
- package/src/backend/kilo/handler/index.ts +1 -2
- package/src/backend/kilo/handler/state.ts +3 -8
- package/src/backend/kilo/index.ts +2 -28
- package/src/backend/openai-agents/handler/message.ts +1 -1
- package/src/backend/openai-agents/session.ts +1 -1
- package/src/backend/opencode/handler/index.ts +1 -2
- package/src/backend/opencode/handler/state.ts +3 -8
- package/src/backend/opencode/index.ts +0 -7
- package/src/backend/shared/delivery.ts +1 -1
- package/src/backend/shared/handle-retry.ts +1 -1
- package/src/backend/shared/index.ts +3 -2
- package/src/backend/shared/turn-interrupt.ts +1 -1
- package/src/cli/index.ts +0 -8
- package/src/core/bus/index.ts +1 -9
- package/src/core/mesh/registry.ts +106 -4
- package/src/core/mesh/service.ts +22 -7
- package/src/core/mesh/transfers.ts +33 -4
- package/src/core/plugin/index.ts +0 -9
- package/src/core/prompt/index.ts +1 -16
- package/src/core/vfs/index.ts +2 -21
- package/src/core/weaver/index.ts +5 -9
- package/src/frontend/discord/actions/messaging.ts +73 -13
- package/src/frontend/discord/actions/shared.ts +21 -3
- package/src/frontend/discord/commands/admin.ts +1 -1
- package/src/frontend/discord/errors.ts +16 -5
- package/src/frontend/discord/formatting.ts +19 -4
- package/src/frontend/native/index.ts +22 -8
- package/src/frontend/native/protocol.ts +6 -0
- package/src/frontend/native/server.ts +171 -12
- package/src/frontend/shared/format.ts +6 -0
- package/src/frontend/telegram/actions/messaging.ts +120 -24
- package/src/frontend/telegram/callbacks/metrics.ts +1 -1
- package/src/frontend/telegram/commands/admin.ts +1 -1
- package/src/frontend/telegram/formatting.ts +64 -19
- package/src/frontend/terminal/commands.ts +46 -8
- package/src/frontend/terminal/input.ts +110 -12
- package/src/frontend/terminal/renderer.ts +2 -0
- package/src/{util → storage}/metrics.ts +1 -1
- package/src/storage/scheduled-store.ts +6 -3
- package/src/util/config.ts +8 -0
- package/src/util/log.ts +1 -0
- package/src/backend/codex/index.ts +0 -33
- package/src/backend/openai-agents/index.ts +0 -48
- package/src/cli/plugin-entries.ts +0 -104
- package/src/core/agent-runtime/index.ts +0 -62
- package/src/core/background/index.ts +0 -21
- package/src/core/engine/index.ts +0 -20
- package/src/core/models/index.ts +0 -17
- package/src/core/soul/index.ts +0 -140
- package/src/core/tools/mcp-server.ts +0 -111
- /package/src/{backend/shared → util}/session-name.ts +0 -0
package/src/core/soul/index.ts
DELETED
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Soul Kernel — public surface.
|
|
3
|
-
*
|
|
4
|
-
* Talon's compiled identity: a content-addressed Merkle DAG of evidence, values,
|
|
5
|
-
* spine, reflexes, and lenses, learned mechanically from behavioral telemetry and
|
|
6
|
-
* projected into the system prompt by selection. The reasoning model reads the
|
|
7
|
-
* soul; it never writes it.
|
|
8
|
-
*
|
|
9
|
-
* Typical lifecycle:
|
|
10
|
-
*
|
|
11
|
-
* const soul = SoulKernel.genesis({ seedValues: [...] });
|
|
12
|
-
* soul.ingest({ kind: "correction", at, text, activeNodes });
|
|
13
|
-
* soul.commit("nightly");
|
|
14
|
-
* const { text } = soul.project({ lens: "dylan" }); // inject `text`
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
export { SoulKernel } from "./kernel.js";
|
|
18
|
-
export type { GenesisOptions } from "./kernel.js";
|
|
19
|
-
export { SoulDag, structuralChildren } from "./dag.js";
|
|
20
|
-
export { projectRuntime, estimateTokens } from "./projector.js";
|
|
21
|
-
export type { Projection, ProjectionOptions } from "./projector.js";
|
|
22
|
-
export { retrieveValues, DEFAULT_RETRIEVAL_WEIGHTS } from "./retrieve.js";
|
|
23
|
-
export type {
|
|
24
|
-
RetrievedValue,
|
|
25
|
-
RetrievalWeights,
|
|
26
|
-
RetrieveOptions,
|
|
27
|
-
} from "./retrieve.js";
|
|
28
|
-
export {
|
|
29
|
-
evaluateReflexes,
|
|
30
|
-
evaluateReflex,
|
|
31
|
-
isBlocked,
|
|
32
|
-
seedReflexes,
|
|
33
|
-
BUILTIN_PREDICATES,
|
|
34
|
-
} from "./reflex.js";
|
|
35
|
-
export type {
|
|
36
|
-
ReflexContext,
|
|
37
|
-
ReflexVerdict,
|
|
38
|
-
ReflexPredicate,
|
|
39
|
-
} from "./reflex.js";
|
|
40
|
-
export {
|
|
41
|
-
reinforce,
|
|
42
|
-
coactivate,
|
|
43
|
-
applyPredictionError,
|
|
44
|
-
effectiveSalience,
|
|
45
|
-
confidence,
|
|
46
|
-
decayFactor,
|
|
47
|
-
} from "./salience.js";
|
|
48
|
-
export { ingest, ingestAll, appendSpine } from "./compiler.js";
|
|
49
|
-
export type { IngestResult } from "./compiler.js";
|
|
50
|
-
export {
|
|
51
|
-
retrievability,
|
|
52
|
-
effectiveStrength,
|
|
53
|
-
reinforceFsrs,
|
|
54
|
-
nextStability,
|
|
55
|
-
initialStability,
|
|
56
|
-
} from "./forgetting.js";
|
|
57
|
-
export {
|
|
58
|
-
critique,
|
|
59
|
-
extractFeatures,
|
|
60
|
-
isFlagged,
|
|
61
|
-
DEFAULT_THRESHOLDS,
|
|
62
|
-
} from "./critic.js";
|
|
63
|
-
export type {
|
|
64
|
-
Critique,
|
|
65
|
-
CritiqueFeatures,
|
|
66
|
-
CritiqueThresholds,
|
|
67
|
-
FailureMode,
|
|
68
|
-
} from "./critic.js";
|
|
69
|
-
export { deriveFailureModes, assessText } from "./emergent-critic.js";
|
|
70
|
-
export type { EmergentFailureMode, FailureRisk } from "./emergent-critic.js";
|
|
71
|
-
export { emojiValence } from "./signals.js";
|
|
72
|
-
export type { Signal } from "./signals.js";
|
|
73
|
-
export { ValenceModel } from "./valence.js";
|
|
74
|
-
export type { ValenceSnapshot } from "./valence.js";
|
|
75
|
-
export { Adwin } from "./drift.js";
|
|
76
|
-
export type { AdwinChange } from "./drift.js";
|
|
77
|
-
export { diffSnapshots, renderDelta, explainDelta } from "./delta.js";
|
|
78
|
-
export type { SoulDelta } from "./delta.js";
|
|
79
|
-
export { ApprovalQueue } from "./governance.js";
|
|
80
|
-
export type {
|
|
81
|
-
Proposal,
|
|
82
|
-
ProposalStatus,
|
|
83
|
-
ApprovalSnapshot,
|
|
84
|
-
} from "./governance.js";
|
|
85
|
-
export {
|
|
86
|
-
CompositionalMemory,
|
|
87
|
-
symbolVector,
|
|
88
|
-
bind,
|
|
89
|
-
bundle,
|
|
90
|
-
permute,
|
|
91
|
-
cleanup,
|
|
92
|
-
hdCosine,
|
|
93
|
-
DEFAULT_HD_DIM,
|
|
94
|
-
} from "./hdc.js";
|
|
95
|
-
export type { Hypervector } from "./hdc.js";
|
|
96
|
-
export {
|
|
97
|
-
HashingEmbedder,
|
|
98
|
-
cosineSimilarity,
|
|
99
|
-
cosineDistance,
|
|
100
|
-
normalize,
|
|
101
|
-
centroid,
|
|
102
|
-
medoidIndex,
|
|
103
|
-
dot,
|
|
104
|
-
norm,
|
|
105
|
-
} from "./embedder.js";
|
|
106
|
-
export type { Embedder } from "./embedder.js";
|
|
107
|
-
export { TalonEmbedder } from "./talon-embedder.js";
|
|
108
|
-
export type { TalonEmbedderOptions } from "./talon-embedder.js";
|
|
109
|
-
export {
|
|
110
|
-
resolveSoulSettings,
|
|
111
|
-
soulEnabled,
|
|
112
|
-
DEFAULT_SOUL_SETTINGS,
|
|
113
|
-
} from "./settings.js";
|
|
114
|
-
export type { SoulSettings } from "./settings.js";
|
|
115
|
-
export { clusterEvidence } from "./cluster.js";
|
|
116
|
-
export type { Embedded, EvidenceCluster } from "./cluster.js";
|
|
117
|
-
export { detectTensions, tensionPairs } from "./lattice.js";
|
|
118
|
-
export type { TensionOptions } from "./lattice.js";
|
|
119
|
-
export { associativeRecall, prime } from "./associative.js";
|
|
120
|
-
export type {
|
|
121
|
-
RecallResult,
|
|
122
|
-
RecallOptions,
|
|
123
|
-
PrimeOptions,
|
|
124
|
-
} from "./associative.js";
|
|
125
|
-
export { pagerank } from "./centrality.js";
|
|
126
|
-
export type { PageRankOptions } from "./centrality.js";
|
|
127
|
-
export { consolidate, liveValues, isSuperseded } from "./consolidate.js";
|
|
128
|
-
export type { ConsolidateOptions, ConsolidateResult } from "./consolidate.js";
|
|
129
|
-
export { reflect } from "./reflect.js";
|
|
130
|
-
export { compileLens, liveLens } from "./lens.js";
|
|
131
|
-
export type { LensOptions } from "./lens.js";
|
|
132
|
-
export type { ReflectOptions, ReflectResult } from "./reflect.js";
|
|
133
|
-
export {
|
|
134
|
-
hashContent,
|
|
135
|
-
hashPayload,
|
|
136
|
-
canonicalize,
|
|
137
|
-
merkleRoot,
|
|
138
|
-
isHash,
|
|
139
|
-
} from "./hash.js";
|
|
140
|
-
export * from "./types.js";
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Unified MCP server — replaces per-backend tools.ts files.
|
|
4
|
-
*
|
|
5
|
-
* Reads TALON_FRONTEND env var to compose the right tool set,
|
|
6
|
-
* then registers them all on a single MCP server over stdio.
|
|
7
|
-
*
|
|
8
|
-
* Environment:
|
|
9
|
-
* TALON_BRIDGE_URL — HTTP bridge URL (default: http://127.0.0.1:19876)
|
|
10
|
-
* TALON_CHAT_ID — Current chat ID
|
|
11
|
-
* TALON_FRONTEND — Frontend type: "telegram" | "teams" | "terminal" | "discord" | "native" (default: "telegram")
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
15
|
-
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
16
|
-
import { composeTools } from "./index.js";
|
|
17
|
-
import { createBridge, textResult } from "./bridge.js";
|
|
18
|
-
import {
|
|
19
|
-
ENV_DISABLED_TOOLS,
|
|
20
|
-
ENV_DISABLED_TOOL_TAGS,
|
|
21
|
-
parseEnvList,
|
|
22
|
-
} from "./mcp-env.js";
|
|
23
|
-
import type { ToolFrontend, ToolTag } from "./types.js";
|
|
24
|
-
|
|
25
|
-
process.on("unhandledRejection", (err) => {
|
|
26
|
-
const detail =
|
|
27
|
-
err instanceof Error ? (err.stack ?? err.message) : String(err);
|
|
28
|
-
const message = `[mcp-server] Unhandled rejection: ${detail}\n`;
|
|
29
|
-
|
|
30
|
-
// Ensure we always exit even if stderr is backpressured
|
|
31
|
-
const forceExit = setTimeout(() => process.exit(1), 1000);
|
|
32
|
-
forceExit.unref();
|
|
33
|
-
|
|
34
|
-
process.stderr.write(message, () => {
|
|
35
|
-
clearTimeout(forceExit);
|
|
36
|
-
process.exit(1);
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
const VALID_FRONTENDS = new Set<ToolFrontend>([
|
|
41
|
-
"telegram",
|
|
42
|
-
"teams",
|
|
43
|
-
"terminal",
|
|
44
|
-
"discord",
|
|
45
|
-
"native",
|
|
46
|
-
]);
|
|
47
|
-
const BRIDGE_URL = process.env.TALON_BRIDGE_URL || "http://127.0.0.1:19876";
|
|
48
|
-
const CHAT_ID = process.env.TALON_CHAT_ID || "";
|
|
49
|
-
const rawFrontend = (process.env.TALON_FRONTEND || "telegram") as ToolFrontend;
|
|
50
|
-
|
|
51
|
-
if (!CHAT_ID) {
|
|
52
|
-
console.warn(
|
|
53
|
-
"TALON_CHAT_ID is not set — bridge calls will fail without a valid chat context.",
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (!VALID_FRONTENDS.has(rawFrontend)) {
|
|
58
|
-
console.error(
|
|
59
|
-
`Invalid TALON_FRONTEND: "${rawFrontend}". Must be one of: ${[...VALID_FRONTENDS].join(", ")}`,
|
|
60
|
-
);
|
|
61
|
-
process.exit(1);
|
|
62
|
-
}
|
|
63
|
-
const FRONTEND = rawFrontend;
|
|
64
|
-
|
|
65
|
-
const bridge = createBridge(BRIDGE_URL, CHAT_ID);
|
|
66
|
-
const serverName = `${FRONTEND}-tools`;
|
|
67
|
-
const server = new McpServer({ name: serverName, version: "3.0.0" });
|
|
68
|
-
|
|
69
|
-
// Compose and register the tool set for the active frontend, minus
|
|
70
|
-
// any config-disabled tools/tags (see `disabledTools` /
|
|
71
|
-
// `disabledToolTags` in talon.json — every registered tool costs
|
|
72
|
-
// context tokens in every session, so unused groups are trimmable).
|
|
73
|
-
// `end_turn` is exempt: tool-only backends need it to close every turn.
|
|
74
|
-
const excludeNames = parseEnvList(process.env[ENV_DISABLED_TOOLS]).filter(
|
|
75
|
-
(name) => name !== "end_turn",
|
|
76
|
-
);
|
|
77
|
-
const excludeTags = parseEnvList(
|
|
78
|
-
process.env[ENV_DISABLED_TOOL_TAGS],
|
|
79
|
-
) as ToolTag[];
|
|
80
|
-
|
|
81
|
-
const tools = composeTools({ frontend: FRONTEND, excludeTags, excludeNames });
|
|
82
|
-
if (excludeTags.length > 0 && !tools.some((t) => t.name === "end_turn")) {
|
|
83
|
-
const endTurn = composeTools({ frontend: FRONTEND }).find(
|
|
84
|
-
(t) => t.name === "end_turn",
|
|
85
|
-
);
|
|
86
|
-
if (endTurn) tools.push(endTurn);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
for (const tool of tools) {
|
|
90
|
-
server.tool(tool.name, tool.description, tool.schema, async (params) =>
|
|
91
|
-
textResult(await tool.execute(params, bridge)),
|
|
92
|
-
);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
async function main() {
|
|
96
|
-
const transport = new StdioServerTransport();
|
|
97
|
-
await server.connect(transport);
|
|
98
|
-
|
|
99
|
-
// Graceful self-termination: when the parent closes our stdin (e.g. the SDK
|
|
100
|
-
// tears down this MCP server during hot-swap), exit cleanly. This is the
|
|
101
|
-
// OS-agnostic replacement for scanning /proc — the parent signals "you're done"
|
|
102
|
-
// by closing the stdio pipe, and we respect it.
|
|
103
|
-
process.stdin.on("end", () => {
|
|
104
|
-
server.close().finally(() => process.exit(0));
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
main().catch((err) => {
|
|
109
|
-
console.error("MCP server error:", err);
|
|
110
|
-
process.exit(1);
|
|
111
|
-
});
|
|
File without changes
|