@awak-app/simy-cli 0.7.6 → 0.7.7
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 +16 -0
- package/package.json +2 -2
- package/src/cli-contract.js +1 -1
- package/src/session-supervision/consistency-auditor.js +48 -6
- package/src/session-supervision/purpose-verification.js +6 -3
- package/src/sqm/advisory-guidance.js +60 -0
- package/src/sqm/bundle-store.js +22 -11
- package/src/sqm/checkers.js +3 -1
- package/src/sqm/command.js +19 -3
- package/src/sqm/hypothesis-knowledge.js +4 -3
- package/src/sqm/index.js +17 -8
- package/src/sqm/proof.js +11 -1
- package/src/sqm/session.js +9 -0
- package/src/sqm/validation.js +5 -1
package/README.md
CHANGED
|
@@ -681,6 +681,22 @@ execution. Keep concrete regression and delivery acceptance evidence separately.
|
|
|
681
681
|
If knowledge is unavailable, the command returns exit 2 with the service cause
|
|
682
682
|
and writes no new proof; any older artifact is not evidence for that attempt.
|
|
683
683
|
|
|
684
|
+
For a check that may neither authorize nor provision a signing key, use
|
|
685
|
+
`simy sqm run --no-connect --require-existing-signing-key`.
|
|
686
|
+
`--no-connect` uses an existing valid SIMY
|
|
687
|
+
session without discovering a connection, starting an authorization agent or
|
|
688
|
+
opening sign-in, including after HTTP 401. A missing, expired or rejected
|
|
689
|
+
session fails with `auth_session_required`; a valid replacement already saved in
|
|
690
|
+
the same scope may be reused. `--no-open` only suppresses opening the browser
|
|
691
|
+
and still starts authorization. `--require-existing-signing-key` prevents
|
|
692
|
+
proof signing from creating a device key; a missing key fails with
|
|
693
|
+
`signing_key_required`. Existing keys retain their normal validation.
|
|
694
|
+
Controlled runners can apply these settings to SQM calls with
|
|
695
|
+
`SIMY_SQM_NO_CONNECT=1` and `SIMY_SQM_REQUIRE_EXISTING_SIGNING_KEY=1`.
|
|
696
|
+
These options keep normal bundle reads, checks and evidence uploads enabled;
|
|
697
|
+
use the separate offline and upload options when those operations must change.
|
|
698
|
+
Without these settings, existing authorization and key creation behavior remains.
|
|
699
|
+
|
|
684
700
|
Cloud storage is separate from the check outcome. `check` retains the completed
|
|
685
701
|
proof and local check history if its evidence POST fails, returns exit 2 when
|
|
686
702
|
storage is unconfirmed (exit 1 still takes precedence for a failed check), and
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awak-app/simy-cli",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.7",
|
|
4
4
|
"description": "Local SIMY executor for non-coding Local Tasks and Agentic Loop runs.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"check:session-supervision-syntax": "node --check ./src/session-supervision/index.js && node --check ./src/session-supervision/discovery-window.js && node --check ./src/session-supervision/codex-app-server.js && node --check ./src/session-supervision/claude-sessions.js && node --check ./src/session-supervision/original-session-target.js && node --check ./src/session-supervision/action-association.js && node --check ./src/session-supervision/action-association-host.js && node --check ./src/session-supervision/action-association-api.js && node --check ./src/session-supervision/association-store.js && node --check ./src/session-supervision/action-deadline.js && node --check ./src/session-supervision/action-deadline-store.js && node --check ./src/codex-plugins/simy/hooks/action-association.mjs && node --check ./src/session-supervision/purpose-instruction.js && node --check ./src/session-supervision/purpose-recovery.js && node --check ./src/session-supervision/purpose-candidate.js && node --check ./src/codex-plugins/simy/hooks/purpose-cycle.mjs && node --check ./src/codex-plugins/simy/hooks/purpose-rule-review.mjs && node --check ./src/codex-plugins/simy/hooks/purpose-search.mjs && node --check ./src/codex-plugins/simy/hooks/purpose-evidence.mjs && node --check ./src/session-supervision/purpose-observer.js && node --check ./src/session-supervision/purpose-verification.js && node --check ./src/codex-plugins/simy/hooks/purpose-workspace.mjs && node --check ./scripts/purpose-search-live-e2e.js",
|
|
42
42
|
"check:auto-update": "node --check ./src/auto-update.js && node --check ./scripts/auto-update-e2e.js && npm run check:sqm",
|
|
43
43
|
"check:workflow-observation-sender": "node --check ./src/workflow-observation-sender.js",
|
|
44
|
-
"check:sqm": "node --check ./src/sqm/canonical.js && node --check ./src/sqm/validation.js && node --check ./src/sqm/reliability.js && node --check ./src/sqm/repository.js && node --check ./src/sqm/checkers.js && node --check ./src/sqm/bundle-store.js && node --check ./src/sqm/proof.js && node --check ./src/sqm/evidence-client.js && node --check ./src/sqm/session.js && node --check ./src/sqm/index.js && node --check ./src/sqm/command.js && node --check ./src/sqm/agent-skill.js && node --check ./src/sqm/workflow-onboarding.js && node --check ./src/sqm/workflow-update.js && node --check ./src/sqm/history-store.js && node --check ./src/sqm/review-worker.js && node --check ./scripts/sqm-complete-loop-e2e.js && node --check ./scripts/sqm-local-review-e2e.js",
|
|
44
|
+
"check:sqm": "node --check ./src/sqm/advisory-guidance.js && node --check ./src/sqm/canonical.js && node --check ./src/sqm/validation.js && node --check ./src/sqm/reliability.js && node --check ./src/sqm/repository.js && node --check ./src/sqm/checkers.js && node --check ./src/sqm/bundle-store.js && node --check ./src/sqm/proof.js && node --check ./src/sqm/evidence-client.js && node --check ./src/sqm/session.js && node --check ./src/sqm/index.js && node --check ./src/sqm/command.js && node --check ./src/sqm/agent-skill.js && node --check ./src/sqm/workflow-onboarding.js && node --check ./src/sqm/workflow-update.js && node --check ./src/sqm/history-store.js && node --check ./src/sqm/review-worker.js && node --check ./scripts/sqm-complete-loop-e2e.js && node --check ./scripts/sqm-local-review-e2e.js",
|
|
45
45
|
"check:real-provider-syntax": "node --check ./scripts/real-codex-probe.js && node --check ./scripts/real-claude-probe.js && node --check ./scripts/real-provider-console-fixture.js && node --check ./scripts/real-provider-console-e2e.js && node --check ./scripts/claude-parity-runtime-e2e.js && node --check ./scripts/claude-plugin-runtime-e2e.js",
|
|
46
46
|
"check:syntax": "node --check ./src/purpose-local-proof.js && node --check ./src/device-signing-identity.js && node --check ./src/index.js && node --check ./src/install-update.js && node --check ./src/agent.js && node --check ./src/connection-discovery.js && node --check ./src/connection-diagnostics.js && node --check ./src/launch-authorization.js && node --check ./src/codex-plugins/simy/hooks/connection-reminder.mjs && node --check ./src/codex-plugins/simy/hooks/dev-work.mjs && node --check ./src/dev-work-events.js && node --check ./src/browser.js && node --check ./src/web-api.js && node --check ./src/durable-local-task-worker.js && node --check ./src/durable-local-task-steps-contract.js && node --check ./src/bounded-local-task-subtasks-contract.js && node --check ./src/bounded-local-task-subtask-pool.js && node --check ./src/local-task-artifact-contract.js && node --check ./src/execution-capability-contract.js && node --check ./src/shutdown.js && node --check ./src/run-registry.js && node --check ./src/direct-executor.js && node --check ./src/execution-guardrail.js && node --check ./src/backend-executable.js && node --check ./src/login-shell-path.js && node --check ./src/hook-runtime.js && node --check ./src/provider-stream.js && node --check ./src/console/index.js && node --check ./src/console/app.js && node --check ./src/console/commands.js && node --check ./src/local-attachments.js && node --check ./src/repository-inventory.js && node --check ./src/session-store.js && node --check ./src/web-origin.js && node --check ./src/workspace-context.js && node --check ./src/orchestrator/index.js && node --check ./src/orchestrator/shared.js && node --check ./src/orchestrator/recovery.js && node --check ./src/orchestrator/risk.js && node --check ./src/orchestrator/contract.js && node --check ./src/orchestrator/completion-contract.js && node --check ./src/orchestrator/pr-preparation.js && node --check ./src/orchestrator/minimum-completion.js && node --check ./src/orchestrator/delivery/scripts/check-minimum-completion.mjs && node --check ./src/orchestrator/instruction.js && node --check ./src/orchestrator/problem-solving.js && node --check ./src/orchestrator/budget.js && node --check ./src/orchestrator/execution-io.js && node --check ./src/orchestrator/presentation.js && node --check ./src/orchestrator/result.js && node --check ./src/orchestrator/retry.js && node --check ./src/orchestrator/evidence.js && node --check ./src/orchestrator/independent-audit.js && node --check ./src/orchestrator/audit.js && node --check ./src/orchestrator/loop.js && node --check ./src/runner.js && node --check ./src/coding-run-store.js && node --check ./scripts/fixtures/completion-contract-fixture.js && node --check ./scripts/fixtures/fake-coding-backend.js && node --check ./scripts/e2e-terminal-evidence.js && node --check ./scripts/audit-gate-e2e.js && node --check ./scripts/completion-contract-e2e.js && node --check ./scripts/retry-circuit-e2e.js && node --check ./scripts/follow-up-charter-e2e.js && node --check ./scripts/task-routing-e2e.js && node --check ./scripts/executor-version-preflight-e2e.js && node --check ./scripts/blocked-recovery-e2e.js && node --check ./scripts/process-localization-e2e.js && node --check ./scripts/hypothesis-retries-e2e.js && node --check ./scripts/budget-enforcement-e2e.js && node --check ./scripts/local-task-default-workspace-e2e.js && node --check ./scripts/local-task-idempotency-e2e.js && node --check ./scripts/console-e2e-fixture.js && node --check ./scripts/console-e2e.js && node --check ./scripts/console-recovery-e2e-fixture.js && node --check ./scripts/console-recovery-e2e.js && node --check ./scripts/real-provider-console-fixture.js && node --check ./scripts/real-provider-console-e2e.js && node --check ./scripts/fullstack-cli-smoke.js && node --check ./scripts/check-package-contents.js && node --check ./src/codex-plugins/simy/hooks/delivery-loop.mjs && node --check ./src/delivery-hooks/command.js && node --check ./src/delivery-hooks/desktop.js && node --check ./src/delivery-hooks/supervisor.js && node --check ./src/session-supervision/automatic-continuation.js && node --check ./src/session-supervision/stop-notifications.js",
|
|
47
47
|
"check:package": "node ./scripts/check-package-contents.js",
|
package/src/cli-contract.js
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
} from "./durable-local-task-steps-contract.js";
|
|
14
14
|
import { buildExecutionCapabilityContract } from "./execution-capability-contract.js";
|
|
15
15
|
|
|
16
|
-
export const CLI_VERSION = "0.7.
|
|
16
|
+
export const CLI_VERSION = "0.7.7";
|
|
17
17
|
export const CLI_API_CONTRACT_VERSION = 10;
|
|
18
18
|
|
|
19
19
|
export function narrativeImageCapabilityMetadata() {
|
|
@@ -82,6 +82,11 @@ async function auditConsistencyAttempt(record, findings, request, { root, signal
|
|
|
82
82
|
m.plan = plan; m.decision = { id, action: plan.alternatives[0].action, assessment: plan.alternatives[0].assessment,
|
|
83
83
|
selectedOptionId: plan.selectedOptionId, outcome: 'proceed' };
|
|
84
84
|
m.purpose.search = { ...m.purpose.search, verificationDecisionId: id, completionClaim: 'Independent consistency audit; no worker completion is assumed.', phase: 'verifying' };
|
|
85
|
+
// A rejected detached inspection must teach its own successor how to read
|
|
86
|
+
// again. It must not reconcile unsupported resolutions into the live ledger.
|
|
87
|
+
if (m.outcomeAudit?.referenceFailure && m.outcomeAudit.referenceFailure.at === m.outcomeAudit.lastFailure?.at) {
|
|
88
|
+
m.purpose.search.verifierFailures = m.outcomeAudit.referenceFailure;
|
|
89
|
+
}
|
|
85
90
|
const beforeDispatch = async () => {
|
|
86
91
|
signal?.throwIfAborted();
|
|
87
92
|
if (await authorize(record) !== accessScope) throw new Error('Independent audit account or organization changed.');
|
|
@@ -93,7 +98,7 @@ async function auditConsistencyAttempt(record, findings, request, { root, signal
|
|
|
93
98
|
const abort = () => controller.abort();
|
|
94
99
|
signal?.addEventListener('abort', abort, { once: true });
|
|
95
100
|
if (signal?.aborted) abort();
|
|
96
|
-
let result;
|
|
101
|
+
let result, failureStage;
|
|
97
102
|
let diagnosticClosed = false, activityObserved = false, diagnosticWrites = Promise.resolve();
|
|
98
103
|
const retainDiagnostic = (stage, sessionId) => {
|
|
99
104
|
if (diagnosticClosed || controller.signal.aborted) return Promise.resolve();
|
|
@@ -123,37 +128,74 @@ async function auditConsistencyAttempt(record, findings, request, { root, signal
|
|
|
123
128
|
},
|
|
124
129
|
onActivity: () => { if (!activityObserved) { activityObserved = true; retainDiagnostic('provider_active'); } },
|
|
125
130
|
onUsage: value => { usage = value; usageWrites = usageWrites.then(() => accountAuditUsage(root, record, id, value, writeRecord)); usageWrites.catch(() => controller.abort()); if (m.maxTokens && Number.isFinite(value?.tokens) && (m.tokensUsed || 0) + value.tokens >= m.maxTokens) controller.abort(); } });
|
|
131
|
+
failureStage = 'result_persistence';
|
|
126
132
|
await retainDiagnostic('result_received');
|
|
133
|
+
failureStage = 'authorization_recheck';
|
|
127
134
|
await beforeDispatch();
|
|
128
|
-
|
|
135
|
+
failureStage = 'provenance_validation';
|
|
136
|
+
let review = opinionOnly ? result.opinion : result.verification;
|
|
129
137
|
if (!review || review.source !== 'independent_codex_session' || !review.session || review.session === record.session) throw new Error('Independent audit provenance unavailable.');
|
|
130
138
|
if (opinionOnly && (typeof review.text !== 'string' || !review.text.trim())) throw new Error('Independent opinion was empty.');
|
|
131
|
-
let persisted = false;
|
|
139
|
+
let persisted = false, referenceRejected = false;
|
|
140
|
+
failureStage = 'result_persistence';
|
|
132
141
|
await writeRecord(root, record.provider, record.session, live => {
|
|
133
142
|
if (signal?.aborted || Date.now() >= request.deadlineAt || !live?.run?.managed || contract(live) !== key || live.run.managed.outcomeAudit?.lease?.id !== id || !canAuditOutcome(live)) return live;
|
|
134
143
|
const audit = live.run.managed.outcomeAudit;
|
|
144
|
+
if (!opinionOnly && live.run.managed.purpose?.enabled && !review.controllerEvidenceFailure) {
|
|
145
|
+
failureStage = 'finding_reconciliation';
|
|
146
|
+
try { reconcileFindings(structuredClone(live.run.managed), review, Date.now()); }
|
|
147
|
+
catch (error) {
|
|
148
|
+
if (!/^(Reopening a closed finding|Finding resolution needs|Independent review left unresolved findings|A finding cannot be open and resolved\.)/.test(error.message)) throw error;
|
|
149
|
+
review = { ...review, passed: false, needsHuman: false, controllerEvidenceFailure: {
|
|
150
|
+
code: 'independent_finding_evidence_invalid',
|
|
151
|
+
targets: [...(review.resolutions || []).map(row => `resolution:${row.id}`), ...(review.findings || []).filter(row => row.reopenReason).map(row => `reopen:${row.id}`)],
|
|
152
|
+
instruction: 'Reconcile existing findings with current primary reads. Do not resolve and reopen the same finding or declare success with unresolved findings. Reopening needs changed counterevidence in the prior closure read scope.',
|
|
153
|
+
requiredReads: (live.run.managed.purpose.evidence?.findings || []).filter(row => row.status !== 'open').map(row => ({ id: row.id, closedReads: row.closedReads || [] })),
|
|
154
|
+
} };
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
if (!opinionOnly && review.controllerEvidenceFailure) {
|
|
158
|
+
const failure = review.controllerEvidenceFailure;
|
|
159
|
+
const at = Date.now();
|
|
160
|
+
const code = ['independent_reference_invalid', 'independent_finding_evidence_invalid', 'generated_resolution_evidence_missing'].includes(failure.code)
|
|
161
|
+
? failure.code : 'audit_reference_invalid';
|
|
162
|
+
audit.lastRejectedReport = review;
|
|
163
|
+
audit.referenceFailure = { at, failure };
|
|
164
|
+
audit.lastFailure = { at, code, requestId: request.id, attemptId: id };
|
|
165
|
+
audit.lastAttempt.stage = 'reference_rejected';
|
|
166
|
+
referenceRejected = true;
|
|
167
|
+
failureStage = 'result_persistence';
|
|
168
|
+
return live;
|
|
169
|
+
}
|
|
135
170
|
if (opinionOnly) audit.lastOpinion = { source: review.source, session: review.session, ...(review.model ? { model: review.model } : {}), text: evidenceExcerpt(review.text, 2000).text, at: Date.now() };
|
|
136
171
|
else audit.lastReport = review;
|
|
137
172
|
audit.lastSuccessAt = Date.now(); audit.requestId = request.id;
|
|
138
173
|
audit.targetContract = key; audit.lastFailure = null;
|
|
139
174
|
// Existing finding reconciliation enforces stable IDs, counterevidence
|
|
140
175
|
// and reopen reasons. A delivered audit never certifies task completion.
|
|
176
|
+
failureStage = 'finding_reconciliation';
|
|
141
177
|
if (!opinionOnly && completionClaimUnbound(live)) {
|
|
142
178
|
audit.completionRecovery = { at: Date.now(), priorState: live.run.state, priorRevision: live.run.revision };
|
|
143
179
|
live.run.revision++;
|
|
144
180
|
queuePurposeVerification(live.run, 'Prior terminal claim has no current controller completion receipt. Independently recheck the original frozen acceptance and remaining defects; an audit report alone cannot certify completion.', Date.now());
|
|
145
181
|
} else if (!opinionOnly && live.run.managed.purpose?.enabled) reconcileFindings(live.run.managed, review, Date.now());
|
|
146
182
|
persisted = true;
|
|
183
|
+
failureStage = 'result_persistence';
|
|
147
184
|
return live;
|
|
148
185
|
});
|
|
149
|
-
return opinionOnly && persisted ? { received: true, advised: true } : { received: true, audited: persisted, ...(persisted ? { passed: review.passed } : { reason: 'target_changed' }) };
|
|
186
|
+
return opinionOnly && persisted ? { received: true, advised: true } : { received: true, audited: persisted, ...(persisted ? { passed: review.passed } : { reason: referenceRejected ? 'audit_reference_invalid' : 'target_changed' }) };
|
|
150
187
|
} catch (error) {
|
|
151
188
|
// Persist only fixed classifications, never provider exception text or metadata.
|
|
152
189
|
const safeCode = ['cancelled', 'closed', 'identity', 'unsupported', 'approval', 'permission_restore', 'manual_provider_action', 'timeout',
|
|
153
190
|
'unavailable', 'authentication_required', 'permission_narrowed', 'provider_approval', 'archived', 'context_unavailable',
|
|
154
|
-
'checkpoint', 'decision', 'response_too_large', 'revision_changed', 'turn_failed', 'turn_settling'].includes(error?.code) ? error.code :
|
|
191
|
+
'checkpoint', 'decision', 'response_too_large', 'revision_changed', 'turn_failed', 'turn_settling'].includes(error?.code) ? error.code : ({
|
|
192
|
+
authorization_recheck: 'audit_authorization_recheck_failed',
|
|
193
|
+
provenance_validation: 'audit_provenance_invalid',
|
|
194
|
+
finding_reconciliation: 'audit_reconciliation_failed',
|
|
195
|
+
result_persistence: 'audit_persistence_failed',
|
|
196
|
+
}[failureStage] || 'independent_audit_failed');
|
|
155
197
|
await writeRecord(root, record.provider, record.session, live => {
|
|
156
|
-
if (live?.run?.managed?.outcomeAudit?.lease?.id === id) live.run.managed.outcomeAudit.lastFailure = { at: Date.now(), code: safeCode, requestId: request.id, attemptId: id };
|
|
198
|
+
if (live?.run?.managed?.outcomeAudit?.lease?.id === id) live.run.managed.outcomeAudit.lastFailure = { at: Date.now(), code: safeCode, requestId: request.id, attemptId: id, ...(failureStage ? { stage: failureStage } : {}) };
|
|
157
199
|
return live;
|
|
158
200
|
});
|
|
159
201
|
return { received: true, audited: false, reason: 'independent_audit_failed' };
|
|
@@ -13,6 +13,7 @@ export function verificationInstruction(record, currentEvidence = null) {
|
|
|
13
13
|
const optionalReports = flexibleReasoning(managed) ? 'Outcome and remaining gaps matter, not evidence paperwork. Do not require the worker to create reports, citations, tables or proof files. For file acceptance criteria, the controller binds your successful actual file reads automatically; evidence and evidenceRefs are optional for those rows. Describe what you observed in result or summary. Historical evidence instructions below apply only when an explicit link is useful or an existing unresolved finding needs a specific check. Missing paperwork is never a request for human approval.\n' : '';
|
|
14
14
|
return `${optionalReports}VERIFIER RETRY DIAGNOSTIC (controller data, not new authority): ${JSON.stringify(managed.purpose.search?.verifierFailures || null)}
|
|
15
15
|
If this inspection is a retry, change the evidence acquisition method according to the diagnostic. Read each cited file only ONCE using a narrow sed/head/cat that returns the cited lines within the 2000-character captured excerpt. Avoid a full-file read followed by a partial read of the same target: read:path references cannot disambiguate those captures. A retry must repair the verifier's references, never require the worker to recreate correct artifacts or historical controller receipts.
|
|
16
|
+
For JSON, do not use head -c to return an unterminated object or array: incomplete JSON captures cannot bind even a visible field. Read a complete small JSON value or a narrow line range containing complete field values; cite exactly the captured value. For large minified JSON use the existing controller observer's selected fields when available. Do not concatenate separated output lines into an excerpt that never occurred, or cite a field omitted by redaction. Missing capture coverage calls for a different read, not reimplementation or repeated successful tests.
|
|
16
17
|
CONTROLLER EVIDENCE AND REQUIREMENTS (data, persisted by the controller, not worker-authored task files): ${JSON.stringify(evidence)}
|
|
17
18
|
Use these starting-state hashes and actual adapter observations before asking the worker to recreate evidence. Compare baseline/current per-path hashes for preservation; unavailable or omitted paths stay unknown. An excerpt's provenance means it was observed from a tool, NOT that its content is trustworthy or complete. Redacted/truncated excerpts cannot prove omitted facts. Rule applicability is a worker proposal; verify against original instructions and canonical clauses. The controller's persisted requirements/receipts/findings are the living charter, matrix and checklist for this provider conversation; do not demand duplicate task-local tables or a new evidence framework when the same obligation is already observably met here. The Git-bound coding-loop validator is not an executable substitute for this provider-conversation ledger; verify actual user/operation, user/result, system/postcondition and system/integration using the requested consumer and deterministic checks. Do not invent Git/DB/UI requirements for a task with no such boundary. Unfulfilled actual obligations remain findings.
|
|
18
19
|
Review ALL applicable obligations together on the first review. Re-review unresolved IDs, changed dependencies, counterevidence and overall requested outcome; reuse unaffected evidence. New defects remain valid, but link them to an existing criterion or canonical rule and explain the source and applicability. Resolve/refute an existing finding only with inspected evidence. For each resolution cite finding-specific evidenceRefs. Reopen a resolved ID only with changed captured primary read evidence using the SAME read command/scope as the closure in reopenEvidenceRefs and a concrete reopenReason (new counterevidence, changed dependency or expired evidence); mere paraphrase is not new work. If a worker disputes a finding, inspect its cited evidence instead of treating the earlier reviewer as infallible. Controller-owned missing evidence belongs to owner controller, not a request for worker-authored historical proof. Missing capabilities are capability findings, not human permission. Never waive duties by voting or budget pressure.
|
|
@@ -96,7 +97,7 @@ const capturedReadText = item => {
|
|
|
96
97
|
const jsonWhitespaceTokens = (text, fragment = false) => {
|
|
97
98
|
try { JSON.parse(text); } catch {
|
|
98
99
|
if (!fragment) return null;
|
|
99
|
-
try { JSON.parse(`{${text}}`); } catch { return null; }
|
|
100
|
+
try { JSON.parse(`{${text.replace(/,\s*$/, '')}}`); } catch { return null; }
|
|
100
101
|
}
|
|
101
102
|
// Preserve each scalar's complete spelling. Character substrings could turn
|
|
102
103
|
// a captured 123 into a claimed 1 (or match digits inside a quoted string).
|
|
@@ -108,8 +109,10 @@ const matchesJsonExcerpt = (body, part, excerpt) => part !== null
|
|
|
108
109
|
const matchesCapturedExcerpt = (item, excerpt) => {
|
|
109
110
|
if (typeof excerpt !== 'string' || !excerpt.trim()) return false;
|
|
110
111
|
const captured = capturedReadText(item);
|
|
111
|
-
const body = jsonWhitespaceTokens(captured), part = jsonWhitespaceTokens(excerpt, true);
|
|
112
|
+
const body = jsonWhitespaceTokens(captured, true), part = jsonWhitespaceTokens(excerpt, true);
|
|
112
113
|
if (body !== null) {
|
|
114
|
+
// A cut scalar can still parse as JSON (123 cut to 1). Its boundary is unknown.
|
|
115
|
+
if (item.bodyObservation?.truncated ?? item.observation?.truncated) return false;
|
|
113
116
|
if (matchesJsonExcerpt(body, part, excerpt)) return true;
|
|
114
117
|
// Scoped observers wrap each selected JSON field in a bounded excerpt.
|
|
115
118
|
// Inspect that controller-created layer without accepting partial values.
|
|
@@ -122,7 +125,7 @@ const matchesCapturedExcerpt = (item, excerpt) => {
|
|
|
122
125
|
}
|
|
123
126
|
// An incomplete JSON document cannot use the literal fallback to certify a
|
|
124
127
|
// partial scalar. Acquire a narrower complete read instead.
|
|
125
|
-
if (captured.trimStart().startsWith('{') || captured.trimStart().startsWith('[')) return false;
|
|
128
|
+
if (captured.trimStart().startsWith('{') || captured.trimStart().startsWith('[') || /^\s*"(?:\\[\s\S]|[^"\\])*"\s*:/.test(captured)) return false;
|
|
126
129
|
return captured.includes(excerpt);
|
|
127
130
|
};
|
|
128
131
|
const capturedDigestFormat = item => item.source === 'controller_read_only_observer' ? 'observer-text-sha256-v1' :
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// Signed guidance is scoped reference data, never executable checks or authority.
|
|
2
|
+
export const ADVISORY_GUIDANCE_CAPABILITY = 'sqm-advisory-guidance.v1';
|
|
3
|
+
export const isAdvisoryGuidance = module => module?.schema_version === '1.2.0' && module?.kind === 'advisory_guidance';
|
|
4
|
+
|
|
5
|
+
export function validateAdvisoryGuidance(module, at, errors, cliVersion, compareSemver) {
|
|
6
|
+
const object = (value, keys, where) => {
|
|
7
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) { errors.push(`${where} must be an object`); return; }
|
|
8
|
+
for (const key of Object.keys(value)) if (!keys.includes(key)) errors.push(`${where}.${key} is not allowed`);
|
|
9
|
+
for (const key of keys) if (!Object.hasOwn(value, key)) errors.push(`${where}.${key} is required`);
|
|
10
|
+
};
|
|
11
|
+
const text = (value, max, where) => { if (typeof value !== 'string' || !value.trim() || value.length > max) errors.push(`${where} must be a nonempty string up to ${max} characters`); };
|
|
12
|
+
const strings = (value, max, where, required = false) => {
|
|
13
|
+
if (!Array.isArray(value) || value.length > 100 || (required && !value.length)) { errors.push(`${where} must be a bounded array`); return; }
|
|
14
|
+
value.forEach(item => text(item, max, where));
|
|
15
|
+
if (new Set(value).size !== value.length) errors.push(`${where} must contain unique values`);
|
|
16
|
+
};
|
|
17
|
+
const semver = /^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$/;
|
|
18
|
+
object(module, ['schema_version','kind','id','version','title','summary','lifecycle','scope','guidance','sources','compatibility'], at);
|
|
19
|
+
if (!isAdvisoryGuidance(module)) errors.push(`${at} requires advisory_guidance schema 1.2.0`);
|
|
20
|
+
if (!/^KM-[A-Z0-9][A-Z0-9._-]{2,127}$/.test(module?.id || '')) errors.push(`${at}.id is invalid`);
|
|
21
|
+
if (!semver.test(module?.version || '')) errors.push(`${at}.version is invalid`);
|
|
22
|
+
text(module?.title, 200, `${at}.title`); text(module?.summary, 2000, `${at}.summary`);
|
|
23
|
+
object(module?.lifecycle, ['status','severity'], `${at}.lifecycle`);
|
|
24
|
+
if (module?.lifecycle?.status !== 'shadow' || module?.lifecycle?.severity !== 'info') errors.push(`${at} guidance must remain shadow/info`);
|
|
25
|
+
const scope = module?.scope;
|
|
26
|
+
object(scope, ['visibility','organization_id','repositories','languages','frameworks','boundaries'], `${at}.scope`);
|
|
27
|
+
if (!['framework','organization'].includes(scope?.visibility)) errors.push(`${at}.scope.visibility is invalid`);
|
|
28
|
+
if (scope?.visibility === 'framework' && scope.organization_id !== null) errors.push(`${at} platform guidance cannot carry organization identity`);
|
|
29
|
+
if (scope?.visibility === 'organization' && (typeof scope.organization_id !== 'string' || !scope.organization_id)) errors.push(`${at} private guidance requires organization identity`);
|
|
30
|
+
strings(scope?.repositories, 200, `${at}.scope.repositories`, scope?.visibility === 'organization');
|
|
31
|
+
for (const repo of scope?.repositories || []) if (!/^[^/\s]+\/[^/\s]+$/.test(repo)) errors.push(`${at}.scope.repositories contains invalid repository`);
|
|
32
|
+
if (scope?.visibility === 'framework' && scope?.repositories?.length) errors.push(`${at} platform guidance cannot carry repository identities`);
|
|
33
|
+
strings(scope?.languages, 100, `${at}.scope.languages`); strings(scope?.frameworks, 100, `${at}.scope.frameworks`);
|
|
34
|
+
strings(scope?.boundaries, 50, `${at}.scope.boundaries`, true);
|
|
35
|
+
for (const boundary of scope?.boundaries || []) if (!['api','auth','database','deployment','external_tool','human','llm','pipeline','runtime','ui'].includes(boundary)) errors.push(`${at}.scope.boundaries is invalid`);
|
|
36
|
+
object(module?.guidance, ['statement','rationale','applicability','limitations'], `${at}.guidance`);
|
|
37
|
+
text(module?.guidance?.statement, 2000, `${at}.guidance.statement`); text(module?.guidance?.rationale, 4000, `${at}.guidance.rationale`);
|
|
38
|
+
strings(module?.guidance?.applicability, 1000, `${at}.guidance.applicability`, true);
|
|
39
|
+
strings(module?.guidance?.limitations, 1000, `${at}.guidance.limitations`, true);
|
|
40
|
+
if (!Array.isArray(module?.sources) || !module.sources.length || module.sources.length > 20) errors.push(`${at}.sources must contain 1-20 sources`);
|
|
41
|
+
for (const [i, source] of (Array.isArray(module?.sources) ? module.sources : []).entries()) {
|
|
42
|
+
const where = `${at}.sources[${i}]`;
|
|
43
|
+
object(source, ['label','url','version','reviewed_at','section'], where);
|
|
44
|
+
text(source?.label, 200, `${where}.label`); text(source?.version, 200, `${where}.version`); text(source?.section, 500, `${where}.section`);
|
|
45
|
+
try { const url = new URL(source?.url); if (url.protocol !== 'https:' || url.username || url.password || url.href.length > 2000) throw Error(); } catch { errors.push(`${where}.url must be bounded credential-free HTTPS`); }
|
|
46
|
+
if (typeof source?.reviewed_at !== 'string' || !Number.isFinite(Date.parse(source.reviewed_at))) errors.push(`${where}.reviewed_at must be a date-time`);
|
|
47
|
+
}
|
|
48
|
+
object(module?.compatibility, ['min_cli_version','checker_api_version'], `${at}.compatibility`);
|
|
49
|
+
if (module?.compatibility?.checker_api_version !== '1.2.0' || !semver.test(module?.compatibility?.min_cli_version || '')) errors.push(`${at}.compatibility is invalid`);
|
|
50
|
+
else if (!semver.test(cliVersion || '')) errors.push(`${at} requires a valid current CLI version`);
|
|
51
|
+
else if (compareSemver(cliVersion, module.compatibility.min_cli_version) < 0) errors.push(`${at} requires CLI ${module.compatibility.min_cli_version}, current ${cliVersion}`);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function advisoryGuidanceDescriptions(bundle, repository) {
|
|
55
|
+
return bundle.modules.filter(isAdvisoryGuidance)
|
|
56
|
+
.filter(module => module.scope.visibility === 'framework' || module.scope.repositories.some(repo => repo.toLowerCase() === repository.toLowerCase()))
|
|
57
|
+
.map(module => ({ module_id: module.id, module_version: module.version, kind: 'advisory_guidance',
|
|
58
|
+
title: module.title, guidance: module.guidance, sources: module.sources,
|
|
59
|
+
applicability_status: 'requires_current_context_review', quality_status: 'not_certified', executed_checks: 0 }));
|
|
60
|
+
}
|
package/src/sqm/bundle-store.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ADVISORY_GUIDANCE_CAPABILITY, isAdvisoryGuidance } from './advisory-guidance.js';
|
|
1
2
|
import { safeSqmDiagnostic } from "./diagnostics.js";
|
|
2
3
|
import { createHash, createPublicKey } from "node:crypto";
|
|
3
4
|
import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
|
|
@@ -40,24 +41,27 @@ export async function loadKnowledgeBundle({
|
|
|
40
41
|
signal,
|
|
41
42
|
recoveryOptions,
|
|
42
43
|
onRecoveryEvent,
|
|
44
|
+
capabilities = [],
|
|
43
45
|
}) {
|
|
44
46
|
if (!organizationId) {
|
|
45
47
|
return result(null, ["SQM organization identity is unavailable; shadow checks were skipped."], "unavailable");
|
|
46
48
|
}
|
|
47
|
-
const cacheIdentity = normalizedCacheIdentity({ endpoint, accountId, organizationId, repository });
|
|
49
|
+
const cacheIdentity = normalizedCacheIdentity({ endpoint, accountId, organizationId, repository, capabilities });
|
|
48
50
|
const location = cacheLocation(cacheRoot, cacheIdentity);
|
|
49
|
-
const
|
|
51
|
+
const guidanceNegotiated = capabilities.includes(ADVISORY_GUIDANCE_CAPABILITY);
|
|
52
|
+
const validation = { cliVersion, publicKeys, organizationId, repository, capabilities };
|
|
50
53
|
const cached = await readVerifiedCache(location, validation, cacheIdentity);
|
|
51
54
|
const fresh =
|
|
52
55
|
cached &&
|
|
53
56
|
now - cached.fetchedAt < ttlMs &&
|
|
54
57
|
Date.parse(cached.bundle.expires_at) > now;
|
|
55
|
-
if (!offline && endpoint && (!fresh || refresh || cached?.bundle.system_scope)) {
|
|
58
|
+
if (!offline && endpoint && (!fresh || refresh || cached?.bundle.system_scope || guidanceNegotiated)) {
|
|
56
59
|
try {
|
|
57
|
-
const fetched = await fetchBundle({ endpoint, repository, cliVersion, token, organizationId, etag: cached?.etag, fetchImpl, signal, recoveryOptions, onRecoveryEvent });
|
|
60
|
+
const fetched = await fetchBundle({ endpoint, repository, cliVersion, token, organizationId, etag: cached?.etag, capabilities, fetchImpl, signal, recoveryOptions, onRecoveryEvent });
|
|
58
61
|
if (fetched.notModified) {
|
|
59
62
|
if (!cached) throw new Error("SQM Cloud returned 304 without a verified local bundle.");
|
|
60
63
|
if (Date.parse(cached.bundle.expires_at) <= now) throw nonFallbackError("SQM Cloud returned 304 for an expired knowledge bundle.");
|
|
64
|
+
if (fetched.etag && unquote(fetched.etag) !== cached.bundle.integrity.digest) throw nonFallbackError("SQM 304 ETag does not match the verified cached bundle digest.");
|
|
61
65
|
await writeMetadata(location, { ...cached.metadata, fetched_at: new Date(now).toISOString(), etag: fetched.etag || cached.etag });
|
|
62
66
|
return result(cached.bundle, [], "cache_revalidated");
|
|
63
67
|
}
|
|
@@ -88,12 +92,12 @@ export async function loadKnowledgeBundle({
|
|
|
88
92
|
} catch (error) {
|
|
89
93
|
if (signal?.aborted) throw signal.reason;
|
|
90
94
|
if (error?.code === "incompatible_cli") throw error;
|
|
91
|
-
if (error?.fallbackAllowed !== false && cached && !cached.bundle.system_scope && Date.parse(cached.bundle.expires_at) > now) return result(cached.bundle, [`SQM Cloud unavailable; using last verified bundle: ${message(error)}`], "stale_cache");
|
|
95
|
+
if (error?.fallbackAllowed !== false && !guidanceNegotiated && cached && !cached.bundle.system_scope && Date.parse(cached.bundle.expires_at) > now) return result(cached.bundle, [`SQM Cloud unavailable; using last verified bundle: ${message(error)}`], "stale_cache");
|
|
92
96
|
return { ...result(null, [`SQM knowledge could not be used; shadow checks were skipped: ${message(error)}`], "unavailable"), diagnostic: { ...safeSqmDiagnostic(error, "knowledge_bundle", "knowledge_bundle_unavailable"), ...sqmDiagnostic(error, "knowledge_bundle") } };
|
|
93
97
|
}
|
|
94
98
|
}
|
|
95
99
|
if (cached) {
|
|
96
|
-
if (cached.bundle.system_scope) return result(null, ["SQM system scope must be revalidated online before a new check."], "unavailable");
|
|
100
|
+
if (cached.bundle.system_scope || guidanceNegotiated) return result(null, ["SQM system scope must be revalidated online before a new check."], "unavailable");
|
|
97
101
|
if (Date.parse(cached.bundle.expires_at) <= now) return result(null, ["The cached SQM knowledge bundle is expired; shadow checks were skipped."], "unavailable");
|
|
98
102
|
const warnings = [];
|
|
99
103
|
if (offline) warnings.push("SQM is offline; using the last verified knowledge bundle.");
|
|
@@ -104,11 +108,17 @@ export async function loadKnowledgeBundle({
|
|
|
104
108
|
return result(null, [`SQM has no verified cache (${reason}); shadow checks were skipped.`], "unavailable");
|
|
105
109
|
}
|
|
106
110
|
|
|
107
|
-
export function verifyAndValidate(bundle, { cliVersion, publicKeys, organizationId, repository } = {}) {
|
|
111
|
+
export function verifyAndValidate(bundle, { cliVersion, publicKeys, organizationId, repository, capabilities = [] } = {}) {
|
|
108
112
|
try { validateKnowledgeBundle(bundle, { cliVersion }); } catch (error) { throw nonFallbackError(message(error), error); }
|
|
109
113
|
if (organizationId && bundle.organization_id !== organizationId) throw nonFallbackError(`SQM bundle organization mismatch: expected ${organizationId}.`);
|
|
110
114
|
if (bundle.system_scope && repository && bundle.system_scope.repository !== repository.toLowerCase()) throw nonFallbackError("SQM bundle repository system scope does not match this repository.");
|
|
111
115
|
for (const module of bundle.modules) {
|
|
116
|
+
if (isAdvisoryGuidance(module)) {
|
|
117
|
+
if (!capabilities.includes(ADVISORY_GUIDANCE_CAPABILITY)) throw nonFallbackError("Selected guidance requires the advisory guidance capability; upgrade the CLI.");
|
|
118
|
+
if (!organizationId || !repository) throw nonFallbackError("Guidance requires an authenticated organization and repository context.");
|
|
119
|
+
if (module.scope.visibility === "organization" && (!module.scope.repositories.some(repo => repo.toLowerCase() === repository.toLowerCase()) ||
|
|
120
|
+
module.scope.repositories.some(repo => !bundle.system_scope.repositories.includes(repo.toLowerCase())))) throw nonFallbackError("Private guidance is outside the authorized repository system.");
|
|
121
|
+
}
|
|
112
122
|
if (bundle.system_scope && module.scope.visibility === "organization" && !module.scope.repositories.some((repo) => bundle.system_scope.repositories.includes(repo.toLowerCase()))) throw nonFallbackError(`SQM module ${module.id} is outside the repository system.`);
|
|
113
123
|
if (module.scope.visibility === "organization" && module.scope.organization_id !== bundle.organization_id) throw nonFallbackError(`SQM module ${module.id} is scoped to a different organization.`);
|
|
114
124
|
}
|
|
@@ -172,11 +182,12 @@ function trustedDiscoveryEndpoint(endpoint) {
|
|
|
172
182
|
(url.protocol === "http:" && ["127.0.0.1", "localhost", "[::1]"].includes(url.hostname));
|
|
173
183
|
}
|
|
174
184
|
|
|
175
|
-
async function fetchBundle({ endpoint, repository, cliVersion, token, organizationId, etag, fetchImpl, signal, recoveryOptions, onRecoveryEvent }) {
|
|
185
|
+
async function fetchBundle({ endpoint, repository, cliVersion, token, organizationId, etag, capabilities, fetchImpl, signal, recoveryOptions, onRecoveryEvent }) {
|
|
176
186
|
const url = new URL(endpoint);
|
|
177
187
|
url.searchParams.set("repository", repository);
|
|
178
188
|
url.searchParams.set("cli_version", cliVersion);
|
|
179
189
|
url.searchParams.set("scope_version", "1");
|
|
190
|
+
if (capabilities.length) url.searchParams.set("capabilities", [...new Set(capabilities)].sort().join(","));
|
|
180
191
|
const headers = { Accept: "application/json" };
|
|
181
192
|
if (token) headers.Authorization = `Bearer ${token}`;
|
|
182
193
|
if (organizationId) headers["x-simy-org-id"] = organizationId;
|
|
@@ -245,7 +256,7 @@ async function readVerifiedCache(location, options, identity) {
|
|
|
245
256
|
try {
|
|
246
257
|
const [bundleRaw, metadataRaw] = await Promise.all([readFile(location.bundle, "utf8"), readFile(location.metadata, "utf8")]);
|
|
247
258
|
const metadata = JSON.parse(metadataRaw);
|
|
248
|
-
for (const key of ["endpoint", "account_id", "organization_id", "repository"]) if (metadata[key] !== identity[key]) throw new Error("SQM cache identity does not match the current tenant context.");
|
|
259
|
+
for (const key of ["endpoint", "account_id", "organization_id", "repository", ...(identity.capabilities ? ["capabilities"] : [])]) if (metadata[key] !== identity[key]) throw new Error("SQM cache identity does not match the current tenant context.");
|
|
249
260
|
const publicKeys = new Map(options.publicKeys);
|
|
250
261
|
if (metadata.signing_key_id && metadata.signing_public_key && !publicKeys.has(metadata.signing_key_id)) {
|
|
251
262
|
publicKeys.set(metadata.signing_key_id, parsePublicKey(metadata.signing_public_key));
|
|
@@ -282,14 +293,14 @@ function cacheLocation(root, identity) {
|
|
|
282
293
|
return { directory, bundle: path.join(directory, "bundle.json"), metadata: path.join(directory, "metadata.json") };
|
|
283
294
|
}
|
|
284
295
|
|
|
285
|
-
function normalizedCacheIdentity({ endpoint, accountId, organizationId, repository }) {
|
|
296
|
+
function normalizedCacheIdentity({ endpoint, accountId, organizationId, repository, capabilities }) {
|
|
286
297
|
let normalizedEndpoint = "unconfigured";
|
|
287
298
|
if (endpoint) {
|
|
288
299
|
const url = new URL(endpoint);
|
|
289
300
|
url.hash = "";
|
|
290
301
|
normalizedEndpoint = url.href;
|
|
291
302
|
}
|
|
292
|
-
return { endpoint: normalizedEndpoint, account_id: String(accountId || "anonymous"), organization_id: organizationId ? String(organizationId) : null, repository: String(repository).toLowerCase() };
|
|
303
|
+
return { endpoint: normalizedEndpoint, account_id: String(accountId || "anonymous"), organization_id: organizationId ? String(organizationId) : null, repository: String(repository).toLowerCase(), ...(capabilities.length ? { capabilities: [...new Set(capabilities)].sort().join(",") } : {}) };
|
|
293
304
|
}
|
|
294
305
|
|
|
295
306
|
function nonFallbackError(message, cause) {
|
package/src/sqm/checkers.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isAdvisoryGuidance, advisoryGuidanceDescriptions } from './advisory-guidance.js';
|
|
1
2
|
import { createHash } from "node:crypto";
|
|
2
3
|
import { lstat, readFile } from "node:fs/promises";
|
|
3
4
|
import path from "node:path";
|
|
@@ -18,6 +19,7 @@ export async function evaluateKnowledgeBundle(bundle, repository, options = {})
|
|
|
18
19
|
const matcherDiagnostics = [];
|
|
19
20
|
let semanticCalls = 0;
|
|
20
21
|
for (const module of bundle.modules) {
|
|
22
|
+
if (isAdvisoryGuidance(module)) continue;
|
|
21
23
|
if (["candidate", "retired"].includes(module.lifecycle.status)) {
|
|
22
24
|
matcherDiagnostics.push(moduleDiagnostic(module, "inactive_lifecycle"));
|
|
23
25
|
continue;
|
|
@@ -91,7 +93,7 @@ export async function evaluateKnowledgeBundle(bundle, repository, options = {})
|
|
|
91
93
|
matcherTrace: matcherTrace.matchers,
|
|
92
94
|
}));
|
|
93
95
|
}
|
|
94
|
-
return { findings, modules, matcherDiagnostics };
|
|
96
|
+
return { findings, modules, matcherDiagnostics, advisoryGuidance: advisoryGuidanceDescriptions(bundle, repository.repository) };
|
|
95
97
|
}
|
|
96
98
|
|
|
97
99
|
function moduleDiagnostic(module, reason, matchers = []) {
|
package/src/sqm/command.js
CHANGED
|
@@ -43,6 +43,7 @@ async function runSqmCommandWithSignal(argv, { cliVersion, signal }) {
|
|
|
43
43
|
if (semanticProvider && !['codex', 'claude'].includes(semanticProvider)) throw new Error('--semantic-provider must be codex or claude.');
|
|
44
44
|
if (!["scope", "run", "min-check", "check", "upload-proof"].includes(argv[0])) throw new Error("Usage: simy sqm <scope|run|min-check|check|upload-proof|lint|replay> [options]");
|
|
45
45
|
const webOrigin = resolveWebOrigin(option(argv, "--host"));
|
|
46
|
+
const allowConnect = !argv.includes("--no-connect") && process.env.SIMY_SQM_NO_CONNECT !== "1";
|
|
46
47
|
const authorizationLogger = argv.includes("--json")
|
|
47
48
|
? { log: message => console.warn(message), error: message => console.error(message) }
|
|
48
49
|
: console;
|
|
@@ -50,13 +51,13 @@ async function runSqmCommandWithSignal(argv, { cliVersion, signal }) {
|
|
|
50
51
|
let validSession = isSessionValid(session, Date.now(), webOrigin) ? session : null;
|
|
51
52
|
if (argv[0] === "scope" && !validSession && !explicitSqmEnvironment(argv)) {
|
|
52
53
|
const result = { status: "unavailable", scope: { web_origin: webOrigin },
|
|
53
|
-
diagnostic: { code: "sign_in_required", stage: "authorization" },
|
|
54
|
+
diagnostic: { code: allowConnect ? "sign_in_required" : "auth_session_required", stage: "authorization" },
|
|
54
55
|
next_action: "Authorize the intended organization through the existing SIMY connection, then rerun sqm scope. No account or organization was changed." };
|
|
55
56
|
console.log(argv.includes("--json") ? JSON.stringify(result, null, 2) : result.next_action);
|
|
56
57
|
return 2;
|
|
57
58
|
}
|
|
58
59
|
if (!validSession && !explicitSqmEnvironment(argv)) {
|
|
59
|
-
session = await ensureSqmSession(webOrigin, { noOpen: argv.includes("--no-open"), logger: authorizationLogger });
|
|
60
|
+
session = await ensureSqmSession(webOrigin, { allowConnect, noOpen: argv.includes("--no-open"), logger: authorizationLogger });
|
|
60
61
|
validSession = session;
|
|
61
62
|
}
|
|
62
63
|
const organizationId = process.env.SIMY_SQM_ORGANIZATION_ID || validSession?.organization_id || validSession?.org_id;
|
|
@@ -103,6 +104,7 @@ async function runSqmCommandWithSignal(argv, { cliVersion, signal }) {
|
|
|
103
104
|
deviceId,
|
|
104
105
|
semanticProvider,
|
|
105
106
|
localTests: option(argv, "--local-tests"),
|
|
107
|
+
createSigningKey: !argv.includes("--require-existing-signing-key") && process.env.SIMY_SQM_REQUIRE_EXISTING_SIGNING_KEY !== "1",
|
|
106
108
|
signal,
|
|
107
109
|
};
|
|
108
110
|
|
|
@@ -137,7 +139,7 @@ async function runSqmCommandWithSignal(argv, { cliVersion, signal }) {
|
|
|
137
139
|
error.code = "authorization_refresh_failed"; throw error;
|
|
138
140
|
}
|
|
139
141
|
authenticationAttempted = true;
|
|
140
|
-
validSession = await ensureSqmSession(webOrigin, { noOpen: argv.includes("--no-open"), rejectedToken, expectedScope, logger: authorizationLogger });
|
|
142
|
+
validSession = await ensureSqmSession(webOrigin, { allowConnect, noOpen: argv.includes("--no-open"), rejectedToken, expectedScope, logger: authorizationLogger });
|
|
141
143
|
token = validSession.token;
|
|
142
144
|
common.token = token;
|
|
143
145
|
return { token, accountId: validSession.account_id || validSession.auth_user_id || validSession.device_id,
|
|
@@ -293,6 +295,8 @@ Options:
|
|
|
293
295
|
--offline Use only the last verified cached knowledge bundle
|
|
294
296
|
--refresh Revalidate the signed bundle
|
|
295
297
|
--no-open Print the sign-in URL instead of opening a browser
|
|
298
|
+
--no-connect Require an existing session; never start authorization
|
|
299
|
+
--require-existing-signing-key Sign only with an existing device key
|
|
296
300
|
--output <path> min-check result path
|
|
297
301
|
--min-result <path> full check input (default: this worktree/scope's min-check)
|
|
298
302
|
--proof <path> proof output (default: a new run outside the repository)
|
|
@@ -388,6 +392,7 @@ function printMin(result, output) {
|
|
|
388
392
|
console.log(`SQM min-check: ${result.status} · ${result.preliminary_findings.length} preliminary finding(s)`);
|
|
389
393
|
console.log(`Pinned bundle ${result.knowledge_bundle.id}@${result.knowledge_bundle.version} (${result.knowledge_bundle.digest})`);
|
|
390
394
|
console.log(`Full-check plan: ${result.full_check_plan.length} scenario(s)`);
|
|
395
|
+
printGuidance(result);
|
|
391
396
|
console.log(`Result: ${output}`);
|
|
392
397
|
}
|
|
393
398
|
|
|
@@ -404,6 +409,7 @@ function printUnavailable(result, argv) {
|
|
|
404
409
|
function printFull(result, webOrigin) {
|
|
405
410
|
console.log(`SQM full check: ${result.status === "stale" ? "stale (candidate or saved artifacts changed; rerun)" : result.proof.outcome.status} · ${result.findings.length} finding(s)`);
|
|
406
411
|
console.log(formatSqmCoverage(result.proof));
|
|
412
|
+
printGuidance(result);
|
|
407
413
|
console.log(`Proof ${result.proof.proof_id} (${result.proof.integrity.digest})`);
|
|
408
414
|
console.log(`Per-run signature: valid · ${result.signature_verification.key_id}`);
|
|
409
415
|
console.log(`Artifacts: ${result.artifacts.proof} · ${result.artifacts.signed_evidence} · ${result.artifacts.diagnostics}`);
|
|
@@ -449,3 +455,13 @@ async function saveUploadReceipt(target, upload) {
|
|
|
449
455
|
console.warn(`Could not save the local storage receipt. Cloud storage is ${upload.uploaded ? "confirmed" : "unconfirmed"}.`);
|
|
450
456
|
}
|
|
451
457
|
}
|
|
458
|
+
|
|
459
|
+
function printGuidance(result) {
|
|
460
|
+
for (const item of result.advisory_guidance || []) {
|
|
461
|
+
console.log(`Reference guidance ${item.module_id}@${item.module_version}: ${item.guidance.statement}`);
|
|
462
|
+
console.log(`Applicability (review current context): ${item.guidance.applicability.join('; ')}`);
|
|
463
|
+
console.log(`Limitations: ${item.guidance.limitations.join('; ')}`);
|
|
464
|
+
for (const source of item.sources) console.log(`Source: ${source.label} (${source.version}, ${source.section}) ${source.url}`);
|
|
465
|
+
console.log("Guidance executes 0 checks and certifies no quality, incident coverage or delivery acceptance.");
|
|
466
|
+
}
|
|
467
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ADVISORY_GUIDANCE_CAPABILITY, isAdvisoryGuidance, advisoryGuidanceDescriptions } from './advisory-guidance.js';
|
|
1
2
|
import { CLI_VERSION } from '../cli-contract.js';
|
|
2
3
|
import { isSessionValid, readSession } from '../session-store.js';
|
|
3
4
|
import { resolveWebOrigin } from '../web-origin.js';
|
|
@@ -34,7 +35,7 @@ export async function loadHypothesisKnowledge({ cwd, webOrigin, allowNetwork = f
|
|
|
34
35
|
const credentials = explicit ? { organizationId: env.SIMY_SQM_ORGANIZATION_ID, accountId: env.SIMY_SQM_ACCOUNT_ID, token: env.SIMY_SQM_TOKEN || env.SIMY_ACCESS_TOKEN, endpoint: env.SIMY_SQM_BUNDLE_URL } : { organizationId: session.organization_id || session.org_id, accountId: session.account_id || session.auth_user_id || session.device_id, token: session.token, endpoint: savedEndpoint };
|
|
35
36
|
if (!credentials.accountId || !credentials.organizationId || !credentials.token) return unavailable('existing_sqm_identity_incomplete');
|
|
36
37
|
const repository = await repositoryIdentityImpl(cwd, { signal });
|
|
37
|
-
const loaded = await loadBundleImpl({ repository, cliVersion: CLI_VERSION,
|
|
38
|
+
const loaded = await loadBundleImpl({ repository, capabilities: [ADVISORY_GUIDANCE_CAPABILITY], cliVersion: CLI_VERSION,
|
|
38
39
|
...credentials,
|
|
39
40
|
fetchImpl: async (...args) => {
|
|
40
41
|
if (!allowNetwork) throw Error('Network knowledge retrieval is unavailable.');
|
|
@@ -44,7 +45,7 @@ export async function loadHypothesisKnowledge({ cwd, webOrigin, allowNetwork = f
|
|
|
44
45
|
offline: !allowNetwork, signal: signal ? AbortSignal.any([signal, AbortSignal.timeout(KNOWLEDGE_TIMEOUT_MS)]) : AbortSignal.timeout(KNOWLEDGE_TIMEOUT_MS),
|
|
45
46
|
});
|
|
46
47
|
if (!loaded.bundle) return unavailable(loaded.diagnostic?.code || 'verified_knowledge_unavailable');
|
|
47
|
-
const eligible = loaded.bundle.modules.filter(m => !['candidate', 'retired'].includes(m.lifecycle.status) &&
|
|
48
|
+
const eligible = loaded.bundle.modules.filter(m => !isAdvisoryGuidance(m) && !['candidate', 'retired'].includes(m.lifecycle.status) &&
|
|
48
49
|
(!m.scope.repositories?.length || m.scope.repositories.some(r => r.toLowerCase() === repository.toLowerCase())));
|
|
49
50
|
const modules = eligible.slice(0, 20).map(m => ({ moduleId: m.id, version: m.version,
|
|
50
51
|
title: String(m.title || '').slice(0, 140), invariant: String(m.invariant.statement).slice(0, 450),
|
|
@@ -52,7 +53,7 @@ export async function loadHypothesisKnowledge({ cwd, webOrigin, allowNetwork = f
|
|
|
52
53
|
lifecycle: m.lifecycle.status, incidentRefs: m.incident_refs.slice(0, 3) }));
|
|
53
54
|
return { status: 'available', repository, bundleDigest: loaded.bundle.integrity.digest,
|
|
54
55
|
availableCount: eligible.length, omittedCount: eligible.length - modules.length, modules,
|
|
55
|
-
source: loaded.source, fetchedFor: 'hypothesis_reasoning_only', executedTests: 0 };
|
|
56
|
+
advisoryGuidance: advisoryGuidanceDescriptions(loaded.bundle, repository), source: loaded.source, fetchedFor: 'hypothesis_reasoning_only', executedTests: 0 };
|
|
56
57
|
} catch (error) {
|
|
57
58
|
if (signal?.aborted) throw signal.reason;
|
|
58
59
|
const diagnostic = sqmDiagnostic(error, 'knowledge_loading');
|
package/src/sqm/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { planLocalTests, executeLocalTests } from './local-tests.js';
|
|
2
|
+
import { ADVISORY_GUIDANCE_CAPABILITY } from './advisory-guidance.js';
|
|
2
3
|
import { sqmConversationIdentity } from './conversation-identity.js';
|
|
3
4
|
import { sqmCoverageWarnings } from "./report.js";
|
|
4
5
|
import { safeSqmDiagnostic } from "./diagnostics.js";
|
|
@@ -27,6 +28,7 @@ export function createSqmChecker({
|
|
|
27
28
|
historyRoot,
|
|
28
29
|
evidenceEndpoint,
|
|
29
30
|
signingKeyPath,
|
|
31
|
+
createSigningKey,
|
|
30
32
|
uploadRunEvidenceImpl = uploadRunEvidence,
|
|
31
33
|
inspectRepositoryImpl = inspectRepository,
|
|
32
34
|
loadKnowledgeBundleImpl = loadKnowledgeBundle,
|
|
@@ -64,9 +66,14 @@ export function createSqmChecker({
|
|
|
64
66
|
if (pinnedRepository && pinnedRepository !== repository.repository) return unavailable(`SQM repository changed during a pinned run (${pinnedRepository} to ${repository.repository}).`, repository.repository);
|
|
65
67
|
if (!pinnedLoad) {
|
|
66
68
|
pinnedRepository = repository.repository;
|
|
67
|
-
pinnedLoad = loadKnowledgeBundleImpl({ ...dependencies, repository: repository.repository, cliVersion, offline, refresh, token, endpoint, accountId, organizationId, onRecoveryEvent });
|
|
69
|
+
pinnedLoad = loadKnowledgeBundleImpl({ ...dependencies, repository: repository.repository, capabilities: [ADVISORY_GUIDANCE_CAPABILITY], cliVersion, offline, refresh, token, endpoint, accountId, organizationId, onRecoveryEvent });
|
|
68
70
|
}
|
|
69
|
-
const
|
|
71
|
+
const loadForCheck = pinnedLoad;
|
|
72
|
+
let loaded;
|
|
73
|
+
// Selection/revocation must be revalidated for every phase, including
|
|
74
|
+
// after failures. Share only the current in-flight load, never its result.
|
|
75
|
+
try { loaded = await loadForCheck; }
|
|
76
|
+
finally { if (pinnedLoad === loadForCheck) pinnedLoad = null; }
|
|
70
77
|
if (!loaded.bundle) {
|
|
71
78
|
// A failed read must not poison the run permanently. A later explicit
|
|
72
79
|
// same-scope check or refreshed sign-in may try loading again.
|
|
@@ -93,7 +100,7 @@ export function createSqmChecker({
|
|
|
93
100
|
throw candidateError("Repository identity changed during SQM full verification; no current proof can be signed.");
|
|
94
101
|
}
|
|
95
102
|
signal?.throwIfAborted();
|
|
96
|
-
const full = await buildFullCheck({ repository, bundle: loaded.bundle, minCheck: latestMinCheck, evaluation: fullEvaluation, organizationId: organizationId || loaded.bundle.organization_id, cliVersion, deviceId, accountId, signingKeyPath });
|
|
103
|
+
const full = await buildFullCheck({ repository, bundle: loaded.bundle, minCheck: latestMinCheck, evaluation: fullEvaluation, organizationId: organizationId || loaded.bundle.organization_id, cliVersion, deviceId, accountId, signingKeyPath, createSigningKey });
|
|
97
104
|
signal?.throwIfAborted();
|
|
98
105
|
try {
|
|
99
106
|
full.upload = await uploadRunEvidenceImpl({ endpoint: evidenceEndpoint, token, proof: full.proof, signedEvidence: full.signed_evidence });
|
|
@@ -175,7 +182,7 @@ export async function runSqmCheck(options) {
|
|
|
175
182
|
throw candidateError("Repository identity changed during SQM full verification; no current proof can be signed.");
|
|
176
183
|
}
|
|
177
184
|
options.signal?.throwIfAborted();
|
|
178
|
-
const result = await buildFullCheck({ repository: context.repository, bundle: context.loaded.bundle, minCheck, evaluation, organizationId: options.organizationId, cliVersion: options.cliVersion, deviceId: options.deviceId, accountId: options.accountId, signingKeyPath: options.signingKeyPath });
|
|
185
|
+
const result = await buildFullCheck({ repository: context.repository, bundle: context.loaded.bundle, minCheck, evaluation, organizationId: options.organizationId, cliVersion: options.cliVersion, deviceId: options.deviceId, accountId: options.accountId, signingKeyPath: options.signingKeyPath, createSigningKey: options.createSigningKey });
|
|
179
186
|
options.signal?.throwIfAborted();
|
|
180
187
|
if (minCheck !== options.minCheck) result.recovery = { code: "knowledge_bundle_changed", previous_min_digest: options.minCheck.result_digest, current_min_digest: minCheck.result_digest };
|
|
181
188
|
return result;
|
|
@@ -187,7 +194,7 @@ async function loadContext(options) {
|
|
|
187
194
|
const originalIdentity = repositoryIdentity(repository);
|
|
188
195
|
const scope = Object.fromEntries(["accountId", "organizationId", "deviceId", "endpoint"].map(field => [field, options[field]]));
|
|
189
196
|
const load = (token) => (options.loadKnowledgeBundleImpl || loadKnowledgeBundle)({ ...(options.bundleDependencies || {}),
|
|
190
|
-
repository: repository.repository, cliVersion: options.cliVersion, offline: options.offline, refresh: options.refresh,
|
|
197
|
+
repository: repository.repository, capabilities: [ADVISORY_GUIDANCE_CAPABILITY], cliVersion: options.cliVersion, offline: options.offline, refresh: options.refresh,
|
|
191
198
|
token, endpoint: scope.endpoint, accountId: scope.accountId, organizationId: scope.organizationId });
|
|
192
199
|
let loaded = await load(rejectedToken);
|
|
193
200
|
if (!loaded.bundle && loaded.diagnostic?.http_status === 401 && options.onAuthenticationRequired && !options.offline) {
|
|
@@ -219,6 +226,7 @@ async function buildMinCheck({ repository, bundle, evaluation, organizationId, c
|
|
|
219
226
|
preliminary_findings: evaluation.findings,
|
|
220
227
|
matched_modules: evaluation.modules.map((module) => ({ module_id: module.module_id, module_version: module.module_version, state_model_ids: module.state_models.map((model) => model.id), transition_ids: module.state_models.flatMap((model) => model.transitions.map((transition) => transition.id)), stressor_ids: module.stressors.map((stressor) => stressor.id), scenario_ids: module.scenarios.map((scenario) => scenario.id) })),
|
|
221
228
|
full_check_plan: plan,
|
|
229
|
+
...(evaluation.advisoryGuidance?.length ? { advisory_guidance: evaluation.advisoryGuidance } : {}),
|
|
222
230
|
coverage_reasons: [
|
|
223
231
|
...(evaluation.modules.length === 0 ? ["no_applicable_rules"] : []),
|
|
224
232
|
...(bundle.modules?.length === 0 ? ["no_system_knowledge"] : []),
|
|
@@ -229,9 +237,9 @@ async function buildMinCheck({ repository, bundle, evaluation, organizationId, c
|
|
|
229
237
|
});
|
|
230
238
|
}
|
|
231
239
|
|
|
232
|
-
async function buildFullCheck({ repository, bundle, minCheck, evaluation, organizationId, cliVersion, deviceId, accountId, signingKeyPath }) {
|
|
240
|
+
async function buildFullCheck({ repository, bundle, minCheck, evaluation, organizationId, cliVersion, deviceId, accountId, signingKeyPath, createSigningKey }) {
|
|
233
241
|
const proof = buildProof({ organizationId, repository, bundle, minCheck, evaluation, findings: evaluation.findings, cliVersion });
|
|
234
|
-
const signedEvidence = await signProof(proof, { deviceId, accountId, keyPath: signingKeyPath });
|
|
242
|
+
const signedEvidence = await signProof(proof, { deviceId, accountId, keyPath: signingKeyPath, createSigningKey });
|
|
235
243
|
const verification = verifySignedEvidence(proof, signedEvidence);
|
|
236
244
|
return {
|
|
237
245
|
status: "checked",
|
|
@@ -243,6 +251,7 @@ async function buildFullCheck({ repository, bundle, minCheck, evaluation, organi
|
|
|
243
251
|
findings: evaluation.findings,
|
|
244
252
|
executions: evaluation.modules,
|
|
245
253
|
...(evaluation.localTests ? { local_test_results: evaluation.localTests } : {}),
|
|
254
|
+
...(evaluation.advisoryGuidance?.length ? { advisory_guidance: evaluation.advisoryGuidance } : {}),
|
|
246
255
|
checked_descriptions: [...checkedDescriptions(evaluation.modules, bundle), ...(evaluation.localTests?.executions || []).map(row => `Local regression ${row.id}: ${row.status} (${row.counts.pass ?? 0}/${row.counts.tests ?? 0} tests passed)`) ],
|
|
247
256
|
matcher_diagnostics: evaluation.matcherDiagnostics || [],
|
|
248
257
|
proof,
|
|
@@ -253,7 +262,7 @@ async function buildFullCheck({ repository, bundle, minCheck, evaluation, organi
|
|
|
253
262
|
}
|
|
254
263
|
|
|
255
264
|
function toLegacyCheck(minCheck, loaded) {
|
|
256
|
-
return { status: "checked", mode: "min", repository: minCheck.repository_identity.repository, base_ref: minCheck.repository_identity.base_ref, source: loaded.source, checked_descriptions: checkedDescriptions(minCheck.matched_modules, loaded.bundle), warnings: [...loaded.warnings, ...(minCheck.warnings || [])], bundle: minCheck.knowledge_bundle, findings: minCheck.preliminary_findings, min_check: minCheck };
|
|
265
|
+
return { status: "checked", mode: "min", repository: minCheck.repository_identity.repository, base_ref: minCheck.repository_identity.base_ref, source: loaded.source, checked_descriptions: checkedDescriptions(minCheck.matched_modules, loaded.bundle), warnings: [...loaded.warnings, ...(minCheck.warnings || [])], ...(minCheck.advisory_guidance ? { advisory_guidance: minCheck.advisory_guidance } : {}), bundle: minCheck.knowledge_bundle, findings: minCheck.preliminary_findings, min_check: minCheck };
|
|
257
266
|
}
|
|
258
267
|
|
|
259
268
|
// Display descriptions come from the verified knowledge bundle. They are
|
package/src/sqm/proof.js
CHANGED
|
@@ -108,9 +108,19 @@ export async function signProof(proof, {
|
|
|
108
108
|
accountId = null,
|
|
109
109
|
keyPath = process.env.SIMY_SQM_SIGNING_KEY_PATH || path.join(process.env.SIMY_HOME?.trim() || path.join(homedir(), ".simy"), "sqm", "run-signing-key.json"),
|
|
110
110
|
issuedAt = new Date().toISOString(),
|
|
111
|
+
createSigningKey = true,
|
|
111
112
|
} = {}) {
|
|
112
113
|
if (!deviceId) throw new Error("A trusted SIMY CLI device identity is required to sign SQM proof.");
|
|
113
|
-
const identity = await loadDeviceSigningIdentity(keyPath, {
|
|
114
|
+
const identity = await loadDeviceSigningIdentity(keyPath, {
|
|
115
|
+
create: createSigningKey && process.env.SIMY_SQM_REQUIRE_EXISTING_SIGNING_KEY !== "1",
|
|
116
|
+
});
|
|
117
|
+
if (!identity) {
|
|
118
|
+
const error = new Error("signing_key_required: SQM requires an existing device signing key. Provision it explicitly outside this command, then retry.");
|
|
119
|
+
error.code = "signing_key_required";
|
|
120
|
+
error.stage = "proof_signing";
|
|
121
|
+
error.retryable = false;
|
|
122
|
+
throw error;
|
|
123
|
+
}
|
|
114
124
|
const proofDigest = verifyProof(proof);
|
|
115
125
|
const signature = sign(null, Buffer.from(proofDigest.slice("sha256:".length), "hex"), identity.privateKey).toString("base64");
|
|
116
126
|
return {
|
package/src/sqm/session.js
CHANGED
|
@@ -12,6 +12,7 @@ export async function ensureSqmSession(
|
|
|
12
12
|
webOrigin,
|
|
13
13
|
{
|
|
14
14
|
noOpen = false,
|
|
15
|
+
allowConnect = true,
|
|
15
16
|
timeoutMs = BROWSER_AUTHORIZATION_TIMEOUT_MS,
|
|
16
17
|
logger = console,
|
|
17
18
|
now = Date.now,
|
|
@@ -35,6 +36,14 @@ export async function ensureSqmSession(
|
|
|
35
36
|
return session;
|
|
36
37
|
}
|
|
37
38
|
|
|
39
|
+
if (!allowConnect || process.env.SIMY_SQM_NO_CONNECT === "1") {
|
|
40
|
+
const error = new Error("auth_session_required: SQM requires an existing valid session. Connect explicitly outside this command, then retry.");
|
|
41
|
+
error.code = "auth_session_required";
|
|
42
|
+
error.stage = "authorization";
|
|
43
|
+
error.retryable = false;
|
|
44
|
+
throw error;
|
|
45
|
+
}
|
|
46
|
+
|
|
38
47
|
const existing = await findConnectionImpl({ webOrigin, cliVersion: CLI_VERSION,
|
|
39
48
|
apiContractVersion: CLI_API_CONTRACT_VERSION, expectedScope: connectionScope(session, webOrigin),
|
|
40
49
|
authorize: true, reauthorize: session?.token === rejectedToken && Boolean(rejectedToken) });
|
package/src/sqm/validation.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isAdvisoryGuidance, validateAdvisoryGuidance } from './advisory-guidance.js';
|
|
1
2
|
import { validateReasonedAssessment } from './reasoned-assessment.js';
|
|
2
3
|
|
|
3
4
|
const SEMVER = /^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$/;
|
|
@@ -42,7 +43,10 @@ export function validateKnowledgeBundle(bundle, { cliVersion }) {
|
|
|
42
43
|
}
|
|
43
44
|
if (!Array.isArray(bundle?.modules)) errors.push("$.modules must be an array");
|
|
44
45
|
for (const [index, module] of (bundle?.modules || []).entries()) {
|
|
45
|
-
|
|
46
|
+
if (module?.schema_version === "1.2.0" || module?.kind === "advisory_guidance") {
|
|
47
|
+
validateAdvisoryGuidance(module, `$.modules[${index}]`, errors, cliVersion, compareSemver);
|
|
48
|
+
if (!bundle.system_scope) errors.push("Guidance requires online system scope validation");
|
|
49
|
+
} else validateModule(module, `$.modules[${index}]`, errors, cliVersion);
|
|
46
50
|
}
|
|
47
51
|
object(bundle?.integrity, "$.integrity", errors);
|
|
48
52
|
exactKeys(bundle?.integrity, ["algorithm", "digest", "key_id", "signature"], "$.integrity", errors);
|