@mcp-com-ai/plugin-capability-graph 0.0.0-stage → 1.2.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/LICENSE +92 -0
- package/README.md +443 -2
- package/dist/canonical.d.ts +9 -0
- package/dist/classifier.d.ts +11 -0
- package/dist/commands.d.ts +9 -0
- package/dist/compiler.d.ts +9 -0
- package/dist/evaluation.d.ts +24 -0
- package/dist/execution-digests.d.ts +7 -0
- package/dist/execution-envelope.d.ts +19 -0
- package/dist/execution-preflight.d.ts +38 -0
- package/dist/executor.d.ts +21 -0
- package/dist/extensions.d.ts +100 -0
- package/dist/fact-audit.d.ts +34 -0
- package/dist/fact-closure.d.ts +41 -0
- package/dist/graphml.d.ts +2 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +315 -0
- package/dist/json-schema.d.ts +6 -0
- package/dist/openapi-document.d.ts +9 -0
- package/dist/planner.d.ts +14 -0
- package/dist/planning-gates.d.ts +10 -0
- package/dist/response-outcomes.d.ts +6 -0
- package/dist/runtime.d.ts +15 -0
- package/dist/runtime.js +5 -0
- package/dist/triggers.d.ts +15 -0
- package/dist/visualization-api.d.ts +3 -0
- package/dist/visualization-api.js +163 -0
- package/dist/visualization-assets.d.ts +2 -0
- package/dist/visualization-flow-cards.d.ts +26 -0
- package/dist/visualization-renderer.d.ts +2 -0
- package/dist/visualization-shared.d.ts +7 -0
- package/dist/visualization-types.d.ts +343 -0
- package/dist/visualization.d.ts +3 -0
- package/package.json +66 -4
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { CapabilityExecutionLimitsV1, CapabilityExecutionRequestV1, CapabilityExecutionResultV1, CapabilityExecutionRuntimeBindingsV1, CapabilityExecutionTargetDescriptorV1, CapabilityExecutorFactoryV1, CapabilityExecutorV1, CapabilityGraphV1 } from "@mcp-com-ai/core";
|
|
2
|
+
import type { CapabilityExecutionConfirmationPolicy } from "./execution-envelope";
|
|
3
|
+
export declare const CAPABILITY_EXECUTION_SAFETY_CEILINGS: CapabilityExecutionLimitsV1;
|
|
4
|
+
export declare const DEFAULT_CAPABILITY_EXECUTION_LIMITS: CapabilityExecutionLimitsV1;
|
|
5
|
+
export interface GuardedCapabilityExecutorOptions {
|
|
6
|
+
readonly graph: CapabilityGraphV1;
|
|
7
|
+
readonly descriptors: ReadonlyMap<string, CapabilityExecutionTargetDescriptorV1>;
|
|
8
|
+
readonly bindings: CapabilityExecutionRuntimeBindingsV1;
|
|
9
|
+
readonly confirmation?: CapabilityExecutionConfirmationPolicy;
|
|
10
|
+
}
|
|
11
|
+
export declare class GuardedCapabilityExecutor implements CapabilityExecutorV1 {
|
|
12
|
+
private readonly options;
|
|
13
|
+
readonly id = "guarded-capability-executor-v1";
|
|
14
|
+
constructor(options: GuardedCapabilityExecutorOptions);
|
|
15
|
+
execute(originalRequest: CapabilityExecutionRequestV1): Promise<CapabilityExecutionResultV1>;
|
|
16
|
+
private executeStep;
|
|
17
|
+
private preflight;
|
|
18
|
+
private invokeAttempt;
|
|
19
|
+
private handleInvocation;
|
|
20
|
+
}
|
|
21
|
+
export declare function createGuardedCapabilityExecutorFactory(graph: CapabilityGraphV1, confirmation?: CapabilityExecutionConfirmationPolicy): CapabilityExecutorFactoryV1;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { CapabilityGraphDiagnostic, CapabilityGraphEffects, PlanningFactV1 } from "@mcp-com-ai/core";
|
|
2
|
+
export declare const HAPI_PLANNING_EXTENSION_KEY = "x-hapi-planning";
|
|
3
|
+
export interface ParsedPlanningExtensionV1 {
|
|
4
|
+
readonly requires: readonly PlanningFactV1[];
|
|
5
|
+
readonly produces: readonly PlanningFactV1[];
|
|
6
|
+
readonly removes: readonly PlanningFactV1[];
|
|
7
|
+
readonly cost: number;
|
|
8
|
+
}
|
|
9
|
+
/** Documentation schema mirrored by the strict parser below. */
|
|
10
|
+
export declare const HAPI_PLANNING_EXTENSION_SCHEMA_V1: Readonly<{
|
|
11
|
+
readonly type: "object";
|
|
12
|
+
readonly additionalProperties: false;
|
|
13
|
+
readonly required: readonly ["produces"];
|
|
14
|
+
readonly properties: {
|
|
15
|
+
readonly requires: {
|
|
16
|
+
readonly type: "array";
|
|
17
|
+
readonly items: {
|
|
18
|
+
readonly $ref: "#/$defs/fact";
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
readonly produces: {
|
|
22
|
+
readonly type: "array";
|
|
23
|
+
readonly minItems: 1;
|
|
24
|
+
readonly items: {
|
|
25
|
+
readonly $ref: "#/$defs/fact";
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
readonly removes: {
|
|
29
|
+
readonly type: "array";
|
|
30
|
+
readonly items: {
|
|
31
|
+
readonly $ref: "#/$defs/fact";
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
readonly cost: {
|
|
35
|
+
readonly type: "number";
|
|
36
|
+
readonly minimum: 0;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
readonly $defs: {
|
|
40
|
+
readonly fact: {
|
|
41
|
+
readonly type: "object";
|
|
42
|
+
readonly additionalProperties: false;
|
|
43
|
+
readonly required: readonly ["predicate"];
|
|
44
|
+
readonly properties: {
|
|
45
|
+
readonly predicate: {
|
|
46
|
+
readonly type: "string";
|
|
47
|
+
readonly pattern: "^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$";
|
|
48
|
+
};
|
|
49
|
+
readonly value: {};
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
}>;
|
|
54
|
+
export interface ParsedCapabilityExtensions {
|
|
55
|
+
readonly capabilities?: readonly string[];
|
|
56
|
+
readonly intent?: {
|
|
57
|
+
readonly useWhen: readonly string[];
|
|
58
|
+
readonly avoidWhen: readonly string[];
|
|
59
|
+
};
|
|
60
|
+
readonly effects?: CapabilityGraphEffects;
|
|
61
|
+
readonly prerequisites?: readonly string[];
|
|
62
|
+
readonly planning?: ParsedPlanningExtensionV1;
|
|
63
|
+
}
|
|
64
|
+
export declare function parseCapabilityExtensions(operation: Record<string, unknown>, pointer: string, operationId: string, diagnostics: CapabilityGraphDiagnostic[]): ParsedCapabilityExtensions;
|
|
65
|
+
/**
|
|
66
|
+
* Validate and canonicalize planning metadata without attaching it to the
|
|
67
|
+
* compiled graph. Group 2 owns compilation and provenance integration.
|
|
68
|
+
*/
|
|
69
|
+
export declare function parsePlanningExtensionV1(operation: Record<string, unknown>, pointer: string, operationId: string, diagnostics: CapabilityGraphDiagnostic[]): ParsedPlanningExtensionV1 | undefined;
|
|
70
|
+
export declare const HAPI_OUTCOME_EXTENSION_KEY = "x-hapi-outcome";
|
|
71
|
+
export interface ParsedOutcomeExtensionV1 {
|
|
72
|
+
readonly produces: readonly PlanningFactV1[];
|
|
73
|
+
readonly removes: readonly PlanningFactV1[];
|
|
74
|
+
}
|
|
75
|
+
/** True for `2xx` status keys, which `x-hapi-planning` already models. */
|
|
76
|
+
export declare function isSuccessStatusKey(status: string): boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Validate a response-level `x-hapi-outcome`: optional canonical `produces`
|
|
79
|
+
* and `removes`, at least one non-empty, never overlapping, and never on a
|
|
80
|
+
* success status.
|
|
81
|
+
*/
|
|
82
|
+
export declare function parseOutcomeExtensionV1(value: unknown, pointer: string, status: string, operationId: string, diagnostics: CapabilityGraphDiagnostic[]): ParsedOutcomeExtensionV1 | undefined;
|
|
83
|
+
export declare const HAPI_CLIENT_FACTS_EXTENSION_KEY = "x-hapi-client-facts";
|
|
84
|
+
export interface ParsedClientFactV1 {
|
|
85
|
+
readonly fact: PlanningFactV1;
|
|
86
|
+
readonly description?: string;
|
|
87
|
+
readonly pointer: string;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Validate root-level `x-hapi-client-facts`: an array of canonical facts with
|
|
91
|
+
* an optional non-empty description, no duplicates and no other keys.
|
|
92
|
+
*/
|
|
93
|
+
export declare function parseClientFactsExtensionV1(value: unknown, diagnostics: CapabilityGraphDiagnostic[]): readonly ParsedClientFactV1[] | undefined;
|
|
94
|
+
export declare const HAPI_EVENT_EXTENSION_KEY = "x-hapi-event";
|
|
95
|
+
/**
|
|
96
|
+
* Validate `x-hapi-event` on a webhook or callback operation: an object with a
|
|
97
|
+
* non-empty canonical `produces` fact array and no other keys.
|
|
98
|
+
*/
|
|
99
|
+
export declare function parseEventExtensionV1(value: unknown, pointer: string, triggerId: string, diagnostics: CapabilityGraphDiagnostic[]): readonly PlanningFactV1[] | undefined;
|
|
100
|
+
export declare function defaultEffectsForMethod(method: string): CapabilityGraphEffects;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { CapabilityGraphPlanningBoundsV1, CapabilityGraphPlanningOutcome, CapabilityGraphV1, PlanningFactV1 } from "@mcp-com-ai/core";
|
|
2
|
+
import { type CapabilityGraphFactClosureV1 } from "./fact-closure";
|
|
3
|
+
export interface CapabilityGraphReachabilityResultV1 {
|
|
4
|
+
readonly goal: PlanningFactV1;
|
|
5
|
+
readonly label: string;
|
|
6
|
+
readonly outcome: CapabilityGraphPlanningOutcome;
|
|
7
|
+
readonly reachable: boolean;
|
|
8
|
+
readonly diagnostics: readonly string[];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* A topology check: every transition target is eligible and every
|
|
12
|
+
* non-authorization gate is treated as satisfied. It never grants real
|
|
13
|
+
* authorization or confirmation.
|
|
14
|
+
*/
|
|
15
|
+
export interface CapabilityGraphReachabilitySweepV1 {
|
|
16
|
+
readonly kind: "topology-check";
|
|
17
|
+
readonly initialFacts: readonly PlanningFactV1[];
|
|
18
|
+
readonly satisfiedGates: readonly string[];
|
|
19
|
+
readonly results: readonly CapabilityGraphReachabilityResultV1[];
|
|
20
|
+
}
|
|
21
|
+
export interface CapabilityGraphFactAuditReportV1 extends CapabilityGraphFactClosureV1 {
|
|
22
|
+
readonly graphFingerprint: string;
|
|
23
|
+
readonly reachability?: CapabilityGraphReachabilitySweepV1;
|
|
24
|
+
readonly clean: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface CapabilityGraphFactAuditOptions {
|
|
27
|
+
readonly clientVerifiedFacts?: readonly PlanningFactV1[];
|
|
28
|
+
/** Goals to sweep; defaults to the closure's outcomes. */
|
|
29
|
+
readonly goalFacts?: readonly PlanningFactV1[];
|
|
30
|
+
readonly reachability?: boolean;
|
|
31
|
+
readonly bounds?: CapabilityGraphPlanningBoundsV1;
|
|
32
|
+
}
|
|
33
|
+
export declare function auditCapabilityGraphFacts(graph: CapabilityGraphV1, options?: CapabilityGraphFactAuditOptions): Promise<CapabilityGraphFactAuditReportV1>;
|
|
34
|
+
export declare function renderFactAuditSummary(report: CapabilityGraphFactAuditReportV1): string;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { CapabilityGraphV1, PlanningFactV1 } from "@mcp-com-ai/core";
|
|
2
|
+
/** One business fact and the transition targets it relates to. */
|
|
3
|
+
export type CapabilityGraphClientFactOrigin = "contract" | "option";
|
|
4
|
+
export interface CapabilityGraphFactFindingV1 {
|
|
5
|
+
readonly fact: PlanningFactV1;
|
|
6
|
+
readonly label: string;
|
|
7
|
+
readonly operations: readonly string[];
|
|
8
|
+
/** Client-verified findings only: where the declaration came from. */
|
|
9
|
+
readonly origins?: readonly CapabilityGraphClientFactOrigin[];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Static fact-closure findings for a compiled graph. Pure analysis: no planner
|
|
13
|
+
* run, no API call, and compiler-generated technical facts are excluded.
|
|
14
|
+
*/
|
|
15
|
+
export interface CapabilityGraphFactClosureV1 {
|
|
16
|
+
readonly schemaVersion: "1";
|
|
17
|
+
/** Required somewhere, produced nowhere, and not declared client-verified. */
|
|
18
|
+
readonly orphanRequirements: readonly CapabilityGraphFactFindingV1[];
|
|
19
|
+
/** Declared client-verified facts that some transition requires. */
|
|
20
|
+
readonly clientVerifiedFacts: readonly CapabilityGraphFactFindingV1[];
|
|
21
|
+
/** Produced and never required: candidate goals. */
|
|
22
|
+
readonly outcomes: readonly CapabilityGraphFactFindingV1[];
|
|
23
|
+
/**
|
|
24
|
+
* Facts produced by declared response outcomes, with `<operation> <status>`
|
|
25
|
+
* sources. They are established by an observed response, never planned.
|
|
26
|
+
*/
|
|
27
|
+
readonly responseFacts: readonly CapabilityGraphFactFindingV1[];
|
|
28
|
+
/** Facts signalled by declared webhook or callback triggers, by trigger id. */
|
|
29
|
+
readonly eventFacts: readonly CapabilityGraphFactFindingV1[];
|
|
30
|
+
/** Operations that no planning transition targets. */
|
|
31
|
+
readonly discoveryOnlyOperations: readonly string[];
|
|
32
|
+
}
|
|
33
|
+
export declare function analyzeFactClosure(graph: CapabilityGraphV1, clientVerifiedFacts?: readonly PlanningFactV1[]): CapabilityGraphFactClosureV1;
|
|
34
|
+
/**
|
|
35
|
+
* Client-verified facts from the contract's `x-hapi-client-facts` and from
|
|
36
|
+
* explicit options, keyed by canonical fact, with each fact's origins.
|
|
37
|
+
*/
|
|
38
|
+
export declare function clientFactOrigins(graph: CapabilityGraphV1, optionFacts?: readonly PlanningFactV1[]): Map<string, Set<CapabilityGraphClientFactOrigin>>;
|
|
39
|
+
/** The union of contract-declared and option client facts, canonically sorted. */
|
|
40
|
+
export declare function effectiveClientFacts(graph: CapabilityGraphV1, optionFacts?: readonly PlanningFactV1[]): PlanningFactV1[];
|
|
41
|
+
export declare function factLabel(fact: PlanningFactV1): string;
|