pinecall 0.3.0 → 0.3.1
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/config.d.ts.map +1 -1
- package/dist/cli/config.js +30 -7
- package/dist/cli/config.js.map +1 -1
- package/dist/cli/env.d.ts +4 -4
- package/dist/cli/env.d.ts.map +1 -1
- package/dist/cli/env.js +11 -8
- package/dist/cli/env.js.map +1 -1
- package/dist/cli/gateway.d.ts +12 -0
- package/dist/cli/gateway.d.ts.map +1 -0
- package/dist/cli/gateway.js +63 -0
- package/dist/cli/gateway.js.map +1 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +6 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/login.d.ts +1 -1
- package/dist/cli/login.d.ts.map +1 -1
- package/dist/cli/login.js +87 -10
- package/dist/cli/login.js.map +1 -1
- package/dist/cli/profiles.d.ts +24 -2
- package/dist/cli/profiles.d.ts.map +1 -1
- package/dist/cli/profiles.js +36 -0
- package/dist/cli/profiles.js.map +1 -1
- package/dist/cli/signup.d.ts.map +1 -1
- package/dist/cli/signup.js +7 -3
- package/dist/cli/signup.js.map +1 -1
- package/dist/cli/ui/console/assets/index-C7LdwphQ.css +1 -0
- package/dist/cli/ui/console/assets/index-DTMBzpRG.js +102 -0
- package/dist/cli/ui/console/favicon.png +0 -0
- package/dist/cli/ui/console/index.html +4 -4
- package/dist/cli/ui/console/pinecall-logo.png +0 -0
- package/dist/cli/ui/console/pinecall-mark.png +0 -0
- package/package.json +2 -2
- package/dist/cli/ui/console/assets/index-BUlGAwqn.css +0 -1
- package/dist/cli/ui/console/assets/index-D9StTnoH.js +0 -102
package/dist/cli/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/cli/config.ts"],"names":[],"mappings":"AAAA,uGAAuG;AAEvG,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAY,UAAU,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/cli/config.ts"],"names":[],"mappings":"AAAA,uGAAuG;AAEvG,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAY,UAAU,EAAyD,MAAM,eAAe,CAAC;AAO5G,eAAO,MAAM,KAAK,EAAE,KAgBnB,CAAC;AAEF,8FAA8F;AAC9F,MAAM,WAAW,OAAO;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC,cAAc,CAAC;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC,cAAc,CAAC;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,mFAAmF;AACnF,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,GAAE,OAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAQ5E;AAED,6EAA6E;AAC7E,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,GAAE,OAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAO5E;AAsFD,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
package/dist/cli/config.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
/** `pinecall config` and `pinecall use`: the gateways this machine knows, and which one is in hand. */
|
|
2
|
-
import { activate, activeName, forget, readConfig } from "./profiles.js";
|
|
2
|
+
import { activate, activeName, forget, inWorld, readConfig } from "./profiles.js";
|
|
3
3
|
const USAGE = `usage: pinecall config the gateways this machine knows
|
|
4
4
|
pinecall config rm <name> forget one
|
|
5
|
-
pinecall use <
|
|
5
|
+
pinecall use <org> the org the next verb goes to
|
|
6
|
+
pinecall use <org> <world> and the world: sandbox, or production`;
|
|
6
7
|
export const group = {
|
|
7
8
|
purpose: "the gateways this machine knows, and which one the next verb goes to",
|
|
8
9
|
usage: `${USAGE}
|
|
9
10
|
|
|
10
|
-
One file — ~/.pinecall/config.json — holds them, and \`pinecall login\` writes one per
|
|
11
|
-
|
|
11
|
+
One file — ~/.pinecall/config.json — holds them, and \`pinecall login\` writes one per ORG you
|
|
12
|
+
belong to, with your key in both of its worlds. Nothing is exported, and there is no order of precedence to remember: the
|
|
12
13
|
profile with the ▸ is the one every verb uses until \`pinecall use\` moves it.
|
|
13
14
|
|
|
14
15
|
It prints no key. What a listing may say about one is that it is there, and its fingerprint is
|
|
@@ -29,6 +30,8 @@ export async function run(argv, how = {}) {
|
|
|
29
30
|
return listed(out, how.home);
|
|
30
31
|
if (named === "rm")
|
|
31
32
|
return dropped(rest[0], out, err, how.home);
|
|
33
|
+
if (rest[0] !== undefined)
|
|
34
|
+
return moved(named, rest[0], out, err, how.home);
|
|
32
35
|
return chosen(named, out, err, how.home);
|
|
33
36
|
}
|
|
34
37
|
/** The same verb under the name a person reaches for: `pinecall use box`. */
|
|
@@ -44,7 +47,7 @@ function listed(out, home) {
|
|
|
44
47
|
const config = readConfig(home);
|
|
45
48
|
const names = Object.keys(config.profiles).sort();
|
|
46
49
|
if (names.length === 0) {
|
|
47
|
-
out.write("no gateway yet: `pinecall login
|
|
50
|
+
out.write("no gateway yet: `pinecall login`\n");
|
|
48
51
|
return 0;
|
|
49
52
|
}
|
|
50
53
|
const rows = names.map((name) => [
|
|
@@ -74,16 +77,36 @@ function chosen(name, out, err, home) {
|
|
|
74
77
|
}
|
|
75
78
|
return noSuchProfile(name, err, home);
|
|
76
79
|
}
|
|
80
|
+
// One login keeps both worlds' keys, so this is a line in a file and never a trip to the gateway.
|
|
81
|
+
function moved(name, world, out, err, home) {
|
|
82
|
+
if (world !== "sandbox" && world !== "production") {
|
|
83
|
+
err.write(`a world is sandbox or production, not ${world}\n`);
|
|
84
|
+
return 2;
|
|
85
|
+
}
|
|
86
|
+
const answer = inWorld(name, world, home);
|
|
87
|
+
if (answer === "unknown")
|
|
88
|
+
return noSuchProfile(name, err, home);
|
|
89
|
+
if (answer === "nokey") {
|
|
90
|
+
err.write(`${name} holds no ${world} key: \`pinecall login\` again keeps both worlds\n`);
|
|
91
|
+
return 2;
|
|
92
|
+
}
|
|
93
|
+
out.write(`▸ ${name} · ${world}\n`);
|
|
94
|
+
if (world === "production")
|
|
95
|
+
out.write(" you look at production from here; what answers its numbers is the box's own key\n");
|
|
96
|
+
return 0;
|
|
97
|
+
}
|
|
77
98
|
/** The one refusal both `use` and `rm` give, naming what this machine does know. */
|
|
78
99
|
function noSuchProfile(name, err, home) {
|
|
79
100
|
const known = Object.keys(readConfig(home).profiles).sort();
|
|
80
|
-
const has = known.length === 0 ? "none yet: `pinecall login
|
|
101
|
+
const has = known.length === 0 ? "none yet: `pinecall login`" : known.join(" · ");
|
|
81
102
|
err.write(`no profile called ${name}: ${has}\n`);
|
|
82
103
|
return 2;
|
|
83
104
|
}
|
|
84
105
|
/** Whose org and which world, as the gateway last said them. A label, never a check. */
|
|
85
106
|
function said(profile) {
|
|
86
|
-
|
|
107
|
+
const other = profile.env === "production" ? "sandbox" : "production";
|
|
108
|
+
const world = profile.env !== undefined && profile.keys?.[other] !== undefined ? `${profile.env} (and ${other})` : profile.env;
|
|
109
|
+
return [profile.org, world].filter((word) => word !== undefined).join(" · ");
|
|
87
110
|
}
|
|
88
111
|
/** Every column as wide as its widest value: nothing is cut to make a table line up. */
|
|
89
112
|
function asColumns(rows) {
|
package/dist/cli/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/cli/config.ts"],"names":[],"mappings":"AAAA,uGAAuG;AAGvG,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/cli/config.ts"],"names":[],"mappings":"AAAA,uGAAuG;AAGvG,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAA4B,MAAM,eAAe,CAAC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,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACvG,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;AACnH,CAAC;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
package/dist/cli/env.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/** Where the CLI is pointed and what opens the door: the one place that decides both, for every verb. */
|
|
2
|
-
/**
|
|
3
|
-
export declare const DEFAULT_URL = "http://localhost:8080";
|
|
4
|
-
/** Pinecall's own cloud: where `pinecall signup` makes an org when no other gateway is named. */
|
|
2
|
+
/** Pinecall's own cloud: where every verb goes until `pinecall gateway <url>` says otherwise. */
|
|
5
3
|
export declare const CLOUD_URL = "https://box.pinecall.io";
|
|
4
|
+
/** The gateway a developer runs on their own machine: what `pinecall gateway` is for. */
|
|
5
|
+
export declare const OWN_BOX_URL = "http://localhost:8080";
|
|
6
6
|
/** Where the key came from, so a verb can say it and a person can check it without grepping. */
|
|
7
7
|
export type Source = "profile" | "none";
|
|
8
8
|
/** What the resolution found: the gateway, the key if there is one, and where the key came from. */
|
|
@@ -33,7 +33,7 @@ export interface Open {
|
|
|
33
33
|
export declare function doorFrom(env?: NodeJS.ProcessEnv, home?: string, profile?: string | undefined): Found;
|
|
34
34
|
/** The gateway a verb knocks at, or nothing once it has said why it cannot: every verb's first act. */
|
|
35
35
|
export declare function theDoor(env?: NodeJS.ProcessEnv, err?: NodeJS.WritableStream): Open | undefined;
|
|
36
|
-
/** What to say when this machine
|
|
36
|
+
/** What to say when this machine holds no key: the verb that fixes it, and where it would go. */
|
|
37
37
|
export declare function noKey(url: string): string;
|
|
38
38
|
/** The first line a verb that connects prints: which gateway, and where its key was found. */
|
|
39
39
|
export declare function doorLine(door: Open): string;
|
package/dist/cli/env.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/cli/env.ts"],"names":[],"mappings":"AAAA,yGAAyG;AAKzG
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/cli/env.ts"],"names":[],"mappings":"AAAA,yGAAyG;AAKzG,iGAAiG;AACjG,eAAO,MAAM,SAAS,4BAA4B,CAAC;AAEnD,yFAAyF;AACzF,eAAO,MAAM,WAAW,0BAA0B,CAAC;AAEnD,gGAAgG;AAChG,MAAM,MAAM,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC;AAExC,oGAAoG;AACpG,MAAM,WAAW,KAAK;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,kFAAkF;AAClF,MAAM,WAAW,IAAI;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,QAAQ,CACtB,GAAG,GAAE,MAAM,CAAC,UAAwB,EACpC,IAAI,GAAE,MAA0B,EAChC,OAAO,GAAE,MAAM,GAAG,SAA8B,GAC/C,KAAK,CAOP;AAED,uGAAuG;AACvG,wBAAgB,OAAO,CACrB,GAAG,GAAE,MAAM,CAAC,UAAwB,EACpC,GAAG,GAAE,MAAM,CAAC,cAA+B,GAC1C,IAAI,GAAG,SAAS,CAOlB;AAED,iGAAiG;AACjG,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAKzC;AAED,8FAA8F;AAC9F,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAE3C"}
|
package/dist/cli/env.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/** Where the CLI is pointed and what opens the door: the one place that decides both, for every verb. */
|
|
2
2
|
import { pinecallHome } from "./credentials.js";
|
|
3
|
-
import { profileFor, theChosenProfile } from "./profiles.js";
|
|
4
|
-
/**
|
|
5
|
-
export const DEFAULT_URL = "http://localhost:8080";
|
|
6
|
-
/** Pinecall's own cloud: where `pinecall signup` makes an org when no other gateway is named. */
|
|
3
|
+
import { chosenGateway, profileFor, theChosenProfile } from "./profiles.js";
|
|
4
|
+
/** Pinecall's own cloud: where every verb goes until `pinecall gateway <url>` says otherwise. */
|
|
7
5
|
export const CLOUD_URL = "https://box.pinecall.io";
|
|
6
|
+
/** The gateway a developer runs on their own machine: what `pinecall gateway` is for. */
|
|
7
|
+
export const OWN_BOX_URL = "http://localhost:8080";
|
|
8
8
|
/**
|
|
9
9
|
* Which gateway and which key: one profile, and there is nothing else.
|
|
10
10
|
*
|
|
@@ -20,8 +20,11 @@ export const CLOUD_URL = "https://box.pinecall.io";
|
|
|
20
20
|
*/
|
|
21
21
|
export function doorFrom(env = process.env, home = pinecallHome(env), profile = theChosenProfile()) {
|
|
22
22
|
const chosen = profileFor(profile, home);
|
|
23
|
+
// No profile yet: the gateway is whichever this machine was pointed at, and the cloud until
|
|
24
|
+
// somebody points it elsewhere. A localhost default sent every first verb at a box that is not
|
|
25
|
+
// running, and the refusal read as the CLI being broken.
|
|
23
26
|
if (chosen === undefined)
|
|
24
|
-
return { url:
|
|
27
|
+
return { url: chosenGateway(home) ?? CLOUD_URL, apiKey: undefined, source: "none" };
|
|
25
28
|
return { url: chosen.url, apiKey: chosen.key, source: "profile" };
|
|
26
29
|
}
|
|
27
30
|
/** The gateway a verb knocks at, or nothing once it has said why it cannot: every verb's first act. */
|
|
@@ -33,10 +36,10 @@ export function theDoor(env = process.env, err = process.stderr) {
|
|
|
33
36
|
}
|
|
34
37
|
return { url: found.url, apiKey: found.apiKey, source: found.source };
|
|
35
38
|
}
|
|
36
|
-
/** What to say when this machine
|
|
39
|
+
/** What to say when this machine holds no key: the verb that fixes it, and where it would go. */
|
|
37
40
|
export function noKey(url) {
|
|
38
|
-
return (`
|
|
39
|
-
+ " (`pinecall config` lists them)");
|
|
41
|
+
return (`not signed in to ${url}: \`pinecall login\`, \`pinecall gateway <url>\` for another gateway,`
|
|
42
|
+
+ " or `pinecall use <profile>` for one already kept (`pinecall config` lists them)");
|
|
40
43
|
}
|
|
41
44
|
/** The first line a verb that connects prints: which gateway, and where its key was found. */
|
|
42
45
|
export function doorLine(door) {
|
package/dist/cli/env.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/cli/env.ts"],"names":[],"mappings":"AAAA,yGAAyG;AAEzG,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/cli/env.ts"],"names":[],"mappings":"AAAA,yGAAyG;AAEzG,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAE5E,iGAAiG;AACjG,MAAM,CAAC,MAAM,SAAS,GAAG,yBAAyB,CAAC;AAEnD,yFAAyF;AACzF,MAAM,CAAC,MAAM,WAAW,GAAG,uBAAuB,CAAC;AAmBnD;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,QAAQ,CACtB,GAAG,GAAsB,OAAO,CAAC,GAAG,EACpC,IAAI,GAAW,YAAY,CAAC,GAAG,CAAC,EAChC,OAAO,GAAuB,gBAAgB,EAAE;IAEhD,MAAM,MAAM,GAAG,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACzC,4FAA4F;IAC5F,+FAA+F;IAC/F,yDAAyD;IACzD,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,EAAE,GAAG,EAAE,aAAa,CAAC,IAAI,CAAC,IAAI,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAC9G,OAAO,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;AACpE,CAAC;AAED,uGAAuG;AACvG,MAAM,UAAU,OAAO,CACrB,GAAG,GAAsB,OAAO,CAAC,GAAG,EACpC,GAAG,GAA0B,OAAO,CAAC,MAAM;IAE3C,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC5B,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QAC/B,GAAG,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACnC,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;AACxE,CAAC;AAED,iGAAiG;AACjG,MAAM,UAAU,KAAK,CAAC,GAAW;IAC/B,OAAO,CACL,oBAAoB,GAAG,uEAAuE;UAC5F,kFAAkF,CACrF,CAAC;AACJ,CAAC;AAED,8FAA8F;AAC9F,MAAM,UAAU,QAAQ,CAAC,IAAU;IACjC,OAAO,WAAW,IAAI,CAAC,GAAG,eAAe,IAAI,CAAC,MAAM,EAAE,CAAC;AACzD,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** `pinecall gateway [url]`: which gateway this machine talks to, and pointing it at another one. */
|
|
2
|
+
import type { Group } from "./groups.js";
|
|
3
|
+
export declare const group: Group;
|
|
4
|
+
/** What the verb can be told besides the argv. Tests only: where to print, and which home. */
|
|
5
|
+
export interface Pointing {
|
|
6
|
+
out?: NodeJS.WritableStream;
|
|
7
|
+
err?: NodeJS.WritableStream;
|
|
8
|
+
home?: string;
|
|
9
|
+
}
|
|
10
|
+
/** With nothing after it, where this machine is pointed; with a URL, point it there. */
|
|
11
|
+
export declare function run(argv: string[], how?: Pointing): number;
|
|
12
|
+
//# sourceMappingURL=gateway.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gateway.d.ts","sourceRoot":"","sources":["../../src/cli/gateway.ts"],"names":[],"mappings":"AAAA,qGAAqG;AAGrG,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAMzC,eAAO,MAAM,KAAK,EAAE,KAcnB,CAAC;AAEF,8FAA8F;AAC9F,MAAM,WAAW,QAAQ;IACvB,GAAG,CAAC,EAAE,MAAM,CAAC,cAAc,CAAC;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC,cAAc,CAAC;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wFAAwF;AACxF,wBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,GAAE,QAAa,GAAG,MAAM,CAmB9D"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/** `pinecall gateway [url]`: which gateway this machine talks to, and pointing it at another one. */
|
|
2
|
+
import { CLOUD_URL } from "./env.js";
|
|
3
|
+
import { chooseGateway, chosenGateway, nameFor, readConfig } from "./profiles.js";
|
|
4
|
+
const USAGE = `usage: pinecall gateway where this machine is pointed
|
|
5
|
+
pinecall gateway <url> point it at your own box, then \`pinecall login\``;
|
|
6
|
+
export const group = {
|
|
7
|
+
purpose: "which gateway this machine talks to, and pointing it at another",
|
|
8
|
+
usage: `${USAGE}
|
|
9
|
+
|
|
10
|
+
Every verb goes to ${CLOUD_URL} until this says otherwise, so a person who is on the cloud
|
|
11
|
+
types \`pinecall login\` and nothing else — no URL to remember, no URL to mistype.
|
|
12
|
+
|
|
13
|
+
Somebody running their own box says so ONCE, here, and every verb after it goes there: the
|
|
14
|
+
login, the signup, and any verb that runs before this machine holds a key. It is remembered in
|
|
15
|
+
~/.pinecall/config.json beside the profiles, and \`pinecall config\` prints which one is in hand.
|
|
16
|
+
|
|
17
|
+
An org you are already signed in to is a profile: \`pinecall use <org>\` moves between them
|
|
18
|
+
and this verb is not what you want. This one is for the gateway you have not signed in to yet.`,
|
|
19
|
+
run,
|
|
20
|
+
};
|
|
21
|
+
/** With nothing after it, where this machine is pointed; with a URL, point it there. */
|
|
22
|
+
export function run(argv, how = {}) {
|
|
23
|
+
const out = how.out ?? process.stdout;
|
|
24
|
+
const err = how.err ?? process.stderr;
|
|
25
|
+
const [named, ...rest] = argv;
|
|
26
|
+
if (rest.length > 0) {
|
|
27
|
+
err.write(`${USAGE}\n`);
|
|
28
|
+
return 2;
|
|
29
|
+
}
|
|
30
|
+
if (named === undefined)
|
|
31
|
+
return said(out, how.home);
|
|
32
|
+
const url = asAUrl(named);
|
|
33
|
+
if (url === null) {
|
|
34
|
+
err.write(`not a gateway URL: ${named} — it is the address of a box, like https://voz.clinica.com\n`);
|
|
35
|
+
return 2;
|
|
36
|
+
}
|
|
37
|
+
chooseGateway(url, how.home);
|
|
38
|
+
const known = readConfig(how.home).profiles[nameFor(url, readConfig(how.home))] !== undefined;
|
|
39
|
+
out.write(`▸ ${url}\n`);
|
|
40
|
+
out.write(known ? " signed in already: `pinecall use <org>` moves between them\n" : " `pinecall login` signs this machine in there\n");
|
|
41
|
+
return 0;
|
|
42
|
+
}
|
|
43
|
+
// Where the next verb goes, and where that answer came from: a person debugging a refusal reads
|
|
44
|
+
// this line first, and a "default" that looks chosen is how an hour goes missing.
|
|
45
|
+
function said(out, home) {
|
|
46
|
+
const chosen = chosenGateway(home);
|
|
47
|
+
out.write(chosen === undefined ? `▸ ${CLOUD_URL} (the default)\n` : `▸ ${chosen} (this machine's own)\n`);
|
|
48
|
+
return 0;
|
|
49
|
+
}
|
|
50
|
+
/** A URL a gateway could live at, or null. An address with no scheme is read as https. */
|
|
51
|
+
function asAUrl(said) {
|
|
52
|
+
const text = /^[a-z][a-z0-9+.-]*:\/\//i.test(said) ? said : `https://${said}`;
|
|
53
|
+
try {
|
|
54
|
+
const url = new URL(text);
|
|
55
|
+
if (url.protocol !== "http:" && url.protocol !== "https:")
|
|
56
|
+
return null;
|
|
57
|
+
return url.origin;
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=gateway.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gateway.js","sourceRoot":"","sources":["../../src/cli/gateway.ts"],"names":[],"mappings":"AAAA,qGAAqG;AAErG,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAElF,MAAM,KAAK,GAAG;uFACyE,CAAC;AAExF,MAAM,CAAC,MAAM,KAAK,GAAU;IAC1B,OAAO,EAAE,iEAAiE;IAC1E,KAAK,EAAE,GAAG,KAAK;;uBAEM,SAAS;;;;;;;;iGAQiE;IAC/F,GAAG;CACJ,CAAC;AASF,wFAAwF;AACxF,MAAM,UAAU,GAAG,CAAC,IAAc,EAAE,GAAG,GAAa,EAAE;IACpD,MAAM,GAAG,GAAG,GAAG,CAAC,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC;IACtC,MAAM,GAAG,GAAG,GAAG,CAAC,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC;IACtC,MAAM,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAC9B,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpB,GAAG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AI,CAAC,CAAC,CAAC,WAAW,IAAI,EAAE,CAAC;IAC9E,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC;QAC1B,IAAI,GAAG,CAAC,QAAQ,KAAK,OAAO,IAAI,GAAG,CAAC,QAAQ,KAAK,QAAQ;YAAE,OAAO,IAAI,CAAC;QACvE,OAAO,GAAG,CAAC,MAAM,CAAC;IACpB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
package/dist/cli/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AACA,gGAAgG;AAKhG,OAAO,EAAkC,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AAQzE,gGAAgG;AAChG,wBAAgB,UAAU,IAAI,MAAM,EAAE,CAErC;AAED,4FAA4F;AAC5F,wBAAgB,UAAU,IAAI,MAAM,EAAE,CAErC;AAED;;;GAGG;AACH,wBAAsB,IAAI,CACxB,IAAI,EAAE,MAAM,EAAE,EACd,GAAG,GAAE,MAAM,CAAC,cAA+B,EAC3C,GAAG,GAAE,MAAM,CAAC,cAA+B,GAC1C,OAAO,CAAC,MAAM,CAAC,CA6BjB;AAID,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,GAAE,MAAM,CAAC,cAA+B,GAAG,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AACA,gGAAgG;AAKhG,OAAO,EAAkC,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AAQzE,gGAAgG;AAChG,wBAAgB,UAAU,IAAI,MAAM,EAAE,CAErC;AAED,4FAA4F;AAC5F,wBAAgB,UAAU,IAAI,MAAM,EAAE,CAErC;AAED;;;GAGG;AACH,wBAAsB,IAAI,CACxB,IAAI,EAAE,MAAM,EAAE,EACd,GAAG,GAAE,MAAM,CAAC,cAA+B,EAC3C,GAAG,GAAE,MAAM,CAAC,cAA+B,GAC1C,OAAO,CAAC,MAAM,CAAC,CA6BjB;AAID,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,GAAE,MAAM,CAAC,cAA+B,GAAG,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC,CAkCpH;AAED,qGAAqG;AACrG,wBAAgB,KAAK,IAAI,MAAM,CAoC9B"}
|
package/dist/cli/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { withoutTheProfileFlag } from "./profiles.js";
|
|
|
7
7
|
// The order this table is written is the order the help prints: run and chat first, because
|
|
8
8
|
// they are what a person types on the first day, and the planned groups after, in the design's
|
|
9
9
|
// order. run is rails server and chat is rails console — see docs/decisions/tenant-cli.md.
|
|
10
|
-
const BUILT = ["run", "serve", "chat", "prompt", "test", "simulate", "eval", "sessions", "runs", "pipeline", "line", "numbers", "personas", "knowledge", "memory", "remember", "supervise", "keys", "providers", "callbacks", "signup", "login", "whoami", "config", "use"];
|
|
10
|
+
const BUILT = ["run", "serve", "chat", "prompt", "test", "simulate", "eval", "sessions", "runs", "pipeline", "line", "numbers", "personas", "knowledge", "memory", "remember", "supervise", "keys", "providers", "callbacks", "signup", "login", "whoami", "gateway", "config", "use"];
|
|
11
11
|
/** Everything `pinecall` answers to, built and planned alike, in the order help prints them. */
|
|
12
12
|
export function groupNames() {
|
|
13
13
|
return [...BUILT, ...Object.keys(PLANNED)];
|
|
@@ -98,6 +98,8 @@ export async function groupFor(name, out = process.stdout) {
|
|
|
98
98
|
return (await import("./signup.js")).group;
|
|
99
99
|
if (name === "login")
|
|
100
100
|
return (await import("./login.js")).group;
|
|
101
|
+
if (name === "gateway")
|
|
102
|
+
return (await import("./gateway.js")).group;
|
|
101
103
|
if (name === "whoami")
|
|
102
104
|
return (await import("./whoami.js")).group;
|
|
103
105
|
if (name === "config")
|
|
@@ -137,9 +139,10 @@ export function usage() {
|
|
|
137
139
|
" providers add | rm | list the provider keys this org brought of its own",
|
|
138
140
|
" callbacks the numbers people left when every seat was taken: who to call back",
|
|
139
141
|
" signup make an org on Pinecall's cloud and keep its first key",
|
|
140
|
-
" login sign in
|
|
142
|
+
" login sign in once; the key is kept as a profile in ~/.pinecall",
|
|
143
|
+
" gateway which gateway this machine talks to: box.pinecall.io until you point it elsewhere",
|
|
141
144
|
" config the gateways this machine knows, and which one the next verb goes to",
|
|
142
|
-
" use
|
|
145
|
+
" use another org of yours, or its other world: `pinecall use clinica production`",
|
|
143
146
|
" whoami which gateway, which org, which world, and where this terminal's key came from",
|
|
144
147
|
"",
|
|
145
148
|
];
|
package/dist/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AACA,gGAAgG;AAEhG,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAc,MAAM,aAAa,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAEtD,4FAA4F;AAC5F,+FAA+F;AAC/F,2FAA2F;AAC3F,MAAM,KAAK,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,CAAU,CAAC;
|
|
1
|
+
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AO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AACjC,CAAC;AAED;;;;;GAKG;AACH,SAAS,OAAO;IACd,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC9B,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACtC,IAAI,CAAC;QACH,OAAO,OAAO,IAAI,CAAC,GAAG,KAAK,aAAa,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;IACrE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,+FAA+F;AAC/F,IAAI,OAAO,EAAE,EAAE,CAAC;IACd,OAAO,CAAC,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACvD,CAAC"}
|
package/dist/cli/login.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export declare function login(argv: string[], how?: Signing): Promise<number>;
|
|
|
21
21
|
* who meant their own box has to be able to see that this one was assumed, in the line above the
|
|
22
22
|
* link, rather than discovering it in `pinecall whoami` tomorrow.
|
|
23
23
|
*/
|
|
24
|
-
export declare function theGateway(named: string | undefined): {
|
|
24
|
+
export declare function theGateway(named: string | undefined, home?: string): {
|
|
25
25
|
url: string;
|
|
26
26
|
assumed?: string;
|
|
27
27
|
};
|
package/dist/cli/login.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/cli/login.ts"],"names":[],"mappings":"AAAA,yGAAyG;AASzG,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAczC,eAAO,MAAM,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/cli/login.ts"],"names":[],"mappings":"AAAA,yGAAyG;AASzG,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAczC,eAAO,MAAM,KAAK,EAAE,KAwBnB,CAAC;AAEF,gGAAgG;AAChG,MAAM,WAAW,OAAO;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC,cAAc,CAAC;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC,cAAc,CAAC;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,+FAA+F;IAC/F,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,8FAA8F;IAC9F,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,qGAAqG;AACrG,wBAAsB,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,GAAE,OAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAyC9E;AAiHD;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAQtG;AAED,0FAA0F;AAC1F,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAE/D"}
|
package/dist/cli/login.js
CHANGED
|
@@ -3,12 +3,12 @@ import { hostname } from "node:os";
|
|
|
3
3
|
import { parseArgs } from "node:util";
|
|
4
4
|
import { openInABrowser } from "./browser.js";
|
|
5
5
|
import { pinecallHome, writeGateway } from "./credentials.js";
|
|
6
|
-
import { nameFor, readConfig, writeProfile } from "./profiles.js";
|
|
6
|
+
import { activate, chosenGateway, nameFor, nameForOrg, readConfig, writeProfile } from "./profiles.js";
|
|
7
7
|
import { CLOUD_URL } from "./env.js";
|
|
8
8
|
import { aLineOfStdin } from "./secret.js";
|
|
9
9
|
import { asked } from "./testing/gateway.js";
|
|
10
10
|
import { orgOf, refusal, whoIs } from "./whoami.js";
|
|
11
|
-
const USAGE = "usage: pinecall login [gateway-url] [--key-stdin]";
|
|
11
|
+
const USAGE = "usage: pinecall login [gateway-url] [--as <profile>] [--key-stdin]";
|
|
12
12
|
// How often the terminal asks, and for how long. The gateway's word lives ten minutes, so this
|
|
13
13
|
// gives up a little after it does rather than polling a word that cannot come back.
|
|
14
14
|
const EVERY_MS = 2_000;
|
|
@@ -23,10 +23,14 @@ export const group = {
|
|
|
23
23
|
it is revoked on its own from the Keys screen. Nothing types a password into a shell, and the
|
|
24
24
|
day your org signs in with Google this verb does not change.
|
|
25
25
|
|
|
26
|
-
With no URL it is
|
|
26
|
+
With no URL it is the gateway this machine is pointed at — ${CLOUD_URL} until \`pinecall gateway
|
|
27
|
+
<url>\` says otherwise — and it says which one out loud before anything is kept.
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
One login keeps everything you hold: a profile per org you belong to, named after the org,
|
|
30
|
+
each with your key in BOTH worlds. The sandbox one is in hand, so \`pinecall run\` and \`pinecall
|
|
31
|
+
chat\` answer in a world of your own and never in the one your customers call; \`pinecall use
|
|
32
|
+
<org>\` moves between orgs and \`pinecall use <org> production\` looks at production. --as keeps
|
|
33
|
+
ONE profile under a name of yours instead.
|
|
30
34
|
|
|
31
35
|
--key-stdin reads a KEY from one line of stdin instead, for a machine: a server, a CI job, a
|
|
32
36
|
container. That is what \`pinecall keys issue\` mints, and it writes the same profile — so a
|
|
@@ -44,7 +48,7 @@ export async function login(argv, how = {}) {
|
|
|
44
48
|
allowPositionals: true,
|
|
45
49
|
options: { "key-stdin": { type: "boolean", default: false }, as: { type: "string" } },
|
|
46
50
|
});
|
|
47
|
-
const { url, assumed } = theGateway(positionals[0]);
|
|
51
|
+
const { url, assumed } = theGateway(positionals[0], pinecallHome(how.env ?? process.env));
|
|
48
52
|
if (assumed !== undefined)
|
|
49
53
|
out.write(`${assumed}\n`);
|
|
50
54
|
const key = values["key-stdin"] === true ? (await aLineOfStdin()).trim() : await throughABrowser(url, how, out, err);
|
|
@@ -73,11 +77,81 @@ export async function login(argv, how = {}) {
|
|
|
73
77
|
// now, and `credentials` is what v1's CLI on this same machine still reads. The second write
|
|
74
78
|
// goes with the second half of this change.
|
|
75
79
|
const name = values.as ?? nameFor(url, readConfig(home));
|
|
76
|
-
|
|
80
|
+
const kept = await everyOrgOfTheirs({ url, apiKey: key }, who, values.as ?? name, values.as !== undefined, home);
|
|
77
81
|
writeGateway(url, { api_key: key, org: orgOf(who) }, home);
|
|
78
|
-
|
|
82
|
+
for (const line of kept)
|
|
83
|
+
out.write(`${line}\n`);
|
|
79
84
|
return 0;
|
|
80
85
|
}
|
|
86
|
+
// What a person held was ONE key: the sandbox of whichever org of theirs was oldest. A second org,
|
|
87
|
+
// or a look at production, meant logging in again with a flag nobody could guess. The gateway
|
|
88
|
+
// mints the rest from the key in hand (POST /v1/login/org, POST /v1/login/env), so the login does
|
|
89
|
+
// it here, once: a profile per org, both worlds in each, and `pinecall use` is the whole of moving.
|
|
90
|
+
/** Every org this key's person belongs to, kept as a profile each, with the keys of both worlds. */
|
|
91
|
+
async function everyOrgOfTheirs(door, who, fallback, named, home) {
|
|
92
|
+
const world = who.env;
|
|
93
|
+
// `--as` names ONE profile, and a machine key names nobody: both keep exactly the key in hand.
|
|
94
|
+
const mine = named ? [] : await theirOrgs(door);
|
|
95
|
+
if (mine.length === 0) {
|
|
96
|
+
const keys = await bothWorlds(door, world);
|
|
97
|
+
writeProfile(fallback, { url: door.url, key: door.apiKey, keys, org: orgOf(who), env: who.env }, home);
|
|
98
|
+
return [`▸ ${fallback} · ${door.url} · org ${orgOf(who)} · ${worldsIn(keys, world)}`];
|
|
99
|
+
}
|
|
100
|
+
const said = [];
|
|
101
|
+
let here;
|
|
102
|
+
for (const org of mine) {
|
|
103
|
+
const key = org.here ? door.apiKey : await inThatOrg(door, org.org);
|
|
104
|
+
if (key === null)
|
|
105
|
+
continue;
|
|
106
|
+
const name = nameForOrg(org.slug ?? org.org, door.url, readConfig(home));
|
|
107
|
+
const keys = await bothWorlds({ url: door.url, apiKey: key }, world);
|
|
108
|
+
writeProfile(name, { url: door.url, key, keys, org: org.slug ?? org.org, env: who.env }, home);
|
|
109
|
+
if (org.here)
|
|
110
|
+
here = name;
|
|
111
|
+
said.push(`${org.here ? "▸" : " "} ${name} · ${door.url} · ${worldsIn(keys, world)}`);
|
|
112
|
+
}
|
|
113
|
+
// The org they signed in to is the one in hand; the rest are a `pinecall use` away.
|
|
114
|
+
if (here !== undefined)
|
|
115
|
+
activate(here, home);
|
|
116
|
+
if (said.length > 1)
|
|
117
|
+
said.push(" `pinecall use <org>` moves between them; `pinecall use <org> production` looks at production");
|
|
118
|
+
return said;
|
|
119
|
+
}
|
|
120
|
+
/** The orgs the person holds a key in, or none for a machine key and for a gateway without the door. */
|
|
121
|
+
async function theirOrgs(door) {
|
|
122
|
+
try {
|
|
123
|
+
return (await asked(door, "/v1/login/orgs", { method: "GET" })).orgs.filter((org) => org.member !== false);
|
|
124
|
+
}
|
|
125
|
+
catch {
|
|
126
|
+
return [];
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/** The same person's key in another org of theirs, or null when the gateway would not mint one. */
|
|
130
|
+
async function inThatOrg(door, org) {
|
|
131
|
+
try {
|
|
132
|
+
return (await asked(door, "/v1/login/org", { method: "POST", body: { org } })).key;
|
|
133
|
+
}
|
|
134
|
+
catch {
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
/** This key and its sibling in the other world, when the gateway mints one for this person. */
|
|
139
|
+
async function bothWorlds(door, world) {
|
|
140
|
+
const other = world === "sandbox" ? "production" : "sandbox";
|
|
141
|
+
const keys = { [world]: door.apiKey };
|
|
142
|
+
try {
|
|
143
|
+
keys[other] = (await asked(door, "/v1/login/env", { method: "POST", body: { env: other } })).key;
|
|
144
|
+
}
|
|
145
|
+
catch {
|
|
146
|
+
// A machine key opens one world and may not mint the other: the profile holds what there is.
|
|
147
|
+
}
|
|
148
|
+
return keys;
|
|
149
|
+
}
|
|
150
|
+
// The world in hand first and marked, so the line reads as where the next verb goes.
|
|
151
|
+
function worldsIn(keys, inHand) {
|
|
152
|
+
const other = inHand === "sandbox" ? "production" : "sandbox";
|
|
153
|
+
return keys[other] === undefined ? inHand : `${inHand} (and ${other})`;
|
|
154
|
+
}
|
|
81
155
|
/**
|
|
82
156
|
* The dance: a word this terminal asks for, a link the person opens, and the key left behind.
|
|
83
157
|
*
|
|
@@ -110,12 +184,15 @@ async function throughABrowser(url, how, out, err) {
|
|
|
110
184
|
* who meant their own box has to be able to see that this one was assumed, in the line above the
|
|
111
185
|
* link, rather than discovering it in `pinecall whoami` tomorrow.
|
|
112
186
|
*/
|
|
113
|
-
export function theGateway(named) {
|
|
187
|
+
export function theGateway(named, home) {
|
|
114
188
|
if (named !== undefined)
|
|
115
189
|
return { url: named };
|
|
190
|
+
const chosen = chosenGateway(home);
|
|
191
|
+
if (chosen !== undefined)
|
|
192
|
+
return { url: chosen, assumed: `gateway ${chosen} (this machine's, from \`pinecall gateway\`)` };
|
|
116
193
|
return {
|
|
117
194
|
url: CLOUD_URL,
|
|
118
|
-
assumed: `gateway ${CLOUD_URL} (the default — \`pinecall
|
|
195
|
+
assumed: `gateway ${CLOUD_URL} (the default — \`pinecall gateway <url>\` for your own box)`,
|
|
119
196
|
};
|
|
120
197
|
}
|
|
121
198
|
/** Where the person signs this terminal in: the gateway's own page, carrying the word. */
|
package/dist/cli/login.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../src/cli/login.ts"],"names":[],"mappings":"AAAA,yGAAyG;AAEzG,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,cAAc,EAAE,MAAM,cA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IACpC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,KAAK,IAAI,UAAU,CAAC,CAAC;IACrD,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,EAAE,CAAC;QAC1B,IAAI,CAAC;YACH,yFAAyF;YACzF,6FAA6F;YAC7F,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAmB,IAAI,EAAE,sBAAsB,IAAI,MAAM,CAAC,CAAC;YACvF,IAAI,QAAQ,EAAE,GAAG,KAAK,SAAS;gBAAE,OAAO,QAAQ,CAAC,GAAG,CAAC;QACvD,CAAC;QAAC,OAAO,OAAO,EAAE,CAAC;YACjB,GAAG,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACnC,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAM,KAAK,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC;IACD,GAAG,CAAC,KAAK,CAAC,GAAG,aAAa,IAAI,CAAC,CAAC;IAChC,OAAO,IAAI,CAAC;AACd,CAAC;AAED,2FAA2F;AAC3F,SAAS,WAAW;IAClB,IAAI,CAAC;QACH,OAAO,QAAQ,EAAE,CAAC;IACpB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,SAAS,KAAK,CAAC,EAAU;IACvB,OAAO,IAAI,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;AACrD,CAAC"}
|
package/dist/cli/profiles.d.ts
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
/** ~/.pinecall/config.json: the gateways this machine knows, by name, and which one is in hand. */
|
|
2
|
-
/**
|
|
2
|
+
/** The two worlds of an org, as a profile names them. */
|
|
3
|
+
export type World = "sandbox" | "production";
|
|
4
|
+
/** The same person's key in each world of one org, as the login minted them. */
|
|
5
|
+
export type Keys = Partial<Record<World, string>>;
|
|
6
|
+
/** One org on one gateway: where it is, the keys that open it, and which world is in hand. */
|
|
3
7
|
export interface Profile {
|
|
4
8
|
url: string;
|
|
9
|
+
/** The key every verb uses: the one of the world `env` names. */
|
|
5
10
|
key: string;
|
|
11
|
+
/** Both worlds' keys, so moving between them is `pinecall use` and never a second login. */
|
|
12
|
+
keys?: Keys;
|
|
6
13
|
/** The org the key belongs to, as `whoami` last said it. A label, never a check. */
|
|
7
14
|
org?: string;
|
|
8
15
|
/** The world it opens, likewise: printed, never trusted over what the gateway says. */
|
|
@@ -10,9 +17,11 @@ export interface Profile {
|
|
|
10
17
|
/** The phone this person calls FROM, so a ring in the sandbox reaches their own agent. */
|
|
11
18
|
calling?: string;
|
|
12
19
|
}
|
|
13
|
-
/** The file: every profile by name,
|
|
20
|
+
/** The file: every profile by name, the one a verb uses when nobody names another, and the gateway this machine was pointed at. */
|
|
14
21
|
export interface Config {
|
|
15
22
|
active?: string;
|
|
23
|
+
/** Where `pinecall login` goes when nobody names a URL: `pinecall gateway <url>` writes it. */
|
|
24
|
+
gateway?: string;
|
|
16
25
|
profiles: Record<string, Profile>;
|
|
17
26
|
}
|
|
18
27
|
/**
|
|
@@ -37,12 +46,25 @@ export declare function withoutTheProfileFlag(argv: readonly string[]): string[]
|
|
|
37
46
|
export declare function theChosenProfile(): string | undefined;
|
|
38
47
|
/** The profile a verb runs on: the one named, or the active one, or nothing at all. */
|
|
39
48
|
export declare function profileFor(named: string | undefined, home?: string): Profile | undefined;
|
|
49
|
+
/** The gateway this machine was pointed at, or nothing — and then it is the cloud's. */
|
|
50
|
+
export declare function chosenGateway(home?: string): string | undefined;
|
|
51
|
+
/** Point this machine at a gateway, so `pinecall login` and every verb with no key go there. */
|
|
52
|
+
export declare function chooseGateway(url: string, home?: string): void;
|
|
40
53
|
/** Which profile is in hand, for a line that says where a verb is about to go. */
|
|
41
54
|
export declare function activeName(home?: string): string | undefined;
|
|
42
55
|
/** Keep one profile and make it the active one: what `pinecall login` does when it has a key. */
|
|
43
56
|
export declare function writeProfile(name: string, profile: Profile, home?: string): void;
|
|
44
57
|
/** Make a profile that is already there the active one. False when there is no such name. */
|
|
45
58
|
export declare function activate(name: string, home?: string): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Move a profile to one of its worlds, with the key the login already minted for it.
|
|
61
|
+
*
|
|
62
|
+
* A person holds a key in each world of an org, and used to hold only the sandbox one: looking at
|
|
63
|
+
* production from a terminal meant a second profile nobody knew how to make.
|
|
64
|
+
*/
|
|
65
|
+
export declare function inWorld(name: string, world: World, home?: string): "moved" | "unknown" | "nokey";
|
|
66
|
+
/** A name for an org's profile: its slug, and the gateway's host beside it when another gateway took the slug. */
|
|
67
|
+
export declare function nameForOrg(slug: string, url: string, config: Config): string;
|
|
46
68
|
/**
|
|
47
69
|
* Forget a gateway. False when there is no such name, so a typo is never silence.
|
|
48
70
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profiles.d.ts","sourceRoot":"","sources":["../../src/cli/profiles.ts"],"names":[],"mappings":"AAAA,mGAAmG;AAanG,
|
|
1
|
+
{"version":3,"file":"profiles.d.ts","sourceRoot":"","sources":["../../src/cli/profiles.ts"],"names":[],"mappings":"AAAA,mGAAmG;AAanG,yDAAyD;AACzD,MAAM,MAAM,KAAK,GAAG,SAAS,GAAG,YAAY,CAAC;AAE7C,gFAAgF;AAChF,MAAM,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;AAElD,8FAA8F;AAC9F,MAAM,WAAW,OAAO;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,iEAAiE;IACjE,GAAG,EAAE,MAAM,CAAC;IACZ,4FAA4F;IAC5F,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,oFAAoF;IACpF,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,uFAAuF;IACvF,GAAG,CAAC,EAAE,MAAM,CAAC;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