@peer2peer/cli 0.1.1 → 0.1.2
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 +13 -11
- package/dist/app.d.ts +78 -0
- package/dist/app.js +150 -39
- package/dist/cli.d.ts +24 -3
- package/dist/cli.js +244 -29
- package/dist/config.d.ts +5 -0
- package/dist/doctor.d.ts +71 -2
- package/dist/doctor.js +95 -16
- package/dist/ext-host.js +5 -1
- package/dist/extensions.js +2 -2
- package/dist/identity.d.ts +29 -3
- package/dist/identity.js +74 -12
- package/dist/ix-local.d.ts +63 -11
- package/dist/ix-local.js +81 -24
- package/dist/pretty.d.ts +3 -1
- package/dist/pretty.js +9 -2
- package/dist/projects.d.ts +70 -3
- package/dist/projects.js +305 -19
- package/dist/rotation.js +15 -7
- package/dist/sessions.d.ts +8 -0
- package/dist/sessions.js +73 -16
- package/dist/social.js +11 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +6 -3
package/dist/ix-local.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
// Copyright 2026 Ix Infrastructure Inc.
|
|
2
2
|
//
|
|
3
|
-
// Ix
|
|
4
|
-
// (version, backend, whether a checkout is mapped),
|
|
5
|
-
//
|
|
3
|
+
// Ix: optional and recommended, never installed for the person (epic #41 piece 1): finding the
|
|
4
|
+
// local Ix CLI, asking it about this machine (version, backend, whether a checkout is mapped),
|
|
5
|
+
// recommending it when it isn't there (the person installs it, or says no and isn't asked again),
|
|
6
|
+
// and turning the `ix` extension on for a new install, with the person's yes, when Ix is there. The CLI never imports an extension (scripts/check-boundaries.mjs), so
|
|
6
7
|
// it runs `ix` itself here, the same way ext-ix does: by absolute path from PATH's absolute
|
|
7
8
|
// entries (never a binary planted in the repository), by argv with no shell, bounded, with an
|
|
8
9
|
// allowlisted environment pinned to the graph target (projects.ts), never the caller's IX_*
|
|
@@ -11,10 +12,51 @@ import { execFile } from "node:child_process";
|
|
|
11
12
|
import { accessSync, constants, statSync } from "node:fs";
|
|
12
13
|
import { delimiter, isAbsolute, join } from "node:path";
|
|
13
14
|
import { sanitizePeerText } from "@peer2peer/core/v3";
|
|
15
|
+
import { setFileConfigField } from "./config.js";
|
|
14
16
|
import { enabledNamespaces, extensionDirs, extensionPackageName, resolveIn, setExtensionEnabled } from "./extensions.js";
|
|
15
17
|
import { personHere } from "./projects.js";
|
|
16
18
|
/** Where to get Ix (and how p2p says it): never installed for the person. */
|
|
17
19
|
export const IX_INSTALL_URL = "https://github.com/ix-infrastructure/Ix";
|
|
20
|
+
/**
|
|
21
|
+
* The command(s) that install Ix on this platform, from the Ix README, for the person to run in their
|
|
22
|
+
* own terminal: Peer2Peer prints them and never runs them (it doesn't run a downloaded script). Intel
|
|
23
|
+
* Macs have no pre-built Ix package, so Homebrew builds it.
|
|
24
|
+
*/
|
|
25
|
+
export function ixInstallCommands(platform = process.platform, arch = process.arch) {
|
|
26
|
+
if (platform === "win32")
|
|
27
|
+
return ["irm https://ix-infra.com/install.ps1 | iex"];
|
|
28
|
+
if (platform === "darwin" && arch === "x64")
|
|
29
|
+
return ["brew tap ix-infrastructure/ix https://github.com/ix-infrastructure/Ix", "brew install ix"];
|
|
30
|
+
return ["curl -fsSL https://ix-infra.com/install.sh | sh"];
|
|
31
|
+
}
|
|
32
|
+
/** The install command(s) as one line (`&&` between steps; Windows has one). */
|
|
33
|
+
export function ixInstallLine(platform = process.platform, arch = process.arch) {
|
|
34
|
+
return ixInstallCommands(platform, arch).join(" && ");
|
|
35
|
+
}
|
|
36
|
+
/** What Ix adds, in a few lines, said when `p2p setup` recommends it. */
|
|
37
|
+
export const IX_PITCH = [
|
|
38
|
+
"Ix (optional, recommended) maps your code into a local graph. With it, Peer2Peer can flag when a peer's",
|
|
39
|
+
"session works on code that overlaps yours, show a change's blast radius, and keep your sessions' context",
|
|
40
|
+
"as local graph memory. Everything stays on this machine. Peer2Peer works without it and never installs it for you.",
|
|
41
|
+
];
|
|
42
|
+
/** The person said no to Ix at `p2p setup` (FileConfig.ixDeclined): not asked again until `p2p setup --ix`. */
|
|
43
|
+
export function ixDeclined(file) {
|
|
44
|
+
return file.ixDeclined === true;
|
|
45
|
+
}
|
|
46
|
+
/** Records the person's answer to the Ix offer (config.json `ixDeclined`); only `p2p setup`, at a terminal, writes it. */
|
|
47
|
+
export function setIxDeclined(home, declined) {
|
|
48
|
+
setFileConfigField(home, "ixDeclined", declined);
|
|
49
|
+
}
|
|
50
|
+
/** CI set (anything but empty, 0 or false): never a prompt. */
|
|
51
|
+
export function ciEnv(env) {
|
|
52
|
+
const v = env.CI?.trim().toLowerCase();
|
|
53
|
+
return Boolean(v) && v !== "0" && v !== "false";
|
|
54
|
+
}
|
|
55
|
+
export function ixAdvice(env, file, o = {}) {
|
|
56
|
+
const installed = ixBinary(env) !== undefined;
|
|
57
|
+
const declined = ixDeclined(file) && o.reoffer !== true;
|
|
58
|
+
return { installed, declined, recommended: !installed && !declined, install: ixInstallLine() };
|
|
59
|
+
}
|
|
18
60
|
/**
|
|
19
61
|
* `name` resolved to an absolute path through PATH's absolute entries (the same rule as ext-ix's
|
|
20
62
|
* which.ts: on Windows the current directory is searched before PATH, so a cloned repository's
|
|
@@ -121,45 +163,60 @@ export function extIxInstalled(env) {
|
|
|
121
163
|
}
|
|
122
164
|
/** P2P_EXTENSIONS decides which extensions load (anything but unset or `config`, which defers to config.json). */
|
|
123
165
|
const envDecides = (env) => env.P2P_EXTENSIONS !== undefined && env.P2P_EXTENSIONS.trim() !== "config";
|
|
124
|
-
|
|
166
|
+
/**
|
|
167
|
+
* What to do about Ix when it isn't installed: the person runs the command themselves; read by an
|
|
168
|
+
* agent (not the person), it says to ask the user instead, since installing is theirs alone.
|
|
169
|
+
*/
|
|
170
|
+
export function ixInstallHint(line, person) {
|
|
171
|
+
const what = "Ix (optional, recommended: a local code graph for overlap, blast radius and graph memory) isn't installed";
|
|
172
|
+
return person
|
|
173
|
+
? `${what}. Peer2Peer never installs it for you: to add it, run \`${line}\` yourself (or see ${IX_INSTALL_URL}), then \`p2p setup --ix\``
|
|
174
|
+
: `${what}. Installing it is your user's decision: don't install it yourself; you may ask your user whether they want it, and they run \`${line}\` in their own terminal, then \`p2p setup --ix\``;
|
|
175
|
+
}
|
|
176
|
+
const DECLINED_IX = "Ix isn't installed (you said no; `p2p setup --ix` offers it again). Peer2Peer works without it";
|
|
125
177
|
const INSTALL_EXT = "Ix is installed, but the Ix extension isn't: `npm i -g @peer2peer/ext-ix`, then `p2p extensions enable ix` (the Claude Code mod ships it: `/peers setup` there turns it on)";
|
|
126
178
|
/**
|
|
127
|
-
* Ix
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
179
|
+
* Ix for `p2p setup`: optional and recommended, never installed. Without the Ix CLI it says what to
|
|
180
|
+
* run (`recommended`, `install`), unless the person said no before (`--ix`, `reoffer`, asks again).
|
|
181
|
+
* With it, a new install (`created`; or any install, with `reoffer`) gets the `ix` extension enabled
|
|
182
|
+
* when ext-ix is there too and the person agrees: their front end's token (the Claude mod's typed
|
|
183
|
+
* `/peers setup`), or, outside any agent's session (its environment or a Claude Code or Codex
|
|
184
|
+
* ancestor), their "yes" typed on the controlling terminal, as for every other person-only action
|
|
185
|
+
* (projects.ts). Otherwise nothing changes: an existing install is never switched silently (it gets
|
|
186
|
+
* the one-time notice, ixNotice), an agent never enables an extension, and P2P_EXTENSIONS, when
|
|
187
|
+
* set, decides alone.
|
|
134
188
|
*/
|
|
135
|
-
export async function setupIx(app, created) {
|
|
136
|
-
const
|
|
189
|
+
export async function setupIx(app, created, o = {}) {
|
|
190
|
+
const adv = ixAdvice(app.env, app.file, o);
|
|
191
|
+
const found = adv.installed;
|
|
192
|
+
const base = { found, installed: found, recommended: adv.recommended, ...(adv.declined ? { declined: true } : {}) };
|
|
137
193
|
const { enabled } = enabledNamespaces(app.env, app.file);
|
|
138
194
|
if (enabled.includes("ix"))
|
|
139
|
-
return {
|
|
195
|
+
return { ...base, enabled: true };
|
|
140
196
|
if (!found)
|
|
141
|
-
return {
|
|
197
|
+
return { ...base, enabled: false, install: adv.install, hint: adv.declined ? DECLINED_IX : ixInstallHint(adv.install, personHere(app)) };
|
|
142
198
|
if (!extIxInstalled(app.env))
|
|
143
|
-
return {
|
|
199
|
+
return { ...base, enabled: false, hint: INSTALL_EXT };
|
|
144
200
|
const chose = Array.isArray(app.file.extensions);
|
|
145
|
-
if (!created || chose || envDecides(app.env) || !personHere(app)) {
|
|
146
|
-
return {
|
|
201
|
+
if ((!created && o.reoffer !== true) || chose || envDecides(app.env) || !personHere(app)) {
|
|
202
|
+
return { ...base, enabled: false, hint: "Ix is installed: `p2p extensions enable ix` lets your sessions share Ix context (notes, subgraph references, blast radius, footprints)" };
|
|
147
203
|
}
|
|
148
204
|
if (app.front !== true) {
|
|
149
205
|
const yes = app.confirmTty ? await app.confirmTty("Ix is installed. Turn on the Ix extension, so your sessions can share Ix context with the people you share a project with? (Ix calls stay on this machine.)").catch(() => false) : false;
|
|
150
206
|
if (!yes)
|
|
151
|
-
return {
|
|
207
|
+
return { ...base, enabled: false, hint: "Ix is installed: `p2p extensions enable ix` lets your sessions share Ix context (notes, subgraph references, blast radius, footprints)" };
|
|
152
208
|
}
|
|
153
209
|
setExtensionEnabled(app.home, "ix", true);
|
|
154
|
-
return {
|
|
210
|
+
return { ...base, enabled: true, enabledNow: true };
|
|
155
211
|
}
|
|
156
212
|
/**
|
|
157
213
|
* The one-time notice for an existing install (shown once per device, to the person at a terminal):
|
|
158
|
-
* new installs turn the Ix extension on when Ix is present; this one wasn't changed.
|
|
159
|
-
* it was shown already, Ix isn't installed,
|
|
214
|
+
* new installs offer to turn the Ix extension on when Ix is present; this one wasn't changed.
|
|
215
|
+
* Undefined when it was shown already, Ix isn't installed, the person said no to Ix, or the
|
|
216
|
+
* extension is on (or P2P_EXTENSIONS decides).
|
|
160
217
|
*/
|
|
161
218
|
export async function ixNotice(app) {
|
|
162
|
-
if (envDecides(app.env))
|
|
219
|
+
if (envDecides(app.env) || ixDeclined(app.file))
|
|
163
220
|
return undefined;
|
|
164
221
|
if (enabledNamespaces(app.env, app.file).enabled.includes("ix"))
|
|
165
222
|
return undefined;
|
|
@@ -171,7 +228,7 @@ export async function ixNotice(app) {
|
|
|
171
228
|
if (!shown)
|
|
172
229
|
return undefined;
|
|
173
230
|
const how = extIxInstalled(app.env) ? "`p2p extensions enable ix`" : "`npm i -g @peer2peer/ext-ix`, then `p2p extensions enable ix`";
|
|
174
|
-
return `Ix:
|
|
231
|
+
return `Ix: \`p2p setup\` now offers to turn the Ix extension on when Ix is installed, so sessions can share Ix context. Yours wasn't changed; to turn it on, run ${how}. Ix calls stay on this machine (\`p2p doctor\` shows each project's graph: local only)`;
|
|
175
232
|
}
|
|
176
233
|
/**
|
|
177
234
|
* Which `ix note` / `ix session` this Ix has, from `ix --help` (graph memory, graph-memory.ts):
|
package/dist/pretty.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Style } from "./prompt/picker.js";
|
|
2
2
|
import type { CircleSummary } from "./circle-ops.js";
|
|
3
3
|
import type { CodeRow, InviteCodeResult } from "./codes.js";
|
|
4
|
-
import type
|
|
4
|
+
import { type DoctorResult } from "./doctor.js";
|
|
5
5
|
import type { PeerRow } from "./sessions.js";
|
|
6
6
|
import type { FriendRow } from "./social.js";
|
|
7
7
|
export interface Pretty {
|
|
@@ -43,6 +43,8 @@ export declare function prettyCodes(rows: CodeRow[], p: Pretty): string;
|
|
|
43
43
|
/** Whole days left, rounded up: a 7-day code a few seconds old still says "7 days". */
|
|
44
44
|
export declare function daysLeft(exp: number, now: number): string;
|
|
45
45
|
export declare function prettyInvite(r: InviteCodeResult, p: Pretty): string;
|
|
46
|
+
/** A "Where your data goes" row is cut only past this many columns (a graph row: name, endpoint, reason, note). */
|
|
47
|
+
export declare const DATA_FLOW_WIDTH = 2000;
|
|
46
48
|
export declare function prettyDoctor(r: DoctorResult, plain: string, p: Pretty): string;
|
|
47
49
|
export declare function prettyRelays(r: {
|
|
48
50
|
relays: string[];
|
package/dist/pretty.js
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
// NO_COLOR, TERM=dumb (and FORCE_COLOR) decide `color` (tui/terminal.ts colorWanted).
|
|
12
12
|
import { COLOR, PLAIN } from "./prompt/picker.js";
|
|
13
13
|
import { cell, clean, displayWidth } from "./tui/sanitize.js";
|
|
14
|
+
import { DATA_FLOW_HEADING } from "./doctor.js";
|
|
14
15
|
const styleOf = (p) => (p.color ? COLOR : PLAIN);
|
|
15
16
|
const nowOf = (p) => p.now ?? Date.now() / 1000;
|
|
16
17
|
/** Everything a terminal could act on, except the SGR (colour) sequences this module writes. */
|
|
@@ -179,13 +180,19 @@ export function prettyInvite(r, p) {
|
|
|
179
180
|
st.dim("Who joined: p2p invites · undo: p2p remove <user> · cancel: p2p invites revoke <code>"),
|
|
180
181
|
].join("\n");
|
|
181
182
|
}
|
|
183
|
+
/** A "Where your data goes" row is cut only past this many columns (a graph row: name, endpoint, reason, note). */
|
|
184
|
+
export const DATA_FLOW_WIDTH = 2000;
|
|
182
185
|
export function prettyDoctor(r, plain, p) {
|
|
183
186
|
const st = styleOf(p);
|
|
187
|
+
let flow = false;
|
|
184
188
|
return plain
|
|
185
189
|
.split("\n")
|
|
186
190
|
.map((l, i) => {
|
|
187
|
-
|
|
188
|
-
if (
|
|
191
|
+
// "Where your data goes" rows (a graph target with its reason) can be long: wider, not cut short.
|
|
192
|
+
if (l.startsWith(DATA_FLOW_HEADING))
|
|
193
|
+
flow = true;
|
|
194
|
+
const s = cell(l, flow ? DATA_FLOW_WIDTH : 400);
|
|
195
|
+
if (i === 0 || s.startsWith(DATA_FLOW_HEADING))
|
|
189
196
|
return st.bold(s);
|
|
190
197
|
if (s.startsWith("✓"))
|
|
191
198
|
return st.green("✓") + s.slice(1);
|
package/dist/projects.d.ts
CHANGED
|
@@ -33,8 +33,12 @@ export type OverWhy = "projects" | "folders" | "unresolved" | "front" | "constra
|
|
|
33
33
|
export declare function overWhys(v: unknown): OverWhy[];
|
|
34
34
|
/** At most this many folders a front end passes per call; past it the session is private. */
|
|
35
35
|
export declare const MAX_SESSION_DIRS = 512;
|
|
36
|
-
/**
|
|
37
|
-
|
|
36
|
+
/**
|
|
37
|
+
* At most this many projects per session; past it the session is private. A storage bound only:
|
|
38
|
+
* a session's ceiling is the intersection of all its projects' policies, so a higher cap never
|
|
39
|
+
* lets a session reach anyone a smaller one wouldn't.
|
|
40
|
+
*/
|
|
41
|
+
export declare const MAX_SESSION_PROJECTS = 64;
|
|
38
42
|
/** Bindings of sessions not seen for this long are dropped. */
|
|
39
43
|
export declare const SESSION_BINDING_TTL_MS: number;
|
|
40
44
|
/** At most this many circles and people in one project's policy. */
|
|
@@ -51,6 +55,8 @@ export interface ProjectRef {
|
|
|
51
55
|
remote?: string;
|
|
52
56
|
/** The repository asks to stay private (a committed PRIVATE_MARKER at `root`). */
|
|
53
57
|
repoPrivate?: true;
|
|
58
|
+
/** A `.git` is there but can't be read as a repository (a folder project at that level). */
|
|
59
|
+
brokenGit?: true;
|
|
54
60
|
}
|
|
55
61
|
export type ProjectShare = "private" | {
|
|
56
62
|
circles: string[];
|
|
@@ -131,6 +137,16 @@ export type Ceiling = {
|
|
|
131
137
|
* message), `disjoint` (its projects share nobody in common, or nobody you can reach).
|
|
132
138
|
*/
|
|
133
139
|
export type PrivateCause = OverWhy | "legacy-over" | "unregistered" | "repo-private" | "private" | "unshared" | "sent-private" | "disjoint";
|
|
140
|
+
/** Whether a path, as written, has a `..` segment (`a/../b`, `..`, `a/..`). */
|
|
141
|
+
export declare function hasDotDot(p: string): boolean;
|
|
142
|
+
/**
|
|
143
|
+
* `p` as the file system walks it (POSIX): each existing prefix is resolved through its symlinks
|
|
144
|
+
* before the next segment applies, so `link/../x` is the link's target's parent's `x`, never the
|
|
145
|
+
* `x` beside the link (path.resolve collapses `..` as text). Past the first segment that doesn't
|
|
146
|
+
* exist, the rest is applied as text. Relative paths start at the process's cwd. On Windows,
|
|
147
|
+
* path.resolve.
|
|
148
|
+
*/
|
|
149
|
+
export declare function physicalPath(p: string): string;
|
|
134
150
|
/**
|
|
135
151
|
* Whether `p` is a device or pseudo file (`/dev/null`, `/dev/tty`, `/proc/self/status`), never a
|
|
136
152
|
* project: it exists, isn't a folder, and its real path stays under /dev (and isn't a regular
|
|
@@ -247,6 +263,36 @@ export declare function makeProjectPrivate(app: App, dir: string): Promise<Proje
|
|
|
247
263
|
export declare function listProjects(app: App): Promise<ProjectView[]>;
|
|
248
264
|
/** `p2p project show`: the project at `dir` (a shared folder above it covers it), its policy and why. */
|
|
249
265
|
export declare function showProject(app: App, dir: string): Promise<ProjectView>;
|
|
266
|
+
/**
|
|
267
|
+
* The folders an agent keeps for this one session (Claude Code: its background tasks' output, the
|
|
268
|
+
* large tool results it saved, its subagents' transcripts, a background job's folder), which its
|
|
269
|
+
* front end names in SCRATCH_ENV. What is in them came from the session's own tool calls, whose
|
|
270
|
+
* real paths were bound already, so a path in them is the session, not a project of its own.
|
|
271
|
+
* Each is matched by the session's exact id, on real paths:
|
|
272
|
+
* - `bases`: a folder whose `<one folder>/<sid>` subtree is this session's: `<tmp>/claude-<uid>`
|
|
273
|
+
* (`<tmp>/claude-<uid>/<project>/<sid>/tasks/…`) and `<config>/projects`
|
|
274
|
+
* (`<config>/projects/<project>/<sid>/tool-results/…`, `…/subagents/…`). Never what is shared
|
|
275
|
+
* across sessions there (`<config>/projects/<project>/memory`, other sessions' transcripts);
|
|
276
|
+
* - `jobs`: the session's background job folder (`<config>/jobs/<id>`, `<id>` the start of `sid`,
|
|
277
|
+
* so a job's next conversation after a /clear, which has a new id, has none).
|
|
278
|
+
*/
|
|
279
|
+
export interface SessionScratch {
|
|
280
|
+
sid: string;
|
|
281
|
+
bases: string[];
|
|
282
|
+
jobs: string[];
|
|
283
|
+
}
|
|
284
|
+
/** The variable a front end names its session's scratch in (JSON: `{sid, tmp: [..], config, job}`). */
|
|
285
|
+
export declare const SCRATCH_ENV = "P2P_SESSION_SCRATCH";
|
|
286
|
+
/** At most this many entries a scratch folder is scanned for symlinks; past it nothing in it is skipped (fails closed: paths there bind). */
|
|
287
|
+
export declare const SCRATCH_SCAN_ENTRIES = 4096;
|
|
288
|
+
/**
|
|
289
|
+
* The scratch a front end named (SCRATCH_ENV), checked: the id's shape; each folder there this
|
|
290
|
+
* user's own and not a symlink; the temporary one named as Claude Code names it (`claude-<uid>`);
|
|
291
|
+
* the job folder right in `<config>/jobs`, its name the start of the id. Anything else: none.
|
|
292
|
+
*/
|
|
293
|
+
export declare function sessionScratch(raw: string | undefined): SessionScratch | undefined;
|
|
294
|
+
/** The scratch folder (`<base>/<project>/<sid>`, or the job folder) the real folder `dir` is in, if any. */
|
|
295
|
+
export declare function scratchRoot(dir: string, s: SessionScratch): string | undefined;
|
|
250
296
|
/**
|
|
251
297
|
* Binds a session to the projects of `dirs` (sticky: a session's projects only ever grow until it
|
|
252
298
|
* ends), plus a constraint an own-device message carried. The person's own session is never
|
|
@@ -258,6 +304,7 @@ export declare function bindSession(app: App, sid: string, dirs: readonly string
|
|
|
258
304
|
over?: boolean | readonly OverWhy[];
|
|
259
305
|
constraint?: ProjectShare;
|
|
260
306
|
inbound?: boolean;
|
|
307
|
+
scratch?: SessionScratch;
|
|
261
308
|
}): Promise<SessionBinding | undefined>;
|
|
262
309
|
/**
|
|
263
310
|
* The variables Claude Code and Codex set in the commands their agents run (an allow-list, from
|
|
@@ -274,6 +321,19 @@ export { isAgentProcess };
|
|
|
274
321
|
export declare function personTokenFile(home: string): string;
|
|
275
322
|
/** The person token, made once (exclusively, 0600, in the CLI's own folder, which the mod's guards keep from the model). */
|
|
276
323
|
export declare function personToken(home: string): string;
|
|
324
|
+
/**
|
|
325
|
+
* Replaces the person token with a fresh one. Called whenever an identity is first created or
|
|
326
|
+
* restored on a home (init, link join, backup restore; setup and join create through init): a
|
|
327
|
+
* person.key that was already there may have been put there by anything that could write the
|
|
328
|
+
* folder before the identity existed, so it must not keep standing in for the person afterwards.
|
|
329
|
+
* The command that creates the identity checked its token when it started, so a front end's first
|
|
330
|
+
* run still works; the front ends read person.key again when the CLI refuses their old token
|
|
331
|
+
* (`person_token_stale`). Written whole: a new 0600 file made exclusively beside it, then renamed
|
|
332
|
+
* over it (a planted symlink is replaced, never followed).
|
|
333
|
+
*/
|
|
334
|
+
export declare function renewPersonToken(home: string): string;
|
|
335
|
+
/** Whether `home` holds an identity: its keys and self documents (state.ts keeps them at <home>/cli/keys.json and self.json). */
|
|
336
|
+
export declare function identityHere(home: string): boolean;
|
|
277
337
|
/** Whether P2P_PERSON_TOKEN is this home's person token (read only: a missing file is no match). */
|
|
278
338
|
export declare function personTokenOk(env: Record<string, string | undefined> | undefined, home: string | undefined): boolean;
|
|
279
339
|
/**
|
|
@@ -292,7 +352,10 @@ export type ConfirmTty = (question: string) => Promise<boolean>;
|
|
|
292
352
|
*/
|
|
293
353
|
export declare function assertPersonForWidening(app: Pick<App, "env"> & {
|
|
294
354
|
front?: boolean;
|
|
295
|
-
|
|
355
|
+
home?: string;
|
|
356
|
+
}, what: string, confirm: ConfirmTty, why?: string, opts?: {
|
|
357
|
+
noTokenBeforeIdentity?: boolean;
|
|
358
|
+
}): Promise<void>;
|
|
296
359
|
/**
|
|
297
360
|
* For an act on a session that binds nothing (a delivery receipt): the session's front end (its
|
|
298
361
|
* token); or, outside any agent's session, a caller acting for a session no front end registered.
|
|
@@ -472,6 +535,10 @@ export declare const MAX_GRAPH_PATHS = 64;
|
|
|
472
535
|
export declare function projectGraphTarget(app: Pick<App, "env" | "file">, ref: Pick<ProjectRef, "id" | "name" | "repoPrivate">, doc: ProjectsDoc): GraphTarget;
|
|
473
536
|
/** How a target reads in one line: `local only (http://localhost:8090)`, or the circle's shared graph. */
|
|
474
537
|
export declare function describeGraphTarget(t: GraphTarget): string;
|
|
538
|
+
/** A target with, for a local one, why: the one wording `p2p project show|ls` and `p2p doctor` print. */
|
|
539
|
+
export declare function graphTargetLine(t: GraphTarget): string;
|
|
540
|
+
/** Who can read what a graph target holds: Ix keeps it in plaintext (docs/security/encryption.md). */
|
|
541
|
+
export declare function graphPlaintextNote(t: GraphTarget): string;
|
|
475
542
|
/**
|
|
476
543
|
* The Ix variables that could send an `ix` call somewhere other than its graph target, or carry a
|
|
477
544
|
* cloud credential: Ix Pro's PAT mode (IX_PAT, IX_ORG, its endpoint override), the cloud push and
|