@portel/photon-core 1.0.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 +21 -0
- package/README.md +403 -0
- package/dist/base.d.ts +58 -0
- package/dist/base.d.ts.map +1 -0
- package/dist/base.js +92 -0
- package/dist/base.js.map +1 -0
- package/dist/dependency-manager.d.ts +49 -0
- package/dist/dependency-manager.d.ts.map +1 -0
- package/dist/dependency-manager.js +165 -0
- package/dist/dependency-manager.js.map +1 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +43 -0
- package/dist/index.js.map +1 -0
- package/dist/schema-extractor.d.ts +110 -0
- package/dist/schema-extractor.d.ts.map +1 -0
- package/dist/schema-extractor.js +727 -0
- package/dist/schema-extractor.js.map +1 -0
- package/dist/types.d.ts +109 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +12 -0
- package/dist/types.js.map +1 -0
- package/package.json +58 -0
- package/src/base.ts +105 -0
- package/src/dependency-manager.ts +206 -0
- package/src/index.ts +46 -0
- package/src/schema-extractor.ts +833 -0
- package/src/types.ts +117 -0
package/src/types.ts
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Photon MCP Core Types
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export interface PhotonTool {
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
inputSchema: {
|
|
9
|
+
type: 'object';
|
|
10
|
+
properties: Record<string, any>;
|
|
11
|
+
required?: string[];
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface ExtractedSchema {
|
|
16
|
+
name: string;
|
|
17
|
+
description: string;
|
|
18
|
+
inputSchema: {
|
|
19
|
+
type: 'object';
|
|
20
|
+
properties: Record<string, any>;
|
|
21
|
+
required?: string[];
|
|
22
|
+
};
|
|
23
|
+
format?: 'primitive' | 'table' | 'tree' | 'list' | 'none';
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface PhotonMCPClass {
|
|
27
|
+
name: string;
|
|
28
|
+
description?: string;
|
|
29
|
+
tools: PhotonTool[];
|
|
30
|
+
instance: any;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface ConstructorParam {
|
|
34
|
+
name: string;
|
|
35
|
+
type: string;
|
|
36
|
+
isOptional: boolean;
|
|
37
|
+
hasDefault: boolean;
|
|
38
|
+
defaultValue?: any;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Template type - for text generation with variable substitution
|
|
43
|
+
* Maps to MCP Prompts, HTTP template endpoints, CLI help generators, etc.
|
|
44
|
+
*/
|
|
45
|
+
export type Template = string & { __brand: 'Template' };
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Static type - for read-only data/content
|
|
49
|
+
* Maps to MCP Resources, HTTP GET endpoints, CLI read commands, etc.
|
|
50
|
+
*/
|
|
51
|
+
export type Static = string & { __brand: 'Static' };
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Helper to cast string as Template (optional, for clarity)
|
|
55
|
+
*/
|
|
56
|
+
export const asTemplate = (str: string): Template => str as Template;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Helper to cast string as Static (optional, for clarity)
|
|
60
|
+
*/
|
|
61
|
+
export const asStatic = (str: string): Static => str as Static;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Message format for templates (MCP compatibility)
|
|
65
|
+
*/
|
|
66
|
+
export interface TemplateMessage {
|
|
67
|
+
role: 'user' | 'assistant';
|
|
68
|
+
content: {
|
|
69
|
+
type: 'text' | 'image';
|
|
70
|
+
text?: string;
|
|
71
|
+
data?: string;
|
|
72
|
+
mimeType?: string;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Template response format (for advanced cases)
|
|
78
|
+
*/
|
|
79
|
+
export interface TemplateResponse {
|
|
80
|
+
messages: TemplateMessage[];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Template metadata
|
|
85
|
+
*/
|
|
86
|
+
export interface TemplateInfo {
|
|
87
|
+
name: string;
|
|
88
|
+
description: string;
|
|
89
|
+
inputSchema: {
|
|
90
|
+
type: 'object';
|
|
91
|
+
properties: Record<string, any>;
|
|
92
|
+
required?: string[];
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Static resource metadata
|
|
98
|
+
*/
|
|
99
|
+
export interface StaticInfo {
|
|
100
|
+
name: string;
|
|
101
|
+
uri: string;
|
|
102
|
+
description: string;
|
|
103
|
+
mimeType?: string;
|
|
104
|
+
inputSchema: {
|
|
105
|
+
type: 'object';
|
|
106
|
+
properties: Record<string, any>;
|
|
107
|
+
required?: string[];
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Extended PhotonMCPClass with templates and statics
|
|
113
|
+
*/
|
|
114
|
+
export interface PhotonMCPClassExtended extends PhotonMCPClass {
|
|
115
|
+
templates: TemplateInfo[];
|
|
116
|
+
statics: StaticInfo[];
|
|
117
|
+
}
|