@codexhost/cli-win32-arm64 0.27.0 → 0.28.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/app/codexhost-distribution.json +1 -1
- package/app/console-server.mjs +369 -163
- package/app/console-web.js +223 -9
- package/app/desktop-controller.mjs +105 -4
- package/app/host-runtime.mjs +1938 -1024
- package/app/plugins/antigravity/plugin.mjs +390 -135
- package/app/plugins/claude-code/plugin.mjs +383 -32
- package/app/plugins/codebuddy/plugin.mjs +213 -30
- package/app/plugins/codex-usage/plugin.mjs +370 -52
- package/app/plugins/copilot/plugin.mjs +105 -4
- package/app/plugins/cursor-cli/plugin.mjs +126 -4
- package/app/plugins/deepseek-harness/plugin.mjs +107 -4
- package/app/plugins/devin/plugin.mjs +106 -4
- package/app/plugins/grok/plugin.mjs +186 -25
- package/app/plugins/hermes/plugin.mjs +107 -4
- package/app/plugins/kimi-code/plugin.mjs +105 -4
- package/app/plugins/kiro-cli/plugin.mjs +105 -4
- package/app/plugins/omp/plugin.mjs +261 -45
- package/app/plugins/opencode/plugin.mjs +107 -4
- package/app/plugins/pi/plugin.mjs +312 -48
- package/app/plugins/qoder/plugin.mjs +179 -18
- package/app/plugins/qoder-cn/plugin.mjs +179 -18
- package/app/plugins/qwen-code/plugin.mjs +105 -4
- package/app/plugins/workbuddy/plugin.mjs +213 -30
- package/app/plugins/zcode/plugin.mjs +225 -85
- package/app/renderer-extension.js +11973 -11468
- package/app/web/assets/index-BJq8mT6r.js +204 -0
- package/app/web/assets/index-CMDliP5b.css +1 -0
- package/app/web/codexhost-settings.js +110 -49
- package/app/web/index.html +2 -2
- package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +65 -65
- package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +69 -69
- package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +75 -75
- package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +72 -72
- package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +14 -14
- package/app/web/plugins/deepseek-ai__dsh-client-ui-input-trigger/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-layout/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-model-selection/client.js +5 -5
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-documentpreview/client.pdf.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-theme/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +18 -18
- package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +7 -7
- package/app/web-modules/server.mjs +2494 -1132
- package/bin/codexhost.exe +0 -0
- package/libexec/codexhost-node-repl.exe +0 -0
- package/libexec/codexhost-shell.exe +0 -0
- package/libexec/codexhost-shim.exe +0 -0
- package/libexec/codexhost-updater.exe +0 -0
- package/package.json +1 -1
- package/app/web/assets/index-D9l7_ThH.js +0 -199
- package/app/web/assets/index-nw2RXcDu.css +0 -1
|
@@ -20525,11 +20525,21 @@ var harnessThinkingOptionsSchema = external_exports.array(harnessThinkingOptionS
|
|
|
20525
20525
|
ids.add(option.id);
|
|
20526
20526
|
}
|
|
20527
20527
|
});
|
|
20528
|
+
var harnessThinkingOptionsScopeSchema = external_exports.enum(["catalog", "activeModel"]);
|
|
20528
20529
|
var harnessModelCatalogSchema = external_exports.object({
|
|
20529
20530
|
models: external_exports.array(harnessModelSchema),
|
|
20530
20531
|
defaultModel: harnessModelRefSchema.optional(),
|
|
20531
20532
|
thinkingOptions: harnessThinkingOptionsSchema,
|
|
20532
|
-
defaultThinkingOptionId: harnessThinkingOptionIdSchema.optional()
|
|
20533
|
+
defaultThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
20534
|
+
/**
|
|
20535
|
+
* Scope of per-Model `supportedThinkingOptionIds` in this catalog.
|
|
20536
|
+
* Omitted or `"catalog"` means each Model's `supportedThinkingOptionIds`
|
|
20537
|
+
* reflects its own options (omitted or `[]` means none).
|
|
20538
|
+
* `"activeModel"` means only the active Model's Thinking options were
|
|
20539
|
+
* observed; other Models omit `supportedThinkingOptionIds` and must be
|
|
20540
|
+
* validated by the Adapter after selecting the Model.
|
|
20541
|
+
*/
|
|
20542
|
+
thinkingOptionsScope: harnessThinkingOptionsScopeSchema.optional()
|
|
20533
20543
|
}).strict().superRefine((catalog, context) => {
|
|
20534
20544
|
const refs = [];
|
|
20535
20545
|
const thinkingIds = new Set(catalog.thinkingOptions.map(({ id: id2 }) => id2));
|
|
@@ -21443,7 +21453,12 @@ var clientProjectlessWorkspaceSchema = external_exports.object({
|
|
|
21443
21453
|
prompt: external_exports.string().max(16384).optional()
|
|
21444
21454
|
}).strict();
|
|
21445
21455
|
var clientWorkspaceSnapshotSchema = external_exports.object({
|
|
21446
|
-
projects: external_exports.array(external_exports.object({
|
|
21456
|
+
projects: external_exports.array(external_exports.object({
|
|
21457
|
+
id: external_exports.string(),
|
|
21458
|
+
name: external_exports.string(),
|
|
21459
|
+
rootPaths: external_exports.array(external_exports.string()),
|
|
21460
|
+
createdAt: external_exports.number().int().optional()
|
|
21461
|
+
})),
|
|
21447
21462
|
nativeProjects: external_exports.literal(true).optional(),
|
|
21448
21463
|
assignments: external_exports.record(external_exports.string(), external_exports.string()),
|
|
21449
21464
|
projectless: external_exports.array(external_exports.string()),
|
|
@@ -21856,6 +21871,7 @@ var delegationReadParamsSchema = external_exports.strictObject({
|
|
|
21856
21871
|
// ../../shared-contracts/dist/remote-peers.js
|
|
21857
21872
|
var REMOTE_PEER_ID_PATTERN = /^[a-zA-Z0-9_-]{1,64}$/u;
|
|
21858
21873
|
var remotePeerIdSchema = external_exports.string().regex(REMOTE_PEER_ID_PATTERN);
|
|
21874
|
+
var remotePeerNodeIdSchema = external_exports.string().regex(REMOTE_PEER_ID_PATTERN);
|
|
21859
21875
|
var remotePeerHostIdSchema = external_exports.string().regex(/^remote-peer:[a-zA-Z0-9_-]{1,64}$/u);
|
|
21860
21876
|
var remotePeerTransportKindSchema = external_exports.enum(["relay", "tailscale", "lan", "custom"]);
|
|
21861
21877
|
var REMOTE_PEER_COLORS = [
|
|
@@ -21879,6 +21895,7 @@ var remotePeerStateSchema = external_exports.enum([
|
|
|
21879
21895
|
var remotePeerSummarySchema = external_exports.object({
|
|
21880
21896
|
peerId: remotePeerIdSchema,
|
|
21881
21897
|
hostId: remotePeerHostIdSchema,
|
|
21898
|
+
nodeId: remotePeerNodeIdSchema.optional(),
|
|
21882
21899
|
name: external_exports.string().min(1).max(120),
|
|
21883
21900
|
color: remotePeerColorSchema.optional(),
|
|
21884
21901
|
origin: external_exports.string().min(1).max(2048),
|
|
@@ -21886,6 +21903,11 @@ var remotePeerSummarySchema = external_exports.object({
|
|
|
21886
21903
|
encrypted: external_exports.boolean(),
|
|
21887
21904
|
enabled: external_exports.boolean(),
|
|
21888
21905
|
state: remotePeerStateSchema,
|
|
21906
|
+
supportsPeerPairing: external_exports.boolean().optional(),
|
|
21907
|
+
/** Omitted when either side's node mapping is unknown. */
|
|
21908
|
+
pairedBack: external_exports.boolean().optional(),
|
|
21909
|
+
/** Other configured remote peerIds on this Hub present in this peer's `manifest.peerNodes`. */
|
|
21910
|
+
linkedPeerIds: external_exports.array(remotePeerIdSchema).max(128).optional(),
|
|
21889
21911
|
latencyMs: external_exports.number().int().nonnegative().optional(),
|
|
21890
21912
|
version: external_exports.string().max(128).optional(),
|
|
21891
21913
|
platform: external_exports.string().max(64).optional(),
|
|
@@ -21904,8 +21926,48 @@ var remotePeerAddParamsSchema = external_exports.object({
|
|
|
21904
21926
|
origin: external_exports.string().min(1).max(2048).optional(),
|
|
21905
21927
|
token: external_exports.string().min(1).max(2048).optional(),
|
|
21906
21928
|
name: external_exports.string().trim().min(1).max(120).optional(),
|
|
21907
|
-
color: remotePeerColorSchema.optional()
|
|
21929
|
+
color: remotePeerColorSchema.optional(),
|
|
21930
|
+
pairBack: external_exports.boolean().optional(),
|
|
21931
|
+
meshPeerIds: external_exports.array(remotePeerIdSchema).max(64).optional(),
|
|
21932
|
+
selfOrigin: external_exports.string().min(1).max(2048).optional()
|
|
21908
21933
|
}).refine((input3) => Boolean(input3.connectionUrl) || Boolean(input3.origin) && Boolean(input3.token), "Provide either connectionUrl or both origin and token");
|
|
21934
|
+
var remotePeerIntroduceParamsSchema = external_exports.strictObject({
|
|
21935
|
+
origin: external_exports.string().min(1).max(2048),
|
|
21936
|
+
token: external_exports.string().min(1).max(2048),
|
|
21937
|
+
name: external_exports.string().trim().min(1).max(120).optional(),
|
|
21938
|
+
color: remotePeerColorSchema.optional(),
|
|
21939
|
+
expectedNodeId: remotePeerNodeIdSchema.optional()
|
|
21940
|
+
});
|
|
21941
|
+
var remotePeerIntroduceResultSchema = external_exports.object({
|
|
21942
|
+
status: external_exports.enum(["added", "updated", "existing"]),
|
|
21943
|
+
peerId: remotePeerIdSchema,
|
|
21944
|
+
hostId: remotePeerHostIdSchema,
|
|
21945
|
+
nodeId: remotePeerNodeIdSchema.optional()
|
|
21946
|
+
});
|
|
21947
|
+
var remotePeerPairingStatusSchema = external_exports.enum([
|
|
21948
|
+
"added",
|
|
21949
|
+
"updated",
|
|
21950
|
+
"existing",
|
|
21951
|
+
"failed",
|
|
21952
|
+
"skipped"
|
|
21953
|
+
]);
|
|
21954
|
+
var remotePeerPairingStepSchema = external_exports.object({
|
|
21955
|
+
targetPeerId: remotePeerIdSchema,
|
|
21956
|
+
targetName: external_exports.string().min(1).max(120),
|
|
21957
|
+
introducedHost: external_exports.union([external_exports.literal("local"), remotePeerIdSchema]),
|
|
21958
|
+
introducedName: external_exports.string().min(1).max(120),
|
|
21959
|
+
status: remotePeerPairingStatusSchema,
|
|
21960
|
+
error: external_exports.string().max(1e3).optional()
|
|
21961
|
+
});
|
|
21962
|
+
var remotePeerPairingReportSchema = external_exports.object({
|
|
21963
|
+
results: external_exports.array(remotePeerPairingStepSchema)
|
|
21964
|
+
});
|
|
21965
|
+
var remotePeerSyncMeshParamsSchema = external_exports.object({
|
|
21966
|
+
peerIds: external_exports.array(remotePeerIdSchema).max(64).optional(),
|
|
21967
|
+
includeSelf: external_exports.boolean().optional(),
|
|
21968
|
+
includeMesh: external_exports.boolean().optional(),
|
|
21969
|
+
selfOrigin: external_exports.string().min(1).max(2048).optional()
|
|
21970
|
+
});
|
|
21909
21971
|
var remotePeerUpdateParamsSchema = external_exports.object({
|
|
21910
21972
|
peerId: remotePeerIdSchema,
|
|
21911
21973
|
name: external_exports.string().trim().min(1).max(120).optional(),
|
|
@@ -21934,6 +21996,9 @@ var remotePeerTestProjectSchema = external_exports.object({
|
|
|
21934
21996
|
});
|
|
21935
21997
|
var remotePeerTestResultSchema = external_exports.object({
|
|
21936
21998
|
ok: external_exports.boolean(),
|
|
21999
|
+
nodeId: remotePeerNodeIdSchema.optional(),
|
|
22000
|
+
supportsPeerPairing: external_exports.boolean().optional(),
|
|
22001
|
+
pairedBack: external_exports.boolean().optional(),
|
|
21937
22002
|
latencyMs: external_exports.number().int().nonnegative().optional(),
|
|
21938
22003
|
origin: external_exports.string().max(2048).optional(),
|
|
21939
22004
|
transportKind: remotePeerTransportKindSchema.optional(),
|
|
@@ -21960,7 +22025,9 @@ var remotePeerCapabilitiesSchema = external_exports.object({
|
|
|
21960
22025
|
/** Peer supports officeToPdf/render over /api/peer/v1/workspace-files/rpc. */
|
|
21961
22026
|
officePreview: external_exports.literal(1).optional(),
|
|
21962
22027
|
/** /api/peer/v1/delegation is available for fixed-whitelist cross-host delegation. */
|
|
21963
|
-
delegation: external_exports.literal(1).optional()
|
|
22028
|
+
delegation: external_exports.literal(1).optional(),
|
|
22029
|
+
/** POST /api/peer/v1/peers is available. */
|
|
22030
|
+
peerPairing: external_exports.literal(1).optional()
|
|
21964
22031
|
});
|
|
21965
22032
|
var remotePeerManifestSchema = external_exports.object({
|
|
21966
22033
|
version: external_exports.string().max(128),
|
|
@@ -21968,6 +22035,8 @@ var remotePeerManifestSchema = external_exports.object({
|
|
|
21968
22035
|
hostname: external_exports.string().max(255),
|
|
21969
22036
|
homeDir: external_exports.string().max(4096).optional(),
|
|
21970
22037
|
epoch: external_exports.string().min(1).max(256),
|
|
22038
|
+
nodeId: remotePeerNodeIdSchema.optional(),
|
|
22039
|
+
peerNodes: external_exports.record(remotePeerHostIdSchema, remotePeerNodeIdSchema).refine((v) => Object.keys(v).length <= 128).optional(),
|
|
21971
22040
|
projects: external_exports.array(remotePeerManifestProjectSchema),
|
|
21972
22041
|
capabilities: remotePeerCapabilitiesSchema.optional()
|
|
21973
22042
|
});
|
|
@@ -22054,6 +22123,29 @@ var remotePeerWorkspaceMutationResultSchema = external_exports.object({
|
|
|
22054
22123
|
workspaceId: external_exports.string().min(1).max(1024).optional(),
|
|
22055
22124
|
manifest: remotePeerManifestSchema
|
|
22056
22125
|
});
|
|
22126
|
+
var delegationRemoteHostsParamsSchema = external_exports.object({
|
|
22127
|
+
sessionHostId: external_exports.string().min(1).max(128).optional()
|
|
22128
|
+
});
|
|
22129
|
+
var delegationRemoteHostOptionSchema = external_exports.object({
|
|
22130
|
+
hostId: external_exports.union([external_exports.literal("local"), remotePeerHostIdSchema]),
|
|
22131
|
+
name: external_exports.string().min(1).max(120),
|
|
22132
|
+
isLocal: external_exports.boolean().optional(),
|
|
22133
|
+
color: remotePeerColorSchema.optional(),
|
|
22134
|
+
hostname: external_exports.string().max(255).optional()
|
|
22135
|
+
});
|
|
22136
|
+
var delegationRemoteHostsResultSchema = external_exports.object({
|
|
22137
|
+
hosts: external_exports.array(delegationRemoteHostOptionSchema)
|
|
22138
|
+
});
|
|
22139
|
+
var delegationHostHarnessesParamsSchema = external_exports.object({
|
|
22140
|
+
hostId: external_exports.union([external_exports.literal("local"), remotePeerHostIdSchema])
|
|
22141
|
+
});
|
|
22142
|
+
var delegationHostHarnessOptionSchema = external_exports.object({
|
|
22143
|
+
id: external_exports.string().regex(/^[a-z0-9][a-z0-9-]*$/u),
|
|
22144
|
+
name: external_exports.string().min(1).max(120)
|
|
22145
|
+
});
|
|
22146
|
+
var delegationHostHarnessesResultSchema = external_exports.object({
|
|
22147
|
+
harnesses: external_exports.array(delegationHostHarnessOptionSchema)
|
|
22148
|
+
});
|
|
22057
22149
|
|
|
22058
22150
|
// ../../shared-contracts/dist/peer-delegation.js
|
|
22059
22151
|
var PEER_DELEGATION_BRIDGE_VERSION = 1;
|
|
@@ -22097,6 +22189,7 @@ var peerDelegationHostProjectSchema = external_exports.strictObject({
|
|
|
22097
22189
|
});
|
|
22098
22190
|
var peerDelegationHostSummarySchema = external_exports.strictObject({
|
|
22099
22191
|
hostId: remotePeerHostIdSchema,
|
|
22192
|
+
nodeId: remotePeerNodeIdSchema.optional(),
|
|
22100
22193
|
displayName: external_exports.string().min(1).max(120),
|
|
22101
22194
|
online: external_exports.boolean(),
|
|
22102
22195
|
state: remotePeerStateSchema,
|
|
@@ -22989,6 +23082,13 @@ var updatePhaseSchema = external_exports.enum([
|
|
|
22989
23082
|
"succeeded",
|
|
22990
23083
|
"failed"
|
|
22991
23084
|
]);
|
|
23085
|
+
var npmDownloadProgressSchema = external_exports.strictObject({
|
|
23086
|
+
completed: external_exports.number().int().nonnegative(),
|
|
23087
|
+
total: external_exports.number().int().positive()
|
|
23088
|
+
}).refine((progress) => progress.completed <= progress.total, {
|
|
23089
|
+
path: ["completed"],
|
|
23090
|
+
message: "completed must not exceed total"
|
|
23091
|
+
});
|
|
22992
23092
|
var updateStatusSchema = external_exports.strictObject({
|
|
22993
23093
|
version: updateSemanticVersionSchema,
|
|
22994
23094
|
installation: updateInstallationSchema,
|
|
@@ -22996,6 +23096,7 @@ var updateStatusSchema = external_exports.strictObject({
|
|
|
22996
23096
|
updatedAt: external_exports.number().int().nonnegative(),
|
|
22997
23097
|
downloadedBytes: external_exports.number().int().nonnegative().optional(),
|
|
22998
23098
|
totalBytes: external_exports.number().int().positive().optional(),
|
|
23099
|
+
npmDownload: npmDownloadProgressSchema.optional(),
|
|
22999
23100
|
error: external_exports.string().min(1).max(UPDATE_ERROR_MAX_LENGTH).nullable(),
|
|
23000
23101
|
serviceStopOutput: external_exports.string().optional()
|
|
23001
23102
|
}).superRefine((status, context) => {
|
|
@@ -23815,9 +23916,8 @@ function configureSubagentSnapshot(snapshot, parent) {
|
|
|
23815
23916
|
|
|
23816
23917
|
// ../../harness-adapter/dist/usage-statistics.js
|
|
23817
23918
|
import { createReadStream } from "node:fs";
|
|
23818
|
-
import { lstat,
|
|
23919
|
+
import { lstat, readdir } from "node:fs/promises";
|
|
23819
23920
|
import path4 from "node:path";
|
|
23820
|
-
import { createInterface } from "node:readline";
|
|
23821
23921
|
var MAX_SESSION_ID_LENGTH = 512;
|
|
23822
23922
|
var MAX_CWD_LENGTH = 4096;
|
|
23823
23923
|
var MAX_SESSION_TITLE_LENGTH = 200;
|
|
@@ -23871,40 +23971,101 @@ function usageEntryFromRequest(request, occurredAtMs) {
|
|
|
23871
23971
|
...request.reasoningOutputTokens !== void 0 ? { reasoningOutputTokens: request.reasoningOutputTokens } : {}
|
|
23872
23972
|
};
|
|
23873
23973
|
}
|
|
23974
|
+
var JSONL_CHUNK_BYTES = 128 * 1024;
|
|
23975
|
+
var JSONL_HEADER_CHUNK_BYTES = 16 * 1024;
|
|
23874
23976
|
async function jsonlUsageSources(root, maxDepth, signal) {
|
|
23875
23977
|
const sources = [];
|
|
23876
23978
|
const visit2 = async (directory, depth) => {
|
|
23877
23979
|
signal.throwIfAborted();
|
|
23878
|
-
const entries = await
|
|
23980
|
+
const entries = await readdir(directory, { withFileTypes: true }).catch((error62) => {
|
|
23879
23981
|
if (error62.code === "ENOENT")
|
|
23880
23982
|
return null;
|
|
23881
23983
|
throw error62;
|
|
23882
23984
|
});
|
|
23883
23985
|
if (!entries)
|
|
23884
23986
|
return;
|
|
23885
|
-
|
|
23886
|
-
|
|
23987
|
+
const subdirectories = [];
|
|
23988
|
+
const files = [];
|
|
23989
|
+
for (const entry of entries) {
|
|
23887
23990
|
const file2 = path4.join(directory, entry.name);
|
|
23888
23991
|
if (entry.isDirectory()) {
|
|
23889
23992
|
if (depth < maxDepth)
|
|
23890
|
-
|
|
23993
|
+
subdirectories.push(file2);
|
|
23891
23994
|
} else if (entry.isFile() && entry.name.endsWith(".jsonl")) {
|
|
23892
|
-
|
|
23893
|
-
|
|
23894
|
-
|
|
23995
|
+
files.push(file2);
|
|
23996
|
+
}
|
|
23997
|
+
}
|
|
23998
|
+
if (files.length > 0) {
|
|
23999
|
+
const stats = await Promise.all(files.map((file2) => lstat(file2).catch(() => null)));
|
|
24000
|
+
signal.throwIfAborted();
|
|
24001
|
+
for (let i = 0; i < files.length; i++) {
|
|
24002
|
+
const file2 = files[i];
|
|
24003
|
+
const info = stats[i];
|
|
24004
|
+
if (file2 && info?.isFile() && info.size > 0) {
|
|
24005
|
+
sources.push({
|
|
24006
|
+
id: file2,
|
|
24007
|
+
fingerprint: `${info.ino}:${info.size}:${info.mtimeMs}`
|
|
24008
|
+
});
|
|
23895
24009
|
}
|
|
23896
24010
|
}
|
|
23897
24011
|
}
|
|
24012
|
+
for (const subdirectory of subdirectories)
|
|
24013
|
+
await visit2(subdirectory, depth + 1);
|
|
23898
24014
|
};
|
|
23899
24015
|
await visit2(root, 0);
|
|
23900
24016
|
return sources;
|
|
23901
24017
|
}
|
|
24018
|
+
function concatParts(parts, total) {
|
|
24019
|
+
const [single] = parts;
|
|
24020
|
+
return single && parts.length === 1 ? single : Buffer.concat(parts, total);
|
|
24021
|
+
}
|
|
24022
|
+
async function* jsonlLineSlices(file2, signal, highWaterMark) {
|
|
24023
|
+
const stream = createReadStream(file2, { highWaterMark, signal });
|
|
24024
|
+
let parts = [];
|
|
24025
|
+
let buffered = 0;
|
|
24026
|
+
try {
|
|
24027
|
+
for await (const raw of stream) {
|
|
24028
|
+
signal.throwIfAborted();
|
|
24029
|
+
const chunk = raw;
|
|
24030
|
+
let start = 0;
|
|
24031
|
+
let end;
|
|
24032
|
+
while ((end = chunk.indexOf(10, start)) >= 0) {
|
|
24033
|
+
const lineEnd = end > start && chunk[end - 1] === 13 ? end - 1 : end;
|
|
24034
|
+
const slice = chunk.subarray(start, lineEnd);
|
|
24035
|
+
if (buffered === 0) {
|
|
24036
|
+
yield slice;
|
|
24037
|
+
} else {
|
|
24038
|
+
if (slice.length > 0) {
|
|
24039
|
+
parts.push(slice);
|
|
24040
|
+
buffered += slice.length;
|
|
24041
|
+
}
|
|
24042
|
+
const combined = concatParts(parts, buffered);
|
|
24043
|
+
parts = [];
|
|
24044
|
+
buffered = 0;
|
|
24045
|
+
yield combined.length > 0 && combined[combined.length - 1] === 13 ? combined.subarray(0, combined.length - 1) : combined;
|
|
24046
|
+
}
|
|
24047
|
+
start = end + 1;
|
|
24048
|
+
}
|
|
24049
|
+
if (start < chunk.length) {
|
|
24050
|
+
const rest = chunk.subarray(start);
|
|
24051
|
+
parts.push(rest);
|
|
24052
|
+
buffered += rest.length;
|
|
24053
|
+
}
|
|
24054
|
+
}
|
|
24055
|
+
if (buffered > 0) {
|
|
24056
|
+
const combined = concatParts(parts, buffered);
|
|
24057
|
+
yield combined.length > 0 && combined[combined.length - 1] === 13 ? combined.subarray(0, combined.length - 1) : combined;
|
|
24058
|
+
}
|
|
24059
|
+
} finally {
|
|
24060
|
+
stream.destroy();
|
|
24061
|
+
}
|
|
24062
|
+
}
|
|
23902
24063
|
async function* jsonlRecords(file2, marker, signal) {
|
|
23903
|
-
const
|
|
23904
|
-
|
|
23905
|
-
|
|
23906
|
-
|
|
23907
|
-
|
|
24064
|
+
const markerBytes = marker.length > 0 ? Buffer.from(marker, "utf8") : null;
|
|
24065
|
+
for await (const rawLine of jsonlLineSlices(file2, signal, JSONL_CHUNK_BYTES)) {
|
|
24066
|
+
if (markerBytes && !rawLine.includes(markerBytes))
|
|
24067
|
+
continue;
|
|
24068
|
+
const line = rawLine.toString("utf8");
|
|
23908
24069
|
if (!line.includes(marker))
|
|
23909
24070
|
continue;
|
|
23910
24071
|
let value;
|
|
@@ -23919,30 +24080,23 @@ async function* jsonlRecords(file2, marker, signal) {
|
|
|
23919
24080
|
}
|
|
23920
24081
|
}
|
|
23921
24082
|
async function jsonlHeader(file2, match, signal, maxLines = 4) {
|
|
23922
|
-
const stream = createReadStream(file2, { encoding: "utf8", signal });
|
|
23923
|
-
const lines = createInterface({ input: stream, crlfDelay: Infinity });
|
|
23924
24083
|
let seen = 0;
|
|
23925
|
-
|
|
23926
|
-
|
|
23927
|
-
|
|
23928
|
-
|
|
23929
|
-
|
|
23930
|
-
|
|
23931
|
-
|
|
23932
|
-
|
|
23933
|
-
|
|
23934
|
-
|
|
23935
|
-
|
|
23936
|
-
|
|
23937
|
-
|
|
23938
|
-
return record10;
|
|
23939
|
-
}
|
|
24084
|
+
for await (const rawLine of jsonlLineSlices(file2, signal, JSONL_HEADER_CHUNK_BYTES)) {
|
|
24085
|
+
if (++seen > maxLines)
|
|
24086
|
+
break;
|
|
24087
|
+
let value;
|
|
24088
|
+
try {
|
|
24089
|
+
value = JSON.parse(rawLine.toString("utf8"));
|
|
24090
|
+
} catch {
|
|
24091
|
+
continue;
|
|
24092
|
+
}
|
|
24093
|
+
if (typeof value === "object" && value !== null && !Array.isArray(value)) {
|
|
24094
|
+
const record10 = value;
|
|
24095
|
+
if (match(record10))
|
|
24096
|
+
return record10;
|
|
23940
24097
|
}
|
|
23941
|
-
return null;
|
|
23942
|
-
} finally {
|
|
23943
|
-
lines.close();
|
|
23944
|
-
stream.destroy();
|
|
23945
24098
|
}
|
|
24099
|
+
return null;
|
|
23946
24100
|
}
|
|
23947
24101
|
function nativeTimeMs(value) {
|
|
23948
24102
|
const time3 = typeof value === "number" ? value : typeof value === "string" ? Date.parse(value) : Number.NaN;
|
|
@@ -23951,10 +24105,10 @@ function nativeTimeMs(value) {
|
|
|
23951
24105
|
|
|
23952
24106
|
// dist/pi-session-import.js
|
|
23953
24107
|
import { createReadStream as createReadStream2 } from "node:fs";
|
|
23954
|
-
import { opendir
|
|
24108
|
+
import { opendir, realpath, stat } from "node:fs/promises";
|
|
23955
24109
|
import os2 from "node:os";
|
|
23956
24110
|
import path5 from "node:path";
|
|
23957
|
-
import { createInterface
|
|
24111
|
+
import { createInterface } from "node:readline";
|
|
23958
24112
|
|
|
23959
24113
|
// ../../harness-adapter/dist/session-import.js
|
|
23960
24114
|
var SessionImportChangedError = class extends Error {
|
|
@@ -24072,7 +24226,7 @@ async function sessionFiles(directory, flat, signal) {
|
|
|
24072
24226
|
const files = [];
|
|
24073
24227
|
const visit2 = async (dir, projectLevel) => {
|
|
24074
24228
|
signal.throwIfAborted();
|
|
24075
|
-
const entries = await
|
|
24229
|
+
const entries = await opendir(dir).catch((error62) => {
|
|
24076
24230
|
if (isMissingFileError(error62))
|
|
24077
24231
|
return null;
|
|
24078
24232
|
throw error62;
|
|
@@ -24096,7 +24250,7 @@ async function readCandidate(file2, signal) {
|
|
|
24096
24250
|
if (!before.isFile() || before.size === 0)
|
|
24097
24251
|
return null;
|
|
24098
24252
|
const stream = createReadStream2(file2, { encoding: "utf8", signal, end: before.size - 1 });
|
|
24099
|
-
const lines =
|
|
24253
|
+
const lines = createInterface({ input: stream, crlfDelay: Infinity });
|
|
24100
24254
|
let header;
|
|
24101
24255
|
let name = null;
|
|
24102
24256
|
let firstMessage = null;
|
|
@@ -24170,7 +24324,7 @@ async function readCandidate(file2, signal) {
|
|
|
24170
24324
|
}
|
|
24171
24325
|
async function readIdentity(file2, signal) {
|
|
24172
24326
|
const stream = createReadStream2(file2, { encoding: "utf8", signal });
|
|
24173
|
-
const lines =
|
|
24327
|
+
const lines = createInterface({ input: stream, crlfDelay: Infinity });
|
|
24174
24328
|
try {
|
|
24175
24329
|
for await (const line of lines) {
|
|
24176
24330
|
signal.throwIfAborted();
|
|
@@ -27198,13 +27352,14 @@ function createPiCredentialImports(options = {}) {
|
|
|
27198
27352
|
}
|
|
27199
27353
|
|
|
27200
27354
|
// dist/pi-empty-session.js
|
|
27201
|
-
import { createReadStream as
|
|
27202
|
-
import { createInterface as
|
|
27355
|
+
import { createReadStream as createReadStream4 } from "node:fs";
|
|
27356
|
+
import { createInterface as createInterface2 } from "node:readline";
|
|
27203
27357
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
27204
27358
|
import { link, open as open3, rm as rm4 } from "node:fs/promises";
|
|
27205
27359
|
import path12 from "node:path";
|
|
27206
27360
|
|
|
27207
27361
|
// dist/pi-session-file.js
|
|
27362
|
+
import { createReadStream as createReadStream3 } from "node:fs";
|
|
27208
27363
|
import { open as open2, realpath as realpath3 } from "node:fs/promises";
|
|
27209
27364
|
var MAX_SESSION_HEADER_BYTES = 64 * 1024;
|
|
27210
27365
|
var utf8Decoder = new TextDecoder("utf-8", { fatal: true });
|
|
@@ -27256,6 +27411,54 @@ async function verifyPiSessionCwd(input3) {
|
|
|
27256
27411
|
throw new Error("Pi Fork Session did not bind the requested cwd");
|
|
27257
27412
|
}
|
|
27258
27413
|
}
|
|
27414
|
+
function historyEntry(value) {
|
|
27415
|
+
if (!isRecord8(value) || value.type === "session" || typeof value.id !== "string" || value.id.length === 0 || value.parentId !== null && typeof value.parentId !== "string" || typeof value.type !== "string") {
|
|
27416
|
+
return null;
|
|
27417
|
+
}
|
|
27418
|
+
return value;
|
|
27419
|
+
}
|
|
27420
|
+
async function* sessionLines(sessionFile) {
|
|
27421
|
+
const input3 = createReadStream3(sessionFile, { encoding: "utf8" });
|
|
27422
|
+
let pending = "";
|
|
27423
|
+
try {
|
|
27424
|
+
for await (const chunk of input3) {
|
|
27425
|
+
const contents = chunk;
|
|
27426
|
+
let start = 0;
|
|
27427
|
+
let newline;
|
|
27428
|
+
while ((newline = contents.indexOf("\n", start)) !== -1) {
|
|
27429
|
+
const line = pending + contents.slice(start, newline);
|
|
27430
|
+
pending = "";
|
|
27431
|
+
yield line.endsWith("\r") ? line.slice(0, -1) : line;
|
|
27432
|
+
start = newline + 1;
|
|
27433
|
+
}
|
|
27434
|
+
pending += contents.slice(start);
|
|
27435
|
+
}
|
|
27436
|
+
if (pending.length > 0)
|
|
27437
|
+
yield pending.endsWith("\r") ? pending.slice(0, -1) : pending;
|
|
27438
|
+
} finally {
|
|
27439
|
+
input3.destroy();
|
|
27440
|
+
}
|
|
27441
|
+
}
|
|
27442
|
+
async function readPiSessionHistory(sessionFile) {
|
|
27443
|
+
const entries = [];
|
|
27444
|
+
let leafId = null;
|
|
27445
|
+
for await (const line of sessionLines(sessionFile)) {
|
|
27446
|
+
if (line.length === 0)
|
|
27447
|
+
continue;
|
|
27448
|
+
let parsed;
|
|
27449
|
+
try {
|
|
27450
|
+
parsed = JSON.parse(line);
|
|
27451
|
+
} catch {
|
|
27452
|
+
continue;
|
|
27453
|
+
}
|
|
27454
|
+
const entry = historyEntry(parsed);
|
|
27455
|
+
if (!entry)
|
|
27456
|
+
continue;
|
|
27457
|
+
entries.push(entry);
|
|
27458
|
+
leafId = entry.id;
|
|
27459
|
+
}
|
|
27460
|
+
return { entries, leafId };
|
|
27461
|
+
}
|
|
27259
27462
|
|
|
27260
27463
|
// dist/pi-empty-session.js
|
|
27261
27464
|
async function persistEmptyPiSession(input3) {
|
|
@@ -27318,8 +27521,8 @@ async function readPiEmptySessionConfiguration(sessionFile) {
|
|
|
27318
27521
|
}
|
|
27319
27522
|
if (header.version !== 3)
|
|
27320
27523
|
return void 0;
|
|
27321
|
-
const stream =
|
|
27322
|
-
const lines =
|
|
27524
|
+
const stream = createReadStream4(sessionFile, { encoding: "utf8" });
|
|
27525
|
+
const lines = createInterface2({ input: stream, crlfDelay: Infinity });
|
|
27323
27526
|
let readFailure;
|
|
27324
27527
|
stream.on("error", (error62) => {
|
|
27325
27528
|
readFailure = error62;
|
|
@@ -31777,6 +31980,67 @@ var PiAdapter = class {
|
|
|
31777
31980
|
return { ok: false, error: normalizedError(error62, "nativeFailure") };
|
|
31778
31981
|
}
|
|
31779
31982
|
}
|
|
31983
|
+
async readSnapshot(input3) {
|
|
31984
|
+
if (this.#closePromise) {
|
|
31985
|
+
return { ok: false, error: invalidState("Pi Adapter is closed") };
|
|
31986
|
+
}
|
|
31987
|
+
const parsedRef = nativeSessionRefSchema.safeParse(input3.nativeRef);
|
|
31988
|
+
if (!parsedRef.success || parsedRef.data.harnessId !== this.harnessId) {
|
|
31989
|
+
return {
|
|
31990
|
+
ok: false,
|
|
31991
|
+
error: {
|
|
31992
|
+
code: "invalidRequest",
|
|
31993
|
+
message: "Pi Native Session reference is invalid",
|
|
31994
|
+
retryable: false
|
|
31995
|
+
}
|
|
31996
|
+
};
|
|
31997
|
+
}
|
|
31998
|
+
const sourceRef = parsedRef.data;
|
|
31999
|
+
if (!isRecord10(sourceRef.locator) || typeof sourceRef.locator.sessionFile !== "string" || sourceRef.locator.sessionFile.length === 0) {
|
|
32000
|
+
return {
|
|
32001
|
+
ok: false,
|
|
32002
|
+
error: {
|
|
32003
|
+
code: "unsupported",
|
|
32004
|
+
message: "Pi Native Session Ref has no resumable Session file",
|
|
32005
|
+
retryable: false
|
|
32006
|
+
}
|
|
32007
|
+
};
|
|
32008
|
+
}
|
|
32009
|
+
try {
|
|
32010
|
+
const sessionFile = sourceRef.locator.sessionFile;
|
|
32011
|
+
const header = await readPiSessionHeader(sessionFile);
|
|
32012
|
+
if (header.id !== sourceRef.nativeSessionId) {
|
|
32013
|
+
throw new PiAdapterFaultError({
|
|
32014
|
+
code: "sessionNotFound",
|
|
32015
|
+
message: "Pi Session header identity does not match the persisted Native Session Ref",
|
|
32016
|
+
retryable: false
|
|
32017
|
+
});
|
|
32018
|
+
}
|
|
32019
|
+
const history = await readPiSessionHistory(sessionFile);
|
|
32020
|
+
const subagents = new PiSubagents(() => void 0);
|
|
32021
|
+
await restorePiSubagents(history, /* @__PURE__ */ new Set([sourceRef.nativeSessionId, sessionFile]), subagents);
|
|
32022
|
+
return {
|
|
32023
|
+
ok: true,
|
|
32024
|
+
value: mapPiSnapshot(history, {
|
|
32025
|
+
sessionId: sourceRef.nativeSessionId,
|
|
32026
|
+
model: null,
|
|
32027
|
+
cwd: input3.cwd
|
|
32028
|
+
}, subagents)
|
|
32029
|
+
};
|
|
32030
|
+
} catch (error62) {
|
|
32031
|
+
if (isRecord10(error62) && error62.code === "ENOENT") {
|
|
32032
|
+
return {
|
|
32033
|
+
ok: false,
|
|
32034
|
+
error: {
|
|
32035
|
+
code: "sessionNotFound",
|
|
32036
|
+
message: errorMessage(error62),
|
|
32037
|
+
retryable: false
|
|
32038
|
+
}
|
|
32039
|
+
};
|
|
32040
|
+
}
|
|
32041
|
+
return { ok: false, error: normalizedError(error62, "nativeFailure") };
|
|
32042
|
+
}
|
|
32043
|
+
}
|
|
31780
32044
|
#trackSession(cwd, options) {
|
|
31781
32045
|
const environment = options.environment;
|
|
31782
32046
|
const createTransport = environment ? (input3) => this.#createTransport({ ...input3, environment }) : this.#createTransport;
|