@ornexus/neocortex 4.60.78 → 4.60.79
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/release-source.json +1 -1
- package/dist/sbom.cdx.json +1193 -1206
- package/install.ps1 +1 -1
- package/install.sh +1 -1
- package/package.json +2 -2
- package/packages/client/dist/adapters/adapter-registry.js +108 -1
- package/packages/client/dist/adapters/antigravity-adapter.js +77 -2
- package/packages/client/dist/adapters/claude-code-adapter.js +79 -3
- package/packages/client/dist/adapters/codex-adapter.js +80 -2
- package/packages/client/dist/adapters/cursor-adapter.js +115 -4
- package/packages/client/dist/adapters/gemini-adapter.js +71 -2
- package/packages/client/dist/adapters/grok-adapter.js +42 -2
- package/packages/client/dist/adapters/index.js +22 -1
- package/packages/client/dist/adapters/platform-detector.js +214 -1
- package/packages/client/dist/adapters/target-adapter.js +12 -0
- package/packages/client/dist/adapters/vscode-adapter.js +72 -2
- package/packages/client/dist/agent/refresh-stubs.js +443 -2
- package/packages/client/dist/agent/update-agent-yaml.js +102 -1
- package/packages/client/dist/agent/update-description.js +260 -1
- package/packages/client/dist/cache/crypto-utils.js +78 -1
- package/packages/client/dist/cache/encrypted-cache.js +338 -1
- package/packages/client/dist/cache/in-memory-asset-cache.js +73 -1
- package/packages/client/dist/cache/index.js +13 -1
- package/packages/client/dist/cache/protected-pi-boundary.js +44 -1
- package/packages/client/dist/checkpoint/checkpoint-client-reader.js +127 -2
- package/packages/client/dist/checkpoint/index.js +11 -1
- package/packages/client/dist/checkpoint/shared-checkpoint-types.js +32 -1
- package/packages/client/dist/cli.js +358 -5
- package/packages/client/dist/commands/activate.js +394 -8
- package/packages/client/dist/commands/architecture-answers.js +274 -7
- package/packages/client/dist/commands/architecture-memory-terminal.js +253 -4
- package/packages/client/dist/commands/architecture-non-ui-continuation.js +100 -1
- package/packages/client/dist/commands/architecture-root-binding.js +51 -1
- package/packages/client/dist/commands/cache-status.js +112 -2
- package/packages/client/dist/commands/config.js +88 -1
- package/packages/client/dist/commands/doctor.js +635 -2
- package/packages/client/dist/commands/invoke.js +7712 -143
- package/packages/client/dist/commands/legacy-epic-terminal.js +71 -1
- package/packages/client/dist/commands/legacy-story-branch.js +96 -1
- package/packages/client/dist/commands/legacy-story-pr.js +276 -1
- package/packages/client/dist/commands/mutation-qa-checkpoint.js +285 -5
- package/packages/client/dist/commands/mutation-qa-gate.js +54 -1
- package/packages/client/dist/commands/mutation-qa-git.js +41 -1
- package/packages/client/dist/commands/mutation-qa-policy.js +102 -1
- package/packages/client/dist/commands/mutation-qa-run.js +219 -3
- package/packages/client/dist/commands/mutation-qa-verdict.js +149 -1
- package/packages/client/dist/commands/mutation-qa.js +220 -1
- package/packages/client/dist/commands/native-agent.js +136 -2
- package/packages/client/dist/commands/planning-diagnosis.js +43 -1
- package/packages/client/dist/commands/planning-generation.js +53 -1
- package/packages/client/dist/commands/planning-memory.js +40 -1
- package/packages/client/dist/commands/planning-research.js +42 -1
- package/packages/client/dist/commands/private-session.js +75 -1
- package/packages/client/dist/commands/property-qa.js +139 -1
- package/packages/client/dist/commands/qa-control.js +16 -1
- package/packages/client/dist/commands/qa-scan-browser-launch.js +55 -1
- package/packages/client/dist/commands/qa-scan-browser-route.js +28 -1
- package/packages/client/dist/commands/qa-scan-capture.js +663 -5
- package/packages/client/dist/commands/qa-scan-discovery.js +376 -3
- package/packages/client/dist/commands/qa-scan-review.js +826 -5
- package/packages/client/dist/commands/qa-synthetic-backend-capture.js +266 -1
- package/packages/client/dist/commands/qa-synthetic-backend-review.js +297 -1
- package/packages/client/dist/commands/qa-synthetic-backend.js +340 -2
- package/packages/client/dist/commands/qa-synthetic-broker-port.js +85 -1
- package/packages/client/dist/commands/qa-synthetic-browser.js +39 -1
- package/packages/client/dist/commands/refactor-characterization.js +671 -21
- package/packages/client/dist/commands/refactor-commit.js +399 -13
- package/packages/client/dist/commands/refactor-control.js +142 -3
- package/packages/client/dist/commands/refactor-cpp-assertions.js +93 -3
- package/packages/client/dist/commands/refactor-review.js +283 -5
- package/packages/client/dist/commands/refactor-root.js +588 -7
- package/packages/client/dist/commands/refresh-memory.js +159 -3
- package/packages/client/dist/commands/shared-architecture-non-ui.js +24 -1
- package/packages/client/dist/commands/story-checkpoint.js +171 -1
- package/packages/client/dist/config/host-auth-broker.js +60 -1
- package/packages/client/dist/config/host-auth-reference.js +93 -1
- package/packages/client/dist/config/profile-directory.js +13 -1
- package/packages/client/dist/config/resolver-selection.js +278 -1
- package/packages/client/dist/config/secure-config.js +281 -12
- package/packages/client/dist/config.js +223 -2
- package/packages/client/dist/constants.js +25 -1
- package/packages/client/dist/context/context-collector.js +222 -2
- package/packages/client/dist/context/context-sanitizer.js +145 -1
- package/packages/client/dist/continuity/autonomous-governance.js +285 -1
- package/packages/client/dist/continuity/continuity-client-state-store.js +1587 -1
- package/packages/client/dist/continuity/invoke-hooks.js +129 -1
- package/packages/client/dist/continuity/migrations/001-initial-schema.js +12 -2
- package/packages/client/dist/continuity/migrations/002-processing-output-summary-indexes.js +12 -2
- package/packages/client/dist/continuity/migrations/003-headless-execution-attempts.js +12 -2
- package/packages/client/dist/continuity/migrations/004-outbox-delivery-state.js +12 -2
- package/packages/client/dist/continuity/migrations/005-bounded-headless-queue.js +12 -2
- package/packages/client/dist/continuity/migrations/006-native-agent-dispatches.js +10 -2
- package/packages/client/dist/continuity/native-agent-store.js +69 -1
- package/packages/client/dist/continuity/native-agent-types.js +105 -1
- package/packages/client/dist/continuity/outbox.js +117 -1
- package/packages/client/dist/continuity/runner-bootstrap-policy.js +172 -1
- package/packages/client/dist/continuity/sqlite-store.js +2612 -81
- package/packages/client/dist/effects/invoke-effect-gateways.js +62 -1
- package/packages/client/dist/errors/error-messages.js +258 -2
- package/packages/client/dist/errors/frontmatter-diagnostics.js +125 -1
- package/packages/client/dist/evidence/collector.js +347 -1
- package/packages/client/dist/evidence/index.js +1 -1
- package/packages/client/dist/evidence/types.js +2 -0
- package/packages/client/dist/fs/atomic-state-replace.js +152 -1
- package/packages/client/dist/generated/command-registry.generated.js +4076 -1
- package/packages/client/dist/generated/public-projections.generated.js +149 -1
- package/packages/client/dist/git/direct-yolo-c01-retry.js +138 -4
- package/packages/client/dist/git/direct-yolo-checkpoint.js +1341 -4
- package/packages/client/dist/git/epic-operational-state.js +672 -2
- package/packages/client/dist/git/git-lifecycle-step-ids.js +14 -1
- package/packages/client/dist/git/git-lifecycle-store.js +2185 -10
- package/packages/client/dist/git/legacy-story-branch-checkpoint.js +259 -9
- package/packages/client/dist/git/legacy-story-branch-setup.js +348 -4
- package/packages/client/dist/git/legacy-story-pr.js +3538 -70
- package/packages/client/dist/git/secure-filesystem-boundary.js +182 -5
- package/packages/client/dist/graph-retrieval/pre-command-hook.js +284 -1
- package/packages/client/dist/graph-retrieval/shared-graph-retrieval-contract.js +237 -1
- package/packages/client/dist/i18n/first-run.js +60 -2
- package/packages/client/dist/index.js +50 -1
- package/packages/client/dist/invocation/invoke-input.js +24 -1
- package/packages/client/dist/license/host-auth-recovery.js +401 -1
- package/packages/client/dist/license/index.js +5 -1
- package/packages/client/dist/license/license-client.js +337 -1
- package/packages/client/dist/machine/fingerprint.js +163 -2
- package/packages/client/dist/machine/index.js +5 -1
- package/packages/client/dist/memory/project-memory-path-scope.js +62 -1
- package/packages/client/dist/memory/project-memory-writer.js +1067 -41
- package/packages/client/dist/memory/shared-project-memory-types.js +259 -2
- package/packages/client/dist/migrations/epic-lifecycle-backfill.js +1060 -3
- package/packages/client/dist/migrations/project-identity-capability.js +50 -1
- package/packages/client/dist/migrations/project-identity.js +493 -7
- package/packages/client/dist/migrations/state-json.js +393 -4
- package/packages/client/dist/policy/architecture-policy.js +184 -2
- package/packages/client/dist/policy/index.js +7 -1
- package/packages/client/dist/policy/shared-policy-types.js +38 -0
- package/packages/client/dist/policy/subagent-approval-policy.js +55 -1
- package/packages/client/dist/private-execution/clean-baseline.js +279 -2
- package/packages/client/dist/private-execution/codex-executor.js +574 -4
- package/packages/client/dist/private-execution/codex-host-runtime.js +137 -1
- package/packages/client/dist/private-execution/codex-lifecycle-guard.js +97 -1
- package/packages/client/dist/private-execution/codex-scoped-permissions.js +128 -1
- package/packages/client/dist/private-execution/delivery.js +410 -13
- package/packages/client/dist/private-execution/diagnosis-root-review.js +294 -2
- package/packages/client/dist/private-execution/frozen-handoff.js +19 -6
- package/packages/client/dist/private-execution/implementation-validation.js +106 -2
- package/packages/client/dist/private-execution/isolated-admission.js +1432 -23
- package/packages/client/dist/private-execution/isolated-session.js +725 -5
- package/packages/client/dist/private-execution/isolated-workspace.js +122 -1
- package/packages/client/dist/private-execution/pact-consumer-runtime.js +409 -3
- package/packages/client/dist/private-execution/pact-test-source.js +258 -1
- package/packages/client/dist/private-execution/pact-toolchain.js +290 -3
- package/packages/client/dist/private-execution/pact-write-set.js +172 -1
- package/packages/client/dist/private-execution/planning-diagnosis-checkpoint.js +406 -5
- package/packages/client/dist/private-execution/planning-generation-checkpoint.js +462 -5
- package/packages/client/dist/private-execution/planning-memory-checkpoint.js +139 -3
- package/packages/client/dist/private-execution/planning-research-checkpoint.js +325 -4
- package/packages/client/dist/private-execution/private-report-store.js +42 -1
- package/packages/client/dist/private-execution/property-test-candidate.js +103 -1
- package/packages/client/dist/private-execution/property-test-choices.js +147 -3
- package/packages/client/dist/private-execution/property-test-plan.js +271 -7
- package/packages/client/dist/private-execution/property-test-review.js +258 -4
- package/packages/client/dist/private-execution/property-test-runtime.js +372 -9
- package/packages/client/dist/private-execution/property-test-source.js +139 -1
- package/packages/client/dist/private-execution/root-checkpoint.js +80 -1
- package/packages/client/dist/private-execution/root-memory-git-evidence.js +135 -3
- package/packages/client/dist/private-execution/root-memory-recovery.js +93 -1
- package/packages/client/dist/private-execution/root-memory-request.js +29 -1
- package/packages/client/dist/private-execution/root-memory-scope.js +178 -1
- package/packages/client/dist/private-execution/root-memory-writer.js +102 -1
- package/packages/client/dist/private-execution/session-lease.js +63 -1
- package/packages/client/dist/private-execution/shared-private-admission-types.js +50 -1
- package/packages/client/dist/private-execution/shared-project-validation.js +66 -1
- package/packages/client/dist/private-execution/shared-root-memory-types.js +61 -1
- package/packages/client/dist/private-execution/ux-source-validation.js +372 -1
- package/packages/client/dist/private-execution/ux-write-set.js +191 -2
- package/packages/client/dist/registry/registry-reconciliation.js +234 -1
- package/packages/client/dist/resilience/circuit-breaker.js +170 -1
- package/packages/client/dist/resilience/degradation-manager.js +164 -1
- package/packages/client/dist/resilience/freshness-indicator.js +100 -1
- package/packages/client/dist/resilience/index.js +8 -1
- package/packages/client/dist/resilience/recovery-detector.js +74 -1
- package/packages/client/dist/resolvers/asset-resolver.js +13 -0
- package/packages/client/dist/resolvers/local-resolver.js +255 -8
- package/packages/client/dist/resolvers/remote-resolver.js +233 -1
- package/packages/client/dist/runner/binary.js +404 -1
- package/packages/client/dist/runner/cli.js +1571 -17
- package/packages/client/dist/runner/epic-background-dispatcher.js +124 -1
- package/packages/client/dist/runner/headless/adapters.js +49 -1
- package/packages/client/dist/runner/headless/background-root.js +85 -1
- package/packages/client/dist/runner/headless/claude-code-adapter.js +79 -1
- package/packages/client/dist/runner/headless/continuous-story-workspace.js +1628 -11
- package/packages/client/dist/runner/headless/epic-git-reconciliation-inventory.js +69 -1
- package/packages/client/dist/runner/headless/epic-merge-candidate-qa.js +111 -2
- package/packages/client/dist/runner/headless/epic-terminal-git-cli-adapter.js +1464 -10
- package/packages/client/dist/runner/headless/epic-terminal-git-runner.js +357 -2
- package/packages/client/dist/runner/headless/fake-adapter.js +62 -1
- package/packages/client/dist/runner/headless/managed-environment-cleanup.js +274 -1
- package/packages/client/dist/runner/headless/managed-profile.js +149 -1
- package/packages/client/dist/runner/headless/opencode-adapter.js +145 -2
- package/packages/client/dist/runner/headless/prepared-story-bundle.js +43 -1
- package/packages/client/dist/runner/headless/resolver.js +231 -1
- package/packages/client/dist/runner/headless/run-yolo.js +886 -1
- package/packages/client/dist/runner/headless/run-yoloop.js +2582 -2
- package/packages/client/dist/runner/headless/types.js +575 -2
- package/packages/client/dist/runner/host-capacity.js +59 -1
- package/packages/client/dist/runner/local-console.js +396 -13
- package/packages/client/dist/runner/portal-sync-worker.js +1487 -1
- package/packages/client/dist/runner/project-identity.js +106 -1
- package/packages/client/dist/runner/scheduler.js +995 -7
- package/packages/client/dist/runner-cli.js +18 -2
- package/packages/client/dist/state/invocation-shape.js +13 -1
- package/packages/client/dist/state/project-state-snapshot.js +1751 -1
- package/packages/client/dist/state/state-json-repair.js +785 -3
- package/packages/client/dist/state/structural-dag-projection.js +118 -1
- package/packages/client/dist/telemetry/index.js +5 -1
- package/packages/client/dist/telemetry/offline-queue.js +131 -1
- package/packages/client/dist/tier/index.js +5 -1
- package/packages/client/dist/tier/tier-aware-client.js +405 -1
- package/packages/client/dist/types/index.js +38 -1
- package/packages/client/dist/version.js +27 -1
- package/packages/client/dist/yolo/change-evidence-collector.js +222 -1
- package/packages/client/dist/yolo/invoke-envelope-capability.js +62 -1
- package/packages/client/dist/yolo/spec-envelope-collector.js +184 -5
- package/packages/client/dist/yoloop/discovery-hook.js +300 -2
- package/packages/client/dist/yoloop/index.js +8 -1
- package/packages/client/dist/yoloop/invoke-hooks.js +669 -12
- package/packages/client/dist/yoloop/shared-discover-epics.js +1007 -1
- package/packages/client/dist/yoloop/shared-yoloop-types.js +33 -1
- package/packages/client/dist/yoloop/target-normalization.js +180 -1
- package/packages/client/dist/yoloop/yoloop-client-state-store.js +1920 -1
- package/targets-stubs/antigravity/gemini.md +1 -1
- package/targets-stubs/antigravity/skill/SKILL.md +1 -1
- package/targets-stubs/claude-code/neocortex-root.agent.yaml +1 -1
- package/targets-stubs/claude-code/neocortex-root.md +2 -2
- package/targets-stubs/claude-code/neocortex.agent.yaml +1 -1
- package/targets-stubs/claude-code/neocortex.md +2 -2
- package/targets-stubs/codex/AGENTS.md +1 -1
- package/targets-stubs/cursor/agent.md +2 -2
- package/targets-stubs/gemini-cli/agent.md +2 -2
- package/targets-stubs/opencode/neocortex-root.md +1 -1
- package/targets-stubs/vscode/neocortex.agent.md +2 -2
|
@@ -1 +1,222 @@
|
|
|
1
|
-
import{execFileSync
|
|
1
|
+
import { execFileSync, spawnSync } from 'node:child_process';
|
|
2
|
+
import { realpathSync } from 'node:fs';
|
|
3
|
+
import { createYoloChangeEvidence } from '../../../shared/dist/yolo/change-evidence.js';
|
|
4
|
+
import { readGitLifecycleRuntimeSync } from '../git/git-lifecycle-store.js';
|
|
5
|
+
export class YoloChangeEvidenceUnavailableError extends Error {
|
|
6
|
+
diagnostic;
|
|
7
|
+
constructor(diagnostic) {
|
|
8
|
+
super('yolo-change-evidence-unavailable');
|
|
9
|
+
this.name = 'YoloChangeEvidenceUnavailableError';
|
|
10
|
+
this.diagnostic = Object.freeze({ ...diagnostic });
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export function yoloChangeEvidenceDiagnostic(error) {
|
|
14
|
+
return error instanceof YoloChangeEvidenceUnavailableError ? error.diagnostic : undefined;
|
|
15
|
+
}
|
|
16
|
+
const NO_REPAIR = Object.freeze({
|
|
17
|
+
repair: 'not-attempted', recollectionCount: 0,
|
|
18
|
+
});
|
|
19
|
+
function fallbackAction(reason) {
|
|
20
|
+
if (reason === 'lease-owner-mismatch' || reason === 'lease-invalid-or-nonsetup'
|
|
21
|
+
|| reason === 'direct-yolo-writer-active')
|
|
22
|
+
return 'resolve-lease-conflict';
|
|
23
|
+
if (reason === 'base-ref-missing' || reason === 'base-observation-unavailable'
|
|
24
|
+
|| reason === 'base-object-missing' || reason === 'base-not-ancestor'
|
|
25
|
+
|| reason === 'diff-read-unavailable')
|
|
26
|
+
return 'restore-verified-base-evidence';
|
|
27
|
+
if (reason === 'execution-branch-mismatch'
|
|
28
|
+
|| reason.startsWith('direct-yolo-'))
|
|
29
|
+
return 'inspect-repository-binding';
|
|
30
|
+
return 'none';
|
|
31
|
+
}
|
|
32
|
+
function unavailable(reason, baseSource, reconciliation = NO_REPAIR, repair = reconciliation.repair) {
|
|
33
|
+
throw new YoloChangeEvidenceUnavailableError({
|
|
34
|
+
reason,
|
|
35
|
+
baseSource,
|
|
36
|
+
repair,
|
|
37
|
+
recollectionCount: reconciliation.recollectionCount,
|
|
38
|
+
fallbackAction: fallbackAction(reason),
|
|
39
|
+
publicSafe: true,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/** Reacquire only an expired setup lease for this exact story through P207's CAS boundary. */
|
|
43
|
+
export async function reconcileYoloChangeEvidenceLease(options) {
|
|
44
|
+
let runtime;
|
|
45
|
+
try {
|
|
46
|
+
runtime = readGitLifecycleRuntimeSync(options.projectRoot, { required: true });
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
// C01 can legitimately precede first-use sidecar materialization. Only
|
|
50
|
+
// that exact absence falls through to the existing remote/base evidence.
|
|
51
|
+
if (error instanceof Error && error.message === 'git-lifecycle-runtime-missing')
|
|
52
|
+
return NO_REPAIR;
|
|
53
|
+
unavailable('runtime-state-unavailable', 'none');
|
|
54
|
+
}
|
|
55
|
+
const lease = runtime.epics[options.epicId]?.branch_lease;
|
|
56
|
+
if (lease === null || lease === undefined)
|
|
57
|
+
return NO_REPAIR;
|
|
58
|
+
if (typeof lease !== 'object' || Array.isArray(lease)) {
|
|
59
|
+
unavailable('lease-invalid-or-nonsetup', 'active-story-lease', NO_REPAIR, 'not-eligible');
|
|
60
|
+
}
|
|
61
|
+
if (lease.ownerStoryId !== options.storyId) {
|
|
62
|
+
unavailable('lease-owner-mismatch', 'active-story-lease', NO_REPAIR, 'not-eligible');
|
|
63
|
+
}
|
|
64
|
+
if (typeof lease.expiresAt !== 'string') {
|
|
65
|
+
unavailable('lease-invalid-or-nonsetup', 'active-story-lease', NO_REPAIR, 'not-eligible');
|
|
66
|
+
}
|
|
67
|
+
const expiry = Date.parse(lease.expiresAt);
|
|
68
|
+
if (!Number.isFinite(expiry)) {
|
|
69
|
+
unavailable('lease-invalid-or-nonsetup', 'active-story-lease', NO_REPAIR, 'not-eligible');
|
|
70
|
+
}
|
|
71
|
+
if (expiry > Date.now())
|
|
72
|
+
return NO_REPAIR;
|
|
73
|
+
if (typeof lease.sessionId !== 'string'
|
|
74
|
+
|| !/^setup-[a-f0-9]{64}$/.test(lease.sessionId)
|
|
75
|
+
|| lease.idempotencyKey !== lease.sessionId) {
|
|
76
|
+
unavailable('lease-invalid-or-nonsetup', 'active-story-lease', NO_REPAIR, 'not-eligible');
|
|
77
|
+
}
|
|
78
|
+
const { prepareDirectYoloSetup } = await import('../git/direct-yolo-checkpoint.js');
|
|
79
|
+
const result = await prepareDirectYoloSetup({
|
|
80
|
+
...options,
|
|
81
|
+
expiredSetupRecovery: {
|
|
82
|
+
schemaVersion: 1,
|
|
83
|
+
expectedRuntimeRevision: runtime.revision,
|
|
84
|
+
expectedLease: Object.freeze({ ...lease }),
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
if (!result.ok) {
|
|
88
|
+
unavailable(result.reasonCode, 'active-story-lease', NO_REPAIR, 'not-eligible');
|
|
89
|
+
}
|
|
90
|
+
if (result.value.storyId !== options.storyId
|
|
91
|
+
|| result.value.epicId !== options.epicId
|
|
92
|
+
|| Date.parse(result.value.leaseExpiresAt) <= Date.now()) {
|
|
93
|
+
unavailable('lease-invalid-or-nonsetup', 'active-story-lease', NO_REPAIR, 'not-eligible');
|
|
94
|
+
}
|
|
95
|
+
return Object.freeze({ repair: 'applied', recollectionCount: 1 });
|
|
96
|
+
}
|
|
97
|
+
function git(root, args, reason, baseSource, reconciliation) {
|
|
98
|
+
try {
|
|
99
|
+
return execFileSync('git', ['-C', root, ...args], {
|
|
100
|
+
encoding: 'utf8', timeout: 3_000, maxBuffer: 1024 * 1024, stdio: ['ignore', 'pipe', 'ignore'],
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
unavailable(reason, baseSource, reconciliation);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
function gitRefExists(root, ref, reconciliation) {
|
|
108
|
+
const result = spawnSync('git', ['-C', root, 'show-ref', '--verify', '--quiet', ref], {
|
|
109
|
+
timeout: 3_000, stdio: 'ignore',
|
|
110
|
+
});
|
|
111
|
+
if (result.status === 0)
|
|
112
|
+
return true;
|
|
113
|
+
if (result.status === 1)
|
|
114
|
+
return false;
|
|
115
|
+
unavailable('base-observation-unavailable', 'none', reconciliation);
|
|
116
|
+
}
|
|
117
|
+
function gitObjectExists(root, object, source, reconciliation) {
|
|
118
|
+
const result = spawnSync('git', ['-C', root, 'cat-file', '-e', `${object}^{commit}`], {
|
|
119
|
+
timeout: 3_000, stdio: 'ignore',
|
|
120
|
+
});
|
|
121
|
+
if (result.status === 0)
|
|
122
|
+
return true;
|
|
123
|
+
if (result.status === 1 || result.status === 128)
|
|
124
|
+
return false;
|
|
125
|
+
unavailable('base-observation-unavailable', source, reconciliation);
|
|
126
|
+
}
|
|
127
|
+
export function collectYoloChangeEvidence(options) {
|
|
128
|
+
const reconciliation = options.reconciliation ?? NO_REPAIR;
|
|
129
|
+
if (!/^[A-Za-z0-9][A-Za-z0-9_./-]{0,119}$/.test(options.defaultBranch)
|
|
130
|
+
|| options.defaultBranch.includes('..'))
|
|
131
|
+
unavailable('invalid-default-branch', 'none', reconciliation);
|
|
132
|
+
let repositoryRoot;
|
|
133
|
+
try {
|
|
134
|
+
repositoryRoot = git(options.projectRoot, ['rev-parse', '--show-toplevel'], 'repository-root-mismatch', 'none', reconciliation).trim();
|
|
135
|
+
if (realpathSync(repositoryRoot) !== realpathSync(options.projectRoot)) {
|
|
136
|
+
unavailable('repository-root-mismatch', 'none', reconciliation);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
catch (error) {
|
|
140
|
+
if (error instanceof YoloChangeEvidenceUnavailableError)
|
|
141
|
+
throw error;
|
|
142
|
+
unavailable('repository-root-mismatch', 'none', reconciliation);
|
|
143
|
+
}
|
|
144
|
+
const headSha = git(options.projectRoot, ['rev-parse', 'HEAD'], 'base-observation-unavailable', 'none', reconciliation).trim();
|
|
145
|
+
if (headSha !== options.expectedHeadSha)
|
|
146
|
+
throw new Error('yolo-change-evidence-stale');
|
|
147
|
+
let baseSha;
|
|
148
|
+
let baseSource = 'none';
|
|
149
|
+
let activeStoryLease = false;
|
|
150
|
+
let executionBranch = null;
|
|
151
|
+
if (options.storyId && options.epicId) {
|
|
152
|
+
let runtime;
|
|
153
|
+
try {
|
|
154
|
+
runtime = readGitLifecycleRuntimeSync(options.projectRoot);
|
|
155
|
+
}
|
|
156
|
+
catch {
|
|
157
|
+
unavailable('runtime-state-unavailable', 'none', reconciliation);
|
|
158
|
+
}
|
|
159
|
+
const epic = runtime.epics[options.epicId];
|
|
160
|
+
const lease = epic?.branch_lease;
|
|
161
|
+
const currentBranch = git(options.projectRoot, ['symbolic-ref', '--quiet', '--short', 'HEAD'], 'execution-branch-mismatch', 'none', reconciliation).trim();
|
|
162
|
+
if (epic?.branch_mode === 'epic' && epic.execution_branch === currentBranch)
|
|
163
|
+
executionBranch = currentBranch;
|
|
164
|
+
if (lease && typeof lease === 'object' && !Array.isArray(lease)) {
|
|
165
|
+
const item = lease;
|
|
166
|
+
if (item.ownerStoryId !== options.storyId) {
|
|
167
|
+
unavailable('lease-owner-mismatch', 'active-story-lease', reconciliation, 'not-eligible');
|
|
168
|
+
}
|
|
169
|
+
if (typeof item.expiresAt !== 'string' || !Number.isFinite(Date.parse(item.expiresAt))
|
|
170
|
+
|| Date.parse(item.expiresAt) <= Date.now()) {
|
|
171
|
+
unavailable('lease-invalid-or-nonsetup', 'active-story-lease', reconciliation, 'not-eligible');
|
|
172
|
+
}
|
|
173
|
+
if (executionBranch === null) {
|
|
174
|
+
unavailable('execution-branch-mismatch', 'active-story-lease', reconciliation, 'not-eligible');
|
|
175
|
+
}
|
|
176
|
+
activeStoryLease = true;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
if (activeStoryLease) {
|
|
180
|
+
// The live setup lease explicitly scopes evidence to current story bytes.
|
|
181
|
+
baseSha = headSha;
|
|
182
|
+
baseSource = 'active-story-lease';
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
const remoteLine = executionBranch === null ? '' : git(options.projectRoot, [
|
|
186
|
+
'ls-remote', '--heads', 'origin', `refs/heads/${executionBranch}`,
|
|
187
|
+
], 'base-observation-unavailable', 'published-execution-branch', reconciliation).trim();
|
|
188
|
+
if (remoteLine) {
|
|
189
|
+
baseSource = 'published-execution-branch';
|
|
190
|
+
const match = /^([a-f0-9]{40})\trefs\/heads\/([^\n]+)$/.exec(remoteLine);
|
|
191
|
+
if (!match || match[2] !== executionBranch) {
|
|
192
|
+
unavailable('base-observation-unavailable', baseSource, reconciliation);
|
|
193
|
+
}
|
|
194
|
+
if (!gitObjectExists(options.projectRoot, match[1], baseSource, reconciliation)) {
|
|
195
|
+
unavailable('base-object-missing', baseSource, reconciliation);
|
|
196
|
+
}
|
|
197
|
+
const ancestor = spawnSync('git', ['-C', options.projectRoot,
|
|
198
|
+
'merge-base', '--is-ancestor', match[1], 'HEAD'], { timeout: 3_000, stdio: 'ignore' });
|
|
199
|
+
if (ancestor.status !== 0)
|
|
200
|
+
unavailable('base-not-ancestor', baseSource, reconciliation);
|
|
201
|
+
baseSha = match[1];
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
const localRef = `refs/heads/${options.defaultBranch}`;
|
|
205
|
+
const remoteRef = `refs/remotes/origin/${options.defaultBranch}`;
|
|
206
|
+
const selectedRef = gitRefExists(options.projectRoot, localRef, reconciliation)
|
|
207
|
+
? localRef
|
|
208
|
+
: gitRefExists(options.projectRoot, remoteRef, reconciliation) ? remoteRef : null;
|
|
209
|
+
if (!selectedRef)
|
|
210
|
+
unavailable('base-ref-missing', 'none', reconciliation);
|
|
211
|
+
baseSource = selectedRef === localRef ? 'local-default-branch' : 'remote-default-branch';
|
|
212
|
+
baseSha = git(options.projectRoot, ['merge-base', 'HEAD', selectedRef], 'base-not-ancestor', baseSource, reconciliation).trim();
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
const tracked = git(options.projectRoot, ['diff', '--name-only', '-z', baseSha, '--'], 'diff-read-unavailable', baseSource, reconciliation).split('\0').filter(Boolean);
|
|
216
|
+
const untracked = git(options.projectRoot, ['ls-files', '--others', '--exclude-standard', '-z'], 'diff-read-unavailable', baseSource, reconciliation).split('\0').filter(Boolean);
|
|
217
|
+
const evidence = createYoloChangeEvidence({ baseSha, headSha, changedPaths: [...tracked, ...untracked] });
|
|
218
|
+
if (git(options.projectRoot, ['rev-parse', 'HEAD'], 'base-observation-unavailable', baseSource, reconciliation).trim() !== headSha) {
|
|
219
|
+
throw new Error('yolo-change-evidence-stale');
|
|
220
|
+
}
|
|
221
|
+
return evidence;
|
|
222
|
+
}
|
|
@@ -1 +1,62 @@
|
|
|
1
|
-
import{YOLO_INVOKE_ENVELOPE_CAPABILITY
|
|
1
|
+
import { YOLO_INVOKE_ENVELOPE_CAPABILITY } from '../../../shared/dist/yolo/spec-envelope.js';
|
|
2
|
+
const MAX_CAPABILITY_RESPONSE_BYTES = 16 * 1024;
|
|
3
|
+
const PUBLIC_VERSION = /^[0-9]{1,6}\.[0-9]{1,6}\.[0-9]{1,6}(?:-[A-Za-z0-9.-]{1,40})?$/;
|
|
4
|
+
function result(supported, reason, serverVersion) {
|
|
5
|
+
return Object.freeze({
|
|
6
|
+
supported,
|
|
7
|
+
capability: YOLO_INVOKE_ENVELOPE_CAPABILITY,
|
|
8
|
+
reason,
|
|
9
|
+
...(serverVersion && PUBLIC_VERSION.test(serverVersion) ? { serverVersion } : {}),
|
|
10
|
+
publicSafe: true,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Non-mutating, fail-closed compatibility probe for targeted YOLO requests.
|
|
15
|
+
* Older strict servers must be rejected before local release-gate execution.
|
|
16
|
+
*/
|
|
17
|
+
export async function probeYoloInvokeEnvelopeCapability(serverUrl, fetcher = globalThis.fetch) {
|
|
18
|
+
if (!fetcher)
|
|
19
|
+
return result(false, 'fetch-unavailable');
|
|
20
|
+
const controller = new AbortController();
|
|
21
|
+
const timeout = setTimeout(() => controller.abort(), 5_000);
|
|
22
|
+
timeout.unref?.();
|
|
23
|
+
try {
|
|
24
|
+
const response = await fetcher(`${serverUrl.replace(/\/+$/, '')}/api/v1/health`, {
|
|
25
|
+
method: 'GET',
|
|
26
|
+
headers: { accept: 'application/json' },
|
|
27
|
+
signal: controller.signal,
|
|
28
|
+
});
|
|
29
|
+
if (!response.ok)
|
|
30
|
+
return result(false, 'http-rejected');
|
|
31
|
+
const raw = await response.text();
|
|
32
|
+
if (Buffer.byteLength(raw, 'utf8') > MAX_CAPABILITY_RESPONSE_BYTES) {
|
|
33
|
+
return result(false, 'response-too-large');
|
|
34
|
+
}
|
|
35
|
+
let parsed;
|
|
36
|
+
try {
|
|
37
|
+
parsed = JSON.parse(raw);
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return result(false, 'response-invalid');
|
|
41
|
+
}
|
|
42
|
+
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
43
|
+
return result(false, 'response-invalid');
|
|
44
|
+
}
|
|
45
|
+
const record = parsed;
|
|
46
|
+
const capabilities = record.capabilities;
|
|
47
|
+
const serverVersion = typeof record.version === 'string' ? record.version : undefined;
|
|
48
|
+
if (!Array.isArray(capabilities)
|
|
49
|
+
|| capabilities.some((value) => typeof value !== 'string' || value.length > 80)) {
|
|
50
|
+
return result(false, 'response-invalid', serverVersion);
|
|
51
|
+
}
|
|
52
|
+
return capabilities.includes(YOLO_INVOKE_ENVELOPE_CAPABILITY)
|
|
53
|
+
? result(true, 'supported', serverVersion)
|
|
54
|
+
: result(false, 'capability-missing', serverVersion);
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
return result(false, 'request-failed');
|
|
58
|
+
}
|
|
59
|
+
finally {
|
|
60
|
+
clearTimeout(timeout);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -1,5 +1,184 @@
|
|
|
1
|
-
import{execFileSync
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { execFileSync } from 'node:child_process';
|
|
2
|
+
import { existsSync, readFileSync, realpathSync, statSync } from 'node:fs';
|
|
3
|
+
import { join, sep } from 'node:path';
|
|
4
|
+
import { createYoloSpecEnvelopeV1, YOLO_SPEC_MAX_ARTIFACTS, } from '../../../shared/dist/yolo/spec-envelope.js';
|
|
5
|
+
import { inspectFrontmatterContext } from '../../../shared/dist/frontmatter-context-contract.js';
|
|
6
|
+
const TEMPLATE_PATHS = [
|
|
7
|
+
'core/templates/specs/feature-spec-template.md',
|
|
8
|
+
'core/templates/specs/architecture-spec-template.md',
|
|
9
|
+
'core/templates/specs/contract-spec-template.md',
|
|
10
|
+
'core/templates/specs/story-spec-template.md',
|
|
11
|
+
'core/templates/specs/traceability-matrix-template.md',
|
|
12
|
+
];
|
|
13
|
+
const REFERENCE_PATH = /(?:^|[\s([`'";])((?:docs\/(?:stories|epics|specs|architecture|examples)\/|core\/templates\/specs\/)[A-Za-z0-9_./-]+\.(?:md|mdx|feature))(?:$|[\s)\]`'",;])/gm;
|
|
14
|
+
const STORY_ID = /^[A-Za-z][A-Za-z0-9_-]*(?:\.[A-Za-z0-9_-]+)+$/;
|
|
15
|
+
// Resource-safety stop only. Ordinary envelope sizing belongs to the existing
|
|
16
|
+
// invoke request guardrail, not to a smaller 64/128 KiB document policy.
|
|
17
|
+
const YOLO_SPEC_LOCAL_SOURCE_SAFETY_LIMIT_BYTES = 16 * 1024 * 1024;
|
|
18
|
+
/** Resolve only an explicit story target. Inline YOLO text intentionally has no match. */
|
|
19
|
+
export function extractTargetedYoloStoryId(args) {
|
|
20
|
+
const pathMatches = [...args.matchAll(/(?:^|\s)@?docs\/stories\/([A-Za-z][A-Za-z0-9_-]*(?:\.[A-Za-z0-9_-]+)+)\.story\.md(?=\s|$)/g)]
|
|
21
|
+
.map((match) => match[1]);
|
|
22
|
+
const tokenMatches = args.trim().split(/\s+/).slice(1)
|
|
23
|
+
.map((token) => token.replace(/^@/, ''))
|
|
24
|
+
.filter((token) => STORY_ID.test(token));
|
|
25
|
+
const matches = [...new Set([...pathMatches, ...tokenMatches])];
|
|
26
|
+
return matches.length === 1 ? matches[0] : null;
|
|
27
|
+
}
|
|
28
|
+
function artifactKind(path) {
|
|
29
|
+
if (path.startsWith('core/templates/'))
|
|
30
|
+
return 'template';
|
|
31
|
+
if (path.startsWith('docs/epics/'))
|
|
32
|
+
return 'epic';
|
|
33
|
+
if (path.startsWith('docs/stories/') && path.endsWith('.story.md'))
|
|
34
|
+
return 'story';
|
|
35
|
+
if (path.endsWith('.rtm.md'))
|
|
36
|
+
return 'traceability';
|
|
37
|
+
if (path.toLowerCase().includes('adr'))
|
|
38
|
+
return 'adr';
|
|
39
|
+
if (path.toLowerCase().includes('contract'))
|
|
40
|
+
return 'contract';
|
|
41
|
+
if (path.toLowerCase().includes('nfr'))
|
|
42
|
+
return 'nfr';
|
|
43
|
+
if (path.endsWith('.feature'))
|
|
44
|
+
return 'bdd';
|
|
45
|
+
if (path.toLowerCase().includes('traceability'))
|
|
46
|
+
return 'traceability';
|
|
47
|
+
if (path.startsWith('docs/examples/'))
|
|
48
|
+
return 'example';
|
|
49
|
+
return 'spec';
|
|
50
|
+
}
|
|
51
|
+
function selectedReferencePaths(story) {
|
|
52
|
+
return [...new Set([...story.matchAll(REFERENCE_PATH)].map((match) => match[1]).filter((path) => Boolean(path)))].sort();
|
|
53
|
+
}
|
|
54
|
+
function safeSource(root, path) {
|
|
55
|
+
const rootReal = realpathSync(root);
|
|
56
|
+
let fileReal;
|
|
57
|
+
try {
|
|
58
|
+
fileReal = realpathSync(join(rootReal, path));
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
throw new Error('yolo-spec-envelope-required');
|
|
62
|
+
}
|
|
63
|
+
if (!fileReal.startsWith(`${rootReal}${sep}`))
|
|
64
|
+
throw new Error('yolo-spec-envelope-path-out-of-scope');
|
|
65
|
+
const sourceStat = statSync(fileReal);
|
|
66
|
+
if (!sourceStat.isFile())
|
|
67
|
+
throw new Error('yolo-spec-envelope-unsafe');
|
|
68
|
+
if (sourceStat.size > YOLO_SPEC_LOCAL_SOURCE_SAFETY_LIMIT_BYTES)
|
|
69
|
+
throw new Error('yolo-spec-envelope-too-large');
|
|
70
|
+
return readFileSync(fileReal, 'utf8');
|
|
71
|
+
}
|
|
72
|
+
function publicMarkdown(source, kind) {
|
|
73
|
+
const context = kind === 'story' ? 'story-target' : 'epic-target';
|
|
74
|
+
const inspected = inspectFrontmatterContext(source, { context, explicitlySelected: true });
|
|
75
|
+
if (inspected.status === 'malformed' || inspected.status === 'oversized')
|
|
76
|
+
throw new Error('yolo-spec-envelope-unsafe');
|
|
77
|
+
if (inspected.status === 'absent')
|
|
78
|
+
return source;
|
|
79
|
+
const match = source.match(/^---\r?\n[\s\S]*?\r?\n---\r?\n/);
|
|
80
|
+
if (!match)
|
|
81
|
+
throw new Error('yolo-spec-envelope-unsafe');
|
|
82
|
+
const fields = Object.entries(inspected.metadata).map(([key, value]) => `${key}: ${JSON.stringify(value)}`);
|
|
83
|
+
return `---\n${fields.join('\n')}\n---\n${source.slice(match[0].length)}`;
|
|
84
|
+
}
|
|
85
|
+
function readHeadSha(root) {
|
|
86
|
+
try {
|
|
87
|
+
return execFileSync('git', ['-C', root, 'rev-parse', 'HEAD'], {
|
|
88
|
+
encoding: 'utf8', timeout: 2_000, stdio: ['ignore', 'pipe', 'ignore'],
|
|
89
|
+
}).trim();
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
throw new Error('yolo-spec-envelope-stale');
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
export function collectYoloSpecEnvelope(options) {
|
|
96
|
+
const targetPath = `docs/stories/${options.storyId}.story.md`;
|
|
97
|
+
const epicPath = `docs/epics/epic-${options.epicId}.md`;
|
|
98
|
+
const initialHead = options.headSha ?? readHeadSha(options.projectRoot);
|
|
99
|
+
const story = publicMarkdown(safeSource(options.projectRoot, targetPath), 'story');
|
|
100
|
+
const epic = publicMarkdown(safeSource(options.projectRoot, epicPath), 'epic');
|
|
101
|
+
const artifacts = [
|
|
102
|
+
{ kind: 'story', path: targetPath, content: story },
|
|
103
|
+
{ kind: 'epic', path: epicPath, content: epic },
|
|
104
|
+
];
|
|
105
|
+
const coreStoryReferences = new Set([
|
|
106
|
+
`docs/stories/${options.storyId}.spec.md`,
|
|
107
|
+
`docs/stories/${options.storyId}.tasks.md`,
|
|
108
|
+
`docs/stories/${options.storyId}.rtm.md`,
|
|
109
|
+
]);
|
|
110
|
+
// Older stories may not link to their own SDD files. Bind physically present
|
|
111
|
+
// siblings to the same HEAD/content checks as explicitly referenced files.
|
|
112
|
+
const selectedReferences = [...new Set([
|
|
113
|
+
...selectedReferencePaths(story),
|
|
114
|
+
...[...coreStoryReferences].filter((path) => existsSync(join(options.projectRoot, path))),
|
|
115
|
+
])].sort();
|
|
116
|
+
const prioritizedReferences = [
|
|
117
|
+
...selectedReferences.filter((path) => coreStoryReferences.has(path)),
|
|
118
|
+
...selectedReferences.filter((path) => !coreStoryReferences.has(path)),
|
|
119
|
+
];
|
|
120
|
+
let omittedReferences = 0;
|
|
121
|
+
for (const path of prioritizedReferences) {
|
|
122
|
+
if (path === targetPath || path === epicPath || !existsSync(join(options.projectRoot, path)))
|
|
123
|
+
continue;
|
|
124
|
+
// A foreign story/epic is a target conflict, never optional context. The
|
|
125
|
+
// byte budget must not turn a prior target-mismatch denial into admission.
|
|
126
|
+
if ((path.startsWith('docs/stories/') && path.endsWith('.story.md'))
|
|
127
|
+
|| path.startsWith('docs/epics/'))
|
|
128
|
+
throw new Error('yolo-spec-envelope-target-mismatch');
|
|
129
|
+
const content = safeSource(options.projectRoot, path);
|
|
130
|
+
if (artifacts.length >= YOLO_SPEC_MAX_ARTIFACTS) {
|
|
131
|
+
if (coreStoryReferences.has(path))
|
|
132
|
+
throw new Error('yolo-spec-envelope-too-large');
|
|
133
|
+
omittedReferences += 1;
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
artifacts.push({ kind: artifactKind(path), path, content });
|
|
137
|
+
}
|
|
138
|
+
// Templates and non-core references are supporting context. Preserve the
|
|
139
|
+
// story's own SDD artifacts and signal omissions without exposing paths.
|
|
140
|
+
if (omittedReferences)
|
|
141
|
+
options.onOmittedReferences?.(omittedReferences);
|
|
142
|
+
for (const path of TEMPLATE_PATHS) {
|
|
143
|
+
if (path === targetPath || path === epicPath || selectedReferences.includes(path)
|
|
144
|
+
|| !existsSync(join(options.projectRoot, path)))
|
|
145
|
+
continue;
|
|
146
|
+
const content = safeSource(options.projectRoot, path);
|
|
147
|
+
if (artifacts.length >= YOLO_SPEC_MAX_ARTIFACTS)
|
|
148
|
+
continue;
|
|
149
|
+
artifacts.push({ kind: artifactKind(path), path, content });
|
|
150
|
+
}
|
|
151
|
+
const envelope = createYoloSpecEnvelopeV1({
|
|
152
|
+
storyId: options.storyId,
|
|
153
|
+
epicId: options.epicId,
|
|
154
|
+
targetPath,
|
|
155
|
+
inputSha256: options.inputSha256,
|
|
156
|
+
headSha: initialHead,
|
|
157
|
+
collectedAt: options.collectedAt ?? new Date().toISOString(),
|
|
158
|
+
artifacts,
|
|
159
|
+
});
|
|
160
|
+
const finalHead = options.headSha ?? readHeadSha(options.projectRoot);
|
|
161
|
+
if (initialHead !== finalHead
|
|
162
|
+
|| publicMarkdown(safeSource(options.projectRoot, targetPath), 'story') !== story
|
|
163
|
+
|| publicMarkdown(safeSource(options.projectRoot, epicPath), 'epic') !== epic
|
|
164
|
+
|| artifacts.some((artifact) => artifact.kind !== 'story' && artifact.kind !== 'epic'
|
|
165
|
+
&& safeSource(options.projectRoot, artifact.path) !== artifact.content)) {
|
|
166
|
+
throw new Error('yolo-spec-envelope-stale');
|
|
167
|
+
}
|
|
168
|
+
return envelope;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Reissue a precollected physical snapshot with a fresh bounded transport time.
|
|
172
|
+
* The caller still performs the final disk/HEAD collection and digest comparison.
|
|
173
|
+
*/
|
|
174
|
+
export function refreshPrecollectedYoloSpecEnvelope(envelope, collectedAt = new Date().toISOString()) {
|
|
175
|
+
return createYoloSpecEnvelopeV1({
|
|
176
|
+
storyId: envelope.storyId,
|
|
177
|
+
epicId: envelope.epicId,
|
|
178
|
+
targetPath: envelope.targetPath,
|
|
179
|
+
inputSha256: envelope.inputSha256,
|
|
180
|
+
headSha: envelope.sourceRevision.headSha,
|
|
181
|
+
collectedAt,
|
|
182
|
+
artifacts: envelope.artifacts.map(({ kind, path, content }) => ({ kind, path, content })),
|
|
183
|
+
});
|
|
184
|
+
}
|