memax-sdk 0.1.14 → 0.3.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/dist/client.d.ts +2 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +8 -4
- package/dist/client.js.map +1 -1
- package/dist/errors.d.ts +129 -2
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +177 -3
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/resources/bar.d.ts +18 -0
- package/dist/resources/bar.d.ts.map +1 -0
- package/dist/resources/bar.js +19 -0
- package/dist/resources/bar.js.map +1 -0
- package/dist/resources/dreams.d.ts +16 -2
- package/dist/resources/dreams.d.ts.map +1 -1
- package/dist/resources/dreams.js +23 -5
- package/dist/resources/dreams.js.map +1 -1
- package/dist/resources/memories.d.ts +9 -4
- package/dist/resources/memories.d.ts.map +1 -1
- package/dist/resources/memories.js +10 -5
- package/dist/resources/memories.js.map +1 -1
- package/dist/transport.d.ts +1 -1
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +34 -3
- package/dist/transport.js.map +1 -1
- package/dist/types.d.ts +141 -5
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -2
- package/dist/client.test.d.ts +0 -2
- package/dist/client.test.d.ts.map +0 -1
- package/dist/client.test.js +0 -290
- package/dist/client.test.js.map +0 -1
- package/dist/resources/admin.d.ts +0 -357
- package/dist/resources/admin.d.ts.map +0 -1
- package/dist/resources/admin.js +0 -168
- package/dist/resources/admin.js.map +0 -1
- package/dist/transport.test.d.ts +0 -2
- package/dist/transport.test.d.ts.map +0 -1
- package/dist/transport.test.js +0 -95
- package/dist/transport.test.js.map +0 -1
package/dist/client.d.ts
CHANGED
|
@@ -12,8 +12,8 @@ import { NotificationsResource } from "./resources/notifications.js";
|
|
|
12
12
|
import { AgentsResource } from "./resources/agents.js";
|
|
13
13
|
import { InvitesResource } from "./resources/invites.js";
|
|
14
14
|
import { AccountResource } from "./resources/account.js";
|
|
15
|
-
import { AdminResource } from "./resources/admin.js";
|
|
16
15
|
import { EventsResource } from "./resources/events.js";
|
|
16
|
+
import { BarResource } from "./resources/bar.js";
|
|
17
17
|
export declare class Memax {
|
|
18
18
|
readonly memories: MemoriesResource;
|
|
19
19
|
readonly configs: ConfigsResource;
|
|
@@ -28,8 +28,8 @@ export declare class Memax {
|
|
|
28
28
|
readonly dreams: DreamsResource;
|
|
29
29
|
readonly notifications: NotificationsResource;
|
|
30
30
|
readonly agents: AgentsResource;
|
|
31
|
-
readonly admin: AdminResource;
|
|
32
31
|
readonly events: EventsResource;
|
|
32
|
+
readonly bar: BarResource;
|
|
33
33
|
constructor(config: MemaxConfig);
|
|
34
34
|
push(...args: Parameters<MemoriesResource["push"]>): Promise<import("./types.js").Memory>;
|
|
35
35
|
recall(...args: Parameters<MemoriesResource["recall"]>): Promise<import("./types.js").RecallResult>;
|
package/dist/client.d.ts.map
CHANGED
|
@@ -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,EAA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AQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAClC,QAAQ,CAAC,aAAa,EAAE,qBAAqB,CAAC;IAC9C,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAClC,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAClC,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,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
|
@@ -12,8 +12,8 @@ import { NotificationsResource } from "./resources/notifications.js";
|
|
|
12
12
|
import { AgentsResource } from "./resources/agents.js";
|
|
13
13
|
import { InvitesResource } from "./resources/invites.js";
|
|
14
14
|
import { AccountResource } from "./resources/account.js";
|
|
15
|
-
import { AdminResource } from "./resources/admin.js";
|
|
16
15
|
import { EventsResource } from "./resources/events.js";
|
|
16
|
+
import { BarResource } from "./resources/bar.js";
|
|
17
17
|
export class Memax {
|
|
18
18
|
memories;
|
|
19
19
|
configs;
|
|
@@ -28,14 +28,18 @@ export class Memax {
|
|
|
28
28
|
dreams;
|
|
29
29
|
notifications;
|
|
30
30
|
agents;
|
|
31
|
-
admin;
|
|
32
31
|
events;
|
|
32
|
+
bar;
|
|
33
33
|
constructor(config) {
|
|
34
34
|
const transport = new ApiTransport(config);
|
|
35
35
|
const req = transport.request.bind(transport);
|
|
36
36
|
const stream = transport.stream.bind(transport);
|
|
37
37
|
const download = transport.download.bind(transport);
|
|
38
|
-
|
|
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;
|
|
39
43
|
this.memories = new MemoriesResource(req, stream, download);
|
|
40
44
|
this.configs = new ConfigsResource(req);
|
|
41
45
|
this.agentSessions = new AgentSessionsResource(req, download);
|
|
@@ -49,8 +53,8 @@ export class Memax {
|
|
|
49
53
|
this.dreams = new DreamsResource(req);
|
|
50
54
|
this.notifications = new NotificationsResource(req);
|
|
51
55
|
this.agents = new AgentsResource(req);
|
|
52
|
-
this.admin = new AdminResource(req);
|
|
53
56
|
this.events = new EventsResource(stream);
|
|
57
|
+
this.bar = new BarResource(req);
|
|
54
58
|
}
|
|
55
59
|
async push(...args) {
|
|
56
60
|
return this.memories.push(...args);
|
package/dist/client.js.map
CHANGED
|
@@ -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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DK 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
|
-
|
|
6
|
-
|
|
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
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,UAAW,SAAQ,KAAK;
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBAAa,UAAW,SAAQ,KAAK;IAe1B,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,MAAM;IACd,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAhB1C;;;;;;;;;OASG;IACI,iBAAiB,CAAC,EAAE,MAAM,CAAC;gBAGhC,OAAO,EAAE,MAAM,EACR,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,YAAA,EACxC,iBAAiB,CAAC,EAAE,MAAM;IAO5B;;;;;;OAMG;IACH,IAAI,aAAa,IAAI,OAAO,CAE3B;IAED;;;;;;OAMG;IACH,IAAI,WAAW,IAAI,OAAO,CAEzB;IAED;;;;;;OAMG;IACH,IAAI,UAAU,IAAI,OAAO,CAExB;IAED;;;;;;;OAOG;IACH,IAAI,UAAU,IAAI,OAAO,CAExB;IAED;;;;;OAKG;IACH,IAAI,eAAe,IAAI,OAAO,CAE7B;IAED;;;;;OAKG;IACH,IAAI,cAAc,IAAI,OAAO,CAE5B;IAED;;;;;OAKG;IACH,IAAI,YAAY,IAAI,OAAO,CAE1B;IAED;;;;;OAKG;IACH,IAAI,aAAa,IAAI,OAAO,CAE3B;IAED;;;;;;;;OAQG;IACH,IAAI,SAAS,IAAI,OAAO,CAEvB;CACF;AAED;;;;;;;;;;;;;;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
|
-
|
|
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
|
-
/**
|
|
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
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,UAAW,SAAQ,KAAK;
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,OAAO,UAAW,SAAQ,KAAK;IAe1B;IACA;IACA;IAhBT;;;;;;;;;OASG;IACI,iBAAiB,CAAU;IAElC,YACE,OAAe,EACR,IAAY,EACZ,MAAc,EACd,OAAiC,EACxC,iBAA0B;QAE1B,KAAK,CAAC,OAAO,CAAC,CAAC;QALR,SAAI,GAAJ,IAAI,CAAQ;QACZ,WAAM,GAAN,MAAM,CAAQ;QACd,YAAO,GAAP,OAAO,CAA0B;QAIxC,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;QACzB,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;IAC7C,CAAC;IAED;;;;;;OAMG;IACH,IAAI,aAAa;QACf,OAAO,IAAI,CAAC,MAAM,KAAK,GAAG,IAAI,IAAI,CAAC,IAAI,KAAK,cAAc,CAAC;IAC7D,CAAC;IAED;;;;;;OAMG;IACH,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,MAAM,KAAK,GAAG,CAAC;IAC7B,CAAC;IAED;;;;;;OAMG;IACH,IAAI,UAAU;QACZ,OAAO,IAAI,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,EAAE,CAAC;QAC1B,MAAM,CAAC,GAAG,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAChC,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACtD,CAAC;IAED,+DAA+D;IAC/D,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACnC,IAAI,MAAM,CAAC,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,6 +1,5 @@
|
|
|
1
1
|
export { Memax } from "./client.js";
|
|
2
2
|
export type { EventsSubscribeOptions } from "./resources/events.js";
|
|
3
|
-
export type { AdminUserListParams, AdminUserListResponse, AdminUserDetail, SystemStats, HubSubscription, AdminTeamHub, AdminEmailTemplateVariable, AdminEmailTemplateSummary, AdminEmailTemplatePreview, AdminEmailTemplateSendResult, AdminEmailTemplateOverride, AdminEmailTemplateRevision, AdminEmailTemplateDetail, AdminNotificationTargeting, AdminSendNotificationParams, AdminSendNotificationResult, AdminSentNotificationsParams, AdminNotificationBatch, AdminSentNotificationsResponse, AdminAudienceRule, AdminAudienceRuleType, AdminAudience, AdminAudienceEstimate, AdminAudienceCreateParams, AdminAudienceUpdateParams, AdminAudienceEstimateParams, AdminAudienceSnapshot, AdminCampaignStatus, AdminCampaign, AdminCampaignListParams, AdminCampaignListResponse, AdminCampaignCreateParams, AdminCampaignUpdateParams, AdminCampaignScheduleParams, AdminCampaignDetail, AdminCommsAuditEntry, } from "./resources/admin.js";
|
|
4
3
|
export { MemaxError } from "./errors.js";
|
|
5
|
-
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";
|
|
6
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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;
|
|
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,EAC3B,aAAa,EACb,cAAc,EACd,YAAY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B,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"}
|
package/dist/index.js
CHANGED
|
@@ -3,5 +3,7 @@
|
|
|
3
3
|
// Works in Node.js, Deno, and edge runtimes (uses fetch, not http)
|
|
4
4
|
// =============================================================================
|
|
5
5
|
export { Memax } from "./client.js";
|
|
6
|
+
// Admin types + client live in packages/web/src/lib/admin-client/ —
|
|
7
|
+
// admin is an internal, web-only surface that never ships to npm.
|
|
6
8
|
export { MemaxError } from "./errors.js";
|
|
7
9
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,+CAA+C;AAC/C,mEAAmE;AACnE,gFAAgF;AAEhF,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,+CAA+C;AAC/C,mEAAmE;AACnE,gFAAgF;AAEhF,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,oEAAoE;AACpE,kEAAkE;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
}): Promise<BarSearchResult>;
|
|
17
|
+
}
|
|
18
|
+
//# 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;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAC7D,OAAO,CAAC,eAAe,CAAC;CAM5B"}
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# 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,OAA8D;QAE9D,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;SACtB,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -1,9 +1,23 @@
|
|
|
1
|
-
import type { DreamReport,
|
|
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
|
-
|
|
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,
|
|
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"}
|
package/dist/resources/dreams.js
CHANGED
|
@@ -3,11 +3,29 @@ export class DreamsResource {
|
|
|
3
3
|
constructor(req) {
|
|
4
4
|
this.req = req;
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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":"
|
|
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"}
|
|
@@ -17,10 +17,15 @@ export declare class MemoriesResource {
|
|
|
17
17
|
topicId?: string;
|
|
18
18
|
}): Promise<SearchResult[]>;
|
|
19
19
|
get(id: string): Promise<Memory>;
|
|
20
|
-
/**
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Semantically related memories via vector nearest-neighbor. Sub-50ms, no
|
|
22
|
+
* external API calls.
|
|
23
|
+
*
|
|
24
|
+
* Neighbor scope is derived server-side from the source memory's hub, so
|
|
25
|
+
* there is no hubId parameter here — a memory's neighbors are the same set
|
|
26
|
+
* regardless of which hub the viewer is currently in.
|
|
27
|
+
*/
|
|
28
|
+
related(id: string): Promise<RelatedMemory[]>;
|
|
24
29
|
delete(id: string): Promise<void>;
|
|
25
30
|
update(id: string, patch: MemoryUpdateInput): Promise<Memory>;
|
|
26
31
|
share(id: string, targetHubId: string): Promise<ShareMemoryResult>;
|