@lumenkey/cli 0.2.3 → 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.
Files changed (98) hide show
  1. package/README.md +43 -7
  2. package/dist/cli/copied.d.ts +19 -36
  3. package/dist/cli/copied.d.ts.map +1 -1
  4. package/dist/cli/copied.js +159 -283
  5. package/dist/cli/copied.js.map +1 -1
  6. package/dist/cli/index.d.ts.map +1 -1
  7. package/dist/cli/index.js +86 -136
  8. package/dist/cli/index.js.map +1 -1
  9. package/dist/cli/render.d.ts +11 -0
  10. package/dist/cli/render.d.ts.map +1 -0
  11. package/dist/cli/render.js +38 -0
  12. package/dist/cli/render.js.map +1 -0
  13. package/dist/core/atomic-config-file.d.ts +21 -2
  14. package/dist/core/atomic-config-file.d.ts.map +1 -1
  15. package/dist/core/atomic-config-file.js +66 -10
  16. package/dist/core/atomic-config-file.js.map +1 -1
  17. package/dist/core/chat.d.ts +13 -0
  18. package/dist/core/chat.d.ts.map +1 -0
  19. package/dist/core/chat.js +31 -0
  20. package/dist/core/chat.js.map +1 -0
  21. package/dist/core/client.d.ts +19 -1
  22. package/dist/core/client.d.ts.map +1 -1
  23. package/dist/core/client.js +50 -11
  24. package/dist/core/client.js.map +1 -1
  25. package/dist/core/config-dir.d.ts.map +1 -1
  26. package/dist/core/config-dir.js +3 -4
  27. package/dist/core/config-dir.js.map +1 -1
  28. package/dist/core/config-error.d.ts +14 -0
  29. package/dist/core/config-error.d.ts.map +1 -0
  30. package/dist/core/config-error.js +20 -0
  31. package/dist/core/config-error.js.map +1 -0
  32. package/dist/core/config.d.ts +1 -5
  33. package/dist/core/config.d.ts.map +1 -1
  34. package/dist/core/config.js +8 -39
  35. package/dist/core/config.js.map +1 -1
  36. package/dist/core/credit-cap.d.ts +5 -0
  37. package/dist/core/credit-cap.d.ts.map +1 -0
  38. package/dist/core/credit-cap.js +15 -0
  39. package/dist/core/credit-cap.js.map +1 -0
  40. package/dist/core/download.d.ts.map +1 -1
  41. package/dist/core/download.js +105 -16
  42. package/dist/core/download.js.map +1 -1
  43. package/dist/core/error-result.d.ts +4 -13
  44. package/dist/core/error-result.d.ts.map +1 -1
  45. package/dist/core/error-result.js +4 -24
  46. package/dist/core/error-result.js.map +1 -1
  47. package/dist/core/generation-input.d.ts +33 -0
  48. package/dist/core/generation-input.d.ts.map +1 -0
  49. package/dist/core/generation-input.js +145 -0
  50. package/dist/core/generation-input.js.map +1 -0
  51. package/dist/core/generation-result.d.ts +17 -14
  52. package/dist/core/generation-result.d.ts.map +1 -1
  53. package/dist/core/generation-result.js +3 -4
  54. package/dist/core/generation-result.js.map +1 -1
  55. package/dist/core/generation.d.ts +124 -0
  56. package/dist/core/generation.d.ts.map +1 -0
  57. package/dist/core/generation.js +316 -0
  58. package/dist/core/generation.js.map +1 -0
  59. package/dist/core/locale.d.ts +21 -0
  60. package/dist/core/locale.d.ts.map +1 -1
  61. package/dist/core/locale.js +84 -4
  62. package/dist/core/locale.js.map +1 -1
  63. package/dist/core/outcome.d.ts +134 -0
  64. package/dist/core/outcome.d.ts.map +1 -0
  65. package/dist/core/outcome.js +112 -0
  66. package/dist/core/outcome.js.map +1 -0
  67. package/dist/core/output-path.d.ts +10 -0
  68. package/dist/core/output-path.d.ts.map +1 -0
  69. package/dist/core/output-path.js +15 -0
  70. package/dist/core/output-path.js.map +1 -0
  71. package/dist/core/params.d.ts +68 -0
  72. package/dist/core/params.d.ts.map +1 -0
  73. package/dist/core/params.js +227 -0
  74. package/dist/core/params.js.map +1 -0
  75. package/dist/core/poller.d.ts +6 -1
  76. package/dist/core/poller.d.ts.map +1 -1
  77. package/dist/core/poller.js +17 -8
  78. package/dist/core/poller.js.map +1 -1
  79. package/dist/core/profiles.d.ts +4 -2
  80. package/dist/core/profiles.d.ts.map +1 -1
  81. package/dist/core/profiles.js +20 -9
  82. package/dist/core/profiles.js.map +1 -1
  83. package/dist/core/submission-journal.d.ts +106 -0
  84. package/dist/core/submission-journal.d.ts.map +1 -0
  85. package/dist/core/submission-journal.js +340 -0
  86. package/dist/core/submission-journal.js.map +1 -0
  87. package/dist/index.d.ts +3 -0
  88. package/dist/index.d.ts.map +1 -1
  89. package/dist/index.js +3 -0
  90. package/dist/index.js.map +1 -1
  91. package/dist/mcp/render.d.ts +11 -0
  92. package/dist/mcp/render.d.ts.map +1 -0
  93. package/dist/mcp/render.js +17 -0
  94. package/dist/mcp/render.js.map +1 -0
  95. package/dist/mcp/server.d.ts.map +1 -1
  96. package/dist/mcp/server.js +95 -337
  97. package/dist/mcp/server.js.map +1 -1
  98. package/package.json +2 -1
