@iamem/amem 0.1.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/LICENSE +21 -0
- package/README.md +534 -0
- package/dist/activity.d.ts +27 -0
- package/dist/activity.js +202 -0
- package/dist/api/routes.d.ts +31 -0
- package/dist/api/routes.js +1345 -0
- package/dist/attest.d.ts +52 -0
- package/dist/attest.js +192 -0
- package/dist/backup-schedule.d.ts +25 -0
- package/dist/backup-schedule.js +216 -0
- package/dist/capture.d.ts +34 -0
- package/dist/capture.js +257 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +1007 -0
- package/dist/context.d.ts +46 -0
- package/dist/context.js +334 -0
- package/dist/crypto.d.ts +39 -0
- package/dist/crypto.js +166 -0
- package/dist/db.d.ts +192 -0
- package/dist/db.js +666 -0
- package/dist/draft-quality.d.ts +19 -0
- package/dist/draft-quality.js +85 -0
- package/dist/embed.d.ts +76 -0
- package/dist/embed.js +331 -0
- package/dist/estimate.d.ts +32 -0
- package/dist/estimate.js +69 -0
- package/dist/freshness.d.ts +15 -0
- package/dist/freshness.js +93 -0
- package/dist/hook.d.ts +16 -0
- package/dist/hook.js +177 -0
- package/dist/hygiene-schedule.d.ts +28 -0
- package/dist/hygiene-schedule.js +221 -0
- package/dist/hygiene.d.ts +61 -0
- package/dist/hygiene.js +196 -0
- package/dist/install/claude.d.ts +6 -0
- package/dist/install/claude.js +69 -0
- package/dist/install/cursor.d.ts +7 -0
- package/dist/install/cursor.js +80 -0
- package/dist/install/hosts.d.ts +21 -0
- package/dist/install/hosts.js +186 -0
- package/dist/install/skills.d.ts +8 -0
- package/dist/install/skills.js +67 -0
- package/dist/it-pack.d.ts +20 -0
- package/dist/it-pack.js +84 -0
- package/dist/kinds.d.ts +18 -0
- package/dist/kinds.js +106 -0
- package/dist/license.d.ts +48 -0
- package/dist/license.js +172 -0
- package/dist/mcp.d.ts +40 -0
- package/dist/mcp.js +435 -0
- package/dist/paths.d.ts +11 -0
- package/dist/paths.js +55 -0
- package/dist/personal.d.ts +7 -0
- package/dist/personal.js +44 -0
- package/dist/platforms.d.ts +11 -0
- package/dist/platforms.js +32 -0
- package/dist/policy.d.ts +46 -0
- package/dist/policy.js +254 -0
- package/dist/prefs.d.ts +6 -0
- package/dist/prefs.js +11 -0
- package/dist/proposal.d.ts +90 -0
- package/dist/proposal.js +376 -0
- package/dist/publish.d.ts +28 -0
- package/dist/publish.js +57 -0
- package/dist/remember-contract.d.ts +23 -0
- package/dist/remember-contract.js +117 -0
- package/dist/repo-identity.d.ts +15 -0
- package/dist/repo-identity.js +82 -0
- package/dist/rules-sync.d.ts +7 -0
- package/dist/rules-sync.js +47 -0
- package/dist/savings-export.d.ts +49 -0
- package/dist/savings-export.js +141 -0
- package/dist/scan.d.ts +16 -0
- package/dist/scan.js +109 -0
- package/dist/search.d.ts +25 -0
- package/dist/search.js +150 -0
- package/dist/service.d.ts +20 -0
- package/dist/service.js +254 -0
- package/dist/shop.d.ts +9 -0
- package/dist/shop.js +15 -0
- package/dist/ui/server.d.ts +21 -0
- package/dist/ui/server.js +268 -0
- package/dist/vault.d.ts +25 -0
- package/dist/vault.js +42 -0
- package/dist/workspace-setup.d.ts +8 -0
- package/dist/workspace-setup.js +55 -0
- package/docs/agent-install-prompt.md +41 -0
- package/docs/backlog.md +59 -0
- package/docs/enterprise-endpoint.md +98 -0
- package/docs/license.md +54 -0
- package/docs/npm-release.md +38 -0
- package/docs/remember-contract.md +42 -0
- package/package.json +64 -0
- package/scripts/mdm-offboard.sh +14 -0
- package/skills/amem-bootstrap/SKILL.md +83 -0
- package/skills/amem-update-working-memory/SKILL.md +54 -0
- package/templates/cursor-rule.mdc +23 -0
- package/templates/mdm/co.amem.managed.plist +33 -0
- package/templates/policy.deny-default.toml +20 -0
- package/templates/policy.example.toml +22 -0
- package/ui-static/app.js +3966 -0
- package/ui-static/index.html +178 -0
- package/ui-static/orbit.js +389 -0
- package/ui-static/styles.css +2411 -0
package/dist/db.d.ts
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import Database from "better-sqlite3";
|
|
2
|
+
import { type RepoIdentity } from "./repo-identity.js";
|
|
3
|
+
export type RepoRow = {
|
|
4
|
+
id: string;
|
|
5
|
+
repo_key: string;
|
|
6
|
+
remote_url: string | null;
|
|
7
|
+
root_path: string;
|
|
8
|
+
repo_name: string;
|
|
9
|
+
default_branch: string;
|
|
10
|
+
platform: string | null;
|
|
11
|
+
created_at: string;
|
|
12
|
+
updated_at: string;
|
|
13
|
+
};
|
|
14
|
+
export type ClaimRow = {
|
|
15
|
+
repo_id: string;
|
|
16
|
+
id: string;
|
|
17
|
+
kind: string;
|
|
18
|
+
text: string;
|
|
19
|
+
code_anchors: string;
|
|
20
|
+
source_ref: string | null;
|
|
21
|
+
created_at: string;
|
|
22
|
+
updated_at: string;
|
|
23
|
+
/** active | superseded — superseded claims are excluded from retrieval */
|
|
24
|
+
status: string;
|
|
25
|
+
superseded_by: string | null;
|
|
26
|
+
/** 1 when pinned — boosted in retrieval and sorted first in Memory */
|
|
27
|
+
pinned: number;
|
|
28
|
+
};
|
|
29
|
+
export type ProposalDraftRow = {
|
|
30
|
+
id: string;
|
|
31
|
+
repo_id: string;
|
|
32
|
+
platform: string;
|
|
33
|
+
session_id: string | null;
|
|
34
|
+
title: string;
|
|
35
|
+
proposal_json: string;
|
|
36
|
+
status: string;
|
|
37
|
+
source: string;
|
|
38
|
+
created_at: string;
|
|
39
|
+
updated_at: string;
|
|
40
|
+
};
|
|
41
|
+
export type ComponentRow = {
|
|
42
|
+
repo_id: string;
|
|
43
|
+
id: string;
|
|
44
|
+
name: string;
|
|
45
|
+
code_anchor: string | null;
|
|
46
|
+
};
|
|
47
|
+
export type FlowRow = {
|
|
48
|
+
repo_id: string;
|
|
49
|
+
id: string;
|
|
50
|
+
name: string;
|
|
51
|
+
};
|
|
52
|
+
export type EdgeRow = {
|
|
53
|
+
repo_id: string;
|
|
54
|
+
id: string;
|
|
55
|
+
from_id: string;
|
|
56
|
+
from_type: string;
|
|
57
|
+
to_id: string;
|
|
58
|
+
to_type: string;
|
|
59
|
+
kind: string;
|
|
60
|
+
};
|
|
61
|
+
export type UsageEventRow = {
|
|
62
|
+
id: string;
|
|
63
|
+
repo_id: string;
|
|
64
|
+
platform: string;
|
|
65
|
+
session_id: string | null;
|
|
66
|
+
query: string;
|
|
67
|
+
claim_ids: string;
|
|
68
|
+
anchors_count: number;
|
|
69
|
+
claims_count: number;
|
|
70
|
+
packet_tokens: number;
|
|
71
|
+
estimated_tokens_saved: number;
|
|
72
|
+
reported_tokens_saved: number | null;
|
|
73
|
+
created_at: string;
|
|
74
|
+
local_ms: number | null;
|
|
75
|
+
estimated_ms_saved: number | null;
|
|
76
|
+
kind: string | null;
|
|
77
|
+
};
|
|
78
|
+
export type SessionRow = {
|
|
79
|
+
platform: string;
|
|
80
|
+
session_id: string;
|
|
81
|
+
repo_id: string;
|
|
82
|
+
last_seen: string;
|
|
83
|
+
};
|
|
84
|
+
export type ConversationNoteRow = {
|
|
85
|
+
id: string;
|
|
86
|
+
repo_id: string;
|
|
87
|
+
platform: string;
|
|
88
|
+
session_id: string | null;
|
|
89
|
+
role: string;
|
|
90
|
+
text: string;
|
|
91
|
+
created_at: string;
|
|
92
|
+
};
|
|
93
|
+
export type SetupStateRow = {
|
|
94
|
+
repo_id: string;
|
|
95
|
+
platforms: string;
|
|
96
|
+
setup_completed_at: string | null;
|
|
97
|
+
updated_at: string;
|
|
98
|
+
};
|
|
99
|
+
export declare function openDb(): Database.Database;
|
|
100
|
+
export declare function closeDb(): void;
|
|
101
|
+
declare function nowIso(): string;
|
|
102
|
+
export declare function upsertRepo(identity?: RepoIdentity, platform?: string): RepoRow;
|
|
103
|
+
export declare function getRepoByCwd(cwd?: string): RepoRow | null;
|
|
104
|
+
export declare function requireRepo(cwd?: string): RepoRow;
|
|
105
|
+
export declare function getMeta(key: string): string | null;
|
|
106
|
+
export declare function setMeta(key: string, value: string): void;
|
|
107
|
+
export declare function listClaims(repoId: string, opts?: {
|
|
108
|
+
includeSuperseded?: boolean;
|
|
109
|
+
}): ClaimRow[];
|
|
110
|
+
export declare function listClaimsAll(opts?: {
|
|
111
|
+
includeSuperseded?: boolean;
|
|
112
|
+
}): ClaimRow[];
|
|
113
|
+
export declare function getClaim(repoId: string, claimId: string): ClaimRow | null;
|
|
114
|
+
export declare function updateClaim(repoId: string, claimId: string, patch: {
|
|
115
|
+
text?: string;
|
|
116
|
+
kind?: string;
|
|
117
|
+
code_anchors?: string[];
|
|
118
|
+
pinned?: boolean;
|
|
119
|
+
}): ClaimRow | null;
|
|
120
|
+
export declare function setClaimPinned(repoId: string, claimId: string, pinned: boolean): ClaimRow | null;
|
|
121
|
+
export declare function setClaimStatus(repoId: string, claimId: string, status: "active" | "decayed" | "superseded"): ClaimRow | null;
|
|
122
|
+
export declare function deleteClaim(repoId: string, claimId: string): boolean;
|
|
123
|
+
/** Reindex FTS + local embeddings for one repo (after propose apply / wipe helpers). */
|
|
124
|
+
export declare function reindexClaimsSearch(repoId: string): void;
|
|
125
|
+
export declare function listComponents(repoId: string): ComponentRow[];
|
|
126
|
+
export declare function listComponentsAll(): ComponentRow[];
|
|
127
|
+
export declare function listFlows(repoId: string): FlowRow[];
|
|
128
|
+
export declare function listFlowsAll(): FlowRow[];
|
|
129
|
+
export declare function listEdges(repoId: string): EdgeRow[];
|
|
130
|
+
export declare function listEdgesAll(): EdgeRow[];
|
|
131
|
+
export declare function wipeRepo(repoId: string): void;
|
|
132
|
+
/** Delete every bound repo (cascade clears claims/flows/usage). Returns count wiped. */
|
|
133
|
+
export declare function wipeAllRepos(): number;
|
|
134
|
+
export declare function touchSession(platform: string, sessionId: string, repoId: string): void;
|
|
135
|
+
export declare function insertUsageEvent(input: {
|
|
136
|
+
repoId: string;
|
|
137
|
+
platform: string;
|
|
138
|
+
sessionId?: string | null;
|
|
139
|
+
query: string;
|
|
140
|
+
claimIds: string[];
|
|
141
|
+
anchorsCount: number;
|
|
142
|
+
claimsCount: number;
|
|
143
|
+
packetTokens: number;
|
|
144
|
+
estimatedTokensSaved: number;
|
|
145
|
+
localMs?: number | null;
|
|
146
|
+
estimatedMsSaved?: number | null;
|
|
147
|
+
kind?: string | null;
|
|
148
|
+
}): UsageEventRow;
|
|
149
|
+
export declare function listSessions(repoId: string): SessionRow[];
|
|
150
|
+
export declare function listSessionsAll(): SessionRow[];
|
|
151
|
+
export declare function setReportedTokensSaved(eventId: string, saved: number): UsageEventRow;
|
|
152
|
+
export declare function setReportedOnLatest(repoId: string, platform: string, saved: number): UsageEventRow;
|
|
153
|
+
export declare function listUsageEvents(opts: {
|
|
154
|
+
repoId?: string | null;
|
|
155
|
+
days?: number;
|
|
156
|
+
}): UsageEventRow[];
|
|
157
|
+
export declare function listRepos(): RepoRow[];
|
|
158
|
+
export declare function getSetupState(repoId: string): SetupStateRow | null;
|
|
159
|
+
export declare function upsertSetupState(repoId: string, platforms: string[], completed: boolean): SetupStateRow;
|
|
160
|
+
export declare function getRepoById(id: string): RepoRow | null;
|
|
161
|
+
export declare function getRepoByName(name: string): RepoRow | null;
|
|
162
|
+
/** Change a workspace display name. Keeps id, repo_key, and amem:// slug so memory stays bound. */
|
|
163
|
+
export declare function renameWorkspace(repoId: string, displayName: string): RepoRow;
|
|
164
|
+
export declare function insertConversationNote(input: {
|
|
165
|
+
repoId: string;
|
|
166
|
+
platform: string;
|
|
167
|
+
sessionId?: string | null;
|
|
168
|
+
role: string;
|
|
169
|
+
text: string;
|
|
170
|
+
}): ConversationNoteRow;
|
|
171
|
+
export declare function listConversationNotes(repoId: string, limit?: number): ConversationNoteRow[];
|
|
172
|
+
export declare function insertProposalDraft(input: {
|
|
173
|
+
repoId: string;
|
|
174
|
+
platform: string;
|
|
175
|
+
sessionId?: string | null;
|
|
176
|
+
title: string;
|
|
177
|
+
proposal: unknown;
|
|
178
|
+
source?: string;
|
|
179
|
+
}): ProposalDraftRow;
|
|
180
|
+
export declare function getProposalDraft(id: string): ProposalDraftRow | null;
|
|
181
|
+
export declare function listProposalDrafts(repoId: string, opts?: {
|
|
182
|
+
status?: string;
|
|
183
|
+
limit?: number;
|
|
184
|
+
}): ProposalDraftRow[];
|
|
185
|
+
export declare function listProposalDraftsAll(opts?: {
|
|
186
|
+
status?: string;
|
|
187
|
+
limit?: number;
|
|
188
|
+
}): ProposalDraftRow[];
|
|
189
|
+
export declare function countProposalDrafts(repoId: string, status?: string): number;
|
|
190
|
+
export declare function countProposalDraftsAll(status?: string): number;
|
|
191
|
+
export declare function setProposalDraftStatus(id: string, status: "pending" | "applied" | "dismissed"): ProposalDraftRow | null;
|
|
192
|
+
export { nowIso };
|