@liberseek/boft-cli-win32-arm64 0.8.3 → 0.8.5
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 +117 -13
- package/app/console-web.js +713 -129
- package/app/desktop-controller.mjs +713 -42
- package/app/host-runtime.mjs +2535 -855
- package/app/plugins/antigravity/plugin.mjs +437 -67
- package/app/plugins/claude-code/plugin.mjs +758 -248
- package/app/plugins/codebuddy/plugin.mjs +348 -156
- package/app/plugins/codex-usage/plugin.mjs +258 -106
- package/app/plugins/copilot/assets/icon.png +0 -0
- package/app/plugins/copilot/manifest.json +26 -0
- package/app/plugins/copilot/plugin.mjs +34651 -0
- package/app/plugins/cursor-cli/plugin.mjs +20905 -44961
- package/app/plugins/deepseek-harness/plugin.mjs +195 -53
- package/app/plugins/enabled.json +1 -0
- package/app/plugins/grok/plugin.mjs +584 -138
- package/app/plugins/hermes/plugin.mjs +134 -13
- package/app/plugins/kimi-code/plugin.mjs +145 -26
- package/app/plugins/kiro-cli/plugin.mjs +145 -26
- package/app/plugins/muse/plugin.mjs +132 -14
- package/app/plugins/omp/plugin.mjs +2245 -2040
- package/app/plugins/opencode/plugin.mjs +196 -72
- package/app/plugins/pi/plugin.mjs +2643 -2309
- package/app/plugins/qoder/plugin.mjs +162 -40
- package/app/plugins/qoder-cn/plugin.mjs +162 -40
- package/app/plugins/workbuddy/plugin.mjs +609 -180
- package/app/plugins/zcode/plugin.mjs +192 -44
- package/app/renderer-extension.js +3405 -429
- package/bin/boft.exe +0 -0
- package/libexec/boft-node-repl.exe +0 -0
- package/libexec/boft-shim.exe +0 -0
- package/libexec/boft-updater.exe +0 -0
- package/package.json +1 -1
|
@@ -3040,10 +3040,10 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
3040
3040
|
const shape = def.shape;
|
|
3041
3041
|
const propValues = {};
|
|
3042
3042
|
for (const key in shape) {
|
|
3043
|
-
const
|
|
3044
|
-
if (
|
|
3043
|
+
const field2 = shape[key]._zod;
|
|
3044
|
+
if (field2.values) {
|
|
3045
3045
|
propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
|
|
3046
|
-
for (const v of
|
|
3046
|
+
for (const v of field2.values)
|
|
3047
3047
|
propValues[key].add(v);
|
|
3048
3048
|
}
|
|
3049
3049
|
}
|
|
@@ -14662,10 +14662,19 @@ var model = external_exports.string().min(1).max(512);
|
|
|
14662
14662
|
var project = external_exports.string().min(1).max(4096);
|
|
14663
14663
|
var usageStatisticsParamsSchema = external_exports.strictObject({
|
|
14664
14664
|
range: external_exports.enum(USAGE_STATISTICS_RANGES),
|
|
14665
|
+
/** Display timezone for ranges, dates and hourly buckets; omitted means the Host's local zone. */
|
|
14666
|
+
timeZone: external_exports.string().min(1).max(128).refine((value) => {
|
|
14667
|
+
try {
|
|
14668
|
+
new Intl.DateTimeFormat("en", { timeZone: value });
|
|
14669
|
+
return true;
|
|
14670
|
+
} catch {
|
|
14671
|
+
return false;
|
|
14672
|
+
}
|
|
14673
|
+
}, "Unsupported usage statistics timezone").optional(),
|
|
14665
14674
|
harness: harness.optional(),
|
|
14666
14675
|
model: model.nullable().optional(),
|
|
14667
14676
|
project: project.nullable().optional(),
|
|
14668
|
-
/** One
|
|
14677
|
+
/** One date in the query timezone inside the range. */
|
|
14669
14678
|
date: localDate.optional()
|
|
14670
14679
|
});
|
|
14671
14680
|
var usageStatisticsTotalsSchema = external_exports.strictObject({
|
|
@@ -14674,6 +14683,8 @@ var usageStatisticsTotalsSchema = external_exports.strictObject({
|
|
|
14674
14683
|
cachedInputTokens: count,
|
|
14675
14684
|
cacheWriteInputTokens: count,
|
|
14676
14685
|
cacheKnownInputTokens: count,
|
|
14686
|
+
cacheHitCachedInputTokens: count,
|
|
14687
|
+
cacheHitInputTokens: count,
|
|
14677
14688
|
outputTokens: count,
|
|
14678
14689
|
reasoningOutputTokens: count,
|
|
14679
14690
|
/** USD at the public price, summed over the priced requests only. */
|
|
@@ -14701,7 +14712,7 @@ var usageStatisticsSessionSchema = external_exports.strictObject({
|
|
|
14701
14712
|
});
|
|
14702
14713
|
var usageStatisticsResultSchema = external_exports.strictObject({
|
|
14703
14714
|
range: external_exports.enum(USAGE_STATISTICS_RANGES),
|
|
14704
|
-
/** First
|
|
14715
|
+
/** First date in the query timezone (Host local when omitted); null for all time. */
|
|
14705
14716
|
from: localDate.nullable(),
|
|
14706
14717
|
to: localDate,
|
|
14707
14718
|
/** The filters these figures apply, echoed so a late answer to older filters is recognised. */
|
|
@@ -14741,7 +14752,7 @@ var usageStatisticsResultSchema = external_exports.strictObject({
|
|
|
14741
14752
|
totals: usageStatisticsTotalsSchema,
|
|
14742
14753
|
/** Each date and Harness of the range: every filter except the day. */
|
|
14743
14754
|
daily: external_exports.array(external_exports.strictObject({ date: localDate, harness, ...totals })).max(2e5),
|
|
14744
|
-
/**
|
|
14755
|
+
/** Weekday (0 = Sunday) and hour in the query timezone, all filters applied. */
|
|
14745
14756
|
hourly: external_exports.array(external_exports.strictObject({
|
|
14746
14757
|
weekday: external_exports.number().int().min(0).max(6),
|
|
14747
14758
|
hour: external_exports.number().int().min(0).max(23),
|
|
@@ -14781,6 +14792,51 @@ var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
|
14781
14792
|
var threadPrewarmDiscardParamsSchema = external_exports.object({ threadId: hostThreadIdSchema });
|
|
14782
14793
|
var threadPrewarmDiscardResultSchema = external_exports.object({ discarded: external_exports.boolean() });
|
|
14783
14794
|
|
|
14795
|
+
// ../../shared-contracts/dist/thread-questions.js
|
|
14796
|
+
var field = external_exports.discriminatedUnion("type", [
|
|
14797
|
+
external_exports.object({
|
|
14798
|
+
id: external_exports.string().min(1),
|
|
14799
|
+
type: external_exports.literal("choice"),
|
|
14800
|
+
prompt: external_exports.string(),
|
|
14801
|
+
options: external_exports.array(external_exports.object({
|
|
14802
|
+
value: external_exports.string().min(1),
|
|
14803
|
+
label: external_exports.string(),
|
|
14804
|
+
description: external_exports.string().optional()
|
|
14805
|
+
})).min(1),
|
|
14806
|
+
multiple: external_exports.boolean(),
|
|
14807
|
+
allowOther: external_exports.boolean(),
|
|
14808
|
+
optional: external_exports.boolean()
|
|
14809
|
+
}),
|
|
14810
|
+
external_exports.object({
|
|
14811
|
+
id: external_exports.string().min(1),
|
|
14812
|
+
type: external_exports.literal("text"),
|
|
14813
|
+
prompt: external_exports.string(),
|
|
14814
|
+
multiline: external_exports.boolean(),
|
|
14815
|
+
secret: external_exports.literal(false),
|
|
14816
|
+
optional: external_exports.boolean(),
|
|
14817
|
+
placeholder: external_exports.string().optional(),
|
|
14818
|
+
prefill: external_exports.string().optional()
|
|
14819
|
+
})
|
|
14820
|
+
]);
|
|
14821
|
+
var threadQuestionSchema = external_exports.object({
|
|
14822
|
+
interactionId: external_exports.string().min(1),
|
|
14823
|
+
turnId: external_exports.string().min(1),
|
|
14824
|
+
title: external_exports.string().optional(),
|
|
14825
|
+
questions: external_exports.array(field).min(1)
|
|
14826
|
+
}).refine(({ questions }) => questions.some((q) => q.type === "choice" && q.multiple), {
|
|
14827
|
+
message: "Shared cards require at least one multi-select question"
|
|
14828
|
+
});
|
|
14829
|
+
var threadQuestionsListParamsSchema = external_exports.strictObject({ threadId: external_exports.string().min(1) });
|
|
14830
|
+
var threadQuestionsResultSchema = external_exports.object({ questions: external_exports.array(threadQuestionSchema) });
|
|
14831
|
+
var threadQuestionRespondParamsSchema = external_exports.strictObject({
|
|
14832
|
+
threadId: external_exports.string().min(1),
|
|
14833
|
+
turnId: external_exports.string().min(1),
|
|
14834
|
+
interactionId: external_exports.string().min(1),
|
|
14835
|
+
answers: external_exports.record(external_exports.string(), external_exports.array(external_exports.string())),
|
|
14836
|
+
cancelled: external_exports.boolean().default(false)
|
|
14837
|
+
});
|
|
14838
|
+
var threadQuestionRespondResultSchema = external_exports.object({ accepted: external_exports.literal(true) });
|
|
14839
|
+
|
|
14784
14840
|
// ../../shared-contracts/dist/harness-plugins.js
|
|
14785
14841
|
var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
|
|
14786
14842
|
var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
|
|
@@ -14883,6 +14939,8 @@ var CONSOLE_HOST_METHODS = Object.freeze([
|
|
|
14883
14939
|
"codexhost/harness/display-settings/set",
|
|
14884
14940
|
"codexhost/harness/inspect",
|
|
14885
14941
|
"codexhost/harness/installation",
|
|
14942
|
+
"codexhost/harness/installation/start",
|
|
14943
|
+
"codexhost/harness/installation/status",
|
|
14886
14944
|
"codexhost/harness/launch-settings/get",
|
|
14887
14945
|
"codexhost/harness/launch-settings/set",
|
|
14888
14946
|
HARNESS_LONG_CONTEXT_GET_METHOD,
|
|
@@ -14960,7 +15018,18 @@ var threadManualCompactionStartedSchema = external_exports.strictObject({
|
|
|
14960
15018
|
var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
|
|
14961
15019
|
var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
|
|
14962
15020
|
var cacheHitRatePercentSchema = external_exports.number().finite().min(0).max(100);
|
|
15021
|
+
var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text2) => text2.length <= maximum));
|
|
15022
|
+
var composerIndicatorsSchema = external_exports.array(external_exports.object({
|
|
15023
|
+
kind: external_exports.literal("countdown"),
|
|
15024
|
+
id: external_exports.string().min(1).max(64),
|
|
15025
|
+
expiresAtUnix: nonNegativeSafeIntegerSchema,
|
|
15026
|
+
label: indicatorTextSchema(256).optional(),
|
|
15027
|
+
tooltip: indicatorTextSchema(1024).optional()
|
|
15028
|
+
}).strict()).max(2).refine((entries) => new Set(entries.map(({ id }) => id)).size === entries.length, {
|
|
15029
|
+
message: "Composer indicator IDs must be unique"
|
|
15030
|
+
});
|
|
14963
15031
|
var threadUsageSnapshotSchema = external_exports.object({
|
|
15032
|
+
composerIndicators: composerIndicatorsSchema.optional(),
|
|
14964
15033
|
inputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
14965
15034
|
cachedInputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
14966
15035
|
cacheWriteInputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
@@ -15386,7 +15455,9 @@ var harnessSessionCapabilitiesSchema = external_exports.object({
|
|
|
15386
15455
|
}).strict().optional(),
|
|
15387
15456
|
input: external_exports.object({
|
|
15388
15457
|
image: external_exports.boolean()
|
|
15389
|
-
}).strict().optional()
|
|
15458
|
+
}).strict().optional(),
|
|
15459
|
+
/** True only when `turn.steer` delivers input into the active Turn through a native primitive. */
|
|
15460
|
+
steer: external_exports.boolean().optional()
|
|
15390
15461
|
}).strict();
|
|
15391
15462
|
var harnessConfigurationStateSchema = external_exports.object({
|
|
15392
15463
|
effectiveModel: harnessModelRefSchema.optional(),
|
|
@@ -15433,7 +15504,9 @@ var harnessInspectionSchema = external_exports.union([
|
|
|
15433
15504
|
var harnessInspectParamsSchema = external_exports.object({
|
|
15434
15505
|
harnessId: harnessIdSchema,
|
|
15435
15506
|
cwd: nonBlankTextSchema2.max(16384).optional(),
|
|
15436
|
-
refresh: external_exports.boolean().optional()
|
|
15507
|
+
refresh: external_exports.boolean().optional(),
|
|
15508
|
+
/** `availability` asks only whether the Harness can run; see `InspectHarnessInput.purpose`. */
|
|
15509
|
+
purpose: external_exports.literal("availability").optional()
|
|
15437
15510
|
}).strict();
|
|
15438
15511
|
var harnessWebUiOpenParamsSchema = external_exports.object({
|
|
15439
15512
|
harnessId: harnessIdSchema
|
|
@@ -15518,13 +15591,25 @@ var threadOwnershipListResultSchema = external_exports.object({
|
|
|
15518
15591
|
seen.add(thread.threadId);
|
|
15519
15592
|
}
|
|
15520
15593
|
});
|
|
15594
|
+
var threadSteeringInspectParamsSchema = external_exports.object({
|
|
15595
|
+
threadId: hostThreadIdSchema,
|
|
15596
|
+
/** The text about to be steered; a Harness command always stops and restarts. */
|
|
15597
|
+
text: external_exports.string().optional()
|
|
15598
|
+
}).strict();
|
|
15599
|
+
var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
|
|
15600
|
+
var threadSteeringInspectResultSchema = external_exports.object({
|
|
15601
|
+
delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
|
|
15602
|
+
}).strict();
|
|
15521
15603
|
|
|
15522
15604
|
// ../../shared-contracts/dist/harness-route.js
|
|
15523
15605
|
var harnessPluginRouteSchema = external_exports.object({
|
|
15524
15606
|
harnessId: harnessPluginIdSchema,
|
|
15525
15607
|
model: harnessModelRefSchema.optional(),
|
|
15526
15608
|
thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
15527
|
-
permissionModeId: harnessPermissionModeIdSchema.optional()
|
|
15609
|
+
permissionModeId: harnessPermissionModeIdSchema.optional(),
|
|
15610
|
+
/** A draft prewarm create: stays unsubmitted until the user's first Turn.
|
|
15611
|
+
* Desktop forwards only the Model of a main-process prewarm to thread/start. */
|
|
15612
|
+
prewarm: external_exports.literal(true).optional()
|
|
15528
15613
|
}).strict();
|
|
15529
15614
|
|
|
15530
15615
|
// ../../shared-contracts/dist/harness-launch-settings.js
|
|
@@ -15550,6 +15635,10 @@ var harnessInstallationStateSchema = external_exports.object({
|
|
|
15550
15635
|
latestVersion: external_exports.string().min(1).max(128),
|
|
15551
15636
|
updateAvailable: external_exports.boolean(),
|
|
15552
15637
|
canUpdate: external_exports.boolean(),
|
|
15638
|
+
/** Defaults to CLI; some Harnesses ship only inside a desktop application. */
|
|
15639
|
+
versionKind: external_exports.enum(["cli", "application"]).optional(),
|
|
15640
|
+
/** Official download opened by the user; does not imply an automatic installation. */
|
|
15641
|
+
manualUpdateUrl: external_exports.url().max(2048).refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Manual updates require a credential-free HTTPS URL").optional(),
|
|
15553
15642
|
// Adapter-owned diagnostic text; UI uses messageCode rather than displaying it verbatim.
|
|
15554
15643
|
message: external_exports.string().max(2048).optional(),
|
|
15555
15644
|
messageCode: external_exports.string().min(1).max(128).optional(),
|
|
@@ -15557,6 +15646,20 @@ var harnessInstallationStateSchema = external_exports.object({
|
|
|
15557
15646
|
notice: harnessLocalizedTextSchema.optional(),
|
|
15558
15647
|
latestVersionKind: external_exports.enum(["unknown", "tracking-branch"]).optional()
|
|
15559
15648
|
}).strict();
|
|
15649
|
+
var harnessInstallationTaskParamsSchema = external_exports.object({ taskId: external_exports.string().uuid() }).strict();
|
|
15650
|
+
var harnessInstallationTaskSchema = external_exports.discriminatedUnion("status", [
|
|
15651
|
+
external_exports.object({ taskId: external_exports.string().uuid(), status: external_exports.literal("running") }).strict(),
|
|
15652
|
+
external_exports.object({
|
|
15653
|
+
taskId: external_exports.string().uuid(),
|
|
15654
|
+
status: external_exports.literal("succeeded"),
|
|
15655
|
+
result: harnessInstallationStateSchema
|
|
15656
|
+
}).strict(),
|
|
15657
|
+
external_exports.object({
|
|
15658
|
+
taskId: external_exports.string().uuid(),
|
|
15659
|
+
status: external_exports.literal("failed"),
|
|
15660
|
+
error: external_exports.object({ code: external_exports.number().int(), message: external_exports.string().min(1).max(2048) }).strict()
|
|
15661
|
+
}).strict()
|
|
15662
|
+
]);
|
|
15560
15663
|
|
|
15561
15664
|
// ../../shared-contracts/dist/codex-accounts.js
|
|
15562
15665
|
var accountIdSchema = external_exports.string().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u);
|
|
@@ -16071,6 +16174,18 @@ function sanitizeDiagnosticTail(value) {
|
|
|
16071
16174
|
return redacted.length <= DIAGNOSTIC_TAIL_MAX_LENGTH ? redacted : redacted.slice(-DIAGNOSTIC_TAIL_MAX_LENGTH);
|
|
16072
16175
|
}
|
|
16073
16176
|
|
|
16177
|
+
// ../../harness-adapter/dist/steer.js
|
|
16178
|
+
function unsupportedSteer(harnessLabel) {
|
|
16179
|
+
return {
|
|
16180
|
+
ok: false,
|
|
16181
|
+
error: {
|
|
16182
|
+
code: "unsupported",
|
|
16183
|
+
message: `${harnessLabel} cannot steer an active Turn natively`,
|
|
16184
|
+
retryable: false
|
|
16185
|
+
}
|
|
16186
|
+
};
|
|
16187
|
+
}
|
|
16188
|
+
|
|
16074
16189
|
// ../../harness-adapter/dist/usage.js
|
|
16075
16190
|
var tokenFields = [
|
|
16076
16191
|
"inputTokens",
|
|
@@ -16098,6 +16213,7 @@ var usageFields = /* @__PURE__ */ new Set([
|
|
|
16098
16213
|
...safeIntegerFields,
|
|
16099
16214
|
...percentFields,
|
|
16100
16215
|
"sessionCacheUsage",
|
|
16216
|
+
"composerIndicators",
|
|
16101
16217
|
"totalCostUsd",
|
|
16102
16218
|
"totalCredits",
|
|
16103
16219
|
"contextUsagePercent",
|
|
@@ -16120,26 +16236,27 @@ function parseHostUsage(value) {
|
|
|
16120
16236
|
throw new Error(`Harness Usage contains unknown field '${key}'`);
|
|
16121
16237
|
}
|
|
16122
16238
|
}
|
|
16123
|
-
|
|
16239
|
+
const indicators = value.composerIndicators === void 0 ? {} : { composerIndicators: composerIndicatorsSchema.parse(value.composerIndicators) };
|
|
16240
|
+
for (const field2 of [
|
|
16124
16241
|
"totalCredits",
|
|
16125
16242
|
"contextUsagePercent",
|
|
16126
16243
|
"apiOutputTokensPerSecond"
|
|
16127
16244
|
]) {
|
|
16128
|
-
const candidate = value[
|
|
16245
|
+
const candidate = value[field2];
|
|
16129
16246
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0)) {
|
|
16130
|
-
throw new Error(`Harness Usage '${
|
|
16247
|
+
throw new Error(`Harness Usage '${field2}' must be a finite non-negative number`);
|
|
16131
16248
|
}
|
|
16132
16249
|
}
|
|
16133
|
-
for (const
|
|
16134
|
-
const candidate = value[
|
|
16250
|
+
for (const field2 of tokenFields) {
|
|
16251
|
+
const candidate = value[field2];
|
|
16135
16252
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
|
|
16136
|
-
throw new Error(`Harness Usage '${
|
|
16253
|
+
throw new Error(`Harness Usage '${field2}' must be a non-negative safe integer`);
|
|
16137
16254
|
}
|
|
16138
16255
|
}
|
|
16139
|
-
for (const
|
|
16140
|
-
const candidate = value[
|
|
16256
|
+
for (const field2 of safeIntegerFields) {
|
|
16257
|
+
const candidate = value[field2];
|
|
16141
16258
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
|
|
16142
|
-
throw new Error(`Harness Usage '${
|
|
16259
|
+
throw new Error(`Harness Usage '${field2}' must be a non-negative safe integer`);
|
|
16143
16260
|
}
|
|
16144
16261
|
}
|
|
16145
16262
|
if (value.outputTokensPerSecond !== void 0 && (typeof value.outputTokensPerSecond !== "number" || !Number.isFinite(value.outputTokensPerSecond) || value.outputTokensPerSecond < 0)) {
|
|
@@ -16148,16 +16265,16 @@ function parseHostUsage(value) {
|
|
|
16148
16265
|
if (value.totalCostUsd !== void 0 && (typeof value.totalCostUsd !== "number" || !Number.isFinite(value.totalCostUsd) || value.totalCostUsd < 0)) {
|
|
16149
16266
|
throw new Error("Harness Usage 'totalCostUsd' must be a finite non-negative number");
|
|
16150
16267
|
}
|
|
16151
|
-
for (const
|
|
16152
|
-
const candidate = value[
|
|
16268
|
+
for (const field2 of ["totalCredits", "contextUsagePercent"]) {
|
|
16269
|
+
const candidate = value[field2];
|
|
16153
16270
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0)) {
|
|
16154
|
-
throw new Error(`Harness Usage '${
|
|
16271
|
+
throw new Error(`Harness Usage '${field2}' must be a finite non-negative number`);
|
|
16155
16272
|
}
|
|
16156
16273
|
}
|
|
16157
|
-
for (const
|
|
16158
|
-
const candidate = value[
|
|
16274
|
+
for (const field2 of percentFields) {
|
|
16275
|
+
const candidate = value[field2];
|
|
16159
16276
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0 || candidate > 100)) {
|
|
16160
|
-
throw new Error(`Harness Usage '${
|
|
16277
|
+
throw new Error(`Harness Usage '${field2}' must be between 0 and 100`);
|
|
16161
16278
|
}
|
|
16162
16279
|
}
|
|
16163
16280
|
if (value.sessionCacheUsage !== void 0) {
|
|
@@ -16196,9 +16313,9 @@ function parseHostUsage(value) {
|
|
|
16196
16313
|
if (value.costSource !== "publicPrice") {
|
|
16197
16314
|
throw new Error("Harness Usage 'unpricedModels' must be provided with a 'publicPrice' cost");
|
|
16198
16315
|
}
|
|
16199
|
-
return { ...value, unpricedModels: [...models] };
|
|
16316
|
+
return { ...value, ...indicators, unpricedModels: [...models] };
|
|
16200
16317
|
}
|
|
16201
|
-
return { ...value };
|
|
16318
|
+
return { ...value, ...indicators };
|
|
16202
16319
|
}
|
|
16203
16320
|
var requestTokenFields = [
|
|
16204
16321
|
"inputTokens",
|
|
@@ -16228,19 +16345,19 @@ function parseHostUsageRequest(value) {
|
|
|
16228
16345
|
if (typeof value.requestId !== "string" || value.requestId.length === 0) {
|
|
16229
16346
|
throw new Error("Harness Usage request 'requestId' must be a non-empty string");
|
|
16230
16347
|
}
|
|
16231
|
-
for (const
|
|
16232
|
-
const candidate = value[
|
|
16348
|
+
for (const field2 of ["model", "provider"]) {
|
|
16349
|
+
const candidate = value[field2];
|
|
16233
16350
|
if (candidate !== void 0 && (typeof candidate !== "string" || candidate.length === 0)) {
|
|
16234
|
-
throw new Error(`Harness Usage request '${
|
|
16351
|
+
throw new Error(`Harness Usage request '${field2}' must be a non-empty string`);
|
|
16235
16352
|
}
|
|
16236
16353
|
}
|
|
16237
16354
|
if (value.historical !== void 0 && typeof value.historical !== "boolean") {
|
|
16238
16355
|
throw new Error("Harness Usage request 'historical' must be a boolean");
|
|
16239
16356
|
}
|
|
16240
|
-
for (const
|
|
16241
|
-
const candidate = value[
|
|
16357
|
+
for (const field2 of requestTokenFields) {
|
|
16358
|
+
const candidate = value[field2];
|
|
16242
16359
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
|
|
16243
|
-
throw new Error(`Harness Usage request '${
|
|
16360
|
+
throw new Error(`Harness Usage request '${field2}' must be a non-negative safe integer`);
|
|
16244
16361
|
}
|
|
16245
16362
|
}
|
|
16246
16363
|
if (value.inputTokens === void 0 || value.outputTokens === void 0) {
|
|
@@ -16358,6 +16475,7 @@ var harnessBrokerMethodSchema = external_exports.enum([
|
|
|
16358
16475
|
"adapter.sessionImport.resolve",
|
|
16359
16476
|
"adapter.subagent.readSnapshot",
|
|
16360
16477
|
"session.readSnapshot",
|
|
16478
|
+
"session.readCapabilities",
|
|
16361
16479
|
"session.refreshUsage",
|
|
16362
16480
|
"session.execute",
|
|
16363
16481
|
"session.commands.list",
|
|
@@ -16457,30 +16575,6 @@ function consumeBrokerFrames(socket, onFrame, onError) {
|
|
|
16457
16575
|
});
|
|
16458
16576
|
}
|
|
16459
16577
|
|
|
16460
|
-
// ../../harness-broker/dist/paths.js
|
|
16461
|
-
import os from "node:os";
|
|
16462
|
-
import path from "node:path";
|
|
16463
|
-
var HARNESS_BROKER_DESCRIPTOR_ENV = "CODEXHOST_CLAUDE_BROKER_DESCRIPTOR";
|
|
16464
|
-
var HARNESS_BROKER_DESCRIPTOR_FILE = "claude-code-broker-v1.json";
|
|
16465
|
-
function defaultHarnessBrokerDirectory(environment = process.env) {
|
|
16466
|
-
const home = environment.HOME || os.homedir();
|
|
16467
|
-
return path.join(home, ".codexhost", "harness-broker");
|
|
16468
|
-
}
|
|
16469
|
-
function defaultHarnessBrokerDescriptorPath(environment = process.env, harnessId = "claude-code") {
|
|
16470
|
-
harnessPluginIdSchema.parse(harnessId);
|
|
16471
|
-
if (harnessId !== "claude-code")
|
|
16472
|
-
return path.join(defaultHarnessBrokerDirectory(environment), `${harnessId}-broker-v1.json`);
|
|
16473
|
-
return environment[HARNESS_BROKER_DESCRIPTOR_ENV] ?? path.join(defaultHarnessBrokerDirectory(environment), HARNESS_BROKER_DESCRIPTOR_FILE);
|
|
16474
|
-
}
|
|
16475
|
-
function harnessBrokerLaunchAgentLabel(harnessId = "claude-code") {
|
|
16476
|
-
harnessPluginIdSchema.parse(harnessId);
|
|
16477
|
-
return harnessId === "claude-code" ? "ai.bytepioneer.codexhost.native-harness-broker" : `ai.bytepioneer.codexhost.${harnessId}-broker`;
|
|
16478
|
-
}
|
|
16479
|
-
function harnessBrokerLaunchAgentPlistPath(environment = process.env, harnessId = "claude-code") {
|
|
16480
|
-
const home = environment.HOME || os.homedir();
|
|
16481
|
-
return path.join(home, "Library", "LaunchAgents", `${harnessBrokerLaunchAgentLabel(harnessId)}.plist`);
|
|
16482
|
-
}
|
|
16483
|
-
|
|
16484
16578
|
// ../../harness-broker/dist/validation.js
|
|
16485
16579
|
var cwdSchema = external_exports.string().min(1).max(16384);
|
|
16486
16580
|
var brokerEnvironmentSchema = external_exports.object({
|
|
@@ -16531,7 +16625,11 @@ var brokerOpenInputSchema = external_exports.discriminatedUnion("kind", [
|
|
|
16531
16625
|
forkSchema,
|
|
16532
16626
|
rollbackSchema
|
|
16533
16627
|
]);
|
|
16534
|
-
var brokerInspectInputSchema = external_exports.object({
|
|
16628
|
+
var brokerInspectInputSchema = external_exports.object({
|
|
16629
|
+
cwd: cwdSchema.optional(),
|
|
16630
|
+
refresh: external_exports.boolean().optional(),
|
|
16631
|
+
purpose: external_exports.literal("availability").optional()
|
|
16632
|
+
}).strict();
|
|
16535
16633
|
var brokerSessionImportListParamsSchema = external_exports.object({
|
|
16536
16634
|
offset: external_exports.number().int().nonnegative().safe(),
|
|
16537
16635
|
limit: external_exports.number().int().min(1).max(HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE)
|
|
@@ -16546,10 +16644,10 @@ var brokerSessionImportSourceSchema = external_exports.object({
|
|
|
16546
16644
|
candidate: harnessSessionImportCandidateSchema,
|
|
16547
16645
|
nativeRef: nativeSessionRefSchema
|
|
16548
16646
|
}).strict().superRefine((source, context) => {
|
|
16549
|
-
if (source.nativeRef.
|
|
16647
|
+
if (source.nativeRef.nativeSessionId !== source.candidate.nativeSessionId) {
|
|
16550
16648
|
context.addIssue({
|
|
16551
16649
|
code: "custom",
|
|
16552
|
-
message: "
|
|
16650
|
+
message: "Session import source identity does not match"
|
|
16553
16651
|
});
|
|
16554
16652
|
}
|
|
16555
16653
|
});
|
|
@@ -16559,6 +16657,11 @@ var turnStartSchema = external_exports.object({
|
|
|
16559
16657
|
turnId: hostTurnIdSchema,
|
|
16560
16658
|
input: external_exports.array(textInputSchema)
|
|
16561
16659
|
}).strict();
|
|
16660
|
+
var turnSteerSchema = external_exports.object({
|
|
16661
|
+
type: external_exports.literal("turn.steer"),
|
|
16662
|
+
turnId: hostTurnIdSchema,
|
|
16663
|
+
input: external_exports.array(textInputSchema)
|
|
16664
|
+
}).strict();
|
|
16562
16665
|
var turnCancelSchema = external_exports.object({ type: external_exports.literal("turn.cancel"), turnId: hostTurnIdSchema }).strict();
|
|
16563
16666
|
var interactionResponseSchema = external_exports.union([
|
|
16564
16667
|
external_exports.object({
|
|
@@ -16584,6 +16687,7 @@ var permissionSelectSchema = external_exports.object({
|
|
|
16584
16687
|
}).strict();
|
|
16585
16688
|
var brokerHostCommandSchema = external_exports.discriminatedUnion("type", [
|
|
16586
16689
|
turnStartSchema,
|
|
16690
|
+
turnSteerSchema,
|
|
16587
16691
|
turnCancelSchema,
|
|
16588
16692
|
interactionRespondSchema,
|
|
16589
16693
|
modelSelectSchema,
|
|
@@ -16717,6 +16821,107 @@ var harnessOutputSchema = external_exports.custom((value) => {
|
|
|
16717
16821
|
return false;
|
|
16718
16822
|
});
|
|
16719
16823
|
|
|
16824
|
+
// ../../harness-broker/dist/session-import-client.js
|
|
16825
|
+
function createBrokerSessionImportCapability(input) {
|
|
16826
|
+
let listing = null;
|
|
16827
|
+
const closed = () => ({
|
|
16828
|
+
ok: false,
|
|
16829
|
+
error: { code: "invalidState", message: "Harness broker adapter is closed", retryable: false }
|
|
16830
|
+
});
|
|
16831
|
+
const invalid = () => ({
|
|
16832
|
+
ok: false,
|
|
16833
|
+
error: {
|
|
16834
|
+
code: "protocolError",
|
|
16835
|
+
message: "Harness broker returned invalid Session import metadata",
|
|
16836
|
+
retryable: false
|
|
16837
|
+
}
|
|
16838
|
+
});
|
|
16839
|
+
const list = async () => {
|
|
16840
|
+
try {
|
|
16841
|
+
const candidates = [];
|
|
16842
|
+
const identities = /* @__PURE__ */ new Set();
|
|
16843
|
+
let total;
|
|
16844
|
+
for (; ; ) {
|
|
16845
|
+
if (input.isClosed())
|
|
16846
|
+
return closed();
|
|
16847
|
+
const result = await input.request("adapter.sessionImport.list", {
|
|
16848
|
+
offset: candidates.length,
|
|
16849
|
+
limit: HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE
|
|
16850
|
+
});
|
|
16851
|
+
if (input.isClosed())
|
|
16852
|
+
return closed();
|
|
16853
|
+
if (!result.ok)
|
|
16854
|
+
return result;
|
|
16855
|
+
const page = brokerSessionImportPageSchema.safeParse(result.value);
|
|
16856
|
+
if (!page.success || total !== void 0 && total !== page.data.total || page.data.total < candidates.length + page.data.candidates.length || page.data.candidates.length === 0 && candidates.length < page.data.total)
|
|
16857
|
+
return invalid();
|
|
16858
|
+
total = page.data.total;
|
|
16859
|
+
for (const candidate of page.data.candidates) {
|
|
16860
|
+
if (identities.has(candidate.nativeSessionId))
|
|
16861
|
+
return invalid();
|
|
16862
|
+
identities.add(candidate.nativeSessionId);
|
|
16863
|
+
candidates.push(candidate);
|
|
16864
|
+
}
|
|
16865
|
+
if (candidates.length === total)
|
|
16866
|
+
return { ok: true, value: candidates };
|
|
16867
|
+
}
|
|
16868
|
+
} catch (error51) {
|
|
16869
|
+
return { ok: false, error: input.error(error51) };
|
|
16870
|
+
}
|
|
16871
|
+
};
|
|
16872
|
+
return {
|
|
16873
|
+
listCandidates() {
|
|
16874
|
+
if (input.isClosed())
|
|
16875
|
+
return Promise.resolve(closed());
|
|
16876
|
+
listing ??= list().finally(() => {
|
|
16877
|
+
listing = null;
|
|
16878
|
+
});
|
|
16879
|
+
return listing;
|
|
16880
|
+
},
|
|
16881
|
+
async resolveCandidate(nativeSessionId) {
|
|
16882
|
+
if (input.isClosed())
|
|
16883
|
+
return closed();
|
|
16884
|
+
try {
|
|
16885
|
+
const result = await input.request("adapter.sessionImport.resolve", { nativeSessionId });
|
|
16886
|
+
if (input.isClosed())
|
|
16887
|
+
return closed();
|
|
16888
|
+
if (!result.ok)
|
|
16889
|
+
return result;
|
|
16890
|
+
const source = brokerSessionImportSourceSchema.safeParse(result.value);
|
|
16891
|
+
if (!source.success || source.data.nativeRef.harnessId !== input.harnessId || source.data.candidate.nativeSessionId !== nativeSessionId)
|
|
16892
|
+
return invalid();
|
|
16893
|
+
return { ok: true, value: source.data };
|
|
16894
|
+
} catch (error51) {
|
|
16895
|
+
return { ok: false, error: input.error(error51) };
|
|
16896
|
+
}
|
|
16897
|
+
}
|
|
16898
|
+
};
|
|
16899
|
+
}
|
|
16900
|
+
|
|
16901
|
+
// ../../harness-broker/dist/paths.js
|
|
16902
|
+
import os from "node:os";
|
|
16903
|
+
import path from "node:path";
|
|
16904
|
+
var HARNESS_BROKER_DESCRIPTOR_ENV = "CODEXHOST_CLAUDE_BROKER_DESCRIPTOR";
|
|
16905
|
+
var HARNESS_BROKER_DESCRIPTOR_FILE = "claude-code-broker-v1.json";
|
|
16906
|
+
function defaultHarnessBrokerDirectory(environment = process.env) {
|
|
16907
|
+
const home = environment.HOME || os.homedir();
|
|
16908
|
+
return path.join(home, ".codexhost", "harness-broker");
|
|
16909
|
+
}
|
|
16910
|
+
function defaultHarnessBrokerDescriptorPath(environment = process.env, harnessId = "claude-code") {
|
|
16911
|
+
harnessPluginIdSchema.parse(harnessId);
|
|
16912
|
+
if (harnessId !== "claude-code")
|
|
16913
|
+
return path.join(defaultHarnessBrokerDirectory(environment), `${harnessId}-broker-v1.json`);
|
|
16914
|
+
return environment[HARNESS_BROKER_DESCRIPTOR_ENV] ?? path.join(defaultHarnessBrokerDirectory(environment), HARNESS_BROKER_DESCRIPTOR_FILE);
|
|
16915
|
+
}
|
|
16916
|
+
function harnessBrokerLaunchAgentLabel(harnessId = "claude-code") {
|
|
16917
|
+
harnessPluginIdSchema.parse(harnessId);
|
|
16918
|
+
return harnessId === "claude-code" ? "ai.bytepioneer.codexhost.native-harness-broker" : `ai.bytepioneer.codexhost.${harnessId}-broker`;
|
|
16919
|
+
}
|
|
16920
|
+
function harnessBrokerLaunchAgentPlistPath(environment = process.env, harnessId = "claude-code") {
|
|
16921
|
+
const home = environment.HOME || os.homedir();
|
|
16922
|
+
return path.join(home, "Library", "LaunchAgents", `${harnessBrokerLaunchAgentLabel(harnessId)}.plist`);
|
|
16923
|
+
}
|
|
16924
|
+
|
|
16720
16925
|
// ../../harness-broker/dist/client.js
|
|
16721
16926
|
function unavailable(message, retryable = true) {
|
|
16722
16927
|
return { code: "unavailable", message, retryable, stage: "harnessBroker" };
|
|
@@ -16776,6 +16981,7 @@ function parseSessionMetadata(value) {
|
|
|
16776
16981
|
sessionId: candidate.sessionId,
|
|
16777
16982
|
sessionGeneration: candidate.sessionGeneration,
|
|
16778
16983
|
capabilities: harnessSessionCapabilitiesSchema.parse(candidate.capabilities),
|
|
16984
|
+
readCapabilities: candidate.readCapabilities === true,
|
|
16779
16985
|
initialState: state,
|
|
16780
16986
|
initialUsage: candidate.initialUsage === null ? null : parseHostUsage(candidate.initialUsage),
|
|
16781
16987
|
commands: candidate.commands === true
|
|
@@ -17127,6 +17333,11 @@ var BrokeredHarnessSession = class {
|
|
|
17127
17333
|
event: { type: "session.faulted", error: unavailable(error51.message) }
|
|
17128
17334
|
});
|
|
17129
17335
|
}
|
|
17336
|
+
async readCapabilities() {
|
|
17337
|
+
if (!this.#metadata.readCapabilities)
|
|
17338
|
+
return { ...this.capabilities, steer: false };
|
|
17339
|
+
return harnessSessionCapabilitiesSchema.parse(await this.#request("session.readCapabilities", {}));
|
|
17340
|
+
}
|
|
17130
17341
|
async refreshUsage() {
|
|
17131
17342
|
await this.#request("session.refreshUsage", {});
|
|
17132
17343
|
}
|
|
@@ -17158,6 +17369,8 @@ var BrokeredHarnessSession = class {
|
|
|
17158
17369
|
try {
|
|
17159
17370
|
return parseHarnessResult(await this.#request("session.execute", { command }));
|
|
17160
17371
|
} catch (error51) {
|
|
17372
|
+
if (command.type === "turn.steer")
|
|
17373
|
+
throw error51;
|
|
17161
17374
|
return {
|
|
17162
17375
|
ok: false,
|
|
17163
17376
|
error: unavailable(error51 instanceof Error ? error51.message : String(error51))
|
|
@@ -17245,6 +17458,7 @@ var BrokeredHarnessAdapter = class {
|
|
|
17245
17458
|
commandCatalog;
|
|
17246
17459
|
liveCommandCatalog;
|
|
17247
17460
|
harnessId;
|
|
17461
|
+
sessionImport;
|
|
17248
17462
|
credits;
|
|
17249
17463
|
refreshCredits;
|
|
17250
17464
|
#descriptorPath;
|
|
@@ -17254,7 +17468,6 @@ var BrokeredHarnessAdapter = class {
|
|
|
17254
17468
|
#startTimeoutMs;
|
|
17255
17469
|
#connection = null;
|
|
17256
17470
|
#closed = false;
|
|
17257
|
-
#sessionImportListing = null;
|
|
17258
17471
|
#credits = null;
|
|
17259
17472
|
#creditsRefresh = null;
|
|
17260
17473
|
subagents = {
|
|
@@ -17266,86 +17479,16 @@ var BrokeredHarnessAdapter = class {
|
|
|
17266
17479
|
}
|
|
17267
17480
|
}
|
|
17268
17481
|
};
|
|
17269
|
-
sessionImport = Object.freeze({
|
|
17270
|
-
listCandidates: () => {
|
|
17271
|
-
this.#sessionImportListing ??= this.#listSessionImportCandidates().finally(() => {
|
|
17272
|
-
this.#sessionImportListing = null;
|
|
17273
|
-
});
|
|
17274
|
-
return this.#sessionImportListing;
|
|
17275
|
-
},
|
|
17276
|
-
resolveCandidate: async (nativeSessionId) => {
|
|
17277
|
-
if (this.#closed) {
|
|
17278
|
-
return {
|
|
17279
|
-
ok: false,
|
|
17280
|
-
error: unavailable("Claude Aqua broker adapter is closed", false)
|
|
17281
|
-
};
|
|
17282
|
-
}
|
|
17283
|
-
try {
|
|
17284
|
-
const result = parseHarnessResult(await (await this.#connect()).request("adapter.sessionImport.resolve", {
|
|
17285
|
-
nativeSessionId
|
|
17286
|
-
}));
|
|
17287
|
-
if (!result.ok)
|
|
17288
|
-
return result;
|
|
17289
|
-
const parsed = brokerSessionImportSourceSchema.safeParse(result.value);
|
|
17290
|
-
if (!parsed.success || parsed.data.candidate.nativeSessionId !== nativeSessionId) {
|
|
17291
|
-
return {
|
|
17292
|
-
ok: false,
|
|
17293
|
-
error: {
|
|
17294
|
-
...unavailable("Harness broker returned an invalid Session source", false),
|
|
17295
|
-
code: "protocolError"
|
|
17296
|
-
}
|
|
17297
|
-
};
|
|
17298
|
-
}
|
|
17299
|
-
return { ok: true, value: parsed.data };
|
|
17300
|
-
} catch (error51) {
|
|
17301
|
-
this.#connection = null;
|
|
17302
|
-
return {
|
|
17303
|
-
ok: false,
|
|
17304
|
-
error: unavailable(error51 instanceof Error ? error51.message : String(error51))
|
|
17305
|
-
};
|
|
17306
|
-
}
|
|
17307
|
-
}
|
|
17308
|
-
});
|
|
17309
|
-
async #listSessionImportCandidates() {
|
|
17310
|
-
if (this.#closed) {
|
|
17311
|
-
return {
|
|
17312
|
-
ok: false,
|
|
17313
|
-
error: unavailable("Claude Aqua broker adapter is closed", false)
|
|
17314
|
-
};
|
|
17315
|
-
}
|
|
17316
|
-
try {
|
|
17317
|
-
const candidates = [];
|
|
17318
|
-
for (; ; ) {
|
|
17319
|
-
const result = parseHarnessResult(await (await this.#connect()).request("adapter.sessionImport.list", {
|
|
17320
|
-
offset: candidates.length,
|
|
17321
|
-
limit: HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE
|
|
17322
|
-
}));
|
|
17323
|
-
if (!result.ok)
|
|
17324
|
-
return result;
|
|
17325
|
-
const parsed = brokerSessionImportPageSchema.safeParse(result.value);
|
|
17326
|
-
if (!parsed.success || parsed.data.total < candidates.length + parsed.data.candidates.length || parsed.data.candidates.length === 0 && candidates.length < parsed.data.total) {
|
|
17327
|
-
return {
|
|
17328
|
-
ok: false,
|
|
17329
|
-
error: {
|
|
17330
|
-
...unavailable("Harness broker returned invalid Session candidates", false),
|
|
17331
|
-
code: "protocolError"
|
|
17332
|
-
}
|
|
17333
|
-
};
|
|
17334
|
-
}
|
|
17335
|
-
candidates.push(...parsed.data.candidates);
|
|
17336
|
-
if (candidates.length === parsed.data.total)
|
|
17337
|
-
return { ok: true, value: candidates };
|
|
17338
|
-
}
|
|
17339
|
-
} catch (error51) {
|
|
17340
|
-
this.#connection = null;
|
|
17341
|
-
return {
|
|
17342
|
-
ok: false,
|
|
17343
|
-
error: unavailable(error51 instanceof Error ? error51.message : String(error51))
|
|
17344
|
-
};
|
|
17345
|
-
}
|
|
17346
|
-
}
|
|
17347
17482
|
constructor(input = {}) {
|
|
17348
17483
|
this.harnessId = harnessPluginIdSchema.parse(input.harnessId ?? "claude-code");
|
|
17484
|
+
if (input.sessionImport) {
|
|
17485
|
+
this.sessionImport = createBrokerSessionImportCapability({
|
|
17486
|
+
harnessId: this.harnessId,
|
|
17487
|
+
request: async (method, params) => parseHarnessResult(await this.#request(method, params, method === "adapter.sessionImport.resolve")),
|
|
17488
|
+
isClosed: () => this.#closed,
|
|
17489
|
+
error: (error51) => this.#error(error51)
|
|
17490
|
+
});
|
|
17491
|
+
}
|
|
17349
17492
|
if (input.accountCredits !== false) {
|
|
17350
17493
|
this.credits = () => this.#credits;
|
|
17351
17494
|
this.refreshCredits = () => this.#refreshAccountCredits();
|
|
@@ -17547,10 +17690,13 @@ function usageSessionTitle(value) {
|
|
|
17547
17690
|
return void 0;
|
|
17548
17691
|
if (normalized.length <= MAX_SESSION_TITLE_LENGTH)
|
|
17549
17692
|
return normalized;
|
|
17550
|
-
|
|
17551
|
-
|
|
17552
|
-
|
|
17553
|
-
|
|
17693
|
+
let title = "";
|
|
17694
|
+
for (const character of normalized) {
|
|
17695
|
+
if (title.length + character.length >= MAX_SESSION_TITLE_LENGTH)
|
|
17696
|
+
break;
|
|
17697
|
+
title += character;
|
|
17698
|
+
}
|
|
17699
|
+
return `${title.trimEnd()}…`;
|
|
17554
17700
|
}
|
|
17555
17701
|
function sessionIdOk(value) {
|
|
17556
17702
|
return typeof value === "string" && value.length > 0 && value.length <= MAX_SESSION_ID_LENGTH;
|
|
@@ -18851,7 +18997,17 @@ function pendingNativeHistoryRewind(contents) {
|
|
|
18851
18997
|
const last = parseRows(contents).findLast((row) => row.type === "resend-fork-notice" || NATIVE_MESSAGE_TYPES.has(text(row.type)));
|
|
18852
18998
|
return last?.type === "resend-fork-notice" ? { forkPointId: text(last.parentId) || null } : void 0;
|
|
18853
18999
|
}
|
|
19000
|
+
function isNativeCompactionSummary(row) {
|
|
19001
|
+
const data = record2(row.providerData);
|
|
19002
|
+
return row.type === "message" && row.role === "user" && data.isCompactInternal === true;
|
|
19003
|
+
}
|
|
18854
19004
|
function nativeHistoryRows(contents) {
|
|
19005
|
+
return collectNativeHistoryRows(contents, false);
|
|
19006
|
+
}
|
|
19007
|
+
function nativeDisplayHistoryRows(contents) {
|
|
19008
|
+
return collectNativeHistoryRows(contents, true);
|
|
19009
|
+
}
|
|
19010
|
+
function collectNativeHistoryRows(contents, followCompactionParent) {
|
|
18855
19011
|
const entries = /* @__PURE__ */ new Map();
|
|
18856
19012
|
let leaf = "";
|
|
18857
19013
|
for (const row of parseRows(contents)) {
|
|
@@ -18876,10 +19032,16 @@ function nativeHistoryRows(contents) {
|
|
|
18876
19032
|
throw new CodeBuddyError("protocolError", "Native history parent is missing");
|
|
18877
19033
|
chain.push(row);
|
|
18878
19034
|
leaf = text(row.parentId);
|
|
19035
|
+
if (!leaf && followCompactionParent && isNativeCompactionSummary(row)) {
|
|
19036
|
+
const logicalParent = text(row.logicalParentId);
|
|
19037
|
+
if (logicalParent && !entries.has(logicalParent))
|
|
19038
|
+
throw new CodeBuddyError("protocolError", "Native compaction parent is missing");
|
|
19039
|
+
leaf = logicalParent;
|
|
19040
|
+
}
|
|
18879
19041
|
}
|
|
18880
19042
|
return chain.reverse();
|
|
18881
19043
|
}
|
|
18882
|
-
function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PROFILE) {
|
|
19044
|
+
function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PROFILE, options = {}) {
|
|
18883
19045
|
const supportsNativeCommands = nativeCommandsEnabled(profile);
|
|
18884
19046
|
const supportsFork = capabilitiesForProfile(profile).history.fork;
|
|
18885
19047
|
const turns = [];
|
|
@@ -18905,7 +19067,8 @@ function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PRO
|
|
|
18905
19067
|
snapshot.item.outputTruncated = Boolean(output.truncated);
|
|
18906
19068
|
}
|
|
18907
19069
|
};
|
|
18908
|
-
const
|
|
19070
|
+
const includeCompactionHistory = options.includeCompactionHistory !== false;
|
|
19071
|
+
const history = includeCompactionHistory ? nativeDisplayHistoryRows(contents) : nativeHistoryRows(contents);
|
|
18909
19072
|
const manualCompactions = /* @__PURE__ */ new Set();
|
|
18910
19073
|
let compactUser;
|
|
18911
19074
|
if (supportsNativeCommands)
|
|
@@ -18939,6 +19102,22 @@ function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PRO
|
|
|
18939
19102
|
continue;
|
|
18940
19103
|
if (supportsNativeCommands && row.type === "message" && row.role === "user" && data.agent === "compact" && !manualCompactions.has(text(row.id)))
|
|
18941
19104
|
continue;
|
|
19105
|
+
if (includeCompactionHistory && isNativeCompactionSummary(row)) {
|
|
19106
|
+
if (supportsNativeCommands && current) {
|
|
19107
|
+
const outcome = data.isCompacted === true ? { status: "succeeded" } : {
|
|
19108
|
+
status: "failed",
|
|
19109
|
+
error: nativeError(new CodeBuddyError("nativeFailure", "Native compaction did not complete"), profile)
|
|
19110
|
+
};
|
|
19111
|
+
current.items.push({
|
|
19112
|
+
item: {
|
|
19113
|
+
type: "contextCompaction",
|
|
19114
|
+
itemId: hostItemIdSchema.parse(`compact-${text(row.id)}`)
|
|
19115
|
+
},
|
|
19116
|
+
outcome
|
|
19117
|
+
});
|
|
19118
|
+
}
|
|
19119
|
+
continue;
|
|
19120
|
+
}
|
|
18942
19121
|
if (row.type === "message" && row.role === "user") {
|
|
18943
19122
|
current = {
|
|
18944
19123
|
nativeTurnRef: nativeTurnRefSchema.parse({
|
|
@@ -19192,7 +19371,7 @@ function createCodeBuddyUsageStatistics(environment, profile) {
|
|
|
19192
19371
|
import { stat as stat3 } from "node:fs/promises";
|
|
19193
19372
|
|
|
19194
19373
|
// ../codebuddy/dist/acp-client.js
|
|
19195
|
-
import { execFile as
|
|
19374
|
+
import { execFile as execFile3, spawn } from "node:child_process";
|
|
19196
19375
|
import { Readable as Readable2, Writable } from "node:stream";
|
|
19197
19376
|
|
|
19198
19377
|
// ../../../node_modules/@agentclientprotocol/sdk/dist/schema/index.js
|
|
@@ -23357,9 +23536,23 @@ var ClientSideConnection = class {
|
|
|
23357
23536
|
|
|
23358
23537
|
// ../codebuddy/dist/copy-cleanup.js
|
|
23359
23538
|
import { randomBytes } from "node:crypto";
|
|
23539
|
+
|
|
23540
|
+
// ../codebuddy/dist/acp-stdio.js
|
|
23360
23541
|
import { createInterface as createInterface2 } from "node:readline";
|
|
23361
|
-
import { stripVTControlCharacters } from "node:util";
|
|
23362
23542
|
import { Readable } from "node:stream";
|
|
23543
|
+
import { stripVTControlCharacters } from "node:util";
|
|
23544
|
+
function codeBuddyAcpOutput(stdout, onLine) {
|
|
23545
|
+
return Readable.from((async function* () {
|
|
23546
|
+
for await (const line of createInterface2({ input: stdout })) {
|
|
23547
|
+
onLine?.(stripVTControlCharacters(line));
|
|
23548
|
+
if (line.trimStart().startsWith("{"))
|
|
23549
|
+
yield Buffer.from(`${line}
|
|
23550
|
+
`);
|
|
23551
|
+
}
|
|
23552
|
+
})());
|
|
23553
|
+
}
|
|
23554
|
+
|
|
23555
|
+
// ../codebuddy/dist/copy-cleanup.js
|
|
23363
23556
|
var CodeBuddyCopyCleanup = class {
|
|
23364
23557
|
copyId;
|
|
23365
23558
|
cwd;
|
|
@@ -23389,17 +23582,11 @@ var CodeBuddyCopyCleanup = class {
|
|
|
23389
23582
|
}
|
|
23390
23583
|
/** Native --serve banners include its password; never pass them to the ACP parser/logs. */
|
|
23391
23584
|
protocolOutput(stdout) {
|
|
23392
|
-
return
|
|
23393
|
-
|
|
23394
|
-
async *#protocolLines(stdout) {
|
|
23395
|
-
for await (const line of createInterface2({ input: stdout })) {
|
|
23396
|
-
const endpoint = /^\s*Endpoint\s+(http:\/\/127\.0\.0\.1:\d+)\s*$/u.exec(stripVTControlCharacters(line));
|
|
23585
|
+
return codeBuddyAcpOutput(stdout, (line) => {
|
|
23586
|
+
const endpoint = /^\s*Endpoint\s+(http:\/\/127\.0\.0\.1:\d+)\s*$/u.exec(line);
|
|
23397
23587
|
if (endpoint)
|
|
23398
23588
|
this.#endpoint = endpoint[1];
|
|
23399
|
-
|
|
23400
|
-
yield Buffer.from(`${line}
|
|
23401
|
-
`);
|
|
23402
|
-
}
|
|
23589
|
+
});
|
|
23403
23590
|
}
|
|
23404
23591
|
async remove() {
|
|
23405
23592
|
if (!this.#endpoint)
|
|
@@ -23664,6 +23851,88 @@ function resolveHarnessExecutable(spec, input, dependencies = {}) {
|
|
|
23664
23851
|
return void 0;
|
|
23665
23852
|
}
|
|
23666
23853
|
|
|
23854
|
+
// ../../harness-discovery/dist/installation.js
|
|
23855
|
+
import { execFile as execFile2 } from "node:child_process";
|
|
23856
|
+
import { homedir as homedir2 } from "node:os";
|
|
23857
|
+
function runInstallationCommand(command, args, environment, timeout = 3e4) {
|
|
23858
|
+
const env = withNodeRuntimeOnPath(environment);
|
|
23859
|
+
const invocation = /\.[cm]?js$/i.test(command) ? commandInvocation(process.execPath, [command, ...args], env) : commandInvocation(command, args, env);
|
|
23860
|
+
return new Promise((resolve, reject) => {
|
|
23861
|
+
const child = execFile2(invocation.command, invocation.arguments, {
|
|
23862
|
+
env,
|
|
23863
|
+
cwd: env.HOME ?? env.USERPROFILE ?? homedir2(),
|
|
23864
|
+
encoding: "utf8",
|
|
23865
|
+
timeout,
|
|
23866
|
+
killSignal: "SIGKILL",
|
|
23867
|
+
maxBuffer: 1024 * 1024,
|
|
23868
|
+
windowsHide: true,
|
|
23869
|
+
windowsVerbatimArguments: invocation.windowsVerbatimArguments
|
|
23870
|
+
}, (error51, stdout, stderr) => {
|
|
23871
|
+
if (error51)
|
|
23872
|
+
reject(new Error(error51.killed ? "Harness command timed out" : "Harness command failed; check the native installation and retry"));
|
|
23873
|
+
else
|
|
23874
|
+
resolve((stdout || stderr).trim());
|
|
23875
|
+
});
|
|
23876
|
+
child.stdin?.end();
|
|
23877
|
+
});
|
|
23878
|
+
}
|
|
23879
|
+
function installationVersion(value) {
|
|
23880
|
+
if (typeof value !== "string" || !/^v?\d+(?:\.\d+){1,3}(?:-[\w.-]+)?(?:\+[\w.-]+)?$/.test(value.trim()))
|
|
23881
|
+
throw new Error("Harness returned an invalid version");
|
|
23882
|
+
return value.trim().replace(/^v/, "");
|
|
23883
|
+
}
|
|
23884
|
+
function versionFromOutput(output) {
|
|
23885
|
+
return installationVersion(output.match(/\b\d+(?:\.\d+){1,3}(?:-[\w.-]+)?(?:\+[\w.-]+)?\b/)?.[0]);
|
|
23886
|
+
}
|
|
23887
|
+
function newerInstallationVersion(current, latest) {
|
|
23888
|
+
const a = installationVersion(current).replace(/\+.*/, "");
|
|
23889
|
+
const b = installationVersion(latest).replace(/\+.*/, "");
|
|
23890
|
+
const coreA = a.replace(/-.*/, "").split(".").map(BigInt);
|
|
23891
|
+
const coreB = b.replace(/-.*/, "").split(".").map(BigInt);
|
|
23892
|
+
for (let i = 0; i < Math.max(coreA.length, coreB.length); i++) {
|
|
23893
|
+
if ((coreA[i] ?? 0n) !== (coreB[i] ?? 0n))
|
|
23894
|
+
return (coreB[i] ?? 0n) > (coreA[i] ?? 0n);
|
|
23895
|
+
}
|
|
23896
|
+
const preA = a.includes("-") ? a.slice(a.indexOf("-") + 1).split(".") : [];
|
|
23897
|
+
const preB = b.includes("-") ? b.slice(b.indexOf("-") + 1).split(".") : [];
|
|
23898
|
+
if (!preA.length || !preB.length)
|
|
23899
|
+
return !!preA.length && !preB.length;
|
|
23900
|
+
for (let i = 0; i < Math.max(preA.length, preB.length); i++) {
|
|
23901
|
+
const x = preA[i];
|
|
23902
|
+
const y = preB[i];
|
|
23903
|
+
if (x === y)
|
|
23904
|
+
continue;
|
|
23905
|
+
if (x === void 0 || y === void 0)
|
|
23906
|
+
return x === void 0;
|
|
23907
|
+
const numericX = /^\d+$/.test(x);
|
|
23908
|
+
const numericY = /^\d+$/.test(y);
|
|
23909
|
+
if (numericX && numericY) {
|
|
23910
|
+
if (BigInt(x) === BigInt(y))
|
|
23911
|
+
continue;
|
|
23912
|
+
return BigInt(y) > BigInt(x);
|
|
23913
|
+
}
|
|
23914
|
+
if (numericX !== numericY)
|
|
23915
|
+
return numericX;
|
|
23916
|
+
return y > x;
|
|
23917
|
+
}
|
|
23918
|
+
return false;
|
|
23919
|
+
}
|
|
23920
|
+
async function fetchInstallationText(url2) {
|
|
23921
|
+
const request = async () => {
|
|
23922
|
+
const response = await fetch(url2, { signal: AbortSignal.timeout(15e3) });
|
|
23923
|
+
if (!response.ok)
|
|
23924
|
+
throw new Error("Could not check the latest Harness version");
|
|
23925
|
+
return response.text();
|
|
23926
|
+
};
|
|
23927
|
+
try {
|
|
23928
|
+
return await request();
|
|
23929
|
+
} catch (error51) {
|
|
23930
|
+
if (error51 instanceof DOMException && (error51.name === "AbortError" || error51.name === "TimeoutError"))
|
|
23931
|
+
throw error51;
|
|
23932
|
+
return request();
|
|
23933
|
+
}
|
|
23934
|
+
}
|
|
23935
|
+
|
|
23667
23936
|
// ../codebuddy/dist/command.js
|
|
23668
23937
|
var codeBuddyDiscoverySpec = {
|
|
23669
23938
|
id: "codebuddy",
|
|
@@ -23763,7 +24032,7 @@ var CodeBuddyAcpClient = class {
|
|
|
23763
24032
|
return { outcome: "cancelled" };
|
|
23764
24033
|
return options.handlers.question(params);
|
|
23765
24034
|
}
|
|
23766
|
-
}), ndJsonStream2(Writable.toWeb(this.#child.stdin), Readable2.toWeb(this.#copyCleanup?.protocolOutput(this.#child.stdout) ?? this.#child.stdout)));
|
|
24035
|
+
}), ndJsonStream2(Writable.toWeb(this.#child.stdin), Readable2.toWeb(this.#copyCleanup?.protocolOutput(this.#child.stdout) ?? (invocation.arguments.includes("--serve") ? codeBuddyAcpOutput(this.#child.stdout) : this.#child.stdout))));
|
|
23767
24036
|
void this.#connection.closed.then(() => {
|
|
23768
24037
|
this.#fault(new CodeBuddyError("processExited", "ACP connection closed"));
|
|
23769
24038
|
}).catch((error51) => {
|
|
@@ -23856,7 +24125,7 @@ var CodeBuddyAcpClient = class {
|
|
|
23856
24125
|
}
|
|
23857
24126
|
const pid = this.#child.pid;
|
|
23858
24127
|
if (pid && process.platform === "win32") {
|
|
23859
|
-
await new Promise((resolve) =>
|
|
24128
|
+
await new Promise((resolve) => execFile3("taskkill", ["/PID", String(pid), "/T", "/F"], { windowsHide: true, timeout: 3e3 }, () => resolve()));
|
|
23860
24129
|
} else if (pid) {
|
|
23861
24130
|
try {
|
|
23862
24131
|
process.kill(-pid, "SIGKILL");
|
|
@@ -23869,7 +24138,7 @@ var CodeBuddyAcpClient = class {
|
|
|
23869
24138
|
|
|
23870
24139
|
// ../codebuddy/dist/derivation.js
|
|
23871
24140
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
23872
|
-
import { execFile as
|
|
24141
|
+
import { execFile as execFile4, spawn as spawn2 } from "node:child_process";
|
|
23873
24142
|
import { lstat as lstat3, mkdir, readFile as readFile3, realpath as realpath4, unlink, writeFile } from "node:fs/promises";
|
|
23874
24143
|
import path8 from "node:path";
|
|
23875
24144
|
import { isDeepStrictEqual as isDeepStrictEqual3 } from "node:util";
|
|
@@ -24119,7 +24388,7 @@ async function copyCodeBuddySession(cwd, sourceId, targetId, environment, signal
|
|
|
24119
24388
|
child.stderr.destroy();
|
|
24120
24389
|
} else if (process.platform === "win32" && child.pid) {
|
|
24121
24390
|
termination = new Promise((done) => {
|
|
24122
|
-
|
|
24391
|
+
execFile4("taskkill", ["/PID", String(child.pid), "/T", "/F"], { windowsHide: true, timeout: 3e3 }, () => {
|
|
24123
24392
|
child.kill();
|
|
24124
24393
|
done();
|
|
24125
24394
|
});
|
|
@@ -24196,7 +24465,9 @@ function commandCaveat(row) {
|
|
|
24196
24465
|
}
|
|
24197
24466
|
function retainedRowCount(input, contents, sourceCwd = input.cwd, profile = CODEBUDDY_RUNTIME_PROFILE) {
|
|
24198
24467
|
const rows2 = nativeHistoryRows(contents);
|
|
24199
|
-
const turns = snapshotFromHistory(contents, input.sourceRef, sourceCwd, profile
|
|
24468
|
+
const turns = snapshotFromHistory(contents, input.sourceRef, sourceCwd, profile, {
|
|
24469
|
+
includeCompactionHistory: false
|
|
24470
|
+
}).turns;
|
|
24200
24471
|
let excluded2;
|
|
24201
24472
|
if (input.kind === "rollbackLastTurn") {
|
|
24202
24473
|
if (!turns.length)
|
|
@@ -25790,6 +26061,8 @@ var CodeBuddySession = class {
|
|
|
25790
26061
|
async #execute(command, nativeCommand = false) {
|
|
25791
26062
|
if (this.#closed || this.#fault)
|
|
25792
26063
|
return failure("invalidState", "Session is closed or faulted", this.profile);
|
|
26064
|
+
if (command.type === "turn.steer")
|
|
26065
|
+
return unsupportedSteer(this.profile.displayName);
|
|
25793
26066
|
if (command.type === "interaction.respond")
|
|
25794
26067
|
return this.#interactions.respond(command);
|
|
25795
26068
|
if (command.type === "turn.cancel") {
|
|
@@ -26149,8 +26422,9 @@ var CodeBuddyAdapter = class {
|
|
|
26149
26422
|
};
|
|
26150
26423
|
|
|
26151
26424
|
// dist/command.js
|
|
26152
|
-
import { lstatSync } from "node:fs";
|
|
26153
|
-
import {
|
|
26425
|
+
import { lstatSync, statSync } from "node:fs";
|
|
26426
|
+
import { randomBytes as randomBytes2 } from "node:crypto";
|
|
26427
|
+
import { homedir as homedir3 } from "node:os";
|
|
26154
26428
|
|
|
26155
26429
|
// dist/delegation.js
|
|
26156
26430
|
var DELEGATION_ENVIRONMENT_KEYS = [
|
|
@@ -26225,8 +26499,57 @@ var WORKBUDDY_CREDENTIAL_PRELOAD = String.raw`
|
|
|
26225
26499
|
socketPath = path.join(directory, "c");
|
|
26226
26500
|
}
|
|
26227
26501
|
const cleanup = () => {
|
|
26502
|
+
clearTimeout(readyTimer);
|
|
26503
|
+
readyServer && readyServer.close();
|
|
26504
|
+
for (const connection of readyConnections) connection.destroy();
|
|
26228
26505
|
if (directory) try { fs.rmSync(directory, {recursive:true,force:true}); } catch {}
|
|
26229
26506
|
};
|
|
26507
|
+
const needsReady = process.argv.includes("--serve");
|
|
26508
|
+
let credentialReady = false;
|
|
26509
|
+
let runtimeReady = !needsReady;
|
|
26510
|
+
let readyTimer;
|
|
26511
|
+
let readyServer;
|
|
26512
|
+
const readyConnections = new Set();
|
|
26513
|
+
const cleanupWhenReady = () => {
|
|
26514
|
+
if (!credentialReady || !runtimeReady) return;
|
|
26515
|
+
cleanup();
|
|
26516
|
+
process.removeListener("exit", cleanup);
|
|
26517
|
+
};
|
|
26518
|
+
if (needsReady) {
|
|
26519
|
+
readyServer = net.createServer(connection => {
|
|
26520
|
+
readyConnections.add(connection);
|
|
26521
|
+
connection.once("close", () => readyConnections.delete(connection));
|
|
26522
|
+
connection.on("error", () => connection.destroy());
|
|
26523
|
+
let input = "";
|
|
26524
|
+
connection.on("data", chunk => {
|
|
26525
|
+
input += chunk;
|
|
26526
|
+
if (input.length > 4096) return connection.destroy();
|
|
26527
|
+
if (!input.includes("\n")) return;
|
|
26528
|
+
try {
|
|
26529
|
+
const request = JSON.parse(input.slice(0, input.indexOf("\n")));
|
|
26530
|
+
const params = request.params;
|
|
26531
|
+
if (request.jsonrpc !== "2.0" || request.method !== "session.ready" ||
|
|
26532
|
+
typeof request.id !== "string" || params?.protocolVersion !== 1 ||
|
|
26533
|
+
params.token !== token || params.sessionId !== sessionId || params.pid !== process.pid ||
|
|
26534
|
+
!Number.isInteger(params.port) || params.port < 1 || params.port > 65535) {
|
|
26535
|
+
connection.destroy();
|
|
26536
|
+
return;
|
|
26537
|
+
}
|
|
26538
|
+
runtimeReady = true;
|
|
26539
|
+
connection.end(JSON.stringify({jsonrpc:"2.0",id:request.id,result:{ok:true}}) + "\n", cleanupWhenReady);
|
|
26540
|
+
} catch { connection.destroy(); }
|
|
26541
|
+
});
|
|
26542
|
+
});
|
|
26543
|
+
readyServer.once("error", () => {
|
|
26544
|
+
process.stderr.write("WorkBuddy runtime readiness listener failed\n");
|
|
26545
|
+
process.exit(1);
|
|
26546
|
+
});
|
|
26547
|
+
readyServer.listen(socketPath + "-ready");
|
|
26548
|
+
readyTimer = setTimeout(() => {
|
|
26549
|
+
process.stderr.write("WorkBuddy runtime readiness timed out\n");
|
|
26550
|
+
process.exit(1);
|
|
26551
|
+
}, 15000);
|
|
26552
|
+
}
|
|
26230
26553
|
process.once("exit", cleanup);
|
|
26231
26554
|
Object.assign(env, {
|
|
26232
26555
|
WORKBUDDY_AT_REST_ENCRYPTION: "fields",
|
|
@@ -26249,8 +26572,8 @@ var WORKBUDDY_CREDENTIAL_PRELOAD = String.raw`
|
|
|
26249
26572
|
clearTimeout(timer);
|
|
26250
26573
|
socket && socket.destroy();
|
|
26251
26574
|
message = "";
|
|
26252
|
-
|
|
26253
|
-
|
|
26575
|
+
credentialReady = success;
|
|
26576
|
+
if (success) cleanupWhenReady();
|
|
26254
26577
|
if (!success) {
|
|
26255
26578
|
process.stderr.write("WorkBuddy credential bootstrap failed\n");
|
|
26256
26579
|
process.exit(1);
|
|
@@ -26389,7 +26712,7 @@ function bundledProductConfigPath(environment, platform, dependencies) {
|
|
|
26389
26712
|
function workBuddyEnvironment(environment, platform = process.platform) {
|
|
26390
26713
|
const paths = targetPath(platform);
|
|
26391
26714
|
const configuredRoot = environment.WORKBUDDY_CONFIG_DIR;
|
|
26392
|
-
const root = paths.resolve(configuredRoot?.trim() ? configuredRoot : paths.join(environment.HOME || environment.USERPROFILE ||
|
|
26715
|
+
const root = paths.resolve(configuredRoot?.trim() ? configuredRoot : paths.join(environment.HOME || environment.USERPROFILE || homedir3(), ".workbuddy-ai"));
|
|
26393
26716
|
return {
|
|
26394
26717
|
...environment,
|
|
26395
26718
|
// The bundled core reads CODEBUDDY_CONFIG_DIR. Force both names to one
|
|
@@ -26399,9 +26722,7 @@ function workBuddyEnvironment(environment, platform = process.platform) {
|
|
|
26399
26722
|
DISABLE_AUTOUPDATER: environment.DISABLE_AUTOUPDATER ?? "1"
|
|
26400
26723
|
};
|
|
26401
26724
|
}
|
|
26402
|
-
function
|
|
26403
|
-
const dependencies = Array.isArray(dependenciesOrArguments) ? {} : dependenciesOrArguments;
|
|
26404
|
-
const nativeArguments = Array.isArray(dependenciesOrArguments) ? dependenciesOrArguments : argumentsOverride;
|
|
26725
|
+
function resolveWorkBuddyLaunch(environment, dependencies = {}) {
|
|
26405
26726
|
const platform = dependencies.platform ?? process.platform;
|
|
26406
26727
|
const configured = environmentValue(environment, "CODEXHOST_WORKBUDDY_COMMAND")?.trim() || void 0;
|
|
26407
26728
|
if (!configured && platform !== "darwin" && platform !== "win32")
|
|
@@ -26414,6 +26735,29 @@ function workBuddyInvocation(environment, ephemeral, dependenciesOrArguments = {
|
|
|
26414
26735
|
const executable = configured && !explicitDesktop && !configuredDirectory ? explicitExecutable : bundle?.executable;
|
|
26415
26736
|
if (!executable)
|
|
26416
26737
|
throw new CodeBuddyError("notInstalled", "WorkBuddy AI app or its bundled CLI is unavailable");
|
|
26738
|
+
return { executable, bundle };
|
|
26739
|
+
}
|
|
26740
|
+
function workBuddyInvocation(environment, ephemeral, dependenciesOrArguments = {}, argumentsOverride) {
|
|
26741
|
+
const dependencies = Array.isArray(dependenciesOrArguments) ? {} : dependenciesOrArguments;
|
|
26742
|
+
const nativeArguments = Array.isArray(dependenciesOrArguments) ? dependenciesOrArguments : argumentsOverride;
|
|
26743
|
+
const platform = dependencies.platform ?? process.platform;
|
|
26744
|
+
const { executable, bundle } = resolveWorkBuddyLaunch(environment, dependencies);
|
|
26745
|
+
const paths = targetPath(platform);
|
|
26746
|
+
const cliDist = bundle && paths.join(paths.dirname(paths.dirname(bundle.cli)), "dist");
|
|
26747
|
+
const isFile = dependencies.isFile ?? ((candidate) => {
|
|
26748
|
+
try {
|
|
26749
|
+
return statSync(candidate).isFile();
|
|
26750
|
+
} catch {
|
|
26751
|
+
return false;
|
|
26752
|
+
}
|
|
26753
|
+
});
|
|
26754
|
+
const liteOnly = Boolean(cliDist && isFile(paths.join(cliDist, "codebuddy-lite-wb.mjs")) && !isFile(paths.join(cliDist, "codebuddy.js")) && !isFile(paths.join(cliDist, "codebuddy-headless.js")));
|
|
26755
|
+
const acpArguments = nativeArguments ?? [
|
|
26756
|
+
"--acp",
|
|
26757
|
+
...ephemeral ? ["--no-session-persistence"] : [],
|
|
26758
|
+
...workBuddyDelegationArguments(environment, ephemeral)
|
|
26759
|
+
];
|
|
26760
|
+
const serve = liteOnly && acpArguments.includes("--acp") && !acpArguments.includes("--serve");
|
|
26417
26761
|
const configuredEnvironment = withNodeRuntimeOnPath(workBuddyEnvironment(environment, platform), process.execPath, platform);
|
|
26418
26762
|
const productConfigPath = bundle ? bundledProductConfigPath(configuredEnvironment, platform, dependencies) : void 0;
|
|
26419
26763
|
const childEnvironment = bundle ? {
|
|
@@ -26422,17 +26766,20 @@ function workBuddyInvocation(environment, ephemeral, dependenciesOrArguments = {
|
|
|
26422
26766
|
// waits for its telemetry channel before copying; normal ACP keeps its policy.
|
|
26423
26767
|
...nativeArguments?.includes("--print") && nativeArguments.includes("--fork-session") && configuredEnvironment.DISABLE_TELEMETRY === void 0 ? { DISABLE_TELEMETRY: "1" } : {},
|
|
26424
26768
|
...productConfigPath ? { [WORKBUDDY_PRODUCT_CONFIG_PATH_ENV]: productConfigPath } : {},
|
|
26769
|
+
...liteOnly ? { CODEBUDDY_FORCE_LITE_WB_BUNDLE: "1" } : {},
|
|
26770
|
+
...serve ? {
|
|
26771
|
+
CODEBUDDY_GATEWAY_AUTH: "password",
|
|
26772
|
+
CODEBUDDY_GATEWAY_PASSWORD: randomBytes2(32).toString("base64url"),
|
|
26773
|
+
CODEBUDDY_GATEWAY_BASE_PATH: ""
|
|
26774
|
+
} : {},
|
|
26425
26775
|
ELECTRON_RUN_AS_NODE: "1"
|
|
26426
26776
|
} : configuredEnvironment;
|
|
26427
26777
|
return {
|
|
26428
26778
|
...commandInvocation(executable, [
|
|
26429
26779
|
...bundle ? ["--eval", `${WORKBUDDY_CREDENTIAL_PRELOAD}
|
|
26430
26780
|
require(process.argv[1]);`, bundle.cli] : [],
|
|
26431
|
-
...
|
|
26432
|
-
|
|
26433
|
-
...ephemeral ? ["--no-session-persistence"] : [],
|
|
26434
|
-
...workBuddyDelegationArguments(childEnvironment, ephemeral)
|
|
26435
|
-
]
|
|
26781
|
+
...acpArguments,
|
|
26782
|
+
...serve ? ["--serve", "--host", "127.0.0.1", "--port", "0", "--auth", "password"] : []
|
|
26436
26783
|
], childEnvironment, platform),
|
|
26437
26784
|
environment: childEnvironment
|
|
26438
26785
|
};
|
|
@@ -26637,14 +26984,95 @@ var WorkBuddyAdapter = class extends CodeBuddyAdapter {
|
|
|
26637
26984
|
}
|
|
26638
26985
|
};
|
|
26639
26986
|
|
|
26987
|
+
// dist/installation.js
|
|
26988
|
+
import { readFile as readFile6, stat as stat5 } from "node:fs/promises";
|
|
26989
|
+
var applicationNotice = {
|
|
26990
|
+
en: "These are WorkBuddy desktop app versions. Its bundled CLI updates with the app. Download the official installer, complete installation, then reopen Connections to verify the version. Existing sessions keep their running CLI.",
|
|
26991
|
+
"zh-CN": "此处显示 WorkBuddy 桌面应用版本,内置 CLI 随应用更新。请下载官方安装包并完成安装,再重新打开连接页确认版本。已有会话继续使用运行中的 CLI。"
|
|
26992
|
+
};
|
|
26993
|
+
function appVersion(value) {
|
|
26994
|
+
const version2 = installationVersion(value);
|
|
26995
|
+
return version2.replace(/^(\d+\.\d+\.\d+)\.\d+$/u, "$1");
|
|
26996
|
+
}
|
|
26997
|
+
async function readProduct(file2) {
|
|
26998
|
+
const metadata = await stat5(file2);
|
|
26999
|
+
if (!metadata.isFile() || metadata.size <= 0 || metadata.size > 8 * 1024 * 1024)
|
|
27000
|
+
throw new Error("WorkBuddy product metadata is unavailable");
|
|
27001
|
+
return JSON.parse(await readFile6(file2, "utf8"));
|
|
27002
|
+
}
|
|
27003
|
+
function createWorkBuddyInstallation(environment, dependencies = {}) {
|
|
27004
|
+
const platform = dependencies.platform ?? process.platform;
|
|
27005
|
+
const arch = dependencies.arch ?? process.arch;
|
|
27006
|
+
return async (action) => {
|
|
27007
|
+
if (action === "update")
|
|
27008
|
+
throw new Error("Complete the update with WorkBuddy's official desktop installer");
|
|
27009
|
+
const { executable, bundle } = resolveWorkBuddyLaunch(environment, { platform });
|
|
27010
|
+
if (!bundle)
|
|
27011
|
+
return {
|
|
27012
|
+
currentVersion: versionFromOutput(await runInstallationCommand(executable, ["--version"], environment)),
|
|
27013
|
+
latestVersion: "Unknown",
|
|
27014
|
+
latestVersionKind: "unknown",
|
|
27015
|
+
updateAvailable: false,
|
|
27016
|
+
canUpdate: false,
|
|
27017
|
+
notice: {
|
|
27018
|
+
en: "This is a custom CLI. Use its original installer to update; WorkBuddy desktop releases do not identify this CLI's latest version.",
|
|
27019
|
+
"zh-CN": "当前使用自定义 CLI,请通过原安装方式更新;WorkBuddy 桌面应用版本不代表此 CLI 的最新版本。"
|
|
27020
|
+
}
|
|
27021
|
+
};
|
|
27022
|
+
const paths = targetPath(platform);
|
|
27023
|
+
const product = await (dependencies.readProduct ?? readProduct)(paths.join(paths.dirname(paths.dirname(bundle.cli)), "product.json"));
|
|
27024
|
+
const currentVersion = appVersion(product.genieVersion);
|
|
27025
|
+
const unknown2 = {
|
|
27026
|
+
currentVersion,
|
|
27027
|
+
versionKind: "application",
|
|
27028
|
+
latestVersion: "Unknown",
|
|
27029
|
+
latestVersionKind: "unknown",
|
|
27030
|
+
updateAvailable: false,
|
|
27031
|
+
canUpdate: false,
|
|
27032
|
+
notice: {
|
|
27033
|
+
en: "The installed WorkBuddy desktop app version is shown. Check and install updates in WorkBuddy itself; this installation's update channel could not be checked here.",
|
|
27034
|
+
"zh-CN": "此处显示已安装的 WorkBuddy 桌面应用版本。当前无法查询此安装的更新渠道,请在 WorkBuddy 应用内检查并安装更新。"
|
|
27035
|
+
}
|
|
27036
|
+
};
|
|
27037
|
+
const root = product.applicationName === "workbuddy-ai" && product.updateUrl === "https://www.workbuddy.ai" ? "https://www.workbuddy.ai" : product.applicationName === "workbuddy" && product.updateUrl === "https://www.workbuddy.cn" ? "https://www.workbuddy.cn" : void 0;
|
|
27038
|
+
const target = platform === "darwin" && (arch === "arm64" || arch === "x64") ? `darwin-${arch}` : platform === "win32" && arch === "x64" ? "win32-x64-user" : void 0;
|
|
27039
|
+
if (!root || !target || environment.WORKBUDDY_UPDATE_URL?.trim() && environment.WORKBUDDY_UPDATE_URL.trim() !== root)
|
|
27040
|
+
return unknown2;
|
|
27041
|
+
try {
|
|
27042
|
+
const feed = JSON.parse(await (dependencies.fetchText ?? fetchInstallationText)(`${root}/v2/update?platform=workbuddy-${target}`));
|
|
27043
|
+
const feedVersion = installationVersion(feed.version);
|
|
27044
|
+
const latestVersion = appVersion(feedVersion);
|
|
27045
|
+
const download = new URL(typeof feed.url === "string" ? feed.url : "");
|
|
27046
|
+
const downloadHost = root.endsWith(".ai") ? "download.codebuddy.ai" : "download.codebuddy.cn";
|
|
27047
|
+
if (download.origin !== `https://${downloadHost}` || download.username || download.password || download.search || download.hash || !download.pathname.startsWith(`/workbuddy/saas/${target}/WorkBuddy-${target}-${feedVersion}-`) || !download.pathname.endsWith(platform === "darwin" ? ".zip" : ".exe"))
|
|
27048
|
+
throw new Error("WorkBuddy update feed returned an invalid installer URL");
|
|
27049
|
+
if (platform === "darwin")
|
|
27050
|
+
download.pathname = download.pathname.replace(/\.zip$/u, ".dmg");
|
|
27051
|
+
const updateAvailable = newerInstallationVersion(currentVersion, latestVersion);
|
|
27052
|
+
return {
|
|
27053
|
+
currentVersion,
|
|
27054
|
+
versionKind: "application",
|
|
27055
|
+
latestVersion,
|
|
27056
|
+
updateAvailable,
|
|
27057
|
+
canUpdate: false,
|
|
27058
|
+
...updateAvailable ? { manualUpdateUrl: download.href } : {},
|
|
27059
|
+
notice: applicationNotice
|
|
27060
|
+
};
|
|
27061
|
+
} catch {
|
|
27062
|
+
return unknown2;
|
|
27063
|
+
}
|
|
27064
|
+
};
|
|
27065
|
+
}
|
|
27066
|
+
|
|
26640
27067
|
// dist/plugin.js
|
|
26641
27068
|
function createHarnessAdapter(context) {
|
|
26642
27069
|
if (context.platform === "darwin" && context.managedRemoteHost) {
|
|
26643
|
-
const
|
|
27070
|
+
const environment2 = {
|
|
26644
27071
|
...context.environment,
|
|
26645
27072
|
...context.launchCommand ? { CODEXHOST_WORKBUDDY_COMMAND: context.launchCommand } : {}
|
|
26646
27073
|
};
|
|
26647
27074
|
return new BrokeredHarnessAdapter({
|
|
27075
|
+
sessionImport: true,
|
|
26648
27076
|
accountCredits: false,
|
|
26649
27077
|
harnessId: "workbuddy",
|
|
26650
27078
|
commandCatalog: WORKBUDDY_COMMAND_CATALOG,
|
|
@@ -26652,7 +27080,7 @@ function createHarnessAdapter(context) {
|
|
|
26652
27080
|
environment: { ...context.environment },
|
|
26653
27081
|
isInstalled: () => {
|
|
26654
27082
|
try {
|
|
26655
|
-
workBuddyInvocation(
|
|
27083
|
+
workBuddyInvocation(environment2, true);
|
|
26656
27084
|
return true;
|
|
26657
27085
|
} catch (error51) {
|
|
26658
27086
|
return !(error51 instanceof CodeBuddyError && error51.code === "notInstalled");
|
|
@@ -26661,11 +27089,12 @@ function createHarnessAdapter(context) {
|
|
|
26661
27089
|
...context.brokerDescriptorPath ? { descriptorPath: context.brokerDescriptorPath } : {}
|
|
26662
27090
|
});
|
|
26663
27091
|
}
|
|
26664
|
-
|
|
26665
|
-
environment
|
|
26666
|
-
|
|
26667
|
-
|
|
26668
|
-
|
|
27092
|
+
const environment = {
|
|
27093
|
+
...context.environment,
|
|
27094
|
+
...context.launchCommand ? { CODEXHOST_WORKBUDDY_COMMAND: context.launchCommand } : {}
|
|
27095
|
+
};
|
|
27096
|
+
return Object.assign(new WorkBuddyAdapter({ environment }), {
|
|
27097
|
+
installation: createWorkBuddyInstallation(environment)
|
|
26669
27098
|
});
|
|
26670
27099
|
}
|
|
26671
27100
|
export {
|