@codetelemetry/mcp 0.3.0 → 0.3.8

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,14 +1,22 @@
1
- const TERMINAL_ERRORS = new Set(["expired_token", "invalid_grant", "access_denied"]);
2
- export async function requestDeviceCode(endpoints, fetchImpl = fetch, timeoutMs = 10_000) {
1
+ const TERMINAL_ERRORS = new Set(["expired_token", "invalid_grant", "access_denied", "wrong_scope"]);
2
+ function tokenError(body, fallback) {
3
+ return body.state === "wrong_scope" ? "wrong_scope" : String(body.error ?? fallback);
4
+ }
5
+ function issuedIngestEndpoint(body, endpoints) {
6
+ return typeof body.ingest_endpoint === "string" && body.ingest_endpoint ? body.ingest_endpoint : endpoints.ingestEndpoint;
7
+ }
8
+ export async function requestDeviceCode(endpoints, fetchImpl = fetch, timeoutMs = 10_000, expected) {
9
+ const scopeFenced = !!expected && Object.keys(expected).length > 0;
10
+ const codeUrl = scopeFenced ? endpoints.deviceScopedCodeUrl : endpoints.deviceCodeUrl;
3
11
  const ac = new AbortController();
4
12
  const timer = setTimeout(() => ac.abort(), Math.max(1, timeoutMs));
5
13
  try {
6
14
  let res;
7
15
  try {
8
- res = await fetchImpl(endpoints.deviceCodeUrl, {
16
+ res = await fetchImpl(codeUrl, {
9
17
  method: "POST",
10
18
  headers: { "content-type": "application/json" },
11
- body: JSON.stringify({ client: "codetelemetry-connect" }),
19
+ body: JSON.stringify({ client: "codetelemetry-connect", ...(expected ? { expected } : {}) }),
12
20
  signal: ac.signal,
13
21
  });
14
22
  }
@@ -34,19 +42,32 @@ export async function requestDeviceCode(endpoints, fetchImpl = fetch, timeoutMs
34
42
  verificationUri: String(j.verification_uri ?? endpoints.verificationUri),
35
43
  expiresIn: Number(j.expires_in ?? 600),
36
44
  interval: Number(j.interval ?? 2),
45
+ scopeFenced,
37
46
  };
38
47
  }
39
48
  finally {
40
49
  clearTimeout(timer);
41
50
  }
42
51
  }
43
- async function tokenRequest(endpoints, deviceCode, fetchImpl, timeoutMs) {
52
+ function keyScope(value) {
53
+ if (!value || typeof value !== "object" || Array.isArray(value))
54
+ return undefined;
55
+ const raw = value;
56
+ if (typeof raw.tenantId !== "string" || !raw.tenantId || raw.tenantId.length > 256)
57
+ return undefined;
58
+ if (raw.teamId !== null && (typeof raw.teamId !== "string" || !raw.teamId || raw.teamId.length > 256))
59
+ return undefined;
60
+ if (typeof raw.billingAccountId !== "string" || !raw.billingAccountId || raw.billingAccountId.length > 256)
61
+ return undefined;
62
+ return { tenantId: raw.tenantId, teamId: raw.teamId, billingAccountId: raw.billingAccountId };
63
+ }
64
+ async function tokenRequest(endpoints, deviceCode, fetchImpl, timeoutMs, scopeFenced) {
44
65
  const ac = new AbortController();
45
66
  const timer = setTimeout(() => ac.abort(), Math.max(1, timeoutMs));
46
67
  try {
47
68
  let response;
48
69
  try {
49
- response = await fetchImpl(endpoints.deviceTokenUrl, {
70
+ response = await fetchImpl(scopeFenced ? endpoints.deviceScopedTokenUrl : endpoints.deviceTokenUrl, {
50
71
  method: "POST",
51
72
  headers: { "content-type": "application/json" },
52
73
  body: JSON.stringify({ device_code: deviceCode }),
@@ -65,15 +86,21 @@ async function tokenRequest(endpoints, deviceCode, fetchImpl, timeoutMs) {
65
86
  clearTimeout(timer);
66
87
  }
67
88
  }
68
- export async function pollOnce(endpoints, deviceCode, fetchImpl = fetch, timeoutMs = 8_000) {
69
- const result = await tokenRequest(endpoints, deviceCode, fetchImpl, timeoutMs);
89
+ export async function pollOnce(endpoints, deviceCode, fetchImpl = fetch, timeoutMs = 8_000, opts = {}) {
90
+ const result = await tokenRequest(endpoints, deviceCode, fetchImpl, timeoutMs, opts.scopeFenced === true);
70
91
  if (result === null)
71
92
  return { status: "pending" };
72
93
  const { response: res, body: j } = result;
73
94
  if (res.ok && j.api_key) {
74
- return { status: "authorized", apiKey: String(j.api_key), ingestEndpoint: String(j.ingest_endpoint) };
95
+ const scope = keyScope(j.scope);
96
+ return {
97
+ status: "authorized",
98
+ apiKey: String(j.api_key),
99
+ ingestEndpoint: issuedIngestEndpoint(j, endpoints),
100
+ ...(scope ? { scope } : {}),
101
+ };
75
102
  }
76
- const error = String(j.error ?? "authorization_pending");
103
+ const error = tokenError(j, "authorization_pending");
77
104
  return TERMINAL_ERRORS.has(error) ? { status: "error", error } : { status: "pending" };
78
105
  }
79
106
  const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
@@ -89,15 +116,20 @@ export async function pollForKey(endpoints, deviceCode, opts = {}) {
89
116
  if (remaining <= 0) {
90
117
  throw new Error("device authorization timed out — approval not completed in time");
91
118
  }
92
- const result = await tokenRequest(endpoints, deviceCode, fetchImpl, remaining);
119
+ const result = await tokenRequest(endpoints, deviceCode, fetchImpl, remaining, opts.scopeFenced === true);
93
120
  if (result === null) {
94
121
  throw new Error("device authorization timed out — approval not completed in time");
95
122
  }
96
123
  const { response: res, body: j } = result;
97
124
  if (res.ok && j.api_key) {
98
- return { apiKey: String(j.api_key), ingestEndpoint: String(j.ingest_endpoint) };
125
+ const scope = keyScope(j.scope);
126
+ return {
127
+ apiKey: String(j.api_key),
128
+ ingestEndpoint: issuedIngestEndpoint(j, endpoints),
129
+ ...(scope ? { scope } : {}),
130
+ };
99
131
  }
100
- const error = String(j.error ?? (res.status >= 500 ? "server_error" : "authorization_pending"));
132
+ const error = tokenError(j, res.status >= 500 ? "server_error" : "authorization_pending");
101
133
  if (TERMINAL_ERRORS.has(error)) {
102
134
  throw new Error(`device authorization ${error}`);
103
135
  }
@@ -1,7 +1,7 @@
1
1
  import { type SettingsScope } from "./config.ts";
2
2
  import { type WriteResult } from "./settings.ts";
3
3
  import { type SendTestResult, type FetchLike } from "./otlp.ts";
4
- import { type ConfirmResult } from "./connectivity.ts";
4
+ import { type ConfirmResult, type ExpectedKeyScope, type KeyScope } from "./connectivity.ts";
5
5
  export type OnboardStep = {
6
6
  name: string;
7
7
  ok: boolean;
@@ -24,6 +24,7 @@ export type OnboardOptions = {
24
24
  getKey?: () => Promise<{
25
25
  apiKey: string;
26
26
  ingestEndpoint?: string;
27
+ scope?: KeyScope;
27
28
  }>;
28
29
  client?: OnboardClient;
29
30
  endpoints?: Partial<{
@@ -41,6 +42,7 @@ export type OnboardOptions = {
41
42
  verify?: boolean;
42
43
  verifyTimeoutMs?: number;
43
44
  verifyIntervalMs?: number;
45
+ expectedScope?: ExpectedKeyScope;
44
46
  fetchImpl?: FetchLike;
45
47
  logger?: (msg: string) => void;
46
48
  };
@@ -2,13 +2,14 @@ import { resolveEndpoints, resolveSettingsPath } from "./config.js";
2
2
  import { writeSettings } from "./settings.js";
3
3
  import { resolveCodexConfigPath, writeCodexConfig } from "./codexConfig.js";
4
4
  import { sendTestEvent } from "./otlp.js";
5
- import { confirmLanded } from "./connectivity.js";
5
+ import { confirmLanded, verifyScope, } from "./connectivity.js";
6
6
  import { keyHash, mask, assertKey } from "./keys.js";
7
7
  export async function onboard(opts) {
8
8
  const log = opts.logger ?? (() => { });
9
9
  const steps = [];
10
10
  let apiKey;
11
11
  let deviceIngest;
12
+ let approvedScope;
12
13
  if (opts.key) {
13
14
  apiKey = assertKey(opts.key);
14
15
  steps.push({ name: "authenticate", ok: true, detail: "used provided ingest key" });
@@ -17,6 +18,7 @@ export async function onboard(opts) {
17
18
  const got = await opts.getKey();
18
19
  apiKey = assertKey(got.apiKey);
19
20
  deviceIngest = got.ingestEndpoint;
21
+ approvedScope = got.scope;
20
22
  steps.push({ name: "authenticate", ok: true, detail: "obtained ingest key via device flow" });
21
23
  }
22
24
  else {
@@ -27,6 +29,28 @@ export async function onboard(opts) {
27
29
  ingestEndpoint: deviceIngest ?? opts.endpoints?.ingestEndpoint,
28
30
  });
29
31
  log(`Using ingest key ${mask(apiKey)} → ${endpoints.ingestEndpoint}`);
32
+ if (opts.expectedScope && Object.keys(opts.expectedScope).length > 0) {
33
+ const scopeAttested = approvedScope
34
+ && (opts.expectedScope.tenantId === undefined || opts.expectedScope.tenantId === approvedScope.tenantId)
35
+ && (opts.expectedScope.teamId === undefined || opts.expectedScope.teamId === approvedScope.teamId)
36
+ && (opts.expectedScope.billingAccountId === undefined || opts.expectedScope.billingAccountId === approvedScope.billingAccountId);
37
+ if (scopeAttested) {
38
+ steps.push({ name: "verify_scope", ok: true, detail: "device authorization attested key destination and billing scope" });
39
+ }
40
+ else {
41
+ const preflight = await verifyScope({
42
+ key: apiKey,
43
+ connectivityUrl: endpoints.connectivityUrl,
44
+ fetchImpl: opts.fetchImpl,
45
+ expected: opts.expectedScope,
46
+ });
47
+ if (preflight.state !== "scope_verified") {
48
+ const mismatches = preflight.mismatches?.join(", ");
49
+ throw new Error(`refusing to configure key: ${preflight.state}${mismatches ? ` (${mismatches})` : ""}`);
50
+ }
51
+ steps.push({ name: "verify_scope", ok: true, detail: "key destination and billing scope verified" });
52
+ }
53
+ }
30
54
  const settings = opts.client === "codex"
31
55
  ? writeCodexConfig({
32
56
  key: apiKey,
@@ -71,11 +95,14 @@ export async function onboard(opts) {
71
95
  fetchImpl: opts.fetchImpl,
72
96
  timeoutMs: opts.verifyTimeoutMs,
73
97
  intervalMs: opts.verifyIntervalMs,
98
+ expected: opts.expectedScope,
74
99
  });
75
100
  steps.push({
76
101
  name: "verify_telemetry",
77
102
  ok: verify.landed,
78
- detail: verify.landed ? `landed in ${verify.elapsedMs}ms` : `not seen within timeout (${verify.elapsedMs}ms)`,
103
+ detail: verify.landed
104
+ ? `landed in ${verify.elapsedMs}ms for ${verify.scope?.teamId ? `organization ${verify.scope.teamId}` : "personal scope"}`
105
+ : `${verify.state} (${verify.elapsedMs}ms)`,
79
106
  });
80
107
  log(verify.landed ? `✓ Telemetry landed in ${verify.elapsedMs}ms` : "Telemetry not confirmed yet — it can take a moment to appear");
81
108
  }
@@ -0,0 +1,53 @@
1
+ export declare const MAX_PLAN_TEXT = 4000;
2
+ export declare const MAX_PLAN_TITLE = 300;
3
+ export declare const MAX_PLAN_STEP_TITLE = 300;
4
+ export declare const MAX_PLAN_STEP_DETAIL = 4000;
5
+ export declare const MAX_PLAN_STEPS = 50;
6
+ export declare const MAX_PLAN_REPO = 200;
7
+ export declare const MAX_PLAN_PROJECT = 200;
8
+ export declare const MAX_PLAN_MODEL = 120;
9
+ export declare const PLAN_PROVIDERS: readonly ["claude", "codex"];
10
+ export type PlanProvider = (typeof PLAN_PROVIDERS)[number];
11
+ export type PlanStepInput = string | {
12
+ title?: string;
13
+ detail?: string;
14
+ };
15
+ export type PlanInput = {
16
+ planText?: string;
17
+ steps?: PlanStepInput[];
18
+ title?: string;
19
+ repo?: string;
20
+ project?: string;
21
+ provider?: PlanProvider;
22
+ model?: string;
23
+ };
24
+ export type PlanSourceStep = {
25
+ index: number;
26
+ title: string | null;
27
+ chars: number;
28
+ };
29
+ export type PlanSource = {
30
+ kind: "plan";
31
+ title: string | null;
32
+ format: "text" | "steps" | "text+steps";
33
+ stepCount: number;
34
+ steps: PlanSourceStep[];
35
+ repo: string | null;
36
+ project: string | null;
37
+ provider: PlanProvider | null;
38
+ model: string | null;
39
+ contentChars: number;
40
+ };
41
+ export type NormalizedPlan = {
42
+ taskText: string;
43
+ repo?: string;
44
+ source: PlanSource;
45
+ };
46
+ export type NormalizePlanResult = {
47
+ ok: true;
48
+ plan: NormalizedPlan;
49
+ } | {
50
+ ok: false;
51
+ message: string;
52
+ };
53
+ export declare function normalizePlan(raw: Record<string, unknown>): NormalizePlanResult;
@@ -0,0 +1,112 @@
1
+ export const MAX_PLAN_TEXT = 4_000;
2
+ export const MAX_PLAN_TITLE = 300;
3
+ export const MAX_PLAN_STEP_TITLE = 300;
4
+ export const MAX_PLAN_STEP_DETAIL = 4_000;
5
+ export const MAX_PLAN_STEPS = 50;
6
+ export const MAX_PLAN_REPO = 200;
7
+ export const MAX_PLAN_PROJECT = 200;
8
+ export const MAX_PLAN_MODEL = 120;
9
+ export const PLAN_PROVIDERS = ["claude", "codex"];
10
+ const bad = (message) => ({ ok: false, message });
11
+ function boundedString(value, max) {
12
+ if (value === undefined)
13
+ return undefined;
14
+ if (typeof value !== "string" || value.length > max)
15
+ return null;
16
+ return value.trim();
17
+ }
18
+ export function normalizePlan(raw) {
19
+ const planText = boundedString(raw.planText, MAX_PLAN_TEXT);
20
+ if (planText === null) {
21
+ return bad(`planText must be a string of at most ${MAX_PLAN_TEXT} characters`);
22
+ }
23
+ const title = boundedString(raw.title, MAX_PLAN_TITLE);
24
+ if (title === null)
25
+ return bad(`title must be a string of at most ${MAX_PLAN_TITLE} characters`);
26
+ const repo = boundedString(raw.repo, MAX_PLAN_REPO);
27
+ if (repo === null)
28
+ return bad(`repo must be a string of at most ${MAX_PLAN_REPO} characters`);
29
+ const project = boundedString(raw.project, MAX_PLAN_PROJECT);
30
+ if (project === null)
31
+ return bad(`project must be a string of at most ${MAX_PLAN_PROJECT} characters`);
32
+ const model = boundedString(raw.model, MAX_PLAN_MODEL);
33
+ if (model === null)
34
+ return bad(`model must be a string of at most ${MAX_PLAN_MODEL} characters`);
35
+ let provider;
36
+ if (raw.provider !== undefined) {
37
+ if (typeof raw.provider !== "string" || !PLAN_PROVIDERS.includes(raw.provider)) {
38
+ return bad(`provider must be one of ${PLAN_PROVIDERS.join(", ")}`);
39
+ }
40
+ provider = raw.provider;
41
+ }
42
+ const stepLines = [];
43
+ const sourceSteps = [];
44
+ if (raw.steps !== undefined) {
45
+ if (!Array.isArray(raw.steps))
46
+ return bad("steps must be an array");
47
+ if (raw.steps.length > MAX_PLAN_STEPS)
48
+ return bad(`steps must contain at most ${MAX_PLAN_STEPS} items`);
49
+ for (let i = 0; i < raw.steps.length; i++) {
50
+ const step = raw.steps[i];
51
+ let stepTitle;
52
+ let stepDetail;
53
+ if (typeof step === "string") {
54
+ stepDetail = step.trim();
55
+ }
56
+ else if (step !== null && typeof step === "object" && !Array.isArray(step)) {
57
+ const obj = step;
58
+ const t = boundedString(obj.title, MAX_PLAN_STEP_TITLE);
59
+ const d = boundedString(obj.detail, MAX_PLAN_STEP_DETAIL);
60
+ if (t === null)
61
+ return bad(`steps[${i}].title must be a string of at most ${MAX_PLAN_STEP_TITLE} characters`);
62
+ if (d === null)
63
+ return bad(`steps[${i}].detail must be a string of at most ${MAX_PLAN_STEP_DETAIL} characters`);
64
+ stepTitle = t || undefined;
65
+ stepDetail = d || undefined;
66
+ }
67
+ else {
68
+ return bad(`steps[${i}] must be a string or an object with title/detail`);
69
+ }
70
+ if (!stepTitle && !stepDetail) {
71
+ return bad(`steps[${i}] must have a non-empty title or detail`);
72
+ }
73
+ const label = stepTitle && stepDetail ? `${stepTitle}: ${stepDetail}` : stepTitle ?? stepDetail;
74
+ stepLines.push(`${i + 1}. ${label}`);
75
+ sourceSteps.push({
76
+ index: i + 1,
77
+ title: stepTitle ?? null,
78
+ chars: (stepTitle?.length ?? 0) + (stepDetail?.length ?? 0),
79
+ });
80
+ }
81
+ }
82
+ const hasText = !!planText;
83
+ const hasSteps = sourceSteps.length > 0;
84
+ if (!hasText && !hasSteps) {
85
+ return bad("Provide planText or at least one step to estimate.");
86
+ }
87
+ const parts = [];
88
+ if (title)
89
+ parts.push(title);
90
+ if (planText)
91
+ parts.push(planText);
92
+ if (hasSteps)
93
+ parts.push(`Plan steps:\n${stepLines.join("\n")}`);
94
+ const taskText = parts.join("\n\n");
95
+ if (taskText.length > MAX_PLAN_TEXT) {
96
+ return bad(`Assembled plan is ${taskText.length} characters; keep title, plan text, and steps under ${MAX_PLAN_TEXT} together.`);
97
+ }
98
+ const format = hasText && hasSteps ? "text+steps" : hasSteps ? "steps" : "text";
99
+ const source = {
100
+ kind: "plan",
101
+ title: title || null,
102
+ format,
103
+ stepCount: sourceSteps.length,
104
+ steps: sourceSteps,
105
+ repo: repo || null,
106
+ project: project || null,
107
+ provider: provider ?? null,
108
+ model: model || null,
109
+ contentChars: taskText.length,
110
+ };
111
+ return { ok: true, plan: { taskText, ...(repo ? { repo } : {}), source } };
112
+ }
@@ -3,11 +3,35 @@ import { ListToolsRequestSchema, CallToolRequestSchema } from "@modelcontextprot
3
3
  import { TOOLS, callTool } from "./tools.js";
4
4
  import { manifestEntries } from "./manifest.js";
5
5
  import { MCP_SERVER_NAME, MCP_SERVER_VERSION } from "./version.js";
6
+ const MCP_TOOL_RESPONSE_BYTES = 64 * 1024;
7
+ const MCP_JSONRPC_FRAMING_BYTES = 512;
8
+ function boundedToolResponse(result) {
9
+ const make = (value) => ({
10
+ content: [{ type: "text", text: JSON.stringify(value, null, 2) }],
11
+ structuredContent: value,
12
+ isError: value.ok === false,
13
+ });
14
+ const response = make(result);
15
+ if (Buffer.byteLength(JSON.stringify(response), "utf8") <= MCP_TOOL_RESPONSE_BYTES - MCP_JSONRPC_FRAMING_BYTES)
16
+ return response;
17
+ const fallback = {
18
+ ok: false,
19
+ error: "response_budget_exceeded",
20
+ state: typeof result.state === "string" ? result.state : "provider_failure",
21
+ message: "The tool response exceeded the complete MCP response budget; retry with a narrower evidence selection.",
22
+ };
23
+ const bounded = make(fallback);
24
+ if (Buffer.byteLength(JSON.stringify(bounded), "utf8") > MCP_TOOL_RESPONSE_BYTES - MCP_JSONRPC_FRAMING_BYTES)
25
+ throw new Error("MCP response budget invariant failed");
26
+ return bounded;
27
+ }
6
28
  export function buildServer(ctx) {
7
29
  const server = new Server({ name: MCP_SERVER_NAME, version: MCP_SERVER_VERSION }, { capabilities: { tools: {} } });
8
30
  server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: manifestEntries(TOOLS) }));
9
31
  server.setRequestHandler(CallToolRequestSchema, async (req) => {
10
32
  const result = await callTool(req.params.name, (req.params.arguments ?? {}), ctx);
33
+ if (["interpret_session", "read_session_events", "compare_sessions", "plan_next_session"].includes(req.params.name))
34
+ return boundedToolResponse(result);
11
35
  return {
12
36
  content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
13
37
  structuredContent: result,
@@ -1,3 +1,4 @@
1
+ import type { ExpectedKeyScope, KeyScope } from "./client/connectivity.ts";
1
2
  export type KeySource = "device-flow" | "pasted";
2
3
  export declare class OnboardingSession {
3
4
  #private;
@@ -8,7 +9,13 @@ export declare class OnboardingSession {
8
9
  deviceCode: string | null;
9
10
  userCode: string | null;
10
11
  lastProbeId: string | null;
12
+ pendingScope: ExpectedKeyScope | null;
13
+ deviceScopeFenced: boolean;
14
+ keyScope: KeyScope | null;
15
+ keyExpectedScope: ExpectedKeyScope | null;
16
+ serverChosenByModel: boolean;
11
17
  setKey(plaintext: string, source: KeySource, ingestEndpoint?: string): void;
18
+ forgetKey(): void;
12
19
  hasKey(): boolean;
13
20
  useKey(): string;
14
21
  view(): {
@@ -8,6 +8,11 @@ export class OnboardingSession {
8
8
  deviceCode = null;
9
9
  userCode = null;
10
10
  lastProbeId = null;
11
+ pendingScope = null;
12
+ deviceScopeFenced = false;
13
+ keyScope = null;
14
+ keyExpectedScope = null;
15
+ serverChosenByModel = false;
11
16
  setKey(plaintext, source, ingestEndpoint) {
12
17
  if (!looksLikeKey(plaintext))
13
18
  throw new Error("not a valid CodeTelemetry ingest key (expected cot_…)");
@@ -16,6 +21,23 @@ export class OnboardingSession {
16
21
  this.source = source;
17
22
  if (ingestEndpoint)
18
23
  this.ingestEndpoint = ingestEndpoint;
24
+ this.keyScope = null;
25
+ this.keyExpectedScope = null;
26
+ if (source === "pasted") {
27
+ this.pendingScope = null;
28
+ this.deviceCode = null;
29
+ this.userCode = null;
30
+ this.deviceScopeFenced = false;
31
+ }
32
+ }
33
+ forgetKey() {
34
+ this.#key = null;
35
+ this.keyHash = null;
36
+ this.source = null;
37
+ this.keyScope = null;
38
+ this.keyExpectedScope = null;
39
+ this.ingestEndpoint = null;
40
+ this.lastProbeId = null;
19
41
  }
20
42
  hasKey() {
21
43
  return this.#key !== null;
@@ -40,5 +62,10 @@ export class OnboardingSession {
40
62
  this.deviceCode = null;
41
63
  this.userCode = null;
42
64
  this.lastProbeId = null;
65
+ this.pendingScope = null;
66
+ this.deviceScopeFenced = false;
67
+ this.keyScope = null;
68
+ this.keyExpectedScope = null;
69
+ this.serverChosenByModel = false;
43
70
  }
44
71
  }
@@ -1,4 +1,6 @@
1
+ import path from "node:path";
1
2
  import { type FetchLike } from "./client/otlp.ts";
3
+ import { type OnboardClient } from "./client/onboard.ts";
2
4
  import { OnboardingSession } from "./session.ts";
3
5
  export type ToolContext = {
4
6
  session: OnboardingSession;
@@ -22,7 +24,20 @@ export type ToolDef = {
22
24
  inputSchema: Record<string, unknown>;
23
25
  handler: (args: Record<string, unknown>, ctx: ToolContext) => Promise<ToolResult>;
24
26
  };
27
+ type RequestedPath = {
28
+ ok: true;
29
+ path: string | undefined;
30
+ } | {
31
+ ok: false;
32
+ message: string;
33
+ };
34
+ export declare function requestedConfigPath(client: OnboardClient, args: Record<string, unknown>, pathImpl?: path.PlatformPath): RequestedPath;
25
35
  export declare const ISSUE_SIZING_ERRORS: ReadonlySet<string>;
36
+ export declare const INTERPRET_SESSION_STATES: ReadonlySet<string>;
37
+ export declare const COMPARE_SESSION_STATES: ReadonlySet<string>;
38
+ export declare const PLAN_NEXT_SESSION_STATES: ReadonlySet<string>;
39
+ export declare const READ_SESSION_EVENTS_STATES: ReadonlySet<string>;
26
40
  export declare const TOOLS: ToolDef[];
27
41
  export declare const TOOLS_BY_NAME: Record<string, ToolDef>;
28
42
  export declare function callTool(name: string, args: Record<string, unknown>, ctx: ToolContext): Promise<ToolResult>;
43
+ export {};