@llm-dev-ops/agentics-cli 2.7.37 → 2.7.38

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.
Files changed (35) hide show
  1. package/dist/adapters/base-adapter.d.ts.map +1 -1
  2. package/dist/adapters/base-adapter.js.map +1 -1
  3. package/dist/agents/repo-agent-runner.d.ts.map +1 -1
  4. package/dist/agents/repo-agent-runner.js +0 -2
  5. package/dist/agents/repo-agent-runner.js.map +1 -1
  6. package/dist/agents/system-prompts.d.ts.map +1 -1
  7. package/dist/agents/system-prompts.js +0 -19
  8. package/dist/agents/system-prompts.js.map +1 -1
  9. package/dist/commands/agents.d.ts +4 -24
  10. package/dist/commands/agents.d.ts.map +1 -1
  11. package/dist/commands/agents.js +6 -36
  12. package/dist/commands/agents.js.map +1 -1
  13. package/dist/pipeline/phase7/deliverables-registry.js +1 -1
  14. package/dist/pipeline/phase7/deliverables-registry.js.map +1 -1
  15. package/dist/pipeline/ruflo-phase-executor.d.ts +2 -5
  16. package/dist/pipeline/ruflo-phase-executor.d.ts.map +1 -1
  17. package/dist/pipeline/ruflo-phase-executor.js +3 -6
  18. package/dist/pipeline/ruflo-phase-executor.js.map +1 -1
  19. package/dist/routing/domain-boundary.d.ts +4 -20
  20. package/dist/routing/domain-boundary.d.ts.map +1 -1
  21. package/dist/routing/domain-boundary.js +6 -81
  22. package/dist/routing/domain-boundary.js.map +1 -1
  23. package/dist/routing/graph-router.d.ts.map +1 -1
  24. package/dist/routing/graph-router.js +0 -22
  25. package/dist/routing/graph-router.js.map +1 -1
  26. package/docs/ecosystem.graph.json +15 -65
  27. package/package.json +1 -1
  28. package/dist/config/qe-gating.d.ts +0 -81
  29. package/dist/config/qe-gating.d.ts.map +0 -1
  30. package/dist/config/qe-gating.js +0 -138
  31. package/dist/config/qe-gating.js.map +0 -1
  32. package/dist/pipeline/phase5-build/qe-gating-executor.d.ts +0 -73
  33. package/dist/pipeline/phase5-build/qe-gating-executor.d.ts.map +0 -1
  34. package/dist/pipeline/phase5-build/qe-gating-executor.js +0 -134
  35. package/dist/pipeline/phase5-build/qe-gating-executor.js.map +0 -1
