@essentialai/cogent 3.2.0 → 3.5.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/CHANGELOG.md CHANGED
@@ -1,10 +1,31 @@
1
1
  # Changelog
2
2
 
3
+ ## [3.4.0] - 2026-06-03
4
+
5
+ ### Added
6
+ - `CreateSessionRequest` / `JoinSessionRequest` (+ their Zod schemas) gain an **optional**
7
+ `orgId` field — the 3rd join credential for Team Edition Org_ID-gated channels.
8
+ Backward-compatible: optional + still `.strict()`, so free-edition clients that omit it are
9
+ unaffected, and the free relay ignores it. Org_ID is generated high-entropy by the control
10
+ plane; the relay stores/verifies only its bcrypt hash.
11
+
12
+ ## [3.3.0] - 2026-06-03
13
+
14
+ ### Added
15
+ - New `./auth` subpath export — shared hashing/token primitives (`AuthService`):
16
+ bcrypt `hashSecret`/`verifySecret`, `generateToken`, SHA-256 `hashToken`,
17
+ `timingSafeCompare`. Caller injects the bcrypt cost factor. Moved verbatim from
18
+ the relay so the relay and the upcoming Team Edition control plane hash
19
+ Org_IDs and channel secrets identically (no drift between deployed services).
20
+
21
+ ### Changed
22
+ - Added `bcryptjs` as a runtime dependency (used by `AuthService`).
23
+
3
24
  ## [3.2.0] - 2026-06-01
4
25
 
5
26
  ### Added
6
27
  - New `./slack-format` subpath export — shared Slack <-> markdown translation engine,
