synomem 0.6.9 → 0.6.11

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/src/remote.ts CHANGED
@@ -37,6 +37,17 @@ export interface RemoteSynomemOptions {
37
37
  signal?: AbortSignal;
38
38
  timeoutMs?: number;
39
39
  maximumResponseBytes?: number;
40
+ /**
41
+ * False when `expectedActor` is only a historical CLI fallback guess (a
42
+ * caller named no real identity via `--actor`, `SYNOMEM_ACTOR_ID`, or a
43
+ * project binding), not an identity the caller actually asserted. Defaults
44
+ * to true, so every existing caller keeps its current strict behavior.
45
+ * `kind: 'system'` already bypasses the match unconditionally (its own
46
+ * historical bootstrap placeholder); this is the same bypass for a
47
+ * fallback of any other kind, without pretending that fallback IS a real
48
+ * identity.
49
+ */
50
+ assertActor?: boolean;
40
51
  }
41
52
 
42
53
  interface ApiErrorEnvelope {
@@ -153,6 +164,7 @@ export class RemoteSynomemService implements SynomemService {
153
164
  private readonly signal?: AbortSignal;
154
165
  private readonly timeoutMs: number;
155
166
  private readonly maximumResponseBytes: number;
167
+ private readonly assertActor: boolean;
156
168
  private initialized = false;
157
169
  private cachedCapabilities?: SynomemServiceCapabilities;
158
170
 
@@ -489,6 +501,7 @@ export class RemoteSynomemService implements SynomemService {
489
501
  throw asSynomemError(error);
490
502
  }
491
503
  this.credentialProvider = options.credentialProvider;
504
+ this.assertActor = options.assertActor ?? true;
492
505
  this.fetchImplementation = options.fetch ?? fetch;
493
506
  this.signal = options.signal;
494
507
  this.timeoutMs = options.timeoutMs ?? defaultTimeoutMs;
@@ -520,10 +533,13 @@ export class RemoteSynomemService implements SynomemService {
520
533
  // credential the server authenticates ever reports that kind back, so
521
534
  // asserting it here would make every one of those commands fail against
522
535
  // a remote backend no matter who is actually calling — exactly the
523
- // bootstrap deadlock the server-side half of this already fixed. Only a
524
- // caller that named a real identity (an agent ID, or an actor supplied
525
- // via --actor/SYNOMEM_ACTOR_ID) gets its match enforced.
526
- const assertedRealActor = this.actor.kind !== 'system';
536
+ // bootstrap deadlock the server-side half of this already fixed.
537
+ // `assertActor: false` is the same bypass for a fallback of any other
538
+ // kind: a caller whose "actor" is only a historical guess (never a real
539
+ // --actor, SYNOMEM_ACTOR_ID, or project binding) that should adopt
540
+ // whatever the credential actually names rather than fail outright.
541
+ // Either way, only a caller that named a real identity gets it enforced.
542
+ const assertedRealActor = this.assertActor && this.actor.kind !== 'system';
527
543
  if (
528
544
  binding.workspaceId !== this.workspaceId ||
529
545
  (assertedRealActor &&
package/src/types.ts CHANGED
@@ -496,7 +496,8 @@ export interface TaskRecord {
496
496
  };
497
497
  status: 'assigned' | 'open' | 'completed' | 'rejected' | 'canceled';
498
498
  }
499
- export type ItemRecord = KudosRecord | MemoRecord | NoteRecord | TaskRecord | TodoRecord;
499
+ export type ItemRecord =
500
+ KudosRecord | MemoRecord | NoteRecord | PostRecord | TaskRecord | TodoRecord;
500
501
 
501
502
  export interface ItemSummary {
502
503
  id: string;
@@ -796,6 +797,14 @@ export interface SynomemClientOptions {
796
797
  * actor's real org role here instead — see `SynomemCoreOptions`.
797
798
  */
798
799
  administrative?: boolean;
800
+ /**
801
+ * False when `actor` is only a historical fallback guess, not an identity
802
+ * the caller actually asserted. A local `SynomemClient` ignores this (a
803
+ * local home accepts any actor); a remote backend uses it to decide
804
+ * whether to enforce the credential's bound actor or adopt it — see
805
+ * `RemoteSynomemOptions.assertActor`.
806
+ */
807
+ assertActor?: boolean;
799
808
  clock?: () => Date;
800
809
  idGenerator?: () => string;
801
810
  readOnly?: boolean;