@@ -1,138 +0,0 @@
1
- /**
2
- * QE Gating Config (ADR-PIPELINE-086)
3
- *
4
- * Resolves the AGENTICS_QE_GATING mode from either the env var or a persisted
5
- * config file in ~/.agentics/qe-gating.json. Emits structured bypass records
6
- * when the mode is not `on`.
7
- *
8
- * Source precedence (highest → lowest):
9
- * 1. AGENTICS_QE_GATING env var
10
- * 2. Persisted config at <configDir>/qe-gating.json
11
- * 3. Default: `on`
12
- *
13
- * The persisted file is the mechanism on-call uses outside of env-var
14
- * environments (e.g., managed deployments where env vars require a redeploy).
15
- * Both paths require a non-empty reason when setting anything other than `on`
16
- * — callers that persist without a reason will throw.
17
- */
18
- import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'node:fs';
19
- import { homedir } from 'node:os';
20
- import { join, dirname } from 'node:path';
21
- export const DEFAULT_MODE = 'on';
22
- export const ENV_VAR_NAME = 'AGENTICS_QE_GATING';
23
- export const CONFIG_FILE = 'qe-gating.json';
24
- export const DEFAULT_CONFIG_DIR = join(homedir(), '.agentics');
25
- // ============================================================================
26
- // Parsing
27
- // ============================================================================
28
- export class InvalidGatingValueError extends Error {
29
- code = 'INVALID_QE_GATING_VALUE';
30
- value;
31
- constructor(value) {
32
- super(`Invalid ${ENV_VAR_NAME} value "${value}" — must be one of: on, advisory, off`);
33
- this.value = value;
34
- this.name = 'InvalidGatingValueError';
35
- }
36
- }
37
- export class EmptyReasonError extends Error {
38
- code = 'EMPTY_QE_GATING_REASON';
39
- constructor() {
40
- super(`Non-empty reason is required when setting ${ENV_VAR_NAME} to advisory or off (ADR-086 §2 audit trail requirement)`);
41
- this.name = 'EmptyReasonError';
42
- }
43
- }
44
- /**
45
- * Parse a raw env-var value. Accepts exactly one of: on, advisory, off
46
- * (case-insensitive; whitespace-trimmed). Empty / undefined returns null so
47
- * callers can fall through to persisted / default resolution.
48
- */
49
- export function parseGatingValue(raw) {
50
- if (raw === undefined || raw === null)
51
- return null;
52
- const trimmed = raw.trim().toLowerCase();
53
- if (trimmed === '')
54
- return null;
55
- if (trimmed === 'on' || trimmed === 'advisory' || trimmed === 'off')
56
- return trimmed;
57
- throw new InvalidGatingValueError(raw);
58
- }
59
- // ============================================================================
60
- // Persisted config (file-backed)
61
- // ============================================================================
62
- function persistedPath(configDir) {
63
- return join(configDir, CONFIG_FILE);
64
- }
65
- export function loadPersistedQeGating(opts = {}) {
66
- const configDir = opts.configDir ?? DEFAULT_CONFIG_DIR;
67
- const path = persistedPath(configDir);
68
- if (!existsSync(path))
69
- return null;
70
- try {
71
- const raw = readFileSync(path, 'utf-8');
72
- const parsed = JSON.parse(raw);
73
- // Round-trip validation: mode must be a legal value.
74
- if (parseGatingValue(parsed.mode) === null)
75
- return null;
76
- return parsed;
77
- }
78
- catch {
79
- return null;
80
- }
81
- }
82
- /**
83
- * Persist a gating decision. Throws `EmptyReasonError` if mode is not `on`
84
- * and reason is empty. Creates the config dir if missing.
85
- */
86
- export function persistQeGating(mode, reason, opts = {}) {
87
- if (mode !== 'on' && (!reason || reason.trim() === '')) {
88
- throw new EmptyReasonError();
89
- }
90
- const configDir = opts.configDir ?? DEFAULT_CONFIG_DIR;
91
- const path = persistedPath(configDir);
92
- mkdirSync(dirname(path), { recursive: true });
93
- const now = opts.now ?? new Date();
94
- const record = {
95
- mode,
96
- reason: reason.trim(),
97
- applied_at: now.toISOString(),
98
- ...(opts.appliedBy !== undefined ? { applied_by: opts.appliedBy } : {}),
99
- ...(opts.correlationId !== undefined ? { correlation_id: opts.correlationId } : {}),
100
- };
101
- writeFileSync(path, JSON.stringify(record, null, 2) + '\n', 'utf-8');
102
- return record;
103
- }
104
- // ============================================================================
105
- // Resolution
106
- // ============================================================================
107
- /**
108
- * Resolve the effective gating mode from env > persisted > default.
109
- */
110
- export function resolveQeGatingMode(opts = {}) {
111
- const env = opts.env ?? process.env;
112
- const rawEnv = env[ENV_VAR_NAME];
113
- const fromEnv = parseGatingValue(rawEnv);
114
- if (fromEnv !== null) {
115
- const result = { mode: fromEnv, source: 'env' };
116
- if (rawEnv !== undefined)
117
- result.rawEnv = rawEnv;
118
- return result;
119
- }
120
- const persisted = loadPersistedQeGating(opts);
121
- if (persisted !== null) {
122
- return { mode: persisted.mode, source: 'persisted', reason: persisted.reason };
123
- }
124
- return { mode: DEFAULT_MODE, source: 'default' };
125
- }
126
- // ============================================================================
127
- // Short-hand helpers
128
- // ============================================================================
129
- export function isGatingOn(opts = {}) {
130
- return resolveQeGatingMode(opts).mode === 'on';
131
- }
132
- export function isGatingAdvisory(opts = {}) {
133
- return resolveQeGatingMode(opts).mode === 'advisory';
134
- }
135
- export function isGatingOff(opts = {}) {
136
- return resolveQeGatingMode(opts).mode === 'off';
137
- }
138
- //# sourceMappingURL=qe-gating.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"qe-gating.js","sourceRoot":"","sources":["../../src/config/qe-gating.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQ1C,MAAM,CAAC,MAAM,YAAY,GAAiB,IAAI,CAAC;AAC/C,MAAM,CAAC,MAAM,YAAY,GAAG,oBAAoB,CAAC;AACjD,MAAM,CAAC,MAAM,WAAW,GAAG,gBAAgB,CAAC;AAC5C,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,WAAW,CAAC,CAAC;AAoC/D,+EAA+E;AAC/E,UAAU;AACV,+EAA+E;AAE/E,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IACvC,IAAI,GAAG,yBAAkC,CAAC;IAC1C,KAAK,CA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,IAAI,CAAC,CAAC,IAAI,KAAK,UAAU,CAAC;AACvD,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,OAAuB,EAAE;IACnD,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,KAAK,CAAC;AAClD,CAAC"}
@@ -1,73 +0,0 @@
1
- /**
2
- * QE Gating Executor (ADR-PIPELINE-086)
3
- *
4
- * Encapsulates the phase-8-validation decision tree driven by the gating mode
5
- * resolved from env / persisted config (see src/config/qe-gating.ts).
6
- *
7
- * Contract:
8
- * on → run all mandatory QE agents; any failure halts the pipeline
9
- * with exit code 141 (via Ruvector Acceptance Gate integration
10
- * upstream). The executor returns `status: 'completed'` or throws.
11
- * advisory → run all mandatory QE agents; failures become warnings in the
12
- * output. Returns `status: 'completed_with_warnings'`.
13
- * off → skip QE invocation entirely. Returns `status: 'bypassed'`.
14
- *
15
- * The executor is pure — it does not invoke agents itself; callers pass in an
16
- * `invokeAgent` callback. This keeps the module testable without a live
17
- * pipeline and independent of adapter implementation.
18
- */
19
- import type { QeGatingMode, ResolvedQeGating } from '../../config/qe-gating.js';
20
- export type Phase8Status = 'completed' | 'completed_with_warnings' | 'bypassed';
21
- export interface QeAgentInvocation {
22
- agent: string;
23
- status: 200 | 502;
24
- data?: Record<string, unknown>;
25
- error?: string;
26
- timing_ms?: number;
27
- }
28
- export interface QeExecutionOutcome {
29
- status: Phase8Status;
30
- mode: QeGatingMode;
31
- source: ResolvedQeGating['source'];
32
- invocations: readonly QeAgentInvocation[];
33
- warnings: readonly string[];
34
- bypassRecord?: BypassRecord;
35
- /** Exit code upstream should propagate on failure (on mode only). */
36
- exitCode?: number;
37
- }
38
- export interface BypassRecord {
39
- timestamp: string;
40
- mode: 'advisory' | 'off';
41
- source: ResolvedQeGating['source'];
42
- reason?: string;
43
- correlation_id: string;
44
- affected_agents: readonly string[];
45
- }
46
- export type InvokeAgentFn = (agentId: string) => Promise<QeAgentInvocation>;
47
- export interface ExecuteOptions {
48
- correlationId: string;
49
- /** Explicit mode override (tests). If omitted, resolves from env/persisted. */
50
- modeOverride?: ResolvedQeGating;
51
- /** Clock override. */
52
- now?: Date;
53
- }
54
- /**
55
- * Run phase-8 QE validation per the gating mode.
56
- *
57
- * @param mandatoryAgents — list of agent IDs the phase requires (from ADR-083)
58
- * @param invokeAgent — callback that dispatches a single agent invocation
59
- * @param options — correlation id + optional mode override
60
- */
61
- export declare function executePhase8Qe(mandatoryAgents: readonly string[], invokeAgent: InvokeAgentFn, options: ExecuteOptions): Promise<QeExecutionOutcome>;
62
- /**
63
- * Emit a structured JSON log line to stderr describing a gating bypass.
64
- * Observatory consumes this via the standard stderr-to-metrics pipeline.
65
- */
66
- export declare function emitBypassLog(record: BypassRecord, writeLine?: (s: string) => void): void;
67
- /**
68
- * Build the Markdown header block stamped onto VALIDATION_REPORT.md when a
69
- * bypass occurs. Callers prepend this to the normal report body so reviewers
70
- * see the bypass at the top.
71
- */
72
- export declare function buildValidationReportBypassHeader(record: BypassRecord): string;
73
- //# sourceMappingURL=qe-gating-executor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"qe-gating-executor.d.ts","sourceRoot":"","sources":["../../../src/pipeline/phase5-build/qe-gating-executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAOhF,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG,yBAAyB,GAAG,UAAU,CAAC;AAEhF,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,GAAG,GAAG,GAAG,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAA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ELINE-086)
3
- *
4
- * Encapsulates the phase-8-validation decision tree driven by the gating mode
5
- * resolved from env / persisted config (see src/config/qe-gating.ts).
6
- *
7
- * Contract:
8
- * on → run all mandatory QE agents; any failure halts the pipeline
9
- * with exit code 141 (via Ruvector Acceptance Gate integration
10
- * upstream). The executor returns `status: 'completed'` or throws.
11
- * advisory → run all mandatory QE agents; failures become warnings in the
12
- * output. Returns `status: 'completed_with_warnings'`.
13
- * off → skip QE invocation entirely. Returns `status: 'bypassed'`.
14
- *
15
- * The executor is pure — it does not invoke agents itself; callers pass in an
16
- * `invokeAgent` callback. This keeps the module testable without a live
17
- * pipeline and independent of adapter implementation.
18
- */
19
- import { resolveQeGatingMode } from '../../config/qe-gating.js';
20
- // ============================================================================
21
- // Execution
22
- // ============================================================================
23
- /**
24
- * Run phase-8 QE validation per the gating mode.
25
- *
26
- * @param mandatoryAgents — list of agent IDs the phase requires (from ADR-083)
27
- * @param invokeAgent — callback that dispatches a single agent invocation
28
- * @param options — correlation id + optional mode override
29
- */
30
- export async function executePhase8Qe(mandatoryAgents, invokeAgent, options) {
31
- const resolved = options.modeOverride ?? resolveQeGatingMode();
32
- const now = options.now ?? new Date();
33
- if (resolved.mode === 'off') {
34
- const bypass = {
35
- timestamp: now.toISOString(),
36
- mode: 'off',
37
- source: resolved.source,
38
- ...(resolved.reason !== undefined ? { reason: resolved.reason } : {}),
39
- correlation_id: options.correlationId,
40
- affected_agents: [...mandatoryAgents],
41
- };
42
- emitBypassLog(bypass);
43
- return {
44
- status: 'bypassed',
45
- mode: 'off',
46
- source: resolved.source,
47
- invocations: [],
48
- warnings: [`QE gating bypassed (off): ${mandatoryAgents.length} mandatory agents skipped`],
49
- bypassRecord: bypass,
50
- };
51
- }
52
- const invocations = [];
53
- for (const agent of mandatoryAgents) {
54
- invocations.push(await invokeAgent(agent));
55
- }
56
- const failures = invocations.filter(i => i.status !== 200);
57
- if (resolved.mode === 'advisory') {
58
- const bypass = {
59
- timestamp: now.toISOString(),
60
- mode: 'advisory',
61
- source: resolved.source,
62
- ...(resolved.reason !== undefined ? { reason: resolved.reason } : {}),
63
- correlation_id: options.correlationId,
64
- affected_agents: failures.map(f => f.agent),
65
- };
66
- if (failures.length > 0)
67
- emitBypassLog(bypass);
68
- return {
69
- status: failures.length > 0 ? 'completed_with_warnings' : 'completed',
70
- mode: 'advisory',
71
- source: resolved.source,
72
- invocations,
73
- warnings: failures.map(f => `QE agent "${f.agent}" failed (${f.error ?? 'status ' + f.status}); advisory mode — not blocking`),
74
- ...(failures.length > 0 ? { bypassRecord: bypass } : {}),
75
- };
76
- }
77
- // mode === 'on' — any failure is a halting condition.
78
- if (failures.length > 0) {
79
- return {
80
- status: 'completed_with_warnings', // caller upgrades to halt via exit code
81
- mode: 'on',
82
- source: resolved.source,
83
- invocations,
84
- warnings: failures.map(f => `QE agent "${f.agent}" failed (${f.error ?? 'status ' + f.status})`),
85
- exitCode: 141,
86
- };
87
- }
88
- return {
89
- status: 'completed',
90
- mode: 'on',
91
- source: resolved.source,
92
- invocations,
93
- warnings: [],
94
- };
95
- }
96
- // ============================================================================
97
- // Bypass logging
98
- // ============================================================================
99
- /**
100
- * Emit a structured JSON log line to stderr describing a gating bypass.
101
- * Observatory consumes this via the standard stderr-to-metrics pipeline.
102
- */
103
- export function emitBypassLog(record, writeLine = (s) => process.stderr.write(s)) {
104
- writeLine(JSON.stringify({
105
- level: 'WARN',
106
- event: 'qe_gating_bypass',
107
- ...record,
108
- }) + '\n');
109
- }
110
- // ============================================================================
111
- // VALIDATION_REPORT header for bypassed runs
112
- // ============================================================================
113
- /**
114
- * Build the Markdown header block stamped onto VALIDATION_REPORT.md when a
115
- * bypass occurs. Callers prepend this to the normal report body so reviewers
116
- * see the bypass at the top.
117
- */
118
- export function buildValidationReportBypassHeader(record) {
119
- const modeLabel = record.mode === 'off' ? 'OFF (skipped)' : 'ADVISORY (warnings-only)';
120
- const reasonLine = record.reason ? `> Reason: ${record.reason}` : '> Reason: (not provided)';
121
- return [
122
- '> ⚠️ **QE GATING BYPASSED**',
123
- `> Mode: ${modeLabel}`,
124
- `> Source: ${record.source} config`,
125
- reasonLine,
126
- `> Timestamp: ${record.timestamp}`,
127
- `> Correlation: ${record.correlation_id}`,
128
- `> Affected agents: ${record.affected_agents.length > 0 ? record.affected_agents.join(', ') : '(none — full bypass)'}`,
129
- '>',
130
- '> See ADR-PIPELINE-086 and `docs/runbooks/qe-gating-recovery-086.md` for recovery.',
131
- '',
132
- ].join('\n');
133
- }
134
- //# sourceMappingURL=qe-gating-executor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"qe-gating-executor.js","sourceRoot":"","sources":["../../../src/pipeline/phase5-build/qe-gating-executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AA8ChE,+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAE/E;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,eAAkC,EAClC,WAA0B,EAC1B,OAAuB;IAEvB,MAAM,QAAQ,GAAG,OAAO,CAAC,YAAY,IAAI,mBAAmB,EAAE,CAAC;IAC/D,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,IAAI,IAAI,EAAE,CAAC;IAEtC,IAAI,QAAQ,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;QAC5B,MAAM,MAAM,GAAiB;YAC3B,SAAS,EAAE,GAAG,CAAC,WAAW,EAAE;YAC5B,IAAI,EAAE,KAAK;YACX,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,GAAG,CAAC,QAAQ,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACrE,cAAc,EAAE,OAAO,CAAC,aAAa;YACrC,eAAe,EAAE,CAAC,GAAG,eAAe,CAAC;SACtC,C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