7
- reused by the Slack adapter (and the upcoming Business Edition's distributed app):
28
+ reused by the Slack adapter (and the upcoming Team Edition's distributed app):
8
29
  - `slackToMarkdown`, `markdownToSlack`
9
30
  - `extractUserIds`, `resolveInboundMentions`, `resolveOutboundMentions`
10
31
  - `derivePeerId`, `buildPeerLabel`, `platformLabel`, `getAgentEmoji`
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Authentication / hashing primitives shared across Cogent services.
3
+ *
4
+ * Responsibilities:
5
+ * - bcrypt hashing of session secrets (one-time, during create/join)
6
+ * - Random bearer token generation with SHA-256 hashing for storage
7
+ * - Timing-safe comparison for token verification (every request)
8
+ *
9
+ * bcrypt is used for secrets (slow, salted -- appropriate for passwords).
10
+ * SHA-256 is used for tokens (fast -- tokens are high-entropy random values).
11
+ * Timing-safe comparison prevents timing attacks on token verification.
12
+ *
13
+ * The bcrypt cost factor is caller-injected so each deployment (free relay,
14
+ * business control plane) supplies its own configured rounds.
15
+ */
16
+ export declare class AuthService {
17
+ private readonly bcryptRounds;
18
+ constructor(bcryptRounds: number);
19
+ /**
20
+ * Hash a plaintext secret using bcrypt.
21
+ * Used during session creation and join operations.
22
+ */
23
+ hashSecret(plainSecret: string): Promise<string>;
24
+ /**
25
+ * Verify a plaintext secret against a bcrypt hash.
26
+ * Used during session join to validate the provided secret.
27
+ */
28
+ verifySecret(plainSecret: string, hash: string): Promise<boolean>;
29
+ /**
30
+ * Generate a cryptographically random bearer token.
31
+ * Returns both the plaintext token (to send to client) and its
32
+ * SHA-256 hash (to store on disk for lookup).
33
+ */
34
+ generateToken(): {
35
+ token: string;
36
+ tokenHash: string;
37
+ };
38
+ /**
39
+ * Compute the SHA-256 hash of a token string.
40
+ * Used by auth middleware to look up tokens in the session store index.
41
+ */
42
+ hashToken(token: string): string;
43
+ /**
44
+ * Timing-safe string comparison.
45
+ * Hashes both strings with SHA-256 to normalize length, then uses
46
+ * crypto.timingSafeEqual on the resulting buffers. This prevents
47
+ * timing attacks regardless of input string lengths.
48
+ */
49
+ timingSafeCompare(a: string, b: string): boolean;
50
+ }
51
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;GAcG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;gBAE1B,YAAY,EAAE,MAAM;IAIhC;;;OAGG;IACG,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAItD;;;OAGG;IACG,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAIvE;;;;OAIG;IACH,aAAa,IAAI;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE;IAMrD;;;OAGG;IACH,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAIhC;;;;;OAKG;IACH,iBAAiB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO;CAKjD"}
@@ -0,0 +1,66 @@
1
+ import crypto from "node:crypto";
2
+ import bcrypt from "bcryptjs";
3
+ /**
4
+ * Authentication / hashing primitives shared across Cogent services.
5
+ *
6
+ * Responsibilities:
7
+ * - bcrypt hashing of session secrets (one-time, during create/join)
8
+ * - Random bearer token generation with SHA-256 hashing for storage
9
+ * - Timing-safe comparison for token verification (every request)
10
+ *
11
+ * bcrypt is used for secrets (slow, salted -- appropriate for passwords).
12
+ * SHA-256 is used for tokens (fast -- tokens are high-entropy random values).
13
+ * Timing-safe comparison prevents timing attacks on token verification.
14
+ *
15
+ * The bcrypt cost factor is caller-injected so each deployment (free relay,
16
+ * business control plane) supplies its own configured rounds.
17
+ */
18
+ export class AuthService {
19
+ bcryptRounds;
20
+ constructor(bcryptRounds) {
21
+ this.bcryptRounds = bcryptRounds;
22
+ }
23
+ /**
24
+ * Hash a plaintext secret using bcrypt.
25
+ * Used during session creation and join operations.
26
+ */
27
+ async hashSecret(plainSecret) {
28
+ return bcrypt.hash(plainSecret, this.bcryptRounds);
29
+ }
30
+ /**
31
+ * Verify a plaintext secret against a bcrypt hash.
32
+ * Used during session join to validate the provided secret.
33
+ */
34
+ async verifySecret(plainSecret, hash) {
35
+ return bcrypt.compare(plainSecret, hash);
36
+ }
37
+ /**
38
+ * Generate a cryptographically random bearer token.
39
+ * Returns both the plaintext token (to send to client) and its
40
+ * SHA-256 hash (to store on disk for lookup).
41
+ */
42
+ generateToken() {
43
+ const token = crypto.randomBytes(32).toString("hex");
44
+ const tokenHash = this.hashToken(token);
45
+ return { token, tokenHash };
46
+ }
47
+ /**
48
+ * Compute the SHA-256 hash of a token string.
49
+ * Used by auth middleware to look up tokens in the session store index.
50
+ */
51
+ hashToken(token) {
52
+ return crypto.createHash("sha256").update(token).digest("hex");
53
+ }
54
+ /**
55
+ * Timing-safe string comparison.
56
+ * Hashes both strings with SHA-256 to normalize length, then uses
57
+ * crypto.timingSafeEqual on the resulting buffers. This prevents
58
+ * timing attacks regardless of input string lengths.
59
+ */
60
+ timingSafeCompare(a, b) {
61
+ const hashA = crypto.createHash("sha256").update(a).digest();
62
+ const hashB = crypto.createHash("sha256").update(b).digest();
63
+ return crypto.timingSafeEqual(hashA, hashB);
64
+ }
65
+ }
66
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,WAAW;IACL,YAAY,CAAS;IAEtC,YAAY,YAAoB;QAC9B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,UAAU,CAAC,WAAmB;QAClC,OAAO,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IACrD,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,YAAY,CAAC,WAAmB,EAAE,IAAY;QAClD,OAAO,MAAM,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;IAC3C,CAAC;IAED;;;;OAIG;IACH,aAAa;QACX,MAAM,KAAK,GAAG,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACrD,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACxC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;IAC9B,CAAC;IAED;;;OAGG;IACH,SAAS,CAAC,KAAa;QACrB,OAAO,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACjE,CAAC;IAED;;;;;OAKG;IACH,iBAAiB,CAAC,CAAS,EAAE,CAAS;QACpC,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QAC7D,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QAC7D,OAAO,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAC9C,CAAC;CACF"}
@@ -3,10 +3,24 @@ import { z } from "zod";
3
3
  export interface CreateSessionRequest {
4
4
  label?: string;
5
5
  secret: string;
6
+ /**
7
+ * Optional Org_ID — the 3rd join credential for Business Edition channels.
8
+ * When supplied on a multi-tenant relay, the channel becomes Org_ID-gated.
9
+ * Ignored by the free relay. Generated high-entropy by the control plane.
10
+ */
11
+ orgId?: string;
6
12
  }
7
13
  /** Request body for joining an existing session. */
8
14
  export interface JoinSessionRequest {
9
15
  secret: string;
16
+ /** Optional Org_ID — required to join an Org_ID-gated business channel. */
17
+ orgId?: string;
18
+ }
19
+ /** Request body for resolving a channel label (name) to its session ID. */
20
+ export interface ResolveSessionRequest {
21
+ label: string;
22
+ /** Optional Org_ID — required to resolve an Org_ID-gated business channel by name. */
23
+ orgId?: string;
10
24
  }
11
25
  /** Request body for registering a peer in a session. */
12
26
  export interface RegisterPeerRequest {
@@ -49,6 +63,12 @@ export declare const CreateSessionRequestSchema: z.ZodType<CreateSessionRequest>
49
63
  * Joins an existing session by providing the shared secret.
50
64
  */
51
65
  export declare const JoinSessionRequestSchema: z.ZodType<JoinSessionRequest>;
66
+ /**
67
+ * Schema for POST /api/sessions/resolve request body.
68
+ * Resolves a channel label to its session ID. An Org_ID scopes the lookup to a
69
+ * business channel (whose label is invisible to the public GET /resolve).
70
+ */
71
+ export declare const ResolveSessionRequestSchema: z.ZodType<ResolveSessionRequest>;
52
72
  /**
53
73
  * Schema for POST /api/sessions/:sessionId/peers request body.
54
74
  * Registers a new peer in a session. sessionId comes from URL path.
@@ -1 +1 @@
1
- {"version":3,"file":"api-requests.d.ts","sourceRoot":"","sources":["../../src/schemas/api-requests.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,sDAAsD;AACtD,MAAM,WAAW,oBAAoB;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,oDAAoD;AACpD,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wDAAwD;AACxD,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,IAAI,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,KAAK,CAAC;IACtD,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IACzB,SAAS,CAAC,EAAE,IAAI,GAAG,WAAW,GAAG,WAAW,GAAG,WAAW,CAAC;IAC3D,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC3C;AAED,+EAA+E;AAC/E,MAAM,WAAW,qBAAqB;CAAG;AAEzC,wDAAwD;AACxD,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE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CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;CAChB;AAID;;;GAGG;AACH,eAAO,MAAM,0BAA0B,EAAE,CAAC,CAAC,OAAO,CAAC,oBAAoB,CAM5D,CAAC;AAEZ;;;GAGG;AACH,eAAO,MAAM,wBAAwB,EAAE,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAKxD,CAAC;AAEZ;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,EAAE,CAAC,CAAC,OAAO,CAAC,qBAAqB,CAK9D,CAAC;AAEZ;;;GAGG;AACH,eAAO,MAAM,yBAAyB,EAAE,CAAC,CAAC,OAAO,CAAC,mBAAmB,CAU1D,CAAC;AAEZ;;;GAGG;AACH,eAAO,MAAM,2BAA2B,EAAE,CAAC,CAAC,OAAO,CAAC,qBAAqB,CAE9D,CAAC;AAEZ;;;GAGG;AACH,eAAO,MAAM,wBAAwB,EAAE,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAOxD,CAAC;AAEZ;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,CAAC,CAAC,OAAO,CAAC,eAAe,CAMlD,CAAC;AAEZ;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAKtC,CAAC"}
@@ -8,6 +8,7 @@ export const CreateSessionRequestSchema = z
8
8
  .object({
9
9
  label: z.string().regex(/^[a-z0-9][a-z0-9-]{1,30}[a-z0-9]$/).optional().describe("Optional human-readable session label (3-32 lowercase alphanumeric + hyphens)"),
10
10
  secret: z.string().min(8).describe("Shared secret for joining the session (min 8 chars)"),
11
+ orgId: z.string().min(1).optional().describe("Optional Org_ID -- gates the channel to Business Edition orgs (multi-tenant relay only)"),
11
12
  })
12
13
  .strict();
13
14
  /**
@@ -17,6 +18,18 @@ export const CreateSessionRequestSchema = z
17
18
  export const JoinSessionRequestSchema = z
18
19
  .object({
19
20
  secret: z.string().min(1).describe("Shared secret for the session"),
21
+ orgId: z.string().min(1).optional().describe("Optional Org_ID -- required for Org_ID-gated business channels"),
22
+ })
23
+ .strict();
24
+ /**
25
+ * Schema for POST /api/sessions/resolve request body.
26
+ * Resolves a channel label to its session ID. An Org_ID scopes the lookup to a
27
+ * business channel (whose label is invisible to the public GET /resolve).
28
+ */
29
+ export const ResolveSessionRequestSchema = z
30
+ .object({
31
+ label: z.string().regex(/^[a-z0-9][a-z0-9-]{1,30}[a-z0-9]$/).describe("Channel label (name) to resolve (3-32 lowercase alphanumeric + hyphens)"),
32
+ orgId: z.string().min(1).optional().describe("Optional Org_ID -- required to resolve an Org_ID-gated business channel"),
20
33
  })
21
34
  .strict();
22
35
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"api-requests.js","sourceRoot":"","sources":["../../src/schemas/api-requests.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAkDxB,wCAAwC;AAExC;;;GAGG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAoC,CAAC;KACzE,MAAM,CAAC;IACN,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,+EAA+E,CAAC;IACjK,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,qDAAqD,CAAC;CAC1F,CAAC;KACD,MAAM,EAAE,CAAC;AAEZ;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAkC,CAAC;KACrE,MAAM,CAAC;IACN,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,+BAA+B,CAAC;CACpE,CAAC;KACD,MAAM,EAAE,CAAC;AAEZ;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAmC,CAAC;KACvE,MAAM,CAAC;IACN,MAAM,EAAE,CAAC,CAAC,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eAAe,GAAyB,CAAC;KACnD,MAAM,CAAC;IACN,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,sCAAsC,CAAC;IACrF,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,mBAAmB,CAAC;CACxD,CAAC;KACD,MAAM,EAAE,CAAC"}
@@ -1,3 +1,3 @@
1
- export { CreateSessionRequestSchema, type CreateSessionRequest, JoinSessionRequestSchema, type JoinSessionRequest, RegisterPeerRequestSchema, type RegisterPeerRequest, DeregisterPeerRequestSchema, type DeregisterPeerRequest, SendMessageRequestSchema, type SendMessageRequest, GetHistoryQuerySchema, type GetHistoryQuery, PollQuerySchema, type PollQuery, } from "./api-requests.js";
1
+ export { CreateSessionRequestSchema, type CreateSessionRequest, JoinSessionRequestSchema, type JoinSessionRequest, ResolveSessionRequestSchema, type ResolveSessionRequest, RegisterPeerRequestSchema, type RegisterPeerRequest, DeregisterPeerRequestSchema, type DeregisterPeerRequest, SendMessageRequestSchema, type SendMessageRequest, GetHistoryQuerySchema, type GetHistoryQuery, PollQuerySchema, type PollQuery, } from "./api-requests.js";
2
2
  export { CreateSessionResponseSchema, type CreateSessionResponse, JoinSessionResponseSchema, type JoinSessionResponse, RegisterPeerResponseSchema, ListPeersResponseSchema, type ListPeersResponse, SendMessageResponseSchema, type SendMessageResponse, GetHistoryResponseSchema, type GetHistoryResponse, HealthResponseSchema, type HealthResponse, PeerEventSchema, type PeerEvent, PollResponseSchema, type PollResponse, ErrorResponseSchema, } from "./api-responses.js";
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,KAAK,oBAAoB,EACzB,wBAAwB,EACxB,KAAK,kBAAkB,EACvB,yBAAyB,EACzB,KAAK,mBAAmB,EACxB,2BAA2B,EAC3B,KAAK,qBAAqB,EAC1B,wBAAwB,EACxB,KAAK,kBAAkB,EACvB,qBAAqB,EACrB,KAAK,eAAe,EACpB,eAAe,EACf,KAAK,SAAS,GACf,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,2BAA2B,EAC3B,KAAK,qBAAqB,EAC1B,yBAAyB,EACzB,KAAK,mBAAmB,EACxB,0BAA0B,EAC1B,uBAAuB,EACvB,KAAK,iBAAiB,EACtB,yBAAyB,EACzB,KAAK,mBAAmB,EACxB,wBAAwB,EACxB,KAAK,kBAAkB,EACvB,oBAAoB,EACpB,KAAK,cAAc,EACnB,eAAe,EACf,KAAK,SAAS,EACd,kBAAkB,EAClB,KAAK,YAAY,EACjB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,KAAK,oBAAoB,EACzB,wBAAwB,EACxB,KAAK,kBAAkB,EACvB,2BAA2B,EAC3B,KAAK,qBAAqB,EAC1B,yBAAyB,EACzB,KAAK,mBAAmB,EACxB,2BAA2B,EAC3B,KAAK,qBAAqB,EAC1B,wBAAwB,EACxB,KAAK,kBAAkB,EACvB,qBAAqB,EACrB,KAAK,eAAe,EACpB,eAAe,EACf,KAAK,SAAS,GACf,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,2BAA2B,EAC3B,KAAK,qBAAqB,EAC1B,yBAAyB,EACzB,KAAK,mBAAmB,EACxB,0BAA0B,EAC1B,uBAAuB,EACvB,KAAK,iBAAiB,EACtB,yBAAyB,EACzB,KAAK,mBAAmB,EACxB,wBAAwB,EACxB,KAAK,kBAAkB,EACvB,oBAAoB,EACpB,KAAK,cAAc,EACnB,eAAe,EACf,KAAK,SAAS,EACd,kBAAkB,EAClB,KAAK,YAAY,EACjB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC"}
@@ -1,3 +1,3 @@
1
- export { CreateSessionRequestSchema, JoinSessionRequestSchema, RegisterPeerRequestSchema, DeregisterPeerRequestSchema, SendMessageRequestSchema, GetHistoryQuerySchema, PollQuerySchema, } from "./api-requests.js";
1
+ export { CreateSessionRequestSchema, JoinSessionRequestSchema, ResolveSessionRequestSchema, RegisterPeerRequestSchema, DeregisterPeerRequestSchema, SendMessageRequestSchema, GetHistoryQuerySchema, PollQuerySchema, } from "./api-requests.js";
2
2
  export { CreateSessionResponseSchema, JoinSessionResponseSchema, RegisterPeerResponseSchema, ListPeersResponseSchema, SendMessageResponseSchema, GetHistoryResponseSchema, HealthResponseSchema, PeerEventSchema, PollResponseSchema, ErrorResponseSchema, } from "./api-responses.js";
3
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAE1B,wBAAwB,EAExB,yBAAyB,EAEzB,2BAA2B,EAE3B,wBAAwB,EAExB,qBAAqB,EAErB,eAAe,GAEhB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,2BAA2B,EAE3B,yBAAyB,EAEzB,0BAA0B,EAC1B,uBAAuB,EAEvB,yBAAyB,EAEzB,wBAAwB,EAExB,oBAAoB,EAEpB,eAAe,EAEf,kBAAkB,EAElB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAE1B,wBAAwB,EAExB,2BAA2B,EAE3B,yBAAyB,EAEzB,2BAA2B,EAE3B,wBAAwB,EAExB,qBAAqB,EAErB,eAAe,GAEhB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,2BAA2B,EAE3B,yBAAyB,EAEzB,0BAA0B,EAC1B,uBAAuB,EAEvB,yBAAyB,EAEzB,wBAAwB,EAExB,oBAAoB,EAEpB,eAAe,EAEf,kBAAkB,EAElB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@essentialai/cogent",
3
- "version": "3.2.0",
3
+ "version": "3.5.0",
4
4
  "description": "Shared types, schemas, and contracts for Cogent Bridge",
5
5
  "type": "module",
6
6
  "exports": {
@@ -15,6 +15,10 @@
15
15
  "./slack-format": {
16
16
  "types": "./dist/slack-format/index.d.ts",
17
17
  "default": "./dist/slack-format/index.js"
18
+ },
19
+ "./auth": {
20
+ "types": "./dist/auth/index.d.ts",
21
+ "default": "./dist/auth/index.js"
18
22
  }
19
23
  },
20
24
  "files": [
@@ -32,6 +36,7 @@
32
36
  "check-exports": "attw --pack"
33
37
  },
34
38
  "dependencies": {
39
+ "bcryptjs": "^3.0.3",
35
40
  "slackify-markdown": "^5.0.0"
36
41
  },
37
42
  "peerDependencies": {