@llm-dev-ops/agentics-cli 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/README.md +1 -0
- package/dist/adapters/base-adapter.d.ts +73 -0
- package/dist/adapters/base-adapter.d.ts.map +1 -0
- package/dist/adapters/base-adapter.js +311 -0
- package/dist/adapters/base-adapter.js.map +1 -0
- package/dist/adapters/index.d.ts +8 -0
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/index.js +7 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/audit/audit-trail.d.ts +68 -0
- package/dist/audit/audit-trail.d.ts.map +1 -0
- package/dist/audit/audit-trail.js +172 -0
- package/dist/audit/audit-trail.js.map +1 -0
- package/dist/cli/index.d.ts +15 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +265 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/commands/deploy.d.ts +23 -0
- package/dist/commands/deploy.d.ts.map +1 -0
- package/dist/commands/deploy.js +97 -0
- package/dist/commands/deploy.js.map +1 -0
- package/dist/commands/diligence.d.ts +23 -0
- package/dist/commands/diligence.d.ts.map +1 -0
- package/dist/commands/diligence.js +97 -0
- package/dist/commands/diligence.js.map +1 -0
- package/dist/commands/export.d.ts +23 -0
- package/dist/commands/export.d.ts.map +1 -0
- package/dist/commands/export.js +99 -0
- package/dist/commands/export.js.map +1 -0
- package/dist/commands/index.d.ts +20 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +13 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/inspect.d.ts +25 -0
- package/dist/commands/inspect.d.ts.map +1 -0
- package/dist/commands/inspect.js +101 -0
- package/dist/commands/inspect.js.map +1 -0
- package/dist/commands/plan.d.ts +23 -0
- package/dist/commands/plan.d.ts.map +1 -0
- package/dist/commands/plan.js +114 -0
- package/dist/commands/plan.js.map +1 -0
- package/dist/commands/quantify.d.ts +26 -0
- package/dist/commands/quantify.d.ts.map +1 -0
- package/dist/commands/quantify.js +102 -0
- package/dist/commands/quantify.js.map +1 -0
- package/dist/commands/simulate.d.ts +23 -0
- package/dist/commands/simulate.d.ts.map +1 -0
- package/dist/commands/simulate.js +97 -0
- package/dist/commands/simulate.js.map +1 -0
- package/dist/config/endpoints.d.ts +16 -0
- package/dist/config/endpoints.d.ts.map +1 -0
- package/dist/config/endpoints.js +73 -0
- package/dist/config/endpoints.js.map +1 -0
- package/dist/errors/index.d.ts +120 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +281 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/modules/artifact-handoff.d.ts +57 -0
- package/dist/modules/artifact-handoff.d.ts.map +1 -0
- package/dist/modules/artifact-handoff.js +85 -0
- package/dist/modules/artifact-handoff.js.map +1 -0
- package/dist/modules/command-parser.d.ts +28 -0
- package/dist/modules/command-parser.d.ts.map +1 -0
- package/dist/modules/command-parser.js +176 -0
- package/dist/modules/command-parser.js.map +1 -0
- package/dist/modules/index.d.ts +14 -0
- package/dist/modules/index.d.ts.map +1 -0
- package/dist/modules/index.js +10 -0
- package/dist/modules/index.js.map +1 -0
- package/dist/modules/orchestration-engine.d.ts +43 -0
- package/dist/modules/orchestration-engine.d.ts.map +1 -0
- package/dist/modules/orchestration-engine.js +159 -0
- package/dist/modules/orchestration-engine.js.map +1 -0
- package/dist/modules/output-renderer.d.ts +51 -0
- package/dist/modules/output-renderer.d.ts.map +1 -0
- package/dist/modules/output-renderer.js +193 -0
- package/dist/modules/output-renderer.js.map +1 -0
- package/dist/types/index.d.ts +223 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +33 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +64 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Export Command
|
|
3
|
+
*
|
|
4
|
+
* SPARC Pseudocode Reference: §2.4
|
|
5
|
+
*
|
|
6
|
+
* FLOW:
|
|
7
|
+
* 1. Parse arguments → CommandObject
|
|
8
|
+
* 2. Generate exports via agentics-deployment-exporters
|
|
9
|
+
* 3. Record audit entry
|
|
10
|
+
* 4. Return ExportReference
|
|
11
|
+
*/
|
|
12
|
+
import { ExportersAdapter } from '../adapters/base-adapter.js';
|
|
13
|
+
import { createOrchestrationEngine, } from '../modules/orchestration-engine.js';
|
|
14
|
+
import { createArtifactHandoff } from '../modules/artifact-handoff.js';
|
|
15
|
+
import { createAuditTrail } from '../audit/audit-trail.js';
|
|
16
|
+
import { failFast } from '../errors/index.js';
|
|
17
|
+
import { loadEndpointConfig } from '../config/endpoints.js';
|
|
18
|
+
// ============================================================================
|
|
19
|
+
// Export Command Implementation
|
|
20
|
+
// ============================================================================
|
|
21
|
+
export async function executeExportCommand(input, options) {
|
|
22
|
+
const correlationId = options.trace_id ?? crypto.randomUUID();
|
|
23
|
+
const startTime = Date.now();
|
|
24
|
+
// Initialize components
|
|
25
|
+
const engine = createOrchestrationEngine(correlationId);
|
|
26
|
+
const handoff = createArtifactHandoff();
|
|
27
|
+
const audit = createAuditTrail();
|
|
28
|
+
// Create adapter
|
|
29
|
+
const exportersConfig = loadEndpointConfig('agentics-deployment-exporters');
|
|
30
|
+
const exportersAdapter = new ExportersAdapter(exportersConfig, correlationId);
|
|
31
|
+
// Define orchestration stages
|
|
32
|
+
const stages = [
|
|
33
|
+
{
|
|
34
|
+
name: 'generate-export',
|
|
35
|
+
adapter: exportersAdapter,
|
|
36
|
+
request: {
|
|
37
|
+
endpoint: '/api/v1/exports/generate',
|
|
38
|
+
method: 'POST',
|
|
39
|
+
buildBody: () => ({
|
|
40
|
+
intent_ref: handoff.passthrough(input.intentRef),
|
|
41
|
+
format_spec: {
|
|
42
|
+
format: input.format,
|
|
43
|
+
output_path: input.outputPath,
|
|
44
|
+
},
|
|
45
|
+
}),
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
];
|
|
49
|
+
try {
|
|
50
|
+
// Execute orchestration
|
|
51
|
+
const result = await engine.execute(stages, options);
|
|
52
|
+
if (!result.success) {
|
|
53
|
+
const failedStage = result.stages.find(s => s.status === 'failed');
|
|
54
|
+
throw new Error(failedStage?.error?.message ?? 'Export generation failed');
|
|
55
|
+
}
|
|
56
|
+
// Extract export reference
|
|
57
|
+
const exportStage = result.stages.find(s => s.name === 'generate-export');
|
|
58
|
+
const exportRef = handoff.extractReference(exportStage?.response);
|
|
59
|
+
// Record audit entry
|
|
60
|
+
audit.record({
|
|
61
|
+
command: 'export',
|
|
62
|
+
inputs: { intentRef: input.intentRef.id, format: input.format, outputPath: input.outputPath },
|
|
63
|
+
outputs: exportRef,
|
|
64
|
+
dependencies: [
|
|
65
|
+
{ service: 'agentics-deployment-exporters', method: 'generate', timestamp: new Date().toISOString(), duration_ms: result.timing.total, success: true },
|
|
66
|
+
],
|
|
67
|
+
duration_ms: result.timing.total,
|
|
68
|
+
status: 'SUCCESS',
|
|
69
|
+
trace_id: correlationId,
|
|
70
|
+
});
|
|
71
|
+
return {
|
|
72
|
+
reference: exportRef,
|
|
73
|
+
timing: Date.now() - startTime,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
// Record failure in audit
|
|
78
|
+
audit.record({
|
|
79
|
+
command: 'export',
|
|
80
|
+
inputs: { intentRef: input.intentRef.id, format: input.format },
|
|
81
|
+
outputs: null,
|
|
82
|
+
dependencies: [],
|
|
83
|
+
duration_ms: Date.now() - startTime,
|
|
84
|
+
status: 'FAILED',
|
|
85
|
+
error_code: error instanceof Error ? error.name : 'UNKNOWN',
|
|
86
|
+
error_message: error instanceof Error ? error.message : 'Unknown error',
|
|
87
|
+
trace_id: correlationId,
|
|
88
|
+
});
|
|
89
|
+
// Fail fast
|
|
90
|
+
failFast({
|
|
91
|
+
command: 'export',
|
|
92
|
+
phase: 'generation',
|
|
93
|
+
upstreamError: error instanceof Error ? error : new Error(String(error)),
|
|
94
|
+
inputs: input,
|
|
95
|
+
correlationId,
|
|
96
|
+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exports
|
|
3
|
+
*
|
|
4
|
+
* Re-exports all command implementations
|
|
5
|
+
*/
|
|
6
|
+
export { executePlanCommand } from './plan.js';
|
|
7
|
+
export type { PlanCommandInput, PlanCommandResult } from './plan.js';
|
|
8
|
+
export { executeSimulateCommand } from './simulate.js';
|
|
9
|
+
export type { SimulateCommandInput, SimulateCommandResult } from './simulate.js';
|
|
10
|
+
export { executeInspectCommand } from './inspect.js';
|
|
11
|
+
export type { InspectCommandInput, InspectCommandResult } from './inspect.js';
|
|
12
|
+
export { executeQuantifyCommand } from './quantify.js';
|
|
13
|
+
export type { QuantifyCommandInput, QuantifyCommandResult } from './quantify.js';
|
|
14
|
+
export { executeDeployCommand } from './deploy.js';
|
|
15
|
+
export type { DeployCommandInput, DeployCommandResult } from './deploy.js';
|
|
16
|
+
export { executeExportCommand } from './export.js';
|
|
17
|
+
export type { ExportCommandInput, ExportCommandResult } from './export.js';
|
|
18
|
+
export { executeDiligenceCommand } from './diligence.js';
|
|
19
|
+
export type { DiligenceCommandInput, DiligenceCommandResult } from './diligence.js';
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAErE,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACvD,YAAY,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAEjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,YAAY,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAE9E,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACvD,YAAY,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAEjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,YAAY,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAE3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,YAAY,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAE3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACzD,YAAY,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Command Exports
|
|
3
|
+
*
|
|
4
|
+
* Re-exports all command implementations
|
|
5
|
+
*/
|
|
6
|
+
export { executePlanCommand } from './plan.js';
|
|
7
|
+
export { executeSimulateCommand } from './simulate.js';
|
|
8
|
+
export { executeInspectCommand } from './inspect.js';
|
|
9
|
+
export { executeQuantifyCommand } from './quantify.js';
|
|
10
|
+
export { executeDeployCommand } from './deploy.js';
|
|
11
|
+
export { executeExportCommand } from './export.js';
|
|
12
|
+
export { executeDiligenceCommand } from './diligence.js';
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAG/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAGvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAGrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAGvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inspect Command
|
|
3
|
+
*
|
|
4
|
+
* SPARC Pseudocode Reference: §2.6
|
|
5
|
+
*
|
|
6
|
+
* FLOW:
|
|
7
|
+
* 1. Parse arguments → CommandObject
|
|
8
|
+
* 2. Retrieve simulation output via agentics-simulation-engine
|
|
9
|
+
* 3. Record audit entry
|
|
10
|
+
* 4. Return SimulationOutputReference
|
|
11
|
+
*
|
|
12
|
+
* PURPOSE: Retrieve deterministic simulation outputs from completed simulations
|
|
13
|
+
* The CLI does NOT interpret or transform outputs - passthrough only
|
|
14
|
+
*/
|
|
15
|
+
import type { CommandOptions, SimulationOutputReference, SimulationReference, SimulationOutputType } from '../types/index.js';
|
|
16
|
+
export interface InspectCommandInput {
|
|
17
|
+
simRef: SimulationReference;
|
|
18
|
+
outputType?: SimulationOutputType;
|
|
19
|
+
}
|
|
20
|
+
export interface InspectCommandResult {
|
|
21
|
+
reference: SimulationOutputReference;
|
|
22
|
+
timing: number;
|
|
23
|
+
}
|
|
24
|
+
export declare function executeInspectCommand(input: InspectCommandInput, options: CommandOptions): Promise<InspectCommandResult>;
|
|
25
|
+
//# sourceMappingURL=inspect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspect.d.ts","sourceRoot":"","sources":["../../src/commands/inspect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,yBAAyB,EACzB,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAe3B,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,mBAAmB,CAAC;IAC5B,UAAU,CAAC,EAAE,oBAAoB,CAAC;CACnC;AAED,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,yBAAyB,CAAC;IACrC,MAAM,EAAE,MAAM,CAAC;CAChB;AAMD,wBAAsB,qBAAqB,CACzC,KAAK,EAAE,mBAAmB,EAC1B,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,oBAAoB,CAAC,CAqF/B"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inspect Command
|
|
3
|
+
*
|
|
4
|
+
* SPARC Pseudocode Reference: §2.6
|
|
5
|
+
*
|
|
6
|
+
* FLOW:
|
|
7
|
+
* 1. Parse arguments → CommandObject
|
|
8
|
+
* 2. Retrieve simulation output via agentics-simulation-engine
|
|
9
|
+
* 3. Record audit entry
|
|
10
|
+
* 4. Return SimulationOutputReference
|
|
11
|
+
*
|
|
12
|
+
* PURPOSE: Retrieve deterministic simulation outputs from completed simulations
|
|
13
|
+
* The CLI does NOT interpret or transform outputs - passthrough only
|
|
14
|
+
*/
|
|
15
|
+
import { SimulationEngineAdapter } from '../adapters/base-adapter.js';
|
|
16
|
+
import { createOrchestrationEngine, } from '../modules/orchestration-engine.js';
|
|
17
|
+
import { createArtifactHandoff } from '../modules/artifact-handoff.js';
|
|
18
|
+
import { createAuditTrail } from '../audit/audit-trail.js';
|
|
19
|
+
import { failFast } from '../errors/index.js';
|
|
20
|
+
import { loadEndpointConfig } from '../config/endpoints.js';
|
|
21
|
+
// ============================================================================
|
|
22
|
+
// Inspect Command Implementation
|
|
23
|
+
// ============================================================================
|
|
24
|
+
export async function executeInspectCommand(input, options) {
|
|
25
|
+
const correlationId = options.trace_id ?? crypto.randomUUID();
|
|
26
|
+
const startTime = Date.now();
|
|
27
|
+
// Initialize components
|
|
28
|
+
const engine = createOrchestrationEngine(correlationId);
|
|
29
|
+
const handoff = createArtifactHandoff();
|
|
30
|
+
const audit = createAuditTrail();
|
|
31
|
+
// Create adapter
|
|
32
|
+
const engineConfig = loadEndpointConfig('agentics-simulation-engine');
|
|
33
|
+
const engineAdapter = new SimulationEngineAdapter(engineConfig, correlationId);
|
|
34
|
+
// Default output type
|
|
35
|
+
const outputType = input.outputType ?? 'summary';
|
|
36
|
+
// Define orchestration stages
|
|
37
|
+
const stages = [
|
|
38
|
+
{
|
|
39
|
+
name: 'retrieve-output',
|
|
40
|
+
adapter: engineAdapter,
|
|
41
|
+
request: {
|
|
42
|
+
endpoint: '/api/v1/outputs/retrieve',
|
|
43
|
+
method: 'POST',
|
|
44
|
+
buildBody: () => ({
|
|
45
|
+
sim_ref: handoff.passthrough(input.simRef),
|
|
46
|
+
output_type: outputType,
|
|
47
|
+
}),
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
];
|
|
51
|
+
try {
|
|
52
|
+
// Execute orchestration
|
|
53
|
+
const result = await engine.execute(stages, options);
|
|
54
|
+
if (!result.success) {
|
|
55
|
+
const failedStage = result.stages.find(s => s.status === 'failed');
|
|
56
|
+
throw new Error(failedStage?.error?.message ?? 'Output retrieval failed');
|
|
57
|
+
}
|
|
58
|
+
// Extract output reference
|
|
59
|
+
const outputStage = result.stages.find(s => s.name === 'retrieve-output');
|
|
60
|
+
const outputRef = handoff.extractReference(outputStage?.response);
|
|
61
|
+
// Record audit entry
|
|
62
|
+
audit.record({
|
|
63
|
+
command: 'inspect',
|
|
64
|
+
inputs: { simRef: input.simRef.id, outputType },
|
|
65
|
+
outputs: outputRef,
|
|
66
|
+
dependencies: [
|
|
67
|
+
{ service: 'agentics-simulation-engine', method: 'retrieve', timestamp: new Date().toISOString(), duration_ms: result.timing.total, success: true },
|
|
68
|
+
],
|
|
69
|
+
duration_ms: result.timing.total,
|
|
70
|
+
status: 'SUCCESS',
|
|
71
|
+
trace_id: correlationId,
|
|
72
|
+
});
|
|
73
|
+
return {
|
|
74
|
+
reference: outputRef,
|
|
75
|
+
timing: Date.now() - startTime,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
// Record failure in audit
|
|
80
|
+
audit.record({
|
|
81
|
+
command: 'inspect',
|
|
82
|
+
inputs: { simRef: input.simRef.id, outputType },
|
|
83
|
+
outputs: null,
|
|
84
|
+
dependencies: [],
|
|
85
|
+
duration_ms: Date.now() - startTime,
|
|
86
|
+
status: 'FAILED',
|
|
87
|
+
error_code: error instanceof Error ? error.name : 'UNKNOWN',
|
|
88
|
+
error_message: error instanceof Error ? error.message : 'Unknown error',
|
|
89
|
+
trace_id: correlationId,
|
|
90
|
+
});
|
|
91
|
+
// Fail fast
|
|
92
|
+
failFast({
|
|
93
|
+
command: 'inspect',
|
|
94
|
+
phase: 'retrieval',
|
|
95
|
+
upstreamError: error instanceof Error ? error : new Error(String(error)),
|
|
96
|
+
inputs: input,
|
|
97
|
+
correlationId,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=inspect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspect.js","sourceRoot":"","sources":["../../src/commands/inspect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAQH,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EACL,yBAAyB,GAE1B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAgB5D,+EAA+E;AAC/E,iCAAiC;AACjC,+EAA+E;AAE/E,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,KAA0B,EAC1B,OAAuB;IAEvB,MAAM,aAAa,GAAG,OAAO,CAAC,QAAQ,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;IAC9D,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAE7B,wBAAwB;IACxB,MAAM,MAAM,GAAG,yBAAyB,CAAC,aAAa,CAA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,QAAQ,CAAC;YACP,OAAO,EAAE,SAAS;YAClB,KAAK,EAAE,WAAW;YAClB,aAAa,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACxE,MAAM,EAAE,KAAK;YACb,aAAa;SACd,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plan Command
|
|
3
|
+
*
|
|
4
|
+
* SPARC Pseudocode Reference: §2.1
|
|
5
|
+
*
|
|
6
|
+
* FLOW:
|
|
7
|
+
* 1. Parse arguments → CommandObject
|
|
8
|
+
* 2. Select manifest via agentics-org-manifests
|
|
9
|
+
* 3. Create plan via agentics-simulation-planner
|
|
10
|
+
* 4. Record audit entry
|
|
11
|
+
* 5. Return PlanReference
|
|
12
|
+
*/
|
|
13
|
+
import type { CommandOptions, PlanReference } from '../types/index.js';
|
|
14
|
+
export interface PlanCommandInput {
|
|
15
|
+
manifestQuery: string;
|
|
16
|
+
params?: Record<string, unknown>;
|
|
17
|
+
}
|
|
18
|
+
export interface PlanCommandResult {
|
|
19
|
+
reference: PlanReference;
|
|
20
|
+
timing: number;
|
|
21
|
+
}
|
|
22
|
+
export declare function executePlanCommand(input: PlanCommandInput, options: CommandOptions): Promise<PlanCommandResult>;
|
|
23
|
+
//# sourceMappingURL=plan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../src/commands/plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACd,MAAM,mBAAmB,CAAC;AAkB3B,MAAM,WAAW,gBAAgB;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,aAAa,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;CAChB;AAMD,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,gBAAgB,EACvB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,iBAAiB,CAAC,CAoG5B"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plan Command
|
|
3
|
+
*
|
|
4
|
+
* SPARC Pseudocode Reference: §2.1
|
|
5
|
+
*
|
|
6
|
+
* FLOW:
|
|
7
|
+
* 1. Parse arguments → CommandObject
|
|
8
|
+
* 2. Select manifest via agentics-org-manifests
|
|
9
|
+
* 3. Create plan via agentics-simulation-planner
|
|
10
|
+
* 4. Record audit entry
|
|
11
|
+
* 5. Return PlanReference
|
|
12
|
+
*/
|
|
13
|
+
import { ManifestsAdapter, PlannerAdapter, } from '../adapters/base-adapter.js';
|
|
14
|
+
import { createOrchestrationEngine, } from '../modules/orchestration-engine.js';
|
|
15
|
+
import { createArtifactHandoff } from '../modules/artifact-handoff.js';
|
|
16
|
+
import { createAuditTrail } from '../audit/audit-trail.js';
|
|
17
|
+
import { failFast } from '../errors/index.js';
|
|
18
|
+
import { loadEndpointConfig } from '../config/endpoints.js';
|
|
19
|
+
// ============================================================================
|
|
20
|
+
// Plan Command Implementation
|
|
21
|
+
// ============================================================================
|
|
22
|
+
export async function executePlanCommand(input, options) {
|
|
23
|
+
const correlationId = options.trace_id ?? crypto.randomUUID();
|
|
24
|
+
const startTime = Date.now();
|
|
25
|
+
// Initialize components
|
|
26
|
+
const engine = createOrchestrationEngine(correlationId);
|
|
27
|
+
const handoff = createArtifactHandoff();
|
|
28
|
+
const audit = createAuditTrail();
|
|
29
|
+
// Create adapters
|
|
30
|
+
const manifestsConfig = loadEndpointConfig('agentics-org-manifests');
|
|
31
|
+
const plannerConfig = loadEndpointConfig('agentics-simulation-planner');
|
|
32
|
+
const manifestsAdapter = new ManifestsAdapter(manifestsConfig, correlationId);
|
|
33
|
+
const plannerAdapter = new PlannerAdapter(plannerConfig, correlationId);
|
|
34
|
+
// Define orchestration stages
|
|
35
|
+
const stages = [
|
|
36
|
+
{
|
|
37
|
+
name: 'select-manifest',
|
|
38
|
+
adapter: manifestsAdapter,
|
|
39
|
+
request: {
|
|
40
|
+
endpoint: '/api/v1/manifests/select',
|
|
41
|
+
method: 'POST',
|
|
42
|
+
buildBody: () => ({ query: input.manifestQuery }),
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: 'create-plan',
|
|
47
|
+
adapter: plannerAdapter,
|
|
48
|
+
request: {
|
|
49
|
+
endpoint: '/api/v1/plans/create',
|
|
50
|
+
method: 'POST',
|
|
51
|
+
buildBody: (previousResults) => {
|
|
52
|
+
const manifestResult = previousResults.get('select-manifest');
|
|
53
|
+
const manifestRef = handoff.extractReference(manifestResult);
|
|
54
|
+
return {
|
|
55
|
+
manifest_ref: manifestRef,
|
|
56
|
+
params: input.params ?? {},
|
|
57
|
+
};
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
dependsOn: ['select-manifest'],
|
|
61
|
+
},
|
|
62
|
+
];
|
|
63
|
+
try {
|
|
64
|
+
// Execute orchestration
|
|
65
|
+
const result = await engine.execute(stages, options);
|
|
66
|
+
if (!result.success) {
|
|
67
|
+
const failedStage = result.stages.find(s => s.status === 'failed');
|
|
68
|
+
throw new Error(failedStage?.error?.message ?? 'Orchestration failed');
|
|
69
|
+
}
|
|
70
|
+
// Extract plan reference from final stage
|
|
71
|
+
const planStage = result.stages.find(s => s.name === 'create-plan');
|
|
72
|
+
const planRef = handoff.extractReference(planStage?.response);
|
|
73
|
+
// Record audit entry
|
|
74
|
+
audit.record({
|
|
75
|
+
command: 'plan',
|
|
76
|
+
inputs: { manifestQuery: input.manifestQuery, params: input.params },
|
|
77
|
+
outputs: planRef,
|
|
78
|
+
dependencies: [
|
|
79
|
+
{ service: 'agentics-org-manifests', method: 'select', timestamp: new Date().toISOString(), duration_ms: result.timing.breakdown['select-manifest'] ?? 0, success: true },
|
|
80
|
+
{ service: 'agentics-simulation-planner', method: 'create', timestamp: new Date().toISOString(), duration_ms: result.timing.breakdown['create-plan'] ?? 0, success: true },
|
|
81
|
+
],
|
|
82
|
+
duration_ms: result.timing.total,
|
|
83
|
+
status: 'SUCCESS',
|
|
84
|
+
trace_id: correlationId,
|
|
85
|
+
});
|
|
86
|
+
return {
|
|
87
|
+
reference: planRef,
|
|
88
|
+
timing: Date.now() - startTime,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
// Record failure in audit
|
|
93
|
+
audit.record({
|
|
94
|
+
command: 'plan',
|
|
95
|
+
inputs: { manifestQuery: input.manifestQuery, params: input.params },
|
|
96
|
+
outputs: null,
|
|
97
|
+
dependencies: [],
|
|
98
|
+
duration_ms: Date.now() - startTime,
|
|
99
|
+
status: 'FAILED',
|
|
100
|
+
error_code: error instanceof Error ? error.name : 'UNKNOWN',
|
|
101
|
+
error_message: error instanceof Error ? error.message : 'Unknown error',
|
|
102
|
+
trace_id: correlationId,
|
|
103
|
+
});
|
|
104
|
+
// Fail fast - propagate error
|
|
105
|
+
failFast({
|
|
106
|
+
command: 'plan',
|
|
107
|
+
phase: 'orchestration',
|
|
108
|
+
upstreamError: error instanceof Error ? error : new Error(String(error)),
|
|
109
|
+
inputs: input,
|
|
110
|
+
correlationId,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=plan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan.js","sourceRoot":"","sources":["../../src/commands/plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,OAAO,EACL,gBAAgB,EAChB,cAAc,GACf,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,yBAAyB,GAE1B,MAAM,oCAAoC,CAAC;AAC5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SACxB,CAAC,CAAC;QAEH,8BAA8B;QAC9B,QAAQ,CAAC;YACP,OAAO,EAAE,MAAM;YACf,KAAK,EAAE,eAAe;YACtB,aAAa,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACxE,MAAM,EAAE,KAAK;YACb,aAAa;SACd,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Quantify Command
|
|
3
|
+
*
|
|
4
|
+
* SPARC Pseudocode Reference: §2.7
|
|
5
|
+
*
|
|
6
|
+
* FLOW:
|
|
7
|
+
* 1. Parse arguments → CommandObject
|
|
8
|
+
* 2. Generate ROI report via enterprise-roi-engine
|
|
9
|
+
* 3. Record audit entry
|
|
10
|
+
* 4. Return RoiReportReference
|
|
11
|
+
*
|
|
12
|
+
* PURPOSE: Generate CFO-grade financial impact summaries from completed simulations
|
|
13
|
+
* The CLI does NOT perform financial calculations - delegates entirely to enterprise-roi-engine
|
|
14
|
+
*/
|
|
15
|
+
import type { CommandOptions, RoiReportReference, SimulationReference, RoiReportType } from '../types/index.js';
|
|
16
|
+
export interface QuantifyCommandInput {
|
|
17
|
+
simRef: SimulationReference;
|
|
18
|
+
reportType?: RoiReportType;
|
|
19
|
+
params?: Record<string, unknown>;
|
|
20
|
+
}
|
|
21
|
+
export interface QuantifyCommandResult {
|
|
22
|
+
reference: RoiReportReference;
|
|
23
|
+
timing: number;
|
|
24
|
+
}
|
|
25
|
+
export declare function executeQuantifyCommand(input: QuantifyCommandInput, options: CommandOptions): Promise<QuantifyCommandResult>;
|
|
26
|
+
//# sourceMappingURL=quantify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quantify.d.ts","sourceRoot":"","sources":["../../src/commands/quantify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,aAAa,EACd,MAAM,mBAAmB,CAAC;AAe3B,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,mBAAmB,CAAC;IAC5B,UAAU,CAAC,EAAE,aAAa,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,kBAAkB,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC;CAChB;AAMD,wBAAsB,sBAAsB,CAC1C,KAAK,EAAE,oBAAoB,EAC3B,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,qBAAqB,CAAC,CAsFhC"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Quantify Command
|
|
3
|
+
*
|
|
4
|
+
* SPARC Pseudocode Reference: §2.7
|
|
5
|
+
*
|
|
6
|
+
* FLOW:
|
|
7
|
+
* 1. Parse arguments → CommandObject
|
|
8
|
+
* 2. Generate ROI report via enterprise-roi-engine
|
|
9
|
+
* 3. Record audit entry
|
|
10
|
+
* 4. Return RoiReportReference
|
|
11
|
+
*
|
|
12
|
+
* PURPOSE: Generate CFO-grade financial impact summaries from completed simulations
|
|
13
|
+
* The CLI does NOT perform financial calculations - delegates entirely to enterprise-roi-engine
|
|
14
|
+
*/
|
|
15
|
+
import { RoiEngineAdapter } from '../adapters/base-adapter.js';
|
|
16
|
+
import { createOrchestrationEngine, } from '../modules/orchestration-engine.js';
|
|
17
|
+
import { createArtifactHandoff } from '../modules/artifact-handoff.js';
|
|
18
|
+
import { createAuditTrail } from '../audit/audit-trail.js';
|
|
19
|
+
import { failFast } from '../errors/index.js';
|
|
20
|
+
import { loadEndpointConfig } from '../config/endpoints.js';
|
|
21
|
+
// ============================================================================
|
|
22
|
+
// Quantify Command Implementation
|
|
23
|
+
// ============================================================================
|
|
24
|
+
export async function executeQuantifyCommand(input, options) {
|
|
25
|
+
const correlationId = options.trace_id ?? crypto.randomUUID();
|
|
26
|
+
const startTime = Date.now();
|
|
27
|
+
// Initialize components
|
|
28
|
+
const engine = createOrchestrationEngine(correlationId);
|
|
29
|
+
const handoff = createArtifactHandoff();
|
|
30
|
+
const audit = createAuditTrail();
|
|
31
|
+
// Create adapter
|
|
32
|
+
const roiConfig = loadEndpointConfig('enterprise-roi-engine');
|
|
33
|
+
const roiAdapter = new RoiEngineAdapter(roiConfig, correlationId);
|
|
34
|
+
// Default report type
|
|
35
|
+
const reportType = input.reportType ?? 'cfo-grade';
|
|
36
|
+
// Define orchestration stages
|
|
37
|
+
const stages = [
|
|
38
|
+
{
|
|
39
|
+
name: 'generate-roi-report',
|
|
40
|
+
adapter: roiAdapter,
|
|
41
|
+
request: {
|
|
42
|
+
endpoint: '/api/v1/reports/generate',
|
|
43
|
+
method: 'POST',
|
|
44
|
+
buildBody: () => ({
|
|
45
|
+
sim_ref: handoff.passthrough(input.simRef),
|
|
46
|
+
report_type: reportType,
|
|
47
|
+
params: input.params ?? {},
|
|
48
|
+
}),
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
];
|
|
52
|
+
try {
|
|
53
|
+
// Execute orchestration
|
|
54
|
+
const result = await engine.execute(stages, options);
|
|
55
|
+
if (!result.success) {
|
|
56
|
+
const failedStage = result.stages.find(s => s.status === 'failed');
|
|
57
|
+
throw new Error(failedStage?.error?.message ?? 'ROI report generation failed');
|
|
58
|
+
}
|
|
59
|
+
// Extract ROI report reference
|
|
60
|
+
const roiStage = result.stages.find(s => s.name === 'generate-roi-report');
|
|
61
|
+
const roiRef = handoff.extractReference(roiStage?.response);
|
|
62
|
+
// Record audit entry
|
|
63
|
+
audit.record({
|
|
64
|
+
command: 'quantify',
|
|
65
|
+
inputs: { simRef: input.simRef.id, reportType, params: input.params },
|
|
66
|
+
outputs: roiRef,
|
|
67
|
+
dependencies: [
|
|
68
|
+
{ service: 'enterprise-roi-engine', method: 'generate', timestamp: new Date().toISOString(), duration_ms: result.timing.total, success: true },
|
|
69
|
+
],
|
|
70
|
+
duration_ms: result.timing.total,
|
|
71
|
+
status: 'SUCCESS',
|
|
72
|
+
trace_id: correlationId,
|
|
73
|
+
});
|
|
74
|
+
return {
|
|
75
|
+
reference: roiRef,
|
|
76
|
+
timing: Date.now() - startTime,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
// Record failure in audit
|
|
81
|
+
audit.record({
|
|
82
|
+
command: 'quantify',
|
|
83
|
+
inputs: { simRef: input.simRef.id, reportType },
|
|
84
|
+
outputs: null,
|
|
85
|
+
dependencies: [],
|
|
86
|
+
duration_ms: Date.now() - startTime,
|
|
87
|
+
status: 'FAILED',
|
|
88
|
+
error_code: error instanceof Error ? error.name : 'UNKNOWN',
|
|
89
|
+
error_message: error instanceof Error ? error.message : 'Unknown error',
|
|
90
|
+
trace_id: correlationId,
|
|
91
|
+
});
|
|
92
|
+
// Fail fast
|
|
93
|
+
failFast({
|
|
94
|
+
command: 'quantify',
|
|
95
|
+
phase: 'generation',
|
|
96
|
+
upstreamError: error instanceof Error ? error : new Error(String(error)),
|
|
97
|
+
inputs: input,
|
|
98
|
+
correlationId,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=quantify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quantify.js","sourceRoot":"","sources":["../../src/commands/quantify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAQH,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EACL,yBAAyB,GAE1B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,QAAQ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AAO,EAAE,UAAU;YACnB,MAAM,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,UAAU,EAAE;YAC/C,OAAO,EAAE,IAAI;YACb,YAAY,EAAE,EAAE;YAChB,WAAW,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS;YACnC,MAAM,EAAE,QAAQ;YAChB,UAAU,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;YAC3D,aAAa,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe;YACvE,QAAQ,EAAE,aAAa;SACxB,CAAC,CAAC;QAEH,YAAY;QACZ,QAAQ,CAAC;YACP,OAAO,EAAE,UAAU;YACnB,KAAK,EAAE,YAAY;YACnB,aAAa,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACxE,MAAM,EAAE,KAAK;YACb,aAAa;SACd,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simulate Command
|
|
3
|
+
*
|
|
4
|
+
* SPARC Pseudocode Reference: §2.2
|
|
5
|
+
*
|
|
6
|
+
* FLOW:
|
|
7
|
+
* 1. Parse arguments → CommandObject
|
|
8
|
+
* 2. Execute simulation via agentics-simulation-runner
|
|
9
|
+
* 3. Record audit entry
|
|
10
|
+
* 4. Return SimulationReference
|
|
11
|
+
*/
|
|
12
|
+
import type { CommandOptions, SimulationReference, PlanReference } from '../types/index.js';
|
|
13
|
+
export interface SimulateCommandInput {
|
|
14
|
+
planRef: PlanReference;
|
|
15
|
+
config?: Record<string, unknown>;
|
|
16
|
+
iterations?: number;
|
|
17
|
+
}
|
|
18
|
+
export interface SimulateCommandResult {
|
|
19
|
+
reference: SimulationReference;
|
|
20
|
+
timing: number;
|
|
21
|
+
}
|
|
22
|
+
export declare function executeSimulateCommand(input: SimulateCommandInput, options: CommandOptions): Promise<SimulateCommandResult>;
|
|
23
|
+
//# sourceMappingURL=simulate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simulate.d.ts","sourceRoot":"","sources":["../../src/commands/simulate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,mBAAmB,EACnB,aAAa,EACd,MAAM,mBAAmB,CAAC;AAe3B,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,aAAa,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,mBAAmB,CAAC;IAC/B,MAAM,EAAE,MAAM,CAAC;CAChB;AAMD,wBAAsB,sBAAsB,CAC1C,KAAK,EAAE,oBAAoB,EAC3B,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,qBAAqB,CAAC,CAmFhC"}
|