@skaile/workspaces 4.38.0 → 4.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/dist/app-sdk/index.js +1 -1
- package/dist/{asset-feeds-UYIFZKKG.js → asset-feeds-KXL45ALC.js} +4 -4
- package/dist/{asset-feeds-UYIFZKKG.js.map → asset-feeds-KXL45ALC.js.map} +1 -1
- package/dist/asset-manager/index.js +1 -1
- package/dist/bridge/drivers/claude-sdk.js +4 -4
- package/dist/bridge/drivers/codex.js +2 -2
- package/dist/bridge/drivers/continue.js +3 -3
- package/dist/bridge/drivers/echo.js +3 -3
- package/dist/bridge/drivers/gemini.js +5 -5
- package/dist/bridge/drivers/goose.js +3 -3
- package/dist/bridge/drivers/omp.js +4 -4
- package/dist/bridge/drivers/opencode.js +3 -3
- package/dist/bridge/drivers/qwen.js +5 -5
- package/dist/bridge/index.js +5 -5
- package/dist/{chunk-27DN4DZD.js → chunk-252TK4RU.js} +3 -3
- package/dist/{chunk-27DN4DZD.js.map → chunk-252TK4RU.js.map} +1 -1
- package/dist/{chunk-MS2JK4V7.js → chunk-3C3ODIDE.js} +3 -3
- package/dist/{chunk-MS2JK4V7.js.map → chunk-3C3ODIDE.js.map} +1 -1
- package/dist/{chunk-CACCIOQL.js → chunk-5LF27VUB.js} +6 -6
- package/dist/{chunk-CACCIOQL.js.map → chunk-5LF27VUB.js.map} +1 -1
- package/dist/{chunk-J5UF3OOS.js → chunk-5RWL4L3X.js} +7 -7
- package/dist/{chunk-J5UF3OOS.js.map → chunk-5RWL4L3X.js.map} +1 -1
- package/dist/{chunk-6VRZ6M2L.js → chunk-7SAWDPUT.js} +3 -3
- package/dist/{chunk-6VRZ6M2L.js.map → chunk-7SAWDPUT.js.map} +1 -1
- package/dist/{chunk-HUNZYTOS.js → chunk-B4IAZTZZ.js} +2 -2
- package/dist/chunk-B4IAZTZZ.js.map +1 -0
- package/dist/{chunk-EETXMMZS.js → chunk-BCUVRJXV.js} +3 -3
- package/dist/{chunk-EETXMMZS.js.map → chunk-BCUVRJXV.js.map} +1 -1
- package/dist/{chunk-R2U346ER.js → chunk-C75VKXAM.js} +3 -3
- package/dist/{chunk-R2U346ER.js.map → chunk-C75VKXAM.js.map} +1 -1
- package/dist/{chunk-BQ3HXZNT.js → chunk-FTPKMJFD.js} +2 -2
- package/dist/{chunk-BQ3HXZNT.js.map → chunk-FTPKMJFD.js.map} +1 -1
- package/dist/{chunk-MQ42OYKH.js → chunk-H7N6RWNF.js} +3 -3
- package/dist/{chunk-MQ42OYKH.js.map → chunk-H7N6RWNF.js.map} +1 -1
- package/dist/{chunk-YNUBJY3L.js → chunk-IDEA6CYI.js} +6 -5
- package/dist/chunk-IDEA6CYI.js.map +1 -0
- package/dist/{chunk-DV47JNI4.js → chunk-KC3OF6B2.js} +3 -3
- package/dist/{chunk-DV47JNI4.js.map → chunk-KC3OF6B2.js.map} +1 -1
- package/dist/{chunk-7UL2SQQH.js → chunk-M7GPCWEV.js} +4 -4
- package/dist/{chunk-7UL2SQQH.js.map → chunk-M7GPCWEV.js.map} +1 -1
- package/dist/{chunk-ILAZDNIA.js → chunk-NLKIW2VI.js} +3 -3
- package/dist/{chunk-ILAZDNIA.js.map → chunk-NLKIW2VI.js.map} +1 -1
- package/dist/{chunk-R5ARWJGE.js → chunk-P7BU6DAC.js} +199 -17
- package/dist/chunk-P7BU6DAC.js.map +1 -0
- package/dist/{chunk-7FZSABQV.js → chunk-QVLQGXT6.js} +4 -4
- package/dist/{chunk-7FZSABQV.js.map → chunk-QVLQGXT6.js.map} +1 -1
- package/dist/{chunk-PRCUGFXV.js → chunk-RDYI4MML.js} +3 -3
- package/dist/{chunk-PRCUGFXV.js.map → chunk-RDYI4MML.js.map} +1 -1
- package/dist/{chunk-6EMF4UZI.js → chunk-SM6EUQMY.js} +6 -6
- package/dist/{chunk-6EMF4UZI.js.map → chunk-SM6EUQMY.js.map} +1 -1
- package/dist/{chunk-LOHQTTUV.js → chunk-SSCPTAFJ.js} +3 -3
- package/dist/{chunk-LOHQTTUV.js.map → chunk-SSCPTAFJ.js.map} +1 -1
- package/dist/{chunk-QWWDDU5Z.js → chunk-TQ6XNACF.js} +2 -2
- package/dist/{chunk-QWWDDU5Z.js.map → chunk-TQ6XNACF.js.map} +1 -1
- package/dist/{chunk-6KPQDP7P.js → chunk-TSVRKUGV.js} +2 -2
- package/dist/{chunk-6KPQDP7P.js.map → chunk-TSVRKUGV.js.map} +1 -1
- package/dist/{chunk-HXG6IZSF.js → chunk-VXPFSZDT.js} +6 -6
- package/dist/{chunk-HXG6IZSF.js.map → chunk-VXPFSZDT.js.map} +1 -1
- package/dist/{chunk-4WKZEMBD.js → chunk-WCWFS36P.js} +3 -3
- package/dist/{chunk-4WKZEMBD.js.map → chunk-WCWFS36P.js.map} +1 -1
- package/dist/{chunk-YCJ3PJNB.js → chunk-X4DKUGV4.js} +3 -3
- package/dist/{chunk-YCJ3PJNB.js.map → chunk-X4DKUGV4.js.map} +1 -1
- package/dist/cli/index.js +37 -37
- package/dist/connectors/index.js +7 -7
- package/dist/connectors-shared/index.js +2 -2
- package/dist/{ensure-sources-VX63EKY7.js → ensure-sources-J5CDTQ36.js} +4 -4
- package/dist/{ensure-sources-VX63EKY7.js.map → ensure-sources-J5CDTQ36.js.map} +1 -1
- package/dist/factory-assets/connectors/box.js +7 -7
- package/dist/factory-assets/connectors/deploy.js +7 -7
- package/dist/factory-assets/connectors/devserver.js +7 -7
- package/dist/factory-assets/connectors/flow/adapter.js +7 -7
- package/dist/factory-assets/connectors/flow/run-flow.js +8 -8
- package/dist/factory-assets/connectors/flow.js +7 -7
- package/dist/factory-assets/connectors/git.js +7 -7
- package/dist/factory-assets/connectors/gmail.js +7 -7
- package/dist/factory-assets/connectors/googledrive.js +7 -7
- package/dist/factory-assets/connectors/local.js +7 -7
- package/dist/factory-assets/connectors/mattermost.js +7 -7
- package/dist/factory-assets/connectors/memory.js +7 -7
- package/dist/factory-assets/connectors/minio.js +7 -7
- package/dist/factory-assets/connectors/postgres.js +7 -7
- package/dist/factory-assets/connectors/s3.js +7 -7
- package/dist/factory-assets/connectors/sharepoint.js +7 -7
- package/dist/factory-assets/connectors/sqlite.js +7 -7
- package/dist/factory-assets/connectors/static-server.js +7 -7
- package/dist/factory-assets/connectors/tunnel.js +7 -7
- package/dist/factory-assets/connectors/webdav.js +7 -7
- package/dist/factory-assets/connectors/xstate-store.js +7 -7
- package/dist/factory-assets/connectors/xstate.js +7 -7
- package/dist/{helpers-DF55G2YC.js → helpers-EP6H3O3S.js} +4 -4
- package/dist/{helpers-DF55G2YC.js.map → helpers-EP6H3O3S.js.map} +1 -1
- package/dist/{library-publish-2PNWJJOY.js → library-publish-KKT73FJK.js} +7 -7
- package/dist/{library-publish-2PNWJJOY.js.map → library-publish-KKT73FJK.js.map} +1 -1
- package/dist/{open-library-SUVOMIWZ.js → open-library-R62UBL6E.js} +5 -5
- package/dist/{open-library-SUVOMIWZ.js.map → open-library-R62UBL6E.js.map} +1 -1
- package/dist/{project-RTLVOXUU.js → project-GCW5DFAB.js} +5 -5
- package/dist/{project-RTLVOXUU.js.map → project-GCW5DFAB.js.map} +1 -1
- package/dist/runner/index.js +11 -11
- package/dist/runner/src/resource-handler.d.ts +32 -3
- package/dist/runner/src/resource-handler.d.ts.map +1 -1
- package/dist/sdk/asset-manager.js +1 -1
- package/dist/sdk/bridge.js +5 -5
- package/dist/sdk/index.js +11 -11
- package/dist/sdk/runner.js +11 -11
- package/dist/sdk/session.js +2 -2
- package/dist/sdk/types.js +1 -1
- package/dist/secrets/index.js +1 -17
- package/dist/secrets/src/providers/local.d.ts.map +1 -1
- package/dist/session/index.js +2 -2
- package/dist/{setup-ZA7VZL72.js → setup-Q3LXY5AE.js} +10 -10
- package/dist/{setup-ZA7VZL72.js.map → setup-Q3LXY5AE.js.map} +1 -1
- package/dist/{source-Y5YQ7M53.js → source-CFQESKJU.js} +6 -6
- package/dist/{source-Y5YQ7M53.js.map → source-CFQESKJU.js.map} +1 -1
- package/dist/{source-manifest-publish-RZIJNRIW.js → source-manifest-publish-3TCBA2RV.js} +8 -8
- package/dist/{source-manifest-publish-RZIJNRIW.js.map → source-manifest-publish-3TCBA2RV.js.map} +1 -1
- package/dist/tui/index.js +11 -11
- package/dist/types/index.js +1 -1
- package/dist/types/src/events.d.ts +69 -2
- package/dist/types/src/events.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/protocol.d.ts +3 -3
- package/dist/types/src/protocol.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +27 -1
- package/dist/types/src/version.d.ts.map +1 -1
- package/dist/workspace-plugin/adapters/mcp.js +2 -2
- package/dist/workspace-plugin/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-HUNZYTOS.js.map +0 -1
- package/dist/chunk-R5ARWJGE.js.map +0 -1
- package/dist/chunk-YNUBJY3L.js.map +0 -1
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { WorkspacePlugin } from './chunk-
|
|
2
|
-
import { buildWorkspaceToolDefs } from './chunk-
|
|
1
|
+
import { WorkspacePlugin } from './chunk-FTPKMJFD.js';
|
|
2
|
+
import { buildWorkspaceToolDefs } from './chunk-X4DKUGV4.js';
|
|
3
3
|
import { findAiAssetsRoot } from './chunk-EOKAFBJ7.js';
|
|
4
4
|
import { WebSocketServerTransport } from './chunk-5LKOAX7I.js';
|
|
5
5
|
import { assembleSystemPrompt, buildCapabilitiesPromptSection } from './chunk-W3UDISS2.js';
|
|
6
6
|
import { prepareNativePolicy, codexInstanceEnvironment, parseCodexCredential, parseCodexRefreshInput, parseCodexRefreshResult } from './chunk-HCYS7GFP.js';
|
|
7
|
-
import { resolveFlowPath } from './chunk-
|
|
7
|
+
import { resolveFlowPath } from './chunk-252TK4RU.js';
|
|
8
8
|
import { findAiAssetsRoot as findAiAssetsRoot$1, deployCatalogEntry, undeployCatalogEntry } from './chunk-DOVURNRK.js';
|
|
9
|
-
import { ConnectFailureCarryOver, registerBuiltinConnectors, buildConnectorPromptSection, findMissingPackages, installNpmPackages, ConnectorManager, buildSdkConnectorTools, buildLazySdkFlowTools, describeFlowOperations, buildConnectorToolDefs, buildFlowToolDefs, SessionNodeExecutor, SessionSubpromptRunner, ClassifierSubpromptRunner, SessionInlineSubFlowRunner, driveOrchestratorTurn, buildSdkFlowTools } from './chunk-
|
|
9
|
+
import { ConnectFailureCarryOver, registerBuiltinConnectors, buildConnectorPromptSection, findMissingPackages, installNpmPackages, ConnectorManager, buildSdkConnectorTools, buildLazySdkFlowTools, describeFlowOperations, buildConnectorToolDefs, buildFlowToolDefs, SessionNodeExecutor, SessionSubpromptRunner, ClassifierSubpromptRunner, SessionInlineSubFlowRunner, driveOrchestratorTurn, buildSdkFlowTools } from './chunk-5RWL4L3X.js';
|
|
10
10
|
import { loadYamlConnectorDeclarations, withMaterializedConnectorDeclarations, SecretProviderChain, ConnectorStartupError, isKnownSecretRef, EnvSecretProvider, PreMintedSecretProvider, InMemorySecretProvider, resolvedConfigToDeclarations, deriveSingleMaterializedConnectorDeclaration } from './chunk-YQEF36D5.js';
|
|
11
|
-
import { EventNormalizer } from './chunk-
|
|
11
|
+
import { EventNormalizer } from './chunk-M7GPCWEV.js';
|
|
12
12
|
import { probeResumeTranscript, transcriptStoreForRuntime } from './chunk-5NYBY6ZE.js';
|
|
13
13
|
import { scopeReconfigureModel } from './chunk-EINLFFP6.js';
|
|
14
14
|
import { CodexNativeStateUnavailable } from './chunk-LOO5CB5M.js';
|
|
15
|
-
import { dispatchCapability } from './chunk-
|
|
15
|
+
import { dispatchCapability } from './chunk-RDYI4MML.js';
|
|
16
16
|
import { classifyClaudeSdkError } from './chunk-XBSQ4KMC.js';
|
|
17
17
|
import { agentExecRequested } from './chunk-YROR332M.js';
|
|
18
|
-
import { toAgentEffort, createDriver, catalogLayer, providerCredentialEnvName, toMergedRegistry, registryCredentialEnv, AI_PROVIDER_PRESETS, AgentDriver } from './chunk-
|
|
18
|
+
import { toAgentEffort, createDriver, catalogLayer, providerCredentialEnvName, toMergedRegistry, registryCredentialEnv, AI_PROVIDER_PRESETS, AgentDriver } from './chunk-TSVRKUGV.js';
|
|
19
19
|
import { loadFlow } from './chunk-7RC37XFW.js';
|
|
20
20
|
import { parseFlowDefinition } from './chunk-DIQDYNXZ.js';
|
|
21
21
|
import { renderStimulusPrompt } from './chunk-K3IBZ2UZ.js';
|
|
22
|
-
import { withActivityLabelJsonSchema, TOOL_ACTIVITY_PROMPT_SECTION, SESSION_ROOT_CONNECTOR_ID, PROTOCOL_VERSION } from './chunk-
|
|
22
|
+
import { withActivityLabelJsonSchema, TOOL_ACTIVITY_PROMPT_SECTION, SESSION_ROOT_CONNECTOR_ID, PROTOCOL_VERSION } from './chunk-IDEA6CYI.js';
|
|
23
23
|
import { resolveLibraryDir, resolveSettings, loadProviderRegistry } from './chunk-YV3YI3TA.js';
|
|
24
24
|
import { resolveRuntimeAssets } from './chunk-36ML6SFP.js';
|
|
25
25
|
import { resolveDriverPaths } from './chunk-K5GBV4SA.js';
|
|
@@ -32,7 +32,7 @@ import { pickRegistryEntries, registryEntries, resolveEntryBaseUrl, parseModelRe
|
|
|
32
32
|
import { getLogStore, registerLogStore, createLogger, resetLogStore, isUnwritableStreamError, markStreamBroken, isBrokenPipeError, redactCredentials } from './chunk-BOFL7GIF.js';
|
|
33
33
|
import { __require } from './chunk-NSBPE2FW.js';
|
|
34
34
|
import pc from 'picocolors';
|
|
35
|
-
import path5, { join, resolve,
|
|
35
|
+
import path5, { join, resolve, basename, dirname, relative, sep, isAbsolute } from 'path';
|
|
36
36
|
import { Marked } from 'marked';
|
|
37
37
|
import { markedTerminal } from 'marked-terminal';
|
|
38
38
|
import fs4, { readFile, readdir, lstat, stat, rm, unlink, mkdir, writeFile, realpath, rename, open, readlink, mkdtemp } from 'fs/promises';
|
|
@@ -3864,6 +3864,176 @@ async function readMountRange(targetPath, range, authoritativeSize) {
|
|
|
3864
3864
|
});
|
|
3865
3865
|
}
|
|
3866
3866
|
}
|
|
3867
|
+
var MOUNT_WRITE_MAX_CHUNK_BYTES = 8 * 1024 * 1024;
|
|
3868
|
+
var WRITE_RANGE_PARTIAL_TTL_MS = 60 * 60 * 1e3;
|
|
3869
|
+
var PARTIAL_SUFFIX = ".skaile-partial";
|
|
3870
|
+
var UPLOAD_ID_PATTERN = /^[A-Za-z0-9_-]{1,64}$/;
|
|
3871
|
+
var PARTIAL_NAME_MAX_BYTES = 120;
|
|
3872
|
+
function writeRangePartialPath(targetPath, uploadId) {
|
|
3873
|
+
const name = basename(targetPath);
|
|
3874
|
+
const stem = Buffer.byteLength(name) > PARTIAL_NAME_MAX_BYTES ? createHash("sha256").update(name).digest("hex").slice(0, 32) : name;
|
|
3875
|
+
return join(dirname(targetPath), `.${stem}.${uploadId}${PARTIAL_SUFFIX}`);
|
|
3876
|
+
}
|
|
3877
|
+
var partialLocks = /* @__PURE__ */ new Map();
|
|
3878
|
+
var transferOutcomes = /* @__PURE__ */ new Map();
|
|
3879
|
+
function recordOutcome(partialPath, outcome, size) {
|
|
3880
|
+
const now = Date.now();
|
|
3881
|
+
for (const [key, entry] of transferOutcomes) {
|
|
3882
|
+
if (now - entry.at > WRITE_RANGE_PARTIAL_TTL_MS) transferOutcomes.delete(key);
|
|
3883
|
+
}
|
|
3884
|
+
transferOutcomes.set(partialPath, { outcome, size, at: now });
|
|
3885
|
+
}
|
|
3886
|
+
async function withPartialLock(key, fn) {
|
|
3887
|
+
const previous = partialLocks.get(key) ?? Promise.resolve();
|
|
3888
|
+
const run = previous.catch(() => {
|
|
3889
|
+
}).then(fn);
|
|
3890
|
+
partialLocks.set(key, run);
|
|
3891
|
+
try {
|
|
3892
|
+
return await run;
|
|
3893
|
+
} finally {
|
|
3894
|
+
if (partialLocks.get(key) === run) partialLocks.delete(key);
|
|
3895
|
+
}
|
|
3896
|
+
}
|
|
3897
|
+
function invalidRange(message) {
|
|
3898
|
+
return new ResourceOperationError(`Invalid write range: ${message}`, "invalid_range");
|
|
3899
|
+
}
|
|
3900
|
+
function parseWriteRange(options, content) {
|
|
3901
|
+
const { uploadId, offset, size, abort } = options ?? {};
|
|
3902
|
+
if (typeof uploadId !== "string" || !UPLOAD_ID_PATTERN.test(uploadId)) {
|
|
3903
|
+
throw invalidRange("uploadId must be 1-64 letters, digits, '-' or '_'");
|
|
3904
|
+
}
|
|
3905
|
+
if (abort === true) return { uploadId, offset: 0, size: 0, abort: true, chunk: Buffer.alloc(0) };
|
|
3906
|
+
for (const [name, value] of [
|
|
3907
|
+
["offset", offset],
|
|
3908
|
+
["size", size]
|
|
3909
|
+
]) {
|
|
3910
|
+
if (!(Number.isSafeInteger(value) && value >= 0)) {
|
|
3911
|
+
throw invalidRange(`${name} must be a non-negative integer`);
|
|
3912
|
+
}
|
|
3913
|
+
}
|
|
3914
|
+
const body = typeof content === "object" && content !== null ? content : void 0;
|
|
3915
|
+
if (body?.encoding !== "binary" || typeof body.data !== "string") {
|
|
3916
|
+
throw invalidRange('the chunk must be base64 content with encoding "binary"');
|
|
3917
|
+
}
|
|
3918
|
+
if (body.data.length > Math.ceil(MOUNT_WRITE_MAX_CHUNK_BYTES / 3) * 4) {
|
|
3919
|
+
throw invalidRange(`a chunk holds at most ${MOUNT_WRITE_MAX_CHUNK_BYTES} bytes`);
|
|
3920
|
+
}
|
|
3921
|
+
const chunk = Buffer.from(body.data, "base64");
|
|
3922
|
+
if (chunk.length > MOUNT_WRITE_MAX_CHUNK_BYTES) {
|
|
3923
|
+
throw invalidRange(`a chunk holds at most ${MOUNT_WRITE_MAX_CHUNK_BYTES} bytes`);
|
|
3924
|
+
}
|
|
3925
|
+
if (offset + chunk.length > size) {
|
|
3926
|
+
throw invalidRange(
|
|
3927
|
+
`a chunk of ${chunk.length} bytes at offset ${offset} runs past the stated size of ${size}`
|
|
3928
|
+
);
|
|
3929
|
+
}
|
|
3930
|
+
if (chunk.length === 0 && offset < size) {
|
|
3931
|
+
throw invalidRange(
|
|
3932
|
+
`an empty chunk at offset ${offset} cannot complete a file of ${size} bytes`
|
|
3933
|
+
);
|
|
3934
|
+
}
|
|
3935
|
+
return { uploadId, offset, size, abort: false, chunk };
|
|
3936
|
+
}
|
|
3937
|
+
async function sweepStalePartials(targetPath, keep) {
|
|
3938
|
+
const dir = dirname(targetPath);
|
|
3939
|
+
try {
|
|
3940
|
+
const names = await withFsDeadline(`readdir ${dir}`, () => readdir(dir));
|
|
3941
|
+
const now = Date.now();
|
|
3942
|
+
for (const name of names) {
|
|
3943
|
+
if (!name.startsWith(".") || !name.endsWith(PARTIAL_SUFFIX)) continue;
|
|
3944
|
+
const abs = join(dir, name);
|
|
3945
|
+
if (abs === keep) continue;
|
|
3946
|
+
const st = await withFsDeadline(`lstat ${abs}`, () => lstat(abs));
|
|
3947
|
+
if (st.isFile() && now - st.mtimeMs > WRITE_RANGE_PARTIAL_TTL_MS) {
|
|
3948
|
+
await withFsDeadline(`unlink ${abs}`, () => unlink(abs));
|
|
3949
|
+
}
|
|
3950
|
+
}
|
|
3951
|
+
} catch {
|
|
3952
|
+
}
|
|
3953
|
+
}
|
|
3954
|
+
async function openPartial(partialPath, start) {
|
|
3955
|
+
if (start) await withFsDeadline(`rm ${partialPath}`, () => rm(partialPath, { force: true }));
|
|
3956
|
+
const flags = start ? constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | constants.O_NOFOLLOW : constants.O_RDWR | constants.O_NOFOLLOW;
|
|
3957
|
+
const opening = open(partialPath, flags);
|
|
3958
|
+
try {
|
|
3959
|
+
return await withFsDeadline(`open ${partialPath}`, () => opening);
|
|
3960
|
+
} catch (err) {
|
|
3961
|
+
void opening.then((h) => h.close()).catch(() => {
|
|
3962
|
+
});
|
|
3963
|
+
throw err;
|
|
3964
|
+
}
|
|
3965
|
+
}
|
|
3966
|
+
async function writeRangeChunk(targetPath, options, content) {
|
|
3967
|
+
const req = parseWriteRange(options, content);
|
|
3968
|
+
const partialPath = writeRangePartialPath(targetPath, req.uploadId);
|
|
3969
|
+
return withPartialLock(partialPath, async () => {
|
|
3970
|
+
const known = transferOutcomes.get(partialPath);
|
|
3971
|
+
if (req.abort) {
|
|
3972
|
+
await withFsDeadline(`rm ${partialPath}`, () => rm(partialPath, { force: true }));
|
|
3973
|
+
transferOutcomes.delete(partialPath);
|
|
3974
|
+
return { received: 0, size: 0, complete: false };
|
|
3975
|
+
}
|
|
3976
|
+
const received = req.offset + req.chunk.length;
|
|
3977
|
+
if (req.offset > 0 && known?.outcome === "done") {
|
|
3978
|
+
if (received === req.size && known.size === req.size) {
|
|
3979
|
+
return { received, size: req.size, complete: true };
|
|
3980
|
+
}
|
|
3981
|
+
throw invalidRange(`transfer "${req.uploadId}" is already complete`);
|
|
3982
|
+
}
|
|
3983
|
+
if (req.offset > 0 && known?.outcome === "stalled") {
|
|
3984
|
+
throw invalidRange(
|
|
3985
|
+
`transfer "${req.uploadId}" stalled on a slow mount; start again at offset 0`
|
|
3986
|
+
);
|
|
3987
|
+
}
|
|
3988
|
+
const parentDir = dirname(targetPath);
|
|
3989
|
+
await withFsDeadline(`mkdir ${parentDir}`, () => mkdir(parentDir, { recursive: true }));
|
|
3990
|
+
if (req.offset === 0) await sweepStalePartials(targetPath, partialPath);
|
|
3991
|
+
let fh;
|
|
3992
|
+
try {
|
|
3993
|
+
fh = await openPartial(partialPath, req.offset === 0);
|
|
3994
|
+
if (req.offset === 0) transferOutcomes.delete(partialPath);
|
|
3995
|
+
} catch (err) {
|
|
3996
|
+
const code = err.code;
|
|
3997
|
+
if (code === "ELOOP") throw invalidRange("the partial file is not a regular file");
|
|
3998
|
+
if (code !== "ENOENT" || req.offset === 0) throw err;
|
|
3999
|
+
throw invalidRange(`no transfer "${req.uploadId}" is in progress; start again at offset 0`);
|
|
4000
|
+
}
|
|
4001
|
+
try {
|
|
4002
|
+
const st = await withFsDeadline(`fstat ${partialPath}`, () => fh.stat());
|
|
4003
|
+
if (!st.isFile()) throw invalidRange("the partial file is not a regular file");
|
|
4004
|
+
if (st.size !== req.offset) {
|
|
4005
|
+
throw invalidRange(`expected offset ${st.size}, got ${req.offset}`);
|
|
4006
|
+
}
|
|
4007
|
+
await withFsDeadline(`write ${partialPath} @${req.offset}+${req.chunk.length}`, async () => {
|
|
4008
|
+
let done = 0;
|
|
4009
|
+
while (done < req.chunk.length) {
|
|
4010
|
+
const { bytesWritten } = await fh.write(
|
|
4011
|
+
req.chunk,
|
|
4012
|
+
done,
|
|
4013
|
+
req.chunk.length - done,
|
|
4014
|
+
req.offset + done
|
|
4015
|
+
);
|
|
4016
|
+
done += bytesWritten;
|
|
4017
|
+
}
|
|
4018
|
+
});
|
|
4019
|
+
} catch (err) {
|
|
4020
|
+
if (err instanceof FsDeadlineError) {
|
|
4021
|
+
void fh.close().catch(() => {
|
|
4022
|
+
});
|
|
4023
|
+
recordOutcome(partialPath, "stalled", req.size);
|
|
4024
|
+
} else {
|
|
4025
|
+
await fh.close().catch(() => {
|
|
4026
|
+
});
|
|
4027
|
+
}
|
|
4028
|
+
throw err;
|
|
4029
|
+
}
|
|
4030
|
+
await withFsDeadline(`close ${partialPath}`, () => fh.close());
|
|
4031
|
+
if (received < req.size) return { received, size: req.size, complete: false };
|
|
4032
|
+
await withFsDeadline(`rename ${partialPath}`, () => rename(partialPath, targetPath));
|
|
4033
|
+
recordOutcome(partialPath, "done", req.size);
|
|
4034
|
+
return { received, size: req.size, complete: true };
|
|
4035
|
+
});
|
|
4036
|
+
}
|
|
3867
4037
|
var MOUNT_STAT_MAX_ENTRIES = 5e4;
|
|
3868
4038
|
var MOUNT_STAT_BUDGET_MS = 1e4;
|
|
3869
4039
|
var MOUNT_STAT_CONCURRENCY = 16;
|
|
@@ -4094,6 +4264,11 @@ async function handleMountResourceRequest(command, manager, emit) {
|
|
|
4094
4264
|
data = true;
|
|
4095
4265
|
break;
|
|
4096
4266
|
}
|
|
4267
|
+
case "write_range": {
|
|
4268
|
+
if (rel === "") throw new Error("A file path is required");
|
|
4269
|
+
data = await writeRangeChunk(targetPath, options, content);
|
|
4270
|
+
break;
|
|
4271
|
+
}
|
|
4097
4272
|
case "mkdir": {
|
|
4098
4273
|
if (rel === "") throw new Error("A folder path is required");
|
|
4099
4274
|
const parentDir = dirname(targetPath);
|
|
@@ -4216,27 +4391,34 @@ async function readDanglingLink(absPath) {
|
|
|
4216
4391
|
async function handleSessionRootResourceRequest(command, rootDir, emit) {
|
|
4217
4392
|
const { requestId, connectorId, operation, path: reqPath, content } = command;
|
|
4218
4393
|
try {
|
|
4219
|
-
if (operation !== "write" && operation !== "delete") {
|
|
4394
|
+
if (operation !== "write" && operation !== "write_range" && operation !== "delete") {
|
|
4220
4395
|
throw unsupportedOperation(operation, "the session root");
|
|
4221
4396
|
}
|
|
4397
|
+
const access = operation === "delete" ? "delete" : "write";
|
|
4222
4398
|
if (!reqPath) throw new Error("A path is required for the session root");
|
|
4223
4399
|
if (isAbsolute(reqPath)) throw new Error("Absolute paths are not allowed for the session root");
|
|
4224
4400
|
const root = resolve(rootDir);
|
|
4225
4401
|
const targetPath = resolve(root, reqPath);
|
|
4226
4402
|
if (!isWithin2(root, targetPath)) throw new Error("Path traversal outside the session root");
|
|
4227
4403
|
const rel = relative(root, targetPath).split(sep).join("/");
|
|
4228
|
-
if (!isSessionRootPathAllowed(rel,
|
|
4404
|
+
if (!isSessionRootPathAllowed(rel, access)) {
|
|
4229
4405
|
throw new Error(
|
|
4230
4406
|
`Path "${rel}" is not writable in the session root \u2014 allowed: ${[...SESSION_ROOT_WRITABLE_FILES, ...SESSION_ROOT_WRITABLE_DIRS.map((d) => `${d}/**`)].join(", ")}`
|
|
4231
4407
|
);
|
|
4232
4408
|
}
|
|
4233
4409
|
const realRoot = await withFsDeadline(`realpath ${root}`, () => realpath(root));
|
|
4234
|
-
const onDisk =
|
|
4235
|
-
if (!isWithin2(realRoot,
|
|
4410
|
+
const onDisk = access === "write" ? await resolveOnDisk(targetPath) : join(await resolveOnDisk(dirname(targetPath)), basename(targetPath));
|
|
4411
|
+
if (!isWithin2(realRoot, access === "write" ? onDisk : dirname(onDisk))) {
|
|
4236
4412
|
throw new Error("Path escapes the session root through a symlink");
|
|
4237
4413
|
}
|
|
4238
4414
|
let data = true;
|
|
4239
|
-
if (operation === "
|
|
4415
|
+
if (operation === "write_range") {
|
|
4416
|
+
data = await writeRangeChunk(
|
|
4417
|
+
onDisk,
|
|
4418
|
+
command.options,
|
|
4419
|
+
content
|
|
4420
|
+
);
|
|
4421
|
+
} else if (operation === "write") {
|
|
4240
4422
|
const parentDir = dirname(onDisk);
|
|
4241
4423
|
await withFsDeadline(`mkdir ${parentDir}`, () => mkdir(parentDir, { recursive: true }));
|
|
4242
4424
|
const writeContent = typeof content === "string" ? content : content?.data ?? "";
|
|
@@ -11710,6 +11892,6 @@ function touchSession(state) {
|
|
|
11710
11892
|
return { ...state, updatedAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
11711
11893
|
}
|
|
11712
11894
|
|
|
11713
|
-
export { CLAUDE_CODE_CREDENTIALS_KEY, COMPILE_MANIFEST_FILENAME, CONNECTOR_MUTATE_NOT_READY, CapabilityRegistry, DEFAULT_CAPABILITY_CALL_TIMEOUT_MS, DEFAULT_COALESCE_MS, DEFAULT_FLOW_MUTATE_CONNECTOR_WAIT_MS, MOUNT_LIST_MAX_DEPTH, MOUNT_LIST_MAX_ENTRIES, MOUNT_READ_DEADLINE_FACTOR, MOUNT_READ_MAX_CHUNK_BYTES, MOUNT_STAT_BUDGET_MS, MOUNT_STAT_MAX_ENTRIES, MOUNT_TREE_OP_DEADLINE_FACTOR, MarkdownStreamer, PreInitRingSink, ResourceOperationError, SESSION_ROOT_WRITABLE_DIRS, SESSION_ROOT_WRITABLE_FILES, WS_AUTH_TOKEN_ENV, WS_AUTH_TOKEN_FILE_ENV, agentDefinitionExists, bootstrapCapabilityRegistry, bootstrapRunnerLogStore, buildAgentResources, buildClientCapabilityHandler, buildConnectorTokenMediator, buildContextSection, buildEnvironmentSection, buildResourcesAvailablePayload, buildStoreSnapshotReplay, builtinCapabilities, capabilityLogInstance, capabilitySignatureInputs, clearPreInitRingSink, clearSession, compileComposition, computeCapabilitySignature, computeDirectoryTotals, connectorRefreshKind, createAgentSession, createFlowConnectorReadiness, createManagedCodexSubpromptDriver, createSessionStimulusBus, defineCapability, deleteSession, dispatchResourceRequest, dispatchRunnerCapabilityInvocation, driverActiveAfterTurnEnd, emitSystemPromptComposed, ensureClaudeSettingsDisablesConnectors, ensureGitConfigInclude, executeConnectorMutate, extractClaudeAiOauthExpiresAt, flowRunDrivesTurns, flowStartNeedsDriverRestart, getPreInitRingSink, handleMountResourceRequest, handleResourceRequest, handleSessionRootResourceRequest, hasNonTerminalFlow, hostOpResumeStimulus, installPreInitRingSink, isSessionRootPathAllowed, isTerminalFlowStatus, listSessions, loadAgentManifest, loadCompileManifest, loadCompileManifestFromDir, loadManagedCodexHostConfig, loadSession, loadSessionById, mcpAuthSecretKey, newSession, nulTailPaddingLength, pickChatFlowTarget, pickFlowToolTarget, pickRepointedManager, planFlowMutate, prepareCodexTools, reconcilePendingDecisions, reconnectedRunNeedsAgentTurn, recreateKeepingLiveFlows, registerActiveFlow, registerCompositionCapabilities, rejectCapabilityOnApprovalDeny, rejectPendingCapabilityCallsOnDisconnect, resetRunnerLogStore, resolveAgentComposition, resolveAgentMixins, resolveBinding, resolveCapabilityCallTimeoutMs, resolveCapabilityResult, resolveComposition, resolveFlowMutateConnectorWaitMs, resolveMixin, restoredRunHasWorkToResume, runAgentChat, saveSession, setCurrentSession, setUpFlowConnector, startAgentServer, stimulusFromMetas, supportsLiveToolUpdates, takeRunnerWsAuthToken, toActiveFlowTarget, touchSession, validateInputResponse, writeClaudeCodeCredentialsFile };
|
|
11714
|
-
//# sourceMappingURL=chunk-
|
|
11715
|
-
//# sourceMappingURL=chunk-
|
|
11895
|
+
export { CLAUDE_CODE_CREDENTIALS_KEY, COMPILE_MANIFEST_FILENAME, CONNECTOR_MUTATE_NOT_READY, CapabilityRegistry, DEFAULT_CAPABILITY_CALL_TIMEOUT_MS, DEFAULT_COALESCE_MS, DEFAULT_FLOW_MUTATE_CONNECTOR_WAIT_MS, MOUNT_LIST_MAX_DEPTH, MOUNT_LIST_MAX_ENTRIES, MOUNT_READ_DEADLINE_FACTOR, MOUNT_READ_MAX_CHUNK_BYTES, MOUNT_STAT_BUDGET_MS, MOUNT_STAT_MAX_ENTRIES, MOUNT_TREE_OP_DEADLINE_FACTOR, MOUNT_WRITE_MAX_CHUNK_BYTES, MarkdownStreamer, PreInitRingSink, ResourceOperationError, SESSION_ROOT_WRITABLE_DIRS, SESSION_ROOT_WRITABLE_FILES, WRITE_RANGE_PARTIAL_TTL_MS, WS_AUTH_TOKEN_ENV, WS_AUTH_TOKEN_FILE_ENV, agentDefinitionExists, bootstrapCapabilityRegistry, bootstrapRunnerLogStore, buildAgentResources, buildClientCapabilityHandler, buildConnectorTokenMediator, buildContextSection, buildEnvironmentSection, buildResourcesAvailablePayload, buildStoreSnapshotReplay, builtinCapabilities, capabilityLogInstance, capabilitySignatureInputs, clearPreInitRingSink, clearSession, compileComposition, computeCapabilitySignature, computeDirectoryTotals, connectorRefreshKind, createAgentSession, createFlowConnectorReadiness, createManagedCodexSubpromptDriver, createSessionStimulusBus, defineCapability, deleteSession, dispatchResourceRequest, dispatchRunnerCapabilityInvocation, driverActiveAfterTurnEnd, emitSystemPromptComposed, ensureClaudeSettingsDisablesConnectors, ensureGitConfigInclude, executeConnectorMutate, extractClaudeAiOauthExpiresAt, flowRunDrivesTurns, flowStartNeedsDriverRestart, getPreInitRingSink, handleMountResourceRequest, handleResourceRequest, handleSessionRootResourceRequest, hasNonTerminalFlow, hostOpResumeStimulus, installPreInitRingSink, isSessionRootPathAllowed, isTerminalFlowStatus, listSessions, loadAgentManifest, loadCompileManifest, loadCompileManifestFromDir, loadManagedCodexHostConfig, loadSession, loadSessionById, mcpAuthSecretKey, newSession, nulTailPaddingLength, pickChatFlowTarget, pickFlowToolTarget, pickRepointedManager, planFlowMutate, prepareCodexTools, reconcilePendingDecisions, reconnectedRunNeedsAgentTurn, recreateKeepingLiveFlows, registerActiveFlow, registerCompositionCapabilities, rejectCapabilityOnApprovalDeny, rejectPendingCapabilityCallsOnDisconnect, resetRunnerLogStore, resolveAgentComposition, resolveAgentMixins, resolveBinding, resolveCapabilityCallTimeoutMs, resolveCapabilityResult, resolveComposition, resolveFlowMutateConnectorWaitMs, resolveMixin, restoredRunHasWorkToResume, runAgentChat, saveSession, setCurrentSession, setUpFlowConnector, startAgentServer, stimulusFromMetas, supportsLiveToolUpdates, takeRunnerWsAuthToken, toActiveFlowTarget, touchSession, validateInputResponse, writeClaudeCodeCredentialsFile, writeRangeChunk, writeRangePartialPath };
|
|
11896
|
+
//# sourceMappingURL=chunk-P7BU6DAC.js.map
|
|
11897
|
+
//# sourceMappingURL=chunk-P7BU6DAC.js.map
|