@cortex-agent/server 2026.9.14 → 2026.9.15
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/defaults/plugins/cortex-commission/.claude-plugin/plugin.json +2 -2
- package/defaults/plugins/cortex-commission/plugin.json +2 -2
- package/defaults/plugins/cortex-commission/skills/commission/SKILL.md +3 -3
- package/dist/agent-adapter/claude/adapter.d.ts +0 -6
- package/dist/agent-adapter/claude/adapter.js +0 -8
- package/dist/agent-adapter/claude/defaults.d.ts +10 -7
- package/dist/agent-adapter/claude/defaults.js +18 -16
- package/dist/agent-adapter/claude/spawn-args.d.ts +0 -3
- package/dist/agent-adapter/claude/spawn-args.js +16 -16
- package/dist/agent-adapter/pi/mcp-bridge-logic.d.ts +11 -2
- package/dist/agent-adapter/pi/mcp-bridge-logic.js +32 -1
- package/dist/agent-adapter/pi/mcp-bridge.js +16 -15
- package/dist/agent-adapter/pi/session-options.d.ts +0 -6
- package/dist/agent-adapter/pi/session-options.js +1 -8
- package/dist/agent-adapter/types.d.ts +0 -1
- package/dist/core/mcp-tool-gate.d.ts +3 -17
- package/dist/core/mcp-tool-gate.js +3 -19
- package/dist/core/settings-spec.d.ts +1 -1
- package/dist/core/settings-spec.js +5 -1
- package/dist/domain/agents/config.d.ts +1 -1
- package/dist/domain/agents/config.js +1 -1
- package/dist/domain/agents/profile-switch.d.ts +1 -1
- package/dist/domain/agents/profile-switch.js +3 -5
- package/dist/domain/agents/subagent/runner.js +0 -1
- package/dist/domain/commissions/commission-draft.d.ts +58 -0
- package/dist/domain/commissions/commission-draft.js +87 -4
- package/dist/domain/commissions/commission-finalize.d.ts +8 -3
- package/dist/domain/commissions/commission-finalize.js +14 -0
- package/dist/domain/mcp/tools/commission-tools.d.ts +12 -1
- package/dist/domain/mcp/tools/commission-tools.js +68 -14
- package/dist/domain/remote/client-manager.js +66 -7
- package/dist/domain/remote/client-ssh-tunnel.d.ts +16 -5
- package/dist/domain/remote/client-ssh-tunnel.js +12 -5
- package/dist/domain/runs/builders.js +0 -1
- package/dist/domain/runs/compact.js +0 -1
- package/dist/domain/runs/engine-spec.d.ts +11 -4
- package/dist/domain/runs/engine-spec.js +7 -4
- package/dist/domain/runs/prompt.js +16 -10
- package/dist/domain/runs/request.d.ts +0 -1
- package/dist/domain/sessions/session-hooks.d.ts +5 -12
- package/dist/domain/sessions/session-hooks.js +6 -13
- package/dist/domain/sessions/session-lifecycle.d.ts +4 -4
- package/dist/domain/sessions/session-lifecycle.js +5 -6
- package/dist/domain/sessions/session-retention.d.ts +1 -3
- package/dist/domain/sessions/session-retention.js +9 -26
- package/dist/domain/sessions/session-use.d.ts +32 -0
- package/dist/domain/sessions/session-use.js +63 -0
- package/dist/domain/sessions/session.js +6 -5
- package/dist/domain/system/server-update-check.js +29 -1
- package/dist/domain/system/update-ui-state.d.ts +32 -0
- package/dist/domain/system/update-ui-state.js +63 -0
- package/dist/domain/threads/runner.js +0 -1
- package/dist/domain/ui-service/app-router.d.ts +30 -0
- package/dist/domain/ui-service/app-router.js +5 -1
- package/dist/domain/ui-service/input-schemas.d.ts +32 -0
- package/dist/domain/ui-service/input-schemas.js +22 -0
- package/dist/domain/ui-service/mutate/sessions.d.ts +13 -1
- package/dist/domain/ui-service/mutate/sessions.js +69 -3
- package/dist/domain/ui-service/mutate/system.d.ts +3 -1
- package/dist/domain/ui-service/mutate/system.js +13 -0
- package/dist/domain/ui-service/query/system.d.ts +2 -1
- package/dist/domain/ui-service/query/system.js +4 -0
- package/dist/domain/ui-service/types.d.ts +44 -3
- package/dist/domain/ui-service/ui-service.js +7 -3
- package/dist/entry/app.js +11 -23
- package/dist/entry/start-ui-http.js +3 -1
- package/dist/events/event-types.d.ts +5 -0
- package/dist/orchestration/agent-runner.d.ts +1 -1
- package/dist/orchestration/agent-runner.js +8 -11
- package/dist/orchestration/conversation-request.d.ts +26 -8
- package/dist/orchestration/conversation-request.js +49 -20
- package/dist/orchestration/edit-retry.js +2 -1
- package/dist/orchestration/interactions/ask-user-resume.js +2 -1
- package/dist/orchestration/interactions/ui-update-prompt.d.ts +8 -0
- package/dist/orchestration/interactions/ui-update-prompt.js +47 -0
- package/dist/orchestration/resume-dispatcher.js +2 -2
- package/dist/orchestration/routing/webhook.js +47 -0
- package/dist/orchestration/session-compact.d.ts +3 -0
- package/dist/orchestration/session-compact.js +3 -2
- package/dist/orchestration/session-events.d.ts +6 -0
- package/dist/orchestration/session-events.js +5 -0
- package/dist/orchestration/turn/turn-prep.js +2 -1
- package/dist/platform/ui-http/app-update.d.ts +11 -0
- package/dist/platform/ui-http/app-update.js +3 -0
- package/dist/store/conversation-ledger-repo.d.ts +10 -19
- package/dist/store/conversation-ledger-repo.js +143 -152
- package/dist/store/session-registry-import.d.ts +34 -0
- package/dist/store/session-registry-import.js +182 -0
- package/dist/store/session-registry-journal.d.ts +107 -0
- package/dist/store/session-registry-journal.js +307 -18
- package/dist/store/session-registry-repo.d.ts +113 -28
- package/dist/store/session-registry-repo.js +287 -104
- package/dist/store/version-migrations.d.ts +16 -0
- package/dist/store/version-migrations.js +34 -0
- package/package.json +1 -1
- package/web/dist/assets/{index-aHbOZSP6.js → index-CEZ0DSei.js} +1 -1
- package/web/dist/assets/{index-CCPxQ94C.css → index-CRDJo39X.css} +1 -1
- package/web/dist/assets/index-DjuPJVZE.js +444 -0
- package/web/dist/index.html +2 -2
- package/dist/store/session-repo.d.ts +0 -65
- package/dist/store/session-repo.js +0 -184
- package/web/dist/assets/index-BuXbCsuz.js +0 -444
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cortex-commission",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Commission mode skill bundle — how to work inside a contract-anchored long task: ledger entries, surprise triage, checkpoint discipline. Loaded
|
|
3
|
+
"version": "0.5.0",
|
|
4
|
+
"description": "Commission mode skill bundle — how to work inside a contract-anchored long task: ledger entries, surprise triage, checkpoint discipline. Loaded once a contract has landed and the session is bound to the commission. Creating a commission is not covered here; that protocol lives in the cortex_commission_start tool."
|
|
5
5
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
|
|
3
3
|
"name": "cortex-commission",
|
|
4
|
-
"version": "0.
|
|
5
|
-
"description": "Commission mode skill bundle — how to work inside a contract-anchored long task: ledger entries, surprise triage, checkpoint discipline. Loaded
|
|
4
|
+
"version": "0.5.0",
|
|
5
|
+
"description": "Commission mode skill bundle — how to work inside a contract-anchored long task: ledger entries, surprise triage, checkpoint discipline. Loaded once a contract has landed and the session is bound to the commission. Creating a commission is not covered here; that protocol lives in the cortex_commission_start tool."
|
|
6
6
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: commission
|
|
3
|
-
description: "How to work inside a commission — a contract-anchored long task. Loaded
|
|
3
|
+
description: "How to work inside a commission — a contract-anchored long task. Loaded once the contract lands and this session is bound to the commission; while a contract is still being drafted, the protocol lives in the cortex_commission_start tool instead. Covers maintenance: ledger entries, surprise triage, checkpoint discipline, gates."
|
|
4
4
|
allowed-tools: Read, Write, Edit, Bash, Grep, Glob, mcp__cortex-core__cortex_context, mcp__cortex-core__cortex_ask_user, mcp__cortex-core__send_decision
|
|
5
5
|
metadata:
|
|
6
6
|
author: "Cortex"
|
|
7
|
-
version: "3.
|
|
7
|
+
version: "3.2.0"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# Working inside a commission
|
|
@@ -26,7 +26,7 @@ commissions/<slug>/
|
|
|
26
26
|
|
|
27
27
|
The [Commission] block is only an index — it names contract.md and ledger.md, it does not carry their contents. Read both at the start of the session, and re-read contract.md (including its Revisions section) at every checkpoint; the user may have edited it.
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
You are reading this because a contract already exists. A session still drafting one does not load this skill at all: creation is carried entirely by `cortex_commission_start`, and this skill arrives with the contract.
|
|
30
30
|
|
|
31
31
|
## Surprise triage
|
|
32
32
|
|
|
@@ -12,8 +12,6 @@ interface ClaudeSessionOptions {
|
|
|
12
12
|
needsResume: boolean;
|
|
13
13
|
model?: string | null;
|
|
14
14
|
isUserInitiated?: boolean;
|
|
15
|
-
/** Expose the commission-creation tools; set only while a contract is being drafted. */
|
|
16
|
-
commissionTools?: boolean;
|
|
17
15
|
callbackSource?: string | null;
|
|
18
16
|
scheduleTaskId?: string | null;
|
|
19
17
|
sessionKey?: string | null;
|
|
@@ -67,9 +65,6 @@ export interface ClaudeSpawnCompatibility {
|
|
|
67
65
|
routeIdentity: string;
|
|
68
66
|
composition: McpComposition;
|
|
69
67
|
interactionBridge: boolean;
|
|
70
|
-
/** Adding the commission tools rewrites `--tools`, which a live process cannot be re-pointed
|
|
71
|
-
* at, so a change must force a fresh spawn + `--resume`. */
|
|
72
|
-
commissionTools: boolean;
|
|
73
68
|
tools: string | null;
|
|
74
69
|
pluginCapabilityFingerprint: string | null;
|
|
75
70
|
pluginDirs: string[];
|
|
@@ -101,7 +96,6 @@ declare class ClaudeSession implements TurnHost {
|
|
|
101
96
|
/** Model name requested via --model CLI arg (used as fallback for cost_record). */
|
|
102
97
|
modelName: string | null;
|
|
103
98
|
private isUserInitiated;
|
|
104
|
-
private commissionTools;
|
|
105
99
|
private callbackSource;
|
|
106
100
|
private scheduleTaskId;
|
|
107
101
|
private claudeAgent;
|
|
@@ -72,7 +72,6 @@ export function sameClaudeSpawnCompatibility(left, right) {
|
|
|
72
72
|
&& left.routeIdentity === right.routeIdentity
|
|
73
73
|
&& left.composition === right.composition
|
|
74
74
|
&& left.interactionBridge === right.interactionBridge
|
|
75
|
-
&& left.commissionTools === right.commissionTools
|
|
76
75
|
&& left.tools === right.tools
|
|
77
76
|
&& left.pluginCapabilityFingerprint === right.pluginCapabilityFingerprint
|
|
78
77
|
&& left.supplementalMcpConfigIdentity === right.supplementalMcpConfigIdentity
|
|
@@ -88,7 +87,6 @@ function compatibilityFromOptions(options) {
|
|
|
88
87
|
routeIdentity: claudeRouteIdentity(options),
|
|
89
88
|
composition,
|
|
90
89
|
interactionBridge: composition === 'direct' && options.isUserInitiated === true,
|
|
91
|
-
commissionTools: options.commissionTools === true,
|
|
92
90
|
tools: options.tools ?? null,
|
|
93
91
|
pluginCapabilityFingerprint: options.pluginCapabilityFingerprint ?? null,
|
|
94
92
|
pluginDirs: cloneTextArray(options.pluginDirs),
|
|
@@ -112,7 +110,6 @@ export function claudeCompatibilityIdentity(compatibility) {
|
|
|
112
110
|
['routeIdentity', compatibility.routeIdentity],
|
|
113
111
|
['composition', compatibility.composition],
|
|
114
112
|
['interactionBridge', compatibility.interactionBridge],
|
|
115
|
-
['commissionTools', compatibility.commissionTools],
|
|
116
113
|
['tools', compatibility.tools],
|
|
117
114
|
['pluginCapabilityFingerprint', compatibility.pluginCapabilityFingerprint],
|
|
118
115
|
['supplementalMcpConfigIdentity', compatibility.supplementalMcpConfigIdentity],
|
|
@@ -140,7 +137,6 @@ class ClaudeSession {
|
|
|
140
137
|
/** Model name requested via --model CLI arg (used as fallback for cost_record). */
|
|
141
138
|
modelName;
|
|
142
139
|
isUserInitiated;
|
|
143
|
-
commissionTools;
|
|
144
140
|
callbackSource;
|
|
145
141
|
scheduleTaskId;
|
|
146
142
|
claudeAgent;
|
|
@@ -195,7 +191,6 @@ class ClaudeSession {
|
|
|
195
191
|
this.cwd = resolveSpawnCwd(options.cwd);
|
|
196
192
|
this.turns = new ClaudeTurnMachine(this, createContextUsageTracker(this.modelName, this.cwd, options));
|
|
197
193
|
this.isUserInitiated = options.isUserInitiated || false;
|
|
198
|
-
this.commissionTools = options.commissionTools === true;
|
|
199
194
|
this.callbackSource = options.callbackSource || null;
|
|
200
195
|
this.scheduleTaskId = options.scheduleTaskId || null;
|
|
201
196
|
this.claudeAgent = options.claudeAgent || null;
|
|
@@ -285,7 +280,6 @@ class ClaudeSession {
|
|
|
285
280
|
options.loadFeishuMcp = this.channel.startsWith('feishu:');
|
|
286
281
|
options.loadWebMcp = this.channel.startsWith('web:');
|
|
287
282
|
options.isUserInitiated = this.isUserInitiated;
|
|
288
|
-
options.commissionTools = this.commissionTools;
|
|
289
283
|
const env = buildClaudeEnv(this.channel, this.sessionId, this.callbackSource, this.scheduleTaskId, this.anthropicBaseUrl, this.extraEnv, this.context, this.pinnedEnv, this.unsetEnv);
|
|
290
284
|
env[MCP_BUNDLES_ENV] = encodeMcpBundles(resolveClaudeMcpBundles(options));
|
|
291
285
|
return { args: buildSpawnArgs(options), env };
|
|
@@ -566,7 +560,6 @@ function sessionRuntimeOptions(spec, composition) {
|
|
|
566
560
|
mcpComposition: composition,
|
|
567
561
|
mcpConfigPaths: spec.mcp.configPaths,
|
|
568
562
|
mcpToolAllowlist: spec.mcp.allowlist,
|
|
569
|
-
commissionTools: spec.mcp.commissionTools === true,
|
|
570
563
|
supplementalMcpConfigPath: supplemental?.path ?? null,
|
|
571
564
|
supplementalMcpConfigIdentity: supplemental?.identity ?? null,
|
|
572
565
|
browserMcpConfigPath: browser?.path ?? null,
|
|
@@ -620,7 +613,6 @@ function computeSpawnArgsForSpec(spec) {
|
|
|
620
613
|
streamDeltas: opts.streamDeltas,
|
|
621
614
|
});
|
|
622
615
|
spawnOptions.isUserInitiated = spec.flags.isUserInitiated;
|
|
623
|
-
spawnOptions.commissionTools = spec.mcp.commissionTools === true;
|
|
624
616
|
return buildSpawnArgs(spawnOptions);
|
|
625
617
|
}
|
|
626
618
|
/** D9: `claudeBackend: 'tui'` is accepted but deprecated; warn once per process, then run print. */
|
|
@@ -29,14 +29,17 @@ export declare const DEFAULT_PLAN_DIRS: string[];
|
|
|
29
29
|
* tool (see {@link ALWAYS_STRIP_TOOLS}), so both backends delegate through one implementation. */
|
|
30
30
|
export declare const DEFAULT_TOOLS = "AskUserQuestion,Bash,Edit,EnterPlanMode,ExitPlanMode,Glob,Grep,Read,Skill,TaskStop,TodoWrite,WebFetch,WebSearch,Write";
|
|
31
31
|
/**
|
|
32
|
-
* The cortex-interaction-bridge MCP tools that replace the native EnterPlanMode /
|
|
33
|
-
* AskUserQuestion
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
32
|
+
* The cortex-interaction-bridge MCP tools: the three that replace the native EnterPlanMode /
|
|
33
|
+
* ExitPlanMode / AskUserQuestion, plus the two commission-creation tools. Shared by user-initiated
|
|
34
|
+
* Claude print sessions and user-initiated PI sessions.
|
|
35
|
+
*
|
|
36
|
+
* The commission pair is listed unconditionally (DR-0037 v4). Listing it per session was v3's lever
|
|
37
|
+
* for hiding it, and that lever never existed: `--tools` filters Claude's BUILT-IN set only
|
|
38
|
+
* ("the list of available tools from the built-in set", `claude --help`), so an MCP tool registered
|
|
39
|
+
* by the bundled server was callable from every direct session whatever this list said. What keeps
|
|
40
|
+
* a commission from being bootstrapped out of an ordinary session is a state check in
|
|
41
|
+
* `commission-finalize`, not tool visibility — and a check that holds on both backends.
|
|
37
42
|
*/
|
|
38
|
-
export declare function interactionBridgeTools(commissionTools?: boolean): string[];
|
|
39
|
-
/** Default (non-commission) bridge surface. */
|
|
40
43
|
export declare const INTERACTION_BRIDGE_TOOLS: readonly string[];
|
|
41
44
|
/** Native interaction tools that must be stripped wherever the interaction bridge replaces them —
|
|
42
45
|
* i.e. a direct, user-initiated session, which is the only composition that loads the bridge.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as path from 'path';
|
|
2
2
|
import * as os from 'os';
|
|
3
3
|
import { DATA_DIR, CONFIG_DIR, HOOKS_DIR } from '../../core/utils.js';
|
|
4
|
-
import {
|
|
4
|
+
import { SUBAGENT_TOOLS } from '../../core/mcp-tool-gate.js';
|
|
5
5
|
export const IDLE_SESSION_TIMEOUT = 65 * 60 * 1000;
|
|
6
6
|
export const TURN_IDLE_TIMEOUT = 60 * 60 * 1000;
|
|
7
7
|
/** DR-0012: tmux session name prefix used by the startup migration sweep
|
|
@@ -38,22 +38,24 @@ export const DEFAULT_TOOLS = 'AskUserQuestion,Bash,Edit,EnterPlanMode,ExitPlanMo
|
|
|
38
38
|
* The bundled server is exposed under the `cortex-core` name regardless of which bundles it loads. */
|
|
39
39
|
const MCP_PREFIX = 'mcp__cortex-core__';
|
|
40
40
|
/**
|
|
41
|
-
* The cortex-interaction-bridge MCP tools that replace the native EnterPlanMode /
|
|
42
|
-
* AskUserQuestion
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
41
|
+
* The cortex-interaction-bridge MCP tools: the three that replace the native EnterPlanMode /
|
|
42
|
+
* ExitPlanMode / AskUserQuestion, plus the two commission-creation tools. Shared by user-initiated
|
|
43
|
+
* Claude print sessions and user-initiated PI sessions.
|
|
44
|
+
*
|
|
45
|
+
* The commission pair is listed unconditionally (DR-0037 v4). Listing it per session was v3's lever
|
|
46
|
+
* for hiding it, and that lever never existed: `--tools` filters Claude's BUILT-IN set only
|
|
47
|
+
* ("the list of available tools from the built-in set", `claude --help`), so an MCP tool registered
|
|
48
|
+
* by the bundled server was callable from every direct session whatever this list said. What keeps
|
|
49
|
+
* a commission from being bootstrapped out of an ordinary session is a state check in
|
|
50
|
+
* `commission-finalize`, not tool visibility — and a check that holds on both backends.
|
|
46
51
|
*/
|
|
47
|
-
export
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
/** Default (non-commission) bridge surface. */
|
|
56
|
-
export const INTERACTION_BRIDGE_TOOLS = interactionBridgeTools();
|
|
52
|
+
export const INTERACTION_BRIDGE_TOOLS = [
|
|
53
|
+
`${MCP_PREFIX}cortex_plan_enter`,
|
|
54
|
+
`${MCP_PREFIX}cortex_plan_exit`,
|
|
55
|
+
`${MCP_PREFIX}cortex_ask_user`,
|
|
56
|
+
`${MCP_PREFIX}cortex_commission_start`,
|
|
57
|
+
`${MCP_PREFIX}cortex_commission_submit`,
|
|
58
|
+
];
|
|
57
59
|
/** Native interaction tools that must be stripped wherever the interaction bridge replaces them —
|
|
58
60
|
* i.e. a direct, user-initiated session, which is the only composition that loads the bridge.
|
|
59
61
|
* The native tools drop the prompt into a mode Cortex cannot mediate headlessly. */
|
|
@@ -16,9 +16,6 @@ export interface ClaudeSpawnOptions {
|
|
|
16
16
|
mcpConfigPaths?: string[] | null;
|
|
17
17
|
/** Canonical per-tool MCP allowlist. */
|
|
18
18
|
mcpToolAllowlist?: string[] | null;
|
|
19
|
-
/** Add the two standalone commission-creation tools. Only meaningful when the interaction bridge
|
|
20
|
-
* is on, and set only while a NEW commission is being drafted (DR-0037 v3). */
|
|
21
|
-
commissionTools?: boolean;
|
|
22
19
|
/** Supplemental Claude MCP config written from portable runtime servers. */
|
|
23
20
|
supplementalMcpConfigPath?: string | null;
|
|
24
21
|
/** Omit all configured ambient hooks. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createHash } from 'crypto';
|
|
2
|
-
import { ALWAYS_STRIP_TOOLS, DEFAULT_TOOLS, EMPTY_MCP_CONFIG, MCP_CONFIG, THREAD_MCP_CONFIG,
|
|
2
|
+
import { ALWAYS_STRIP_TOOLS, DEFAULT_TOOLS, EMPTY_MCP_CONFIG, MCP_CONFIG, THREAD_MCP_CONFIG, INTERACTION_BRIDGE_TOOLS, subagentBridgeTools, INTERACTION_STRIP_TOOLS, } from './defaults.js';
|
|
3
3
|
import { getSettings } from '../../core/settings.js';
|
|
4
4
|
import { materializeMcpToolAllowlistConfigs } from '../../core/config-generator.js';
|
|
5
5
|
import { MCP_INFRASTRUCTURE_TIMEOUT_MS } from '../../core/mcp-timeout.js';
|
|
@@ -31,9 +31,9 @@ function resolveMcpConfigs(options, composition) {
|
|
|
31
31
|
}
|
|
32
32
|
appendBrowserMcpConfig(configs, options, composition === 'direct');
|
|
33
33
|
const bundles = resolveClaudeMcpBundles(options);
|
|
34
|
-
//
|
|
35
|
-
//
|
|
36
|
-
//
|
|
34
|
+
// Only an explicitly declared allowlist materializes a gated config (subagents). A direct session
|
|
35
|
+
// declares none and therefore registers its bundles whole — deliberate since DR-0037 v4: no tool
|
|
36
|
+
// in the direct surface is hidden per session, so nothing here has to depend on config *content*.
|
|
37
37
|
const allowlist = options.mcpToolAllowlist ?? undefined;
|
|
38
38
|
return materializeMcpToolAllowlistConfigs(configs, allowlist, undefined, bundles);
|
|
39
39
|
}
|
|
@@ -94,20 +94,23 @@ function subagentTools(options) {
|
|
|
94
94
|
* The exact `--tools` list, after both native-for-MCP substitutions.
|
|
95
95
|
*
|
|
96
96
|
* `Agent` is dropped unconditionally and replaced by the MCP `agent` tool (see
|
|
97
|
-
* {@link ALWAYS_STRIP_TOOLS}). The three interaction tools are dropped only where Cortex
|
|
98
|
-
* approvals through the bridge
|
|
99
|
-
*
|
|
100
|
-
*
|
|
97
|
+
* {@link ALWAYS_STRIP_TOOLS}). The three native interaction tools are dropped only where Cortex
|
|
98
|
+
* mediates approvals through the bridge — `bridge` false (a non-user-initiated or non-direct
|
|
99
|
+
* session) means "keep the natives, add nothing back".
|
|
100
|
+
*
|
|
101
|
+
* Note what this list does NOT do: it cannot hide an MCP tool. `--tools` filters the built-in set
|
|
102
|
+
* only, so naming MCP tools here is a declaration of intent the CLI does not enforce. Anything that
|
|
103
|
+
* must be denied per session is denied at the MCP layer (`CORTEX_MCP_TOOL_ALLOWLIST`) or by the
|
|
104
|
+
* tool's own validation.
|
|
101
105
|
*/
|
|
102
|
-
function resolveEffectiveTools(options,
|
|
103
|
-
const stripInteraction = commissionTools !== null;
|
|
106
|
+
function resolveEffectiveTools(options, bridge) {
|
|
104
107
|
const kept = (options.tools || DEFAULT_TOOLS).split(',')
|
|
105
108
|
.map(tool => tool.trim())
|
|
106
109
|
.filter(tool => tool
|
|
107
110
|
&& !ALWAYS_STRIP_TOOLS.has(tool)
|
|
108
|
-
&& !(
|
|
111
|
+
&& !(bridge && INTERACTION_STRIP_TOOLS.has(tool)));
|
|
109
112
|
const appended = [
|
|
110
|
-
...(
|
|
113
|
+
...(bridge ? INTERACTION_BRIDGE_TOOLS : []),
|
|
111
114
|
...subagentTools(options),
|
|
112
115
|
];
|
|
113
116
|
return [...new Set([...kept, ...appended])].join(',');
|
|
@@ -160,12 +163,9 @@ export function buildSpawnArgs(options) {
|
|
|
160
163
|
const composition = options.mcpComposition ?? 'direct';
|
|
161
164
|
const isDirect = composition === 'direct';
|
|
162
165
|
const wantsInteractionBridge = isDirect && !!options.isUserInitiated;
|
|
163
|
-
const commissionTools = wantsInteractionBridge
|
|
164
|
-
? !!options.commissionTools
|
|
165
|
-
: null;
|
|
166
166
|
const configs = resolveMcpConfigs(options, composition);
|
|
167
167
|
const args = printModeArgs(options);
|
|
168
|
-
const tools = resolveEffectiveTools(options,
|
|
168
|
+
const tools = resolveEffectiveTools(options, wantsInteractionBridge);
|
|
169
169
|
appendCoreArgs(args, configs, composition, tools);
|
|
170
170
|
appendPromptOptions(args, options);
|
|
171
171
|
appendRepeatedOption(args, '--plugin-dir', options.pluginDirs);
|
|
@@ -7,7 +7,16 @@ type PiTextContent = {
|
|
|
7
7
|
type: 'text';
|
|
8
8
|
text: string;
|
|
9
9
|
};
|
|
10
|
-
|
|
10
|
+
type PiImageContent = {
|
|
11
|
+
type: 'image';
|
|
12
|
+
data: string;
|
|
13
|
+
mimeType: string;
|
|
14
|
+
};
|
|
15
|
+
export type PiContent = PiTextContent | PiImageContent;
|
|
16
|
+
/** Map an MCP content item into PI content without silently dropping unsupported payloads.
|
|
17
|
+
* Images pass through as image blocks — PI tool results carry `(TextContent | ImageContent)[]`
|
|
18
|
+
* natively, so `remote_read` and any other image-returning MCP tool stay visible to a vision
|
|
19
|
+
* model. Only what PI cannot send inline degrades to a description. */
|
|
11
20
|
export declare function mapMcpContent(item: {
|
|
12
21
|
type: string;
|
|
13
22
|
text?: string;
|
|
@@ -20,5 +29,5 @@ export declare function mapMcpContent(item: {
|
|
|
20
29
|
mimeType?: string;
|
|
21
30
|
};
|
|
22
31
|
[key: string]: unknown;
|
|
23
|
-
}):
|
|
32
|
+
}): PiContent;
|
|
24
33
|
export {};
|
|
@@ -11,12 +11,40 @@ export function shouldLoadWeb(channel) {
|
|
|
11
11
|
export function shouldLoadThreadControl(threadId) {
|
|
12
12
|
return !!threadId;
|
|
13
13
|
}
|
|
14
|
-
/**
|
|
14
|
+
/** The inline image types every PI provider adapter can encode (`pi-ai` normalizes to exactly
|
|
15
|
+
* these). Anything else reaching a provider is a 400, so an unknown type stays a text note. */
|
|
16
|
+
const PI_IMAGE_MIMES = new Set(['image/png', 'image/jpeg', 'image/gif', 'image/webp']);
|
|
17
|
+
/** The provider-safe form of `mimeType`, or null when PI cannot send it inline. */
|
|
18
|
+
function inlineImageMime(mimeType) {
|
|
19
|
+
if (!mimeType)
|
|
20
|
+
return null;
|
|
21
|
+
const base = mimeType.split(';')[0]?.trim().toLowerCase();
|
|
22
|
+
if (!base)
|
|
23
|
+
return null;
|
|
24
|
+
const normalized = base === 'image/jpg' ? 'image/jpeg' : base;
|
|
25
|
+
return PI_IMAGE_MIMES.has(normalized) ? normalized : null;
|
|
26
|
+
}
|
|
27
|
+
/** An image block PI will carry to the model, or null to fall back to a text description.
|
|
28
|
+
* A model without vision needs no guard here: `pi-ai` downgrades image blocks to a placeholder
|
|
29
|
+
* before the request is built (transform-messages.ts, `downgradeUnsupportedImages`). */
|
|
30
|
+
function inlineImage(data, mimeType) {
|
|
31
|
+
const mime = inlineImageMime(mimeType);
|
|
32
|
+
if (!mime || typeof data !== 'string' || data.length === 0)
|
|
33
|
+
return null;
|
|
34
|
+
return { type: 'image', data, mimeType: mime };
|
|
35
|
+
}
|
|
36
|
+
/** Map an MCP content item into PI content without silently dropping unsupported payloads.
|
|
37
|
+
* Images pass through as image blocks — PI tool results carry `(TextContent | ImageContent)[]`
|
|
38
|
+
* natively, so `remote_read` and any other image-returning MCP tool stay visible to a vision
|
|
39
|
+
* model. Only what PI cannot send inline degrades to a description. */
|
|
15
40
|
export function mapMcpContent(item) {
|
|
16
41
|
if (item.type === 'text' && typeof item.text === 'string') {
|
|
17
42
|
return { type: 'text', text: item.text };
|
|
18
43
|
}
|
|
19
44
|
if (item.type === 'image') {
|
|
45
|
+
const image = inlineImage(item.data, item.mimeType);
|
|
46
|
+
if (image)
|
|
47
|
+
return image;
|
|
20
48
|
const len = typeof item.data === 'string' ? item.data.length : 0;
|
|
21
49
|
return { type: 'text', text: `[Image: mimeType=${item.mimeType ?? 'unknown'}, base64(${len} chars)]` };
|
|
22
50
|
}
|
|
@@ -25,6 +53,9 @@ export function mapMcpContent(item) {
|
|
|
25
53
|
if (typeof resource.text === 'string')
|
|
26
54
|
return { type: 'text', text: resource.text };
|
|
27
55
|
if (typeof resource.blob === 'string') {
|
|
56
|
+
const image = inlineImage(resource.blob, resource.mimeType);
|
|
57
|
+
if (image)
|
|
58
|
+
return image;
|
|
28
59
|
return {
|
|
29
60
|
type: 'text',
|
|
30
61
|
text: `[Binary resource: uri=${resource.uri ?? 'unknown'}, mimeType=${resource.mimeType ?? 'unknown'}]`,
|
|
@@ -6,10 +6,10 @@ import { InMemoryTransport } from '@modelcontextprotocol/sdk/inMemory.js';
|
|
|
6
6
|
import { Type } from '@sinclair/typebox';
|
|
7
7
|
import { createLogger } from '../../core/log.js';
|
|
8
8
|
import { MCP_INFRASTRUCTURE_TIMEOUT_MS } from '../../core/mcp-timeout.js';
|
|
9
|
-
import { MCP_TOOL_ALLOWLIST_ENV, MCP_TOOLS_BY_SERVER, parseMcpToolAllowlist, validateMcpToolAllowlist,
|
|
9
|
+
import { MCP_TOOL_ALLOWLIST_ENV, MCP_TOOLS_BY_SERVER, parseMcpToolAllowlist, validateMcpToolAllowlist, withoutSubagentTools, } from '../../core/mcp-tool-gate.js';
|
|
10
10
|
import { createRedirectRejectingFetch } from '../mcp-remote-fetch.js';
|
|
11
11
|
import { mapMcpContent, shouldLoadFeishu, shouldLoadSlack, shouldLoadThreadControl, shouldLoadWeb, } from './mcp-bridge-logic.js';
|
|
12
|
-
import {
|
|
12
|
+
import { PI_INTERACTION_BRIDGE_ENV, PI_MCP_COMPOSITION_ENV, } from './session-options.js';
|
|
13
13
|
import { safeNativeComposite, safeNativeName } from '../../core/native-name.js';
|
|
14
14
|
const log = createLogger('pi-mcp-bridge');
|
|
15
15
|
const DEFAULT_TRANSPORT_CONSTRUCTORS = {
|
|
@@ -31,23 +31,21 @@ function builtinEnv(env) {
|
|
|
31
31
|
* bundle. This runs here rather than in the adapter because this is the first place that knows PI's
|
|
32
32
|
* bundle set.
|
|
33
33
|
*
|
|
34
|
-
*
|
|
34
|
+
* One exclusion is applied: **delegation tools, always.** `agent` / `agent_stop` exist in
|
|
35
|
+
* `cortex-core` for backends that have no subagent of their own; PI registers its own in-process
|
|
36
|
+
* `agent`, and a bundled MCP tool is exposed under its bare name, so leaving them in would mean two
|
|
37
|
+
* tools called `agent`. The native one wins by construction because the MCP pair never reaches PI.
|
|
35
38
|
*
|
|
36
|
-
* -
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* native one wins by construction because the MCP pair never reaches PI at all.
|
|
39
|
+
* The commission-creation tools used to be excluded here too, which made PI the only backend where
|
|
40
|
+
* that gate actually worked — Claude's equivalent (`--tools`) cannot filter MCP tools at all. Rather
|
|
41
|
+
* than teach Claude the same trick, DR-0037 v4 dropped the gate on both: the two tools are part of
|
|
42
|
+
* the direct surface everywhere, and a submit from a session that never entered the mode is refused
|
|
43
|
+
* by `commission-finalize` instead.
|
|
42
44
|
*/
|
|
43
45
|
function toolGatedEnv(bundles, env) {
|
|
44
46
|
const toolEnv = builtinEnv(env);
|
|
45
|
-
const dropCommission = bundles.includes('cortex-interaction-bridge')
|
|
46
|
-
&& env[PI_COMMISSION_TOOLS_ENV] !== '1';
|
|
47
47
|
const declared = parseMcpToolAllowlist(env[MCP_TOOL_ALLOWLIST_ENV]);
|
|
48
|
-
|
|
49
|
-
if (dropCommission)
|
|
50
|
-
allowlist = withoutCommissionTools(allowlist, bundles);
|
|
48
|
+
const allowlist = withoutSubagentTools(declared ? [...declared] : undefined, bundles);
|
|
51
49
|
toolEnv[MCP_TOOL_ALLOWLIST_ENV] = JSON.stringify(allowlist);
|
|
52
50
|
return toolEnv;
|
|
53
51
|
}
|
|
@@ -368,7 +366,10 @@ class McpBridgeSession {
|
|
|
368
366
|
});
|
|
369
367
|
const content = result.content.map(mapMcpContent);
|
|
370
368
|
if (result.isError) {
|
|
371
|
-
const message = content
|
|
369
|
+
const message = content
|
|
370
|
+
.map(item => (item.type === 'text' ? item.text : ''))
|
|
371
|
+
.filter(Boolean)
|
|
372
|
+
.join('\n');
|
|
372
373
|
throw new Error(message || `${exposedName} failed`);
|
|
373
374
|
}
|
|
374
375
|
return { content, details: undefined };
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import type { CortexContextEnv, EngineSpec, McpComposition, McpServerConfig } from '../types.js';
|
|
2
2
|
export declare const PI_MCP_COMPOSITION_ENV = "CORTEX_PI_MCP_COMPOSITION";
|
|
3
3
|
export declare const PI_INTERACTION_BRIDGE_ENV = "CORTEX_PI_INTERACTION_BRIDGE";
|
|
4
|
-
/** Set while a NEW commission is being drafted. Read by the MCP bridge, which is where PI knows its
|
|
5
|
-
* bundle set and can therefore write the allowlist that hides the commission tools from every other
|
|
6
|
-
* session. */
|
|
7
|
-
export declare const PI_COMMISSION_TOOLS_ENV = "CORTEX_PI_COMMISSION_TOOLS";
|
|
8
4
|
export interface PIEnvOptions {
|
|
9
5
|
sessionId?: string | null;
|
|
10
6
|
channel?: string | null;
|
|
@@ -23,8 +19,6 @@ export interface PIEnvOptions {
|
|
|
23
19
|
mcpToolAllowlist?: string[] | null;
|
|
24
20
|
/** Trusted marker enabling the shared interaction MCP bridge. */
|
|
25
21
|
enableInteractionBridge?: boolean;
|
|
26
|
-
/** Expose the commission-creation tools; ignored when the bridge is off. */
|
|
27
|
-
commissionTools?: boolean;
|
|
28
22
|
/** Explicit marker for the restricted PI subagent surface. */
|
|
29
23
|
subagentMarker?: string | null;
|
|
30
24
|
}
|
|
@@ -4,10 +4,6 @@ import { browserMcpServer } from '../browser-mcp-server.js';
|
|
|
4
4
|
import { MCP_TOOL_ALLOWLIST_ENV } from '../../core/mcp-tool-gate.js';
|
|
5
5
|
export const PI_MCP_COMPOSITION_ENV = 'CORTEX_PI_MCP_COMPOSITION';
|
|
6
6
|
export const PI_INTERACTION_BRIDGE_ENV = 'CORTEX_PI_INTERACTION_BRIDGE';
|
|
7
|
-
/** Set while a NEW commission is being drafted. Read by the MCP bridge, which is where PI knows its
|
|
8
|
-
* bundle set and can therefore write the allowlist that hides the commission tools from every other
|
|
9
|
-
* session. */
|
|
10
|
-
export const PI_COMMISSION_TOOLS_ENV = 'CORTEX_PI_COMMISSION_TOOLS';
|
|
11
7
|
const RESET_CONTEXT_KEYS = [
|
|
12
8
|
'SLACK_CHANNEL', 'FEISHU_CHANNEL',
|
|
13
9
|
'CORTEX_SESSION_ID', 'CORTEX_THREAD_ID', 'CORTEX_PROFILE',
|
|
@@ -20,7 +16,7 @@ const RESET_CONTEXT_KEYS = [
|
|
|
20
16
|
'CORTEX_WEBHOOK_SINGLE_ROOT_TEMPLATE',
|
|
21
17
|
'CORTEX_PRODUCTION_BENCHMARK_EVIDENCE_CONTEXT_FILE',
|
|
22
18
|
'CORTEX_PI_ALLOWED_TOOLS', 'CORTEX_PI_SUBAGENT',
|
|
23
|
-
PI_MCP_COMPOSITION_ENV, PI_INTERACTION_BRIDGE_ENV,
|
|
19
|
+
PI_MCP_COMPOSITION_ENV, PI_INTERACTION_BRIDGE_ENV,
|
|
24
20
|
MCP_TOOL_ALLOWLIST_ENV,
|
|
25
21
|
];
|
|
26
22
|
function setOptional(env, key, value) {
|
|
@@ -67,8 +63,6 @@ export function buildPiEnv(options, inheritedEnv = process.env) {
|
|
|
67
63
|
}
|
|
68
64
|
if (options.enableInteractionBridge === true)
|
|
69
65
|
env[PI_INTERACTION_BRIDGE_ENV] = '1';
|
|
70
|
-
if (options.commissionTools === true)
|
|
71
|
-
env[PI_COMMISSION_TOOLS_ENV] = '1';
|
|
72
66
|
setOptional(env, 'CORTEX_PI_SUBAGENT', options.subagentMarker);
|
|
73
67
|
applyContext(env, options);
|
|
74
68
|
return env;
|
|
@@ -139,7 +133,6 @@ export function buildSessionRequest(spec, inputs) {
|
|
|
139
133
|
enableInteractionBridge: composition === 'direct'
|
|
140
134
|
&& spec.flags.isUserInitiated === true
|
|
141
135
|
&& marker === undefined,
|
|
142
|
-
commissionTools: spec.mcp.commissionTools === true,
|
|
143
136
|
subagentMarker: marker,
|
|
144
137
|
}, spec.env.pinned);
|
|
145
138
|
return {
|
|
@@ -1,29 +1,15 @@
|
|
|
1
1
|
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
2
|
export declare const MCP_TOOL_ALLOWLIST_ENV = "CORTEX_MCP_TOOL_ALLOWLIST";
|
|
3
3
|
export declare const MCP_TOOLS_BY_SERVER: Readonly<Record<string, readonly string[]>>;
|
|
4
|
-
/**
|
|
5
|
-
* The two commission-creation tools. They are standalone — they do NOT replace cortex_plan_enter /
|
|
6
|
-
* cortex_plan_exit, and a session creating a commission holds both sets. They are injected only
|
|
7
|
-
* while a new commission is being drafted, so no other session ever sees them (DR-0037 v3).
|
|
8
|
-
*/
|
|
9
|
-
export declare const COMMISSION_TOOLS: readonly string[];
|
|
10
|
-
/**
|
|
11
|
-
* A per-spawn allowlist with the commission tools removed.
|
|
12
|
-
*
|
|
13
|
-
* Only backends without a per-tool launch flag need this: Claude keeps the tools out of an ordinary
|
|
14
|
-
* session through `--tools`, but PI has no equivalent, so the allowlist is its only lever. The gate
|
|
15
|
-
* is fail-OPEN (see {@link parseMcpToolAllowlist}: absent env ⇒ everything registers), so exclusion
|
|
16
|
-
* can never be expressed by *withholding* an allowlist — when the caller has none of its own we
|
|
17
|
-
* synthesize one from the selected bundles' full surface.
|
|
18
|
-
*/
|
|
19
|
-
export declare function withoutCommissionTools(allowlist: readonly string[] | undefined, selectedBundles: readonly string[]): string[];
|
|
20
4
|
/**
|
|
21
5
|
* The delegation tools. A subagent is a leaf: it never gets these, on either backend, which is what
|
|
22
6
|
* makes the recursion guard structural rather than a depth counter (plan §6.1).
|
|
23
7
|
*/
|
|
24
8
|
export declare const SUBAGENT_TOOLS: readonly string[];
|
|
25
9
|
/** A per-spawn allowlist a subagent child runs under: everything its bundles offer, minus
|
|
26
|
-
* delegation.
|
|
10
|
+
* delegation. The gate is fail-OPEN (see {@link parseMcpToolAllowlist}: absent env ⇒ everything
|
|
11
|
+
* registers), so exclusion can never be expressed by *withholding* an allowlist — when the caller
|
|
12
|
+
* has none of its own we synthesize one from the selected bundles' full surface. */
|
|
27
13
|
export declare function withoutSubagentTools(allowlist: readonly string[] | undefined, selectedBundles: readonly string[]): string[];
|
|
28
14
|
export declare function canonicalizeMcpToolAllowlist(values: readonly string[]): string[];
|
|
29
15
|
export declare function validateMcpToolAllowlist(allowlist: readonly string[], knownTools?: ReadonlySet<string>): void;
|
|
@@ -24,31 +24,15 @@ export const MCP_TOOLS_BY_SERVER = {
|
|
|
24
24
|
'cortex-benchmark-thread': ['thread_run'],
|
|
25
25
|
};
|
|
26
26
|
const ALL_MCP_TOOLS = new Set(Object.values(MCP_TOOLS_BY_SERVER).flat());
|
|
27
|
-
/**
|
|
28
|
-
* The two commission-creation tools. They are standalone — they do NOT replace cortex_plan_enter /
|
|
29
|
-
* cortex_plan_exit, and a session creating a commission holds both sets. They are injected only
|
|
30
|
-
* while a new commission is being drafted, so no other session ever sees them (DR-0037 v3).
|
|
31
|
-
*/
|
|
32
|
-
export const COMMISSION_TOOLS = ['cortex_commission_start', 'cortex_commission_submit'];
|
|
33
|
-
/**
|
|
34
|
-
* A per-spawn allowlist with the commission tools removed.
|
|
35
|
-
*
|
|
36
|
-
* Only backends without a per-tool launch flag need this: Claude keeps the tools out of an ordinary
|
|
37
|
-
* session through `--tools`, but PI has no equivalent, so the allowlist is its only lever. The gate
|
|
38
|
-
* is fail-OPEN (see {@link parseMcpToolAllowlist}: absent env ⇒ everything registers), so exclusion
|
|
39
|
-
* can never be expressed by *withholding* an allowlist — when the caller has none of its own we
|
|
40
|
-
* synthesize one from the selected bundles' full surface.
|
|
41
|
-
*/
|
|
42
|
-
export function withoutCommissionTools(allowlist, selectedBundles) {
|
|
43
|
-
return withoutTools(allowlist, selectedBundles, COMMISSION_TOOLS);
|
|
44
|
-
}
|
|
45
27
|
/**
|
|
46
28
|
* The delegation tools. A subagent is a leaf: it never gets these, on either backend, which is what
|
|
47
29
|
* makes the recursion guard structural rather than a depth counter (plan §6.1).
|
|
48
30
|
*/
|
|
49
31
|
export const SUBAGENT_TOOLS = ['agent', 'agent_stop'];
|
|
50
32
|
/** A per-spawn allowlist a subagent child runs under: everything its bundles offer, minus
|
|
51
|
-
* delegation.
|
|
33
|
+
* delegation. The gate is fail-OPEN (see {@link parseMcpToolAllowlist}: absent env ⇒ everything
|
|
34
|
+
* registers), so exclusion can never be expressed by *withholding* an allowlist — when the caller
|
|
35
|
+
* has none of its own we synthesize one from the selected bundles' full surface. */
|
|
52
36
|
export function withoutSubagentTools(allowlist, selectedBundles) {
|
|
53
37
|
return withoutTools(allowlist, selectedBundles, SUBAGENT_TOOLS);
|
|
54
38
|
}
|
|
@@ -135,7 +135,11 @@ export const SETTINGS_SPEC = {
|
|
|
135
135
|
commissionEnabled: {
|
|
136
136
|
envVar: 'CORTEX_COMMISSION_ENABLED',
|
|
137
137
|
type: 'boolean',
|
|
138
|
-
default:
|
|
138
|
+
// On by default since DR-0037 v4: entering the mode is now a decision the agent (or the user)
|
|
139
|
+
// makes inside an ordinary session, so a switch defaulting to off would hide a capability
|
|
140
|
+
// nobody has to opt into. It stays a switch because it is the kill switch — off refuses every
|
|
141
|
+
// entry point (create, composer, the start webhook) and stops injecting contract blocks.
|
|
142
|
+
default: true,
|
|
139
143
|
legacyParse: (raw) => raw === '1',
|
|
140
144
|
},
|
|
141
145
|
managerRotateSteps: {
|
|
@@ -23,7 +23,7 @@ export declare function getActiveProfile(channel?: string): string | null;
|
|
|
23
23
|
* The backend a channel runs: its profile's, falling back to the default profile's.
|
|
24
24
|
*
|
|
25
25
|
* DEVIATION from plan D5, which has this "degenerate into reading the session record". That was
|
|
26
|
-
* the right move while
|
|
26
|
+
* the right move while the session store keyed on `backend:channel` and the caller had to know the
|
|
27
27
|
* backend to find the session at all — but the backend is no longer part of the key, so no session
|
|
28
28
|
* lookup needs this any more. What is left are callers asking which backend a channel runs
|
|
29
29
|
* (conversation ledger, rollback, compaction support), and for them the profile is the source of
|
|
@@ -246,7 +246,7 @@ export function getActiveProfile(channel) {
|
|
|
246
246
|
* The backend a channel runs: its profile's, falling back to the default profile's.
|
|
247
247
|
*
|
|
248
248
|
* DEVIATION from plan D5, which has this "degenerate into reading the session record". That was
|
|
249
|
-
* the right move while
|
|
249
|
+
* the right move while the session store keyed on `backend:channel` and the caller had to know the
|
|
250
250
|
* backend to find the session at all — but the backend is no longer part of the key, so no session
|
|
251
251
|
* lookup needs this any more. What is left are callers asking which backend a channel runs
|
|
252
252
|
* (conversation ledger, rollback, compaction support), and for them the profile is the source of
|
|
@@ -38,7 +38,7 @@ export interface SwitchProfileResult {
|
|
|
38
38
|
reason?: SwitchProfileFailure;
|
|
39
39
|
}
|
|
40
40
|
/** Does the channel's session already carry conversation history? A fresh (just-created) session has
|
|
41
|
-
*
|
|
41
|
+
* zero turns; a live conversation has ≥1 turn. Read straight from the registry's channel turns. */
|
|
42
42
|
export declare function channelHasHistory(channel: string): Promise<boolean>;
|
|
43
43
|
/**
|
|
44
44
|
* Switch the active profile for a channel/session under the shared rule. Validates the profile,
|