@peer2peer/cli 0.1.1 → 0.1.3

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/cli.d.ts CHANGED
@@ -28,6 +28,8 @@ export declare const realOps: {
28
28
  why: projects.OverWhy[];
29
29
  };
30
30
  overWhys(v: unknown): projects.OverWhy[];
31
+ hasDotDot(p: string): boolean;
32
+ physicalPath(p: string): string;
31
33
  pseudoPath(p: string): boolean;
32
34
  braceChoice(c: string): boolean;
33
35
  dirProjectId(root: string): string;
@@ -54,25 +56,40 @@ export declare const realOps: {
54
56
  makeProjectPrivate(app: App, dir: string): Promise<projects.ProjectView>;
55
57
  listProjects(app: App): Promise<projects.ProjectView[]>;
56
58
  showProject(app: App, dir: string): Promise<projects.ProjectView>;
59
+ sessionScratch(raw: string | undefined): projects.SessionScratch | undefined;
60
+ scratchRoot(dir: string, s: projects.SessionScratch): string | undefined;
57
61
  bindSession(app: App, sid: string, dirs: readonly string[], o?: {
58
62
  person?: boolean;
59
63
  over?: boolean | readonly projects.OverWhy[];
60
64
  constraint?: projects.ProjectShare;
61
65
  inbound?: boolean;
66
+ scratch?: projects.SessionScratch;
62
67
  }): Promise<projects.SessionBinding | undefined>;
63
68
  agentEnv(env: Record<string, string | undefined> | undefined): boolean;
64
69
  agentContext(env: Record<string, string | undefined> | undefined): boolean;
65
70
  personTokenFile(home: string): string;
71
+ personSaltFile(home: string): string;
72
+ homeFilesOwn(home: string): boolean;
73
+ personTokenMatchesKeys(home: string, spk: string, token: string): boolean;
66
74
  personToken(home: string): string;
75
+ renewPersonToken(home: string, spk?: string): string;
76
+ identityHere(home: string): boolean;
67
77
  personTokenOk(env: Record<string, string | undefined> | undefined, home: string | undefined): boolean;
78
+ healPersonToken(home: string): void;
68
79
  takePersonToken(env: Record<string, string | undefined>, home: string | undefined): boolean;
69
80
  assertPersonForWidening(app: Pick<App, "env"> & {
70
81
  front?: boolean;
71
- }, what: string, confirm: projects.ConfirmTty, why?: string): Promise<void>;
82
+ home?: string;
83
+ }, what: string, confirm: projects.ConfirmTty, why?: string, opts?: {
84
+ noTokenBeforeIdentity?: boolean;
85
+ }): Promise<void>;
72
86
  assertSpeaksFor(app: App, sid: string): Promise<void>;
73
87
  personHere(app: Pick<App, "env"> & {
74
88
  front?: boolean;
75
89
  }): boolean;
90
+ personHereStrict(app: Pick<App, "env"> & {
91
+ front?: boolean;
92
+ }): boolean;
76
93
  sessionBinding(app: App, sid: string): Promise<projects.SessionBinding | undefined>;
77
94
  privateReasons(doc: projects.ProjectsDoc, b: projects.SessionBinding): projects.PrivateReason[];
78
95
  privateRemedy(causes: readonly projects.PrivateCause[], names: string[]): string;
@@ -106,17 +123,21 @@ export declare const realOps: {
106
123
  }, sharedGraphs?: ReadonlyMap<string, string>): Promise<projects.GraphTarget>;
107
124
  projectGraphTarget(app: Pick<App, "env" | "file">, ref: Pick<projects.ProjectRef, "id" | "name" | "repoPrivate">, doc: projects.ProjectsDoc): projects.GraphTarget;
108
125
  describeGraphTarget(t: projects.GraphTarget): string;
126
+ graphTargetLine(t: projects.GraphTarget): string;
127
+ graphPlaintextNote(t: projects.GraphTarget): string;
109
128
  graphPinnedEnv(env: Record<string, string | undefined>, target: projects.GraphTarget, base?: Record<string, string | undefined>): Record<string, string | undefined>;
110
129
  PERSON_SESSION: "tui";
111
130
  PRIVATE_MARKER: ".p2p-private";
112
131
  MAX_SESSION_DIRS: 512;
113
- MAX_SESSION_PROJECTS: 16;
132
+ MAX_SESSION_PROJECTS: 64;
114
133
  SESSION_BINDING_TTL_MS: number;
115
134
  MAX_PROJECT_SHARES: 32;
116
135
  MAX_SESSION_CONSTRAINTS: 16;
117
136
  MAX_UNDER: 64;
118
137
  NESTED_SCAN_DEPTH: 4;
119
138
  NESTED_SCAN_ENTRIES: 2000;
139
+ SCRATCH_ENV: "P2P_SESSION_SCRATCH";
140
+ SCRATCH_SCAN_ENTRIES: 4096;
120
141
  AGENT_ENV_VARS: readonly string[];
121
142
  isAgentProcess: typeof projects.isAgentProcess;
122
143
  PROJECT_NOTICE_PREFIX: "project boundaries:";
