pi-anchor 0.2.4 → 0.4.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/index.js CHANGED
@@ -1,147 +1,67 @@
1
1
  import {
2
2
  AnchorStore,
3
3
  COMMENT_FORMATS,
4
- DEFAULT_DECAY_POLICY,
5
- DURABLE_DECAY_POLICY,
6
- EPHEMERAL_DECAY_POLICY,
7
- SessionTouchObserver,
4
+ MS_PER_DAY,
5
+ QUIET_AFTER_DAYS,
8
6
  acquireSyncLock,
9
7
  atomicRenameWithRetry,
10
- classifyAnchor,
11
- detectDurability,
12
- detectRecurrence,
13
- detectTargetDate,
14
- evaluateAnchorDecay,
8
+ extractPathsFromText,
15
9
  findMatchedAnchors,
16
- formatCreationTime,
17
10
  formatOrigin,
18
- formatRelativeTime,
19
- formatRemainingTtl,
20
- formatSettlementCard,
21
- formatTargetDate,
22
- generateSettlementProposals,
11
+ formatRelativeAge,
23
12
  getDefaultStorageDir,
24
13
  getDisplayWidth,
25
- getEphemeralDecayPolicy,
26
- getTodayDateString,
27
14
  globToRegExp,
28
- groupAnchorsByQuadrant,
29
15
  hasActiveUI,
16
+ isAnchorTargetingWorkspace,
30
17
  isSameOrSubPath,
31
18
  makeSafeTaskAnnotation,
32
19
  matchAnchorAgainstTouchedFiles,
20
+ matchesCommitMessage,
33
21
  normalizePath,
34
22
  openAnchorDashboard,
35
23
  padToWidth,
24
+ parseAnchorCommandInput,
36
25
  renderActiveAnchorsContext,
37
26
  renderColdStartAnchorsContext,
38
- runPhysicalVerification,
27
+ resolveAnchorTarget,
28
+ sortAnchorsForDisplay,
39
29
  stripAnsi,
40
- sweepStore,
30
+ sweepQuietNotes,
41
31
  truncateToWidth,
42
32
  updateAnchorStatusBar,
43
33
  updateStartupBanner
44
- } from "./chunk-G72UHPBN.js";
45
-
46
- // src/protocol.ts
47
- var AnchorProtocol = class {
48
- store;
49
- observer;
50
- annotatedThisSession = /* @__PURE__ */ new Set();
51
- constructor(store) {
52
- this.store = store;
53
- this.observer = new SessionTouchObserver();
54
- }
55
- /**
56
- * Run session initialization lifecycle: sweeps stale anchors and resets session state
57
- */
58
- handleSessionStart(now = Date.now()) {
59
- this.observer.clear();
60
- this.annotatedThisSession.clear();
61
- const sweep = sweepStore(this.store, now);
62
- return { sleepingCount: sweep.transitionedToSleeping.length };
63
- }
64
- /**
65
- * Handle turn lifecycle: injects cold-start prompt on turn 1, returns null (0 tokens) on turn 2+
66
- */
67
- handleBeforeTurn(turnCount, cwd, now = Date.now()) {
68
- if (turnCount <= 1) {
69
- return renderColdStartAnchorsContext(this.store, cwd, now) || null;
70
- }
71
- return null;
72
- }
73
- /**
74
- * Handle tool execution result: detects touched paths, refreshes mutation touch timers,
75
- * and returns safe language-specific JIT annotation (or null if syntax incompatible/already annotated).
76
- */
77
- handleToolResult(input) {
78
- if (!input.isError) {
79
- this.observer.recordToolCall(input.toolName, input.filePath ? { path: input.filePath } : {});
80
- }
81
- if (!input.filePath) {
82
- return { annotation: null, matchedAnchors: [] };
83
- }
84
- const touchedPath = normalizePath(input.filePath);
85
- const anchors = this.store.list({ cwd: input.cwd }).filter((a2) => a2.status === "active" || a2.status === "sleeping");
86
- const matches = findMatchedAnchors(anchors, [touchedPath]);
87
- if (matches.length === 0) {
88
- return { annotation: null, matchedAnchors: [] };
89
- }
90
- if (input.isMutation && !input.isError) {
91
- for (const m of matches) {
92
- this.store.touch(m.anchor.id);
93
- }
94
- }
95
- const a = matches[0].anchor;
96
- if (!this.annotatedThisSession.has(a.id)) {
97
- this.annotatedThisSession.add(a.id);
98
- const annotation = makeSafeTaskAnnotation(touchedPath, a);
99
- return { annotation, matchedAnchors: matches.map((m) => m.anchor) };
100
- }
101
- return { annotation: null, matchedAnchors: matches.map((m) => m.anchor) };
102
- }
103
- };
34
+ } from "./chunk-LKY6WIKH.js";
104
35
  export {
105
- AnchorProtocol,
106
36
  AnchorStore,
107
37
  COMMENT_FORMATS,
108
- DEFAULT_DECAY_POLICY,
109
- DURABLE_DECAY_POLICY,
110
- EPHEMERAL_DECAY_POLICY,
111
- SessionTouchObserver,
38
+ MS_PER_DAY,
39
+ QUIET_AFTER_DAYS,
112
40
  acquireSyncLock,
113
41
  atomicRenameWithRetry,
114
- classifyAnchor,
115
- detectDurability,
116
- detectRecurrence,
117
- detectTargetDate,
118
- evaluateAnchorDecay,
42
+ extractPathsFromText,
119
43
  findMatchedAnchors,
120
- formatCreationTime,
121
44
  formatOrigin,
122
- formatRelativeTime,
123
- formatRemainingTtl,
124
- formatSettlementCard,
125
- formatTargetDate,
126
- generateSettlementProposals,
45
+ formatRelativeAge,
127
46
  getDefaultStorageDir,
128
47
  getDisplayWidth,
129
- getEphemeralDecayPolicy,
130
- getTodayDateString,
131
48
  globToRegExp,
132
- groupAnchorsByQuadrant,
133
49
  hasActiveUI,
50
+ isAnchorTargetingWorkspace,
134
51
  isSameOrSubPath,
135
52
  makeSafeTaskAnnotation,
136
53
  matchAnchorAgainstTouchedFiles,
54
+ matchesCommitMessage,
137
55
  normalizePath,
138
56
  openAnchorDashboard,
139
57
  padToWidth,
58
+ parseAnchorCommandInput,
140
59
  renderActiveAnchorsContext,
141
60
  renderColdStartAnchorsContext,
142
- runPhysicalVerification,
61
+ resolveAnchorTarget,
62
+ sortAnchorsForDisplay,
143
63
  stripAnsi,
144
- sweepStore,
64
+ sweepQuietNotes,
145
65
  truncateToWidth,
146
66
  updateAnchorStatusBar,
147
67
  updateStartupBanner
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-anchor",
3
- "version": "0.2.4",
4
- "description": "Never lose unfinished tasks when closing Pi — pin reminders across sessions (/pin), auto-remind when touching matching files, and auto-complete on git commit with 0 TODO.md clutter.",
3
+ "version": "0.4.0",
4
+ "description": "A digital sticky note for Pi — stick a quick note across sessions (/pin), get a 1-line whisper when touching matching files, and auto-tear off on git commit with 0 TODO.md clutter.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",