pi-anchor 0.3.0 → 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/src/types.ts CHANGED
@@ -1,67 +1,47 @@
1
1
  /**
2
- * Anchor Data Contracts & Type Definitions
3
- * Single Global Source of Truth with Zero Workspace Contamination.
2
+ * Anchor Data Contracts
3
+ * Minimalist cross-session sticky notes stored in ~/.anchor/state.json
4
4
  */
5
5
 
6
- export type AnchorStatus = 'active' | 'sleeping' | 'settled' | 'graveyard';
6
+ export type AnchorStatus = 'active' | 'sleeping' | 'settled';
7
7
  export type AnchorPriority = 'p0' | 'p1' | 'p2';
8
- export type AnchorDurability = 'ephemeral' | 'durable';
9
-
10
- export interface AnchorDecayPolicy {
11
- /** Days before an untouched active anchor transitions to sleeping */
12
- activeDays: number;
13
- /** Days an anchor remains sleeping before dropping to graveyard */
14
- sleepDays: number;
15
- /** Total maximum days before permanent graveyard sweep (9999 = never) */
16
- graveyardDays: number;
17
- }
18
8
 
19
9
  export interface AnchorEvidence {
20
10
  settledAt?: number;
21
- settledBy?: 'one-tap-settlement' | 'manual-command' | 'verification-test';
11
+ settledBy?: 'commit' | 'manual' | 'one-tap-settlement' | 'manual-command' | 'verification-test';
22
12
  commitHash?: string;
23
13
  summary?: string;
24
14
  touchedFiles?: string[];
25
15
  }
26
16
 
27
17
  export interface Anchor {
28
- /** Unique sequential identifier, e.g., 'anc-1' */
18
+ /** Sequential identifier, e.g. 'anc-1' */
29
19
  id: string;
30
- /** Short imperative title of the task */
20
+ /** Sticky note text */
31
21
  title: string;
32
- /** Optional detailed context or notes */
22
+ /** Optional extra context */
33
23
  description?: string;
34
- /** Task priority */
35
- priority: AnchorPriority;
36
- /** Current lifecycle status */
24
+ /** Lifecycle status: 'active' (recent) or 'sleeping' (>7d untouched, 0 prompt tokens) */
37
25
  status: AnchorStatus;
38
- /** Durability tier: ephemeral (short-lived reminder, 48h TTL) or durable (long-term architecture vision) */
39
- durability: AnchorDurability;
40
- /** Canonical project name (e.g. 'PPT', 'X', or 'global') */
26
+ /** Short workspace label (e.g. 'anchor', 'College/优化', or 'global') */
41
27
  project: string;
42
- /** Canonical root directory where the task was anchored (empty string for global tasks) */
28
+ /** Workspace directory path where the note applies */
43
29
  cwd: string;
44
- /** Creation timestamp in ms */
30
+ /** Creation timestamp (ms) */
45
31
  createdAt: number;
46
- /** Last update timestamp in ms */
32
+ /** Last update timestamp (ms) */
47
33
  updatedAt: number;
48
- /** Last touched timestamp in ms (resets on file touch) */
34
+ /** Last activity timestamp (ms) */
49
35
  lastTouchedAt: number;
50
- /** Associated file paths or globs, e.g. ['src/auth/*.ts'] */
36
+ /** Associated file paths or globs (explicit or auto-extracted from note text) */
51
37
  files: string[];
52
- /** Expected completion date in format 'YYYY-MM-DD' (e.g. '2026-09-24') */
53
- targetDate?: string;
54
- /** Optional shell command for automated physical verification (e.g. 'npm test') */
55
- verifyCommand?: string;
56
- /** Topic or domain tags, e.g. ['auth', 'security'] */
38
+ /** Optional tags */
57
39
  tags: string[];
58
- /** Optional recurrence pattern: 'daily' for recurring daily habits */
59
- recurrence?: 'daily';
60
- /** Last completed date string 'YYYY-MM-DD' for recurring tasks */
61
- lastCompletedDate?: string;
62
- /** Decay policy overrides */
63
- decay: AnchorDecayPolicy;
64
- /** Settlement evidence metadata upon closure */
40
+ /** Optional due date ('YYYY-MM-DD') */
41
+ targetDate?: string;
42
+ /** Optional priority kept for backward compatibility */
43
+ priority?: AnchorPriority;
44
+ /** Settlement metadata when archived */
65
45
  evidence?: AnchorEvidence;
66
46
  }
67
47
 
@@ -76,30 +56,9 @@ export interface TouchMatchResult {
76
56
  anchor: Anchor;
77
57
  score: number;
78
58
  matchedFiles: string[];
79
- reason: 'exact-file' | 'dir-prefix' | 'tag-keyword';
80
- }
81
-
82
- export interface SettlementProposal {
83
- anchor: Anchor;
84
- matchedFiles: string[];
85
- reason: string;
86
- recommendedAction: 'settle' | 'defer';
59
+ reason: 'exact-file' | 'dir-prefix';
87
60
  }
88
61
 
89
- export const EPHEMERAL_DECAY_POLICY: AnchorDecayPolicy = {
90
- activeDays: 7, // 7 days active before quiet sleep
91
- sleepDays: 30,
92
- graveyardDays: 9999 // Never silently auto-delete unfinished tasks
93
- };
94
-
95
- export const DURABLE_DECAY_POLICY: AnchorDecayPolicy = {
96
- activeDays: 7, // 7 days active before quiet sleep
97
- sleepDays: 30,
98
- graveyardDays: 9999 // Never permanently auto-dropped; preserved indefinitely
99
- };
100
-
101
- export const DEFAULT_DECAY_POLICY: AnchorDecayPolicy = {
102
- activeDays: 7,
103
- sleepDays: 30,
104
- graveyardDays: 9999
105
- };
62
+ /** 7 days without activity moves a note to quiet mode (still visible in UI, 0 prompt tokens in unrelated workspaces) */
63
+ export const QUIET_AFTER_DAYS = 7;
64
+ export const MS_PER_DAY = 86_400_000;