cognitive-modules-cli 1.3.0 → 1.4.1
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/index.d.ts +3 -1
- package/dist/index.js +7 -1
- package/dist/mcp/server.js +1 -1
- package/dist/modules/runner.d.ts +44 -2
- package/dist/modules/runner.js +604 -2
- package/dist/providers/base.d.ts +45 -1
- package/dist/providers/base.js +67 -0
- package/dist/providers/openai.d.ts +27 -3
- package/dist/providers/openai.js +175 -3
- package/dist/server/http.js +2 -2
- package/dist/types.d.ts +308 -1
- package/dist/types.js +120 -1
- package/package.json +1 -1
- package/src/index.ts +11 -0
- package/src/mcp/server.ts +1 -1
- package/src/modules/runner.ts +797 -3
- package/src/providers/base.ts +86 -1
- package/src/providers/openai.ts +226 -4
- package/src/server/http.ts +2 -2
- package/src/types.ts +454 -1
package/dist/index.d.ts
CHANGED
|
@@ -5,5 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export type { Provider, InvokeParams, InvokeResult, Message, CognitiveModule, ModuleResult, ModuleInput, ModuleConstraints, ToolsPolicy, OutputContract, FailureContract, CommandContext, CommandResult, } from './types.js';
|
|
7
7
|
export { getProvider, listProviders, GeminiProvider, OpenAIProvider, AnthropicProvider, BaseProvider, } from './providers/index.js';
|
|
8
|
-
export { loadModule, findModule, listModules, getDefaultSearchPaths, runModule, } from './modules/index.js';
|
|
8
|
+
export { loadModule, findModule, listModules, getDefaultSearchPaths, runModule, SubagentOrchestrator, runWithSubagents, parseCalls, createContext, } from './modules/index.js';
|
|
9
|
+
export { serve as serveHttp, createServer } from './server/index.js';
|
|
10
|
+
export { serve as serveMcp } from './mcp/index.js';
|
|
9
11
|
export { run, list, pipe } from './commands/index.js';
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,12 @@
|
|
|
6
6
|
// Providers
|
|
7
7
|
export { getProvider, listProviders, GeminiProvider, OpenAIProvider, AnthropicProvider, BaseProvider, } from './providers/index.js';
|
|
8
8
|
// Modules
|
|
9
|
-
export { loadModule, findModule, listModules, getDefaultSearchPaths, runModule,
|
|
9
|
+
export { loadModule, findModule, listModules, getDefaultSearchPaths, runModule,
|
|
10
|
+
// Subagent
|
|
11
|
+
SubagentOrchestrator, runWithSubagents, parseCalls, createContext, } from './modules/index.js';
|
|
12
|
+
// Server
|
|
13
|
+
export { serve as serveHttp, createServer } from './server/index.js';
|
|
14
|
+
// MCP
|
|
15
|
+
export { serve as serveMcp } from './mcp/index.js';
|
|
10
16
|
// Commands
|
|
11
17
|
export { run, list, pipe } from './commands/index.js';
|
package/dist/mcp/server.js
CHANGED
|
@@ -17,7 +17,7 @@ import { getProvider } from '../providers/index.js';
|
|
|
17
17
|
// =============================================================================
|
|
18
18
|
const server = new Server({
|
|
19
19
|
name: 'cognitive-modules',
|
|
20
|
-
version: '1.
|
|
20
|
+
version: '1.3.0',
|
|
21
21
|
}, {
|
|
22
22
|
capabilities: {
|
|
23
23
|
tools: {},
|
package/dist/modules/runner.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Module Runner - Execute Cognitive Modules
|
|
3
|
-
* v2.
|
|
3
|
+
* v2.5: Streaming response and multimodal support
|
|
4
4
|
*/
|
|
5
|
-
import type { Provider, CognitiveModule, ModuleResult, ModuleInput } from '../types.js';
|
|
5
|
+
import type { Provider, CognitiveModule, ModuleResult, ModuleInput, StreamingChunk, MediaInput, ModalityType, RuntimeCapabilities } from '../types.js';
|
|
6
6
|
export interface RunOptions {
|
|
7
7
|
input?: ModuleInput;
|
|
8
8
|
args?: string;
|
|
@@ -12,3 +12,45 @@ export interface RunOptions {
|
|
|
12
12
|
enableRepair?: boolean;
|
|
13
13
|
}
|
|
14
14
|
export declare function runModule(module: CognitiveModule, provider: Provider, options?: RunOptions): Promise<ModuleResult>;
|
|
15
|
+
export interface StreamRunOptions extends RunOptions {
|
|
16
|
+
/** Callback for each chunk */
|
|
17
|
+
onChunk?: (chunk: StreamingChunk) => void;
|
|
18
|
+
/** Callback for progress updates */
|
|
19
|
+
onProgress?: (percent: number, message?: string) => void;
|
|
20
|
+
/** Heartbeat interval in milliseconds (default: 15000) */
|
|
21
|
+
heartbeatInterval?: number;
|
|
22
|
+
/** Maximum stream duration in milliseconds (default: 300000) */
|
|
23
|
+
maxDuration?: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Run module with streaming response
|
|
27
|
+
*
|
|
28
|
+
* @param module - The cognitive module to execute
|
|
29
|
+
* @param provider - The LLM provider
|
|
30
|
+
* @param options - Run options including streaming callbacks
|
|
31
|
+
* @yields Streaming chunks
|
|
32
|
+
*/
|
|
33
|
+
export declare function runModuleStream(module: CognitiveModule, provider: Provider, options?: StreamRunOptions): AsyncGenerator<StreamingChunk, ModuleResult | undefined, unknown>;
|
|
34
|
+
/**
|
|
35
|
+
* Load media file as base64
|
|
36
|
+
*/
|
|
37
|
+
export declare function loadMediaAsBase64(path: string): Promise<{
|
|
38
|
+
data: string;
|
|
39
|
+
media_type: string;
|
|
40
|
+
} | null>;
|
|
41
|
+
/**
|
|
42
|
+
* Validate media input against module constraints
|
|
43
|
+
*/
|
|
44
|
+
export declare function validateMediaInput(media: MediaInput, module: CognitiveModule, maxSizeMb?: number): {
|
|
45
|
+
valid: boolean;
|
|
46
|
+
error?: string;
|
|
47
|
+
code?: string;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Get runtime capabilities
|
|
51
|
+
*/
|
|
52
|
+
export declare function getRuntimeCapabilities(): RuntimeCapabilities;
|
|
53
|
+
/**
|
|
54
|
+
* Check if runtime supports a specific modality
|
|
55
|
+
*/
|
|
56
|
+
export declare function runtimeSupportsModality(modality: ModalityType, direction?: 'input' | 'output'): boolean;
|