@skaile/workspaces 4.12.0 → 4.14.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 +24 -0
- package/dist/app-sdk/index.js +1 -1
- package/dist/{asset-feeds-WSKIL5GA.js → asset-feeds-ZCUKOJVN.js} +9 -8
- package/dist/asset-feeds-ZCUKOJVN.js.map +1 -0
- package/dist/asset-manager/catalog-deployer.js +5 -4
- package/dist/asset-manager/index.js +8 -7
- package/dist/asset-manager/installer.js +6 -5
- package/dist/bridge/drivers/claude-sdk.js +259 -27
- package/dist/bridge/drivers/claude-sdk.js.map +1 -1
- package/dist/bridge/drivers/codex.js +8 -7
- package/dist/bridge/drivers/codex.js.map +1 -1
- package/dist/bridge/drivers/continue.js +9 -8
- package/dist/bridge/drivers/continue.js.map +1 -1
- package/dist/bridge/drivers/echo.js +5 -4
- package/dist/bridge/drivers/echo.js.map +1 -1
- package/dist/bridge/drivers/gemini.js +7 -6
- package/dist/bridge/drivers/goose.js +9 -8
- package/dist/bridge/drivers/goose.js.map +1 -1
- package/dist/bridge/drivers/omp.js +4 -3
- package/dist/bridge/drivers/omp.js.map +1 -1
- package/dist/bridge/drivers/opencode.js +9 -8
- package/dist/bridge/drivers/opencode.js.map +1 -1
- package/dist/bridge/drivers/qwen.js +7 -6
- package/dist/bridge/drivers/qwen.js.map +1 -1
- package/dist/bridge/index.js +10 -9
- package/dist/bridge/src/drivers/claude-sdk.d.ts +25 -1
- package/dist/bridge/src/drivers/claude-sdk.d.ts.map +1 -1
- package/dist/bridge/src/mcp-tool-schema-filter.d.ts +44 -0
- package/dist/bridge/src/mcp-tool-schema-filter.d.ts.map +1 -0
- package/dist/bridge/src/normalizer.d.ts.map +1 -1
- package/dist/bridge/src/types.d.ts +8 -0
- package/dist/bridge/src/types.d.ts.map +1 -1
- package/dist/{chunk-5UPJWC3M.js → chunk-2JGXE46E.js} +7 -7
- package/dist/{chunk-5UPJWC3M.js.map → chunk-2JGXE46E.js.map} +1 -1
- package/dist/{chunk-C7R65ZTD.js → chunk-4JGTXBQB.js} +4 -4
- package/dist/{chunk-C7R65ZTD.js.map → chunk-4JGTXBQB.js.map} +1 -1
- package/dist/{chunk-TMOS6KL5.js → chunk-6GHXBCE5.js} +6 -6
- package/dist/{chunk-TMOS6KL5.js.map → chunk-6GHXBCE5.js.map} +1 -1
- package/dist/{chunk-RE2XE2AP.js → chunk-7CO3MYNN.js} +6 -6
- package/dist/chunk-7CO3MYNN.js.map +1 -0
- package/dist/{chunk-3QCLMSXU.js → chunk-7NRF7BQB.js} +4 -4
- package/dist/{chunk-3QCLMSXU.js.map → chunk-7NRF7BQB.js.map} +1 -1
- package/dist/{chunk-626UIDZT.js → chunk-A2T4WIZL.js} +3 -3
- package/dist/{chunk-626UIDZT.js.map → chunk-A2T4WIZL.js.map} +1 -1
- package/dist/{chunk-C7DPL3YA.js → chunk-BRNGJTHH.js} +3 -3
- package/dist/{chunk-C7DPL3YA.js.map → chunk-BRNGJTHH.js.map} +1 -1
- package/dist/chunk-C3CAXQMA.js +8 -0
- package/dist/chunk-C3CAXQMA.js.map +1 -0
- package/dist/{chunk-N5O6Z7HV.js → chunk-DM4KP4SC.js} +9 -9
- package/dist/{chunk-N5O6Z7HV.js.map → chunk-DM4KP4SC.js.map} +1 -1
- package/dist/{chunk-NQ3OMJFK.js → chunk-FEEAYDKF.js} +28 -10
- package/dist/chunk-FEEAYDKF.js.map +1 -0
- package/dist/{chunk-DMJ4FUEO.js → chunk-FVKSVVVP.js} +3 -3
- package/dist/{chunk-DMJ4FUEO.js.map → chunk-FVKSVVVP.js.map} +1 -1
- package/dist/{chunk-TVQPJZSO.js → chunk-IM7S4A5E.js} +2 -2
- package/dist/{chunk-TVQPJZSO.js.map → chunk-IM7S4A5E.js.map} +1 -1
- package/dist/{chunk-RUBPZLMO.js → chunk-JMKB7IB4.js} +3 -5
- package/dist/chunk-JMKB7IB4.js.map +1 -0
- package/dist/{chunk-QUSE2T4N.js → chunk-JN2TH5YB.js} +9 -9
- package/dist/chunk-JN2TH5YB.js.map +1 -0
- package/dist/{chunk-QOCH3LO7.js → chunk-L534UCEQ.js} +5 -5
- package/dist/{chunk-QOCH3LO7.js.map → chunk-L534UCEQ.js.map} +1 -1
- package/dist/{chunk-LHBWHIIT.js → chunk-LCKZCLXA.js} +2 -2
- package/dist/{chunk-LHBWHIIT.js.map → chunk-LCKZCLXA.js.map} +1 -1
- package/dist/{chunk-RQRWMKST.js → chunk-LQMALDDB.js} +2 -2
- package/dist/{chunk-RQRWMKST.js.map → chunk-LQMALDDB.js.map} +1 -1
- package/dist/{chunk-WNDDWWGU.js → chunk-NCALGSGL.js} +5 -5
- package/dist/{chunk-WNDDWWGU.js.map → chunk-NCALGSGL.js.map} +1 -1
- package/dist/{chunk-ZSB2SPV4.js → chunk-NKRAHM7T.js} +3 -3
- package/dist/{chunk-ZSB2SPV4.js.map → chunk-NKRAHM7T.js.map} +1 -1
- package/dist/{chunk-N4DHPRBS.js → chunk-NXTLDFLA.js} +3 -3
- package/dist/{chunk-N4DHPRBS.js.map → chunk-NXTLDFLA.js.map} +1 -1
- package/dist/{chunk-PCM75ICY.js → chunk-O7MVMQEU.js} +4 -4
- package/dist/{chunk-PCM75ICY.js.map → chunk-O7MVMQEU.js.map} +1 -1
- package/dist/{chunk-BVYTXIN5.js → chunk-ODP2MN2D.js} +3 -3
- package/dist/{chunk-BVYTXIN5.js.map → chunk-ODP2MN2D.js.map} +1 -1
- package/dist/{chunk-UE4AKJNQ.js → chunk-PB2Y4AMQ.js} +3 -3
- package/dist/{chunk-UE4AKJNQ.js.map → chunk-PB2Y4AMQ.js.map} +1 -1
- package/dist/{chunk-6XIIGQXL.js → chunk-PE3A6FFW.js} +3 -3
- package/dist/{chunk-6XIIGQXL.js.map → chunk-PE3A6FFW.js.map} +1 -1
- package/dist/{chunk-O64WU6WS.js → chunk-QQ3G5N7X.js} +4 -4
- package/dist/chunk-QQ3G5N7X.js.map +1 -0
- package/dist/{chunk-2J3PASYF.js → chunk-QWGSKDD7.js} +90 -6
- package/dist/chunk-QWGSKDD7.js.map +1 -0
- package/dist/{chunk-CPIAQTYM.js → chunk-TOXPRXAK.js} +3 -3
- package/dist/{chunk-CPIAQTYM.js.map → chunk-TOXPRXAK.js.map} +1 -1
- package/dist/{chunk-YZSMZK37.js → chunk-UF4AEO54.js} +3 -3
- package/dist/{chunk-YZSMZK37.js.map → chunk-UF4AEO54.js.map} +1 -1
- package/dist/{chunk-IGI6M7MS.js → chunk-UOJW2DOZ.js} +3 -3
- package/dist/{chunk-IGI6M7MS.js.map → chunk-UOJW2DOZ.js.map} +1 -1
- package/dist/{chunk-KECSNBET.js → chunk-W64ZXABT.js} +26 -19
- package/dist/chunk-W64ZXABT.js.map +1 -0
- package/dist/{chunk-7EYRYGIM.js → chunk-WQPLZUXU.js} +4 -4
- package/dist/{chunk-7EYRYGIM.js.map → chunk-WQPLZUXU.js.map} +1 -1
- package/dist/{chunk-DPKRBLYC.js → chunk-WZQWZJYL.js} +3 -3
- package/dist/{chunk-DPKRBLYC.js.map → chunk-WZQWZJYL.js.map} +1 -1
- package/dist/{chunk-RJNBMEFG.js → chunk-ZEODSOBX.js} +10 -8
- package/dist/chunk-ZEODSOBX.js.map +1 -0
- package/dist/{chunk-BYBIEHQX.js → chunk-ZISHZRG6.js} +27 -27
- package/dist/chunk-ZISHZRG6.js.map +1 -0
- package/dist/{chunk-MH4GYGOW.js → chunk-ZXPIKQAN.js} +4 -4
- package/dist/{chunk-MH4GYGOW.js.map → chunk-ZXPIKQAN.js.map} +1 -1
- package/dist/{chunk-4G6HFU27.js → chunk-ZXQMKXWR.js} +3 -3
- package/dist/{chunk-4G6HFU27.js.map → chunk-ZXQMKXWR.js.map} +1 -1
- package/dist/cli/index.js +61 -55
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/src/commands/migrate-legacy-entry.d.ts.map +1 -1
- package/dist/cli/src/commands/project.d.ts.map +1 -1
- package/dist/cli/src/store-auth.d.ts.map +1 -1
- package/dist/connectors/config.js +3 -2
- package/dist/connectors/index.js +14 -13
- package/dist/connectors-shared/index.js +2 -2
- package/dist/core/index.js +5 -4
- package/dist/core/logging.js +2 -1
- package/dist/core/runtime-assets.js +3 -2
- package/dist/core/src/index.d.ts +2 -2
- package/dist/core/src/index.d.ts.map +1 -1
- package/dist/core/src/logging/retention-value.d.ts +7 -0
- package/dist/core/src/logging/retention-value.d.ts.map +1 -0
- package/dist/core/src/logging/retention.d.ts.map +1 -1
- package/dist/core/src/workspace-config.d.ts +51 -2
- package/dist/core/src/workspace-config.d.ts.map +1 -1
- package/dist/core/workspace-config.js +2 -1
- package/dist/deploy/index.js +5 -4
- package/dist/deploy/index.js.map +1 -1
- package/dist/{ensure-sources-ZZRU74UG.js → ensure-sources-5QRNKIKQ.js} +11 -10
- package/dist/ensure-sources-5QRNKIKQ.js.map +1 -0
- package/dist/factory-assets/connectors/box.js +14 -13
- package/dist/factory-assets/connectors/deploy.js +14 -13
- package/dist/factory-assets/connectors/devserver.js +14 -13
- package/dist/factory-assets/connectors/flow/adapter.js +14 -13
- package/dist/factory-assets/connectors/flow/engine.js +6 -5
- package/dist/factory-assets/connectors/flow/run-flow.js +15 -14
- package/dist/factory-assets/connectors/flow/subprompt-runner.d.ts.map +1 -1
- package/dist/factory-assets/connectors/flow.js +14 -13
- package/dist/factory-assets/connectors/git.js +14 -13
- package/dist/factory-assets/connectors/gmail.js +14 -13
- package/dist/factory-assets/connectors/googledrive.js +14 -13
- package/dist/factory-assets/connectors/local.js +14 -13
- package/dist/factory-assets/connectors/mattermost.js +14 -13
- package/dist/factory-assets/connectors/memory.js +14 -13
- package/dist/factory-assets/connectors/minio.js +14 -13
- package/dist/factory-assets/connectors/postgres.js +14 -13
- package/dist/factory-assets/connectors/s3.js +14 -13
- package/dist/factory-assets/connectors/sharepoint.js +14 -13
- package/dist/factory-assets/connectors/sqlite.js +14 -13
- package/dist/factory-assets/connectors/static-server.js +14 -13
- package/dist/factory-assets/connectors/tunnel.js +14 -13
- package/dist/factory-assets/connectors/webdav.js +14 -13
- package/dist/factory-assets/connectors/xstate-store.js +14 -13
- package/dist/factory-assets/connectors/xstate.js +14 -13
- package/dist/{flows-XHRUNYJV.js → flows-7EB63Q2Q.js} +8 -7
- package/dist/{flows-XHRUNYJV.js.map → flows-7EB63Q2Q.js.map} +1 -1
- package/dist/{helpers-M76C6JVC.js → helpers-FNZ6J5AB.js} +11 -10
- package/dist/{helpers-M76C6JVC.js.map → helpers-FNZ6J5AB.js.map} +1 -1
- package/dist/library/index.js +6 -5
- package/dist/{library-publish-EQYEJXWO.js → library-publish-BM7X5K6K.js} +15 -14
- package/dist/library-publish-BM7X5K6K.js.map +1 -0
- package/dist/{open-library-YTP7CVVT.js → open-library-TVZI745K.js} +13 -12
- package/dist/{open-library-YTP7CVVT.js.map → open-library-TVZI745K.js.map} +1 -1
- package/dist/{paths-BG3I2LPM.js → paths-IK6Y4OIU.js} +8 -7
- package/dist/{paths-BG3I2LPM.js.map → paths-IK6Y4OIU.js.map} +1 -1
- package/dist/{plugin-store-BCNR6ZBP.js → plugin-store-LUJ4GXSO.js} +7 -6
- package/dist/plugin-store-LUJ4GXSO.js.map +1 -0
- package/dist/{project-THCZLS67.js → project-SLWRBQVB.js} +12 -11
- package/dist/{project-THCZLS67.js.map → project-SLWRBQVB.js.map} +1 -1
- package/dist/resolver/index.js +5 -4
- package/dist/run-group-engine/index.js.map +1 -1
- package/dist/run-group-engine/src/rollup.d.ts.map +1 -1
- package/dist/runner/index.js +20 -19
- package/dist/runner/src/codex-init.d.ts.map +1 -1
- package/dist/runner/src/compaction/orchestrator.d.ts.map +1 -1
- package/dist/runner/src/compaction/strategy.d.ts +8 -5
- package/dist/runner/src/compaction/strategy.d.ts.map +1 -1
- package/dist/runner/src/logging-bootstrap.d.ts +6 -1
- package/dist/runner/src/logging-bootstrap.d.ts.map +1 -1
- package/dist/sdk/asset-manager.js +8 -7
- package/dist/sdk/bridge.js +10 -9
- package/dist/sdk/core.js +5 -4
- package/dist/sdk/flow.js +6 -5
- package/dist/sdk/index.js +20 -19
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/resolver.js +5 -4
- package/dist/sdk/runner.js +20 -19
- package/dist/sdk/session.js +2 -2
- package/dist/sdk/types.js +1 -1
- package/dist/session/index.js +2 -2
- package/dist/session/src/dispatcher.d.ts +7 -1
- package/dist/session/src/dispatcher.d.ts.map +1 -1
- package/dist/{setup-QN4HKSFJ.js → setup-YTYMPCWC.js} +17 -16
- package/dist/setup-YTYMPCWC.js.map +1 -0
- package/dist/{skills-FKVBIDNM.js → skills-YB5RHUAT.js} +7 -6
- package/dist/{skills-FKVBIDNM.js.map → skills-YB5RHUAT.js.map} +1 -1
- package/dist/{source-5EAGZA6K.js → source-WPO6HH4P.js} +14 -13
- package/dist/{source-5EAGZA6K.js.map → source-WPO6HH4P.js.map} +1 -1
- package/dist/{source-manifest-publish-57SGT7Q3.js → source-manifest-publish-FNPZJFFK.js} +16 -15
- package/dist/source-manifest-publish-FNPZJFFK.js.map +1 -0
- package/dist/tui/index.js +20 -19
- package/dist/tui/index.js.map +1 -1
- package/dist/types/index.js +1 -1
- package/dist/types/src/events.d.ts +12 -0
- package/dist/types/src/events.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +8 -1
- package/dist/types/src/version.d.ts.map +1 -1
- package/dist/workspace-plugin/adapters/mcp.js +8 -7
- package/dist/workspace-plugin/adapters/omp.js +7 -7
- package/dist/workspace-plugin/adapters/omp.js.map +1 -1
- package/dist/workspace-plugin/index.js +3 -2
- package/dist/workspace-plugin/src/adapters/omp.d.ts.map +1 -1
- package/package.json +2 -1
- package/dist/asset-feeds-WSKIL5GA.js.map +0 -1
- package/dist/chunk-2J3PASYF.js.map +0 -1
- package/dist/chunk-BYBIEHQX.js.map +0 -1
- package/dist/chunk-KECSNBET.js.map +0 -1
- package/dist/chunk-NQ3OMJFK.js.map +0 -1
- package/dist/chunk-O64WU6WS.js.map +0 -1
- package/dist/chunk-QUSE2T4N.js.map +0 -1
- package/dist/chunk-RE2XE2AP.js.map +0 -1
- package/dist/chunk-RJNBMEFG.js.map +0 -1
- package/dist/chunk-RUBPZLMO.js.map +0 -1
- package/dist/ensure-sources-ZZRU74UG.js.map +0 -1
- package/dist/library-publish-EQYEJXWO.js.map +0 -1
- package/dist/plugin-store-BCNR6ZBP.js.map +0 -1
- package/dist/setup-QN4HKSFJ.js.map +0 -1
- package/dist/source-manifest-publish-57SGT7Q3.js.map +0 -1
|
@@ -1,31 +1,178 @@
|
|
|
1
1
|
import { scrubPoisonedTranscript, resolveClaudeConfigDir, claudeEndpointMode, buildClaudeEndpointEnv } from '../../chunk-4SIMGJIU.js';
|
|
2
|
-
import { dispatchCapability } from '../../chunk-
|
|
3
|
-
import { fetchProviderModels } from '../../chunk-
|
|
2
|
+
import { dispatchCapability } from '../../chunk-TOXPRXAK.js';
|
|
3
|
+
import { fetchProviderModels } from '../../chunk-ZXQMKXWR.js';
|
|
4
4
|
import { AuthError, classifyClaudeSdkError, reclassifyAuthAsAccountUnavailable, AccountUnavailableError } from '../../chunk-GAH4YRCI.js';
|
|
5
|
-
import { BUILTIN_DRIVER_CATALOG, AgentDriver, getBridgeLogger, entryCredentialValue, registryDriverConfig } from '../../chunk-
|
|
5
|
+
import { BUILTIN_DRIVER_CATALOG, AgentDriver, getBridgeLogger, entryCredentialValue, registryDriverConfig } from '../../chunk-LQMALDDB.js';
|
|
6
6
|
import '../../chunk-6E6PKKAD.js';
|
|
7
|
-
import { withActivityLabelShape } from '../../chunk-
|
|
8
|
-
import '../../chunk-
|
|
7
|
+
import { withActivityLabelShape } from '../../chunk-QQ3G5N7X.js';
|
|
8
|
+
import '../../chunk-7NRF7BQB.js';
|
|
9
9
|
import '../../chunk-4GY63JU6.js';
|
|
10
|
-
import '../../chunk-
|
|
10
|
+
import '../../chunk-NXTLDFLA.js';
|
|
11
11
|
import '../../chunk-F3HNW354.js';
|
|
12
12
|
import '../../chunk-K5GBV4SA.js';
|
|
13
13
|
import '../../chunk-QVZA2MDT.js';
|
|
14
|
-
import '../../chunk-
|
|
14
|
+
import '../../chunk-QWGSKDD7.js';
|
|
15
15
|
import '../../chunk-MENCWIHW.js';
|
|
16
16
|
import '../../chunk-P4VHQA4N.js';
|
|
17
17
|
import '../../chunk-2FBPAR2V.js';
|
|
18
18
|
import '../../chunk-GEEW6SY2.js';
|
|
19
|
-
import '../../chunk-
|
|
19
|
+
import '../../chunk-JMKB7IB4.js';
|
|
20
20
|
import '../../chunk-DPLIN2RA.js';
|
|
21
21
|
import { mergeRegistries, parseModelRef, isEntryEnabled, resolveEntryBaseUrl } from '../../chunk-GZZPKAV5.js';
|
|
22
|
-
import '../../chunk-
|
|
22
|
+
import '../../chunk-C3CAXQMA.js';
|
|
23
|
+
import { createLogger } from '../../chunk-BOFL7GIF.js';
|
|
23
24
|
import '../../chunk-N7B3LZ7V.js';
|
|
24
25
|
import '../../chunk-NSBPE2FW.js';
|
|
25
26
|
import { spawnSync, spawn } from 'child_process';
|
|
26
27
|
import { readFileSync, existsSync } from 'fs';
|
|
27
28
|
import { createRequire } from 'module';
|
|
28
29
|
import * as zNS from 'zod';
|
|
30
|
+
import { InMemoryTransport } from '@modelcontextprotocol/sdk/inMemory.js';
|
|
31
|
+
import { Ajv2020 } from 'ajv/dist/2020.js';
|
|
32
|
+
|
|
33
|
+
var TOOL_PROPERTY_KEY_PATTERN = /^[a-zA-Z0-9_.-]{1,64}$/;
|
|
34
|
+
var DRAFT_2020_12_META = "https://json-schema.org/draft/2020-12/schema";
|
|
35
|
+
var PROBE_TIMEOUT_MS = 5e3;
|
|
36
|
+
var metaValidator = null;
|
|
37
|
+
function draft202012MetaValidator() {
|
|
38
|
+
if (metaValidator) return metaValidator;
|
|
39
|
+
const ajv = new Ajv2020({ strict: false, validateFormats: false, logger: false });
|
|
40
|
+
const validate = ajv.getSchema(DRAFT_2020_12_META);
|
|
41
|
+
if (!validate) throw new Error("ajv draft 2020-12 meta-schema is unavailable");
|
|
42
|
+
metaValidator = validate;
|
|
43
|
+
return validate;
|
|
44
|
+
}
|
|
45
|
+
function checkToolPropertyKeys(schema) {
|
|
46
|
+
if (!schema || typeof schema !== "object" || Array.isArray(schema)) return null;
|
|
47
|
+
const props = schema.properties;
|
|
48
|
+
if (!props || typeof props !== "object" || Array.isArray(props)) return null;
|
|
49
|
+
for (const key of Object.keys(props)) {
|
|
50
|
+
if (!TOOL_PROPERTY_KEY_PATTERN.test(key)) {
|
|
51
|
+
return `property key ${JSON.stringify(key)} does not match ${TOOL_PROPERTY_KEY_PATTERN.source}`;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
function checkToolInputSchema(schema) {
|
|
57
|
+
if (!schema || typeof schema !== "object" || Array.isArray(schema)) {
|
|
58
|
+
return "input schema is not a JSON object";
|
|
59
|
+
}
|
|
60
|
+
const keyReason = checkToolPropertyKeys(schema);
|
|
61
|
+
if (keyReason) return keyReason;
|
|
62
|
+
const validate = draft202012MetaValidator();
|
|
63
|
+
if (!validate(schema)) {
|
|
64
|
+
const first = validate.errors?.[0];
|
|
65
|
+
const where = first?.instancePath || "/";
|
|
66
|
+
return `not valid JSON Schema draft 2020-12: ${where} ${first?.message ?? "is invalid"}`;
|
|
67
|
+
}
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
var filteredInstances = /* @__PURE__ */ new WeakMap();
|
|
71
|
+
function sdkInstanceOf(config) {
|
|
72
|
+
if (!config || typeof config !== "object") return null;
|
|
73
|
+
const c = config;
|
|
74
|
+
if (c.type !== "sdk" || !c.instance || typeof c.instance !== "object") return null;
|
|
75
|
+
const inst = c.instance;
|
|
76
|
+
return typeof inst.connect === "function" && typeof inst.close === "function" ? inst : null;
|
|
77
|
+
}
|
|
78
|
+
function withTimeout(p, what) {
|
|
79
|
+
let timer;
|
|
80
|
+
const timeout = new Promise((_, reject) => {
|
|
81
|
+
timer = setTimeout(() => reject(new Error(`${what} timed out`)), PROBE_TIMEOUT_MS);
|
|
82
|
+
});
|
|
83
|
+
return Promise.race([p, timeout]).finally(() => clearTimeout(timer));
|
|
84
|
+
}
|
|
85
|
+
async function listInProcessTools(instance) {
|
|
86
|
+
const [clientSide, serverSide] = InMemoryTransport.createLinkedPair();
|
|
87
|
+
const pending = /* @__PURE__ */ new Map();
|
|
88
|
+
clientSide.onmessage = (msg) => {
|
|
89
|
+
const m = msg;
|
|
90
|
+
const id = typeof m.id === "number" ? m.id : void 0;
|
|
91
|
+
if (id === void 0) return;
|
|
92
|
+
pending.get(id)?.(m);
|
|
93
|
+
pending.delete(id);
|
|
94
|
+
};
|
|
95
|
+
let nextId = 1;
|
|
96
|
+
const call = (method, params) => withTimeout(
|
|
97
|
+
new Promise((resolve, reject) => {
|
|
98
|
+
const id = nextId++;
|
|
99
|
+
pending.set(id, resolve);
|
|
100
|
+
clientSide.send({ jsonrpc: "2.0", id, method, params }).catch(reject);
|
|
101
|
+
}),
|
|
102
|
+
method
|
|
103
|
+
).then((res) => {
|
|
104
|
+
if (res.error) throw new Error(`${method} failed: ${JSON.stringify(res.error)}`);
|
|
105
|
+
return res.result ?? {};
|
|
106
|
+
});
|
|
107
|
+
await clientSide.start();
|
|
108
|
+
await instance.connect(serverSide);
|
|
109
|
+
try {
|
|
110
|
+
await call("initialize", {
|
|
111
|
+
protocolVersion: "2025-06-18",
|
|
112
|
+
capabilities: {},
|
|
113
|
+
clientInfo: { name: "skaile-tool-schema-filter", version: "1.0.0" }
|
|
114
|
+
});
|
|
115
|
+
await clientSide.send({ jsonrpc: "2.0", method: "notifications/initialized" });
|
|
116
|
+
const tools = [];
|
|
117
|
+
let cursor;
|
|
118
|
+
do {
|
|
119
|
+
const page = await call("tools/list", cursor ? { cursor } : {});
|
|
120
|
+
tools.push(...page.tools ?? []);
|
|
121
|
+
cursor = typeof page.nextCursor === "string" ? page.nextCursor : void 0;
|
|
122
|
+
} while (cursor);
|
|
123
|
+
return tools;
|
|
124
|
+
} finally {
|
|
125
|
+
await instance.close().catch(() => {
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
var defaultLog = createLogger({ kind: "mcp", subkind: "tool-schema-filter" });
|
|
130
|
+
async function filterInProcessMcpServerTools(server, config, log = defaultLog) {
|
|
131
|
+
const instance = sdkInstanceOf(config);
|
|
132
|
+
if (!instance) return [];
|
|
133
|
+
const cached = filteredInstances.get(instance);
|
|
134
|
+
if (cached) return cached;
|
|
135
|
+
const registered = instance._registeredTools;
|
|
136
|
+
if (!registered || Object.keys(registered).length === 0) return [];
|
|
137
|
+
if (instance.isConnected?.()) {
|
|
138
|
+
log.debug("in-process MCP server already connected; schema check skipped", { server });
|
|
139
|
+
return [];
|
|
140
|
+
}
|
|
141
|
+
let wireTools;
|
|
142
|
+
try {
|
|
143
|
+
wireTools = await listInProcessTools(instance);
|
|
144
|
+
} catch (err) {
|
|
145
|
+
log.warn("could not inspect in-process MCP server tools; passing it unchanged", {
|
|
146
|
+
server,
|
|
147
|
+
error: err instanceof Error ? err.message : String(err)
|
|
148
|
+
});
|
|
149
|
+
return [];
|
|
150
|
+
}
|
|
151
|
+
const dropped = [];
|
|
152
|
+
for (const tool of wireTools) {
|
|
153
|
+
const reason = checkToolInputSchema(tool.inputSchema);
|
|
154
|
+
if (!reason) continue;
|
|
155
|
+
const handle = registered[tool.name];
|
|
156
|
+
if (typeof handle?.disable !== "function") {
|
|
157
|
+
log.warn("MCP tool has an invalid input schema but cannot be disabled", {
|
|
158
|
+
server,
|
|
159
|
+
tool: tool.name,
|
|
160
|
+
reason
|
|
161
|
+
});
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
handle.disable();
|
|
165
|
+
dropped.push({ server, tool: tool.name, reason });
|
|
166
|
+
log.warn("MCP tool dropped: invalid input schema", { server, tool: tool.name, reason });
|
|
167
|
+
}
|
|
168
|
+
filteredInstances.set(instance, dropped);
|
|
169
|
+
return dropped;
|
|
170
|
+
}
|
|
171
|
+
function formatDroppedToolsNotice(dropped) {
|
|
172
|
+
if (dropped.length === 0) return null;
|
|
173
|
+
const items = dropped.map((d) => `${d.tool} (server ${d.server}: ${d.reason})`).join("; ");
|
|
174
|
+
return `Some MCP tools were not loaded because the Claude API would reject their input schema: ${items}. Do not try to call them.`;
|
|
175
|
+
}
|
|
29
176
|
|
|
30
177
|
// bridge/src/drivers/sanitize-assistant-text.ts
|
|
31
178
|
var NS = "(?:[a-z][a-z0-9]*:)?";
|
|
@@ -306,6 +453,8 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
306
453
|
supportsInBandAbort: true
|
|
307
454
|
};
|
|
308
455
|
log = getBridgeLogger("claude-sdk");
|
|
456
|
+
/** `kind: mcp` logger for tool-schema drops, alongside the runner's MCP rows. */
|
|
457
|
+
mcpLog = createLogger({ kind: "mcp", subkind: "tool-schema-filter" });
|
|
309
458
|
config;
|
|
310
459
|
abortController = null;
|
|
311
460
|
running = false;
|
|
@@ -522,6 +671,8 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
522
671
|
* upstream auth-shaped failures get a quota-aware hint when warranted.
|
|
523
672
|
*/
|
|
524
673
|
usingOauthCredential = false;
|
|
674
|
+
/** Capability tools already warned about, so a per-turn rebuild logs each once. */
|
|
675
|
+
warnedDroppedCapabilityTools = /* @__PURE__ */ new Set();
|
|
525
676
|
/**
|
|
526
677
|
* @param config - Driver configuration. Claude SDK-relevant fields:
|
|
527
678
|
* - `cwd` — working directory; SDK session files and agent definitions are read from here.
|
|
@@ -1264,10 +1415,16 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
1264
1415
|
this.usingOauthCredential = endpoint.mode === "anthropic" && !endpoint.credential;
|
|
1265
1416
|
const claudePath = this.findClaudeBinary();
|
|
1266
1417
|
const onStderr = (data) => this.log.warn("claude stderr", { line: data.trim() });
|
|
1418
|
+
const { patch: mcpServersPatch, dropped: droppedMcpTools } = await this.buildEffectiveMcpServers();
|
|
1419
|
+
const systemPromptAppend = [this.config.systemPrompt, formatDroppedToolsNotice(droppedMcpTools)].filter((part) => !!part).join("\n\n");
|
|
1267
1420
|
const options = {
|
|
1268
1421
|
cwd: this.config.cwd,
|
|
1269
1422
|
// Load project + user settings so .claude/skills/ are discovered
|
|
1270
1423
|
settingSources: ["user", "project"],
|
|
1424
|
+
// MCP servers come only from the runner (`mcpServers` below). Without
|
|
1425
|
+
// this the CLI also loads the workspace repo's `.mcp.json` unprompted,
|
|
1426
|
+
// which bypasses the runner's approval flow and the schema filter.
|
|
1427
|
+
strictMcpConfig: true,
|
|
1271
1428
|
// Use full Claude Code tool preset so skills, agents, etc. work
|
|
1272
1429
|
tools: { type: "preset", preset: "claude_code" },
|
|
1273
1430
|
permissionMode: "bypassPermissions",
|
|
@@ -1319,7 +1476,7 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
1319
1476
|
systemPrompt: {
|
|
1320
1477
|
type: "preset",
|
|
1321
1478
|
preset: "claude_code",
|
|
1322
|
-
...
|
|
1479
|
+
...systemPromptAppend ? { append: systemPromptAppend } : {}
|
|
1323
1480
|
},
|
|
1324
1481
|
// ── Session continuity ────────────────────────────────────────────────
|
|
1325
1482
|
// Three-level fallback ensures the right session is always resumed:
|
|
@@ -1340,7 +1497,7 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
1340
1497
|
// calls into that server route back through `hooks.invoke()` so the
|
|
1341
1498
|
// registry's per-handler logger fires and fire-and-forget / render
|
|
1342
1499
|
// semantics apply uniformly.
|
|
1343
|
-
...
|
|
1500
|
+
...mcpServersPatch,
|
|
1344
1501
|
// ── Main-agent handoff ────────────────────────────────────────────────
|
|
1345
1502
|
// agentName (from AgentConfig) is the equivalent of `claude --agent <name>`.
|
|
1346
1503
|
// The SDK reads .claude/agents/<agentName>.md from the cwd; that file was
|
|
@@ -1468,40 +1625,81 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
1468
1625
|
*
|
|
1469
1626
|
* Returns an empty options patch when neither source is configured, so legacy
|
|
1470
1627
|
* v1 sessions remain unaffected.
|
|
1628
|
+
*
|
|
1629
|
+
* Tools the Claude API would reject are removed on the way out and
|
|
1630
|
+
* reported in `dropped`, so one bad tool cannot fail every turn when the
|
|
1631
|
+
* CLI's own flag-gated filter is off: `config.mcpServers` entries get the
|
|
1632
|
+
* wire probe, and `skaile-capabilities` gets the key rule while it is built
|
|
1633
|
+
* (see {@link buildCapabilityMcpServer}).
|
|
1471
1634
|
*/
|
|
1472
1635
|
async buildEffectiveMcpServers() {
|
|
1473
1636
|
const out = {};
|
|
1637
|
+
const dropped = [];
|
|
1474
1638
|
if (this.config.mcpServers) {
|
|
1475
1639
|
Object.assign(out, this.config.mcpServers);
|
|
1476
1640
|
}
|
|
1477
1641
|
const hooks = this.config.capabilities;
|
|
1478
1642
|
if (hooks) {
|
|
1479
|
-
const
|
|
1480
|
-
|
|
1481
|
-
|
|
1643
|
+
const cap = await this.buildCapabilityMcpServer();
|
|
1644
|
+
dropped.push(...cap.dropped);
|
|
1645
|
+
if (cap.server) {
|
|
1646
|
+
out["skaile-capabilities"] = cap.server;
|
|
1482
1647
|
}
|
|
1483
1648
|
}
|
|
1484
|
-
|
|
1649
|
+
if (this.config.mcpServers) {
|
|
1650
|
+
const results = await Promise.all(
|
|
1651
|
+
Object.entries(this.config.mcpServers).map(
|
|
1652
|
+
([name, config]) => filterInProcessMcpServerTools(name, config, this.mcpLog)
|
|
1653
|
+
)
|
|
1654
|
+
);
|
|
1655
|
+
for (const r of results) dropped.push(...r);
|
|
1656
|
+
}
|
|
1657
|
+
return {
|
|
1658
|
+
patch: Object.keys(out).length > 0 ? { mcpServers: out } : {},
|
|
1659
|
+
dropped
|
|
1660
|
+
};
|
|
1485
1661
|
}
|
|
1486
1662
|
/**
|
|
1487
1663
|
* Build the synthetic MCP server that exposes registered capabilities to the
|
|
1488
1664
|
* Claude Agent SDK. Lazy-imports `createSdkMcpServer` from the SDK and `zod`
|
|
1489
1665
|
* (an SDK peer) since both are optional peers of this bridge.
|
|
1490
1666
|
*
|
|
1491
|
-
*
|
|
1667
|
+
* `server` is null when the SDK or zod is unavailable, or when the registry
|
|
1492
1668
|
* exposes no tools — leaving the legacy `mcpServers` untouched.
|
|
1669
|
+
*
|
|
1670
|
+
* A tool whose declared schema has a property key the API rejects
|
|
1671
|
+
* ({@link checkToolPropertyKeys}) is left out and reported in `dropped`.
|
|
1672
|
+
* Only the key rule applies here: `jsonSchemaToZodLoose` copies keys
|
|
1673
|
+
* verbatim but flattens every other construct to string/number/boolean/
|
|
1674
|
+
* array/record/any, so the wire schema is always valid draft 2020-12 and
|
|
1675
|
+
* a declared-schema meta check would drop tools that work.
|
|
1493
1676
|
*/
|
|
1494
1677
|
async buildCapabilityMcpServer() {
|
|
1678
|
+
const dropped = [];
|
|
1495
1679
|
const hooks = this.config.capabilities;
|
|
1496
|
-
if (!hooks) return null;
|
|
1497
|
-
const tools = hooks.composeTools()
|
|
1498
|
-
|
|
1680
|
+
if (!hooks) return { server: null, dropped };
|
|
1681
|
+
const tools = hooks.composeTools().filter((tool) => {
|
|
1682
|
+
const reason = checkToolPropertyKeys(tool.parameters);
|
|
1683
|
+
if (!reason) return true;
|
|
1684
|
+
dropped.push({ server: "skaile-capabilities", tool: tool.name, reason });
|
|
1685
|
+
const key = `${tool.name}\0${reason}`;
|
|
1686
|
+
if (!this.warnedDroppedCapabilityTools.has(key)) {
|
|
1687
|
+
this.warnedDroppedCapabilityTools.add(key);
|
|
1688
|
+
this.mcpLog.warn("MCP tool dropped: invalid input schema", {
|
|
1689
|
+
server: "skaile-capabilities",
|
|
1690
|
+
tool: tool.name,
|
|
1691
|
+
reason
|
|
1692
|
+
});
|
|
1693
|
+
}
|
|
1694
|
+
return false;
|
|
1695
|
+
});
|
|
1696
|
+
if (tools.length === 0) return { server: null, dropped };
|
|
1499
1697
|
let sdk;
|
|
1500
1698
|
try {
|
|
1501
1699
|
sdk = await import('@anthropic-ai/claude-agent-sdk');
|
|
1502
1700
|
} catch {
|
|
1503
1701
|
this.log.warn("claude-agent-sdk unavailable; cannot build capability MCP server");
|
|
1504
|
-
return null;
|
|
1702
|
+
return { server: null, dropped };
|
|
1505
1703
|
}
|
|
1506
1704
|
const z2 = zStatic;
|
|
1507
1705
|
const sdkTools = tools.map((tool) => ({
|
|
@@ -1541,7 +1739,10 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
1541
1739
|
}
|
|
1542
1740
|
}
|
|
1543
1741
|
}));
|
|
1544
|
-
return
|
|
1742
|
+
return {
|
|
1743
|
+
server: sdk.createSdkMcpServer({ name: "skaile-capabilities", tools: sdkTools }),
|
|
1744
|
+
dropped
|
|
1745
|
+
};
|
|
1545
1746
|
}
|
|
1546
1747
|
/** Fetch and cache slash commands from the SDK query. */
|
|
1547
1748
|
async fetchSlashCommands() {
|
|
@@ -1933,10 +2134,12 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
1933
2134
|
handleAssistantMessage(msg) {
|
|
1934
2135
|
this.captureAssistantContext(msg);
|
|
1935
2136
|
const agentMsg = this.mapAssistantMessage(msg);
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
2137
|
+
if (msg.parent_tool_use_id) {
|
|
2138
|
+
this.emitSubagentAssistantMessage(agentMsg, msg.parent_tool_use_id);
|
|
2139
|
+
return;
|
|
1939
2140
|
}
|
|
2141
|
+
const apiErrorKind = msg.error;
|
|
2142
|
+
this.lastApiErrorRender = typeof apiErrorKind === "string" ? { kind: apiErrorKind, excerpt: apiErrorExcerpt(this.assistantTextOf(agentMsg)) } : null;
|
|
1940
2143
|
if (this.isSuppressibleAuthRender(agentMsg)) {
|
|
1941
2144
|
this.log.info("suppressing SDK auth-error assistant text; self-heal will retry");
|
|
1942
2145
|
this.stashSuppressedAuthRender(this.assistantTextOf(agentMsg));
|
|
@@ -1963,6 +2166,31 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
1963
2166
|
this.suppressedAuthRenderText = null;
|
|
1964
2167
|
this.emit("agent-event", { type: "message_end", message: agentMsg });
|
|
1965
2168
|
}
|
|
2169
|
+
/**
|
|
2170
|
+
* A subagent runs concurrently with the main reply, so its messages must not
|
|
2171
|
+
* touch the main thread's stream state (the reset below would cut the main
|
|
2172
|
+
* reply's sanitizer and auth-render tracking mid-stream). Its tool calls are
|
|
2173
|
+
* still reported, tagged so consumers can tell them from the main thread's.
|
|
2174
|
+
*/
|
|
2175
|
+
emitSubagentAssistantMessage(agentMsg, parentToolUseId) {
|
|
2176
|
+
if (this.isSuppressibleAuthRender(agentMsg)) {
|
|
2177
|
+
this.log.info("suppressing SDK auth-error subagent text; self-heal will retry");
|
|
2178
|
+
this.stashSuppressedAuthRender(this.assistantTextOf(agentMsg));
|
|
2179
|
+
return;
|
|
2180
|
+
}
|
|
2181
|
+
this.emit("agent-event", { type: "message_start", message: agentMsg });
|
|
2182
|
+
for (const tc of agentMsg.toolCalls ?? []) {
|
|
2183
|
+
this.emit("agent-event", {
|
|
2184
|
+
type: "tool_call",
|
|
2185
|
+
name: tc.name,
|
|
2186
|
+
tool: { name: tc.name },
|
|
2187
|
+
toolCallId: tc.id,
|
|
2188
|
+
input: tc.input,
|
|
2189
|
+
parentToolUseId
|
|
2190
|
+
});
|
|
2191
|
+
}
|
|
2192
|
+
this.emit("agent-event", { type: "message_end", message: agentMsg });
|
|
2193
|
+
}
|
|
1966
2194
|
// True when this assistant text is the SDK's render of a 401 about to be self-healed.
|
|
1967
2195
|
isSuppressibleAuthRender(msg) {
|
|
1968
2196
|
if (msg.toolCalls && msg.toolCalls.length > 0) return false;
|
|
@@ -2011,6 +2239,7 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
2011
2239
|
return classifyClaudeSdkError({ errors: [text], oauthCredential: this.usingOauthCredential }).category === "auth";
|
|
2012
2240
|
}
|
|
2013
2241
|
handleStreamEvent(msg) {
|
|
2242
|
+
if (msg.parent_tool_use_id) return;
|
|
2014
2243
|
const event = msg.event;
|
|
2015
2244
|
if (event?.type === "content_block_delta" && event.delta?.type === "text_delta" && event.delta.text) {
|
|
2016
2245
|
const delta = event.delta.text;
|
|
@@ -2043,7 +2272,8 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
2043
2272
|
for (const result of toolResults) {
|
|
2044
2273
|
this.emit("agent-event", {
|
|
2045
2274
|
type: "tool_execution_end",
|
|
2046
|
-
toolName: result.toolName
|
|
2275
|
+
toolName: result.toolName,
|
|
2276
|
+
...result.parentToolUseId ? { parentToolUseId: result.parentToolUseId } : {}
|
|
2047
2277
|
});
|
|
2048
2278
|
}
|
|
2049
2279
|
if (toolResults.length > 0) {
|
|
@@ -2273,7 +2503,8 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
2273
2503
|
return {
|
|
2274
2504
|
role: "assistant",
|
|
2275
2505
|
content: contentBlocks,
|
|
2276
|
-
toolCalls: toolCalls.length > 0 ? toolCalls : void 0
|
|
2506
|
+
toolCalls: toolCalls.length > 0 ? toolCalls : void 0,
|
|
2507
|
+
...msg.parent_tool_use_id ? { parentToolUseId: msg.parent_tool_use_id } : {}
|
|
2277
2508
|
};
|
|
2278
2509
|
}
|
|
2279
2510
|
mapToolResults(msg) {
|
|
@@ -2286,7 +2517,8 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
2286
2517
|
role: "tool",
|
|
2287
2518
|
content: typeof block.content === "string" ? block.content : JSON.stringify(block.content),
|
|
2288
2519
|
toolName: this.toolIdToName.get(block.tool_use_id) ?? block.tool_use_id,
|
|
2289
|
-
isError: block.is_error
|
|
2520
|
+
isError: block.is_error,
|
|
2521
|
+
...msg.parent_tool_use_id ? { parentToolUseId: msg.parent_tool_use_id } : {}
|
|
2290
2522
|
});
|
|
2291
2523
|
}
|
|
2292
2524
|
}
|