snipara-companion 3.0.0 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +4 -1
- package/dist/index.js +383 -81
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2161,6 +2161,8 @@ declare const ENGINEERING_LEAD_WORK_PACKAGE_STATUSES: readonly ["contracting", "
|
|
|
2161
2161
|
declare const ENGINEERING_LEAD_SUPERVISION_STATUSES: readonly ["on_track", "needs_review", "needs_replan", "blocked", "cold_start", "unknown"];
|
|
2162
2162
|
declare const ENGINEERING_LEAD_EXECUTION_RECEIPT_STATUSES: readonly ["pending_handoff", "handoff_ready", "executing", "verification_required", "blocked", "closed", "unknown"];
|
|
2163
2163
|
declare const ENGINEERING_LEAD_EXECUTION_RECEIPT_STAGES: readonly ["handoff", "claim", "approval", "proof", "outcome", "brain_update"];
|
|
2164
|
+
declare const ENGINEERING_LEAD_PROOF_VERIFICATION_STATUSES: readonly ["declared", "provided", "verified", "rejected", "unknown"];
|
|
2165
|
+
declare const ENGINEERING_LEAD_PROOF_VERIFICATION_SOURCES: readonly ["agent_report", "companion_handoff", "local_command", "ci", "htask", "manual", "unknown"];
|
|
2164
2166
|
type EngineeringLeadPlanSummary = ProjectIntelligenceEngineeringLeadPlanSummary;
|
|
2165
2167
|
interface CompanionEngineeringLeadReconciliation {
|
|
2166
2168
|
status: "on_track" | "needs_review" | "needs_replan" | "blocked";
|
|
@@ -3628,6 +3630,7 @@ interface OrchestratorHandoffOptions {
|
|
|
3628
3630
|
rootDir?: string;
|
|
3629
3631
|
changedFiles?: string[];
|
|
3630
3632
|
contextRefs?: string[];
|
|
3633
|
+
decisionIds?: string[];
|
|
3631
3634
|
resumeSummary?: string;
|
|
3632
3635
|
featureTitle?: string;
|
|
3633
3636
|
workstreams?: string[];
|
|
@@ -3643,4 +3646,4 @@ declare function buildOrchestratorHandoff(options: OrchestratorHandoffOptions):
|
|
|
3643
3646
|
declare function buildAdaptiveWorkRoutingRecommendation(options: AdaptiveWorkRoutingOptions): AdaptiveWorkRoutingRecommendation;
|
|
3644
3647
|
declare function writeOrchestratorHandoff(options: OrchestratorHandoffOptions): WrittenOrchestratorHandoff;
|
|
3645
3648
|
|
|
3646
|
-
export { AUTOMATION_MANIFEST_RELATIVE_PATH, AutomationInstallConflictError, AutomationUnsupportedHookBundleError, COLLABORATION_STATE_RELATIVE_PATH, ENGINEERING_LEAD_EXECUTION_RECEIPT_STAGES, ENGINEERING_LEAD_EXECUTION_RECEIPT_STATUSES, ENGINEERING_LEAD_POSTURES, ENGINEERING_LEAD_ROUTING_MODES, ENGINEERING_LEAD_STATUSES, ENGINEERING_LEAD_SUPERVISION_STATUSES, ENGINEERING_LEAD_WORKER_ROLES, ENGINEERING_LEAD_WORK_PACKAGE_STATUSES, ORCHESTRATOR_HANDOFF_RELATIVE_PATH, TEAM_SYNC_STATE_RELATIVE_PATH, WORKFLOW_PLANS_RELATIVE_DIR, WORKFLOW_STATE_RELATIVE_PATH, agentReadinessAuditCommand, archiveInactiveTeamSyncWork, attachLocalContextPackReceipts, autoArchiveTeamSyncState, buildAdaptiveWorkRoutingRecommendation, buildAgentReadinessAuditReport, buildAgenticHandoffMarkdown, buildAgenticTimeline, buildAgenticWorkStatus, buildAutomationInstallPlan, buildCanonicalEvent, buildCodeHooksInstallPlan, buildCodePromotionResult, buildCodeStatusResult, buildCodeSyncResult, buildCollaborationActor, buildCollaborationGuardActionCards, buildCollaborationHooksInstallPlan, buildCompanionEngineeringLeadPlanReport, buildContextPackStats, buildEvalCaseArtifact, buildGeneratedWorkflowPlanDocument, buildHostedCodeOverlayUploadPayload, buildHostedGuardPayload, buildJournalCheckpointEntry, buildLocalCallersResult, buildLocalCodeOverlay, buildLocalContextPackReceipt, buildLocalContextPackReceipts, buildLocalImpactResult, buildLocalImportsResult, buildLocalNeighborsResult, buildLocalShortestPathResult, buildLocalSourceSnapshot, buildLocalSourceStatus, buildLocalSourceSyncResult, buildMemoryAudit, buildOnboardFolderManifest, buildOrchestratorHandoff, buildProjectIntelligenceBrief, buildProjectIntelligenceRun, buildProjectJudgmentCard, buildSessionBootstrapQuality, buildSyncDocumentsDryRun, buildTeamSyncHandoffRecord, buildTeamSyncStartWorkRecord, buildTeamSyncSummary, buildToolCallPayload, buildToolResultPayload, buildVerificationPlan, buildWorkflowImpactGate, buildWorkflowPhaseCommitSummary, buildWorkflowPlanScaffold, categoryFromGuardTag, classifyToolResult, cleanContextPacks, collaborationIdeStatusCommand, collectAgentReadinessLocalSignals, collectSyncDocuments, collectSyncDocumentsInput, compactHostedGuardResources, compareLocalSourceSnapshots, completeTeamSyncStateFromEvidence, completeTeamSyncWorkFromEvidence, contextPackCleanCommand, contextPackPackCommand, contextPackRetrieveCommand, contextPackStatsCommand, createClient, createEmptyCollaborationState, createEmptyTeamSyncState, createLocalQueryCache, deriveLocalCollaborationResourcesFromFiles, detectReleaseSurfacesFromFiles, detectRuntimeEnvironment, evalExportCommand, evalRunCommand, evaluateProjectPolicyGates, extractCommandFromToolInput, extractFilesFromToolInput, formatAgentReadinessAuditReport, formatCompanionEngineeringLeadPlanReport, formatOrchestratorRecommendationReason, formatPolicyGateDecision, formatProjectJudgmentCard, formatStuckGuardDecision, getAutomationManifestPath, getAutomationStatus, getCollaborationStatePath, getConfigPath, getContextPackStoragePaths, getLocalCodeOverlayCachePath, getLocalCodePromotionStatePath, getLocalSourceSnapshotPath, getOrchestratorRecommendation, getPlanStepDisplayTitle, getStagedFiles, getStuckGuardInjection, getTeamSyncStatePath, ingestReferences, installAutomationBundle, leadPlanCommand, listProjectsForApiKey, loadAutomationManifest, loadCollaborationState, loadConfig, loadTeamSyncState, memoryAuditCommand, memoryCleanCandidatesCommand, memoryCompactCommand, memoryHealthCommand, memoryLocalCommand, normalizeCollaborationFiles, normalizeGuardTag, normalizeWorkflowPlanInput, packContext, parseCollaborationResources, projectIntelligenceBriefCommand, projectIntelligenceRunCommand, readLocalCodeOverlayCache, readLocalCodePromotionState, readLocalSourceSnapshot, referencesIngestCommand, referencesScanCommand, resolveContextPackRecord, resolveFullWorkflowTokenBudget, resolveQueryFromToolInput, retrieveContextPack, runMemoryGuardCheck, saveCollaborationState, saveConfig, saveTeamSyncState, scanReferences, shouldSuggestOrchestratorForWorkflow, shouldSuggestRuntimeForWorkflow, summarizeLocalCodeOverlay, teamSyncSweepCommand, validatePlanResult, verifyCommand, writeLocalCodeOverlayCache, writeLocalCodePromotionState, writeLocalSourceSnapshot, writeOrchestratorHandoff };
|
|
3649
|
+
export { AUTOMATION_MANIFEST_RELATIVE_PATH, AutomationInstallConflictError, AutomationUnsupportedHookBundleError, COLLABORATION_STATE_RELATIVE_PATH, ENGINEERING_LEAD_EXECUTION_RECEIPT_STAGES, ENGINEERING_LEAD_EXECUTION_RECEIPT_STATUSES, ENGINEERING_LEAD_POSTURES, ENGINEERING_LEAD_PROOF_VERIFICATION_SOURCES, ENGINEERING_LEAD_PROOF_VERIFICATION_STATUSES, ENGINEERING_LEAD_ROUTING_MODES, ENGINEERING_LEAD_STATUSES, ENGINEERING_LEAD_SUPERVISION_STATUSES, ENGINEERING_LEAD_WORKER_ROLES, ENGINEERING_LEAD_WORK_PACKAGE_STATUSES, ORCHESTRATOR_HANDOFF_RELATIVE_PATH, TEAM_SYNC_STATE_RELATIVE_PATH, WORKFLOW_PLANS_RELATIVE_DIR, WORKFLOW_STATE_RELATIVE_PATH, agentReadinessAuditCommand, archiveInactiveTeamSyncWork, attachLocalContextPackReceipts, autoArchiveTeamSyncState, buildAdaptiveWorkRoutingRecommendation, buildAgentReadinessAuditReport, buildAgenticHandoffMarkdown, buildAgenticTimeline, buildAgenticWorkStatus, buildAutomationInstallPlan, buildCanonicalEvent, buildCodeHooksInstallPlan, buildCodePromotionResult, buildCodeStatusResult, buildCodeSyncResult, buildCollaborationActor, buildCollaborationGuardActionCards, buildCollaborationHooksInstallPlan, buildCompanionEngineeringLeadPlanReport, buildContextPackStats, buildEvalCaseArtifact, buildGeneratedWorkflowPlanDocument, buildHostedCodeOverlayUploadPayload, buildHostedGuardPayload, buildJournalCheckpointEntry, buildLocalCallersResult, buildLocalCodeOverlay, buildLocalContextPackReceipt, buildLocalContextPackReceipts, buildLocalImpactResult, buildLocalImportsResult, buildLocalNeighborsResult, buildLocalShortestPathResult, buildLocalSourceSnapshot, buildLocalSourceStatus, buildLocalSourceSyncResult, buildMemoryAudit, buildOnboardFolderManifest, buildOrchestratorHandoff, buildProjectIntelligenceBrief, buildProjectIntelligenceRun, buildProjectJudgmentCard, buildSessionBootstrapQuality, buildSyncDocumentsDryRun, buildTeamSyncHandoffRecord, buildTeamSyncStartWorkRecord, buildTeamSyncSummary, buildToolCallPayload, buildToolResultPayload, buildVerificationPlan, buildWorkflowImpactGate, buildWorkflowPhaseCommitSummary, buildWorkflowPlanScaffold, categoryFromGuardTag, classifyToolResult, cleanContextPacks, collaborationIdeStatusCommand, collectAgentReadinessLocalSignals, collectSyncDocuments, collectSyncDocumentsInput, compactHostedGuardResources, compareLocalSourceSnapshots, completeTeamSyncStateFromEvidence, completeTeamSyncWorkFromEvidence, contextPackCleanCommand, contextPackPackCommand, contextPackRetrieveCommand, contextPackStatsCommand, createClient, createEmptyCollaborationState, createEmptyTeamSyncState, createLocalQueryCache, deriveLocalCollaborationResourcesFromFiles, detectReleaseSurfacesFromFiles, detectRuntimeEnvironment, evalExportCommand, evalRunCommand, evaluateProjectPolicyGates, extractCommandFromToolInput, extractFilesFromToolInput, formatAgentReadinessAuditReport, formatCompanionEngineeringLeadPlanReport, formatOrchestratorRecommendationReason, formatPolicyGateDecision, formatProjectJudgmentCard, formatStuckGuardDecision, getAutomationManifestPath, getAutomationStatus, getCollaborationStatePath, getConfigPath, getContextPackStoragePaths, getLocalCodeOverlayCachePath, getLocalCodePromotionStatePath, getLocalSourceSnapshotPath, getOrchestratorRecommendation, getPlanStepDisplayTitle, getStagedFiles, getStuckGuardInjection, getTeamSyncStatePath, ingestReferences, installAutomationBundle, leadPlanCommand, listProjectsForApiKey, loadAutomationManifest, loadCollaborationState, loadConfig, loadTeamSyncState, memoryAuditCommand, memoryCleanCandidatesCommand, memoryCompactCommand, memoryHealthCommand, memoryLocalCommand, normalizeCollaborationFiles, normalizeGuardTag, normalizeWorkflowPlanInput, packContext, parseCollaborationResources, projectIntelligenceBriefCommand, projectIntelligenceRunCommand, readLocalCodeOverlayCache, readLocalCodePromotionState, readLocalSourceSnapshot, referencesIngestCommand, referencesScanCommand, resolveContextPackRecord, resolveFullWorkflowTokenBudget, resolveQueryFromToolInput, retrieveContextPack, runMemoryGuardCheck, saveCollaborationState, saveConfig, saveTeamSyncState, scanReferences, shouldSuggestOrchestratorForWorkflow, shouldSuggestRuntimeForWorkflow, summarizeLocalCodeOverlay, teamSyncSweepCommand, validatePlanResult, verifyCommand, writeLocalCodeOverlayCache, writeLocalCodePromotionState, writeLocalSourceSnapshot, writeOrchestratorHandoff };
|
package/dist/index.js
CHANGED
|
@@ -38,6 +38,8 @@ __export(index_exports, {
|
|
|
38
38
|
ENGINEERING_LEAD_EXECUTION_RECEIPT_STAGES: () => ENGINEERING_LEAD_EXECUTION_RECEIPT_STAGES,
|
|
39
39
|
ENGINEERING_LEAD_EXECUTION_RECEIPT_STATUSES: () => ENGINEERING_LEAD_EXECUTION_RECEIPT_STATUSES,
|
|
40
40
|
ENGINEERING_LEAD_POSTURES: () => ENGINEERING_LEAD_POSTURES,
|
|
41
|
+
ENGINEERING_LEAD_PROOF_VERIFICATION_SOURCES: () => ENGINEERING_LEAD_PROOF_VERIFICATION_SOURCES,
|
|
42
|
+
ENGINEERING_LEAD_PROOF_VERIFICATION_STATUSES: () => ENGINEERING_LEAD_PROOF_VERIFICATION_STATUSES,
|
|
41
43
|
ENGINEERING_LEAD_ROUTING_MODES: () => ENGINEERING_LEAD_ROUTING_MODES,
|
|
42
44
|
ENGINEERING_LEAD_STATUSES: () => ENGINEERING_LEAD_STATUSES,
|
|
43
45
|
ENGINEERING_LEAD_SUPERVISION_STATUSES: () => ENGINEERING_LEAD_SUPERVISION_STATUSES,
|
|
@@ -2899,6 +2901,7 @@ var SUPPORTED_EXTENSIONS = /* @__PURE__ */ new Map([
|
|
|
2899
2901
|
var DEFAULT_MAX_FILES = 2e3;
|
|
2900
2902
|
var DEFAULT_MAX_FILE_BYTES = 1024 * 1024;
|
|
2901
2903
|
var DEFAULT_HOSTED_OVERLAY_TTL_HOURS = 48;
|
|
2904
|
+
var MAX_HOSTED_OVERLAY_TTL_HOURS = 168;
|
|
2902
2905
|
var DEFAULT_HOOK_REINDEX_DELAY_SECONDS = 5;
|
|
2903
2906
|
var CACHE_RELATIVE_PATH = import_path.default.join(".snipara", "code-overlay", "latest.json");
|
|
2904
2907
|
var PROMOTION_RELATIVE_PATH = import_path.default.join(".snipara", "code-overlay", "promotion.json");
|
|
@@ -2961,8 +2964,14 @@ function ensureTrailingNewline2(content) {
|
|
|
2961
2964
|
return content.endsWith("\n") ? content : `${content}
|
|
2962
2965
|
`;
|
|
2963
2966
|
}
|
|
2964
|
-
function positiveInteger2(value, fallback) {
|
|
2965
|
-
|
|
2967
|
+
function positiveInteger2(value, fallback, label = "value") {
|
|
2968
|
+
if (value === void 0) {
|
|
2969
|
+
return fallback;
|
|
2970
|
+
}
|
|
2971
|
+
if (Number.isFinite(value) && value > 0) {
|
|
2972
|
+
return Math.floor(value);
|
|
2973
|
+
}
|
|
2974
|
+
throw new Error(`${label} must be a positive integer.`);
|
|
2966
2975
|
}
|
|
2967
2976
|
function nonNegativeInteger(value, fallback) {
|
|
2968
2977
|
return Number.isFinite(value) && value !== void 0 && value >= 0 ? Math.floor(value) : fallback;
|
|
@@ -3344,8 +3353,12 @@ function buildLocalCodeOverlay(options = {}) {
|
|
|
3344
3353
|
const repoRoot = resolveRepoRoot2(options.cwd ?? process.cwd());
|
|
3345
3354
|
const mode = options.mode ?? "working_tree";
|
|
3346
3355
|
const commit = mode === "local_commit" ? options.commit ?? "HEAD" : options.commit ?? "HEAD";
|
|
3347
|
-
const maxFiles = positiveInteger2(options.maxFiles, DEFAULT_MAX_FILES);
|
|
3348
|
-
const maxFileBytes = positiveInteger2(
|
|
3356
|
+
const maxFiles = positiveInteger2(options.maxFiles, DEFAULT_MAX_FILES, "--max-files");
|
|
3357
|
+
const maxFileBytes = positiveInteger2(
|
|
3358
|
+
options.maxFileBytes,
|
|
3359
|
+
DEFAULT_MAX_FILE_BYTES,
|
|
3360
|
+
"--max-file-bytes"
|
|
3361
|
+
);
|
|
3349
3362
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
3350
3363
|
const branch = readBranch(repoRoot);
|
|
3351
3364
|
const localHeadSha = readHeadSha(repoRoot);
|
|
@@ -4193,7 +4206,14 @@ function buildHostedCodeOverlayUploadPayload(options = {}) {
|
|
|
4193
4206
|
maxFiles: options.maxFiles
|
|
4194
4207
|
});
|
|
4195
4208
|
const cachePath = writeLocalCodeOverlayCache(manifest);
|
|
4196
|
-
const ttlHours = positiveInteger2(
|
|
4209
|
+
const ttlHours = positiveInteger2(
|
|
4210
|
+
options.ttlHours,
|
|
4211
|
+
DEFAULT_HOSTED_OVERLAY_TTL_HOURS,
|
|
4212
|
+
"--ttl-hours"
|
|
4213
|
+
);
|
|
4214
|
+
if (ttlHours > MAX_HOSTED_OVERLAY_TTL_HOURS) {
|
|
4215
|
+
throw new Error(`--ttl-hours must be less than or equal to ${MAX_HOSTED_OVERLAY_TTL_HOURS}.`);
|
|
4216
|
+
}
|
|
4197
4217
|
return {
|
|
4198
4218
|
manifest,
|
|
4199
4219
|
cachePath,
|
|
@@ -10119,6 +10139,12 @@ function buildOrchestratorHandoff(options) {
|
|
|
10119
10139
|
const changedFiles = normalizeStringList(
|
|
10120
10140
|
options.changedFiles ?? (Array.isArray(workflowState?.currentPhase?.files) ? workflowState.currentPhase.files : [])
|
|
10121
10141
|
);
|
|
10142
|
+
const contextRefs = normalizeStringList(options.contextRefs);
|
|
10143
|
+
const decisionIds = normalizeDecisionIds([
|
|
10144
|
+
...normalizeStringList(workflowState?.decisionIds),
|
|
10145
|
+
...normalizeStringList(options.decisionIds),
|
|
10146
|
+
...extractDecisionIdsFromRefs(contextRefs)
|
|
10147
|
+
]);
|
|
10122
10148
|
const requiresProofGate = options.recommendation.reasons.includes("proof_gate_intent") || options.recommendation.reasons.includes("team_sync_collision");
|
|
10123
10149
|
const requiresDriftCheck = options.recommendation.reasons.includes("production_validation_intent") || options.recommendation.reasons.includes("workflow_mode_orchestrate");
|
|
10124
10150
|
return {
|
|
@@ -10187,8 +10213,8 @@ function buildOrchestratorHandoff(options) {
|
|
|
10187
10213
|
] : []
|
|
10188
10214
|
},
|
|
10189
10215
|
memory: {
|
|
10190
|
-
decisionIds
|
|
10191
|
-
contextRefs
|
|
10216
|
+
decisionIds,
|
|
10217
|
+
contextRefs,
|
|
10192
10218
|
resumeSummary: options.resumeSummary ?? null
|
|
10193
10219
|
}
|
|
10194
10220
|
};
|
|
@@ -10424,6 +10450,22 @@ function normalizeEndpointTypes(values) {
|
|
|
10424
10450
|
)
|
|
10425
10451
|
).sort();
|
|
10426
10452
|
}
|
|
10453
|
+
function normalizeDecisionIds(values) {
|
|
10454
|
+
return Array.from(
|
|
10455
|
+
new Set(
|
|
10456
|
+
normalizeStringList(values).map((value) => value.toUpperCase()).filter((value) => /^DEC-[A-Z0-9._-]+$/.test(value))
|
|
10457
|
+
)
|
|
10458
|
+
).sort();
|
|
10459
|
+
}
|
|
10460
|
+
function extractDecisionIdsFromRefs(contextRefs) {
|
|
10461
|
+
const matches = [];
|
|
10462
|
+
for (const ref of contextRefs) {
|
|
10463
|
+
for (const match of ref.matchAll(/\bDEC-[A-Za-z0-9._-]+\b/g)) {
|
|
10464
|
+
matches.push(match[0]);
|
|
10465
|
+
}
|
|
10466
|
+
}
|
|
10467
|
+
return matches;
|
|
10468
|
+
}
|
|
10427
10469
|
function compactObject2(value) {
|
|
10428
10470
|
return Object.fromEntries(
|
|
10429
10471
|
Object.entries(value).filter(
|
|
@@ -10481,9 +10523,20 @@ function readWorkflowState(rootDir) {
|
|
|
10481
10523
|
currentPhaseId: parsed.currentPhaseId,
|
|
10482
10524
|
currentPhase,
|
|
10483
10525
|
phases,
|
|
10484
|
-
runtimeSandboxPhases
|
|
10526
|
+
runtimeSandboxPhases,
|
|
10527
|
+
decisionIds: extractWorkflowDecisionIds(parsed)
|
|
10485
10528
|
};
|
|
10486
10529
|
}
|
|
10530
|
+
function extractWorkflowDecisionIds(parsed) {
|
|
10531
|
+
const fromTopLevel = normalizeStringList(parsed.decisionIds);
|
|
10532
|
+
const fromDecisions = Array.isArray(parsed.decisions) ? parsed.decisions.map((decision) => {
|
|
10533
|
+
if (typeof decision === "string") {
|
|
10534
|
+
return decision;
|
|
10535
|
+
}
|
|
10536
|
+
return isRecord4(decision) ? stringValue2(decision.decisionId) : void 0;
|
|
10537
|
+
}).filter((decisionId) => Boolean(decisionId)) : [];
|
|
10538
|
+
return normalizeDecisionIds([...fromTopLevel, ...fromDecisions]);
|
|
10539
|
+
}
|
|
10487
10540
|
function normalizeContextPackIds(value) {
|
|
10488
10541
|
if (!Array.isArray(value)) {
|
|
10489
10542
|
return [];
|
|
@@ -10934,11 +10987,11 @@ function hostedHandoffTests(hosted) {
|
|
|
10934
10987
|
var ADAPTER_TARGETS = {
|
|
10935
10988
|
codex: {
|
|
10936
10989
|
label: "Codex",
|
|
10937
|
-
instruction: "Use Hosted MCP and AGENTS.md first; keep companion phase state visible."
|
|
10990
|
+
instruction: "Use Hosted MCP and AGENTS.md first; keep companion phase state visible and return the canonical proof receipt."
|
|
10938
10991
|
},
|
|
10939
10992
|
"claude-code": {
|
|
10940
10993
|
label: "Claude Code",
|
|
10941
|
-
instruction: "Use generated/local instructions and return proof through companion handoff."
|
|
10994
|
+
instruction: "Use generated/local instructions and return proof through companion handoff using the canonical receipt fields."
|
|
10942
10995
|
},
|
|
10943
10996
|
cursor: {
|
|
10944
10997
|
label: "Cursor",
|
|
@@ -10957,6 +11010,7 @@ var ADAPTER_TARGETS = {
|
|
|
10957
11010
|
instruction: "Require the receiving worker to echo the receipt fields before closure."
|
|
10958
11011
|
}
|
|
10959
11012
|
};
|
|
11013
|
+
var FIRST_PARTY_ADAPTER_TARGETS = ["codex", "claude-code"];
|
|
10960
11014
|
function normalizeAdapterTarget(value) {
|
|
10961
11015
|
const normalized = (value ?? "codex").trim().toLowerCase();
|
|
10962
11016
|
if (normalized === "claude" || normalized === "claude_code") {
|
|
@@ -10967,6 +11021,14 @@ function normalizeAdapterTarget(value) {
|
|
|
10967
11021
|
}
|
|
10968
11022
|
return "custom";
|
|
10969
11023
|
}
|
|
11024
|
+
function assertSupportedAdapterTarget(targetId) {
|
|
11025
|
+
if (FIRST_PARTY_ADAPTER_TARGETS.includes(targetId)) {
|
|
11026
|
+
return;
|
|
11027
|
+
}
|
|
11028
|
+
throw new Error(
|
|
11029
|
+
`ADE Adapter Pack V1 currently supports codex and claude-code only; ${targetId} is planned but not enabled.`
|
|
11030
|
+
);
|
|
11031
|
+
}
|
|
10970
11032
|
function normalizeAdapterValues(values) {
|
|
10971
11033
|
return [
|
|
10972
11034
|
...new Set(
|
|
@@ -11007,7 +11069,8 @@ function buildAdapterPrompt(input) {
|
|
|
11007
11069
|
input.record.files.length > 0 ? `File scope: ${input.record.files.join(", ")}` : "File scope: not declared",
|
|
11008
11070
|
input.proofGates.length > 0 ? `Proof gates: ${input.proofGates.join("; ")}` : "Proof gates: provide explicit evidence before closure.",
|
|
11009
11071
|
input.acceptanceCriteria.length > 0 ? `Acceptance criteria: ${input.acceptanceCriteria.join("; ")}` : "Acceptance criteria: use the next step and handoff summary as the minimum contract.",
|
|
11010
|
-
"Return a companion handoff receipt with files changed, commands run, proof evidence, blockers, and
|
|
11072
|
+
"Return a companion handoff receipt with files changed, commands run, proof evidence, blockers, next action, and proofVerification status.",
|
|
11073
|
+
"Treat proof evidence as provided until Snipara validates the source and records proofVerification.status=verified."
|
|
11011
11074
|
].join("\n");
|
|
11012
11075
|
}
|
|
11013
11076
|
function buildAgenticHandoffAdapterPack(input) {
|
|
@@ -11015,6 +11078,7 @@ function buildAgenticHandoffAdapterPack(input) {
|
|
|
11015
11078
|
return void 0;
|
|
11016
11079
|
}
|
|
11017
11080
|
const targetId = normalizeAdapterTarget(input.options.adapterTarget);
|
|
11081
|
+
assertSupportedAdapterTarget(targetId);
|
|
11018
11082
|
const target = ADAPTER_TARGETS[targetId];
|
|
11019
11083
|
const contextRefs = normalizeAdapterValues(input.options.context);
|
|
11020
11084
|
const explicitProof = normalizeAdapterValues(input.options.proof);
|
|
@@ -11039,7 +11103,7 @@ function buildAgenticHandoffAdapterPack(input) {
|
|
|
11039
11103
|
constraints: [
|
|
11040
11104
|
"Use this artifact as a work contract, not as approval to expand scope silently.",
|
|
11041
11105
|
"Keep secrets out of handoff receipts and proof notes.",
|
|
11042
|
-
"Do not close the task until proof gates are addressed or an explicit waiver is recorded.",
|
|
11106
|
+
"Do not close the task until proof gates are addressed and proofVerification.status is verified or an explicit waiver is recorded.",
|
|
11043
11107
|
input.gitStatus.length > 0 ? `${input.gitStatus.length} dirty git file(s) existed when this pack was generated.` : "No dirty git file count was added to the adapter constraints."
|
|
11044
11108
|
]
|
|
11045
11109
|
},
|
|
@@ -11054,6 +11118,8 @@ function buildAgenticHandoffAdapterPack(input) {
|
|
|
11054
11118
|
"filesChanged",
|
|
11055
11119
|
"commandsRun",
|
|
11056
11120
|
"proofEvidence",
|
|
11121
|
+
"proofVerificationStatus",
|
|
11122
|
+
"proofSource",
|
|
11057
11123
|
"blockers",
|
|
11058
11124
|
"nextAction"
|
|
11059
11125
|
]
|
|
@@ -11067,8 +11133,9 @@ function buildAgenticHandoffAdapterPack(input) {
|
|
|
11067
11133
|
}),
|
|
11068
11134
|
caveats: [
|
|
11069
11135
|
"ADE Adapter Pack V1 is a portable contract; it does not control the target client runtime.",
|
|
11136
|
+
"First-party adapter packs are currently limited to Codex and Claude Code.",
|
|
11070
11137
|
"Native hooks or IDE-specific automation must be installed separately when they exist.",
|
|
11071
|
-
"The receiving agent
|
|
11138
|
+
"The receiving agent can provide proof evidence, but Snipara must validate the source before treating proof as verified."
|
|
11072
11139
|
]
|
|
11073
11140
|
};
|
|
11074
11141
|
}
|
|
@@ -17907,6 +17974,18 @@ async function taskCommitCommand(options) {
|
|
|
17907
17974
|
var SNAPSHOT_RELATIVE_PATH = import_path2.default.join(".snipara", "source", "latest.json");
|
|
17908
17975
|
var DEFAULT_MAX_FILES2 = 5e3;
|
|
17909
17976
|
var DEFAULT_MAX_FILE_BYTES2 = 5 * 1024 * 1024;
|
|
17977
|
+
var LOCAL_SOURCE_FILE_KINDS = /* @__PURE__ */ new Set([
|
|
17978
|
+
"DOC",
|
|
17979
|
+
"BINARY",
|
|
17980
|
+
"CODE",
|
|
17981
|
+
"CONFIG",
|
|
17982
|
+
"OTHER"
|
|
17983
|
+
]);
|
|
17984
|
+
var LOCAL_SOURCE_SKIPPED_REASONS = /* @__PURE__ */ new Set([
|
|
17985
|
+
"ignored",
|
|
17986
|
+
"too_large",
|
|
17987
|
+
"read_error"
|
|
17988
|
+
]);
|
|
17910
17989
|
var DOCUMENT_FORMATS = /* @__PURE__ */ new Map([
|
|
17911
17990
|
[".adoc", { kind: "DOC", format: "adoc" }],
|
|
17912
17991
|
[".markdown", { kind: "DOC", format: "markdown" }],
|
|
@@ -17979,12 +18058,27 @@ var DEFAULT_IGNORED_DIRS = /* @__PURE__ */ new Set([
|
|
|
17979
18058
|
"target",
|
|
17980
18059
|
"venv"
|
|
17981
18060
|
]);
|
|
17982
|
-
function positiveInteger3(value, fallback) {
|
|
17983
|
-
|
|
18061
|
+
function positiveInteger3(value, fallback, label = "value") {
|
|
18062
|
+
if (value === void 0) {
|
|
18063
|
+
return fallback;
|
|
18064
|
+
}
|
|
18065
|
+
if (Number.isFinite(value) && value > 0) {
|
|
18066
|
+
return Math.floor(value);
|
|
18067
|
+
}
|
|
18068
|
+
throw new Error(`${label} must be a positive integer.`);
|
|
17984
18069
|
}
|
|
17985
18070
|
function normalizeRepoPath2(value) {
|
|
17986
18071
|
return value.split(import_path2.default.sep).join("/").replace(/^\/+/, "");
|
|
17987
18072
|
}
|
|
18073
|
+
function comparePaths(left, right) {
|
|
18074
|
+
if (left < right) {
|
|
18075
|
+
return -1;
|
|
18076
|
+
}
|
|
18077
|
+
if (left > right) {
|
|
18078
|
+
return 1;
|
|
18079
|
+
}
|
|
18080
|
+
return 0;
|
|
18081
|
+
}
|
|
17988
18082
|
function sha2564(value) {
|
|
17989
18083
|
return import_crypto2.default.createHash("sha256").update(value).digest("hex");
|
|
17990
18084
|
}
|
|
@@ -18070,8 +18164,12 @@ function getLocalSourceSnapshotPath(cwd = process.cwd()) {
|
|
|
18070
18164
|
function buildLocalSourceSnapshot(options = {}) {
|
|
18071
18165
|
const root = resolveSourceRoot(options.dir);
|
|
18072
18166
|
const recursive = options.recursive ?? true;
|
|
18073
|
-
const maxFiles = positiveInteger3(options.maxFiles, DEFAULT_MAX_FILES2);
|
|
18074
|
-
const maxFileBytes = positiveInteger3(
|
|
18167
|
+
const maxFiles = positiveInteger3(options.maxFiles, DEFAULT_MAX_FILES2, "--max-files");
|
|
18168
|
+
const maxFileBytes = positiveInteger3(
|
|
18169
|
+
options.maxFileBytes,
|
|
18170
|
+
DEFAULT_MAX_FILE_BYTES2,
|
|
18171
|
+
"--max-file-bytes"
|
|
18172
|
+
);
|
|
18075
18173
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
18076
18174
|
const sniparaIgnore = readSniparaIgnore2(root);
|
|
18077
18175
|
const files = [];
|
|
@@ -18150,6 +18248,8 @@ function buildLocalSourceSnapshot(options = {}) {
|
|
|
18150
18248
|
if (files.length >= maxFiles) {
|
|
18151
18249
|
warnings.push(`Stopped after ${maxFiles} files. Increase --max-files for larger folders.`);
|
|
18152
18250
|
}
|
|
18251
|
+
files.sort((left, right) => comparePaths(left.path, right.path));
|
|
18252
|
+
skippedSamples.sort((left, right) => comparePaths(left.path, right.path));
|
|
18153
18253
|
const byKind = emptyKindCounts();
|
|
18154
18254
|
let totalBytes = 0;
|
|
18155
18255
|
for (const file of files) {
|
|
@@ -18204,11 +18304,51 @@ function readLocalSourceSnapshot(cwd = process.cwd()) {
|
|
|
18204
18304
|
}
|
|
18205
18305
|
try {
|
|
18206
18306
|
const parsed = JSON.parse(import_fs2.default.readFileSync(snapshotPath, "utf8"));
|
|
18207
|
-
return parsed
|
|
18307
|
+
return isLocalSourceSnapshot(parsed) ? parsed : null;
|
|
18208
18308
|
} catch {
|
|
18209
18309
|
return null;
|
|
18210
18310
|
}
|
|
18211
18311
|
}
|
|
18312
|
+
function isRecord6(value) {
|
|
18313
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
18314
|
+
}
|
|
18315
|
+
function isLocalSourceFile(value) {
|
|
18316
|
+
if (!isRecord6(value)) {
|
|
18317
|
+
return false;
|
|
18318
|
+
}
|
|
18319
|
+
return typeof value.path === "string" && LOCAL_SOURCE_FILE_KINDS.has(value.kind) && (typeof value.format === "string" || value.format === null) && typeof value.sizeBytes === "number" && Number.isFinite(value.sizeBytes) && typeof value.modifiedAt === "string" && typeof value.sha256 === "string";
|
|
18320
|
+
}
|
|
18321
|
+
function isSkippedFile(value) {
|
|
18322
|
+
if (!isRecord6(value)) {
|
|
18323
|
+
return false;
|
|
18324
|
+
}
|
|
18325
|
+
return typeof value.path === "string" && LOCAL_SOURCE_SKIPPED_REASONS.has(value.reason) && (value.sizeBytes === void 0 || typeof value.sizeBytes === "number" && Number.isFinite(value.sizeBytes));
|
|
18326
|
+
}
|
|
18327
|
+
function hasKindCounts(value) {
|
|
18328
|
+
if (!isRecord6(value)) {
|
|
18329
|
+
return false;
|
|
18330
|
+
}
|
|
18331
|
+
return Array.from(LOCAL_SOURCE_FILE_KINDS).every(
|
|
18332
|
+
(kind) => typeof value[kind] === "number" && Number.isFinite(value[kind])
|
|
18333
|
+
);
|
|
18334
|
+
}
|
|
18335
|
+
function hasSkippedCounts(value) {
|
|
18336
|
+
if (!isRecord6(value)) {
|
|
18337
|
+
return false;
|
|
18338
|
+
}
|
|
18339
|
+
return Array.from(LOCAL_SOURCE_SKIPPED_REASONS).every(
|
|
18340
|
+
(reason) => typeof value[reason] === "number" && Number.isFinite(value[reason])
|
|
18341
|
+
);
|
|
18342
|
+
}
|
|
18343
|
+
function isLocalSourceSnapshot(value) {
|
|
18344
|
+
if (!isRecord6(value) || value.version !== "snipara.local_source_snapshot.v1") {
|
|
18345
|
+
return false;
|
|
18346
|
+
}
|
|
18347
|
+
if (!isRecord6(value.summary) || !isRecord6(value.skipped)) {
|
|
18348
|
+
return false;
|
|
18349
|
+
}
|
|
18350
|
+
return typeof value.generatedAt === "string" && typeof value.root === "string" && value.provider === "local_folder" && typeof value.revision === "string" && typeof value.recursive === "boolean" && typeof value.maxFiles === "number" && typeof value.maxFileBytes === "number" && typeof value.summary.totalFiles === "number" && typeof value.summary.totalBytes === "number" && hasKindCounts(value.summary.byKind) && typeof value.summary.skipped === "number" && Array.isArray(value.files) && value.files.every(isLocalSourceFile) && typeof value.skipped.total === "number" && hasSkippedCounts(value.skipped.byReason) && Array.isArray(value.skipped.samples) && value.skipped.samples.every(isSkippedFile) && Array.isArray(value.warnings) && value.warnings.every((warning) => typeof warning === "string");
|
|
18351
|
+
}
|
|
18212
18352
|
function compareLocalSourceSnapshots(previous, current) {
|
|
18213
18353
|
if (!previous) {
|
|
18214
18354
|
return {
|
|
@@ -18406,14 +18546,48 @@ async function sourceSyncCommand(options = {}) {
|
|
|
18406
18546
|
printSyncResult(result);
|
|
18407
18547
|
}
|
|
18408
18548
|
async function sourceWatchCommand(options = {}) {
|
|
18409
|
-
const intervalMs = positiveInteger3(options.intervalMs, 5e3);
|
|
18549
|
+
const intervalMs = positiveInteger3(options.intervalMs, 5e3, "--interval-ms");
|
|
18410
18550
|
if (options.once) {
|
|
18411
18551
|
await sourceSyncCommand(options);
|
|
18412
18552
|
return;
|
|
18413
18553
|
}
|
|
18414
|
-
|
|
18415
|
-
|
|
18416
|
-
|
|
18554
|
+
let stopping = false;
|
|
18555
|
+
let activeTimer = null;
|
|
18556
|
+
let resolveWait = null;
|
|
18557
|
+
const stop = () => {
|
|
18558
|
+
stopping = true;
|
|
18559
|
+
if (activeTimer) {
|
|
18560
|
+
clearTimeout(activeTimer);
|
|
18561
|
+
activeTimer = null;
|
|
18562
|
+
}
|
|
18563
|
+
if (resolveWait) {
|
|
18564
|
+
resolveWait();
|
|
18565
|
+
resolveWait = null;
|
|
18566
|
+
}
|
|
18567
|
+
};
|
|
18568
|
+
const signals = ["SIGINT", "SIGTERM"];
|
|
18569
|
+
for (const signal of signals) {
|
|
18570
|
+
process.once(signal, stop);
|
|
18571
|
+
}
|
|
18572
|
+
try {
|
|
18573
|
+
while (!stopping) {
|
|
18574
|
+
await sourceSyncCommand(options);
|
|
18575
|
+
if (stopping) {
|
|
18576
|
+
break;
|
|
18577
|
+
}
|
|
18578
|
+
await new Promise((resolve17) => {
|
|
18579
|
+
resolveWait = resolve17;
|
|
18580
|
+
activeTimer = setTimeout(() => {
|
|
18581
|
+
activeTimer = null;
|
|
18582
|
+
resolveWait = null;
|
|
18583
|
+
resolve17();
|
|
18584
|
+
}, intervalMs);
|
|
18585
|
+
});
|
|
18586
|
+
}
|
|
18587
|
+
} finally {
|
|
18588
|
+
for (const signal of signals) {
|
|
18589
|
+
process.removeListener(signal, stop);
|
|
18590
|
+
}
|
|
18417
18591
|
}
|
|
18418
18592
|
}
|
|
18419
18593
|
|
|
@@ -18467,19 +18641,19 @@ function normalizeTask(task) {
|
|
|
18467
18641
|
const normalized = task?.trim();
|
|
18468
18642
|
return normalized ? normalized : void 0;
|
|
18469
18643
|
}
|
|
18470
|
-
function
|
|
18644
|
+
function isRecord7(value) {
|
|
18471
18645
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
18472
18646
|
}
|
|
18473
18647
|
function stringValue4(value) {
|
|
18474
18648
|
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
18475
18649
|
}
|
|
18476
18650
|
function recordList(value) {
|
|
18477
|
-
return Array.isArray(value) ? value.filter(
|
|
18651
|
+
return Array.isArray(value) ? value.filter(isRecord7) : [];
|
|
18478
18652
|
}
|
|
18479
18653
|
function safeReadJson(filePath) {
|
|
18480
18654
|
try {
|
|
18481
18655
|
const parsed = JSON.parse(fs19.readFileSync(filePath, "utf8"));
|
|
18482
|
-
return
|
|
18656
|
+
return isRecord7(parsed) ? parsed : void 0;
|
|
18483
18657
|
} catch {
|
|
18484
18658
|
return void 0;
|
|
18485
18659
|
}
|
|
@@ -18925,6 +19099,22 @@ var PROJECT_INTELLIGENCE_ENGINEERING_LEAD_EXECUTION_RECEIPT_STAGES = [
|
|
|
18925
19099
|
"outcome",
|
|
18926
19100
|
"brain_update"
|
|
18927
19101
|
];
|
|
19102
|
+
var PROJECT_INTELLIGENCE_ENGINEERING_LEAD_PROOF_VERIFICATION_STATUSES = [
|
|
19103
|
+
"declared",
|
|
19104
|
+
"provided",
|
|
19105
|
+
"verified",
|
|
19106
|
+
"rejected",
|
|
19107
|
+
"unknown"
|
|
19108
|
+
];
|
|
19109
|
+
var PROJECT_INTELLIGENCE_ENGINEERING_LEAD_PROOF_VERIFICATION_SOURCES = [
|
|
19110
|
+
"agent_report",
|
|
19111
|
+
"companion_handoff",
|
|
19112
|
+
"local_command",
|
|
19113
|
+
"ci",
|
|
19114
|
+
"htask",
|
|
19115
|
+
"manual",
|
|
19116
|
+
"unknown"
|
|
19117
|
+
];
|
|
18928
19118
|
|
|
18929
19119
|
// src/commands/lead-plan.ts
|
|
18930
19120
|
var ENGINEERING_LEAD_STATUSES = PROJECT_HEALTH_COCKPIT_STATUSES;
|
|
@@ -18935,6 +19125,8 @@ var ENGINEERING_LEAD_WORK_PACKAGE_STATUSES = PROJECT_INTELLIGENCE_ENGINEERING_LE
|
|
|
18935
19125
|
var ENGINEERING_LEAD_SUPERVISION_STATUSES = PROJECT_INTELLIGENCE_ENGINEERING_LEAD_SUPERVISION_STATUSES;
|
|
18936
19126
|
var ENGINEERING_LEAD_EXECUTION_RECEIPT_STATUSES = PROJECT_INTELLIGENCE_ENGINEERING_LEAD_EXECUTION_RECEIPT_STATUSES;
|
|
18937
19127
|
var ENGINEERING_LEAD_EXECUTION_RECEIPT_STAGES = PROJECT_INTELLIGENCE_ENGINEERING_LEAD_EXECUTION_RECEIPT_STAGES;
|
|
19128
|
+
var ENGINEERING_LEAD_PROOF_VERIFICATION_STATUSES = PROJECT_INTELLIGENCE_ENGINEERING_LEAD_PROOF_VERIFICATION_STATUSES;
|
|
19129
|
+
var ENGINEERING_LEAD_PROOF_VERIFICATION_SOURCES = PROJECT_INTELLIGENCE_ENGINEERING_LEAD_PROOF_VERIFICATION_SOURCES;
|
|
18938
19130
|
var TARGET_LABELS = {
|
|
18939
19131
|
codex: "Codex",
|
|
18940
19132
|
"claude-code": "Claude Code",
|
|
@@ -18964,11 +19156,11 @@ function unique3(values) {
|
|
|
18964
19156
|
)
|
|
18965
19157
|
];
|
|
18966
19158
|
}
|
|
18967
|
-
function
|
|
19159
|
+
function isRecord8(value) {
|
|
18968
19160
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
18969
19161
|
}
|
|
18970
19162
|
function recordList2(value) {
|
|
18971
|
-
return Array.isArray(value) ? value.filter(
|
|
19163
|
+
return Array.isArray(value) ? value.filter(isRecord8) : [];
|
|
18972
19164
|
}
|
|
18973
19165
|
function stringValue5(value) {
|
|
18974
19166
|
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
@@ -19000,6 +19192,61 @@ function cockpitEnumValue(field, values, value, fallback) {
|
|
|
19000
19192
|
function compactReasonCodes(values) {
|
|
19001
19193
|
return values.filter((value) => Boolean(value));
|
|
19002
19194
|
}
|
|
19195
|
+
function defaultProofVerificationStatus(input) {
|
|
19196
|
+
if (input.proofEvidenceProvided) {
|
|
19197
|
+
return "provided";
|
|
19198
|
+
}
|
|
19199
|
+
return input.proofRequired.length > 0 ? "declared" : "unknown";
|
|
19200
|
+
}
|
|
19201
|
+
function buildProofVerification(input) {
|
|
19202
|
+
return {
|
|
19203
|
+
status: input.status,
|
|
19204
|
+
source: input.source ?? "unknown",
|
|
19205
|
+
sourceRef: input.sourceRef ?? null,
|
|
19206
|
+
adapterTarget: input.adapterTarget ?? null,
|
|
19207
|
+
verifiedBy: input.verifiedBy ?? null,
|
|
19208
|
+
verifiedAt: input.verifiedAt ?? null,
|
|
19209
|
+
evidenceHash: input.evidenceHash ?? null,
|
|
19210
|
+
reasonCodes: [
|
|
19211
|
+
.../* @__PURE__ */ new Set([
|
|
19212
|
+
...input.reasonCodes ?? [],
|
|
19213
|
+
`proof_verification_${input.status}`,
|
|
19214
|
+
...input.status === "verified" ? [] : ["proof_verification_pending_validation"]
|
|
19215
|
+
])
|
|
19216
|
+
]
|
|
19217
|
+
};
|
|
19218
|
+
}
|
|
19219
|
+
function normalizeProofVerification(input) {
|
|
19220
|
+
const fallbackStatus = defaultProofVerificationStatus(input);
|
|
19221
|
+
if (!isRecord8(input.value)) {
|
|
19222
|
+
return buildProofVerification({ status: fallbackStatus });
|
|
19223
|
+
}
|
|
19224
|
+
const status = cockpitEnumValue(
|
|
19225
|
+
"proof_verification_status",
|
|
19226
|
+
ENGINEERING_LEAD_PROOF_VERIFICATION_STATUSES,
|
|
19227
|
+
input.value.status,
|
|
19228
|
+
fallbackStatus
|
|
19229
|
+
);
|
|
19230
|
+
const source2 = cockpitEnumValue(
|
|
19231
|
+
"proof_verification_source",
|
|
19232
|
+
ENGINEERING_LEAD_PROOF_VERIFICATION_SOURCES,
|
|
19233
|
+
input.value.source,
|
|
19234
|
+
"unknown"
|
|
19235
|
+
);
|
|
19236
|
+
return buildProofVerification({
|
|
19237
|
+
status: status.value,
|
|
19238
|
+
source: source2.value,
|
|
19239
|
+
sourceRef: stringValue5(input.value.sourceRef) ?? null,
|
|
19240
|
+
adapterTarget: stringValue5(input.value.adapterTarget) ?? null,
|
|
19241
|
+
verifiedBy: stringValue5(input.value.verifiedBy) ?? null,
|
|
19242
|
+
verifiedAt: stringValue5(input.value.verifiedAt) ?? null,
|
|
19243
|
+
evidenceHash: stringValue5(input.value.evidenceHash) ?? null,
|
|
19244
|
+
reasonCodes: [
|
|
19245
|
+
...stringList(input.value.reasonCodes),
|
|
19246
|
+
...compactReasonCodes([status.droppedReasonCode, source2.droppedReasonCode])
|
|
19247
|
+
]
|
|
19248
|
+
});
|
|
19249
|
+
}
|
|
19003
19250
|
function slug(value, fallback) {
|
|
19004
19251
|
const normalized = value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 48);
|
|
19005
19252
|
return normalized || fallback;
|
|
@@ -19308,9 +19555,13 @@ function missingRequirementsForExecutionReceipt(input) {
|
|
|
19308
19555
|
if (input.requiredStages.includes("approval") && !completed.has("approval")) {
|
|
19309
19556
|
missing.add("approval_receipt");
|
|
19310
19557
|
}
|
|
19311
|
-
|
|
19558
|
+
const proofEvidenceProvided = input.proofEvidenceProvided ?? completed.has("proof");
|
|
19559
|
+
if (input.requiredStages.includes("proof") && !proofEvidenceProvided) {
|
|
19312
19560
|
missing.add("proof_receipt");
|
|
19313
19561
|
}
|
|
19562
|
+
if (input.requiredStages.includes("proof") && proofEvidenceProvided && input.workPackage.proofRequired.length > 0 && input.proofVerificationStatus !== "verified") {
|
|
19563
|
+
missing.add("verified_proof");
|
|
19564
|
+
}
|
|
19314
19565
|
if (input.requiredStages.includes("outcome") && !completed.has("outcome")) {
|
|
19315
19566
|
missing.add("outcome_receipt");
|
|
19316
19567
|
}
|
|
@@ -19321,7 +19572,7 @@ function missingRequirementsForExecutionReceipt(input) {
|
|
|
19321
19572
|
}
|
|
19322
19573
|
function executionReceiptStatusFromWorkPackage(input) {
|
|
19323
19574
|
if (input.workPackage.status === "blocked") return "blocked";
|
|
19324
|
-
if (input.workPackage.status === "closed" && input.requiredStages.every((stage) => input.completedStages.includes(stage))) {
|
|
19575
|
+
if (input.workPackage.status === "closed" && input.requiredStages.every((stage) => input.completedStages.includes(stage)) && input.missingRequirements.length === 0) {
|
|
19325
19576
|
return "closed";
|
|
19326
19577
|
}
|
|
19327
19578
|
if (input.workPackage.status === "executing") return "executing";
|
|
@@ -19343,6 +19594,9 @@ function executionReceiptNextAction(input) {
|
|
|
19343
19594
|
if (input.missingRequirements.includes("proof_receipt")) {
|
|
19344
19595
|
return "Attach proof receipts before closure.";
|
|
19345
19596
|
}
|
|
19597
|
+
if (input.missingRequirements.includes("verified_proof")) {
|
|
19598
|
+
return "Validate the proof source before treating this package as complete.";
|
|
19599
|
+
}
|
|
19346
19600
|
if (input.missingRequirements.includes("outcome_receipt")) {
|
|
19347
19601
|
return "Attach an outcome or closure receipt before Brain promotion.";
|
|
19348
19602
|
}
|
|
@@ -19397,6 +19651,9 @@ function buildExpectedExecutionReceipts(input) {
|
|
|
19397
19651
|
brainUpdateReceiptId: null,
|
|
19398
19652
|
proofRequired: workPackage.proofRequired,
|
|
19399
19653
|
proofExecuted: [],
|
|
19654
|
+
proofVerification: buildProofVerification({
|
|
19655
|
+
status: workPackage.proofRequired.length > 0 ? "declared" : "unknown"
|
|
19656
|
+
}),
|
|
19400
19657
|
missingRequirements,
|
|
19401
19658
|
nextAction: executionReceiptNextAction({ status, missingRequirements }),
|
|
19402
19659
|
replanTriggers: workPackage.replanTriggers,
|
|
@@ -19520,7 +19777,7 @@ function buildLocalEngineeringLeadPlan(input) {
|
|
|
19520
19777
|
};
|
|
19521
19778
|
}
|
|
19522
19779
|
function normalizeWorkerRecommendation(value, index) {
|
|
19523
|
-
const contract =
|
|
19780
|
+
const contract = isRecord8(value.contract) ? value.contract : {};
|
|
19524
19781
|
const role = cockpitEnumValue(
|
|
19525
19782
|
"worker_role",
|
|
19526
19783
|
ENGINEERING_LEAD_WORKER_ROLES,
|
|
@@ -19645,13 +19902,30 @@ function normalizeExecutionReceipt(value, index, workPackages, workerRecommendat
|
|
|
19645
19902
|
(stage) => normalizedRequiredStages.includes(stage)
|
|
19646
19903
|
);
|
|
19647
19904
|
const brainUpdateCandidates2 = stringList(value.brainUpdateCandidates).length > 0 ? stringList(value.brainUpdateCandidates) : recommendation?.brainUpdateCandidates ?? [];
|
|
19905
|
+
const proofReceiptIds = stringList(value.proofReceiptIds);
|
|
19906
|
+
const proofRequired = stringList(value.proofRequired).length > 0 ? stringList(value.proofRequired) : workPackage?.proofRequired ?? [];
|
|
19907
|
+
const proofExecuted = stringList(value.proofExecuted);
|
|
19908
|
+
const proofEvidenceProvided = proofReceiptIds.length > 0 || proofExecuted.length > 0 || normalizedCompletedStages.includes("proof");
|
|
19909
|
+
const proofVerification = normalizeProofVerification({
|
|
19910
|
+
value: value.proofVerification,
|
|
19911
|
+
proofRequired,
|
|
19912
|
+
proofEvidenceProvided
|
|
19913
|
+
});
|
|
19648
19914
|
const derivedMissing = workPackage && missingRequirementsForExecutionReceipt({
|
|
19649
19915
|
workPackage,
|
|
19650
19916
|
requiredStages: normalizedRequiredStages,
|
|
19651
19917
|
completedStages: normalizedCompletedStages,
|
|
19652
|
-
brainUpdateCandidates: brainUpdateCandidates2
|
|
19918
|
+
brainUpdateCandidates: brainUpdateCandidates2,
|
|
19919
|
+
proofVerificationStatus: proofVerification.status,
|
|
19920
|
+
proofEvidenceProvided
|
|
19653
19921
|
});
|
|
19654
|
-
const
|
|
19922
|
+
const missingRequirementsSet = new Set(
|
|
19923
|
+
stringList(value.missingRequirements).length > 0 ? stringList(value.missingRequirements) : derivedMissing ?? []
|
|
19924
|
+
);
|
|
19925
|
+
if (normalizedRequiredStages.includes("proof") && proofRequired.length > 0 && proofEvidenceProvided && proofVerification.status !== "verified") {
|
|
19926
|
+
missingRequirementsSet.add("verified_proof");
|
|
19927
|
+
}
|
|
19928
|
+
const missingRequirements = Array.from(missingRequirementsSet).sort();
|
|
19655
19929
|
const fallbackStatus = workPackage ? executionReceiptStatusFromWorkPackage({
|
|
19656
19930
|
workPackage,
|
|
19657
19931
|
requiredStages: normalizedRequiredStages,
|
|
@@ -19664,33 +19938,42 @@ function normalizeExecutionReceipt(value, index, workPackages, workerRecommendat
|
|
|
19664
19938
|
value.status,
|
|
19665
19939
|
fallbackStatus
|
|
19666
19940
|
);
|
|
19941
|
+
const effectiveStatus = status.value === "closed" && missingRequirements.length > 0 ? "verification_required" : status.value;
|
|
19942
|
+
const statusReasonCodes = compactReasonCodes([
|
|
19943
|
+
status.droppedReasonCode,
|
|
19944
|
+
status.value === "closed" && effectiveStatus === "verification_required" ? "companion_downgraded_closed_execution_receipt_pending_verification" : null
|
|
19945
|
+
]);
|
|
19667
19946
|
return {
|
|
19668
19947
|
id: stringValue5(value.id) ?? `engineering-lead-receipt:${workPackageId}`,
|
|
19669
19948
|
workPackageId,
|
|
19670
19949
|
workPackageTitle: stringValue5(value.workPackageTitle) ?? workPackage?.title ?? `Imported work package ${index + 1}`,
|
|
19671
|
-
status:
|
|
19950
|
+
status: effectiveStatus,
|
|
19672
19951
|
requiredStages: normalizedRequiredStages,
|
|
19673
19952
|
completedStages: normalizedCompletedStages,
|
|
19674
19953
|
handoffReceiptId: stringValue5(value.handoffReceiptId) ?? null,
|
|
19675
19954
|
claimId: stringValue5(value.claimId) ?? null,
|
|
19676
19955
|
htaskId: stringValue5(value.htaskId) ?? null,
|
|
19677
19956
|
approvalReceiptId: stringValue5(value.approvalReceiptId) ?? null,
|
|
19678
|
-
proofReceiptIds
|
|
19957
|
+
proofReceiptIds,
|
|
19679
19958
|
outcomeReceiptId: stringValue5(value.outcomeReceiptId) ?? null,
|
|
19680
19959
|
brainUpdateReceiptId: stringValue5(value.brainUpdateReceiptId) ?? null,
|
|
19681
|
-
proofRequired
|
|
19682
|
-
proofExecuted
|
|
19960
|
+
proofRequired,
|
|
19961
|
+
proofExecuted,
|
|
19962
|
+
proofVerification,
|
|
19683
19963
|
missingRequirements,
|
|
19684
|
-
nextAction: stringValue5(value.nextAction) ?? executionReceiptNextAction({ status:
|
|
19964
|
+
nextAction: stringValue5(value.nextAction) ?? executionReceiptNextAction({ status: effectiveStatus, missingRequirements }),
|
|
19685
19965
|
replanTriggers: stringList(value.replanTriggers).length > 0 ? stringList(value.replanTriggers) : workPackage?.replanTriggers ?? [],
|
|
19686
19966
|
brainUpdateCandidates: brainUpdateCandidates2,
|
|
19687
19967
|
evidence: normalizeEvidence(value.evidence).length > 0 ? normalizeEvidence(value.evidence) : workPackage?.evidence ?? [],
|
|
19688
19968
|
reasonCodes: [
|
|
19689
19969
|
.../* @__PURE__ */ new Set([
|
|
19690
19970
|
...stringList(value.reasonCodes),
|
|
19691
|
-
...
|
|
19971
|
+
...statusReasonCodes,
|
|
19692
19972
|
...requiredStages.reasonCodes,
|
|
19693
|
-
...completedStages.reasonCodes
|
|
19973
|
+
...completedStages.reasonCodes,
|
|
19974
|
+
...proofVerification.reasonCodes.filter(
|
|
19975
|
+
(code2) => code2.startsWith("companion_dropped_unknown_")
|
|
19976
|
+
)
|
|
19694
19977
|
])
|
|
19695
19978
|
]
|
|
19696
19979
|
};
|
|
@@ -19738,7 +20021,7 @@ function summarizeSupervisionFromWorkPackages(workPackages) {
|
|
|
19738
20021
|
};
|
|
19739
20022
|
}
|
|
19740
20023
|
function normalizeSupervision(value, workPackages) {
|
|
19741
|
-
if (!
|
|
20024
|
+
if (!isRecord8(value)) {
|
|
19742
20025
|
return summarizeSupervisionFromWorkPackages(workPackages);
|
|
19743
20026
|
}
|
|
19744
20027
|
const fallback = summarizeSupervisionFromWorkPackages(workPackages);
|
|
@@ -19790,7 +20073,7 @@ function normalizeSupervision(value, workPackages) {
|
|
|
19790
20073
|
};
|
|
19791
20074
|
}
|
|
19792
20075
|
function normalizeCockpitPlan(cockpit) {
|
|
19793
|
-
const rawPlan =
|
|
20076
|
+
const rawPlan = isRecord8(cockpit.engineeringLeadPlan) ? cockpit.engineeringLeadPlan : cockpit;
|
|
19794
20077
|
const score = Math.round(numberValue3(rawPlan.score, 0));
|
|
19795
20078
|
const workerRecommendations = recordList2(rawPlan.workerRecommendations).map(
|
|
19796
20079
|
normalizeWorkerRecommendation
|
|
@@ -19928,11 +20211,19 @@ function reconcileEngineeringLeadPlan(input) {
|
|
|
19928
20211
|
recommendedActions.add(trigger);
|
|
19929
20212
|
}
|
|
19930
20213
|
for (const receipt of executionReceipts) {
|
|
20214
|
+
const proofEvidenceProvided = receipt.proofReceiptIds.length > 0 || receipt.proofExecuted.length > 0 || receipt.completedStages.includes("proof");
|
|
19931
20215
|
if (receipt.status === "blocked") {
|
|
19932
20216
|
changedSignals.add(`blocked_execution_receipt:${receipt.workPackageId}`);
|
|
19933
20217
|
recommendedActions.add(receipt.nextAction);
|
|
19934
20218
|
reasonCodes.add("companion_reconcile_execution_receipt_blocked");
|
|
19935
20219
|
}
|
|
20220
|
+
if (receipt.requiredStages.includes("proof") && proofEvidenceProvided && receipt.proofVerification?.status !== "verified") {
|
|
20221
|
+
changedSignals.add(`execution_receipt_unverified_proof:${receipt.workPackageId}`);
|
|
20222
|
+
recommendedActions.add(
|
|
20223
|
+
`Validate proof source for ${receipt.workPackageTitle} before closure.`
|
|
20224
|
+
);
|
|
20225
|
+
reasonCodes.add("companion_reconcile_execution_receipt_unverified_proof");
|
|
20226
|
+
}
|
|
19936
20227
|
if (receipt.missingRequirements.length > 0) {
|
|
19937
20228
|
changedSignals.add(
|
|
19938
20229
|
`execution_receipt_missing:${receipt.workPackageId}:${receipt.missingRequirements.join(",")}`
|
|
@@ -19990,7 +20281,7 @@ function applyReconciliationToPlan(plan, reconciliation) {
|
|
|
19990
20281
|
}
|
|
19991
20282
|
function readJsonFile3(filePath) {
|
|
19992
20283
|
const parsed = JSON.parse(fs20.readFileSync(path19.resolve(filePath), "utf8"));
|
|
19993
|
-
if (!
|
|
20284
|
+
if (!isRecord8(parsed)) {
|
|
19994
20285
|
throw new Error(`${filePath} must contain a JSON object`);
|
|
19995
20286
|
}
|
|
19996
20287
|
return parsed;
|
|
@@ -20123,6 +20414,15 @@ function formatCompanionEngineeringLeadPlanReport(report) {
|
|
|
20123
20414
|
lines.push(` handoff receipt: ${receipt.handoffReceiptId ?? "missing"}`);
|
|
20124
20415
|
lines.push(` claim: ${receipt.claimId ?? "missing"}`);
|
|
20125
20416
|
lines.push(` approval receipt: ${receipt.approvalReceiptId ?? "missing"}`);
|
|
20417
|
+
lines.push(` proof receipts: ${formatList3(receipt.proofReceiptIds)}`);
|
|
20418
|
+
if (receipt.proofVerification) {
|
|
20419
|
+
lines.push(
|
|
20420
|
+
` proof verification: ${receipt.proofVerification.status} (${receipt.proofVerification.source})`
|
|
20421
|
+
);
|
|
20422
|
+
if (receipt.proofVerification.adapterTarget) {
|
|
20423
|
+
lines.push(` proof adapter target: ${receipt.proofVerification.adapterTarget}`);
|
|
20424
|
+
}
|
|
20425
|
+
}
|
|
20126
20426
|
lines.push(` outcome receipt: ${receipt.outcomeReceiptId ?? "missing"}`);
|
|
20127
20427
|
lines.push(` brain update receipt: ${receipt.brainUpdateReceiptId ?? "missing"}`);
|
|
20128
20428
|
lines.push(` missing: ${formatList3(receipt.missingRequirements)}`);
|
|
@@ -20195,7 +20495,7 @@ var import_node_child_process6 = require("child_process");
|
|
|
20195
20495
|
var import_chalk8 = __toESM(require("chalk"));
|
|
20196
20496
|
|
|
20197
20497
|
// src/commands/judgment-card.ts
|
|
20198
|
-
function
|
|
20498
|
+
function isRecord9(value) {
|
|
20199
20499
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
20200
20500
|
}
|
|
20201
20501
|
function numberValue4(value) {
|
|
@@ -20213,12 +20513,12 @@ function stringListValue(value) {
|
|
|
20213
20513
|
function nestedRecord(root, keys) {
|
|
20214
20514
|
let current = root;
|
|
20215
20515
|
for (const key of keys) {
|
|
20216
|
-
if (!
|
|
20516
|
+
if (!isRecord9(current) || !isRecord9(current[key])) {
|
|
20217
20517
|
return {};
|
|
20218
20518
|
}
|
|
20219
20519
|
current = current[key];
|
|
20220
20520
|
}
|
|
20221
|
-
return
|
|
20521
|
+
return isRecord9(current) ? current : {};
|
|
20222
20522
|
}
|
|
20223
20523
|
function nestedArray(root, keys) {
|
|
20224
20524
|
if (keys.length === 0) {
|
|
@@ -20304,7 +20604,7 @@ function advisorRecommendationsFromInput(input) {
|
|
|
20304
20604
|
return recommendations;
|
|
20305
20605
|
}
|
|
20306
20606
|
function advisorRecommendationFromUnknown(value, index) {
|
|
20307
|
-
if (!
|
|
20607
|
+
if (!isRecord9(value)) {
|
|
20308
20608
|
return null;
|
|
20309
20609
|
}
|
|
20310
20610
|
const title = stringValue6(value.title);
|
|
@@ -20327,7 +20627,7 @@ function advisorRecommendationFromUnknown(value, index) {
|
|
|
20327
20627
|
};
|
|
20328
20628
|
}
|
|
20329
20629
|
function codeImpactRisk(impact) {
|
|
20330
|
-
const risk =
|
|
20630
|
+
const risk = isRecord9(impact?.risk) ? impact?.risk : {};
|
|
20331
20631
|
return {
|
|
20332
20632
|
level: stringValue6(risk.level),
|
|
20333
20633
|
score: numberValue4(risk.score)
|
|
@@ -20361,19 +20661,19 @@ function collectVerificationChecks(plan) {
|
|
|
20361
20661
|
};
|
|
20362
20662
|
}
|
|
20363
20663
|
function gapCode(gap) {
|
|
20364
|
-
return
|
|
20664
|
+
return isRecord9(gap) ? stringValue6(gap.code) ?? "verification_gap" : "verification_gap";
|
|
20365
20665
|
}
|
|
20366
20666
|
function gapMessage(gap) {
|
|
20367
|
-
if (!
|
|
20667
|
+
if (!isRecord9(gap)) {
|
|
20368
20668
|
return String(gap);
|
|
20369
20669
|
}
|
|
20370
20670
|
return stringValue6(gap.message) ?? stringValue6(gap.reason) ?? stringValue6(gap.title) ?? "Verification gap";
|
|
20371
20671
|
}
|
|
20372
20672
|
function checkCommand(check2) {
|
|
20373
|
-
return
|
|
20673
|
+
return isRecord9(check2) ? stringValue6(check2.command) : void 0;
|
|
20374
20674
|
}
|
|
20375
20675
|
function checkTitle(check2) {
|
|
20376
|
-
if (!
|
|
20676
|
+
if (!isRecord9(check2)) {
|
|
20377
20677
|
return String(check2);
|
|
20378
20678
|
}
|
|
20379
20679
|
return stringValue6(check2.title) ?? stringValue6(check2.command) ?? stringValue6(check2.file) ?? "verification check";
|
|
@@ -20453,7 +20753,7 @@ function buildProjectJudgmentCard(input) {
|
|
|
20453
20753
|
"Code impact was degraded; local reads and broader checks should override confidence."
|
|
20454
20754
|
);
|
|
20455
20755
|
}
|
|
20456
|
-
const freshness =
|
|
20756
|
+
const freshness = isRecord9(input.codeImpact?.index_freshness) ? input.codeImpact?.index_freshness : {};
|
|
20457
20757
|
if (freshness.is_stale === true || freshness.commit_match === false) {
|
|
20458
20758
|
addReason(reasons, {
|
|
20459
20759
|
code: "code_graph_stale",
|
|
@@ -20476,12 +20776,12 @@ function buildProjectJudgmentCard(input) {
|
|
|
20476
20776
|
type: "run_check",
|
|
20477
20777
|
title: checkTitle(check2),
|
|
20478
20778
|
command: checkCommand(check2),
|
|
20479
|
-
reason:
|
|
20779
|
+
reason: isRecord9(check2) ? stringValue6(check2.reason) : void 0,
|
|
20480
20780
|
severity: "medium"
|
|
20481
20781
|
});
|
|
20482
20782
|
}
|
|
20483
20783
|
for (const gap of missingChecks) {
|
|
20484
|
-
const severity = normalizeSeverity(
|
|
20784
|
+
const severity = normalizeSeverity(isRecord9(gap) ? gap.severity : void 0);
|
|
20485
20785
|
const code2 = gapCode(gap);
|
|
20486
20786
|
addReason(reasons, {
|
|
20487
20787
|
code: code2,
|
|
@@ -20785,7 +21085,7 @@ function formatProjectJudgmentCard(card) {
|
|
|
20785
21085
|
var import_fs3 = __toESM(require("fs"));
|
|
20786
21086
|
var import_path3 = __toESM(require("path"));
|
|
20787
21087
|
var import_chalk7 = __toESM(require("chalk"));
|
|
20788
|
-
function
|
|
21088
|
+
function isRecord10(value) {
|
|
20789
21089
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
20790
21090
|
}
|
|
20791
21091
|
function stringValue7(value) {
|
|
@@ -20802,7 +21102,7 @@ function stringList2(value) {
|
|
|
20802
21102
|
if (typeof item === "string") {
|
|
20803
21103
|
return [item];
|
|
20804
21104
|
}
|
|
20805
|
-
if (!
|
|
21105
|
+
if (!isRecord10(item)) {
|
|
20806
21106
|
return [];
|
|
20807
21107
|
}
|
|
20808
21108
|
return [
|
|
@@ -20858,7 +21158,7 @@ function collectActionChecks(impact) {
|
|
|
20858
21158
|
const kind2 = checkKindFromText(item);
|
|
20859
21159
|
return kind2 === "command" || kind2 === "inspection" ? [] : [{ kind: kind2, title: item, source: "code-impact" }];
|
|
20860
21160
|
}
|
|
20861
|
-
if (!
|
|
21161
|
+
if (!isRecord10(item)) {
|
|
20862
21162
|
return [];
|
|
20863
21163
|
}
|
|
20864
21164
|
const title = actionTitle(item);
|
|
@@ -20886,7 +21186,7 @@ function collectDirectTestChecks(impact) {
|
|
|
20886
21186
|
impact.related_tests,
|
|
20887
21187
|
impact.relatedTests,
|
|
20888
21188
|
impact.tests,
|
|
20889
|
-
|
|
21189
|
+
isRecord10(impact.impact) ? impact.impact.tests : void 0
|
|
20890
21190
|
];
|
|
20891
21191
|
return candidates.flatMap((candidate) => {
|
|
20892
21192
|
if (!Array.isArray(candidate)) {
|
|
@@ -20904,7 +21204,7 @@ function collectDirectTestChecks(impact) {
|
|
|
20904
21204
|
}
|
|
20905
21205
|
];
|
|
20906
21206
|
}
|
|
20907
|
-
if (!
|
|
21207
|
+
if (!isRecord10(item)) {
|
|
20908
21208
|
return [];
|
|
20909
21209
|
}
|
|
20910
21210
|
const command = stringValue7(item.command);
|
|
@@ -20947,7 +21247,7 @@ function findPackageJson(startPath, cwd) {
|
|
|
20947
21247
|
function readPackageInfo(packageJsonPath) {
|
|
20948
21248
|
try {
|
|
20949
21249
|
const parsed = JSON.parse(import_fs3.default.readFileSync(packageJsonPath, "utf8"));
|
|
20950
|
-
const scripts =
|
|
21250
|
+
const scripts = isRecord10(parsed.scripts) ? Object.fromEntries(
|
|
20951
21251
|
Object.entries(parsed.scripts).filter((entry) => {
|
|
20952
21252
|
return typeof entry[1] === "string";
|
|
20953
21253
|
})
|
|
@@ -21004,12 +21304,12 @@ function collectImpactedFiles(impact, changedFiles, filePath) {
|
|
|
21004
21304
|
...stringList2(impact?.impacted_files),
|
|
21005
21305
|
...stringList2(impact?.impactedFiles),
|
|
21006
21306
|
...stringList2(impact?.matched_targets),
|
|
21007
|
-
...stringList2(
|
|
21307
|
+
...stringList2(isRecord10(impact?.impact) ? impact?.impact.files : void 0)
|
|
21008
21308
|
];
|
|
21009
21309
|
return unique4(files);
|
|
21010
21310
|
}
|
|
21011
21311
|
function buildRisk(impact) {
|
|
21012
|
-
const risk = impact &&
|
|
21312
|
+
const risk = impact && isRecord10(impact.risk) ? impact.risk : {};
|
|
21013
21313
|
return {
|
|
21014
21314
|
level: stringValue7(risk.level) ?? "unknown",
|
|
21015
21315
|
...numberValue5(risk.score) !== void 0 ? { score: numberValue5(risk.score) } : {},
|
|
@@ -21021,7 +21321,7 @@ function collectCoverageGaps(impact) {
|
|
|
21021
21321
|
return [];
|
|
21022
21322
|
}
|
|
21023
21323
|
return impact.coverage_gaps.map((gap) => {
|
|
21024
|
-
if (!
|
|
21324
|
+
if (!isRecord10(gap)) {
|
|
21025
21325
|
return {
|
|
21026
21326
|
code: "coverage_gap",
|
|
21027
21327
|
severity: "medium",
|
|
@@ -21045,7 +21345,7 @@ function collectCaveats(impact, errors) {
|
|
|
21045
21345
|
"Code impact returned degraded results; prefer conservative checks and local reads."
|
|
21046
21346
|
);
|
|
21047
21347
|
}
|
|
21048
|
-
const freshness = impact &&
|
|
21348
|
+
const freshness = impact && isRecord10(impact.index_freshness) ? impact.index_freshness : {};
|
|
21049
21349
|
if (freshness.commit_match === false || freshness.is_stale === true) {
|
|
21050
21350
|
caveats.push(
|
|
21051
21351
|
"Code graph freshness does not fully match the local working tree; verify exact files locally."
|
|
@@ -21053,7 +21353,7 @@ function collectCaveats(impact, errors) {
|
|
|
21053
21353
|
}
|
|
21054
21354
|
const warnings = Array.isArray(freshness.warnings) ? freshness.warnings : [];
|
|
21055
21355
|
for (const warning of warnings.slice(0, 3)) {
|
|
21056
|
-
if (
|
|
21356
|
+
if (isRecord10(warning) && warning.message) {
|
|
21057
21357
|
caveats.push(preview2(warning.message, 220));
|
|
21058
21358
|
}
|
|
21059
21359
|
}
|
|
@@ -21258,7 +21558,7 @@ async function verifyCommand(options) {
|
|
|
21258
21558
|
}
|
|
21259
21559
|
|
|
21260
21560
|
// src/commands/intelligence.ts
|
|
21261
|
-
function
|
|
21561
|
+
function isRecord11(value) {
|
|
21262
21562
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
21263
21563
|
}
|
|
21264
21564
|
function numberValue6(value) {
|
|
@@ -21291,7 +21591,7 @@ function nestedRecord2(root, keys) {
|
|
|
21291
21591
|
let current = root;
|
|
21292
21592
|
for (const key of keys) {
|
|
21293
21593
|
const next = current[key];
|
|
21294
|
-
if (!
|
|
21594
|
+
if (!isRecord11(next)) {
|
|
21295
21595
|
return {};
|
|
21296
21596
|
}
|
|
21297
21597
|
current = next;
|
|
@@ -21312,7 +21612,7 @@ function actionList(value) {
|
|
|
21312
21612
|
if (typeof item === "string") {
|
|
21313
21613
|
return item;
|
|
21314
21614
|
}
|
|
21315
|
-
if (!
|
|
21615
|
+
if (!isRecord11(item)) {
|
|
21316
21616
|
return preview3(item);
|
|
21317
21617
|
}
|
|
21318
21618
|
const title = item.action ?? item.title ?? item.name ?? item.recommendedAction ?? "action";
|
|
@@ -21430,7 +21730,7 @@ function printResumeContext(result) {
|
|
|
21430
21730
|
console.log(import_chalk8.default.yellow("Unavailable"));
|
|
21431
21731
|
return;
|
|
21432
21732
|
}
|
|
21433
|
-
const resumeContext =
|
|
21733
|
+
const resumeContext = isRecord11(result.resumeContext) ? result.resumeContext : result;
|
|
21434
21734
|
const focus = nestedRecord2(resumeContext, ["focus"]);
|
|
21435
21735
|
const scope = nestedRecord2(resumeContext, ["scope"]);
|
|
21436
21736
|
if (scope.branch) {
|
|
@@ -21469,7 +21769,7 @@ function printMemoryHealth2(result) {
|
|
|
21469
21769
|
if (score !== void 0) {
|
|
21470
21770
|
console.log(`Memory Health: ${formatPercentScore(score)}`);
|
|
21471
21771
|
}
|
|
21472
|
-
const metrics =
|
|
21772
|
+
const metrics = isRecord11(result.metrics) ? result.metrics : nestedRecord2(result, ["summary", "metrics"]);
|
|
21473
21773
|
const metricEntries = Object.entries(metrics).filter(([, value]) => value !== void 0);
|
|
21474
21774
|
if (metricEntries.length > 0) {
|
|
21475
21775
|
console.log(
|
|
@@ -21484,11 +21784,11 @@ function printCodeImpact(result) {
|
|
|
21484
21784
|
console.log(import_chalk8.default.yellow("Skipped or unavailable"));
|
|
21485
21785
|
return;
|
|
21486
21786
|
}
|
|
21487
|
-
const risk =
|
|
21787
|
+
const risk = isRecord11(result.risk) ? result.risk : {};
|
|
21488
21788
|
if (risk.level || risk.score !== void 0) {
|
|
21489
21789
|
console.log(`Risk: ${preview3(risk.level ?? "unknown")} (${preview3(risk.score ?? "n/a")})`);
|
|
21490
21790
|
}
|
|
21491
|
-
const evidence =
|
|
21791
|
+
const evidence = isRecord11(result.evidence_summary) ? result.evidence_summary : {};
|
|
21492
21792
|
if (evidence.matched_target_count !== void 0) {
|
|
21493
21793
|
console.log(`Matched targets: ${preview3(evidence.matched_target_count)}`);
|
|
21494
21794
|
}
|
|
@@ -22006,7 +22306,7 @@ var REGISTRY_VERSION = "project-intelligence.policy-gates.registry.v1";
|
|
|
22006
22306
|
function normalizeChangedFiles(changedFiles) {
|
|
22007
22307
|
return [...new Set((changedFiles ?? []).map((file) => file.trim()).filter(Boolean))];
|
|
22008
22308
|
}
|
|
22009
|
-
function
|
|
22309
|
+
function isRecord12(value) {
|
|
22010
22310
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
22011
22311
|
}
|
|
22012
22312
|
function stringValue8(value) {
|
|
@@ -22015,12 +22315,12 @@ function stringValue8(value) {
|
|
|
22015
22315
|
function nestedRecord3(root, keys) {
|
|
22016
22316
|
let current = root;
|
|
22017
22317
|
for (const key of keys) {
|
|
22018
|
-
if (!
|
|
22318
|
+
if (!isRecord12(current) || !isRecord12(current[key])) {
|
|
22019
22319
|
return {};
|
|
22020
22320
|
}
|
|
22021
22321
|
current = current[key];
|
|
22022
22322
|
}
|
|
22023
|
-
return
|
|
22323
|
+
return isRecord12(current) ? current : {};
|
|
22024
22324
|
}
|
|
22025
22325
|
function combinedText(input) {
|
|
22026
22326
|
return [input.task, input.diffSummary, ...input.changedFiles ?? []].filter(Boolean).join("\n").toLowerCase();
|
|
@@ -22392,7 +22692,7 @@ var ADVISOR_RECEIPT_WRITE_LIMIT = 6;
|
|
|
22392
22692
|
function normalizeStringList3(values) {
|
|
22393
22693
|
return [...new Set((values ?? []).map((value) => value.trim()).filter(Boolean))];
|
|
22394
22694
|
}
|
|
22395
|
-
function
|
|
22695
|
+
function isRecord13(value) {
|
|
22396
22696
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
22397
22697
|
}
|
|
22398
22698
|
function guardPayload(guard) {
|
|
@@ -22415,7 +22715,7 @@ function servedJudgmentIdFromUnknown(value, depth = 0) {
|
|
|
22415
22715
|
if (depth > 5 || value === null || value === void 0) {
|
|
22416
22716
|
return void 0;
|
|
22417
22717
|
}
|
|
22418
|
-
if (!
|
|
22718
|
+
if (!isRecord13(value)) {
|
|
22419
22719
|
if (Array.isArray(value)) {
|
|
22420
22720
|
for (const item of value.slice(0, 12)) {
|
|
22421
22721
|
const found = servedJudgmentIdFromUnknown(item, depth + 1);
|
|
@@ -22772,7 +23072,7 @@ function runGuard(options, changedFiles) {
|
|
|
22772
23072
|
let payload;
|
|
22773
23073
|
try {
|
|
22774
23074
|
const parsed = JSON.parse(result.stdout);
|
|
22775
|
-
if (
|
|
23075
|
+
if (isRecord13(parsed)) {
|
|
22776
23076
|
payload = parsed;
|
|
22777
23077
|
}
|
|
22778
23078
|
} catch {
|
|
@@ -22934,10 +23234,10 @@ async function projectIntelligenceRunCommand(options) {
|
|
|
22934
23234
|
if (result.guard) {
|
|
22935
23235
|
console.log(import_chalk10.default.bold("Guard"));
|
|
22936
23236
|
console.log(`Status: ${result.guard.status}`);
|
|
22937
|
-
const actionCards =
|
|
23237
|
+
const actionCards = isRecord13(result.guard.payload) ? result.guard.payload.actionCards : [];
|
|
22938
23238
|
if (Array.isArray(actionCards) && actionCards.length > 0) {
|
|
22939
23239
|
for (const card of actionCards.slice(0, 6)) {
|
|
22940
|
-
if (!
|
|
23240
|
+
if (!isRecord13(card)) continue;
|
|
22941
23241
|
console.log(`- ${card.kind}: ${card.title ?? card.reason ?? "guard action"}`);
|
|
22942
23242
|
}
|
|
22943
23243
|
}
|
|
@@ -24889,7 +25189,7 @@ program.command("timeline").description("Show recent workflow phase commits, che
|
|
|
24889
25189
|
json: Boolean(options.json)
|
|
24890
25190
|
});
|
|
24891
25191
|
});
|
|
24892
|
-
program.command("handoff").description("Create an agent-ready handoff artifact and persist Team Sync continuity").option("--summary <summary>", "What changed in this session").option("--next <next>", "Recommended next action").option("--files <files...>", "Relevant files").option("--attention <attention>", "Attention level (note|watch|review|proof)").option("--risk <risk>", "Compatibility alias for --attention").option("--actor <actor>", "Actor or agent name").option("--adapter-pack", "Attach an ADE Adapter Pack V1 to the handoff artifact").option("--target <target>", "ADE target (codex|claude-code
|
|
25192
|
+
program.command("handoff").description("Create an agent-ready handoff artifact and persist Team Sync continuity").option("--summary <summary>", "What changed in this session").option("--next <next>", "Recommended next action").option("--files <files...>", "Relevant files").option("--attention <attention>", "Attention level (note|watch|review|proof)").option("--risk <risk>", "Compatibility alias for --attention").option("--actor <actor>", "Actor or agent name").option("--adapter-pack", "Attach an ADE Adapter Pack V1 to the handoff artifact").option("--target <target>", "ADE adapter-pack target (codex|claude-code)").option("--context <refs...>", "Context references for the adapter pack").option("--proof <proof...>", "Proof gates expected from the receiving agent").option("--acceptance <criteria...>", "Acceptance criteria for the receiving agent").option(
|
|
24893
25193
|
"--conflict-posture <posture>",
|
|
24894
25194
|
"Conflict posture (continue|wait|split_work|review_only|handoff)"
|
|
24895
25195
|
).option("-d, --dir <directory>", "Project directory (default: current)").option("-o, --output <file>", "Write the handoff artifact to Markdown or JSON").option("--json", "Print raw JSON").action(async (options) => {
|
|
@@ -26552,6 +26852,8 @@ if (require.main === module) {
|
|
|
26552
26852
|
ENGINEERING_LEAD_EXECUTION_RECEIPT_STAGES,
|
|
26553
26853
|
ENGINEERING_LEAD_EXECUTION_RECEIPT_STATUSES,
|
|
26554
26854
|
ENGINEERING_LEAD_POSTURES,
|
|
26855
|
+
ENGINEERING_LEAD_PROOF_VERIFICATION_SOURCES,
|
|
26856
|
+
ENGINEERING_LEAD_PROOF_VERIFICATION_STATUSES,
|
|
26555
26857
|
ENGINEERING_LEAD_ROUTING_MODES,
|
|
26556
26858
|
ENGINEERING_LEAD_STATUSES,
|
|
26557
26859
|
ENGINEERING_LEAD_SUPERVISION_STATUSES,
|