peaks-loop 4.1.17 → 4.1.19
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/.claude-plugin/marketplace.json +2 -2
- package/CHANGELOG.md +269 -0
- package/README-en.md +6 -0
- package/README.md +5 -0
- package/contracts/test-style-contract.md +14 -5
- package/dist/cli/commands/audit-red-lines-runners.js +6 -1
- package/dist/cli/commands/best-practice-scan-collision.d.ts +42 -0
- package/dist/cli/commands/best-practice-scan-collision.js +115 -0
- package/dist/cli/commands/best-practice-scan-command.d.ts +5 -0
- package/dist/cli/commands/best-practice-scan-command.js +9 -18
- package/dist/cli/commands/best-practice-scan-helpers.d.ts +12 -6
- package/dist/cli/commands/best-practice-scan-helpers.js +37 -17
- package/dist/cli/commands/code-auto-compact-command.js +71 -40
- package/dist/cli/commands/code-auto-compact-deferral.d.ts +34 -0
- package/dist/cli/commands/code-auto-compact-deferral.js +59 -0
- package/dist/cli/commands/code-gate-command.d.ts +4 -4
- package/dist/cli/commands/code-gate-command.js +4 -4
- package/dist/cli/commands/core/skill-generated-config-notice.d.ts +5 -0
- package/dist/cli/commands/core/skill-generated-config-notice.js +42 -8
- package/dist/cli/commands/core/skill-presence-commands.js +42 -74
- package/dist/cli/commands/core/skill-presence-set-command.d.ts +11 -0
- package/dist/cli/commands/core/skill-presence-set-command.js +175 -0
- package/dist/cli/commands/core/skill-registry-commands.js +32 -0
- package/dist/cli/commands/core/skill-store-report.d.ts +8 -0
- package/dist/cli/commands/core/skill-store-report.js +79 -0
- package/dist/cli/commands/core/standards-init-command.js +44 -8
- package/dist/cli/commands/core/standards-migrate-command.js +5 -4
- package/dist/cli/commands/dispatch-dag-runners.d.ts +1 -0
- package/dist/cli/commands/dispatch-dag-runners.js +11 -1
- package/dist/cli/commands/dispatch-detached-branch.js +19 -1
- package/dist/cli/commands/dispatch-prompt-composition.js +7 -2
- package/dist/cli/commands/dispatch-scratch-path-block.d.ts +73 -0
- package/dist/cli/commands/dispatch-scratch-path-block.js +131 -0
- package/dist/cli/commands/hooks-commands.js +36 -7
- package/dist/cli/commands/hooks-uninstall-command.js +5 -5
- package/dist/cli/commands/mut-commands-helpers.d.ts +72 -5
- package/dist/cli/commands/mut-commands-helpers.js +197 -4
- package/dist/cli/commands/mut-commands.d.ts +9 -1
- package/dist/cli/commands/mut-commands.js +82 -154
- package/dist/cli/commands/preferences-commands.js +27 -2
- package/dist/cli/commands/scan-scope-helpers.js +2 -2
- package/dist/services/24h-mode/auto-engage.d.ts +11 -3
- package/dist/services/24h-mode/auto-engage.js +14 -6
- package/dist/services/artifacts/artifact-templates.js +10 -0
- package/dist/services/artifacts/backcompat-acceptance.d.ts +8 -1
- package/dist/services/artifacts/backcompat-acceptance.js +8 -7
- package/dist/services/artifacts/rd-transition-gates.d.ts +32 -5
- package/dist/services/artifacts/rd-transition-gates.js +96 -19
- package/dist/services/artifacts/request-artifact-service.js +6 -6
- package/dist/services/audit/enforcers/lint-output-style.js +14 -2
- package/dist/services/audit/enforcers/root-scratch-artifacts.d.ts +46 -0
- package/dist/services/audit/enforcers/root-scratch-artifacts.js +97 -0
- package/dist/services/audit/static-service.js +4 -4
- package/dist/services/code/auto-compact-history.d.ts +6 -1
- package/dist/services/code/auto-compact-history.js +6 -1
- package/dist/services/code/auto-compact-modes.d.ts +60 -14
- package/dist/services/code/auto-compact-modes.js +75 -20
- package/dist/services/code/auto-compact-orchestrator.js +7 -5
- package/dist/services/code/auto-compact-profile.d.ts +23 -0
- package/dist/services/code/auto-compact-profile.js +51 -0
- package/dist/services/code/auto-compact-run-types.d.ts +8 -4
- package/dist/services/compact-history/compact-history-service.d.ts +6 -1
- package/dist/services/compact-history/compact-history-service.js +5 -1
- package/dist/services/context/auto-compact-types.d.ts +7 -5
- package/dist/services/dispatch/dispatch-ledger-reader.d.ts +13 -0
- package/dist/services/dispatch/dispatch-ledger-reader.js +164 -0
- package/dist/services/doctor/doctor-service/checks/canonical-store-version.d.ts +57 -0
- package/dist/services/doctor/doctor-service/checks/canonical-store-version.js +190 -0
- package/dist/services/doctor/doctor-service/checks/l3-runtime-root-census.d.ts +37 -0
- package/dist/services/doctor/doctor-service/checks/l3-runtime-root-census.js +100 -0
- package/dist/services/doctor/doctor-service/checks/skill-reference-parity.d.ts +11 -3
- package/dist/services/doctor/doctor-service/checks/skill-reference-parity.js +48 -29
- package/dist/services/doctor/doctor-service/plugin-registry.js +4 -0
- package/dist/services/doctor/doctor-service/types.d.ts +12 -0
- package/dist/services/hooks/hook-payload-cwd.d.ts +11 -4
- package/dist/services/hooks/hook-payload-cwd.js +11 -4
- package/dist/services/hooks/pre-tool-code-gate.d.ts +4 -4
- package/dist/services/hooks/pre-tool-code-gate.js +4 -4
- package/dist/services/hooks/presence-marker-detector.d.ts +3 -0
- package/dist/services/hooks/presence-marker-detector.js +21 -19
- package/dist/services/ide/adapters/claude-code-adapter.js +6 -8
- package/dist/services/ide/adapters/codex-adapter.js +23 -7
- package/dist/services/ide/adapters/cursor-adapter.js +23 -7
- package/dist/services/mode/mode-status-service.d.ts +26 -27
- package/dist/services/mode/mode-status-service.js +36 -60
- package/dist/services/preferences/preferences-types.d.ts +30 -0
- package/dist/services/preferences/preferences-types.js +13 -0
- package/dist/services/scan/acceptance-coverage-service.d.ts +14 -11
- package/dist/services/scan/acceptance-coverage-service.js +157 -52
- package/dist/services/scan/rid-change-claims.d.ts +15 -0
- package/dist/services/scan/rid-change-claims.js +116 -0
- package/dist/services/session/getSessionDir.d.ts +13 -0
- package/dist/services/session/getSessionDir.js +7 -1
- package/dist/services/skills/hooks-settings-types.d.ts +17 -21
- package/dist/services/skills/presence-caller-id.d.ts +51 -0
- package/dist/services/skills/presence-caller-id.js +43 -0
- package/dist/services/skills/presence-gate.d.ts +65 -0
- package/dist/services/skills/presence-gate.js +113 -0
- package/dist/services/skills/presence-lease-resolver.d.ts +63 -0
- package/dist/services/skills/presence-lease-resolver.js +114 -0
- package/dist/services/skills/presence-lease-selection.d.ts +91 -0
- package/dist/services/skills/presence-lease-selection.js +135 -0
- package/dist/services/skills/presence-lease-service.d.ts +3 -11
- package/dist/services/skills/presence-lease-service.js +34 -87
- package/dist/services/skills/presence-lease-store.d.ts +33 -0
- package/dist/services/skills/presence-lease-store.js +94 -0
- package/dist/services/skills/presence-lease-types.d.ts +31 -0
- package/dist/services/skills/presence-lease-types.js +27 -0
- package/dist/services/skills/presence-role.d.ts +35 -0
- package/dist/services/skills/presence-role.js +72 -0
- package/dist/services/skills/skill-presence-service.d.ts +39 -9
- package/dist/services/skills/skill-presence-service.js +143 -174
- package/dist/services/skills/skill-presence-write.d.ts +60 -0
- package/dist/services/skills/skill-presence-write.js +74 -0
- package/dist/services/skills/skill-statusline-service.js +7 -7
- package/dist/services/skills/sync-service-support.d.ts +27 -0
- package/dist/services/skills/sync-service.js +1 -0
- package/dist/services/standards/ide-aware-standards-service.d.ts +35 -23
- package/dist/services/standards/ide-aware-standards-service.js +45 -20
- package/dist/services/standards/migrate-claude-rules-service.d.ts +6 -0
- package/dist/services/standards/migrate-claude-rules-service.js +18 -0
- package/dist/services/standards/migrate-service.d.ts +1 -1
- package/dist/services/standards/migrate-service.js +27 -7
- package/dist/services/standards/project-scripts.d.ts +25 -0
- package/dist/services/standards/project-scripts.js +116 -0
- package/dist/services/standards/project-standards-service.d.ts +23 -15
- package/dist/services/standards/project-standards-service.js +176 -243
- package/dist/services/standards/standards-constitution.d.ts +89 -0
- package/dist/services/standards/standards-constitution.js +199 -0
- package/dist/services/standards/standards-files.d.ts +37 -0
- package/dist/services/standards/standards-files.js +138 -0
- package/dist/services/standards/standards-pointer.d.ts +73 -0
- package/dist/services/standards/standards-pointer.js +98 -0
- package/dist/services/standards/standards-render-agents.d.ts +34 -0
- package/dist/services/standards/standards-render-agents.js +149 -0
- package/dist/services/standards/standards-render-common.d.ts +38 -1
- package/dist/services/standards/standards-render-common.js +44 -7
- package/dist/services/standards/standards-render.d.ts +1 -3
- package/dist/services/standards/standards-render.js +6 -87
- package/dist/services/workflow/workflow-graph-ensure.d.ts +77 -0
- package/dist/services/workflow/workflow-graph-ensure.js +97 -0
- package/dist/services/workflow/workflow-inflight-probe.d.ts +68 -31
- package/dist/services/workflow/workflow-inflight-probe.js +163 -75
- package/dist/services/workflow/workflow-presence-lifecycle.js +21 -6
- package/dist/services/workspace/generated-artifacts-content.d.ts +46 -0
- package/dist/services/workspace/generated-artifacts-content.js +167 -0
- package/dist/services/workspace/generated-artifacts-stamp.d.ts +36 -13
- package/dist/services/workspace/generated-artifacts-stamp.js +37 -15
- package/dist/services/workspace/runtime-layout.d.ts +64 -0
- package/dist/services/workspace/runtime-layout.js +62 -0
- package/output-styles/peaks-skill-swarm.md +18 -2
- package/package.json +10 -9
- package/schemas/doctor-report.schema.json +1 -1
- package/scripts/canonical-store-fs.mjs +112 -0
- package/scripts/canonical-store-link.mjs +13 -22
- package/scripts/canonical-store-marker.mjs +241 -0
- package/scripts/canonical-store.mjs +119 -141
- package/scripts/install-skills-bundles.mjs +56 -13
- package/scripts/install-skills-fs.mjs +73 -0
- package/scripts/install-skills-output-styles.mjs +8 -2
- package/scripts/install-skills-report.mjs +19 -0
- package/scripts/install-skills.mjs +9 -0
- package/skills/bee/peaks-perf-audit/SKILL.md +3 -1
- package/skills/bee/peaks-prd/SKILL.md +5 -3
- package/skills/bee/peaks-qa/SKILL.md +4 -2
- package/skills/bee/peaks-qa/references/qa-skill-presence.md +1 -1
- package/skills/bee/peaks-qa/references/qa-standards-preflight.md +3 -1
- package/skills/bee/peaks-qa/references/qa-sub-agent-dispatch.md +2 -2
- package/skills/bee/peaks-rd/SKILL.md +4 -2
- package/skills/bee/peaks-rd/references/artifact-and-standards-output.md +1 -1
- package/skills/bee/peaks-rd/references/rd-runbook.md +11 -2
- package/skills/bee/peaks-rd/references/rd-standards-preflight.md +3 -1
- package/skills/bee/peaks-rd/references/rd-sub-agent-dispatch.md +24 -5
- package/skills/bee/peaks-rd/references/rd-transition-gates.md +49 -5
- package/skills/bee/peaks-rd/references/skill-presence-and-title.md +1 -1
- package/skills/bee/peaks-reviewer/SKILL.md +3 -1
- package/skills/bee/peaks-sc/SKILL.md +4 -2
- package/skills/bee/peaks-security-audit/SKILL.md +3 -1
- package/skills/bee/peaks-txt/SKILL.md +5 -3
- package/skills/bee/peaks-ui/SKILL.md +6 -4
- package/skills/peaks-audit/SKILL.md +3 -1
- package/skills/peaks-code/SKILL.md +4 -2
- package/skills/peaks-code/references/a2a-artifact-mapping.md +3 -3
- package/skills/peaks-code/references/completion-handoff.md +1 -1
- package/skills/peaks-code/references/local-artifact-workspace.md +10 -11
- package/skills/peaks-code/references/micro-cycle.md +2 -2
- package/skills/peaks-code/references/mode-selection-with-stale-presence.md +3 -3
- package/skills/peaks-code/references/runbook.md +4 -4
- package/skills/peaks-code/references/skill-presence-and-title.md +4 -2
- package/skills/peaks-code/references/standards-preflight.md +7 -6
- package/skills/peaks-code/references/sub-agent-dispatch.md +1 -1
- package/skills/peaks-code/references/swarm-dispatch-contract.md +5 -5
- package/skills/peaks-code/references/workflow-gates-and-types.md +37 -11
- package/skills/peaks-content/SKILL.md +3 -1
- package/skills/peaks-doctor/SKILL.md +3 -1
- package/skills/peaks-final-review/SKILL.md +3 -1
- package/skills/peaks-ide/SKILL.md +3 -1
- package/skills/peaks-issue-fix-orchestrator/SKILL.md +5 -3
- package/skills/peaks-race-code/SKILL.md +9 -4
- package/skills/peaks-resume/SKILL.md +3 -1
- package/skills/peaks-slice-decompose/SKILL.md +3 -1
- package/skills/peaks-solo/SKILL.md +3 -1
- package/skills/peaks-sop/SKILL.md +4 -2
- package/skills/peaks-status/SKILL.md +3 -1
- package/skills/peaks-test/SKILL.md +3 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { resolvePresenceLease } from '../skills/presence-lease-resolver.js';
|
|
2
|
+
import { readPresenceGate } from '../skills/presence-gate.js';
|
|
3
3
|
/**
|
|
4
4
|
*
|
|
5
5
|
* Background: the consumer-facing CLAUDE.md template (rendered by
|
|
@@ -43,25 +43,23 @@ export const PRESENCE_MARKER_WARNING = [
|
|
|
43
43
|
];
|
|
44
44
|
/**
|
|
45
45
|
* Slice 4.0.11 statusline-sid-scoped-lease C: read the canonical
|
|
46
|
-
* sid-scoped lease projection.
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
46
|
+
* sid-scoped lease projection.
|
|
47
|
+
*
|
|
48
|
+
* Slice 4.0.17 (presence cross-session): the read goes through
|
|
49
|
+
* the SAME resolver the `peaks skill presence` CLI uses — the lease that
|
|
50
|
+
* is eligible across EVERY session tree, not just the bound one. The
|
|
51
|
+
* two readers must not disagree: the CLI says "peaks-code is running"
|
|
52
|
+
* and the hook says "no presence" is not a state a user can act on.
|
|
53
|
+
*
|
|
54
|
+
* Returns the freshest eligible lease (freshest `lastHeartbeat` wins,
|
|
55
|
+
* with a total tie-break), or null when no tree holds one.
|
|
50
56
|
*/
|
|
51
57
|
function readCanonicalLease(projectRoot) {
|
|
52
|
-
const
|
|
53
|
-
if (
|
|
54
|
-
return null;
|
|
55
|
-
const leases = listPresenceLeases(projectRoot, sessionId);
|
|
56
|
-
const inFlight = leases.filter((l) => l.status === 'running' || l.status === 'preparing');
|
|
57
|
-
if (inFlight.length === 0)
|
|
58
|
-
return null;
|
|
59
|
-
// Sort by lastHeartbeat desc, return the freshest.
|
|
60
|
-
inFlight.sort((a, b) => b.lastHeartbeat.localeCompare(a.lastHeartbeat));
|
|
61
|
-
const freshest = inFlight[0];
|
|
62
|
-
if (freshest === undefined)
|
|
58
|
+
const selection = resolvePresenceLease(projectRoot);
|
|
59
|
+
if (selection === null)
|
|
63
60
|
return null;
|
|
64
|
-
|
|
61
|
+
const gate = readPresenceGate(selection.lease.gate);
|
|
62
|
+
return { skill: selection.lease.skill, ...(gate !== undefined ? { gate } : {}) };
|
|
65
63
|
}
|
|
66
64
|
/**
|
|
67
65
|
* Slice 4.0.11 statusline-sid-scoped-lease C: the deprecated
|
|
@@ -100,6 +98,7 @@ export function detectPresenceMarker(input) {
|
|
|
100
98
|
if (presence === null) {
|
|
101
99
|
return { active: false, markerFound: false };
|
|
102
100
|
}
|
|
101
|
+
const gateField = presence.gate !== undefined ? { gate: presence.gate } : {};
|
|
103
102
|
const brokenGraph = tryDetectBrokenGraph(project);
|
|
104
103
|
const markerFound = messageHasMarker(message);
|
|
105
104
|
if (markerFound) {
|
|
@@ -107,16 +106,18 @@ export function detectPresenceMarker(input) {
|
|
|
107
106
|
return {
|
|
108
107
|
active: true,
|
|
109
108
|
skill: presence.skill,
|
|
109
|
+
...gateField,
|
|
110
110
|
markerFound: true,
|
|
111
111
|
warning: `Peaks presence active but graph is broken (${brokenGraph}); run \`peaks workspace reconcile\` to repair.`
|
|
112
112
|
};
|
|
113
113
|
}
|
|
114
|
-
return { active: true, skill: presence.skill, markerFound: true };
|
|
114
|
+
return { active: true, skill: presence.skill, ...gateField, markerFound: true };
|
|
115
115
|
}
|
|
116
116
|
if (brokenGraph !== null) {
|
|
117
117
|
return {
|
|
118
118
|
active: true,
|
|
119
119
|
skill: presence.skill,
|
|
120
|
+
...gateField,
|
|
120
121
|
markerFound: false,
|
|
121
122
|
warning: `Peaks presence active but graph is broken (${brokenGraph}); run \`peaks workspace reconcile\` to repair.`
|
|
122
123
|
};
|
|
@@ -124,6 +125,7 @@ export function detectPresenceMarker(input) {
|
|
|
124
125
|
return {
|
|
125
126
|
active: true,
|
|
126
127
|
skill: presence.skill,
|
|
128
|
+
...gateField,
|
|
127
129
|
markerFound: false,
|
|
128
130
|
warning: PRESENCE_MARKER_WARNING[0]
|
|
129
131
|
};
|
|
@@ -530,20 +530,18 @@ export const CLAUDE_CODE_ADAPTER = {
|
|
|
530
530
|
resolveTranscriptPath: (outerSessionId) => resolveClaudeTranscriptPath(outerSessionId)
|
|
531
531
|
},
|
|
532
532
|
// Slice #011: standards profile. Claude Code reads its constitution at
|
|
533
|
-
// CLAUDE.md
|
|
534
|
-
// the
|
|
535
|
-
//
|
|
536
|
-
//
|
|
537
|
-
//
|
|
538
|
-
// route to the SAME paths, so byte-stability on `peaks standards init` for
|
|
539
|
-
// Claude Code projects is preserved.
|
|
533
|
+
// CLAUDE.md and its module-level rules under .claude/rules/**. The
|
|
534
|
+
// `rootFile` value is what the standards writer branches on: a
|
|
535
|
+
// `CLAUDE.md` root means the writer emits the shared cross-tool body
|
|
536
|
+
// (AGENTS.md) AND a CLAUDE.md pointer that imports it, because Claude
|
|
537
|
+
// Code reads CLAUDE.md, not AGENTS.md, unless it is configured to.
|
|
540
538
|
standardsProfile: {
|
|
541
539
|
rootFile: 'CLAUDE.md',
|
|
542
540
|
rulesDir: '.claude/rules',
|
|
543
541
|
rulesFileGlob: '**/*.md',
|
|
544
542
|
autoLoaded: true,
|
|
545
543
|
format: 'markdown',
|
|
546
|
-
migrationHint: 'Standards live at
|
|
544
|
+
migrationHint: 'Standards live at AGENTS.md (body) + CLAUDE.md (pointer) for Claude Code.'
|
|
547
545
|
},
|
|
548
546
|
// Slice #011: skill install profile. The postinstall script symlinks
|
|
549
547
|
// bundled skills to `~/.claude/skills` and writes output-styles to
|
|
@@ -102,12 +102,28 @@ export const CODEX_ADAPTER = {
|
|
|
102
102
|
const err = new Error('PEAKS_CALLER_NOT_RESOLVED: Codex vendor signal reserved');
|
|
103
103
|
err.code = 'PEAKS_CALLER_NOT_RESOLVED';
|
|
104
104
|
throw err;
|
|
105
|
+
},
|
|
106
|
+
// Standards profile: Codex CLI reads `AGENTS.md` natively — it is one of
|
|
107
|
+
// the tools the AGENTS.md standard (OpenAI's AGENTS.md, now under the
|
|
108
|
+
// Linux Foundation's Agentic AI Foundation) is adopted by. So the shared
|
|
109
|
+
// cross-tool body IS Codex's project-instructions file, and no CLAUDE.md
|
|
110
|
+
// pointer is needed next to it.
|
|
111
|
+
//
|
|
112
|
+
// `rulesDir` stays `null`: where Codex looks for MODULE-level rules is
|
|
113
|
+
// still unverified (see slice #013+ for the real-install dogfood), so the
|
|
114
|
+
// profile claims only the root file.
|
|
115
|
+
standardsProfile: {
|
|
116
|
+
rootFile: 'AGENTS.md',
|
|
117
|
+
rulesDir: null,
|
|
118
|
+
rulesFileGlob: '**/*.md',
|
|
119
|
+
autoLoaded: true,
|
|
120
|
+
format: 'markdown',
|
|
121
|
+
migrationHint: 'Codex reads AGENTS.md directly; no CLAUDE.md pointer is written.'
|
|
105
122
|
}
|
|
106
|
-
// Standards:
|
|
107
|
-
//
|
|
108
|
-
//
|
|
109
|
-
//
|
|
110
|
-
//
|
|
111
|
-
//
|
|
112
|
-
// who want Codex-specific paths must move the files manually.
|
|
123
|
+
// Standards: the ROOT file is verified above (AGENTS.md); the `rulesDir`
|
|
124
|
+
// and `skillInstall` fields remain UNVERIFIED pending slice #013+
|
|
125
|
+
// (Codex real-install dogfood). Until then the postinstall script writes
|
|
126
|
+
// skills + output-styles to the legacy `~/.claude/{skills,output-styles}`
|
|
127
|
+
// paths with a stderr warning. Users who want Codex-specific paths must
|
|
128
|
+
// move the files manually.
|
|
113
129
|
};
|
|
@@ -71,13 +71,29 @@ export const CURSOR_ADAPTER = {
|
|
|
71
71
|
// that can host peaks statusline output, so opt in to the capability.
|
|
72
72
|
statusline: true
|
|
73
73
|
},
|
|
74
|
-
// Standards:
|
|
75
|
-
// the
|
|
76
|
-
//
|
|
77
|
-
//
|
|
78
|
-
//
|
|
79
|
-
//
|
|
80
|
-
//
|
|
74
|
+
// Standards profile: Cursor reads `AGENTS.md` natively — it is one of the
|
|
75
|
+
// tools the AGENTS.md standard (OpenAI's AGENTS.md, now under the Linux
|
|
76
|
+
// Foundation's Agentic AI Foundation) is adopted by. So the shared
|
|
77
|
+
// cross-tool body IS Cursor's project-instructions file, and no CLAUDE.md
|
|
78
|
+
// pointer is needed next to it.
|
|
79
|
+
//
|
|
80
|
+
// `rulesDir` stays `null`: where Cursor looks for MODULE-level rules is
|
|
81
|
+
// still unverified (see slice #012+ for the real-install dogfood), so the
|
|
82
|
+
// profile claims only the root file.
|
|
83
|
+
standardsProfile: {
|
|
84
|
+
rootFile: 'AGENTS.md',
|
|
85
|
+
rulesDir: null,
|
|
86
|
+
rulesFileGlob: '**/*.md',
|
|
87
|
+
autoLoaded: true,
|
|
88
|
+
format: 'markdown',
|
|
89
|
+
migrationHint: 'Cursor reads AGENTS.md directly; no CLAUDE.md pointer is written.'
|
|
90
|
+
},
|
|
91
|
+
// Standards: the ROOT file is verified above (AGENTS.md); the `rulesDir`
|
|
92
|
+
// and `skillInstall` fields remain UNVERIFIED pending slice #012+
|
|
93
|
+
// (Cursor real-install dogfood). Until then the postinstall script writes
|
|
94
|
+
// skills + output-styles to the legacy `~/.claude/{skills,output-styles}`
|
|
95
|
+
// paths with a stderr warning. Users who want Cursor-specific paths must
|
|
96
|
+
// move the files manually.
|
|
81
97
|
// Slice 4.0.8 RD §5: Cursor vendor signal is unverified; reserve-only resolver.
|
|
82
98
|
resolveCallerId: (env) => {
|
|
83
99
|
const e = env ?? process.env;
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
*/
|
|
21
21
|
import { type SkillPresenceMode } from '../skills/skill-presence-service.js';
|
|
22
22
|
import type { State24hSnapshot } from '../24h-mode/state.js';
|
|
23
|
-
import { type
|
|
23
|
+
import { type AutoCompactProfile } from '../code/auto-compact-modes.js';
|
|
24
|
+
import { type AutoCompactProfileSource } from '../code/auto-compact-profile.js';
|
|
24
25
|
export interface ResolvedPresenceMode {
|
|
25
26
|
readonly mode: SkillPresenceMode | null;
|
|
26
27
|
readonly skill: string | null;
|
|
@@ -43,8 +44,14 @@ export interface ModeStatus {
|
|
|
43
44
|
readonly h24State: State24hSnapshot | null;
|
|
44
45
|
/** Job-mode flag from `job-shape.json` (`false` when undecided / unreadable). */
|
|
45
46
|
readonly jobMode: boolean;
|
|
46
|
-
/**
|
|
47
|
-
|
|
47
|
+
/**
|
|
48
|
+
* The resolved auto-compact profile: `standard` or `eager`. It is a PUBLIC
|
|
49
|
+
* choice — the project setting `autoCompactProfile` or an explicit
|
|
50
|
+
* `--mode`, never the 24h state machine.
|
|
51
|
+
*/
|
|
52
|
+
readonly autoCompactProfile: AutoCompactProfile;
|
|
53
|
+
/** Where that profile came from, so the answer is diagnosable. */
|
|
54
|
+
readonly autoCompactProfileSource: AutoCompactProfileSource;
|
|
48
55
|
/** Thresholds backing `autoCompactProfile` (display aid). */
|
|
49
56
|
readonly autoCompactThresholds: {
|
|
50
57
|
readonly autoFire: number;
|
|
@@ -58,35 +65,27 @@ export interface ModeStatus {
|
|
|
58
65
|
*/
|
|
59
66
|
export declare function resolvePresenceMode(projectRoot: string): ResolvedPresenceMode;
|
|
60
67
|
/**
|
|
61
|
-
* Resolve the auto-compact profile: `
|
|
62
|
-
*
|
|
68
|
+
* Resolve the auto-compact profile: `standard` (the v2.13.0 zero-pause
|
|
69
|
+
* contract thresholds) or `eager` (the earlier-firing thresholds).
|
|
63
70
|
*
|
|
64
|
-
*
|
|
71
|
+
* The profile is a PUBLIC choice, resolved in one order:
|
|
65
72
|
*
|
|
66
|
-
* 1.
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
* `WAITING_USER`) — the durable, session-scoped record.
|
|
73
|
+
* 1. an explicit `--mode` on this invocation (one call, one override)
|
|
74
|
+
* 2. the project setting `autoCompactProfile`
|
|
75
|
+
* 3. the default `'standard'`
|
|
70
76
|
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
* stamp does not survive the next skill workflow either. The observed
|
|
79
|
-
* consequence was a `24H_ACTIVE` session resolving to `standard` and
|
|
80
|
-
* auto-compacting LATER than a plain session, the opposite of the
|
|
81
|
-
* documented contract.
|
|
77
|
+
* The 24h mode does NOT take part. It used to: the profile was derived from
|
|
78
|
+
* the presence mode and from the 24h state machine, which made the
|
|
79
|
+
* compaction cadence a private property of one mode — a 24h session
|
|
80
|
+
* compacted earlier than a plain one without anybody asking for it. A
|
|
81
|
+
* project that wants to compact earlier now says so with
|
|
82
|
+
* `peaks preferences set --key autoCompactProfile --value eager`, and
|
|
83
|
+
* nothing changes under it silently.
|
|
82
84
|
*
|
|
83
|
-
* The
|
|
84
|
-
*
|
|
85
|
-
* `WAITING_USER`, and keep it when only the state machine knows.
|
|
86
|
-
* Nothing that resolved to `partial` before resolves to `standard`
|
|
87
|
-
* now; a project with no 24h run is byte-identical to before.
|
|
85
|
+
* The resolution itself lives in `services/code/auto-compact-profile.ts`;
|
|
86
|
+
* this function keeps the name and the arity every existing caller uses.
|
|
88
87
|
*/
|
|
89
|
-
export declare function resolveAutoCompactProfile(projectRoot: string):
|
|
88
|
+
export declare function resolveAutoCompactProfile(projectRoot: string): AutoCompactProfile;
|
|
90
89
|
/**
|
|
91
90
|
* Assemble the full stacked status. `sessionId` defaults to the
|
|
92
91
|
* canonical binding when omitted.
|
|
@@ -26,6 +26,7 @@ import { getCurrentSessionId } from '../skills/skill-presence-service.js';
|
|
|
26
26
|
import { read24hState } from '../24h-mode/store.js';
|
|
27
27
|
import { readJobShapeDecision } from '../code/job-shape-decision.js';
|
|
28
28
|
import { AUTO_COMPACT_THRESHOLDS } from '../code/auto-compact-modes.js';
|
|
29
|
+
import { resolveAutoCompactProfile as resolveProfileSelection } from '../code/auto-compact-profile.js';
|
|
29
30
|
/**
|
|
30
31
|
* Read the active presence mode via the canonical lease projection.
|
|
31
32
|
* Never throws.
|
|
@@ -45,64 +46,39 @@ export function resolvePresenceMode(projectRoot) {
|
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
48
|
/**
|
|
48
|
-
*
|
|
49
|
+
* Resolve the auto-compact profile: `standard` (the v2.13.0 zero-pause
|
|
50
|
+
* contract thresholds) or `eager` (the earlier-firing thresholds).
|
|
49
51
|
*
|
|
50
|
-
*
|
|
51
|
-
* it (the run is still on — the user just has to answer). `BRAINSTORM`
|
|
52
|
-
* / `USER_CONFIRM` precede the run, `HANDOFF` ends it, `IDLE` means it
|
|
53
|
-
* never started.
|
|
54
|
-
*/
|
|
55
|
-
const ENGAGED_24H_STATES = new Set(['24H_ACTIVE', 'WAITING_USER']);
|
|
56
|
-
/**
|
|
57
|
-
* Fail-soft read of the bound session's 24h state machine: `true` when
|
|
58
|
-
* the long run is engaged. Every degradation (no session, missing or
|
|
59
|
-
* malformed snapshot) reads as `false` so a non-24h project is
|
|
60
|
-
* untouched by this signal.
|
|
61
|
-
*/
|
|
62
|
-
function is24hRunEngaged(projectRoot) {
|
|
63
|
-
try {
|
|
64
|
-
const sessionId = getCurrentSessionId(projectRoot);
|
|
65
|
-
if (sessionId === null)
|
|
66
|
-
return false;
|
|
67
|
-
return ENGAGED_24H_STATES.has(read24hState(projectRoot, sessionId).state);
|
|
68
|
-
}
|
|
69
|
-
catch {
|
|
70
|
-
return false;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Resolve the auto-compact profile: `partial` (earlier thresholds for
|
|
75
|
-
* long-run sessions) or `standard`.
|
|
52
|
+
* The profile is a PUBLIC choice, resolved in one order:
|
|
76
53
|
*
|
|
77
|
-
*
|
|
54
|
+
* 1. an explicit `--mode` on this invocation (one call, one override)
|
|
55
|
+
* 2. the project setting `autoCompactProfile`
|
|
56
|
+
* 3. the default `'standard'`
|
|
78
57
|
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
58
|
+
* The 24h mode does NOT take part. It used to: the profile was derived from
|
|
59
|
+
* the presence mode and from the 24h state machine, which made the
|
|
60
|
+
* compaction cadence a private property of one mode — a 24h session
|
|
61
|
+
* compacted earlier than a plain one without anybody asking for it. A
|
|
62
|
+
* project that wants to compact earlier now says so with
|
|
63
|
+
* `peaks preferences set --key autoCompactProfile --value eager`, and
|
|
64
|
+
* nothing changes under it silently.
|
|
83
65
|
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
* presence lease, and `applyAutoEngagePresenceMode` can only stamp
|
|
87
|
-
* leases that are already in flight — entering `24H_ACTIVE` with no
|
|
88
|
-
* in-flight lease fails closed as `{ applied: false, reason:
|
|
89
|
-
* 'no-in-flight-lease' }`. A fresh lease is also written without a
|
|
90
|
-
* mode (`workflow-presence-lifecycle.initWorkflow`), so a successful
|
|
91
|
-
* stamp does not survive the next skill workflow either. The observed
|
|
92
|
-
* consequence was a `24H_ACTIVE` session resolving to `standard` and
|
|
93
|
-
* auto-compacting LATER than a plain session, the opposite of the
|
|
94
|
-
* documented contract.
|
|
95
|
-
*
|
|
96
|
-
* The union is a superset of both the pre-2026-09-09 mapping (state
|
|
97
|
-
* mode): keep partial while the mode says `24h` even in
|
|
98
|
-
* `WAITING_USER`, and keep it when only the state machine knows.
|
|
99
|
-
* Nothing that resolved to `partial` before resolves to `standard`
|
|
100
|
-
* now; a project with no 24h run is byte-identical to before.
|
|
66
|
+
* The resolution itself lives in `services/code/auto-compact-profile.ts`;
|
|
67
|
+
* this function keeps the name and the arity every existing caller uses.
|
|
101
68
|
*/
|
|
102
69
|
export function resolveAutoCompactProfile(projectRoot) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
70
|
+
return resolveProfile(projectRoot).profile;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* The single place this module resolves the auto-compact profile.
|
|
74
|
+
*
|
|
75
|
+
* Both public entry points — `resolveAutoCompactProfile` and
|
|
76
|
+
* `resolveModeStatus` — go through it, so the profile the status command
|
|
77
|
+
* reports and the profile the services apply come from ONE call and cannot
|
|
78
|
+
* disagree.
|
|
79
|
+
*/
|
|
80
|
+
function resolveProfile(projectRoot) {
|
|
81
|
+
return resolveProfileSelection({ projectRoot });
|
|
106
82
|
}
|
|
107
83
|
/**
|
|
108
84
|
* Assemble the full stacked status. `sessionId` defaults to the
|
|
@@ -139,12 +115,11 @@ export function resolveModeStatus(input) {
|
|
|
139
115
|
jobMode = false;
|
|
140
116
|
}
|
|
141
117
|
}
|
|
142
|
-
// Delegate rather than re-derive
|
|
143
|
-
//
|
|
144
|
-
// copy of the
|
|
145
|
-
//
|
|
146
|
-
|
|
147
|
-
const autoCompactProfile = resolveAutoCompactProfile(projectRoot);
|
|
118
|
+
// Delegate rather than re-derive the profile: the resolution order lives
|
|
119
|
+
// in one place (`services/code/auto-compact-profile.ts`), and a local
|
|
120
|
+
// copy of the rule would make `peaks code mode status` advertise a
|
|
121
|
+
// different profile than the one `peaks code auto-compact` applies.
|
|
122
|
+
const profile = resolveProfile(projectRoot);
|
|
148
123
|
return {
|
|
149
124
|
mode: presence.mode,
|
|
150
125
|
skill: presence.skill,
|
|
@@ -152,7 +127,8 @@ export function resolveModeStatus(input) {
|
|
|
152
127
|
is24h,
|
|
153
128
|
h24State,
|
|
154
129
|
jobMode,
|
|
155
|
-
autoCompactProfile,
|
|
156
|
-
|
|
130
|
+
autoCompactProfile: profile.profile,
|
|
131
|
+
autoCompactProfileSource: profile.source,
|
|
132
|
+
autoCompactThresholds: AUTO_COMPACT_THRESHOLDS[profile.profile]
|
|
157
133
|
};
|
|
158
134
|
}
|
|
@@ -21,6 +21,26 @@ export type UaPromptDecision = 'unset' | 'skip-this-session' | 'skip-forever';
|
|
|
21
21
|
* - 'lax' — always downgrade to previous level (faster, riskier)
|
|
22
22
|
*/
|
|
23
23
|
export type ClassifyConservatism = 'default' | 'strict' | 'lax';
|
|
24
|
+
/**
|
|
25
|
+
* The auto-compact profile a project can pin.
|
|
26
|
+
*
|
|
27
|
+
* PUBLIC: any project, in any mode, can choose the compaction cadence. The
|
|
28
|
+
* profile is a THRESHOLD choice — `eager` fires earlier than `standard` —
|
|
29
|
+
* and it is set with
|
|
30
|
+
* `peaks preferences set --key autoCompactProfile --value eager`.
|
|
31
|
+
*
|
|
32
|
+
* The value set is closed on purpose: an unknown value is rejected at write
|
|
33
|
+
* time with the legal ones named, rather than stored and read back as
|
|
34
|
+
* something else.
|
|
35
|
+
*/
|
|
36
|
+
export type AutoCompactProfilePreference = 'standard' | 'eager';
|
|
37
|
+
/** The legal `autoCompactProfile` values, in the order the error message lists them. */
|
|
38
|
+
export declare const AUTO_COMPACT_PROFILE_VALUES: readonly AutoCompactProfilePreference[];
|
|
39
|
+
/**
|
|
40
|
+
* The `isFanoutMode` paradigm for the auto-compact profile: one guard, one
|
|
41
|
+
* closed set, so a caller never has to re-spell the legal values.
|
|
42
|
+
*/
|
|
43
|
+
export declare function isAutoCompactProfile(value: unknown): value is AutoCompactProfilePreference;
|
|
24
44
|
export interface ClassifyRuleOverrides {
|
|
25
45
|
/** File count threshold above which a task is promoted to 'feature' */
|
|
26
46
|
readonly feature_threshold_files?: number;
|
|
@@ -86,6 +106,16 @@ export interface ProjectPreferences {
|
|
|
86
106
|
readonly classifyConservatism: ClassifyConservatism;
|
|
87
107
|
readonly classifyRules: ClassifyRuleOverrides;
|
|
88
108
|
readonly swarmSpeculative: SwarmSpeculativePreferences;
|
|
109
|
+
/**
|
|
110
|
+
* The auto-compact profile this project pins: `standard` (the v2.13.0
|
|
111
|
+
* zero-pause contract thresholds) or `eager` (fires earlier).
|
|
112
|
+
*
|
|
113
|
+
* OPTIONAL on purpose. The field is additive, so an existing
|
|
114
|
+
* `.peaks/preferences.json` that does not carry it keeps loading — the
|
|
115
|
+
* schema version is unchanged, and a file without the key resolves to the
|
|
116
|
+
* default profile rather than to a load error.
|
|
117
|
+
*/
|
|
118
|
+
readonly autoCompactProfile?: AutoCompactProfilePreference;
|
|
89
119
|
/** Loop Autonomous (L4 14.5) toggle. Default: false — never auto-enable. */
|
|
90
120
|
readonly loopAutonomousEnabled: boolean;
|
|
91
121
|
/**
|
|
@@ -5,6 +5,18 @@
|
|
|
5
5
|
*
|
|
6
6
|
*/
|
|
7
7
|
export const PREFERENCES_SCHEMA_VERSION = '2.0.0';
|
|
8
|
+
/** The legal `autoCompactProfile` values, in the order the error message lists them. */
|
|
9
|
+
export const AUTO_COMPACT_PROFILE_VALUES = [
|
|
10
|
+
'standard',
|
|
11
|
+
'eager'
|
|
12
|
+
];
|
|
13
|
+
/**
|
|
14
|
+
* The `isFanoutMode` paradigm for the auto-compact profile: one guard, one
|
|
15
|
+
* closed set, so a caller never has to re-spell the legal values.
|
|
16
|
+
*/
|
|
17
|
+
export function isAutoCompactProfile(value) {
|
|
18
|
+
return (typeof value === 'string' && AUTO_COMPACT_PROFILE_VALUES.includes(value));
|
|
19
|
+
}
|
|
8
20
|
export const FANOUT_MODES = ['fan-out'];
|
|
9
21
|
/**
|
|
10
22
|
* narrowed the closed set from `['fan-out','serial']` to `['fan-out']`
|
|
@@ -26,6 +38,7 @@ export const DEFAULT_PREFERENCES = {
|
|
|
26
38
|
feature_threshold_lines: 100,
|
|
27
39
|
runtime_clean_grace_hours: 24
|
|
28
40
|
},
|
|
41
|
+
autoCompactProfile: 'standard',
|
|
29
42
|
swarmSpeculative: {
|
|
30
43
|
enabled: true,
|
|
31
44
|
maxConcurrent: 3,
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
export type CriteriaSource = 'declared' | 'section' | 'both';
|
|
1
2
|
export type AcceptanceItem = {
|
|
2
3
|
id: string;
|
|
3
4
|
text: string;
|
|
4
5
|
line: number;
|
|
6
|
+
source: CriteriaSource;
|
|
5
7
|
};
|
|
6
8
|
export type TestCase = {
|
|
7
9
|
title: string;
|
|
@@ -13,6 +15,18 @@ export type CoverageEntry = {
|
|
|
13
15
|
acceptanceText: string;
|
|
14
16
|
testCases: string[];
|
|
15
17
|
};
|
|
18
|
+
export type AcceptanceCoverageOptions = {
|
|
19
|
+
projectRoot: string;
|
|
20
|
+
requestId: string;
|
|
21
|
+
sessionId?: string;
|
|
22
|
+
};
|
|
23
|
+
export type AcceptanceCoverageError = {
|
|
24
|
+
kind: 'prd-not-found';
|
|
25
|
+
message: string;
|
|
26
|
+
} | {
|
|
27
|
+
kind: 'test-cases-not-found';
|
|
28
|
+
expectedPath: string;
|
|
29
|
+
};
|
|
16
30
|
export type AcceptanceCoverageReport = {
|
|
17
31
|
ok: boolean;
|
|
18
32
|
prdPath: string;
|
|
@@ -27,16 +41,5 @@ export type AcceptanceCoverageReport = {
|
|
|
27
41
|
reference: string;
|
|
28
42
|
}>;
|
|
29
43
|
};
|
|
30
|
-
export type AcceptanceCoverageOptions = {
|
|
31
|
-
projectRoot: string;
|
|
32
|
-
requestId: string;
|
|
33
|
-
sessionId?: string;
|
|
34
|
-
};
|
|
35
|
-
export type AcceptanceCoverageError = {
|
|
36
|
-
kind: 'prd-not-found';
|
|
37
|
-
} | {
|
|
38
|
-
kind: 'test-cases-not-found';
|
|
39
|
-
expectedPath: string;
|
|
40
|
-
};
|
|
41
44
|
export declare function getAcceptanceCoverage(options: AcceptanceCoverageOptions): Promise<AcceptanceCoverageReport | AcceptanceCoverageError>;
|
|
42
45
|
export declare function isAcceptanceCoverageError(value: AcceptanceCoverageReport | AcceptanceCoverageError): value is AcceptanceCoverageError;
|