@@ -1,19 +1,22 @@
1
- import type { GenerationJobDetail } from './types.js';
2
- /** A local save failure must not erase a successful, billable gateway result. */
3
- export declare function generationResult(detail: GenerationJobDetail, idempotencyKey: string, outputPath?: string, signal?: AbortSignal): Promise<{
4
- success: boolean;
5
- submitted: boolean;
1
+ import type { GenerationJobDetail, JobStatus } from './types.js';
2
+ export interface DownloadReport {
3
+ ok: boolean;
4
+ code?: string;
5
+ error?: string;
6
+ httpStatus?: number;
7
+ }
8
+ export interface GenerationSuccess {
9
+ success: true;
10
+ /** @deprecated 0.3: use `submission === 'created'`. Boolean as in 0.2.x; never present on failures. */
11
+ submitted: true;
6
12
  jobId: string;
7
13
  idempotencyKey: string;
8
- status: import("./types.js").JobStatus;
9
- jobStatus: import("./types.js").JobStatus;
14
+ status: JobStatus;
15
+ jobStatus: JobStatus;
10
16
  urls: string[];
11
17
  localFile: string | undefined;
12
- download: {
13
- ok: boolean;
14
- code?: string;
15
- error?: string;
16
- httpStatus?: unknown;
17
- } | undefined;
18
- }>;
18
+ download: DownloadReport | undefined;
19
+ }
20
+ /** A local save failure must not erase a successful, billable gateway result. */
21
+ export declare function generationResult(detail: GenerationJobDetail, idempotencyKey: string, outputPath?: string, signal?: AbortSignal): Promise<GenerationSuccess>;
19
22
  //# sourceMappingURL=generation-result.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"generation-result.d.ts","sourceRoot":"","sources":["../../src/core/generation-result.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtD,iFAAiF;AACjF,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW;;;;;;;;;;YAI/G,OAAO;eAAS,MAAM;gBAAU,MAAM;qBAAe,OAAO;;GAUjF"}
