agent-working-memory 0.7.17 → 0.8.6

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.
Files changed (188) hide show
  1. package/README.md +156 -15
  2. package/dist/adapters/common.d.ts.map +1 -1
  3. package/dist/adapters/common.js +289 -202
  4. package/dist/adapters/common.js.map +1 -1
  5. package/dist/adapters/http.js +22 -22
  6. package/dist/api/routes.d.ts +1 -1
  7. package/dist/api/routes.d.ts.map +1 -1
  8. package/dist/api/routes.js +258 -79
  9. package/dist/api/routes.js.map +1 -1
  10. package/dist/cli/migrate.d.ts +42 -0
  11. package/dist/cli/migrate.d.ts.map +1 -0
  12. package/dist/cli/migrate.js +268 -0
  13. package/dist/cli/migrate.js.map +1 -0
  14. package/dist/cli.js +147 -103
  15. package/dist/cli.js.map +1 -1
  16. package/dist/coordination/circuit-breaker.d.ts +24 -0
  17. package/dist/coordination/circuit-breaker.d.ts.map +1 -0
  18. package/dist/coordination/circuit-breaker.js +70 -0
  19. package/dist/coordination/circuit-breaker.js.map +1 -0
  20. package/dist/coordination/failure-modes.d.ts +21 -0
  21. package/dist/coordination/failure-modes.d.ts.map +1 -0
  22. package/dist/coordination/failure-modes.js +49 -0
  23. package/dist/coordination/failure-modes.js.map +1 -0
  24. package/dist/coordination/peer-decisions.js +7 -7
  25. package/dist/coordination/routes.d.ts.map +1 -1
  26. package/dist/coordination/routes.js +44 -1
  27. package/dist/coordination/routes.js.map +1 -1
  28. package/dist/coordination/schema.d.ts.map +1 -1
  29. package/dist/coordination/schema.js +18 -0
  30. package/dist/coordination/schema.js.map +1 -1
  31. package/dist/coordination/schemas.d.ts +9 -9
  32. package/dist/coordination/stale.d.ts +9 -1
  33. package/dist/coordination/stale.d.ts.map +1 -1
  34. package/dist/coordination/stale.js +53 -9
  35. package/dist/coordination/stale.js.map +1 -1
  36. package/dist/core/embeddings.d.ts +16 -10
  37. package/dist/core/embeddings.d.ts.map +1 -1
  38. package/dist/core/embeddings.js +54 -38
  39. package/dist/core/embeddings.js.map +1 -1
  40. package/dist/core/ml-worker-entry.d.ts +17 -0
  41. package/dist/core/ml-worker-entry.d.ts.map +1 -0
  42. package/dist/core/ml-worker-entry.js +193 -0
  43. package/dist/core/ml-worker-entry.js.map +1 -0
  44. package/dist/core/ml-worker.d.ts +59 -0
  45. package/dist/core/ml-worker.d.ts.map +1 -0
  46. package/dist/core/ml-worker.js +253 -0
  47. package/dist/core/ml-worker.js.map +1 -0
  48. package/dist/core/query-expander.d.ts +13 -15
  49. package/dist/core/query-expander.d.ts.map +1 -1
  50. package/dist/core/query-expander.js +48 -54
  51. package/dist/core/query-expander.js.map +1 -1
  52. package/dist/core/reranker.d.ts +9 -19
  53. package/dist/core/reranker.d.ts.map +1 -1
  54. package/dist/core/reranker.js +33 -35
  55. package/dist/core/reranker.js.map +1 -1
  56. package/dist/core/salience.d.ts +32 -5
  57. package/dist/core/salience.d.ts.map +1 -1
  58. package/dist/core/salience.js +201 -28
  59. package/dist/core/salience.js.map +1 -1
  60. package/dist/core/write-pipeline.d.ts +10 -2
  61. package/dist/core/write-pipeline.d.ts.map +1 -1
  62. package/dist/core/write-pipeline.js +218 -49
  63. package/dist/core/write-pipeline.js.map +1 -1
  64. package/dist/engine/activation.d.ts +2 -2
  65. package/dist/engine/activation.d.ts.map +1 -1
  66. package/dist/engine/activation.js +238 -115
  67. package/dist/engine/activation.js.map +1 -1
  68. package/dist/engine/confidence.d.ts +62 -0
  69. package/dist/engine/confidence.d.ts.map +1 -0
  70. package/dist/engine/confidence.js +100 -0
  71. package/dist/engine/confidence.js.map +1 -0
  72. package/dist/engine/connections.d.ts +47 -8
  73. package/dist/engine/connections.d.ts.map +1 -1
  74. package/dist/engine/connections.js +83 -22
  75. package/dist/engine/connections.js.map +1 -1
  76. package/dist/engine/consolidation-scheduler.d.ts +46 -10
  77. package/dist/engine/consolidation-scheduler.d.ts.map +1 -1
  78. package/dist/engine/consolidation-scheduler.js +170 -50
  79. package/dist/engine/consolidation-scheduler.js.map +1 -1
  80. package/dist/engine/consolidation.d.ts +16 -2
  81. package/dist/engine/consolidation.d.ts.map +1 -1
  82. package/dist/engine/consolidation.js +143 -44
  83. package/dist/engine/consolidation.js.map +1 -1
  84. package/dist/engine/eval.d.ts +2 -2
  85. package/dist/engine/eval.d.ts.map +1 -1
  86. package/dist/engine/eval.js +9 -9
  87. package/dist/engine/eval.js.map +1 -1
  88. package/dist/engine/eviction.d.ts +4 -4
  89. package/dist/engine/eviction.d.ts.map +1 -1
  90. package/dist/engine/eviction.js +15 -15
  91. package/dist/engine/eviction.js.map +1 -1
  92. package/dist/engine/retraction.d.ts +93 -5
  93. package/dist/engine/retraction.d.ts.map +1 -1
  94. package/dist/engine/retraction.js +238 -19
  95. package/dist/engine/retraction.js.map +1 -1
  96. package/dist/engine/staging.d.ts +1 -1
  97. package/dist/engine/staging.d.ts.map +1 -1
  98. package/dist/engine/staging.js +3 -3
  99. package/dist/engine/staging.js.map +1 -1
  100. package/dist/hooks/sidecar.d.ts +1 -1
  101. package/dist/hooks/sidecar.d.ts.map +1 -1
  102. package/dist/hooks/sidecar.js +4 -4
  103. package/dist/hooks/sidecar.js.map +1 -1
  104. package/dist/index.js +48 -31
  105. package/dist/index.js.map +1 -1
  106. package/dist/mcp.js +167 -141
  107. package/dist/mcp.js.map +1 -1
  108. package/dist/storage/factory.d.ts +55 -0
  109. package/dist/storage/factory.d.ts.map +1 -0
  110. package/dist/storage/factory.js +135 -0
  111. package/dist/storage/factory.js.map +1 -0
  112. package/dist/storage/pglite-schema.d.ts +20 -0
  113. package/dist/storage/pglite-schema.d.ts.map +1 -0
  114. package/dist/storage/pglite-schema.js +165 -0
  115. package/dist/storage/pglite-schema.js.map +1 -0
  116. package/dist/storage/pglite.d.ts +187 -0
  117. package/dist/storage/pglite.d.ts.map +1 -0
  118. package/dist/storage/pglite.js +1114 -0
  119. package/dist/storage/pglite.js.map +1 -0
  120. package/dist/storage/sqlite.d.ts +117 -0
  121. package/dist/storage/sqlite.d.ts.map +1 -1
  122. package/dist/storage/sqlite.js +357 -8
  123. package/dist/storage/sqlite.js.map +1 -1
  124. package/dist/storage/store.d.ts +63 -0
  125. package/dist/storage/store.d.ts.map +1 -0
  126. package/dist/storage/store.js +27 -0
  127. package/dist/storage/store.js.map +1 -0
  128. package/dist/types/engram.d.ts +92 -2
  129. package/dist/types/engram.d.ts.map +1 -1
  130. package/dist/types/engram.js.map +1 -1
  131. package/package.json +3 -1
  132. package/src/adapters/claude-code.ts +218 -218
  133. package/src/adapters/codex.ts +252 -252
  134. package/src/adapters/common.ts +498 -411
  135. package/src/adapters/cursor.ts +135 -135
  136. package/src/adapters/http.ts +93 -93
  137. package/src/adapters/index.ts +31 -31
  138. package/src/adapters/types.ts +75 -75
  139. package/src/api/index.ts +3 -3
  140. package/src/api/routes.ts +970 -714
  141. package/src/cli/migrate.ts +307 -0
  142. package/src/cli.ts +755 -719
  143. package/src/coordination/circuit-breaker.ts +83 -0
  144. package/src/coordination/events.ts +90 -90
  145. package/src/coordination/failure-modes.ts +50 -0
  146. package/src/coordination/peer-decisions.ts +105 -105
  147. package/src/coordination/plugin-loader.ts +60 -60
  148. package/src/coordination/plugin.ts +44 -44
  149. package/src/coordination/routes.ts +56 -1
  150. package/src/coordination/schema.ts +13 -0
  151. package/src/coordination/stale.ts +80 -11
  152. package/src/coordination/types.ts +311 -311
  153. package/src/coordination/write-mutex.ts +69 -69
  154. package/src/core/auto-tagger.ts +168 -168
  155. package/src/core/decay.ts +63 -63
  156. package/src/core/embeddings.ts +110 -93
  157. package/src/core/index.ts +5 -5
  158. package/src/core/logger.ts +36 -36
  159. package/src/core/ml-worker-entry.ts +194 -0
  160. package/src/core/ml-worker.ts +281 -0
  161. package/src/core/query-expander.ts +122 -128
  162. package/src/core/reranker.ts +119 -125
  163. package/src/core/salience.ts +200 -33
  164. package/src/core/write-pipeline.ts +521 -343
  165. package/src/engine/activation.ts +235 -109
  166. package/src/engine/confidence.ts +120 -0
  167. package/src/engine/connections.ts +162 -103
  168. package/src/engine/consolidation-scheduler.ts +242 -125
  169. package/src/engine/consolidation.ts +138 -45
  170. package/src/engine/eval.ts +102 -102
  171. package/src/engine/eviction.ts +101 -101
  172. package/src/engine/index.ts +8 -8
  173. package/src/engine/retraction.ts +366 -116
  174. package/src/engine/staging.ts +74 -74
  175. package/src/hooks/sidecar.ts +5 -5
  176. package/src/index.ts +226 -212
  177. package/src/mcp.ts +1145 -1121
  178. package/src/storage/factory.ts +147 -0
  179. package/src/storage/index.ts +3 -3
  180. package/src/storage/pglite-schema.ts +166 -0
  181. package/src/storage/pglite.ts +1363 -0
  182. package/src/storage/sqlite.ts +402 -7
  183. package/src/storage/store.ts +80 -0
  184. package/src/types/agent.ts +67 -67
  185. package/src/types/checkpoint.ts +46 -46
  186. package/src/types/engram.ts +101 -3
  187. package/src/types/eval.ts +100 -100
  188. package/src/types/index.ts +6 -6
