@props-labs/mesh-os 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,219 @@
1
+ /**
2
+ * Taxonomy and classification models for MeshOS.
3
+ */
4
+ import { z } from 'zod';
5
+ /**
6
+ * Primary data type classification.
7
+ */
8
+ export declare enum DataType {
9
+ ACTIVITY = "activity",// Agent & system actions
10
+ KNOWLEDGE = "knowledge",// Structured information
11
+ DECISION = "decision",// Strategic & operational choices
12
+ MEDIA = "media"
13
+ }
14
+ /**
15
+ * Subtypes for activity data.
16
+ */
17
+ export declare enum ActivitySubtype {
18
+ AGENT_CONVERSATION = "agent-conversation",// Structured record of agent interactions
19
+ AGENT_LOG = "agent-log",// System-level agent actions
20
+ EXECUTION_LOG = "execution-log",// Action execution records
21
+ EVENT_LOG = "event-log",// System events and notifications
22
+ WORKFLOW_STEP = "workflow-step"
23
+ }
24
+ /**
25
+ * Subtypes for knowledge data.
26
+ */
27
+ export declare enum KnowledgeSubtype {
28
+ COMPANY_METADATA = "company-metadata",// Core company information
29
+ COMPANY_MISSION = "company-mission",// Company's core purpose
30
+ COMPANY_VISION = "company-vision",// Strategic direction
31
+ AGENT_MISSION = "agent-mission",// Agent's specific role
32
+ AGENT_VISION = "agent-vision",// Agent's long-term goals
33
+ RESEARCH_REPORT = "research-report",// Analysis and findings
34
+ FAQ_ENTRY = "faq-entry",// Common QA entries
35
+ DATASET = "dataset",// Structured data collections
36
+ OKRS = "okrs"
37
+ }
38
+ /**
39
+ * Subtypes for decision data.
40
+ */
41
+ export declare enum DecisionSubtype {
42
+ POLICY_UPDATE = "policy-update",// Policy changes
43
+ COMPANY_STRATEGY = "company-strategy",// Strategic initiatives
44
+ SYSTEM_DECISION = "system-decision",// System-level choices
45
+ USER_FEEDBACK_DECISION = "user-feedback-decision"
46
+ }
47
+ /**
48
+ * Subtypes for media data.
49
+ */
50
+ export declare enum MediaSubtype {
51
+ IMAGE = "image",// Image files
52
+ VIDEO = "video",// Video content
53
+ TEXT_DOCUMENT = "text-document",// Text-based documents
54
+ GENERATED_CONTENT = "generated-content"
55
+ }
56
+ /**
57
+ * Standard relationship types for memory edges.
58
+ */
59
+ export declare enum EdgeType {
60
+ RELATED_TO = "related_to",// Generic association
61
+ VERSION_OF = "version_of",// Updated version
62
+ FOLLOWS_UP = "follows_up",// Sequential relationship
63
+ CONTRADICTS = "contradicts",// Conflicting information
64
+ DEPENDS_ON = "depends_on",// Prerequisite relationship
65
+ SUMMARIZES = "summarizes",// Condensed version
66
+ INFLUENCES = "influences"
67
+ }
68
+ /**
69
+ * Relevance classification tags.
70
+ */
71
+ export declare enum RelevanceTag {
72
+ HIGH_RELEVANCE = "high-relevance",
73
+ TIME_SENSITIVE = "time-sensitive",
74
+ ARCHIVAL = "archival",
75
+ VOLATILE = "volatile",
76
+ EXPERIMENTAL = "experimental"
77
+ }
78
+ /**
79
+ * Version history entry.
80
+ */
81
+ export interface VersionInfo {
82
+ version: number;
83
+ modifiedAt: Date;
84
+ modifiedBy: string;
85
+ }
86
+ /**
87
+ * Standardized metadata structure for memories.
88
+ */
89
+ export declare const memoryMetadataSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
90
+ type: z.ZodNativeEnum<typeof DataType>;
91
+ subtype: z.ZodString;
92
+ tags: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
93
+ relevance: z.ZodOptional<z.ZodNativeEnum<typeof RelevanceTag>>;
94
+ validUntil: z.ZodOptional<z.ZodDate>;
95
+ version: z.ZodDefault<z.ZodNumber>;
96
+ history: z.ZodDefault<z.ZodArray<z.ZodObject<{
97
+ version: z.ZodNumber;
98
+ modifiedAt: z.ZodDate;
99
+ modifiedBy: z.ZodString;
100
+ }, "strip", z.ZodTypeAny, {
101
+ version: number;
102
+ modifiedAt: Date;
103
+ modifiedBy: string;
104
+ }, {
105
+ version: number;
106
+ modifiedAt: Date;
107
+ modifiedBy: string;
108
+ }>, "many">>;
109
+ previousVersion: z.ZodOptional<z.ZodString>;
110
+ additional: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
111
+ }, "strip", z.ZodTypeAny, {
112
+ type: DataType;
113
+ subtype: string;
114
+ tags: string[];
115
+ version: number;
116
+ history: {
117
+ version: number;
118
+ modifiedAt: Date;
119
+ modifiedBy: string;
120
+ }[];
121
+ additional: Record<string, unknown>;
122
+ relevance?: RelevanceTag | undefined;
123
+ validUntil?: Date | undefined;
124
+ previousVersion?: string | undefined;
125
+ }, {
126
+ type: DataType;
127
+ subtype: string;
128
+ tags?: string[] | undefined;
129
+ relevance?: RelevanceTag | undefined;
130
+ validUntil?: Date | undefined;
131
+ version?: number | undefined;
132
+ history?: {
133
+ version: number;
134
+ modifiedAt: Date;
135
+ modifiedBy: string;
136
+ }[] | undefined;
137
+ previousVersion?: string | undefined;
138
+ additional?: Record<string, unknown> | undefined;
139
+ }>, {
140
+ type: DataType;
141
+ subtype: string;
142
+ tags: string[];
143
+ version: number;
144
+ history: {
145
+ version: number;
146
+ modifiedAt: Date;
147
+ modifiedBy: string;
148
+ }[];
149
+ additional: Record<string, unknown>;
150
+ relevance?: RelevanceTag | undefined;
151
+ validUntil?: Date | undefined;
152
+ previousVersion?: string | undefined;
153
+ }, {
154
+ type: DataType;
155
+ subtype: string;
156
+ tags?: string[] | undefined;
157
+ relevance?: RelevanceTag | undefined;
158
+ validUntil?: Date | undefined;
159
+ version?: number | undefined;
160
+ history?: {
161
+ version: number;
162
+ modifiedAt: Date;
163
+ modifiedBy: string;
164
+ }[] | undefined;
165
+ previousVersion?: string | undefined;
166
+ additional?: Record<string, unknown> | undefined;
167
+ }>, {
168
+ type: DataType;
169
+ subtype: string;
170
+ tags: string[];
171
+ version: number;
172
+ history: {
173
+ version: number;
174
+ modifiedAt: Date;
175
+ modifiedBy: string;
176
+ }[];
177
+ additional: Record<string, unknown>;
178
+ relevance?: RelevanceTag | undefined;
179
+ validUntil?: Date | undefined;
180
+ previousVersion?: string | undefined;
181
+ }, {
182
+ type: DataType;
183
+ subtype: string;
184
+ tags?: string[] | undefined;
185
+ relevance?: RelevanceTag | undefined;
186
+ validUntil?: Date | undefined;
187
+ version?: number | undefined;
188
+ history?: {
189
+ version: number;
190
+ modifiedAt: Date;
191
+ modifiedBy: string;
192
+ }[] | undefined;
193
+ previousVersion?: string | undefined;
194
+ additional?: Record<string, unknown> | undefined;
195
+ }>;
196
+ export type MemoryMetadata = z.infer<typeof memoryMetadataSchema>;
197
+ /**
198
+ * Metadata structure for memory edges.
199
+ */
200
+ export declare const edgeMetadataSchema: z.ZodObject<{
201
+ relationship: z.ZodNativeEnum<typeof EdgeType>;
202
+ weight: z.ZodDefault<z.ZodNumber>;
203
+ validUntil: z.ZodOptional<z.ZodDate>;
204
+ bidirectional: z.ZodDefault<z.ZodBoolean>;
205
+ additional: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
206
+ }, "strip", z.ZodTypeAny, {
207
+ additional: Record<string, unknown>;
208
+ relationship: EdgeType;
209
+ weight: number;
210
+ bidirectional: boolean;
211
+ validUntil?: Date | undefined;
212
+ }, {
213
+ relationship: EdgeType;
214
+ validUntil?: Date | undefined;
215
+ additional?: Record<string, unknown> | undefined;
216
+ weight?: number | undefined;
217
+ bidirectional?: boolean | undefined;
218
+ }>;
219
+ export type EdgeMetadata = z.infer<typeof edgeMetadataSchema>;
@@ -0,0 +1,131 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.edgeMetadataSchema = exports.memoryMetadataSchema = exports.RelevanceTag = exports.EdgeType = exports.MediaSubtype = exports.DecisionSubtype = exports.KnowledgeSubtype = exports.ActivitySubtype = exports.DataType = void 0;
4
+ /**
5
+ * Taxonomy and classification models for MeshOS.
6
+ */
7
+ const zod_1 = require("zod");
8
+ /**
9
+ * Primary data type classification.
10
+ */
11
+ var DataType;
12
+ (function (DataType) {
13
+ DataType["ACTIVITY"] = "activity";
14
+ DataType["KNOWLEDGE"] = "knowledge";
15
+ DataType["DECISION"] = "decision";
16
+ DataType["MEDIA"] = "media";
17
+ })(DataType || (exports.DataType = DataType = {}));
18
+ /**
19
+ * Subtypes for activity data.
20
+ */
21
+ var ActivitySubtype;
22
+ (function (ActivitySubtype) {
23
+ ActivitySubtype["AGENT_CONVERSATION"] = "agent-conversation";
24
+ ActivitySubtype["AGENT_LOG"] = "agent-log";
25
+ ActivitySubtype["EXECUTION_LOG"] = "execution-log";
26
+ ActivitySubtype["EVENT_LOG"] = "event-log";
27
+ ActivitySubtype["WORKFLOW_STEP"] = "workflow-step";
28
+ })(ActivitySubtype || (exports.ActivitySubtype = ActivitySubtype = {}));
29
+ /**
30
+ * Subtypes for knowledge data.
31
+ */
32
+ var KnowledgeSubtype;
33
+ (function (KnowledgeSubtype) {
34
+ KnowledgeSubtype["COMPANY_METADATA"] = "company-metadata";
35
+ KnowledgeSubtype["COMPANY_MISSION"] = "company-mission";
36
+ KnowledgeSubtype["COMPANY_VISION"] = "company-vision";
37
+ KnowledgeSubtype["AGENT_MISSION"] = "agent-mission";
38
+ KnowledgeSubtype["AGENT_VISION"] = "agent-vision";
39
+ KnowledgeSubtype["RESEARCH_REPORT"] = "research-report";
40
+ KnowledgeSubtype["FAQ_ENTRY"] = "faq-entry";
41
+ KnowledgeSubtype["DATASET"] = "dataset";
42
+ KnowledgeSubtype["OKRS"] = "okrs";
43
+ })(KnowledgeSubtype || (exports.KnowledgeSubtype = KnowledgeSubtype = {}));
44
+ /**
45
+ * Subtypes for decision data.
46
+ */
47
+ var DecisionSubtype;
48
+ (function (DecisionSubtype) {
49
+ DecisionSubtype["POLICY_UPDATE"] = "policy-update";
50
+ DecisionSubtype["COMPANY_STRATEGY"] = "company-strategy";
51
+ DecisionSubtype["SYSTEM_DECISION"] = "system-decision";
52
+ DecisionSubtype["USER_FEEDBACK_DECISION"] = "user-feedback-decision";
53
+ })(DecisionSubtype || (exports.DecisionSubtype = DecisionSubtype = {}));
54
+ /**
55
+ * Subtypes for media data.
56
+ */
57
+ var MediaSubtype;
58
+ (function (MediaSubtype) {
59
+ MediaSubtype["IMAGE"] = "image";
60
+ MediaSubtype["VIDEO"] = "video";
61
+ MediaSubtype["TEXT_DOCUMENT"] = "text-document";
62
+ MediaSubtype["GENERATED_CONTENT"] = "generated-content";
63
+ })(MediaSubtype || (exports.MediaSubtype = MediaSubtype = {}));
64
+ /**
65
+ * Standard relationship types for memory edges.
66
+ */
67
+ var EdgeType;
68
+ (function (EdgeType) {
69
+ EdgeType["RELATED_TO"] = "related_to";
70
+ EdgeType["VERSION_OF"] = "version_of";
71
+ EdgeType["FOLLOWS_UP"] = "follows_up";
72
+ EdgeType["CONTRADICTS"] = "contradicts";
73
+ EdgeType["DEPENDS_ON"] = "depends_on";
74
+ EdgeType["SUMMARIZES"] = "summarizes";
75
+ EdgeType["INFLUENCES"] = "influences";
76
+ })(EdgeType || (exports.EdgeType = EdgeType = {}));
77
+ /**
78
+ * Relevance classification tags.
79
+ */
80
+ var RelevanceTag;
81
+ (function (RelevanceTag) {
82
+ RelevanceTag["HIGH_RELEVANCE"] = "high-relevance";
83
+ RelevanceTag["TIME_SENSITIVE"] = "time-sensitive";
84
+ RelevanceTag["ARCHIVAL"] = "archival";
85
+ RelevanceTag["VOLATILE"] = "volatile";
86
+ RelevanceTag["EXPERIMENTAL"] = "experimental";
87
+ })(RelevanceTag || (exports.RelevanceTag = RelevanceTag = {}));
88
+ /**
89
+ * Standardized metadata structure for memories.
90
+ */
91
+ exports.memoryMetadataSchema = zod_1.z.object({
92
+ type: zod_1.z.nativeEnum(DataType),
93
+ subtype: zod_1.z.string(),
94
+ tags: zod_1.z.array(zod_1.z.string()).default([]),
95
+ relevance: zod_1.z.nativeEnum(RelevanceTag).optional(),
96
+ validUntil: zod_1.z.date().optional(),
97
+ version: zod_1.z.number().default(1),
98
+ history: zod_1.z.array(zod_1.z.object({
99
+ version: zod_1.z.number(),
100
+ modifiedAt: zod_1.z.date(),
101
+ modifiedBy: zod_1.z.string(),
102
+ })).default([]),
103
+ previousVersion: zod_1.z.string().optional(),
104
+ additional: zod_1.z.record(zod_1.z.unknown()).default({}),
105
+ }).refine((data) => {
106
+ // Validate subtype based on the primary type
107
+ const typeSubtypes = {
108
+ [DataType.ACTIVITY]: Object.values(ActivitySubtype),
109
+ [DataType.KNOWLEDGE]: Object.values(KnowledgeSubtype),
110
+ [DataType.DECISION]: Object.values(DecisionSubtype),
111
+ [DataType.MEDIA]: Object.values(MediaSubtype),
112
+ };
113
+ return typeSubtypes[data.type].includes(data.subtype);
114
+ }, {
115
+ message: 'Invalid subtype for the given type',
116
+ }).refine((data) => {
117
+ // Validate tag format
118
+ return data.tags.every(tag => tag === tag.toLowerCase() && !tag.includes(' '));
119
+ }, {
120
+ message: 'Tags must be lowercase and use hyphens instead of spaces',
121
+ });
122
+ /**
123
+ * Metadata structure for memory edges.
124
+ */
125
+ exports.edgeMetadataSchema = zod_1.z.object({
126
+ relationship: zod_1.z.nativeEnum(EdgeType),
127
+ weight: zod_1.z.number().min(0).max(1).default(1.0),
128
+ validUntil: zod_1.z.date().optional(),
129
+ bidirectional: zod_1.z.boolean().default(false),
130
+ additional: zod_1.z.record(zod_1.z.unknown()).default({}),
131
+ });
@@ -0,0 +1,6 @@
1
+ /**
2
+ * MeshOS - A lightweight multi-agent memory system with semantic search.
3
+ */
4
+ export { Agent, Memory, MemoryEdge, MeshOS, GraphQLError, InvalidSlugError, type MeshOSConfig } from './core/client';
5
+ export { DataType, ActivitySubtype, KnowledgeSubtype, DecisionSubtype, MediaSubtype, EdgeType, RelevanceTag, type VersionInfo, type MemoryMetadata, type EdgeMetadata, } from './core/taxonomy';
6
+ export declare const VERSION = "0.1.6";
package/dist/index.js ADDED
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ /**
3
+ * MeshOS - A lightweight multi-agent memory system with semantic search.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.VERSION = exports.RelevanceTag = exports.EdgeType = exports.MediaSubtype = exports.DecisionSubtype = exports.KnowledgeSubtype = exports.ActivitySubtype = exports.DataType = exports.InvalidSlugError = exports.GraphQLError = exports.MeshOS = void 0;
7
+ var client_1 = require("./core/client");
8
+ Object.defineProperty(exports, "MeshOS", { enumerable: true, get: function () { return client_1.MeshOS; } });
9
+ Object.defineProperty(exports, "GraphQLError", { enumerable: true, get: function () { return client_1.GraphQLError; } });
10
+ Object.defineProperty(exports, "InvalidSlugError", { enumerable: true, get: function () { return client_1.InvalidSlugError; } });
11
+ var taxonomy_1 = require("./core/taxonomy");
12
+ // Data types
13
+ Object.defineProperty(exports, "DataType", { enumerable: true, get: function () { return taxonomy_1.DataType; } });
14
+ Object.defineProperty(exports, "ActivitySubtype", { enumerable: true, get: function () { return taxonomy_1.ActivitySubtype; } });
15
+ Object.defineProperty(exports, "KnowledgeSubtype", { enumerable: true, get: function () { return taxonomy_1.KnowledgeSubtype; } });
16
+ Object.defineProperty(exports, "DecisionSubtype", { enumerable: true, get: function () { return taxonomy_1.DecisionSubtype; } });
17
+ Object.defineProperty(exports, "MediaSubtype", { enumerable: true, get: function () { return taxonomy_1.MediaSubtype; } });
18
+ Object.defineProperty(exports, "EdgeType", { enumerable: true, get: function () { return taxonomy_1.EdgeType; } });
19
+ Object.defineProperty(exports, "RelevanceTag", { enumerable: true, get: function () { return taxonomy_1.RelevanceTag; } });
20
+ exports.VERSION = '0.1.6';
package/dist/main.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/main.js ADDED
@@ -0,0 +1,146 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ var __importDefault = (this && this.__importDefault) || function (mod) {
37
+ return (mod && mod.__esModule) ? mod : { "default": mod };
38
+ };
39
+ Object.defineProperty(exports, "__esModule", { value: true });
40
+ const commander_1 = require("commander");
41
+ const path = __importStar(require("path"));
42
+ const fs = __importStar(require("fs-extra"));
43
+ const chalk_1 = __importDefault(require("chalk"));
44
+ const child_process_1 = require("child_process");
45
+ const program = new commander_1.Command();
46
+ program
47
+ .name('mesh-os')
48
+ .description('CLI to manage MeshOS Docker setup and examples')
49
+ .version('0.1.0');
50
+ program
51
+ .command('init')
52
+ .description('Initialize a new MeshOS project')
53
+ .argument('<project-name>', 'Name of the project')
54
+ .action(async (projectName) => {
55
+ const targetDir = path.join(process.cwd(), projectName);
56
+ if (fs.existsSync(targetDir)) {
57
+ console.error(chalk_1.default.red(`Error: Directory ${projectName} already exists`));
58
+ process.exit(1);
59
+ }
60
+ console.log(chalk_1.default.blue(`Creating new project: ${projectName}`));
61
+ try {
62
+ // Create project directory
63
+ fs.mkdirSync(targetDir);
64
+ // Copy templates
65
+ const templatesDir = path.join(__dirname, 'templates');
66
+ await fs.copy(path.join(templatesDir, 'docker-compose.yml'), path.join(targetDir, 'docker-compose.yml'));
67
+ await fs.copy(path.join(templatesDir, 'hasura'), path.join(targetDir, 'hasura'));
68
+ // Create examples directory
69
+ const examplesDir = path.join(targetDir, 'examples');
70
+ fs.mkdirSync(examplesDir);
71
+ await fs.copy(path.join(templatesDir, 'examples'), examplesDir);
72
+ console.log(chalk_1.default.green('✓ Project files created'));
73
+ console.log(chalk_1.default.blue('\nNext steps:'));
74
+ console.log(`1. cd ${projectName}`);
75
+ console.log('2. mesh-os up');
76
+ console.log('3. Set your OPENAI_API_KEY in .env');
77
+ }
78
+ catch (error) {
79
+ console.error(chalk_1.default.red('Error creating project:'), error);
80
+ process.exit(1);
81
+ }
82
+ });
83
+ program
84
+ .command('up')
85
+ .description('Start MeshOS services')
86
+ .action(async () => {
87
+ if (!fs.existsSync('docker-compose.yml')) {
88
+ console.error(chalk_1.default.red('Error: docker-compose.yml not found. Are you in a MeshOS project directory?'));
89
+ process.exit(1);
90
+ }
91
+ console.log(chalk_1.default.blue('Starting MeshOS services...'));
92
+ try {
93
+ // Stop any existing containers and remove volumes
94
+ await runCommand('docker', ['compose', 'down', '-v']);
95
+ // Start services
96
+ const up = (0, child_process_1.spawn)('docker', ['compose', 'up', '-d'], { stdio: 'inherit' });
97
+ up.on('close', (code) => {
98
+ if (code === 0) {
99
+ console.log(chalk_1.default.green('\n✓ Services started successfully!'));
100
+ console.log(chalk_1.default.blue('\nServices available at:'));
101
+ console.log('• GraphQL API: http://localhost:8080/v1/graphql');
102
+ console.log('• Hasura Console: http://localhost:8080/console');
103
+ }
104
+ else {
105
+ console.error(chalk_1.default.red('\nError starting services'));
106
+ process.exit(1);
107
+ }
108
+ });
109
+ }
110
+ catch (error) {
111
+ console.error(chalk_1.default.red('Error:'), error);
112
+ process.exit(1);
113
+ }
114
+ });
115
+ program
116
+ .command('down')
117
+ .description('Stop MeshOS services')
118
+ .action(async () => {
119
+ if (!fs.existsSync('docker-compose.yml')) {
120
+ console.error(chalk_1.default.red('Error: docker-compose.yml not found. Are you in a MeshOS project directory?'));
121
+ process.exit(1);
122
+ }
123
+ console.log(chalk_1.default.blue('Stopping MeshOS services...'));
124
+ try {
125
+ await runCommand('docker', ['compose', 'down']);
126
+ console.log(chalk_1.default.green('✓ Services stopped successfully'));
127
+ }
128
+ catch (error) {
129
+ console.error(chalk_1.default.red('Error:'), error);
130
+ process.exit(1);
131
+ }
132
+ });
133
+ async function runCommand(command, args) {
134
+ return new Promise((resolve, reject) => {
135
+ const proc = (0, child_process_1.spawn)(command, args, { stdio: 'inherit' });
136
+ proc.on('close', (code) => {
137
+ if (code === 0) {
138
+ resolve();
139
+ }
140
+ else {
141
+ reject(new Error(`Command failed with code ${code}`));
142
+ }
143
+ });
144
+ });
145
+ }
146
+ program.parse();
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "@props-labs/mesh-os",
3
+ "version": "0.1.7",
4
+ "description": "MeshOS - A memory system for AI agents",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "bin": {
8
+ "mesh-os": "./dist/main.js"
9
+ },
10
+ "files": [
11
+ "dist",
12
+ "src/templates"
13
+ ],
14
+ "keywords": [
15
+ "ai",
16
+ "memory",
17
+ "agents",
18
+ "hasura",
19
+ "pgvector",
20
+ "openai"
21
+ ],
22
+ "author": "Props Labs",
23
+ "license": "MIT",
24
+ "dependencies": {
25
+ "boxen": "^7.1.1",
26
+ "chalk": "^4.1.2",
27
+ "commander": "^11.1.0",
28
+ "dotenv": "^16.3.1",
29
+ "fs-extra": "^11.2.0",
30
+ "openai": "^4.28.0",
31
+ "zod": "^3.22.4"
32
+ },
33
+ "devDependencies": {
34
+ "@types/fs-extra": "^11.0.4",
35
+ "@types/node": "^20.10.5",
36
+ "@typescript-eslint/eslint-plugin": "^6.15.0",
37
+ "@typescript-eslint/parser": "^6.15.0",
38
+ "eslint": "^8.56.0",
39
+ "vitest": "^1.2.2",
40
+ "ts-node": "^10.9.2",
41
+ "typescript": "^5.3.3"
42
+ },
43
+ "publishConfig": {
44
+ "access": "public"
45
+ },
46
+ "packageManager": "pnpm@9.15.4+sha512.b2dc20e2fc72b3e18848459b37359a32064663e5627a51e4c74b2c29dd8e8e0491483c3abb40789cfd578bf362fb6ba8261b05f0387d76792ed6e23ea3b1b6a0",
47
+ "scripts": {
48
+ "build": "tsc",
49
+ "start": "ts-node src/main.ts",
50
+ "lint": "eslint . --ext .ts",
51
+ "test": "vitest run",
52
+ "test:watch": "vitest"
53
+ }
54
+ }
@@ -0,0 +1,18 @@
1
+ # PostgreSQL Configuration
2
+ POSTGRES_PASSWORD=mysecretpassword
3
+ POSTGRES_DB=mesh_os
4
+ POSTGRES_PORT=5432
5
+
6
+ # Hasura Configuration
7
+ HASURA_URL=http://localhost:8080/v1/graphql
8
+ HASURA_ADMIN_SECRET=meshos
9
+ HASURA_PORT=8080
10
+ HASURA_ENABLE_CONSOLE=true
11
+
12
+ # OpenAI Configuration (Required)
13
+ # Get your API key at: https://platform.openai.com/api-keys
14
+ OPENAI_API_KEY=your-api-key-here
15
+
16
+ # Vector Search Configuration
17
+ SIMILARITY_THRESHOLD=0.7
18
+ MAX_RESULTS=10
@@ -0,0 +1,55 @@
1
+ services:
2
+ postgres:
3
+ image: pgvector/pgvector:pg15
4
+ container_name: mesh_os_postgres
5
+ environment:
6
+ POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-mysecretpassword}
7
+ POSTGRES_DB: mesh_os
8
+ POSTGRES_INITDB_ARGS: "--data-checksums"
9
+ command: >
10
+ bash -c "
11
+ echo 'Creating extensions...' &&
12
+ docker-entrypoint.sh postgres &
13
+ until pg_isready -U postgres; do sleep 1; done &&
14
+ psql -U postgres -d mesh_os -c 'CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\"; CREATE EXTENSION IF NOT EXISTS vector;' &&
15
+ wait
16
+ "
17
+ ports:
18
+ - "${POSTGRES_PORT:-5432}:5432"
19
+ volumes:
20
+ - postgres_data:/var/lib/postgresql/data
21
+ healthcheck:
22
+ test: ["CMD-SHELL", "pg_isready -U postgres"]
23
+ interval: 10s
24
+ timeout: 5s
25
+ retries: 10
26
+ start_period: 30s
27
+ restart: unless-stopped
28
+
29
+ hasura:
30
+ image: hasura/graphql-engine:v2.33.4
31
+ container_name: mesh_os_hasura
32
+ ports:
33
+ - "${HASURA_PORT:-8080}:8080"
34
+ depends_on:
35
+ postgres:
36
+ condition: service_healthy
37
+ environment:
38
+ HASURA_GRAPHQL_DATABASE_URL: postgres://postgres:${POSTGRES_PASSWORD:-mysecretpassword}@postgres:5432/mesh_os
39
+ HASURA_GRAPHQL_ADMIN_SECRET: ${HASURA_ADMIN_SECRET:-meshos}
40
+ HASURA_GRAPHQL_ENABLE_CONSOLE: ${HASURA_ENABLE_CONSOLE:-true}
41
+ HASURA_GRAPHQL_CONSOLE_ASSETS_DIR: /srv/console-assets
42
+ HASURA_GRAPHQL_DEV_MODE: "true"
43
+ HASURA_GRAPHQL_ENABLED_LOG_TYPES: startup, http-log, webhook-log, websocket-log, query-log
44
+ HASURA_GRAPHQL_CORS_DOMAIN: "*"
45
+ HASURA_GRAPHQL_METADATA_DATABASE_URL: postgres://postgres:${POSTGRES_PASSWORD:-mysecretpassword}@postgres:5432/mesh_os
46
+ healthcheck:
47
+ test: ["CMD", "wget", "--spider", "http://localhost:8080/healthz"]
48
+ interval: 15s
49
+ timeout: 10s
50
+ retries: 10
51
+ start_period: 40s
52
+ restart: unless-stopped
53
+
54
+ volumes:
55
+ postgres_data:
@@ -0,0 +1,9 @@
1
+ version: 3
2
+ endpoint: http://hasura:8080
3
+ admin_secret: meshos
4
+ metadata_directory: metadata
5
+ migrations_directory: migrations
6
+ seeds_directory: seeds
7
+ actions:
8
+ kind: synchronous
9
+ handler_webhook_baseurl: http://localhost:3000