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/README.md +33 -170
- package/README_zh.md +32 -176
- package/assets/hero-en.svg +23 -39
- package/assets/hero-zh.svg +23 -39
- package/bin/anchor.js +36 -69
- package/dist/chunk-LKY6WIKH.js +1100 -0
- package/dist/extension-B1-fzCox.d.cts +167 -0
- package/dist/extension-B1-fzCox.d.ts +167 -0
- package/dist/extension.cjs +369 -1315
- package/dist/extension.d.cts +2 -20
- package/dist/extension.d.ts +2 -20
- package/dist/extension.js +4 -536
- package/dist/index.cjs +317 -1143
- package/dist/index.d.cts +17 -250
- package/dist/index.d.ts +17 -250
- package/dist/index.js +15 -103
- package/package.json +2 -2
- package/src/extension.ts +124 -362
- package/src/index.ts +1 -6
- package/src/store.ts +294 -424
- package/src/tui.ts +102 -297
- package/src/types.ts +24 -65
- package/dist/chunk-Q7IILJFA.js +0 -1563
- package/dist/store-t2_TDhJn.d.cts +0 -210
- package/dist/store-t2_TDhJn.d.ts +0 -210
- package/src/context_injector.ts +0 -166
- package/src/decay.ts +0 -125
- package/src/matcher.ts +0 -202
- package/src/observer.ts +0 -141
- package/src/protocol.ts +0 -95
- package/src/settlement.ts +0 -140
package/src/types.ts
CHANGED
|
@@ -1,67 +1,47 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Anchor Data Contracts
|
|
3
|
-
*
|
|
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'
|
|
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
|
-
/**
|
|
18
|
+
/** Sequential identifier, e.g. 'anc-1' */
|
|
29
19
|
id: string;
|
|
30
|
-
/**
|
|
20
|
+
/** Sticky note text */
|
|
31
21
|
title: string;
|
|
32
|
-
/** Optional
|
|
22
|
+
/** Optional extra context */
|
|
33
23
|
description?: string;
|
|
34
|
-
/**
|
|
35
|
-
priority: AnchorPriority;
|
|
36
|
-
/** Current lifecycle status */
|
|
24
|
+
/** Lifecycle status: 'active' (recent) or 'sleeping' (>7d untouched, 0 prompt tokens) */
|
|
37
25
|
status: AnchorStatus;
|
|
38
|
-
/**
|
|
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
|
-
/**
|
|
28
|
+
/** Workspace directory path where the note applies */
|
|
43
29
|
cwd: string;
|
|
44
|
-
/** Creation timestamp
|
|
30
|
+
/** Creation timestamp (ms) */
|
|
45
31
|
createdAt: number;
|
|
46
|
-
/** Last update timestamp
|
|
32
|
+
/** Last update timestamp (ms) */
|
|
47
33
|
updatedAt: number;
|
|
48
|
-
/** Last
|
|
34
|
+
/** Last activity timestamp (ms) */
|
|
49
35
|
lastTouchedAt: number;
|
|
50
|
-
/** Associated file paths or globs
|
|
36
|
+
/** Associated file paths or globs (explicit or auto-extracted from note text) */
|
|
51
37
|
files: string[];
|
|
52
|
-
/**
|
|
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
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
|
|
62
|
-
/**
|
|
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'
|
|
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
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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;
|