@props-labs/mesh-os 0.1.7
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 +201 -0
- package/README.md +258 -0
- package/dist/core/client.d.ts +142 -0
- package/dist/core/client.js +581 -0
- package/dist/core/taxonomy.d.ts +219 -0
- package/dist/core/taxonomy.js +131 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +20 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.js +146 -0
- package/package.json +54 -0
- package/src/templates/.env.example +18 -0
- package/src/templates/docker-compose.yml +55 -0
- package/src/templates/hasura/config.yaml +9 -0
- package/src/templates/hasura/metadata/config.yaml +1 -0
- package/src/templates/hasura/metadata/databases/databases.yaml +15 -0
- package/src/templates/hasura/metadata/databases/default/tables/public_agents.yaml +14 -0
- package/src/templates/hasura/metadata/databases/default/tables/public_memories.yaml +17 -0
- package/src/templates/hasura/metadata/databases/default/tables/public_memory_edges.yaml +57 -0
- package/src/templates/hasura/metadata/databases/default/tables/tables.yaml +54 -0
- package/src/templates/hasura/metadata/databases/default/tables/track_tables.yaml +14 -0
- package/src/templates/hasura/metadata/metadata.json +80 -0
- package/src/templates/hasura/metadata/version.yaml +1 -0
- package/src/templates/hasura/migrations/default/1_init/down.sql +13 -0
- package/src/templates/hasura/migrations/default/1_init/up.sql +218 -0
package/LICENSE
ADDED
@@ -0,0 +1,201 @@
|
|
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 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 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 those 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
|
+
APPENDIX: How to apply the Apache License to your work.
|
179
|
+
|
180
|
+
To apply the Apache License to your work, attach the following
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
182
|
+
replaced with your own identifying information. (Don't include
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
184
|
+
comment syntax for the file format. We also recommend that a
|
185
|
+
file or class name and description of purpose be included on the
|
186
|
+
same "printed page" as the copyright notice for easier
|
187
|
+
identification within third-party archives.
|
188
|
+
|
189
|
+
Copyright [2023] [Taranjeet Singh]
|
190
|
+
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
192
|
+
you may not use this file except in compliance with the License.
|
193
|
+
You may obtain a copy of the License at
|
194
|
+
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
196
|
+
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200
|
+
See the License for the specific language governing permissions and
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
@@ -0,0 +1,258 @@
|
|
1
|
+

|
2
|
+
|
3
|
+
> [!WARNING]
|
4
|
+
> This is the **experimental TypeScript version** of MeshOS. For the stable Python implementation, please visit [Props-Labs/mesh-os](https://github.com/Props-Labs/mesh-os).
|
5
|
+
>
|
6
|
+
> The TypeScript version is under active development and APIs may change frequently. For production use, we recommend using the Python version.
|
7
|
+
|
8
|
+
# MeshOS
|
9
|
+
|
10
|
+
**The Memory & Knowledge Engine for Multi-Agent Systems**
|
11
|
+
|
12
|
+
MeshOS is a **developer-first framework** for building **multi-agent AI-driven operations** with structured memory, knowledge retrieval, and real-time collaboration. Unlike generic memory stores, MeshOS is purpose-built for:
|
13
|
+
|
14
|
+
- **Autonomous Agents & Teams** – Agents and humans evolve a shared memory over time.
|
15
|
+
- **Graph-Based Memory** – Track relationships, dependencies, and evolving knowledge.
|
16
|
+
- **Fast Semantic Search** – Vector-based retrieval with **pgvector**.
|
17
|
+
- **Event-Driven Execution** – Automate workflows based on evolving context.
|
18
|
+
- **Versioned Knowledge** – Track updates, past decisions, and historical context.
|
19
|
+
- **Open & Portable** – Runs on **PostgreSQL + Hasura** with no vendor lock-in.
|
20
|
+
|
21
|
+
## Why MeshOS?
|
22
|
+
|
23
|
+
Most frameworks give you a **blob of memories**—MeshOS gives you **structured, evolving intelligence** with deep relationships and versioning.
|
24
|
+
|
25
|
+
| Feature | MeshOS | Mem0 / Letta / Zep |
|
26
|
+
| ---------------------------- | ------ | ------------------ |
|
27
|
+
| **Multi-Agent Memory** | ✅ Yes | ❌ No |
|
28
|
+
| **Structured Taxonomy** | ✅ Yes | ❌ No |
|
29
|
+
| **Versioned Knowledge** | ✅ Yes | ❌ No |
|
30
|
+
| **Graph-Based Relationships** | ✅ Yes | ❌ No |
|
31
|
+
| **Semantic & Vector Search** | ✅ Yes | ✅ Partial |
|
32
|
+
| **Event-Driven Execution** | ✅ Yes | ❌ No |
|
33
|
+
| **Open-Source & Portable** | ✅ Yes | ✅ Partial |
|
34
|
+
|
35
|
+
### **Who is MeshOS for?**
|
36
|
+
|
37
|
+
✅ **Builders of AI-powered operations** – Structured memory and decision-making for AI-driven systems.
|
38
|
+
✅ **Multi-agent system developers** – AI agents that need to store, process, and evolve shared knowledge.
|
39
|
+
✅ **Developers & engineers** – Wanting an **open-source, PostgreSQL-powered framework** with no lock-in.
|
40
|
+
|
41
|
+
---
|
42
|
+
|
43
|
+
```mermaid
|
44
|
+
flowchart LR
|
45
|
+
%% Main System
|
46
|
+
subgraph MeshOS[MeshOS System]
|
47
|
+
direction LR
|
48
|
+
|
49
|
+
%% Taxonomy Details
|
50
|
+
subgraph Taxonomy[Memory Classification]
|
51
|
+
direction TB
|
52
|
+
|
53
|
+
subgraph DataTypes[Data Types]
|
54
|
+
direction LR
|
55
|
+
knowledge[Knowledge Type]
|
56
|
+
activity[Activity Type]
|
57
|
+
decision[Decision Type]
|
58
|
+
media[Media Type]
|
59
|
+
end
|
60
|
+
|
61
|
+
subgraph Subtypes[Example Subtypes]
|
62
|
+
direction LR
|
63
|
+
k_types[Research/Mission/Vision]
|
64
|
+
a_types[Conversations/Logs/Events]
|
65
|
+
d_types[Policies/Strategies]
|
66
|
+
m_types[Documents/Images]
|
67
|
+
|
68
|
+
knowledge --> k_types
|
69
|
+
activity --> a_types
|
70
|
+
decision --> d_types
|
71
|
+
media --> m_types
|
72
|
+
end
|
73
|
+
|
74
|
+
subgraph Relations[Edge Types]
|
75
|
+
direction LR
|
76
|
+
basic[related_to/version_of]
|
77
|
+
semantic[influences/depends_on]
|
78
|
+
temporal[follows_up/precedes]
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
%% Memory Operations
|
83
|
+
subgraph MemoryEngine[Memory Operations]
|
84
|
+
direction LR
|
85
|
+
rememberAction[Store/Remember]
|
86
|
+
recallAction[Search/Recall]
|
87
|
+
linkAction[Link Memories]
|
88
|
+
versioning[Version Control]
|
89
|
+
|
90
|
+
rememberAction --> recallAction
|
91
|
+
recallAction --> linkAction
|
92
|
+
linkAction --> versioning
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
%% Organization & Agents
|
97
|
+
subgraph Organization[Organization & Agents]
|
98
|
+
direction TB
|
99
|
+
|
100
|
+
%% Company Memory
|
101
|
+
subgraph CompanyMemory[Company-Wide Memory]
|
102
|
+
direction LR
|
103
|
+
corpVision[Company Vision]
|
104
|
+
corpMission[Company Mission]
|
105
|
+
corpData[Knowledge Base]
|
106
|
+
end
|
107
|
+
|
108
|
+
%% Agents
|
109
|
+
subgraph Agent1[Research Agent]
|
110
|
+
a1Mem[Research Memories]
|
111
|
+
end
|
112
|
+
|
113
|
+
subgraph Agent2[Service Agent]
|
114
|
+
a2Mem[Service Memories]
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
%% System Connections
|
119
|
+
Taxonomy --> MemoryEngine
|
120
|
+
MemoryEngine --> Organization
|
121
|
+
|
122
|
+
%% Memory Connections
|
123
|
+
corpVision -.->|influences| a1Mem
|
124
|
+
corpMission -.->|guides| a2Mem
|
125
|
+
a1Mem -.->|shares| a2Mem
|
126
|
+
a2Mem -.->|feedback| corpData
|
127
|
+
a1Mem -.->|versions| corpData
|
128
|
+
|
129
|
+
%% Styling
|
130
|
+
classDef system fill:#dfeff9,stroke:#333,stroke-width:1.5px
|
131
|
+
classDef engine fill:#fcf8e3,stroke:#333
|
132
|
+
classDef taxonomy fill:#e7f5e9,stroke:#333
|
133
|
+
classDef types fill:#f8f4ff,stroke:#333
|
134
|
+
classDef org fill:#f4f4f4,stroke:#333
|
135
|
+
|
136
|
+
class MeshOS system
|
137
|
+
class MemoryEngine engine
|
138
|
+
class Taxonomy,DataTypes,Subtypes,Relations taxonomy
|
139
|
+
class Organization org
|
140
|
+
```
|
141
|
+
|
142
|
+
---
|
143
|
+
|
144
|
+
## Getting Started
|
145
|
+
|
146
|
+
### Install & Create a New Instance
|
147
|
+
```bash
|
148
|
+
# Install the CLI tool
|
149
|
+
npm install -g @props-labs/mesh-os
|
150
|
+
|
151
|
+
# Create and start a new project
|
152
|
+
mesh-os init my-project && cd my-project
|
153
|
+
mesh-os up
|
154
|
+
```
|
155
|
+
|
156
|
+
## Usage
|
157
|
+
```typescript
|
158
|
+
import { MeshOS } from '@props-labs/mesh-os';
|
159
|
+
import dotenv from 'dotenv';
|
160
|
+
|
161
|
+
// Load environment variables
|
162
|
+
dotenv.config();
|
163
|
+
|
164
|
+
// Initialize MeshOS
|
165
|
+
const client = new MeshOS({
|
166
|
+
url: process.env.HASURA_URL || 'http://localhost:8080',
|
167
|
+
apiKey: process.env.HASURA_ADMIN_SECRET || 'meshos',
|
168
|
+
openaiApiKey: process.env.OPENAI_API_KEY
|
169
|
+
});
|
170
|
+
|
171
|
+
// Register an agent with a slug
|
172
|
+
const agent = await client.registerAgent(
|
173
|
+
'AI_Explorer',
|
174
|
+
'An agent for exploring data',
|
175
|
+
{ role: 'explorer' },
|
176
|
+
'ai-explorer'
|
177
|
+
);
|
178
|
+
|
179
|
+
// Store structured knowledge
|
180
|
+
const memory = await client.remember(
|
181
|
+
'The Moon has water ice.',
|
182
|
+
agent.id,
|
183
|
+
{
|
184
|
+
type: 'knowledge',
|
185
|
+
subtype: 'fact',
|
186
|
+
tags: ['astronomy', 'moon'],
|
187
|
+
version: 1
|
188
|
+
}
|
189
|
+
);
|
190
|
+
|
191
|
+
// Retrieve similar knowledge
|
192
|
+
const results = await client.recall('Tell me about the Moon.', {
|
193
|
+
agentId: agent.id,
|
194
|
+
limit: 5,
|
195
|
+
threshold: 0.7
|
196
|
+
});
|
197
|
+
```
|
198
|
+
|
199
|
+
---
|
200
|
+
|
201
|
+
## 🏗️ Core Features
|
202
|
+
|
203
|
+
✅ **Memory for Multi-Agent Systems** – Let agents store, retrieve, and link structured knowledge.
|
204
|
+
✅ **Fast Semantic Search** – pgvector-powered similarity matching across all memories.
|
205
|
+
✅ **Graph-Based Knowledge** – Build evolving relationships between facts, ideas, and actions.
|
206
|
+
✅ **Versioning Built-In** – Track updates, past decisions, and context shifts.
|
207
|
+
✅ **Event-Driven Execution** – Automate workflows based on new knowledge.
|
208
|
+
✅ **Open & Portable** – Runs anywhere PostgreSQL does. No black-box infrastructure.
|
209
|
+
|
210
|
+
---
|
211
|
+
|
212
|
+
## 🔗 Structured Taxonomy & Memory Graph
|
213
|
+
|
214
|
+
MeshOS **enforces structured knowledge** with **memory classification** and **versioning**:
|
215
|
+
|
216
|
+
| **Memory Type** | **Examples** |
|
217
|
+
| --------------- | -------------------------------------------- |
|
218
|
+
| **Knowledge** | Research reports, datasets, concepts |
|
219
|
+
| **Activity** | Agent workflows, logs, system events |
|
220
|
+
| **Decision** | Policy updates, business strategy |
|
221
|
+
| **Media** | Documents, images, AI-generated content |
|
222
|
+
|
223
|
+
Memories **evolve** over time, with full versioning and relationship tracking.
|
224
|
+
|
225
|
+
---
|
226
|
+
|
227
|
+
## 🛠️ Development & Configuration
|
228
|
+
|
229
|
+
### **Configuration**
|
230
|
+
```ini
|
231
|
+
# Required
|
232
|
+
OPENAI_API_KEY=your_api_key_here
|
233
|
+
|
234
|
+
# Optional (defaults shown)
|
235
|
+
POSTGRES_PASSWORD=mysecretpassword
|
236
|
+
HASURA_ADMIN_SECRET=meshos
|
237
|
+
POSTGRES_PORT=5432
|
238
|
+
HASURA_PORT=8080
|
239
|
+
HASURA_ENABLE_CONSOLE=true
|
240
|
+
```
|
241
|
+
|
242
|
+
### **Development**
|
243
|
+
```bash
|
244
|
+
git clone https://github.com/props-labs/mesh-os.git
|
245
|
+
cd mesh-os
|
246
|
+
pnpm install
|
247
|
+
pnpm build
|
248
|
+
pnpm test
|
249
|
+
```
|
250
|
+
|
251
|
+
### **Contributing**
|
252
|
+
Contributions are welcome! Please submit a Pull Request.
|
253
|
+
|
254
|
+
---
|
255
|
+
|
256
|
+
## ⚖️ License
|
257
|
+
This project is licensed under the MIT License – see [LICENSE](./LICENSE) for details.
|
258
|
+
|
@@ -0,0 +1,142 @@
|
|
1
|
+
import { EdgeType, type EdgeMetadata, type MemoryMetadata } from './taxonomy';
|
2
|
+
/**
|
3
|
+
* An agent in the system.
|
4
|
+
*/
|
5
|
+
export interface Agent {
|
6
|
+
id: string;
|
7
|
+
name: string;
|
8
|
+
description: string;
|
9
|
+
metadata: Record<string, unknown>;
|
10
|
+
status: string;
|
11
|
+
slug?: string;
|
12
|
+
}
|
13
|
+
/**
|
14
|
+
* A memory stored in the system.
|
15
|
+
*/
|
16
|
+
export interface Memory {
|
17
|
+
id: string;
|
18
|
+
agentId: string;
|
19
|
+
content: string;
|
20
|
+
metadata: MemoryMetadata;
|
21
|
+
embedding: number[];
|
22
|
+
createdAt: string;
|
23
|
+
updatedAt: string;
|
24
|
+
similarity?: number;
|
25
|
+
}
|
26
|
+
/**
|
27
|
+
* A connection between two memories.
|
28
|
+
*/
|
29
|
+
export interface MemoryEdge {
|
30
|
+
id: string;
|
31
|
+
sourceMemory: string;
|
32
|
+
targetMemory: string;
|
33
|
+
relationship: EdgeType;
|
34
|
+
weight: number;
|
35
|
+
createdAt: string;
|
36
|
+
metadata: EdgeMetadata;
|
37
|
+
}
|
38
|
+
/**
|
39
|
+
* GraphQL error class.
|
40
|
+
*/
|
41
|
+
export declare class GraphQLError extends Error {
|
42
|
+
constructor(message: string);
|
43
|
+
}
|
44
|
+
/**
|
45
|
+
* Invalid slug error class.
|
46
|
+
*/
|
47
|
+
export declare class InvalidSlugError extends Error {
|
48
|
+
constructor(message: string);
|
49
|
+
}
|
50
|
+
/**
|
51
|
+
* MeshOS client configuration.
|
52
|
+
*/
|
53
|
+
export interface MeshOSConfig {
|
54
|
+
url?: string;
|
55
|
+
apiKey?: string;
|
56
|
+
openaiApiKey?: string;
|
57
|
+
}
|
58
|
+
/**
|
59
|
+
* MeshOS client for interacting with the system.
|
60
|
+
*/
|
61
|
+
export declare class MeshOS {
|
62
|
+
private url;
|
63
|
+
private headers;
|
64
|
+
private openai;
|
65
|
+
constructor(config?: MeshOSConfig);
|
66
|
+
private validateSlug;
|
67
|
+
/**
|
68
|
+
* Execute a GraphQL query.
|
69
|
+
*/
|
70
|
+
private executeQuery;
|
71
|
+
/**
|
72
|
+
* Create an embedding for the given text.
|
73
|
+
*/
|
74
|
+
private createEmbedding;
|
75
|
+
/**
|
76
|
+
* Register a new agent in the system.
|
77
|
+
*/
|
78
|
+
registerAgent(name: string, description: string, metadata?: Record<string, unknown>, slug?: string): Promise<Agent>;
|
79
|
+
/**
|
80
|
+
* Get agent details by slug.
|
81
|
+
*/
|
82
|
+
getAgentBySlug(slug: string): Promise<Agent | null>;
|
83
|
+
/**
|
84
|
+
* Unregister an agent and remove all their memories.
|
85
|
+
*/
|
86
|
+
unregisterAgent(agentId: string): Promise<boolean>;
|
87
|
+
/**
|
88
|
+
* Get agent details by ID.
|
89
|
+
*/
|
90
|
+
getAgent(agentId: string): Promise<Agent | null>;
|
91
|
+
/**
|
92
|
+
* Store a new memory.
|
93
|
+
*/
|
94
|
+
remember(content: string, agentId: string, metadata?: Partial<MemoryMetadata>): Promise<Memory>;
|
95
|
+
/**
|
96
|
+
* Delete a specific memory.
|
97
|
+
*/
|
98
|
+
forget(memoryId: string): Promise<boolean>;
|
99
|
+
/**
|
100
|
+
* Create a link between two memories.
|
101
|
+
*/
|
102
|
+
linkMemories(sourceMemoryId: string, targetMemoryId: string, relationship: EdgeType, weight?: number, metadata?: Partial<EdgeMetadata>): Promise<MemoryEdge>;
|
103
|
+
/**
|
104
|
+
* Remove links between two memories.
|
105
|
+
*/
|
106
|
+
unlinkMemories(sourceMemoryId: string, targetMemoryId: string, relationship?: string): Promise<boolean>;
|
107
|
+
/**
|
108
|
+
* Update a memory and optionally create a version edge to the previous version.
|
109
|
+
*/
|
110
|
+
updateMemory(memoryId: string, content: string, metadata?: Partial<MemoryMetadata>, createVersionEdge?: boolean): Promise<Memory>;
|
111
|
+
/**
|
112
|
+
* Get memories connected to the given memory.
|
113
|
+
*/
|
114
|
+
getConnectedMemories(memoryId: string, relationship?: string, maxDepth?: number): Promise<Array<{
|
115
|
+
source_id: string;
|
116
|
+
target_id: string;
|
117
|
+
relationship: string;
|
118
|
+
weight: number;
|
119
|
+
depth: number;
|
120
|
+
}>>;
|
121
|
+
/**
|
122
|
+
* Generate semantic variations of the query.
|
123
|
+
*/
|
124
|
+
private expandQuery;
|
125
|
+
/**
|
126
|
+
* Search memories by semantic similarity.
|
127
|
+
*/
|
128
|
+
recall(options: {
|
129
|
+
query: string;
|
130
|
+
agentId?: string;
|
131
|
+
limit?: number;
|
132
|
+
threshold?: number;
|
133
|
+
minResults?: number;
|
134
|
+
adaptiveThreshold?: boolean;
|
135
|
+
useSemanticExpansion?: boolean;
|
136
|
+
filters?: Record<string, unknown>;
|
137
|
+
}): Promise<Memory[]>;
|
138
|
+
/**
|
139
|
+
* Internal method to perform recall with a specific threshold.
|
140
|
+
*/
|
141
|
+
private recallWithThreshold;
|
142
|
+
}
|