@stigmer/cli 0.1.2 → 0.2.0
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/auth/browser.d.ts +7 -0
- package/auth/browser.d.ts.map +1 -0
- package/auth/browser.js +49 -0
- package/auth/browser.js.map +1 -0
- package/auth/callback-server.d.ts +8 -3
- package/auth/callback-server.d.ts.map +1 -1
- package/auth/callback-server.js +53 -19
- package/auth/callback-server.js.map +1 -1
- package/auth/device.d.ts +23 -0
- package/auth/device.d.ts.map +1 -0
- package/auth/device.js +119 -0
- package/auth/device.js.map +1 -0
- package/auth/index.d.ts +4 -3
- package/auth/index.d.ts.map +1 -1
- package/auth/index.js +4 -3
- package/auth/index.js.map +1 -1
- package/auth/login.d.ts +49 -1
- package/auth/login.d.ts.map +1 -1
- package/auth/login.js +161 -51
- package/auth/login.js.map +1 -1
- package/auth/oidc.d.ts +67 -0
- package/auth/oidc.d.ts.map +1 -0
- package/auth/oidc.js +213 -0
- package/auth/oidc.js.map +1 -0
- package/auth/token.d.ts +17 -23
- package/auth/token.d.ts.map +1 -1
- package/auth/token.js +51 -60
- package/auth/token.js.map +1 -1
- package/client/client.d.ts.map +1 -1
- package/client/client.js +4 -1
- package/client/client.js.map +1 -1
- package/client/current-organization.d.ts +5 -0
- package/client/current-organization.d.ts.map +1 -0
- package/client/current-organization.js +15 -0
- package/client/current-organization.js.map +1 -0
- package/commands/apikey/index.d.ts +16 -1
- package/commands/apikey/index.d.ts.map +1 -1
- package/commands/apikey/index.js +81 -0
- package/commands/apikey/index.js.map +1 -1
- package/commands/app-handover.d.ts +17 -0
- package/commands/app-handover.d.ts.map +1 -0
- package/commands/app-handover.js +155 -0
- package/commands/app-handover.js.map +1 -0
- package/commands/auth/index.d.ts.map +1 -1
- package/commands/auth/index.js +15 -9
- package/commands/auth/index.js.map +1 -1
- package/commands/auth/login.d.ts +7 -2
- package/commands/auth/login.d.ts.map +1 -1
- package/commands/auth/login.js +26 -23
- package/commands/auth/login.js.map +1 -1
- package/commands/auth/whoami.d.ts +5 -0
- package/commands/auth/whoami.d.ts.map +1 -1
- package/commands/auth/whoami.js +13 -1
- package/commands/auth/whoami.js.map +1 -1
- package/commands/coding-agent.d.ts +5 -0
- package/commands/coding-agent.d.ts.map +1 -0
- package/commands/coding-agent.js +30 -0
- package/commands/coding-agent.js.map +1 -0
- package/commands/config/backend.js +20 -6
- package/commands/config/backend.js.map +1 -1
- package/commands/embedding.d.ts +28 -0
- package/commands/embedding.d.ts.map +1 -0
- package/commands/embedding.js +170 -0
- package/commands/embedding.js.map +1 -0
- package/commands/example.d.ts +13 -0
- package/commands/example.d.ts.map +1 -0
- package/commands/example.js +126 -0
- package/commands/example.js.map +1 -0
- package/commands/help.d.ts.map +1 -1
- package/commands/help.js +16 -3
- package/commands/help.js.map +1 -1
- package/commands/load-test/burst.d.ts +64 -0
- package/commands/load-test/burst.d.ts.map +1 -0
- package/commands/load-test/burst.js +202 -0
- package/commands/load-test/burst.js.map +1 -0
- package/commands/load-test/index.d.ts +37 -0
- package/commands/load-test/index.d.ts.map +1 -0
- package/commands/load-test/index.js +154 -0
- package/commands/load-test/index.js.map +1 -0
- package/commands/load-test/report.d.ts +98 -0
- package/commands/load-test/report.d.ts.map +1 -0
- package/commands/load-test/report.js +210 -0
- package/commands/load-test/report.js.map +1 -0
- package/commands/mcp-server.d.ts +3 -3
- package/commands/mcp-server.d.ts.map +1 -1
- package/commands/mcp-server.js +4 -4
- package/commands/mcp-server.js.map +1 -1
- package/commands/setup.d.ts +17 -0
- package/commands/setup.d.ts.map +1 -1
- package/commands/setup.js +71 -1
- package/commands/setup.js.map +1 -1
- package/commands/up.d.ts.map +1 -1
- package/commands/up.js +67 -9
- package/commands/up.js.map +1 -1
- package/commands/usage.d.ts +15 -0
- package/commands/usage.d.ts.map +1 -1
- package/commands/usage.js +52 -2
- package/commands/usage.js.map +1 -1
- package/config/config.d.ts +14 -7
- package/config/config.d.ts.map +1 -1
- package/config/config.js +5 -1
- package/config/config.js.map +1 -1
- package/config/index.d.ts +1 -1
- package/config/index.d.ts.map +1 -1
- package/config/index.js +1 -1
- package/config/index.js.map +1 -1
- package/config/resolve.d.ts +1 -1
- package/config/resolve.d.ts.map +1 -1
- package/config/resolve.js +6 -3
- package/config/resolve.js.map +1 -1
- package/errors/classify.d.ts.map +1 -1
- package/errors/classify.js +10 -1
- package/errors/classify.js.map +1 -1
- package/errors/cli-exit-error.d.ts +3 -1
- package/errors/cli-exit-error.d.ts.map +1 -1
- package/errors/cli-exit-error.js +6 -2
- package/errors/cli-exit-error.js.map +1 -1
- package/errors/handle.d.ts +32 -5
- package/errors/handle.d.ts.map +1 -1
- package/errors/handle.js +67 -8
- package/errors/handle.js.map +1 -1
- package/local/daemon/components.d.ts +28 -1
- package/local/daemon/components.d.ts.map +1 -1
- package/local/daemon/components.js +64 -2
- package/local/daemon/components.js.map +1 -1
- package/local/daemon/host.d.ts.map +1 -1
- package/local/daemon/host.js +6 -2
- package/local/daemon/host.js.map +1 -1
- package/local/daemon/launch.d.ts +12 -4
- package/local/daemon/launch.d.ts.map +1 -1
- package/local/daemon/launch.js +49 -16
- package/local/daemon/launch.js.map +1 -1
- package/local/daemon/types.d.ts +9 -1
- package/local/daemon/types.d.ts.map +1 -1
- package/local/key-check.d.ts +20 -0
- package/local/key-check.d.ts.map +1 -0
- package/local/key-check.js +45 -0
- package/local/key-check.js.map +1 -0
- package/local/model-key-step.d.ts +63 -0
- package/local/model-key-step.d.ts.map +1 -0
- package/local/model-key-step.js +133 -0
- package/local/model-key-step.js.map +1 -0
- package/local/setup/prompt.d.ts.map +1 -1
- package/local/setup/prompt.js +22 -18
- package/local/setup/prompt.js.map +1 -1
- package/local/setup/wizard.d.ts +10 -0
- package/local/setup/wizard.d.ts.map +1 -1
- package/local/setup/wizard.js +40 -17
- package/local/setup/wizard.js.map +1 -1
- package/local/state/lock.d.ts.map +1 -1
- package/local/state/lock.js +123 -36
- package/local/state/lock.js.map +1 -1
- package/local/state/pidfile.d.ts +4 -0
- package/local/state/pidfile.d.ts.map +1 -1
- package/local/state/pidfile.js +12 -3
- package/local/state/pidfile.js.map +1 -1
- package/package.json +12 -9
- package/program.d.ts.map +1 -1
- package/program.js +10 -0
- package/program.js.map +1 -1
- package/resources/get.js +1 -1
- package/resources/get.js.map +1 -1
- package/resources/run/stream.d.ts.map +1 -1
- package/resources/run/stream.js +2 -1
- package/resources/run/stream.js.map +1 -1
- package/resources/stream/render-plaintext.d.ts +3 -0
- package/resources/stream/render-plaintext.d.ts.map +1 -1
- package/resources/stream/render-plaintext.js +20 -2
- package/resources/stream/render-plaintext.js.map +1 -1
- package/resources/usage.d.ts +8 -0
- package/resources/usage.d.ts.map +1 -1
- package/resources/usage.js +37 -0
- package/resources/usage.js.map +1 -1
- package/runtime.d.ts +9 -0
- package/runtime.d.ts.map +1 -1
- package/runtime.js +12 -1
- package/runtime.js.map +1 -1
- package/src/auth/browser.ts +57 -0
- package/src/auth/callback-server.ts +58 -22
- package/src/auth/device.ts +151 -0
- package/src/auth/index.ts +4 -3
- package/src/auth/login.ts +243 -67
- package/src/auth/oidc.ts +270 -0
- package/src/auth/token.ts +53 -90
- package/src/client/client.ts +4 -1
- package/src/client/current-organization.ts +27 -0
- package/src/commands/apikey/index.ts +85 -0
- package/src/commands/app-handover.ts +188 -0
- package/src/commands/auth/index.ts +16 -10
- package/src/commands/auth/login.ts +30 -23
- package/src/commands/auth/whoami.ts +16 -1
- package/src/commands/coding-agent.ts +33 -0
- package/src/commands/config/backend.ts +20 -6
- package/src/commands/embedding.ts +209 -0
- package/src/commands/example.ts +146 -0
- package/src/commands/help.ts +16 -3
- package/src/commands/load-test/burst.ts +291 -0
- package/src/commands/load-test/index.ts +183 -0
- package/src/commands/load-test/report.ts +302 -0
- package/src/commands/mcp-server.ts +5 -5
- package/src/commands/setup.ts +76 -2
- package/src/commands/up.ts +76 -10
- package/src/commands/usage.ts +55 -2
- package/src/config/config.ts +18 -8
- package/src/config/index.ts +1 -0
- package/src/config/resolve.ts +5 -3
- package/src/errors/classify.ts +10 -1
- package/src/errors/cli-exit-error.ts +6 -2
- package/src/errors/handle.ts +74 -8
- package/src/local/daemon/components.ts +66 -2
- package/src/local/daemon/host.ts +6 -2
- package/src/local/daemon/launch.ts +51 -16
- package/src/local/daemon/types.ts +9 -1
- package/src/local/key-check.ts +61 -0
- package/src/local/model-key-step.ts +164 -0
- package/src/local/setup/prompt.ts +22 -18
- package/src/local/setup/wizard.ts +45 -18
- package/src/local/state/lock.ts +116 -35
- package/src/local/state/pidfile.ts +14 -3
- package/src/program.ts +10 -0
- package/src/resources/get.ts +1 -1
- package/src/resources/run/stream.ts +2 -1
- package/src/resources/stream/render-plaintext.ts +20 -2
- package/src/resources/usage.ts +42 -0
- package/src/runtime.ts +17 -1
- package/auth/auth0.d.ts +0 -19
- package/auth/auth0.d.ts.map +0 -1
- package/auth/auth0.js +0 -39
- package/auth/auth0.js.map +0 -1
- package/src/auth/auth0.ts +0 -43
|
@@ -138,7 +138,8 @@ async function runHeadless(deps: StreamDeps, renderer: HeadlessRenderer): Promis
|
|
|
138
138
|
|
|
139
139
|
try {
|
|
140
140
|
return await runHeadlessStream({
|
|
141
|
-
|
|
141
|
+
// Liveness for the one line a wait for a sandbox writes (render-plaintext.ts).
|
|
142
|
+
follow: (signal) => followSession(deps.client, deps.sessionId, { signal, previews: ["stigmer.run.liveness"] }),
|
|
142
143
|
answer: (toolUseId, answer) => submitAnswer(deps.client, deps.sessionId, toolUseId, answer),
|
|
143
144
|
approveDefault: deps.approveDefault,
|
|
144
145
|
renderer,
|
|
@@ -9,11 +9,13 @@
|
|
|
9
9
|
// console reads), a subagent's start and
|
|
10
10
|
// end with its tool uses indented beneath (its task call's line, once the
|
|
11
11
|
// call returns, carries its span: "✓ task (1m 4s)"), the platform's notes, a context
|
|
12
|
-
// compaction, the turn's errors,
|
|
12
|
+
// compaction, the turn's errors, how each ask was answered, and one line
|
|
13
|
+
// each time the turn starts waiting for a sandbox with room ("… Waiting
|
|
14
|
+
// for a sandbox", from the turn's liveness, which the stream asks for). No ANSI, no
|
|
13
15
|
// frames. Each fold is compared with the last by reference, so a turn no event
|
|
14
16
|
// touched is not walked again, and everything already written stays written.
|
|
15
17
|
|
|
16
|
-
import { backgroundEndingLine, extractShellIntent, formatElapsed, type SessionFold, type ToolUse, type Turn, type TurnItem } from "@stigmer/client";
|
|
18
|
+
import { backgroundEndingLine, extractShellIntent, formatElapsed, SANDBOX_WAIT_PHRASE, type SessionFold, type ToolUse, type Turn, type TurnItem } from "@stigmer/client";
|
|
17
19
|
import { answerWord, type ApproveDefault, type AskAnswer } from "./answer.js";
|
|
18
20
|
import type { HeadlessRenderer } from "./headless.js";
|
|
19
21
|
import type { LineWriter } from "./render-ndjson.js";
|
|
@@ -34,6 +36,8 @@ export class PlaintextRenderer implements HeadlessRenderer {
|
|
|
34
36
|
private readonly toolStates = new Map<string, string>();
|
|
35
37
|
private readonly backgroundStates = new Map<string, string>();
|
|
36
38
|
private readonly threadStates = new Map<string, string>();
|
|
39
|
+
/** The runs whose turn waits for a sandbox now, so a wait's line is written once, at its start. */
|
|
40
|
+
private readonly waitingForSandbox = new Set<string>();
|
|
37
41
|
|
|
38
42
|
constructor(private readonly opts: PlaintextRendererOptions) {}
|
|
39
43
|
|
|
@@ -57,12 +61,26 @@ export class PlaintextRenderer implements HeadlessRenderer {
|
|
|
57
61
|
if (message !== undefined && this.once(message.id)) {
|
|
58
62
|
this.opts.status.write(`\n> ${message.text}\n\n`);
|
|
59
63
|
}
|
|
64
|
+
this.renderSandboxWait(turn);
|
|
60
65
|
this.renderItems(turn.items, "", true);
|
|
61
66
|
for (const error of turn.errors) {
|
|
62
67
|
if (this.once(error.id)) this.opts.status.write(` ✗ ${error.message}\n`);
|
|
63
68
|
}
|
|
64
69
|
}
|
|
65
70
|
|
|
71
|
+
// A wait for a sandbox is said once when it starts; a later wait of the
|
|
72
|
+
// same turn (after a pause, or run again) is said again.
|
|
73
|
+
private renderSandboxWait(turn: Turn): void {
|
|
74
|
+
const waiting = !turn.ended && turn.liveness?.awaitingSandboxMs !== undefined;
|
|
75
|
+
if (!waiting) {
|
|
76
|
+
this.waitingForSandbox.delete(turn.runId);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
if (this.waitingForSandbox.has(turn.runId)) return;
|
|
80
|
+
this.waitingForSandbox.add(turn.runId);
|
|
81
|
+
this.opts.status.write(` … ${SANDBOX_WAIT_PHRASE}\n`);
|
|
82
|
+
}
|
|
83
|
+
|
|
66
84
|
// The primary thread's messages are the answer and go to stdout; a
|
|
67
85
|
// subagent's are its own working and are left out (its reply reaches the
|
|
68
86
|
// agent, which answers in its own words).
|
package/src/resources/usage.ts
CHANGED
|
@@ -46,6 +46,11 @@ import {
|
|
|
46
46
|
type AgentHours,
|
|
47
47
|
} from "@stigmer/apis/ai/stigmer/billing/subscription/v1/io_pb";
|
|
48
48
|
import type { Stigmer } from "@stigmer/client";
|
|
49
|
+
import {
|
|
50
|
+
GetOnboardingFunnelOutputSchema,
|
|
51
|
+
type GetOnboardingFunnelOutput,
|
|
52
|
+
} from "@stigmer/apis/ai/stigmer/platform/v1/onboarding_funnel_pb";
|
|
53
|
+
import { OnboardingStepId } from "@stigmer/apis/ai/stigmer/tenancy/organization/v1/onboarding_pb";
|
|
49
54
|
import type { OutputFormat } from "../output/index.js";
|
|
50
55
|
import { renderProtoJson, renderProtoYaml, renderTable, terminalWidth, type TerminalStream } from "../output/index.js";
|
|
51
56
|
import { formatTokenCount } from "./run-format.js";
|
|
@@ -83,6 +88,10 @@ export async function getOrgUsageReport(
|
|
|
83
88
|
);
|
|
84
89
|
}
|
|
85
90
|
|
|
91
|
+
export async function getOnboardingFunnel(client: Stigmer, range: DateRange): Promise<GetOnboardingFunnelOutput> {
|
|
92
|
+
return client.platform.getOnboardingFunnel(range);
|
|
93
|
+
}
|
|
94
|
+
|
|
86
95
|
export async function getAgentHours(client: Stigmer, org: string): Promise<AgentHours> {
|
|
87
96
|
return client.subscription.getAgentHours(create(GetAgentHoursInputSchema, { org }));
|
|
88
97
|
}
|
|
@@ -445,3 +454,36 @@ function mapPhaseToString(phase: RunPhase): string {
|
|
|
445
454
|
return "unknown";
|
|
446
455
|
}
|
|
447
456
|
}
|
|
457
|
+
|
|
458
|
+
/** Each step's name in the onboarding count, as the console's card words it. */
|
|
459
|
+
const ONBOARDING_STEP_WORDS: Readonly<Record<number, string>> = {
|
|
460
|
+
[OnboardingStepId.describe]: "Said what it should do",
|
|
461
|
+
[OnboardingStepId.key]: "Added a model key",
|
|
462
|
+
[OnboardingStepId.watch]: "Watched it work",
|
|
463
|
+
[OnboardingStepId.make_yours]: "Made it theirs",
|
|
464
|
+
[OnboardingStepId.in_app]: "Put it in their app",
|
|
465
|
+
[OnboardingStepId.others]: "Brought others in",
|
|
466
|
+
};
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* The onboarding count: how many new organizations were counted, how many
|
|
470
|
+
* were the operator's own, and how many reached each step, with its share
|
|
471
|
+
* of those counted. json and yaml are protojson.
|
|
472
|
+
*/
|
|
473
|
+
export function renderOnboardingFunnel(funnel: GetOnboardingFunnelOutput, range: DateRange, format: OutputFormat): string {
|
|
474
|
+
if (format === "json") return renderProtoJson(GetOnboardingFunnelOutputSchema, funnel);
|
|
475
|
+
if (format === "yaml") return renderProtoYaml(GetOnboardingFunnelOutputSchema, funnel);
|
|
476
|
+
|
|
477
|
+
const lines: string[] = ["", "Onboarding", `Period: ${formatInputDateRange(range.from, range.to)}`, ""];
|
|
478
|
+
const own = funnel.excluded === 0 ? "" : ` (${funnel.excluded} made by your own team left out)`;
|
|
479
|
+
lines.push(` New organizations: ${funnel.organizations}${own}`, "");
|
|
480
|
+
if (funnel.organizations > 0) {
|
|
481
|
+
const rows = funnel.steps.map((step, index) => [
|
|
482
|
+
`${index + 1} ${ONBOARDING_STEP_WORDS[step.id] ?? OnboardingStepId[step.id] ?? String(step.id)}`,
|
|
483
|
+
String(step.reached),
|
|
484
|
+
`${Math.round((step.reached / funnel.organizations) * 100)}%`,
|
|
485
|
+
]);
|
|
486
|
+
lines.push(renderTable(["STEP", "REACHED", "SHARE"], rows), "");
|
|
487
|
+
}
|
|
488
|
+
return lines.join("\n");
|
|
489
|
+
}
|
package/src/runtime.ts
CHANGED
|
@@ -5,13 +5,19 @@
|
|
|
5
5
|
// Two records are written later, by the command itself, so an error can
|
|
6
6
|
// name what was actually tried: the server address the backend client
|
|
7
7
|
// dials (and where that address came from), recorded when the client is
|
|
8
|
-
// made, and the resource type a get, delete or download resolved.
|
|
8
|
+
// made, and the resource type a get, delete or download resolved. The
|
|
9
|
+
// client also records how to ask its server where to get help, so a
|
|
10
|
+
// failure the server answered can end with the server's help line.
|
|
9
11
|
|
|
10
12
|
let debug = false;
|
|
11
13
|
let standalone = false;
|
|
12
14
|
let actionCommand = "";
|
|
13
15
|
let serverAddress: ServerAddress | undefined;
|
|
14
16
|
let resourceType = "";
|
|
17
|
+
let helpProbe: HelpProbe | undefined;
|
|
18
|
+
|
|
19
|
+
/** Asks the dialled server where to get help (its `getServerInfo`'s `help`), sharing the client's one probe. */
|
|
20
|
+
export type HelpProbe = () => Promise<{ readonly url: string; readonly label: string } | undefined>;
|
|
15
21
|
|
|
16
22
|
/**
|
|
17
23
|
* Where the address the backend client dials came from: the active
|
|
@@ -70,3 +76,13 @@ export function setActionResourceType(type: string): void {
|
|
|
70
76
|
export function actionResourceType(): string {
|
|
71
77
|
return resourceType;
|
|
72
78
|
}
|
|
79
|
+
|
|
80
|
+
/** Record how to ask the dialled server for its help link; undefined forgets it (tests). */
|
|
81
|
+
export function setServerHelpProbe(probe: HelpProbe | undefined): void {
|
|
82
|
+
helpProbe = probe;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** How to ask the dialled server for its help link; undefined when no client was made. */
|
|
86
|
+
export function serverHelpProbe(): HelpProbe | undefined {
|
|
87
|
+
return helpProbe;
|
|
88
|
+
}
|
package/auth/auth0.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export declare const AUTH0_DOMAIN = "https://stigmer-prod.us.auth0.com";
|
|
2
|
-
export declare const CLIENT_ID = "kIT6URf4HKn6YzrQVVFTFN63BrSJdTPM";
|
|
3
|
-
export declare const AUDIENCE = "https://api.stigmer.com/";
|
|
4
|
-
export declare const CALLBACK_PORT = 8088;
|
|
5
|
-
export declare const CALLBACK_PATH = "/auth/callback";
|
|
6
|
-
export declare const AUTHORIZE_URL = "https://stigmer-prod.us.auth0.com/authorize";
|
|
7
|
-
export declare const TOKEN_URL = "https://stigmer-prod.us.auth0.com/oauth/token";
|
|
8
|
-
/** The loopback redirect URI Auth0 calls back with the authorization code. */
|
|
9
|
-
export declare function callbackUrl(): string;
|
|
10
|
-
/**
|
|
11
|
-
* Build the Auth0 /authorize URL for the PKCE authorization-code flow.
|
|
12
|
-
* `prompt=login` forces the login page even with an active session, enabling
|
|
13
|
-
* account switching.
|
|
14
|
-
*/
|
|
15
|
-
export declare function buildAuthorizeUrl(params: {
|
|
16
|
-
state: string;
|
|
17
|
-
codeChallenge: string;
|
|
18
|
-
}): string;
|
|
19
|
-
//# sourceMappingURL=auth0.d.ts.map
|
package/auth/auth0.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth0.d.ts","sourceRoot":"","sources":["../src/auth/auth0.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,YAAY,sCAAsC,CAAC;AAChE,eAAO,MAAM,SAAS,qCAAqC,CAAC;AAC5D,eAAO,MAAM,QAAQ,6BAA6B,CAAC;AACnD,eAAO,MAAM,aAAa,OAAO,CAAC;AAClC,eAAO,MAAM,aAAa,mBAAmB,CAAC;AAI9C,eAAO,MAAM,aAAa,gDAA8B,CAAC;AACzD,eAAO,MAAM,SAAS,kDAAgC,CAAC;AAEvD,8EAA8E;AAC9E,wBAAgB,WAAW,IAAI,MAAM,CAEpC;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAY1F"}
|
package/auth/auth0.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
// Auth0 PKCE configuration for Stigmer Cloud.
|
|
2
|
-
//
|
|
3
|
-
// These values are public metadata for a Native/PKCE application — they are NOT
|
|
4
|
-
// secrets. An Auth0 client ID is a public identifier (like a username, not a
|
|
5
|
-
// password), and PKCE removes the need for a client secret entirely. The
|
|
6
|
-
// authorize/token endpoints are hardcoded because Auth0's URL structure is
|
|
7
|
-
// stable ({domain}/authorize, {domain}/oauth/token), saving an OIDC-discovery
|
|
8
|
-
// round-trip at login time.
|
|
9
|
-
export const AUTH0_DOMAIN = "https://stigmer-prod.us.auth0.com";
|
|
10
|
-
export const CLIENT_ID = "kIT6URf4HKn6YzrQVVFTFN63BrSJdTPM";
|
|
11
|
-
export const AUDIENCE = "https://api.stigmer.com/";
|
|
12
|
-
export const CALLBACK_PORT = 8088;
|
|
13
|
-
export const CALLBACK_PATH = "/auth/callback";
|
|
14
|
-
const SCOPES = ["openid", "profile", "email", "offline_access"];
|
|
15
|
-
export const AUTHORIZE_URL = `${AUTH0_DOMAIN}/authorize`;
|
|
16
|
-
export const TOKEN_URL = `${AUTH0_DOMAIN}/oauth/token`;
|
|
17
|
-
/** The loopback redirect URI Auth0 calls back with the authorization code. */
|
|
18
|
-
export function callbackUrl() {
|
|
19
|
-
return `http://localhost:${CALLBACK_PORT}${CALLBACK_PATH}`;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Build the Auth0 /authorize URL for the PKCE authorization-code flow.
|
|
23
|
-
* `prompt=login` forces the login page even with an active session, enabling
|
|
24
|
-
* account switching.
|
|
25
|
-
*/
|
|
26
|
-
export function buildAuthorizeUrl(params) {
|
|
27
|
-
const url = new URL(AUTHORIZE_URL);
|
|
28
|
-
url.searchParams.set("response_type", "code");
|
|
29
|
-
url.searchParams.set("client_id", CLIENT_ID);
|
|
30
|
-
url.searchParams.set("redirect_uri", callbackUrl());
|
|
31
|
-
url.searchParams.set("scope", SCOPES.join(" "));
|
|
32
|
-
url.searchParams.set("audience", AUDIENCE);
|
|
33
|
-
url.searchParams.set("state", params.state);
|
|
34
|
-
url.searchParams.set("code_challenge", params.codeChallenge);
|
|
35
|
-
url.searchParams.set("code_challenge_method", "S256");
|
|
36
|
-
url.searchParams.set("prompt", "login");
|
|
37
|
-
return url.toString();
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=auth0.js.map
|
package/auth/auth0.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth0.js","sourceRoot":"","sources":["../src/auth/auth0.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,EAAE;AACF,gFAAgF;AAChF,6EAA6E;AAC7E,yEAAyE;AACzE,2EAA2E;AAC3E,8EAA8E;AAC9E,4BAA4B;AAE5B,MAAM,CAAC,MAAM,YAAY,GAAG,mCAAmC,CAAC;AAChE,MAAM,CAAC,MAAM,SAAS,GAAG,kCAAkC,CAAC;AAC5D,MAAM,CAAC,MAAM,QAAQ,GAAG,0BAA0B,CAAC;AACnD,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAC;AAClC,MAAM,CAAC,MAAM,aAAa,GAAG,gBAAgB,CAAC;AAE9C,MAAM,MAAM,GAAG,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,gBAAgB,CAAU,CAAC;AAEzE,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,YAAY,YAAY,CAAC;AACzD,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,YAAY,cAAc,CAAC;AAEvD,8EAA8E;AAC9E,MAAM,UAAU,WAAW;IACzB,OAAO,oBAAoB,aAAa,GAAG,aAAa,EAAE,CAAC;AAC7D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAgD;IAChF,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,aAAa,CAAC,CAAC;IACnC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;IAC9C,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;IAC7C,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,cAAc,EAAE,WAAW,EAAE,CAAC,CAAC;IACpD,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAChD,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IAC3C,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5C,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,gBAAgB,EAAE,MAAM,CAAC,aAAa,CAAC,CAAC;IAC7D,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,uBAAuB,EAAE,MAAM,CAAC,CAAC;IACtD,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACxC,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;AACxB,CAAC"}
|
package/src/auth/auth0.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
// Auth0 PKCE configuration for Stigmer Cloud.
|
|
2
|
-
//
|
|
3
|
-
// These values are public metadata for a Native/PKCE application — they are NOT
|
|
4
|
-
// secrets. An Auth0 client ID is a public identifier (like a username, not a
|
|
5
|
-
// password), and PKCE removes the need for a client secret entirely. The
|
|
6
|
-
// authorize/token endpoints are hardcoded because Auth0's URL structure is
|
|
7
|
-
// stable ({domain}/authorize, {domain}/oauth/token), saving an OIDC-discovery
|
|
8
|
-
// round-trip at login time.
|
|
9
|
-
|
|
10
|
-
export const AUTH0_DOMAIN = "https://stigmer-prod.us.auth0.com";
|
|
11
|
-
export const CLIENT_ID = "kIT6URf4HKn6YzrQVVFTFN63BrSJdTPM";
|
|
12
|
-
export const AUDIENCE = "https://api.stigmer.com/";
|
|
13
|
-
export const CALLBACK_PORT = 8088;
|
|
14
|
-
export const CALLBACK_PATH = "/auth/callback";
|
|
15
|
-
|
|
16
|
-
const SCOPES = ["openid", "profile", "email", "offline_access"] as const;
|
|
17
|
-
|
|
18
|
-
export const AUTHORIZE_URL = `${AUTH0_DOMAIN}/authorize`;
|
|
19
|
-
export const TOKEN_URL = `${AUTH0_DOMAIN}/oauth/token`;
|
|
20
|
-
|
|
21
|
-
/** The loopback redirect URI Auth0 calls back with the authorization code. */
|
|
22
|
-
export function callbackUrl(): string {
|
|
23
|
-
return `http://localhost:${CALLBACK_PORT}${CALLBACK_PATH}`;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Build the Auth0 /authorize URL for the PKCE authorization-code flow.
|
|
28
|
-
* `prompt=login` forces the login page even with an active session, enabling
|
|
29
|
-
* account switching.
|
|
30
|
-
*/
|
|
31
|
-
export function buildAuthorizeUrl(params: { state: string; codeChallenge: string }): string {
|
|
32
|
-
const url = new URL(AUTHORIZE_URL);
|
|
33
|
-
url.searchParams.set("response_type", "code");
|
|
34
|
-
url.searchParams.set("client_id", CLIENT_ID);
|
|
35
|
-
url.searchParams.set("redirect_uri", callbackUrl());
|
|
36
|
-
url.searchParams.set("scope", SCOPES.join(" "));
|
|
37
|
-
url.searchParams.set("audience", AUDIENCE);
|
|
38
|
-
url.searchParams.set("state", params.state);
|
|
39
|
-
url.searchParams.set("code_challenge", params.codeChallenge);
|
|
40
|
-
url.searchParams.set("code_challenge_method", "S256");
|
|
41
|
-
url.searchParams.set("prompt", "login");
|
|
42
|
-
return url.toString();
|
|
43
|
-
}
|