@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.
package/README.md CHANGED
@@ -219,19 +219,28 @@ const { space, added } = await client.spaces.merge({
219
219
  Additive, never destructive. Both sources keep exactly what they had, a memory
220
220
  in both is filed once, and undoing it is deleting the Space that comes back.
221
221
 
222
- ### The default Space
222
+ ### There is no default Space
223
223
 
224
- Where a capture lands when it names none the Telegram bot with no `/space`
225
- set, an MCP `remember` with no `spaceIds`, a conversation started from a chat.
224
+ A capture that names none is REFUSED. `client.memories.remember({ text })` with
225
+ no `spaceIds` answers 400, naming the Spaces this account has; the Telegram bot
226
+ with no `/space` set keeps nothing and says so; an MCP `remember` with no
227
+ `spaceIds` and no `work_in_space` returns an error rather than filing. Nothing
228
+ picks a Space on anybody's behalf.
229
+
230
+ `spaces.setDefault` and `spaces.getDefault` are gone with the two endpoints
231
+ they called. What replaces them is per-context rather than per-account: which
232
+ Space THIS command line, or this account's ingest address, is working in.
226
233
 
227
234
  ```ts
228
- await client.spaces.setDefault(work.id);
229
- const { space } = await client.spaces.getDefault(); // {} when there is none
230
- await client.spaces.setDefault(null); // back to nothing
235
+ await client.spaces.chooseWorking(work.id); // this profile
236
+ await client.spaces.chooseWorking(work.id, { surface: "email" }); // the inbox
237
+ const here = await client.spaces.working(); // { scope, chosen? }
238
+ await client.spaces.chooseWorking(null); // stop; nothing is kept
231
239
  ```
232
240
 
233
- `null` clears it and is not the same as omitting the field. Having no default is
234
- the normal state, not a gapnothing picks a Space on your behalf.
241
+ `null` clears it and is not the same as omitting the field. `chosen` absent
242
+ means nothing sent from that context is kept not that it is kept somewhere
243
+ else.
235
244
 
236
245
  ### Nesting, listing, updating, archiving
237
246
 
package/dist/index.cjs CHANGED
@@ -654,6 +654,14 @@ var Spaces = class {
654
654
  * `delete` never destroys a memory that is filed in another Space as well —
655
655
  * that one is detached and left alone. `deleted` and `kept` come back so you
656
656
  * can say what actually happened.
657
+ *
658
+ * `moveTo` NAMES WHERE THE STRANDED ONES GO, and is refused-into rather than
659
+ * required: most deletions strand nothing, because everything in the Space
660
+ * is also filed elsewhere, and demanding a destination for those would be a
661
+ * question about nothing. When something WOULD be left in no Space at all,
662
+ * the server answers 400 naming this field. It used to file them into the
663
+ * account's default, which no longer exists — nothing picks a Space on
664
+ * anybody's behalf, so "keep these" has no answer unless you say where.
657
665
  */
658
666
  async delete(id, params, options) {
659
667
  return this.#http.delete(
@@ -677,21 +685,55 @@ var Spaces = class {
677
685
  options
678
686
  );
679
687
  }
688
+ /* ------------------------- where this is working ------------------------- */
689
+ /*
690
+ `getDefault` AND `setDefault` ARE GONE, with the endpoints they called.
691
+
692
+ They read and wrote the account-wide Space a capture fell into when nobody
693
+ named one. Nothing falls anywhere now: a Space is chosen for the context
694
+ doing the capturing, or `remember` answers 400. Keeping the methods would
695
+ mean keeping two calls that 404, which is a worse break than removing them
696
+ because it looks like a server fault rather than a change.
697
+ */
680
698
  /**
681
- * The Space this account files into when a capture names none.
699
+ * Which Space a context is working in.
700
+ *
701
+ * `chosen` absent means NOTHING sent from that context is kept — there is no
702
+ * default behind it and nothing picks one. The reply used to carry a
703
+ * `fallback` for that case and no longer can.
682
704
  *
683
- * `{}` an object with no `space` means there is no default, which is the
684
- * normal state rather than a gap. It is also what comes back after the Space
685
- * somebody chose has been deleted.
705
+ * `profile` is the command line's own profile name, and `surface` says which
706
+ * context is being asked about: `cli` for this profile, `email` for the
707
+ * account's ingest address. Between them they are the whole of what a caller
708
+ * may say about where it is working — the server builds the scope key
709
+ * itself, so this can never read or move where a chat is filing.
686
710
  */
687
- async getDefault(options) {
688
- return this.#http.get("/api/v1/spaces/default", void 0, options);
711
+ async working(params = {}, options) {
712
+ return this.#http.get(
713
+ "/api/v1/spaces/working",
714
+ {
715
+ ...params.profile !== void 0 ? { profile: params.profile } : {},
716
+ ...params.surface !== void 0 ? { surface: params.surface } : {}
717
+ },
718
+ options
719
+ );
689
720
  }
690
- /** `null` clears it. Not the same as omitting it, which is why the type says so. */
691
- async setDefault(spaceId, options) {
721
+ /**
722
+ * Works in one from here on. `null` stops working in any.
723
+ *
724
+ * Takes an id or a NAME, because that is how a person says it. `null` rather
725
+ * than an omitted field: "clear this" and "I did not mention it" are
726
+ * different instructions, and clearing means this context keeps nothing
727
+ * until a Space is chosen again.
728
+ */
729
+ async chooseWorking(space, params = {}, options) {
692
730
  return this.#http.patch(
693
- "/api/v1/spaces/default",
694
- { spaceId },
731
+ "/api/v1/spaces/working",
732
+ {
733
+ space,
734
+ ...params.profile !== void 0 ? { profile: params.profile } : {},
735
+ ...params.surface !== void 0 ? { surface: params.surface } : {}
736
+ },
695
737
  options
696
738
  );
697
739
  }