@@ -1,75 +1,75 @@
1
- // Copyright 2026 Robert Winter / Complete Ideas
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- /**
5
- * Shared types for CLI adapters.
6
- *
7
- * Each AI CLI tool (Claude Code, Codex, Cursor, etc.) gets its own adapter
8
- * that implements CLIAdapter. The setup orchestrator in cli.ts delegates to
9
- * the selected adapter.
10
- */
11
-
12
- export interface SetupContext {
13
- /** Current working directory */
14
- cwd: string;
15
- /** Lowercase project name derived from cwd */
16
- projectName: string;
17
- /** Agent identifier for AWM */
18
- agentId: string;
19
- /** Absolute path to the SQLite database */
20
- dbPath: string;
21
- /** Absolute path to the AWM package root */
22
- packageRoot: string;
23
- /** Absolute path to dist/mcp.js (compiled entrypoint) */
24
- mcpDist: string;
25
- /** Absolute path to src/mcp.ts (dev entrypoint) */
26
- mcpScript: string;
27
- /** Whether dist/mcp.js exists (determines command strategy) */
28
- hasDist: boolean;
29
- /** Hook sidecar secret token */
30
- hookSecret: string;
31
- /** Hook sidecar port */
32
- hookPort: string;
33
- /** Whether to use global scope */
34
- isGlobal: boolean;
35
- /** Windows platform */
36
- isWindows: boolean;
37
- /** Pre-built environment variables for the MCP server */
38
- envVars: Record<string, string>;
39
- }
40
-
41
- export interface SetupResult {
42
- configAction: string;
43
- instructionsAction: string;
44
- hooksAction: string;
45
- }
46
-
47
- export interface DiagnosticResult {
48
- check: string;
49
- status: 'ok' | 'warn' | 'fail';
50
- message: string;
51
- fix?: string;
52
- }
53
-
54
- export interface CLIAdapter {
55
- /** Short identifier: 'claude-code', 'codex', 'cursor', 'http' */
56
- id: string;
57
- /** Display name for output */
58
- name: string;
59
- /** Does this adapter support project-level scope? */
60
- supportsProjectScope: boolean;
61
- /** Does this adapter support global scope? */
62
- supportsGlobalScope: boolean;
63
-
64
- /** Write the MCP server config for this CLI. Returns action summary. */
65
- writeMcpConfig(ctx: SetupContext): string;
66
-
67
- /** Write/append instruction content. Returns action summary. */
68
- writeInstructions(ctx: SetupContext, skip: boolean): string;
69
-
70
- /** Configure hooks (if supported). Returns action summary. */
71
- writeHooks(ctx: SetupContext, skip: boolean): string;
72
-
73
- /** Validate that the setup is healthy. */
74
- diagnose(ctx: SetupContext): DiagnosticResult[];
75
- }
1
+ // Copyright 2026 Robert Winter / Complete Ideas
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ /**
5
+ * Shared types for CLI adapters.
6
+ *
7
+ * Each AI CLI tool (Claude Code, Codex, Cursor, etc.) gets its own adapter
8
+ * that implements CLIAdapter. The setup orchestrator in cli.ts delegates to
9
+ * the selected adapter.
10
+ */
11
+
12
+ export interface SetupContext {
13
+ /** Current working directory */
14
+ cwd: string;
15
+ /** Lowercase project name derived from cwd */
16
+ projectName: string;
17
+ /** Agent identifier for AWM */
18
+ agentId: string;
19
+ /** Absolute path to the SQLite database */
20
+ dbPath: string;
21
+ /** Absolute path to the AWM package root */
22
+ packageRoot: string;
23
+ /** Absolute path to dist/mcp.js (compiled entrypoint) */
24
+ mcpDist: string;
25
+ /** Absolute path to src/mcp.ts (dev entrypoint) */
26
+ mcpScript: string;
27
+ /** Whether dist/mcp.js exists (determines command strategy) */
28
+ hasDist: boolean;
29
+ /** Hook sidecar secret token */
30
+ hookSecret: string;
31
+ /** Hook sidecar port */
32
+ hookPort: string;
33
+ /** Whether to use global scope */
34
+ isGlobal: boolean;
35
+ /** Windows platform */
36
+ isWindows: boolean;
37
+ /** Pre-built environment variables for the MCP server */
38
+ envVars: Record<string, string>;
39
+ }
40
+
41
+ export interface SetupResult {
42
+ configAction: string;
43
+ instructionsAction: string;
44
+ hooksAction: string;
45
+ }
46
+
47
+ export interface DiagnosticResult {
48
+ check: string;
49
+ status: 'ok' | 'warn' | 'fail';
50
+ message: string;
51
+ fix?: string;
52
+ }
53
+
54
+ export interface CLIAdapter {
55
+ /** Short identifier: 'claude-code', 'codex', 'cursor', 'http' */
56
+ id: string;
57
+ /** Display name for output */
58
+ name: string;
59
+ /** Does this adapter support project-level scope? */
60
+ supportsProjectScope: boolean;
61
+ /** Does this adapter support global scope? */
62
+ supportsGlobalScope: boolean;
63
+
64
+ /** Write the MCP server config for this CLI. Returns action summary. */
65
+ writeMcpConfig(ctx: SetupContext): string;
66
+
67
+ /** Write/append instruction content. Returns action summary. */
68
+ writeInstructions(ctx: SetupContext, skip: boolean): string;
69
+
70
+ /** Configure hooks (if supported). Returns action summary. */
71
+ writeHooks(ctx: SetupContext, skip: boolean): string;
72
+
73
+ /** Validate that the setup is healthy. */
74
+ diagnose(ctx: SetupContext): DiagnosticResult[];
75
+ }
package/src/api/index.ts CHANGED
@@ -1,3 +1,3 @@
1
- // Copyright 2026 Robert Winter / Complete Ideas
2
- // SPDX-License-Identifier: Apache-2.0
3
- export * from './routes.js';
1
+ // Copyright 2026 Robert Winter / Complete Ideas
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ export * from './routes.js';