@ornexus/neocortex 4.60.67 → 4.60.68
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 +1194 -1194
- 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 +212 -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 +417 -2
- package/packages/client/dist/agent/update-agent-yaml.js +102 -1
- package/packages/client/dist/agent/update-description.js +251 -1
- package/packages/client/dist/cache/crypto-utils.js +78 -1
- package/packages/client/dist/cache/encrypted-cache.js +108 -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 +290 -3
- 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 +7140 -142
- 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 +156 -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/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 +90 -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 +2536 -81
- package/packages/client/dist/effects/invoke-effect-gateways.js +62 -1
- package/packages/client/dist/errors/error-messages.js +228 -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 +1234 -4
- package/packages/client/dist/git/git-lifecycle-step-ids.js +14 -1
- package/packages/client/dist/git/git-lifecycle-store.js +1938 -9
- 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 +47 -1
- package/packages/client/dist/invocation/invoke-input.js +24 -1
- package/packages/client/dist/license/index.js +5 -1
- package/packages/client/dist/license/license-client.js +304 -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 +1007 -40
- package/packages/client/dist/memory/shared-project-memory-types.js +253 -2
- 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 +344 -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/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/headless/adapters.js +49 -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 +110 -2
- package/packages/client/dist/runner/headless/epic-terminal-git-cli-adapter.js +1236 -8
- package/packages/client/dist/runner/headless/epic-terminal-git-runner.js +318 -2
- package/packages/client/dist/runner/headless/fake-adapter.js +62 -1
- package/packages/client/dist/runner/headless/managed-profile.js +132 -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 +885 -1
- package/packages/client/dist/runner/headless/run-yoloop.js +2574 -2
- package/packages/client/dist/runner/headless/types.js +574 -2
- 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 +1677 -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 +126 -1
- package/packages/client/dist/yolo/invoke-envelope-capability.js +62 -1
- package/packages/client/dist/yolo/spec-envelope-collector.js +185 -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 +1723 -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,63 @@
|
|
|
1
|
-
|
|
1
|
+
/** Bounded host renewal preserves the existing C01 owner, origin and session pin. */
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
|
+
import { acquireGitLifecyclePhysicalIntegrationLock, mutateGitLifecycleRuntime, readGitLifecycleRuntime, releaseGitLifecyclePhysicalIntegrationLock } from '../git/git-lifecycle-store.js';
|
|
4
|
+
import { resumePrivateYoloIsolatedSession } from './isolated-session.js';
|
|
5
|
+
export async function renewPrivateYoloSessionLease(projectRoot, storyId, graphRevision, input) {
|
|
6
|
+
const root = resolve(projectRoot), now = Date.now(), requested = Date.parse(input.expiresAt);
|
|
7
|
+
if (input.executorStopped !== true || !/^[a-f0-9]{40,64}$/.test(input.expectedSnapshotSha)
|
|
8
|
+
|| !Number.isFinite(requested) || requested <= now || requested > now + 60 * 60 * 1000) {
|
|
9
|
+
throw new Error('private-execution-session-renewal-input-invalid');
|
|
10
|
+
}
|
|
11
|
+
const before = await readGitLifecycleRuntime(root, { required: true });
|
|
12
|
+
const epicId = storyId.split('.')[0], epic = before.epics[epicId], rawLease = epic?.branch_lease;
|
|
13
|
+
const lease = rawLease && typeof rawLease === 'object' && !Array.isArray(rawLease)
|
|
14
|
+
? rawLease : undefined;
|
|
15
|
+
if (!lease || lease.schemaVersion !== 1 || lease.ownerStoryId !== storyId || lease.sessionId !== lease.idempotencyKey
|
|
16
|
+
|| typeof lease.sessionId !== 'string' || epic?.graph_revision !== graphRevision
|
|
17
|
+
|| typeof lease.expiresAt !== 'string' || !Number.isFinite(Date.parse(lease.expiresAt)) || Date.parse(lease.expiresAt) <= now
|
|
18
|
+
|| requested < Date.parse(lease.expiresAt) || !epic.origin_binding) {
|
|
19
|
+
throw new Error('private-execution-session-renewal-authority-invalid');
|
|
20
|
+
}
|
|
21
|
+
const sessionId = lease.sessionId, previousExpiresAt = lease.expiresAt;
|
|
22
|
+
const lock = await acquireGitLifecyclePhysicalIntegrationLock(root, { kind: 'direct', storyId,
|
|
23
|
+
sessionId, idempotencyKey: sessionId,
|
|
24
|
+
expiresAt: new Date(now + 5 * 60_000).toISOString(), persistent: false });
|
|
25
|
+
if (!lock.ok)
|
|
26
|
+
throw new Error('private-execution-session-renewal-backpressure');
|
|
27
|
+
try {
|
|
28
|
+
const session = await resumePrivateYoloIsolatedSession(root, storyId, graphRevision);
|
|
29
|
+
if (session.snapshotSha !== input.expectedSnapshotSha || session.setupSessionId !== sessionId
|
|
30
|
+
|| session.workspace.baseSha !== lease.setupHeadSha)
|
|
31
|
+
throw new Error('private-execution-session-renewal-pin-invalid');
|
|
32
|
+
const expiresAt = new Date(requested).toISOString();
|
|
33
|
+
let revision = before.revision;
|
|
34
|
+
if (Date.parse(previousExpiresAt) !== requested) {
|
|
35
|
+
const mutation = await mutateGitLifecycleRuntime(root, document => {
|
|
36
|
+
const current = document.epics[epicId];
|
|
37
|
+
if (!current || JSON.stringify(current.origin_binding) !== JSON.stringify(epic.origin_binding)
|
|
38
|
+
|| JSON.stringify(current.branch_lease) !== JSON.stringify(lease)
|
|
39
|
+
|| current.graph_revision !== graphRevision)
|
|
40
|
+
throw new Error('private-execution-session-renewal-raced');
|
|
41
|
+
current.branch_lease = { ...lease, expiresAt };
|
|
42
|
+
}, { expectedRevision: before.revision, preCommit: async () => {
|
|
43
|
+
if (Date.parse(previousExpiresAt) <= Date.now())
|
|
44
|
+
throw new Error('private-execution-session-renewal-expired');
|
|
45
|
+
const fresh = await resumePrivateYoloIsolatedSession(root, storyId, graphRevision);
|
|
46
|
+
if (fresh.snapshotSha !== input.expectedSnapshotSha || fresh.setupSessionId !== sessionId) {
|
|
47
|
+
throw new Error('private-execution-session-renewal-raced');
|
|
48
|
+
}
|
|
49
|
+
} });
|
|
50
|
+
revision = mutation.document.revision;
|
|
51
|
+
}
|
|
52
|
+
return { schemaVersion: 'PrivateYoloSessionLeaseRenewal/1', storyId, graphRevision,
|
|
53
|
+
snapshotSha: session.snapshotSha, sourceHead: session.workspace.baseSha,
|
|
54
|
+
previousExpiresAt, expiresAt, revision,
|
|
55
|
+
reused: Date.parse(previousExpiresAt) === requested, sessionPinPreserved: true,
|
|
56
|
+
originPreserved: true, checkpointAccepted: false, publicSafe: true };
|
|
57
|
+
}
|
|
58
|
+
finally {
|
|
59
|
+
if (!await releaseGitLifecyclePhysicalIntegrationLock(lock.path, lock.owner)) {
|
|
60
|
+
throw new Error('private-execution-session-renewal-lock-unverified');
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -1 +1,50 @@
|
|
|
1
|
-
|
|
1
|
+
/** Standalone-client shadows of public private-execution admission contracts. */
|
|
2
|
+
const PROPERTY_STEP = `step-${'a8ce5c64'}`;
|
|
3
|
+
const VALIDATE_STEP = `step-${'b2fe7cb5'}`;
|
|
4
|
+
const QA_STEP = `step-${'8721319d'}`;
|
|
5
|
+
export function isPrivateYoloSkippedPredecessors(value) {
|
|
6
|
+
return Array.isArray(value) && value.length <= 1 && value.every(item => {
|
|
7
|
+
if (!item || typeof item !== 'object' || Array.isArray(item))
|
|
8
|
+
return false;
|
|
9
|
+
const record = item;
|
|
10
|
+
return Object.keys(record).sort().join('|') === ['stepId', 'featureFlagId', 'enabled', 'tier', 'publicSafe'].sort().join('|')
|
|
11
|
+
&& record.stepId === PROPERTY_STEP && record.featureFlagId === 'property-testing'
|
|
12
|
+
&& typeof record.enabled === 'boolean' && ['free', 'pro', 'enterprise'].includes(String(record.tier))
|
|
13
|
+
&& (record.enabled === false || record.tier === 'free') && record.publicSafe === true;
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
export function isPrivateQaSkippedPredecessors(value) {
|
|
17
|
+
if (!Array.isArray(value) || value.length > 2)
|
|
18
|
+
return false;
|
|
19
|
+
const ids = [];
|
|
20
|
+
for (const item of value) {
|
|
21
|
+
if (isPrivateYoloSkippedPredecessors([item])) {
|
|
22
|
+
ids.push(item.stepId);
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
if (!item || typeof item !== 'object' || Array.isArray(item))
|
|
26
|
+
return false;
|
|
27
|
+
const record = item;
|
|
28
|
+
if (Object.keys(record).sort().join('|') !== ['stepId', 'featureGate', 'reason', 'tier', 'publicSafe'].sort().join('|')
|
|
29
|
+
|| record.stepId !== VALIDATE_STEP || record.featureGate !== 'validate-tests'
|
|
30
|
+
|| record.reason !== 'subscription-tier' || record.tier !== 'free' || record.publicSafe !== true)
|
|
31
|
+
return false;
|
|
32
|
+
ids.push(record.stepId);
|
|
33
|
+
}
|
|
34
|
+
return new Set(ids).size === ids.length && (value.length < 2
|
|
35
|
+
|| ids[0] === PROPERTY_STEP && ids[1] === VALIDATE_STEP && value[0].tier === 'free');
|
|
36
|
+
}
|
|
37
|
+
export function isPrivateQaStructuralAdmission(value) {
|
|
38
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
39
|
+
return false;
|
|
40
|
+
const record = value, checks = record.checks;
|
|
41
|
+
return Object.keys(record).sort().join('|') === ['schemaVersion', 'kind', 'stepId', 'generationId', 'graphRevision', 'topologyGenerationId', 'tier', 'checks', 'publicSafe'].sort().join('|')
|
|
42
|
+
&& record.schemaVersion === 1 && record.kind === 'server-private-qa-structural-admission' && record.stepId === QA_STEP
|
|
43
|
+
&& typeof record.generationId === 'string' && /^sha256:[a-f0-9]{64}$/.test(record.generationId)
|
|
44
|
+
&& typeof record.graphRevision === 'string' && /^[a-f0-9]{64}$/.test(record.graphRevision)
|
|
45
|
+
&& typeof record.topologyGenerationId === 'string' && /^sha256:[a-f0-9]{64}$/.test(record.topologyGenerationId)
|
|
46
|
+
&& ['free', 'pro', 'enterprise'].includes(String(record.tier)) && record.publicSafe === true
|
|
47
|
+
&& !!checks && typeof checks === 'object' && !Array.isArray(checks)
|
|
48
|
+
&& Object.keys(checks).sort().join('|') === ['classifiedAssetDelivery', 'licensedCommandAdmission', 'registeredStatusMapping', 'prerequisiteStateAdmitted'].sort().join('|')
|
|
49
|
+
&& Object.values(checks).every(result => result === true);
|
|
50
|
+
}
|
|
@@ -1 +1,66 @@
|
|
|
1
|
-
|
|
1
|
+
/** Standalone-client shadow of bounded project validation declarations. */
|
|
2
|
+
export const PROJECT_VALIDATION_KINDS = ['unit', 'integration', 'contract', 'bdd-example', 'e2e'];
|
|
3
|
+
export function readProjectValidationCommands(storyId, sources) {
|
|
4
|
+
const byKind = new Map();
|
|
5
|
+
let declared = false, invalid = false;
|
|
6
|
+
const allowedPaths = new Set(['story', 'spec', 'tasks'].map(suffix => `docs/stories/${storyId}.${suffix}.md`));
|
|
7
|
+
if (sources.length > 3 || new Set(sources.map(source => source.path)).size !== sources.length) {
|
|
8
|
+
return { declared: true, invalid: true, commands: [] };
|
|
9
|
+
}
|
|
10
|
+
for (const source of sources) {
|
|
11
|
+
if (!allowedPaths.has(source.path) || Buffer.byteLength(source.content) > 131072) {
|
|
12
|
+
invalid = true;
|
|
13
|
+
declared = true;
|
|
14
|
+
continue;
|
|
15
|
+
}
|
|
16
|
+
let active = false, fenced = false, headings = 0, entries = 0;
|
|
17
|
+
for (const raw of source.content.split(/\r?\n/)) {
|
|
18
|
+
const line = raw.trim();
|
|
19
|
+
if (/^(?:```|~~~)/.test(line)) {
|
|
20
|
+
fenced = !fenced;
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
if (fenced)
|
|
24
|
+
continue;
|
|
25
|
+
if (/^##\s+/.test(line)) {
|
|
26
|
+
if (active && entries === 0)
|
|
27
|
+
invalid = true;
|
|
28
|
+
active = line === '## Validation Commands';
|
|
29
|
+
if (active) {
|
|
30
|
+
declared = true;
|
|
31
|
+
headings++;
|
|
32
|
+
entries = 0;
|
|
33
|
+
if (headings > 1)
|
|
34
|
+
invalid = true;
|
|
35
|
+
}
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
if (!active || !line)
|
|
39
|
+
continue;
|
|
40
|
+
const match = /^- (unit|integration|contract|bdd-example|e2e): `([^`]{1,220})`$/.exec(line);
|
|
41
|
+
if (!match) {
|
|
42
|
+
invalid = true;
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
const kind = match[1], command = match[2];
|
|
46
|
+
if (!/^[A-Za-z0-9_./-]+(?: [A-Za-z0-9_./:@%+=,-]+)*$/.test(command)
|
|
47
|
+
|| /(?:token|password|license_key|secret|credential)=|(?:https?|ssh):\/\/|@[^ /]+\.[A-Za-z]/i.test(command)
|
|
48
|
+
|| command.split(' ').some(argument => argument.split('/').includes('..'))) {
|
|
49
|
+
invalid = true;
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
entries++;
|
|
53
|
+
const prior = byKind.get(kind);
|
|
54
|
+
if (prior && prior.command !== command || prior?.sourcePaths.includes(source.path)) {
|
|
55
|
+
invalid = true;
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
byKind.set(kind, { kind, command, sourcePaths: [...(prior?.sourcePaths ?? []), source.path] });
|
|
59
|
+
}
|
|
60
|
+
if (active && entries === 0)
|
|
61
|
+
invalid = true;
|
|
62
|
+
}
|
|
63
|
+
if (declared && !byKind.has('unit'))
|
|
64
|
+
invalid = true;
|
|
65
|
+
return { declared, invalid, commands: [...byKind.values()] };
|
|
66
|
+
}
|
|
@@ -1 +1,61 @@
|
|
|
1
|
-
|
|
1
|
+
/** Standalone-client shadow of the public root-memory effect contract. */
|
|
2
|
+
import { getProjectMemoryTarget, listProjectMemoryTargets } from '../memory/shared-project-memory-types.js';
|
|
3
|
+
export { getProjectMemoryTarget, listProjectMemoryTargets };
|
|
4
|
+
export function canonicalRootMemoryEffectJson(effect) {
|
|
5
|
+
const ordered = (value) => Array.isArray(value) ? value.map(ordered)
|
|
6
|
+
: value !== null && typeof value === 'object'
|
|
7
|
+
? Object.fromEntries(Object.keys(value).sort().map(key => [key, ordered(value[key])]))
|
|
8
|
+
: value;
|
|
9
|
+
return JSON.stringify(ordered(effect));
|
|
10
|
+
}
|
|
11
|
+
export function rootProjectMemoryPaths() {
|
|
12
|
+
return [...new Set(['NEOCORTEX.md', ...listProjectMemoryTargets().flatMap(target => [target.primaryFile,
|
|
13
|
+
...target.secondaryFiles.filter(file => file.scope === 'project').map(file => file.path)])])].sort();
|
|
14
|
+
}
|
|
15
|
+
export function isRootProjectMemoryEffect(value) {
|
|
16
|
+
const record = (candidate) => candidate !== null && typeof candidate === 'object' && !Array.isArray(candidate)
|
|
17
|
+
? candidate : undefined;
|
|
18
|
+
const effect = record(value);
|
|
19
|
+
const keys = ['schemaVersion', 'producer', 'storyId', 'epicId', 'executionBranch', 'sourceHeadSha',
|
|
20
|
+
'sourceSnapshotSha', 'memorySnapshotSha', 'graphRevision', 'childClaimRevision', 'setupSessionId',
|
|
21
|
+
'rootQaReceiptId', 'proposalSha256', 'canonicalSha256', 'projectionSha256', 'projectionFileCount', 'files', 'recordedAt', 'publicSafe'];
|
|
22
|
+
if (!effect || Object.keys(effect).sort().join('|') !== keys.sort().join('|')
|
|
23
|
+
|| effect.schemaVersion !== 'RootProjectMemoryEffect/1' || effect.producer !== 'root-project-memory'
|
|
24
|
+
|| effect.publicSafe !== true || typeof effect.storyId !== 'string'
|
|
25
|
+
|| !/^P[1-9][0-9]*\.[0-9]+$/.test(effect.storyId) || effect.epicId !== effect.storyId.split('.')[0]
|
|
26
|
+
|| effect.executionBranch !== `epic/${effect.epicId}`
|
|
27
|
+
|| ['sourceHeadSha', 'sourceSnapshotSha', 'memorySnapshotSha'].some(key => typeof effect[key] !== 'string' || !/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/.test(effect[key]))
|
|
28
|
+
|| ['graphRevision', 'childClaimRevision', 'rootQaReceiptId', 'proposalSha256', 'canonicalSha256', 'projectionSha256'].some(key => typeof effect[key] !== 'string' || !/^[a-f0-9]{64}$/.test(effect[key]))
|
|
29
|
+
|| typeof effect.setupSessionId !== 'string' || !/^setup-[a-f0-9]{64}$/.test(effect.setupSessionId)
|
|
30
|
+
|| typeof effect.recordedAt !== 'string' || !/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(effect.recordedAt)
|
|
31
|
+
|| !Number.isFinite(Date.parse(effect.recordedAt)) || new Date(effect.recordedAt).toISOString() !== effect.recordedAt
|
|
32
|
+
|| !Number.isSafeInteger(effect.projectionFileCount) || effect.projectionFileCount < 1
|
|
33
|
+
|| effect.projectionFileCount > 128 || !Array.isArray(effect.files) || effect.files.length > 128)
|
|
34
|
+
return false;
|
|
35
|
+
const allowed = new Set(rootProjectMemoryPaths()), seen = new Set();
|
|
36
|
+
const state = (candidate, path, after) => {
|
|
37
|
+
const item = record(candidate);
|
|
38
|
+
if (!item || !['absent', 'regular', 'symlink'].includes(String(item.kind))
|
|
39
|
+
|| Object.keys(item).sort().join('|') !== ['kind', 'sha256', ...(item.kind === 'symlink' ? ['linkTarget'] : [])].sort().join('|'))
|
|
40
|
+
return false;
|
|
41
|
+
if (item.kind === 'absent')
|
|
42
|
+
return !after && item.sha256 === null;
|
|
43
|
+
if (typeof item.sha256 !== 'string' || !/^[a-f0-9]{64}$/.test(item.sha256))
|
|
44
|
+
return false;
|
|
45
|
+
if (path === 'NEOCORTEX.md' && item.kind !== 'regular')
|
|
46
|
+
return false;
|
|
47
|
+
const canonicalTarget = '../'.repeat(path.split('/').length - 1) + 'NEOCORTEX.md';
|
|
48
|
+
return item.kind !== 'symlink' || typeof item.linkTarget === 'string' && item.linkTarget.length <= 1024
|
|
49
|
+
&& (after ? item.linkTarget === canonicalTarget
|
|
50
|
+
: item.linkTarget.split('/').filter(part => part !== '.').join('/') === canonicalTarget);
|
|
51
|
+
};
|
|
52
|
+
return effect.files.every(candidate => {
|
|
53
|
+
const file = record(candidate);
|
|
54
|
+
if (!file || Object.keys(file).sort().join('|') !== 'after|before|path' || typeof file.path !== 'string'
|
|
55
|
+
|| !allowed.has(file.path) || seen.has(file.path) || !state(file.before, file.path, false)
|
|
56
|
+
|| !state(file.after, file.path, true))
|
|
57
|
+
return false;
|
|
58
|
+
seen.add(file.path);
|
|
59
|
+
return true;
|
|
60
|
+
});
|
|
61
|
+
}
|