memax-sdk 0.2.0 → 0.4.0-alpha.1890

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/dist/client.d.ts CHANGED
@@ -13,6 +13,7 @@ import { AgentsResource } from "./resources/agents.js";
13
13
  import { InvitesResource } from "./resources/invites.js";
14
14
  import { AccountResource } from "./resources/account.js";
15
15
  import { EventsResource } from "./resources/events.js";
16
+ import { BarResource } from "./resources/bar.js";
16
17
  export declare class Memax {
17
18
  readonly memories: MemoriesResource;
18
19
  readonly configs: ConfigsResource;
@@ -28,6 +29,7 @@ export declare class Memax {
28
29
  readonly notifications: NotificationsResource;
29
30
  readonly agents: AgentsResource;
30
31
  readonly events: EventsResource;
32
+ readonly bar: BarResource;
31
33
  constructor(config: MemaxConfig);
32
34
  push(...args: Parameters<MemoriesResource["push"]>): Promise<import("./types.js").Memory>;
33
35
  recall(...args: Parameters<MemoriesResource["recall"]>): Promise<import("./types.js").RecallResult>;
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAA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cAAc,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,aAAa,EAAE,qBAAqB,CAAC;IAC9C,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,GAAG,EAAE,WAAW,CAAC;gBAEd,MAAM,EAAE,WAAW;IA4BzB,IAAI,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAIlD,MAAM,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAItD,GAAG,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;CAGvD"}
package/dist/client.js CHANGED
@@ -13,6 +13,7 @@ import { AgentsResource } from "./resources/agents.js";
13
13
  import { InvitesResource } from "./resources/invites.js";
14
14
  import { AccountResource } from "./resources/account.js";
15
15
  import { EventsResource } from "./resources/events.js";
16
+ import { BarResource } from "./resources/bar.js";
16
17
  export class Memax {
17
18
  memories;
18
19
  configs;
@@ -28,12 +29,17 @@ export class Memax {
28
29
  notifications;
29
30
  agents;
30
31
  events;
32
+ bar;
31
33
  constructor(config) {
32
34
  const transport = new ApiTransport(config);
33
35
  const req = transport.request.bind(transport);
34
36
  const stream = transport.stream.bind(transport);
35
37
  const download = transport.download.bind(transport);
36
- const apiUrl = (config.apiUrl ?? "https://api.memax.app").replace(/\/$/, "");
38
+ // Read the resolved URL from the transport so the DEFAULT_API_URL
39
+ // fallback lives in exactly one place. Duplicating the hardcoded
40
+ // literal here would let the transport-level drift guard pass
41
+ // while `auth.githubURL(...)` silently used a stale host.
42
+ const apiUrl = transport.apiUrl;
37
43
  this.memories = new MemoriesResource(req, stream, download);
38
44
  this.configs = new ConfigsResource(req);
39
45
  this.agentSessions = new AgentSessionsResource(req, download);
@@ -48,6 +54,7 @@ export class Memax {
48
54
  this.notifications = new NotificationsResource(req);
49
55
  this.agents = new AgentsResource(req);
50
56
  this.events = new EventsResource(stream);
57
+ this.bar = new BarResource(req);
51
58
  }
52
59
  async push(...args) {
53
60
  return this.memories.push(...args);
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,MAAM,OAAO,KAAK;IACP,QAAQ,CAAmB;IAC3B,OAAO,CAAkB;IACzB,aAAa,CAAwB;IACrC,OAAO,CAAkB;IACzB,IAAI,CAAe;IACnB,OAAO,CAAkB;IACzB,IAAI,CAAe;IACnB,OAAO,CAAkB;IACzB,MAA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AAG,IAAyC;QACpD,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;IACpC,CAAC;CACF"}
package/dist/errors.d.ts CHANGED
@@ -1,9 +1,136 @@
1
+ /**
2
+ * MemaxError — the typed error thrown by the SDK on every non-2xx
3
+ * response. Carries the HTTP status, the machine-readable `code` the
4
+ * server sends in its error envelope, an optional `details` bag, and
5
+ * (for 429 responses) the `Retry-After` advice in seconds.
6
+ *
7
+ * # How to branch on it
8
+ *
9
+ * Three patterns exist, in order of preference:
10
+ *
11
+ * 1. **Status-class getters** (`isRateLimited`, `isForbidden`, …).
12
+ * Covers the common HTTP semantics in one predicate. Most callers
13
+ * want this.
14
+ *
15
+ * 2. **Machine code comparison** (`err.code === "hub_frozen"`).
16
+ * Use when the server returns a business-logic code with no clean
17
+ * status-class equivalent — e.g. `hub_frozen` is a 409 but means
18
+ * "billing state", not "optimistic-lock conflict". The two
19
+ * populate the same status but call for different copy.
20
+ *
21
+ * 3. **Raw status** (`err.status === 418`). Escape hatch. Avoid
22
+ * unless you genuinely need the number.
23
+ *
24
+ * # Why getters, not a single `kind: "rateLimited" | ...` tag
25
+ *
26
+ * Errors can legitimately be in multiple classes (a 500 is a server
27
+ * error AND, by definition, retryable). Getters compose cleanly and
28
+ * stay open to extension without a breaking enum change. They also
29
+ * keep the public shape narrow: the SDK doesn't need to document a
30
+ * discriminator union that it'd have to evolve on every new status.
31
+ */
1
32
  export declare class MemaxError extends Error {
2
33
  code: string;
3
34
  status: number;
4
35
  details?: Record<string, unknown> | undefined;
5
- constructor(message: string, code: string, status: number, details?: Record<string, unknown> | undefined);
6
- /** True when the error is a quota limit (402). */
36
+ /**
37
+ * When set (always on 429 responses that carry a Retry-After header),
38
+ * this is the server's advice for how many seconds to wait before
39
+ * retrying. The transport parses both integer-second and HTTP-date
40
+ * forms; undefined means the header was missing or malformed.
41
+ *
42
+ * Rounded up to the nearest whole second for HTTP-date parsing, so
43
+ * callers can always display a clean countdown without needing
44
+ * ceiling logic of their own.
45
+ */
46
+ retryAfterSeconds?: number;
47
+ constructor(message: string, code: string, status: number, details?: Record<string, unknown> | undefined, retryAfterSeconds?: number);
48
+ /**
49
+ * Rate-limit (HTTP 429). Server also stamps `code === "rate_limited"`.
50
+ * Either signal is load-bearing: callers in browsers may see a 429
51
+ * surfaced by an intermediate proxy (CDN, WAF) without the server's
52
+ * error envelope, so the status-code branch is a genuine second path,
53
+ * not a duplicate.
54
+ */
55
+ get isRateLimited(): boolean;
56
+ /**
57
+ * Permission denied (HTTP 403). The user is authenticated but the
58
+ * grant does not permit this operation — includes API-key scope
59
+ * failures, hub-member role mismatches, and admin-only endpoint
60
+ * refusals. Distinct from 401 (not authenticated) which should push
61
+ * the user through the re-auth flow rather than showing a toast.
62
+ */
63
+ get isForbidden(): boolean;
64
+ /**
65
+ * Resource not found (HTTP 404). Usually means the thing the user
66
+ * was operating on no longer exists — deleted by another client,
67
+ * archived by a dream cycle, revoked by an admin. Callers may prefer
68
+ * silent success over an error toast for idempotent deletes, but the
69
+ * default copy ("That no longer exists") is accurate.
70
+ */
71
+ get isNotFound(): boolean;
72
+ /**
73
+ * State conflict (HTTP 409). Ambiguous on its own — could be
74
+ * optimistic-lock (someone else updated the row mid-edit) or a
75
+ * business-logic refusal (hub_frozen, duplicate_slug). Callers that
76
+ * care about the distinction should check `err.code` first, then
77
+ * fall back to this getter for the generic "refresh and try again"
78
+ * copy.
79
+ */
80
+ get isConflict(): boolean;
81
+ /**
82
+ * Quota exceeded (HTTP 402). The user hit their plan's limit
83
+ * (memory count, storage bytes, recall count, etc.). Distinct from
84
+ * rate-limited: the answer isn't "wait", it's "upgrade" or "archive
85
+ * something". Surface a link to the plan page, not a countdown.
86
+ */
7
87
  get isQuotaExceeded(): boolean;
88
+ /**
89
+ * Authentication failure (HTTP 401). Means the session / token is
90
+ * missing or expired — the user is not authenticated, not that
91
+ * they're authenticated-but-forbidden. Callers almost always want
92
+ * to redirect to sign-in rather than toast.
93
+ */
94
+ get isUnauthorized(): boolean;
95
+ /**
96
+ * Bad request (HTTP 400). Usually a client bug (malformed payload,
97
+ * invalid UUID, etc.) — shouldn't surface in production UIs. The
98
+ * classifier's copy is deliberately vague because we'd rather the
99
+ * error be reported than guessed-at.
100
+ */
101
+ get isBadRequest(): boolean;
102
+ /**
103
+ * Server error (HTTP 5xx). The server failed or is momentarily
104
+ * unavailable. Retryable — the classifier suggests "try again in
105
+ * a moment". Distinct from network-offline (status 0) which means
106
+ * the request didn't reach the server at all.
107
+ */
108
+ get isServerError(): boolean;
109
+ /**
110
+ * Network-layer failure (status 0). The request didn't reach the
111
+ * server — fetch threw (DNS, TCP, TLS, browser offline). The SDK
112
+ * doesn't currently manufacture this status code itself (it wraps
113
+ * fetch throws differently), so this is a forward-compatibility
114
+ * hook for a future transport refactor. Today, callers that want to
115
+ * detect offline should combine `err.status === 0` with
116
+ * `navigator.onLine === false` checks.
117
+ */
118
+ get isNetwork(): boolean;
8
119
  }
120
+ /**
121
+ * parseRetryAfter — shared helper for 429 Retry-After parsing.
122
+ *
123
+ * The spec (RFC 7231 §7.1.3) allows two formats:
124
+ * - delta-seconds (a non-negative integer): "120"
125
+ * - HTTP-date (IMF-fixdate): "Fri, 31 Dec 1999 23:59:59 GMT"
126
+ *
127
+ * We handle both. Returns undefined when the header is missing or
128
+ * unparseable, so callers can treat "don't know how long to wait" the
129
+ * same as "server didn't say".
130
+ *
131
+ * Exported so the transport module and tests can share one code path —
132
+ * otherwise two implementations drift out of sync the first time
133
+ * anyone adds a new edge case (we've shipped that bug before).
134
+ */
135
+ export declare function parseRetryAfter(raw: string | null | undefined, now?: Date): number | undefined;
9
136
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,UAAW,SAAQ,KAAK;IAG1B,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,MAAM;IACd,O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;;;;;GAcG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC9B,GAAG,GAAE,IAAiB,GACrB,MAAM,GAAG,SAAS,CA4BpB"}
package/dist/errors.js CHANGED
@@ -1,17 +1,191 @@
1
+ /**
2
+ * MemaxError — the typed error thrown by the SDK on every non-2xx
3
+ * response. Carries the HTTP status, the machine-readable `code` the
4
+ * server sends in its error envelope, an optional `details` bag, and
5
+ * (for 429 responses) the `Retry-After` advice in seconds.
6
+ *
7
+ * # How to branch on it
8
+ *
9
+ * Three patterns exist, in order of preference:
10
+ *
11
+ * 1. **Status-class getters** (`isRateLimited`, `isForbidden`, …).
12
+ * Covers the common HTTP semantics in one predicate. Most callers
13
+ * want this.
14
+ *
15
+ * 2. **Machine code comparison** (`err.code === "hub_frozen"`).
16
+ * Use when the server returns a business-logic code with no clean
17
+ * status-class equivalent — e.g. `hub_frozen` is a 409 but means
18
+ * "billing state", not "optimistic-lock conflict". The two
19
+ * populate the same status but call for different copy.
20
+ *
21
+ * 3. **Raw status** (`err.status === 418`). Escape hatch. Avoid
22
+ * unless you genuinely need the number.
23
+ *
24
+ * # Why getters, not a single `kind: "rateLimited" | ...` tag
25
+ *
26
+ * Errors can legitimately be in multiple classes (a 500 is a server
27
+ * error AND, by definition, retryable). Getters compose cleanly and
28
+ * stay open to extension without a breaking enum change. They also
29
+ * keep the public shape narrow: the SDK doesn't need to document a
30
+ * discriminator union that it'd have to evolve on every new status.
31
+ */
1
32
  export class MemaxError extends Error {
2
33
  code;
3
34
  status;
4
35
  details;
5
- constructor(message, code, status, details) {
36
+ /**
37
+ * When set (always on 429 responses that carry a Retry-After header),
38
+ * this is the server's advice for how many seconds to wait before
39
+ * retrying. The transport parses both integer-second and HTTP-date
40
+ * forms; undefined means the header was missing or malformed.
41
+ *
42
+ * Rounded up to the nearest whole second for HTTP-date parsing, so
43
+ * callers can always display a clean countdown without needing
44
+ * ceiling logic of their own.
45
+ */
46
+ retryAfterSeconds;
47
+ constructor(message, code, status, details, retryAfterSeconds) {
6
48
  super(message);
7
49
  this.code = code;
8
50
  this.status = status;
9
51
  this.details = details;
10
52
  this.name = "MemaxError";
53
+ this.retryAfterSeconds = retryAfterSeconds;
11
54
  }
12
- /** True when the error is a quota limit (402). */
55
+ /**
56
+ * Rate-limit (HTTP 429). Server also stamps `code === "rate_limited"`.
57
+ * Either signal is load-bearing: callers in browsers may see a 429
58
+ * surfaced by an intermediate proxy (CDN, WAF) without the server's
59
+ * error envelope, so the status-code branch is a genuine second path,
60
+ * not a duplicate.
61
+ */
62
+ get isRateLimited() {
63
+ return this.status === 429 || this.code === "rate_limited";
64
+ }
65
+ /**
66
+ * Permission denied (HTTP 403). The user is authenticated but the
67
+ * grant does not permit this operation — includes API-key scope
68
+ * failures, hub-member role mismatches, and admin-only endpoint
69
+ * refusals. Distinct from 401 (not authenticated) which should push
70
+ * the user through the re-auth flow rather than showing a toast.
71
+ */
72
+ get isForbidden() {
73
+ return this.status === 403;
74
+ }
75
+ /**
76
+ * Resource not found (HTTP 404). Usually means the thing the user
77
+ * was operating on no longer exists — deleted by another client,
78
+ * archived by a dream cycle, revoked by an admin. Callers may prefer
79
+ * silent success over an error toast for idempotent deletes, but the
80
+ * default copy ("That no longer exists") is accurate.
81
+ */
82
+ get isNotFound() {
83
+ return this.status === 404;
84
+ }
85
+ /**
86
+ * State conflict (HTTP 409). Ambiguous on its own — could be
87
+ * optimistic-lock (someone else updated the row mid-edit) or a
88
+ * business-logic refusal (hub_frozen, duplicate_slug). Callers that
89
+ * care about the distinction should check `err.code` first, then
90
+ * fall back to this getter for the generic "refresh and try again"
91
+ * copy.
92
+ */
93
+ get isConflict() {
94
+ return this.status === 409;
95
+ }
96
+ /**
97
+ * Quota exceeded (HTTP 402). The user hit their plan's limit
98
+ * (memory count, storage bytes, recall count, etc.). Distinct from
99
+ * rate-limited: the answer isn't "wait", it's "upgrade" or "archive
100
+ * something". Surface a link to the plan page, not a countdown.
101
+ */
13
102
  get isQuotaExceeded() {
14
- return this.code === "quota_exceeded";
103
+ return this.status === 402 || this.code === "quota_exceeded";
104
+ }
105
+ /**
106
+ * Authentication failure (HTTP 401). Means the session / token is
107
+ * missing or expired — the user is not authenticated, not that
108
+ * they're authenticated-but-forbidden. Callers almost always want
109
+ * to redirect to sign-in rather than toast.
110
+ */
111
+ get isUnauthorized() {
112
+ return this.status === 401;
113
+ }
114
+ /**
115
+ * Bad request (HTTP 400). Usually a client bug (malformed payload,
116
+ * invalid UUID, etc.) — shouldn't surface in production UIs. The
117
+ * classifier's copy is deliberately vague because we'd rather the
118
+ * error be reported than guessed-at.
119
+ */
120
+ get isBadRequest() {
121
+ return this.status === 400;
122
+ }
123
+ /**
124
+ * Server error (HTTP 5xx). The server failed or is momentarily
125
+ * unavailable. Retryable — the classifier suggests "try again in
126
+ * a moment". Distinct from network-offline (status 0) which means
127
+ * the request didn't reach the server at all.
128
+ */
129
+ get isServerError() {
130
+ return this.status >= 500 && this.status < 600;
131
+ }
132
+ /**
133
+ * Network-layer failure (status 0). The request didn't reach the
134
+ * server — fetch threw (DNS, TCP, TLS, browser offline). The SDK
135
+ * doesn't currently manufacture this status code itself (it wraps
136
+ * fetch throws differently), so this is a forward-compatibility
137
+ * hook for a future transport refactor. Today, callers that want to
138
+ * detect offline should combine `err.status === 0` with
139
+ * `navigator.onLine === false` checks.
140
+ */
141
+ get isNetwork() {
142
+ return this.status === 0;
143
+ }
144
+ }
145
+ /**
146
+ * parseRetryAfter — shared helper for 429 Retry-After parsing.
147
+ *
148
+ * The spec (RFC 7231 §7.1.3) allows two formats:
149
+ * - delta-seconds (a non-negative integer): "120"
150
+ * - HTTP-date (IMF-fixdate): "Fri, 31 Dec 1999 23:59:59 GMT"
151
+ *
152
+ * We handle both. Returns undefined when the header is missing or
153
+ * unparseable, so callers can treat "don't know how long to wait" the
154
+ * same as "server didn't say".
155
+ *
156
+ * Exported so the transport module and tests can share one code path —
157
+ * otherwise two implementations drift out of sync the first time
158
+ * anyone adds a new edge case (we've shipped that bug before).
159
+ */
160
+ export function parseRetryAfter(raw, now = new Date()) {
161
+ if (!raw)
162
+ return undefined;
163
+ const trimmed = raw.trim();
164
+ if (!trimmed)
165
+ return undefined;
166
+ // Reject "number-ish but not delta-seconds" inputs (-5, 1.5, +3, .9)
167
+ // before they reach Date.parse, which would interpret them as
168
+ // ambiguous dates. The spec accepts ONLY `1*DIGIT` for delta-seconds,
169
+ // and every HTTP-date form contains letters ("Mon", "GMT", etc.), so
170
+ // a string that's neither pure-digits nor contains a letter is not
171
+ // a valid Retry-After value.
172
+ if (!/^\d+$/.test(trimmed) && !/[a-zA-Z]/.test(trimmed))
173
+ return undefined;
174
+ // Integer seconds — the common case. Regex is deliberate over
175
+ // Number() to reject floats and scientific notation up front.
176
+ if (/^\d+$/.test(trimmed)) {
177
+ const n = parseInt(trimmed, 10);
178
+ return Number.isFinite(n) && n >= 0 ? n : undefined;
15
179
  }
180
+ // HTTP-date form — Date.parse handles IMF-fixdate and RFC 850.
181
+ const parsed = Date.parse(trimmed);
182
+ if (Number.isNaN(parsed))
183
+ return undefined;
184
+ const deltaMs = parsed - now.getTime();
185
+ if (deltaMs <= 0)
186
+ return 0;
187
+ // Round up so "wait 0.3 seconds" becomes 1, not 0 — countdowns
188
+ // that briefly display "0s" look broken.
189
+ return Math.ceil(deltaMs / 1000);
16
190
  }
17
191
  //# sourceMappingURL=errors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,UAAW,SAAQ,KAAK;IAG1B;IACA;IACA;IAJT,YACE,OAAe,EACR,IAAY,EACZ,MAAc,EACd,OAAiC;QAExC,KAAK,CAAC,OAAO,CAAC,CAAC;QAJR,SAAI,GAAJ,IAAI,CAAQ;QACZ,WAAM,GAAN,MAAM,CAAQ;QACd,YAAO,GAAP,OAAO,CAA0B;QAGxC,IAAI,CAAC,IAAI,GAAG,Y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KAAK,CAAC,MAAM,CAAC;QAAE,OAAO,SAAS,CAAC;IAC3C,MAAM,OAAO,GAAG,MAAM,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;IACvC,IAAI,OAAO,IAAI,CAAC;QAAE,OAAO,CAAC,CAAC;IAC3B,+DAA+D;IAC/D,yCAAyC;IACzC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;AACnC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { Memax } from "./client.js";
2
2
  export type { EventsSubscribeOptions } from "./resources/events.js";
3
3
  export { MemaxError } from "./errors.js";
4
- export type { MemaxConfig, AuthProvider, PushOptions, RecallOptions, AskOptions, ListMemoriesOptions, HubUpdateParams, MemoryKind, MemoryStability, Memory, MemoryAttachment, AttachmentViewURL, MemoryLifecycle, MemoryUpdateInput, DreamActionRef, DreamTopicRef, ShareMemoryResult, BatchMoveResult, BatchMoveSkippedMemory, BatchMoveSkipReason, BatchDeleteResult, BatchDeleteSkippedMemory, BatchDeleteSkipReason, AgentConfigBatchDeleteResult, AgentConfigDeleteSkippedItem, AgentConfigDeleteSkipReason, RelatedMemory, RecalledMemory, RecallResult, SearchResult, AskResult, ListMemoriesResult, Scope, AgentConfig, AgentConfigListResult, DeletedAgentConfig, SyncAction, SyncPlanAction, SyncManifestEntry, ConfigSyncRequest, AgentConfigSyncAck, ConfigSyncAckRequest, ConfigLocalDeleteRequest, RestoreDeletedConfigRequest, ConfigUpsertRequest, ConfigMergeRequest, UploadIntent, AgentSession, DeletedAgentSession, SessionSyncAction, SessionSyncPlanAction, SessionSyncManifestEntry, AgentSessionSyncRequest, AgentSessionSyncAck, AgentSessionSyncAckRequest, AgentSessionLocalDeleteRequest, RestoreDeletedSessionRequest, AgentSessionUpsertRequest, ResolveDivergenceRequest, ResolveDivergenceResponse, AuthProviderName, User, MeResponse, AuthTokenPair, ImpersonationResult, AuthIdentity, UnlinkProviderResult, ApiKeyCreateOptions, ApiKey, ApiKeyListItem, UpdateApiKeyPayload, UpdateApiKeyResult, OAuthConsentHub, OAuthConsentPermission, OAuthConsentRequest, UpdateProfileResult, DeleteAllDataResult, Hub, HubWithRole, HubMember, HubInvite, HubInviteeInput, HubOwnershipTransfer, HubDetailResult, HubSummary, HubSummaryStats, HubSummaryHeader, HubSummaryMember, HubAccent, HubRole, HubType, HubHeaderState, HubTimeBucket, HubGreetingKey, ContributorDeletePolicy, InviteDetails, InviteAcceptResult, DevFlagsSettings, Settings, SettingsUpdateInput, Usage, UsageWithLimits, PlanScope, PlanDefinition, UserLimits, Topic, TopicLifecycle, TopicDeltaSummary, TopicTree, TopicListResponse, TopicCreateParams, TopicUpdateParams, TopicUpdateErrorCode, TopicReorderOperation, TopicMemoriesResponse, DreamRun, DreamAction, DreamLatestRunSummary, DreamPendingReviewSummary, DreamIntelligenceSummary, DreamReport, ReviewTopicMergePayload, ReviewTopicRestructurePayload, ReviewTopicRef, Notification, NotificationAudience, NotificationStatus, NotificationResolution, NotificationKind, NotificationKindCount, NotificationSummary, NotificationListQuery, NotificationListResponse, NotificationBulkQuery, NotificationBulkResult, NotificationResolveAction, NotificationResolveResult, ReviewContradictionPayload, ReviewMemoryRef, DreamRunCompletedPayload, DreamRunCounts, HubInvitePayload, HubInviteHubRef, HubInviteInviterRef, HubMemberJoinedPayload, HubMemberRef, HubInviteAcceptedPayload, HubInviteDeclinedPayload, HubInviteDeclinedByYouPayload, HubOwnershipTransferPayload, HubOwnershipTransferredPayload, SystemNoticePayload, GiftInviteLinkPayload, ConnectedAgent, ConnectedAgentWithStats, ConnectedAgentUpdate, DisconnectAgentResult, AgentDisconnectSkipReason, AgentDisconnectSkippedItem, ApiKeyRevokeResult, ApiKeyRevokeSkipReason, ApiKeyRevokeSkippedItem, } from "./types.js";
4
+ export type { MemaxConfig, AuthProvider, PushOptions, RecallOptions, AskOptions, ListMemoriesOptions, HubUpdateParams, MemoryKind, MemoryStability, Memory, MemoryAttachment, AttachmentViewURL, MemoryLifecycle, MemoryUpdateInput, DreamActionRef, DreamTopicRef, ShareMemoryResult, BatchMoveResult, BatchMoveSkippedMemory, BatchMoveSkipReason, BatchDeleteResult, BatchDeleteSkippedMemory, BatchDeleteSkipReason, AgentConfigBatchDeleteResult, AgentConfigDeleteSkippedItem, AgentConfigDeleteSkipReason, RelatedMemory, RecalledMemory, RecallResult, SearchResult, BarSearchResult, BarTopicMatch, BarHubMatch, AskResult, ListMemoriesResult, Scope, AgentConfig, AgentConfigListResult, DeletedAgentConfig, SyncAction, SyncPlanAction, SyncManifestEntry, ConfigSyncRequest, AgentConfigSyncAck, ConfigSyncAckRequest, ConfigLocalDeleteRequest, RestoreDeletedConfigRequest, ConfigUpsertRequest, ConfigMergeRequest, UploadIntent, AgentSession, DeletedAgentSession, SessionSyncAction, SessionSyncPlanAction, SessionSyncManifestEntry, AgentSessionSyncRequest, AgentSessionSyncAck, AgentSessionSyncAckRequest, AgentSessionLocalDeleteRequest, RestoreDeletedSessionRequest, AgentSessionUpsertRequest, ResolveDivergenceRequest, ResolveDivergenceResponse, AuthProviderName, User, MeResponse, AuthTokenPair, ImpersonationResult, AuthIdentity, UnlinkProviderResult, ApiKeyCreateOptions, ApiKey, ApiKeyListItem, UpdateApiKeyPayload, UpdateApiKeyResult, OAuthConsentHub, OAuthConsentPermission, OAuthConsentRequest, UpdateProfileResult, DeleteAllDataResult, Hub, HubSettings, HubSettingsInput, HubWithRole, HubMember, HubInvite, HubInviteeInput, HubOwnershipTransfer, HubDetailResult, HubSummary, HubSummaryStats, HubSummaryHeader, HubSummaryMember, HubAccent, HubRole, HubType, HubHeaderState, HubHeaderAuroraMode, HubTimeBucket, HubGreetingKey, ContributorDeletePolicy, InviteDetails, InviteAcceptResult, DevFlagsSettings, Settings, SettingsUpdateInput, Usage, UsageWithLimits, PlanScope, PlanDefinition, UserLimits, Topic, TopicLifecycle, TopicDeltaSummary, TopicTree, TopicListResponse, TopicCreateParams, TopicUpdateParams, TopicUpdateErrorCode, TopicReorderOperation, TopicMemoriesResponse, DreamRun, DreamAction, DreamLatestRunSummary, DreamPendingReviewSummary, DreamIntelligenceSummary, DreamReport, DreamRunListOptions, DreamRunListResponse, ReviewTopicMergePayload, ReviewTopicRestructurePayload, ReviewTopicRef, Notification, NotificationAudience, NotificationStatus, NotificationResolution, NotificationKind, NotificationKindCount, NotificationSummary, NotificationListQuery, NotificationListResponse, NotificationBulkQuery, NotificationBulkResult, NotificationResolveAction, NotificationResolveResult, ReviewContradictionPayload, ReviewMemoryRef, DreamRunCompletedPayload, DreamRunCounts, HubInvitePayload, HubInviteHubRef, HubInviteInviterRef, HubMemberJoinedPayload, HubMemberRef, HubInviteAcceptedPayload, HubInviteDeclinedPayload, HubInviteDeclinedByYouPayload, HubOwnershipTransferPayload, HubOwnershipTransferredPayload, SystemNoticePayload, GiftInviteLinkPayload, ConnectedAgent, ConnectedAgentWithStats, ConnectedAgentUpdate, DisconnectAgentResult, AgentDisconnectSkipReason, AgentDisconnectSkippedItem, ApiKeyRevokeResult, ApiKeyRevokeSkipReason, ApiKeyRevokeSkippedItem, } from "./types.js";
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,YAAY,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAGpE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,YAAY,EAEV,WAAW,EACX,YAAY,EAEZ,WAAW,EACX,aAAa,EACb,UAAU,EACV,mBAAmB,EACnB,eAAe,EAEf,UAAU,EACV,eAAe,EACf,MAAM,EACN,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,EACjB,w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,EACR,WAAW,EACX,qBAAqB,EACrB,yBAAyB,EACzB,wBAAwB,EACxB,WAAW,EACX,uBAAuB,EACvB,6BAA6B,EAC7B,cAAc,EAEd,YAAY,EACZ,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,EACxB,qBAAqB,EACrB,sBAAsB,EACtB,yBAAyB,EACzB,yBAAyB,EACzB,0BAA0B,EAC1B,eAAe,EACf,wBAAwB,EACxB,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,sBAAsB,EACtB,YAAY,EACZ,wBAAwB,EACxB,wBAAwB,EACxB,6BAA6B,EAC7B,2BAA2B,EAC3B,8BAA8B,EAC9B,mBAAmB,EACnB,qBAAqB,EAErB,cAAc,EACd,uBAAuB,EACvB,oBAAoB,EACpB,qBAAqB,EACrB,yBAAyB,EACzB,0BAA0B,EAC1B,kBAAkB,EAClB,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,YAAY,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAGpE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,YAAY,EAEV,WAAW,EACX,YAAY,EAEZ,WAAW,EACX,aAAa,EACb,UAAU,EACV,mBAAmB,EACnB,eAAe,EAEf,UAAU,EACV,eAAe,EACf,MAAM,EACN,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,EACjB,wBAAwB,EACxB,qBAAqB,EACrB,4BAA4B,EAC5B,4BAA4B,EAC5B,2BAA2B,E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AQ,EACR,WAAW,EACX,qBAAqB,EACrB,yBAAyB,EACzB,wBAAwB,EACxB,WAAW,EACX,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,EACvB,6BAA6B,EAC7B,cAAc,EAEd,YAAY,EACZ,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,EACxB,qBAAqB,EACrB,sBAAsB,EACtB,yBAAyB,EACzB,yBAAyB,EACzB,0BAA0B,EAC1B,eAAe,EACf,wBAAwB,EACxB,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,sBAAsB,EACtB,YAAY,EACZ,wBAAwB,EACxB,wBAAwB,EACxB,6BAA6B,EAC7B,2BAA2B,EAC3B,8BAA8B,EAC9B,mBAAmB,EACnB,qBAAqB,EAErB,cAAc,EACd,uBAAuB,EACvB,oBAAoB,EACpB,qBAAqB,EACrB,yBAAyB,EACzB,0BAA0B,EAC1B,kBAAkB,EAClB,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,YAAY,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type { BarSearchResult } from "../types.js";
2
+ import type { RequestFn } from "../transport.js";
3
+ export declare class BarResource {
4
+ private readonly req;
5
+ constructor(req: RequestFn);
6
+ /**
7
+ * Unified search for the web bar's pre-Enter "quick matches" layer.
8
+ * Returns memory FTS matches plus topic and hub jump-to candidates
9
+ * in a single response. Empty query returns empty arrays instead of
10
+ * a 400 so the client can call this unconditionally.
11
+ */
12
+ search(query: string, options?: {
13
+ limit?: number;
14
+ hubId?: string;
15
+ topicId?: string;
16
+ signal?: AbortSignal;
17
+ }): Promise<BarSearchResult>;
18
+ }
19
+ //# sourceMappingURL=bar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bar.d.ts","sourceRoot":"","sources":["../../src/resources/bar.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,qBAAa,WAAW;IACV,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,SAAS;IAE3C;;;;;OAKG;IACG,MAAM,CACV,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE;QACR,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,MAAM,CAAC,EAAE,WAAW,CAAC;KACtB,GACA,OAAO,CAAC,eAAe,CAAC;CAO5B"}
@@ -0,0 +1,20 @@
1
+ export class BarResource {
2
+ req;
3
+ constructor(req) {
4
+ this.req = req;
5
+ }
6
+ /**
7
+ * Unified search for the web bar's pre-Enter "quick matches" layer.
8
+ * Returns memory FTS matches plus topic and hub jump-to candidates
9
+ * in a single response. Empty query returns empty arrays instead of
10
+ * a 400 so the client can call this unconditionally.
11
+ */
12
+ async search(query, options) {
13
+ return this.req("GET", "/v1/bar/search", {
14
+ query: { q: query, limit: options?.limit, topic_id: options?.topicId },
15
+ hubId: options?.hubId,
16
+ signal: options?.signal,
17
+ });
18
+ }
19
+ }
20
+ //# sourceMappingURL=bar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bar.js","sourceRoot":"","sources":["../../src/resources/bar.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,WAAW;IACO;IAA7B,YAA6B,GAAc;QAAd,QAAG,GAAH,GAAG,CAAW;IAAG,CAAC;IAE/C;;;;;OAKG;IACH,KAAK,CAAC,MAAM,CACV,KAAa,EACb,OAKC;QAED,OAAO,IAAI,CAAC,GAAG,CAAkB,KAAK,EAAE,gBAAgB,EAAE;YACxD,KAAK,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE;YACtE,KAAK,EAAE,OAAO,EAAE,KAAK;YACrB,MAAM,EAAE,OAAO,EAAE,MAAM;SACxB,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -1,9 +1,23 @@
1
- import type { DreamReport, DreamRun } from "../types.js";
1
+ import type { DreamReport, DreamRunListOptions, DreamRunListResponse } from "../types.js";
2
2
  import type { RequestFn } from "../transport.js";
3
3
  export declare class DreamsResource {
4
4
  private readonly req;
5
5
  constructor(req: RequestFn);
6
- list(limit?: number, hubId?: string): Promise<DreamRun[]>;
6
+ /**
7
+ * List recent dream runs for the caller, across hubs they
8
+ * belong to. Keyset paginated: pass the previous response's
9
+ * `next_cursor` as `cursor` to fetch the next page.
10
+ *
11
+ * Scoping:
12
+ * - `hubId` narrows to one hub (the caller must be a member,
13
+ * else the server returns 403).
14
+ * - Omitting `hubId` spans every hub the caller participates
15
+ * in — the default behavior for the Dream history view.
16
+ *
17
+ * Default limit is 20 on the server (max 100). Passing a
18
+ * `limit` overrides that per request.
19
+ */
20
+ list(opts?: DreamRunListOptions): Promise<DreamRunListResponse>;
7
21
  report(hubId?: string): Promise<DreamReport>;
8
22
  trigger(hubId?: string): Promise<{
9
23
  status: string;
@@ -1 +1 @@
1
- {"version":3,"file":"dreams.d.ts","sourceRoot":"","sources":["../../src/resources/dreams.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,qBAAa,cAAc;IACb,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,SAAS;IAErC,IAAI,CAAC,KAAK,SAAK,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAOrD,MAAM,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAI5C,OAAO,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAM3D"}
1
+ {"version":3,"file":"dreams.d.ts","sourceRoot":"","sources":["../../src/resources/dreams.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,qBAAa,cAAc;IACb,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,SAAS;IAE3C;;;;;;;;;;;;;OAaG;IACG,IAAI,CAAC,IAAI,GAAE,mBAAwB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAQnE,MAAM,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAI5C,OAAO,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAM3D"}
@@ -3,11 +3,29 @@ export class DreamsResource {
3
3
  constructor(req) {
4
4
  this.req = req;
5
5
  }
6
- async list(limit = 10, hubId) {
7
- return this.req("GET", "/v1/dreams", {
8
- hubId,
9
- query: { limit },
10
- });
6
+ /**
7
+ * List recent dream runs for the caller, across hubs they
8
+ * belong to. Keyset paginated: pass the previous response's
9
+ * `next_cursor` as `cursor` to fetch the next page.
10
+ *
11
+ * Scoping:
12
+ * - `hubId` narrows to one hub (the caller must be a member,
13
+ * else the server returns 403).
14
+ * - Omitting `hubId` spans every hub the caller participates
15
+ * in — the default behavior for the Dream history view.
16
+ *
17
+ * Default limit is 20 on the server (max 100). Passing a
18
+ * `limit` overrides that per request.
19
+ */
20
+ async list(opts = {}) {
21
+ const query = {};
22
+ if (opts.limit !== undefined)
23
+ query.limit = opts.limit;
24
+ if (opts.hubId !== undefined)
25
+ query.hub_id = opts.hubId;
26
+ if (opts.cursor !== undefined)
27
+ query.cursor = opts.cursor;
28
+ return this.req("GET", "/v1/dreams", { query });
11
29
  }
12
30
  async report(hubId) {
13
31
  return this.req("GET", "/v1/dreams/report", { hubId });
@@ -1 +1 @@
1
- {"version":3,"file":"dreams.js","sourceRoot":"","sources":["../../src/resources/dreams.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,cAAc;IACI;IAA7B,YAA6B,GAAc;QAAd,QAAG,GAAH,GAAG,CAAW;IAAG,CAAC;IAE/C,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,EAAE,EAAE,KAAc;QACnC,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,YAAY,EAAE;YACnC,KAAK;YACL,KAAK,EAAE,EAAE,KAAK,EAAE;SACjB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,KAAc;QACzB,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,mBAAmB,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IACzD,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,KAAc;QAC1B,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,oBAAoB,EAAE;YAC5C,IAAI,EAAE,EAAE;YACR,KAAK;SACN,CAAC,CAAC;IACL,CAAC;CACF"}
1
+ {"version":3,"file":"dreams.js","sourceRoot":"","sources":["../../src/resources/dreams.ts"],"names":[],"mappings":"AAOA,MAAM,OAAO,cAAc;IACI;IAA7B,YAA6B,GAAc;QAAd,QAAG,GAAH,GAAG,CAAW;IAAG,CAAC;IAE/C;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,IAAI,CAAC,OAA4B,EAAE;QACvC,MAAM,KAAK,GAAgD,EAAE,CAAC;QAC9D,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS;YAAE,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACvD,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS;YAAE,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC;QACxD,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS;YAAE,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC1D,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IAClD,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,KAAc;QACzB,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,mBAAmB,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IACzD,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,KAAc;QAC1B,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,oBAAoB,EAAE;YAC5C,IAAI,EAAE,EAAE;YACR,KAAK;SACN,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -15,11 +15,21 @@ export declare class MemoriesResource {
15
15
  limit?: number;
16
16
  hubId?: string;
17
17
  topicId?: string;
18
+ signal?: AbortSignal;
18
19
  }): Promise<SearchResult[]>;
19
- get(id: string): Promise<Memory>;
20
- /** Semantically related memories via vector nearest-neighbor. Sub-50ms, no external API calls. */
20
+ get(id: string, options?: {
21
+ signal?: AbortSignal;
22
+ }): Promise<Memory>;
23
+ /**
24
+ * Semantically related memories via vector nearest-neighbor. Sub-50ms, no
25
+ * external API calls.
26
+ *
27
+ * Neighbor scope is derived server-side from the source memory's hub, so
28
+ * there is no hubId parameter here — a memory's neighbors are the same set
29
+ * regardless of which hub the viewer is currently in.
30
+ */
21
31
  related(id: string, options?: {
22
- hubId?: string;
32
+ signal?: AbortSignal;
23
33
  }): Promise<RelatedMemory[]>;
24
34
  delete(id: string): Promise<void>;
25
35
  update(id: string, patch: MemoryUpdateInput): Promise<Memory>;
@@ -1 +1 @@
1
- {"version":3,"file":"memories.d.ts","sourceRoot":"","sources":["../../src/resources/memories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EAC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