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