@skaile/workspaces 3.16.1 → 3.17.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 +53 -0
- package/dist/app-sdk/index.js +1 -1
- package/dist/{asset-feeds-TS76HDGE.js → asset-feeds-FQT6GH24.js} +4 -4
- package/dist/{asset-feeds-TS76HDGE.js.map → asset-feeds-FQT6GH24.js.map} +1 -1
- package/dist/asset-manager/index.js +1 -1
- package/dist/bridge/codex-app-server.d.ts +2 -0
- package/dist/bridge/codex-app-server.js +206 -0
- package/dist/bridge/codex-app-server.js.map +1 -0
- package/dist/bridge/drivers/claude-sdk.js +39 -1
- package/dist/bridge/drivers/claude-sdk.js.map +1 -1
- package/dist/bridge/drivers/codex.js +1 -1
- package/dist/bridge/drivers/continue.js +2 -2
- package/dist/bridge/drivers/echo.js +3 -3
- package/dist/bridge/drivers/echo.js.map +1 -1
- package/dist/bridge/drivers/gemini.js +3 -3
- package/dist/bridge/drivers/goose.js +2 -2
- package/dist/bridge/drivers/omp.js +1 -1
- package/dist/bridge/drivers/opencode.js +2 -2
- package/dist/bridge/drivers/qwen.js +3 -3
- package/dist/bridge/index.js +2 -2
- package/dist/bridge/src/codex/native-protocol.generated.d.ts +1325 -0
- package/dist/bridge/src/codex/native-protocol.generated.d.ts.map +1 -0
- package/dist/bridge/src/codex-app-server.d.ts +55 -0
- package/dist/bridge/src/codex-app-server.d.ts.map +1 -0
- package/dist/bridge/src/drivers/claude-sdk.d.ts +12 -0
- package/dist/bridge/src/drivers/claude-sdk.d.ts.map +1 -1
- package/dist/bridge/src/drivers/echo.d.ts.map +1 -1
- package/dist/{chunk-EVQDXN27.js → chunk-2XGFQKNJ.js} +2 -2
- package/dist/{chunk-EVQDXN27.js.map → chunk-2XGFQKNJ.js.map} +1 -1
- package/dist/{chunk-2KBA5OO2.js → chunk-BCOGOM6F.js} +4 -4
- package/dist/{chunk-2KBA5OO2.js.map → chunk-BCOGOM6F.js.map} +1 -1
- package/dist/{chunk-PCDNZROC.js → chunk-CMGYUF5P.js} +6 -6
- package/dist/{chunk-PCDNZROC.js.map → chunk-CMGYUF5P.js.map} +1 -1
- package/dist/{chunk-775OMGVP.js → chunk-EO7IJY3Q.js} +3 -3
- package/dist/{chunk-775OMGVP.js.map → chunk-EO7IJY3Q.js.map} +1 -1
- package/dist/{chunk-VC2MWHRH.js → chunk-EXT2LNST.js} +4 -4
- package/dist/{chunk-VC2MWHRH.js.map → chunk-EXT2LNST.js.map} +1 -1
- package/dist/{chunk-NIUG3MIH.js → chunk-FRER2PEN.js} +2 -2
- package/dist/{chunk-NIUG3MIH.js.map → chunk-FRER2PEN.js.map} +1 -1
- package/dist/{chunk-4J24AU4Q.js → chunk-HEKLK4NG.js} +3 -3
- package/dist/{chunk-4J24AU4Q.js.map → chunk-HEKLK4NG.js.map} +1 -1
- package/dist/{chunk-OEK2ACRR.js → chunk-KCI7DAKE.js} +145 -44
- package/dist/chunk-KCI7DAKE.js.map +1 -0
- package/dist/{chunk-OGTS7QJX.js → chunk-NIQPSQFN.js} +4 -4
- package/dist/{chunk-OGTS7QJX.js.map → chunk-NIQPSQFN.js.map} +1 -1
- package/dist/{chunk-4W2OOVN5.js → chunk-NMAICJUA.js} +3 -3
- package/dist/{chunk-4W2OOVN5.js.map → chunk-NMAICJUA.js.map} +1 -1
- package/dist/{chunk-5FCBPIOK.js → chunk-PBRMY64S.js} +3 -3
- package/dist/{chunk-5FCBPIOK.js.map → chunk-PBRMY64S.js.map} +1 -1
- package/dist/{chunk-QA52GQQN.js → chunk-PYX4WZLJ.js} +6 -6
- package/dist/{chunk-QA52GQQN.js.map → chunk-PYX4WZLJ.js.map} +1 -1
- package/dist/{chunk-QG6C3XOS.js → chunk-QFYEDM63.js} +3 -3
- package/dist/{chunk-QG6C3XOS.js.map → chunk-QFYEDM63.js.map} +1 -1
- package/dist/{chunk-GP2AYOC2.js → chunk-SWUVULBU.js} +2 -2
- package/dist/{chunk-GP2AYOC2.js.map → chunk-SWUVULBU.js.map} +1 -1
- package/dist/{chunk-6KPCHQP5.js → chunk-VT4MPCRK.js} +3 -3
- package/dist/{chunk-6KPCHQP5.js.map → chunk-VT4MPCRK.js.map} +1 -1
- package/dist/{chunk-U2UNQBXB.js → chunk-X7FJ3ES3.js} +3 -3
- package/dist/{chunk-U2UNQBXB.js.map → chunk-X7FJ3ES3.js.map} +1 -1
- package/dist/cli/index.js +31 -31
- package/dist/connectors/index.js +3 -3
- package/dist/{ensure-sources-I2F6XBDJ.js → ensure-sources-4GBXK6UR.js} +4 -4
- package/dist/{ensure-sources-I2F6XBDJ.js.map → ensure-sources-4GBXK6UR.js.map} +1 -1
- package/dist/factory-assets/connectors/box.js +3 -3
- 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/{helpers-Y66CM6LO.js → helpers-26LW4IXY.js} +4 -4
- package/dist/{helpers-Y66CM6LO.js.map → helpers-26LW4IXY.js.map} +1 -1
- package/dist/{library-publish-SNUOWBUD.js → library-publish-IYGHOPEK.js} +6 -6
- package/dist/{library-publish-SNUOWBUD.js.map → library-publish-IYGHOPEK.js.map} +1 -1
- package/dist/{open-library-IO4TSO2H.js → open-library-HH5LST7Z.js} +5 -5
- package/dist/{open-library-IO4TSO2H.js.map → open-library-HH5LST7Z.js.map} +1 -1
- package/dist/{project-OR524CQ3.js → project-U5QRUCBN.js} +5 -5
- package/dist/{project-OR524CQ3.js.map → project-U5QRUCBN.js.map} +1 -1
- package/dist/runner/index.js +7 -7
- package/dist/runner/src/codex-init.d.ts +14 -0
- package/dist/runner/src/codex-init.d.ts.map +1 -0
- package/dist/runner/src/serve.d.ts.map +1 -1
- package/dist/sdk/asset-manager.js +1 -1
- package/dist/sdk/bridge.js +2 -2
- package/dist/sdk/index.js +7 -7
- package/dist/sdk/runner.js +7 -7
- package/dist/sdk/session.js +2 -2
- package/dist/sdk/types.js +1 -1
- package/dist/session/index.js +2 -2
- package/dist/{setup-5OG442AZ.js → setup-XKTBHRWM.js} +4 -4
- package/dist/{setup-5OG442AZ.js.map → setup-XKTBHRWM.js.map} +1 -1
- package/dist/{source-DTV7VK3C.js → source-ODR4IU6R.js} +6 -6
- package/dist/{source-DTV7VK3C.js.map → source-ODR4IU6R.js.map} +1 -1
- package/dist/{source-manifest-publish-HC3K7D63.js → source-manifest-publish-WCJY3GAM.js} +7 -7
- package/dist/{source-manifest-publish-HC3K7D63.js.map → source-manifest-publish-WCJY3GAM.js.map} +1 -1
- package/dist/tui/index.js +7 -7
- package/dist/types/index.js +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/lifecycle.d.ts +43 -0
- package/dist/types/src/lifecycle.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/dist/workspace-plugin/adapters/mcp.js +1 -1
- package/dist/workspace-plugin/index.js +1 -1
- package/package.json +8 -1
- package/dist/chunk-OEK2ACRR.js.map +0 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { WorkspacePlugin } from './chunk-
|
|
1
|
+
import { WorkspacePlugin } from './chunk-2XGFQKNJ.js';
|
|
2
2
|
import { assembleSystemPrompt, buildCapabilitiesPromptSection } from './chunk-W3UDISS2.js';
|
|
3
3
|
import { WebSocketServerTransport } from './chunk-WQ7DE5UC.js';
|
|
4
|
-
import { resolveFlowPath } from './chunk-
|
|
4
|
+
import { resolveFlowPath } from './chunk-HEKLK4NG.js';
|
|
5
5
|
import { findAiAssetsRoot, deployCatalogEntry, undeployCatalogEntry } from './chunk-7BUZQVRR.js';
|
|
6
|
-
import { registerBuiltinConnectors, buildConnectorPromptSection, findMissingPackages, installNpmPackages, ConnectorManager, ConnectorStartupError, buildSdkConnectorTools, driveOrchestratorTurn, SessionNodeExecutor, SessionSubpromptRunner, SessionInlineSubFlowRunner, buildSdkFlowTools } from './chunk-
|
|
6
|
+
import { registerBuiltinConnectors, buildConnectorPromptSection, findMissingPackages, installNpmPackages, ConnectorManager, ConnectorStartupError, buildSdkConnectorTools, driveOrchestratorTurn, SessionNodeExecutor, SessionSubpromptRunner, SessionInlineSubFlowRunner, buildSdkFlowTools } from './chunk-EXT2LNST.js';
|
|
7
7
|
import { loadConnectorDeclarations, SecretProviderChain, PreMintedSecretProvider, InMemorySecretProvider, resolvedConfigToDeclarations, isKnownSecretRef, deriveSingleMaterializedConnectorDeclaration } from './chunk-5KSIVLOX.js';
|
|
8
|
-
import { EventNormalizer } from './chunk-
|
|
8
|
+
import { EventNormalizer } from './chunk-PBRMY64S.js';
|
|
9
9
|
import { SUPPORTED_CLOUDS, probeResumeTranscript, CLOUD_SECRET_ENV_KEYS } from './chunk-3NCGSSCU.js';
|
|
10
10
|
import { classifyClaudeSdkError } from './chunk-GAH4YRCI.js';
|
|
11
|
-
import { createDriver } from './chunk-
|
|
11
|
+
import { createDriver } from './chunk-FRER2PEN.js';
|
|
12
12
|
import { loadFlow } from './chunk-BQMRUH7J.js';
|
|
13
13
|
import { parseFlowDefinition } from './chunk-HY6CIKFH.js';
|
|
14
14
|
import { renderStimulusPrompt } from './chunk-2D5BYAL6.js';
|
|
15
|
-
import { PROTOCOL_VERSION } from './chunk-
|
|
15
|
+
import { PROTOCOL_VERSION } from './chunk-BCOGOM6F.js';
|
|
16
16
|
import { resolveSettings, resolveApiKey, providerEnvKey } from './chunk-CIPK5JMJ.js';
|
|
17
17
|
import { resolveDriverPaths } from './chunk-K5GBV4SA.js';
|
|
18
18
|
import { resolveRuntimeAssets } from './chunk-OIDFK7SG.js';
|
|
@@ -29,7 +29,7 @@ import fs4, { readFile, stat, rm, unlink, mkdir, writeFile, readdir, rename } fr
|
|
|
29
29
|
import path4, { join, resolve, relative, sep, isAbsolute, dirname, basename } from 'path';
|
|
30
30
|
import { existsSync, readFileSync, mkdirSync, writeFileSync, watch, chmodSync, rmSync } from 'fs';
|
|
31
31
|
import { homedir } from 'os';
|
|
32
|
-
import * as
|
|
32
|
+
import * as z6 from 'zod';
|
|
33
33
|
import { z } from 'zod';
|
|
34
34
|
import { createHash, randomUUID } from 'crypto';
|
|
35
35
|
import { execFile } from 'child_process';
|
|
@@ -190,11 +190,11 @@ var MarkdownStreamer = class {
|
|
|
190
190
|
}
|
|
191
191
|
};
|
|
192
192
|
function defineCapability(args) {
|
|
193
|
-
const inputSchema =
|
|
193
|
+
const inputSchema = z6.toJSONSchema(args.input, {
|
|
194
194
|
target: "draft-07",
|
|
195
195
|
io: "input"
|
|
196
196
|
});
|
|
197
|
-
const outputSchema = args.output ?
|
|
197
|
+
const outputSchema = args.output ? z6.toJSONSchema(args.output, {
|
|
198
198
|
target: "draft-07",
|
|
199
199
|
io: "output"
|
|
200
200
|
}) : void 0;
|
|
@@ -545,7 +545,7 @@ function registerCompositionCapabilities(registry, entries) {
|
|
|
545
545
|
scope: "session",
|
|
546
546
|
kind: "query",
|
|
547
547
|
userInvokable: false,
|
|
548
|
-
input:
|
|
548
|
+
input: z6.strictObject({}),
|
|
549
549
|
handler: async (_args, ctx) => {
|
|
550
550
|
ctx.log.info("loading composed asset content", {
|
|
551
551
|
ref: entry.ref,
|
|
@@ -2206,10 +2206,10 @@ function keywordSearch(capabilities, query, limit) {
|
|
|
2206
2206
|
return scored.slice(0, limit).map((x) => x.cap);
|
|
2207
2207
|
}
|
|
2208
2208
|
function builtinCapabilities(registry) {
|
|
2209
|
-
const listFilterSchema =
|
|
2210
|
-
side:
|
|
2211
|
-
originKind:
|
|
2212
|
-
scope:
|
|
2209
|
+
const listFilterSchema = z6.strictObject({
|
|
2210
|
+
side: z6.enum(["client", "agent"]).optional(),
|
|
2211
|
+
originKind: z6.enum(["framework", "client", "agent", "flow", "skill", "mcp", "connector", "mount"]).optional(),
|
|
2212
|
+
scope: z6.enum(["session", "turn"]).optional()
|
|
2213
2213
|
});
|
|
2214
2214
|
return [
|
|
2215
2215
|
defineCapability({
|
|
@@ -2235,9 +2235,9 @@ function builtinCapabilities(registry) {
|
|
|
2235
2235
|
origin: { kind: "framework" },
|
|
2236
2236
|
kind: "query",
|
|
2237
2237
|
userInvokable: false,
|
|
2238
|
-
input:
|
|
2239
|
-
query:
|
|
2240
|
-
limit:
|
|
2238
|
+
input: z6.strictObject({
|
|
2239
|
+
query: z6.string(),
|
|
2240
|
+
limit: z6.number().int().positive().optional()
|
|
2241
2241
|
}),
|
|
2242
2242
|
handler: async ({ query, limit }) => keywordSearch(registry.list(), query, limit ?? 10)
|
|
2243
2243
|
}),
|
|
@@ -2249,7 +2249,7 @@ function builtinCapabilities(registry) {
|
|
|
2249
2249
|
origin: { kind: "framework" },
|
|
2250
2250
|
kind: "query",
|
|
2251
2251
|
userInvokable: false,
|
|
2252
|
-
input:
|
|
2252
|
+
input: z6.strictObject({ name: z6.string() }),
|
|
2253
2253
|
handler: async ({ name }) => {
|
|
2254
2254
|
const cap = registry.resolve(name);
|
|
2255
2255
|
if (!cap) return null;
|
|
@@ -2832,6 +2832,59 @@ async function handleMountResourceRequest(command, manager, emit) {
|
|
|
2832
2832
|
});
|
|
2833
2833
|
}
|
|
2834
2834
|
}
|
|
2835
|
+
var identifier = z6.string().min(1).max(4096);
|
|
2836
|
+
var timestamp = z6.iso.datetime({ offset: true });
|
|
2837
|
+
var common = {
|
|
2838
|
+
configId: identifier,
|
|
2839
|
+
credentialVersion: z6.number().int().nonnegative().safe(),
|
|
2840
|
+
mintedAt: timestamp
|
|
2841
|
+
};
|
|
2842
|
+
var subscription = z6.strictObject({
|
|
2843
|
+
...common,
|
|
2844
|
+
kind: z6.literal("codex-subscription"),
|
|
2845
|
+
accessToken: z6.string().min(1).max(65536),
|
|
2846
|
+
chatgptAccountId: identifier,
|
|
2847
|
+
chatgptPlanType: identifier.optional(),
|
|
2848
|
+
expiresAt: timestamp
|
|
2849
|
+
});
|
|
2850
|
+
var delivery = z6.discriminatedUnion("kind", [
|
|
2851
|
+
subscription,
|
|
2852
|
+
z6.strictObject({
|
|
2853
|
+
...common,
|
|
2854
|
+
kind: z6.literal("openai-api-key"),
|
|
2855
|
+
apiKey: z6.string().min(1).max(65536)
|
|
2856
|
+
})
|
|
2857
|
+
]);
|
|
2858
|
+
function parseCodexCredential(value, now = Date.now()) {
|
|
2859
|
+
const parsed = delivery.safeParse(value);
|
|
2860
|
+
if (!parsed.success) throw new Error("Invalid managed AI credential");
|
|
2861
|
+
const credential = parsed.data;
|
|
2862
|
+
const mintedAt = Date.parse(credential.mintedAt);
|
|
2863
|
+
if (mintedAt > now || credential.kind === "codex-subscription" && (Date.parse(credential.expiresAt) <= now || Date.parse(credential.expiresAt) <= mintedAt))
|
|
2864
|
+
throw new Error("Invalid managed AI credential timestamps");
|
|
2865
|
+
return credential;
|
|
2866
|
+
}
|
|
2867
|
+
function validateCodexInit(cmd, supported, previous) {
|
|
2868
|
+
const requirements = cmd.requiredRuntimeFeatures;
|
|
2869
|
+
if (requirements !== void 0 && (!Array.isArray(requirements) || requirements.some((item) => typeof item !== "string" || !supported.includes(item))))
|
|
2870
|
+
throw new Error("Unsupported runtime: required features are unavailable");
|
|
2871
|
+
const profile = cmd.resolvedConfig.agentConfig;
|
|
2872
|
+
const managed = profile?.driver === "codex" && (profile.authMode !== void 0 || requirements?.includes("codex-app-server-v1"));
|
|
2873
|
+
if ((managed || cmd.credentials.ai !== void 0) && !supported.includes("codex-app-server-v1"))
|
|
2874
|
+
throw new Error("Unsupported runtime: codex-app-server-v1 is unavailable");
|
|
2875
|
+
if (!managed && cmd.credentials.ai === void 0) return;
|
|
2876
|
+
if (previous && ["containerId", "sessionId", "projectId", "ownerUserId"].some(
|
|
2877
|
+
(key) => previous[key] !== cmd.identity[key]
|
|
2878
|
+
))
|
|
2879
|
+
throw new Error("Invalid managed AI session identity");
|
|
2880
|
+
if (!managed || profile?.provider !== "openai" || !["subscription", "api-key"].includes(profile.authMode ?? ""))
|
|
2881
|
+
throw new Error("Invalid managed OpenAI profile");
|
|
2882
|
+
const credential = parseCodexCredential(cmd.credentials.ai);
|
|
2883
|
+
if (credential.configId !== cmd.resolvedConfig.aiProviderConfigId || profile.authMode === "subscription" !== (credential.kind === "codex-subscription"))
|
|
2884
|
+
throw new Error("Invalid managed AI credential binding");
|
|
2885
|
+
if (cmd.secrets && Object.keys(cmd.secrets).some((key) => /openai|codex/i.test(key)))
|
|
2886
|
+
throw new Error("Conflicting managed AI credential delivery");
|
|
2887
|
+
}
|
|
2835
2888
|
var MINT_RETRY_MAX_ATTEMPTS = 3;
|
|
2836
2889
|
var MINT_RETRY_BASE_DELAY_MS = 2e3;
|
|
2837
2890
|
var MINT_RETRY_MAX_DELAY_MS = 5e3;
|
|
@@ -4376,54 +4429,54 @@ function notImplemented(name) {
|
|
|
4376
4429
|
message: `${name} handler not configured`
|
|
4377
4430
|
};
|
|
4378
4431
|
}
|
|
4379
|
-
var requiredUnknown =
|
|
4380
|
-
var preMintedTokenSchema =
|
|
4381
|
-
token:
|
|
4382
|
-
expiresAt:
|
|
4432
|
+
var requiredUnknown = z6.unknown().refine(() => true);
|
|
4433
|
+
var preMintedTokenSchema = z6.object({
|
|
4434
|
+
token: z6.string(),
|
|
4435
|
+
expiresAt: z6.string().nullable().optional()
|
|
4383
4436
|
}).optional();
|
|
4384
|
-
var mountDeclarationInput =
|
|
4437
|
+
var mountDeclarationInput = z6.strictObject({
|
|
4385
4438
|
declaration: requiredUnknown,
|
|
4386
4439
|
preMintedToken: preMintedTokenSchema,
|
|
4387
4440
|
// The platform attaches a workspace-migration directive on add_mount; the
|
|
4388
4441
|
// handler ignores it for now (replace-workspace hot-migration is a follow-up).
|
|
4389
4442
|
// Accepted here so a real platform add_mount payload validates.
|
|
4390
|
-
migration:
|
|
4443
|
+
migration: z6.unknown().optional()
|
|
4391
4444
|
});
|
|
4392
|
-
var connectorDeclarationInput =
|
|
4445
|
+
var connectorDeclarationInput = z6.strictObject({
|
|
4393
4446
|
declaration: requiredUnknown,
|
|
4394
4447
|
preMintedToken: preMintedTokenSchema
|
|
4395
4448
|
});
|
|
4396
|
-
var addMcpServerInputSchema =
|
|
4449
|
+
var addMcpServerInputSchema = z6.strictObject({
|
|
4397
4450
|
declaration: requiredUnknown,
|
|
4398
4451
|
preMintedToken: preMintedTokenSchema
|
|
4399
4452
|
});
|
|
4400
|
-
var attachInstanceInputSchema =
|
|
4401
|
-
kind:
|
|
4402
|
-
name:
|
|
4453
|
+
var attachInstanceInputSchema = z6.strictObject({
|
|
4454
|
+
kind: z6.string(),
|
|
4455
|
+
name: z6.string(),
|
|
4403
4456
|
preMintedToken: preMintedTokenSchema
|
|
4404
4457
|
});
|
|
4405
|
-
var removeResourceInput =
|
|
4406
|
-
id:
|
|
4458
|
+
var removeResourceInput = z6.strictObject({
|
|
4459
|
+
id: z6.string()
|
|
4407
4460
|
});
|
|
4408
|
-
var updateCredentialInput =
|
|
4409
|
-
kind:
|
|
4410
|
-
id:
|
|
4461
|
+
var updateCredentialInput = z6.strictObject({
|
|
4462
|
+
kind: z6.enum(["mount", "connector"]),
|
|
4463
|
+
id: z6.string(),
|
|
4411
4464
|
// `CredentialMint` is a discriminated union from `@skaile/workspaces/types`.
|
|
4412
4465
|
// We accept it as `z.unknown()` here because Zod can't easily mirror
|
|
4413
4466
|
// a discriminated TypeScript union without duplicating the schema —
|
|
4414
4467
|
// the platform side has already validated the shape before sending.
|
|
4415
4468
|
mint: requiredUnknown
|
|
4416
4469
|
});
|
|
4417
|
-
var setLogLevelInput =
|
|
4418
|
-
level:
|
|
4470
|
+
var setLogLevelInput = z6.strictObject({
|
|
4471
|
+
level: z6.enum(["silent", "error", "warn", "info", "debug", "trace"])
|
|
4419
4472
|
});
|
|
4420
|
-
var setStateInput =
|
|
4421
|
-
store:
|
|
4422
|
-
key:
|
|
4473
|
+
var setStateInput = z6.strictObject({
|
|
4474
|
+
store: z6.string(),
|
|
4475
|
+
key: z6.string(),
|
|
4423
4476
|
value: requiredUnknown
|
|
4424
4477
|
});
|
|
4425
|
-
var lifecycleInput =
|
|
4426
|
-
phase:
|
|
4478
|
+
var lifecycleInput = z6.strictObject({
|
|
4479
|
+
phase: z6.enum(["hibernate", "close", "compact"])
|
|
4427
4480
|
});
|
|
4428
4481
|
var VALID_LOG_STORE_LEVELS = /* @__PURE__ */ new Set(["debug", "info", "warn", "error"]);
|
|
4429
4482
|
function buildRunnerCapabilities(handlers) {
|
|
@@ -5432,6 +5485,7 @@ async function startAgentServer(opts) {
|
|
|
5432
5485
|
instance: sessionId
|
|
5433
5486
|
});
|
|
5434
5487
|
const log = (line) => serverLog.info(line);
|
|
5488
|
+
const logPhase = (phase, startedAt, data) => serverLog.info(`[serve] phase ${phase}`, { ...data, phase, elapsedMs: Date.now() - startedAt });
|
|
5435
5489
|
const exitOnBrokenPipe = opts.exitOnBrokenPipe ?? false;
|
|
5436
5490
|
const stopOutputWatch = watchOutputStream({ exitOnBrokenPipe });
|
|
5437
5491
|
let teardownProcessHandlers = stopOutputWatch;
|
|
@@ -6478,8 +6532,15 @@ async function startAgentServer(opts) {
|
|
|
6478
6532
|
}
|
|
6479
6533
|
async function recreateAgentSessionInner(overrides) {
|
|
6480
6534
|
const disposedManager = agentSession.resourceManager;
|
|
6535
|
+
const disposeStartedAt = Date.now();
|
|
6481
6536
|
await agentSession.dispose();
|
|
6537
|
+
const createStartedAt = Date.now();
|
|
6482
6538
|
agentSession = await createAgentSession({ ...sessionConfig, ...overrides });
|
|
6539
|
+
logPhase("session_rebuild", disposeStartedAt, {
|
|
6540
|
+
disposeMs: createStartedAt - disposeStartedAt,
|
|
6541
|
+
createMs: Date.now() - createStartedAt,
|
|
6542
|
+
resuming: !!overrides.resumeSessionId
|
|
6543
|
+
});
|
|
6483
6544
|
emitSystemPromptComposed(agentSession, sendEvent);
|
|
6484
6545
|
swapDriver();
|
|
6485
6546
|
rebuildCompactionOrchestrator();
|
|
@@ -6711,7 +6772,9 @@ async function startAgentServer(opts) {
|
|
|
6711
6772
|
}))
|
|
6712
6773
|
});
|
|
6713
6774
|
}
|
|
6775
|
+
let runtimeRejected = false;
|
|
6714
6776
|
async function handleSessionInit(cmd) {
|
|
6777
|
+
const initReceivedAt = Date.now();
|
|
6715
6778
|
if (cmd.protocolVersion.major !== PROTOCOL_VERSION.major) {
|
|
6716
6779
|
log(
|
|
6717
6780
|
`[serve] incompatible protocol: agent=${PROTOCOL_VERSION.major} platform=${cmd.protocolVersion.major}`
|
|
@@ -6726,6 +6789,22 @@ async function startAgentServer(opts) {
|
|
|
6726
6789
|
disposeLogStore();
|
|
6727
6790
|
return;
|
|
6728
6791
|
}
|
|
6792
|
+
try {
|
|
6793
|
+
validateCodexInit(cmd, [], runtimeIdentity ?? void 0);
|
|
6794
|
+
} catch {
|
|
6795
|
+
runtimeRejected = true;
|
|
6796
|
+
sendEvent({
|
|
6797
|
+
type: "error",
|
|
6798
|
+
fatal: true,
|
|
6799
|
+
category: "config",
|
|
6800
|
+
message: "Unsupported runtime: managed Codex initialization is unavailable or invalid"
|
|
6801
|
+
});
|
|
6802
|
+
await cleanup();
|
|
6803
|
+
teardownProcessHandlers();
|
|
6804
|
+
disposeLogStore();
|
|
6805
|
+
await transport.close();
|
|
6806
|
+
return;
|
|
6807
|
+
}
|
|
6729
6808
|
if (runtimeIdentity && runtimeIdentity.containerId !== cmd.identity.containerId) {
|
|
6730
6809
|
log(
|
|
6731
6810
|
`[serve] session_init_mismatch: expected=${runtimeIdentity.containerId} received=${cmd.identity.containerId}`
|
|
@@ -6760,7 +6839,11 @@ async function startAgentServer(opts) {
|
|
|
6760
6839
|
...resumeProbe ? { resumeProbe } : {}
|
|
6761
6840
|
});
|
|
6762
6841
|
const buildSession = async () => {
|
|
6842
|
+
const firstBuildStartedAt = Date.now();
|
|
6763
6843
|
const { needsWireFallbackRecreate, needsWireAgentConfigRecreate } = await buildSessionFromInit(cmd.secrets, resolvedConfigToDeclarations(cmd.resolvedConfig));
|
|
6844
|
+
logPhase("session_build", firstBuildStartedAt, {
|
|
6845
|
+
resumeRequested: !!cmd.resume?.sessionId
|
|
6846
|
+
});
|
|
6764
6847
|
const cfg = {
|
|
6765
6848
|
aiResources: cmd.resolvedConfig.aiResources,
|
|
6766
6849
|
subagents: cmd.resolvedConfig.subagents,
|
|
@@ -6801,7 +6884,11 @@ async function startAgentServer(opts) {
|
|
|
6801
6884
|
}
|
|
6802
6885
|
if (pendingResumeSessionId || cfg.subagents || needsWireFallbackRecreate || needsWireAgentConfigRecreate) {
|
|
6803
6886
|
log("[serve] session_init: consolidated session recreate");
|
|
6887
|
+
const recreateStartedAt = Date.now();
|
|
6804
6888
|
await recreateSessionForInit(pendingResumeSessionId);
|
|
6889
|
+
logPhase("session_recreate", recreateStartedAt, {
|
|
6890
|
+
resuming: !!pendingResumeSessionId
|
|
6891
|
+
});
|
|
6805
6892
|
}
|
|
6806
6893
|
if (cfg.sharedState) {
|
|
6807
6894
|
const handled = await applyInitSharedState(cfg.sharedState);
|
|
@@ -6810,10 +6897,15 @@ async function startAgentServer(opts) {
|
|
|
6810
6897
|
if (cfg.aiResources) {
|
|
6811
6898
|
await applyInitAiResources(cfg.aiResources);
|
|
6812
6899
|
}
|
|
6900
|
+
logPhase("session_ready", initReceivedAt, {
|
|
6901
|
+
ready: true,
|
|
6902
|
+
resumeRequested: !!cmd.resume?.sessionId
|
|
6903
|
+
});
|
|
6813
6904
|
resolveSessionReady();
|
|
6814
6905
|
};
|
|
6815
6906
|
void buildSession().catch((err) => {
|
|
6816
6907
|
const errMsg = err instanceof Error ? err.message : String(err);
|
|
6908
|
+
logPhase("session_ready", initReceivedAt, { ready: false });
|
|
6817
6909
|
log(`[serve] session_init failed to build session: ${errMsg}`);
|
|
6818
6910
|
sendEvent({ type: "error", message: errMsg, fatal: true });
|
|
6819
6911
|
rejectSessionReady(err instanceof Error ? err : new Error(errMsg));
|
|
@@ -6822,7 +6914,10 @@ async function startAgentServer(opts) {
|
|
|
6822
6914
|
const awaitCompactionIdle = (what) => guardTurnAgainstCompaction({ gate: compactionGate, what, log, sendEvent });
|
|
6823
6915
|
async function handlePrompt(cmd) {
|
|
6824
6916
|
if (cmd.messageId) sendEvent({ type: "prompt_ack", messageId: cmd.messageId });
|
|
6825
|
-
|
|
6917
|
+
const promptReceivedAt = Date.now();
|
|
6918
|
+
const sessionIsReady = await awaitSessionReadyOrFail();
|
|
6919
|
+
logPhase("prompt_gate_wait", promptReceivedAt, { ready: sessionIsReady });
|
|
6920
|
+
if (!sessionIsReady) return;
|
|
6826
6921
|
if (!secretsProvisioned) {
|
|
6827
6922
|
log("[serve] prompt received before secrets provisioned \u2014 rejecting");
|
|
6828
6923
|
sendEvent({
|
|
@@ -6862,13 +6957,18 @@ async function startAgentServer(opts) {
|
|
|
6862
6957
|
}
|
|
6863
6958
|
return;
|
|
6864
6959
|
}
|
|
6960
|
+
const driverStartStartedAt = Date.now();
|
|
6961
|
+
let driverStartOk = false;
|
|
6865
6962
|
try {
|
|
6866
6963
|
await ensureDriverStarted();
|
|
6964
|
+
driverStartOk = true;
|
|
6867
6965
|
} catch (err) {
|
|
6868
6966
|
const errMsg = err instanceof Error ? err.message : String(err);
|
|
6869
6967
|
log(`[serve] driver start failed: ${errMsg}`);
|
|
6870
6968
|
sendEvent({ type: "error", message: `Driver start failed: ${errMsg}`, fatal: true });
|
|
6871
6969
|
return;
|
|
6970
|
+
} finally {
|
|
6971
|
+
logPhase("driver_start", driverStartStartedAt, { ok: driverStartOk });
|
|
6872
6972
|
}
|
|
6873
6973
|
sendEvent({ type: "status", phase: "thinking" });
|
|
6874
6974
|
const endTurn = driverSwapGate.beginTurn();
|
|
@@ -7129,6 +7229,7 @@ async function startAgentServer(opts) {
|
|
|
7129
7229
|
}
|
|
7130
7230
|
}
|
|
7131
7231
|
async function handleCommand(cmd) {
|
|
7232
|
+
if (runtimeRejected) return;
|
|
7132
7233
|
const inbound = cmd;
|
|
7133
7234
|
if (isCredentialRotatedSignal(cmd)) {
|
|
7134
7235
|
await handleCredentialRotatedSignal({
|
|
@@ -7426,5 +7527,5 @@ function touchSession(state) {
|
|
|
7426
7527
|
}
|
|
7427
7528
|
|
|
7428
7529
|
export { CLAUDE_CODE_CREDENTIALS_KEY, COMPILE_MANIFEST_FILENAME, 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_TREE_OP_DEADLINE_FACTOR, MarkdownStreamer, PreInitRingSink, agentDefinitionExists, bootstrapCapabilityRegistry, bootstrapRunnerLogStore, buildAgentResources, buildClientCapabilityHandler, buildConnectorTokenMediator, buildContextSection, buildEnvironmentSection, buildResourcesAvailablePayload, buildStoreSnapshotReplay, builtinCapabilities, capabilityLogInstance, clearPreInitRingSink, clearSession, compileComposition, computeCapabilitySignature, connectorRefreshKind, createAgentSession, createFlowConnectorReadiness, createSessionStimulusBus, defineCapability, deleteSession, dispatchRunnerCapabilityInvocation, emitSystemPromptComposed, ensureClaudeSettingsDisablesConnectors, ensureGitConfigInclude, executeConnectorMutate, extractClaudeAiOauthExpiresAt, getPreInitRingSink, handleMountResourceRequest, handleResourceRequest, hasNonTerminalFlow, hostOpResumeStimulus, installPreInitRingSink, isTerminalFlowStatus, listSessions, loadAgentManifest, loadCompileManifest, loadCompileManifestFromDir, loadSession, loadSessionById, mcpAuthSecretKey, newSession, nulTailPaddingLength, pickRepointedManager, planFlowMutate, reconcilePendingDecisions, registerActiveFlow, registerCompositionCapabilities, rejectCapabilityOnApprovalDeny, resetRunnerLogStore, resolveAgentComposition, resolveAgentMixins, resolveBinding, resolveCapabilityCallTimeoutMs, resolveCapabilityResult, resolveComposition, resolveFlowMutateConnectorWaitMs, resolveMixin, runAgentChat, saveSession, setCurrentSession, setUpFlowConnector, startAgentServer, stimulusFromMetas, touchSession, validateInputResponse, writeClaudeCodeCredentialsFile };
|
|
7429
|
-
//# sourceMappingURL=chunk-
|
|
7430
|
-
//# sourceMappingURL=chunk-
|
|
7530
|
+
//# sourceMappingURL=chunk-KCI7DAKE.js.map
|
|
7531
|
+
//# sourceMappingURL=chunk-KCI7DAKE.js.map
|