@@ -127,12 +148,15 @@ export declare const realOps: {
127
148
  IX_CLOUD_ENV: readonly string[];
128
149
  IX_KEEP: readonly string[];
129
150
  readRotationState(home: string): Promise<rotation.RotationState | undefined>;
151
+ assertAdopted(app: App, userId: string): void;
130
152
  adoptHome(app: App, src: string, tag: string): Promise<string>;
131
153
  raiseRotationAlert(app: App, r: import("@peer2peer/core/v3").VerifiedRotation, by?: string): Promise<boolean>;
132
154
  alertForeignRotations(app: App): Promise<void>;
133
155
  friendVerdict(st: rotation.RotationState, peer: string): {
134
156
  invite: boolean;
135
- why?: string;
157
+ why
158
+ /** setup, "I already use Peer2Peer on another device": `p2p link join`, inline. No identity is made here, so no backup is asked. */
159
+ ? /** setup, "I already use Peer2Peer on another device": `p2p link join`, inline. No identity is made here, so no backup is asked. */: string;
136
160
  };
137
161
  rotatePlan(app: App, opts?: rotation.RotateOptions): Promise<rotation.RotationPlan>;
138
162
  rotateCancel(app: App): Promise<{
@@ -546,6 +570,8 @@ export declare const realOps: {
546
570
  })[]>;
547
571
  getHeld(app: App, id: string): Promise<import("./state.js").HeldItem>;
548
572
  HELD_ID_MIN_PREFIX: 8;
573
+ p2pCommand(platform?: NodeJS.Platform): string;
574
+ noRelaysReason(home: string, platform?: NodeJS.Platform): string;
549
575
  init(app: App, opts: {
550
576
  name?: string;
551
577
  relays?: string[];
@@ -553,8 +579,10 @@ export declare const realOps: {
553
579
  setup(app: App, opts: {
554
580
  name?: string;
555
581
  relays?: string[];
556
- backup?: "file" | "print" | "none";
582
+ backup?: identity.BackupMode;
557
583
  backupFile?: string;
584
+ ix?: boolean;
585
+ chooseBackup?: (created: identity.InitResult) => Promise<identity.BackupMode>;
558
586
  }): Promise<identity.SetupResult>;
559
587
  relaysList(app: App): Promise<{
560
588
  relays: string[];
@@ -564,7 +592,7 @@ export declare const realOps: {
564
592
  rejoined: string[];
565
593
  }>;
566
594
  relaysAdd(app: App, url: string): Promise<identity.RelaysChange>;
567
- relaysRemove(app: App, url: string): Promise<identity.RelaysChange>;
595
+ relaysRemove(app: App, urls: string | readonly string[]): Promise<identity.RelaysChange>;
568
596
  devices(app: App): Promise<identity.DeviceRow[]>;
569
597
  whoami(app: App): Promise<identity.WhoamiResult>;
570
598
  revokeDevice(app: App, did: string): Promise<{
@@ -581,6 +609,7 @@ export declare const realOps: {
581
609
  linkJoin(app: App, code: string, opts?: {
582
610
  label?: string;
583
611
  maxWaitMs?: number;
612
+ allowPrivateRelay?: boolean;
584
613
  }): Promise<identity.LinkJoin>;
585
614
  backupShow(app: App): Promise<{
586
615
  phrase: string;
@@ -648,11 +677,30 @@ export interface ProgramDeps {
648
677
  noInput?: boolean;
649
678
  /** The person token was valid (main() checks it once and removes it from the environment: projects.ts). */
650
679
  front?: boolean;
680
+ /** A person token was passed that isn't this home's (person.key was replaced since): every command refuses it (main()). */
681
+ personTokenStale?: boolean;
682
+ /** A person token was passed to a home whose files are links (projects.ts homeFilesOwn): every command refuses it (main()). */
683
+ personTokenLinked?: boolean;
684
+ /** The token `front` rests on (main() keeps it in memory, never in the environment): re-checked against the home as the command finds it, and against the keys it loads (App.load). */
685
+ frontToken?: string;
686
+ /** The home held no identity when main() checked the token. */
687
+ frontFresh?: boolean;
651
688
  /** The person's "yes" on their controlling terminal (tty-confirm.ts; tests stand in). */
652
689
  confirmTty?: projects.ConfirmTty;
653
690
  }
654
691
  /** The widening command `cmd` is (its path from the program, with `session roster` only when it adds), or undefined. */
655
692
  export declare function wideningOf(cmd: Command): string | undefined;
693
+ /**
694
+ * The person-only command `cmd` is ({what, why}), or undefined. Reads stay open: a bare
695
+ * `receipts`, `circle hold <cid>` and `ix config`, and a bare `identity rotate --plan` (it makes
696
+ * or shows the plan: the new fingerprint and which devices follow; nothing is published or
697
+ * revealed, and accepting it is gated).
698
+ */
699
+ export declare function personOnlyOf(cmd: Command): {
700
+ what: string;
701
+ why: string;
702
+ agentOnly?: boolean;
703
+ } | undefined;
656
704
  export declare function buildProgram(deps: ProgramDeps): Command;
657
705
  /** Writes a line to stdout; resolves false once the reader is gone (EPIPE). */
658
706
  export declare function stdoutWriter(ctl: AbortController): (line: string) => Promise<boolean>;