@psiclawops/hypermem 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.
Files changed (94) hide show
  1. package/ARCHITECTURE.md +296 -0
  2. package/LICENSE +190 -0
  3. package/README.md +243 -0
  4. package/dist/background-indexer.d.ts +117 -0
  5. package/dist/background-indexer.d.ts.map +1 -0
  6. package/dist/background-indexer.js +732 -0
  7. package/dist/compaction-fence.d.ts +89 -0
  8. package/dist/compaction-fence.d.ts.map +1 -0
  9. package/dist/compaction-fence.js +153 -0
  10. package/dist/compositor.d.ts +139 -0
  11. package/dist/compositor.d.ts.map +1 -0
  12. package/dist/compositor.js +1109 -0
  13. package/dist/cross-agent.d.ts +57 -0
  14. package/dist/cross-agent.d.ts.map +1 -0
  15. package/dist/cross-agent.js +254 -0
  16. package/dist/db.d.ts +131 -0
  17. package/dist/db.d.ts.map +1 -0
  18. package/dist/db.js +398 -0
  19. package/dist/desired-state-store.d.ts +100 -0
  20. package/dist/desired-state-store.d.ts.map +1 -0
  21. package/dist/desired-state-store.js +212 -0
  22. package/dist/doc-chunk-store.d.ts +115 -0
  23. package/dist/doc-chunk-store.d.ts.map +1 -0
  24. package/dist/doc-chunk-store.js +278 -0
  25. package/dist/doc-chunker.d.ts +99 -0
  26. package/dist/doc-chunker.d.ts.map +1 -0
  27. package/dist/doc-chunker.js +324 -0
  28. package/dist/episode-store.d.ts +48 -0
  29. package/dist/episode-store.d.ts.map +1 -0
  30. package/dist/episode-store.js +135 -0
  31. package/dist/fact-store.d.ts +57 -0
  32. package/dist/fact-store.d.ts.map +1 -0
  33. package/dist/fact-store.js +175 -0
  34. package/dist/fleet-store.d.ts +144 -0
  35. package/dist/fleet-store.d.ts.map +1 -0
  36. package/dist/fleet-store.js +276 -0
  37. package/dist/hybrid-retrieval.d.ts +60 -0
  38. package/dist/hybrid-retrieval.d.ts.map +1 -0
  39. package/dist/hybrid-retrieval.js +340 -0
  40. package/dist/index.d.ts +611 -0
  41. package/dist/index.d.ts.map +1 -0
  42. package/dist/index.js +1042 -0
  43. package/dist/knowledge-graph.d.ts +110 -0
  44. package/dist/knowledge-graph.d.ts.map +1 -0
  45. package/dist/knowledge-graph.js +305 -0
  46. package/dist/knowledge-store.d.ts +72 -0
  47. package/dist/knowledge-store.d.ts.map +1 -0
  48. package/dist/knowledge-store.js +241 -0
  49. package/dist/library-schema.d.ts +22 -0
  50. package/dist/library-schema.d.ts.map +1 -0
  51. package/dist/library-schema.js +717 -0
  52. package/dist/message-store.d.ts +76 -0
  53. package/dist/message-store.d.ts.map +1 -0
  54. package/dist/message-store.js +273 -0
  55. package/dist/preference-store.d.ts +54 -0
  56. package/dist/preference-store.d.ts.map +1 -0
  57. package/dist/preference-store.js +109 -0
  58. package/dist/preservation-gate.d.ts +82 -0
  59. package/dist/preservation-gate.d.ts.map +1 -0
  60. package/dist/preservation-gate.js +150 -0
  61. package/dist/provider-translator.d.ts +40 -0
  62. package/dist/provider-translator.d.ts.map +1 -0
  63. package/dist/provider-translator.js +349 -0
  64. package/dist/rate-limiter.d.ts +76 -0
  65. package/dist/rate-limiter.d.ts.map +1 -0
  66. package/dist/rate-limiter.js +179 -0
  67. package/dist/redis.d.ts +188 -0
  68. package/dist/redis.d.ts.map +1 -0
  69. package/dist/redis.js +534 -0
  70. package/dist/schema.d.ts +15 -0
  71. package/dist/schema.d.ts.map +1 -0
  72. package/dist/schema.js +203 -0
  73. package/dist/secret-scanner.d.ts +51 -0
  74. package/dist/secret-scanner.d.ts.map +1 -0
  75. package/dist/secret-scanner.js +248 -0
  76. package/dist/seed.d.ts +108 -0
  77. package/dist/seed.d.ts.map +1 -0
  78. package/dist/seed.js +177 -0
  79. package/dist/system-store.d.ts +73 -0
  80. package/dist/system-store.d.ts.map +1 -0
  81. package/dist/system-store.js +182 -0
  82. package/dist/topic-store.d.ts +45 -0
  83. package/dist/topic-store.d.ts.map +1 -0
  84. package/dist/topic-store.js +136 -0
  85. package/dist/types.d.ts +329 -0
  86. package/dist/types.d.ts.map +1 -0
  87. package/dist/types.js +9 -0
  88. package/dist/vector-store.d.ts +132 -0
  89. package/dist/vector-store.d.ts.map +1 -0
  90. package/dist/vector-store.js +498 -0
  91. package/dist/work-store.d.ts +112 -0
  92. package/dist/work-store.d.ts.map +1 -0
  93. package/dist/work-store.js +273 -0
  94. package/package.json +57 -0
