@praxis-ai/praxis 0.1.4 → 0.1.5
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/dist/agentCore/index.d.ts +11 -3
- package/dist/applicationLayer/applicationRuntime.js +7 -1
- package/dist/basetool/authoring.d.ts +2 -0
- package/dist/basetool/authoring.js +2 -0
- package/dist/basetool/catalog.d.ts +1 -1
- package/dist/basetool/catalog.js +86 -4
- package/dist/basetool/core/index.d.ts +4 -2
- package/dist/basetool/core/index.js +8 -0
- package/dist/basetool/core/mcpCompletions.d.ts +2 -0
- package/dist/basetool/core/mcpCompletions.js +70 -0
- package/dist/basetool/core/mcpPrompts.d.ts +2 -0
- package/dist/basetool/core/mcpPrompts.js +48 -0
- package/dist/basetool/core/mcpResources.js +41 -5
- package/dist/basetool/profiles.js +15 -1
- package/dist/basetool/registry.d.ts +1 -1
- package/dist/basetool/supportCatalog.js +23 -6
- package/dist/runtimeImplementation/praxisRuntimeKernel.js +1696 -1499
- package/dist/runtimeImplementation/runtime.execEngine/baseToolApprovalScope.js +11 -0
- package/dist/runtimeImplementation/runtime.execEngine/baseToolExecutorPortFactory.js +13 -1
- package/dist/runtimeImplementation/runtime.execEngine/baseToolPolicyAdjudicator.js +14 -0
- package/dist/runtimeImplementation/runtime.execEngine/mcpRuntimeAdapter.d.ts +27 -0
- package/dist/runtimeImplementation/runtime.execEngine/mcpRuntimeAdapter.js +648 -56
- package/dist/runtimeImplementation/runtime.execEngine/promptContextAssembly.d.ts +1 -0
- package/dist/runtimeImplementation/runtime.execEngine/promptContextAssembly.js +18 -0
- package/dist/runtimeImplementation/runtime.mcpPlane/index.d.ts +20 -7
- package/dist/runtimeImplementation/runtime.mcpPlane/index.js +105 -89
- package/dist/toolBase/catalog.d.ts +24 -0
- package/dist/toolBase/catalog.js +41 -3
- package/dist/toolBase/profiles.d.ts +3 -3
- package/dist/toolBase/profiles.js +2 -0
- package/dist/toolBase/types.d.ts +1 -1
- package/examples/raxode-mcp-plus-ten-server.config.json +229 -0
- package/examples/scripts/README.md +8 -2
- package/examples/scripts/mcp-plus-native-smoke.ts +1296 -0
- package/package.json +3 -1
- package/raxode-tui/dist/raxode-cli/backend/agents/codingAgent/prompts/tool-use.md +1 -1
- package/raxode-tui/dist/raxode-cli/backend/application/mcpConfig.d.ts +9 -0
- package/raxode-tui/dist/raxode-cli/backend/application/mcpConfig.js +65 -0
- package/raxode-tui/dist/raxode-cli/backend/application/mcpReadinessSummary.d.ts +28 -0
- package/raxode-tui/dist/raxode-cli/backend/application/mcpReadinessSummary.js +57 -0
- package/raxode-tui/dist/raxode-cli/backend/application/runtimeReadiness.d.ts +5 -1
- package/raxode-tui/dist/raxode-cli/backend/application/runtimeReadiness.js +40 -0
- package/raxode-tui/dist/raxode-cli/backend/application/stdioApplicationServer.js +6 -0
- package/raxode-tui/dist/raxode-cli/backend/directApplicationBackend.d.ts +4 -0
- package/raxode-tui/dist/raxode-cli/backend/directApplicationBackend.js +14 -0
- package/raxode-tui/dist/raxode-cli/backend/raxodeBackend.d.ts +1 -1
- package/raxode-tui/dist/raxode-cli/backend/raxodeBackend.js +16 -1
- package/raxode-tui/dist/raxode-cli/contracts.d.ts +1 -0
- package/raxode-tui/dist/raxode-cli/frontend/bridge/readiness.js +24 -0
- package/raxode-tui/dist/raxode-cli/frontend/tui/app/direct-tui.js +35 -0
- package/raxode-tui/dist/raxode-cli/frontend/tui/cli/raxode-cli.d.ts +2 -0
- package/raxode-tui/dist/raxode-cli/frontend/tui/cli/raxode-cli.js +8 -0
- package/raxode-tui/dist/raxode-cli/frontend/tui/config/raxode-config.d.ts +31 -0
- package/raxode-tui/dist/raxode-cli/frontend/tui/config/raxode-config.js +129 -0
- package/raxode-tui/dist/raxode-cli/index.d.ts +1 -0
|
@@ -36,6 +36,7 @@ export type PromptContextAssemblyRequest = {
|
|
|
36
36
|
sessionSummary?: PromptContextSessionSummary;
|
|
37
37
|
conversationWindow?: readonly PromptContextConversationMessage[];
|
|
38
38
|
projectContextGovernanceMaterials?: readonly PromptPackMaterialDraft[];
|
|
39
|
+
toolDeclarationPreludeMaterials?: readonly PromptPackMaterialDraft[];
|
|
39
40
|
budget?: PromptContextAssemblyBudget;
|
|
40
41
|
toolContextSelection?: BaseToolContextSelection;
|
|
41
42
|
toolContextUsage?: readonly BaseToolContextUsageRecord[];
|
|
@@ -418,6 +418,22 @@ export function assemblePromptContextMaterials(input) {
|
|
|
418
418
|
sandboxMode: input.manifest.sandbox?.profile,
|
|
419
419
|
toolSpecificGuidance: PRAXIS_BASE_TOOL_CALLING_PROTOCOL,
|
|
420
420
|
});
|
|
421
|
+
const toolDeclarationPreludeMaterials = (input.toolDeclarationPreludeMaterials ?? []).map((material, index) => ({
|
|
422
|
+
...material,
|
|
423
|
+
id: material.id ?? `runtime:tool-declaration-prelude:${index + 1}`,
|
|
424
|
+
kind: material.kind,
|
|
425
|
+
source: material.source ?? "runtime.toolDeclarationPrelude",
|
|
426
|
+
sourceCategory: material.sourceCategory ?? "declared-built-in",
|
|
427
|
+
priority: material.priority ?? 95.5 - index,
|
|
428
|
+
trusted: material.trusted ?? true,
|
|
429
|
+
scope: material.scope ?? "runtime.toolCalling",
|
|
430
|
+
promptSegmentKind: "toolDeclarations",
|
|
431
|
+
metadata: {
|
|
432
|
+
...(material.metadata ?? {}),
|
|
433
|
+
promptSegmentKind: "toolDeclarations",
|
|
434
|
+
toolMaterialType: "policy",
|
|
435
|
+
},
|
|
436
|
+
}));
|
|
421
437
|
const sessionSummaryMaterial = input.sessionSummary === undefined
|
|
422
438
|
? []
|
|
423
439
|
: [{
|
|
@@ -445,6 +461,7 @@ export function assemblePromptContextMaterials(input) {
|
|
|
445
461
|
...projectContextGovernanceMaterials,
|
|
446
462
|
...sessionSummaryMaterial,
|
|
447
463
|
...memoryContextMaterials,
|
|
464
|
+
...toolDeclarationPreludeMaterials,
|
|
448
465
|
{
|
|
449
466
|
id: `task:${input.turnIndex}`,
|
|
450
467
|
kind: "user",
|
|
@@ -526,6 +543,7 @@ export function assemblePromptContextMaterials(input) {
|
|
|
526
543
|
...manifestPromptMaterials,
|
|
527
544
|
declaredRuntimeContextMaterial,
|
|
528
545
|
toolDeclarationsMaterial,
|
|
546
|
+
...toolDeclarationPreludeMaterials,
|
|
529
547
|
...projectContextGovernanceMaterials,
|
|
530
548
|
...sessionSummaryMaterial,
|
|
531
549
|
...memoryContextMaterials,
|
|
@@ -90,7 +90,7 @@ export type McpPlusProfileProposal = {
|
|
|
90
90
|
title: string;
|
|
91
91
|
summary: string;
|
|
92
92
|
}[];
|
|
93
|
-
rationale?: string
|
|
93
|
+
rationale?: string | Readonly<Record<string, string>>;
|
|
94
94
|
metadata?: Readonly<Record<string, unknown>>;
|
|
95
95
|
};
|
|
96
96
|
export type McpPlusLearnedProfile = {
|
|
@@ -99,7 +99,7 @@ export type McpPlusLearnedProfile = {
|
|
|
99
99
|
projectId: string;
|
|
100
100
|
exposure: NonNullable<McpPlusManifest["exposure"]>;
|
|
101
101
|
skills?: NonNullable<McpPlusManifest["skills"]>;
|
|
102
|
-
rationale?: string
|
|
102
|
+
rationale?: string | Readonly<Record<string, string>>;
|
|
103
103
|
createdAt: string;
|
|
104
104
|
updatedAt: string;
|
|
105
105
|
metadata?: Readonly<Record<string, unknown>>;
|
|
@@ -107,14 +107,26 @@ export type McpPlusLearnedProfile = {
|
|
|
107
107
|
export type McpPlusRuntimeOverlay = {
|
|
108
108
|
serverId: string;
|
|
109
109
|
sessionId: string;
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
110
|
+
state: {
|
|
111
|
+
mode: ExposureMode;
|
|
112
|
+
activeTools: readonly string[];
|
|
113
|
+
pendingReprofile?: boolean;
|
|
114
|
+
counters: {
|
|
115
|
+
consecutiveIndexedToolCalls: Readonly<Record<string, number>>;
|
|
116
|
+
};
|
|
115
117
|
};
|
|
116
118
|
updatedAt: string;
|
|
117
119
|
metadata?: Readonly<Record<string, unknown>>;
|
|
120
|
+
/** @deprecated Read-only migration support for pre-contract Praxis overlays. */
|
|
121
|
+
mode?: ExposureMode;
|
|
122
|
+
/** @deprecated Read-only migration support for pre-contract Praxis overlays. */
|
|
123
|
+
activeTools?: readonly string[];
|
|
124
|
+
/** @deprecated Read-only migration support for pre-contract Praxis overlays. */
|
|
125
|
+
pendingReprofile?: boolean;
|
|
126
|
+
/** @deprecated Read-only migration support for pre-contract Praxis overlays. */
|
|
127
|
+
counters?: {
|
|
128
|
+
consecutiveIndexedToolCalls: Readonly<Record<string, number>>;
|
|
129
|
+
};
|
|
118
130
|
};
|
|
119
131
|
export type McpPlusProfileStoreKey = {
|
|
120
132
|
serverId: string;
|
|
@@ -206,6 +218,7 @@ export declare function learnedProfileFromProposal(input: {
|
|
|
206
218
|
projectId: string;
|
|
207
219
|
now: string;
|
|
208
220
|
existing?: McpPlusLearnedProfile;
|
|
221
|
+
protectedAlwaysIndexTools?: readonly string[];
|
|
209
222
|
}): {
|
|
210
223
|
ok: true;
|
|
211
224
|
profile: McpPlusLearnedProfile;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
7
7
|
import path from "node:path";
|
|
8
|
-
import { compileMcpPlusManifest, createExpandToolDeclaration, lowerExposurePlanToMcpSurface, planExposure, } from "@praxis-ai/mcp-plus";
|
|
8
|
+
import { compileMcpPlusManifest, createExpandToolDeclaration, createInitToolDeclaration as createMcpPlusContractInitToolDeclaration, createLearnedProfileFromProposal as createContractLearnedProfileFromProposal, createReprofileToolDeclaration as createMcpPlusContractReprofileToolDeclaration, lowerExposurePlanToMcpSurface, mergeMcpPlusPolicy, normalizeProfileProposal, planExposure, validateProfileProposal, } from "@praxis-ai/mcp-plus";
|
|
9
9
|
export function mcpServer(serverId, input) {
|
|
10
10
|
return {
|
|
11
11
|
...input,
|
|
@@ -42,6 +42,14 @@ export const mcp = {
|
|
|
42
42
|
toolId: "mcp.resources",
|
|
43
43
|
metadata: { source: "praxis.mcp.recommendedTools", toolProviderKind: "mcp-static" },
|
|
44
44
|
},
|
|
45
|
+
{
|
|
46
|
+
toolId: "mcp.prompts",
|
|
47
|
+
metadata: { source: "praxis.mcp.recommendedTools", toolProviderKind: "mcp-static" },
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
toolId: "mcp.completions",
|
|
51
|
+
metadata: { source: "praxis.mcp.recommendedTools", toolProviderKind: "mcp-static" },
|
|
52
|
+
},
|
|
45
53
|
];
|
|
46
54
|
},
|
|
47
55
|
};
|
|
@@ -113,18 +121,10 @@ function jsonObjectSchema(properties, required = []) {
|
|
|
113
121
|
};
|
|
114
122
|
}
|
|
115
123
|
export function createMcpPlusInitToolDeclaration() {
|
|
116
|
-
return
|
|
117
|
-
name: "mcp_plus.init",
|
|
118
|
-
description: "Submit the first MCP+ profile proposal for this standard MCP server after inspecting its full MCP tools/list surface.",
|
|
119
|
-
inputSchema: profileProposalInputSchema("init"),
|
|
120
|
-
};
|
|
124
|
+
return createMcpPlusContractInitToolDeclaration();
|
|
121
125
|
}
|
|
122
126
|
export function createMcpPlusReprofileToolDeclaration() {
|
|
123
|
-
return
|
|
124
|
-
name: "mcp_plus.reprofile",
|
|
125
|
-
description: "Submit an updated MCP+ profile proposal for this standard MCP server when runtime usage shows the current profile is stale.",
|
|
126
|
-
inputSchema: profileProposalInputSchema("reprofile"),
|
|
127
|
-
};
|
|
127
|
+
return createMcpPlusContractReprofileToolDeclaration();
|
|
128
128
|
}
|
|
129
129
|
export function createMcpPlusSkillReadToolDeclaration() {
|
|
130
130
|
return {
|
|
@@ -165,36 +165,6 @@ export function createMcpPlusFinishToolDeclaration() {
|
|
|
165
165
|
}, ["serverId", "outcome"]),
|
|
166
166
|
};
|
|
167
167
|
}
|
|
168
|
-
function profileProposalInputSchema(kind) {
|
|
169
|
-
return jsonObjectSchema({
|
|
170
|
-
serverId: { type: "string" },
|
|
171
|
-
pinnedTools: { type: "array", items: { type: "string" } },
|
|
172
|
-
warmTools: { type: "array", items: { type: "string" } },
|
|
173
|
-
indexedTools: { type: "array", items: { type: "string" } },
|
|
174
|
-
alwaysIndexTools: { type: "array", items: { type: "string" } },
|
|
175
|
-
toolCards: {
|
|
176
|
-
type: "object",
|
|
177
|
-
additionalProperties: {
|
|
178
|
-
type: "object",
|
|
179
|
-
properties: {
|
|
180
|
-
title: { type: "string" },
|
|
181
|
-
summary: { type: "string" },
|
|
182
|
-
keywords: { type: "array", items: { type: "string" } },
|
|
183
|
-
},
|
|
184
|
-
additionalProperties: false,
|
|
185
|
-
},
|
|
186
|
-
},
|
|
187
|
-
skillChapters: {
|
|
188
|
-
type: "array",
|
|
189
|
-
items: jsonObjectSchema({
|
|
190
|
-
id: { type: "string" },
|
|
191
|
-
title: { type: "string" },
|
|
192
|
-
summary: { type: "string" },
|
|
193
|
-
}, ["id", "title", "summary"]),
|
|
194
|
-
},
|
|
195
|
-
rationale: { type: "string", description: `${kind} rationale for the host runtime.` },
|
|
196
|
-
}, ["serverId"]);
|
|
197
|
-
}
|
|
198
168
|
function dynamicToolSpecForNativeTool(serverId, tool) {
|
|
199
169
|
return {
|
|
200
170
|
toolId: `mcp.${toolIdPart(serverId)}.${toolIdPart(tool.name)}`,
|
|
@@ -362,6 +332,47 @@ function defaultToolCard(tool) {
|
|
|
362
332
|
keywords: tool.name.split(/[^a-zA-Z0-9]+/u).filter(Boolean),
|
|
363
333
|
};
|
|
364
334
|
}
|
|
335
|
+
function profileRationaleForContract(rationale) {
|
|
336
|
+
if (typeof rationale === "string") {
|
|
337
|
+
return rationale.trim().length === 0 ? undefined : { summary: rationale };
|
|
338
|
+
}
|
|
339
|
+
if (rationale === undefined)
|
|
340
|
+
return undefined;
|
|
341
|
+
return Object.fromEntries(Object.entries(rationale).filter(([, value]) => typeof value === "string"));
|
|
342
|
+
}
|
|
343
|
+
function toContractProfileProposal(proposal) {
|
|
344
|
+
const toolCards = Object.fromEntries(Object.entries(proposal.toolCards ?? {}).map(([toolName, card]) => [toolName, {
|
|
345
|
+
title: card.title,
|
|
346
|
+
summary: card.summary,
|
|
347
|
+
keywords: card.keywords === undefined ? undefined : [...card.keywords],
|
|
348
|
+
}]));
|
|
349
|
+
const contractProposal = {
|
|
350
|
+
serverId: proposal.serverId,
|
|
351
|
+
pinnedTools: uniqueStrings(proposal.pinnedTools),
|
|
352
|
+
warmTools: proposal.warmTools === undefined ? undefined : uniqueStrings(proposal.warmTools),
|
|
353
|
+
indexedTools: uniqueStrings(proposal.indexedTools),
|
|
354
|
+
alwaysIndexTools: proposal.alwaysIndexTools === undefined ? undefined : uniqueStrings(proposal.alwaysIndexTools),
|
|
355
|
+
toolCards,
|
|
356
|
+
skillChapters: proposal.skillChapters?.map((chapter) => ({ ...chapter })),
|
|
357
|
+
rationale: profileRationaleForContract(proposal.rationale),
|
|
358
|
+
};
|
|
359
|
+
if (Object.hasOwn(proposal, "modeHint")) {
|
|
360
|
+
contractProposal.modeHint = proposal.modeHint;
|
|
361
|
+
}
|
|
362
|
+
return Object.fromEntries(Object.entries(contractProposal).filter(([, value]) => value !== undefined));
|
|
363
|
+
}
|
|
364
|
+
function profileErrorCodeFromValidationIssue(code) {
|
|
365
|
+
switch (code) {
|
|
366
|
+
case "unknown_tool":
|
|
367
|
+
return "MCP_PLUS_PROFILE_UNKNOWN_TOOL";
|
|
368
|
+
case "always_index_pinned":
|
|
369
|
+
return "MCP_PLUS_PROFILE_ALWAYS_INDEX_PINNED";
|
|
370
|
+
case "reserved_runtime_field":
|
|
371
|
+
return "MCP_PLUS_PROFILE_MODE_HINT_UNSUPPORTED";
|
|
372
|
+
default:
|
|
373
|
+
return "MCP_PLUS_PROFILE_INVALID_PROPOSAL";
|
|
374
|
+
}
|
|
375
|
+
}
|
|
365
376
|
function learnedManifestFromProfile(profile, server) {
|
|
366
377
|
return {
|
|
367
378
|
server: {
|
|
@@ -373,6 +384,28 @@ function learnedManifestFromProfile(profile, server) {
|
|
|
373
384
|
skills: profile.skills,
|
|
374
385
|
};
|
|
375
386
|
}
|
|
387
|
+
function contractLearnedProfileFromPraxisProfile(profile) {
|
|
388
|
+
const toolCards = Object.fromEntries(Object.entries(profile.exposure.toolCards ?? {}).flatMap(([toolName, card]) => {
|
|
389
|
+
if (typeof card.summary !== "string" || card.summary.trim().length === 0)
|
|
390
|
+
return [];
|
|
391
|
+
return [[toolName, {
|
|
392
|
+
title: card.title,
|
|
393
|
+
summary: card.summary,
|
|
394
|
+
keywords: card.keywords === undefined ? undefined : [...card.keywords],
|
|
395
|
+
}]];
|
|
396
|
+
}));
|
|
397
|
+
return {
|
|
398
|
+
schemaVersion: profile.schemaVersion,
|
|
399
|
+
serverId: profile.serverId,
|
|
400
|
+
pinnedTools: [...(profile.exposure.pinnedTools ?? [])],
|
|
401
|
+
warmTools: [...(profile.exposure.warmTools ?? [])],
|
|
402
|
+
indexedTools: [...(profile.exposure.indexedTools ?? [])],
|
|
403
|
+
alwaysIndexTools: [...(profile.exposure.alwaysIndexTools ?? [])],
|
|
404
|
+
toolCards,
|
|
405
|
+
skillChapters: profile.skills?.chapters?.map((chapter) => ({ ...chapter })),
|
|
406
|
+
rationale: profileRationaleForContract(profile.rationale),
|
|
407
|
+
};
|
|
408
|
+
}
|
|
376
409
|
function fallbackMcpPlusManifest(server, nativeTools) {
|
|
377
410
|
const smallServer = nativeTools.length <= 8;
|
|
378
411
|
return {
|
|
@@ -412,65 +445,41 @@ function bootstrapSurface(server, nativeTools) {
|
|
|
412
445
|
};
|
|
413
446
|
}
|
|
414
447
|
export function learnedProfileFromProposal(input) {
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
const nativeToolNames = new Set(input.nativeTools.map((tool) => tool.name));
|
|
426
|
-
const referenced = [
|
|
427
|
-
...uniqueStrings(input.proposal.pinnedTools),
|
|
428
|
-
...uniqueStrings(input.proposal.warmTools),
|
|
429
|
-
...uniqueStrings(input.proposal.indexedTools),
|
|
430
|
-
...uniqueStrings(input.proposal.alwaysIndexTools),
|
|
431
|
-
...Object.keys(input.proposal.toolCards ?? {}),
|
|
432
|
-
];
|
|
433
|
-
const unknown = referenced.filter((toolName) => !nativeToolNames.has(toolName));
|
|
434
|
-
if (unknown.length > 0) {
|
|
435
|
-
return {
|
|
436
|
-
ok: false,
|
|
437
|
-
error: {
|
|
438
|
-
code: "MCP_PLUS_PROFILE_UNKNOWN_TOOL",
|
|
439
|
-
message: `MCP+ profile proposal references unknown tool(s): ${unknown.join(", ")}`,
|
|
440
|
-
publicSafe: true,
|
|
441
|
-
},
|
|
442
|
-
};
|
|
443
|
-
}
|
|
444
|
-
const alwaysIndex = new Set(uniqueStrings(input.proposal.alwaysIndexTools));
|
|
445
|
-
const pinnedAlwaysIndex = uniqueStrings(input.proposal.pinnedTools).filter((toolName) => alwaysIndex.has(toolName));
|
|
446
|
-
if (pinnedAlwaysIndex.length > 0) {
|
|
448
|
+
const contractProposal = toContractProfileProposal(input.proposal);
|
|
449
|
+
const validation = validateProfileProposal(contractProposal, input.nativeTools, {
|
|
450
|
+
serverId: input.proposal.serverId,
|
|
451
|
+
alwaysIndexTools: [
|
|
452
|
+
...(input.existing?.exposure.alwaysIndexTools ?? []),
|
|
453
|
+
...(input.protectedAlwaysIndexTools ?? []),
|
|
454
|
+
],
|
|
455
|
+
});
|
|
456
|
+
if (!validation.valid) {
|
|
457
|
+
const primary = validation.issues[0];
|
|
447
458
|
return {
|
|
448
459
|
ok: false,
|
|
449
460
|
error: {
|
|
450
|
-
code: "
|
|
451
|
-
message:
|
|
461
|
+
code: primary === undefined ? "MCP_PLUS_PROFILE_INVALID_PROPOSAL" : profileErrorCodeFromValidationIssue(primary.code),
|
|
462
|
+
message: validation.issues.map((issue) => issue.message).join(" "),
|
|
452
463
|
publicSafe: true,
|
|
453
464
|
},
|
|
454
465
|
};
|
|
455
466
|
}
|
|
467
|
+
const normalizedProposal = normalizeProfileProposal(contractProposal);
|
|
468
|
+
const contractProfile = createContractLearnedProfileFromProposal(normalizedProposal);
|
|
456
469
|
const profile = {
|
|
457
470
|
schemaVersion: "mcp-plus.profile.v1",
|
|
458
|
-
serverId:
|
|
471
|
+
serverId: contractProfile.serverId,
|
|
459
472
|
projectId: input.projectId,
|
|
460
473
|
exposure: {
|
|
461
|
-
pinnedTools:
|
|
462
|
-
warmTools:
|
|
463
|
-
indexedTools:
|
|
464
|
-
alwaysIndexTools:
|
|
465
|
-
toolCards:
|
|
466
|
-
title: card.title,
|
|
467
|
-
summary: card.summary,
|
|
468
|
-
keywords: card.keywords === undefined ? undefined : [...card.keywords],
|
|
469
|
-
}])),
|
|
474
|
+
pinnedTools: contractProfile.pinnedTools ?? [],
|
|
475
|
+
warmTools: contractProfile.warmTools ?? [],
|
|
476
|
+
indexedTools: contractProfile.indexedTools ?? [],
|
|
477
|
+
alwaysIndexTools: contractProfile.alwaysIndexTools ?? [],
|
|
478
|
+
toolCards: contractProfile.toolCards,
|
|
470
479
|
},
|
|
471
|
-
skills:
|
|
480
|
+
skills: contractProfile.skillChapters === undefined ? input.existing?.skills : {
|
|
472
481
|
...(input.existing?.skills ?? {}),
|
|
473
|
-
chapters:
|
|
482
|
+
chapters: contractProfile.skillChapters.map((chapter) => ({ ...chapter })),
|
|
474
483
|
},
|
|
475
484
|
rationale: input.proposal.rationale,
|
|
476
485
|
createdAt: input.existing?.createdAt ?? input.now,
|
|
@@ -514,9 +523,15 @@ export function planMcpHarnessExposure(manifest, nativeToolInventoryByServerId,
|
|
|
514
523
|
dynamicToolSpecs: dynamicToolSpecsForSurface(server.serverId, surface),
|
|
515
524
|
};
|
|
516
525
|
}
|
|
517
|
-
const
|
|
526
|
+
const baseManifest = server.manifest ?? (learnedProfile === undefined
|
|
518
527
|
? fallbackMcpPlusManifest(server, nativeTools)
|
|
519
528
|
: learnedManifestFromProfile(learnedProfile, server));
|
|
529
|
+
const effectiveManifest = learnedProfile === undefined
|
|
530
|
+
? baseManifest
|
|
531
|
+
: mergeMcpPlusPolicy({
|
|
532
|
+
manifest: baseManifest,
|
|
533
|
+
learnedProfile: contractLearnedProfileFromPraxisProfile(learnedProfile),
|
|
534
|
+
});
|
|
520
535
|
const graph = compileMcpPlusManifest(effectiveManifest, nativeTools);
|
|
521
536
|
const state = {
|
|
522
537
|
serverId: server.serverId,
|
|
@@ -525,10 +540,11 @@ export function planMcpHarnessExposure(manifest, nativeToolInventoryByServerId,
|
|
|
525
540
|
};
|
|
526
541
|
const plan = planExposure(graph, state);
|
|
527
542
|
const surface = lowerExposurePlanToMcpSurface(plan);
|
|
543
|
+
const shouldExposeExpandControl = state.mode === "frozen" || surface.sidecar.toolIndex.length > 0;
|
|
528
544
|
const withNativeControls = {
|
|
529
545
|
tools: [
|
|
530
546
|
...surface.tools.filter((tool) => tool.name !== "mcp_plus.expand"),
|
|
531
|
-
createExpandToolDeclaration(),
|
|
547
|
+
...(shouldExposeExpandControl ? [createExpandToolDeclaration()] : []),
|
|
532
548
|
...(stateByServerId[server.serverId]?.mode === "frozen" ? [] : [
|
|
533
549
|
createMcpPlusSkillReadToolDeclaration(),
|
|
534
550
|
createMcpPlusSkillWriteToolDeclaration(),
|
|
@@ -202,6 +202,30 @@ export declare const TOOL_BASE_CATALOG: ({
|
|
|
202
202
|
aliases: string[];
|
|
203
203
|
capabilityTags: string[];
|
|
204
204
|
requiresRuntimePorts: string[];
|
|
205
|
+
} | {
|
|
206
|
+
id: "mcp.prompts";
|
|
207
|
+
title: string;
|
|
208
|
+
layer: "agent";
|
|
209
|
+
visibility: "deferred";
|
|
210
|
+
risk: "read";
|
|
211
|
+
interaction: "inspect";
|
|
212
|
+
description: string;
|
|
213
|
+
inputSchema: Readonly<Record<string, unknown>>;
|
|
214
|
+
aliases: string[];
|
|
215
|
+
capabilityTags: string[];
|
|
216
|
+
requiresRuntimePorts: string[];
|
|
217
|
+
} | {
|
|
218
|
+
id: "mcp.completions";
|
|
219
|
+
title: string;
|
|
220
|
+
layer: "agent";
|
|
221
|
+
visibility: "deferred";
|
|
222
|
+
risk: "read";
|
|
223
|
+
interaction: "inspect";
|
|
224
|
+
description: string;
|
|
225
|
+
inputSchema: Readonly<Record<string, unknown>>;
|
|
226
|
+
aliases: string[];
|
|
227
|
+
capabilityTags: string[];
|
|
228
|
+
requiresRuntimePorts: string[];
|
|
205
229
|
} | {
|
|
206
230
|
id: "lsp.query";
|
|
207
231
|
title: string;
|
package/dist/toolBase/catalog.js
CHANGED
|
@@ -289,13 +289,51 @@ export const TOOL_BASE_CATALOG = [
|
|
|
289
289
|
visibility: "deferred",
|
|
290
290
|
risk: "read",
|
|
291
291
|
interaction: "inspect",
|
|
292
|
-
description: "List
|
|
292
|
+
description: "List resources, list resource templates, read, subscribe to, or unsubscribe from resources exposed by mounted MCP servers.",
|
|
293
293
|
inputSchema: objectSchema({
|
|
294
294
|
server: { type: "string" },
|
|
295
295
|
uri: { type: "string" },
|
|
296
|
-
|
|
296
|
+
subscriptionId: { type: "string" },
|
|
297
|
+
action: { type: "string", enum: ["list", "templates", "read", "subscribe", "unsubscribe"] },
|
|
297
298
|
}, ["action"]),
|
|
298
|
-
aliases: ["list_mcp_resources", "read_mcp_resource"],
|
|
299
|
+
aliases: ["list_mcp_resources", "list_mcp_resource_templates", "read_mcp_resource", "subscribe_mcp_resource", "unsubscribe_mcp_resource"],
|
|
300
|
+
capabilityTags: ["mcp", "external", "context"],
|
|
301
|
+
requiresRuntimePorts: ["mcp"],
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
id: "mcp.prompts",
|
|
305
|
+
title: "Read MCP Prompts",
|
|
306
|
+
layer: "agent",
|
|
307
|
+
visibility: "deferred",
|
|
308
|
+
risk: "read",
|
|
309
|
+
interaction: "inspect",
|
|
310
|
+
description: "List or get prompts exposed by mounted MCP servers.",
|
|
311
|
+
inputSchema: objectSchema({
|
|
312
|
+
server: { type: "string" },
|
|
313
|
+
name: { type: "string" },
|
|
314
|
+
cursor: { type: "string" },
|
|
315
|
+
action: { type: "string", enum: ["list", "get"] },
|
|
316
|
+
arguments: { type: "object" },
|
|
317
|
+
}, ["action"]),
|
|
318
|
+
aliases: ["list_mcp_prompts", "get_mcp_prompt"],
|
|
319
|
+
capabilityTags: ["mcp", "external", "context"],
|
|
320
|
+
requiresRuntimePorts: ["mcp"],
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
id: "mcp.completions",
|
|
324
|
+
title: "Complete MCP Arguments",
|
|
325
|
+
layer: "agent",
|
|
326
|
+
visibility: "deferred",
|
|
327
|
+
risk: "read",
|
|
328
|
+
interaction: "inspect",
|
|
329
|
+
description: "Request completion suggestions for prompt arguments or resource template variables exposed by mounted MCP servers.",
|
|
330
|
+
inputSchema: objectSchema({
|
|
331
|
+
server: { type: "string" },
|
|
332
|
+
ref: { type: "object" },
|
|
333
|
+
argument: { type: "object" },
|
|
334
|
+
context: { type: "object" },
|
|
335
|
+
}, ["ref", "argument"]),
|
|
336
|
+
aliases: ["complete_mcp_argument", "complete_mcp_resource_template"],
|
|
299
337
|
capabilityTags: ["mcp", "external", "context"],
|
|
300
338
|
requiresRuntimePorts: ["mcp"],
|
|
301
339
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const MINIMAL_CODING_TOOL_IDS: readonly ["shell.run", "file.read", "file.search", "patch.apply", "plan.update", "user.ask"];
|
|
2
2
|
export declare const STANDARD_AGENT_TOOL_IDS: readonly ["shell.run", "file.read", "file.search", "patch.apply", "plan.update", "user.ask", "web.search", "web.fetch", "skill.load", "mcp.use", "agent.spawn"];
|
|
3
|
-
export declare const EXTENDED_AGENT_TOOL_IDS: readonly ["shell.run", "file.read", "file.search", "patch.apply", "plan.update", "user.ask", "web.search", "web.fetch", "skill.load", "mcp.use", "agent.spawn", "file.write", "file.edit", "agent.message", "agent.wait", "context.load", "mcp.resources", "lsp.query", "browser.use", "computer.use", "image.view", "image.generate", "audio.transcribe", "media.generate", "memory.use", "repo.inspect"];
|
|
3
|
+
export declare const EXTENDED_AGENT_TOOL_IDS: readonly ["shell.run", "file.read", "file.search", "patch.apply", "plan.update", "user.ask", "web.search", "web.fetch", "skill.load", "mcp.use", "agent.spawn", "file.write", "file.edit", "agent.message", "agent.wait", "context.load", "mcp.resources", "mcp.prompts", "lsp.query", "browser.use", "computer.use", "image.view", "image.generate", "audio.transcribe", "media.generate", "memory.use", "repo.inspect"];
|
|
4
4
|
export declare const TOOL_BASE_PROFILES: readonly [{
|
|
5
5
|
readonly name: "minimalCoding";
|
|
6
6
|
readonly description: "Pi/Codex-like small coding set for models that perform best with a short familiar tool list.";
|
|
@@ -19,9 +19,9 @@ export declare const TOOL_BASE_PROFILES: readonly [{
|
|
|
19
19
|
readonly name: "extendedAgent";
|
|
20
20
|
readonly description: "Large set for high-capability runtimes; uncommon tools remain deferred until the agent asks for them.";
|
|
21
21
|
readonly defaultVisibility: "deferred";
|
|
22
|
-
readonly toolIds: readonly ["shell.run", "file.read", "file.search", "patch.apply", "plan.update", "user.ask", "web.search", "web.fetch", "skill.load", "mcp.use", "agent.spawn", "file.write", "file.edit", "agent.message", "agent.wait", "context.load", "mcp.resources", "lsp.query", "browser.use", "computer.use", "image.view", "image.generate", "audio.transcribe", "media.generate", "memory.use", "repo.inspect"];
|
|
22
|
+
readonly toolIds: readonly ["shell.run", "file.read", "file.search", "patch.apply", "plan.update", "user.ask", "web.search", "web.fetch", "skill.load", "mcp.use", "agent.spawn", "file.write", "file.edit", "agent.message", "agent.wait", "context.load", "mcp.resources", "mcp.prompts", "lsp.query", "browser.use", "computer.use", "image.view", "image.generate", "audio.transcribe", "media.generate", "memory.use", "repo.inspect"];
|
|
23
23
|
readonly hiddenToolIds: readonly [];
|
|
24
|
-
readonly deferredToolIds: readonly ["file.write", "file.edit", "agent.message", "agent.wait", "context.load", "mcp.resources", "lsp.query", "browser.use", "computer.use", "image.view", "image.generate", "audio.transcribe", "media.generate", "memory.use", "repo.inspect"];
|
|
24
|
+
readonly deferredToolIds: readonly ["file.write", "file.edit", "agent.message", "agent.wait", "context.load", "mcp.resources", "mcp.prompts", "lsp.query", "browser.use", "computer.use", "image.view", "image.generate", "audio.transcribe", "media.generate", "memory.use", "repo.inspect"];
|
|
25
25
|
}, {
|
|
26
26
|
readonly name: "runtimeOnly";
|
|
27
27
|
readonly description: "Runtime governance ports and internal operations; never sent directly to the model.";
|
|
@@ -22,6 +22,7 @@ export const EXTENDED_AGENT_TOOL_IDS = [
|
|
|
22
22
|
"agent.wait",
|
|
23
23
|
"context.load",
|
|
24
24
|
"mcp.resources",
|
|
25
|
+
"mcp.prompts",
|
|
25
26
|
"lsp.query",
|
|
26
27
|
"browser.use",
|
|
27
28
|
"computer.use",
|
|
@@ -62,6 +63,7 @@ export const TOOL_BASE_PROFILES = [
|
|
|
62
63
|
"agent.wait",
|
|
63
64
|
"context.load",
|
|
64
65
|
"mcp.resources",
|
|
66
|
+
"mcp.prompts",
|
|
65
67
|
"lsp.query",
|
|
66
68
|
"browser.use",
|
|
67
69
|
"computer.use",
|
package/dist/toolBase/types.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export type ToolBaseVisibility = "model" | "deferred" | "runtime" | "disabled";
|
|
|
3
3
|
export type ToolBaseRisk = "safe" | "read" | "write" | "network" | "execute" | "dangerous";
|
|
4
4
|
export type ToolBaseInteraction = "inspect" | "mutate" | "execute" | "delegate" | "ask" | "govern" | "generate";
|
|
5
5
|
export type ToolBaseSchema = Readonly<Record<string, unknown>>;
|
|
6
|
-
export type ToolBaseId = "shell.run" | "file.read" | "file.write" | "file.edit" | "file.search" | "patch.apply" | "web.search" | "web.fetch" | "plan.update" | "user.ask" | "agent.spawn" | "agent.message" | "agent.wait" | "skill.load" | "context.load" | "mcp.use" | "mcp.resources" | "lsp.query" | "browser.use" | "computer.use" | "image.view" | "image.generate" | "audio.transcribe" | "media.generate" | "memory.use" | "repo.inspect" | "approval.request" | "permission.check" | "sandbox.run" | "artifact.store" | "output.truncate" | "process.wait" | "process.kill" | "secret.resolve" | "tool.discover" | "tool.describe" | (string & {});
|
|
6
|
+
export type ToolBaseId = "shell.run" | "file.read" | "file.write" | "file.edit" | "file.search" | "patch.apply" | "web.search" | "web.fetch" | "plan.update" | "user.ask" | "agent.spawn" | "agent.message" | "agent.wait" | "skill.load" | "context.load" | "mcp.use" | "mcp.resources" | "mcp.prompts" | "lsp.query" | "browser.use" | "computer.use" | "image.view" | "image.generate" | "audio.transcribe" | "media.generate" | "memory.use" | "repo.inspect" | "approval.request" | "permission.check" | "sandbox.run" | "artifact.store" | "output.truncate" | "process.wait" | "process.kill" | "secret.resolve" | "tool.discover" | "tool.describe" | (string & {});
|
|
7
7
|
export type ToolBaseDefinition = {
|
|
8
8
|
id: ToolBaseId;
|
|
9
9
|
title: string;
|