@peer2peer/cli 0.1.3 → 0.1.4

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/state.d.ts CHANGED
@@ -6,6 +6,7 @@ import type { GraphMemoryDoc } from "./graph-memory.js";
6
6
  import { type LockOptions } from "@peer2peer/core/v3/node";
7
7
  import type { DocBackend, RotationStatement, StatusBody } from "@peer2peer/core/v3";
8
8
  import { type Progress } from "./progress.js";
9
+ import { KeyStoreBackend } from "./keystore.js";
9
10
  export interface KeysDoc {
10
11
  v: 1;
11
12
  userId: string;
@@ -414,6 +415,11 @@ type Docs = {
414
415
  ixNotice: {
415
416
  at: number;
416
417
  };
418
+ /** When a front end showed the one-time notice to deny P2P_HOME to its agent's sandbox (sandbox.ts), per front end. */
419
+ sandboxNotice: {
420
+ claude?: number;
421
+ codex?: number;
422
+ };
417
423
  /** Graph memory (graph-memory.ts): this device's sessions' context waiting for the local Ix graph, and counters. */
418
424
  graphMemory: GraphMemoryDoc;
419
425
  };
@@ -448,6 +454,8 @@ export declare class CliState {
448
454
  constructor(dir: string, progress?: Progress | undefined,
449
455
  /** `p2p doctor`: an in-memory overlay (readonly.ts), so nothing is written to `dir`. */
450
456
  backend?: CliBackend, lockOpts?: Partial<LockOptions>);
457
+ /** The key store in front of this state's documents (keystore.ts). */
458
+ get keyStore(): KeyStoreBackend;
451
459
  get<K extends keyof Docs>(name: K): Promise<Docs[K] | undefined>;
452
460
  /** Read-modify-write under the cross-process lock. Return `undefined` as `next` to leave it. */
453
461
  /**
package/dist/state.js CHANGED
@@ -5,7 +5,8 @@
5
5
  // Every read-modify-write runs under the lock, so `p2p watch` and short
6
6
  // commands can run at the same time.
7
7
  //
8
- // keys this device's secrets (and the identity seed on key holders)
8
+ // keys this device's secrets (and the identity seed on key holders); with the keychain backend
9
+ // only the public part, the secrets in the OS keychain (keystore.ts)
9
10
  // self name, relays, did, the default circle
10
11
  // sessions own session rosters, by sid
11
12
  // seq envelope sequence counters, by (own, sid)
@@ -35,11 +36,14 @@
35
36
  // projects project policies (projects.ts): shared with circles and people, or private (the default)
36
37
  // sessionProjects the projects each session worked in (projects.ts), by sid
37
38
  // ixNotice when the one-time "Ix on by default" notice was shown (ix-local.ts)
39
+ // sandboxNotice when a front end showed the one-time "deny P2P_HOME to your agent's sandbox" notice (sandbox.ts)
38
40
  // graphMemory graph memory (graph-memory.ts): what was recorded of each own session, the bounded queue, counters
39
41
  // history, history-<n> message history (history.ts): sealed with the key in history.key, never plaintext
40
42
  import { join } from "node:path";
41
43
  import { FileDocBackend } from "@peer2peer/core/v3/node";
42
44
  import { debug, step } from "./progress.js";
45
+ import { KeyStoreBackend } from "./keystore.js";
46
+ import { OverlayDocBackend } from "./readonly.js";
43
47
  export const sessKey = (own, sid) => `${own}|${sid}`;
44
48
  /** Events older than this, or beyond the count cap, are pruned. */
45
49
  export const EVENT_RETENTION_MS = 7 * 24 * 3600 * 1000;
@@ -93,7 +97,13 @@ export class CliState {
93
97
  backend, lockOpts = {}) {
94
98
  this.dir = dir;
95
99
  this.progress = progress;
96
- this.backend = backend ?? new FileDocBackend(join(dir, "cli"), lockOpts);
100
+ // The keys document goes through the key store (keystore.ts): the OS keychain when this home chose it.
101
+ // `p2p doctor`'s overlay keeps every write in memory: so does the key store (no keychain write, no file touched).
102
+ this.backend = new KeyStoreBackend(backend ?? new FileDocBackend(join(dir, "cli"), lockOpts), dir, { memoryOnly: backend instanceof OverlayDocBackend });
103
+ }
104
+ /** The key store in front of this state's documents (keystore.ts). */
105
+ get keyStore() {
106
+ return this.backend;
97
107
  }
98
108
  async get(name) {
99
109
  return (await this.backend.read(name));
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "0.1.3";
1
+ export declare const VERSION = "0.1.4";
package/dist/version.js CHANGED
@@ -2,4 +2,4 @@
2
2
  //
3
3
  // This CLI's version (scripts/set-version.mjs writes it), on its own so the status and identity
4
4
  // code can advertise it (features.ts) without importing the command line.
5
- export const VERSION = "0.1.3";
5
+ export const VERSION = "0.1.4";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peer2peer/cli",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "The standalone Peer2Peer v3 CLI (`p2p`): an account-free identity, friends, circles, end-to-end encrypted session messaging and status over open relays",
5
5
  "keywords": [
6
6
  "peer2peer",
@@ -53,8 +53,8 @@
53
53
  "registry": "https://registry.npmjs.org/"
54
54
  },
55
55
  "dependencies": {
56
- "@peer2peer/codex-bridge": "0.1.3",
57
- "@peer2peer/core": "0.1.3",
56
+ "@peer2peer/codex-bridge": "0.1.4",
57
+ "@peer2peer/core": "0.1.4",
58
58
  "commander": "15.0.0",
59
59
  "uqr": "0.1.3",
60
60
  "ws": "8.22.0"