@little-samo/samo-ai-sdk 0.1.0 → 0.1.1-rv2

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 +11 -123
  2. package/dist/dto/entities/agents/agent.d.ts +4 -6
  3. package/dist/dto/entities/agents/agent.preset.d.ts +1 -1
  4. package/dist/dto/entities/agents/agent.requests.d.ts +18 -2
  5. package/dist/dto/entities/agents/agent.requests.js +14 -4
  6. package/dist/dto/entities/agents/agent.requests.js.map +1 -1
  7. package/dist/dto/entities/index.d.ts +0 -1
  8. package/dist/dto/entities/index.js +0 -1
  9. package/dist/dto/entities/index.js.map +1 -1
  10. package/dist/dto/entities/users/index.d.ts +1 -0
  11. package/dist/dto/entities/users/index.js +1 -0
  12. package/dist/dto/entities/users/index.js.map +1 -1
  13. package/dist/dto/entities/users/user.d.ts +0 -4
  14. package/dist/dto/entities/users/user.requests.d.ts +13 -0
  15. package/dist/dto/entities/users/user.requests.js +13 -0
  16. package/dist/dto/entities/users/user.requests.js.map +1 -0
  17. package/dist/dto/items/item.rankings.d.ts +3 -3
  18. package/dist/dto/locations/index.d.ts +1 -1
  19. package/dist/dto/locations/index.js +1 -1
  20. package/dist/dto/locations/index.js.map +1 -1
  21. package/dist/dto/locations/location.d.ts +18 -16
  22. package/dist/dto/locations/location.events.d.ts +17 -10
  23. package/dist/dto/locations/location.events.js +1 -0
  24. package/dist/dto/locations/location.events.js.map +1 -1
  25. package/dist/dto/locations/location.message.d.ts +13 -0
  26. package/dist/dto/locations/location.message.js +3 -0
  27. package/dist/dto/locations/location.message.js.map +1 -0
  28. package/dist/dto/locations/location.messages.d.ts +2 -1
  29. package/dist/dto/locations/location.messages.js +15 -0
  30. package/dist/dto/locations/location.messages.js.map +1 -1
  31. package/dist/dto/locations/location.preset.d.ts +1 -1
  32. package/dist/dto/locations/location.requests.d.ts +191 -21
  33. package/dist/dto/locations/location.requests.js +61 -11
  34. package/dist/dto/locations/location.requests.js.map +1 -1
  35. package/dist/index.d.ts +2 -0
  36. package/dist/index.js +19 -0
  37. package/dist/index.js.map +1 -0
  38. package/dist/models/locations/location.config.d.ts +47 -3
  39. package/dist/models/locations/location.config.js +38 -21
  40. package/dist/models/locations/location.config.js.map +1 -1
  41. package/dist/models/locations/location.constants.d.ts +8 -0
  42. package/dist/models/locations/location.constants.js +8 -1
  43. package/dist/models/locations/location.constants.js.map +1 -1
  44. package/package.json +3 -3
package/README.md CHANGED
@@ -1,155 +1,43 @@
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 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>
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>
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> •
12
10
  <a href="#learn-more">Learn More</a> •
13
11
  <a href="#license">License</a>
14
12
  </p>
15
13
 
16
14
  ## Features
17
15
 
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
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
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-repository-storage
28
+ npm install @little-samo/samo-ai-sdk
29
29
  ```
30
30
 
31
31
  Or using yarn:
32
32
 
33
33
  ```bash
34
- yarn add @little-samo/samo-ai-repository-storage
34
+ yarn add @little-samo/samo-ai-sdk
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
-
149
37
  ## Learn More
150
38
 
