@engramind/client 0.0.0-stage → 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.
@@ -0,0 +1,215 @@
1
+ import { W as WhoAmI, g as ConsumerSettings, C as Category, E as EngramindAgent, p as EngramindSubscription, k as EngramindChannel, n as EngramindMemory, u as MemoryWrite, M as MemoryRevision, I as ImportResult, S as SearchResults, l as EngramindHint, h as ContextView, q as EngramindToken, s as IssuedToken, j as EngramindApp } from './types-BnU5iHwB.js';
2
+
3
+ interface ChannelQuery {
4
+ include_archived?: boolean;
5
+ cursor?: string;
6
+ limit?: number;
7
+ }
8
+ interface MemoryQuery {
9
+ channels?: string;
10
+ status?: string;
11
+ category?: string;
12
+ cursor?: string;
13
+ limit?: number;
14
+ stale?: boolean;
15
+ }
16
+ interface CategoryInput {
17
+ key: string;
18
+ label?: string;
19
+ description?: string;
20
+ priority?: number;
21
+ }
22
+
23
+ /**
24
+ * Cliente HTTP do Engramind — SOMENTE servidor. Bearer com o token do app (ou de um agente),
25
+ * `Idempotency-Key` em toda mutação, `If-None-Match` no contexto (`304` → `null`) e erros do envelope
26
+ * `{ error: { code, message, details } }` traduzidos para `EngramindError` (pt-BR), inclusive o 5xx
27
+ * mascarado por um proxy na frente do Engramind (Cloudflare).
28
+ */
29
+ type EngramindMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
30
+ type Query = Record<string, string | number | boolean | null | undefined>;
31
+ interface EngramindClientOptions {
32
+ /** URL base do Engramind (ex.: `https://engramind.exemplo.com`). */
33
+ baseUrl: string;
34
+ /** Token do app (`kind: app`), de um agente ou, no gestor, admin. Nunca vai ao navegador. */
35
+ token: string;
36
+ userAgent?: string;
37
+ timeoutMs?: number;
38
+ fetch?: typeof fetch;
39
+ /** Depuração: método, URL (com `focus` omitido), status e duração. Nunca recebe o corpo nem o token. */
40
+ onDebug?: (entry: {
41
+ method: string;
42
+ url: string;
43
+ status: number | null;
44
+ durationMs: number;
45
+ error?: string;
46
+ }) => void;
47
+ }
48
+ interface CallOptions {
49
+ query?: Query;
50
+ body?: unknown;
51
+ headers?: Record<string, string>;
52
+ /** Chave de idempotência fixa (importação); padrão: uma nova por mutação. */
53
+ idempotencyKey?: string;
54
+ signal?: AbortSignal;
55
+ timeoutMs?: number;
56
+ }
57
+ declare function buildUrl(baseUrl: string, path: string, query?: Query): string;
58
+ /** URL para a depuração: o texto do usuário (`focus`) vira o tamanho. */
59
+ declare function debugUrl(url: string): string;
60
+ declare function createEngramindClient(options: EngramindClientOptions): {
61
+ call: <T = unknown>(method: EngramindMethod, path: string, request?: CallOptions) => Promise<T>;
62
+ ready: (signal?: AbortSignal) => Promise<{
63
+ ready: boolean;
64
+ detail: string;
65
+ }>;
66
+ whoami: () => Promise<WhoAmI>;
67
+ consumerSettings: () => Promise<ConsumerSettings>;
68
+ categories: {
69
+ list: () => Promise<{
70
+ categories: Category[];
71
+ }>;
72
+ create: (input: CategoryInput) => Promise<Category>;
73
+ };
74
+ agents: {
75
+ list: (query?: Query) => Promise<{
76
+ agents: EngramindAgent[];
77
+ next_cursor: string | null;
78
+ }>;
79
+ get: (agent: string) => Promise<EngramindAgent>;
80
+ create: (input: {
81
+ app?: string;
82
+ slug: string;
83
+ name: string;
84
+ description?: string | null;
85
+ }) => Promise<EngramindAgent & {
86
+ created?: boolean;
87
+ }>;
88
+ update: (agent: string, input: {
89
+ name?: string;
90
+ description?: string | null;
91
+ disabled?: boolean;
92
+ }) => Promise<EngramindAgent>;
93
+ delete: (agent: string) => Promise<null>;
94
+ };
95
+ subscriptions: {
96
+ list: (query?: Query) => Promise<{
97
+ subscriptions: EngramindSubscription[];
98
+ next_cursor: string | null;
99
+ }>;
100
+ create: (input: {
101
+ agent: string;
102
+ target: string;
103
+ mode: "inject" | "search" | "manage";
104
+ access?: string[] | null;
105
+ priority?: number | null;
106
+ }) => Promise<EngramindSubscription & {
107
+ created?: boolean;
108
+ }>;
109
+ update: (subscription: string, input: {
110
+ mode?: "inject" | "search" | "manage";
111
+ access?: string[] | null;
112
+ priority?: number | null;
113
+ }) => Promise<EngramindSubscription>;
114
+ delete: (subscription: string) => Promise<null>;
115
+ };
116
+ channels: {
117
+ list: (query?: ChannelQuery) => Promise<{
118
+ channels: EngramindChannel[];
119
+ next_cursor: string | null;
120
+ }>;
121
+ get: (channel: string) => Promise<EngramindChannel>;
122
+ archive: (channel: string) => Promise<EngramindChannel>;
123
+ restore: (channel: string) => Promise<EngramindChannel>;
124
+ };
125
+ memories: {
126
+ list: (query?: MemoryQuery) => Promise<{
127
+ memories: EngramindMemory[];
128
+ next_cursor: string | null;
129
+ }>;
130
+ get: (memory: string) => Promise<EngramindMemory>;
131
+ create: (input: {
132
+ channel: string;
133
+ text: string;
134
+ category?: string;
135
+ key?: string;
136
+ tags?: string[];
137
+ }) => Promise<MemoryWrite>;
138
+ update: (memory: string, input: {
139
+ text?: string;
140
+ category?: string;
141
+ expected_version?: number;
142
+ tags?: string[];
143
+ }) => Promise<MemoryWrite>;
144
+ delete: (memory: string) => Promise<null>;
145
+ archive: (memory: string) => Promise<EngramindMemory>;
146
+ restore: (memory: string) => Promise<EngramindMemory>;
147
+ pin: (memory: string) => Promise<EngramindMemory>;
148
+ unpin: (memory: string) => Promise<EngramindMemory>;
149
+ move: (memory: string, channel: string) => Promise<EngramindMemory>;
150
+ history: (memory: string, query?: Query) => Promise<{
151
+ revisions: MemoryRevision[];
152
+ next_cursor: string | null;
153
+ }>;
154
+ revert: (memory: string, version: number) => Promise<EngramindMemory>;
155
+ import: (input: {
156
+ channel: string;
157
+ memories: unknown[];
158
+ }, idempotencyKey?: string) => Promise<ImportResult>;
159
+ search: (input: {
160
+ query: string;
161
+ channels?: string[];
162
+ categories?: string[];
163
+ limit?: number;
164
+ include_archived?: boolean;
165
+ exclude_context?: boolean;
166
+ }) => Promise<SearchResults & {
167
+ context_version?: string;
168
+ }>;
169
+ };
170
+ hints: (input: {
171
+ text: string;
172
+ channels?: string[];
173
+ limit?: number;
174
+ }) => Promise<{
175
+ hints: EngramindHint[];
176
+ }>;
177
+ context: (input: {
178
+ channels?: string[];
179
+ format?: string;
180
+ focus?: string;
181
+ ifNoneMatch?: string | null;
182
+ }, request?: Pick<CallOptions, "signal" | "timeoutMs">) => Promise<ContextView | null>;
183
+ tokens: {
184
+ list: (query?: Query) => Promise<{
185
+ tokens: EngramindToken[];
186
+ next_cursor: string | null;
187
+ }>;
188
+ issue: (input: {
189
+ kind: "agent" | "app" | "admin";
190
+ agent?: string;
191
+ app?: string;
192
+ scopes: string[];
193
+ label?: string;
194
+ expires_at?: string;
195
+ }) => Promise<IssuedToken>;
196
+ update: (token: string, input: {
197
+ label?: string | null;
198
+ scopes?: string[];
199
+ expires_at?: string | null;
200
+ }) => Promise<EngramindToken>;
201
+ revoke: (token: string) => Promise<EngramindToken>;
202
+ rotate: (token: string) => Promise<IssuedToken>;
203
+ };
204
+ apps: {
205
+ get: (app: string) => Promise<EngramindApp>;
206
+ /** `update_app_webhook`: grava ou remove (com `null`) a URL e o segredo do webhook do app. */
207
+ updateWebhook: (app: string, input: {
208
+ url: string | null;
209
+ secret?: string | null;
210
+ }) => Promise<EngramindApp>;
211
+ };
212
+ };
213
+ type EngramindClient = ReturnType<typeof createEngramindClient>;
214
+
215
+ export { type CallOptions as C, type EngramindClient as E, type MemoryQuery as M, type Query as Q, type EngramindMethod as a, type CategoryInput as b, type ChannelQuery as c, type EngramindClientOptions as d, buildUrl as e, createEngramindClient as f, debugUrl as g };
@@ -0,0 +1,117 @@
1
+ /**
2
+ * Erros do Engramind traduzidos para pt-BR. Decide pelo `code` estável do envelope
3
+ * `{ error: { code, message, details } }`, nunca pela `message`. Os códigos expostos pela lib levam o
4
+ * prefixo `ENGRAMIND_` (ex.: `ENGRAMIND_CHANNEL_SHARED`), e os erros da própria lib também
5
+ * (`ENGRAMIND_UNREACHABLE`, `ENGRAMIND_PROXY_MASKED`, `ENGRAMIND_NOT_CONFIGURED`).
6
+ */
7
+ interface EngramindErrorBody {
8
+ code: string;
9
+ message?: string;
10
+ details?: unknown;
11
+ }
12
+ declare class EngramindError extends Error {
13
+ readonly status: number;
14
+ readonly code: string;
15
+ readonly details?: unknown;
16
+ /** Segundos de `Retry-After` (429). */
17
+ readonly retryAfter: number | null;
18
+ constructor(status: number, message: string, code: string, details?: unknown, retryAfter?: number | null);
19
+ }
20
+ /** Status devolvido ao navegador: falha do próprio serviço vira 502 e token recusado vira 409 (reconfigurar). */
21
+ declare function clientStatus(status: number): number;
22
+ /**
23
+ * Corpo de um 5xx trocado pelo proxy na frente do Engramind (o Cloudflare substitui o corpo das respostas
24
+ * 5xx pela própria página/JSON): devolve o nome do erro do proxy, quando reconhecido.
25
+ */
26
+ declare function proxyMaskedError(text: string, json: unknown): string | null;
27
+ declare function toEngramindError(status: number, body: EngramindErrorBody | null, retryAfter?: string | null, masked?: string | null): EngramindError;
28
+ /** Engramind fora do ar ou inalcançável. */
29
+ declare const unreachableError: (reason: string) => EngramindError;
30
+ declare const notConfiguredError: () => EngramindError;
31
+ /** Código do Engramind (sem o prefixo) de um erro traduzido. */
32
+ declare const engramindCodeOf: (error: unknown) => string | null;
33
+
34
+ /**
35
+ * Eventos do Engramind (webhook) e o formato que a lib repassa ao navegador pelo SSE: só ids, slugs e
36
+ * tipos — nunca texto, título, `query` ou segredo.
37
+ */
38
+ type WebhookEventType = "memory.created" | "memory.updated" | "memory.archived" | "memory.deleted" | "memory.consumed" | "channel.updated" | "subscription.updated" | "settings.updated" | "identities.updated";
39
+ /** Corpo do webhook (`POST <webhook_url>`), contrato do Engramind ≥ 0.12.0. */
40
+ interface WebhookEvent {
41
+ id: string;
42
+ type: WebhookEventType | (string & {});
43
+ channel: string | null;
44
+ channel_version?: number | null;
45
+ memory_ids?: string[];
46
+ at?: string;
47
+ keys?: string[];
48
+ subscription?: string;
49
+ agent?: string | null;
50
+ target?: string;
51
+ app?: string | null;
52
+ consumption?: string;
53
+ operation?: "get_context" | "search_memories" | "get_hints" | "get_memory" | (string & {});
54
+ title_ids?: string[];
55
+ context_version?: string;
56
+ }
57
+ /** Evento ao vivo entregue pelo SSE da lib (`event: engramind`). */
58
+ interface LiveEvent {
59
+ /** `id` do webhook (ausente nos eventos gerados pelo próprio app). */
60
+ id?: string;
61
+ type: string;
62
+ channel?: string | null;
63
+ memoryIds?: string[];
64
+ keys?: string[];
65
+ agent?: string | null;
66
+ app?: string | null;
67
+ consumption?: string;
68
+ operation?: string;
69
+ titleIds?: string[];
70
+ contextVersion?: string;
71
+ at?: string;
72
+ }
73
+ /** Webhook → evento ao vivo (só os campos permitidos). */
74
+ declare function toLiveEvent(event: WebhookEvent): LiveEvent;
75
+ /** `memory.consumed` não muda nada: nunca marca o contexto como sujo nem invalida as listas. */
76
+ declare const isConsumedEvent: (type: string) => type is "memory.consumed";
77
+ /** Eventos `memory.*` que mudam o contexto (todos menos `memory.consumed`). */
78
+ declare const isMemoryChange: (type: string) => boolean;
79
+ /**
80
+ * Consumo agrupado (um por `consumption`): o formato que a rede anima. `channels` são os canais que
81
+ * entregaram memórias (um evento por canal), `delivered` idem.
82
+ */
83
+ interface ConsumptionEvent {
84
+ /** Agente que leu (`app/agente`). */
85
+ agent: string;
86
+ kind: "context" | "search";
87
+ channels: string[];
88
+ delivered: string[];
89
+ memoryIds: string[];
90
+ titleIds?: string[];
91
+ version?: string;
92
+ /** Id do consumo no Engramind (`cns_…`). */
93
+ consumption?: string;
94
+ operation?: string;
95
+ }
96
+ /** Junta os eventos `memory.consumed` de uma mesma leitura (`consumption`). */
97
+ declare function mergeConsumption(events: readonly LiveEvent[]): ConsumptionEvent | null;
98
+ interface ConsumptionGrouperOptions {
99
+ /** Espera para juntar os eventos de canais da mesma leitura (padrão 400 ms). */
100
+ windowMs?: number;
101
+ /** Quantos `consumption` já emitidos são lembrados para descartar repetições (padrão 500). */
102
+ memory?: number;
103
+ onGroup: (event: ConsumptionEvent) => void;
104
+ }
105
+ /**
106
+ * Agrupa `memory.consumed` por `consumption`: emite **um** consumo por leitura, depois de `windowMs` sem
107
+ * novos canais. Evento sem `agent` (leitura por token de app ou admin) é ignorado, e um `consumption` já
108
+ * emitido não é emitido de novo (retentativa do webhook). Isomórfico (servidor e navegador).
109
+ */
110
+ declare function createConsumptionGrouper(options: ConsumptionGrouperOptions): {
111
+ push(event: LiveEvent): void;
112
+ /** Emite os grupos pendentes na hora (desmontagem, testes). */
113
+ flushAll(): void;
114
+ dispose(): void;
115
+ };
116
+
117
+ export { type ConsumptionEvent as C, EngramindError as E, type LiveEvent as L, type WebhookEvent as W, type ConsumptionGrouperOptions as a, type EngramindErrorBody as b, type WebhookEventType as c, clientStatus as d, createConsumptionGrouper as e, engramindCodeOf as f, isMemoryChange as g, toLiveEvent as h, isConsumedEvent as i, mergeConsumption as m, notConfiguredError as n, proxyMaskedError as p, toEngramindError as t, unreachableError as u };
@@ -0,0 +1,149 @@
1
+ export { A as AuditEvent, a as Author, C as Category, b as ChannelSettingMeta, c as ChannelSettingsView, d as ChannelStats, e as ConsolidationPlan, f as ConsolidationRun, g as ConsumerSettings, h as ContextView, i as CursorPage, E as EngramindAgent, j as EngramindApp, k as EngramindChannel, l as EngramindHint, m as EngramindJob, n as EngramindMemory, o as EngramindStatus, p as EngramindSubscription, q as EngramindToken, r as EngramindTokenKind, I as ImportResult, s as IssuedToken, L as LlmCall, t as LocalModelStatus, M as MemoryRevision, u as MemoryWrite, R as Ref, S as SearchResults, v as SettingMeta, U as UsageReport, W as WhoAmI } from './types-BnU5iHwB.js';
2
+ export { C as ConsumptionEvent, a as ConsumptionGrouperOptions, E as EngramindError, b as EngramindErrorBody, L as LiveEvent, W as WebhookEvent, c as WebhookEventType, d as clientStatus, e as createConsumptionGrouper, f as engramindCodeOf, i as isConsumedEvent, g as isMemoryChange, m as mergeConsumption, n as notConfiguredError, p as proxyMaskedError, t as toEngramindError, h as toLiveEvent, u as unreachableError } from './events-DYEjIvxs.js';
3
+ import { z } from 'zod';
4
+
5
+ /** Prefixo das chaves do TanStack Query da lib (`["engramind", <área>, ...]`). */
6
+ declare const ENGRAMIND_QUERY_KEY = "engramind";
7
+ declare const ENGRAMIND_SCOPES: readonly ["read", "write", "delete"];
8
+ type EngramindScope = (typeof ENGRAMIND_SCOPES)[number];
9
+ declare const SCOPE_COMBINATIONS: readonly ["read", "read+write", "read+delete", "read+write+delete"];
10
+ type ScopeCombination = (typeof SCOPE_COMBINATIONS)[number];
11
+ declare const scopesOfCombination: (combination: ScopeCombination) => EngramindScope[];
12
+ declare function combinationOf(scopes: readonly string[]): ScopeCombination | null;
13
+ declare const TOKEN_KINDS: readonly ["admin", "app", "agent"];
14
+ declare const SUBSCRIPTION_MODES: readonly ["inject", "search", "manage"];
15
+ declare const MEMORY_STATUSES: readonly ["active", "permanent", "archived"];
16
+
17
+ /**
18
+ * Schemas de entrada das operações que a lib usa (os mesmos do catálogo do Opex): o formulário valida com
19
+ * eles e o proxy valida o corpo antes de chamar o Engramind.
20
+ */
21
+ declare const limit: z.ZodOptional<z.ZodNumber>;
22
+ declare const cursor: z.ZodOptional<z.ZodString>;
23
+ declare const page: {
24
+ cursor: z.ZodOptional<z.ZodString>;
25
+ limit: z.ZodOptional<z.ZodNumber>;
26
+ };
27
+ /** Slug hierárquico do canal (`eng/global`): minúsculas, dígitos e hífens; até 8 segmentos e 120 caracteres. */
28
+ declare const channelSlugSchema: z.ZodString;
29
+ declare const channelRef: z.ZodString;
30
+ declare const appRef: z.ZodString;
31
+ declare const agentRef: z.ZodString;
32
+ declare const tokenRef: z.ZodString;
33
+ declare const memoryRef: z.ZodString;
34
+ /** Alvo de assinatura: canal exato (`eng/global`) ou prefixo com um segmento completo antes do `*` (`eng/*`, `eng/projeto-*`). */
35
+ declare function isValidSubscriptionTarget(value: string): boolean;
36
+ declare const createAgentInput: z.ZodObject<{
37
+ app: z.ZodString;
38
+ slug: z.ZodString;
39
+ name: z.ZodString;
40
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
41
+ }, z.core.$strip>;
42
+ declare const updateAgentInput: z.ZodObject<{
43
+ agent: z.ZodString;
44
+ name: z.ZodOptional<z.ZodString>;
45
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
46
+ disabled: z.ZodOptional<z.ZodBoolean>;
47
+ }, z.core.$strip>;
48
+ declare const updateTokenInput: z.ZodObject<{
49
+ token: z.ZodString;
50
+ label: z.ZodOptional<z.ZodNullable<z.ZodString>>;
51
+ scopes: z.ZodOptional<z.ZodArray<z.ZodEnum<{
52
+ read: "read";
53
+ write: "write";
54
+ delete: "delete";
55
+ }>>>;
56
+ expires_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
57
+ }, z.core.$strip>;
58
+ declare const createChannelInput: z.ZodObject<{
59
+ slug: z.ZodString;
60
+ name: z.ZodString;
61
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
62
+ priority: z.ZodOptional<z.ZodNumber>;
63
+ }, z.core.$strip>;
64
+ declare const updateChannelInput: z.ZodObject<{
65
+ channel: z.ZodString;
66
+ name: z.ZodOptional<z.ZodString>;
67
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
68
+ priority: z.ZodOptional<z.ZodNumber>;
69
+ }, z.core.$strip>;
70
+ declare const subscribeInput: z.ZodObject<{
71
+ agent: z.ZodString;
72
+ target: z.ZodString;
73
+ mode: z.ZodEnum<{
74
+ inject: "inject";
75
+ search: "search";
76
+ manage: "manage";
77
+ }>;
78
+ access: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodEnum<{
79
+ read: "read";
80
+ write: "write";
81
+ delete: "delete";
82
+ }>>>>;
83
+ priority: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
84
+ }, z.core.$strip>;
85
+ declare const updateSubscriptionInput: z.ZodObject<{
86
+ subscription: z.ZodString;
87
+ mode: z.ZodOptional<z.ZodEnum<{
88
+ inject: "inject";
89
+ search: "search";
90
+ manage: "manage";
91
+ }>>;
92
+ access: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodEnum<{
93
+ read: "read";
94
+ write: "write";
95
+ delete: "delete";
96
+ }>>>>;
97
+ priority: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
98
+ }, z.core.$strip>;
99
+ declare const issueTokenInput: z.ZodObject<{
100
+ kind: z.ZodEnum<{
101
+ admin: "admin";
102
+ agent: "agent";
103
+ app: "app";
104
+ }>;
105
+ app: z.ZodOptional<z.ZodString>;
106
+ agent: z.ZodOptional<z.ZodString>;
107
+ scopes: z.ZodArray<z.ZodEnum<{
108
+ read: "read";
109
+ write: "write";
110
+ delete: "delete";
111
+ }>>;
112
+ label: z.ZodOptional<z.ZodString>;
113
+ expires_at: z.ZodOptional<z.ZodString>;
114
+ }, z.core.$strip>;
115
+ declare const createMemoryInput: z.ZodObject<{
116
+ channel: z.ZodString;
117
+ text: z.ZodString;
118
+ category: z.ZodOptional<z.ZodString>;
119
+ key: z.ZodOptional<z.ZodString>;
120
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
121
+ }, z.core.$strip>;
122
+ declare const updateMemoryInput: z.ZodObject<{
123
+ text: z.ZodOptional<z.ZodString>;
124
+ category: z.ZodOptional<z.ZodString>;
125
+ expected_version: z.ZodOptional<z.ZodNumber>;
126
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
127
+ }, z.core.$strip>;
128
+ declare const moveMemoryInput: z.ZodObject<{
129
+ channel: z.ZodString;
130
+ }, z.core.$strip>;
131
+ /** `update_app_webhook`: `url: null` remove a URL e o segredo; URL exige segredo (o enviado ou o já gravado). */
132
+ declare const appWebhookInput: z.ZodObject<{
133
+ url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
134
+ secret: z.ZodOptional<z.ZodNullable<z.ZodString>>;
135
+ }, z.core.$strict>;
136
+ declare const memoryStatusSchema: z.ZodEnum<{
137
+ active: "active";
138
+ permanent: "permanent";
139
+ archived: "archived";
140
+ }>;
141
+
142
+ /** Escopos de um token ou acesso de assinatura: só `read`, `read+write`, `read+delete` ou `read+write+delete`. */
143
+ declare const scopesSchema: z.ZodArray<z.ZodEnum<{
144
+ read: "read";
145
+ write: "write";
146
+ delete: "delete";
147
+ }>>;
148
+
149
+ export { ENGRAMIND_QUERY_KEY, ENGRAMIND_SCOPES, type EngramindScope, MEMORY_STATUSES, SCOPE_COMBINATIONS, SUBSCRIPTION_MODES, type ScopeCombination, TOKEN_KINDS, agentRef, appRef, appWebhookInput, channelRef, channelSlugSchema, combinationOf, createAgentInput, createChannelInput, createMemoryInput, cursor, isValidSubscriptionTarget, issueTokenInput, limit, memoryRef, memoryStatusSchema, moveMemoryInput, page, scopesOfCombination, scopesSchema, subscribeInput, tokenRef, updateAgentInput, updateChannelInput, updateMemoryInput, updateSubscriptionInput, updateTokenInput };
package/dist/index.js ADDED
@@ -0,0 +1,132 @@
1
+ import {
2
+ EngramindError,
3
+ clientStatus,
4
+ createConsumptionGrouper,
5
+ engramindCodeOf,
6
+ isConsumedEvent,
7
+ isMemoryChange,
8
+ mergeConsumption,
9
+ notConfiguredError,
10
+ proxyMaskedError,
11
+ toEngramindError,
12
+ toLiveEvent,
13
+ unreachableError
14
+ } from "./chunk-THVEWMKQ.js";
15
+
16
+ // src/core/constants.ts
17
+ var ENGRAMIND_QUERY_KEY = "engramind";
18
+ var ENGRAMIND_SCOPES = ["read", "write", "delete"];
19
+ var SCOPE_COMBINATIONS = ["read", "read+write", "read+delete", "read+write+delete"];
20
+ var scopesOfCombination = (combination) => combination.split("+");
21
+ function combinationOf(scopes) {
22
+ const key = ENGRAMIND_SCOPES.filter((scope) => scopes.includes(scope)).join("+");
23
+ return SCOPE_COMBINATIONS.includes(key) && key.split("+").length === scopes.length ? key : null;
24
+ }
25
+ var TOKEN_KINDS = ["admin", "app", "agent"];
26
+ var SUBSCRIPTION_MODES = ["inject", "search", "manage"];
27
+ var MEMORY_STATUSES = ["active", "permanent", "archived"];
28
+
29
+ // src/core/schemas.ts
30
+ import { z as z2 } from "zod";
31
+
32
+ // src/core/scopes.ts
33
+ import { z } from "zod";
34
+ var scopesSchema = z.array(z.enum(ENGRAMIND_SCOPES)).min(1, "Escolha os escopos").max(3).refine((scopes) => combinationOf(scopes) !== null, "Combina\xE7\xF5es aceitas: read, read+write, read+delete ou read+write+delete (write e delete exigem read)");
35
+
36
+ // src/core/schemas.ts
37
+ var limit = z2.number().int().min(1).max(200).optional().describe("Itens por p\xE1gina (1 a 200, padr\xE3o 50)");
38
+ var cursor = z2.string().trim().min(1).max(500).optional().describe("Cursor da pr\xF3xima p\xE1gina (next_cursor)");
39
+ var page = { cursor, limit };
40
+ var isoDate = z2.string().trim().datetime({ offset: true, message: "Use data e hora RFC 3339 (ex.: 2026-10-31T12:00:00Z)" });
41
+ var channelSlugSchema = z2.string().trim().max(120, "At\xE9 120 caracteres").regex(/^[a-z0-9]+(?:-[a-z0-9]+)*(?:\/[a-z0-9]+(?:-[a-z0-9]+)*){0,7}$/, "Use segmentos com min\xFAsculas, d\xEDgitos e h\xEDfens simples, separados por /");
42
+ var channelRef = z2.string().trim().min(1).max(160).describe("Id (ch_\u2026) ou slug do canal (eng/global)");
43
+ var identitySlug = z2.string().trim().min(1).max(64).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/, "Use min\xFAsculas, d\xEDgitos e h\xEDfens simples");
44
+ var appRef = z2.string().trim().min(1).max(80).describe("Id (app_\u2026) ou slug do app");
45
+ var agentRef = z2.string().trim().min(1).max(160).describe("Id (ag_\u2026) ou app/agente");
46
+ var tokenRef = z2.string().trim().min(1).max(40).describe("Id do token (tk_\u2026)");
47
+ var memoryRef = z2.string().trim().min(1).max(60).describe("Id da mem\xF3ria (m_\u2026)");
48
+ var name = z2.string().trim().min(1, "Informe o nome").max(120);
49
+ var description = z2.string().trim().max(1e3).nullable().optional();
50
+ var priority = z2.number().int().min(-1e3).max(1e3);
51
+ var webhookUrl = z2.string().trim().url("URL inv\xE1lida").max(2048).regex(/^https?:\/\//, "Use http:// ou https://").nullable().optional();
52
+ var webhookSecret = z2.string().min(32, "O segredo do webhook tem de 32 a 256 caracteres").max(256).nullable().optional();
53
+ function isValidSubscriptionTarget(value) {
54
+ if (!value.endsWith("*")) return channelSlugSchema.safeParse(value).success;
55
+ const base = value.slice(0, -1);
56
+ const slash = base.lastIndexOf("/");
57
+ if (slash <= 0) return false;
58
+ return channelSlugSchema.safeParse(base.slice(0, slash)).success && /^[a-z0-9-]*$/.test(base.slice(slash + 1));
59
+ }
60
+ var subscriptionTarget = z2.string().trim().min(1).max(121).refine(isValidSubscriptionTarget, "Canal exato (eng/global) ou prefixo terminado em * depois de um segmento completo (eng/*, eng/projeto-*)");
61
+ var createAgentInput = z2.object({ app: appRef, slug: identitySlug, name, description });
62
+ var updateAgentInput = z2.object({ agent: agentRef, name: name.optional(), description, disabled: z2.boolean().optional() });
63
+ var updateTokenInput = z2.object({ token: tokenRef, label: z2.string().trim().max(120).nullable().optional(), scopes: scopesSchema.optional(), expires_at: isoDate.nullable().optional() });
64
+ var createChannelInput = z2.object({ slug: channelSlugSchema, name, description, priority: priority.optional() });
65
+ var updateChannelInput = z2.object({ channel: channelRef, name: name.optional(), description, priority: priority.optional() });
66
+ var subscribeInput = z2.object({ agent: agentRef, target: subscriptionTarget, mode: z2.enum(SUBSCRIPTION_MODES), access: scopesSchema.nullable().optional(), priority: priority.nullable().optional() });
67
+ var updateSubscriptionInput = z2.object({ subscription: z2.string().trim().min(1).max(40), mode: z2.enum(SUBSCRIPTION_MODES).optional(), access: scopesSchema.nullable().optional(), priority: priority.nullable().optional() });
68
+ var issueTokenInput = z2.object({
69
+ kind: z2.enum(TOKEN_KINDS),
70
+ app: appRef.optional(),
71
+ agent: agentRef.optional(),
72
+ scopes: scopesSchema,
73
+ label: z2.string().trim().max(120).optional(),
74
+ expires_at: isoDate.optional()
75
+ }).superRefine((value, ctx) => {
76
+ if (value.kind === "agent" && !value.agent) ctx.addIssue({ code: "custom", path: ["agent"], message: "Token agent exige o agente" });
77
+ if (value.kind === "admin" && !value.app && !value.agent) ctx.addIssue({ code: "custom", path: ["app"], message: "Informe o app do token admin" });
78
+ if (value.kind === "app" && !value.app) ctx.addIssue({ code: "custom", path: ["app"], message: "Informe o app do token de app" });
79
+ if (value.kind === "app" && value.agent) ctx.addIssue({ code: "custom", path: ["agent"], message: "Token de app n\xE3o tem agente" });
80
+ }).meta({ examples: [{ kind: "agent", agent: "app-a/curador", scopes: ["read", "write"] }] });
81
+ var createMemoryInput = z2.object({ channel: channelRef, text: z2.string().min(1), category: z2.string().trim().min(1).max(64).optional(), key: z2.string().trim().max(200).optional(), tags: z2.array(z2.string()).optional() });
82
+ var updateMemoryInput = z2.object({ text: z2.string().min(1).optional(), category: z2.string().trim().min(1).max(64).optional(), expected_version: z2.number().int().optional(), tags: z2.array(z2.string()).optional() });
83
+ var moveMemoryInput = z2.object({ channel: channelRef });
84
+ var appWebhookInput = z2.object({ url: webhookUrl, secret: webhookSecret }).strict();
85
+ var memoryStatusSchema = z2.enum(MEMORY_STATUSES);
86
+ export {
87
+ ENGRAMIND_QUERY_KEY,
88
+ ENGRAMIND_SCOPES,
89
+ EngramindError,
90
+ MEMORY_STATUSES,
91
+ SCOPE_COMBINATIONS,
92
+ SUBSCRIPTION_MODES,
93
+ TOKEN_KINDS,
94
+ agentRef,
95
+ appRef,
96
+ appWebhookInput,
97
+ channelRef,
98
+ channelSlugSchema,
99
+ clientStatus,
100
+ combinationOf,
101
+ createAgentInput,
102
+ createChannelInput,
103
+ createConsumptionGrouper,
104
+ createMemoryInput,
105
+ cursor,
106
+ engramindCodeOf,
107
+ isConsumedEvent,
108
+ isMemoryChange,
109
+ isValidSubscriptionTarget,
110
+ issueTokenInput,
111
+ limit,
112
+ memoryRef,
113
+ memoryStatusSchema,
114
+ mergeConsumption,
115
+ moveMemoryInput,
116
+ notConfiguredError,
117
+ page,
118
+ proxyMaskedError,
119
+ scopesOfCombination,
120
+ scopesSchema,
121
+ subscribeInput,
122
+ toEngramindError,
123
+ toLiveEvent,
124
+ tokenRef,
125
+ unreachableError,
126
+ updateAgentInput,
127
+ updateChannelInput,
128
+ updateMemoryInput,
129
+ updateSubscriptionInput,
130
+ updateTokenInput
131
+ };
132
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/core/constants.ts","../src/core/schemas.ts","../src/core/scopes.ts"],"sourcesContent":["/** Prefixo das chaves do TanStack Query da lib (`[\"engramind\", <área>, ...]`). */\nexport const ENGRAMIND_QUERY_KEY = \"engramind\"\n\nexport const ENGRAMIND_SCOPES = [\"read\", \"write\", \"delete\"] as const\nexport type EngramindScope = (typeof ENGRAMIND_SCOPES)[number]\nexport const SCOPE_COMBINATIONS = [\"read\", \"read+write\", \"read+delete\", \"read+write+delete\"] as const\nexport type ScopeCombination = (typeof SCOPE_COMBINATIONS)[number]\nexport const scopesOfCombination = (combination: ScopeCombination): EngramindScope[] => combination.split(\"+\") as EngramindScope[]\nexport function combinationOf(scopes: readonly string[]): ScopeCombination | null {\n const key = ENGRAMIND_SCOPES.filter((scope) => scopes.includes(scope)).join(\"+\")\n return (SCOPE_COMBINATIONS as readonly string[]).includes(key) && key.split(\"+\").length === scopes.length ? (key as ScopeCombination) : null\n}\n\nexport const TOKEN_KINDS = [\"admin\", \"app\", \"agent\"] as const\nexport const SUBSCRIPTION_MODES = [\"inject\", \"search\", \"manage\"] as const\nexport const MEMORY_STATUSES = [\"active\", \"permanent\", \"archived\"] as const\n","import { z } from \"zod\"\nimport { MEMORY_STATUSES, SUBSCRIPTION_MODES, TOKEN_KINDS } from \"./constants\"\nimport { scopesSchema } from \"./scopes\"\n\n/**\n * Schemas de entrada das operações que a lib usa (os mesmos do catálogo do Opex): o formulário valida com\n * eles e o proxy valida o corpo antes de chamar o Engramind.\n */\n\nconst limit = z.number().int().min(1).max(200).optional().describe(\"Itens por página (1 a 200, padrão 50)\")\nconst cursor = z.string().trim().min(1).max(500).optional().describe(\"Cursor da próxima página (next_cursor)\")\nconst page = { cursor, limit }\nconst isoDate = z.string().trim().datetime({ offset: true, message: \"Use data e hora RFC 3339 (ex.: 2026-10-31T12:00:00Z)\" })\n\n/** Slug hierárquico do canal (`eng/global`): minúsculas, dígitos e hífens; até 8 segmentos e 120 caracteres. */\nexport const channelSlugSchema = z\n .string()\n .trim()\n .max(120, \"Até 120 caracteres\")\n .regex(/^[a-z0-9]+(?:-[a-z0-9]+)*(?:\\/[a-z0-9]+(?:-[a-z0-9]+)*){0,7}$/, \"Use segmentos com minúsculas, dígitos e hífens simples, separados por /\")\nconst channelRef = z.string().trim().min(1).max(160).describe(\"Id (ch_…) ou slug do canal (eng/global)\")\nconst identitySlug = z\n .string()\n .trim()\n .min(1)\n .max(64)\n .regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/, \"Use minúsculas, dígitos e hífens simples\")\nconst appRef = z.string().trim().min(1).max(80).describe(\"Id (app_…) ou slug do app\")\nconst agentRef = z.string().trim().min(1).max(160).describe(\"Id (ag_…) ou app/agente\")\nconst tokenRef = z.string().trim().min(1).max(40).describe(\"Id do token (tk_…)\")\nconst memoryRef = z.string().trim().min(1).max(60).describe(\"Id da memória (m_…)\")\nconst name = z.string().trim().min(1, \"Informe o nome\").max(120)\nconst description = z.string().trim().max(1000).nullable().optional()\nconst priority = z.number().int().min(-1000).max(1000)\nconst webhookUrl = z.string().trim().url(\"URL inválida\").max(2048).regex(/^https?:\\/\\//, \"Use http:// ou https://\").nullable().optional()\nconst webhookSecret = z.string().min(32, \"O segredo do webhook tem de 32 a 256 caracteres\").max(256).nullable().optional()\n/** Alvo de assinatura: canal exato (`eng/global`) ou prefixo com um segmento completo antes do `*` (`eng/*`, `eng/projeto-*`). */\nexport function isValidSubscriptionTarget(value: string): boolean {\n if (!value.endsWith(\"*\")) return channelSlugSchema.safeParse(value).success\n const base = value.slice(0, -1)\n const slash = base.lastIndexOf(\"/\")\n if (slash <= 0) return false\n return channelSlugSchema.safeParse(base.slice(0, slash)).success && /^[a-z0-9-]*$/.test(base.slice(slash + 1))\n}\nconst subscriptionTarget = z\n .string()\n .trim()\n .min(1)\n .max(121)\n .refine(isValidSubscriptionTarget, \"Canal exato (eng/global) ou prefixo terminado em * depois de um segmento completo (eng/*, eng/projeto-*)\")\nexport const createAgentInput = z.object({ app: appRef, slug: identitySlug, name, description })\nexport const updateAgentInput = z.object({ agent: agentRef, name: name.optional(), description, disabled: z.boolean().optional() })\nexport const updateTokenInput = z.object({ token: tokenRef, label: z.string().trim().max(120).nullable().optional(), scopes: scopesSchema.optional(), expires_at: isoDate.nullable().optional() })\nexport const createChannelInput = z.object({ slug: channelSlugSchema, name, description, priority: priority.optional() })\nexport const updateChannelInput = z.object({ channel: channelRef, name: name.optional(), description, priority: priority.optional() })\nexport const subscribeInput = z.object({ agent: agentRef, target: subscriptionTarget, mode: z.enum(SUBSCRIPTION_MODES), access: scopesSchema.nullable().optional(), priority: priority.nullable().optional() })\nexport const updateSubscriptionInput = z.object({ subscription: z.string().trim().min(1).max(40), mode: z.enum(SUBSCRIPTION_MODES).optional(), access: scopesSchema.nullable().optional(), priority: priority.nullable().optional() })\nexport const issueTokenInput = z\n.object({\n kind: z.enum(TOKEN_KINDS),\n app: appRef.optional(),\n agent: agentRef.optional(),\n scopes: scopesSchema,\n label: z.string().trim().max(120).optional(),\n expires_at: isoDate.optional(),\n})\n.superRefine((value, ctx) => {\n if (value.kind === \"agent\" && !value.agent) ctx.addIssue({ code: \"custom\", path: [\"agent\"], message: \"Token agent exige o agente\" })\n if (value.kind === \"admin\" && !value.app && !value.agent) ctx.addIssue({ code: \"custom\", path: [\"app\"], message: \"Informe o app do token admin\" })\n if (value.kind === \"app\" && !value.app) ctx.addIssue({ code: \"custom\", path: [\"app\"], message: \"Informe o app do token de app\" })\n if (value.kind === \"app\" && value.agent) ctx.addIssue({ code: \"custom\", path: [\"agent\"], message: \"Token de app não tem agente\" })\n})\n .meta({ examples: [{ kind: \"agent\", agent: \"app-a/curador\", scopes: [\"read\", \"write\"] }] })\n\nexport const createMemoryInput = z.object({ channel: channelRef, text: z.string().min(1), category: z.string().trim().min(1).max(64).optional(), key: z.string().trim().max(200).optional(), tags: z.array(z.string()).optional() })\nexport const updateMemoryInput = z.object({ text: z.string().min(1).optional(), category: z.string().trim().min(1).max(64).optional(), expected_version: z.number().int().optional(), tags: z.array(z.string()).optional() })\nexport const moveMemoryInput = z.object({ channel: channelRef })\n/** `update_app_webhook`: `url: null` remove a URL e o segredo; URL exige segredo (o enviado ou o já gravado). */\nexport const appWebhookInput = z.object({ url: webhookUrl, secret: webhookSecret }).strict()\nexport const memoryStatusSchema = z.enum(MEMORY_STATUSES)\nexport { memoryRef, tokenRef, agentRef, appRef, channelRef, cursor, limit, page }\n","import { z } from \"zod\"\nimport { combinationOf, ENGRAMIND_SCOPES } from \"./constants\"\n\n/** Escopos de um token ou acesso de assinatura: só `read`, `read+write`, `read+delete` ou `read+write+delete`. */\nexport const scopesSchema = z\n .array(z.enum(ENGRAMIND_SCOPES))\n .min(1, \"Escolha os escopos\")\n .max(3)\n .refine((scopes) => combinationOf(scopes) !== null, \"Combinações aceitas: read, read+write, read+delete ou read+write+delete (write e delete exigem read)\")\n"],"mappings":";;;;;;;;;;;;;;;;AACO,IAAM,sBAAsB;AAE5B,IAAM,mBAAmB,CAAC,QAAQ,SAAS,QAAQ;AAEnD,IAAM,qBAAqB,CAAC,QAAQ,cAAc,eAAe,mBAAmB;AAEpF,IAAM,sBAAsB,CAAC,gBAAoD,YAAY,MAAM,GAAG;AACtG,SAAS,cAAc,QAAoD;AAC9E,QAAM,MAAM,iBAAiB,OAAO,CAAC,UAAU,OAAO,SAAS,KAAK,CAAC,EAAE,KAAK,GAAG;AAC/E,SAAQ,mBAAyC,SAAS,GAAG,KAAK,IAAI,MAAM,GAAG,EAAE,WAAW,OAAO,SAAU,MAA2B;AAC5I;AAEO,IAAM,cAAc,CAAC,SAAS,OAAO,OAAO;AAC5C,IAAM,qBAAqB,CAAC,UAAU,UAAU,QAAQ;AACxD,IAAM,kBAAkB,CAAC,UAAU,aAAa,UAAU;;;ACfjE,SAAS,KAAAA,UAAS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