@lore-co/core 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.
package/LICENSE ADDED
@@ -0,0 +1,110 @@
1
+ # Functional Source License, Version 1.1
2
+
3
+ ## Abbreviation
4
+
5
+ FSL-1.1-MIT
6
+
7
+ ## Notice
8
+
9
+ Copyright (c) 2026 Treadie, Inc
10
+
11
+ ## Terms and Conditions
12
+
13
+ ### Licensor ("We")
14
+
15
+ The party offering the Software under these Terms and Conditions.
16
+
17
+ ### The Software
18
+
19
+ The "Software" is each version of the software that we make available under
20
+ these Terms and Conditions, as indicated by our inclusion of these Terms and
21
+ Conditions with the Software.
22
+
23
+ ### License Grant
24
+
25
+ Subject to your compliance with this License Grant and the Patents,
26
+ Redistribution and Trademark clauses below, we hereby grant you the right to
27
+ use, copy, modify, create derivative works, publicly perform, publicly display
28
+ and redistribute the Software for any Permitted Purpose identified below.
29
+
30
+ ### Permitted Purpose
31
+
32
+ A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
33
+ means making the Software available to others in a commercial product or
34
+ service that:
35
+
36
+ 1. substitutes for the Software;
37
+
38
+ 2. substitutes for any other product or service we offer using the Software
39
+ that exists as of the date we make the Software available; or
40
+
41
+ 3. offers the same or substantially similar functionality as the Software.
42
+
43
+ Permitted Purposes specifically include using the Software:
44
+
45
+ 1. for your internal use and access;
46
+
47
+ 2. for non-commercial education;
48
+
49
+ 3. for non-commercial research; and
50
+
51
+ 4. in connection with professional services that you provide to a licensee
52
+ using the Software in accordance with these Terms and Conditions.
53
+
54
+ ### Patents
55
+
56
+ To the extent your use for a Permitted Purpose would necessarily infringe our
57
+ patents, the license grant above includes a license under our patents. If you
58
+ make a claim against any party that the Software infringes or contributes to
59
+ the infringement of any patent, then your patent license to the Software ends
60
+ immediately.
61
+
62
+ ### Redistribution
63
+
64
+ The Terms and Conditions apply to all copies, modifications and derivatives of
65
+ the Software.
66
+
67
+ If you redistribute any copies, modifications or derivatives of the Software,
68
+ you must include a copy of or a link to these Terms and Conditions and not
69
+ remove any copyright notices provided in or with the Software.
70
+
71
+ ### Disclaimer
72
+
73
+ THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
74
+ IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
75
+ PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
76
+
77
+ IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
78
+ SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
79
+ EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
80
+
81
+ ### Trademarks
82
+
83
+ Except for displaying the License Details and identifying us as the origin of
84
+ the Software, you have no right under these Terms and Conditions to use our
85
+ trademarks, trade names, service marks or product names.
86
+
87
+ ## Grant of Future License
88
+
89
+ We hereby irrevocably grant you an additional license to use the Software under
90
+ the MIT license that is effective on the second anniversary of the date we make
91
+ the Software available. On or after that date, you may use the Software under
92
+ the MIT license, in which case the following will apply:
93
+
94
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
95
+ this software and associated documentation files (the "Software"), to deal in
96
+ the Software without restriction, including without limitation the rights to
97
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
98
+ of the Software, and to permit persons to whom the Software is furnished to do
99
+ so, subject to the following conditions:
100
+
101
+ The above copyright notice and this permission notice shall be included in all
102
+ copies or substantial portions of the Software.
103
+
104
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
105
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
106
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
107
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
108
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
109
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
110
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # `@lore-co/core`
2
+
3
+ Runtime schemas and shared types for Lore's engineering-memory APIs.
4
+
5
+ ```ts
6
+ import { PairedTurnRequestSchema } from "@lore-co/core";
7
+
8
+ const turn = PairedTurnRequestSchema.parse(input);
9
+ ```
10
+
11
+ Node.js 22 or newer is required.
@@ -0,0 +1,206 @@
1
+ import { z } from "zod";
2
+ export declare const AuthEmailSchema: z.ZodPipe<z.ZodString, z.ZodEmail>;
3
+ export type AuthEmail = z.infer<typeof AuthEmailSchema>;
4
+ export declare function normalizeAuthEmail(email: string): string;
5
+ export declare const AuthTokenSchema: z.ZodString;
6
+ export type AuthToken = z.infer<typeof AuthTokenSchema>;
7
+ export declare const WorkspaceTokenSecretSchema: z.ZodString;
8
+ export type WorkspaceTokenSecret = z.infer<typeof WorkspaceTokenSecretSchema>;
9
+ export declare const WorkspaceTokenNameSchema: z.ZodString;
10
+ export declare const WorkspaceTokenStatusSchema: z.ZodEnum<{
11
+ active: "active";
12
+ expired: "expired";
13
+ revoked: "revoked";
14
+ }>;
15
+ export type WorkspaceTokenStatus = z.infer<typeof WorkspaceTokenStatusSchema>;
16
+ export declare const WorkspaceTokenSchema: z.ZodObject<{
17
+ id: z.ZodUUID;
18
+ name: z.ZodString;
19
+ tokenPrefix: z.ZodString;
20
+ status: z.ZodEnum<{
21
+ active: "active";
22
+ expired: "expired";
23
+ revoked: "revoked";
24
+ }>;
25
+ expiresAt: z.ZodNullable<z.ZodISODateTime>;
26
+ revokedAt: z.ZodNullable<z.ZodISODateTime>;
27
+ lastUsedAt: z.ZodNullable<z.ZodISODateTime>;
28
+ createdAt: z.ZodISODateTime;
29
+ }, z.core.$strict>;
30
+ export type WorkspaceToken = z.infer<typeof WorkspaceTokenSchema>;
31
+ export declare const ListWorkspaceTokensResponseSchema: z.ZodObject<{
32
+ tokens: z.ZodArray<z.ZodObject<{
33
+ id: z.ZodUUID;
34
+ name: z.ZodString;
35
+ tokenPrefix: z.ZodString;
36
+ status: z.ZodEnum<{
37
+ active: "active";
38
+ expired: "expired";
39
+ revoked: "revoked";
40
+ }>;
41
+ expiresAt: z.ZodNullable<z.ZodISODateTime>;
42
+ revokedAt: z.ZodNullable<z.ZodISODateTime>;
43
+ lastUsedAt: z.ZodNullable<z.ZodISODateTime>;
44
+ createdAt: z.ZodISODateTime;
45
+ }, z.core.$strict>>;
46
+ }, z.core.$strict>;
47
+ export type ListWorkspaceTokensResponse = z.infer<typeof ListWorkspaceTokensResponseSchema>;
48
+ export declare const CreateWorkspaceTokenRequestSchema: z.ZodObject<{
49
+ name: z.ZodString;
50
+ expiresInDays: z.ZodOptional<z.ZodNumber>;
51
+ }, z.core.$strict>;
52
+ export type CreateWorkspaceTokenRequest = z.infer<typeof CreateWorkspaceTokenRequestSchema>;
53
+ export declare const CreateWorkspaceTokenResponseSchema: z.ZodObject<{
54
+ token: z.ZodString;
55
+ workspaceToken: z.ZodObject<{
56
+ id: z.ZodUUID;
57
+ name: z.ZodString;
58
+ tokenPrefix: z.ZodString;
59
+ status: z.ZodEnum<{
60
+ active: "active";
61
+ expired: "expired";
62
+ revoked: "revoked";
63
+ }>;
64
+ expiresAt: z.ZodNullable<z.ZodISODateTime>;
65
+ revokedAt: z.ZodNullable<z.ZodISODateTime>;
66
+ lastUsedAt: z.ZodNullable<z.ZodISODateTime>;
67
+ createdAt: z.ZodISODateTime;
68
+ }, z.core.$strict>;
69
+ }, z.core.$strict>;
70
+ export type CreateWorkspaceTokenResponse = z.infer<typeof CreateWorkspaceTokenResponseSchema>;
71
+ export declare const RevokeWorkspaceTokenResponseSchema: z.ZodObject<{
72
+ workspaceToken: z.ZodObject<{
73
+ id: z.ZodUUID;
74
+ name: z.ZodString;
75
+ tokenPrefix: z.ZodString;
76
+ status: z.ZodEnum<{
77
+ active: "active";
78
+ expired: "expired";
79
+ revoked: "revoked";
80
+ }>;
81
+ expiresAt: z.ZodNullable<z.ZodISODateTime>;
82
+ revokedAt: z.ZodNullable<z.ZodISODateTime>;
83
+ lastUsedAt: z.ZodNullable<z.ZodISODateTime>;
84
+ createdAt: z.ZodISODateTime;
85
+ }, z.core.$strict>;
86
+ }, z.core.$strict>;
87
+ export type RevokeWorkspaceTokenResponse = z.infer<typeof RevokeWorkspaceTokenResponseSchema>;
88
+ export declare const AuthUserStatusSchema: z.ZodEnum<{
89
+ active: "active";
90
+ disabled: "disabled";
91
+ }>;
92
+ export type AuthUserStatus = z.infer<typeof AuthUserStatusSchema>;
93
+ export declare const AuthSignupRequestSchema: z.ZodObject<{
94
+ organizationName: z.ZodString;
95
+ email: z.ZodPipe<z.ZodString, z.ZodEmail>;
96
+ }, z.core.$strict>;
97
+ export type AuthSignupRequest = z.infer<typeof AuthSignupRequestSchema>;
98
+ export declare const AuthLoginRequestSchema: z.ZodObject<{
99
+ email: z.ZodPipe<z.ZodString, z.ZodEmail>;
100
+ }, z.core.$strict>;
101
+ export type AuthLoginRequest = z.infer<typeof AuthLoginRequestSchema>;
102
+ export declare const AuthInitiationResponseSchema: z.ZodObject<{
103
+ accepted: z.ZodLiteral<true>;
104
+ }, z.core.$strict>;
105
+ export type AuthInitiationResponse = z.infer<typeof AuthInitiationResponseSchema>;
106
+ export declare const AuthVerifyRequestSchema: z.ZodObject<{
107
+ token: z.ZodString;
108
+ }, z.core.$strict>;
109
+ export type AuthVerifyRequest = z.infer<typeof AuthVerifyRequestSchema>;
110
+ export declare const AuthSessionProfileSchema: z.ZodObject<{
111
+ userId: z.ZodUUID;
112
+ email: z.ZodPipe<z.ZodString, z.ZodEmail>;
113
+ workspaceId: z.ZodUUID;
114
+ workspaceName: z.ZodString;
115
+ organization: z.ZodString;
116
+ }, z.core.$strict>;
117
+ export type AuthSessionProfile = z.infer<typeof AuthSessionProfileSchema>;
118
+ export declare const AuthVerifyResponseSchema: z.ZodObject<{
119
+ sessionToken: z.ZodString;
120
+ session: z.ZodObject<{
121
+ userId: z.ZodUUID;
122
+ email: z.ZodPipe<z.ZodString, z.ZodEmail>;
123
+ workspaceId: z.ZodUUID;
124
+ workspaceName: z.ZodString;
125
+ organization: z.ZodString;
126
+ }, z.core.$strict>;
127
+ }, z.core.$strict>;
128
+ export type AuthVerifyResponse = z.infer<typeof AuthVerifyResponseSchema>;
129
+ export declare const AuthSessionResponseSchema: z.ZodObject<{
130
+ session: z.ZodObject<{
131
+ userId: z.ZodUUID;
132
+ email: z.ZodPipe<z.ZodString, z.ZodEmail>;
133
+ workspaceId: z.ZodUUID;
134
+ workspaceName: z.ZodString;
135
+ organization: z.ZodString;
136
+ }, z.core.$strict>;
137
+ }, z.core.$strict>;
138
+ export type AuthSessionResponse = z.infer<typeof AuthSessionResponseSchema>;
139
+ export declare const AuthLogoutRequestSchema: z.ZodDefault<z.ZodObject<{}, z.core.$strict>>;
140
+ export type AuthLogoutRequest = z.infer<typeof AuthLogoutRequestSchema>;
141
+ export declare const AuthLogoutResponseSchema: z.ZodUndefined;
142
+ export type AuthLogoutResponse = z.infer<typeof AuthLogoutResponseSchema>;
143
+ export declare const AuthenticatedWorkspaceSchema: z.ZodObject<{
144
+ workspaceId: z.ZodUUID;
145
+ organization: z.ZodString;
146
+ tokenId: z.ZodUUID;
147
+ credentialType: z.ZodOptional<z.ZodEnum<{
148
+ session: "session";
149
+ workspace_token: "workspace_token";
150
+ }>>;
151
+ userId: z.ZodOptional<z.ZodUUID>;
152
+ email: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodEmail>>;
153
+ workspaceName: z.ZodOptional<z.ZodString>;
154
+ }, z.core.$strict>;
155
+ export type AuthenticatedWorkspace = z.infer<typeof AuthenticatedWorkspaceSchema>;
156
+ export declare const SignupRequestSchema: z.ZodObject<{
157
+ organizationName: z.ZodString;
158
+ email: z.ZodPipe<z.ZodString, z.ZodEmail>;
159
+ }, z.core.$strict>;
160
+ export type SignupRequest = AuthSignupRequest;
161
+ export declare const LoginRequestSchema: z.ZodObject<{
162
+ email: z.ZodPipe<z.ZodString, z.ZodEmail>;
163
+ }, z.core.$strict>;
164
+ export type LoginRequest = AuthLoginRequest;
165
+ export declare const AuthAcceptedResponseSchema: z.ZodObject<{
166
+ accepted: z.ZodLiteral<true>;
167
+ }, z.core.$strict>;
168
+ export type AuthAcceptedResponse = AuthInitiationResponse;
169
+ export declare const VerifyRequestSchema: z.ZodObject<{
170
+ token: z.ZodString;
171
+ }, z.core.$strict>;
172
+ export type VerifyRequest = AuthVerifyRequest;
173
+ export declare const VerifyResponseSchema: z.ZodObject<{
174
+ sessionToken: z.ZodString;
175
+ session: z.ZodObject<{
176
+ userId: z.ZodUUID;
177
+ email: z.ZodPipe<z.ZodString, z.ZodEmail>;
178
+ workspaceId: z.ZodUUID;
179
+ workspaceName: z.ZodString;
180
+ organization: z.ZodString;
181
+ }, z.core.$strict>;
182
+ }, z.core.$strict>;
183
+ export type VerifyResponse = AuthVerifyResponse;
184
+ export declare const SessionProfileSchema: z.ZodObject<{
185
+ userId: z.ZodUUID;
186
+ email: z.ZodPipe<z.ZodString, z.ZodEmail>;
187
+ workspaceId: z.ZodUUID;
188
+ workspaceName: z.ZodString;
189
+ organization: z.ZodString;
190
+ }, z.core.$strict>;
191
+ export type SessionProfile = AuthSessionProfile;
192
+ export declare const SessionResponseSchema: z.ZodObject<{
193
+ session: z.ZodObject<{
194
+ userId: z.ZodUUID;
195
+ email: z.ZodPipe<z.ZodString, z.ZodEmail>;
196
+ workspaceId: z.ZodUUID;
197
+ workspaceName: z.ZodString;
198
+ organization: z.ZodString;
199
+ }, z.core.$strict>;
200
+ }, z.core.$strict>;
201
+ export type SessionResponse = AuthSessionResponse;
202
+ export declare const LogoutRequestSchema: z.ZodDefault<z.ZodObject<{}, z.core.$strict>>;
203
+ export type LogoutRequest = AuthLogoutRequest;
204
+ export declare const LogoutResponseSchema: z.ZodUndefined;
205
+ export type LogoutResponse = AuthLogoutResponse;
206
+ //# sourceMappingURL=auth-schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-schemas.d.ts","sourceRoot":"","sources":["../src/auth-schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,eAAe,oCAKD,CAAC;AAC5B,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,eAAO,MAAM,eAAe,aAGI,CAAC;AACjC,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,eAAO,MAAM,0BAA0B,aAGF,CAAC;AACtC,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CACxC,OAAO,0BAA0B,CAClC,CAAC;AAEF,eAAO,MAAM,wBAAwB,aAAoC,CAAC;AAC1E,eAAO,MAAM,0BAA0B;;;;EAIrC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CACxC,OAAO,0BAA0B,CAClC,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;kBAWtB,CAAC;AACZ,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;kBAInC,CAAC;AACZ,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAC/C,OAAO,iCAAiC,CACzC,CAAC;AAEF,eAAO,MAAM,iCAAiC;;;kBAKnC,CAAC;AACZ,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAC/C,OAAO,iCAAiC,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,gBAA2B,CAAC;AAC7D,MAAM,MAAM,cAAc,GAAG,kBAAkB,CAAC"}
@@ -0,0 +1,119 @@
1
+ import { z } from "zod";
2
+ import { AuthenticatedWorkspaceSchema as BaseAuthenticatedWorkspaceSchema } from "./pilot-schemas.js";
3
+ export const AuthEmailSchema = z
4
+ .string()
5
+ .trim()
6
+ .toLowerCase()
7
+ .max(320)
8
+ .pipe(z.email().max(320));
9
+ export function normalizeAuthEmail(email) {
10
+ return AuthEmailSchema.parse(email);
11
+ }
12
+ export const AuthTokenSchema = z
13
+ .string()
14
+ .length(43)
15
+ .regex(/^[A-Za-z0-9_-]{43}$/u);
16
+ export const WorkspaceTokenSecretSchema = z
17
+ .string()
18
+ .length(48)
19
+ .regex(/^lore_[A-Za-z0-9_-]{43}$/u);
20
+ export const WorkspaceTokenNameSchema = z.string().trim().min(1).max(100);
21
+ export const WorkspaceTokenStatusSchema = z.enum([
22
+ "active",
23
+ "expired",
24
+ "revoked",
25
+ ]);
26
+ export const WorkspaceTokenSchema = z
27
+ .object({
28
+ id: z.uuid(),
29
+ name: WorkspaceTokenNameSchema,
30
+ tokenPrefix: z.string().min(4).max(16),
31
+ status: WorkspaceTokenStatusSchema,
32
+ expiresAt: z.iso.datetime().nullable(),
33
+ revokedAt: z.iso.datetime().nullable(),
34
+ lastUsedAt: z.iso.datetime().nullable(),
35
+ createdAt: z.iso.datetime(),
36
+ })
37
+ .strict();
38
+ export const ListWorkspaceTokensResponseSchema = z
39
+ .object({
40
+ tokens: z.array(WorkspaceTokenSchema),
41
+ })
42
+ .strict();
43
+ export const CreateWorkspaceTokenRequestSchema = z
44
+ .object({
45
+ name: WorkspaceTokenNameSchema,
46
+ expiresInDays: z.number().int().min(1).max(365).optional(),
47
+ })
48
+ .strict();
49
+ export const CreateWorkspaceTokenResponseSchema = z
50
+ .object({
51
+ token: WorkspaceTokenSecretSchema,
52
+ workspaceToken: WorkspaceTokenSchema,
53
+ })
54
+ .strict();
55
+ export const RevokeWorkspaceTokenResponseSchema = z
56
+ .object({
57
+ workspaceToken: WorkspaceTokenSchema,
58
+ })
59
+ .strict();
60
+ export const AuthUserStatusSchema = z.enum(["active", "disabled"]);
61
+ export const AuthSignupRequestSchema = z
62
+ .object({
63
+ organizationName: z.string().trim().min(1).max(200),
64
+ email: AuthEmailSchema,
65
+ })
66
+ .strict();
67
+ export const AuthLoginRequestSchema = z
68
+ .object({
69
+ email: AuthEmailSchema,
70
+ })
71
+ .strict();
72
+ export const AuthInitiationResponseSchema = z
73
+ .object({
74
+ accepted: z.literal(true),
75
+ })
76
+ .strict();
77
+ export const AuthVerifyRequestSchema = z
78
+ .object({
79
+ token: AuthTokenSchema,
80
+ })
81
+ .strict();
82
+ export const AuthSessionProfileSchema = z
83
+ .object({
84
+ userId: z.uuid(),
85
+ email: AuthEmailSchema,
86
+ workspaceId: z.uuid(),
87
+ workspaceName: z.string().trim().min(1).max(200),
88
+ organization: z.string().trim().min(1).max(200),
89
+ })
90
+ .strict();
91
+ export const AuthVerifyResponseSchema = z
92
+ .object({
93
+ sessionToken: AuthTokenSchema,
94
+ session: AuthSessionProfileSchema,
95
+ })
96
+ .strict();
97
+ export const AuthSessionResponseSchema = z
98
+ .object({
99
+ session: AuthSessionProfileSchema,
100
+ })
101
+ .strict();
102
+ export const AuthLogoutRequestSchema = z.object({}).strict().default({});
103
+ export const AuthLogoutResponseSchema = z.undefined();
104
+ export const AuthenticatedWorkspaceSchema = BaseAuthenticatedWorkspaceSchema.extend({
105
+ credentialType: z.enum(["workspace_token", "session"]).optional(),
106
+ userId: z.uuid().optional(),
107
+ email: AuthEmailSchema.optional(),
108
+ workspaceName: z.string().trim().min(1).max(200).optional(),
109
+ });
110
+ export const SignupRequestSchema = AuthSignupRequestSchema;
111
+ export const LoginRequestSchema = AuthLoginRequestSchema;
112
+ export const AuthAcceptedResponseSchema = AuthInitiationResponseSchema;
113
+ export const VerifyRequestSchema = AuthVerifyRequestSchema;
114
+ export const VerifyResponseSchema = AuthVerifyResponseSchema;
115
+ export const SessionProfileSchema = AuthSessionProfileSchema;
116
+ export const SessionResponseSchema = AuthSessionResponseSchema;
117
+ export const LogoutRequestSchema = AuthLogoutRequestSchema;
118
+ export const LogoutResponseSchema = AuthLogoutResponseSchema;
119
+ //# sourceMappingURL=auth-schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-schemas.js","sourceRoot":"","sources":["../src/auth-schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,4BAA4B,IAAI,gCAAgC,EAAE,MAAM,oBAAoB,CAAC;AAEtG,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC;KAC7B,MAAM,EAAE;KACR,IAAI,EAAE;KACN,WAAW,EAAE;KACb,GAAG,CAAC,GAAG,CAAC;KACR,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AAG5B,MAAM,UAAU,kBAAkB,CAAC,KAAa;IAC9C,OAAO,eAAe,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AACtC,CAAC;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC;KAC7B,MAAM,EAAE;KACR,MAAM,CAAC,EAAE,CAAC;KACV,KAAK,CAAC,sBAAsB,CAAC,CAAC;AAGjC,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC;KACxC,MAAM,EAAE;KACR,MAAM,CAAC,EAAE,CAAC;KACV,KAAK,CAAC,2BAA2B,CAAC,CAAC;AAKtC,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC1E,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,IAAI,CAAC;IAC/C,QAAQ;IACR,SAAS;IACT,SAAS;CACV,CAAC,CAAC;AAK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D,MAAM,CAAC,MAAM,qBAAqB,GAAG,yBAAyB,CAAC;AAE/D,MAAM,CAAC,MAAM,mBAAmB,GAAG,uBAAuB,CAAC;AAE3D,MAAM,CAAC,MAAM,oBAAoB,GAAG,wBAAwB,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { type AgentInteraction, type AgentTask, type CorrectMemoryDto, type CorrectMemoryResponse, type CreateMemoryDto, type ForgetMemoryDto, type ForgetMemoryResponse, type GetContextResponse, type GetMemoryDto, type GetMemoryResponse, type ListMemoriesDto, type ListMemoriesResponse, type MemoryCategory, type MemoryScope, type ObserveResponse, type RememberResponse } from "./schemas.js";
2
+ import type { MemoryExtractor, MemoryRepository, MemoryRetriever } from "./ports.js";
3
+ export interface SharedMemoryEngineDependencies {
4
+ repository: MemoryRepository;
5
+ extractor: MemoryExtractor;
6
+ retriever: MemoryRetriever;
7
+ minimumConfidence?: number;
8
+ }
9
+ export declare function createMemoryFingerprint(input: {
10
+ content: string;
11
+ scope: MemoryScope;
12
+ category: MemoryCategory;
13
+ supersedesMemoryId?: string | null;
14
+ }): string;
15
+ export declare class SharedMemoryEngine {
16
+ #private;
17
+ constructor(dependencies: SharedMemoryEngineDependencies);
18
+ constructor(repository: MemoryRepository, extractor: MemoryExtractor, retriever: MemoryRetriever);
19
+ observe(interactionInput: AgentInteraction): Promise<ObserveResponse>;
20
+ getContext(taskInput: AgentTask, context?: {
21
+ workspaceId?: string;
22
+ }): Promise<GetContextResponse>;
23
+ remember(input: CreateMemoryDto): Promise<RememberResponse>;
24
+ correct(input: CorrectMemoryDto): Promise<CorrectMemoryResponse>;
25
+ forget(input: ForgetMemoryDto | string): Promise<ForgetMemoryResponse>;
26
+ listMemories(input?: ListMemoriesDto): Promise<ListMemoriesResponse>;
27
+ getMemory(input: GetMemoryDto | string): Promise<GetMemoryResponse>;
28
+ }
29
+ export { SharedMemoryEngine as LoreEngine };
30
+ //# sourceMappingURL=engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file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