greprag 5.49.16 → 5.51.0
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/commands/doc-pointer-reminder.d.ts +18 -0
- package/dist/commands/doc-pointer-reminder.js +41 -0
- package/dist/commands/doc-pointer-reminder.js.map +1 -0
- package/dist/commands/enrichment-health-reminder.d.ts +23 -0
- package/dist/commands/enrichment-health-reminder.js +39 -0
- package/dist/commands/enrichment-health-reminder.js.map +1 -0
- package/dist/commands/init.js +20 -0
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/load.d.ts +8 -5
- package/dist/commands/load.js +89 -10
- package/dist/commands/load.js.map +1 -1
- package/dist/commands/memory.js +40 -12
- package/dist/commands/memory.js.map +1 -1
- package/dist/commands/opencode-interrupt.d.ts +5 -0
- package/dist/commands/opencode-interrupt.js +8 -2
- package/dist/commands/opencode-interrupt.js.map +1 -1
- package/dist/commands/opencode-relay.js +1 -1
- package/dist/commands/opencode-relay.js.map +1 -1
- package/dist/commands/procedure.d.ts +15 -0
- package/dist/commands/procedure.js +167 -0
- package/dist/commands/procedure.js.map +1 -0
- package/dist/commands/reminder-registry.js +8 -0
- package/dist/commands/reminder-registry.js.map +1 -1
- package/dist/commands/reminder-types.d.ts +35 -0
- package/dist/commands/skill-gain-reminder.d.ts +17 -0
- package/dist/commands/skill-gain-reminder.js +32 -0
- package/dist/commands/skill-gain-reminder.js.map +1 -0
- package/dist/commands/skill-mirror-reminder.d.ts +15 -0
- package/dist/commands/skill-mirror-reminder.js +33 -0
- package/dist/commands/skill-mirror-reminder.js.map +1 -0
- package/dist/commands/skillgain.d.ts +12 -0
- package/dist/commands/skillgain.js +109 -0
- package/dist/commands/skillgain.js.map +1 -0
- package/dist/hook.js +386 -2
- package/dist/hook.js.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/opencode-plugin.bundle.js +92 -1
- package/dist/procedure-watch.d.ts +153 -0
- package/dist/procedure-watch.js +349 -0
- package/dist/procedure-watch.js.map +1 -0
- package/dist/procedure.d.ts +88 -0
- package/dist/procedure.js +269 -0
- package/dist/procedure.js.map +1 -0
- package/dist/skill-landing.d.ts +88 -0
- package/dist/skill-landing.js +220 -0
- package/dist/skill-landing.js.map +1 -0
- package/dist/skill-mirror-client.d.ts +37 -0
- package/dist/skill-mirror-client.js +172 -0
- package/dist/skill-mirror-client.js.map +1 -0
- package/package.json +1 -1
- package/skill/commander/SKILL.md +2 -2
- package/skill/greprag/SKILL.md +1 -1
- package/skill/greprag/docs/inbox-watch.md +5 -5
- package/skill/templates/chip-leader-opencode.md +98 -0
|
@@ -1833,6 +1833,28 @@ var corpusAnnounceModule = {
|
|
|
1833
1833
|
reminder: () => null
|
|
1834
1834
|
};
|
|
1835
1835
|
|
|
1836
|
+
// src/commands/doc-pointer-reminder.ts
|
|
1837
|
+
var ANNOUNCE_CAP = 20;
|
|
1838
|
+
function buildDocPointerAnnounce(pointers) {
|
|
1839
|
+
if (!pointers || pointers.length === 0)
|
|
1840
|
+
return null;
|
|
1841
|
+
const shown = pointers.slice(0, ANNOUNCE_CAP);
|
|
1842
|
+
const more = pointers.length > shown.length ? ` (+${pointers.length - shown.length} more registered)` : "";
|
|
1843
|
+
return [
|
|
1844
|
+
`[greprag docs \u2014 core documents on file for this project (auto-registered)${more}:]`,
|
|
1845
|
+
...shown.map((p) => `\u2022 ${p.path} \u2014 ${p.hook}`),
|
|
1846
|
+
"One of these covers your topic? READ IT before re-deriving what it already answers."
|
|
1847
|
+
].join("\n");
|
|
1848
|
+
}
|
|
1849
|
+
var docPointerAnnounceModule = {
|
|
1850
|
+
id: "doc-pointer-announce",
|
|
1851
|
+
detect: (_env) => ({ tier: "silent" }),
|
|
1852
|
+
// announce-only, never a per-turn nag
|
|
1853
|
+
announce: (env) => buildDocPointerAnnounce(env.docPointers),
|
|
1854
|
+
reannounceOnCompact: false,
|
|
1855
|
+
reminder: () => null
|
|
1856
|
+
};
|
|
1857
|
+
|
|
1836
1858
|
// src/commands/setup-reminder.ts
|
|
1837
1859
|
function setupDetect(env) {
|
|
1838
1860
|
return env.setupWarning ? { tier: "nudge" } : { tier: "silent" };
|
|
@@ -2018,15 +2040,83 @@ var versionUpgradeModule = {
|
|
|
2018
2040
|
reminder: () => null
|
|
2019
2041
|
};
|
|
2020
2042
|
|
|
2043
|
+
// src/commands/enrichment-health-reminder.ts
|
|
2044
|
+
function buildEnrichmentHealthAnnounce(down) {
|
|
2045
|
+
if (!down || !down.errorClass)
|
|
2046
|
+
return null;
|
|
2047
|
+
const detail = down.detail ? ` (${down.detail})` : "";
|
|
2048
|
+
const action = down.actionHint ? ` OPERATOR ACTION: ${down.actionHint}.` : "";
|
|
2049
|
+
return [
|
|
2050
|
+
`[greprag health \u2014 \u26A0 WRITE-SIDE ENRICHMENT IS DOWN: Gemini ${down.errorClass} failure${detail}.]`,
|
|
2051
|
+
`Memory rollups, judges, and capture enrichment are NOT running \u2014 raw turns still store, but recaps and all flash-lite reflexes silently stall until this is fixed.${action} Surface this to the operator THIS session; it does not fix itself.`
|
|
2052
|
+
].join("\n");
|
|
2053
|
+
}
|
|
2054
|
+
var enrichmentHealthModule = {
|
|
2055
|
+
id: "enrichment-health",
|
|
2056
|
+
detect: (_env) => ({ tier: "silent" }),
|
|
2057
|
+
// announce-only
|
|
2058
|
+
announce: (env) => buildEnrichmentHealthAnnounce(env.enrichmentDown),
|
|
2059
|
+
reminder: () => null
|
|
2060
|
+
};
|
|
2061
|
+
|
|
2062
|
+
// src/commands/skill-gain-reminder.ts
|
|
2063
|
+
function buildSkillGainAnnounce(gains) {
|
|
2064
|
+
if (!gains || gains.landed.length === 0)
|
|
2065
|
+
return null;
|
|
2066
|
+
return [
|
|
2067
|
+
"[greprag skills \u2014 learned from past runs (Skill Learning Loop):]",
|
|
2068
|
+
...gains.landed.map((l) => `\u2699 ${l.skill} packed a briefcase: ${l.oneLiner}`),
|
|
2069
|
+
"Each lands as a fuse line + focused doc inside the skill and SELF-APPLIES on its next invocation (the agent folds it in, deletes the fuse). Nothing to do here. Undo one: `greprag skillgain reject <id>`."
|
|
2070
|
+
].join("\n");
|
|
2071
|
+
}
|
|
2072
|
+
var skillGainAnnounceModule = {
|
|
2073
|
+
id: "skill-gain-announce",
|
|
2074
|
+
detect: (_env) => ({ tier: "silent" }),
|
|
2075
|
+
// announce-only
|
|
2076
|
+
announce: (env) => buildSkillGainAnnounce(env.skillGains),
|
|
2077
|
+
reannounceOnCompact: false,
|
|
2078
|
+
reminder: () => null
|
|
2079
|
+
};
|
|
2080
|
+
|
|
2081
|
+
// src/commands/skill-mirror-reminder.ts
|
|
2082
|
+
function buildSkillMirrorAnnounce(m) {
|
|
2083
|
+
if (!m || m.count <= 0)
|
|
2084
|
+
return null;
|
|
2085
|
+
const sample = m.names.slice(0, 4).join(", ");
|
|
2086
|
+
const more = m.count > 4 ? ", \u2026" : "";
|
|
2087
|
+
return [
|
|
2088
|
+
`[greprag skills \u2014 ${m.count} of your skills travel with the harness (auto-mirrored from use, always fresh): ${sample}${more}.]`,
|
|
2089
|
+
"Any machine or harness with the greprag CLI can use them \u2014 `greprag load` to browse, `greprag load <skill>` to read one inline. No ~/.claude/skills needed."
|
|
2090
|
+
].join("\n");
|
|
2091
|
+
}
|
|
2092
|
+
var skillMirrorAnnounceModule = {
|
|
2093
|
+
id: "skill-mirror-announce",
|
|
2094
|
+
source: "prompt",
|
|
2095
|
+
dependsOn: ["load-primer"],
|
|
2096
|
+
// references `greprag load` — the primer establishes it
|
|
2097
|
+
detect: (_env) => ({ tier: "silent" }),
|
|
2098
|
+
// announce-only
|
|
2099
|
+
announce: (env) => buildSkillMirrorAnnounce(env.mirroredSkills),
|
|
2100
|
+
reminder: () => null
|
|
2101
|
+
};
|
|
2102
|
+
|
|
2021
2103
|
// src/commands/reminder-registry.ts
|
|
2022
2104
|
var REGISTRY = [
|
|
2023
2105
|
inboxPrimerModule,
|
|
2024
2106
|
loadPrimerModule,
|
|
2025
2107
|
chipSpawnPointerModule,
|
|
2026
2108
|
corpusAnnounceModule,
|
|
2109
|
+
docPointerAnnounceModule,
|
|
2110
|
+
// announce-only "core documents" list (docs/doc-pointer-system.md)
|
|
2111
|
+
skillGainAnnounceModule,
|
|
2112
|
+
// announce-only skill-gain landings (docs/skill-learning-loop.md)
|
|
2113
|
+
skillMirrorAnnounceModule,
|
|
2114
|
+
// one-line Tier-3 pointer: your skills travel via greprag load (docs/load-system.md)
|
|
2027
2115
|
setupWarningModule,
|
|
2028
2116
|
versionUpgradeModule,
|
|
2029
2117
|
// Deficiency-gated announce — silent unless a newer release exists
|
|
2118
|
+
enrichmentHealthModule,
|
|
2119
|
+
// Deficiency-gated announce — silent unless the Gemini probe fails (fix c2eb8777)
|
|
2030
2120
|
assistantDoctrineModule,
|
|
2031
2121
|
memoryPrimerModule,
|
|
2032
2122
|
watcherArmModule,
|
|
@@ -2119,8 +2209,9 @@ function buildOpenCodeEnv(params) {
|
|
|
2119
2209
|
updateAvailable: params.updateAvailable ?? null
|
|
2120
2210
|
};
|
|
2121
2211
|
}
|
|
2212
|
+
var OPENCODE_CHIP_BOOTLOADER_POINTER = '[greprag chips \u2014 agent coordination is built in (messaging plumbing in the inbox primer).]\n\u2022 Delegating a component of a plan to an isolated sub-session (a "chip") for focused, efficient work? \u2192 run `greprag load chip-bootloader` for the copyable bootloader template (Block 1 setup + Block 2 report-back).';
|
|
2122
2213
|
function getOpenCodeAnnounces(env) {
|
|
2123
|
-
return collectAnnounces(env, opencodeRegistry);
|
|
2214
|
+
return [...collectAnnounces(env, opencodeRegistry), OPENCODE_CHIP_BOOTLOADER_POINTER];
|
|
2124
2215
|
}
|
|
2125
2216
|
function getOpenCodeReminders(env) {
|
|
2126
2217
|
return collectReminders(env, opencodeRegistry);
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/** Procedure watch — the Procedure System's span-watch state + close logic
|
|
2
|
+
* (docs/procedure-system.md §V1 LEARN-leg build spec, component 1).
|
|
3
|
+
*
|
|
4
|
+
* The unit of learning is a WATCH WINDOW: the UserPromptSubmit trigger opens
|
|
5
|
+
* it, the Stop hook observes each turn inside it, negative continuity closes
|
|
6
|
+
* it ("is the <verb> procedure still live?" — cessation, never completion).
|
|
7
|
+
* One JSON file beside the procedure store; ONE active watch at a time (v1).
|
|
8
|
+
*
|
|
9
|
+
* PURE open/advance/close (openWatch / buildTurnDigest / advanceWatch /
|
|
10
|
+
* liveSpan / applyDistillTransition) is split from the file I/O (read/write/
|
|
11
|
+
* clear) — the procedure.ts shape — so hysteresis, the watchdog, and the
|
|
12
|
+
* transition table are unit-testable without a hook.
|
|
13
|
+
*
|
|
14
|
+
* Endpoint-detection invariants (§Endpoint detection):
|
|
15
|
+
* - hysteresis: one OFF turn never closes (a tangent can't truncate the
|
|
16
|
+
* span); close at offStreak ≥ 2.
|
|
17
|
+
* - the endpoint stamps at the LAST LIVE turn, not the first dead one —
|
|
18
|
+
* span = observations[0 .. lastLiveTurn].
|
|
19
|
+
* - judge unreachable → offStreak untouched (the watch extends); the
|
|
20
|
+
* max-turn watchdog is the backstop, never the primary mechanism. */
|
|
21
|
+
import { type Procedure, type ProcedureStore, type ProcedureMatch } from './procedure';
|
|
22
|
+
export type WatchPhase = 'LEARN' | 'REPLAY';
|
|
23
|
+
/** One observed turn, compact (≤1.5K serialized — the digest cap bounds both
|
|
24
|
+
* the per-turn observe POST and the close-time distill call). */
|
|
25
|
+
export interface ProcedureTurnDigest {
|
|
26
|
+
/** 1-based turn index within the watch. */
|
|
27
|
+
turn: number;
|
|
28
|
+
/** User-prompt head. */
|
|
29
|
+
user: string;
|
|
30
|
+
/** Bash commands the turn ran, each with a short output-tail exit hint. */
|
|
31
|
+
commands: string[];
|
|
32
|
+
/** Files the turn touched (project-relative where possible). */
|
|
33
|
+
files: string[];
|
|
34
|
+
/** Turn status: completed | interrupted | errored. */
|
|
35
|
+
status: string;
|
|
36
|
+
}
|
|
37
|
+
export interface ProcedureWatch {
|
|
38
|
+
verb: string;
|
|
39
|
+
phase: WatchPhase;
|
|
40
|
+
openedAt: string;
|
|
41
|
+
/** Turns observed so far (== observations.length). */
|
|
42
|
+
turnCount: number;
|
|
43
|
+
observations: ProcedureTurnDigest[];
|
|
44
|
+
/** The last turn the judge called LIVE — where the endpoint stamps.
|
|
45
|
+
* 0 = never live. */
|
|
46
|
+
lastLiveTurn: number;
|
|
47
|
+
/** Consecutive not-live turns. Close at ≥ WATCH_OFF_STREAK_CLOSE. */
|
|
48
|
+
offStreak: number;
|
|
49
|
+
}
|
|
50
|
+
/** Watchdog backstop: a watch never observes past this many turns — the next
|
|
51
|
+
* turn aborts it (log a fix-queue smell, never distill). */
|
|
52
|
+
export declare const WATCH_MAX_TURNS = 15;
|
|
53
|
+
/** Hysteresis: consecutive OFF turns required to close (a one-turn tangent
|
|
54
|
+
* can't truncate the span). */
|
|
55
|
+
export declare const WATCH_OFF_STREAK_CLOSE = 2;
|
|
56
|
+
/** Per-turn digest cap, serialized. */
|
|
57
|
+
export declare const DIGEST_TOTAL_CAP = 1500;
|
|
58
|
+
/** User-prompt head cap inside the digest. */
|
|
59
|
+
export declare const DIGEST_USER_CAP = 300;
|
|
60
|
+
/** The Tier-1 trigger set for OPENING A LEARN WATCH, independent of the store
|
|
61
|
+
* (docs/procedure-system.md §Tier 1: deploy / push / release / ship / build /
|
|
62
|
+
* test — `ship` phrases map to the `release` verb, matching GIT_SEED_SET).
|
|
63
|
+
* `build` + `test` have no seed: the clean LEARN proof case. `push` is
|
|
64
|
+
* destructive — it sits here only so the opener can NAME the refusal; a LEARN
|
|
65
|
+
* watch never opens for it (the seed is the canon even when stale). Entries
|
|
66
|
+
* are Procedure-shaped (steps empty — vocabulary, not recipes) so the same
|
|
67
|
+
* matcher + intent guard run over them. */
|
|
68
|
+
export declare const TIER1_LEARN_TRIGGERS: Procedure[];
|
|
69
|
+
/** Match a prompt against the Tier-1 LEARN vocabulary (same matcher + intent
|
|
70
|
+
* guard as the store path). PURE. */
|
|
71
|
+
export declare function matchLearnTrigger(prompt: string): ProcedureMatch | null;
|
|
72
|
+
/** Is this verb destructive — per the store's procedure OR the Tier-1
|
|
73
|
+
* vocabulary? Destructive verbs are never learn-writable and a LEARN watch
|
|
74
|
+
* never opens for them. PURE. */
|
|
75
|
+
export declare function isDestructiveVerb(verb: string, store: ProcedureStore): boolean;
|
|
76
|
+
/** The trigger phrases a LEARNED procedure should match on next time — the
|
|
77
|
+
* store procedure's own triggers when it exists (stale re-learn keeps them),
|
|
78
|
+
* else the Tier-1 vocabulary's, else the bare verb. PURE. */
|
|
79
|
+
export declare function learnTriggersForVerb(verb: string, store: ProcedureStore): string[];
|
|
80
|
+
export declare function openWatch(verb: string, phase: WatchPhase, openedAt?: string): ProcedureWatch;
|
|
81
|
+
/** What the digest builder needs from the parsed turn — a structural subset of
|
|
82
|
+
* the hook's ParsedTurn (Bash briefs carry the command; _output the stdout). */
|
|
83
|
+
export interface DigestSourceTurn {
|
|
84
|
+
userPrompt: string;
|
|
85
|
+
toolCalls: Array<{
|
|
86
|
+
name: string;
|
|
87
|
+
brief?: string;
|
|
88
|
+
_output?: string;
|
|
89
|
+
}>;
|
|
90
|
+
filesTouched: string[];
|
|
91
|
+
status: string;
|
|
92
|
+
}
|
|
93
|
+
/** Build one compact TurnDigest: user-prompt head ≤300 chars, Bash commands
|
|
94
|
+
* (+ a short output-tail exit hint) from toolCalls, files touched, turn
|
|
95
|
+
* status — ≤1.5K serialized total. PURE — unit-tested. */
|
|
96
|
+
export declare function buildTurnDigest(turn: DigestSourceTurn, turnNumber: number): ProcedureTurnDigest;
|
|
97
|
+
export type WatchDisposition = 'continue' | 'close' | 'watchdog';
|
|
98
|
+
/** Would observing one more turn cross the watchdog? The caller checks this
|
|
99
|
+
* BEFORE the judge call so the aborting turn costs nothing. PURE. */
|
|
100
|
+
export declare function willExceedWatchdog(watch: ProcedureWatch): boolean;
|
|
101
|
+
/** Advance the watch by one observed turn. Appends the digest, then applies
|
|
102
|
+
* the continuity verdict per §Endpoint detection:
|
|
103
|
+
* live=true → stamp lastLiveTurn, reset offStreak
|
|
104
|
+
* live=false → offStreak++
|
|
105
|
+
* live=null → judge unreachable: offStreak UNTOUCHED (the watch extends;
|
|
106
|
+
* the watchdog is the backstop)
|
|
107
|
+
* Dispositions: 'watchdog' when the turn count exceeds the cap (defensive —
|
|
108
|
+
* callers should pre-check willExceedWatchdog), 'close' at
|
|
109
|
+
* offStreak ≥ WATCH_OFF_STREAK_CLOSE, else 'continue'. PURE — unit-tested. */
|
|
110
|
+
export declare function advanceWatch(watch: ProcedureWatch, digest: ProcedureTurnDigest, live: boolean | null): {
|
|
111
|
+
watch: ProcedureWatch;
|
|
112
|
+
disposition: WatchDisposition;
|
|
113
|
+
};
|
|
114
|
+
/** The live span — the endpoint stamps at the last LIVE turn, so trailing
|
|
115
|
+
* not-live turns never enter the artifact. Span = observations[0 ..
|
|
116
|
+
* lastLiveTurn]. Empty when the watch was never live (nothing to distill —
|
|
117
|
+
* never register garbage). PURE. */
|
|
118
|
+
export declare function liveSpan(watch: ProcedureWatch): ProcedureTurnDigest[];
|
|
119
|
+
export interface DistilledFields {
|
|
120
|
+
steps: string;
|
|
121
|
+
endpoint: string;
|
|
122
|
+
caveats?: string;
|
|
123
|
+
}
|
|
124
|
+
export type TransitionAction = 'learned' | 'confirmed' | 'relearned' | 'discarded';
|
|
125
|
+
/** Apply the spec's transition table (component 6) to the procedure store:
|
|
126
|
+
*
|
|
127
|
+
* LEARN | any (span ended) | status=learned, steps/endpoint/caveats from distill
|
|
128
|
+
* REPLAY | clean | status=confirmed (steps untouched)
|
|
129
|
+
* REPLAY | floundered | re-learn in place: distill the failed span → learned
|
|
130
|
+
* any | distill unreadable / judge down | no write; watch discarded
|
|
131
|
+
*
|
|
132
|
+
* Each row gates on the fields it actually consumes: LEARN and
|
|
133
|
+
* REPLAY-floundered need the distilled fields; REPLAY-clean needs the
|
|
134
|
+
* outcome. A missing required field = the unreadable/judge-down row → no
|
|
135
|
+
* write. All writes flow through upsertProcedure, whose destructive guard
|
|
136
|
+
* already refuses to overwrite a `push` seed (never weakened here).
|
|
137
|
+
* PURE — unit-tested. Returns the (possibly unchanged) store + what happened. */
|
|
138
|
+
export declare function applyDistillTransition(store: ProcedureStore, watch: Pick<ProcedureWatch, 'verb' | 'phase'>, outcome: 'clean' | 'floundered' | null, distilled: DistilledFields | null, fallbackTriggers: string[]): {
|
|
139
|
+
store: ProcedureStore;
|
|
140
|
+
action: TransitionAction;
|
|
141
|
+
};
|
|
142
|
+
export declare function procedureWatchPath(projectId: string): string;
|
|
143
|
+
/** The Stop-hook observer's zero-cost gate: no file → no watch → no work. */
|
|
144
|
+
export declare function hasProcedureWatch(projectId: string): boolean;
|
|
145
|
+
/** Read the active watch. Null on any miss/corruption — fail-open; the caller
|
|
146
|
+
* clears the file so a corrupt watch can't wedge the observer. */
|
|
147
|
+
export declare function readProcedureWatch(projectId: string): ProcedureWatch | null;
|
|
148
|
+
export declare function writeProcedureWatch(projectId: string, watch: ProcedureWatch): void;
|
|
149
|
+
export declare function clearProcedureWatch(projectId: string): void;
|
|
150
|
+
/** Open a watch iff none is active (ONE active watch at a time, v1 — an
|
|
151
|
+
* in-flight watch is never replaced by a new trigger). Returns whether a
|
|
152
|
+
* watch was opened. */
|
|
153
|
+
export declare function openWatchIfIdle(projectId: string, verb: string, phase: WatchPhase): boolean;
|
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/** Procedure watch — the Procedure System's span-watch state + close logic
|
|
3
|
+
* (docs/procedure-system.md §V1 LEARN-leg build spec, component 1).
|
|
4
|
+
*
|
|
5
|
+
* The unit of learning is a WATCH WINDOW: the UserPromptSubmit trigger opens
|
|
6
|
+
* it, the Stop hook observes each turn inside it, negative continuity closes
|
|
7
|
+
* it ("is the <verb> procedure still live?" — cessation, never completion).
|
|
8
|
+
* One JSON file beside the procedure store; ONE active watch at a time (v1).
|
|
9
|
+
*
|
|
10
|
+
* PURE open/advance/close (openWatch / buildTurnDigest / advanceWatch /
|
|
11
|
+
* liveSpan / applyDistillTransition) is split from the file I/O (read/write/
|
|
12
|
+
* clear) — the procedure.ts shape — so hysteresis, the watchdog, and the
|
|
13
|
+
* transition table are unit-testable without a hook.
|
|
14
|
+
*
|
|
15
|
+
* Endpoint-detection invariants (§Endpoint detection):
|
|
16
|
+
* - hysteresis: one OFF turn never closes (a tangent can't truncate the
|
|
17
|
+
* span); close at offStreak ≥ 2.
|
|
18
|
+
* - the endpoint stamps at the LAST LIVE turn, not the first dead one —
|
|
19
|
+
* span = observations[0 .. lastLiveTurn].
|
|
20
|
+
* - judge unreachable → offStreak untouched (the watch extends); the
|
|
21
|
+
* max-turn watchdog is the backstop, never the primary mechanism. */
|
|
22
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
23
|
+
if (k2 === undefined) k2 = k;
|
|
24
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
25
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
26
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
27
|
+
}
|
|
28
|
+
Object.defineProperty(o, k2, desc);
|
|
29
|
+
}) : (function(o, m, k, k2) {
|
|
30
|
+
if (k2 === undefined) k2 = k;
|
|
31
|
+
o[k2] = m[k];
|
|
32
|
+
}));
|
|
33
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
34
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
35
|
+
}) : function(o, v) {
|
|
36
|
+
o["default"] = v;
|
|
37
|
+
});
|
|
38
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
39
|
+
var ownKeys = function(o) {
|
|
40
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
41
|
+
var ar = [];
|
|
42
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
43
|
+
return ar;
|
|
44
|
+
};
|
|
45
|
+
return ownKeys(o);
|
|
46
|
+
};
|
|
47
|
+
return function (mod) {
|
|
48
|
+
if (mod && mod.__esModule) return mod;
|
|
49
|
+
var result = {};
|
|
50
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
51
|
+
__setModuleDefault(result, mod);
|
|
52
|
+
return result;
|
|
53
|
+
};
|
|
54
|
+
})();
|
|
55
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
56
|
+
exports.TIER1_LEARN_TRIGGERS = exports.DIGEST_USER_CAP = exports.DIGEST_TOTAL_CAP = exports.WATCH_OFF_STREAK_CLOSE = exports.WATCH_MAX_TURNS = void 0;
|
|
57
|
+
exports.matchLearnTrigger = matchLearnTrigger;
|
|
58
|
+
exports.isDestructiveVerb = isDestructiveVerb;
|
|
59
|
+
exports.learnTriggersForVerb = learnTriggersForVerb;
|
|
60
|
+
exports.openWatch = openWatch;
|
|
61
|
+
exports.buildTurnDigest = buildTurnDigest;
|
|
62
|
+
exports.willExceedWatchdog = willExceedWatchdog;
|
|
63
|
+
exports.advanceWatch = advanceWatch;
|
|
64
|
+
exports.liveSpan = liveSpan;
|
|
65
|
+
exports.applyDistillTransition = applyDistillTransition;
|
|
66
|
+
exports.procedureWatchPath = procedureWatchPath;
|
|
67
|
+
exports.hasProcedureWatch = hasProcedureWatch;
|
|
68
|
+
exports.readProcedureWatch = readProcedureWatch;
|
|
69
|
+
exports.writeProcedureWatch = writeProcedureWatch;
|
|
70
|
+
exports.clearProcedureWatch = clearProcedureWatch;
|
|
71
|
+
exports.openWatchIfIdle = openWatchIfIdle;
|
|
72
|
+
const path = __importStar(require("path"));
|
|
73
|
+
const fs = __importStar(require("fs"));
|
|
74
|
+
const procedure_1 = require("./procedure");
|
|
75
|
+
/** Watchdog backstop: a watch never observes past this many turns — the next
|
|
76
|
+
* turn aborts it (log a fix-queue smell, never distill). */
|
|
77
|
+
exports.WATCH_MAX_TURNS = 15;
|
|
78
|
+
/** Hysteresis: consecutive OFF turns required to close (a one-turn tangent
|
|
79
|
+
* can't truncate the span). */
|
|
80
|
+
exports.WATCH_OFF_STREAK_CLOSE = 2;
|
|
81
|
+
/** Per-turn digest cap, serialized. */
|
|
82
|
+
exports.DIGEST_TOTAL_CAP = 1_500;
|
|
83
|
+
/** User-prompt head cap inside the digest. */
|
|
84
|
+
exports.DIGEST_USER_CAP = 300;
|
|
85
|
+
const DIGEST_MAX_COMMANDS = 6;
|
|
86
|
+
const DIGEST_COMMAND_CAP = 180;
|
|
87
|
+
const DIGEST_EXIT_HINT_CAP = 80;
|
|
88
|
+
const DIGEST_MAX_FILES = 8;
|
|
89
|
+
// ---------- Tier-1 LEARN trigger vocabulary (PURE data) -----------------------
|
|
90
|
+
/** The Tier-1 trigger set for OPENING A LEARN WATCH, independent of the store
|
|
91
|
+
* (docs/procedure-system.md §Tier 1: deploy / push / release / ship / build /
|
|
92
|
+
* test — `ship` phrases map to the `release` verb, matching GIT_SEED_SET).
|
|
93
|
+
* `build` + `test` have no seed: the clean LEARN proof case. `push` is
|
|
94
|
+
* destructive — it sits here only so the opener can NAME the refusal; a LEARN
|
|
95
|
+
* watch never opens for it (the seed is the canon even when stale). Entries
|
|
96
|
+
* are Procedure-shaped (steps empty — vocabulary, not recipes) so the same
|
|
97
|
+
* matcher + intent guard run over them. */
|
|
98
|
+
exports.TIER1_LEARN_TRIGGERS = [
|
|
99
|
+
{ verb: 'deploy', triggers: ['deploy', 'deploy the api', 'deploy the worker', 'redeploy'], steps: '', status: 'seeded' },
|
|
100
|
+
{ verb: 'push', triggers: ['push', 'git push', 'push to remote', 'push it up', 'push upstream'], steps: '', status: 'seeded', destructive: true },
|
|
101
|
+
{ verb: 'release', triggers: ['release', 'ship', 'ship it', 'ship a release', 'cut a release', 'publish the release', 'do a release'], steps: '', status: 'seeded' },
|
|
102
|
+
{ verb: 'build', triggers: ['build', 'rebuild', 'compile', 'run the build'], steps: '', status: 'seeded' },
|
|
103
|
+
{ verb: 'test', triggers: ['test', 'tests', 'run the tests', 'run tests'], steps: '', status: 'seeded' },
|
|
104
|
+
];
|
|
105
|
+
/** Match a prompt against the Tier-1 LEARN vocabulary (same matcher + intent
|
|
106
|
+
* guard as the store path). PURE. */
|
|
107
|
+
function matchLearnTrigger(prompt) {
|
|
108
|
+
return (0, procedure_1.matchProcedure)(prompt, {
|
|
109
|
+
version: procedure_1.PROCEDURE_STORE_VERSION,
|
|
110
|
+
procedures: exports.TIER1_LEARN_TRIGGERS,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
/** Is this verb destructive — per the store's procedure OR the Tier-1
|
|
114
|
+
* vocabulary? Destructive verbs are never learn-writable and a LEARN watch
|
|
115
|
+
* never opens for them. PURE. */
|
|
116
|
+
function isDestructiveVerb(verb, store) {
|
|
117
|
+
if (store.procedures.some(p => p.verb === verb && p.destructive))
|
|
118
|
+
return true;
|
|
119
|
+
return exports.TIER1_LEARN_TRIGGERS.some(p => p.verb === verb && p.destructive);
|
|
120
|
+
}
|
|
121
|
+
/** The trigger phrases a LEARNED procedure should match on next time — the
|
|
122
|
+
* store procedure's own triggers when it exists (stale re-learn keeps them),
|
|
123
|
+
* else the Tier-1 vocabulary's, else the bare verb. PURE. */
|
|
124
|
+
function learnTriggersForVerb(verb, store) {
|
|
125
|
+
const existing = store.procedures.find(p => p.verb === verb);
|
|
126
|
+
if (existing && existing.triggers.length)
|
|
127
|
+
return existing.triggers;
|
|
128
|
+
const vocab = exports.TIER1_LEARN_TRIGGERS.find(p => p.verb === verb);
|
|
129
|
+
if (vocab && vocab.triggers.length)
|
|
130
|
+
return vocab.triggers;
|
|
131
|
+
return [verb];
|
|
132
|
+
}
|
|
133
|
+
// ---------- Open (PURE) -------------------------------------------------------
|
|
134
|
+
function openWatch(verb, phase, openedAt) {
|
|
135
|
+
return {
|
|
136
|
+
verb,
|
|
137
|
+
phase,
|
|
138
|
+
openedAt: openedAt || new Date().toISOString(),
|
|
139
|
+
turnCount: 0,
|
|
140
|
+
observations: [],
|
|
141
|
+
lastLiveTurn: 0,
|
|
142
|
+
offStreak: 0,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
function oneLine(s) {
|
|
146
|
+
return (s || '').replace(/\s+/g, ' ').trim();
|
|
147
|
+
}
|
|
148
|
+
/** Build one compact TurnDigest: user-prompt head ≤300 chars, Bash commands
|
|
149
|
+
* (+ a short output-tail exit hint) from toolCalls, files touched, turn
|
|
150
|
+
* status — ≤1.5K serialized total. PURE — unit-tested. */
|
|
151
|
+
function buildTurnDigest(turn, turnNumber) {
|
|
152
|
+
const commands = [];
|
|
153
|
+
for (const tc of turn.toolCalls) {
|
|
154
|
+
if (tc.name !== 'Bash' || !tc.brief)
|
|
155
|
+
continue;
|
|
156
|
+
if (commands.length >= DIGEST_MAX_COMMANDS)
|
|
157
|
+
break;
|
|
158
|
+
let cmd = oneLine(tc.brief).slice(0, DIGEST_COMMAND_CAP);
|
|
159
|
+
if (tc._output) {
|
|
160
|
+
const lines = tc._output.split('\n').map(l => l.trim()).filter(Boolean);
|
|
161
|
+
const tail = lines.length ? lines[lines.length - 1].slice(0, DIGEST_EXIT_HINT_CAP) : '';
|
|
162
|
+
if (tail)
|
|
163
|
+
cmd += ` ⇒ ${tail}`;
|
|
164
|
+
}
|
|
165
|
+
commands.push(cmd);
|
|
166
|
+
}
|
|
167
|
+
const digest = {
|
|
168
|
+
turn: turnNumber,
|
|
169
|
+
user: oneLine(turn.userPrompt).slice(0, exports.DIGEST_USER_CAP),
|
|
170
|
+
commands,
|
|
171
|
+
files: turn.filesTouched.slice(0, DIGEST_MAX_FILES).map(f => f.slice(0, 160)),
|
|
172
|
+
status: turn.status || 'completed',
|
|
173
|
+
};
|
|
174
|
+
// Total-size guard: trim breadth (files, then commands, then the user head)
|
|
175
|
+
// until the serialized digest fits the cap.
|
|
176
|
+
while (JSON.stringify(digest).length > exports.DIGEST_TOTAL_CAP) {
|
|
177
|
+
if (digest.files.length > 2)
|
|
178
|
+
digest.files = digest.files.slice(0, digest.files.length - 1);
|
|
179
|
+
else if (digest.commands.length > 1)
|
|
180
|
+
digest.commands = digest.commands.slice(0, digest.commands.length - 1);
|
|
181
|
+
else if (digest.user.length > 100)
|
|
182
|
+
digest.user = digest.user.slice(0, digest.user.length - 50);
|
|
183
|
+
else
|
|
184
|
+
break; // structurally minimal — accept
|
|
185
|
+
}
|
|
186
|
+
return digest;
|
|
187
|
+
}
|
|
188
|
+
/** Would observing one more turn cross the watchdog? The caller checks this
|
|
189
|
+
* BEFORE the judge call so the aborting turn costs nothing. PURE. */
|
|
190
|
+
function willExceedWatchdog(watch) {
|
|
191
|
+
return watch.turnCount >= exports.WATCH_MAX_TURNS;
|
|
192
|
+
}
|
|
193
|
+
/** Advance the watch by one observed turn. Appends the digest, then applies
|
|
194
|
+
* the continuity verdict per §Endpoint detection:
|
|
195
|
+
* live=true → stamp lastLiveTurn, reset offStreak
|
|
196
|
+
* live=false → offStreak++
|
|
197
|
+
* live=null → judge unreachable: offStreak UNTOUCHED (the watch extends;
|
|
198
|
+
* the watchdog is the backstop)
|
|
199
|
+
* Dispositions: 'watchdog' when the turn count exceeds the cap (defensive —
|
|
200
|
+
* callers should pre-check willExceedWatchdog), 'close' at
|
|
201
|
+
* offStreak ≥ WATCH_OFF_STREAK_CLOSE, else 'continue'. PURE — unit-tested. */
|
|
202
|
+
function advanceWatch(watch, digest, live) {
|
|
203
|
+
const next = {
|
|
204
|
+
...watch,
|
|
205
|
+
turnCount: watch.turnCount + 1,
|
|
206
|
+
observations: [...watch.observations, digest],
|
|
207
|
+
};
|
|
208
|
+
if (next.turnCount > exports.WATCH_MAX_TURNS) {
|
|
209
|
+
return { watch: next, disposition: 'watchdog' };
|
|
210
|
+
}
|
|
211
|
+
if (live === true) {
|
|
212
|
+
next.lastLiveTurn = next.turnCount;
|
|
213
|
+
next.offStreak = 0;
|
|
214
|
+
}
|
|
215
|
+
else if (live === false) {
|
|
216
|
+
next.offStreak = watch.offStreak + 1;
|
|
217
|
+
} // live === null → untouched
|
|
218
|
+
if (next.offStreak >= exports.WATCH_OFF_STREAK_CLOSE) {
|
|
219
|
+
return { watch: next, disposition: 'close' };
|
|
220
|
+
}
|
|
221
|
+
return { watch: next, disposition: 'continue' };
|
|
222
|
+
}
|
|
223
|
+
/** The live span — the endpoint stamps at the last LIVE turn, so trailing
|
|
224
|
+
* not-live turns never enter the artifact. Span = observations[0 ..
|
|
225
|
+
* lastLiveTurn]. Empty when the watch was never live (nothing to distill —
|
|
226
|
+
* never register garbage). PURE. */
|
|
227
|
+
function liveSpan(watch) {
|
|
228
|
+
return watch.observations.slice(0, watch.lastLiveTurn);
|
|
229
|
+
}
|
|
230
|
+
/** Apply the spec's transition table (component 6) to the procedure store:
|
|
231
|
+
*
|
|
232
|
+
* LEARN | any (span ended) | status=learned, steps/endpoint/caveats from distill
|
|
233
|
+
* REPLAY | clean | status=confirmed (steps untouched)
|
|
234
|
+
* REPLAY | floundered | re-learn in place: distill the failed span → learned
|
|
235
|
+
* any | distill unreadable / judge down | no write; watch discarded
|
|
236
|
+
*
|
|
237
|
+
* Each row gates on the fields it actually consumes: LEARN and
|
|
238
|
+
* REPLAY-floundered need the distilled fields; REPLAY-clean needs the
|
|
239
|
+
* outcome. A missing required field = the unreadable/judge-down row → no
|
|
240
|
+
* write. All writes flow through upsertProcedure, whose destructive guard
|
|
241
|
+
* already refuses to overwrite a `push` seed (never weakened here).
|
|
242
|
+
* PURE — unit-tested. Returns the (possibly unchanged) store + what happened. */
|
|
243
|
+
function applyDistillTransition(store, watch, outcome, distilled, fallbackTriggers) {
|
|
244
|
+
const existing = store.procedures.find(p => p.verb === watch.verb);
|
|
245
|
+
if (watch.phase === 'LEARN') {
|
|
246
|
+
if (!distilled)
|
|
247
|
+
return { store, action: 'discarded' };
|
|
248
|
+
const proc = {
|
|
249
|
+
verb: watch.verb,
|
|
250
|
+
triggers: existing?.triggers?.length ? existing.triggers : fallbackTriggers,
|
|
251
|
+
steps: distilled.steps,
|
|
252
|
+
endpoint: distilled.endpoint,
|
|
253
|
+
caveats: distilled.caveats,
|
|
254
|
+
status: 'learned',
|
|
255
|
+
destructive: existing?.destructive,
|
|
256
|
+
};
|
|
257
|
+
return { store: (0, procedure_1.upsertProcedure)(store, proc), action: 'learned' };
|
|
258
|
+
}
|
|
259
|
+
// REPLAY
|
|
260
|
+
if (outcome === 'clean') {
|
|
261
|
+
if (!existing)
|
|
262
|
+
return { store, action: 'discarded' };
|
|
263
|
+
return {
|
|
264
|
+
store: (0, procedure_1.upsertProcedure)(store, { ...existing, status: 'confirmed' }),
|
|
265
|
+
action: 'confirmed',
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
if (outcome === 'floundered') {
|
|
269
|
+
// The failed span already contains the new winning path — a stale REPLAY
|
|
270
|
+
// span IS the next LEARN span; no extra failure needed.
|
|
271
|
+
if (!distilled)
|
|
272
|
+
return { store, action: 'discarded' };
|
|
273
|
+
const proc = {
|
|
274
|
+
verb: watch.verb,
|
|
275
|
+
triggers: existing?.triggers?.length ? existing.triggers : fallbackTriggers,
|
|
276
|
+
steps: distilled.steps,
|
|
277
|
+
endpoint: distilled.endpoint,
|
|
278
|
+
caveats: distilled.caveats,
|
|
279
|
+
status: 'learned',
|
|
280
|
+
destructive: existing?.destructive,
|
|
281
|
+
};
|
|
282
|
+
return { store: (0, procedure_1.upsertProcedure)(store, proc), action: 'relearned' };
|
|
283
|
+
}
|
|
284
|
+
// outcome null → judge down → no write.
|
|
285
|
+
return { store, action: 'discarded' };
|
|
286
|
+
}
|
|
287
|
+
// ---------- Watch file I/O (beside the procedure store) -----------------------
|
|
288
|
+
function stateDir() {
|
|
289
|
+
const home = process.env.HOME || process.env.USERPROFILE || '';
|
|
290
|
+
return path.join(home, '.greprag', 'state');
|
|
291
|
+
}
|
|
292
|
+
function procedureWatchPath(projectId) {
|
|
293
|
+
return path.join(stateDir(), `procedure-watch-${projectId}.json`);
|
|
294
|
+
}
|
|
295
|
+
/** The Stop-hook observer's zero-cost gate: no file → no watch → no work. */
|
|
296
|
+
function hasProcedureWatch(projectId) {
|
|
297
|
+
try {
|
|
298
|
+
return fs.existsSync(procedureWatchPath(projectId));
|
|
299
|
+
}
|
|
300
|
+
catch {
|
|
301
|
+
return false;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
/** Read the active watch. Null on any miss/corruption — fail-open; the caller
|
|
305
|
+
* clears the file so a corrupt watch can't wedge the observer. */
|
|
306
|
+
function readProcedureWatch(projectId) {
|
|
307
|
+
try {
|
|
308
|
+
const raw = fs.readFileSync(procedureWatchPath(projectId), 'utf-8');
|
|
309
|
+
const w = JSON.parse(raw);
|
|
310
|
+
if (w && typeof w.verb === 'string' && w.verb
|
|
311
|
+
&& (w.phase === 'LEARN' || w.phase === 'REPLAY')
|
|
312
|
+
&& Array.isArray(w.observations)) {
|
|
313
|
+
return {
|
|
314
|
+
verb: w.verb,
|
|
315
|
+
phase: w.phase,
|
|
316
|
+
openedAt: typeof w.openedAt === 'string' ? w.openedAt : '',
|
|
317
|
+
turnCount: typeof w.turnCount === 'number' ? w.turnCount : w.observations.length,
|
|
318
|
+
observations: w.observations,
|
|
319
|
+
lastLiveTurn: typeof w.lastLiveTurn === 'number' ? w.lastLiveTurn : 0,
|
|
320
|
+
offStreak: typeof w.offStreak === 'number' ? w.offStreak : 0,
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
catch { /* missing / unreadable → null */ }
|
|
325
|
+
return null;
|
|
326
|
+
}
|
|
327
|
+
function writeProcedureWatch(projectId, watch) {
|
|
328
|
+
const file = procedureWatchPath(projectId);
|
|
329
|
+
const dir = path.dirname(file);
|
|
330
|
+
if (!fs.existsSync(dir))
|
|
331
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
332
|
+
fs.writeFileSync(file, JSON.stringify(watch, null, 2) + '\n');
|
|
333
|
+
}
|
|
334
|
+
function clearProcedureWatch(projectId) {
|
|
335
|
+
try {
|
|
336
|
+
fs.unlinkSync(procedureWatchPath(projectId));
|
|
337
|
+
}
|
|
338
|
+
catch { /* already gone */ }
|
|
339
|
+
}
|
|
340
|
+
/** Open a watch iff none is active (ONE active watch at a time, v1 — an
|
|
341
|
+
* in-flight watch is never replaced by a new trigger). Returns whether a
|
|
342
|
+
* watch was opened. */
|
|
343
|
+
function openWatchIfIdle(projectId, verb, phase) {
|
|
344
|
+
if (hasProcedureWatch(projectId))
|
|
345
|
+
return false;
|
|
346
|
+
writeProcedureWatch(projectId, openWatch(verb, phase));
|
|
347
|
+
return true;
|
|
348
|
+
}
|
|
349
|
+
//# sourceMappingURL=procedure-watch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"procedure-watch.js","sourceRoot":"","sources":["../src/procedure-watch.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;0EAmB0E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8E1E,8CAKC;AAKD,8CAGC;AAKD,oDAMC;AAID,8BAUC;AAoBD,0CA6BC;AAQD,gDAEC;AAWD,oCAqBC;AAMD,4BAEC;AAyBD,wDAgDC;AASD,gDAEC;AAGD,8CAEC;AAID,gDAqBC;AAED,kDAKC;AAED,kDAEC;AAKD,0CAIC;AA3VD,2CAA6B;AAC7B,uCAAyB;AACzB,2CAGqB;AAmCrB;6DAC6D;AAChD,QAAA,eAAe,GAAG,EAAE,CAAC;AAClC;gCACgC;AACnB,QAAA,sBAAsB,GAAG,CAAC,CAAC;AACxC,uCAAuC;AAC1B,QAAA,gBAAgB,GAAG,KAAK,CAAC;AACtC,8CAA8C;AACjC,QAAA,eAAe,GAAG,GAAG,CAAC;AAEnC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAC9B,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAC/B,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAChC,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAE3B,iFAAiF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