@little-samo/samo-ai-sdk 0.1.0-rv9 → 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 (44) hide show
  1. package/README.md +123 -11
  2. package/dist/dto/entities/agents/agent.d.ts +6 -4
  3. package/dist/dto/entities/agents/agent.preset.d.ts +1 -1
  4. package/dist/dto/entities/agents/agent.requests.d.ts +18 -34
  5. package/dist/dto/entities/agents/agent.requests.js +4 -14
  6. package/dist/dto/entities/agents/agent.requests.js.map +1 -1
  7. package/dist/dto/entities/index.d.ts +1 -0
  8. package/dist/dto/entities/index.js +1 -0
  9. package/dist/dto/entities/index.js.map +1 -1
  10. package/dist/dto/entities/users/index.d.ts +0 -1
  11. package/dist/dto/entities/users/index.js +0 -1
  12. package/dist/dto/entities/users/index.js.map +1 -1
  13. package/dist/dto/entities/users/user.d.ts +4 -0
  14. package/dist/dto/items/item.rankings.d.ts +3 -3
  15. package/dist/dto/locations/index.d.ts +1 -1
  16. package/dist/dto/locations/index.js +1 -1
  17. package/dist/dto/locations/index.js.map +1 -1
  18. package/dist/dto/locations/location.d.ts +16 -18
  19. package/dist/dto/locations/location.events.d.ts +10 -17
  20. package/dist/dto/locations/location.events.js +0 -1
  21. package/dist/dto/locations/location.events.js.map +1 -1
  22. package/dist/dto/locations/location.messages.d.ts +1 -2
  23. package/dist/dto/locations/location.messages.js +0 -15
  24. package/dist/dto/locations/location.messages.js.map +1 -1
  25. package/dist/dto/locations/location.preset.d.ts +1 -1
  26. package/dist/dto/locations/location.requests.d.ts +37 -207
  27. package/dist/dto/locations/location.requests.js +11 -61
  28. package/dist/dto/locations/location.requests.js.map +1 -1
  29. package/dist/models/locations/location.config.d.ts +3 -47
  30. package/dist/models/locations/location.config.js +21 -38
  31. package/dist/models/locations/location.config.js.map +1 -1
  32. package/dist/models/locations/location.constants.d.ts +0 -8
  33. package/dist/models/locations/location.constants.js +1 -8
  34. package/dist/models/locations/location.constants.js.map +1 -1
  35. package/package.json +1 -1
  36. package/dist/dto/entities/users/user.requests.d.ts +0 -13
  37. package/dist/dto/entities/users/user.requests.js +0 -13
  38. package/dist/dto/entities/users/user.requests.js.map +0 -1
  39. package/dist/dto/locations/location.message.d.ts +0 -13
  40. package/dist/dto/locations/location.message.js +0 -3
  41. package/dist/dto/locations/location.message.js.map +0 -1
  42. package/dist/index.d.ts +0 -2
  43. package/dist/index.js +0 -19
  44. package/dist/index.js.map +0 -1
package/README.md CHANGED
@@ -1,43 +1,155 @@
1
1
  <div align="center">
2
2
  <img src="https://media.githubusercontent.com/media/little-samo/CI/master/assets/characters/samo/profile.png" alt="Little Samo Mascot" width="250" />
3
- <h1>SamoAI SDK</h1>
4
- <p><em>TypeScript SDK for <a href="https://github.com/little-samo/SamoAI">@little-samo/samo-ai</a> with comprehensive DTOs and configuration models</em></p>
3
+ <h1>SamoAI Repository Storage</h1>
4
+ <p><em>File system-based repository implementations for <a href="https://github.com/little-samo/SamoAI">@little-samo/samo-ai</a></em></p>
5
5
  </div>
6
6
 
7
7
  <p align="center">
8
8
  <a href="#features">Features</a> •
9
9
  <a href="#installation">Installation</a> •
10
+ <a href="#usage">Usage</a> •
11
+ <a href="#file-structure">File Structure</a> •
10
12
  <a href="#learn-more">Learn More</a> •
11
13
  <a href="#license">License</a>
12
14
  </p>
13
15
 
14
16
  ## Features
15
17
 
16
- - **Type-safe DTOs** for all SamoAI entities (Agents, Users, Locations, Items)
17
- - **Zod validation schemas** for runtime type checking
18
- - **Configuration models** with comprehensive validation
19
- - **Event system** for real-time updates
20
- - **Request/Response types** for API interactions
21
- - **Full TypeScript support** with strict type checking
18
+ - File system-based storage for SamoAI entities
19
+ - Persistent memory and state management
20
+ - Support for agents, users, locations, items, and gimmicks
21
+ - TypeScript support with full type safety
22
22
 
