@praxis-ai/praxis 0.1.3 → 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.
Files changed (56) hide show
  1. package/dist/agentCore/index.d.ts +11 -3
  2. package/dist/applicationLayer/applicationRuntime.js +7 -1
  3. package/dist/basetool/authoring.d.ts +2 -0
  4. package/dist/basetool/authoring.js +2 -0
  5. package/dist/basetool/catalog.d.ts +1 -1
  6. package/dist/basetool/catalog.js +86 -4
  7. package/dist/basetool/core/index.d.ts +4 -2
  8. package/dist/basetool/core/index.js +8 -0
  9. package/dist/basetool/core/mcpCompletions.d.ts +2 -0
  10. package/dist/basetool/core/mcpCompletions.js +70 -0
  11. package/dist/basetool/core/mcpPrompts.d.ts +2 -0
  12. package/dist/basetool/core/mcpPrompts.js +48 -0
  13. package/dist/basetool/core/mcpResources.js +41 -5
  14. package/dist/basetool/profiles.js +15 -1
  15. package/dist/basetool/registry.d.ts +1 -1
  16. package/dist/basetool/supportCatalog.js +23 -6
  17. package/dist/runtimeImplementation/praxisRuntimeKernel.js +1696 -1499
  18. package/dist/runtimeImplementation/runtime.execEngine/baseToolApprovalScope.js +11 -0
  19. package/dist/runtimeImplementation/runtime.execEngine/baseToolExecutorPortFactory.js +13 -1
  20. package/dist/runtimeImplementation/runtime.execEngine/baseToolPolicyAdjudicator.js +14 -0
  21. package/dist/runtimeImplementation/runtime.execEngine/mcpRuntimeAdapter.d.ts +27 -0
  22. package/dist/runtimeImplementation/runtime.execEngine/mcpRuntimeAdapter.js +648 -56
  23. package/dist/runtimeImplementation/runtime.execEngine/promptContextAssembly.d.ts +1 -0
  24. package/dist/runtimeImplementation/runtime.execEngine/promptContextAssembly.js +18 -0
  25. package/dist/runtimeImplementation/runtime.mcpPlane/index.d.ts +20 -7
  26. package/dist/runtimeImplementation/runtime.mcpPlane/index.js +105 -89
  27. package/dist/toolBase/catalog.d.ts +24 -0
  28. package/dist/toolBase/catalog.js +41 -3
  29. package/dist/toolBase/profiles.d.ts +3 -3
  30. package/dist/toolBase/profiles.js +2 -0
  31. package/dist/toolBase/types.d.ts +1 -1
  32. package/examples/raxode-mcp-plus-ten-server.config.json +229 -0
  33. package/examples/scripts/README.md +8 -2
  34. package/examples/scripts/mcp-plus-native-smoke.ts +1296 -0
  35. package/package.json +4 -2
  36. package/raxode-tui/dist/raxode-cli/backend/agents/codingAgent/prompts/tool-use.md +1 -1
  37. package/raxode-tui/dist/raxode-cli/backend/application/mcpConfig.d.ts +9 -0
  38. package/raxode-tui/dist/raxode-cli/backend/application/mcpConfig.js +65 -0
  39. package/raxode-tui/dist/raxode-cli/backend/application/mcpReadinessSummary.d.ts +28 -0
  40. package/raxode-tui/dist/raxode-cli/backend/application/mcpReadinessSummary.js +57 -0
  41. package/raxode-tui/dist/raxode-cli/backend/application/runtimeReadiness.d.ts +5 -1
  42. package/raxode-tui/dist/raxode-cli/backend/application/runtimeReadiness.js +40 -0
  43. package/raxode-tui/dist/raxode-cli/backend/application/stdioApplicationServer.js +6 -0
  44. package/raxode-tui/dist/raxode-cli/backend/directApplicationBackend.d.ts +4 -0
  45. package/raxode-tui/dist/raxode-cli/backend/directApplicationBackend.js +14 -0
  46. package/raxode-tui/dist/raxode-cli/backend/raxodeBackend.d.ts +1 -1
  47. package/raxode-tui/dist/raxode-cli/backend/raxodeBackend.js +16 -1
  48. package/raxode-tui/dist/raxode-cli/contracts.d.ts +1 -0
  49. package/raxode-tui/dist/raxode-cli/frontend/bridge/readiness.js +24 -0
  50. package/raxode-tui/dist/raxode-cli/frontend/tui/app/direct-tui.js +35 -0
  51. package/raxode-tui/dist/raxode-cli/frontend/tui/cli/raxode-cli.d.ts +2 -0
  52. package/raxode-tui/dist/raxode-cli/frontend/tui/cli/raxode-cli.js +8 -0
  53. package/raxode-tui/dist/raxode-cli/frontend/tui/config/raxode-config.d.ts +31 -0
  54. package/raxode-tui/dist/raxode-cli/frontend/tui/config/raxode-config.js +129 -0
  55. package/raxode-tui/dist/raxode-cli/index.d.ts +1 -0
  56. package/raxode-tui/package.json +1 -1
