llm-cli-gateway 2.13.2 → 2.14.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/CHANGELOG.md +139 -0
- package/README.md +68 -29
- package/dist/acp/client.d.ts +29 -1
- package/dist/acp/client.js +78 -4
- package/dist/acp/errors.d.ts +9 -1
- package/dist/acp/errors.js +19 -0
- package/dist/acp/event-normalizer.d.ts +12 -0
- package/dist/acp/event-normalizer.js +16 -0
- package/dist/acp/flight-redaction.d.ts +3 -0
- package/dist/acp/flight-redaction.js +3 -0
- package/dist/acp/permission-bridge.js +11 -5
- package/dist/acp/process-manager.d.ts +2 -1
- package/dist/acp/process-manager.js +43 -4
- package/dist/acp/provider-registry.js +19 -11
- package/dist/acp/runtime.d.ts +8 -0
- package/dist/acp/runtime.js +47 -4
- package/dist/acp/types.d.ts +3083 -55
- package/dist/acp/types.js +242 -5
- package/dist/async-job-manager.d.ts +38 -1
- package/dist/async-job-manager.js +287 -20
- package/dist/codex-json-parser.d.ts +1 -0
- package/dist/codex-json-parser.js +6 -0
- package/dist/config.d.ts +19 -0
- package/dist/config.js +84 -1
- package/dist/flight-recorder.d.ts +2 -0
- package/dist/flight-recorder.js +20 -0
- package/dist/gemini-json-parser.d.ts +2 -0
- package/dist/gemini-json-parser.js +45 -8
- package/dist/grok-json-parser.d.ts +14 -0
- package/dist/grok-json-parser.js +156 -0
- package/dist/index.d.ts +47 -2
- package/dist/index.js +504 -122
- package/dist/job-store.d.ts +119 -11
- package/dist/job-store.js +372 -42
- package/dist/model-registry.d.ts +1 -0
- package/dist/model-registry.js +46 -0
- package/dist/oauth.js +2 -2
- package/dist/postgres-job-store-worker.d.ts +1 -0
- package/dist/postgres-job-store-worker.js +444 -0
- package/dist/pricing.d.ts +3 -2
- package/dist/provider-acp-capabilities.d.ts +52 -0
- package/dist/provider-acp-capabilities.js +101 -0
- package/dist/provider-admin-tools.d.ts +100 -0
- package/dist/provider-admin-tools.js +572 -0
- package/dist/provider-capability-cache.d.ts +46 -0
- package/dist/provider-capability-cache.js +248 -0
- package/dist/provider-capability-discovery.d.ts +85 -0
- package/dist/provider-capability-discovery.js +461 -0
- package/dist/provider-capability-resolver.d.ts +29 -0
- package/dist/provider-capability-resolver.js +92 -0
- package/dist/provider-definition-assertions.d.ts +9 -0
- package/dist/provider-definition-assertions.js +147 -0
- package/dist/provider-definitions.d.ts +127 -0
- package/dist/provider-definitions.js +758 -0
- package/dist/provider-help-parser.d.ts +34 -0
- package/dist/provider-help-parser.js +203 -0
- package/dist/provider-model-discovery.d.ts +30 -0
- package/dist/provider-model-discovery.js +229 -0
- package/dist/provider-output-metadata.d.ts +7 -0
- package/dist/provider-output-metadata.js +68 -0
- package/dist/provider-schema-builder.d.ts +22 -0
- package/dist/provider-schema-builder.js +55 -0
- package/dist/provider-surface-generator.d.ts +98 -0
- package/dist/provider-surface-generator.js +140 -0
- package/dist/provider-tool-capabilities.d.ts +3 -2
- package/dist/provider-tool-capabilities.js +77 -62
- package/dist/request-helpers.d.ts +37 -4
- package/dist/request-helpers.js +134 -0
- package/dist/resources.d.ts +6 -1
- package/dist/resources.js +64 -192
- package/dist/session-manager.js +18 -11
- package/dist/sqlite-driver.d.ts +1 -1
- package/dist/sqlite-driver.js +2 -1
- package/dist/stream-json-parser.d.ts +1 -0
- package/dist/stream-json-parser.js +3 -0
- package/dist/upstream-contracts.d.ts +17 -1
- package/dist/upstream-contracts.js +209 -36
- package/npm-shrinkwrap.json +2 -2
- package/package.json +8 -3
package/dist/job-store.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Logger } from "./logger.js";
|
|
2
2
|
import type { PersistenceConfig } from "./config.js";
|
|
3
|
-
export type JobStoreStatus = "running" | "completed" | "failed" | "canceled" | "orphaned";
|
|
3
|
+
export type JobStoreStatus = "queued" | "running" | "completed" | "failed" | "canceled" | "orphaned";
|
|
4
|
+
export type JobStoreActiveStatus = Extract<JobStoreStatus, "queued" | "running">;
|
|
4
5
|
export type JobTransport = "process" | "http";
|
|
5
6
|
export interface JobRecord {
|
|
6
7
|
id: string;
|
|
@@ -23,11 +24,26 @@ export interface JobRecord {
|
|
|
23
24
|
transport: JobTransport;
|
|
24
25
|
httpStatus: number | null;
|
|
25
26
|
payloadJson: string | null;
|
|
27
|
+
ownerInstance: string | null;
|
|
28
|
+
leaseDeadline: number | null;
|
|
26
29
|
}
|
|
27
30
|
export declare function resolveJobStoreDbPath(): string | null;
|
|
28
31
|
export declare function resolveJobRetentionMs(): number;
|
|
29
32
|
export declare function resolveDedupWindowMs(): number;
|
|
30
33
|
export declare function computeRequestKey(cli: string, args: string[], extra?: string): string;
|
|
34
|
+
export interface GatewayInstanceMeta {
|
|
35
|
+
instanceId: string;
|
|
36
|
+
role: string | null;
|
|
37
|
+
hostname: string | null;
|
|
38
|
+
pid: number | null;
|
|
39
|
+
}
|
|
40
|
+
export interface SweepCandidate {
|
|
41
|
+
id: string;
|
|
42
|
+
pid: number | null;
|
|
43
|
+
transport: JobTransport;
|
|
44
|
+
ownerInstance: string | null;
|
|
45
|
+
hostname: string | null;
|
|
46
|
+
}
|
|
31
47
|
export interface JobStore {
|
|
32
48
|
recordStart(input: {
|
|
33
49
|
id: string;
|
|
@@ -39,13 +55,23 @@ export interface JobStore {
|
|
|
39
55
|
startedAt: string;
|
|
40
56
|
pid: number | null;
|
|
41
57
|
ownerPrincipal?: string | null;
|
|
58
|
+
ownerInstance?: string | null;
|
|
42
59
|
transport?: JobTransport;
|
|
43
60
|
payloadJson?: string | null;
|
|
44
61
|
}): void;
|
|
62
|
+
markRunning(id: string, opts: {
|
|
63
|
+
pid: number | null;
|
|
64
|
+
}): boolean;
|
|
65
|
+
registerInstance(meta: GatewayInstanceMeta): void;
|
|
66
|
+
heartbeat(instanceId: string): void;
|
|
67
|
+
deregisterInstance(instanceId: string): void;
|
|
68
|
+
selectStaleProcessCandidates(leaseTtlMs: number, httpJobGraceMs: number): SweepCandidate[];
|
|
69
|
+
recoverStaleJobs(leaseTtlMs: number, httpJobGraceMs: number, liveConfirmedIds?: string[]): OrphanedJobSnapshot[];
|
|
70
|
+
gcInstances(instanceGcMs: number): number;
|
|
45
71
|
recordOutput(id: string, stdout: string, stderr: string, outputTruncated: boolean): void;
|
|
46
72
|
recordComplete(input: {
|
|
47
73
|
id: string;
|
|
48
|
-
status: Exclude<JobStoreStatus, "running">;
|
|
74
|
+
status: Exclude<JobStoreStatus, "running" | "queued">;
|
|
49
75
|
exitCode: number | null;
|
|
50
76
|
stdout: string;
|
|
51
77
|
stderr: string;
|
|
@@ -117,6 +143,7 @@ export declare class SqliteJobStore implements JobStore, ValidationRunStore {
|
|
|
117
143
|
private db;
|
|
118
144
|
private retentionMs;
|
|
119
145
|
private dedupWindowMs;
|
|
146
|
+
private leaseTtlMs;
|
|
120
147
|
private insertStmt;
|
|
121
148
|
private updateOutputStmt;
|
|
122
149
|
private updateCompleteStmt;
|
|
@@ -125,9 +152,19 @@ export declare class SqliteJobStore implements JobStore, ValidationRunStore {
|
|
|
125
152
|
private selectRunningOrphansStmt;
|
|
126
153
|
private markOrphanedStmt;
|
|
127
154
|
private deleteExpiredStmt;
|
|
155
|
+
private markRunningStmt;
|
|
156
|
+
private registerInstanceStmt;
|
|
157
|
+
private heartbeatInstanceStmt;
|
|
158
|
+
private heartbeatJobsStmt;
|
|
159
|
+
private deregisterInstanceStmt;
|
|
160
|
+
private selectStaleCandidatesStmt;
|
|
161
|
+
private orphanExpiredStmt;
|
|
162
|
+
private advanceLeaseStmt;
|
|
163
|
+
private gcInstancesStmt;
|
|
128
164
|
constructor(dbPath: string, logger?: Logger, options?: {
|
|
129
165
|
retentionMs?: number;
|
|
130
166
|
dedupWindowMs?: number;
|
|
167
|
+
leaseTtlMs?: number;
|
|
131
168
|
});
|
|
132
169
|
recordStart(input: {
|
|
133
170
|
id: string;
|
|
@@ -139,13 +176,23 @@ export declare class SqliteJobStore implements JobStore, ValidationRunStore {
|
|
|
139
176
|
startedAt: string;
|
|
140
177
|
pid: number | null;
|
|
141
178
|
ownerPrincipal?: string | null;
|
|
179
|
+
ownerInstance?: string | null;
|
|
142
180
|
transport?: JobTransport;
|
|
143
181
|
payloadJson?: string | null;
|
|
144
182
|
}): void;
|
|
183
|
+
markRunning(id: string, opts: {
|
|
184
|
+
pid: number | null;
|
|
185
|
+
}): boolean;
|
|
186
|
+
registerInstance(meta: GatewayInstanceMeta): void;
|
|
187
|
+
heartbeat(instanceId: string): void;
|
|
188
|
+
deregisterInstance(instanceId: string): void;
|
|
189
|
+
selectStaleProcessCandidates(_leaseTtlMs: number, _httpJobGraceMs: number): SweepCandidate[];
|
|
190
|
+
recoverStaleJobs(leaseTtlMs: number, httpJobGraceMs: number, liveConfirmedIds?: string[]): OrphanedJobSnapshot[];
|
|
191
|
+
gcInstances(instanceGcMs: number): number;
|
|
145
192
|
recordOutput(id: string, stdout: string, stderr: string, outputTruncated: boolean): void;
|
|
146
193
|
recordComplete(input: {
|
|
147
194
|
id: string;
|
|
148
|
-
status: Exclude<JobStoreStatus, "running">;
|
|
195
|
+
status: Exclude<JobStoreStatus, "running" | "queued">;
|
|
149
196
|
exitCode: number | null;
|
|
150
197
|
stdout: string;
|
|
151
198
|
stderr: string;
|
|
@@ -176,9 +223,11 @@ export declare class MemoryJobStore implements JobStore {
|
|
|
176
223
|
private rows;
|
|
177
224
|
private retentionMs;
|
|
178
225
|
private dedupWindowMs;
|
|
226
|
+
private leaseTtlMs;
|
|
179
227
|
constructor(options?: {
|
|
180
228
|
retentionMs?: number;
|
|
181
229
|
dedupWindowMs?: number;
|
|
230
|
+
leaseTtlMs?: number;
|
|
182
231
|
});
|
|
183
232
|
recordStart(input: {
|
|
184
233
|
id: string;
|
|
@@ -190,13 +239,23 @@ export declare class MemoryJobStore implements JobStore {
|
|
|
190
239
|
startedAt: string;
|
|
191
240
|
pid: number | null;
|
|
192
241
|
ownerPrincipal?: string | null;
|
|
242
|
+
ownerInstance?: string | null;
|
|
193
243
|
transport?: JobTransport;
|
|
194
244
|
payloadJson?: string | null;
|
|
195
245
|
}): void;
|
|
246
|
+
markRunning(id: string, opts: {
|
|
247
|
+
pid: number | null;
|
|
248
|
+
}): boolean;
|
|
249
|
+
registerInstance(_meta: GatewayInstanceMeta): void;
|
|
250
|
+
heartbeat(instanceId: string): void;
|
|
251
|
+
deregisterInstance(_instanceId: string): void;
|
|
252
|
+
selectStaleProcessCandidates(_leaseTtlMs: number, _httpJobGraceMs: number): SweepCandidate[];
|
|
253
|
+
recoverStaleJobs(_leaseTtlMs: number, _httpJobGraceMs: number, _liveConfirmedIds?: string[]): OrphanedJobSnapshot[];
|
|
254
|
+
gcInstances(_instanceGcMs: number): number;
|
|
196
255
|
recordOutput(id: string, stdout: string, stderr: string, outputTruncated: boolean): void;
|
|
197
256
|
recordComplete(input: {
|
|
198
257
|
id: string;
|
|
199
|
-
status: Exclude<JobStoreStatus, "running">;
|
|
258
|
+
status: Exclude<JobStoreStatus, "running" | "queued">;
|
|
200
259
|
exitCode: number | null;
|
|
201
260
|
stdout: string;
|
|
202
261
|
stderr: string;
|
|
@@ -214,18 +273,67 @@ export declare class MemoryJobStore implements JobStore {
|
|
|
214
273
|
evictExpired(): number;
|
|
215
274
|
close(): void;
|
|
216
275
|
}
|
|
217
|
-
export declare class PostgresJobStore implements JobStore {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
276
|
+
export declare class PostgresJobStore implements JobStore, ValidationRunStore {
|
|
277
|
+
private logger;
|
|
278
|
+
private worker;
|
|
279
|
+
private tmpDir;
|
|
280
|
+
private nextRequestId;
|
|
281
|
+
private closed;
|
|
282
|
+
constructor(dsn: string, logger?: Logger, options?: {
|
|
283
|
+
retentionMs?: number;
|
|
284
|
+
dedupWindowMs?: number;
|
|
285
|
+
leaseTtlMs?: number;
|
|
286
|
+
});
|
|
287
|
+
private syncCall;
|
|
288
|
+
recordStart(input: {
|
|
289
|
+
id: string;
|
|
290
|
+
correlationId: string;
|
|
291
|
+
requestKey: string;
|
|
292
|
+
cli: string;
|
|
293
|
+
args: string[];
|
|
294
|
+
outputFormat?: string;
|
|
295
|
+
startedAt: string;
|
|
296
|
+
pid: number | null;
|
|
297
|
+
ownerPrincipal?: string | null;
|
|
298
|
+
ownerInstance?: string | null;
|
|
299
|
+
transport?: JobTransport;
|
|
300
|
+
payloadJson?: string | null;
|
|
301
|
+
}): void;
|
|
302
|
+
markRunning(id: string, opts: {
|
|
303
|
+
pid: number | null;
|
|
304
|
+
}): boolean;
|
|
305
|
+
registerInstance(meta: GatewayInstanceMeta): void;
|
|
306
|
+
heartbeat(instanceId: string): void;
|
|
307
|
+
deregisterInstance(instanceId: string): void;
|
|
308
|
+
selectStaleProcessCandidates(leaseTtlMs: number, httpJobGraceMs: number): SweepCandidate[];
|
|
309
|
+
recoverStaleJobs(leaseTtlMs: number, httpJobGraceMs: number, liveConfirmedIds?: string[]): OrphanedJobSnapshot[];
|
|
310
|
+
gcInstances(instanceGcMs: number): number;
|
|
311
|
+
recordOutput(id: string, stdout: string, stderr: string, outputTruncated: boolean): void;
|
|
312
|
+
recordComplete(input: {
|
|
313
|
+
id: string;
|
|
314
|
+
status: Exclude<JobStoreStatus, "running" | "queued">;
|
|
315
|
+
exitCode: number | null;
|
|
316
|
+
stdout: string;
|
|
317
|
+
stderr: string;
|
|
318
|
+
outputTruncated: boolean;
|
|
319
|
+
error: string | null;
|
|
320
|
+
finishedAt: string;
|
|
321
|
+
httpStatus?: number | null;
|
|
322
|
+
}): void;
|
|
323
|
+
getById(id: string): JobRecord | null;
|
|
324
|
+
findByRequestKey(requestKey: string): JobRecord | null;
|
|
224
325
|
markOrphanedOnStartup(): {
|
|
225
326
|
count: number;
|
|
226
327
|
orphaned: Array<OrphanedJobSnapshot>;
|
|
227
328
|
};
|
|
228
329
|
evictExpired(): number;
|
|
330
|
+
recordValidationRun(run: ValidationRunRecord): void;
|
|
331
|
+
getValidationRun(validationId: string): ValidationRunRecord | null;
|
|
332
|
+
setValidationJudgeLink(validationId: string, judgeLink: ValidationRunLink): void;
|
|
333
|
+
setValidationRunStatus(validationId: string, status: ValidationRunRecord["status"]): void;
|
|
334
|
+
getValidationRunIdByJobId(jobId: string): string | null;
|
|
335
|
+
recordValidationReceipt(receipt: ValidationReceiptRecord): void;
|
|
336
|
+
getValidationReceipt(validationId: string): ValidationReceiptRecord | null;
|
|
229
337
|
close(): void;
|
|
230
338
|
}
|
|
231
339
|
export declare function createJobStore(config: PersistenceConfig, logger?: Logger): JobStore | null;
|