@skaile/workspaces 4.32.1 → 4.33.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 +14 -0
- package/dist/app-sdk/index.js +1 -1
- package/dist/{asset-feeds-TOJQTJYS.js → asset-feeds-CZGV7GCG.js} +4 -4
- package/dist/{asset-feeds-TOJQTJYS.js.map → asset-feeds-CZGV7GCG.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-EOX3QH74.js → chunk-3C6Q6TCZ.js} +286 -22
- package/dist/chunk-3C6Q6TCZ.js.map +1 -0
- package/dist/{chunk-MNA22VPT.js → chunk-4T25XCWX.js} +4 -4
- package/dist/{chunk-MNA22VPT.js.map → chunk-4T25XCWX.js.map} +1 -1
- package/dist/{chunk-CYESHAXV.js → chunk-6J4WBP3C.js} +6 -6
- package/dist/{chunk-CYESHAXV.js.map → chunk-6J4WBP3C.js.map} +1 -1
- package/dist/{chunk-3GMRVUDA.js → chunk-A7WRTOFI.js} +4 -4
- package/dist/{chunk-3GMRVUDA.js.map → chunk-A7WRTOFI.js.map} +1 -1
- package/dist/{chunk-E2IZD74W.js → chunk-AAPFZCQX.js} +3 -3
- package/dist/{chunk-E2IZD74W.js.map → chunk-AAPFZCQX.js.map} +1 -1
- package/dist/{chunk-223FKFTC.js → chunk-ACDHNOT7.js} +106 -34
- package/dist/chunk-ACDHNOT7.js.map +1 -0
- package/dist/{chunk-IXGNQP7Z.js → chunk-C4JDLXPI.js} +3 -3
- package/dist/{chunk-IXGNQP7Z.js.map → chunk-C4JDLXPI.js.map} +1 -1
- package/dist/{chunk-3DZGPJU5.js → chunk-DRAI3JH5.js} +3 -3
- package/dist/{chunk-3DZGPJU5.js.map → chunk-DRAI3JH5.js.map} +1 -1
- package/dist/{chunk-ZRE4N6ZA.js → chunk-ENUCD5MW.js} +3 -3
- package/dist/{chunk-ZRE4N6ZA.js.map → chunk-ENUCD5MW.js.map} +1 -1
- package/dist/{chunk-IT7ZHRCK.js → chunk-GTVQUHBN.js} +6 -6
- package/dist/{chunk-IT7ZHRCK.js.map → chunk-GTVQUHBN.js.map} +1 -1
- package/dist/{chunk-G3N2ZCOJ.js → chunk-HXC5VF3L.js} +2 -2
- package/dist/{chunk-G3N2ZCOJ.js.map → chunk-HXC5VF3L.js.map} +1 -1
- package/dist/{chunk-OS4SXZTQ.js → chunk-I6NZG7WX.js} +3 -3
- package/dist/{chunk-OS4SXZTQ.js.map → chunk-I6NZG7WX.js.map} +1 -1
- package/dist/{chunk-34ZVTPDV.js → chunk-JS7DCCDA.js} +4 -4
- package/dist/{chunk-34ZVTPDV.js.map → chunk-JS7DCCDA.js.map} +1 -1
- package/dist/{chunk-TGLCW25T.js → chunk-N3AH66VX.js} +3 -3
- package/dist/{chunk-TGLCW25T.js.map → chunk-N3AH66VX.js.map} +1 -1
- package/dist/{chunk-U2I2BRCP.js → chunk-NPS765HV.js} +6 -6
- package/dist/{chunk-U2I2BRCP.js.map → chunk-NPS765HV.js.map} +1 -1
- package/dist/{chunk-BU53MUL5.js → chunk-QDRQKQOU.js} +3 -3
- package/dist/{chunk-BU53MUL5.js.map → chunk-QDRQKQOU.js.map} +1 -1
- package/dist/{chunk-JYWEWJ46.js → chunk-SK36WO2Z.js} +2 -2
- package/dist/{chunk-JYWEWJ46.js.map → chunk-SK36WO2Z.js.map} +1 -1
- package/dist/{chunk-MVSF6AB4.js → chunk-TAZMDZFP.js} +2 -2
- package/dist/{chunk-MVSF6AB4.js.map → chunk-TAZMDZFP.js.map} +1 -1
- package/dist/{chunk-XVGB3K4B.js → chunk-UWJAJP6T.js} +3 -3
- package/dist/{chunk-XVGB3K4B.js.map → chunk-UWJAJP6T.js.map} +1 -1
- package/dist/{chunk-NJVXDRQY.js → chunk-XUVQSDNV.js} +3 -3
- package/dist/{chunk-NJVXDRQY.js.map → chunk-XUVQSDNV.js.map} +1 -1
- package/dist/{chunk-UNUQGYCW.js → chunk-Z2QI42YH.js} +3 -3
- package/dist/{chunk-UNUQGYCW.js.map → chunk-Z2QI42YH.js.map} +1 -1
- package/dist/{chunk-DMNYWLED.js → chunk-ZWTCXL3H.js} +3 -3
- package/dist/{chunk-DMNYWLED.js.map → chunk-ZWTCXL3H.js.map} +1 -1
- package/dist/cli/index.js +35 -35
- package/dist/connectors/index.js +7 -7
- package/dist/connectors/src/watcher.d.ts +27 -0
- package/dist/connectors/src/watcher.d.ts.map +1 -1
- package/dist/connectors-shared/index.js +2 -2
- package/dist/{ensure-sources-UJBLBTXI.js → ensure-sources-JGKHWDC4.js} +4 -4
- package/dist/{ensure-sources-UJBLBTXI.js.map → ensure-sources-JGKHWDC4.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-QSRBM6LP.js → helpers-6X4HJKWS.js} +4 -4
- package/dist/{helpers-QSRBM6LP.js.map → helpers-6X4HJKWS.js.map} +1 -1
- package/dist/{library-publish-JTS2PA2P.js → library-publish-MGN3N73A.js} +6 -6
- package/dist/{library-publish-JTS2PA2P.js.map → library-publish-MGN3N73A.js.map} +1 -1
- package/dist/{open-library-PIUYBOZI.js → open-library-4PFE2CJ7.js} +5 -5
- package/dist/{open-library-PIUYBOZI.js.map → open-library-4PFE2CJ7.js.map} +1 -1
- package/dist/{project-Y2BU3TSB.js → project-MD4HQ62C.js} +5 -5
- package/dist/{project-Y2BU3TSB.js.map → project-MD4HQ62C.js.map} +1 -1
- package/dist/runner/index.js +11 -11
- package/dist/runner/src/external-mcp.d.ts +10 -0
- package/dist/runner/src/external-mcp.d.ts.map +1 -1
- package/dist/runner/src/lifecycle-handler.d.ts.map +1 -1
- package/dist/runner/src/logging-bootstrap.d.ts +5 -0
- package/dist/runner/src/logging-bootstrap.d.ts.map +1 -1
- package/dist/runner/src/resources.d.ts.map +1 -1
- package/dist/runner/src/runner-capabilities.d.ts +2 -0
- package/dist/runner/src/runner-capabilities.d.ts.map +1 -1
- package/dist/runner/src/serve.d.ts.map +1 -1
- package/dist/runner/src/stall-watchdog.d.ts +53 -0
- package/dist/runner/src/stall-watchdog.d.ts.map +1 -0
- 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/session/index.js +2 -2
- package/dist/{setup-VY5L44XZ.js → setup-PB35G5SG.js} +10 -10
- package/dist/{setup-VY5L44XZ.js.map → setup-PB35G5SG.js.map} +1 -1
- package/dist/{source-CKD4YPK4.js → source-Y5OF6IZU.js} +6 -6
- package/dist/{source-CKD4YPK4.js.map → source-Y5OF6IZU.js.map} +1 -1
- package/dist/{source-manifest-publish-KTSEBNHY.js → source-manifest-publish-YWFVYTEI.js} +7 -7
- package/dist/{source-manifest-publish-KTSEBNHY.js.map → source-manifest-publish-YWFVYTEI.js.map} +1 -1
- package/dist/tui/index.js +11 -11
- package/dist/types/index.js +1 -1
- package/dist/types/src/version.d.ts +10 -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-223FKFTC.js.map +0 -1
- package/dist/chunk-EOX3QH74.js.map +0 -1
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { WorkspacePlugin } from './chunk-
|
|
2
|
-
import { buildWorkspaceToolDefs } from './chunk-
|
|
1
|
+
import { WorkspacePlugin } from './chunk-SK36WO2Z.js';
|
|
2
|
+
import { buildWorkspaceToolDefs } from './chunk-QDRQKQOU.js';
|
|
3
3
|
import { findAiAssetsRoot } from './chunk-7IH3RKKK.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-I6NZG7WX.js';
|
|
8
8
|
import { findAiAssetsRoot as findAiAssetsRoot$1, deployCatalogEntry, undeployCatalogEntry } from './chunk-Q6NDQ6BH.js';
|
|
9
|
-
import { registerBuiltinConnectors, buildConnectorPromptSection, findMissingPackages, installNpmPackages, ConnectorManager, buildSdkConnectorTools, buildLazySdkFlowTools, describeFlowOperations, buildConnectorToolDefs, buildFlowToolDefs, SessionNodeExecutor, SessionSubpromptRunner, ClassifierSubpromptRunner, SessionInlineSubFlowRunner, driveOrchestratorTurn, buildSdkFlowTools } from './chunk-
|
|
10
|
-
import { loadYamlConnectorDeclarations, withMaterializedConnectorDeclarations, SecretProviderChain, ConnectorStartupError, EnvSecretProvider, PreMintedSecretProvider, InMemorySecretProvider, resolvedConfigToDeclarations,
|
|
11
|
-
import { EventNormalizer } from './chunk-
|
|
9
|
+
import { registerBuiltinConnectors, buildConnectorPromptSection, findMissingPackages, installNpmPackages, ConnectorManager, buildSdkConnectorTools, buildLazySdkFlowTools, describeFlowOperations, buildConnectorToolDefs, buildFlowToolDefs, SessionNodeExecutor, SessionSubpromptRunner, ClassifierSubpromptRunner, SessionInlineSubFlowRunner, driveOrchestratorTurn, buildSdkFlowTools } from './chunk-ACDHNOT7.js';
|
|
10
|
+
import { loadYamlConnectorDeclarations, withMaterializedConnectorDeclarations, SecretProviderChain, ConnectorStartupError, isKnownSecretRef, EnvSecretProvider, PreMintedSecretProvider, InMemorySecretProvider, resolvedConfigToDeclarations, deriveSingleMaterializedConnectorDeclaration } from './chunk-2JANXYTJ.js';
|
|
11
|
+
import { EventNormalizer } from './chunk-4T25XCWX.js';
|
|
12
12
|
import { probeResumeTranscript, transcriptStoreForRuntime } from './chunk-LX3FKVLL.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-UWJAJP6T.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-TAZMDZFP.js';
|
|
19
19
|
import { loadFlow } from './chunk-JULFGNQN.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-JS7DCCDA.js';
|
|
23
23
|
import { resolveSettings, loadProviderRegistry } from './chunk-WPISSDEI.js';
|
|
24
24
|
import { resolveRuntimeAssets } from './chunk-5RHPNNWP.js';
|
|
25
25
|
import { resolveDriverPaths } from './chunk-K5GBV4SA.js';
|
|
@@ -52,6 +52,7 @@ import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js';
|
|
|
52
52
|
import { getDefaultEnvironment, StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
|
|
53
53
|
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
54
54
|
import mime from 'mime';
|
|
55
|
+
import { Worker } from 'worker_threads';
|
|
55
56
|
|
|
56
57
|
var PreInitRingSink = class {
|
|
57
58
|
ring = [];
|
|
@@ -111,13 +112,19 @@ var currentSessionId = null;
|
|
|
111
112
|
function bootstrapRunnerLogStore(opts) {
|
|
112
113
|
const existing = getLogStore();
|
|
113
114
|
if (existing && currentSessionId === opts.sessionId) {
|
|
114
|
-
|
|
115
|
+
const reusedPath = opts.projectDir ? path5.join(opts.projectDir, ".skaile", "logs.db") : void 0;
|
|
116
|
+
return {
|
|
117
|
+
store: existing,
|
|
118
|
+
dispose: () => disposeStore(existing),
|
|
119
|
+
...reusedPath ? { logsDbPath: reusedPath } : {}
|
|
120
|
+
};
|
|
115
121
|
}
|
|
116
122
|
const cfg = resolveLogStoreConfig({
|
|
117
123
|
sessionId: opts.sessionId,
|
|
118
124
|
workspacePath: opts.projectDir,
|
|
119
125
|
yamlBlock: opts.yamlBlock
|
|
120
126
|
});
|
|
127
|
+
const logsDbPath = cfg.mode === "persistent" && cfg.workspacePath ? path5.join(cfg.workspacePath, ".skaile", "logs.db") : void 0;
|
|
121
128
|
const store = createLogStoreFromConfig(cfg);
|
|
122
129
|
if (opts.onLog) {
|
|
123
130
|
store.addSink(new OnLogBridgeSink(opts.onLog));
|
|
@@ -137,7 +144,8 @@ function bootstrapRunnerLogStore(opts) {
|
|
|
137
144
|
disposeStore(store);
|
|
138
145
|
currentSessionId = null;
|
|
139
146
|
},
|
|
140
|
-
...retention ? { retention } : {}
|
|
147
|
+
...retention ? { retention } : {},
|
|
148
|
+
...logsDbPath ? { logsDbPath } : {}
|
|
141
149
|
};
|
|
142
150
|
}
|
|
143
151
|
function scheduleRetention(cfg) {
|
|
@@ -1730,6 +1738,21 @@ function resolveRecordSecretsStrict(record2, secrets, ctx) {
|
|
|
1730
1738
|
}
|
|
1731
1739
|
return resolved;
|
|
1732
1740
|
}
|
|
1741
|
+
function resolveMcpUrl(decl, secrets) {
|
|
1742
|
+
const raw = decl.url ?? "";
|
|
1743
|
+
if (!isKnownSecretRef(raw)) return new URL(raw);
|
|
1744
|
+
const resolved = secrets?.resolve(raw);
|
|
1745
|
+
if (resolved === void 0) {
|
|
1746
|
+
throw new Error(
|
|
1747
|
+
`credential for MCP server '${decl.id}' unavailable \u2014 unresolved secret ref '${raw}' in url`
|
|
1748
|
+
);
|
|
1749
|
+
}
|
|
1750
|
+
try {
|
|
1751
|
+
return new URL(resolved);
|
|
1752
|
+
} catch {
|
|
1753
|
+
throw new Error(`resolved url for MCP server '${decl.id}' is not a valid URL`);
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1733
1756
|
var RESERVED_MCP_SERVER_IDS = /* @__PURE__ */ new Set([
|
|
1734
1757
|
"skaile-connectors",
|
|
1735
1758
|
"skaile-workspace",
|
|
@@ -1864,7 +1887,7 @@ function buildTransport(decl, secrets) {
|
|
|
1864
1887
|
serverId: decl.id,
|
|
1865
1888
|
kind: "header"
|
|
1866
1889
|
});
|
|
1867
|
-
return new SSEClientTransport(
|
|
1890
|
+
return new SSEClientTransport(resolveMcpUrl(decl, secrets), { requestInit: { headers } });
|
|
1868
1891
|
}
|
|
1869
1892
|
if (transport === "http") {
|
|
1870
1893
|
if (!decl.url) throw new Error(`http MCP server '${decl.id}' is missing 'url'`);
|
|
@@ -1872,7 +1895,9 @@ function buildTransport(decl, secrets) {
|
|
|
1872
1895
|
serverId: decl.id,
|
|
1873
1896
|
kind: "header"
|
|
1874
1897
|
});
|
|
1875
|
-
return new StreamableHTTPClientTransport(
|
|
1898
|
+
return new StreamableHTTPClientTransport(resolveMcpUrl(decl, secrets), {
|
|
1899
|
+
requestInit: { headers }
|
|
1900
|
+
});
|
|
1876
1901
|
}
|
|
1877
1902
|
throw new Error(`Unknown MCP transport '${transport}' for server '${decl.id}'`);
|
|
1878
1903
|
}
|
|
@@ -2569,7 +2594,15 @@ function toSdkMcpServerConfig(decl, secrets) {
|
|
|
2569
2594
|
}
|
|
2570
2595
|
if (transport === "sse" || transport === "http") {
|
|
2571
2596
|
if (!decl.url) return null;
|
|
2572
|
-
|
|
2597
|
+
let url = decl.url;
|
|
2598
|
+
if (isKnownSecretRef(url)) {
|
|
2599
|
+
try {
|
|
2600
|
+
url = resolveMcpUrl(decl, secrets).href;
|
|
2601
|
+
} catch {
|
|
2602
|
+
return null;
|
|
2603
|
+
}
|
|
2604
|
+
}
|
|
2605
|
+
const cfg = { type: transport, url };
|
|
2573
2606
|
if (decl.headers && Object.keys(decl.headers).length > 0) {
|
|
2574
2607
|
cfg.headers = resolveRecordSecrets(decl.headers, secrets);
|
|
2575
2608
|
}
|
|
@@ -6905,11 +6938,12 @@ function replyResults(results) {
|
|
|
6905
6938
|
}
|
|
6906
6939
|
function buildLifecycleHandler(deps) {
|
|
6907
6940
|
const { getCompactionOrchestrator, getResourceManager, log } = deps;
|
|
6908
|
-
return async ({ phase }) => {
|
|
6941
|
+
return async ({ phase, trigger }) => {
|
|
6909
6942
|
switch (phase) {
|
|
6910
6943
|
case "compact": {
|
|
6911
6944
|
const orchestrator = getCompactionOrchestrator();
|
|
6912
|
-
if (orchestrator)
|
|
6945
|
+
if (orchestrator)
|
|
6946
|
+
await orchestrator.compact(trigger === "hibernate" ? "hibernate" : "manual");
|
|
6913
6947
|
else log("[lifecycle] compact: no compaction orchestrator \u2014 skipped");
|
|
6914
6948
|
return { ok: true };
|
|
6915
6949
|
}
|
|
@@ -7235,7 +7269,8 @@ var setStateInput = z7.strictObject({
|
|
|
7235
7269
|
value: requiredUnknown
|
|
7236
7270
|
});
|
|
7237
7271
|
var lifecycleInput = z7.strictObject({
|
|
7238
|
-
phase: z7.enum(["hibernate", "close", "compact"])
|
|
7272
|
+
phase: z7.enum(["hibernate", "close", "compact"]),
|
|
7273
|
+
trigger: z7.enum(["manual", "hibernate"]).optional()
|
|
7239
7274
|
});
|
|
7240
7275
|
var reconfigureInputSchema = z7.strictObject({
|
|
7241
7276
|
model: z7.string().trim().min(1).optional(),
|
|
@@ -7406,7 +7441,7 @@ function buildRunnerCapabilities(handlers) {
|
|
|
7406
7441
|
defineCapability({
|
|
7407
7442
|
name: "runner.lifecycle",
|
|
7408
7443
|
displayName: "Session lifecycle",
|
|
7409
|
-
description: "Transition the session lifecycle: hibernate (connectors persist state), close (connectors finalize), or compact conversation history.",
|
|
7444
|
+
description: "Transition the session lifecycle: hibernate (connectors persist state), close (connectors finalize), or compact conversation history (trigger hibernate: no follow-up agent turn).",
|
|
7410
7445
|
side: "agent",
|
|
7411
7446
|
origin: RUNNER_CAP_ORIGIN,
|
|
7412
7447
|
audience: ["runtime"],
|
|
@@ -7602,6 +7637,212 @@ function createSessionStimulusBus(opts) {
|
|
|
7602
7637
|
}
|
|
7603
7638
|
};
|
|
7604
7639
|
}
|
|
7640
|
+
var HEARTBEAT_MS = 1e3;
|
|
7641
|
+
var DEFAULT_STALL_THRESHOLD_MS = 1e4;
|
|
7642
|
+
var PHASE_MAX_BYTES = 240;
|
|
7643
|
+
function wasProcessPaused(input) {
|
|
7644
|
+
if (input.reported || !input.workerAlive) return false;
|
|
7645
|
+
return input.workerSawOwnGap || input.now - input.workerLastTick > input.thresholdMs;
|
|
7646
|
+
}
|
|
7647
|
+
function resolveStallThresholdMs(raw = process.env.SKAILE_RUNNER_STALL_WATCHDOG_MS) {
|
|
7648
|
+
if (raw === void 0 || raw.trim() === "") return DEFAULT_STALL_THRESHOLD_MS;
|
|
7649
|
+
const n = Number(raw);
|
|
7650
|
+
if (!Number.isInteger(n) || n < 0) return DEFAULT_STALL_THRESHOLD_MS;
|
|
7651
|
+
return n;
|
|
7652
|
+
}
|
|
7653
|
+
var WORKER_SOURCE = `
|
|
7654
|
+
const { workerData } = require("node:worker_threads");
|
|
7655
|
+
const fs = require("node:fs");
|
|
7656
|
+
const hb = new BigInt64Array(workerData.heartbeat);
|
|
7657
|
+
const phaseLen = new Int32Array(workerData.phaseLen);
|
|
7658
|
+
const phaseBytes = new Uint8Array(workerData.phaseBytes);
|
|
7659
|
+
const workerTick = new BigInt64Array(workerData.workerTick);
|
|
7660
|
+
// [0] = reported the current stall.
|
|
7661
|
+
const flags = new Int32Array(workerData.flags);
|
|
7662
|
+
// When this thread last saw a gap of its own (the process was paused).
|
|
7663
|
+
const pausedAt = new BigInt64Array(workerData.pausedAt);
|
|
7664
|
+
const stallPhaseLen = new Int32Array(workerData.stallPhaseLen);
|
|
7665
|
+
const stallPhaseBytes = new Uint8Array(workerData.stallPhaseBytes);
|
|
7666
|
+
const decoder = new TextDecoder();
|
|
7667
|
+
const B32 = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
7668
|
+
function ulid(now) {
|
|
7669
|
+
let t = "";
|
|
7670
|
+
for (let i = 0, v = now; i < 10; i++) { t = B32[v % 32] + t; v = Math.floor(v / 32); }
|
|
7671
|
+
let r = "";
|
|
7672
|
+
for (let i = 0; i < 16; i++) r += B32[Math.floor(Math.random() * 32)];
|
|
7673
|
+
return t + r;
|
|
7674
|
+
}
|
|
7675
|
+
function readPhase() {
|
|
7676
|
+
const n = Math.max(0, Math.min(Atomics.load(phaseLen, 0), phaseBytes.length));
|
|
7677
|
+
return decoder.decode(phaseBytes.slice(0, n));
|
|
7678
|
+
}
|
|
7679
|
+
function writeRow(entry) {
|
|
7680
|
+
// Never create the file: a store that is not persistent has no logs.db to append to.
|
|
7681
|
+
if (!workerData.logsDbPath || !fs.existsSync(workerData.logsDbPath)) return;
|
|
7682
|
+
let db;
|
|
7683
|
+
try {
|
|
7684
|
+
if (typeof Bun !== "undefined") {
|
|
7685
|
+
const { Database } = require("bun:sqlite");
|
|
7686
|
+
db = new Database(workerData.logsDbPath);
|
|
7687
|
+
} else {
|
|
7688
|
+
const { DatabaseSync } = require("node:sqlite");
|
|
7689
|
+
db = new DatabaseSync(workerData.logsDbPath);
|
|
7690
|
+
}
|
|
7691
|
+
db.exec("PRAGMA busy_timeout = 1000");
|
|
7692
|
+
db.prepare(
|
|
7693
|
+
"INSERT INTO log_entries (id, timestamp, session_id, kind, subkind, instance, level, message, data_json, error_json) " +
|
|
7694
|
+
"VALUES ($id, $timestamp, $session_id, $kind, $subkind, $instance, $level, $message, $data_json, NULL)"
|
|
7695
|
+
).run({
|
|
7696
|
+
$id: entry.id, $timestamp: entry.timestamp, $session_id: entry.sessionId, $kind: "runner",
|
|
7697
|
+
$subkind: "session", $instance: entry.sessionId, $level: "warn", $message: entry.message,
|
|
7698
|
+
$data_json: JSON.stringify(entry.data),
|
|
7699
|
+
});
|
|
7700
|
+
} catch (err) {
|
|
7701
|
+
try { fs.writeSync(2, "[stall-watchdog] logs.db write failed: " + String(err && err.message || err) + "\\n"); } catch {}
|
|
7702
|
+
} finally {
|
|
7703
|
+
try { db && db.close(); } catch {}
|
|
7704
|
+
}
|
|
7705
|
+
}
|
|
7706
|
+
let reportedFor = 0n;
|
|
7707
|
+
let lastWorkerTick = Date.now();
|
|
7708
|
+
setInterval(() => {
|
|
7709
|
+
const now = Date.now();
|
|
7710
|
+
const selfGap = now - lastWorkerTick;
|
|
7711
|
+
lastWorkerTick = now;
|
|
7712
|
+
Atomics.store(workerTick, 0, BigInt(now));
|
|
7713
|
+
const last = Atomics.load(hb, 0);
|
|
7714
|
+
// This thread stopped too, so the whole process was paused: not a main-thread stall.
|
|
7715
|
+
if (selfGap > workerData.thresholdMs) {
|
|
7716
|
+
Atomics.store(pausedAt, 0, BigInt(now));
|
|
7717
|
+
reportedFor = last;
|
|
7718
|
+
return;
|
|
7719
|
+
}
|
|
7720
|
+
if (last === reportedFor) return;
|
|
7721
|
+
const age = now - Number(last);
|
|
7722
|
+
if (age <= workerData.thresholdMs) return;
|
|
7723
|
+
reportedFor = last;
|
|
7724
|
+
const phase = readPhase();
|
|
7725
|
+
// Handed to the main thread, which may have moved to the next phase before it logs the end.
|
|
7726
|
+
Atomics.store(stallPhaseLen, 0, 0);
|
|
7727
|
+
const n = Math.min(phaseBytes.length, Atomics.load(phaseLen, 0));
|
|
7728
|
+
stallPhaseBytes.set(phaseBytes.subarray(0, n));
|
|
7729
|
+
Atomics.store(stallPhaseLen, 0, n);
|
|
7730
|
+
Atomics.store(flags, 0, 1);
|
|
7731
|
+
const entry = {
|
|
7732
|
+
id: ulid(now),
|
|
7733
|
+
timestamp: new Date(now).toISOString(),
|
|
7734
|
+
sessionId: workerData.sessionId,
|
|
7735
|
+
message: "runner main thread stalled",
|
|
7736
|
+
data: { phase, stalledForMs: age, thresholdMs: workerData.thresholdMs },
|
|
7737
|
+
};
|
|
7738
|
+
try {
|
|
7739
|
+
// The StdoutSink's JSON line shape, so the container log reads like every other entry.
|
|
7740
|
+
fs.writeSync(2, JSON.stringify({ id: entry.id, timestamp: entry.timestamp, sessionId: entry.sessionId,
|
|
7741
|
+
source: { kind: "runner", subkind: "session", instance: entry.sessionId }, level: "warn",
|
|
7742
|
+
message: entry.message, data: entry.data }) + "\\n");
|
|
7743
|
+
} catch {}
|
|
7744
|
+
writeRow(entry);
|
|
7745
|
+
}, workerData.intervalMs);
|
|
7746
|
+
`;
|
|
7747
|
+
function startStallWatchdog(opts) {
|
|
7748
|
+
const thresholdMs = opts.thresholdMs ?? resolveStallThresholdMs();
|
|
7749
|
+
const intervalMs = opts.intervalMs ?? HEARTBEAT_MS;
|
|
7750
|
+
const heartbeat = new BigInt64Array(new SharedArrayBuffer(8));
|
|
7751
|
+
const phaseLen = new Int32Array(new SharedArrayBuffer(4));
|
|
7752
|
+
const phaseBytes = new Uint8Array(new SharedArrayBuffer(PHASE_MAX_BYTES));
|
|
7753
|
+
const workerTick = new BigInt64Array(new SharedArrayBuffer(8));
|
|
7754
|
+
const flags = new Int32Array(new SharedArrayBuffer(4));
|
|
7755
|
+
const pausedAt = new BigInt64Array(new SharedArrayBuffer(8));
|
|
7756
|
+
const stallPhaseLen = new Int32Array(new SharedArrayBuffer(4));
|
|
7757
|
+
const stallPhaseBytes = new Uint8Array(new SharedArrayBuffer(PHASE_MAX_BYTES));
|
|
7758
|
+
const encoder = new TextEncoder();
|
|
7759
|
+
const decoder = new TextDecoder();
|
|
7760
|
+
let phase = "starting";
|
|
7761
|
+
const markPhase = (next) => {
|
|
7762
|
+
phase = next;
|
|
7763
|
+
Atomics.store(phaseLen, 0, 0);
|
|
7764
|
+
const { written } = encoder.encodeInto(next, phaseBytes);
|
|
7765
|
+
Atomics.store(phaseLen, 0, written);
|
|
7766
|
+
};
|
|
7767
|
+
markPhase(phase);
|
|
7768
|
+
if (thresholdMs <= 0) return { markPhase: () => {
|
|
7769
|
+
}, stop: async () => {
|
|
7770
|
+
} };
|
|
7771
|
+
let worker;
|
|
7772
|
+
try {
|
|
7773
|
+
worker = new Worker(WORKER_SOURCE, {
|
|
7774
|
+
eval: true,
|
|
7775
|
+
workerData: {
|
|
7776
|
+
heartbeat: heartbeat.buffer,
|
|
7777
|
+
phaseLen: phaseLen.buffer,
|
|
7778
|
+
phaseBytes: phaseBytes.buffer,
|
|
7779
|
+
workerTick: workerTick.buffer,
|
|
7780
|
+
flags: flags.buffer,
|
|
7781
|
+
pausedAt: pausedAt.buffer,
|
|
7782
|
+
stallPhaseLen: stallPhaseLen.buffer,
|
|
7783
|
+
stallPhaseBytes: stallPhaseBytes.buffer,
|
|
7784
|
+
thresholdMs,
|
|
7785
|
+
intervalMs,
|
|
7786
|
+
sessionId: opts.sessionId,
|
|
7787
|
+
logsDbPath: opts.logsDbPath ?? null
|
|
7788
|
+
}
|
|
7789
|
+
});
|
|
7790
|
+
} catch {
|
|
7791
|
+
return { markPhase: () => {
|
|
7792
|
+
}, stop: async () => {
|
|
7793
|
+
} };
|
|
7794
|
+
}
|
|
7795
|
+
worker.unref();
|
|
7796
|
+
let workerAlive = true;
|
|
7797
|
+
worker.on("error", (err) => {
|
|
7798
|
+
workerAlive = false;
|
|
7799
|
+
try {
|
|
7800
|
+
process.stderr.write(
|
|
7801
|
+
`[stall-watchdog] worker died, stalls are no longer recorded: ${String(err)}
|
|
7802
|
+
`
|
|
7803
|
+
);
|
|
7804
|
+
} catch {
|
|
7805
|
+
}
|
|
7806
|
+
});
|
|
7807
|
+
worker.on("exit", () => {
|
|
7808
|
+
workerAlive = false;
|
|
7809
|
+
});
|
|
7810
|
+
let lastTick = Date.now();
|
|
7811
|
+
Atomics.store(heartbeat, 0, BigInt(lastTick));
|
|
7812
|
+
Atomics.store(workerTick, 0, BigInt(lastTick));
|
|
7813
|
+
const timer = setInterval(() => {
|
|
7814
|
+
const now = Date.now();
|
|
7815
|
+
const gap = now - lastTick;
|
|
7816
|
+
const prevTick = lastTick;
|
|
7817
|
+
lastTick = now;
|
|
7818
|
+
Atomics.store(heartbeat, 0, BigInt(now));
|
|
7819
|
+
if (gap > thresholdMs) {
|
|
7820
|
+
const reported = Atomics.exchange(flags, 0, 0) === 1;
|
|
7821
|
+
const paused = wasProcessPaused({
|
|
7822
|
+
now,
|
|
7823
|
+
workerLastTick: Number(Atomics.load(workerTick, 0)),
|
|
7824
|
+
// Only a gap the worker saw inside this one counts; an old one is stale.
|
|
7825
|
+
workerSawOwnGap: Number(Atomics.load(pausedAt, 0)) > prevTick,
|
|
7826
|
+
workerAlive,
|
|
7827
|
+
reported,
|
|
7828
|
+
thresholdMs
|
|
7829
|
+
});
|
|
7830
|
+
const stallPhase = reported ? decoder.decode(stallPhaseBytes.slice(0, Math.max(0, Atomics.load(stallPhaseLen, 0)))) : phase;
|
|
7831
|
+
try {
|
|
7832
|
+
opts.onRecovered({ stallMs: gap, phase: stallPhase, paused });
|
|
7833
|
+
} catch {
|
|
7834
|
+
}
|
|
7835
|
+
}
|
|
7836
|
+
}, intervalMs);
|
|
7837
|
+
timer.unref?.();
|
|
7838
|
+
return {
|
|
7839
|
+
markPhase,
|
|
7840
|
+
stop: async () => {
|
|
7841
|
+
clearInterval(timer);
|
|
7842
|
+
await worker.terminate().catch(() => 0);
|
|
7843
|
+
}
|
|
7844
|
+
};
|
|
7845
|
+
}
|
|
7605
7846
|
|
|
7606
7847
|
// runner/src/turn-status-replay.ts
|
|
7607
7848
|
var TurnStatusTracker = class {
|
|
@@ -8480,7 +8721,11 @@ async function startAgentServer(opts) {
|
|
|
8480
8721
|
const wsConfig = resolveSkWorkspaceConfig(opts.projectDir);
|
|
8481
8722
|
if (managedHost && wsConfig.agent?.["prompt-extensions"]?.length)
|
|
8482
8723
|
throw new Error("CODEX_MANAGED_PROMPT_EXTENSIONS_UNSUPPORTED");
|
|
8483
|
-
const {
|
|
8724
|
+
const {
|
|
8725
|
+
store: logStore,
|
|
8726
|
+
dispose: disposeLogStoreOnly,
|
|
8727
|
+
logsDbPath
|
|
8728
|
+
} = bootstrapRunnerLogStore({
|
|
8484
8729
|
sessionId,
|
|
8485
8730
|
projectDir: opts.projectDir,
|
|
8486
8731
|
yamlBlock: wsConfig.logging,
|
|
@@ -8501,7 +8746,20 @@ async function startAgentServer(opts) {
|
|
|
8501
8746
|
serverLog.warn("ws auth token file could not be removed", {
|
|
8502
8747
|
code: takenAuthToken.unlinkError
|
|
8503
8748
|
});
|
|
8504
|
-
const
|
|
8749
|
+
const stallWatchdog = startStallWatchdog({
|
|
8750
|
+
sessionId,
|
|
8751
|
+
logsDbPath,
|
|
8752
|
+
onRecovered: ({ stallMs, phase, paused }) => paused ? serverLog.info("runner process was paused", { pausedMs: stallMs, phase }) : serverLog.warn("runner main thread stall ended", { stallMs, phase })
|
|
8753
|
+
});
|
|
8754
|
+
const markPhase = (phase) => stallWatchdog.markPhase(phase);
|
|
8755
|
+
const disposeLogStore = () => {
|
|
8756
|
+
void stallWatchdog.stop();
|
|
8757
|
+
disposeLogStoreOnly();
|
|
8758
|
+
};
|
|
8759
|
+
const logPhase = (phase, startedAt, data) => {
|
|
8760
|
+
markPhase(phase);
|
|
8761
|
+
serverLog.info(`[serve] phase ${phase}`, { ...data, phase, elapsedMs: Date.now() - startedAt });
|
|
8762
|
+
};
|
|
8505
8763
|
const exitOnBrokenPipe = opts.exitOnBrokenPipe ?? false;
|
|
8506
8764
|
const stopOutputWatch = watchOutputStream({ exitOnBrokenPipe });
|
|
8507
8765
|
let teardownProcessHandlers = stopOutputWatch;
|
|
@@ -9829,11 +10087,14 @@ async function startAgentServer(opts) {
|
|
|
9829
10087
|
}
|
|
9830
10088
|
async function rebuildAgentSession(overrides) {
|
|
9831
10089
|
const disposedManager = agentSession.resourceManager;
|
|
10090
|
+
markPhase("session rebuild: snapshotting shared state");
|
|
9832
10091
|
const sharedStateSnapshots = await snapshotInitSharedState();
|
|
9833
10092
|
const disposeStartedAt = Date.now();
|
|
10093
|
+
markPhase("session rebuild: disposing the old session");
|
|
9834
10094
|
await agentSession.dispose();
|
|
9835
10095
|
if (managedHost && managedBootstrapClosed) throw new Error("CODEX_RUNTIME_UNSUPPORTED");
|
|
9836
10096
|
const createStartedAt = Date.now();
|
|
10097
|
+
markPhase("session rebuild: creating the new session");
|
|
9837
10098
|
agentSession = await createAgentSession({ ...sessionConfig, ...overrides });
|
|
9838
10099
|
if (managedHost && managedBootstrapClosed) {
|
|
9839
10100
|
await agentSession.dispose();
|
|
@@ -10106,6 +10367,7 @@ async function startAgentServer(opts) {
|
|
|
10106
10367
|
}
|
|
10107
10368
|
const prevSessionId = driver.runtimeSessionId;
|
|
10108
10369
|
log(`[serve] restarting driver to pick up ${reason} (resume=${prevSessionId ?? "none"})`);
|
|
10370
|
+
markPhase(`driver restart: ${reason}`);
|
|
10109
10371
|
return { resumeSessionId: prevSessionId };
|
|
10110
10372
|
});
|
|
10111
10373
|
}
|
|
@@ -10304,6 +10566,7 @@ async function startAgentServer(opts) {
|
|
|
10304
10566
|
});
|
|
10305
10567
|
const buildSession = async () => {
|
|
10306
10568
|
const firstBuildStartedAt = Date.now();
|
|
10569
|
+
markPhase("session_init: building the session");
|
|
10307
10570
|
const { needsWireFallbackRecreate, needsWireAgentConfigRecreate } = await buildSessionFromInit(cmd.secrets, resolvedConfigToDeclarations(cmd.resolvedConfig));
|
|
10308
10571
|
logPhase("session_build", firstBuildStartedAt, {
|
|
10309
10572
|
resumeRequested: !!cmd.resume?.sessionId
|
|
@@ -10357,6 +10620,7 @@ async function startAgentServer(opts) {
|
|
|
10357
10620
|
}
|
|
10358
10621
|
if (pendingResumeSessionId || cfg.subagents || needsWireFallbackRecreate || needsWireAgentConfigRecreate) {
|
|
10359
10622
|
log("[serve] session_init: consolidated session recreate");
|
|
10623
|
+
markPhase("session_init: consolidated session recreate");
|
|
10360
10624
|
const recreateStartedAt = Date.now();
|
|
10361
10625
|
await recreateSessionForInit(pendingResumeSessionId);
|
|
10362
10626
|
if (needsWireFallbackRecreate) wireConnectorDeclarationsApplied = true;
|
|
@@ -11119,5 +11383,5 @@ function touchSession(state) {
|
|
|
11119
11383
|
}
|
|
11120
11384
|
|
|
11121
11385
|
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, clearPreInitRingSink, clearSession, compileComposition, computeCapabilitySignature, computeDirectoryTotals, connectorRefreshKind, createAgentSession, createFlowConnectorReadiness, createManagedCodexSubpromptDriver, createSessionStimulusBus, defineCapability, deleteSession, dispatchResourceRequest, dispatchRunnerCapabilityInvocation, 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, 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 };
|
|
11122
|
-
//# sourceMappingURL=chunk-
|
|
11123
|
-
//# sourceMappingURL=chunk-
|
|
11386
|
+
//# sourceMappingURL=chunk-3C6Q6TCZ.js.map
|
|
11387
|
+
//# sourceMappingURL=chunk-3C6Q6TCZ.js.map
|