151
39
  - [SamoAI Core Library](https://github.com/little-samo/SamoAI) - The main SamoAI framework
152
- - [SamoAI Example CLI](https://github.com/little-samo/SamoAI-Example-CLI) - Example implementation using this storage library
40
+ - [SamoAI Example CLI](https://github.com/little-samo/SamoAI-Example-CLI) - Example implementation
153
41
 
154
42
  ## License
155
43
 
@@ -1,13 +1,11 @@
1
1
  import { AgentId, UserId } from '@little-samo/samo-ai';
2
2
  import { AgentConfig } from '@little-samo/samo-ai-sdk/models';
3
- import { EntityDto } from '../entity';
4
- export interface AgentDto extends EntityDto {
5
- id: AgentId;
6
- }
7
- export interface AgentPrivateDto {
3
+ export interface AgentPublicDto {
8
4
  id: AgentId;
9
5
  name: string;
10
- username: string | null;
6
+ avatar: string;
11
7
  ownerUserId: UserId;
8
+ }
9
+ export interface AgentPrivateDto extends AgentPublicDto {
12
10
  config: AgentConfig;
13
11
  }
@@ -4,7 +4,7 @@ export interface AgentPresetDto {
4
4
  presetName: string;
5
5
  presetShortDescription: string;
6
6
  presetDescription: string;
7
- config: AgentConfig;
7
+ config: Partial<AgentConfig>;
8
8
  createdAt: Date;
9
9
  updatedAt: Date;
10
10
  }
@@ -1,5 +1,6 @@
1
+ import { AgentConfig } from '@little-samo/samo-ai-sdk/models';
1
2
  import { z } from 'zod';
2
- import { AgentPrivateDto } from './agent';
3
+ import { AgentPrivateDto, AgentPublicDto } from './agent';
3
4
  import { AgentPresetDto } from './agent.preset';
4
5
  export declare const AgentsPaginationQuerySchema: z.ZodObject<{
5
6
  page: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
@@ -21,6 +22,20 @@ export interface AgentsPaginatedResponseDto {
21
22
  totalPages: number;
22
23
  };
23
24
  }
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
+ }
24
39
  export declare const AgentUpdateConfigSchema: z.ZodObject<{
25
40
  agentId: z.ZodBigInt;
26
41
  config: z.ZodObject<{
@@ -206,7 +221,7 @@ export declare const AgentUpdateConfigSchema: z.ZodObject<{
206
221
  }, z.ZodOptional<z.ZodString>, "strip">>>;
207
222
  }, 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">>>>;
208
223
  rules: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
209
- }, "strip", z.ZodTypeAny, {
224
+ }, "strict", z.ZodTypeAny, {
210
225
  name?: string | undefined;
211
226
  avatar?: string | undefined;
212
227
  appearance?: string | undefined;
@@ -491,6 +506,7 @@ export declare const AgentUpdateConfigSchema: z.ZodObject<{
491
506
  };
492
507
  }>;
493
508
  export type AgentUpdateConfigDto = z.infer<typeof AgentUpdateConfigSchema>;
509
+ export type AgentUpdateConfigResponseDto = Partial<AgentConfig>;
494
510
  export declare const AgentPresetsPaginationQuerySchema: z.ZodObject<{
495
511
  page: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
496
512
  limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
@@ -1,22 +1,32 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GetHelperAgentSchema = exports.CreateAgentFromPresetSchema = exports.AgentPresetsPaginationQuerySchema = exports.AgentUpdateConfigSchema = exports.AgentsPaginationQuerySchema = void 0;
3
+ exports.GetHelperAgentSchema = exports.CreateAgentFromPresetSchema = exports.AgentPresetsPaginationQuerySchema = exports.AgentUpdateConfigSchema = exports.GetAgentsByIdsQuerySchema = 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
+ });
10
18
  exports.AgentUpdateConfigSchema = zod_1.z.object({
11
- agentId: zod_1.z.bigint(),
12
- config: models_1.AgentConfigSchema.partial(),
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.)'),
13
23
  });
14
24
  exports.AgentPresetsPaginationQuerySchema = zod_1.z.object({
15
25
  page: zod_1.z.coerce.number().int().min(1).optional().default(1),
16
26
  limit: zod_1.z.coerce.number().int().min(1).max(100).optional().default(20),
17
27
  });
18
28
  exports.CreateAgentFromPresetSchema = zod_1.z.object({
19
- presetId: zod_1.z.bigint(),
29
+ presetId: zod_1.z.coerce.bigint(),
20
30
  });
21
31
  exports.GetHelperAgentSchema = zod_1.z.object({
22
32
  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,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;A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,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,3 +1,2 @@
1
1
  export * from './agents';
2
2
  export * from './users';
3
- export * from './entity';
@@ -16,5 +16,4 @@ 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);
20
19
  //# 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;AACxB,2CAAyB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/dto/entities/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,0CAAwB"}
@@ -1,2 +1,3 @@
1
1
  export * from './user.events';
2
+ export * from './user.requests';
2
3
  export * from './user';
@@ -15,5 +15,6 @@ 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);
18
19
  __exportStar(require("./user"), exports);
19
20
  //# 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,yCAAuB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/dto/entities/users/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,kDAAgC;AAChC,yCAAuB"}
@@ -1,8 +1,4 @@
1
1
  import { UserId } from '@little-samo/samo-ai';
2
- import { EntityDto } from '../entity';
3
- export interface UserDto extends EntityDto {
4
- id: UserId;
5
- }
6
2
  export interface UserPublicDto {
7
3
  id: UserId;
8
4
  username: string | null;
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+ import { UserPublicDto } from './user';
3
+ export declare const GetUsersByIdsQuerySchema: z.ZodObject<{
4
+ userIds: z.ZodEffects<z.ZodEffects<z.ZodString, bigint[], string>, bigint[], string>;
5
+ }, "strip", z.ZodTypeAny, {
6
+ userIds: bigint[];
7
+ }, {
8
+ userIds: string;
9
+ }>;
10
+ export type GetUsersByIdsQueryDto = z.infer<typeof GetUsersByIdsQuerySchema>;
11
+ export interface GetUserPublicsByIdsResponseDto {
12
+ users: UserPublicDto[];
13
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetUsersByIdsQuerySchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.GetUsersByIdsQuerySchema = zod_1.z.object({
6
+ userIds: zod_1.z
7
+ .string()
8
+ .transform((val) => val.split(',').map((id) => BigInt(id.trim())))
9
+ .refine((arr) => arr.length > 0 && arr.length <= 25, {
10
+ message: 'userIds must contain 1-25 user IDs',
11
+ }),
12
+ });
13
+ //# sourceMappingURL=user.requests.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user.requests.js","sourceRoot":"","sources":["../../../../src/dto/entities/users/user.requests.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAIX,QAAA,wBAAwB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC/C,OAAO,EAAE,OAAC;SACP,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,oCAAoC;KAC9C,CAAC;CACL,CAAC,CAAC"}
@@ -1,7 +1,7 @@
1
- import { AgentDto, UserDto } from '../entities';
1
+ import { AgentPublicDto, UserPublicDto } from '../entities';
2
2
  export interface ItemRankingDto {
3
3
  rank: number;
4
- ownerAgent?: AgentDto;
5
- ownerUser?: UserDto;
4
+ ownerAgent?: AgentPublicDto;
5
+ ownerUser?: UserPublicDto;
6
6
  count: number;
7
7
  }
@@ -1,5 +1,5 @@
1
1
  export * from './location.events';
2
- export * from './location.messages';
2
+ export * from './location.message';
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.messages"), exports);
18
+ __exportStar(require("./location.message"), 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,sDAAoC;AACpC,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,qDAAmC;AACnC,oDAAkC;AAClC,sDAAoC;AACpC,oDAAkC;AAClC,6CAA2B"}
@@ -1,21 +1,23 @@
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 {
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 {
6
5
  id: LocationId;
7
6
  name: string;
8
- users: UserDto[];
9
- agents: AgentDto[];
10
- messages: LocationMessageDto[];
11
- messageCursor?: string;
12
- }
13
- export interface LocationBasicDto {
14
- id: LocationId;
15
- name: string;
16
- platform: string;
17
- type: string;
18
- config: LocationConfig;
7
+ type: LocationType;
8
+ environment: LocationEnvironment;
19
9
  createdAt: Date;
20
10
  updatedAt: Date;
21
11
  }
12
+ export interface LocationPrivateDto extends LocationPublicDto {
13
+ 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;
23
+ }
@@ -1,29 +1,27 @@
1
- import { UserId } from '@little-samo/samo-ai';
2
- import { UserDto } from '../entities';
3
- import { LocationMessageDto } from './location.messages';
1
+ import { LocationId, UserId } from '@little-samo/samo-ai';
2
+ import { UserPublicDto } from '../entities';
3
+ import { LocationMessageDto } from './location.message';
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";
10
11
  };
11
12
  export type LocationEventType = (typeof LocationEventType)[keyof typeof LocationEventType];
12
13
  export interface LocationEventDtoBase {
13
- locationId: number;
14
+ locationId: LocationId;
15
+ userIds?: UserId[];
14
16
  type: LocationEventType;
15
17
  }
16
- export interface LocationRenderingUpdatedEventDto extends LocationEventDtoBase {
17
- type: typeof LocationEventType.RenderingUpdated;
18
- rendering: string | null;
19
- }
20
18
  export interface LocationAgentExecutionEventDto extends LocationEventDtoBase {
21
19
  type: typeof LocationEventType.AgentExecution;
22
20
  name: string;
23
21
  }
24
22
  export interface LocationUserJoinEventDto extends LocationEventDtoBase {
25
23
  type: typeof LocationEventType.UserJoin;
26
- user: UserDto;
24
+ user: UserPublicDto;
27
25
  }
28
26
  export interface LocationUserLeaveEventDto extends LocationEventDtoBase {
29
27
  type: typeof LocationEventType.UserLeave;
@@ -33,4 +31,13 @@ export interface LocationAddMessageEventDto extends LocationEventDtoBase {
33
31
  type: typeof LocationEventType.AddMessage;
34
32
  message: LocationMessageDto;
35
33
  }
36
- export type LocationEventDto = LocationRenderingUpdatedEventDto | LocationAgentExecutionEventDto | LocationUserJoinEventDto | LocationUserLeaveEventDto | LocationAddMessageEventDto;
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;
@@ -7,5 +7,6 @@ exports.LocationEventType = {
7
7
  UserLeave: 'UserLeave',
8
8
  AddMessage: 'AddMessage',
9
9
  RenderingUpdated: 'RenderingUpdated',
10
+ PauseUpdateUntilUpdated: 'PauseUpdateUntilUpdated',
10
11
  };
11
12
  //# 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;CAC5B,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;IACpC,uBAAuB,EAAE,yBAAyB;CAC1C,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { EntityId, EntityType } from '@little-samo/samo-ai';
2
+ export interface LocationMessageDto {
3
+ entityType: EntityType;
4
+ entityId: EntityId;
5
+ name: string;
6
+ expression?: string;
7
+ message?: string;
8
+ action?: string;
9
+ emotion?: string;
10
+ image?: string;
11
+ createdAt: Date;
12
+ updatedAt: Date;
13
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=location.message.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"location.message.js","sourceRoot":"","sources":["../../../src/dto/locations/location.message.ts"],"names":[],"mappings":""}
@@ -1,4 +1,4 @@
1
- import { EntityId, EntityType } from '@little-samo/samo-ai';
1
+ import { EntityId, EntityType, LocationMessage } from '@little-samo/samo-ai';
2
2
  export interface LocationMessageDto {
3
3
  entityType: EntityType;
4
4
  entityId: EntityId;
@@ -11,3 +11,4 @@ export interface LocationMessageDto {
11
11
  createdAt: Date;
12
12
  updatedAt: Date;
13
13
  }
14
+ export declare function convertLocationMessageToDto(message: LocationMessage): LocationMessageDto;
@@ -1,3 +1,18 @@
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
+ }
3
18
  //# sourceMappingURL=location.messages.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"location.messages.js","sourceRoot":"","sources":["../../../src/dto/locations/location.messages.ts"],"names":[],"mappings":""}
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"}
@@ -6,7 +6,7 @@ export interface LocationPresetDto {
6
6
  presetDescription: string;
7
7
  name: string;
8
8
  description: string;
9
- config: LocationConfig;
9
+ config: Partial<LocationConfig>;
10
10
  createdAt: Date;
11
11
  updatedAt: Date;
12
12
  }