@persistmemory/sdk 0.3.0 → 0.4.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.
@@ -1,6 +1,6 @@
1
1
  import type { HttpClient, RequestOptions } from "../http.js";
2
2
  import { Paginated } from "../pagination.js";
3
- import type { CreateSpaceParams, ListSpacesParams, Memory, ShareSpaceParams, Space, SpaceCollaborator, GrantableSpaceRole, UpdateSpaceParams } from "../types.js";
3
+ import type { CreateSpaceParams, ListSpacesParams, Memory, ShareSpaceParams, Space, SpaceCollaborator, GrantableSpaceRole, UpdateSpaceParams, WorkingSpace } from "../types.js";
4
4
  /**
5
5
  * Spaces: a boundary around a set of memories.
6
6
  *
@@ -36,12 +36,22 @@ export declare class Spaces {
36
36
  * `delete` never destroys a memory that is filed in another Space as well —
37
37
  * that one is detached and left alone. `deleted` and `kept` come back so you
38
38
  * can say what actually happened.
39
+ *
40
+ * `moveTo` NAMES WHERE THE STRANDED ONES GO, and is refused-into rather than
41
+ * required: most deletions strand nothing, because everything in the Space
42
+ * is also filed elsewhere, and demanding a destination for those would be a
43
+ * question about nothing. When something WOULD be left in no Space at all,
44
+ * the server answers 400 naming this field. It used to file them into the
45
+ * account's default, which no longer exists — nothing picks a Space on
46
+ * anybody's behalf, so "keep these" has no answer unless you say where.
39
47
  */
40
48
  delete(id: string, params: {
41
49
  readonly memories: "keep" | "delete";
50
+ readonly moveTo?: string;
42
51
  }, options?: RequestOptions): Promise<{
43
52
  deleted: number;
44
53
  kept: number;
54
+ rehomed?: number;
45
55
  }>;
46
56
  /**
47
57
  * Merges Spaces into a NEW one, leaving every source exactly as it was.
@@ -60,19 +70,34 @@ export declare class Spaces {
60
70
  added: number;
61
71
  }>;
62
72
  /**
63
- * The Space this account files into when a capture names none.
73
+ * Which Space a context is working in.
74
+ *
75
+ * `chosen` absent means NOTHING sent from that context is kept — there is no
76
+ * default behind it and nothing picks one. The reply used to carry a
77
+ * `fallback` for that case and no longer can.
64
78
  *
65
- * `{}` an object with no `space` means there is no default, which is the
66
- * normal state rather than a gap. It is also what comes back after the Space
67
- * somebody chose has been deleted.
79
+ * `profile` is the command line's own profile name, and `surface` says which
80
+ * context is being asked about: `cli` for this profile, `email` for the
81
+ * account's ingest address. Between them they are the whole of what a caller
82
+ * may say about where it is working — the server builds the scope key
83
+ * itself, so this can never read or move where a chat is filing.
68
84
  */
69
- getDefault(options?: RequestOptions): Promise<{
70
- space?: Space;
71
- }>;
72
- /** `null` clears it. Not the same as omitting it, which is why the type says so. */
73
- setDefault(spaceId: string | null, options?: RequestOptions): Promise<{
74
- space?: Space;
75
- }>;
85
+ working(params?: {
86
+ readonly profile?: string;
87
+ readonly surface?: "cli" | "email";
88
+ }, options?: RequestOptions): Promise<WorkingSpace>;
89
+ /**
90
+ * Works in one from here on. `null` stops working in any.
91
+ *
92
+ * Takes an id or a NAME, because that is how a person says it. `null` rather
93
+ * than an omitted field: "clear this" and "I did not mention it" are
94
+ * different instructions, and clearing means this context keeps nothing
95
+ * until a Space is chosen again.
96
+ */
97
+ chooseWorking(space: string | null, params?: {
98
+ readonly profile?: string;
99
+ readonly surface?: "cli" | "email";
100
+ }, options?: RequestOptions): Promise<WorkingSpace>;
76
101
  /** Renaming, retention, and archiving - `archived` is a field, not a verb. */
77
102
  update(id: string, params: UpdateSpaceParams, options?: RequestOptions): Promise<Space>;
78
103
  /**
package/dist/types.d.ts CHANGED
@@ -141,6 +141,21 @@ export interface ListMemoriesParams {
141
141
  export interface RememberParams {
142
142
  readonly text: string;
143
143
  readonly title?: string;
144
+ /**
145
+ * The Spaces this is filed into. REQUIRED BY THE SERVER, though optional
146
+ * here.
147
+ *
148
+ * A capture with no Space is refused with a 400 that names this account's
149
+ * Spaces. It used to be filed into the account's default, its oldest Space,
150
+ * or a new one made for it — three destinations nobody chose — and none of
151
+ * those exists now: a Space is chosen or nothing is kept.
152
+ *
153
+ * It stays optional in the TYPE so that a caller upgrading this package gets
154
+ * the explanation from the server, in a sentence listing the Spaces they
155
+ * actually have, rather than a compile error that says "required" and leaves
156
+ * them looking for a list. Every call that omits it now fails at runtime;
157
+ * that break is intended and is the whole change.
158
+ */
144
159
  readonly spaceIds?: readonly string[];
145
160
  }
146
161
  /**
@@ -247,6 +262,35 @@ export interface Space {
247
262
  /** Set when archived. An archived Space is hidden, not deleted. */
248
263
  readonly archivedAt?: string;
249
264
  }
265
+ /**
266
+ * Where one context is filing, and whether anybody decided it.
267
+ *
268
+ * TWO FIELDS BECAUSE THEY ARE TWO FACTS, and merging them is the mistake this
269
+ * shape exists to make impossible. `chosen` is a Space somebody picked here: it
270
+ * narrows what a question is answered from as well as where a note lands.
271
+ * `fallback` is the account's own default, adopted automatically for captures
272
+ * that name none, and it narrows NOTHING — reading through it would silently
273
+ * scope every question the person ever asked to a Space they never picked.
274
+ *
275
+ * Neither present means no Space can be named at all, which is a real state
276
+ * rather than a gap: an account with no Spaces yet.
277
+ */
278
+ export interface WorkingSpace {
279
+ /** The context this answers about — `cli:default`, `email`. The server owns it. */
280
+ readonly scope: string;
281
+ /**
282
+ * The Space chosen for this context.
283
+ *
284
+ * ABSENT MEANS NOTHING IS KEPT from it, not "kept somewhere else". There
285
+ * used to be a `fallback` beside this — the account-wide Space a capture
286
+ * fell into when nobody chose — and it is gone with the setting itself: a
287
+ * Space is chosen or the capture is refused.
288
+ */
289
+ readonly chosen?: {
290
+ readonly id: string;
291
+ readonly name: string;
292
+ };
293
+ }
250
294
  export interface CreateSpaceParams {
251
295
  readonly name: string;
252
296
  readonly description?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@persistmemory/sdk",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "The official TypeScript client for the PersistMemory API",
5
5
  "license": "MIT",
6
6
  "author": "PersistMemory",