@@ -0,0 +1,296 @@
1
+ # HyperMem Architecture
2
+
3
+ _Agent-centric memory that outlives sessions._
4
+
5
+ ---
6
+
7
+ ## Memory Layers
8
+
9
+ ```
10
+ L1 Redis (Hot) Active session working memory
11
+ │ Slots: system, identity, messages, facts, context
12
+ │ Sub-millisecond reads, evicts on session end
13
+ │ Fleet cache: agent profiles, fleet summary
14
+
15
+ L2 Agent Messages DB Raw conversation history (per agent)
16
+ │ messages.db Write-heavy, rotatable (100MB / 90 days)
17
+ │ messages_YYYYQN.db Rotated archives, read-only
18
+
19
+ L3 Agent Vectors DB Semantic search index (per agent)
20
+ │ vectors.db Index rebuilt from L2+L4 (reconstructable)
21
+ │ KNN search via sqlite-vec (nomic-embed-text, 768d)
22
+ │ Rate-limited embedding via token bucket
23
+
24
+ L4 Library DB Fleet-wide structured knowledge
25
+ library.db Facts, knowledge, preferences, fleet registry
26
+ Episodes, topics, work items, system state
27
+ Desired state, agent capabilities
28
+ Knowledge graph (DAG links between entities)
29
+ ```
30
+
31
+ ## Database Schema
32
+
33
+ ### messages.db (per agent, schema v3)
34
+ - `agent_meta` — agent metadata
35
+ - `conversations` — session tracking
36
+ - `messages` — raw message log (text, tool calls, tool results)
37
+ - `schema_version` — migration tracking
38
+ - **Rotation:** When size > 100MB or age > 90 days, renamed to `messages_YYYYQN.db`
39
+ - **WAL mode** with checkpoint on rotation
40
+
41
+ ### vectors.db (per agent)
42
+ - `vec_facts` — 768-dimensional vectors for facts (sqlite-vec virtual table)
43
+ - `vec_knowledge` — vectors for knowledge entries
44
+ - `vec_episodes` — vectors for episode descriptions
45
+ - `vec_sessions` — vectors for session summaries
46
+ - `vec_index_map` — tracks what's been indexed (source_table, source_id, source_db)
47
+ - `embedding_cache` — avoids redundant Ollama API calls
48
+
49
+ ### library.db (shared, schema v5)
50
+ - `facts` — verifiable claims with confidence, domain, expiry, supersedes chains
51
+ - `knowledge` — domain/key/value structured data
52
+ - `knowledge_links` — DAG edges between entities (fact↔fact, fact↔knowledge, etc.)
53
+ - `episodes` — significant events with impact and participants
54
+ - `topics` — cross-session thread tracking
55
+ - `preferences` — operator/user behavioral patterns
56
+ - `fleet_agents` — agent registry with tier, org, capabilities (JSON)
57
+ - `fleet_orgs` — organizational structure
58
+ - `agent_capabilities` — queryable skills, tools, MCP servers per agent
59
+ - `agent_desired_state` — intended configuration vs. actual (drift detection)
60
+ - `agent_config_events` — change audit trail
61
+ - `system_registry` — service state tracking
62
+ - `system_events` — service lifecycle events
63
+ - `work_items` — work queue entries with FTS5
64
+ - `session_registry` — session lifecycle tracking
65
+
66
+ ## Compositor
67
+
68
+ Assembles LLM prompts from all four layers with token budgeting:
69
+
70
+ ```
71
+ User message arrives
72
+
73
+ ├── L1 Redis: system prompt, identity, cached slots
74
+ ├── L2 Messages: recent conversation history (budget-truncated)
75
+ ├── L3 Vectors: KNN semantic recall on user's latest message
76
+ │ └── Related facts/knowledge/episodes with relevance scores
77
+ ├── L4 Library: structured knowledge injection
78
+ │ ├── Facts (up to 30% of remaining budget): active, non-expired, sorted by confidence
79
+ │ ├── Knowledge (up to 20% of remaining): grouped by domain, top 15 entries
80
+ │ └── Preferences (up to 10% of remaining): behavioral patterns, grouped by subject
81
+ └── Cross-session (up to 20% of remaining): context from related sessions
82
+ ```
83
+
84
+ Each slot gets a proportional budget cap. Smart truncation at line boundaries.
85
+ Multi-provider output: Anthropic and OpenAI message formats.
86
+
87
+ ### Tuning Parameters (TUNE-001–007)
88
+
89
+ Compositor behavior is tuned via parameters tracked in `tune/TUNING_REGISTRY.md`:
90
+
91
+ | ID | Parameter | Value | Effect |
92
+ |---|---|---|---|
93
+ | TUNE-001 | Semantic recall min RRF score | 0.008 | Drops noise results from hybrid search |
94
+ | TUNE-002 | Facts confidence floor | 0.5 | Excludes low-confidence facts from injection |
95
+ | TUNE-003 | Differentiated fact confidence | 0.60–0.75 by type | Decisions/incidents score higher than config/prefs |
96
+ | TUNE-004 | config_change episode significance | 0.5 (was 0.4) | Config changes no longer silently dropped |
97
+ | TUNE-005 | Extraction slot guard | suppress on default | No-op when strategy is lightweight/default |
98
+ | TUNE-006 | Advisor slot guard | suppress bare seat list | No-op when no domain routes matched |
99
+ | TUNE-007 | Identity anchor guard | suppress on default identity | No-op when identity resolves to 'default' |
100
+
101
+ ### Safety Mechanisms
102
+
103
+ - **Budget safety valve:** Post-assembly check — if estimated tokens exceed budget × 1.05, trims oldest history messages until under budget. System/identity/current prompt are never touched.
104
+ - **Compaction fence:** Per-conversation boundary protecting the LLM's recent tail from compaction. Only moves forward (monotone progress). No fence = no compaction (explicit opt-in).
105
+ - **Preservation gate:** Nomic-space geometric verification that summaries stay faithful to source content. Centroid alignment + source coverage → combined score (threshold: 0.65).
106
+
107
+ ## Fleet Cache (Redis Hot Layer)
108
+
109
+ ```
110
+ fleet:agent:{id} — Composite profile: registry + capabilities + desired state
111
+ fleet:summary — Fleet-wide stats: agent count, drift count, tier breakdown
112
+ ```
113
+
114
+ - **Cache-aside** on reads: Redis first, SQLite fallback, warm on miss
115
+ - **Write-through invalidation** on fleet mutations
116
+ - **Hydration** on gateway startup: bulk-populate from library.db
117
+ - TTL: agent profiles 10min, summary 2min
118
+
119
+ ## Knowledge Graph
120
+
121
+ DAG traversal over `knowledge_links` for relationship discovery:
122
+
123
+ - **Entity types:** fact, knowledge, topic, episode, agent, preference
124
+ - **Link types:** supports, contradicts, supersedes, references, derived_from, depends_on, extends, covers, related, authored_by
125
+ - **BFS traversal:** configurable depth, result limit, direction filter, type filter
126
+ - **Shortest path:** between any two entities
127
+ - **Analytics:** most-connected entities, link count by type
128
+
129
+ ## Rate Limiter
130
+
131
+ Token-bucket rate limiter for embedding API calls:
132
+
133
+ - Burst capacity with steady refill (default: 5/s, burst 10)
134
+ - Priority queue: high (user-facing recall) > normal > low (batch indexing)
135
+ - Reserved tokens for high-priority requests
136
+ - `createRateLimitedEmbedder()` wraps any embedding function
137
+
138
+ ## Cross-Agent Access Control
139
+
140
+ Visibility-tiered access model for cross-agent knowledge queries:
141
+
142
+ - **`fleet`** — visible to all agents (default tier)
143
+ - **`org`** — visible to agents in the same organizational unit
144
+ - **`council`** — visible to council-tier agents and the org lead
145
+ - **`private`** — visible only to the owning agent
146
+
147
+ ### Org Registry
148
+
149
+ `visibilityFilter()` resolves access levels using an `OrgRegistry` — a mapping of agents to tiers, orgs, and capabilities. Currently loaded from a hardcoded `defaultOrgRegistry()` in `cross-agent.ts`.
150
+
151
+ **Known limitation:** This duplicates fleet structure that lives authoritatively in `fleet_agents` + `fleet_orgs` in library.db. Near-term roadmap item: replace with live-loaded registry from library.db, with the hardcoded version as cold-start fallback only.
152
+
153
+ ### Unknown Agent Fallback (Restrictive Default)
154
+
155
+ When a target agent is not found in the registry, `visibilityFilter()` applies a **restrictive default**: fleet-only visibility with a logged warning. This is a deliberate safety-side behavior — unknown agents see only fleet-visible data rather than failing the query entirely. The warning surfaces registry gaps for operators to fix.
156
+
157
+ This means:
158
+ - Queries succeed but return a narrowed result set
159
+ - New agents provisioned in the DB but not yet in the registry will have reduced cross-agent visibility until registered
160
+ - The warning message names the missing agent and suggests adding it to the registry
161
+
162
+ ## Context Engine Plugin
163
+
164
+ `plugin/src/index.ts` — OpenClaw context engine plugin (replaces basic hook integration):
165
+
166
+ ```
167
+ gateway:startup → Init HyperMem, auto-rotate DBs, hydrate fleet cache
168
+ agent:bootstrap → Warm session (history, facts, profile → Redis)
169
+ context:assemble → Full four-layer prompt assembly within token budget
170
+ agent:afterTurn → Ingest new messages to SQLite + Redis, trigger background indexer
171
+ ```
172
+
173
+ Registers with `ownsCompaction: true` — runtime skips legacy compaction entirely.
174
+ Deployed as managed hook at `~/.openclaw/hooks/hypermem-core/handler.js`.
175
+
176
+ ### Plugin Data Flow
177
+
178
+ ```
179
+ ┌──────────────────────────────────────────────────┐
180
+ │ REDIS (L1 Hot Layer) │
181
+ │ │
182
+ │ hm:{a}:{s}:history ── Session archive (250 cap │
183
+ │ (append-only) at bootstrap, 1000 soft │
184
+ │ cap ongoing) │
185
+ │ │
186
+ │ hm:{a}:{s}:window ── Submission buffer │
187
+ │ (compositor output) (120s TTL) │
188
+ │ │
189
+ │ hm:{a}:{s}:cursor ── Last-sent pointer │
190
+ │ (compositor metadata) (24h TTL) │
191
+ │ │
192
+ │ hm:{a}:{s}:system ── System prompt slot │
193
+ │ hm:{a}:{s}:identity ── Identity slot │
194
+ │ hm:{a}:{s}:facts ── Cached facts slot │
195
+ │ hm:{a}:{s}:context ── Cross-session slot │
196
+ └──────────────────────────────────────────────────┘
197
+
198
+ Data Flow (current — P0 stabilized, window/cursor active):
199
+
200
+ bootstrap() assemble() afterTurn()
201
+ ─────────── ────────── ───────────
202
+ ▸ sessionExists() → skip if hot compose() slice(prePromptCount)
203
+ ▸ SQLite ─→ warmSession() ─→ getHistory(limit) ✅ ─→ record*Message()
204
+ ─→ pushHistory(250) ─→ dedup by id ─→ pushHistory(1, dedup)
205
+ ─→ Redis :history ─→ budget assembly ─→ Redis :history
206
+ ─→ write :window (120s) ─→ invalidateWindow()
207
+ ─→ write :cursor (24h) ─→ background indexer
208
+ ─→ → runtime → provider
209
+
210
+ ### Key Invariants
211
+
212
+ 1. Redis `history` is the warm archive. Append-only. Nothing reads it for direct submission.
213
+ 2. Redis `window` is the compositor's output cache. Written ONLY by `compose()`. Read ONLY by `assemble()`. Invalidated by `afterTurn`.
214
+ 3. Redis `cursor` tracks the newest message in the last window. Used by background indexer for high-signal mining.
215
+ 4. `warmSession()` seeds `history` only (capped at 250). Never writes `window`.
216
+ 5. `pushHistory()` tail-checks before append (no duplicate IDs in Redis list).
217
+ 6. `compose()` deduplicates history by `id` before budget assembly.
218
+ 7. `getHistory()` honors its `limit` parameter on BOTH Redis and SQLite paths.
219
+
220
+ Design spec: `specs/HYPERMEM_QUEUE_SPLIT.md`
221
+ Incident history: `specs/HYPERMEM_INCIDENT_HISTORY.md`
222
+
223
+ ### Open Items (Tracked)
224
+
225
+ | Item | WQ | Status | Notes |
226
+ |---|---|---|---|
227
+ | Cross-session context boundary markers | WQ-20260402-001 | 🟡 OPEN | `buildCrossSessionContext()` renders flat previews, no per-message boundaries or sender identity. Incident 6. |
228
+ | Cursor durability (SQLite dual-write) | — | 🟡 DEFERRED | Cursor TTL = 24h. Dual-write to SQLite required before background indexer reads cursor. Gate 2. |
229
+ | Plugin type unification | — | 🟡 DEFERRED | Plugin uses dynamic imports; can't use TS types from core. Shims are intentional. Structural change needed. |
230
+ | ACA Step 4 — retrieval stubs replace static files | — | 🔲 PENDING | `systemPromptAddition` carries governance doc chunks instead of embedding full workspace files. Blocked on Step 3 ✅ |
231
+ | ACA Step 5 — governance context assembly | — | 🔲 PENDING | Full on-demand assembly replaces static prompt injection. Requires Step 4. |
232
+
233
+ ### Runtime Contract
234
+
235
+ **Exclusive dispatch:** The OpenClaw runtime calls either `afterTurn()` OR `ingest()`/`ingestBatch()`, never both. Since HyperMem implements `afterTurn`, it must handle message ingestion there. `ingest()` exists for API compatibility but is never called by the runtime in practice.
236
+
237
+ **Provider translation:** The plugin sets `skipProviderTranslation: true` on compose requests. The compositor returns NeutralMessages; the plugin converts to AgentMessages. The runtime handles provider-specific translation. Two-stage translation (compositor → provider format → plugin → agent format) was the root cause of Incident 1 (silent tool call drops).
238
+
239
+ ## Module Map (29 files, ~12,300 lines)
240
+
241
+ | Module | Lines | Layer | Purpose |
242
+ |---|---|---|---|
243
+ | `index.ts` | ~1,340 | All | Facade — all public API |
244
+ | `compositor.ts` | ~1,140 | L1-L4 | Prompt assembly + token budgeting + safety valve + window/cursor write |
245
+ | `library-schema.ts` | ~780 | L4 | Library schema v5 + migrations |
246
+ | `background-indexer.ts` | ~680 | L2-L4 | LLM-powered extraction framework |
247
+ | `vector-store.ts` | ~600 | L3 | Semantic search + embedding |
248
+ | `hybrid-retrieval.ts` | ~450 | L3-L4 | FTS5 + KNN with Reciprocal Rank Fusion |
249
+ | `fleet-store.ts` | ~440 | L4 | Fleet registry + capabilities |
250
+ | `db.ts` | ~440 | - | Database manager + rotation |
251
+ | `knowledge-graph.ts` | ~420 | L4 | DAG traversal + shortest path |
252
+ | `redis.ts` | ~530 | L1 | Redis operations, window cache, cursor, fleet cache |
253
+ | `doc-chunker.ts` | ~400 | - | Section-aware markdown/file parser |
254
+ | `work-store.ts` | ~400 | L4 | Work queue + FTS5 |
255
+ | `provider-translator.ts` | ~390 | - | Neutral ↔ provider format conversion |
256
+ | `doc-chunk-store.ts` | ~375 | L4 | Chunk storage + deduplication |
257
+ | `message-store.ts` | ~370 | L2 | Conversation recording + querying |
258
+ | `types.ts` | ~370 | - | Shared type definitions + SessionCursor |
259
+ | `cross-agent.ts` | ~330 | L2-L4 | Cross-agent knowledge queries + visibility |
260
+ | `desired-state-store.ts` | ~310 | L4 | Config drift detection |
261
+ | `knowledge-store.ts` | ~300 | L4 | Domain/key/value structured data |
262
+ | `secret-scanner.ts` | ~285 | - | Credential/secret detection |
263
+ | `system-store.ts` | ~250 | L4 | Service state tracking |
264
+ | `seed.ts` | ~250 | L4 | Workspace seeder + collection inference |
265
+ | `fact-store.ts` | ~230 | L4 | Facts with confidence + expiry |
266
+ | `rate-limiter.ts` | ~230 | L3 | Token-bucket for embedding API |
267
+ | `schema.ts` | ~200 | L2 | Messages schema + migrations |
268
+ | `episode-store.ts` | ~180 | L4 | Significant event tracking |
269
+ | `preference-store.ts` | ~170 | L4 | Operator behavioral patterns |
270
+ | `topic-store.ts` | ~160 | L4 | Cross-session thread tracking |
271
+ | `plugin/src/index.ts` | ~590 | - | OpenClaw context engine plugin + window invalidation |
272
+
273
+ ## Test Coverage (105 assertions, 11 suites)
274
+
275
+ _Test count reflects assertions, not individual test blocks. Suites contain inline assertions._
276
+
277
+ | Suite | Key coverage |
278
+ |---|---|
279
+ | smoke | End-to-end create/write/read/close, provider translation |
280
+ | redis-integration | Redis ops, slots, history limits, window cache, cursor, warming, dedup |
281
+ | cross-agent | Cross-agent queries, fleet search, visibility tiers |
282
+ | vector-search | Embedding, KNN, batch indexing |
283
+ | library | All L4 collections (facts → desired state) |
284
+ | compositor | Four-layer composition, budgets, providers, safety valve, Gate 1 |
285
+ | fleet-cache | Redis fleet cache, hydration, cache-aside |
286
+ | rotation | DB rotation, auto-rotate, collision handling |
287
+ | knowledge-graph | DAG traversal, shortest path, analytics |
288
+ | rate-limiter | Token bucket, priority, timeout, embedder |
289
+ | doc-chunker | Markdown/file chunking, section-aware parsing, seeder |
290
+
291
+ ## Dependencies
292
+
293
+ - `node:sqlite` (Node 22+ built-in) — zero-dependency SQLite
294
+ - `ioredis` — Redis client
295
+ - `sqlite-vec` — optional, vector search extension
296
+ - Ollama (localhost:11434) — optional, embedding generation
package/LICENSE ADDED
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to the Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by the Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding any notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2026 PsiClawOps
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.