23
23
  ## Installation
24
24
 
25
25
  Install the package using npm:
26
26
 
27
27
  ```bash
28
- npm install @little-samo/samo-ai-sdk
28
+ npm install @little-samo/samo-ai-repository-storage
29
29
  ```
30
30
 
31
31
  Or using yarn:
32
32
 
33
33
  ```bash
34
- yarn add @little-samo/samo-ai-sdk
34
+ yarn add @little-samo/samo-ai-repository-storage
35
35
  ```
36
36
 
37
+ ## Usage
38
+
39
+ ### Basic Setup
40
+
41
+ ```typescript
42
+ import {
43
+ AgentStorage,
44
+ UserStorage,
45
+ LocationStorage,
46
+ ItemStorage,
47
+ GimmickStorage
48
+ } from '@little-samo/samo-ai-repository-storage';
49
+ import { WorldManager } from '@little-samo/samo-ai';
50
+
51
+ // Initialize storage instances
52
+ const agentStorage = new AgentStorage(
53
+ './models/agents', // Path to agent model files
54
+ './states/agents' // Path to agent state files
55
+ );
56
+
57
+ const userStorage = new UserStorage(
58
+ './models/users',
59
+ './states/users'
60
+ );
61
+
62
+ const locationStorage = new LocationStorage(
63
+ './models/locations',
64
+ './states/locations'
65
+ );
66
+
67
+ const itemStorage = new ItemStorage(
68
+ './states/items' // Only state path needed for items
69
+ );
70
+
71
+ const gimmickStorage = new GimmickStorage(
72
+ './states/gimmicks' // Only state path needed for gimmicks
73
+ );
74
+
75
+ // Initialize with existing data
76
+ await agentStorage.initialize(['samo', 'nyx']); // Load samo.json and nyx.json
77
+ await userStorage.initialize(['lucid']); // Load lucid.json
78
+ await locationStorage.initialize(['empty']);
79
+ await itemStorage.initialize(['agent:1', 'user:1']); // Initialize inventories
80
+ await gimmickStorage.initialize([1]); // Initialize gimmicks for location
81
+
82
+ // Initialize WorldManager with all repositories
83
+ WorldManager.initialize({
84
+ agentRepository: agentStorage,
85
+ gimmickRepository: gimmickStorage,
86
+ itemRepository: itemStorage,
87
+ locationRepository: locationStorage,
88
+ userRepository: userStorage,
89
+ });
90
+ ```
91
+
92
+ ### Environment Configuration
93
+
94
+ To use LLM features, you need to configure API keys for the supported platforms. Set the following environment variables:
95
+
96
+ - **OpenAI**: `OPENAI_API_KEY=your_openai_api_key`
97
+ - **Gemini**: `GEMINI_API_KEY=your_gemini_api_key`
98
+ - **Anthropic**: `ANTHROPIC_API_KEY=your_anthropic_api_key`
99
+
100
+ You can set these in several ways:
101
+
102
+ - Set environment variables directly: `OPENAI_API_KEY=sk-... node your-app.js`
103
+ - Use dotenv package with a `.env` file:
104
+ ```
105
+ OPENAI_API_KEY=sk-...
106
+ GEMINI_API_KEY=AI...
107
+ ANTHROPIC_API_KEY=sk-ant-...
108
+ ```
109
+ - Set them in your system environment
110
+
111
+ **Note**: Currently, API keys are shared across all users. In a production environment, you would typically store user-specific API keys.
112
+
113
+ ## File Structure
114
+
115
+ The storage system expects the following directory structure:
116
+
117
+ ```
118
+ your-project/
119
+ ├── models/
120
+ │ ├── agents/
121
+ │ │ ├── samo.json
122
+ │ │ └── nyx.json
123
+ │ ├── users/
124
+ │ │ └── lucid.json
125
+ │ └── locations/
126
+ │ └── empty.json
127
+ └── states/
128
+ ├── agents/
129
+ │ ├── samo.json
130
+ │ └── nyx.json
131
+ ├── users/
132
+ │ └── lucid.json
133
+ ├── locations/
134
+ │ └── empty.json
135
+ ├── items/
136
+ │ ├── items_agent_1.json
137
+ │ └── items_user_1.json
138
+ └── gimmicks/
139
+ └── gimmicks_1.json
140
+ ```
141
+
142
+ - **models/**: Static entity definitions (agents, users, locations only) - **Must be created manually**
143
+ - **states/**: Dynamic runtime data that changes during execution - **Created automatically if missing**
144
+ - **items/**: Inventory data per entity (format: `items_{entityType}_{entityId}.json`)
145
+ - **gimmicks/**: Gimmick states per location (format: `gimmicks_{locationId}.json`)
146
+
147
+ **Note**: Items and gimmicks don't have model files - they are created and managed entirely through the state files. The `states/` directories will be automatically created during initialization if they don't exist.
148
+
37
149
  ## Learn More
38
150
 
39
151
  - [SamoAI Core Library](https://github.com/little-samo/SamoAI) - The main SamoAI framework
40
- - [SamoAI Example CLI](https://github.com/little-samo/SamoAI-Example-CLI) - Example implementation
152
+ - [SamoAI Example CLI](https://github.com/little-samo/SamoAI-Example-CLI) - Example implementation using this storage library
41
153
 
42
154
  ## License
43
155
 
@@ -1,11 +1,13 @@
1
1
  import { AgentId, UserId } from '@little-samo/samo-ai';
2
2
  import { AgentConfig } from '@little-samo/samo-ai-sdk/models';
3
- export interface AgentPublicDto {
3
+ import { EntityDto } from '../entity';
4
+ export interface AgentDto extends EntityDto {
5
+ id: AgentId;
6
+ }
7
+ export interface AgentPrivateDto {
4
8
  id: AgentId;
5
9
  name: string;
6
- avatar: string;
10
+ username: string | null;
7
11
  ownerUserId: UserId;
8
- }
9
- export interface AgentPrivateDto extends AgentPublicDto {
10
12
  config: AgentConfig;
11
13
  }
@@ -4,7 +4,7 @@ export interface AgentPresetDto {
4
4
  presetName: string;
5
5
  presetShortDescription: string;
6
6
  presetDescription: string;
7
- config: Partial<AgentConfig>;
7
+ config: AgentConfig;
8
8
  createdAt: Date;
9
9
  updatedAt: Date;
10
10
  }
@@ -1,16 +1,15 @@
1
- import { AgentConfig } from '@little-samo/samo-ai-sdk/models';
2
1
  import { z } from 'zod';
3
- import { AgentPrivateDto, AgentPublicDto } from './agent';
2
+ import { AgentPrivateDto } from './agent';
4
3
  import { AgentPresetDto } from './agent.preset';
5
4
  export declare const AgentsPaginationQuerySchema: z.ZodObject<{
6
5
  page: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
7
6
  limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
8
7
  }, "strip", z.ZodTypeAny, {
9
- limit: number;
10
8
  page: number;
9
+ limit: number;
11
10
  }, {
12
- limit?: number | undefined;
13
11
  page?: number | undefined;
12
+ limit?: number | undefined;
14
13
  }>;
15
14
  export type AgentsPaginationQueryDto = z.infer<typeof AgentsPaginationQuerySchema>;
16
15
  export interface AgentsPaginatedResponseDto {
@@ -22,20 +21,6 @@ export interface AgentsPaginatedResponseDto {
22
21
  totalPages: number;
23
22
  };
24
23
  }
25
- export declare const GetAgentsByIdsQuerySchema: z.ZodObject<{
26
- agentIds: z.ZodEffects<z.ZodEffects<z.ZodString, bigint[], string>, bigint[], string>;
27
- }, "strip", z.ZodTypeAny, {
28
- agentIds: bigint[];
29
- }, {
30
- agentIds: string;
31
- }>;
32
- export type GetAgentsByIdsQueryDto = z.infer<typeof GetAgentsByIdsQuerySchema>;
33
- export interface GetAgentPublicsByIdsResponseDto {
34
- agents: AgentPublicDto[];
35
- }
36
- export interface GetAgentPrivatesByIdsResponseDto {
37
- agents: AgentPrivateDto[];
38
- }
39
24
  export declare const AgentUpdateConfigSchema: z.ZodObject<{
40
25
  agentId: z.ZodBigInt;
41
26
  config: z.ZodObject<{
@@ -221,14 +206,13 @@ export declare const AgentUpdateConfigSchema: z.ZodObject<{
221
206
  }, z.ZodOptional<z.ZodString>, "strip">>>;
222
207
  }, z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodObject<{}, "strip", z.ZodOptional<z.ZodString>, z.objectOutputType<{}, z.ZodOptional<z.ZodString>, "strip">, z.objectInputType<{}, z.ZodOptional<z.ZodString>, "strip">>]>, "strip">>>>;
223
208
  rules: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
224
- }, "strict", z.ZodTypeAny, {
209
+ }, "strip", z.ZodTypeAny, {
225
210
  name?: string | undefined;
211
+ avatar?: string | undefined;
212
+ appearance?: string | undefined;
226
213
  core?: {
227
214
  name: "evaluate_and_actions" | "execute_actions" | "response_every_message";
228
215
  } | undefined;
229
- appearance?: string | undefined;
230
- rules?: string[] | undefined;
231
- avatar?: string | undefined;
232
216
  llmPreset?: "gemini-low" | "gemini-medium" | "gemini-high" | "openai-low" | "openai-medium" | "anthropic-low" | "anthropic-medium" | "anthropic-high" | "deepseek-low" | "deepseek-medium" | undefined;
233
217
  languages?: string[] | undefined;
234
218
  timeZone?: string | undefined;
@@ -290,14 +274,14 @@ export declare const AgentUpdateConfigSchema: z.ZodObject<{
290
274
  mbti: z.ZodOptional<z.ZodString>;
291
275
  }, z.ZodOptional<z.ZodString>, "strip">>>;
292
276
  }, z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodObject<{}, "strip", z.ZodOptional<z.ZodString>, z.objectOutputType<{}, z.ZodOptional<z.ZodString>, "strip">, z.objectInputType<{}, z.ZodOptional<z.ZodString>, "strip">>]>, "strip"> | undefined;
277
+ rules?: string[] | undefined;
293
278
  }, {
294
279
  name?: string | undefined;
280
+ avatar?: string | undefined;
281
+ appearance?: string | undefined;
295
282
  core?: {
296
283
  name: "evaluate_and_actions" | "execute_actions" | "response_every_message";
297
284
  } | undefined;
298
- appearance?: string | undefined;
299
- rules?: string[] | undefined;
300
- avatar?: string | undefined;
301
285
  llmPreset?: "gemini-low" | "gemini-medium" | "gemini-high" | "openai-low" | "openai-medium" | "anthropic-low" | "anthropic-medium" | "anthropic-high" | "deepseek-low" | "deepseek-medium" | undefined;
302
286
  languages?: string[] | undefined;
303
287
  timeZone?: string | undefined;
@@ -359,17 +343,17 @@ export declare const AgentUpdateConfigSchema: z.ZodObject<{
359
343
  mbti: z.ZodOptional<z.ZodString>;
360
344
  }, z.ZodOptional<z.ZodString>, "strip">>>;
361
345
  }, z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodObject<{}, "strip", z.ZodOptional<z.ZodString>, z.objectOutputType<{}, z.ZodOptional<z.ZodString>, "strip">, z.objectInputType<{}, z.ZodOptional<z.ZodString>, "strip">>]>, "strip"> | undefined;
346
+ rules?: string[] | undefined;
362
347
  }>;
363
348
  }, "strip", z.ZodTypeAny, {
364
349
  agentId: bigint;
365
350
  config: {
366
351
  name?: string | undefined;
352
+ avatar?: string | undefined;
353
+ appearance?: string | undefined;
367
354
  core?: {
368
355
  name: "evaluate_and_actions" | "execute_actions" | "response_every_message";
369
356
  } | undefined;
370
- appearance?: string | undefined;
371
- rules?: string[] | undefined;
372
- avatar?: string | undefined;
373
357
  llmPreset?: "gemini-low" | "gemini-medium" | "gemini-high" | "openai-low" | "openai-medium" | "anthropic-low" | "anthropic-medium" | "anthropic-high" | "deepseek-low" | "deepseek-medium" | undefined;
374
358
  languages?: string[] | undefined;
375
359
  timeZone?: string | undefined;
@@ -431,17 +415,17 @@ export declare const AgentUpdateConfigSchema: z.ZodObject<{
431
415
  mbti: z.ZodOptional<z.ZodString>;
432
416
  }, z.ZodOptional<z.ZodString>, "strip">>>;
433
417
  }, z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodObject<{}, "strip", z.ZodOptional<z.ZodString>, z.objectOutputType<{}, z.ZodOptional<z.ZodString>, "strip">, z.objectInputType<{}, z.ZodOptional<z.ZodString>, "strip">>]>, "strip"> | undefined;
418
+ rules?: string[] | undefined;
434
419
  };
435
420
  }, {
436
421
  agentId: bigint;
437
422
  config: {
438
423
  name?: string | undefined;
424
+ avatar?: string | undefined;
425
+ appearance?: string | undefined;
439
426
  core?: {
440
427
  name: "evaluate_and_actions" | "execute_actions" | "response_every_message";
441
428
  } | undefined;
442
- appearance?: string | undefined;
443
- rules?: string[] | undefined;
444
- avatar?: string | undefined;
445
429
  llmPreset?: "gemini-low" | "gemini-medium" | "gemini-high" | "openai-low" | "openai-medium" | "anthropic-low" | "anthropic-medium" | "anthropic-high" | "deepseek-low" | "deepseek-medium" | undefined;
446
430
  languages?: string[] | undefined;
447
431
  timeZone?: string | undefined;
@@ -503,19 +487,19 @@ export declare const AgentUpdateConfigSchema: z.ZodObject<{
503
487
  mbti: z.ZodOptional<z.ZodString>;
504
488
  }, z.ZodOptional<z.ZodString>, "strip">>>;
505
489
  }, z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodObject<{}, "strip", z.ZodOptional<z.ZodString>, z.objectOutputType<{}, z.ZodOptional<z.ZodString>, "strip">, z.objectInputType<{}, z.ZodOptional<z.ZodString>, "strip">>]>, "strip"> | undefined;
490
+ rules?: string[] | undefined;
506
491
  };
507
492
  }>;
508
493
  export type AgentUpdateConfigDto = z.infer<typeof AgentUpdateConfigSchema>;
509
- export type AgentUpdateConfigResponseDto = Partial<AgentConfig>;
510
494
  export declare const AgentPresetsPaginationQuerySchema: z.ZodObject<{
511
495
  page: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
512
496
  limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
513
497
  }, "strip", z.ZodTypeAny, {
514
- limit: number;
515
498
  page: number;
499
+ limit: number;
516
500
  }, {
517
- limit?: number | undefined;
518
501
  page?: number | undefined;
502
+ limit?: number | undefined;
519
503
  }>;
520
504
  export type AgentPresetsPaginationQueryDto = z.infer<typeof AgentPresetsPaginationQuerySchema>;
521
505
  export interface AgentPresetsPaginatedResponseDto {
@@ -1,32 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GetHelperAgentSchema = exports.CreateAgentFromPresetSchema = exports.AgentPresetsPaginationQuerySchema = exports.AgentUpdateConfigSchema = exports.GetAgentsByIdsQuerySchema = exports.AgentsPaginationQuerySchema = void 0;
3
+ exports.GetHelperAgentSchema = exports.CreateAgentFromPresetSchema = exports.AgentPresetsPaginationQuerySchema = exports.AgentUpdateConfigSchema = exports.AgentsPaginationQuerySchema = void 0;
4
4
  const models_1 = require("@little-samo/samo-ai-sdk/models");
5
5
  const zod_1 = require("zod");
6
6
  exports.AgentsPaginationQuerySchema = zod_1.z.object({
7
7
  page: zod_1.z.coerce.number().int().min(1).optional().default(1),
8
8
  limit: zod_1.z.coerce.number().int().min(1).max(100).optional().default(10),
9
9
  });
10
- exports.GetAgentsByIdsQuerySchema = zod_1.z.object({
11
- agentIds: zod_1.z
12
- .string()
13
- .transform((val) => val.split(',').map((id) => BigInt(id.trim())))
14
- .refine((arr) => arr.length > 0 && arr.length <= 25, {
15
- message: 'agentIds must contain 1-25 agent IDs',
16
- }),
17
- });
18
10
  exports.AgentUpdateConfigSchema = zod_1.z.object({
19
- agentId: zod_1.z.coerce.bigint().describe('ID of the agent to update'),
20
- config: models_1.AgentConfigSchema.partial()
21
- .strict()
22
- .describe('Only the specific configuration fields that need to be updated (name, avatar, core, etc.)'),
11
+ agentId: zod_1.z.bigint(),
12
+ config: models_1.AgentConfigSchema.partial(),
23
13
  });
24
14
  exports.AgentPresetsPaginationQuerySchema = zod_1.z.object({
25
15
  page: zod_1.z.coerce.number().int().min(1).optional().default(1),
26
16
  limit: zod_1.z.coerce.number().int().min(1).max(100).optional().default(20),
27
17
  });
28
18
  exports.CreateAgentFromPresetSchema = zod_1.z.object({
29
- presetId: zod_1.z.coerce.bigint(),
19
+ presetId: zod_1.z.bigint(),
30
20
  });
31
21
  exports.GetHelperAgentSchema = zod_1.z.object({
32
22
  helperType: zod_1.z.nativeEnum(models_1.AgentHelperType),
@@ -1 +1 @@
1
- {"version":3,"file":"agent.requests.js","sourceRoot":"","sources":["../../../../src/dto/entities/agents/agent.requests.ts"],"names":[],"mappings":";;;AAAA,4DAIyC;AACzC,6BAAwB;AAKX,QAAA,2BAA2B,GAAG,OAAC,CAAC,MAAM,CAAC;IAClD,IAAI,EAAE,OAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAC1D,KAAK,EAAE,OAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;CACtE,CAAC,CAAC;AAgBU,QAAA,yBAAyB,GAAG,OAAC,CAAC,MAAM,CAAC;IAChD,QAAQ,EAAE,OAAC;SACR,MAAM,EAAE;SACR,SAAS,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;SACjE,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,GAAG,CAAC,MAAM,IAAI,EAAE,EAAE;QACnD,OAAO,EAAE,sCAAsC;KAChD,CAAC;CACL,CAAC,CAAC;AAYU,QAAA,uBAAuB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC9C,OAAO,EAAE,OAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,2BAA2B,CAAC;IAChE,MAAM,EAAE,0BAAiB,CAAC,OAAO,EAAE;SAChC,MAAM,EAAE;SACR,QAAQ,CACP,2FAA2F,CAC5F;CACJ,CAAC,CAAC;AAMU,QAAA,iCAAiC,GAAG,OAAC,CAAC,MAAM,CAAC;IACxD,IAAI,EAAE,OAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAC1D,KAAK,EAAE,OAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;CACtE,CAAC,CAAC;AAgBU,QAAA,2BAA2B,GAAG,OAAC,CAAC,MAAM,CAAC;IAClD,QAAQ,EAAE,OAAC,CAAC,MAAM,CAAC,MAAM,EAAE;CAC5B,CAAC,CAAC;AAUU,QAAA,oBAAoB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC3C,UAAU,EAAE,OAAC,CAAC,UAAU,CAAC,wBAAe,CAAC;CAC1C,CAAC,CAAC"}
1
+ {"version":3,"file":"agent.requests.js","sourceRoot":"","sources":["../../../../src/dto/entities/agents/agent.requests.ts"],"names":[],"mappings":";;;AAAA,4DAGyC;AACzC,6BAAwB;AAKX,QAAA,2BAA2B,GAAG,OAAC,CAAC,MAAM,CAAC;IAClD,IAAI,EAAE,OAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAC1D,KAAK,EAAE,OAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;CACtE,CAAC,CAAC;AAgBU,QAAA,uBAAuB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC9C,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE;IACnB,MAAM,EAAE,0BAAiB,CAAC,OAAO,EAAE;CACpC,CAAC,CAAC;AAIU,QAAA,iCAAiC,GAAG,OAAC,CAAC,MAAM,CAAC;IACxD,IAAI,EAAE,OAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAC1D,KAAK,EAAE,OAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;CACtE,CAAC,CAAC;AAgBU,QAAA,2BAA2B,GAAG,OAAC,CAAC,MAAM,CAAC;IAClD,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE;CACrB,CAAC,CAAC;AAUU,QAAA,oBAAoB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC3C,UAAU,EAAE,OAAC,CAAC,UAAU,CAAC,wBAAe,CAAC;CAC1C,CAAC,CAAC"}
@@ -1,2 +1,3 @@
1
1
  export * from './agents';
2
2
  export * from './users';
3
+ export * from './entity';
@@ -16,4 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./agents"), exports);
18
18
  __exportStar(require("./users"), exports);
19
+ __exportStar(require("./entity"), exports);
19
20
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/dto/entities/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,0CAAwB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/dto/entities/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,0CAAwB;AACxB,2CAAyB"}
@@ -1,3 +1,2 @@
1
1
  export * from './user.events';
2
- export * from './user.requests';
3
2
  export * from './user';
@@ -15,6 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./user.events"), exports);
18
- __exportStar(require("./user.requests"), exports);
19
18
  __exportStar(require("./user"), exports);
20
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/dto/entities/users/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,kDAAgC;AAChC,yCAAuB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/dto/entities/users/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,yCAAuB"}
@@ -1,4 +1,8 @@
1
1
  import { UserId } from '@little-samo/samo-ai';
2
+ import { EntityDto } from '../entity';
3
+ export interface UserDto extends EntityDto {
4
+ id: UserId;
5
+ }
2
6
  export interface UserPublicDto {
3
7
  id: UserId;
4
8
  username: string | null;
@@ -1,7 +1,7 @@
1
- import { AgentPublicDto, UserPublicDto } from '../entities';
1
+ import { AgentDto, UserDto } from '../entities';
2
2
  export interface ItemRankingDto {
3
3
  rank: number;
4
- ownerAgent?: AgentPublicDto;
5
- ownerUser?: UserPublicDto;
4
+ ownerAgent?: AgentDto;
5
+ ownerUser?: UserDto;
6
6
  count: number;
7
7
  }
@@ -1,5 +1,5 @@
1
1
  export * from './location.events';
2
- export * from './location.message';
2
+ export * from './location.messages';
3
3
  export * from './location.preset';
4
4
  export * from './location.requests';
5
5
  export * from './location.states';
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./location.events"), exports);
18
- __exportStar(require("./location.message"), exports);
18
+ __exportStar(require("./location.messages"), exports);
19
19
  __exportStar(require("./location.preset"), exports);
20
20
  __exportStar(require("./location.requests"), exports);
21
21
  __exportStar(require("./location.states"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/dto/locations/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,qDAAmC;AACnC,oDAAkC;AAClC,sDAAoC;AACpC,oDAAkC;AAClC,6CAA2B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/dto/locations/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,sDAAoC;AACpC,oDAAkC;AAClC,sDAAoC;AACpC,oDAAkC;AAClC,6CAA2B"}
@@ -1,23 +1,21 @@
1
- import { AgentId, LocationId, UserId } from '@little-samo/samo-ai';
2
- import { LocationConfig, LocationEnvironment, LocationType } from '@little-samo/samo-ai-sdk/models';
3
- import { LocationMessageDto } from './location.message';
4
- export interface LocationPublicDto {
1
+ import { LocationId } from '@little-samo/samo-ai';
2
+ import { LocationConfig } from '@little-samo/samo-ai-sdk/models';
3
+ import { AgentDto, UserDto } from '../entities';
4
+ import { LocationMessageDto } from './location.messages';
5
+ export interface LocationMessagesDto {
5
6
  id: LocationId;
6
7
  name: string;
7
- type: LocationType;
8
- environment: LocationEnvironment;
9
- createdAt: Date;
10
- updatedAt: Date;
8
+ users: UserDto[];
9
+ agents: AgentDto[];
10
+ messages: LocationMessageDto[];
11
+ messageCursor?: string;
11
12
  }
12
- export interface LocationPrivateDto extends LocationPublicDto {
13
+ export interface LocationBasicDto {
14
+ id: LocationId;
15
+ name: string;
16
+ platform: string;
17
+ type: string;
13
18
  config: LocationConfig;
14
- }
15
- export interface LocationListItemDto extends LocationPublicDto {
16
- lastMessage: LocationMessageDto | null;
17
- unreadCount: number;
18
- agentIds: AgentId[];
19
- userIds: UserId[];
20
- gimmickCount: number;
21
- pauseUpdateUntil: Date | null;
22
- pauseUpdateReason: string | null;
19
+ createdAt: Date;
20
+ updatedAt: Date;
23
21
  }
@@ -1,27 +1,29 @@
1
- import { LocationId, UserId } from '@little-samo/samo-ai';
2
- import { UserPublicDto } from '../entities';
3
- import { LocationMessageDto } from './location.message';
1
+ import { UserId } from '@little-samo/samo-ai';
2
+ import { UserDto } from '../entities';
3
+ import { LocationMessageDto } from './location.messages';
4
4
  export declare const LocationEventType: {
5
5
  readonly AgentExecution: "AgentExecution";
6
6
  readonly UserJoin: "UserJoin";
7
7
  readonly UserLeave: "UserLeave";
8
8
  readonly AddMessage: "AddMessage";
9
9
  readonly RenderingUpdated: "RenderingUpdated";
10
- readonly PauseUpdateUntilUpdated: "PauseUpdateUntilUpdated";
11
10
  };
12
11
  export type LocationEventType = (typeof LocationEventType)[keyof typeof LocationEventType];
13
12
  export interface LocationEventDtoBase {
14
- locationId: LocationId;
15
- userIds?: UserId[];
13
+ locationId: number;
16
14
  type: LocationEventType;
17
15
  }
16
+ export interface LocationRenderingUpdatedEventDto extends LocationEventDtoBase {
17
+ type: typeof LocationEventType.RenderingUpdated;
18
+ rendering: string | null;
19
+ }
18
20
  export interface LocationAgentExecutionEventDto extends LocationEventDtoBase {
19
21
  type: typeof LocationEventType.AgentExecution;
20
22
  name: string;
21
23
  }
22
24
  export interface LocationUserJoinEventDto extends LocationEventDtoBase {
23
25
  type: typeof LocationEventType.UserJoin;
24
- user: UserPublicDto;
26
+ user: UserDto;
25
27
  }
26
28
  export interface LocationUserLeaveEventDto extends LocationEventDtoBase {
27
29
  type: typeof LocationEventType.UserLeave;
@@ -31,13 +33,4 @@ export interface LocationAddMessageEventDto extends LocationEventDtoBase {
31
33
  type: typeof LocationEventType.AddMessage;
32
34
  message: LocationMessageDto;
33
35
  }
34
- export interface LocationRenderingUpdatedEventDto extends LocationEventDtoBase {
35
- type: typeof LocationEventType.RenderingUpdated;
36
- rendering: string | null;
37
- }
38
- export interface LocationPauseUpdateUntilUpdatedEventDto extends LocationEventDtoBase {
39
- type: typeof LocationEventType.PauseUpdateUntilUpdated;
40
- pauseUpdateUntil: Date | null;
41
- pauseUpdateReason: string | null;
42
- }
43
- export type LocationEventDto = LocationAgentExecutionEventDto | LocationUserJoinEventDto | LocationUserLeaveEventDto | LocationAddMessageEventDto | LocationRenderingUpdatedEventDto | LocationPauseUpdateUntilUpdatedEventDto;
36
+ export type LocationEventDto = LocationRenderingUpdatedEventDto | LocationAgentExecutionEventDto | LocationUserJoinEventDto | LocationUserLeaveEventDto | LocationAddMessageEventDto;
@@ -7,6 +7,5 @@ exports.LocationEventType = {
7
7
  UserLeave: 'UserLeave',
8
8
  AddMessage: 'AddMessage',
9
9
  RenderingUpdated: 'RenderingUpdated',
10
- PauseUpdateUntilUpdated: 'PauseUpdateUntilUpdated',
11
10
  };
12
11
  //# sourceMappingURL=location.events.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"location.events.js","sourceRoot":"","sources":["../../../src/dto/locations/location.events.ts"],"names":[],"mappings":";;;AAMa,QAAA,iBAAiB,GAAG;IAC/B,cAAc,EAAE,gBAAgB;IAChC,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,WAAW;IACtB,UAAU,EAAE,YAAY;IACxB,gBAAgB,EAAE,kBAAkB;IACpC,uBAAuB,EAAE,yBAAyB;CAC1C,CAAC"}
1
+ {"version":3,"file":"location.events.js","sourceRoot":"","sources":["../../../src/dto/locations/location.events.ts"],"names":[],"mappings":";;;AAMa,QAAA,iBAAiB,GAAG;IAC/B,cAAc,EAAE,gBAAgB;IAChC,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,WAAW;IACtB,UAAU,EAAE,YAAY;IACxB,gBAAgB,EAAE,kBAAkB;CAC5B,CAAC"}
@@ -1,4 +1,4 @@
1
- import { EntityId, EntityType, LocationMessage } from '@little-samo/samo-ai';
1
+ import { EntityId, EntityType } from '@little-samo/samo-ai';
2
2
  export interface LocationMessageDto {
3
3
  entityType: EntityType;
4
4
  entityId: EntityId;
@@ -11,4 +11,3 @@ export interface LocationMessageDto {
11
11
  createdAt: Date;
12
12
  updatedAt: Date;
13
13
  }
14
- export declare function convertLocationMessageToDto(message: LocationMessage): LocationMessageDto;
@@ -1,18 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.convertLocationMessageToDto = convertLocationMessageToDto;
4
- function convertLocationMessageToDto(message) {
5
- return {
6
- entityType: message.entityType,
7
- entityId: message.entityId,
8
- name: message.name,
9
- expression: message.expression,
10
- message: message.message,
11
- action: message.action,
12
- emotion: message.emotion,
13
- image: message.image,
14
- createdAt: message.createdAt,
15
- updatedAt: message.updatedAt,
16
- };
17
- }
18
3
  //# sourceMappingURL=location.messages.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"location.messages.js","sourceRoot":"","sources":["../../../src/dto/locations/location.messages.ts"],"names":[],"mappings":";;AAeA,kEAeC;AAfD,SAAgB,2BAA2B,CACzC,OAAwB;IAExB,OAAO;QACL,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,SAAS,EAAE,OAAO,CAAC,SAAS;KAC7B,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"location.messages.js","sourceRoot":"","sources":["../../../src/dto/locations/location.messages.ts"],"names":[],"mappings":""}
@@ -6,7 +6,7 @@ export interface LocationPresetDto {
6
6
  presetDescription: string;
7
7
  name: string;
8
8
  description: string;
9
- config: Partial<LocationConfig>;
9
+ config: LocationConfig;
10
10
  createdAt: Date;
11
11
  updatedAt: Date;
12
12
  }