@@ -125,6 +125,34 @@ export interface RaxodeEmbeddingConfig {
125
125
  authProfileId?: string;
126
126
  dimensions?: number;
127
127
  }
128
+ export type RaxodeMcpServerMode = "native" | "mcp-plus";
129
+ export type RaxodeMcpServerConfig = {
130
+ serverId: string;
131
+ mode: RaxodeMcpServerMode;
132
+ title?: string;
133
+ summary?: string;
134
+ enabled: boolean;
135
+ timeoutMs?: number;
136
+ manifest?: Record<string, unknown>;
137
+ metadata?: Record<string, unknown>;
138
+ } & ({
139
+ transport: "stdio";
140
+ command: string;
141
+ args?: string[];
142
+ cwd?: string;
143
+ env?: Record<string, string>;
144
+ framing?: "content-length" | "line-json";
145
+ } | {
146
+ transport: "http" | "sse";
147
+ url: string;
148
+ sseUrl?: string;
149
+ headers?: Record<string, string>;
150
+ });
151
+ export interface RaxodeMcpConfig {
152
+ servers: RaxodeMcpServerConfig[];
153
+ projectId?: string;
154
+ reprofileConsecutiveIndexedCalls?: number;
155
+ }
128
156
  export interface RaxodeConfigFile {
129
157
  schemaVersion: number;
130
158
  providerSlots: Partial<Record<RaxodeProviderSlot, string>>;
@@ -134,6 +162,7 @@ export interface RaxodeConfigFile {
134
162
  workspace: RaxodeWorkspaceConfig;
135
163
  ui: RaxodeUiConfig;
136
164
  permissions: RaxodePermissionsConfig;
165
+ mcp: RaxodeMcpConfig;
137
166
  }
138
167
  export interface RaxodeRuntimeConfigSnapshot {
139
168
  modelPlan: RaxodeLiveChatModelPlan;
@@ -141,6 +170,7 @@ export interface RaxodeRuntimeConfigSnapshot {
141
170
  permissions: RaxodePermissionsConfig;
142
171
  embedding: RaxodeEmbeddingConfig;
143
172
  workspace: RaxodeWorkspaceConfig;
173
+ mcp: RaxodeMcpConfig;
144
174
  }
145
175
  export interface RaxodeResolvedProfile {
146
176
  slot: RaxodeProviderSlot;
@@ -190,6 +220,7 @@ export declare function loadRaxodeLiveChatModelPlan(fallbackDir?: string): Raxod
190
220
  export declare function loadRaxodeUiConfig(fallbackDir?: string): RaxodeUiConfig;
191
221
  export declare function loadRaxodePermissionsConfig(fallbackDir?: string): RaxodePermissionsConfig;
192
222
  export declare function loadRaxodeRuntimeConfigSnapshot(fallbackDir?: string): RaxodeRuntimeConfigSnapshot;
223
+ export declare function loadRaxodeMcpConfig(fallbackDir?: string): RaxodeMcpConfig;
193
224
  export declare function loadResolvedProviderSlotConfig(slot: RaxodeProviderSlot, fallbackDir?: string): RaxodeResolvedProfile;
194
225
  export declare function loadResolvedProviderSlotConfigs(fallbackDir?: string): {
195
226
  openai: RaxodeResolvedProfile;
@@ -235,6 +235,9 @@ function createDefaultConfigFile(fallbackDir = process.cwd()) {
235
235
  permissions: {
236
236
  ...createDefaultRaxodePermissionsConfig(),
237
237
  },
238
+ mcp: {
239
+ servers: [],
240
+ },
238
241
  };
239
242
  }
240
243
  export function ensureRaxodeHomeScaffold(fallbackDir = process.cwd()) {
@@ -295,6 +298,121 @@ function asBoolean(value, defaultValue = true) {
295
298
  function asPositiveInteger(value) {
296
299
  return typeof value === "number" && Number.isInteger(value) && value > 0 ? value : undefined;
297
300
  }
301
+ function asStringArray(value, filePath, fieldPath) {
302
+ if (value === undefined)
303
+ return undefined;
304
+ if (!Array.isArray(value)) {
305
+ throw new RaxodeConfigError(`Raxode 配置字段无效: ${fieldPath}`, { filePath, fieldPath });
306
+ }
307
+ return value.map((entry, index) => asString(entry, filePath, `${fieldPath}[${index}]`));
308
+ }
309
+ function asStringRecord(value, filePath, fieldPath) {
310
+ if (value === undefined)
311
+ return undefined;
312
+ const record = asRecord(value, filePath, fieldPath);
313
+ return Object.fromEntries(Object.entries(record).map(([key, entry]) => [key, asString(entry, filePath, `${fieldPath}.${key}`)]));
314
+ }
315
+ function asObjectRecord(value, filePath, fieldPath) {
316
+ if (value === undefined)
317
+ return undefined;
318
+ return { ...asRecord(value, filePath, fieldPath) };
319
+ }
320
+ function asMcpServerMode(value, filePath, fieldPath) {
321
+ if (value === undefined)
322
+ return "mcp-plus";
323
+ if (value === "native" || value === "mcp-plus")
324
+ return value;
325
+ throw new RaxodeConfigError(`Raxode 配置字段无效: ${fieldPath}`, { filePath, fieldPath });
326
+ }
327
+ function asMcpStdioFraming(value, filePath, fieldPath) {
328
+ if (value === undefined)
329
+ return undefined;
330
+ if (value === "content-length" || value === "line-json")
331
+ return value;
332
+ throw new RaxodeConfigError(`Raxode 配置字段无效: ${fieldPath}`, { filePath, fieldPath });
333
+ }
334
+ function asMcpServerConfig(value, filePath, fieldPath) {
335
+ const record = asRecord(value, filePath, fieldPath);
336
+ const serverId = asString(record.serverId, filePath, `${fieldPath}.serverId`);
337
+ const transport = asString(record.transport, filePath, `${fieldPath}.transport`);
338
+ const common = {
339
+ serverId,
340
+ mode: asMcpServerMode(record.mode, filePath, `${fieldPath}.mode`),
341
+ title: asOptionalString(record.title),
342
+ summary: asOptionalString(record.summary),
343
+ enabled: asBoolean(record.enabled, true),
344
+ timeoutMs: asPositiveInteger(record.timeoutMs),
345
+ manifest: asObjectRecord(record.manifest, filePath, `${fieldPath}.manifest`),
346
+ metadata: asObjectRecord(record.metadata, filePath, `${fieldPath}.metadata`),
347
+ };
348
+ if (transport === "stdio") {
349
+ return {
350
+ ...common,
351
+ transport,
352
+ command: asString(record.command, filePath, `${fieldPath}.command`),
353
+ args: asStringArray(record.args, filePath, `${fieldPath}.args`),
354
+ cwd: asOptionalString(record.cwd),
355
+ env: asStringRecord(record.env, filePath, `${fieldPath}.env`),
356
+ framing: asMcpStdioFraming(record.framing, filePath, `${fieldPath}.framing`),
357
+ };
358
+ }
359
+ if (transport === "http" || transport === "sse") {
360
+ return {
361
+ ...common,
362
+ transport,
363
+ url: asString(record.url, filePath, `${fieldPath}.url`),
364
+ sseUrl: asOptionalString(record.sseUrl),
365
+ headers: asStringRecord(record.headers, filePath, `${fieldPath}.headers`),
366
+ };
367
+ }
368
+ throw new RaxodeConfigError(`Raxode 配置字段无效: ${fieldPath}.transport`, { filePath, fieldPath: `${fieldPath}.transport` });
369
+ }
370
+ function loadMcpConfig(value, filePath) {
371
+ const record = value === undefined ? {} : asRecord(value, filePath, "mcp");
372
+ const rawServers = record.servers;
373
+ const servers = rawServers === undefined
374
+ ? []
375
+ : Array.isArray(rawServers)
376
+ ? rawServers.map((entry, index) => asMcpServerConfig(entry, filePath, `mcp.servers[${index}]`))
377
+ : (() => {
378
+ throw new RaxodeConfigError("Raxode 配置字段无效: mcp.servers", { filePath, fieldPath: "mcp.servers" });
379
+ })();
380
+ return {
381
+ servers,
382
+ projectId: asOptionalString(record.projectId),
383
+ reprofileConsecutiveIndexedCalls: asPositiveInteger(record.reprofileConsecutiveIndexedCalls),
384
+ };
385
+ }
386
+ function cloneMcpServerConfig(server) {
387
+ const common = {
388
+ serverId: server.serverId,
389
+ mode: server.mode,
390
+ title: server.title,
391
+ summary: server.summary,
392
+ enabled: server.enabled,
393
+ timeoutMs: server.timeoutMs,
394
+ manifest: server.manifest ? { ...server.manifest } : undefined,
395
+ metadata: server.metadata ? { ...server.metadata } : undefined,
396
+ };
397
+ if (server.transport === "stdio") {
398
+ return {
399
+ ...common,
400
+ transport: "stdio",
401
+ command: server.command,
402
+ args: server.args ? [...server.args] : undefined,
403
+ cwd: server.cwd,
404
+ env: server.env ? { ...server.env } : undefined,
405
+ framing: server.framing,
406
+ };
407
+ }
408
+ return {
409
+ ...common,
410
+ transport: server.transport,
411
+ url: server.url,
412
+ sseUrl: server.sseUrl,
413
+ headers: server.headers ? { ...server.headers } : undefined,
414
+ };
415
+ }
298
416
  function loadAuthProfiles(filePath) {
299
417
  const parsed = parseJsonFile(filePath);
300
418
  const authProfilesRaw = parsed.authProfiles;
@@ -407,6 +525,7 @@ function loadConfigFile(filePath) {
407
525
  const ui = asRecord(parsed.ui ?? {}, filePath, "ui");
408
526
  const permissions = asRecord(parsed.permissions ?? {}, filePath, "permissions");
409
527
  const providerSlots = asRecord(parsed.providerSlots ?? {}, filePath, "providerSlots");
528
+ const mcp = loadMcpConfig(parsed.mcp, filePath);
410
529
  const matrix = Array.isArray(permissions.shared15ViewMatrix)
411
530
  ? permissions.shared15ViewMatrix.map((entry, index) => ({
412
531
  ...asRecord(entry, filePath, `permissions.shared15ViewMatrix[${index}]`),
@@ -471,6 +590,7 @@ function loadConfigFile(filePath) {
471
590
  shared15ViewMatrix: matrix,
472
591
  persistedAllowRules,
473
592
  },
593
+ mcp,
474
594
  };
475
595
  }
476
596
  function migrateRaxodeConfigFile(config) {
@@ -488,6 +608,11 @@ function migrateRaxodeConfigFile(config) {
488
608
  embedding: { ...config.embedding },
489
609
  workspace: { ...config.workspace },
490
610
  ui: { ...config.ui },
611
+ mcp: {
612
+ projectId: config.mcp.projectId,
613
+ reprofileConsecutiveIndexedCalls: config.mcp.reprofileConsecutiveIndexedCalls,
614
+ servers: config.mcp.servers.map(cloneMcpServerConfig),
615
+ },
491
616
  permissions: {
492
617
  ...config.permissions,
493
618
  requireHumanOnRiskLevels: [...config.permissions.requireHumanOnRiskLevels],
@@ -640,8 +765,12 @@ export function loadRaxodeRuntimeConfigSnapshot(fallbackDir = process.cwd()) {
640
765
  permissions: config.permissions,
641
766
  embedding: config.embedding,
642
767
  workspace: config.workspace,
768
+ mcp: config.mcp,
643
769
  };
644
770
  }
771
+ export function loadRaxodeMcpConfig(fallbackDir = process.cwd()) {
772
+ return loadRaxodeConfigFile(fallbackDir).mcp;
773
+ }
645
774
  export function loadResolvedProviderSlotConfig(slot, fallbackDir = process.cwd()) {
646
775
  const authFile = loadRaxodeAuthFile(fallbackDir);
647
776
  const configFile = loadRaxodeConfigFile(fallbackDir);
@@ -6,6 +6,7 @@ export { createRaxodeReadinessEvent, inspectRaxodeBackendReadiness, inspectRaxod
6
6
  export { createRaxodeBackendModuleInventory, } from "./backend/application/backendModuleInventory.js";
7
7
  export { probeLocalRaxodeReadiness, } from "./backend/application/localReadinessProbe.js";
8
8
  export type { RaxodeBackendReadiness, RaxodeReadinessArea, RaxodeReadinessOwner, RaxodeReadinessPhase, RaxodeReadinessSeverity, RaxodeReadinessStatus, } from "./backend/application/runtimeReadiness.js";
9
+ export type { RaxodeMcpReadinessSummary, } from "./backend/application/mcpReadinessSummary.js";
9
10
  export type { RaxodeBackendModuleId, RaxodeBackendModuleInventory, RaxodeBackendModuleInventoryItem, RaxodeBackendModuleStatus, } from "./backend/application/backendModuleInventory.js";
10
11
  export type { RaxodeDependencyProbe, RaxodeDependencyProbeStatus, RaxodeLocalReadinessProbe, RaxodeLocalReadinessProbeInput, RaxodeSandboxProbe, RaxodeSandboxProbeStatus, } from "./backend/application/localReadinessProbe.js";
11
12
  export type { RaxodeApplicationAttachment, RaxodeApplicationBackendResult, RaxodeApplicationCommand, RaxodeApplicationEvent, RaxodeApplicationInputEnvelope, RaxodeApplicationPermissionProfile, RaxodeApplicationReasoningEffort, RaxodeApplicationRunMode, RaxodeApplicationStatus, RaxodeApplicationViewModel, } from "./contracts.js";
@@ -55,7 +55,7 @@
55
55
  "@lancedb/lancedb": "^0.27.2",
56
56
  "@modelcontextprotocol/sdk": "^1.29.0",
57
57
  "@openai/agents": "^0.11.4",
58
- "@praxis-ai/praxis": "0.1.2",
58
+ "@praxis-ai/praxis": "0.1.4",
59
59
  "@praxis-ai/raxcell": "^0.1.5",
60
60
  "apache-arrow": "^18.1.0",
61
61
  "class-variance-authority": "^0.7.1",