trellis 2.1.9 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +65 -796
- package/dist/cli/index.d.ts +3 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +2948 -182
- package/dist/client/index.js +4 -4
- package/dist/context/heat-map-manager.d.ts +100 -0
- package/dist/context/heat-map-manager.d.ts.map +1 -0
- package/dist/context/manager.d.ts +16 -0
- package/dist/context/manager.d.ts.map +1 -0
- package/dist/context/types.d.ts +20 -0
- package/dist/context/types.d.ts.map +1 -0
- package/dist/core/agents/harness.d.ts +10 -1
- package/dist/core/agents/harness.d.ts.map +1 -1
- package/dist/core/agents/types.d.ts +18 -2
- package/dist/core/agents/types.d.ts.map +1 -1
- package/dist/core/computation/expr-evaluator.d.ts +52 -0
- package/dist/core/computation/expr-evaluator.d.ts.map +1 -0
- package/dist/core/index.js +93 -5
- package/dist/core/kernel/logic-middleware.d.ts +19 -0
- package/dist/core/kernel/logic-middleware.d.ts.map +1 -0
- package/dist/core/kernel/schema-middleware.d.ts +15 -0
- package/dist/core/kernel/schema-middleware.d.ts.map +1 -0
- package/dist/core/kernel/security-middleware.d.ts +24 -0
- package/dist/core/kernel/security-middleware.d.ts.map +1 -0
- package/dist/core/kernel/sync-provider.d.ts +59 -0
- package/dist/core/kernel/sync-provider.d.ts.map +1 -0
- package/dist/core/kernel/trellis-kernel.d.ts +55 -0
- package/dist/core/kernel/trellis-kernel.d.ts.map +1 -1
- package/dist/core/ontology/builtins.d.ts.map +1 -1
- package/dist/core/ontology/core-ontology.d.ts +20 -0
- package/dist/core/ontology/core-ontology.d.ts.map +1 -0
- package/dist/core/ontology/index.d.ts +3 -1
- package/dist/core/ontology/index.d.ts.map +1 -1
- package/dist/core/ontology/types.d.ts +138 -34
- package/dist/core/ontology/types.d.ts.map +1 -1
- package/dist/core/persist/backend.d.ts +2 -0
- package/dist/core/persist/backend.d.ts.map +1 -1
- package/dist/core/persist/better-sqlite-backend.d.ts +33 -0
- package/dist/core/persist/better-sqlite-backend.d.ts.map +1 -0
- package/dist/core/persist/sqlite-backend.d.ts +2 -0
- package/dist/core/persist/sqlite-backend.d.ts.map +1 -1
- package/dist/core/store/eav-store.d.ts +4 -0
- package/dist/core/store/eav-store.d.ts.map +1 -1
- package/dist/db/index.js +10 -8
- package/dist/{deploy-99j5dc9c.js → deploy-999q207z.js} +2 -1
- package/dist/engine.d.ts +3 -1
- package/dist/engine.d.ts.map +1 -1
- package/dist/evals/types.d.ts +29 -0
- package/dist/evals/types.d.ts.map +1 -0
- package/dist/{import-fyg5sgq4.js → import-s2b8e0ft.js} +2 -2
- package/dist/{index-3ejh8k6v.js → index-0q7wbasy.js} +18 -4
- package/dist/{index-7t92ej34.js → index-0zk3fx2s.js} +467 -7
- package/dist/{index-xr7rx360.js → index-6n5dcebj.js} +33 -0
- package/dist/{index-4beszbgg.js → index-7e27kvvj.js} +1 -1
- package/dist/index-bmyt7k8n.js +90 -0
- package/dist/{index-k5kf7sd0.js → index-hmdbnd4n.js} +1 -1
- package/dist/{index-czecrvvn.js → index-q31hfjja.js} +858 -48
- package/dist/{index-8fjwnztt.js → index-skhn0agf.js} +1 -1
- package/dist/{index-04sq3h27.js → index-w7ng765c.js} +3 -1
- package/dist/{index-hgd30epa.js → index-wt8rz4gn.js} +4 -21
- package/dist/{index-5p6zgspx.js → index-y3d71wzd.js} +1 -1
- package/dist/index-y6a4kj0p.js +43 -0
- package/dist/{index-5bhe57y9.js → index-yhwjgfvj.js} +16 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -6
- package/dist/llm/provider.d.ts +11 -0
- package/dist/llm/provider.d.ts.map +1 -0
- package/dist/llm/types.d.ts +74 -0
- package/dist/llm/types.d.ts.map +1 -0
- package/dist/mcp/index.d.ts +7 -1
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/orchestration/types.d.ts +22 -0
- package/dist/orchestration/types.d.ts.map +1 -0
- package/dist/plugins/agent-memory/graph-context-manager.d.ts +75 -0
- package/dist/plugins/agent-memory/graph-context-manager.d.ts.map +1 -0
- package/dist/plugins/agent-memory/index.d.ts +30 -0
- package/dist/plugins/agent-memory/index.d.ts.map +1 -0
- package/dist/plugins/agent-memory/ontology.d.ts +13 -0
- package/dist/plugins/agent-memory/ontology.d.ts.map +1 -0
- package/dist/plugins/agent-memory/plugin.d.ts +17 -0
- package/dist/plugins/agent-memory/plugin.d.ts.map +1 -0
- package/dist/plugins/brand/cache.d.ts +18 -0
- package/dist/plugins/brand/cache.d.ts.map +1 -0
- package/dist/plugins/brand/catalog-generator.d.ts +89 -0
- package/dist/plugins/brand/catalog-generator.d.ts.map +1 -0
- package/dist/plugins/brand/constraints.d.ts +55 -0
- package/dist/plugins/brand/constraints.d.ts.map +1 -0
- package/dist/plugins/brand/index.d.ts +44 -0
- package/dist/plugins/brand/index.d.ts.map +1 -0
- package/dist/plugins/brand/mcp-tools.d.ts +101 -0
- package/dist/plugins/brand/mcp-tools.d.ts.map +1 -0
- package/dist/plugins/brand/ontology.d.ts +13 -0
- package/dist/plugins/brand/ontology.d.ts.map +1 -0
- package/dist/plugins/brand/plugin.d.ts +21 -0
- package/dist/plugins/brand/plugin.d.ts.map +1 -0
- package/dist/plugins/brand/voice-tone.d.ts +24 -0
- package/dist/plugins/brand/voice-tone.d.ts.map +1 -0
- package/dist/plugins/idea-garden/api.d.ts +26 -0
- package/dist/plugins/idea-garden/api.d.ts.map +1 -0
- package/dist/plugins/idea-garden/index.d.ts +12 -0
- package/dist/plugins/idea-garden/index.d.ts.map +1 -0
- package/dist/plugins/idea-garden/plugin.d.ts +16 -0
- package/dist/plugins/idea-garden/plugin.d.ts.map +1 -0
- package/dist/plugins/idea-garden/types.d.ts +22 -0
- package/dist/plugins/idea-garden/types.d.ts.map +1 -0
- package/dist/plugins/plan-approval/index.d.ts +36 -0
- package/dist/plugins/plan-approval/index.d.ts.map +1 -0
- package/dist/plugins/plan-approval/ontology.d.ts +11 -0
- package/dist/plugins/plan-approval/ontology.d.ts.map +1 -0
- package/dist/plugins/plan-approval/plan-manager.d.ts +104 -0
- package/dist/plugins/plan-approval/plan-manager.d.ts.map +1 -0
- package/dist/plugins/plan-approval/plugin.d.ts +110 -0
- package/dist/plugins/plan-approval/plugin.d.ts.map +1 -0
- package/dist/plugins/proactive-watcher/index.d.ts +28 -0
- package/dist/plugins/proactive-watcher/index.d.ts.map +1 -0
- package/dist/plugins/proactive-watcher/ontology.d.ts +8 -0
- package/dist/plugins/proactive-watcher/ontology.d.ts.map +1 -0
- package/dist/plugins/proactive-watcher/plugin.d.ts +20 -0
- package/dist/plugins/proactive-watcher/plugin.d.ts.map +1 -0
- package/dist/plugins/proactive-watcher/watcher-manager.d.ts +36 -0
- package/dist/plugins/proactive-watcher/watcher-manager.d.ts.map +1 -0
- package/dist/plugins/sprite-tools/checkpoint-middleware.d.ts +43 -0
- package/dist/plugins/sprite-tools/checkpoint-middleware.d.ts.map +1 -0
- package/dist/plugins/sprite-tools/index.d.ts +40 -0
- package/dist/plugins/sprite-tools/index.d.ts.map +1 -0
- package/dist/plugins/sprite-tools/plugin.d.ts +69 -0
- package/dist/plugins/sprite-tools/plugin.d.ts.map +1 -0
- package/dist/react/index.js +4 -4
- package/dist/scaffold/index.d.ts +13 -0
- package/dist/scaffold/index.d.ts.map +1 -0
- package/dist/scaffold/infer.d.ts +42 -0
- package/dist/scaffold/infer.d.ts.map +1 -0
- package/dist/scaffold/profile.d.ts +51 -0
- package/dist/scaffold/profile.d.ts.map +1 -0
- package/dist/scaffold/seed.d.ts +27 -0
- package/dist/scaffold/seed.d.ts.map +1 -0
- package/dist/scaffold/write.d.ts +53 -0
- package/dist/scaffold/write.d.ts.map +1 -0
- package/dist/{sdk-sj8rp0m7.js → sdk-snn5gad3.js} +4 -4
- package/dist/server/deploy.d.ts.map +1 -1
- package/dist/server/index.d.ts +5 -3
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +37 -7
- package/dist/server/sprites.d.ts +26 -0
- package/dist/server/sprites.d.ts.map +1 -0
- package/dist/server/vm-config.d.ts +60 -0
- package/dist/server/vm-config.d.ts.map +1 -0
- package/dist/{server-3vkpnpbz.js → server-mrctdwzr.js} +2 -2
- package/dist/sprites-vc4qbrp1.js +16 -0
- package/dist/streaming/types.d.ts +43 -0
- package/dist/streaming/types.d.ts.map +1 -0
- package/dist/{tenancy-tjr7kk2v.js → tenancy-7d1g4ayp.js} +3 -3
- package/dist/ui/client.html +460 -664
- package/dist/ui/server.d.ts +6 -2
- package/dist/ui/server.d.ts.map +1 -1
- package/dist/vcs/decompose.d.ts.map +1 -1
- package/dist/vcs/index.js +2 -2
- package/dist/vcs/issue.d.ts.map +1 -1
- package/dist/vcs/types.d.ts +1 -0
- package/dist/vcs/types.d.ts.map +1 -1
- package/dist/vm-config-6xhsj6b3.js +22 -0
- package/package.json +14 -4
- /package/dist/{index-kbnht9p8.js → index-c9h37r6h.js} +0 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constraint Application — Narrows shadcn component Zod enums based on brand tokens.
|
|
3
|
+
*
|
|
4
|
+
* The core transformation: shadcn's Button accepts z.enum(["primary","secondary","danger"])
|
|
5
|
+
* → a brand-constrained catalog narrows it to z.enum(["primary","danger"]) based on
|
|
6
|
+
* which token roles exist in the graph.
|
|
7
|
+
*
|
|
8
|
+
* @module trellis/plugins/brand
|
|
9
|
+
*/
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
/**
|
|
12
|
+
* Maps component name → { propName: tokenType }.
|
|
13
|
+
* Only components/props listed here are narrowed; everything else passes through.
|
|
14
|
+
*/
|
|
15
|
+
export declare const CONSTRAINT_MAP: Record<string, Record<string, string>>;
|
|
16
|
+
/**
|
|
17
|
+
* When token role names don't match shadcn enum values 1:1, this map provides
|
|
18
|
+
* the translation. A role of "destructive" maps to both "destructive" and "danger"
|
|
19
|
+
* (whichever the shadcn component actually uses).
|
|
20
|
+
*/
|
|
21
|
+
export declare const ROLE_ALIASES: Record<string, string[]>;
|
|
22
|
+
/**
|
|
23
|
+
* Extract enum values from a Zod schema. Handles:
|
|
24
|
+
* - z.enum([...])
|
|
25
|
+
* - z.enum([...]).nullable()
|
|
26
|
+
* - z.enum([...]).optional()
|
|
27
|
+
* - z.enum([...]).nullable().optional()
|
|
28
|
+
*
|
|
29
|
+
* Returns null if the schema is not an enum type.
|
|
30
|
+
*/
|
|
31
|
+
export declare function extractEnumValues(schema: z.ZodType): string[] | null;
|
|
32
|
+
/**
|
|
33
|
+
* Narrow an enum to only values that match available token roles.
|
|
34
|
+
*
|
|
35
|
+
* @param originalEnum - The full set of enum values from the shadcn component
|
|
36
|
+
* @param availableRoles - Token roles present in the brand guide
|
|
37
|
+
* @returns Narrowed enum values. Falls back to first original value if nothing matches.
|
|
38
|
+
*/
|
|
39
|
+
export declare function constrainEnum(originalEnum: string[], availableRoles: string[]): string[];
|
|
40
|
+
/**
|
|
41
|
+
* Given a component definition and the available tokens grouped by type,
|
|
42
|
+
* return a new definition with narrowed Zod enum props.
|
|
43
|
+
*
|
|
44
|
+
* If the component has no constraints in CONSTRAINT_MAP, returns the original.
|
|
45
|
+
*/
|
|
46
|
+
export declare function constrainComponentDef(componentName: string, def: {
|
|
47
|
+
props: z.ZodType;
|
|
48
|
+
[key: string]: unknown;
|
|
49
|
+
}, tokensByType: Record<string, Array<{
|
|
50
|
+
role: string;
|
|
51
|
+
}>>): {
|
|
52
|
+
props: z.ZodType;
|
|
53
|
+
[key: string]: unknown;
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=constraints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constraints.d.ts","sourceRoot":"","sources":["../../../src/plugins/brand/constraints.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAgBjE,CAAC;AAMF;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAqBjD,CAAC;AAMF;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,GAAG,MAAM,EAAE,GAAG,IAAI,CAcpE;AAMD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,YAAY,EAAE,MAAM,EAAE,EAAE,cAAc,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAcxF;AAMD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,aAAa,EAAE,MAAM,EACrB,GAAG,EAAE;IAAE,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,EACjD,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,GACpD;IAAE,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,CAoC9C"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Brand Token System — Trellis plugin for design token governance
|
|
3
|
+
* and json-render catalog generation.
|
|
4
|
+
*
|
|
5
|
+
* @module trellis/plugins/brand
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { createBrandPlugin, brandOntology, generateBrandCatalog, brandTools } from 'trellis/plugins/brand';
|
|
10
|
+
*
|
|
11
|
+
* // 1. Register the plugin
|
|
12
|
+
* const { plugin, cache } = createBrandPlugin();
|
|
13
|
+
* pluginRegistry.register(plugin);
|
|
14
|
+
* await pluginRegistry.load('trellis:brand', kernel, ontologyRegistry);
|
|
15
|
+
*
|
|
16
|
+
* // 2. Create a brand guide + tokens
|
|
17
|
+
* await kernel.createEntity('guide-1', 'BrandGuide', { name: 'Acme Brand', complianceMode: 'strict' });
|
|
18
|
+
* await kernel.createEntity('token-primary', 'DesignToken', {
|
|
19
|
+
* name: 'Primary Blue', tokenType: 'color', role: 'primary',
|
|
20
|
+
* value: JSON.stringify({ hex: '#2563eb', oklch: 'oklch(0.55 0.22 264)' }),
|
|
21
|
+
* });
|
|
22
|
+
* await kernel.addLink('guide-1', 'hasToken', 'token-primary');
|
|
23
|
+
*
|
|
24
|
+
* // 3. Generate a constrained catalog
|
|
25
|
+
* import { defineCatalog } from '@json-render/core';
|
|
26
|
+
* import { schema } from '@json-render/react/schema';
|
|
27
|
+
* import { shadcnComponentDefinitions } from '@json-render/shadcn/catalog';
|
|
28
|
+
*
|
|
29
|
+
* const { catalog, voiceRules } = generateBrandCatalog(
|
|
30
|
+
* kernel, 'guide-1', defineCatalog, schema, shadcnComponentDefinitions,
|
|
31
|
+
* );
|
|
32
|
+
*
|
|
33
|
+
* // 4. Get the AI prompt with brand constraints
|
|
34
|
+
* const prompt = catalog.prompt({ customRules: voiceRules, mode: 'inline' });
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export { brandOntology } from './ontology.js';
|
|
38
|
+
export { createBrandPlugin } from './plugin.js';
|
|
39
|
+
export { CatalogCache } from './cache.js';
|
|
40
|
+
export { generateBrandCatalog, collectTokens, parseBrandGuide, type CollectedTokens, type BrandGuideData, type GenerateCatalogResult, type KernelReader, } from './catalog-generator.js';
|
|
41
|
+
export { constrainEnum, constrainComponentDef, extractEnumValues, CONSTRAINT_MAP, ROLE_ALIASES, } from './constraints.js';
|
|
42
|
+
export { buildVoiceToneRules, type VoiceToneConfig } from './voice-tone.js';
|
|
43
|
+
export { brandTools, brandCreateGuide, brandUpsertToken, brandDeleteToken, brandListTokens, brandGenerateCatalog, brandGetPrompt, type BrandToolContext, } from './mcp-tools.js';
|
|
44
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/brand/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAG9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGhD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG1C,OAAO,EACL,oBAAoB,EACpB,aAAa,EACb,eAAe,EACf,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,KAAK,YAAY,GAClB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,iBAAiB,EACjB,cAAc,EACd,YAAY,GACb,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,mBAAmB,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAG5E,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,cAAc,EACd,KAAK,gBAAgB,GACtB,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Tools — Brand token management and catalog generation tools
|
|
3
|
+
* for the Model Context Protocol.
|
|
4
|
+
*
|
|
5
|
+
* These are standalone tool definitions that can be registered on any MCP server.
|
|
6
|
+
* Each tool follows the pattern: { name, description, inputSchema, handler }.
|
|
7
|
+
*
|
|
8
|
+
* @module trellis/plugins/brand
|
|
9
|
+
*/
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
import type { TrellisKernel } from '../../core/kernel/trellis-kernel.js';
|
|
12
|
+
import { CatalogCache } from './cache.js';
|
|
13
|
+
interface McpToolResult {
|
|
14
|
+
content: Array<{
|
|
15
|
+
type: 'text';
|
|
16
|
+
text: string;
|
|
17
|
+
}>;
|
|
18
|
+
}
|
|
19
|
+
interface McpToolDef<T> {
|
|
20
|
+
name: string;
|
|
21
|
+
description: string;
|
|
22
|
+
inputSchema: Record<string, z.ZodType>;
|
|
23
|
+
handler: (input: T, ctx: BrandToolContext) => Promise<McpToolResult>;
|
|
24
|
+
}
|
|
25
|
+
export interface BrandToolContext {
|
|
26
|
+
kernel: TrellisKernel;
|
|
27
|
+
cache: CatalogCache;
|
|
28
|
+
/** The `defineCatalog` function from `@json-render/core` */
|
|
29
|
+
defineCatalog: (schema: unknown, input: {
|
|
30
|
+
components: Record<string, unknown>;
|
|
31
|
+
actions: Record<string, unknown>;
|
|
32
|
+
}) => unknown;
|
|
33
|
+
/** The schema instance from `@json-render/react/schema` (or other renderer) */
|
|
34
|
+
schema: unknown;
|
|
35
|
+
/** Base component definitions (e.g., shadcnComponentDefinitions) */
|
|
36
|
+
baseComponents: Record<string, {
|
|
37
|
+
props: unknown;
|
|
38
|
+
[key: string]: unknown;
|
|
39
|
+
}>;
|
|
40
|
+
}
|
|
41
|
+
export declare const brandCreateGuide: McpToolDef<{
|
|
42
|
+
guideId: string;
|
|
43
|
+
name: string;
|
|
44
|
+
complianceMode?: string;
|
|
45
|
+
voiceTone?: string;
|
|
46
|
+
}>;
|
|
47
|
+
export declare const brandUpsertToken: McpToolDef<{
|
|
48
|
+
tokenId: string;
|
|
49
|
+
guideId: string;
|
|
50
|
+
name: string;
|
|
51
|
+
tokenType: string;
|
|
52
|
+
role: string;
|
|
53
|
+
value: string;
|
|
54
|
+
description?: string;
|
|
55
|
+
lightMode?: string;
|
|
56
|
+
darkMode?: string;
|
|
57
|
+
wcagAA?: boolean;
|
|
58
|
+
wcagAAA?: boolean;
|
|
59
|
+
}>;
|
|
60
|
+
export declare const brandDeleteToken: McpToolDef<{
|
|
61
|
+
tokenId: string;
|
|
62
|
+
}>;
|
|
63
|
+
export declare const brandListTokens: McpToolDef<{
|
|
64
|
+
guideId: string;
|
|
65
|
+
tokenType?: string;
|
|
66
|
+
}>;
|
|
67
|
+
export declare const brandGenerateCatalog: McpToolDef<{
|
|
68
|
+
guideId: string;
|
|
69
|
+
}>;
|
|
70
|
+
export declare const brandGetPrompt: McpToolDef<{
|
|
71
|
+
guideId: string;
|
|
72
|
+
}>;
|
|
73
|
+
export declare const brandTools: readonly [McpToolDef<{
|
|
74
|
+
guideId: string;
|
|
75
|
+
name: string;
|
|
76
|
+
complianceMode?: string;
|
|
77
|
+
voiceTone?: string;
|
|
78
|
+
}>, McpToolDef<{
|
|
79
|
+
tokenId: string;
|
|
80
|
+
guideId: string;
|
|
81
|
+
name: string;
|
|
82
|
+
tokenType: string;
|
|
83
|
+
role: string;
|
|
84
|
+
value: string;
|
|
85
|
+
description?: string;
|
|
86
|
+
lightMode?: string;
|
|
87
|
+
darkMode?: string;
|
|
88
|
+
wcagAA?: boolean;
|
|
89
|
+
wcagAAA?: boolean;
|
|
90
|
+
}>, McpToolDef<{
|
|
91
|
+
tokenId: string;
|
|
92
|
+
}>, McpToolDef<{
|
|
93
|
+
guideId: string;
|
|
94
|
+
tokenType?: string;
|
|
95
|
+
}>, McpToolDef<{
|
|
96
|
+
guideId: string;
|
|
97
|
+
}>, McpToolDef<{
|
|
98
|
+
guideId: string;
|
|
99
|
+
}>];
|
|
100
|
+
export {};
|
|
101
|
+
//# sourceMappingURL=mcp-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-tools.d.ts","sourceRoot":"","sources":["../../../src/plugins/brand/mcp-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,aAAa,EAAgB,MAAM,qCAAqC,CAAC;AAEvF,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAM1C,U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M,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CA+CA,CAAC;AAMF,eAAO,MAAM,gBAAgB,EAAE,UAAU,CAAC;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAa5D,CAAC;AAMF,eAAO,MAAM,eAAe,EAAE,UAAU,CAAC;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CA+BA,CAAC;AAMF,eAAO,MAAM,oBAAoB,EAAE,UAAU,CAAC;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAuChE,CAAC;AAMF,eAAO,MAAM,cAAc,EAAE,UAAU,CAAC;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAsB1D,CAAC;AAMF,eAAO,MAAM,UAAU;aAvOZ,MAAM;UACT,MAAM;qBACK,MAAM;gBACX,MAAM;;aAgCT,MAAM;aACN,MAAM;UACT,MAAM;eACD,MAAM;UACX,MAAM;WACL,MAAM;kBACC,MAAM;gBACR,MAAM;eACP,MAAM;aACR,OAAO;cACN,OAAO;;aAsDkC,MAAM;;aAoBhD,MAAM;gBACH,MAAM;;aAsCqC,MAAM;;aA6CZ,MAAM;GAmC/C,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Brand Token Ontology — Schema definitions for BrandGuide and DesignToken entities.
|
|
3
|
+
*
|
|
4
|
+
* Two entity types, one relation. Deliberately flat:
|
|
5
|
+
* - BrandGuide: container for a set of tokens + brand rules
|
|
6
|
+
* - DesignToken: a single token discriminated by tokenType
|
|
7
|
+
* - hasToken: links a guide to its tokens
|
|
8
|
+
*
|
|
9
|
+
* @module trellis/plugins/brand
|
|
10
|
+
*/
|
|
11
|
+
import type { OntologySchema } from '../../core/ontology/types.js';
|
|
12
|
+
export declare const brandOntology: OntologySchema;
|
|
13
|
+
//# sourceMappingURL=ontology.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ontology.d.ts","sourceRoot":"","sources":["../../../src/plugins/brand/ontology.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAEnE,eAAO,MAAM,aAAa,EAAE,cAkF3B,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Brand Plugin — Trellis plugin definition for the brand token system.
|
|
3
|
+
*
|
|
4
|
+
* Registers the brand ontology and subscribes to entity events to
|
|
5
|
+
* invalidate cached catalogs when tokens or guides change.
|
|
6
|
+
*
|
|
7
|
+
* @module trellis/plugins/brand
|
|
8
|
+
*/
|
|
9
|
+
import type { PluginDef } from '../../core/plugins/types.js';
|
|
10
|
+
import { CatalogCache } from './cache.js';
|
|
11
|
+
/**
|
|
12
|
+
* Create a brand token plugin instance.
|
|
13
|
+
*
|
|
14
|
+
* Returns a PluginDef and the shared CatalogCache so MCP tools
|
|
15
|
+
* and external consumers can access cached catalogs.
|
|
16
|
+
*/
|
|
17
|
+
export declare function createBrandPlugin(): {
|
|
18
|
+
plugin: PluginDef;
|
|
19
|
+
cache: CatalogCache;
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/brand/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAE7D,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C;;;;;GAKG;AACH,wBAAgB,iBAAiB,IAAI;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,YAAY,CAAA;CAAE,CAiD9E"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Voice & Tone — Converts brand voice/tone config into json-render catalog prompt rules.
|
|
3
|
+
*
|
|
4
|
+
* These rules are passed as `customRules` to `catalog.prompt()`, injecting
|
|
5
|
+
* communication constraints into the AI system prompt alongside component schemas.
|
|
6
|
+
*
|
|
7
|
+
* @module trellis/plugins/brand
|
|
8
|
+
*/
|
|
9
|
+
export interface VoiceToneConfig {
|
|
10
|
+
/** Personality traits: ["professional", "warm", "concise"] */
|
|
11
|
+
traits?: string[];
|
|
12
|
+
/** Vocabulary swaps: { "click": "select", "delete": "remove" } */
|
|
13
|
+
preferred?: Record<string, string>;
|
|
14
|
+
/** Words to never use: ["synergy", "leverage", "disrupt"] */
|
|
15
|
+
avoided?: string[];
|
|
16
|
+
/** Example phrases that embody the tone */
|
|
17
|
+
examples?: string[];
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Build an array of rule strings from a voice/tone config.
|
|
21
|
+
* Returns empty array if config is undefined or empty.
|
|
22
|
+
*/
|
|
23
|
+
export declare function buildVoiceToneRules(config: VoiceToneConfig | undefined | null): string[];
|
|
24
|
+
//# sourceMappingURL=voice-tone.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"voice-tone.d.ts","sourceRoot":"","sources":["../../../src/plugins/brand/voice-tone.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,eAAe;IAC9B,8DAA8D;IAC9D,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,kEAAkE;IAClE,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,6DAA6D;IAC7D,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,eAAe,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,EAAE,CAyBxF"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Idea Garden API
|
|
3
|
+
*
|
|
4
|
+
* Provides functions to query the Trellis kernel for abandoned threads,
|
|
5
|
+
* rejected plans, and unexplored alternatives, surfacing them as RecoverableIdeas.
|
|
6
|
+
*/
|
|
7
|
+
import type { TrellisKernel } from '../../core/kernel/trellis-kernel.js';
|
|
8
|
+
import type { RecoverableIdea } from './types.js';
|
|
9
|
+
export declare class IdeaGarden {
|
|
10
|
+
private kernel;
|
|
11
|
+
constructor(kernel: TrellisKernel);
|
|
12
|
+
/**
|
|
13
|
+
* Harvests all recoverable ideas from the graph.
|
|
14
|
+
* Scans for:
|
|
15
|
+
* 1. Rejected/Cancelled PendingPlans
|
|
16
|
+
* 2. Archived Conversations
|
|
17
|
+
* 3. DecisionTraces with unexplored alternatives
|
|
18
|
+
*/
|
|
19
|
+
harvestIdeas(): RecoverableIdea[];
|
|
20
|
+
/**
|
|
21
|
+
* Resurrects a rejected plan by creating a new active 'pending' replica of it.
|
|
22
|
+
* Returns the new PendingPlan ID.
|
|
23
|
+
*/
|
|
24
|
+
resurrectPlan(ideaId: string): Promise<string>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/plugins/idea-garden/api.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,qBAAa,UAAU;IACT,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,aAAa;IAEzC;;;;;;OAMG;IACH,YAAY,IAAI,eAAe,EAAE;IAgFjC;;;OAGG;IACG,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAuBrD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Idea Garden
|
|
3
|
+
*
|
|
4
|
+
* Surfaces abandoned threads, cancelled plans, and unexplored alternatives
|
|
5
|
+
* from the graph as "Recoverable Ideas".
|
|
6
|
+
*
|
|
7
|
+
* @module trellis/plugins/idea-garden
|
|
8
|
+
*/
|
|
9
|
+
export * from './types.js';
|
|
10
|
+
export { IdeaGarden } from './api.js';
|
|
11
|
+
export { createIdeaGardenPlugin } from './plugin.js';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/idea-garden/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Idea Garden Plugin
|
|
3
|
+
*
|
|
4
|
+
* Registers the Idea Garden feature and exposes agent tools to traverse
|
|
5
|
+
* and resurrect ideas from the garden.
|
|
6
|
+
*
|
|
7
|
+
* @module trellis/plugins/idea-garden
|
|
8
|
+
*/
|
|
9
|
+
import type { PluginDef } from '../../core/plugins/types.js';
|
|
10
|
+
import type { TrellisKernel } from '../../core/kernel/trellis-kernel.js';
|
|
11
|
+
import type { AgentHarness } from '../../core/agents/harness.js';
|
|
12
|
+
import { IdeaGarden } from './api.js';
|
|
13
|
+
export declare function createIdeaGardenPlugin(kernel: TrellisKernel, harness: AgentHarness): PluginDef & {
|
|
14
|
+
api: IdeaGarden;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/idea-garden/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,YAAY,GACpB,SAAS,GAAG;IAAE,GAAG,EAAE,UAAU,CAAA;CAAE,CAgEjC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Idea Garden Types
|
|
3
|
+
*
|
|
4
|
+
* Defines the structure for recovering abandoned threads, rejected plans,
|
|
5
|
+
* and unexplored alternatives as "Recoverable Ideas".
|
|
6
|
+
*
|
|
7
|
+
* @module trellis/plugins/idea-garden
|
|
8
|
+
*/
|
|
9
|
+
export type IdeaSource = 'rejected_plan' | 'archived_conversation' | 'unexplored_alternative';
|
|
10
|
+
export interface RecoverableIdea {
|
|
11
|
+
/** Unique ID for this idea view (e.g. `idea:rejected_plan:plan_123`) */
|
|
12
|
+
id: string;
|
|
13
|
+
sourceType: IdeaSource;
|
|
14
|
+
/** The ID of the actual entity in the graph (PendingPlan, Conversation, or DecisionTrace) */
|
|
15
|
+
sourceEntityId: string;
|
|
16
|
+
title: string;
|
|
17
|
+
description: string;
|
|
18
|
+
createdAt: string;
|
|
19
|
+
/** Source-specific payload data (e.g. operations for a plan, alternate text for a decision) */
|
|
20
|
+
payload?: Record<string, unknown>;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/plugins/idea-garden/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,MAAM,UAAU,GAAG,eAAe,GAAG,uBAAuB,GAAG,wBAAwB,CAAC;AAE9F,MAAM,WAAW,eAAe;IAC9B,wEAAwE;IACxE,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,UAAU,CAAC;IACvB,6FAA6F;IAC7F,cAAc,EAAE,MAAM,CAAC;IAEvB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAElB,+FAA+F;IAC/F,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plan Approval — Trellis plugin for multi-turn planning with buffered
|
|
3
|
+
* mutations and user approval.
|
|
4
|
+
*
|
|
5
|
+
* @module trellis/plugins/plan-approval
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import {
|
|
10
|
+
* createPlanApprovalPlugin,
|
|
11
|
+
* PlanManager,
|
|
12
|
+
* registerPlanTools,
|
|
13
|
+
* } from 'trellis/plugins/plan-approval';
|
|
14
|
+
*
|
|
15
|
+
* // 1. Register the plugin
|
|
16
|
+
* const plugin = createPlanApprovalPlugin();
|
|
17
|
+
* pluginRegistry.register(plugin);
|
|
18
|
+
* await pluginRegistry.load('trellis:plan-approval', kernel, ontologyRegistry);
|
|
19
|
+
*
|
|
20
|
+
* // 2. Create a plan manager and register tools with the harness
|
|
21
|
+
* const planManager = new PlanManager(kernel);
|
|
22
|
+
* await registerPlanTools(harness, { planManager });
|
|
23
|
+
*
|
|
24
|
+
* // 3. Agent can now use enterPlanMode, planCreateEntity, submitPlan tools
|
|
25
|
+
* // The harness will pause on submitPlan and set run status to plan_pending
|
|
26
|
+
*
|
|
27
|
+
* // 4. After user reviews:
|
|
28
|
+
* const result = await planManager.approvePlan('user:trent');
|
|
29
|
+
* // or: await planManager.rejectPlan('Not the right approach', 'user:trent');
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export { planApprovalOntology } from './ontology.js';
|
|
33
|
+
export { createPlanApprovalPlugin } from './plugin.js';
|
|
34
|
+
export { PlanManager, type PlannedOperation, type PendingPlan, type PlanStatus, type OperationKind, type ApprovalResult, } from './plan-manager.js';
|
|
35
|
+
export { registerPlanTools, createEnterPlanModeTool, createPlanCreateEntityTool, createPlanUpdateEntityTool, createPlanAddLinkTool, createSubmitPlanTool, createCancelPlanTool, type PlanToolContext, } from './plugin.js';
|
|
36
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/plan-approval/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAGH,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAGrD,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAGvD,OAAO,EACL,WAAW,EACX,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,cAAc,GACpB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,0BAA0B,EAC1B,0BAA0B,EAC1B,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,KAAK,eAAe,GACrB,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plan Approval Ontology — Schema definitions for PendingPlan and PlannedOperation entities.
|
|
3
|
+
*
|
|
4
|
+
* Plans are first-class graph entities so they can be queried, linked to runs,
|
|
5
|
+
* and preserved for the Idea Garden when rejected.
|
|
6
|
+
*
|
|
7
|
+
* @module trellis/plugins/plan-approval
|
|
8
|
+
*/
|
|
9
|
+
import type { OntologySchema } from '../../core/ontology/types.js';
|
|
10
|
+
export declare const planApprovalOntology: OntologySchema;
|
|
11
|
+
//# sourceMappingURL=ontology.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ontology.d.ts","sourceRoot":"","sources":["../../../src/plugins/plan-approval/ontology.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAEnE,eAAO,MAAM,oBAAoB,EAAE,cA8DlC,CAAC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plan Manager — Coordinates multi-turn planning with buffered mutations.
|
|
3
|
+
*
|
|
4
|
+
* When plan mode is active, the PlanManager buffers intended graph operations
|
|
5
|
+
* as structured data instead of executing them. On approval, it replays them
|
|
6
|
+
* as real kernel calls. On rejection, the plan is preserved as an entity for
|
|
7
|
+
* the Idea Garden.
|
|
8
|
+
*
|
|
9
|
+
* @module trellis/plugins/plan-approval
|
|
10
|
+
*/
|
|
11
|
+
import type { TrellisKernel, MutateResult } from '../../core/kernel/trellis-kernel.js';
|
|
12
|
+
import type { Atom } from '../../core/store/eav-store.js';
|
|
13
|
+
export type OperationKind = 'createEntity' | 'updateEntity' | 'deleteEntity' | 'addLink' | 'removeLink';
|
|
14
|
+
export interface PlannedOperation {
|
|
15
|
+
id: string;
|
|
16
|
+
kind: OperationKind;
|
|
17
|
+
entityId?: string;
|
|
18
|
+
entityType?: string;
|
|
19
|
+
attributes?: Record<string, Atom>;
|
|
20
|
+
sourceId?: string;
|
|
21
|
+
targetId?: string;
|
|
22
|
+
linkAttribute?: string;
|
|
23
|
+
description?: string;
|
|
24
|
+
sequence: number;
|
|
25
|
+
}
|
|
26
|
+
export type PlanStatus = 'drafting' | 'submitted' | 'approved' | 'rejected';
|
|
27
|
+
export interface PendingPlan {
|
|
28
|
+
id: string;
|
|
29
|
+
status: PlanStatus;
|
|
30
|
+
title: string;
|
|
31
|
+
description?: string;
|
|
32
|
+
operations: PlannedOperation[];
|
|
33
|
+
createdAt: string;
|
|
34
|
+
submittedAt?: string;
|
|
35
|
+
resolvedAt?: string;
|
|
36
|
+
resolvedBy?: string;
|
|
37
|
+
rejectionReason?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface ApprovalResult {
|
|
40
|
+
planId: string;
|
|
41
|
+
operationsExecuted: number;
|
|
42
|
+
results: MutateResult[];
|
|
43
|
+
}
|
|
44
|
+
export declare class PlanManager {
|
|
45
|
+
private kernel;
|
|
46
|
+
private activePlan;
|
|
47
|
+
constructor(kernel: TrellisKernel);
|
|
48
|
+
/**
|
|
49
|
+
* Enter plan mode. Creates a PendingPlan entity in the graph and sets it
|
|
50
|
+
* as the active plan. All subsequent `addOperation()` calls buffer into it.
|
|
51
|
+
*/
|
|
52
|
+
enterPlanMode(title: string, description?: string): Promise<string>;
|
|
53
|
+
/**
|
|
54
|
+
* Whether a plan is currently being drafted.
|
|
55
|
+
*/
|
|
56
|
+
isInPlanMode(): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Get the active plan (if any).
|
|
59
|
+
*/
|
|
60
|
+
getActivePlan(): PendingPlan | null;
|
|
61
|
+
/**
|
|
62
|
+
* Buffer a planned graph operation. Only valid in plan mode.
|
|
63
|
+
* Returns the operation ID.
|
|
64
|
+
*/
|
|
65
|
+
addOperation(op: Omit<PlannedOperation, 'id' | 'sequence'>): Promise<string>;
|
|
66
|
+
planCreateEntity(entityId: string, entityType: string, attributes?: Record<string, Atom>, description?: string): Promise<string>;
|
|
67
|
+
planUpdateEntity(entityId: string, attributes: Record<string, Atom>, description?: string): Promise<string>;
|
|
68
|
+
planDeleteEntity(entityId: string, description?: string): Promise<string>;
|
|
69
|
+
planAddLink(sourceId: string, linkAttribute: string, targetId: string, description?: string): Promise<string>;
|
|
70
|
+
planRemoveLink(sourceId: string, linkAttribute: string, targetId: string, description?: string): Promise<string>;
|
|
71
|
+
/**
|
|
72
|
+
* Submit the active plan for review. Marks it as submitted and returns
|
|
73
|
+
* the plan for the caller to present to the user.
|
|
74
|
+
*/
|
|
75
|
+
submitPlan(): Promise<PendingPlan>;
|
|
76
|
+
/**
|
|
77
|
+
* Approve a submitted plan. Replays all buffered operations against the
|
|
78
|
+
* real kernel in sequence order. Returns the results of each operation.
|
|
79
|
+
*/
|
|
80
|
+
approvePlan(resolvedBy?: string): Promise<ApprovalResult>;
|
|
81
|
+
/**
|
|
82
|
+
* Reject a submitted plan. The plan and its operations remain in the graph
|
|
83
|
+
* as entities, preserving them as substrate for the Idea Garden (Phase 6).
|
|
84
|
+
*/
|
|
85
|
+
rejectPlan(reason?: string, resolvedBy?: string): Promise<void>;
|
|
86
|
+
/**
|
|
87
|
+
* Cancel a drafting plan without submitting. Like rejection but for
|
|
88
|
+
* plans that were never submitted.
|
|
89
|
+
*/
|
|
90
|
+
cancelPlan(): Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* Load a plan from the graph by ID, including its operations.
|
|
93
|
+
*/
|
|
94
|
+
loadPlan(planId: string): PendingPlan | null;
|
|
95
|
+
/**
|
|
96
|
+
* List all plans, optionally filtered by status.
|
|
97
|
+
*/
|
|
98
|
+
listPlans(status?: PlanStatus): PendingPlan[];
|
|
99
|
+
/**
|
|
100
|
+
* Execute a single planned operation against the real kernel.
|
|
101
|
+
*/
|
|
102
|
+
private _executeOperation;
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=plan-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan-manager.d.ts","sourceRoot":"","sources":["../../../src/plugins/plan-approval/plan-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;G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