cognitive-modules-cli 2.2.10 → 2.2.12
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/CHANGELOG.md +9 -0
- package/README.md +47 -40
- package/dist/cli-args.d.ts +34 -0
- package/dist/cli-args.js +149 -0
- package/dist/cli.js +86 -75
- package/dist/commands/add.js +2 -2
- package/dist/commands/compose.js +1 -24
- package/dist/commands/conformance.d.ts +39 -0
- package/dist/commands/conformance.js +517 -0
- package/dist/commands/index.d.ts +1 -0
- package/dist/commands/index.js +1 -0
- package/dist/commands/pipe.js +1 -16
- package/dist/commands/run.js +1 -22
- package/dist/modules/composition.d.ts +3 -3
- package/dist/modules/composition.js +4 -3
- package/dist/modules/json-extract.d.ts +7 -0
- package/dist/modules/json-extract.js +132 -0
- package/dist/modules/runner.d.ts +11 -1
- package/dist/modules/runner.js +614 -47
- package/dist/policy-summary.d.ts +16 -0
- package/dist/policy-summary.js +33 -0
- package/dist/profile.d.ts +1 -0
- package/dist/profile.js +38 -17
- package/dist/providers/base.d.ts +2 -1
- package/dist/providers/base.js +6 -0
- package/dist/providers/gemini.d.ts +5 -0
- package/dist/providers/gemini.js +57 -7
- package/dist/providers/index.d.ts +10 -1
- package/dist/providers/index.js +34 -8
- package/dist/providers/moonshot.d.ts +3 -0
- package/dist/providers/moonshot.js +58 -13
- package/dist/registry/assets.d.ts +8 -0
- package/dist/registry/assets.js +48 -13
- package/dist/types.d.ts +43 -3
- package/package.json +3 -2
package/dist/types.d.ts
CHANGED
|
@@ -2,10 +2,49 @@
|
|
|
2
2
|
* Cognitive Runtime - Core Types
|
|
3
3
|
* Version 2.2 - With Control/Data plane separation, tier, overflow, extensible enums
|
|
4
4
|
*/
|
|
5
|
+
/**
|
|
6
|
+
* Provider structured output support levels.
|
|
7
|
+
*
|
|
8
|
+
* - none: provider does not accept a schema hint (runtime will still validate/repair post-hoc)
|
|
9
|
+
* - prompt: schema is injected into the prompt as guidance (best-effort)
|
|
10
|
+
* - native: provider supports a native structured output / response schema API surface
|
|
11
|
+
*/
|
|
12
|
+
export type StructuredOutputMode = 'none' | 'prompt' | 'native';
|
|
13
|
+
/** If a schema is passed, how it should be applied. */
|
|
14
|
+
export type JsonSchemaMode = Exclude<StructuredOutputMode, 'none'>;
|
|
15
|
+
/**
|
|
16
|
+
* Dialect for a provider-native structured output API.
|
|
17
|
+
*
|
|
18
|
+
* The runtime's schemas are JSON Schema (draft-2020-12-ish). Some providers expose a "native schema"
|
|
19
|
+
* API surface, but it may not accept JSON Schema directly.
|
|
20
|
+
*/
|
|
21
|
+
export type NativeSchemaDialect = 'json-schema' | 'gemini-responseSchema';
|
|
22
|
+
/**
|
|
23
|
+
* Runtime preference for how to apply structured output.
|
|
24
|
+
*
|
|
25
|
+
* - auto: choose based on provider capabilities (and allow safe downgrade from native -> prompt)
|
|
26
|
+
* - off: do not pass schema hints to providers (runtime can still validate/repair post-hoc)
|
|
27
|
+
* - prompt: always inject schema as prompt guidance
|
|
28
|
+
* - native: always use provider-native structured output when available (no auto downgrade)
|
|
29
|
+
*/
|
|
30
|
+
export type StructuredOutputPreference = 'auto' | 'off' | 'prompt' | 'native';
|
|
31
|
+
export interface ProviderCapabilities {
|
|
32
|
+
structuredOutput: StructuredOutputMode;
|
|
33
|
+
streaming: boolean;
|
|
34
|
+
/** If structuredOutput === 'native', which dialect the provider expects. Defaults to 'json-schema'. */
|
|
35
|
+
nativeSchemaDialect?: NativeSchemaDialect;
|
|
36
|
+
/** Optional hint for safety limits (bytes) when passing native schemas. */
|
|
37
|
+
maxNativeSchemaBytes?: number;
|
|
38
|
+
}
|
|
5
39
|
export interface Provider {
|
|
6
40
|
name: string;
|
|
7
41
|
invoke(params: InvokeParams): Promise<InvokeResult>;
|
|
8
42
|
isConfigured(): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Optional capability surface for "publish-grade" behavior parity.
|
|
45
|
+
* If absent, the runtime assumes structuredOutput='prompt' and streaming based on supportsStreaming().
|
|
46
|
+
*/
|
|
47
|
+
getCapabilities?(): ProviderCapabilities;
|
|
9
48
|
/**
|
|
10
49
|
* Stream-based invoke (optional).
|
|
11
50
|
* Returns an async generator that yields content chunks.
|
|
@@ -21,6 +60,7 @@ export interface Provider {
|
|
|
21
60
|
export interface InvokeParams {
|
|
22
61
|
messages: Message[];
|
|
23
62
|
jsonSchema?: object;
|
|
63
|
+
jsonSchemaMode?: JsonSchemaMode;
|
|
24
64
|
temperature?: number;
|
|
25
65
|
maxTokens?: number;
|
|
26
66
|
}
|
|
@@ -386,11 +426,10 @@ export interface CommandResultV2 {
|
|
|
386
426
|
/**
|
|
387
427
|
* Execution profile:
|
|
388
428
|
* - core: minimal constraints (5-minute path)
|
|
389
|
-
* -
|
|
390
|
-
* - strict: higher assurance (more enforcement)
|
|
429
|
+
* - standard: safe defaults for day-to-day usage
|
|
391
430
|
* - certified: strongest gates (intended for publishable / regulated flows)
|
|
392
431
|
*/
|
|
393
|
-
export type ExecutionProfile = 'core' | '
|
|
432
|
+
export type ExecutionProfile = 'core' | 'standard' | 'certified';
|
|
394
433
|
/** Validation mode for input/output schemas and runtime enforcement. */
|
|
395
434
|
export type ValidateMode = 'auto' | 'on' | 'off';
|
|
396
435
|
export interface ExecutionPolicy {
|
|
@@ -398,6 +437,7 @@ export interface ExecutionPolicy {
|
|
|
398
437
|
validate: ValidateMode;
|
|
399
438
|
audit: boolean;
|
|
400
439
|
enableRepair: boolean;
|
|
440
|
+
structured: StructuredOutputPreference;
|
|
401
441
|
/**
|
|
402
442
|
* If true, refuse to run non-v2.2 modules (legacy/v0/v1 or missing formatVersion).
|
|
403
443
|
* This is a gate for certification-style flows.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cognitive-modules-cli",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.12",
|
|
4
4
|
"description": "Cognitive Modules - Structured AI Task Execution with version management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
],
|
|
49
49
|
"repository": {
|
|
50
50
|
"type": "git",
|
|
51
|
-
"url": "https://github.com/Cognary/cognitive.git"
|
|
51
|
+
"url": "git+https://github.com/Cognary/cognitive.git"
|
|
52
52
|
},
|
|
53
53
|
"homepage": "https://cognary.github.io/cognitive/",
|
|
54
54
|
"bugs": {
|
|
@@ -62,6 +62,7 @@
|
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"ajv": "^8.12.0",
|
|
65
|
+
"ajv-formats": "^3.0.1",
|
|
65
66
|
"js-yaml": "^4.1.1"
|
|
66
67
|
},
|
|
67
68
|
"optionalDependencies": {
|