@respan/cli 0.14.1 → 0.15.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.
@@ -1,117 +1,11 @@
1
1
  import { BaseCommand } from './base-command.js';
2
- import { CliTool, DetectionSignal } from './agents.js';
3
2
  export type SetupMode = 'tracing' | 'gateway';
4
3
  interface RunSetupOptions {
5
4
  agent?: string;
6
5
  noInstrument?: boolean;
7
6
  }
8
- /**
9
- * Intermediate base class for the `respan setup` family of commands
10
- * (`setup`, `setup tracing`, `setup gateway`).
11
- *
12
- * It deliberately sits between the concrete commands and {@link BaseCommand}
13
- * so that setup-only concerns (interactive prompts, the agent registry, and
14
- * multi-kilobyte skill content) never leak onto the root command class that
15
- * every other command extends.
16
- */
7
+ /** Compatibility entry point. Setup instructions are maintained in the docs. */
17
8
  export declare abstract class SetupBaseCommand extends BaseCommand {
18
- static baseFlags: {
19
- json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
20
- csv: import("@oclif/core/interfaces").BooleanFlag<boolean>;
21
- 'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
22
- 'base-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
23
- profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
24
- verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
25
- };
26
- /**
27
- * Shared setup flow for all three entry points.
28
- *
29
- * 1. askEndpoint() // saved endpoint (confirm reuse) → environment prompt
30
- * 2. askApiKey() // .env → global credential → prompt
31
- * 3. if mode is undefined → ask "Tracing or Gateway?" (interactive only)
32
- * 4. verifyApiKey(mode) // both re-prompt on a rejected key; can pause setup
33
- * 5. selectAgent() // drives only the launch
34
- * 6. installSkill() // full bundle, for all agents, regardless of selection
35
- * 7. launchAgent(mode) // only if an agent was selected
36
- */
37
- protected runSetup(mode?: SetupMode, opts?: RunSetupOptions): Promise<void>;
38
- /**
39
- * Resolve which Respan endpoint this project should target, mirroring the
40
- * environment prompt in `respan auth login`.
41
- *
42
- * First run: ask "Respan Platform or Enterprise?" and remember the choice.
43
- * Later runs: offer the saved endpoint and confirm before reusing it, so a
44
- * user who switched environments isn't silently pinned to the old one. An
45
- * explicit `--base-url` flag wins and skips the prompt for scripted flows.
46
- */
47
- protected askEndpoint(projectRoot: string): Promise<string>;
48
- /**
49
- * Persist the chosen endpoint onto the existing saved credential — the same
50
- * `~/.respan/credentials.json` store `auth login` uses. Only updates a
51
- * credential that already exists; a first-time key is saved (with this
52
- * baseUrl) later in {@link askApiKey}, so we never create a second store.
53
- */
54
- private rememberEndpoint;
55
- /** Friendly name for the known endpoints; falls back to the raw URL. */
56
- protected endpointLabel(baseUrl: string): string;
57
- /** Dashboard origin that pairs with an ingest endpoint. */
58
- protected dashboardUrl(baseUrl: string): string;
59
- /**
60
- * Pin the SDK's RESPAN_BASE_URL in `.env` when the endpoint isn't the
61
- * default. The SDK already targets the Respan Platform out of the box, so we
62
- * leave `.env` untouched for that choice and only write the override that a
63
- * non-default endpoint actually needs (with the `/api` suffix the SDK wants).
64
- */
65
- protected persistBaseUrlToEnv(projectRoot: string, baseUrl: string): void;
66
- /** Resolve the OTLP traces ingest URL for a base URL (with/without /api). */
67
- protected resolveTracesEndpoint(baseUrl: string): string;
68
- /** Resolve the gateway chat-completions URL for a base URL (with/without /api). */
69
- protected resolveCompletionsEndpoint(baseUrl: string): string;
70
- protected askMode(step: number): Promise<SetupMode>;
71
- protected askApiKey(projectRoot: string, baseUrl?: string): Promise<string>;
72
- /**
73
- * Verify the key for the chosen mode. Both paths re-prompt on a rejected key
74
- * and return false if the user abandons the check, so the caller can pause
75
- * setup instead of reporting success with a key that doesn't work.
76
- */
77
- protected verifyApiKey(apiKey: string, mode: SetupMode, projectRoot: string, baseUrl: string): Promise<boolean>;
78
- /** Prompt for a replacement key and persist it to the project .env. */
79
- private reenterApiKey;
80
- private verifyTracingKey;
81
- /**
82
- * Gateway verification gates on a real request succeeding: there is no
83
- * credit-balance endpoint, so a 200 is the only proof of a valid key with a
84
- * positive balance. A rejected key (401/403) re-prompts; any other failure
85
- * loops on the user's say-so. Returns true on success, false if abandoned.
86
- */
87
- private verifyGatewayKey;
88
- /**
89
- * Build a rich demo OTLP trace that mimics a customer support agent workflow:
90
- * workflow: customer_support_pipeline
91
- * └── agent: support_agent
92
- * ├── tool: lookup_order
93
- * ├── chat: openai.chat (classify intent)
94
- * ├── tool: process_refund
95
- * ├── chat: openai.chat (generate response)
96
- * └── task: log_resolution
97
- */
98
- protected buildDemoTrace(email?: string): Record<string, unknown>;
99
- /**
100
- * Minimal chat completion sent through the gateway to prove auth + routing
101
- * and drop a real logged request into the user's account.
102
- */
103
- protected buildDemoCompletion(): Record<string, unknown>;
104
- protected selectAgent(flagAgent: CliTool | undefined, detected: DetectionSignal[]): Promise<CliTool | null>;
105
- protected installSkill(): Promise<void>;
106
- protected launchAgent(tool: CliTool, projectRoot: string, mode: SetupMode): Promise<void>;
107
- protected logStep(num: number, label: string): void;
108
- protected saveToEnv(envPath: string, existingContent: string, key: string, value: string): void;
109
- protected getGitEmail(): string | undefined;
110
- /**
111
- * Send a lightweight setup notification (email only).
112
- * This helps the team know when new users set up Respan so we can
113
- * reach out and help with onboarding.
114
- */
115
- protected notifySetup(email?: string): Promise<void>;
9
+ protected runSetup(mode?: SetupMode, _opts?: RunSetupOptions): Promise<void>;
116
10
  }
117
11
  export {};