@codexhost/cli-darwin-x64 0.13.3 → 0.15.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/README.md +1 -1
- package/app/codexhost-distribution.json +1 -1
- package/app/console-server.mjs +109 -11
- package/app/console-web.js +649 -132
- package/app/desktop-controller.mjs +120 -12
- package/app/host-runtime.mjs +1124 -293
- package/app/plugins/antigravity/plugin.mjs +431 -66
- package/app/plugins/claude-code/plugin.mjs +761 -139
- package/app/plugins/codebuddy/plugin.mjs +322 -68
- package/app/plugins/codex-usage/plugin.mjs +249 -102
- package/app/plugins/copilot/assets/icon.png +0 -0
- package/app/plugins/copilot/manifest.json +26 -0
- package/app/plugins/copilot/plugin.mjs +34591 -0
- package/app/plugins/cursor-cli/plugin.mjs +21011 -44970
- package/app/plugins/deepseek-harness/plugin.mjs +160 -43
- package/app/plugins/enabled.json +1 -0
- package/app/plugins/grok/plugin.mjs +565 -107
- package/app/plugins/hermes/plugin.mjs +128 -12
- package/app/plugins/kimi-code/plugin.mjs +136 -22
- package/app/plugins/kiro-cli/plugin.mjs +136 -22
- package/app/plugins/omp/plugin.mjs +2236 -2036
- package/app/plugins/opencode/plugin.mjs +187 -68
- package/app/plugins/pi/plugin.mjs +2621 -2304
- package/app/plugins/qoder/plugin.mjs +153 -36
- package/app/plugins/qoder-cn/plugin.mjs +153 -36
- package/app/plugins/workbuddy/plugin.mjs +583 -92
- package/app/plugins/zcode/plugin.mjs +183 -40
- package/app/renderer-extension.js +1758 -392
- package/bin/codexhost +0 -0
- package/libexec/codexhost-shim +0 -0
- package/libexec/codexhost-updater +0 -0
- package/package.json +1 -1
|
@@ -3034,10 +3034,10 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
3034
3034
|
const shape = def.shape;
|
|
3035
3035
|
const propValues = {};
|
|
3036
3036
|
for (const key2 in shape) {
|
|
3037
|
-
const
|
|
3038
|
-
if (
|
|
3037
|
+
const field2 = shape[key2]._zod;
|
|
3038
|
+
if (field2.values) {
|
|
3039
3039
|
propValues[key2] ?? (propValues[key2] = /* @__PURE__ */ new Set());
|
|
3040
|
-
for (const v of
|
|
3040
|
+
for (const v of field2.values)
|
|
3041
3041
|
propValues[key2].add(v);
|
|
3042
3042
|
}
|
|
3043
3043
|
}
|
|
@@ -14656,10 +14656,19 @@ var model = external_exports.string().min(1).max(512);
|
|
|
14656
14656
|
var project = external_exports.string().min(1).max(4096);
|
|
14657
14657
|
var usageStatisticsParamsSchema = external_exports.strictObject({
|
|
14658
14658
|
range: external_exports.enum(USAGE_STATISTICS_RANGES),
|
|
14659
|
+
/** Display timezone for ranges, dates and hourly buckets; omitted means the Host's local zone. */
|
|
14660
|
+
timeZone: external_exports.string().min(1).max(128).refine((value) => {
|
|
14661
|
+
try {
|
|
14662
|
+
new Intl.DateTimeFormat("en", { timeZone: value });
|
|
14663
|
+
return true;
|
|
14664
|
+
} catch {
|
|
14665
|
+
return false;
|
|
14666
|
+
}
|
|
14667
|
+
}, "Unsupported usage statistics timezone").optional(),
|
|
14659
14668
|
harness: harness.optional(),
|
|
14660
14669
|
model: model.nullable().optional(),
|
|
14661
14670
|
project: project.nullable().optional(),
|
|
14662
|
-
/** One
|
|
14671
|
+
/** One date in the query timezone inside the range. */
|
|
14663
14672
|
date: localDate.optional()
|
|
14664
14673
|
});
|
|
14665
14674
|
var usageStatisticsTotalsSchema = external_exports.strictObject({
|
|
@@ -14695,7 +14704,7 @@ var usageStatisticsSessionSchema = external_exports.strictObject({
|
|
|
14695
14704
|
});
|
|
14696
14705
|
var usageStatisticsResultSchema = external_exports.strictObject({
|
|
14697
14706
|
range: external_exports.enum(USAGE_STATISTICS_RANGES),
|
|
14698
|
-
/** First
|
|
14707
|
+
/** First date in the query timezone (Host local when omitted); null for all time. */
|
|
14699
14708
|
from: localDate.nullable(),
|
|
14700
14709
|
to: localDate,
|
|
14701
14710
|
/** The filters these figures apply, echoed so a late answer to older filters is recognised. */
|
|
@@ -14735,7 +14744,7 @@ var usageStatisticsResultSchema = external_exports.strictObject({
|
|
|
14735
14744
|
totals: usageStatisticsTotalsSchema,
|
|
14736
14745
|
/** Each date and Harness of the range: every filter except the day. */
|
|
14737
14746
|
daily: external_exports.array(external_exports.strictObject({ date: localDate, harness, ...totals })).max(2e5),
|
|
14738
|
-
/**
|
|
14747
|
+
/** Weekday (0 = Sunday) and hour in the query timezone, all filters applied. */
|
|
14739
14748
|
hourly: external_exports.array(external_exports.strictObject({
|
|
14740
14749
|
weekday: external_exports.number().int().min(0).max(6),
|
|
14741
14750
|
hour: external_exports.number().int().min(0).max(23),
|
|
@@ -14775,6 +14784,51 @@ var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
|
14775
14784
|
var threadPrewarmDiscardParamsSchema = external_exports.object({ threadId: hostThreadIdSchema });
|
|
14776
14785
|
var threadPrewarmDiscardResultSchema = external_exports.object({ discarded: external_exports.boolean() });
|
|
14777
14786
|
|
|
14787
|
+
// ../../shared-contracts/dist/thread-questions.js
|
|
14788
|
+
var field = external_exports.discriminatedUnion("type", [
|
|
14789
|
+
external_exports.object({
|
|
14790
|
+
id: external_exports.string().min(1),
|
|
14791
|
+
type: external_exports.literal("choice"),
|
|
14792
|
+
prompt: external_exports.string(),
|
|
14793
|
+
options: external_exports.array(external_exports.object({
|
|
14794
|
+
value: external_exports.string().min(1),
|
|
14795
|
+
label: external_exports.string(),
|
|
14796
|
+
description: external_exports.string().optional()
|
|
14797
|
+
})).min(1),
|
|
14798
|
+
multiple: external_exports.boolean(),
|
|
14799
|
+
allowOther: external_exports.boolean(),
|
|
14800
|
+
optional: external_exports.boolean()
|
|
14801
|
+
}),
|
|
14802
|
+
external_exports.object({
|
|
14803
|
+
id: external_exports.string().min(1),
|
|
14804
|
+
type: external_exports.literal("text"),
|
|
14805
|
+
prompt: external_exports.string(),
|
|
14806
|
+
multiline: external_exports.boolean(),
|
|
14807
|
+
secret: external_exports.literal(false),
|
|
14808
|
+
optional: external_exports.boolean(),
|
|
14809
|
+
placeholder: external_exports.string().optional(),
|
|
14810
|
+
prefill: external_exports.string().optional()
|
|
14811
|
+
})
|
|
14812
|
+
]);
|
|
14813
|
+
var threadQuestionSchema = external_exports.object({
|
|
14814
|
+
interactionId: external_exports.string().min(1),
|
|
14815
|
+
turnId: external_exports.string().min(1),
|
|
14816
|
+
title: external_exports.string().optional(),
|
|
14817
|
+
questions: external_exports.array(field).min(1)
|
|
14818
|
+
}).refine(({ questions }) => questions.some((q) => q.type === "choice" && q.multiple), {
|
|
14819
|
+
message: "Shared cards require at least one multi-select question"
|
|
14820
|
+
});
|
|
14821
|
+
var threadQuestionsListParamsSchema = external_exports.strictObject({ threadId: external_exports.string().min(1) });
|
|
14822
|
+
var threadQuestionsResultSchema = external_exports.object({ questions: external_exports.array(threadQuestionSchema) });
|
|
14823
|
+
var threadQuestionRespondParamsSchema = external_exports.strictObject({
|
|
14824
|
+
threadId: external_exports.string().min(1),
|
|
14825
|
+
turnId: external_exports.string().min(1),
|
|
14826
|
+
interactionId: external_exports.string().min(1),
|
|
14827
|
+
answers: external_exports.record(external_exports.string(), external_exports.array(external_exports.string())),
|
|
14828
|
+
cancelled: external_exports.boolean().default(false)
|
|
14829
|
+
});
|
|
14830
|
+
var threadQuestionRespondResultSchema = external_exports.object({ accepted: external_exports.literal(true) });
|
|
14831
|
+
|
|
14778
14832
|
// ../../shared-contracts/dist/console.js
|
|
14779
14833
|
var consoleAnnouncementSchema = external_exports.strictObject({
|
|
14780
14834
|
title: external_exports.string().trim().min(1).max(200),
|
|
@@ -14795,6 +14849,8 @@ var CONSOLE_HOST_METHODS = Object.freeze([
|
|
|
14795
14849
|
"codexhost/harness/display-settings/set",
|
|
14796
14850
|
"codexhost/harness/inspect",
|
|
14797
14851
|
"codexhost/harness/installation",
|
|
14852
|
+
"codexhost/harness/installation/start",
|
|
14853
|
+
"codexhost/harness/installation/status",
|
|
14798
14854
|
"codexhost/harness/launch-settings/get",
|
|
14799
14855
|
"codexhost/harness/launch-settings/set",
|
|
14800
14856
|
"codexhost/harness/web-ui/open",
|
|
@@ -14870,7 +14926,18 @@ var threadManualCompactionStartedSchema = external_exports.strictObject({
|
|
|
14870
14926
|
var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
|
|
14871
14927
|
var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
|
|
14872
14928
|
var cacheHitRatePercentSchema = external_exports.number().finite().min(0).max(100);
|
|
14929
|
+
var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text2) => text2.length <= maximum));
|
|
14930
|
+
var composerIndicatorsSchema = external_exports.array(external_exports.object({
|
|
14931
|
+
kind: external_exports.literal("countdown"),
|
|
14932
|
+
id: external_exports.string().min(1).max(64),
|
|
14933
|
+
expiresAtUnix: nonNegativeSafeIntegerSchema,
|
|
14934
|
+
label: indicatorTextSchema(256).optional(),
|
|
14935
|
+
tooltip: indicatorTextSchema(1024).optional()
|
|
14936
|
+
}).strict()).max(2).refine((entries) => new Set(entries.map(({ id }) => id)).size === entries.length, {
|
|
14937
|
+
message: "Composer indicator IDs must be unique"
|
|
14938
|
+
});
|
|
14873
14939
|
var threadUsageSnapshotSchema = external_exports.object({
|
|
14940
|
+
composerIndicators: composerIndicatorsSchema.optional(),
|
|
14874
14941
|
inputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
14875
14942
|
cachedInputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
14876
14943
|
cacheWriteInputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
@@ -15278,7 +15345,9 @@ var harnessSessionCapabilitiesSchema = external_exports.object({
|
|
|
15278
15345
|
}).strict().optional(),
|
|
15279
15346
|
autonomousTurns: external_exports.object({
|
|
15280
15347
|
observe: external_exports.boolean()
|
|
15281
|
-
}).strict().optional()
|
|
15348
|
+
}).strict().optional(),
|
|
15349
|
+
/** True only when `turn.steer` delivers input into the active Turn through a native primitive. */
|
|
15350
|
+
steer: external_exports.boolean().optional()
|
|
15282
15351
|
}).strict();
|
|
15283
15352
|
var harnessConfigurationStateSchema = external_exports.object({
|
|
15284
15353
|
effectiveModel: harnessModelRefSchema.optional(),
|
|
@@ -15325,7 +15394,9 @@ var harnessInspectionSchema = external_exports.union([
|
|
|
15325
15394
|
var harnessInspectParamsSchema = external_exports.object({
|
|
15326
15395
|
harnessId: harnessIdSchema,
|
|
15327
15396
|
cwd: nonBlankTextSchema2.max(16384).optional(),
|
|
15328
|
-
refresh: external_exports.boolean().optional()
|
|
15397
|
+
refresh: external_exports.boolean().optional(),
|
|
15398
|
+
/** `availability` asks only whether the Harness can run; see `InspectHarnessInput.purpose`. */
|
|
15399
|
+
purpose: external_exports.literal("availability").optional()
|
|
15329
15400
|
}).strict();
|
|
15330
15401
|
var harnessWebUiOpenParamsSchema = external_exports.object({
|
|
15331
15402
|
harnessId: harnessIdSchema
|
|
@@ -15408,6 +15479,15 @@ var threadOwnershipListResultSchema = external_exports.object({
|
|
|
15408
15479
|
seen.add(thread.threadId);
|
|
15409
15480
|
}
|
|
15410
15481
|
});
|
|
15482
|
+
var threadSteeringInspectParamsSchema = external_exports.object({
|
|
15483
|
+
threadId: hostThreadIdSchema,
|
|
15484
|
+
/** The text about to be steered; a Harness command always stops and restarts. */
|
|
15485
|
+
text: external_exports.string().optional()
|
|
15486
|
+
}).strict();
|
|
15487
|
+
var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
|
|
15488
|
+
var threadSteeringInspectResultSchema = external_exports.object({
|
|
15489
|
+
delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
|
|
15490
|
+
}).strict();
|
|
15411
15491
|
|
|
15412
15492
|
// ../../shared-contracts/dist/harness-plugins.js
|
|
15413
15493
|
var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
|
|
@@ -15509,6 +15589,10 @@ var harnessInstallationStateSchema = external_exports.object({
|
|
|
15509
15589
|
latestVersion: external_exports.string().min(1).max(128),
|
|
15510
15590
|
updateAvailable: external_exports.boolean(),
|
|
15511
15591
|
canUpdate: external_exports.boolean(),
|
|
15592
|
+
/** Defaults to CLI; some Harnesses ship only inside a desktop application. */
|
|
15593
|
+
versionKind: external_exports.enum(["cli", "application"]).optional(),
|
|
15594
|
+
/** Official download opened by the user; does not imply an automatic installation. */
|
|
15595
|
+
manualUpdateUrl: external_exports.url().max(2048).refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Manual updates require a credential-free HTTPS URL").optional(),
|
|
15512
15596
|
// Adapter-owned diagnostic text; UI uses messageCode rather than displaying it verbatim.
|
|
15513
15597
|
message: external_exports.string().max(2048).optional(),
|
|
15514
15598
|
messageCode: external_exports.string().min(1).max(128).optional(),
|
|
@@ -15516,6 +15600,20 @@ var harnessInstallationStateSchema = external_exports.object({
|
|
|
15516
15600
|
notice: harnessLocalizedTextSchema.optional(),
|
|
15517
15601
|
latestVersionKind: external_exports.enum(["unknown", "tracking-branch"]).optional()
|
|
15518
15602
|
}).strict();
|
|
15603
|
+
var harnessInstallationTaskParamsSchema = external_exports.object({ taskId: external_exports.string().uuid() }).strict();
|
|
15604
|
+
var harnessInstallationTaskSchema = external_exports.discriminatedUnion("status", [
|
|
15605
|
+
external_exports.object({ taskId: external_exports.string().uuid(), status: external_exports.literal("running") }).strict(),
|
|
15606
|
+
external_exports.object({
|
|
15607
|
+
taskId: external_exports.string().uuid(),
|
|
15608
|
+
status: external_exports.literal("succeeded"),
|
|
15609
|
+
result: harnessInstallationStateSchema
|
|
15610
|
+
}).strict(),
|
|
15611
|
+
external_exports.object({
|
|
15612
|
+
taskId: external_exports.string().uuid(),
|
|
15613
|
+
status: external_exports.literal("failed"),
|
|
15614
|
+
error: external_exports.object({ code: external_exports.number().int(), message: external_exports.string().min(1).max(2048) }).strict()
|
|
15615
|
+
}).strict()
|
|
15616
|
+
]);
|
|
15519
15617
|
|
|
15520
15618
|
// ../../shared-contracts/dist/codex-accounts.js
|
|
15521
15619
|
var accountIdSchema = external_exports.string().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u);
|
|
@@ -15904,6 +16002,13 @@ import { setImmediate as yieldToEventLoop } from "node:timers/promises";
|
|
|
15904
16002
|
// ../../harness-adapter/dist/usage-statistics.js
|
|
15905
16003
|
import { createReadStream } from "node:fs";
|
|
15906
16004
|
import { createInterface } from "node:readline";
|
|
16005
|
+
var HarnessUsageSourceChangedError = class extends Error {
|
|
16006
|
+
code = "HARNESS_USAGE_SOURCE_CHANGED";
|
|
16007
|
+
/** Plugins may bundle their own copy of this contract, so instanceof is insufficient. */
|
|
16008
|
+
static is(error51) {
|
|
16009
|
+
return typeof error51 === "object" && error51 !== null && "code" in error51 && error51.code === "HARNESS_USAGE_SOURCE_CHANGED";
|
|
16010
|
+
}
|
|
16011
|
+
};
|
|
15907
16012
|
var MAX_SESSION_ID_LENGTH = 512;
|
|
15908
16013
|
var MAX_CWD_LENGTH = 4096;
|
|
15909
16014
|
var MAX_SESSION_TITLE_LENGTH = 200;
|
|
@@ -15915,10 +16020,13 @@ function usageSessionTitle(value) {
|
|
|
15915
16020
|
return void 0;
|
|
15916
16021
|
if (normalized.length <= MAX_SESSION_TITLE_LENGTH)
|
|
15917
16022
|
return normalized;
|
|
15918
|
-
|
|
15919
|
-
|
|
15920
|
-
|
|
15921
|
-
|
|
16023
|
+
let title = "";
|
|
16024
|
+
for (const character of normalized) {
|
|
16025
|
+
if (title.length + character.length >= MAX_SESSION_TITLE_LENGTH)
|
|
16026
|
+
break;
|
|
16027
|
+
title += character;
|
|
16028
|
+
}
|
|
16029
|
+
return `${title.trimEnd()}…`;
|
|
15922
16030
|
}
|
|
15923
16031
|
function sessionIdOk(value) {
|
|
15924
16032
|
return typeof value === "string" && value.length > 0 && value.length <= MAX_SESSION_ID_LENGTH;
|
|
@@ -15955,13 +16063,13 @@ function parseHarnessUsageEntry(value) {
|
|
|
15955
16063
|
}
|
|
15956
16064
|
if (!tokenCount(entry.inputTokens) || !tokenCount(entry.outputTokens))
|
|
15957
16065
|
return null;
|
|
15958
|
-
for (const
|
|
16066
|
+
for (const field2 of [
|
|
15959
16067
|
"cachedInputTokens",
|
|
15960
16068
|
"cacheWriteInputTokens",
|
|
15961
16069
|
"cacheWrite1hInputTokens",
|
|
15962
16070
|
"reasoningOutputTokens"
|
|
15963
16071
|
]) {
|
|
15964
|
-
if (entry[
|
|
16072
|
+
if (entry[field2] !== void 0 && !tokenCount(entry[field2]))
|
|
15965
16073
|
return null;
|
|
15966
16074
|
}
|
|
15967
16075
|
const cached2 = entry.cachedInputTokens ?? 0;
|
|
@@ -16055,8 +16163,8 @@ function usage(value) {
|
|
|
16055
16163
|
if (!row)
|
|
16056
16164
|
return null;
|
|
16057
16165
|
const result = { values: [], known: 0 };
|
|
16058
|
-
for (const [i,
|
|
16059
|
-
const n = row[
|
|
16166
|
+
for (const [i, field2] of fields.entries()) {
|
|
16167
|
+
const n = row[field2];
|
|
16060
16168
|
if (n !== void 0 && n !== null) {
|
|
16061
16169
|
if (typeof n !== "number" || !Number.isSafeInteger(n) || n < 0)
|
|
16062
16170
|
return null;
|
|
@@ -16421,8 +16529,9 @@ var CodexCounters = class {
|
|
|
16421
16529
|
// dist/rollout-io.js
|
|
16422
16530
|
import { createReadStream as createReadStream2 } from "node:fs";
|
|
16423
16531
|
import { StringDecoder } from "node:string_decoder";
|
|
16424
|
-
import {
|
|
16425
|
-
import {
|
|
16532
|
+
import { pipeline } from "node:stream/promises";
|
|
16533
|
+
import { Readable } from "node:stream";
|
|
16534
|
+
import { constants as zstdConstants, createZstdDecompress } from "node:zlib";
|
|
16426
16535
|
/*!
|
|
16427
16536
|
* Rollout reading: zstd frame walking, streaming copy-prefix comparison.
|
|
16428
16537
|
*
|
|
@@ -16445,74 +16554,103 @@ import { zstdDecompress } from "node:zlib";
|
|
|
16445
16554
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
16446
16555
|
* SOFTWARE.
|
|
16447
16556
|
*/
|
|
16448
|
-
var decompress = promisify(zstdDecompress);
|
|
16449
|
-
var MAX_FRAME = 64 * 1024 * 1024;
|
|
16450
16557
|
var MAX_LINE = 128 * 1024 * 1024;
|
|
16451
|
-
function frameSize(data) {
|
|
16452
|
-
if (data.length < 8)
|
|
16453
|
-
return null;
|
|
16454
|
-
const magic = data.readUInt32LE(0);
|
|
16455
|
-
if ((magic & 4294967280) === 407710288) {
|
|
16456
|
-
const size = 8 + data.readUInt32LE(4);
|
|
16457
|
-
if (size > MAX_FRAME)
|
|
16458
|
-
throw new Error("Codex zstd frame exceeds the safety limit");
|
|
16459
|
-
return data.length >= size ? { size, skip: true } : null;
|
|
16460
|
-
}
|
|
16461
|
-
if (magic !== 4247762216)
|
|
16462
|
-
throw new Error("Invalid Codex zstd frame");
|
|
16463
|
-
const descriptor = data.readUInt8(4);
|
|
16464
|
-
if (descriptor & 8)
|
|
16465
|
-
throw new Error("Reserved Codex zstd frame header");
|
|
16466
|
-
const single = descriptor >> 5 & 1;
|
|
16467
|
-
let offset = 5 + (single ? 0 : 1) + ([0, 1, 2, 4][descriptor & 3] ?? 0) + ([single, 2, 4, 8][descriptor >> 6] ?? 0);
|
|
16468
|
-
for (; ; ) {
|
|
16469
|
-
if (offset + 3 > data.length)
|
|
16470
|
-
return null;
|
|
16471
|
-
const block = data.readUIntLE(offset, 3);
|
|
16472
|
-
const type = block >> 1 & 3;
|
|
16473
|
-
if (type === 3)
|
|
16474
|
-
throw new Error("Reserved Codex zstd block");
|
|
16475
|
-
offset += 3 + (type === 1 ? 1 : block >>> 3);
|
|
16476
|
-
if (offset > MAX_FRAME)
|
|
16477
|
-
throw new Error("Codex zstd frame exceeds the safety limit");
|
|
16478
|
-
if (block & 1)
|
|
16479
|
-
break;
|
|
16480
|
-
}
|
|
16481
|
-
if (descriptor & 4)
|
|
16482
|
-
offset += 4;
|
|
16483
|
-
return data.length >= offset ? { size: offset, skip: false } : null;
|
|
16484
|
-
}
|
|
16485
16558
|
async function* rolloutBytes(file2, signal) {
|
|
16486
16559
|
signal.throwIfAborted();
|
|
16487
16560
|
const stream = createReadStream2(file2, { signal });
|
|
16488
|
-
let pending = Buffer.alloc(0);
|
|
16489
16561
|
try {
|
|
16490
|
-
|
|
16491
|
-
|
|
16492
|
-
|
|
16493
|
-
if (!file2.endsWith(".zst")) {
|
|
16562
|
+
if (!file2.endsWith(".zst")) {
|
|
16563
|
+
for await (const chunk of stream) {
|
|
16564
|
+
signal.throwIfAborted();
|
|
16494
16565
|
yield chunk;
|
|
16566
|
+
}
|
|
16567
|
+
return;
|
|
16568
|
+
}
|
|
16569
|
+
const input = stream[Symbol.asyncIterator]();
|
|
16570
|
+
let pending = Buffer.alloc(0);
|
|
16571
|
+
async function readExact(size, allowEof = false) {
|
|
16572
|
+
const parts = [];
|
|
16573
|
+
let length = 0;
|
|
16574
|
+
while (length < size) {
|
|
16575
|
+
signal.throwIfAborted();
|
|
16576
|
+
if (!pending.length) {
|
|
16577
|
+
const next = await input.next();
|
|
16578
|
+
if (next.done) {
|
|
16579
|
+
if (allowEof && !length)
|
|
16580
|
+
return Buffer.alloc(0);
|
|
16581
|
+
throw new Error("Truncated Codex zstd rollout");
|
|
16582
|
+
}
|
|
16583
|
+
pending = next.value;
|
|
16584
|
+
}
|
|
16585
|
+
const count2 = Math.min(size - length, pending.length);
|
|
16586
|
+
parts.push(pending.subarray(0, count2));
|
|
16587
|
+
pending = pending.subarray(count2);
|
|
16588
|
+
length += count2;
|
|
16589
|
+
}
|
|
16590
|
+
return Buffer.concat(parts, length);
|
|
16591
|
+
}
|
|
16592
|
+
for (; ; ) {
|
|
16593
|
+
const magicBytes = await readExact(4, true);
|
|
16594
|
+
if (!magicBytes.length)
|
|
16595
|
+
break;
|
|
16596
|
+
const magic = magicBytes.readUInt32LE(0);
|
|
16597
|
+
if ((magic & 4294967280) === 407710288) {
|
|
16598
|
+
let size = (await readExact(4)).readUInt32LE(0);
|
|
16599
|
+
while (size) {
|
|
16600
|
+
const count2 = Math.min(size, 64 * 1024);
|
|
16601
|
+
await readExact(count2);
|
|
16602
|
+
size -= count2;
|
|
16603
|
+
}
|
|
16495
16604
|
continue;
|
|
16496
16605
|
}
|
|
16497
|
-
|
|
16498
|
-
|
|
16499
|
-
|
|
16500
|
-
|
|
16501
|
-
|
|
16502
|
-
|
|
16503
|
-
|
|
16504
|
-
|
|
16505
|
-
|
|
16606
|
+
if (magic !== 4247762216)
|
|
16607
|
+
throw new Error("Invalid Codex zstd frame");
|
|
16608
|
+
const descriptorBytes = await readExact(1);
|
|
16609
|
+
const descriptor = descriptorBytes.readUInt8(0);
|
|
16610
|
+
if (descriptor & 8)
|
|
16611
|
+
throw new Error("Reserved Codex zstd frame header");
|
|
16612
|
+
const single = descriptor >> 5 & 1;
|
|
16613
|
+
const headerSize = (single ? 0 : 1) + ([0, 1, 2, 4][descriptor & 3] ?? 0) + ([single, 2, 4, 8][descriptor >> 6] ?? 0);
|
|
16614
|
+
const header = Buffer.concat([magicBytes, descriptorBytes, await readExact(headerSize)]);
|
|
16615
|
+
async function* frameChunks() {
|
|
16616
|
+
yield header;
|
|
16617
|
+
for (; ; ) {
|
|
16618
|
+
const blockBytes = await readExact(3);
|
|
16619
|
+
const block = blockBytes.readUIntLE(0, 3);
|
|
16620
|
+
const type = block >> 1 & 3;
|
|
16621
|
+
if (type === 3)
|
|
16622
|
+
throw new Error("Reserved Codex zstd block");
|
|
16623
|
+
const blockSize = block >>> 3;
|
|
16624
|
+
if (blockSize > 128 * 1024)
|
|
16625
|
+
throw new Error("Invalid Codex zstd block size");
|
|
16626
|
+
yield blockBytes;
|
|
16627
|
+
yield await readExact(type === 1 ? 1 : blockSize);
|
|
16628
|
+
if (block & 1)
|
|
16629
|
+
break;
|
|
16630
|
+
}
|
|
16631
|
+
if (descriptor & 4)
|
|
16632
|
+
yield await readExact(4);
|
|
16633
|
+
}
|
|
16634
|
+
const frame = Readable.from(frameChunks(), { objectMode: false });
|
|
16635
|
+
const decoder = createZstdDecompress({
|
|
16636
|
+
chunkSize: 64 * 1024,
|
|
16637
|
+
params: { [zstdConstants.ZSTD_d_windowLogMax]: 27 }
|
|
16638
|
+
});
|
|
16639
|
+
const completed = pipeline(frame, decoder, { signal }).then(() => null, (error51) => error51);
|
|
16640
|
+
try {
|
|
16641
|
+
for await (const chunk of decoder) {
|
|
16506
16642
|
signal.throwIfAborted();
|
|
16507
|
-
yield
|
|
16643
|
+
yield chunk;
|
|
16508
16644
|
}
|
|
16509
|
-
|
|
16645
|
+
const error51 = await completed;
|
|
16646
|
+
if (error51)
|
|
16647
|
+
throw error51;
|
|
16648
|
+
} finally {
|
|
16649
|
+
frame.destroy();
|
|
16650
|
+
decoder.destroy();
|
|
16651
|
+
await completed;
|
|
16510
16652
|
}
|
|
16511
|
-
if (pending.length > MAX_FRAME)
|
|
16512
|
-
throw new Error("Codex zstd frame exceeds the safety limit");
|
|
16513
16653
|
}
|
|
16514
|
-
if (pending.length)
|
|
16515
|
-
throw new Error("Truncated Codex zstd rollout");
|
|
16516
16654
|
} finally {
|
|
16517
16655
|
stream.destroy();
|
|
16518
16656
|
}
|
|
@@ -16586,12 +16724,17 @@ var ROW_KINDS = /* @__PURE__ */ new Set([
|
|
|
16586
16724
|
]);
|
|
16587
16725
|
var HEAD_TYPE = /"type"\s*:\s*"([^"]+)"/u;
|
|
16588
16726
|
var TAIL_TYPE = /"type"\s*:\s*"([^"]+)"\s*\}\s*$/u;
|
|
16727
|
+
var USER_ROLE = /"role"\s*:\s*"user"/u;
|
|
16728
|
+
var EVENT_OF_INTEREST = /"type"\s*:\s*"(?:token_count|task_started|thread_settings_applied|user_message)"/u;
|
|
16589
16729
|
function rowKind(line) {
|
|
16590
16730
|
const head = HEAD_TYPE.exec(line.slice(0, 1024))?.[1];
|
|
16591
16731
|
if (head && ROW_KINDS.has(head))
|
|
16592
16732
|
return head;
|
|
16593
16733
|
return TAIL_TYPE.exec(line.slice(-1024))?.[1] ?? head;
|
|
16594
16734
|
}
|
|
16735
|
+
function markerIn(pattern, line) {
|
|
16736
|
+
return pattern.test(line.slice(0, 1024)) || pattern.test(line.slice(-1024));
|
|
16737
|
+
}
|
|
16595
16738
|
async function stamp(file2) {
|
|
16596
16739
|
const s = await lstat(file2, { bigint: true });
|
|
16597
16740
|
if (!s.isFile())
|
|
@@ -16655,9 +16798,9 @@ async function readCodexRollouts(files, thread, signal, options = {}) {
|
|
|
16655
16798
|
options.onIncomplete?.();
|
|
16656
16799
|
if (!kind || !ROW_KINDS.has(kind))
|
|
16657
16800
|
continue;
|
|
16658
|
-
if (kind === "response_item" &&
|
|
16801
|
+
if (kind === "response_item" && !markerIn(USER_ROLE, line))
|
|
16659
16802
|
continue;
|
|
16660
|
-
if (kind === "event_msg" &&
|
|
16803
|
+
if (kind === "event_msg" && !markerIn(EVENT_OF_INTEREST, line))
|
|
16661
16804
|
continue;
|
|
16662
16805
|
let row;
|
|
16663
16806
|
try {
|
|
@@ -16708,8 +16851,10 @@ async function readCodexRollouts(files, thread, signal, options = {}) {
|
|
|
16708
16851
|
break;
|
|
16709
16852
|
}
|
|
16710
16853
|
case "response_item":
|
|
16711
|
-
|
|
16712
|
-
|
|
16854
|
+
if (p.type === "message" && p.role === "user") {
|
|
16855
|
+
counters.boundary();
|
|
16856
|
+
firstPrompt ??= userItemPrompt(p);
|
|
16857
|
+
}
|
|
16713
16858
|
break;
|
|
16714
16859
|
case "event_msg":
|
|
16715
16860
|
if (p.type === "task_started") {
|
|
@@ -16839,7 +16984,7 @@ function createCodexUsageStatistics(environment, options = {}) {
|
|
|
16839
16984
|
const entries = await readCodexRollouts(kept.map(({ file: file2 }) => file2), group.thread, signal, options);
|
|
16840
16985
|
for (const file2 of group.files)
|
|
16841
16986
|
if (await stamp(file2.file) !== file2.fingerprint)
|
|
16842
|
-
throw new
|
|
16987
|
+
throw new HarnessUsageSourceChangedError("Codex rollout changed while reading; refresh to retry");
|
|
16843
16988
|
const named = options.sessionId ? void 0 : (await threadNames(signal)).get(group.thread);
|
|
16844
16989
|
return named ? entries.map((entry) => withUsageSession(entry, {
|
|
16845
16990
|
sessionId: entry.sessionId,
|
|
@@ -16880,6 +17025,7 @@ var usageFields = /* @__PURE__ */ new Set([
|
|
|
16880
17025
|
...safeIntegerFields,
|
|
16881
17026
|
...percentFields,
|
|
16882
17027
|
"sessionCacheUsage",
|
|
17028
|
+
"composerIndicators",
|
|
16883
17029
|
"totalCostUsd",
|
|
16884
17030
|
"totalCredits",
|
|
16885
17031
|
"contextUsagePercent",
|
|
@@ -16902,26 +17048,27 @@ function parseHostUsage(value) {
|
|
|
16902
17048
|
throw new Error(`Harness Usage contains unknown field '${key2}'`);
|
|
16903
17049
|
}
|
|
16904
17050
|
}
|
|
16905
|
-
|
|
17051
|
+
const indicators = value.composerIndicators === void 0 ? {} : { composerIndicators: composerIndicatorsSchema.parse(value.composerIndicators) };
|
|
17052
|
+
for (const field2 of [
|
|
16906
17053
|
"totalCredits",
|
|
16907
17054
|
"contextUsagePercent",
|
|
16908
17055
|
"apiOutputTokensPerSecond"
|
|
16909
17056
|
]) {
|
|
16910
|
-
const candidate = value[
|
|
17057
|
+
const candidate = value[field2];
|
|
16911
17058
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0)) {
|
|
16912
|
-
throw new Error(`Harness Usage '${
|
|
17059
|
+
throw new Error(`Harness Usage '${field2}' must be a finite non-negative number`);
|
|
16913
17060
|
}
|
|
16914
17061
|
}
|
|
16915
|
-
for (const
|
|
16916
|
-
const candidate = value[
|
|
17062
|
+
for (const field2 of tokenFields) {
|
|
17063
|
+
const candidate = value[field2];
|
|
16917
17064
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
|
|
16918
|
-
throw new Error(`Harness Usage '${
|
|
17065
|
+
throw new Error(`Harness Usage '${field2}' must be a non-negative safe integer`);
|
|
16919
17066
|
}
|
|
16920
17067
|
}
|
|
16921
|
-
for (const
|
|
16922
|
-
const candidate = value[
|
|
17068
|
+
for (const field2 of safeIntegerFields) {
|
|
17069
|
+
const candidate = value[field2];
|
|
16923
17070
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
|
|
16924
|
-
throw new Error(`Harness Usage '${
|
|
17071
|
+
throw new Error(`Harness Usage '${field2}' must be a non-negative safe integer`);
|
|
16925
17072
|
}
|
|
16926
17073
|
}
|
|
16927
17074
|
if (value.outputTokensPerSecond !== void 0 && (typeof value.outputTokensPerSecond !== "number" || !Number.isFinite(value.outputTokensPerSecond) || value.outputTokensPerSecond < 0)) {
|
|
@@ -16930,10 +17077,10 @@ function parseHostUsage(value) {
|
|
|
16930
17077
|
if (value.totalCostUsd !== void 0 && (typeof value.totalCostUsd !== "number" || !Number.isFinite(value.totalCostUsd) || value.totalCostUsd < 0)) {
|
|
16931
17078
|
throw new Error("Harness Usage 'totalCostUsd' must be a finite non-negative number");
|
|
16932
17079
|
}
|
|
16933
|
-
for (const
|
|
16934
|
-
const candidate = value[
|
|
17080
|
+
for (const field2 of percentFields) {
|
|
17081
|
+
const candidate = value[field2];
|
|
16935
17082
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0 || candidate > 100)) {
|
|
16936
|
-
throw new Error(`Harness Usage '${
|
|
17083
|
+
throw new Error(`Harness Usage '${field2}' must be between 0 and 100`);
|
|
16937
17084
|
}
|
|
16938
17085
|
}
|
|
16939
17086
|
if (value.sessionCacheUsage !== void 0) {
|
|
@@ -16972,9 +17119,9 @@ function parseHostUsage(value) {
|
|
|
16972
17119
|
if (value.costSource !== "publicPrice") {
|
|
16973
17120
|
throw new Error("Harness Usage 'unpricedModels' must be provided with a 'publicPrice' cost");
|
|
16974
17121
|
}
|
|
16975
|
-
return { ...value, unpricedModels: [...models] };
|
|
17122
|
+
return { ...value, ...indicators, unpricedModels: [...models] };
|
|
16976
17123
|
}
|
|
16977
|
-
return { ...value };
|
|
17124
|
+
return { ...value, ...indicators };
|
|
16978
17125
|
}
|
|
16979
17126
|
var requestTokenFields = [
|
|
16980
17127
|
"inputTokens",
|
|
@@ -17004,19 +17151,19 @@ function parseHostUsageRequest(value) {
|
|
|
17004
17151
|
if (typeof value.requestId !== "string" || value.requestId.length === 0) {
|
|
17005
17152
|
throw new Error("Harness Usage request 'requestId' must be a non-empty string");
|
|
17006
17153
|
}
|
|
17007
|
-
for (const
|
|
17008
|
-
const candidate = value[
|
|
17154
|
+
for (const field2 of ["model", "provider"]) {
|
|
17155
|
+
const candidate = value[field2];
|
|
17009
17156
|
if (candidate !== void 0 && (typeof candidate !== "string" || candidate.length === 0)) {
|
|
17010
|
-
throw new Error(`Harness Usage request '${
|
|
17157
|
+
throw new Error(`Harness Usage request '${field2}' must be a non-empty string`);
|
|
17011
17158
|
}
|
|
17012
17159
|
}
|
|
17013
17160
|
if (value.historical !== void 0 && typeof value.historical !== "boolean") {
|
|
17014
17161
|
throw new Error("Harness Usage request 'historical' must be a boolean");
|
|
17015
17162
|
}
|
|
17016
|
-
for (const
|
|
17017
|
-
const candidate = value[
|
|
17163
|
+
for (const field2 of requestTokenFields) {
|
|
17164
|
+
const candidate = value[field2];
|
|
17018
17165
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
|
|
17019
|
-
throw new Error(`Harness Usage request '${
|
|
17166
|
+
throw new Error(`Harness Usage request '${field2}' must be a non-negative safe integer`);
|
|
17020
17167
|
}
|
|
17021
17168
|
}
|
|
17022
17169
|
if (value.inputTokens === void 0 || value.outputTokens === void 0) {
|
|
@@ -17050,7 +17197,7 @@ function tokenSnapshot(value) {
|
|
|
17050
17197
|
const total = object2(token.total);
|
|
17051
17198
|
const last = object2(token.last);
|
|
17052
17199
|
const result = {};
|
|
17053
|
-
for (const
|
|
17200
|
+
for (const field2 of [
|
|
17054
17201
|
"totalTokens",
|
|
17055
17202
|
"inputTokens",
|
|
17056
17203
|
"cachedInputTokens",
|
|
@@ -17058,9 +17205,9 @@ function tokenSnapshot(value) {
|
|
|
17058
17205
|
"outputTokens",
|
|
17059
17206
|
"reasoningOutputTokens"
|
|
17060
17207
|
]) {
|
|
17061
|
-
const n = integer2(total?.[
|
|
17208
|
+
const n = integer2(total?.[field2]);
|
|
17062
17209
|
if (n !== void 0)
|
|
17063
|
-
result[
|
|
17210
|
+
result[field2] = n;
|
|
17064
17211
|
}
|
|
17065
17212
|
const used = integer2(last?.totalTokens);
|
|
17066
17213
|
const window = integer2(token.modelContextWindow);
|
|
Binary file
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"manifestVersion": 1,
|
|
3
|
+
"id": "copilot",
|
|
4
|
+
"name": "GitHub Copilot",
|
|
5
|
+
"version": "0.0.0",
|
|
6
|
+
"installation": {
|
|
7
|
+
"commands": [
|
|
8
|
+
{
|
|
9
|
+
"terminal": "npm · macOS / Linux / Windows",
|
|
10
|
+
"command": "npm install -g @github/copilot"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"after": {
|
|
14
|
+
"en": "Run copilot; use /login only if authentication is unavailable. Existing native authentication on the target Host can be reused. CODEXHOST_COPILOT_COMMAND selects an existing CLI installation. Windows npm launchers resolve to that installation's actual JavaScript or executable entrypoint; arbitrary shell wrappers are not supported.",
|
|
15
|
+
"zh-CN": "运行 copilot;若缺少认证,再使用 /login。可复用目标 Host 已有的原生登录;CODEXHOST_COPILOT_COMMAND 可指定已有 CLI 安装。Windows npm 启动器会解析到同一安装的实际 JavaScript 或可执行入口,不支持任意 shell 包装脚本。"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"links": {
|
|
19
|
+
"website": "https://github.com/features/copilot",
|
|
20
|
+
"documentation": "https://docs.github.com/en/copilot/get-started/cli-quickstart",
|
|
21
|
+
"installation": "https://docs.github.com/en/copilot/how-tos/copilot-cli/set-up-copilot-cli/install-copilot-cli"
|
|
22
|
+
},
|
|
23
|
+
"adapterApiVersion": 1,
|
|
24
|
+
"entry": "plugin.mjs",
|
|
25
|
+
"icon": "./assets/icon.png"
|
|
26
|
+
}
|