@skaile/workspaces 0.37.0 → 0.38.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 +17 -0
- package/dist/asset-manager/index.js +1 -1
- package/dist/{chunk-ZSFWJAFD.js → chunk-A26MZ2GW.js} +3 -3
- package/dist/{chunk-ZSFWJAFD.js.map → chunk-A26MZ2GW.js.map} +1 -1
- package/dist/{chunk-3HR6IN5B.js → chunk-DQLRTCA2.js} +4 -4
- package/dist/{chunk-3HR6IN5B.js.map → chunk-DQLRTCA2.js.map} +1 -1
- package/dist/{chunk-CCQ3EMJT.js → chunk-GL3MUJ5L.js} +2 -2
- package/dist/{chunk-CCQ3EMJT.js.map → chunk-GL3MUJ5L.js.map} +1 -1
- package/dist/{chunk-RNFNWOKZ.js → chunk-KM6IWBDN.js} +2 -2
- package/dist/{chunk-RNFNWOKZ.js.map → chunk-KM6IWBDN.js.map} +1 -1
- package/dist/{chunk-DAEYSPOC.js → chunk-OW32SQU3.js} +100 -32
- package/dist/chunk-OW32SQU3.js.map +1 -0
- package/dist/{chunk-XT6AZWK3.js → chunk-P7CIT445.js} +18 -2
- package/dist/chunk-P7CIT445.js.map +1 -0
- package/dist/{chunk-CC5ZHSHJ.js → chunk-WLWHOA3S.js} +81 -5
- package/dist/chunk-WLWHOA3S.js.map +1 -0
- package/dist/cli/index.js +7 -7
- package/dist/connectors/config.js +1 -1
- package/dist/connectors/index.js +3 -3
- package/dist/connectors/rclone.js +1 -1
- package/dist/connectors/src/config.d.ts +3 -1
- package/dist/connectors/src/config.d.ts.map +1 -1
- package/dist/connectors/src/index.d.ts +1 -0
- package/dist/connectors/src/index.d.ts.map +1 -1
- package/dist/connectors/src/materialized-connectors.d.ts +8 -0
- package/dist/connectors/src/materialized-connectors.d.ts.map +1 -0
- package/dist/connectors/src/rclone-process-manager.d.ts.map +1 -1
- package/dist/factory-assets/connectors/deploy.js +3 -3
- package/dist/factory-assets/connectors/devserver.js +3 -3
- package/dist/factory-assets/connectors/flow/adapter.js +3 -3
- package/dist/factory-assets/connectors/flow/run-flow.js +4 -4
- package/dist/factory-assets/connectors/flow.js +3 -3
- package/dist/factory-assets/connectors/git.js +3 -3
- package/dist/factory-assets/connectors/gmail.js +3 -3
- package/dist/factory-assets/connectors/googledrive.js +3 -3
- package/dist/factory-assets/connectors/local.js +3 -3
- package/dist/factory-assets/connectors/mattermost.js +3 -3
- package/dist/factory-assets/connectors/memory.js +3 -3
- package/dist/factory-assets/connectors/minio.js +3 -3
- package/dist/factory-assets/connectors/postgres.js +3 -3
- package/dist/factory-assets/connectors/s3.js +3 -3
- package/dist/factory-assets/connectors/sharepoint.js +3 -3
- package/dist/factory-assets/connectors/sqlite.js +3 -3
- package/dist/factory-assets/connectors/static-server.js +3 -3
- package/dist/factory-assets/connectors/tunnel.js +3 -3
- package/dist/factory-assets/connectors/webdav.js +3 -3
- package/dist/factory-assets/connectors/xstate-store.js +3 -3
- package/dist/factory-assets/connectors/xstate.js +3 -3
- package/dist/runner/index.js +5 -5
- package/dist/runner/src/serve.d.ts.map +1 -1
- package/dist/runner/src/session-resource-handlers.d.ts +22 -12
- package/dist/runner/src/session-resource-handlers.d.ts.map +1 -1
- package/dist/sdk/asset-manager.js +1 -1
- package/dist/sdk/index.js +5 -5
- package/dist/sdk/runner.js +5 -5
- package/dist/tui/index.js +5 -5
- package/dist/workspace-plugin/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-CC5ZHSHJ.js.map +0 -1
- package/dist/chunk-DAEYSPOC.js.map +0 -1
- package/dist/chunk-XT6AZWK3.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WorkspacePlugin } from './chunk-
|
|
1
|
+
import { WorkspacePlugin } from './chunk-GL3MUJ5L.js';
|
|
2
2
|
import { WebSocketServerTransport } from './chunk-WQ7DE5UC.js';
|
|
3
3
|
import { assembleSystemPrompt, buildCapabilitiesPromptSection } from './chunk-W3UDISS2.js';
|
|
4
4
|
import { PROTOCOL_VERSION } from './chunk-TDSRLMDB.js';
|
|
@@ -6,8 +6,8 @@ import { EventNormalizer } from './chunk-5IXCNMMU.js';
|
|
|
6
6
|
import { classifyClaudeSdkError } from './chunk-GAH4YRCI.js';
|
|
7
7
|
import { createDriver } from './chunk-KM6DCR7A.js';
|
|
8
8
|
import { deployCatalogEntry, undeployCatalogEntry } from './chunk-LV2HPH3C.js';
|
|
9
|
-
import { registerBuiltinConnectors, buildConnectorPromptSection, findMissingPackages, installNpmPackages, ConnectorManager, ConnectorStartupError, buildSdkConnectorTools } from './chunk-
|
|
10
|
-
import { loadConnectorDeclarations, SecretProviderChain, PreMintedSecretProvider, InMemorySecretProvider } from './chunk-
|
|
9
|
+
import { registerBuiltinConnectors, buildConnectorPromptSection, findMissingPackages, installNpmPackages, ConnectorManager, ConnectorStartupError, buildSdkConnectorTools } from './chunk-DQLRTCA2.js';
|
|
10
|
+
import { loadConnectorDeclarations, SecretProviderChain, PreMintedSecretProvider, InMemorySecretProvider, deriveSingleMaterializedConnectorDeclaration } from './chunk-WLWHOA3S.js';
|
|
11
11
|
import { renderStimulusPrompt, buildOrchestratorPrompt } from './chunk-DEYYRFQU.js';
|
|
12
12
|
import { resolveSettings, resolveApiKey, providerEnvKey } from './chunk-FBIQ4QPF.js';
|
|
13
13
|
import { resolveRuntimeAssets } from './chunk-CFCSDZYF.js';
|
|
@@ -19,7 +19,7 @@ import { __require } from './chunk-NSBPE2FW.js';
|
|
|
19
19
|
import pc from 'picocolors';
|
|
20
20
|
import { Marked } from 'marked';
|
|
21
21
|
import { markedTerminal } from 'marked-terminal';
|
|
22
|
-
import { readdirSync, existsSync, readFileSync, unlinkSync, mkdirSync, writeFileSync, statSync, watch, openSync, readSync, closeSync } from 'fs';
|
|
22
|
+
import { readdirSync, existsSync, readFileSync, unlinkSync, mkdirSync, writeFileSync, statSync, watch, chmodSync, openSync, readSync, closeSync } from 'fs';
|
|
23
23
|
import path4, { join, resolve, relative, sep, isAbsolute, dirname, basename } from 'path';
|
|
24
24
|
import { homedir } from 'os';
|
|
25
25
|
import * as z5 from 'zod';
|
|
@@ -2949,8 +2949,16 @@ function buildLifecycleHandler(deps) {
|
|
|
2949
2949
|
return { ok: true };
|
|
2950
2950
|
};
|
|
2951
2951
|
}
|
|
2952
|
-
|
|
2953
|
-
|
|
2952
|
+
function readResolvedConnectorSecret(instancePath, id) {
|
|
2953
|
+
if (!existsSync(instancePath)) return void 0;
|
|
2954
|
+
try {
|
|
2955
|
+
const parsed = JSON.parse(readFileSync(instancePath, "utf8"));
|
|
2956
|
+
const value = parsed.resolvedSecrets?.[`connector:${id}`];
|
|
2957
|
+
return typeof value === "string" ? value : void 0;
|
|
2958
|
+
} catch {
|
|
2959
|
+
return void 0;
|
|
2960
|
+
}
|
|
2961
|
+
}
|
|
2954
2962
|
function asDeclaration(declaration) {
|
|
2955
2963
|
if (declaration !== null && typeof declaration === "object" && typeof declaration.id === "string" && typeof declaration.driver === "string") {
|
|
2956
2964
|
return declaration;
|
|
@@ -2961,7 +2969,7 @@ function toPreMinted(token) {
|
|
|
2961
2969
|
return { ok: true, token: token.token, expiresAt: token.expiresAt ?? null };
|
|
2962
2970
|
}
|
|
2963
2971
|
function buildSessionResourceHandlers(deps) {
|
|
2964
|
-
const { getResourceManager, getPreMintedSecrets, emitResourcesAvailable, log } = deps;
|
|
2972
|
+
const { getResourceManager, getPreMintedSecrets, emitResourcesAvailable, log, getProjectDir } = deps;
|
|
2965
2973
|
async function add(kind, input) {
|
|
2966
2974
|
const rm = getResourceManager();
|
|
2967
2975
|
if (!rm) return { ok: false, code: "no_session", message: "session resources not ready" };
|
|
@@ -2975,6 +2983,9 @@ function buildSessionResourceHandlers(deps) {
|
|
|
2975
2983
|
try {
|
|
2976
2984
|
await rm.connect(decl);
|
|
2977
2985
|
} catch (err) {
|
|
2986
|
+
if (input.preMintedToken) {
|
|
2987
|
+
getPreMintedSecrets()?.unset(kind, decl.id);
|
|
2988
|
+
}
|
|
2978
2989
|
const message = err instanceof Error ? err.message : String(err);
|
|
2979
2990
|
log(`[session-resource] runner.add_${kind} failed for ${decl.id}: ${message}`);
|
|
2980
2991
|
return { ok: false, code: "connect_failed", message };
|
|
@@ -2983,9 +2994,52 @@ function buildSessionResourceHandlers(deps) {
|
|
|
2983
2994
|
log(`[session-resource] runner.add_${kind} connected ${decl.id}`);
|
|
2984
2995
|
return { ok: true, id: decl.id };
|
|
2985
2996
|
}
|
|
2997
|
+
async function attachConnectorInstance(name) {
|
|
2998
|
+
if (!name) {
|
|
2999
|
+
return { ok: false, code: "invalid_input", message: "name is required" };
|
|
3000
|
+
}
|
|
3001
|
+
if (name.includes("/") || name.includes("\\") || name.includes("..")) {
|
|
3002
|
+
return {
|
|
3003
|
+
ok: false,
|
|
3004
|
+
code: "invalid_input",
|
|
3005
|
+
message: "name must not contain path separators or traversal segments"
|
|
3006
|
+
};
|
|
3007
|
+
}
|
|
3008
|
+
const projectDir = getProjectDir?.();
|
|
3009
|
+
if (!projectDir) {
|
|
3010
|
+
return { ok: false, code: "no_project_dir", message: "getProjectDir not configured" };
|
|
3011
|
+
}
|
|
3012
|
+
const root = join(projectDir, ".skaile/assets/connector");
|
|
3013
|
+
const decl = deriveSingleMaterializedConnectorDeclaration(root, name);
|
|
3014
|
+
if (!decl) {
|
|
3015
|
+
return {
|
|
3016
|
+
ok: false,
|
|
3017
|
+
code: "not_materialized",
|
|
3018
|
+
message: `no materialized connector at ${join(root, name)}`
|
|
3019
|
+
};
|
|
3020
|
+
}
|
|
3021
|
+
const rm = getResourceManager();
|
|
3022
|
+
if (!rm) return { ok: false, code: "no_session", message: "session resources not ready" };
|
|
3023
|
+
const token = readResolvedConnectorSecret(join(root, name, ".instance.json"), decl.id);
|
|
3024
|
+
if (token !== void 0) {
|
|
3025
|
+
getPreMintedSecrets()?.set("connector", decl.id, { ok: true, token, expiresAt: null });
|
|
3026
|
+
}
|
|
3027
|
+
try {
|
|
3028
|
+
await rm.connect(decl);
|
|
3029
|
+
} catch (err) {
|
|
3030
|
+
getPreMintedSecrets()?.unset("connector", decl.id);
|
|
3031
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
3032
|
+
log(`[session-resource] runner.attach_instance connector failed for ${decl.id}: ${message}`);
|
|
3033
|
+
return { ok: false, code: "connector_connect_failed", message };
|
|
3034
|
+
}
|
|
3035
|
+
emitResourcesAvailable();
|
|
3036
|
+
log(`[session-resource] runner.attach_instance connected connector ${decl.id}`);
|
|
3037
|
+
return { ok: true, id: decl.id, live: true, toolCount: 0 };
|
|
3038
|
+
}
|
|
2986
3039
|
return {
|
|
2987
3040
|
addConnector: (input) => add("connector", input),
|
|
2988
3041
|
addMount: (input) => add("mount", input),
|
|
3042
|
+
attachConnectorInstance,
|
|
2989
3043
|
removeResource: async (input) => {
|
|
2990
3044
|
const rm = getResourceManager();
|
|
2991
3045
|
if (!rm) return { ok: false, code: "no_session", message: "session resources not ready" };
|
|
@@ -4226,11 +4280,15 @@ async function startAgentServer(opts) {
|
|
|
4226
4280
|
}
|
|
4227
4281
|
const fleetHealthDir = join(opts.projectDir, ".skaile", "fleet-health");
|
|
4228
4282
|
try {
|
|
4229
|
-
mkdirSync(fleetHealthDir, { recursive: true });
|
|
4283
|
+
mkdirSync(fleetHealthDir, { recursive: true, mode: 1528 });
|
|
4284
|
+
chmodSync(fleetHealthDir, 1528);
|
|
4230
4285
|
} catch (err) {
|
|
4231
|
-
serverLog.warn(
|
|
4232
|
-
|
|
4233
|
-
|
|
4286
|
+
serverLog.warn(
|
|
4287
|
+
"failed to pre-create/chmod fleet-health dir \u2014 platform health signal may be degraded",
|
|
4288
|
+
{
|
|
4289
|
+
error: err instanceof Error ? err.message : String(err)
|
|
4290
|
+
}
|
|
4291
|
+
);
|
|
4234
4292
|
}
|
|
4235
4293
|
let fleetHealthWatcher = null;
|
|
4236
4294
|
try {
|
|
@@ -4360,26 +4418,36 @@ async function startAgentServer(opts) {
|
|
|
4360
4418
|
emitResourcesAvailable();
|
|
4361
4419
|
agentSession.startWatching();
|
|
4362
4420
|
capabilityRegistry.setRemoteInvoker(remoteCapabilityInvoker);
|
|
4421
|
+
const { attachConnectorInstance, ...resourceCaps } = buildSessionResourceHandlers({
|
|
4422
|
+
getResourceManager: () => resourceManager,
|
|
4423
|
+
getPreMintedSecrets: () => preMintedSecrets,
|
|
4424
|
+
emitResourcesAvailable,
|
|
4425
|
+
log,
|
|
4426
|
+
getProjectDir: () => opts.projectDir
|
|
4427
|
+
});
|
|
4428
|
+
const mcpHandlers = buildMcpRuntimeHandlers({
|
|
4429
|
+
getOrCreateMcpManager: () => agentSession?.getOrCreateExternalMcpManager() ?? null,
|
|
4430
|
+
getPreMintedSecrets: () => preMintedSecrets ?? null,
|
|
4431
|
+
driverPicksUpToolsLive,
|
|
4432
|
+
emitResourcesAvailable,
|
|
4433
|
+
log,
|
|
4434
|
+
getProjectDir: () => opts.projectDir
|
|
4435
|
+
});
|
|
4363
4436
|
const runnerCaps = buildRunnerCapabilities({
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
//
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
driverPicksUpToolsLive,
|
|
4379
|
-
emitResourcesAvailable,
|
|
4380
|
-
log,
|
|
4381
|
-
getProjectDir: () => opts.projectDir
|
|
4382
|
-
}),
|
|
4437
|
+
...resourceCaps,
|
|
4438
|
+
...mcpHandlers,
|
|
4439
|
+
// attach_instance routes by kind: connectors take the materialize-then-
|
|
4440
|
+
// connect path; everything else stays on the MCP attach path.
|
|
4441
|
+
attachInstance: async (input) => {
|
|
4442
|
+
if (input.kind === "connector") {
|
|
4443
|
+
return attachConnectorInstance(input.name);
|
|
4444
|
+
}
|
|
4445
|
+
return mcpHandlers.attachInstance ? mcpHandlers.attachInstance(input) : {
|
|
4446
|
+
ok: false,
|
|
4447
|
+
code: "not_implemented",
|
|
4448
|
+
message: "attach_instance handler not configured"
|
|
4449
|
+
};
|
|
4450
|
+
},
|
|
4383
4451
|
// setLogLevel left undefined (the cap self-falls-back to getLogStore);
|
|
4384
4452
|
// setState remains a stub (not resource hot-plug).
|
|
4385
4453
|
lifecycle: buildLifecycleHandler({
|
|
@@ -5272,5 +5340,5 @@ function touchSession(state) {
|
|
|
5272
5340
|
}
|
|
5273
5341
|
|
|
5274
5342
|
export { CLAUDE_CODE_CREDENTIALS_KEY, COMPILE_MANIFEST_FILENAME, CapabilityRegistry, DEFAULT_CAPABILITY_CALL_TIMEOUT_MS, DEFAULT_COALESCE_MS, MarkdownStreamer, PreInitRingSink, agentDefinitionExists, bootstrapCapabilityRegistry, bootstrapRunnerLogStore, buildAgentResources, buildClientCapabilityHandler, buildContextSection, buildEnvironmentSection, buildResourcesAvailablePayload, builtinCapabilities, clearPreInitRingSink, clearSession, compileComposition, computeCapabilitySignature, createAgentSession, createSessionStimulusBus, defineCapability, deleteSession, dispatchRunnerCapabilityInvocation, emitSystemPromptComposed, ensureGitConfigInclude, extractClaudeAiOauthExpiresAt, getPreInitRingSink, handleMountResourceRequest, handleResourceRequest, installPreInitRingSink, listSessions, loadAgentManifest, loadCompileManifest, loadCompileManifestFromDir, loadSession, loadSessionById, mcpAuthSecretKey, newSession, registerCompositionCapabilities, rejectCapabilityOnApprovalDeny, resetRunnerLogStore, resolveAgentComposition, resolveAgentMixins, resolveBinding, resolveCapabilityCallTimeoutMs, resolveCapabilityResult, resolveComposition, resolveMixin, runAgentChat, saveSession, setCurrentSession, startAgentServer, touchSession, writeClaudeCodeCredentialsFile };
|
|
5275
|
-
//# sourceMappingURL=chunk-
|
|
5276
|
-
//# sourceMappingURL=chunk-
|
|
5343
|
+
//# sourceMappingURL=chunk-OW32SQU3.js.map
|
|
5344
|
+
//# sourceMappingURL=chunk-OW32SQU3.js.map
|