@denpex/sdk 0.8.0 → 0.8.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/README.md CHANGED
@@ -39,6 +39,7 @@ Create an API key at <https://denpex.com/dashboard>. It is sent as the `X-Denpex
39
39
  |---|---|
40
40
  | `new DenpexClient({ apiKey, baseUrl?, timeoutMs? })` | Construct a client. `baseUrl` defaults to `https://api.denpex.com`; the default 320-second timeout covers the server's 290-second deep path. |
41
41
  | `diagnose(logs, opts?)` | `POST /api/diagnose` — returns the diagnosis (failure type, confidence, root cause, fix, evidence). |
42
+ | `refine(logs, operatorAnswers, opts?)` | Re-run the same canonical diagnosis with typed answers from `clarifyingChoices`. Send the full answer history; action selections become evidence requests, not evidence. |
42
43
  | `feedback(diagnosisId, outcome, note?)` | `POST /api/diagnose/feedback` — `outcome` is `"worked"` or `"did_not_work"`. |
43
44
  | `quota()` | `GET /api/diagnose/quota` — remaining diagnoses for the key's plan. |
44
45
 
package/dist/client.d.ts CHANGED
@@ -18,6 +18,15 @@ export interface DiagnoseOptions {
18
18
  codeContext?: Record<string, unknown>;
19
19
  /** Client-side signature matches (e.g. from denpex_lite) so Tier 0 starts from evidence. */
20
20
  signatures?: unknown;
21
+ /** Prior clarification answers. Keep these typed and outside `logs`. */
22
+ operatorAnswers?: OperatorAnswerInput[];
23
+ }
24
+ export interface OperatorAnswerInput {
25
+ questionId?: string;
26
+ optionId?: string;
27
+ kind?: 'fact' | 'action';
28
+ question?: string;
29
+ answer: string;
21
30
  }
22
31
  export interface DiagnoseMeta {
23
32
  failureType?: string;
@@ -52,11 +61,53 @@ export interface DiagnoseInitiator {
52
61
  totalLines?: number | null;
53
62
  analyzedLines?: number | null;
54
63
  }
64
+ export interface ClarifyingOption {
65
+ id?: string;
66
+ label?: string;
67
+ detail?: string;
68
+ /**
69
+ * Present only on an `action` question. The engine never recommends an answer to a
70
+ * question of fact: a recommendation there returns the answer that was hinted at
71
+ * rather than the one that happened, and the next verdict is built on an
72
+ * observation nobody made. Render this marker only when `kind === 'action'`.
73
+ */
74
+ recommended?: boolean;
75
+ /** Exact evidence command represented by this option on an action question. */
76
+ command?: string;
77
+ }
78
+ export interface ClarifyingQuestion {
79
+ id?: string;
80
+ /** `fact` = what the operator observed; `action` = what they could run next. */
81
+ kind?: 'fact' | 'action';
82
+ question?: string;
83
+ options?: ClarifyingOption[];
84
+ allowOther?: boolean;
85
+ /** The exact command behind the recommended option, on `action` questions. */
86
+ command?: string;
87
+ }
55
88
  export interface DiagnoseResponse {
56
89
  fix?: {
57
90
  summary?: string;
58
91
  action?: string;
59
92
  evidence?: unknown[];
93
+ /**
94
+ * Set when the engine declined to name one cause and is asking for evidence
95
+ * instead. Answer with the option ids to get a sharper diagnosis. `inviteFollowup`
96
+ * is the flag that says this happened.
97
+ */
98
+ clarifyingChoices?: ClarifyingQuestion[];
99
+ /** Plain-text form of the same questions, for older callers. */
100
+ clarifyingQuestions?: string[];
101
+ inviteFollowup?: boolean;
102
+ evidenceRequests?: Array<{
103
+ questionId: string;
104
+ optionId: string;
105
+ label: string;
106
+ command: string;
107
+ why?: string;
108
+ pasteBack?: string;
109
+ }>;
110
+ awaitingEvidence?: boolean;
60
111
  [k: string]: unknown;
61
112
  };
62
113
  meta?: DiagnoseMeta;
@@ -90,6 +141,8 @@ export declare class DenpexClient {
90
141
  constructor(options: DenpexClientOptions);
91
142
  /** Diagnose a training failure from raw logs (20 chars – 256 KB). */
92
143
  diagnose(logs: string, opts?: DiagnoseOptions): Promise<DiagnoseResponse>;
144
+ /** Re-run the canonical diagnosis with observed facts or a selected evidence check. */
145
+ refine(logs: string, operatorAnswers: OperatorAnswerInput[], opts?: Omit<DiagnoseOptions, 'operatorAnswers'>): Promise<DiagnoseResponse>;
93
146
  /** Report whether a diagnosis worked — this feedback directly improves future priors. */
94
147
  feedback(diagnosisId: string, outcome: FeedbackOutcome, note?: string): Promise<Record<string, unknown>>;
95
148
  /** Remaining diagnosis headroom for this key's plan. */
package/dist/client.js CHANGED
@@ -49,6 +49,10 @@ class DenpexClient {
49
49
  }
50
50
  return this.request('POST', '/api/diagnose', { logs, ...opts });
51
51
  }
52
+ /** Re-run the canonical diagnosis with observed facts or a selected evidence check. */
53
+ async refine(logs, operatorAnswers, opts = {}) {
54
+ return this.diagnose(logs, { ...opts, operatorAnswers });
55
+ }
52
56
  /** Report whether a diagnosis worked — this feedback directly improves future priors. */
53
57
  async feedback(diagnosisId, outcome, note) {
54
58
  if (!diagnosisId)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@denpex/sdk",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "TypeScript client for the Denpex API — diagnose GPU training failures from logs (POST /api/diagnose), report fix outcomes, check quota. Zero dependencies, Node >= 18.",
5
5
  "keywords": [
6
6
  "denpex",