@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
|
@@ -20126,11 +20126,21 @@ var harnessThinkingOptionsSchema = external_exports.array(harnessThinkingOptionS
|
|
|
20126
20126
|
ids.add(option2.id);
|
|
20127
20127
|
}
|
|
20128
20128
|
});
|
|
20129
|
+
var harnessThinkingOptionsScopeSchema = external_exports.enum(["catalog", "activeModel"]);
|
|
20129
20130
|
var harnessModelCatalogSchema = external_exports.object({
|
|
20130
20131
|
models: external_exports.array(harnessModelSchema),
|
|
20131
20132
|
defaultModel: harnessModelRefSchema.optional(),
|
|
20132
20133
|
thinkingOptions: harnessThinkingOptionsSchema,
|
|
20133
|
-
defaultThinkingOptionId: harnessThinkingOptionIdSchema.optional()
|
|
20134
|
+
defaultThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
20135
|
+
/**
|
|
20136
|
+
* Scope of per-Model `supportedThinkingOptionIds` in this catalog.
|
|
20137
|
+
* Omitted or `"catalog"` means each Model's `supportedThinkingOptionIds`
|
|
20138
|
+
* reflects its own options (omitted or `[]` means none).
|
|
20139
|
+
* `"activeModel"` means only the active Model's Thinking options were
|
|
20140
|
+
* observed; other Models omit `supportedThinkingOptionIds` and must be
|
|
20141
|
+
* validated by the Adapter after selecting the Model.
|
|
20142
|
+
*/
|
|
20143
|
+
thinkingOptionsScope: harnessThinkingOptionsScopeSchema.optional()
|
|
20134
20144
|
}).strict().superRefine((catalog, context) => {
|
|
20135
20145
|
const refs = [];
|
|
20136
20146
|
const thinkingIds = new Set(catalog.thinkingOptions.map(({ id: id3 }) => id3));
|
|
@@ -21044,7 +21054,12 @@ var clientProjectlessWorkspaceSchema = external_exports.object({
|
|
|
21044
21054
|
prompt: external_exports.string().max(16384).optional()
|
|
21045
21055
|
}).strict();
|
|
21046
21056
|
var clientWorkspaceSnapshotSchema = external_exports.object({
|
|
21047
|
-
projects: external_exports.array(external_exports.object({
|
|
21057
|
+
projects: external_exports.array(external_exports.object({
|
|
21058
|
+
id: external_exports.string(),
|
|
21059
|
+
name: external_exports.string(),
|
|
21060
|
+
rootPaths: external_exports.array(external_exports.string()),
|
|
21061
|
+
createdAt: external_exports.number().int().optional()
|
|
21062
|
+
})),
|
|
21048
21063
|
nativeProjects: external_exports.literal(true).optional(),
|
|
21049
21064
|
assignments: external_exports.record(external_exports.string(), external_exports.string()),
|
|
21050
21065
|
projectless: external_exports.array(external_exports.string()),
|
|
@@ -21457,6 +21472,7 @@ var delegationReadParamsSchema = external_exports.strictObject({
|
|
|
21457
21472
|
// ../../shared-contracts/dist/remote-peers.js
|
|
21458
21473
|
var REMOTE_PEER_ID_PATTERN = /^[a-zA-Z0-9_-]{1,64}$/u;
|
|
21459
21474
|
var remotePeerIdSchema = external_exports.string().regex(REMOTE_PEER_ID_PATTERN);
|
|
21475
|
+
var remotePeerNodeIdSchema = external_exports.string().regex(REMOTE_PEER_ID_PATTERN);
|
|
21460
21476
|
var remotePeerHostIdSchema = external_exports.string().regex(/^remote-peer:[a-zA-Z0-9_-]{1,64}$/u);
|
|
21461
21477
|
var remotePeerTransportKindSchema = external_exports.enum(["relay", "tailscale", "lan", "custom"]);
|
|
21462
21478
|
var REMOTE_PEER_COLORS = [
|
|
@@ -21480,6 +21496,7 @@ var remotePeerStateSchema = external_exports.enum([
|
|
|
21480
21496
|
var remotePeerSummarySchema = external_exports.object({
|
|
21481
21497
|
peerId: remotePeerIdSchema,
|
|
21482
21498
|
hostId: remotePeerHostIdSchema,
|
|
21499
|
+
nodeId: remotePeerNodeIdSchema.optional(),
|
|
21483
21500
|
name: external_exports.string().min(1).max(120),
|
|
21484
21501
|
color: remotePeerColorSchema.optional(),
|
|
21485
21502
|
origin: external_exports.string().min(1).max(2048),
|
|
@@ -21487,6 +21504,11 @@ var remotePeerSummarySchema = external_exports.object({
|
|
|
21487
21504
|
encrypted: external_exports.boolean(),
|
|
21488
21505
|
enabled: external_exports.boolean(),
|
|
21489
21506
|
state: remotePeerStateSchema,
|
|
21507
|
+
supportsPeerPairing: external_exports.boolean().optional(),
|
|
21508
|
+
/** Omitted when either side's node mapping is unknown. */
|
|
21509
|
+
pairedBack: external_exports.boolean().optional(),
|
|
21510
|
+
/** Other configured remote peerIds on this Hub present in this peer's `manifest.peerNodes`. */
|
|
21511
|
+
linkedPeerIds: external_exports.array(remotePeerIdSchema).max(128).optional(),
|
|
21490
21512
|
latencyMs: external_exports.number().int().nonnegative().optional(),
|
|
21491
21513
|
version: external_exports.string().max(128).optional(),
|
|
21492
21514
|
platform: external_exports.string().max(64).optional(),
|
|
@@ -21505,8 +21527,48 @@ var remotePeerAddParamsSchema = external_exports.object({
|
|
|
21505
21527
|
origin: external_exports.string().min(1).max(2048).optional(),
|
|
21506
21528
|
token: external_exports.string().min(1).max(2048).optional(),
|
|
21507
21529
|
name: external_exports.string().trim().min(1).max(120).optional(),
|
|
21508
|
-
color: remotePeerColorSchema.optional()
|
|
21530
|
+
color: remotePeerColorSchema.optional(),
|
|
21531
|
+
pairBack: external_exports.boolean().optional(),
|
|
21532
|
+
meshPeerIds: external_exports.array(remotePeerIdSchema).max(64).optional(),
|
|
21533
|
+
selfOrigin: external_exports.string().min(1).max(2048).optional()
|
|
21509
21534
|
}).refine((input3) => Boolean(input3.connectionUrl) || Boolean(input3.origin) && Boolean(input3.token), "Provide either connectionUrl or both origin and token");
|
|
21535
|
+
var remotePeerIntroduceParamsSchema = external_exports.strictObject({
|
|
21536
|
+
origin: external_exports.string().min(1).max(2048),
|
|
21537
|
+
token: external_exports.string().min(1).max(2048),
|
|
21538
|
+
name: external_exports.string().trim().min(1).max(120).optional(),
|
|
21539
|
+
color: remotePeerColorSchema.optional(),
|
|
21540
|
+
expectedNodeId: remotePeerNodeIdSchema.optional()
|
|
21541
|
+
});
|
|
21542
|
+
var remotePeerIntroduceResultSchema = external_exports.object({
|
|
21543
|
+
status: external_exports.enum(["added", "updated", "existing"]),
|
|
21544
|
+
peerId: remotePeerIdSchema,
|
|
21545
|
+
hostId: remotePeerHostIdSchema,
|
|
21546
|
+
nodeId: remotePeerNodeIdSchema.optional()
|
|
21547
|
+
});
|
|
21548
|
+
var remotePeerPairingStatusSchema = external_exports.enum([
|
|
21549
|
+
"added",
|
|
21550
|
+
"updated",
|
|
21551
|
+
"existing",
|
|
21552
|
+
"failed",
|
|
21553
|
+
"skipped"
|
|
21554
|
+
]);
|
|
21555
|
+
var remotePeerPairingStepSchema = external_exports.object({
|
|
21556
|
+
targetPeerId: remotePeerIdSchema,
|
|
21557
|
+
targetName: external_exports.string().min(1).max(120),
|
|
21558
|
+
introducedHost: external_exports.union([external_exports.literal("local"), remotePeerIdSchema]),
|
|
21559
|
+
introducedName: external_exports.string().min(1).max(120),
|
|
21560
|
+
status: remotePeerPairingStatusSchema,
|
|
21561
|
+
error: external_exports.string().max(1e3).optional()
|
|
21562
|
+
});
|
|
21563
|
+
var remotePeerPairingReportSchema = external_exports.object({
|
|
21564
|
+
results: external_exports.array(remotePeerPairingStepSchema)
|
|
21565
|
+
});
|
|
21566
|
+
var remotePeerSyncMeshParamsSchema = external_exports.object({
|
|
21567
|
+
peerIds: external_exports.array(remotePeerIdSchema).max(64).optional(),
|
|
21568
|
+
includeSelf: external_exports.boolean().optional(),
|
|
21569
|
+
includeMesh: external_exports.boolean().optional(),
|
|
21570
|
+
selfOrigin: external_exports.string().min(1).max(2048).optional()
|
|
21571
|
+
});
|
|
21510
21572
|
var remotePeerUpdateParamsSchema = external_exports.object({
|
|
21511
21573
|
peerId: remotePeerIdSchema,
|
|
21512
21574
|
name: external_exports.string().trim().min(1).max(120).optional(),
|
|
@@ -21535,6 +21597,9 @@ var remotePeerTestProjectSchema = external_exports.object({
|
|
|
21535
21597
|
});
|
|
21536
21598
|
var remotePeerTestResultSchema = external_exports.object({
|
|
21537
21599
|
ok: external_exports.boolean(),
|
|
21600
|
+
nodeId: remotePeerNodeIdSchema.optional(),
|
|
21601
|
+
supportsPeerPairing: external_exports.boolean().optional(),
|
|
21602
|
+
pairedBack: external_exports.boolean().optional(),
|
|
21538
21603
|
latencyMs: external_exports.number().int().nonnegative().optional(),
|
|
21539
21604
|
origin: external_exports.string().max(2048).optional(),
|
|
21540
21605
|
transportKind: remotePeerTransportKindSchema.optional(),
|
|
@@ -21561,7 +21626,9 @@ var remotePeerCapabilitiesSchema = external_exports.object({
|
|
|
21561
21626
|
/** Peer supports officeToPdf/render over /api/peer/v1/workspace-files/rpc. */
|
|
21562
21627
|
officePreview: external_exports.literal(1).optional(),
|
|
21563
21628
|
/** /api/peer/v1/delegation is available for fixed-whitelist cross-host delegation. */
|
|
21564
|
-
delegation: external_exports.literal(1).optional()
|
|
21629
|
+
delegation: external_exports.literal(1).optional(),
|
|
21630
|
+
/** POST /api/peer/v1/peers is available. */
|
|
21631
|
+
peerPairing: external_exports.literal(1).optional()
|
|
21565
21632
|
});
|
|
21566
21633
|
var remotePeerManifestSchema = external_exports.object({
|
|
21567
21634
|
version: external_exports.string().max(128),
|
|
@@ -21569,6 +21636,8 @@ var remotePeerManifestSchema = external_exports.object({
|
|
|
21569
21636
|
hostname: external_exports.string().max(255),
|
|
21570
21637
|
homeDir: external_exports.string().max(4096).optional(),
|
|
21571
21638
|
epoch: external_exports.string().min(1).max(256),
|
|
21639
|
+
nodeId: remotePeerNodeIdSchema.optional(),
|
|
21640
|
+
peerNodes: external_exports.record(remotePeerHostIdSchema, remotePeerNodeIdSchema).refine((v) => Object.keys(v).length <= 128).optional(),
|
|
21572
21641
|
projects: external_exports.array(remotePeerManifestProjectSchema),
|
|
21573
21642
|
capabilities: remotePeerCapabilitiesSchema.optional()
|
|
21574
21643
|
});
|
|
@@ -21655,6 +21724,29 @@ var remotePeerWorkspaceMutationResultSchema = external_exports.object({
|
|
|
21655
21724
|
workspaceId: external_exports.string().min(1).max(1024).optional(),
|
|
21656
21725
|
manifest: remotePeerManifestSchema
|
|
21657
21726
|
});
|
|
21727
|
+
var delegationRemoteHostsParamsSchema = external_exports.object({
|
|
21728
|
+
sessionHostId: external_exports.string().min(1).max(128).optional()
|
|
21729
|
+
});
|
|
21730
|
+
var delegationRemoteHostOptionSchema = external_exports.object({
|
|
21731
|
+
hostId: external_exports.union([external_exports.literal("local"), remotePeerHostIdSchema]),
|
|
21732
|
+
name: external_exports.string().min(1).max(120),
|
|
21733
|
+
isLocal: external_exports.boolean().optional(),
|
|
21734
|
+
color: remotePeerColorSchema.optional(),
|
|
21735
|
+
hostname: external_exports.string().max(255).optional()
|
|
21736
|
+
});
|
|
21737
|
+
var delegationRemoteHostsResultSchema = external_exports.object({
|
|
21738
|
+
hosts: external_exports.array(delegationRemoteHostOptionSchema)
|
|
21739
|
+
});
|
|
21740
|
+
var delegationHostHarnessesParamsSchema = external_exports.object({
|
|
21741
|
+
hostId: external_exports.union([external_exports.literal("local"), remotePeerHostIdSchema])
|
|
21742
|
+
});
|
|
21743
|
+
var delegationHostHarnessOptionSchema = external_exports.object({
|
|
21744
|
+
id: external_exports.string().regex(/^[a-z0-9][a-z0-9-]*$/u),
|
|
21745
|
+
name: external_exports.string().min(1).max(120)
|
|
21746
|
+
});
|
|
21747
|
+
var delegationHostHarnessesResultSchema = external_exports.object({
|
|
21748
|
+
harnesses: external_exports.array(delegationHostHarnessOptionSchema)
|
|
21749
|
+
});
|
|
21658
21750
|
|
|
21659
21751
|
// ../../shared-contracts/dist/peer-delegation.js
|
|
21660
21752
|
var PEER_DELEGATION_BRIDGE_VERSION = 1;
|
|
@@ -21698,6 +21790,7 @@ var peerDelegationHostProjectSchema = external_exports.strictObject({
|
|
|
21698
21790
|
});
|
|
21699
21791
|
var peerDelegationHostSummarySchema = external_exports.strictObject({
|
|
21700
21792
|
hostId: remotePeerHostIdSchema,
|
|
21793
|
+
nodeId: remotePeerNodeIdSchema.optional(),
|
|
21701
21794
|
displayName: external_exports.string().min(1).max(120),
|
|
21702
21795
|
online: external_exports.boolean(),
|
|
21703
21796
|
state: remotePeerStateSchema,
|
|
@@ -22590,6 +22683,13 @@ var updatePhaseSchema = external_exports.enum([
|
|
|
22590
22683
|
"succeeded",
|
|
22591
22684
|
"failed"
|
|
22592
22685
|
]);
|
|
22686
|
+
var npmDownloadProgressSchema = external_exports.strictObject({
|
|
22687
|
+
completed: external_exports.number().int().nonnegative(),
|
|
22688
|
+
total: external_exports.number().int().positive()
|
|
22689
|
+
}).refine((progress) => progress.completed <= progress.total, {
|
|
22690
|
+
path: ["completed"],
|
|
22691
|
+
message: "completed must not exceed total"
|
|
22692
|
+
});
|
|
22593
22693
|
var updateStatusSchema = external_exports.strictObject({
|
|
22594
22694
|
version: updateSemanticVersionSchema,
|
|
22595
22695
|
installation: updateInstallationSchema,
|
|
@@ -22597,6 +22697,7 @@ var updateStatusSchema = external_exports.strictObject({
|
|
|
22597
22697
|
updatedAt: external_exports.number().int().nonnegative(),
|
|
22598
22698
|
downloadedBytes: external_exports.number().int().nonnegative().optional(),
|
|
22599
22699
|
totalBytes: external_exports.number().int().positive().optional(),
|
|
22700
|
+
npmDownload: npmDownloadProgressSchema.optional(),
|
|
22600
22701
|
error: external_exports.string().min(1).max(UPDATE_ERROR_MAX_LENGTH).nullable(),
|
|
22601
22702
|
serviceStopOutput: external_exports.string().optional()
|
|
22602
22703
|
}).superRefine((status, context) => {
|
|
@@ -23449,6 +23550,7 @@ var harnessBrokerMethodSchema = external_exports.enum([
|
|
|
23449
23550
|
"adapter.open",
|
|
23450
23551
|
"adapter.sessionImport.list",
|
|
23451
23552
|
"adapter.sessionImport.resolve",
|
|
23553
|
+
"adapter.readSnapshot",
|
|
23452
23554
|
"adapter.subagent.readSnapshot",
|
|
23453
23555
|
"session.readSnapshot",
|
|
23454
23556
|
"session.readCapabilities",
|
|
@@ -23710,6 +23812,11 @@ var sessionExecuteParamsSchema = sessionParamsSchema.extend({
|
|
|
23710
23812
|
var sessionCommandExecuteParamsSchema = sessionParamsSchema.extend({
|
|
23711
23813
|
command: brokerCommandInvocationSchema
|
|
23712
23814
|
});
|
|
23815
|
+
var adapterReadSnapshotSchema = external_exports.object({
|
|
23816
|
+
nativeRef: nativeSessionRefSchema,
|
|
23817
|
+
cwd: cwdSchema,
|
|
23818
|
+
environment: brokerEnvironmentSchema.optional()
|
|
23819
|
+
}).strict();
|
|
23713
23820
|
var subagentReadSnapshotSchema = external_exports.object({
|
|
23714
23821
|
parent: nativeSessionRefSchema,
|
|
23715
23822
|
nativeSubagentId: external_exports.string().min(1).max(4096),
|
|
@@ -23720,6 +23827,8 @@ var harnessErrorSchema = external_exports.object({
|
|
|
23720
23827
|
"notInstalled",
|
|
23721
23828
|
"unavailable",
|
|
23722
23829
|
"authenticationRequired",
|
|
23830
|
+
"rateLimited",
|
|
23831
|
+
"quotaExhausted",
|
|
23723
23832
|
"sessionNotFound",
|
|
23724
23833
|
"sessionBusy",
|
|
23725
23834
|
"checkpointNotFound",
|
|
@@ -23733,6 +23842,7 @@ var harnessErrorSchema = external_exports.object({
|
|
|
23733
23842
|
]),
|
|
23734
23843
|
message: external_exports.string().max(65536),
|
|
23735
23844
|
retryable: external_exports.boolean(),
|
|
23845
|
+
resetsAt: external_exports.string().min(1).max(128).refine((value) => !Number.isNaN(Date.parse(value)), "resetsAt must be a valid timestamp").optional(),
|
|
23736
23846
|
diagnostic: external_exports.string().max(65536).optional(),
|
|
23737
23847
|
stage: external_exports.string().max(1024).optional(),
|
|
23738
23848
|
durationMs: external_exports.number().finite().nonnegative().optional(),
|
|
@@ -24091,6 +24201,7 @@ function parseHarnessResult(value) {
|
|
|
24091
24201
|
code: parsed.code,
|
|
24092
24202
|
message: parsed.message,
|
|
24093
24203
|
retryable: parsed.retryable,
|
|
24204
|
+
...parsed.resetsAt ? { resetsAt: parsed.resetsAt } : {},
|
|
24094
24205
|
...parsed.diagnostic ? { diagnostic: parsed.diagnostic } : {},
|
|
24095
24206
|
...parsed.stage ? { stage: parsed.stage } : {},
|
|
24096
24207
|
...parsed.durationMs !== void 0 ? { durationMs: parsed.durationMs } : {},
|
|
@@ -24600,6 +24711,17 @@ var BrokeredHarnessAdapter = class {
|
|
|
24600
24711
|
#closed = false;
|
|
24601
24712
|
#credits = null;
|
|
24602
24713
|
#creditsRefresh = null;
|
|
24714
|
+
async readSnapshot(input3) {
|
|
24715
|
+
try {
|
|
24716
|
+
return parseHarnessResult(await this.#request("adapter.readSnapshot", {
|
|
24717
|
+
nativeRef: input3.nativeRef,
|
|
24718
|
+
cwd: input3.cwd,
|
|
24719
|
+
environment: input3.environment
|
|
24720
|
+
}, true));
|
|
24721
|
+
} catch (error63) {
|
|
24722
|
+
return { ok: false, error: this.#error(error63) };
|
|
24723
|
+
}
|
|
24724
|
+
}
|
|
24603
24725
|
subagents = {
|
|
24604
24726
|
readSnapshot: async (input3) => {
|
|
24605
24727
|
try {
|
|
@@ -24886,9 +25008,8 @@ import path3 from "node:path";
|
|
|
24886
25008
|
|
|
24887
25009
|
// ../../harness-adapter/dist/usage-statistics.js
|
|
24888
25010
|
import { createReadStream } from "node:fs";
|
|
24889
|
-
import { lstat as lstat2,
|
|
25011
|
+
import { lstat as lstat2, readdir } from "node:fs/promises";
|
|
24890
25012
|
import path2 from "node:path";
|
|
24891
|
-
import { createInterface } from "node:readline";
|
|
24892
25013
|
var MAX_SESSION_ID_LENGTH = 512;
|
|
24893
25014
|
var MAX_CWD_LENGTH = 4096;
|
|
24894
25015
|
var MAX_SESSION_TITLE_LENGTH = 200;
|
|
@@ -24942,40 +25063,101 @@ function usageEntryFromRequest(request, occurredAtMs) {
|
|
|
24942
25063
|
...request.reasoningOutputTokens !== void 0 ? { reasoningOutputTokens: request.reasoningOutputTokens } : {}
|
|
24943
25064
|
};
|
|
24944
25065
|
}
|
|
25066
|
+
var JSONL_CHUNK_BYTES = 128 * 1024;
|
|
25067
|
+
var JSONL_HEADER_CHUNK_BYTES = 16 * 1024;
|
|
24945
25068
|
async function jsonlUsageSources(root, maxDepth, signal) {
|
|
24946
25069
|
const sources = [];
|
|
24947
25070
|
const visit2 = async (directory, depth) => {
|
|
24948
25071
|
signal.throwIfAborted();
|
|
24949
|
-
const entries = await
|
|
25072
|
+
const entries = await readdir(directory, { withFileTypes: true }).catch((error63) => {
|
|
24950
25073
|
if (error63.code === "ENOENT")
|
|
24951
25074
|
return null;
|
|
24952
25075
|
throw error63;
|
|
24953
25076
|
});
|
|
24954
25077
|
if (!entries)
|
|
24955
25078
|
return;
|
|
24956
|
-
|
|
24957
|
-
|
|
25079
|
+
const subdirectories = [];
|
|
25080
|
+
const files = [];
|
|
25081
|
+
for (const entry of entries) {
|
|
24958
25082
|
const file2 = path2.join(directory, entry.name);
|
|
24959
25083
|
if (entry.isDirectory()) {
|
|
24960
25084
|
if (depth < maxDepth)
|
|
24961
|
-
|
|
25085
|
+
subdirectories.push(file2);
|
|
24962
25086
|
} else if (entry.isFile() && entry.name.endsWith(".jsonl")) {
|
|
24963
|
-
|
|
24964
|
-
|
|
24965
|
-
|
|
25087
|
+
files.push(file2);
|
|
25088
|
+
}
|
|
25089
|
+
}
|
|
25090
|
+
if (files.length > 0) {
|
|
25091
|
+
const stats = await Promise.all(files.map((file2) => lstat2(file2).catch(() => null)));
|
|
25092
|
+
signal.throwIfAborted();
|
|
25093
|
+
for (let i = 0; i < files.length; i++) {
|
|
25094
|
+
const file2 = files[i];
|
|
25095
|
+
const info = stats[i];
|
|
25096
|
+
if (file2 && info?.isFile() && info.size > 0) {
|
|
25097
|
+
sources.push({
|
|
25098
|
+
id: file2,
|
|
25099
|
+
fingerprint: `${info.ino}:${info.size}:${info.mtimeMs}`
|
|
25100
|
+
});
|
|
24966
25101
|
}
|
|
24967
25102
|
}
|
|
24968
25103
|
}
|
|
25104
|
+
for (const subdirectory of subdirectories)
|
|
25105
|
+
await visit2(subdirectory, depth + 1);
|
|
24969
25106
|
};
|
|
24970
25107
|
await visit2(root, 0);
|
|
24971
25108
|
return sources;
|
|
24972
25109
|
}
|
|
25110
|
+
function concatParts(parts, total) {
|
|
25111
|
+
const [single] = parts;
|
|
25112
|
+
return single && parts.length === 1 ? single : Buffer.concat(parts, total);
|
|
25113
|
+
}
|
|
25114
|
+
async function* jsonlLineSlices(file2, signal, highWaterMark) {
|
|
25115
|
+
const stream = createReadStream(file2, { highWaterMark, signal });
|
|
25116
|
+
let parts = [];
|
|
25117
|
+
let buffered = 0;
|
|
25118
|
+
try {
|
|
25119
|
+
for await (const raw of stream) {
|
|
25120
|
+
signal.throwIfAborted();
|
|
25121
|
+
const chunk = raw;
|
|
25122
|
+
let start = 0;
|
|
25123
|
+
let end;
|
|
25124
|
+
while ((end = chunk.indexOf(10, start)) >= 0) {
|
|
25125
|
+
const lineEnd = end > start && chunk[end - 1] === 13 ? end - 1 : end;
|
|
25126
|
+
const slice = chunk.subarray(start, lineEnd);
|
|
25127
|
+
if (buffered === 0) {
|
|
25128
|
+
yield slice;
|
|
25129
|
+
} else {
|
|
25130
|
+
if (slice.length > 0) {
|
|
25131
|
+
parts.push(slice);
|
|
25132
|
+
buffered += slice.length;
|
|
25133
|
+
}
|
|
25134
|
+
const combined = concatParts(parts, buffered);
|
|
25135
|
+
parts = [];
|
|
25136
|
+
buffered = 0;
|
|
25137
|
+
yield combined.length > 0 && combined[combined.length - 1] === 13 ? combined.subarray(0, combined.length - 1) : combined;
|
|
25138
|
+
}
|
|
25139
|
+
start = end + 1;
|
|
25140
|
+
}
|
|
25141
|
+
if (start < chunk.length) {
|
|
25142
|
+
const rest = chunk.subarray(start);
|
|
25143
|
+
parts.push(rest);
|
|
25144
|
+
buffered += rest.length;
|
|
25145
|
+
}
|
|
25146
|
+
}
|
|
25147
|
+
if (buffered > 0) {
|
|
25148
|
+
const combined = concatParts(parts, buffered);
|
|
25149
|
+
yield combined.length > 0 && combined[combined.length - 1] === 13 ? combined.subarray(0, combined.length - 1) : combined;
|
|
25150
|
+
}
|
|
25151
|
+
} finally {
|
|
25152
|
+
stream.destroy();
|
|
25153
|
+
}
|
|
25154
|
+
}
|
|
24973
25155
|
async function* jsonlRecords(file2, marker, signal) {
|
|
24974
|
-
const
|
|
24975
|
-
|
|
24976
|
-
|
|
24977
|
-
|
|
24978
|
-
|
|
25156
|
+
const markerBytes = marker.length > 0 ? Buffer.from(marker, "utf8") : null;
|
|
25157
|
+
for await (const rawLine of jsonlLineSlices(file2, signal, JSONL_CHUNK_BYTES)) {
|
|
25158
|
+
if (markerBytes && !rawLine.includes(markerBytes))
|
|
25159
|
+
continue;
|
|
25160
|
+
const line = rawLine.toString("utf8");
|
|
24979
25161
|
if (!line.includes(marker))
|
|
24980
25162
|
continue;
|
|
24981
25163
|
let value;
|
|
@@ -60817,10 +60999,10 @@ function claudeUltracodeUnavailableReason(settings, environment = {}) {
|
|
|
60817
60999
|
|
|
60818
61000
|
// dist/claude-session-import.js
|
|
60819
61001
|
import { createReadStream as createReadStream3 } from "node:fs";
|
|
60820
|
-
import { opendir
|
|
61002
|
+
import { opendir, realpath as realpath3, stat as stat2 } from "node:fs/promises";
|
|
60821
61003
|
import os3 from "node:os";
|
|
60822
61004
|
import path4 from "node:path";
|
|
60823
|
-
import { createInterface as
|
|
61005
|
+
import { createInterface as createInterface2 } from "node:readline";
|
|
60824
61006
|
|
|
60825
61007
|
// ../../harness-adapter/dist/session-import.js
|
|
60826
61008
|
var SessionImportChangedError = class extends Error {
|
|
@@ -60938,7 +61120,7 @@ function claudeProjectsDirectory2(environment) {
|
|
|
60938
61120
|
}
|
|
60939
61121
|
async function sessionFiles(directory, signal) {
|
|
60940
61122
|
signal.throwIfAborted();
|
|
60941
|
-
const projects = await
|
|
61123
|
+
const projects = await opendir(directory).catch((error63) => {
|
|
60942
61124
|
if (isMissingFileError(error63))
|
|
60943
61125
|
return null;
|
|
60944
61126
|
throw error63;
|
|
@@ -60950,7 +61132,7 @@ async function sessionFiles(directory, signal) {
|
|
|
60950
61132
|
signal.throwIfAborted();
|
|
60951
61133
|
if (!project2.isDirectory())
|
|
60952
61134
|
continue;
|
|
60953
|
-
const entries = await
|
|
61135
|
+
const entries = await opendir(path4.join(directory, project2.name)).catch((error63) => {
|
|
60954
61136
|
if (isMissingFileError(error63))
|
|
60955
61137
|
return null;
|
|
60956
61138
|
throw error63;
|
|
@@ -60974,7 +61156,7 @@ async function readCandidate(file2, signal) {
|
|
|
60974
61156
|
if (!before.isFile() || before.size === 0)
|
|
60975
61157
|
return null;
|
|
60976
61158
|
const stream = createReadStream3(file2, { encoding: "utf8", signal, end: before.size - 1 });
|
|
60977
|
-
const lines =
|
|
61159
|
+
const lines = createInterface2({ input: stream, crlfDelay: Infinity });
|
|
60978
61160
|
let cwd = null;
|
|
60979
61161
|
let customTitle = null;
|
|
60980
61162
|
let generatedTitle = null;
|
|
@@ -62090,6 +62272,7 @@ var ClaudeTaskTracker = class {
|
|
|
62090
62272
|
// dist/native-message.js
|
|
62091
62273
|
var ABORTED_TERMINALS = /* @__PURE__ */ new Set(["aborted_streaming", "aborted_tools"]);
|
|
62092
62274
|
var AUTHENTICATION_ERRORS = /* @__PURE__ */ new Set(["authentication_failed", "oauth_org_not_allowed"]);
|
|
62275
|
+
var MAX_SAFE_UNIX_SECONDS = 864e10;
|
|
62093
62276
|
var CLAUDE_SUBAGENT_TOOLS = /* @__PURE__ */ new Set(["Agent", "Task", "SendMessage"]);
|
|
62094
62277
|
var CLAUDE_WORKFLOW_TOOL = "Workflow";
|
|
62095
62278
|
var BACKGROUND_OUTPUT_FILE_PATTERN = /Output is being written to: (.+?\.output)\./u;
|
|
@@ -62171,8 +62354,27 @@ function claudeSendMessageFailed(nativeResult, outputText) {
|
|
|
62171
62354
|
function includesAuthenticationFailure(errors) {
|
|
62172
62355
|
return errors.some((error63) => AUTHENTICATION_ERRORS.has(error63));
|
|
62173
62356
|
}
|
|
62174
|
-
function failure2(kind) {
|
|
62175
|
-
return {
|
|
62357
|
+
function failure2(kind, resetsAtUnix) {
|
|
62358
|
+
return {
|
|
62359
|
+
status: "failed",
|
|
62360
|
+
kind,
|
|
62361
|
+
...resetsAtUnix !== void 0 ? { resetsAtUnix } : {}
|
|
62362
|
+
};
|
|
62363
|
+
}
|
|
62364
|
+
function validResetsAtUnix(value) {
|
|
62365
|
+
return safeNonNegativeInteger(value) && value > 0 && value <= MAX_SAFE_UNIX_SECONDS ? value : void 0;
|
|
62366
|
+
}
|
|
62367
|
+
function isOverageCoveringRateLimit(info) {
|
|
62368
|
+
return info.isUsingOverage === true || info.overageInUse === true || info.overageStatus === "allowed" || info.overageStatus === "allowed_warning";
|
|
62369
|
+
}
|
|
62370
|
+
function rejectedRateLimitResetUnix(info) {
|
|
62371
|
+
const primary = validResetsAtUnix(info.resetsAt);
|
|
62372
|
+
const overage = info.overageStatus === "rejected" ? validResetsAtUnix(info.overageResetsAt) : void 0;
|
|
62373
|
+
if (info.rateLimitType === "overage")
|
|
62374
|
+
return overage ?? primary;
|
|
62375
|
+
if (primary !== void 0 && overage !== void 0)
|
|
62376
|
+
return Math.min(primary, overage);
|
|
62377
|
+
return primary ?? overage;
|
|
62176
62378
|
}
|
|
62177
62379
|
function safeNonNegativeInteger(value) {
|
|
62178
62380
|
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
@@ -62421,6 +62623,7 @@ var ClaudeNativeTurnAccumulator = class {
|
|
|
62421
62623
|
/** Native record UUIDs already published, across stream and request message IDs. */
|
|
62422
62624
|
#publishedCheckpointIds = /* @__PURE__ */ new Set();
|
|
62423
62625
|
#assistantErrors = [];
|
|
62626
|
+
#rejectedRateLimit = null;
|
|
62424
62627
|
#cancelRequested = false;
|
|
62425
62628
|
#compactionState = "idle";
|
|
62426
62629
|
#completed = false;
|
|
@@ -62430,6 +62633,8 @@ var ClaudeNativeTurnAccumulator = class {
|
|
|
62430
62633
|
#completedThinkingBlocks = /* @__PURE__ */ new Set();
|
|
62431
62634
|
#protocolConflict = false;
|
|
62432
62635
|
#textConflict = false;
|
|
62636
|
+
/** Fallback notices already published, keyed by request id (or model pair). */
|
|
62637
|
+
#fallbackNoticeKeys = /* @__PURE__ */ new Set();
|
|
62433
62638
|
#tools = /* @__PURE__ */ new Map();
|
|
62434
62639
|
constructor(options = {}) {
|
|
62435
62640
|
this.#provider = options.provider;
|
|
@@ -62458,6 +62663,7 @@ var ClaudeNativeTurnAccumulator = class {
|
|
|
62458
62663
|
if (!nested) {
|
|
62459
62664
|
this.#consumeCompaction(message, events);
|
|
62460
62665
|
this.#consumeLocalCommandOutput(message, events);
|
|
62666
|
+
this.#consumeModelFallback(message, events);
|
|
62461
62667
|
}
|
|
62462
62668
|
if (message.type === "stream_event" && isRecord9(message.event)) {
|
|
62463
62669
|
if (!nested) {
|
|
@@ -62467,6 +62673,15 @@ var ClaudeNativeTurnAccumulator = class {
|
|
|
62467
62673
|
} else if (message.type === "tool_progress") {
|
|
62468
62674
|
this.#consumeToolProgress(message, events);
|
|
62469
62675
|
}
|
|
62676
|
+
if (message.type === "rate_limit_event" && isRecord9(message.rate_limit_info)) {
|
|
62677
|
+
const info = message.rate_limit_info;
|
|
62678
|
+
if (info.status === "rejected" && !isOverageCoveringRateLimit(info)) {
|
|
62679
|
+
const resetsAtUnix = rejectedRateLimitResetUnix(info);
|
|
62680
|
+
this.#rejectedRateLimit = resetsAtUnix !== void 0 ? { resetsAtUnix } : {};
|
|
62681
|
+
} else if (info.status === "allowed" || info.status === "allowed_warning" || info.status === "rejected" && isOverageCoveringRateLimit(info)) {
|
|
62682
|
+
this.#rejectedRateLimit = null;
|
|
62683
|
+
}
|
|
62684
|
+
}
|
|
62470
62685
|
if (!nested) {
|
|
62471
62686
|
const error63 = assistantError(message);
|
|
62472
62687
|
if (error63 !== null)
|
|
@@ -62507,7 +62722,16 @@ var ClaudeNativeTurnAccumulator = class {
|
|
|
62507
62722
|
} else if (nativeSuccess) {
|
|
62508
62723
|
terminal = { status: "succeeded" };
|
|
62509
62724
|
} else {
|
|
62510
|
-
|
|
62725
|
+
const lastError = this.#assistantErrors.at(-1);
|
|
62726
|
+
if (lastError === "billing_error") {
|
|
62727
|
+
terminal = failure2("billing");
|
|
62728
|
+
} else if (this.#rejectedRateLimit !== null && (lastError === void 0 || lastError === "rate_limit")) {
|
|
62729
|
+
terminal = failure2("quotaExhausted", this.#rejectedRateLimit.resetsAtUnix);
|
|
62730
|
+
} else if (lastError === "rate_limit") {
|
|
62731
|
+
terminal = failure2("rateLimited");
|
|
62732
|
+
} else {
|
|
62733
|
+
terminal = failure2("native");
|
|
62734
|
+
}
|
|
62511
62735
|
}
|
|
62512
62736
|
return { events, terminal };
|
|
62513
62737
|
}
|
|
@@ -62539,6 +62763,34 @@ var ClaudeNativeTurnAccumulator = class {
|
|
|
62539
62763
|
this.#compactionState = "settled";
|
|
62540
62764
|
events.push({ type: "compaction.completed", outcome: "succeeded" });
|
|
62541
62765
|
}
|
|
62766
|
+
/**
|
|
62767
|
+
* Claude reports a primary-model refusal fallback (the turn retried on a
|
|
62768
|
+
* fallback model) as a `model_refusal_fallback` system push. A `session`
|
|
62769
|
+
* scope (or absent, on older CLIs) means the main thread fell back and the
|
|
62770
|
+
* session model is swapped, so the user sees one non-blocking chat notice;
|
|
62771
|
+
* a `local` scope is a subagent / side-question fallback and stays silent.
|
|
62772
|
+
*/
|
|
62773
|
+
#consumeModelFallback(message, events) {
|
|
62774
|
+
if (message.type !== "system" || message.subtype !== "model_refusal_fallback")
|
|
62775
|
+
return;
|
|
62776
|
+
if (message.scope === "local")
|
|
62777
|
+
return;
|
|
62778
|
+
if (message.direction !== void 0 && message.direction !== "retry" && message.direction !== "sticky")
|
|
62779
|
+
return;
|
|
62780
|
+
const original = typeof message.original_model === "string" ? message.original_model : "";
|
|
62781
|
+
const fallback = typeof message.fallback_model === "string" ? message.fallback_model : "";
|
|
62782
|
+
if (original.length === 0 || fallback.length === 0)
|
|
62783
|
+
return;
|
|
62784
|
+
const key = typeof message.request_id === "string" && message.request_id.length > 0 ? message.request_id : `${original}\0${fallback}`;
|
|
62785
|
+
if (this.#fallbackNoticeKeys.has(key))
|
|
62786
|
+
return;
|
|
62787
|
+
this.#fallbackNoticeKeys.add(key);
|
|
62788
|
+
const checkpointId = nativeUuid(message);
|
|
62789
|
+
const messageId = checkpointId ?? this.#nextMessageId();
|
|
62790
|
+
const delta = `Model fallback: **${original} → ${fallback}**. The session continues on the fallback model; your configured model choice is unchanged.`;
|
|
62791
|
+
events.push({ type: "text.delta", messageId, delta });
|
|
62792
|
+
events.push({ type: "message.completed", messageId, localCommand: true });
|
|
62793
|
+
}
|
|
62542
62794
|
#consumeLocalCommandOutput(message, events) {
|
|
62543
62795
|
if (message.type !== "system" || message.subtype !== "local_command_output")
|
|
62544
62796
|
return;
|
|
@@ -63956,7 +64208,7 @@ import { readFile as readFile5, rename as rename4, rm as rm5, stat as stat5, wri
|
|
|
63956
64208
|
import { createReadStream as createReadStream4 } from "node:fs";
|
|
63957
64209
|
import os6 from "node:os";
|
|
63958
64210
|
import path12 from "node:path";
|
|
63959
|
-
import { readdir as
|
|
64211
|
+
import { readdir as readdir4, stat as stat4 } from "node:fs/promises";
|
|
63960
64212
|
function projectDirectoryName(cwd) {
|
|
63961
64213
|
return cwd.replace(/[^A-Za-z0-9]/gu, "-");
|
|
63962
64214
|
}
|
|
@@ -63978,7 +64230,7 @@ async function findClaudeTranscript(input3) {
|
|
|
63978
64230
|
return expected;
|
|
63979
64231
|
let projects;
|
|
63980
64232
|
try {
|
|
63981
|
-
projects = await
|
|
64233
|
+
projects = await readdir4(projectsDirectory);
|
|
63982
64234
|
} catch {
|
|
63983
64235
|
return null;
|
|
63984
64236
|
}
|
|
@@ -67036,7 +67288,7 @@ function transcriptRequestUsage(messages, messageId) {
|
|
|
67036
67288
|
function invalidState(message) {
|
|
67037
67289
|
return { code: "invalidState", message, retryable: false };
|
|
67038
67290
|
}
|
|
67039
|
-
function transportFailure(kind) {
|
|
67291
|
+
function transportFailure(kind, resetsAtUnix) {
|
|
67040
67292
|
if (kind === "authentication") {
|
|
67041
67293
|
return {
|
|
67042
67294
|
code: "authenticationRequired",
|
|
@@ -67051,6 +67303,30 @@ function transportFailure(kind) {
|
|
|
67051
67303
|
retryable: false
|
|
67052
67304
|
};
|
|
67053
67305
|
}
|
|
67306
|
+
const resetsAt = resetsAtUnix !== void 0 && Number.isSafeInteger(resetsAtUnix) && resetsAtUnix > 0 && resetsAtUnix <= 864e10 ? isoFromUnix(resetsAtUnix) : void 0;
|
|
67307
|
+
if (kind === "rateLimited") {
|
|
67308
|
+
return {
|
|
67309
|
+
code: "rateLimited",
|
|
67310
|
+
message: resetsAt ? `Claude Code rate limit reached (resets at ${resetsAt})` : "Claude Code rate limit reached",
|
|
67311
|
+
retryable: true,
|
|
67312
|
+
...resetsAt ? { resetsAt } : {}
|
|
67313
|
+
};
|
|
67314
|
+
}
|
|
67315
|
+
if (kind === "quotaExhausted") {
|
|
67316
|
+
return {
|
|
67317
|
+
code: "quotaExhausted",
|
|
67318
|
+
message: resetsAt ? `Claude Code usage limit reached (resets at ${resetsAt})` : "Claude Code usage limit reached",
|
|
67319
|
+
retryable: true,
|
|
67320
|
+
...resetsAt ? { resetsAt } : {}
|
|
67321
|
+
};
|
|
67322
|
+
}
|
|
67323
|
+
if (kind === "billing") {
|
|
67324
|
+
return {
|
|
67325
|
+
code: "quotaExhausted",
|
|
67326
|
+
message: "Claude Code billing or credit limit reached",
|
|
67327
|
+
retryable: false
|
|
67328
|
+
};
|
|
67329
|
+
}
|
|
67054
67330
|
return {
|
|
67055
67331
|
code: "nativeFailure",
|
|
67056
67332
|
message: kind === "textConflict" ? "Claude Code returned inconsistent streamed text" : kind === "cancellationUnproven" ? "Claude Code cancellation could not be proven" : "Claude Code Turn failed",
|
|
@@ -68540,7 +68816,7 @@ var ClaudeHarnessSession = class {
|
|
|
68540
68816
|
if (event.lastRequestUsage) {
|
|
68541
68817
|
this.#requestUsageBoundary += 1;
|
|
68542
68818
|
this.#applyLatestRequestUsage(active2, event.lastRequestUsage);
|
|
68543
|
-
} else {
|
|
68819
|
+
} else if (!event.localCommand) {
|
|
68544
68820
|
this.#requestLatestRequestUsage(active2, event.messageId);
|
|
68545
68821
|
}
|
|
68546
68822
|
if (event.checkpointId)
|
|
@@ -69045,7 +69321,7 @@ var ClaudeHarnessSession = class {
|
|
|
69045
69321
|
active2.promptCacheTtlObserved = false;
|
|
69046
69322
|
if (active2.cancellation) {
|
|
69047
69323
|
if (result.status === "failed") {
|
|
69048
|
-
active2.cancellation.failure ??= transportFailure(result.kind);
|
|
69324
|
+
active2.cancellation.failure ??= transportFailure(result.kind, result.resetsAtUnix);
|
|
69049
69325
|
}
|
|
69050
69326
|
active2.cancellation.interrupting = false;
|
|
69051
69327
|
this.#clearCancelEscalation();
|
|
@@ -69063,7 +69339,7 @@ var ClaudeHarnessSession = class {
|
|
|
69063
69339
|
} else if (result.status === "cancelled") {
|
|
69064
69340
|
this.#finish(active2, { status: "cancelled", reason: result.reason });
|
|
69065
69341
|
} else {
|
|
69066
|
-
this.#finishFailed(active2, transportFailure(result.kind));
|
|
69342
|
+
this.#finishFailed(active2, transportFailure(result.kind, result.resetsAtUnix));
|
|
69067
69343
|
}
|
|
69068
69344
|
}
|
|
69069
69345
|
#requestContextUsage(transport, turnId, retryDelaysMs, detail = "full") {
|
|
@@ -69514,6 +69790,81 @@ var ClaudeCodeAdapter = class {
|
|
|
69514
69790
|
resolveCandidate: (nativeSessionId) => this.#importScope.resolve((signal) => this.#importIndex.resolve(nativeSessionId, signal))
|
|
69515
69791
|
});
|
|
69516
69792
|
usageStatistics;
|
|
69793
|
+
async readSnapshot(input3) {
|
|
69794
|
+
if (this.#closePromise) {
|
|
69795
|
+
return { ok: false, error: invalidState("Claude Code Adapter is closed") };
|
|
69796
|
+
}
|
|
69797
|
+
if (input3.nativeRef.harnessId !== this.harnessId || input3.nativeRef.nativeSessionId.trim().length === 0) {
|
|
69798
|
+
return {
|
|
69799
|
+
ok: false,
|
|
69800
|
+
error: {
|
|
69801
|
+
code: "invalidRequest",
|
|
69802
|
+
message: "Claude Code Native Session reference is invalid",
|
|
69803
|
+
retryable: false
|
|
69804
|
+
}
|
|
69805
|
+
};
|
|
69806
|
+
}
|
|
69807
|
+
let messages;
|
|
69808
|
+
try {
|
|
69809
|
+
messages = await this.#dependencies.readSessionMessages({
|
|
69810
|
+
cwd: input3.cwd,
|
|
69811
|
+
sessionId: input3.nativeRef.nativeSessionId
|
|
69812
|
+
}) ?? [];
|
|
69813
|
+
} catch {
|
|
69814
|
+
return {
|
|
69815
|
+
ok: false,
|
|
69816
|
+
error: {
|
|
69817
|
+
code: "nativeFailure",
|
|
69818
|
+
message: "Claude Code history could not be read",
|
|
69819
|
+
retryable: true
|
|
69820
|
+
}
|
|
69821
|
+
};
|
|
69822
|
+
}
|
|
69823
|
+
if (messages.length === 0 && isPendingClaudeSession(input3.nativeRef)) {
|
|
69824
|
+
try {
|
|
69825
|
+
const pending = await this.#pendingSessions.read(input3.nativeRef, input3.cwd);
|
|
69826
|
+
if (!pending.started)
|
|
69827
|
+
return { ok: true, value: { turns: [] } };
|
|
69828
|
+
} catch {
|
|
69829
|
+
return {
|
|
69830
|
+
ok: false,
|
|
69831
|
+
error: {
|
|
69832
|
+
code: "sessionNotFound",
|
|
69833
|
+
message: "Claude Code pending Session is unavailable",
|
|
69834
|
+
retryable: false
|
|
69835
|
+
}
|
|
69836
|
+
};
|
|
69837
|
+
}
|
|
69838
|
+
}
|
|
69839
|
+
if (messages.length === 0) {
|
|
69840
|
+
return {
|
|
69841
|
+
ok: false,
|
|
69842
|
+
error: {
|
|
69843
|
+
code: "sessionNotFound",
|
|
69844
|
+
message: "Claude Code Native Session is unavailable",
|
|
69845
|
+
retryable: false
|
|
69846
|
+
}
|
|
69847
|
+
};
|
|
69848
|
+
}
|
|
69849
|
+
try {
|
|
69850
|
+
return {
|
|
69851
|
+
ok: true,
|
|
69852
|
+
value: {
|
|
69853
|
+
...mapClaudeSnapshot(messages, input3.nativeRef.nativeSessionId),
|
|
69854
|
+
persistentPlan: true
|
|
69855
|
+
}
|
|
69856
|
+
};
|
|
69857
|
+
} catch {
|
|
69858
|
+
return {
|
|
69859
|
+
ok: false,
|
|
69860
|
+
error: {
|
|
69861
|
+
code: "protocolError",
|
|
69862
|
+
message: "Claude Code history is invalid",
|
|
69863
|
+
retryable: false
|
|
69864
|
+
}
|
|
69865
|
+
};
|
|
69866
|
+
}
|
|
69867
|
+
}
|
|
69517
69868
|
subagents = {
|
|
69518
69869
|
readSnapshot: async (input3) => {
|
|
69519
69870
|
if (input3.parent.harnessId !== this.harnessId || input3.nativeSubagentId.trim().length === 0) {
|