@cesarus777/opencode-cgp 0.3.1 → 0.4.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/CHANGELOG.md +38 -0
- package/README.md +23 -9
- package/dist/cli.js +1179 -92
- package/dist/core.js +49 -4
- package/dist/index.js +570 -9
- package/dist/rpc.js +129 -2
- package/dist/tui.js +1543 -707
- package/dist/types/adapter.d.ts +2 -0
- package/dist/types/core.d.ts +1 -0
- package/dist/types/dashboard/command.d.ts +1 -1
- package/dist/types/dashboard/connection.d.ts +2 -0
- package/dist/types/dashboard/controller.d.ts +4 -0
- package/dist/types/dashboard/models.d.ts +42 -0
- package/dist/types/dashboard/modelview.d.ts +30 -0
- package/dist/types/dashboard/port.d.ts +6 -0
- package/dist/types/dashboard/terminal.d.ts +7 -0
- package/dist/types/dashboard/terminalview.d.ts +7 -2
- package/dist/types/dashboard/view.d.ts +6 -1
- package/dist/types/history.d.ts +1 -0
- package/dist/types/historyclient.d.ts +15 -0
- package/dist/types/modelanalytics.d.ts +8 -0
- package/dist/types/modelanalyticsserver.d.ts +16 -0
- package/dist/types/modelseries.d.ts +43 -0
- package/dist/types/rpc.d.ts +28 -0
- package/dist/types/tui/chartformat.d.ts +1 -1
- package/dist/types/tui/charts.d.ts +2 -3
- package/dist/types/tui/compactformat.d.ts +12 -3
- package/dist/types/tui/historystate.d.ts +49 -0
- package/dist/types/tui/inventory.d.ts +12 -0
- package/dist/types/tui/panelcontrols.d.ts +8 -0
- package/dist/types/tui/panelformat.d.ts +12 -0
- package/dist/types/tui/panelview.d.ts +22 -0
- package/dist/types/tui/quantity.d.ts +1 -0
- package/dist/types/tui/sidebar.d.ts +0 -5
- package/dist/types/tui/state.d.ts +3 -1
- package/dist/types/tui/statusformat.d.ts +19 -0
- package/package.json +1 -1
package/dist/rpc.js
CHANGED
|
@@ -43,6 +43,12 @@ function isHistoryRead(value) {
|
|
|
43
43
|
function isHistoryResult(value) {
|
|
44
44
|
return valid(value, historyResultSchema);
|
|
45
45
|
}
|
|
46
|
+
function isAnalyticsRead(value) {
|
|
47
|
+
return valid(value, analyticsReadSchema) && record(value) && typeof value.from === "number" && typeof value.to === "number" && value.from < value.to && value.to - value.from <= 604800000 && !(value.model !== undefined && value.unknownModel === true) && (!(value.modelCursor || value.requestCursor) || typeof value.snapshotId === "string");
|
|
48
|
+
}
|
|
49
|
+
function isAnalyticsResult(value) {
|
|
50
|
+
return valid(value, analyticsResultSchema);
|
|
51
|
+
}
|
|
46
52
|
function record(x) {
|
|
47
53
|
return typeof x === "object" && x !== null && !Array.isArray(x);
|
|
48
54
|
}
|
|
@@ -100,7 +106,7 @@ var count, text, enumeration = (...values) => ({ type: "string", enum: values })
|
|
|
100
106
|
type: "array",
|
|
101
107
|
items,
|
|
102
108
|
maxItems
|
|
103
|
-
}), measurement, row, batchFields, readSchema, batchSchema, resultSchema, monitorRpc, nonnegative, performanceSchema, performanceRow, performanceBatchSchema, performanceResultSchema, performanceRpc, chartPointSchema, chartRequestSchema, historyReadSchema, historyResultSchema, historyRpc;
|
|
109
|
+
}), measurement, row, batchFields, readSchema, batchSchema, resultSchema, monitorRpc, nonnegative, performanceSchema, performanceRow, performanceBatchSchema, performanceResultSchema, performanceRpc, chartPointSchema, chartRequestSchema, historyReadSchema, historyResultSchema, historyRpc, modelSummarySchema, analyticsReadSchema, analyticsResultSchema, analyticsRpc;
|
|
104
110
|
var init_rpc = __esm(() => {
|
|
105
111
|
count = {
|
|
106
112
|
type: "integer",
|
|
@@ -336,6 +342,123 @@ var init_rpc = __esm(() => {
|
|
|
336
342
|
methods: { read: { input: historyReadSchema, output: historyResultSchema } },
|
|
337
343
|
events: {}
|
|
338
344
|
});
|
|
345
|
+
modelSummarySchema = object({
|
|
346
|
+
model: text,
|
|
347
|
+
sessions: count,
|
|
348
|
+
completedRequests: count,
|
|
349
|
+
partialRequests: count,
|
|
350
|
+
legacyAttributionRequests: count,
|
|
351
|
+
tpsRequests: count,
|
|
352
|
+
ttftRequests: count,
|
|
353
|
+
excludedTpsRequests: count,
|
|
354
|
+
excludedTtftRequests: count,
|
|
355
|
+
outputTokens: nonnegative,
|
|
356
|
+
durationMs: nonnegative,
|
|
357
|
+
averageTps: nonnegative,
|
|
358
|
+
meanTtftMs: nonnegative,
|
|
359
|
+
medianTtftMs: nonnegative,
|
|
360
|
+
p95TtftMs: nonnegative
|
|
361
|
+
}, [
|
|
362
|
+
"sessions",
|
|
363
|
+
"completedRequests",
|
|
364
|
+
"partialRequests",
|
|
365
|
+
"legacyAttributionRequests",
|
|
366
|
+
"tpsRequests",
|
|
367
|
+
"ttftRequests",
|
|
368
|
+
"excludedTpsRequests",
|
|
369
|
+
"excludedTtftRequests",
|
|
370
|
+
"outputTokens",
|
|
371
|
+
"durationMs"
|
|
372
|
+
]);
|
|
373
|
+
analyticsReadSchema = object({
|
|
374
|
+
schemaVersion: { const: 1 },
|
|
375
|
+
from: count,
|
|
376
|
+
to: count,
|
|
377
|
+
buckets: { type: "integer", minimum: 1, maximum: 240 },
|
|
378
|
+
agent: text,
|
|
379
|
+
model: text,
|
|
380
|
+
unknownModel: { type: "boolean" },
|
|
381
|
+
sort: enumeration("requests", "tps", "ttft", "identity"),
|
|
382
|
+
snapshotId: text,
|
|
383
|
+
modelCursor: text,
|
|
384
|
+
requestCursor: text
|
|
385
|
+
}, ["schemaVersion", "from", "to", "buckets"]);
|
|
386
|
+
analyticsResultSchema = object({
|
|
387
|
+
schemaVersion: { const: 1 },
|
|
388
|
+
generatedAt: count,
|
|
389
|
+
expiresAt: count,
|
|
390
|
+
snapshotId: text,
|
|
391
|
+
enabled: { type: "boolean" },
|
|
392
|
+
from: count,
|
|
393
|
+
to: count,
|
|
394
|
+
agent: text,
|
|
395
|
+
models: array(modelSummarySchema, 50),
|
|
396
|
+
totalModels: count,
|
|
397
|
+
nextModelsCursor: text,
|
|
398
|
+
selected: modelSummarySchema,
|
|
399
|
+
buckets: array(object({ from: nonnegative, to: nonnegative, summary: modelSummarySchema }, ["from", "to"]), 240),
|
|
400
|
+
requests: array(object({
|
|
401
|
+
location: text,
|
|
402
|
+
sessionId: text,
|
|
403
|
+
requestId: text,
|
|
404
|
+
startedAt: count,
|
|
405
|
+
completedAt: count,
|
|
406
|
+
model: text,
|
|
407
|
+
agent: text,
|
|
408
|
+
attribution: enumeration("request", "legacy-record", "unknown"),
|
|
409
|
+
partial: { type: "boolean" },
|
|
410
|
+
outputTokens: nonnegative,
|
|
411
|
+
ttftMs: nonnegative
|
|
412
|
+
}, [
|
|
413
|
+
"location",
|
|
414
|
+
"sessionId",
|
|
415
|
+
"requestId",
|
|
416
|
+
"startedAt",
|
|
417
|
+
"completedAt",
|
|
418
|
+
"attribution",
|
|
419
|
+
"partial"
|
|
420
|
+
]), 50),
|
|
421
|
+
nextRequestsCursor: text,
|
|
422
|
+
coverage: object({
|
|
423
|
+
source: enumeration("retained-request-records"),
|
|
424
|
+
scannedRecords: count,
|
|
425
|
+
unscannedRecords: count,
|
|
426
|
+
duplicateRecords: count,
|
|
427
|
+
conflictingRequests: count,
|
|
428
|
+
missingIdentityRecords: count,
|
|
429
|
+
incompleteRequests: count,
|
|
430
|
+
invalidTimingRequests: count,
|
|
431
|
+
gapRecords: count,
|
|
432
|
+
maxRequests: count,
|
|
433
|
+
partial: { type: "boolean" }
|
|
434
|
+
}),
|
|
435
|
+
metadata: historyResultSchema.properties.metadata ?? {},
|
|
436
|
+
gaps: array(count, 128),
|
|
437
|
+
omittedGaps: count
|
|
438
|
+
}, [
|
|
439
|
+
"schemaVersion",
|
|
440
|
+
"generatedAt",
|
|
441
|
+
"expiresAt",
|
|
442
|
+
"snapshotId",
|
|
443
|
+
"enabled",
|
|
444
|
+
"from",
|
|
445
|
+
"to",
|
|
446
|
+
"models",
|
|
447
|
+
"totalModels",
|
|
448
|
+
"buckets",
|
|
449
|
+
"requests",
|
|
450
|
+
"coverage",
|
|
451
|
+
"metadata",
|
|
452
|
+
"gaps",
|
|
453
|
+
"omittedGaps"
|
|
454
|
+
]);
|
|
455
|
+
analyticsRpc = Rpc.define({
|
|
456
|
+
id: "context-guard.analytics.v1",
|
|
457
|
+
methods: {
|
|
458
|
+
read: { input: analyticsReadSchema, output: analyticsResultSchema }
|
|
459
|
+
},
|
|
460
|
+
events: {}
|
|
461
|
+
});
|
|
339
462
|
});
|
|
340
463
|
init_rpc();
|
|
341
464
|
|
|
@@ -355,7 +478,11 @@ export {
|
|
|
355
478
|
isHistoryResult,
|
|
356
479
|
isHistoryRead,
|
|
357
480
|
isBatch,
|
|
481
|
+
isAnalyticsResult,
|
|
482
|
+
isAnalyticsRead,
|
|
358
483
|
historyRpc,
|
|
359
484
|
historyReadSchema,
|
|
360
|
-
batchSchema
|
|
485
|
+
batchSchema,
|
|
486
|
+
analyticsRpc,
|
|
487
|
+
analyticsReadSchema
|
|
361
488
|
};
|