1
+ {"version":3,"file":"generation-result.d.ts","sourceRoot":"","sources":["../../src/core/generation-result.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEjE,MAAM,WAAW,cAAc;IAAG,EAAE,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE;AAEnG,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,IAAI,CAAC;IACd,uGAAuG;IACvG,SAAS,EAAE,IAAI,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,SAAS,CAAC;IAClB,SAAS,EAAE,SAAS,CAAC;IACrB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,QAAQ,EAAE,cAAc,GAAG,SAAS,CAAC;CACtC;AAED,iFAAiF;AACjF,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAajK"}
@@ -1,5 +1,5 @@
1
1
  import { assertJobResult, downloadFile } from './poller.js';
2
- import { errorResult } from './error-result.js';
2
+ import { failure } from './outcome.js';
3
3
  /** A local save failure must not erase a successful, billable gateway result. */
4
4
  export async function generationResult(detail, idempotencyKey, outputPath, signal) {
5
5
  assertJobResult(detail, true);
@@ -12,9 +12,8 @@ export async function generationResult(detail, idempotencyKey, outputPath, signa
12
12
  download = { ok: true };
13
13
  }
14
14
  catch (error) {
15
- const failure = errorResult(error);
16
- download = { ok: false, code: failure.code, error: failure.error,
17
- ...(failure.httpStatus === undefined ? {} : { httpStatus: failure.httpStatus }) };
15
+ const saved = failure(error);
16
+ download = { ok: false, code: saved.code, error: saved.error, ...(saved.httpStatus === undefined ? {} : { httpStatus: saved.httpStatus }) };
18
17
  }
19
18
  }
20
19
  return { success: true, submitted: true, jobId: detail.jobId, idempotencyKey, status: detail.status, jobStatus: detail.status, urls, localFile, download };
@@ -1 +1 @@
1
- {"version":3,"file":"generation-result.js","sourceRoot":"","sources":["../../src/core/generation-result.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,iFAAiF;AACjF,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,MAA2B,EAAE,cAAsB,EAAE,UAAmB,EAAE,MAAoB;IACnI,eAAe,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC9B,MAAM,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAiB,EAAE,CAAC,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACzI,IAAI,SAA6B,CAAC;IAClC,IAAI,QAA0F,CAAC;IAC/F,IAAI,UAAU,EAAE,CAAC;QACf,IAAI,C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C,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAiB,EAAE,CAAC,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACzI,IAAI,SAA6B,CAAC;IAClC,IAAI,QAAoC,CAAC;IACzC,IAAI,UAAU,EAAE,CAAC;QACf,IAAI,CAAC;YAAC,SAAS,GAAG,MAAM,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;YAAC,QAAQ,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;QAAC,CAAC;QACpG,OAAO,KAAK,EAAE,CAAC;YACb,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;YAC7B,QAAQ,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC;QAC9I,CAAC;IACH,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;AAC7J,CAAC"}
@@ -0,0 +1,124 @@
1
+ import { LumenKeyClient } from './client.js';
2
+ import { type GenerationSuccess } from './generation-result.js';
3
+ import { type DryRunPreview } from './generation-input.js';
4
+ import { type JobSuccess, type Outcome, type QuoteSuccess, type Success, type WaitSuccess } from './outcome.js';
5
+ import { type OutputPathPolicy } from './output-path.js';
6
+ import type { GenerationJobDetail, GenerationQuoteResponse } from './types.js';
7
+ export type GenerationEvent = {
8
+ type: 'quoting';
9
+ modelId: string;
10
+ kind: 'video' | 'image';
11
+ } | {
12
+ type: 'quoted';
13
+ quote: GenerationQuoteResponse;
14
+ } | {
15
+ type: 'submitting';
16
+ quoteId: string;
17
+ credits: number;
18
+ idempotencyKey: string;
19
+ resubmit: boolean;
20
+ } | {
21
+ type: 'job_created';
22
+ jobId: string;
23
+ idempotencyKey: string;
24
+ quoteId: string;
25
+ } | {
26
+ type: 'polling';
27
+ jobId: string;
28
+ } | {
29
+ type: 'progress';
30
+ detail: GenerationJobDetail;
31
+ } | {
32
+ type: 'downloading';
33
+ jobId: string;
34
+ kind: 'video' | 'image';
35
+ }
36
+ /** A fact about the pending-submission journal the user should see on stderr (also returned as `detail`). */
37
+ | {
38
+ type: 'notice';
39
+ text: string;
40
+ };
41
+ export interface GenerationRequest {
42
+ kind: 'video' | 'image';
43
+ modelId: string;
44
+ /** Caller-supplied fields; undefined values are ignored and only catalog-declared fields are sent. */
45
+ fields: Record<string, unknown>;
46
+ /** Extra key=value pairs. */
47
+ pairs: string[];
48
+ dryRun?: boolean;
49
+ confirm?: boolean;
50
+ idempotencyKey?: string;
51
+ maxCredits?: number;
52
+ /** Surface spelling of the spending-cap option, used in its error text. */
53
+ capLabel?: string;
54
+ projectId?: string;
55
+ outputPath?: string;
56
+ /** How a relative outputPath is treated; defaults to the CLI's cwd resolution. */
57
+ outputPathPolicy?: OutputPathPolicy;
58
+ intervalMs?: number;
59
+ timeoutMs?: number;
60
+ signal?: AbortSignal;
61
+ onEvent?: (event: GenerationEvent) => void;
62
+ /** Overrides the home directory holding the pending-submission journal; tests only. */
63
+ home?: string;
64
+ }
65
+ export interface GenerationCompleted extends GenerationSuccess {
66
+ submission: 'created';
67
+ /** True when a recorded submission was re-sent instead of quoting anew. */
68
+ resumed: boolean;
69
+ quoteId: string;
70
+ /** Journal facts worth knowing even though the job was created (records seen but not resumed, a record that could not be removed). */
71
+ detail?: string;
72
+ job: GenerationJobDetail;
73
+ videoUrl?: string;
74
+ imageUrl?: string;
75
+ }
76
+ export type GenerationOutcome = Outcome<DryRunPreview | QuoteSuccess | GenerationCompleted>;
77
+ /**
78
+ * The nine gateway codes produced *only inside* the create step of `POST /v1/generation-jobs`. The
79
+ * server checks the idempotency record before that step, so a replay of an earlier unknown
80
+ * submission that is refused with one of these proves the earlier attempt never created a job (it
81
+ * would have been replayed instead). Source: `F:/光钥/docs/knowledge/hk-zh-idempotency-contract.md`
82
+ * (2026-10-12, corrected the same day; read from byte-identical copies of the live compiled server;
83
+ * not HTTP-tested). Every other refusal of a replay — authentication, rate limiting, body
84
+ * validation, any 5xx including 500 INTERNAL_ERROR — happens before the create step or is a
85
+ * catch-all, and says nothing about whether the first attempt committed.
86
+ *
87
+ * `COUNTRY_NOT_SUPPORTED` (403) is deliberately absent although the create step can produce it too:
88
+ * the authentication guard that runs before the idempotency lookup — the API-key check on the public
89
+ * route and the session check on the console route — refuses with the same code based on the request's
90
+ * country header. The client cannot tell which of the two places answered, so a replay refused with it
91
+ * proves nothing about the first attempt; the submission stays `unknown` and the record is kept.
92
+ */
93
+ export declare const REPLAY_SETTLING_CODES: readonly string[];
94
+ /**
95
+ * quote -> confirm -> create job -> poll -> finish, for every surface. Never throws: every
96
+ * exit is an Outcome, and once the job POST has been attempted every exit names the
97
+ * idempotency key, the quote and whether the submission is known to have happened.
98
+ */
99
+ export declare function runGeneration(client: LumenKeyClient, req: GenerationRequest): Promise<GenerationOutcome>;
100
+ export interface ResumeRequest {
101
+ idempotencyKey: string;
102
+ outputPath?: string;
103
+ outputPathPolicy?: OutputPathPolicy;
104
+ intervalMs?: number;
105
+ timeoutMs?: number;
106
+ signal?: AbortSignal;
107
+ onEvent?: (event: GenerationEvent) => void;
108
+ home?: string;
109
+ }
110
+ /**
111
+ * `tasks resume <key>` / `lumenkey_resume_submission`: re-send a recorded submission verbatim.
112
+ * No catalog projection runs — a delisted or changed model cannot block recovering an existing job.
113
+ * Same sender binding, same 23-hour window, same replay classification, same envelope (`resumed: true`).
114
+ */
115
+ export declare function resumeSubmission(client: LumenKeyClient, req: ResumeRequest): Promise<Outcome<GenerationCompleted>>;
116
+ export declare function readJob(client: LumenKeyClient, jobId: string): Promise<Outcome<JobSuccess>>;
117
+ export interface WaitRequest {
118
+ intervalMs?: number;
119
+ timeoutMs?: number;
120
+ signal?: AbortSignal;
121
+ }
122
+ export declare function waitJob(client: LumenKeyClient, jobId: string, req?: WaitRequest): Promise<Outcome<WaitSuccess>>;
123
+ export type { Success };
124
+ //# sourceMappingURL=generation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generation.d.ts","sourceRoot":"","sources":["../../src/core/generation.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,cAAc,EAAqD,MAAM,aAAa,CAAC;AAGtH,OAAO,EAAoB,KAAK,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAClF,OAAO,EAAuC,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEhG,OAAO,EAAuE,KAAK,UAAU,EAAE,KAAK,OAAO,EAAE,KAAK,YAAY,EAAmB,KAAK,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAEtM,OAAO,EAAqB,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAG5E,OAAO,KAAK,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAE/E,MAAM,MAAM,eAAe,GACvB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAA;CAAE,GAC7D;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,uBAAuB,CAAA;CAAE,GAClD;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;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CAgCxH;AAED,wBAAsB,OAAO,CAAC,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAOjG;AAED,MAAM,WAAW,WAAW;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,wBAAsB,OAAO,CAAC,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,GAAE,WAAgB,GAAG,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAOzH;AAED,YAAY,EAAE,OAAO,EAAE,CAAC"}
@@ -0,0 +1,316 @@
1
+ import crypto from 'node:crypto';
2
+ import { assertIdempotencyKey, LumenKeyError, validateJobId } from './client.js';
3
+ import { assertWaitOptions, pollJob } from './poller.js';
4
+ import { waitForJob } from './wait.js';
5
+ import { generationResult } from './generation-result.js';
6
+ import { buildGenerationInput, dryRunPreview } from './generation-input.js';
7
+ import { quoteCreditLimitError } from './credit-cap.js';
8
+ import { failure, jobOutcome, quoteOutcome, waitOutcome } from './outcome.js';
9
+ import { replayConflictAdvice, replaySettledAdvice, resumeCommandText, ui } from './locale.js';
10
+ import { resolveOutputPath } from './output-path.js';
11
+ import os from 'node:os';
12
+ import { ageMs, ageText, assertJournalWritable, canonical, findInputPolicyConflict, findResumablePendingSubmission, forgetPendingSubmission, isExpired, markPendingSubmissionUnknown, processAlive, rememberPendingSubmission, sameSender, takePendingSubmission } from './submission-journal.js';
13
+ /**
14
+ * The nine gateway codes produced *only inside* the create step of `POST /v1/generation-jobs`. The
15
+ * server checks the idempotency record before that step, so a replay of an earlier unknown
16
+ * submission that is refused with one of these proves the earlier attempt never created a job (it
17
+ * would have been replayed instead). Source: `F:/光钥/docs/knowledge/hk-zh-idempotency-contract.md`
18
+ * (2026-10-12, corrected the same day; read from byte-identical copies of the live compiled server;
19
+ * not HTTP-tested). Every other refusal of a replay — authentication, rate limiting, body
20
+ * validation, any 5xx including 500 INTERNAL_ERROR — happens before the create step or is a
21
+ * catch-all, and says nothing about whether the first attempt committed.
22
+ *
23
+ * `COUNTRY_NOT_SUPPORTED` (403) is deliberately absent although the create step can produce it too:
24
+ * the authentication guard that runs before the idempotency lookup — the API-key check on the public
25
+ * route and the session check on the console route — refuses with the same code based on the request's
26
+ * country header. The client cannot tell which of the two places answered, so a replay refused with it
27
+ * proves nothing about the first attempt; the submission stays `unknown` and the record is kept.
28
+ */
29
+ export const REPLAY_SETTLING_CODES = Object.freeze([
30
+ 'QUOTE_NOT_AVAILABLE',
31
+ 'QUOTE_ALREADY_CONSUMED',
32
+ 'INSUFFICIENT_CREDITS',
33
+ 'SPENDING_LIMIT_EXCEEDED',
34
+ 'ROUTE_PREFERENCE_MISMATCH',
35
+ 'QUOTE_ROUTE_AUTHORITY_INVALID',
36
+ 'MODEL_NOT_AVAILABLE',
37
+ 'ACCOUNT_NOT_ELIGIBLE',
38
+ 'RESTRICTED_GENERATION_DISABLED',
39
+ ]);
40
+ /**
41
+ * What a failed job POST proves. First attempt: the server writes record, hold and job in one
42
+ * transaction, so a business-coded 4xx (IDEMPOTENCY_CONFLICT included: *this* attempt created
43
+ * nothing) means `none`; transport loss, timeout, malformed 2xx and every 5xx mean `unknown`.
44
+ * Replay of a recorded submission: only REPLAY_SETTLING_CODES settle it as `none`.
45
+ */
46
+ function classifyCreateFailure(error, replay) {
47
+ if (!(error instanceof LumenKeyError))
48
+ return 'unknown';
49
+ if (replay)
50
+ return REPLAY_SETTLING_CODES.includes(error.code) ? 'none' : 'unknown';
51
+ // A 4xx without a parsed business code (HTML from a proxy) is not an answer from the gateway's create step.
52
+ return error.status !== undefined && error.status >= 400 && error.status < 500 && error.code !== 'API_REQUEST_FAILED' ? 'none' : 'unknown';
53
+ }
54
+ /** Same code/status/billing, more specific recovery text. */
55
+ function withAdvice(error, advice) {
56
+ return new LumenKeyError(error.code, error.status, error.retryAfterMs, `${error.publicMessage} ${advice}`, error.billing);
57
+ }
58
+ /**
59
+ * record (unless resuming) → POST → classify → journal → poll → finish. Shared by the generate
60
+ * commands and by `tasks resume`, so there is exactly one place that decides what a failed or
61
+ * successful POST means for the record and for the user's next step.
62
+ */
63
+ async function submitAndFinish(client, plan, journal) {
64
+ const { ctx, emit, notices, note } = journal;
65
+ const { quoteId, credits, projectId, input, idempotencyKey, pending } = plan;
66
+ ctx.idempotencyKey = idempotencyKey;
67
+ ctx.quoteId = quoteId;
68
+ ctx.resumed = Boolean(pending);
69
+ ctx.recordedAt = pending?.createdAt;
70
+ if (!pending) {
71
+ ctx.recordedAt = new Date().toISOString();
72
+ rememberPendingSubmission({ ...plan.identity, idempotencyKey, quoteId, projectId, kind: plan.kind, modelId: plan.modelId, input, callerInput: plan.callerInput, credits, createdAt: ctx.recordedAt }, plan.home);
73
+ }
74
+ emit({ type: 'submitting', quoteId, credits, idempotencyKey, resubmit: Boolean(pending) });
75
+ ctx.submission = 'unknown';
76
+ const journalNote = (error) => note(error instanceof Error ? error.message : String(error));
77
+ let created;
78
+ try {
79
+ created = await client.createJob({ quoteId, projectId, input }, idempotencyKey);
80
+ }
81
+ catch (error) {
82
+ ctx.submission = classifyCreateFailure(error, Boolean(pending));
83
+ if (ctx.submission === 'none') {
84
+ // Definite for this attempt: remove our own record (compare-then-unlink; a sibling's record under the same key survives).
85
+ try {
86
+ forgetPendingSubmission(idempotencyKey, quoteId, plan.home);
87
+ }
88
+ catch (journalError) {
89
+ journalNote(journalError);
90
+ }
91
+ }
92
+ else {
93
+ // Make the record resumable without the key, and let the advice describe what is really on disk:
94
+ // marked and still inside the window → a rerun resumes; marked but already past the window → it will not;
95
+ // gone → the ledger; could not be marked → the resume command reaches an in-flight record.
96
+ try {
97
+ const marked = markPendingSubmissionUnknown(idempotencyKey, plan.home);
98
+ ctx.recovery = !marked ? 'ledger' : isExpired(marked) ? 'expired' : 'rerun';
99
+ }
100
+ catch (journalError) {
101
+ ctx.recovery = 'resume-command';
102
+ journalNote(journalError);
103
+ }
104
+ }
105
+ if (notices.length)
106
+ ctx.detail = notices.join(' ');
107
+ if (pending && error instanceof LumenKeyError) {
108
+ if (error.code === 'QUOTE_NOT_AVAILABLE')
109
+ throw withAdvice(error, replaySettledAdvice());
110
+ if (error.code === 'IDEMPOTENCY_CONFLICT')
111
+ throw withAdvice(error, replayConflictAdvice());
112
+ }
113
+ throw error;
114
+ }
115
+ // The job exists: say so before touching the journal; a failed delete can never replace this outcome.
116
+ ctx.submission = 'created';
117
+ ctx.jobId = created.jobId;
118
+ emit({ type: 'job_created', jobId: created.jobId, idempotencyKey, quoteId });
119
+ try {
120
+ forgetPendingSubmission(idempotencyKey, quoteId, plan.home);
121
+ }
122
+ catch (journalError) {
123
+ journalNote(journalError);
124
+ }
125
+ if (notices.length)
126
+ ctx.detail = notices.join(' ');
127
+ emit({ type: 'polling', jobId: created.jobId });
128
+ const detail = await pollJob(client, created.jobId, {
129
+ initialIntervalMs: plan.intervalMs, timeoutMs: plan.timeoutMs, signal: plan.signal,
130
+ onProgress: row => emit({ type: 'progress', detail: row }),
131
+ });
132
+ if (plan.outputPath)
133
+ emit({ type: 'downloading', jobId: created.jobId, kind: plan.kind });
134
+ const result = await generationResult(detail, idempotencyKey, plan.outputPath, plan.signal);
135
+ return { ok: true, ...result, submission: 'created', resumed: Boolean(pending), quoteId, job: detail,
136
+ ...(notices.length ? { detail: notices.join(' ') } : {}),
137
+ ...(plan.kind === 'video' ? { videoUrl: result.urls[0] } : { imageUrl: result.urls[0] }) };
138
+ }
139
+ function newJournal(ctx, onEvent) {
140
+ const emit = (event) => onEvent?.(event);
141
+ const notices = [];
142
+ return { ctx, emit, notices, note: text => { notices.push(text); emit({ type: 'notice', text }); } };
143
+ }
144
+ /** A record of another account or gateway: send nothing, leave it to its owner. */
145
+ function assertOwnRecord(record, identity, suppliedKey) {
146
+ if (!sameSender(record, identity)) {
147
+ throw Object.assign(new LumenKeyError('SUBMISSION_CREDENTIALS_MISMATCH'), { idempotencyKey: suppliedKey ?? record.idempotencyKey, quoteId: record.quoteId });
148
+ }
149
+ }
150
+ /** Past the resumable window the gateway may have dropped its record; a replay could be misread as "never created". */
151
+ function assertNotExpired(record) {
152
+ if (isExpired(record))
153
+ throw Object.assign(new LumenKeyError('SUBMISSION_RECORD_EXPIRED'), { idempotencyKey: record.idempotencyKey, quoteId: record.quoteId });
154
+ }
155
+ function pendingRecordRemainsNote(pending) {
156
+ return ui(`A pending submission with idempotency key ${pending.idempotencyKey} (quote ${pending.quoteId}, ${pending.credits} credits) is still recorded and was not re-sent; raise the cap or check your job list and balance.`, `幂等键 ${pending.idempotencyKey} 的待确认提交(报价 ${pending.quoteId},${pending.credits} 算力点)仍有记录且未重发;请提高上限,或核对任务列表与余额。`);
157
+ }
158
+ /**
159
+ * quote -> confirm -> create job -> poll -> finish, for every surface. Never throws: every
160
+ * exit is an Outcome, and once the job POST has been attempted every exit names the
161
+ * idempotency key, the quote and whether the submission is known to have happened.
162
+ */
163
+ export async function runGeneration(client, req) {
164
+ const ctx = {};
165
+ const journal = newJournal(ctx, req.onEvent);
166
+ const { emit, note } = journal;
167
+ const capLabel = req.capLabel ?? '--max-credits';
168
+ try {
169
+ // Once a confirm is requested, every outcome says what happened to the submission.
170
+ if (req.confirm)
171
+ ctx.submission = 'none';
172
+ client.requireKey();
173
+ if (req.idempotencyKey !== undefined)
174
+ assertIdempotencyKey(req.idempotencyKey);
175
+ assertWaitOptions(req.intervalMs, req.timeoutMs);
176
+ // Resolve the save path before anything billable so a bad path cannot cost a quote or a job.
177
+ const outputPath = req.outputPath === undefined ? undefined : resolveOutputPath(req.outputPath, req.outputPathPolicy ?? 'resolve-cwd');
178
+ const built = await buildGenerationInput(client, req.modelId, req.fields, req.pairs);
179
+ if (req.dryRun)
180
+ return { ok: true, ...dryRunPreview(req.modelId, built.input, built.model, req.confirm) };
181
+ // Recovery instead of a new quote under a new fingerprint:
182
+ // - an explicit key with a pending record (any state) re-sends that record unchanged;
183
+ // - otherwise an unconfirmed record for exactly this sender, model and input is resumed — even when
184
+ // a *different* explicit key was supplied, because a script that mints a key per attempt is still
185
+ // retrying the same submission; the supplied key is then not used and the outcome says so.
186
+ // Records are bound to the account and gateway that created them.
187
+ const identity = req.confirm ? client.senderIdentity() : undefined;
188
+ // Prove the journal is writable before buying a quote, so a refused submission never orphans one.
189
+ if (req.confirm)
190
+ assertJournalWritable(req.home);
191
+ let pending;
192
+ if (req.confirm && identity) {
193
+ // Preserve the explicit-key expiry notice before the policy scan sweeps old records.
194
+ // No request is sent here; the changed-input guard still runs before replay or a new quote.
195
+ if (req.idempotencyKey !== undefined) {
196
+ const taken = takePendingSubmission(req.idempotencyKey, req.home);
197
+ pending = taken.record;
198
+ if (taken.discarded)
199
+ note(ui(`An earlier submission recorded under idempotency key ${req.idempotencyKey} ${ageText(taken.discarded)} is older than 48 hours and can no longer be verified from here; its record was discarded. Check your job list and balance if that submission matters before continuing under this key.`, `幂等键 ${req.idempotencyKey} 下${ageText(taken.discarded)}记录的一次提交已超过 48 小时,无法再从这里核实,记录已丢弃。若那次提交重要,请先核对任务列表与余额,再继续使用该键。`));
200
+ }
201
+ const changed = findInputPolicyConflict(identity, req.modelId, built.input, built.callerInput, built.defaults, req.home, built.legacyCallerInput);
202
+ if (changed) {
203
+ // No quote, no POST, no rewritten journal. The explicit recovery verb alone replays the
204
+ // historical body, and keeps its existing sender binding and 23-hour safety window.
205
+ const advice = isExpired(changed) ? ui('Its replay window has expired; check your job list and balance instead of retrying it.', '该记录已超过安全重放窗口,请核对任务列表和余额,不要重新提交。') : ui(`Use ${resumeCommandText(changed.idempotencyKey, 'en')} to recover the recorded body verbatim.`, `请用 ${resumeCommandText(changed.idempotencyKey, 'zh')} 原样恢复已有提交。`);
206
+ throw Object.assign(new LumenKeyError('SUBMISSION_INPUT_POLICY_CHANGED', undefined, undefined, ui(`Catalog defaults or client input rules changed an unconfirmed submission (key ${changed.idempotencyKey}, quote ${changed.quoteId}). No new quote or job was sent. ${advice}`, `目录默认值或客户端入参规则使待确认提交的输入发生变化(键 ${changed.idempotencyKey},报价 ${changed.quoteId})。没有发送新报价或新任务。${advice}`)), { ...(req.idempotencyKey !== undefined ? { idempotencyKey: req.idempotencyKey } : {}), pendingIdempotencyKey: changed.idempotencyKey,
207
+ pendingQuoteId: changed.quoteId, pendingRecordedAt: changed.createdAt, pendingAgeSeconds: Math.floor(ageMs(changed) / 1000) });
208
+ }
209
+ if (!pending) {
210
+ const lookup = findResumablePendingSubmission(identity, req.modelId, canonical(built.input), req.home);
211
+ for (const text of lookup.notices)
212
+ note(text);
213
+ if (lookup.record && req.idempotencyKey !== undefined) {
214
+ // An explicit key means "this is a distinct request": the client neither overrides it nor creates a second
215
+ // identical job while an identical submission is unconfirmed. Refuse, and name the pending record structurally.
216
+ const pendingRecord = lookup.record;
217
+ throw Object.assign(new LumenKeyError('SUBMISSION_PENDING_IDENTICAL', undefined, undefined, ui(`An identical submission is already recorded and unconfirmed under idempotency key ${pendingRecord.idempotencyKey} (quote ${pendingRecord.quoteId}, recorded ${ageText(pendingRecord)}). Nothing was sent under key ${req.idempotencyKey}. Settle it first with ${resumeCommandText(pendingRecord.idempotencyKey, 'en')}; a second identical job cannot be created until then, or until the record expires 23 hours after it was recorded.`, `已有一次相同的提交以幂等键 ${pendingRecord.idempotencyKey} 记录且结果未确认(报价 ${pendingRecord.quoteId},记录于${ageText(pendingRecord)})。没有用键 ${req.idempotencyKey} 发送任何内容。请先运行 ${resumeCommandText(pendingRecord.idempotencyKey, 'zh')} 处理它;在它处理完或记录后 23 小时过期之前,无法创建第二个相同的任务。`)), { idempotencyKey: req.idempotencyKey, pendingIdempotencyKey: pendingRecord.idempotencyKey, pendingQuoteId: pendingRecord.quoteId, pendingRecordedAt: pendingRecord.createdAt, pendingAgeSeconds: Math.floor(ageMs(pendingRecord) / 1000) });
218
+ }
219
+ pending = lookup.record;
220
+ }
221
+ }
222
+ if (pending && identity) {
223
+ assertOwnRecord(pending, identity, req.idempotencyKey);
224
+ assertNotExpired(pending);
225
+ }
226
+ let quoteId;
227
+ let credits;
228
+ let projectId;
229
+ let input;
230
+ if (pending) {
231
+ if (pending.modelId !== req.modelId || canonical(pending.input) !== canonical(built.input)) {
232
+ throw Object.assign(new LumenKeyError('SUBMISSION_RETRY_MISMATCH', undefined, undefined, ui(`This idempotency key belongs to a pending submission with a different model or input. Nothing was submitted. Recorded: model ${pending.modelId}, input ${canonical(pending.input)}. Given: model ${req.modelId}, input ${canonical(built.input)}. To re-send the recorded submission as recorded (for example after a catalog change), run ${resumeCommandText(pending.idempotencyKey, 'en')}.`, `该幂等键对应一条待确认的提交,但模型或输入与这次不同。没有提交任何任务。记录:模型 ${pending.modelId},输入 ${canonical(pending.input)}。这次:模型 ${req.modelId},输入 ${canonical(built.input)}。要原样重发记录的提交(例如目录变更后),请运行 ${resumeCommandText(pending.idempotencyKey, 'zh')}。`)), { idempotencyKey: pending.idempotencyKey, quoteId: pending.quoteId });
233
+ }
234
+ ({ quoteId, credits, projectId, input } = pending);
235
+ if (req.maxCredits !== undefined && credits > req.maxCredits) {
236
+ throw Object.assign(quoteCreditLimitError(capLabel), { idempotencyKey: pending.idempotencyKey, quoteId, detail: pendingRecordRemainsNote(pending) });
237
+ }
238
+ }
239
+ else {
240
+ emit({ type: 'quoting', modelId: req.modelId, kind: req.kind });
241
+ const quote = await client.getQuote({ modelId: req.modelId, input: built.input });
242
+ emit({ type: 'quoted', quote });
243
+ if (req.maxCredits !== undefined && quote.credits > req.maxCredits)
244
+ throw quoteCreditLimitError(capLabel);
245
+ if (!req.confirm)
246
+ return quoteOutcome(quote);
247
+ quoteId = quote.quoteId;
248
+ credits = quote.credits;
249
+ projectId = client.resolveProjectId(req.projectId);
250
+ input = built.input;
251
+ }
252
+ return await submitAndFinish(client, {
253
+ kind: req.kind, modelId: req.modelId, quoteId, credits, projectId, input, callerInput: built.callerInput, pending,
254
+ idempotencyKey: pending?.idempotencyKey ?? req.idempotencyKey ?? crypto.randomUUID(),
255
+ identity: identity, outputPath, intervalMs: req.intervalMs, timeoutMs: req.timeoutMs, signal: req.signal, home: req.home,
256
+ }, journal);
257
+ }
258
+ catch (error) {
259
+ return failure(error, ctx);
260
+ }
261
+ }
262
+ /**
263
+ * `tasks resume <key>` / `lumenkey_resume_submission`: re-send a recorded submission verbatim.
264
+ * No catalog projection runs — a delisted or changed model cannot block recovering an existing job.
265
+ * Same sender binding, same 23-hour window, same replay classification, same envelope (`resumed: true`).
266
+ */
267
+ export async function resumeSubmission(client, req) {
268
+ const ctx = { submission: 'none', resumed: true };
269
+ const journal = newJournal(ctx, req.onEvent);
270
+ try {
271
+ client.requireKey();
272
+ assertIdempotencyKey(req.idempotencyKey);
273
+ assertWaitOptions(req.intervalMs, req.timeoutMs);
274
+ const outputPath = req.outputPath === undefined ? undefined : resolveOutputPath(req.outputPath, req.outputPathPolicy ?? 'resolve-cwd');
275
+ const identity = client.senderIdentity();
276
+ assertJournalWritable(req.home);
277
+ const taken = takePendingSubmission(req.idempotencyKey, req.home);
278
+ if (!taken.record) {
279
+ throw Object.assign(new LumenKeyError('SUBMISSION_RECORD_NOT_FOUND', undefined, undefined, taken.discarded
280
+ ? ui(`${ui('No pending submission is recorded under this idempotency key for this account and gateway.', '这个账号和网关下没有以该幂等键记录的待确认提交。')} An earlier record under this key (${ageText(taken.discarded)}) was older than 48 hours and was discarded; check your job list and balance.`, `这个账号和网关下没有以该幂等键记录的待确认提交。该键下更早的记录(${ageText(taken.discarded)})已超过 48 小时并被丢弃;请核对任务列表与余额。`)
281
+ : undefined), { idempotencyKey: req.idempotencyKey });
282
+ }
283
+ const record = taken.record;
284
+ assertOwnRecord(record, identity, req.idempotencyKey);
285
+ assertNotExpired(record);
286
+ if (record.state === 'in-flight' && record.hostname === os.hostname() && record.pid !== process.pid && processAlive(record.pid)) {
287
+ journal.note(ui(`The process that recorded this submission (pid ${record.pid}) is still alive; resuming anyway. The same key and body are re-sent, so the gateway replays or refuses and never creates a second job.`, `记录这次提交的进程(pid ${record.pid})仍在运行;仍然继续接续。重发的是同一个键和请求体,网关只会回放或拒绝,不会创建第二个任务。`));
288
+ }
289
+ return await submitAndFinish(client, {
290
+ kind: record.kind, modelId: record.modelId, quoteId: record.quoteId, credits: record.credits, projectId: record.projectId, input: record.input, pending: record,
291
+ idempotencyKey: record.idempotencyKey, identity, outputPath, intervalMs: req.intervalMs, timeoutMs: req.timeoutMs, signal: req.signal, home: req.home,
292
+ }, journal);
293
+ }
294
+ catch (error) {
295
+ return failure(error, ctx);
296
+ }
297
+ }
298
+ export async function readJob(client, jobId) {
299
+ try {
300
+ validateJobId(jobId);
301
+ return jobOutcome(await client.getJob(jobId));
302
+ }
303
+ catch (error) {
304
+ return failure(error);
305
+ }
306
+ }
307
+ export async function waitJob(client, jobId, req = {}) {
308
+ try {
309
+ validateJobId(jobId);
310
+ return waitOutcome(await waitForJob(client, jobId, req));
311
+ }
312
+ catch (error) {
313
+ return failure(error, { jobId });
314
+ }
315
+ }
316
+ //# sourceMappingURL=generation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generation.js","sourceRoot":"","sources":["../../src/core/generation.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,oBAAoB,EAAkB,aAAa,EAAE,aAAa,EAAuB,MAAM,aAAa,CAAC;AACtH,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAA0B,MAAM,wBAAwB,CAAC;AAClF,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAsB,MAAM,uBAAuB,CAAC;AAChG,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAA0H,MAAM,cAAc,CAAC;A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a,EAAE,MAAmB,EAAE;IACxF,IAAI,CAAC;QACH,aAAa,CAAC,KAAK,CAAC,CAAC;QACrB,OAAO,WAAW,CAAC,MAAM,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;IAC3D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,OAAO,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IACnC,CAAC;AACH,CAAC"}
@@ -19,8 +19,29 @@ export declare function idempotencyKeyMessages(lang?: Lang): {
19
19
  };
20
20
  export declare function ui(en: string, zh: string, lang?: Lang): string;
21
21
  export declare function waitTimeoutDetail(jobId: string, timeoutMs: number, lang?: Lang): string;
22
+ export declare function waitInterruptedDetail(jobId: string, lang?: Lang): string;
23
+ /**
24
+ * A job POST was sent but no well-formed answer came back: the gateway may hold a job and credits
25
+ * for this key. The recovery step depends on what is actually on disk: a record marked unknown is
26
+ * resumed by rerunning; a record still in flight needs the explicit key; no record means the ledger.
27
+ */
28
+ export type UnknownRecovery = 'rerun' | 'resume-command' | 'expired' | 'ledger';
29
+ /** Local display only; recovery's machine deadline stays ISO UTC in the outcome. */
30
+ export declare function submissionUnknownMessage(recovery: UnknownRecovery, deadline?: Date, lang?: Lang): string;
31
+ /** The recovery verb on both surfaces, named wherever a keyless rerun will not do. */
32
+ export declare function resumeCommandText(idempotencyKey: string, lang?: Lang): string;
33
+ export declare function submissionUnknownAdvice(idempotencyKey: string, recovery?: UnknownRecovery, recordedAt?: string, lang?: Lang): string;
34
+ /** A replay was refused inside the gateway's create step, which is only reached when no job exists for the key. */
35
+ export declare function replaySettledAdvice(lang?: Lang): string;
36
+ /** A replay met a record for the same key with a different body: the earlier job exists, but this client cannot see it. */
37
+ export declare function replayConflictAdvice(lang?: Lang): string;
38
+ /** Chat requests are replayed by key, so the safe retry is the identical request with the same key. */
39
+ export declare function chatRetryAdvice(idempotencyKey: string, lang?: Lang): string;
40
+ export declare function downloadPathNotAbsoluteDetail(lang?: Lang): string;
22
41
  export declare function jobStatusText(status: string, lang?: Lang): string;
23
42
  export declare function blankPromptSentence(kind: 'flag' | 'field' | 'user', lang?: Lang): string;
43
+ /** Surface-neutral: neither a CLI flag nor an MCP field is named. */
44
+ export declare function promptRequiredSentence(lang?: Lang): string;
24
45
  export declare function spendingCapSentence(label: string, lang?: Lang): string;
25
46
  export declare function quoteCapSentence(label: string, lang?: Lang): string;
26
47
  export declare function internalUpstreamError(text: string): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"locale.d.ts","sourceRoot":"","sources":["../../src/core/locale.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AA8L/B,wBAAgB,QAAQ,CAAC,IAAI,GAAE,SAAS,MAAM,EAAiB,GAAG,MAAM,GAAG,SAAS,CASnF;AAUD,sGAAsG;AACtG,wBAAgB,WAAW,CAAC,IAAI,GAAE,SAAS,MAAM,EAAiB,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,IAAI,CAQ9G;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEtD;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,IAAoB,GAAG,MAAM,CAG9E;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,IAAoB,GAAG,MAAM,CAI1F;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,IAAoB,GAAG,MAAM,CAIxF;AAED,wBAAgB,2BAA2B,CAAC,IAAI,GAAE,IAAoB,GAAG,MAAM,CAI9E;AAID,0GAA0G;AAC1G,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAErD;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,GAAE,IAAoB,GAAG,MAAM,CAKvF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